@warp-drive-mirror/build-config 5.6.0-beta.0 → 5.6.0-beta.2

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.
Files changed (75) hide show
  1. package/declarations/-private/utils/deprecations.d.ts +5 -0
  2. package/declarations/-private/utils/features.d.ts +4 -0
  3. package/declarations/-private/utils/get-env.d.ts +8 -0
  4. package/declarations/-private/utils/logging.d.ts +9 -0
  5. package/declarations/babel-macros.d.ts +13 -0
  6. package/declarations/canary-features.d.ts +136 -0
  7. package/declarations/debugging.d.ts +172 -0
  8. package/declarations/deprecation-versions.d.ts +30 -0
  9. package/declarations/deprecations.d.ts +516 -0
  10. package/declarations/env.d.ts +129 -0
  11. package/declarations/index.d.ts +101 -0
  12. package/declarations/macros.d.ts +18 -0
  13. package/dist/addon-shim.cjs +0 -1
  14. package/dist/babel-macros.js +45 -13
  15. package/dist/babel-plugin-transform-asserts.cjs +5 -7
  16. package/dist/babel-plugin-transform-deprecations.cjs +2 -3
  17. package/dist/babel-plugin-transform-features.cjs +2 -3
  18. package/dist/babel-plugin-transform-logging.cjs +2 -3
  19. package/dist/canary-features-CuKgaVtX.js +146 -0
  20. package/dist/canary-features.js +1 -2
  21. package/dist/cjs-set-config.cjs +160 -609
  22. package/dist/{debugging-BtpYr1v0.js → debugging-VdsvkNjX.js} +79 -62
  23. package/dist/debugging.js +1 -2
  24. package/dist/deprecations-BNNGFAiG.js +548 -0
  25. package/dist/deprecations.js +1 -2
  26. package/dist/env.js +124 -1
  27. package/dist/index.js +20 -521
  28. package/dist/macros.js +18 -1
  29. package/package.json +7 -19
  30. package/dist/addon-shim.cjs.map +0 -1
  31. package/dist/babel-macros.js.map +0 -1
  32. package/dist/babel-plugin-transform-asserts.cjs.map +0 -1
  33. package/dist/babel-plugin-transform-deprecations.cjs.map +0 -1
  34. package/dist/babel-plugin-transform-features.cjs.map +0 -1
  35. package/dist/babel-plugin-transform-logging.cjs.map +0 -1
  36. package/dist/canary-features-D1wplYmb.js +0 -113
  37. package/dist/canary-features-D1wplYmb.js.map +0 -1
  38. package/dist/canary-features.js.map +0 -1
  39. package/dist/cjs-set-config.cjs.map +0 -1
  40. package/dist/debugging-BtpYr1v0.js.map +0 -1
  41. package/dist/debugging.js.map +0 -1
  42. package/dist/deprecations-D_dBAPC9.js +0 -34
  43. package/dist/deprecations-D_dBAPC9.js.map +0 -1
  44. package/dist/deprecations.js.map +0 -1
  45. package/dist/env.js.map +0 -1
  46. package/dist/index.js.map +0 -1
  47. package/dist/macros.js.map +0 -1
  48. package/unstable-preview-types/-private/utils/deprecations.d.ts +0 -12
  49. package/unstable-preview-types/-private/utils/deprecations.d.ts.map +0 -1
  50. package/unstable-preview-types/-private/utils/features.d.ts +0 -9
  51. package/unstable-preview-types/-private/utils/features.d.ts.map +0 -1
  52. package/unstable-preview-types/-private/utils/get-env.d.ts +0 -11
  53. package/unstable-preview-types/-private/utils/get-env.d.ts.map +0 -1
  54. package/unstable-preview-types/-private/utils/logging.d.ts +0 -14
  55. package/unstable-preview-types/-private/utils/logging.d.ts.map +0 -1
  56. package/unstable-preview-types/babel-macros.d.ts +0 -6
  57. package/unstable-preview-types/babel-macros.d.ts.map +0 -1
  58. package/unstable-preview-types/canary-features.d.ts +0 -105
  59. package/unstable-preview-types/canary-features.d.ts.map +0 -1
  60. package/unstable-preview-types/cjs-set-config.d.ts +0 -4
  61. package/unstable-preview-types/cjs-set-config.d.ts.map +0 -1
  62. package/unstable-preview-types/debugging.d.ts +0 -164
  63. package/unstable-preview-types/debugging.d.ts.map +0 -1
  64. package/unstable-preview-types/deprecation-versions.d.ts +0 -485
  65. package/unstable-preview-types/deprecation-versions.d.ts.map +0 -1
  66. package/unstable-preview-types/deprecations.d.ts +0 -16
  67. package/unstable-preview-types/deprecations.d.ts.map +0 -1
  68. package/unstable-preview-types/env.d.ts +0 -9
  69. package/unstable-preview-types/env.d.ts.map +0 -1
  70. package/unstable-preview-types/index.d.ts +0 -49
  71. package/unstable-preview-types/index.d.ts.map +0 -1
  72. package/unstable-preview-types/macros.d.ts +0 -5
  73. package/unstable-preview-types/macros.d.ts.map +0 -1
  74. package/unstable-preview-types/validate-exports.type-test.d.ts +0 -4
  75. package/unstable-preview-types/validate-exports.type-test.d.ts.map +0 -1
@@ -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,
@@ -32,9 +35,6 @@ function getEnv() {
32
35
  };
33
36
  }
34
37
 
35
- /**
36
- * @module @warp-drive-mirror/build-config
37
- */
38
38
  // ========================
39
39
  // FOR CONTRIBUTING AUTHORS
40
40
  //
@@ -52,496 +52,18 @@ function getEnv() {
52
52
  //
53
53
  // ========================
54
54
  //
55
-
56
- /**
57
- * ## Deprecation Management
58
- *
59
- * EmberData allows users to opt-in and remove code that exists to support deprecated
60
- * behaviors.
61
- *
62
- * If your app has resolved all deprecations present in a given version,
63
- * you may specify that version as your "compatibility" version to remove
64
- * the code that supported the deprecated behavior from your app.
65
- *
66
- * For instance, if a deprecation was introduced in 3.13, and the app specifies
67
- * 3.13 as its minimum version compatibility, any deprecations introduced before
68
- * or during 3.13 would be stripped away.
69
- *
70
- * An app can use a different version than what it specifies as it's compatibility
71
- * version. For instance, an App could be using `3.16` while specifying compatibility
72
- * with `3.12`. This would remove any deprecations that were present in or before `3.12`
73
- * but keep support for anything deprecated in or above `3.13`.
74
- *
75
- * You may also specify that specific deprecations are resolved. These approaches
76
- * may be used together.
77
- *
78
- * ```ts
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`
84
- * deprecations: {
85
- * // resolve individual deprecations here
86
- * },
87
- * });
88
- * ```
89
- *
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.
95
- *
96
- * @class CurrentDeprecations
97
- * @public
98
- */
99
55
  const DEPRECATE_CATCH_ALL = '99.0';
100
- /**
101
- * **id: ember-data:deprecate-non-strict-types**
102
- *
103
- * Currently, EmberData expects that the `type` property associated with
104
- * a resource follows several conventions.
105
- *
106
- * - The `type` property must be a non-empty string
107
- * - The `type` property must be singular
108
- * - The `type` property must be dasherized
109
- *
110
- * We are deprecating support for types that do not match this pattern
111
- * in order to unlock future improvements in which we can support `type`
112
- * being any string of your choosing.
113
- *
114
- * The goal is that in the future, you will be able to use any string
115
- * so long as it matches what your configured cache, identifier generation,
116
- * and schemas expect.
117
- *
118
- * E.G. It will matter not that your string is in a specific format like
119
- * singular, dasherized, etc. so long as everywhere you refer to the type
120
- * you use the same string.
121
- *
122
- * If using @ember-data-mirror/model, there will always be a restriction that the
123
- * `type` must match the path on disk where the model is defined.
124
- *
125
- * e.g. `app/models/foo/bar-bem.js` must have a type of `foo/bar-bem`
126
- *
127
- * @property DEPRECATE_NON_STRICT_TYPES
128
- * @type {Boolean}
129
- * @since 5.3
130
- * @until 6.0
131
- * @public
132
- */
133
56
  const DEPRECATE_NON_STRICT_TYPES = '5.3';
134
-
135
- /**
136
- * **id: ember-data:deprecate-non-strict-id**
137
- *
138
- * Currently, EmberData expects that the `id` property associated with
139
- * a resource is a string.
140
- *
141
- * However, for legacy support in many locations we would accept a number
142
- * which would then immediately be coerced into a string.
143
- *
144
- * We are deprecating this legacy support for numeric IDs.
145
- *
146
- * The goal is that in the future, you will be able to use any ID format
147
- * so long as everywhere you refer to the ID you use the same format.
148
- *
149
- * However, for identifiers we will always use string IDs and so any
150
- * custom identifier configuration should provide a string ID.
151
- *
152
- * @property DEPRECATE_NON_STRICT_ID
153
- * @type {Boolean}
154
- * @since 5.3
155
- * @until 6.0
156
- * @public
157
- */
158
57
  const DEPRECATE_NON_STRICT_ID = '5.3';
159
-
160
- /**
161
- * **id: <none yet assigned>**
162
- *
163
- * This is a planned deprecation which will trigger when observer or computed
164
- * chains are used to watch for changes on any EmberData LiveArray, CollectionRecordArray,
165
- * ManyArray or PromiseManyArray.
166
- *
167
- * Support for these chains is currently guarded by the deprecation flag
168
- * listed here, enabling removal of the behavior if desired.
169
- *
170
- * The instrumentation was added in 5.0 but the version number
171
- * is set to 7.0 as we do not want to strip support without
172
- * adding a deprecation message.
173
- *
174
- * Once we've added the deprecation message, we will
175
- * update this version number to the proper version.
176
- *
177
- * @property DEPRECATE_COMPUTED_CHAINS
178
- * @type {Boolean}
179
- * @since 5.0
180
- * @until 8.0
181
- * @public
182
- */
183
58
  const DEPRECATE_COMPUTED_CHAINS = '7.0';
184
-
185
- /**
186
- * **id: ember-data:deprecate-legacy-imports**
187
- *
188
- * Deprecates when importing from `ember-data/*` instead of `@ember-data/*`
189
- * in order to prepare for the eventual removal of the legacy `ember-data/*`
190
- *
191
- * All imports from `ember-data/*` should be updated to `@ember-data/*`
192
- * except for `ember-data/store`. When you are using `ember-data` (as opposed to
193
- * installing the indivudal packages) you should import from `ember-data/store`
194
- * instead of `@ember-data-mirror/store` in order to receive the appropriate configuration
195
- * of defaults.
196
- *
197
- * @property DEPRECATE_LEGACY_IMPORTS
198
- * @type {Boolean}
199
- * @since 5.3
200
- * @until 6.0
201
- * @public
202
- */
203
59
  const DEPRECATE_LEGACY_IMPORTS = '5.3';
204
-
205
- /**
206
- * **id: ember-data:deprecate-non-unique-collection-payloads**
207
- *
208
- * Deprecates when the data for a hasMany relationship contains
209
- * duplicate identifiers.
210
- *
211
- * Previously, relationships would silently de-dupe the data
212
- * when received, but this behavior is being removed in favor
213
- * of erroring if the same related record is included multiple
214
- * times.
215
- *
216
- * For instance, in JSON:API the below relationship data would
217
- * be considered invalid:
218
- *
219
- * ```json
220
- * {
221
- * "data": {
222
- * "type": "article",
223
- * "id": "1",
224
- * "relationships": {
225
- * "comments": {
226
- * "data": [
227
- * { "type": "comment", "id": "1" },
228
- * { "type": "comment", "id": "2" },
229
- * { "type": "comment", "id": "1" } // duplicate
230
- * ]
231
- * }
232
- * }
233
- * }
234
- * ```
235
- *
236
- * To resolve this deprecation, either update your server to
237
- * not include duplicate data, or implement normalization logic
238
- * in either a request handler or serializer which removes
239
- * duplicate data from relationship payloads.
240
- *
241
- * @property DEPRECATE_NON_UNIQUE_PAYLOADS
242
- * @type {Boolean}
243
- * @since 5.3
244
- * @until 6.0
245
- * @public
246
- */
247
60
  const DEPRECATE_NON_UNIQUE_PAYLOADS = '5.3';
248
-
249
- /**
250
- * **id: ember-data:deprecate-relationship-remote-update-clearing-local-state**
251
- *
252
- * Deprecates when a relationship is updated remotely and the local state
253
- * is cleared of all changes except for "new" records.
254
- *
255
- * Instead, any records not present in the new payload will be considered
256
- * "removed" while any records present in the new payload will be considered "added".
257
- *
258
- * This allows us to "commit" local additions and removals, preserving any additions
259
- * or removals that are not yet reflected in the remote state.
260
- *
261
- * For instance, given the following initial state:
262
- *
263
- * remote: A, B, C
264
- * local: add D, E
265
- * remove B, C
266
- * => A, D, E
267
- *
268
- *
269
- * If after an update, the remote state is now A, B, D, F then the new state will be
270
- *
271
- * remote: A, B, D, F
272
- * local: add E
273
- * remove B
274
- * => A, D, E, F
275
- *
276
- * Under the old behavior the updated local state would instead have been
277
- * => A, B, D, F
278
- *
279
- * Similarly, if a belongsTo remote State was A while its local state was B,
280
- * then under the old behavior if the remote state changed to C, the local state
281
- * would be updated to C. Under the new behavior, the local state would remain B.
282
- *
283
- * If the remote state was A while its local state was `null`, then under the old
284
- * behavior if the remote state changed to C, the local state would be updated to C.
285
- * Under the new behavior, the local state would remain `null`.
286
- *
287
- * Thus the new correct mental model is that the state of the relationship at any point
288
- * in time is whatever the most recent remote state is, plus any local additions or removals
289
- * you have made that have not yet been reflected by the remote state.
290
- *
291
- * > Note: The old behavior extended to modifying the inverse of a relationship. So if
292
- * > you had local state not reflected in the new remote state, inverses would be notified
293
- * > and their state reverted as well when "resetting" the relationship.
294
- * > Under the new behavior, since the local state is preserved the inverses will also
295
- * > not be reverted.
296
- *
297
- * ### Resolving this deprecation
298
- *
299
- * Resolving this deprecation can be done individually for each relationship
300
- * or globally for all relationships.
301
- *
302
- * To resolve it globally, set the `DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE`
303
- * to `false` in ember-cli-build.js
304
- *
305
- * ```js
306
- * const { setConfig } = await import('@warp-drive-mirror/build-config');
307
- *
308
- * let app = new EmberApp(defaults, {});
309
- *
310
- * setConfig(app, __dirname, {
311
- * deprecations: {
312
- * // set to false to strip the deprecated code (thereby opting into the new behavior)
313
- * DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE: false
314
- * }
315
- * });
316
- * ```
317
- *
318
- * To resolve this deprecation on an individual relationship, adjust the `options` passed to
319
- * the relationship. For relationships with inverses, both sides MUST be migrated to the new
320
- * behavior at the same time.
321
- *
322
- * ```js
323
- * class Person extends Model {
324
- * @hasMany('person', {
325
- * async: false,
326
- * inverse: null,
327
- * resetOnRemoteUpdate: false
328
- * }) children;
329
- *
330
- * @belongsTo('person', {
331
- * async: false,
332
- * inverse: null,
333
- * resetOnRemoteUpdate: false
334
- * }) parent;
335
- * }
336
- * ```
337
- *
338
- * > Note: false is the only valid value here, all other values (including missing)
339
- * > will be treated as true, where `true` is the legacy behavior that is now deprecated.
340
- *
341
- * Once you have migrated all relationships, you can remove the the resetOnRemoteUpdate
342
- * option and set the deprecation flag to false in ember-cli-build.
343
- *
344
- * ### What if I don't want the new behavior?
345
- *
346
- * EmberData's philosophy is to not make assumptions about your application. Where possible
347
- * we seek out "100%" solutions – solutions that work for all use cases - and where that is
348
- * not possible we default to "90%" solutions – solutions that work for the vast majority of use
349
- * cases. In the case of "90%" solutions we look for primitives that allow you to resolve the
350
- * 10% case in your application. If no such primitives exist, we provide an escape hatch that
351
- * ensures you can build the behavior you need without adopting the cost of the default solution.
352
- *
353
- * In this case, the old behavior was a "40%" solution. The inability for an application developer
354
- * to determine what changes were made locally, and thus what changes should be preserved, made
355
- * it impossible to build certain features easily, or in some cases at all. The proliferation of
356
- * feature requests, bug reports (from folks surprised by the prior behavior) and addon attempts
357
- * in this space are all evidence of this.
358
- *
359
- * We believe the new behavior is a "90%" solution. It works for the vast majority of use cases,
360
- * often without noticeable changes to existing application behavior, and provides primitives that
361
- * allow you to build the behavior you need for the remaining 10%.
362
- *
363
- * The great news is that this behavior defaults to trusting your API similar to the old behavior.
364
- * If your API is correct, you will not need to make any changes to your application to adopt
365
- * the new behavior.
366
- *
367
- * This means the 10% cases are those where you can't trust your API to provide the correct
368
- * information. In these cases, because you now have cheap access to a diff of the relationship
369
- * state, there are a few options that weren't available before:
370
- *
371
- * - you can adjust returned API payloads to contain the expected changes that it doesn't include
372
- * - you can modify local state by adding or removing records on the HasMany record array to remove
373
- * any local changes that were not returned by the API.
374
- * - you can use `<Cache>.mutate(mutation)` to directly modify the local cache state of the relationship
375
- * to match the expected state.
376
- *
377
- * What this version (5.3) does not yet provide is a way to directly modify the cache's remote state
378
- * for the relationship via public APIs other than via the broader action of upserting a response via
379
- * `<Cache>.put(document)`. However, such an API was sketched in the Cache 2.1 RFC
380
- * `<Cache>.patch(operation)` and is likely to be added in a future 5.x release of EmberData.
381
- *
382
- * This version (5.3) also does not yet provide a way to directly modify the graph (a general purpose
383
- * subset of cache behaviors specific to relationships) via public APIs. However, during the
384
- * 5.x release series we will be working on finalizing the Graph API and making it public.
385
- *
386
- * If none of these options work for you, you can always opt-out more broadly by implementing
387
- * a custom Cache with the relationship behaviors you need.
388
- *
389
- * @property DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE
390
- * @type {Boolean}
391
- * @since 5.3
392
- * @until 6.0
393
- * @public
394
- */
395
61
  const DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE = '5.3';
396
-
397
- /**
398
- * **id: ember-data:deprecate-many-array-duplicates**
399
- *
400
- * When the flag is `true` (default), adding duplicate records to a `ManyArray`
401
- * is deprecated in non-production environments. In production environments,
402
- * duplicate records added to a `ManyArray` will be deduped and no error will
403
- * be thrown.
404
- *
405
- * When the flag is `false`, an error will be thrown when duplicates are added.
406
- *
407
- * @property DEPRECATE_MANY_ARRAY_DUPLICATES
408
- * @type {Boolean}
409
- * @since 5.3
410
- * @until 6.0
411
- * @public
412
- */
413
62
  const DEPRECATE_MANY_ARRAY_DUPLICATES = '5.3';
414
-
415
- /**
416
- * **id: ember-data:deprecate-store-extends-ember-object**
417
- *
418
- * When the flag is `true` (default), the Store class will extend from `@ember/object`.
419
- * When the flag is `false` or `ember-source` is not present, the Store will not extend
420
- * from EmberObject.
421
- *
422
- * @property DEPRECATE_STORE_EXTENDS_EMBER_OBJECT
423
- * @type {Boolean}
424
- * @since 5.4
425
- * @until 6.0
426
- * @public
427
- */
428
63
  const DEPRECATE_STORE_EXTENDS_EMBER_OBJECT = '5.4';
429
-
430
- /**
431
- * **id: ember-data:schema-service-updates**
432
- *
433
- * When the flag is `true` (default), the legacy schema
434
- * service features will be enabled on the store and
435
- * the service, and deprecations will be thrown when
436
- * they are used.
437
- *
438
- * Deprecated features include:
439
- *
440
- * - `Store.registerSchema` method is deprecated in favor of the `Store.createSchemaService` hook
441
- * - `Store.registerSchemaDefinitionService` method is deprecated in favor of the `Store.createSchemaService` hook
442
- * - `Store.getSchemaDefinitionService` method is deprecated in favor of `Store.schema` property
443
- * - `SchemaService.doesTypeExist` method is deprecated in favor of the `SchemaService.hasResource` method
444
- * - `SchemaService.attributesDefinitionFor` method is deprecated in favor of the `SchemaService.fields` method
445
- * - `SchemaService.relationshipsDefinitionFor` method is deprecated in favor of the `SchemaService.fields` method
446
- *
447
- * @property ENABLE_LEGACY_SCHEMA_SERVICE
448
- * @type {Boolean}
449
- * @since 5.4
450
- * @until 6.0
451
- * @public
452
- */
453
64
  const ENABLE_LEGACY_SCHEMA_SERVICE = '5.4';
454
-
455
- /**
456
- * **id: warp-drive.ember-inflector**
457
- *
458
- * Deprecates the use of ember-inflector for pluralization and singularization in favor
459
- * of the `@ember-data-mirror/request-utils` package.
460
- *
461
- * Rule configuration methods (singular, plural, uncountable, irregular) and
462
- * usage methods (singularize, pluralize) are are available as imports from
463
- * `@ember-data-mirror/request-utils/string`
464
- *
465
- * Notable differences with ember-inflector:
466
- * - there cannot be multiple inflector instances with separate rules
467
- * - pluralization does not support a count argument
468
- * - string caches now default to 10k entries instead of 1k, and this
469
- * size is now configurable. Additionally, the cache is now a LRU cache
470
- * instead of a first-N cache.
471
- *
472
- * This deprecation can be resolved by removing usage of ember-inflector or by using
473
- * both ember-inflector and @ember-data-mirror/request-utils in parallel and updating your
474
- * EmberData/WarpDrive build config to mark the deprecation as resolved
475
- * in ember-cli-build
476
- *
477
- * ```js
478
- * setConfig(app, __dirname, { deprecations: { DEPRECATE_EMBER_INFLECTOR: false }});
479
- * ```
480
- *
481
- * @property DEPRECATE_EMBER_INFLECTOR
482
- * @type {Boolean}
483
- * @since 5.3
484
- * @until 6.0
485
- * @public
486
- */
487
65
  const DEPRECATE_EMBER_INFLECTOR = '5.3';
488
-
489
- /**
490
- * This is a special flag that can be used to opt-in early to receiving deprecations introduced in 6.x
491
- * which have had their infra backported to 5.x versions of EmberData.
492
- *
493
- * When this flag is not present or set to `true`, the deprecations from the 6.x branch
494
- * will not print their messages and the deprecation cannot be resolved.
495
- *
496
- * When this flag is present and set to `false`, the deprecations from the 6.x branch will
497
- * print and can be resolved.
498
- *
499
- * @property DISABLE_7X_DEPRECATIONS
500
- * @type {Boolean}
501
- * @since 5.3
502
- * @until 7.0
503
- * @public
504
- */
505
66
  const DISABLE_7X_DEPRECATIONS = '7.0';
506
-
507
- /**
508
- * **id: warp-drive:deprecate-tracking-package**
509
- *
510
- * Deprecates the use of the @ember-data-mirror/tracking package which
511
- * historically provided bindings into Ember's reactivity system.
512
- *
513
- * This package is no longer needed as the configuration is now
514
- * provided by the @warp-drive-mirror/ember package.
515
- *
516
- * This deprecation can be resolved by removing the
517
- * @ember-data-mirror/tracking package from your project and ensuring
518
- * that your app.js file has the following import:
519
- *
520
- * ```js
521
- * import '@warp-drive-mirror/ember/install';
522
- * ```
523
- *
524
- * Once this import is present, you can remove the deprecation
525
- * by setting the deprecation to `false` in your build config:
526
- *
527
- * ```js
528
- * // inside of ember-cli-build.js
529
- *
530
- * const { setConfig } = await import('@warp-drive-mirror/build-config');
531
- *
532
- * setConfig(app, __dirname, {
533
- * deprecations: {
534
- * DEPRECATE_TRACKING_PACKAGE: false
535
- * }
536
- * });
537
- * ```
538
- *
539
- * @property DEPRECATE_TRACKING_PACKAGE
540
- * @type {Boolean}
541
- * @since 5.5
542
- * @until 6.0
543
- * @public
544
- */
545
67
  const DEPRECATE_TRACKING_PACKAGE = '5.5';
546
68
 
547
69
  const CURRENT_DEPRECATIONS = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
@@ -605,82 +127,112 @@ function getDeprecations(compatVersion, deprecations) {
605
127
 
606
128
  /**
607
129
  *
608
- * @module @warp-drive-mirror/build-config
609
- */
610
-
611
- /**
612
- *
613
- * ## Canary Features
130
+ * # Canary Features <Badge type="warning" text="requires canary" />
614
131
  *
615
- * EmberData allows users to test features that are implemented but not yet
616
- * available even in canary.
132
+ * ***Warp*Drive** allows users to test upcoming features that are implemented
133
+ * but not yet activated in canary builds.
617
134
  *
618
- * Typically these features represent work that might introduce a new concept,
619
- * new API, change an API, or risk an unintended change in behavior to consuming
620
- * applications.
135
+ * Typically these features represent work that carries higher risk of breaking
136
+ * changes, or are not yet fully ready for production use.
621
137
  *
622
138
  * Such features have their implementations guarded by a "feature flag", and the
623
139
  * flag is only activated once the core-data team is prepared to ship the work
624
- * in a canary release.
140
+ * in a canary release, beginning the process of it landing in a stable release.
625
141
  *
626
142
  * ### Installing Canary
627
143
  *
628
- * To test a feature you MUST be using a canary build. Canary builds are published
629
- * to `npm` and can be installed using a precise tag (such as `ember-data@3.16.0-alpha.1`)
630
- * or by installing the latest dist-tag published to the `canary` channel using your javascript
631
- * package manager of choice. For instance with [pnpm](https://pnpm.io/)
632
-
633
- ```cli
634
- pnpm add ember-data@canary
635
- ```
144
+ * ::: warning To test a feature guarded behind a flag, you MUST be using a canary build.
145
+ * :::
636
146
  *
637
- * ### Activating a Canary Feature
147
+ * Canary builds are published to `npm` and can be installed using a precise tag
148
+ * (such as `@warp-drive-mirror/core@5.6.0-alpha.1`) or by installing the latest dist-tag
149
+ * published to the `canary` channel.
638
150
  *
639
- * Once you have installed canary, feature-flags can be activated at build-time
151
+ * Because ***Warp*Drive** packages operate on a strict lockstep policy with each other,
152
+ * you must install the matching canary version of all ***Warp*Drive** packages.
640
153
  *
641
- * by setting an environment variable:
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.
642
156
  *
643
- * ```cli
644
- * # Activate a single flag
645
- * WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG ember build
157
+ * Add/remove packages from this list to match your project.
646
158
  *
647
- * # Activate multiple flags by separating with commas
648
- * WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG,OTHER_FLAG ember build
159
+ * ::: code-group
649
160
  *
650
- * # Activate all flags
651
- * WARP_DRIVE_FEATURE_OVERRIDE=ENABLE_ALL_OPTIONAL ember build
161
+ * ```sh [pnpm]
162
+ * pnpm add -E @warp-drive-mirror/core@canary \
163
+ * @warp-drive-mirror/json-api@canary \
164
+ * @warp-drive-mirror/ember@canary;
165
+ * ```
166
+ *
167
+ * ```sh [npm]
168
+ * npm add -E @warp-drive-mirror/core@canary \
169
+ * @warp-drive-mirror/json-api@canary \
170
+ * @warp-drive-mirror/ember@canary;
652
171
  * ```
653
172
  *
654
- * or by setting the appropriate flag in your `ember-cli-build` file:
173
+ * ```sh [yarn]
174
+ * yarn add -E @warp-drive-mirror/core@canary \
175
+ * @warp-drive-mirror/json-api@canary \
176
+ * @warp-drive-mirror/ember@canary;
177
+ * ```
178
+ *
179
+ * ```sh [bun]
180
+ * bun add --exact @warp-drive-mirror/core@canary \
181
+ * @warp-drive-mirror/json-api@canary \
182
+ * @warp-drive-mirror/ember@canary;
183
+ * ```
184
+ *
185
+ * :::
186
+ *
187
+ * ### Activating a Feature
188
+ *
189
+ * Once you have installed canary, feature-flags can be activated at build-time
655
190
  *
656
191
  * ```ts
657
192
  * setConfig(app, __dirname, {
658
193
  * features: {
659
- * SAMPLE_FEATURE_FLAG: false // utliize existing behavior, strip code for the new feature
660
- * OTHER_FEATURE_FLAG: true // utilize this new feature, strip code for the older behavior
194
+ * FEATURE_A: false, // utilize existing behavior
195
+ * FEATURE_B: true // utilize the new behavior
661
196
  * }
662
197
  * })
663
198
  * ```
664
199
  *
665
- * **The "off" branch of feature-flagged code is always stripped from production builds.**
200
+ * by setting an environment variable:
666
201
  *
667
- * 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")
202
+ * ```sh
203
+ * # Activate a single flag
204
+ * export WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG;
205
+ *
206
+ * # Activate multiple flags by separating with commas
207
+ * export WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG,OTHER_FLAG;
208
+ *
209
+ * # Activate all flags
210
+ * export WARP_DRIVE_FEATURE_OVERRIDE=ENABLE_ALL_OPTIONAL;
211
+ * ```
212
+ *
213
+ * ::: warning To test a feature guarded behind a flag, you MUST be running a development build.
214
+ * :::
668
215
  *
669
216
  *
670
217
  * ### Preparing a Project to use a Canary Feature
671
218
  *
672
- * For most projects, simple version detection should be enough.
219
+ * For most projects and features, simple version detection should be enough.
220
+ *
673
221
  * Using the provided version compatibility helpers from [embroider-macros](https://github.com/embroider-build/embroider/tree/main/packages/macros#readme)
674
222
  * the following can be done:
675
223
  *
676
224
  * ```js
677
- * if (macroCondition(dependencySatisfies('@ember-data-mirror/store', '5.0'))) {
225
+ * if (macroCondition(dependencySatisfies('@warp-drive-mirror/core', '5.6'))) {
678
226
  * // do thing
679
227
  * }
680
228
  * ```
681
229
  *
230
+ * For more complex projects and migrations, configure [@warp-drive-mirror/build-config/babel-macros](./babel-macros)
231
+ *
682
232
  * The current list of features used at build time for canary releases is defined below.
683
- * If empty there are no features currently gated by feature flags.
233
+ *
234
+ * ::: tip 💡 If empty there are no features currently gated by feature flags.
235
+ * :::
684
236
  *
685
237
  * The valid values are:
686
238
  *
@@ -688,9 +240,15 @@ function getDeprecations(compatVersion, deprecations) {
688
240
  * - `false` | The feature is **disabled** at all times, and cannot be enabled.
689
241
  * - `null` | The feature is **disabled by default**, but can be enabled via configuration.
690
242
  *
691
- * @class CanaryFeatures
243
+ * @module
692
244
  * @public
693
- */
245
+ */
246
+
247
+ /**
248
+ * We use this for some tests etc.
249
+ *
250
+ * @internal
251
+ */
694
252
  const SAMPLE_FEATURE_FLAG = null;
695
253
 
696
254
  /**
@@ -701,8 +259,6 @@ const SAMPLE_FEATURE_FLAG = null;
701
259
  * `cache.put`, the cache will validate the payload against registered
702
260
  * schemas as well as the JSON:API spec.
703
261
  *
704
- * @property JSON_API_CACHE_VALIDATION_ERRORS
705
- * @type {Boolean|null}
706
262
  * @since 5.4
707
263
  * @public
708
264
  */
@@ -770,10 +326,7 @@ function getFeatures(isProd) {
770
326
  }
771
327
 
772
328
  /**
773
- @module @warp-drive-mirror/build-config
774
- */
775
- /**
776
- * ## Debug Logging
329
+ * # Log Instrumentation <Badge type="tip" text="debug only" />
777
330
  *
778
331
  * Many portions of the internals are helpfully instrumented with logging.
779
332
  * This instrumentation is always removed from production builds.
@@ -785,19 +338,11 @@ function getFeatures(isProd) {
785
338
  * either in your build config or via the runtime helper.
786
339
  *
787
340
  *
788
- * ### Activation Via Runtime Helper
789
- *
790
- * A runtime helper is attached to `globalThis` to enable activation of the logs
791
- * from anywhere in your application including from the devtools panel.
792
- *
793
- * The runtime helper overrides any build config settings for the given flag
794
- * for the current browser tab. It stores the configuration you give it in
795
- * `sessionStorage` so that it persists across page reloads of the current tab,
796
- * but not across browser tabs or windows. Thus if you need to deactivate the
797
- * logging, you can call the helper again with the same flag set to `false` or
798
- * just open a new tab/window.
341
+ * ## Runtime Activation
799
342
  *
800
- * Example Usage:
343
+ * ::: tip 💡 Just Works in browser Dev Tools!
344
+ * No import is needed, and the logging config is preserved when the page is refreshed
345
+ * :::
801
346
  *
802
347
  * ```ts
803
348
  * setWarpDriveLogging({
@@ -806,26 +351,34 @@ function getFeatures(isProd) {
806
351
  * })
807
352
  * ```
808
353
  *
809
- * ### Activation Via Build Config
354
+ * A runtime helper is attached to `globalThis` to enable activation of the logs
355
+ * from anywhere in your application including from the devtools panel.
356
+ *
357
+ * The runtime helper overrides any build config settings for the given flag
358
+ * for the current browser tab. It stores the configuration you give it in
359
+ * `sessionStorage` so that it persists across page reloads of the current tab,
360
+ * but not across browser tabs or windows.
361
+ *
362
+ * If you need to deactivate the logging, you can call the helper again with the
363
+ * same flag set to `false` or just open a new tab/window.
364
+ *
365
+ * ## Buildtime Activation
810
366
  *
811
367
  * ```ts
812
368
  * setConfig(__dirname, app, {
813
369
  * debug: {
814
- * LOG_CACHE: false, // data store received to update cache with
815
- * LOG_NOTIFICATIONS: false,
370
+ * LOG_CACHE: true,
816
371
  * LOG_REQUESTS: false,
817
- * LOG_REQUEST_STATUS: false,
818
- * LOG_IDENTIFIERS: false,
819
- * LOG_GRAPH: false,
820
- * LOG_INSTANCE_CACHE: false,
821
- * LOG_METRIC_COUNTS: false,
822
- * DEBUG_RELATIONSHIP_NOTIFICATIONS: false,
372
+ * LOG_NOTIFICATIONS: true,
823
373
  * }
824
374
  * });
825
375
  * ```
826
376
  *
827
- * @class DebugLogging
828
- * @public
377
+ * The build config settings are used to set the default values for the
378
+ * logging flags. Any logging flag that is not set in the build config
379
+ * will default to `false`.
380
+ *
381
+ * @module
829
382
  */
830
383
  /**
831
384
  * log cache updates for both local
@@ -836,16 +389,50 @@ function getFeatures(isProd) {
836
389
  *
837
390
  * The others were `LOG_OPERATIONS` and `LOG_MUTATIONS`.
838
391
  *
839
- * @property LOG_CACHE
840
- * @type {Boolean}
841
392
  * @public
393
+ * @since 5.5
842
394
  */
843
395
  const LOG_CACHE = false;
396
+
397
+ /**
398
+ * <Badge type="danger" text="removed" />
399
+ *
400
+ * This flag no longer has any effect.
401
+ *
402
+ * Use {@link LOG_CACHE} instead.
403
+ *
404
+ * @deprecated removed in version 5.5
405
+ * @public
406
+ */
407
+ const LOG_PAYLOADS = false;
408
+
409
+ /**
410
+ * <Badge type="danger" text="removed" />
411
+ *
412
+ * This flag no longer has any effect.
413
+ *
414
+ * Use {@link LOG_CACHE} instead.
415
+ *
416
+ * @deprecated removed in version 5.5
417
+ * @public
418
+ */
419
+ const LOG_OPERATIONS = false;
420
+
421
+ /**
422
+ * <Badge type="danger" text="removed" />
423
+ *
424
+ * This flag no longer has any effect.
425
+ *
426
+ * Use {@link LOG_CACHE} instead.
427
+ *
428
+ * @deprecated removed in version 5.5
429
+ * @public
430
+ */
431
+ const LOG_MUTATIONS = false;
432
+
844
433
  /**
845
434
  * Log decisions made by the Basic CachePolicy
846
435
  *
847
- * @property LOG_CACHE_POLICY
848
- * @type {Boolean}
849
436
  * @public
850
437
  */
851
438
  const LOG_CACHE_POLICY = false;
@@ -853,16 +440,12 @@ const LOG_CACHE_POLICY = false;
853
440
  /**
854
441
  * log notifications received by the NotificationManager
855
442
  *
856
- * @property LOG_NOTIFICATIONS
857
- * @type {Boolean}
858
443
  * @public
859
444
  */
860
445
  const LOG_NOTIFICATIONS = false;
861
446
  /**
862
447
  * log requests issued by the RequestManager
863
448
  *
864
- * @property LOG_REQUESTS
865
- * @type {Boolean}
866
449
  * @public
867
450
  */
868
451
  const LOG_REQUESTS = false;
@@ -870,8 +453,6 @@ const LOG_REQUESTS = false;
870
453
  * log updates to requests the store has issued to
871
454
  * the network (adapter) to fulfill.
872
455
  *
873
- * @property LOG_REQUEST_STATUS
874
- * @type {Boolean}
875
456
  * @public
876
457
  */
877
458
  const LOG_REQUEST_STATUS = false;
@@ -879,8 +460,6 @@ const LOG_REQUEST_STATUS = false;
879
460
  * log peek, generation and updates to
880
461
  * Record Identifiers.
881
462
  *
882
- * @property LOG_IDENTIFIERS
883
- * @type {Boolean}
884
463
 
885
464
  * @public
886
465
  */
@@ -888,8 +467,6 @@ const LOG_IDENTIFIERS = false;
888
467
  /**
889
468
  * log updates received by the graph (relationship pointer storage)
890
469
  *
891
- * @property LOG_GRAPH
892
- * @type {Boolean}
893
470
  * @public
894
471
  */
895
472
  const LOG_GRAPH = false;
@@ -897,8 +474,6 @@ const LOG_GRAPH = false;
897
474
  * log creation/removal of RecordData and Record
898
475
  * instances.
899
476
  *
900
- * @property LOG_INSTANCE_CACHE
901
- * @type {Boolean}
902
477
  * @public
903
478
  */
904
479
  const LOG_INSTANCE_CACHE = false;
@@ -906,8 +481,6 @@ const LOG_INSTANCE_CACHE = false;
906
481
  * Log key count metrics, useful for performance
907
482
  * debugging.
908
483
  *
909
- * @property LOG_METRIC_COUNTS
910
- * @type {Boolean}
911
484
  * @public
912
485
  */
913
486
  const LOG_METRIC_COUNTS = false;
@@ -915,8 +488,6 @@ const LOG_METRIC_COUNTS = false;
915
488
  * Helps when debugging causes of a change notification
916
489
  * when processing an update to a hasMany relationship.
917
490
  *
918
- * @property DEBUG_RELATIONSHIP_NOTIFICATIONS
919
- * @type {Boolean}
920
491
  * @public
921
492
  */
922
493
  const DEBUG_RELATIONSHIP_NOTIFICATIONS = false;
@@ -929,7 +500,7 @@ const DEBUG_RELATIONSHIP_NOTIFICATIONS = false;
929
500
  *
930
501
  * LOG_METRIC_COUNTS must also be enabled.
931
502
  *
932
- * @typedoc
503
+ * @internal
933
504
  */
934
505
  const __INTERNAL_LOG_NATIVE_MAP_SET_COUNTS = false;
935
506
 
@@ -942,7 +513,10 @@ const LOGGING = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
942
513
  LOG_IDENTIFIERS,
943
514
  LOG_INSTANCE_CACHE,
944
515
  LOG_METRIC_COUNTS,
516
+ LOG_MUTATIONS,
945
517
  LOG_NOTIFICATIONS,
518
+ LOG_OPERATIONS,
519
+ LOG_PAYLOADS,
946
520
  LOG_REQUESTS,
947
521
  LOG_REQUEST_STATUS,
948
522
  __INTERNAL_LOG_NATIVE_MAP_SET_COUNTS
@@ -967,17 +541,17 @@ function createLoggingConfig(env, debug) {
967
541
  *
968
542
  * This configuration is done using `setConfig` in `ember-cli-build`.
969
543
  *
970
- * ```ts
544
+ * ```ts [ember-cli-build.js]
971
545
  * 'use strict';
972
546
  *
973
547
  * const EmberApp = require('ember-cli/lib/broccoli/ember-app');
974
548
  *
975
549
  * module.exports = async function (defaults) {
976
- * const { setConfig } = await import('@warp-drive-mirror/build-config');
550
+ * const { setConfig } = await import('@warp-drive-mirror/build-config'); // [!code focus]
977
551
  *
978
552
  * const app = new EmberApp(defaults, {});
979
553
  *
980
- * setConfig(app, __dirname, {
554
+ * setConfig(app, __dirname, { // [!code focus:3]
981
555
  * // settings here
982
556
  * });
983
557
  *
@@ -989,38 +563,16 @@ function createLoggingConfig(env, debug) {
989
563
  *
990
564
  * Available settings include:
991
565
  *
992
- * - [Debug Logging](../classes/DebugLogging)
993
- * - [Deprecated Code Removal](../classes/CurrentDeprecations)
994
- * - [Canary Feature Activation](../classes/CanaryFeatures)
995
- *
996
- * As well as:
997
- *
998
- * ### polyfillUUID
566
+ * - {@link LOGGING | debugging}
567
+ * - {@link DEPRECATIONS | deprecations}
568
+ * - {@link FEATURES | features}
569
+ * - {@link WarpDriveConfig.polyfillUUID | polyfillUUID}
570
+ * - {@link WarpDriveConfig.includeDataAdapterInProduction | includeDataAdapterInProduction}
571
+ * - {@link WarpDriveConfig.compatWith | compatWith}
999
572
  *
1000
- * If you are using the library in an environment that does not support `window.crypto.randomUUID`
1001
- * you can enable a polyfill for it.
1002
573
  *
1003
- * ```ts
1004
- * setConfig(app, __dirname, {
1005
- * polyfillUUID: true
1006
- * });
1007
- * ```
1008
- *
1009
- * ### includeDataAdapterInProduction
1010
- *
1011
- * By default, the integration required to support the ember inspector browser extension
1012
- * is included in production builds only when using the `ember-data` package. Otherwise
1013
- * the default is to exclude it. This setting allows to explicitly enable/disable it in
1014
- * production builds.
1015
- *
1016
- * ```ts
1017
- * setConfig(app, __dirname, {
1018
- * includeDataAdapterInProduction: true
1019
- * });
1020
- * ```
1021
574
  *
1022
- * @module @warp-drive-mirror/build-config
1023
- * @main @warp-drive-mirror/build-config
575
+ * @module
1024
576
  */
1025
577
  const _MacrosConfig = EmbroiderMacros.MacrosConfig;
1026
578
  function recastMacrosConfig(macros) {
@@ -1055,7 +607,7 @@ function setConfig(context, appRootOrConfig, config) {
1055
607
  // }
1056
608
 
1057
609
  const debugOptions = Object.assign({}, LOGGING, userConfig.debug);
1058
- const env = getEnv();
610
+ const env = getEnv(userConfig.forceMode);
1059
611
  const DEPRECATIONS = getDeprecations(userConfig.compatWith || null, userConfig.deprecations);
1060
612
  const FEATURES = getFeatures(env.PRODUCTION);
1061
613
  const includeDataAdapterInProduction = typeof userConfig.includeDataAdapterInProduction === 'boolean' ? userConfig.includeDataAdapterInProduction : true;
@@ -1074,4 +626,3 @@ function setConfig(context, appRootOrConfig, config) {
1074
626
  }
1075
627
 
1076
628
  exports.setConfig = setConfig;
1077
- //# sourceMappingURL=cjs-set-config.cjs.map