@warp-drive/build-config 5.6.0-alpha.5 → 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 +2 -3
- package/dist/babel-plugin-transform-asserts.cjs +3 -5
- package/dist/babel-plugin-transform-deprecations.cjs +0 -1
- package/dist/babel-plugin-transform-features.cjs +0 -1
- package/dist/babel-plugin-transform-logging.cjs +0 -1
- package/dist/{canary-features-DF5hbs2w.js → canary-features-CuKgaVtX.js} +17 -41
- package/dist/canary-features.js +1 -2
- package/dist/cjs-set-config.cjs +25 -46
- package/dist/debugging-VdsvkNjX.js +0 -1
- package/dist/debugging.js +0 -1
- package/dist/{deprecations-BVxAmwe9.js → deprecations-BNNGFAiG.js} +5 -6
- package/dist/deprecations.js +1 -2
- package/dist/env.js +0 -1
- package/dist/index.js +9 -7
- package/dist/macros.js +0 -1
- package/package.json +7 -16
- 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-DF5hbs2w.js.map +0 -1
- package/dist/canary-features.js.map +0 -1
- package/dist/cjs-set-config.cjs.map +0 -1
- package/dist/debugging-VdsvkNjX.js.map +0 -1
- package/dist/debugging.js.map +0 -1
- package/dist/deprecations-BVxAmwe9.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 -16
- package/unstable-preview-types/babel-macros.d.ts.map +0 -1
- package/unstable-preview-types/canary-features.d.ts +0 -162
- 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 -175
- package/unstable-preview-types/debugging.d.ts.map +0 -1
- package/unstable-preview-types/deprecation-versions.d.ts +0 -16
- package/unstable-preview-types/deprecation-versions.d.ts.map +0 -1
- package/unstable-preview-types/deprecations.d.ts +0 -519
- package/unstable-preview-types/deprecations.d.ts.map +0 -1
- package/unstable-preview-types/env.d.ts +0 -132
- package/unstable-preview-types/env.d.ts.map +0 -1
- package/unstable-preview-types/index.d.ts +0 -113
- package/unstable-preview-types/index.d.ts.map +0 -1
- package/unstable-preview-types/macros.d.ts +0 -21
- 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,6 +1,6 @@
|
|
|
1
1
|
import { L as LOGGING } from './debugging-VdsvkNjX.js';
|
|
2
|
-
import { C as CURRENT_FEATURES } from './canary-features-
|
|
3
|
-
import { C as CURRENT_DEPRECATIONS } from './deprecations-
|
|
2
|
+
import { C as CURRENT_FEATURES } from './canary-features-CuKgaVtX.js';
|
|
3
|
+
import { C as CURRENT_DEPRECATIONS } from './deprecations-BNNGFAiG.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Babel plugins that convert constants and expressions into [macroConditions](https://www.npmjs.com/package/@embroider/macros#the-macros)
|
|
@@ -80,4 +80,3 @@ function macros() {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
export { macros };
|
|
83
|
-
//# 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
|
/*
|
|
@@ -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
|
|
@@ -24,58 +24,35 @@
|
|
|
24
24
|
* Because ***Warp*Drive** packages operate on a strict lockstep policy with each other,
|
|
25
25
|
* you must install the matching canary version of all ***Warp*Drive** packages.
|
|
26
26
|
*
|
|
27
|
-
* Below is an example of installing the latest canary version of all the
|
|
28
|
-
* packages that are part of the ***Warp*Drive** project
|
|
29
|
-
*
|
|
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.
|
|
30
31
|
*
|
|
31
32
|
* ::: code-group
|
|
32
33
|
*
|
|
33
34
|
* ```sh [pnpm]
|
|
34
|
-
* pnpm add -E @
|
|
35
|
-
* @
|
|
36
|
-
* @
|
|
37
|
-
* @ember-data/graph@canary \
|
|
38
|
-
* @ember-data/request@canary \
|
|
39
|
-
* @ember-data/request-utils@canary \
|
|
40
|
-
* @warp-drive/schema-record@canary \
|
|
41
|
-
* @warp-drive/build-config@canary \
|
|
42
|
-
* @warp-drive/core-types@canary;
|
|
35
|
+
* pnpm add -E @warp-drive/core@canary \
|
|
36
|
+
* @warp-drive/json-api@canary \
|
|
37
|
+
* @warp-drive/ember@canary;
|
|
43
38
|
* ```
|
|
44
39
|
*
|
|
45
40
|
* ```sh [npm]
|
|
46
|
-
* npm add -E @
|
|
47
|
-
* @
|
|
48
|
-
* @
|
|
49
|
-
* @ember-data/graph@canary \
|
|
50
|
-
* @ember-data/request@canary \
|
|
51
|
-
* @ember-data/request-utils@canary \
|
|
52
|
-
* @warp-drive/schema-record@canary \
|
|
53
|
-
* @warp-drive/build-config@canary \
|
|
54
|
-
* @warp-drive/core-types@canary;
|
|
41
|
+
* npm add -E @warp-drive/core@canary \
|
|
42
|
+
* @warp-drive/json-api@canary \
|
|
43
|
+
* @warp-drive/ember@canary;
|
|
55
44
|
* ```
|
|
56
45
|
*
|
|
57
46
|
* ```sh [yarn]
|
|
58
|
-
* yarn add -E @
|
|
59
|
-
* @
|
|
60
|
-
* @
|
|
61
|
-
* @ember-data/graph@canary \
|
|
62
|
-
* @ember-data/request@canary \
|
|
63
|
-
* @ember-data/request-utils@canary \
|
|
64
|
-
* @warp-drive/schema-record@canary \
|
|
65
|
-
* @warp-drive/build-config@canary \
|
|
66
|
-
* @warp-drive/core-types@canary;
|
|
47
|
+
* yarn add -E @warp-drive/core@canary \
|
|
48
|
+
* @warp-drive/json-api@canary \
|
|
49
|
+
* @warp-drive/ember@canary;
|
|
67
50
|
* ```
|
|
68
51
|
*
|
|
69
52
|
* ```sh [bun]
|
|
70
|
-
* bun add --exact @
|
|
71
|
-
* @
|
|
72
|
-
* @
|
|
73
|
-
* @ember-data/graph@canary \
|
|
74
|
-
* @ember-data/request@canary \
|
|
75
|
-
* @ember-data/request-utils@canary \
|
|
76
|
-
* @warp-drive/schema-record@canary \
|
|
77
|
-
* @warp-drive/build-config@canary \
|
|
78
|
-
* @warp-drive/core-types@canary;
|
|
53
|
+
* bun add --exact @warp-drive/core@canary \
|
|
54
|
+
* @warp-drive/json-api@canary \
|
|
55
|
+
* @warp-drive/ember@canary;
|
|
79
56
|
* ```
|
|
80
57
|
*
|
|
81
58
|
* :::
|
|
@@ -118,7 +95,7 @@
|
|
|
118
95
|
* the following can be done:
|
|
119
96
|
*
|
|
120
97
|
* ```js
|
|
121
|
-
* if (macroCondition(dependencySatisfies('@
|
|
98
|
+
* if (macroCondition(dependencySatisfies('@warp-drive/core', '5.6'))) {
|
|
122
99
|
* // do thing
|
|
123
100
|
* }
|
|
124
101
|
* ```
|
|
@@ -167,4 +144,3 @@ const CURRENT_FEATURES = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.definePr
|
|
|
167
144
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
168
145
|
|
|
169
146
|
export { CURRENT_FEATURES as C, JSON_API_CACHE_VALIDATION_ERRORS as J, SAMPLE_FEATURE_FLAG as S };
|
|
170
|
-
//# sourceMappingURL=canary-features-DF5hbs2w.js.map
|
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';
|
package/dist/cjs-set-config.cjs
CHANGED
|
@@ -9,7 +9,10 @@ const path = require('path');
|
|
|
9
9
|
const url = require('url');
|
|
10
10
|
|
|
11
11
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
12
|
-
function getEnv() {
|
|
12
|
+
function getEnv(forceMode) {
|
|
13
|
+
const FORCE_TESTING = forceMode === 'testing' || forceMode === 'development' || forceMode === 'debug';
|
|
14
|
+
const FORCE_DEBUG = forceMode === 'development' || forceMode === 'debug';
|
|
15
|
+
const FORCE_PRODUCTION = forceMode === 'production';
|
|
13
16
|
const {
|
|
14
17
|
EMBER_ENV,
|
|
15
18
|
IS_TESTING,
|
|
@@ -18,9 +21,9 @@ function getEnv() {
|
|
|
18
21
|
CI,
|
|
19
22
|
IS_RECORDING
|
|
20
23
|
} = process.env;
|
|
21
|
-
const PRODUCTION = EMBER_ENV === 'production' || !EMBER_ENV && NODE_ENV === 'production';
|
|
22
|
-
const DEBUG = !PRODUCTION;
|
|
23
|
-
const TESTING = DEBUG || Boolean(EMBER_ENV === 'test' || IS_TESTING || EMBER_CLI_TEST_COMMAND);
|
|
24
|
+
const PRODUCTION = FORCE_PRODUCTION || EMBER_ENV === 'production' || !EMBER_ENV && NODE_ENV === 'production';
|
|
25
|
+
const DEBUG = FORCE_DEBUG || !PRODUCTION;
|
|
26
|
+
const TESTING = FORCE_TESTING || DEBUG || Boolean(EMBER_ENV === 'test' || IS_TESTING || EMBER_CLI_TEST_COMMAND);
|
|
24
27
|
const SHOULD_RECORD = Boolean(!CI || IS_RECORDING);
|
|
25
28
|
return {
|
|
26
29
|
TESTING,
|
|
@@ -148,58 +151,35 @@ function getDeprecations(compatVersion, deprecations) {
|
|
|
148
151
|
* Because ***Warp*Drive** packages operate on a strict lockstep policy with each other,
|
|
149
152
|
* you must install the matching canary version of all ***Warp*Drive** packages.
|
|
150
153
|
*
|
|
151
|
-
* Below is an example of installing the latest canary version of all the
|
|
152
|
-
* packages that are part of the ***Warp*Drive** project
|
|
153
|
-
*
|
|
154
|
+
* Below is an example of installing the latest canary version of all the core
|
|
155
|
+
* packages that are part of the ***Warp*Drive** project when using EmberJS.
|
|
156
|
+
*
|
|
157
|
+
* Add/remove packages from this list to match your project.
|
|
154
158
|
*
|
|
155
159
|
* ::: code-group
|
|
156
160
|
*
|
|
157
161
|
* ```sh [pnpm]
|
|
158
|
-
* pnpm add -E @
|
|
159
|
-
* @
|
|
160
|
-
* @
|
|
161
|
-
* @ember-data/graph@canary \
|
|
162
|
-
* @ember-data/request@canary \
|
|
163
|
-
* @ember-data/request-utils@canary \
|
|
164
|
-
* @warp-drive/schema-record@canary \
|
|
165
|
-
* @warp-drive/build-config@canary \
|
|
166
|
-
* @warp-drive/core-types@canary;
|
|
162
|
+
* pnpm add -E @warp-drive/core@canary \
|
|
163
|
+
* @warp-drive/json-api@canary \
|
|
164
|
+
* @warp-drive/ember@canary;
|
|
167
165
|
* ```
|
|
168
166
|
*
|
|
169
167
|
* ```sh [npm]
|
|
170
|
-
* npm add -E @
|
|
171
|
-
* @
|
|
172
|
-
* @
|
|
173
|
-
* @ember-data/graph@canary \
|
|
174
|
-
* @ember-data/request@canary \
|
|
175
|
-
* @ember-data/request-utils@canary \
|
|
176
|
-
* @warp-drive/schema-record@canary \
|
|
177
|
-
* @warp-drive/build-config@canary \
|
|
178
|
-
* @warp-drive/core-types@canary;
|
|
168
|
+
* npm add -E @warp-drive/core@canary \
|
|
169
|
+
* @warp-drive/json-api@canary \
|
|
170
|
+
* @warp-drive/ember@canary;
|
|
179
171
|
* ```
|
|
180
172
|
*
|
|
181
173
|
* ```sh [yarn]
|
|
182
|
-
* yarn add -E @
|
|
183
|
-
* @
|
|
184
|
-
* @
|
|
185
|
-
* @ember-data/graph@canary \
|
|
186
|
-
* @ember-data/request@canary \
|
|
187
|
-
* @ember-data/request-utils@canary \
|
|
188
|
-
* @warp-drive/schema-record@canary \
|
|
189
|
-
* @warp-drive/build-config@canary \
|
|
190
|
-
* @warp-drive/core-types@canary;
|
|
174
|
+
* yarn add -E @warp-drive/core@canary \
|
|
175
|
+
* @warp-drive/json-api@canary \
|
|
176
|
+
* @warp-drive/ember@canary;
|
|
191
177
|
* ```
|
|
192
178
|
*
|
|
193
179
|
* ```sh [bun]
|
|
194
|
-
* bun add --exact @
|
|
195
|
-
* @
|
|
196
|
-
* @
|
|
197
|
-
* @ember-data/graph@canary \
|
|
198
|
-
* @ember-data/request@canary \
|
|
199
|
-
* @ember-data/request-utils@canary \
|
|
200
|
-
* @warp-drive/schema-record@canary \
|
|
201
|
-
* @warp-drive/build-config@canary \
|
|
202
|
-
* @warp-drive/core-types@canary;
|
|
180
|
+
* bun add --exact @warp-drive/core@canary \
|
|
181
|
+
* @warp-drive/json-api@canary \
|
|
182
|
+
* @warp-drive/ember@canary;
|
|
203
183
|
* ```
|
|
204
184
|
*
|
|
205
185
|
* :::
|
|
@@ -242,7 +222,7 @@ function getDeprecations(compatVersion, deprecations) {
|
|
|
242
222
|
* the following can be done:
|
|
243
223
|
*
|
|
244
224
|
* ```js
|
|
245
|
-
* if (macroCondition(dependencySatisfies('@
|
|
225
|
+
* if (macroCondition(dependencySatisfies('@warp-drive/core', '5.6'))) {
|
|
246
226
|
* // do thing
|
|
247
227
|
* }
|
|
248
228
|
* ```
|
|
@@ -627,7 +607,7 @@ function setConfig(context, appRootOrConfig, config) {
|
|
|
627
607
|
// }
|
|
628
608
|
|
|
629
609
|
const debugOptions = Object.assign({}, LOGGING, userConfig.debug);
|
|
630
|
-
const env = getEnv();
|
|
610
|
+
const env = getEnv(userConfig.forceMode);
|
|
631
611
|
const DEPRECATIONS = getDeprecations(userConfig.compatWith || null, userConfig.deprecations);
|
|
632
612
|
const FEATURES = getFeatures(env.PRODUCTION);
|
|
633
613
|
const includeDataAdapterInProduction = typeof userConfig.includeDataAdapterInProduction === 'boolean' ? userConfig.includeDataAdapterInProduction : true;
|
|
@@ -646,4 +626,3 @@ function setConfig(context, appRootOrConfig, config) {
|
|
|
646
626
|
}
|
|
647
627
|
|
|
648
628
|
exports.setConfig = setConfig;
|
|
649
|
-
//# sourceMappingURL=cjs-set-config.cjs.map
|
|
@@ -196,4 +196,3 @@ const LOGGING = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
196
196
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
197
197
|
|
|
198
198
|
export { DEBUG_RELATIONSHIP_NOTIFICATIONS as D, LOGGING as L, __INTERNAL_LOG_NATIVE_MAP_SET_COUNTS as _, LOG_CACHE as a, LOG_PAYLOADS as b, LOG_OPERATIONS as c, LOG_MUTATIONS as d, LOG_CACHE_POLICY as e, LOG_NOTIFICATIONS as f, LOG_REQUESTS as g, LOG_REQUEST_STATUS as h, LOG_IDENTIFIERS as i, LOG_GRAPH as j, LOG_INSTANCE_CACHE as k, LOG_METRIC_COUNTS as l };
|
|
199
|
-
//# sourceMappingURL=debugging-VdsvkNjX.js.map
|
package/dist/debugging.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
1
|
export { D as DEBUG_RELATIONSHIP_NOTIFICATIONS, a as LOG_CACHE, e as LOG_CACHE_POLICY, j as LOG_GRAPH, i as LOG_IDENTIFIERS, k as LOG_INSTANCE_CACHE, l as LOG_METRIC_COUNTS, d as LOG_MUTATIONS, f as LOG_NOTIFICATIONS, c as LOG_OPERATIONS, b as LOG_PAYLOADS, g as LOG_REQUESTS, h as LOG_REQUEST_STATUS, _ as __INTERNAL_LOG_NATIVE_MAP_SET_COUNTS } from './debugging-VdsvkNjX.js';
|
|
2
|
-
//# sourceMappingURL=debugging.js.map
|
|
@@ -109,7 +109,7 @@ const DEPRECATE_CATCH_ALL = true;
|
|
|
109
109
|
* <Badge type="danger" text="no-id-assigned" />
|
|
110
110
|
*
|
|
111
111
|
* This is a planned deprecation which will trigger when observer or computed
|
|
112
|
-
* chains are used to watch for changes on any
|
|
112
|
+
* chains are used to watch for changes on any WarpDrive LiveArray, CollectionRecordArray,
|
|
113
113
|
* ManyArray or PromiseManyArray.
|
|
114
114
|
*
|
|
115
115
|
* Support for these chains is currently guarded by the deprecation flag
|
|
@@ -150,7 +150,7 @@ const DEPRECATE_COMPUTED_CHAINS = true;
|
|
|
150
150
|
* singular, dasherized, etc. so long as everywhere you refer to the type
|
|
151
151
|
* you use the same string.
|
|
152
152
|
*
|
|
153
|
-
* If using @
|
|
153
|
+
* If using @warp-drive/legacy/model, there will always be a restriction that the
|
|
154
154
|
* `type` must match the path on disk where the model is defined.
|
|
155
155
|
*
|
|
156
156
|
* e.g. `app/models/foo/bar-bem.js` must have a type of `foo/bar-bem`
|
|
@@ -164,7 +164,7 @@ const DEPRECATE_NON_STRICT_TYPES = true;
|
|
|
164
164
|
/**
|
|
165
165
|
* <Badge type="warning" text="ember-data:deprecate-non-strict-id" />
|
|
166
166
|
*
|
|
167
|
-
* Currently,
|
|
167
|
+
* Currently, WarpDrive expects that the `id` property associated with
|
|
168
168
|
* a resource is a string.
|
|
169
169
|
*
|
|
170
170
|
* However, for legacy support in many locations we would accept a number
|
|
@@ -341,7 +341,7 @@ const DEPRECATE_NON_UNIQUE_PAYLOADS = true;
|
|
|
341
341
|
*
|
|
342
342
|
* ### What if I don't want the new behavior?
|
|
343
343
|
*
|
|
344
|
-
*
|
|
344
|
+
* WarpDrive's philosophy is to not make assumptions about your application. Where possible
|
|
345
345
|
* we seek out "100%" solutions – solutions that work for all use cases - and where that is
|
|
346
346
|
* not possible we default to "90%" solutions – solutions that work for the vast majority of use
|
|
347
347
|
* cases. In the case of "90%" solutions we look for primitives that allow you to resolve the
|
|
@@ -375,7 +375,7 @@ const DEPRECATE_NON_UNIQUE_PAYLOADS = true;
|
|
|
375
375
|
* What this version (5.3) does not yet provide is a way to directly modify the cache's remote state
|
|
376
376
|
* for the relationship via public APIs other than via the broader action of upserting a response via
|
|
377
377
|
* `<Cache>.put(document)`. However, such an API was sketched in the Cache 2.1 RFC
|
|
378
|
-
* `<Cache>.patch(operation)` and is likely to be added in a future 5.x release of
|
|
378
|
+
* `<Cache>.patch(operation)` and is likely to be added in a future 5.x release of WarpDrive.
|
|
379
379
|
*
|
|
380
380
|
* This version (5.3) also does not yet provide a way to directly modify the graph (a general purpose
|
|
381
381
|
* subset of cache behaviors specific to relationships) via public APIs. However, during the
|
|
@@ -546,4 +546,3 @@ const CURRENT_DEPRECATIONS = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defi
|
|
|
546
546
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
547
547
|
|
|
548
548
|
export { CURRENT_DEPRECATIONS as C, DEPRECATE_CATCH_ALL as D, ENABLE_LEGACY_SCHEMA_SERVICE as E, DEPRECATE_COMPUTED_CHAINS as a, DEPRECATE_NON_STRICT_TYPES as b, DEPRECATE_NON_STRICT_ID as c, DEPRECATE_LEGACY_IMPORTS as d, DEPRECATE_NON_UNIQUE_PAYLOADS as e, DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE as f, DEPRECATE_MANY_ARRAY_DUPLICATES as g, DEPRECATE_STORE_EXTENDS_EMBER_OBJECT as h, DEPRECATE_EMBER_INFLECTOR as i, DEPRECATE_TRACKING_PACKAGE as j, DISABLE_7X_DEPRECATIONS as k };
|
|
549
|
-
//# sourceMappingURL=deprecations-BVxAmwe9.js.map
|
package/dist/deprecations.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { D as DEPRECATE_CATCH_ALL, a as DEPRECATE_COMPUTED_CHAINS, i as DEPRECATE_EMBER_INFLECTOR, d as DEPRECATE_LEGACY_IMPORTS, g as DEPRECATE_MANY_ARRAY_DUPLICATES, c as DEPRECATE_NON_STRICT_ID, b as DEPRECATE_NON_STRICT_TYPES, e as DEPRECATE_NON_UNIQUE_PAYLOADS, f as DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE, h as DEPRECATE_STORE_EXTENDS_EMBER_OBJECT, j as DEPRECATE_TRACKING_PACKAGE, k as DISABLE_7X_DEPRECATIONS, E as ENABLE_LEGACY_SCHEMA_SERVICE } from './deprecations-
|
|
2
|
-
//# sourceMappingURL=deprecations.js.map
|
|
1
|
+
export { D as DEPRECATE_CATCH_ALL, a as DEPRECATE_COMPUTED_CHAINS, i as DEPRECATE_EMBER_INFLECTOR, d as DEPRECATE_LEGACY_IMPORTS, g as DEPRECATE_MANY_ARRAY_DUPLICATES, c as DEPRECATE_NON_STRICT_ID, b as DEPRECATE_NON_STRICT_TYPES, e as DEPRECATE_NON_UNIQUE_PAYLOADS, f as DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE, h as DEPRECATE_STORE_EXTENDS_EMBER_OBJECT, j as DEPRECATE_TRACKING_PACKAGE, k as DISABLE_7X_DEPRECATIONS, E as ENABLE_LEGACY_SCHEMA_SERVICE } from './deprecations-BNNGFAiG.js';
|
package/dist/env.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,10 +3,13 @@ import semver from 'semver';
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
|
-
import { C as CURRENT_FEATURES } from './canary-features-
|
|
6
|
+
import { C as CURRENT_FEATURES } from './canary-features-CuKgaVtX.js';
|
|
7
7
|
import { L as LOGGING } from './debugging-VdsvkNjX.js';
|
|
8
8
|
|
|
9
|
-
function getEnv() {
|
|
9
|
+
function getEnv(forceMode) {
|
|
10
|
+
const FORCE_TESTING = forceMode === 'testing' || forceMode === 'development' || forceMode === 'debug';
|
|
11
|
+
const FORCE_DEBUG = forceMode === 'development' || forceMode === 'debug';
|
|
12
|
+
const FORCE_PRODUCTION = forceMode === 'production';
|
|
10
13
|
const {
|
|
11
14
|
EMBER_ENV,
|
|
12
15
|
IS_TESTING,
|
|
@@ -15,9 +18,9 @@ function getEnv() {
|
|
|
15
18
|
CI,
|
|
16
19
|
IS_RECORDING
|
|
17
20
|
} = process.env;
|
|
18
|
-
const PRODUCTION = EMBER_ENV === 'production' || !EMBER_ENV && NODE_ENV === 'production';
|
|
19
|
-
const DEBUG = !PRODUCTION;
|
|
20
|
-
const TESTING = DEBUG || Boolean(EMBER_ENV === 'test' || IS_TESTING || EMBER_CLI_TEST_COMMAND);
|
|
21
|
+
const PRODUCTION = FORCE_PRODUCTION || EMBER_ENV === 'production' || !EMBER_ENV && NODE_ENV === 'production';
|
|
22
|
+
const DEBUG = FORCE_DEBUG || !PRODUCTION;
|
|
23
|
+
const TESTING = FORCE_TESTING || DEBUG || Boolean(EMBER_ENV === 'test' || IS_TESTING || EMBER_CLI_TEST_COMMAND);
|
|
21
24
|
const SHOULD_RECORD = Boolean(!CI || IS_RECORDING);
|
|
22
25
|
return {
|
|
23
26
|
TESTING,
|
|
@@ -259,7 +262,7 @@ function setConfig(context, appRootOrConfig, config) {
|
|
|
259
262
|
// }
|
|
260
263
|
|
|
261
264
|
const debugOptions = Object.assign({}, LOGGING, userConfig.debug);
|
|
262
|
-
const env = getEnv();
|
|
265
|
+
const env = getEnv(userConfig.forceMode);
|
|
263
266
|
const DEPRECATIONS = getDeprecations(userConfig.compatWith || null, userConfig.deprecations);
|
|
264
267
|
const FEATURES = getFeatures(env.PRODUCTION);
|
|
265
268
|
const includeDataAdapterInProduction = typeof userConfig.includeDataAdapterInProduction === 'boolean' ? userConfig.includeDataAdapterInProduction : true;
|
|
@@ -278,4 +281,3 @@ function setConfig(context, appRootOrConfig, config) {
|
|
|
278
281
|
}
|
|
279
282
|
|
|
280
283
|
export { setConfig };
|
|
281
|
-
//# sourceMappingURL=index.js.map
|
package/dist/macros.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/build-config",
|
|
3
|
-
"version": "5.6.0-
|
|
3
|
+
"version": "5.6.0-beta.1",
|
|
4
4
|
"description": "Provides Build Configuration for projects using WarpDrive or EmberData",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-data",
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+ssh://git@github.com:emberjs/data.git",
|
|
12
|
-
"directory": "packages/build-config"
|
|
12
|
+
"directory": "warp-drive-packages/build-config"
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"author": "Chris Thoburn <runspired@users.noreply.github.com>",
|
|
16
16
|
"type": "module",
|
|
17
17
|
"files": [
|
|
18
18
|
"dist",
|
|
19
|
-
"
|
|
19
|
+
"declarations",
|
|
20
20
|
"CHANGELOG.md",
|
|
21
21
|
"README.md",
|
|
22
22
|
"LICENSE.md",
|
|
@@ -24,16 +24,15 @@
|
|
|
24
24
|
],
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
|
+
"types": "./declarations/index.d.ts",
|
|
27
28
|
"default": "./dist/index.js"
|
|
28
29
|
},
|
|
29
30
|
"./*.cjs": {
|
|
30
31
|
"default": "./dist/*.cjs"
|
|
31
32
|
},
|
|
32
33
|
"./*": {
|
|
34
|
+
"types": "./declarations/*.d.ts",
|
|
33
35
|
"default": "./dist/*.js"
|
|
34
|
-
},
|
|
35
|
-
"./unstable-preview-types": {
|
|
36
|
-
"types": "./unstable-preview-types/index.d.ts"
|
|
37
36
|
}
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
@@ -43,26 +42,18 @@
|
|
|
43
42
|
"semver": "^7.7.1"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
|
-
"@warp-drive/internal-config": "5.6.0-
|
|
45
|
+
"@warp-drive/internal-config": "5.6.0-beta.1",
|
|
47
46
|
"@types/babel__core": "^7.20.5",
|
|
48
47
|
"@types/node": "^20.17.32",
|
|
49
48
|
"@babel/plugin-transform-typescript": "^7.27.0",
|
|
50
49
|
"@babel/preset-typescript": "^7.27.0",
|
|
51
50
|
"@babel/core": "^7.26.10",
|
|
52
51
|
"typescript": "^5.8.3",
|
|
53
|
-
"
|
|
54
|
-
"vite": "^5.4.15"
|
|
52
|
+
"vite": "^7.0.0"
|
|
55
53
|
},
|
|
56
54
|
"volta": {
|
|
57
55
|
"extends": "../../package.json"
|
|
58
56
|
},
|
|
59
|
-
"typesVersions": {
|
|
60
|
-
"*": {
|
|
61
|
-
"unstable-preview-types": [
|
|
62
|
-
"./unstable-preview-types"
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
57
|
"scripts": {
|
|
67
58
|
"build:pkg": "vite build; vite build -c ./vite.config-cjs.mjs;",
|
|
68
59
|
"sync": "echo \"syncing\"",
|
package/dist/addon-shim.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addon-shim.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/dist/babel-macros.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"babel-macros.js","sources":["../src/babel-macros.ts"],"sourcesContent":["/**\n * Babel plugins that convert constants and expressions into [macroConditions](https://www.npmjs.com/package/@embroider/macros#the-macros)\n * so that they can be stripped from the code during the build process.\n *\n * This allows us to have great DX around common configuration patterns\n * while still being able to ship a small and fast library.\n *\n * Transforms\n *\n * - deprecation constants imported from `@warp-drive/build-config/deprecations`\n * - feature flags imported from `@warp-drive/build-config/canary-features`\n * - debug logging constants imported from `@warp-drive/build-config/debugging`\n * - environment constants imported from `@warp-drive/build-config/env`\n * - expressionts imported from `@warp-drive/build-config/macros`\n *\n * Addons and apps can use these plugins to match the code-stripping behaviors of\n * ***Warp*Drive**. This is useful when managing migrations for canary features\n * and deprecations.\n *\n * @module\n */\nimport * as LOGGING from './debugging.ts';\nimport * as CURRENT_FEATURES from './canary-features.ts';\nimport * as CURRENT_DEPRECATIONS from './deprecations.ts';\n\ntype FEATURE = keyof typeof CURRENT_FEATURES;\nconst features = Object.keys(CURRENT_FEATURES) as FEATURE[];\nconst FEATURES = Object.assign({}, CURRENT_FEATURES) as Record<FEATURE, boolean>;\nfeatures.forEach((feature) => {\n let featureValue = FEATURES[feature];\n if (featureValue === null) {\n FEATURES[feature] = false;\n }\n});\n\nconst config = {\n features: FEATURES,\n deprecations: Object.assign({}, CURRENT_DEPRECATIONS),\n debug: Object.assign({}, LOGGING),\n};\n\ntype BabelPlugin = [string, Record<string, unknown>, string];\n\n/**\n * @returns an array of Babel plugins that can be used for code-stripping\n * based on the configuration supplied to `setConfig` and the current ENV.\n *\n * - deprecation constants imported from `@warp-drive/build-config/deprecations`\n * - feature flags imported from `@warp-drive/build-config/canary-features`\n * - debug logging constants imported from `@warp-drive/build-config/debugging`\n * - environment constants imported from `@warp-drive/build-config/env`\n * - expressionts imported from `@warp-drive/build-config/macros`\n */\nexport function macros(): BabelPlugin[] {\n const TransformAsserts = import.meta.resolve('./babel-plugin-transform-asserts.cjs').slice(7);\n const TransformDeprecations = import.meta.resolve('./babel-plugin-transform-deprecations.cjs').slice(7);\n const TransformDebugLogging = import.meta.resolve('./babel-plugin-transform-logging.cjs').slice(7);\n const TransformFeatures = import.meta.resolve('./babel-plugin-transform-features.cjs').slice(7);\n\n let plugins = [\n [\n TransformAsserts,\n {\n sources: ['@warp-drive/build-config/macros', '@warp-drive/core/build-config/macros'],\n },\n '@warp-drive/core/build-config/asserts-stripping',\n ],\n [\n TransformFeatures,\n {\n sources: ['@warp-drive/build-config/canary-features', '@warp-drive/core/build-config/canary-features'],\n flags: config.features,\n },\n '@warp-drive/core/build-config/canary-features-stripping',\n ],\n [\n TransformDeprecations,\n {\n sources: ['@warp-drive/build-config/deprecations', '@warp-drive/core/build-config/deprecations'],\n flags: config.deprecations,\n },\n '@warp-drive/core/build-config/deprecation-stripping',\n ],\n [\n TransformDebugLogging,\n {\n sources: ['@warp-drive/build-config/debugging', '@warp-drive/core/build-config/debugging'],\n configKey: 'debug',\n runtimeKey: 'activeLogging',\n flags: config.debug,\n },\n '@warp-drive/core/build-config/debugging-stripping',\n ],\n [\n TransformDebugLogging,\n {\n sources: ['@warp-drive/build-config/env', '@warp-drive/core/build-config/env'],\n configKey: 'env',\n flags: {\n TESTING: true,\n PRODUCTION: true,\n DEBUG: true,\n IS_RECORDING: true,\n IS_CI: true,\n SHOULD_RECORD: true,\n },\n },\n '@warp-drive/core/build-config/env',\n ],\n ] satisfies BabelPlugin[];\n\n return plugins;\n}\n"],"names":["features","Object","keys","CURRENT_FEATURES","FEATURES","assign","forEach","feature","featureValue","config","deprecations","CURRENT_DEPRECATIONS","debug","LOGGING","macros","TransformAsserts","import","meta","resolve","slice","TransformDeprecations","TransformDebugLogging","TransformFeatures","plugins","sources","flags","configKey","runtimeKey","TESTING","PRODUCTION","DEBUG","IS_RECORDING","IS_CI","SHOULD_RECORD"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA,MAAMA,QAAQ,GAAGC,MAAM,CAACC,IAAI,CAACC,gBAAgB,CAAc;AAC3D,MAAMC,QAAQ,GAAGH,MAAM,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AAC;IACtGC,KAAK,EAAEhB,MAAM,CAACT;AAChB,GAAC,EACD,yDAAyD,CAC1D,EACD,CACEoB,qBAAqB,EACrB;AACEI,IAAAA,OAAO,EAAE,CAAC,uCAAuC,EAAE,4CAA4C,CAAC;IAChGC,KAAK,EAAEhB,MAAM,CAACC;AAChB,GAAC,EACD,qDAAqD,CACtD,EACD,CACEW,qBAAqB,EACrB;AACEG,IAAAA,OAAO,EAAE,CAAC,oCAAoC,EAAE,yCAAyC,CAAC;AAC1FE,IAAAA,SAAS,EAAE,OAAO;AAClBC,IAAAA,UAAU,EAAE,eAAe;IAC3BF,KAAK,EAAEhB,MAAM,CAACG;AAChB,GAAC,EACD,mDAAmD,CACpD,EACD,CACES,qBAAqB,EACrB;AACEG,IAAAA,OAAO,EAAE,CAAC,8BAA8B,EAAE,mCAAmC,CAAC;AAC9EE,IAAAA,SAAS,EAAE,KAAK;AAChBD,IAAAA,KAAK,EAAE;AACLG,MAAAA,OAAO,EAAE,IAAI;AACbC,MAAAA,UAAU,EAAE,IAAI;AAChBC,MAAAA,KAAK,EAAE,IAAI;AACXC,MAAAA,YAAY,EAAE,IAAI;AAClBC,MAAAA,KAAK,EAAE,IAAI;AACXC,MAAAA,aAAa,EAAE;AACjB;GACD,EACD,mCAAmC,CACpC,CACsB;AAEzB,EAAA,OAAOV,OAAO;AAChB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-transform-asserts.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-asserts.js"],"sourcesContent":["const { ImportUtil } = require('babel-import-util');\n\nconst Utils = new Set(['assert']);\n\n/*\n// Before\nimport { assert } from '@warp-drive/build-config/macros';\n\nassert('foo', true);\n\n// After\n(macroCondition(isDevelopingApp()) ? function assert(test) { if (!test) { throw new Error('foo'); } }(true) : {});\n*/\n\n// => _macros.getGlobalConfig().WarpDrive.env.DEBUG\nfunction buildMacroConstDEBUG(types, binding, state) {\n return types.memberExpression(\n types.memberExpression(\n types.memberExpression(\n types.callExpression(state.importer.import(binding, '@embroider/macros', 'getGlobalConfig'), []),\n types.identifier('WarpDrive')\n ),\n types.identifier('env')\n ),\n types.identifier('DEBUG')\n );\n}\n\n// => _macros.macroCondition(_macros.getGlobalConfig().WarpDrive.env.DEBUG)\nfunction buildMacroConditionDEBUG(types, binding, state) {\n return types.callExpression(state.importer.import(binding, '@embroider/macros', 'macroCondition'), [\n buildMacroConstDEBUG(types, binding, state),\n ]);\n}\n\n// (test) => { if (!test) { throw new Error(someMessage); } }(someCond)\nfunction buildAssert(types, originalCallExpression) {\n const desc = originalCallExpression.arguments[0];\n const test = originalCallExpression.arguments[1] ?? types.booleanLiteral(false);\n // prettier-ignore\n return types.callExpression(\n types.arrowFunctionExpression([types.identifier('test')], // (test) =>\n types.blockStatement([ // {\n types.ifStatement( // if\n types.unaryExpression('!', types.identifier('test')), // (!test)\n types.blockStatement([ // {\n types.throwStatement( // throw\n types.newExpression(types.identifier('Error'), [desc]) // new Error(desc)\n )]) // }\n )]) // }\n ),\n [test] // (someCond)\n );\n}\n\n// => ( <debug-macro> ? <assert-exp> : {});\nfunction buildAssertTernary(types, binding, state, originalCallExpression) {\n return types.expressionStatement(\n types.conditionalExpression(\n buildMacroConditionDEBUG(types, binding, state),\n buildAssert(types, originalCallExpression),\n types.objectExpression([])\n )\n );\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 (state.opts.sources.includes(importPath)) {\n const specifiers = path.get('specifiers');\n\n specifiers.forEach((specifier) => {\n const name = specifier.node.imported.name;\n if (!Utils.has(name)) {\n throw new Error(`Unexpected import '${name}' imported from '${importPath}'`);\n }\n\n const localBindingName = specifier.node.local.name;\n const binding = specifier.scope.getBinding(localBindingName);\n\n binding.referencePaths.forEach((p) => {\n const originalCallExpression = p.parentPath.node;\n\n if (!t.isCallExpression(originalCallExpression)) {\n throw new Error('Expected a call expression');\n }\n\n const assertTernary = buildAssertTernary(t, binding, state, originalCallExpression);\n p.parentPath.replaceWith(assertTernary);\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\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":["ImportUtil","require","Utils","Set","buildMacroConstDEBUG","types","binding","state","memberExpression","callExpression","importer","import","identifier","buildMacroConditionDEBUG","buildAssert","originalCallExpression","desc","arguments","test","booleanLiteral","arrowFunctionExpression","blockStatement","ifStatement","unaryExpression","throwStatement","newExpression","buildAssertTernary","expressionStatement","conditionalExpression","objectExpression","babel","t","name","visitor","ImportDeclaration","path","importPath","node","source","value","opts","sources","includes","specifiers","get","forEach","specifier","imported","has","Error","localBindingName","local","scope","getBinding","referencePaths","p","parentPath","isCallExpression","assertTernary","replaceWith","removeOwnBinding","remove","length","Program"],"mappings":";;AAAA,MAAM;AAAEA,EAAAA;AAAW,CAAC,GAAGC,OAAO,CAAC,mBAAmB,CAAC;AAEnD,MAAMC,KAAK,GAAG,IAAIC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;;AAEjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,SAASC,oBAAoBA,CAACC,KAAK,EAAEC,OAAO,EAAEC,KAAK,EAAE;EACnD,OAAOF,KAAK,CAACG,gBAAgB,CAC3BH,KAAK,CAACG,gBAAgB,CACpBH,KAAK,CAACG,gBAAgB,CACpBH,KAAK,CAACI,cAAc,CAACF,KAAK,CAACG,QAAQ,CAACC,MAAM,CAACL,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,CAAC,EAAE,EAAE,CAAC,EAChGD,KAAK,CAACO,UAAU,CAAC,WAAW,CAC9B,CAAC,EACDP,KAAK,CAACO,UAAU,CAAC,KAAK,CACxB,CAAC,EACDP,KAAK,CAACO,UAAU,CAAC,OAAO,CAC1B,CAAC;AAC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