@warp-drive/build-config 0.0.2 → 0.0.3
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/addon-shim.cjs +7 -24
- package/dist/addon-shim.cjs.map +1 -1
- package/dist/babel-macros.js +2 -2
- package/dist/babel-plugin-transform-features.cjs +1 -5
- package/dist/babel-plugin-transform-features.cjs.map +1 -1
- package/dist/{canary-features-BzGSGY5j.js → canary-features-CFdRGi2p.js} +41 -26
- package/dist/canary-features-CFdRGi2p.js.map +1 -0
- package/dist/canary-features.js +1 -1
- package/dist/cjs-set-config.cjs +154 -132
- package/dist/cjs-set-config.cjs.map +1 -1
- package/dist/{debugging-PCb4hczb.js → debugging-Dc--S1MJ.js} +29 -53
- package/dist/debugging-Dc--S1MJ.js.map +1 -0
- package/dist/debugging.js +1 -1
- package/dist/index.js +91 -60
- package/dist/index.js.map +1 -1
- package/package.json +11 -12
- package/unstable-preview-types/canary-features.d.ts +36 -24
- package/unstable-preview-types/canary-features.d.ts.map +1 -1
- package/unstable-preview-types/debugging.d.ts +25 -48
- package/unstable-preview-types/debugging.d.ts.map +1 -1
- package/unstable-preview-types/deprecation-versions.d.ts +18 -42
- package/unstable-preview-types/deprecation-versions.d.ts.map +1 -1
- package/unstable-preview-types/index.d.ts +1 -0
- package/unstable-preview-types/index.d.ts.map +1 -1
- package/dist/canary-features-BzGSGY5j.js.map +0 -1
- package/dist/debugging-PCb4hczb.js.map +0 -1
package/dist/addon-shim.cjs
CHANGED
|
@@ -2,29 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const path = require('path');
|
|
7
|
-
const pkg = require(path.join(dirName, './package.json'));
|
|
8
|
-
const isV2Addon = pkg['ember-addon']?.version === 2;
|
|
9
|
-
if (isV2Addon) {
|
|
10
|
-
const {
|
|
11
|
-
addonV1Shim
|
|
12
|
-
} = require('@embroider/addon-shim');
|
|
13
|
-
return addonV1Shim(dirName, options);
|
|
14
|
-
}
|
|
15
|
-
const Funnel = require('broccoli-funnel');
|
|
16
|
-
return {
|
|
17
|
-
name: pkg.name,
|
|
18
|
-
treeForVendor() {},
|
|
19
|
-
treeForPublic() {},
|
|
20
|
-
treeForStyles() {},
|
|
21
|
-
treeForAddonStyles() {},
|
|
22
|
-
treeForApp() {},
|
|
23
|
-
treeForAddon() {
|
|
24
|
-
return this._super.treeForAddon.call(this, new Funnel(path.join(dirName, 'dist')));
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
5
|
+
const addonShim = require('@embroider/addon-shim');
|
|
28
6
|
|
|
29
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "addonShim", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: () => addonShim.addonV1Shim
|
|
12
|
+
});
|
|
30
13
|
//# sourceMappingURL=addon-shim.cjs.map
|
package/dist/addon-shim.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addon-shim.cjs","sources":[
|
|
1
|
+
{"version":3,"file":"addon-shim.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/dist/babel-macros.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LOGGING } from './debugging-
|
|
2
|
-
import { C as CURRENT_FEATURES } from './canary-features-
|
|
1
|
+
import { L as LOGGING } from './debugging-Dc--S1MJ.js';
|
|
2
|
+
import { C as CURRENT_FEATURES } from './canary-features-CFdRGi2p.js';
|
|
3
3
|
import { C as CURRENT_DEPRECATIONS } from './deprecations-ChFQtx-4.js';
|
|
4
4
|
|
|
5
5
|
const features = Object.keys(CURRENT_FEATURES);
|
|
@@ -6,7 +6,7 @@ const fs = require('fs');
|
|
|
6
6
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
7
7
|
const pkg = JSON.parse(fs.readFileSync(new URL("../package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('babel-plugin-transform-features.cjs', document.baseURI).href))), 'utf-8'));
|
|
8
8
|
const version = pkg.version;
|
|
9
|
-
|
|
9
|
+
version.includes('alpha');
|
|
10
10
|
function parentIsUnary(node) {
|
|
11
11
|
if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {
|
|
12
12
|
return true;
|
|
@@ -35,10 +35,6 @@ function babelPluginTransformFeatures (babel) {
|
|
|
35
35
|
binding.referencePaths.forEach(p => {
|
|
36
36
|
let negateStatement = false;
|
|
37
37
|
let node = p;
|
|
38
|
-
if (!isCanary) {
|
|
39
|
-
p.replaceWith(t.boolean(state.opts.flags[name]));
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
38
|
if (parentIsUnary(p)) {
|
|
43
39
|
negateStatement = true;
|
|
44
40
|
node = p.parentPath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-transform-features.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-features.js"],"sourcesContent":["import { ImportUtil } from 'babel-import-util';\nimport fs from 'fs';\n\nconst pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8'));\nconst version = pkg.version;\n\nconst isCanary = version.includes('alpha');\n\nfunction parentIsUnary(node) {\n if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {\n return true;\n }\n return false;\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === state.opts.source) {\n const specifiers = path.get('specifiers');\n specifiers.forEach((specifier) => {\n let name = specifier.node.imported.name;\n if (!(name in state.opts.flags)) {\n throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);\n }\n let localBindingName = specifier.node.local.name;\n let binding = specifier.scope.getBinding(localBindingName);\n binding.referencePaths.forEach((p) => {\n let negateStatement = false;\n let node = p;\n
|
|
1
|
+
{"version":3,"file":"babel-plugin-transform-features.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-features.js"],"sourcesContent":["import { ImportUtil } from 'babel-import-util';\nimport fs from 'fs';\n\nconst pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8'));\nconst version = pkg.version;\n\nconst isCanary = version.includes('alpha');\n\nfunction parentIsUnary(node) {\n if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {\n return true;\n }\n return false;\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === state.opts.source) {\n const specifiers = path.get('specifiers');\n specifiers.forEach((specifier) => {\n let name = specifier.node.imported.name;\n if (!(name in state.opts.flags)) {\n throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);\n }\n let localBindingName = specifier.node.local.name;\n let binding = specifier.scope.getBinding(localBindingName);\n binding.referencePaths.forEach((p) => {\n let negateStatement = false;\n let node = p;\n\n if (parentIsUnary(p)) {\n negateStatement = true;\n node = p.parentPath;\n }\n let getConfig = t.memberExpression(\n t.memberExpression(\n t.memberExpression(\n t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []),\n t.identifier('WarpDrive')\n ),\n t.identifier('features')\n ),\n t.identifier(name)\n );\n node.replaceWith(\n // if (LOG_FOO)\n // =>\n // if (macroCondition(getGlobalConfig('WarpDrive').debug.LOG_FOO))\n t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [\n negateStatement ? t.unaryExpression('!', getConfig) : getConfig,\n ])\n );\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["pkg","JSON","parse","fs","readFileSync","version","includes","parentIsUnary","node","parent","type","operator","babel","types","t","name","visitor","ImportDeclaration","path","state","importPath","source","value","opts","specifiers","get","forEach","specifier","imported","flags","Error","localBindingName","local","binding","scope","getBinding","referencePaths","p","negateStatement","parentPath","getConfig","memberExpression","callExpression","importer","import","identifier","replaceWith","unaryExpression","removeOwnBinding","remove","length","Program","ImportUtil"],"mappings":"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"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
+
*
|
|
3
|
+
* @module @warp-drive/build-config
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
2
8
|
* ## Canary Features
|
|
3
9
|
*
|
|
4
10
|
* EmberData allows users to test features that are implemented but not yet
|
|
@@ -31,24 +37,22 @@
|
|
|
31
37
|
*
|
|
32
38
|
* ```cli
|
|
33
39
|
* # Activate a single flag
|
|
34
|
-
*
|
|
40
|
+
* WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG ember build
|
|
35
41
|
*
|
|
36
42
|
* # Activate multiple flags by separating with commas
|
|
37
|
-
*
|
|
43
|
+
* WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG,OTHER_FLAG ember build
|
|
38
44
|
*
|
|
39
45
|
* # Activate all flags
|
|
40
|
-
*
|
|
46
|
+
* WARP_DRIVE_FEATURE_OVERRIDE=ENABLE_ALL_OPTIONAL ember build
|
|
41
47
|
* ```
|
|
42
48
|
*
|
|
43
49
|
* or by setting the appropriate flag in your `ember-cli-build` file:
|
|
44
50
|
*
|
|
45
51
|
* ```ts
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* OTHER_FEATURE_FLAG: true // utilize this new feature, strip code for the older behavior
|
|
51
|
-
* }
|
|
52
|
+
* setConfig(app, __dirname, {
|
|
53
|
+
* features: {
|
|
54
|
+
* SAMPLE_FEATURE_FLAG: false // utliize existing behavior, strip code for the new feature
|
|
55
|
+
* OTHER_FEATURE_FLAG: true // utilize this new feature, strip code for the older behavior
|
|
52
56
|
* }
|
|
53
57
|
* })
|
|
54
58
|
* ```
|
|
@@ -70,28 +74,39 @@
|
|
|
70
74
|
* }
|
|
71
75
|
* ```
|
|
72
76
|
*
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
The
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
- `null` | The feature is **disabled by default**, but can be enabled via configuration.
|
|
85
|
-
|
|
86
|
-
@class CanaryFeatureFlags
|
|
87
|
-
@public
|
|
77
|
+
* The current list of features used at build time for canary releases is defined below.
|
|
78
|
+
* If empty there are no features currently gated by feature flags.
|
|
79
|
+
*
|
|
80
|
+
* The valid values are:
|
|
81
|
+
*
|
|
82
|
+
* - `true` | The feature is **enabled** at all times, and cannot be disabled.
|
|
83
|
+
* - `false` | The feature is **disabled** at all times, and cannot be enabled.
|
|
84
|
+
* - `null` | The feature is **disabled by default**, but can be enabled via configuration.
|
|
85
|
+
*
|
|
86
|
+
* @class CanaryFeatures
|
|
87
|
+
* @public
|
|
88
88
|
*/
|
|
89
89
|
const SAMPLE_FEATURE_FLAG = null;
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* This upcoming feature adds a validation step to payloads received
|
|
93
|
+
* by the JSONAPICache implementation.
|
|
94
|
+
*
|
|
95
|
+
* When a request completes and the result is given to the cache via
|
|
96
|
+
* `cache.put`, the cache will validate the payload against registered
|
|
97
|
+
* schemas as well as the JSON:API spec.
|
|
98
|
+
*
|
|
99
|
+
* @property JSON_API_CACHE_VALIDATION_ERRORS
|
|
100
|
+
* @since 5.4
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
const JSON_API_CACHE_VALIDATION_ERRORS = false;
|
|
104
|
+
|
|
91
105
|
const CURRENT_FEATURES = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
92
106
|
__proto__: null,
|
|
107
|
+
JSON_API_CACHE_VALIDATION_ERRORS,
|
|
93
108
|
SAMPLE_FEATURE_FLAG
|
|
94
109
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
95
110
|
|
|
96
|
-
export { CURRENT_FEATURES as C, SAMPLE_FEATURE_FLAG as S };
|
|
97
|
-
//# sourceMappingURL=canary-features-
|
|
111
|
+
export { CURRENT_FEATURES as C, JSON_API_CACHE_VALIDATION_ERRORS as J, SAMPLE_FEATURE_FLAG as S };
|
|
112
|
+
//# sourceMappingURL=canary-features-CFdRGi2p.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canary-features-CFdRGi2p.js","sources":["../src/canary-features.ts"],"sourcesContent":["/**\n *\n * @module @warp-drive/build-config\n */\n\n/**\n *\n * ## Canary Features\n *\n * EmberData allows users to test features that are implemented but not yet\n * available even in canary.\n *\n * Typically these features represent work that might introduce a new concept,\n * new API, change an API, or risk an unintended change in behavior to consuming\n * applications.\n *\n * Such features have their implementations guarded by a \"feature flag\", and the\n * flag is only activated once the core-data team is prepared to ship the work\n * in a canary release.\n *\n * ### Installing Canary\n *\n * To test a feature you MUST be using a canary build. Canary builds are published\n * to `npm` and can be installed using a precise tag (such as `ember-data@3.16.0-alpha.1`)\n * or by installing the latest dist-tag published to the `canary` channel using your javascript\n * package manager of choice. For instance with [pnpm](https://pnpm.io/)\n\n ```cli\n pnpm add ember-data@canary\n ```\n *\n * ### Activating a Canary Feature\n *\n * Once you have installed canary, feature-flags can be activated at build-time\n *\n * by setting an environment variable:\n *\n * ```cli\n * # Activate a single flag\n * WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG ember build\n *\n * # Activate multiple flags by separating with commas\n * WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG,OTHER_FLAG ember build\n *\n * # Activate all flags\n * WARP_DRIVE_FEATURE_OVERRIDE=ENABLE_ALL_OPTIONAL ember build\n * ```\n *\n * or by setting the appropriate flag in your `ember-cli-build` file:\n *\n * ```ts\n * setConfig(app, __dirname, {\n * features: {\n * SAMPLE_FEATURE_FLAG: false // utliize existing behavior, strip code for the new feature\n * OTHER_FEATURE_FLAG: true // utilize this new feature, strip code for the older behavior\n * }\n * })\n * ```\n *\n * **The \"off\" branch of feature-flagged code is always stripped from production builds.**\n *\n * The list of available feature-flags is located [here](https://github.com/emberjs/data/tree/main/packages/build-config/src/virtual/canary-features.ts \"List of EmberData FeatureFlags\")\n *\n *\n * ### Preparing a Project to use a Canary Feature\n *\n * For most projects, simple version detection should be enough.\n * Using the provided version compatibility helpers from [embroider-macros](https://github.com/embroider-build/embroider/tree/main/packages/macros#readme)\n * the following can be done:\n *\n * ```js\n * if (macroCondition(dependencySatisfies('@ember-data/store', '5.0'))) {\n * // do thing\n * }\n * ```\n *\n * The current list of features used at build time for canary releases is defined below.\n * If empty there are no features currently gated by feature flags.\n *\n * The valid values are:\n *\n * - `true` | The feature is **enabled** at all times, and cannot be disabled.\n * - `false` | The feature is **disabled** at all times, and cannot be enabled.\n * - `null` | The feature is **disabled by default**, but can be enabled via configuration.\n *\n * @class CanaryFeatures\n * @public\n*/\nexport const SAMPLE_FEATURE_FLAG: boolean | null = null;\n\n/**\n * This upcoming feature adds a validation step to payloads received\n * by the JSONAPICache implementation.\n *\n * When a request completes and the result is given to the cache via\n * `cache.put`, the cache will validate the payload against registered\n * schemas as well as the JSON:API spec.\n *\n * @property JSON_API_CACHE_VALIDATION_ERRORS\n * @since 5.4\n * @public\n */\nexport const JSON_API_CACHE_VALIDATION_ERRORS: boolean | null = false;\n"],"names":["SAMPLE_FEATURE_FLAG","JSON_API_CACHE_VALIDATION_ERRORS"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmC,GAAG;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,gCAAgD,GAAG;;;;;;;;;;"}
|
package/dist/canary-features.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { S as SAMPLE_FEATURE_FLAG } from './canary-features-
|
|
1
|
+
export { J as JSON_API_CACHE_VALIDATION_ERRORS, S as SAMPLE_FEATURE_FLAG } from './canary-features-CFdRGi2p.js';
|
|
2
2
|
//# sourceMappingURL=canary-features.js.map
|
package/dist/cjs-set-config.cjs
CHANGED
|
@@ -32,6 +32,9 @@ function getEnv() {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* @module @warp-drive/build-config
|
|
37
|
+
*/
|
|
35
38
|
// ========================
|
|
36
39
|
// FOR CONTRIBUTING AUTHORS
|
|
37
40
|
//
|
|
@@ -51,7 +54,7 @@ function getEnv() {
|
|
|
51
54
|
//
|
|
52
55
|
|
|
53
56
|
/**
|
|
54
|
-
* ##
|
|
57
|
+
* ## Deprecation Management
|
|
55
58
|
*
|
|
56
59
|
* EmberData allows users to opt-in and remove code that exists to support deprecated
|
|
57
60
|
* behaviors.
|
|
@@ -69,54 +72,26 @@ function getEnv() {
|
|
|
69
72
|
* with `3.12`. This would remove any deprecations that were present in or before `3.12`
|
|
70
73
|
* but keep support for anything deprecated in or above `3.13`.
|
|
71
74
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* To configure your compatibility version, set the `compatWith` to the version you
|
|
75
|
-
* are compatible with on the `emberData` config in your `ember-cli-build.js` file.
|
|
76
|
-
*
|
|
77
|
-
* ```js
|
|
78
|
-
* const { setConfig } = await import('@warp-drive/build-config');
|
|
79
|
-
*
|
|
80
|
-
* let app = new EmberApp(defaults, {});
|
|
81
|
-
*
|
|
82
|
-
* setConfig(app, __dirname, { compatWith: '3.12' });
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* Alternatively, individual deprecations can be resolved (and thus have its support stripped)
|
|
86
|
-
* via one of the flag names listed below. For instance, given a flag named `DEPRECATE_FOO_BEHAVIOR`.
|
|
87
|
-
*
|
|
88
|
-
* This capability is interopable with `compatWith`. You may set `compatWith` and then selectively resolve
|
|
89
|
-
* additional deprecations, or set compatWith and selectively un-resolve specific deprecations.
|
|
90
|
-
*
|
|
91
|
-
* Note: EmberData does not test against permutations of deprecations being stripped, our tests run against
|
|
92
|
-
* "all deprecated code included" and "all deprecated code removed". Unspecified behavior may sometimes occur
|
|
93
|
-
* when removing code for only some deprecations associated to a version number.
|
|
94
|
-
*
|
|
95
|
-
* ```js
|
|
96
|
-
* const { setConfig } = await import('@warp-drive/build-config');
|
|
97
|
-
*
|
|
98
|
-
* let app = new EmberApp(defaults, {});
|
|
75
|
+
* You may also specify that specific deprecations are resolved. These approaches
|
|
76
|
+
* may be used together.
|
|
99
77
|
*
|
|
78
|
+
* ```ts
|
|
100
79
|
* setConfig(app, __dirname, {
|
|
80
|
+
* // declare that all deprecations through "5.0" have been fully resolved
|
|
81
|
+
* compatWith: '5.0',
|
|
82
|
+
*
|
|
83
|
+
* // mark individual deprecations as resolved by setting them to `false`
|
|
101
84
|
* deprecations: {
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* }
|
|
85
|
+
* // resolve individual deprecations here
|
|
86
|
+
* },
|
|
105
87
|
* });
|
|
106
88
|
* ```
|
|
107
89
|
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* The following list represents deprecations currently active.
|
|
117
|
-
*
|
|
118
|
-
* Some deprecation flags guard multiple deprecation IDs. All
|
|
119
|
-
* associated IDs are listed.
|
|
90
|
+
* > [!TIP]
|
|
91
|
+
* > EmberData does not test against permutations of deprecations
|
|
92
|
+
* > being stripped, our tests run against "all deprecated code included"
|
|
93
|
+
* > and "all deprecated code removed". Unspecified behavior may sometimes occur
|
|
94
|
+
* > when removing code for only some deprecations associated to a version number.
|
|
120
95
|
*
|
|
121
96
|
* @class CurrentDeprecations
|
|
122
97
|
* @public
|
|
@@ -570,6 +545,12 @@ function getDeprecations(compatVersion, deprecations) {
|
|
|
570
545
|
}
|
|
571
546
|
|
|
572
547
|
/**
|
|
548
|
+
*
|
|
549
|
+
* @module @warp-drive/build-config
|
|
550
|
+
*/
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
*
|
|
573
554
|
* ## Canary Features
|
|
574
555
|
*
|
|
575
556
|
* EmberData allows users to test features that are implemented but not yet
|
|
@@ -602,24 +583,22 @@ function getDeprecations(compatVersion, deprecations) {
|
|
|
602
583
|
*
|
|
603
584
|
* ```cli
|
|
604
585
|
* # Activate a single flag
|
|
605
|
-
*
|
|
586
|
+
* WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG ember build
|
|
606
587
|
*
|
|
607
588
|
* # Activate multiple flags by separating with commas
|
|
608
|
-
*
|
|
589
|
+
* WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG,OTHER_FLAG ember build
|
|
609
590
|
*
|
|
610
591
|
* # Activate all flags
|
|
611
|
-
*
|
|
592
|
+
* WARP_DRIVE_FEATURE_OVERRIDE=ENABLE_ALL_OPTIONAL ember build
|
|
612
593
|
* ```
|
|
613
594
|
*
|
|
614
595
|
* or by setting the appropriate flag in your `ember-cli-build` file:
|
|
615
596
|
*
|
|
616
597
|
* ```ts
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
* OTHER_FEATURE_FLAG: true // utilize this new feature, strip code for the older behavior
|
|
622
|
-
* }
|
|
598
|
+
* setConfig(app, __dirname, {
|
|
599
|
+
* features: {
|
|
600
|
+
* SAMPLE_FEATURE_FLAG: false // utliize existing behavior, strip code for the new feature
|
|
601
|
+
* OTHER_FEATURE_FLAG: true // utilize this new feature, strip code for the older behavior
|
|
623
602
|
* }
|
|
624
603
|
* })
|
|
625
604
|
* ```
|
|
@@ -641,26 +620,37 @@ function getDeprecations(compatVersion, deprecations) {
|
|
|
641
620
|
* }
|
|
642
621
|
* ```
|
|
643
622
|
*
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
The
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
- `null` | The feature is **disabled by default**, but can be enabled via configuration.
|
|
656
|
-
|
|
657
|
-
@class CanaryFeatureFlags
|
|
658
|
-
@public
|
|
623
|
+
* The current list of features used at build time for canary releases is defined below.
|
|
624
|
+
* If empty there are no features currently gated by feature flags.
|
|
625
|
+
*
|
|
626
|
+
* The valid values are:
|
|
627
|
+
*
|
|
628
|
+
* - `true` | The feature is **enabled** at all times, and cannot be disabled.
|
|
629
|
+
* - `false` | The feature is **disabled** at all times, and cannot be enabled.
|
|
630
|
+
* - `null` | The feature is **disabled by default**, but can be enabled via configuration.
|
|
631
|
+
*
|
|
632
|
+
* @class CanaryFeatures
|
|
633
|
+
* @public
|
|
659
634
|
*/
|
|
660
635
|
const SAMPLE_FEATURE_FLAG = null;
|
|
661
636
|
|
|
637
|
+
/**
|
|
638
|
+
* This upcoming feature adds a validation step to payloads received
|
|
639
|
+
* by the JSONAPICache implementation.
|
|
640
|
+
*
|
|
641
|
+
* When a request completes and the result is given to the cache via
|
|
642
|
+
* `cache.put`, the cache will validate the payload against registered
|
|
643
|
+
* schemas as well as the JSON:API spec.
|
|
644
|
+
*
|
|
645
|
+
* @property JSON_API_CACHE_VALIDATION_ERRORS
|
|
646
|
+
* @since 5.4
|
|
647
|
+
* @public
|
|
648
|
+
*/
|
|
649
|
+
const JSON_API_CACHE_VALIDATION_ERRORS = false;
|
|
650
|
+
|
|
662
651
|
const CURRENT_FEATURES = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
663
652
|
__proto__: null,
|
|
653
|
+
JSON_API_CACHE_VALIDATION_ERRORS,
|
|
664
654
|
SAMPLE_FEATURE_FLAG
|
|
665
655
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
666
656
|
|
|
@@ -681,7 +671,7 @@ function getFeatures(isProd) {
|
|
|
681
671
|
}
|
|
682
672
|
return features;
|
|
683
673
|
}
|
|
684
|
-
const FEATURE_OVERRIDES = process.env.
|
|
674
|
+
const FEATURE_OVERRIDES = process.env.WARP_DRIVE_FEATURE_OVERRIDE;
|
|
685
675
|
if (FEATURE_OVERRIDES === 'ENABLE_ALL_OPTIONAL') {
|
|
686
676
|
// enable all features with a current value of `null`
|
|
687
677
|
for (const feature of keys) {
|
|
@@ -720,65 +710,43 @@ function getFeatures(isProd) {
|
|
|
720
710
|
}
|
|
721
711
|
|
|
722
712
|
/**
|
|
723
|
-
|
|
724
|
-
*
|
|
725
|
-
* Many portions of the internals are helpfully instrumented with logging that can be activated
|
|
726
|
-
* at build time. This instrumentation is always removed from production builds or any builds
|
|
727
|
-
* that has not explicitly activated it. To activate it set the appropriate flag to `true`.
|
|
728
|
-
*
|
|
729
|
-
@module @warp-drive/build-config/debugging
|
|
730
|
-
@main @warp-drive/build-config/debugging
|
|
713
|
+
@module @warp-drive/build-config
|
|
731
714
|
*/
|
|
732
715
|
/**
|
|
716
|
+
* ## Debug Logging
|
|
733
717
|
*
|
|
734
718
|
* Many portions of the internals are helpfully instrumented with logging that can be activated
|
|
735
|
-
at build time. This instrumentation is always removed from production builds or any builds
|
|
736
|
-
that has not explicitly activated it. To activate it set the appropriate flag to `true`.
|
|
737
|
-
|
|
738
|
-
```ts
|
|
739
|
-
let app = new EmberApp(defaults, {
|
|
740
|
-
emberData: {
|
|
741
|
-
debug: {
|
|
742
|
-
LOG_PAYLOADS: false, // data store received to update cache with
|
|
743
|
-
LOG_OPERATIONS: false, // updates to cache remote state
|
|
744
|
-
LOG_MUTATIONS: false, // updates to cache local state
|
|
745
|
-
LOG_NOTIFICATIONS: false,
|
|
746
|
-
LOG_REQUESTS: false,
|
|
747
|
-
LOG_REQUEST_STATUS: false,
|
|
748
|
-
LOG_IDENTIFIERS: false,
|
|
749
|
-
LOG_GRAPH: false,
|
|
750
|
-
LOG_INSTANCE_CACHE: false,
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
});
|
|
754
|
-
```
|
|
755
|
-
|
|
756
|
-
@class DebugLogging
|
|
757
|
-
@public
|
|
758
|
-
*/
|
|
759
|
-
/**
|
|
760
|
-
* log payloads received by the store
|
|
761
|
-
* via `push` or returned from a delete/update/create
|
|
762
|
-
* operation.
|
|
719
|
+
* at build time. This instrumentation is always removed from production builds or any builds
|
|
720
|
+
* that has not explicitly activated it. To activate it set the appropriate flag to `true`.
|
|
763
721
|
*
|
|
764
|
-
*
|
|
765
|
-
*
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
*
|
|
722
|
+
* ```ts
|
|
723
|
+
* setConfig(__dirname, app, {
|
|
724
|
+
* debug: {
|
|
725
|
+
* LOG_CACHE: false, // data store received to update cache with
|
|
726
|
+
* LOG_NOTIFICATIONS: false,
|
|
727
|
+
* LOG_REQUESTS: false,
|
|
728
|
+
* LOG_REQUEST_STATUS: false,
|
|
729
|
+
* LOG_IDENTIFIERS: false,
|
|
730
|
+
* LOG_GRAPH: false,
|
|
731
|
+
* LOG_INSTANCE_CACHE: false,
|
|
732
|
+
* LOG_METRIC_COUNTS: false,
|
|
733
|
+
* DEBUG_RELATIONSHIP_NOTIFICATIONS: false,
|
|
734
|
+
* }
|
|
735
|
+
* });
|
|
736
|
+
* ```
|
|
770
737
|
*
|
|
771
|
-
* @
|
|
738
|
+
* @class DebugLogging
|
|
772
739
|
* @public
|
|
773
740
|
*/
|
|
774
|
-
const LOG_OPERATIONS = false;
|
|
775
741
|
/**
|
|
776
|
-
* log
|
|
742
|
+
* log cache updates for both local
|
|
743
|
+
* and remote state.
|
|
777
744
|
*
|
|
778
|
-
* @property {boolean}
|
|
745
|
+
* @property {boolean} LOG_CACHE
|
|
779
746
|
* @public
|
|
780
747
|
*/
|
|
781
|
-
const
|
|
748
|
+
const LOG_CACHE = false;
|
|
749
|
+
|
|
782
750
|
/**
|
|
783
751
|
* log notifications received by the NotificationManager
|
|
784
752
|
*
|
|
@@ -856,14 +824,12 @@ const __INTERNAL_LOG_NATIVE_MAP_SET_COUNTS = false;
|
|
|
856
824
|
const LOGGING = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
857
825
|
__proto__: null,
|
|
858
826
|
DEBUG_RELATIONSHIP_NOTIFICATIONS,
|
|
827
|
+
LOG_CACHE,
|
|
859
828
|
LOG_GRAPH,
|
|
860
829
|
LOG_IDENTIFIERS,
|
|
861
830
|
LOG_INSTANCE_CACHE,
|
|
862
831
|
LOG_METRIC_COUNTS,
|
|
863
|
-
LOG_MUTATIONS,
|
|
864
832
|
LOG_NOTIFICATIONS,
|
|
865
|
-
LOG_OPERATIONS,
|
|
866
|
-
LOG_PAYLOADS,
|
|
867
833
|
LOG_REQUESTS,
|
|
868
834
|
LOG_REQUEST_STATUS,
|
|
869
835
|
__INTERNAL_LOG_NATIVE_MAP_SET_COUNTS
|
|
@@ -882,6 +848,65 @@ function createLoggingConfig(env, debug) {
|
|
|
882
848
|
return config;
|
|
883
849
|
}
|
|
884
850
|
|
|
851
|
+
/**
|
|
852
|
+
* Settings configuration for deprecations, optional features, development/testing
|
|
853
|
+
* support and debug logging is done using `setConfig` in `ember-cli-build`.
|
|
854
|
+
*
|
|
855
|
+
* ```ts
|
|
856
|
+
* 'use strict';
|
|
857
|
+
*
|
|
858
|
+
* const EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
|
859
|
+
*
|
|
860
|
+
* module.exports = async function (defaults) {
|
|
861
|
+
* const { setConfig } = await import('@warp-drive/build-config');
|
|
862
|
+
*
|
|
863
|
+
* const app = new EmberApp(defaults, {});
|
|
864
|
+
*
|
|
865
|
+
* setConfig(app, __dirname, {
|
|
866
|
+
* // settings here
|
|
867
|
+
* });
|
|
868
|
+
*
|
|
869
|
+
* const { Webpack } = require('@embroider/webpack');
|
|
870
|
+
* return require('@embroider/compat').compatBuild(app, Webpack, {});
|
|
871
|
+
* };
|
|
872
|
+
*
|
|
873
|
+
* ```
|
|
874
|
+
*
|
|
875
|
+
* Available settings include:
|
|
876
|
+
*
|
|
877
|
+
* - [Debug Logging](../classes/DebugLogging)
|
|
878
|
+
* - [Deprecated Code Removal](../classes/CurrentDeprecations)
|
|
879
|
+
* - [Canary Feature Activation](../classes/CanaryFeatures)
|
|
880
|
+
*
|
|
881
|
+
* As well as:
|
|
882
|
+
*
|
|
883
|
+
* ### polyfillUUID
|
|
884
|
+
*
|
|
885
|
+
* If you are using the library in an environment that does not support `window.crypto.randomUUID`
|
|
886
|
+
* you can enable a polyfill for it.
|
|
887
|
+
*
|
|
888
|
+
* ```ts
|
|
889
|
+
* setConfig(app, __dirname, {
|
|
890
|
+
* polyfillUUID: true
|
|
891
|
+
* });
|
|
892
|
+
* ```
|
|
893
|
+
*
|
|
894
|
+
* ### includeDataAdapterInProduction
|
|
895
|
+
*
|
|
896
|
+
* By default, the integration required to support the ember inspector browser extension
|
|
897
|
+
* is included in production builds only when using the `ember-data` package. Otherwise
|
|
898
|
+
* the default is to exclude it. This setting allows to explicitly enable/disable it in
|
|
899
|
+
* production builds.
|
|
900
|
+
*
|
|
901
|
+
* ```ts
|
|
902
|
+
* setConfig(app, __dirname, {
|
|
903
|
+
* includeDataAdapterInProduction: true
|
|
904
|
+
* });
|
|
905
|
+
* ```
|
|
906
|
+
*
|
|
907
|
+
* @module @warp-drive/build-config
|
|
908
|
+
* @main @warp-drive/build-config
|
|
909
|
+
*/
|
|
885
910
|
const _MacrosConfig = EmbroiderMacros.MacrosConfig;
|
|
886
911
|
function recastMacrosConfig(macros) {
|
|
887
912
|
if (!('globalConfig' in macros)) {
|
|
@@ -889,10 +914,12 @@ function recastMacrosConfig(macros) {
|
|
|
889
914
|
}
|
|
890
915
|
return macros;
|
|
891
916
|
}
|
|
892
|
-
function setConfig(context,
|
|
893
|
-
const
|
|
894
|
-
const
|
|
895
|
-
const
|
|
917
|
+
function setConfig(context, appRootOrConfig, config) {
|
|
918
|
+
const isEmberClassicUsage = arguments.length === 3;
|
|
919
|
+
const macros = recastMacrosConfig(isEmberClassicUsage ? _MacrosConfig.for(context, appRootOrConfig) : context);
|
|
920
|
+
const userConfig = isEmberClassicUsage ? config : appRootOrConfig;
|
|
921
|
+
const isLegacySupport = userConfig.___legacy_support;
|
|
922
|
+
const hasDeprecatedConfig = isLegacySupport && Object.keys(userConfig).length > 1;
|
|
896
923
|
const hasInitiatedConfig = macros.globalConfig['WarpDrive'];
|
|
897
924
|
|
|
898
925
|
// setConfig called by user prior to legacy support called
|
|
@@ -903,11 +930,6 @@ function setConfig(context, appRoot, config) {
|
|
|
903
930
|
return;
|
|
904
931
|
}
|
|
905
932
|
|
|
906
|
-
// legacy support called prior to user setConfig
|
|
907
|
-
if (isLegacySupport && hasDeprecatedConfig) {
|
|
908
|
-
console.warn(`You are using the legacy emberData key in your ember-cli-build.js file. This key is deprecated and will be removed in the next major version of EmberData/WarpDrive. Please use \`import { setConfig } from '@warp-drive/build-config';\` instead.`);
|
|
909
|
-
}
|
|
910
|
-
|
|
911
933
|
// included hooks run during class initialization of the EmberApp instance
|
|
912
934
|
// so our hook will run before the user has a chance to call setConfig
|
|
913
935
|
// else we could print a useful message here
|
|
@@ -917,17 +939,17 @@ function setConfig(context, appRoot, config) {
|
|
|
917
939
|
// );
|
|
918
940
|
// }
|
|
919
941
|
|
|
920
|
-
const debugOptions = Object.assign({}, LOGGING,
|
|
942
|
+
const debugOptions = Object.assign({}, LOGGING, userConfig.debug);
|
|
921
943
|
const env = getEnv();
|
|
922
|
-
const DEPRECATIONS = getDeprecations(
|
|
944
|
+
const DEPRECATIONS = getDeprecations(userConfig.compatWith || null, userConfig.deprecations);
|
|
923
945
|
const FEATURES = getFeatures(env.PRODUCTION);
|
|
924
|
-
const includeDataAdapterInProduction = typeof
|
|
946
|
+
const includeDataAdapterInProduction = typeof userConfig.includeDataAdapterInProduction === 'boolean' ? userConfig.includeDataAdapterInProduction : true;
|
|
925
947
|
const includeDataAdapter = env.PRODUCTION ? includeDataAdapterInProduction : true;
|
|
926
948
|
const finalizedConfig = {
|
|
927
949
|
debug: debugOptions,
|
|
928
|
-
polyfillUUID:
|
|
950
|
+
polyfillUUID: userConfig.polyfillUUID ?? false,
|
|
929
951
|
includeDataAdapter,
|
|
930
|
-
compatWith:
|
|
952
|
+
compatWith: userConfig.compatWith ?? null,
|
|
931
953
|
deprecations: DEPRECATIONS,
|
|
932
954
|
features: FEATURES,
|
|
933
955
|
activeLogging: createLoggingConfig(env, debugOptions),
|