@embroider/compat 3.7.1-unstable.d367b87 → 3.7.1-unstable.e73d3a7

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.d367b87",
3
+ "version": "3.7.1-unstable.e73d3a7",
4
4
  "private": false,
5
5
  "description": "Backward compatibility layer for the Embroider build system.",
6
6
  "repository": {
@@ -17,9 +17,6 @@
17
17
  "src/**/*.d.ts",
18
18
  "src/**/*.js.map"
19
19
  ],
20
- "bin": {
21
- "embroider-compat-audit": "./src/audit-cli.js"
22
- },
23
20
  "dependencies": {
24
21
  "@babel/code-frame": "^7.14.5",
25
22
  "@babel/core": "^7.14.5",
@@ -31,7 +28,6 @@
31
28
  "@babel/runtime": "^7.18.6",
32
29
  "@babel/traverse": "^7.14.5",
33
30
  "@types/babel__code-frame": "^7.0.2",
34
- "@types/yargs": "^17.0.3",
35
31
  "assert-never": "^1.1.0",
36
32
  "babel-import-util": "^2.0.0",
37
33
  "babel-plugin-debug-macros": "^1.0.2",
@@ -64,8 +60,7 @@
64
60
  "tree-sync": "^2.1.0",
65
61
  "typescript-memoize": "^1.0.1",
66
62
  "walk-sync": "^3.0.0",
67
- "yargs": "^17.0.1",
68
- "@embroider/macros": "1.16.10-unstable.d367b87"
63
+ "@embroider/macros": "1.16.10-unstable.e73d3a7"
69
64
  },
70
65
  "devDependencies": {
71
66
  "@glimmer/syntax": "^0.84.3",
@@ -88,12 +83,12 @@
88
83
  "ember-engines": "^0.8.19",
89
84
  "scenario-tester": "^4.0.0",
90
85
  "typescript": "^5.4.5",
91
- "@embroider/core": "^3.4.20-unstable.d367b87",
86
+ "@embroider/core": "^3.4.20-unstable.e73d3a7",
92
87
  "@embroider/sample-transforms": "0.0.0",
93
88
  "@embroider/test-support": "0.36.0"
94
89
  },
95
90
  "peerDependencies": {
96
- "@embroider/core": "^3.4.20-unstable.d367b87"
91
+ "@embroider/core": "^3.4.20-unstable.e73d3a7"
97
92
  },
98
93
  "engines": {
99
94
  "node": "12.* || 14.* || >= 16"
@@ -1,5 +1,6 @@
1
1
  export interface AuditOptions {
2
- debug?: boolean;
2
+ entrypoints: string[];
3
+ rootURL: string;
3
4
  }
4
5
  export interface AuditBuildOptions extends AuditOptions {
5
6
  'reuse-build'?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":"","sourcesContent":["export interface AuditOptions {\n debug?: boolean;\n}\n\nexport interface AuditBuildOptions extends AuditOptions {\n 'reuse-build'?: boolean;\n app: string;\n}\n"]}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":"","sourcesContent":["export interface AuditOptions {\n entrypoints: string[];\n rootURL: string;\n}\n\nexport interface AuditBuildOptions extends AuditOptions {\n 'reuse-build'?: boolean;\n app: string;\n}\n"]}
package/src/audit.d.ts CHANGED
@@ -41,14 +41,11 @@ export declare class Audit {
41
41
  private findings;
42
42
  private frames;
43
43
  static run(options: AuditBuildOptions): Promise<AuditResults>;
44
- constructor(originAppRoot: string, options?: AuditOptions);
45
- private get pkg();
44
+ constructor(originAppRoot: string, options: AuditOptions);
46
45
  private get movedAppRoot();
47
- private get meta();
48
46
  private get babelConfig();
49
47
  private get resolverParams();
50
48
  private resolver;
51
- private debug;
52
49
  run(): Promise<AuditResults>;
53
50
  private resolveId;
54
51
  private load;
package/src/audit.js CHANGED
@@ -95,7 +95,7 @@ class Audit {
95
95
  let audit = new this(options.app, options);
96
96
  return audit.run();
97
97
  }
98
- constructor(originAppRoot, options = {}) {
98
+ constructor(originAppRoot, options) {
99
99
  this.originAppRoot = originAppRoot;
100
100
  this.options = options;
101
101
  this.virtualModules = new Map();
@@ -108,9 +108,9 @@ class Audit {
108
108
  // plugins, so the imports are still present and should be left alone.
109
109
  return undefined;
110
110
  }
111
- if (fromFile.endsWith('.html') && specifier.startsWith(this.meta['root-url'])) {
111
+ if (fromFile.endsWith('.html') && specifier.startsWith(this.options.rootURL)) {
112
112
  // root-relative URLs in HTML are actually relative to the appDir
113
- specifier = (0, core_1.explicitRelative)((0, path_1.dirname)(fromFile), (0, path_1.resolve)(this.movedAppRoot, specifier.replace(this.meta['root-url'], '')));
113
+ specifier = (0, core_1.explicitRelative)((0, path_1.dirname)(fromFile), (0, path_1.resolve)(this.movedAppRoot, specifier.replace(this.options.rootURL, '')));
114
114
  }
115
115
  let resolution = await this.resolver.nodeResolve(specifier, fromFile);
116
116
  switch (resolution.type) {
@@ -145,16 +145,10 @@ class Audit {
145
145
  }
146
146
  };
147
147
  }
148
- get pkg() {
149
- return (0, fs_extra_1.readJSONSync)((0, path_1.join)(this.movedAppRoot, 'package.json'));
150
- }
151
148
  get movedAppRoot() {
152
149
  let cache = core_1.RewrittenPackageCache.shared('embroider', this.originAppRoot);
153
150
  return cache.maybeMoved(cache.get(this.originAppRoot)).root;
154
151
  }
155
- get meta() {
156
- return this.pkg['ember-addon'];
157
- }
158
152
  get babelConfig() {
159
153
  let origCwd = process.cwd();
160
154
  process.chdir(this.originAppRoot);
@@ -173,16 +167,12 @@ class Audit {
173
167
  get resolverParams() {
174
168
  return (0, fs_extra_1.readJSONSync)((0, path_1.join)((0, core_1.locateEmbroiderWorkingDir)(this.originAppRoot), 'resolver.json'));
175
169
  }
176
- debug(message, ...args) {
177
- if (this.options.debug) {
178
- console.log(message, ...args);
179
- }
180
- }
181
170
  async run() {
182
171
  globalThis.embroider_audit = this.handleResolverError.bind(this);
183
172
  try {
184
- this.debug(`meta`, this.meta);
185
- let entrypoints = this.meta.assets.filter(a => a.endsWith('html')).map(a => (0, path_1.resolve)(this.movedAppRoot, a));
173
+ let entrypoints = this.options.entrypoints
174
+ .filter(a => a.endsWith('html'))
175
+ .map(a => (0, path_1.resolve)(this.movedAppRoot, a));
186
176
  let modules = await (0, module_visitor_1.visitModules)({
187
177
  base: this.originAppRoot,
188
178
  entrypoints,
@@ -283,9 +273,6 @@ class Audit {
283
273
  }
284
274
  }
285
275
  exports.Audit = Audit;
286
- __decorate([
287
- (0, typescript_memoize_1.Memoize)()
288
- ], Audit.prototype, "pkg", null);
289
276
  __decorate([
290
277
  (0, typescript_memoize_1.Memoize)()
291
278
  ], Audit.prototype, "movedAppRoot", null);
package/src/audit.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"audit.js","sourceRoot":"","sources":["audit.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAsD;AACtD,+BAA6D;AAE7D,0CAAwH;AACxH,2DAA6C;AAC7C,kDAA0B;AAC1B,6DAAqC;AAErC,yDAA4E;AAE5E,yCAAmE;AAuBzB,2FAvBvB,kBAAU,OAuBuB;AAAE,6FAvBvB,oBAAY,OAuBuB;AAtBlE,qDAO0B;AAwB1B,MAAa,YAAY;IAAzB;QACE,YAAO,GAA+B,EAAE,CAAC;QACzC,aAAQ,GAAc,EAAE,CAAC;IAkE3B,CAAC;IAhEC,MAAM,CAAC,MAAM,CAAC,OAAe,EAAE,QAAmB,EAAE,OAA+B;QACjF,IAAI,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QACzB,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;QAC1B,KAAK,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;gBAChD,CAAC,CAAC,OAAO,CAAC,QAAQ;gBAClB,CAAC,CAAC,IAAA,uBAAgB,EAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;YAEhD,IAAI,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC1D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,OA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GAAG,IAAI,CAAC;SAC1B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC","sourcesContent":["import { readFileSync, readJSONSync } from 'fs-extra';\nimport { join, resolve as resolvePath, dirname } from 'path';\nimport type { AppMeta, ResolverOptions } from '@embroider/core';\nimport { explicitRelative, hbsToJS, locateEmbroiderWorkingDir, Resolver, RewrittenPackageCache } from '@embroider/core';\nimport { Memoize } from 'typescript-memoize';\nimport chalk from 'chalk';\nimport groupBy from 'lodash/groupBy';\nimport type { NamespaceMarker } from './audit/babel-visitor';\nimport { CodeFrameStorage, isNamespaceMarker } from './audit/babel-visitor';\nimport { AuditBuildOptions, AuditOptions } from './audit/options';\nimport { buildApp, BuildError, isBuildError } from './audit/build';\nimport {\n type ContentType,\n type Module,\n visitModules,\n type RootMarker,\n isRootMarker,\n type CompleteModule,\n} from './module-visitor';\n\nexport interface AuditMessage {\n message: string;\n detail: string;\n loc: Loc;\n source: string;\n filename: string;\n}\n\nexport interface Loc {\n start: { line: number; column: number };\n end: { line: number; column: number };\n}\n\nexport { AuditOptions, AuditBuildOptions, BuildError, isBuildError };\n\nexport interface Finding {\n message: string;\n filename: string;\n detail: string;\n codeFrame?: string;\n}\n\nexport class AuditResults {\n modules: { [file: string]: Module } = {};\n findings: Finding[] = [];\n\n static create(baseDir: string, findings: Finding[], modules: Record<string, Module>) {\n let results = new this();\n results.modules = modules;\n for (let finding of findings) {\n const filename = finding.filename.startsWith('./')\n ? finding.filename\n : explicitRelative(baseDir, finding.filename);\n\n let relFinding = Object.assign({}, finding, { filename });\n results.findings.push(relFinding);\n }\n return results;\n }\n\n humanReadable(): string {\n let output = [] as string[];\n let findingsByFile = groupBy(this.findings, f => f.filename);\n output.push(`=== Audit Results ===`);\n for (let [filename, findings] of Object.entries(findingsByFile)) {\n output.push(`${chalk.yellow(filename)}`);\n for (let finding of findings) {\n output.push(indent(chalk.red(finding.message) + ': ' + finding.detail, 1));\n if (finding.codeFrame) {\n output.push(indent(finding.codeFrame, 2));\n }\n }\n output.push(indent(chalk.blueBright(`file was included because:`), 1));\n let pointer: string | RootMarker = filename;\n while (!isRootMarker(pointer)) {\n // the zero here means we only display the first path we found. I think\n // that's a fine tradeoff to keep the output smaller.\n let nextPointer: string | RootMarker | undefined = this.modules[pointer]?.consumedFrom[0];\n if (!nextPointer) {\n output.push(\n indent(\n chalk.red(`couldn't figure out why this was included. Please file a bug against @embroider/compat.`),\n 2\n )\n );\n break;\n }\n if (isRootMarker(nextPointer)) {\n output.push(indent('packageJSON.ember-addon.assets', 2));\n } else {\n output.push(indent(nextPointer, 2));\n }\n pointer = nextPointer;\n }\n }\n let summaryColor;\n if (this.perfect) {\n summaryColor = chalk.green;\n } else {\n summaryColor = chalk.yellow;\n }\n output.push(summaryColor(`${this.findings.length} issues found`));\n output.push(`=== End Audit Results ===`);\n output.push(''); // always end with a newline because `yarn run` can overwrite our last line otherwise\n return output.join('\\n');\n }\n\n get perfect() {\n return this.findings.length === 0;\n }\n}\n\nexport class Audit {\n private virtualModules: Map<string, string> = new Map();\n private findings = [] as Finding[];\n\n private frames = new CodeFrameStorage();\n\n static async run(options: AuditBuildOptions): Promise<AuditResults> {\n if (!options['reuse-build']) {\n await buildApp(options);\n }\n\n let audit = new this(options.app, options);\n return audit.run();\n }\n\n constructor(private originAppRoot: string, private options: AuditOptions = {}) {}\n\n @Memoize()\n private get pkg() {\n return readJSONSync(join(this.movedAppRoot, 'package.json'));\n }\n\n @Memoize()\n private get movedAppRoot() {\n let cache = RewrittenPackageCache.shared('embroider', this.originAppRoot);\n return cache.maybeMoved(cache.get(this.originAppRoot)).root;\n }\n\n private get meta() {\n return this.pkg['ember-addon'] as AppMeta;\n }\n\n @Memoize()\n private get babelConfig() {\n let origCwd = process.cwd();\n process.chdir(this.originAppRoot);\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n let config = require(join(this.originAppRoot, 'babel.config.cjs'));\n\n config = Object.assign({}, config);\n config.plugins = config.plugins.filter((p: any) => !isMacrosPlugin(p));\n\n config.ast = true;\n return config;\n } finally {\n process.chdir(origCwd);\n }\n }\n\n private get resolverParams(): ResolverOptions {\n return readJSONSync(join(locateEmbroiderWorkingDir(this.originAppRoot), 'resolver.json'));\n }\n\n private resolver = new Resolver(this.resolverParams);\n\n private debug(message: string, ...args: any[]) {\n if (this.options.debug) {\n console.log(message, ...args);\n }\n }\n\n async run(): Promise<AuditResults> {\n (globalThis as any).embroider_audit = this.handleResolverError.bind(this);\n\n try {\n this.debug(`meta`, this.meta);\n let entrypoints = this.meta.assets.filter(a => a.endsWith('html')).map(a => resolvePath(this.movedAppRoot, a));\n\n let modules = await visitModules({\n base: this.originAppRoot,\n entrypoints,\n resolveId: this.resolveId,\n load: this.load,\n findings: this.findings,\n frames: this.frames,\n babelConfig: this.babelConfig,\n });\n\n this.inspectModules(modules);\n\n return AuditResults.create(this.originAppRoot, this.findings, modules);\n } finally {\n delete (globalThis as any).embroider_audit;\n }\n }\n\n private resolveId = async (specifier: string, fromFile: string): Promise<string | undefined> => {\n if (['@embroider/macros'].includes(specifier)) {\n // the audit process deliberately removes the @embroider/macros babel\n // plugins, so the imports are still present and should be left alone.\n return undefined;\n }\n\n if (fromFile.endsWith('.html') && specifier.startsWith(this.meta['root-url'])) {\n // root-relative URLs in HTML are actually relative to the appDir\n specifier = explicitRelative(\n dirname(fromFile),\n resolvePath(this.movedAppRoot, specifier.replace(this.meta['root-url'], ''))\n );\n }\n\n let resolution = await this.resolver.nodeResolve(specifier, fromFile);\n switch (resolution.type) {\n case 'virtual':\n this.virtualModules.set(resolution.filename, resolution.content);\n return resolution.filename;\n case 'not_found':\n return undefined;\n case 'real':\n return resolution.filename;\n }\n };\n\n private load = async (id: string): Promise<{ content: string | Buffer; type: ContentType } | undefined> => {\n let content: string | Buffer;\n if (this.virtualModules.has(id)) {\n content = this.virtualModules.get(id)!;\n } else {\n content = readFileSync(id);\n }\n\n if (id.endsWith('.html')) {\n return { content, type: 'html' };\n } else if (id.endsWith('.hbs')) {\n return { content: hbsToJS(content.toString('utf8')), type: 'javascript' };\n } else if (id.endsWith('.json')) {\n return this.handleJSON(id, content);\n } else {\n return { content, type: 'javascript' };\n }\n };\n\n private handleResolverError(msg: AuditMessage) {\n this.pushFinding({\n message: msg.message,\n filename: msg.filename,\n detail: msg.detail,\n codeFrame: this.frames.render(this.frames.forSource(msg.source)(msg)),\n });\n }\n\n private inspectModules(modules: Record<string, Module>) {\n for (let [filename, module] of Object.entries(modules)) {\n if (module.type === 'complete') {\n this.inspectImports(filename, module, modules);\n }\n }\n }\n\n private inspectImports(filename: string, module: CompleteModule, modules: Record<string, Module>) {\n for (let imp of module.imports) {\n // our Audit should always ignore any imports of @embroider/macros because we already ignored them\n // in resolveId above\n if (imp.source === '@embroider/macros') {\n continue;\n }\n let resolved = module.resolutions[imp.source];\n if (!resolved) {\n this.findings.push({\n filename,\n message: 'unable to resolve dependency',\n detail: imp.source,\n codeFrame: this.frames.render(imp.codeFrameIndex),\n });\n } else if (resolved) {\n let target = modules[resolved]!;\n for (let specifier of imp.specifiers) {\n if (target.type === 'complete' && !this.moduleProvidesName(target, specifier.name)) {\n if (specifier.name === 'default') {\n let backtick = '`';\n this.findings.push({\n filename,\n message: 'importing a non-existent default export',\n detail: `\"${imp.source}\" has no default export. Did you mean ${backtick}import * as ${specifier.local} from \"${imp.source}\"${backtick}?`,\n codeFrame: this.frames.render(specifier.codeFrameIndex),\n });\n } else {\n this.findings.push({\n filename,\n message: 'importing a non-existent named export',\n detail: `\"${imp.source}\" has no export named \"${specifier.name}\".`,\n codeFrame: this.frames.render(specifier.codeFrameIndex),\n });\n }\n }\n }\n }\n }\n }\n\n private moduleProvidesName(target: CompleteModule, name: string | NamespaceMarker) {\n // any module can provide a namespace.\n // CJS and AMD are too dynamic to be sure exactly what names are available,\n // so they always get a pass\n return isNamespaceMarker(name) || target.isCJS || target.isAMD || target.exports.includes(name);\n }\n\n private handleJSON(filename: string, content: Buffer | string): { content: string; type: ContentType } | undefined {\n let js;\n try {\n let structure = JSON.parse(content.toString('utf8'));\n js = `export default ${JSON.stringify(structure)}`;\n } catch (err) {\n this.findings.push({\n filename,\n message: `failed to parse JSON`,\n detail: err.toString().replace(filename, explicitRelative(this.originAppRoot, filename)),\n });\n return;\n }\n return { content: js, type: 'javascript' };\n }\n\n private pushFinding(finding: Finding) {\n this.findings.push(finding);\n }\n}\n\nfunction isMacrosPlugin(p: any) {\n return Array.isArray(p) && p[1] && p[1].embroiderMacrosConfigMarker;\n}\n\nfunction indent(str: string, level: number) {\n const spacesPerLevel = 2;\n let spaces = '';\n for (let i = 0; i < level * spacesPerLevel; i++) {\n spaces += ' ';\n }\n\n return str\n .split('\\n')\n .map(line => spaces + line)\n .join('\\n');\n}\n\nexport { Module };\n"]}
1
+ {"version":3,"file":"audit.js","sourceRoot":"","sources":["audit.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAsD;AACtD,+BAA6D;AAE7D,0CAAwH;AACxH,2DAA6C;AAC7C,kDAA0B;AAC1B,6DAAqC;AAErC,yDAA4E;AAE5E,yCAAmE;AAuBzB,2FAvBvB,kBAAU,OAuBuB;AAAE,6FAvBvB,oBAAY,OAuBuB;AAtBlE,qDAO0B;AAwB1B,MAAa,YAAY;IAAzB;QACE,YAAO,GAA+B,EAAE,CAAC;QACzC,aAAQ,GAAc,EAAE,CAAC;IAkE3B,CAAC;IAhEC,MAAM,CAAC,MAAM,CAAC,OAAe,EAAE,QAAmB,EAAE,OAA+B;QACjF,IAAI,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QACzB,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;QAC1B,KAAK,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;gBAChD,CAAC,CAAC,OAAO,CAAC,QAAQ;gBAClB,CAAC,CAAC,IAAA,uBAAgB,EAAC,OAAO,EAAE,OAAO,CAAC,Q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AQ,EAAE,IAAA,uBAAgB,EAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;aACzF,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IAC7C,CAAC;IAEO,WAAW,CAAC,OAAgB;QAClC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACF;AA3MD,sBA2MC;AAzLC;IADC,IAAA,4BAAO,GAAE;yCAIT;AAGD;IADC,IAAA,4BAAO,GAAE;wCAgBT;AAsKH,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,2BAA2B,CAAC;AACtE,CAAC;AAED,SAAS,MAAM,CAAC,GAAW,EAAE,KAAa;IACxC,MAAM,cAAc,GAAG,CAAC,CAAC;IACzB,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,cAAc,EAAE,CAAC,EAAE,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,CAAC;IAChB,CAAC;IAED,OAAO,GAAG;SACP,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC;SAC1B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC","sourcesContent":["import { readFileSync, readJSONSync } from 'fs-extra';\nimport { join, resolve as resolvePath, dirname } from 'path';\nimport type { ResolverOptions } from '@embroider/core';\nimport { explicitRelative, hbsToJS, locateEmbroiderWorkingDir, Resolver, RewrittenPackageCache } from '@embroider/core';\nimport { Memoize } from 'typescript-memoize';\nimport chalk from 'chalk';\nimport groupBy from 'lodash/groupBy';\nimport type { NamespaceMarker } from './audit/babel-visitor';\nimport { CodeFrameStorage, isNamespaceMarker } from './audit/babel-visitor';\nimport { AuditBuildOptions, AuditOptions } from './audit/options';\nimport { buildApp, BuildError, isBuildError } from './audit/build';\nimport {\n type ContentType,\n type Module,\n visitModules,\n type RootMarker,\n isRootMarker,\n type CompleteModule,\n} from './module-visitor';\n\nexport interface AuditMessage {\n message: string;\n detail: string;\n loc: Loc;\n source: string;\n filename: string;\n}\n\nexport interface Loc {\n start: { line: number; column: number };\n end: { line: number; column: number };\n}\n\nexport { AuditOptions, AuditBuildOptions, BuildError, isBuildError };\n\nexport interface Finding {\n message: string;\n filename: string;\n detail: string;\n codeFrame?: string;\n}\n\nexport class AuditResults {\n modules: { [file: string]: Module } = {};\n findings: Finding[] = [];\n\n static create(baseDir: string, findings: Finding[], modules: Record<string, Module>) {\n let results = new this();\n results.modules = modules;\n for (let finding of findings) {\n const filename = finding.filename.startsWith('./')\n ? finding.filename\n : explicitRelative(baseDir, finding.filename);\n\n let relFinding = Object.assign({}, finding, { filename });\n results.findings.push(relFinding);\n }\n return results;\n }\n\n humanReadable(): string {\n let output = [] as string[];\n let findingsByFile = groupBy(this.findings, f => f.filename);\n output.push(`=== Audit Results ===`);\n for (let [filename, findings] of Object.entries(findingsByFile)) {\n output.push(`${chalk.yellow(filename)}`);\n for (let finding of findings) {\n output.push(indent(chalk.red(finding.message) + ': ' + finding.detail, 1));\n if (finding.codeFrame) {\n output.push(indent(finding.codeFrame, 2));\n }\n }\n output.push(indent(chalk.blueBright(`file was included because:`), 1));\n let pointer: string | RootMarker = filename;\n while (!isRootMarker(pointer)) {\n // the zero here means we only display the first path we found. I think\n // that's a fine tradeoff to keep the output smaller.\n let nextPointer: string | RootMarker | undefined = this.modules[pointer]?.consumedFrom[0];\n if (!nextPointer) {\n output.push(\n indent(\n chalk.red(`couldn't figure out why this was included. Please file a bug against @embroider/compat.`),\n 2\n )\n );\n break;\n }\n if (isRootMarker(nextPointer)) {\n output.push(indent('packageJSON.ember-addon.assets', 2));\n } else {\n output.push(indent(nextPointer, 2));\n }\n pointer = nextPointer;\n }\n }\n let summaryColor;\n if (this.perfect) {\n summaryColor = chalk.green;\n } else {\n summaryColor = chalk.yellow;\n }\n output.push(summaryColor(`${this.findings.length} issues found`));\n output.push(`=== End Audit Results ===`);\n output.push(''); // always end with a newline because `yarn run` can overwrite our last line otherwise\n return output.join('\\n');\n }\n\n get perfect() {\n return this.findings.length === 0;\n }\n}\n\nexport class Audit {\n private virtualModules: Map<string, string> = new Map();\n private findings = [] as Finding[];\n\n private frames = new CodeFrameStorage();\n\n static async run(options: AuditBuildOptions): Promise<AuditResults> {\n if (!options['reuse-build']) {\n await buildApp(options);\n }\n\n let audit = new this(options.app, options);\n return audit.run();\n }\n\n constructor(private originAppRoot: string, private options: AuditOptions) {}\n\n @Memoize()\n private get movedAppRoot() {\n let cache = RewrittenPackageCache.shared('embroider', this.originAppRoot);\n return cache.maybeMoved(cache.get(this.originAppRoot)).root;\n }\n\n @Memoize()\n private get babelConfig() {\n let origCwd = process.cwd();\n process.chdir(this.originAppRoot);\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n let config = require(join(this.originAppRoot, 'babel.config.cjs'));\n\n config = Object.assign({}, config);\n config.plugins = config.plugins.filter((p: any) => !isMacrosPlugin(p));\n\n config.ast = true;\n return config;\n } finally {\n process.chdir(origCwd);\n }\n }\n\n private get resolverParams(): ResolverOptions {\n return readJSONSync(join(locateEmbroiderWorkingDir(this.originAppRoot), 'resolver.json'));\n }\n\n private resolver = new Resolver(this.resolverParams);\n\n async run(): Promise<AuditResults> {\n (globalThis as any).embroider_audit = this.handleResolverError.bind(this);\n\n try {\n let entrypoints = this.options.entrypoints\n .filter(a => a.endsWith('html'))\n .map(a => resolvePath(this.movedAppRoot, a));\n\n let modules = await visitModules({\n base: this.originAppRoot,\n entrypoints,\n resolveId: this.resolveId,\n load: this.load,\n findings: this.findings,\n frames: this.frames,\n babelConfig: this.babelConfig,\n });\n\n this.inspectModules(modules);\n\n return AuditResults.create(this.originAppRoot, this.findings, modules);\n } finally {\n delete (globalThis as any).embroider_audit;\n }\n }\n\n private resolveId = async (specifier: string, fromFile: string): Promise<string | undefined> => {\n if (['@embroider/macros'].includes(specifier)) {\n // the audit process deliberately removes the @embroider/macros babel\n // plugins, so the imports are still present and should be left alone.\n return undefined;\n }\n\n if (fromFile.endsWith('.html') && specifier.startsWith(this.options.rootURL)) {\n // root-relative URLs in HTML are actually relative to the appDir\n specifier = explicitRelative(\n dirname(fromFile),\n resolvePath(this.movedAppRoot, specifier.replace(this.options.rootURL, ''))\n );\n }\n\n let resolution = await this.resolver.nodeResolve(specifier, fromFile);\n switch (resolution.type) {\n case 'virtual':\n this.virtualModules.set(resolution.filename, resolution.content);\n return resolution.filename;\n case 'not_found':\n return undefined;\n case 'real':\n return resolution.filename;\n }\n };\n\n private load = async (id: string): Promise<{ content: string | Buffer; type: ContentType } | undefined> => {\n let content: string | Buffer;\n if (this.virtualModules.has(id)) {\n content = this.virtualModules.get(id)!;\n } else {\n content = readFileSync(id);\n }\n\n if (id.endsWith('.html')) {\n return { content, type: 'html' };\n } else if (id.endsWith('.hbs')) {\n return { content: hbsToJS(content.toString('utf8')), type: 'javascript' };\n } else if (id.endsWith('.json')) {\n return this.handleJSON(id, content);\n } else {\n return { content, type: 'javascript' };\n }\n };\n\n private handleResolverError(msg: AuditMessage) {\n this.pushFinding({\n message: msg.message,\n filename: msg.filename,\n detail: msg.detail,\n codeFrame: this.frames.render(this.frames.forSource(msg.source)(msg)),\n });\n }\n\n private inspectModules(modules: Record<string, Module>) {\n for (let [filename, module] of Object.entries(modules)) {\n if (module.type === 'complete') {\n this.inspectImports(filename, module, modules);\n }\n }\n }\n\n private inspectImports(filename: string, module: CompleteModule, modules: Record<string, Module>) {\n for (let imp of module.imports) {\n // our Audit should always ignore any imports of @embroider/macros because we already ignored them\n // in resolveId above\n if (imp.source === '@embroider/macros') {\n continue;\n }\n let resolved = module.resolutions[imp.source];\n if (!resolved) {\n this.findings.push({\n filename,\n message: 'unable to resolve dependency',\n detail: imp.source,\n codeFrame: this.frames.render(imp.codeFrameIndex),\n });\n } else if (resolved) {\n let target = modules[resolved]!;\n for (let specifier of imp.specifiers) {\n if (target.type === 'complete' && !this.moduleProvidesName(target, specifier.name)) {\n if (specifier.name === 'default') {\n let backtick = '`';\n this.findings.push({\n filename,\n message: 'importing a non-existent default export',\n detail: `\"${imp.source}\" has no default export. Did you mean ${backtick}import * as ${specifier.local} from \"${imp.source}\"${backtick}?`,\n codeFrame: this.frames.render(specifier.codeFrameIndex),\n });\n } else {\n this.findings.push({\n filename,\n message: 'importing a non-existent named export',\n detail: `\"${imp.source}\" has no export named \"${specifier.name}\".`,\n codeFrame: this.frames.render(specifier.codeFrameIndex),\n });\n }\n }\n }\n }\n }\n }\n\n private moduleProvidesName(target: CompleteModule, name: string | NamespaceMarker) {\n // any module can provide a namespace.\n // CJS and AMD are too dynamic to be sure exactly what names are available,\n // so they always get a pass\n return isNamespaceMarker(name) || target.isCJS || target.isAMD || target.exports.includes(name);\n }\n\n private handleJSON(filename: string, content: Buffer | string): { content: string; type: ContentType } | undefined {\n let js;\n try {\n let structure = JSON.parse(content.toString('utf8'));\n js = `export default ${JSON.stringify(structure)}`;\n } catch (err) {\n this.findings.push({\n filename,\n message: `failed to parse JSON`,\n detail: err.toString().replace(filename, explicitRelative(this.originAppRoot, filename)),\n });\n return;\n }\n return { content: js, type: 'javascript' };\n }\n\n private pushFinding(finding: Finding) {\n this.findings.push(finding);\n }\n}\n\nfunction isMacrosPlugin(p: any) {\n return Array.isArray(p) && p[1] && p[1].embroiderMacrosConfigMarker;\n}\n\nfunction indent(str: string, level: number) {\n const spacesPerLevel = 2;\n let spaces = '';\n for (let i = 0; i < level * spacesPerLevel; i++) {\n spaces += ' ';\n }\n\n return str\n .split('\\n')\n .map(line => spaces + line)\n .join('\\n');\n}\n\nexport { Module };\n"]}
@@ -147,7 +147,6 @@ class RewriteManifest extends broccoli_plugin_1.default {
147
147
  // treated as ember code it needs to have v2 addon metadata
148
148
  json.keywords = [...((_a = json.keywords) !== null && _a !== void 0 ? _a : []), 'ember-addon'];
149
149
  let meta = {
150
- type: 'addon',
151
150
  version: 2,
152
151
  'auto-upgraded': true,
153
152
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ember-cli-fastboot.js","sourceRoot":"","sources":["ember-cli-fastboot.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkC;AAClC,sEAAqC;AAErC,uCAAwD;AACxD,+BAA4B;AAC5B,kFAA8C;AAC9C,2DAA6C;AAC7C,oEAAkC;AAGlC,MAAqB,gBAAiB,SAAQ,kBAAO;IACnD,UAAU,CAAC,GAAG,KAAe;QAC3B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;gBAC7B,4DAA4D;gBAC5D,sEAAsE;gBACtE,6DAA6D;gBAC7D,yDAAyD;gBACzD,EAAE;gBACF,mEAAmE;gBACnE,WAAW;gBACX,OAAO,KAAK,CAAC;YACf,CAAC;iBAAM,CAAC;gBACN,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,OAAO;QACT,IAAI,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;QAE1B,2EAA2E;QAC3E,0EAA0E;QAC1E,oDAAoD;QACpD,KAAK,CAAC,IAAI,CACR,IAAI,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE;YACjG,mCAAmC;SACpC,CAAC,CACH,CAAC;QAEF,yEAAyE;QACzE,oCAAoC;QACpC,KAAK,CAAC,IAAI,CAAC,IAAA,+BAAS,EAAC,uBAAuB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAEtE,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I,CAAC,YAAY,CAAC,CAAC;QAElG,2EAA2E;QAC3E,oEAAoE;QACpE,sEAAsE;QACtE,wEAAwE;QACxE,mCAAmC;QACnC,IAAI,CAAC,QAAQ,GAAG;YACd,aAAa,EAAE,CAAC;YAChB,cAAc,EAAE,YAAY;YAC5B,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,eAAe;YAC9C,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa;SAC3C,CAAC;QAEF,2EAA2E;QAC3E,wEAAwE;QACxE,eAAe;QACf,EAAE;QACF,uEAAuE;QACvE,iEAAiE;QACjE,sEAAsE;QACtE,4EAA4E;QAC5E,0BAA0B;QAC1B,IAAI,CAAC,oBAAoB,CAAC,GAAG;YAC3B,aAAa;YACb,gBAAgB;SACjB,CAAC;QAEF,qEAAqE;QACrE,4EAA4E;QAC5E,2DAA2D;QAC3D,IAAI,CAAC,QAAQ,GAAG,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,QAAQ,mCAAI,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;QAC1D,IAAI,IAAI,GAAc;YACpB,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,CAAC;YACV,eAAe,EAAE,IAAI;SACtB,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;QAE3B,IAAA,yBAAc,EAAC,IAAA,WAAI,EAAC,IAAI,CAAC,UAAU,EAAE,YAAY,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAC3F,CAAC;CACF","sourcesContent":["import V1Addon from '../v1-addon';\nimport Plugin from 'broccoli-plugin';\nimport type { Node } from 'broccoli-node-api';\nimport { readJSONSync, outputJSONSync } from 'fs-extra';\nimport { join } from 'path';\nimport writeFile from 'broccoli-file-creator';\nimport { Memoize } from 'typescript-memoize';\nimport bind from 'bind-decorator';\nimport type { AddonMeta } from '@embroider/core';\n\nexport default class EmberCliFastboot extends V1Addon {\n customizes(...trees: string[]): boolean {\n return trees.some(tree => {\n if (tree === 'treeForPublic') {\n // This is an optimization. It means we won't bother running\n // ember-cli-fastboot's custom treeForPublic at all. We don't actually\n // want *most* of what's in there, because embroider natively\n // understands how to build each addon's treeForFastboot.\n //\n // But we do want *some*, so we handle those specific bits below in\n // v2Trees.\n return false;\n } else {\n return super.customizes(tree);\n }\n });\n }\n get v2Trees() {\n let trees = super.v2Trees;\n\n // We want to grab the fastboot config and rewrite it. We're going to strip\n // out the expectedFiles that we know are already accounted for, and we're\n // going to add app-factory.js which we know is not.\n trees.push(\n new RewriteManifest(this.addonInstance._buildFastbootConfigTree(this.rootTree), this.scriptFilter, [\n 'ember-cli-fastboot/app-factory.js',\n ])\n );\n\n // We also still need to emit the fastboot app factory module. This emits\n // the actual file into our package.\n trees.push(writeFile('public/app-factory.js', this.appFactoryModule));\n\n return trees;\n }\n\n get packageMeta() {\n let meta = super.packageMeta;\n if (!meta['public-assets']) {\n meta['public-assets'] = {};\n }\n // we need to list app-factory.js as a public asset so it will make it's way\n // into the app's final dist.\n meta['public-assets']['./public/app-factory.js'] = 'ember-cli-fastboot/app-factory.js';\n return meta;\n }\n\n // these are the default files that ember-cli-fastbot includes in its appFiles\n // and vendorFiles that we know are already accounted for by the standard\n // embroider build\n @Memoize()\n private expectedFiles(): string[] {\n let outputPaths = this.addonInstance.app.options.outputPaths;\n function stripLeadingSlash(filePath: string) {\n return filePath.replace(/^\\//, '');\n }\n let appFilePath = stripLeadingSlash(outputPaths.app.js);\n let appFastbootFilePath = appFilePath.replace(/\\.js$/, '') + '-fastboot.js';\n let vendorFilePath = stripLeadingSlash(outputPaths.vendor.js);\n\n // ember-auto-import emits this into the fastboot manifest. But embroider\n // subsumes all of ember-auto-import, so we take responsibility for this\n // stuff directly.\n let autoImportPath = 'assets/auto-import-fastboot.js';\n\n // the compat adapter for ember-asset-loader has already removed the code\n // that reads from this file. And this file fails to get generated because\n // we don't run ember-asset-loader's \"all\" postprocess tree. So we need to\n // remove it here so it doesn't try to load.\n let nodeAssetManifest = 'assets/node-asset-manifest.js';\n\n return [appFilePath, appFastbootFilePath, vendorFilePath, autoImportPath, nodeAssetManifest];\n }\n\n @bind\n private scriptFilter(file: string): boolean {\n // we can drop all of engines-dist here because engines are handled natively\n // by embroider (the engine code is part of the regular module graph)\n return !this.expectedFiles().includes(file) && !file.startsWith('engines-dist/');\n }\n\n @Memoize()\n private get appFactoryModule() {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const fastbootAppFactoryModule = require(join(this.root, 'lib/utilities/fastboot-app-factory-module.js'));\n return fastbootAppFactoryModule(this.addonInstance._name, false);\n }\n}\n\nclass RewriteManifest extends Plugin {\n constructor(tree: Node, private scriptFilter: (file: string) => boolean, private extraAppFiles: string[]) {\n super([tree], {\n annotation: 'embroider-compat-adapter-ember-cli-fastboot',\n persistentOutput: true,\n needsCache: false,\n });\n }\n build() {\n let json = readJSONSync(join(this.inputPaths[0], 'package.json'));\n\n let extraAppFiles = (json.fastboot.manifest.appFiles as string[]).filter(this.scriptFilter);\n\n for (let file of this.extraAppFiles) {\n extraAppFiles.push(file);\n }\n\n let extraVendorFiles = (json.fastboot.manifest.vendorFiles as string[]).filter(this.scriptFilter);\n\n // we're using our own new style of fastboot manifest that loads everything\n // via the HTML. HTML is better understood by tools beyond Ember and\n // Fastboot, so it's more robust to going through third-party bundlers\n // without breaking. We can get by with only a very small extension over\n // purely standards-compliant HTML.\n json.fastboot = {\n schemaVersion: 5,\n htmlEntrypoint: 'index.html',\n moduleWhitelist: json.fastboot.moduleWhitelist,\n hostWhitelist: json.fastboot.hostWhitelist,\n };\n\n // this is a message to Embroider stage2 (in app.ts), because we need it to\n // arrange the one special extension to HTML that we need: fastboot-only\n // script tags.\n //\n // Fastboot only javascript *modules* don't need any magic, because our\n // macro system can guard them. That is the preferred way to have\n // fastboot-only code. But for backward compatibility, we also support\n // fastboot-only *scripts*, and those do need a bit of magic, in the form of\n // <fastboot-script> tags.\n json['embroider-fastboot'] = {\n extraAppFiles,\n extraVendorFiles,\n };\n\n // because we contain a subdir with its own package.json, that subdir\n // becomes a \"package\" from emroider's perspective, and if we want it to get\n // treated as ember code it needs to have v2 addon metadata\n json.keywords = [...(json.keywords ?? []), 'ember-addon'];\n let meta: AddonMeta = {\n type: 'addon',\n version: 2,\n 'auto-upgraded': true,\n };\n json['ember-addon'] = meta;\n\n outputJSONSync(join(this.outputPath, '_fastboot_', 'package.json'), json, { spaces: 2 });\n }\n}\n"]}
1
+ {"version":3,"file":"ember-cli-fastboot.js","sourceRoot":"","sources":["ember-cli-fastboot.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkC;AAClC,sEAAqC;AAErC,uCAAwD;AACxD,+BAA4B;AAC5B,kFAA8C;AAC9C,2DAA6C;AAC7C,oEAAkC;AAGlC,MAAqB,gBAAiB,SAAQ,kBAAO;IACnD,UAAU,CAAC,GAAG,KAAe;QAC3B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;gBAC7B,4DAA4D;gBAC5D,sEAAsE;gBACtE,6DAA6D;gBAC7D,yDAAyD;gBACzD,EAAE;gBACF,mEAAmE;gBACnE,WAAW;gBACX,OAAO,KAAK,CAAC;YACf,CAAC;iBAAM,CAAC;gBACN,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,OAAO;QACT,IAAI,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;QAE1B,2EAA2E;QAC3E,0EAA0E;QAC1E,oDAAoD;QACpD,KAAK,CAAC,IAAI,CACR,IAAI,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE;YACjG,mCAAmC;SACpC,CAAC,CACH,CAAC;QAEF,yEAAyE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,IAAI,CAAC,CAAC;QAC3B,CAAC;QAED,IAAI,gBAAgB,GAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAElG,2EAA2E;QAC3E,oEAAoE;QACpE,sEAAsE;QACtE,wEAAwE;QACxE,mCAAmC;QACnC,IAAI,CAAC,QAAQ,GAAG;YACd,aAAa,EAAE,CAAC;YAChB,cAAc,EAAE,YAAY;YAC5B,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,eAAe;YAC9C,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa;SAC3C,CAAC;QAEF,2EAA2E;QAC3E,wEAAwE;QACxE,eAAe;QACf,EAAE;QACF,uEAAuE;QACvE,iEAAiE;QACjE,sEAAsE;QACtE,4EAA4E;QAC5E,0BAA0B;QAC1B,IAAI,CAAC,oBAAoB,CAAC,GAAG;YAC3B,aAAa;YACb,gBAAgB;SACjB,CAAC;QAEF,qEAAqE;QACrE,4EAA4E;QAC5E,2DAA2D;QAC3D,IAAI,CAAC,QAAQ,GAAG,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,QAAQ,mCAAI,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;QAC1D,IAAI,IAAI,GAAc;YACpB,OAAO,EAAE,CAAC;YACV,eAAe,EAAE,IAAI;SACtB,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;QAE3B,IAAA,yBAAc,EAAC,IAAA,WAAI,EAAC,IAAI,CAAC,UAAU,EAAE,YAAY,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAC3F,CAAC;CACF","sourcesContent":["import V1Addon from '../v1-addon';\nimport Plugin from 'broccoli-plugin';\nimport type { Node } from 'broccoli-node-api';\nimport { readJSONSync, outputJSONSync } from 'fs-extra';\nimport { join } from 'path';\nimport writeFile from 'broccoli-file-creator';\nimport { Memoize } from 'typescript-memoize';\nimport bind from 'bind-decorator';\nimport type { AddonMeta } from '@embroider/core';\n\nexport default class EmberCliFastboot extends V1Addon {\n customizes(...trees: string[]): boolean {\n return trees.some(tree => {\n if (tree === 'treeForPublic') {\n // This is an optimization. It means we won't bother running\n // ember-cli-fastboot's custom treeForPublic at all. We don't actually\n // want *most* of what's in there, because embroider natively\n // understands how to build each addon's treeForFastboot.\n //\n // But we do want *some*, so we handle those specific bits below in\n // v2Trees.\n return false;\n } else {\n return super.customizes(tree);\n }\n });\n }\n get v2Trees() {\n let trees = super.v2Trees;\n\n // We want to grab the fastboot config and rewrite it. We're going to strip\n // out the expectedFiles that we know are already accounted for, and we're\n // going to add app-factory.js which we know is not.\n trees.push(\n new RewriteManifest(this.addonInstance._buildFastbootConfigTree(this.rootTree), this.scriptFilter, [\n 'ember-cli-fastboot/app-factory.js',\n ])\n );\n\n // We also still need to emit the fastboot app factory module. This emits\n // the actual file into our package.\n trees.push(writeFile('public/app-factory.js', this.appFactoryModule));\n\n return trees;\n }\n\n get packageMeta() {\n let meta = super.packageMeta;\n if (!meta['public-assets']) {\n meta['public-assets'] = {};\n }\n // we need to list app-factory.js as a public asset so it will make it's way\n // into the app's final dist.\n meta['public-assets']['./public/app-factory.js'] = 'ember-cli-fastboot/app-factory.js';\n return meta;\n }\n\n // these are the default files that ember-cli-fastbot includes in its appFiles\n // and vendorFiles that we know are already accounted for by the standard\n // embroider build\n @Memoize()\n private expectedFiles(): string[] {\n let outputPaths = this.addonInstance.app.options.outputPaths;\n function stripLeadingSlash(filePath: string) {\n return filePath.replace(/^\\//, '');\n }\n let appFilePath = stripLeadingSlash(outputPaths.app.js);\n let appFastbootFilePath = appFilePath.replace(/\\.js$/, '') + '-fastboot.js';\n let vendorFilePath = stripLeadingSlash(outputPaths.vendor.js);\n\n // ember-auto-import emits this into the fastboot manifest. But embroider\n // subsumes all of ember-auto-import, so we take responsibility for this\n // stuff directly.\n let autoImportPath = 'assets/auto-import-fastboot.js';\n\n // the compat adapter for ember-asset-loader has already removed the code\n // that reads from this file. And this file fails to get generated because\n // we don't run ember-asset-loader's \"all\" postprocess tree. So we need to\n // remove it here so it doesn't try to load.\n let nodeAssetManifest = 'assets/node-asset-manifest.js';\n\n return [appFilePath, appFastbootFilePath, vendorFilePath, autoImportPath, nodeAssetManifest];\n }\n\n @bind\n private scriptFilter(file: string): boolean {\n // we can drop all of engines-dist here because engines are handled natively\n // by embroider (the engine code is part of the regular module graph)\n return !this.expectedFiles().includes(file) && !file.startsWith('engines-dist/');\n }\n\n @Memoize()\n private get appFactoryModule() {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const fastbootAppFactoryModule = require(join(this.root, 'lib/utilities/fastboot-app-factory-module.js'));\n return fastbootAppFactoryModule(this.addonInstance._name, false);\n }\n}\n\nclass RewriteManifest extends Plugin {\n constructor(tree: Node, private scriptFilter: (file: string) => boolean, private extraAppFiles: string[]) {\n super([tree], {\n annotation: 'embroider-compat-adapter-ember-cli-fastboot',\n persistentOutput: true,\n needsCache: false,\n });\n }\n build() {\n let json = readJSONSync(join(this.inputPaths[0], 'package.json'));\n\n let extraAppFiles = (json.fastboot.manifest.appFiles as string[]).filter(this.scriptFilter);\n\n for (let file of this.extraAppFiles) {\n extraAppFiles.push(file);\n }\n\n let extraVendorFiles = (json.fastboot.manifest.vendorFiles as string[]).filter(this.scriptFilter);\n\n // we're using our own new style of fastboot manifest that loads everything\n // via the HTML. HTML is better understood by tools beyond Ember and\n // Fastboot, so it's more robust to going through third-party bundlers\n // without breaking. We can get by with only a very small extension over\n // purely standards-compliant HTML.\n json.fastboot = {\n schemaVersion: 5,\n htmlEntrypoint: 'index.html',\n moduleWhitelist: json.fastboot.moduleWhitelist,\n hostWhitelist: json.fastboot.hostWhitelist,\n };\n\n // this is a message to Embroider stage2 (in app.ts), because we need it to\n // arrange the one special extension to HTML that we need: fastboot-only\n // script tags.\n //\n // Fastboot only javascript *modules* don't need any magic, because our\n // macro system can guard them. That is the preferred way to have\n // fastboot-only code. But for backward compatibility, we also support\n // fastboot-only *scripts*, and those do need a bit of magic, in the form of\n // <fastboot-script> tags.\n json['embroider-fastboot'] = {\n extraAppFiles,\n extraVendorFiles,\n };\n\n // because we contain a subdir with its own package.json, that subdir\n // becomes a \"package\" from emroider's perspective, and if we want it to get\n // treated as ember code it needs to have v2 addon metadata\n json.keywords = [...(json.keywords ?? []), 'ember-addon'];\n let meta: AddonMeta = {\n version: 2,\n 'auto-upgraded': true,\n };\n json['ember-addon'] = meta;\n\n outputJSONSync(join(this.outputPath, '_fastboot_', 'package.json'), json, { spaces: 2 });\n }\n}\n"]}
@@ -11,7 +11,6 @@ class default_1 extends v1_addon_1.default {
11
11
  return super.packageMeta;
12
12
  }
13
13
  return {
14
- type: 'addon',
15
14
  version: 2,
16
15
  'auto-upgraded': true,
17
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ember-cli-mirage.js","sourceRoot":"","sources":["ember-cli-mirage.ts"],"names":[],"mappings":";;;;;AAAA,2DAAkC;AAClC,sEAA0C;AAG1C,eAAqB,SAAQ,kBAAO;IAClC,IAAI,WAAW;QACb,IAAI,IAAI,CAAC,aAAa,CAAC,mBAAmB,EAAE,EAAE,CAAC;YAC7C,OAAO,KAAK,CAAC,WAAW,CAAC;QAC3B,CAAC;QACD,OAAO;YACL,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,CAAC;YACV,eAAe,EAAE,IAAI;SACtB,CAAC;IACJ,CAAC;IAED,IAAI,MAAM;QACR,IAAI,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC;QACxB,IAAI,IAAI,CAAC,aAAa,CAAC,mBAAmB,EAAE,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAA,yBAAW,EAAC,IAAI,EAAE;YACvB,OAAO,EAAE,CAAC,cAAc,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AArBD,4BAqBC","sourcesContent":["import V1Addon from '../v1-addon';\nimport buildFunnel from 'broccoli-funnel';\nimport type { AddonMeta } from '@embroider/core';\n\nexport default class extends V1Addon {\n get packageMeta(): Partial<AddonMeta> {\n if (this.addonInstance._shouldIncludeFiles()) {\n return super.packageMeta;\n }\n return {\n type: 'addon',\n version: 2,\n 'auto-upgraded': true,\n };\n }\n\n get v2Tree() {\n let tree = super.v2Tree;\n if (this.addonInstance._shouldIncludeFiles()) {\n return tree;\n }\n return buildFunnel(tree, {\n include: ['package.json'],\n });\n }\n}\n"]}
1
+ {"version":3,"file":"ember-cli-mirage.js","sourceRoot":"","sources":["ember-cli-mirage.ts"],"names":[],"mappings":";;;;;AAAA,2DAAkC;AAClC,sEAA0C;AAG1C,eAAqB,SAAQ,kBAAO;IAClC,IAAI,WAAW;QACb,IAAI,IAAI,CAAC,aAAa,CAAC,mBAAmB,EAAE,EAAE,CAAC;YAC7C,OAAO,KAAK,CAAC,WAAW,CAAC;QAC3B,CAAC;QACD,OAAO;YACL,OAAO,EAAE,CAAC;YACV,eAAe,EAAE,IAAI;SACtB,CAAC;IACJ,CAAC;IAED,IAAI,MAAM;QACR,IAAI,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC;QACxB,IAAI,IAAI,CAAC,aAAa,CAAC,mBAAmB,EAAE,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAA,yBAAW,EAAC,IAAI,EAAE;YACvB,OAAO,EAAE,CAAC,cAAc,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AApBD,4BAoBC","sourcesContent":["import V1Addon from '../v1-addon';\nimport buildFunnel from 'broccoli-funnel';\nimport type { AddonMeta } from '@embroider/core';\n\nexport default class extends V1Addon {\n get packageMeta(): Partial<AddonMeta> {\n if (this.addonInstance._shouldIncludeFiles()) {\n return super.packageMeta;\n }\n return {\n version: 2,\n 'auto-upgraded': true,\n };\n }\n\n get v2Tree() {\n let tree = super.v2Tree;\n if (this.addonInstance._shouldIncludeFiles()) {\n return tree;\n }\n return buildFunnel(tree, {\n include: ['package.json'],\n });\n }\n}\n"]}
package/src/compat-app.js CHANGED
@@ -343,7 +343,6 @@ class CompatApp {
343
343
  }
344
344
  let remapAsset = this.remapAsset.bind(this);
345
345
  let addonMeta = {
346
- type: 'addon',
347
346
  version: 2,
348
347
  'implicit-scripts': this._implicitScripts.map(remapAsset).filter(forbiddenVendorPath),
349
348
  'implicit-styles': this._implicitStyles.map(remapAsset),
@@ -397,7 +396,6 @@ class CompatApp {
397
396
  let styles = this.preprocessors.preprocessCss(nestedInput, '/app/styles', '/assets', options);
398
397
  return new add_to_tree_1.default(styles, outputPath => {
399
398
  let addonMeta = {
400
- type: 'addon',
401
399
  version: 2,
402
400
  'public-assets': {},
403
401
  };
@@ -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,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;YACx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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;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"]}
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,sBA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ADC,IAAA,4BAAO,GAAE;iDAST;AAGD;IADC,IAAA,4BAAO,GAAE;kDAGT;AAgBD;IADC,IAAA,4BAAO,GAAE;+CAGT;AAGD;IADC,IAAA,4BAAO,GAAE;mDAGT;AAmBD;IADC,IAAA,4BAAO,GAAE;uCAGT;AAGD;IADC,IAAA,4BAAO,GAAE;2CAKT;AAGD;IADC,IAAA,4BAAO,GAAE;2CAWT;AAWD;IADC,IAAA,4BAAO,GAAE;sDAOT;AAWD;IADC,IAAA,4BAAO,GAAE;kDA0BT;AAGD;IADC,IAAA,4BAAO,GAAE;kDAyBT;AAGO;IADP,IAAA,4BAAO,GAAE;qDAgBT;AAgTD;IADC,IAAA,4BAAO,GAAE;8CAGT;AA0CD;IADC,IAAA,4BAAO,GAAE;2CAcT;AA0DH,SAAS,mBAAmB,CAAC,IAAY;IACvC,wEAAwE;IACxE,uBAAuB;IACvB,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 version: 2,\n 'implicit-scripts': this._implicitScripts.map(remapAsset).filter(forbiddenVendorPath),\n 'implicit-styles': this._implicitStyles.map(remapAsset),\n 'implicit-test-scripts': this.legacyEmberAppInstance.legacyTestFilesToAppend.map(remapAsset),\n 'implicit-test-styles': this.legacyEmberAppInstance.vendorTestStaticStyles.map(remapAsset),\n 'public-assets': mapKeys(this._publicAssets, (_, key) => remapAsset(key)),\n };\n let meta: PackageInfo = {\n name: '@embroider/synthesized-vendor',\n version: '0.0.0',\n keywords: ['ember-addon'],\n 'ember-addon': addonMeta,\n };\n writeJSONSync(join(outputPath, 'package.json'), meta, { spaces: 2 });\n });\n }\n\n synthesizeVendorPackage(addonTrees: BroccoliNode[]): BroccoliNode {\n return this.applyCustomTransforms(this.addNodeAssets(this.combinedVendor(addonTrees)));\n }\n\n private combinedStyles(addonTrees: BroccoliNode[]): BroccoliNode {\n let trees: BroccoliNode[] = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: '_app_styles_',\n })\n );\n let appStyles = this.legacyEmberAppInstance.trees.styles as BroccoliNode | undefined;\n if (appStyles) {\n // Workaround for https://github.com/ember-cli/ember-cli/issues/9020\n //\n // The default app styles tree is unwatched and relies on side effects\n // elsewhere in ember-cli's build pipeline to actually get rebuilds to\n // work. Here we need it to actually be watched properly if we want to\n // rely on it, particularly when using BROCCOLI_ENABLED_MEMOIZE.\n if ((appStyles as any)._watched === false && (appStyles as any)._directoryPath) {\n appStyles = new WatchedDir((appStyles as any)._directoryPath);\n }\n trees.push(appStyles);\n }\n return mergeTrees(trees, { overwrite: true, annotation: 'embroider-v1-app-combined-styles' });\n }\n\n synthesizeStylesPackage(addonTrees: BroccoliNode[]): BroccoliNode {\n let options = {\n // we're deliberately not allowing this to be customized. It's an\n // internal implementation detail, and respecting outputPaths here is\n // unnecessary complexity. The corresponding code that adjusts the HTML\n // <link> is in updateHTML in app.ts.\n outputPaths: { app: `/assets/${this.name}.css` },\n registry: this.legacyEmberAppInstance.registry,\n minifyCSS: this.legacyEmberAppInstance.options.minifyCSS.options,\n };\n\n let nestedInput = buildFunnel(this.combinedStyles(addonTrees), { destDir: 'app/styles' });\n let styles = this.preprocessors.preprocessCss(nestedInput, '/app/styles', '/assets', options);\n\n return new AddToTree(styles, outputPath => {\n let addonMeta: AddonMeta = {\n version: 2,\n 'public-assets': {},\n };\n let assetPath = join(outputPath, 'assets');\n if (pathExistsSync(assetPath)) {\n for (let file of walkSync(assetPath, { directories: false })) {\n addonMeta['public-assets']![`./assets/${file}`] = `/assets/${file}`;\n }\n }\n let meta: PackageInfo = {\n name: '@embroider/synthesized-styles',\n version: '0.0.0',\n keywords: ['ember-addon'],\n 'ember-addon': addonMeta,\n };\n writeJSONSync(join(outputPath, 'package.json'), meta, { spaces: 2 });\n });\n }\n\n // this is taken nearly verbatim from ember-cli.\n private applyCustomTransforms(externalTree: BroccoliNode) {\n for (let customTransformEntry of this.legacyEmberAppInstance._customTransformsMap) {\n let transformName = customTransformEntry[0];\n let transformConfig = customTransformEntry[1];\n\n let transformTree = buildFunnel(externalTree, {\n files: transformConfig.files,\n annotation: `Funnel (custom transform: ${transformName})`,\n });\n\n externalTree = mergeTrees([externalTree, transformConfig.callback(transformTree, transformConfig.options)], {\n annotation: `TreeMerger (custom transform: ${transformName})`,\n overwrite: true,\n });\n }\n return externalTree;\n }\n\n private remapAsset(asset: string) {\n if (this.transformedNodeFiles().has(asset)) {\n // transformed node assets become local paths, because we have copied\n // those ones into our synthesized vendor package.\n return './' + asset;\n }\n let preresolved = this.preresolvedNodeFile(asset);\n if (preresolved) {\n // non-transformed node assets point directly at their pre-resolved\n // original files (this is an absolute path).\n return preresolved;\n }\n // non node assets are local paths. They need an explicit `/` or `.` at\n // the start.\n if (asset.startsWith('.') || isAbsolute(asset)) {\n return asset;\n }\n return './' + asset;\n }\n\n get htmlbarsPlugins(): Transform[] {\n let plugins = loadAstPlugins(this.legacyEmberAppInstance.registry);\n // even if the app was using @embroider/macros, we drop it from the config\n // here in favor of our globally-configured one.\n plugins = plugins.filter((p: any) => !isEmbroiderMacrosPlugin(p));\n return plugins;\n }\n\n private get vendorTree(): BroccoliNode | undefined {\n return this.ensureTree(this.legacyEmberAppInstance.trees.vendor);\n }\n\n private ensureTree(maybeTree: string | BroccoliNode | undefined): BroccoliNode | undefined {\n if (typeof maybeTree === 'string') {\n // this is deliberately mimicking how ember-cli does it. We don't use\n // `this.root` on purpose, because that can differ from what ember-cli\n // considers the project.root. And we don't use path.resolve even though\n // that seems possibly more correct, because ember-cli always assumes the\n // input is relative.\n let resolvedPath = join(this.legacyEmberAppInstance.project.root, maybeTree);\n if (existsSync(resolvedPath)) {\n return new WatchedDir(maybeTree);\n } else {\n return undefined;\n }\n }\n return maybeTree;\n }\n\n @Memoize()\n private get preprocessors(): Preprocessors {\n return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');\n }\n\n readonly macrosConfig: MacrosConfig;\n\n constructor(readonly legacyEmberAppInstance: EmberAppInstance, _options?: Options) {\n this.options = optionsWithDefaults(_options);\n\n this.macrosConfig = MacrosConfig.for(legacyEmberAppInstance, this.root);\n if (this.env !== 'production') {\n this.macrosConfig.enablePackageDevelopment(this.root);\n this.macrosConfig.enableRuntimeMode();\n if (this.isDummy) {\n // dummy apps automatically put their owning addon under development too\n this.macrosConfig.enablePackageDevelopment(\n dirname(pkgUpSync({ cwd: this.legacyEmberAppInstance.project.root })!)\n );\n }\n }\n\n // this uses globalConfig because it's a way for packages to ask \"is\n // Embroider doing this build?\". So it's necessarily global, not scoped to\n // any subgraph of dependencies.\n this.macrosConfig.setGlobalConfig(__filename, `@embroider/core`, {\n // this is hard-coded to true because it literally means \"embroider is\n // building this Ember app\". You can see non-true when using the Embroider\n // macros in a classic build.\n active: true,\n });\n }\n\n private inTrees(prevStageTree: BroccoliNode) {\n let configTree = this.config;\n let contentForTree = this.contentFor;\n\n return {\n configTree,\n contentForTree,\n prevStageTree,\n };\n }\n\n @Memoize()\n appPackage(): Package {\n // this is deliberately not RewrittenPackageCache, because it's supposed to\n // be the original copy of the app with all the original dependencies.\n let packageCache = PackageCache.shared('embroider', this.root);\n if (this.isDummy) {\n return new DummyPackage(\n this.root,\n this.legacyEmberAppInstance.project.root,\n packageCache as unknown as PackageCache // TODO: cast won't be needed when refactor is complete\n );\n } else {\n return packageCache.get(this.root);\n }\n }\n\n private async instantiate(\n packageCache: RewrittenPackageCache,\n configTree: V1Config,\n contentForTree: ContentForConfig\n ) {\n let origAppPkg = this.appPackage();\n let movedAppPkg = packageCache.withRewrittenDeps(origAppPkg);\n let workingDir = locateEmbroiderWorkingDir(this.root);\n return new CompatAppBuilder(\n origAppPkg,\n movedAppPkg,\n this.options,\n this,\n configTree,\n contentForTree,\n packageCache.get(join(workingDir, 'rewritten-packages', '@embroider', 'synthesized-vendor')),\n packageCache.get(join(workingDir, 'rewritten-packages', '@embroider', 'synthesized-styles'))\n );\n }\n\n asStage(prevStage: Stage): Stage {\n let resolve: (result: { outputPath: string }) => void;\n let promise: Promise<{ outputPath: string }> = new Promise(r => (resolve = r));\n\n let tree = () => {\n let inTrees = this.inTrees(prevStage.tree);\n return new WaitForTrees(inTrees, this.annotation, async _treePaths => {\n if (!this.active) {\n let { outputPath } = await prevStage.ready();\n let packageCache = RewrittenPackageCache.shared('embroider', this.root);\n this.active = await this.instantiate(packageCache, inTrees.configTree, inTrees.contentForTree);\n resolve({ outputPath });\n }\n await this.active.build();\n });\n };\n\n return {\n get inputPath() {\n return prevStage.inputPath;\n },\n ready: async () => {\n return await promise;\n },\n get tree() {\n return tree();\n },\n };\n }\n}\n\ninterface Preprocessors {\n preprocessJs(tree: BroccoliNode, a: string, b: string, options: object): BroccoliNode;\n preprocessCss(tree: BroccoliNode, a: string, b: string, options: object): BroccoliNode;\n}\n\nfunction forbiddenVendorPath(path: string) {\n // ember-source does not go in vendor under embroider (we always use the\n // separate ES modules)\n //\n // loader.js sets up AMD. We don't use AMD.\n return !['./vendor/loader/loader.js', './vendor/ember/ember.js'].includes(path);\n}\n"]}
package/src/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export { default as Options, recommendedOptions } from './options';
4
4
  export { default as V1Addon } from './v1-addon';
5
5
  export { prebuild, PipelineOptions } from './default-pipeline';
6
6
  export { PackageRules, ModuleRules } from './dependency-rules';
7
+ export type { Options as ResolverTransformOptions } from './resolver-transform';
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA,2CAA8C;AAArC,kHAAA,OAAO,OAAO;AACvB,iDAAoD;AAA3C,wHAAA,OAAO,OAAU;AAC1B,qCAAmE;AAAtC,6GAAA,kBAAkB,OAAA;AAC/C,uCAAgD;AAAvC,oHAAA,OAAO,OAAW;AAC3B,uDAA+D;AAAtD,4GAAA,QAAQ,OAAA","sourcesContent":["export { default as App } from './compat-app';\nexport { default as Addons } from './compat-addons';\nexport { default as Options, recommendedOptions } from './options';\nexport { default as V1Addon } from './v1-addon';\nexport { prebuild, PipelineOptions } from './default-pipeline';\nexport { PackageRules, ModuleRules } from './dependency-rules';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA,2CAA8C;AAArC,kHAAA,OAAO,OAAO;AACvB,iDAAoD;AAA3C,wHAAA,OAAO,OAAU;AAC1B,qCAAmE;AAAtC,6GAAA,kBAAkB,OAAA;AAC/C,uCAAgD;AAAvC,oHAAA,OAAO,OAAW;AAC3B,uDAA+D;AAAtD,4GAAA,QAAQ,OAAA","sourcesContent":["export { default as App } from './compat-app';\nexport { default as Addons } from './compat-addons';\nexport { default as Options, recommendedOptions } from './options';\nexport { default as V1Addon } from './v1-addon';\nexport { prebuild, PipelineOptions } from './default-pipeline';\nexport { PackageRules, ModuleRules } from './dependency-rules';\nexport type { Options as ResolverTransformOptions } from './resolver-transform';\n"]}
@@ -141,7 +141,7 @@ class TemplateResolver {
141
141
  });
142
142
  return;
143
143
  }
144
- let resolution = this.targetComponent(node.path.original);
144
+ let resolution = this.targetComponent(node.path.original, node.path.original);
145
145
  this.emit(path, resolution, (node, newId) => {
146
146
  node.path = newId;
147
147
  });
@@ -283,7 +283,7 @@ class TemplateResolver {
283
283
  // if it starts with lower case, it can't be a component we need to
284
284
  // globally resolve
285
285
  if (node.tag[0] !== node.tag[0].toLowerCase()) {
286
- resolution = this.targetComponent((0, dasherize_component_name_1.dasherize)(node.tag));
286
+ resolution = this.targetComponent((0, dasherize_component_name_1.dasherize)(node.tag), node.tag);
287
287
  }
288
288
  this.emit(path, resolution, (node, newId) => {
289
289
  node.tag = newId.original;
@@ -503,7 +503,7 @@ class TemplateResolver {
503
503
  }
504
504
  return name;
505
505
  }
506
- targetComponent(name) {
506
+ targetComponent(name, nameHint) {
507
507
  if (!this.staticComponentsEnabled) {
508
508
  return null;
509
509
  }
@@ -534,7 +534,7 @@ class TemplateResolver {
534
534
  yieldsComponents: componentRules ? componentRules.yieldsSafeComponents : [],
535
535
  yieldsArguments: componentRules ? componentRules.yieldsArguments : [],
536
536
  argumentsAreComponents: componentRules ? componentRules.argumentsAreComponents : [],
537
- nameHint: this.nameHint(name),
537
+ nameHint: this.nameHint(nameHint),
538
538
  };
539
539
  }
540
540
  targetComponentHelper(component, loc, impliedBecause) {
@@ -568,7 +568,7 @@ class TemplateResolver {
568
568
  loc,
569
569
  };
570
570
  }
571
- return this.targetComponent(component.path);
571
+ return this.targetComponent(component.path, component.path);
572
572
  }
573
573
  targetHelper(path) {
574
574
  if (!this.staticHelpersEnabled) {
@@ -682,7 +682,7 @@ class TemplateResolver {
682
682
  if (ownComponentRules === null || ownComponentRules === void 0 ? void 0 : ownComponentRules.disambiguate[path]) {
683
683
  switch (ownComponentRules.disambiguate[path]) {
684
684
  case 'component':
685
- return this.targetComponent(path);
685
+ return this.targetComponent(path, path);
686
686
  case 'helper':
687
687
  return this.targetHelper(path);
688
688
  case 'data':
@@ -1 +1 @@
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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AAS,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
+ {"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;Q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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, nameHint: 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(nameHint),\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, 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, 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, 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), 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,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/src/audit-cli.js DELETED
@@ -1,150 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const fs_extra_1 = require("fs-extra");
8
- const path_1 = require("path");
9
- const yargs_1 = __importDefault(require("yargs/yargs"));
10
- const audit_1 = require("./audit");
11
- // slightly wacky because yargs types don't cover this, but you can't access the
12
- // other documented place to find `hideBin` on node < 12.17
13
- const { hideBin } = yargs_1.default;
14
- function runCLI() {
15
- return (0, yargs_1.default)(hideBin(process.argv))
16
- .command('$0', 'audit your app for embroider compatibility problems', yargs => {
17
- return yargs
18
- .option('debug', {
19
- alias: 'd',
20
- type: 'boolean',
21
- description: 'Add debug logging about the audit itself',
22
- default: false,
23
- })
24
- .option('json', {
25
- alias: 'j',
26
- type: 'boolean',
27
- description: 'Print results in JSON format',
28
- default: false,
29
- })
30
- .option('reuse-build', {
31
- alias: 'r',
32
- type: 'boolean',
33
- description: 'Reuse previous build',
34
- default: false,
35
- })
36
- .option('load', {
37
- alias: 'l',
38
- type: 'string',
39
- description: 'Load previous audit results from a JSON file instead of running a new audit',
40
- })
41
- .option('save', {
42
- alias: 's',
43
- type: 'string',
44
- description: 'Save audit results as a JSON file.',
45
- })
46
- .option('app', {
47
- type: 'string',
48
- description: 'Path to your app',
49
- default: process.cwd(),
50
- })
51
- .option('filter', {
52
- type: 'string',
53
- description: 'Path to a JS file that describes which findings to silence. Generate the initial file using `--create-filter`.',
54
- })
55
- .option('create-filter', {
56
- type: 'string',
57
- description: 'Path to a JS file where we will create a filter that will silence all your current findings. Pass it back into future audits via --filter',
58
- })
59
- .fail(function (_, err, _yargs) {
60
- if ((0, audit_1.isBuildError)(err)) {
61
- process.stderr.write(err.message + '\n');
62
- }
63
- else {
64
- console.error(err);
65
- }
66
- process.exit(1);
67
- });
68
- }, async (options) => {
69
- let filter = loadFilter(options);
70
- let results;
71
- if (options.load) {
72
- results = new audit_1.AuditResults();
73
- Object.assign(results, (0, fs_extra_1.readJSONSync)(options.load));
74
- }
75
- else {
76
- results = await audit_1.Audit.run(options);
77
- }
78
- if (options.save) {
79
- (0, fs_extra_1.writeFileSync)(options.save, JSON.stringify(results, null, 2));
80
- }
81
- applyFilter(filter, results);
82
- if (options.json) {
83
- process.stdout.write(JSON.stringify(results, null, 2) + '\n');
84
- }
85
- else {
86
- process.stdout.write(results.humanReadable());
87
- }
88
- if (options['create-filter']) {
89
- createFilter(options['create-filter'], results);
90
- }
91
- process.exit(results.perfect ? 0 : 1);
92
- })
93
- .command('pretty', 'format JSON audit results as pretty human-readable results', yargs => {
94
- return yargs.option('filter', {
95
- type: 'string',
96
- description: 'Path to a JS file that describes which findings to silence. Generate the file using `embroider-compat-audit acknowledge`',
97
- });
98
- }, async (options) => {
99
- let filter = loadFilter(options);
100
- let results = new audit_1.AuditResults();
101
- // process.stdin.fd is a documented public API. The Node typings don't
102
- // seem to know about it.
103
- Object.assign(results, JSON.parse((0, fs_extra_1.readFileSync)(process.stdin.fd, 'utf8')));
104
- applyFilter(filter, results);
105
- process.stdout.write(results.humanReadable());
106
- process.exit(0);
107
- })
108
- .command('acknowledge', 'Pipe your audit JSON to this command to generate a filter file that will silence the current issues. Pass the filter file into your next audit via --filter. Delete findings out of the filter file as you address them.', yargs => yargs, async () => {
109
- let results = new audit_1.AuditResults();
110
- // process.stdin.fd is a documented public API. The Node typings don't
111
- // seem to know about it.
112
- Object.assign(results, JSON.parse((0, fs_extra_1.readFileSync)(process.stdin.fd, 'utf8')));
113
- let findings = results.findings.map(f => ({
114
- filename: f.filename,
115
- message: f.message,
116
- detail: f.detail,
117
- }));
118
- process.stdout.write(`module.exports = ${JSON.stringify({ findings }, null, 2)};\n`);
119
- process.exit(0);
120
- }).argv;
121
- }
122
- if (require.main === module) {
123
- runCLI();
124
- }
125
- function loadFilter(options) {
126
- if (options.filter) {
127
- // eslint-disable-next-line @typescript-eslint/no-require-imports
128
- return require((0, path_1.resolve)(options.filter));
129
- }
130
- }
131
- function applyFilter(filter, results) {
132
- if (filter) {
133
- results.findings = results.findings.filter(finding => {
134
- return !filter.findings.find(filtered => {
135
- return (filtered.message === finding.message &&
136
- filtered.detail === finding.detail &&
137
- filtered.filename === finding.filename);
138
- });
139
- });
140
- }
141
- }
142
- function createFilter(filename, results) {
143
- let findings = results.findings.map(f => ({
144
- filename: f.filename,
145
- message: f.message,
146
- detail: f.detail,
147
- }));
148
- (0, fs_extra_1.writeFileSync)(filename, `module.exports = ${JSON.stringify({ findings }, null, 2)};\n`);
149
- }
150
- //# sourceMappingURL=audit-cli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit-cli.js","sourceRoot":"","sources":["aud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Q,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ,CACvC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,QAAgB,EAAE,OAAqB;IAC3D,IAAI,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACxC,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,MAAM,EAAE,CAAC,CAAC,MAAM;KACjB,CAAC,CAAC,CAAC;IACJ,IAAA,wBAAa,EAAC,QAAQ,EAAE,oBAAoB,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport { readFileSync, readJSONSync, writeFileSync } from 'fs-extra';\nimport { resolve } from 'path';\nimport yargs from 'yargs/yargs';\nimport type { Finding } from './audit';\nimport { Audit, AuditResults, isBuildError } from './audit';\n\n// slightly wacky because yargs types don't cover this, but you can't access the\n// other documented place to find `hideBin` on node < 12.17\nconst { hideBin } = yargs as any as {\n hideBin(argv: readonly string[]): readonly string[];\n};\n\nfunction runCLI() {\n return yargs(hideBin(process.argv))\n .command(\n '$0',\n 'audit your app for embroider compatibility problems',\n yargs => {\n return yargs\n .option('debug', {\n alias: 'd',\n type: 'boolean',\n description: 'Add debug logging about the audit itself',\n default: false,\n })\n .option('json', {\n alias: 'j',\n type: 'boolean',\n description: 'Print results in JSON format',\n default: false,\n })\n .option('reuse-build', {\n alias: 'r',\n type: 'boolean',\n description: 'Reuse previous build',\n default: false,\n })\n .option('load', {\n alias: 'l',\n type: 'string',\n description: 'Load previous audit results from a JSON file instead of running a new audit',\n })\n .option('save', {\n alias: 's',\n type: 'string',\n description: 'Save audit results as a JSON file.',\n })\n .option('app', {\n type: 'string',\n description: 'Path to your app',\n default: process.cwd(),\n })\n .option('filter', {\n type: 'string',\n description:\n 'Path to a JS file that describes which findings to silence. Generate the initial file using `--create-filter`.',\n })\n .option('create-filter', {\n type: 'string',\n description:\n 'Path to a JS file where we will create a filter that will silence all your current findings. Pass it back into future audits via --filter',\n })\n .fail(function (_, err, _yargs) {\n if (isBuildError(err)) {\n process.stderr.write(err.message + '\\n');\n } else {\n console.error(err);\n }\n process.exit(1);\n });\n },\n async options => {\n let filter = loadFilter(options);\n let results: AuditResults;\n if (options.load) {\n results = new AuditResults();\n Object.assign(results, readJSONSync(options.load));\n } else {\n results = await Audit.run(options);\n }\n if (options.save) {\n writeFileSync(options.save, JSON.stringify(results, null, 2));\n }\n applyFilter(filter, results);\n if (options.json) {\n process.stdout.write(JSON.stringify(results, null, 2) + '\\n');\n } else {\n process.stdout.write(results.humanReadable());\n }\n if (options['create-filter']) {\n createFilter(options['create-filter'], results);\n }\n process.exit(results.perfect ? 0 : 1);\n }\n )\n .command(\n 'pretty',\n 'format JSON audit results as pretty human-readable results',\n yargs => {\n return yargs.option('filter', {\n type: 'string',\n description:\n 'Path to a JS file that describes which findings to silence. Generate the file using `embroider-compat-audit acknowledge`',\n });\n },\n async options => {\n let filter = loadFilter(options);\n let results = new AuditResults();\n // process.stdin.fd is a documented public API. The Node typings don't\n // seem to know about it.\n Object.assign(results, JSON.parse(readFileSync((process.stdin as any).fd, 'utf8')));\n applyFilter(filter, results);\n process.stdout.write(results.humanReadable());\n process.exit(0);\n }\n )\n .command(\n 'acknowledge',\n 'Pipe your audit JSON to this command to generate a filter file that will silence the current issues. Pass the filter file into your next audit via --filter. Delete findings out of the filter file as you address them.',\n yargs => yargs,\n async () => {\n let results = new AuditResults();\n // process.stdin.fd is a documented public API. The Node typings don't\n // seem to know about it.\n Object.assign(results, JSON.parse(readFileSync((process.stdin as any).fd, 'utf8')));\n let findings = results.findings.map(f => ({\n filename: f.filename,\n message: f.message,\n detail: f.detail,\n }));\n process.stdout.write(`module.exports = ${JSON.stringify({ findings }, null, 2)};\\n`);\n process.exit(0);\n }\n ).argv;\n}\n\nif (require.main === module) {\n runCLI();\n}\n\ntype Filter = { findings: Omit<Finding, 'codeFrame'>[] };\n\nfunction loadFilter(options: { filter: string | undefined }): Filter | undefined {\n if (options.filter) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(resolve(options.filter));\n }\n}\n\nfunction applyFilter(filter: Filter | undefined, results: AuditResults) {\n if (filter) {\n results.findings = results.findings.filter(finding => {\n return !filter!.findings.find(filtered => {\n return (\n filtered.message === finding.message &&\n filtered.detail === finding.detail &&\n filtered.filename === finding.filename\n );\n });\n });\n }\n}\n\nfunction createFilter(filename: string, results: AuditResults) {\n let findings = results.findings.map(f => ({\n filename: f.filename,\n message: f.message,\n detail: f.detail,\n }));\n writeFileSync(filename, `module.exports = ${JSON.stringify({ findings }, null, 2)};\\n`);\n}\n"]}