@embroider/addon-dev 8.4.1 → 8.5.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/README.md +2 -2
- package/package.json +4 -2
- package/src/commands.d.ts +3 -0
- package/src/commands.js +70 -0
- package/src/commands.js.map +1 -0
- package/src/rollup-addon-dependencies.d.ts +3 -0
- package/src/rollup-addon-dependencies.js +46 -0
- package/src/rollup-addon-dependencies.js.map +1 -0
- package/src/rollup-app-reexports.d.ts +10 -0
- package/src/rollup-app-reexports.js +51 -0
- package/src/rollup-app-reexports.js.map +1 -0
- package/src/rollup-declarations.d.ts +10 -0
- package/src/rollup-declarations.js +134 -0
- package/src/rollup-declarations.js.map +1 -0
- package/src/rollup-gjs-plugin.d.ts +3 -0
- package/src/rollup-gjs-plugin.js +36 -0
- package/src/rollup-gjs-plugin.js.map +1 -0
- package/src/rollup-hbs-plugin.d.ts +5 -0
- package/src/rollup-hbs-plugin.js +105 -0
- package/src/rollup-hbs-plugin.js.map +1 -0
- package/src/rollup-incremental-plugin.d.ts +3 -0
- package/src/rollup-incremental-plugin.js +76 -0
- package/src/rollup-incremental-plugin.js.map +1 -0
- package/src/rollup-keep-assets.d.ts +7 -0
- package/src/rollup-keep-assets.js +123 -0
- package/src/rollup-keep-assets.js.map +1 -0
- package/src/rollup-public-assets.d.ts +23 -0
- package/src/rollup-public-assets.js +51 -0
- package/src/rollup-public-assets.js.map +1 -0
- package/src/rollup-public-entrypoints.d.ts +7 -0
- package/src/rollup-public-entrypoints.js +83 -0
- package/src/rollup-public-entrypoints.js.map +1 -0
- package/src/rollup.d.ts +33 -0
- package/src/rollup.js +116 -0
- package/src/rollup.js.map +1 -0
- package/src/template-colocation-plugin.d.ts +4 -0
- package/src/template-colocation-plugin.js +5 -0
- package/src/template-colocation-plugin.js.map +1 -0
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
exports.default = incremental;
|
|
7
|
+
const walk_sync_1 = __importDefault(require("walk-sync"));
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const fs_extra_1 = require("fs-extra");
|
|
11
|
+
function incremental() {
|
|
12
|
+
const generatedAssets = new Map();
|
|
13
|
+
const generatedFiles = new Set();
|
|
14
|
+
function isEqual(v1, v2) {
|
|
15
|
+
if (typeof v1 === 'string' && typeof v2 === 'string') {
|
|
16
|
+
return v1 === v2;
|
|
17
|
+
}
|
|
18
|
+
if (Buffer.isBuffer(v1) && Buffer.isBuffer(v2)) {
|
|
19
|
+
return v1.equals(v2);
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
let firstTime = true;
|
|
24
|
+
function initGeneratedFiles(outDir) {
|
|
25
|
+
if ((0, fs_extra_1.existsSync)(outDir)) {
|
|
26
|
+
const files = (0, walk_sync_1.default)(outDir, {
|
|
27
|
+
globs: ['**/*'],
|
|
28
|
+
directories: false,
|
|
29
|
+
});
|
|
30
|
+
for (const file of files) {
|
|
31
|
+
generatedFiles.add(file);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function deleteRemovedFiles(bundle, outDir) {
|
|
36
|
+
for (const file of generatedFiles) {
|
|
37
|
+
if (!bundle[file]) {
|
|
38
|
+
generatedAssets.delete(file);
|
|
39
|
+
(0, fs_1.rmSync)((0, path_1.join)(outDir, file));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
generatedFiles.clear();
|
|
43
|
+
for (const file of Object.keys(bundle)) {
|
|
44
|
+
generatedFiles.add(file);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function syncFiles(bundle) {
|
|
48
|
+
for (const checkKey of Object.keys(bundle)) {
|
|
49
|
+
if (bundle[checkKey]) {
|
|
50
|
+
let module = bundle[checkKey];
|
|
51
|
+
let code = module.source || module.code;
|
|
52
|
+
if (generatedAssets.has(checkKey) &&
|
|
53
|
+
isEqual(code, generatedAssets.get(checkKey))) {
|
|
54
|
+
delete bundle[checkKey];
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
generatedAssets.set(checkKey, code);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
name: 'incremental',
|
|
64
|
+
generateBundle(options, bundle) {
|
|
65
|
+
if (firstTime) {
|
|
66
|
+
firstTime = false;
|
|
67
|
+
initGeneratedFiles(options.dir);
|
|
68
|
+
}
|
|
69
|
+
if ((0, fs_extra_1.existsSync)(options.dir)) {
|
|
70
|
+
deleteRemovedFiles(bundle, options.dir);
|
|
71
|
+
}
|
|
72
|
+
syncFiles(bundle);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=rollup-incremental-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup-incremental-plugin.js","sourceRoot":"","sources":["rollup-incremental-plugin.ts"],"names":[],"mappings":";;;;;AAMA,8BAwEC;AA9ED,0DAAiC;AACjC,2BAA4B;AAC5B,+BAA4B;AAE5B,uCAAsC;AAEtC,SAAwB,WAAW;IACjC,MAAM,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;IAClC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IAEzC,SAAS,OAAO,CAAC,EAAuB,EAAE,EAAuB;QAC/D,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;YACrD,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,QAAQ,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C,IAAI,IAAI,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC;gBACxC,IACE,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC;oBAC7B,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAC5C,CAAC;oBACD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAC1B,CAAC;qBAAM,CAAC;oBACN,eAAe,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,cAAc,CAAC,OAAO,EAAE,MAAM;YAC5B,IAAI,SAAS,EAAE,CAAC;gBACd,SAAS,GAAG,KAAK,CAAC;gBAClB,kBAAkB,CAAC,OAAO,CAAC,GAAI,CAAC,CAAC;YACnC,CAAC;YACD,IAAI,IAAA,qBAAU,EAAC,OAAO,CAAC,GAAI,CAAC,EAAE,CAAC;gBAC7B,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,GAAI,CAAC,CAAC;YAC3C,CAAC;YAED,SAAS,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import walkSync from 'walk-sync';\nimport { rmSync } from 'fs';\nimport { join } from 'path';\nimport type { Plugin } from 'rollup';\nimport { existsSync } from 'fs-extra';\n\nexport default function incremental(): Plugin {\n const generatedAssets = new Map();\n const generatedFiles = new Set<string>();\n\n function isEqual(v1: string | Uint8Array, v2: string | Uint8Array): boolean {\n if (typeof v1 === 'string' && typeof v2 === 'string') {\n return v1 === v2;\n }\n if (Buffer.isBuffer(v1) && Buffer.isBuffer(v2)) {\n return v1.equals(v2);\n }\n return false;\n }\n\n let firstTime = true;\n\n function initGeneratedFiles(outDir: string) {\n if (existsSync(outDir)) {\n const files = walkSync(outDir, {\n globs: ['**/*'],\n directories: false,\n });\n for (const file of files) {\n generatedFiles.add(file);\n }\n }\n }\n\n function deleteRemovedFiles(bundle: Record<string, any>, outDir: string) {\n for (const file of generatedFiles) {\n if (!bundle[file]) {\n generatedAssets.delete(file);\n rmSync(join(outDir, file));\n }\n }\n generatedFiles.clear();\n for (const file of Object.keys(bundle)) {\n generatedFiles.add(file);\n }\n }\n\n function syncFiles(bundle: Record<string, any>) {\n for (const checkKey of Object.keys(bundle)) {\n if (bundle[checkKey]) {\n let module = bundle[checkKey] as any;\n let code = module.source || module.code;\n if (\n generatedAssets.has(checkKey) &&\n isEqual(code, generatedAssets.get(checkKey))\n ) {\n delete bundle[checkKey];\n } else {\n generatedAssets.set(checkKey, code);\n }\n }\n }\n }\n\n return {\n name: 'incremental',\n generateBundle(options, bundle) {\n if (firstTime) {\n firstTime = false;\n initGeneratedFiles(options.dir!);\n }\n if (existsSync(options.dir!)) {\n deleteRemovedFiles(bundle, options.dir!);\n }\n\n syncFiles(bundle);\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
exports.default = keepAssets;
|
|
7
|
+
const minimatch_1 = __importDefault(require("minimatch"));
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const magic_string_1 = __importDefault(require("magic-string"));
|
|
11
|
+
// randomly chosen, we're just looking to have high-entropy identifiers that
|
|
12
|
+
// won't collide with anyting else in the source
|
|
13
|
+
let counter = 11559;
|
|
14
|
+
function keepAssets({ from, include, exports, }) {
|
|
15
|
+
const marker = `__keep_assets_marker_${counter++}__`;
|
|
16
|
+
return {
|
|
17
|
+
name: 'keep-assets',
|
|
18
|
+
// we implement a load hook for the assets we're keeping so that we can
|
|
19
|
+
// capture their true binary representations. If we fell through to the
|
|
20
|
+
// default rollup load hook we would get utf8 interpretations of them.
|
|
21
|
+
//
|
|
22
|
+
// Our plugin should be placed after any other plugins that have their own
|
|
23
|
+
// load hooks, in which case this will not run but our transform hook will
|
|
24
|
+
// still over from there.
|
|
25
|
+
load(id) {
|
|
26
|
+
if (include.some((pattern) => (0, minimatch_1.default)(id, pattern))) {
|
|
27
|
+
return {
|
|
28
|
+
code: (0, fs_1.readFileSync)(id).toString('binary'),
|
|
29
|
+
meta: {
|
|
30
|
+
'keep-assets': {
|
|
31
|
+
binaryLoaded: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
transform(code, id) {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
let output = code;
|
|
40
|
+
let ourMeta = (_b = (_a = this.getModuleInfo(id)) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b['keep-assets'];
|
|
41
|
+
if (ourMeta === null || ourMeta === void 0 ? void 0 : ourMeta.binaryLoaded) {
|
|
42
|
+
// when the code was produced by our own load hook it is binary-encoded
|
|
43
|
+
// string and we can emit the true bytes.
|
|
44
|
+
output = Buffer.from(code, 'binary');
|
|
45
|
+
}
|
|
46
|
+
if (include.some((pattern) => (0, minimatch_1.default)(id, pattern))) {
|
|
47
|
+
let ref = this.emitFile({
|
|
48
|
+
type: 'asset',
|
|
49
|
+
fileName: (0, path_1.relative)(from, id),
|
|
50
|
+
source: output,
|
|
51
|
+
});
|
|
52
|
+
let replacement;
|
|
53
|
+
if (exports === '*') {
|
|
54
|
+
replacement = `export * from ${marker}("${ref}")`;
|
|
55
|
+
}
|
|
56
|
+
else if (exports === 'default') {
|
|
57
|
+
replacement = `export default ${marker}("${ref}")`;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
// side-effect only
|
|
61
|
+
replacement = `${marker}("${ref}")`;
|
|
62
|
+
}
|
|
63
|
+
// the asset's content leaves the JS module graph here. An empty map is
|
|
64
|
+
// rollup's convention for "deliberately no mapping", which keeps the
|
|
65
|
+
// chunk's source map intact instead of breaking it.
|
|
66
|
+
return { code: replacement, map: { mappings: '' } };
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
renderChunk(code, chunk) {
|
|
70
|
+
if (code.includes(marker)) {
|
|
71
|
+
const { getName, imports } = nameTracker(code, exports);
|
|
72
|
+
const magic = new magic_string_1.default(code);
|
|
73
|
+
magic.replaceAll(new RegExp(`${marker}\\("([^"]+)"\\)`, 'g'), (_x, ref) => {
|
|
74
|
+
var _a;
|
|
75
|
+
let assetFileName = this.getFileName(ref);
|
|
76
|
+
let relativeName = './' + (0, path_1.relative)((0, path_1.dirname)(chunk.fileName), assetFileName);
|
|
77
|
+
return (_a = getName(relativeName)) !== null && _a !== void 0 ? _a : '';
|
|
78
|
+
});
|
|
79
|
+
magic.prepend(imports());
|
|
80
|
+
// returning a map keeps the chunk's source map accurate across the
|
|
81
|
+
// injected imports and marker replacements
|
|
82
|
+
return {
|
|
83
|
+
code: magic.toString(),
|
|
84
|
+
map: magic.generateMap({ hires: 'boundary' }),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function nameTracker(code, exports) {
|
|
91
|
+
let counter = 0;
|
|
92
|
+
let assets = new Map();
|
|
93
|
+
function getName(assetName) {
|
|
94
|
+
if (assets.has(assetName)) {
|
|
95
|
+
return assets.get(assetName);
|
|
96
|
+
}
|
|
97
|
+
if (!exports) {
|
|
98
|
+
assets.set(assetName, undefined);
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
while (true) {
|
|
102
|
+
let candidate = `_asset_${counter++}_`;
|
|
103
|
+
if (!code.includes(candidate)) {
|
|
104
|
+
assets.set(assetName, candidate);
|
|
105
|
+
return candidate;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function imports() {
|
|
110
|
+
return ([...assets]
|
|
111
|
+
.map(([assetName, importedName]) => {
|
|
112
|
+
if (importedName) {
|
|
113
|
+
return `import ${importedName} from "${assetName}"`;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
return `import "${assetName}"`;
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
.join('\n') + '\n');
|
|
120
|
+
}
|
|
121
|
+
return { getName, imports };
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=rollup-keep-assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup-keep-assets.js","sourceRoot":"","sources":["rollup-keep-assets.ts"],"names":[],"mappings":";;;;;AAUA,6BAwFC;AAjGD,0DAAkC;AAClC,+BAAyC;AACzC,2BAAkC;AAClC,gEAAuC;AAEvC,4EAA4E;AAC5E,gDAAgD;AAChD,IAAI,OAAO,GAAG,KAAK,CAAC;AAEpB,SAAwB,UAAU,CAAC,EACjC,IAAI,EACJ,OAAO,EACP,OAAO,GAKR;IACC,MAAM,MAAM,GAAG,wBAAwB,OAAO,EAAE,IAAI,CAAC;IAErD,OAAO;QACL,IAAI,EAAE,aAAa;QAEnB,uEAAuE;QACvE,uEAAuE;QACvE,sEAAsE;QACtE,EAAE;QACF,0EAA0E;QAC1E,0EAA0E;QAC1E,yBAAyB;QACzB,IAAI,CAAC,EAAU;YACb,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,mBAAS,EAAC,EAAE,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;gBACtD,OAAO;oBACL,IAAI,EAAE,IAAA,iBAAY,EAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;oBACzC,IAAI,EAAE;wBACJ,aAAa,EAAE;4BACb,YAAY,EAAE,IAAI;yBACnB;qBACF;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,SAAS,CAAC,IAAY,EAAE,EAAU;;YAChC,IAAI,MAAM,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AAC,CAAC;YACjC,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,EAAE,CAAC;YACZ,IAAI,SAAS,GAAG,UAAU,OAAO,EAAE,GAAG,CAAC;YACvC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC9B,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;gBACjC,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;IACH,CAAC;IAED,SAAS,OAAO;QACd,OAAO,CACL,CAAC,GAAG,MAAM,CAAC;aACR,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,EAAE;YACjC,IAAI,YAAY,EAAE,CAAC;gBACjB,OAAO,UAAU,YAAY,UAAU,SAAS,GAAG,CAAC;YACtD,CAAC;iBAAM,CAAC;gBACN,OAAO,WAAW,SAAS,GAAG,CAAC;YACjC,CAAC;QACH,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CACrB,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["import type { Plugin } from 'rollup';\nimport minimatch from 'minimatch';\nimport { dirname, relative } from 'path';\nimport { readFileSync } from 'fs';\nimport MagicString from 'magic-string';\n\n// randomly chosen, we're just looking to have high-entropy identifiers that\n// won't collide with anyting else in the source\nlet counter = 11559;\n\nexport default function keepAssets({\n from,\n include,\n exports,\n}: {\n from: string;\n include: string[];\n exports?: undefined | 'default' | '*';\n}): Plugin {\n const marker = `__keep_assets_marker_${counter++}__`;\n\n return {\n name: 'keep-assets',\n\n // we implement a load hook for the assets we're keeping so that we can\n // capture their true binary representations. If we fell through to the\n // default rollup load hook we would get utf8 interpretations of them.\n //\n // Our plugin should be placed after any other plugins that have their own\n // load hooks, in which case this will not run but our transform hook will\n // still over from there.\n load(id: string) {\n if (include.some((pattern) => minimatch(id, pattern))) {\n return {\n code: readFileSync(id).toString('binary'),\n meta: {\n 'keep-assets': {\n binaryLoaded: true,\n },\n },\n };\n }\n },\n\n transform(code: string, id: string) {\n let output: Buffer | string = code;\n let ourMeta = this.getModuleInfo(id)?.meta?.['keep-assets'];\n if (ourMeta?.binaryLoaded) {\n // when the code was produced by our own load hook it is binary-encoded\n // string and we can emit the true bytes.\n output = Buffer.from(code, 'binary');\n }\n if (include.some((pattern) => minimatch(id, pattern))) {\n let ref = this.emitFile({\n type: 'asset',\n fileName: relative(from, id),\n source: output,\n });\n let replacement: string;\n if (exports === '*') {\n replacement = `export * from ${marker}(\"${ref}\")`;\n } else if (exports === 'default') {\n replacement = `export default ${marker}(\"${ref}\")`;\n } else {\n // side-effect only\n replacement = `${marker}(\"${ref}\")`;\n }\n // the asset's content leaves the JS module graph here. An empty map is\n // rollup's convention for \"deliberately no mapping\", which keeps the\n // chunk's source map intact instead of breaking it.\n return { code: replacement, map: { mappings: '' as const } };\n }\n },\n renderChunk(code, chunk) {\n if (code.includes(marker)) {\n const { getName, imports } = nameTracker(code, exports);\n const magic = new MagicString(code);\n\n magic.replaceAll(\n new RegExp(`${marker}\\\\(\"([^\"]+)\"\\\\)`, 'g'),\n (_x: string, ref: string) => {\n let assetFileName = this.getFileName(ref);\n let relativeName =\n './' + relative(dirname(chunk.fileName), assetFileName);\n return getName(relativeName) ?? '';\n }\n );\n magic.prepend(imports());\n\n // returning a map keeps the chunk's source map accurate across the\n // injected imports and marker replacements\n return {\n code: magic.toString(),\n map: magic.generateMap({ hires: 'boundary' }),\n };\n }\n },\n };\n}\n\nfunction nameTracker(code: string, exports: undefined | 'default' | '*') {\n let counter = 0;\n let assets = new Map<string, string | undefined>();\n\n function getName(assetName: string): string | undefined {\n if (assets.has(assetName)) {\n return assets.get(assetName)!;\n }\n if (!exports) {\n assets.set(assetName, undefined);\n return undefined;\n }\n while (true) {\n let candidate = `_asset_${counter++}_`;\n if (!code.includes(candidate)) {\n assets.set(assetName, candidate);\n return candidate;\n }\n }\n }\n\n function imports() {\n return (\n [...assets]\n .map(([assetName, importedName]) => {\n if (importedName) {\n return `import ${importedName} from \"${assetName}\"`;\n } else {\n return `import \"${assetName}\"`;\n }\n })\n .join('\\n') + '\\n'\n );\n }\n\n return { getName, imports };\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Plugin } from 'rollup';
|
|
2
|
+
export interface PublicAssetsOptions {
|
|
3
|
+
/**
|
|
4
|
+
* glob pattern passed to `walkSync.include` to pick files
|
|
5
|
+
*/
|
|
6
|
+
include?: string[];
|
|
7
|
+
/**
|
|
8
|
+
* glob pattern passed to `walkSync.ignore` to exclude files
|
|
9
|
+
*/
|
|
10
|
+
exclude?: string[];
|
|
11
|
+
/**
|
|
12
|
+
* namespace to expose files
|
|
13
|
+
*/
|
|
14
|
+
namespace?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A rollup plugin to expose a folder of assets
|
|
18
|
+
*
|
|
19
|
+
* @param path - the public folder that you want to add as public assets
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export default function publicAssets(path: string, opts?: PublicAssetsOptions): Plugin;
|
|
23
|
+
//# sourceMappingURL=rollup-public-assets.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
exports.default = publicAssets;
|
|
7
|
+
const fs_extra_1 = require("fs-extra");
|
|
8
|
+
const walk_sync_1 = __importDefault(require("walk-sync"));
|
|
9
|
+
const posix_1 = require("path/posix");
|
|
10
|
+
/**
|
|
11
|
+
* A rollup plugin to expose a folder of assets
|
|
12
|
+
*
|
|
13
|
+
* @param path - the public folder that you want to add as public assets
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
function publicAssets(path, opts) {
|
|
17
|
+
const includeGlobPatterns = opts === null || opts === void 0 ? void 0 : opts.include;
|
|
18
|
+
const excludedGlobPatterns = (opts === null || opts === void 0 ? void 0 : opts.exclude) || [];
|
|
19
|
+
return {
|
|
20
|
+
name: 'public-assets-bundler',
|
|
21
|
+
// Prior to https://github.com/rollup/rollup/pull/5270, we cannot call this
|
|
22
|
+
// from within `generateBundle`
|
|
23
|
+
buildStart() {
|
|
24
|
+
this.addWatchFile(path);
|
|
25
|
+
},
|
|
26
|
+
closeBundle() {
|
|
27
|
+
var _a;
|
|
28
|
+
let pkg = (0, fs_extra_1.readJsonSync)('package.json');
|
|
29
|
+
const filenames = (0, walk_sync_1.default)(path, {
|
|
30
|
+
directories: false,
|
|
31
|
+
globs: includeGlobPatterns,
|
|
32
|
+
ignore: excludedGlobPatterns,
|
|
33
|
+
});
|
|
34
|
+
const publicAssets = filenames.reduce((acc, v) => {
|
|
35
|
+
var _a;
|
|
36
|
+
const namespace = (_a = opts === null || opts === void 0 ? void 0 : opts.namespace) !== null && _a !== void 0 ? _a : pkg.name;
|
|
37
|
+
acc[`./${path}/${v}`] = (0, posix_1.resolve)('/' + (0, posix_1.join)(namespace, v));
|
|
38
|
+
return acc;
|
|
39
|
+
}, {});
|
|
40
|
+
let originalPublicAssets = (_a = pkg['ember-addon']) === null || _a === void 0 ? void 0 : _a['public-assets'];
|
|
41
|
+
let hasChanges = JSON.stringify(originalPublicAssets) !== JSON.stringify(publicAssets);
|
|
42
|
+
if (hasChanges) {
|
|
43
|
+
pkg['ember-addon'] = Object.assign({}, pkg['ember-addon'], {
|
|
44
|
+
'public-assets': publicAssets,
|
|
45
|
+
});
|
|
46
|
+
(0, fs_extra_1.writeJsonSync)('package.json', pkg, { spaces: 2 });
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=rollup-public-assets.js.map
|
|
@@ -0,0 +1 @@
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AAe,CAAC,CAAC;YAEjE,IAAI,UAAU,GACZ,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAExE,IAAI,UAAU,EAAE,CAAC;gBACf,GAAG,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,aAAa,CAAC,EAAE;oBACzD,eAAe,EAAE,YAAY;iBAC9B,CAAC,CAAC;gBAEH,IAAA,wBAAa,EAAC,cAAc,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { readJsonSync, writeJsonSync } from 'fs-extra';\nimport walkSync from 'walk-sync';\nimport type { Plugin } from 'rollup';\nimport { resolve, join } from 'path/posix';\n\nexport interface PublicAssetsOptions {\n /**\n * glob pattern passed to `walkSync.include` to pick files\n */\n include?: string[];\n\n /**\n * glob pattern passed to `walkSync.ignore` to exclude files\n */\n exclude?: string[];\n\n /**\n * namespace to expose files\n */\n namespace?: string;\n}\n\n/**\n * A rollup plugin to expose a folder of assets\n *\n * @param path - the public folder that you want to add as public assets\n * @returns\n */\nexport default function publicAssets(\n path: string,\n opts?: PublicAssetsOptions\n): Plugin {\n const includeGlobPatterns = opts?.include;\n const excludedGlobPatterns = opts?.exclude || [];\n\n return {\n name: 'public-assets-bundler',\n\n // Prior to https://github.com/rollup/rollup/pull/5270, we cannot call this\n // from within `generateBundle`\n buildStart() {\n this.addWatchFile(path);\n },\n\n closeBundle() {\n let pkg = readJsonSync('package.json');\n const filenames = walkSync(path, {\n directories: false,\n globs: includeGlobPatterns,\n ignore: excludedGlobPatterns,\n });\n const publicAssets: Record<string, string> = filenames.reduce(\n (acc: Record<string, string>, v): Record<string, string> => {\n const namespace = opts?.namespace ?? pkg.name;\n\n acc[`./${path}/${v}`] = resolve('/' + join(namespace, v));\n return acc;\n },\n {}\n );\n\n let originalPublicAssets = pkg['ember-addon']?.['public-assets'];\n\n let hasChanges =\n JSON.stringify(originalPublicAssets) !== JSON.stringify(publicAssets);\n\n if (hasChanges) {\n pkg['ember-addon'] = Object.assign({}, pkg['ember-addon'], {\n 'public-assets': publicAssets,\n });\n\n writeJsonSync('package.json', pkg, { spaces: 2 });\n }\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
exports.default = publicEntrypoints;
|
|
7
|
+
const walk_sync_1 = __importDefault(require("walk-sync"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const minimatch_1 = __importDefault(require("minimatch"));
|
|
10
|
+
function normalizeFileExt(fileName) {
|
|
11
|
+
return fileName.replace(/(?<!\.d)\.ts|\.hbs|\.gts|\.gjs$/, '.js');
|
|
12
|
+
}
|
|
13
|
+
function publicEntrypoints(args) {
|
|
14
|
+
const allEntryPoints = new Set();
|
|
15
|
+
return {
|
|
16
|
+
name: 'addon-modules',
|
|
17
|
+
async buildStart() {
|
|
18
|
+
const include = [
|
|
19
|
+
...args.include,
|
|
20
|
+
'**/*.hbs',
|
|
21
|
+
'**/*.ts',
|
|
22
|
+
'**/*.gts',
|
|
23
|
+
'**/*.gjs',
|
|
24
|
+
];
|
|
25
|
+
// wait a bit first https://github.com/nodejs/node/issues/4760
|
|
26
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
27
|
+
let matches = (0, walk_sync_1.default)(args.srcDir, {
|
|
28
|
+
globs: include,
|
|
29
|
+
ignore: args.exclude,
|
|
30
|
+
});
|
|
31
|
+
matches.forEach((m) => allEntryPoints.add(m));
|
|
32
|
+
for (const name of allEntryPoints) {
|
|
33
|
+
this.addWatchFile(path_1.default.resolve(args.srcDir, name));
|
|
34
|
+
}
|
|
35
|
+
for (let name of matches) {
|
|
36
|
+
// the matched file, but with the extension swapped with .js
|
|
37
|
+
let normalizedName = normalizeFileExt(name);
|
|
38
|
+
// anything that doesn't match the users patterns, and wasn't a template-only
|
|
39
|
+
// component needs to be emitted "as-is" so that other plugins may handle it.
|
|
40
|
+
let isTO = isTemplateOnly(matches, name);
|
|
41
|
+
let isHbs = path_1.default.extname(name) === '.hbs';
|
|
42
|
+
// hbs for-colocated components is handled by the rollup-hbs-plugin
|
|
43
|
+
// hbs for template-only components is handled in the isTO block
|
|
44
|
+
if (isHbs && !isTO) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
// these chunks matched are **/*.hbs glob and are
|
|
48
|
+
// guaranteed to not have any corresponding file as a co-located component would have.
|
|
49
|
+
if (isTO) {
|
|
50
|
+
this.emitFile({
|
|
51
|
+
type: 'chunk',
|
|
52
|
+
id: path_1.default.join(args.srcDir, normalizedName),
|
|
53
|
+
fileName: normalizedName,
|
|
54
|
+
});
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
// anything that matches one of the user's patterns is definitely emitted
|
|
58
|
+
let isUserDefined = args.include.some((pattern) => (0, minimatch_1.default)(name, pattern));
|
|
59
|
+
// additionally, we want to emit chunks where the pattern matches the supported
|
|
60
|
+
// file extensions above (TS, GTS, etc) as if they were already the built JS.
|
|
61
|
+
let wouldMatchIfBuilt = include.some((pattern) => (0, minimatch_1.default)(normalizedName, pattern));
|
|
62
|
+
if (isUserDefined || wouldMatchIfBuilt) {
|
|
63
|
+
this.emitFile({
|
|
64
|
+
type: 'chunk',
|
|
65
|
+
id: path_1.default.join(args.srcDir, name),
|
|
66
|
+
fileName: normalizedName,
|
|
67
|
+
});
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function isTemplateOnly(matches, filePath) {
|
|
75
|
+
let isHbs = path_1.default.extname(filePath) === '.hbs';
|
|
76
|
+
if (!isHbs)
|
|
77
|
+
return false;
|
|
78
|
+
let correspondingFileGlob = path_1.default.join(path_1.default.dirname(filePath), path_1.default.basename(filePath).replace(/hbs$/, '*'));
|
|
79
|
+
let relatedFiles = matches.filter((match) => (0, minimatch_1.default)(match, correspondingFileGlob));
|
|
80
|
+
let isTO = relatedFiles.filter((x) => x !== filePath).length === 0;
|
|
81
|
+
return isTO;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=rollup-public-entrypoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup-public-entrypoints.js","sourceRoot":"","sources":["rollup-public-entrypoints.ts"],"names":[],"mappings":";;;;;AAUA,oCAkFC;AA5FD,0DAAiC;AACjC,gDAAwB;AACxB,0DAAkC;AAIlC,SAAS,gBAAgB,CAAC,QAAgB;IACxC,OAAO,QAAQ,CAAC,OAAO,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC;AAED,SAAwB,iBAAiB,CAAC,IAIzC;IACC,MAAM,cAAc,GAAgB,IAAI,GAAG,EAAE,CAAC;IAE9C,OAAO;QACL,IAAI,EAAE,eAAe;QAErB,KAAK,CAAC,UAAU;YACd,MAAM,OAAO,GAAG;gBACd,GAAG,IAAI,CAAC,OAAO;gBACf,UAAU;gBACV,SAAS;gBACT,UAAU;gBACV,UAAU;aACX,CAAC;YACF,8DAA8D;YAC9D,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;YACxD,IAAI,OAAO,GAAG,IAAA,mBAAQ,EAAC,IAAI,CAAC,MAAM,EAAE;gBAClC,KAAK,EAAE,OAAO;gBACd,MAAM,EAAE,IAAI,CAAC,OAAO;aACrB,CAAC,CAAC;YAEH,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EA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AC;gBAEF,IAAI,aAAa,IAAI,iBAAiB,EAAE,CAAC;oBACvC,IAAI,CAAC,QAAQ,CAAC;wBACZ,IAAI,EAAE,OAAO;wBACb,EAAE,EAAE,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;wBAChC,QAAQ,EAAE,cAAc;qBACzB,CAAC,CAAC;oBAEH,SAAS;gBACX,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,OAAiB,EAAE,QAAgB;IACzD,IAAI,KAAK,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,MAAM,CAAC;IAE9C,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IAEzB,IAAI,qBAAqB,GAAG,cAAI,CAAC,IAAI,CACnC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EACtB,cAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAC7C,CAAC;IAEF,IAAI,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAC1C,IAAA,mBAAS,EAAC,KAAK,EAAE,qBAAqB,CAAC,CACxC,CAAC;IACF,IAAI,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IAEnE,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import walkSync from 'walk-sync';\nimport path from 'path';\nimport minimatch from 'minimatch';\n\nimport type { Plugin } from 'rollup';\n\nfunction normalizeFileExt(fileName: string) {\n return fileName.replace(/(?<!\\.d)\\.ts|\\.hbs|\\.gts|\\.gjs$/, '.js');\n}\n\nexport default function publicEntrypoints(args: {\n srcDir: string;\n include: string[];\n exclude?: string[];\n}): Plugin {\n const allEntryPoints: Set<string> = new Set();\n\n return {\n name: 'addon-modules',\n\n async buildStart() {\n const include = [\n ...args.include,\n '**/*.hbs',\n '**/*.ts',\n '**/*.gts',\n '**/*.gjs',\n ];\n // wait a bit first https://github.com/nodejs/node/issues/4760\n await new Promise((resolve) => setTimeout(resolve, 50));\n let matches = walkSync(args.srcDir, {\n globs: include,\n ignore: args.exclude,\n });\n\n matches.forEach((m) => allEntryPoints.add(m));\n\n for (const name of allEntryPoints) {\n this.addWatchFile(path.resolve(args.srcDir, name));\n }\n\n for (let name of matches) {\n // the matched file, but with the extension swapped with .js\n let normalizedName = normalizeFileExt(name);\n\n // anything that doesn't match the users patterns, and wasn't a template-only\n // component needs to be emitted \"as-is\" so that other plugins may handle it.\n let isTO = isTemplateOnly(matches, name);\n\n let isHbs = path.extname(name) === '.hbs';\n\n // hbs for-colocated components is handled by the rollup-hbs-plugin\n // hbs for template-only components is handled in the isTO block\n if (isHbs && !isTO) {\n continue;\n }\n\n // these chunks matched are **/*.hbs glob and are\n // guaranteed to not have any corresponding file as a co-located component would have.\n if (isTO) {\n this.emitFile({\n type: 'chunk',\n id: path.join(args.srcDir, normalizedName),\n fileName: normalizedName,\n });\n\n continue;\n }\n\n // anything that matches one of the user's patterns is definitely emitted\n let isUserDefined = args.include.some((pattern) =>\n minimatch(name, pattern)\n );\n\n // additionally, we want to emit chunks where the pattern matches the supported\n // file extensions above (TS, GTS, etc) as if they were already the built JS.\n let wouldMatchIfBuilt = include.some((pattern) =>\n minimatch(normalizedName, pattern)\n );\n\n if (isUserDefined || wouldMatchIfBuilt) {\n this.emitFile({\n type: 'chunk',\n id: path.join(args.srcDir, name),\n fileName: normalizedName,\n });\n\n continue;\n }\n }\n },\n };\n}\n\nfunction isTemplateOnly(matches: string[], filePath: string) {\n let isHbs = path.extname(filePath) === '.hbs';\n\n if (!isHbs) return false;\n\n let correspondingFileGlob = path.join(\n path.dirname(filePath),\n path.basename(filePath).replace(/hbs$/, '*')\n );\n\n let relatedFiles = matches.filter((match) =>\n minimatch(match, correspondingFileGlob)\n );\n let isTO = relatedFiles.filter((x) => x !== filePath).length === 0;\n\n return isTO;\n}\n"]}
|
package/src/rollup.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type PublicAssetsOptions } from './rollup-public-assets';
|
|
2
|
+
import type { Plugin } from 'rollup';
|
|
3
|
+
export declare class Addon {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(params?: {
|
|
6
|
+
srcDir?: string;
|
|
7
|
+
destDir?: string;
|
|
8
|
+
});
|
|
9
|
+
appReexports(patterns: string[], opts?: {
|
|
10
|
+
mapFilename?: (fileName: string) => string;
|
|
11
|
+
exports?: (filename: string) => string[] | string | undefined;
|
|
12
|
+
exclude?: string[];
|
|
13
|
+
}): Plugin;
|
|
14
|
+
publicEntrypoints(patterns: string[], opts?: {
|
|
15
|
+
exclude?: string[];
|
|
16
|
+
}): Plugin<any>;
|
|
17
|
+
hbs(options?: {}): Plugin<any>;
|
|
18
|
+
gjs(): Plugin<any>;
|
|
19
|
+
clean(): Plugin<any>;
|
|
20
|
+
keepAssets(patterns: string[], exports?: undefined | 'default' | '*'): Plugin<any>;
|
|
21
|
+
output(): {
|
|
22
|
+
dir: string;
|
|
23
|
+
entryFileNames: string;
|
|
24
|
+
experimentalMinChunkSize: number;
|
|
25
|
+
format: string;
|
|
26
|
+
hoistTransitiveImports: boolean;
|
|
27
|
+
sourcemap: boolean;
|
|
28
|
+
};
|
|
29
|
+
dependencies(): Plugin<any>;
|
|
30
|
+
publicAssets(path: string, opts?: PublicAssetsOptions): Plugin<any>;
|
|
31
|
+
declarations(path: string, command?: string): Plugin<any>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=rollup.d.ts.map
|
package/src/rollup.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
var _Addon_srcDir, _Addon_destDir;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.Addon = void 0;
|
|
19
|
+
const rollup_hbs_plugin_1 = __importDefault(require("./rollup-hbs-plugin"));
|
|
20
|
+
const rollup_gjs_plugin_1 = __importDefault(require("./rollup-gjs-plugin"));
|
|
21
|
+
const rollup_public_entrypoints_1 = __importDefault(require("./rollup-public-entrypoints"));
|
|
22
|
+
const rollup_app_reexports_1 = __importDefault(require("./rollup-app-reexports"));
|
|
23
|
+
const rollup_keep_assets_1 = __importDefault(require("./rollup-keep-assets"));
|
|
24
|
+
const rollup_declarations_1 = __importDefault(require("./rollup-declarations"));
|
|
25
|
+
const rollup_addon_dependencies_1 = __importDefault(require("./rollup-addon-dependencies"));
|
|
26
|
+
const rollup_public_assets_1 = __importDefault(require("./rollup-public-assets"));
|
|
27
|
+
const rollup_incremental_plugin_1 = __importDefault(require("./rollup-incremental-plugin"));
|
|
28
|
+
class Addon {
|
|
29
|
+
constructor(params = {}) {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
_Addon_srcDir.set(this, void 0);
|
|
32
|
+
_Addon_destDir.set(this, void 0);
|
|
33
|
+
__classPrivateFieldSet(this, _Addon_srcDir, (_a = params.srcDir) !== null && _a !== void 0 ? _a : 'src', "f");
|
|
34
|
+
__classPrivateFieldSet(this, _Addon_destDir, (_b = params.destDir) !== null && _b !== void 0 ? _b : 'dist', "f");
|
|
35
|
+
}
|
|
36
|
+
// Given a list of globs describing modules in your srcDir, this generates
|
|
37
|
+
// corresponding appTree modules that contain reexports, and updates your
|
|
38
|
+
// package.json metadata to list them all.
|
|
39
|
+
appReexports(patterns, opts = {}) {
|
|
40
|
+
return (0, rollup_app_reexports_1.default)({
|
|
41
|
+
from: __classPrivateFieldGet(this, _Addon_srcDir, "f"),
|
|
42
|
+
to: __classPrivateFieldGet(this, _Addon_destDir, "f"),
|
|
43
|
+
include: patterns,
|
|
44
|
+
mapFilename: opts.mapFilename,
|
|
45
|
+
exports: opts.exports,
|
|
46
|
+
exclude: opts.exclude,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// This configures rollup to emit public entrypoints for each module in your
|
|
50
|
+
// srcDir that matches one of the given globs. Typical addons will want to
|
|
51
|
+
// match patterns like "components/**/*.js", "index.js", and "test-support.js".
|
|
52
|
+
publicEntrypoints(patterns, opts = {}) {
|
|
53
|
+
return (0, rollup_public_entrypoints_1.default)({
|
|
54
|
+
srcDir: __classPrivateFieldGet(this, _Addon_srcDir, "f"),
|
|
55
|
+
include: patterns,
|
|
56
|
+
exclude: opts.exclude,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
// This wraps standalone .hbs files as Javascript files using inline
|
|
60
|
+
// templates. This means special resolving rules for .hbs files aren't
|
|
61
|
+
// required for javascript tooling to understand your package.
|
|
62
|
+
hbs(options = {}) {
|
|
63
|
+
return (0, rollup_hbs_plugin_1.default)(options);
|
|
64
|
+
}
|
|
65
|
+
gjs() {
|
|
66
|
+
return (0, rollup_gjs_plugin_1.default)();
|
|
67
|
+
}
|
|
68
|
+
// this does incremental updates to the dist files and also deletes files that are not part of the generated bundle
|
|
69
|
+
// rollup already supports incremental transforms of files,
|
|
70
|
+
// this extends it to the dist files
|
|
71
|
+
clean() {
|
|
72
|
+
return (0, rollup_incremental_plugin_1.default)();
|
|
73
|
+
}
|
|
74
|
+
// V2 Addons are allowed to contain imports of .css files. This tells rollup
|
|
75
|
+
// to leave those imports alone and to make sure the corresponding .css files
|
|
76
|
+
// are kept in the same relative locations in the destDir as they were in the
|
|
77
|
+
// srcDir.
|
|
78
|
+
keepAssets(patterns, exports) {
|
|
79
|
+
return (0, rollup_keep_assets_1.default)({
|
|
80
|
+
from: __classPrivateFieldGet(this, _Addon_srcDir, "f"),
|
|
81
|
+
include: patterns,
|
|
82
|
+
exports: exports,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
// This is the default `output` configuration you should pass to rollup. We're
|
|
86
|
+
// emitting ES modules, in your `destDir`, and their filenames are equal to
|
|
87
|
+
// their bundle names (the bundle names get generated by `publicEntrypoints`
|
|
88
|
+
// above).
|
|
89
|
+
//
|
|
90
|
+
// hoistTransitiveImports is disabled because the purpose of hoisting transitive imports
|
|
91
|
+
// is to improve performance of apps loading modules.
|
|
92
|
+
// Since v2 addons do not know exactly how they'll be used, this performance decision
|
|
93
|
+
// is left up to apps.
|
|
94
|
+
output() {
|
|
95
|
+
return {
|
|
96
|
+
dir: __classPrivateFieldGet(this, _Addon_destDir, "f"),
|
|
97
|
+
entryFileNames: '[name]',
|
|
98
|
+
experimentalMinChunkSize: 0,
|
|
99
|
+
format: 'es',
|
|
100
|
+
hoistTransitiveImports: false,
|
|
101
|
+
sourcemap: true,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
dependencies() {
|
|
105
|
+
return (0, rollup_addon_dependencies_1.default)();
|
|
106
|
+
}
|
|
107
|
+
publicAssets(path, opts) {
|
|
108
|
+
return (0, rollup_public_assets_1.default)(path, opts);
|
|
109
|
+
}
|
|
110
|
+
declarations(path, command) {
|
|
111
|
+
return (0, rollup_declarations_1.default)(path, command);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.Addon = Addon;
|
|
115
|
+
_Addon_srcDir = new WeakMap(), _Addon_destDir = new WeakMap();
|
|
116
|
+
//# sourceMappingURL=rollup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,4EAAqD;AACrD,4EAAqD;AACrD,4FAA2E;AAC3E,kFAAiE;AACjE,8EAA6D;AAC7D,gFAAgE;AAChE,4FAAsE;AACtE,kFAGgC;AAChC,4FAA+D;AAG/D,MAAa,KAAK;IAIhB,YAAY,SAAgD,EAAE;;QAH9D,gCAAgB;QAChB,iCAAiB;QAGf,uBAAA,IAAI,iBAAW,MAAA,MAAM,CAAC,MAAM,mCAAI,KAAK,MAAA,CAAC;QACtC,uBAAA,IAAI,kBAAY,MAAA,MAAM,CAAC,OAAO,mCAAI,MAAM,MAAA,CAAC;IAC3C,CAAC;IAED,0EAA0E;IAC1E,yEAAyE;IACzE,0CAA0C;IAC1C,YAAY,CACV,QAAkB,EAClB,OAII,EAAE;QAEN,OAAO,IAAA,8BAAY,EAAC;YAClB,IAAI,EAAE,uBAAA,IAAI,qBAAQ;YAClB,EAAE,EAAE,uBAAA,IAAI,sBAAS;YACjB,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;IAED,4EAA4E;IAC5E,0EAA0E;IAC1E,+EAA+E;IAC/E,iBAAiB,CAAC,QAAkB,EAAE,OAA+B,EAAE;QACrE,OAAO,IAAA,mCAAiB,EAAC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IAAA,6BAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;CACF;AAtGD,sBAsGC","sourcesContent":["import { default as hbs } from './rollup-hbs-plugin';\nimport { default as gjs } from './rollup-gjs-plugin';\nimport { default as publicEntrypoints } from './rollup-public-entrypoints';\nimport { default as appReexports } from './rollup-app-reexports';\nimport { default as keepAssets } from './rollup-keep-assets';\nimport { default as declarations } from './rollup-declarations';\nimport { default as dependencies } from './rollup-addon-dependencies';\nimport {\n default as publicAssets,\n type PublicAssetsOptions,\n} from './rollup-public-assets';\nimport { default as clean } from './rollup-incremental-plugin';\nimport type { Plugin } from 'rollup';\n\nexport class Addon {\n #srcDir: string;\n #destDir: string;\n\n constructor(params: { srcDir?: string; destDir?: string } = {}) {\n this.#srcDir = params.srcDir ?? 'src';\n this.#destDir = params.destDir ?? 'dist';\n }\n\n // Given a list of globs describing modules in your srcDir, this generates\n // corresponding appTree modules that contain reexports, and updates your\n // package.json metadata to list them all.\n appReexports(\n patterns: string[],\n opts: {\n mapFilename?: (fileName: string) => string;\n exports?: (filename: string) => string[] | string | undefined;\n exclude?: string[];\n } = {}\n ): Plugin {\n return appReexports({\n from: this.#srcDir,\n to: this.#destDir,\n include: patterns,\n mapFilename: opts.mapFilename,\n exports: opts.exports,\n exclude: opts.exclude,\n });\n }\n\n // This configures rollup to emit public entrypoints for each module in your\n // srcDir that matches one of the given globs. Typical addons will want to\n // match patterns like \"components/**/*.js\", \"index.js\", and \"test-support.js\".\n publicEntrypoints(patterns: string[], opts: { exclude?: string[] } = {}) {\n return publicEntrypoints({\n srcDir: this.#srcDir,\n include: patterns,\n exclude: opts.exclude,\n });\n }\n\n // This wraps standalone .hbs files as Javascript files using inline\n // templates. This means special resolving rules for .hbs files aren't\n // required for javascript tooling to understand your package.\n hbs(options = {}) {\n return hbs(options);\n }\n\n gjs() {\n return gjs();\n }\n\n // this does incremental updates to the dist files and also deletes files that are not part of the generated bundle\n // rollup already supports incremental transforms of files,\n // this extends it to the dist files\n clean() {\n return clean();\n }\n\n // V2 Addons are allowed to contain imports of .css files. This tells rollup\n // to leave those imports alone and to make sure the corresponding .css files\n // are kept in the same relative locations in the destDir as they were in the\n // srcDir.\n keepAssets(patterns: string[], exports?: undefined | 'default' | '*') {\n return keepAssets({\n from: this.#srcDir,\n include: patterns,\n exports: exports,\n });\n }\n\n // This is the default `output` configuration you should pass to rollup. We're\n // emitting ES modules, in your `destDir`, and their filenames are equal to\n // their bundle names (the bundle names get generated by `publicEntrypoints`\n // above).\n //\n // hoistTransitiveImports is disabled because the purpose of hoisting transitive imports\n // is to improve performance of apps loading modules.\n // Since v2 addons do not know exactly how they'll be used, this performance decision\n // is left up to apps.\n output() {\n return {\n dir: this.#destDir,\n entryFileNames: '[name]',\n experimentalMinChunkSize: 0,\n format: 'es',\n hoistTransitiveImports: false,\n sourcemap: true,\n };\n }\n\n dependencies() {\n return dependencies();\n }\n\n publicAssets(path: string, opts?: PublicAssetsOptions) {\n return publicAssets(path, opts);\n }\n\n declarations(path: string, command?: string) {\n return declarations(path, command);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-colocation-plugin.js","sourceRoot":"","sources":["template-colocation-plugin.ts"],"names":[],"mappings":";;AAAA,0CAGyB;AAGzB,kBAAe,+BAAwB,CAAC","sourcesContent":["import {\n templateColocationPlugin,\n Options as TemplateColocationPluginOptions,\n} from '@embroider/core';\n\nexport { TemplateColocationPluginOptions as Options };\nexport default templateColocationPlugin;\n"]}
|