@embroider/compat 3.8.1-unstable.fc482ba → 3.8.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 +17 -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/options.d.ts +1 -2
- package/src/audit/options.js.map +1 -1
- package/src/audit-cli.d.ts +2 -0
- package/src/audit-cli.js +150 -0
- package/src/audit-cli.js.map +1 -0
- package/src/audit.d.ts +57 -7
- package/src/audit.js +301 -101
- 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-cli-fastboot.js +1 -0
- package/src/compat-adapters/ember-cli-fastboot.js.map +1 -1
- package/src/compat-adapters/ember-cli-mirage.js +1 -0
- package/src/compat-adapters/ember-cli-mirage.js.map +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 +1272 -110
- package/src/compat-app-builder.js.map +1 -1
- package/src/compat-app.d.ts +22 -4
- package/src/compat-app.js +218 -77
- package/src/compat-app.js.map +1 -1
- package/src/default-pipeline.d.ts +5 -4
- package/src/default-pipeline.js +46 -21
- 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 -2
- package/src/index.js +4 -3
- package/src/index.js.map +1 -1
- package/src/options.d.ts +40 -3
- package/src/options.js +11 -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 +15 -56
- 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 +302 -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,32 +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 = {
|
|
383
|
+
type: 'addon',
|
|
346
384
|
version: 2,
|
|
347
|
-
'implicit-scripts': this._implicitScripts.map(remapAsset)
|
|
385
|
+
'implicit-scripts': this._implicitScripts.map(remapAsset),
|
|
348
386
|
'implicit-styles': this._implicitStyles.map(remapAsset),
|
|
349
387
|
'implicit-test-scripts': this.legacyEmberAppInstance.legacyTestFilesToAppend.map(remapAsset),
|
|
350
388
|
'implicit-test-styles': this.legacyEmberAppInstance.vendorTestStaticStyles.map(remapAsset),
|
|
@@ -396,12 +434,13 @@ class CompatApp {
|
|
|
396
434
|
let styles = this.preprocessors.preprocessCss(nestedInput, '/app/styles', '/assets', options);
|
|
397
435
|
return new add_to_tree_1.default(styles, outputPath => {
|
|
398
436
|
let addonMeta = {
|
|
437
|
+
type: 'addon',
|
|
399
438
|
version: 2,
|
|
400
439
|
'public-assets': {},
|
|
401
440
|
};
|
|
402
441
|
let assetPath = (0, path_1.join)(outputPath, 'assets');
|
|
403
442
|
if ((0, fs_extra_1.pathExistsSync)(assetPath)) {
|
|
404
|
-
for (let file of (0,
|
|
443
|
+
for (let file of (0, fs_extra_1.readdirSync)(assetPath)) {
|
|
405
444
|
addonMeta['public-assets'][`./assets/${file}`] = `/assets/${file}`;
|
|
406
445
|
}
|
|
407
446
|
}
|
|
@@ -449,6 +488,19 @@ class CompatApp {
|
|
|
449
488
|
}
|
|
450
489
|
return './' + asset;
|
|
451
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
|
+
}
|
|
452
504
|
get htmlbarsPlugins() {
|
|
453
505
|
let plugins = (0, prepare_htmlbars_ast_plugins_1.default)(this.legacyEmberAppInstance.registry);
|
|
454
506
|
// even if the app was using @embroider/macros, we drop it from the config
|
|
@@ -456,6 +508,25 @@ class CompatApp {
|
|
|
456
508
|
plugins = plugins.filter((p) => !(0, node_1.isEmbroiderMacrosPlugin)(p));
|
|
457
509
|
return plugins;
|
|
458
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
|
+
}
|
|
459
530
|
get vendorTree() {
|
|
460
531
|
return this.ensureTree(this.legacyEmberAppInstance.trees.vendor);
|
|
461
532
|
}
|
|
@@ -479,6 +550,69 @@ class CompatApp {
|
|
|
479
550
|
get preprocessors() {
|
|
480
551
|
return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');
|
|
481
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
|
+
}
|
|
482
616
|
constructor(legacyEmberAppInstance, _options) {
|
|
483
617
|
this.legacyEmberAppInstance = legacyEmberAppInstance;
|
|
484
618
|
this.annotation = '@embroider/compat/app';
|
|
@@ -506,11 +640,17 @@ class CompatApp {
|
|
|
506
640
|
});
|
|
507
641
|
}
|
|
508
642
|
inTrees(prevStageTree) {
|
|
643
|
+
let publicTree = this.publicTree;
|
|
509
644
|
let configTree = this.config;
|
|
510
|
-
|
|
645
|
+
if (this.options.extraPublicTrees.length > 0) {
|
|
646
|
+
publicTree = (0, broccoli_merge_trees_1.default)([publicTree, ...this.options.extraPublicTrees].filter(Boolean));
|
|
647
|
+
}
|
|
511
648
|
return {
|
|
649
|
+
appJS: this.processAppJS().appJS,
|
|
650
|
+
htmlTree: this.htmlTree,
|
|
651
|
+
publicTree,
|
|
512
652
|
configTree,
|
|
513
|
-
|
|
653
|
+
appBootTree: this.appBoot,
|
|
514
654
|
prevStageTree,
|
|
515
655
|
};
|
|
516
656
|
}
|
|
@@ -526,25 +666,25 @@ class CompatApp {
|
|
|
526
666
|
return packageCache.get(this.root);
|
|
527
667
|
}
|
|
528
668
|
}
|
|
529
|
-
async instantiate(packageCache, configTree
|
|
669
|
+
async instantiate(root, packageCache, configTree) {
|
|
530
670
|
let origAppPkg = this.appPackage();
|
|
531
671
|
let movedAppPkg = packageCache.withRewrittenDeps(origAppPkg);
|
|
532
672
|
let workingDir = (0, core_1.locateEmbroiderWorkingDir)(this.root);
|
|
533
|
-
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')));
|
|
534
674
|
}
|
|
535
675
|
asStage(prevStage) {
|
|
536
676
|
let resolve;
|
|
537
677
|
let promise = new Promise(r => (resolve = r));
|
|
538
678
|
let tree = () => {
|
|
539
679
|
let inTrees = this.inTrees(prevStage.tree);
|
|
540
|
-
return new core_1.WaitForTrees(inTrees, this.annotation, async (
|
|
680
|
+
return new core_1.WaitForTrees(inTrees, this.annotation, async (treePaths) => {
|
|
541
681
|
if (!this.active) {
|
|
542
682
|
let { outputPath } = await prevStage.ready();
|
|
543
683
|
let packageCache = core_1.RewrittenPackageCache.shared('embroider', this.root);
|
|
544
|
-
this.active = await this.instantiate(packageCache, inTrees.configTree
|
|
684
|
+
this.active = await this.instantiate(outputPath, packageCache, inTrees.configTree);
|
|
545
685
|
resolve({ outputPath });
|
|
546
686
|
}
|
|
547
|
-
await this.active.build();
|
|
687
|
+
await this.active.build(treePaths);
|
|
548
688
|
});
|
|
549
689
|
};
|
|
550
690
|
return {
|
|
@@ -584,13 +724,13 @@ __decorate([
|
|
|
584
724
|
], CompatApp.prototype, "testConfig", null);
|
|
585
725
|
__decorate([
|
|
586
726
|
(0, typescript_memoize_1.Memoize)()
|
|
587
|
-
], CompatApp.prototype, "
|
|
727
|
+
], CompatApp.prototype, "appBoot", null);
|
|
588
728
|
__decorate([
|
|
589
729
|
(0, typescript_memoize_1.Memoize)()
|
|
590
730
|
], CompatApp.prototype, "configReplacePatterns", null);
|
|
591
731
|
__decorate([
|
|
592
732
|
(0, typescript_memoize_1.Memoize)()
|
|
593
|
-
], CompatApp.prototype, "
|
|
733
|
+
], CompatApp.prototype, "babelConfig", null);
|
|
594
734
|
__decorate([
|
|
595
735
|
(0, typescript_memoize_1.Memoize)()
|
|
596
736
|
], CompatApp.prototype, "babelMajorVersion", null);
|
|
@@ -603,11 +743,12 @@ __decorate([
|
|
|
603
743
|
__decorate([
|
|
604
744
|
(0, typescript_memoize_1.Memoize)()
|
|
605
745
|
], CompatApp.prototype, "appPackage", null);
|
|
606
|
-
function
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
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;
|
|
612
753
|
}
|
|
613
754
|
//# sourceMappingURL=compat-app.js.map
|