@embroider/addon-dev 8.0.0-alpha.5 → 8.0.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embroider/addon-dev",
|
|
3
|
-
"version": "8.0.0
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Utilities for addon authors",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,15 +30,6 @@
|
|
|
30
30
|
"optional": true
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
"release-plan": {
|
|
34
|
-
"semverIncrementAs": {
|
|
35
|
-
"major": "prerelease",
|
|
36
|
-
"minor": "prerelease",
|
|
37
|
-
"patch": "prerelease"
|
|
38
|
-
},
|
|
39
|
-
"semverIncrementTag": "alpha",
|
|
40
|
-
"publishTag": "alpha"
|
|
41
|
-
},
|
|
42
33
|
"dependencies": {
|
|
43
34
|
"@rollup/pluginutils": "^5.1.0",
|
|
44
35
|
"content-tag": "^3.0.0",
|
|
@@ -48,10 +39,10 @@
|
|
|
48
39
|
"rollup-plugin-copy-assets": "^2.0.3",
|
|
49
40
|
"walk-sync": "^3.0.0",
|
|
50
41
|
"yargs": "^17.0.1",
|
|
51
|
-
"@embroider/core": "^4.0.0
|
|
42
|
+
"@embroider/core": "^4.0.0"
|
|
52
43
|
},
|
|
53
44
|
"devDependencies": {
|
|
54
|
-
"@glimmer/syntax": "^0.
|
|
45
|
+
"@glimmer/syntax": "^0.94.9",
|
|
55
46
|
"@glint/core": "^1.5.0",
|
|
56
47
|
"@glint/template": "^1.5.0",
|
|
57
48
|
"@glint/environment-ember-loose": "^1.5.0",
|
package/src/rollup-hbs-plugin.js
CHANGED
|
@@ -18,10 +18,12 @@ function rollupHbsPlugin({ excludeColocation, }) {
|
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
let resolution = await this.resolve(source, importer, {
|
|
21
|
+
...options,
|
|
21
22
|
skipSelf: true,
|
|
22
23
|
});
|
|
23
24
|
if (!resolution && (0, path_1.extname)(source) === '') {
|
|
24
25
|
resolution = await this.resolve(source + '.hbs', importer, {
|
|
26
|
+
...options,
|
|
25
27
|
skipSelf: true,
|
|
26
28
|
});
|
|
27
29
|
}
|
|
@@ -29,6 +31,7 @@ function rollupHbsPlugin({ excludeColocation, }) {
|
|
|
29
31
|
let hbsSource = (0, core_1.syntheticJStoHBS)(source);
|
|
30
32
|
if (hbsSource) {
|
|
31
33
|
resolution = await this.resolve(hbsSource, importer, {
|
|
34
|
+
...options,
|
|
32
35
|
skipSelf: true,
|
|
33
36
|
custom: {
|
|
34
37
|
embroider: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-hbs-plugin.js","sourceRoot":"","sources":["rollup-hbs-plugin.ts"],"names":[],"mappings":";;;;;AAaA,
|
|
1
|
+
{"version":3,"file":"rollup-hbs-plugin.js","sourceRoot":"","sources":["rollup-hbs-plugin.ts"],"names":[],"mappings":";;;;;AAaA,kCA6FC;AAzGD,qDAAmD;AACnD,0DAAkC;AAClC,0CAKyB;AACzB,+BAA+B;AAE/B,MAAM,SAAS,GAAG,IAAA,0BAAY,EAAC,iBAAiB,CAAC,CAAC;AAElD,SAAwB,eAAe,CAAC,EACtC,iBAAiB,GAGlB;IACC,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,KAAK,CAAC,SAAS,CAAC,MAAc,EAAE,QAA4B,EAAE,OAAO;;YACnE,IAAI,MAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,SAAS,0CAAE,iBAAiB,EAAE,CAAC;gBACjD,OAAO,IAAI,CAAC;YACd,CAAC;YAED,IAAI,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE;gBACpD,GAAG,OAAO;gBACV,QAAQ,EAAE,IAAI;aACf,CAAC,CAAC;YAEH,IAAI,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QACN,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import type { Plugin, PluginContext } from 'rollup';\nimport { createFilter } from '@rollup/pluginutils';\nimport minimatch from 'minimatch';\nimport {\n hbsToJS,\n templateOnlyComponentSource,\n needsSyntheticComponentJS,\n syntheticJStoHBS,\n} from '@embroider/core';\nimport { extname } from 'path';\n\nconst hbsFilter = createFilter('**/*.hbs?([?]*)');\n\nexport default function rollupHbsPlugin({\n excludeColocation,\n}: {\n excludeColocation?: string[];\n}): Plugin {\n return {\n name: 'rollup-hbs-plugin',\n async resolveId(source: string, importer: string | undefined, options) {\n if (options.custom?.embroider?.isExtensionSearch) {\n return null;\n }\n\n let resolution = await this.resolve(source, importer, {\n ...options,\n skipSelf: true,\n });\n\n if (!resolution && extname(source) === '') {\n resolution = await this.resolve(source + '.hbs', importer, {\n ...options,\n skipSelf: true,\n });\n }\n\n if (!resolution) {\n let hbsSource = syntheticJStoHBS(source);\n if (hbsSource) {\n resolution = await this.resolve(hbsSource, importer, {\n ...options,\n skipSelf: true,\n custom: {\n embroider: {\n isExtensionSearch: true,\n },\n },\n });\n }\n\n if (!resolution) {\n return null;\n }\n }\n\n if (resolution && resolution.id.endsWith('.hbs')) {\n let isExcluded = excludeColocation?.some((glob) =>\n minimatch(resolution!.id, glob)\n );\n if (isExcluded) {\n return resolution;\n }\n }\n\n let syntheticId = needsSyntheticComponentJS(source, resolution.id);\n if (syntheticId) {\n this.addWatchFile(source);\n return {\n id: syntheticId,\n meta: {\n 'rollup-hbs-plugin': {\n type: 'template-only-component-js',\n },\n },\n };\n }\n },\n\n load(id: string) {\n if (getMeta(this, id)?.type === 'template-only-component-js') {\n this.addWatchFile(id);\n return {\n code: templateOnlyComponentSource(),\n };\n }\n },\n\n transform: {\n // Enforce running the hbs transform before any others like babel that expect valid JS\n order: 'pre',\n handler(code: string, id: string) {\n let hbsFilename = id.replace(/\\.\\w{1,3}$/, '') + '.hbs';\n if (hbsFilename !== id) {\n this.addWatchFile(hbsFilename);\n if (getMeta(this, id)?.type === 'template-only-component-js') {\n this.addWatchFile(id);\n }\n }\n if (!hbsFilter(id)) {\n return null;\n }\n return hbsToJS(code);\n },\n },\n };\n}\n\ntype Meta = {\n type: 'template-only-component-js';\n};\n\nfunction getMeta(context: PluginContext, id: string): Meta | null {\n const meta = context.getModuleInfo(id)?.meta?.['rollup-hbs-plugin'];\n if (meta) {\n return meta as Meta;\n } else {\n return null;\n }\n}\n"]}
|