@embroider/compat 3.1.5-unstable.d660c6a → 3.1.5

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Edward Faulkner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/compat",
3
- "version": "3.1.5-unstable.d660c6a",
3
+ "version": "3.1.5",
4
4
  "private": false,
5
5
  "description": "Backward compatibility layer for the Embroider build system.",
6
6
  "repository": {
@@ -19,9 +19,6 @@
19
19
  "bin": {
20
20
  "embroider-compat-audit": "./src/audit-cli.js"
21
21
  },
22
- "scripts": {
23
- "test": "jest"
24
- },
25
22
  "dependencies": {
26
23
  "@babel/code-frame": "^7.14.5",
27
24
  "@babel/core": "^7.14.5",
@@ -30,7 +27,6 @@
30
27
  "@babel/preset-env": "^7.14.5",
31
28
  "@babel/runtime": "^7.18.6",
32
29
  "@babel/traverse": "^7.14.5",
33
- "@embroider/macros": "1.12.3-unstable.d660c6a",
34
30
  "@types/babel__code-frame": "^7.0.2",
35
31
  "@types/yargs": "^17.0.3",
36
32
  "assert-never": "^1.1.0",
@@ -63,11 +59,10 @@
63
59
  "tree-sync": "^2.1.0",
64
60
  "typescript-memoize": "^1.0.1",
65
61
  "walk-sync": "^3.0.0",
66
- "yargs": "^17.0.1"
62
+ "yargs": "^17.0.1",
63
+ "@embroider/macros": "1.12.3"
67
64
  },
68
65
  "devDependencies": {
69
- "@embroider/sample-transforms": "workspace:*",
70
- "@embroider/test-support": "workspace:*",
71
66
  "@glimmer/syntax": "^0.84.2",
72
67
  "@glint/template": "^1.0.0",
73
68
  "@types/babel__core": "^7.1.14",
@@ -87,15 +82,20 @@
87
82
  "code-equality-assertions": "^0.9.0",
88
83
  "ember-engines": "^0.8.19",
89
84
  "scenario-tester": "^2.1.2",
90
- "typescript": "^5.1.6"
85
+ "typescript": "^5.1.6",
86
+ "@embroider/sample-transforms": "0.0.0",
87
+ "@embroider/test-support": "0.36.0"
91
88
  },
92
89
  "peerDependencies": {
93
- "@embroider/core": "3.1.3-unstable.d660c6a"
90
+ "@embroider/core": "^3.1.3"
94
91
  },
95
92
  "engines": {
96
93
  "node": "12.* || 14.* || >= 16"
97
94
  },
98
95
  "volta": {
99
96
  "extends": "../../package.json"
97
+ },
98
+ "scripts": {
99
+ "test": "jest"
100
100
  }
101
- }
101
+ }
@@ -26,17 +26,17 @@ class BuildError extends Error {
26
26
  }
27
27
  exports.BuildError = BuildError;
28
28
  function isBuildError(err) {
29
- return err?.isBuildError;
29
+ return err === null || err === void 0 ? void 0 : err.isBuildError;
30
30
  }
31
31
  exports.isBuildError = isBuildError;
32
32
  async function execute(shellCommand, opts) {
33
33
  let env;
34
- if (opts?.env) {
34
+ if (opts === null || opts === void 0 ? void 0 : opts.env) {
35
35
  env = { ...process.env, ...opts.env };
36
36
  }
37
37
  let child = (0, child_process_1.spawn)(shellCommand, {
38
38
  stdio: ['inherit', 'pipe', 'pipe'],
39
- cwd: opts?.pwd,
39
+ cwd: opts === null || opts === void 0 ? void 0 : opts.pwd,
40
40
  shell: true,
41
41
  env,
42
42
  });
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,iDAAsC;AAE/B,KAAK,UAAU,QAAQ,CAAC,OAA0B;IACvD,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,6CAA6C,EAAE;QACxE,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE;YACH,WAAW,EAAE,MAAM;SACpB;KACF,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE;QACzB,MAAM,IAAI,UAAU,CAClB,GAAG,eAAK,CAAC,MAAM,CAAC,uBAAuB,CAAC,qDAAqD,MAAM,CAAC,MAAM,EAAE,CAC7G,CAAC;KACH;AACH,CAAC;AAbD,4BAaC;AAED,MAAa,UAAW,SAAQ,KAAK;IAEnC,YAAY,WAAmB;QAC7B,KAAK,CAAC,WAAW,CAAC,CAAC;QAFrB,iBAAY,GAAG,IAAI,CAAC;IAGpB,CAAC;CACF;AALD,gCAKC;AAED,SAAgB,YAAY,CAAC,GAAQ;IACnC,OAAO,GAAG,EAAE,YAAY,CAAC;AAC3B,CAAC;AAFD,oCAEC;AAED,KAAK,UAAU,OAAO,CACpB,YAAoB,EACpB,IAAqD;IAOrD,IAAI,GAAmD,CAAC;IACxD,IAAI,IAAI,EAAE,GAAG,EAAE;QACb,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;KACvC;IACD,IAAI,KAAK,GAAG,IAAA,qBAAK,EAAC,YAAY,EAAE;QAC9B,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC;QAClC,GAAG,EAAE,IAAI,EAAE,GAAG;QACd,KAAK,EAAE,IAAI;QACX,GAAG;KACJ,CAAC,CAAC;IACH,IAAI,YAAY,GAAa,EAAE,CAAC;IAChC,IAAI,YAAY,GAAa,EAAE,CAAC;IAChC,IAAI,cAAc,GAAa,EAAE,CAAC;IAClC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;QAC7B,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;QAC7B,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,QAAgB,EAAE,EAAE;YACrC,OAAO,CAAC;gBACN,QAAQ;gBACR,IAAI,MAAM;oBACR,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC/B,CAAC;gBACD,IAAI,MAAM;oBACR,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC/B,CAAC;gBACD,IAAI,MAAM;oBACR,OAAO,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACjC,CAAC;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { AuditBuildOptions } from '../audit';\nimport { spawn } from 'child_process';\n\nexport async function buildApp(options: AuditBuildOptions): Promise<void> {\n let result = await execute(`node node_modules/ember-cli/bin/ember build`, {\n pwd: options.app,\n env: {\n STAGE2_ONLY: 'true',\n },\n });\n\n if (result.exitCode !== 0) {\n throw new BuildError(\n `${chalk.yellow('Unable to begin audit')} because the build failed. Build output follows:\\n${result.output}`\n );\n }\n}\n\nexport class BuildError extends Error {\n isBuildError = true;\n constructor(buildOutput: string) {\n super(buildOutput);\n }\n}\n\nexport function isBuildError(err: any): err is BuildError {\n return err?.isBuildError;\n}\n\nasync function execute(\n shellCommand: string,\n opts?: { env?: Record<string, string>; pwd?: string }\n): Promise<{\n exitCode: number;\n stderr: string;\n stdout: string;\n output: string;\n}> {\n let env: Record<string, string | undefined> | undefined;\n if (opts?.env) {\n env = { ...process.env, ...opts.env };\n }\n let child = spawn(shellCommand, {\n stdio: ['inherit', 'pipe', 'pipe'],\n cwd: opts?.pwd,\n shell: true,\n env,\n });\n let stderrBuffer: string[] = [];\n let stdoutBuffer: string[] = [];\n let combinedBuffer: string[] = [];\n child.stderr.on('data', data => {\n stderrBuffer.push(data);\n combinedBuffer.push(data);\n });\n child.stdout.on('data', data => {\n stdoutBuffer.push(data);\n combinedBuffer.push(data);\n });\n return new Promise(resolve => {\n child.on('close', (exitCode: number) => {\n resolve({\n exitCode,\n get stdout() {\n return stdoutBuffer.join('');\n },\n get stderr() {\n return stderrBuffer.join('');\n },\n get output() {\n return combinedBuffer.join('');\n },\n });\n });\n });\n}\n"]}
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,iDAAsC;AAE/B,KAAK,UAAU,QAAQ,CAAC,OAA0B;IACvD,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,6CAA6C,EAAE;QACxE,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE;YACH,WAAW,EAAE,MAAM;SACpB;KACF,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE;QACzB,MAAM,IAAI,UAAU,CAClB,GAAG,eAA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AAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,QAAgB,EAAE,EAAE;YACrC,OAAO,CAAC;gBACN,QAAQ;gBACR,IAAI,MAAM;oBACR,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC/B,CAAC;gBACD,IAAI,MAAM;oBACR,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC/B,CAAC;gBACD,IAAI,MAAM;oBACR,OAAO,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACjC,CAAC;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { AuditBuildOptions } from '../audit';\nimport { spawn } from 'child_process';\n\nexport async function buildApp(options: AuditBuildOptions): Promise<void> {\n let result = await execute(`node node_modules/ember-cli/bin/ember build`, {\n pwd: options.app,\n env: {\n STAGE2_ONLY: 'true',\n },\n });\n\n if (result.exitCode !== 0) {\n throw new BuildError(\n `${chalk.yellow('Unable to begin audit')} because the build failed. Build output follows:\\n${result.output}`\n );\n }\n}\n\nexport class BuildError extends Error {\n isBuildError = true;\n constructor(buildOutput: string) {\n super(buildOutput);\n }\n}\n\nexport function isBuildError(err: any): err is BuildError {\n return err?.isBuildError;\n}\n\nasync function execute(\n shellCommand: string,\n opts?: { env?: Record<string, string>; pwd?: string }\n): Promise<{\n exitCode: number;\n stderr: string;\n stdout: string;\n output: string;\n}> {\n let env: Record<string, string | undefined> | undefined;\n if (opts?.env) {\n env = { ...process.env, ...opts.env };\n }\n let child = spawn(shellCommand, {\n stdio: ['inherit', 'pipe', 'pipe'],\n cwd: opts?.pwd,\n shell: true,\n env,\n });\n let stderrBuffer: string[] = [];\n let stdoutBuffer: string[] = [];\n let combinedBuffer: string[] = [];\n child.stderr.on('data', data => {\n stderrBuffer.push(data);\n combinedBuffer.push(data);\n });\n child.stdout.on('data', data => {\n stdoutBuffer.push(data);\n combinedBuffer.push(data);\n });\n return new Promise(resolve => {\n child.on('close', (exitCode: number) => {\n resolve({\n exitCode,\n get stdout() {\n return stdoutBuffer.join('');\n },\n get stderr() {\n return stderrBuffer.join('');\n },\n get output() {\n return combinedBuffer.join('');\n },\n });\n });\n });\n}\n"]}
package/src/audit-cli.js CHANGED
File without changes
package/src/audit.js CHANGED
@@ -27,10 +27,10 @@ function isResolutionFailure(result) {
27
27
  return typeof result === 'object' && 'isResolutionFailure' in result;
28
28
  }
29
29
  function isResolved(module) {
30
- return Boolean(module?.parsed && module.resolved);
30
+ return Boolean((module === null || module === void 0 ? void 0 : module.parsed) && module.resolved);
31
31
  }
32
32
  function isLinked(module) {
33
- return Boolean(module?.parsed && module.resolved && module.linked);
33
+ return Boolean((module === null || module === void 0 ? void 0 : module.parsed) && module.resolved && module.linked);
34
34
  }
35
35
  class AuditResults {
36
36
  constructor() {
@@ -38,6 +38,7 @@ class AuditResults {
38
38
  this.findings = [];
39
39
  }
40
40
  static create(baseDir, findings, modules) {
41
+ var _a, _b, _c, _d;
41
42
  let results = new this();
42
43
  for (let [filename, module] of modules) {
43
44
  let publicModule = {
@@ -56,7 +57,7 @@ class AuditResults {
56
57
  isResolutionFailure(target) ? null : (0, core_1.explicitRelative)(baseDir, target),
57
58
  ]))
58
59
  : {},
59
- imports: module.parsed?.imports
60
+ imports: ((_a = module.parsed) === null || _a === void 0 ? void 0 : _a.imports)
60
61
  ? module.parsed.imports.map(i => ({
61
62
  source: i.source,
62
63
  specifiers: i.specifiers.map(s => ({
@@ -65,9 +66,9 @@ class AuditResults {
65
66
  })),
66
67
  }))
67
68
  : [],
68
- exports: module.linked?.exports ? [...module.linked.exports] : [],
69
- content: module.parsed?.transpiledContent
70
- ? module.parsed?.transpiledContent.toString()
69
+ exports: ((_b = module.linked) === null || _b === void 0 ? void 0 : _b.exports) ? [...module.linked.exports] : [],
70
+ content: ((_c = module.parsed) === null || _c === void 0 ? void 0 : _c.transpiledContent)
71
+ ? (_d = module.parsed) === null || _d === void 0 ? void 0 : _d.transpiledContent.toString()
71
72
  : 'module failed to transpile',
72
73
  };
73
74
  results.modules[(0, core_1.explicitRelative)(baseDir, filename)] = publicModule;
@@ -79,6 +80,7 @@ class AuditResults {
79
80
  return results;
80
81
  }
81
82
  humanReadable() {
83
+ var _a;
82
84
  let output = [];
83
85
  let findingsByFile = (0, groupBy_1.default)(this.findings, f => f.filename);
84
86
  output.push(`=== Audit Results ===`);
@@ -95,7 +97,7 @@ class AuditResults {
95
97
  while (!isRootMarker(pointer)) {
96
98
  // the zero here means we only display the first path we found. I think
97
99
  // that's a fine tradeoff to keep the output smaller.
98
- let nextPointer = this.modules[pointer]?.consumedFrom[0];
100
+ let nextPointer = (_a = this.modules[pointer]) === null || _a === void 0 ? void 0 : _a.consumedFrom[0];
99
101
  if (!nextPointer) {
100
102
  output.push(indent(chalk_1.default.red(`couldn't figure out why this was included. Please file a bug against @embroider/compat.`), 2));
101
103
  break;
package/src/audit.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"audit.js","sourceRoot":"","sources":["audit.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAsD;AACtD,+BAA6D;AAC7D,0CAQyB;AACzB,2DAA6C;AAC7C,kDAA0B;AAC1B,kDAA0B;AAC1B,6DAAqC;AACrC,iEAAyC;AACzC,yDAO+B;AAE/B,yCAAmE;AAiBzB,2FAjBvB,kBAAU,OAiBuB;AAAE,6FAjBvB,oBAAY,OAiBuB;AAflE,MAAM,EAAE,KAAK,EAAE,GAAG,eAAK,CAAC;AAqCxB,SAAS,mBAAmB,CAAC,MAA8C;IACzE,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,qBAAqB,IAAI,MAAM,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O,GAAE;gCAGT;AAGD;IADC,IAAA,4BAAO,GAAE;yCAIT;AAOD;IADC,IAAA,4BAAO,GAAE;wCAST;AAsUH,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;QAC/C,MAAM,IAAI,GAAG,CAAC;KACf;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;AAMD,SAAgB,YAAY,CAAC,KAAsC;IACjE,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AACrE,CAAC;AAFD,oCAEC","sourcesContent":["import { readFileSync, readJSONSync } from 'fs-extra';\nimport { dirname, join, resolve as resolvePath } from 'path';\nimport {\n AppMeta,\n explicitRelative,\n hbsToJS,\n locateEmbroiderWorkingDir,\n Resolver,\n ResolverOptions,\n RewrittenPackageCache,\n} from '@embroider/core';\nimport { Memoize } from 'typescript-memoize';\nimport chalk from 'chalk';\nimport jsdom from 'jsdom';\nimport groupBy from 'lodash/groupBy';\nimport fromPairs from 'lodash/fromPairs';\nimport {\n auditJS,\n CodeFrameStorage,\n ExportAll,\n InternalImport,\n isNamespaceMarker,\n NamespaceMarker,\n} from './audit/babel-visitor';\nimport { AuditBuildOptions, AuditOptions } from './audit/options';\nimport { buildApp, BuildError, isBuildError } from './audit/build';\n\nconst { JSDOM } = jsdom;\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 interface Module {\n appRelativePath: string;\n consumedFrom: (string | RootMarker)[];\n imports: Import[];\n exports: string[];\n resolutions: { [source: string]: string | null };\n content: string;\n}\n\ninterface ResolutionFailure {\n isResolutionFailure: true;\n}\n\nfunction isResolutionFailure(result: string | ResolutionFailure | undefined): result is ResolutionFailure {\n return typeof result === 'object' && 'isResolutionFailure' in result;\n}\n\ninterface InternalModule {\n consumedFrom: (string | RootMarker)[];\n\n parsed?: {\n imports: InternalImport[];\n exports: Set<string | ExportAll>;\n isCJS: boolean;\n isAMD: boolean;\n dependencies: string[];\n transpiledContent: string | Buffer;\n };\n\n resolved?: Map<string, string | ResolutionFailure>;\n\n linked?: {\n exports: Set<string>;\n };\n}\n\ntype ParsedInternalModule = Omit<InternalModule, 'parsed'> & {\n parsed: NonNullable<InternalModule['parsed']>;\n};\n\ntype ResolvedInternalModule = Omit<ParsedInternalModule, 'resolved'> & {\n resolved: NonNullable<ParsedInternalModule['resolved']>;\n};\n\nfunction isResolved(module: InternalModule | undefined): module is ResolvedInternalModule {\n return Boolean(module?.parsed && module.resolved);\n}\n\ntype LinkedInternalModule = Omit<ResolvedInternalModule, 'linked'> & {\n linked: NonNullable<ResolvedInternalModule['linked']>;\n};\n\nfunction isLinked(module: InternalModule | undefined): module is LinkedInternalModule {\n return Boolean(module?.parsed && module.resolved && module.linked);\n}\n\nexport interface Import {\n source: string;\n specifiers: {\n name: string | NamespaceMarker;\n local: string | null; // can be null when re-exporting, because in that case we import `name` from `source` but don't create any local binding for it\n }[];\n}\n\nexport class AuditResults {\n modules: { [file: string]: Module } = {};\n findings: Finding[] = [];\n\n static create(baseDir: string, findings: Finding[], modules: Map<string, InternalModule>) {\n let results = new this();\n for (let [filename, module] of modules) {\n let publicModule: Module = {\n appRelativePath: explicitRelative(baseDir, filename),\n consumedFrom: module.consumedFrom.map(entry => {\n if (isRootMarker(entry)) {\n return entry;\n } else {\n return explicitRelative(baseDir, entry);\n }\n }),\n resolutions: module.resolved\n ? fromPairs(\n [...module.resolved].map(([source, target]) => [\n source,\n isResolutionFailure(target) ? null : explicitRelative(baseDir, target),\n ])\n )\n : {},\n imports: module.parsed?.imports\n ? module.parsed.imports.map(i => ({\n source: i.source,\n specifiers: i.specifiers.map(s => ({\n name: s.name,\n local: s.local,\n })),\n }))\n : [],\n exports: module.linked?.exports ? [...module.linked.exports] : [],\n content: module.parsed?.transpiledContent\n ? module.parsed?.transpiledContent.toString()\n : 'module failed to transpile',\n };\n results.modules[explicitRelative(baseDir, filename)] = publicModule;\n }\n for (let finding of findings) {\n let relFinding = Object.assign({}, finding, { filename: explicitRelative(baseDir, 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 modules: Map<string, InternalModule> = new Map();\n private virtualModules: Map<string, string> = new Map();\n private moduleQueue = new Set<string>();\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 if (options['reuse-build']) {\n if (!audit.meta.babel.isParallelSafe) {\n throw new BuildError(\n `You can't use the ${chalk.red(\n '--reuse-build'\n )} option because some of your babel or HBS plugins are non-serializable`\n );\n }\n }\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 // eslint-disable-next-line @typescript-eslint/no-require-imports\n let config = require(join(this.movedAppRoot, this.meta.babel.filename));\n config = Object.assign({}, config);\n config.plugins = config.plugins.filter((p: any) => !isMacrosPlugin(p));\n\n config.ast = true;\n return config;\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 private visitorFor(\n filename: string\n ): (\n this: Audit,\n filename: string,\n content: Buffer | string\n ) => Promise<NonNullable<InternalModule['parsed']> | Finding[]> {\n if (filename.endsWith('.html')) {\n return this.visitHTML;\n } else if (filename.endsWith('.hbs')) {\n return this.visitHBS;\n } else if (filename.endsWith('.json')) {\n return this.visitJSON;\n } else {\n return this.visitJS;\n }\n }\n\n private async drainQueue() {\n while (this.moduleQueue.size > 0) {\n let filename = this.moduleQueue.values().next().value as string;\n this.moduleQueue.delete(filename);\n this.debug('visit', filename);\n let visitor = this.visitorFor(filename);\n let content: string | Buffer;\n if (this.virtualModules.has(filename)) {\n content = this.virtualModules.get(filename)!;\n } else {\n content = readFileSync(filename);\n }\n // cast is safe because the only way to get into the queue is to go\n // through scheduleVisit, and scheduleVisit creates the entry in\n // this.modules.\n let module: InternalModule = this.modules.get(filename)!;\n let visitResult = await visitor.call(this, filename, content);\n if (Array.isArray(visitResult)) {\n // the visitor was unable to figure out the ParseFields and returned\n // some number of Findings to us to explain why.\n for (let finding of visitResult) {\n this.pushFinding(finding);\n }\n } else {\n module.parsed = visitResult;\n module.resolved = await this.resolveDeps(visitResult.dependencies, filename);\n }\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 for (let asset of this.meta.assets) {\n if (asset.endsWith('.html')) {\n this.scheduleVisit(resolvePath(this.movedAppRoot, asset), { isRoot: true });\n }\n }\n await this.drainQueue();\n this.linkModules();\n this.inspectModules();\n\n return AuditResults.create(this.originAppRoot, this.findings, this.modules);\n } finally {\n delete (globalThis as any).embroider_audit;\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 linkModules() {\n for (let module of this.modules.values()) {\n if (isResolved(module)) {\n this.linkModule(module);\n }\n }\n }\n\n private linkModule(module: ResolvedInternalModule) {\n let exports = new Set<string>();\n for (let exp of module.parsed.exports) {\n if (typeof exp === 'string') {\n exports.add(exp);\n } else {\n let moduleName = module.resolved.get(exp.all)!;\n if (!isResolutionFailure(moduleName)) {\n let target = this.modules.get(moduleName)!;\n if (!isLinked(target) && isResolved(target)) {\n this.linkModule(target);\n }\n if (isLinked(target)) {\n for (let innerExp of target.linked.exports) {\n exports.add(innerExp);\n }\n } else {\n // our module doesn't successfully enter linked state because it\n // depends on stuff that also couldn't\n return;\n }\n }\n }\n }\n module.linked = {\n exports,\n };\n }\n\n private inspectModules() {\n for (let [filename, module] of this.modules) {\n if (isLinked(module)) {\n this.inspectImports(filename, module);\n }\n }\n }\n\n private inspectImports(filename: string, module: LinkedInternalModule) {\n for (let imp of module.parsed.imports) {\n let resolved = module.resolved.get(imp.source);\n if (isResolutionFailure(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 = this.modules.get(resolved)!;\n for (let specifier of imp.specifiers) {\n if (isLinked(target) && !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: LinkedInternalModule, 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.parsed.isCJS || target.parsed.isAMD || target.linked.exports.has(name);\n }\n\n private async visitHTML(filename: string, content: Buffer | string): Promise<ParsedInternalModule['parsed']> {\n let dom = new JSDOM(content);\n let scripts = dom.window.document.querySelectorAll('script[type=\"module\"]') as NodeListOf<HTMLScriptElement>;\n let dependencies = [] as string[];\n for (let script of scripts) {\n let src = script.src;\n if (!src) {\n continue;\n }\n if (new URL(src, 'http://example.com:4321').origin !== 'http://example.com:4321') {\n // src was absolute, we don't handle it\n continue;\n }\n if (src.startsWith(this.meta['root-url'])) {\n // root-relative URLs are actually relative to the appDir\n src = explicitRelative(\n dirname(filename),\n resolvePath(this.movedAppRoot, src.replace(this.meta['root-url'], ''))\n );\n }\n dependencies.push(src);\n }\n\n return {\n imports: [],\n exports: new Set(),\n isCJS: false,\n isAMD: false,\n dependencies,\n transpiledContent: content,\n };\n }\n\n private async visitJS(\n filename: string,\n content: Buffer | string\n ): Promise<ParsedInternalModule['parsed'] | Finding[]> {\n let rawSource = content.toString('utf8');\n try {\n let result = auditJS(rawSource, filename, this.babelConfig, this.frames);\n\n for (let problem of result.problems) {\n this.pushFinding({\n filename,\n message: problem.message,\n detail: problem.detail,\n codeFrame: this.frames.render(problem.codeFrameIndex),\n });\n }\n return {\n exports: result.exports,\n imports: result.imports,\n isCJS: result.isCJS,\n isAMD: result.isAMD,\n dependencies: result.imports.map(i => i.source),\n transpiledContent: result.transpiledContent,\n };\n } catch (err) {\n if (['BABEL_PARSE_ERROR', 'BABEL_TRANSFORM_ERROR'].includes(err.code)) {\n return [\n {\n filename,\n message: `failed to parse`,\n detail: err.toString().replace(filename, explicitRelative(this.originAppRoot, filename)),\n },\n ];\n } else {\n throw err;\n }\n }\n }\n\n private async visitHBS(\n filename: string,\n content: Buffer | string\n ): Promise<ParsedInternalModule['parsed'] | Finding[]> {\n let rawSource = content.toString('utf8');\n let js = hbsToJS(rawSource);\n return this.visitJS(filename, js);\n }\n\n private async visitJSON(\n filename: string,\n content: Buffer | string\n ): Promise<ParsedInternalModule['parsed'] | Finding[]> {\n let js;\n try {\n let structure = JSON.parse(content.toString('utf8'));\n js = `export default ${JSON.stringify(structure)}`;\n } catch (err) {\n return [\n {\n filename,\n message: `failed to parse JSON`,\n detail: err.toString().replace(filename, explicitRelative(this.originAppRoot, filename)),\n },\n ];\n }\n return this.visitJS(filename, js);\n }\n\n private async resolveDeps(deps: string[], fromFile: string): Promise<InternalModule['resolved']> {\n let resolved = new Map() as NonNullable<InternalModule['resolved']>;\n for (let dep of deps) {\n let resolution = await this.resolver.nodeResolve(dep, fromFile);\n switch (resolution.type) {\n case 'virtual':\n this.virtualModules.set(resolution.filename, resolution.content);\n resolved.set(dep, resolution.filename);\n this.scheduleVisit(resolution.filename, fromFile);\n break;\n case 'not_found':\n if (['@embroider/macros', '@ember/template-factory'].includes(dep)) {\n // the audit process deliberately removes the @embroider/macros babel\n // plugins, so the imports are still present and should be left alone.\n continue;\n }\n resolved.set(dep, { isResolutionFailure: true as true });\n break;\n case 'real':\n resolved.set(dep, resolution.filename);\n this.scheduleVisit(resolution.filename, fromFile);\n break;\n }\n }\n return resolved;\n }\n\n private pushFinding(finding: Finding) {\n this.findings.push(finding);\n }\n\n private scheduleVisit(filename: string, parent: string | RootMarker) {\n let record = this.modules.get(filename);\n if (!record) {\n this.debug(`discovered`, filename);\n record = {\n consumedFrom: [parent],\n };\n this.modules.set(filename, record);\n this.moduleQueue.add(filename);\n } else {\n record.consumedFrom.push(parent);\n }\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 interface RootMarker {\n isRoot: true;\n}\n\nexport function isRootMarker(value: string | RootMarker | undefined): value is RootMarker {\n return Boolean(value && typeof value !== 'string' && value.isRoot);\n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AAMD,SAAgB,YAAY,CAAC,KAAsC;IACjE,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;AACrE,CAAC;AAFD,oCAEC","sourcesContent":["import { readFileSync, readJSONSync } from 'fs-extra';\nimport { dirname, join, resolve as resolvePath } from 'path';\nimport {\n AppMeta,\n explicitRelative,\n hbsToJS,\n locateEmbroiderWorkingDir,\n Resolver,\n ResolverOptions,\n RewrittenPackageCache,\n} from '@embroider/core';\nimport { Memoize } from 'typescript-memoize';\nimport chalk from 'chalk';\nimport jsdom from 'jsdom';\nimport groupBy from 'lodash/groupBy';\nimport fromPairs from 'lodash/fromPairs';\nimport {\n auditJS,\n CodeFrameStorage,\n ExportAll,\n InternalImport,\n isNamespaceMarker,\n NamespaceMarker,\n} from './audit/babel-visitor';\nimport { AuditBuildOptions, AuditOptions } from './audit/options';\nimport { buildApp, BuildError, isBuildError } from './audit/build';\n\nconst { JSDOM } = jsdom;\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 interface Module {\n appRelativePath: string;\n consumedFrom: (string | RootMarker)[];\n imports: Import[];\n exports: string[];\n resolutions: { [source: string]: string | null };\n content: string;\n}\n\ninterface ResolutionFailure {\n isResolutionFailure: true;\n}\n\nfunction isResolutionFailure(result: string | ResolutionFailure | undefined): result is ResolutionFailure {\n return typeof result === 'object' && 'isResolutionFailure' in result;\n}\n\ninterface InternalModule {\n consumedFrom: (string | RootMarker)[];\n\n parsed?: {\n imports: InternalImport[];\n exports: Set<string | ExportAll>;\n isCJS: boolean;\n isAMD: boolean;\n dependencies: string[];\n transpiledContent: string | Buffer;\n };\n\n resolved?: Map<string, string | ResolutionFailure>;\n\n linked?: {\n exports: Set<string>;\n };\n}\n\ntype ParsedInternalModule = Omit<InternalModule, 'parsed'> & {\n parsed: NonNullable<InternalModule['parsed']>;\n};\n\ntype ResolvedInternalModule = Omit<ParsedInternalModule, 'resolved'> & {\n resolved: NonNullable<ParsedInternalModule['resolved']>;\n};\n\nfunction isResolved(module: InternalModule | undefined): module is ResolvedInternalModule {\n return Boolean(module?.parsed && module.resolved);\n}\n\ntype LinkedInternalModule = Omit<ResolvedInternalModule, 'linked'> & {\n linked: NonNullable<ResolvedInternalModule['linked']>;\n};\n\nfunction isLinked(module: InternalModule | undefined): module is LinkedInternalModule {\n return Boolean(module?.parsed && module.resolved && module.linked);\n}\n\nexport interface Import {\n source: string;\n specifiers: {\n name: string | NamespaceMarker;\n local: string | null; // can be null when re-exporting, because in that case we import `name` from `source` but don't create any local binding for it\n }[];\n}\n\nexport class AuditResults {\n modules: { [file: string]: Module } = {};\n findings: Finding[] = [];\n\n static create(baseDir: string, findings: Finding[], modules: Map<string, InternalModule>) {\n let results = new this();\n for (let [filename, module] of modules) {\n let publicModule: Module = {\n appRelativePath: explicitRelative(baseDir, filename),\n consumedFrom: module.consumedFrom.map(entry => {\n if (isRootMarker(entry)) {\n return entry;\n } else {\n return explicitRelative(baseDir, entry);\n }\n }),\n resolutions: module.resolved\n ? fromPairs(\n [...module.resolved].map(([source, target]) => [\n source,\n isResolutionFailure(target) ? null : explicitRelative(baseDir, target),\n ])\n )\n : {},\n imports: module.parsed?.imports\n ? module.parsed.imports.map(i => ({\n source: i.source,\n specifiers: i.specifiers.map(s => ({\n name: s.name,\n local: s.local,\n })),\n }))\n : [],\n exports: module.linked?.exports ? [...module.linked.exports] : [],\n content: module.parsed?.transpiledContent\n ? module.parsed?.transpiledContent.toString()\n : 'module failed to transpile',\n };\n results.modules[explicitRelative(baseDir, filename)] = publicModule;\n }\n for (let finding of findings) {\n let relFinding = Object.assign({}, finding, { filename: explicitRelative(baseDir, 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 modules: Map<string, InternalModule> = new Map();\n private virtualModules: Map<string, string> = new Map();\n private moduleQueue = new Set<string>();\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 if (options['reuse-build']) {\n if (!audit.meta.babel.isParallelSafe) {\n throw new BuildError(\n `You can't use the ${chalk.red(\n '--reuse-build'\n )} option because some of your babel or HBS plugins are non-serializable`\n );\n }\n }\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 // eslint-disable-next-line @typescript-eslint/no-require-imports\n let config = require(join(this.movedAppRoot, this.meta.babel.filename));\n config = Object.assign({}, config);\n config.plugins = config.plugins.filter((p: any) => !isMacrosPlugin(p));\n\n config.ast = true;\n return config;\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 private visitorFor(\n filename: string\n ): (\n this: Audit,\n filename: string,\n content: Buffer | string\n ) => Promise<NonNullable<InternalModule['parsed']> | Finding[]> {\n if (filename.endsWith('.html')) {\n return this.visitHTML;\n } else if (filename.endsWith('.hbs')) {\n return this.visitHBS;\n } else if (filename.endsWith('.json')) {\n return this.visitJSON;\n } else {\n return this.visitJS;\n }\n }\n\n private async drainQueue() {\n while (this.moduleQueue.size > 0) {\n let filename = this.moduleQueue.values().next().value as string;\n this.moduleQueue.delete(filename);\n this.debug('visit', filename);\n let visitor = this.visitorFor(filename);\n let content: string | Buffer;\n if (this.virtualModules.has(filename)) {\n content = this.virtualModules.get(filename)!;\n } else {\n content = readFileSync(filename);\n }\n // cast is safe because the only way to get into the queue is to go\n // through scheduleVisit, and scheduleVisit creates the entry in\n // this.modules.\n let module: InternalModule = this.modules.get(filename)!;\n let visitResult = await visitor.call(this, filename, content);\n if (Array.isArray(visitResult)) {\n // the visitor was unable to figure out the ParseFields and returned\n // some number of Findings to us to explain why.\n for (let finding of visitResult) {\n this.pushFinding(finding);\n }\n } else {\n module.parsed = visitResult;\n module.resolved = await this.resolveDeps(visitResult.dependencies, filename);\n }\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 for (let asset of this.meta.assets) {\n if (asset.endsWith('.html')) {\n this.scheduleVisit(resolvePath(this.movedAppRoot, asset), { isRoot: true });\n }\n }\n await this.drainQueue();\n this.linkModules();\n this.inspectModules();\n\n return AuditResults.create(this.originAppRoot, this.findings, this.modules);\n } finally {\n delete (globalThis as any).embroider_audit;\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 linkModules() {\n for (let module of this.modules.values()) {\n if (isResolved(module)) {\n this.linkModule(module);\n }\n }\n }\n\n private linkModule(module: ResolvedInternalModule) {\n let exports = new Set<string>();\n for (let exp of module.parsed.exports) {\n if (typeof exp === 'string') {\n exports.add(exp);\n } else {\n let moduleName = module.resolved.get(exp.all)!;\n if (!isResolutionFailure(moduleName)) {\n let target = this.modules.get(moduleName)!;\n if (!isLinked(target) && isResolved(target)) {\n this.linkModule(target);\n }\n if (isLinked(target)) {\n for (let innerExp of target.linked.exports) {\n exports.add(innerExp);\n }\n } else {\n // our module doesn't successfully enter linked state because it\n // depends on stuff that also couldn't\n return;\n }\n }\n }\n }\n module.linked = {\n exports,\n };\n }\n\n private inspectModules() {\n for (let [filename, module] of this.modules) {\n if (isLinked(module)) {\n this.inspectImports(filename, module);\n }\n }\n }\n\n private inspectImports(filename: string, module: LinkedInternalModule) {\n for (let imp of module.parsed.imports) {\n let resolved = module.resolved.get(imp.source);\n if (isResolutionFailure(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 = this.modules.get(resolved)!;\n for (let specifier of imp.specifiers) {\n if (isLinked(target) && !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: LinkedInternalModule, 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.parsed.isCJS || target.parsed.isAMD || target.linked.exports.has(name);\n }\n\n private async visitHTML(filename: string, content: Buffer | string): Promise<ParsedInternalModule['parsed']> {\n let dom = new JSDOM(content);\n let scripts = dom.window.document.querySelectorAll('script[type=\"module\"]') as NodeListOf<HTMLScriptElement>;\n let dependencies = [] as string[];\n for (let script of scripts) {\n let src = script.src;\n if (!src) {\n continue;\n }\n if (new URL(src, 'http://example.com:4321').origin !== 'http://example.com:4321') {\n // src was absolute, we don't handle it\n continue;\n }\n if (src.startsWith(this.meta['root-url'])) {\n // root-relative URLs are actually relative to the appDir\n src = explicitRelative(\n dirname(filename),\n resolvePath(this.movedAppRoot, src.replace(this.meta['root-url'], ''))\n );\n }\n dependencies.push(src);\n }\n\n return {\n imports: [],\n exports: new Set(),\n isCJS: false,\n isAMD: false,\n dependencies,\n transpiledContent: content,\n };\n }\n\n private async visitJS(\n filename: string,\n content: Buffer | string\n ): Promise<ParsedInternalModule['parsed'] | Finding[]> {\n let rawSource = content.toString('utf8');\n try {\n let result = auditJS(rawSource, filename, this.babelConfig, this.frames);\n\n for (let problem of result.problems) {\n this.pushFinding({\n filename,\n message: problem.message,\n detail: problem.detail,\n codeFrame: this.frames.render(problem.codeFrameIndex),\n });\n }\n return {\n exports: result.exports,\n imports: result.imports,\n isCJS: result.isCJS,\n isAMD: result.isAMD,\n dependencies: result.imports.map(i => i.source),\n transpiledContent: result.transpiledContent,\n };\n } catch (err) {\n if (['BABEL_PARSE_ERROR', 'BABEL_TRANSFORM_ERROR'].includes(err.code)) {\n return [\n {\n filename,\n message: `failed to parse`,\n detail: err.toString().replace(filename, explicitRelative(this.originAppRoot, filename)),\n },\n ];\n } else {\n throw err;\n }\n }\n }\n\n private async visitHBS(\n filename: string,\n content: Buffer | string\n ): Promise<ParsedInternalModule['parsed'] | Finding[]> {\n let rawSource = content.toString('utf8');\n let js = hbsToJS(rawSource);\n return this.visitJS(filename, js);\n }\n\n private async visitJSON(\n filename: string,\n content: Buffer | string\n ): Promise<ParsedInternalModule['parsed'] | Finding[]> {\n let js;\n try {\n let structure = JSON.parse(content.toString('utf8'));\n js = `export default ${JSON.stringify(structure)}`;\n } catch (err) {\n return [\n {\n filename,\n message: `failed to parse JSON`,\n detail: err.toString().replace(filename, explicitRelative(this.originAppRoot, filename)),\n },\n ];\n }\n return this.visitJS(filename, js);\n }\n\n private async resolveDeps(deps: string[], fromFile: string): Promise<InternalModule['resolved']> {\n let resolved = new Map() as NonNullable<InternalModule['resolved']>;\n for (let dep of deps) {\n let resolution = await this.resolver.nodeResolve(dep, fromFile);\n switch (resolution.type) {\n case 'virtual':\n this.virtualModules.set(resolution.filename, resolution.content);\n resolved.set(dep, resolution.filename);\n this.scheduleVisit(resolution.filename, fromFile);\n break;\n case 'not_found':\n if (['@embroider/macros', '@ember/template-factory'].includes(dep)) {\n // the audit process deliberately removes the @embroider/macros babel\n // plugins, so the imports are still present and should be left alone.\n continue;\n }\n resolved.set(dep, { isResolutionFailure: true as true });\n break;\n case 'real':\n resolved.set(dep, resolution.filename);\n this.scheduleVisit(resolution.filename, fromFile);\n break;\n }\n }\n return resolved;\n }\n\n private pushFinding(finding: Finding) {\n this.findings.push(finding);\n }\n\n private scheduleVisit(filename: string, parent: string | RootMarker) {\n let record = this.modules.get(filename);\n if (!record) {\n this.debug(`discovered`, filename);\n record = {\n consumedFrom: [parent],\n };\n this.modules.set(filename, record);\n this.moduleQueue.add(filename);\n } else {\n record.consumedFrom.push(parent);\n }\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 interface RootMarker {\n isRoot: true;\n}\n\nexport function isRootMarker(value: string | RootMarker | undefined): value is RootMarker {\n return Boolean(value && typeof value !== 'string' && value.isRoot);\n}\n"]}
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const v1_addon_1 = __importDefault(require("../../v1-addon"));
7
7
  class EmberDataDebug extends v1_addon_1.default {
8
8
  get packageMeta() {
9
+ var _a;
9
10
  let meta = super.packageMeta;
10
11
  // See also the compat-adapter for @ember-data/store where we make this an
11
12
  // implicit-module.
12
- meta.externals = [...(meta.externals ?? []), '@ember-data/store'];
13
+ meta.externals = [...((_a = meta.externals) !== null && _a !== void 0 ? _a : []), '@ember-data/store'];
13
14
  return meta;
14
15
  }
15
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"debug.js","sourceRoot":"","sources":["debug.ts"],"names":[],"mappings":";;;;;AACA,8DAAqC;AAErC,MAAqB,cAAe,SAAQ,kBAAO;IACjD,IAAI,WAAW;QACb,IAAI,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC;QAE7B,0EAA0E;QAC1E,mBAAmB;QACnB,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,mBAAmB,CAAC,CAAC;QAElE,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAVD,iCAUC","sourcesContent":["import { AddonMeta } from '@embroider/core';\nimport V1Addon from '../../v1-addon';\n\nexport default class EmberDataDebug extends V1Addon {\n get packageMeta(): Partial<AddonMeta> {\n let meta = super.packageMeta;\n\n // See also the compat-adapter for @ember-data/store where we make this an\n // implicit-module.\n meta.externals = [...(meta.externals ?? []), '@ember-data/store'];\n\n return meta;\n }\n}\n"]}
1
+ {"version":3,"file":"debug.js","sourceRoot":"","sources":["debug.ts"],"names":[],"mappings":";;;;;AACA,8DAAqC;AAErC,MAAqB,cAAe,SAAQ,kBAAO;IACjD,IAAI,WAAW;;QACb,IAAI,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC;QAE7B,0EAA0E;QAC1E,mBAAmB;QACnB,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,SAAS,mCAAI,EAAE,CAAC,EAAE,mBAAmB,CAAC,CAAC;QAElE,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAVD,iCAUC","sourcesContent":["import { AddonMeta } from '@embroider/core';\nimport V1Addon from '../../v1-addon';\n\nexport default class EmberDataDebug extends V1Addon {\n get packageMeta(): Partial<AddonMeta> {\n let meta = super.packageMeta;\n\n // See also the compat-adapter for @ember-data/store where we make this an\n // implicit-module.\n meta.externals = [...(meta.externals ?? []), '@ember-data/store'];\n\n return meta;\n }\n}\n"]}
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ember_data_1 = require("../ember-data");
4
4
  class EmberDataStore extends ember_data_1.EmberDataBase {
5
5
  get packageMeta() {
6
+ var _a;
6
7
  let meta = super.packageMeta;
7
8
  // this is here because the compat-adapter for @ember-data/debug adds this
8
9
  // to externals because it has an undeclared peerDep on us, and thus might
9
10
  // resolve totally incorrect copies. By making it external we leave it up to
10
11
  // runtime, where we will find this implicit-module for the actual copy of
11
12
  // @ember-data/store that is active in app.
12
- meta['implicit-modules'] = [...(meta['implicit-modules'] ?? []), './index.js'];
13
+ meta['implicit-modules'] = [...((_a = meta['implicit-modules']) !== null && _a !== void 0 ? _a : []), './index.js'];
13
14
  return meta;
14
15
  }
15
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["store.ts"],"names":[],"mappings":";;AACA,8CAA8C;AAE9C,MAAqB,cAAe,SAAQ,0BAAa;IACvD,IAAI,WAAW;QACb,IAAI,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC;QAE7B,0EAA0E;QAC1E,0EAA0E;QAC1E,4EAA4E;QAC5E,0EAA0E;QAC1E,2CAA2C;QAC3C,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC;QAE/E,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAbD,iCAaC","sourcesContent":["import { AddonMeta } from '@embroider/core';\nimport { EmberDataBase } from '../ember-data';\n\nexport default class EmberDataStore extends EmberDataBase {\n get packageMeta(): Partial<AddonMeta> {\n let meta = super.packageMeta;\n\n // this is here because the compat-adapter for @ember-data/debug adds this\n // to externals because it has an undeclared peerDep on us, and thus might\n // resolve totally incorrect copies. By making it external we leave it up to\n // runtime, where we will find this implicit-module for the actual copy of\n // @ember-data/store that is active in app.\n meta['implicit-modules'] = [...(meta['implicit-modules'] ?? []), './index.js'];\n\n return meta;\n }\n}\n"]}
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["store.ts"],"names":[],"mappings":";;AACA,8CAA8C;AAE9C,MAAqB,cAAe,SAAQ,0BAAa;IACvD,IAAI,WAAW;;QACb,IAAI,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC;QAE7B,0EAA0E;QAC1E,0EAA0E;QAC1E,4EAA4E;QAC5E,0EAA0E;QAC1E,2CAA2C;QAC3C,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,kBAAkB,CAAC,mCAAI,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC;QAE/E,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAbD,iCAaC","sourcesContent":["import { AddonMeta } from '@embroider/core';\nimport { EmberDataBase } from '../ember-data';\n\nexport default class EmberDataStore extends EmberDataBase {\n get packageMeta(): Partial<AddonMeta> {\n let meta = super.packageMeta;\n\n // this is here because the compat-adapter for @ember-data/debug adds this\n // to externals because it has an undeclared peerDep on us, and thus might\n // resolve totally incorrect copies. By making it external we leave it up to\n // runtime, where we will find this implicit-module for the actual copy of\n // @ember-data/store that is active in app.\n meta['implicit-modules'] = [...(meta['implicit-modules'] ?? []), './index.js'];\n\n return meta;\n }\n}\n"]}
@@ -111,6 +111,7 @@ class RewriteManifest extends broccoli_plugin_1.default {
111
111
  this.extraAppFiles = extraAppFiles;
112
112
  }
113
113
  build() {
114
+ var _a;
114
115
  let json = (0, fs_extra_1.readJSONSync)((0, path_1.join)(this.inputPaths[0], 'package.json'));
115
116
  let extraAppFiles = json.fastboot.manifest.appFiles.filter(this.scriptFilter);
116
117
  for (let file of this.extraAppFiles) {
@@ -144,7 +145,7 @@ class RewriteManifest extends broccoli_plugin_1.default {
144
145
  // because we contain a subdir with its own package.json, that subdir
145
146
  // becomes a "package" from emroider's perspective, and if we want it to get
146
147
  // treated as ember code it needs to have v2 addon metadata
147
- json.keywords = [...(json.keywords ?? []), 'ember-addon'];
148
+ json.keywords = [...((_a = json.keywords) !== null && _a !== void 0 ? _a : []), 'ember-addon'];
148
149
  let meta = {
149
150
  type: 'addon',
150
151
  version: 2,
@@ -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;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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,IAAI,CAAC,QAAQ,IAAI,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 { 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 { 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,s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,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 { 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 { 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"]}
@@ -135,7 +135,7 @@ class CompatAppBuilder {
135
135
  // a given package, to align with how ember-cli resolves addons. So here
136
136
  // we only include dependencies that definitely appear in one of the other
137
137
  // sections.
138
- addon => pkg.packageJSON.dependencies?.[addon.name] || pkg.packageJSON.devDependencies?.[addon.name]);
138
+ addon => { var _a, _b; return ((_a = pkg.packageJSON.dependencies) === null || _a === void 0 ? void 0 : _a[addon.name]) || ((_b = pkg.packageJSON.devDependencies) === null || _b === void 0 ? void 0 : _b[addon.name]); });
139
139
  if (pkg === this.appPackageWithMovedDeps) {
140
140
  let extras = [this.synthVendor, this.synthStyles].filter(this.isActiveAddon);
141
141
  result = [...result, ...extras];
@@ -596,6 +596,7 @@ class CompatAppBuilder {
596
596
  }
597
597
  }
598
598
  updateAppJS(inputPaths) {
599
+ var _a;
599
600
  if (!this.engines) {
600
601
  this.engines = this.partitionEngines(inputPaths.appJS).map(engine => {
601
602
  if (engine.sourcePath === inputPaths.appJS) {
@@ -630,9 +631,12 @@ class CompatAppBuilder {
630
631
  }
631
632
  for (let engine of this.engines) {
632
633
  engine.appSync.update();
633
- engine.fastbootSync?.update();
634
+ (_a = engine.fastbootSync) === null || _a === void 0 ? void 0 : _a.update();
634
635
  }
635
- return this.engines.map(({ engine, appSync, fastbootSync }) => new app_files_1.AppFiles(engine, appSync.files, fastbootSync?.files ?? new Set(), this.resolvableExtensionsPattern, this.podModulePrefix()));
636
+ return this.engines.map(({ engine, appSync, fastbootSync }) => {
637
+ var _a;
638
+ return new app_files_1.AppFiles(engine, appSync.files, (_a = fastbootSync === null || fastbootSync === void 0 ? void 0 : fastbootSync.files) !== null && _a !== void 0 ? _a : new Set(), this.resolvableExtensionsPattern, this.podModulePrefix());
639
+ });
636
640
  }
637
641
  prepareAsset(asset, appFiles, prepared, emberENV) {
638
642
  if (asset.kind === 'ember') {
@@ -900,7 +904,7 @@ class CompatAppBuilder {
900
904
  (0, fs_extra_1.writeFileSync)((0, path_2.join)(this.root, '_babel_filter_.js'), babelFilterTemplate({ skipBabel: this.options.skipBabel, appRoot: this.origAppPackage.root }), 'utf8');
901
905
  }
902
906
  addResolverConfig(config) {
903
- (0, fs_extra_1.outputJSONSync)((0, path_2.join)((0, core_1.locateEmbroiderWorkingDir)(this.compatApp.root), 'resolver.json'), config);
907
+ (0, fs_extra_1.outputJSONSync)((0, path_2.join)((0, core_1.locateEmbroiderWorkingDir)(this.compatApp.root), 'resolver.json'), config, { spaces: 2 });
904
908
  }
905
909
  shouldSplitRoute(routeName) {
906
910
  return (!this.options.splitAtRoutes ||