From c07eda4eacd78b4d3f08bd32358436ce1620b364 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Mon, 31 Oct 2022 13:45:37 -0700 Subject: [PATCH 1/9] feat: @ember-data/store as v2-lite addon --- .eslintrc.js | 1 + ember-data-types/q/identifier.ts | 2 +- .../q/minimum-adapter-interface.ts | 2 +- package.json | 4 +- .../-private/legacy-relationships-support.ts | 2 +- packages/model/addon/-private/many-array.ts | 2 +- .../private-build-infra/src/v1-addon-main.js | 36 +++++++++++ .../src/v2-babel-build-pack.js | 34 +++++++++++ packages/store/addon-main.js | 5 ++ packages/store/babel.config.js | 13 ++++ packages/store/index.js | 49 --------------- packages/store/package.json | 36 +++++++++-- packages/store/rollup.config.mjs | 59 +++++++++++++++++++ packages/store/src/-private.ts | 1 + .../-private/caches/identifier-cache.ts | 0 .../-private/caches/instance-cache.ts | 0 .../-private/caches/record-data-for.ts | 0 .../store/{addon => src}/-private/index.ts | 0 .../legacy-model-support/record-reference.ts | 0 .../schema-definition-service.ts | 0 .../legacy-model-support/shim-model-class.ts | 0 .../-private/managers/record-array-manager.ts | 0 .../-private/managers/record-data-manager.ts | 0 .../managers/record-data-store-wrapper.ts | 0 .../managers/record-notification-manager.ts | 0 .../-private/network/fetch-manager.ts | 0 .../-private/network/finders.js | 0 .../-private/network/request-cache.ts | 0 .../-private/network/snapshot-record-array.ts | 0 .../-private/network/snapshot.ts | 0 .../-private/proxies/promise-proxies.ts | 0 .../-private/proxies/promise-proxy-base.d.ts | 0 .../-private/proxies/promise-proxy-base.js | 0 .../record-arrays/identifier-array.ts | 0 .../{addon => src}/-private/store-service.ts | 0 .../-private/utils/coerce-id.ts | 0 .../{addon => src}/-private/utils/common.js | 0 .../-private/utils/construct-resource.ts | 0 .../-private/utils/identifer-debug-consts.ts | 0 .../-private/utils/is-non-empty-string.ts | 0 .../-private/utils/normalize-model-name.ts | 0 .../-private/utils/promise-record.ts | 0 .../-private/utils/serializer-response.ts | 0 .../-private/utils/uuid-polyfill.ts | 0 packages/store/{addon => src}/.gitkeep | 0 packages/store/{addon => src}/index.ts | 0 packages/tracking/package.json | 2 +- tsconfig.json | 36 +++++------ 48 files changed, 204 insertions(+), 80 deletions(-) create mode 100644 packages/private-build-infra/src/v1-addon-main.js create mode 100644 packages/private-build-infra/src/v2-babel-build-pack.js create mode 100644 packages/store/addon-main.js create mode 100644 packages/store/babel.config.js delete mode 100644 packages/store/index.js create mode 100644 packages/store/rollup.config.mjs create mode 100644 packages/store/src/-private.ts rename packages/store/{addon => src}/-private/caches/identifier-cache.ts (100%) rename packages/store/{addon => src}/-private/caches/instance-cache.ts (100%) rename packages/store/{addon => src}/-private/caches/record-data-for.ts (100%) rename packages/store/{addon => src}/-private/index.ts (100%) rename packages/store/{addon => src}/-private/legacy-model-support/record-reference.ts (100%) rename packages/store/{addon => src}/-private/legacy-model-support/schema-definition-service.ts (100%) rename packages/store/{addon => src}/-private/legacy-model-support/shim-model-class.ts (100%) rename packages/store/{addon => src}/-private/managers/record-array-manager.ts (100%) rename packages/store/{addon => src}/-private/managers/record-data-manager.ts (100%) rename packages/store/{addon => src}/-private/managers/record-data-store-wrapper.ts (100%) rename packages/store/{addon => src}/-private/managers/record-notification-manager.ts (100%) rename packages/store/{addon => src}/-private/network/fetch-manager.ts (100%) rename packages/store/{addon => src}/-private/network/finders.js (100%) rename packages/store/{addon => src}/-private/network/request-cache.ts (100%) rename packages/store/{addon => src}/-private/network/snapshot-record-array.ts (100%) rename packages/store/{addon => src}/-private/network/snapshot.ts (100%) rename packages/store/{addon => src}/-private/proxies/promise-proxies.ts (100%) rename packages/store/{addon => src}/-private/proxies/promise-proxy-base.d.ts (100%) rename packages/store/{addon => src}/-private/proxies/promise-proxy-base.js (100%) rename packages/store/{addon => src}/-private/record-arrays/identifier-array.ts (100%) rename packages/store/{addon => src}/-private/store-service.ts (100%) rename packages/store/{addon => src}/-private/utils/coerce-id.ts (100%) rename packages/store/{addon => src}/-private/utils/common.js (100%) rename packages/store/{addon => src}/-private/utils/construct-resource.ts (100%) rename packages/store/{addon => src}/-private/utils/identifer-debug-consts.ts (100%) rename packages/store/{addon => src}/-private/utils/is-non-empty-string.ts (100%) rename packages/store/{addon => src}/-private/utils/normalize-model-name.ts (100%) rename packages/store/{addon => src}/-private/utils/promise-record.ts (100%) rename packages/store/{addon => src}/-private/utils/serializer-response.ts (100%) rename packages/store/{addon => src}/-private/utils/uuid-polyfill.ts (100%) rename packages/store/{addon => src}/.gitkeep (100%) rename packages/store/{addon => src}/index.ts (100%) diff --git a/.eslintrc.js b/.eslintrc.js index 4e14e7663f1..5be7052643c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -296,6 +296,7 @@ module.exports = { 'packages/private-build-infra/src/**/*.js', 'packages/unpublished-test-infra/src/**/*.js', 'packages/unpublished-eslint-rules/src/**/*.js', + 'packages/*/babel.config.js', 'packages/*/.ember-cli.js', 'packages/*/.eslintrc.js', 'packages/*/.template-lintrc.js', diff --git a/ember-data-types/q/identifier.ts b/ember-data-types/q/identifier.ts index 2dcca59de0d..c09b9e482ee 100644 --- a/ember-data-types/q/identifier.ts +++ b/ember-data-types/q/identifier.ts @@ -5,7 +5,7 @@ import { DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET, -} from '@ember-data/store/-private/utils/identifer-debug-consts'; +} from 'packages/store/src/-private/utils/identifer-debug-consts'; import type { ExistingResourceObject, ResourceIdentifierObject } from './ember-data-json-api'; diff --git a/ember-data-types/q/minimum-adapter-interface.ts b/ember-data-types/q/minimum-adapter-interface.ts index 8cbaee2d27d..f0d9a8c0f75 100644 --- a/ember-data-types/q/minimum-adapter-interface.ts +++ b/ember-data-types/q/minimum-adapter-interface.ts @@ -1,7 +1,7 @@ import type Store from '@ember-data/store'; import type Snapshot from '@ember-data/store/-private/network/snapshot'; import type SnapshotRecordArray from '@ember-data/store/-private/network/snapshot-record-array'; -import type { Collection } from '@ember-data/store/-private/record-arrays/identifier-array'; +import type { Collection } from 'packages/store/src/-private/record-arrays/identifier-array'; import type { ModelSchema } from './ds-model'; import type { RelationshipSchema } from './record-data-schemas'; diff --git a/package.json b/package.json index 4dd6894ced5..e70ed9ad61d 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "url": "git+ssh://git@github.com:emberjs/data.git" }, "scripts": { - "build-v2-addons": "pnpm --filter @ember-data/tracking --filter @ember-data/request build", + "build-v2-addons": "pnpm --filter @ember-data/tracking --filter @ember-data/request --filter @ember-data/store build", "build:docs": "mkdir -p packages/-ember-data/dist && cd ./docs-generator && node ./compile-docs.js", "lint:js": "eslint --cache --ext=js,ts .", "preinstall": "npx only-allow pnpm", @@ -168,4 +168,4 @@ "@embroider/macros@1.9.0": "patches/@embroider__macros@1.9.0.patch" } } -} \ No newline at end of file +} diff --git a/packages/model/addon/-private/legacy-relationships-support.ts b/packages/model/addon/-private/legacy-relationships-support.ts index 75876b0e08b..b0ee30e772d 100644 --- a/packages/model/addon/-private/legacy-relationships-support.ts +++ b/packages/model/addon/-private/legacy-relationships-support.ts @@ -13,7 +13,7 @@ import type BelongsToRelationship from '@ember-data/record-data/-private/relatio import type ManyRelationship from '@ember-data/record-data/-private/relationships/state/has-many'; import type Store from '@ember-data/store'; import { fastPush, isStableIdentifier, recordIdentifierFor, SOURCE, storeFor } from '@ember-data/store/-private'; -import type { NonSingletonRecordDataManager } from '@ember-data/store/-private/managers/record-data-manager'; +import type { NonSingletonRecordDataManager } from 'packages/store/src/-private/managers/record-data-manager'; import type { DSModel } from '@ember-data/types/q/ds-model'; import { CollectionResourceRelationship, SingleResourceRelationship } from '@ember-data/types/q/ember-data-json-api'; import type { StableRecordIdentifier } from '@ember-data/types/q/identifier'; diff --git a/packages/model/addon/-private/many-array.ts b/packages/model/addon/-private/many-array.ts index c44ff94e6ad..cd0a432439d 100644 --- a/packages/model/addon/-private/many-array.ts +++ b/packages/model/addon/-private/many-array.ts @@ -7,7 +7,7 @@ import { DEPRECATE_PROMISE_PROXIES } from '@ember-data/private-build-infra/depre import type Store from '@ember-data/store'; import { IDENTIFIER_ARRAY_TAG, MUTATE, RecordArray, recordIdentifierFor, SOURCE } from '@ember-data/store/-private'; import type ShimModelClass from '@ember-data/store/-private/legacy-model-support/shim-model-class'; -import { IdentifierArrayCreateOptions } from '@ember-data/store/-private/record-arrays/identifier-array'; +import { IdentifierArrayCreateOptions } from 'packages/store/src/-private/record-arrays/identifier-array'; import type { CreateRecordProperties } from '@ember-data/store/-private/store-service'; import type { Links, PaginationLinks } from '@ember-data/types/q/ember-data-json-api'; import type { StableRecordIdentifier } from '@ember-data/types/q/identifier'; diff --git a/packages/private-build-infra/src/v1-addon-main.js b/packages/private-build-infra/src/v1-addon-main.js new file mode 100644 index 00000000000..dabd48a9b15 --- /dev/null +++ b/packages/private-build-infra/src/v1-addon-main.js @@ -0,0 +1,36 @@ +const path = require('path'); + +const Funnel = require('broccoli-funnel'); + +module.exports = module.exports = function (pkg) { + return { + name: pkg.name, + + options: { + babel: { + plugins: [require.resolve('./transforms/babel-plugin-transform-ext.js')], + }, + }, + + treeForAddon() { + const assetDir = path.join(__dirname, './dist'); + return this._super.treeForAddon.call(this, new Funnel(assetDir, { include: ['**/*.js'] })); + }, + + treeForVendor() { + return; + }, + treeForPublic() { + return; + }, + treeForStyles() { + return; + }, + treeForAddonStyles() { + return; + }, + treeForApp() { + return; + }, + }; +}; diff --git a/packages/private-build-infra/src/v2-babel-build-pack.js b/packages/private-build-infra/src/v2-babel-build-pack.js new file mode 100644 index 00000000000..8d3d0a64f8d --- /dev/null +++ b/packages/private-build-infra/src/v2-babel-build-pack.js @@ -0,0 +1,34 @@ +const pkg = require('../package.json'); + +const requireModule = require('./utilities/require-module'); + +const debugFlags = requireModule('@ember-data/private-build-infra/addon/debugging.ts'); +const deprecationFlags = requireModule('@ember-data/private-build-infra/addon/current-deprecations.ts'); +const featureFlags = requireModule('@ember-data/canary-features/addon/default-features.ts'); + +const isCanary = pkg.version.includes('alpha'); + +const features = {}; +Object.keys(featureFlags).forEach((flag) => { + if (isCanary) { + features[flag] = featureFlags[flag]; + } else { + const value = featureFlags[flag]; + + if (value === null) { + features[flag] = false; + } else { + features[flag] = value; + } + } +}); + +const config = { + debug: Object.assign({}, debugFlags.default), + deprecations: Object.assign({}, deprecationFlags.default), + features, +}; + +const plugins = require('./debug-macros')(config); + +module.exports = plugins; diff --git a/packages/store/addon-main.js b/packages/store/addon-main.js new file mode 100644 index 00000000000..beda6cfe921 --- /dev/null +++ b/packages/store/addon-main.js @@ -0,0 +1,5 @@ +const buildMain = require('@ember-data/private-build-infra/src/v1-addon-main'); + +const pkg = require('./package.json'); + +module.exports = buildMain(pkg); diff --git a/packages/store/babel.config.js b/packages/store/babel.config.js new file mode 100644 index 00000000000..5cb8ecffdc1 --- /dev/null +++ b/packages/store/babel.config.js @@ -0,0 +1,13 @@ +const macros = require('@ember-data/private-build-infra/src/v2-babel-build-pack'); + +module.exports = { + plugins: [ + ...macros, + // '@embroider/macros/src/babel/macros-babel-plugin.js', + '@babel/plugin-transform-runtime', + ['@babel/plugin-transform-typescript', { allowDeclareFields: true }], + ['@babel/plugin-proposal-decorators', { legacy: true }], + '@babel/plugin-proposal-private-methods', + '@babel/plugin-proposal-class-properties', + ], +}; diff --git a/packages/store/index.js b/packages/store/index.js deleted file mode 100644 index dbf6381dbdf..00000000000 --- a/packages/store/index.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; - -const addonBuildConfigForDataPackage = require('@ember-data/private-build-infra/src/addon-build-config-for-data-package'); - -const name = require('./package').name; - -const addonBaseConfig = addonBuildConfigForDataPackage(name); - -module.exports = Object.assign({}, addonBaseConfig, { - shouldRollupPrivate: true, - externalDependenciesForPrivateModule() { - return [ - 'ember-cached-decorator-polyfill', - - '@ember-data/canary-features', - '@ember-data/tracking/-private', - - '@ember/application', - '@ember/array/proxy', - '@ember/array', - '@ember/debug', - '@ember/error', - '@ember/object', - '@ember/object/computed', - '@ember/object/evented', - '@ember/object/internals', - '@ember/object/mixin', - '@ember/object/compat', - '@ember/object/promise-proxy-mixin', - '@ember/object/proxy', - '@ember/polyfills', - '@ember/runloop', - '@ember/service', - '@ember/string', - '@ember/test', - '@ember/utils', - - '@embroider/macros/es-compat', - '@embroider/macros/runtime', - - 'ember-inflector', - 'ember', - 'rsvp', - 'require', - - '@glimmer/tracking', - ]; - }, -}); diff --git a/packages/store/package.json b/packages/store/package.json index 629796df2e6..c02967e84eb 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -13,6 +13,16 @@ "license": "MIT", "author": "", "directories": {}, + "scripts": { + "build": "rollup --config", + "start": "rollup --config --watch", + "prepack": "rollup --config" + }, + "ember-addon": { + "main": "addon-main.js", + "type": "addon", + "version": 1 + }, "peerDependencies": { "@ember-data/model": "workspace:4.10.0-alpha.4", "@ember-data/record-data": "workspace:4.10.0-alpha.4", @@ -37,25 +47,39 @@ } }, "dependencies": { - "@ember-data/canary-features": "workspace:4.10.0-alpha.4", + "broccoli-funnel": "^3.0.8", + "ember-cli-babel": "^7.26.11", "@ember-data/private-build-infra": "workspace:4.10.0-alpha.4", "@embroider/macros": "^1.10.0", "ember-auto-import": "^2.5.0", - "ember-cached-decorator-polyfill": "^1.0.1", - "ember-cli-babel": "^7.26.11" + "ember-cached-decorator-polyfill": "^1.0.1" }, "devDependencies": { "@babel/core": "^7.20.2", "@glimmer/component": "^1.1.2", + "webpack": "^5.75.0", "ember-source": "~4.8.2", - "webpack": "^5.75.0" + "@embroider/addon-dev": "^2.0.0", + "rollup": "^3.2.3", + "@babel/plugin-proposal-class-properties": "^7.18.6", + "@babel/plugin-proposal-private-methods": "^7.18.6", + "@babel/plugin-proposal-decorators": "^7.20.0", + "@babel/plugin-transform-typescript": "^7.20.0", + "@babel/plugin-transform-runtime": "^7.19.6", + "@babel/preset-typescript": "^7.18.6", + "@babel/preset-env": "^7.19.4", + "@babel/runtime": "^7.20.0", + "@rollup/plugin-babel":"^6.0.2", + "@rollup/plugin-node-resolve": "^15.0.1", + "tslib": "^2.4.0", + "walk-sync": "^3.0.0", + "typescript": "^4.8.4" }, "engines": { "node": "^14.8.0 || 16.* || >= 18.*" }, - "ember-addon": {}, "volta": { "extends": "../../package.json" }, "packageManager": "pnpm@7.18.0" -} \ No newline at end of file +} diff --git a/packages/store/rollup.config.mjs b/packages/store/rollup.config.mjs new file mode 100644 index 00000000000..24e0e47ae48 --- /dev/null +++ b/packages/store/rollup.config.mjs @@ -0,0 +1,59 @@ +import { Addon } from '@embroider/addon-dev/rollup'; +import babel from '@rollup/plugin-babel'; +import { nodeResolve } from '@rollup/plugin-node-resolve'; + +const addon = new Addon({ + srcDir: 'src', + destDir: 'dist', +}); + +export default { + // This provides defaults that work well alongside `publicEntrypoints` below. + // You can augment this if you need to. + output: addon.output(), + + external: [ + '@embroider/macros', + '@glimmer/tracking', + + '@ember-data/tracking/-private', + '@ember-data/private-build-infra/deprecations', + + // to eliminate + '@ember/object/compat', + '@ember/runloop', + '@ember/service', + '@ember/string', + 'ember', + + // investigate why these are present + '@ember/utils', + '@ember/application', + '@ember/object/computed', + + // deprecated usages only + '@ember/object', + '@ember/object/proxy', + '@ember/object/promise-proxy-mixin', + '@ember/array/proxy', + + // test/debug only + '@ember/test', + '@ember/debug', + ], + + plugins: [ + // These are the modules that users should be able to import from your + // addon. Anything not listed here may get optimized away. + addon.publicEntrypoints(['index.js', '-private.js']), + + nodeResolve({ extensions: ['.ts'] }), + babel({ + extensions: ['.ts'], + babelHelpers: 'runtime', // we should consider "external", + }), + + // Remove leftover build artifacts when starting a new build. + addon.clean(), + ], +}; diff --git a/packages/store/src/-private.ts b/packages/store/src/-private.ts new file mode 100644 index 00000000000..3a50ff42290 --- /dev/null +++ b/packages/store/src/-private.ts @@ -0,0 +1 @@ +export * from './-private/index'; diff --git a/packages/store/addon/-private/caches/identifier-cache.ts b/packages/store/src/-private/caches/identifier-cache.ts similarity index 100% rename from packages/store/addon/-private/caches/identifier-cache.ts rename to packages/store/src/-private/caches/identifier-cache.ts diff --git a/packages/store/addon/-private/caches/instance-cache.ts b/packages/store/src/-private/caches/instance-cache.ts similarity index 100% rename from packages/store/addon/-private/caches/instance-cache.ts rename to packages/store/src/-private/caches/instance-cache.ts diff --git a/packages/store/addon/-private/caches/record-data-for.ts b/packages/store/src/-private/caches/record-data-for.ts similarity index 100% rename from packages/store/addon/-private/caches/record-data-for.ts rename to packages/store/src/-private/caches/record-data-for.ts diff --git a/packages/store/addon/-private/index.ts b/packages/store/src/-private/index.ts similarity index 100% rename from packages/store/addon/-private/index.ts rename to packages/store/src/-private/index.ts diff --git a/packages/store/addon/-private/legacy-model-support/record-reference.ts b/packages/store/src/-private/legacy-model-support/record-reference.ts similarity index 100% rename from packages/store/addon/-private/legacy-model-support/record-reference.ts rename to packages/store/src/-private/legacy-model-support/record-reference.ts diff --git a/packages/store/addon/-private/legacy-model-support/schema-definition-service.ts b/packages/store/src/-private/legacy-model-support/schema-definition-service.ts similarity index 100% rename from packages/store/addon/-private/legacy-model-support/schema-definition-service.ts rename to packages/store/src/-private/legacy-model-support/schema-definition-service.ts diff --git a/packages/store/addon/-private/legacy-model-support/shim-model-class.ts b/packages/store/src/-private/legacy-model-support/shim-model-class.ts similarity index 100% rename from packages/store/addon/-private/legacy-model-support/shim-model-class.ts rename to packages/store/src/-private/legacy-model-support/shim-model-class.ts diff --git a/packages/store/addon/-private/managers/record-array-manager.ts b/packages/store/src/-private/managers/record-array-manager.ts similarity index 100% rename from packages/store/addon/-private/managers/record-array-manager.ts rename to packages/store/src/-private/managers/record-array-manager.ts diff --git a/packages/store/addon/-private/managers/record-data-manager.ts b/packages/store/src/-private/managers/record-data-manager.ts similarity index 100% rename from packages/store/addon/-private/managers/record-data-manager.ts rename to packages/store/src/-private/managers/record-data-manager.ts diff --git a/packages/store/addon/-private/managers/record-data-store-wrapper.ts b/packages/store/src/-private/managers/record-data-store-wrapper.ts similarity index 100% rename from packages/store/addon/-private/managers/record-data-store-wrapper.ts rename to packages/store/src/-private/managers/record-data-store-wrapper.ts diff --git a/packages/store/addon/-private/managers/record-notification-manager.ts b/packages/store/src/-private/managers/record-notification-manager.ts similarity index 100% rename from packages/store/addon/-private/managers/record-notification-manager.ts rename to packages/store/src/-private/managers/record-notification-manager.ts diff --git a/packages/store/addon/-private/network/fetch-manager.ts b/packages/store/src/-private/network/fetch-manager.ts similarity index 100% rename from packages/store/addon/-private/network/fetch-manager.ts rename to packages/store/src/-private/network/fetch-manager.ts diff --git a/packages/store/addon/-private/network/finders.js b/packages/store/src/-private/network/finders.js similarity index 100% rename from packages/store/addon/-private/network/finders.js rename to packages/store/src/-private/network/finders.js diff --git a/packages/store/addon/-private/network/request-cache.ts b/packages/store/src/-private/network/request-cache.ts similarity index 100% rename from packages/store/addon/-private/network/request-cache.ts rename to packages/store/src/-private/network/request-cache.ts diff --git a/packages/store/addon/-private/network/snapshot-record-array.ts b/packages/store/src/-private/network/snapshot-record-array.ts similarity index 100% rename from packages/store/addon/-private/network/snapshot-record-array.ts rename to packages/store/src/-private/network/snapshot-record-array.ts diff --git a/packages/store/addon/-private/network/snapshot.ts b/packages/store/src/-private/network/snapshot.ts similarity index 100% rename from packages/store/addon/-private/network/snapshot.ts rename to packages/store/src/-private/network/snapshot.ts diff --git a/packages/store/addon/-private/proxies/promise-proxies.ts b/packages/store/src/-private/proxies/promise-proxies.ts similarity index 100% rename from packages/store/addon/-private/proxies/promise-proxies.ts rename to packages/store/src/-private/proxies/promise-proxies.ts diff --git a/packages/store/addon/-private/proxies/promise-proxy-base.d.ts b/packages/store/src/-private/proxies/promise-proxy-base.d.ts similarity index 100% rename from packages/store/addon/-private/proxies/promise-proxy-base.d.ts rename to packages/store/src/-private/proxies/promise-proxy-base.d.ts diff --git a/packages/store/addon/-private/proxies/promise-proxy-base.js b/packages/store/src/-private/proxies/promise-proxy-base.js similarity index 100% rename from packages/store/addon/-private/proxies/promise-proxy-base.js rename to packages/store/src/-private/proxies/promise-proxy-base.js diff --git a/packages/store/addon/-private/record-arrays/identifier-array.ts b/packages/store/src/-private/record-arrays/identifier-array.ts similarity index 100% rename from packages/store/addon/-private/record-arrays/identifier-array.ts rename to packages/store/src/-private/record-arrays/identifier-array.ts diff --git a/packages/store/addon/-private/store-service.ts b/packages/store/src/-private/store-service.ts similarity index 100% rename from packages/store/addon/-private/store-service.ts rename to packages/store/src/-private/store-service.ts diff --git a/packages/store/addon/-private/utils/coerce-id.ts b/packages/store/src/-private/utils/coerce-id.ts similarity index 100% rename from packages/store/addon/-private/utils/coerce-id.ts rename to packages/store/src/-private/utils/coerce-id.ts diff --git a/packages/store/addon/-private/utils/common.js b/packages/store/src/-private/utils/common.js similarity index 100% rename from packages/store/addon/-private/utils/common.js rename to packages/store/src/-private/utils/common.js diff --git a/packages/store/addon/-private/utils/construct-resource.ts b/packages/store/src/-private/utils/construct-resource.ts similarity index 100% rename from packages/store/addon/-private/utils/construct-resource.ts rename to packages/store/src/-private/utils/construct-resource.ts diff --git a/packages/store/addon/-private/utils/identifer-debug-consts.ts b/packages/store/src/-private/utils/identifer-debug-consts.ts similarity index 100% rename from packages/store/addon/-private/utils/identifer-debug-consts.ts rename to packages/store/src/-private/utils/identifer-debug-consts.ts diff --git a/packages/store/addon/-private/utils/is-non-empty-string.ts b/packages/store/src/-private/utils/is-non-empty-string.ts similarity index 100% rename from packages/store/addon/-private/utils/is-non-empty-string.ts rename to packages/store/src/-private/utils/is-non-empty-string.ts diff --git a/packages/store/addon/-private/utils/normalize-model-name.ts b/packages/store/src/-private/utils/normalize-model-name.ts similarity index 100% rename from packages/store/addon/-private/utils/normalize-model-name.ts rename to packages/store/src/-private/utils/normalize-model-name.ts diff --git a/packages/store/addon/-private/utils/promise-record.ts b/packages/store/src/-private/utils/promise-record.ts similarity index 100% rename from packages/store/addon/-private/utils/promise-record.ts rename to packages/store/src/-private/utils/promise-record.ts diff --git a/packages/store/addon/-private/utils/serializer-response.ts b/packages/store/src/-private/utils/serializer-response.ts similarity index 100% rename from packages/store/addon/-private/utils/serializer-response.ts rename to packages/store/src/-private/utils/serializer-response.ts diff --git a/packages/store/addon/-private/utils/uuid-polyfill.ts b/packages/store/src/-private/utils/uuid-polyfill.ts similarity index 100% rename from packages/store/addon/-private/utils/uuid-polyfill.ts rename to packages/store/src/-private/utils/uuid-polyfill.ts diff --git a/packages/store/addon/.gitkeep b/packages/store/src/.gitkeep similarity index 100% rename from packages/store/addon/.gitkeep rename to packages/store/src/.gitkeep diff --git a/packages/store/addon/index.ts b/packages/store/src/index.ts similarity index 100% rename from packages/store/addon/index.ts rename to packages/store/src/index.ts diff --git a/packages/tracking/package.json b/packages/tracking/package.json index 0f6c1ea7dda..c20ec77709a 100644 --- a/packages/tracking/package.json +++ b/packages/tracking/package.json @@ -59,4 +59,4 @@ "ember": { "edition": "octane" } -} \ No newline at end of file +} diff --git a/tsconfig.json b/tsconfig.json index 4e33fbf693c..1246c6ad7a3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,10 +18,10 @@ "tests/fastboot/app/config/environment.d.ts", "tests/fastboot/app/app.ts", "tests/fastboot/app/adapters/application.ts", - "packages/store/addon/index.ts", - "packages/store/addon/-private/utils/promise-record.ts", - "packages/store/addon/-private/utils/is-non-empty-string.ts", - "packages/store/addon/-private/utils/construct-resource.ts", + "packages/store/src/index.ts", + "packages/store/src/-private/utils/promise-record.ts", + "packages/store/src/-private/utils/is-non-empty-string.ts", + "packages/store/src/-private/utils/construct-resource.ts", "ember-data-types/q/utils.ts", "ember-data-types/q/schema-definition-service.ts", "ember-data-types/q/record-instance.ts", @@ -35,20 +35,20 @@ "ember-data-types/q/fetch-manager.ts", "ember-data-types/q/ember-data-json-api.ts", "ember-data-types/q/ds-model.ts", - "packages/store/addon/-private/managers/record-data-store-wrapper.ts", - "packages/store/addon/-private/network/snapshot.ts", - "packages/store/addon/-private/network/snapshot-record-array.ts", - "packages/store/addon/-private/legacy-model-support/schema-definition-service.ts", - "packages/store/addon/-private/network/request-cache.ts", - "packages/store/addon/-private/managers/record-notification-manager.ts", - "packages/store/addon/-private/caches/record-data-for.ts", - "packages/store/addon/-private/utils/normalize-model-name.ts", - "packages/store/addon/-private/legacy-model-support/shim-model-class.ts", - "packages/store/addon/-private/network/fetch-manager.ts", - "packages/store/addon/-private/store-service.ts", - "packages/store/addon/-private/utils/coerce-id.ts", - "packages/store/addon/-private/index.ts", - "packages/store/addon/-private/caches/identifier-cache.ts", + "packages/store/src/-private/managers/record-data-store-wrapper.ts", + "packages/store/src/-private/network/snapshot.ts", + "packages/store/src/-private/network/snapshot-record-array.ts", + "packages/store/src/-private/legacy-model-support/schema-definition-service.ts", + "packages/store/src/-private/network/request-cache.ts", + "packages/store/src/-private/managers/record-notification-manager.ts", + "packages/store/src/-private/caches/record-data-for.ts", + "packages/store/src/-private/utils/normalize-model-name.ts", + "packages/store/src/-private/legacy-model-support/shim-model-class.ts", + "packages/store/src/-private/network/fetch-manager.ts", + "packages/store/src/-private/store-service.ts", + "packages/store/src/-private/utils/coerce-id.ts", + "packages/store/src/-private/index.ts", + "packages/store/src/-private/caches/identifier-cache.ts", "packages/serializer/addon/index.ts", "tests/graph/tests/integration/graph/polymorphism/implicit-keys-test.ts", "tests/graph/tests/integration/graph/graph-test.ts", From 547b2f156fdf5722212acaec479c5608f920a615 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Mon, 31 Oct 2022 13:56:04 -0700 Subject: [PATCH 2/9] fix config --- packages/store/rollup.config.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/store/rollup.config.mjs b/packages/store/rollup.config.mjs index 24e0e47ae48..28dfbe72a34 100644 --- a/packages/store/rollup.config.mjs +++ b/packages/store/rollup.config.mjs @@ -47,9 +47,9 @@ export default { // addon. Anything not listed here may get optimized away. addon.publicEntrypoints(['index.js', '-private.js']), - nodeResolve({ extensions: ['.ts'] }), + nodeResolve({ extensions: ['.ts', '.js'] }), babel({ - extensions: ['.ts'], + extensions: ['.ts', '.js'], babelHelpers: 'runtime', // we should consider "external", }), From 66434da08935762cbe57a26db26b5825d73c1593 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Mon, 31 Oct 2022 14:11:02 -0700 Subject: [PATCH 3/9] fix build path --- .../private-build-infra/src/v1-addon-main.js | 36 ------------------- packages/store/addon-main.js | 35 ++++++++++++++++-- 2 files changed, 33 insertions(+), 38 deletions(-) delete mode 100644 packages/private-build-infra/src/v1-addon-main.js diff --git a/packages/private-build-infra/src/v1-addon-main.js b/packages/private-build-infra/src/v1-addon-main.js deleted file mode 100644 index dabd48a9b15..00000000000 --- a/packages/private-build-infra/src/v1-addon-main.js +++ /dev/null @@ -1,36 +0,0 @@ -const path = require('path'); - -const Funnel = require('broccoli-funnel'); - -module.exports = module.exports = function (pkg) { - return { - name: pkg.name, - - options: { - babel: { - plugins: [require.resolve('./transforms/babel-plugin-transform-ext.js')], - }, - }, - - treeForAddon() { - const assetDir = path.join(__dirname, './dist'); - return this._super.treeForAddon.call(this, new Funnel(assetDir, { include: ['**/*.js'] })); - }, - - treeForVendor() { - return; - }, - treeForPublic() { - return; - }, - treeForStyles() { - return; - }, - treeForAddonStyles() { - return; - }, - treeForApp() { - return; - }, - }; -}; diff --git a/packages/store/addon-main.js b/packages/store/addon-main.js index beda6cfe921..3acf1c00125 100644 --- a/packages/store/addon-main.js +++ b/packages/store/addon-main.js @@ -1,5 +1,36 @@ -const buildMain = require('@ember-data/private-build-infra/src/v1-addon-main'); +const path = require('path'); + +const Funnel = require('broccoli-funnel'); const pkg = require('./package.json'); -module.exports = buildMain(pkg); +module.exports = { + name: pkg.name, + + options: { + babel: { + plugins: [require.resolve('@ember-data/private-build-infra/src/transforms/babel-plugin-transform-ext.js')], + }, + }, + + treeForAddon() { + const assetDir = path.join(__dirname, './dist'); + return this._super.treeForAddon.call(this, new Funnel(assetDir, { include: ['**/*.js'] })); + }, + + treeForVendor() { + return; + }, + treeForPublic() { + return; + }, + treeForStyles() { + return; + }, + treeForAddonStyles() { + return; + }, + treeForApp() { + return; + }, +}; From 0b7263073e71a9336a93d333a79b9fa046f8447c Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Mon, 31 Oct 2022 14:46:11 -0700 Subject: [PATCH 4/9] fix lint and docs --- .eslintrc.js | 38 +++++++++---------- docs-generator/yuidoc.json | 2 +- ember-data-types/q/identifier.ts | 2 +- .../q/minimum-adapter-interface.ts | 2 +- .../-private/legacy-relationships-support.ts | 2 +- packages/model/addon/-private/many-array.ts | 2 +- .../src/v2-babel-build-pack.js | 1 + .../src/-private/caches/identifier-cache.ts | 2 +- ...g-consts.ts => identifier-debug-consts.ts} | 0 root-tsconfig.json | 5 ++- 10 files changed, 29 insertions(+), 27 deletions(-) rename packages/store/src/-private/utils/{identifer-debug-consts.ts => identifier-debug-consts.ts} (100%) diff --git a/.eslintrc.js b/.eslintrc.js index 5be7052643c..d760d52f274 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -170,10 +170,10 @@ module.exports = { '@types/@ember/runloop/-private/backburner.d.ts', '@types/@ember/object/compat.d.ts', '@types/@ember/debug/index.d.ts', - 'packages/store/addon/index.ts', - 'packages/store/addon/-private/utils/promise-record.ts', - 'packages/store/addon/-private/utils/is-non-empty-string.ts', - 'packages/store/addon/-private/utils/construct-resource.ts', + 'packages/store/src/index.ts', + 'packages/store/src/-private/utils/promise-record.ts', + 'packages/store/src/-private/utils/is-non-empty-string.ts', + 'packages/store/src/-private/utils/construct-resource.ts', 'ember-data-types/q/utils.ts', 'ember-data-types/q/schema-definition-service.ts', 'ember-data-types/q/record-instance.ts', @@ -187,21 +187,21 @@ module.exports = { 'ember-data-types/q/fetch-manager.ts', 'ember-data-types/q/ember-data-json-api.ts', 'ember-data-types/q/ds-model.ts', - 'packages/store/addon/-private/managers/record-data-store-wrapper.ts', - 'packages/store/addon/-private/network/snapshot.ts', - 'packages/store/addon/-private/network/snapshot-record-array.ts', - 'packages/store/addon/-private/legacy-model-support/schema-definition-service.ts', - 'packages/store/addon/-private/network/request-cache.ts', - 'packages/store/addon/-private/legacy-model-support/record-reference.ts', - 'packages/store/addon/-private/managers/record-notification-manager.ts', - 'packages/store/addon/-private/caches/record-data-for.ts', - 'packages/store/addon/-private/utils/normalize-model-name.ts', - 'packages/store/addon/-private/legacy-model-support/shim-model-class.ts', - 'packages/store/addon/-private/network/fetch-manager.ts', - 'packages/store/addon/-private/store-service.ts', - 'packages/store/addon/-private/utils/coerce-id.ts', - 'packages/store/addon/-private/index.ts', - 'packages/store/addon/-private/caches/identifier-cache.ts', + 'packages/store/src/-private/managers/record-data-store-wrapper.ts', + 'packages/store/src/-private/network/snapshot.ts', + 'packages/store/src/-private/network/snapshot-record-array.ts', + 'packages/store/src/-private/legacy-model-support/schema-definition-service.ts', + 'packages/store/src/-private/network/request-cache.ts', + 'packages/store/src/-private/legacy-model-support/record-reference.ts', + 'packages/store/src/-private/managers/record-notification-manager.ts', + 'packages/store/src/-private/caches/record-data-for.ts', + 'packages/store/src/-private/utils/normalize-model-name.ts', + 'packages/store/src/-private/legacy-model-support/shim-model-class.ts', + 'packages/store/src/-private/network/fetch-manager.ts', + 'packages/store/src/-private/store-service.ts', + 'packages/store/src/-private/utils/coerce-id.ts', + 'packages/store/src/-private/index.ts', + 'packages/store/src/-private/caches/identifier-cache.ts', 'packages/serializer/addon/index.ts', '@types/@ember/runloop/index.d.ts', '@types/@ember/polyfills/index.d.ts', diff --git a/docs-generator/yuidoc.json b/docs-generator/yuidoc.json index 7d4b84c2d9f..38ac811014b 100644 --- a/docs-generator/yuidoc.json +++ b/docs-generator/yuidoc.json @@ -16,7 +16,7 @@ "../packages/adapter/addon", "../packages/model/addon", "../packages/serializer/addon", - "../packages/store/addon", + "../packages/store/src", "../packages/record-data/addon", "../packages/debug/addon", "../packages/private-build-infra/addon", diff --git a/ember-data-types/q/identifier.ts b/ember-data-types/q/identifier.ts index c09b9e482ee..39bbbb4daa6 100644 --- a/ember-data-types/q/identifier.ts +++ b/ember-data-types/q/identifier.ts @@ -5,7 +5,7 @@ import { DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET, -} from 'packages/store/src/-private/utils/identifer-debug-consts'; +} from '@ember-data/store/-private/utils/identifier-debug-consts'; import type { ExistingResourceObject, ResourceIdentifierObject } from './ember-data-json-api'; diff --git a/ember-data-types/q/minimum-adapter-interface.ts b/ember-data-types/q/minimum-adapter-interface.ts index f0d9a8c0f75..8cbaee2d27d 100644 --- a/ember-data-types/q/minimum-adapter-interface.ts +++ b/ember-data-types/q/minimum-adapter-interface.ts @@ -1,7 +1,7 @@ import type Store from '@ember-data/store'; import type Snapshot from '@ember-data/store/-private/network/snapshot'; import type SnapshotRecordArray from '@ember-data/store/-private/network/snapshot-record-array'; -import type { Collection } from 'packages/store/src/-private/record-arrays/identifier-array'; +import type { Collection } from '@ember-data/store/-private/record-arrays/identifier-array'; import type { ModelSchema } from './ds-model'; import type { RelationshipSchema } from './record-data-schemas'; diff --git a/packages/model/addon/-private/legacy-relationships-support.ts b/packages/model/addon/-private/legacy-relationships-support.ts index b0ee30e772d..75876b0e08b 100644 --- a/packages/model/addon/-private/legacy-relationships-support.ts +++ b/packages/model/addon/-private/legacy-relationships-support.ts @@ -13,7 +13,7 @@ import type BelongsToRelationship from '@ember-data/record-data/-private/relatio import type ManyRelationship from '@ember-data/record-data/-private/relationships/state/has-many'; import type Store from '@ember-data/store'; import { fastPush, isStableIdentifier, recordIdentifierFor, SOURCE, storeFor } from '@ember-data/store/-private'; -import type { NonSingletonRecordDataManager } from 'packages/store/src/-private/managers/record-data-manager'; +import type { NonSingletonRecordDataManager } from '@ember-data/store/-private/managers/record-data-manager'; import type { DSModel } from '@ember-data/types/q/ds-model'; import { CollectionResourceRelationship, SingleResourceRelationship } from '@ember-data/types/q/ember-data-json-api'; import type { StableRecordIdentifier } from '@ember-data/types/q/identifier'; diff --git a/packages/model/addon/-private/many-array.ts b/packages/model/addon/-private/many-array.ts index cd0a432439d..c44ff94e6ad 100644 --- a/packages/model/addon/-private/many-array.ts +++ b/packages/model/addon/-private/many-array.ts @@ -7,7 +7,7 @@ import { DEPRECATE_PROMISE_PROXIES } from '@ember-data/private-build-infra/depre import type Store from '@ember-data/store'; import { IDENTIFIER_ARRAY_TAG, MUTATE, RecordArray, recordIdentifierFor, SOURCE } from '@ember-data/store/-private'; import type ShimModelClass from '@ember-data/store/-private/legacy-model-support/shim-model-class'; -import { IdentifierArrayCreateOptions } from 'packages/store/src/-private/record-arrays/identifier-array'; +import { IdentifierArrayCreateOptions } from '@ember-data/store/-private/record-arrays/identifier-array'; import type { CreateRecordProperties } from '@ember-data/store/-private/store-service'; import type { Links, PaginationLinks } from '@ember-data/types/q/ember-data-json-api'; import type { StableRecordIdentifier } from '@ember-data/types/q/identifier'; diff --git a/packages/private-build-infra/src/v2-babel-build-pack.js b/packages/private-build-infra/src/v2-babel-build-pack.js index 8d3d0a64f8d..de8ef221ba9 100644 --- a/packages/private-build-infra/src/v2-babel-build-pack.js +++ b/packages/private-build-infra/src/v2-babel-build-pack.js @@ -1,5 +1,6 @@ const pkg = require('../package.json'); +// eslint-disable-next-line import/order const requireModule = require('./utilities/require-module'); const debugFlags = requireModule('@ember-data/private-build-infra/addon/debugging.ts'); diff --git a/packages/store/src/-private/caches/identifier-cache.ts b/packages/store/src/-private/caches/identifier-cache.ts index 7c9ba36c9c2..1af92c52bcf 100644 --- a/packages/store/src/-private/caches/identifier-cache.ts +++ b/packages/store/src/-private/caches/identifier-cache.ts @@ -22,7 +22,7 @@ import type { import type { ConfidentDict } from '@ember-data/types/q/utils'; import coerceId from '../utils/coerce-id'; -import { DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET } from '../utils/identifer-debug-consts'; +import { DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET } from '../utils/identifier-debug-consts'; import isNonEmptyString from '../utils/is-non-empty-string'; import normalizeModelName from '../utils/normalize-model-name'; import installPolyfill from '../utils/uuid-polyfill'; diff --git a/packages/store/src/-private/utils/identifer-debug-consts.ts b/packages/store/src/-private/utils/identifier-debug-consts.ts similarity index 100% rename from packages/store/src/-private/utils/identifer-debug-consts.ts rename to packages/store/src/-private/utils/identifier-debug-consts.ts diff --git a/root-tsconfig.json b/root-tsconfig.json index 47fa1ddb7b9..6db61248817 100644 --- a/root-tsconfig.json +++ b/root-tsconfig.json @@ -31,8 +31,8 @@ "ember-data/*": ["packages/-ember-data/addon/*"], "@ember-data/types": ["ember-data-types"], "@ember-data/types/*": ["ember-data-types/*"], - "@ember-data/store": ["packages/store/addon"], - "@ember-data/store/*": ["packages/store/addon/*"], + "@ember-data/store": ["packages/store/src"], + "@ember-data/store/*": ["packages/store/src/*"], "@ember-data/tracking": ["packages/tracking/src"], "@ember-data/tracking/*": ["packages/tracking/src/*"], "@ember-data/request": ["packages/request/src"], @@ -78,6 +78,7 @@ "packages/**/tests/**/*", "packages/tracking/src/**/*", "packages/request/src/**/*", + "packages/store/src/**/*", "packages/experimental-preview-types/src/**/*", "packages/fastboot-test-app/types/**/*", "packages/**/test-support/**/*", From 03f1613f8565d0f3d7ebdc5cfebe8c3ce05e070e Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Tue, 1 Nov 2022 16:48:41 -0700 Subject: [PATCH 5/9] fix configs --- packages/store/addon-main.js | 66 ++++++++++++++++++++++++++++++++++++ packages/store/package.json | 9 +++++ 2 files changed, 75 insertions(+) diff --git a/packages/store/addon-main.js b/packages/store/addon-main.js index 3acf1c00125..edd2275d0fb 100644 --- a/packages/store/addon-main.js +++ b/packages/store/addon-main.js @@ -11,6 +11,72 @@ module.exports = { babel: { plugins: [require.resolve('@ember-data/private-build-infra/src/transforms/babel-plugin-transform-ext.js')], }, + '@embroider/macros': { + setOwnConfig: {}, + }, + }, + + _emberDataConfig: null, + configureEmberData() { + if (this._emberDataConfig) { + return this._emberDataConfig; + } + const app = this._findHost(); + const isProd = /production/.test(process.env.EMBER_ENV); + const hostOptions = app.options?.emberData || {}; + const debugOptions = Object.assign( + { + LOG_PAYLOADS: false, + LOG_OPERATIONS: false, + LOG_MUTATIONS: false, + LOG_NOTIFICATIONS: false, + LOG_REQUEST_STATUS: false, + LOG_IDENTIFIERS: false, + LOG_GRAPH: false, + LOG_INSTANCE_CACHE: false, + }, + hostOptions.debug || {} + ); + let HAS_DEBUG_PACKAGE, HAS_META_PACKAGE; + + try { + // eslint-disable-next-line node/no-missing-require + require.resolve('@ember-data/debug', { paths: [process.cwd(), __dirname] }); + HAS_DEBUG_PACKAGE = true; + } catch { + HAS_DEBUG_PACKAGE = false; + } + try { + // eslint-disable-next-line node/no-missing-require + require.resolve('ember-data', { paths: [process.cwd(), __dirname] }); + HAS_META_PACKAGE = true; + } catch { + HAS_META_PACKAGE = false; + } + const includeDataAdapterInProduction = + typeof hostOptions.includeDataAdapterInProduction === 'boolean' + ? hostOptions.includeDataAdapterInProduction + : HAS_META_PACKAGE; + + const includeDataAdapter = HAS_DEBUG_PACKAGE ? (isProd ? includeDataAdapterInProduction : true) : false; + const DEPRECATIONS = require('@ember-data/private-build-infra/src/deprecations')(hostOptions.compatWith || null); + const FEATURES = require('@ember-data/private-build-infra/src/features')(isProd); + + // copy configs forward + const ownConfig = this.options['@embroider/macros'].setOwnConfig; + ownConfig.compatWith = hostOptions.compatWith || null; + ownConfig.debug = debugOptions; + ownConfig.deprecations = Object.assign(DEPRECATIONS, ownConfig.deprecations || {}); + ownConfig.features = Object.assign({}, FEATURES); + ownConfig.includeDataAdapter = includeDataAdapter; + + this._emberDataConfig = ownConfig; + return ownConfig; + }, + + included() { + this.configureEmberData(); + return this._super.included.call(this, ...arguments); }, treeForAddon() { diff --git a/packages/store/package.json b/packages/store/package.json index c02967e84eb..989a5d8b876 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -23,6 +23,15 @@ "type": "addon", "version": 1 }, + "exports": { + ".": "./dist/index.js", + "./*": "./dist/*", + "./addon-main.js": "./addon-main.js" + }, + "files": [ + "addon-main.js", + "dist" + ], "peerDependencies": { "@ember-data/model": "workspace:4.10.0-alpha.4", "@ember-data/record-data": "workspace:4.10.0-alpha.4", From 44751fec056503681bfc5ead8e80bb60a772d128 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Wed, 7 Dec 2022 23:38:03 -0800 Subject: [PATCH 6/9] cleanup --- .eslintignore | 1 + .github/actions/prepare-build/action copy.yml | 5 -- .github/actions/setup/action.yml | 5 -- .github/workflows/asset-size-check.yml | 4 +- .github/workflows/compat-tests.yml | 2 +- .github/workflows/nightly.yml | 4 - .github/workflows/perf-check.yml | 4 +- .github/workflows/perf-over-release.yml | 4 +- .gitignore | 1 + package.json | 1 - packages/request/package.json | 5 +- packages/store/addon-main.js | 12 --- packages/store/babel.config.js | 8 +- packages/store/package.json | 14 ++- packages/store/rollup.config.mjs | 4 +- .../src/-private/caches/instance-cache.ts | 8 +- packages/store/src/-private/store-service.ts | 7 +- .../src/-private/utils/identifier-has-id.ts | 8 ++ packages/tracking/package.json | 3 +- pnpm-lock.yaml | 87 ++++++++++++++++--- 20 files changed, 113 insertions(+), 74 deletions(-) create mode 100644 packages/store/src/-private/utils/identifier-has-id.ts diff --git a/.eslintignore b/.eslintignore index c2710d4b7d0..18164b7c6f9 100644 --- a/.eslintignore +++ b/.eslintignore @@ -9,6 +9,7 @@ **/tmp/ /packages/tracking/addon/ /packages/request/addon/ +/packages/store/addon/ /packages/-ember-data/docs/ /packages/tracking/addon/ diff --git a/.github/actions/prepare-build/action copy.yml b/.github/actions/prepare-build/action copy.yml index 93ef8641652..9dbbb9c239c 100644 --- a/.github/actions/prepare-build/action copy.yml +++ b/.github/actions/prepare-build/action copy.yml @@ -108,10 +108,6 @@ runs: restore-keys: | master - - if: ${{ inputs.build-addons }} - name: Exec Library Prepackage Steps - run: pnpm build-v2-addons - - if: ${{ inputs.restore-lint-caches }} name: Restore Lint Caches uses: actions/cache@v3 @@ -121,4 +117,3 @@ runs: key: ${{ github.ref }} restore-keys: | master - diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index fb2bc3317e9..49f984bbef4 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -74,11 +74,6 @@ runs: broccoli-master broccoli- - - name: Exec Library Prepackage Steps - if: ${{ inputs.build-addons == 'true' }} - shell: bash - run: pnpm build-v2-addons && pnpm install - - name: Restore Lint Caches if: ${{ inputs.restore-lint-caches == 'true' }} uses: actions/cache@v3 diff --git a/.github/workflows/asset-size-check.yml b/.github/workflows/asset-size-check.yml index adf8fe9c07a..ec75ad6be7e 100644 --- a/.github/workflows/asset-size-check.yml +++ b/.github/workflows/asset-size-check.yml @@ -42,7 +42,7 @@ jobs: - name: Install dependencies for master run: pnpm install - name: Build V2 Addons - run: pnpm run --if-present build-v2-addons && pnpm install + run: pnpm install - name: Build Production master run: pnpm --filter "full-data-asset-size-app" exec ember build -e production --output-path dists/control - name: Checkout ${{github.ref}} @@ -52,7 +52,7 @@ jobs: - name: Install dependencies for ${{github.ref}} run: pnpm install - name: Build V2 Addons - run: pnpm run --if-present build-v2-addons && pnpm install + run: pnpm install - name: Build Production ${{github.ref}} run: pnpm --filter "full-data-asset-size-app" exec ember build -e production --output-path dists/experiment - name: Analyze Master Assets diff --git a/.github/workflows/compat-tests.yml b/.github/workflows/compat-tests.yml index d9219782c31..baaabb2fea9 100644 --- a/.github/workflows/compat-tests.yml +++ b/.github/workflows/compat-tests.yml @@ -43,7 +43,7 @@ jobs: - name: Install dependencies w/o lockfile run: pnpm install --no-lockfile - name: Build V2 Addons - run: pnpm build-v2-addons && pnpm install + run: pnpm install - name: Basic Tests run: pnpm test node-version-test: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 50f77db8dd3..286893c8868 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -16,8 +16,6 @@ jobs: cache: 'pnpm' - name: Install dependencies for master run: pnpm install - - name: Build V2 Addons - run: pnpm build-v2-addons - name: Basic Tests env: CI: true @@ -44,8 +42,6 @@ jobs: cache: 'pnpm' - name: Install dependencies for ${{ matrix.scenario }} run: pnpm install - - name: Build V2 Addons - run: pnpm build-v2-addons - name: Basic Tests env: CI: true diff --git a/.github/workflows/perf-check.yml b/.github/workflows/perf-check.yml index 6e09e62d230..3929716205b 100644 --- a/.github/workflows/perf-check.yml +++ b/.github/workflows/perf-check.yml @@ -40,9 +40,9 @@ jobs: cache: 'pnpm' - uses: tracerbench/tracerbench-compare-action@master with: - experiment-build-command: npm run --if-present build-v2-addons && pnpm install && pnpm --filter performance-test-app exec ember build -e production --output-path dist-experiment + experiment-build-command: pnpm install && pnpm --filter performance-test-app exec ember build -e production --output-path dist-experiment experiment-serve-command: pnpm --filter performance-test-app exec ember s --path dist-experiment --port 4201 - control-build-command: npm run --if-present build-v2-addons && pnpm install && pnpm --filter performance-test-app exec ember build -e production --output-path dist-control + control-build-command: pnpm install && pnpm --filter performance-test-app exec ember build -e production --output-path dist-control control-serve-command: pnpm --filter performance-test-app exec ember s --path dist-control sample-timeout: 60 use-pnpm: true diff --git a/.github/workflows/perf-over-release.yml b/.github/workflows/perf-over-release.yml index ff0bf65af5c..ecaacb9478f 100644 --- a/.github/workflows/perf-over-release.yml +++ b/.github/workflows/perf-over-release.yml @@ -40,9 +40,9 @@ jobs: cache: 'pnpm' - uses: tracerbench/tracerbench-compare-action@master with: - experiment-build-command: npm run --if-present build-v2-addons && pnpm install && pnpm --filter performance-test-app exec ember build -e production --output-path dist-experiment + experiment-build-command: pnpm install && pnpm --filter performance-test-app exec ember build -e production --output-path dist-experiment experiment-serve-command: pnpm --filter performance-test-app exec ember s --path dist-experiment --port 4201 - control-build-command: npm run --if-present build-v2-addons && pnpm install && pnpm --filter performance-test-app exec ember build -e production --output-path dist-control + control-build-command: pnpm install && pnpm --filter performance-test-app exec ember build -e production --output-path dist-control control-serve-command: pnpm --filter performance-test-app exec ember s --path dist-control sample-timeout: 60 use-pnpm: true diff --git a/.gitignore b/.gitignore index 16047f85901..99fc57e982c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ dist tmp packages/tracking/addon packages/request/addon +packages/store/addon # dependencies bower_components diff --git a/package.json b/package.json index e70ed9ad61d..89677a14b14 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "url": "git+ssh://git@github.com:emberjs/data.git" }, "scripts": { - "build-v2-addons": "pnpm --filter @ember-data/tracking --filter @ember-data/request --filter @ember-data/store build", "build:docs": "mkdir -p packages/-ember-data/dist && cd ./docs-generator && node ./compile-docs.js", "lint:js": "eslint --cache --ext=js,ts .", "preinstall": "npx only-allow pnpm", diff --git a/packages/request/package.json b/packages/request/package.json index 21a430e21af..35d16a5b8f5 100644 --- a/packages/request/package.json +++ b/packages/request/package.json @@ -32,7 +32,8 @@ "scripts": { "build": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js", "start": "rollup --config --watch", - "prepack": "pnpm build" + "prepack": "pnpm build", + "prepare": "pnpm build" }, "ember-addon": { "main": "addon-main.js", @@ -61,4 +62,4 @@ "ember": { "edition": "octane" } -} \ No newline at end of file +} diff --git a/packages/store/addon-main.js b/packages/store/addon-main.js index edd2275d0fb..1ec8a148f84 100644 --- a/packages/store/addon-main.js +++ b/packages/store/addon-main.js @@ -1,16 +1,9 @@ -const path = require('path'); - -const Funnel = require('broccoli-funnel'); - const pkg = require('./package.json'); module.exports = { name: pkg.name, options: { - babel: { - plugins: [require.resolve('@ember-data/private-build-infra/src/transforms/babel-plugin-transform-ext.js')], - }, '@embroider/macros': { setOwnConfig: {}, }, @@ -79,11 +72,6 @@ module.exports = { return this._super.included.call(this, ...arguments); }, - treeForAddon() { - const assetDir = path.join(__dirname, './dist'); - return this._super.treeForAddon.call(this, new Funnel(assetDir, { include: ['**/*.js'] })); - }, - treeForVendor() { return; }, diff --git a/packages/store/babel.config.js b/packages/store/babel.config.js index 5cb8ecffdc1..944b6102d62 100644 --- a/packages/store/babel.config.js +++ b/packages/store/babel.config.js @@ -4,10 +4,10 @@ module.exports = { plugins: [ ...macros, // '@embroider/macros/src/babel/macros-babel-plugin.js', - '@babel/plugin-transform-runtime', + ['@babel/plugin-transform-runtime', { loose: true }], ['@babel/plugin-transform-typescript', { allowDeclareFields: true }], - ['@babel/plugin-proposal-decorators', { legacy: true }], - '@babel/plugin-proposal-private-methods', - '@babel/plugin-proposal-class-properties', + ['@babel/plugin-proposal-decorators', { legacy: true, loose: true }], + ['@babel/plugin-proposal-private-methods', { loose: true }], + ['@babel/plugin-proposal-class-properties', { loose: true }], ], }; diff --git a/packages/store/package.json b/packages/store/package.json index 989a5d8b876..e8611df4864 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -14,23 +14,19 @@ "author": "", "directories": {}, "scripts": { - "build": "rollup --config", + "build": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js", "start": "rollup --config --watch", - "prepack": "rollup --config" + "prepack": "pnpm build", + "prepare": "pnpm build" }, "ember-addon": { "main": "addon-main.js", "type": "addon", "version": 1 }, - "exports": { - ".": "./dist/index.js", - "./*": "./dist/*", - "./addon-main.js": "./addon-main.js" - }, "files": [ "addon-main.js", - "dist" + "addon" ], "peerDependencies": { "@ember-data/model": "workspace:4.10.0-alpha.4", @@ -56,7 +52,6 @@ } }, "dependencies": { - "broccoli-funnel": "^3.0.8", "ember-cli-babel": "^7.26.11", "@ember-data/private-build-infra": "workspace:4.10.0-alpha.4", "@embroider/macros": "^1.10.0", @@ -65,6 +60,7 @@ }, "devDependencies": { "@babel/core": "^7.20.2", + "@babel/cli": "^7.19.3", "@glimmer/component": "^1.1.2", "webpack": "^5.75.0", "ember-source": "~4.8.2", diff --git a/packages/store/rollup.config.mjs b/packages/store/rollup.config.mjs index 28dfbe72a34..f5614554710 100644 --- a/packages/store/rollup.config.mjs +++ b/packages/store/rollup.config.mjs @@ -4,7 +4,7 @@ import { nodeResolve } from '@rollup/plugin-node-resolve'; const addon = new Addon({ srcDir: 'src', - destDir: 'dist', + destDir: 'addon', }); export default { @@ -22,9 +22,9 @@ export default { // to eliminate '@ember/object/compat', '@ember/runloop', - '@ember/service', '@ember/string', 'ember', + 'rsvp', // investigate why these are present '@ember/utils', diff --git a/packages/store/src/-private/caches/instance-cache.ts b/packages/store/src/-private/caches/instance-cache.ts index ac138b6bf76..1fbda100c1b 100644 --- a/packages/store/src/-private/caches/instance-cache.ts +++ b/packages/store/src/-private/caches/instance-cache.ts @@ -20,12 +20,12 @@ import type { StableRecordIdentifier, } from '@ember-data/types/q/identifier'; import type { RecordData } from '@ember-data/types/q/record-data'; -import { JsonApiRelationship, JsonApiResource } from '@ember-data/types/q/record-data-json-api'; -import { RelationshipSchema } from '@ember-data/types/q/record-data-schemas'; +import type { JsonApiRelationship, JsonApiResource } from '@ember-data/types/q/record-data-json-api'; +import type { RelationshipSchema } from '@ember-data/types/q/record-data-schemas'; import type { RecordDataStoreWrapper as StoreWrapper } from '@ember-data/types/q/record-data-store-wrapper'; import type { RecordInstance } from '@ember-data/types/q/record-instance'; import type { FindOptions } from '@ember-data/types/q/store'; -import { Dict } from '@ember-data/types/q/utils'; +import type { Dict } from '@ember-data/types/q/utils'; import RecordReference from '../legacy-model-support/record-reference'; import { NonSingletonRecordDataManager, SingletonRecordDataManager } from '../managers/record-data-manager'; @@ -33,9 +33,9 @@ import { RecordDataStoreWrapper } from '../managers/record-data-store-wrapper'; import Snapshot from '../network/snapshot'; import type { CreateRecordProperties } from '../store-service'; import type Store from '../store-service'; -import { assertIdentifierHasId } from '../store-service'; import coerceId, { ensureStringId } from '../utils/coerce-id'; import constructResource from '../utils/construct-resource'; +import { assertIdentifierHasId } from '../utils/identifier-has-id'; import normalizeModelName from '../utils/normalize-model-name'; import { removeRecordDataFor, setRecordDataFor } from './record-data-for'; diff --git a/packages/store/src/-private/store-service.ts b/packages/store/src/-private/store-service.ts index ca72f227fcc..f1d039e2755 100644 --- a/packages/store/src/-private/store-service.ts +++ b/packages/store/src/-private/store-service.ts @@ -68,6 +68,7 @@ import { PromiseArray, promiseArray, PromiseObject, promiseObject } from './prox import IdentifierArray, { Collection } from './record-arrays/identifier-array'; import coerceId, { ensureStringId } from './utils/coerce-id'; import constructResource from './utils/construct-resource'; +import { assertIdentifierHasId } from './utils/identifier-has-id'; import normalizeModelName from './utils/normalize-model-name'; import promiseRecord from './utils/promise-record'; @@ -2701,12 +2702,6 @@ function isMaybeIdentifier( ); } -export function assertIdentifierHasId( - identifier: StableRecordIdentifier -): asserts identifier is StableExistingRecordIdentifier { - assert(`Attempted to schedule a fetch for a record without an id.`, identifier.id !== null); -} - function isDSModel(record: RecordInstance | null): record is DSModel { return ( HAS_MODEL_PACKAGE && diff --git a/packages/store/src/-private/utils/identifier-has-id.ts b/packages/store/src/-private/utils/identifier-has-id.ts new file mode 100644 index 00000000000..07029de5c55 --- /dev/null +++ b/packages/store/src/-private/utils/identifier-has-id.ts @@ -0,0 +1,8 @@ +import type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@ember-data/types/q/identifier'; +import { assert } from '@ember/debug'; + +export function assertIdentifierHasId( + identifier: StableRecordIdentifier +): asserts identifier is StableExistingRecordIdentifier { + assert(`Attempted to schedule a fetch for a record without an id.`, identifier.id !== null); +} diff --git a/packages/tracking/package.json b/packages/tracking/package.json index c20ec77709a..217df70e895 100644 --- a/packages/tracking/package.json +++ b/packages/tracking/package.json @@ -31,7 +31,8 @@ "scripts": { "build": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js", "start": "rollup --config --watch", - "prepack": "pnpm build" + "prepack": "pnpm build", + "prepare": "pnpm build" }, "ember-addon": { "main": "addon-main.js", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f25ebc293b7..195ebaef47f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -527,27 +527,57 @@ importers: packages/store: specifiers: + '@babel/cli': ^7.19.3 '@babel/core': ^7.20.2 - '@ember-data/canary-features': workspace:4.10.0-alpha.4 + '@babel/plugin-proposal-class-properties': ^7.18.6 + '@babel/plugin-proposal-decorators': ^7.20.0 + '@babel/plugin-proposal-private-methods': ^7.18.6 + '@babel/plugin-transform-runtime': ^7.19.6 + '@babel/plugin-transform-typescript': ^7.20.0 + '@babel/preset-env': ^7.19.4 + '@babel/preset-typescript': ^7.18.6 + '@babel/runtime': ^7.20.0 '@ember-data/private-build-infra': workspace:4.10.0-alpha.4 + '@embroider/addon-dev': ^2.0.0 '@embroider/macros': ^1.10.0 '@glimmer/component': ^1.1.2 + '@rollup/plugin-babel': ^6.0.2 + '@rollup/plugin-node-resolve': ^15.0.1 ember-auto-import: ^2.5.0 ember-cached-decorator-polyfill: ^1.0.1 ember-cli-babel: ^7.26.11 ember-source: ~4.8.2 + rollup: ^3.2.3 + tslib: ^2.4.0 + typescript: ^4.8.4 + walk-sync: ^3.0.0 webpack: ^5.75.0 dependencies: - '@ember-data/canary-features': file:packages/canary-features '@ember-data/private-build-infra': file:packages/private-build-infra '@embroider/macros': 1.10.0 ember-auto-import: 2.5.0_webpack@5.75.0 ember-cached-decorator-polyfill: 1.0.1_o6vra3atesdmwivzf2sf5xbdmm ember-cli-babel: 7.26.11 devDependencies: + '@babel/cli': 7.19.3_@babel+core@7.20.2 '@babel/core': 7.20.2 + '@babel/plugin-proposal-class-properties': 7.18.6_@babel+core@7.20.2 + '@babel/plugin-proposal-decorators': 7.20.2_@babel+core@7.20.2 + '@babel/plugin-proposal-private-methods': 7.18.6_@babel+core@7.20.2 + '@babel/plugin-transform-runtime': 7.19.6_@babel+core@7.20.2 + '@babel/plugin-transform-typescript': 7.20.2_@babel+core@7.20.2 + '@babel/preset-env': 7.20.2_@babel+core@7.20.2 + '@babel/preset-typescript': 7.18.6_@babel+core@7.20.2 + '@babel/runtime': 7.20.1 + '@embroider/addon-dev': 2.0.0_jgqpuikonnnyxxj34ossexjace '@glimmer/component': 1.1.2_@babel+core@7.20.2 + '@rollup/plugin-babel': 6.0.3_ilus2vz5zuhvfvn5o2dsrag2wi + '@rollup/plugin-node-resolve': 15.0.1_rollup@3.7.0 ember-source: 4.8.2_rzt62hinieo7pkbxqnerr4utxi + rollup: 3.7.0 + tslib: 2.4.1 + typescript: 4.9.3 + walk-sync: 3.0.0 webpack: 5.75.0 dependenciesMeta: '@ember-data/canary-features': @@ -1861,6 +1891,7 @@ packages: semver: 6.3.0 transitivePeerDependencies: - supports-color + dev: true /@babel/eslint-parser/7.19.1_hojp5sdiorqnqfvcamcc5sgvyi: resolution: {integrity: sha512-AqNf2QWt1rtu2/1rLswy6CDP7H9Oh3mMhk177Y67Rg8d7RD9WfOLLv8CGn6tisFvS2htm86yIe1yLF6I1UDaGQ==} @@ -2102,6 +2133,7 @@ packages: '@babel/types': 7.20.2 transitivePeerDependencies: - supports-color + dev: true /@babel/helper-optimise-call-expression/7.18.6: resolution: {integrity: sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==} @@ -2213,6 +2245,7 @@ packages: '@babel/types': 7.20.2 transitivePeerDependencies: - supports-color + dev: true /@babel/highlight/7.18.6: resolution: {integrity: sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==} @@ -2384,7 +2417,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.20.2_supports-color@8.1.1 + '@babel/core': 7.20.2 '@babel/helper-plugin-utils': 7.20.2 '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3_@babel+core@7.20.2 @@ -2427,7 +2460,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.20.2_supports-color@8.1.1 + '@babel/core': 7.20.2 '@babel/helper-plugin-utils': 7.20.2 '@babel/helper-skip-transparent-expression-wrappers': 7.20.0 '@babel/plugin-syntax-optional-chaining': 7.8.3_@babel+core@7.20.2 @@ -2548,7 +2581,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.20.2_supports-color@8.1.1 + '@babel/core': 7.20.2 '@babel/helper-plugin-utils': 7.20.2 /@babel/plugin-syntax-numeric-separator/7.10.4_@babel+core@7.20.2: @@ -2580,7 +2613,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.20.2_supports-color@8.1.1 + '@babel/core': 7.20.2 '@babel/helper-plugin-utils': 7.20.2 /@babel/plugin-syntax-private-property-in-object/7.14.5_@babel+core@7.20.2: @@ -2899,7 +2932,7 @@ packages: dependencies: '@babel/core': 7.20.2 '@babel/helper-module-imports': 7.18.6 - '@babel/helper-plugin-utils': 7.19.0 + '@babel/helper-plugin-utils': 7.20.2 babel-plugin-polyfill-corejs2: 0.3.3_@babel+core@7.20.2 babel-plugin-polyfill-corejs3: 0.6.0_@babel+core@7.20.2 babel-plugin-polyfill-regenerator: 0.4.1_@babel+core@7.20.2 @@ -3335,6 +3368,7 @@ packages: globals: 11.12.0 transitivePeerDependencies: - supports-color + dev: true /@babel/types/7.20.0: resolution: {integrity: sha512-Jlgt3H0TajCW164wkTOTzHkZb075tMQMULzrLUoUeKmO7eFL96GgDxf7/Axhc5CAuKE3KFyVW1p6ysKsi2oXAg==} @@ -3448,6 +3482,34 @@ packages: - supports-color dev: true + /@embroider/addon-dev/2.0.0_jgqpuikonnnyxxj34ossexjace: + resolution: {integrity: sha512-XOThXF6/4rQWmKOaD20xFsdPkNzmSCRUsLG2Qb9z/NpNonN9AFjo385OkUgMju2bp1E+U2QQNqCEsZLH9jdG9w==} + engines: {node: 12.* || 14.* || >= 16} + hasBin: true + peerDependencies: + ember-source: '*' + peerDependenciesMeta: + ember-source: + optional: true + dependencies: + '@embroider/core': 1.9.0 + '@rollup/pluginutils': 4.2.1 + assert-never: 1.2.1 + ember-source: 4.8.2_rzt62hinieo7pkbxqnerr4utxi + fs-extra: 10.1.0 + minimatch: 3.1.2 + rollup-plugin-copy-assets: 2.0.3_rollup@3.7.0 + rollup-plugin-delete: 2.0.0 + walk-sync: 3.0.0 + yargs: 17.6.0 + transitivePeerDependencies: + - bufferutil + - canvas + - rollup + - supports-color + - utf-8-validate + dev: true + /@embroider/addon-dev/3.0.0_rollup@3.7.0: resolution: {integrity: sha512-h3ISDdp8LASA6583WC3IU3ECZ5fHlW3V3EkgpEeeH7KhxTerHjDjNf+S6+ZvPH+ZHi3WOCYPvUA5OfNICyMbtA==} engines: {node: 12.* || 14.* || >= 16} @@ -7561,7 +7623,7 @@ packages: - supports-color /concat-map/0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} /configstore/5.0.1: resolution: {integrity: sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==} @@ -8056,6 +8118,7 @@ packages: dependencies: ms: 2.1.2 supports-color: 8.1.1 + dev: true /decamelize/4.0.0: resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} @@ -8285,8 +8348,8 @@ packages: dependencies: '@babel/core': 7.20.2 '@babel/plugin-proposal-class-properties': 7.18.6_@babel+core@7.20.2 - '@babel/plugin-proposal-decorators': 7.20.0_@babel+core@7.20.2 - '@babel/preset-env': 7.19.4_@babel+core@7.20.2 + '@babel/plugin-proposal-decorators': 7.20.2_@babel+core@7.20.2 + '@babel/preset-env': 7.20.2_@babel+core@7.20.2 '@embroider/macros': 1.10.0 '@embroider/shared-internals': 1.8.3 babel-loader: 8.2.5_hkczypimj4evef4hfazf6yfxte @@ -8323,8 +8386,8 @@ packages: dependencies: '@babel/core': 7.20.2 '@babel/plugin-proposal-class-properties': 7.18.6_@babel+core@7.20.2 - '@babel/plugin-proposal-decorators': 7.20.0_@babel+core@7.20.2 - '@babel/preset-env': 7.19.4_@babel+core@7.20.2 + '@babel/plugin-proposal-decorators': 7.20.2_@babel+core@7.20.2 + '@babel/preset-env': 7.20.2_@babel+core@7.20.2 '@embroider/macros': 1.10.0 '@embroider/shared-internals': 1.8.3 babel-loader: 8.2.5_npabyccmuonwo2rku4k53xo3hi From 86b54fd2447399773cc17dca526585b9d38aa220 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Wed, 7 Dec 2022 23:51:58 -0800 Subject: [PATCH 7/9] fix lint --- packages/store/src/-private/utils/identifier-has-id.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/store/src/-private/utils/identifier-has-id.ts b/packages/store/src/-private/utils/identifier-has-id.ts index 07029de5c55..c48b5d3b376 100644 --- a/packages/store/src/-private/utils/identifier-has-id.ts +++ b/packages/store/src/-private/utils/identifier-has-id.ts @@ -1,6 +1,7 @@ -import type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@ember-data/types/q/identifier'; import { assert } from '@ember/debug'; +import type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@ember-data/types/q/identifier'; + export function assertIdentifierHasId( identifier: StableRecordIdentifier ): asserts identifier is StableExistingRecordIdentifier { From 17a7add2416702b3e901dcaba5df63dd43f632ec Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Thu, 8 Dec 2022 10:05:18 -0800 Subject: [PATCH 8/9] fix deps --- packages/store/package.json | 1 - pnpm-lock.yaml | 66 ++++++++++---------------- tests/model-encapsulation/package.json | 2 +- 3 files changed, 27 insertions(+), 42 deletions(-) diff --git a/packages/store/package.json b/packages/store/package.json index e8611df4864..2d85f77b0c9 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -55,7 +55,6 @@ "ember-cli-babel": "^7.26.11", "@ember-data/private-build-infra": "workspace:4.10.0-alpha.4", "@embroider/macros": "^1.10.0", - "ember-auto-import": "^2.5.0", "ember-cached-decorator-polyfill": "^1.0.1" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 195ebaef47f..170a0e03906 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -253,7 +253,7 @@ importers: '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/record-data': file:packages/record-data_ogssen3petzlrxu2jp77kbd7ka '@ember-data/serializer': file:packages/serializer_5er2ksmzjrpz2hfjbfgxrw6bey - '@ember-data/store': file:packages/store_f7zcyxyxu7apacjefnjp4w4zha + '@ember-data/store': file:packages/store_ay2ghmofe4mzaykjgvdh6vhjpu '@ember-data/tracking': file:packages/tracking '@ember/edition-utils': 1.2.0 '@ember/string': 3.0.0 @@ -543,7 +543,6 @@ importers: '@glimmer/component': ^1.1.2 '@rollup/plugin-babel': ^6.0.2 '@rollup/plugin-node-resolve': ^15.0.1 - ember-auto-import: ^2.5.0 ember-cached-decorator-polyfill: ^1.0.1 ember-cli-babel: ^7.26.11 ember-source: ~4.8.2 @@ -555,7 +554,6 @@ importers: dependencies: '@ember-data/private-build-infra': file:packages/private-build-infra '@embroider/macros': 1.10.0 - ember-auto-import: 2.5.0_webpack@5.75.0 ember-cached-decorator-polyfill: 1.0.1_o6vra3atesdmwivzf2sf5xbdmm ember-cli-babel: 7.26.11 devDependencies: @@ -745,7 +743,7 @@ importers: '@ember-data/model': file:packages/model_fgniduetvjrxwopb2vf7gj7uwy '@ember-data/record-data': file:packages/record-data_dgwrkmq7r6qfk3frqvisd56iue '@ember-data/serializer': file:packages/serializer_mlvxpb5zsngkdj4s77tymgcgtq - '@ember-data/store': file:packages/store_6rvvm535ip7b34aaqcs2jvsdfy + '@ember-data/store': file:packages/store_xqskmitp2kk2xfyxvp7fbxiypy '@ember-data/tracking': file:packages/tracking '@ember-data/unpublished-test-infra': file:packages/unpublished-test-infra '@ember/optional-features': 2.0.0 @@ -861,7 +859,7 @@ importers: '@ember-data/adapter': file:packages/adapter_mlvxpb5zsngkdj4s77tymgcgtq '@ember-data/model': file:packages/model_hf6aecxwqw7ngtlnvt3h57gcfe '@ember-data/serializer': file:packages/serializer_mlvxpb5zsngkdj4s77tymgcgtq - '@ember-data/store': file:packages/store_krukdbndhhlkrgilkm6boc4g5y + '@ember-data/store': file:packages/store_wycyuvyoee33ls5puf5kocpemy '@ember-data/tracking': file:packages/tracking '@ember-data/unpublished-test-infra': file:packages/unpublished-test-infra '@ember/optional-features': 2.0.0 @@ -1188,7 +1186,7 @@ importers: '@ember-data/model': file:packages/model_fgniduetvjrxwopb2vf7gj7uwy '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/record-data': file:packages/record-data_dgwrkmq7r6qfk3frqvisd56iue - '@ember-data/store': file:packages/store_6rvvm535ip7b34aaqcs2jvsdfy + '@ember-data/store': file:packages/store_xqskmitp2kk2xfyxvp7fbxiypy '@ember-data/tracking': file:packages/tracking '@ember-data/unpublished-test-infra': file:packages/unpublished-test-infra '@ember/edition-utils': 1.2.0 @@ -1316,7 +1314,7 @@ importers: '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/record-data': file:packages/record-data_dgwrkmq7r6qfk3frqvisd56iue '@ember-data/serializer': file:packages/serializer_mlvxpb5zsngkdj4s77tymgcgtq - '@ember-data/store': file:packages/store_6rvvm535ip7b34aaqcs2jvsdfy + '@ember-data/store': file:packages/store_xqskmitp2kk2xfyxvp7fbxiypy '@ember-data/tracking': file:packages/tracking '@ember-data/unpublished-test-infra': file:packages/unpublished-test-infra '@ember/edition-utils': 1.2.0 @@ -1435,7 +1433,7 @@ importers: '@ember-data/canary-features': file:packages/canary-features '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/serializer': file:packages/serializer_mlvxpb5zsngkdj4s77tymgcgtq - '@ember-data/store': file:packages/store_x5xppcsvbeyvm3cilovbje5aqi + '@ember-data/store': file:packages/store_24rwhycbxndajgnmpq7gbevzqy '@ember-data/tracking': file:packages/tracking '@ember-data/unpublished-test-infra': file:packages/unpublished-test-infra '@ember/optional-features': 2.0.0 @@ -1572,7 +1570,7 @@ importers: '@ember-data/debug': file:packages/debug_kmsc2736dkhfkaunrjhq23icem '@ember-data/model': file:packages/model_hf6aecxwqw7ngtlnvt3h57gcfe '@ember-data/serializer': file:packages/serializer_mlvxpb5zsngkdj4s77tymgcgtq - '@ember-data/store': file:packages/store_krukdbndhhlkrgilkm6boc4g5y + '@ember-data/store': file:packages/store_wycyuvyoee33ls5puf5kocpemy '@ember-data/tracking': file:packages/tracking '@ember-data/unpublished-test-infra': file:packages/unpublished-test-infra '@ember/optional-features': 2.0.0 @@ -1746,7 +1744,7 @@ importers: '@ember-data/adapter': file:packages/adapter_mlvxpb5zsngkdj4s77tymgcgtq '@ember-data/model': file:packages/model_fgniduetvjrxwopb2vf7gj7uwy '@ember-data/record-data': file:packages/record-data_dgwrkmq7r6qfk3frqvisd56iue - '@ember-data/store': file:packages/store_6rvvm535ip7b34aaqcs2jvsdfy + '@ember-data/store': file:packages/store_xqskmitp2kk2xfyxvp7fbxiypy '@ember-data/tracking': file:packages/tracking '@ember-data/unpublished-test-infra': file:packages/unpublished-test-infra '@ember/optional-features': 2.0.0 @@ -16471,7 +16469,7 @@ packages: '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/record-data': file:packages/record-data_dgwrkmq7r6qfk3frqvisd56iue '@ember-data/serializer': file:packages/serializer_mlvxpb5zsngkdj4s77tymgcgtq - '@ember-data/store': file:packages/store_6rvvm535ip7b34aaqcs2jvsdfy + '@ember-data/store': file:packages/store_xqskmitp2kk2xfyxvp7fbxiypy '@ember-data/tracking': file:packages/tracking '@ember/edition-utils': 1.2.0 '@ember/string': 3.0.0 @@ -16501,7 +16499,7 @@ packages: '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/record-data': file:packages/record-data_ogssen3petzlrxu2jp77kbd7ka '@ember-data/serializer': file:packages/serializer_5er2ksmzjrpz2hfjbfgxrw6bey - '@ember-data/store': file:packages/store_f7zcyxyxu7apacjefnjp4w4zha + '@ember-data/store': file:packages/store_ay2ghmofe4mzaykjgvdh6vhjpu '@ember-data/tracking': file:packages/tracking '@ember/edition-utils': 1.2.0 '@ember/string': 3.0.0 @@ -16552,7 +16550,7 @@ packages: ember-inflector: ^4.0.2 dependencies: '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store_f7zcyxyxu7apacjefnjp4w4zha + '@ember-data/store': file:packages/store_ay2ghmofe4mzaykjgvdh6vhjpu '@ember/edition-utils': 1.2.0 '@ember/string': 3.0.0 '@embroider/macros': 1.10.0 @@ -16577,7 +16575,7 @@ packages: ember-inflector: ^4.0.2 dependencies: '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store_krukdbndhhlkrgilkm6boc4g5y + '@ember-data/store': file:packages/store_wycyuvyoee33ls5puf5kocpemy '@ember/edition-utils': 1.2.0 '@ember/string': 3.0.0 '@embroider/macros': 1.10.0 @@ -16691,7 +16689,7 @@ packages: '@ember-data/canary-features': file:packages/canary-features '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/record-data': file:packages/record-data_dgwrkmq7r6qfk3frqvisd56iue - '@ember-data/store': file:packages/store_6rvvm535ip7b34aaqcs2jvsdfy + '@ember-data/store': file:packages/store_xqskmitp2kk2xfyxvp7fbxiypy '@ember-data/tracking': file:packages/tracking '@ember/edition-utils': 1.2.0 '@ember/string': 3.0.0 @@ -16728,7 +16726,7 @@ packages: dependencies: '@ember-data/canary-features': file:packages/canary-features '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store_krukdbndhhlkrgilkm6boc4g5y + '@ember-data/store': file:packages/store_wycyuvyoee33ls5puf5kocpemy '@ember-data/tracking': file:packages/tracking '@ember/edition-utils': 1.2.0 '@ember/string': 3.0.0 @@ -16766,7 +16764,7 @@ packages: '@ember-data/canary-features': file:packages/canary-features '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/record-data': file:packages/record-data_ogssen3petzlrxu2jp77kbd7ka - '@ember-data/store': file:packages/store_f7zcyxyxu7apacjefnjp4w4zha + '@ember-data/store': file:packages/store_ay2ghmofe4mzaykjgvdh6vhjpu '@ember-data/tracking': file:packages/tracking '@ember/edition-utils': 1.2.0 '@ember/string': 3.0.0 @@ -16834,7 +16832,7 @@ packages: dependencies: '@ember-data/canary-features': file:packages/canary-features '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store_6rvvm535ip7b34aaqcs2jvsdfy + '@ember-data/store': file:packages/store_xqskmitp2kk2xfyxvp7fbxiypy '@ember/edition-utils': 1.2.0 '@embroider/macros': 1.10.0 ember-auto-import: 2.5.0_webpack@5.74.0 @@ -16854,7 +16852,7 @@ packages: dependencies: '@ember-data/canary-features': file:packages/canary-features '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store_f7zcyxyxu7apacjefnjp4w4zha + '@ember-data/store': file:packages/store_ay2ghmofe4mzaykjgvdh6vhjpu '@ember/edition-utils': 1.2.0 '@embroider/macros': 1.10.0 ember-auto-import: 2.5.0_webpack@5.75.0 @@ -16908,7 +16906,7 @@ packages: ember-inflector: ^4.0.2 dependencies: '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store_f7zcyxyxu7apacjefnjp4w4zha + '@ember-data/store': file:packages/store_ay2ghmofe4mzaykjgvdh6vhjpu '@ember/string': 3.0.0 '@embroider/macros': 1.10.0 ember-auto-import: 2.5.0_webpack@5.75.0 @@ -16932,7 +16930,7 @@ packages: ember-inflector: ^4.0.2 dependencies: '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/store': file:packages/store_6rvvm535ip7b34aaqcs2jvsdfy + '@ember-data/store': file:packages/store_xqskmitp2kk2xfyxvp7fbxiypy '@ember/string': 3.0.0 '@embroider/macros': 1.10.0 ember-auto-import: 2.5.0_webpack@5.74.0 @@ -16943,7 +16941,7 @@ packages: - supports-color - webpack - file:packages/store_6rvvm535ip7b34aaqcs2jvsdfy: + file:packages/store_24rwhycbxndajgnmpq7gbevzqy: resolution: {directory: packages/store, type: directory} id: file:packages/store name: '@ember-data/store' @@ -16961,24 +16959,20 @@ packages: '@ember-data/record-data': optional: true dependencies: - '@ember-data/canary-features': file:packages/canary-features - '@ember-data/model': file:packages/model_fgniduetvjrxwopb2vf7gj7uwy '@ember-data/private-build-infra': file:packages/private-build-infra - '@ember-data/record-data': file:packages/record-data_dgwrkmq7r6qfk3frqvisd56iue '@ember-data/tracking': file:packages/tracking '@ember/string': 3.0.0 '@embroider/macros': 1.10.0 '@glimmer/tracking': 1.1.2 - ember-auto-import: 2.5.0_webpack@5.74.0 ember-cached-decorator-polyfill: 1.0.1_44zau4gslyki3rcm3qc4yjjvrq ember-cli-babel: 7.26.11 transitivePeerDependencies: - '@babel/core' - ember-source - supports-color - - webpack + dev: true - file:packages/store_f7zcyxyxu7apacjefnjp4w4zha: + file:packages/store_ay2ghmofe4mzaykjgvdh6vhjpu: resolution: {directory: packages/store, type: directory} id: file:packages/store name: '@ember-data/store' @@ -16996,7 +16990,6 @@ packages: '@ember-data/record-data': optional: true dependencies: - '@ember-data/canary-features': file:packages/canary-features '@ember-data/model': file:packages/model_ioy3abppj7zef5o734fhdefjli '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/record-data': file:packages/record-data_ogssen3petzlrxu2jp77kbd7ka @@ -17004,17 +16997,15 @@ packages: '@ember/string': 3.0.0 '@embroider/macros': 1.10.0 '@glimmer/tracking': 1.1.2 - ember-auto-import: 2.5.0_webpack@5.75.0 ember-cached-decorator-polyfill: 1.0.1_o6vra3atesdmwivzf2sf5xbdmm ember-cli-babel: 7.26.11 transitivePeerDependencies: - '@babel/core' - ember-source - supports-color - - webpack dev: false - file:packages/store_krukdbndhhlkrgilkm6boc4g5y: + file:packages/store_wycyuvyoee33ls5puf5kocpemy: resolution: {directory: packages/store, type: directory} id: file:packages/store name: '@ember-data/store' @@ -17032,23 +17023,20 @@ packages: '@ember-data/record-data': optional: true dependencies: - '@ember-data/canary-features': file:packages/canary-features '@ember-data/model': file:packages/model_hf6aecxwqw7ngtlnvt3h57gcfe '@ember-data/private-build-infra': file:packages/private-build-infra '@ember-data/tracking': file:packages/tracking '@ember/string': 3.0.0 '@embroider/macros': 1.10.0 '@glimmer/tracking': 1.1.2 - ember-auto-import: 2.5.0_webpack@5.74.0 ember-cached-decorator-polyfill: 1.0.1_44zau4gslyki3rcm3qc4yjjvrq ember-cli-babel: 7.26.11 transitivePeerDependencies: - '@babel/core' - ember-source - supports-color - - webpack - file:packages/store_x5xppcsvbeyvm3cilovbje5aqi: + file:packages/store_xqskmitp2kk2xfyxvp7fbxiypy: resolution: {directory: packages/store, type: directory} id: file:packages/store name: '@ember-data/store' @@ -17066,21 +17054,19 @@ packages: '@ember-data/record-data': optional: true dependencies: - '@ember-data/canary-features': file:packages/canary-features + '@ember-data/model': file:packages/model_fgniduetvjrxwopb2vf7gj7uwy '@ember-data/private-build-infra': file:packages/private-build-infra + '@ember-data/record-data': file:packages/record-data_dgwrkmq7r6qfk3frqvisd56iue '@ember-data/tracking': file:packages/tracking '@ember/string': 3.0.0 '@embroider/macros': 1.10.0 '@glimmer/tracking': 1.1.2 - ember-auto-import: 2.5.0_webpack@5.74.0 ember-cached-decorator-polyfill: 1.0.1_44zau4gslyki3rcm3qc4yjjvrq ember-cli-babel: 7.26.11 transitivePeerDependencies: - '@babel/core' - ember-source - supports-color - - webpack - dev: true file:packages/tracking: resolution: {directory: packages/tracking, type: directory} diff --git a/tests/model-encapsulation/package.json b/tests/model-encapsulation/package.json index bff3121a595..881bdbe06da 100644 --- a/tests/model-encapsulation/package.json +++ b/tests/model-encapsulation/package.json @@ -89,4 +89,4 @@ "extends": "../../package.json" }, "packageManager": "pnpm@7.15.0" -} \ No newline at end of file +} From 8e014f4cd2c657fda50223efa1a3e2abf06f9c75 Mon Sep 17 00:00:00 2001 From: Chris Thoburn Date: Thu, 8 Dec 2022 10:48:59 -0800 Subject: [PATCH 9/9] make some small size optimizations --- packages/request/babel.config.json | 6 +++--- packages/request/src/-private/context.ts | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/request/babel.config.json b/packages/request/babel.config.json index fea1b66f091..109a93113dc 100644 --- a/packages/request/babel.config.json +++ b/packages/request/babel.config.json @@ -1,8 +1,8 @@ { "plugins": [ - "@babel/plugin-transform-runtime", + ["@babel/plugin-transform-runtime", { "loose": true }], ["@babel/plugin-transform-typescript", { "allowDeclareFields": true }], - ["@babel/plugin-proposal-decorators", { "legacy": true }], - "@babel/plugin-proposal-class-properties" + ["@babel/plugin-proposal-decorators", { "legacy": true, "loose": true }], + ["@babel/plugin-proposal-class-properties", { "loose": true }] ] } diff --git a/packages/request/src/-private/context.ts b/packages/request/src/-private/context.ts index 285d19c1aa5..2e0fd5e5053 100644 --- a/packages/request/src/-private/context.ts +++ b/packages/request/src/-private/context.ts @@ -10,11 +10,11 @@ export class ContextOwner { hasSubscribers = false; stream: Deferred = createDeferred(); response: ResponseInfo | null = null; - request: ImmutableRequestInfo; - enhancedRequest: ImmutableRequestInfo; + declare request: ImmutableRequestInfo; + declare enhancedRequest: ImmutableRequestInfo; nextCalled: number = 0; - god: GodContext; - controller: AbortController; + declare god: GodContext; + declare controller: AbortController; constructor(request: RequestInfo, god: GodContext) { this.controller = request.controller || god.controller; @@ -126,7 +126,7 @@ export class ContextOwner { export class Context { #owner: ContextOwner; - request: ImmutableRequestInfo; + declare request: ImmutableRequestInfo; constructor(owner: ContextOwner) { this.#owner = owner;