@embroider/compat 0.47.1 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/audit-cli.js +0 -0
- package/src/build-compat-addon.js +7 -1
- package/src/build-compat-addon.js.map +1 -1
- package/src/compat-adapters/ember-cli-babel.d.ts +4 -0
- package/src/compat-adapters/ember-cli-babel.js +25 -0
- package/src/compat-adapters/ember-cli-babel.js.map +1 -0
- package/src/compat-adapters/ember-get-config.js +5 -1
- package/src/compat-adapters/ember-get-config.js.map +1 -1
- package/src/compat-app.js +5 -3
- package/src/compat-app.js.map +1 -1
- package/src/dependency-rules.js.map +1 -1
- package/src/options.js +1 -0
- package/src/options.js.map +1 -1
- package/src/resolver-transform.d.ts +1 -0
- package/src/resolver-transform.js +30 -1
- package/src/resolver-transform.js.map +1 -1
- package/src/resolver.d.ts +10 -2
- package/src/resolver.js +62 -3
- package/src/resolver.js.map +1 -1
- package/src/v1-addon.d.ts +1 -0
- package/src/v1-addon.js +19 -0
- package/src/v1-addon.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embroider/compat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Backward compatibility layer for the Embroider build system.",
|
|
6
6
|
"repository": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
30
30
|
"@babel/preset-env": "^7.14.5",
|
|
31
31
|
"@babel/traverse": "^7.14.5",
|
|
32
|
-
"@embroider/macros": "0.
|
|
33
|
-
"@embroider/shared-internals": "0.
|
|
32
|
+
"@embroider/macros": "0.49.0",
|
|
33
|
+
"@embroider/shared-internals": "0.49.0",
|
|
34
34
|
"@types/babel__code-frame": "^7.0.2",
|
|
35
35
|
"@types/yargs": "^17.0.3",
|
|
36
36
|
"assert-never": "^1.1.0",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"typescript": "*"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@embroider/core": "0.
|
|
88
|
+
"@embroider/core": "0.49.0"
|
|
89
89
|
},
|
|
90
90
|
"engines": {
|
|
91
91
|
"node": "12.* || 14.* || >= 16"
|
package/src/audit-cli.js
CHANGED
|
File without changes
|
|
@@ -26,6 +26,12 @@ function buildCompatAddon(originalPackage, v1Cache) {
|
|
|
26
26
|
return withoutNodeModules(originalPackage);
|
|
27
27
|
}
|
|
28
28
|
let oldPackages = v1Cache.getAddons(originalPackage.root);
|
|
29
|
+
if (oldPackages.length > 1) {
|
|
30
|
+
// extensibility hook that allows a compat adapter to optimize its own
|
|
31
|
+
// smooshing. We do it early so that if it reduces all the way to zero, the
|
|
32
|
+
// next check will handle that.
|
|
33
|
+
oldPackages = oldPackages[0].reduceInstances(oldPackages);
|
|
34
|
+
}
|
|
29
35
|
if (oldPackages.length === 0) {
|
|
30
36
|
// this happens when the v1 addon wasn't actually getting instantiated at
|
|
31
37
|
// all, which can happen if the app uses `addons.blacklist` or another addon
|
|
@@ -37,7 +43,7 @@ function buildCompatAddon(originalPackage, v1Cache) {
|
|
|
37
43
|
// up unused at this point.
|
|
38
44
|
return new empty_package_tree_1.default(originalPackage.name);
|
|
39
45
|
}
|
|
40
|
-
let needsSmooshing = oldPackages[0].hasAnyTrees();
|
|
46
|
+
let needsSmooshing = oldPackages.length > 1 && oldPackages[0].hasAnyTrees();
|
|
41
47
|
if (needsSmooshing) {
|
|
42
48
|
let trees = oldPackages.map(pkg => pkg.v2Tree).reverse();
|
|
43
49
|
let smoosher = new smoosh_package_json_1.default(trees, { annotation: originalPackage.name });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-compat-addon.js","sourceRoot":"","sources":["build-compat-addon.ts"],"names":[],"mappings":";;;;;AAEA,gFAAsD;AACtD,gFAAsD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F,OAAO,IAAA,8BAAkB,EAAC,CAAC,GAAG,KAAK,EAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;KACtE;SAAM;QACL,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;KAC9B;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,eAAwB;IAClD,IAAI,KAAK,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,4BAAU,CAAC,CAAC,CAAC,8BAAY,CAAC;IACnE,OAAO,IAAA,yBAAW,EAAC,IAAI,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE;QAClD,OAAO,EAAE,CAAC,cAAc,CAAC;KAC1B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import V1InstanceCache from './v1-instance-cache';\nimport { Package } from '@embroider/core';\nimport SmooshPackageJSON from './smoosh-package-json';\nimport broccoliMergeTrees from 'broccoli-merge-trees';\nimport { Node } from 'broccoli-node-api';\nimport OneShot from './one-shot';\nimport buildFunnel from 'broccoli-funnel';\nimport { UnwatchedDir, WatchedDir } from 'broccoli-source';\nimport EmptyPackageTree from './empty-package-tree';\n\nexport default function cachedBuildCompatAddon(originalPackage: Package, v1Cache: V1InstanceCache): Node {\n let tree = buildCompatAddon(originalPackage, v1Cache);\n if (!originalPackage.mayRebuild) {\n tree = new OneShot(tree, originalPackage.name);\n }\n return tree;\n}\n\nfunction buildCompatAddon(originalPackage: Package, v1Cache: V1InstanceCache): Node {\n if (originalPackage.isV2Addon()) {\n // this case is needed when a native-v2 addon depends on a\n // non-native-v2 addon. (The non-native one will get rewritten and\n // therefore moved, so to continue depending on it the native one needs to\n // move too.)\n return withoutNodeModules(originalPackage);\n }\n\n let oldPackages = v1Cache.getAddons(originalPackage.root);\n\n if (oldPackages.length > 1) {\n // extensibility hook that allows a compat adapter to optimize its own\n // smooshing. We do it early so that if it reduces all the way to zero, the\n // next check will handle that.\n oldPackages = oldPackages[0].reduceInstances(oldPackages);\n }\n\n if (oldPackages.length === 0) {\n // this happens when the v1 addon wasn't actually getting instantiated at\n // all, which can happen if the app uses `addons.blacklist` or another addon\n // uses `shouldIncludeChildAddon`.\n //\n // we still keep a place for this addon in the rewritten addon workspace,\n // because that whole process only depends on looking at all the\n // package.json files on disk -- it can't know which ones are going to end\n // up unused at this point.\n return new EmptyPackageTree(originalPackage.name);\n }\n\n let needsSmooshing = oldPackages.length > 1 && oldPackages[0].hasAnyTrees();\n if (needsSmooshing) {\n let trees = oldPackages.map(pkg => pkg.v2Tree).reverse();\n let smoosher = new SmooshPackageJSON(trees, { annotation: originalPackage.name });\n return broccoliMergeTrees([...trees, smoosher], { overwrite: true });\n } else {\n return oldPackages[0].v2Tree;\n }\n}\n\nfunction withoutNodeModules(originalPackage: Package): Node {\n let Klass = originalPackage.mayRebuild ? WatchedDir : UnwatchedDir;\n return buildFunnel(new Klass(originalPackage.root), {\n exclude: ['node_modules'],\n });\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const v1_addon_1 = __importDefault(require("../v1-addon"));
|
|
7
|
+
class EmberCliBabel extends v1_addon_1.default {
|
|
8
|
+
// the only copy of ember-cli-babel that might need to do something is the
|
|
9
|
+
// first one that wants to emit babel polyfills. No other copy is allowed to
|
|
10
|
+
// emit anything into the build.
|
|
11
|
+
reduceInstances(copies) {
|
|
12
|
+
let polyfillCopy = copies.find(c => {
|
|
13
|
+
let instance = c.addonInstance;
|
|
14
|
+
return typeof instance._shouldIncludePolyfill === 'function' && instance._shouldIncludePolyfill();
|
|
15
|
+
});
|
|
16
|
+
if (polyfillCopy) {
|
|
17
|
+
return [polyfillCopy];
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = EmberCliBabel;
|
|
25
|
+
//# sourceMappingURL=ember-cli-babel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ember-cli-babel.js","sourceRoot":"","sources":["ember-cli-babel.ts"],"names":[],"mappings":";;;;;AAAA,2DAAkC;AAElC,MAAqB,aAAc,SAAQ,kBAAO;IAChD,0EAA0E;IAC1E,4EAA4E;IAC5E,gCAAgC;IAChC,eAAe,CAAC,MAAuB;QACrC,IAAI,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;YACjC,IAAI,QAAQ,GAAG,CAAC,CAAC,aAAoB,CAAC;YACtC,OAAO,OAAO,QAAQ,CAAC,sBAAsB,KAAK,UAAU,IAAI,QAAQ,CAAC,sBAAsB,EAAE,CAAC;QACpG,CAAC,CAAC,CAAC;QACH,IAAI,YAAY,EAAE;YAChB,OAAO,CAAC,YAAY,CAAC,CAAC;SACvB;aAAM;YACL,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF;AAfD,gCAeC","sourcesContent":["import V1Addon from '../v1-addon';\n\nexport default class EmberCliBabel extends V1Addon {\n // the only copy of ember-cli-babel that might need to do something is the\n // first one that wants to emit babel polyfills. No other copy is allowed to\n // emit anything into the build.\n reduceInstances(copies: EmberCliBabel[]): EmberCliBabel[] {\n let polyfillCopy = copies.find(c => {\n let instance = c.addonInstance as any;\n return typeof instance._shouldIncludePolyfill === 'function' && instance._shouldIncludePolyfill();\n });\n if (polyfillCopy) {\n return [polyfillCopy];\n } else {\n return [];\n }\n }\n}\n"]}
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const v1_addon_1 = __importDefault(require("../v1-addon"));
|
|
7
7
|
const broccoli_file_creator_1 = __importDefault(require("broccoli-file-creator"));
|
|
8
|
+
const broccoli_merge_trees_1 = __importDefault(require("broccoli-merge-trees"));
|
|
8
9
|
function createIndexContents(config) {
|
|
9
10
|
return `export default ${JSON.stringify(config)};`;
|
|
10
11
|
}
|
|
@@ -24,7 +25,10 @@ class default_1 extends v1_addon_1.default {
|
|
|
24
25
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
25
26
|
const configModule = require(this.app.configPath());
|
|
26
27
|
const appEnvironmentConfig = configModule(this.app.env);
|
|
27
|
-
return (0,
|
|
28
|
+
return (0, broccoli_merge_trees_1.default)([
|
|
29
|
+
(0, broccoli_file_creator_1.default)('index.js', createIndexContents(appEnvironmentConfig)),
|
|
30
|
+
(0, broccoli_file_creator_1.default)('package.json', JSON.stringify(this.newPackageJSON, null, 2)),
|
|
31
|
+
]);
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
exports.default = default_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ember-get-config.js","sourceRoot":"","sources":["ember-get-config.ts"],"names":[],"mappings":";;;;;AAAA,2DAAkC;AAClC,kFAA8C;AAE9C,SAAS,mBAAmB,CAAC,MAAW;IACtC,OAAO,kBAAkB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC;AACrD,CAAC;AAED;;;;;;;;;;GAUG;AACH,eAAqB,SAAQ,kBAAO;IAClC,IAAI,MAAM;QACR,iEAAiE;QACjE,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QACpD,MAAM,oBAAoB,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAExD,OAAO,IAAA,+BAAS,EAAC,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ember-get-config.js","sourceRoot":"","sources":["ember-get-config.ts"],"names":[],"mappings":";;;;;AAAA,2DAAkC;AAClC,kFAA8C;AAC9C,gFAA8C;AAE9C,SAAS,mBAAmB,CAAC,MAAW;IACtC,OAAO,kBAAkB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC;AACrD,CAAC;AAED;;;;;;;;;;GAUG;AACH,eAAqB,SAAQ,kBAAO;IAClC,IAAI,MAAM;QACR,iEAAiE;QACjE,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QACpD,MAAM,oBAAoB,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAExD,OAAO,IAAA,8BAAU,EAAC;YAChB,IAAA,+BAAS,EAAC,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;YAChE,IAAA,+BAAS,EAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;SACxE,CAAC,CAAC;IACL,CAAC;CACF;AAXD,4BAWC","sourcesContent":["import V1Addon from '../v1-addon';\nimport writeFile from 'broccoli-file-creator';\nimport mergeTrees from 'broccoli-merge-trees';\n\nfunction createIndexContents(config: any): string {\n return `export default ${JSON.stringify(config)};`;\n}\n\n/**\n * The `ember-get-config` addon conceptually does just one thing: re-exports the `config/environment` runtime module\n * from the host app so that addons can import it themseles. It handles the \"hard part\" of knowing what the host app's\n * module name is, since that's not something an addon can normally know ahead of time.\n *\n * From a dependency graph perspective though, declaring all of the dependencies correctly would require a circular\n * dependency from the addon back to the host app itself, which we don't want to introduce.\n *\n * We need to basically re-implement the entire addon's behavior so that it still exports the app's\n * `config/environment` runtime value, but without needing it to actually export from the host app's module.\n */\nexport default class extends V1Addon {\n get v2Tree() {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const configModule = require(this.app.configPath());\n const appEnvironmentConfig = configModule(this.app.env);\n\n return mergeTrees([\n writeFile('index.js', createIndexContents(appEnvironmentConfig)),\n writeFile('package.json', JSON.stringify(this.newPackageJSON, null, 2)),\n ]);\n }\n}\n"]}
|
package/src/compat-app.js
CHANGED
|
@@ -133,9 +133,11 @@ class CompatAppAdapter {
|
|
|
133
133
|
}
|
|
134
134
|
activeAddonChildren(pkg = this.appPackage) {
|
|
135
135
|
let result = pkg.dependencies.filter(this.isActiveAddon).filter(
|
|
136
|
-
// When looking for child addons, we want to ignore 'peerDependencies' of
|
|
137
|
-
// align with how ember-cli resolves addons
|
|
138
|
-
|
|
136
|
+
// When looking for child addons, we want to ignore 'peerDependencies' of
|
|
137
|
+
// a given package, to align with how ember-cli resolves addons. So here
|
|
138
|
+
// we only include dependencies that definitely appear in one of the other
|
|
139
|
+
// sections.
|
|
140
|
+
addon => { var _a, _b; return ((_a = pkg.packageJSON.dependencies) === null || _a === void 0 ? void 0 : _a[addon.name]) || ((_b = pkg.packageJSON.devDependencies) === null || _b === void 0 ? void 0 : _b[addon.name]); });
|
|
139
141
|
if (pkg === this.appPackage) {
|
|
140
142
|
let extras = [this.synthVendor, this.synthStyles].filter(this.isActiveAddon);
|
|
141
143
|
result = [...result, ...extras];
|
package/src/compat-app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat-app.js","sourceRoot":"","sources":["compat-app.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,gFAA8C;AAC9C,0CAeyB;AACzB,4EAAkD;AAElD,0DAAiC;AACjC,+BAA4B;AAG5B,2BAA0D;AAC1D,uCAAyD;AACzD,0DAAwC;AACxC,yDAAyF;AACzF,6DAAqC;AACrC,2DAA6C;AAC7C,6DAAqC;AACrC,qCAA8C;AAC9C,qDAA0D;AAC1D,oEAAkC;AAClC,uCAA0C;AAC1C,kEAAqD;AAErD,mGAAmF;AAEnF,oDAA4B;AAS5B,uEAAuE;AACvE,wEAAwE;AACxE,QAAQ;AACR,SAAS,KAAK,CAAC,sBAA8B,EAAE,OAA0B;IACvE,IAAI,UAAU,GAAG,2BAAe,CA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cAAc,CAAC,EAAE,CAAC,CAAC;IACzD,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACjC,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,wBAAwB;IAC/B,OAAO,IAAA,gBAAW,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC;SAC1D,GAAG,CAAC,QAAQ,CAAC,EAAE;QACd,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YAC5B,iEAAiE;YACjE,OAAO,OAAO,CAAC,IAAA,WAAI,EAAC,SAAS,EAAE,wBAAwB,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;SAC7E;IACH,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAC;SACf,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import { Node as BroccoliNode } from 'broccoli-node-api';\nimport mergeTrees from 'broccoli-merge-trees';\nimport {\n Stage,\n PackageCache,\n OutputPaths,\n BuildStage,\n Asset,\n EmberAsset,\n AppAdapter,\n AppBuilder,\n EmberENV,\n Package,\n TemplateCompilerPlugins,\n Resolver,\n NodeTemplateCompiler,\n AddonPackage,\n} from '@embroider/core';\nimport V1InstanceCache from './v1-instance-cache';\nimport V1App from './v1-app';\nimport walkSync from 'walk-sync';\nimport { join } from 'path';\nimport { JSDOM } from 'jsdom';\nimport { V1Config } from './v1-config';\nimport { statSync, readdirSync, writeFileSync } from 'fs';\nimport Options, { optionsWithDefaults } from './options';\nimport CompatResolver from './resolver';\nimport { activePackageRules, PackageRules, expandModuleRules } from './dependency-rules';\nimport flatMap from 'lodash/flatMap';\nimport { Memoize } from 'typescript-memoize';\nimport flatten from 'lodash/flatten';\nimport { sync as resolveSync } from 'resolve';\nimport { MacrosConfig } from '@embroider/macros/src/node';\nimport bind from 'bind-decorator';\nimport { pathExistsSync } from 'fs-extra';\nimport { tmpdir } from '@embroider/shared-internals';\nimport { Options as AdjustImportsOptions } from '@embroider/core/src/babel-plugin-adjust-imports';\nimport { getEmberExports } from '@embroider/core/src/load-ember-template-compiler';\n\nimport semver from 'semver';\n\ninterface TreeNames {\n appJS: BroccoliNode;\n htmlTree: BroccoliNode;\n publicTree: BroccoliNode | undefined;\n configTree: BroccoliNode;\n}\n\n// This runs at broccoli-pipeline-construction time, whereas our actual\n// CompatAppAdapter instance only becomes available during tree-building\n// time.\nfunction setup(legacyEmberAppInstance: object, options: Required<Options>) {\n let oldPackage = V1InstanceCache.forApp(legacyEmberAppInstance, options).app;\n\n let { appJS } = oldPackage.processAppJS();\n let htmlTree = oldPackage.htmlTree;\n let publicTree = oldPackage.publicTree;\n let configTree = oldPackage.config;\n let appBootTree = oldPackage.appBoot;\n\n if (options.extraPublicTrees.length > 0) {\n publicTree = mergeTrees([publicTree, ...options.extraPublicTrees].filter(Boolean) as BroccoliNode[]);\n }\n\n let inTrees = {\n appJS,\n htmlTree,\n publicTree,\n configTree,\n appBootTree,\n };\n\n let instantiate = async (root: string, appSrcDir: string, packageCache: PackageCache) => {\n let appPackage = packageCache.getApp(appSrcDir);\n let adapter = new CompatAppAdapter(\n root,\n appPackage,\n options,\n oldPackage,\n configTree,\n packageCache.get(join(root, 'node_modules', '@embroider', 'synthesized-vendor')),\n packageCache.get(join(root, 'node_modules', '@embroider', 'synthesized-styles'))\n );\n\n return new AppBuilder<TreeNames>(root, appPackage, adapter, options, MacrosConfig.for(legacyEmberAppInstance));\n };\n\n return { inTrees, instantiate };\n}\n\nclass CompatAppAdapter implements AppAdapter<TreeNames> {\n constructor(\n private root: string,\n private appPackage: Package,\n private options: Required<Options>,\n private oldPackage: V1App,\n private configTree: V1Config,\n private synthVendor: Package,\n private synthStyles: Package\n ) {}\n\n appJSSrcDir(treePaths: OutputPaths<TreeNames>) {\n return treePaths.appJS;\n }\n\n @Memoize()\n fastbootJSSrcDir(_treePaths: OutputPaths<TreeNames>) {\n let target = join(this.oldPackage.root, 'fastboot');\n if (pathExistsSync(target)) {\n return target;\n }\n }\n\n get env() {\n return this.oldPackage.env;\n }\n\n assets(treePaths: OutputPaths<TreeNames>): Asset[] {\n let assets: Asset[] = [];\n\n // Everything in our traditional public tree is an on-disk asset\n if (treePaths.publicTree) {\n walkSync\n .entries(treePaths.publicTree, {\n directories: false,\n })\n .forEach(entry => {\n assets.push({\n kind: 'on-disk',\n relativePath: entry.relativePath,\n sourcePath: entry.fullPath,\n mtime: entry.mtime as unknown as number, // https://github.com/joliss/node-walk-sync/pull/38\n size: entry.size,\n });\n });\n }\n\n // ember-cli traditionally outputs a dummy testem.js file to prevent\n // spurious errors when running tests under \"ember s\".\n if (this.oldPackage.shouldBuildTests) {\n let testemAsset = this.findTestemAsset();\n if (testemAsset) {\n assets.push(testemAsset);\n }\n }\n\n for (let asset of this.emberEntrypoints(treePaths.htmlTree)) {\n assets.push(asset);\n }\n\n return assets;\n }\n\n @Memoize()\n findTestemAsset(): Asset | undefined {\n let sourcePath;\n try {\n sourcePath = resolveSync('ember-cli/lib/broccoli/testem.js', { basedir: this.root });\n } catch (err) {}\n if (sourcePath) {\n let stat = statSync(sourcePath);\n return {\n kind: 'on-disk',\n relativePath: 'testem.js',\n sourcePath,\n mtime: stat.mtime.getTime(),\n size: stat.size,\n };\n }\n }\n\n developingAddons(): string[] {\n if (this.oldPackage.owningAddon) {\n return [this.oldPackage.owningAddon.root];\n }\n return [];\n }\n\n @Memoize()\n activeAddonChildren(pkg: Package = this.appPackage): AddonPackage[] {\n let result = (pkg.dependencies.filter(this.isActiveAddon) as AddonPackage[]).filter(\n // When looking for child addons, we want to ignore 'peerDependencies' of a given package, to\n // align with how ember-cli resolves addons\n addon => !pkg.packageJSON.peerDependencies?.[addon.name]\n );\n if (pkg === this.appPackage) {\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 get allActiveAddons(): AddonPackage[] {\n let result = this.appPackage.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 // todo: filter by addon-provided hook\n return pkg.isEmberPackage();\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 @Memoize()\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 let extensions = ['.wasm', '.mjs', '.js', '.json', '.hbs'];\n\n // for now, this is hard-coded. If we see ember-cli-typescript, ts files are\n // resolvable. Once we implement a preprocessor-registration build hook,\n // this logic can be pushed down first into `@embroider/compat` (which can\n // generate the appropriate hooks when it upcompiles ember-cli-typescript),\n // and then later into ember-cli-typescript itself (which can ship a v2\n // version with the hook).\n //\n // Typescript is a slightly weird example of a preprocessor because it gets\n // implemented in babel, so all we realy need to do is make the extension\n // resolvable and there's no other \"loader\" or anything to apply.\n if (this.activeAddonChildren().find(pkg => pkg.name === 'ember-cli-typescript')) {\n extensions.unshift('.ts');\n }\n\n return extensions;\n }\n\n private *emberEntrypoints(htmlTreePath: string): IterableIterator<Asset> {\n let classicEntrypoints = [\n { entrypoint: 'index.html', includeTests: false },\n { entrypoint: 'tests/index.html', includeTests: true },\n ];\n if (!this.oldPackage.shouldBuildTests) {\n classicEntrypoints.pop();\n }\n for (let { entrypoint, includeTests } of classicEntrypoints) {\n let sourcePath = join(htmlTreePath, entrypoint);\n let stats = statSync(sourcePath);\n let asset: EmberAsset = {\n kind: 'ember',\n relativePath: entrypoint,\n includeTests,\n sourcePath,\n mtime: stats.mtime.getTime(),\n size: stats.size,\n rootURL: this.rootURL(),\n prepare: (dom: JSDOM) => {\n let scripts = [...dom.window.document.querySelectorAll('script')];\n let styles = [...dom.window.document.querySelectorAll('link[rel=\"stylesheet\"]')] as HTMLLinkElement[];\n\n return {\n javascript: definitelyReplace(dom, this.oldPackage.findAppScript(scripts, entrypoint)),\n styles: definitelyReplace(dom, this.oldPackage.findAppStyles(styles, entrypoint)),\n implicitScripts: definitelyReplace(dom, this.oldPackage.findVendorScript(scripts, entrypoint)),\n implicitStyles: definitelyReplace(dom, this.oldPackage.findVendorStyles(styles, entrypoint)),\n testJavascript: maybeReplace(dom, this.oldPackage.findTestScript(scripts)),\n implicitTestScripts: maybeReplace(dom, this.oldPackage.findTestSupportScript(scripts)),\n implicitTestStyles: maybeReplace(dom, this.oldPackage.findTestSupportStyles(styles)),\n };\n },\n };\n yield asset;\n }\n }\n\n autoRun(): boolean {\n return this.oldPackage.autoRun;\n }\n\n appBoot(): string | undefined {\n return this.oldPackage.appBoot.readAppBoot();\n }\n\n mainModule(): string {\n return 'app';\n }\n\n mainModuleConfig(): unknown {\n return this.configTree.readConfig().APP;\n }\n\n emberENV(): EmberENV {\n return this.configTree.readConfig().EmberENV;\n }\n\n modulePrefix(): string {\n return this.configTree.readConfig().modulePrefix;\n }\n\n podModulePrefix(): string | undefined {\n return this.configTree.readConfig().podModulePrefix;\n }\n\n rootURL(): string {\n return this.configTree.readConfig().rootURL;\n }\n\n templateCompilerPath(): string {\n return 'ember-source/vendor/ember/ember-template-compiler';\n }\n\n strictV2Format() {\n return false;\n }\n\n @Memoize()\n private activeRules() {\n return activePackageRules(this.options.packageRules.concat(defaultAddonPackageRules()), [\n this.appPackage,\n ...this.allActiveAddons.filter(p => p.meta['auto-upgraded']),\n ]);\n }\n\n @Memoize()\n templateResolver(): Resolver {\n return new CompatResolver({\n root: this.root,\n modulePrefix: this.modulePrefix(),\n podModulePrefix: this.podModulePrefix(),\n options: this.options,\n activePackageRules: this.activeRules(),\n adjustImportsOptionsPath: this.adjustImportsOptionsPath(),\n });\n }\n\n @Memoize()\n adjustImportsOptionsPath(): string {\n let file = join(this.root, '_adjust_imports.json');\n writeFileSync(file, JSON.stringify(this.adjustImportsOptions()));\n return file;\n }\n\n @Memoize()\n adjustImportsOptions(): AdjustImportsOptions {\n return this.makeAdjustImportOptions(true);\n }\n\n // this gets serialized out by babel plugin and ast plugin\n private makeAdjustImportOptions(outer: boolean): AdjustImportsOptions {\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 activeAddons: AdjustImportsOptions['activeAddons'] = {};\n for (let addon of this.allActiveAddons) {\n activeAddons[addon.name] = addon.root;\n }\n\n let emberSource = this.activeAddonChildren().find(a => a.name === 'ember-source')!;\n let emberNeedsModulesPolyfill = semver.satisfies(emberSource.version, '<3.27.0-beta.0', {\n includePrerelease: true,\n });\n\n return {\n activeAddons,\n renameModules,\n renamePackages,\n // \"outer\" here prevents uncontrolled recursion. We can't know our\n // extraImports until after we have the internalTemplateResolver which in\n // turn needs some adjustImportsOptions\n extraImports: outer ? this.extraImports() : [],\n relocatedFiles: {}, // this is the only part we can't completely fill out here. It needs to wait for the AppBuilder to finish smooshing together all appTrees\n resolvableExtensions: this.resolvableExtensions(),\n\n // it's important that this is a persistent location, because we fill it\n // up as a side-effect of babel transpilation, and babel is subject to\n // persistent caching.\n externalsDir: join(tmpdir, 'embroider', 'externals'),\n emberNeedsModulesPolyfill,\n };\n }\n\n // unlike `templateResolver`, this one brings its own simple TemplateCompiler\n // along so it's capable of parsing component snippets in people's module\n // rules.\n @Memoize()\n private internalTemplateResolver(): CompatResolver {\n let resolver = new CompatResolver({\n root: this.root,\n modulePrefix: this.modulePrefix(),\n options: this.options,\n activePackageRules: this.activeRules(),\n adjustImportsOptions: this.makeAdjustImportOptions(false),\n });\n\n const compilerPath = resolveSync(this.templateCompilerPath(), { basedir: this.root });\n const { cacheKey: compilerChecksum } = getEmberExports(compilerPath);\n // It's ok that this isn't a fully configured template compiler. We're only\n // using it to parse component snippets out of rules.\n resolver.astTransformer(\n new NodeTemplateCompiler({\n compilerPath,\n compilerChecksum,\n\n EmberENV: {},\n plugins: {},\n })\n );\n return resolver;\n }\n\n private extraImports() {\n let output: { absPath: string; target: string; runtimeName?: string }[][] = [];\n\n for (let rule of this.activeRules()) {\n if (rule.addonModules) {\n for (let [filename, moduleRules] of Object.entries(rule.addonModules)) {\n for (let root of rule.roots) {\n let absPath = join(root, filename);\n output.push(expandModuleRules(absPath, moduleRules, this.internalTemplateResolver()));\n }\n }\n }\n if (rule.appModules) {\n for (let [filename, moduleRules] of Object.entries(rule.appModules)) {\n let absPath = join(this.root, filename);\n output.push(expandModuleRules(absPath, moduleRules, this.internalTemplateResolver()));\n }\n }\n }\n return flatten(output);\n }\n\n htmlbarsPlugins(): TemplateCompilerPlugins {\n return this.oldPackage.htmlbarsPlugins;\n }\n\n babelMajorVersion() {\n return this.oldPackage.babelMajorVersion();\n }\n\n babelConfig() {\n return this.oldPackage.babelConfig();\n }\n}\n\nexport default class CompatApp extends BuildStage<TreeNames> {\n constructor(legacyEmberAppInstance: object, addons: Stage, options?: Options) {\n let { inTrees, instantiate } = setup(legacyEmberAppInstance, optionsWithDefaults(options));\n super(addons, inTrees, '@embroider/compat/app', instantiate);\n }\n}\n\nfunction maybeReplace(dom: JSDOM, element: Element | undefined): Node | undefined {\n if (element) {\n return definitelyReplace(dom, element);\n }\n}\n\nfunction definitelyReplace(dom: JSDOM, element: Element): Node {\n let placeholder = dom.window.document.createTextNode('');\n element.replaceWith(placeholder);\n return placeholder;\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"]}
|
|
1
|
+
{"version":3,"file":"compat-app.js","sourceRoot":"","sources":["compat-app.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,gFAA8C;AAC9C,0CAeyB;AACzB,4EAAkD;AAElD,0DAAiC;AACjC,+BAA4B;AAG5B,2BAA0D;AAC1D,uCAAyD;AACzD,0DAAwC;AACxC,yDAAyF;AACzF,6DAAqC;AACrC,2DAA6C;AAC7C,6DAAqC;AACrC,qCAA8C;AAC9C,qDAA0D;AAC1D,oEAAkC;AAClC,uCAA0C;AAC1C,kEAAqD;AAErD,mGAAmF;AAEnF,oDAA4B;AAS5B,uEAAuE;AACvE,wEAAwE;AACxE,QAAQ;AACR,SAAS,KAAK,CAAC,sBAA8B,EAAE,OAA0B;IACvE,IAAI,UAAU,GAAG,2BAAe,CAAC,MAAM,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC;IAE7E,IAAI,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,YAAY,EAAE,CAAC;IAC1C,IAAI,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IACnC,IAAI,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;IACvC,IAAI,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC;IACnC,IAAI,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC;IAErC,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QACvC,UAAU,GAAG,IAAA,8BAAU,EAAC,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAmB,CAAC,CAAC;KACtG;I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C7E;IACH,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAC;SACf,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import { Node as BroccoliNode } from 'broccoli-node-api';\nimport mergeTrees from 'broccoli-merge-trees';\nimport {\n Stage,\n PackageCache,\n OutputPaths,\n BuildStage,\n Asset,\n EmberAsset,\n AppAdapter,\n AppBuilder,\n EmberENV,\n Package,\n TemplateCompilerPlugins,\n Resolver,\n NodeTemplateCompiler,\n AddonPackage,\n} from '@embroider/core';\nimport V1InstanceCache from './v1-instance-cache';\nimport V1App from './v1-app';\nimport walkSync from 'walk-sync';\nimport { join } from 'path';\nimport { JSDOM } from 'jsdom';\nimport { V1Config } from './v1-config';\nimport { statSync, readdirSync, writeFileSync } from 'fs';\nimport Options, { optionsWithDefaults } from './options';\nimport CompatResolver from './resolver';\nimport { activePackageRules, PackageRules, expandModuleRules } from './dependency-rules';\nimport flatMap from 'lodash/flatMap';\nimport { Memoize } from 'typescript-memoize';\nimport flatten from 'lodash/flatten';\nimport { sync as resolveSync } from 'resolve';\nimport { MacrosConfig } from '@embroider/macros/src/node';\nimport bind from 'bind-decorator';\nimport { pathExistsSync } from 'fs-extra';\nimport { tmpdir } from '@embroider/shared-internals';\nimport { Options as AdjustImportsOptions } from '@embroider/core/src/babel-plugin-adjust-imports';\nimport { getEmberExports } from '@embroider/core/src/load-ember-template-compiler';\n\nimport semver from 'semver';\n\ninterface TreeNames {\n appJS: BroccoliNode;\n htmlTree: BroccoliNode;\n publicTree: BroccoliNode | undefined;\n configTree: BroccoliNode;\n}\n\n// This runs at broccoli-pipeline-construction time, whereas our actual\n// CompatAppAdapter instance only becomes available during tree-building\n// time.\nfunction setup(legacyEmberAppInstance: object, options: Required<Options>) {\n let oldPackage = V1InstanceCache.forApp(legacyEmberAppInstance, options).app;\n\n let { appJS } = oldPackage.processAppJS();\n let htmlTree = oldPackage.htmlTree;\n let publicTree = oldPackage.publicTree;\n let configTree = oldPackage.config;\n let appBootTree = oldPackage.appBoot;\n\n if (options.extraPublicTrees.length > 0) {\n publicTree = mergeTrees([publicTree, ...options.extraPublicTrees].filter(Boolean) as BroccoliNode[]);\n }\n\n let inTrees = {\n appJS,\n htmlTree,\n publicTree,\n configTree,\n appBootTree,\n };\n\n let instantiate = async (root: string, appSrcDir: string, packageCache: PackageCache) => {\n let appPackage = packageCache.getApp(appSrcDir);\n let adapter = new CompatAppAdapter(\n root,\n appPackage,\n options,\n oldPackage,\n configTree,\n packageCache.get(join(root, 'node_modules', '@embroider', 'synthesized-vendor')),\n packageCache.get(join(root, 'node_modules', '@embroider', 'synthesized-styles'))\n );\n\n return new AppBuilder<TreeNames>(root, appPackage, adapter, options, MacrosConfig.for(legacyEmberAppInstance));\n };\n\n return { inTrees, instantiate };\n}\n\nclass CompatAppAdapter implements AppAdapter<TreeNames> {\n constructor(\n private root: string,\n private appPackage: Package,\n private options: Required<Options>,\n private oldPackage: V1App,\n private configTree: V1Config,\n private synthVendor: Package,\n private synthStyles: Package\n ) {}\n\n appJSSrcDir(treePaths: OutputPaths<TreeNames>) {\n return treePaths.appJS;\n }\n\n @Memoize()\n fastbootJSSrcDir(_treePaths: OutputPaths<TreeNames>) {\n let target = join(this.oldPackage.root, 'fastboot');\n if (pathExistsSync(target)) {\n return target;\n }\n }\n\n get env() {\n return this.oldPackage.env;\n }\n\n assets(treePaths: OutputPaths<TreeNames>): Asset[] {\n let assets: Asset[] = [];\n\n // Everything in our traditional public tree is an on-disk asset\n if (treePaths.publicTree) {\n walkSync\n .entries(treePaths.publicTree, {\n directories: false,\n })\n .forEach(entry => {\n assets.push({\n kind: 'on-disk',\n relativePath: entry.relativePath,\n sourcePath: entry.fullPath,\n mtime: entry.mtime as unknown as number, // https://github.com/joliss/node-walk-sync/pull/38\n size: entry.size,\n });\n });\n }\n\n // ember-cli traditionally outputs a dummy testem.js file to prevent\n // spurious errors when running tests under \"ember s\".\n if (this.oldPackage.shouldBuildTests) {\n let testemAsset = this.findTestemAsset();\n if (testemAsset) {\n assets.push(testemAsset);\n }\n }\n\n for (let asset of this.emberEntrypoints(treePaths.htmlTree)) {\n assets.push(asset);\n }\n\n return assets;\n }\n\n @Memoize()\n findTestemAsset(): Asset | undefined {\n let sourcePath;\n try {\n sourcePath = resolveSync('ember-cli/lib/broccoli/testem.js', { basedir: this.root });\n } catch (err) {}\n if (sourcePath) {\n let stat = statSync(sourcePath);\n return {\n kind: 'on-disk',\n relativePath: 'testem.js',\n sourcePath,\n mtime: stat.mtime.getTime(),\n size: stat.size,\n };\n }\n }\n\n developingAddons(): string[] {\n if (this.oldPackage.owningAddon) {\n return [this.oldPackage.owningAddon.root];\n }\n return [];\n }\n\n @Memoize()\n activeAddonChildren(pkg: Package = this.appPackage): 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 definitely appear in one of the other\n // sections.\n addon => pkg.packageJSON.dependencies?.[addon.name] || pkg.packageJSON.devDependencies?.[addon.name]\n );\n if (pkg === this.appPackage) {\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 get allActiveAddons(): AddonPackage[] {\n let result = this.appPackage.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 // todo: filter by addon-provided hook\n return pkg.isEmberPackage();\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 @Memoize()\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 let extensions = ['.wasm', '.mjs', '.js', '.json', '.hbs'];\n\n // for now, this is hard-coded. If we see ember-cli-typescript, ts files are\n // resolvable. Once we implement a preprocessor-registration build hook,\n // this logic can be pushed down first into `@embroider/compat` (which can\n // generate the appropriate hooks when it upcompiles ember-cli-typescript),\n // and then later into ember-cli-typescript itself (which can ship a v2\n // version with the hook).\n //\n // Typescript is a slightly weird example of a preprocessor because it gets\n // implemented in babel, so all we realy need to do is make the extension\n // resolvable and there's no other \"loader\" or anything to apply.\n if (this.activeAddonChildren().find(pkg => pkg.name === 'ember-cli-typescript')) {\n extensions.unshift('.ts');\n }\n\n return extensions;\n }\n\n private *emberEntrypoints(htmlTreePath: string): IterableIterator<Asset> {\n let classicEntrypoints = [\n { entrypoint: 'index.html', includeTests: false },\n { entrypoint: 'tests/index.html', includeTests: true },\n ];\n if (!this.oldPackage.shouldBuildTests) {\n classicEntrypoints.pop();\n }\n for (let { entrypoint, includeTests } of classicEntrypoints) {\n let sourcePath = join(htmlTreePath, entrypoint);\n let stats = statSync(sourcePath);\n let asset: EmberAsset = {\n kind: 'ember',\n relativePath: entrypoint,\n includeTests,\n sourcePath,\n mtime: stats.mtime.getTime(),\n size: stats.size,\n rootURL: this.rootURL(),\n prepare: (dom: JSDOM) => {\n let scripts = [...dom.window.document.querySelectorAll('script')];\n let styles = [...dom.window.document.querySelectorAll('link[rel=\"stylesheet\"]')] as HTMLLinkElement[];\n\n return {\n javascript: definitelyReplace(dom, this.oldPackage.findAppScript(scripts, entrypoint)),\n styles: definitelyReplace(dom, this.oldPackage.findAppStyles(styles, entrypoint)),\n implicitScripts: definitelyReplace(dom, this.oldPackage.findVendorScript(scripts, entrypoint)),\n implicitStyles: definitelyReplace(dom, this.oldPackage.findVendorStyles(styles, entrypoint)),\n testJavascript: maybeReplace(dom, this.oldPackage.findTestScript(scripts)),\n implicitTestScripts: maybeReplace(dom, this.oldPackage.findTestSupportScript(scripts)),\n implicitTestStyles: maybeReplace(dom, this.oldPackage.findTestSupportStyles(styles)),\n };\n },\n };\n yield asset;\n }\n }\n\n autoRun(): boolean {\n return this.oldPackage.autoRun;\n }\n\n appBoot(): string | undefined {\n return this.oldPackage.appBoot.readAppBoot();\n }\n\n mainModule(): string {\n return 'app';\n }\n\n mainModuleConfig(): unknown {\n return this.configTree.readConfig().APP;\n }\n\n emberENV(): EmberENV {\n return this.configTree.readConfig().EmberENV;\n }\n\n modulePrefix(): string {\n return this.configTree.readConfig().modulePrefix;\n }\n\n podModulePrefix(): string | undefined {\n return this.configTree.readConfig().podModulePrefix;\n }\n\n rootURL(): string {\n return this.configTree.readConfig().rootURL;\n }\n\n templateCompilerPath(): string {\n return 'ember-source/vendor/ember/ember-template-compiler';\n }\n\n strictV2Format() {\n return false;\n }\n\n @Memoize()\n private activeRules() {\n return activePackageRules(this.options.packageRules.concat(defaultAddonPackageRules()), [\n this.appPackage,\n ...this.allActiveAddons.filter(p => p.meta['auto-upgraded']),\n ]);\n }\n\n @Memoize()\n templateResolver(): Resolver {\n return new CompatResolver({\n root: this.root,\n modulePrefix: this.modulePrefix(),\n podModulePrefix: this.podModulePrefix(),\n options: this.options,\n activePackageRules: this.activeRules(),\n adjustImportsOptionsPath: this.adjustImportsOptionsPath(),\n });\n }\n\n @Memoize()\n adjustImportsOptionsPath(): string {\n let file = join(this.root, '_adjust_imports.json');\n writeFileSync(file, JSON.stringify(this.adjustImportsOptions()));\n return file;\n }\n\n @Memoize()\n adjustImportsOptions(): AdjustImportsOptions {\n return this.makeAdjustImportOptions(true);\n }\n\n // this gets serialized out by babel plugin and ast plugin\n private makeAdjustImportOptions(outer: boolean): AdjustImportsOptions {\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 activeAddons: AdjustImportsOptions['activeAddons'] = {};\n for (let addon of this.allActiveAddons) {\n activeAddons[addon.name] = addon.root;\n }\n\n let emberSource = this.activeAddonChildren().find(a => a.name === 'ember-source')!;\n let emberNeedsModulesPolyfill = semver.satisfies(emberSource.version, '<3.27.0-beta.0', {\n includePrerelease: true,\n });\n\n return {\n activeAddons,\n renameModules,\n renamePackages,\n // \"outer\" here prevents uncontrolled recursion. We can't know our\n // extraImports until after we have the internalTemplateResolver which in\n // turn needs some adjustImportsOptions\n extraImports: outer ? this.extraImports() : [],\n relocatedFiles: {}, // this is the only part we can't completely fill out here. It needs to wait for the AppBuilder to finish smooshing together all appTrees\n resolvableExtensions: this.resolvableExtensions(),\n\n // it's important that this is a persistent location, because we fill it\n // up as a side-effect of babel transpilation, and babel is subject to\n // persistent caching.\n externalsDir: join(tmpdir, 'embroider', 'externals'),\n emberNeedsModulesPolyfill,\n };\n }\n\n // unlike `templateResolver`, this one brings its own simple TemplateCompiler\n // along so it's capable of parsing component snippets in people's module\n // rules.\n @Memoize()\n private internalTemplateResolver(): CompatResolver {\n let resolver = new CompatResolver({\n root: this.root,\n modulePrefix: this.modulePrefix(),\n options: this.options,\n activePackageRules: this.activeRules(),\n adjustImportsOptions: this.makeAdjustImportOptions(false),\n });\n\n const compilerPath = resolveSync(this.templateCompilerPath(), { basedir: this.root });\n const { cacheKey: compilerChecksum } = getEmberExports(compilerPath);\n // It's ok that this isn't a fully configured template compiler. We're only\n // using it to parse component snippets out of rules.\n resolver.astTransformer(\n new NodeTemplateCompiler({\n compilerPath,\n compilerChecksum,\n\n EmberENV: {},\n plugins: {},\n })\n );\n return resolver;\n }\n\n private extraImports() {\n let output: { absPath: string; target: string; runtimeName?: string }[][] = [];\n\n for (let rule of this.activeRules()) {\n if (rule.addonModules) {\n for (let [filename, moduleRules] of Object.entries(rule.addonModules)) {\n for (let root of rule.roots) {\n let absPath = join(root, filename);\n output.push(expandModuleRules(absPath, moduleRules, this.internalTemplateResolver()));\n }\n }\n }\n if (rule.appModules) {\n for (let [filename, moduleRules] of Object.entries(rule.appModules)) {\n let absPath = join(this.root, filename);\n output.push(expandModuleRules(absPath, moduleRules, this.internalTemplateResolver()));\n }\n }\n }\n return flatten(output);\n }\n\n htmlbarsPlugins(): TemplateCompilerPlugins {\n return this.oldPackage.htmlbarsPlugins;\n }\n\n babelMajorVersion() {\n return this.oldPackage.babelMajorVersion();\n }\n\n babelConfig() {\n return this.oldPackage.babelConfig();\n }\n}\n\nexport default class CompatApp extends BuildStage<TreeNames> {\n constructor(legacyEmberAppInstance: object, addons: Stage, options?: Options) {\n let { inTrees, instantiate } = setup(legacyEmberAppInstance, optionsWithDefaults(options));\n super(addons, inTrees, '@embroider/compat/app', instantiate);\n }\n}\n\nfunction maybeReplace(dom: JSDOM, element: Element | undefined): Node | undefined {\n if (element) {\n return definitelyReplace(dom, element);\n }\n}\n\nfunction definitelyReplace(dom: JSDOM, element: Element): Node {\n let placeholder = dom.window.document.createTextNode('');\n element.replaceWith(placeholder);\n return placeholder;\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-rules.js","sourceRoot":"","sources":["dependency-rules.ts"],"names":[],"mappings":";;;AAAA,0CAAyE;AACzE,mCAAmC;AAEnC,+BAA+B;AA8J/B,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AC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;aAC7G;YACD,MAAM,CAAC,IAAI,CAAC;gBACV,OAAO;gBACP,MAAM,EAAE,IAAA,uBAAgB,EAAC,IAAA,cAAO,EAAC,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC;gBACzD,WAAW,EAAE,KAAK,CAAC,WAAW;aAC/B,CAAC,CAAC;SACJ;KACF;IACD,IAAI,WAAW,CAAC,mBAAmB,EAAE;QACnC,KAAK,IAAI,OAAO,IAAI,WAAW,CAAC,mBAAmB,EAAE;YACnD,IAAI,KAAK,GAAG,QAAQ,CAAC,uBAAuB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YACnE,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,KAAK,CAAC,OAAO,EAAE;gBAC1D,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAA,uBAAgB,EAAC,IAAA,cAAO,EAAC,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;aAC3F;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAxBD,8CAwBC","sourcesContent":["import { Package, explicitRelative, getOrCreate } from '@embroider/core';\nimport { satisfies } from 'semver';\nimport CompatResolver from './resolver';\nimport { dirname } from 'path';\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 temlate 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\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 dependsOnComponents: ComponentSnippet[];\n argumentsAreComponents: string[];\n safeInteriorPaths: string[];\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 let dependsOnComponents = [];\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 }\n }\n if (componentRules.invokes) {\n for (let [path, snippets] of Object.entries(componentRules.invokes)) {\n safeInteriorPaths.push(path);\n for (let snippet of snippets) {\n dependsOnComponents.push(snippet);\n }\n }\n }\n return {\n argumentsAreComponents,\n safeInteriorPaths,\n dependsOnComponents,\n yieldsSafeComponents: componentRules.yieldsSafeComponents || [],\n yieldsArguments: componentRules.yieldsArguments || [],\n };\n}\n\nexport function activePackageRules(packageRules: PackageRules[], activePackages: Package[]): 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 expandModuleRules(absPath: string, moduleRules: ModuleRules, resolver: CompatResolver) {\n let output: { absPath: string; target: string; runtimeName: string }[] = [];\n if (moduleRules.dependsOnModules) {\n for (let path of moduleRules.dependsOnModules) {\n let found = resolver.resolveImport(path, absPath);\n if (!found) {\n throw new Error(`can't locate ${path} referred to in module rules:${JSON.stringify(moduleRules, null, 2)}`);\n }\n output.push({\n absPath,\n target: explicitRelative(dirname(absPath), found.absPath),\n runtimeName: found.runtimeName,\n });\n }\n }\n if (moduleRules.dependsOnComponents) {\n for (let snippet of moduleRules.dependsOnComponents) {\n let found = resolver.resolveComponentSnippet(snippet, moduleRules);\n for (let { absPath: target, runtimeName } of found.modules) {\n output.push({ absPath, target: explicitRelative(dirname(absPath), target), runtimeName });\n }\n }\n }\n return output;\n}\n"]}
|
|
1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AAE,OAAO,CAAC,CAAC;YAClD,IAAI,CAAC,KAAK,EAAE;gBACV,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,gCAAgC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;aAC7G;YACD,MAAM,CAAC,IAAI,CAAC;gBACV,OAAO;gBACP,MAAM,EAAE,IAAA,uBAAgB,EAAC,IAAA,cAAO,EAAC,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC;gBACzD,WAAW,EAAE,KAAK,CAAC,WAAW;aAC/B,CAAC,CAAC;SACJ;KACF;IACD,IAAI,WAAW,CAAC,mBAAmB,EAAE;QACnC,KAAK,IAAI,OAAO,IAAI,WAAW,CAAC,mBAAmB,EAAE;YACnD,IAAI,KAAK,GAAG,QAAQ,CAAC,uBAAuB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YACnE,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,KAAK,CAAC,OAAO,EAAE;gBAC1D,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAA,uBAAgB,EAAC,IAAA,cAAO,EAAC,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;aAC3F;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAxBD,8CAwBC","sourcesContent":["import { Package, explicitRelative, getOrCreate } from '@embroider/core';\nimport { satisfies } from 'semver';\nimport CompatResolver from './resolver';\nimport { dirname } from 'path';\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\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 dependsOnComponents: ComponentSnippet[];\n argumentsAreComponents: string[];\n safeInteriorPaths: string[];\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 let dependsOnComponents = [];\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 }\n }\n if (componentRules.invokes) {\n for (let [path, snippets] of Object.entries(componentRules.invokes)) {\n safeInteriorPaths.push(path);\n for (let snippet of snippets) {\n dependsOnComponents.push(snippet);\n }\n }\n }\n return {\n argumentsAreComponents,\n safeInteriorPaths,\n dependsOnComponents,\n yieldsSafeComponents: componentRules.yieldsSafeComponents || [],\n yieldsArguments: componentRules.yieldsArguments || [],\n };\n}\n\nexport function activePackageRules(packageRules: PackageRules[], activePackages: Package[]): 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 expandModuleRules(absPath: string, moduleRules: ModuleRules, resolver: CompatResolver) {\n let output: { absPath: string; target: string; runtimeName: string }[] = [];\n if (moduleRules.dependsOnModules) {\n for (let path of moduleRules.dependsOnModules) {\n let found = resolver.resolveImport(path, absPath);\n if (!found) {\n throw new Error(`can't locate ${path} referred to in module rules:${JSON.stringify(moduleRules, null, 2)}`);\n }\n output.push({\n absPath,\n target: explicitRelative(dirname(absPath), found.absPath),\n runtimeName: found.runtimeName,\n });\n }\n }\n if (moduleRules.dependsOnComponents) {\n for (let snippet of moduleRules.dependsOnComponents) {\n let found = resolver.resolveComponentSnippet(snippet, moduleRules);\n for (let { absPath: target, runtimeName } of found.modules) {\n output.push({ absPath, target: explicitRelative(dirname(absPath), target), runtimeName });\n }\n }\n }\n return output;\n}\n"]}
|
package/src/options.js
CHANGED
package/src/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";;;AAEA,0CAAkG;AA0FlG,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAA,0BAAgB,GAAE,EAAE;IACjD,gBAAgB,EAAE,KAAK;IACvB,2BAA2B,EAAE,KAAK;IAClC,cAAc,EAAE,IAAI,GAAG,EAAE;IACzB,gBAAgB,EAAE,EAAE;IACpB,YAAY,EAAE,IAAI;IAClB,kBAAkB,EAAE,EAAE;IACtB,YAAY,EAAE,EAAE;IAChB,4BAA4B,EAAE,KAAK;CACpC,CAAC,CAAC;AAEH,SAAgB,mBAAmB,CAAC,OAAiB;IACnD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAFD,kDAEC;AAED,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAC/E,cAAc;AACD,QAAA,kBAAkB,GAAgC,MAAM,CAAC,MAAM,CAAC;IAC3E,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE,IAAI;QACtB,2BAA2B,EAAE,IAAI;QACjC,aAAa,EAAE,IAAI;QACnB,gBAAgB,EAAE,IAAI;QACtB,4BAA4B,EAAE,KAAK;KACpC,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { V1AddonConstructor } from './v1-addon';\nimport { Node } from 'broccoli-node-api';\nimport { Options as CoreOptions, optionsWithDefaults as coreWithDefaults } from '@embroider/core';\nimport { PackageRules } from './dependency-rules';\n\n// These options control how hard we will try to achieve compatibility with v1\n// addons. The defaults are conservative and try to maximize compatibility, at\n// the cost of slower or bigger builds. As you eliminate sources of legacy\n// behavior you can benefit from the more aggressive modes.\nexport default interface Options extends CoreOptions {\n // Controls whether your addon's \"addon\" trees should be resolved statically\n // at build time.\n //\n // false (the default): implies maximum backward compatibility at the cost\n // of bigger builds. In this mode, we force every file into the Ember app,\n // which is the legacy behavior.\n //\n // true: produces smaller builds. The addon files must be imported from\n // somewhere we can statically see during the build. In this mode, your app\n // will only include files that are actually imported from somewhere.\n //\n // Commentary: most v1 addons already work well with this set to true, because\n // they tend to either offer Javascript that users are supposed to directly\n // `import` or components / helpers / services that get directly imported and\n // re-exported by code in App Javascript. The exceptions are addons that do\n // runtime shenanigans with `require` or scoped runtime resolutions.\n //\n // To workaround an addon that is preventing you from enabling this flag, you\n // can use addonDependencyRules.\n staticAddonTrees?: boolean;\n\n // Controls whether your addon's \"addonTestSupport\" trees should be resolved\n // statically at build time.\n //\n // false (the default): implies maximum backward compatibility at the cost\n // of bigger builds. All test support files will be forced into your Ember\n // app, which is the legacy behavior.\n //\n // true: produces smaller builds. Only files that are explicitly imported\n // will end up in your app.\n //\n // Commentary: this is analogous to staticAddonTrees and the same guidelines\n // apply.\n staticAddonTestSupportTrees?: boolean;\n\n // Allows you to override how specific addons will build. Like:\n //\n // import V1Addon from '@embroider/compat'; let compatAdapters = new Map();\n // compatAdapters.set('some-addon', class extends V1Addon {// do stuff here:\n // see examples in ./compat-adapters\n // });\n //\n // This should be understood as a temporary way to keep yourself from getting\n // stuck, not an alternative to actually fixing upstream. For the most part,\n // the real solution will be converting the addon in question to natively\n // publish as v2.\n //\n // We ship with some default compatAdapters to fix otherwise incompatible\n // behaviors in popular addons. You can override the default adapters by\n // setting your own value here (including null to completely disable it).\n compatAdapters?: Map<string, V1AddonConstructor | null>;\n\n // temporary directory where we will work when we're rewriting your addons\n // and/or app to v2-compatible formats.\n workspaceDir?: string | null;\n\n // optional list of additional broccoli trees that should be incorporated into\n // the final build. This exists because the classic `app.toTree()` method\n // accepts an optional tree argument that has the same purpose.\n extraPublicTrees?: Node[];\n\n // Allows you to tell Embroider about otherwise dynamic dependencies within\n // your app and addons that it can't figure out on its own. These are combined\n // with the default rules that ship with Embroider. Your own rules take\n // precedence over the built-ins. Order matters, first matching rule will\n // apply to any given addon.\n //\n // See the addon-dependency-rules directory in the @embroider/compat package\n // for the built-in rules.\n //\n // These ONLY APPLY to v1-formatted addons. An addon that ships as native v2\n // is expected to do the right thing on its own.\n //\n // Follow to the definition of PackageRules for more info.\n packageRules?: PackageRules[];\n\n // This turns build errors into runtime errors. It is not a good idea to keep\n // it on in production. But it can be helpful when testing how much of your\n // app is able to work with staticComponents enabled.\n allowUnsafeDynamicComponents?: boolean;\n}\n\nconst defaults = Object.assign(coreWithDefaults(), {\n staticAddonTrees: false,\n staticAddonTestSupportTrees: false,\n compatAdapters: new Map(),\n extraPublicTrees: [],\n workspaceDir: null,\n optionalComponents: [],\n packageRules: [],\n allowUnsafeDynamicComponents: false,\n});\n\nexport function optionsWithDefaults(options?: Options): Required<Options> {\n return Object.assign({}, defaults, options);\n}\n\n// These are recommended configurations for addons to test themselves under. By\n// keeping them here, it's easier to do ecosystem-wide compatibility testing.\n// See the `@embroider/test-setup` package which can help consume these to test\n// them in CI.\nexport const recommendedOptions: { [name: string]: Options } = Object.freeze({\n safe: Object.freeze({}),\n optimized: Object.freeze({\n staticAddonTrees: true,\n staticAddonTestSupportTrees: true,\n staticHelpers: true,\n staticComponents: true,\n allowUnsafeDynamicComponents: false,\n }),\n});\n"]}
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";;;AAEA,0CAAkG;AA0FlG,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAA,0BAAgB,GAAE,EAAE;IACjD,gBAAgB,EAAE,KAAK;IACvB,2BAA2B,EAAE,KAAK;IAClC,cAAc,EAAE,IAAI,GAAG,EAAE;IACzB,gBAAgB,EAAE,EAAE;IACpB,YAAY,EAAE,IAAI;IAClB,kBAAkB,EAAE,EAAE;IACtB,YAAY,EAAE,EAAE;IAChB,4BAA4B,EAAE,KAAK;CACpC,CAAC,CAAC;AAEH,SAAgB,mBAAmB,CAAC,OAAiB;IACnD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAFD,kDAEC;AAED,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAC/E,cAAc;AACD,QAAA,kBAAkB,GAAgC,MAAM,CAAC,MAAM,CAAC;IAC3E,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE,IAAI;QACtB,2BAA2B,EAAE,IAAI;QACjC,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,IAAI;QACrB,gBAAgB,EAAE,IAAI;QACtB,4BAA4B,EAAE,KAAK;KACpC,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { V1AddonConstructor } from './v1-addon';\nimport { Node } from 'broccoli-node-api';\nimport { Options as CoreOptions, optionsWithDefaults as coreWithDefaults } from '@embroider/core';\nimport { PackageRules } from './dependency-rules';\n\n// These options control how hard we will try to achieve compatibility with v1\n// addons. The defaults are conservative and try to maximize compatibility, at\n// the cost of slower or bigger builds. As you eliminate sources of legacy\n// behavior you can benefit from the more aggressive modes.\nexport default interface Options extends CoreOptions {\n // Controls whether your addon's \"addon\" trees should be resolved statically\n // at build time.\n //\n // false (the default): implies maximum backward compatibility at the cost\n // of bigger builds. In this mode, we force every file into the Ember app,\n // which is the legacy behavior.\n //\n // true: produces smaller builds. The addon files must be imported from\n // somewhere we can statically see during the build. In this mode, your app\n // will only include files that are actually imported from somewhere.\n //\n // Commentary: most v1 addons already work well with this set to true, because\n // they tend to either offer Javascript that users are supposed to directly\n // `import` or components / helpers / services that get directly imported and\n // re-exported by code in App Javascript. The exceptions are addons that do\n // runtime shenanigans with `require` or scoped runtime resolutions.\n //\n // To workaround an addon that is preventing you from enabling this flag, you\n // can use addonDependencyRules.\n staticAddonTrees?: boolean;\n\n // Controls whether your addon's \"addonTestSupport\" trees should be resolved\n // statically at build time.\n //\n // false (the default): implies maximum backward compatibility at the cost\n // of bigger builds. All test support files will be forced into your Ember\n // app, which is the legacy behavior.\n //\n // true: produces smaller builds. Only files that are explicitly imported\n // will end up in your app.\n //\n // Commentary: this is analogous to staticAddonTrees and the same guidelines\n // apply.\n staticAddonTestSupportTrees?: boolean;\n\n // Allows you to override how specific addons will build. Like:\n //\n // import V1Addon from '@embroider/compat'; let compatAdapters = new Map();\n // compatAdapters.set('some-addon', class extends V1Addon {// do stuff here:\n // see examples in ./compat-adapters\n // });\n //\n // This should be understood as a temporary way to keep yourself from getting\n // stuck, not an alternative to actually fixing upstream. For the most part,\n // the real solution will be converting the addon in question to natively\n // publish as v2.\n //\n // We ship with some default compatAdapters to fix otherwise incompatible\n // behaviors in popular addons. You can override the default adapters by\n // setting your own value here (including null to completely disable it).\n compatAdapters?: Map<string, V1AddonConstructor | null>;\n\n // temporary directory where we will work when we're rewriting your addons\n // and/or app to v2-compatible formats.\n workspaceDir?: string | null;\n\n // optional list of additional broccoli trees that should be incorporated into\n // the final build. This exists because the classic `app.toTree()` method\n // accepts an optional tree argument that has the same purpose.\n extraPublicTrees?: Node[];\n\n // Allows you to tell Embroider about otherwise dynamic dependencies within\n // your app and addons that it can't figure out on its own. These are combined\n // with the default rules that ship with Embroider. Your own rules take\n // precedence over the built-ins. Order matters, first matching rule will\n // apply to any given addon.\n //\n // See the addon-dependency-rules directory in the @embroider/compat package\n // for the built-in rules.\n //\n // These ONLY APPLY to v1-formatted addons. An addon that ships as native v2\n // is expected to do the right thing on its own.\n //\n // Follow to the definition of PackageRules for more info.\n packageRules?: PackageRules[];\n\n // This turns build errors into runtime errors. It is not a good idea to keep\n // it on in production. But it can be helpful when testing how much of your\n // app is able to work with staticComponents enabled.\n allowUnsafeDynamicComponents?: boolean;\n}\n\nconst defaults = Object.assign(coreWithDefaults(), {\n staticAddonTrees: false,\n staticAddonTestSupportTrees: false,\n compatAdapters: new Map(),\n extraPublicTrees: [],\n workspaceDir: null,\n optionalComponents: [],\n packageRules: [],\n allowUnsafeDynamicComponents: false,\n});\n\nexport function optionsWithDefaults(options?: Options): Required<Options> {\n return Object.assign({}, defaults, options);\n}\n\n// These are recommended configurations for addons to test themselves under. By\n// keeping them here, it's easier to do ecosystem-wide compatibility testing.\n// See the `@embroider/test-setup` package which can help consume these to test\n// them in CI.\nexport const recommendedOptions: { [name: string]: Options } = Object.freeze({\n safe: Object.freeze({}),\n optimized: Object.freeze({\n staticAddonTrees: true,\n staticAddonTestSupportTrees: true,\n staticHelpers: true,\n staticModifiers: true,\n staticComponents: true,\n allowUnsafeDynamicComponents: false,\n }),\n});\n"]}
|
|
@@ -13,6 +13,7 @@ export declare function makeResolverTransform(resolver: Resolver): {
|
|
|
13
13
|
BlockStatement(node: ASTv1.BlockStatement): void;
|
|
14
14
|
SubExpression(node: ASTv1.SubExpression): void;
|
|
15
15
|
MustacheStatement(node: ASTv1.MustacheStatement): void;
|
|
16
|
+
ElementModifierStatement(node: ASTv1.ElementModifierStatement): void;
|
|
16
17
|
ElementNode: {
|
|
17
18
|
enter(node: ASTv1.ElementNode): void;
|
|
18
19
|
exit(): void;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.makeResolverTransform = void 0;
|
|
7
7
|
const resolver_1 = __importDefault(require("./resolver"));
|
|
8
|
-
// This is the AST transform that resolves components and
|
|
8
|
+
// This is the AST transform that resolves components, helpers and modifiers at build time
|
|
9
9
|
// and puts them into `dependencies`.
|
|
10
10
|
function makeResolverTransform(resolver) {
|
|
11
11
|
function resolverTransform({ filename }) {
|
|
@@ -29,6 +29,9 @@ function makeResolverTransform(resolver) {
|
|
|
29
29
|
if (scopeStack.inScope(node.path.parts[0])) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
+
if (node.path.this === true) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
32
35
|
if (node.path.parts.length > 1) {
|
|
33
36
|
// paths with a dot in them (which therefore split into more than
|
|
34
37
|
// one "part") are classically understood by ember to be contextual
|
|
@@ -81,6 +84,9 @@ function makeResolverTransform(resolver) {
|
|
|
81
84
|
if (scopeStack.inScope(node.path.parts[0])) {
|
|
82
85
|
return;
|
|
83
86
|
}
|
|
87
|
+
if (node.path.this === true) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
84
90
|
if (node.path.parts.length > 1) {
|
|
85
91
|
// paths with a dot in them (which therefore split into more than
|
|
86
92
|
// one "part") are classically understood by ember to be contextual
|
|
@@ -106,6 +112,29 @@ function makeResolverTransform(resolver) {
|
|
|
106
112
|
}
|
|
107
113
|
}
|
|
108
114
|
},
|
|
115
|
+
ElementModifierStatement(node) {
|
|
116
|
+
if (node.path.type !== 'PathExpression') {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (scopeStack.inScope(node.path.parts[0])) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (node.path.this === true) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (node.path.data === true) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (node.path.parts.length > 1) {
|
|
129
|
+
// paths with a dot in them (which therefore split into more than
|
|
130
|
+
// one "part") are classically understood by ember to be contextual
|
|
131
|
+
// components. With the introduction of `Template strict mode` in Ember 3.25
|
|
132
|
+
// it is also possible to pass modifiers this way which means there's nothing
|
|
133
|
+
// to resolve at this location.
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
resolver.resolveElementModifierStatement(node.path.original, filename, node.path.loc);
|
|
137
|
+
},
|
|
109
138
|
ElementNode: {
|
|
110
139
|
enter(node) {
|
|
111
140
|
if (!scopeStack.inScope(node.tag.split('.')[0])) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver-transform.js","sourceRoot":"","sources":["resolver-transform.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAwF;AAGxF,+EAA+E;AAC/E,qCAAqC;AACrC,SAAgB,qBAAqB,CAAC,QAAkB;IACtD,SAAS,iBAAiB,CAAC,EAAE,QAAQ,EAAwB;QAC3D,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEzB,IAAI,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QAElC,OAAO;YACL,IAAI,EAAE,+BAA+B;YAErC,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,KAAK,CAAC,IAAmB;wBACvB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBACpC,CAAC;oBACD,IAAI;wBACF,UAAU,CAAC,GAAG,EAAE,CAAC;oBACnB,CAAC;iBACF;gBACD,cAAc,CAAC,IAA0B;oBACvC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAAE;wBACvC,OAAO;qBACR;oBACD,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;wBAC1C,OAAO;qBACR;oBACD,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;wBAC9B,iEAAiE;wBACjE,mEAAmE;wBACnE,6DAA6D;wBAC7D,YAAY;wBACZ,OAAO;qBACR;oBACD,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,WAAW,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;wBAChE,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;wBACtE,OAAO;q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AAE,UAAU,EAAE,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAEhF,OAAO;IACP,0CAA0C;IAC1C,qCAAqC;IACrC,iCAAiC;IACjC,wEAAwE;IACxE,MAAM;IACN,YAAY;IACZ,IAAI;IAEJ,OAAO;IACP,0CAA0C;IAC1C,4CAA4C;IAC5C,wCAAwC;IACxC,MAAM;IACN,sFAAsF;IACtF,YAAY;IACZ,IAAI;IAEJ,mCAAmC;IACnC,oGAAoG;IACpG,YAAY;IACZ,IAAI;IAEJ,uHAAuH;IACvH,yFAAyF;IACzF,YAAY;IACZ,IAAI;IAEJ,8FAA8F;AAChG,CAAC","sourcesContent":["import { default as Resolver, ComponentResolution, ComponentLocator } from './resolver';\nimport type { ASTv1 } from '@glimmer/syntax';\n\n// This is the AST transform that resolves components and helpers at build time\n// and puts them into `dependencies`.\nexport function makeResolverTransform(resolver: Resolver) {\n function resolverTransform({ filename }: { filename: string }) {\n resolver.enter(filename);\n\n let scopeStack = new ScopeStack();\n\n return {\n name: 'embroider-build-time-resolver',\n\n visitor: {\n Program: {\n enter(node: ASTv1.Program) {\n scopeStack.push(node.blockParams);\n },\n exit() {\n scopeStack.pop();\n },\n },\n BlockStatement(node: ASTv1.BlockStatement) {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (scopeStack.inScope(node.path.parts[0])) {\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 handleComponentHelper(node.params[0], resolver, filename, scopeStack);\n return;\n }\n // a block counts as args from our perpsective (it's enough to prove\n // this thing must be a component, not content)\n let hasArgs = true;\n const resolution = resolver.resolveMustache(node.path.original, hasArgs, filename, node.path.loc);\n if (resolution && resolution.type === 'component') {\n scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n for (let name of argumentsAreComponents) {\n let pair = node.hash.pairs.find((pair: ASTv1.HashPair) => pair.key === name);\n if (pair) {\n handleComponentHelper(pair.value, resolver, filename, scopeStack, {\n componentName: (node.path as ASTv1.PathExpression).original,\n argumentName: name,\n });\n }\n }\n });\n }\n },\n SubExpression(node: ASTv1.SubExpression) {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (scopeStack.inScope(node.path.parts[0])) {\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n handleComponentHelper(node.params[0], resolver, filename, scopeStack);\n return;\n }\n resolver.resolveSubExpression(node.path.original, filename, node.path.loc);\n },\n MustacheStatement(node: ASTv1.MustacheStatement) {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (scopeStack.inScope(node.path.parts[0])) {\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 handleComponentHelper(node.params[0], resolver, filename, scopeStack);\n return;\n }\n let hasArgs = node.params.length > 0 || node.hash.pairs.length > 0;\n let resolution = resolver.resolveMustache(node.path.original, hasArgs, filename, node.path.loc);\n if (resolution && resolution.type === 'component') {\n for (let name of resolution.argumentsAreComponents) {\n let pair = node.hash.pairs.find((pair: ASTv1.HashPair) => pair.key === name);\n if (pair) {\n handleComponentHelper(pair.value, resolver, filename, scopeStack, {\n componentName: node.path.original,\n argumentName: name,\n });\n }\n }\n }\n },\n ElementNode: {\n enter(node: ASTv1.ElementNode) {\n if (!scopeStack.inScope(node.tag.split('.')[0])) {\n const resolution = resolver.resolveElement(node.tag, filename, node.loc);\n if (resolution && resolution.type === 'component') {\n scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n for (let name of argumentsAreComponents) {\n let attr = node.attributes.find((attr: ASTv1.AttrNode) => attr.name === '@' + name);\n if (attr) {\n handleComponentHelper(attr.value, resolver, filename, scopeStack, {\n componentName: node.tag,\n argumentName: name,\n });\n }\n }\n });\n }\n }\n scopeStack.push(node.blockParams);\n },\n exit() {\n scopeStack.pop();\n },\n },\n },\n };\n }\n resolverTransform.parallelBabel = {\n requireFile: __filename,\n buildUsing: 'makeResolverTransform',\n params: Resolver,\n };\n return resolverTransform;\n}\n\ninterface ComponentBlockMarker {\n type: 'componentBlockMarker';\n resolution: ComponentResolution;\n argumentsAreComponents: string[];\n exit: (marker: ComponentBlockMarker) => void;\n}\n\ntype ScopeEntry = { type: 'blockParams'; blockParams: string[] } | ComponentBlockMarker;\n\nclass ScopeStack {\n private stack: ScopeEntry[] = [];\n\n // as we enter a block, we push the block params onto here to mark them as\n // being in scope\n push(blockParams: string[]) {\n this.stack.unshift({ type: 'blockParams', blockParams });\n }\n\n // and when we leave the block they go out of scope. If this block was tagged\n // by a safe component marker, we also clear that.\n pop() {\n this.stack.shift();\n let next = this.stack[0];\n if (next && next.type === 'componentBlockMarker') {\n next.exit(next);\n this.stack.shift();\n }\n }\n\n // right before we enter a block, we might determine that some of the values\n // that will be yielded as marked (by a rule) as safe to be used with the\n // {{component}} helper.\n enteringComponentBlock(resolution: ComponentResolution, exit: ComponentBlockMarker['exit']) {\n this.stack.unshift({\n type: 'componentBlockMarker',\n resolution,\n argumentsAreComponents: resolution.argumentsAreComponents.slice(),\n exit,\n });\n }\n\n inScope(name: string) {\n for (let scope of this.stack) {\n if (scope.type === 'blockParams' && scope.blockParams.includes(name)) {\n return true;\n }\n }\n return false;\n }\n\n safeComponentInScope(name: string): boolean {\n let parts = name.split('.');\n if (parts.length > 2) {\n // we let component rules specify that they yield components or objects\n // containing components. But not deeper than that. So the max path length\n // that can refer to a marked-safe component is two segments.\n return false;\n }\n for (let i = 0; i < this.stack.length - 1; i++) {\n let here = this.stack[i];\n let next = this.stack[i + 1];\n if (here.type === 'blockParams' && next.type === 'componentBlockMarker') {\n let positionalIndex = here.blockParams.indexOf(parts[0]);\n if (positionalIndex === -1) {\n continue;\n }\n\n if (parts.length === 1) {\n if (next.resolution.yieldsComponents[positionalIndex] === true) {\n return true;\n }\n let sourceArg = next.resolution.yieldsArguments[positionalIndex];\n if (typeof sourceArg === 'string') {\n next.argumentsAreComponents.push(sourceArg);\n return true;\n }\n } else {\n let entry = next.resolution.yieldsComponents[positionalIndex];\n if (entry && typeof entry === 'object') {\n return entry[parts[1]] === true;\n }\n\n let argsEntry = next.resolution.yieldsArguments[positionalIndex];\n if (argsEntry && typeof argsEntry === 'object') {\n let sourceArg = argsEntry[parts[1]];\n if (typeof sourceArg === 'string') {\n next.argumentsAreComponents.push(sourceArg);\n return true;\n }\n }\n }\n // we found the source of the name, but there were no rules to cover it.\n // Don't keep searching higher, those are different names.\n return false;\n }\n }\n return false;\n }\n}\n\nfunction handleComponentHelper(\n param: ASTv1.Node,\n resolver: Resolver,\n moduleName: string,\n scopeStack: ScopeStack,\n impliedBecause?: { componentName: string; argumentName: string }\n): void {\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 handleComponentHelper(param.path, resolver, moduleName, scopeStack, impliedBecause);\n return;\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;\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;\n }\n if (param.path.type === 'PathExpression' && param.path.original === 'ensure-safe-component') {\n // safe because we trust ensure-safe-component\n return;\n }\n locator = { type: 'other' };\n break;\n default:\n locator = { type: 'other' };\n }\n\n if (locator.type === 'path' && scopeStack.safeComponentInScope(locator.path)) {\n return;\n }\n\n resolver.resolveComponentHelper(locator, moduleName, param.loc, impliedBecause);\n\n // if (\n // param.type === 'MustacheStatement' &&\n // param.hash.pairs.length === 0 &&\n // param.params.length === 0 &&\n // handleComponentHelper(param.path, resolver, moduleName, scopeStack)\n // ) {\n // return;\n // }\n\n // if (\n // param.type === 'MustacheStatement' &&\n // param.path.type === 'PathExpression' &&\n // param.path.original === 'component'\n // ) {\n // // safe because we will handle this inner `{{component ...}}` mustache on its own\n // return;\n // }\n\n // if (param.type === 'TextNode') {\n // resolver.resolveComponentHelper({ type: 'literal', path: param.chars }, moduleName, param.loc);\n // return;\n // }\n\n // if (param.type === 'SubExpression' && param.path.type === 'PathExpression' && param.path.original === 'component') {\n // // safe because we will handle this inner `(component ...)` subexpression on its own\n // return;\n // }\n\n // resolver.unresolvableComponentArgument(componentName, argumentName, moduleName, param.loc);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"resolver-transform.js","sourceRoot":"","sources":["resolver-transform.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAwF;AAGxF,0FAA0F;AAC1F,qCAAqC;AACrC,SAAgB,qBAAqB,CAAC,QAAkB;IACtD,SAAS,iBAAiB,CAAC,EAAE,QAAQ,EAAwB;QAC3D,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEzB,IAAI,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QAElC,OAAO;YACL,IAAI,EAAE,+BAA+B;YAErC,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,KAAK,CAAC,IAAmB;wBACvB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBACpC,CAAC;oBACD,IAAI;wBACF,UAAU,CAAC,GAAG,EAAE,CAAC;oBACnB,CAAC;iBACF;gBACD,cAAc,CAAC,IAA0B;oBACvC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAAE;wBACvC,OAAO;qBACR;oBACD,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KA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AI,CAAC,EAAE;QAC5E,OAAO;KACR;IAED,QAAQ,CAAC,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAEhF,OAAO;IACP,0CAA0C;IAC1C,qCAAqC;IACrC,iCAAiC;IACjC,wEAAwE;IACxE,MAAM;IACN,YAAY;IACZ,IAAI;IAEJ,OAAO;IACP,0CAA0C;IAC1C,4CAA4C;IAC5C,wCAAwC;IACxC,MAAM;IACN,sFAAsF;IACtF,YAAY;IACZ,IAAI;IAEJ,mCAAmC;IACnC,oGAAoG;IACpG,YAAY;IACZ,IAAI;IAEJ,uHAAuH;IACvH,yFAAyF;IACzF,YAAY;IACZ,IAAI;IAEJ,8FAA8F;AAChG,CAAC","sourcesContent":["import { default as Resolver, ComponentResolution, ComponentLocator } from './resolver';\nimport type { ASTv1 } from '@glimmer/syntax';\n\n// This is the AST transform that resolves components, helpers and modifiers at build time\n// and puts them into `dependencies`.\nexport function makeResolverTransform(resolver: Resolver) {\n function resolverTransform({ filename }: { filename: string }) {\n resolver.enter(filename);\n\n let scopeStack = new ScopeStack();\n\n return {\n name: 'embroider-build-time-resolver',\n\n visitor: {\n Program: {\n enter(node: ASTv1.Program) {\n scopeStack.push(node.blockParams);\n },\n exit() {\n scopeStack.pop();\n },\n },\n BlockStatement(node: ASTv1.BlockStatement) {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (scopeStack.inScope(node.path.parts[0])) {\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (node.path.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 handleComponentHelper(node.params[0], resolver, filename, scopeStack);\n return;\n }\n // a block counts as args from our perpsective (it's enough to prove\n // this thing must be a component, not content)\n let hasArgs = true;\n const resolution = resolver.resolveMustache(node.path.original, hasArgs, filename, node.path.loc);\n if (resolution && resolution.type === 'component') {\n scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n for (let name of argumentsAreComponents) {\n let pair = node.hash.pairs.find((pair: ASTv1.HashPair) => pair.key === name);\n if (pair) {\n handleComponentHelper(pair.value, resolver, filename, scopeStack, {\n componentName: (node.path as ASTv1.PathExpression).original,\n argumentName: name,\n });\n }\n }\n });\n }\n },\n SubExpression(node: ASTv1.SubExpression) {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (scopeStack.inScope(node.path.parts[0])) {\n return;\n }\n if (node.path.original === 'component' && node.params.length > 0) {\n handleComponentHelper(node.params[0], resolver, filename, scopeStack);\n return;\n }\n resolver.resolveSubExpression(node.path.original, filename, node.path.loc);\n },\n MustacheStatement(node: ASTv1.MustacheStatement) {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (scopeStack.inScope(node.path.parts[0])) {\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (node.path.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 handleComponentHelper(node.params[0], resolver, filename, scopeStack);\n return;\n }\n let hasArgs = node.params.length > 0 || node.hash.pairs.length > 0;\n let resolution = resolver.resolveMustache(node.path.original, hasArgs, filename, node.path.loc);\n if (resolution && resolution.type === 'component') {\n for (let name of resolution.argumentsAreComponents) {\n let pair = node.hash.pairs.find((pair: ASTv1.HashPair) => pair.key === name);\n if (pair) {\n handleComponentHelper(pair.value, resolver, filename, scopeStack, {\n componentName: node.path.original,\n argumentName: name,\n });\n }\n }\n }\n },\n ElementModifierStatement(node: ASTv1.ElementModifierStatement) {\n if (node.path.type !== 'PathExpression') {\n return;\n }\n if (scopeStack.inScope(node.path.parts[0])) {\n return;\n }\n if (node.path.this === true) {\n return;\n }\n if (node.path.data === true) {\n return;\n }\n if (node.path.parts.length > 1) {\n // paths with a dot in them (which therefore split into more than\n // one \"part\") are classically understood by ember to be contextual\n // components. With the introduction of `Template strict mode` in Ember 3.25\n // it is also possible to pass modifiers this way which means there's nothing\n // to resolve at this location.\n return;\n }\n\n resolver.resolveElementModifierStatement(node.path.original, filename, node.path.loc);\n },\n ElementNode: {\n enter(node: ASTv1.ElementNode) {\n if (!scopeStack.inScope(node.tag.split('.')[0])) {\n const resolution = resolver.resolveElement(node.tag, filename, node.loc);\n if (resolution && resolution.type === 'component') {\n scopeStack.enteringComponentBlock(resolution, ({ argumentsAreComponents }) => {\n for (let name of argumentsAreComponents) {\n let attr = node.attributes.find((attr: ASTv1.AttrNode) => attr.name === '@' + name);\n if (attr) {\n handleComponentHelper(attr.value, resolver, filename, scopeStack, {\n componentName: node.tag,\n argumentName: name,\n });\n }\n }\n });\n }\n }\n scopeStack.push(node.blockParams);\n },\n exit() {\n scopeStack.pop();\n },\n },\n },\n };\n }\n resolverTransform.parallelBabel = {\n requireFile: __filename,\n buildUsing: 'makeResolverTransform',\n params: Resolver,\n };\n return resolverTransform;\n}\n\ninterface ComponentBlockMarker {\n type: 'componentBlockMarker';\n resolution: ComponentResolution;\n argumentsAreComponents: string[];\n exit: (marker: ComponentBlockMarker) => void;\n}\n\ntype ScopeEntry = { type: 'blockParams'; blockParams: string[] } | ComponentBlockMarker;\n\nclass ScopeStack {\n private stack: ScopeEntry[] = [];\n\n // as we enter a block, we push the block params onto here to mark them as\n // being in scope\n push(blockParams: string[]) {\n this.stack.unshift({ type: 'blockParams', blockParams });\n }\n\n // and when we leave the block they go out of scope. If this block was tagged\n // by a safe component marker, we also clear that.\n pop() {\n this.stack.shift();\n let next = this.stack[0];\n if (next && next.type === 'componentBlockMarker') {\n next.exit(next);\n this.stack.shift();\n }\n }\n\n // right before we enter a block, we might determine that some of the values\n // that will be yielded as marked (by a rule) as safe to be used with the\n // {{component}} helper.\n enteringComponentBlock(resolution: ComponentResolution, exit: ComponentBlockMarker['exit']) {\n this.stack.unshift({\n type: 'componentBlockMarker',\n resolution,\n argumentsAreComponents: resolution.argumentsAreComponents.slice(),\n exit,\n });\n }\n\n inScope(name: string) {\n for (let scope of this.stack) {\n if (scope.type === 'blockParams' && scope.blockParams.includes(name)) {\n return true;\n }\n }\n return false;\n }\n\n safeComponentInScope(name: string): boolean {\n let parts = name.split('.');\n if (parts.length > 2) {\n // we let component rules specify that they yield components or objects\n // containing components. But not deeper than that. So the max path length\n // that can refer to a marked-safe component is two segments.\n return false;\n }\n for (let i = 0; i < this.stack.length - 1; i++) {\n let here = this.stack[i];\n let next = this.stack[i + 1];\n if (here.type === 'blockParams' && next.type === 'componentBlockMarker') {\n let positionalIndex = here.blockParams.indexOf(parts[0]);\n if (positionalIndex === -1) {\n continue;\n }\n\n if (parts.length === 1) {\n if (next.resolution.yieldsComponents[positionalIndex] === true) {\n return true;\n }\n let sourceArg = next.resolution.yieldsArguments[positionalIndex];\n if (typeof sourceArg === 'string') {\n next.argumentsAreComponents.push(sourceArg);\n return true;\n }\n } else {\n let entry = next.resolution.yieldsComponents[positionalIndex];\n if (entry && typeof entry === 'object') {\n return entry[parts[1]] === true;\n }\n\n let argsEntry = next.resolution.yieldsArguments[positionalIndex];\n if (argsEntry && typeof argsEntry === 'object') {\n let sourceArg = argsEntry[parts[1]];\n if (typeof sourceArg === 'string') {\n next.argumentsAreComponents.push(sourceArg);\n return true;\n }\n }\n }\n // we found the source of the name, but there were no rules to cover it.\n // Don't keep searching higher, those are different names.\n return false;\n }\n }\n return false;\n }\n}\n\nfunction handleComponentHelper(\n param: ASTv1.Node,\n resolver: Resolver,\n moduleName: string,\n scopeStack: ScopeStack,\n impliedBecause?: { componentName: string; argumentName: string }\n): void {\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 handleComponentHelper(param.path, resolver, moduleName, scopeStack, impliedBecause);\n return;\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;\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;\n }\n if (param.path.type === 'PathExpression' && param.path.original === 'ensure-safe-component') {\n // safe because we trust ensure-safe-component\n return;\n }\n locator = { type: 'other' };\n break;\n default:\n locator = { type: 'other' };\n }\n\n if (locator.type === 'path' && scopeStack.safeComponentInScope(locator.path)) {\n return;\n }\n\n resolver.resolveComponentHelper(locator, moduleName, param.loc, impliedBecause);\n\n // if (\n // param.type === 'MustacheStatement' &&\n // param.hash.pairs.length === 0 &&\n // param.params.length === 0 &&\n // handleComponentHelper(param.path, resolver, moduleName, scopeStack)\n // ) {\n // return;\n // }\n\n // if (\n // param.type === 'MustacheStatement' &&\n // param.path.type === 'PathExpression' &&\n // param.path.original === 'component'\n // ) {\n // // safe because we will handle this inner `{{component ...}}` mustache on its own\n // return;\n // }\n\n // if (param.type === 'TextNode') {\n // resolver.resolveComponentHelper({ type: 'literal', path: param.chars }, moduleName, param.loc);\n // return;\n // }\n\n // if (param.type === 'SubExpression' && param.path.type === 'PathExpression' && param.path.original === 'component') {\n // // safe because we will handle this inner `(component ...)` subexpression on its own\n // return;\n // }\n\n // resolver.unresolvableComponentArgument(componentName, argumentName, moduleName, param.loc);\n}\n"]}
|