@embroider/compat 3.8.1 → 4.0.0-alpha.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.
Files changed (100) hide show
  1. package/babel.js +1 -0
  2. package/package.json +20 -14
  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/options.d.ts +2 -1
  7. package/src/audit/options.js.map +1 -1
  8. package/src/audit.d.ts +7 -57
  9. package/src/audit.js +101 -301
  10. package/src/audit.js.map +1 -1
  11. package/src/babel-plugin-adjust-imports.js +19 -18
  12. package/src/babel-plugin-adjust-imports.js.map +1 -1
  13. package/src/babel.d.ts +17 -0
  14. package/src/babel.js +146 -0
  15. package/src/babel.js.map +1 -0
  16. package/src/compat-adapters/@ember-data/store.d.ts +1 -5
  17. package/src/compat-adapters/@ember-data/store.js +3 -15
  18. package/src/compat-adapters/@ember-data/store.js.map +1 -1
  19. package/src/compat-adapters/active-model-adapter.d.ts +1 -1
  20. package/src/compat-adapters/ember-asset-loader.d.ts +1 -1
  21. package/src/compat-adapters/ember-cli-addon-docs.d.ts +1 -1
  22. package/src/compat-adapters/ember-cli-fastboot.js +0 -1
  23. package/src/compat-adapters/ember-cli-fastboot.js.map +1 -1
  24. package/src/compat-adapters/ember-cli-mirage.js +0 -1
  25. package/src/compat-adapters/ember-cli-mirage.js.map +1 -1
  26. package/src/compat-adapters/ember-decorators.d.ts +1 -1
  27. package/src/compat-adapters/ember-fetch.d.ts +5 -0
  28. package/src/compat-adapters/{ember-macro-helpers.js → ember-fetch.js} +5 -4
  29. package/src/compat-adapters/ember-fetch.js.map +1 -0
  30. package/src/compat-adapters/ember-percy.d.ts +1 -1
  31. package/src/compat-adapters/ember-resolver.d.ts +4 -0
  32. package/src/compat-adapters/ember-resolver.js +21 -0
  33. package/src/compat-adapters/ember-resolver.js.map +1 -0
  34. package/src/compat-adapters/ember-scroll-modifiers.d.ts +1 -1
  35. package/src/compat-adapters/ember-source.d.ts +3 -6
  36. package/src/compat-adapters/ember-source.js +26 -41
  37. package/src/compat-adapters/ember-source.js.map +1 -1
  38. package/src/compat-adapters/ember-test-selectors.d.ts +1 -1
  39. package/src/compat-addons.js +1 -1
  40. package/src/compat-addons.js.map +1 -1
  41. package/src/compat-app-builder.d.ts +9 -67
  42. package/src/compat-app-builder.js +108 -1299
  43. package/src/compat-app-builder.js.map +1 -1
  44. package/src/compat-app.d.ts +4 -22
  45. package/src/compat-app.js +78 -221
  46. package/src/compat-app.js.map +1 -1
  47. package/src/content-for-config.d.ts +11 -0
  48. package/src/content-for-config.js +66 -0
  49. package/src/content-for-config.js.map +1 -0
  50. package/src/default-pipeline.d.ts +4 -5
  51. package/src/default-pipeline.js +21 -46
  52. package/src/default-pipeline.js.map +1 -1
  53. package/src/dependency-rules.d.ts +1 -0
  54. package/src/dependency-rules.js +19 -11
  55. package/src/dependency-rules.js.map +1 -1
  56. package/src/detect-babel-plugins.d.ts +1 -0
  57. package/src/detect-babel-plugins.js +14 -0
  58. package/src/detect-babel-plugins.js.map +1 -1
  59. package/src/http-audit.d.ts +13 -0
  60. package/src/http-audit.js +60 -0
  61. package/src/http-audit.js.map +1 -0
  62. package/src/index.d.ts +2 -2
  63. package/src/index.js +3 -4
  64. package/src/index.js.map +1 -1
  65. package/src/module-visitor.d.ts +52 -0
  66. package/src/module-visitor.js +285 -0
  67. package/src/module-visitor.js.map +1 -0
  68. package/src/options.d.ts +4 -43
  69. package/src/options.js +35 -12
  70. package/src/options.js.map +1 -1
  71. package/src/resolver-transform.d.ts +1 -1
  72. package/src/resolver-transform.js +71 -43
  73. package/src/resolver-transform.js.map +1 -1
  74. package/src/standalone-addon-build.js +6 -15
  75. package/src/standalone-addon-build.js.map +1 -1
  76. package/src/v1-addon.js +6 -35
  77. package/src/v1-addon.js.map +1 -1
  78. package/src/v1-config.d.ts +0 -8
  79. package/src/v1-config.js +1 -51
  80. package/src/v1-config.js.map +1 -1
  81. package/src/audit-cli.d.ts +0 -2
  82. package/src/audit-cli.js +0 -150
  83. package/src/audit-cli.js.map +0 -1
  84. package/src/compat-adapters/@ember-data/debug.d.ts +0 -6
  85. package/src/compat-adapters/@ember-data/debug.js +0 -22
  86. package/src/compat-adapters/@ember-data/debug.js.map +0 -1
  87. package/src/compat-adapters/ember-macro-helpers.d.ts +0 -4
  88. package/src/compat-adapters/ember-macro-helpers.js.map +0 -1
  89. package/src/rename-require-plugin.d.ts +0 -1
  90. package/src/rename-require-plugin.js +0 -15
  91. package/src/rename-require-plugin.js.map +0 -1
  92. package/src/sync-dir.d.ts +0 -8
  93. package/src/sync-dir.js +0 -68
  94. package/src/sync-dir.js.map +0 -1
  95. package/src/template-tag-codemod.d.ts +0 -13
  96. package/src/template-tag-codemod.js +0 -302
  97. package/src/template-tag-codemod.js.map +0 -1
  98. package/src/v1-appboot.d.ts +0 -14
  99. package/src/v1-appboot.js +0 -47
  100. 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
  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,9 +78,6 @@ 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
- }
84
81
  get configLoader() {
85
82
  return this.requireFromEmberCLI('broccoli-config-loader');
86
83
  }
@@ -114,20 +111,21 @@ class CompatApp {
114
111
  return new v1_config_1.V1Config(this.configTree, 'test');
115
112
  }
116
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
+ }
117
126
  get autoRun() {
118
127
  return this.legacyEmberAppInstance.options.autoRun;
119
128
  }
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
- }
131
129
  get storeConfigInMeta() {
132
130
  return this.legacyEmberAppInstance.options.storeConfigInMeta;
133
131
  }
@@ -138,93 +136,36 @@ class CompatApp {
138
136
  storeConfigInMeta: this.storeConfigInMeta,
139
137
  });
140
138
  }
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
- }
148
- }
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
- });
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
+ };
177
145
  }
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).
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).
196
150
  let appBabel = this.legacyEmberAppInstance.options.babel;
197
151
  if (appBabel) {
198
152
  if (appBabel.plugins) {
199
- plugins = appBabel.plugins.concat(plugins);
200
- }
201
- if (appBabel.presets) {
202
- 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
+ });
203
166
  }
204
167
  }
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;
168
+ return [];
228
169
  }
229
170
  babelMajorVersion() {
230
171
  var _a, _b;
@@ -378,11 +319,32 @@ class CompatApp {
378
319
  (0, fs_extra_1.ensureDirSync)((0, path_1.dirname)(destPath));
379
320
  (0, fs_extra_1.copySync)(sourcePath, destPath);
380
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
+ }
381
344
  let remapAsset = this.remapAsset.bind(this);
382
345
  let addonMeta = {
383
- type: 'addon',
384
346
  version: 2,
385
- 'implicit-scripts': this._implicitScripts.map(remapAsset),
347
+ 'implicit-scripts': this._implicitScripts.map(remapAsset).filter(forbiddenVendorPath),
386
348
  'implicit-styles': this._implicitStyles.map(remapAsset),
387
349
  'implicit-test-scripts': this.legacyEmberAppInstance.legacyTestFilesToAppend.map(remapAsset),
388
350
  'implicit-test-styles': this.legacyEmberAppInstance.vendorTestStaticStyles.map(remapAsset),
@@ -426,7 +388,7 @@ class CompatApp {
426
388
  // internal implementation detail, and respecting outputPaths here is
427
389
  // unnecessary complexity. The corresponding code that adjusts the HTML
428
390
  // <link> is in updateHTML in app.ts.
429
- outputPaths: { app: `/assets/${this.name}.css` },
391
+ outputPaths: { app: `/@embroider/virtual/app.css` },
430
392
  registry: this.legacyEmberAppInstance.registry,
431
393
  minifyCSS: this.legacyEmberAppInstance.options.minifyCSS.options,
432
394
  };
@@ -434,14 +396,13 @@ class CompatApp {
434
396
  let styles = this.preprocessors.preprocessCss(nestedInput, '/app/styles', '/assets', options);
435
397
  return new add_to_tree_1.default(styles, outputPath => {
436
398
  let addonMeta = {
437
- type: 'addon',
438
399
  version: 2,
439
400
  'public-assets': {},
440
401
  };
441
- let assetPath = (0, path_1.join)(outputPath, 'assets');
402
+ let assetPath = (0, path_1.join)(outputPath, '@embroider', 'virtual');
442
403
  if ((0, fs_extra_1.pathExistsSync)(assetPath)) {
443
- for (let file of (0, fs_extra_1.readdirSync)(assetPath)) {
444
- addonMeta['public-assets'][`./assets/${file}`] = `/assets/${file}`;
404
+ for (let file of (0, walk_sync_1.default)(assetPath, { directories: false })) {
405
+ addonMeta['public-assets'][`./@embroider/virtual/${file}`] = `/@embroider/virtual/${file}`;
445
406
  }
446
407
  }
447
408
  let meta = {
@@ -488,19 +449,6 @@ class CompatApp {
488
449
  }
489
450
  return './' + asset;
490
451
  }
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
- }
504
452
  get htmlbarsPlugins() {
505
453
  let plugins = (0, prepare_htmlbars_ast_plugins_1.default)(this.legacyEmberAppInstance.registry);
506
454
  // even if the app was using @embroider/macros, we drop it from the config
@@ -508,25 +456,6 @@ class CompatApp {
508
456
  plugins = plugins.filter((p) => !(0, node_1.isEmbroiderMacrosPlugin)(p));
509
457
  return plugins;
510
458
  }
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
- }
530
459
  get vendorTree() {
531
460
  return this.ensureTree(this.legacyEmberAppInstance.trees.vendor);
532
461
  }
@@ -550,69 +479,6 @@ class CompatApp {
550
479
  get preprocessors() {
551
480
  return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');
552
481
  }
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
- }
616
482
  constructor(legacyEmberAppInstance, _options) {
617
483
  this.legacyEmberAppInstance = legacyEmberAppInstance;
618
484
  this.annotation = '@embroider/compat/app';
@@ -640,17 +506,11 @@ class CompatApp {
640
506
  });
641
507
  }
642
508
  inTrees(prevStageTree) {
643
- let publicTree = this.publicTree;
644
509
  let configTree = this.config;
645
- if (this.options.extraPublicTrees.length > 0) {
646
- publicTree = (0, broccoli_merge_trees_1.default)([publicTree, ...this.options.extraPublicTrees].filter(Boolean));
647
- }
510
+ let contentForTree = this.contentFor;
648
511
  return {
649
- appJS: this.processAppJS().appJS,
650
- htmlTree: this.htmlTree,
651
- publicTree,
652
512
  configTree,
653
- appBootTree: this.appBoot,
513
+ contentForTree,
654
514
  prevStageTree,
655
515
  };
656
516
  }
@@ -666,25 +526,25 @@ class CompatApp {
666
526
  return packageCache.get(this.root);
667
527
  }
668
528
  }
669
- async instantiate(root, packageCache, configTree) {
529
+ async instantiate(packageCache, configTree, contentForTree) {
670
530
  let origAppPkg = this.appPackage();
671
531
  let movedAppPkg = packageCache.withRewrittenDeps(origAppPkg);
672
532
  let workingDir = (0, core_1.locateEmbroiderWorkingDir)(this.root);
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')));
533
+ 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')));
674
534
  }
675
535
  asStage(prevStage) {
676
536
  let resolve;
677
537
  let promise = new Promise(r => (resolve = r));
678
538
  let tree = () => {
679
539
  let inTrees = this.inTrees(prevStage.tree);
680
- return new core_1.WaitForTrees(inTrees, this.annotation, async (treePaths) => {
540
+ return new core_1.WaitForTrees(inTrees, this.annotation, async (_treePaths) => {
681
541
  if (!this.active) {
682
542
  let { outputPath } = await prevStage.ready();
683
543
  let packageCache = core_1.RewrittenPackageCache.shared('embroider', this.root);
684
- this.active = await this.instantiate(outputPath, packageCache, inTrees.configTree);
544
+ this.active = await this.instantiate(packageCache, inTrees.configTree, inTrees.contentForTree);
685
545
  resolve({ outputPath });
686
546
  }
687
- await this.active.build(treePaths);
547
+ await this.active.build();
688
548
  });
689
549
  };
690
550
  return {
@@ -724,13 +584,13 @@ __decorate([
724
584
  ], CompatApp.prototype, "testConfig", null);
725
585
  __decorate([
726
586
  (0, typescript_memoize_1.Memoize)()
727
- ], CompatApp.prototype, "appBoot", null);
587
+ ], CompatApp.prototype, "contentFor", null);
728
588
  __decorate([
729
589
  (0, typescript_memoize_1.Memoize)()
730
590
  ], CompatApp.prototype, "configReplacePatterns", null);
731
591
  __decorate([
732
592
  (0, typescript_memoize_1.Memoize)()
733
- ], CompatApp.prototype, "babelConfig", null);
593
+ ], CompatApp.prototype, "extraBabelPlugins", null);
734
594
  __decorate([
735
595
  (0, typescript_memoize_1.Memoize)()
736
596
  ], CompatApp.prototype, "babelMajorVersion", null);
@@ -743,12 +603,9 @@ __decorate([
743
603
  __decorate([
744
604
  (0, typescript_memoize_1.Memoize)()
745
605
  ], CompatApp.prototype, "appPackage", null);
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;
606
+ function forbiddenVendorPath(path) {
607
+ // ember-source does not go in vendor under embroider (we always use the
608
+ // separate ES modules)
609
+ return !['./vendor/ember/ember.js'].includes(path);
753
610
  }
754
611
  //# sourceMappingURL=compat-app.js.map