Skip to content

Commit 5356d6b

Browse files
authored
Merge pull request #94 from ember-cli/drop-legacy-config
Drop deprecated config format
2 parents b08cb1c + 993b66c commit 5356d6b

File tree

3 files changed

+18
-146
lines changed

3 files changed

+18
-146
lines changed

src/utils/normalize-options.js

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -60,50 +60,6 @@ function parseFlags(options) {
6060
}
6161
});
6262

63-
let legacyEnvFlags = options.envFlags;
64-
if (legacyEnvFlags) {
65-
let source = legacyEnvFlags.source;
66-
combinedFlags[source] = combinedFlags[source] || {};
67-
68-
for (let flagName in legacyEnvFlags.flags) {
69-
let flagValue = legacyEnvFlags.flags[flagName];
70-
combinedFlags[source][flagName] = evaluateFlagValue(options, null, flagName, flagValue);
71-
}
72-
}
73-
74-
let legacyFeatures = options.features;
75-
if (legacyFeatures) {
76-
if (!Array.isArray(legacyFeatures)) {
77-
legacyFeatures = [legacyFeatures];
78-
}
79-
80-
legacyFeatures.forEach((flagsDefinition) => {
81-
let source = flagsDefinition.source;
82-
let flagsForSource = (combinedFlags[source] = combinedFlags[source] || {});
83-
84-
for (let flagName in flagsDefinition.flags) {
85-
let flagValue = flagsDefinition.flags[flagName];
86-
87-
flagsForSource[flagName] = evaluateFlagValue(
88-
options,
89-
flagsDefinition.name,
90-
flagName,
91-
flagValue
92-
);
93-
}
94-
});
95-
}
96-
97-
if (legacyFeatures || legacyEnvFlags) {
98-
let msg = `[babel-plugin-debug-macros]: passed v1 configuration, converting to v2. Legacy configuration passed:\n${JSON.stringify(
99-
options,
100-
null,
101-
2
102-
)}`;
103-
104-
console.warn(msg);
105-
}
106-
10763
return combinedFlags;
10864
}
10965

tests/create-tests.js

Lines changed: 18 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -173,63 +173,28 @@ function createTests(options) {
173173
});
174174

175175
describe('ember-cli-babel configuration', function () {
176-
describe('Ember < 3.27', function () {
177-
describe('legacy config API', function () {
178-
beforeEach(function () {
179-
console.warn = () => {};
180-
});
181-
182-
let h = transformTestHelper({
183-
presets,
184-
plugins: [
185-
[
186-
DebugToolsPlugin,
187-
{
188-
externalizeHelpers: {
189-
global: 'Ember',
190-
},
191-
debugTools: {
192-
isDebug: true,
193-
source: '@ember/debug',
194-
assertPredicateIndex: 1,
195-
},
196-
envFlags: {
197-
source: '@glimmer/env',
198-
flags: {
199-
DEBUG: true,
200-
},
201-
},
176+
describe('default configuration', function () {
177+
let h = transformTestHelper({
178+
presets,
179+
plugins: [
180+
[
181+
DebugToolsPlugin,
182+
{
183+
externalizeHelpers: {
184+
global: 'Ember',
202185
},
203-
],
204-
],
205-
});
206-
207-
h.generateTest('ember-cli-babel-config-pre-3-27');
208-
});
209-
210-
describe('default configuration', function () {
211-
let h = transformTestHelper({
212-
presets,
213-
plugins: [
214-
[
215-
DebugToolsPlugin,
216-
{
217-
externalizeHelpers: {
218-
global: 'Ember',
219-
},
220-
debugTools: {
221-
isDebug: true,
222-
source: '@ember/debug',
223-
assertPredicateIndex: 1,
224-
},
225-
flags: [{ source: '@glimmer/env', flags: { DEBUG: true } }],
186+
debugTools: {
187+
isDebug: true,
188+
source: '@ember/debug',
189+
assertPredicateIndex: 1,
226190
},
227-
],
191+
flags: [{ source: '@glimmer/env', flags: { DEBUG: true } }],
192+
},
228193
],
229-
});
230-
231-
h.generateTest('ember-cli-babel-config-pre-3-27');
194+
],
232195
});
196+
197+
h.generateTest('ember-cli-babel-config-pre-3-27');
233198
});
234199

235200
describe('Ember >= 3.27', function () {

tests/normalize-options-test.js

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -26,55 +26,6 @@ describe('normalizeOptions', function () {
2626
expect(actual).toEqual(expected);
2727
});
2828

29-
it('converts "old style" options into the newer style (with deprecation)', function () {
30-
let warnings = [];
31-
console.warn = warning => warnings.push(warning); // eslint-disable-line
32-
33-
let options = {
34-
envFlags: {
35-
source: '@ember/env-flags',
36-
flags: {
37-
DEBUG: false,
38-
},
39-
},
40-
debugTools: {
41-
source: '@ember/debug-tools',
42-
},
43-
features: {
44-
name: 'ember-source',
45-
source: '@ember/features',
46-
flags: {
47-
FEATURE_A: true,
48-
FEATURE_B: null,
49-
},
50-
},
51-
};
52-
let stringifiedOptions = JSON.stringify(options, null, 2);
53-
let actual = normalizeOptions(options);
54-
let expected = {
55-
debugTools: {
56-
isDebug: false,
57-
assertPredicateIndex: undefined,
58-
debugToolsImport: '@ember/debug-tools',
59-
},
60-
flags: {
61-
'@ember/env-flags': {
62-
DEBUG: false,
63-
},
64-
'@ember/features': {
65-
FEATURE_A: true,
66-
FEATURE_B: null,
67-
},
68-
},
69-
externalizeHelpers: undefined,
70-
};
71-
72-
expect(actual).toEqual(expected);
73-
expect(warnings).toEqual([
74-
`[babel-plugin-debug-macros]: passed v1 configuration, converting to v2. Legacy configuration passed:\n${stringifiedOptions}`,
75-
]);
76-
});
77-
7829
it('sets flag to false when svelte version matches the flag version', function () {
7930
let actual = normalizeOptions({
8031
debugTools: {

0 commit comments

Comments
 (0)