@embroider/compat 3.8.1-unstable.fc482ba → 4.0.0-alpha.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/compat",
3
- "version": "3.8.1-unstable.fc482ba",
3
+ "version": "4.0.0-alpha.0",
4
4
  "private": false,
5
5
  "description": "Backward compatibility layer for the Embroider build system.",
6
6
  "repository": {
@@ -17,6 +17,14 @@
17
17
  "src/**/*.d.ts",
18
18
  "src/**/*.js.map"
19
19
  ],
20
+ "release-plan": {
21
+ "semverIncrementAs": {
22
+ "major": "premajor",
23
+ "minor": "prerelease",
24
+ "patch": "prerelease"
25
+ },
26
+ "semverIncrementTag": "alpha"
27
+ },
20
28
  "dependencies": {
21
29
  "@babel/code-frame": "^7.14.5",
22
30
  "@babel/core": "^7.14.5",
@@ -60,7 +68,7 @@
60
68
  "tree-sync": "^2.1.0",
61
69
  "typescript-memoize": "^1.0.1",
62
70
  "walk-sync": "^3.0.0",
63
- "@embroider/macros": "1.16.11-unstable.fc482ba"
71
+ "@embroider/macros": "1.17.0-alpha.0"
64
72
  },
65
73
  "devDependencies": {
66
74
  "@glimmer/syntax": "^0.84.3",
@@ -83,12 +91,12 @@
83
91
  "ember-engines": "^0.8.19",
84
92
  "scenario-tester": "^4.0.0",
85
93
  "typescript": "^5.4.5",
94
+ "@embroider/sample-transforms": "0.0.0",
86
95
  "@embroider/test-support": "0.36.0",
87
- "@embroider/core": "^3.5.1-unstable.fc482ba",
88
- "@embroider/sample-transforms": "0.0.0"
96
+ "@embroider/core": "^4.0.0-alpha.0"
89
97
  },
90
98
  "peerDependencies": {
91
- "@embroider/core": "^3.5.1-unstable.fc482ba"
99
+ "@embroider/core": "^4.0.0-alpha.0"
92
100
  },
93
101
  "engines": {
94
102
  "node": "12.* || 14.* || >= 16"
@@ -12,9 +12,6 @@ export declare class CompatAppBuilder {
12
12
  private contentForTree;
13
13
  private synthVendor;
14
14
  private synthStyles;
15
- private staticComponents;
16
- private staticHelpers;
17
- private staticModifiers;
18
15
  constructor(origAppPackage: Package, appPackageWithMovedDeps: Package, options: CompatOptionsType, compatApp: CompatApp, configTree: V1Config, contentForTree: ContentForConfig, synthVendor: Package, synthStyles: Package);
19
16
  private modulePrefix;
20
17
  private podModulePrefix;
@@ -32,33 +32,6 @@ class CompatAppBuilder {
32
32
  this.contentForTree = contentForTree;
33
33
  this.synthVendor = synthVendor;
34
34
  this.synthStyles = synthStyles;
35
- this.staticComponents = false;
36
- this.staticHelpers = false;
37
- this.staticModifiers = false;
38
- // staticInvokables always wins when configured
39
- if (typeof options.staticInvokables !== 'undefined') {
40
- if (typeof options.staticComponents !== 'undefined' ||
41
- typeof options.staticHelpers !== 'undefined' ||
42
- typeof options.staticModifiers !== 'undefined') {
43
- throw new Error('You cannot set `staticHelpers`, `staticComponents`, or `staticModifiers` if you have set `staticInvokables`. Delete these configs to continue.');
44
- }
45
- this.staticComponents = this.staticHelpers = this.staticModifiers = options.staticInvokables;
46
- return;
47
- }
48
- if (typeof options.staticComponents !== 'undefined') {
49
- // TODO it doesn't seem like we have any real deprecation functionality in this package yet.
50
- // do we need it?
51
- console.error(`Setting 'staticComponents' is deprecated. Use 'staticInvokables' instead`);
52
- this.staticComponents = options.staticComponents;
53
- }
54
- if (typeof options.staticHelpers !== 'undefined') {
55
- console.error(`Setting 'staticHelpers' is deprecated. Use 'staticInvokables' instead`);
56
- this.staticHelpers = options.staticHelpers;
57
- }
58
- if (typeof options.staticModifiers !== 'undefined') {
59
- console.error(`Setting 'staticModifiers' is deprecated. Use 'staticInvokables' instead`);
60
- this.staticModifiers = options.staticModifiers;
61
- }
62
35
  }
63
36
  modulePrefix() {
64
37
  return this.configTree.readConfig().modulePrefix;
@@ -80,9 +53,7 @@ class CompatAppBuilder {
80
53
  ...allActiveAddons.filter(p => p.meta['auto-upgraded']),
81
54
  ]);
82
55
  options.options = {
83
- staticHelpers: this.staticHelpers,
84
- staticModifiers: this.staticModifiers,
85
- staticComponents: this.staticComponents,
56
+ staticInvokables: this.options.staticInvokables,
86
57
  allowUnsafeDynamicComponents: this.options.allowUnsafeDynamicComponents,
87
58
  };
88
59
  return options;
@@ -1 +1 @@
1
- {"version":3,"file":"compat-app-builder.js","sourceRoot":"","sources":["compat-app-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,0CAA4D;AAG5D,yDAAwD;AACxD,uCAAyD;AAEzD,2DAAgF;AAChF,2DAA6C;AAC7C,+BAAqC;AACrC,sDAA8B;AAI9B,uCAAuC;AAIvC,qDAA0D;AAC1D,yFAAmF;AAGnF,8EAA8E;AAC9E,uDAAuD;AAEvD,MAAa,gBAAgB;IAK3B,YACU,cAAuB,EACvB,uBAAgC,EAChC,OAA0B,EAC1B,SAAoB,EACpB,UAAoB,EACpB,cAAgC,EAChC,WAAoB,EACpB,WAAoB;QAPpB,mBAAc,GAAd,cAAc,CAAS;QACvB,4BAAuB,GAAvB,uBAAuB,CAAS;QAChC,YAAO,GAAP,OAAO,CAAmB;QAC1B,cAAS,GAAT,SAAS,CAAW;QACpB,eAAU,GAAV,UAAU,CAAU;QACpB,mBAAc,GAAd,cAAc,CAAkB;QAChC,gBAAW,GAAX,WAAW,CAAS;QACpB,gBAAW,GAAX,WAAW,CAAS;QAZtB,qBAAgB,GAAG,KAAK,CAAC;QACzB,kBAAa,GAAG,KAAK,CAAC;QACtB,oBAAe,GAAG,KAAK,CAAC;QAY9B,+CAA+C;QAC/C,IAAI,OAAO,OAAO,CAAC,gBAAgB,KAAK,WAAW,EAAE,CAAC;YACpD,IACE,OAAO,OAAO,CAAC,gBAAgB,KAAK,WAAW;gBAC/C,OAAO,OAAO,CAAC,aAAa,KAAK,WAAW;gBAC5C,OAAO,OAAO,CAAC,eAAe,KAAK,WAAW,EAC9C,CAAC;gBACD,MAAM,IAAI,KAAK,CACb,gJAAgJ,CACjJ,CAAC;YACJ,CAAC;YACD,IAAI,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AAC;QAErB,MAAM,OAAO,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,CAAC;QAC5D,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAEpE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC;;;;;UAKZ,OAAO;;;;OAIV,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAjOD,4CAiOC;AAxKC;IADC,IAAA,4BAAO,GAAE;sDAuBT;AAmBD;IADC,IAAA,4BAAO,GAAE;qDAkBT;AAgHH,SAAS,wBAAwB;IAC/B,OAAO,IAAA,sBAAW,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC;SAC1D,GAAG,CAAC,QAAQ,CAAC,EAAE;QACd,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,iEAAiE;YACjE,OAAO,OAAO,CAAC,IAAA,WAAI,EAAC,SAAS,EAAE,wBAAwB,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;QAC9E,CAAC;IACH,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAC;SACf,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import type { AddonPackage } from '@embroider/core';\nimport { locateEmbroiderWorkingDir } from '@embroider/core';\nimport type { CompatResolverOptions } from './resolver-transform';\nimport type { PackageRules } from './dependency-rules';\nimport { activePackageRules } from './dependency-rules';\nimport { outputJSONSync, writeFileSync } from 'fs-extra';\nimport type { PortableHint } from '@embroider/core/src/portable';\nimport { maybeNodeModuleVersion, Portable } from '@embroider/core/src/portable';\nimport { Memoize } from 'typescript-memoize';\nimport { join, dirname } from 'path';\nimport resolve from 'resolve';\nimport type ContentForConfig from './content-for-config';\nimport type { V1Config } from './v1-config';\nimport type { Package } from '@embroider/core';\nimport { readdirSync } from 'fs-extra';\n\nimport type CompatApp from './compat-app';\nimport type { CompatBabelState } from './babel';\nimport { MacrosConfig } from '@embroider/macros/src/node';\nimport { buildResolverOptions } from '@embroider/core/src/module-resolver-options';\nimport type { CompatOptionsType } from './options';\n\n// This exists during the actual broccoli build step. As opposed to CompatApp,\n// which also exists during pipeline-construction time.\n\nexport class CompatAppBuilder {\n private staticComponents = false;\n private staticHelpers = false;\n private staticModifiers = false;\n\n constructor(\n private origAppPackage: Package,\n private appPackageWithMovedDeps: Package,\n private options: CompatOptionsType,\n private compatApp: CompatApp,\n private configTree: V1Config,\n private contentForTree: ContentForConfig,\n private synthVendor: Package,\n private synthStyles: Package\n ) {\n // staticInvokables always wins when configured\n if (typeof options.staticInvokables !== 'undefined') {\n if (\n typeof options.staticComponents !== 'undefined' ||\n typeof options.staticHelpers !== 'undefined' ||\n typeof options.staticModifiers !== 'undefined'\n ) {\n throw new Error(\n 'You cannot set `staticHelpers`, `staticComponents`, or `staticModifiers` if you have set `staticInvokables`. Delete these configs to continue.'\n );\n }\n this.staticComponents = this.staticHelpers = this.staticModifiers = options.staticInvokables;\n return;\n }\n\n if (typeof options.staticComponents !== 'undefined') {\n // TODO it doesn't seem like we have any real deprecation functionality in this package yet.\n // do we need it?\n console.error(`Setting 'staticComponents' is deprecated. Use 'staticInvokables' instead`);\n this.staticComponents = options.staticComponents;\n }\n\n if (typeof options.staticHelpers !== 'undefined') {\n console.error(`Setting 'staticHelpers' is deprecated. Use 'staticInvokables' instead`);\n this.staticHelpers = options.staticHelpers;\n }\n\n if (typeof options.staticModifiers !== 'undefined') {\n console.error(`Setting 'staticModifiers' is deprecated. Use 'staticInvokables' instead`);\n this.staticModifiers = options.staticModifiers;\n }\n }\n\n private modulePrefix(): string {\n return this.configTree.readConfig().modulePrefix;\n }\n\n private podModulePrefix(): string | undefined {\n return this.configTree.readConfig().podModulePrefix;\n }\n\n @Memoize()\n private get resolverConfig(): CompatResolverOptions {\n return buildResolverOptions({\n appPackage: this.appPackageWithMovedDeps,\n modulePrefix: this.modulePrefix(),\n podModulePrefix: this.podModulePrefix(),\n splitAtRoutes: this.options.splitAtRoutes,\n staticAppPaths: this.options.staticAppPaths,\n extraDeps: new Map([[this.appPackageWithMovedDeps.root, [this.synthVendor, this.synthStyles] as AddonPackage[]]]),\n extend: (options: CompatResolverOptions, allActiveAddons) => {\n options.activePackageRules = activePackageRules(this.options.packageRules.concat(defaultAddonPackageRules()), [\n { name: this.origAppPackage.name, version: this.origAppPackage.version, root: this.origAppPackage.root },\n ...allActiveAddons.filter(p => p.meta['auto-upgraded']),\n ]);\n options.options = {\n staticHelpers: this.staticHelpers,\n staticModifiers: this.staticModifiers,\n staticComponents: this.staticComponents,\n allowUnsafeDynamicComponents: this.options.allowUnsafeDynamicComponents,\n };\n return options;\n },\n });\n }\n\n async build() {\n // on the first build, we lock down the macros config. on subsequent builds,\n // this doesn't do anything anyway because it's idempotent.\n this.compatApp.macrosConfig.finalize();\n\n let resolverConfig = this.resolverConfig;\n let config = this.configTree.readConfig();\n let contentForConfig = this.contentForTree.readContents();\n\n this.addResolverConfig(resolverConfig);\n this.addContentForConfig(contentForConfig);\n this.addEmberEnvConfig(config.EmberENV);\n this.outputAppBootError(config.modulePrefix, config.APP, contentForConfig);\n this.addBabelCompat();\n }\n\n @Memoize()\n private get portableHints(): PortableHint[] {\n return this.options.pluginHints.map(hint => {\n let cursor = join(this.origAppPackage.root, 'package.json');\n for (let i = 0; i < hint.resolve.length; i++) {\n let target = hint.resolve[i];\n if (i < hint.resolve.length - 1) {\n target = join(target, 'package.json');\n }\n cursor = resolve.sync(target, { basedir: dirname(cursor) });\n }\n\n return {\n requireFile: cursor,\n useMethod: hint.useMethod,\n packageVersion: maybeNodeModuleVersion(cursor),\n };\n });\n }\n\n private addBabelCompat() {\n let plugins = this.compatApp.extraBabelPlugins();\n let templateTransforms = this.compatApp.htmlbarsPlugins;\n let babelMacros = this.compatApp.macrosConfig.babelPluginConfig();\n let { plugins: templateMacros, setConfig } = MacrosConfig.transforms();\n setConfig(this.compatApp.macrosConfig);\n\n let config: CompatBabelState = {\n plugins,\n templateTransforms,\n babelMacros,\n templateMacros: templateMacros as any,\n };\n\n let portableConfig = new Portable({ hints: this.portableHints }).dehydrate(config);\n if (!portableConfig.isParallelSafe) {\n throw new Error(`non-serializble babel plugins or AST transforms found in your app`);\n }\n\n writeFileSync(\n join(locateEmbroiderWorkingDir(this.compatApp.root), '_babel_compat_.js'),\n `\n const { Portable } = require('@embroider/core/src/portable');\n module.exports = new Portable().hydrate(${JSON.stringify(portableConfig.value, null, 2)});\n `,\n 'utf8'\n );\n }\n\n private addResolverConfig(config: CompatResolverOptions) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'resolver.json'), config, { spaces: 2 });\n }\n\n private addContentForConfig(contentForConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'content-for.json'), contentForConfig, {\n spaces: 2,\n });\n\n // In addition to outputting content-for.json, we also want to check if content-for 'config-module' has a custom content.\n // If so, it means some classic addons used to provide this custom content, which is no longer supported.\n // Developers can deactivate this check (and the subsequent warning) with useAddonConfigModule\n if (this.compatApp.options.useAddonConfigModule) {\n let modulePrefix = this.configTree.readConfig().modulePrefix;\n\n // This is the default script provided by https://github.com/ember-cli/ember-cli/blob/master/lib/utilities/ember-app-utils.js#L84\n // When storeConfigInMeta is true, this content is always present in the config-module key of content-for.json\n const defaultConfigModule =\n `var prefix = '${modulePrefix}';\\ntry {\\n var metaName = prefix + '/config/environment';\\n var rawConfig = document.querySelector('meta[name=\\\"' + metaName + '\\\"]').getAttribute('content');\\n var config = JSON.parse(decodeURIComponent(rawConfig));\\n\\n var exports = { 'default': config };\\n\\n Object.defineProperty(exports, '__esModule', { value: true });\\n\\n return exports;\\n}\\ncatch(err) {\\n throw new Error('Could not read config from meta tag with name \\\"' + metaName + '\\\".');\\n}\\n`.replace(\n /\\s/g,\n ''\n );\n\n const configModule = contentForConfig['/index.html']['config-module'];\n const diff = configModule.replace(/\\s/g, '').replace(defaultConfigModule, '');\n\n if (diff.length) {\n throw new Error(`\n Your app uses at least one classic addon that provides content-for 'config-module'. This is no longer supported.\n With Embroider, you have full control over the config module, so classic addons no longer need to modify it under the hood.\n The following code is included via content-for 'config-module':\n\n ${configModule}\n\n 1. If you want to keep the same behavior, add it to the app/environment.js.\n 2. Once app/environment.js has the content you need, remove the present error by setting \"useAddonConfigModule\" to false in the build options.\n `);\n }\n }\n }\n\n private addEmberEnvConfig(emberEnvConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'ember-env.json'), emberEnvConfig, {\n spaces: 2,\n });\n }\n\n // Classic addons providing custom content-for \"app-boot\" is no longer supported.\n // The purpose of this error message is to help developers to move the classic addons code.\n // Developers can deactivate it with useAddonAppBoot build option.\n private outputAppBootError(modulePrefix: string, appConfig: any, contentForConfig: any) {\n if (!this.compatApp.options.useAddonAppBoot) {\n return;\n }\n\n // This is the default script provided by\n // https://github.com/ember-cli/ember-cli/blob/master/lib/utilities/ember-app-utils.js#L103\n const defaultAppBoot = `\n if (!runningTests) {\n require(\"${modulePrefix}/app\")[\"default\"].create(${JSON.stringify(appConfig || {})});\n }\n `.replace(/\\s/g, '');\n\n const appBoot = contentForConfig['/index.html']['app-boot'];\n const diff = appBoot.replace(/\\s/g, '').replace(defaultAppBoot, '');\n\n if (diff.length) {\n throw new Error(`\n Your app uses at least one classic addon that provides content-for 'app-boot'. This is no longer supported.\n With Embroider, you have full control over the app-boot script, so classic addons no longer need to modify it under the hood.\n The following code is used for your app boot:\n\n ${appBoot}\n\n 1. If you want to keep the same behavior, copy and paste it to the app-boot script included in app/index.html.\n 2. Once app/index.html has the content you need, remove the present error by setting \"useAddonAppBoot\" to false in the build options.\n `);\n }\n }\n}\n\nfunction defaultAddonPackageRules(): PackageRules[] {\n return readdirSync(join(__dirname, 'addon-dependency-rules'))\n .map(filename => {\n if (filename.endsWith('.js')) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(join(__dirname, 'addon-dependency-rules', filename)).default;\n }\n })\n .filter(Boolean)\n .reduce((a, b) => a.concat(b), []);\n}\n"]}
1
+ {"version":3,"file":"compat-app-builder.js","sourceRoot":"","sources":["compat-app-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,0CAA4D;AAG5D,yDAAwD;AACxD,uCAAyD;AAEzD,2DAAgF;AAChF,2DAA6C;AAC7C,+BAAqC;AACrC,sDAA8B;AAI9B,uCAAuC;AAIvC,qDAA0D;AAC1D,yFAAmF;AAGnF,8EAA8E;AAC9E,uDAAuD;AAEvD,MAAa,gBAAgB;IAC3B,YACU,cAAuB,EACvB,uBAAgC,EAChC,OAA0B,EAC1B,SAAoB,EACpB,UAAoB,EACpB,cAAgC,EAChC,WAAoB,EACpB,WAAoB;QAPpB,mBAAc,GAAd,cAAc,CAAS;QACvB,4BAAuB,GAAvB,uBAAuB,CAAS;QAChC,YAAO,GAAP,OAAO,CAAmB;QAC1B,cAAS,GAAT,SAAS,CAAW;QACpB,eAAU,GAAV,UAAU,CAAU;QACpB,mBAAc,GAAd,cAAc,CAAkB;QAChC,gBAAW,GAAX,WAAW,CAAS;QACpB,gBAAW,GAAX,WAAW,CAAS;IAC3B,CAAC;IAEI,YAAY;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,YAAY,CAAC;IACnD,CAAC;IAEO,eAAe;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,eAAe,CAAC;IACtD,CAAC;IAGD,IAAY,cAAc;QACxB,OAAO,IAAA,8CAAoB,EAAC;YAC1B,UAAU,EAAE,IAAI,CAAC,uBAAuB;YACxC,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE;YACjC,eAAe,EAAE,I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3F,MAAM,cAAc,GAAG;;mBAER,YAAY,4BAA4B,IAAI,CAAC,SAAS,CAAC,SAAS,IAAI,EAAE,CAAC;;KAErF,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAErB,MAAM,OAAO,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,CAAC;QAC5D,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAEpE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC;;;;;UAKZ,OAAO;;;;OAIV,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AA3LD,4CA2LC;AAtKC;IADC,IAAA,4BAAO,GAAE;sDAqBT;AAmBD;IADC,IAAA,4BAAO,GAAE;qDAkBT;AAgHH,SAAS,wBAAwB;IAC/B,OAAO,IAAA,sBAAW,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC;SAC1D,GAAG,CAAC,QAAQ,CAAC,EAAE;QACd,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,iEAAiE;YACjE,OAAO,OAAO,CAAC,IAAA,WAAI,EAAC,SAAS,EAAE,wBAAwB,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;QAC9E,CAAC;IACH,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAC;SACf,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import type { AddonPackage } from '@embroider/core';\nimport { locateEmbroiderWorkingDir } from '@embroider/core';\nimport type { CompatResolverOptions } from './resolver-transform';\nimport type { PackageRules } from './dependency-rules';\nimport { activePackageRules } from './dependency-rules';\nimport { outputJSONSync, writeFileSync } from 'fs-extra';\nimport type { PortableHint } from '@embroider/core/src/portable';\nimport { maybeNodeModuleVersion, Portable } from '@embroider/core/src/portable';\nimport { Memoize } from 'typescript-memoize';\nimport { join, dirname } from 'path';\nimport resolve from 'resolve';\nimport type ContentForConfig from './content-for-config';\nimport type { V1Config } from './v1-config';\nimport type { Package } from '@embroider/core';\nimport { readdirSync } from 'fs-extra';\n\nimport type CompatApp from './compat-app';\nimport type { CompatBabelState } from './babel';\nimport { MacrosConfig } from '@embroider/macros/src/node';\nimport { buildResolverOptions } from '@embroider/core/src/module-resolver-options';\nimport type { CompatOptionsType } from './options';\n\n// This exists during the actual broccoli build step. As opposed to CompatApp,\n// which also exists during pipeline-construction time.\n\nexport class CompatAppBuilder {\n constructor(\n private origAppPackage: Package,\n private appPackageWithMovedDeps: Package,\n private options: CompatOptionsType,\n private compatApp: CompatApp,\n private configTree: V1Config,\n private contentForTree: ContentForConfig,\n private synthVendor: Package,\n private synthStyles: Package\n ) {}\n\n private modulePrefix(): string {\n return this.configTree.readConfig().modulePrefix;\n }\n\n private podModulePrefix(): string | undefined {\n return this.configTree.readConfig().podModulePrefix;\n }\n\n @Memoize()\n private get resolverConfig(): CompatResolverOptions {\n return buildResolverOptions({\n appPackage: this.appPackageWithMovedDeps,\n modulePrefix: this.modulePrefix(),\n podModulePrefix: this.podModulePrefix(),\n splitAtRoutes: this.options.splitAtRoutes,\n staticAppPaths: this.options.staticAppPaths,\n extraDeps: new Map([[this.appPackageWithMovedDeps.root, [this.synthVendor, this.synthStyles] as AddonPackage[]]]),\n extend: (options: CompatResolverOptions, allActiveAddons) => {\n options.activePackageRules = activePackageRules(this.options.packageRules.concat(defaultAddonPackageRules()), [\n { name: this.origAppPackage.name, version: this.origAppPackage.version, root: this.origAppPackage.root },\n ...allActiveAddons.filter(p => p.meta['auto-upgraded']),\n ]);\n options.options = {\n staticInvokables: this.options.staticInvokables,\n allowUnsafeDynamicComponents: this.options.allowUnsafeDynamicComponents,\n };\n return options;\n },\n });\n }\n\n async build() {\n // on the first build, we lock down the macros config. on subsequent builds,\n // this doesn't do anything anyway because it's idempotent.\n this.compatApp.macrosConfig.finalize();\n\n let resolverConfig = this.resolverConfig;\n let config = this.configTree.readConfig();\n let contentForConfig = this.contentForTree.readContents();\n\n this.addResolverConfig(resolverConfig);\n this.addContentForConfig(contentForConfig);\n this.addEmberEnvConfig(config.EmberENV);\n this.outputAppBootError(config.modulePrefix, config.APP, contentForConfig);\n this.addBabelCompat();\n }\n\n @Memoize()\n private get portableHints(): PortableHint[] {\n return this.options.pluginHints.map(hint => {\n let cursor = join(this.origAppPackage.root, 'package.json');\n for (let i = 0; i < hint.resolve.length; i++) {\n let target = hint.resolve[i];\n if (i < hint.resolve.length - 1) {\n target = join(target, 'package.json');\n }\n cursor = resolve.sync(target, { basedir: dirname(cursor) });\n }\n\n return {\n requireFile: cursor,\n useMethod: hint.useMethod,\n packageVersion: maybeNodeModuleVersion(cursor),\n };\n });\n }\n\n private addBabelCompat() {\n let plugins = this.compatApp.extraBabelPlugins();\n let templateTransforms = this.compatApp.htmlbarsPlugins;\n let babelMacros = this.compatApp.macrosConfig.babelPluginConfig();\n let { plugins: templateMacros, setConfig } = MacrosConfig.transforms();\n setConfig(this.compatApp.macrosConfig);\n\n let config: CompatBabelState = {\n plugins,\n templateTransforms,\n babelMacros,\n templateMacros: templateMacros as any,\n };\n\n let portableConfig = new Portable({ hints: this.portableHints }).dehydrate(config);\n if (!portableConfig.isParallelSafe) {\n throw new Error(`non-serializble babel plugins or AST transforms found in your app`);\n }\n\n writeFileSync(\n join(locateEmbroiderWorkingDir(this.compatApp.root), '_babel_compat_.js'),\n `\n const { Portable } = require('@embroider/core/src/portable');\n module.exports = new Portable().hydrate(${JSON.stringify(portableConfig.value, null, 2)});\n `,\n 'utf8'\n );\n }\n\n private addResolverConfig(config: CompatResolverOptions) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'resolver.json'), config, { spaces: 2 });\n }\n\n private addContentForConfig(contentForConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'content-for.json'), contentForConfig, {\n spaces: 2,\n });\n\n // In addition to outputting content-for.json, we also want to check if content-for 'config-module' has a custom content.\n // If so, it means some classic addons used to provide this custom content, which is no longer supported.\n // Developers can deactivate this check (and the subsequent warning) with useAddonConfigModule\n if (this.compatApp.options.useAddonConfigModule) {\n let modulePrefix = this.configTree.readConfig().modulePrefix;\n\n // This is the default script provided by https://github.com/ember-cli/ember-cli/blob/master/lib/utilities/ember-app-utils.js#L84\n // When storeConfigInMeta is true, this content is always present in the config-module key of content-for.json\n const defaultConfigModule =\n `var prefix = '${modulePrefix}';\\ntry {\\n var metaName = prefix + '/config/environment';\\n var rawConfig = document.querySelector('meta[name=\\\"' + metaName + '\\\"]').getAttribute('content');\\n var config = JSON.parse(decodeURIComponent(rawConfig));\\n\\n var exports = { 'default': config };\\n\\n Object.defineProperty(exports, '__esModule', { value: true });\\n\\n return exports;\\n}\\ncatch(err) {\\n throw new Error('Could not read config from meta tag with name \\\"' + metaName + '\\\".');\\n}\\n`.replace(\n /\\s/g,\n ''\n );\n\n const configModule = contentForConfig['/index.html']['config-module'];\n const diff = configModule.replace(/\\s/g, '').replace(defaultConfigModule, '');\n\n if (diff.length) {\n throw new Error(`\n Your app uses at least one classic addon that provides content-for 'config-module'. This is no longer supported.\n With Embroider, you have full control over the config module, so classic addons no longer need to modify it under the hood.\n The following code is included via content-for 'config-module':\n\n ${configModule}\n\n 1. If you want to keep the same behavior, add it to the app/environment.js.\n 2. Once app/environment.js has the content you need, remove the present error by setting \"useAddonConfigModule\" to false in the build options.\n `);\n }\n }\n }\n\n private addEmberEnvConfig(emberEnvConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'ember-env.json'), emberEnvConfig, {\n spaces: 2,\n });\n }\n\n // Classic addons providing custom content-for \"app-boot\" is no longer supported.\n // The purpose of this error message is to help developers to move the classic addons code.\n // Developers can deactivate it with useAddonAppBoot build option.\n private outputAppBootError(modulePrefix: string, appConfig: any, contentForConfig: any) {\n if (!this.compatApp.options.useAddonAppBoot) {\n return;\n }\n\n // This is the default script provided by\n // https://github.com/ember-cli/ember-cli/blob/master/lib/utilities/ember-app-utils.js#L103\n const defaultAppBoot = `\n if (!runningTests) {\n require(\"${modulePrefix}/app\")[\"default\"].create(${JSON.stringify(appConfig || {})});\n }\n `.replace(/\\s/g, '');\n\n const appBoot = contentForConfig['/index.html']['app-boot'];\n const diff = appBoot.replace(/\\s/g, '').replace(defaultAppBoot, '');\n\n if (diff.length) {\n throw new Error(`\n Your app uses at least one classic addon that provides content-for 'app-boot'. This is no longer supported.\n With Embroider, you have full control over the app-boot script, so classic addons no longer need to modify it under the hood.\n The following code is used for your app boot:\n\n ${appBoot}\n\n 1. If you want to keep the same behavior, copy and paste it to the app-boot script included in app/index.html.\n 2. Once app/index.html has the content you need, remove the present error by setting \"useAddonAppBoot\" to false in the build options.\n `);\n }\n }\n}\n\nfunction defaultAddonPackageRules(): PackageRules[] {\n return readdirSync(join(__dirname, 'addon-dependency-rules'))\n .map(filename => {\n if (filename.endsWith('.js')) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(join(__dirname, 'addon-dependency-rules', filename)).default;\n }\n })\n .filter(Boolean)\n .reduce((a, b) => a.concat(b), []);\n}\n"]}
package/src/compat-app.js CHANGED
@@ -388,7 +388,7 @@ class CompatApp {
388
388
  // internal implementation detail, and respecting outputPaths here is
389
389
  // unnecessary complexity. The corresponding code that adjusts the HTML
390
390
  // <link> is in updateHTML in app.ts.
391
- outputPaths: { app: `/assets/${this.name}.css` },
391
+ outputPaths: { app: `/@embroider/virtual/app.css` },
392
392
  registry: this.legacyEmberAppInstance.registry,
393
393
  minifyCSS: this.legacyEmberAppInstance.options.minifyCSS.options,
394
394
  };
@@ -399,10 +399,10 @@ class CompatApp {
399
399
  version: 2,
400
400
  'public-assets': {},
401
401
  };
402
- let assetPath = (0, path_1.join)(outputPath, 'assets');
402
+ let assetPath = (0, path_1.join)(outputPath, '@embroider', 'virtual');
403
403
  if ((0, fs_extra_1.pathExistsSync)(assetPath)) {
404
404
  for (let file of (0, walk_sync_1.default)(assetPath, { directories: false })) {
405
- addonMeta['public-assets'][`./assets/${file}`] = `/assets/${file}`;
405
+ addonMeta['public-assets'][`./@embroider/virtual/${file}`] = `/@embroider/virtual/${file}`;
406
406
  }
407
407
  }
408
408
  let meta = {
@@ -606,8 +606,6 @@ __decorate([
606
606
  function forbiddenVendorPath(path) {
607
607
  // ember-source does not go in vendor under embroider (we always use the
608
608
  // separate ES modules)
609
- //
610
- // loader.js sets up AMD. We don't use AMD.
611
- return !['./vendor/loader/loader.js', './vendor/ember/ember.js'].includes(path);
609
+ return !['./vendor/ember/ember.js'].includes(path);
612
610
  }
613
611
  //# sourceMappingURL=compat-app.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compat-app.js","sourceRoot":"","sources":["compat-app.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,0CAA+G;AAG/G,uCAAgD;AAChD,2DAA6C;AAC7C,mCAA2C;AAC3C,+BAAsD;AACtD,sEAA0C;AAC1C,gFAA8C;AAC9C,qDAA6C;AAC7C,sDAA8B;AAC9B,8EAAoD;AACpD,2CAAuC;AAEvC,uCAA6G;AAC7G,gEAAsC;AACtC,oEAA2C;AAE3C,qDAAmF;AACnF,gFAAsD;AACtD,sEAAqC;AACrC,6DAAqC;AACrC,iEAAiH;AACjH,kGAA4D;AAC5D,2BAAkC;AAClC,oDAA4B;AAE5B,6DAAwD;AACxD,0DAAiC;AACjC,kFAA8C;AAQ9C,gEAAgE;AAChE,8EAA8E;AAC9E,MAAqB,SAAS;IAS5B,IAAY,OAAO;;QACjB,OAAO,MAAA,MAAA,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,0CAAE,QAAQ,CAAC,aAAa,CAAC,mCAAI,KAAK,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AO,GAAE;+CAGT;AAGD;IADC,IAAA,4BAAO,GAAE;mDAGT;AAmBD;IADC,IAAA,4BAAO,GAAE;uCAGT;AAGD;IADC,IAAA,4BAAO,GAAE;2CAKT;AAGD;IADC,IAAA,4BAAO,GAAE;2CAWT;AAWD;IADC,IAAA,4BAAO,GAAE;sDAOT;AAWD;IADC,IAAA,4BAAO,GAAE;kDA0BT;AAGD;IADC,IAAA,4BAAO,GAAE;kDAyBT;AAGO;IADP,IAAA,4BAAO,GAAE;qDAgBT;AAgTD;IADC,IAAA,4BAAO,GAAE;8CAGT;AA0CD;IADC,IAAA,4BAAO,GAAE;2CAcT;AA0DH,SAAS,mBAAmB,CAAC,IAAY;IACvC,wEAAwE;IACxE,uBAAuB;IACvB,EAAE;IACF,2CAA2C;IAC3C,OAAO,CAAC,CAAC,2BAA2B,EAAE,yBAAyB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import type { Node as BroccoliNode } from 'broccoli-node-api';\nimport type { Stage, Package } from '@embroider/core';\nimport { PackageCache, WaitForTrees, RewrittenPackageCache, locateEmbroiderWorkingDir } from '@embroider/core';\nimport type Options from './options';\nimport type { CompatOptionsType } from './options';\nimport { optionsWithDefaults } from './options';\nimport { Memoize } from 'typescript-memoize';\nimport { sync as pkgUpSync } from 'pkg-up';\nimport { join, dirname, isAbsolute, sep } from 'path';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport { WatchedDir } from 'broccoli-source';\nimport resolve from 'resolve';\nimport ContentForConfig from './content-for-config';\nimport { V1Config } from './v1-config';\nimport type { AddonMeta, EmberAppInstance, OutputFileToInputFileMap, PackageInfo } from '@embroider/core';\nimport { writeJSONSync, ensureDirSync, copySync, pathExistsSync, existsSync, writeFileSync } from 'fs-extra';\nimport AddToTree from './add-to-tree';\nimport DummyPackage from './dummy-package';\nimport type { PluginItem, TransformOptions } from '@babel/core';\nimport { isEmbroiderMacrosPlugin, MacrosConfig } from '@embroider/macros/src/node';\nimport resolvePackagePath from 'resolve-package-path';\nimport Concat from 'broccoli-concat';\nimport mapKeys from 'lodash/mapKeys';\nimport { isEmberAutoImportDynamic, isHtmlbarColocation, isInlinePrecompilePlugin } from './detect-babel-plugins';\nimport loadAstPlugins from './prepare-htmlbars-ast-plugins';\nimport { readFileSync } from 'fs';\nimport semver from 'semver';\nimport type { Transform } from 'babel-plugin-ember-template-compilation';\nimport { CompatAppBuilder } from './compat-app-builder';\nimport walkSync from 'walk-sync';\nimport writeFile from 'broccoli-file-creator';\n\ninterface Group {\n outputFiles: OutputFileToInputFileMap;\n implicitKey: '_implicitStyles' | '_implicitScripts';\n vendorOutputPath: 'string';\n}\n\n// This runs at broccoli-pipeline-construction time, whereas the\n// CompatAppBuilder instance only becomes available during tree-building time.\nexport default class CompatApp {\n private annotation = '@embroider/compat/app';\n private active: CompatAppBuilder | undefined;\n readonly options: CompatOptionsType;\n\n private _publicAssets: { [filePath: string]: string } = Object.create(null);\n private _implicitScripts: string[] = [];\n private _implicitStyles: string[] = [];\n\n private get isDummy(): boolean {\n return this.legacyEmberAppInstance.project.pkg.keywords?.includes('ember-addon') ?? false;\n }\n\n get name(): string {\n if (this.isDummy) {\n // here we accept the ember-cli behavior\n return this.legacyEmberAppInstance.name;\n } else {\n // always the name from package.json. Not the one that apps may have weirdly\n // customized.\n return this.legacyEmberAppInstance.project.pkg.name;\n }\n }\n\n get env(): string {\n return this.legacyEmberAppInstance.env;\n }\n\n @Memoize()\n get root(): string {\n if (this.isDummy) {\n // this is the Known Hack for finding the true root of the dummy app.\n return join(this.legacyEmberAppInstance.project.configPath(), '..', '..');\n } else {\n return dirname(pkgUpSync({ cwd: this.legacyEmberAppInstance.project.root })!);\n }\n }\n\n @Memoize()\n private get emberCLILocation() {\n const emberCLIPackage = resolvePackagePath('ember-cli', this.root);\n\n if (emberCLIPackage === null) {\n throw new Error(`Embroider: cannot resolve ember-cli's package.json`);\n }\n\n return dirname(emberCLIPackage);\n }\n\n @Memoize()\n get hasCompiledStyles() {\n return semver.gte(JSON.parse(readFileSync(`${this.emberCLILocation}/package.json`, 'utf8')).version, '3.18.0');\n }\n\n private requireFromEmberCLI(specifier: string) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(resolve.sync(specifier, { basedir: this.emberCLILocation }));\n }\n\n private get configLoader() {\n return this.requireFromEmberCLI('broccoli-config-loader');\n }\n\n private get appUtils() {\n return this.requireFromEmberCLI('./lib/utilities/ember-app-utils');\n }\n\n @Memoize()\n get addonTreeCache(): Map<string, BroccoliNode> {\n return new Map();\n }\n\n @Memoize()\n get preprocessRegistry() {\n return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');\n }\n\n get shouldBuildTests(): boolean {\n return this.legacyEmberAppInstance.tests || false;\n }\n\n configPath(): string {\n return this.legacyEmberAppInstance.project.configPath();\n }\n\n private get configTree() {\n return new this.configLoader(dirname(this.configPath()), {\n env: this.legacyEmberAppInstance.env,\n tests: this.legacyEmberAppInstance.tests || false,\n project: this.legacyEmberAppInstance.project,\n });\n }\n\n @Memoize()\n private get config(): V1Config {\n return new V1Config(this.configTree, this.legacyEmberAppInstance.env);\n }\n\n @Memoize()\n get testConfig(): V1Config | undefined {\n if (this.shouldBuildTests) {\n return new V1Config(this.configTree, 'test');\n }\n }\n\n @Memoize()\n private get contentFor(): ContentForConfig {\n const configPaths = [\n { file: '/index.html', path: join('environments', `${this.legacyEmberAppInstance.env}.json`) },\n ];\n if (this.shouldBuildTests) configPaths.push({ file: '/tests/index.html', path: join('environments', `test.json`) });\n return new ContentForConfig(this.configTree, {\n availableContentForTypes: this.options.availableContentForTypes,\n configPaths,\n pattern: this.filteredPatternsByContentFor.contentFor,\n });\n }\n\n get autoRun(): boolean {\n return this.legacyEmberAppInstance.options.autoRun;\n }\n\n private get storeConfigInMeta(): boolean {\n return this.legacyEmberAppInstance.options.storeConfigInMeta;\n }\n\n @Memoize()\n private get configReplacePatterns() {\n return this.appUtils.configReplacePatterns({\n addons: this.legacyEmberAppInstance.project.addons,\n autoRun: this.autoRun,\n storeConfigInMeta: this.storeConfigInMeta,\n });\n }\n\n private get filteredPatternsByContentFor() {\n const filter = '/{{content-for [\\'\"](.+?)[\"\\']}}/g';\n return {\n contentFor: this.configReplacePatterns.find((pattern: any) => filter.includes(pattern.match.toString())),\n others: this.configReplacePatterns.filter((pattern: any) => !filter.includes(pattern.match.toString())),\n };\n }\n\n @Memoize()\n extraBabelPlugins(): PluginItem[] {\n // this finds any custom babel plugins on the app (either because the app\n // author explicitly added some, or because addons have pushed plugins into\n // it).\n let appBabel: TransformOptions = this.legacyEmberAppInstance.options.babel;\n if (appBabel) {\n if (appBabel.plugins) {\n return appBabel.plugins.filter(p => {\n // even if the app was using @embroider/macros, we drop it from the config\n // here in favor of our globally-configured one.\n return (\n !isEmbroiderMacrosPlugin(p) &&\n // similarly, if the app was already using an inline template compiler\n // babel plugin, we remove it here because we have our own\n // always-installed version of that (v2 addons are allowed to assume it\n // will be present in the final app build, the app doesn't get to turn\n // that off or configure it.)\n !isInlinePrecompilePlugin(p) &&\n !isEmberAutoImportDynamic(p) &&\n !isHtmlbarColocation(p)\n );\n });\n }\n }\n return [];\n }\n\n @Memoize()\n babelMajorVersion(): 7 {\n let babelAddon = this.legacyEmberAppInstance.project.addons.find((a: any) => a.name === 'ember-cli-babel');\n if (babelAddon) {\n let babelAddonMajor = Number(babelAddon.pkg.version.split('.')[0]);\n let babelMajor: number | undefined = babelAddonMajor;\n if (babelAddonMajor >= 8) {\n // `ember-cli-babel` v8 breaks lockstep with Babel, because it now\n // defines `@babel/core` as a peer dependency, so we need to check the\n // project's version of `@babel/core`:\n let babelVersion = this.legacyEmberAppInstance.project.pkg.devDependencies?.['@babel/core'];\n if (babelVersion) {\n babelMajor = semver.coerce(babelVersion)?.major;\n } else {\n babelMajor = 7;\n }\n }\n if (babelMajor !== 7) {\n throw new Error('`@embroider/compat` only supports apps and addons that use Babel v7.');\n }\n return babelMajor;\n }\n // if we didn't have our own babel plugin at all, it's safe to parse our\n // code with 7.\n return 7;\n }\n\n @Memoize()\n private transformedNodeFiles(): Map<string, string> {\n // any app.imports from node_modules that need custom transforms will need\n // to get copied into our own synthesized vendor package. app.imports from\n // node_modules that *don't* need custom transforms can just stay where they\n // are.\n let transformed = new Map();\n for (let transformConfig of this.legacyEmberAppInstance._customTransformsMap.values()) {\n for (let filename of transformConfig.files as string[]) {\n let preresolved = this.preresolvedNodeFile(filename);\n if (preresolved) {\n transformed.set(filename, preresolved);\n }\n }\n }\n return transformed;\n }\n\n private preresolvedNodeFile(filename: string) {\n // this regex is an exact copy of how ember-cli does this, so we align.\n let match = filename.match(/^node_modules\\/((@[^/]+\\/)?[^/]+)\\//);\n if (match) {\n // ember-cli has already done its own resolution of\n // `app.import('node_modules/something/...')`, so we go find its answer.\n for (let { name, path } of this.legacyEmberAppInstance._nodeModules.values()) {\n if (match[1] === name) {\n return filename.replace(match[0], path + sep);\n }\n }\n throw new Error(`bug: expected ember-cli to already have a resolved path for asset ${filename}`);\n }\n }\n\n private combinedVendor(addonTrees: BroccoliNode[]): BroccoliNode {\n let trees = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: 'vendor',\n destDir: 'vendor',\n })\n );\n\n let emberSource = this.legacyEmberAppInstance.project.addons.find(a => a.name === 'ember-source');\n if (emberSource && (emberSource.pkg['ember-addon']?.['version'] ?? 1) >= 2) {\n // there's stuff in the ecosystem that assumes these files will always be\n // present in the vendor tree. But when ember-source is V2, it cannot put\n // them there, so @embroider/compat will fill in defaults. The bundles are\n // empty because we're just trying to keep the build from blowing up, the\n // actual ember modules get loaded as modules instead.\n //\n // The template compiler is still here so that apps using a V2 ember can\n // still app.import the traditional runtime template compiler.\n trees.push(writeFile('vendor/ember/ember.js', () => ''));\n trees.push(writeFile('vendor/ember/ember-testing.js', () => ''));\n const templateCompilerSrc = readFileSync(join(emberSource.root, 'dist/ember-template-compiler.js'), 'utf8');\n trees.push(writeFile('vendor/ember/ember-testing.js', () => templateCompilerSrc));\n }\n\n if (this.vendorTree) {\n trees.push(\n buildFunnel(this.vendorTree, {\n destDir: 'vendor',\n })\n );\n }\n\n const tree = mergeTrees(trees, { overwrite: true });\n\n const outputGroups: Group[] = [\n // scripts\n {\n outputFiles: this.legacyEmberAppInstance._scriptOutputFiles,\n implicitKey: '_implicitScripts',\n vendorOutputPath: this.legacyEmberAppInstance.options.outputPaths.vendor.js,\n },\n // styles\n {\n outputFiles: this.legacyEmberAppInstance._styleOutputFiles,\n implicitKey: '_implicitStyles',\n vendorOutputPath: this.legacyEmberAppInstance.options.outputPaths.vendor.css,\n },\n ];\n\n const concatentations = [];\n\n // support: app.import / outputFile / using\n for (let entry of outputGroups) {\n const { outputFiles, implicitKey, vendorOutputPath } = entry;\n for (let importPath of Object.keys(outputFiles)) {\n const headerFiles = outputFiles[importPath];\n\n if (importPath === vendorOutputPath) {\n // these are the default ember-cli output files vendor.js or\n // vendor.css. Let embroider handle these.\n this[implicitKey] = headerFiles;\n } else if (headerFiles.length === 0) {\n // something went really wrong, open an issue\n throw new Error('Embroider: EWUT');\n } else if (headerFiles.length === 1) {\n // app.import(x, { outputFile: y }); where only one app.imports had this outputFile\n //\n // No concat needed. Simply serialize the remapping in the addon's\n // manifest, this ensures it is included in the final output with no extra work.\n this._publicAssets[headerFiles[0]] = importPath;\n } else {\n // app.import(x, { outputFile: y }); where multiple app.imports share one outputFile\n // Concat needed. Perform concat, and include the outputFile in the\n // addon's manifest. This ensures it is included in the final output\n this._publicAssets[importPath] = importPath;\n\n concatentations.push(\n new Concat(tree, {\n headerFiles,\n outputFile: importPath,\n annotation: `Package ${importPath}`,\n separator: '\\n;',\n sourceMapConfig: this.legacyEmberAppInstance.options['sourcemaps'],\n })\n );\n }\n }\n }\n\n this.addOtherAssets();\n return mergeTrees([tree, ...concatentations], { overwrite: true });\n }\n\n private addOtherAssets() {\n for (let asset of this.legacyEmberAppInstance.otherAssetPaths) {\n this._publicAssets[`${asset.src}/${asset.file}`] = `${asset.dest}/${asset.file}`;\n }\n }\n\n private addNodeAssets(inputTree: BroccoliNode): BroccoliNode {\n let transformedNodeFiles = this.transformedNodeFiles();\n\n return new AddToTree(inputTree, outputPath => {\n for (let [localDestPath, sourcePath] of transformedNodeFiles) {\n let destPath = join(outputPath, localDestPath);\n ensureDirSync(dirname(destPath));\n copySync(sourcePath, destPath);\n }\n\n if (this.shouldBuildTests) {\n writeFileSync(\n join(outputPath, 'testem.js'),\n `/*\n * This is dummy file that exists for the sole purpose\n * of allowing tests to run directly in the browser as\n * well as by Testem.\n *\n * Testem is configured to run tests directly against\n * the test build of index.html, which requires a\n * snippet to load the testem.js file:\n * <script src=\"/testem.js\"></script>\n * This has to go before the qunit framework and app\n * tests are loaded.\n *\n * Testem internally supplies this file. However, if you\n * run the tests directly in the browser (localhost:8000/tests),\n * this file does not exist.\n *\n * Hence the purpose of this fake file. This file is served\n * directly from the express server to satisify the script load.\n*/`\n );\n this._publicAssets['/testem.js'] = './testem.js';\n }\n\n let remapAsset = this.remapAsset.bind(this);\n\n let addonMeta: AddonMeta = {\n version: 2,\n 'implicit-scripts': this._implicitScripts.map(remapAsset).filter(forbiddenVendorPath),\n 'implicit-styles': this._implicitStyles.map(remapAsset),\n 'implicit-test-scripts': this.legacyEmberAppInstance.legacyTestFilesToAppend.map(remapAsset),\n 'implicit-test-styles': this.legacyEmberAppInstance.vendorTestStaticStyles.map(remapAsset),\n 'public-assets': mapKeys(this._publicAssets, (_, key) => remapAsset(key)),\n };\n let meta: PackageInfo = {\n name: '@embroider/synthesized-vendor',\n version: '0.0.0',\n keywords: ['ember-addon'],\n 'ember-addon': addonMeta,\n };\n writeJSONSync(join(outputPath, 'package.json'), meta, { spaces: 2 });\n });\n }\n\n synthesizeVendorPackage(addonTrees: BroccoliNode[]): BroccoliNode {\n return this.applyCustomTransforms(this.addNodeAssets(this.combinedVendor(addonTrees)));\n }\n\n private combinedStyles(addonTrees: BroccoliNode[]): BroccoliNode {\n let trees: BroccoliNode[] = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: '_app_styles_',\n })\n );\n let appStyles = this.legacyEmberAppInstance.trees.styles as BroccoliNode | undefined;\n if (appStyles) {\n // Workaround for https://github.com/ember-cli/ember-cli/issues/9020\n //\n // The default app styles tree is unwatched and relies on side effects\n // elsewhere in ember-cli's build pipeline to actually get rebuilds to\n // work. Here we need it to actually be watched properly if we want to\n // rely on it, particularly when using BROCCOLI_ENABLED_MEMOIZE.\n if ((appStyles as any)._watched === false && (appStyles as any)._directoryPath) {\n appStyles = new WatchedDir((appStyles as any)._directoryPath);\n }\n trees.push(appStyles);\n }\n return mergeTrees(trees, { overwrite: true, annotation: 'embroider-v1-app-combined-styles' });\n }\n\n synthesizeStylesPackage(addonTrees: BroccoliNode[]): BroccoliNode {\n let options = {\n // we're deliberately not allowing this to be customized. It's an\n // internal implementation detail, and respecting outputPaths here is\n // unnecessary complexity. The corresponding code that adjusts the HTML\n // <link> is in updateHTML in app.ts.\n outputPaths: { app: `/assets/${this.name}.css` },\n registry: this.legacyEmberAppInstance.registry,\n minifyCSS: this.legacyEmberAppInstance.options.minifyCSS.options,\n };\n\n let nestedInput = buildFunnel(this.combinedStyles(addonTrees), { destDir: 'app/styles' });\n let styles = this.preprocessors.preprocessCss(nestedInput, '/app/styles', '/assets', options);\n\n return new AddToTree(styles, outputPath => {\n let addonMeta: AddonMeta = {\n version: 2,\n 'public-assets': {},\n };\n let assetPath = join(outputPath, 'assets');\n if (pathExistsSync(assetPath)) {\n for (let file of walkSync(assetPath, { directories: false })) {\n addonMeta['public-assets']![`./assets/${file}`] = `/assets/${file}`;\n }\n }\n let meta: PackageInfo = {\n name: '@embroider/synthesized-styles',\n version: '0.0.0',\n keywords: ['ember-addon'],\n 'ember-addon': addonMeta,\n };\n writeJSONSync(join(outputPath, 'package.json'), meta, { spaces: 2 });\n });\n }\n\n // this is taken nearly verbatim from ember-cli.\n private applyCustomTransforms(externalTree: BroccoliNode) {\n for (let customTransformEntry of this.legacyEmberAppInstance._customTransformsMap) {\n let transformName = customTransformEntry[0];\n let transformConfig = customTransformEntry[1];\n\n let transformTree = buildFunnel(externalTree, {\n files: transformConfig.files,\n annotation: `Funnel (custom transform: ${transformName})`,\n });\n\n externalTree = mergeTrees([externalTree, transformConfig.callback(transformTree, transformConfig.options)], {\n annotation: `TreeMerger (custom transform: ${transformName})`,\n overwrite: true,\n });\n }\n return externalTree;\n }\n\n private remapAsset(asset: string) {\n if (this.transformedNodeFiles().has(asset)) {\n // transformed node assets become local paths, because we have copied\n // those ones into our synthesized vendor package.\n return './' + asset;\n }\n let preresolved = this.preresolvedNodeFile(asset);\n if (preresolved) {\n // non-transformed node assets point directly at their pre-resolved\n // original files (this is an absolute path).\n return preresolved;\n }\n // non node assets are local paths. They need an explicit `/` or `.` at\n // the start.\n if (asset.startsWith('.') || isAbsolute(asset)) {\n return asset;\n }\n return './' + asset;\n }\n\n get htmlbarsPlugins(): Transform[] {\n let plugins = loadAstPlugins(this.legacyEmberAppInstance.registry);\n // even if the app was using @embroider/macros, we drop it from the config\n // here in favor of our globally-configured one.\n plugins = plugins.filter((p: any) => !isEmbroiderMacrosPlugin(p));\n return plugins;\n }\n\n private get vendorTree(): BroccoliNode | undefined {\n return this.ensureTree(this.legacyEmberAppInstance.trees.vendor);\n }\n\n private ensureTree(maybeTree: string | BroccoliNode | undefined): BroccoliNode | undefined {\n if (typeof maybeTree === 'string') {\n // this is deliberately mimicking how ember-cli does it. We don't use\n // `this.root` on purpose, because that can differ from what ember-cli\n // considers the project.root. And we don't use path.resolve even though\n // that seems possibly more correct, because ember-cli always assumes the\n // input is relative.\n let resolvedPath = join(this.legacyEmberAppInstance.project.root, maybeTree);\n if (existsSync(resolvedPath)) {\n return new WatchedDir(maybeTree);\n } else {\n return undefined;\n }\n }\n return maybeTree;\n }\n\n @Memoize()\n private get preprocessors(): Preprocessors {\n return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');\n }\n\n readonly macrosConfig: MacrosConfig;\n\n constructor(readonly legacyEmberAppInstance: EmberAppInstance, _options?: Options) {\n this.options = optionsWithDefaults(_options);\n\n this.macrosConfig = MacrosConfig.for(legacyEmberAppInstance, this.root);\n if (this.env !== 'production') {\n this.macrosConfig.enablePackageDevelopment(this.root);\n this.macrosConfig.enableRuntimeMode();\n if (this.isDummy) {\n // dummy apps automatically put their owning addon under development too\n this.macrosConfig.enablePackageDevelopment(\n dirname(pkgUpSync({ cwd: this.legacyEmberAppInstance.project.root })!)\n );\n }\n }\n\n // this uses globalConfig because it's a way for packages to ask \"is\n // Embroider doing this build?\". So it's necessarily global, not scoped to\n // any subgraph of dependencies.\n this.macrosConfig.setGlobalConfig(__filename, `@embroider/core`, {\n // this is hard-coded to true because it literally means \"embroider is\n // building this Ember app\". You can see non-true when using the Embroider\n // macros in a classic build.\n active: true,\n });\n }\n\n private inTrees(prevStageTree: BroccoliNode) {\n let configTree = this.config;\n let contentForTree = this.contentFor;\n\n return {\n configTree,\n contentForTree,\n prevStageTree,\n };\n }\n\n @Memoize()\n appPackage(): Package {\n // this is deliberately not RewrittenPackageCache, because it's supposed to\n // be the original copy of the app with all the original dependencies.\n let packageCache = PackageCache.shared('embroider', this.root);\n if (this.isDummy) {\n return new DummyPackage(\n this.root,\n this.legacyEmberAppInstance.project.root,\n packageCache as unknown as PackageCache // TODO: cast won't be needed when refactor is complete\n );\n } else {\n return packageCache.get(this.root);\n }\n }\n\n private async instantiate(\n packageCache: RewrittenPackageCache,\n configTree: V1Config,\n contentForTree: ContentForConfig\n ) {\n let origAppPkg = this.appPackage();\n let movedAppPkg = packageCache.withRewrittenDeps(origAppPkg);\n let workingDir = locateEmbroiderWorkingDir(this.root);\n return new CompatAppBuilder(\n origAppPkg,\n movedAppPkg,\n this.options,\n this,\n configTree,\n contentForTree,\n packageCache.get(join(workingDir, 'rewritten-packages', '@embroider', 'synthesized-vendor')),\n packageCache.get(join(workingDir, 'rewritten-packages', '@embroider', 'synthesized-styles'))\n );\n }\n\n asStage(prevStage: Stage): Stage {\n let resolve: (result: { outputPath: string }) => void;\n let promise: Promise<{ outputPath: string }> = new Promise(r => (resolve = r));\n\n let tree = () => {\n let inTrees = this.inTrees(prevStage.tree);\n return new WaitForTrees(inTrees, this.annotation, async _treePaths => {\n if (!this.active) {\n let { outputPath } = await prevStage.ready();\n let packageCache = RewrittenPackageCache.shared('embroider', this.root);\n this.active = await this.instantiate(packageCache, inTrees.configTree, inTrees.contentForTree);\n resolve({ outputPath });\n }\n await this.active.build();\n });\n };\n\n return {\n get inputPath() {\n return prevStage.inputPath;\n },\n ready: async () => {\n return await promise;\n },\n get tree() {\n return tree();\n },\n };\n }\n}\n\ninterface Preprocessors {\n preprocessJs(tree: BroccoliNode, a: string, b: string, options: object): BroccoliNode;\n preprocessCss(tree: BroccoliNode, a: string, b: string, options: object): BroccoliNode;\n}\n\nfunction forbiddenVendorPath(path: string) {\n // ember-source does not go in vendor under embroider (we always use the\n // separate ES modules)\n //\n // loader.js sets up AMD. We don't use AMD.\n return !['./vendor/loader/loader.js', './vendor/ember/ember.js'].includes(path);\n}\n"]}
1
+ {"version":3,"file":"compat-app.js","sourceRoot":"","sources":["compat-app.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,0CAA+G;AAG/G,uCAAgD;AAChD,2DAA6C;AAC7C,mCAA2C;AAC3C,+BAAsD;AACtD,sEAA0C;AAC1C,gFAA8C;AAC9C,qDAA6C;AAC7C,sDAA8B;AAC9B,8EAAoD;AACpD,2CAAuC;AAEvC,uCAA6G;AAC7G,gEAAsC;AACtC,oEAA2C;AAE3C,qDAAmF;AACnF,gFAAsD;AACtD,sEAAqC;AACrC,6DAAqC;AACrC,iEAAiH;AACjH,kGAA4D;AAC5D,2BAAkC;AAClC,oDAA4B;AAE5B,6DAAwD;AACxD,0DAAiC;AACjC,kFAA8C;AAQ9C,gEAAgE;AAChE,8EAA8E;AAC9E,MAAqB,SAAS;IAS5B,IA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AArlBC;IADC,IAAA,4BAAO,GAAE;qCAQT;AAGD;IADC,IAAA,4BAAO,GAAE;iDAST;AAGD;IADC,IAAA,4BAAO,GAAE;kDAGT;AAgBD;IADC,IAAA,4BAAO,GAAE;+CAGT;AAGD;IADC,IAAA,4BAAO,GAAE;mDAGT;AAmBD;IADC,IAAA,4BAAO,GAAE;uCAGT;AAGD;IADC,IAAA,4BAAO,GAAE;2CAKT;AAGD;IADC,IAAA,4BAAO,GAAE;2CAWT;AAWD;IADC,IAAA,4BAAO,GAAE;sDAOT;AAWD;IADC,IAAA,4BAAO,GAAE;kDA0BT;AAGD;IADC,IAAA,4BAAO,GAAE;kDAyBT;AAGO;IADP,IAAA,4BAAO,GAAE;qDAgBT;AAgTD;IADC,IAAA,4BAAO,GAAE;8CAGT;AA0CD;IADC,IAAA,4BAAO,GAAE;2CAcT;AA0DH,SAAS,mBAAmB,CAAC,IAAY;IACvC,wEAAwE;IACxE,uBAAuB;IACvB,OAAO,CAAC,CAAC,yBAAyB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import type { Node as BroccoliNode } from 'broccoli-node-api';\nimport type { Stage, Package } from '@embroider/core';\nimport { PackageCache, WaitForTrees, RewrittenPackageCache, locateEmbroiderWorkingDir } from '@embroider/core';\nimport type Options from './options';\nimport type { CompatOptionsType } from './options';\nimport { optionsWithDefaults } from './options';\nimport { Memoize } from 'typescript-memoize';\nimport { sync as pkgUpSync } from 'pkg-up';\nimport { join, dirname, isAbsolute, sep } from 'path';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport { WatchedDir } from 'broccoli-source';\nimport resolve from 'resolve';\nimport ContentForConfig from './content-for-config';\nimport { V1Config } from './v1-config';\nimport type { AddonMeta, EmberAppInstance, OutputFileToInputFileMap, PackageInfo } from '@embroider/core';\nimport { writeJSONSync, ensureDirSync, copySync, pathExistsSync, existsSync, writeFileSync } from 'fs-extra';\nimport AddToTree from './add-to-tree';\nimport DummyPackage from './dummy-package';\nimport type { PluginItem, TransformOptions } from '@babel/core';\nimport { isEmbroiderMacrosPlugin, MacrosConfig } from '@embroider/macros/src/node';\nimport resolvePackagePath from 'resolve-package-path';\nimport Concat from 'broccoli-concat';\nimport mapKeys from 'lodash/mapKeys';\nimport { isEmberAutoImportDynamic, isHtmlbarColocation, isInlinePrecompilePlugin } from './detect-babel-plugins';\nimport loadAstPlugins from './prepare-htmlbars-ast-plugins';\nimport { readFileSync } from 'fs';\nimport semver from 'semver';\nimport type { Transform } from 'babel-plugin-ember-template-compilation';\nimport { CompatAppBuilder } from './compat-app-builder';\nimport walkSync from 'walk-sync';\nimport writeFile from 'broccoli-file-creator';\n\ninterface Group {\n outputFiles: OutputFileToInputFileMap;\n implicitKey: '_implicitStyles' | '_implicitScripts';\n vendorOutputPath: 'string';\n}\n\n// This runs at broccoli-pipeline-construction time, whereas the\n// CompatAppBuilder instance only becomes available during tree-building time.\nexport default class CompatApp {\n private annotation = '@embroider/compat/app';\n private active: CompatAppBuilder | undefined;\n readonly options: CompatOptionsType;\n\n private _publicAssets: { [filePath: string]: string } = Object.create(null);\n private _implicitScripts: string[] = [];\n private _implicitStyles: string[] = [];\n\n private get isDummy(): boolean {\n return this.legacyEmberAppInstance.project.pkg.keywords?.includes('ember-addon') ?? false;\n }\n\n get name(): string {\n if (this.isDummy) {\n // here we accept the ember-cli behavior\n return this.legacyEmberAppInstance.name;\n } else {\n // always the name from package.json. Not the one that apps may have weirdly\n // customized.\n return this.legacyEmberAppInstance.project.pkg.name;\n }\n }\n\n get env(): string {\n return this.legacyEmberAppInstance.env;\n }\n\n @Memoize()\n get root(): string {\n if (this.isDummy) {\n // this is the Known Hack for finding the true root of the dummy app.\n return join(this.legacyEmberAppInstance.project.configPath(), '..', '..');\n } else {\n return dirname(pkgUpSync({ cwd: this.legacyEmberAppInstance.project.root })!);\n }\n }\n\n @Memoize()\n private get emberCLILocation() {\n const emberCLIPackage = resolvePackagePath('ember-cli', this.root);\n\n if (emberCLIPackage === null) {\n throw new Error(`Embroider: cannot resolve ember-cli's package.json`);\n }\n\n return dirname(emberCLIPackage);\n }\n\n @Memoize()\n get hasCompiledStyles() {\n return semver.gte(JSON.parse(readFileSync(`${this.emberCLILocation}/package.json`, 'utf8')).version, '3.18.0');\n }\n\n private requireFromEmberCLI(specifier: string) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(resolve.sync(specifier, { basedir: this.emberCLILocation }));\n }\n\n private get configLoader() {\n return this.requireFromEmberCLI('broccoli-config-loader');\n }\n\n private get appUtils() {\n return this.requireFromEmberCLI('./lib/utilities/ember-app-utils');\n }\n\n @Memoize()\n get addonTreeCache(): Map<string, BroccoliNode> {\n return new Map();\n }\n\n @Memoize()\n get preprocessRegistry() {\n return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');\n }\n\n get shouldBuildTests(): boolean {\n return this.legacyEmberAppInstance.tests || false;\n }\n\n configPath(): string {\n return this.legacyEmberAppInstance.project.configPath();\n }\n\n private get configTree() {\n return new this.configLoader(dirname(this.configPath()), {\n env: this.legacyEmberAppInstance.env,\n tests: this.legacyEmberAppInstance.tests || false,\n project: this.legacyEmberAppInstance.project,\n });\n }\n\n @Memoize()\n private get config(): V1Config {\n return new V1Config(this.configTree, this.legacyEmberAppInstance.env);\n }\n\n @Memoize()\n get testConfig(): V1Config | undefined {\n if (this.shouldBuildTests) {\n return new V1Config(this.configTree, 'test');\n }\n }\n\n @Memoize()\n private get contentFor(): ContentForConfig {\n const configPaths = [\n { file: '/index.html', path: join('environments', `${this.legacyEmberAppInstance.env}.json`) },\n ];\n if (this.shouldBuildTests) configPaths.push({ file: '/tests/index.html', path: join('environments', `test.json`) });\n return new ContentForConfig(this.configTree, {\n availableContentForTypes: this.options.availableContentForTypes,\n configPaths,\n pattern: this.filteredPatternsByContentFor.contentFor,\n });\n }\n\n get autoRun(): boolean {\n return this.legacyEmberAppInstance.options.autoRun;\n }\n\n private get storeConfigInMeta(): boolean {\n return this.legacyEmberAppInstance.options.storeConfigInMeta;\n }\n\n @Memoize()\n private get configReplacePatterns() {\n return this.appUtils.configReplacePatterns({\n addons: this.legacyEmberAppInstance.project.addons,\n autoRun: this.autoRun,\n storeConfigInMeta: this.storeConfigInMeta,\n });\n }\n\n private get filteredPatternsByContentFor() {\n const filter = '/{{content-for [\\'\"](.+?)[\"\\']}}/g';\n return {\n contentFor: this.configReplacePatterns.find((pattern: any) => filter.includes(pattern.match.toString())),\n others: this.configReplacePatterns.filter((pattern: any) => !filter.includes(pattern.match.toString())),\n };\n }\n\n @Memoize()\n extraBabelPlugins(): PluginItem[] {\n // this finds any custom babel plugins on the app (either because the app\n // author explicitly added some, or because addons have pushed plugins into\n // it).\n let appBabel: TransformOptions = this.legacyEmberAppInstance.options.babel;\n if (appBabel) {\n if (appBabel.plugins) {\n return appBabel.plugins.filter(p => {\n // even if the app was using @embroider/macros, we drop it from the config\n // here in favor of our globally-configured one.\n return (\n !isEmbroiderMacrosPlugin(p) &&\n // similarly, if the app was already using an inline template compiler\n // babel plugin, we remove it here because we have our own\n // always-installed version of that (v2 addons are allowed to assume it\n // will be present in the final app build, the app doesn't get to turn\n // that off or configure it.)\n !isInlinePrecompilePlugin(p) &&\n !isEmberAutoImportDynamic(p) &&\n !isHtmlbarColocation(p)\n );\n });\n }\n }\n return [];\n }\n\n @Memoize()\n babelMajorVersion(): 7 {\n let babelAddon = this.legacyEmberAppInstance.project.addons.find((a: any) => a.name === 'ember-cli-babel');\n if (babelAddon) {\n let babelAddonMajor = Number(babelAddon.pkg.version.split('.')[0]);\n let babelMajor: number | undefined = babelAddonMajor;\n if (babelAddonMajor >= 8) {\n // `ember-cli-babel` v8 breaks lockstep with Babel, because it now\n // defines `@babel/core` as a peer dependency, so we need to check the\n // project's version of `@babel/core`:\n let babelVersion = this.legacyEmberAppInstance.project.pkg.devDependencies?.['@babel/core'];\n if (babelVersion) {\n babelMajor = semver.coerce(babelVersion)?.major;\n } else {\n babelMajor = 7;\n }\n }\n if (babelMajor !== 7) {\n throw new Error('`@embroider/compat` only supports apps and addons that use Babel v7.');\n }\n return babelMajor;\n }\n // if we didn't have our own babel plugin at all, it's safe to parse our\n // code with 7.\n return 7;\n }\n\n @Memoize()\n private transformedNodeFiles(): Map<string, string> {\n // any app.imports from node_modules that need custom transforms will need\n // to get copied into our own synthesized vendor package. app.imports from\n // node_modules that *don't* need custom transforms can just stay where they\n // are.\n let transformed = new Map();\n for (let transformConfig of this.legacyEmberAppInstance._customTransformsMap.values()) {\n for (let filename of transformConfig.files as string[]) {\n let preresolved = this.preresolvedNodeFile(filename);\n if (preresolved) {\n transformed.set(filename, preresolved);\n }\n }\n }\n return transformed;\n }\n\n private preresolvedNodeFile(filename: string) {\n // this regex is an exact copy of how ember-cli does this, so we align.\n let match = filename.match(/^node_modules\\/((@[^/]+\\/)?[^/]+)\\//);\n if (match) {\n // ember-cli has already done its own resolution of\n // `app.import('node_modules/something/...')`, so we go find its answer.\n for (let { name, path } of this.legacyEmberAppInstance._nodeModules.values()) {\n if (match[1] === name) {\n return filename.replace(match[0], path + sep);\n }\n }\n throw new Error(`bug: expected ember-cli to already have a resolved path for asset ${filename}`);\n }\n }\n\n private combinedVendor(addonTrees: BroccoliNode[]): BroccoliNode {\n let trees = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: 'vendor',\n destDir: 'vendor',\n })\n );\n\n let emberSource = this.legacyEmberAppInstance.project.addons.find(a => a.name === 'ember-source');\n if (emberSource && (emberSource.pkg['ember-addon']?.['version'] ?? 1) >= 2) {\n // there's stuff in the ecosystem that assumes these files will always be\n // present in the vendor tree. But when ember-source is V2, it cannot put\n // them there, so @embroider/compat will fill in defaults. The bundles are\n // empty because we're just trying to keep the build from blowing up, the\n // actual ember modules get loaded as modules instead.\n //\n // The template compiler is still here so that apps using a V2 ember can\n // still app.import the traditional runtime template compiler.\n trees.push(writeFile('vendor/ember/ember.js', () => ''));\n trees.push(writeFile('vendor/ember/ember-testing.js', () => ''));\n const templateCompilerSrc = readFileSync(join(emberSource.root, 'dist/ember-template-compiler.js'), 'utf8');\n trees.push(writeFile('vendor/ember/ember-testing.js', () => templateCompilerSrc));\n }\n\n if (this.vendorTree) {\n trees.push(\n buildFunnel(this.vendorTree, {\n destDir: 'vendor',\n })\n );\n }\n\n const tree = mergeTrees(trees, { overwrite: true });\n\n const outputGroups: Group[] = [\n // scripts\n {\n outputFiles: this.legacyEmberAppInstance._scriptOutputFiles,\n implicitKey: '_implicitScripts',\n vendorOutputPath: this.legacyEmberAppInstance.options.outputPaths.vendor.js,\n },\n // styles\n {\n outputFiles: this.legacyEmberAppInstance._styleOutputFiles,\n implicitKey: '_implicitStyles',\n vendorOutputPath: this.legacyEmberAppInstance.options.outputPaths.vendor.css,\n },\n ];\n\n const concatentations = [];\n\n // support: app.import / outputFile / using\n for (let entry of outputGroups) {\n const { outputFiles, implicitKey, vendorOutputPath } = entry;\n for (let importPath of Object.keys(outputFiles)) {\n const headerFiles = outputFiles[importPath];\n\n if (importPath === vendorOutputPath) {\n // these are the default ember-cli output files vendor.js or\n // vendor.css. Let embroider handle these.\n this[implicitKey] = headerFiles;\n } else if (headerFiles.length === 0) {\n // something went really wrong, open an issue\n throw new Error('Embroider: EWUT');\n } else if (headerFiles.length === 1) {\n // app.import(x, { outputFile: y }); where only one app.imports had this outputFile\n //\n // No concat needed. Simply serialize the remapping in the addon's\n // manifest, this ensures it is included in the final output with no extra work.\n this._publicAssets[headerFiles[0]] = importPath;\n } else {\n // app.import(x, { outputFile: y }); where multiple app.imports share one outputFile\n // Concat needed. Perform concat, and include the outputFile in the\n // addon's manifest. This ensures it is included in the final output\n this._publicAssets[importPath] = importPath;\n\n concatentations.push(\n new Concat(tree, {\n headerFiles,\n outputFile: importPath,\n annotation: `Package ${importPath}`,\n separator: '\\n;',\n sourceMapConfig: this.legacyEmberAppInstance.options['sourcemaps'],\n })\n );\n }\n }\n }\n\n this.addOtherAssets();\n return mergeTrees([tree, ...concatentations], { overwrite: true });\n }\n\n private addOtherAssets() {\n for (let asset of this.legacyEmberAppInstance.otherAssetPaths) {\n this._publicAssets[`${asset.src}/${asset.file}`] = `${asset.dest}/${asset.file}`;\n }\n }\n\n private addNodeAssets(inputTree: BroccoliNode): BroccoliNode {\n let transformedNodeFiles = this.transformedNodeFiles();\n\n return new AddToTree(inputTree, outputPath => {\n for (let [localDestPath, sourcePath] of transformedNodeFiles) {\n let destPath = join(outputPath, localDestPath);\n ensureDirSync(dirname(destPath));\n copySync(sourcePath, destPath);\n }\n\n if (this.shouldBuildTests) {\n writeFileSync(\n join(outputPath, 'testem.js'),\n `/*\n * This is dummy file that exists for the sole purpose\n * of allowing tests to run directly in the browser as\n * well as by Testem.\n *\n * Testem is configured to run tests directly against\n * the test build of index.html, which requires a\n * snippet to load the testem.js file:\n * <script src=\"/testem.js\"></script>\n * This has to go before the qunit framework and app\n * tests are loaded.\n *\n * Testem internally supplies this file. However, if you\n * run the tests directly in the browser (localhost:8000/tests),\n * this file does not exist.\n *\n * Hence the purpose of this fake file. This file is served\n * directly from the express server to satisify the script load.\n*/`\n );\n this._publicAssets['/testem.js'] = './testem.js';\n }\n\n let remapAsset = this.remapAsset.bind(this);\n\n let addonMeta: AddonMeta = {\n version: 2,\n 'implicit-scripts': this._implicitScripts.map(remapAsset).filter(forbiddenVendorPath),\n 'implicit-styles': this._implicitStyles.map(remapAsset),\n 'implicit-test-scripts': this.legacyEmberAppInstance.legacyTestFilesToAppend.map(remapAsset),\n 'implicit-test-styles': this.legacyEmberAppInstance.vendorTestStaticStyles.map(remapAsset),\n 'public-assets': mapKeys(this._publicAssets, (_, key) => remapAsset(key)),\n };\n let meta: PackageInfo = {\n name: '@embroider/synthesized-vendor',\n version: '0.0.0',\n keywords: ['ember-addon'],\n 'ember-addon': addonMeta,\n };\n writeJSONSync(join(outputPath, 'package.json'), meta, { spaces: 2 });\n });\n }\n\n synthesizeVendorPackage(addonTrees: BroccoliNode[]): BroccoliNode {\n return this.applyCustomTransforms(this.addNodeAssets(this.combinedVendor(addonTrees)));\n }\n\n private combinedStyles(addonTrees: BroccoliNode[]): BroccoliNode {\n let trees: BroccoliNode[] = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: '_app_styles_',\n })\n );\n let appStyles = this.legacyEmberAppInstance.trees.styles as BroccoliNode | undefined;\n if (appStyles) {\n // Workaround for https://github.com/ember-cli/ember-cli/issues/9020\n //\n // The default app styles tree is unwatched and relies on side effects\n // elsewhere in ember-cli's build pipeline to actually get rebuilds to\n // work. Here we need it to actually be watched properly if we want to\n // rely on it, particularly when using BROCCOLI_ENABLED_MEMOIZE.\n if ((appStyles as any)._watched === false && (appStyles as any)._directoryPath) {\n appStyles = new WatchedDir((appStyles as any)._directoryPath);\n }\n trees.push(appStyles);\n }\n return mergeTrees(trees, { overwrite: true, annotation: 'embroider-v1-app-combined-styles' });\n }\n\n synthesizeStylesPackage(addonTrees: BroccoliNode[]): BroccoliNode {\n let options = {\n // we're deliberately not allowing this to be customized. It's an\n // internal implementation detail, and respecting outputPaths here is\n // unnecessary complexity. The corresponding code that adjusts the HTML\n // <link> is in updateHTML in app.ts.\n outputPaths: { app: `/@embroider/virtual/app.css` },\n registry: this.legacyEmberAppInstance.registry,\n minifyCSS: this.legacyEmberAppInstance.options.minifyCSS.options,\n };\n\n let nestedInput = buildFunnel(this.combinedStyles(addonTrees), { destDir: 'app/styles' });\n let styles = this.preprocessors.preprocessCss(nestedInput, '/app/styles', '/assets', options);\n\n return new AddToTree(styles, outputPath => {\n let addonMeta: AddonMeta = {\n version: 2,\n 'public-assets': {},\n };\n let assetPath = join(outputPath, '@embroider', 'virtual');\n if (pathExistsSync(assetPath)) {\n for (let file of walkSync(assetPath, { directories: false })) {\n addonMeta['public-assets']![`./@embroider/virtual/${file}`] = `/@embroider/virtual/${file}`;\n }\n }\n let meta: PackageInfo = {\n name: '@embroider/synthesized-styles',\n version: '0.0.0',\n keywords: ['ember-addon'],\n 'ember-addon': addonMeta,\n };\n writeJSONSync(join(outputPath, 'package.json'), meta, { spaces: 2 });\n });\n }\n\n // this is taken nearly verbatim from ember-cli.\n private applyCustomTransforms(externalTree: BroccoliNode) {\n for (let customTransformEntry of this.legacyEmberAppInstance._customTransformsMap) {\n let transformName = customTransformEntry[0];\n let transformConfig = customTransformEntry[1];\n\n let transformTree = buildFunnel(externalTree, {\n files: transformConfig.files,\n annotation: `Funnel (custom transform: ${transformName})`,\n });\n\n externalTree = mergeTrees([externalTree, transformConfig.callback(transformTree, transformConfig.options)], {\n annotation: `TreeMerger (custom transform: ${transformName})`,\n overwrite: true,\n });\n }\n return externalTree;\n }\n\n private remapAsset(asset: string) {\n if (this.transformedNodeFiles().has(asset)) {\n // transformed node assets become local paths, because we have copied\n // those ones into our synthesized vendor package.\n return './' + asset;\n }\n let preresolved = this.preresolvedNodeFile(asset);\n if (preresolved) {\n // non-transformed node assets point directly at their pre-resolved\n // original files (this is an absolute path).\n return preresolved;\n }\n // non node assets are local paths. They need an explicit `/` or `.` at\n // the start.\n if (asset.startsWith('.') || isAbsolute(asset)) {\n return asset;\n }\n return './' + asset;\n }\n\n get htmlbarsPlugins(): Transform[] {\n let plugins = loadAstPlugins(this.legacyEmberAppInstance.registry);\n // even if the app was using @embroider/macros, we drop it from the config\n // here in favor of our globally-configured one.\n plugins = plugins.filter((p: any) => !isEmbroiderMacrosPlugin(p));\n return plugins;\n }\n\n private get vendorTree(): BroccoliNode | undefined {\n return this.ensureTree(this.legacyEmberAppInstance.trees.vendor);\n }\n\n private ensureTree(maybeTree: string | BroccoliNode | undefined): BroccoliNode | undefined {\n if (typeof maybeTree === 'string') {\n // this is deliberately mimicking how ember-cli does it. We don't use\n // `this.root` on purpose, because that can differ from what ember-cli\n // considers the project.root. And we don't use path.resolve even though\n // that seems possibly more correct, because ember-cli always assumes the\n // input is relative.\n let resolvedPath = join(this.legacyEmberAppInstance.project.root, maybeTree);\n if (existsSync(resolvedPath)) {\n return new WatchedDir(maybeTree);\n } else {\n return undefined;\n }\n }\n return maybeTree;\n }\n\n @Memoize()\n private get preprocessors(): Preprocessors {\n return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');\n }\n\n readonly macrosConfig: MacrosConfig;\n\n constructor(readonly legacyEmberAppInstance: EmberAppInstance, _options?: Options) {\n this.options = optionsWithDefaults(_options);\n\n this.macrosConfig = MacrosConfig.for(legacyEmberAppInstance, this.root);\n if (this.env !== 'production') {\n this.macrosConfig.enablePackageDevelopment(this.root);\n this.macrosConfig.enableRuntimeMode();\n if (this.isDummy) {\n // dummy apps automatically put their owning addon under development too\n this.macrosConfig.enablePackageDevelopment(\n dirname(pkgUpSync({ cwd: this.legacyEmberAppInstance.project.root })!)\n );\n }\n }\n\n // this uses globalConfig because it's a way for packages to ask \"is\n // Embroider doing this build?\". So it's necessarily global, not scoped to\n // any subgraph of dependencies.\n this.macrosConfig.setGlobalConfig(__filename, `@embroider/core`, {\n // this is hard-coded to true because it literally means \"embroider is\n // building this Ember app\". You can see non-true when using the Embroider\n // macros in a classic build.\n active: true,\n });\n }\n\n private inTrees(prevStageTree: BroccoliNode) {\n let configTree = this.config;\n let contentForTree = this.contentFor;\n\n return {\n configTree,\n contentForTree,\n prevStageTree,\n };\n }\n\n @Memoize()\n appPackage(): Package {\n // this is deliberately not RewrittenPackageCache, because it's supposed to\n // be the original copy of the app with all the original dependencies.\n let packageCache = PackageCache.shared('embroider', this.root);\n if (this.isDummy) {\n return new DummyPackage(\n this.root,\n this.legacyEmberAppInstance.project.root,\n packageCache as unknown as PackageCache // TODO: cast won't be needed when refactor is complete\n );\n } else {\n return packageCache.get(this.root);\n }\n }\n\n private async instantiate(\n packageCache: RewrittenPackageCache,\n configTree: V1Config,\n contentForTree: ContentForConfig\n ) {\n let origAppPkg = this.appPackage();\n let movedAppPkg = packageCache.withRewrittenDeps(origAppPkg);\n let workingDir = locateEmbroiderWorkingDir(this.root);\n return new CompatAppBuilder(\n origAppPkg,\n movedAppPkg,\n this.options,\n this,\n configTree,\n contentForTree,\n packageCache.get(join(workingDir, 'rewritten-packages', '@embroider', 'synthesized-vendor')),\n packageCache.get(join(workingDir, 'rewritten-packages', '@embroider', 'synthesized-styles'))\n );\n }\n\n asStage(prevStage: Stage): Stage {\n let resolve: (result: { outputPath: string }) => void;\n let promise: Promise<{ outputPath: string }> = new Promise(r => (resolve = r));\n\n let tree = () => {\n let inTrees = this.inTrees(prevStage.tree);\n return new WaitForTrees(inTrees, this.annotation, async _treePaths => {\n if (!this.active) {\n let { outputPath } = await prevStage.ready();\n let packageCache = RewrittenPackageCache.shared('embroider', this.root);\n this.active = await this.instantiate(packageCache, inTrees.configTree, inTrees.contentForTree);\n resolve({ outputPath });\n }\n await this.active.build();\n });\n };\n\n return {\n get inputPath() {\n return prevStage.inputPath;\n },\n ready: async () => {\n return await promise;\n },\n get tree() {\n return tree();\n },\n };\n }\n}\n\ninterface Preprocessors {\n preprocessJs(tree: BroccoliNode, a: string, b: string, options: object): BroccoliNode;\n preprocessCss(tree: BroccoliNode, a: string, b: string, options: object): BroccoliNode;\n}\n\nfunction forbiddenVendorPath(path: string) {\n // ember-source does not go in vendor under embroider (we always use the\n // separate ES modules)\n return !['./vendor/ember/ember.js'].includes(path);\n}\n"]}
package/src/options.d.ts CHANGED
@@ -2,8 +2,6 @@ import type { V1AddonConstructor } from './v1-addon';
2
2
  import type { Options as CoreOptions } from '@embroider/core';
3
3
  import type { PackageRules } from './dependency-rules';
4
4
  export default interface Options extends CoreOptions {
5
- staticAddonTrees?: boolean;
6
- staticAddonTestSupportTrees?: boolean;
7
5
  compatAdapters?: Map<string, V1AddonConstructor | null>;
8
6
  packageRules?: PackageRules[];
9
7
  allowUnsafeDynamicComponents?: boolean;
@@ -11,7 +9,7 @@ export default interface Options extends CoreOptions {
11
9
  useAddonAppBoot?: boolean;
12
10
  useAddonConfigModule?: boolean;
13
11
  }
14
- export type CompatOptionsType = Required<Omit<Options, 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'staticInvokables'>> & Pick<Options, 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'staticInvokables'>;
12
+ export type CompatOptionsType = Required<Options>;
15
13
  export declare function optionsWithDefaults(options?: Options): CompatOptionsType;
16
14
  export declare const recommendedOptions: {
17
15
  [name: string]: Options;
package/src/options.js CHANGED
@@ -16,6 +16,41 @@ const defaults = Object.assign((0, core_1.optionsWithDefaults)(), {
16
16
  useAddonConfigModule: true,
17
17
  });
18
18
  function optionsWithDefaults(options) {
19
+ if ((options === null || options === void 0 ? void 0 : options.staticEmberSource) !== undefined) {
20
+ if (options.staticEmberSource === false) {
21
+ throw new Error(`You have set 'staticEmberSource' to 'false' in your Embroider options. This option has been removed is always considered to have the value 'true'. Please remove this setting to continue.`);
22
+ }
23
+ else {
24
+ console.log(`You have set 'staticEmberSource' in your Embroider options. This can safely be removed now and it defaults to true.`);
25
+ }
26
+ }
27
+ if ((options === null || options === void 0 ? void 0 : options.staticEmberSource) !== undefined) {
28
+ if (options.staticEmberSource === false) {
29
+ throw new Error(`You have set 'staticEmberSource' to 'false' in your Embroider options. This option has been removed is always considered to have the value 'true'. Please remove this setting to continue.`);
30
+ }
31
+ else {
32
+ console.log(`You have set 'staticEmberSource' in your Embroider options. This can safely be removed now and it defaults to true.`);
33
+ }
34
+ }
35
+ if ((options === null || options === void 0 ? void 0 : options.staticAddonTrees) !== undefined) {
36
+ if (options.staticAddonTrees === false) {
37
+ throw new Error(`You have set 'staticAddonTrees' to 'false' in your Embroider options. This option has been removed is always considered to have the value 'true'. Please remove this setting to continue.`);
38
+ }
39
+ else {
40
+ console.log(`You have set 'staticAddonTrees' in your Embroider options. This can safely be removed now and it defaults to true.`);
41
+ }
42
+ }
43
+ if ((options === null || options === void 0 ? void 0 : options.staticAddonTestSupportTrees) !== undefined) {
44
+ if (options.staticAddonTestSupportTrees === false) {
45
+ throw new Error(`You have set 'staticAddonTestSupportTrees' to 'false' in your Embroider options. This option has been removed is always considered to have the value 'true'. Please remove this setting to continue.`);
46
+ }
47
+ else {
48
+ console.log(`You have set 'staticAddonTestSupportTrees' in your Embroider options. This can safely be removed now and it defaults to true.`);
49
+ }
50
+ }
51
+ if ((options === null || options === void 0 ? void 0 : options.skipBabel) !== undefined) {
52
+ throw new Error(`You have set 'skipBabel' on your Embroider options. This setting has been removed and you can now configure your babel ignores directly in the babel config in your repo https://babeljs.io/docs/options#ignore`);
53
+ }
19
54
  return Object.assign({}, defaults, options);
20
55
  }
21
56
  // These are recommended configurations for addons to test themselves under. By
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";;;AAuHA,kDAEC;AAvHD,0CAA0E;AAmG1E,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAA,0BAAgB,GAAE,EAAE;IACjD,gBAAgB,EAAE,KAAK;IACvB,2BAA2B,EAAE,KAAK;IAClC,cAAc,EAAE,IAAI,GAAG,EAAE;IACzB,gBAAgB,EAAE,EAAE;IACpB,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,EAAE;IAChB,4BAA4B,EAAE,KAAK;IACnC,wBAAwB,EAAE,EAAE;IAC5B,eAAe,EAAE,IAAI;IACrB,oBAAoB,EAAE,IAAI;CAC3B,CAAC,CAAC;AAOH,SAAgB,mBAAmB,CAAC,OAAiB;IACnD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAC/E,cAAc;AACD,QAAA,kBAAkB,GAAgC,MAAM,CAAC,MAAM,CAAC;IAC3E,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE,IAAI;QACtB,2BAA2B,EAAE,IAAI;QACjC,4BAA4B,EAAE,KAAK;QACnC,gBAAgB,EAAE,IAAI;KACvB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import type { V1AddonConstructor } from './v1-addon';\nimport type { Options as CoreOptions } from '@embroider/core';\nimport { optionsWithDefaults as coreWithDefaults } from '@embroider/core';\nimport type { PackageRules } from './dependency-rules';\n\n// These options control how hard we will try to achieve compatibility with v1\n// addons. The defaults are conservative and try to maximize compatibility, at\n// the cost of slower or bigger builds. As you eliminate sources of legacy\n// behavior you can benefit from the more aggressive modes.\nexport default interface Options extends CoreOptions {\n // Controls whether your addon's \"addon\" trees should be resolved statically\n // at build time.\n //\n // false (the default): implies maximum backward compatibility at the cost\n // of bigger builds. In this mode, we force every file into the Ember app,\n // which is the legacy behavior.\n //\n // true: produces smaller builds. The addon files must be imported from\n // somewhere we can statically see during the build. In this mode, your app\n // will only include files that are actually imported from somewhere.\n //\n // Commentary: most v1 addons already work well with this set to true, because\n // they tend to either offer Javascript that users are supposed to directly\n // `import` or components / helpers / services that get directly imported and\n // re-exported by code in App Javascript. The exceptions are addons that do\n // runtime shenanigans with `require` or scoped runtime resolutions.\n //\n // To workaround an addon that is preventing you from enabling this flag, you\n // can use addonDependencyRules.\n staticAddonTrees?: boolean;\n\n // Controls whether your addon's \"addonTestSupport\" trees should be resolved\n // statically at build time.\n //\n // false (the default): implies maximum backward compatibility at the cost\n // of bigger builds. All test support files will be forced into your Ember\n // app, which is the legacy behavior.\n //\n // true: produces smaller builds. Only files that are explicitly imported\n // will end up in your app.\n //\n // Commentary: this is analogous to staticAddonTrees and the same guidelines\n // apply.\n staticAddonTestSupportTrees?: boolean;\n\n // Allows you to override how specific addons will build. Like:\n //\n // import V1Addon from '@embroider/compat'; let compatAdapters = new Map();\n // compatAdapters.set('some-addon', class extends V1Addon {// do stuff here:\n // see examples in ./compat-adapters\n // });\n //\n // This should be understood as a temporary way to keep yourself from getting\n // stuck, not an alternative to actually fixing upstream. For the most part,\n // the real solution will be converting the addon in question to natively\n // publish as v2.\n //\n // We ship with some default compatAdapters to fix otherwise incompatible\n // behaviors in popular addons. You can override the default adapters by\n // setting your own value here (including null to completely disable it).\n compatAdapters?: Map<string, V1AddonConstructor | null>;\n\n // Allows you to tell Embroider about otherwise dynamic dependencies within\n // your app and addons that it can't figure out on its own. These are combined\n // with the default rules that ship with Embroider. Your own rules take\n // precedence over the built-ins. Order matters, first matching rule will\n // apply to any given addon.\n //\n // See the addon-dependency-rules directory in the @embroider/compat package\n // for the built-in rules.\n //\n // These ONLY APPLY to v1-formatted addons. An addon that ships as native v2\n // is expected to do the right thing on its own.\n //\n // Follow to the definition of PackageRules for more info.\n packageRules?: PackageRules[];\n\n // This turns build errors into runtime errors. It is not a good idea to keep\n // it on in production. But it can be helpful when testing how much of your\n // app is able to work with staticComponents enabled.\n allowUnsafeDynamicComponents?: boolean;\n\n // Allows you to customize the list of content types addons use to provide HTML\n // to {{content-for}}. By default, the following content types are expected:\n // 'head', 'test-head', 'head-footer', 'test-head-footer', 'body', 'test-body',\n // 'body-footer', 'test-body-footer'. You need to use this config only to extend\n // this list.\n availableContentForTypes?: string[];\n\n // Allows you to cancel the warning that at least one classic addon provides\n // content-for 'app-boot'. This warning brings awareness for developers\n // switching to Embroider, but is no longer necessary once content-for\n // 'app-boot' code has been properly moved to the app-side.\n useAddonAppBoot?: boolean;\n\n // content-for 'config-module'. This warning brings awareness for developers\n // switching to Embroider, but is no longer necessary once content-for\n // 'config-module' code has been properly moved to the app-side.\n useAddonConfigModule?: boolean;\n}\n\nconst defaults = Object.assign(coreWithDefaults(), {\n staticAddonTrees: false,\n staticAddonTestSupportTrees: false,\n compatAdapters: new Map(),\n extraPublicTrees: [],\n workspaceDir: null,\n packageRules: [],\n allowUnsafeDynamicComponents: false,\n availableContentForTypes: [],\n useAddonAppBoot: true,\n useAddonConfigModule: true,\n});\n\nexport type CompatOptionsType = Required<\n Omit<Options, 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'staticInvokables'>\n> &\n Pick<Options, 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'staticInvokables'>;\n\nexport function optionsWithDefaults(options?: Options): CompatOptionsType {\n return Object.assign({}, defaults, options);\n}\n\n// These are recommended configurations for addons to test themselves under. By\n// keeping them here, it's easier to do ecosystem-wide compatibility testing.\n// See the `@embroider/test-setup` package which can help consume these to test\n// them in CI.\nexport const recommendedOptions: { [name: string]: Options } = Object.freeze({\n safe: Object.freeze({}),\n optimized: Object.freeze({\n staticAddonTrees: true,\n staticAddonTestSupportTrees: true,\n allowUnsafeDynamicComponents: false,\n staticInvokables: true,\n }),\n});\n"]}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";;;AAiFA,kDAwDC;AAvID,0CAA0E;AAgE1E,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAA,0BAAgB,GAAE,EAAE;IACjD,gBAAgB,EAAE,KAAK;IACvB,2BAA2B,EAAE,KAAK;IAClC,cAAc,EAAE,IAAI,GAAG,EAAE;IACzB,gBAAgB,EAAE,EAAE;IACpB,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,EAAE;IAChB,4BAA4B,EAAE,KAAK;IACnC,wBAAwB,EAAE,EAAE;IAC5B,eAAe,EAAE,IAAI;IACrB,oBAAoB,EAAE,IAAI;CAC3B,CAAC,CAAC;AAIH,SAAgB,mBAAmB,CAAC,OAAiB;IACnD,IAAI,CAAC,OAAe,aAAf,OAAO,uBAAP,OAAO,CAAU,iBAAiB,MAAK,SAAS,EAAE,CAAC;QACtD,IAAK,OAAe,CAAC,iBAAiB,KAAK,KAAK,EAAE,CAAC;YACjD,MAAM,IAAI,KAAK,CACb,4LAA4L,CAC7L,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CACT,qHAAqH,CACtH,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,CAAC,OAAe,aAAf,OAAO,uBAAP,OAAO,CAAU,iBAAiB,MAAK,SAAS,EAAE,CAAC;QACtD,IAAK,OAAe,CAAC,iBA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A2B,EAAE,IAAI;QACjC,4BAA4B,EAAE,KAAK;QACnC,gBAAgB,EAAE,IAAI;KACvB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import type { V1AddonConstructor } from './v1-addon';\nimport type { Options as CoreOptions } from '@embroider/core';\nimport { optionsWithDefaults as coreWithDefaults } from '@embroider/core';\nimport type { PackageRules } from './dependency-rules';\n\n// These options control how hard we will try to achieve compatibility with v1\n// addons. The defaults are conservative and try to maximize compatibility, at\n// the cost of slower or bigger builds. As you eliminate sources of legacy\n// behavior you can benefit from the more aggressive modes.\nexport default interface Options extends CoreOptions {\n // Allows you to override how specific addons will build. Like:\n //\n // import V1Addon from '@embroider/compat'; let compatAdapters = new Map();\n // compatAdapters.set('some-addon', class extends V1Addon {// do stuff here:\n // see examples in ./compat-adapters\n // });\n //\n // This should be understood as a temporary way to keep yourself from getting\n // stuck, not an alternative to actually fixing upstream. For the most part,\n // the real solution will be converting the addon in question to natively\n // publish as v2.\n //\n // We ship with some default compatAdapters to fix otherwise incompatible\n // behaviors in popular addons. You can override the default adapters by\n // setting your own value here (including null to completely disable it).\n compatAdapters?: Map<string, V1AddonConstructor | null>;\n\n // Allows you to tell Embroider about otherwise dynamic dependencies within\n // your app and addons that it can't figure out on its own. These are combined\n // with the default rules that ship with Embroider. Your own rules take\n // precedence over the built-ins. Order matters, first matching rule will\n // apply to any given addon.\n //\n // See the addon-dependency-rules directory in the @embroider/compat package\n // for the built-in rules.\n //\n // These ONLY APPLY to v1-formatted addons. An addon that ships as native v2\n // is expected to do the right thing on its own.\n //\n // Follow to the definition of PackageRules for more info.\n packageRules?: PackageRules[];\n\n // This turns build errors into runtime errors. It is not a good idea to keep\n // it on in production. But it can be helpful when testing how much of your\n // app is able to work with staticComponents enabled.\n allowUnsafeDynamicComponents?: boolean;\n\n // Allows you to customize the list of content types addons use to provide HTML\n // to {{content-for}}. By default, the following content types are expected:\n // 'head', 'test-head', 'head-footer', 'test-head-footer', 'body', 'test-body',\n // 'body-footer', 'test-body-footer'. You need to use this config only to extend\n // this list.\n availableContentForTypes?: string[];\n\n // Allows you to cancel the warning that at least one classic addon provides\n // content-for 'app-boot'. This warning brings awareness for developers\n // switching to Embroider, but is no longer necessary once content-for\n // 'app-boot' code has been properly moved to the app-side.\n useAddonAppBoot?: boolean;\n\n // content-for 'config-module'. This warning brings awareness for developers\n // switching to Embroider, but is no longer necessary once content-for\n // 'config-module' code has been properly moved to the app-side.\n useAddonConfigModule?: boolean;\n}\n\nconst defaults = Object.assign(coreWithDefaults(), {\n staticAddonTrees: false,\n staticAddonTestSupportTrees: false,\n compatAdapters: new Map(),\n extraPublicTrees: [],\n workspaceDir: null,\n packageRules: [],\n allowUnsafeDynamicComponents: false,\n availableContentForTypes: [],\n useAddonAppBoot: true,\n useAddonConfigModule: true,\n});\n\nexport type CompatOptionsType = Required<Options>;\n\nexport function optionsWithDefaults(options?: Options): CompatOptionsType {\n if ((options as any)?.staticEmberSource !== undefined) {\n if ((options as any).staticEmberSource === false) {\n throw new Error(\n `You have set 'staticEmberSource' to 'false' in your Embroider options. This option has been removed is always considered to have the value 'true'. Please remove this setting to continue.`\n );\n } else {\n console.log(\n `You have set 'staticEmberSource' in your Embroider options. This can safely be removed now and it defaults to true.`\n );\n }\n }\n\n if ((options as any)?.staticEmberSource !== undefined) {\n if ((options as any).staticEmberSource === false) {\n throw new Error(\n `You have set 'staticEmberSource' to 'false' in your Embroider options. This option has been removed is always considered to have the value 'true'. Please remove this setting to continue.`\n );\n } else {\n console.log(\n `You have set 'staticEmberSource' in your Embroider options. This can safely be removed now and it defaults to true.`\n );\n }\n }\n\n if ((options as any)?.staticAddonTrees !== undefined) {\n if ((options as any).staticAddonTrees === false) {\n throw new Error(\n `You have set 'staticAddonTrees' to 'false' in your Embroider options. This option has been removed is always considered to have the value 'true'. Please remove this setting to continue.`\n );\n } else {\n console.log(\n `You have set 'staticAddonTrees' in your Embroider options. This can safely be removed now and it defaults to true.`\n );\n }\n }\n\n if ((options as any)?.staticAddonTestSupportTrees !== undefined) {\n if ((options as any).staticAddonTestSupportTrees === false) {\n throw new Error(\n `You have set 'staticAddonTestSupportTrees' to 'false' in your Embroider options. This option has been removed is always considered to have the value 'true'. Please remove this setting to continue.`\n );\n } else {\n console.log(\n `You have set 'staticAddonTestSupportTrees' in your Embroider options. This can safely be removed now and it defaults to true.`\n );\n }\n }\n\n if ((options as any)?.skipBabel !== undefined) {\n throw new Error(\n `You have set 'skipBabel' on your Embroider options. This setting has been removed and you can now configure your babel ignores directly in the babel config in your repo https://babeljs.io/docs/options#ignore`\n );\n }\n\n return Object.assign({}, defaults, options);\n}\n\n// These are recommended configurations for addons to test themselves under. By\n// keeping them here, it's easier to do ecosystem-wide compatibility testing.\n// See the `@embroider/test-setup` package which can help consume these to test\n// them in CI.\nexport const recommendedOptions: { [name: string]: Options } = Object.freeze({\n safe: Object.freeze({}),\n optimized: Object.freeze({\n staticAddonTrees: true,\n staticAddonTestSupportTrees: true,\n allowUnsafeDynamicComponents: false,\n staticInvokables: true,\n }),\n});\n"]}
@@ -9,7 +9,7 @@ type Env = WithJSUtils<ASTPluginEnvironment> & {
9
9
  strictMode?: boolean;
10
10
  locals?: string[];
11
11
  };
12
- type UserConfig = Pick<Required<CompatOptions>, 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'allowUnsafeDynamicComponents'>;
12
+ type UserConfig = Pick<Required<CompatOptions>, 'staticInvokables' | 'allowUnsafeDynamicComponents'>;
13
13
  export interface CompatResolverOptions extends CoreResolverOptions {
14
14
  activePackageRules: ActivePackageRules[];
15
15
  options: UserConfig;