@embroider/compat 2.1.0 → 2.1.1-unstable.21eae41

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.
Files changed (36) hide show
  1. package/package.json +5 -4
  2. package/src/addon-dependency-rules/ember-data.js +1 -0
  3. package/src/addon-dependency-rules/ember-data.js.map +1 -1
  4. package/src/audit/build.js +48 -46
  5. package/src/audit/build.js.map +1 -1
  6. package/src/audit/options.d.ts +3 -2
  7. package/src/audit/options.js.map +1 -1
  8. package/src/audit-cli.js +0 -0
  9. package/src/audit.d.ts +25 -1
  10. package/src/audit.js +51 -32
  11. package/src/audit.js.map +1 -1
  12. package/src/babel-plugin-adjust-imports.d.ts +16 -0
  13. package/src/babel-plugin-adjust-imports.js +131 -0
  14. package/src/babel-plugin-adjust-imports.js.map +1 -0
  15. package/src/compat-adapters/ember-data.d.ts +1 -0
  16. package/src/compat-adapters/ember-data.js +4 -0
  17. package/src/compat-adapters/ember-data.js.map +1 -1
  18. package/src/compat-app.js +47 -76
  19. package/src/compat-app.js.map +1 -1
  20. package/src/dependency-rules.d.ts +5 -7
  21. package/src/dependency-rules.js +8 -40
  22. package/src/dependency-rules.js.map +1 -1
  23. package/src/resolver-transform.d.ts +11 -4
  24. package/src/resolver-transform.js +707 -322
  25. package/src/resolver-transform.js.map +1 -1
  26. package/src/v1-app.js +18 -4
  27. package/src/v1-app.js.map +1 -1
  28. package/src/audit/capture.d.ts +0 -8
  29. package/src/audit/capture.js +0 -45
  30. package/src/audit/capture.js.map +0 -1
  31. package/src/resolver.d.ts +0 -128
  32. package/src/resolver.js +0 -677
  33. package/src/resolver.js.map +0 -1
  34. package/src/template-compiler-broccoli-plugin.d.ts +0 -10
  35. package/src/template-compiler-broccoli-plugin.js +0 -28
  36. package/src/template-compiler-broccoli-plugin.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"resolver-transform.js","sourceRoot":"","sources":["resolver-transform.ts"],"names":[],"mappings":";;;;;AAA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F,kGAAkG;IAClG,oCAAoC;IACpC,6GAA6G;IAC7G,gFAAgF;IAChF,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE;QAClC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;KAC9F;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAuB,EAAE,QAAkB,EAAE,UAAkB;IAC5F,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE;QAClC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;KAChG;AACH,CAAC;AAED,SAAS,UAAU,CACjB,IAAmB,EACnB,GAAM;IAEN,MAAM,WAAW,GAAG,IAAI,CAAC,WAMxB,CAAC;IACF,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,GAAa,CAAC,CAAQ,CAAC;KACvE;SAAM;QACL,OAAO,IAAI,WAAW,CAAC,KAAY,EAAE,IAAI,EAAE,GAAa,CAAQ,CAAC;KAClE;AACH,CAAC","sourcesContent":["import {\n default as Resolver,\n ComponentResolution,\n ComponentLocator,\n ResolutionFail,\n Resolution,\n ResolvedDep,\n} from './resolver';\nimport type { ASTv1, ASTPluginBuilder, ASTPluginEnvironment, WalkerPath } from '@glimmer/syntax';\nimport type { WithJSUtils } from 'babel-plugin-ember-template-compilation';\nimport assertNever from 'assert-never';\n\ntype Env = WithJSUtils<ASTPluginEnvironment> & {\n filename: string;\n contents: string;\n strict?: boolean;\n locals?: string[];\n};\n\nexport interface Options {\n resolver: Resolver;\n patchHelpersBug: boolean;\n}\n\n// This is the AST transform that resolves components, helpers and modifiers at build time\nexport default function makeResolverTransform({ resolver, patchHelpersBug }: Options) {\n const resolverTransform: ASTPluginBuilder<Env> = env => {\n let {\n filename,\n contents,\n meta: { jsutils },\n syntax: { builders },\n strict,\n locals,\n } = env;\n\n let scopeStack = new ScopeStack();\n let emittedAMDDeps: Set<string> = new Set();\n\n // The first time we insert a component as a lexical binding\n // - if there's no JS-scope collision with the name, we're going to bind the existing name\n // - in this case, any subsequent invocations of the same component just got automatically fixed too\n // - but that means we need to remember that we did this, in order to\n // give those other invocation sites support for features like argumentsAreComponents. That is what\n // emittedLexicalBindings is for.\n // - else there is a JS-scope collision, we're going to bind a mangled name and rewrite the callsite\n // - in this case, subequent callsites will get their own independent\n // resolution and they will get correctly aggregated by the\n // jsutils.bindImport logic.\n let emittedLexicalBindings: Map<string, Resolution> = new Map();\n\n function emitAMD(dep: ResolvedDep | null) {\n if (dep && !emittedAMDDeps.has(dep.runtimeName)) {\n let parts = dep.runtimeName.split('/');\n let { path, runtimeName } = dep;\n jsutils.emitExpression(context => {\n let identifier = context.import(path, 'default', parts[parts.length - 1]);\n return `window.define(\"${runtimeName}\", () => ${identifier})`;\n });\n emittedAMDDeps.add(dep.runtimeName);\n }\n }\n\n function emit<Target extends WalkerPath<ASTv1.Node>>(\n parentPath: Target,\n resolution: Resolution | null,\n setter: (target: Target['node'], newIdentifier: ASTv1.PathExpression) => void\n ) {\n switch (resolution?.type) {\n case 'error':\n resolver.reportError(resolution, filename, contents);\n return;\n case 'helper':\n if (patchHelpersBug) {\n // lexical invocation of helpers was not reliable before Ember 4.2 due to https://github.com/emberjs/ember.js/pull/19878\n emitAMD(resolution.module);\n } else {\n let name = jsutils.bindImport(resolution.module.path, 'default', parentPath, {\n nameHint: resolution.nameHint,\n });\n emittedLexicalBindings.set(name, resolution);\n setter(parentPath.node, builders.path(name));\n }\n return;\n case 'modifier':\n let name = jsutils.bindImport(resolution.module.path, 'default', parentPath, {\n nameHint: resolution.nameHint,\n });\n emittedLexicalBindings.set(name, resolution);\n setter(parentPath.node, builders.path(name));\n return;\n case 'component':\n // When people are using octane-style template co-location or\n // polaris-style first-class templates, we see only JS files for their\n // components, because the template association is handled before\n // we're doing any resolving here. In that case, we can safely do\n // component invocation via lexical scope.\n //\n // But when people are using the older non-co-located template style,\n // we can't safely do that -- ember needs to discover both the\n // component and the template in the AMD loader to associate them. In\n // that case, we emit just-in-time AMD definitions for them.\n if (resolution.jsModule && !resolution.hbsModule) {\n let name = jsutils.bindImport(resolution.jsModule.path, 'default', parentPath, {\n nameHint: resolution.nameHint,\n });\n emittedLexicalBindings.set(name, resolution);\n setter(parentPath.node, builders.path(name));\n } else {\n emitAMD(resolution.hbsModule);\n emitAMD(resolution.jsModule);\n }\n case undefined:\n return;\n default:\n assertNever(resolution);\n }\n }\n\n function handleDynamicComponentArguments(\n componentName: string,\n argumentsAreComponents: string[],\n attributes: WalkerPath<ASTv1.AttrNode | ASTv1.HashPair>[]\n ) {\n for (let name of argumentsAreComponents) {\n let attr = attributes.find(attr => {\n if (attr.node.type === 'AttrNode') {\n return attr.node.name === '@' + name;\n } else {\n return attr.node.key === name;\n }\n });\n if (attr) {\n let resolution = handleComponentHelper(attr.node.value, resolver, filename, scopeStack, {\n componentName,\n argumentName: name,\n });\n emit(attr, resolution, (node, newId) => {\n if (node.type === 'AttrNode') {\n node.value = builders.mustache(newId);\n } else {\n node.value = newId;\n }\n });\n }\n }\n }\n\n if (strict) {\n return {\n name: 'embroider-build-time-resolver-strict-noop',\n visitor: {},\n };\n }\n\n return {\n name: 'embroider-build-time-resolver',\n\n visitor: {\n Program: {\n enter(node) {\n if (locals) {\n scopeStack.push(locals);\n }\n scopeStack.push(node.blockParams);\n },\n exit() {\n scopeStack.pop();\n if (locals) {\n scopeStack.pop();\n }\n },\n },\n BlockStatement(node, path) {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n let rootName = node.path.parts[0];\n if (scopeStack.inScope(rootName)) {\n let resolution = emittedLexicalBindings.get(rootName);\n if (resolution?.type === 'component') {\n scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n handleDynamicComponentArguments(\n rootName,\n argumentsAreComponents,\n extendPath(extendPath(path, 'hash'), 'pairs')\n );\n });\n }\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (node.path.parts.length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components, which means there's nothing to resolve at this\n // location.\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n let resolution = handleComponentHelper(node.params[0], resolver, filename, scopeStack);\n emit(path, resolution, (node, newIdentifier) => {\n node.params[0] = newIdentifier;\n });\n return;\n }\n // a block counts as args from our perpsective (it's enough to prove\n // this thing must be a component, not content)\n let hasArgs = true;\n let resolution = resolver.resolveMustache(node.path.original, hasArgs, filename, node.path.loc);\n emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n if (resolution?.type === 'component') {\n scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n handleDynamicComponentArguments(\n rootName,\n argumentsAreComponents,\n extendPath(extendPath(path, 'hash'), 'pairs')\n );\n });\n }\n },\n SubExpression(node, path) {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (scopeStack.inScope(node.path.parts[0])) {\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n let resolution = handleComponentHelper(node.params[0], resolver, filename, scopeStack);\n emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.original === 'helper' && node.params.length > 0) {\n handleDynamicHelper(node.params[0], resolver, filename);\n return;\n }\n if (node.path.original === 'modifier' && node.params.length > 0) {\n handleDynamicModifier(node.params[0], resolver, filename);\n return;\n }\n let resolution = resolver.resolveSubExpression(node.path.original, filename, node.path.loc);\n emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n },\n MustacheStatement: {\n enter(node, path) {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n let rootName = node.path.parts[0];\n if (scopeStack.inScope(rootName)) {\n let resolution = emittedLexicalBindings.get(rootName);\n if (resolution && resolution.type === 'component') {\n handleDynamicComponentArguments(\n rootName,\n resolution.argumentsAreComponents,\n extendPath(extendPath(path, 'hash'), 'pairs')\n );\n }\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (node.path.parts.length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components, which means there's nothing to resolve at this\n // location.\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n let resolution = handleComponentHelper(node.params[0], resolver, filename, scopeStack);\n emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.original === 'helper' && node.params.length > 0) {\n handleDynamicHelper(node.params[0], resolver, filename);\n return;\n }\n let hasArgs = node.params.length > 0 || node.hash.pairs.length > 0;\n let resolution = resolver.resolveMustache(node.path.original, hasArgs, filename, node.path.loc);\n emit(path, resolution, (node, newIdentifier) => {\n node.path = newIdentifier;\n });\n if (resolution?.type === 'component') {\n handleDynamicComponentArguments(\n node.path.original,\n resolution.argumentsAreComponents,\n extendPath(extendPath(path, 'hash'), 'pairs')\n );\n }\n },\n },\n ElementModifierStatement(node, path) {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (scopeStack.inScope(node.path.parts[0])) {\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (node.path.data === true) {\n return;\n }\n if (node.path.parts.length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components. With the introduction of `Template strict mode` in Ember 3.25\n // it is also possible to pass modifiers this way which means there's nothing\n // to resolve at this location.\n return;\n }\n\n let resolution = resolver.resolveElementModifierStatement(node.path.original, filename, node.path.loc);\n emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n },\n ElementNode: {\n enter(node, path) {\n let rootName = node.tag.split('.')[0];\n if (scopeStack.inScope(rootName)) {\n const resolution = emittedLexicalBindings.get(rootName);\n if (resolution?.type === 'component') {\n scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n handleDynamicComponentArguments(node.tag, argumentsAreComponents, extendPath(path, 'attributes'));\n });\n }\n } else {\n const resolution = resolver.resolveElement(node.tag, filename, node.loc);\n emit(path, resolution, (node, newId) => {\n node.tag = newId.original;\n });\n if (resolution?.type === 'component') {\n scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n handleDynamicComponentArguments(node.tag, argumentsAreComponents, extendPath(path, 'attributes'));\n });\n }\n }\n scopeStack.push(node.blockParams);\n },\n exit() {\n scopeStack.pop();\n },\n },\n },\n };\n };\n (resolverTransform as any).parallelBabel = {\n requireFile: __filename,\n buildUsing: 'makeResolverTransform',\n params: Resolver,\n };\n return resolverTransform;\n}\n\ninterface ComponentBlockMarker {\n type: 'componentBlockMarker';\n resolution: ComponentResolution;\n argumentsAreComponents: string[];\n exit: (marker: ComponentBlockMarker) => void;\n}\n\ntype ScopeEntry = { type: 'blockParams'; blockParams: string[] } | ComponentBlockMarker;\n\nclass ScopeStack {\n private stack: ScopeEntry[] = [];\n\n // as we enter a block, we push the block params onto here to mark them as\n // being in scope\n push(blockParams: string[]) {\n this.stack.unshift({ type: 'blockParams', blockParams });\n }\n\n // and when we leave the block they go out of scope. If this block was tagged\n // by a safe component marker, we also clear that.\n pop() {\n this.stack.shift();\n let next = this.stack[0];\n if (next && next.type === 'componentBlockMarker') {\n next.exit(next);\n this.stack.shift();\n }\n }\n\n // right before we enter a block, we might determine that some of the values\n // that will be yielded as marked (by a rule) as safe to be used with the\n // {{component}} helper.\n enteringComponentBlock(resolution: ComponentResolution, exit: ComponentBlockMarker['exit']) {\n this.stack.unshift({\n type: 'componentBlockMarker',\n resolution,\n argumentsAreComponents: resolution.argumentsAreComponents.slice(),\n exit,\n });\n }\n\n inScope(name: string) {\n for (let scope of this.stack) {\n if (scope.type === 'blockParams' && scope.blockParams.includes(name)) {\n return true;\n }\n }\n return false;\n }\n\n safeComponentInScope(name: string): boolean {\n let parts = name.split('.');\n if (parts.length > 2) {\n // we let component rules specify that they yield components or objects\n // containing components. But not deeper than that. So the max path length\n // that can refer to a marked-safe component is two segments.\n return false;\n }\n for (let i = 0; i < this.stack.length - 1; i++) {\n let here = this.stack[i];\n let next = this.stack[i + 1];\n if (here.type === 'blockParams' && next.type === 'componentBlockMarker') {\n let positionalIndex = here.blockParams.indexOf(parts[0]);\n if (positionalIndex === -1) {\n continue;\n }\n\n if (parts.length === 1) {\n if (next.resolution.yieldsComponents[positionalIndex] === true) {\n return true;\n }\n let sourceArg = next.resolution.yieldsArguments[positionalIndex];\n if (typeof sourceArg === 'string') {\n next.argumentsAreComponents.push(sourceArg);\n return true;\n }\n } else {\n let entry = next.resolution.yieldsComponents[positionalIndex];\n if (entry && typeof entry === 'object') {\n return entry[parts[1]] === true;\n }\n\n let argsEntry = next.resolution.yieldsArguments[positionalIndex];\n if (argsEntry && typeof argsEntry === 'object') {\n let sourceArg = argsEntry[parts[1]];\n if (typeof sourceArg === 'string') {\n next.argumentsAreComponents.push(sourceArg);\n return true;\n }\n }\n }\n // we found the source of the name, but there were no rules to cover it.\n // Don't keep searching higher, those are different names.\n return false;\n }\n }\n return false;\n }\n}\n\nfunction handleComponentHelper(\n param: ASTv1.Node,\n resolver: Resolver,\n moduleName: string,\n scopeStack: ScopeStack,\n impliedBecause?: { componentName: string; argumentName: string }\n): ComponentResolution | ResolutionFail | null {\n let locator: ComponentLocator;\n switch (param.type) {\n case 'StringLiteral':\n locator = { type: 'literal', path: param.value };\n break;\n case 'PathExpression':\n locator = { type: 'path', path: param.original };\n break;\n case 'MustacheStatement':\n if (param.hash.pairs.length === 0 && param.params.length === 0) {\n return handleComponentHelper(param.path, resolver, moduleName, scopeStack, impliedBecause);\n } else if (param.path.type === 'PathExpression' && param.path.original === 'component') {\n // safe because we will handle this inner `{{component ...}}` mustache on its own\n return null;\n } else {\n locator = { type: 'other' };\n }\n break;\n case 'TextNode':\n locator = { type: 'literal', path: param.chars };\n break;\n case 'SubExpression':\n if (param.path.type === 'PathExpression' && param.path.original === 'component') {\n // safe because we will handle this inner `(component ...)` subexpression on its own\n return null;\n }\n if (param.path.type === 'PathExpression' && param.path.original === 'ensure-safe-component') {\n // safe because we trust ensure-safe-component\n return null;\n }\n locator = { type: 'other' };\n break;\n default:\n locator = { type: 'other' };\n }\n\n if (locator.type === 'path' && scopeStack.safeComponentInScope(locator.path)) {\n return null;\n }\n\n return resolver.resolveComponentHelper(locator, moduleName, param.loc, impliedBecause);\n}\n\nfunction handleDynamicHelper(param: ASTv1.Expression, resolver: Resolver, moduleName: string): void {\n // We only need to handle StringLiterals since Ember already throws an error if unsupported values\n // are passed to the helper keyword.\n // If a helper reference is passed in we don't need to do anything since it's either the result of a previous\n // helper keyword invocation, or a helper reference that was imported somewhere.\n if (param.type === 'StringLiteral') {\n resolver.resolveDynamicHelper({ type: 'literal', path: param.value }, moduleName, param.loc);\n }\n}\n\nfunction handleDynamicModifier(param: ASTv1.Expression, resolver: Resolver, moduleName: string): void {\n if (param.type === 'StringLiteral') {\n resolver.resolveDynamicModifier({ type: 'literal', path: param.value }, moduleName, param.loc);\n }\n}\n\nfunction extendPath<N extends ASTv1.Node, K extends keyof N>(\n path: WalkerPath<N>,\n key: K\n): N[K] extends ASTv1.Node ? WalkerPath<N[K]> : N[K] extends ASTv1.Node[] ? WalkerPath<N[K][0]>[] : never {\n const _WalkerPath = path.constructor as {\n new <Child extends ASTv1.Node>(\n node: Child,\n parent?: WalkerPath<ASTv1.Node> | null,\n parentKey?: string | null\n ): WalkerPath<Child>;\n };\n let child = path.node[key];\n if (Array.isArray(child)) {\n return child.map(c => new _WalkerPath(c, path, key as string)) as any;\n } else {\n return new _WalkerPath(child as any, path, key as string) as any;\n }\n}\n"]}
1
+ {"version":3,"file":"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,EAAE,QAAa;IAChD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC3B,OAAO,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;KAClC;AACH,CAAC","sourcesContent":["import type { ASTv1, ASTPlugin, ASTPluginBuilder, ASTPluginEnvironment, WalkerPath } from '@glimmer/syntax';\nimport {\n PreprocessedComponentRule,\n preprocessComponentRule,\n ActivePackageRules,\n ComponentRules,\n PackageRules,\n ModuleRules,\n} from './dependency-rules';\nimport { Memoize } from 'typescript-memoize';\nimport type { WithJSUtils } from 'babel-plugin-ember-template-compilation';\nimport assertNever from 'assert-never';\nimport { join, sep } from 'path';\nimport { readJSONSync } from 'fs-extra';\nimport { dasherize, snippetToDasherizedName } from './dasherize-component-name';\nimport { ResolverOptions as CoreResolverOptions, Resolver } from '@embroider/core';\nimport CompatOptions from './options';\nimport { AuditMessage, Loc } from './audit';\nimport { camelCase, mergeWith } from 'lodash';\n\ntype Env = WithJSUtils<ASTPluginEnvironment> & {\n filename: string;\n contents: string;\n strict?: boolean;\n locals?: string[];\n};\n\n// this is a subset of the full Options. We care about serializability, and we\n// only needs parts that are easily serializable, which is why we don't keep the\n// whole thing.\ntype UserConfig = Pick<\n Required<CompatOptions>,\n 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'allowUnsafeDynamicComponents'\n>;\n\nexport interface CompatResolverOptions extends CoreResolverOptions {\n activePackageRules: ActivePackageRules[];\n options: UserConfig;\n}\n\nexport interface Options {\n appRoot: string;\n}\n\nexport const builtInKeywords = [\n '-get-dynamic-var',\n '-in-element',\n '-with-dynamic-vars',\n 'action',\n 'array',\n 'component',\n 'concat',\n 'debugger',\n 'each-in',\n 'each',\n 'fn',\n 'get',\n 'has-block-params',\n 'has-block',\n 'hasBlock',\n 'hasBlockParams',\n 'hash',\n 'helper',\n 'if',\n 'in-element',\n 'input',\n 'let',\n 'link-to',\n 'loc',\n 'log',\n 'modifier',\n 'mount',\n 'mut',\n 'on',\n 'outlet',\n 'partial',\n 'query-params',\n 'readonly',\n 'textarea',\n 'unbound',\n 'unique-id',\n 'unless',\n 'with',\n 'yield',\n];\n\ninterface ComponentResolution {\n type: 'component';\n specifier: string;\n yieldsComponents: Required<ComponentRules>['yieldsSafeComponents'];\n yieldsArguments: Required<ComponentRules>['yieldsArguments'];\n argumentsAreComponents: string[];\n nameHint: string;\n}\n\ntype HelperResolution = {\n type: 'helper';\n nameHint: string;\n specifier: string;\n};\n\ntype ModifierResolution = {\n type: 'modifier';\n specifier: string;\n nameHint: string;\n};\n\ntype ResolutionResult = ComponentResolution | HelperResolution | ModifierResolution;\n\ninterface ResolutionFail {\n type: 'error';\n message: string;\n detail: string;\n loc: Loc;\n}\n\ntype Resolution = ResolutionResult | ResolutionFail;\n\ntype ComponentLocator =\n | {\n type: 'literal';\n path: string;\n }\n | {\n type: 'path';\n path: string;\n }\n | {\n type: 'other';\n };\n\nclass TemplateResolver implements ASTPlugin {\n readonly name = 'embroider-build-time-resolver';\n\n private auditHandler: undefined | ((msg: AuditMessage) => void);\n private scopeStack = new ScopeStack();\n\n private moduleResolver: Resolver;\n\n constructor(private env: Env, private config: CompatResolverOptions) {\n this.moduleResolver = new Resolver(config);\n if ((globalThis as any).embroider_audit) {\n this.auditHandler = (globalThis as any).embroider_audit;\n }\n }\n\n private emit<Target extends WalkerPath<ASTv1.Node>>(\n parentPath: Target,\n resolution: Resolution | null,\n setter: (target: Target['node'], newIdentifier: ASTv1.PathExpression) => void\n ) {\n switch (resolution?.type) {\n case 'error':\n this.reportError(resolution);\n return;\n case 'component':\n case 'modifier':\n case 'helper': {\n let name = this.env.meta.jsutils.bindImport(resolution.specifier, 'default', parentPath, {\n nameHint: resolution.nameHint,\n });\n setter(parentPath.node, this.env.syntax.builders.path(name));\n return;\n }\n case undefined:\n return;\n default:\n assertNever(resolution);\n }\n }\n\n private reportError(dep: ResolutionFail) {\n if (!this.auditHandler && !this.config.options.allowUnsafeDynamicComponents) {\n let e: any = new Error(`${dep.message}: ${dep.detail} in ${this.humanReadableFile(this.env.filename)}`);\n e.isTemplateResolverError = true;\n e.loc = dep.loc;\n e.moduleName = this.env.filename;\n throw e;\n }\n if (this.auditHandler) {\n this.auditHandler({\n message: dep.message,\n filename: this.env.filename,\n detail: dep.detail,\n loc: dep.loc,\n source: this.env.contents,\n });\n }\n }\n\n private humanReadableFile(file: string) {\n let { appRoot } = this.config;\n if (!appRoot.endsWith(sep)) {\n appRoot += sep;\n }\n if (file.startsWith(appRoot)) {\n return file.slice(appRoot.length);\n }\n return file;\n }\n\n private handleComponentHelper(\n param: ASTv1.Node,\n impliedBecause?: { componentName: string; argumentName: string }\n ): ComponentResolution | ResolutionFail | null {\n let locator: ComponentLocator;\n switch (param.type) {\n case 'StringLiteral':\n locator = { type: 'literal', path: param.value };\n break;\n case 'PathExpression':\n locator = { type: 'path', path: param.original };\n break;\n case 'MustacheStatement':\n if (param.hash.pairs.length === 0 && param.params.length === 0) {\n return this.handleComponentHelper(param.path, impliedBecause);\n } else if (param.path.type === 'PathExpression' && param.path.original === 'component') {\n // safe because we will handle this inner `{{component ...}}` mustache on its own\n return null;\n } else {\n locator = { type: 'other' };\n }\n break;\n case 'TextNode':\n locator = { type: 'literal', path: param.chars };\n break;\n case 'SubExpression':\n if (param.path.type === 'PathExpression' && param.path.original === 'component') {\n // safe because we will handle this inner `(component ...)` subexpression on its own\n return null;\n }\n if (param.path.type === 'PathExpression' && param.path.original === 'ensure-safe-component') {\n // safe because we trust ensure-safe-component\n return null;\n }\n locator = { type: 'other' };\n break;\n default:\n locator = { type: 'other' };\n }\n\n if (locator.type === 'path' && this.scopeStack.safeComponentInScope(locator.path)) {\n return null;\n }\n\n return this.targetComponentHelper(locator, param.loc, impliedBecause);\n }\n\n private handleDynamicComponentArguments(\n componentName: string,\n argumentsAreComponents: string[],\n attributes: WalkerPath<ASTv1.AttrNode | ASTv1.HashPair>[]\n ) {\n for (let name of argumentsAreComponents) {\n let attr = attributes.find(attr => {\n if (attr.node.type === 'AttrNode') {\n return attr.node.name === '@' + name;\n } else {\n return attr.node.key === name;\n }\n });\n if (attr) {\n let resolution = this.handleComponentHelper(attr.node.value, {\n componentName,\n argumentName: name,\n });\n this.emit(attr, resolution, (node, newId) => {\n if (node.type === 'AttrNode') {\n node.value = this.env.syntax.builders.mustache(newId);\n } else {\n node.value = newId;\n }\n });\n }\n }\n }\n\n private get staticComponentsEnabled(): boolean {\n return this.config.options.staticComponents || Boolean(this.auditHandler);\n }\n\n private get staticHelpersEnabled(): boolean {\n return this.config.options.staticHelpers || Boolean(this.auditHandler);\n }\n\n private get staticModifiersEnabled(): boolean {\n return this.config.options.staticModifiers || Boolean(this.auditHandler);\n }\n\n private isIgnoredComponent(dasherizedName: string) {\n return this.rules.components.get(dasherizedName)?.safeToIgnore;\n }\n\n @Memoize()\n private get rules() {\n // rules that are keyed by the filename they're talking about\n let files: Map<string, PreprocessedComponentRule> = new Map();\n\n // rules that are keyed by our dasherized interpretation of the component's name\n let components: Map<string, PreprocessedComponentRule> = new Map();\n\n // we're not responsible for filtering out rules for inactive packages here,\n // that is done before getting to us. So we should assume these are all in\n // force.\n for (let rule of this.config.activePackageRules) {\n if (rule.components) {\n for (let [snippet, rules] of Object.entries(rule.components)) {\n let processedRules = preprocessComponentRule(rules);\n let dasherizedName = this.standardDasherize(snippet, rule);\n components.set(dasherizedName, processedRules);\n }\n }\n if (rule.appTemplates) {\n for (let [path, templateRules] of Object.entries(rule.appTemplates)) {\n let processedRules = preprocessComponentRule(templateRules);\n files.set(join(this.config.appRoot, path), processedRules);\n }\n }\n if (rule.addonTemplates) {\n for (let [path, templateRules] of Object.entries(rule.addonTemplates)) {\n let processedRules = preprocessComponentRule(templateRules);\n for (let root of rule.roots) {\n files.set(join(root, path), processedRules);\n }\n }\n }\n }\n return { files, components };\n }\n\n private findRules(absPath: string): PreprocessedComponentRule | undefined {\n let fileRules = this.rules.files.get(absPath);\n let componentRules: PreprocessedComponentRule | undefined;\n\n let componentName = this.moduleResolver.reverseComponentLookup(absPath);\n if (componentName) {\n componentRules = this.rules.components.get(componentName);\n }\n\n if (fileRules && componentRules) {\n return mergeWith(fileRules, componentRules, appendArrays);\n }\n\n return fileRules ?? componentRules;\n }\n\n private standardDasherize(snippet: string, rule: PackageRules | ModuleRules): string {\n let name = snippetToDasherizedName(snippet);\n if (name == null) {\n throw new Error(`unable to parse component snippet \"${snippet}\" from rule ${JSON.stringify(rule, null, 2)}`);\n }\n return name;\n }\n\n private targetComponent(name: string): ComponentResolution | null {\n if (!this.staticComponentsEnabled) {\n return null;\n }\n\n if (builtInKeywords.includes(name)) {\n return null;\n }\n if (this.isIgnoredComponent(name)) {\n return null;\n }\n\n let componentRules = this.rules.components.get(name);\n return {\n type: 'component',\n specifier: `#embroider_compat/components/${name}`,\n yieldsComponents: componentRules ? componentRules.yieldsSafeComponents : [],\n yieldsArguments: componentRules ? componentRules.yieldsArguments : [],\n argumentsAreComponents: componentRules ? componentRules.argumentsAreComponents : [],\n nameHint: this.nameHint(name),\n };\n }\n\n private targetComponentHelper(\n component: ComponentLocator,\n loc: Loc,\n impliedBecause?: { componentName: string; argumentName: string }\n ): ComponentResolution | ResolutionFail | null {\n if (!this.staticComponentsEnabled) {\n return null;\n }\n\n let message;\n if (impliedBecause) {\n message = `argument \"${impliedBecause.argumentName}\" to component \"${impliedBecause.componentName}\" is treated as a component, but the value you're passing is dynamic`;\n } else {\n message = `Unsafe dynamic component`;\n }\n\n if (component.type === 'other') {\n return {\n type: 'error',\n message,\n detail: `cannot statically analyze this expression`,\n loc,\n };\n }\n if (component.type === 'path') {\n let ownComponentRules = this.findRules(this.env.filename);\n if (ownComponentRules && ownComponentRules.safeInteriorPaths.includes(component.path)) {\n return null;\n }\n return {\n type: 'error',\n message,\n detail: component.path,\n loc,\n };\n }\n\n return this.targetComponent(component.path);\n }\n\n private targetHelper(path: string): HelperResolution | null {\n if (!this.staticHelpersEnabled) {\n return null;\n }\n\n // people are not allowed to override the built-in helpers with their own\n // globally-named helpers. It throws an error. So it's fine for us to\n // prioritize the builtIns here without bothering to resolve a user helper\n // of the same name.\n if (builtInKeywords.includes(path)) {\n return null;\n }\n\n return {\n type: 'helper',\n specifier: `#embroider_compat/helpers/${path}`,\n nameHint: this.nameHint(path),\n };\n }\n\n private targetHelperOrComponent(\n path: string,\n loc: Loc,\n hasArgs: boolean\n ): ComponentResolution | HelperResolution | null {\n /*\n\n In earlier embroider versions we would do a bunch of module resolution right\n here inside the ast transform to try to resolve the ambiguity of this case\n and if we didn't find anything, leave the template unchanged. But that leads\n to both a lot of extra build-time expense (since we are attempting\n resolution for lots of things that may in fact be just some data and not a\n component invocation at all, and also since we are pre-resolving modules\n that will get resolved a second time by the final stage packager).\n\n Now, we're going to be less forgiving, because it streamlines the build for\n everyone who's not still using these *extremely* old patterns.\n\n The problematic case is:\n\n 1. In a non-strict template (because this whole resolver-transform.ts is a\n no-op on strict handlebars).\n\n 2. Have a mustache statement like: `{{something}}`, where `something` is:\n\n a. Not a variable in scope (for example, there's no preceeding line \n like `<Parent as |something|>`)\n b. Does not start with `@` because that must be an argument from outside this template.\n c. Does not contain a dot, like `some.thing` (because that case is classically \n never a global component resolution that we would need to handle)\n d. Does not start with `this` (this rule is mostly redundant with the previous rule, \n but even a standalone `this` is never a component invocation).\n e. Does not have any arguments. If there are argument like `{{something a=b}}`, \n there is still ambiguity between helper vs component, but there is no longer \n the possibility that this was just rendering some data.\n f. Does not take a block, like `{{#something}}{{/something}}` (because that is \n always a component, no ambiguity.)\n\n We can't tell if this problematic case is really:\n\n 1. A helper invocation with no arguments that is being directly rendered.\n Out-of-the-box, ember already generates [a lint\n error](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-curly-component-invocation.md)\n for this, although it tells you to whitelist your helper when IMO it\n should tell you to use an unambiguous syntax like `{{ (something) }}`\n instead.\n\n 2. A component invocation, which you could have written `<Something />`\n instead. Angle-bracket invocation has been available and easy-to-adopt\n for a very long time. \n\n 3. Property-this-fallback for `{{this.something}}`. Property-this-fallback\n is eliminated at Ember 4.0, so people have been heavily pushed to get\n it out of their addons.\n */\n\n // first, bail out on all the stuff we can obviously ignore\n if (\n (!this.staticHelpersEnabled && !this.staticComponentsEnabled) ||\n builtInKeywords.includes(path) ||\n this.isIgnoredComponent(path)\n ) {\n return null;\n }\n\n let ownComponentRules = this.findRules(this.env.filename);\n if (ownComponentRules?.disambiguate[path]) {\n switch (ownComponentRules.disambiguate[path]) {\n case 'component':\n return this.targetComponent(path);\n case 'helper':\n return this.targetHelper(path);\n case 'data':\n return null;\n }\n }\n\n if (!hasArgs && !path.includes('/') && !path.includes('@')) {\n // this is the case that could also be property-this-fallback. We're going\n // to force people to disambiguate, because letting a potential component\n // or helper invocation lurk inside every bit of data you render is not\n // ok.\n this.reportError({\n type: 'error',\n message: 'unsupported ambiguous syntax',\n detail: `\"{{${path}}}\" is ambiguous and could mean \"{{this.${path}}}\" or component \"<${capitalize(\n camelCase(path)\n )} />\" or helper \"{{ (${path}) }}\". Change it to one of those unambigous forms, or use a \"disambiguate\" packageRule to work around the problem if its in third-party code you cannot easily fix.`,\n loc,\n });\n return null;\n }\n\n // Above we already bailed out if both of these were disabled, so we know at\n // least one is turned on. If both aren't turned on, we're stuck, because we\n // can't even tell if this *is* a component vs a helper.\n if (!this.staticHelpersEnabled || !this.staticComponentsEnabled) {\n this.reportError({\n type: 'error',\n message: 'unsupported ambiguity between helper and component',\n detail: `this use of \"{{${path}}}\" could be helper \"{{ (${path}) }}\" or component \"<${capitalize(\n camelCase(path)\n )} />\", and your settings for staticHelpers and staticComponents do not agree. Either switch to one of the unambiguous forms, or make staticHelpers and staticComponents agree, or use a \"disambiguate\" packageRule to work around the problem if its in third-party code you cannot easily fix.`,\n loc,\n });\n return null;\n }\n\n let componentRules = this.rules.components.get(path);\n return {\n type: 'component',\n specifier: `#embroider_compat/ambiguous/${path}`,\n yieldsComponents: componentRules ? componentRules.yieldsSafeComponents : [],\n yieldsArguments: componentRules ? componentRules.yieldsArguments : [],\n argumentsAreComponents: componentRules ? componentRules.argumentsAreComponents : [],\n nameHint: this.nameHint(path),\n };\n }\n\n private targetElementModifier(path: string): ModifierResolution | null {\n if (!this.staticModifiersEnabled) {\n return null;\n }\n if (builtInKeywords.includes(path)) {\n return null;\n }\n\n return {\n type: 'modifier',\n specifier: `#embroider_compat/modifiers/${path}`,\n nameHint: this.nameHint(path),\n };\n }\n\n targetDynamicModifier(modifier: ComponentLocator, loc: Loc): ModifierResolution | ResolutionFail | null {\n if (!this.staticModifiersEnabled) {\n return null;\n }\n\n if (modifier.type === 'literal') {\n return this.targetElementModifier(modifier.path);\n } else {\n return {\n type: 'error',\n message: 'Unsafe dynamic modifier',\n detail: `cannot statically analyze this expression`,\n loc,\n };\n }\n }\n\n private targetDynamicHelper(helper: ComponentLocator): HelperResolution | null {\n if (!this.staticHelpersEnabled) {\n return null;\n }\n\n if (helper.type === 'literal') {\n return this.targetHelper(helper.path);\n }\n\n // we don't have to manage any errors in this case because ember itself\n // considers it an error to pass anything but a string literal to the\n // `helper` helper.\n return null;\n }\n\n private nameHint(path: string) {\n let parts = path.split('@');\n\n // the extra underscore here guarantees that we will never collide with an\n // HTML element.\n return parts[parts.length - 1] + '_';\n }\n\n private handleDynamicModifier(param: ASTv1.Expression): ModifierResolution | ResolutionFail | null {\n if (param.type === 'StringLiteral') {\n return this.targetDynamicModifier({ type: 'literal', path: param.value }, param.loc);\n }\n // we don't have to manage any errors in this case because ember itself\n // considers it an error to pass anything but a string literal to the\n // modifier helper.\n return null;\n }\n\n private handleDynamicHelper(param: ASTv1.Expression): HelperResolution | ResolutionFail | null {\n // We only need to handle StringLiterals since Ember already throws an error if unsupported values\n // are passed to the helper keyword.\n // If a helper reference is passed in we don't need to do anything since it's either the result of a previous\n // helper keyword invocation, or a helper reference that was imported somewhere.\n if (param.type === 'StringLiteral') {\n return this.targetDynamicHelper({ type: 'literal', path: param.value });\n }\n return null;\n }\n\n visitor: ASTPlugin['visitor'] = {\n Template: {\n enter: () => {\n if (this.env.locals) {\n this.scopeStack.pushMustacheBlock(this.env.locals);\n }\n },\n exit: () => {\n if (this.env.locals) {\n this.scopeStack.pop();\n }\n },\n },\n Block: {\n enter: node => {\n this.scopeStack.pushMustacheBlock(node.blockParams);\n },\n exit: () => {\n this.scopeStack.pop();\n },\n },\n BlockStatement: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n let rootName = node.path.parts[0];\n if (this.scopeStack.inScope(rootName, path)) {\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (node.path.parts.length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components, which means there's nothing to resolve at this\n // location.\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n let resolution = this.handleComponentHelper(node.params[0]);\n this.emit(path, resolution, (node, newIdentifier) => {\n node.params[0] = newIdentifier;\n });\n return;\n }\n let resolution = this.targetComponent(node.path.original);\n this.emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n if (resolution?.type === 'component') {\n this.scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n this.handleDynamicComponentArguments(\n rootName,\n argumentsAreComponents,\n extendPath(extendPath(path, 'hash'), 'pairs')\n );\n });\n }\n },\n SubExpression: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (this.scopeStack.inScope(node.path.parts[0], path)) {\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n let resolution = this.handleComponentHelper(node.params[0]);\n this.emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.original === 'helper' && node.params.length > 0) {\n let resolution = this.handleDynamicHelper(node.params[0]);\n this.emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.original === 'modifier' && node.params.length > 0) {\n let resolution = this.handleDynamicModifier(node.params[0]);\n this.emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n let resolution = this.targetHelper(node.path.original);\n this.emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n },\n MustacheStatement: {\n enter: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n let rootName = node.path.parts[0];\n if (this.scopeStack.inScope(rootName, path)) {\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (node.path.parts.length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components, which means there's nothing to resolve at this\n // location.\n return;\n }\n if (node.path.original.startsWith('@')) {\n // similarly, global resolution of helpers and components never\n // happens with argument paths (it could still be an invocation, but\n // it would be a lexically-scoped invocation, not one we need to\n // adjust)\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n let resolution = this.handleComponentHelper(node.params[0]);\n this.emit(path, resolution, (node, newId) => {\n node.params[0] = newId;\n });\n return;\n }\n if (node.path.original === 'helper' && node.params.length > 0) {\n let resolution = this.handleDynamicHelper(node.params[0]);\n this.emit(path, resolution, (node, newIdentifier) => {\n node.params[0] = newIdentifier;\n });\n return;\n }\n if (path.parent?.node.type === 'AttrNode') {\n // this mustache is the value of an attribute. Components aren't\n // allowed here, so we're not ambiguous, so resolve a helper.\n let resolution = this.targetHelper(node.path.original);\n this.emit(path, resolution, (node, newIdentifier) => {\n node.path = newIdentifier;\n });\n return;\n }\n let hasArgs = node.params.length > 0 || node.hash.pairs.length > 0;\n let resolution = this.targetHelperOrComponent(node.path.original, node.path.loc, hasArgs);\n this.emit(path, resolution, (node, newIdentifier) => {\n node.path = newIdentifier;\n });\n if (resolution?.type === 'component') {\n this.handleDynamicComponentArguments(\n node.path.original,\n resolution.argumentsAreComponents,\n extendPath(extendPath(path, 'hash'), 'pairs')\n );\n }\n },\n },\n ElementModifierStatement: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (this.scopeStack.inScope(node.path.parts[0], path)) {\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (node.path.data === true) {\n return;\n }\n if (node.path.parts.length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components. With the introduction of `Template strict mode` in Ember 3.25\n // it is also possible to pass modifiers this way which means there's nothing\n // to resolve at this location.\n return;\n }\n\n let resolution = this.targetElementModifier(node.path.original);\n this.emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n },\n ElementNode: {\n enter: (node, path) => {\n let rootName = node.tag.split('.')[0];\n if (!this.scopeStack.inScope(rootName, path)) {\n let resolution: ComponentResolution | null = null;\n\n // if it starts with lower case, it can't be a component we need to\n // globally resolve\n if (node.tag[0] !== node.tag[0].toLowerCase()) {\n resolution = this.targetComponent(dasherize(node.tag));\n }\n\n this.emit(path, resolution, (node, newId) => {\n node.tag = newId.original;\n });\n if (resolution?.type === 'component') {\n this.scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n this.handleDynamicComponentArguments(node.tag, argumentsAreComponents, extendPath(path, 'attributes'));\n });\n }\n }\n this.scopeStack.pushElementBlock(node.blockParams, node);\n },\n exit: () => {\n this.scopeStack.pop();\n },\n },\n };\n}\n\n// This is the AST transform that resolves components, helpers and modifiers at build time\nexport default function makeResolverTransform({ appRoot }: Options) {\n let config: CompatResolverOptions = readJSONSync(join(appRoot, '.embroider', 'resolver.json'));\n const resolverTransform: ASTPluginBuilder<Env> = env => {\n if (env.strict) {\n return {\n name: 'embroider-build-time-resolver-strict-noop',\n visitor: {},\n };\n }\n return new TemplateResolver(env, config);\n };\n (resolverTransform as any).parallelBabel = {\n requireFile: __filename,\n buildUsing: 'makeResolverTransform',\n params: { appRoot: appRoot },\n };\n return resolverTransform;\n}\n\ninterface ComponentBlockMarker {\n type: 'componentBlockMarker';\n resolution: ComponentResolution;\n argumentsAreComponents: string[];\n exit: (marker: ComponentBlockMarker) => void;\n}\n\ntype ScopeEntry =\n | { type: 'mustache'; blockParams: string[] }\n | { type: 'element'; blockParams: string[]; childrenOf: ASTv1.ElementNode }\n | ComponentBlockMarker;\n\nclass ScopeStack {\n private stack: ScopeEntry[] = [];\n\n // mustache blocks like:\n //\n // {{#stuff as |some block vars|}}\n //\n // are relatively simple for us because there's a dedicated `Block` AST node\n // that exactly covers the range in which the variables are in scope.\n pushMustacheBlock(blockParams: string[]) {\n this.stack.unshift({ type: 'mustache', blockParams });\n }\n\n // element blocks like:\n //\n // <Stuff as |some block vars|>\n //\n // are *not* so simple for us because there's no single AST node that exactly\n // covers the range in which the variables are in scope. For example, the\n // *attributes* of the element do not see the variables, but the children of\n // the element do.\n pushElementBlock(blockParams: string[], childrenOf: ASTv1.ElementNode) {\n this.stack.unshift({ type: 'element', blockParams, childrenOf });\n }\n\n // and when we leave the block they go out of scope. If this block was tagged\n // by a safe component marker, we also clear that.\n pop() {\n this.stack.shift();\n let next = this.stack[0];\n if (next && next.type === 'componentBlockMarker') {\n next.exit(next);\n this.stack.shift();\n }\n }\n\n // right before we enter a block, we might determine that some of the values\n // that will be yielded as marked (by a rule) as safe to be used with the\n // {{component}} helper.\n enteringComponentBlock(resolution: ComponentResolution, exit: ComponentBlockMarker['exit']) {\n this.stack.unshift({\n type: 'componentBlockMarker',\n resolution,\n argumentsAreComponents: resolution.argumentsAreComponents.slice(),\n exit,\n });\n }\n\n inScope(name: string, fromPath: WalkerPath<ASTv1.Node>) {\n for (let scope of this.stack) {\n if (scope.type === 'mustache' && scope.blockParams.includes(name)) {\n return true;\n }\n if (\n scope.type === 'element' &&\n scope.blockParams.includes(name) &&\n withinElementBlock(fromPath, scope.childrenOf)\n ) {\n return true;\n }\n }\n return false;\n }\n\n safeComponentInScope(name: string): boolean {\n let parts = name.split('.');\n if (parts.length > 2) {\n // we let component rules specify that they yield components or objects\n // containing components. But not deeper than that. So the max path length\n // that can refer to a marked-safe component is two segments.\n return false;\n }\n for (let i = 0; i < this.stack.length - 1; i++) {\n let here = this.stack[i];\n let next = this.stack[i + 1];\n if ((here.type === 'mustache' || here.type === 'element') && next.type === 'componentBlockMarker') {\n let positionalIndex = here.blockParams.indexOf(parts[0]);\n if (positionalIndex === -1) {\n continue;\n }\n\n if (parts.length === 1) {\n if (next.resolution.yieldsComponents[positionalIndex] === true) {\n return true;\n }\n let sourceArg = next.resolution.yieldsArguments[positionalIndex];\n if (typeof sourceArg === 'string') {\n next.argumentsAreComponents.push(sourceArg);\n return true;\n }\n } else {\n let entry = next.resolution.yieldsComponents[positionalIndex];\n if (entry && typeof entry === 'object') {\n return entry[parts[1]] === true;\n }\n\n let argsEntry = next.resolution.yieldsArguments[positionalIndex];\n if (argsEntry && typeof argsEntry === 'object') {\n let sourceArg = argsEntry[parts[1]];\n if (typeof sourceArg === 'string') {\n next.argumentsAreComponents.push(sourceArg);\n return true;\n }\n }\n }\n // we found the source of the name, but there were no rules to cover it.\n // Don't keep searching higher, those are different names.\n return false;\n }\n }\n return false;\n }\n}\n\nfunction extendPath<N extends ASTv1.Node, K extends keyof N>(\n path: WalkerPath<N>,\n key: K\n): N[K] extends ASTv1.Node ? WalkerPath<N[K]> : N[K] extends ASTv1.Node[] ? WalkerPath<N[K][0]>[] : never {\n const _WalkerPath = path.constructor as {\n new <Child extends ASTv1.Node>(\n node: Child,\n parent?: WalkerPath<ASTv1.Node> | null,\n parentKey?: string | null\n ): WalkerPath<Child>;\n };\n let child = path.node[key];\n if (Array.isArray(child)) {\n return child.map(c => new _WalkerPath(c, path, key as string)) as any;\n } else {\n return new _WalkerPath(child as any, path, key as string) as any;\n }\n}\n\nfunction capitalize(word: string): string {\n return word[0].toUpperCase() + word.slice(1);\n}\n\n// ElementNodes have both children and attributes and both of those are\n// \"children\" in the abstract syntax tree sense, but here we want to distinguish\n// between them.\nfunction withinElementBlock(childPath: WalkerPath<ASTv1.Node>, ancestorNode: ASTv1.ElementNode): Boolean {\n let cursor: WalkerPath<ASTv1.Node> | null = childPath;\n while (cursor && cursor.node !== ancestorNode) {\n if (ancestorNode.children.includes(cursor.node as ASTv1.Statement)) {\n return true;\n }\n cursor = cursor.parent;\n }\n return false;\n}\nfunction appendArrays(objValue: any, srcValue: any) {\n if (Array.isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n}\n"]}
package/src/v1-app.js CHANGED
@@ -238,13 +238,27 @@ class V1App {
238
238
  return config;
239
239
  }
240
240
  babelMajorVersion() {
241
+ var _a, _b;
241
242
  let babelAddon = this.app.project.addons.find((a) => a.name === 'ember-cli-babel');
242
243
  if (babelAddon) {
243
- let major = Number(babelAddon.pkg.version.split('.')[0]);
244
- if (major !== 7) {
245
- throw new Error(`@embroider/compat only supports v1 addons that use babel 7`);
244
+ let babelAddonMajor = Number(babelAddon.pkg.version.split('.')[0]);
245
+ let babelMajor = babelAddonMajor;
246
+ if (babelAddonMajor >= 8) {
247
+ // `ember-cli-babel` v8 breaks lockstep with Babel, because it now
248
+ // defines `@babel/core` as a peer dependency, so we need to check the
249
+ // project's version of `@babel/core`:
250
+ let babelVersion = (_a = this.app.project.pkg.devDependencies) === null || _a === void 0 ? void 0 : _a['@babel/core'];
251
+ if (babelVersion) {
252
+ babelMajor = (_b = semver_1.default.coerce(babelVersion)) === null || _b === void 0 ? void 0 : _b.major;
253
+ }
254
+ else {
255
+ babelMajor = 7;
256
+ }
257
+ }
258
+ if (babelMajor !== 7) {
259
+ throw new Error('`@embroider/compat` only supports apps and addons that use Babel v7.');
246
260
  }
247
- return major;
261
+ return babelMajor;
248
262
  }
249
263
  // if we didn't have our own babel plugin at all, it's safe to parse our
250
264
  // code with 7.
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,+BAAsD;AACtD,sEAA0C;AAC1C,gFAA8C;AAC9C,qDAA6C;AAC7C,sDAA8B;AAE9B,2CAAsD;AACtD,6CAA6D;AAS7D,uCAA2G;AAC3G,gEAAsC;AACtC,iEAA4D;AAE5D,qDAAmF;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AC,IAAI,EAAE,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, sep } 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 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\nimport type { Transform } from 'babel-plugin-ember-template-compilation';\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 ...this.app.options['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 + sep);\n }\n }\n throw new Error(`bug: expected ember-cli to already have a resolved path for asset ${filename}`);\n }\n }\n\n private combinedVendor(addonTrees: 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(): Transform[] {\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 // classically, this list was backwards for silly historic reasons. But\n // we're the compatibility system, so we're putting it back into\n // reasonable order.\n options.plugins.ast.reverse();\n\n return options.plugins.ast;\n } else {\n return [];\n }\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(\n new SynthesizeTemplateOnlyComponents(appTree, { allowedPaths: ['components'], templateExtensions: ['.hbs'] })\n );\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) && rootURL) || (!rootURL && !src.startsWith('/'))) {\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,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'typescript-memoize';\nimport { sync as pkgUpSync } from 'pkg-up';\nimport { join, dirname, isAbsolute, sep } from 'path';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport { WatchedDir } from 'broccoli-source';\nimport resolve from 'resolve';\nimport { Node } from 'broccoli-node-api';\nimport { V1Config, WriteV1Config } from './v1-config';\nimport { WriteV1AppBoot, ReadV1AppBoot } from './v1-appboot';\nimport {\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\nimport type { Transform } from 'babel-plugin-ember-template-compilation';\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 ...this.app.options['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 babelAddonMajor = Number(babelAddon.pkg.version.split('.')[0]);\n let babelMajor: number | undefined = babelAddonMajor;\n if (babelAddonMajor >= 8) {\n // `ember-cli-babel` v8 breaks lockstep with Babel, because it now\n // defines `@babel/core` as a peer dependency, so we need to check the\n // project's version of `@babel/core`:\n let babelVersion = this.app.project.pkg.devDependencies?.['@babel/core'];\n if (babelVersion) {\n babelMajor = semver.coerce(babelVersion)?.major;\n } else {\n babelMajor = 7;\n }\n }\n if (babelMajor !== 7) {\n throw new Error('`@embroider/compat` only supports apps and addons that use Babel v7.');\n }\n return babelMajor;\n }\n // if we didn't have our own babel plugin at all, it's safe to parse our\n // code with 7.\n return 7;\n }\n\n @Memoize()\n private transformedNodeFiles(): Map<string, string> {\n // any app.imports from node_modules that need custom transforms will need\n // to get copied into our own synthesized vendor package. app.imports from\n // node_modules that *don't* need custom transforms can just stay where they\n // are.\n let transformed = new Map();\n for (let transformConfig of this.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 + sep);\n }\n }\n throw new Error(`bug: expected ember-cli to already have a resolved path for asset ${filename}`);\n }\n }\n\n private combinedVendor(addonTrees: 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(): Transform[] {\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 // classically, this list was backwards for silly historic reasons. But\n // we're the compatibility system, so we're putting it back into\n // reasonable order.\n options.plugins.ast.reverse();\n\n return options.plugins.ast;\n } else {\n return [];\n }\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(\n new SynthesizeTemplateOnlyComponents(appTree, { allowedPaths: ['components'], templateExtensions: ['.hbs'] })\n );\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) && rootURL) || (!rootURL && !src.startsWith('/'))) {\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,8 +0,0 @@
1
- /// <reference types="node" />
2
- import { Writable } from 'stream';
3
- export declare class CaptureStream extends Writable {
4
- private gather;
5
- _write(chunk: string | Buffer, _encoding: string, callback: (err?: any) => void): void;
6
- log(msg: string, ...args: any[]): void;
7
- get output(): string;
8
- }
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CaptureStream = void 0;
13
- const bind_decorator_1 = __importDefault(require("bind-decorator"));
14
- const stream_1 = require("stream");
15
- const util_1 = require("util");
16
- class CaptureStream extends stream_1.Writable {
17
- constructor() {
18
- super(...arguments);
19
- this.gather = [];
20
- }
21
- _write(chunk, _encoding, callback) {
22
- this.gather.push(chunk);
23
- callback();
24
- }
25
- log(msg, ...args) {
26
- this.gather.push((0, util_1.format)(msg, ...args));
27
- }
28
- get output() {
29
- return this.gather
30
- .map(element => {
31
- if (typeof element === 'string') {
32
- return element;
33
- }
34
- else {
35
- return element.toString('utf8');
36
- }
37
- })
38
- .join('');
39
- }
40
- }
41
- __decorate([
42
- bind_decorator_1.default
43
- ], CaptureStream.prototype, "log", null);
44
- exports.CaptureStream = CaptureStream;
45
- //# sourceMappingURL=capture.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"capture.js","sourceRoot":"","sources":["capture.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oEAAkC;AAClC,mCAAkC;AAClC,+BAA8B;AAE9B,MAAa,aAAc,SAAQ,iBAAQ;IAA3C;;QACU,WAAM,GAAG,EAAyB,CAAC;IAsB7C,CAAC;IArBC,MAAM,CAAC,KAAsB,EAAE,SAAiB,EAAE,QAA6B;QAC7E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,QAAQ,EAAE,CAAC;IACb,CAAC;IAGD,GAAG,CAAC,GAAW,EAAE,GAAG,IAAW;QAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAA,aAAM,EAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM;aACf,GAAG,CAAC,OAAO,CAAC,EAAE;YACb,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;gBAC/B,OAAO,OAAO,CAAC;aAChB;iBAAM;gBACL,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;aACjC;QACH,CAAC,CAAC;aACD,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;CACF;AAfC;IADC,wBAAI;wCAGJ;AAVH,sCAuBC","sourcesContent":["import bind from 'bind-decorator';\nimport { Writable } from 'stream';\nimport { format } from 'util';\n\nexport class CaptureStream extends Writable {\n private gather = [] as (string | Buffer)[];\n _write(chunk: string | Buffer, _encoding: string, callback: (err?: any) => void) {\n this.gather.push(chunk);\n callback();\n }\n\n @bind\n log(msg: string, ...args: any[]) {\n this.gather.push(format(msg, ...args));\n }\n\n get output(): string {\n return this.gather\n .map(element => {\n if (typeof element === 'string') {\n return element;\n } else {\n return element.toString('utf8');\n }\n })\n .join('');\n }\n}\n"]}