@ember-data/tracking 5.6.0-beta.0 → 5.6.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/addon-main.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const { addonShim } = require('@warp-drive/build-config/addon-shim.cjs');
3
+ const { addonShim } = require('@warp-drive/core/addon-shim.cjs');
4
4
 
5
5
  module.exports = addonShim(__dirname);
package/dist/index.js CHANGED
@@ -1,8 +1,85 @@
1
1
  import { tagForProperty } from '@ember/-internals/metal';
2
2
  import { _backburner } from '@ember/runloop';
3
3
  import { createCache, track, updateTag, consumeTag, getValue, dirtyTag } from '@glimmer/validator';
4
- import { macroCondition, getGlobalConfig } from '@embroider/macros';
4
+ import { macroCondition, getGlobalConfig, importSync } from '@embroider/macros';
5
+
6
+ /**
7
+ * # ~~@ember-data/tracking~~ <Badge type="warning" text="deprecated v5.5" />
8
+ *
9
+ * Using ***Warp*Drive** with EmberJS requires configuring it to use Ember's reactivity system.
10
+ *
11
+ * ::: warning
12
+ * The use of the package **@ember-data/tracking** is now deprecated. It
13
+ * historically provided the bindings into Ember's reactivity system.
14
+ *
15
+ * This package is no longer needed as the configuration is now
16
+ * provided by the package [@warp-drive/ember](../../@warp-drive/ember).
17
+ * :::
18
+ *
19
+ * To resolve this deprecation, follow these steps:
20
+ *
21
+ * ## 1. Remove @ember-data/tracking
22
+ *
23
+ * - Remove `@ember-data/tracking` from package.json (if using `ember-data` this may not be present)
24
+ * - Remove type imports for `@ember-data/tracking` from tsconfig.json
25
+ * - If using `untracked`, change to using `untrack` from `@glimmer/validator`
26
+ *
27
+ * ## 2. Add @warp-drive/ember
28
+ *
29
+ * - Add `@warp-drive/ember` to package.json - the version to install should match the version of `ember-data` or `@ember-data/store`
30
+ * - Do NOT add `@warp-drive/ember` to tsconfig.json - the types in this package install automatically, you can remove any entry for this if it is there
31
+ * - Add `import '@warp-drive/ember/install';` to the top of your `app.js` or `app.ts` file
32
+ *
33
+ * ## 3. Clear the deprecation
34
+ *
35
+ * Once the above steps are complete, the deprecation can be silenced and the automatic fallback
36
+ * registration of reactivity from `@ember-data/tracking` can be removed by updating your [WarpDrive
37
+ * build config](../../@warp-drive/build-config) in your `ember-cli-build` file.
38
+ *
39
+ * ```js [ember-cli-build.js]
40
+ * 'use strict';
41
+ * const EmberApp = require('ember-cli/lib/broccoli/ember-app');
42
+ * const { compatBuild } = require('@embroider/compat');
43
+ *
44
+ * module.exports = async function (defaults) {
45
+ * const { setConfig } = await import('@warp-drive/build-config'); // [!code focus]
46
+ * const { buildOnce } = await import('@embroider/vite');
47
+ * const app = new EmberApp(defaults, {});
48
+ *
49
+ * setConfig(app, __dirname, { // [!code focus:9]
50
+ * // this should be the most recent <major>.<minor> version for
51
+ * // which all deprecations have been fully resolved
52
+ * // and should be updated when that changes
53
+ * compatWith: '4.12'
54
+ * deprecations: {
55
+ * // ... list individual deprecations that have been resolved here
56
+ * DEPRECATE_TRACKING_PACKAGE: false // [!code highlight]
57
+ * }
58
+ * });
59
+ *
60
+ * return compatBuild(app, buildOnce);
61
+ * };
62
+ *```
63
+ *
64
+ * @deprecated in version 5.5.0
65
+ * @module
66
+ */
5
67
  const emberDirtyTag = dirtyTag;
68
+
69
+ /**
70
+ * <Badge type="warning" text="deprecated" />
71
+ *
72
+ * Creates a signal configuration object for WarpDrive that integrates with Ember's
73
+ * reactivity system. This will be automatically imported and registered by
74
+ * `@ember-data/store` if the deprecation has not been resolved.
75
+ *
76
+ * This function should not be called directly in your application code
77
+ * and this package is deprecated entirely, see the [package overview](../../)
78
+ * for more details.
79
+ *
80
+ * @deprecated
81
+ * @public
82
+ */
6
83
  function buildSignalConfig(options) {
7
84
  const ARRAY_SIGNAL = options.wellknown.Array;
8
85
  return {
@@ -58,7 +135,17 @@ function buildSignalConfig(options) {
58
135
  willSyncFlushWatchers: () => {
59
136
  //@ts-expect-error
60
137
  return !!_backburner.currentInstance && _backburner._autorun !== true;
138
+ },
139
+ waitFor: async promise => {
140
+ if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
141
+ const {
142
+ waitForPromise
143
+ } = importSync('@ember/test-waiters');
144
+ return waitForPromise(promise);
145
+ }
146
+ return promise;
61
147
  }
62
148
  };
63
149
  }
64
- export { buildSignalConfig };
150
+
151
+ export { buildSignalConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ember-data/tracking",
3
3
  "description": "DEPRECATED - Use @warp-drive/ember",
4
- "version": "5.6.0-beta.0",
4
+ "version": "5.6.0-beta.1",
5
5
  "deprecated": "Use @warp-drive/ember",
6
6
  "private": false,
7
7
  "license": "MIT",
@@ -21,11 +21,10 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@embroider/macros": "^1.16.12",
24
- "@warp-drive/build-config": "5.6.0-beta.0"
24
+ "@warp-drive/core": "5.6.0-beta.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "ember-source": "3.28.12 || ^4.0.4 || ^5.0.0 || ^6.0.0",
28
- "@warp-drive/core-types": "5.6.0-beta.0"
27
+ "@ember/test-waiters": "^3.1.0 || ^4.0.0"
29
28
  },
30
29
  "files": [
31
30
  "unstable-preview-types",
@@ -57,13 +56,11 @@
57
56
  "@babel/plugin-transform-typescript": "^7.27.0",
58
57
  "@babel/preset-env": "^7.26.9",
59
58
  "@babel/preset-typescript": "^7.27.0",
60
- "@glimmer/component": "^2.0.0",
61
- "@glimmer/validator": "^0.94.8",
62
- "@warp-drive/core-types": "5.6.0-beta.0",
63
- "@warp-drive/internal-config": "5.6.0-beta.0",
59
+ "@ember/test-waiters": "^4.1.0",
60
+ "@warp-drive/internal-config": "5.6.0-beta.1",
64
61
  "ember-source": "~6.3.0",
65
62
  "typescript": "^5.8.3",
66
- "vite": "^5.4.15"
63
+ "vite": "^7.0.0"
67
64
  },
68
65
  "ember": {
69
66
  "edition": "octane"
@@ -1,18 +1,94 @@
1
1
 
2
2
  declare module '@ember-data/tracking' {
3
- import { tagForProperty } from '@ember/-internals/metal';
3
+ /**
4
+ * # ~~@ember-data/tracking~~ <Badge type="warning" text="deprecated v5.5" />
5
+ *
6
+ * Using ***Warp*Drive** with EmberJS requires configuring it to use Ember's reactivity system.
7
+ *
8
+ * ::: warning
9
+ * The use of the package **@ember-data/tracking** is now deprecated. It
10
+ * historically provided the bindings into Ember's reactivity system.
11
+ *
12
+ * This package is no longer needed as the configuration is now
13
+ * provided by the package [@warp-drive/ember](../../@warp-drive/ember).
14
+ * :::
15
+ *
16
+ * To resolve this deprecation, follow these steps:
17
+ *
18
+ * ## 1. Remove @ember-data/tracking
19
+ *
20
+ * - Remove `@ember-data/tracking` from package.json (if using `ember-data` this may not be present)
21
+ * - Remove type imports for `@ember-data/tracking` from tsconfig.json
22
+ * - If using `untracked`, change to using `untrack` from `@glimmer/validator`
23
+ *
24
+ * ## 2. Add @warp-drive/ember
25
+ *
26
+ * - Add `@warp-drive/ember` to package.json - the version to install should match the version of `ember-data` or `@ember-data/store`
27
+ * - Do NOT add `@warp-drive/ember` to tsconfig.json - the types in this package install automatically, you can remove any entry for this if it is there
28
+ * - Add `import '@warp-drive/ember/install';` to the top of your `app.js` or `app.ts` file
29
+ *
30
+ * ## 3. Clear the deprecation
31
+ *
32
+ * Once the above steps are complete, the deprecation can be silenced and the automatic fallback
33
+ * registration of reactivity from `@ember-data/tracking` can be removed by updating your [WarpDrive
34
+ * build config](../../@warp-drive/build-config) in your `ember-cli-build` file.
35
+ *
36
+ * ```js [ember-cli-build.js]
37
+ * 'use strict';
38
+ * const EmberApp = require('ember-cli/lib/broccoli/ember-app');
39
+ * const { compatBuild } = require('@embroider/compat');
40
+ *
41
+ * module.exports = async function (defaults) {
42
+ * const { setConfig } = await import('@warp-drive/build-config'); // [!code focus]
43
+ * const { buildOnce } = await import('@embroider/vite');
44
+ * const app = new EmberApp(defaults, {});
45
+ *
46
+ * setConfig(app, __dirname, { // [!code focus:9]
47
+ * // this should be the most recent <major>.<minor> version for
48
+ * // which all deprecations have been fully resolved
49
+ * // and should be updated when that changes
50
+ * compatWith: '4.12'
51
+ * deprecations: {
52
+ * // ... list individual deprecations that have been resolved here
53
+ * DEPRECATE_TRACKING_PACKAGE: false // [!code highlight]
54
+ * }
55
+ * });
56
+ *
57
+ * return compatBuild(app, buildOnce);
58
+ * };
59
+ *```
60
+ *
61
+ * @deprecated in version 5.5.0
62
+ * @module
63
+ */
64
+ import { tagForProperty } from "@ember/-internals/metal";
4
65
  type Tag = ReturnType<typeof tagForProperty>;
66
+ /**
67
+ * <Badge type="warning" text="deprecated" />
68
+ *
69
+ * Creates a signal configuration object for WarpDrive that integrates with Ember's
70
+ * reactivity system. This will be automatically imported and registered by
71
+ * `@ember-data/store` if the deprecation has not been resolved.
72
+ *
73
+ * This function should not be called directly in your application code
74
+ * and this package is deprecated entirely, see the [package overview](../../)
75
+ * for more details.
76
+ *
77
+ * @deprecated
78
+ * @public
79
+ */
5
80
  export function buildSignalConfig(options: {
6
- wellknown: {
7
- Array: symbol | string;
8
- };
81
+ wellknown: {
82
+ Array: symbol | string;
83
+ };
9
84
  }): {
10
- createSignal(obj: object, key: string | symbol): import("@glimmer/validator").Tag | readonly [import("@glimmer/validator").Tag, import("@glimmer/validator").Tag, import("@glimmer/validator").Tag];
11
- consumeSignal(signal: Tag | [Tag, Tag, Tag]): void;
12
- notifySignal(signal: Tag | [Tag, Tag, Tag]): void;
13
- createMemo: <F>(object: object, key: string | symbol, fn: () => F) => (() => F);
14
- willSyncFlushWatchers: () => boolean;
85
+ createSignal(obj: object, key: string | symbol): Tag | [Tag, Tag, Tag];
86
+ consumeSignal(signal: Tag | [Tag, Tag, Tag]): void;
87
+ notifySignal(signal: Tag | [Tag, Tag, Tag]): void;
88
+ createMemo: <F>(object: object, key: string | symbol, fn: () => F) => (() => F);
89
+ willSyncFlushWatchers: () => boolean;
90
+ waitFor: <K>(promise: Promise<K>) => Promise<K>;
15
91
  };
16
92
  export {};
17
- }
18
- //# sourceMappingURL=index.d.ts.map
93
+
94
+ }
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { tagForProperty } from '@ember/-internals/metal';\nimport { _backburner } from '@ember/runloop';\nimport { consumeTag, createCache, dirtyTag, getValue, track, type UpdatableTag, updateTag } from '@glimmer/validator';\n\n// import { createCache, getValue } from '@glimmer/tracking/primitives/cache';\nimport { DEPRECATE_COMPUTED_CHAINS } from '@warp-drive/build-config/deprecations';\n\ntype Tag = ReturnType<typeof tagForProperty>;\nconst emberDirtyTag = dirtyTag as unknown as (tag: Tag) => void;\n\nexport function buildSignalConfig(options: {\n wellknown: {\n Array: symbol | string;\n };\n}) {\n const ARRAY_SIGNAL = options.wellknown.Array;\n\n return {\n createSignal(obj: object, key: string | symbol) {\n if (DEPRECATE_COMPUTED_CHAINS) {\n if (key === ARRAY_SIGNAL) {\n return [tagForProperty(obj, key), tagForProperty(obj, 'length'), tagForProperty(obj, '[]')] as const;\n }\n }\n return tagForProperty(obj, key);\n },\n consumeSignal(signal: Tag | [Tag, Tag, Tag]) {\n if (DEPRECATE_COMPUTED_CHAINS) {\n if (Array.isArray(signal)) {\n consumeTag(signal[0]);\n consumeTag(signal[1]);\n consumeTag(signal[2]);\n return;\n }\n }\n consumeTag(signal as Tag);\n },\n notifySignal(signal: Tag | [Tag, Tag, Tag]) {\n if (DEPRECATE_COMPUTED_CHAINS) {\n if (Array.isArray(signal)) {\n emberDirtyTag(signal[0]);\n emberDirtyTag(signal[1]);\n emberDirtyTag(signal[2]);\n return;\n }\n }\n\n emberDirtyTag(signal as Tag);\n },\n createMemo: <F>(object: object, key: string | symbol, fn: () => F): (() => F) => {\n if (DEPRECATE_COMPUTED_CHAINS) {\n const propertyTag = tagForProperty(object, key) as UpdatableTag;\n const memo = createCache(fn);\n let ret: F | undefined;\n const wrappedFn = () => {\n ret = getValue(memo) as F;\n };\n return () => {\n const tag = track(wrappedFn);\n updateTag(propertyTag, tag);\n consumeTag(tag);\n return ret!;\n };\n } else {\n const memo = createCache(fn);\n return () => getValue(memo) as F;\n }\n },\n willSyncFlushWatchers: () => {\n //@ts-expect-error\n return !!_backburner.currentInstance && _backburner._autorun !== true;\n },\n };\n}\n"],"names":["emberDirtyTag","dirtyTag","buildSignalConfig","options","ARRAY_SIGNAL","wellknown","Array","createSignal","obj","key","macroCondition","getGlobalConfig","WarpDrive","deprecations","DEPRECATE_COMPUTED_CHAINS","tagForProperty","consumeSignal","signal","isArray","consumeTag","notifySignal","createMemo","object","fn","propertyTag","memo","createCache","ret","wrappedFn","getValue","tag","track","updateTag","willSyncFlushWatchers","_backburner","currentInstance","_autorun"],"mappings":";;;;;AAQA,MAAMA,aAAa,GAAGC,QAAyC;AAExD,SAASC,iBAAiBA,CAACC,OAIjC,EAAE;AACD,EAAA,MAAMC,YAAY,GAAGD,OAAO,CAACE,SAAS,CAACC,KAAK;EAE5C,OAAO;AACLC,IAAAA,YAAYA,CAACC,GAAW,EAAEC,GAAoB,EAAE;MAC9C,IAAAC,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,YAAA,CAAAC,yBAAA,CAA+B,EAAA;QAC7B,IAAIL,GAAG,KAAKL,YAAY,EAAE;UACxB,OAAO,CAACW,cAAc,CAACP,GAAG,EAAEC,GAAG,CAAC,EAAEM,cAAc,CAACP,GAAG,EAAE,QAAQ,CAAC,EAAEO,cAAc,CAACP,GAAG,EAAE,IAAI,CAAC,CAAC;AAC7F;AACF;AACA,MAAA,OAAOO,cAAc,CAACP,GAAG,EAAEC,GAAG,CAAC;KAChC;IACDO,aAAaA,CAACC,MAA6B,EAAE;MAC3C,IAAAP,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,YAAA,CAAAC,yBAAA,CAA+B,EAAA;AAC7B,QAAA,IAAIR,KAAK,CAACY,OAAO,CAACD,MAAM,CAAC,EAAE;AACzBE,UAAAA,UAAU,CAACF,MAAM,CAAC,CAA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