@warp-drive-mirror/build-config 5.8.0-alpha.0 → 5.8.0-alpha.11

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/CHANGELOG.md CHANGED
@@ -4,21 +4,21 @@
4
4
 
5
5
  #### :evergreen_tree: New Deprecation
6
6
 
7
- * [#9479](https://github.com/emberjs/data/pull/9479) feat: support migration path for ember-inflector usage ([@runspired](https://github.com/runspired))
7
+ * [#9479](https://github.com/warp-drive-data/warp-drive/pull/9479) feat: support migration path for ember-inflector usage ([@runspired](https://github.com/runspired))
8
8
 
9
9
  #### :rocket: Enhancement
10
10
 
11
- * [#9471](https://github.com/emberjs/data/pull/9471) feat: npx warp-drive ([@runspired](https://github.com/runspired))
12
- * [#9448](https://github.com/emberjs/data/pull/9448) feat: impl SchemaService RFC ([@runspired](https://github.com/runspired))
11
+ * [#9471](https://github.com/warp-drive-data/warp-drive/pull/9471) feat: npx warp-drive ([@runspired](https://github.com/runspired))
12
+ * [#9448](https://github.com/warp-drive-data/warp-drive/pull/9448) feat: impl SchemaService RFC ([@runspired](https://github.com/runspired))
13
13
 
14
14
  #### :bug: Bug Fix
15
15
 
16
- * [#9455](https://github.com/emberjs/data/pull/9455) fix: config version lookup needs to be project location aware ([@runspired](https://github.com/runspired))
16
+ * [#9455](https://github.com/warp-drive-data/warp-drive/pull/9455) fix: config version lookup needs to be project location aware ([@runspired](https://github.com/runspired))
17
17
 
18
18
  #### :house: Internal
19
19
 
20
- * [#9477](https://github.com/emberjs/data/pull/9477) fix: add deprecation and avoid breaking configs ([@runspired](https://github.com/runspired))
21
- * [#9292](https://github.com/emberjs/data/pull/9292) feat: add new build-config package ([@runspired](https://github.com/runspired))
20
+ * [#9477](https://github.com/warp-drive-data/warp-drive/pull/9477) fix: add deprecation and avoid breaking configs ([@runspired](https://github.com/runspired))
21
+ * [#9292](https://github.com/warp-drive-data/warp-drive/pull/9292) feat: add new build-config package ([@runspired](https://github.com/runspired))
22
22
 
23
23
  #### Committers: (1)
24
24
 
package/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  <p align="center">
2
2
  <img
3
3
  class="project-logo"
4
- src="./logos/NCC-1701-a-blue.svg#gh-light-mode-only"
4
+ src="./logos/warp-drive-logo-dark.svg#gh-light-mode-only"
5
5
  alt="WarpDrive"
6
- width="120px"
6
+ width="200px"
7
7
  title="WarpDrive" />
8
8
  <img
9
9
  class="project-logo"
10
- src="./logos/NCC-1701-a.svg#gh-dark-mode-only"
10
+ src="./logos/warp-drive-logo-gold.svg#gh-dark-mode-only"
11
11
  alt="WarpDrive"
12
- width="120px"
12
+ width="200px"
13
13
  title="WarpDrive" />
14
14
  </p>
15
15
 
@@ -51,7 +51,7 @@ module.exports = async function (defaults) {
51
51
  const app = new EmberApp(defaults, {});
52
52
 
53
53
  setConfig(app, __dirname, {
54
- // WarpDrive/EmberData settings go here (if any)
54
+ // WarpDrive settings go here (if any)
55
55
  });
56
56
 
57
57
  return app.toTree();
@@ -68,7 +68,7 @@ module.exports = async function (defaults) {
68
68
  img.project-logo {
69
69
  padding: 0 5em 1em 5em;
70
70
  width: 100px;
71
- border-bottom: 2px solid #0969da;
71
+ border-bottom: 2px solid #bbb;
72
72
  margin: 0 auto;
73
73
  display: block;
74
74
  }
@@ -84,7 +84,7 @@ module.exports = async function (defaults) {
84
84
  display: inline-block;
85
85
  padding: .2rem 0;
86
86
  color: #000;
87
- border-bottom: 3px solid #0969da;
87
+ border-bottom: 3px solid #bbb;
88
88
  }
89
89
 
90
90
  details > details {
@@ -100,7 +100,7 @@
100
100
  * }
101
101
  * ```
102
102
  *
103
- * For more complex projects and migrations, configure [@warp-drive-mirror/build-config/babel-macros](./babel-macros)
103
+ * For more complex projects and migrations, configure {@link @warp-drive-mirror/core!build-config/babel-macros | @warp-drive-mirror/core/build-config/babel-macros}
104
104
  *
105
105
  * The current list of features used at build time for canary releases is defined below.
106
106
  *
@@ -450,7 +450,7 @@ export declare const ENABLE_LEGACY_SCHEMA_SERVICE: boolean;
450
450
  *
451
451
  * This deprecation can be resolved by removing usage of ember-inflector or by using
452
452
  * both ember-inflector and @ember-data-mirror/request-utils in parallel and updating your
453
- * EmberData/WarpDrive build config to mark the deprecation as resolved
453
+ * WarpDrive build config to mark the deprecation as resolved
454
454
  * in ember-cli-build
455
455
  *
456
456
  * ```js
@@ -1,7 +1,26 @@
1
1
  import { getDeprecations } from "./-private/utils/deprecations.js";
2
2
  import { getFeatures } from "./-private/utils/features.js";
3
3
  import * as LOGGING from "./debugging.js";
4
- export type WarpDriveConfig = {
4
+ import type { PluginItem } from "@babel/core";
5
+ /**
6
+ * Create the Babel plugin for WarpDrive
7
+ *
8
+ * Note: If your project already uses [@embroider/macros](https://www.npmjs.com/package/@embroider/macros)
9
+ * then you should use {@link setConfig} instead of this function.
10
+ *
11
+ * @param options WarpDrive configuration options
12
+ * @returns An array of Babel plugins
13
+ */
14
+ export declare function babelPlugin(options: WarpDriveConfig): {
15
+ gts: Function[];
16
+ js: PluginItem[];
17
+ };
18
+ /**
19
+ * Build Configuration options for WarpDrive that
20
+ * allow adjusting logging, deprecations, canary features
21
+ * and optional features.
22
+ */
23
+ export interface WarpDriveConfig {
5
24
  /**
6
25
  * An object of key/value pairs of logging flags
7
26
  *
@@ -44,6 +63,13 @@ export type WarpDriveConfig = {
44
63
  * `5.3` will remove all the support for the deprecated
45
64
  * features for associated deprecations.
46
65
  *
66
+ * :::caution **Universal Apps**
67
+ * This value should be at least `5.6` for universal/non-ember
68
+ * applications as that was the first version that builds
69
+ * without any ember-source dependencies provided all deprecations
70
+ * are resolved.
71
+ * :::
72
+ *
47
73
  * See {@link DEPRECATIONS | deprecations} for more details.
48
74
  */
49
75
  compatWith?: `${number}.${number}`;
@@ -81,8 +107,8 @@ export type WarpDriveConfig = {
81
107
  * @private
82
108
  */
83
109
  forceMode?: "testing" | "production" | "development";
84
- };
85
- type InternalWarpDriveConfig = {
110
+ }
111
+ interface InternalWarpDriveConfig {
86
112
  debug: typeof LOGGING;
87
113
  polyfillUUID: boolean;
88
114
  includeDataAdapter: boolean;
@@ -95,7 +121,57 @@ type InternalWarpDriveConfig = {
95
121
  PRODUCTION: boolean;
96
122
  DEBUG: boolean;
97
123
  };
98
- };
124
+ }
125
+ /**
126
+ * Sets the build configuration for WarpDrive that ensures
127
+ * environment specific behaviors are activated/deactivated
128
+ * and enables adjusting log instrumentation, removing code
129
+ * that supports deprecated features, enabling canary features
130
+ * and enabling/disabling optional features.
131
+ *
132
+ * The library uses [@embroider/macros](https://www.npmjs.com/package/@embroider/macros)
133
+ * to perform this final configuration code transform.
134
+ *
135
+ * This is a low level API for configuring WarpDrive. If your
136
+ * project does not use `@embroider/macros` then you should use
137
+ * {@link babelPlugin} instead of this function.
138
+ *
139
+ * ### Example
140
+ *
141
+ * ```ts
142
+ * import { setConfig } from '@warp-drive-mirror/core/build-config';
143
+ * import { buildMacros } from '@embroider/macros/babel';
144
+ *
145
+ * const Macros = buildMacros({
146
+ * configure: (config) => {
147
+ * setConfig(config, {
148
+ * compatWith: '5.6'
149
+ * });
150
+ * },
151
+ * });
152
+ *
153
+ * export default {
154
+ * plugins: [
155
+ * // babel-plugin-debug-macros is temporarily needed
156
+ * // to convert deprecation/warn calls into console.warn
157
+ * [
158
+ * 'babel-plugin-debug-macros',
159
+ * {
160
+ * flags: [],
161
+ *
162
+ * debugTools: {
163
+ * isDebug: true,
164
+ * source: '@ember/debug',
165
+ * assertPredicateIndex: 1,
166
+ * },
167
+ * },
168
+ * 'ember-data-mirror-specific-macros-stripping-test',
169
+ * ],
170
+ * ...Macros.babelMacros,
171
+ * ],
172
+ * };
173
+ * ```
174
+ */
99
175
  export declare function setConfig(macros: object, config: WarpDriveConfig): void;
100
176
  export declare function setConfig(context: object, appRoot: string, config: WarpDriveConfig): void;
101
177
  export {};
@@ -1,6 +1,6 @@
1
1
  import { L as LOGGING } from './debugging-DgRWKeE4.js';
2
- import { C as CURRENT_FEATURES } from './canary-features-BM0to_ys.js';
3
- import { C as CURRENT_DEPRECATIONS } from './deprecations-DitCVLCo.js';
2
+ import { C as CURRENT_FEATURES } from './canary-features-BUBNGiZ-.js';
3
+ import { C as CURRENT_DEPRECATIONS } from './deprecations-3a6psrPz.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)
@@ -100,7 +100,7 @@
100
100
  * }
101
101
  * ```
102
102
  *
103
- * For more complex projects and migrations, configure [@warp-drive-mirror/build-config/babel-macros](./babel-macros)
103
+ * For more complex projects and migrations, configure {@link @warp-drive-mirror/core!build-config/babel-macros | @warp-drive-mirror/core/build-config/babel-macros}
104
104
  *
105
105
  * The current list of features used at build time for canary releases is defined below.
106
106
  *
@@ -1 +1 @@
1
- export { E as ENFORCE_STRICT_RESOURCE_FINALIZATION, J as JSON_API_CACHE_VALIDATION_ERRORS, S as SAMPLE_FEATURE_FLAG } from './canary-features-BM0to_ys.js';
1
+ export { E as ENFORCE_STRICT_RESOURCE_FINALIZATION, J as JSON_API_CACHE_VALIDATION_ERRORS, S as SAMPLE_FEATURE_FLAG } from './canary-features-BUBNGiZ-.js';
@@ -7,6 +7,7 @@ const semver = require('semver');
7
7
  const fs = require('fs');
8
8
  const path = require('path');
9
9
  const url = require('url');
10
+ require('@embroider/macros/src/babel.js');
10
11
 
11
12
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
12
13
  function getEnv(forceMode) {
@@ -229,7 +230,7 @@ function getDeprecations(compatVersion, deprecations) {
229
230
  * }
230
231
  * ```
231
232
  *
232
- * For more complex projects and migrations, configure [@warp-drive-mirror/build-config/babel-macros](./babel-macros)
233
+ * For more complex projects and migrations, configure {@link @warp-drive-mirror/core!build-config/babel-macros | @warp-drive-mirror/core/build-config/babel-macros}
233
234
  *
234
235
  * The current list of features used at build time for canary releases is defined below.
235
236
  *
@@ -593,17 +594,75 @@ function createLoggingConfig(env, debug) {
593
594
  * - {@link WarpDriveConfig.includeDataAdapterInProduction | includeDataAdapterInProduction}
594
595
  * - {@link WarpDriveConfig.compatWith | compatWith}
595
596
  *
596
- *
597
- *
598
597
  * @module
599
598
  */
599
+
600
600
  const _MacrosConfig = EmbroiderMacros.MacrosConfig;
601
+
602
+ /**
603
+ * Build Configuration options for WarpDrive that
604
+ * allow adjusting logging, deprecations, canary features
605
+ * and optional features.
606
+ */
607
+
601
608
  function recastMacrosConfig(macros) {
602
609
  if (!('globalConfig' in macros)) {
603
610
  throw new Error('Expected MacrosConfig to have a globalConfig property');
604
611
  }
605
612
  return macros;
606
613
  }
614
+
615
+ /**
616
+ * Sets the build configuration for WarpDrive that ensures
617
+ * environment specific behaviors are activated/deactivated
618
+ * and enables adjusting log instrumentation, removing code
619
+ * that supports deprecated features, enabling canary features
620
+ * and enabling/disabling optional features.
621
+ *
622
+ * The library uses [@embroider/macros](https://www.npmjs.com/package/@embroider/macros)
623
+ * to perform this final configuration code transform.
624
+ *
625
+ * This is a low level API for configuring WarpDrive. If your
626
+ * project does not use `@embroider/macros` then you should use
627
+ * {@link babelPlugin} instead of this function.
628
+ *
629
+ * ### Example
630
+ *
631
+ * ```ts
632
+ * import { setConfig } from '@warp-drive-mirror/core/build-config';
633
+ * import { buildMacros } from '@embroider/macros/babel';
634
+ *
635
+ * const Macros = buildMacros({
636
+ * configure: (config) => {
637
+ * setConfig(config, {
638
+ * compatWith: '5.6'
639
+ * });
640
+ * },
641
+ * });
642
+ *
643
+ * export default {
644
+ * plugins: [
645
+ * // babel-plugin-debug-macros is temporarily needed
646
+ * // to convert deprecation/warn calls into console.warn
647
+ * [
648
+ * 'babel-plugin-debug-macros',
649
+ * {
650
+ * flags: [],
651
+ *
652
+ * debugTools: {
653
+ * isDebug: true,
654
+ * source: '@ember/debug',
655
+ * assertPredicateIndex: 1,
656
+ * },
657
+ * },
658
+ * 'ember-data-mirror-specific-macros-stripping-test',
659
+ * ],
660
+ * ...Macros.babelMacros,
661
+ * ],
662
+ * };
663
+ * ```
664
+ */
665
+
607
666
  function setConfig(context, appRootOrConfig, config) {
608
667
  const isEmberClassicUsage = arguments.length === 3;
609
668
  const macros = recastMacrosConfig(isEmberClassicUsage ? _MacrosConfig.for(context, appRootOrConfig) : context);
@@ -461,7 +461,7 @@ const ENABLE_LEGACY_SCHEMA_SERVICE = true;
461
461
  *
462
462
  * This deprecation can be resolved by removing usage of ember-inflector or by using
463
463
  * both ember-inflector and @ember-data-mirror/request-utils in parallel and updating your
464
- * EmberData/WarpDrive build config to mark the deprecation as resolved
464
+ * WarpDrive build config to mark the deprecation as resolved
465
465
  * in ember-cli-build
466
466
  *
467
467
  * ```js
@@ -1 +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, l as DISABLE_7X_DEPRECATIONS, k as ENABLE_LEGACY_REQUEST_METHODS, E as ENABLE_LEGACY_SCHEMA_SERVICE } from './deprecations-DitCVLCo.js';
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, l as DISABLE_7X_DEPRECATIONS, k as ENABLE_LEGACY_REQUEST_METHODS, E as ENABLE_LEGACY_SCHEMA_SERVICE } from './deprecations-3a6psrPz.js';
package/dist/index.js CHANGED
@@ -3,8 +3,9 @@ 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-BM0to_ys.js';
6
+ import { C as CURRENT_FEATURES } from './canary-features-BUBNGiZ-.js';
7
7
  import { L as LOGGING } from './debugging-DgRWKeE4.js';
8
+ import { buildMacros } from '@embroider/macros/src/babel.js';
8
9
 
9
10
  function getEnv(forceMode) {
10
11
  const FORCE_TESTING = forceMode === 'testing' || forceMode === 'development' || forceMode === 'debug';
@@ -229,17 +230,115 @@ function createLoggingConfig(env, debug) {
229
230
  * - {@link WarpDriveConfig.includeDataAdapterInProduction | includeDataAdapterInProduction}
230
231
  * - {@link WarpDriveConfig.compatWith | compatWith}
231
232
  *
233
+ * @module
234
+ */
235
+
236
+
237
+ /**
238
+ * Create the Babel plugin for WarpDrive
232
239
  *
240
+ * Note: If your project already uses [@embroider/macros](https://www.npmjs.com/package/@embroider/macros)
241
+ * then you should use {@link setConfig} instead of this function.
233
242
  *
234
- * @module
243
+ * @param options WarpDrive configuration options
244
+ * @returns An array of Babel plugins
235
245
  */
246
+ function babelPlugin(options) {
247
+ const macros = buildMacros({
248
+ configure: config => {
249
+ setConfig(config, options);
250
+ }
251
+ });
252
+ const env = getEnv(options.forceMode);
253
+ return {
254
+ gts: macros.templateMacros,
255
+ js: [
256
+ // babel-plugin-debug-macros is temporarily needed
257
+ // to convert deprecation/warn calls into console.warn
258
+ [resolve('babel-plugin-debug-macros'), {
259
+ flags: [],
260
+ debugTools: {
261
+ isDebug: env.DEBUG,
262
+ source: '@ember/debug',
263
+ assertPredicateIndex: 1
264
+ }
265
+ }, 'ember-data-mirror-specific-macros-stripping-test'], ...macros.babelMacros]
266
+ };
267
+ }
268
+ function resolve(module) {
269
+ const filePath = import.meta.resolve(module);
270
+ const file = filePath.replace('/node_modules/.vite-temp/', '/');
271
+ if (file.startsWith('file://')) {
272
+ return file.slice(7);
273
+ }
274
+ return file;
275
+ }
236
276
  const _MacrosConfig = EmbroiderMacros.MacrosConfig;
277
+
278
+ /**
279
+ * Build Configuration options for WarpDrive that
280
+ * allow adjusting logging, deprecations, canary features
281
+ * and optional features.
282
+ */
283
+
237
284
  function recastMacrosConfig(macros) {
238
285
  if (!('globalConfig' in macros)) {
239
286
  throw new Error('Expected MacrosConfig to have a globalConfig property');
240
287
  }
241
288
  return macros;
242
289
  }
290
+
291
+ /**
292
+ * Sets the build configuration for WarpDrive that ensures
293
+ * environment specific behaviors are activated/deactivated
294
+ * and enables adjusting log instrumentation, removing code
295
+ * that supports deprecated features, enabling canary features
296
+ * and enabling/disabling optional features.
297
+ *
298
+ * The library uses [@embroider/macros](https://www.npmjs.com/package/@embroider/macros)
299
+ * to perform this final configuration code transform.
300
+ *
301
+ * This is a low level API for configuring WarpDrive. If your
302
+ * project does not use `@embroider/macros` then you should use
303
+ * {@link babelPlugin} instead of this function.
304
+ *
305
+ * ### Example
306
+ *
307
+ * ```ts
308
+ * import { setConfig } from '@warp-drive-mirror/core/build-config';
309
+ * import { buildMacros } from '@embroider/macros/babel';
310
+ *
311
+ * const Macros = buildMacros({
312
+ * configure: (config) => {
313
+ * setConfig(config, {
314
+ * compatWith: '5.6'
315
+ * });
316
+ * },
317
+ * });
318
+ *
319
+ * export default {
320
+ * plugins: [
321
+ * // babel-plugin-debug-macros is temporarily needed
322
+ * // to convert deprecation/warn calls into console.warn
323
+ * [
324
+ * 'babel-plugin-debug-macros',
325
+ * {
326
+ * flags: [],
327
+ *
328
+ * debugTools: {
329
+ * isDebug: true,
330
+ * source: '@ember/debug',
331
+ * assertPredicateIndex: 1,
332
+ * },
333
+ * },
334
+ * 'ember-data-mirror-specific-macros-stripping-test',
335
+ * ],
336
+ * ...Macros.babelMacros,
337
+ * ],
338
+ * };
339
+ * ```
340
+ */
341
+
243
342
  function setConfig(context, appRootOrConfig, config) {
244
343
  const isEmberClassicUsage = arguments.length === 3;
245
344
  const macros = recastMacrosConfig(isEmberClassicUsage ? _MacrosConfig.for(context, appRootOrConfig) : context);
@@ -284,4 +383,4 @@ function setConfig(context, appRootOrConfig, config) {
284
383
  macros.setGlobalConfig(import.meta.filename, 'WarpDriveMirror', finalizedConfig);
285
384
  }
286
385
 
287
- export { setConfig };
386
+ export { babelPlugin, setConfig };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@warp-drive-mirror/build-config",
3
- "version": "5.8.0-alpha.0",
4
- "description": "Provides Build Configuration for projects using WarpDrive or EmberData",
3
+ "version": "5.8.0-alpha.11",
4
+ "description": "Provides Build Configuration for projects using WarpDrive",
5
5
  "keywords": [
6
6
  "ember-data-mirror",
7
7
  "warp-drive"
8
8
  ],
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+ssh://git@github.com:emberjs/data.git",
11
+ "url": "git+ssh://git@github.com:warp-drive-data/warp-drive.git",
12
12
  "directory": "warp-drive-packages/build-config"
13
13
  },
14
14
  "license": "MIT",
@@ -36,13 +36,14 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
+ "babel-plugin-debug-macros": "^2.0.0",
39
40
  "@embroider/macros": "^1.18.1",
40
41
  "@embroider/addon-shim": "^1.10.0",
41
42
  "babel-import-util": "^2.1.1",
42
43
  "semver": "^7.7.2"
43
44
  },
44
45
  "devDependencies": {
45
- "@warp-drive/internal-config": "5.8.0-alpha.0",
46
+ "@warp-drive/internal-config": "5.8.0-alpha.11",
46
47
  "@types/babel__core": "^7.20.5",
47
48
  "@types/node": "^20.19.11",
48
49
  "@babel/plugin-transform-typescript": "^7.28.0",