@embroider/core 3.4.10-unstable.2f2e854 → 3.4.10-unstable.3608a1f
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/index.d.ts +0 -1
- package/src/index.js.map +1 -1
- package/src/virtual-entrypoint.js +1 -1
- package/src/virtual-entrypoint.js.map +1 -1
- package/src/asset.d.ts +0 -29
- package/src/asset.js +0 -3
- package/src/asset.js.map +0 -1
- package/src/ember-html.d.ts +0 -37
- package/src/ember-html.js +0 -95
- package/src/ember-html.js.map +0 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@embroider/core",
|
3
|
-
"version": "3.4.10-unstable.
|
3
|
+
"version": "3.4.10-unstable.3608a1f",
|
4
4
|
"private": false,
|
5
5
|
"description": "A build system for EmberJS applications.",
|
6
6
|
"repository": {
|
@@ -23,9 +23,9 @@
|
|
23
23
|
"@babel/core": "^7.14.5",
|
24
24
|
"@babel/parser": "^7.14.5",
|
25
25
|
"@babel/traverse": "^7.14.5",
|
26
|
-
"@embroider/macros": "1.16.2-unstable.
|
27
|
-
"@embroider/reverse-exports": "0.1.1-unstable.
|
28
|
-
"@embroider/shared-internals": "2.6.1-unstable.
|
26
|
+
"@embroider/macros": "1.16.2-unstable.3608a1f",
|
27
|
+
"@embroider/reverse-exports": "0.1.1-unstable.3608a1f",
|
28
|
+
"@embroider/shared-internals": "2.6.1-unstable.3608a1f",
|
29
29
|
"assert-never": "^1.2.1",
|
30
30
|
"babel-plugin-ember-template-compilation": "^2.1.1",
|
31
31
|
"broccoli-node-api": "^1.7.0",
|
package/src/index.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
export { Packager, PackagerConstructor, Variant, applyVariantToBabelConfig, getAppMeta, getPackagerCacheDir, } from './packager';
|
2
2
|
export { HTMLEntrypoint, BundleSummary } from './html-entrypoint';
|
3
3
|
export { default as Stage } from './stage';
|
4
|
-
export { Asset, EmberAsset } from './asset';
|
5
4
|
export { default as Options, optionsWithDefaults } from './options';
|
6
5
|
export { default as toBroccoliPlugin } from './to-broccoli-plugin';
|
7
6
|
export { default as WaitForTrees, OutputPaths } from './wait-for-trees';
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,uCAOoB;AAHlB,qHAAA,yBAAyB,OAAA;AACzB,sGAAA,UAAU,OAAA;AACV,+GAAA,mBAAmB,OAAA;AAErB,qDAAkE;AAAzD,iHAAA,cAAc,OAAA;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,uCAOoB;AAHlB,qHAAA,yBAAyB,OAAA;AACzB,sGAAA,UAAU,OAAA;AACV,+GAAA,mBAAmB,OAAA;AAErB,qDAAkE;AAAzD,iHAAA,cAAc,OAAA;AAEvB,qCAAoE;AAAvC,8GAAA,mBAAmB,OAAA;AAChD,2DAAmE;AAA1D,uIAAA,OAAO,OAAoB;AACpC,mDAAwE;AAA/D,+HAAA,OAAO,OAAgB;AAChC,iDAAiE;AAAxD,oHAAA,OAAO,OAAuB;AACvC,uCAA4F;AAAnF,gGAAA,IAAI,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,gGAAA,IAAI,OAAA;AAAE,iGAAA,KAAK,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,2GAAA,eAAe,OAAA;AACvE,qDAAoG;AAA3F,2GAAA,QAAQ,OAAA;AACjB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AAGvB,8EAA8E;AAC9E,+DAA+D;AAC/D,8DAA4C","sourcesContent":["export {\n Packager,\n PackagerConstructor,\n Variant,\n applyVariantToBabelConfig,\n getAppMeta,\n getPackagerCacheDir,\n} from './packager';\nexport { HTMLEntrypoint, BundleSummary } from './html-entrypoint';\nexport { default as Stage } from './stage';\nexport { default as Options, optionsWithDefaults } from './options';\nexport { default as toBroccoliPlugin } from './to-broccoli-plugin';\nexport { default as WaitForTrees, OutputPaths } from './wait-for-trees';\nexport { compile as jsHandlebarsCompile } from './js-handlebars';\nexport { todo, unsupported, warn, debug, expectWarning, throwOnWarnings } from './messages';\nexport { Resolver, Options as ResolverOptions, ModuleRequest, Resolution } from './module-resolver';\nexport { ResolverLoader } from './resolver-loader';\nexport { virtualContent } from './virtual-content';\nexport type { Engine } from './app-files';\n\n// this is reexported because we already make users manage a peerDep from some\n// other packages (like embroider/webpack and @embroider/compat\nexport * from '@embroider/shared-internals';\n"]}
|
@@ -289,7 +289,7 @@ function shouldSplitRoute(routeName, splitAtRoutes) {
|
|
289
289
|
}
|
290
290
|
function getAppFiles(appRoot) {
|
291
291
|
const files = (0, walk_sync_1.default)(appRoot, {
|
292
|
-
ignore: ['
|
292
|
+
ignore: ['_babel_filter_.js', 'app.js', 'assets', 'testem.js', 'node_modules'],
|
293
293
|
});
|
294
294
|
return new Set(files);
|
295
295
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"virtual-entrypoint.js","sourceRoot":"","sources":["virtual-entrypoint.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAwD;AACxD,mDAA0C;AAG1C,mCAA4C;AAC5C,+BAA4B;AAC5B,kEAA2F;AAC3F,0DAAiC;AAEjC,yEAAyE;AACzE,uCAAwC;AACxC,gFAAgD;AAEhD,MAAM,iBAAiB,GAAG,8CAA8C,CAAC;AAEzE,SAAgB,gBAAgB,CAAC,QAAgB;IAC/C,0DAA0D;IAC1D,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;QAChD,OAAO;IACT,CAAC;IACD,IAAI,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,CAAC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AED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,aAAa,CAAC,CAAC,GAAG,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;AACH,CAAC;AA7DD,gCA6DC;AAED,SAAS,gBAAgB,CAAC,SAAiB,EAAE,aAA8C;IACzF,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;QAClC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,OAAO,KAAK,SAAS,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,WAAW,CAAC,OAAe;IACzC,MAAM,KAAK,GAAa,IAAA,mBAAQ,EAAC,OAAO,EAAE;QACxC,MAAM,EAAE,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,CAAC;KACpG,CAAC,CAAC;IACH,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC;AALD,kCAKC;AAED,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAa,IAAA,mBAAQ,EAAC,UAAU,CAAC,CAAC;IAC7C,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC;AAJD,4CAIC","sourcesContent":["import { AppFiles, type RouteFiles } from './app-files';\nimport { compile } from './js-handlebars';\nimport type { Resolver } from './module-resolver';\nimport type { CompatResolverOptions } from '../../compat/src/resolver-transform';\nimport { flatten, partition } from 'lodash';\nimport { join } from 'path';\nimport { extensionsPattern, locateEmbroiderWorkingDir } from '@embroider/shared-internals';\nimport walkSync from 'walk-sync';\nimport type { V2AddonPackage } from '@embroider/shared-internals/src/package';\nimport { encodePublicRouteEntrypoint } from './virtual-route-entrypoint';\nimport { readFileSync } from 'fs-extra';\nimport escapeRegExp from 'escape-string-regexp';\n\nconst entrypointPattern = /(?<filename>.*)[\\\\/]-embroider-entrypoint.js/;\n\nexport function decodeEntrypoint(filename: string): { fromFile: string } | undefined {\n // Performance: avoid paying regex exec cost unless needed\n if (!filename.includes('-embroider-entrypoint')) {\n return;\n }\n let m = entrypointPattern.exec(filename);\n if (m) {\n return {\n fromFile: m.groups!.filename,\n };\n }\n}\n\nexport function staticAppPathsPattern(staticAppPaths: string[] | undefined): RegExp | undefined {\n if (staticAppPaths && staticAppPaths.length > 0) {\n return new RegExp('^(?:' + staticAppPaths.map(staticAppPath => escapeRegExp(staticAppPath)).join('|') + ')(?:$|/)');\n }\n}\n\nexport function renderEntrypoint(\n resolver: Resolver,\n { fromFile }: { fromFile: string }\n): { src: string; watches: string[] } {\n // this is new\n const owner = resolver.packageCache.ownerOfFile(fromFile);\n\n let eagerModules: string[] = [];\n\n if (!owner) {\n throw new Error('Owner expected'); // ToDo: Really bad error, update message\n }\n\n let engine = resolver.owningEngine(owner);\n let isApp = owner?.root === resolver.options.engines[0]!.root;\n let hasFastboot = Boolean(resolver.options.engines[0]!.activeAddons.find(a => a.name === 'ember-cli-fastboot'));\n\n let appFiles = new AppFiles(\n {\n package: owner,\n addons: new Map(\n engine.activeAddons.map(addon => [\n resolver.packageCache.get(addon.root) as V2AddonPackage,\n addon.canResolveFromFile,\n ])\n ),\n isApp,\n modulePrefix: isApp ? resolver.options.modulePrefix : engine.packageName,\n appRelativePath: 'NOT_USED_DELETE_ME',\n },\n getAppFiles(owner.root),\n hasFastboot ? getFastbootFiles(owner.root) : new Set(),\n extensionsPattern(resolver.options.resolvableExtensions),\n staticAppPathsPattern(resolver.options.staticAppPaths),\n resolver.options.podModulePrefix\n );\n\n let options = (resolver.options as CompatResolverOptions).options;\n\n let requiredAppFiles = [appFiles.otherAppFiles];\n if (!options.staticComponents) {\n requiredAppFiles.push(appFiles.components);\n }\n if (!options.staticHelpers) {\n requiredAppFiles.push(appFiles.helpers);\n }\n if (!options.staticModifiers) {\n requiredAppFiles.push(appFiles.modifiers);\n }\n\n let styles = [];\n // only import styles from engines with a parent (this excludeds the parent application) as their styles\n // will be inserted via a direct <link> tag.\n if (!appFiles.engine.isApp && appFiles.engine.package.isLazyEngine()) {\n styles.push({\n path: '@embroider/core/vendor.css',\n });\n }\n\n let lazyEngines: { names: string[]; path: string }[] = [];\n\n if (isApp) {\n // deliberately ignoring the app (which is the first entry in the engines array)\n let [, ...childEngines] = resolver.options.engines;\n for (let childEngine of childEngines) {\n let target = `@embroider/core/entrypoint/${childEngine.packageName}`;\n\n if (childEngine.isLazy) {\n lazyEngines.push({\n names: [childEngine.packageName],\n path: target,\n });\n } else {\n eagerModules.push(target);\n }\n }\n }\n\n let lazyRoutes: { names: string[]; path: string }[] = [];\n for (let [routeName, routeFiles] of appFiles.routeFiles.children) {\n splitRoute(\n routeName,\n routeFiles,\n resolver.options.splitAtRoutes,\n (_: string, filename: string) => {\n requiredAppFiles.push([filename]);\n },\n (routeNames: string[], _files: string[]) => {\n lazyRoutes.push({\n names: routeNames,\n path: encodePublicRouteEntrypoint(routeNames, _files),\n });\n }\n );\n }\n\n let [fastboot, nonFastboot] = partition(excludeDotFiles(flatten(requiredAppFiles)), file =>\n appFiles.isFastbootOnly.get(file)\n );\n\n let amdModules = nonFastboot.map(file => importPaths(resolver, appFiles, file));\n let fastbootOnlyAmdModules = fastboot.map(file => importPaths(resolver, appFiles, file));\n\n let params = {\n amdModules,\n fastbootOnlyAmdModules,\n lazyRoutes,\n lazyEngines,\n eagerModules,\n styles,\n // this is a backward-compatibility feature: addons can force inclusion of modules.\n defineModulesFrom: './-embroider-implicit-modules.js',\n };\n\n // for the top-level entry template we need to pass extra params to the template\n // this is new, it used to be passed into the appJS function instead\n if (isApp) {\n const appBoot = readFileSync(join(locateEmbroiderWorkingDir(resolver.options.appRoot), 'ember-app-boot.js'), {\n encoding: 'utf-8',\n });\n\n Object.assign(params, {\n autoRun: resolver.options.autoRun,\n appBoot,\n });\n }\n\n return {\n src: entryTemplate(params),\n watches: [],\n };\n}\n\nconst entryTemplate = compile(`\nimport { importSync as i, macroCondition, getGlobalConfig } from '@embroider/macros';\nlet w = window;\nlet d = w.define;\n\nimport environment from './config/environment';\n\n{{#if styles}}\n if (macroCondition(!getGlobalConfig().fastboot?.isRunning)) {\n {{#each styles as |stylePath| ~}}\n await import(\"{{js-string-escape stylePath.path}}\");\n {{/each}}\n }\n{{/if}}\n\n{{#if defineModulesFrom ~}}\n import implicitModules from \"{{js-string-escape defineModulesFrom}}\";\n\n for(const [name, module] of Object.entries(implicitModules)) {\n d(name, function() { return module });\n }\n{{/if}}\n\n\n{{#each eagerModules as |eagerModule| ~}}\n import \"{{js-string-escape eagerModule}}\";\n{{/each}}\n\n{{#each amdModules as |amdModule index| ~}}\n import * as amdModule{{index}} from \"{{js-string-escape amdModule.buildtime}}\"\n d(\"{{js-string-escape amdModule.runtime}}\", function(){ return amdModule{{index}}; });\n{{/each}}\n\n{{#if fastbootOnlyAmdModules}}\n if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {\n let fastbootModules = {};\n\n {{#each fastbootOnlyAmdModules as |amdModule| ~}}\n fastbootModules[\"{{js-string-escape amdModule.runtime}}\"] = import(\"{{js-string-escape amdModule.buildtime}}\");\n {{/each}}\n\n const resolvedValues = await Promise.all(Object.values(fastbootModules));\n\n Object.keys(fastbootModules).forEach((k, i) => {\n d(k, function(){ return resolvedValues[i];});\n })\n }\n{{/if}}\n\n\n{{#if lazyRoutes}}\nw._embroiderRouteBundles_ = [\n {{#each lazyRoutes as |route|}}\n {\n names: {{json-stringify route.names}},\n load: function() {\n return import(\"{{js-string-escape route.path}}\");\n }\n },\n {{/each}}\n]\n{{/if}}\n\n{{#if lazyEngines}}\nw._embroiderEngineBundles_ = [\n {{#each lazyEngines as |engine|}}\n {\n names: {{json-stringify engine.names}},\n load: function() {\n return import(\"{{js-string-escape engine.path}}\");\n }\n },\n {{/each}}\n]\n{{/if}}\n\n{{#if autoRun ~}}\n i(\"./app\").default.create(environment.APP);\n{{else if appBoot ~}}\n {{ appBoot }}\n{{/if}}\n`) as (params: {\n amdModules: { runtime: string; buildtime: string }[];\n fastbootOnlyAmdModules?: { runtime: string; buildtime: string }[];\n defineModulesFrom?: string;\n eagerModules?: string[];\n autoRun?: boolean;\n appBoot?: string;\n lazyRoutes?: { names: string[]; path: string }[];\n lazyEngines?: { names: string[]; path: string }[];\n styles?: { path: string }[];\n}) => string;\n\nfunction excludeDotFiles(files: string[]) {\n return files.filter(file => !file.startsWith('.') && !file.includes('/.'));\n}\n\nexport function importPaths(resolver: Resolver, { engine }: AppFiles, engineRelativePath: string) {\n let resolvableExtensionsPattern = extensionsPattern(resolver.options.resolvableExtensions);\n let noHBS = engineRelativePath.replace(resolvableExtensionsPattern, '').replace(/\\.hbs$/, '');\n return {\n runtime: `${engine.modulePrefix}/${noHBS}`,\n buildtime: `./${engineRelativePath}`,\n };\n}\n\nexport function splitRoute(\n routeName: string,\n files: RouteFiles,\n splitAtRoutes: (RegExp | string)[] | undefined,\n addToParent: (routeName: string, filename: string) => void,\n addLazyBundle: (routeNames: string[], files: string[]) => void\n) {\n let shouldSplit = routeName && shouldSplitRoute(routeName, splitAtRoutes);\n let ownFiles = [];\n let ownNames = new Set() as Set<string>;\n\n if (files.template) {\n if (shouldSplit) {\n ownFiles.push(files.template);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.template);\n }\n }\n\n if (files.controller) {\n if (shouldSplit) {\n ownFiles.push(files.controller);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.controller);\n }\n }\n\n if (files.route) {\n if (shouldSplit) {\n ownFiles.push(files.route);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.route);\n }\n }\n\n for (let [childName, childFiles] of files.children) {\n splitRoute(\n `${routeName}.${childName}`,\n childFiles,\n splitAtRoutes,\n (childRouteName: string, childFile: string) => {\n // this is our child calling \"addToParent\"\n if (shouldSplit) {\n ownFiles.push(childFile);\n ownNames.add(childRouteName);\n } else {\n addToParent(childRouteName, childFile);\n }\n },\n (routeNames: string[], files: string[]) => {\n addLazyBundle(routeNames, files);\n }\n );\n }\n\n if (ownFiles.length > 0) {\n addLazyBundle([...ownNames], ownFiles);\n }\n}\n\nfunction shouldSplitRoute(routeName: string, splitAtRoutes: (RegExp | string)[] | undefined) {\n if (!splitAtRoutes) {\n return false;\n }\n return splitAtRoutes.find(pattern => {\n if (typeof pattern === 'string') {\n return pattern === routeName;\n } else {\n return pattern.test(routeName);\n }\n });\n}\n\nexport function getAppFiles(appRoot: string): Set<string> {\n const files: string[] = walkSync(appRoot, {\n ignore: ['_babel_config_.js', '_babel_filter_.js', 'app.js', 'assets', 'testem.js', 'node_modules'],\n });\n return new Set(files);\n}\n\nexport function getFastbootFiles(appRoot: string): Set<string> {\n const appDirPath = join(appRoot, '_fastboot_');\n const files: string[] = walkSync(appDirPath);\n return new Set(files);\n}\n"]}
|
1
|
+
{"version":3,"file":"virtual-entrypoint.js","sourceRoot":"","sources":["virtual-entrypoint.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAwD;AACxD,mDAA0C;AAG1C,mCAA4C;AAC5C,+BAA4B;AAC5B,kEAA2F;AAC3F,0DAAiC;AAEjC,yEAAyE;AACzE,uCAAwC;AACxC,gFAAgD;AAEhD,MAAM,iBAAiB,GAAG,8CAA8C,CAAC;AAEzE,SAAgB,gBAAgB,CAAC,QAAgB;IAC/C,0DAA0D;IAC1D,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;QAChD,OAAO;IACT,CAAC;IACD,IAAI,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI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AAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,aAAa,CAAC,CAAC,GAAG,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;AACH,CAAC;AA7DD,gCA6DC;AAED,SAAS,gBAAgB,CAAC,SAAiB,EAAE,aAA8C;IACzF,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;QAClC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,OAAO,KAAK,SAAS,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,WAAW,CAAC,OAAe;IACzC,MAAM,KAAK,GAAa,IAAA,mBAAQ,EAAC,OAAO,EAAE;QACxC,MAAM,EAAE,CAAC,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,CAAC;KAC/E,CAAC,CAAC;IACH,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC;AALD,kCAKC;AAED,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAa,IAAA,mBAAQ,EAAC,UAAU,CAAC,CAAC;IAC7C,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC;AAJD,4CAIC","sourcesContent":["import { AppFiles, type RouteFiles } from './app-files';\nimport { compile } from './js-handlebars';\nimport type { Resolver } from './module-resolver';\nimport type { CompatResolverOptions } from '../../compat/src/resolver-transform';\nimport { flatten, partition } from 'lodash';\nimport { join } from 'path';\nimport { extensionsPattern, locateEmbroiderWorkingDir } from '@embroider/shared-internals';\nimport walkSync from 'walk-sync';\nimport type { V2AddonPackage } from '@embroider/shared-internals/src/package';\nimport { encodePublicRouteEntrypoint } from './virtual-route-entrypoint';\nimport { readFileSync } from 'fs-extra';\nimport escapeRegExp from 'escape-string-regexp';\n\nconst entrypointPattern = /(?<filename>.*)[\\\\/]-embroider-entrypoint.js/;\n\nexport function decodeEntrypoint(filename: string): { fromFile: string } | undefined {\n // Performance: avoid paying regex exec cost unless needed\n if (!filename.includes('-embroider-entrypoint')) {\n return;\n }\n let m = entrypointPattern.exec(filename);\n if (m) {\n return {\n fromFile: m.groups!.filename,\n };\n }\n}\n\nexport function staticAppPathsPattern(staticAppPaths: string[] | undefined): RegExp | undefined {\n if (staticAppPaths && staticAppPaths.length > 0) {\n return new RegExp('^(?:' + staticAppPaths.map(staticAppPath => escapeRegExp(staticAppPath)).join('|') + ')(?:$|/)');\n }\n}\n\nexport function renderEntrypoint(\n resolver: Resolver,\n { fromFile }: { fromFile: string }\n): { src: string; watches: string[] } {\n // this is new\n const owner = resolver.packageCache.ownerOfFile(fromFile);\n\n let eagerModules: string[] = [];\n\n if (!owner) {\n throw new Error('Owner expected'); // ToDo: Really bad error, update message\n }\n\n let engine = resolver.owningEngine(owner);\n let isApp = owner?.root === resolver.options.engines[0]!.root;\n let hasFastboot = Boolean(resolver.options.engines[0]!.activeAddons.find(a => a.name === 'ember-cli-fastboot'));\n\n let appFiles = new AppFiles(\n {\n package: owner,\n addons: new Map(\n engine.activeAddons.map(addon => [\n resolver.packageCache.get(addon.root) as V2AddonPackage,\n addon.canResolveFromFile,\n ])\n ),\n isApp,\n modulePrefix: isApp ? resolver.options.modulePrefix : engine.packageName,\n appRelativePath: 'NOT_USED_DELETE_ME',\n },\n getAppFiles(owner.root),\n hasFastboot ? getFastbootFiles(owner.root) : new Set(),\n extensionsPattern(resolver.options.resolvableExtensions),\n staticAppPathsPattern(resolver.options.staticAppPaths),\n resolver.options.podModulePrefix\n );\n\n let options = (resolver.options as CompatResolverOptions).options;\n\n let requiredAppFiles = [appFiles.otherAppFiles];\n if (!options.staticComponents) {\n requiredAppFiles.push(appFiles.components);\n }\n if (!options.staticHelpers) {\n requiredAppFiles.push(appFiles.helpers);\n }\n if (!options.staticModifiers) {\n requiredAppFiles.push(appFiles.modifiers);\n }\n\n let styles = [];\n // only import styles from engines with a parent (this excludeds the parent application) as their styles\n // will be inserted via a direct <link> tag.\n if (!appFiles.engine.isApp && appFiles.engine.package.isLazyEngine()) {\n styles.push({\n path: '@embroider/core/vendor.css',\n });\n }\n\n let lazyEngines: { names: string[]; path: string }[] = [];\n\n if (isApp) {\n // deliberately ignoring the app (which is the first entry in the engines array)\n let [, ...childEngines] = resolver.options.engines;\n for (let childEngine of childEngines) {\n let target = `@embroider/core/entrypoint/${childEngine.packageName}`;\n\n if (childEngine.isLazy) {\n lazyEngines.push({\n names: [childEngine.packageName],\n path: target,\n });\n } else {\n eagerModules.push(target);\n }\n }\n }\n\n let lazyRoutes: { names: string[]; path: string }[] = [];\n for (let [routeName, routeFiles] of appFiles.routeFiles.children) {\n splitRoute(\n routeName,\n routeFiles,\n resolver.options.splitAtRoutes,\n (_: string, filename: string) => {\n requiredAppFiles.push([filename]);\n },\n (routeNames: string[], _files: string[]) => {\n lazyRoutes.push({\n names: routeNames,\n path: encodePublicRouteEntrypoint(routeNames, _files),\n });\n }\n );\n }\n\n let [fastboot, nonFastboot] = partition(excludeDotFiles(flatten(requiredAppFiles)), file =>\n appFiles.isFastbootOnly.get(file)\n );\n\n let amdModules = nonFastboot.map(file => importPaths(resolver, appFiles, file));\n let fastbootOnlyAmdModules = fastboot.map(file => importPaths(resolver, appFiles, file));\n\n let params = {\n amdModules,\n fastbootOnlyAmdModules,\n lazyRoutes,\n lazyEngines,\n eagerModules,\n styles,\n // this is a backward-compatibility feature: addons can force inclusion of modules.\n defineModulesFrom: './-embroider-implicit-modules.js',\n };\n\n // for the top-level entry template we need to pass extra params to the template\n // this is new, it used to be passed into the appJS function instead\n if (isApp) {\n const appBoot = readFileSync(join(locateEmbroiderWorkingDir(resolver.options.appRoot), 'ember-app-boot.js'), {\n encoding: 'utf-8',\n });\n\n Object.assign(params, {\n autoRun: resolver.options.autoRun,\n appBoot,\n });\n }\n\n return {\n src: entryTemplate(params),\n watches: [],\n };\n}\n\nconst entryTemplate = compile(`\nimport { importSync as i, macroCondition, getGlobalConfig } from '@embroider/macros';\nlet w = window;\nlet d = w.define;\n\nimport environment from './config/environment';\n\n{{#if styles}}\n if (macroCondition(!getGlobalConfig().fastboot?.isRunning)) {\n {{#each styles as |stylePath| ~}}\n await import(\"{{js-string-escape stylePath.path}}\");\n {{/each}}\n }\n{{/if}}\n\n{{#if defineModulesFrom ~}}\n import implicitModules from \"{{js-string-escape defineModulesFrom}}\";\n\n for(const [name, module] of Object.entries(implicitModules)) {\n d(name, function() { return module });\n }\n{{/if}}\n\n\n{{#each eagerModules as |eagerModule| ~}}\n import \"{{js-string-escape eagerModule}}\";\n{{/each}}\n\n{{#each amdModules as |amdModule index| ~}}\n import * as amdModule{{index}} from \"{{js-string-escape amdModule.buildtime}}\"\n d(\"{{js-string-escape amdModule.runtime}}\", function(){ return amdModule{{index}}; });\n{{/each}}\n\n{{#if fastbootOnlyAmdModules}}\n if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {\n let fastbootModules = {};\n\n {{#each fastbootOnlyAmdModules as |amdModule| ~}}\n fastbootModules[\"{{js-string-escape amdModule.runtime}}\"] = import(\"{{js-string-escape amdModule.buildtime}}\");\n {{/each}}\n\n const resolvedValues = await Promise.all(Object.values(fastbootModules));\n\n Object.keys(fastbootModules).forEach((k, i) => {\n d(k, function(){ return resolvedValues[i];});\n })\n }\n{{/if}}\n\n\n{{#if lazyRoutes}}\nw._embroiderRouteBundles_ = [\n {{#each lazyRoutes as |route|}}\n {\n names: {{json-stringify route.names}},\n load: function() {\n return import(\"{{js-string-escape route.path}}\");\n }\n },\n {{/each}}\n]\n{{/if}}\n\n{{#if lazyEngines}}\nw._embroiderEngineBundles_ = [\n {{#each lazyEngines as |engine|}}\n {\n names: {{json-stringify engine.names}},\n load: function() {\n return import(\"{{js-string-escape engine.path}}\");\n }\n },\n {{/each}}\n]\n{{/if}}\n\n{{#if autoRun ~}}\n i(\"./app\").default.create(environment.APP);\n{{else if appBoot ~}}\n {{ appBoot }}\n{{/if}}\n`) as (params: {\n amdModules: { runtime: string; buildtime: string }[];\n fastbootOnlyAmdModules?: { runtime: string; buildtime: string }[];\n defineModulesFrom?: string;\n eagerModules?: string[];\n autoRun?: boolean;\n appBoot?: string;\n lazyRoutes?: { names: string[]; path: string }[];\n lazyEngines?: { names: string[]; path: string }[];\n styles?: { path: string }[];\n}) => string;\n\nfunction excludeDotFiles(files: string[]) {\n return files.filter(file => !file.startsWith('.') && !file.includes('/.'));\n}\n\nexport function importPaths(resolver: Resolver, { engine }: AppFiles, engineRelativePath: string) {\n let resolvableExtensionsPattern = extensionsPattern(resolver.options.resolvableExtensions);\n let noHBS = engineRelativePath.replace(resolvableExtensionsPattern, '').replace(/\\.hbs$/, '');\n return {\n runtime: `${engine.modulePrefix}/${noHBS}`,\n buildtime: `./${engineRelativePath}`,\n };\n}\n\nexport function splitRoute(\n routeName: string,\n files: RouteFiles,\n splitAtRoutes: (RegExp | string)[] | undefined,\n addToParent: (routeName: string, filename: string) => void,\n addLazyBundle: (routeNames: string[], files: string[]) => void\n) {\n let shouldSplit = routeName && shouldSplitRoute(routeName, splitAtRoutes);\n let ownFiles = [];\n let ownNames = new Set() as Set<string>;\n\n if (files.template) {\n if (shouldSplit) {\n ownFiles.push(files.template);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.template);\n }\n }\n\n if (files.controller) {\n if (shouldSplit) {\n ownFiles.push(files.controller);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.controller);\n }\n }\n\n if (files.route) {\n if (shouldSplit) {\n ownFiles.push(files.route);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.route);\n }\n }\n\n for (let [childName, childFiles] of files.children) {\n splitRoute(\n `${routeName}.${childName}`,\n childFiles,\n splitAtRoutes,\n (childRouteName: string, childFile: string) => {\n // this is our child calling \"addToParent\"\n if (shouldSplit) {\n ownFiles.push(childFile);\n ownNames.add(childRouteName);\n } else {\n addToParent(childRouteName, childFile);\n }\n },\n (routeNames: string[], files: string[]) => {\n addLazyBundle(routeNames, files);\n }\n );\n }\n\n if (ownFiles.length > 0) {\n addLazyBundle([...ownNames], ownFiles);\n }\n}\n\nfunction shouldSplitRoute(routeName: string, splitAtRoutes: (RegExp | string)[] | undefined) {\n if (!splitAtRoutes) {\n return false;\n }\n return splitAtRoutes.find(pattern => {\n if (typeof pattern === 'string') {\n return pattern === routeName;\n } else {\n return pattern.test(routeName);\n }\n });\n}\n\nexport function getAppFiles(appRoot: string): Set<string> {\n const files: string[] = walkSync(appRoot, {\n ignore: ['_babel_filter_.js', 'app.js', 'assets', 'testem.js', 'node_modules'],\n });\n return new Set(files);\n}\n\nexport function getFastbootFiles(appRoot: string): Set<string> {\n const appDirPath = join(appRoot, '_fastboot_');\n const files: string[] = walkSync(appDirPath);\n return new Set(files);\n}\n"]}
|
package/src/asset.d.ts
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
/// <reference types="jsdom/ts4.0" />
|
3
|
-
/// <reference types="jsdom/base" />
|
4
|
-
import type { JSDOM } from 'jsdom';
|
5
|
-
import type { EmberHTML } from './ember-html';
|
6
|
-
interface BaseAsset {
|
7
|
-
relativePath: string;
|
8
|
-
}
|
9
|
-
export interface OnDiskAsset extends BaseAsset {
|
10
|
-
kind: 'on-disk';
|
11
|
-
sourcePath: string;
|
12
|
-
mtime: number;
|
13
|
-
size: number;
|
14
|
-
}
|
15
|
-
export interface InMemoryAsset extends BaseAsset {
|
16
|
-
kind: 'in-memory';
|
17
|
-
source: string | Buffer;
|
18
|
-
}
|
19
|
-
export interface EmberAsset extends BaseAsset {
|
20
|
-
kind: 'ember';
|
21
|
-
sourcePath: string;
|
22
|
-
mtime: number;
|
23
|
-
size: number;
|
24
|
-
includeTests: boolean;
|
25
|
-
rootURL: string;
|
26
|
-
prepare(dom: JSDOM): EmberHTML;
|
27
|
-
}
|
28
|
-
export type Asset = OnDiskAsset | InMemoryAsset | EmberAsset;
|
29
|
-
export {};
|
package/src/asset.js
DELETED
package/src/asset.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"asset.js","sourceRoot":"","sources":["asset.ts"],"names":[],"mappings":"","sourcesContent":["import type { JSDOM } from 'jsdom';\nimport type { EmberHTML } from './ember-html';\n\ninterface BaseAsset {\n // where this asset should be placed, relative to the app's root\n relativePath: string;\n}\n\nexport interface OnDiskAsset extends BaseAsset {\n kind: 'on-disk';\n\n // absolute path to where we will find it\n sourcePath: string;\n mtime: number;\n size: number;\n}\n\nexport interface InMemoryAsset extends BaseAsset {\n kind: 'in-memory';\n\n // the actual bits\n source: string | Buffer;\n}\n\n// This represents an HTML entrypoint to the Ember app\nexport interface EmberAsset extends BaseAsset {\n kind: 'ember';\n\n // absolute path to where we will find the html file\n sourcePath: string;\n\n // these describe the file at sourcePath so we can avoid rebuilding when it\n // hasn't changed\n mtime: number;\n size: number;\n\n // whether we should include the test suite (in addition to the ember app)\n includeTests: boolean;\n\n // the rootURL at which this Ember app expects to be hosted.\n rootURL: string;\n\n // This will receive the parsed document. It may optionally modify the\n // document. And it must return a description of the locations where we're\n // supposed to insert the parts of the Ember app.\n prepare(dom: JSDOM): EmberHTML;\n}\n\nexport type Asset = OnDiskAsset | InMemoryAsset | EmberAsset;\n"]}
|
package/src/ember-html.d.ts
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
/// <reference types="jsdom/ts4.0" />
|
2
|
-
/// <reference types="jsdom/base" />
|
3
|
-
import { JSDOM } from 'jsdom';
|
4
|
-
import type { EmberAsset } from './asset';
|
5
|
-
export interface EmberHTML {
|
6
|
-
javascript: Node;
|
7
|
-
implicitScripts: Node;
|
8
|
-
testJavascript?: Node;
|
9
|
-
}
|
10
|
-
declare class Placeholder {
|
11
|
-
readonly start: Node;
|
12
|
-
readonly end: Node;
|
13
|
-
readonly reference: Node;
|
14
|
-
static find(node: Node): Placeholder;
|
15
|
-
static replacing(node: Node): Placeholder;
|
16
|
-
static immediatelyAfter(node: Node): Placeholder;
|
17
|
-
readonly parent: HTMLElement;
|
18
|
-
constructor(start: Node, end: Node, reference: Node);
|
19
|
-
clear(): void;
|
20
|
-
insert(node: Node): void;
|
21
|
-
}
|
22
|
-
export declare class PreparedEmberHTML {
|
23
|
-
private asset;
|
24
|
-
dom: JSDOM;
|
25
|
-
javascript: Placeholder;
|
26
|
-
implicitScripts: Placeholder;
|
27
|
-
constructor(asset: EmberAsset);
|
28
|
-
private placeholders;
|
29
|
-
clear(): void;
|
30
|
-
insertScriptTag(placeholder: Placeholder, relativeSrc: string, { type, tag }?: {
|
31
|
-
type?: string;
|
32
|
-
tag?: string;
|
33
|
-
}): void;
|
34
|
-
insertStyleLink(placeholder: Placeholder, relativeHref: string): void;
|
35
|
-
}
|
36
|
-
export declare function insertNewline(at: Node): void;
|
37
|
-
export {};
|
package/src/ember-html.js
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.insertNewline = exports.PreparedEmberHTML = void 0;
|
4
|
-
const jsdom_1 = require("jsdom");
|
5
|
-
const fs_1 = require("fs");
|
6
|
-
const html_placeholder_1 = require("./html-placeholder");
|
7
|
-
class Placeholder {
|
8
|
-
static find(node) {
|
9
|
-
let placeholder = this.immediatelyAfter(node);
|
10
|
-
return placeholder;
|
11
|
-
}
|
12
|
-
static replacing(node) {
|
13
|
-
let placeholder = this.immediatelyAfter(node);
|
14
|
-
node.parentElement.removeChild(node);
|
15
|
-
return placeholder;
|
16
|
-
}
|
17
|
-
static immediatelyAfter(node) {
|
18
|
-
let document = node.ownerDocument;
|
19
|
-
let parent = node.parentElement;
|
20
|
-
if (!document || !parent) {
|
21
|
-
throw new Error('Cannot make Placeholder out of detached node');
|
22
|
-
}
|
23
|
-
let nextSibling = node.nextSibling;
|
24
|
-
let start = document.createTextNode('');
|
25
|
-
let end = document.createTextNode('');
|
26
|
-
parent.insertBefore(start, nextSibling);
|
27
|
-
parent.insertBefore(end, nextSibling);
|
28
|
-
return new Placeholder(start, end, node);
|
29
|
-
}
|
30
|
-
constructor(start, end, reference) {
|
31
|
-
this.start = start;
|
32
|
-
this.end = end;
|
33
|
-
this.reference = reference;
|
34
|
-
if (start.parentElement && start.parentElement === end.parentElement) {
|
35
|
-
this.parent = start.parentElement;
|
36
|
-
}
|
37
|
-
else {
|
38
|
-
throw new Error('Cannot make Placeholder out of detached node');
|
39
|
-
}
|
40
|
-
}
|
41
|
-
clear() {
|
42
|
-
let { start, end, parent } = this;
|
43
|
-
while (start.nextSibling && start.nextSibling !== end) {
|
44
|
-
parent.removeChild(start.nextSibling);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
insert(node) {
|
48
|
-
this.parent.insertBefore(node, this.end);
|
49
|
-
}
|
50
|
-
}
|
51
|
-
class PreparedEmberHTML {
|
52
|
-
constructor(asset) {
|
53
|
-
this.asset = asset;
|
54
|
-
this.dom = new jsdom_1.JSDOM((0, fs_1.readFileSync)(asset.sourcePath, 'utf8'));
|
55
|
-
let html = asset.prepare(this.dom);
|
56
|
-
this.javascript = Placeholder.find(html.javascript);
|
57
|
-
this.implicitScripts = Placeholder.find(html.implicitScripts);
|
58
|
-
}
|
59
|
-
placeholders() {
|
60
|
-
return [this.javascript, this.implicitScripts];
|
61
|
-
}
|
62
|
-
clear() {
|
63
|
-
for (let range of this.placeholders()) {
|
64
|
-
range.clear();
|
65
|
-
}
|
66
|
-
}
|
67
|
-
// this takes the src relative to the application root, we adjust it so it's
|
68
|
-
// root-relative via the configured rootURL
|
69
|
-
insertScriptTag(placeholder, relativeSrc, { type, tag = 'script' } = {}) {
|
70
|
-
let document = this.dom.window.document;
|
71
|
-
let from = placeholder.reference.nodeType === 1 ? placeholder.reference : undefined;
|
72
|
-
let src = this.asset.rootURL + relativeSrc;
|
73
|
-
let attributes = type ? { src, type } : { src };
|
74
|
-
let newTag = (0, html_placeholder_1.makeTag)(document, { from, tag, attributes });
|
75
|
-
placeholder.insert(this.dom.window.document.createTextNode('\n'));
|
76
|
-
placeholder.insert(newTag);
|
77
|
-
}
|
78
|
-
// this takes the href relative to the application root, we adjust it so it's
|
79
|
-
// root-relative via the configured rootURL
|
80
|
-
insertStyleLink(placeholder, relativeHref) {
|
81
|
-
let document = this.dom.window.document;
|
82
|
-
let from = placeholder.reference.nodeType === 1 ? placeholder.reference : undefined;
|
83
|
-
let href = this.asset.rootURL + relativeHref;
|
84
|
-
let newTag = (0, html_placeholder_1.makeTag)(document, { from, tag: 'link', attributes: { href } });
|
85
|
-
(0, html_placeholder_1.normalizeStyleLink)(newTag);
|
86
|
-
placeholder.insert(this.dom.window.document.createTextNode('\n'));
|
87
|
-
placeholder.insert(newTag);
|
88
|
-
}
|
89
|
-
}
|
90
|
-
exports.PreparedEmberHTML = PreparedEmberHTML;
|
91
|
-
function insertNewline(at) {
|
92
|
-
at.parentElement.insertBefore(at.ownerDocument.createTextNode('\n'), at);
|
93
|
-
}
|
94
|
-
exports.insertNewline = insertNewline;
|
95
|
-
//# sourceMappingURL=ember-html.js.map
|
package/src/ember-html.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ember-html.js","sourceRoot":"","sources":["ember-html.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAC9B,2BAAkC;AAElC,yDAAiE;AAqBjE,MAAM,WAAW;IACf,MAAM,CAAC,IAAI,CAAC,IAAU;QACpB,IAAI,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC9C,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,IAAU;QACzB,IAAI,WAAW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E,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF;AAjDD,8CAiDC;AAED,SAAgB,aAAa,CAAC,EAAQ;IACpC,EAAE,CAAC,aAAc,CAAC,YAAY,CAAC,EAAE,CAAC,aAAc,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;AAC7E,CAAC;AAFD,sCAEC","sourcesContent":["import { JSDOM } from 'jsdom';\nimport { readFileSync } from 'fs';\nimport type { EmberAsset } from './asset';\nimport { makeTag, normalizeStyleLink } from './html-placeholder';\n\nexport interface EmberHTML {\n // each of the Nodes in here points at where we should insert the\n // corresponding parts of the ember app. The Nodes themselves will be\n // replaced, so provide placeholders.\n\n // these are mandatory, the Ember app may need to put things into them.\n javascript: Node;\n implicitScripts: Node;\n\n // these are optional because you *may* choose to stick your implicit test\n // things into specific locations (which we need for backward-compat). But you\n // can leave these off and we will simply put them in the same places as the\n // non-test things.\n //\n // Do not confuse these with controlling whether or not we will insert tests.\n // That is separately controlled via `includeTests`.\n testJavascript?: Node;\n}\n\nclass Placeholder {\n static find(node: Node): Placeholder {\n let placeholder = this.immediatelyAfter(node);\n return placeholder;\n }\n\n static replacing(node: Node): Placeholder {\n let placeholder = this.immediatelyAfter(node);\n node.parentElement!.removeChild(node);\n return placeholder;\n }\n\n static immediatelyAfter(node: Node): Placeholder {\n let document = node.ownerDocument;\n let parent = node.parentElement;\n\n if (!document || !parent) {\n throw new Error('Cannot make Placeholder out of detached node');\n }\n\n let nextSibling = node.nextSibling;\n let start = document.createTextNode('');\n let end = document.createTextNode('');\n\n parent.insertBefore(start, nextSibling);\n parent.insertBefore(end, nextSibling);\n return new Placeholder(start, end, node);\n }\n\n readonly parent: HTMLElement;\n\n constructor(readonly start: Node, readonly end: Node, readonly reference: Node) {\n if (start.parentElement && start.parentElement === end.parentElement) {\n this.parent = start.parentElement;\n } else {\n throw new Error('Cannot make Placeholder out of detached node');\n }\n }\n\n clear() {\n let { start, end, parent } = this;\n while (start.nextSibling && start.nextSibling !== end) {\n parent.removeChild(start.nextSibling);\n }\n }\n\n insert(node: Node) {\n this.parent.insertBefore(node, this.end);\n }\n}\n\nexport class PreparedEmberHTML {\n dom: JSDOM;\n javascript: Placeholder;\n implicitScripts: Placeholder;\n\n constructor(private asset: EmberAsset) {\n this.dom = new JSDOM(readFileSync(asset.sourcePath, 'utf8'));\n let html = asset.prepare(this.dom);\n this.javascript = Placeholder.find(html.javascript);\n this.implicitScripts = Placeholder.find(html.implicitScripts);\n }\n\n private placeholders(): Placeholder[] {\n return [this.javascript, this.implicitScripts];\n }\n\n clear() {\n for (let range of this.placeholders()) {\n range.clear();\n }\n }\n\n // this takes the src relative to the application root, we adjust it so it's\n // root-relative via the configured rootURL\n insertScriptTag(\n placeholder: Placeholder,\n relativeSrc: string,\n { type, tag = 'script' }: { type?: string; tag?: string } = {}\n ) {\n let document = this.dom.window.document;\n let from = placeholder.reference.nodeType === 1 ? (placeholder.reference as HTMLElement) : undefined;\n let src = this.asset.rootURL + relativeSrc;\n let attributes: Record<string, string> = type ? { src, type } : { src };\n let newTag = makeTag(document, { from, tag, attributes });\n placeholder.insert(this.dom.window.document.createTextNode('\\n'));\n placeholder.insert(newTag);\n }\n\n // this takes the href relative to the application root, we adjust it so it's\n // root-relative via the configured rootURL\n insertStyleLink(placeholder: Placeholder, relativeHref: string) {\n let document = this.dom.window.document;\n let from = placeholder.reference.nodeType === 1 ? (placeholder.reference as HTMLElement) : undefined;\n let href = this.asset.rootURL + relativeHref;\n let newTag = makeTag(document, { from, tag: 'link', attributes: { href } });\n normalizeStyleLink(newTag);\n placeholder.insert(this.dom.window.document.createTextNode('\\n'));\n placeholder.insert(newTag);\n }\n}\n\nexport function insertNewline(at: Node) {\n at.parentElement!.insertBefore(at.ownerDocument!.createTextNode('\\n'), at);\n}\n"]}
|