@embroider/compat 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -6
- package/src/audit/babel-visitor.d.ts +1 -1
- package/src/audit/babel-visitor.js.map +1 -1
- package/src/audit/build.js +5 -1
- package/src/audit/build.js.map +1 -1
- package/src/audit-cli.js +0 -0
- package/src/v1-addon.js +8 -0
- package/src/v1-addon.js.map +1 -1
- package/src/v1-app.js +9 -2
- package/src/v1-app.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embroider/compat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Backward compatibility layer for the Embroider build system.",
|
|
6
6
|
"repository": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
30
30
|
"@babel/preset-env": "^7.14.5",
|
|
31
31
|
"@babel/traverse": "^7.14.5",
|
|
32
|
-
"@embroider/macros": "1.
|
|
33
|
-
"@embroider/shared-internals": "1.
|
|
32
|
+
"@embroider/macros": "1.8.0",
|
|
33
|
+
"@embroider/shared-internals": "1.8.0",
|
|
34
34
|
"@types/babel__code-frame": "^7.0.2",
|
|
35
35
|
"@types/yargs": "^17.0.3",
|
|
36
36
|
"assert-never": "^1.1.0",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@embroider/sample-transforms": "0.0.0",
|
|
66
66
|
"@embroider/test-support": "0.36.0",
|
|
67
|
+
"@glimmer/syntax": "0.80.0",
|
|
67
68
|
"@types/babel__core": "^7.1.14",
|
|
68
69
|
"@types/babel__generator": "^7.6.2",
|
|
69
70
|
"@types/babel__template": "^7.4.0",
|
|
@@ -77,14 +78,14 @@
|
|
|
77
78
|
"@types/resolve": "^1.20.0",
|
|
78
79
|
"@types/semver": "^7.3.6",
|
|
79
80
|
"@types/strip-bom": "^4.0.1",
|
|
80
|
-
"
|
|
81
|
+
"broccoli-stew": "^3.0.0",
|
|
81
82
|
"ember-cli-htmlbars-3": "npm:ember-cli-htmlbars@3",
|
|
82
|
-
"
|
|
83
|
+
"ember-cli-htmlbars-inline-precompile": "^2.1.0",
|
|
83
84
|
"ember-engines": "^0.8.19",
|
|
84
85
|
"typescript": "*"
|
|
85
86
|
},
|
|
86
87
|
"peerDependencies": {
|
|
87
|
-
"@embroider/core": "1.
|
|
88
|
+
"@embroider/core": "1.8.0"
|
|
88
89
|
},
|
|
89
90
|
"engines": {
|
|
90
91
|
"node": "12.* || 14.* || >= 16"
|
|
@@ -33,7 +33,7 @@ export declare class CodeFrameStorage {
|
|
|
33
33
|
private codeFrames;
|
|
34
34
|
private rawSources;
|
|
35
35
|
forSource(rawSource: string): (node: {
|
|
36
|
-
loc
|
|
36
|
+
loc?: SourceLocation | null;
|
|
37
37
|
}) => number | undefined;
|
|
38
38
|
render(codeFrameIndex: number | undefined): string | undefined;
|
|
39
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-visitor.js","sourceRoot":"","sources":["babel-visitor.ts"],"names":[],"mappings":";;;;;;AAAA,+DAA2D;AAC3D,sCAA0E;AAC1E,kDAAqE;AAErE,MAAa,YAAY;CAAG;AAA5B,oCAA4B;AAgB5B,SAAgB,iBAAiB,CAAC,KAA+B;IAC/D,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAFD,8CAEC;AAMD,yCAAyC;AACzC,SAAgB,OAAO,CAAC,SAAiB,EAAE,QAAgB,EAAE,WAA6B,EAAE,MAAwB;IAClH,IAAI,OAAO,GAAG,EAAsB,CAAC;IACrC,IAAI,OAAO,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC5C,IAAI,QAAQ,GAAG,EAA+E,CAAC;IAE/F,2DAA2D;IAC3D,4EAA4E;IAC5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AK,mBAAmB;YACtB,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,0BAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClF,KAAK,qBAAqB,CAAC;QAC3B,KAAK,kBAAkB;YACrB,OAAO,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,IAAI,0BAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChF;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC","sourcesContent":["import traverse, { NodePath, Node } from '@babel/traverse';\nimport { TransformOptions, transformSync, types as t } from '@babel/core';\nimport { codeFrameColumns, SourceLocation } from '@babel/code-frame';\n\nexport class VisitorState {}\n\nexport interface InternalImport {\n source: string;\n codeFrameIndex: number | undefined;\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 codeFrameIndex: number | undefined;\n }[];\n}\n\nexport interface NamespaceMarker {\n isNamespace: true;\n}\n\nexport function isNamespaceMarker(value: string | NamespaceMarker): value is NamespaceMarker {\n return typeof value !== 'string';\n}\n\nexport interface ExportAll {\n all: string;\n}\n\n// babelConfig must include { ast: true }\nexport function auditJS(rawSource: string, filename: string, babelConfig: TransformOptions, frames: CodeFrameStorage) {\n let imports = [] as InternalImport[];\n let exports = new Set<string | ExportAll>();\n let problems = [] as { message: string; detail: string; codeFrameIndex: number | undefined }[];\n\n /* eslint-disable @typescript-eslint/no-inferrable-types */\n // These are not really inferrable. Without explicit declarations, TS thinks\n // they're always false because it doesn't know the handler methods run\n // synchronously\n let sawModule: boolean = false;\n let sawExports: boolean = false;\n let sawDefine: boolean = false;\n /* eslint-enable @typescript-eslint/no-inferrable-types */\n\n let ast = transformSync(rawSource, Object.assign({ filename: filename }, babelConfig))!.ast!;\n let saveCodeFrame = frames.forSource(rawSource);\n\n traverse(ast, {\n Identifier(path: NodePath<t.Identifier>) {\n if (path.node.name === 'module' && isFreeVariable(path)) {\n sawModule = true;\n } else if (path.node.name === 'exports' && isFreeVariable(path)) {\n sawExports = true;\n } else if (path.node.name === 'define' && isFreeVariable(path)) {\n sawDefine = true;\n }\n if (inExportDeclarationContext(path)) {\n exports.add(path.node.name);\n }\n },\n CallExpression(path: NodePath<t.CallExpression>) {\n let callee = path.get('callee');\n if (callee.referencesImport('@embroider/macros', 'importSync') || t.isImport(callee)) {\n let arg = path.node.arguments[0];\n if (arg.type === 'StringLiteral') {\n imports.push({\n source: arg.value,\n codeFrameIndex: saveCodeFrame(arg),\n specifiers: [],\n });\n } else {\n problems.push({\n message: `audit tool is unable to understand this usage of ${t.isImport(callee) ? 'import' : 'importSync'}`,\n detail: arg.type,\n codeFrameIndex: saveCodeFrame(arg),\n });\n }\n }\n },\n ImportDeclaration(path: NodePath<t.ImportDeclaration>) {\n imports.push({\n source: path.node.source.value,\n codeFrameIndex: saveCodeFrame(path.node.source),\n specifiers: [],\n });\n },\n ImportDefaultSpecifier(path: NodePath<t.ImportDefaultSpecifier>) {\n imports[imports.length - 1].specifiers.push({\n name: 'default',\n local: path.node.local.name,\n codeFrameIndex: saveCodeFrame(path.node),\n });\n },\n ImportNamespaceSpecifier(path: NodePath<t.ImportNamespaceSpecifier>) {\n imports[imports.length - 1].specifiers.push({\n name: { isNamespace: true },\n local: path.node.local.name,\n codeFrameIndex: saveCodeFrame(path.node),\n });\n },\n ImportSpecifier(path: NodePath<t.ImportSpecifier>) {\n imports[imports.length - 1].specifiers.push({\n name: name(path.node.imported),\n local: path.node.local.name,\n codeFrameIndex: saveCodeFrame(path.node),\n });\n },\n ExportDefaultDeclaration(_path: NodePath<t.ExportDefaultDeclaration>) {\n exports.add('default');\n },\n ExportSpecifier(path: NodePath<t.ExportSpecifier>) {\n exports.add(name(path.node.exported));\n if (path.parent.type === 'ExportNamedDeclaration' && path.parent.source) {\n imports[imports.length - 1].specifiers.push({\n name: name(path.node.local),\n local: null, // re-exports don't create local bindings\n codeFrameIndex: saveCodeFrame(path.node),\n });\n }\n },\n ExportNamespaceSpecifier(path: NodePath<t.ExportNamespaceSpecifier>) {\n exports.add(name(path.node.exported));\n if (path.parent.type === 'ExportNamedDeclaration' && path.parent.source) {\n imports[imports.length - 1].specifiers.push({\n name: { isNamespace: true },\n local: null, // re-exports don't create local bindings\n codeFrameIndex: saveCodeFrame(path.node),\n });\n }\n },\n ExportAllDeclaration(path: NodePath<t.ExportAllDeclaration>) {\n exports.add({ all: path.node.source.value });\n imports.push({\n source: path.node.source.value,\n codeFrameIndex: saveCodeFrame(path.node.source),\n specifiers: [\n {\n name: { isNamespace: true },\n local: null,\n codeFrameIndex: saveCodeFrame(path.node),\n },\n ],\n });\n },\n ExportNamedDeclaration(path: NodePath<t.ExportNamedDeclaration>) {\n if (path.node.source) {\n imports.push({\n source: path.node.source.value,\n codeFrameIndex: saveCodeFrame(path.node.source),\n specifiers: [],\n });\n }\n },\n });\n\n let isCJS = imports.length === 0 && exports.size === 0 && (sawModule || sawExports);\n let isAMD = imports.length === 0 && exports.size === 0 && sawDefine;\n return { imports, exports, isCJS, isAMD, problems };\n}\n\nexport class CodeFrameStorage {\n private codeFrames = [] as { rawSourceIndex: number; loc: SourceLocation }[];\n private rawSources = [] as string[];\n\n forSource(rawSource: string): (node: { loc: SourceLocation | null }) => number | undefined {\n let rawSourceIndex: number | undefined;\n return (node: { loc: SourceLocation | null }) => {\n let loc = node.loc;\n if (!loc) {\n return;\n }\n if (rawSourceIndex == null) {\n rawSourceIndex = this.rawSources.length;\n this.rawSources.push(rawSource);\n }\n let codeFrameIndex = this.codeFrames.length;\n this.codeFrames.push({\n rawSourceIndex,\n loc,\n });\n return codeFrameIndex;\n };\n }\n\n render(codeFrameIndex: number | undefined): string | undefined {\n if (codeFrameIndex != null) {\n let { loc, rawSourceIndex } = this.codeFrames[codeFrameIndex];\n return codeFrameColumns(this.rawSources[rawSourceIndex], loc, { highlightCode: true });\n }\n }\n}\n\nfunction name(node: t.StringLiteral | t.Identifier): string {\n if (t.isStringLiteral(node)) {\n return node.value;\n } else {\n return node.name;\n }\n}\n\nfunction isFreeVariable(path: NodePath<t.Identifier>) {\n return !path.scope.hasBinding(path.node.name);\n}\n\nconst contextCache: WeakMap<Node, boolean> = new WeakMap();\n\nfunction inExportDeclarationContext(path: NodePath): boolean {\n if (contextCache.has(path.node)) {\n return contextCache.get(path.node)!;\n } else {\n let answer = _inExportDeclarationContext(path);\n contextCache.set(path.node, answer);\n return answer;\n }\n}\n\nfunction _inExportDeclarationContext(path: NodePath): boolean {\n let parent = path.parent;\n switch (parent.type) {\n case 'ExportNamedDeclaration':\n return parent.declaration === path.node;\n case 'VariableDeclaration':\n case 'ObjectPattern':\n case 'ArrayPattern':\n case 'RestElement':\n return inExportDeclarationContext(path.parentPath);\n case 'VariableDeclarator':\n return parent.id === path.node && inExportDeclarationContext(path.parentPath);\n case 'ObjectProperty':\n return parent.value === path.node && inExportDeclarationContext(path.parentPath);\n case 'AssignmentPattern':\n return parent.left === path.node && inExportDeclarationContext(path.parentPath);\n case 'FunctionDeclaration':\n case 'ClassDeclaration':\n return parent.id === path.node && inExportDeclarationContext(path.parentPath);\n default:\n return false;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"babel-visitor.js","sourceRoot":"","sources":["babel-visitor.ts"],"names":[],"mappings":";;;;;;AAAA,+DAA2D;AAC3D,sCAA0E;AAC1E,kDAAqE;AAErE,MAAa,YAAY;CAAG;AAA5B,oCAA4B;AAgB5B,SAAgB,iBAAiB,CAAC,KAA+B;IAC/D,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAFD,8CAEC;AAMD,yCAAyC;AACzC,SAAgB,OAAO,CAAC,SAAiB,EAAE,QAAgB,EAAE,WAA6B,EAAE,MAAwB;IAClH,IAAI,OAAO,GAAG,EAAsB,CAAC;IACrC,IAAI,OAAO,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC5C,IAAI,QAAQ,GAAG,EAA+E,CAAC;IAE/F,2DAA2D;IA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AC,CAAC;QACnF,KAAK,mBAAmB;YACtB,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,0BAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClF,KAAK,qBAAqB,CAAC;QAC3B,KAAK,kBAAkB;YACrB,OAAO,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,IAAI,0BAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChF;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC","sourcesContent":["import traverse, { NodePath, Node } from '@babel/traverse';\nimport { TransformOptions, transformSync, types as t } from '@babel/core';\nimport { codeFrameColumns, SourceLocation } from '@babel/code-frame';\n\nexport class VisitorState {}\n\nexport interface InternalImport {\n source: string;\n codeFrameIndex: number | undefined;\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 codeFrameIndex: number | undefined;\n }[];\n}\n\nexport interface NamespaceMarker {\n isNamespace: true;\n}\n\nexport function isNamespaceMarker(value: string | NamespaceMarker): value is NamespaceMarker {\n return typeof value !== 'string';\n}\n\nexport interface ExportAll {\n all: string;\n}\n\n// babelConfig must include { ast: true }\nexport function auditJS(rawSource: string, filename: string, babelConfig: TransformOptions, frames: CodeFrameStorage) {\n let imports = [] as InternalImport[];\n let exports = new Set<string | ExportAll>();\n let problems = [] as { message: string; detail: string; codeFrameIndex: number | undefined }[];\n\n /* eslint-disable @typescript-eslint/no-inferrable-types */\n // These are not really inferrable. Without explicit declarations, TS thinks\n // they're always false because it doesn't know the handler methods run\n // synchronously\n let sawModule: boolean = false;\n let sawExports: boolean = false;\n let sawDefine: boolean = false;\n /* eslint-enable @typescript-eslint/no-inferrable-types */\n\n let ast = transformSync(rawSource, Object.assign({ filename: filename }, babelConfig))!.ast!;\n let saveCodeFrame = frames.forSource(rawSource);\n\n traverse(ast, {\n Identifier(path: NodePath<t.Identifier>) {\n if (path.node.name === 'module' && isFreeVariable(path)) {\n sawModule = true;\n } else if (path.node.name === 'exports' && isFreeVariable(path)) {\n sawExports = true;\n } else if (path.node.name === 'define' && isFreeVariable(path)) {\n sawDefine = true;\n }\n if (inExportDeclarationContext(path)) {\n exports.add(path.node.name);\n }\n },\n CallExpression(path: NodePath<t.CallExpression>) {\n let callee = path.get('callee');\n if (callee.referencesImport('@embroider/macros', 'importSync') || t.isImport(callee)) {\n let arg = path.node.arguments[0];\n if (arg.type === 'StringLiteral') {\n imports.push({\n source: arg.value,\n codeFrameIndex: saveCodeFrame(arg),\n specifiers: [],\n });\n } else {\n problems.push({\n message: `audit tool is unable to understand this usage of ${t.isImport(callee) ? 'import' : 'importSync'}`,\n detail: arg.type,\n codeFrameIndex: saveCodeFrame(arg),\n });\n }\n }\n },\n ImportDeclaration(path: NodePath<t.ImportDeclaration>) {\n imports.push({\n source: path.node.source.value,\n codeFrameIndex: saveCodeFrame(path.node.source),\n specifiers: [],\n });\n },\n ImportDefaultSpecifier(path: NodePath<t.ImportDefaultSpecifier>) {\n imports[imports.length - 1].specifiers.push({\n name: 'default',\n local: path.node.local.name,\n codeFrameIndex: saveCodeFrame(path.node),\n });\n },\n ImportNamespaceSpecifier(path: NodePath<t.ImportNamespaceSpecifier>) {\n imports[imports.length - 1].specifiers.push({\n name: { isNamespace: true },\n local: path.node.local.name,\n codeFrameIndex: saveCodeFrame(path.node),\n });\n },\n ImportSpecifier(path: NodePath<t.ImportSpecifier>) {\n imports[imports.length - 1].specifiers.push({\n name: name(path.node.imported),\n local: path.node.local.name,\n codeFrameIndex: saveCodeFrame(path.node),\n });\n },\n ExportDefaultDeclaration(_path: NodePath<t.ExportDefaultDeclaration>) {\n exports.add('default');\n },\n ExportSpecifier(path: NodePath<t.ExportSpecifier>) {\n exports.add(name(path.node.exported));\n if (path.parent.type === 'ExportNamedDeclaration' && path.parent.source) {\n imports[imports.length - 1].specifiers.push({\n name: name(path.node.local),\n local: null, // re-exports don't create local bindings\n codeFrameIndex: saveCodeFrame(path.node),\n });\n }\n },\n ExportNamespaceSpecifier(path: NodePath<t.ExportNamespaceSpecifier>) {\n exports.add(name(path.node.exported));\n if (path.parent.type === 'ExportNamedDeclaration' && path.parent.source) {\n imports[imports.length - 1].specifiers.push({\n name: { isNamespace: true },\n local: null, // re-exports don't create local bindings\n codeFrameIndex: saveCodeFrame(path.node),\n });\n }\n },\n ExportAllDeclaration(path: NodePath<t.ExportAllDeclaration>) {\n exports.add({ all: path.node.source.value });\n imports.push({\n source: path.node.source.value,\n codeFrameIndex: saveCodeFrame(path.node.source),\n specifiers: [\n {\n name: { isNamespace: true },\n local: null,\n codeFrameIndex: saveCodeFrame(path.node),\n },\n ],\n });\n },\n ExportNamedDeclaration(path: NodePath<t.ExportNamedDeclaration>) {\n if (path.node.source) {\n imports.push({\n source: path.node.source.value,\n codeFrameIndex: saveCodeFrame(path.node.source),\n specifiers: [],\n });\n }\n },\n });\n\n let isCJS = imports.length === 0 && exports.size === 0 && (sawModule || sawExports);\n let isAMD = imports.length === 0 && exports.size === 0 && sawDefine;\n return { imports, exports, isCJS, isAMD, problems };\n}\n\nexport class CodeFrameStorage {\n private codeFrames = [] as { rawSourceIndex: number; loc: SourceLocation }[];\n private rawSources = [] as string[];\n\n forSource(rawSource: string): (node: { loc?: SourceLocation | null }) => number | undefined {\n let rawSourceIndex: number | undefined;\n return (node: { loc?: SourceLocation | null | undefined }) => {\n let loc = node.loc;\n if (!loc) {\n return;\n }\n if (rawSourceIndex == null) {\n rawSourceIndex = this.rawSources.length;\n this.rawSources.push(rawSource);\n }\n let codeFrameIndex = this.codeFrames.length;\n this.codeFrames.push({\n rawSourceIndex,\n loc,\n });\n return codeFrameIndex;\n };\n }\n\n render(codeFrameIndex: number | undefined): string | undefined {\n if (codeFrameIndex != null) {\n let { loc, rawSourceIndex } = this.codeFrames[codeFrameIndex];\n return codeFrameColumns(this.rawSources[rawSourceIndex], loc, { highlightCode: true });\n }\n }\n}\n\nfunction name(node: t.StringLiteral | t.Identifier): string {\n if (t.isStringLiteral(node)) {\n return node.value;\n } else {\n return node.name;\n }\n}\n\nfunction isFreeVariable(path: NodePath<t.Identifier>) {\n return !path.scope.hasBinding(path.node.name);\n}\n\nconst contextCache: WeakMap<Node, boolean> = new WeakMap();\n\nfunction inExportDeclarationContext(path: NodePath): boolean {\n if (contextCache.has(path.node)) {\n return contextCache.get(path.node)!;\n } else {\n let answer = _inExportDeclarationContext(path);\n contextCache.set(path.node, answer);\n return answer;\n }\n}\n\nfunction _inExportDeclarationContext(path: NodePath): boolean {\n let parent = path.parent;\n switch (parent.type) {\n case 'ExportNamedDeclaration':\n return parent.declaration === path.node;\n case 'VariableDeclaration':\n case 'ObjectPattern':\n case 'ArrayPattern':\n case 'RestElement':\n return inExportDeclarationContext(path.parentPath);\n case 'VariableDeclarator':\n return parent.id === path.node && inExportDeclarationContext(path.parentPath);\n case 'ObjectProperty':\n return parent.value === path.node && inExportDeclarationContext(path.parentPath);\n case 'AssignmentPattern':\n return parent.left === path.node && inExportDeclarationContext(path.parentPath);\n case 'FunctionDeclaration':\n case 'ClassDeclaration':\n return parent.id === path.node && inExportDeclarationContext(path.parentPath);\n default:\n return false;\n }\n}\n"]}
|
package/src/audit/build.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/src/audit/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,sDAAoC;AAEpC,uCAA0C;AAEnC,KAAK,UAAU,QAAQ,CAAC,OAA0B;IACvD,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,wDAAa,iBAAa,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,GAAC,CAAC;IAC/F,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,MAAM,CAAC;IACjC,IAAI,OAAO,GAAG,IAAI,uBAAa,EAAE,CAAC;IAClC,IAAI,IAAI,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IAC9F,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,mEAAmE;IACnE,8CAA8C;IAC9C,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC;IACzD,IAAI;QACF,IAAI,MAAM,GAAG,MAAM,GAAG,CAAC;YACrB,OAAO,EAAE,CAAC,OAAO,CAAC;YAClB,YAAY,EAAE,OAAO;YACrB,WAAW,EAAE,OAAO;SACrB,CAAC,CAAC;QACH,IAAI,QAAQ,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;QACrE,mEAAmE;QACnE,IAAI,QAAQ,IAAI,IAAI,IAAI,QAAQ,KAAK,CAAC,EAAE;YACtC,MAAM,IAAI,UAAU,CAClB,GAAG,eAAK,CAAC,MAAM,CAAC,uBAAuB,CAAC,qDAAqD,OAAO,CAAC,MAAM,EAAE,CAC9G,CAAC;SACH;KACF;YAAS;QACR,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACvB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACzB,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;KAC5B;AACH,CAAC;AA5BD,4BA4BC;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,aAAH,GAAG,uBAAH,GAAG,CAAE,YAAY,CAAC;AAC3B,CAAC;AAFD,oCAEC","sourcesContent":["import chalk from 'chalk';\nimport resolveModule from 'resolve';\nimport { AuditBuildOptions } from '../audit';\nimport { CaptureStream } from './capture';\n\nexport async function buildApp(options: AuditBuildOptions): Promise<void> {\n let { default: cli } = await import(resolveModule.sync('ember-cli', { basedir: options.app }));\n process.env.STAGE2_ONLY = 'true';\n let capture = new CaptureStream();\n let orig = { cwd: process.cwd(), log: console.log, error: console.error, warn: console.warn };\n process.chdir(options.app);\n // this is icky, but too many things in the build don't respect the\n // `outputStream`, etc, options we pass below.\n console.log = console.warn = console.error = capture.log;\n try {\n let result = await cli({\n cliArgs: ['build'],\n outputStream: capture,\n errorStream: capture,\n });\n let exitCode = typeof result === 'object' ? result.exitCode : result;\n // an undefined exit code means success, because of course it does.\n if (exitCode != null && exitCode !== 0) {\n throw new BuildError(\n `${chalk.yellow('Unable to begin audit')} because the build failed. Build output follows:\\n${capture.output}`\n );\n }\n } finally {\n process.chdir(orig.cwd);\n console.log = orig.log;\n console.warn = orig.warn;\n console.error = orig.error;\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"]}
|
package/src/audit-cli.js
CHANGED
|
File without changes
|
package/src/v1-addon.js
CHANGED
|
@@ -404,9 +404,17 @@ class V1Addon {
|
|
|
404
404
|
// applies preprocessors to JS and HBS
|
|
405
405
|
transpile(tree) {
|
|
406
406
|
var _a;
|
|
407
|
+
// Namespace the tree being passed to preprocessJs with the moduleName
|
|
408
|
+
// to mimic classic build
|
|
409
|
+
tree = (0, broccoli_funnel_1.default)(tree, { destDir: this.moduleName });
|
|
407
410
|
tree = this.addonInstance.preprocessJs(tree, '/', this.moduleName, {
|
|
408
411
|
registry: this.addonInstance.registry,
|
|
409
412
|
});
|
|
413
|
+
// Remove namespacing so that it gets written out to the node_modules
|
|
414
|
+
// directory correctly.
|
|
415
|
+
tree = (0, broccoli_funnel_1.default)(tree, {
|
|
416
|
+
srcDir: this.moduleName,
|
|
417
|
+
});
|
|
410
418
|
if (this.addonInstance.shouldCompileTemplates() && ((_a = this.addonInstance.registry.load('template')) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
411
419
|
tree = this.app.preprocessRegistry.preprocessTemplates(tree, {
|
|
412
420
|
registry: this.addonInstance.registry,
|
package/src/v1-addon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1-addon.js","sourceRoot":"","sources":["v1-addon.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAA6C;AAC7C,+BAA2D;AAC3D,mCAA2C;AAC3C,uCAAsD;AACtD,sEAAwE;AACxE,qDAA2D;AAC3D,kFAAwD;AACxD,2DAAiE;AAEjE,gFAA8C;AAC9C,oDAA4B;AAC5B,8EAAoD;AACpD,qCAA2C;AAC3C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AG,EAAE;IACxB,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAEF,YAAY,CAAC,OAAO,GAAG,GAAG,EAAE;IAC1B,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC","sourcesContent":["import { Memoize } from 'typescript-memoize';\nimport { dirname, isAbsolute, join, relative } from 'path';\nimport { sync as pkgUpSync } from 'pkg-up';\nimport { existsSync, pathExistsSync } from 'fs-extra';\nimport buildFunnel, { Options as FunnelOptions } from 'broccoli-funnel';\nimport { UnwatchedDir, WatchedDir } from 'broccoli-source';\nimport RewritePackageJSON from './rewrite-package-json';\nimport { todo, unsupported } from '@embroider/core/src/messages';\nimport { Node } from 'broccoli-node-api';\nimport mergeTrees from 'broccoli-merge-trees';\nimport semver from 'semver';\nimport rewriteAddonTree from './rewrite-addon-tree';\nimport { mergeWithAppend } from './merges';\nimport {\n AddonMeta,\n NodeTemplateCompiler,\n debug,\n PackageCache,\n Resolver,\n extensionsPattern,\n AddonInstance,\n AddonTreePath,\n} from '@embroider/core';\nimport Options from './options';\nimport walkSync from 'walk-sync';\nimport ObserveTree from './observe-tree';\nimport type { Options as HTMLBarsOptions } from 'ember-cli-htmlbars';\nimport { isEmbroiderMacrosPlugin } from '@embroider/macros/src/node';\nimport { TransformOptions, PluginItem } from '@babel/core';\nimport V1App from './v1-app';\nimport modulesCompat from './modules-compat';\nimport writeFile from 'broccoli-file-creator';\nimport SynthesizeTemplateOnlyComponents from './synthesize-template-only-components';\nimport {\n isEmberAutoImportDynamic,\n isCompactReexports,\n isColocationPlugin,\n isInlinePrecompilePlugin,\n} from './detect-babel-plugins';\nimport { ResolvedDep } from '@embroider/core/src/resolver';\nimport TemplateCompilerBroccoliPlugin from './template-compiler-broccoli-plugin';\nimport { fromPairs } from 'lodash';\nimport { getEmberExports } from '@embroider/core/src/load-ember-template-compiler';\nimport prepHtmlbarsAstPluginsForUnwrap from './prepare-htmlbars-ast-plugins';\nimport getRealAddon from './get-real-addon';\n\nconst stockTreeNames: AddonTreePath[] = Object.freeze([\n 'addon',\n 'addon-styles',\n 'styles',\n 'addon-test-support',\n 'test-support',\n 'app',\n 'public',\n 'vendor',\n // 'addon-templates' and 'templates are trees too, but they live inside\n // 'addon' and 'app' and we handle them there.\n]) as AddonTreePath[];\n\nconst dynamicTreeHooks = Object.freeze([\n 'treeFor',\n 'treeForAddon',\n 'treeForAddonTemplates',\n 'treeForAddonTestSupport',\n 'treeForApp',\n 'treeForPublic',\n 'treeForStyles',\n 'treeForTemplates',\n 'treeForTestSupport',\n 'treeForVendor',\n]);\n\nconst appPublicationDir = '_app_';\nconst fastbootPublicationDir = '_fastboot_';\n\n/**\n * Creating a interface here just to keep the Resolver's structure as it is.\n */\ninterface ResolverParams {\n root: string;\n modulePrefix: string;\n}\n\nexport function resolver(params: ResolverParams): V1AddonCompatResolver {\n return new V1AddonCompatResolver(params);\n}\n\nclass V1AddonCompatResolver implements Resolver {\n params: ResolverParams;\n\n _parallelBabel: {\n requireFile: string;\n buildUsing: string;\n params: ResolverParams;\n };\n\n constructor(params: ResolverParams) {\n this.params = params;\n this._parallelBabel = {\n requireFile: __filename,\n buildUsing: 'resolver',\n params,\n };\n }\n astTransformer(_templateCompiler: NodeTemplateCompiler): unknown {\n return;\n }\n dependenciesOf(_moduleName: string): ResolvedDep[] {\n return [];\n }\n absPathToRuntimePath(absPath: string) {\n if (isAbsolute(absPath)) {\n return absPath;\n }\n return join(this.params.modulePrefix, absPath);\n }\n absPathToRuntimeName(absPath: string) {\n return this.absPathToRuntimePath(absPath)\n .replace(extensionsPattern(['.js', '.hbs']), '')\n .replace(/\\/index$/, '');\n }\n get adjustImportsOptions(): Resolver['adjustImportsOptions'] {\n throw new Error(`bug: the addon compat resolver only supports absPath mapping`);\n }\n}\n\n// This controls and types the interface between our new world and the classic\n// v1 addon instance.\nexport default class V1Addon {\n constructor(\n protected addonInstance: AddonInstance,\n protected addonOptions: Required<Options>,\n protected app: V1App,\n private packageCache: PackageCache,\n private orderIdx: number\n ) {\n if (addonInstance.registry) {\n this.updateRegistry(addonInstance.registry);\n }\n }\n\n // Optional extensible hook for pruning down the list of redundant addon\n // instances produced by the classic ember-cli architecture. ember-cli\n // instantiates each addon *per consumer*, not per package. So a given package\n // will have many addon instances, and Embroider dutifully produces a V1Addon\n // instance for each one, and then needs to mimic the classic smooshing\n // behavior between them.\n //\n // But some packages (and ember-cli-babel is the motivating example) produce a\n // huge number of instances that do nothing useful and incur significant cost.\n // This hook allows their compat adapter to prune down the set, using\n // addon-specific knowledge of which instance(s) are actually important.\n //\n // The order of the instances is significant. The first one is the one with\n // the highest precedence, meaning its files would win under classic\n // smooshing.\n reduceInstances(instances: V1Addon[]): V1Addon[] {\n // the default beahvior is that all copies matter\n return instances;\n }\n\n // this is only defined when there are custom AST transforms that need it\n @Memoize()\n private get templateCompiler(): NodeTemplateCompiler | undefined {\n let htmlbars = this.addonInstance.addons.find(a => a.name === 'ember-cli-htmlbars');\n if (htmlbars) {\n let options = (htmlbars as any).htmlbarsOptions() as HTMLBarsOptions;\n if (options?.plugins?.ast) {\n // our macros don't run here in stage1\n options.plugins.ast = options.plugins.ast.filter((p: any) => !isEmbroiderMacrosPlugin(p));\n prepHtmlbarsAstPluginsForUnwrap(this.addonInstance.registry);\n if (options.plugins.ast.length > 0) {\n const { cacheKey: compilerChecksum } = getEmberExports(options.templateCompilerPath);\n\n return new NodeTemplateCompiler({\n compilerPath: options.templateCompilerPath,\n compilerChecksum,\n EmberENV: {},\n plugins: options.plugins,\n resolver: this.templateResolver(),\n });\n }\n }\n }\n }\n\n @Memoize()\n templateResolver(): Resolver {\n return resolver({\n root: this.app.root,\n modulePrefix: this.moduleName,\n });\n }\n\n private updateRegistry(registry: any) {\n // auto-import gets disabled because we support it natively\n registry.remove('js', 'ember-auto-import-analyzer');\n\n // here we're replacing the stock template compiler with our own. Ours\n // leaves hbs files as hbs, not js. The only transformation it is supposed\n // to do is applying any custom AST transforms and reserializing the results\n // back to HBS.\n //\n // Even when no AST transforms are registered, we'll still need to register\n // a no-op transform here to avoid an exception coming out of ember-cli like\n // \"Addon templates were detected, but there are no template compilers\n // registered\".\n registry.remove('template', 'ember-cli-htmlbars');\n registry.add('template', {\n name: 'embroider-addon-templates',\n ext: 'hbs',\n _addon: this,\n toTree(this: { _addon: V1Addon }, tree: Node): Node {\n if (this._addon.templateCompiler) {\n return new TemplateCompilerBroccoliPlugin(tree, this._addon.templateCompiler);\n } else {\n // when there are no custom AST transforms, we don't need to do\n // anything at all.\n return tree;\n }\n },\n });\n\n // first, look into the babel config and related packages to decide whether\n // we need to run babel at all in this stage.\n let needsCustomBabel = this.needsCustomBabel();\n\n // regardless of the answer, we modify the babel config, because even if\n // we're unregistering ember-cli-babel, some addons manually invoke\n // ember-cli-babel in their custom hooks, and in that case we want to be\n // sure we've taken out the babel plugins that really shouldn't run at this\n // stage.\n this.updateBabelConfig();\n\n if (!needsCustomBabel) {\n // no custom babel behavior, so we don't run the ember-cli-babel\n // preprocessor at all. We still need to register a no-op preprocessor to\n // prevent ember-cli from emitting a deprecation warning.\n registry.remove('js', 'ember-cli-babel');\n registry.add('js', {\n name: 'embroider-babel-noop',\n ext: 'js',\n toTree(tree: Node) {\n return tree;\n },\n });\n }\n }\n\n // we need to run custom inline hbs preprocessing if there are custom hbs\n // plugins and there are inline hbs templates\n private needsInlineHBS(): boolean {\n if (!this.templateCompiler) {\n // no custom transforms\n return false;\n }\n if (this.addonInstance.addons.find((a: any) => a.name === 'ember-cli-htmlbars-inline-precompile')) {\n // the older inline template compiler is present\n return true;\n }\n\n if (\n this.addonInstance.addons.find(\n (a: any) =>\n a.name === 'ember-cli-htmlbars' && semver.satisfies(semver.coerce(a.pkg.version) || a.pkg.version, '>4.0.0')\n )\n ) {\n // a version of ember-cli-htmlbars that natively supports inline hbs is present\n return true;\n }\n\n return false;\n }\n\n private needsCustomBabel() {\n if (\n this.addonInstance.addons.find(\n (a: any) =>\n a.name === 'ember-cli-typescript' &&\n semver.satisfies(semver.coerce(a.pkg.version) || a.pkg.version, '>=4.0.0-alpha.1')\n )\n ) {\n // This addon is using ember-cli-typescript 4, which relies on\n // ember-cli-babel to add the TypeScript transform Babel plugin.\n return true;\n }\n\n if (\n this.addonInstance.options &&\n this.addonInstance.options['ember-cli-babel'] &&\n this.addonInstance.options['ember-cli-babel'].enableTypeScriptTransform\n ) {\n // This addon has explicitly configured ember-cli-babel to add the\n // TypeScript transform Babel plugin.\n return true;\n }\n\n if ((this.options.babel?.plugins?.filter(babelPluginAllowedInStage1)?.length ?? 0) > 0) {\n // this addon has custom babel plugins, so we need to run them here in\n // stage1\n return true;\n }\n\n // even if there are no custom babel plugins, if we need to do any\n // preprocessing of inline handlebars templates we still need to run the\n // custom babel.\n return this.needsInlineHBS();\n }\n\n get name(): string {\n return this.packageJSON.name;\n }\n\n // you can override this to change the *input* packageJSON that the rest of\n // stage1 will see. If you want to see and change the *output* packageJSON see\n // `newPackageJSON`.\n protected get packageJSON() {\n return this.packageCache.get(this.root).packageJSON;\n }\n\n protected get newPackageJSON() {\n // shallow copy only! This is OK as long as we're only changing top-level\n // keys in this method\n let pkg = Object.assign({}, this.packageJSON);\n let meta: AddonMeta = Object.assign({}, this.packageCache.get(this.root).meta, this.packageMeta);\n pkg['ember-addon'] = meta;\n\n // classic addons don't get to customize their entrypoints like this. We\n // always rewrite them so their entrypoint is index.js, so whatever was here\n // is just misleading to stage3 packagers that might look (rollup does).\n delete pkg.main;\n delete pkg.module;\n\n return pkg;\n }\n\n @Memoize()\n get root(): string {\n // addonInstance.root gets modified by a customized \"main\" or\n // \"ember-addon.main\" in package.json. We want the real package root here\n // (the place where package.json lives).\n return dirname(pkgUpSync({ cwd: this.addonInstance.root })!);\n }\n\n @Memoize()\n private get mainModule() {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const mod = require((this.addonInstance as unknown as any).constructor._meta_.modulePath);\n\n if (typeof mod === 'function') {\n return mod.prototype;\n } else {\n return mod;\n }\n }\n\n protected get options() {\n if (!this.addonInstance.options) {\n this.addonInstance.options = {};\n return this.addonInstance.options;\n }\n // some addons (like ember-cli-inline-content) assign the *app's* options\n // onto their own this.options. Which means they (accidentally or on\n // purpose), always get the app's babel config, and it means when we try\n // to modify the addon's babel config we're accidentally modifying the\n // app's too.\n //\n // So here we do copying to ensure that we can modify the babel config\n // without altering anybody else. We're not doing cloneDeep because that\n // pulls on our lazy MacrosConfig if it appears in any babel configs here,\n // whereas we want to leave it unevaluated until babel actually uses it.\n let addonOptions =\n typeof this.addonInstance.options == 'function' ? this.addonInstance.options() : this.addonInstance.options;\n let options = Object.assign({}, addonOptions);\n if (options.babel) {\n options.babel = Object.assign({}, options.babel);\n if (options.babel.plugins) {\n options.babel.plugins = options.babel.plugins.slice();\n }\n }\n if (options['ember-cli-babel']) {\n options['ember-cli-babel'] = Object.assign({}, options['ember-cli-babel']);\n }\n\n if (typeof this.addonInstance.options == 'function') {\n this.addonInstance.options = () => options;\n } else {\n this.addonInstance.options = options;\n }\n\n return options;\n }\n\n protected customizes(...treeNames: string[]) {\n // get the real addon as we're going to compare with __proto__\n const realAddon = getRealAddon(this.addonInstance);\n return Boolean(\n treeNames.find(treeName => {\n return (\n // customized hook exists in actual code exported from their index.js\n this.mainModule[treeName] ||\n // addon instance doesn't match its own prototype\n (realAddon.__proto__ && realAddon[treeName] !== realAddon.__proto__[treeName])\n );\n })\n );\n }\n\n @Memoize()\n private hasStockTree(treeName: AddonTreePath): boolean {\n if (this.suppressesTree(treeName)) {\n return false;\n }\n\n // we need to use this.addonInstance.root instead of this.root here because\n // we're looking for the classic location of the stock tree, and that\n // location is influenced by a customized ember-addon.main in package.json,\n // which is reflected in addonInstance.root.\n return (\n this.addonInstance.treePaths && existsSync(join(this.addonInstance.root, this.addonInstance.treePaths[treeName]))\n );\n }\n\n hasAnyTrees(): boolean {\n return Boolean(stockTreeNames.find(name => this.hasStockTree(name))) || this.customizes(...dynamicTreeHooks);\n }\n\n // we keep all these here to ensure that we always apply the same options to\n // the same tree, so that our cache doesn't need to worry about varying\n // options.\n private stockTreeFunnelOptions(treeName: string): FunnelOptions | undefined {\n switch (treeName) {\n case 'addon':\n return {\n exclude: ['styles/**'],\n };\n case 'styles':\n return {\n destDir: '_app_styles_',\n };\n case 'addon-test-support':\n return {\n destDir: 'test-support',\n };\n case 'app':\n return {\n exclude: ['styles/**'],\n destDir: appPublicationDir,\n };\n case 'public':\n return {\n destDir: `public/${this.moduleName}`,\n };\n case 'vendor':\n return {\n destDir: 'vendor',\n };\n }\n }\n\n protected stockTree(treeName: AddonTreePath): Node {\n return this.throughTreeCache(treeName, 'stock', () => {\n // adjust from the legacy \"root\" to our real root, because our rootTree\n // uses our real root but the stock trees are defined in terms of the\n // legacy root\n let srcDir = relative(this.root, join(this.addonInstance.root, this.addonInstance.treePaths[treeName]));\n let opts = Object.assign({ srcDir }, this.stockTreeFunnelOptions(treeName));\n return buildFunnel(this.rootTree, opts);\n })!;\n }\n\n @Memoize()\n protected get rootTree(): Node {\n if (this.packageCache.get(this.root).mayRebuild) {\n return new WatchedDir(this.root);\n } else {\n return new UnwatchedDir(this.root);\n }\n }\n\n @Memoize()\n private get moduleName(): string {\n if (typeof this.addonInstance.moduleName === 'function') {\n return this.addonInstance.moduleName();\n }\n return this.addonInstance.name;\n }\n\n // applies preprocessors to JS and HBS\n private transpile(tree: Node) {\n tree = this.addonInstance.preprocessJs(tree, '/', this.moduleName, {\n registry: this.addonInstance.registry,\n });\n if (this.addonInstance.shouldCompileTemplates() && this.addonInstance.registry.load('template')?.length > 0) {\n tree = this.app.preprocessRegistry.preprocessTemplates(tree, {\n registry: this.addonInstance.registry,\n });\n }\n return tree;\n }\n\n @Memoize()\n protected updateBabelConfig() {\n let packageOptions = this.options;\n let emberCLIBabelInstance = this.addonInstance.addons.find((a: any) => a.name === 'ember-cli-babel');\n let version;\n\n if (emberCLIBabelInstance) {\n version = emberCLIBabelInstance.pkg.version;\n }\n\n if (!packageOptions['ember-cli-babel']) {\n packageOptions['ember-cli-babel'] = {};\n }\n\n if (!packageOptions.babel) {\n packageOptions.babel = {};\n }\n let babelConfig = packageOptions.babel as TransformOptions;\n\n Object.assign(packageOptions['ember-cli-babel'], {\n compileModules: false,\n disablePresetEnv: true,\n disableDebugTooling: true,\n disableEmberModulesAPIPolyfill: true,\n });\n\n if (version && semver.satisfies(semver.coerce(version) || version, '^5')) {\n unsupported(`${this.name} is using babel 5. Not installing our custom plugin.`);\n return;\n }\n\n if (!babelConfig.plugins) {\n babelConfig.plugins = [];\n } else {\n let hadAutoImport = Boolean(babelConfig.plugins.find(isEmberAutoImportDynamic));\n babelConfig.plugins = babelConfig.plugins.filter(babelPluginAllowedInStage1);\n if (hadAutoImport) {\n // if we removed ember-auto-import's dynamic import() plugin, the code\n // may use import() syntax and we need to re-add it to the parser.\n if (version && semver.satisfies(semver.coerce(version) || version, '^6')) {\n babelConfig.plugins.push(require.resolve('babel-plugin-syntax-dynamic-import'));\n } else {\n babelConfig.plugins.push(require.resolve('@babel/plugin-syntax-dynamic-import'));\n }\n }\n }\n\n if (this.templateCompiler) {\n babelConfig.plugins.push(this.templateCompiler.inlineTransformsBabelPlugin());\n }\n }\n\n get v2Tree(): Node {\n return this.throughTreeCache(\n // these are all the kinds of trees that ember-cli's tree cache\n // understands. We need them all here because if *any* of these are\n // uncacheable, we want our whole v2 tree to be treated as uncacheable.\n [\n 'app',\n 'addon',\n 'addon-styles',\n 'addon-templates',\n 'addon-test-support',\n 'public',\n 'styles',\n 'templates',\n 'test-support',\n 'vendor',\n ],\n 'v2Tree',\n () => mergeTrees(this.v2Trees, { overwrite: true })\n );\n }\n\n // this is split out so that compatibility shims can override it to add more\n // things to the package metadata.\n protected get packageMeta(): Partial<AddonMeta> {\n let built = this.build();\n return mergeWithAppend(\n {\n version: 2,\n 'auto-upgraded': true,\n type: 'addon',\n },\n built.staticMeta,\n ...built.dynamicMeta.map(d => d())\n );\n }\n\n @Memoize()\n protected get v2Trees() {\n let { trees } = this.build();\n return trees;\n }\n\n protected throughTreeCache(nameOrNames: string | string[], category: string, fn: () => Node): Node;\n protected throughTreeCache(\n nameOrNames: string | string[],\n category: string,\n fn: () => Node | undefined\n ): Node | undefined {\n let cacheKey: string | undefined;\n if (typeof this.addonInstance.cacheKeyForTree === 'function') {\n let names = Array.isArray(nameOrNames) ? nameOrNames : [nameOrNames];\n cacheKey = names.reduce((accum: string | undefined, name) => {\n if (accum == null) {\n // a previous name was uncacheable, so we're entirely uncacheable\n return undefined;\n }\n let key = this.addonInstance.cacheKeyForTree?.(name);\n if (key) {\n return accum + key;\n } else {\n return undefined;\n }\n }, '');\n if (cacheKey) {\n cacheKey = cacheKey + category;\n let cachedTree = this.app.addonTreeCache.get(cacheKey);\n if (cachedTree) {\n debug('cache hit %s %s %s', this.name, nameOrNames, category);\n return cachedTree;\n }\n }\n }\n debug('cache miss %s %s %s', this.name, nameOrNames, category);\n let tree = fn();\n if (tree && cacheKey) {\n this.app.addonTreeCache.set(cacheKey, tree);\n }\n return tree;\n }\n\n // In general, we can't reliably run addons' custom `treeFor()` methods,\n // because they recurse in a way that we absolutely don't want.\n //\n // But there is a very common use case that we *can* handle opportunisticaly,\n // which is a treeFor() that's used purely to guard whether `_super` will be\n // called or not.\n private suppressesTree(name: string): boolean {\n if (!this.customizes('treeFor')) {\n return false;\n }\n // get the real addon as we're going to patch and restore `_super`\n const realAddon = getRealAddon(this.addonInstance);\n let origSuper = this.addonInstance._super;\n try {\n realAddon._super = stubbedSuper;\n let result = this.mainModule.treeFor?.call(this.addonInstance, name);\n if (result === markedEmptyTree) {\n // the method returns _super unchanged, so tree is not suppressed and we\n // understand what's going on\n return false;\n }\n if (result == null) {\n // the method nulled out the tree, so we are definitely suppressing\n return true;\n }\n // we can't tell what's really going on, don't suppress and hope for the\n // best\n unsupported(`${this.name} has a custom treeFor() method that is doing some arbitrary broccoli processing.`);\n return false;\n } finally {\n if (realAddon._super === stubbedSuper) {\n realAddon._super = origSuper;\n }\n }\n }\n\n protected invokeOriginalTreeFor(\n name: string,\n { neuterPreprocessors } = { neuterPreprocessors: false }\n ): Node | undefined {\n // @ts-expect-error have no idea why throughTreeCache overload is not working here..\n return this.throughTreeCache(name, 'original', () => {\n // get the real addon as we're going to patch and restore `preprocessJs`\n const realAddon = getRealAddon(this.addonInstance);\n let original;\n try {\n if (neuterPreprocessors) {\n original = realAddon.preprocessJs;\n realAddon.preprocessJs = function (tree: Node) {\n return tree;\n };\n }\n if (this.suppressesTree(name)) {\n return undefined;\n }\n return this.addonInstance._treeFor(name);\n } finally {\n if (neuterPreprocessors) {\n realAddon.preprocessJs = original;\n }\n }\n });\n }\n\n protected treeForAddon(built: IntermediateBuild): Node | undefined {\n // the extra isEngine condition is because ember-engines injects a\n // treeForAddon method into each engine addon that we really don't need or\n // want to run. Unfortunately there's not a more localized place to patch it\n // out, partly because ember-engines also uses a bogus inheritance strategy\n // (instead of providing a prototype that engine addons can extend it\n // patches things into their instance directly).\n if (this.customizes('treeForAddon', 'treeForAddonTemplates') && !this.isEngine()) {\n let tree = this.invokeOriginalTreeFor('addon', { neuterPreprocessors: true });\n if (tree) {\n tree = modulesCompat(tree);\n\n // this captures addons that are trying to escape their own package's\n // namespace\n let result = rewriteAddonTree(this.transpile(tree), this.name, this.moduleName);\n built.dynamicMeta.push(result.getMeta);\n return result.tree;\n }\n } else if (this.hasStockTree('addon')) {\n return this.transpile(this.stockTree('addon'));\n }\n }\n\n protected addonStylesTree(): Node | undefined {\n if (this.customizes('treeForAddonStyles')) {\n let custom = this.invokeOriginalTreeFor('addon-styles');\n if (custom) {\n return this.addonInstance.compileStyles(custom);\n }\n } else if (this.hasStockTree('addon-styles')) {\n return this.addonInstance.compileStyles(this.stockTree('addon-styles'));\n }\n }\n\n protected treeForTestSupport(): Node | undefined {\n if (this.customizes('treeForTestSupport')) {\n todo(`${this.name} has customized the test support tree`);\n } else if (this.hasStockTree('test-support')) {\n // this one doesn't go through transpile yet because it gets handled as\n // part of the consuming app. For example, imports should be relative to\n // the consuming app, not our own package.\n return buildFunnel(this.stockTree('test-support'), {\n destDir: `${appPublicationDir}/tests`,\n });\n }\n }\n\n private buildTreeForAddon(built: IntermediateBuild) {\n let tree = this.treeForAddon(built);\n if (!tree) {\n return;\n }\n let templateOnlyComponents: Node = new SynthesizeTemplateOnlyComponents(tree, ['components']);\n if (!this.addonOptions.staticAddonTrees) {\n let filenames: string[] = [];\n let templateOnlyComponentNames: string[] = [];\n\n tree = new ObserveTree(tree, outputDir => {\n filenames = walkSync(outputDir, { globs: ['**/*.js', '**/*.hbs'] })\n .map(f => `./${f.replace(/\\.js$/i, '')}`)\n .filter(notColocatedTemplate);\n });\n\n templateOnlyComponents = new ObserveTree(templateOnlyComponents, outputDir => {\n templateOnlyComponentNames = walkSync(outputDir, { globs: ['**/*.js'] }).map(\n f => `./${f.replace(/\\.js$/i, '')}`\n );\n });\n\n built.dynamicMeta.push(() => ({\n 'implicit-modules': filenames.concat(templateOnlyComponentNames),\n }));\n }\n built.trees.push(tree);\n built.trees.push(templateOnlyComponents);\n }\n\n private buildAddonStyles(built: IntermediateBuild) {\n let addonStylesTree = this.addonStylesTree();\n if (addonStylesTree) {\n if (this.app.hasCompiledStyles) {\n // >= ember-cli@3.18 store css files in <addon-name/__COMPILED_STYLES__\n // and for embroider to work correctly need to be moved back to `/`\n //\n // speaking with @rwjblue the ember-cli build is now frozen, and it is\n // ok to assume that after the above version no changes will occur\n // makings this work-around safe.\n //\n // additional context: https://github.com/embroider-build/embroider/pull/934/files#r695269976\n addonStylesTree = buildFunnel(addonStylesTree, {\n srcDir: `${this.name}/__COMPILED_STYLES__`,\n destDir: '/',\n allowEmpty: true,\n });\n }\n\n let discoveredFiles: string[] = [];\n let tree = new ObserveTree(addonStylesTree, outputPath => {\n discoveredFiles = walkSync(outputPath, { globs: ['**/*.css'], directories: false });\n });\n built.trees.push(tree);\n built.dynamicMeta.push(() => {\n return {\n 'implicit-styles': discoveredFiles.map(f => `./${f}`),\n };\n });\n }\n }\n\n private buildTreeForStyles(built: IntermediateBuild) {\n let tree;\n if (this.customizes('treeForStyles')) {\n // the user's tree returns their own styles with no \"app/styles\" wrapping\n // around, which is actually what we want\n tree = this.invokeOriginalTreeFor('styles');\n if (tree) {\n tree = buildFunnel(tree, {\n destDir: '_app_styles_',\n getDestinationPath(path) {\n return path.replace(/^app\\/styles\\//, '');\n },\n });\n }\n } else if (this.hasStockTree('styles')) {\n tree = this.stockTree('styles');\n }\n if (tree) {\n built.trees.push(tree);\n }\n }\n\n private buildAddonTestSupport(built: IntermediateBuild) {\n let addonTestSupportTree;\n if (this.customizes('treeForAddonTestSupport')) {\n let original = this.invokeOriginalTreeFor('addon-test-support', { neuterPreprocessors: true });\n if (original) {\n let { tree, getMeta } = rewriteAddonTree(original, this.name, this.moduleName);\n addonTestSupportTree = this.transpile(tree);\n built.dynamicMeta.push(getMeta);\n }\n } else if (this.hasStockTree('addon-test-support')) {\n addonTestSupportTree = this.transpile(this.stockTree('addon-test-support'));\n }\n if (addonTestSupportTree) {\n if (!this.addonOptions.staticAddonTestSupportTrees) {\n let filenames: string[] = [];\n addonTestSupportTree = new ObserveTree(addonTestSupportTree, outputPath => {\n filenames = walkSync(outputPath, { globs: ['**/*.js', '**/*.hbs'] }).map(f => `./${f.replace(/.js$/i, '')}`);\n });\n built.dynamicMeta.push(() => ({\n 'implicit-test-modules': filenames,\n }));\n }\n built.trees.push(addonTestSupportTree);\n }\n }\n\n private maybeSetDirectoryMeta(built: IntermediateBuild, tree: Node, localDir: string, key: keyof AddonMeta): Node {\n let files: AddonMeta['app-js'];\n built.dynamicMeta.push(() => {\n if (files) {\n return { [key]: files };\n } else {\n return {};\n }\n });\n return new ObserveTree(tree, (outputPath: string) => {\n let dir = join(outputPath, localDir);\n if (existsSync(dir)) {\n files = fromPairs(walkSync(dir, { globs: ['**/*.js', '**/*.hbs'] }).map(f => [`./${f}`, `./${localDir}/${f}`]));\n } else {\n files = undefined;\n }\n });\n }\n\n private buildTestSupport(built: IntermediateBuild) {\n let tree = this.treeForTestSupport();\n if (tree) {\n tree = this.maybeSetDirectoryMeta(built, tree, appPublicationDir, 'app-js');\n built.trees.push(tree);\n }\n }\n\n private buildTreeForApp(built: IntermediateBuild) {\n let appTree;\n if (this.customizes('treeForApp', 'treeForTemplates')) {\n let original = this.invokeOriginalTreeFor('app');\n if (original) {\n appTree = buildFunnel(original, {\n destDir: appPublicationDir,\n });\n }\n } else if (this.hasStockTree('app')) {\n appTree = this.stockTree('app');\n }\n\n if (appTree) {\n // this one doesn't go through transpile yet because it gets handled as\n // part of the consuming app.\n appTree = this.maybeSetDirectoryMeta(built, appTree, appPublicationDir, 'app-js');\n built.trees.push(appTree);\n }\n\n if (\n typeof this.addonInstance.isDevelopingAddon === 'function' &&\n this.addonInstance.isDevelopingAddon() &&\n this.addonInstance.hintingEnabled()\n ) {\n let hintTree = this.addonInstance.jshintAddonTree();\n if (hintTree) {\n hintTree = this.maybeSetDirectoryMeta(\n built,\n buildFunnel(hintTree, { destDir: appPublicationDir }),\n appPublicationDir,\n 'app-js'\n );\n built.trees.push(hintTree);\n }\n }\n }\n\n private buildTreeForFastBoot(built: IntermediateBuild) {\n let tree;\n\n if (this.customizes('treeForFastBoot')) {\n // Arguably, it would be more correct to always create the new Funnel,\n // because the fastboot directory could be created *after* our build starts.\n // But that would result in hundreds of additional trees, even though the\n // vast majority of addons aren't changing and don't have fastboot\n // directories. So I'm pretty comfortable with the optimization. It means\n // that an addon author who creates a brand new fastboot directory in a v1\n // packages will need to restart their build. (Really we hope new addons\n // will be authored in v2 instead soon anyway, and they won't need the\n // concept of \"fastboot directory\" because they can use the macro system to\n // conditionally import some things only in fastboot.)\n if (pathExistsSync(join(this.root, 'fastboot'))) {\n tree = buildFunnel(this.rootTree, { srcDir: 'fastboot' });\n }\n tree = this.addonInstance.treeForFastBoot(tree);\n if (tree) {\n tree = buildFunnel(tree, { destDir: fastbootPublicationDir });\n }\n } else {\n if (pathExistsSync(join(this.root, 'fastboot'))) {\n tree = buildFunnel(this.rootTree, { srcDir: 'fastboot', destDir: fastbootPublicationDir });\n }\n }\n\n if (tree) {\n // this one doesn't go through transpile yet because it gets handled as\n // part of the consuming app.\n tree = this.maybeSetDirectoryMeta(built, tree, fastbootPublicationDir, 'fastboot-js');\n built.trees.push(tree);\n }\n }\n\n private buildPublicTree(built: IntermediateBuild) {\n let publicTree;\n // the extra isEngine condition is here because ember-engines injects a\n // customized treeForPublic into every engine addon. We don't want or need\n // it to run.\n if (this.customizes('treeForPublic') && !this.isEngine()) {\n let original = this.invokeOriginalTreeFor('public');\n if (original) {\n publicTree = buildFunnel(original, {\n destDir: 'public',\n });\n }\n } else if (this.hasStockTree('public')) {\n publicTree = this.stockTree('public');\n }\n if (publicTree) {\n let publicAssets: { [filename: string]: string } = {};\n publicTree = new ObserveTree(publicTree, (outputPath: string) => {\n publicAssets = {};\n for (let filename of walkSync(join(outputPath, 'public'))) {\n if (!filename.endsWith('/')) {\n publicAssets[`./public/${filename}`] = './' + filename;\n }\n }\n });\n built.trees.push(publicTree);\n built.dynamicMeta.push(() => ({ 'public-assets': publicAssets }));\n }\n }\n\n private buildVendorTree(built: IntermediateBuild) {\n if (this.customizes('treeForVendor')) {\n // We don't have any particular opinions about the structure inside\n // vendor, so even when it's customized we can just use the customized\n // one.\n let tree = this.invokeOriginalTreeFor('vendor');\n if (tree) {\n built.trees.push(\n buildFunnel(tree, {\n destDir: 'vendor',\n })\n );\n }\n } else if (this.hasStockTree('vendor')) {\n built.trees.push(this.stockTree('vendor'));\n }\n }\n\n private isEngine() {\n return typeof this.addonInstance.getEngineConfigContents === 'function';\n }\n\n private buildEngineConfig(built: IntermediateBuild) {\n if (!this.isEngine()) {\n return;\n }\n // this addon is an engine, so it needs its own config/environment.js.\n // ember-engines always emits a separate inline (not-meta-tag) config for\n // fastboot, so we mimic that behavior here.\n //\n // getEngineConfigContents is an arbitrary customizable module, so we can't\n // easily rewrite it to live inside our conditional, so it's safer in a\n // separate module.\n built.trees.push(writeFile('config/_environment_browser_.js', this.addonInstance.getEngineConfigContents?.()));\n built.trees.push(\n writeFile(\n 'config/environment.js',\n `\n import { macroCondition, getGlobalConfig, importSync } from '@embroider/macros';\n let config;\n if (macroCondition(getGlobalConfig().fastboot?.isRunning)){\n config = ${JSON.stringify(this.addonInstance.engineConfig?.(this.app.env, {}), null, 2)};\n } else {\n config = importSync('./_environment_browser_.js').default;\n }\n export default config;\n `\n )\n );\n }\n\n private buildPackageJSON(built: IntermediateBuild) {\n built.trees.push(new RewritePackageJSON(this.rootTree, () => this.newPackageJSON));\n }\n\n @Memoize()\n private build(): IntermediateBuild {\n let built = new IntermediateBuild();\n built.staticMeta['order-index'] = this.orderIdx;\n\n if (this.options.lazyLoading && this.options.lazyLoading.enabled) {\n built.staticMeta['lazy-engine'] = true;\n }\n\n if (this.moduleName !== this.name) {\n built.staticMeta['renamed-packages'] = {\n [this.moduleName]: this.name,\n };\n }\n\n this.buildTreeForAddon(built);\n this.buildAddonStyles(built);\n this.buildTreeForStyles(built);\n this.buildAddonTestSupport(built);\n this.buildTestSupport(built);\n this.buildTreeForApp(built);\n this.buildTreeForFastBoot(built);\n this.buildPublicTree(built);\n this.buildVendorTree(built);\n this.buildEngineConfig(built);\n this.buildPackageJSON(built);\n return built;\n }\n}\n\nexport interface V1AddonConstructor {\n new (\n addonInstance: any,\n options: Required<Options>,\n app: V1App,\n packageCache: PackageCache,\n orderIdx: number\n ): V1Addon;\n\n shouldApplyAdapter?(addonInstance: any): boolean;\n}\n\nclass IntermediateBuild {\n trees: Node[] = [];\n staticMeta: { [metaField: string]: any } = {};\n dynamicMeta: (() => Partial<AddonMeta>)[] = [];\n}\n\nfunction babelPluginAllowedInStage1(plugin: PluginItem) {\n if (isEmbroiderMacrosPlugin(plugin)) {\n // the point of @embroider/macros is that it's allowed to stay in v2\n // addon publication format, so it doesn't need to run here in stage1.\n // We always run it in stage3.\n return false;\n }\n\n if (isInlinePrecompilePlugin(plugin)) {\n // Similarly, the inline precompile plugin must not run in stage1. We\n // want all templates uncompiled. Instead, we will be adding our own\n // plugin that only runs custom AST transforms inside inline\n // templates.\n return false;\n }\n\n if (isEmberAutoImportDynamic(plugin)) {\n // We replace ember-auto-import's implementation of dynamic import(), so we\n // need to stop its plugin from rewriting those.\n return false;\n }\n\n if (isCompactReexports(plugin)) {\n // We don't want to replace re-exports at this stage, since that will turn\n // an `export` statement into a `define`, which is handled in Stage 3\n return false;\n }\n\n if (isColocationPlugin(plugin)) {\n // template co-location is a first-class feature we support directly, so\n // whether or not the app brought a plugin for it we're going to do it our\n // way.\n return false;\n }\n\n return true;\n}\n\nfunction notColocatedTemplate(path: string) {\n return !/^\\.\\/components\\/.*\\.hbs$/.test(path);\n}\n\nconst markedEmptyTree = new UnwatchedDir(process.cwd());\n\nconst stubbedSuper = () => {\n return markedEmptyTree;\n};\n\nstubbedSuper.treeFor = () => {\n return markedEmptyTree;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"v1-addon.js","sourceRoot":"","sources":["v1-addon.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAA6C;AAC7C,+BAA2D;AAC3D,mCAA2C;AAC3C,uCAAsD;AACtD,sEAAwE;AACxE,qDAA2D;AAC3D,kFAAwD;AACxD,2DAAiE;AAEjE,gFAA8C;AAC9C,oDAA4B;AAC5B,8EAAoD;AACpD,qCAA2C;AAC3C,0CASyB;AAEzB,0DAAiC;AACjC,kEAAyC;AAEzC,qDAAqE;AAGrE,sEAA6C;AAC7C,kFAA8C;AAC9C,gHAAqF;AACrF,iEAKgC;AAEhC,4GAAiF;AACjF,mCAAmC;AACnC,mGAAmF;AACnF,kGAA6E;AAC7E,sEAA4C;AAE5C,MAAM,cAAc,GAAoB,MAAM,CAAC,MAAM,CAAC;IACpD,OAAO;IACP,cAAc;IACd,QAAQ;IACR,oBAAoB;IACpB,cAAc;IACd,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,uEAAuE;IACvE,8CAA8C;CAC/C,CAAoB,CAAC;AAEtB,MAAM,gBAAgB,GAAG,MAAM,CAAC,MA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 'typescript-memoize';\nimport { dirname, isAbsolute, join, relative } from 'path';\nimport { sync as pkgUpSync } from 'pkg-up';\nimport { existsSync, pathExistsSync } from 'fs-extra';\nimport buildFunnel, { Options as FunnelOptions } from 'broccoli-funnel';\nimport { UnwatchedDir, WatchedDir } from 'broccoli-source';\nimport RewritePackageJSON from './rewrite-package-json';\nimport { todo, unsupported } from '@embroider/core/src/messages';\nimport { Node } from 'broccoli-node-api';\nimport mergeTrees from 'broccoli-merge-trees';\nimport semver from 'semver';\nimport rewriteAddonTree from './rewrite-addon-tree';\nimport { mergeWithAppend } from './merges';\nimport {\n AddonMeta,\n NodeTemplateCompiler,\n debug,\n PackageCache,\n Resolver,\n extensionsPattern,\n AddonInstance,\n AddonTreePath,\n} from '@embroider/core';\nimport Options from './options';\nimport walkSync from 'walk-sync';\nimport ObserveTree from './observe-tree';\nimport type { Options as HTMLBarsOptions } from 'ember-cli-htmlbars';\nimport { isEmbroiderMacrosPlugin } from '@embroider/macros/src/node';\nimport { TransformOptions, PluginItem } from '@babel/core';\nimport V1App from './v1-app';\nimport modulesCompat from './modules-compat';\nimport writeFile from 'broccoli-file-creator';\nimport SynthesizeTemplateOnlyComponents from './synthesize-template-only-components';\nimport {\n isEmberAutoImportDynamic,\n isCompactReexports,\n isColocationPlugin,\n isInlinePrecompilePlugin,\n} from './detect-babel-plugins';\nimport { ResolvedDep } from '@embroider/core/src/resolver';\nimport TemplateCompilerBroccoliPlugin from './template-compiler-broccoli-plugin';\nimport { fromPairs } from 'lodash';\nimport { getEmberExports } from '@embroider/core/src/load-ember-template-compiler';\nimport prepHtmlbarsAstPluginsForUnwrap from './prepare-htmlbars-ast-plugins';\nimport getRealAddon from './get-real-addon';\n\nconst stockTreeNames: AddonTreePath[] = Object.freeze([\n 'addon',\n 'addon-styles',\n 'styles',\n 'addon-test-support',\n 'test-support',\n 'app',\n 'public',\n 'vendor',\n // 'addon-templates' and 'templates are trees too, but they live inside\n // 'addon' and 'app' and we handle them there.\n]) as AddonTreePath[];\n\nconst dynamicTreeHooks = Object.freeze([\n 'treeFor',\n 'treeForAddon',\n 'treeForAddonTemplates',\n 'treeForAddonTestSupport',\n 'treeForApp',\n 'treeForPublic',\n 'treeForStyles',\n 'treeForTemplates',\n 'treeForTestSupport',\n 'treeForVendor',\n]);\n\nconst appPublicationDir = '_app_';\nconst fastbootPublicationDir = '_fastboot_';\n\n/**\n * Creating a interface here just to keep the Resolver's structure as it is.\n */\ninterface ResolverParams {\n root: string;\n modulePrefix: string;\n}\n\nexport function resolver(params: ResolverParams): V1AddonCompatResolver {\n return new V1AddonCompatResolver(params);\n}\n\nclass V1AddonCompatResolver implements Resolver {\n params: ResolverParams;\n\n _parallelBabel: {\n requireFile: string;\n buildUsing: string;\n params: ResolverParams;\n };\n\n constructor(params: ResolverParams) {\n this.params = params;\n this._parallelBabel = {\n requireFile: __filename,\n buildUsing: 'resolver',\n params,\n };\n }\n astTransformer(_templateCompiler: NodeTemplateCompiler): unknown {\n return;\n }\n dependenciesOf(_moduleName: string): ResolvedDep[] {\n return [];\n }\n absPathToRuntimePath(absPath: string) {\n if (isAbsolute(absPath)) {\n return absPath;\n }\n return join(this.params.modulePrefix, absPath);\n }\n absPathToRuntimeName(absPath: string) {\n return this.absPathToRuntimePath(absPath)\n .replace(extensionsPattern(['.js', '.hbs']), '')\n .replace(/\\/index$/, '');\n }\n get adjustImportsOptions(): Resolver['adjustImportsOptions'] {\n throw new Error(`bug: the addon compat resolver only supports absPath mapping`);\n }\n}\n\n// This controls and types the interface between our new world and the classic\n// v1 addon instance.\nexport default class V1Addon {\n constructor(\n protected addonInstance: AddonInstance,\n protected addonOptions: Required<Options>,\n protected app: V1App,\n private packageCache: PackageCache,\n private orderIdx: number\n ) {\n if (addonInstance.registry) {\n this.updateRegistry(addonInstance.registry);\n }\n }\n\n // Optional extensible hook for pruning down the list of redundant addon\n // instances produced by the classic ember-cli architecture. ember-cli\n // instantiates each addon *per consumer*, not per package. So a given package\n // will have many addon instances, and Embroider dutifully produces a V1Addon\n // instance for each one, and then needs to mimic the classic smooshing\n // behavior between them.\n //\n // But some packages (and ember-cli-babel is the motivating example) produce a\n // huge number of instances that do nothing useful and incur significant cost.\n // This hook allows their compat adapter to prune down the set, using\n // addon-specific knowledge of which instance(s) are actually important.\n //\n // The order of the instances is significant. The first one is the one with\n // the highest precedence, meaning its files would win under classic\n // smooshing.\n reduceInstances(instances: V1Addon[]): V1Addon[] {\n // the default beahvior is that all copies matter\n return instances;\n }\n\n // this is only defined when there are custom AST transforms that need it\n @Memoize()\n private get templateCompiler(): NodeTemplateCompiler | undefined {\n let htmlbars = this.addonInstance.addons.find(a => a.name === 'ember-cli-htmlbars');\n if (htmlbars) {\n let options = (htmlbars as any).htmlbarsOptions() as HTMLBarsOptions;\n if (options?.plugins?.ast) {\n // our macros don't run here in stage1\n options.plugins.ast = options.plugins.ast.filter((p: any) => !isEmbroiderMacrosPlugin(p));\n prepHtmlbarsAstPluginsForUnwrap(this.addonInstance.registry);\n if (options.plugins.ast.length > 0) {\n const { cacheKey: compilerChecksum } = getEmberExports(options.templateCompilerPath);\n\n return new NodeTemplateCompiler({\n compilerPath: options.templateCompilerPath,\n compilerChecksum,\n EmberENV: {},\n plugins: options.plugins,\n resolver: this.templateResolver(),\n });\n }\n }\n }\n }\n\n @Memoize()\n templateResolver(): Resolver {\n return resolver({\n root: this.app.root,\n modulePrefix: this.moduleName,\n });\n }\n\n private updateRegistry(registry: any) {\n // auto-import gets disabled because we support it natively\n registry.remove('js', 'ember-auto-import-analyzer');\n\n // here we're replacing the stock template compiler with our own. Ours\n // leaves hbs files as hbs, not js. The only transformation it is supposed\n // to do is applying any custom AST transforms and reserializing the results\n // back to HBS.\n //\n // Even when no AST transforms are registered, we'll still need to register\n // a no-op transform here to avoid an exception coming out of ember-cli like\n // \"Addon templates were detected, but there are no template compilers\n // registered\".\n registry.remove('template', 'ember-cli-htmlbars');\n registry.add('template', {\n name: 'embroider-addon-templates',\n ext: 'hbs',\n _addon: this,\n toTree(this: { _addon: V1Addon }, tree: Node): Node {\n if (this._addon.templateCompiler) {\n return new TemplateCompilerBroccoliPlugin(tree, this._addon.templateCompiler);\n } else {\n // when there are no custom AST transforms, we don't need to do\n // anything at all.\n return tree;\n }\n },\n });\n\n // first, look into the babel config and related packages to decide whether\n // we need to run babel at all in this stage.\n let needsCustomBabel = this.needsCustomBabel();\n\n // regardless of the answer, we modify the babel config, because even if\n // we're unregistering ember-cli-babel, some addons manually invoke\n // ember-cli-babel in their custom hooks, and in that case we want to be\n // sure we've taken out the babel plugins that really shouldn't run at this\n // stage.\n this.updateBabelConfig();\n\n if (!needsCustomBabel) {\n // no custom babel behavior, so we don't run the ember-cli-babel\n // preprocessor at all. We still need to register a no-op preprocessor to\n // prevent ember-cli from emitting a deprecation warning.\n registry.remove('js', 'ember-cli-babel');\n registry.add('js', {\n name: 'embroider-babel-noop',\n ext: 'js',\n toTree(tree: Node) {\n return tree;\n },\n });\n }\n }\n\n // we need to run custom inline hbs preprocessing if there are custom hbs\n // plugins and there are inline hbs templates\n private needsInlineHBS(): boolean {\n if (!this.templateCompiler) {\n // no custom transforms\n return false;\n }\n if (this.addonInstance.addons.find((a: any) => a.name === 'ember-cli-htmlbars-inline-precompile')) {\n // the older inline template compiler is present\n return true;\n }\n\n if (\n this.addonInstance.addons.find(\n (a: any) =>\n a.name === 'ember-cli-htmlbars' && semver.satisfies(semver.coerce(a.pkg.version) || a.pkg.version, '>4.0.0')\n )\n ) {\n // a version of ember-cli-htmlbars that natively supports inline hbs is present\n return true;\n }\n\n return false;\n }\n\n private needsCustomBabel() {\n if (\n this.addonInstance.addons.find(\n (a: any) =>\n a.name === 'ember-cli-typescript' &&\n semver.satisfies(semver.coerce(a.pkg.version) || a.pkg.version, '>=4.0.0-alpha.1')\n )\n ) {\n // This addon is using ember-cli-typescript 4, which relies on\n // ember-cli-babel to add the TypeScript transform Babel plugin.\n return true;\n }\n\n if (\n this.addonInstance.options &&\n this.addonInstance.options['ember-cli-babel'] &&\n this.addonInstance.options['ember-cli-babel'].enableTypeScriptTransform\n ) {\n // This addon has explicitly configured ember-cli-babel to add the\n // TypeScript transform Babel plugin.\n return true;\n }\n\n if ((this.options.babel?.plugins?.filter(babelPluginAllowedInStage1)?.length ?? 0) > 0) {\n // this addon has custom babel plugins, so we need to run them here in\n // stage1\n return true;\n }\n\n // even if there are no custom babel plugins, if we need to do any\n // preprocessing of inline handlebars templates we still need to run the\n // custom babel.\n return this.needsInlineHBS();\n }\n\n get name(): string {\n return this.packageJSON.name;\n }\n\n // you can override this to change the *input* packageJSON that the rest of\n // stage1 will see. If you want to see and change the *output* packageJSON see\n // `newPackageJSON`.\n protected get packageJSON() {\n return this.packageCache.get(this.root).packageJSON;\n }\n\n protected get newPackageJSON() {\n // shallow copy only! This is OK as long as we're only changing top-level\n // keys in this method\n let pkg = Object.assign({}, this.packageJSON);\n let meta: AddonMeta = Object.assign({}, this.packageCache.get(this.root).meta, this.packageMeta);\n pkg['ember-addon'] = meta;\n\n // classic addons don't get to customize their entrypoints like this. We\n // always rewrite them so their entrypoint is index.js, so whatever was here\n // is just misleading to stage3 packagers that might look (rollup does).\n delete pkg.main;\n delete pkg.module;\n\n return pkg;\n }\n\n @Memoize()\n get root(): string {\n // addonInstance.root gets modified by a customized \"main\" or\n // \"ember-addon.main\" in package.json. We want the real package root here\n // (the place where package.json lives).\n return dirname(pkgUpSync({ cwd: this.addonInstance.root })!);\n }\n\n @Memoize()\n private get mainModule() {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const mod = require((this.addonInstance as unknown as any).constructor._meta_.modulePath);\n\n if (typeof mod === 'function') {\n return mod.prototype;\n } else {\n return mod;\n }\n }\n\n protected get options() {\n if (!this.addonInstance.options) {\n this.addonInstance.options = {};\n return this.addonInstance.options;\n }\n // some addons (like ember-cli-inline-content) assign the *app's* options\n // onto their own this.options. Which means they (accidentally or on\n // purpose), always get the app's babel config, and it means when we try\n // to modify the addon's babel config we're accidentally modifying the\n // app's too.\n //\n // So here we do copying to ensure that we can modify the babel config\n // without altering anybody else. We're not doing cloneDeep because that\n // pulls on our lazy MacrosConfig if it appears in any babel configs here,\n // whereas we want to leave it unevaluated until babel actually uses it.\n let addonOptions =\n typeof this.addonInstance.options == 'function' ? this.addonInstance.options() : this.addonInstance.options;\n let options = Object.assign({}, addonOptions);\n if (options.babel) {\n options.babel = Object.assign({}, options.babel);\n if (options.babel.plugins) {\n options.babel.plugins = options.babel.plugins.slice();\n }\n }\n if (options['ember-cli-babel']) {\n options['ember-cli-babel'] = Object.assign({}, options['ember-cli-babel']);\n }\n\n if (typeof this.addonInstance.options == 'function') {\n this.addonInstance.options = () => options;\n } else {\n this.addonInstance.options = options;\n }\n\n return options;\n }\n\n protected customizes(...treeNames: string[]) {\n // get the real addon as we're going to compare with __proto__\n const realAddon = getRealAddon(this.addonInstance);\n return Boolean(\n treeNames.find(treeName => {\n return (\n // customized hook exists in actual code exported from their index.js\n this.mainModule[treeName] ||\n // addon instance doesn't match its own prototype\n (realAddon.__proto__ && realAddon[treeName] !== realAddon.__proto__[treeName])\n );\n })\n );\n }\n\n @Memoize()\n private hasStockTree(treeName: AddonTreePath): boolean {\n if (this.suppressesTree(treeName)) {\n return false;\n }\n\n // we need to use this.addonInstance.root instead of this.root here because\n // we're looking for the classic location of the stock tree, and that\n // location is influenced by a customized ember-addon.main in package.json,\n // which is reflected in addonInstance.root.\n return (\n this.addonInstance.treePaths && existsSync(join(this.addonInstance.root, this.addonInstance.treePaths[treeName]))\n );\n }\n\n hasAnyTrees(): boolean {\n return Boolean(stockTreeNames.find(name => this.hasStockTree(name))) || this.customizes(...dynamicTreeHooks);\n }\n\n // we keep all these here to ensure that we always apply the same options to\n // the same tree, so that our cache doesn't need to worry about varying\n // options.\n private stockTreeFunnelOptions(treeName: string): FunnelOptions | undefined {\n switch (treeName) {\n case 'addon':\n return {\n exclude: ['styles/**'],\n };\n case 'styles':\n return {\n destDir: '_app_styles_',\n };\n case 'addon-test-support':\n return {\n destDir: 'test-support',\n };\n case 'app':\n return {\n exclude: ['styles/**'],\n destDir: appPublicationDir,\n };\n case 'public':\n return {\n destDir: `public/${this.moduleName}`,\n };\n case 'vendor':\n return {\n destDir: 'vendor',\n };\n }\n }\n\n protected stockTree(treeName: AddonTreePath): Node {\n return this.throughTreeCache(treeName, 'stock', () => {\n // adjust from the legacy \"root\" to our real root, because our rootTree\n // uses our real root but the stock trees are defined in terms of the\n // legacy root\n let srcDir = relative(this.root, join(this.addonInstance.root, this.addonInstance.treePaths[treeName]));\n let opts = Object.assign({ srcDir }, this.stockTreeFunnelOptions(treeName));\n return buildFunnel(this.rootTree, opts);\n })!;\n }\n\n @Memoize()\n protected get rootTree(): Node {\n if (this.packageCache.get(this.root).mayRebuild) {\n return new WatchedDir(this.root);\n } else {\n return new UnwatchedDir(this.root);\n }\n }\n\n @Memoize()\n private get moduleName(): string {\n if (typeof this.addonInstance.moduleName === 'function') {\n return this.addonInstance.moduleName();\n }\n return this.addonInstance.name;\n }\n\n // applies preprocessors to JS and HBS\n private transpile(tree: Node) {\n // Namespace the tree being passed to preprocessJs with the moduleName\n // to mimic classic build\n tree = buildFunnel(tree, { destDir: this.moduleName });\n\n tree = this.addonInstance.preprocessJs(tree, '/', this.moduleName, {\n registry: this.addonInstance.registry,\n });\n\n // Remove namespacing so that it gets written out to the node_modules\n // directory correctly.\n tree = buildFunnel(tree, {\n srcDir: this.moduleName,\n });\n\n if (this.addonInstance.shouldCompileTemplates() && this.addonInstance.registry.load('template')?.length > 0) {\n tree = this.app.preprocessRegistry.preprocessTemplates(tree, {\n registry: this.addonInstance.registry,\n });\n }\n\n return tree;\n }\n\n @Memoize()\n protected updateBabelConfig() {\n let packageOptions = this.options;\n let emberCLIBabelInstance = this.addonInstance.addons.find((a: any) => a.name === 'ember-cli-babel');\n let version;\n\n if (emberCLIBabelInstance) {\n version = emberCLIBabelInstance.pkg.version;\n }\n\n if (!packageOptions['ember-cli-babel']) {\n packageOptions['ember-cli-babel'] = {};\n }\n\n if (!packageOptions.babel) {\n packageOptions.babel = {};\n }\n let babelConfig = packageOptions.babel as TransformOptions;\n\n Object.assign(packageOptions['ember-cli-babel'], {\n compileModules: false,\n disablePresetEnv: true,\n disableDebugTooling: true,\n disableEmberModulesAPIPolyfill: true,\n });\n\n if (version && semver.satisfies(semver.coerce(version) || version, '^5')) {\n unsupported(`${this.name} is using babel 5. Not installing our custom plugin.`);\n return;\n }\n\n if (!babelConfig.plugins) {\n babelConfig.plugins = [];\n } else {\n let hadAutoImport = Boolean(babelConfig.plugins.find(isEmberAutoImportDynamic));\n babelConfig.plugins = babelConfig.plugins.filter(babelPluginAllowedInStage1);\n if (hadAutoImport) {\n // if we removed ember-auto-import's dynamic import() plugin, the code\n // may use import() syntax and we need to re-add it to the parser.\n if (version && semver.satisfies(semver.coerce(version) || version, '^6')) {\n babelConfig.plugins.push(require.resolve('babel-plugin-syntax-dynamic-import'));\n } else {\n babelConfig.plugins.push(require.resolve('@babel/plugin-syntax-dynamic-import'));\n }\n }\n }\n\n if (this.templateCompiler) {\n babelConfig.plugins.push(this.templateCompiler.inlineTransformsBabelPlugin());\n }\n }\n\n get v2Tree(): Node {\n return this.throughTreeCache(\n // these are all the kinds of trees that ember-cli's tree cache\n // understands. We need them all here because if *any* of these are\n // uncacheable, we want our whole v2 tree to be treated as uncacheable.\n [\n 'app',\n 'addon',\n 'addon-styles',\n 'addon-templates',\n 'addon-test-support',\n 'public',\n 'styles',\n 'templates',\n 'test-support',\n 'vendor',\n ],\n 'v2Tree',\n () => mergeTrees(this.v2Trees, { overwrite: true })\n );\n }\n\n // this is split out so that compatibility shims can override it to add more\n // things to the package metadata.\n protected get packageMeta(): Partial<AddonMeta> {\n let built = this.build();\n return mergeWithAppend(\n {\n version: 2,\n 'auto-upgraded': true,\n type: 'addon',\n },\n built.staticMeta,\n ...built.dynamicMeta.map(d => d())\n );\n }\n\n @Memoize()\n protected get v2Trees() {\n let { trees } = this.build();\n return trees;\n }\n\n protected throughTreeCache(nameOrNames: string | string[], category: string, fn: () => Node): Node;\n protected throughTreeCache(\n nameOrNames: string | string[],\n category: string,\n fn: () => Node | undefined\n ): Node | undefined {\n let cacheKey: string | undefined;\n if (typeof this.addonInstance.cacheKeyForTree === 'function') {\n let names = Array.isArray(nameOrNames) ? nameOrNames : [nameOrNames];\n cacheKey = names.reduce((accum: string | undefined, name) => {\n if (accum == null) {\n // a previous name was uncacheable, so we're entirely uncacheable\n return undefined;\n }\n let key = this.addonInstance.cacheKeyForTree?.(name);\n if (key) {\n return accum + key;\n } else {\n return undefined;\n }\n }, '');\n if (cacheKey) {\n cacheKey = cacheKey + category;\n let cachedTree = this.app.addonTreeCache.get(cacheKey);\n if (cachedTree) {\n debug('cache hit %s %s %s', this.name, nameOrNames, category);\n return cachedTree;\n }\n }\n }\n debug('cache miss %s %s %s', this.name, nameOrNames, category);\n let tree = fn();\n if (tree && cacheKey) {\n this.app.addonTreeCache.set(cacheKey, tree);\n }\n return tree;\n }\n\n // In general, we can't reliably run addons' custom `treeFor()` methods,\n // because they recurse in a way that we absolutely don't want.\n //\n // But there is a very common use case that we *can* handle opportunisticaly,\n // which is a treeFor() that's used purely to guard whether `_super` will be\n // called or not.\n private suppressesTree(name: string): boolean {\n if (!this.customizes('treeFor')) {\n return false;\n }\n // get the real addon as we're going to patch and restore `_super`\n const realAddon = getRealAddon(this.addonInstance);\n let origSuper = this.addonInstance._super;\n try {\n realAddon._super = stubbedSuper;\n let result = this.mainModule.treeFor?.call(this.addonInstance, name);\n if (result === markedEmptyTree) {\n // the method returns _super unchanged, so tree is not suppressed and we\n // understand what's going on\n return false;\n }\n if (result == null) {\n // the method nulled out the tree, so we are definitely suppressing\n return true;\n }\n // we can't tell what's really going on, don't suppress and hope for the\n // best\n unsupported(`${this.name} has a custom treeFor() method that is doing some arbitrary broccoli processing.`);\n return false;\n } finally {\n if (realAddon._super === stubbedSuper) {\n realAddon._super = origSuper;\n }\n }\n }\n\n protected invokeOriginalTreeFor(\n name: string,\n { neuterPreprocessors } = { neuterPreprocessors: false }\n ): Node | undefined {\n // @ts-expect-error have no idea why throughTreeCache overload is not working here..\n return this.throughTreeCache(name, 'original', () => {\n // get the real addon as we're going to patch and restore `preprocessJs`\n const realAddon = getRealAddon(this.addonInstance);\n let original;\n try {\n if (neuterPreprocessors) {\n original = realAddon.preprocessJs;\n realAddon.preprocessJs = function (tree: Node) {\n return tree;\n };\n }\n if (this.suppressesTree(name)) {\n return undefined;\n }\n return this.addonInstance._treeFor(name);\n } finally {\n if (neuterPreprocessors) {\n realAddon.preprocessJs = original;\n }\n }\n });\n }\n\n protected treeForAddon(built: IntermediateBuild): Node | undefined {\n // the extra isEngine condition is because ember-engines injects a\n // treeForAddon method into each engine addon that we really don't need or\n // want to run. Unfortunately there's not a more localized place to patch it\n // out, partly because ember-engines also uses a bogus inheritance strategy\n // (instead of providing a prototype that engine addons can extend it\n // patches things into their instance directly).\n if (this.customizes('treeForAddon', 'treeForAddonTemplates') && !this.isEngine()) {\n let tree = this.invokeOriginalTreeFor('addon', { neuterPreprocessors: true });\n if (tree) {\n tree = modulesCompat(tree);\n\n // this captures addons that are trying to escape their own package's\n // namespace\n let result = rewriteAddonTree(this.transpile(tree), this.name, this.moduleName);\n built.dynamicMeta.push(result.getMeta);\n return result.tree;\n }\n } else if (this.hasStockTree('addon')) {\n return this.transpile(this.stockTree('addon'));\n }\n }\n\n protected addonStylesTree(): Node | undefined {\n if (this.customizes('treeForAddonStyles')) {\n let custom = this.invokeOriginalTreeFor('addon-styles');\n if (custom) {\n return this.addonInstance.compileStyles(custom);\n }\n } else if (this.hasStockTree('addon-styles')) {\n return this.addonInstance.compileStyles(this.stockTree('addon-styles'));\n }\n }\n\n protected treeForTestSupport(): Node | undefined {\n if (this.customizes('treeForTestSupport')) {\n todo(`${this.name} has customized the test support tree`);\n } else if (this.hasStockTree('test-support')) {\n // this one doesn't go through transpile yet because it gets handled as\n // part of the consuming app. For example, imports should be relative to\n // the consuming app, not our own package.\n return buildFunnel(this.stockTree('test-support'), {\n destDir: `${appPublicationDir}/tests`,\n });\n }\n }\n\n private buildTreeForAddon(built: IntermediateBuild) {\n let tree = this.treeForAddon(built);\n if (!tree) {\n return;\n }\n let templateOnlyComponents: Node = new SynthesizeTemplateOnlyComponents(tree, ['components']);\n if (!this.addonOptions.staticAddonTrees) {\n let filenames: string[] = [];\n let templateOnlyComponentNames: string[] = [];\n\n tree = new ObserveTree(tree, outputDir => {\n filenames = walkSync(outputDir, { globs: ['**/*.js', '**/*.hbs'] })\n .map(f => `./${f.replace(/\\.js$/i, '')}`)\n .filter(notColocatedTemplate);\n });\n\n templateOnlyComponents = new ObserveTree(templateOnlyComponents, outputDir => {\n templateOnlyComponentNames = walkSync(outputDir, { globs: ['**/*.js'] }).map(\n f => `./${f.replace(/\\.js$/i, '')}`\n );\n });\n\n built.dynamicMeta.push(() => ({\n 'implicit-modules': filenames.concat(templateOnlyComponentNames),\n }));\n }\n built.trees.push(tree);\n built.trees.push(templateOnlyComponents);\n }\n\n private buildAddonStyles(built: IntermediateBuild) {\n let addonStylesTree = this.addonStylesTree();\n if (addonStylesTree) {\n if (this.app.hasCompiledStyles) {\n // >= ember-cli@3.18 store css files in <addon-name/__COMPILED_STYLES__\n // and for embroider to work correctly need to be moved back to `/`\n //\n // speaking with @rwjblue the ember-cli build is now frozen, and it is\n // ok to assume that after the above version no changes will occur\n // makings this work-around safe.\n //\n // additional context: https://github.com/embroider-build/embroider/pull/934/files#r695269976\n addonStylesTree = buildFunnel(addonStylesTree, {\n srcDir: `${this.name}/__COMPILED_STYLES__`,\n destDir: '/',\n allowEmpty: true,\n });\n }\n\n let discoveredFiles: string[] = [];\n let tree = new ObserveTree(addonStylesTree, outputPath => {\n discoveredFiles = walkSync(outputPath, { globs: ['**/*.css'], directories: false });\n });\n built.trees.push(tree);\n built.dynamicMeta.push(() => {\n return {\n 'implicit-styles': discoveredFiles.map(f => `./${f}`),\n };\n });\n }\n }\n\n private buildTreeForStyles(built: IntermediateBuild) {\n let tree;\n if (this.customizes('treeForStyles')) {\n // the user's tree returns their own styles with no \"app/styles\" wrapping\n // around, which is actually what we want\n tree = this.invokeOriginalTreeFor('styles');\n if (tree) {\n tree = buildFunnel(tree, {\n destDir: '_app_styles_',\n getDestinationPath(path) {\n return path.replace(/^app\\/styles\\//, '');\n },\n });\n }\n } else if (this.hasStockTree('styles')) {\n tree = this.stockTree('styles');\n }\n if (tree) {\n built.trees.push(tree);\n }\n }\n\n private buildAddonTestSupport(built: IntermediateBuild) {\n let addonTestSupportTree;\n if (this.customizes('treeForAddonTestSupport')) {\n let original = this.invokeOriginalTreeFor('addon-test-support', { neuterPreprocessors: true });\n if (original) {\n let { tree, getMeta } = rewriteAddonTree(original, this.name, this.moduleName);\n addonTestSupportTree = this.transpile(tree);\n built.dynamicMeta.push(getMeta);\n }\n } else if (this.hasStockTree('addon-test-support')) {\n addonTestSupportTree = this.transpile(this.stockTree('addon-test-support'));\n }\n if (addonTestSupportTree) {\n if (!this.addonOptions.staticAddonTestSupportTrees) {\n let filenames: string[] = [];\n addonTestSupportTree = new ObserveTree(addonTestSupportTree, outputPath => {\n filenames = walkSync(outputPath, { globs: ['**/*.js', '**/*.hbs'] }).map(f => `./${f.replace(/.js$/i, '')}`);\n });\n built.dynamicMeta.push(() => ({\n 'implicit-test-modules': filenames,\n }));\n }\n built.trees.push(addonTestSupportTree);\n }\n }\n\n private maybeSetDirectoryMeta(built: IntermediateBuild, tree: Node, localDir: string, key: keyof AddonMeta): Node {\n let files: AddonMeta['app-js'];\n built.dynamicMeta.push(() => {\n if (files) {\n return { [key]: files };\n } else {\n return {};\n }\n });\n return new ObserveTree(tree, (outputPath: string) => {\n let dir = join(outputPath, localDir);\n if (existsSync(dir)) {\n files = fromPairs(walkSync(dir, { globs: ['**/*.js', '**/*.hbs'] }).map(f => [`./${f}`, `./${localDir}/${f}`]));\n } else {\n files = undefined;\n }\n });\n }\n\n private buildTestSupport(built: IntermediateBuild) {\n let tree = this.treeForTestSupport();\n if (tree) {\n tree = this.maybeSetDirectoryMeta(built, tree, appPublicationDir, 'app-js');\n built.trees.push(tree);\n }\n }\n\n private buildTreeForApp(built: IntermediateBuild) {\n let appTree;\n if (this.customizes('treeForApp', 'treeForTemplates')) {\n let original = this.invokeOriginalTreeFor('app');\n if (original) {\n appTree = buildFunnel(original, {\n destDir: appPublicationDir,\n });\n }\n } else if (this.hasStockTree('app')) {\n appTree = this.stockTree('app');\n }\n\n if (appTree) {\n // this one doesn't go through transpile yet because it gets handled as\n // part of the consuming app.\n appTree = this.maybeSetDirectoryMeta(built, appTree, appPublicationDir, 'app-js');\n built.trees.push(appTree);\n }\n\n if (\n typeof this.addonInstance.isDevelopingAddon === 'function' &&\n this.addonInstance.isDevelopingAddon() &&\n this.addonInstance.hintingEnabled()\n ) {\n let hintTree = this.addonInstance.jshintAddonTree();\n if (hintTree) {\n hintTree = this.maybeSetDirectoryMeta(\n built,\n buildFunnel(hintTree, { destDir: appPublicationDir }),\n appPublicationDir,\n 'app-js'\n );\n built.trees.push(hintTree);\n }\n }\n }\n\n private buildTreeForFastBoot(built: IntermediateBuild) {\n let tree;\n\n if (this.customizes('treeForFastBoot')) {\n // Arguably, it would be more correct to always create the new Funnel,\n // because the fastboot directory could be created *after* our build starts.\n // But that would result in hundreds of additional trees, even though the\n // vast majority of addons aren't changing and don't have fastboot\n // directories. So I'm pretty comfortable with the optimization. It means\n // that an addon author who creates a brand new fastboot directory in a v1\n // packages will need to restart their build. (Really we hope new addons\n // will be authored in v2 instead soon anyway, and they won't need the\n // concept of \"fastboot directory\" because they can use the macro system to\n // conditionally import some things only in fastboot.)\n if (pathExistsSync(join(this.root, 'fastboot'))) {\n tree = buildFunnel(this.rootTree, { srcDir: 'fastboot' });\n }\n tree = this.addonInstance.treeForFastBoot(tree);\n if (tree) {\n tree = buildFunnel(tree, { destDir: fastbootPublicationDir });\n }\n } else {\n if (pathExistsSync(join(this.root, 'fastboot'))) {\n tree = buildFunnel(this.rootTree, { srcDir: 'fastboot', destDir: fastbootPublicationDir });\n }\n }\n\n if (tree) {\n // this one doesn't go through transpile yet because it gets handled as\n // part of the consuming app.\n tree = this.maybeSetDirectoryMeta(built, tree, fastbootPublicationDir, 'fastboot-js');\n built.trees.push(tree);\n }\n }\n\n private buildPublicTree(built: IntermediateBuild) {\n let publicTree;\n // the extra isEngine condition is here because ember-engines injects a\n // customized treeForPublic into every engine addon. We don't want or need\n // it to run.\n if (this.customizes('treeForPublic') && !this.isEngine()) {\n let original = this.invokeOriginalTreeFor('public');\n if (original) {\n publicTree = buildFunnel(original, {\n destDir: 'public',\n });\n }\n } else if (this.hasStockTree('public')) {\n publicTree = this.stockTree('public');\n }\n if (publicTree) {\n let publicAssets: { [filename: string]: string } = {};\n publicTree = new ObserveTree(publicTree, (outputPath: string) => {\n publicAssets = {};\n for (let filename of walkSync(join(outputPath, 'public'))) {\n if (!filename.endsWith('/')) {\n publicAssets[`./public/${filename}`] = './' + filename;\n }\n }\n });\n built.trees.push(publicTree);\n built.dynamicMeta.push(() => ({ 'public-assets': publicAssets }));\n }\n }\n\n private buildVendorTree(built: IntermediateBuild) {\n if (this.customizes('treeForVendor')) {\n // We don't have any particular opinions about the structure inside\n // vendor, so even when it's customized we can just use the customized\n // one.\n let tree = this.invokeOriginalTreeFor('vendor');\n if (tree) {\n built.trees.push(\n buildFunnel(tree, {\n destDir: 'vendor',\n })\n );\n }\n } else if (this.hasStockTree('vendor')) {\n built.trees.push(this.stockTree('vendor'));\n }\n }\n\n private isEngine() {\n return typeof this.addonInstance.getEngineConfigContents === 'function';\n }\n\n private buildEngineConfig(built: IntermediateBuild) {\n if (!this.isEngine()) {\n return;\n }\n // this addon is an engine, so it needs its own config/environment.js.\n // ember-engines always emits a separate inline (not-meta-tag) config for\n // fastboot, so we mimic that behavior here.\n //\n // getEngineConfigContents is an arbitrary customizable module, so we can't\n // easily rewrite it to live inside our conditional, so it's safer in a\n // separate module.\n built.trees.push(writeFile('config/_environment_browser_.js', this.addonInstance.getEngineConfigContents?.()));\n built.trees.push(\n writeFile(\n 'config/environment.js',\n `\n import { macroCondition, getGlobalConfig, importSync } from '@embroider/macros';\n let config;\n if (macroCondition(getGlobalConfig().fastboot?.isRunning)){\n config = ${JSON.stringify(this.addonInstance.engineConfig?.(this.app.env, {}), null, 2)};\n } else {\n config = importSync('./_environment_browser_.js').default;\n }\n export default config;\n `\n )\n );\n }\n\n private buildPackageJSON(built: IntermediateBuild) {\n built.trees.push(new RewritePackageJSON(this.rootTree, () => this.newPackageJSON));\n }\n\n @Memoize()\n private build(): IntermediateBuild {\n let built = new IntermediateBuild();\n built.staticMeta['order-index'] = this.orderIdx;\n\n if (this.options.lazyLoading && this.options.lazyLoading.enabled) {\n built.staticMeta['lazy-engine'] = true;\n }\n\n if (this.moduleName !== this.name) {\n built.staticMeta['renamed-packages'] = {\n [this.moduleName]: this.name,\n };\n }\n\n this.buildTreeForAddon(built);\n this.buildAddonStyles(built);\n this.buildTreeForStyles(built);\n this.buildAddonTestSupport(built);\n this.buildTestSupport(built);\n this.buildTreeForApp(built);\n this.buildTreeForFastBoot(built);\n this.buildPublicTree(built);\n this.buildVendorTree(built);\n this.buildEngineConfig(built);\n this.buildPackageJSON(built);\n return built;\n }\n}\n\nexport interface V1AddonConstructor {\n new (\n addonInstance: any,\n options: Required<Options>,\n app: V1App,\n packageCache: PackageCache,\n orderIdx: number\n ): V1Addon;\n\n shouldApplyAdapter?(addonInstance: any): boolean;\n}\n\nclass IntermediateBuild {\n trees: Node[] = [];\n staticMeta: { [metaField: string]: any } = {};\n dynamicMeta: (() => Partial<AddonMeta>)[] = [];\n}\n\nfunction babelPluginAllowedInStage1(plugin: PluginItem) {\n if (isEmbroiderMacrosPlugin(plugin)) {\n // the point of @embroider/macros is that it's allowed to stay in v2\n // addon publication format, so it doesn't need to run here in stage1.\n // We always run it in stage3.\n return false;\n }\n\n if (isInlinePrecompilePlugin(plugin)) {\n // Similarly, the inline precompile plugin must not run in stage1. We\n // want all templates uncompiled. Instead, we will be adding our own\n // plugin that only runs custom AST transforms inside inline\n // templates.\n return false;\n }\n\n if (isEmberAutoImportDynamic(plugin)) {\n // We replace ember-auto-import's implementation of dynamic import(), so we\n // need to stop its plugin from rewriting those.\n return false;\n }\n\n if (isCompactReexports(plugin)) {\n // We don't want to replace re-exports at this stage, since that will turn\n // an `export` statement into a `define`, which is handled in Stage 3\n return false;\n }\n\n if (isColocationPlugin(plugin)) {\n // template co-location is a first-class feature we support directly, so\n // whether or not the app brought a plugin for it we're going to do it our\n // way.\n return false;\n }\n\n return true;\n}\n\nfunction notColocatedTemplate(path: string) {\n return !/^\\.\\/components\\/.*\\.hbs$/.test(path);\n}\n\nconst markedEmptyTree = new UnwatchedDir(process.cwd());\n\nconst stubbedSuper = () => {\n return markedEmptyTree;\n};\n\nstubbedSuper.treeFor = () => {\n return markedEmptyTree;\n};\n"]}
|
package/src/v1-app.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -473,10 +477,13 @@ class V1App {
|
|
|
473
477
|
this.app.registry.remove('js', 'ember-cli-babel');
|
|
474
478
|
// auto-import is supported natively so we don't need it here
|
|
475
479
|
this.app.registry.remove('js', 'ember-auto-import-analyzer');
|
|
476
|
-
|
|
480
|
+
tree = (0, broccoli_funnel_1.default)(tree, { destDir: this.name });
|
|
481
|
+
tree = this.preprocessors.preprocessJs(tree, `/`, '/', {
|
|
477
482
|
annotation: 'v1-app-preprocess-js',
|
|
478
483
|
registry: this.app.registry,
|
|
479
484
|
});
|
|
485
|
+
tree = (0, broccoli_funnel_1.default)(tree, { srcDir: this.name });
|
|
486
|
+
return tree;
|
|
480
487
|
}
|
|
481
488
|
get htmlbarsPlugins() {
|
|
482
489
|
var _a, _b;
|
package/src/v1-app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1-app.js","sourceRoot":"","sources":["v1-app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA6C;AAC7C,mCAA2C;AAC3C,+BAAiD;AACjD,sEAA0C;AAC1C,gFAA8C;AAC9C,qDAA6C;AAC7C,sDAA8B;AAE9B,2CAAsD;AACtD,6CAA6D;AAU7D,uCAA2G;AAC3G,gEAAsC;AACtC,iEAA4D;AAE5D,qDAAmF;AACnF,gFAAsD;AACtD,sEAAqC;AACrC,6DAAqC;AACrC,gHAAqF;AACrF,iEAA4F;AAC5F,kGAA6E;AAC7E,2BAAkC;AAElC,oDAA4B;AAC5B,+DAA4D;AAe5D,MAAqB,KAAK;IAmBxB,YAAgC,GAAqB;QAArB,QAAG,GAAH,GAAG,CAAkB;QAN7C,kBAAa,GAAmC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpE,qBAAgB,GAAa,EAAE,CAAC;QAChC,oBAAe,GAAa,EAAE,CAAC;QAKrC,IAAI,CAAC,YAAY,GAAG,IAAI,yCAAmB,CAAC,mBAAY,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3F,CAAC;IAjBD,MAAM,CAAC,MAAM,CAAC,GAAqB;;QACjC,IAAI,MAAA,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,0CAAE,QAAQ,CAAC,aAAa,CAAC,EAAE;YACr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AAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC7E,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,uBAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED,IAAI,IAAI;QACN,wCAAwC;QACxC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,IAAI,IAAI;QACN,qEAAqE;QACrE,OAAO,IAAA,WAAI,EAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;CACF","sourcesContent":["import { Memoize } from 'typescript-memoize';\nimport { sync as pkgUpSync } from 'pkg-up';\nimport { join, dirname, isAbsolute } from 'path';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport { WatchedDir } from 'broccoli-source';\nimport resolve from 'resolve';\nimport { Node } from 'broccoli-node-api';\nimport { V1Config, WriteV1Config } from './v1-config';\nimport { WriteV1AppBoot, ReadV1AppBoot } from './v1-appboot';\nimport {\n TemplateCompilerPlugins,\n AddonMeta,\n Package,\n EmberAppInstance,\n OutputFileToInputFileMap,\n PackageInfo,\n AddonInstance,\n} from '@embroider/core';\nimport { writeJSONSync, ensureDirSync, copySync, readdirSync, pathExistsSync, existsSync } from 'fs-extra';\nimport AddToTree from './add-to-tree';\nimport DummyPackage, { OwningAddon } from './dummy-package';\nimport { 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 SynthesizeTemplateOnlyComponents from './synthesize-template-only-components';\nimport { isEmberAutoImportDynamic, isInlinePrecompilePlugin } from './detect-babel-plugins';\nimport prepHtmlbarsAstPluginsForUnwrap from './prepare-htmlbars-ast-plugins';\nimport { readFileSync } from 'fs';\nimport type { Options as HTMLBarsOptions } from 'ember-cli-htmlbars';\nimport semver from 'semver';\nimport { MovablePackageCache } from './moved-package-cache';\n\n// This controls and types the interface between our new world and the classic\n// v1 app instance.\n\ntype EmberCliHTMLBarsAddon = AddonInstance & {\n htmlbarsOptions(): HTMLBarsOptions;\n};\n\ninterface Group {\n outputFiles: OutputFileToInputFileMap;\n implicitKey: '_implicitStyles' | '_implicitScripts';\n vendorOutputPath: 'string';\n}\n\nexport default class V1App {\n // used to signal that this is a dummy app owned by a particular addon\n owningAddon: Package | undefined;\n\n static create(app: EmberAppInstance): V1App {\n if (app.project.pkg.keywords?.includes('ember-addon')) {\n // we are a dummy app, which is unfortunately weird and special\n return new V1DummyApp(app);\n } else {\n return new V1App(app);\n }\n }\n\n private _publicAssets: { [filePath: string]: string } = Object.create(null);\n private _implicitScripts: string[] = [];\n private _implicitStyles: string[] = [];\n\n packageCache: MovablePackageCache;\n\n protected constructor(protected app: EmberAppInstance) {\n this.packageCache = new MovablePackageCache(MacrosConfig.for(app, this.root), this.root);\n }\n\n // always the name from package.json. Not the one that apps may have weirdly\n // customized.\n get name(): string {\n return this.app.project.pkg.name;\n }\n\n get env(): string {\n return this.app.env;\n }\n\n @Memoize()\n get root(): string {\n return dirname(pkgUpSync({ cwd: this.app.project.root })!);\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 configReplace() {\n return this.requireFromEmberCLI('broccoli-config-replace');\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, Node> {\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.app.tests || false;\n }\n\n configPath(): string {\n return this.app.project.configPath();\n }\n\n private get configTree() {\n return new this.configLoader(dirname(this.configPath()), {\n env: this.app.env,\n tests: this.app.tests || false,\n project: this.app.project,\n });\n }\n\n @Memoize()\n get config(): V1Config {\n return new V1Config(this.configTree, this.app.env);\n }\n\n get autoRun(): boolean {\n return this.app.options.autoRun;\n }\n\n @Memoize()\n get appBoot(): ReadV1AppBoot {\n let env = this.app.env;\n let appBootContentTree = new WriteV1AppBoot();\n\n let patterns = this.configReplacePatterns;\n\n appBootContentTree = new this.configReplace(appBootContentTree, this.configTree, {\n configPath: join('environments', `${env}.json`),\n files: ['config/app-boot.js'],\n patterns,\n });\n\n return new ReadV1AppBoot(appBootContentTree);\n }\n\n private get storeConfigInMeta(): boolean {\n return this.app.options.storeConfigInMeta;\n }\n\n @Memoize()\n private get configReplacePatterns() {\n return this.appUtils.configReplacePatterns({\n addons: this.app.project.addons,\n autoRun: this.autoRun,\n storeConfigInMeta: this.storeConfigInMeta,\n });\n }\n\n get htmlTree() {\n if (this.app.tests) {\n return mergeTrees([this.indexTree, this.testIndexTree]);\n } else {\n return this.indexTree;\n }\n }\n\n private get indexTree() {\n let indexFilePath = this.app.options.outputPaths.app.html;\n let index = buildFunnel(this.app.trees.app, {\n allowEmpty: true,\n include: [`index.html`],\n getDestinationPath: () => indexFilePath,\n annotation: 'app/index.html',\n });\n return new this.configReplace(index, this.configTree, {\n configPath: join('environments', `${this.app.env}.json`),\n files: [indexFilePath],\n patterns: this.configReplacePatterns,\n annotation: 'ConfigReplace/indexTree',\n });\n }\n\n private get testIndexTree() {\n let index = buildFunnel(this.app.trees.tests, {\n allowEmpty: true,\n include: [`index.html`],\n destDir: 'tests',\n annotation: 'tests/index.html',\n });\n return new this.configReplace(index, this.configTree, {\n configPath: join('environments', `test.json`),\n files: ['tests/index.html'],\n patterns: this.configReplacePatterns,\n annotation: 'ConfigReplace/testIndexTree',\n });\n }\n\n @Memoize()\n babelConfig(): TransformOptions {\n // this finds all the built-in babel configuration that comes with ember-cli-babel\n const babelAddon = (this.app.project as any).findAddonByName('ember-cli-babel');\n const babelConfig = babelAddon.buildBabelOptions({\n 'ember-cli-babel': {\n includeExternalHelpers: true,\n compileModules: false,\n disableDebugTooling: false,\n disablePresetEnv: false,\n disableEmberModulesAPIPolyfill: false,\n disableDecoratorTransforms: false,\n },\n });\n\n let plugins = babelConfig.plugins as any[];\n let presets = babelConfig.presets;\n\n // this finds any custom babel configuration that's on the app (either\n // because the app author explicitly added some, or because addons have\n // pushed plugins into it).\n let appBabel = this.app.options.babel;\n if (appBabel) {\n if (appBabel.plugins) {\n plugins = appBabel.plugins.concat(plugins);\n }\n if (appBabel.presets) {\n presets = appBabel.presets.concat(presets);\n }\n }\n\n plugins = 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 );\n });\n\n const config: TransformOptions = {\n babelrc: false,\n plugins,\n presets,\n // this is here because broccoli-middleware can't render a codeFrame full\n // of terminal codes. It would be nice to add something like\n // https://github.com/mmalecki/ansispan to broccoli-middleware so we can\n // leave color enabled.\n highlightCode: false,\n };\n\n return config;\n }\n\n @Memoize()\n babelMajorVersion(): 7 {\n let babelAddon = this.app.project.addons.find((a: any) => a.name === 'ember-cli-babel');\n if (babelAddon) {\n let major = Number(babelAddon.pkg.version.split('.')[0]);\n if (major !== 7) {\n throw new Error(`@embroider/compat only supports v1 addons that use babel 7`);\n }\n return major;\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.app._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.app._nodeModules.values()) {\n if (match[1] === name) {\n return filename.replace(match[0], path + '/');\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: Node[]): Node {\n let trees = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: 'vendor',\n destDir: 'vendor',\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.app._scriptOutputFiles,\n implicitKey: '_implicitScripts',\n vendorOutputPath: this.app.options.outputPaths.vendor.js,\n },\n // styles\n {\n outputFiles: this.app._styleOutputFiles,\n implicitKey: '_implicitStyles',\n vendorOutputPath: this.app.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.app.options['sourcemaps'],\n })\n );\n }\n }\n }\n\n this.addOtherAssets();\n return mergeTrees([tree, ...concatentations], { overwrite: true });\n }\n\n addOtherAssets() {\n for (let asset of this.app.otherAssetPaths) {\n this._publicAssets[`${asset.src}/${asset.file}`] = `${asset.dest}/${asset.file}`;\n }\n }\n\n private addNodeAssets(inputTree: Node): Node {\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 let remapAsset = this.remapAsset.bind(this);\n\n let addonMeta: AddonMeta = {\n type: 'addon',\n version: 2,\n 'implicit-scripts': this._implicitScripts.map(remapAsset),\n 'implicit-styles': this._implicitStyles.map(remapAsset),\n 'implicit-test-scripts': this.app.legacyTestFilesToAppend.map(remapAsset),\n 'implicit-test-styles': this.app.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: Node[]): Node {\n return this.applyCustomTransforms(this.addNodeAssets(this.combinedVendor(addonTrees)));\n }\n\n private combinedStyles(addonTrees: Node[]): Node {\n let trees: Node[] = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: '_app_styles_',\n })\n );\n let appStyles = this.app.trees.styles as Node | 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: Node[]): Node {\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.app.registry,\n minifyCSS: this.app.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 readdirSync(assetPath)) {\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: Node) {\n for (let customTransformEntry of this.app._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 private preprocessJS(tree: Node): Node {\n // we're saving all our babel compilation for the final stage packager\n this.app.registry.remove('js', 'ember-cli-babel');\n\n // auto-import is supported natively so we don't need it here\n this.app.registry.remove('js', 'ember-auto-import-analyzer');\n\n return this.preprocessors.preprocessJs(tree, `/`, '/', {\n annotation: 'v1-app-preprocess-js',\n registry: this.app.registry,\n });\n }\n\n get htmlbarsPlugins(): TemplateCompilerPlugins {\n let addon = this.app.project.addons.find(\n (a: AddonInstance) => a.name === 'ember-cli-htmlbars'\n ) as unknown as EmberCliHTMLBarsAddon;\n let options = addon.htmlbarsOptions();\n if (options?.plugins?.ast) {\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 options.plugins.ast = options.plugins.ast.filter((p: any) => !isEmbroiderMacrosPlugin(p));\n prepHtmlbarsAstPluginsForUnwrap(this.app.registry);\n }\n return options.plugins ?? {};\n }\n\n // our own appTree. Not to be confused with the one that combines the app js\n // from all addons too.\n private get appTree(): Node {\n return this.preprocessJS(\n buildFunnel(this.app.trees.app, {\n exclude: ['styles/**', '*.html'],\n })\n );\n }\n\n private get testsTree(): Node | undefined {\n if (this.shouldBuildTests && this.app.trees.tests) {\n return this.preprocessJS(\n buildFunnel(this.app.trees.tests, {\n destDir: 'tests',\n })\n );\n }\n }\n\n private get lintTree(): Node | undefined {\n if (this.shouldBuildTests) {\n return this.app.getLintTests();\n }\n }\n\n get vendorTree(): Node | undefined {\n return this.ensureTree(this.app.trees.vendor);\n }\n\n private ensureTree(maybeTree: string | Node | undefined): Node | 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.app.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 get publicTree(): Node | undefined {\n return this.ensureTree(this.app.trees.public);\n }\n\n processAppJS(): { appJS: Node } {\n let appTree = this.appTree;\n let testsTree = this.testsTree;\n let lintTree = this.lintTree;\n let config = new WriteV1Config(this.config, this.storeConfigInMeta);\n let patterns = this.configReplacePatterns;\n let configReplaced = new this.configReplace(config, this.configTree, {\n configPath: join('environments', `${this.app.env}.json`),\n files: ['config/environment.js'],\n patterns,\n });\n\n let trees: Node[] = [];\n trees.push(appTree);\n trees.push(new SynthesizeTemplateOnlyComponents(appTree, ['components']));\n\n trees.push(configReplaced);\n if (testsTree) {\n trees.push(testsTree);\n }\n if (lintTree) {\n trees.push(lintTree);\n }\n return {\n appJS: mergeTrees(trees, { overwrite: true }),\n };\n }\n\n private withoutRootURL(src: string) {\n let rootURL = this.config.readConfig().rootURL;\n if (src.startsWith(rootURL)) {\n src = '/' + src.slice(rootURL.length);\n } else if (src.startsWith('/' + rootURL)) {\n src = src.slice(rootURL.length);\n }\n return src;\n }\n\n findAppScript(scripts: HTMLScriptElement[], entrypoint: string): HTMLScriptElement {\n let appJS = scripts.find(script => this.withoutRootURL(script.src) === this.app.options.outputPaths.app.js);\n return throwIfMissing(\n appJS,\n this.app.options.outputPaths.app.js,\n scripts.map(s => s.src),\n entrypoint,\n 'app javascript'\n );\n }\n\n findAppStyles(styles: HTMLLinkElement[], entrypoint: string): HTMLLinkElement {\n let style = styles.find(style => this.withoutRootURL(style.href) === this.app.options.outputPaths.app.css.app);\n return throwIfMissing(\n style,\n this.app.options.outputPaths.app.css.app,\n styles.map(s => s.href),\n entrypoint,\n 'app css'\n );\n }\n\n findVendorScript(scripts: HTMLScriptElement[], entrypoint: string): HTMLScriptElement {\n let vendor = scripts.find(script => this.withoutRootURL(script.src) === this.app.options.outputPaths.vendor.js);\n return throwIfMissing(\n vendor,\n this.app.options.outputPaths.vendor.js,\n scripts.map(s => s.src),\n entrypoint,\n 'vendor javascript'\n );\n }\n\n findVendorStyles(styles: HTMLLinkElement[], entrypoint: string): HTMLLinkElement {\n let vendorStyle = styles.find(style => this.withoutRootURL(style.href) === this.app.options.outputPaths.vendor.css);\n return throwIfMissing(\n vendorStyle,\n this.app.options.outputPaths.vendor.css,\n styles.map(s => s.href),\n entrypoint,\n 'vendor css'\n );\n }\n\n findTestSupportStyles(styles: HTMLLinkElement[]): HTMLLinkElement | undefined {\n return styles.find(style => this.withoutRootURL(style.href) === this.app.options.outputPaths.testSupport.css);\n }\n\n findTestSupportScript(scripts: HTMLScriptElement[]): HTMLScriptElement | undefined {\n return scripts.find(\n script => this.withoutRootURL(script.src) === this.app.options.outputPaths.testSupport.js.testSupport\n );\n }\n\n findTestScript(scripts: HTMLScriptElement[]): HTMLScriptElement | undefined {\n return scripts.find(script => this.withoutRootURL(script.src) === this.app.options.outputPaths.tests.js);\n }\n}\n\nfunction throwIfMissing<T>(\n asset: T | undefined,\n needle: string,\n haystack: string[],\n entryfile: string,\n context: string\n): T {\n if (!asset) {\n throw new Error(\n `Could not find ${context}: \"${needle}\" in ${entryfile}. Found the following instead:\\n${haystack\n .map(asset => ` - ${asset}`)\n .join(\n '\\n'\n )}\\n\\nFor more information about this error: https://github.com/thoov/stitch/wiki/Could-not-find-asset-in-entry-file-error-help`\n );\n }\n\n return asset;\n}\n\nclass V1DummyApp extends V1App {\n constructor(app: EmberAppInstance) {\n super(app);\n this.owningAddon = new OwningAddon(this.app.project.root, this.packageCache);\n this.packageCache.seed(this.owningAddon);\n this.packageCache.seed(new DummyPackage(this.root, this.owningAddon, this.packageCache));\n }\n\n get name(): string {\n // here we accept the ember-cli behavior\n return this.app.name;\n }\n\n get root(): string {\n // this is the Known Hack for finding the true root of the dummy app.\n return join(this.app.project.configPath(), '..', '..');\n }\n}\n\ninterface Preprocessors {\n preprocessJs(tree: Node, a: string, b: string, options: object): Node;\n preprocessCss(tree: Node, a: string, b: string, options: object): Node;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"v1-app.js","sourceRoot":"","sources":["v1-app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA6C;AAC7C,mCAA2C;AAC3C,+BAAiD;AACjD,sEAA0C;AAC1C,gFAA8C;AAC9C,qDAA6C;AAC7C,sDAA8B;AAE9B,2CAAsD;AACtD,6CAA6D;AAU7D,uCAA2G;AAC3G,gEAAsC;AACtC,iEAA4D;AAE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CAAC;IACvB,CAAC;IAED,IAAI,IAAI;QACN,qEAAqE;QACrE,OAAO,IAAA,WAAI,EAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;CACF","sourcesContent":["import { Memoize } from 'typescript-memoize';\nimport { sync as pkgUpSync } from 'pkg-up';\nimport { join, dirname, isAbsolute } from 'path';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport { WatchedDir } from 'broccoli-source';\nimport resolve from 'resolve';\nimport { Node } from 'broccoli-node-api';\nimport { V1Config, WriteV1Config } from './v1-config';\nimport { WriteV1AppBoot, ReadV1AppBoot } from './v1-appboot';\nimport {\n TemplateCompilerPlugins,\n AddonMeta,\n Package,\n EmberAppInstance,\n OutputFileToInputFileMap,\n PackageInfo,\n AddonInstance,\n} from '@embroider/core';\nimport { writeJSONSync, ensureDirSync, copySync, readdirSync, pathExistsSync, existsSync } from 'fs-extra';\nimport AddToTree from './add-to-tree';\nimport DummyPackage, { OwningAddon } from './dummy-package';\nimport { 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 SynthesizeTemplateOnlyComponents from './synthesize-template-only-components';\nimport { isEmberAutoImportDynamic, isInlinePrecompilePlugin } from './detect-babel-plugins';\nimport prepHtmlbarsAstPluginsForUnwrap from './prepare-htmlbars-ast-plugins';\nimport { readFileSync } from 'fs';\nimport type { Options as HTMLBarsOptions } from 'ember-cli-htmlbars';\nimport semver from 'semver';\nimport { MovablePackageCache } from './moved-package-cache';\n\n// This controls and types the interface between our new world and the classic\n// v1 app instance.\n\ntype EmberCliHTMLBarsAddon = AddonInstance & {\n htmlbarsOptions(): HTMLBarsOptions;\n};\n\ninterface Group {\n outputFiles: OutputFileToInputFileMap;\n implicitKey: '_implicitStyles' | '_implicitScripts';\n vendorOutputPath: 'string';\n}\n\nexport default class V1App {\n // used to signal that this is a dummy app owned by a particular addon\n owningAddon: Package | undefined;\n\n static create(app: EmberAppInstance): V1App {\n if (app.project.pkg.keywords?.includes('ember-addon')) {\n // we are a dummy app, which is unfortunately weird and special\n return new V1DummyApp(app);\n } else {\n return new V1App(app);\n }\n }\n\n private _publicAssets: { [filePath: string]: string } = Object.create(null);\n private _implicitScripts: string[] = [];\n private _implicitStyles: string[] = [];\n\n packageCache: MovablePackageCache;\n\n protected constructor(protected app: EmberAppInstance) {\n this.packageCache = new MovablePackageCache(MacrosConfig.for(app, this.root), this.root);\n }\n\n // always the name from package.json. Not the one that apps may have weirdly\n // customized.\n get name(): string {\n return this.app.project.pkg.name;\n }\n\n get env(): string {\n return this.app.env;\n }\n\n @Memoize()\n get root(): string {\n return dirname(pkgUpSync({ cwd: this.app.project.root })!);\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 configReplace() {\n return this.requireFromEmberCLI('broccoli-config-replace');\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, Node> {\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.app.tests || false;\n }\n\n configPath(): string {\n return this.app.project.configPath();\n }\n\n private get configTree() {\n return new this.configLoader(dirname(this.configPath()), {\n env: this.app.env,\n tests: this.app.tests || false,\n project: this.app.project,\n });\n }\n\n @Memoize()\n get config(): V1Config {\n return new V1Config(this.configTree, this.app.env);\n }\n\n get autoRun(): boolean {\n return this.app.options.autoRun;\n }\n\n @Memoize()\n get appBoot(): ReadV1AppBoot {\n let env = this.app.env;\n let appBootContentTree = new WriteV1AppBoot();\n\n let patterns = this.configReplacePatterns;\n\n appBootContentTree = new this.configReplace(appBootContentTree, this.configTree, {\n configPath: join('environments', `${env}.json`),\n files: ['config/app-boot.js'],\n patterns,\n });\n\n return new ReadV1AppBoot(appBootContentTree);\n }\n\n private get storeConfigInMeta(): boolean {\n return this.app.options.storeConfigInMeta;\n }\n\n @Memoize()\n private get configReplacePatterns() {\n return this.appUtils.configReplacePatterns({\n addons: this.app.project.addons,\n autoRun: this.autoRun,\n storeConfigInMeta: this.storeConfigInMeta,\n });\n }\n\n get htmlTree() {\n if (this.app.tests) {\n return mergeTrees([this.indexTree, this.testIndexTree]);\n } else {\n return this.indexTree;\n }\n }\n\n private get indexTree() {\n let indexFilePath = this.app.options.outputPaths.app.html;\n let index = buildFunnel(this.app.trees.app, {\n allowEmpty: true,\n include: [`index.html`],\n getDestinationPath: () => indexFilePath,\n annotation: 'app/index.html',\n });\n return new this.configReplace(index, this.configTree, {\n configPath: join('environments', `${this.app.env}.json`),\n files: [indexFilePath],\n patterns: this.configReplacePatterns,\n annotation: 'ConfigReplace/indexTree',\n });\n }\n\n private get testIndexTree() {\n let index = buildFunnel(this.app.trees.tests, {\n allowEmpty: true,\n include: [`index.html`],\n destDir: 'tests',\n annotation: 'tests/index.html',\n });\n return new this.configReplace(index, this.configTree, {\n configPath: join('environments', `test.json`),\n files: ['tests/index.html'],\n patterns: this.configReplacePatterns,\n annotation: 'ConfigReplace/testIndexTree',\n });\n }\n\n @Memoize()\n babelConfig(): TransformOptions {\n // this finds all the built-in babel configuration that comes with ember-cli-babel\n const babelAddon = (this.app.project as any).findAddonByName('ember-cli-babel');\n const babelConfig = babelAddon.buildBabelOptions({\n 'ember-cli-babel': {\n includeExternalHelpers: true,\n compileModules: false,\n disableDebugTooling: false,\n disablePresetEnv: false,\n disableEmberModulesAPIPolyfill: false,\n disableDecoratorTransforms: false,\n },\n });\n\n let plugins = babelConfig.plugins as any[];\n let presets = babelConfig.presets;\n\n // this finds any custom babel configuration that's on the app (either\n // because the app author explicitly added some, or because addons have\n // pushed plugins into it).\n let appBabel = this.app.options.babel;\n if (appBabel) {\n if (appBabel.plugins) {\n plugins = appBabel.plugins.concat(plugins);\n }\n if (appBabel.presets) {\n presets = appBabel.presets.concat(presets);\n }\n }\n\n plugins = 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 );\n });\n\n const config: TransformOptions = {\n babelrc: false,\n plugins,\n presets,\n // this is here because broccoli-middleware can't render a codeFrame full\n // of terminal codes. It would be nice to add something like\n // https://github.com/mmalecki/ansispan to broccoli-middleware so we can\n // leave color enabled.\n highlightCode: false,\n };\n\n return config;\n }\n\n @Memoize()\n babelMajorVersion(): 7 {\n let babelAddon = this.app.project.addons.find((a: any) => a.name === 'ember-cli-babel');\n if (babelAddon) {\n let major = Number(babelAddon.pkg.version.split('.')[0]);\n if (major !== 7) {\n throw new Error(`@embroider/compat only supports v1 addons that use babel 7`);\n }\n return major;\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.app._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.app._nodeModules.values()) {\n if (match[1] === name) {\n return filename.replace(match[0], path + '/');\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: Node[]): Node {\n let trees = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: 'vendor',\n destDir: 'vendor',\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.app._scriptOutputFiles,\n implicitKey: '_implicitScripts',\n vendorOutputPath: this.app.options.outputPaths.vendor.js,\n },\n // styles\n {\n outputFiles: this.app._styleOutputFiles,\n implicitKey: '_implicitStyles',\n vendorOutputPath: this.app.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.app.options['sourcemaps'],\n })\n );\n }\n }\n }\n\n this.addOtherAssets();\n return mergeTrees([tree, ...concatentations], { overwrite: true });\n }\n\n addOtherAssets() {\n for (let asset of this.app.otherAssetPaths) {\n this._publicAssets[`${asset.src}/${asset.file}`] = `${asset.dest}/${asset.file}`;\n }\n }\n\n private addNodeAssets(inputTree: Node): Node {\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 let remapAsset = this.remapAsset.bind(this);\n\n let addonMeta: AddonMeta = {\n type: 'addon',\n version: 2,\n 'implicit-scripts': this._implicitScripts.map(remapAsset),\n 'implicit-styles': this._implicitStyles.map(remapAsset),\n 'implicit-test-scripts': this.app.legacyTestFilesToAppend.map(remapAsset),\n 'implicit-test-styles': this.app.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: Node[]): Node {\n return this.applyCustomTransforms(this.addNodeAssets(this.combinedVendor(addonTrees)));\n }\n\n private combinedStyles(addonTrees: Node[]): Node {\n let trees: Node[] = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: '_app_styles_',\n })\n );\n let appStyles = this.app.trees.styles as Node | 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: Node[]): Node {\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.app.registry,\n minifyCSS: this.app.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 readdirSync(assetPath)) {\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: Node) {\n for (let customTransformEntry of this.app._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 private preprocessJS(tree: Node): Node {\n // we're saving all our babel compilation for the final stage packager\n this.app.registry.remove('js', 'ember-cli-babel');\n\n // auto-import is supported natively so we don't need it here\n this.app.registry.remove('js', 'ember-auto-import-analyzer');\n\n tree = buildFunnel(tree, { destDir: this.name });\n\n tree = this.preprocessors.preprocessJs(tree, `/`, '/', {\n annotation: 'v1-app-preprocess-js',\n registry: this.app.registry,\n });\n\n tree = buildFunnel(tree, { srcDir: this.name });\n\n return tree;\n }\n\n get htmlbarsPlugins(): TemplateCompilerPlugins {\n let addon = this.app.project.addons.find(\n (a: AddonInstance) => a.name === 'ember-cli-htmlbars'\n ) as unknown as EmberCliHTMLBarsAddon;\n let options = addon.htmlbarsOptions();\n if (options?.plugins?.ast) {\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 options.plugins.ast = options.plugins.ast.filter((p: any) => !isEmbroiderMacrosPlugin(p));\n prepHtmlbarsAstPluginsForUnwrap(this.app.registry);\n }\n return options.plugins ?? {};\n }\n\n // our own appTree. Not to be confused with the one that combines the app js\n // from all addons too.\n private get appTree(): Node {\n return this.preprocessJS(\n buildFunnel(this.app.trees.app, {\n exclude: ['styles/**', '*.html'],\n })\n );\n }\n\n private get testsTree(): Node | undefined {\n if (this.shouldBuildTests && this.app.trees.tests) {\n return this.preprocessJS(\n buildFunnel(this.app.trees.tests, {\n destDir: 'tests',\n })\n );\n }\n }\n\n private get lintTree(): Node | undefined {\n if (this.shouldBuildTests) {\n return this.app.getLintTests();\n }\n }\n\n get vendorTree(): Node | undefined {\n return this.ensureTree(this.app.trees.vendor);\n }\n\n private ensureTree(maybeTree: string | Node | undefined): Node | 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.app.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 get publicTree(): Node | undefined {\n return this.ensureTree(this.app.trees.public);\n }\n\n processAppJS(): { appJS: Node } {\n let appTree = this.appTree;\n let testsTree = this.testsTree;\n let lintTree = this.lintTree;\n let config = new WriteV1Config(this.config, this.storeConfigInMeta);\n let patterns = this.configReplacePatterns;\n let configReplaced = new this.configReplace(config, this.configTree, {\n configPath: join('environments', `${this.app.env}.json`),\n files: ['config/environment.js'],\n patterns,\n });\n\n let trees: Node[] = [];\n trees.push(appTree);\n trees.push(new SynthesizeTemplateOnlyComponents(appTree, ['components']));\n\n trees.push(configReplaced);\n if (testsTree) {\n trees.push(testsTree);\n }\n if (lintTree) {\n trees.push(lintTree);\n }\n return {\n appJS: mergeTrees(trees, { overwrite: true }),\n };\n }\n\n private withoutRootURL(src: string) {\n let rootURL = this.config.readConfig().rootURL;\n if (src.startsWith(rootURL)) {\n src = '/' + src.slice(rootURL.length);\n } else if (src.startsWith('/' + rootURL)) {\n src = src.slice(rootURL.length);\n }\n return src;\n }\n\n findAppScript(scripts: HTMLScriptElement[], entrypoint: string): HTMLScriptElement {\n let appJS = scripts.find(script => this.withoutRootURL(script.src) === this.app.options.outputPaths.app.js);\n return throwIfMissing(\n appJS,\n this.app.options.outputPaths.app.js,\n scripts.map(s => s.src),\n entrypoint,\n 'app javascript'\n );\n }\n\n findAppStyles(styles: HTMLLinkElement[], entrypoint: string): HTMLLinkElement {\n let style = styles.find(style => this.withoutRootURL(style.href) === this.app.options.outputPaths.app.css.app);\n return throwIfMissing(\n style,\n this.app.options.outputPaths.app.css.app,\n styles.map(s => s.href),\n entrypoint,\n 'app css'\n );\n }\n\n findVendorScript(scripts: HTMLScriptElement[], entrypoint: string): HTMLScriptElement {\n let vendor = scripts.find(script => this.withoutRootURL(script.src) === this.app.options.outputPaths.vendor.js);\n return throwIfMissing(\n vendor,\n this.app.options.outputPaths.vendor.js,\n scripts.map(s => s.src),\n entrypoint,\n 'vendor javascript'\n );\n }\n\n findVendorStyles(styles: HTMLLinkElement[], entrypoint: string): HTMLLinkElement {\n let vendorStyle = styles.find(style => this.withoutRootURL(style.href) === this.app.options.outputPaths.vendor.css);\n return throwIfMissing(\n vendorStyle,\n this.app.options.outputPaths.vendor.css,\n styles.map(s => s.href),\n entrypoint,\n 'vendor css'\n );\n }\n\n findTestSupportStyles(styles: HTMLLinkElement[]): HTMLLinkElement | undefined {\n return styles.find(style => this.withoutRootURL(style.href) === this.app.options.outputPaths.testSupport.css);\n }\n\n findTestSupportScript(scripts: HTMLScriptElement[]): HTMLScriptElement | undefined {\n return scripts.find(\n script => this.withoutRootURL(script.src) === this.app.options.outputPaths.testSupport.js.testSupport\n );\n }\n\n findTestScript(scripts: HTMLScriptElement[]): HTMLScriptElement | undefined {\n return scripts.find(script => this.withoutRootURL(script.src) === this.app.options.outputPaths.tests.js);\n }\n}\n\nfunction throwIfMissing<T>(\n asset: T | undefined,\n needle: string,\n haystack: string[],\n entryfile: string,\n context: string\n): T {\n if (!asset) {\n throw new Error(\n `Could not find ${context}: \"${needle}\" in ${entryfile}. Found the following instead:\\n${haystack\n .map(asset => ` - ${asset}`)\n .join(\n '\\n'\n )}\\n\\nFor more information about this error: https://github.com/thoov/stitch/wiki/Could-not-find-asset-in-entry-file-error-help`\n );\n }\n\n return asset;\n}\n\nclass V1DummyApp extends V1App {\n constructor(app: EmberAppInstance) {\n super(app);\n this.owningAddon = new OwningAddon(this.app.project.root, this.packageCache);\n this.packageCache.seed(this.owningAddon);\n this.packageCache.seed(new DummyPackage(this.root, this.owningAddon, this.packageCache));\n }\n\n get name(): string {\n // here we accept the ember-cli behavior\n return this.app.name;\n }\n\n get root(): string {\n // this is the Known Hack for finding the true root of the dummy app.\n return join(this.app.project.configPath(), '..', '..');\n }\n}\n\ninterface Preprocessors {\n preprocessJs(tree: Node, a: string, b: string, options: object): Node;\n preprocessCss(tree: Node, a: string, b: string, options: object): Node;\n}\n"]}
|