@embroider/compat 3.6.5 → 3.7.1-unstable.0aa8fc6

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.
Files changed (88) hide show
  1. package/babel.js +1 -0
  2. package/package.json +14 -11
  3. package/src/audit/babel-visitor.js +7 -1
  4. package/src/audit/babel-visitor.js.map +1 -1
  5. package/src/audit/build.js.map +1 -1
  6. package/src/audit.d.ts +6 -53
  7. package/src/audit.js +98 -285
  8. package/src/audit.js.map +1 -1
  9. package/src/babel-plugin-adjust-imports.js +19 -18
  10. package/src/babel-plugin-adjust-imports.js.map +1 -1
  11. package/src/babel.d.ts +17 -0
  12. package/src/babel.js +146 -0
  13. package/src/babel.js.map +1 -0
  14. package/src/compat-adapters/@ember-data/store.d.ts +1 -5
  15. package/src/compat-adapters/@ember-data/store.js +3 -15
  16. package/src/compat-adapters/@ember-data/store.js.map +1 -1
  17. package/src/compat-adapters/active-model-adapter.d.ts +1 -1
  18. package/src/compat-adapters/ember-asset-loader.d.ts +1 -1
  19. package/src/compat-adapters/ember-cli-addon-docs.d.ts +1 -1
  20. package/src/compat-adapters/ember-decorators.d.ts +1 -1
  21. package/src/compat-adapters/ember-fetch.d.ts +5 -0
  22. package/src/compat-adapters/{ember-macro-helpers.js → ember-fetch.js} +5 -4
  23. package/src/compat-adapters/ember-fetch.js.map +1 -0
  24. package/src/compat-adapters/ember-percy.d.ts +1 -1
  25. package/src/compat-adapters/ember-resolver.d.ts +4 -0
  26. package/src/compat-adapters/ember-resolver.js +21 -0
  27. package/src/compat-adapters/ember-resolver.js.map +1 -0
  28. package/src/compat-adapters/ember-scroll-modifiers.d.ts +1 -1
  29. package/src/compat-adapters/ember-source.d.ts +3 -6
  30. package/src/compat-adapters/ember-source.js +26 -41
  31. package/src/compat-adapters/ember-source.js.map +1 -1
  32. package/src/compat-adapters/ember-test-selectors.d.ts +1 -1
  33. package/src/compat-addons.js +1 -1
  34. package/src/compat-addons.js.map +1 -1
  35. package/src/compat-app-builder.d.ts +9 -64
  36. package/src/compat-app-builder.js +110 -1275
  37. package/src/compat-app-builder.js.map +1 -1
  38. package/src/compat-app.d.ts +4 -22
  39. package/src/compat-app.js +94 -216
  40. package/src/compat-app.js.map +1 -1
  41. package/src/content-for-config.d.ts +11 -0
  42. package/src/content-for-config.js +66 -0
  43. package/src/content-for-config.js.map +1 -0
  44. package/src/default-pipeline.d.ts +3 -5
  45. package/src/default-pipeline.js +11 -49
  46. package/src/default-pipeline.js.map +1 -1
  47. package/src/dependency-rules.d.ts +1 -0
  48. package/src/dependency-rules.js +19 -11
  49. package/src/dependency-rules.js.map +1 -1
  50. package/src/detect-babel-plugins.d.ts +1 -0
  51. package/src/detect-babel-plugins.js +14 -0
  52. package/src/detect-babel-plugins.js.map +1 -1
  53. package/src/http-audit.d.ts +13 -0
  54. package/src/http-audit.js +60 -0
  55. package/src/http-audit.js.map +1 -0
  56. package/src/index.d.ts +1 -2
  57. package/src/index.js +2 -4
  58. package/src/index.js.map +1 -1
  59. package/src/module-visitor.d.ts +52 -0
  60. package/src/module-visitor.js +285 -0
  61. package/src/module-visitor.js.map +1 -0
  62. package/src/options.d.ts +3 -3
  63. package/src/options.js +3 -2
  64. package/src/options.js.map +1 -1
  65. package/src/resolver-transform.js +50 -9
  66. package/src/resolver-transform.js.map +1 -1
  67. package/src/standalone-addon-build.js +6 -15
  68. package/src/standalone-addon-build.js.map +1 -1
  69. package/src/v1-config.d.ts +0 -8
  70. package/src/v1-config.js +1 -51
  71. package/src/v1-config.js.map +1 -1
  72. package/src/compat-adapters/@ember-data/debug.d.ts +0 -6
  73. package/src/compat-adapters/@ember-data/debug.js +0 -22
  74. package/src/compat-adapters/@ember-data/debug.js.map +0 -1
  75. package/src/compat-adapters/ember-macro-helpers.d.ts +0 -4
  76. package/src/compat-adapters/ember-macro-helpers.js.map +0 -1
  77. package/src/rename-require-plugin.d.ts +0 -1
  78. package/src/rename-require-plugin.js +0 -15
  79. package/src/rename-require-plugin.js.map +0 -1
  80. package/src/sync-dir.d.ts +0 -8
  81. package/src/sync-dir.js +0 -68
  82. package/src/sync-dir.js.map +0 -1
  83. package/src/template-tag-codemod.d.ts +0 -13
  84. package/src/template-tag-codemod.js +0 -304
  85. package/src/template-tag-codemod.js.map +0 -1
  86. package/src/v1-appboot.d.ts +0 -14
  87. package/src/v1-appboot.js +0 -47
  88. 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,13 @@ 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
+ const broccoli_file_creator_1 = __importDefault(require("broccoli-file-creator"));
36
37
  // This runs at broccoli-pipeline-construction time, whereas the
37
38
  // CompatAppBuilder instance only becomes available during tree-building time.
38
39
  class CompatApp {
@@ -77,9 +78,6 @@ class CompatApp {
77
78
  // eslint-disable-next-line @typescript-eslint/no-require-imports
78
79
  return require(resolve_1.default.sync(specifier, { basedir: this.emberCLILocation }));
79
80
  }
80
- get configReplace() {
81
- return this.requireFromEmberCLI('broccoli-config-replace');
82
- }
83
81
  get configLoader() {
84
82
  return this.requireFromEmberCLI('broccoli-config-loader');
85
83
  }
@@ -113,20 +111,21 @@ class CompatApp {
113
111
  return new v1_config_1.V1Config(this.configTree, 'test');
114
112
  }
115
113
  }
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
+ }
116
126
  get autoRun() {
117
127
  return this.legacyEmberAppInstance.options.autoRun;
118
128
  }
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
129
  get storeConfigInMeta() {
131
130
  return this.legacyEmberAppInstance.options.storeConfigInMeta;
132
131
  }
@@ -137,93 +136,36 @@ class CompatApp {
137
136
  storeConfigInMeta: this.storeConfigInMeta,
138
137
  });
139
138
  }
140
- get htmlTree() {
141
- if (this.legacyEmberAppInstance.tests) {
142
- return (0, broccoli_merge_trees_1.default)([this.indexTree, this.testIndexTree]);
143
- }
144
- else {
145
- return this.indexTree;
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
- });
139
+ get filteredPatternsByContentFor() {
140
+ const filter = '/{{content-for [\'"](.+?)["\']}}/g';
141
+ return {
142
+ contentFor: this.configReplacePatterns.find((pattern) => filter.includes(pattern.match.toString())),
143
+ others: this.configReplacePatterns.filter((pattern) => !filter.includes(pattern.match.toString())),
144
+ };
176
145
  }
177
- babelConfig() {
178
- // this finds all the built-in babel configuration that comes with ember-cli-babel
179
- const babelAddon = this.legacyEmberAppInstance.project.findAddonByName('ember-cli-babel');
180
- const babelConfig = babelAddon.buildBabelOptions({
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).
146
+ extraBabelPlugins() {
147
+ // this finds any custom babel plugins on the app (either because the app
148
+ // author explicitly added some, or because addons have pushed plugins into
149
+ // it).
195
150
  let appBabel = this.legacyEmberAppInstance.options.babel;
196
151
  if (appBabel) {
197
152
  if (appBabel.plugins) {
198
- plugins = appBabel.plugins.concat(plugins);
199
- }
200
- if (appBabel.presets) {
201
- presets = appBabel.presets.concat(presets);
153
+ return appBabel.plugins.filter(p => {
154
+ // even if the app was using @embroider/macros, we drop it from the config
155
+ // here in favor of our globally-configured one.
156
+ return (!(0, node_1.isEmbroiderMacrosPlugin)(p) &&
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
+ });
202
166
  }
203
167
  }
204
- plugins = plugins.filter(p => {
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;
168
+ return [];
227
169
  }
228
170
  babelMajorVersion() {
229
171
  var _a, _b;
@@ -283,11 +225,27 @@ class CompatApp {
283
225
  }
284
226
  }
285
227
  combinedVendor(addonTrees) {
228
+ var _a, _b;
286
229
  let trees = addonTrees.map(tree => (0, broccoli_funnel_1.default)(tree, {
287
230
  allowEmpty: true,
288
231
  srcDir: 'vendor',
289
232
  destDir: 'vendor',
290
233
  }));
234
+ let emberSource = this.legacyEmberAppInstance.project.addons.find(a => a.name === 'ember-source');
235
+ if (emberSource && ((_b = (_a = emberSource.pkg['ember-addon']) === null || _a === void 0 ? void 0 : _a['version']) !== null && _b !== void 0 ? _b : 1) >= 2) {
236
+ // there's stuff in the ecosystem that assumes these files will always be
237
+ // present in the vendor tree. But when ember-source is V2, it cannot put
238
+ // them there, so @embroider/compat will fill in defaults. The bundles are
239
+ // empty because we're just trying to keep the build from blowing up, the
240
+ // actual ember modules get loaded as modules instead.
241
+ //
242
+ // The template compiler is still here so that apps using a V2 ember can
243
+ // still app.import the traditional runtime template compiler.
244
+ trees.push((0, broccoli_file_creator_1.default)('vendor/ember/ember.js', () => ''));
245
+ trees.push((0, broccoli_file_creator_1.default)('vendor/ember/ember-testing.js', () => ''));
246
+ const templateCompilerSrc = (0, fs_1.readFileSync)((0, path_1.join)(emberSource.root, 'dist/ember-template-compiler.js'), 'utf8');
247
+ trees.push((0, broccoli_file_creator_1.default)('vendor/ember/ember-testing.js', () => templateCompilerSrc));
248
+ }
291
249
  if (this.vendorTree) {
292
250
  trees.push((0, broccoli_funnel_1.default)(this.vendorTree, {
293
251
  destDir: 'vendor',
@@ -361,11 +319,33 @@ class CompatApp {
361
319
  (0, fs_extra_1.ensureDirSync)((0, path_1.dirname)(destPath));
362
320
  (0, fs_extra_1.copySync)(sourcePath, destPath);
363
321
  }
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
+ }
364
344
  let remapAsset = this.remapAsset.bind(this);
365
345
  let addonMeta = {
366
346
  type: 'addon',
367
347
  version: 2,
368
- 'implicit-scripts': this._implicitScripts.map(remapAsset),
348
+ 'implicit-scripts': this._implicitScripts.map(remapAsset).filter(forbiddenVendorPath),
369
349
  'implicit-styles': this._implicitStyles.map(remapAsset),
370
350
  'implicit-test-scripts': this.legacyEmberAppInstance.legacyTestFilesToAppend.map(remapAsset),
371
351
  'implicit-test-styles': this.legacyEmberAppInstance.vendorTestStaticStyles.map(remapAsset),
@@ -423,7 +403,7 @@ class CompatApp {
423
403
  };
424
404
  let assetPath = (0, path_1.join)(outputPath, 'assets');
425
405
  if ((0, fs_extra_1.pathExistsSync)(assetPath)) {
426
- for (let file of (0, fs_extra_1.readdirSync)(assetPath)) {
406
+ for (let file of (0, walk_sync_1.default)(assetPath, { directories: false })) {
427
407
  addonMeta['public-assets'][`./assets/${file}`] = `/assets/${file}`;
428
408
  }
429
409
  }
@@ -471,19 +451,6 @@ class CompatApp {
471
451
  }
472
452
  return './' + asset;
473
453
  }
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
454
  get htmlbarsPlugins() {
488
455
  let plugins = (0, prepare_htmlbars_ast_plugins_1.default)(this.legacyEmberAppInstance.registry);
489
456
  // even if the app was using @embroider/macros, we drop it from the config
@@ -491,25 +458,6 @@ class CompatApp {
491
458
  plugins = plugins.filter((p) => !(0, node_1.isEmbroiderMacrosPlugin)(p));
492
459
  return plugins;
493
460
  }
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
461
  get vendorTree() {
514
462
  return this.ensureTree(this.legacyEmberAppInstance.trees.vendor);
515
463
  }
@@ -533,69 +481,6 @@ class CompatApp {
533
481
  get preprocessors() {
534
482
  return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');
535
483
  }
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
484
  constructor(legacyEmberAppInstance, _options) {
600
485
  this.legacyEmberAppInstance = legacyEmberAppInstance;
601
486
  this.annotation = '@embroider/compat/app';
@@ -623,17 +508,11 @@ class CompatApp {
623
508
  });
624
509
  }
625
510
  inTrees(prevStageTree) {
626
- let publicTree = this.publicTree;
627
511
  let configTree = this.config;
628
- if (this.options.extraPublicTrees.length > 0) {
629
- publicTree = (0, broccoli_merge_trees_1.default)([publicTree, ...this.options.extraPublicTrees].filter(Boolean));
630
- }
512
+ let contentForTree = this.contentFor;
631
513
  return {
632
- appJS: this.processAppJS().appJS,
633
- htmlTree: this.htmlTree,
634
- publicTree,
635
514
  configTree,
636
- appBootTree: this.appBoot,
515
+ contentForTree,
637
516
  prevStageTree,
638
517
  };
639
518
  }
@@ -649,25 +528,25 @@ class CompatApp {
649
528
  return packageCache.get(this.root);
650
529
  }
651
530
  }
652
- async instantiate(root, packageCache, configTree) {
531
+ async instantiate(packageCache, configTree, contentForTree) {
653
532
  let origAppPkg = this.appPackage();
654
533
  let movedAppPkg = packageCache.withRewrittenDeps(origAppPkg);
655
534
  let workingDir = (0, core_1.locateEmbroiderWorkingDir)(this.root);
656
- 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')));
535
+ 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
536
  }
658
537
  asStage(prevStage) {
659
538
  let resolve;
660
539
  let promise = new Promise(r => (resolve = r));
661
540
  let tree = () => {
662
541
  let inTrees = this.inTrees(prevStage.tree);
663
- return new core_1.WaitForTrees(inTrees, this.annotation, async (treePaths) => {
542
+ return new core_1.WaitForTrees(inTrees, this.annotation, async (_treePaths) => {
664
543
  if (!this.active) {
665
544
  let { outputPath } = await prevStage.ready();
666
545
  let packageCache = core_1.RewrittenPackageCache.shared('embroider', this.root);
667
- this.active = await this.instantiate(outputPath, packageCache, inTrees.configTree);
546
+ this.active = await this.instantiate(packageCache, inTrees.configTree, inTrees.contentForTree);
668
547
  resolve({ outputPath });
669
548
  }
670
- await this.active.build(treePaths);
549
+ await this.active.build();
671
550
  });
672
551
  };
673
552
  return {
@@ -707,13 +586,13 @@ __decorate([
707
586
  ], CompatApp.prototype, "testConfig", null);
708
587
  __decorate([
709
588
  (0, typescript_memoize_1.Memoize)()
710
- ], CompatApp.prototype, "appBoot", null);
589
+ ], CompatApp.prototype, "contentFor", null);
711
590
  __decorate([
712
591
  (0, typescript_memoize_1.Memoize)()
713
592
  ], CompatApp.prototype, "configReplacePatterns", null);
714
593
  __decorate([
715
594
  (0, typescript_memoize_1.Memoize)()
716
- ], CompatApp.prototype, "babelConfig", null);
595
+ ], CompatApp.prototype, "extraBabelPlugins", null);
717
596
  __decorate([
718
597
  (0, typescript_memoize_1.Memoize)()
719
598
  ], CompatApp.prototype, "babelMajorVersion", null);
@@ -726,12 +605,11 @@ __decorate([
726
605
  __decorate([
727
606
  (0, typescript_memoize_1.Memoize)()
728
607
  ], 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;
608
+ function forbiddenVendorPath(path) {
609
+ // ember-source does not go in vendor under embroider (we always use the
610
+ // separate ES modules)
611
+ //
612
+ // loader.js sets up AMD. We don't use AMD.
613
+ return !['./vendor/loader/loader.js', './vendor/ember/ember.js'].includes(path);
736
614
  }
737
615
  //# sourceMappingURL=compat-app.js.map