@embroider/compat 3.7.1-unstable.b89b741 → 3.7.1
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/package.json +12 -15
- package/src/audit/babel-visitor.js +1 -7
- package/src/audit/babel-visitor.js.map +1 -1
- package/src/audit/build.js.map +1 -1
- package/src/audit.d.ts +53 -6
- package/src/audit.js +285 -98
- package/src/audit.js.map +1 -1
- package/src/babel-plugin-adjust-imports.js +18 -19
- package/src/babel-plugin-adjust-imports.js.map +1 -1
- package/src/compat-adapters/@ember-data/debug.d.ts +6 -0
- package/src/compat-adapters/@ember-data/debug.js +22 -0
- package/src/compat-adapters/@ember-data/debug.js.map +1 -0
- package/src/compat-adapters/@ember-data/store.d.ts +5 -1
- package/src/compat-adapters/@ember-data/store.js +15 -3
- package/src/compat-adapters/@ember-data/store.js.map +1 -1
- package/src/compat-adapters/active-model-adapter.d.ts +1 -1
- package/src/compat-adapters/ember-asset-loader.d.ts +1 -1
- package/src/compat-adapters/ember-cli-addon-docs.d.ts +1 -1
- package/src/compat-adapters/ember-decorators.d.ts +1 -1
- package/src/compat-adapters/ember-macro-helpers.d.ts +4 -0
- package/src/compat-adapters/{ember-fetch.js → ember-macro-helpers.js} +4 -5
- package/src/compat-adapters/ember-macro-helpers.js.map +1 -0
- package/src/compat-adapters/ember-percy.d.ts +1 -1
- package/src/compat-adapters/ember-scroll-modifiers.d.ts +1 -1
- package/src/compat-adapters/ember-source.d.ts +6 -3
- package/src/compat-adapters/ember-source.js +41 -26
- package/src/compat-adapters/ember-source.js.map +1 -1
- package/src/compat-adapters/ember-test-selectors.d.ts +1 -1
- package/src/compat-addons.js +1 -1
- package/src/compat-addons.js.map +1 -1
- package/src/compat-app-builder.d.ts +64 -9
- package/src/compat-app-builder.js +1275 -110
- package/src/compat-app-builder.js.map +1 -1
- package/src/compat-app.d.ts +22 -4
- package/src/compat-app.js +216 -77
- package/src/compat-app.js.map +1 -1
- package/src/default-pipeline.d.ts +5 -3
- package/src/default-pipeline.js +49 -11
- package/src/default-pipeline.js.map +1 -1
- package/src/dependency-rules.d.ts +0 -1
- package/src/dependency-rules.js +11 -19
- package/src/dependency-rules.js.map +1 -1
- package/src/detect-babel-plugins.d.ts +0 -1
- package/src/detect-babel-plugins.js +0 -14
- package/src/detect-babel-plugins.js.map +1 -1
- package/src/index.d.ts +2 -1
- package/src/index.js +4 -2
- package/src/index.js.map +1 -1
- package/src/options.d.ts +3 -3
- package/src/options.js +2 -3
- package/src/options.js.map +1 -1
- package/src/rename-require-plugin.d.ts +1 -0
- package/src/rename-require-plugin.js +15 -0
- package/src/rename-require-plugin.js.map +1 -0
- package/src/resolver-transform.js +9 -50
- package/src/resolver-transform.js.map +1 -1
- package/src/standalone-addon-build.js +15 -6
- package/src/standalone-addon-build.js.map +1 -1
- package/src/sync-dir.d.ts +8 -0
- package/src/sync-dir.js +68 -0
- package/src/sync-dir.js.map +1 -0
- package/src/template-tag-codemod.d.ts +13 -0
- package/src/template-tag-codemod.js +304 -0
- package/src/template-tag-codemod.js.map +1 -0
- package/src/v1-appboot.d.ts +14 -0
- package/src/v1-appboot.js +47 -0
- package/src/v1-appboot.js.map +1 -0
- package/src/v1-config.d.ts +8 -0
- package/src/v1-config.js +51 -1
- package/src/v1-config.js.map +1 -1
- package/babel.js +0 -1
- package/src/babel.d.ts +0 -17
- package/src/babel.js +0 -146
- package/src/babel.js.map +0 -1
- package/src/compat-adapters/ember-fetch.d.ts +0 -5
- package/src/compat-adapters/ember-fetch.js.map +0 -1
- package/src/compat-adapters/ember-resolver.d.ts +0 -4
- package/src/compat-adapters/ember-resolver.js +0 -21
- package/src/compat-adapters/ember-resolver.js.map +0 -1
- package/src/content-for-config.d.ts +0 -11
- package/src/content-for-config.js +0 -66
- package/src/content-for-config.js.map +0 -1
- package/src/http-audit.d.ts +0 -13
- package/src/http-audit.js +0 -60
- package/src/http-audit.js.map +0 -1
- package/src/module-visitor.d.ts +0 -52
- package/src/module-visitor.js +0 -285
- package/src/module-visitor.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"));
|
|
22
21
|
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"));
|
|
30
31
|
const detect_babel_plugins_1 = require("./detect-babel-plugins");
|
|
31
32
|
const prepare_htmlbars_ast_plugins_1 = __importDefault(require("./prepare-htmlbars-ast-plugins"));
|
|
32
33
|
const fs_1 = require("fs");
|
|
33
34
|
const semver_1 = __importDefault(require("semver"));
|
|
34
35
|
const compat_app_builder_1 = require("./compat-app-builder");
|
|
35
|
-
const walk_sync_1 = __importDefault(require("walk-sync"));
|
|
36
36
|
const broccoli_file_creator_1 = __importDefault(require("broccoli-file-creator"));
|
|
37
37
|
// This runs at broccoli-pipeline-construction time, whereas the
|
|
38
38
|
// CompatAppBuilder instance only becomes available during tree-building time.
|
|
@@ -78,6 +78,9 @@ class CompatApp {
|
|
|
78
78
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
79
79
|
return require(resolve_1.default.sync(specifier, { basedir: this.emberCLILocation }));
|
|
80
80
|
}
|
|
81
|
+
get configReplace() {
|
|
82
|
+
return this.requireFromEmberCLI('broccoli-config-replace');
|
|
83
|
+
}
|
|
81
84
|
get configLoader() {
|
|
82
85
|
return this.requireFromEmberCLI('broccoli-config-loader');
|
|
83
86
|
}
|
|
@@ -111,21 +114,20 @@ class CompatApp {
|
|
|
111
114
|
return new v1_config_1.V1Config(this.configTree, 'test');
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
|
-
get contentFor() {
|
|
115
|
-
const configPaths = [
|
|
116
|
-
{ file: '/index.html', path: (0, path_1.join)('environments', `${this.legacyEmberAppInstance.env}.json`) },
|
|
117
|
-
];
|
|
118
|
-
if (this.shouldBuildTests)
|
|
119
|
-
configPaths.push({ file: '/tests/index.html', path: (0, path_1.join)('environments', `test.json`) });
|
|
120
|
-
return new content_for_config_1.default(this.configTree, {
|
|
121
|
-
availableContentForTypes: this.options.availableContentForTypes,
|
|
122
|
-
configPaths,
|
|
123
|
-
pattern: this.filteredPatternsByContentFor.contentFor,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
117
|
get autoRun() {
|
|
127
118
|
return this.legacyEmberAppInstance.options.autoRun;
|
|
128
119
|
}
|
|
120
|
+
get appBoot() {
|
|
121
|
+
let env = this.legacyEmberAppInstance.env;
|
|
122
|
+
let appBootContentTree = new v1_appboot_1.WriteV1AppBoot();
|
|
123
|
+
let patterns = this.configReplacePatterns;
|
|
124
|
+
appBootContentTree = new this.configReplace(appBootContentTree, this.configTree, {
|
|
125
|
+
configPath: (0, path_1.join)('environments', `${env}.json`),
|
|
126
|
+
files: ['config/app-boot.js'],
|
|
127
|
+
patterns,
|
|
128
|
+
});
|
|
129
|
+
return new v1_appboot_1.ReadV1AppBoot(appBootContentTree);
|
|
130
|
+
}
|
|
129
131
|
get storeConfigInMeta() {
|
|
130
132
|
return this.legacyEmberAppInstance.options.storeConfigInMeta;
|
|
131
133
|
}
|
|
@@ -136,36 +138,93 @@ class CompatApp {
|
|
|
136
138
|
storeConfigInMeta: this.storeConfigInMeta,
|
|
137
139
|
});
|
|
138
140
|
}
|
|
139
|
-
get
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
get htmlTree() {
|
|
142
|
+
if (this.legacyEmberAppInstance.tests) {
|
|
143
|
+
return (0, broccoli_merge_trees_1.default)([this.indexTree, this.testIndexTree]);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
return this.indexTree;
|
|
147
|
+
}
|
|
145
148
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
get indexTree() {
|
|
150
|
+
let indexFilePath = this.legacyEmberAppInstance.options.outputPaths.app.html;
|
|
151
|
+
let index = (0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.app, {
|
|
152
|
+
allowEmpty: true,
|
|
153
|
+
include: [`index.html`],
|
|
154
|
+
getDestinationPath: () => indexFilePath,
|
|
155
|
+
annotation: 'app/index.html',
|
|
156
|
+
});
|
|
157
|
+
return new this.configReplace(index, this.configTree, {
|
|
158
|
+
configPath: (0, path_1.join)('environments', `${this.legacyEmberAppInstance.env}.json`),
|
|
159
|
+
files: [indexFilePath],
|
|
160
|
+
patterns: this.configReplacePatterns,
|
|
161
|
+
annotation: 'ConfigReplace/indexTree',
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
get testIndexTree() {
|
|
165
|
+
let index = (0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.tests, {
|
|
166
|
+
allowEmpty: true,
|
|
167
|
+
include: [`index.html`],
|
|
168
|
+
destDir: 'tests',
|
|
169
|
+
annotation: 'tests/index.html',
|
|
170
|
+
});
|
|
171
|
+
return new this.configReplace(index, this.configTree, {
|
|
172
|
+
configPath: (0, path_1.join)('environments', `test.json`),
|
|
173
|
+
files: ['tests/index.html'],
|
|
174
|
+
patterns: this.configReplacePatterns,
|
|
175
|
+
annotation: 'ConfigReplace/testIndexTree',
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
babelConfig() {
|
|
179
|
+
// this finds all the built-in babel configuration that comes with ember-cli-babel
|
|
180
|
+
const babelAddon = this.legacyEmberAppInstance.project.findAddonByName('ember-cli-babel');
|
|
181
|
+
const babelConfig = babelAddon.buildBabelOptions({
|
|
182
|
+
'ember-cli-babel': {
|
|
183
|
+
...this.legacyEmberAppInstance.options['ember-cli-babel'],
|
|
184
|
+
includeExternalHelpers: true,
|
|
185
|
+
compileModules: false,
|
|
186
|
+
disableDebugTooling: false,
|
|
187
|
+
disablePresetEnv: false,
|
|
188
|
+
disableEmberModulesAPIPolyfill: false,
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
let plugins = babelConfig.plugins;
|
|
192
|
+
let presets = babelConfig.presets;
|
|
193
|
+
// this finds any custom babel configuration that's on the app (either
|
|
194
|
+
// because the app author explicitly added some, or because addons have
|
|
195
|
+
// pushed plugins into it).
|
|
150
196
|
let appBabel = this.legacyEmberAppInstance.options.babel;
|
|
151
197
|
if (appBabel) {
|
|
152
198
|
if (appBabel.plugins) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// similarly, if the app was already using an inline template compiler
|
|
158
|
-
// babel plugin, we remove it here because we have our own
|
|
159
|
-
// always-installed version of that (v2 addons are allowed to assume it
|
|
160
|
-
// will be present in the final app build, the app doesn't get to turn
|
|
161
|
-
// that off or configure it.)
|
|
162
|
-
!(0, detect_babel_plugins_1.isInlinePrecompilePlugin)(p) &&
|
|
163
|
-
!(0, detect_babel_plugins_1.isEmberAutoImportDynamic)(p) &&
|
|
164
|
-
!(0, detect_babel_plugins_1.isHtmlbarColocation)(p));
|
|
165
|
-
});
|
|
199
|
+
plugins = appBabel.plugins.concat(plugins);
|
|
200
|
+
}
|
|
201
|
+
if (appBabel.presets) {
|
|
202
|
+
presets = appBabel.presets.concat(presets);
|
|
166
203
|
}
|
|
167
204
|
}
|
|
168
|
-
|
|
205
|
+
plugins = plugins.filter(p => {
|
|
206
|
+
// even if the app was using @embroider/macros, we drop it from the config
|
|
207
|
+
// here in favor of our globally-configured one.
|
|
208
|
+
return (!(0, node_1.isEmbroiderMacrosPlugin)(p) &&
|
|
209
|
+
// similarly, if the app was already using an inline template compiler
|
|
210
|
+
// babel plugin, we remove it here because we have our own
|
|
211
|
+
// always-installed version of that (v2 addons are allowed to assume it
|
|
212
|
+
// will be present in the final app build, the app doesn't get to turn
|
|
213
|
+
// that off or configure it.)
|
|
214
|
+
!(0, detect_babel_plugins_1.isInlinePrecompilePlugin)(p) &&
|
|
215
|
+
!(0, detect_babel_plugins_1.isEmberAutoImportDynamic)(p));
|
|
216
|
+
});
|
|
217
|
+
const config = {
|
|
218
|
+
babelrc: false,
|
|
219
|
+
plugins,
|
|
220
|
+
presets,
|
|
221
|
+
// this is here because broccoli-middleware can't render a codeFrame full
|
|
222
|
+
// of terminal codes. It would be nice to add something like
|
|
223
|
+
// https://github.com/mmalecki/ansispan to broccoli-middleware so we can
|
|
224
|
+
// leave color enabled.
|
|
225
|
+
highlightCode: false,
|
|
226
|
+
};
|
|
227
|
+
return config;
|
|
169
228
|
}
|
|
170
229
|
babelMajorVersion() {
|
|
171
230
|
var _a, _b;
|
|
@@ -319,33 +378,11 @@ class CompatApp {
|
|
|
319
378
|
(0, fs_extra_1.ensureDirSync)((0, path_1.dirname)(destPath));
|
|
320
379
|
(0, fs_extra_1.copySync)(sourcePath, destPath);
|
|
321
380
|
}
|
|
322
|
-
if (this.shouldBuildTests) {
|
|
323
|
-
(0, fs_extra_1.writeFileSync)((0, path_1.join)(outputPath, 'testem.js'), `/*
|
|
324
|
-
* This is dummy file that exists for the sole purpose
|
|
325
|
-
* of allowing tests to run directly in the browser as
|
|
326
|
-
* well as by Testem.
|
|
327
|
-
*
|
|
328
|
-
* Testem is configured to run tests directly against
|
|
329
|
-
* the test build of index.html, which requires a
|
|
330
|
-
* snippet to load the testem.js file:
|
|
331
|
-
* <script src="/testem.js"></script>
|
|
332
|
-
* This has to go before the qunit framework and app
|
|
333
|
-
* tests are loaded.
|
|
334
|
-
*
|
|
335
|
-
* Testem internally supplies this file. However, if you
|
|
336
|
-
* run the tests directly in the browser (localhost:8000/tests),
|
|
337
|
-
* this file does not exist.
|
|
338
|
-
*
|
|
339
|
-
* Hence the purpose of this fake file. This file is served
|
|
340
|
-
* directly from the express server to satisify the script load.
|
|
341
|
-
*/`);
|
|
342
|
-
this._publicAssets['/testem.js'] = './testem.js';
|
|
343
|
-
}
|
|
344
381
|
let remapAsset = this.remapAsset.bind(this);
|
|
345
382
|
let addonMeta = {
|
|
346
383
|
type: 'addon',
|
|
347
384
|
version: 2,
|
|
348
|
-
'implicit-scripts': this._implicitScripts.map(remapAsset)
|
|
385
|
+
'implicit-scripts': this._implicitScripts.map(remapAsset),
|
|
349
386
|
'implicit-styles': this._implicitStyles.map(remapAsset),
|
|
350
387
|
'implicit-test-scripts': this.legacyEmberAppInstance.legacyTestFilesToAppend.map(remapAsset),
|
|
351
388
|
'implicit-test-styles': this.legacyEmberAppInstance.vendorTestStaticStyles.map(remapAsset),
|
|
@@ -403,7 +440,7 @@ class CompatApp {
|
|
|
403
440
|
};
|
|
404
441
|
let assetPath = (0, path_1.join)(outputPath, 'assets');
|
|
405
442
|
if ((0, fs_extra_1.pathExistsSync)(assetPath)) {
|
|
406
|
-
for (let file of (0,
|
|
443
|
+
for (let file of (0, fs_extra_1.readdirSync)(assetPath)) {
|
|
407
444
|
addonMeta['public-assets'][`./assets/${file}`] = `/assets/${file}`;
|
|
408
445
|
}
|
|
409
446
|
}
|
|
@@ -451,6 +488,19 @@ class CompatApp {
|
|
|
451
488
|
}
|
|
452
489
|
return './' + asset;
|
|
453
490
|
}
|
|
491
|
+
preprocessJS(tree) {
|
|
492
|
+
// we're saving all our babel compilation for the final stage packager
|
|
493
|
+
this.legacyEmberAppInstance.registry.remove('js', 'ember-cli-babel');
|
|
494
|
+
// auto-import is supported natively so we don't need it here
|
|
495
|
+
this.legacyEmberAppInstance.registry.remove('js', 'ember-auto-import-analyzer');
|
|
496
|
+
tree = (0, broccoli_funnel_1.default)(tree, { destDir: this.name });
|
|
497
|
+
tree = this.preprocessors.preprocessJs(tree, `/`, '/', {
|
|
498
|
+
annotation: 'v1-app-preprocess-js',
|
|
499
|
+
registry: this.legacyEmberAppInstance.registry,
|
|
500
|
+
});
|
|
501
|
+
tree = (0, broccoli_funnel_1.default)(tree, { srcDir: this.name });
|
|
502
|
+
return tree;
|
|
503
|
+
}
|
|
454
504
|
get htmlbarsPlugins() {
|
|
455
505
|
let plugins = (0, prepare_htmlbars_ast_plugins_1.default)(this.legacyEmberAppInstance.registry);
|
|
456
506
|
// even if the app was using @embroider/macros, we drop it from the config
|
|
@@ -458,6 +508,25 @@ class CompatApp {
|
|
|
458
508
|
plugins = plugins.filter((p) => !(0, node_1.isEmbroiderMacrosPlugin)(p));
|
|
459
509
|
return plugins;
|
|
460
510
|
}
|
|
511
|
+
// our own appTree. Not to be confused with the one that combines the app js
|
|
512
|
+
// from all addons too.
|
|
513
|
+
get appTree() {
|
|
514
|
+
return this.preprocessJS((0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.app, {
|
|
515
|
+
exclude: ['styles/**', '*.html'],
|
|
516
|
+
}));
|
|
517
|
+
}
|
|
518
|
+
get testsTree() {
|
|
519
|
+
if (this.shouldBuildTests && this.legacyEmberAppInstance.trees.tests) {
|
|
520
|
+
return this.preprocessJS((0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.tests, {
|
|
521
|
+
destDir: 'tests',
|
|
522
|
+
}));
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
get lintTree() {
|
|
526
|
+
if (this.shouldBuildTests) {
|
|
527
|
+
return this.legacyEmberAppInstance.getLintTests();
|
|
528
|
+
}
|
|
529
|
+
}
|
|
461
530
|
get vendorTree() {
|
|
462
531
|
return this.ensureTree(this.legacyEmberAppInstance.trees.vendor);
|
|
463
532
|
}
|
|
@@ -481,6 +550,69 @@ class CompatApp {
|
|
|
481
550
|
get preprocessors() {
|
|
482
551
|
return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');
|
|
483
552
|
}
|
|
553
|
+
get publicTree() {
|
|
554
|
+
return this.ensureTree(this.legacyEmberAppInstance.trees.public);
|
|
555
|
+
}
|
|
556
|
+
processAppJS() {
|
|
557
|
+
let appTree = this.appTree;
|
|
558
|
+
let testsTree = this.testsTree;
|
|
559
|
+
let lintTree = this.lintTree;
|
|
560
|
+
let config = new v1_config_1.WriteV1Config(this.config, this.storeConfigInMeta, this.testConfig);
|
|
561
|
+
let patterns = this.configReplacePatterns;
|
|
562
|
+
let configReplaced = new this.configReplace(config, this.configTree, {
|
|
563
|
+
configPath: (0, path_1.join)('environments', `${this.legacyEmberAppInstance.env}.json`),
|
|
564
|
+
files: ['config/environment.js'],
|
|
565
|
+
patterns,
|
|
566
|
+
});
|
|
567
|
+
let trees = [];
|
|
568
|
+
trees.push(appTree);
|
|
569
|
+
trees.push(new synthesize_template_only_components_1.default(appTree, { allowedPaths: ['components'], templateExtensions: ['.hbs'] }));
|
|
570
|
+
trees.push(configReplaced);
|
|
571
|
+
if (testsTree) {
|
|
572
|
+
trees.push(testsTree);
|
|
573
|
+
}
|
|
574
|
+
if (lintTree) {
|
|
575
|
+
trees.push(lintTree);
|
|
576
|
+
}
|
|
577
|
+
return {
|
|
578
|
+
appJS: (0, broccoli_merge_trees_1.default)(trees, { overwrite: true }),
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
withoutRootURL(src) {
|
|
582
|
+
let rootURL = this.config.readConfig().rootURL;
|
|
583
|
+
if ((src.startsWith(rootURL) && rootURL) || (!rootURL && !src.startsWith('/'))) {
|
|
584
|
+
src = '/' + src.slice(rootURL.length);
|
|
585
|
+
}
|
|
586
|
+
else if (src.startsWith('/' + rootURL)) {
|
|
587
|
+
src = src.slice(rootURL.length);
|
|
588
|
+
}
|
|
589
|
+
return src;
|
|
590
|
+
}
|
|
591
|
+
findAppScript(scripts, entrypoint) {
|
|
592
|
+
let appJS = scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.app.js);
|
|
593
|
+
return throwIfMissing(appJS, this.legacyEmberAppInstance.options.outputPaths.app.js, scripts.map(s => s.src), entrypoint, 'app javascript');
|
|
594
|
+
}
|
|
595
|
+
findAppStyles(styles, entrypoint) {
|
|
596
|
+
let style = styles.find(style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.app.css.app);
|
|
597
|
+
return throwIfMissing(style, this.legacyEmberAppInstance.options.outputPaths.app.css.app, styles.map(s => s.href), entrypoint, 'app css');
|
|
598
|
+
}
|
|
599
|
+
findVendorScript(scripts, entrypoint) {
|
|
600
|
+
let vendor = scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.vendor.js);
|
|
601
|
+
return throwIfMissing(vendor, this.legacyEmberAppInstance.options.outputPaths.vendor.js, scripts.map(s => s.src), entrypoint, 'vendor javascript');
|
|
602
|
+
}
|
|
603
|
+
findVendorStyles(styles, entrypoint) {
|
|
604
|
+
let vendorStyle = styles.find(style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.vendor.css);
|
|
605
|
+
return throwIfMissing(vendorStyle, this.legacyEmberAppInstance.options.outputPaths.vendor.css, styles.map(s => s.href), entrypoint, 'vendor css');
|
|
606
|
+
}
|
|
607
|
+
findTestSupportStyles(styles) {
|
|
608
|
+
return styles.find(style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.testSupport.css);
|
|
609
|
+
}
|
|
610
|
+
findTestSupportScript(scripts) {
|
|
611
|
+
return scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.testSupport.js.testSupport);
|
|
612
|
+
}
|
|
613
|
+
findTestScript(scripts) {
|
|
614
|
+
return scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.tests.js);
|
|
615
|
+
}
|
|
484
616
|
constructor(legacyEmberAppInstance, _options) {
|
|
485
617
|
this.legacyEmberAppInstance = legacyEmberAppInstance;
|
|
486
618
|
this.annotation = '@embroider/compat/app';
|
|
@@ -508,11 +640,17 @@ class CompatApp {
|
|
|
508
640
|
});
|
|
509
641
|
}
|
|
510
642
|
inTrees(prevStageTree) {
|
|
643
|
+
let publicTree = this.publicTree;
|
|
511
644
|
let configTree = this.config;
|
|
512
|
-
|
|
645
|
+
if (this.options.extraPublicTrees.length > 0) {
|
|
646
|
+
publicTree = (0, broccoli_merge_trees_1.default)([publicTree, ...this.options.extraPublicTrees].filter(Boolean));
|
|
647
|
+
}
|
|
513
648
|
return {
|
|
649
|
+
appJS: this.processAppJS().appJS,
|
|
650
|
+
htmlTree: this.htmlTree,
|
|
651
|
+
publicTree,
|
|
514
652
|
configTree,
|
|
515
|
-
|
|
653
|
+
appBootTree: this.appBoot,
|
|
516
654
|
prevStageTree,
|
|
517
655
|
};
|
|
518
656
|
}
|
|
@@ -528,25 +666,25 @@ class CompatApp {
|
|
|
528
666
|
return packageCache.get(this.root);
|
|
529
667
|
}
|
|
530
668
|
}
|
|
531
|
-
async instantiate(packageCache, configTree
|
|
669
|
+
async instantiate(root, packageCache, configTree) {
|
|
532
670
|
let origAppPkg = this.appPackage();
|
|
533
671
|
let movedAppPkg = packageCache.withRewrittenDeps(origAppPkg);
|
|
534
672
|
let workingDir = (0, core_1.locateEmbroiderWorkingDir)(this.root);
|
|
535
|
-
return new compat_app_builder_1.CompatAppBuilder(origAppPkg, movedAppPkg, this.options, this, configTree,
|
|
673
|
+
return new compat_app_builder_1.CompatAppBuilder(root, origAppPkg, movedAppPkg, this.options, this, configTree, packageCache.get((0, path_1.join)(workingDir, 'rewritten-packages', '@embroider', 'synthesized-vendor')), packageCache.get((0, path_1.join)(workingDir, 'rewritten-packages', '@embroider', 'synthesized-styles')));
|
|
536
674
|
}
|
|
537
675
|
asStage(prevStage) {
|
|
538
676
|
let resolve;
|
|
539
677
|
let promise = new Promise(r => (resolve = r));
|
|
540
678
|
let tree = () => {
|
|
541
679
|
let inTrees = this.inTrees(prevStage.tree);
|
|
542
|
-
return new core_1.WaitForTrees(inTrees, this.annotation, async (
|
|
680
|
+
return new core_1.WaitForTrees(inTrees, this.annotation, async (treePaths) => {
|
|
543
681
|
if (!this.active) {
|
|
544
682
|
let { outputPath } = await prevStage.ready();
|
|
545
683
|
let packageCache = core_1.RewrittenPackageCache.shared('embroider', this.root);
|
|
546
|
-
this.active = await this.instantiate(packageCache, inTrees.configTree
|
|
684
|
+
this.active = await this.instantiate(outputPath, packageCache, inTrees.configTree);
|
|
547
685
|
resolve({ outputPath });
|
|
548
686
|
}
|
|
549
|
-
await this.active.build();
|
|
687
|
+
await this.active.build(treePaths);
|
|
550
688
|
});
|
|
551
689
|
};
|
|
552
690
|
return {
|
|
@@ -586,13 +724,13 @@ __decorate([
|
|
|
586
724
|
], CompatApp.prototype, "testConfig", null);
|
|
587
725
|
__decorate([
|
|
588
726
|
(0, typescript_memoize_1.Memoize)()
|
|
589
|
-
], CompatApp.prototype, "
|
|
727
|
+
], CompatApp.prototype, "appBoot", null);
|
|
590
728
|
__decorate([
|
|
591
729
|
(0, typescript_memoize_1.Memoize)()
|
|
592
730
|
], CompatApp.prototype, "configReplacePatterns", null);
|
|
593
731
|
__decorate([
|
|
594
732
|
(0, typescript_memoize_1.Memoize)()
|
|
595
|
-
], CompatApp.prototype, "
|
|
733
|
+
], CompatApp.prototype, "babelConfig", null);
|
|
596
734
|
__decorate([
|
|
597
735
|
(0, typescript_memoize_1.Memoize)()
|
|
598
736
|
], CompatApp.prototype, "babelMajorVersion", null);
|
|
@@ -605,11 +743,12 @@ __decorate([
|
|
|
605
743
|
__decorate([
|
|
606
744
|
(0, typescript_memoize_1.Memoize)()
|
|
607
745
|
], CompatApp.prototype, "appPackage", null);
|
|
608
|
-
function
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
746
|
+
function throwIfMissing(asset, needle, haystack, entryfile, context) {
|
|
747
|
+
if (!asset) {
|
|
748
|
+
throw new Error(`Could not find ${context}: "${needle}" in ${entryfile}. Found the following instead:\n${haystack
|
|
749
|
+
.map(asset => ` - ${asset}`)
|
|
750
|
+
.join('\n')}\n\nFor more information about this error: https://github.com/thoov/stitch/wiki/Could-not-find-asset-in-entry-file-error-help`);
|
|
751
|
+
}
|
|
752
|
+
return asset;
|
|
614
753
|
}
|
|
615
754
|
//# sourceMappingURL=compat-app.js.map
|