Skip to content

Commit

Permalink
chore: misc fixes from 4x branch
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Dec 19, 2024
1 parent 06ba47b commit c8ebf57
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 44 deletions.
2 changes: 1 addition & 1 deletion packages/-ember-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"@ember/test-waiters": "^3.1.0",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@types/qunit": "^2.19.10",
"@types/qunit": "2.19.10",
"@ember/test-helpers": "4.0.4",
"@warp-drive/internal-config": "workspace:*",
"ember-source": "~5.12.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/experiments/src/persisted-cache/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export class PersistedCache implements Cache {
* @method changedAttrs
* @internal
* @param identifier
* @returns
* @return
*/
changedAttrs(identifier: StableRecordIdentifier): ChangedAttributesHash {
return this._cache.changedAttrs(identifier);
Expand Down Expand Up @@ -524,7 +524,7 @@ export class PersistedCache implements Cache {
* @method getErrors
* @internal
* @param identifier
* @returns
* @return
*/
getErrors(identifier: StableRecordIdentifier): ApiError[] {
return this._cache.getErrors(identifier);
Expand Down
2 changes: 1 addition & 1 deletion packages/model/src/-private/many-array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ type PromiseProxyRecord = { then(): void; content: OpaqueRecordInstance | null |

function assertRecordPassedToHasMany(record: OpaqueRecordInstance | PromiseProxyRecord) {
assert(
`All elements of a hasMany relationship must be instances of Model, you passed $${typeof record}`,
`All elements of a hasMany relationship must be instances of Model, you passed ${typeof record}`,
(function () {
try {
recordIdentifierFor(record);
Expand Down
14 changes: 0 additions & 14 deletions packages/model/src/-private/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,6 @@ export function isElementDescriptor(args: unknown[]): args is [object, string, D
);
}

export type DataDecorator = (
target: object,
key: string,
desc?: DecoratorPropertyDescriptor
) => DecoratorPropertyDescriptor;
export type DataDecoratorFactory = (...args: unknown[]) => DataDecorator;

export function computedMacroWithOptionalParams(fn: DataDecorator | DataDecoratorFactory) {
return (...maybeDesc: unknown[]) =>
isElementDescriptor(maybeDesc)
? (fn as DataDecoratorFactory)()(...maybeDesc)
: fn(...(maybeDesc as [object, string, DecoratorPropertyDescriptor?]));
}

export function normalizeModelName(type: string): string {
if (DEPRECATE_NON_STRICT_TYPES) {
const result = dasherize(type);
Expand Down
9 changes: 8 additions & 1 deletion packages/store/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@
import { globalIgnores } from '@warp-drive/internal-config/eslint/ignore.js';
import * as node from '@warp-drive/internal-config/eslint/node.js';
import * as typescript from '@warp-drive/internal-config/eslint/typescript.js';
import * as js from '@warp-drive/internal-config/eslint/browser.js';
import { externals } from './vite.config.mjs';

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
// all ================
globalIgnores(),

js.browser({
srcDirs: ['src'],
allowedImports: externals,
}),

// browser (js/ts) ================
typescript.browser({
srcDirs: ['src'],
allowedImports: ['@ember/debug', '@ember/object'],
allowedImports: externals,
}),

// node (module) ================
Expand Down
2 changes: 1 addition & 1 deletion packages/store/src/-private/caches/resource-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function isResource(resource: unknown): resource is Record<string, unknown> {

function hasProp<T extends string, K extends { [J in T]: string }>(resource: unknown, prop: T): resource is K {
return Boolean(
isResource(resource) && prop in resource && typeof resource[prop] === 'string' && (resource[prop] as string).length
isResource(resource) && prop in resource && typeof resource[prop] === 'string' && resource[prop].length
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @module @ember-data/store
*/
// eslint-disable-next-line no-restricted-imports

import { _backburner } from '@ember/runloop';

import { LOG_NOTIFICATIONS } from '@warp-drive/build-config/debugging';
Expand Down
1 change: 1 addition & 0 deletions packages/tracking/src/-private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ export function createSignal<T extends object>(obj: T, key: string): Signal {
}
const modelName =
tryGet('$type') ?? tryGet('modelName') ?? tryGet<{ modelName?: string }>('constructor')?.modelName ?? '';

const className = obj.constructor?.name ?? obj.toString?.() ?? 'unknown';
_signal._debug_base = `${className}${modelName && !className.startsWith('SchemaRecord') ? `:${modelName}` : ''}`;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/unpublished-test-infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"@ember/test-helpers": "4.0.4",
"@glimmer/component": "^1.1.2",
"@types/semver": "^7.5.8",
"@types/qunit": "^2.19.10",
"@types/qunit": "2.19.10",
"@ember-data/request": "workspace:*",
"@ember-data/request-utils": "workspace:*",
"@ember-data/store": "workspace:*",
Expand Down
21 changes: 12 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/ember-data__model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"@ember/test-helpers": "4.0.4",
"@ember/test-waiters": "^3.1.0",
"@embroider/addon-shim": "^1.8.9",
"@embroider/macros": "^1.16.6",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@warp-drive/core-types": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion tests/ember-data__serializer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"ember-cli-inject-live-reload": "^2.1.0",
"ember-load-initializers": "^2.1.2",
"ember-maybe-import-regenerator": "^1.0.0",
"ember-qunit": "^8.0.2",
"ember-qunit": "8.0.2",
"ember-resolver": "^11.0.1",
"ember-source": "~5.12.0",
"loader.js": "^4.7.0",
Expand Down
3 changes: 0 additions & 3 deletions tests/embroider-basic-compat/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ module.exports = async function (defaults) {

setConfig(app, __dirname, {
compatWith: process.env.EMBER_DATA_FULL_COMPAT ? '99.0' : null,
deprecations: {
DEPRECATE_CATCH_ALL: false,
},
});

const { Webpack } = require('@embroider/webpack');
Expand Down
2 changes: 1 addition & 1 deletion tests/embroider-basic-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"ember-inflector": "4.0.3",
"ember-load-initializers": "^2.1.2",
"ember-maybe-import-regenerator": "^1.0.0",
"ember-qunit": "^8.0.2",
"ember-qunit": "8.0.2",
"ember-resolver": "^11.0.1",
"ember-simple-tree": "^0.8.4",
"ember-source": "~5.12.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/fastboot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"ember-inflector": "4.0.3",
"ember-load-initializers": "^2.1.2",
"ember-maybe-import-regenerator": "^1.0.0",
"ember-qunit": "^8.0.2",
"ember-qunit": "8.0.2",
"ember-resolver": "^11.0.1",
"ember-simple-tree": "^0.8.4",
"ember-source": "~5.12.0",
Expand Down
5 changes: 1 addition & 4 deletions tests/main/config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = function () {
name: 'ember-lts-4.4',
npm: {
devDependencies: {
'@ember/test-helpers': '3.3.0',
'ember-source': '~4.4.0',
},
},
Expand All @@ -36,9 +35,8 @@ module.exports = function () {
name: 'ember-lts-3.28',
npm: {
devDependencies: {
'@ember/test-helpers': '3.3.0',
'ember-cli': '~4.12.3',
'ember-source': '~3.28.0',
'ember-cli': '~4.12.2',
},
},
},
Expand All @@ -47,7 +45,6 @@ module.exports = function () {
npm: {
devDependencies: {
'ember-source': urls[0],
'@glimmer/component': '^1.1.2',
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions tests/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"@glint/environment-ember-loose": "1.5.0",
"@glint/environment-ember-template-imports": "1.5.0",
"@glint/template": "1.5.0",
"@types/qunit": "^2.19.10",
"@types/qunit": "2.19.10",
"@warp-drive/core-types": "workspace:*",
"@warp-drive/schema-record": "workspace:*",
"@warp-drive/build-config": "workspace:*",
Expand Down Expand Up @@ -135,7 +135,7 @@
"ember-load-initializers": "^2.1.2",
"ember-maybe-import-regenerator": "^1.0.0",
"ember-template-imports": "4.1.3",
"ember-qunit": "^8.0.2",
"ember-qunit": "8.0.2",
"ember-resolver": "^11.0.1",
"ember-source": "~5.12.0",
"ember-source-channel-url": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/warp-drive__schema-record/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@glint/environment-ember-loose": "1.5.0",
"@glint/environment-ember-template-imports": "1.5.0",
"@glint/template": "1.5.0",
"@types/qunit": "^2.19.10",
"@types/qunit": "2.19.10",
"@warp-drive/core-types": "workspace:*",
"@warp-drive/internal-config": "workspace:*",
"@warp-drive/schema-record": "workspace:*",
Expand Down

0 comments on commit c8ebf57

Please sign in to comment.