@embroider/compat 3.7.1-unstable.3e8dbe3 → 3.7.1-unstable.449a68c

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.7.1-unstable.3e8dbe3",
3
+ "version": "3.7.1-unstable.449a68c",
4
4
  "private": false,
5
5
  "description": "Backward compatibility layer for the Embroider build system.",
6
6
  "repository": {
@@ -49,6 +49,7 @@
49
49
  "broccoli-source": "^3.0.1",
50
50
  "chalk": "^4.1.1",
51
51
  "debug": "^4.3.2",
52
+ "ember-source": "6.1.0-beta.1",
52
53
  "fast-sourcemap-concat": "^2.1.1",
53
54
  "fs-extra": "^9.1.0",
54
55
  "fs-tree-diff": "^2.0.1",
@@ -64,7 +65,7 @@
64
65
  "typescript-memoize": "^1.0.1",
65
66
  "walk-sync": "^3.0.0",
66
67
  "yargs": "^17.0.1",
67
- "@embroider/macros": "1.16.10-unstable.3e8dbe3"
68
+ "@embroider/macros": "1.16.10-unstable.449a68c"
68
69
  },
69
70
  "devDependencies": {
70
71
  "@glimmer/syntax": "^0.84.3",
@@ -85,14 +86,14 @@
85
86
  "broccoli-node-api": "^1.7.0",
86
87
  "code-equality-assertions": "^1.0.1",
87
88
  "ember-engines": "^0.8.19",
88
- "scenario-tester": "^3.0.1",
89
+ "scenario-tester": "^4.0.0",
89
90
  "typescript": "^5.4.5",
91
+ "@embroider/core": "^3.4.20-unstable.449a68c",
90
92
  "@embroider/sample-transforms": "0.0.0",
91
- "@embroider/core": "^3.4.20-unstable.3e8dbe3",
92
93
  "@embroider/test-support": "0.36.0"
93
94
  },
94
95
  "peerDependencies": {
95
- "@embroider/core": "^3.4.20-unstable.3e8dbe3"
96
+ "@embroider/core": "^3.4.20-unstable.449a68c"
96
97
  },
97
98
  "engines": {
98
99
  "node": "12.* || 14.* || >= 16"
package/src/babel.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { PluginItem } from '@babel/core';
2
2
  import type { Transform } from 'babel-plugin-ember-template-compilation';
3
- import type { Options as AdjustImportsOptions } from './babel-plugin-adjust-imports';
4
3
  export interface CompatBabelState {
5
4
  plugins: PluginItem[];
6
5
  templateTransforms: Transform[];
@@ -12,7 +11,6 @@ export declare function transformsFromV1Addons(): Transform[];
12
11
  export declare function looseModeSupport(): Transform;
13
12
  export declare function templateMacros(): Transform[];
14
13
  export declare function babelMacros(): PluginItem[];
15
- export declare function adjustImports(): (string | AdjustImportsOptions)[];
16
14
  export declare function oldDebugMacros(): PluginItem[];
17
15
  export declare function templateColocation(): PluginItem;
18
16
  export declare function babelCompatSupport(): PluginItem[];
package/src/babel.js CHANGED
@@ -8,7 +8,6 @@ exports.transformsFromV1Addons = transformsFromV1Addons;
8
8
  exports.looseModeSupport = looseModeSupport;
9
9
  exports.templateMacros = templateMacros;
10
10
  exports.babelMacros = babelMacros;
11
- exports.adjustImports = adjustImports;
12
11
  exports.oldDebugMacros = oldDebugMacros;
13
12
  exports.templateColocation = templateColocation;
14
13
  exports.babelCompatSupport = babelCompatSupport;
@@ -63,12 +62,6 @@ function babelMacros() {
63
62
  let config = loadCompatConfig();
64
63
  return config.babelMacros;
65
64
  }
66
- function adjustImports() {
67
- let pluginConfig = {
68
- appRoot: resolverLoader.resolver.options.appRoot,
69
- };
70
- return [require.resolve('./babel-plugin-adjust-imports'), pluginConfig];
71
- }
72
65
  function oldDebugMacros() {
73
66
  let debugMacros = require.resolve('babel-plugin-debug-macros');
74
67
  return [
@@ -145,7 +138,7 @@ function templateColocation() {
145
138
  return [core_1.templateColocationPluginPath, colocationOptions];
146
139
  }
147
140
  function babelCompatSupport() {
148
- return [...babelMacros(), adjustImports(), ...oldDebugMacros(), templateColocation(), ...pluginsFromV1Addons()];
141
+ return [...babelMacros(), ...oldDebugMacros(), templateColocation(), ...pluginsFromV1Addons()];
149
142
  }
150
143
  function templateCompatSupport() {
151
144
  return [...transformsFromV1Addons(), ...templateMacros(), looseModeSupport()];
package/src/babel.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"babel.js","sourceRoot":"","sources":["babel.ts"],"names":[],"mappings":";;;;;AA6CA,kDAGC;AAED,wDAGC;AAED,4CAOC;AAED,wCAGC;AAED,kCAGC;AAED,sCAKC;AAED,wCAyCC;AAED,gDAkCC;AAED,gDAEC;AAED,sDAEC;AArKD,2BAAgC;AAChC,0CAKyB;AACzB,+BAA4B;AAI5B,wFAA+D;AAS/D,SAAS,gBAAgB;IACvB,IAAI,UAAU,GAAG,IAAA,WAAI,EAAC,IAAA,gCAAyB,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,mBAAmB,CAAC,CAAC;IACrF,IAAI,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,CAAC;QAC3B,iEAAiE;QACjE,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,MAAM,GAAG,uBAAY,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACjD,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,uBAAY,CAAC,UAAU,EAAE,CAAC;IACvE,SAAS,CAAC,MAAM,CAAC,CAAC;IAClB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC3C,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC/C,MAAM,CAAC,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO;QACL,OAAO,EAAE,EAAE;QACX,kBAAkB,EAAE,EAAE;QACtB,WAAW,EAAE,MAAM,CAAC,iBAAiB,EAAE;QACvC,cAAc,EAAE,cAAqB;KACtC,CAAC;AACJ,CAAC;AAED,MAAM,cAAc,GAAG,IAAI,qBAAc,CAAC,OA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;IACnC,OAAO,CAAC,GAAG,sBAAsB,EAAE,EAAE,GAAG,cAAc,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAChF,CAAC","sourcesContent":["import type { PluginItem } from '@babel/core';\nimport { existsSync } from 'fs';\nimport {\n locateEmbroiderWorkingDir,\n ResolverLoader,\n templateColocationPluginPath,\n type TemplateColocationPluginOptions,\n} from '@embroider/core';\nimport { join } from 'path';\nimport type { Transform } from 'babel-plugin-ember-template-compilation';\nimport type { Options as ResolverTransformOptions } from './resolver-transform';\nimport type { Options as AdjustImportsOptions } from './babel-plugin-adjust-imports';\nimport MacrosConfig from '@embroider/macros/src/macros-config';\n\nexport interface CompatBabelState {\n plugins: PluginItem[];\n templateTransforms: Transform[];\n babelMacros: PluginItem[];\n templateMacros: Transform[];\n}\n\nfunction loadCompatConfig(): CompatBabelState {\n let compatFile = join(locateEmbroiderWorkingDir(process.cwd()), '_babel_compat_.js');\n if (existsSync(compatFile)) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(compatFile);\n }\n let macros = MacrosConfig.for({}, process.cwd());\n let { plugins: templateMacros, setConfig } = MacrosConfig.transforms();\n setConfig(macros);\n if (process.env.NODE_ENV === 'development') {\n macros.enablePackageDevelopment(process.cwd());\n macros.enableRuntimeMode();\n }\n macros.finalize();\n return {\n plugins: [],\n templateTransforms: [],\n babelMacros: macros.babelPluginConfig(),\n templateMacros: templateMacros as any,\n };\n}\n\nconst resolverLoader = new ResolverLoader(process.cwd());\n\nexport function pluginsFromV1Addons() {\n let config = loadCompatConfig();\n return config.plugins;\n}\n\nexport function transformsFromV1Addons() {\n let config = loadCompatConfig();\n return config.templateTransforms;\n}\n\nexport function looseModeSupport(): Transform {\n const { resolver } = resolverLoader;\n let opts: ResolverTransformOptions = {\n appRoot: resolver.options.appRoot,\n emberVersion: resolver.options.emberVersion,\n };\n return [require.resolve('./resolver-transform'), opts];\n}\n\nexport function templateMacros() {\n let config = loadCompatConfig();\n return config.templateMacros;\n}\n\nexport function babelMacros() {\n let config = loadCompatConfig();\n return config.babelMacros;\n}\n\nexport function adjustImports() {\n let pluginConfig: AdjustImportsOptions = {\n appRoot: resolverLoader.resolver.options.appRoot,\n };\n return [require.resolve('./babel-plugin-adjust-imports'), pluginConfig];\n}\n\nexport function oldDebugMacros(): PluginItem[] {\n let debugMacros = require.resolve('babel-plugin-debug-macros');\n return [\n [\n debugMacros,\n {\n flags: [\n {\n source: '@glimmer/env',\n flags: {\n DEBUG: true,\n CI: false,\n },\n },\n ],\n debugTools: {\n isDebug: true,\n source: '@ember/debug',\n assertPredicateIndex: 1,\n },\n externalizeHelpers: {\n module: '@ember/debug',\n },\n },\n '@ember/debug stripping',\n ],\n [\n debugMacros,\n {\n externalizeHelpers: {\n module: '@ember/application/deprecations',\n },\n debugTools: {\n isDebug: true,\n source: '@ember/application/deprecations',\n assertPredicateIndex: 1,\n },\n },\n '@ember/application/deprecations stripping',\n ],\n ];\n}\n\nexport function templateColocation(): PluginItem {\n let colocationOptions: TemplateColocationPluginOptions = {\n appRoot: resolverLoader.resolver.options.appRoot,\n\n // This extra weirdness is a compromise in favor of build performance.\n //\n // 1. When auto-upgrading an addon from v1 to v2, we definitely want to\n // run any custom AST transforms in stage1.\n //\n // 2. In general case, AST transforms are allowed to manipulate Javascript\n // scope. This means that running transforms -- even when we're doing\n // source-to-source compilation that emits handlebars and not wire\n // format -- implies changing .hbs files into .js files.\n //\n // 3. So stage1 may need to rewrite .hbs to .hbs.js (to avoid colliding\n // with an existing co-located .js file).\n //\n // 4. But stage1 doesn't necessarily want to run babel over the\n // corresponding JS file. Most of the time, that's just an\n // unnecessarily expensive second parse. (We only run it in stage1 to\n // eliminate an addon's custom babel plugins, and many addons don't\n // have any.)\n //\n // 5. Therefore, the work of template-colocation gets defered until here,\n // and it may see co-located templates named `.hbs.js` instead of the\n // usual `.hbs.\n templateExtensions: ['.hbs', '.hbs.js'],\n\n // All of the above only applies to auto-upgraded packages that were\n // authored in v1. V2 packages don't get any of this complexity, they're\n // supposed to take care of colocating their own templates explicitly.\n packageGuard: true,\n };\n return [templateColocationPluginPath, colocationOptions];\n}\n\nexport function babelCompatSupport(): PluginItem[] {\n return [...babelMacros(), adjustImports(), ...oldDebugMacros(), templateColocation(), ...pluginsFromV1Addons()];\n}\n\nexport function templateCompatSupport(): Transform[] {\n return [...transformsFromV1Addons(), ...templateMacros(), looseModeSupport()];\n}\n"]}
1
+ {"version":3,"file":"babel.js","sourceRoot":"","sources":["babel.ts"],"names":[],"mappings":";;;;;AA4CA,kDAGC;AAED,wDAGC;AAED,4CAOC;AAED,wCAGC;AAED,kCAGC;AAED,wCAyCC;AAED,gDAkCC;AAED,gDAEC;AAED,sDAEC;AA7JD,2BAAgC;AAChC,0CAKyB;AACzB,+BAA4B;AAG5B,wFAA+D;AAS/D,SAAS,gBAAgB;IACvB,IAAI,UAAU,GAAG,IAAA,WAAI,EAAC,IAAA,gCAAyB,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,mBAAmB,CAAC,CAAC;IACrF,IAAI,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,CAAC;QAC3B,iEAAiE;QACjE,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,MAAM,GAAG,uBAAY,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACjD,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,uBAAY,CAAC,UAAU,EAAE,CAAC;IACvE,SAAS,CAAC,MAAM,CAAC,CAAC;IAClB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC3C,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC/C,MAAM,CAAC,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO;QACL,O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AG,cAAc,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAChF,CAAC","sourcesContent":["import type { PluginItem } from '@babel/core';\nimport { existsSync } from 'fs';\nimport {\n locateEmbroiderWorkingDir,\n ResolverLoader,\n templateColocationPluginPath,\n type TemplateColocationPluginOptions,\n} from '@embroider/core';\nimport { join } from 'path';\nimport type { Transform } from 'babel-plugin-ember-template-compilation';\nimport type { Options as ResolverTransformOptions } from './resolver-transform';\nimport MacrosConfig from '@embroider/macros/src/macros-config';\n\nexport interface CompatBabelState {\n plugins: PluginItem[];\n templateTransforms: Transform[];\n babelMacros: PluginItem[];\n templateMacros: Transform[];\n}\n\nfunction loadCompatConfig(): CompatBabelState {\n let compatFile = join(locateEmbroiderWorkingDir(process.cwd()), '_babel_compat_.js');\n if (existsSync(compatFile)) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(compatFile);\n }\n let macros = MacrosConfig.for({}, process.cwd());\n let { plugins: templateMacros, setConfig } = MacrosConfig.transforms();\n setConfig(macros);\n if (process.env.NODE_ENV === 'development') {\n macros.enablePackageDevelopment(process.cwd());\n macros.enableRuntimeMode();\n }\n macros.finalize();\n return {\n plugins: [],\n templateTransforms: [],\n babelMacros: macros.babelPluginConfig(),\n templateMacros: templateMacros as any,\n };\n}\n\nconst resolverLoader = new ResolverLoader(process.cwd());\n\nexport function pluginsFromV1Addons() {\n let config = loadCompatConfig();\n return config.plugins;\n}\n\nexport function transformsFromV1Addons() {\n let config = loadCompatConfig();\n return config.templateTransforms;\n}\n\nexport function looseModeSupport(): Transform {\n const { resolver } = resolverLoader;\n let opts: ResolverTransformOptions = {\n appRoot: resolver.options.appRoot,\n emberVersion: resolver.options.emberVersion,\n };\n return [require.resolve('./resolver-transform'), opts];\n}\n\nexport function templateMacros() {\n let config = loadCompatConfig();\n return config.templateMacros;\n}\n\nexport function babelMacros() {\n let config = loadCompatConfig();\n return config.babelMacros;\n}\n\nexport function oldDebugMacros(): PluginItem[] {\n let debugMacros = require.resolve('babel-plugin-debug-macros');\n return [\n [\n debugMacros,\n {\n flags: [\n {\n source: '@glimmer/env',\n flags: {\n DEBUG: true,\n CI: false,\n },\n },\n ],\n debugTools: {\n isDebug: true,\n source: '@ember/debug',\n assertPredicateIndex: 1,\n },\n externalizeHelpers: {\n module: '@ember/debug',\n },\n },\n '@ember/debug stripping',\n ],\n [\n debugMacros,\n {\n externalizeHelpers: {\n module: '@ember/application/deprecations',\n },\n debugTools: {\n isDebug: true,\n source: '@ember/application/deprecations',\n assertPredicateIndex: 1,\n },\n },\n '@ember/application/deprecations stripping',\n ],\n ];\n}\n\nexport function templateColocation(): PluginItem {\n let colocationOptions: TemplateColocationPluginOptions = {\n appRoot: resolverLoader.resolver.options.appRoot,\n\n // This extra weirdness is a compromise in favor of build performance.\n //\n // 1. When auto-upgrading an addon from v1 to v2, we definitely want to\n // run any custom AST transforms in stage1.\n //\n // 2. In general case, AST transforms are allowed to manipulate Javascript\n // scope. This means that running transforms -- even when we're doing\n // source-to-source compilation that emits handlebars and not wire\n // format -- implies changing .hbs files into .js files.\n //\n // 3. So stage1 may need to rewrite .hbs to .hbs.js (to avoid colliding\n // with an existing co-located .js file).\n //\n // 4. But stage1 doesn't necessarily want to run babel over the\n // corresponding JS file. Most of the time, that's just an\n // unnecessarily expensive second parse. (We only run it in stage1 to\n // eliminate an addon's custom babel plugins, and many addons don't\n // have any.)\n //\n // 5. Therefore, the work of template-colocation gets defered until here,\n // and it may see co-located templates named `.hbs.js` instead of the\n // usual `.hbs.\n templateExtensions: ['.hbs', '.hbs.js'],\n\n // All of the above only applies to auto-upgraded packages that were\n // authored in v1. V2 packages don't get any of this complexity, they're\n // supposed to take care of colocating their own templates explicitly.\n packageGuard: true,\n };\n return [templateColocationPluginPath, colocationOptions];\n}\n\nexport function babelCompatSupport(): PluginItem[] {\n return [...babelMacros(), ...oldDebugMacros(), templateColocation(), ...pluginsFromV1Addons()];\n}\n\nexport function templateCompatSupport(): Transform[] {\n return [...transformsFromV1Addons(), ...templateMacros(), looseModeSupport()];\n}\n"]}
@@ -1,13 +1,10 @@
1
1
  import V1Addon from '../v1-addon';
2
2
  export default class extends V1Addon {
3
3
  get v2Tree(): Node;
4
- private get useStaticEmber();
5
4
  private get includedDependencies();
6
5
  get newPackageJSON(): import("@embroider/shared-internals").PackageInfo;
7
6
  customizes(treeName: string): boolean;
8
- invokeOriginalTreeFor(name: string, opts?: {
9
- neuterPreprocessors: boolean;
10
- }): any;
7
+ invokeOriginalTreeFor(name: string): any;
11
8
  private customAddonTree;
12
9
  private customVendorTree;
13
10
  get packageMeta(): Partial<import("@embroider/shared-internals").AddonMeta>;
@@ -24,9 +24,6 @@ class default_1 extends v1_addon_1.default {
24
24
  get v2Tree() {
25
25
  return (0, broccoli_merge_trees_1.default)([super.v2Tree, (0, broccoli_funnel_1.default)(this.rootTree, { include: ['dist/ember-template-compiler.js'] })]);
26
26
  }
27
- get useStaticEmber() {
28
- return this.app.options.staticEmberSource;
29
- }
30
27
  // versions of ember-source prior to
31
28
  // https://github.com/emberjs/ember.js/pull/20675 ship dist/packages and
32
29
  // dist/dependencies separately and the imports between them are package-name
@@ -65,36 +62,26 @@ class default_1 extends v1_addon_1.default {
65
62
  get newPackageJSON() {
66
63
  var _a;
67
64
  let json = super.newPackageJSON;
68
- if (this.useStaticEmber) {
69
- for (let name of this.includedDependencies) {
70
- // weirdly, many of the inlined dependency are still listed as real
71
- // dependencies too. If we don't delete them here, they will take
72
- // precedence over the inlined ones, because the embroider module-resolver
73
- // tries to prioritize real deps.
74
- (_a = json.dependencies) === null || _a === void 0 ? true : delete _a[name];
75
- }
65
+ for (let name of this.includedDependencies) {
66
+ // weirdly, many of the inlined dependency are still listed as real
67
+ // dependencies too. If we don't delete them here, they will take
68
+ // precedence over the inlined ones, because the embroider module-resolver
69
+ // tries to prioritize real deps.
70
+ (_a = json.dependencies) === null || _a === void 0 ? true : delete _a[name];
76
71
  }
77
72
  return json;
78
73
  }
79
74
  customizes(treeName) {
80
- if (this.useStaticEmber) {
81
- // we are adding custom implementations of these
82
- return treeName === 'treeForAddon' || treeName === 'treeForVendor' || super.customizes(treeName);
83
- }
84
- else {
85
- return super.customizes(treeName);
86
- }
75
+ // we are adding custom implementations of these
76
+ return treeName === 'treeForAddon' || treeName === 'treeForVendor' || super.customizes(treeName);
87
77
  }
88
- invokeOriginalTreeFor(name, opts = { neuterPreprocessors: false }) {
89
- if (this.useStaticEmber) {
90
- if (name === 'addon') {
91
- return this.customAddonTree();
92
- }
93
- if (name === 'vendor') {
94
- return this.customVendorTree();
95
- }
78
+ invokeOriginalTreeFor(name) {
79
+ if (name === 'addon') {
80
+ return this.customAddonTree();
81
+ }
82
+ if (name === 'vendor') {
83
+ return this.customVendorTree();
96
84
  }
97
- return super.invokeOriginalTreeFor(name, opts);
98
85
  }
99
86
  // Our addon tree is all of the "packages" we share. @embroider/compat already
100
87
  // supports that pattern of emitting modules into other package's namespaces.
@@ -135,21 +122,19 @@ class default_1 extends v1_addon_1.default {
135
122
  }
136
123
  get packageMeta() {
137
124
  let meta = super.packageMeta;
138
- if (this.useStaticEmber) {
139
- if (!meta['implicit-modules']) {
140
- meta['implicit-modules'] = [];
141
- }
142
- meta['implicit-modules'].push('./ember/index.js');
143
- // before 5.6, Ember uses the AMD loader to decide if it's test-only parts
144
- // are present, so we must ensure they're registered. After that it's
145
- // enough to evaluate ember-testing, which @embroider/core is hard-coded
146
- // to do in the backward-compatible tests bundle.
147
- if (!(0, semver_1.satisfies)(this.packageJSON.version, '>= 5.6.0-alpha.0', { includePrerelease: true })) {
148
- if (!meta['implicit-test-modules']) {
149
- meta['implicit-test-modules'] = [];
150
- }
151
- meta['implicit-test-modules'].push('./ember-testing/index.js');
125
+ if (!meta['implicit-modules']) {
126
+ meta['implicit-modules'] = [];
127
+ }
128
+ meta['implicit-modules'].push('./ember/index.js');
129
+ // before 5.6, Ember uses the AMD loader to decide if it's test-only parts
130
+ // are present, so we must ensure they're registered. After that it's
131
+ // enough to evaluate ember-testing, which @embroider/core is hard-coded
132
+ // to do in the backward-compatible tests bundle.
133
+ if (!(0, semver_1.satisfies)(this.packageJSON.version, '>= 5.6.0-alpha.0', { includePrerelease: true })) {
134
+ if (!meta['implicit-test-modules']) {
135
+ meta['implicit-test-modules'] = [];
152
136
  }
137
+ meta['implicit-test-modules'].push('./ember-testing/index.js');
153
138
  }
154
139
  return meta;
155
140
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ember-source.js","sourceRoot":"","sources":["ember-source.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkC;AAClC,sEAA0C;AAC1C,gFAA8C;AAC9C,iEAAuC;AACvC,uCAAiF;AACjF,+BAAqC;AACrC,2DAA6C;AAC7C,mCAAmC;AACnC,sCAAwC;AAGxC,sEAAqC;AAErC,2BAAgC;AAEhC,eAAqB,SAAQ,kBAAO;IAClC,IAAI,MAAM;QACR,OAAO,IAAA,8BAAU,EAAC,CAAC,KAAK,CAAC,MAAM,EAAE,IAAA,yBAAW,EAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,iCAAiC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;IAED,IAAY,cAAc;QACxB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAC5C,CAAC;IAED,oCAAoC;IACpC,wEAAwE;IACxE,6EAA6E;IAC7E,qEAAqE;IACrE,2EAA2E;IAC3E,yEAAyE;IACzE,6BAA6B;IAC7B,EAAE;IACF,2EAA2E;IAC3E,oEAAoE;IACpE,uEAAuE;IACvE,4EAA4E;IAC5E,2CAA2C;IAE3C,IAAY,oBAAoB;QAC9B,IAAI,MAAM,GAAa,EAAE,CAAC;QAC1B,IAAI,OAAO,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;QACzD,IAAI,CAAC,IAAA,eAAU,EAAC,OAAO,CAAC,EAAE,CAAC;YAC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AAC,MAAM,CAAC,KAAK,KAAK,eAAe,EAAE,CAAC;wBAC/C,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;oBAC7B,CAAC;gBACH,CAAC;gBACD,IAAI,CAAC,KAA8C,EAAE,KAAiC;oBACpF,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC;gBAC9B,CAAC;aACF;YACD,eAAe,CAAC,IAA2C,EAAE,KAAiC;gBAC5F,IAAI,IAAI,GAAG,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC9F,IAAI,KAAK,CAAC,aAAa,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;oBAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import V1Addon from '../v1-addon';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport AddToTree from '../add-to-tree';\nimport { outputFileSync, readFileSync, readdirSync, unlinkSync } from 'fs-extra';\nimport { join, resolve } from 'path';\nimport { Memoize } from 'typescript-memoize';\nimport { satisfies } from 'semver';\nimport { transform } from '@babel/core';\nimport type * as Babel from '@babel/core';\nimport type { NodePath } from '@babel/traverse';\nimport Plugin from 'broccoli-plugin';\nimport type { Node } from 'broccoli-node-api';\nimport { existsSync } from 'fs';\n\nexport default class extends V1Addon {\n get v2Tree() {\n return mergeTrees([super.v2Tree, buildFunnel(this.rootTree, { include: ['dist/ember-template-compiler.js'] })]);\n }\n\n private get useStaticEmber(): boolean {\n return this.app.options.staticEmberSource;\n }\n\n // versions of ember-source prior to\n // https://github.com/emberjs/ember.js/pull/20675 ship dist/packages and\n // dist/dependencies separately and the imports between them are package-name\n // imports. Since many of the dependencies are also true package.json\n // dependencies (in order to get typescript types), and our module-resolver\n // prioritizes true dependencies, it's necessary to detect and remove the\n // package.json dependencies.\n //\n // After the above linked change, ember-source ships only dist/packages and\n // the inter-package imports are all relative. Some of the things in\n // dist/packages are still the rolled-in dependencies, but now that the\n // imports are all relative we need no special handling for them (beyond the\n // normal v2 addon renamed-modules support.\n @Memoize()\n private get includedDependencies() {\n let result: string[] = [];\n let depsDir = resolve(this.root, 'dist', 'dependencies');\n if (!existsSync(depsDir)) {\n return result;\n }\n for (let name of readdirSync(depsDir)) {\n if (name[0] === '@') {\n for (let innerName of readdirSync(resolve(this.root, 'dist', 'dependencies', name))) {\n if (innerName.endsWith('.js')) {\n result.push(name + '/' + innerName.slice(0, -3));\n }\n }\n } else {\n if (name.endsWith('.js')) {\n result.push(name.slice(0, -3));\n }\n }\n }\n return result;\n }\n\n get newPackageJSON() {\n let json = super.newPackageJSON;\n if (this.useStaticEmber) {\n for (let name of this.includedDependencies) {\n // weirdly, many of the inlined dependency are still listed as real\n // dependencies too. If we don't delete them here, they will take\n // precedence over the inlined ones, because the embroider module-resolver\n // tries to prioritize real deps.\n delete json.dependencies?.[name];\n }\n }\n return json;\n }\n\n customizes(treeName: string) {\n if (this.useStaticEmber) {\n // we are adding custom implementations of these\n return treeName === 'treeForAddon' || treeName === 'treeForVendor' || super.customizes(treeName);\n } else {\n return super.customizes(treeName);\n }\n }\n\n invokeOriginalTreeFor(name: string, opts: { neuterPreprocessors: boolean } = { neuterPreprocessors: false }) {\n if (this.useStaticEmber) {\n if (name === 'addon') {\n return this.customAddonTree();\n }\n if (name === 'vendor') {\n return this.customVendorTree();\n }\n }\n return super.invokeOriginalTreeFor(name, opts);\n }\n\n // Our addon tree is all of the \"packages\" we share. @embroider/compat already\n // supports that pattern of emitting modules into other package's namespaces.\n private customAddonTree() {\n let packages = buildFunnel(this.rootTree, {\n srcDir: 'dist/packages',\n });\n\n let trees: Node[] = [\n packages,\n buildFunnel(this.rootTree, {\n srcDir: 'dist/dependencies',\n allowEmpty: true,\n }),\n ];\n\n if (satisfies(this.packageJSON.version, '>= 4.0.0-alpha.0 <4.10.0-alpha.0', { includePrerelease: true })) {\n // import { loc } from '@ember/string' was removed in 4.0. but the\n // top-level `ember` package tries to import it until 4.10. A\n // spec-compliant ES modules implementation will treat this as a parse\n // error.\n trees.push(new FixStringLoc([packages]));\n }\n\n return mergeTrees(trees, { overwrite: true });\n }\n\n // We're zeroing out these files in vendor rather than deleting them, because\n // we can't easily intercept the `app.import` that presumably exists for them,\n // so rather than error they will just be empty.\n //\n // The reason we're zeroing these out is that we're going to consume all our\n // modules directly out of treeForAddon instead, as real modules that webpack\n // can see.\n private customVendorTree() {\n return new AddToTree(this.addonInstance._treeFor('vendor'), outputPath => {\n unlinkSync(join(outputPath, 'ember', 'ember.js'));\n outputFileSync(join(outputPath, 'ember', 'ember.js'), '');\n unlinkSync(join(outputPath, 'ember', 'ember-testing.js'));\n outputFileSync(join(outputPath, 'ember', 'ember-testing.js'), '');\n });\n }\n\n get packageMeta() {\n let meta = super.packageMeta;\n if (this.useStaticEmber) {\n if (!meta['implicit-modules']) {\n meta['implicit-modules'] = [];\n }\n meta['implicit-modules'].push('./ember/index.js');\n // before 5.6, Ember uses the AMD loader to decide if it's test-only parts\n // are present, so we must ensure they're registered. After that it's\n // enough to evaluate ember-testing, which @embroider/core is hard-coded\n // to do in the backward-compatible tests bundle.\n if (!satisfies(this.packageJSON.version, '>= 5.6.0-alpha.0', { includePrerelease: true })) {\n if (!meta['implicit-test-modules']) {\n meta['implicit-test-modules'] = [];\n }\n meta['implicit-test-modules'].push('./ember-testing/index.js');\n }\n }\n return meta;\n }\n}\n\nclass FixStringLoc extends Plugin {\n build() {\n let inSource = readFileSync(resolve(this.inputPaths[0], 'ember', 'index.js'), 'utf8');\n let outSource = transform(inSource, {\n plugins: [fixStringLoc],\n configFile: false,\n })!.code!;\n outputFileSync(resolve(this.outputPath, 'ember', 'index.js'), outSource, 'utf8');\n }\n}\n\nfunction fixStringLoc(babel: typeof Babel) {\n let t = babel.types;\n return {\n visitor: {\n Program(path: NodePath<Babel.types.Program>) {\n path.node.body.unshift(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier('loc'), t.identifier('undefined'))])\n );\n },\n ImportDeclaration: {\n enter(path: NodePath<Babel.types.ImportDeclaration>, state: { inEmberString: boolean }) {\n if (path.node.source.value === '@ember/string') {\n state.inEmberString = true;\n }\n },\n exit(_path: NodePath<Babel.types.ImportDeclaration>, state: { inEmberString: boolean }) {\n state.inEmberString = false;\n },\n },\n ImportSpecifier(path: NodePath<Babel.types.ImportSpecifier>, state: { inEmberString: boolean }) {\n let name = 'value' in path.node.imported ? path.node.imported.value : path.node.imported.name;\n if (state.inEmberString && name === 'loc') {\n path.remove();\n }\n },\n },\n };\n}\n"]}
1
+ {"version":3,"file":"ember-source.js","sourceRoot":"","sources":["ember-source.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkC;AAClC,sEAA0C;AAC1C,gFAA8C;AAC9C,iEAAuC;AACvC,uCAAiF;AACjF,+BAAqC;AACrC,2DAA6C;AAC7C,mCAAmC;AACnC,sCAAwC;AAGxC,sEAAqC;AAErC,2BAAgC;AAEhC,eAAqB,SAAQ,kBAAO;IAClC,IAAI,MAAM;QACR,OAAO,IAAA,8BAAU,EAAC,CAAC,KAAK,CAAC,MAAM,EAAE,IAAA,yBAAW,EAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,iCAAiC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;IAED,oCAAoC;IACpC,wEAAwE;IACxE,6EAA6E;IAC7E,qEAAqE;IACrE,2EAA2E;IAC3E,yEAAyE;IACzE,6BAA6B;IAC7B,EAAE;IACF,2EAA2E;IAC3E,oEAAoE;IACpE,uEAAuE;IACvE,4EAA4E;IAC5E,2CAA2C;IAE3C,IAAY,oBAAoB;QAC9B,IAAI,MAAM,GAAa,EAAE,CAAC;QAC1B,IAAI,OAAO,GAAG,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OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC9F,IAAI,KAAK,CAAC,aAAa,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;oBAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import V1Addon from '../v1-addon';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport AddToTree from '../add-to-tree';\nimport { outputFileSync, readFileSync, readdirSync, unlinkSync } from 'fs-extra';\nimport { join, resolve } from 'path';\nimport { Memoize } from 'typescript-memoize';\nimport { satisfies } from 'semver';\nimport { transform } from '@babel/core';\nimport type * as Babel from '@babel/core';\nimport type { NodePath } from '@babel/traverse';\nimport Plugin from 'broccoli-plugin';\nimport type { Node } from 'broccoli-node-api';\nimport { existsSync } from 'fs';\n\nexport default class extends V1Addon {\n get v2Tree() {\n return mergeTrees([super.v2Tree, buildFunnel(this.rootTree, { include: ['dist/ember-template-compiler.js'] })]);\n }\n\n // versions of ember-source prior to\n // https://github.com/emberjs/ember.js/pull/20675 ship dist/packages and\n // dist/dependencies separately and the imports between them are package-name\n // imports. Since many of the dependencies are also true package.json\n // dependencies (in order to get typescript types), and our module-resolver\n // prioritizes true dependencies, it's necessary to detect and remove the\n // package.json dependencies.\n //\n // After the above linked change, ember-source ships only dist/packages and\n // the inter-package imports are all relative. Some of the things in\n // dist/packages are still the rolled-in dependencies, but now that the\n // imports are all relative we need no special handling for them (beyond the\n // normal v2 addon renamed-modules support.\n @Memoize()\n private get includedDependencies() {\n let result: string[] = [];\n let depsDir = resolve(this.root, 'dist', 'dependencies');\n if (!existsSync(depsDir)) {\n return result;\n }\n for (let name of readdirSync(depsDir)) {\n if (name[0] === '@') {\n for (let innerName of readdirSync(resolve(this.root, 'dist', 'dependencies', name))) {\n if (innerName.endsWith('.js')) {\n result.push(name + '/' + innerName.slice(0, -3));\n }\n }\n } else {\n if (name.endsWith('.js')) {\n result.push(name.slice(0, -3));\n }\n }\n }\n return result;\n }\n\n get newPackageJSON() {\n let json = super.newPackageJSON;\n\n for (let name of this.includedDependencies) {\n // weirdly, many of the inlined dependency are still listed as real\n // dependencies too. If we don't delete them here, they will take\n // precedence over the inlined ones, because the embroider module-resolver\n // tries to prioritize real deps.\n delete json.dependencies?.[name];\n }\n\n return json;\n }\n\n customizes(treeName: string) {\n // we are adding custom implementations of these\n return treeName === 'treeForAddon' || treeName === 'treeForVendor' || super.customizes(treeName);\n }\n\n invokeOriginalTreeFor(name: string) {\n if (name === 'addon') {\n return this.customAddonTree();\n }\n if (name === 'vendor') {\n return this.customVendorTree();\n }\n }\n\n // Our addon tree is all of the \"packages\" we share. @embroider/compat already\n // supports that pattern of emitting modules into other package's namespaces.\n private customAddonTree() {\n let packages = buildFunnel(this.rootTree, {\n srcDir: 'dist/packages',\n });\n\n let trees: Node[] = [\n packages,\n buildFunnel(this.rootTree, {\n srcDir: 'dist/dependencies',\n allowEmpty: true,\n }),\n ];\n\n if (satisfies(this.packageJSON.version, '>= 4.0.0-alpha.0 <4.10.0-alpha.0', { includePrerelease: true })) {\n // import { loc } from '@ember/string' was removed in 4.0. but the\n // top-level `ember` package tries to import it until 4.10. A\n // spec-compliant ES modules implementation will treat this as a parse\n // error.\n trees.push(new FixStringLoc([packages]));\n }\n\n return mergeTrees(trees, { overwrite: true });\n }\n\n // We're zeroing out these files in vendor rather than deleting them, because\n // we can't easily intercept the `app.import` that presumably exists for them,\n // so rather than error they will just be empty.\n //\n // The reason we're zeroing these out is that we're going to consume all our\n // modules directly out of treeForAddon instead, as real modules that webpack\n // can see.\n private customVendorTree() {\n return new AddToTree(this.addonInstance._treeFor('vendor'), outputPath => {\n unlinkSync(join(outputPath, 'ember', 'ember.js'));\n outputFileSync(join(outputPath, 'ember', 'ember.js'), '');\n unlinkSync(join(outputPath, 'ember', 'ember-testing.js'));\n outputFileSync(join(outputPath, 'ember', 'ember-testing.js'), '');\n });\n }\n\n get packageMeta() {\n let meta = super.packageMeta;\n\n if (!meta['implicit-modules']) {\n meta['implicit-modules'] = [];\n }\n meta['implicit-modules'].push('./ember/index.js');\n // before 5.6, Ember uses the AMD loader to decide if it's test-only parts\n // are present, so we must ensure they're registered. After that it's\n // enough to evaluate ember-testing, which @embroider/core is hard-coded\n // to do in the backward-compatible tests bundle.\n if (!satisfies(this.packageJSON.version, '>= 5.6.0-alpha.0', { includePrerelease: true })) {\n if (!meta['implicit-test-modules']) {\n meta['implicit-test-modules'] = [];\n }\n meta['implicit-test-modules'].push('./ember-testing/index.js');\n }\n\n return meta;\n }\n}\n\nclass FixStringLoc extends Plugin {\n build() {\n let inSource = readFileSync(resolve(this.inputPaths[0], 'ember', 'index.js'), 'utf8');\n let outSource = transform(inSource, {\n plugins: [fixStringLoc],\n configFile: false,\n })!.code!;\n outputFileSync(resolve(this.outputPath, 'ember', 'index.js'), outSource, 'utf8');\n }\n}\n\nfunction fixStringLoc(babel: typeof Babel) {\n let t = babel.types;\n return {\n visitor: {\n Program(path: NodePath<Babel.types.Program>) {\n path.node.body.unshift(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier('loc'), t.identifier('undefined'))])\n );\n },\n ImportDeclaration: {\n enter(path: NodePath<Babel.types.ImportDeclaration>, state: { inEmberString: boolean }) {\n if (path.node.source.value === '@ember/string') {\n state.inEmberString = true;\n }\n },\n exit(_path: NodePath<Babel.types.ImportDeclaration>, state: { inEmberString: boolean }) {\n state.inEmberString = false;\n },\n },\n ImportSpecifier(path: NodePath<Babel.types.ImportSpecifier>, state: { inEmberString: boolean }) {\n let name = 'value' in path.node.imported ? path.node.imported.value : path.node.imported.name;\n if (state.inEmberString && name === 'loc') {\n path.remove();\n }\n },\n },\n };\n}\n"]}
package/src/compat-app.js CHANGED
@@ -345,7 +345,7 @@ class CompatApp {
345
345
  let addonMeta = {
346
346
  type: 'addon',
347
347
  version: 2,
348
- 'implicit-scripts': this._implicitScripts.map(remapAsset),
348
+ 'implicit-scripts': this._implicitScripts.map(remapAsset).filter(forbiddenVendorPath),
349
349
  'implicit-styles': this._implicitStyles.map(remapAsset),
350
350
  'implicit-test-scripts': this.legacyEmberAppInstance.legacyTestFilesToAppend.map(remapAsset),
351
351
  'implicit-test-styles': this.legacyEmberAppInstance.vendorTestStaticStyles.map(remapAsset),
@@ -605,4 +605,11 @@ __decorate([
605
605
  __decorate([
606
606
  (0, typescript_memoize_1.Memoize)()
607
607
  ], CompatApp.prototype, "appPackage", null);
608
+ function forbiddenVendorPath(path) {
609
+ // ember-source does not go in vendor under embroider (we always use the
610
+ // separate ES modules)
611
+ //
612
+ // loader.js sets up AMD. We don't use AMD.
613
+ return !['./vendor/loader/loader.js', './vendor/ember/ember.js'].includes(path);
614
+ }
608
615
  //# sourceMappingURL=compat-app.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compat-app.js","sourceRoot":"","sources":["compat-app.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,0CAA+G;AAE/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,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A,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;AAkTD;IADC,IAAA,4BAAO,GAAE;8CAGT;AA0CD;IADC,IAAA,4BAAO,GAAE;2CAcT","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 { 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: Required<Options>;\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 type: 'addon',\n version: 2,\n 'implicit-scripts': this._implicitScripts.map(remapAsset),\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 type: 'addon',\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"]}
1
+ {"version":3,"file":"compat-app.js","sourceRoot":"","sources":["compat-app.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,0CAA+G;AAE/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,CAAC;IAC5F,CAAC;IAED,IAAI,IAAI;QACN,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,wCAAwC;YACxC,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CA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T;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;AAkTD;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 { 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: Required<Options>;\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 type: 'addon',\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 type: 'addon',\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"]}
@@ -59,6 +59,7 @@ export interface PreprocessedComponentRule {
59
59
  safeToIgnore: boolean;
60
60
  safeInteriorPaths: string[];
61
61
  disambiguate: Record<string, 'component' | 'helper' | 'data'>;
62
+ invokes: Required<ComponentRules>['invokes'];
62
63
  }
63
64
  export declare function preprocessComponentRule(componentRules: ComponentRules): PreprocessedComponentRule;
64
65
  export declare function activePackageRules(packageRules: PackageRules[], activePackages: {
@@ -10,7 +10,7 @@ const resolve_exports_1 = require("resolve.exports");
10
10
  // take a component rule from the authoring format to a format more optimized
11
11
  // for consumption in the resolver
12
12
  function preprocessComponentRule(componentRules) {
13
- var _a;
13
+ var _a, _b;
14
14
  let argumentsAreComponents = [];
15
15
  let safeInteriorPaths = [];
16
16
  if (componentRules.acceptsComponentArguments) {
@@ -44,6 +44,7 @@ function preprocessComponentRule(componentRules) {
44
44
  yieldsSafeComponents: componentRules.yieldsSafeComponents || [],
45
45
  yieldsArguments: componentRules.yieldsArguments || [],
46
46
  disambiguate: (_a = componentRules === null || componentRules === void 0 ? void 0 : componentRules.disambiguate) !== null && _a !== void 0 ? _a : {},
47
+ invokes: (_b = componentRules === null || componentRules === void 0 ? void 0 : componentRules.invokes) !== null && _b !== void 0 ? _b : {},
47
48
  };
48
49
  }
49
50
  function activePackageRules(packageRules, activePackages) {
@@ -1 +1 @@
1
- {"version":3,"file":"dependency-rules.js","sourceRoot":"","sources":["dependency-rules.ts"],"names":[],"mappings":";;AA8KA,0DAkCC;AAED,gDAqBC;AAED,0CAkBC;AA1PD,0CAA8C;AAC9C,+BAAuD;AACvD,mCAAmC;AACnC,qDAA4D;AAwK5D,6EAA6E;AAC7E,kCAAkC;AAClC,SAAgB,uBAAuB,CAAC,cAA8B;;IACpE,IAAI,sBAAsB,GAAG,EAAE,CAAC;IAChC,IAAI,iBAAiB,GAAG,EAAE,CAAC;IAC3B,IAAI,cAAc,CAAC,yBAAyB,EAAE,CAAC;QAC7C,KAAK,IAAI,KAAK,IAAI,cAAc,CAAC,yBAAyB,EAAE,CAAC;YAC3D,IAAI,IAAI,EAAE,QAAQ,CAAC;YACnB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;gBAClB,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;YAC3B,CAAC;YACD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACvB,CAAC;YACD,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,iBAAiB,CAAC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC;YAC3C,iBAAiB,CAAC,IAAI,CAAC,GAA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AAK,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,YAAY,EAAE,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,eAAe,CAAC,IAAY,EAAE,QAAkB;IAC9D,IAAI,GAAG,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAClD,IAAI,GAAG,EAAE,CAAC;QACR,IAAI,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC;YACpB,0EAA0E;YAC1E,8EAA8E;YAC9E,6EAA6E;YAC7E,wCAAwC;YACxC,OAAO,IAAA,cAAW,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACpC,CAAC;aAAM,CAAC;YACN,iBAAiB;YACjB,IAAI,OAAO,GAAG,IAAA,yBAAc,EAAC,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;YAC5D,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,IAAA,cAAO,EAAC,IAAA,cAAW,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { Resolver } from '@embroider/core';\nimport { getOrCreate } from '@embroider/core';\nimport { resolve as pathResolve, dirname } from 'path';\nimport { satisfies } from 'semver';\nimport { resolve as resolveExports } from 'resolve.exports';\n\nexport interface PackageRules {\n // This whole set of rules will only apply when the given addon package\n // matching the given semver range is present and active.\n package: string;\n semverRange?: string;\n\n components?: {\n // I would prefer to write the key type here as `ComponentSnippet` to aid\n // documentation, but Typescript won't allow it. See ComponentSnippet below.\n [key: string]: ComponentRules;\n };\n\n addonModules?: {\n // `filename` is relative to your package root, and it assumes v2 package\n // format. Like \"templates/components/foo.hbs\".\n [filename: string]: ModuleRules;\n };\n\n appModules?: {\n // `filename` is relative to the app's root, and it assumes v2 package\n // format. Like \"templates/components/foo.hbs\".\n [filename: string]: ModuleRules;\n };\n\n addonTemplates?: {\n // `filename` is relative to your package root, and it assumes v2 package\n // format. Like \"templates/foo.hbs\".\n [filename: string]: TemplateRules;\n };\n\n appTemplates?: {\n // `filename` is relative to the app's root, and it assumes v2 package\n // format. Like \"templates/foo.hbs\".\n [filename: string]: TemplateRules;\n };\n}\n\nexport interface ActivePackageRules extends PackageRules {\n // the location(s) of active packages that match this rule.\n roots: string[];\n}\n\nexport interface TemplateRules {\n // Tells embroider which list of components may be needed for a given path.\n // For example, if your template says `{{component this.panel}}` and you know\n // that `this.panel` can be either \"light-panel\" or \"dark-panel\", you would\n // say: `invokes: { \"this.panel\": [\"<LightPanel/>\", \"<DarkPanel/>\"] }`\n invokes?: {\n [path: string]: ComponentSnippet[];\n };\n\n // Embroider will complain if you try to use staticHelper and/or\n // staticComponents and you have ambiguous forms that might be a component or\n // a helper or just some data that is being rendered. For example, if a\n // template says `{{something}}`, we can't tell if that is `<Something />` or\n // `{{ (something) }}` or `{{this.something}}`.\n disambiguate?: {\n [dasherizedName: string]: 'component' | 'helper' | 'data';\n };\n}\n\nexport interface ComponentRules extends TemplateRules {\n // This declares that our component yields other components that are safe to\n // invoke with the {{component}} helper.\n //\n // The array corresponds to your yielded positional arguments. Any value that\n // is true is considered a safe component. Any value can be a hash in which\n // individual keys that are true are considered safe components.\n //\n // Examples:\n //\n // If you do: {{yield (component \"x\") }}\n // Then say: yieldsSafeComponents: [true]\n //\n // If you do: {{yield (hash x=(component \"x\") y=(component \"y\")) }}\n // Then say: yieldsSafeComponents: [{x: true, y: true}]\n //\n yieldsSafeComponents?: (boolean | { [name: string]: boolean })[];\n\n // This declares that our component yields some of its arguments unchanged.\n //\n // The array corresponds to your yielded positional arguments. Each value can\n // be:\n // false, meaning this yielded value is not one of our arguments\n // a string, meaning this yielded value is our argument with that name\n // or a POJO, whose individual properties are string naming which arguments\n // from whence they came.\n //\n // Examples:\n //\n // If you do: {{yield @foo}}\n // Then say: yieldsArguments: ['foo']\n //\n // If you do: {{yield (hash x=@foo) }}\n // Then say: yieldsArguments: [{ x: 'foo' }]\n yieldsArguments?: (string | { [name: string]: string })[];\n\n // This declares that our component accepts arguments that will be invoked\n // with the {{component}} helper. This silences warnings in the places where\n // we consume them, while introducing warnings in the places where people are\n // passing them to us (if they are doing so in a way that is too dynamic to\n // analyze).\n //\n // If you use this, you may also need to set `layout`, see below.\n acceptsComponentArguments?: ArgumentMapping[];\n\n // If you want to use `acceptsComponentArguments` on a component that\n // customies its own `layout` (which is most addon-provided components), you\n // need to tell us here how to find its template by setting either `addonPath`\n // or `appPath`.\n layout?: {\n // This is a path relative to the addon root, assuming V2 format.\n addonPath?: string;\n // This is the path relative to the app root, assuming V2 format.\n appPath?: string;\n };\n\n // An unresolvable component is usually a build error (when your app has the\n // staticComponent Option enabled). But you can tell Embroider to ignore it by\n // setting this.\n safeToIgnore?: boolean;\n}\n\nexport interface ModuleRules {\n // We will resolve these components into the corresponding JS and HBS files\n // and generate imports such that this module depends on them.\n dependsOnComponents?: ComponentSnippet[];\n\n // This adds new imports to our module, as if they were really there. Helpful\n // for working around addons that depend on things but don't say so.\n dependsOnModules?: string[];\n}\n\n// The bare \"string\" short form implies that `becomes` is the same as `name`.\nexport type ArgumentMapping =\n | string\n | {\n // the name of the argument you accept\n name: string;\n // the name its consumed as in your template\n becomes: string;\n };\n\n// A component snippet is a string containing valid HBS that is a single\n// component invocation. We use it to refer to components in a way that doesn't\n// require any new syntax or rules, and that's necessarily supported by whatever\n// build-time template resolver is in use.\n//\n// Examples of valid ComponentSnippets:\n//\n// \"{{my-component}}\"\n// \"{{my-component/foo}}\"\n// \"<MyComponent />\"\n// \"{{component 'my-component'}}\"\n//\ntype ComponentSnippet = string;\n\nexport interface PreprocessedComponentRule {\n yieldsSafeComponents: Required<ComponentRules>['yieldsSafeComponents'];\n yieldsArguments: Required<ComponentRules>['yieldsArguments'];\n argumentsAreComponents: string[];\n safeToIgnore: boolean;\n safeInteriorPaths: string[];\n disambiguate: Record<string, 'component' | 'helper' | 'data'>;\n}\n\n// take a component rule from the authoring format to a format more optimized\n// for consumption in the resolver\nexport function preprocessComponentRule(componentRules: ComponentRules): PreprocessedComponentRule {\n let argumentsAreComponents = [];\n let safeInteriorPaths = [];\n if (componentRules.acceptsComponentArguments) {\n for (let entry of componentRules.acceptsComponentArguments) {\n let name, interior;\n if (typeof entry === 'string') {\n name = interior = entry;\n } else {\n name = entry.name;\n interior = entry.becomes;\n }\n if (name.startsWith('@')) {\n name = name.slice(1);\n }\n argumentsAreComponents.push(name);\n safeInteriorPaths.push(interior);\n safeInteriorPaths.push('this.' + interior);\n safeInteriorPaths.push('@' + name);\n }\n }\n if (componentRules.invokes) {\n for (let [path] of Object.entries(componentRules.invokes)) {\n safeInteriorPaths.push(path);\n }\n }\n return {\n safeInteriorPaths,\n safeToIgnore: Boolean(componentRules.safeToIgnore),\n argumentsAreComponents,\n yieldsSafeComponents: componentRules.yieldsSafeComponents || [],\n yieldsArguments: componentRules.yieldsArguments || [],\n disambiguate: componentRules?.disambiguate ?? {},\n };\n}\n\nexport function activePackageRules(\n packageRules: PackageRules[],\n activePackages: { name: string; root: string; version: string }[]\n): ActivePackageRules[] {\n // rule order implies precedence. The first rule that matches a given package\n // applies to that package, and no other rule does.\n let rootsPerRule = new Map();\n for (let pkg of activePackages) {\n for (let rule of packageRules) {\n if (rule.package === pkg.name && (!rule.semverRange || satisfies(pkg.version, rule.semverRange))) {\n let roots = getOrCreate(rootsPerRule, rule, () => []);\n roots.push(pkg.root);\n break;\n }\n }\n }\n let output = [];\n for (let [rule, roots] of rootsPerRule) {\n output.push(Object.assign({ roots }, rule));\n }\n return output;\n}\n\nexport function appTreeRulesDir(root: string, resolver: Resolver) {\n let pkg = resolver.packageCache.ownerOfFile(root);\n if (pkg) {\n if (pkg.isV2Addon()) {\n // in general v2 addons can keep their app tree stuff in other places than\n // \"_app_\" and we would need to check their package.json to see. But this code\n // is only for applying packageRules to auto-upgraded v1 addons and apps, and\n // those we always organize predictably.\n return pathResolve(root, '_app_');\n } else {\n // this is an app\n let matched = resolveExports(pkg.packageJSON, './index.js');\n if (matched) {\n return dirname(pathResolve(root, matched[0]));\n }\n }\n }\n return root;\n}\n"]}
1
+ {"version":3,"file":"dependency-rules.js","sourceRoot":"","sources":["dependency-rules.ts"],"names":[],"mappings":";;AA+KA,0DAmCC;AAED,gDAqBC;AAED,0CAkBC;AA5PD,0CAA8C;AAC9C,+BAAuD;AACvD,mCAAmC;AACnC,qDAA4D;AAyK5D,6EAA6E;AAC7E,kCAAkC;AAClC,SAAgB,uBAAuB,CAAC,cAA8B;;IACpE,IAAI,sBAAsB,GAAG,EAAE,CAAC;IAChC,IAAI,iBAAiB,GAAG,EAAE,CAAC;IAC3B,IAAI,cAAc,CAAC,yBAAyB,EAAE,CAAC;QAC7C,KAAK,IAAI,KAAK,IAAI,cAAc,CAAC,yBAAyB,EAAE,CAAC;YAC3D,IAAI,IAAI,EAAE,QAAQ,CAAC;YACnB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;gBAClB,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;YAC3B,CAAC;YACD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACvB,CAAC;YACD,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,iBAAiB,CAAC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC;YAC3C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CAAC,IAAI,CAAC,CAAC;gBACrB,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IACD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,YAAY,EAAE,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,eAAe,CAAC,IAAY,EAAE,QAAkB;IAC9D,IAAI,GAAG,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAClD,IAAI,GAAG,EAAE,CAAC;QACR,IAAI,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC;YACpB,0EAA0E;YAC1E,8EAA8E;YAC9E,6EAA6E;YAC7E,wCAAwC;YACxC,OAAO,IAAA,cAAW,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACpC,CAAC;aAAM,CAAC;YACN,iBAAiB;YACjB,IAAI,OAAO,GAAG,IAAA,yBAAc,EAAC,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;YAC5D,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,IAAA,cAAO,EAAC,IAAA,cAAW,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { Resolver } from '@embroider/core';\nimport { getOrCreate } from '@embroider/core';\nimport { resolve as pathResolve, dirname } from 'path';\nimport { satisfies } from 'semver';\nimport { resolve as resolveExports } from 'resolve.exports';\n\nexport interface PackageRules {\n // This whole set of rules will only apply when the given addon package\n // matching the given semver range is present and active.\n package: string;\n semverRange?: string;\n\n components?: {\n // I would prefer to write the key type here as `ComponentSnippet` to aid\n // documentation, but Typescript won't allow it. See ComponentSnippet below.\n [key: string]: ComponentRules;\n };\n\n addonModules?: {\n // `filename` is relative to your package root, and it assumes v2 package\n // format. Like \"templates/components/foo.hbs\".\n [filename: string]: ModuleRules;\n };\n\n appModules?: {\n // `filename` is relative to the app's root, and it assumes v2 package\n // format. Like \"templates/components/foo.hbs\".\n [filename: string]: ModuleRules;\n };\n\n addonTemplates?: {\n // `filename` is relative to your package root, and it assumes v2 package\n // format. Like \"templates/foo.hbs\".\n [filename: string]: TemplateRules;\n };\n\n appTemplates?: {\n // `filename` is relative to the app's root, and it assumes v2 package\n // format. Like \"templates/foo.hbs\".\n [filename: string]: TemplateRules;\n };\n}\n\nexport interface ActivePackageRules extends PackageRules {\n // the location(s) of active packages that match this rule.\n roots: string[];\n}\n\nexport interface TemplateRules {\n // Tells embroider which list of components may be needed for a given path.\n // For example, if your template says `{{component this.panel}}` and you know\n // that `this.panel` can be either \"light-panel\" or \"dark-panel\", you would\n // say: `invokes: { \"this.panel\": [\"<LightPanel/>\", \"<DarkPanel/>\"] }`\n invokes?: {\n [path: string]: ComponentSnippet[];\n };\n\n // Embroider will complain if you try to use staticHelper and/or\n // staticComponents and you have ambiguous forms that might be a component or\n // a helper or just some data that is being rendered. For example, if a\n // template says `{{something}}`, we can't tell if that is `<Something />` or\n // `{{ (something) }}` or `{{this.something}}`.\n disambiguate?: {\n [dasherizedName: string]: 'component' | 'helper' | 'data';\n };\n}\n\nexport interface ComponentRules extends TemplateRules {\n // This declares that our component yields other components that are safe to\n // invoke with the {{component}} helper.\n //\n // The array corresponds to your yielded positional arguments. Any value that\n // is true is considered a safe component. Any value can be a hash in which\n // individual keys that are true are considered safe components.\n //\n // Examples:\n //\n // If you do: {{yield (component \"x\") }}\n // Then say: yieldsSafeComponents: [true]\n //\n // If you do: {{yield (hash x=(component \"x\") y=(component \"y\")) }}\n // Then say: yieldsSafeComponents: [{x: true, y: true}]\n //\n yieldsSafeComponents?: (boolean | { [name: string]: boolean })[];\n\n // This declares that our component yields some of its arguments unchanged.\n //\n // The array corresponds to your yielded positional arguments. Each value can\n // be:\n // false, meaning this yielded value is not one of our arguments\n // a string, meaning this yielded value is our argument with that name\n // or a POJO, whose individual properties are string naming which arguments\n // from whence they came.\n //\n // Examples:\n //\n // If you do: {{yield @foo}}\n // Then say: yieldsArguments: ['foo']\n //\n // If you do: {{yield (hash x=@foo) }}\n // Then say: yieldsArguments: [{ x: 'foo' }]\n yieldsArguments?: (string | { [name: string]: string })[];\n\n // This declares that our component accepts arguments that will be invoked\n // with the {{component}} helper. This silences warnings in the places where\n // we consume them, while introducing warnings in the places where people are\n // passing them to us (if they are doing so in a way that is too dynamic to\n // analyze).\n //\n // If you use this, you may also need to set `layout`, see below.\n acceptsComponentArguments?: ArgumentMapping[];\n\n // If you want to use `acceptsComponentArguments` on a component that\n // customies its own `layout` (which is most addon-provided components), you\n // need to tell us here how to find its template by setting either `addonPath`\n // or `appPath`.\n layout?: {\n // This is a path relative to the addon root, assuming V2 format.\n addonPath?: string;\n // This is the path relative to the app root, assuming V2 format.\n appPath?: string;\n };\n\n // An unresolvable component is usually a build error (when your app has the\n // staticComponent Option enabled). But you can tell Embroider to ignore it by\n // setting this.\n safeToIgnore?: boolean;\n}\n\nexport interface ModuleRules {\n // We will resolve these components into the corresponding JS and HBS files\n // and generate imports such that this module depends on them.\n dependsOnComponents?: ComponentSnippet[];\n\n // This adds new imports to our module, as if they were really there. Helpful\n // for working around addons that depend on things but don't say so.\n dependsOnModules?: string[];\n}\n\n// The bare \"string\" short form implies that `becomes` is the same as `name`.\nexport type ArgumentMapping =\n | string\n | {\n // the name of the argument you accept\n name: string;\n // the name its consumed as in your template\n becomes: string;\n };\n\n// A component snippet is a string containing valid HBS that is a single\n// component invocation. We use it to refer to components in a way that doesn't\n// require any new syntax or rules, and that's necessarily supported by whatever\n// build-time template resolver is in use.\n//\n// Examples of valid ComponentSnippets:\n//\n// \"{{my-component}}\"\n// \"{{my-component/foo}}\"\n// \"<MyComponent />\"\n// \"{{component 'my-component'}}\"\n//\ntype ComponentSnippet = string;\n\nexport interface PreprocessedComponentRule {\n yieldsSafeComponents: Required<ComponentRules>['yieldsSafeComponents'];\n yieldsArguments: Required<ComponentRules>['yieldsArguments'];\n argumentsAreComponents: string[];\n safeToIgnore: boolean;\n safeInteriorPaths: string[];\n disambiguate: Record<string, 'component' | 'helper' | 'data'>;\n invokes: Required<ComponentRules>['invokes'];\n}\n\n// take a component rule from the authoring format to a format more optimized\n// for consumption in the resolver\nexport function preprocessComponentRule(componentRules: ComponentRules): PreprocessedComponentRule {\n let argumentsAreComponents = [];\n let safeInteriorPaths = [];\n if (componentRules.acceptsComponentArguments) {\n for (let entry of componentRules.acceptsComponentArguments) {\n let name, interior;\n if (typeof entry === 'string') {\n name = interior = entry;\n } else {\n name = entry.name;\n interior = entry.becomes;\n }\n if (name.startsWith('@')) {\n name = name.slice(1);\n }\n argumentsAreComponents.push(name);\n safeInteriorPaths.push(interior);\n safeInteriorPaths.push('this.' + interior);\n safeInteriorPaths.push('@' + name);\n }\n }\n if (componentRules.invokes) {\n for (let [path] of Object.entries(componentRules.invokes)) {\n safeInteriorPaths.push(path);\n }\n }\n return {\n safeInteriorPaths,\n safeToIgnore: Boolean(componentRules.safeToIgnore),\n argumentsAreComponents,\n yieldsSafeComponents: componentRules.yieldsSafeComponents || [],\n yieldsArguments: componentRules.yieldsArguments || [],\n disambiguate: componentRules?.disambiguate ?? {},\n invokes: componentRules?.invokes ?? {},\n };\n}\n\nexport function activePackageRules(\n packageRules: PackageRules[],\n activePackages: { name: string; root: string; version: string }[]\n): ActivePackageRules[] {\n // rule order implies precedence. The first rule that matches a given package\n // applies to that package, and no other rule does.\n let rootsPerRule = new Map();\n for (let pkg of activePackages) {\n for (let rule of packageRules) {\n if (rule.package === pkg.name && (!rule.semverRange || satisfies(pkg.version, rule.semverRange))) {\n let roots = getOrCreate(rootsPerRule, rule, () => []);\n roots.push(pkg.root);\n break;\n }\n }\n }\n let output = [];\n for (let [rule, roots] of rootsPerRule) {\n output.push(Object.assign({ roots }, rule));\n }\n return output;\n}\n\nexport function appTreeRulesDir(root: string, resolver: Resolver) {\n let pkg = resolver.packageCache.ownerOfFile(root);\n if (pkg) {\n if (pkg.isV2Addon()) {\n // in general v2 addons can keep their app tree stuff in other places than\n // \"_app_\" and we would need to check their package.json to see. But this code\n // is only for applying packageRules to auto-upgraded v1 addons and apps, and\n // those we always organize predictably.\n return pathResolve(root, '_app_');\n } else {\n // this is an app\n let matched = resolveExports(pkg.packageJSON, './index.js');\n if (matched) {\n return dirname(pathResolve(root, matched[0]));\n }\n }\n }\n return root;\n}\n"]}
package/src/options.d.ts CHANGED
@@ -4,7 +4,6 @@ import type { PackageRules } from './dependency-rules';
4
4
  export default interface Options extends CoreOptions {
5
5
  staticAddonTrees?: boolean;
6
6
  staticAddonTestSupportTrees?: boolean;
7
- staticEmberSource?: boolean;
8
7
  compatAdapters?: Map<string, V1AddonConstructor | null>;
9
8
  packageRules?: PackageRules[];
10
9
  allowUnsafeDynamicComponents?: boolean;
package/src/options.js CHANGED
@@ -6,7 +6,6 @@ const core_1 = require("@embroider/core");
6
6
  const defaults = Object.assign((0, core_1.optionsWithDefaults)(), {
7
7
  staticAddonTrees: false,
8
8
  staticAddonTestSupportTrees: false,
9
- staticEmberSource: false,
10
9
  compatAdapters: new Map(),
11
10
  extraPublicTrees: [],
12
11
  workspaceDir: null,
@@ -31,7 +30,6 @@ exports.recommendedOptions = Object.freeze({
31
30
  staticHelpers: true,
32
31
  staticModifiers: true,
33
32
  staticComponents: true,
34
- staticEmberSource: true,
35
33
  allowUnsafeDynamicComponents: false,
36
34
  }),
37
35
  });
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";;;AA6HA,kDAEC;AA7HD,0CAA0E;AA6G1E,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAA,0BAAgB,GAAE,EAAE;IACjD,gBAAgB,EAAE,KAAK;IACvB,2BAA2B,EAAE,KAAK;IAClC,iBAAiB,EAAE,KAAK;IACxB,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;AAEH,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,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,IAAI;QACrB,gBAAgB,EAAE,IAAI;QACtB,iBAAiB,EAAE,IAAI;QACvB,4BAA4B,EAAE,KAAK;KACpC,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 // when true, we will load ember-source as ES modules. This means unused parts\n // of ember-source won't be included. But it also means that addons using old\n // APIs to try to `require()` things from Ember -- particularly from within\n // vendor.js -- cannot do that anymore.\n //\n // When false (the default) we load ember-source the traditional way, which is\n // that a big ol' script gets smooshed into vendor.js, and none of ember's\n // public module API actually exists as modules at build time.\n staticEmberSource?: 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 staticEmberSource: 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 function optionsWithDefaults(options?: Options): Required<Options> {\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 staticHelpers: true,\n staticModifiers: true,\n staticComponents: true,\n staticEmberSource: true,\n allowUnsafeDynamicComponents: false,\n }),\n});\n"]}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";;;AAkHA,kDAEC;AAlHD,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;AAEH,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,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,IAAI;QACrB,gBAAgB,EAAE,IAAI;QACtB,4BAA4B,EAAE,KAAK;KACpC,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 function optionsWithDefaults(options?: Options): Required<Options> {\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 staticHelpers: true,\n staticModifiers: true,\n staticComponents: true,\n allowUnsafeDynamicComponents: false,\n }),\n});\n"]}
@@ -95,7 +95,9 @@ class TemplateResolver {
95
95
  this.scopeStack = new ScopeStack();
96
96
  this.visitor = {
97
97
  Template: {
98
- enter: () => {
98
+ enter: (node, path) => {
99
+ this.ownRules = this.findRules(this.env.filename);
100
+ this.implementInvokesRule(node, path);
99
101
  if (this.env.locals) {
100
102
  this.scopeStack.pushMustacheBlock(this.env.locals);
101
103
  }
@@ -536,6 +538,7 @@ class TemplateResolver {
536
538
  };
537
539
  }
538
540
  targetComponentHelper(component, loc, impliedBecause) {
541
+ var _a;
539
542
  if (!this.staticComponentsEnabled) {
540
543
  return null;
541
544
  }
@@ -555,8 +558,7 @@ class TemplateResolver {
555
558
  };
556
559
  }
557
560
  if (component.type === 'path') {
558
- let ownComponentRules = this.findRules(this.env.filename);
559
- if (ownComponentRules && ownComponentRules.safeInteriorPaths.includes(component.path)) {
561
+ if ((_a = this.ownRules) === null || _a === void 0 ? void 0 : _a.safeInteriorPaths.includes(component.path)) {
560
562
  return null;
561
563
  }
562
564
  return {
@@ -801,6 +803,28 @@ class TemplateResolver {
801
803
  }
802
804
  return null;
803
805
  }
806
+ implementInvokesRule(node, path) {
807
+ var _a;
808
+ if (!((_a = this.ownRules) === null || _a === void 0 ? void 0 : _a.invokes)) {
809
+ return;
810
+ }
811
+ let registrations = [];
812
+ for (let snippets of Object.values(this.ownRules.invokes)) {
813
+ for (let snippet of snippets) {
814
+ let dasherizedName = (0, dasherize_component_name_1.snippetToDasherizedName)(snippet);
815
+ if (!dasherizedName) {
816
+ throw new Error(`Package rule contains unparseable component snippet: ${snippet}`);
817
+ }
818
+ let resolution = this.targetComponentHelper({ type: 'literal', path: dasherizedName }, node.loc);
819
+ this.emit(path, resolution, (_target, id) => {
820
+ registrations.push(this.env.syntax.builders.pair(dasherizedName, id));
821
+ });
822
+ }
823
+ }
824
+ if (registrations.length > 0) {
825
+ node.body.unshift(this.env.syntax.builders.mustache(this.env.meta.jsutils.bindExpression(registrationHelper, path, { nameHint: 'registerComponents' }), [], this.env.syntax.builders.hash(registrations)));
826
+ }
827
+ }
804
828
  }
805
829
  __decorate([
806
830
  (0, typescript_memoize_1.Memoize)()
@@ -988,4 +1012,18 @@ function parts(path) {
988
1012
  return;
989
1013
  return 'original' in path ? path.original.split('.') : path.parts;
990
1014
  }
1015
+ function registrationHelper(context) {
1016
+ let Helper = context.import('@ember/component/helper', 'default', 'Helper');
1017
+ let getOwner = context.import('@ember/owner', 'getOwner');
1018
+ return `
1019
+ (class extends ${Helper} {
1020
+ compute(_positional, registrations) {
1021
+ let owner = ${getOwner}(this);
1022
+ for (let [name, definition] of Object.entries(registrations)) {
1023
+ owner.register(\`component:\${name}\`, definition);
1024
+ }
1025
+ }
1026
+ })
1027
+ `;
1028
+ }
991
1029
  //# sourceMappingURL=resolver-transform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolver-transform.js","sourceRoot":"","sources":["resolver-transform.ts"],"names":[],"mappings":";;;;;;;;;;;AAs9BA,wCAkBC;AAh+BD,yDAA8E;AAC9E,2DAA6C;AAE7C,gEAAuC;AACvC,+BAAiC;AACjC,yEAAgF;AAEhF,0CAAqE;AAGrE,mCAA8C;AAC9C,mCAAmC;AAsCnC,SAAS,eAAe,CAAC,YAAoB;IAC3C,MAAM,eAAe,GAAwC;QAC3D,kBAAkB,EAAE,EAAE;QACtB,aAAa,EAAE,EAAE;QACjB,oBAAoB,EAAE,EAAE;QACxB,MAAM,EAAE,EAAE;QACV,KAAK,EAAE;YACL,gBAAgB,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC;SAC7C;QACD,SAAS,EAAE,EAAE;QACb,MAAM,EAAE;YACN,gBAAgB,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC;SAC9C;QACD,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;QACb,IAAI,EAAE,EAAE;QACR,EAAE,EAAE;YACF,gBAAgB,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC;SAC1C;QACD,GAAG,EAAE;YACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC;SAC3C;QACD,kBAAk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IAElB,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC;IACvC,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;AAC5B,CAAC;AAED,SAAS,QAAQ,CAAC,IAAS;IACzB,IAAI,CAAC,IAAI;QAAE,OAAO;IAElB,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;IACrC,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;AAC5B,CAAC;AAED,SAAS,KAAK,CAAC,IAAS;IACtB,IAAI,CAAC,IAAI;QAAE,OAAO;IAElB,OAAO,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AACpE,CAAC","sourcesContent":["import type { ASTv1, ASTPlugin, ASTPluginBuilder, ASTPluginEnvironment, WalkerPath } from '@glimmer/syntax';\nimport type {\n PreprocessedComponentRule,\n ActivePackageRules,\n ComponentRules,\n PackageRules,\n ModuleRules,\n} from './dependency-rules';\nimport { preprocessComponentRule, appTreeRulesDir } from './dependency-rules';\nimport { Memoize } from 'typescript-memoize';\nimport type { WithJSUtils } from 'babel-plugin-ember-template-compilation';\nimport assertNever from 'assert-never';\nimport { join, sep } from 'path';\nimport { dasherize, snippetToDasherizedName } from './dasherize-component-name';\nimport type { ResolverOptions as CoreResolverOptions } from '@embroider/core';\nimport { Resolver, ResolverLoader, cleanUrl } from '@embroider/core';\nimport type CompatOptions from './options';\nimport type { AuditMessage, Loc } from './audit';\nimport { camelCase, mergeWith } from 'lodash';\nimport { satisfies } from 'semver';\n\ntype Env = WithJSUtils<ASTPluginEnvironment> & {\n filename: string;\n contents: string;\n strictMode?: boolean;\n locals?: string[];\n};\n\n// this is a subset of the full Options. We care about serializability, and we\n// only needs parts that are easily serializable, which is why we don't keep the\n// whole thing.\ntype UserConfig = Pick<\n Required<CompatOptions>,\n 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'allowUnsafeDynamicComponents'\n>;\n\nexport interface CompatResolverOptions extends CoreResolverOptions {\n activePackageRules: ActivePackageRules[];\n options: UserConfig;\n}\n\nexport interface ExternalNameHint {\n (path: string): string | null;\n}\n\nexport interface Options {\n appRoot: string;\n emberVersion: string;\n externalNameHint?: ExternalNameHint;\n}\n\ntype BuiltIn = {\n importableHelper?: [string, string];\n importableComponent?: [string, string];\n importableModifier?: [string, string];\n};\n\nfunction builtInKeywords(emberVersion: string): Record<string, BuiltIn | undefined> {\n const builtInKeywords: Record<string, BuiltIn | undefined> = {\n '-get-dynamic-var': {},\n '-in-element': {},\n '-with-dynamic-vars': {},\n action: {},\n array: {\n importableHelper: ['array', '@ember/helper'],\n },\n component: {},\n concat: {\n importableHelper: ['concat', '@ember/helper'],\n },\n debugger: {},\n 'each-in': {},\n each: {},\n fn: {\n importableHelper: ['fn', '@ember/helper'],\n },\n get: {\n importableHelper: ['get', '@ember/helper'],\n },\n 'has-block-params': {},\n 'has-block': {},\n hasBlock: {},\n hasBlockParams: {},\n hash: {\n importableHelper: ['hash', '@ember/helper'],\n },\n helper: {},\n if: {},\n 'in-element': {},\n input: {\n importableComponent: ['Input', '@ember/component'],\n },\n let: {},\n 'link-to': {\n importableComponent: ['LinkTo', '@ember/routing'],\n },\n loc: {},\n log: {},\n modifier: {},\n mount: {},\n mut: {},\n on: {\n importableModifier: ['on', '@ember/modifier'],\n },\n outlet: {},\n partial: {},\n 'query-params': {},\n readonly: {},\n textarea: {\n importableComponent: ['Textarea', '@ember/component'],\n },\n unbound: {},\n 'unique-id': {},\n unless: {},\n with: {},\n yield: {},\n };\n if (satisfies(emberVersion, '>=5.2')) {\n builtInKeywords['unique-id'] = {\n importableHelper: ['uniqueId', '@ember/helper'],\n };\n }\n return builtInKeywords;\n}\n\ninterface ComponentResolution {\n type: 'component';\n specifier: string;\n importedName: string;\n yieldsComponents: Required<ComponentRules>['yieldsSafeComponents'];\n yieldsArguments: Required<ComponentRules>['yieldsArguments'];\n argumentsAreComponents: string[];\n nameHint: string;\n}\n\ntype HelperResolution = {\n type: 'helper';\n nameHint: string;\n specifier: string;\n importedName: string;\n};\n\ntype ModifierResolution = {\n type: 'modifier';\n specifier: string;\n importedName: string;\n nameHint: string;\n};\n\ntype ResolutionResult = ComponentResolution | HelperResolution | ModifierResolution;\n\ninterface ResolutionFail {\n type: 'error';\n message: string;\n detail: string;\n loc: Loc;\n}\n\ntype Resolution = ResolutionResult | ResolutionFail;\n\ntype ComponentLocator =\n | {\n type: 'literal';\n path: string;\n }\n | {\n type: 'path';\n path: string;\n }\n | {\n type: 'other';\n };\n\nclass TemplateResolver implements ASTPlugin {\n readonly name = 'embroider-build-time-resolver';\n\n private auditHandler: undefined | ((msg: AuditMessage) => void);\n private scopeStack = new ScopeStack();\n\n private moduleResolver: Resolver;\n\n constructor(\n private env: Env,\n private config: CompatResolverOptions,\n private builtInsForEmberVersion: ReturnType<typeof builtInKeywords>,\n private externalNameHint?: ExternalNameHint\n ) {\n this.moduleResolver = new Resolver(config);\n if ((globalThis as any).embroider_audit) {\n this.auditHandler = (globalThis as any).embroider_audit;\n }\n }\n\n private emit<Target extends WalkerPath<ASTv1.Node>>(\n parentPath: Target,\n resolution: Resolution | null,\n setter: (target: Target['node'], newIdentifier: ASTv1.PathExpression) => void\n ) {\n switch (resolution?.type) {\n case 'error':\n this.reportError(resolution);\n return;\n case 'component':\n case 'modifier':\n case 'helper': {\n let name = this.env.meta.jsutils.bindImport(resolution.specifier, resolution.importedName, parentPath, {\n nameHint: resolution.nameHint,\n });\n setter(parentPath.node, this.env.syntax.builders.path(name));\n return;\n }\n case undefined:\n return;\n default:\n assertNever(resolution);\n }\n }\n\n private reportError(dep: ResolutionFail) {\n if (!this.auditHandler && !this.config.options.allowUnsafeDynamicComponents) {\n let e: any = new Error(`${dep.message}: ${dep.detail} in ${this.humanReadableFile(this.env.filename)}`);\n e.isTemplateResolverError = true;\n e.loc = dep.loc;\n e.moduleName = this.env.filename;\n throw e;\n }\n if (this.auditHandler) {\n this.auditHandler({\n message: dep.message,\n filename: this.env.filename,\n detail: dep.detail,\n loc: dep.loc,\n source: this.env.contents,\n });\n }\n }\n\n private humanReadableFile(file: string) {\n let { appRoot } = this.config;\n if (!appRoot.endsWith(sep)) {\n appRoot += sep;\n }\n if (file.startsWith(appRoot)) {\n return file.slice(appRoot.length);\n }\n return file;\n }\n\n private handleComponentHelper(\n param: ASTv1.Node,\n impliedBecause?: { componentName: string; argumentName: string }\n ): ComponentResolution | ResolutionFail | null {\n let locator: ComponentLocator;\n switch (param.type) {\n case 'StringLiteral':\n locator = { type: 'literal', path: param.value };\n break;\n case 'PathExpression':\n locator = { type: 'path', path: param.original };\n break;\n case 'MustacheStatement':\n if (param.hash.pairs.length === 0 && param.params.length === 0) {\n return this.handleComponentHelper(param.path, impliedBecause);\n } else if (param.path.type === 'PathExpression' && param.path.original === 'component') {\n // safe because we will handle this inner `{{component ...}}` mustache on its own\n return null;\n } else {\n locator = { type: 'other' };\n }\n break;\n case 'TextNode':\n locator = { type: 'literal', path: param.chars };\n break;\n case 'SubExpression':\n if (param.path.type === 'PathExpression' && param.path.original === 'component') {\n // safe because we will handle this inner `(component ...)` subexpression on its own\n return null;\n }\n if (param.path.type === 'PathExpression' && param.path.original === 'ensure-safe-component') {\n // safe because we trust ensure-safe-component\n return null;\n }\n locator = { type: 'other' };\n break;\n default:\n locator = { type: 'other' };\n }\n\n if (locator.type === 'path' && this.scopeStack.safeComponentInScope(locator.path)) {\n return null;\n }\n\n return this.targetComponentHelper(locator, param.loc, impliedBecause);\n }\n\n private handleDynamicComponentArguments(\n componentName: string,\n argumentsAreComponents: string[],\n attributes: WalkerPath<ASTv1.AttrNode | ASTv1.HashPair>[]\n ) {\n for (let name of argumentsAreComponents) {\n let attr = attributes.find(attr => {\n if (attr.node.type === 'AttrNode') {\n return attr.node.name === '@' + name;\n } else {\n return attr.node.key === name;\n }\n });\n if (attr) {\n let resolution = this.handleComponentHelper(attr.node.value, {\n componentName,\n argumentName: name,\n });\n this.emit(attr, resolution, (node, newId) => {\n if (node.type === 'AttrNode') {\n node.value = this.env.syntax.builders.mustache(newId);\n } else {\n node.value = newId;\n }\n });\n }\n }\n }\n\n private get staticComponentsEnabled(): boolean {\n return this.config.options.staticComponents || Boolean(this.auditHandler);\n }\n\n private get staticHelpersEnabled(): boolean {\n return this.config.options.staticHelpers || Boolean(this.auditHandler);\n }\n\n private get staticModifiersEnabled(): boolean {\n return this.config.options.staticModifiers || Boolean(this.auditHandler);\n }\n\n private isIgnoredComponent(dasherizedName: string) {\n return this.rules.components.get(dasherizedName)?.safeToIgnore;\n }\n\n @Memoize()\n private get rules() {\n // rules that are keyed by the filename they're talking about\n let files: Map<string, PreprocessedComponentRule> = new Map();\n\n // rules that are keyed by our dasherized interpretation of the component's name\n let components: Map<string, PreprocessedComponentRule> = new Map();\n\n // we're not responsible for filtering out rules for inactive packages here,\n // that is done before getting to us. So we should assume these are all in\n // force.\n for (let rule of this.config.activePackageRules) {\n if (rule.components) {\n for (let [snippet, rules] of Object.entries(rule.components)) {\n let processedRules = preprocessComponentRule(rules);\n let dasherizedName = this.standardDasherize(snippet, rule);\n components.set(dasherizedName, processedRules);\n if (rules.layout) {\n for (let root of rule.roots) {\n if (rules.layout.addonPath) {\n files.set(join(root, rules.layout.addonPath), processedRules);\n }\n if (rules.layout.appPath) {\n files.set(join(root, rules.layout.appPath), processedRules);\n }\n }\n }\n }\n }\n if (rule.appTemplates) {\n for (let [path, templateRules] of Object.entries(rule.appTemplates)) {\n let processedRules = preprocessComponentRule(templateRules);\n for (let root of rule.roots) {\n files.set(join(appTreeRulesDir(root, this.moduleResolver), path), processedRules);\n }\n }\n }\n if (rule.addonTemplates) {\n for (let [path, templateRules] of Object.entries(rule.addonTemplates)) {\n let processedRules = preprocessComponentRule(templateRules);\n for (let root of rule.roots) {\n files.set(join(root, path), processedRules);\n }\n }\n }\n }\n return { files, components };\n }\n\n private findRules(absPath: string): PreprocessedComponentRule | undefined {\n // when babel is invoked by vite our filenames can have query params still\n // hanging off them. That would break rule matching.\n absPath = cleanUrl(absPath);\n\n let fileRules = this.rules.files.get(absPath);\n let componentRules: PreprocessedComponentRule | undefined;\n\n let componentName = this.moduleResolver.reverseComponentLookup(absPath);\n if (componentName) {\n componentRules = this.rules.components.get(componentName);\n }\n\n if (fileRules && componentRules) {\n return mergeWith(fileRules, componentRules, appendArrays);\n }\n\n return fileRules ?? componentRules;\n }\n\n private standardDasherize(snippet: string, rule: PackageRules | ModuleRules): string {\n let name = snippetToDasherizedName(snippet);\n if (name == null) {\n throw new Error(`unable to parse component snippet \"${snippet}\" from rule ${JSON.stringify(rule, null, 2)}`);\n }\n return name;\n }\n\n private targetComponent(name: string): ComponentResolution | null {\n if (!this.staticComponentsEnabled) {\n return null;\n }\n\n const builtIn = this.builtInsForEmberVersion[name];\n\n if (builtIn?.importableComponent) {\n let [importedName, specifier] = builtIn.importableComponent;\n return {\n type: 'component',\n specifier,\n importedName,\n yieldsComponents: [],\n yieldsArguments: [],\n argumentsAreComponents: [],\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n if (this.isIgnoredComponent(name)) {\n return null;\n }\n\n let componentRules = this.rules.components.get(name);\n return {\n type: 'component',\n specifier: `@embroider/virtual/components/${name}`,\n importedName: 'default',\n yieldsComponents: componentRules ? componentRules.yieldsSafeComponents : [],\n yieldsArguments: componentRules ? componentRules.yieldsArguments : [],\n argumentsAreComponents: componentRules ? componentRules.argumentsAreComponents : [],\n nameHint: this.nameHint(name),\n };\n }\n\n private targetComponentHelper(\n component: ComponentLocator,\n loc: Loc,\n impliedBecause?: { componentName: string; argumentName: string }\n ): ComponentResolution | ResolutionFail | null {\n if (!this.staticComponentsEnabled) {\n return null;\n }\n\n let message;\n if (impliedBecause) {\n message = `argument \"${impliedBecause.argumentName}\" to component \"${impliedBecause.componentName}\" is treated as a component, but the value you're passing is dynamic`;\n } else {\n message = `Unsafe dynamic component`;\n }\n\n if (component.type === 'other') {\n return {\n type: 'error',\n message,\n detail: `cannot statically analyze this expression`,\n loc,\n };\n }\n if (component.type === 'path') {\n let ownComponentRules = this.findRules(this.env.filename);\n if (ownComponentRules && ownComponentRules.safeInteriorPaths.includes(component.path)) {\n return null;\n }\n return {\n type: 'error',\n message,\n detail: component.path,\n loc,\n };\n }\n\n return this.targetComponent(component.path);\n }\n\n private targetHelper(path: string): HelperResolution | null {\n if (!this.staticHelpersEnabled) {\n return null;\n }\n\n // people are not allowed to override the built-in helpers with their own\n // globally-named helpers. It throws an error. So it's fine for us to\n // prioritize the builtIns here without bothering to resolve a user helper\n // of the same name.\n const builtIn = this.builtInsForEmberVersion[path];\n\n if (builtIn?.importableHelper) {\n let [importedName, specifier] = builtIn.importableHelper;\n return {\n type: 'helper',\n specifier,\n importedName,\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n\n return {\n type: 'helper',\n specifier: `@embroider/virtual/helpers/${path}`,\n importedName: 'default',\n nameHint: this.nameHint(path),\n };\n }\n\n private targetHelperOrComponent(\n path: string,\n loc: Loc,\n hasArgs: boolean\n ): ComponentResolution | HelperResolution | null {\n /*\n\n In earlier embroider versions we would do a bunch of module resolution right\n here inside the ast transform to try to resolve the ambiguity of this case\n and if we didn't find anything, leave the template unchanged. But that leads\n to both a lot of extra build-time expense (since we are attempting\n resolution for lots of things that may in fact be just some data and not a\n component invocation at all, and also since we are pre-resolving modules\n that will get resolved a second time by the final stage packager).\n\n Now, we're going to be less forgiving, because it streamlines the build for\n everyone who's not still using these *extremely* old patterns.\n\n The problematic case is:\n\n 1. In a non-strict template (because this whole resolver-transform.ts is a\n no-op on strict handlebars).\n\n 2. Have a mustache statement like: `{{something}}`, where `something` is:\n\n a. Not a variable in scope (for example, there's no preceeding line\n like `<Parent as |something|>`)\n b. Does not start with `@` because that must be an argument from outside this template.\n c. Does not contain a dot, like `some.thing` (because that case is classically\n never a global component resolution that we would need to handle)\n d. Does not start with `this` (this rule is mostly redundant with the previous rule,\n but even a standalone `this` is never a component invocation).\n e. Does not have any arguments. If there are argument like `{{something a=b}}`,\n there is still ambiguity between helper vs component, but there is no longer\n the possibility that this was just rendering some data.\n f. Does not take a block, like `{{#something}}{{/something}}` (because that is\n always a component, no ambiguity.)\n\n We can't tell if this problematic case is really:\n\n 1. A helper invocation with no arguments that is being directly rendered.\n Out-of-the-box, ember already generates [a lint\n error](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-curly-component-invocation.md)\n for this, although it tells you to whitelist your helper when IMO it\n should tell you to use an unambiguous syntax like `{{ (something) }}`\n instead.\n\n 2. A component invocation, which you could have written `<Something />`\n instead. Angle-bracket invocation has been available and easy-to-adopt\n for a very long time.\n\n 3. Property-this-fallback for `{{this.something}}`. Property-this-fallback\n is eliminated at Ember 4.0, so people have been heavily pushed to get\n it out of their addons.\n */\n\n // first, bail out on all the stuff we can obviously ignore\n if ((!this.staticHelpersEnabled && !this.staticComponentsEnabled) || this.isIgnoredComponent(path)) {\n return null;\n }\n\n let builtIn = this.builtInsForEmberVersion[path];\n\n if (builtIn?.importableComponent) {\n let [importedName, specifier] = builtIn.importableComponent;\n return {\n type: 'component',\n specifier,\n importedName,\n yieldsComponents: [],\n yieldsArguments: [],\n argumentsAreComponents: [],\n nameHint: importedName,\n };\n }\n\n if (builtIn?.importableHelper) {\n let [importedName, specifier] = builtIn.importableHelper;\n return {\n type: 'helper',\n specifier,\n importedName,\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n\n let ownComponentRules = this.findRules(this.env.filename);\n if (ownComponentRules?.disambiguate[path]) {\n switch (ownComponentRules.disambiguate[path]) {\n case 'component':\n return this.targetComponent(path);\n case 'helper':\n return this.targetHelper(path);\n case 'data':\n return null;\n }\n }\n\n if (!hasArgs && !path.includes('/') && !path.includes('@')) {\n // this is the case that could also be property-this-fallback. We're going\n // to force people to disambiguate, because letting a potential component\n // or helper invocation lurk inside every bit of data you render is not\n // ok.\n this.reportError({\n type: 'error',\n message: 'unsupported ambiguous syntax',\n detail: `\"{{${path}}}\" is ambiguous and could mean \"{{this.${path}}}\" or component \"<${capitalize(\n camelCase(path)\n )} />\" or helper \"{{ (${path}) }}\". Change it to one of those unambigous forms, or use a \"disambiguate\" packageRule to work around the problem if its in third-party code you cannot easily fix.`,\n loc,\n });\n return null;\n }\n\n // Above we already bailed out if both of these were disabled, so we know at\n // least one is turned on. If both aren't turned on, we're stuck, because we\n // can't even tell if this *is* a component vs a helper.\n if (!this.staticHelpersEnabled || !this.staticComponentsEnabled) {\n this.reportError({\n type: 'error',\n message: 'unsupported ambiguity between helper and component',\n detail: `this use of \"{{${path}}}\" could be helper \"{{ (${path}) }}\" or component \"<${capitalize(\n camelCase(path)\n )} />\", and your settings for staticHelpers and staticComponents do not agree. Either switch to one of the unambiguous forms, or make staticHelpers and staticComponents agree, or use a \"disambiguate\" packageRule to work around the problem if its in third-party code you cannot easily fix.`,\n loc,\n });\n return null;\n }\n\n let componentRules = this.rules.components.get(path);\n return {\n type: 'component',\n specifier: `@embroider/virtual/ambiguous/${path}`,\n importedName: 'default',\n yieldsComponents: componentRules ? componentRules.yieldsSafeComponents : [],\n yieldsArguments: componentRules ? componentRules.yieldsArguments : [],\n argumentsAreComponents: componentRules ? componentRules.argumentsAreComponents : [],\n nameHint: this.nameHint(path),\n };\n }\n\n private targetElementModifier(path: string): ModifierResolution | null {\n if (!this.staticModifiersEnabled) {\n return null;\n }\n\n const builtIn = this.builtInsForEmberVersion[path];\n if (builtIn?.importableModifier) {\n let [importedName, specifier] = builtIn.importableModifier;\n return {\n type: 'modifier',\n specifier,\n importedName,\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n\n return {\n type: 'modifier',\n specifier: `@embroider/virtual/modifiers/${path}`,\n importedName: 'default',\n nameHint: this.nameHint(path),\n };\n }\n\n targetDynamicModifier(modifier: ComponentLocator, loc: Loc): ModifierResolution | ResolutionFail | null {\n if (!this.staticModifiersEnabled) {\n return null;\n }\n\n if (modifier.type === 'literal') {\n return this.targetElementModifier(modifier.path);\n } else {\n return {\n type: 'error',\n message: 'Unsafe dynamic modifier',\n detail: `cannot statically analyze this expression`,\n loc,\n };\n }\n }\n\n private targetDynamicHelper(helper: ComponentLocator): HelperResolution | null {\n if (!this.staticHelpersEnabled) {\n return null;\n }\n\n if (helper.type === 'literal') {\n return this.targetHelper(helper.path);\n }\n\n // we don't have to manage any errors in this case because ember itself\n // considers it an error to pass anything but a string literal to the\n // `helper` helper.\n return null;\n }\n\n private nameHint(path: string) {\n let parts = path.split('@');\n\n // the extra underscore here guarantees that we will never collide with an\n // HTML element.\n return this.externalNameHint?.(path) ?? parts[parts.length - 1] + '_';\n }\n\n private handleDynamicModifier(param: ASTv1.Expression): ModifierResolution | ResolutionFail | null {\n if (param.type === 'StringLiteral') {\n return this.targetDynamicModifier({ type: 'literal', path: param.value }, param.loc);\n }\n // we don't have to manage any errors in this case because ember itself\n // considers it an error to pass anything but a string literal to the\n // modifier helper.\n return null;\n }\n\n private handleDynamicHelper(param: ASTv1.Expression): HelperResolution | ResolutionFail | null {\n // We only need to handle StringLiterals since Ember already throws an error if unsupported values\n // are passed to the helper keyword.\n // If a helper reference is passed in we don't need to do anything since it's either the result of a previous\n // helper keyword invocation, or a helper reference that was imported somewhere.\n if (param.type === 'StringLiteral') {\n return this.targetDynamicHelper({ type: 'literal', path: param.value });\n }\n return null;\n }\n\n visitor: ASTPlugin['visitor'] = {\n Template: {\n enter: () => {\n if (this.env.locals) {\n this.scopeStack.pushMustacheBlock(this.env.locals);\n }\n },\n exit: () => {\n if (this.env.locals) {\n this.scopeStack.pop();\n }\n },\n },\n Block: {\n enter: node => {\n this.scopeStack.pushMustacheBlock(node.blockParams);\n },\n exit: () => {\n this.scopeStack.pop();\n },\n },\n BlockStatement: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n let rootName = headOf(node.path);\n if (this.scopeStack.inScope(rootName, path)) {\n return;\n }\n if (isThisHead(node.path)) {\n return;\n }\n if (parts(node.path).length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components, which means there's nothing to resolve at this\n // location.\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n let resolution = this.handleComponentHelper(node.params[0]);\n this.emit(path, resolution, (node, newIdentifier) => {\n node.params[0] = newIdentifier;\n });\n return;\n }\n let resolution = this.targetComponent(node.path.original);\n this.emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n if (resolution?.type === 'component') {\n this.scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n this.handleDynamicComponentArguments(\n rootName,\n argumentsAreComponents,\n extendPath(extendPath(path, 'hash'), 'pairs')\n );\n });\n }\n },\n SubExpression: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (isThisHead(node.path)) {\n return;\n }\n if (this.scopeStack.inScope(headOf(node.path), path)) {\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n let resolution = this.handleComponentHelper(node.params[0]);\n this.emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.original === 'helper' && node.params.length > 0) {\n let resolution = this.handleDynamicHelper(node.params[0]);\n this.emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.original === 'modifier' && node.params.length > 0) {\n let resolution = this.handleDynamicModifier(node.params[0]);\n this.emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.tail.length === 0 && node.path.head.type === 'VarHead') {\n let resolution = this.targetHelper(node.path.original);\n this.emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n }\n },\n MustacheStatement: {\n enter: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n let rootName = headOf(node.path);\n if (this.scopeStack.inScope(rootName, path)) {\n return;\n }\n if (isThisHead(node.path)) {\n return;\n }\n if (parts(node.path).length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components, which means there's nothing to resolve at this\n // location.\n return;\n }\n if (node.path.original.startsWith('@')) {\n // similarly, global resolution of helpers and components never\n // happens with argument paths (it could still be an invocation, but\n // it would be a lexically-scoped invocation, not one we need to\n // adjust)\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n let resolution = this.handleComponentHelper(node.params[0]);\n this.emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.original === 'helper' && node.params.length > 0) {\n let resolution = this.handleDynamicHelper(node.params[0]);\n this.emit(path, resolution, (node, newIdentifier) => {\n node.params[0] = newIdentifier;\n });\n return;\n }\n if (path.parent?.node.type === 'AttrNode') {\n // this mustache is the value of an attribute. Components aren't\n // allowed here, so we're not ambiguous, so resolve a helper.\n let resolution = this.targetHelper(node.path.original);\n this.emit(path, resolution, (node, newIdentifier) => {\n node.path = newIdentifier;\n });\n return;\n }\n let hasArgs = node.params.length > 0 || node.hash.pairs.length > 0;\n let resolution = this.targetHelperOrComponent(node.path.original, node.path.loc, hasArgs);\n this.emit(path, resolution, (node, newIdentifier) => {\n node.path = newIdentifier;\n });\n if (resolution?.type === 'component') {\n this.handleDynamicComponentArguments(\n node.path.original,\n resolution.argumentsAreComponents,\n extendPath(extendPath(path, 'hash'), 'pairs')\n );\n }\n },\n },\n ElementModifierStatement: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (this.scopeStack.inScope(headOf(node.path), path)) {\n return;\n }\n if (isThisHead(node.path)) {\n return;\n }\n if (isAtHead(node.path)) {\n return;\n }\n if (parts(node.path).length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components. With the introduction of `Template strict mode` in Ember 3.25\n // it is also possible to pass modifiers this way which means there's nothing\n // to resolve at this location.\n return;\n }\n\n let resolution = this.targetElementModifier(node.path.original);\n this.emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n },\n ElementNode: {\n enter: (node, path) => {\n let rootName = node.tag.split('.')[0];\n if (!this.scopeStack.inScope(rootName, path)) {\n let resolution: ComponentResolution | null = null;\n\n // if it starts with lower case, it can't be a component we need to\n // globally resolve\n if (node.tag[0] !== node.tag[0].toLowerCase()) {\n resolution = this.targetComponent(dasherize(node.tag));\n }\n\n this.emit(path, resolution, (node, newId) => {\n node.tag = newId.original;\n });\n if (resolution?.type === 'component') {\n this.scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n this.handleDynamicComponentArguments(node.tag, argumentsAreComponents, extendPath(path, 'attributes'));\n });\n }\n }\n this.scopeStack.pushElementBlock(node.blockParams, node);\n },\n exit: () => {\n this.scopeStack.pop();\n },\n },\n };\n}\n\n// This is the AST transform that resolves components, helpers and modifiers at build time\nexport default function makeResolverTransform({ appRoot, emberVersion, externalNameHint }: Options) {\n let loader = new ResolverLoader(appRoot);\n let config = loader.resolver.options as CompatResolverOptions;\n const resolverTransform: ASTPluginBuilder<Env> = env => {\n if (env.strictMode) {\n return {\n name: 'embroider-build-time-resolver-strict-noop',\n visitor: {},\n };\n }\n return new TemplateResolver(env, config, builtInKeywords(emberVersion), externalNameHint);\n };\n (resolverTransform as any).parallelBabel = {\n requireFile: __filename,\n buildUsing: 'makeResolverTransform',\n params: { appRoot: appRoot },\n };\n return resolverTransform;\n}\n\ninterface ComponentBlockMarker {\n type: 'componentBlockMarker';\n resolution: ComponentResolution;\n argumentsAreComponents: string[];\n exit: (marker: ComponentBlockMarker) => void;\n}\n\ntype ScopeEntry =\n | { type: 'mustache'; blockParams: string[] }\n | { type: 'element'; blockParams: string[]; childrenOf: ASTv1.ElementNode }\n | ComponentBlockMarker;\n\nclass ScopeStack {\n private stack: ScopeEntry[] = [];\n\n // mustache blocks like:\n //\n // {{#stuff as |some block vars|}}\n //\n // are relatively simple for us because there's a dedicated `Block` AST node\n // that exactly covers the range in which the variables are in scope.\n pushMustacheBlock(blockParams: string[]) {\n this.stack.unshift({ type: 'mustache', blockParams });\n }\n\n // element blocks like:\n //\n // <Stuff as |some block vars|>\n //\n // are *not* so simple for us because there's no single AST node that exactly\n // covers the range in which the variables are in scope. For example, the\n // *attributes* of the element do not see the variables, but the children of\n // the element do.\n pushElementBlock(blockParams: string[], childrenOf: ASTv1.ElementNode) {\n this.stack.unshift({ type: 'element', blockParams, childrenOf });\n }\n\n // and when we leave the block they go out of scope. If this block was tagged\n // by a safe component marker, we also clear that.\n pop() {\n this.stack.shift();\n let next = this.stack[0];\n if (next && next.type === 'componentBlockMarker') {\n next.exit(next);\n this.stack.shift();\n }\n }\n\n // right before we enter a block, we might determine that some of the values\n // that will be yielded as marked (by a rule) as safe to be used with the\n // {{component}} helper.\n enteringComponentBlock(resolution: ComponentResolution, exit: ComponentBlockMarker['exit']) {\n this.stack.unshift({\n type: 'componentBlockMarker',\n resolution,\n argumentsAreComponents: resolution.argumentsAreComponents.slice(),\n exit,\n });\n }\n\n inScope(name: string, fromPath: WalkerPath<ASTv1.Node>) {\n for (let scope of this.stack) {\n if (scope.type === 'mustache' && scope.blockParams.includes(name)) {\n return true;\n }\n if (\n scope.type === 'element' &&\n scope.blockParams.includes(name) &&\n withinElementBlock(fromPath, scope.childrenOf)\n ) {\n return true;\n }\n }\n return false;\n }\n\n safeComponentInScope(name: string): boolean {\n let parts = name.split('.');\n if (parts.length > 2) {\n // we let component rules specify that they yield components or objects\n // containing components. But not deeper than that. So the max path length\n // that can refer to a marked-safe component is two segments.\n return false;\n }\n for (let i = 0; i < this.stack.length - 1; i++) {\n let here = this.stack[i];\n let next = this.stack[i + 1];\n if ((here.type === 'mustache' || here.type === 'element') && next.type === 'componentBlockMarker') {\n let positionalIndex = here.blockParams.indexOf(parts[0]);\n if (positionalIndex === -1) {\n continue;\n }\n\n if (parts.length === 1) {\n if (next.resolution.yieldsComponents[positionalIndex] === true) {\n return true;\n }\n let sourceArg = next.resolution.yieldsArguments[positionalIndex];\n if (typeof sourceArg === 'string') {\n next.argumentsAreComponents.push(sourceArg);\n return true;\n }\n } else {\n let entry = next.resolution.yieldsComponents[positionalIndex];\n if (entry && typeof entry === 'object') {\n return entry[parts[1]] === true;\n }\n\n let argsEntry = next.resolution.yieldsArguments[positionalIndex];\n if (argsEntry && typeof argsEntry === 'object') {\n let sourceArg = argsEntry[parts[1]];\n if (typeof sourceArg === 'string') {\n next.argumentsAreComponents.push(sourceArg);\n return true;\n }\n }\n }\n // we found the source of the name, but there were no rules to cover it.\n // Don't keep searching higher, those are different names.\n return false;\n }\n }\n return false;\n }\n}\n\nfunction extendPath<N extends ASTv1.Node, K extends keyof N>(\n path: WalkerPath<N>,\n key: K\n): N[K] extends ASTv1.Node ? WalkerPath<N[K]> : N[K] extends ASTv1.Node[] ? WalkerPath<N[K][0]>[] : never {\n const _WalkerPath = path.constructor as {\n new <Child extends ASTv1.Node>(\n node: Child,\n parent?: WalkerPath<ASTv1.Node> | null,\n parentKey?: string | null\n ): WalkerPath<Child>;\n };\n let child = path.node[key];\n if (Array.isArray(child)) {\n return child.map(c => new _WalkerPath(c, path, key as string)) as any;\n } else {\n return new _WalkerPath(child as any, path, key as string) as any;\n }\n}\n\nfunction capitalize(word: string): string {\n return word[0].toUpperCase() + word.slice(1);\n}\n\n// ElementNodes have both children and attributes and both of those are\n// \"children\" in the abstract syntax tree sense, but here we want to distinguish\n// between them.\nfunction withinElementBlock(childPath: WalkerPath<ASTv1.Node>, ancestorNode: ASTv1.ElementNode): Boolean {\n let cursor: WalkerPath<ASTv1.Node> | null = childPath;\n while (cursor && cursor.node !== ancestorNode) {\n if (ancestorNode.children.includes(cursor.node as ASTv1.Statement)) {\n return true;\n }\n cursor = cursor.parent;\n }\n return false;\n}\nfunction appendArrays(objValue: any, srcValue: any) {\n if (Array.isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n}\n\nfunction headOf(path: any) {\n if (!path) return;\n\n return 'head' in path ? path.head.name : path.parts[0];\n}\n\nfunction isThisHead(path: any) {\n if (!path) return;\n\n if ('head' in path) {\n return path.head.type === 'ThisHead';\n }\n\n return path.this === true;\n}\n\nfunction isAtHead(path: any) {\n if (!path) return;\n\n if ('head' in path) {\n return path.head.type === 'AtHead';\n }\n\n return path.data === true;\n}\n\nfunction parts(path: any) {\n if (!path) return;\n\n return 'original' in path ? path.original.split('.') : path.parts;\n}\n"]}
1
+ {"version":3,"file":"resolver-transform.js","sourceRoot":"","sources":["resolver-transform.ts"],"names":[],"mappings":";;;;;;;;;;;AAq/BA,wCAkBC;AA//BD,yDAA8E;AAC9E,2DAA6C;AAE7C,gEAAuC;AACvC,+BAAiC;AACjC,yEAAgF;AAEhF,0CAAqE;AAGrE,mCAA8C;AAC9C,mCAAmC;AAsCnC,SAAS,eAAe,CAAC,YAAoB;IAC3C,MAAM,eAAe,GAAwC;QAC3D,kBAAkB,EAAE,EAAE;QACtB,aAAa,EAAE,EAAE;QACjB,oBAAoB,EAAE,EAAE;QACxB,MAAM,EAAE,EAAE;QACV,KAAK,EAAE;YACL,gBAAgB,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC;SAC7C;QACD,SAAS,EAAE,EAAE;QACb,MAAM,EAAE;YACN,gBAAgB,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC;SAC9C;QACD,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;QACb,IAAI,EAAE,EAAE;QACR,EAAE,EAAE;YACF,gBAAgB,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC;SAC1C;QACD,GAAG,EAAE;YACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC;SAC3C;QACD,kBAAkB,EAAE,EAAE;QACtB,WAAW,EAAE,EAAE;QACf,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE,EAAE;QAClB,IAAI,EAAE;YACJ,gBAAgB,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC;S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AU,CAAC,IAAS;IAC3B,IAAI,CAAC,IAAI;QAAE,OAAO;IAElB,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC;IACvC,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;AAC5B,CAAC;AAED,SAAS,QAAQ,CAAC,IAAS;IACzB,IAAI,CAAC,IAAI;QAAE,OAAO;IAElB,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;IACrC,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;AAC5B,CAAC;AAED,SAAS,KAAK,CAAC,IAAS;IACtB,IAAI,CAAC,IAAI;QAAE,OAAO;IAElB,OAAO,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AACpE,CAAC;AAED,SAAS,kBAAkB,CAAC,OAA4E;IACtG,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,yBAAyB,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC5E,IAAI,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IAC1D,OAAO;qBACY,MAAM;;sBAEL,QAAQ;;;;;;GAM3B,CAAC;AACJ,CAAC","sourcesContent":["import type { ASTv1, ASTPlugin, ASTPluginBuilder, ASTPluginEnvironment, WalkerPath } from '@glimmer/syntax';\nimport type {\n PreprocessedComponentRule,\n ActivePackageRules,\n ComponentRules,\n PackageRules,\n ModuleRules,\n} from './dependency-rules';\nimport { preprocessComponentRule, appTreeRulesDir } from './dependency-rules';\nimport { Memoize } from 'typescript-memoize';\nimport type { WithJSUtils } from 'babel-plugin-ember-template-compilation';\nimport assertNever from 'assert-never';\nimport { join, sep } from 'path';\nimport { dasherize, snippetToDasherizedName } from './dasherize-component-name';\nimport type { ResolverOptions as CoreResolverOptions } from '@embroider/core';\nimport { Resolver, ResolverLoader, cleanUrl } from '@embroider/core';\nimport type CompatOptions from './options';\nimport type { AuditMessage, Loc } from './audit';\nimport { camelCase, mergeWith } from 'lodash';\nimport { satisfies } from 'semver';\n\ntype Env = WithJSUtils<ASTPluginEnvironment> & {\n filename: string;\n contents: string;\n strictMode?: boolean;\n locals?: string[];\n};\n\n// this is a subset of the full Options. We care about serializability, and we\n// only needs parts that are easily serializable, which is why we don't keep the\n// whole thing.\ntype UserConfig = Pick<\n Required<CompatOptions>,\n 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'allowUnsafeDynamicComponents'\n>;\n\nexport interface CompatResolverOptions extends CoreResolverOptions {\n activePackageRules: ActivePackageRules[];\n options: UserConfig;\n}\n\nexport interface ExternalNameHint {\n (path: string): string | null;\n}\n\nexport interface Options {\n appRoot: string;\n emberVersion: string;\n externalNameHint?: ExternalNameHint;\n}\n\ntype BuiltIn = {\n importableHelper?: [string, string];\n importableComponent?: [string, string];\n importableModifier?: [string, string];\n};\n\nfunction builtInKeywords(emberVersion: string): Record<string, BuiltIn | undefined> {\n const builtInKeywords: Record<string, BuiltIn | undefined> = {\n '-get-dynamic-var': {},\n '-in-element': {},\n '-with-dynamic-vars': {},\n action: {},\n array: {\n importableHelper: ['array', '@ember/helper'],\n },\n component: {},\n concat: {\n importableHelper: ['concat', '@ember/helper'],\n },\n debugger: {},\n 'each-in': {},\n each: {},\n fn: {\n importableHelper: ['fn', '@ember/helper'],\n },\n get: {\n importableHelper: ['get', '@ember/helper'],\n },\n 'has-block-params': {},\n 'has-block': {},\n hasBlock: {},\n hasBlockParams: {},\n hash: {\n importableHelper: ['hash', '@ember/helper'],\n },\n helper: {},\n if: {},\n 'in-element': {},\n input: {\n importableComponent: ['Input', '@ember/component'],\n },\n let: {},\n 'link-to': {\n importableComponent: ['LinkTo', '@ember/routing'],\n },\n loc: {},\n log: {},\n modifier: {},\n mount: {},\n mut: {},\n on: {\n importableModifier: ['on', '@ember/modifier'],\n },\n outlet: {},\n partial: {},\n 'query-params': {},\n readonly: {},\n textarea: {\n importableComponent: ['Textarea', '@ember/component'],\n },\n unbound: {},\n 'unique-id': {},\n unless: {},\n with: {},\n yield: {},\n };\n if (satisfies(emberVersion, '>=5.2')) {\n builtInKeywords['unique-id'] = {\n importableHelper: ['uniqueId', '@ember/helper'],\n };\n }\n return builtInKeywords;\n}\n\ninterface ComponentResolution {\n type: 'component';\n specifier: string;\n importedName: string;\n yieldsComponents: Required<ComponentRules>['yieldsSafeComponents'];\n yieldsArguments: Required<ComponentRules>['yieldsArguments'];\n argumentsAreComponents: string[];\n nameHint: string;\n}\n\ntype HelperResolution = {\n type: 'helper';\n nameHint: string;\n specifier: string;\n importedName: string;\n};\n\ntype ModifierResolution = {\n type: 'modifier';\n specifier: string;\n importedName: string;\n nameHint: string;\n};\n\ntype ResolutionResult = ComponentResolution | HelperResolution | ModifierResolution;\n\ninterface ResolutionFail {\n type: 'error';\n message: string;\n detail: string;\n loc: Loc;\n}\n\ntype Resolution = ResolutionResult | ResolutionFail;\n\ntype ComponentLocator =\n | {\n type: 'literal';\n path: string;\n }\n | {\n type: 'path';\n path: string;\n }\n | {\n type: 'other';\n };\n\nclass TemplateResolver implements ASTPlugin {\n readonly name = 'embroider-build-time-resolver';\n\n private auditHandler: undefined | ((msg: AuditMessage) => void);\n private scopeStack = new ScopeStack();\n\n private moduleResolver: Resolver;\n\n constructor(\n private env: Env,\n private config: CompatResolverOptions,\n private builtInsForEmberVersion: ReturnType<typeof builtInKeywords>,\n private externalNameHint?: ExternalNameHint\n ) {\n this.moduleResolver = new Resolver(config);\n if ((globalThis as any).embroider_audit) {\n this.auditHandler = (globalThis as any).embroider_audit;\n }\n }\n\n private emit<Target extends WalkerPath<ASTv1.Node>>(\n parentPath: Target,\n resolution: Resolution | null,\n setter: (target: Target['node'], newIdentifier: ASTv1.PathExpression) => void\n ) {\n switch (resolution?.type) {\n case 'error':\n this.reportError(resolution);\n return;\n case 'component':\n case 'modifier':\n case 'helper': {\n let name = this.env.meta.jsutils.bindImport(resolution.specifier, resolution.importedName, parentPath, {\n nameHint: resolution.nameHint,\n });\n setter(parentPath.node, this.env.syntax.builders.path(name));\n return;\n }\n case undefined:\n return;\n default:\n assertNever(resolution);\n }\n }\n\n private reportError(dep: ResolutionFail) {\n if (!this.auditHandler && !this.config.options.allowUnsafeDynamicComponents) {\n let e: any = new Error(`${dep.message}: ${dep.detail} in ${this.humanReadableFile(this.env.filename)}`);\n e.isTemplateResolverError = true;\n e.loc = dep.loc;\n e.moduleName = this.env.filename;\n throw e;\n }\n if (this.auditHandler) {\n this.auditHandler({\n message: dep.message,\n filename: this.env.filename,\n detail: dep.detail,\n loc: dep.loc,\n source: this.env.contents,\n });\n }\n }\n\n private humanReadableFile(file: string) {\n let { appRoot } = this.config;\n if (!appRoot.endsWith(sep)) {\n appRoot += sep;\n }\n if (file.startsWith(appRoot)) {\n return file.slice(appRoot.length);\n }\n return file;\n }\n\n private handleComponentHelper(\n param: ASTv1.Node,\n impliedBecause?: { componentName: string; argumentName: string }\n ): ComponentResolution | ResolutionFail | null {\n let locator: ComponentLocator;\n switch (param.type) {\n case 'StringLiteral':\n locator = { type: 'literal', path: param.value };\n break;\n case 'PathExpression':\n locator = { type: 'path', path: param.original };\n break;\n case 'MustacheStatement':\n if (param.hash.pairs.length === 0 && param.params.length === 0) {\n return this.handleComponentHelper(param.path, impliedBecause);\n } else if (param.path.type === 'PathExpression' && param.path.original === 'component') {\n // safe because we will handle this inner `{{component ...}}` mustache on its own\n return null;\n } else {\n locator = { type: 'other' };\n }\n break;\n case 'TextNode':\n locator = { type: 'literal', path: param.chars };\n break;\n case 'SubExpression':\n if (param.path.type === 'PathExpression' && param.path.original === 'component') {\n // safe because we will handle this inner `(component ...)` subexpression on its own\n return null;\n }\n if (param.path.type === 'PathExpression' && param.path.original === 'ensure-safe-component') {\n // safe because we trust ensure-safe-component\n return null;\n }\n locator = { type: 'other' };\n break;\n default:\n locator = { type: 'other' };\n }\n\n if (locator.type === 'path' && this.scopeStack.safeComponentInScope(locator.path)) {\n return null;\n }\n\n return this.targetComponentHelper(locator, param.loc, impliedBecause);\n }\n\n private handleDynamicComponentArguments(\n componentName: string,\n argumentsAreComponents: string[],\n attributes: WalkerPath<ASTv1.AttrNode | ASTv1.HashPair>[]\n ) {\n for (let name of argumentsAreComponents) {\n let attr = attributes.find(attr => {\n if (attr.node.type === 'AttrNode') {\n return attr.node.name === '@' + name;\n } else {\n return attr.node.key === name;\n }\n });\n if (attr) {\n let resolution = this.handleComponentHelper(attr.node.value, {\n componentName,\n argumentName: name,\n });\n this.emit(attr, resolution, (node, newId) => {\n if (node.type === 'AttrNode') {\n node.value = this.env.syntax.builders.mustache(newId);\n } else {\n node.value = newId;\n }\n });\n }\n }\n }\n\n private get staticComponentsEnabled(): boolean {\n return this.config.options.staticComponents || Boolean(this.auditHandler);\n }\n\n private get staticHelpersEnabled(): boolean {\n return this.config.options.staticHelpers || Boolean(this.auditHandler);\n }\n\n private get staticModifiersEnabled(): boolean {\n return this.config.options.staticModifiers || Boolean(this.auditHandler);\n }\n\n private isIgnoredComponent(dasherizedName: string) {\n return this.rules.components.get(dasherizedName)?.safeToIgnore;\n }\n\n @Memoize()\n private get rules() {\n // rules that are keyed by the filename they're talking about\n let files: Map<string, PreprocessedComponentRule> = new Map();\n\n // rules that are keyed by our dasherized interpretation of the component's name\n let components: Map<string, PreprocessedComponentRule> = new Map();\n\n // we're not responsible for filtering out rules for inactive packages here,\n // that is done before getting to us. So we should assume these are all in\n // force.\n for (let rule of this.config.activePackageRules) {\n if (rule.components) {\n for (let [snippet, rules] of Object.entries(rule.components)) {\n let processedRules = preprocessComponentRule(rules);\n let dasherizedName = this.standardDasherize(snippet, rule);\n components.set(dasherizedName, processedRules);\n if (rules.layout) {\n for (let root of rule.roots) {\n if (rules.layout.addonPath) {\n files.set(join(root, rules.layout.addonPath), processedRules);\n }\n if (rules.layout.appPath) {\n files.set(join(root, rules.layout.appPath), processedRules);\n }\n }\n }\n }\n }\n if (rule.appTemplates) {\n for (let [path, templateRules] of Object.entries(rule.appTemplates)) {\n let processedRules = preprocessComponentRule(templateRules);\n for (let root of rule.roots) {\n files.set(join(appTreeRulesDir(root, this.moduleResolver), path), processedRules);\n }\n }\n }\n if (rule.addonTemplates) {\n for (let [path, templateRules] of Object.entries(rule.addonTemplates)) {\n let processedRules = preprocessComponentRule(templateRules);\n for (let root of rule.roots) {\n files.set(join(root, path), processedRules);\n }\n }\n }\n }\n return { files, components };\n }\n\n private findRules(absPath: string): PreprocessedComponentRule | undefined {\n // when babel is invoked by vite our filenames can have query params still\n // hanging off them. That would break rule matching.\n absPath = cleanUrl(absPath);\n\n let fileRules = this.rules.files.get(absPath);\n let componentRules: PreprocessedComponentRule | undefined;\n\n let componentName = this.moduleResolver.reverseComponentLookup(absPath);\n if (componentName) {\n componentRules = this.rules.components.get(componentName);\n }\n\n if (fileRules && componentRules) {\n return mergeWith(fileRules, componentRules, appendArrays);\n }\n\n return fileRules ?? componentRules;\n }\n\n private standardDasherize(snippet: string, rule: PackageRules | ModuleRules): string {\n let name = snippetToDasherizedName(snippet);\n if (name == null) {\n throw new Error(`unable to parse component snippet \"${snippet}\" from rule ${JSON.stringify(rule, null, 2)}`);\n }\n return name;\n }\n\n private targetComponent(name: string): ComponentResolution | null {\n if (!this.staticComponentsEnabled) {\n return null;\n }\n\n const builtIn = this.builtInsForEmberVersion[name];\n\n if (builtIn?.importableComponent) {\n let [importedName, specifier] = builtIn.importableComponent;\n return {\n type: 'component',\n specifier,\n importedName,\n yieldsComponents: [],\n yieldsArguments: [],\n argumentsAreComponents: [],\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n if (this.isIgnoredComponent(name)) {\n return null;\n }\n\n let componentRules = this.rules.components.get(name);\n return {\n type: 'component',\n specifier: `@embroider/virtual/components/${name}`,\n importedName: 'default',\n yieldsComponents: componentRules ? componentRules.yieldsSafeComponents : [],\n yieldsArguments: componentRules ? componentRules.yieldsArguments : [],\n argumentsAreComponents: componentRules ? componentRules.argumentsAreComponents : [],\n nameHint: this.nameHint(name),\n };\n }\n\n private targetComponentHelper(\n component: ComponentLocator,\n loc: Loc,\n impliedBecause?: { componentName: string; argumentName: string }\n ): ComponentResolution | ResolutionFail | null {\n if (!this.staticComponentsEnabled) {\n return null;\n }\n\n let message;\n if (impliedBecause) {\n message = `argument \"${impliedBecause.argumentName}\" to component \"${impliedBecause.componentName}\" is treated as a component, but the value you're passing is dynamic`;\n } else {\n message = `Unsafe dynamic component`;\n }\n\n if (component.type === 'other') {\n return {\n type: 'error',\n message,\n detail: `cannot statically analyze this expression`,\n loc,\n };\n }\n if (component.type === 'path') {\n if (this.ownRules?.safeInteriorPaths.includes(component.path)) {\n return null;\n }\n return {\n type: 'error',\n message,\n detail: component.path,\n loc,\n };\n }\n\n return this.targetComponent(component.path);\n }\n\n private targetHelper(path: string): HelperResolution | null {\n if (!this.staticHelpersEnabled) {\n return null;\n }\n\n // people are not allowed to override the built-in helpers with their own\n // globally-named helpers. It throws an error. So it's fine for us to\n // prioritize the builtIns here without bothering to resolve a user helper\n // of the same name.\n const builtIn = this.builtInsForEmberVersion[path];\n\n if (builtIn?.importableHelper) {\n let [importedName, specifier] = builtIn.importableHelper;\n return {\n type: 'helper',\n specifier,\n importedName,\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n\n return {\n type: 'helper',\n specifier: `@embroider/virtual/helpers/${path}`,\n importedName: 'default',\n nameHint: this.nameHint(path),\n };\n }\n\n private targetHelperOrComponent(\n path: string,\n loc: Loc,\n hasArgs: boolean\n ): ComponentResolution | HelperResolution | null {\n /*\n\n In earlier embroider versions we would do a bunch of module resolution right\n here inside the ast transform to try to resolve the ambiguity of this case\n and if we didn't find anything, leave the template unchanged. But that leads\n to both a lot of extra build-time expense (since we are attempting\n resolution for lots of things that may in fact be just some data and not a\n component invocation at all, and also since we are pre-resolving modules\n that will get resolved a second time by the final stage packager).\n\n Now, we're going to be less forgiving, because it streamlines the build for\n everyone who's not still using these *extremely* old patterns.\n\n The problematic case is:\n\n 1. In a non-strict template (because this whole resolver-transform.ts is a\n no-op on strict handlebars).\n\n 2. Have a mustache statement like: `{{something}}`, where `something` is:\n\n a. Not a variable in scope (for example, there's no preceeding line\n like `<Parent as |something|>`)\n b. Does not start with `@` because that must be an argument from outside this template.\n c. Does not contain a dot, like `some.thing` (because that case is classically\n never a global component resolution that we would need to handle)\n d. Does not start with `this` (this rule is mostly redundant with the previous rule,\n but even a standalone `this` is never a component invocation).\n e. Does not have any arguments. If there are argument like `{{something a=b}}`,\n there is still ambiguity between helper vs component, but there is no longer\n the possibility that this was just rendering some data.\n f. Does not take a block, like `{{#something}}{{/something}}` (because that is\n always a component, no ambiguity.)\n\n We can't tell if this problematic case is really:\n\n 1. A helper invocation with no arguments that is being directly rendered.\n Out-of-the-box, ember already generates [a lint\n error](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-curly-component-invocation.md)\n for this, although it tells you to whitelist your helper when IMO it\n should tell you to use an unambiguous syntax like `{{ (something) }}`\n instead.\n\n 2. A component invocation, which you could have written `<Something />`\n instead. Angle-bracket invocation has been available and easy-to-adopt\n for a very long time.\n\n 3. Property-this-fallback for `{{this.something}}`. Property-this-fallback\n is eliminated at Ember 4.0, so people have been heavily pushed to get\n it out of their addons.\n */\n\n // first, bail out on all the stuff we can obviously ignore\n if ((!this.staticHelpersEnabled && !this.staticComponentsEnabled) || this.isIgnoredComponent(path)) {\n return null;\n }\n\n let builtIn = this.builtInsForEmberVersion[path];\n\n if (builtIn?.importableComponent) {\n let [importedName, specifier] = builtIn.importableComponent;\n return {\n type: 'component',\n specifier,\n importedName,\n yieldsComponents: [],\n yieldsArguments: [],\n argumentsAreComponents: [],\n nameHint: importedName,\n };\n }\n\n if (builtIn?.importableHelper) {\n let [importedName, specifier] = builtIn.importableHelper;\n return {\n type: 'helper',\n specifier,\n importedName,\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n\n let ownComponentRules = this.findRules(this.env.filename);\n if (ownComponentRules?.disambiguate[path]) {\n switch (ownComponentRules.disambiguate[path]) {\n case 'component':\n return this.targetComponent(path);\n case 'helper':\n return this.targetHelper(path);\n case 'data':\n return null;\n }\n }\n\n if (!hasArgs && !path.includes('/') && !path.includes('@')) {\n // this is the case that could also be property-this-fallback. We're going\n // to force people to disambiguate, because letting a potential component\n // or helper invocation lurk inside every bit of data you render is not\n // ok.\n this.reportError({\n type: 'error',\n message: 'unsupported ambiguous syntax',\n detail: `\"{{${path}}}\" is ambiguous and could mean \"{{this.${path}}}\" or component \"<${capitalize(\n camelCase(path)\n )} />\" or helper \"{{ (${path}) }}\". Change it to one of those unambigous forms, or use a \"disambiguate\" packageRule to work around the problem if its in third-party code you cannot easily fix.`,\n loc,\n });\n return null;\n }\n\n // Above we already bailed out if both of these were disabled, so we know at\n // least one is turned on. If both aren't turned on, we're stuck, because we\n // can't even tell if this *is* a component vs a helper.\n if (!this.staticHelpersEnabled || !this.staticComponentsEnabled) {\n this.reportError({\n type: 'error',\n message: 'unsupported ambiguity between helper and component',\n detail: `this use of \"{{${path}}}\" could be helper \"{{ (${path}) }}\" or component \"<${capitalize(\n camelCase(path)\n )} />\", and your settings for staticHelpers and staticComponents do not agree. Either switch to one of the unambiguous forms, or make staticHelpers and staticComponents agree, or use a \"disambiguate\" packageRule to work around the problem if its in third-party code you cannot easily fix.`,\n loc,\n });\n return null;\n }\n\n let componentRules = this.rules.components.get(path);\n return {\n type: 'component',\n specifier: `@embroider/virtual/ambiguous/${path}`,\n importedName: 'default',\n yieldsComponents: componentRules ? componentRules.yieldsSafeComponents : [],\n yieldsArguments: componentRules ? componentRules.yieldsArguments : [],\n argumentsAreComponents: componentRules ? componentRules.argumentsAreComponents : [],\n nameHint: this.nameHint(path),\n };\n }\n\n private targetElementModifier(path: string): ModifierResolution | null {\n if (!this.staticModifiersEnabled) {\n return null;\n }\n\n const builtIn = this.builtInsForEmberVersion[path];\n if (builtIn?.importableModifier) {\n let [importedName, specifier] = builtIn.importableModifier;\n return {\n type: 'modifier',\n specifier,\n importedName,\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n\n return {\n type: 'modifier',\n specifier: `@embroider/virtual/modifiers/${path}`,\n importedName: 'default',\n nameHint: this.nameHint(path),\n };\n }\n\n targetDynamicModifier(modifier: ComponentLocator, loc: Loc): ModifierResolution | ResolutionFail | null {\n if (!this.staticModifiersEnabled) {\n return null;\n }\n\n if (modifier.type === 'literal') {\n return this.targetElementModifier(modifier.path);\n } else {\n return {\n type: 'error',\n message: 'Unsafe dynamic modifier',\n detail: `cannot statically analyze this expression`,\n loc,\n };\n }\n }\n\n private targetDynamicHelper(helper: ComponentLocator): HelperResolution | null {\n if (!this.staticHelpersEnabled) {\n return null;\n }\n\n if (helper.type === 'literal') {\n return this.targetHelper(helper.path);\n }\n\n // we don't have to manage any errors in this case because ember itself\n // considers it an error to pass anything but a string literal to the\n // `helper` helper.\n return null;\n }\n\n private nameHint(path: string) {\n let parts = path.split('@');\n\n // the extra underscore here guarantees that we will never collide with an\n // HTML element.\n return this.externalNameHint?.(path) ?? parts[parts.length - 1] + '_';\n }\n\n private handleDynamicModifier(param: ASTv1.Expression): ModifierResolution | ResolutionFail | null {\n if (param.type === 'StringLiteral') {\n return this.targetDynamicModifier({ type: 'literal', path: param.value }, param.loc);\n }\n // we don't have to manage any errors in this case because ember itself\n // considers it an error to pass anything but a string literal to the\n // modifier helper.\n return null;\n }\n\n private handleDynamicHelper(param: ASTv1.Expression): HelperResolution | ResolutionFail | null {\n // We only need to handle StringLiterals since Ember already throws an error if unsupported values\n // are passed to the helper keyword.\n // If a helper reference is passed in we don't need to do anything since it's either the result of a previous\n // helper keyword invocation, or a helper reference that was imported somewhere.\n if (param.type === 'StringLiteral') {\n return this.targetDynamicHelper({ type: 'literal', path: param.value });\n }\n return null;\n }\n\n private ownRules: PreprocessedComponentRule | undefined;\n\n private implementInvokesRule(node: ASTv1.Template, path: WalkerPath<ASTv1.Template>) {\n if (!this.ownRules?.invokes) {\n return;\n }\n let registrations: ASTv1.HashPair[] = [];\n for (let snippets of Object.values(this.ownRules.invokes)) {\n for (let snippet of snippets) {\n let dasherizedName = snippetToDasherizedName(snippet);\n if (!dasherizedName) {\n throw new Error(`Package rule contains unparseable component snippet: ${snippet}`);\n }\n let resolution = this.targetComponentHelper({ type: 'literal', path: dasherizedName }, node.loc);\n this.emit(path, resolution, (_target, id) => {\n registrations.push(this.env.syntax.builders.pair(dasherizedName, id));\n });\n }\n }\n if (registrations.length > 0) {\n node.body.unshift(\n this.env.syntax.builders.mustache(\n this.env.meta.jsutils.bindExpression(registrationHelper, path, { nameHint: 'registerComponents' }),\n [],\n this.env.syntax.builders.hash(registrations)\n )\n );\n }\n }\n\n visitor: ASTPlugin['visitor'] = {\n Template: {\n enter: (node, path) => {\n this.ownRules = this.findRules(this.env.filename);\n this.implementInvokesRule(node, path);\n if (this.env.locals) {\n this.scopeStack.pushMustacheBlock(this.env.locals);\n }\n },\n exit: () => {\n if (this.env.locals) {\n this.scopeStack.pop();\n }\n },\n },\n Block: {\n enter: node => {\n this.scopeStack.pushMustacheBlock(node.blockParams);\n },\n exit: () => {\n this.scopeStack.pop();\n },\n },\n BlockStatement: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n let rootName = headOf(node.path);\n if (this.scopeStack.inScope(rootName, path)) {\n return;\n }\n if (isThisHead(node.path)) {\n return;\n }\n if (parts(node.path).length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components, which means there's nothing to resolve at this\n // location.\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n let resolution = this.handleComponentHelper(node.params[0]);\n this.emit(path, resolution, (node, newIdentifier) => {\n node.params[0] = newIdentifier;\n });\n return;\n }\n let resolution = this.targetComponent(node.path.original);\n this.emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n if (resolution?.type === 'component') {\n this.scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n this.handleDynamicComponentArguments(\n rootName,\n argumentsAreComponents,\n extendPath(extendPath(path, 'hash'), 'pairs')\n );\n });\n }\n },\n SubExpression: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (isThisHead(node.path)) {\n return;\n }\n if (this.scopeStack.inScope(headOf(node.path), path)) {\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n let resolution = this.handleComponentHelper(node.params[0]);\n this.emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.original === 'helper' && node.params.length > 0) {\n let resolution = this.handleDynamicHelper(node.params[0]);\n this.emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.original === 'modifier' && node.params.length > 0) {\n let resolution = this.handleDynamicModifier(node.params[0]);\n this.emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.tail.length === 0 && node.path.head.type === 'VarHead') {\n let resolution = this.targetHelper(node.path.original);\n this.emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n }\n },\n MustacheStatement: {\n enter: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n let rootName = headOf(node.path);\n if (this.scopeStack.inScope(rootName, path)) {\n return;\n }\n if (isThisHead(node.path)) {\n return;\n }\n if (parts(node.path).length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components, which means there's nothing to resolve at this\n // location.\n return;\n }\n if (node.path.original.startsWith('@')) {\n // similarly, global resolution of helpers and components never\n // happens with argument paths (it could still be an invocation, but\n // it would be a lexically-scoped invocation, not one we need to\n // adjust)\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n let resolution = this.handleComponentHelper(node.params[0]);\n this.emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.original === 'helper' && node.params.length > 0) {\n let resolution = this.handleDynamicHelper(node.params[0]);\n this.emit(path, resolution, (node, newIdentifier) => {\n node.params[0] = newIdentifier;\n });\n return;\n }\n if (path.parent?.node.type === 'AttrNode') {\n // this mustache is the value of an attribute. Components aren't\n // allowed here, so we're not ambiguous, so resolve a helper.\n let resolution = this.targetHelper(node.path.original);\n this.emit(path, resolution, (node, newIdentifier) => {\n node.path = newIdentifier;\n });\n return;\n }\n let hasArgs = node.params.length > 0 || node.hash.pairs.length > 0;\n let resolution = this.targetHelperOrComponent(node.path.original, node.path.loc, hasArgs);\n this.emit(path, resolution, (node, newIdentifier) => {\n node.path = newIdentifier;\n });\n if (resolution?.type === 'component') {\n this.handleDynamicComponentArguments(\n node.path.original,\n resolution.argumentsAreComponents,\n extendPath(extendPath(path, 'hash'), 'pairs')\n );\n }\n },\n },\n ElementModifierStatement: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (this.scopeStack.inScope(headOf(node.path), path)) {\n return;\n }\n if (isThisHead(node.path)) {\n return;\n }\n if (isAtHead(node.path)) {\n return;\n }\n if (parts(node.path).length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components. With the introduction of `Template strict mode` in Ember 3.25\n // it is also possible to pass modifiers this way which means there's nothing\n // to resolve at this location.\n return;\n }\n\n let resolution = this.targetElementModifier(node.path.original);\n this.emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n },\n ElementNode: {\n enter: (node, path) => {\n let rootName = node.tag.split('.')[0];\n if (!this.scopeStack.inScope(rootName, path)) {\n let resolution: ComponentResolution | null = null;\n\n // if it starts with lower case, it can't be a component we need to\n // globally resolve\n if (node.tag[0] !== node.tag[0].toLowerCase()) {\n resolution = this.targetComponent(dasherize(node.tag));\n }\n\n this.emit(path, resolution, (node, newId) => {\n node.tag = newId.original;\n });\n if (resolution?.type === 'component') {\n this.scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n this.handleDynamicComponentArguments(node.tag, argumentsAreComponents, extendPath(path, 'attributes'));\n });\n }\n }\n this.scopeStack.pushElementBlock(node.blockParams, node);\n },\n exit: () => {\n this.scopeStack.pop();\n },\n },\n };\n}\n\n// This is the AST transform that resolves components, helpers and modifiers at build time\nexport default function makeResolverTransform({ appRoot, emberVersion, externalNameHint }: Options) {\n let loader = new ResolverLoader(appRoot);\n let config = loader.resolver.options as CompatResolverOptions;\n const resolverTransform: ASTPluginBuilder<Env> = env => {\n if (env.strictMode) {\n return {\n name: 'embroider-build-time-resolver-strict-noop',\n visitor: {},\n };\n }\n return new TemplateResolver(env, config, builtInKeywords(emberVersion), externalNameHint);\n };\n (resolverTransform as any).parallelBabel = {\n requireFile: __filename,\n buildUsing: 'makeResolverTransform',\n params: { appRoot: appRoot },\n };\n return resolverTransform;\n}\n\ninterface ComponentBlockMarker {\n type: 'componentBlockMarker';\n resolution: ComponentResolution;\n argumentsAreComponents: string[];\n exit: (marker: ComponentBlockMarker) => void;\n}\n\ntype ScopeEntry =\n | { type: 'mustache'; blockParams: string[] }\n | { type: 'element'; blockParams: string[]; childrenOf: ASTv1.ElementNode }\n | ComponentBlockMarker;\n\nclass ScopeStack {\n private stack: ScopeEntry[] = [];\n\n // mustache blocks like:\n //\n // {{#stuff as |some block vars|}}\n //\n // are relatively simple for us because there's a dedicated `Block` AST node\n // that exactly covers the range in which the variables are in scope.\n pushMustacheBlock(blockParams: string[]) {\n this.stack.unshift({ type: 'mustache', blockParams });\n }\n\n // element blocks like:\n //\n // <Stuff as |some block vars|>\n //\n // are *not* so simple for us because there's no single AST node that exactly\n // covers the range in which the variables are in scope. For example, the\n // *attributes* of the element do not see the variables, but the children of\n // the element do.\n pushElementBlock(blockParams: string[], childrenOf: ASTv1.ElementNode) {\n this.stack.unshift({ type: 'element', blockParams, childrenOf });\n }\n\n // and when we leave the block they go out of scope. If this block was tagged\n // by a safe component marker, we also clear that.\n pop() {\n this.stack.shift();\n let next = this.stack[0];\n if (next && next.type === 'componentBlockMarker') {\n next.exit(next);\n this.stack.shift();\n }\n }\n\n // right before we enter a block, we might determine that some of the values\n // that will be yielded as marked (by a rule) as safe to be used with the\n // {{component}} helper.\n enteringComponentBlock(resolution: ComponentResolution, exit: ComponentBlockMarker['exit']) {\n this.stack.unshift({\n type: 'componentBlockMarker',\n resolution,\n argumentsAreComponents: resolution.argumentsAreComponents.slice(),\n exit,\n });\n }\n\n inScope(name: string, fromPath: WalkerPath<ASTv1.Node>) {\n for (let scope of this.stack) {\n if (scope.type === 'mustache' && scope.blockParams.includes(name)) {\n return true;\n }\n if (\n scope.type === 'element' &&\n scope.blockParams.includes(name) &&\n withinElementBlock(fromPath, scope.childrenOf)\n ) {\n return true;\n }\n }\n return false;\n }\n\n safeComponentInScope(name: string): boolean {\n let parts = name.split('.');\n if (parts.length > 2) {\n // we let component rules specify that they yield components or objects\n // containing components. But not deeper than that. So the max path length\n // that can refer to a marked-safe component is two segments.\n return false;\n }\n for (let i = 0; i < this.stack.length - 1; i++) {\n let here = this.stack[i];\n let next = this.stack[i + 1];\n if ((here.type === 'mustache' || here.type === 'element') && next.type === 'componentBlockMarker') {\n let positionalIndex = here.blockParams.indexOf(parts[0]);\n if (positionalIndex === -1) {\n continue;\n }\n\n if (parts.length === 1) {\n if (next.resolution.yieldsComponents[positionalIndex] === true) {\n return true;\n }\n let sourceArg = next.resolution.yieldsArguments[positionalIndex];\n if (typeof sourceArg === 'string') {\n next.argumentsAreComponents.push(sourceArg);\n return true;\n }\n } else {\n let entry = next.resolution.yieldsComponents[positionalIndex];\n if (entry && typeof entry === 'object') {\n return entry[parts[1]] === true;\n }\n\n let argsEntry = next.resolution.yieldsArguments[positionalIndex];\n if (argsEntry && typeof argsEntry === 'object') {\n let sourceArg = argsEntry[parts[1]];\n if (typeof sourceArg === 'string') {\n next.argumentsAreComponents.push(sourceArg);\n return true;\n }\n }\n }\n // we found the source of the name, but there were no rules to cover it.\n // Don't keep searching higher, those are different names.\n return false;\n }\n }\n return false;\n }\n}\n\nfunction extendPath<N extends ASTv1.Node, K extends keyof N>(\n path: WalkerPath<N>,\n key: K\n): N[K] extends ASTv1.Node ? WalkerPath<N[K]> : N[K] extends ASTv1.Node[] ? WalkerPath<N[K][0]>[] : never {\n const _WalkerPath = path.constructor as {\n new <Child extends ASTv1.Node>(\n node: Child,\n parent?: WalkerPath<ASTv1.Node> | null,\n parentKey?: string | null\n ): WalkerPath<Child>;\n };\n let child = path.node[key];\n if (Array.isArray(child)) {\n return child.map(c => new _WalkerPath(c, path, key as string)) as any;\n } else {\n return new _WalkerPath(child as any, path, key as string) as any;\n }\n}\n\nfunction capitalize(word: string): string {\n return word[0].toUpperCase() + word.slice(1);\n}\n\n// ElementNodes have both children and attributes and both of those are\n// \"children\" in the abstract syntax tree sense, but here we want to distinguish\n// between them.\nfunction withinElementBlock(childPath: WalkerPath<ASTv1.Node>, ancestorNode: ASTv1.ElementNode): Boolean {\n let cursor: WalkerPath<ASTv1.Node> | null = childPath;\n while (cursor && cursor.node !== ancestorNode) {\n if (ancestorNode.children.includes(cursor.node as ASTv1.Statement)) {\n return true;\n }\n cursor = cursor.parent;\n }\n return false;\n}\nfunction appendArrays(objValue: any, srcValue: any) {\n if (Array.isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n}\n\nfunction headOf(path: any) {\n if (!path) return;\n\n return 'head' in path ? path.head.name : path.parts[0];\n}\n\nfunction isThisHead(path: any) {\n if (!path) return;\n\n if ('head' in path) {\n return path.head.type === 'ThisHead';\n }\n\n return path.this === true;\n}\n\nfunction isAtHead(path: any) {\n if (!path) return;\n\n if ('head' in path) {\n return path.head.type === 'AtHead';\n }\n\n return path.data === true;\n}\n\nfunction parts(path: any) {\n if (!path) return;\n\n return 'original' in path ? path.original.split('.') : path.parts;\n}\n\nfunction registrationHelper(context: { import: (module: string, name: string, hint?: string) => string }) {\n let Helper = context.import('@ember/component/helper', 'default', 'Helper');\n let getOwner = context.import('@ember/owner', 'getOwner');\n return `\n (class extends ${Helper} {\n compute(_positional, registrations) {\n let owner = ${getOwner}(this);\n for (let [name, definition] of Object.entries(registrations)) {\n owner.register(\\`component:\\${name}\\`, definition);\n }\n }\n })\n `;\n}\n"]}
@@ -1,4 +0,0 @@
1
- import V1Addon from '../v1-addon';
2
- export default class extends V1Addon {
3
- get packageMeta(): Partial<import("@embroider/shared-internals").AddonMeta>;
4
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const v1_addon_1 = __importDefault(require("../v1-addon"));
7
- class default_1 extends v1_addon_1.default {
8
- get packageMeta() {
9
- let meta = super.packageMeta;
10
- if (!meta.externals) {
11
- meta.externals = [];
12
- }
13
- meta.externals.push('./-computed-store');
14
- return meta;
15
- }
16
- }
17
- exports.default = default_1;
18
- //# sourceMappingURL=ember-macro-helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ember-macro-helpers.js","sourceRoot":"","sources":["ember-macro-helpers.ts"],"names":[],"mappings":";;;;;AAAA,2DAAkC;AAElC,eAAqB,SAAQ,kBAAO;IAClC,IAAI,WAAW;QACb,IAAI,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AATD,4BASC","sourcesContent":["import V1Addon from '../v1-addon';\n\nexport default class extends V1Addon {\n get packageMeta() {\n let meta = super.packageMeta;\n if (!meta.externals) {\n meta.externals = [];\n }\n meta.externals.push('./-computed-store');\n return meta;\n }\n}\n"]}