@warp-drive-mirror/build-config 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/declarations/-private/utils/deprecations.d.ts +5 -0
- package/declarations/-private/utils/features.d.ts +4 -0
- package/declarations/-private/utils/get-env.d.ts +8 -0
- package/declarations/-private/utils/logging.d.ts +9 -0
- package/declarations/babel-macros.d.ts +13 -0
- package/declarations/canary-features.d.ts +136 -0
- package/declarations/debugging.d.ts +172 -0
- package/declarations/deprecation-versions.d.ts +30 -0
- package/declarations/deprecations.d.ts +516 -0
- package/declarations/env.d.ts +129 -0
- package/declarations/index.d.ts +101 -0
- package/declarations/macros.d.ts +18 -0
- package/dist/addon-shim.cjs +0 -1
- package/dist/babel-macros.js +45 -13
- package/dist/babel-plugin-transform-asserts.cjs +5 -7
- package/dist/babel-plugin-transform-deprecations.cjs +2 -3
- package/dist/babel-plugin-transform-features.cjs +2 -3
- package/dist/babel-plugin-transform-logging.cjs +2 -3
- package/dist/canary-features-CuKgaVtX.js +146 -0
- package/dist/canary-features.js +1 -2
- package/dist/cjs-set-config.cjs +160 -609
- package/dist/{debugging-BtpYr1v0.js → debugging-VdsvkNjX.js} +79 -62
- package/dist/debugging.js +1 -2
- package/dist/deprecations-BNNGFAiG.js +548 -0
- package/dist/deprecations.js +1 -2
- package/dist/env.js +124 -1
- package/dist/index.js +20 -521
- package/dist/macros.js +18 -1
- package/package.json +7 -19
- package/dist/addon-shim.cjs.map +0 -1
- package/dist/babel-macros.js.map +0 -1
- package/dist/babel-plugin-transform-asserts.cjs.map +0 -1
- package/dist/babel-plugin-transform-deprecations.cjs.map +0 -1
- package/dist/babel-plugin-transform-features.cjs.map +0 -1
- package/dist/babel-plugin-transform-logging.cjs.map +0 -1
- package/dist/canary-features-D1wplYmb.js +0 -113
- package/dist/canary-features-D1wplYmb.js.map +0 -1
- package/dist/canary-features.js.map +0 -1
- package/dist/cjs-set-config.cjs.map +0 -1
- package/dist/debugging-BtpYr1v0.js.map +0 -1
- package/dist/debugging.js.map +0 -1
- package/dist/deprecations-D_dBAPC9.js +0 -34
- package/dist/deprecations-D_dBAPC9.js.map +0 -1
- package/dist/deprecations.js.map +0 -1
- package/dist/env.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/macros.js.map +0 -1
- package/unstable-preview-types/-private/utils/deprecations.d.ts +0 -12
- package/unstable-preview-types/-private/utils/deprecations.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/features.d.ts +0 -9
- package/unstable-preview-types/-private/utils/features.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/get-env.d.ts +0 -11
- package/unstable-preview-types/-private/utils/get-env.d.ts.map +0 -1
- package/unstable-preview-types/-private/utils/logging.d.ts +0 -14
- package/unstable-preview-types/-private/utils/logging.d.ts.map +0 -1
- package/unstable-preview-types/babel-macros.d.ts +0 -6
- package/unstable-preview-types/babel-macros.d.ts.map +0 -1
- package/unstable-preview-types/canary-features.d.ts +0 -105
- package/unstable-preview-types/canary-features.d.ts.map +0 -1
- package/unstable-preview-types/cjs-set-config.d.ts +0 -4
- package/unstable-preview-types/cjs-set-config.d.ts.map +0 -1
- package/unstable-preview-types/debugging.d.ts +0 -164
- package/unstable-preview-types/debugging.d.ts.map +0 -1
- package/unstable-preview-types/deprecation-versions.d.ts +0 -485
- package/unstable-preview-types/deprecation-versions.d.ts.map +0 -1
- package/unstable-preview-types/deprecations.d.ts +0 -16
- package/unstable-preview-types/deprecations.d.ts.map +0 -1
- package/unstable-preview-types/env.d.ts +0 -9
- package/unstable-preview-types/env.d.ts.map +0 -1
- package/unstable-preview-types/index.d.ts +0 -49
- package/unstable-preview-types/index.d.ts.map +0 -1
- package/unstable-preview-types/macros.d.ts +0 -5
- package/unstable-preview-types/macros.d.ts.map +0 -1
- package/unstable-preview-types/validate-exports.type-test.d.ts +0 -4
- package/unstable-preview-types/validate-exports.type-test.d.ts.map +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { getDeprecations } from "./-private/utils/deprecations.js";
|
|
2
|
+
import { getFeatures } from "./-private/utils/features.js";
|
|
3
|
+
import * as LOGGING from "./debugging.js";
|
|
4
|
+
export type WarpDriveConfig = {
|
|
5
|
+
/**
|
|
6
|
+
* An object of key/value pairs of logging flags
|
|
7
|
+
*
|
|
8
|
+
* see {@link LOGGING | debugging} for the available flags.
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* {
|
|
12
|
+
* LOG_CACHE: true,
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
debug?: Partial<InternalWarpDriveConfig["debug"]>;
|
|
19
|
+
/**
|
|
20
|
+
* If you are using the library in an environment that does not
|
|
21
|
+
* support `window.crypto.randomUUID` you can enable a polyfill
|
|
22
|
+
* for it.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
polyfillUUID?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* By default, the integration required to support the ember-inspector
|
|
29
|
+
* browser extension is included in production builds only when using
|
|
30
|
+
* the `ember-data` package.
|
|
31
|
+
*
|
|
32
|
+
* Otherwise the default is to exclude it. This setting allows to explicitly
|
|
33
|
+
* enable/disable it in production builds.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
includeDataAdapterInProduction?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The most recent version of the library from which all
|
|
40
|
+
* deprecations have been resolved.
|
|
41
|
+
*
|
|
42
|
+
* For instance if all deprecations released prior to or
|
|
43
|
+
* within `5.3` have been resolved, then setting this to
|
|
44
|
+
* `5.3` will remove all the support for the deprecated
|
|
45
|
+
* features for associated deprecations.
|
|
46
|
+
*
|
|
47
|
+
* See {@link DEPRECATIONS | deprecations} for more details.
|
|
48
|
+
*/
|
|
49
|
+
compatWith?: `${number}.${number}`;
|
|
50
|
+
/**
|
|
51
|
+
* An object of key/value pairs of logging flags
|
|
52
|
+
*
|
|
53
|
+
* see {@link DEPRECATIONS | deprecations} for the available flags.
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* {
|
|
57
|
+
* DEPRECATE_THING: false,
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
deprecations?: Partial<InternalWarpDriveConfig["deprecations"]>;
|
|
64
|
+
/**
|
|
65
|
+
* An object of key/value pairs of canary feature flags
|
|
66
|
+
* for use when testing new features gated behind a flag
|
|
67
|
+
* in a canary release version.
|
|
68
|
+
*
|
|
69
|
+
* see {@link FEATURES | features} for the available flags.
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* {
|
|
73
|
+
* FEATURE_A: true,
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
features?: Partial<InternalWarpDriveConfig["features"]>;
|
|
80
|
+
/**
|
|
81
|
+
* @private
|
|
82
|
+
*/
|
|
83
|
+
forceMode?: "testing" | "production" | "development";
|
|
84
|
+
};
|
|
85
|
+
type InternalWarpDriveConfig = {
|
|
86
|
+
debug: typeof LOGGING;
|
|
87
|
+
polyfillUUID: boolean;
|
|
88
|
+
includeDataAdapter: boolean;
|
|
89
|
+
compatWith: `${number}.${number}` | null;
|
|
90
|
+
deprecations: ReturnType<typeof getDeprecations>;
|
|
91
|
+
features: ReturnType<typeof getFeatures>;
|
|
92
|
+
activeLogging: typeof LOGGING;
|
|
93
|
+
env: {
|
|
94
|
+
TESTING: boolean;
|
|
95
|
+
PRODUCTION: boolean;
|
|
96
|
+
DEBUG: boolean;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
export declare function setConfig(macros: object, config: WarpDriveConfig): void;
|
|
100
|
+
export declare function setConfig(context: object, appRoot: string, config: WarpDriveConfig): void;
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal functions for instrumenting the library's code with behaviors
|
|
3
|
+
* that are removed from production builds.
|
|
4
|
+
*
|
|
5
|
+
* @hidden
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A type-narrowing assertion function that throws an error with the supplied
|
|
10
|
+
* message if the condition is falsy.
|
|
11
|
+
*
|
|
12
|
+
* Asserts are removed from production builds, making this a "zero cost abstraction"
|
|
13
|
+
* so liberal usage of this function to ensure runtime correctness is encouraged.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function assert(message: string, condition: unknown): asserts condition;
|
|
18
|
+
export declare function assert(message: string): never;
|
package/dist/addon-shim.cjs
CHANGED
package/dist/babel-macros.js
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
|
-
import { L as LOGGING } from './debugging-
|
|
2
|
-
import { C as CURRENT_FEATURES } from './canary-features-
|
|
3
|
-
import { C as CURRENT_DEPRECATIONS } from './deprecations-
|
|
1
|
+
import { L as LOGGING } from './debugging-VdsvkNjX.js';
|
|
2
|
+
import { C as CURRENT_FEATURES } from './canary-features-CuKgaVtX.js';
|
|
3
|
+
import { C as CURRENT_DEPRECATIONS } from './deprecations-BNNGFAiG.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Babel plugins that convert constants and expressions into [macroConditions](https://www.npmjs.com/package/@embroider/macros#the-macros)
|
|
7
|
+
* so that they can be stripped from the code during the build process.
|
|
8
|
+
*
|
|
9
|
+
* This allows us to have great DX around common configuration patterns
|
|
10
|
+
* while still being able to ship a small and fast library.
|
|
11
|
+
*
|
|
12
|
+
* Transforms
|
|
13
|
+
*
|
|
14
|
+
* - deprecation constants imported from `@warp-drive-mirror/build-config/deprecations`
|
|
15
|
+
* - feature flags imported from `@warp-drive-mirror/build-config/canary-features`
|
|
16
|
+
* - debug logging constants imported from `@warp-drive-mirror/build-config/debugging`
|
|
17
|
+
* - environment constants imported from `@warp-drive-mirror/build-config/env`
|
|
18
|
+
* - expressionts imported from `@warp-drive-mirror/build-config/macros`
|
|
19
|
+
*
|
|
20
|
+
* Addons and apps can use these plugins to match the code-stripping behaviors of
|
|
21
|
+
* ***Warp*Drive**. This is useful when managing migrations for canary features
|
|
22
|
+
* and deprecations.
|
|
23
|
+
*
|
|
24
|
+
* @module
|
|
25
|
+
*/
|
|
5
26
|
const features = Object.keys(CURRENT_FEATURES);
|
|
6
27
|
const FEATURES = Object.assign({}, CURRENT_FEATURES);
|
|
7
28
|
features.forEach(feature => {
|
|
@@ -15,24 +36,36 @@ const config = {
|
|
|
15
36
|
deprecations: Object.assign({}, CURRENT_DEPRECATIONS),
|
|
16
37
|
debug: Object.assign({}, LOGGING)
|
|
17
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* @returns an array of Babel plugins that can be used for code-stripping
|
|
41
|
+
* based on the configuration supplied to `setConfig` and the current ENV.
|
|
42
|
+
*
|
|
43
|
+
* - deprecation constants imported from `@warp-drive-mirror/build-config/deprecations`
|
|
44
|
+
* - feature flags imported from `@warp-drive-mirror/build-config/canary-features`
|
|
45
|
+
* - debug logging constants imported from `@warp-drive-mirror/build-config/debugging`
|
|
46
|
+
* - environment constants imported from `@warp-drive-mirror/build-config/env`
|
|
47
|
+
* - expressionts imported from `@warp-drive-mirror/build-config/macros`
|
|
48
|
+
*/
|
|
18
49
|
function macros() {
|
|
19
50
|
const TransformAsserts = import.meta.resolve('./babel-plugin-transform-asserts.cjs').slice(7);
|
|
20
51
|
const TransformDeprecations = import.meta.resolve('./babel-plugin-transform-deprecations.cjs').slice(7);
|
|
21
52
|
const TransformDebugLogging = import.meta.resolve('./babel-plugin-transform-logging.cjs').slice(7);
|
|
22
53
|
const TransformFeatures = import.meta.resolve('./babel-plugin-transform-features.cjs').slice(7);
|
|
23
|
-
let plugins = [[TransformAsserts, {
|
|
24
|
-
|
|
54
|
+
let plugins = [[TransformAsserts, {
|
|
55
|
+
sources: ['@warp-drive-mirror/build-config/macros', '@warp-drive-mirror/core/build-config/macros']
|
|
56
|
+
}, '@warp-drive-mirror/core/build-config/asserts-stripping'], [TransformFeatures, {
|
|
57
|
+
sources: ['@warp-drive-mirror/build-config/canary-features', '@warp-drive-mirror/core/build-config/canary-features'],
|
|
25
58
|
flags: config.features
|
|
26
|
-
}, '@warp-drive-mirror/build-config/canary-features-stripping'], [TransformDeprecations, {
|
|
27
|
-
|
|
59
|
+
}, '@warp-drive-mirror/core/build-config/canary-features-stripping'], [TransformDeprecations, {
|
|
60
|
+
sources: ['@warp-drive-mirror/build-config/deprecations', '@warp-drive-mirror/core/build-config/deprecations'],
|
|
28
61
|
flags: config.deprecations
|
|
29
|
-
}, '@warp-drive-mirror/build-config/deprecation-stripping'], [TransformDebugLogging, {
|
|
30
|
-
|
|
62
|
+
}, '@warp-drive-mirror/core/build-config/deprecation-stripping'], [TransformDebugLogging, {
|
|
63
|
+
sources: ['@warp-drive-mirror/build-config/debugging', '@warp-drive-mirror/core/build-config/debugging'],
|
|
31
64
|
configKey: 'debug',
|
|
32
65
|
runtimeKey: 'activeLogging',
|
|
33
66
|
flags: config.debug
|
|
34
|
-
}, '@warp-drive-mirror/build-config/debugging-stripping'], [TransformDebugLogging, {
|
|
35
|
-
|
|
67
|
+
}, '@warp-drive-mirror/core/build-config/debugging-stripping'], [TransformDebugLogging, {
|
|
68
|
+
sources: ['@warp-drive-mirror/build-config/env', '@warp-drive-mirror/core/build-config/env'],
|
|
36
69
|
configKey: 'env',
|
|
37
70
|
flags: {
|
|
38
71
|
TESTING: true,
|
|
@@ -42,9 +75,8 @@ function macros() {
|
|
|
42
75
|
IS_CI: true,
|
|
43
76
|
SHOULD_RECORD: true
|
|
44
77
|
}
|
|
45
|
-
}, '@warp-drive-mirror/build-config/env']];
|
|
78
|
+
}, '@warp-drive-mirror/core/build-config/env']];
|
|
46
79
|
return plugins;
|
|
47
80
|
}
|
|
48
81
|
|
|
49
82
|
export { macros };
|
|
50
|
-
//# sourceMappingURL=babel-macros.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
} = require('babel-import-util');
|
|
3
|
+
const babelImportUtil = require('babel-import-util');
|
|
4
|
+
|
|
6
5
|
const Utils = new Set(['assert']);
|
|
7
6
|
|
|
8
7
|
/*
|
|
@@ -63,12 +62,12 @@ function babelPluginTransformAsserts (babel) {
|
|
|
63
62
|
visitor: {
|
|
64
63
|
ImportDeclaration(path, state) {
|
|
65
64
|
const importPath = path.node.source.value;
|
|
66
|
-
if (importPath
|
|
65
|
+
if (state.opts.sources.includes(importPath)) {
|
|
67
66
|
const specifiers = path.get('specifiers');
|
|
68
67
|
specifiers.forEach(specifier => {
|
|
69
68
|
const name = specifier.node.imported.name;
|
|
70
69
|
if (!Utils.has(name)) {
|
|
71
|
-
throw new Error(`Unexpected import '${name}' imported from '
|
|
70
|
+
throw new Error(`Unexpected import '${name}' imported from '${importPath}'`);
|
|
72
71
|
}
|
|
73
72
|
const localBindingName = specifier.node.local.name;
|
|
74
73
|
const binding = specifier.scope.getBinding(localBindingName);
|
|
@@ -89,11 +88,10 @@ function babelPluginTransformAsserts (babel) {
|
|
|
89
88
|
}
|
|
90
89
|
},
|
|
91
90
|
Program(path, state) {
|
|
92
|
-
state.importer = new ImportUtil(t, path);
|
|
91
|
+
state.importer = new babelImportUtil.ImportUtil(t, path);
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
94
|
};
|
|
96
95
|
}
|
|
97
96
|
|
|
98
97
|
module.exports = babelPluginTransformAsserts;
|
|
99
|
-
//# sourceMappingURL=babel-plugin-transform-asserts.cjs.map
|
|
@@ -17,12 +17,12 @@ function babelPluginTransformDeprecations (babel) {
|
|
|
17
17
|
visitor: {
|
|
18
18
|
ImportDeclaration(path, state) {
|
|
19
19
|
const importPath = path.node.source.value;
|
|
20
|
-
if (
|
|
20
|
+
if (state.opts.sources.includes(importPath)) {
|
|
21
21
|
const specifiers = path.get('specifiers');
|
|
22
22
|
specifiers.forEach(specifier => {
|
|
23
23
|
let name = specifier.node.imported.name;
|
|
24
24
|
if (!(name in state.opts.flags)) {
|
|
25
|
-
throw new Error(`Unexpected flag ${name} imported from ${
|
|
25
|
+
throw new Error(`Unexpected flag ${name} imported from ${importPath}`);
|
|
26
26
|
}
|
|
27
27
|
let localBindingName = specifier.node.local.name;
|
|
28
28
|
let binding = specifier.scope.getBinding(localBindingName);
|
|
@@ -70,4 +70,3 @@ function babelPluginTransformDeprecations (babel) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
module.exports = babelPluginTransformDeprecations;
|
|
73
|
-
//# sourceMappingURL=babel-plugin-transform-deprecations.cjs.map
|
|
@@ -23,12 +23,12 @@ function babelPluginTransformFeatures (babel) {
|
|
|
23
23
|
visitor: {
|
|
24
24
|
ImportDeclaration(path, state) {
|
|
25
25
|
const importPath = path.node.source.value;
|
|
26
|
-
if (
|
|
26
|
+
if (state.opts.sources.includes(importPath)) {
|
|
27
27
|
const specifiers = path.get('specifiers');
|
|
28
28
|
specifiers.forEach(specifier => {
|
|
29
29
|
let name = specifier.node.imported.name;
|
|
30
30
|
if (!(name in state.opts.flags)) {
|
|
31
|
-
throw new Error(`Unexpected flag ${name} imported from ${
|
|
31
|
+
throw new Error(`Unexpected flag ${name} imported from ${importPath}`);
|
|
32
32
|
}
|
|
33
33
|
let localBindingName = specifier.node.local.name;
|
|
34
34
|
let binding = specifier.scope.getBinding(localBindingName);
|
|
@@ -62,4 +62,3 @@ function babelPluginTransformFeatures (babel) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
module.exports = babelPluginTransformFeatures;
|
|
65
|
-
//# sourceMappingURL=babel-plugin-transform-features.cjs.map
|
|
@@ -18,12 +18,12 @@ function babelPluginTransformLogging (babel) {
|
|
|
18
18
|
visitor: {
|
|
19
19
|
ImportDeclaration(path, state) {
|
|
20
20
|
const importPath = path.node.source.value;
|
|
21
|
-
if (
|
|
21
|
+
if (state.opts.sources.includes(importPath)) {
|
|
22
22
|
const specifiers = path.get('specifiers');
|
|
23
23
|
specifiers.forEach(specifier => {
|
|
24
24
|
let name = specifier.node.imported.name;
|
|
25
25
|
if (!(name in state.opts.flags)) {
|
|
26
|
-
throw new Error(`Unexpected flag ${name} imported from ${
|
|
26
|
+
throw new Error(`Unexpected flag ${name} imported from ${importPath}`);
|
|
27
27
|
}
|
|
28
28
|
let localBindingName = specifier.node.local.name;
|
|
29
29
|
let binding = specifier.scope.getBinding(localBindingName);
|
|
@@ -100,4 +100,3 @@ function babelPluginTransformLogging (babel) {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
module.exports = babelPluginTransformLogging;
|
|
103
|
-
//# sourceMappingURL=babel-plugin-transform-logging.cjs.map
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* # Canary Features <Badge type="warning" text="requires canary" />
|
|
4
|
+
*
|
|
5
|
+
* ***Warp*Drive** allows users to test upcoming features that are implemented
|
|
6
|
+
* but not yet activated in canary builds.
|
|
7
|
+
*
|
|
8
|
+
* Typically these features represent work that carries higher risk of breaking
|
|
9
|
+
* changes, or are not yet fully ready for production use.
|
|
10
|
+
*
|
|
11
|
+
* Such features have their implementations guarded by a "feature flag", and the
|
|
12
|
+
* flag is only activated once the core-data team is prepared to ship the work
|
|
13
|
+
* in a canary release, beginning the process of it landing in a stable release.
|
|
14
|
+
*
|
|
15
|
+
* ### Installing Canary
|
|
16
|
+
*
|
|
17
|
+
* ::: warning To test a feature guarded behind a flag, you MUST be using a canary build.
|
|
18
|
+
* :::
|
|
19
|
+
*
|
|
20
|
+
* Canary builds are published to `npm` and can be installed using a precise tag
|
|
21
|
+
* (such as `@warp-drive-mirror/core@5.6.0-alpha.1`) or by installing the latest dist-tag
|
|
22
|
+
* published to the `canary` channel.
|
|
23
|
+
*
|
|
24
|
+
* Because ***Warp*Drive** packages operate on a strict lockstep policy with each other,
|
|
25
|
+
* you must install the matching canary version of all ***Warp*Drive** packages.
|
|
26
|
+
*
|
|
27
|
+
* Below is an example of installing the latest canary version of all the core
|
|
28
|
+
* packages that are part of the ***Warp*Drive** project when using EmberJS.
|
|
29
|
+
*
|
|
30
|
+
* Add/remove packages from this list to match your project.
|
|
31
|
+
*
|
|
32
|
+
* ::: code-group
|
|
33
|
+
*
|
|
34
|
+
* ```sh [pnpm]
|
|
35
|
+
* pnpm add -E @warp-drive-mirror/core@canary \
|
|
36
|
+
* @warp-drive-mirror/json-api@canary \
|
|
37
|
+
* @warp-drive-mirror/ember@canary;
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* ```sh [npm]
|
|
41
|
+
* npm add -E @warp-drive-mirror/core@canary \
|
|
42
|
+
* @warp-drive-mirror/json-api@canary \
|
|
43
|
+
* @warp-drive-mirror/ember@canary;
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* ```sh [yarn]
|
|
47
|
+
* yarn add -E @warp-drive-mirror/core@canary \
|
|
48
|
+
* @warp-drive-mirror/json-api@canary \
|
|
49
|
+
* @warp-drive-mirror/ember@canary;
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* ```sh [bun]
|
|
53
|
+
* bun add --exact @warp-drive-mirror/core@canary \
|
|
54
|
+
* @warp-drive-mirror/json-api@canary \
|
|
55
|
+
* @warp-drive-mirror/ember@canary;
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* :::
|
|
59
|
+
*
|
|
60
|
+
* ### Activating a Feature
|
|
61
|
+
*
|
|
62
|
+
* Once you have installed canary, feature-flags can be activated at build-time
|
|
63
|
+
*
|
|
64
|
+
* ```ts
|
|
65
|
+
* setConfig(app, __dirname, {
|
|
66
|
+
* features: {
|
|
67
|
+
* FEATURE_A: false, // utilize existing behavior
|
|
68
|
+
* FEATURE_B: true // utilize the new behavior
|
|
69
|
+
* }
|
|
70
|
+
* })
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* by setting an environment variable:
|
|
74
|
+
*
|
|
75
|
+
* ```sh
|
|
76
|
+
* # Activate a single flag
|
|
77
|
+
* export WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG;
|
|
78
|
+
*
|
|
79
|
+
* # Activate multiple flags by separating with commas
|
|
80
|
+
* export WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG,OTHER_FLAG;
|
|
81
|
+
*
|
|
82
|
+
* # Activate all flags
|
|
83
|
+
* export WARP_DRIVE_FEATURE_OVERRIDE=ENABLE_ALL_OPTIONAL;
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* ::: warning To test a feature guarded behind a flag, you MUST be running a development build.
|
|
87
|
+
* :::
|
|
88
|
+
*
|
|
89
|
+
*
|
|
90
|
+
* ### Preparing a Project to use a Canary Feature
|
|
91
|
+
*
|
|
92
|
+
* For most projects and features, simple version detection should be enough.
|
|
93
|
+
*
|
|
94
|
+
* Using the provided version compatibility helpers from [embroider-macros](https://github.com/embroider-build/embroider/tree/main/packages/macros#readme)
|
|
95
|
+
* the following can be done:
|
|
96
|
+
*
|
|
97
|
+
* ```js
|
|
98
|
+
* if (macroCondition(dependencySatisfies('@warp-drive-mirror/core', '5.6'))) {
|
|
99
|
+
* // do thing
|
|
100
|
+
* }
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* For more complex projects and migrations, configure [@warp-drive-mirror/build-config/babel-macros](./babel-macros)
|
|
104
|
+
*
|
|
105
|
+
* The current list of features used at build time for canary releases is defined below.
|
|
106
|
+
*
|
|
107
|
+
* ::: tip 💡 If empty there are no features currently gated by feature flags.
|
|
108
|
+
* :::
|
|
109
|
+
*
|
|
110
|
+
* The valid values are:
|
|
111
|
+
*
|
|
112
|
+
* - `true` | The feature is **enabled** at all times, and cannot be disabled.
|
|
113
|
+
* - `false` | The feature is **disabled** at all times, and cannot be enabled.
|
|
114
|
+
* - `null` | The feature is **disabled by default**, but can be enabled via configuration.
|
|
115
|
+
*
|
|
116
|
+
* @module
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* We use this for some tests etc.
|
|
122
|
+
*
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
const SAMPLE_FEATURE_FLAG = null;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* This upcoming feature adds a validation step to payloads received
|
|
129
|
+
* by the JSONAPICache implementation.
|
|
130
|
+
*
|
|
131
|
+
* When a request completes and the result is given to the cache via
|
|
132
|
+
* `cache.put`, the cache will validate the payload against registered
|
|
133
|
+
* schemas as well as the JSON:API spec.
|
|
134
|
+
*
|
|
135
|
+
* @since 5.4
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
const JSON_API_CACHE_VALIDATION_ERRORS = false;
|
|
139
|
+
|
|
140
|
+
const CURRENT_FEATURES = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
141
|
+
__proto__: null,
|
|
142
|
+
JSON_API_CACHE_VALIDATION_ERRORS,
|
|
143
|
+
SAMPLE_FEATURE_FLAG
|
|
144
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
145
|
+
|
|
146
|
+
export { CURRENT_FEATURES as C, JSON_API_CACHE_VALIDATION_ERRORS as J, SAMPLE_FEATURE_FLAG as S };
|
package/dist/canary-features.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { J as JSON_API_CACHE_VALIDATION_ERRORS, S as SAMPLE_FEATURE_FLAG } from './canary-features-
|
|
2
|
-
//# sourceMappingURL=canary-features.js.map
|
|
1
|
+
export { J as JSON_API_CACHE_VALIDATION_ERRORS, S as SAMPLE_FEATURE_FLAG } from './canary-features-CuKgaVtX.js';
|