@embroider/compat 3.5.7-unstable.d9fc688 → 3.5.7-unstable.eb93cd5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -6
- package/src/compat-app-builder.js +7 -0
- package/src/compat-app-builder.js.map +1 -1
- package/src/compat-app.js +1 -0
- package/src/compat-app.js.map +1 -1
- package/src/dependency-rules.js +17 -10
- package/src/dependency-rules.js.map +1 -1
- package/src/resolver-transform.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embroider/compat",
|
|
3
|
-
"version": "3.5.7-unstable.
|
|
3
|
+
"version": "3.5.7-unstable.eb93cd5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Backward compatibility layer for the Embroider build system.",
|
|
6
6
|
"repository": {
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"lodash": "^4.17.21",
|
|
54
54
|
"pkg-up": "^3.1.0",
|
|
55
55
|
"resolve": "^1.20.0",
|
|
56
|
+
"resolve.exports": "^2.0.2",
|
|
56
57
|
"resolve-package-path": "^4.0.1",
|
|
57
58
|
"semver": "^7.3.5",
|
|
58
59
|
"symlink-or-copy": "^1.3.1",
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"typescript-memoize": "^1.0.1",
|
|
61
62
|
"walk-sync": "^3.0.0",
|
|
62
63
|
"yargs": "^17.0.1",
|
|
63
|
-
"@embroider/macros": "1.16.6-unstable.
|
|
64
|
+
"@embroider/macros": "1.16.6-unstable.eb93cd5"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
67
|
"@glimmer/syntax": "^0.84.3",
|
|
@@ -83,12 +84,12 @@
|
|
|
83
84
|
"ember-engines": "^0.8.19",
|
|
84
85
|
"scenario-tester": "^3.0.1",
|
|
85
86
|
"typescript": "^5.4.5",
|
|
86
|
-
"@embroider/core": "^3.4.15-unstable.
|
|
87
|
-
"@embroider/
|
|
88
|
-
"@embroider/
|
|
87
|
+
"@embroider/core": "^3.4.15-unstable.eb93cd5",
|
|
88
|
+
"@embroider/sample-transforms": "0.0.0",
|
|
89
|
+
"@embroider/test-support": "0.36.0"
|
|
89
90
|
},
|
|
90
91
|
"peerDependencies": {
|
|
91
|
-
"@embroider/core": "^3.4.15-unstable.
|
|
92
|
+
"@embroider/core": "^3.4.15-unstable.eb93cd5"
|
|
92
93
|
},
|
|
93
94
|
"engines": {
|
|
94
95
|
"node": "12.* || 14.* || >= 16"
|
|
@@ -420,6 +420,13 @@ class CompatAppBuilder {
|
|
|
420
420
|
};
|
|
421
421
|
if (((_b = (_a = this.origAppPackage.packageJSON['ember-addon']) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : 0) < 2) {
|
|
422
422
|
meta['auto-upgraded'] = true;
|
|
423
|
+
// our rewriting keeps app in app directory, etc.
|
|
424
|
+
pkgLayers.push({
|
|
425
|
+
exports: {
|
|
426
|
+
'./*': './app/*',
|
|
427
|
+
'./tests/*': './tests/*',
|
|
428
|
+
},
|
|
429
|
+
});
|
|
423
430
|
}
|
|
424
431
|
pkgLayers.push({ 'ember-addon': meta });
|
|
425
432
|
return combinePackageJSON(...pkgLayers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat-app-builder.js","sourceRoot":"","sources":["compat-app-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,0CAUyB;AACzB,+BAA8C;AAI9C,yDAAwD;AACxD,6DAAqC;AACrC,iEAAyC;AACzC,iEAAyC;AACzC,oEAAkC;AAClC,uCAA2G;AAI3G,qFAAyE;AACzE,6DAAyD;AAEzD,2DAAsE;AACtE,2DAA6C;AAC7C,+BAAqC;AACrC,sDAA8B;AAI9B,uCAAuD;AAEvD,qDAA0D;AAC1D,gFAAgD;AAGhD,yCAAqC;AAErC,8EAA8E;AAC9E,uDAAuD;AAEvD,MAAa,gBAAgB;IAC3B,YACU,IAAY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CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAA,mBAAS,EAAC,EAAE,EAAE,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,iBAAiB,CAAC,WAA6B;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzE,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,CAAC,6BAAsB,CAAC,GAAG,gCAAyB,CAAC;QAE5D,KAAK,MAAM,MAAM,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACzC,IAAI,oBAA4B,CAAC;YACjC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;gBAC3D,oBAAoB,GAAG,MAAM,CAAC,CAAC,CAAW,CAAC;YAC7C,CAAC;iBAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACtC,oBAAoB,GAAG,MAAM,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,iEAAiE,MAAM,EAAE,CAAC,CAAC;YAC7F,CAAC;YAED,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAA,iCAAsB,EAAC,oBAAoB,CAAC,CAAC;QAC/E,CAAC;QAED,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;YACvB,6BAAsB;YACtB;gBACE,OAAO;aACR;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import type { Node as BroccoliNode } from 'broccoli-node-api';\nimport type { OutputPaths, AddonPackage, Engine, AppMeta, TemplateColocationPluginOptions } from '@embroider/core';\nimport {\n explicitRelative,\n extensionsPattern,\n warn,\n jsHandlebarsCompile,\n templateColocationPluginPath,\n cacheBustingPluginVersion,\n cacheBustingPluginPath,\n Resolver,\n locateEmbroiderWorkingDir,\n} from '@embroider/core';\nimport { resolve as resolvePath } from 'path';\nimport type Options from './options';\nimport type { CompatResolverOptions } from './resolver-transform';\nimport type { PackageRules } from './dependency-rules';\nimport { activePackageRules } from './dependency-rules';\nimport flatMap from 'lodash/flatMap';\nimport mergeWith from 'lodash/mergeWith';\nimport cloneDeep from 'lodash/cloneDeep';\nimport bind from 'bind-decorator';\nimport { outputJSONSync, readFileSync, readJSONSync, rmSync, writeFileSync, realpathSync } from 'fs-extra';\nimport type { Options as EtcOptions } from 'babel-plugin-ember-template-compilation';\nimport type { Options as ResolverTransformOptions } from './resolver-transform';\nimport type { Options as AdjustImportsOptions } from './babel-plugin-adjust-imports';\nimport { makePortable } from '@embroider/core/src/portable-babel-config';\nimport { AppFiles } from '@embroider/core/src/app-files';\nimport type { PortableHint } from '@embroider/core/src/portable';\nimport { maybeNodeModuleVersion } from '@embroider/core/src/portable';\nimport { Memoize } from 'typescript-memoize';\nimport { join, dirname } from 'path';\nimport resolve from 'resolve';\nimport type ContentForConfig from './content-for-config';\nimport type { V1Config } from './v1-config';\nimport type { Package, PackageInfo } from '@embroider/core';\nimport { readdirSync, pathExistsSync } from 'fs-extra';\nimport type { TransformOptions } from '@babel/core';\nimport { MacrosConfig } from '@embroider/macros/src/node';\nimport escapeRegExp from 'escape-string-regexp';\n\nimport type CompatApp from './compat-app';\nimport { SyncDir } from './sync-dir';\n\n// This exists during the actual broccoli build step. As opposed to CompatApp,\n// which also exists during pipeline-construction time.\n\nexport class CompatAppBuilder {\n constructor(\n private root: string,\n private origAppPackage: Package,\n private appPackageWithMovedDeps: Package,\n private options: Required<Options>,\n private compatApp: CompatApp,\n private configTree: V1Config,\n private contentForTree: ContentForConfig,\n private synthVendor: Package,\n private synthStyles: Package\n ) {}\n\n @Memoize()\n private fastbootJSSrcDir() {\n let target = join(this.compatApp.root, 'fastboot');\n if (pathExistsSync(target)) {\n return target;\n }\n }\n\n private activeAddonChildren(pkg: Package): AddonPackage[] {\n let result = (pkg.dependencies.filter(this.isActiveAddon) as AddonPackage[]).filter(\n // When looking for child addons, we want to ignore 'peerDependencies' of\n // a given package, to align with how ember-cli resolves addons. So here\n // we only include dependencies that are definitely active due to one of\n // the other sections.\n addon => pkg.categorizeDependency(addon.name) !== 'peerDependencies'\n );\n if (pkg === this.appPackageWithMovedDeps) {\n let extras = [this.synthVendor, this.synthStyles].filter(this.isActiveAddon) as AddonPackage[];\n result = [...result, ...extras];\n }\n return result.sort(this.orderAddons);\n }\n\n @Memoize()\n private get allActiveAddons(): AddonPackage[] {\n let result = this.appPackageWithMovedDeps.findDescendants(this.isActiveAddon) as AddonPackage[];\n let extras = [this.synthVendor, this.synthStyles].filter(this.isActiveAddon) as AddonPackage[];\n let extraDescendants = flatMap(extras, dep => dep.findDescendants(this.isActiveAddon)) as AddonPackage[];\n result = [...result, ...extras, ...extraDescendants];\n return result.sort(this.orderAddons);\n }\n\n @bind\n private isActiveAddon(pkg: Package): boolean {\n // stage1 already took care of converting everything that's actually active\n // into v2 addons. If it's not a v2 addon, we don't want it.\n //\n // We can encounter v1 addons here when there is inactive stuff floating\n // around in the node_modules that accidentally satisfy something like an\n // optional peer dep.\n return pkg.isV2Addon();\n }\n\n @bind\n private orderAddons(depA: Package, depB: Package): number {\n let depAIdx = 0;\n let depBIdx = 0;\n\n if (depA && depA.meta && depA.isV2Addon()) {\n depAIdx = depA.meta['order-index'] || 0;\n }\n if (depB && depB.meta && depB.isV2Addon()) {\n depBIdx = depB.meta['order-index'] || 0;\n }\n\n return depAIdx - depBIdx;\n }\n\n private resolvableExtensions(): string[] {\n // webpack's default is ['.wasm', '.mjs', '.js', '.json']. Keeping that\n // subset in that order is sensible, since many third-party libraries will\n // expect it to work that way.\n //\n // For TS, we defer to ember-cli-babel, and the setting for\n // \"enableTypescriptTransform\" can be set with and without\n // ember-cli-typescript\n return ['.wasm', '.mjs', '.js', '.json', '.ts', '.hbs', '.hbs.js', '.gjs', '.gts'];\n }\n\n private addEmberEntrypoints(htmlTreePath: string): string[] {\n let classicEntrypoints = ['index.html', 'tests/index.html'];\n if (!this.compatApp.shouldBuildTests) {\n classicEntrypoints.pop();\n }\n for (let entrypoint of classicEntrypoints) {\n let sourcePath = join(htmlTreePath, entrypoint);\n let rewrittenAppPath = join(this.root, entrypoint);\n writeFileSync(rewrittenAppPath, readFileSync(sourcePath));\n }\n return classicEntrypoints;\n }\n\n private modulePrefix(): string {\n return this.configTree.readConfig().modulePrefix;\n }\n\n private podModulePrefix(): string | undefined {\n return this.configTree.readConfig().podModulePrefix;\n }\n\n private rootURL(): string {\n return this.configTree.readConfig().rootURL;\n }\n\n @Memoize()\n private activeRules() {\n return activePackageRules(this.options.packageRules.concat(defaultAddonPackageRules()), [\n { name: this.origAppPackage.name, version: this.origAppPackage.version, root: this.root },\n ...this.allActiveAddons.filter(p => p.meta['auto-upgraded']),\n ]);\n }\n\n private resolverConfig(engines: AppFiles[]): CompatResolverOptions {\n let renamePackages = Object.assign({}, ...this.allActiveAddons.map(dep => dep.meta['renamed-packages']));\n let renameModules = Object.assign({}, ...this.allActiveAddons.map(dep => dep.meta['renamed-modules']));\n\n let options: CompatResolverOptions['options'] = {\n staticHelpers: this.options.staticHelpers,\n staticModifiers: this.options.staticModifiers,\n staticComponents: this.options.staticComponents,\n allowUnsafeDynamicComponents: this.options.allowUnsafeDynamicComponents,\n };\n\n let config: CompatResolverOptions = {\n // this part is the base ModuleResolverOptions as required by @embroider/core\n renameModules,\n renamePackages,\n resolvableExtensions: this.resolvableExtensions(),\n appRoot: this.origAppPackage.root,\n engines: engines.map((appFiles, index) => ({\n packageName: appFiles.engine.package.name,\n // first engine is the app, which has been relocated to this.root\n // we need to use the real path here because webpack requests always use the real path i.e. follow symlinks\n root: realpathSync(index === 0 ? this.root : appFiles.engine.package.root),\n fastbootFiles: appFiles.fastbootFiles,\n activeAddons: [...appFiles.engine.addons]\n .map(([addon, canResolveFromFile]) => ({\n name: addon.name,\n root: addon.root,\n canResolveFromFile,\n }))\n // the traditional order is the order in which addons will run, such\n // that the last one wins. Our resolver's order is the order to\n // search, so first one wins.\n .reverse(),\n isLazy: appFiles.engine.package.isLazyEngine(),\n })),\n amdCompatibility: this.options.amdCompatibility,\n\n // this is the additional stufff that @embroider/compat adds on top to do\n // global template resolving\n modulePrefix: this.modulePrefix(),\n splitAtRoutes: this.options.splitAtRoutes,\n podModulePrefix: this.podModulePrefix(),\n activePackageRules: this.activeRules(),\n options,\n autoRun: this.compatApp.autoRun,\n staticAppPaths: this.options.staticAppPaths,\n };\n\n return config;\n }\n\n @Memoize()\n private get resolvableExtensionsPattern(): RegExp {\n return extensionsPattern(this.resolvableExtensions());\n }\n\n @Memoize()\n private async babelConfig(resolverConfig: CompatResolverOptions) {\n let babel = cloneDeep(this.compatApp.babelConfig());\n\n if (!babel.plugins) {\n babel.plugins = [];\n }\n\n // Our stage3 code is always allowed to use dynamic import. We may emit it\n // ourself when splitting routes.\n babel.plugins.push(require.resolve('@babel/plugin-syntax-dynamic-import'));\n\n // https://github.com/webpack/webpack/issues/12154\n babel.plugins.push(require.resolve('./rename-require-plugin'));\n\n babel.plugins.push([\n require.resolve('babel-plugin-ember-template-compilation'),\n await this.etcOptions(resolverConfig),\n ]);\n\n // this is @embroider/macros configured for full stage3 resolution\n babel.plugins.push(...this.compatApp.macrosConfig.babelPluginConfig());\n\n let colocationOptions: TemplateColocationPluginOptions = {\n appRoot: this.origAppPackage.root,\n\n // This extra weirdness is a compromise in favor of build performance.\n //\n // 1. When auto-upgrading an addon from v1 to v2, we definitely want to\n // run any custom AST transforms in stage1.\n //\n // 2. In general case, AST transforms are allowed to manipulate Javascript\n // scope. This means that running transforms -- even when we're doing\n // source-to-source compilation that emits handlebars and not wire\n // format -- implies changing .hbs files into .js files.\n //\n // 3. So stage1 may need to rewrite .hbs to .hbs.js (to avoid colliding\n // with an existing co-located .js file).\n //\n // 4. But stage1 doesn't necessarily want to run babel over the\n // corresponding JS file. Most of the time, that's just an\n // unnecessarily expensive second parse. (We only run it in stage1 to\n // eliminate an addon's custom babel plugins, and many addons don't\n // have any.)\n //\n // 5. Therefore, the work of template-colocation gets defered until here,\n // and it may see co-located templates named `.hbs.js` instead of the\n // usual `.hbs.\n templateExtensions: ['.hbs', '.hbs.js'],\n\n // All of the above only applies to auto-upgraded packages that were\n // authored in v1. V2 packages don't get any of this complexity, they're\n // supposed to take care of colocating their own templates explicitly.\n packageGuard: true,\n };\n babel.plugins.push([templateColocationPluginPath, colocationOptions]);\n\n babel.plugins.push([\n require.resolve('./babel-plugin-adjust-imports'),\n (() => {\n let pluginConfig: AdjustImportsOptions = {\n appRoot: resolverConfig.appRoot,\n };\n return pluginConfig;\n })(),\n ]);\n\n // we can use globally shared babel runtime by default\n babel.plugins.push([\n require.resolve('@babel/plugin-transform-runtime'),\n { absoluteRuntime: __dirname, useESModules: true, regenerator: false },\n ]);\n\n const portable = makePortable(babel, { basedir: this.root }, this.portableHints);\n addCachablePlugin(portable.config);\n return portable;\n }\n\n // recurse to find all active addons that don't cross an engine boundary.\n // Inner engines themselves will be returned, but not those engines' children.\n // The output set's insertion order is the proper ember-cli compatible\n // ordering of the addons.\n private findActiveAddons(pkg: Package, engine: Engine, isChild = false): void {\n for (let child of this.activeAddonChildren(pkg)) {\n if (!child.isEngine()) {\n this.findActiveAddons(child, engine, true);\n }\n let canResolveFrom: string;\n if (pkg === this.appPackageWithMovedDeps) {\n // we want canResolveFrom to always be a rewritten package path, and our\n // app's package is not rewritten yet here.\n canResolveFrom = resolvePath(this.root, 'package.json');\n } else {\n // whereas our addons are already moved\n canResolveFrom = resolvePath(pkg.root, 'package.json');\n }\n engine.addons.set(child, canResolveFrom);\n }\n // ensure addons are applied in the correct order, if set (via @embroider/compat/v1-addon)\n if (!isChild) {\n engine.addons = new Map(\n [...engine.addons].sort(([a], [b]) => {\n return (a.meta['order-index'] || 0) - (b.meta['order-index'] || 0);\n })\n );\n }\n }\n\n private partitionEngines(): Engine[] {\n let queue: Engine[] = [\n {\n package: this.appPackageWithMovedDeps,\n addons: new Map(),\n isApp: true,\n modulePrefix: this.modulePrefix(),\n appRelativePath: '.',\n },\n ];\n let done: Engine[] = [];\n let seenEngines: Set<Package> = new Set();\n while (true) {\n let current = queue.shift();\n if (!current) {\n break;\n }\n this.findActiveAddons(current.package, current);\n for (let addon of current.addons.keys()) {\n if (addon.isEngine() && !seenEngines.has(addon)) {\n seenEngines.add(addon);\n queue.push({\n package: addon,\n addons: new Map(),\n isApp: !current,\n modulePrefix: addon.name,\n appRelativePath: explicitRelative(this.root, addon.root),\n });\n }\n }\n done.push(current);\n }\n return done;\n }\n\n @Memoize()\n private get activeFastboot() {\n return this.activeAddonChildren(this.appPackageWithMovedDeps).find(a => a.name === 'ember-cli-fastboot');\n }\n\n private emberVersion() {\n let pkg = this.activeAddonChildren(this.appPackageWithMovedDeps).find(a => a.name === 'ember-source');\n if (!pkg) {\n throw new Error('no ember version!');\n }\n return pkg.version;\n }\n\n @Memoize()\n private get fastbootConfig():\n | { packageJSON: PackageInfo; extraAppFiles: string[]; extraVendorFiles: string[] }\n | undefined {\n if (this.activeFastboot) {\n // this is relying on work done in stage1 by @embroider/compat/src/compat-adapters/ember-cli-fastboot.ts\n let packageJSON = readJSONSync(join(this.activeFastboot.root, '_fastboot_', 'package.json'));\n let { extraAppFiles, extraVendorFiles } = packageJSON['embroider-fastboot'];\n delete packageJSON['embroider-fastboot'];\n extraVendorFiles.push('assets/embroider_macros_fastboot_init.js');\n return { packageJSON, extraAppFiles, extraVendorFiles };\n }\n }\n\n private engines: { engine: Engine; appSync: SyncDir; fastbootSync: SyncDir | undefined }[] | undefined;\n\n private updateAppJS(appJSPath: string): AppFiles[] {\n if (!this.engines) {\n this.engines = this.partitionEngines().map(engine => {\n if (engine.isApp) {\n // this is the app. We have more to do for the app than for other\n // engines.\n let fastbootSync: SyncDir | undefined;\n if (this.activeFastboot) {\n let fastbootDir = this.fastbootJSSrcDir();\n if (fastbootDir) {\n fastbootSync = new SyncDir(fastbootDir, resolvePath(this.root, '_fastboot_'));\n }\n }\n return {\n engine,\n appSync: new SyncDir(appJSPath, this.root),\n fastbootSync,\n };\n } else {\n // this is not the app, so it's some other engine. Engines are already\n // built by stage1 like all other addons, so we only need to observe\n // their files, not doing any actual copying or building.\n return {\n engine,\n appSync: new SyncDir(engine.package.root, undefined),\n\n // AFAIK, we've never supported a fastboot overlay directory in an\n // engine. But if we do need that, it would go here.\n fastbootSync: undefined,\n };\n }\n });\n }\n\n for (let engine of this.engines) {\n engine.appSync.update();\n engine.fastbootSync?.update();\n }\n\n return this.engines.map(\n ({ engine, appSync, fastbootSync }) =>\n new AppFiles(\n engine,\n appSync.files,\n fastbootSync?.files ?? new Set(),\n this.resolvableExtensionsPattern,\n this.staticAppPathsPattern,\n this.podModulePrefix()\n )\n );\n }\n\n @Memoize()\n private get staticAppPathsPattern(): RegExp | undefined {\n if (this.options.staticAppPaths.length > 0) {\n return new RegExp(\n '^(?:' + this.options.staticAppPaths.map(staticAppPath => escapeRegExp(staticAppPath)).join('|') + ')(?:$|/)'\n );\n }\n }\n\n private firstBuild = true;\n\n async build(inputPaths: OutputPaths<TreeNames>) {\n // on the first build, we lock down the macros config. on subsequent builds,\n // this doesn't do anything anyway because it's idempotent.\n this.compatApp.macrosConfig.finalize();\n\n // on first build, clear the output directory completely\n if (this.firstBuild) {\n rmSync(this.root, { recursive: true, force: true });\n this.firstBuild = false;\n }\n\n let appFiles = this.updateAppJS(inputPaths.appJS);\n let assetPaths = this.addEmberEntrypoints(inputPaths.htmlTree);\n\n if (this.activeFastboot) {\n // when using fastboot, our own package.json needs to be in the output so fastboot can read it.\n assetPaths.push('package.json');\n }\n\n let pkg = this.combinePackageJSON(assetPaths);\n writeFileSync(join(this.root, 'package.json'), JSON.stringify(pkg, null, 2), 'utf8');\n\n let resolverConfig = this.resolverConfig(appFiles);\n let config = this.configTree.readConfig();\n let contentForConfig = this.contentForTree.readContents();\n\n this.addResolverConfig(resolverConfig);\n this.addContentForConfig(contentForConfig);\n this.addEmberEnvConfig(config.EmberENV);\n this.outputAppBootError(config.modulePrefix, config.APP, contentForConfig);\n let babelConfig = await this.babelConfig(resolverConfig);\n this.addBabelConfig(babelConfig);\n this.addMacrosConfig(this.compatApp.macrosConfig.babelPluginConfig()[0]);\n }\n\n private combinePackageJSON(assetPaths: string[]): object {\n let pkgLayers: any[] = [this.origAppPackage.packageJSON];\n let fastbootConfig = this.fastbootConfig;\n if (fastbootConfig) {\n // fastboot-specific package.json output is allowed to add to our original package.json\n pkgLayers.push(fastbootConfig.packageJSON);\n }\n\n let meta: AppMeta = {\n type: 'app',\n version: 2,\n assets: assetPaths,\n babel: {\n filename: '_babel_config_.js',\n isParallelSafe: true, // TODO\n majorVersion: this.compatApp.babelMajorVersion(),\n fileFilter: '_babel_filter_.js',\n },\n 'root-url': this.rootURL(),\n };\n\n if ((this.origAppPackage.packageJSON['ember-addon']?.version ?? 0) < 2) {\n meta['auto-upgraded'] = true;\n }\n\n pkgLayers.push({ 'ember-addon': meta });\n\n return combinePackageJSON(...pkgLayers);\n }\n\n private async etcOptions(resolverConfig: CompatResolverOptions): Promise<EtcOptions> {\n let transforms = this.compatApp.htmlbarsPlugins;\n\n let { plugins: macroPlugins, setConfig } = MacrosConfig.transforms();\n setConfig(this.compatApp.macrosConfig);\n for (let macroPlugin of macroPlugins) {\n transforms.push(macroPlugin as any);\n }\n\n if (\n this.options.staticComponents ||\n this.options.staticHelpers ||\n this.options.staticModifiers ||\n (globalThis as any).embroider_audit\n ) {\n let opts: ResolverTransformOptions = {\n appRoot: resolverConfig.appRoot,\n emberVersion: this.emberVersion(),\n };\n transforms.push([require.resolve('./resolver-transform'), opts]);\n }\n\n let resolver = new Resolver(resolverConfig);\n let resolution = await resolver.nodeResolve(\n 'ember-source/vendor/ember/ember-template-compiler',\n resolvePath(this.root, 'package.json')\n );\n if (resolution.type !== 'real') {\n throw new Error(`bug: unable to resolve ember-template-compiler from ${this.root}`);\n }\n\n return {\n transforms,\n compilerPath: resolution.filename,\n enableLegacyModules: ['ember-cli-htmlbars', 'ember-cli-htmlbars-inline-precompile', 'htmlbars-inline-precompile'],\n };\n }\n\n @Memoize()\n private get portableHints(): PortableHint[] {\n return this.options.pluginHints.map(hint => {\n let cursor = join(this.origAppPackage.root, 'package.json');\n for (let i = 0; i < hint.resolve.length; i++) {\n let target = hint.resolve[i];\n if (i < hint.resolve.length - 1) {\n target = join(target, 'package.json');\n }\n cursor = resolve.sync(target, { basedir: dirname(cursor) });\n }\n\n return {\n requireFile: cursor,\n useMethod: hint.useMethod,\n packageVersion: maybeNodeModuleVersion(cursor),\n };\n });\n }\n\n private addBabelConfig(pconfig: { config: TransformOptions; isParallelSafe: boolean }) {\n if (!pconfig.isParallelSafe) {\n warn('Your build is slower because some babel plugins are non-serializable');\n }\n writeFileSync(\n join(locateEmbroiderWorkingDir(this.compatApp.root), '_babel_config_.js'),\n `module.exports = ${JSON.stringify(pconfig.config, null, 2)}`,\n 'utf8'\n );\n writeFileSync(\n join(locateEmbroiderWorkingDir(this.compatApp.root), '_babel_filter_.js'),\n babelFilterTemplate({ skipBabel: this.options.skipBabel, appRoot: this.origAppPackage.root }),\n 'utf8'\n );\n }\n\n private addResolverConfig(config: CompatResolverOptions) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'resolver.json'), config, { spaces: 2 });\n }\n\n private addContentForConfig(contentForConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'content-for.json'), contentForConfig, {\n spaces: 2,\n });\n\n // In addition to outputting content-for.json, we also want to check if content-for 'config-module' has a custom content.\n // If so, it means some classic addons used to provide this custom content, which is no longer supported.\n // Developers can deactivate this check (and the subsequent warning) with useAddonConfigModule\n if (this.compatApp.options.useAddonConfigModule) {\n let modulePrefix = this.configTree.readConfig().modulePrefix;\n\n // This is the default script provided by https://github.com/ember-cli/ember-cli/blob/master/lib/utilities/ember-app-utils.js#L84\n // When storeConfigInMeta is true, this content is always present in the config-module key of content-for.json\n const defaultConfigModule =\n `var prefix = '${modulePrefix}';\\ntry {\\n var metaName = prefix + '/config/environment';\\n var rawConfig = document.querySelector('meta[name=\\\"' + metaName + '\\\"]').getAttribute('content');\\n var config = JSON.parse(decodeURIComponent(rawConfig));\\n\\n var exports = { 'default': config };\\n\\n Object.defineProperty(exports, '__esModule', { value: true });\\n\\n return exports;\\n}\\ncatch(err) {\\n throw new Error('Could not read config from meta tag with name \\\"' + metaName + '\\\".');\\n}\\n`.replace(\n /\\s/g,\n ''\n );\n\n const configModule = contentForConfig['/index.html']['config-module'];\n const diff = configModule.replace(/\\s/g, '').replace(defaultConfigModule, '');\n\n if (diff.length) {\n throw new Error(`\n Your app uses at least one classic addon that provides content-for 'config-module'. This is no longer supported.\n With Embroider, you have full control over the config module, so classic addons no longer need to modify it under the hood.\n The following code is included via content-for 'config-module':\n\n ${configModule}\n\n 1. If you want to keep the same behavior, add it to the app/environment.js.\n 2. Once app/environment.js has the content you need, remove the present error by setting \"useAddonConfigModule\" to false in the build options.\n `);\n }\n }\n }\n\n private addEmberEnvConfig(emberEnvConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'ember-env.json'), emberEnvConfig, {\n spaces: 2,\n });\n }\n\n private addMacrosConfig(macrosConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'macros-config.json'), macrosConfig, {\n spaces: 2,\n });\n }\n\n // Classic addons providing custom content-for \"app-boot\" is no longer supported.\n // The purpose of this error message is to help developers to move the classic addons code.\n // Developers can deactivate it with useAddonAppBoot build option.\n private outputAppBootError(modulePrefix: string, appConfig: any, contentForConfig: any) {\n if (!this.compatApp.options.useAddonAppBoot) {\n return;\n }\n\n // This is the default script provided by\n // https://github.com/ember-cli/ember-cli/blob/master/lib/utilities/ember-app-utils.js#L103\n const defaultAppBoot = `\n if (!runningTests) {\n require(\"${modulePrefix}/app\")[\"default\"].create(${JSON.stringify(appConfig || {})});\n }\n `.replace(/\\s/g, '');\n\n const appBoot = contentForConfig['/index.html']['app-boot'];\n const diff = appBoot.replace(/\\s/g, '').replace(defaultAppBoot, '');\n\n if (diff.length) {\n throw new Error(`\n Your app uses at least one classic addon that provides content-for 'app-boot'. This is no longer supported.\n With Embroider, you have full control over the app-boot script, so classic addons no longer need to modify it under the hood.\n The following code is used for your app boot:\n\n ${appBoot}\n\n 1. If you want to keep the same behavior, copy and paste it to the app-boot script included in app/index.html.\n 2. Once app/index.html has the content you need, remove the present error by setting \"useAddonAppBoot\" to false in the build options.\n `);\n }\n }\n}\n\nfunction defaultAddonPackageRules(): PackageRules[] {\n return readdirSync(join(__dirname, 'addon-dependency-rules'))\n .map(filename => {\n if (filename.endsWith('.js')) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(join(__dirname, 'addon-dependency-rules', filename)).default;\n }\n })\n .filter(Boolean)\n .reduce((a, b) => a.concat(b), []);\n}\n\nconst babelFilterTemplate = jsHandlebarsCompile(`\nconst { babelFilter } = require(${JSON.stringify(require.resolve('@embroider/core'))});\nmodule.exports = babelFilter({{json-stringify skipBabel}}, \"{{js-string-escape appRoot}}\");\n`) as (params: { skipBabel: Options['skipBabel']; appRoot: string }) => string;\n\nfunction combinePackageJSON(...layers: object[]) {\n function custom(objValue: any, srcValue: any, key: string, _object: any, _source: any, stack: { size: number }) {\n if (key === 'keywords' && stack.size === 0) {\n if (Array.isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n }\n }\n return mergeWith({}, ...layers, custom);\n}\n\nfunction addCachablePlugin(babelConfig: TransformOptions) {\n if (Array.isArray(babelConfig.plugins) && babelConfig.plugins.length > 0) {\n const plugins = Object.create(null);\n plugins[cacheBustingPluginPath] = cacheBustingPluginVersion;\n\n for (const plugin of babelConfig.plugins) {\n let absolutePathToPlugin: string;\n if (Array.isArray(plugin) && typeof plugin[0] === 'string') {\n absolutePathToPlugin = plugin[0] as string;\n } else if (typeof plugin === 'string') {\n absolutePathToPlugin = plugin;\n } else {\n throw new Error(`[Embroider] a babel plugin without an absolute path was from: ${plugin}`);\n }\n\n plugins[absolutePathToPlugin] = maybeNodeModuleVersion(absolutePathToPlugin);\n }\n\n babelConfig.plugins.push([\n cacheBustingPluginPath,\n {\n plugins,\n },\n ]);\n }\n}\n\ninterface TreeNames {\n appJS: BroccoliNode;\n htmlTree: BroccoliNode;\n publicTree: BroccoliNode | undefined;\n configTree: BroccoliNode;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compat-app-builder.js","sourceRoot":"","sources":["compat-app-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,0CAUyB;AACzB,+BAA8C;AAI9C,yDAAwD;AACxD,6DAAqC;AACrC,iEAAyC;AACzC,iEAAyC;AACzC,oEAAkC;AAClC,uCAA2G;AAI3G,qFAAyE;AACzE,6DAAyD;AAEzD,2DAAsE;AACtE,2DAA6C;AAC7C,+BAAqC;AACrC,sDAA8B;AAI9B,uCAAuD;AAEvD,qDAA0D;AAC1D,gFAAgD;AAGhD,yCAAqC;AAErC,8EAA8E;AAC9E,uDAAuD;AAEvD,MAAa,gBAAgB;IAC3B,YACU,IAAY,EACZ,cAAuB,EACvB,uBAAgC,EAChC,OAA0B,EAC1B,SAAoB,EACpB,UAAoB,EACpB,cAAgC,EAChC,WAAoB,EACpB,WAAoB;QARpB,SAAI,GAAJ,IAAI,CAAQ;QACZ,mBAAc,GAAd,cAAc,CAAS;QACvB,4BAAuB,GAAvB,uBAAuB,CAAS;QAChC,YAAO,GAAP,OAAO,CAAmB;QAC1B,cAAS,GAAT,SAAS,CAAW;QACpB,eAAU,GAAV,UAAU,CAAU;QACpB,mBAAc,GAAd,cAAc,CAAkB;QAChC,gBAAW,GAAX,WAAW,CAAS;QACpB,gBAAW,GAAX,WAAW,CAAS;QA0YtB,eAAU,GAAG,IAAI,CAAC;IAzYvB,CAAC;IAGI,gBAAgB;QACtB,IAAI,MAAM,GAAG,IAAA,WAAI,EAAC,IAAI,CAA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,gCAAyB,CAAC;QAE5D,KAAK,MAAM,MAAM,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACzC,IAAI,oBAA4B,CAAC;YACjC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;gBAC3D,oBAAoB,GAAG,MAAM,CAAC,CAAC,CAAW,CAAC;YAC7C,CAAC;iBAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACtC,oBAAoB,GAAG,MAAM,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,iEAAiE,MAAM,EAAE,CAAC,CAAC;YAC7F,CAAC;YAED,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAA,iCAAsB,EAAC,oBAAoB,CAAC,CAAC;QAC/E,CAAC;QAED,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;YACvB,6BAAsB;YACtB;gBACE,OAAO;aACR;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import type { Node as BroccoliNode } from 'broccoli-node-api';\nimport type { OutputPaths, AddonPackage, Engine, AppMeta, TemplateColocationPluginOptions } from '@embroider/core';\nimport {\n explicitRelative,\n extensionsPattern,\n warn,\n jsHandlebarsCompile,\n templateColocationPluginPath,\n cacheBustingPluginVersion,\n cacheBustingPluginPath,\n Resolver,\n locateEmbroiderWorkingDir,\n} from '@embroider/core';\nimport { resolve as resolvePath } from 'path';\nimport type Options from './options';\nimport type { CompatResolverOptions } from './resolver-transform';\nimport type { PackageRules } from './dependency-rules';\nimport { activePackageRules } from './dependency-rules';\nimport flatMap from 'lodash/flatMap';\nimport mergeWith from 'lodash/mergeWith';\nimport cloneDeep from 'lodash/cloneDeep';\nimport bind from 'bind-decorator';\nimport { outputJSONSync, readFileSync, readJSONSync, rmSync, writeFileSync, realpathSync } from 'fs-extra';\nimport type { Options as EtcOptions } from 'babel-plugin-ember-template-compilation';\nimport type { Options as ResolverTransformOptions } from './resolver-transform';\nimport type { Options as AdjustImportsOptions } from './babel-plugin-adjust-imports';\nimport { makePortable } from '@embroider/core/src/portable-babel-config';\nimport { AppFiles } from '@embroider/core/src/app-files';\nimport type { PortableHint } from '@embroider/core/src/portable';\nimport { maybeNodeModuleVersion } from '@embroider/core/src/portable';\nimport { Memoize } from 'typescript-memoize';\nimport { join, dirname } from 'path';\nimport resolve from 'resolve';\nimport type ContentForConfig from './content-for-config';\nimport type { V1Config } from './v1-config';\nimport type { Package, PackageInfo } from '@embroider/core';\nimport { readdirSync, pathExistsSync } from 'fs-extra';\nimport type { TransformOptions } from '@babel/core';\nimport { MacrosConfig } from '@embroider/macros/src/node';\nimport escapeRegExp from 'escape-string-regexp';\n\nimport type CompatApp from './compat-app';\nimport { SyncDir } from './sync-dir';\n\n// This exists during the actual broccoli build step. As opposed to CompatApp,\n// which also exists during pipeline-construction time.\n\nexport class CompatAppBuilder {\n constructor(\n private root: string,\n private origAppPackage: Package,\n private appPackageWithMovedDeps: Package,\n private options: Required<Options>,\n private compatApp: CompatApp,\n private configTree: V1Config,\n private contentForTree: ContentForConfig,\n private synthVendor: Package,\n private synthStyles: Package\n ) {}\n\n @Memoize()\n private fastbootJSSrcDir() {\n let target = join(this.compatApp.root, 'fastboot');\n if (pathExistsSync(target)) {\n return target;\n }\n }\n\n private activeAddonChildren(pkg: Package): AddonPackage[] {\n let result = (pkg.dependencies.filter(this.isActiveAddon) as AddonPackage[]).filter(\n // When looking for child addons, we want to ignore 'peerDependencies' of\n // a given package, to align with how ember-cli resolves addons. So here\n // we only include dependencies that are definitely active due to one of\n // the other sections.\n addon => pkg.categorizeDependency(addon.name) !== 'peerDependencies'\n );\n if (pkg === this.appPackageWithMovedDeps) {\n let extras = [this.synthVendor, this.synthStyles].filter(this.isActiveAddon) as AddonPackage[];\n result = [...result, ...extras];\n }\n return result.sort(this.orderAddons);\n }\n\n @Memoize()\n private get allActiveAddons(): AddonPackage[] {\n let result = this.appPackageWithMovedDeps.findDescendants(this.isActiveAddon) as AddonPackage[];\n let extras = [this.synthVendor, this.synthStyles].filter(this.isActiveAddon) as AddonPackage[];\n let extraDescendants = flatMap(extras, dep => dep.findDescendants(this.isActiveAddon)) as AddonPackage[];\n result = [...result, ...extras, ...extraDescendants];\n return result.sort(this.orderAddons);\n }\n\n @bind\n private isActiveAddon(pkg: Package): boolean {\n // stage1 already took care of converting everything that's actually active\n // into v2 addons. If it's not a v2 addon, we don't want it.\n //\n // We can encounter v1 addons here when there is inactive stuff floating\n // around in the node_modules that accidentally satisfy something like an\n // optional peer dep.\n return pkg.isV2Addon();\n }\n\n @bind\n private orderAddons(depA: Package, depB: Package): number {\n let depAIdx = 0;\n let depBIdx = 0;\n\n if (depA && depA.meta && depA.isV2Addon()) {\n depAIdx = depA.meta['order-index'] || 0;\n }\n if (depB && depB.meta && depB.isV2Addon()) {\n depBIdx = depB.meta['order-index'] || 0;\n }\n\n return depAIdx - depBIdx;\n }\n\n private resolvableExtensions(): string[] {\n // webpack's default is ['.wasm', '.mjs', '.js', '.json']. Keeping that\n // subset in that order is sensible, since many third-party libraries will\n // expect it to work that way.\n //\n // For TS, we defer to ember-cli-babel, and the setting for\n // \"enableTypescriptTransform\" can be set with and without\n // ember-cli-typescript\n return ['.wasm', '.mjs', '.js', '.json', '.ts', '.hbs', '.hbs.js', '.gjs', '.gts'];\n }\n\n private addEmberEntrypoints(htmlTreePath: string): string[] {\n let classicEntrypoints = ['index.html', 'tests/index.html'];\n if (!this.compatApp.shouldBuildTests) {\n classicEntrypoints.pop();\n }\n for (let entrypoint of classicEntrypoints) {\n let sourcePath = join(htmlTreePath, entrypoint);\n let rewrittenAppPath = join(this.root, entrypoint);\n writeFileSync(rewrittenAppPath, readFileSync(sourcePath));\n }\n return classicEntrypoints;\n }\n\n private modulePrefix(): string {\n return this.configTree.readConfig().modulePrefix;\n }\n\n private podModulePrefix(): string | undefined {\n return this.configTree.readConfig().podModulePrefix;\n }\n\n private rootURL(): string {\n return this.configTree.readConfig().rootURL;\n }\n\n @Memoize()\n private activeRules() {\n return activePackageRules(this.options.packageRules.concat(defaultAddonPackageRules()), [\n { name: this.origAppPackage.name, version: this.origAppPackage.version, root: this.root },\n ...this.allActiveAddons.filter(p => p.meta['auto-upgraded']),\n ]);\n }\n\n private resolverConfig(engines: AppFiles[]): CompatResolverOptions {\n let renamePackages = Object.assign({}, ...this.allActiveAddons.map(dep => dep.meta['renamed-packages']));\n let renameModules = Object.assign({}, ...this.allActiveAddons.map(dep => dep.meta['renamed-modules']));\n\n let options: CompatResolverOptions['options'] = {\n staticHelpers: this.options.staticHelpers,\n staticModifiers: this.options.staticModifiers,\n staticComponents: this.options.staticComponents,\n allowUnsafeDynamicComponents: this.options.allowUnsafeDynamicComponents,\n };\n\n let config: CompatResolverOptions = {\n // this part is the base ModuleResolverOptions as required by @embroider/core\n renameModules,\n renamePackages,\n resolvableExtensions: this.resolvableExtensions(),\n appRoot: this.origAppPackage.root,\n engines: engines.map((appFiles, index) => ({\n packageName: appFiles.engine.package.name,\n // first engine is the app, which has been relocated to this.root\n // we need to use the real path here because webpack requests always use the real path i.e. follow symlinks\n root: realpathSync(index === 0 ? this.root : appFiles.engine.package.root),\n fastbootFiles: appFiles.fastbootFiles,\n activeAddons: [...appFiles.engine.addons]\n .map(([addon, canResolveFromFile]) => ({\n name: addon.name,\n root: addon.root,\n canResolveFromFile,\n }))\n // the traditional order is the order in which addons will run, such\n // that the last one wins. Our resolver's order is the order to\n // search, so first one wins.\n .reverse(),\n isLazy: appFiles.engine.package.isLazyEngine(),\n })),\n amdCompatibility: this.options.amdCompatibility,\n\n // this is the additional stufff that @embroider/compat adds on top to do\n // global template resolving\n modulePrefix: this.modulePrefix(),\n splitAtRoutes: this.options.splitAtRoutes,\n podModulePrefix: this.podModulePrefix(),\n activePackageRules: this.activeRules(),\n options,\n autoRun: this.compatApp.autoRun,\n staticAppPaths: this.options.staticAppPaths,\n };\n\n return config;\n }\n\n @Memoize()\n private get resolvableExtensionsPattern(): RegExp {\n return extensionsPattern(this.resolvableExtensions());\n }\n\n @Memoize()\n private async babelConfig(resolverConfig: CompatResolverOptions) {\n let babel = cloneDeep(this.compatApp.babelConfig());\n\n if (!babel.plugins) {\n babel.plugins = [];\n }\n\n // Our stage3 code is always allowed to use dynamic import. We may emit it\n // ourself when splitting routes.\n babel.plugins.push(require.resolve('@babel/plugin-syntax-dynamic-import'));\n\n // https://github.com/webpack/webpack/issues/12154\n babel.plugins.push(require.resolve('./rename-require-plugin'));\n\n babel.plugins.push([\n require.resolve('babel-plugin-ember-template-compilation'),\n await this.etcOptions(resolverConfig),\n ]);\n\n // this is @embroider/macros configured for full stage3 resolution\n babel.plugins.push(...this.compatApp.macrosConfig.babelPluginConfig());\n\n let colocationOptions: TemplateColocationPluginOptions = {\n appRoot: this.origAppPackage.root,\n\n // This extra weirdness is a compromise in favor of build performance.\n //\n // 1. When auto-upgrading an addon from v1 to v2, we definitely want to\n // run any custom AST transforms in stage1.\n //\n // 2. In general case, AST transforms are allowed to manipulate Javascript\n // scope. This means that running transforms -- even when we're doing\n // source-to-source compilation that emits handlebars and not wire\n // format -- implies changing .hbs files into .js files.\n //\n // 3. So stage1 may need to rewrite .hbs to .hbs.js (to avoid colliding\n // with an existing co-located .js file).\n //\n // 4. But stage1 doesn't necessarily want to run babel over the\n // corresponding JS file. Most of the time, that's just an\n // unnecessarily expensive second parse. (We only run it in stage1 to\n // eliminate an addon's custom babel plugins, and many addons don't\n // have any.)\n //\n // 5. Therefore, the work of template-colocation gets defered until here,\n // and it may see co-located templates named `.hbs.js` instead of the\n // usual `.hbs.\n templateExtensions: ['.hbs', '.hbs.js'],\n\n // All of the above only applies to auto-upgraded packages that were\n // authored in v1. V2 packages don't get any of this complexity, they're\n // supposed to take care of colocating their own templates explicitly.\n packageGuard: true,\n };\n babel.plugins.push([templateColocationPluginPath, colocationOptions]);\n\n babel.plugins.push([\n require.resolve('./babel-plugin-adjust-imports'),\n (() => {\n let pluginConfig: AdjustImportsOptions = {\n appRoot: resolverConfig.appRoot,\n };\n return pluginConfig;\n })(),\n ]);\n\n // we can use globally shared babel runtime by default\n babel.plugins.push([\n require.resolve('@babel/plugin-transform-runtime'),\n { absoluteRuntime: __dirname, useESModules: true, regenerator: false },\n ]);\n\n const portable = makePortable(babel, { basedir: this.root }, this.portableHints);\n addCachablePlugin(portable.config);\n return portable;\n }\n\n // recurse to find all active addons that don't cross an engine boundary.\n // Inner engines themselves will be returned, but not those engines' children.\n // The output set's insertion order is the proper ember-cli compatible\n // ordering of the addons.\n private findActiveAddons(pkg: Package, engine: Engine, isChild = false): void {\n for (let child of this.activeAddonChildren(pkg)) {\n if (!child.isEngine()) {\n this.findActiveAddons(child, engine, true);\n }\n let canResolveFrom: string;\n if (pkg === this.appPackageWithMovedDeps) {\n // we want canResolveFrom to always be a rewritten package path, and our\n // app's package is not rewritten yet here.\n canResolveFrom = resolvePath(this.root, 'package.json');\n } else {\n // whereas our addons are already moved\n canResolveFrom = resolvePath(pkg.root, 'package.json');\n }\n engine.addons.set(child, canResolveFrom);\n }\n // ensure addons are applied in the correct order, if set (via @embroider/compat/v1-addon)\n if (!isChild) {\n engine.addons = new Map(\n [...engine.addons].sort(([a], [b]) => {\n return (a.meta['order-index'] || 0) - (b.meta['order-index'] || 0);\n })\n );\n }\n }\n\n private partitionEngines(): Engine[] {\n let queue: Engine[] = [\n {\n package: this.appPackageWithMovedDeps,\n addons: new Map(),\n isApp: true,\n modulePrefix: this.modulePrefix(),\n appRelativePath: '.',\n },\n ];\n let done: Engine[] = [];\n let seenEngines: Set<Package> = new Set();\n while (true) {\n let current = queue.shift();\n if (!current) {\n break;\n }\n this.findActiveAddons(current.package, current);\n for (let addon of current.addons.keys()) {\n if (addon.isEngine() && !seenEngines.has(addon)) {\n seenEngines.add(addon);\n queue.push({\n package: addon,\n addons: new Map(),\n isApp: !current,\n modulePrefix: addon.name,\n appRelativePath: explicitRelative(this.root, addon.root),\n });\n }\n }\n done.push(current);\n }\n return done;\n }\n\n @Memoize()\n private get activeFastboot() {\n return this.activeAddonChildren(this.appPackageWithMovedDeps).find(a => a.name === 'ember-cli-fastboot');\n }\n\n private emberVersion() {\n let pkg = this.activeAddonChildren(this.appPackageWithMovedDeps).find(a => a.name === 'ember-source');\n if (!pkg) {\n throw new Error('no ember version!');\n }\n return pkg.version;\n }\n\n @Memoize()\n private get fastbootConfig():\n | { packageJSON: PackageInfo; extraAppFiles: string[]; extraVendorFiles: string[] }\n | undefined {\n if (this.activeFastboot) {\n // this is relying on work done in stage1 by @embroider/compat/src/compat-adapters/ember-cli-fastboot.ts\n let packageJSON = readJSONSync(join(this.activeFastboot.root, '_fastboot_', 'package.json'));\n let { extraAppFiles, extraVendorFiles } = packageJSON['embroider-fastboot'];\n delete packageJSON['embroider-fastboot'];\n extraVendorFiles.push('assets/embroider_macros_fastboot_init.js');\n return { packageJSON, extraAppFiles, extraVendorFiles };\n }\n }\n\n private engines: { engine: Engine; appSync: SyncDir; fastbootSync: SyncDir | undefined }[] | undefined;\n\n private updateAppJS(appJSPath: string): AppFiles[] {\n if (!this.engines) {\n this.engines = this.partitionEngines().map(engine => {\n if (engine.isApp) {\n // this is the app. We have more to do for the app than for other\n // engines.\n let fastbootSync: SyncDir | undefined;\n if (this.activeFastboot) {\n let fastbootDir = this.fastbootJSSrcDir();\n if (fastbootDir) {\n fastbootSync = new SyncDir(fastbootDir, resolvePath(this.root, '_fastboot_'));\n }\n }\n return {\n engine,\n appSync: new SyncDir(appJSPath, this.root),\n fastbootSync,\n };\n } else {\n // this is not the app, so it's some other engine. Engines are already\n // built by stage1 like all other addons, so we only need to observe\n // their files, not doing any actual copying or building.\n return {\n engine,\n appSync: new SyncDir(engine.package.root, undefined),\n\n // AFAIK, we've never supported a fastboot overlay directory in an\n // engine. But if we do need that, it would go here.\n fastbootSync: undefined,\n };\n }\n });\n }\n\n for (let engine of this.engines) {\n engine.appSync.update();\n engine.fastbootSync?.update();\n }\n\n return this.engines.map(\n ({ engine, appSync, fastbootSync }) =>\n new AppFiles(\n engine,\n appSync.files,\n fastbootSync?.files ?? new Set(),\n this.resolvableExtensionsPattern,\n this.staticAppPathsPattern,\n this.podModulePrefix()\n )\n );\n }\n\n @Memoize()\n private get staticAppPathsPattern(): RegExp | undefined {\n if (this.options.staticAppPaths.length > 0) {\n return new RegExp(\n '^(?:' + this.options.staticAppPaths.map(staticAppPath => escapeRegExp(staticAppPath)).join('|') + ')(?:$|/)'\n );\n }\n }\n\n private firstBuild = true;\n\n async build(inputPaths: OutputPaths<TreeNames>) {\n // on the first build, we lock down the macros config. on subsequent builds,\n // this doesn't do anything anyway because it's idempotent.\n this.compatApp.macrosConfig.finalize();\n\n // on first build, clear the output directory completely\n if (this.firstBuild) {\n rmSync(this.root, { recursive: true, force: true });\n this.firstBuild = false;\n }\n\n let appFiles = this.updateAppJS(inputPaths.appJS);\n let assetPaths = this.addEmberEntrypoints(inputPaths.htmlTree);\n\n if (this.activeFastboot) {\n // when using fastboot, our own package.json needs to be in the output so fastboot can read it.\n assetPaths.push('package.json');\n }\n\n let pkg = this.combinePackageJSON(assetPaths);\n writeFileSync(join(this.root, 'package.json'), JSON.stringify(pkg, null, 2), 'utf8');\n\n let resolverConfig = this.resolverConfig(appFiles);\n let config = this.configTree.readConfig();\n let contentForConfig = this.contentForTree.readContents();\n\n this.addResolverConfig(resolverConfig);\n this.addContentForConfig(contentForConfig);\n this.addEmberEnvConfig(config.EmberENV);\n this.outputAppBootError(config.modulePrefix, config.APP, contentForConfig);\n let babelConfig = await this.babelConfig(resolverConfig);\n this.addBabelConfig(babelConfig);\n this.addMacrosConfig(this.compatApp.macrosConfig.babelPluginConfig()[0]);\n }\n\n private combinePackageJSON(assetPaths: string[]): object {\n let pkgLayers: any[] = [this.origAppPackage.packageJSON];\n let fastbootConfig = this.fastbootConfig;\n if (fastbootConfig) {\n // fastboot-specific package.json output is allowed to add to our original package.json\n pkgLayers.push(fastbootConfig.packageJSON);\n }\n\n let meta: AppMeta = {\n type: 'app',\n version: 2,\n assets: assetPaths,\n babel: {\n filename: '_babel_config_.js',\n isParallelSafe: true, // TODO\n majorVersion: this.compatApp.babelMajorVersion(),\n fileFilter: '_babel_filter_.js',\n },\n 'root-url': this.rootURL(),\n };\n\n if ((this.origAppPackage.packageJSON['ember-addon']?.version ?? 0) < 2) {\n meta['auto-upgraded'] = true;\n // our rewriting keeps app in app directory, etc.\n pkgLayers.push({\n exports: {\n './*': './app/*',\n './tests/*': './tests/*',\n },\n });\n }\n\n pkgLayers.push({ 'ember-addon': meta });\n\n return combinePackageJSON(...pkgLayers);\n }\n\n private async etcOptions(resolverConfig: CompatResolverOptions): Promise<EtcOptions> {\n let transforms = this.compatApp.htmlbarsPlugins;\n\n let { plugins: macroPlugins, setConfig } = MacrosConfig.transforms();\n setConfig(this.compatApp.macrosConfig);\n for (let macroPlugin of macroPlugins) {\n transforms.push(macroPlugin as any);\n }\n\n if (\n this.options.staticComponents ||\n this.options.staticHelpers ||\n this.options.staticModifiers ||\n (globalThis as any).embroider_audit\n ) {\n let opts: ResolverTransformOptions = {\n appRoot: resolverConfig.appRoot,\n emberVersion: this.emberVersion(),\n };\n transforms.push([require.resolve('./resolver-transform'), opts]);\n }\n\n let resolver = new Resolver(resolverConfig);\n let resolution = await resolver.nodeResolve(\n 'ember-source/vendor/ember/ember-template-compiler',\n resolvePath(this.root, 'package.json')\n );\n if (resolution.type !== 'real') {\n throw new Error(`bug: unable to resolve ember-template-compiler from ${this.root}`);\n }\n\n return {\n transforms,\n compilerPath: resolution.filename,\n enableLegacyModules: ['ember-cli-htmlbars', 'ember-cli-htmlbars-inline-precompile', 'htmlbars-inline-precompile'],\n };\n }\n\n @Memoize()\n private get portableHints(): PortableHint[] {\n return this.options.pluginHints.map(hint => {\n let cursor = join(this.origAppPackage.root, 'package.json');\n for (let i = 0; i < hint.resolve.length; i++) {\n let target = hint.resolve[i];\n if (i < hint.resolve.length - 1) {\n target = join(target, 'package.json');\n }\n cursor = resolve.sync(target, { basedir: dirname(cursor) });\n }\n\n return {\n requireFile: cursor,\n useMethod: hint.useMethod,\n packageVersion: maybeNodeModuleVersion(cursor),\n };\n });\n }\n\n private addBabelConfig(pconfig: { config: TransformOptions; isParallelSafe: boolean }) {\n if (!pconfig.isParallelSafe) {\n warn('Your build is slower because some babel plugins are non-serializable');\n }\n writeFileSync(\n join(locateEmbroiderWorkingDir(this.compatApp.root), '_babel_config_.js'),\n `module.exports = ${JSON.stringify(pconfig.config, null, 2)}`,\n 'utf8'\n );\n writeFileSync(\n join(locateEmbroiderWorkingDir(this.compatApp.root), '_babel_filter_.js'),\n babelFilterTemplate({ skipBabel: this.options.skipBabel, appRoot: this.origAppPackage.root }),\n 'utf8'\n );\n }\n\n private addResolverConfig(config: CompatResolverOptions) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'resolver.json'), config, { spaces: 2 });\n }\n\n private addContentForConfig(contentForConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'content-for.json'), contentForConfig, {\n spaces: 2,\n });\n\n // In addition to outputting content-for.json, we also want to check if content-for 'config-module' has a custom content.\n // If so, it means some classic addons used to provide this custom content, which is no longer supported.\n // Developers can deactivate this check (and the subsequent warning) with useAddonConfigModule\n if (this.compatApp.options.useAddonConfigModule) {\n let modulePrefix = this.configTree.readConfig().modulePrefix;\n\n // This is the default script provided by https://github.com/ember-cli/ember-cli/blob/master/lib/utilities/ember-app-utils.js#L84\n // When storeConfigInMeta is true, this content is always present in the config-module key of content-for.json\n const defaultConfigModule =\n `var prefix = '${modulePrefix}';\\ntry {\\n var metaName = prefix + '/config/environment';\\n var rawConfig = document.querySelector('meta[name=\\\"' + metaName + '\\\"]').getAttribute('content');\\n var config = JSON.parse(decodeURIComponent(rawConfig));\\n\\n var exports = { 'default': config };\\n\\n Object.defineProperty(exports, '__esModule', { value: true });\\n\\n return exports;\\n}\\ncatch(err) {\\n throw new Error('Could not read config from meta tag with name \\\"' + metaName + '\\\".');\\n}\\n`.replace(\n /\\s/g,\n ''\n );\n\n const configModule = contentForConfig['/index.html']['config-module'];\n const diff = configModule.replace(/\\s/g, '').replace(defaultConfigModule, '');\n\n if (diff.length) {\n throw new Error(`\n Your app uses at least one classic addon that provides content-for 'config-module'. This is no longer supported.\n With Embroider, you have full control over the config module, so classic addons no longer need to modify it under the hood.\n The following code is included via content-for 'config-module':\n\n ${configModule}\n\n 1. If you want to keep the same behavior, add it to the app/environment.js.\n 2. Once app/environment.js has the content you need, remove the present error by setting \"useAddonConfigModule\" to false in the build options.\n `);\n }\n }\n }\n\n private addEmberEnvConfig(emberEnvConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'ember-env.json'), emberEnvConfig, {\n spaces: 2,\n });\n }\n\n private addMacrosConfig(macrosConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'macros-config.json'), macrosConfig, {\n spaces: 2,\n });\n }\n\n // Classic addons providing custom content-for \"app-boot\" is no longer supported.\n // The purpose of this error message is to help developers to move the classic addons code.\n // Developers can deactivate it with useAddonAppBoot build option.\n private outputAppBootError(modulePrefix: string, appConfig: any, contentForConfig: any) {\n if (!this.compatApp.options.useAddonAppBoot) {\n return;\n }\n\n // This is the default script provided by\n // https://github.com/ember-cli/ember-cli/blob/master/lib/utilities/ember-app-utils.js#L103\n const defaultAppBoot = `\n if (!runningTests) {\n require(\"${modulePrefix}/app\")[\"default\"].create(${JSON.stringify(appConfig || {})});\n }\n `.replace(/\\s/g, '');\n\n const appBoot = contentForConfig['/index.html']['app-boot'];\n const diff = appBoot.replace(/\\s/g, '').replace(defaultAppBoot, '');\n\n if (diff.length) {\n throw new Error(`\n Your app uses at least one classic addon that provides content-for 'app-boot'. This is no longer supported.\n With Embroider, you have full control over the app-boot script, so classic addons no longer need to modify it under the hood.\n The following code is used for your app boot:\n\n ${appBoot}\n\n 1. If you want to keep the same behavior, copy and paste it to the app-boot script included in app/index.html.\n 2. Once app/index.html has the content you need, remove the present error by setting \"useAddonAppBoot\" to false in the build options.\n `);\n }\n }\n}\n\nfunction defaultAddonPackageRules(): PackageRules[] {\n return readdirSync(join(__dirname, 'addon-dependency-rules'))\n .map(filename => {\n if (filename.endsWith('.js')) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(join(__dirname, 'addon-dependency-rules', filename)).default;\n }\n })\n .filter(Boolean)\n .reduce((a, b) => a.concat(b), []);\n}\n\nconst babelFilterTemplate = jsHandlebarsCompile(`\nconst { babelFilter } = require(${JSON.stringify(require.resolve('@embroider/core'))});\nmodule.exports = babelFilter({{json-stringify skipBabel}}, \"{{js-string-escape appRoot}}\");\n`) as (params: { skipBabel: Options['skipBabel']; appRoot: string }) => string;\n\nfunction combinePackageJSON(...layers: object[]) {\n function custom(objValue: any, srcValue: any, key: string, _object: any, _source: any, stack: { size: number }) {\n if (key === 'keywords' && stack.size === 0) {\n if (Array.isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n }\n }\n return mergeWith({}, ...layers, custom);\n}\n\nfunction addCachablePlugin(babelConfig: TransformOptions) {\n if (Array.isArray(babelConfig.plugins) && babelConfig.plugins.length > 0) {\n const plugins = Object.create(null);\n plugins[cacheBustingPluginPath] = cacheBustingPluginVersion;\n\n for (const plugin of babelConfig.plugins) {\n let absolutePathToPlugin: string;\n if (Array.isArray(plugin) && typeof plugin[0] === 'string') {\n absolutePathToPlugin = plugin[0] as string;\n } else if (typeof plugin === 'string') {\n absolutePathToPlugin = plugin;\n } else {\n throw new Error(`[Embroider] a babel plugin without an absolute path was from: ${plugin}`);\n }\n\n plugins[absolutePathToPlugin] = maybeNodeModuleVersion(absolutePathToPlugin);\n }\n\n babelConfig.plugins.push([\n cacheBustingPluginPath,\n {\n plugins,\n },\n ]);\n }\n}\n\ninterface TreeNames {\n appJS: BroccoliNode;\n htmlTree: BroccoliNode;\n publicTree: BroccoliNode | undefined;\n configTree: BroccoliNode;\n}\n"]}
|
package/src/compat-app.js
CHANGED
package/src/compat-app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat-app.js","sourceRoot":"","sources":["compat-app.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,0CAA+G;AAE/G,uCAAgD;AAChD,2DAA6C;AAC7C,mCAA2C;AAC3C,+BAAsD;AACtD,sEAA0C;AAC1C,gFAA8C;AAC9C,qDAA6C;AAC7C,sDAA8B;AAC9B,8EAAoD;AACpD,2CAAuC;AAEvC,uCAA6G;AAC7G,gEAAsC;AACtC,oEAA2C;AAE3C,qDAAmF;AACnF,gFAAsD;AACtD,sEAAqC;AACrC,6DAAqC;AACrC,iEAA4F;AAC5F,kGAA4D;AAC5D,2BAAkC;AAClC,oDAA4B;AAE5B,6DAAwD;AACxD,0DAAiC;AAQjC,gEAAgE;AAChE,8EAA8E;AAC9E,MAAqB,SAAS;IAS5B,IAAY,OAAO;;QACjB,OAAO,MAAA,MAAA,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,0CAAE,QAAQ,CAAC,aAAa,CAAC,mCAAI,KAAK,CAAC;IAC5F,CAAC;IAED,IAAI,IAAI;QACN,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,wCAAwC;YACxC,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;QAC1C,CAAC;aAAM,CAAC;YACN,4EAA4E;YAC5E,cAAc;YACd,OAAO,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QACtD,CAAC;IACH,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC;IACzC,CAAC;IAGD,IAAI,IAAI;QACN,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,qEAAqE;YACrE,OAAO,IAAA,WAAI,EAAC,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,UAAU,EAAE,EAA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ADC,IAAA,4BAAO,GAAE;kDAyBT;AAGO;IADP,IAAA,4BAAO,GAAE;qDAgBT;AA8UD;IADC,IAAA,4BAAO,GAAE;8CAGT;AAyED;IADC,IAAA,4BAAO,GAAE;2CAcT","sourcesContent":["import type { Node as BroccoliNode } from 'broccoli-node-api';\nimport type { Stage, Package } from '@embroider/core';\nimport { PackageCache, WaitForTrees, RewrittenPackageCache, locateEmbroiderWorkingDir } from '@embroider/core';\nimport type Options from './options';\nimport { optionsWithDefaults } from './options';\nimport { Memoize } from 'typescript-memoize';\nimport { sync as pkgUpSync } from 'pkg-up';\nimport { join, dirname, isAbsolute, sep } from 'path';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport { WatchedDir } from 'broccoli-source';\nimport resolve from 'resolve';\nimport ContentForConfig from './content-for-config';\nimport { V1Config } from './v1-config';\nimport type { AddonMeta, EmberAppInstance, OutputFileToInputFileMap, PackageInfo } from '@embroider/core';\nimport { writeJSONSync, ensureDirSync, copySync, pathExistsSync, existsSync, writeFileSync } from 'fs-extra';\nimport AddToTree from './add-to-tree';\nimport DummyPackage from './dummy-package';\nimport type { TransformOptions } from '@babel/core';\nimport { isEmbroiderMacrosPlugin, MacrosConfig } from '@embroider/macros/src/node';\nimport resolvePackagePath from 'resolve-package-path';\nimport Concat from 'broccoli-concat';\nimport mapKeys from 'lodash/mapKeys';\nimport { isEmberAutoImportDynamic, isInlinePrecompilePlugin } from './detect-babel-plugins';\nimport loadAstPlugins from './prepare-htmlbars-ast-plugins';\nimport { readFileSync } from 'fs';\nimport semver from 'semver';\nimport type { Transform } from 'babel-plugin-ember-template-compilation';\nimport { CompatAppBuilder } from './compat-app-builder';\nimport walkSync from 'walk-sync';\n\ninterface Group {\n outputFiles: OutputFileToInputFileMap;\n implicitKey: '_implicitStyles' | '_implicitScripts';\n vendorOutputPath: 'string';\n}\n\n// This runs at broccoli-pipeline-construction time, whereas the\n// CompatAppBuilder instance only becomes available during tree-building time.\nexport default class CompatApp {\n private annotation = '@embroider/compat/app';\n private active: CompatAppBuilder | undefined;\n readonly options: Required<Options>;\n\n private _publicAssets: { [filePath: string]: string } = Object.create(null);\n private _implicitScripts: string[] = [];\n private _implicitStyles: string[] = [];\n\n private get isDummy(): boolean {\n return this.legacyEmberAppInstance.project.pkg.keywords?.includes('ember-addon') ?? false;\n }\n\n get name(): string {\n if (this.isDummy) {\n // here we accept the ember-cli behavior\n return this.legacyEmberAppInstance.name;\n } else {\n // always the name from package.json. Not the one that apps may have weirdly\n // customized.\n return this.legacyEmberAppInstance.project.pkg.name;\n }\n }\n\n get env(): string {\n return this.legacyEmberAppInstance.env;\n }\n\n @Memoize()\n get root(): string {\n if (this.isDummy) {\n // this is the Known Hack for finding the true root of the dummy app.\n return join(this.legacyEmberAppInstance.project.configPath(), '..', '..');\n } else {\n return dirname(pkgUpSync({ cwd: this.legacyEmberAppInstance.project.root })!);\n }\n }\n\n @Memoize()\n private get emberCLILocation() {\n const emberCLIPackage = resolvePackagePath('ember-cli', this.root);\n\n if (emberCLIPackage === null) {\n throw new Error(`Embroider: cannot resolve ember-cli's package.json`);\n }\n\n return dirname(emberCLIPackage);\n }\n\n @Memoize()\n get hasCompiledStyles() {\n return semver.gte(JSON.parse(readFileSync(`${this.emberCLILocation}/package.json`, 'utf8')).version, '3.18.0');\n }\n\n private requireFromEmberCLI(specifier: string) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(resolve.sync(specifier, { basedir: this.emberCLILocation }));\n }\n\n private get 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, BroccoliNode> {\n return new Map();\n }\n\n @Memoize()\n get preprocessRegistry() {\n return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');\n }\n\n get shouldBuildTests(): boolean {\n return this.legacyEmberAppInstance.tests || false;\n }\n\n configPath(): string {\n return this.legacyEmberAppInstance.project.configPath();\n }\n\n private get configTree() {\n return new this.configLoader(dirname(this.configPath()), {\n env: this.legacyEmberAppInstance.env,\n tests: this.legacyEmberAppInstance.tests || false,\n project: this.legacyEmberAppInstance.project,\n });\n }\n\n @Memoize()\n private get config(): V1Config {\n return new V1Config(this.configTree, this.legacyEmberAppInstance.env);\n }\n\n @Memoize()\n get testConfig(): V1Config | undefined {\n if (this.shouldBuildTests) {\n return new V1Config(this.configTree, 'test');\n }\n }\n\n @Memoize()\n private get contentFor(): ContentForConfig {\n const configPaths = [\n { file: '/index.html', path: join('environments', `${this.legacyEmberAppInstance.env}.json`) },\n ];\n if (this.shouldBuildTests) configPaths.push({ file: '/tests/index.html', path: join('environments', `test.json`) });\n return new ContentForConfig(this.configTree, {\n availableContentForTypes: this.options.availableContentForTypes,\n configPaths,\n pattern: this.filteredPatternsByContentFor.contentFor,\n });\n }\n\n get autoRun(): boolean {\n return this.legacyEmberAppInstance.options.autoRun;\n }\n\n private get storeConfigInMeta(): boolean {\n return this.legacyEmberAppInstance.options.storeConfigInMeta;\n }\n\n @Memoize()\n private get configReplacePatterns() {\n return this.appUtils.configReplacePatterns({\n addons: this.legacyEmberAppInstance.project.addons,\n autoRun: this.autoRun,\n storeConfigInMeta: this.storeConfigInMeta,\n });\n }\n\n private get filteredPatternsByContentFor() {\n const filter = '/{{content-for [\\'\"](.+?)[\"\\']}}/g';\n return {\n contentFor: this.configReplacePatterns.find((pattern: any) => filter.includes(pattern.match.toString())),\n others: this.configReplacePatterns.filter((pattern: any) => !filter.includes(pattern.match.toString())),\n };\n }\n\n private get htmlTree() {\n if (this.legacyEmberAppInstance.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.legacyEmberAppInstance.options.outputPaths.app.html;\n let index = buildFunnel(this.legacyEmberAppInstance.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.legacyEmberAppInstance.env}.json`),\n files: [indexFilePath],\n patterns: this.filteredPatternsByContentFor.others,\n annotation: 'ConfigReplace/indexTree',\n });\n }\n\n private get testIndexTree() {\n let index = buildFunnel(this.legacyEmberAppInstance.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.filteredPatternsByContentFor.others,\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.legacyEmberAppInstance.project as any).findAddonByName('ember-cli-babel');\n const babelConfig = babelAddon.buildBabelOptions({\n 'ember-cli-babel': {\n ...this.legacyEmberAppInstance.options['ember-cli-babel'],\n includeExternalHelpers: true,\n compileModules: false,\n disableDebugTooling: false,\n disablePresetEnv: false,\n disableEmberModulesAPIPolyfill: 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.legacyEmberAppInstance.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.legacyEmberAppInstance.project.addons.find((a: any) => a.name === 'ember-cli-babel');\n if (babelAddon) {\n let babelAddonMajor = Number(babelAddon.pkg.version.split('.')[0]);\n let babelMajor: number | undefined = babelAddonMajor;\n if (babelAddonMajor >= 8) {\n // `ember-cli-babel` v8 breaks lockstep with Babel, because it now\n // defines `@babel/core` as a peer dependency, so we need to check the\n // project's version of `@babel/core`:\n let babelVersion = this.legacyEmberAppInstance.project.pkg.devDependencies?.['@babel/core'];\n if (babelVersion) {\n babelMajor = semver.coerce(babelVersion)?.major;\n } else {\n babelMajor = 7;\n }\n }\n if (babelMajor !== 7) {\n throw new Error('`@embroider/compat` only supports apps and addons that use Babel v7.');\n }\n return babelMajor;\n }\n // if we didn't have our own babel plugin at all, it's safe to parse our\n // code with 7.\n return 7;\n }\n\n @Memoize()\n private transformedNodeFiles(): Map<string, string> {\n // any app.imports from node_modules that need custom transforms will need\n // to get copied into our own synthesized vendor package. app.imports from\n // node_modules that *don't* need custom transforms can just stay where they\n // are.\n let transformed = new Map();\n for (let transformConfig of this.legacyEmberAppInstance._customTransformsMap.values()) {\n for (let filename of transformConfig.files as string[]) {\n let preresolved = this.preresolvedNodeFile(filename);\n if (preresolved) {\n transformed.set(filename, preresolved);\n }\n }\n }\n return transformed;\n }\n\n private preresolvedNodeFile(filename: string) {\n // this regex is an exact copy of how ember-cli does this, so we align.\n let match = filename.match(/^node_modules\\/((@[^/]+\\/)?[^/]+)\\//);\n if (match) {\n // ember-cli has already done its own resolution of\n // `app.import('node_modules/something/...')`, so we go find its answer.\n for (let { name, path } of this.legacyEmberAppInstance._nodeModules.values()) {\n if (match[1] === name) {\n return filename.replace(match[0], path + sep);\n }\n }\n throw new Error(`bug: expected ember-cli to already have a resolved path for asset ${filename}`);\n }\n }\n\n private combinedVendor(addonTrees: BroccoliNode[]): BroccoliNode {\n let trees = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: 'vendor',\n destDir: 'vendor',\n })\n );\n if (this.vendorTree) {\n trees.push(\n buildFunnel(this.vendorTree, {\n destDir: 'vendor',\n })\n );\n }\n\n const tree = mergeTrees(trees, { overwrite: true });\n\n const outputGroups: Group[] = [\n // scripts\n {\n outputFiles: this.legacyEmberAppInstance._scriptOutputFiles,\n implicitKey: '_implicitScripts',\n vendorOutputPath: this.legacyEmberAppInstance.options.outputPaths.vendor.js,\n },\n // styles\n {\n outputFiles: this.legacyEmberAppInstance._styleOutputFiles,\n implicitKey: '_implicitStyles',\n vendorOutputPath: this.legacyEmberAppInstance.options.outputPaths.vendor.css,\n },\n ];\n\n const concatentations = [];\n\n // support: app.import / outputFile / using\n for (let entry of outputGroups) {\n const { outputFiles, implicitKey, vendorOutputPath } = entry;\n for (let importPath of Object.keys(outputFiles)) {\n const headerFiles = outputFiles[importPath];\n\n if (importPath === vendorOutputPath) {\n // these are the default ember-cli output files vendor.js or\n // vendor.css. Let embroider handle these.\n this[implicitKey] = headerFiles;\n } else if (headerFiles.length === 0) {\n // something went really wrong, open an issue\n throw new Error('Embroider: EWUT');\n } else if (headerFiles.length === 1) {\n // app.import(x, { outputFile: y }); where only one app.imports had this outputFile\n //\n // No concat needed. Simply serialize the remapping in the addon's\n // manifest, this ensures it is included in the final output with no extra work.\n this._publicAssets[headerFiles[0]] = importPath;\n } else {\n // app.import(x, { outputFile: y }); where multiple app.imports share one outputFile\n // Concat needed. Perform concat, and include the outputFile in the\n // addon's manifest. This ensures it is included in the final output\n this._publicAssets[importPath] = importPath;\n\n concatentations.push(\n new Concat(tree, {\n headerFiles,\n outputFile: importPath,\n annotation: `Package ${importPath}`,\n separator: '\\n;',\n sourceMapConfig: this.legacyEmberAppInstance.options['sourcemaps'],\n })\n );\n }\n }\n }\n\n this.addOtherAssets();\n return mergeTrees([tree, ...concatentations], { overwrite: true });\n }\n\n private addOtherAssets() {\n for (let asset of this.legacyEmberAppInstance.otherAssetPaths) {\n this._publicAssets[`${asset.src}/${asset.file}`] = `${asset.dest}/${asset.file}`;\n }\n }\n\n private addNodeAssets(inputTree: BroccoliNode): BroccoliNode {\n let transformedNodeFiles = this.transformedNodeFiles();\n\n return new AddToTree(inputTree, outputPath => {\n for (let [localDestPath, sourcePath] of transformedNodeFiles) {\n let destPath = join(outputPath, localDestPath);\n ensureDirSync(dirname(destPath));\n copySync(sourcePath, destPath);\n }\n\n if (this.shouldBuildTests) {\n writeFileSync(\n join(outputPath, 'testem.js'),\n `/*\n * This is dummy file that exists for the sole purpose\n * of allowing tests to run directly in the browser as\n * well as by Testem.\n *\n * Testem is configured to run tests directly against\n * the test build of index.html, which requires a\n * snippet to load the testem.js file:\n * <script src=\"/testem.js\"></script>\n * This has to go before the qunit framework and app\n * tests are loaded.\n *\n * Testem internally supplies this file. However, if you\n * run the tests directly in the browser (localhost:8000/tests),\n * this file does not exist.\n *\n * Hence the purpose of this fake file. This file is served\n * directly from the express server to satisify the script load.\n*/`\n );\n this._publicAssets['/testem.js'] = './testem.js';\n }\n\n let remapAsset = this.remapAsset.bind(this);\n\n let addonMeta: AddonMeta = {\n type: 'addon',\n version: 2,\n 'implicit-scripts': this._implicitScripts.map(remapAsset),\n 'implicit-styles': this._implicitStyles.map(remapAsset),\n 'implicit-test-scripts': this.legacyEmberAppInstance.legacyTestFilesToAppend.map(remapAsset),\n 'implicit-test-styles': this.legacyEmberAppInstance.vendorTestStaticStyles.map(remapAsset),\n 'public-assets': mapKeys(this._publicAssets, (_, key) => remapAsset(key)),\n };\n let meta: PackageInfo = {\n name: '@embroider/synthesized-vendor',\n version: '0.0.0',\n keywords: ['ember-addon'],\n 'ember-addon': addonMeta,\n };\n writeJSONSync(join(outputPath, 'package.json'), meta, { spaces: 2 });\n });\n }\n\n synthesizeVendorPackage(addonTrees: BroccoliNode[]): BroccoliNode {\n return this.applyCustomTransforms(this.addNodeAssets(this.combinedVendor(addonTrees)));\n }\n\n private combinedStyles(addonTrees: BroccoliNode[]): BroccoliNode {\n let trees: BroccoliNode[] = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: '_app_styles_',\n })\n );\n let appStyles = this.legacyEmberAppInstance.trees.styles as BroccoliNode | undefined;\n if (appStyles) {\n // Workaround for https://github.com/ember-cli/ember-cli/issues/9020\n //\n // The default app styles tree is unwatched and relies on side effects\n // elsewhere in ember-cli's build pipeline to actually get rebuilds to\n // work. Here we need it to actually be watched properly if we want to\n // rely on it, particularly when using BROCCOLI_ENABLED_MEMOIZE.\n if ((appStyles as any)._watched === false && (appStyles as any)._directoryPath) {\n appStyles = new WatchedDir((appStyles as any)._directoryPath);\n }\n trees.push(appStyles);\n }\n return mergeTrees(trees, { overwrite: true, annotation: 'embroider-v1-app-combined-styles' });\n }\n\n synthesizeStylesPackage(addonTrees: BroccoliNode[]): BroccoliNode {\n let options = {\n // we're deliberately not allowing this to be customized. It's an\n // internal implementation detail, and respecting outputPaths here is\n // unnecessary complexity. The corresponding code that adjusts the HTML\n // <link> is in updateHTML in app.ts.\n outputPaths: { app: `/assets/${this.name}.css` },\n registry: this.legacyEmberAppInstance.registry,\n minifyCSS: this.legacyEmberAppInstance.options.minifyCSS.options,\n };\n\n let nestedInput = buildFunnel(this.combinedStyles(addonTrees), { destDir: 'app/styles' });\n let styles = this.preprocessors.preprocessCss(nestedInput, '/app/styles', '/assets', options);\n\n return new AddToTree(styles, outputPath => {\n let addonMeta: AddonMeta = {\n type: 'addon',\n version: 2,\n 'public-assets': {},\n };\n let assetPath = join(outputPath, 'assets');\n if (pathExistsSync(assetPath)) {\n for (let file of walkSync(assetPath, { directories: false })) {\n addonMeta['public-assets']![`./assets/${file}`] = `/assets/${file}`;\n }\n }\n let meta: PackageInfo = {\n name: '@embroider/synthesized-styles',\n version: '0.0.0',\n keywords: ['ember-addon'],\n 'ember-addon': addonMeta,\n };\n writeJSONSync(join(outputPath, 'package.json'), meta, { spaces: 2 });\n });\n }\n\n // this is taken nearly verbatim from ember-cli.\n private applyCustomTransforms(externalTree: BroccoliNode) {\n for (let customTransformEntry of this.legacyEmberAppInstance._customTransformsMap) {\n let transformName = customTransformEntry[0];\n let transformConfig = customTransformEntry[1];\n\n let transformTree = buildFunnel(externalTree, {\n files: transformConfig.files,\n annotation: `Funnel (custom transform: ${transformName})`,\n });\n\n externalTree = mergeTrees([externalTree, transformConfig.callback(transformTree, transformConfig.options)], {\n annotation: `TreeMerger (custom transform: ${transformName})`,\n overwrite: true,\n });\n }\n return externalTree;\n }\n\n private remapAsset(asset: string) {\n if (this.transformedNodeFiles().has(asset)) {\n // transformed node assets become local paths, because we have copied\n // those ones into our synthesized vendor package.\n return './' + asset;\n }\n let preresolved = this.preresolvedNodeFile(asset);\n if (preresolved) {\n // non-transformed node assets point directly at their pre-resolved\n // original files (this is an absolute path).\n return preresolved;\n }\n // non node assets are local paths. They need an explicit `/` or `.` at\n // the start.\n if (asset.startsWith('.') || isAbsolute(asset)) {\n return asset;\n }\n return './' + asset;\n }\n\n private preprocessJS(tree: BroccoliNode): BroccoliNode {\n // we're saving all our babel compilation for the final stage packager\n this.legacyEmberAppInstance.registry.remove('js', 'ember-cli-babel');\n\n // auto-import is supported natively so we don't need it here\n this.legacyEmberAppInstance.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.legacyEmberAppInstance.registry,\n });\n\n tree = buildFunnel(tree, { srcDir: this.name });\n\n return tree;\n }\n\n get htmlbarsPlugins(): Transform[] {\n let plugins = loadAstPlugins(this.legacyEmberAppInstance.registry);\n // even if the app was using @embroider/macros, we drop it from the config\n // here in favor of our globally-configured one.\n plugins = plugins.filter((p: any) => !isEmbroiderMacrosPlugin(p));\n return plugins;\n }\n\n // our own appTree. Not to be confused with the one that combines the app js\n // from all addons too.\n private get appTree(): BroccoliNode {\n return this.preprocessJS(\n buildFunnel(this.legacyEmberAppInstance.trees.app, {\n exclude: ['styles/**', '*.html'],\n })\n );\n }\n\n private get testsTree(): BroccoliNode | undefined {\n if (this.shouldBuildTests && this.legacyEmberAppInstance.trees.tests) {\n return this.preprocessJS(\n buildFunnel(this.legacyEmberAppInstance.trees.tests, {\n destDir: 'tests',\n })\n );\n }\n }\n\n private get lintTree(): BroccoliNode | undefined {\n if (this.shouldBuildTests) {\n return this.legacyEmberAppInstance.getLintTests();\n }\n }\n\n private get vendorTree(): BroccoliNode | undefined {\n return this.ensureTree(this.legacyEmberAppInstance.trees.vendor);\n }\n\n private ensureTree(maybeTree: string | BroccoliNode | undefined): BroccoliNode | undefined {\n if (typeof maybeTree === 'string') {\n // this is deliberately mimicking how ember-cli does it. We don't use\n // `this.root` on purpose, because that can differ from what ember-cli\n // considers the project.root. And we don't use path.resolve even though\n // that seems possibly more correct, because ember-cli always assumes the\n // input is relative.\n let resolvedPath = join(this.legacyEmberAppInstance.project.root, maybeTree);\n if (existsSync(resolvedPath)) {\n return new WatchedDir(maybeTree);\n } else {\n return undefined;\n }\n }\n return maybeTree;\n }\n\n @Memoize()\n private get preprocessors(): Preprocessors {\n return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');\n }\n\n private get publicTree(): BroccoliNode | undefined {\n return this.ensureTree(this.legacyEmberAppInstance.trees.public);\n }\n\n private processAppJS(): { appJS: BroccoliNode } {\n let appTree = this.appTree;\n let testsTree = this.testsTree;\n let lintTree = this.lintTree;\n\n let trees: BroccoliNode[] = [];\n trees.push(appTree);\n\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 readonly macrosConfig: MacrosConfig;\n\n constructor(readonly legacyEmberAppInstance: EmberAppInstance, _options?: Options) {\n this.options = optionsWithDefaults(_options);\n\n this.macrosConfig = MacrosConfig.for(legacyEmberAppInstance, this.root);\n if (this.env !== 'production') {\n this.macrosConfig.enablePackageDevelopment(this.root);\n this.macrosConfig.enableRuntimeMode();\n if (this.isDummy) {\n // dummy apps automatically put their owning addon under development too\n this.macrosConfig.enablePackageDevelopment(\n dirname(pkgUpSync({ cwd: this.legacyEmberAppInstance.project.root })!)\n );\n }\n }\n\n // this uses globalConfig because it's a way for packages to ask \"is\n // Embroider doing this build?\". So it's necessarily global, not scoped to\n // any subgraph of dependencies.\n this.macrosConfig.setGlobalConfig(__filename, `@embroider/core`, {\n // this is hard-coded to true because it literally means \"embroider is\n // building this Ember app\". You can see non-true when using the Embroider\n // macros in a classic build.\n active: true,\n });\n }\n\n private inTrees(prevStageTree: BroccoliNode) {\n let publicTree = this.publicTree;\n let configTree = this.config;\n let contentForTree = this.contentFor;\n\n if (this.options.extraPublicTrees.length > 0) {\n publicTree = mergeTrees([publicTree, ...this.options.extraPublicTrees].filter(Boolean) as BroccoliNode[]);\n }\n\n return {\n appJS: this.processAppJS().appJS,\n htmlTree: this.htmlTree,\n publicTree,\n configTree,\n contentForTree,\n prevStageTree,\n };\n }\n\n @Memoize()\n appPackage(): Package {\n // this is deliberately not RewrittenPackageCache, because it's supposed to\n // be the original copy of the app with all the original dependencies.\n let packageCache = PackageCache.shared('embroider', this.root);\n if (this.isDummy) {\n return new DummyPackage(\n this.root,\n this.legacyEmberAppInstance.project.root,\n packageCache as unknown as PackageCache // TODO: cast won't be needed when refactor is complete\n );\n } else {\n return packageCache.get(this.root);\n }\n }\n\n private async instantiate(\n root: string,\n packageCache: RewrittenPackageCache,\n configTree: V1Config,\n contentForTree: ContentForConfig\n ) {\n let origAppPkg = this.appPackage();\n let movedAppPkg = packageCache.withRewrittenDeps(origAppPkg);\n let workingDir = locateEmbroiderWorkingDir(this.root);\n return new CompatAppBuilder(\n root,\n origAppPkg,\n movedAppPkg,\n this.options,\n this,\n configTree,\n contentForTree,\n packageCache.get(join(workingDir, 'rewritten-packages', '@embroider', 'synthesized-vendor')),\n packageCache.get(join(workingDir, 'rewritten-packages', '@embroider', 'synthesized-styles'))\n );\n }\n\n asStage(prevStage: Stage): Stage {\n let resolve: (result: { outputPath: string }) => void;\n let promise: Promise<{ outputPath: string }> = new Promise(r => (resolve = r));\n\n let tree = () => {\n let inTrees = this.inTrees(prevStage.tree);\n return new WaitForTrees(inTrees, this.annotation, async treePaths => {\n if (!this.active) {\n let { outputPath } = await prevStage.ready();\n let packageCache = RewrittenPackageCache.shared('embroider', this.root);\n this.active = await this.instantiate(outputPath, packageCache, inTrees.configTree, inTrees.contentForTree);\n resolve({ outputPath });\n }\n await this.active.build(treePaths);\n });\n };\n\n return {\n get inputPath() {\n return prevStage.inputPath;\n },\n ready: async () => {\n return await promise;\n },\n get tree() {\n return tree();\n },\n };\n }\n}\n\ninterface Preprocessors {\n preprocessJs(tree: BroccoliNode, a: string, b: string, options: object): BroccoliNode;\n preprocessCss(tree: BroccoliNode, a: string, b: string, options: object): BroccoliNode;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compat-app.js","sourceRoot":"","sources":["compat-app.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,0CAA+G;AAE/G,uCAAgD;AAChD,2DAA6C;AAC7C,mCAA2C;AAC3C,+BAAsD;AACtD,sEAA0C;AAC1C,gFAA8C;AAC9C,qDAA6C;AAC7C,sDAA8B;AAC9B,8EAAoD;AACpD,2CAAuC;AAEvC,uCAA6G;AAC7G,gEAAsC;AACtC,oEAA2C;AAE3C,qDAAmF;AACnF,gFAAsD;AACtD,sEAAqC;AACrC,6DAAqC;AACrC,iEAA4F;AAC5F,kGAA4D;AAC5D,2BAAkC;AAClC,oDAA4B;AAE5B,6DAAwD;AACxD,0DAAiC;AAQjC,gEAAgE;AAChE,8EAA8E;AAC9E,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AC,SAAS,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,OAAO;YACL,IAAI,SAAS;gBACX,OAAO,SAAS,CAAC,SAAS,CAAC;YAC7B,CAAC;YACD,KAAK,EAAE,KAAK,IAAI,EAAE;gBAChB,OAAO,MAAM,OAAO,CAAC;YACvB,CAAC;YACD,IAAI,IAAI;gBACN,OAAO,IAAI,EAAE,CAAC;YAChB,CAAC;SACF,CAAC;IACJ,CAAC;CACF;AA7vBD,4BA6vBC;AAhuBC;IADC,IAAA,4BAAO,GAAE;qCAQT;AAGD;IADC,IAAA,4BAAO,GAAE;iDAST;AAGD;IADC,IAAA,4BAAO,GAAE;kDAGT;AAoBD;IADC,IAAA,4BAAO,GAAE;+CAGT;AAGD;IADC,IAAA,4BAAO,GAAE;mDAGT;AAmBD;IADC,IAAA,4BAAO,GAAE;uCAGT;AAGD;IADC,IAAA,4BAAO,GAAE;2CAKT;AAGD;IADC,IAAA,4BAAO,GAAE;2CAWT;AAWD;IADC,IAAA,4BAAO,GAAE;sDAOT;AAkDD;IADC,IAAA,4BAAO,GAAE;4CA0DT;AAGD;IADC,IAAA,4BAAO,GAAE;kDAyBT;AAGO;IADP,IAAA,4BAAO,GAAE;qDAgBT;AA+UD;IADC,IAAA,4BAAO,GAAE;8CAGT;AAyED;IADC,IAAA,4BAAO,GAAE;2CAcT","sourcesContent":["import type { Node as BroccoliNode } from 'broccoli-node-api';\nimport type { Stage, Package } from '@embroider/core';\nimport { PackageCache, WaitForTrees, RewrittenPackageCache, locateEmbroiderWorkingDir } from '@embroider/core';\nimport type Options from './options';\nimport { optionsWithDefaults } from './options';\nimport { Memoize } from 'typescript-memoize';\nimport { sync as pkgUpSync } from 'pkg-up';\nimport { join, dirname, isAbsolute, sep } from 'path';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport { WatchedDir } from 'broccoli-source';\nimport resolve from 'resolve';\nimport ContentForConfig from './content-for-config';\nimport { V1Config } from './v1-config';\nimport type { AddonMeta, EmberAppInstance, OutputFileToInputFileMap, PackageInfo } from '@embroider/core';\nimport { writeJSONSync, ensureDirSync, copySync, pathExistsSync, existsSync, writeFileSync } from 'fs-extra';\nimport AddToTree from './add-to-tree';\nimport DummyPackage from './dummy-package';\nimport type { TransformOptions } from '@babel/core';\nimport { isEmbroiderMacrosPlugin, MacrosConfig } from '@embroider/macros/src/node';\nimport resolvePackagePath from 'resolve-package-path';\nimport Concat from 'broccoli-concat';\nimport mapKeys from 'lodash/mapKeys';\nimport { isEmberAutoImportDynamic, isInlinePrecompilePlugin } from './detect-babel-plugins';\nimport loadAstPlugins from './prepare-htmlbars-ast-plugins';\nimport { readFileSync } from 'fs';\nimport semver from 'semver';\nimport type { Transform } from 'babel-plugin-ember-template-compilation';\nimport { CompatAppBuilder } from './compat-app-builder';\nimport walkSync from 'walk-sync';\n\ninterface Group {\n outputFiles: OutputFileToInputFileMap;\n implicitKey: '_implicitStyles' | '_implicitScripts';\n vendorOutputPath: 'string';\n}\n\n// This runs at broccoli-pipeline-construction time, whereas the\n// CompatAppBuilder instance only becomes available during tree-building time.\nexport default class CompatApp {\n private annotation = '@embroider/compat/app';\n private active: CompatAppBuilder | undefined;\n readonly options: Required<Options>;\n\n private _publicAssets: { [filePath: string]: string } = Object.create(null);\n private _implicitScripts: string[] = [];\n private _implicitStyles: string[] = [];\n\n private get isDummy(): boolean {\n return this.legacyEmberAppInstance.project.pkg.keywords?.includes('ember-addon') ?? false;\n }\n\n get name(): string {\n if (this.isDummy) {\n // here we accept the ember-cli behavior\n return this.legacyEmberAppInstance.name;\n } else {\n // always the name from package.json. Not the one that apps may have weirdly\n // customized.\n return this.legacyEmberAppInstance.project.pkg.name;\n }\n }\n\n get env(): string {\n return this.legacyEmberAppInstance.env;\n }\n\n @Memoize()\n get root(): string {\n if (this.isDummy) {\n // this is the Known Hack for finding the true root of the dummy app.\n return join(this.legacyEmberAppInstance.project.configPath(), '..', '..');\n } else {\n return dirname(pkgUpSync({ cwd: this.legacyEmberAppInstance.project.root })!);\n }\n }\n\n @Memoize()\n private get emberCLILocation() {\n const emberCLIPackage = resolvePackagePath('ember-cli', this.root);\n\n if (emberCLIPackage === null) {\n throw new Error(`Embroider: cannot resolve ember-cli's package.json`);\n }\n\n return dirname(emberCLIPackage);\n }\n\n @Memoize()\n get hasCompiledStyles() {\n return semver.gte(JSON.parse(readFileSync(`${this.emberCLILocation}/package.json`, 'utf8')).version, '3.18.0');\n }\n\n private requireFromEmberCLI(specifier: string) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(resolve.sync(specifier, { basedir: this.emberCLILocation }));\n }\n\n private get 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, BroccoliNode> {\n return new Map();\n }\n\n @Memoize()\n get preprocessRegistry() {\n return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');\n }\n\n get shouldBuildTests(): boolean {\n return this.legacyEmberAppInstance.tests || false;\n }\n\n configPath(): string {\n return this.legacyEmberAppInstance.project.configPath();\n }\n\n private get configTree() {\n return new this.configLoader(dirname(this.configPath()), {\n env: this.legacyEmberAppInstance.env,\n tests: this.legacyEmberAppInstance.tests || false,\n project: this.legacyEmberAppInstance.project,\n });\n }\n\n @Memoize()\n private get config(): V1Config {\n return new V1Config(this.configTree, this.legacyEmberAppInstance.env);\n }\n\n @Memoize()\n get testConfig(): V1Config | undefined {\n if (this.shouldBuildTests) {\n return new V1Config(this.configTree, 'test');\n }\n }\n\n @Memoize()\n private get contentFor(): ContentForConfig {\n const configPaths = [\n { file: '/index.html', path: join('environments', `${this.legacyEmberAppInstance.env}.json`) },\n ];\n if (this.shouldBuildTests) configPaths.push({ file: '/tests/index.html', path: join('environments', `test.json`) });\n return new ContentForConfig(this.configTree, {\n availableContentForTypes: this.options.availableContentForTypes,\n configPaths,\n pattern: this.filteredPatternsByContentFor.contentFor,\n });\n }\n\n get autoRun(): boolean {\n return this.legacyEmberAppInstance.options.autoRun;\n }\n\n private get storeConfigInMeta(): boolean {\n return this.legacyEmberAppInstance.options.storeConfigInMeta;\n }\n\n @Memoize()\n private get configReplacePatterns() {\n return this.appUtils.configReplacePatterns({\n addons: this.legacyEmberAppInstance.project.addons,\n autoRun: this.autoRun,\n storeConfigInMeta: this.storeConfigInMeta,\n });\n }\n\n private get filteredPatternsByContentFor() {\n const filter = '/{{content-for [\\'\"](.+?)[\"\\']}}/g';\n return {\n contentFor: this.configReplacePatterns.find((pattern: any) => filter.includes(pattern.match.toString())),\n others: this.configReplacePatterns.filter((pattern: any) => !filter.includes(pattern.match.toString())),\n };\n }\n\n private get htmlTree() {\n if (this.legacyEmberAppInstance.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.legacyEmberAppInstance.options.outputPaths.app.html;\n let index = buildFunnel(this.legacyEmberAppInstance.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.legacyEmberAppInstance.env}.json`),\n files: [indexFilePath],\n patterns: this.filteredPatternsByContentFor.others,\n annotation: 'ConfigReplace/indexTree',\n });\n }\n\n private get testIndexTree() {\n let index = buildFunnel(this.legacyEmberAppInstance.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.filteredPatternsByContentFor.others,\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.legacyEmberAppInstance.project as any).findAddonByName('ember-cli-babel');\n const babelConfig = babelAddon.buildBabelOptions({\n 'ember-cli-babel': {\n ...this.legacyEmberAppInstance.options['ember-cli-babel'],\n includeExternalHelpers: true,\n compileModules: false,\n disableDebugTooling: false,\n disablePresetEnv: false,\n disableEmberModulesAPIPolyfill: 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.legacyEmberAppInstance.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.legacyEmberAppInstance.project.addons.find((a: any) => a.name === 'ember-cli-babel');\n if (babelAddon) {\n let babelAddonMajor = Number(babelAddon.pkg.version.split('.')[0]);\n let babelMajor: number | undefined = babelAddonMajor;\n if (babelAddonMajor >= 8) {\n // `ember-cli-babel` v8 breaks lockstep with Babel, because it now\n // defines `@babel/core` as a peer dependency, so we need to check the\n // project's version of `@babel/core`:\n let babelVersion = this.legacyEmberAppInstance.project.pkg.devDependencies?.['@babel/core'];\n if (babelVersion) {\n babelMajor = semver.coerce(babelVersion)?.major;\n } else {\n babelMajor = 7;\n }\n }\n if (babelMajor !== 7) {\n throw new Error('`@embroider/compat` only supports apps and addons that use Babel v7.');\n }\n return babelMajor;\n }\n // if we didn't have our own babel plugin at all, it's safe to parse our\n // code with 7.\n return 7;\n }\n\n @Memoize()\n private transformedNodeFiles(): Map<string, string> {\n // any app.imports from node_modules that need custom transforms will need\n // to get copied into our own synthesized vendor package. app.imports from\n // node_modules that *don't* need custom transforms can just stay where they\n // are.\n let transformed = new Map();\n for (let transformConfig of this.legacyEmberAppInstance._customTransformsMap.values()) {\n for (let filename of transformConfig.files as string[]) {\n let preresolved = this.preresolvedNodeFile(filename);\n if (preresolved) {\n transformed.set(filename, preresolved);\n }\n }\n }\n return transformed;\n }\n\n private preresolvedNodeFile(filename: string) {\n // this regex is an exact copy of how ember-cli does this, so we align.\n let match = filename.match(/^node_modules\\/((@[^/]+\\/)?[^/]+)\\//);\n if (match) {\n // ember-cli has already done its own resolution of\n // `app.import('node_modules/something/...')`, so we go find its answer.\n for (let { name, path } of this.legacyEmberAppInstance._nodeModules.values()) {\n if (match[1] === name) {\n return filename.replace(match[0], path + sep);\n }\n }\n throw new Error(`bug: expected ember-cli to already have a resolved path for asset ${filename}`);\n }\n }\n\n private combinedVendor(addonTrees: BroccoliNode[]): BroccoliNode {\n let trees = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: 'vendor',\n destDir: 'vendor',\n })\n );\n if (this.vendorTree) {\n trees.push(\n buildFunnel(this.vendorTree, {\n destDir: 'vendor',\n })\n );\n }\n\n const tree = mergeTrees(trees, { overwrite: true });\n\n const outputGroups: Group[] = [\n // scripts\n {\n outputFiles: this.legacyEmberAppInstance._scriptOutputFiles,\n implicitKey: '_implicitScripts',\n vendorOutputPath: this.legacyEmberAppInstance.options.outputPaths.vendor.js,\n },\n // styles\n {\n outputFiles: this.legacyEmberAppInstance._styleOutputFiles,\n implicitKey: '_implicitStyles',\n vendorOutputPath: this.legacyEmberAppInstance.options.outputPaths.vendor.css,\n },\n ];\n\n const concatentations = [];\n\n // support: app.import / outputFile / using\n for (let entry of outputGroups) {\n const { outputFiles, implicitKey, vendorOutputPath } = entry;\n for (let importPath of Object.keys(outputFiles)) {\n const headerFiles = outputFiles[importPath];\n\n if (importPath === vendorOutputPath) {\n // these are the default ember-cli output files vendor.js or\n // vendor.css. Let embroider handle these.\n this[implicitKey] = headerFiles;\n } else if (headerFiles.length === 0) {\n // something went really wrong, open an issue\n throw new Error('Embroider: EWUT');\n } else if (headerFiles.length === 1) {\n // app.import(x, { outputFile: y }); where only one app.imports had this outputFile\n //\n // No concat needed. Simply serialize the remapping in the addon's\n // manifest, this ensures it is included in the final output with no extra work.\n this._publicAssets[headerFiles[0]] = importPath;\n } else {\n // app.import(x, { outputFile: y }); where multiple app.imports share one outputFile\n // Concat needed. Perform concat, and include the outputFile in the\n // addon's manifest. This ensures it is included in the final output\n this._publicAssets[importPath] = importPath;\n\n concatentations.push(\n new Concat(tree, {\n headerFiles,\n outputFile: importPath,\n annotation: `Package ${importPath}`,\n separator: '\\n;',\n sourceMapConfig: this.legacyEmberAppInstance.options['sourcemaps'],\n })\n );\n }\n }\n }\n\n this.addOtherAssets();\n return mergeTrees([tree, ...concatentations], { overwrite: true });\n }\n\n private addOtherAssets() {\n for (let asset of this.legacyEmberAppInstance.otherAssetPaths) {\n this._publicAssets[`${asset.src}/${asset.file}`] = `${asset.dest}/${asset.file}`;\n }\n }\n\n private addNodeAssets(inputTree: BroccoliNode): BroccoliNode {\n let transformedNodeFiles = this.transformedNodeFiles();\n\n return new AddToTree(inputTree, outputPath => {\n for (let [localDestPath, sourcePath] of transformedNodeFiles) {\n let destPath = join(outputPath, localDestPath);\n ensureDirSync(dirname(destPath));\n copySync(sourcePath, destPath);\n }\n\n if (this.shouldBuildTests) {\n writeFileSync(\n join(outputPath, 'testem.js'),\n `/*\n * This is dummy file that exists for the sole purpose\n * of allowing tests to run directly in the browser as\n * well as by Testem.\n *\n * Testem is configured to run tests directly against\n * the test build of index.html, which requires a\n * snippet to load the testem.js file:\n * <script src=\"/testem.js\"></script>\n * This has to go before the qunit framework and app\n * tests are loaded.\n *\n * Testem internally supplies this file. However, if you\n * run the tests directly in the browser (localhost:8000/tests),\n * this file does not exist.\n *\n * Hence the purpose of this fake file. This file is served\n * directly from the express server to satisify the script load.\n*/`\n );\n this._publicAssets['/testem.js'] = './testem.js';\n }\n\n let remapAsset = this.remapAsset.bind(this);\n\n let addonMeta: AddonMeta = {\n type: 'addon',\n version: 2,\n 'implicit-scripts': this._implicitScripts.map(remapAsset),\n 'implicit-styles': this._implicitStyles.map(remapAsset),\n 'implicit-test-scripts': this.legacyEmberAppInstance.legacyTestFilesToAppend.map(remapAsset),\n 'implicit-test-styles': this.legacyEmberAppInstance.vendorTestStaticStyles.map(remapAsset),\n 'public-assets': mapKeys(this._publicAssets, (_, key) => remapAsset(key)),\n };\n let meta: PackageInfo = {\n name: '@embroider/synthesized-vendor',\n version: '0.0.0',\n keywords: ['ember-addon'],\n 'ember-addon': addonMeta,\n };\n writeJSONSync(join(outputPath, 'package.json'), meta, { spaces: 2 });\n });\n }\n\n synthesizeVendorPackage(addonTrees: BroccoliNode[]): BroccoliNode {\n return this.applyCustomTransforms(this.addNodeAssets(this.combinedVendor(addonTrees)));\n }\n\n private combinedStyles(addonTrees: BroccoliNode[]): BroccoliNode {\n let trees: BroccoliNode[] = addonTrees.map(tree =>\n buildFunnel(tree, {\n allowEmpty: true,\n srcDir: '_app_styles_',\n })\n );\n let appStyles = this.legacyEmberAppInstance.trees.styles as BroccoliNode | undefined;\n if (appStyles) {\n // Workaround for https://github.com/ember-cli/ember-cli/issues/9020\n //\n // The default app styles tree is unwatched and relies on side effects\n // elsewhere in ember-cli's build pipeline to actually get rebuilds to\n // work. Here we need it to actually be watched properly if we want to\n // rely on it, particularly when using BROCCOLI_ENABLED_MEMOIZE.\n if ((appStyles as any)._watched === false && (appStyles as any)._directoryPath) {\n appStyles = new WatchedDir((appStyles as any)._directoryPath);\n }\n trees.push(appStyles);\n }\n return mergeTrees(trees, { overwrite: true, annotation: 'embroider-v1-app-combined-styles' });\n }\n\n synthesizeStylesPackage(addonTrees: BroccoliNode[]): BroccoliNode {\n let options = {\n // we're deliberately not allowing this to be customized. It's an\n // internal implementation detail, and respecting outputPaths here is\n // unnecessary complexity. The corresponding code that adjusts the HTML\n // <link> is in updateHTML in app.ts.\n outputPaths: { app: `/assets/${this.name}.css` },\n registry: this.legacyEmberAppInstance.registry,\n minifyCSS: this.legacyEmberAppInstance.options.minifyCSS.options,\n };\n\n let nestedInput = buildFunnel(this.combinedStyles(addonTrees), { destDir: 'app/styles' });\n let styles = this.preprocessors.preprocessCss(nestedInput, '/app/styles', '/assets', options);\n\n return new AddToTree(styles, outputPath => {\n let addonMeta: AddonMeta = {\n type: 'addon',\n version: 2,\n 'public-assets': {},\n };\n let assetPath = join(outputPath, 'assets');\n if (pathExistsSync(assetPath)) {\n for (let file of walkSync(assetPath, { directories: false })) {\n addonMeta['public-assets']![`./assets/${file}`] = `/assets/${file}`;\n }\n }\n let meta: PackageInfo = {\n name: '@embroider/synthesized-styles',\n version: '0.0.0',\n keywords: ['ember-addon'],\n 'ember-addon': addonMeta,\n };\n writeJSONSync(join(outputPath, 'package.json'), meta, { spaces: 2 });\n });\n }\n\n // this is taken nearly verbatim from ember-cli.\n private applyCustomTransforms(externalTree: BroccoliNode) {\n for (let customTransformEntry of this.legacyEmberAppInstance._customTransformsMap) {\n let transformName = customTransformEntry[0];\n let transformConfig = customTransformEntry[1];\n\n let transformTree = buildFunnel(externalTree, {\n files: transformConfig.files,\n annotation: `Funnel (custom transform: ${transformName})`,\n });\n\n externalTree = mergeTrees([externalTree, transformConfig.callback(transformTree, transformConfig.options)], {\n annotation: `TreeMerger (custom transform: ${transformName})`,\n overwrite: true,\n });\n }\n return externalTree;\n }\n\n private remapAsset(asset: string) {\n if (this.transformedNodeFiles().has(asset)) {\n // transformed node assets become local paths, because we have copied\n // those ones into our synthesized vendor package.\n return './' + asset;\n }\n let preresolved = this.preresolvedNodeFile(asset);\n if (preresolved) {\n // non-transformed node assets point directly at their pre-resolved\n // original files (this is an absolute path).\n return preresolved;\n }\n // non node assets are local paths. They need an explicit `/` or `.` at\n // the start.\n if (asset.startsWith('.') || isAbsolute(asset)) {\n return asset;\n }\n return './' + asset;\n }\n\n private preprocessJS(tree: BroccoliNode): BroccoliNode {\n // we're saving all our babel compilation for the final stage packager\n this.legacyEmberAppInstance.registry.remove('js', 'ember-cli-babel');\n\n // auto-import is supported natively so we don't need it here\n this.legacyEmberAppInstance.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.legacyEmberAppInstance.registry,\n });\n\n tree = buildFunnel(tree, { srcDir: this.name });\n\n return tree;\n }\n\n get htmlbarsPlugins(): Transform[] {\n let plugins = loadAstPlugins(this.legacyEmberAppInstance.registry);\n // even if the app was using @embroider/macros, we drop it from the config\n // here in favor of our globally-configured one.\n plugins = plugins.filter((p: any) => !isEmbroiderMacrosPlugin(p));\n return plugins;\n }\n\n // our own appTree. Not to be confused with the one that combines the app js\n // from all addons too.\n private get appTree(): BroccoliNode {\n return this.preprocessJS(\n buildFunnel(this.legacyEmberAppInstance.trees.app, {\n exclude: ['styles/**', '*.html'],\n destDir: 'app',\n })\n );\n }\n\n private get testsTree(): BroccoliNode | undefined {\n if (this.shouldBuildTests && this.legacyEmberAppInstance.trees.tests) {\n return this.preprocessJS(\n buildFunnel(this.legacyEmberAppInstance.trees.tests, {\n destDir: 'tests',\n })\n );\n }\n }\n\n private get lintTree(): BroccoliNode | undefined {\n if (this.shouldBuildTests) {\n return this.legacyEmberAppInstance.getLintTests();\n }\n }\n\n private get vendorTree(): BroccoliNode | undefined {\n return this.ensureTree(this.legacyEmberAppInstance.trees.vendor);\n }\n\n private ensureTree(maybeTree: string | BroccoliNode | undefined): BroccoliNode | undefined {\n if (typeof maybeTree === 'string') {\n // this is deliberately mimicking how ember-cli does it. We don't use\n // `this.root` on purpose, because that can differ from what ember-cli\n // considers the project.root. And we don't use path.resolve even though\n // that seems possibly more correct, because ember-cli always assumes the\n // input is relative.\n let resolvedPath = join(this.legacyEmberAppInstance.project.root, maybeTree);\n if (existsSync(resolvedPath)) {\n return new WatchedDir(maybeTree);\n } else {\n return undefined;\n }\n }\n return maybeTree;\n }\n\n @Memoize()\n private get preprocessors(): Preprocessors {\n return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');\n }\n\n private get publicTree(): BroccoliNode | undefined {\n return this.ensureTree(this.legacyEmberAppInstance.trees.public);\n }\n\n private processAppJS(): { appJS: BroccoliNode } {\n let appTree = this.appTree;\n let testsTree = this.testsTree;\n let lintTree = this.lintTree;\n\n let trees: BroccoliNode[] = [];\n trees.push(appTree);\n\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 readonly macrosConfig: MacrosConfig;\n\n constructor(readonly legacyEmberAppInstance: EmberAppInstance, _options?: Options) {\n this.options = optionsWithDefaults(_options);\n\n this.macrosConfig = MacrosConfig.for(legacyEmberAppInstance, this.root);\n if (this.env !== 'production') {\n this.macrosConfig.enablePackageDevelopment(this.root);\n this.macrosConfig.enableRuntimeMode();\n if (this.isDummy) {\n // dummy apps automatically put their owning addon under development too\n this.macrosConfig.enablePackageDevelopment(\n dirname(pkgUpSync({ cwd: this.legacyEmberAppInstance.project.root })!)\n );\n }\n }\n\n // this uses globalConfig because it's a way for packages to ask \"is\n // Embroider doing this build?\". So it's necessarily global, not scoped to\n // any subgraph of dependencies.\n this.macrosConfig.setGlobalConfig(__filename, `@embroider/core`, {\n // this is hard-coded to true because it literally means \"embroider is\n // building this Ember app\". You can see non-true when using the Embroider\n // macros in a classic build.\n active: true,\n });\n }\n\n private inTrees(prevStageTree: BroccoliNode) {\n let publicTree = this.publicTree;\n let configTree = this.config;\n let contentForTree = this.contentFor;\n\n if (this.options.extraPublicTrees.length > 0) {\n publicTree = mergeTrees([publicTree, ...this.options.extraPublicTrees].filter(Boolean) as BroccoliNode[]);\n }\n\n return {\n appJS: this.processAppJS().appJS,\n htmlTree: this.htmlTree,\n publicTree,\n configTree,\n contentForTree,\n prevStageTree,\n };\n }\n\n @Memoize()\n appPackage(): Package {\n // this is deliberately not RewrittenPackageCache, because it's supposed to\n // be the original copy of the app with all the original dependencies.\n let packageCache = PackageCache.shared('embroider', this.root);\n if (this.isDummy) {\n return new DummyPackage(\n this.root,\n this.legacyEmberAppInstance.project.root,\n packageCache as unknown as PackageCache // TODO: cast won't be needed when refactor is complete\n );\n } else {\n return packageCache.get(this.root);\n }\n }\n\n private async instantiate(\n root: string,\n packageCache: RewrittenPackageCache,\n configTree: V1Config,\n contentForTree: ContentForConfig\n ) {\n let origAppPkg = this.appPackage();\n let movedAppPkg = packageCache.withRewrittenDeps(origAppPkg);\n let workingDir = locateEmbroiderWorkingDir(this.root);\n return new CompatAppBuilder(\n root,\n origAppPkg,\n movedAppPkg,\n this.options,\n this,\n configTree,\n contentForTree,\n packageCache.get(join(workingDir, 'rewritten-packages', '@embroider', 'synthesized-vendor')),\n packageCache.get(join(workingDir, 'rewritten-packages', '@embroider', 'synthesized-styles'))\n );\n }\n\n asStage(prevStage: Stage): Stage {\n let resolve: (result: { outputPath: string }) => void;\n let promise: Promise<{ outputPath: string }> = new Promise(r => (resolve = r));\n\n let tree = () => {\n let inTrees = this.inTrees(prevStage.tree);\n return new WaitForTrees(inTrees, this.annotation, async treePaths => {\n if (!this.active) {\n let { outputPath } = await prevStage.ready();\n let packageCache = RewrittenPackageCache.shared('embroider', this.root);\n this.active = await this.instantiate(outputPath, packageCache, inTrees.configTree, inTrees.contentForTree);\n resolve({ outputPath });\n }\n await this.active.build(treePaths);\n });\n };\n\n return {\n get inputPath() {\n return prevStage.inputPath;\n },\n ready: async () => {\n return await promise;\n },\n get tree() {\n return tree();\n },\n };\n }\n}\n\ninterface Preprocessors {\n preprocessJs(tree: BroccoliNode, a: string, b: string, options: object): BroccoliNode;\n preprocessCss(tree: BroccoliNode, a: string, b: string, options: object): BroccoliNode;\n}\n"]}
|
package/src/dependency-rules.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.appTreeRulesDir = appTreeRulesDir;
|
|
|
6
6
|
const core_1 = require("@embroider/core");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const semver_1 = require("semver");
|
|
9
|
+
const resolve_exports_1 = require("resolve.exports");
|
|
9
10
|
// take a component rule from the authoring format to a format more optimized
|
|
10
11
|
// for consumption in the resolver
|
|
11
12
|
function preprocessComponentRule(componentRules) {
|
|
@@ -66,16 +67,22 @@ function activePackageRules(packageRules, activePackages) {
|
|
|
66
67
|
}
|
|
67
68
|
function appTreeRulesDir(root, resolver) {
|
|
68
69
|
let pkg = resolver.packageCache.ownerOfFile(root);
|
|
69
|
-
if (pkg
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
if (pkg) {
|
|
71
|
+
if (pkg.isV2Addon()) {
|
|
72
|
+
// in general v2 addons can keep their app tree stuff in other places than
|
|
73
|
+
// "_app_" and we would need to check their package.json to see. But this code
|
|
74
|
+
// is only for applying packageRules to auto-upgraded v1 addons and apps, and
|
|
75
|
+
// those we always organize predictably.
|
|
76
|
+
return (0, path_1.resolve)(root, '_app_');
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// this is an app
|
|
80
|
+
let matched = (0, resolve_exports_1.resolve)(pkg.packageJSON, './index.js');
|
|
81
|
+
if (matched) {
|
|
82
|
+
return (0, path_1.dirname)((0, path_1.resolve)(root, matched[0]));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
79
85
|
}
|
|
86
|
+
return root;
|
|
80
87
|
}
|
|
81
88
|
//# sourceMappingURL=dependency-rules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-rules.js","sourceRoot":"","sources":["dependency-rules.ts"],"names":[],"mappings":";;AA6KA,0DAkCC;AAED,gDAqBC;AAED,0CAYC;AAnPD,0CAA8C;AAC9C,+BAA+B;AAC/B,mCAAmC;AAwKnC,6EAA6E;AAC7E,kCAAkC;AAClC,SAAgB,uBAAuB,CAAC,cAA8B;;IACpE,IAAI,sBAAsB,GAAG,EAAE,CAAC;IAChC,IAAI,iBAAiB,GAAG,EAAE,CAAC;IAC3B,IAAI,cAAc,CAAC,yBAAyB,EAAE,CAAC;QAC7C,KAAK,IAAI,KAAK,IAAI,cAAc,CAAC,yBAAyB,EAAE,CAAC;YAC3D,IAAI,IAAI,EAAE,QAAQ,CAAC;YACnB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;gBAClB,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;YAC3B,CAAC;YACD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACvB,CAAC;YACD,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,iBAAiB,CAAC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC;YAC3C,iBAAiB,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IACD,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC;Q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AC,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,eAAe,CAAC,IAAY,EAAE,QAAkB;IAC9D,IAAI,GAAG,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAClD,IAAI,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,SAAS,EAAE,EAAE,CAAC;QACrB,0EAA0E;QAC1E,8EAA8E;QAC9E,6EAA6E;QAC7E,wCAAwC;QACxC,OAAO,IAAA,cAAO,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,mDAAmD;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import type { Resolver } from '@embroider/core';\nimport { getOrCreate } from '@embroider/core';\nimport { resolve } from 'path';\nimport { satisfies } from 'semver';\n\nexport interface PackageRules {\n // This whole set of rules will only apply when the given addon package\n // matching the given semver range is present and active.\n package: string;\n semverRange?: string;\n\n components?: {\n // I would prefer to write the key type here as `ComponentSnippet` to aid\n // documentation, but Typescript won't allow it. See ComponentSnippet below.\n [key: string]: ComponentRules;\n };\n\n addonModules?: {\n // `filename` is relative to your package root, and it assumes v2 package\n // format. Like \"templates/components/foo.hbs\".\n [filename: string]: ModuleRules;\n };\n\n appModules?: {\n // `filename` is relative to the app's root, and it assumes v2 package\n // format. Like \"templates/components/foo.hbs\".\n [filename: string]: ModuleRules;\n };\n\n addonTemplates?: {\n // `filename` is relative to your package root, and it assumes v2 package\n // format. Like \"templates/foo.hbs\".\n [filename: string]: TemplateRules;\n };\n\n appTemplates?: {\n // `filename` is relative to the app's root, and it assumes v2 package\n // format. Like \"templates/foo.hbs\".\n [filename: string]: TemplateRules;\n };\n}\n\nexport interface ActivePackageRules extends PackageRules {\n // the location(s) of active packages that match this rule.\n roots: string[];\n}\n\nexport interface TemplateRules {\n // Tells embroider which list of components may be needed for a given path.\n // For example, if your template says `{{component this.panel}}` and you know\n // that `this.panel` can be either \"light-panel\" or \"dark-panel\", you would\n // say: `invokes: { \"this.panel\": [\"<LightPanel/>\", \"<DarkPanel/>\"] }`\n invokes?: {\n [path: string]: ComponentSnippet[];\n };\n\n // Embroider will complain if you try to use staticHelper and/or\n // staticComponents and you have ambiguous forms that might be a component or\n // a helper or just some data that is being rendered. For example, if a\n // template says `{{something}}`, we can't tell if that is `<Something />` or\n // `{{ (something) }}` or `{{this.something}}`.\n disambiguate?: {\n [dasherizedName: string]: 'component' | 'helper' | 'data';\n };\n}\n\nexport interface ComponentRules extends TemplateRules {\n // This declares that our component yields other components that are safe to\n // invoke with the {{component}} helper.\n //\n // The array corresponds to your yielded positional arguments. Any value that\n // is true is considered a safe component. Any value can be a hash in which\n // individual keys that are true are considered safe components.\n //\n // Examples:\n //\n // If you do: {{yield (component \"x\") }}\n // Then say: yieldsSafeComponents: [true]\n //\n // If you do: {{yield (hash x=(component \"x\") y=(component \"y\")) }}\n // Then say: yieldsSafeComponents: [{x: true, y: true}]\n //\n yieldsSafeComponents?: (boolean | { [name: string]: boolean })[];\n\n // This declares that our component yields some of its arguments unchanged.\n //\n // The array corresponds to your yielded positional arguments. Each value can\n // be:\n // false, meaning this yielded value is not one of our arguments\n // a string, meaning this yielded value is our argument with that name\n // or a POJO, whose individual properties are string naming which arguments\n // from whence they came.\n //\n // Examples:\n //\n // If you do: {{yield @foo}}\n // Then say: yieldsArguments: ['foo']\n //\n // If you do: {{yield (hash x=@foo) }}\n // Then say: yieldsArguments: [{ x: 'foo' }]\n yieldsArguments?: (string | { [name: string]: string })[];\n\n // This declares that our component accepts arguments that will be invoked\n // with the {{component}} helper. This silences warnings in the places where\n // we consume them, while introducing warnings in the places where people are\n // passing them to us (if they are doing so in a way that is too dynamic to\n // analyze).\n //\n // If you use this, you may also need to set `layout`, see below.\n acceptsComponentArguments?: ArgumentMapping[];\n\n // If you want to use `acceptsComponentArguments` on a component that\n // customies its own `layout` (which is most addon-provided components), you\n // need to tell us here how to find its template by setting either `addonPath`\n // or `appPath`.\n layout?: {\n // This is a path relative to the addon root, assuming V2 format.\n addonPath?: string;\n // This is the path relative to the app root, assuming V2 format.\n appPath?: string;\n };\n\n // An unresolvable component is usually a build error (when your app has the\n // staticComponent Option enabled). But you can tell Embroider to ignore it by\n // setting this.\n safeToIgnore?: boolean;\n}\n\nexport interface ModuleRules {\n // We will resolve these components into the corresponding JS and HBS files\n // and generate imports such that this module depends on them.\n dependsOnComponents?: ComponentSnippet[];\n\n // This adds new imports to our module, as if they were really there. Helpful\n // for working around addons that depend on things but don't say so.\n dependsOnModules?: string[];\n}\n\n// The bare \"string\" short form implies that `becomes` is the same as `name`.\nexport type ArgumentMapping =\n | string\n | {\n // the name of the argument you accept\n name: string;\n // the name its consumed as in your template\n becomes: string;\n };\n\n// A component snippet is a string containing valid HBS that is a single\n// component invocation. We use it to refer to components in a way that doesn't\n// require any new syntax or rules, and that's necessarily supported by whatever\n// build-time template resolver is in use.\n//\n// Examples of valid ComponentSnippets:\n//\n// \"{{my-component}}\"\n// \"{{my-component/foo}}\"\n// \"<MyComponent />\"\n// \"{{component 'my-component'}}\"\n//\ntype ComponentSnippet = string;\n\nexport interface PreprocessedComponentRule {\n yieldsSafeComponents: Required<ComponentRules>['yieldsSafeComponents'];\n yieldsArguments: Required<ComponentRules>['yieldsArguments'];\n argumentsAreComponents: string[];\n safeToIgnore: boolean;\n safeInteriorPaths: string[];\n disambiguate: Record<string, 'component' | 'helper' | 'data'>;\n}\n\n// take a component rule from the authoring format to a format more optimized\n// for consumption in the resolver\nexport function preprocessComponentRule(componentRules: ComponentRules): PreprocessedComponentRule {\n let argumentsAreComponents = [];\n let safeInteriorPaths = [];\n if (componentRules.acceptsComponentArguments) {\n for (let entry of componentRules.acceptsComponentArguments) {\n let name, interior;\n if (typeof entry === 'string') {\n name = interior = entry;\n } else {\n name = entry.name;\n interior = entry.becomes;\n }\n if (name.startsWith('@')) {\n name = name.slice(1);\n }\n argumentsAreComponents.push(name);\n safeInteriorPaths.push(interior);\n safeInteriorPaths.push('this.' + interior);\n safeInteriorPaths.push('@' + name);\n }\n }\n if (componentRules.invokes) {\n for (let [path] of Object.entries(componentRules.invokes)) {\n safeInteriorPaths.push(path);\n }\n }\n return {\n safeInteriorPaths,\n safeToIgnore: Boolean(componentRules.safeToIgnore),\n argumentsAreComponents,\n yieldsSafeComponents: componentRules.yieldsSafeComponents || [],\n yieldsArguments: componentRules.yieldsArguments || [],\n disambiguate: componentRules?.disambiguate ?? {},\n };\n}\n\nexport function activePackageRules(\n packageRules: PackageRules[],\n activePackages: { name: string; root: string; version: string }[]\n): ActivePackageRules[] {\n // rule order implies precedence. The first rule that matches a given package\n // applies to that package, and no other rule does.\n let rootsPerRule = new Map();\n for (let pkg of activePackages) {\n for (let rule of packageRules) {\n if (rule.package === pkg.name && (!rule.semverRange || satisfies(pkg.version, rule.semverRange))) {\n let roots = getOrCreate(rootsPerRule, rule, () => []);\n roots.push(pkg.root);\n break;\n }\n }\n }\n let output = [];\n for (let [rule, roots] of rootsPerRule) {\n output.push(Object.assign({ roots }, rule));\n }\n return output;\n}\n\nexport function appTreeRulesDir(root: string, resolver: Resolver) {\n let pkg = resolver.packageCache.ownerOfFile(root);\n if (pkg?.isV2Addon()) {\n // in general v2 addons can keep their app tree stuff in other places than\n // \"_app_\" and we would need to check their package.json to see. But this code\n // is only for applying packageRules to auto-upgraded v1 addons and apps, and\n // those we always organize predictably.\n return resolve(root, '_app_');\n } else {\n // auto-upgraded apps don't get an exist _app_ dir.\n return root;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dependency-rules.js","sourceRoot":"","sources":["dependency-rules.ts"],"names":[],"mappings":";;AA8KA,0DAkCC;AAED,gDAqBC;AAED,0CAkBC;AA1PD,0CAA8C;AAC9C,+BAAuD;AACvD,mCAAmC;AACnC,qDAA4D;AAwK5D,6EAA6E;AAC7E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AAE,CAAC;YACpB,0EAA0E;YAC1E,8EAA8E;YAC9E,6EAA6E;YAC7E,wCAAwC;YACxC,OAAO,IAAA,cAAW,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACpC,CAAC;aAAM,CAAC;YACN,iBAAiB;YACjB,IAAI,OAAO,GAAG,IAAA,yBAAc,EAAC,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;YAC5D,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,IAAA,cAAO,EAAC,IAAA,cAAW,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { Resolver } from '@embroider/core';\nimport { getOrCreate } from '@embroider/core';\nimport { resolve as pathResolve, dirname } from 'path';\nimport { satisfies } from 'semver';\nimport { resolve as resolveExports } from 'resolve.exports';\n\nexport interface PackageRules {\n // This whole set of rules will only apply when the given addon package\n // matching the given semver range is present and active.\n package: string;\n semverRange?: string;\n\n components?: {\n // I would prefer to write the key type here as `ComponentSnippet` to aid\n // documentation, but Typescript won't allow it. See ComponentSnippet below.\n [key: string]: ComponentRules;\n };\n\n addonModules?: {\n // `filename` is relative to your package root, and it assumes v2 package\n // format. Like \"templates/components/foo.hbs\".\n [filename: string]: ModuleRules;\n };\n\n appModules?: {\n // `filename` is relative to the app's root, and it assumes v2 package\n // format. Like \"templates/components/foo.hbs\".\n [filename: string]: ModuleRules;\n };\n\n addonTemplates?: {\n // `filename` is relative to your package root, and it assumes v2 package\n // format. Like \"templates/foo.hbs\".\n [filename: string]: TemplateRules;\n };\n\n appTemplates?: {\n // `filename` is relative to the app's root, and it assumes v2 package\n // format. Like \"templates/foo.hbs\".\n [filename: string]: TemplateRules;\n };\n}\n\nexport interface ActivePackageRules extends PackageRules {\n // the location(s) of active packages that match this rule.\n roots: string[];\n}\n\nexport interface TemplateRules {\n // Tells embroider which list of components may be needed for a given path.\n // For example, if your template says `{{component this.panel}}` and you know\n // that `this.panel` can be either \"light-panel\" or \"dark-panel\", you would\n // say: `invokes: { \"this.panel\": [\"<LightPanel/>\", \"<DarkPanel/>\"] }`\n invokes?: {\n [path: string]: ComponentSnippet[];\n };\n\n // Embroider will complain if you try to use staticHelper and/or\n // staticComponents and you have ambiguous forms that might be a component or\n // a helper or just some data that is being rendered. For example, if a\n // template says `{{something}}`, we can't tell if that is `<Something />` or\n // `{{ (something) }}` or `{{this.something}}`.\n disambiguate?: {\n [dasherizedName: string]: 'component' | 'helper' | 'data';\n };\n}\n\nexport interface ComponentRules extends TemplateRules {\n // This declares that our component yields other components that are safe to\n // invoke with the {{component}} helper.\n //\n // The array corresponds to your yielded positional arguments. Any value that\n // is true is considered a safe component. Any value can be a hash in which\n // individual keys that are true are considered safe components.\n //\n // Examples:\n //\n // If you do: {{yield (component \"x\") }}\n // Then say: yieldsSafeComponents: [true]\n //\n // If you do: {{yield (hash x=(component \"x\") y=(component \"y\")) }}\n // Then say: yieldsSafeComponents: [{x: true, y: true}]\n //\n yieldsSafeComponents?: (boolean | { [name: string]: boolean })[];\n\n // This declares that our component yields some of its arguments unchanged.\n //\n // The array corresponds to your yielded positional arguments. Each value can\n // be:\n // false, meaning this yielded value is not one of our arguments\n // a string, meaning this yielded value is our argument with that name\n // or a POJO, whose individual properties are string naming which arguments\n // from whence they came.\n //\n // Examples:\n //\n // If you do: {{yield @foo}}\n // Then say: yieldsArguments: ['foo']\n //\n // If you do: {{yield (hash x=@foo) }}\n // Then say: yieldsArguments: [{ x: 'foo' }]\n yieldsArguments?: (string | { [name: string]: string })[];\n\n // This declares that our component accepts arguments that will be invoked\n // with the {{component}} helper. This silences warnings in the places where\n // we consume them, while introducing warnings in the places where people are\n // passing them to us (if they are doing so in a way that is too dynamic to\n // analyze).\n //\n // If you use this, you may also need to set `layout`, see below.\n acceptsComponentArguments?: ArgumentMapping[];\n\n // If you want to use `acceptsComponentArguments` on a component that\n // customies its own `layout` (which is most addon-provided components), you\n // need to tell us here how to find its template by setting either `addonPath`\n // or `appPath`.\n layout?: {\n // This is a path relative to the addon root, assuming V2 format.\n addonPath?: string;\n // This is the path relative to the app root, assuming V2 format.\n appPath?: string;\n };\n\n // An unresolvable component is usually a build error (when your app has the\n // staticComponent Option enabled). But you can tell Embroider to ignore it by\n // setting this.\n safeToIgnore?: boolean;\n}\n\nexport interface ModuleRules {\n // We will resolve these components into the corresponding JS and HBS files\n // and generate imports such that this module depends on them.\n dependsOnComponents?: ComponentSnippet[];\n\n // This adds new imports to our module, as if they were really there. Helpful\n // for working around addons that depend on things but don't say so.\n dependsOnModules?: string[];\n}\n\n// The bare \"string\" short form implies that `becomes` is the same as `name`.\nexport type ArgumentMapping =\n | string\n | {\n // the name of the argument you accept\n name: string;\n // the name its consumed as in your template\n becomes: string;\n };\n\n// A component snippet is a string containing valid HBS that is a single\n// component invocation. We use it to refer to components in a way that doesn't\n// require any new syntax or rules, and that's necessarily supported by whatever\n// build-time template resolver is in use.\n//\n// Examples of valid ComponentSnippets:\n//\n// \"{{my-component}}\"\n// \"{{my-component/foo}}\"\n// \"<MyComponent />\"\n// \"{{component 'my-component'}}\"\n//\ntype ComponentSnippet = string;\n\nexport interface PreprocessedComponentRule {\n yieldsSafeComponents: Required<ComponentRules>['yieldsSafeComponents'];\n yieldsArguments: Required<ComponentRules>['yieldsArguments'];\n argumentsAreComponents: string[];\n safeToIgnore: boolean;\n safeInteriorPaths: string[];\n disambiguate: Record<string, 'component' | 'helper' | 'data'>;\n}\n\n// take a component rule from the authoring format to a format more optimized\n// for consumption in the resolver\nexport function preprocessComponentRule(componentRules: ComponentRules): PreprocessedComponentRule {\n let argumentsAreComponents = [];\n let safeInteriorPaths = [];\n if (componentRules.acceptsComponentArguments) {\n for (let entry of componentRules.acceptsComponentArguments) {\n let name, interior;\n if (typeof entry === 'string') {\n name = interior = entry;\n } else {\n name = entry.name;\n interior = entry.becomes;\n }\n if (name.startsWith('@')) {\n name = name.slice(1);\n }\n argumentsAreComponents.push(name);\n safeInteriorPaths.push(interior);\n safeInteriorPaths.push('this.' + interior);\n safeInteriorPaths.push('@' + name);\n }\n }\n if (componentRules.invokes) {\n for (let [path] of Object.entries(componentRules.invokes)) {\n safeInteriorPaths.push(path);\n }\n }\n return {\n safeInteriorPaths,\n safeToIgnore: Boolean(componentRules.safeToIgnore),\n argumentsAreComponents,\n yieldsSafeComponents: componentRules.yieldsSafeComponents || [],\n yieldsArguments: componentRules.yieldsArguments || [],\n disambiguate: componentRules?.disambiguate ?? {},\n };\n}\n\nexport function activePackageRules(\n packageRules: PackageRules[],\n activePackages: { name: string; root: string; version: string }[]\n): ActivePackageRules[] {\n // rule order implies precedence. The first rule that matches a given package\n // applies to that package, and no other rule does.\n let rootsPerRule = new Map();\n for (let pkg of activePackages) {\n for (let rule of packageRules) {\n if (rule.package === pkg.name && (!rule.semverRange || satisfies(pkg.version, rule.semverRange))) {\n let roots = getOrCreate(rootsPerRule, rule, () => []);\n roots.push(pkg.root);\n break;\n }\n }\n }\n let output = [];\n for (let [rule, roots] of rootsPerRule) {\n output.push(Object.assign({ roots }, rule));\n }\n return output;\n}\n\nexport function appTreeRulesDir(root: string, resolver: Resolver) {\n let pkg = resolver.packageCache.ownerOfFile(root);\n if (pkg) {\n if (pkg.isV2Addon()) {\n // in general v2 addons can keep their app tree stuff in other places than\n // \"_app_\" and we would need to check their package.json to see. But this code\n // is only for applying packageRules to auto-upgraded v1 addons and apps, and\n // those we always organize predictably.\n return pathResolve(root, '_app_');\n } else {\n // this is an app\n let matched = resolveExports(pkg.packageJSON, './index.js');\n if (matched) {\n return dirname(pathResolve(root, matched[0]));\n }\n }\n }\n return root;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver-transform.js","sourceRoot":"","sources":["resolver-transform.ts"],"names":[],"mappings":";;;;;;;;;;;AAi9BA,wCAiBC;AA19BD,yDAA8E;AAC9E,2DAA6C;AAE7C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nE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AACD,SAAS,YAAY,CAAC,QAAa,EAAE,QAAa;IAChD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,OAAO,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;AACH,CAAC","sourcesContent":["import type { ASTv1, ASTPlugin, ASTPluginBuilder, ASTPluginEnvironment, WalkerPath } from '@glimmer/syntax';\nimport type {\n PreprocessedComponentRule,\n ActivePackageRules,\n ComponentRules,\n PackageRules,\n ModuleRules,\n} from './dependency-rules';\nimport { preprocessComponentRule, appTreeRulesDir } from './dependency-rules';\nimport { Memoize } from 'typescript-memoize';\nimport type { WithJSUtils } from 'babel-plugin-ember-template-compilation';\nimport assertNever from 'assert-never';\nimport { join, sep } from 'path';\nimport { readJSONSync } from 'fs-extra';\nimport { dasherize, snippetToDasherizedName } from './dasherize-component-name';\nimport type { ResolverOptions as CoreResolverOptions } from '@embroider/core';\nimport { Resolver, cleanUrl, locateEmbroiderWorkingDir } from '@embroider/core';\nimport type CompatOptions from './options';\nimport type { AuditMessage, Loc } from './audit';\nimport { camelCase, mergeWith } from 'lodash';\nimport { satisfies } from 'semver';\n\ntype Env = WithJSUtils<ASTPluginEnvironment> & {\n filename: string;\n contents: string;\n strictMode?: boolean;\n locals?: string[];\n};\n\n// this is a subset of the full Options. We care about serializability, and we\n// only needs parts that are easily serializable, which is why we don't keep the\n// whole thing.\ntype UserConfig = Pick<\n Required<CompatOptions>,\n 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'allowUnsafeDynamicComponents'\n>;\n\nexport interface CompatResolverOptions extends CoreResolverOptions {\n activePackageRules: ActivePackageRules[];\n options: UserConfig;\n}\n\nexport interface Options {\n appRoot: string;\n emberVersion: string;\n}\n\ntype BuiltIn = {\n importableHelper?: [string, string];\n importableComponent?: [string, string];\n importableModifier?: [string, string];\n};\n\nfunction builtInKeywords(emberVersion: string): Record<string, BuiltIn | undefined> {\n const builtInKeywords: Record<string, BuiltIn | undefined> = {\n '-get-dynamic-var': {},\n '-in-element': {},\n '-with-dynamic-vars': {},\n action: {},\n array: {\n importableHelper: ['array', '@ember/helper'],\n },\n component: {},\n concat: {\n importableHelper: ['concat', '@ember/helper'],\n },\n debugger: {},\n 'each-in': {},\n each: {},\n fn: {\n importableHelper: ['fn', '@ember/helper'],\n },\n get: {\n importableHelper: ['get', '@ember/helper'],\n },\n 'has-block-params': {},\n 'has-block': {},\n hasBlock: {},\n hasBlockParams: {},\n hash: {\n importableHelper: ['hash', '@ember/helper'],\n },\n helper: {},\n if: {},\n 'in-element': {},\n input: {\n importableComponent: ['Input', '@ember/component'],\n },\n let: {},\n 'link-to': {\n importableComponent: ['LinkTo', '@ember/routing'],\n },\n loc: {},\n log: {},\n modifier: {},\n mount: {},\n mut: {},\n on: {\n importableModifier: ['on', '@ember/modifier'],\n },\n outlet: {},\n partial: {},\n 'query-params': {},\n readonly: {},\n textarea: {\n importableComponent: ['Textarea', '@ember/component'],\n },\n unbound: {},\n 'unique-id': {},\n unless: {},\n with: {},\n yield: {},\n };\n if (satisfies(emberVersion, '>=5.2')) {\n builtInKeywords['unique-id'] = {\n importableHelper: ['uniqueId', '@ember/helper'],\n };\n }\n return builtInKeywords;\n}\n\ninterface ComponentResolution {\n type: 'component';\n specifier: string;\n importedName: string;\n yieldsComponents: Required<ComponentRules>['yieldsSafeComponents'];\n yieldsArguments: Required<ComponentRules>['yieldsArguments'];\n argumentsAreComponents: string[];\n nameHint: string;\n}\n\ntype HelperResolution = {\n type: 'helper';\n nameHint: string;\n specifier: string;\n importedName: string;\n};\n\ntype ModifierResolution = {\n type: 'modifier';\n specifier: string;\n importedName: string;\n nameHint: string;\n};\n\ntype ResolutionResult = ComponentResolution | HelperResolution | ModifierResolution;\n\ninterface ResolutionFail {\n type: 'error';\n message: string;\n detail: string;\n loc: Loc;\n}\n\ntype Resolution = ResolutionResult | ResolutionFail;\n\ntype ComponentLocator =\n | {\n type: 'literal';\n path: string;\n }\n | {\n type: 'path';\n path: string;\n }\n | {\n type: 'other';\n };\n\nclass TemplateResolver implements ASTPlugin {\n readonly name = 'embroider-build-time-resolver';\n\n private auditHandler: undefined | ((msg: AuditMessage) => void);\n private scopeStack = new ScopeStack();\n\n private moduleResolver: Resolver;\n\n constructor(\n private env: Env,\n private config: CompatResolverOptions,\n private builtInsForEmberVersion: ReturnType<typeof builtInKeywords>\n ) {\n this.moduleResolver = new Resolver(config);\n if ((globalThis as any).embroider_audit) {\n this.auditHandler = (globalThis as any).embroider_audit;\n }\n }\n\n private emit<Target extends WalkerPath<ASTv1.Node>>(\n parentPath: Target,\n resolution: Resolution | null,\n setter: (target: Target['node'], newIdentifier: ASTv1.PathExpression) => void\n ) {\n switch (resolution?.type) {\n case 'error':\n this.reportError(resolution);\n return;\n case 'component':\n case 'modifier':\n case 'helper': {\n let name = this.env.meta.jsutils.bindImport(resolution.specifier, resolution.importedName, parentPath, {\n nameHint: resolution.nameHint,\n });\n setter(parentPath.node, this.env.syntax.builders.path(name));\n return;\n }\n case undefined:\n return;\n default:\n assertNever(resolution);\n }\n }\n\n private reportError(dep: ResolutionFail) {\n if (!this.auditHandler && !this.config.options.allowUnsafeDynamicComponents) {\n let e: any = new Error(`${dep.message}: ${dep.detail} in ${this.humanReadableFile(this.env.filename)}`);\n e.isTemplateResolverError = true;\n e.loc = dep.loc;\n e.moduleName = this.env.filename;\n throw e;\n }\n if (this.auditHandler) {\n this.auditHandler({\n message: dep.message,\n filename: this.env.filename,\n detail: dep.detail,\n loc: dep.loc,\n source: this.env.contents,\n });\n }\n }\n\n private humanReadableFile(file: string) {\n let { appRoot } = this.config;\n if (!appRoot.endsWith(sep)) {\n appRoot += sep;\n }\n if (file.startsWith(appRoot)) {\n return file.slice(appRoot.length);\n }\n return file;\n }\n\n private handleComponentHelper(\n param: ASTv1.Node,\n impliedBecause?: { componentName: string; argumentName: string }\n ): ComponentResolution | ResolutionFail | null {\n let locator: ComponentLocator;\n switch (param.type) {\n case 'StringLiteral':\n locator = { type: 'literal', path: param.value };\n break;\n case 'PathExpression':\n locator = { type: 'path', path: param.original };\n break;\n case 'MustacheStatement':\n if (param.hash.pairs.length === 0 && param.params.length === 0) {\n return this.handleComponentHelper(param.path, impliedBecause);\n } else if (param.path.type === 'PathExpression' && param.path.original === 'component') {\n // safe because we will handle this inner `{{component ...}}` mustache on its own\n return null;\n } else {\n locator = { type: 'other' };\n }\n break;\n case 'TextNode':\n locator = { type: 'literal', path: param.chars };\n break;\n case 'SubExpression':\n if (param.path.type === 'PathExpression' && param.path.original === 'component') {\n // safe because we will handle this inner `(component ...)` subexpression on its own\n return null;\n }\n if (param.path.type === 'PathExpression' && param.path.original === 'ensure-safe-component') {\n // safe because we trust ensure-safe-component\n return null;\n }\n locator = { type: 'other' };\n break;\n default:\n locator = { type: 'other' };\n }\n\n if (locator.type === 'path' && this.scopeStack.safeComponentInScope(locator.path)) {\n return null;\n }\n\n return this.targetComponentHelper(locator, param.loc, impliedBecause);\n }\n\n private handleDynamicComponentArguments(\n componentName: string,\n argumentsAreComponents: string[],\n attributes: WalkerPath<ASTv1.AttrNode | ASTv1.HashPair>[]\n ) {\n for (let name of argumentsAreComponents) {\n let attr = attributes.find(attr => {\n if (attr.node.type === 'AttrNode') {\n return attr.node.name === '@' + name;\n } else {\n return attr.node.key === name;\n }\n });\n if (attr) {\n let resolution = this.handleComponentHelper(attr.node.value, {\n componentName,\n argumentName: name,\n });\n this.emit(attr, resolution, (node, newId) => {\n if (node.type === 'AttrNode') {\n node.value = this.env.syntax.builders.mustache(newId);\n } else {\n node.value = newId;\n }\n });\n }\n }\n }\n\n private get staticComponentsEnabled(): boolean {\n return this.config.options.staticComponents || Boolean(this.auditHandler);\n }\n\n private get staticHelpersEnabled(): boolean {\n return this.config.options.staticHelpers || Boolean(this.auditHandler);\n }\n\n private get staticModifiersEnabled(): boolean {\n return this.config.options.staticModifiers || Boolean(this.auditHandler);\n }\n\n private isIgnoredComponent(dasherizedName: string) {\n return this.rules.components.get(dasherizedName)?.safeToIgnore;\n }\n\n @Memoize()\n private get rules() {\n // rules that are keyed by the filename they're talking about\n let files: Map<string, PreprocessedComponentRule> = new Map();\n\n // rules that are keyed by our dasherized interpretation of the component's name\n let components: Map<string, PreprocessedComponentRule> = new Map();\n\n // we're not responsible for filtering out rules for inactive packages here,\n // that is done before getting to us. So we should assume these are all in\n // force.\n for (let rule of this.config.activePackageRules) {\n if (rule.components) {\n for (let [snippet, rules] of Object.entries(rule.components)) {\n let processedRules = preprocessComponentRule(rules);\n let dasherizedName = this.standardDasherize(snippet, rule);\n components.set(dasherizedName, processedRules);\n if (rules.layout) {\n for (let root of rule.roots) {\n if (rules.layout.addonPath) {\n files.set(join(root, rules.layout.addonPath), processedRules);\n }\n if (rules.layout.appPath) {\n files.set(join(root, rules.layout.appPath), processedRules);\n }\n }\n }\n }\n }\n if (rule.appTemplates) {\n for (let [path, templateRules] of Object.entries(rule.appTemplates)) {\n let processedRules = preprocessComponentRule(templateRules);\n for (let root of rule.roots) {\n files.set(join(appTreeRulesDir(root, this.moduleResolver), path), processedRules);\n }\n }\n }\n if (rule.addonTemplates) {\n for (let [path, templateRules] of Object.entries(rule.addonTemplates)) {\n let processedRules = preprocessComponentRule(templateRules);\n for (let root of rule.roots) {\n files.set(join(root, path), processedRules);\n }\n }\n }\n }\n return { files, components };\n }\n\n private findRules(absPath: string): PreprocessedComponentRule | undefined {\n // when babel is invoked by vite our filenames can have query params still\n // hanging off them. That would break rule matching.\n absPath = cleanUrl(absPath);\n\n let fileRules = this.rules.files.get(absPath);\n let componentRules: PreprocessedComponentRule | undefined;\n\n let componentName = this.moduleResolver.reverseComponentLookup(absPath);\n if (componentName) {\n componentRules = this.rules.components.get(componentName);\n }\n\n if (fileRules && componentRules) {\n return mergeWith(fileRules, componentRules, appendArrays);\n }\n\n return fileRules ?? componentRules;\n }\n\n private standardDasherize(snippet: string, rule: PackageRules | ModuleRules): string {\n let name = snippetToDasherizedName(snippet);\n if (name == null) {\n throw new Error(`unable to parse component snippet \"${snippet}\" from rule ${JSON.stringify(rule, null, 2)}`);\n }\n return name;\n }\n\n private targetComponent(name: string): ComponentResolution | null {\n if (!this.staticComponentsEnabled) {\n return null;\n }\n\n const builtIn = this.builtInsForEmberVersion[name];\n\n if (builtIn?.importableComponent) {\n let [importedName, specifier] = builtIn.importableComponent;\n return {\n type: 'component',\n specifier,\n importedName,\n yieldsComponents: [],\n yieldsArguments: [],\n argumentsAreComponents: [],\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n if (this.isIgnoredComponent(name)) {\n return null;\n }\n\n let componentRules = this.rules.components.get(name);\n return {\n type: 'component',\n specifier: `@embroider/virtual/components/${name}`,\n importedName: 'default',\n yieldsComponents: componentRules ? componentRules.yieldsSafeComponents : [],\n yieldsArguments: componentRules ? componentRules.yieldsArguments : [],\n argumentsAreComponents: componentRules ? componentRules.argumentsAreComponents : [],\n nameHint: this.nameHint(name),\n };\n }\n\n private targetComponentHelper(\n component: ComponentLocator,\n loc: Loc,\n impliedBecause?: { componentName: string; argumentName: string }\n ): ComponentResolution | ResolutionFail | null {\n if (!this.staticComponentsEnabled) {\n return null;\n }\n\n let message;\n if (impliedBecause) {\n message = `argument \"${impliedBecause.argumentName}\" to component \"${impliedBecause.componentName}\" is treated as a component, but the value you're passing is dynamic`;\n } else {\n message = `Unsafe dynamic component`;\n }\n\n if (component.type === 'other') {\n return {\n type: 'error',\n message,\n detail: `cannot statically analyze this expression`,\n loc,\n };\n }\n if (component.type === 'path') {\n let ownComponentRules = this.findRules(this.env.filename);\n if (ownComponentRules && ownComponentRules.safeInteriorPaths.includes(component.path)) {\n return null;\n }\n return {\n type: 'error',\n message,\n detail: component.path,\n loc,\n };\n }\n\n return this.targetComponent(component.path);\n }\n\n private targetHelper(path: string): HelperResolution | null {\n if (!this.staticHelpersEnabled) {\n return null;\n }\n\n // people are not allowed to override the built-in helpers with their own\n // globally-named helpers. It throws an error. So it's fine for us to\n // prioritize the builtIns here without bothering to resolve a user helper\n // of the same name.\n const builtIn = this.builtInsForEmberVersion[path];\n\n if (builtIn?.importableHelper) {\n let [importedName, specifier] = builtIn.importableHelper;\n return {\n type: 'helper',\n specifier,\n importedName,\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n\n return {\n type: 'helper',\n specifier: `@embroider/virtual/helpers/${path}`,\n importedName: 'default',\n nameHint: this.nameHint(path),\n };\n }\n\n private targetHelperOrComponent(\n path: string,\n loc: Loc,\n hasArgs: boolean\n ): ComponentResolution | HelperResolution | null {\n /*\n\n In earlier embroider versions we would do a bunch of module resolution right\n here inside the ast transform to try to resolve the ambiguity of this case\n and if we didn't find anything, leave the template unchanged. But that leads\n to both a lot of extra build-time expense (since we are attempting\n resolution for lots of things that may in fact be just some data and not a\n component invocation at all, and also since we are pre-resolving modules\n that will get resolved a second time by the final stage packager).\n\n Now, we're going to be less forgiving, because it streamlines the build for\n everyone who's not still using these *extremely* old patterns.\n\n The problematic case is:\n\n 1. In a non-strict template (because this whole resolver-transform.ts is a\n no-op on strict handlebars).\n\n 2. Have a mustache statement like: `{{something}}`, where `something` is:\n\n a. Not a variable in scope (for example, there's no preceeding line \n like `<Parent as |something|>`)\n b. Does not start with `@` because that must be an argument from outside this template.\n c. Does not contain a dot, like `some.thing` (because that case is classically \n never a global component resolution that we would need to handle)\n d. Does not start with `this` (this rule is mostly redundant with the previous rule, \n but even a standalone `this` is never a component invocation).\n e. Does not have any arguments. If there are argument like `{{something a=b}}`, \n there is still ambiguity between helper vs component, but there is no longer \n the possibility that this was just rendering some data.\n f. Does not take a block, like `{{#something}}{{/something}}` (because that is \n always a component, no ambiguity.)\n\n We can't tell if this problematic case is really:\n\n 1. A helper invocation with no arguments that is being directly rendered.\n Out-of-the-box, ember already generates [a lint\n error](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-curly-component-invocation.md)\n for this, although it tells you to whitelist your helper when IMO it\n should tell you to use an unambiguous syntax like `{{ (something) }}`\n instead.\n\n 2. A component invocation, which you could have written `<Something />`\n instead. Angle-bracket invocation has been available and easy-to-adopt\n for a very long time. \n\n 3. Property-this-fallback for `{{this.something}}`. Property-this-fallback\n is eliminated at Ember 4.0, so people have been heavily pushed to get\n it out of their addons.\n */\n\n // first, bail out on all the stuff we can obviously ignore\n if ((!this.staticHelpersEnabled && !this.staticComponentsEnabled) || this.isIgnoredComponent(path)) {\n return null;\n }\n\n let builtIn = this.builtInsForEmberVersion[path];\n\n if (builtIn?.importableComponent) {\n let [importedName, specifier] = builtIn.importableComponent;\n return {\n type: 'component',\n specifier,\n importedName,\n yieldsComponents: [],\n yieldsArguments: [],\n argumentsAreComponents: [],\n nameHint: importedName,\n };\n }\n\n if (builtIn?.importableHelper) {\n let [importedName, specifier] = builtIn.importableHelper;\n return {\n type: 'helper',\n specifier,\n importedName,\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n\n let ownComponentRules = this.findRules(this.env.filename);\n if (ownComponentRules?.disambiguate[path]) {\n switch (ownComponentRules.disambiguate[path]) {\n case 'component':\n return this.targetComponent(path);\n case 'helper':\n return this.targetHelper(path);\n case 'data':\n return null;\n }\n }\n\n if (!hasArgs && !path.includes('/') && !path.includes('@')) {\n // this is the case that could also be property-this-fallback. We're going\n // to force people to disambiguate, because letting a potential component\n // or helper invocation lurk inside every bit of data you render is not\n // ok.\n this.reportError({\n type: 'error',\n message: 'unsupported ambiguous syntax',\n detail: `\"{{${path}}}\" is ambiguous and could mean \"{{this.${path}}}\" or component \"<${capitalize(\n camelCase(path)\n )} />\" or helper \"{{ (${path}) }}\". Change it to one of those unambigous forms, or use a \"disambiguate\" packageRule to work around the problem if its in third-party code you cannot easily fix.`,\n loc,\n });\n return null;\n }\n\n // Above we already bailed out if both of these were disabled, so we know at\n // least one is turned on. If both aren't turned on, we're stuck, because we\n // can't even tell if this *is* a component vs a helper.\n if (!this.staticHelpersEnabled || !this.staticComponentsEnabled) {\n this.reportError({\n type: 'error',\n message: 'unsupported ambiguity between helper and component',\n detail: `this use of \"{{${path}}}\" could be helper \"{{ (${path}) }}\" or component \"<${capitalize(\n camelCase(path)\n )} />\", and your settings for staticHelpers and staticComponents do not agree. Either switch to one of the unambiguous forms, or make staticHelpers and staticComponents agree, or use a \"disambiguate\" packageRule to work around the problem if its in third-party code you cannot easily fix.`,\n loc,\n });\n return null;\n }\n\n let componentRules = this.rules.components.get(path);\n return {\n type: 'component',\n specifier: `@embroider/virtual/ambiguous/${path}`,\n importedName: 'default',\n yieldsComponents: componentRules ? componentRules.yieldsSafeComponents : [],\n yieldsArguments: componentRules ? componentRules.yieldsArguments : [],\n argumentsAreComponents: componentRules ? componentRules.argumentsAreComponents : [],\n nameHint: this.nameHint(path),\n };\n }\n\n private targetElementModifier(path: string): ModifierResolution | null {\n if (!this.staticModifiersEnabled) {\n return null;\n }\n\n const builtIn = this.builtInsForEmberVersion[path];\n if (builtIn?.importableModifier) {\n let [importedName, specifier] = builtIn.importableModifier;\n return {\n type: 'modifier',\n specifier,\n importedName,\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n\n return {\n type: 'modifier',\n specifier: `@embroider/virtual/modifiers/${path}`,\n importedName: 'default',\n nameHint: this.nameHint(path),\n };\n }\n\n targetDynamicModifier(modifier: ComponentLocator, loc: Loc): ModifierResolution | ResolutionFail | null {\n if (!this.staticModifiersEnabled) {\n return null;\n }\n\n if (modifier.type === 'literal') {\n return this.targetElementModifier(modifier.path);\n } else {\n return {\n type: 'error',\n message: 'Unsafe dynamic modifier',\n detail: `cannot statically analyze this expression`,\n loc,\n };\n }\n }\n\n private targetDynamicHelper(helper: ComponentLocator): HelperResolution | null {\n if (!this.staticHelpersEnabled) {\n return null;\n }\n\n if (helper.type === 'literal') {\n return this.targetHelper(helper.path);\n }\n\n // we don't have to manage any errors in this case because ember itself\n // considers it an error to pass anything but a string literal to the\n // `helper` helper.\n return null;\n }\n\n private nameHint(path: string) {\n let parts = path.split('@');\n\n // the extra underscore here guarantees that we will never collide with an\n // HTML element.\n return 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 if (node.path.tail.length === 0 && node.path.head.type === 'VarHead') {\n let resolution = this.targetHelper(node.path.original);\n this.emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n }\n },\n MustacheStatement: {\n enter: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n let rootName = 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, emberVersion }: Options) {\n let config: CompatResolverOptions = readJSONSync(join(locateEmbroiderWorkingDir(appRoot), 'resolver.json'));\n const resolverTransform: ASTPluginBuilder<Env> = env => {\n if (env.strictMode) {\n return {\n name: 'embroider-build-time-resolver-strict-noop',\n visitor: {},\n };\n }\n return new TemplateResolver(env, config, builtInKeywords(emberVersion));\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"]}
|
|
1
|
+
{"version":3,"file":"resolver-transform.js","sourceRoot":"","sources":["resolver-transform.ts"],"names":[],"mappings":";;;;;;;;;;;AAi9BA,wCAiBC;AA19BD,yDAA8E;AAC9E,2DAA6C;AAE7C,gEAAuC;AACvC,+BAAiC;AACjC,uCAAwC;AACxC,yEAAgF;AAEhF,0CAAgF;AAGhF,mCAA8C;AAC9C,mCAAmC;AAiCnC,SAAS,eAAe,CAAC,YAAoB;IAC3C,MAAM,eAAe,GAAwC;QAC3D,kBAAkB,EAAE,EAAE;QACtB,aAAa,EAAE,EAAE;QACjB,oBAAoB,EAAE,EAAE;QACxB,MAAM,EAAE,EAAE;QACV,KAAK,EAAE;YACL,gBAAgB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AACH,CAAC","sourcesContent":["import type { ASTv1, ASTPlugin, ASTPluginBuilder, ASTPluginEnvironment, WalkerPath } from '@glimmer/syntax';\nimport type {\n PreprocessedComponentRule,\n ActivePackageRules,\n ComponentRules,\n PackageRules,\n ModuleRules,\n} from './dependency-rules';\nimport { preprocessComponentRule, appTreeRulesDir } from './dependency-rules';\nimport { Memoize } from 'typescript-memoize';\nimport type { WithJSUtils } from 'babel-plugin-ember-template-compilation';\nimport assertNever from 'assert-never';\nimport { join, sep } from 'path';\nimport { readJSONSync } from 'fs-extra';\nimport { dasherize, snippetToDasherizedName } from './dasherize-component-name';\nimport type { ResolverOptions as CoreResolverOptions } from '@embroider/core';\nimport { Resolver, cleanUrl, locateEmbroiderWorkingDir } from '@embroider/core';\nimport type CompatOptions from './options';\nimport type { AuditMessage, Loc } from './audit';\nimport { camelCase, mergeWith } from 'lodash';\nimport { satisfies } from 'semver';\n\ntype Env = WithJSUtils<ASTPluginEnvironment> & {\n filename: string;\n contents: string;\n strictMode?: boolean;\n locals?: string[];\n};\n\n// this is a subset of the full Options. We care about serializability, and we\n// only needs parts that are easily serializable, which is why we don't keep the\n// whole thing.\ntype UserConfig = Pick<\n Required<CompatOptions>,\n 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'allowUnsafeDynamicComponents'\n>;\n\nexport interface CompatResolverOptions extends CoreResolverOptions {\n activePackageRules: ActivePackageRules[];\n options: UserConfig;\n}\n\nexport interface Options {\n appRoot: string;\n emberVersion: string;\n}\n\ntype BuiltIn = {\n importableHelper?: [string, string];\n importableComponent?: [string, string];\n importableModifier?: [string, string];\n};\n\nfunction builtInKeywords(emberVersion: string): Record<string, BuiltIn | undefined> {\n const builtInKeywords: Record<string, BuiltIn | undefined> = {\n '-get-dynamic-var': {},\n '-in-element': {},\n '-with-dynamic-vars': {},\n action: {},\n array: {\n importableHelper: ['array', '@ember/helper'],\n },\n component: {},\n concat: {\n importableHelper: ['concat', '@ember/helper'],\n },\n debugger: {},\n 'each-in': {},\n each: {},\n fn: {\n importableHelper: ['fn', '@ember/helper'],\n },\n get: {\n importableHelper: ['get', '@ember/helper'],\n },\n 'has-block-params': {},\n 'has-block': {},\n hasBlock: {},\n hasBlockParams: {},\n hash: {\n importableHelper: ['hash', '@ember/helper'],\n },\n helper: {},\n if: {},\n 'in-element': {},\n input: {\n importableComponent: ['Input', '@ember/component'],\n },\n let: {},\n 'link-to': {\n importableComponent: ['LinkTo', '@ember/routing'],\n },\n loc: {},\n log: {},\n modifier: {},\n mount: {},\n mut: {},\n on: {\n importableModifier: ['on', '@ember/modifier'],\n },\n outlet: {},\n partial: {},\n 'query-params': {},\n readonly: {},\n textarea: {\n importableComponent: ['Textarea', '@ember/component'],\n },\n unbound: {},\n 'unique-id': {},\n unless: {},\n with: {},\n yield: {},\n };\n if (satisfies(emberVersion, '>=5.2')) {\n builtInKeywords['unique-id'] = {\n importableHelper: ['uniqueId', '@ember/helper'],\n };\n }\n return builtInKeywords;\n}\n\ninterface ComponentResolution {\n type: 'component';\n specifier: string;\n importedName: string;\n yieldsComponents: Required<ComponentRules>['yieldsSafeComponents'];\n yieldsArguments: Required<ComponentRules>['yieldsArguments'];\n argumentsAreComponents: string[];\n nameHint: string;\n}\n\ntype HelperResolution = {\n type: 'helper';\n nameHint: string;\n specifier: string;\n importedName: string;\n};\n\ntype ModifierResolution = {\n type: 'modifier';\n specifier: string;\n importedName: string;\n nameHint: string;\n};\n\ntype ResolutionResult = ComponentResolution | HelperResolution | ModifierResolution;\n\ninterface ResolutionFail {\n type: 'error';\n message: string;\n detail: string;\n loc: Loc;\n}\n\ntype Resolution = ResolutionResult | ResolutionFail;\n\ntype ComponentLocator =\n | {\n type: 'literal';\n path: string;\n }\n | {\n type: 'path';\n path: string;\n }\n | {\n type: 'other';\n };\n\nclass TemplateResolver implements ASTPlugin {\n readonly name = 'embroider-build-time-resolver';\n\n private auditHandler: undefined | ((msg: AuditMessage) => void);\n private scopeStack = new ScopeStack();\n\n private moduleResolver: Resolver;\n\n constructor(\n private env: Env,\n private config: CompatResolverOptions,\n private builtInsForEmberVersion: ReturnType<typeof builtInKeywords>\n ) {\n this.moduleResolver = new Resolver(config);\n if ((globalThis as any).embroider_audit) {\n this.auditHandler = (globalThis as any).embroider_audit;\n }\n }\n\n private emit<Target extends WalkerPath<ASTv1.Node>>(\n parentPath: Target,\n resolution: Resolution | null,\n setter: (target: Target['node'], newIdentifier: ASTv1.PathExpression) => void\n ) {\n switch (resolution?.type) {\n case 'error':\n this.reportError(resolution);\n return;\n case 'component':\n case 'modifier':\n case 'helper': {\n let name = this.env.meta.jsutils.bindImport(resolution.specifier, resolution.importedName, parentPath, {\n nameHint: resolution.nameHint,\n });\n setter(parentPath.node, this.env.syntax.builders.path(name));\n return;\n }\n case undefined:\n return;\n default:\n assertNever(resolution);\n }\n }\n\n private reportError(dep: ResolutionFail) {\n if (!this.auditHandler && !this.config.options.allowUnsafeDynamicComponents) {\n let e: any = new Error(`${dep.message}: ${dep.detail} in ${this.humanReadableFile(this.env.filename)}`);\n e.isTemplateResolverError = true;\n e.loc = dep.loc;\n e.moduleName = this.env.filename;\n throw e;\n }\n if (this.auditHandler) {\n this.auditHandler({\n message: dep.message,\n filename: this.env.filename,\n detail: dep.detail,\n loc: dep.loc,\n source: this.env.contents,\n });\n }\n }\n\n private humanReadableFile(file: string) {\n let { appRoot } = this.config;\n if (!appRoot.endsWith(sep)) {\n appRoot += sep;\n }\n if (file.startsWith(appRoot)) {\n return file.slice(appRoot.length);\n }\n return file;\n }\n\n private handleComponentHelper(\n param: ASTv1.Node,\n impliedBecause?: { componentName: string; argumentName: string }\n ): ComponentResolution | ResolutionFail | null {\n let locator: ComponentLocator;\n switch (param.type) {\n case 'StringLiteral':\n locator = { type: 'literal', path: param.value };\n break;\n case 'PathExpression':\n locator = { type: 'path', path: param.original };\n break;\n case 'MustacheStatement':\n if (param.hash.pairs.length === 0 && param.params.length === 0) {\n return this.handleComponentHelper(param.path, impliedBecause);\n } else if (param.path.type === 'PathExpression' && param.path.original === 'component') {\n // safe because we will handle this inner `{{component ...}}` mustache on its own\n return null;\n } else {\n locator = { type: 'other' };\n }\n break;\n case 'TextNode':\n locator = { type: 'literal', path: param.chars };\n break;\n case 'SubExpression':\n if (param.path.type === 'PathExpression' && param.path.original === 'component') {\n // safe because we will handle this inner `(component ...)` subexpression on its own\n return null;\n }\n if (param.path.type === 'PathExpression' && param.path.original === 'ensure-safe-component') {\n // safe because we trust ensure-safe-component\n return null;\n }\n locator = { type: 'other' };\n break;\n default:\n locator = { type: 'other' };\n }\n\n if (locator.type === 'path' && this.scopeStack.safeComponentInScope(locator.path)) {\n return null;\n }\n\n return this.targetComponentHelper(locator, param.loc, impliedBecause);\n }\n\n private handleDynamicComponentArguments(\n componentName: string,\n argumentsAreComponents: string[],\n attributes: WalkerPath<ASTv1.AttrNode | ASTv1.HashPair>[]\n ) {\n for (let name of argumentsAreComponents) {\n let attr = attributes.find(attr => {\n if (attr.node.type === 'AttrNode') {\n return attr.node.name === '@' + name;\n } else {\n return attr.node.key === name;\n }\n });\n if (attr) {\n let resolution = this.handleComponentHelper(attr.node.value, {\n componentName,\n argumentName: name,\n });\n this.emit(attr, resolution, (node, newId) => {\n if (node.type === 'AttrNode') {\n node.value = this.env.syntax.builders.mustache(newId);\n } else {\n node.value = newId;\n }\n });\n }\n }\n }\n\n private get staticComponentsEnabled(): boolean {\n return this.config.options.staticComponents || Boolean(this.auditHandler);\n }\n\n private get staticHelpersEnabled(): boolean {\n return this.config.options.staticHelpers || Boolean(this.auditHandler);\n }\n\n private get staticModifiersEnabled(): boolean {\n return this.config.options.staticModifiers || Boolean(this.auditHandler);\n }\n\n private isIgnoredComponent(dasherizedName: string) {\n return this.rules.components.get(dasherizedName)?.safeToIgnore;\n }\n\n @Memoize()\n private get rules() {\n // rules that are keyed by the filename they're talking about\n let files: Map<string, PreprocessedComponentRule> = new Map();\n\n // rules that are keyed by our dasherized interpretation of the component's name\n let components: Map<string, PreprocessedComponentRule> = new Map();\n\n // we're not responsible for filtering out rules for inactive packages here,\n // that is done before getting to us. So we should assume these are all in\n // force.\n for (let rule of this.config.activePackageRules) {\n if (rule.components) {\n for (let [snippet, rules] of Object.entries(rule.components)) {\n let processedRules = preprocessComponentRule(rules);\n let dasherizedName = this.standardDasherize(snippet, rule);\n components.set(dasherizedName, processedRules);\n if (rules.layout) {\n for (let root of rule.roots) {\n if (rules.layout.addonPath) {\n files.set(join(root, rules.layout.addonPath), processedRules);\n }\n if (rules.layout.appPath) {\n files.set(join(root, rules.layout.appPath), processedRules);\n }\n }\n }\n }\n }\n if (rule.appTemplates) {\n for (let [path, templateRules] of Object.entries(rule.appTemplates)) {\n let processedRules = preprocessComponentRule(templateRules);\n for (let root of rule.roots) {\n files.set(join(appTreeRulesDir(root, this.moduleResolver), path), processedRules);\n }\n }\n }\n if (rule.addonTemplates) {\n for (let [path, templateRules] of Object.entries(rule.addonTemplates)) {\n let processedRules = preprocessComponentRule(templateRules);\n for (let root of rule.roots) {\n files.set(join(root, path), processedRules);\n }\n }\n }\n }\n return { files, components };\n }\n\n private findRules(absPath: string): PreprocessedComponentRule | undefined {\n // when babel is invoked by vite our filenames can have query params still\n // hanging off them. That would break rule matching.\n absPath = cleanUrl(absPath);\n\n let fileRules = this.rules.files.get(absPath);\n let componentRules: PreprocessedComponentRule | undefined;\n\n let componentName = this.moduleResolver.reverseComponentLookup(absPath);\n if (componentName) {\n componentRules = this.rules.components.get(componentName);\n }\n\n if (fileRules && componentRules) {\n return mergeWith(fileRules, componentRules, appendArrays);\n }\n\n return fileRules ?? componentRules;\n }\n\n private standardDasherize(snippet: string, rule: PackageRules | ModuleRules): string {\n let name = snippetToDasherizedName(snippet);\n if (name == null) {\n throw new Error(`unable to parse component snippet \"${snippet}\" from rule ${JSON.stringify(rule, null, 2)}`);\n }\n return name;\n }\n\n private targetComponent(name: string): ComponentResolution | null {\n if (!this.staticComponentsEnabled) {\n return null;\n }\n\n const builtIn = this.builtInsForEmberVersion[name];\n\n if (builtIn?.importableComponent) {\n let [importedName, specifier] = builtIn.importableComponent;\n return {\n type: 'component',\n specifier,\n importedName,\n yieldsComponents: [],\n yieldsArguments: [],\n argumentsAreComponents: [],\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n if (this.isIgnoredComponent(name)) {\n return null;\n }\n\n let componentRules = this.rules.components.get(name);\n return {\n type: 'component',\n specifier: `@embroider/virtual/components/${name}`,\n importedName: 'default',\n yieldsComponents: componentRules ? componentRules.yieldsSafeComponents : [],\n yieldsArguments: componentRules ? componentRules.yieldsArguments : [],\n argumentsAreComponents: componentRules ? componentRules.argumentsAreComponents : [],\n nameHint: this.nameHint(name),\n };\n }\n\n private targetComponentHelper(\n component: ComponentLocator,\n loc: Loc,\n impliedBecause?: { componentName: string; argumentName: string }\n ): ComponentResolution | ResolutionFail | null {\n if (!this.staticComponentsEnabled) {\n return null;\n }\n\n let message;\n if (impliedBecause) {\n message = `argument \"${impliedBecause.argumentName}\" to component \"${impliedBecause.componentName}\" is treated as a component, but the value you're passing is dynamic`;\n } else {\n message = `Unsafe dynamic component`;\n }\n\n if (component.type === 'other') {\n return {\n type: 'error',\n message,\n detail: `cannot statically analyze this expression`,\n loc,\n };\n }\n if (component.type === 'path') {\n let ownComponentRules = this.findRules(this.env.filename);\n if (ownComponentRules && ownComponentRules.safeInteriorPaths.includes(component.path)) {\n return null;\n }\n return {\n type: 'error',\n message,\n detail: component.path,\n loc,\n };\n }\n\n return this.targetComponent(component.path);\n }\n\n private targetHelper(path: string): HelperResolution | null {\n if (!this.staticHelpersEnabled) {\n return null;\n }\n\n // people are not allowed to override the built-in helpers with their own\n // globally-named helpers. It throws an error. So it's fine for us to\n // prioritize the builtIns here without bothering to resolve a user helper\n // of the same name.\n const builtIn = this.builtInsForEmberVersion[path];\n\n if (builtIn?.importableHelper) {\n let [importedName, specifier] = builtIn.importableHelper;\n return {\n type: 'helper',\n specifier,\n importedName,\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n\n return {\n type: 'helper',\n specifier: `@embroider/virtual/helpers/${path}`,\n importedName: 'default',\n nameHint: this.nameHint(path),\n };\n }\n\n private targetHelperOrComponent(\n path: string,\n loc: Loc,\n hasArgs: boolean\n ): ComponentResolution | HelperResolution | null {\n /*\n\n In earlier embroider versions we would do a bunch of module resolution right\n here inside the ast transform to try to resolve the ambiguity of this case\n and if we didn't find anything, leave the template unchanged. But that leads\n to both a lot of extra build-time expense (since we are attempting\n resolution for lots of things that may in fact be just some data and not a\n component invocation at all, and also since we are pre-resolving modules\n that will get resolved a second time by the final stage packager).\n\n Now, we're going to be less forgiving, because it streamlines the build for\n everyone who's not still using these *extremely* old patterns.\n\n The problematic case is:\n\n 1. In a non-strict template (because this whole resolver-transform.ts is a\n no-op on strict handlebars).\n\n 2. Have a mustache statement like: `{{something}}`, where `something` is:\n\n a. Not a variable in scope (for example, there's no preceeding line\n like `<Parent as |something|>`)\n b. Does not start with `@` because that must be an argument from outside this template.\n c. Does not contain a dot, like `some.thing` (because that case is classically\n never a global component resolution that we would need to handle)\n d. Does not start with `this` (this rule is mostly redundant with the previous rule,\n but even a standalone `this` is never a component invocation).\n e. Does not have any arguments. If there are argument like `{{something a=b}}`,\n there is still ambiguity between helper vs component, but there is no longer\n the possibility that this was just rendering some data.\n f. Does not take a block, like `{{#something}}{{/something}}` (because that is\n always a component, no ambiguity.)\n\n We can't tell if this problematic case is really:\n\n 1. A helper invocation with no arguments that is being directly rendered.\n Out-of-the-box, ember already generates [a lint\n error](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-curly-component-invocation.md)\n for this, although it tells you to whitelist your helper when IMO it\n should tell you to use an unambiguous syntax like `{{ (something) }}`\n instead.\n\n 2. A component invocation, which you could have written `<Something />`\n instead. Angle-bracket invocation has been available and easy-to-adopt\n for a very long time.\n\n 3. Property-this-fallback for `{{this.something}}`. Property-this-fallback\n is eliminated at Ember 4.0, so people have been heavily pushed to get\n it out of their addons.\n */\n\n // first, bail out on all the stuff we can obviously ignore\n if ((!this.staticHelpersEnabled && !this.staticComponentsEnabled) || this.isIgnoredComponent(path)) {\n return null;\n }\n\n let builtIn = this.builtInsForEmberVersion[path];\n\n if (builtIn?.importableComponent) {\n let [importedName, specifier] = builtIn.importableComponent;\n return {\n type: 'component',\n specifier,\n importedName,\n yieldsComponents: [],\n yieldsArguments: [],\n argumentsAreComponents: [],\n nameHint: importedName,\n };\n }\n\n if (builtIn?.importableHelper) {\n let [importedName, specifier] = builtIn.importableHelper;\n return {\n type: 'helper',\n specifier,\n importedName,\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n\n let ownComponentRules = this.findRules(this.env.filename);\n if (ownComponentRules?.disambiguate[path]) {\n switch (ownComponentRules.disambiguate[path]) {\n case 'component':\n return this.targetComponent(path);\n case 'helper':\n return this.targetHelper(path);\n case 'data':\n return null;\n }\n }\n\n if (!hasArgs && !path.includes('/') && !path.includes('@')) {\n // this is the case that could also be property-this-fallback. We're going\n // to force people to disambiguate, because letting a potential component\n // or helper invocation lurk inside every bit of data you render is not\n // ok.\n this.reportError({\n type: 'error',\n message: 'unsupported ambiguous syntax',\n detail: `\"{{${path}}}\" is ambiguous and could mean \"{{this.${path}}}\" or component \"<${capitalize(\n camelCase(path)\n )} />\" or helper \"{{ (${path}) }}\". Change it to one of those unambigous forms, or use a \"disambiguate\" packageRule to work around the problem if its in third-party code you cannot easily fix.`,\n loc,\n });\n return null;\n }\n\n // Above we already bailed out if both of these were disabled, so we know at\n // least one is turned on. If both aren't turned on, we're stuck, because we\n // can't even tell if this *is* a component vs a helper.\n if (!this.staticHelpersEnabled || !this.staticComponentsEnabled) {\n this.reportError({\n type: 'error',\n message: 'unsupported ambiguity between helper and component',\n detail: `this use of \"{{${path}}}\" could be helper \"{{ (${path}) }}\" or component \"<${capitalize(\n camelCase(path)\n )} />\", and your settings for staticHelpers and staticComponents do not agree. Either switch to one of the unambiguous forms, or make staticHelpers and staticComponents agree, or use a \"disambiguate\" packageRule to work around the problem if its in third-party code you cannot easily fix.`,\n loc,\n });\n return null;\n }\n\n let componentRules = this.rules.components.get(path);\n return {\n type: 'component',\n specifier: `@embroider/virtual/ambiguous/${path}`,\n importedName: 'default',\n yieldsComponents: componentRules ? componentRules.yieldsSafeComponents : [],\n yieldsArguments: componentRules ? componentRules.yieldsArguments : [],\n argumentsAreComponents: componentRules ? componentRules.argumentsAreComponents : [],\n nameHint: this.nameHint(path),\n };\n }\n\n private targetElementModifier(path: string): ModifierResolution | null {\n if (!this.staticModifiersEnabled) {\n return null;\n }\n\n const builtIn = this.builtInsForEmberVersion[path];\n if (builtIn?.importableModifier) {\n let [importedName, specifier] = builtIn.importableModifier;\n return {\n type: 'modifier',\n specifier,\n importedName,\n nameHint: importedName,\n };\n }\n\n if (builtIn) {\n return null;\n }\n\n return {\n type: 'modifier',\n specifier: `@embroider/virtual/modifiers/${path}`,\n importedName: 'default',\n nameHint: this.nameHint(path),\n };\n }\n\n targetDynamicModifier(modifier: ComponentLocator, loc: Loc): ModifierResolution | ResolutionFail | null {\n if (!this.staticModifiersEnabled) {\n return null;\n }\n\n if (modifier.type === 'literal') {\n return this.targetElementModifier(modifier.path);\n } else {\n return {\n type: 'error',\n message: 'Unsafe dynamic modifier',\n detail: `cannot statically analyze this expression`,\n loc,\n };\n }\n }\n\n private targetDynamicHelper(helper: ComponentLocator): HelperResolution | null {\n if (!this.staticHelpersEnabled) {\n return null;\n }\n\n if (helper.type === 'literal') {\n return this.targetHelper(helper.path);\n }\n\n // we don't have to manage any errors in this case because ember itself\n // considers it an error to pass anything but a string literal to the\n // `helper` helper.\n return null;\n }\n\n private nameHint(path: string) {\n let parts = path.split('@');\n\n // the extra underscore here guarantees that we will never collide with an\n // HTML element.\n return 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 if (node.path.tail.length === 0 && node.path.head.type === 'VarHead') {\n let resolution = this.targetHelper(node.path.original);\n this.emit(path, resolution, (node, newId) => {\n node.path = newId;\n });\n }\n },\n MustacheStatement: {\n enter: (node, path) => {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n let rootName = 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, emberVersion }: Options) {\n let config: CompatResolverOptions = readJSONSync(join(locateEmbroiderWorkingDir(appRoot), 'resolver.json'));\n const resolverTransform: ASTPluginBuilder<Env> = env => {\n if (env.strictMode) {\n return {\n name: 'embroider-build-time-resolver-strict-noop',\n visitor: {},\n };\n }\n return new TemplateResolver(env, config, builtInKeywords(emberVersion));\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"]}
|