@warp-drive/ember 5.5.0-alpha.20 → 5.5.0-alpha.22
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/dist/install.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import '@ember-data/store/-private';
|
|
2
|
+
import { tagForProperty } from '@ember/-internals/metal';
|
|
3
|
+
import { createCache, track, updateTag, consumeTag, getValue, dirtyTag } from '@glimmer/validator';
|
|
4
|
+
import { _backburner } from '@ember/runloop';
|
|
5
|
+
import { setupSignals } from '@ember-data/store/configure';
|
|
6
|
+
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
7
|
+
const emberDirtyTag = dirtyTag;
|
|
8
|
+
function buildSignalConfig(options) {
|
|
9
|
+
const ARRAY_SIGNAL = options.wellknown.Array;
|
|
10
|
+
return {
|
|
11
|
+
createSignal(obj, key) {
|
|
12
|
+
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
13
|
+
if (key === ARRAY_SIGNAL) {
|
|
14
|
+
return [tagForProperty(obj, key), tagForProperty(obj, 'length'), tagForProperty(obj, '[]')];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return tagForProperty(obj, key);
|
|
18
|
+
},
|
|
19
|
+
consumeSignal(signal) {
|
|
20
|
+
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
21
|
+
if (Array.isArray(signal)) {
|
|
22
|
+
consumeTag(signal[0]);
|
|
23
|
+
consumeTag(signal[1]);
|
|
24
|
+
consumeTag(signal[2]);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
consumeTag(signal);
|
|
29
|
+
},
|
|
30
|
+
notifySignal(signal) {
|
|
31
|
+
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
32
|
+
if (Array.isArray(signal)) {
|
|
33
|
+
emberDirtyTag(signal[0]);
|
|
34
|
+
emberDirtyTag(signal[1]);
|
|
35
|
+
emberDirtyTag(signal[2]);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
emberDirtyTag(signal);
|
|
40
|
+
},
|
|
41
|
+
createMemo: (object, key, fn) => {
|
|
42
|
+
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
43
|
+
const propertyTag = tagForProperty(object, key);
|
|
44
|
+
const memo = createCache(fn);
|
|
45
|
+
let ret;
|
|
46
|
+
const wrappedFn = () => {
|
|
47
|
+
ret = getValue(memo);
|
|
48
|
+
};
|
|
49
|
+
return () => {
|
|
50
|
+
const tag = track(wrappedFn);
|
|
51
|
+
updateTag(propertyTag, tag);
|
|
52
|
+
consumeTag(tag);
|
|
53
|
+
return ret;
|
|
54
|
+
};
|
|
55
|
+
} else {
|
|
56
|
+
const memo = createCache(fn);
|
|
57
|
+
return () => getValue(memo);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
willSyncFlushWatchers: () => {
|
|
61
|
+
//@ts-expect-error
|
|
62
|
+
return !!_backburner.currentInstance && _backburner._autorun !== true;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
setupSignals(buildSignalConfig);
|
|
67
|
+
export { buildSignalConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sources":["../src/install.ts"],"sourcesContent":["import { SignalHooks } from '@ember-data/store/-private';\nimport { tagForProperty } from '@ember/-internals/metal';\nimport { consumeTag, createCache, dirtyTag, getValue, track, updateTag, type UpdatableTag } from '@glimmer/validator';\n\nimport { _backburner } from '@ember/runloop';\n// import { createCache, getValue } from '@glimmer/tracking/primitives/cache';\nimport { DEPRECATE_COMPUTED_CHAINS } from '@warp-drive/build-config/deprecations';\nimport { setupSignals } from '@ember-data/store/configure';\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\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 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 } satisfies SignalHooks<Tag | [Tag, Tag, Tag]>;\n}\n\nsetupSignals(buildSignalConfig);\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","setupSignals"],"mappings":";;;;;;;AAUA,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,CAAC,CAAC,CAAC;AACrBE,UAAAA,UAAU,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC;AACrBE,UAAAA,UAAU,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC;AACrB,UAAA;AACF;AACF;MAEAE,UAAU,CAACF,MAAa,CAAC;KAC1B;IACDG,YAAYA,CAACH,MAA6B,EAAE;MAC1C,IAAAP,cAAA,CAAAC,eAAA,EAAA,CAAAC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C,YAAY,CAACnC,iBAAiB,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/ember",
|
|
3
3
|
"description": "Data bindings and utilities for Ember applications using WarpDrive",
|
|
4
|
-
"version": "5.5.0-alpha.
|
|
4
|
+
"version": "5.5.0-alpha.22",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Chris Thoburn <runspired@users.noreply.github.com>",
|
|
7
7
|
"repository": {
|
|
@@ -36,16 +36,15 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"ember-source": "3.28.12 || ^4.0.4 || ^5.0.0 || ^6.0.0",
|
|
38
38
|
"@ember/test-waiters": "^3.1.0 || ^4.0.0",
|
|
39
|
-
"@ember-data/store": "5.5.0-alpha.
|
|
40
|
-
"@ember-data/request": "5.5.0-alpha.
|
|
41
|
-
"@ember-data/request-utils": "5.5.0-alpha.
|
|
42
|
-
"@warp-drive/core-types": "5.5.0-alpha.
|
|
43
|
-
"ember-provide-consume-context": "^0.7.0"
|
|
44
|
-
"@ember-data/tracking": "5.5.0-alpha.20"
|
|
39
|
+
"@ember-data/store": "5.5.0-alpha.22",
|
|
40
|
+
"@ember-data/request": "5.5.0-alpha.22",
|
|
41
|
+
"@ember-data/request-utils": "5.5.0-alpha.22",
|
|
42
|
+
"@warp-drive/core-types": "5.5.0-alpha.22",
|
|
43
|
+
"ember-provide-consume-context": "^0.7.0"
|
|
45
44
|
},
|
|
46
45
|
"dependencies": {
|
|
47
46
|
"@embroider/macros": "^1.16.12",
|
|
48
|
-
"@warp-drive/build-config": "5.5.0-alpha.
|
|
47
|
+
"@warp-drive/build-config": "5.5.0-alpha.22"
|
|
49
48
|
},
|
|
50
49
|
"peerDependenciesMeta": {
|
|
51
50
|
"ember-provide-consume-context": {
|
|
@@ -67,14 +66,13 @@
|
|
|
67
66
|
"@glint/template": "1.5.2",
|
|
68
67
|
"decorator-transforms": "^2.3.0",
|
|
69
68
|
"@embroider/addon-dev": "^7.1.3",
|
|
70
|
-
"@ember-data/request": "5.5.0-alpha.
|
|
71
|
-
"@ember-data/request-utils": "5.5.0-alpha.
|
|
72
|
-
"@ember-data/store": "5.5.0-alpha.
|
|
73
|
-
"@ember-data/tracking": "5.5.0-alpha.20",
|
|
69
|
+
"@ember-data/request": "5.5.0-alpha.22",
|
|
70
|
+
"@ember-data/request-utils": "5.5.0-alpha.22",
|
|
71
|
+
"@ember-data/store": "5.5.0-alpha.22",
|
|
74
72
|
"@ember/test-helpers": "5.2.0",
|
|
75
73
|
"@ember/test-waiters": "^4.1.0",
|
|
76
|
-
"@warp-drive/core-types": "5.5.0-alpha.
|
|
77
|
-
"@warp-drive/internal-config": "5.5.0-alpha.
|
|
74
|
+
"@warp-drive/core-types": "5.5.0-alpha.22",
|
|
75
|
+
"@warp-drive/internal-config": "5.5.0-alpha.22",
|
|
78
76
|
"babel-plugin-ember-template-compilation": "^2.4.1",
|
|
79
77
|
"ember-template-imports": "^4.3.0",
|
|
80
78
|
"ember-source": "~6.3.0",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare module '@warp-drive/ember/install' {
|
|
2
|
+
import { tagForProperty } from '@ember/-internals/metal';
|
|
3
|
+
type Tag = ReturnType<typeof tagForProperty>;
|
|
4
|
+
export function buildSignalConfig(options: {
|
|
5
|
+
wellknown: {
|
|
6
|
+
Array: symbol | string;
|
|
7
|
+
};
|
|
8
|
+
}): {
|
|
9
|
+
createSignal(obj: object, key: string | symbol): import("@glimmer/validator").Tag | [import("@glimmer/validator").Tag, import("@glimmer/validator").Tag, import("@glimmer/validator").Tag];
|
|
10
|
+
consumeSignal(signal: Tag | [Tag, Tag, Tag]): void;
|
|
11
|
+
notifySignal(signal: Tag | [Tag, Tag, Tag]): void;
|
|
12
|
+
createMemo: <F>(object: object, key: string | symbol, fn: () => F) => (() => F);
|
|
13
|
+
willSyncFlushWatchers: () => boolean;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAQzD,KAAK,GAAG,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAG7C,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,CAAC;CACH;sBAIqB,MAAM,OAAO,MAAM,GAAG,MAAM;0BAQxB,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;yBAYtB,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;iBAW7B,CAAC,UAAU,MAAM,OAAO,MAAM,GAAG,MAAM,MAAM,MAAM,CAAC,KAAG,CAAC,MAAM,CAAC,CAAC;;EAwBhF"}
|