@warp-drive/build-config 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +19 -5
- package/README.md +2 -2
- package/dist/addon-shim.cjs +7 -24
- package/dist/addon-shim.cjs.map +1 -1
- package/dist/babel-macros.js +3 -2
- package/dist/babel-macros.js.map +1 -1
- package/dist/babel-plugin-transform-asserts.cjs.map +1 -1
- package/dist/babel-plugin-transform-deprecations.cjs.map +1 -1
- package/dist/babel-plugin-transform-features.cjs +1 -5
- package/dist/babel-plugin-transform-features.cjs.map +1 -1
- package/dist/babel-plugin-transform-logging.cjs +46 -3
- package/dist/babel-plugin-transform-logging.cjs.map +1 -1
- package/dist/{canary-features-BzGSGY5j.js → canary-features-CFdRGi2p.js} +41 -26
- package/dist/canary-features-CFdRGi2p.js.map +1 -0
- package/dist/canary-features.js +1 -1
- package/dist/cjs-set-config.cjs +200 -133
- package/dist/cjs-set-config.cjs.map +1 -1
- package/dist/debugging-Dc--S1MJ.js +128 -0
- package/dist/debugging-Dc--S1MJ.js.map +1 -0
- package/dist/debugging.js +1 -1
- package/dist/deprecations-ChFQtx-4.js.map +1 -1
- package/dist/env.js.map +1 -1
- package/dist/index.js +105 -60
- package/dist/index.js.map +1 -1
- package/dist/macros.js.map +1 -1
- package/logos/NCC-1701-a-gold.svg +4 -0
- package/logos/NCC-1701-a-gold_100.svg +1 -0
- package/logos/NCC-1701-a-gold_base-64.txt +1 -0
- package/logos/README.md +4 -0
- package/logos/docs-badge.svg +2 -0
- package/logos/ember-data-logo-dark.svg +12 -0
- package/logos/ember-data-logo-light.svg +12 -0
- package/logos/github-header.svg +444 -0
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +4 -0
- package/logos/warp-drive-logo-gold.svg +4 -0
- package/package.json +17 -18
- package/unstable-preview-types/-private/utils/get-env.d.ts.map +1 -1
- package/unstable-preview-types/-private/utils/logging.d.ts +14 -0
- package/unstable-preview-types/-private/utils/logging.d.ts.map +1 -0
- package/unstable-preview-types/babel-macros.d.ts +3 -24
- package/unstable-preview-types/babel-macros.d.ts.map +1 -1
- package/unstable-preview-types/canary-features.d.ts +36 -24
- package/unstable-preview-types/canary-features.d.ts.map +1 -1
- package/unstable-preview-types/debugging.d.ts +51 -47
- package/unstable-preview-types/debugging.d.ts.map +1 -1
- package/unstable-preview-types/deprecation-versions.d.ts +18 -42
- package/unstable-preview-types/deprecation-versions.d.ts.map +1 -1
- package/unstable-preview-types/index.d.ts +10 -5
- package/unstable-preview-types/index.d.ts.map +1 -1
- package/dist/canary-features-BzGSGY5j.js.map +0 -1
- package/dist/debugging-BzogyWJo.js +0 -121
- package/dist/debugging-BzogyWJo.js.map +0 -1
- /package/{NCC-1701-a-blue.svg → logos/NCC-1701-a-blue.svg} +0 -0
- /package/{NCC-1701-a.svg → logos/NCC-1701-a.svg} +0 -0
package/dist/cjs-set-config.cjs
CHANGED
|
@@ -32,6 +32,9 @@ function getEnv() {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* @module @warp-drive/build-config
|
|
37
|
+
*/
|
|
35
38
|
// ========================
|
|
36
39
|
// FOR CONTRIBUTING AUTHORS
|
|
37
40
|
//
|
|
@@ -51,7 +54,7 @@ function getEnv() {
|
|
|
51
54
|
//
|
|
52
55
|
|
|
53
56
|
/**
|
|
54
|
-
* ##
|
|
57
|
+
* ## Deprecation Management
|
|
55
58
|
*
|
|
56
59
|
* EmberData allows users to opt-in and remove code that exists to support deprecated
|
|
57
60
|
* behaviors.
|
|
@@ -69,54 +72,26 @@ function getEnv() {
|
|
|
69
72
|
* with `3.12`. This would remove any deprecations that were present in or before `3.12`
|
|
70
73
|
* but keep support for anything deprecated in or above `3.13`.
|
|
71
74
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* To configure your compatibility version, set the `compatWith` to the version you
|
|
75
|
-
* are compatible with on the `emberData` config in your `ember-cli-build.js` file.
|
|
76
|
-
*
|
|
77
|
-
* ```js
|
|
78
|
-
* const { setConfig } = await import('@warp-drive/build-config');
|
|
79
|
-
*
|
|
80
|
-
* let app = new EmberApp(defaults, {});
|
|
81
|
-
*
|
|
82
|
-
* setConfig(app, __dirname, { compatWith: '3.12' });
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* Alternatively, individual deprecations can be resolved (and thus have its support stripped)
|
|
86
|
-
* via one of the flag names listed below. For instance, given a flag named `DEPRECATE_FOO_BEHAVIOR`.
|
|
87
|
-
*
|
|
88
|
-
* This capability is interopable with `compatWith`. You may set `compatWith` and then selectively resolve
|
|
89
|
-
* additional deprecations, or set compatWith and selectively un-resolve specific deprecations.
|
|
90
|
-
*
|
|
91
|
-
* Note: EmberData does not test against permutations of deprecations being stripped, our tests run against
|
|
92
|
-
* "all deprecated code included" and "all deprecated code removed". Unspecified behavior may sometimes occur
|
|
93
|
-
* when removing code for only some deprecations associated to a version number.
|
|
94
|
-
*
|
|
95
|
-
* ```js
|
|
96
|
-
* const { setConfig } = await import('@warp-drive/build-config');
|
|
97
|
-
*
|
|
98
|
-
* let app = new EmberApp(defaults, {});
|
|
75
|
+
* You may also specify that specific deprecations are resolved. These approaches
|
|
76
|
+
* may be used together.
|
|
99
77
|
*
|
|
78
|
+
* ```ts
|
|
100
79
|
* setConfig(app, __dirname, {
|
|
80
|
+
* // declare that all deprecations through "5.0" have been fully resolved
|
|
81
|
+
* compatWith: '5.0',
|
|
82
|
+
*
|
|
83
|
+
* // mark individual deprecations as resolved by setting them to `false`
|
|
101
84
|
* deprecations: {
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* }
|
|
85
|
+
* // resolve individual deprecations here
|
|
86
|
+
* },
|
|
105
87
|
* });
|
|
106
88
|
* ```
|
|
107
89
|
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* The following list represents deprecations currently active.
|
|
117
|
-
*
|
|
118
|
-
* Some deprecation flags guard multiple deprecation IDs. All
|
|
119
|
-
* associated IDs are listed.
|
|
90
|
+
* > [!TIP]
|
|
91
|
+
* > EmberData does not test against permutations of deprecations
|
|
92
|
+
* > being stripped, our tests run against "all deprecated code included"
|
|
93
|
+
* > and "all deprecated code removed". Unspecified behavior may sometimes occur
|
|
94
|
+
* > when removing code for only some deprecations associated to a version number.
|
|
120
95
|
*
|
|
121
96
|
* @class CurrentDeprecations
|
|
122
97
|
* @public
|
|
@@ -570,6 +545,12 @@ function getDeprecations(compatVersion, deprecations) {
|
|
|
570
545
|
}
|
|
571
546
|
|
|
572
547
|
/**
|
|
548
|
+
*
|
|
549
|
+
* @module @warp-drive/build-config
|
|
550
|
+
*/
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
*
|
|
573
554
|
* ## Canary Features
|
|
574
555
|
*
|
|
575
556
|
* EmberData allows users to test features that are implemented but not yet
|
|
@@ -602,24 +583,22 @@ function getDeprecations(compatVersion, deprecations) {
|
|
|
602
583
|
*
|
|
603
584
|
* ```cli
|
|
604
585
|
* # Activate a single flag
|
|
605
|
-
*
|
|
586
|
+
* WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG ember build
|
|
606
587
|
*
|
|
607
588
|
* # Activate multiple flags by separating with commas
|
|
608
|
-
*
|
|
589
|
+
* WARP_DRIVE_FEATURE_OVERRIDE=SOME_FLAG,OTHER_FLAG ember build
|
|
609
590
|
*
|
|
610
591
|
* # Activate all flags
|
|
611
|
-
*
|
|
592
|
+
* WARP_DRIVE_FEATURE_OVERRIDE=ENABLE_ALL_OPTIONAL ember build
|
|
612
593
|
* ```
|
|
613
594
|
*
|
|
614
595
|
* or by setting the appropriate flag in your `ember-cli-build` file:
|
|
615
596
|
*
|
|
616
597
|
* ```ts
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
* OTHER_FEATURE_FLAG: true // utilize this new feature, strip code for the older behavior
|
|
622
|
-
* }
|
|
598
|
+
* setConfig(app, __dirname, {
|
|
599
|
+
* features: {
|
|
600
|
+
* SAMPLE_FEATURE_FLAG: false // utliize existing behavior, strip code for the new feature
|
|
601
|
+
* OTHER_FEATURE_FLAG: true // utilize this new feature, strip code for the older behavior
|
|
623
602
|
* }
|
|
624
603
|
* })
|
|
625
604
|
* ```
|
|
@@ -641,26 +620,37 @@ function getDeprecations(compatVersion, deprecations) {
|
|
|
641
620
|
* }
|
|
642
621
|
* ```
|
|
643
622
|
*
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
The
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
- `null` | The feature is **disabled by default**, but can be enabled via configuration.
|
|
656
|
-
|
|
657
|
-
@class CanaryFeatureFlags
|
|
658
|
-
@public
|
|
623
|
+
* The current list of features used at build time for canary releases is defined below.
|
|
624
|
+
* If empty there are no features currently gated by feature flags.
|
|
625
|
+
*
|
|
626
|
+
* The valid values are:
|
|
627
|
+
*
|
|
628
|
+
* - `true` | The feature is **enabled** at all times, and cannot be disabled.
|
|
629
|
+
* - `false` | The feature is **disabled** at all times, and cannot be enabled.
|
|
630
|
+
* - `null` | The feature is **disabled by default**, but can be enabled via configuration.
|
|
631
|
+
*
|
|
632
|
+
* @class CanaryFeatures
|
|
633
|
+
* @public
|
|
659
634
|
*/
|
|
660
635
|
const SAMPLE_FEATURE_FLAG = null;
|
|
661
636
|
|
|
637
|
+
/**
|
|
638
|
+
* This upcoming feature adds a validation step to payloads received
|
|
639
|
+
* by the JSONAPICache implementation.
|
|
640
|
+
*
|
|
641
|
+
* When a request completes and the result is given to the cache via
|
|
642
|
+
* `cache.put`, the cache will validate the payload against registered
|
|
643
|
+
* schemas as well as the JSON:API spec.
|
|
644
|
+
*
|
|
645
|
+
* @property JSON_API_CACHE_VALIDATION_ERRORS
|
|
646
|
+
* @since 5.4
|
|
647
|
+
* @public
|
|
648
|
+
*/
|
|
649
|
+
const JSON_API_CACHE_VALIDATION_ERRORS = false;
|
|
650
|
+
|
|
662
651
|
const CURRENT_FEATURES = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
663
652
|
__proto__: null,
|
|
653
|
+
JSON_API_CACHE_VALIDATION_ERRORS,
|
|
664
654
|
SAMPLE_FEATURE_FLAG
|
|
665
655
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
666
656
|
|
|
@@ -681,7 +671,7 @@ function getFeatures(isProd) {
|
|
|
681
671
|
}
|
|
682
672
|
return features;
|
|
683
673
|
}
|
|
684
|
-
const FEATURE_OVERRIDES = process.env.
|
|
674
|
+
const FEATURE_OVERRIDES = process.env.WARP_DRIVE_FEATURE_OVERRIDE;
|
|
685
675
|
if (FEATURE_OVERRIDES === 'ENABLE_ALL_OPTIONAL') {
|
|
686
676
|
// enable all features with a current value of `null`
|
|
687
677
|
for (const feature of keys) {
|
|
@@ -720,65 +710,43 @@ function getFeatures(isProd) {
|
|
|
720
710
|
}
|
|
721
711
|
|
|
722
712
|
/**
|
|
723
|
-
|
|
724
|
-
*
|
|
725
|
-
* Many portions of the internals are helpfully instrumented with logging that can be activated
|
|
726
|
-
* at build time. This instrumentation is always removed from production builds or any builds
|
|
727
|
-
* that has not explicitly activated it. To activate it set the appropriate flag to `true`.
|
|
728
|
-
*
|
|
729
|
-
@module @warp-drive/build-config/debugging
|
|
730
|
-
@main @warp-drive/build-config/debugging
|
|
713
|
+
@module @warp-drive/build-config
|
|
731
714
|
*/
|
|
732
715
|
/**
|
|
716
|
+
* ## Debug Logging
|
|
733
717
|
*
|
|
734
718
|
* Many portions of the internals are helpfully instrumented with logging that can be activated
|
|
735
|
-
at build time. This instrumentation is always removed from production builds or any builds
|
|
736
|
-
that has not explicitly activated it. To activate it set the appropriate flag to `true`.
|
|
737
|
-
|
|
738
|
-
```ts
|
|
739
|
-
let app = new EmberApp(defaults, {
|
|
740
|
-
emberData: {
|
|
741
|
-
debug: {
|
|
742
|
-
LOG_PAYLOADS: false, // data store received to update cache with
|
|
743
|
-
LOG_OPERATIONS: false, // updates to cache remote state
|
|
744
|
-
LOG_MUTATIONS: false, // updates to cache local state
|
|
745
|
-
LOG_NOTIFICATIONS: false,
|
|
746
|
-
LOG_REQUESTS: false,
|
|
747
|
-
LOG_REQUEST_STATUS: false,
|
|
748
|
-
LOG_IDENTIFIERS: false,
|
|
749
|
-
LOG_GRAPH: false,
|
|
750
|
-
LOG_INSTANCE_CACHE: false,
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
});
|
|
754
|
-
```
|
|
755
|
-
|
|
756
|
-
@class DebugLogging
|
|
757
|
-
@public
|
|
758
|
-
*/
|
|
759
|
-
/**
|
|
760
|
-
* log payloads received by the store
|
|
761
|
-
* via `push` or returned from a delete/update/create
|
|
762
|
-
* operation.
|
|
719
|
+
* at build time. This instrumentation is always removed from production builds or any builds
|
|
720
|
+
* that has not explicitly activated it. To activate it set the appropriate flag to `true`.
|
|
763
721
|
*
|
|
764
|
-
*
|
|
765
|
-
*
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
*
|
|
722
|
+
* ```ts
|
|
723
|
+
* setConfig(__dirname, app, {
|
|
724
|
+
* debug: {
|
|
725
|
+
* LOG_CACHE: false, // data store received to update cache with
|
|
726
|
+
* LOG_NOTIFICATIONS: false,
|
|
727
|
+
* LOG_REQUESTS: false,
|
|
728
|
+
* LOG_REQUEST_STATUS: false,
|
|
729
|
+
* LOG_IDENTIFIERS: false,
|
|
730
|
+
* LOG_GRAPH: false,
|
|
731
|
+
* LOG_INSTANCE_CACHE: false,
|
|
732
|
+
* LOG_METRIC_COUNTS: false,
|
|
733
|
+
* DEBUG_RELATIONSHIP_NOTIFICATIONS: false,
|
|
734
|
+
* }
|
|
735
|
+
* });
|
|
736
|
+
* ```
|
|
770
737
|
*
|
|
771
|
-
* @
|
|
738
|
+
* @class DebugLogging
|
|
772
739
|
* @public
|
|
773
740
|
*/
|
|
774
|
-
const LOG_OPERATIONS = false;
|
|
775
741
|
/**
|
|
776
|
-
* log
|
|
742
|
+
* log cache updates for both local
|
|
743
|
+
* and remote state.
|
|
777
744
|
*
|
|
778
|
-
* @property {boolean}
|
|
745
|
+
* @property {boolean} LOG_CACHE
|
|
779
746
|
* @public
|
|
780
747
|
*/
|
|
781
|
-
const
|
|
748
|
+
const LOG_CACHE = false;
|
|
749
|
+
|
|
782
750
|
/**
|
|
783
751
|
* log notifications received by the NotificationManager
|
|
784
752
|
*
|
|
@@ -824,20 +792,121 @@ const LOG_GRAPH = false;
|
|
|
824
792
|
* @public
|
|
825
793
|
*/
|
|
826
794
|
const LOG_INSTANCE_CACHE = false;
|
|
795
|
+
/**
|
|
796
|
+
* Log key count metrics, useful for performance
|
|
797
|
+
* debugging.
|
|
798
|
+
*
|
|
799
|
+
* @property {boolean} LOG_METRIC_COUNTS
|
|
800
|
+
* @public
|
|
801
|
+
*/
|
|
802
|
+
const LOG_METRIC_COUNTS = false;
|
|
803
|
+
/**
|
|
804
|
+
* Helps when debugging causes of a change notification
|
|
805
|
+
* when processing an update to a hasMany relationship.
|
|
806
|
+
*
|
|
807
|
+
* @property {boolean} DEBUG_RELATIONSHIP_NOTIFICATIONS
|
|
808
|
+
* @public
|
|
809
|
+
*/
|
|
810
|
+
const DEBUG_RELATIONSHIP_NOTIFICATIONS = false;
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* A private flag to enable logging of the native Map/Set
|
|
814
|
+
* constructor and method calls.
|
|
815
|
+
*
|
|
816
|
+
* EXTREMELY MALPERFORMANT
|
|
817
|
+
*
|
|
818
|
+
* LOG_METRIC_COUNTS must also be enabled.
|
|
819
|
+
*
|
|
820
|
+
* @typedoc
|
|
821
|
+
*/
|
|
822
|
+
const __INTERNAL_LOG_NATIVE_MAP_SET_COUNTS = false;
|
|
827
823
|
|
|
828
824
|
const LOGGING = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
829
825
|
__proto__: null,
|
|
826
|
+
DEBUG_RELATIONSHIP_NOTIFICATIONS,
|
|
827
|
+
LOG_CACHE,
|
|
830
828
|
LOG_GRAPH,
|
|
831
829
|
LOG_IDENTIFIERS,
|
|
832
830
|
LOG_INSTANCE_CACHE,
|
|
833
|
-
|
|
831
|
+
LOG_METRIC_COUNTS,
|
|
834
832
|
LOG_NOTIFICATIONS,
|
|
835
|
-
LOG_OPERATIONS,
|
|
836
|
-
LOG_PAYLOADS,
|
|
837
833
|
LOG_REQUESTS,
|
|
838
|
-
LOG_REQUEST_STATUS
|
|
834
|
+
LOG_REQUEST_STATUS,
|
|
835
|
+
__INTERNAL_LOG_NATIVE_MAP_SET_COUNTS
|
|
839
836
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
840
837
|
|
|
838
|
+
function createLoggingConfig(env, debug) {
|
|
839
|
+
const config = {};
|
|
840
|
+
const keys = Object.keys(LOGGING);
|
|
841
|
+
for (const key of keys) {
|
|
842
|
+
if (env.DEBUG || env.TESTING) {
|
|
843
|
+
config[key] = true;
|
|
844
|
+
} else {
|
|
845
|
+
config[key] = debug[key] || false;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
return config;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Settings configuration for deprecations, optional features, development/testing
|
|
853
|
+
* support and debug logging is done using `setConfig` in `ember-cli-build`.
|
|
854
|
+
*
|
|
855
|
+
* ```ts
|
|
856
|
+
* 'use strict';
|
|
857
|
+
*
|
|
858
|
+
* const EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
|
859
|
+
*
|
|
860
|
+
* module.exports = async function (defaults) {
|
|
861
|
+
* const { setConfig } = await import('@warp-drive/build-config');
|
|
862
|
+
*
|
|
863
|
+
* const app = new EmberApp(defaults, {});
|
|
864
|
+
*
|
|
865
|
+
* setConfig(app, __dirname, {
|
|
866
|
+
* // settings here
|
|
867
|
+
* });
|
|
868
|
+
*
|
|
869
|
+
* const { Webpack } = require('@embroider/webpack');
|
|
870
|
+
* return require('@embroider/compat').compatBuild(app, Webpack, {});
|
|
871
|
+
* };
|
|
872
|
+
*
|
|
873
|
+
* ```
|
|
874
|
+
*
|
|
875
|
+
* Available settings include:
|
|
876
|
+
*
|
|
877
|
+
* - [Debug Logging](../classes/DebugLogging)
|
|
878
|
+
* - [Deprecated Code Removal](../classes/CurrentDeprecations)
|
|
879
|
+
* - [Canary Feature Activation](../classes/CanaryFeatures)
|
|
880
|
+
*
|
|
881
|
+
* As well as:
|
|
882
|
+
*
|
|
883
|
+
* ### polyfillUUID
|
|
884
|
+
*
|
|
885
|
+
* If you are using the library in an environment that does not support `window.crypto.randomUUID`
|
|
886
|
+
* you can enable a polyfill for it.
|
|
887
|
+
*
|
|
888
|
+
* ```ts
|
|
889
|
+
* setConfig(app, __dirname, {
|
|
890
|
+
* polyfillUUID: true
|
|
891
|
+
* });
|
|
892
|
+
* ```
|
|
893
|
+
*
|
|
894
|
+
* ### includeDataAdapterInProduction
|
|
895
|
+
*
|
|
896
|
+
* By default, the integration required to support the ember inspector browser extension
|
|
897
|
+
* is included in production builds only when using the `ember-data` package. Otherwise
|
|
898
|
+
* the default is to exclude it. This setting allows to explicitly enable/disable it in
|
|
899
|
+
* production builds.
|
|
900
|
+
*
|
|
901
|
+
* ```ts
|
|
902
|
+
* setConfig(app, __dirname, {
|
|
903
|
+
* includeDataAdapterInProduction: true
|
|
904
|
+
* });
|
|
905
|
+
* ```
|
|
906
|
+
*
|
|
907
|
+
* @module @warp-drive/build-config
|
|
908
|
+
* @main @warp-drive/build-config
|
|
909
|
+
*/
|
|
841
910
|
const _MacrosConfig = EmbroiderMacros.MacrosConfig;
|
|
842
911
|
function recastMacrosConfig(macros) {
|
|
843
912
|
if (!('globalConfig' in macros)) {
|
|
@@ -845,10 +914,12 @@ function recastMacrosConfig(macros) {
|
|
|
845
914
|
}
|
|
846
915
|
return macros;
|
|
847
916
|
}
|
|
848
|
-
function setConfig(context,
|
|
849
|
-
const
|
|
850
|
-
const
|
|
851
|
-
const
|
|
917
|
+
function setConfig(context, appRootOrConfig, config) {
|
|
918
|
+
const isEmberClassicUsage = arguments.length === 3;
|
|
919
|
+
const macros = recastMacrosConfig(isEmberClassicUsage ? _MacrosConfig.for(context, appRootOrConfig) : context);
|
|
920
|
+
const userConfig = isEmberClassicUsage ? config : appRootOrConfig;
|
|
921
|
+
const isLegacySupport = userConfig.___legacy_support;
|
|
922
|
+
const hasDeprecatedConfig = isLegacySupport && Object.keys(userConfig).length > 1;
|
|
852
923
|
const hasInitiatedConfig = macros.globalConfig['WarpDrive'];
|
|
853
924
|
|
|
854
925
|
// setConfig called by user prior to legacy support called
|
|
@@ -859,11 +930,6 @@ function setConfig(context, appRoot, config) {
|
|
|
859
930
|
return;
|
|
860
931
|
}
|
|
861
932
|
|
|
862
|
-
// legacy support called prior to user setConfig
|
|
863
|
-
if (isLegacySupport && hasDeprecatedConfig) {
|
|
864
|
-
console.warn(`You are using the legacy emberData key in your ember-cli-build.js file. This key is deprecated and will be removed in the next major version of EmberData/WarpDrive. Please use \`import { setConfig } from '@warp-drive/build-config';\` instead.`);
|
|
865
|
-
}
|
|
866
|
-
|
|
867
933
|
// included hooks run during class initialization of the EmberApp instance
|
|
868
934
|
// so our hook will run before the user has a chance to call setConfig
|
|
869
935
|
// else we could print a useful message here
|
|
@@ -873,19 +939,20 @@ function setConfig(context, appRoot, config) {
|
|
|
873
939
|
// );
|
|
874
940
|
// }
|
|
875
941
|
|
|
876
|
-
const debugOptions = Object.assign({}, LOGGING,
|
|
942
|
+
const debugOptions = Object.assign({}, LOGGING, userConfig.debug);
|
|
877
943
|
const env = getEnv();
|
|
878
|
-
const DEPRECATIONS = getDeprecations(
|
|
944
|
+
const DEPRECATIONS = getDeprecations(userConfig.compatWith || null, userConfig.deprecations);
|
|
879
945
|
const FEATURES = getFeatures(env.PRODUCTION);
|
|
880
|
-
const includeDataAdapterInProduction = typeof
|
|
946
|
+
const includeDataAdapterInProduction = typeof userConfig.includeDataAdapterInProduction === 'boolean' ? userConfig.includeDataAdapterInProduction : true;
|
|
881
947
|
const includeDataAdapter = env.PRODUCTION ? includeDataAdapterInProduction : true;
|
|
882
948
|
const finalizedConfig = {
|
|
883
949
|
debug: debugOptions,
|
|
884
|
-
polyfillUUID:
|
|
950
|
+
polyfillUUID: userConfig.polyfillUUID ?? false,
|
|
885
951
|
includeDataAdapter,
|
|
886
|
-
compatWith:
|
|
952
|
+
compatWith: userConfig.compatWith ?? null,
|
|
887
953
|
deprecations: DEPRECATIONS,
|
|
888
954
|
features: FEATURES,
|
|
955
|
+
activeLogging: createLoggingConfig(env, debugOptions),
|
|
889
956
|
env
|
|
890
957
|
};
|
|
891
958
|
macros.setGlobalConfig(undefined, 'WarpDrive', finalizedConfig);
|