@embroider/compat 3.6.0 → 3.6.2-unstable.2e5e933
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/babel.js +1 -0
- package/package.json +12 -10
- package/src/audit/babel-visitor.js +7 -1
- package/src/audit/babel-visitor.js.map +1 -1
- package/src/audit/build.js.map +1 -1
- package/src/audit.d.ts +6 -53
- package/src/audit.js +98 -285
- package/src/audit.js.map +1 -1
- package/src/babel-plugin-adjust-imports.js +19 -18
- package/src/babel-plugin-adjust-imports.js.map +1 -1
- package/src/babel.d.ts +19 -0
- package/src/babel.js +153 -0
- package/src/babel.js.map +1 -0
- package/src/compat-adapters/@ember-data/store.d.ts +1 -5
- package/src/compat-adapters/@ember-data/store.js +3 -15
- package/src/compat-adapters/@ember-data/store.js.map +1 -1
- package/src/compat-adapters/ember-fetch.d.ts +5 -0
- package/src/compat-adapters/ember-fetch.js +19 -0
- package/src/compat-adapters/ember-fetch.js.map +1 -0
- package/src/compat-adapters/ember-resolver.d.ts +4 -0
- package/src/compat-adapters/ember-resolver.js +21 -0
- package/src/compat-adapters/ember-resolver.js.map +1 -0
- package/src/compat-addons.js +1 -1
- package/src/compat-addons.js.map +1 -1
- package/src/compat-app-builder.d.ts +9 -64
- package/src/compat-app-builder.js +110 -1275
- package/src/compat-app-builder.js.map +1 -1
- package/src/compat-app.d.ts +4 -22
- package/src/compat-app.js +70 -216
- package/src/compat-app.js.map +1 -1
- package/src/content-for-config.d.ts +11 -0
- package/src/content-for-config.js +66 -0
- package/src/content-for-config.js.map +1 -0
- package/src/default-pipeline.d.ts +2 -2
- package/src/default-pipeline.js +21 -0
- package/src/default-pipeline.js.map +1 -1
- package/src/dependency-rules.js +17 -10
- package/src/dependency-rules.js.map +1 -1
- package/src/detect-babel-plugins.d.ts +1 -0
- package/src/detect-babel-plugins.js +14 -0
- package/src/detect-babel-plugins.js.map +1 -1
- package/src/http-audit.d.ts +13 -0
- package/src/http-audit.js +60 -0
- package/src/http-audit.js.map +1 -0
- package/src/index.d.ts +1 -2
- package/src/index.js +2 -3
- package/src/index.js.map +1 -1
- package/src/module-visitor.d.ts +52 -0
- package/src/module-visitor.js +285 -0
- package/src/module-visitor.js.map +1 -0
- package/src/options.d.ts +3 -2
- package/src/options.js +3 -0
- package/src/options.js.map +1 -1
- package/src/resolver-transform.js +9 -6
- package/src/resolver-transform.js.map +1 -1
- package/src/standalone-addon-build.js +6 -15
- package/src/standalone-addon-build.js.map +1 -1
- package/src/v1-config.d.ts +0 -8
- package/src/v1-config.js +1 -51
- package/src/v1-config.js.map +1 -1
- package/src/compat-adapters/@ember-data/debug.d.ts +0 -6
- package/src/compat-adapters/@ember-data/debug.js +0 -22
- package/src/compat-adapters/@ember-data/debug.js.map +0 -1
- package/src/rename-require-plugin.d.ts +0 -1
- package/src/rename-require-plugin.js +0 -15
- package/src/rename-require-plugin.js.map +0 -1
- package/src/sync-dir.d.ts +0 -8
- package/src/sync-dir.js +0 -68
- package/src/sync-dir.js.map +0 -1
- package/src/template-tag-codemod.d.ts +0 -10
- package/src/template-tag-codemod.js +0 -258
- package/src/template-tag-codemod.js.map +0 -1
- package/src/v1-appboot.d.ts +0 -14
- package/src/v1-appboot.js +0 -47
- package/src/v1-appboot.js.map +0 -1
package/src/compat-app.js
CHANGED
|
@@ -18,8 +18,8 @@ const broccoli_funnel_1 = __importDefault(require("broccoli-funnel"));
|
|
|
18
18
|
const broccoli_merge_trees_1 = __importDefault(require("broccoli-merge-trees"));
|
|
19
19
|
const broccoli_source_1 = require("broccoli-source");
|
|
20
20
|
const resolve_1 = __importDefault(require("resolve"));
|
|
21
|
+
const content_for_config_1 = __importDefault(require("./content-for-config"));
|
|
21
22
|
const v1_config_1 = require("./v1-config");
|
|
22
|
-
const v1_appboot_1 = require("./v1-appboot");
|
|
23
23
|
const fs_extra_1 = require("fs-extra");
|
|
24
24
|
const add_to_tree_1 = __importDefault(require("./add-to-tree"));
|
|
25
25
|
const dummy_package_1 = __importDefault(require("./dummy-package"));
|
|
@@ -27,12 +27,12 @@ const node_1 = require("@embroider/macros/src/node");
|
|
|
27
27
|
const resolve_package_path_1 = __importDefault(require("resolve-package-path"));
|
|
28
28
|
const broccoli_concat_1 = __importDefault(require("broccoli-concat"));
|
|
29
29
|
const mapKeys_1 = __importDefault(require("lodash/mapKeys"));
|
|
30
|
-
const synthesize_template_only_components_1 = __importDefault(require("./synthesize-template-only-components"));
|
|
31
30
|
const detect_babel_plugins_1 = require("./detect-babel-plugins");
|
|
32
31
|
const prepare_htmlbars_ast_plugins_1 = __importDefault(require("./prepare-htmlbars-ast-plugins"));
|
|
33
32
|
const fs_1 = require("fs");
|
|
34
33
|
const semver_1 = __importDefault(require("semver"));
|
|
35
34
|
const compat_app_builder_1 = require("./compat-app-builder");
|
|
35
|
+
const walk_sync_1 = __importDefault(require("walk-sync"));
|
|
36
36
|
// This runs at broccoli-pipeline-construction time, whereas the
|
|
37
37
|
// CompatAppBuilder instance only becomes available during tree-building time.
|
|
38
38
|
class CompatApp {
|
|
@@ -77,9 +77,6 @@ class CompatApp {
|
|
|
77
77
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
78
78
|
return require(resolve_1.default.sync(specifier, { basedir: this.emberCLILocation }));
|
|
79
79
|
}
|
|
80
|
-
get configReplace() {
|
|
81
|
-
return this.requireFromEmberCLI('broccoli-config-replace');
|
|
82
|
-
}
|
|
83
80
|
get configLoader() {
|
|
84
81
|
return this.requireFromEmberCLI('broccoli-config-loader');
|
|
85
82
|
}
|
|
@@ -113,20 +110,21 @@ class CompatApp {
|
|
|
113
110
|
return new v1_config_1.V1Config(this.configTree, 'test');
|
|
114
111
|
}
|
|
115
112
|
}
|
|
113
|
+
get contentFor() {
|
|
114
|
+
const configPaths = [
|
|
115
|
+
{ file: '/index.html', path: (0, path_1.join)('environments', `${this.legacyEmberAppInstance.env}.json`) },
|
|
116
|
+
];
|
|
117
|
+
if (this.shouldBuildTests)
|
|
118
|
+
configPaths.push({ file: '/tests/index.html', path: (0, path_1.join)('environments', `test.json`) });
|
|
119
|
+
return new content_for_config_1.default(this.configTree, {
|
|
120
|
+
availableContentForTypes: this.options.availableContentForTypes,
|
|
121
|
+
configPaths,
|
|
122
|
+
pattern: this.filteredPatternsByContentFor.contentFor,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
116
125
|
get autoRun() {
|
|
117
126
|
return this.legacyEmberAppInstance.options.autoRun;
|
|
118
127
|
}
|
|
119
|
-
get appBoot() {
|
|
120
|
-
let env = this.legacyEmberAppInstance.env;
|
|
121
|
-
let appBootContentTree = new v1_appboot_1.WriteV1AppBoot();
|
|
122
|
-
let patterns = this.configReplacePatterns;
|
|
123
|
-
appBootContentTree = new this.configReplace(appBootContentTree, this.configTree, {
|
|
124
|
-
configPath: (0, path_1.join)('environments', `${env}.json`),
|
|
125
|
-
files: ['config/app-boot.js'],
|
|
126
|
-
patterns,
|
|
127
|
-
});
|
|
128
|
-
return new v1_appboot_1.ReadV1AppBoot(appBootContentTree);
|
|
129
|
-
}
|
|
130
128
|
get storeConfigInMeta() {
|
|
131
129
|
return this.legacyEmberAppInstance.options.storeConfigInMeta;
|
|
132
130
|
}
|
|
@@ -137,93 +135,36 @@ class CompatApp {
|
|
|
137
135
|
storeConfigInMeta: this.storeConfigInMeta,
|
|
138
136
|
});
|
|
139
137
|
}
|
|
140
|
-
get
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
get indexTree() {
|
|
149
|
-
let indexFilePath = this.legacyEmberAppInstance.options.outputPaths.app.html;
|
|
150
|
-
let index = (0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.app, {
|
|
151
|
-
allowEmpty: true,
|
|
152
|
-
include: [`index.html`],
|
|
153
|
-
getDestinationPath: () => indexFilePath,
|
|
154
|
-
annotation: 'app/index.html',
|
|
155
|
-
});
|
|
156
|
-
return new this.configReplace(index, this.configTree, {
|
|
157
|
-
configPath: (0, path_1.join)('environments', `${this.legacyEmberAppInstance.env}.json`),
|
|
158
|
-
files: [indexFilePath],
|
|
159
|
-
patterns: this.configReplacePatterns,
|
|
160
|
-
annotation: 'ConfigReplace/indexTree',
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
get testIndexTree() {
|
|
164
|
-
let index = (0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.tests, {
|
|
165
|
-
allowEmpty: true,
|
|
166
|
-
include: [`index.html`],
|
|
167
|
-
destDir: 'tests',
|
|
168
|
-
annotation: 'tests/index.html',
|
|
169
|
-
});
|
|
170
|
-
return new this.configReplace(index, this.configTree, {
|
|
171
|
-
configPath: (0, path_1.join)('environments', `test.json`),
|
|
172
|
-
files: ['tests/index.html'],
|
|
173
|
-
patterns: this.configReplacePatterns,
|
|
174
|
-
annotation: 'ConfigReplace/testIndexTree',
|
|
175
|
-
});
|
|
138
|
+
get filteredPatternsByContentFor() {
|
|
139
|
+
const filter = '/{{content-for [\'"](.+?)["\']}}/g';
|
|
140
|
+
return {
|
|
141
|
+
contentFor: this.configReplacePatterns.find((pattern) => filter.includes(pattern.match.toString())),
|
|
142
|
+
others: this.configReplacePatterns.filter((pattern) => !filter.includes(pattern.match.toString())),
|
|
143
|
+
};
|
|
176
144
|
}
|
|
177
|
-
|
|
178
|
-
// this finds
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
'ember-cli-babel': {
|
|
182
|
-
...this.legacyEmberAppInstance.options['ember-cli-babel'],
|
|
183
|
-
includeExternalHelpers: true,
|
|
184
|
-
compileModules: false,
|
|
185
|
-
disableDebugTooling: false,
|
|
186
|
-
disablePresetEnv: false,
|
|
187
|
-
disableEmberModulesAPIPolyfill: false,
|
|
188
|
-
},
|
|
189
|
-
});
|
|
190
|
-
let plugins = babelConfig.plugins;
|
|
191
|
-
let presets = babelConfig.presets;
|
|
192
|
-
// this finds any custom babel configuration that's on the app (either
|
|
193
|
-
// because the app author explicitly added some, or because addons have
|
|
194
|
-
// pushed plugins into it).
|
|
145
|
+
extraBabelPlugins() {
|
|
146
|
+
// this finds any custom babel plugins on the app (either because the app
|
|
147
|
+
// author explicitly added some, or because addons have pushed plugins into
|
|
148
|
+
// it).
|
|
195
149
|
let appBabel = this.legacyEmberAppInstance.options.babel;
|
|
196
150
|
if (appBabel) {
|
|
197
151
|
if (appBabel.plugins) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
152
|
+
return appBabel.plugins.filter(p => {
|
|
153
|
+
// even if the app was using @embroider/macros, we drop it from the config
|
|
154
|
+
// here in favor of our globally-configured one.
|
|
155
|
+
return (!(0, node_1.isEmbroiderMacrosPlugin)(p) &&
|
|
156
|
+
// similarly, if the app was already using an inline template compiler
|
|
157
|
+
// babel plugin, we remove it here because we have our own
|
|
158
|
+
// always-installed version of that (v2 addons are allowed to assume it
|
|
159
|
+
// will be present in the final app build, the app doesn't get to turn
|
|
160
|
+
// that off or configure it.)
|
|
161
|
+
!(0, detect_babel_plugins_1.isInlinePrecompilePlugin)(p) &&
|
|
162
|
+
!(0, detect_babel_plugins_1.isEmberAutoImportDynamic)(p) &&
|
|
163
|
+
!(0, detect_babel_plugins_1.isHtmlbarColocation)(p));
|
|
164
|
+
});
|
|
202
165
|
}
|
|
203
166
|
}
|
|
204
|
-
|
|
205
|
-
// even if the app was using @embroider/macros, we drop it from the config
|
|
206
|
-
// here in favor of our globally-configured one.
|
|
207
|
-
return (!(0, node_1.isEmbroiderMacrosPlugin)(p) &&
|
|
208
|
-
// similarly, if the app was already using an inline template compiler
|
|
209
|
-
// babel plugin, we remove it here because we have our own
|
|
210
|
-
// always-installed version of that (v2 addons are allowed to assume it
|
|
211
|
-
// will be present in the final app build, the app doesn't get to turn
|
|
212
|
-
// that off or configure it.)
|
|
213
|
-
!(0, detect_babel_plugins_1.isInlinePrecompilePlugin)(p) &&
|
|
214
|
-
!(0, detect_babel_plugins_1.isEmberAutoImportDynamic)(p));
|
|
215
|
-
});
|
|
216
|
-
const config = {
|
|
217
|
-
babelrc: false,
|
|
218
|
-
plugins,
|
|
219
|
-
presets,
|
|
220
|
-
// this is here because broccoli-middleware can't render a codeFrame full
|
|
221
|
-
// of terminal codes. It would be nice to add something like
|
|
222
|
-
// https://github.com/mmalecki/ansispan to broccoli-middleware so we can
|
|
223
|
-
// leave color enabled.
|
|
224
|
-
highlightCode: false,
|
|
225
|
-
};
|
|
226
|
-
return config;
|
|
167
|
+
return [];
|
|
227
168
|
}
|
|
228
169
|
babelMajorVersion() {
|
|
229
170
|
var _a, _b;
|
|
@@ -361,6 +302,28 @@ class CompatApp {
|
|
|
361
302
|
(0, fs_extra_1.ensureDirSync)((0, path_1.dirname)(destPath));
|
|
362
303
|
(0, fs_extra_1.copySync)(sourcePath, destPath);
|
|
363
304
|
}
|
|
305
|
+
if (this.shouldBuildTests) {
|
|
306
|
+
(0, fs_extra_1.writeFileSync)((0, path_1.join)(outputPath, 'testem.js'), `/*
|
|
307
|
+
* This is dummy file that exists for the sole purpose
|
|
308
|
+
* of allowing tests to run directly in the browser as
|
|
309
|
+
* well as by Testem.
|
|
310
|
+
*
|
|
311
|
+
* Testem is configured to run tests directly against
|
|
312
|
+
* the test build of index.html, which requires a
|
|
313
|
+
* snippet to load the testem.js file:
|
|
314
|
+
* <script src="/testem.js"></script>
|
|
315
|
+
* This has to go before the qunit framework and app
|
|
316
|
+
* tests are loaded.
|
|
317
|
+
*
|
|
318
|
+
* Testem internally supplies this file. However, if you
|
|
319
|
+
* run the tests directly in the browser (localhost:8000/tests),
|
|
320
|
+
* this file does not exist.
|
|
321
|
+
*
|
|
322
|
+
* Hence the purpose of this fake file. This file is served
|
|
323
|
+
* directly from the express server to satisify the script load.
|
|
324
|
+
*/`);
|
|
325
|
+
this._publicAssets['/testem.js'] = './testem.js';
|
|
326
|
+
}
|
|
364
327
|
let remapAsset = this.remapAsset.bind(this);
|
|
365
328
|
let addonMeta = {
|
|
366
329
|
type: 'addon',
|
|
@@ -423,7 +386,7 @@ class CompatApp {
|
|
|
423
386
|
};
|
|
424
387
|
let assetPath = (0, path_1.join)(outputPath, 'assets');
|
|
425
388
|
if ((0, fs_extra_1.pathExistsSync)(assetPath)) {
|
|
426
|
-
for (let file of (0,
|
|
389
|
+
for (let file of (0, walk_sync_1.default)(assetPath, { directories: false })) {
|
|
427
390
|
addonMeta['public-assets'][`./assets/${file}`] = `/assets/${file}`;
|
|
428
391
|
}
|
|
429
392
|
}
|
|
@@ -471,19 +434,6 @@ class CompatApp {
|
|
|
471
434
|
}
|
|
472
435
|
return './' + asset;
|
|
473
436
|
}
|
|
474
|
-
preprocessJS(tree) {
|
|
475
|
-
// we're saving all our babel compilation for the final stage packager
|
|
476
|
-
this.legacyEmberAppInstance.registry.remove('js', 'ember-cli-babel');
|
|
477
|
-
// auto-import is supported natively so we don't need it here
|
|
478
|
-
this.legacyEmberAppInstance.registry.remove('js', 'ember-auto-import-analyzer');
|
|
479
|
-
tree = (0, broccoli_funnel_1.default)(tree, { destDir: this.name });
|
|
480
|
-
tree = this.preprocessors.preprocessJs(tree, `/`, '/', {
|
|
481
|
-
annotation: 'v1-app-preprocess-js',
|
|
482
|
-
registry: this.legacyEmberAppInstance.registry,
|
|
483
|
-
});
|
|
484
|
-
tree = (0, broccoli_funnel_1.default)(tree, { srcDir: this.name });
|
|
485
|
-
return tree;
|
|
486
|
-
}
|
|
487
437
|
get htmlbarsPlugins() {
|
|
488
438
|
let plugins = (0, prepare_htmlbars_ast_plugins_1.default)(this.legacyEmberAppInstance.registry);
|
|
489
439
|
// even if the app was using @embroider/macros, we drop it from the config
|
|
@@ -491,25 +441,6 @@ class CompatApp {
|
|
|
491
441
|
plugins = plugins.filter((p) => !(0, node_1.isEmbroiderMacrosPlugin)(p));
|
|
492
442
|
return plugins;
|
|
493
443
|
}
|
|
494
|
-
// our own appTree. Not to be confused with the one that combines the app js
|
|
495
|
-
// from all addons too.
|
|
496
|
-
get appTree() {
|
|
497
|
-
return this.preprocessJS((0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.app, {
|
|
498
|
-
exclude: ['styles/**', '*.html'],
|
|
499
|
-
}));
|
|
500
|
-
}
|
|
501
|
-
get testsTree() {
|
|
502
|
-
if (this.shouldBuildTests && this.legacyEmberAppInstance.trees.tests) {
|
|
503
|
-
return this.preprocessJS((0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.tests, {
|
|
504
|
-
destDir: 'tests',
|
|
505
|
-
}));
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
get lintTree() {
|
|
509
|
-
if (this.shouldBuildTests) {
|
|
510
|
-
return this.legacyEmberAppInstance.getLintTests();
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
444
|
get vendorTree() {
|
|
514
445
|
return this.ensureTree(this.legacyEmberAppInstance.trees.vendor);
|
|
515
446
|
}
|
|
@@ -533,69 +464,6 @@ class CompatApp {
|
|
|
533
464
|
get preprocessors() {
|
|
534
465
|
return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');
|
|
535
466
|
}
|
|
536
|
-
get publicTree() {
|
|
537
|
-
return this.ensureTree(this.legacyEmberAppInstance.trees.public);
|
|
538
|
-
}
|
|
539
|
-
processAppJS() {
|
|
540
|
-
let appTree = this.appTree;
|
|
541
|
-
let testsTree = this.testsTree;
|
|
542
|
-
let lintTree = this.lintTree;
|
|
543
|
-
let config = new v1_config_1.WriteV1Config(this.config, this.storeConfigInMeta, this.testConfig);
|
|
544
|
-
let patterns = this.configReplacePatterns;
|
|
545
|
-
let configReplaced = new this.configReplace(config, this.configTree, {
|
|
546
|
-
configPath: (0, path_1.join)('environments', `${this.legacyEmberAppInstance.env}.json`),
|
|
547
|
-
files: ['config/environment.js'],
|
|
548
|
-
patterns,
|
|
549
|
-
});
|
|
550
|
-
let trees = [];
|
|
551
|
-
trees.push(appTree);
|
|
552
|
-
trees.push(new synthesize_template_only_components_1.default(appTree, { allowedPaths: ['components'], templateExtensions: ['.hbs'] }));
|
|
553
|
-
trees.push(configReplaced);
|
|
554
|
-
if (testsTree) {
|
|
555
|
-
trees.push(testsTree);
|
|
556
|
-
}
|
|
557
|
-
if (lintTree) {
|
|
558
|
-
trees.push(lintTree);
|
|
559
|
-
}
|
|
560
|
-
return {
|
|
561
|
-
appJS: (0, broccoli_merge_trees_1.default)(trees, { overwrite: true }),
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
withoutRootURL(src) {
|
|
565
|
-
let rootURL = this.config.readConfig().rootURL;
|
|
566
|
-
if ((src.startsWith(rootURL) && rootURL) || (!rootURL && !src.startsWith('/'))) {
|
|
567
|
-
src = '/' + src.slice(rootURL.length);
|
|
568
|
-
}
|
|
569
|
-
else if (src.startsWith('/' + rootURL)) {
|
|
570
|
-
src = src.slice(rootURL.length);
|
|
571
|
-
}
|
|
572
|
-
return src;
|
|
573
|
-
}
|
|
574
|
-
findAppScript(scripts, entrypoint) {
|
|
575
|
-
let appJS = scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.app.js);
|
|
576
|
-
return throwIfMissing(appJS, this.legacyEmberAppInstance.options.outputPaths.app.js, scripts.map(s => s.src), entrypoint, 'app javascript');
|
|
577
|
-
}
|
|
578
|
-
findAppStyles(styles, entrypoint) {
|
|
579
|
-
let style = styles.find(style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.app.css.app);
|
|
580
|
-
return throwIfMissing(style, this.legacyEmberAppInstance.options.outputPaths.app.css.app, styles.map(s => s.href), entrypoint, 'app css');
|
|
581
|
-
}
|
|
582
|
-
findVendorScript(scripts, entrypoint) {
|
|
583
|
-
let vendor = scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.vendor.js);
|
|
584
|
-
return throwIfMissing(vendor, this.legacyEmberAppInstance.options.outputPaths.vendor.js, scripts.map(s => s.src), entrypoint, 'vendor javascript');
|
|
585
|
-
}
|
|
586
|
-
findVendorStyles(styles, entrypoint) {
|
|
587
|
-
let vendorStyle = styles.find(style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.vendor.css);
|
|
588
|
-
return throwIfMissing(vendorStyle, this.legacyEmberAppInstance.options.outputPaths.vendor.css, styles.map(s => s.href), entrypoint, 'vendor css');
|
|
589
|
-
}
|
|
590
|
-
findTestSupportStyles(styles) {
|
|
591
|
-
return styles.find(style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.testSupport.css);
|
|
592
|
-
}
|
|
593
|
-
findTestSupportScript(scripts) {
|
|
594
|
-
return scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.testSupport.js.testSupport);
|
|
595
|
-
}
|
|
596
|
-
findTestScript(scripts) {
|
|
597
|
-
return scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.tests.js);
|
|
598
|
-
}
|
|
599
467
|
constructor(legacyEmberAppInstance, _options) {
|
|
600
468
|
this.legacyEmberAppInstance = legacyEmberAppInstance;
|
|
601
469
|
this.annotation = '@embroider/compat/app';
|
|
@@ -623,17 +491,11 @@ class CompatApp {
|
|
|
623
491
|
});
|
|
624
492
|
}
|
|
625
493
|
inTrees(prevStageTree) {
|
|
626
|
-
let publicTree = this.publicTree;
|
|
627
494
|
let configTree = this.config;
|
|
628
|
-
|
|
629
|
-
publicTree = (0, broccoli_merge_trees_1.default)([publicTree, ...this.options.extraPublicTrees].filter(Boolean));
|
|
630
|
-
}
|
|
495
|
+
let contentForTree = this.contentFor;
|
|
631
496
|
return {
|
|
632
|
-
appJS: this.processAppJS().appJS,
|
|
633
|
-
htmlTree: this.htmlTree,
|
|
634
|
-
publicTree,
|
|
635
497
|
configTree,
|
|
636
|
-
|
|
498
|
+
contentForTree,
|
|
637
499
|
prevStageTree,
|
|
638
500
|
};
|
|
639
501
|
}
|
|
@@ -649,25 +511,25 @@ class CompatApp {
|
|
|
649
511
|
return packageCache.get(this.root);
|
|
650
512
|
}
|
|
651
513
|
}
|
|
652
|
-
async instantiate(
|
|
514
|
+
async instantiate(packageCache, configTree, contentForTree) {
|
|
653
515
|
let origAppPkg = this.appPackage();
|
|
654
516
|
let movedAppPkg = packageCache.withRewrittenDeps(origAppPkg);
|
|
655
517
|
let workingDir = (0, core_1.locateEmbroiderWorkingDir)(this.root);
|
|
656
|
-
return new compat_app_builder_1.CompatAppBuilder(
|
|
518
|
+
return new compat_app_builder_1.CompatAppBuilder(origAppPkg, movedAppPkg, this.options, this, configTree, contentForTree, packageCache.get((0, path_1.join)(workingDir, 'rewritten-packages', '@embroider', 'synthesized-vendor')), packageCache.get((0, path_1.join)(workingDir, 'rewritten-packages', '@embroider', 'synthesized-styles')));
|
|
657
519
|
}
|
|
658
520
|
asStage(prevStage) {
|
|
659
521
|
let resolve;
|
|
660
522
|
let promise = new Promise(r => (resolve = r));
|
|
661
523
|
let tree = () => {
|
|
662
524
|
let inTrees = this.inTrees(prevStage.tree);
|
|
663
|
-
return new core_1.WaitForTrees(inTrees, this.annotation, async (
|
|
525
|
+
return new core_1.WaitForTrees(inTrees, this.annotation, async (_treePaths) => {
|
|
664
526
|
if (!this.active) {
|
|
665
527
|
let { outputPath } = await prevStage.ready();
|
|
666
528
|
let packageCache = core_1.RewrittenPackageCache.shared('embroider', this.root);
|
|
667
|
-
this.active = await this.instantiate(
|
|
529
|
+
this.active = await this.instantiate(packageCache, inTrees.configTree, inTrees.contentForTree);
|
|
668
530
|
resolve({ outputPath });
|
|
669
531
|
}
|
|
670
|
-
await this.active.build(
|
|
532
|
+
await this.active.build();
|
|
671
533
|
});
|
|
672
534
|
};
|
|
673
535
|
return {
|
|
@@ -707,13 +569,13 @@ __decorate([
|
|
|
707
569
|
], CompatApp.prototype, "testConfig", null);
|
|
708
570
|
__decorate([
|
|
709
571
|
(0, typescript_memoize_1.Memoize)()
|
|
710
|
-
], CompatApp.prototype, "
|
|
572
|
+
], CompatApp.prototype, "contentFor", null);
|
|
711
573
|
__decorate([
|
|
712
574
|
(0, typescript_memoize_1.Memoize)()
|
|
713
575
|
], CompatApp.prototype, "configReplacePatterns", null);
|
|
714
576
|
__decorate([
|
|
715
577
|
(0, typescript_memoize_1.Memoize)()
|
|
716
|
-
], CompatApp.prototype, "
|
|
578
|
+
], CompatApp.prototype, "extraBabelPlugins", null);
|
|
717
579
|
__decorate([
|
|
718
580
|
(0, typescript_memoize_1.Memoize)()
|
|
719
581
|
], CompatApp.prototype, "babelMajorVersion", null);
|
|
@@ -726,12 +588,4 @@ __decorate([
|
|
|
726
588
|
__decorate([
|
|
727
589
|
(0, typescript_memoize_1.Memoize)()
|
|
728
590
|
], CompatApp.prototype, "appPackage", null);
|
|
729
|
-
function throwIfMissing(asset, needle, haystack, entryfile, context) {
|
|
730
|
-
if (!asset) {
|
|
731
|
-
throw new Error(`Could not find ${context}: "${needle}" in ${entryfile}. Found the following instead:\n${haystack
|
|
732
|
-
.map(asset => ` - ${asset}`)
|
|
733
|
-
.join('\n')}\n\nFor more information about this error: https://github.com/thoov/stitch/wiki/Could-not-find-asset-in-entry-file-error-help`);
|
|
734
|
-
}
|
|
735
|
-
return asset;
|
|
736
|
-
}
|
|
737
591
|
//# sourceMappingURL=compat-app.js.map
|