@embroider/addon-dev 4.1.4-unstable.2a6775b → 4.1.4-unstable.2f2d9f8
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 +2 -2
- package/src/rollup-app-reexports.d.ts +1 -0
- package/src/rollup-app-reexports.js +4 -3
- package/src/rollup-app-reexports.js.map +1 -1
- package/src/rollup-public-entrypoints.d.ts +1 -0
- package/src/rollup-public-entrypoints.js +1 -0
- package/src/rollup-public-entrypoints.js.map +1 -1
- package/src/rollup.d.ts +4 -1
- package/src/rollup.js +7 -2
- package/src/rollup.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embroider/addon-dev",
|
|
3
|
-
"version": "4.1.4-unstable.
|
|
3
|
+
"version": "4.1.4-unstable.2f2d9f8",
|
|
4
4
|
"description": "Utilities for addon authors",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test": "jest"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@embroider/core": "3.4.4-unstable.
|
|
29
|
+
"@embroider/core": "3.4.4-unstable.2f2d9f8",
|
|
30
30
|
"@rollup/pluginutils": "^4.1.1",
|
|
31
31
|
"content-tag": "^1.1.2",
|
|
32
32
|
"fs-extra": "^10.0.0",
|
|
@@ -10,7 +10,7 @@ function appReexports(opts) {
|
|
|
10
10
|
return {
|
|
11
11
|
name: 'app-reexports',
|
|
12
12
|
generateBundle(_, bundle) {
|
|
13
|
-
var _a, _b, _c, _d;
|
|
13
|
+
var _a, _b, _c, _d, _e;
|
|
14
14
|
let pkg = (0, fs_extra_1.readJsonSync)('package.json');
|
|
15
15
|
let appJS = {};
|
|
16
16
|
for (let addonFilename of Object.keys(bundle)) {
|
|
@@ -20,7 +20,8 @@ function appReexports(opts) {
|
|
|
20
20
|
? appExports
|
|
21
21
|
: `{ ${appExports.join(', ')} }`;
|
|
22
22
|
if (opts.include.some((glob) => (0, minimatch_1.default)(addonFilename, glob)) &&
|
|
23
|
-
!(0, minimatch_1.default)(addonFilename, '**/*.d.ts')
|
|
23
|
+
!(0, minimatch_1.default)(addonFilename, '**/*.d.ts') &&
|
|
24
|
+
((_d = opts.exclude) === null || _d === void 0 ? void 0 : _d.some((glob) => (0, minimatch_1.default)(addonFilename, glob))) !== true) {
|
|
24
25
|
appJS[`./${appFilename}`] = `./dist/_app_/${appFilename}`;
|
|
25
26
|
this.emitFile({
|
|
26
27
|
type: 'asset',
|
|
@@ -29,7 +30,7 @@ function appReexports(opts) {
|
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
let originalAppJS = (
|
|
33
|
+
let originalAppJS = (_e = pkg['ember-addon']) === null || _e === void 0 ? void 0 : _e['app-js'];
|
|
33
34
|
let hasChanges = JSON.stringify(originalAppJS) !== JSON.stringify(appJS);
|
|
34
35
|
// Don't cause a file i/o event unless something actually changed
|
|
35
36
|
if (hasChanges) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-app-reexports.js","sourceRoot":"","sources":["rollup-app-reexports.ts"],"names":[],"mappings":";;;;;AAAA,uCAAuD;AACvD,+BAA+B;AAC/B,0DAAkC;AAGlC,SAAwB,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"rollup-app-reexports.js","sourceRoot":"","sources":["rollup-app-reexports.ts"],"names":[],"mappings":";;;;;AAAA,uCAAuD;AACvD,+BAA+B;AAC/B,0DAAkC;AAGlC,SAAwB,YAAY,CAAC,IAOpC;IACC,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,cAAc,CAAC,CAAC,EAAE,MAAM;;YACtB,IAAI,GAAG,GAAG,IAAA,uBAAY,EAAC,cAAc,CAAC,CAAC;YACvC,IAAI,KAAK,GAA2B,EAAE,CAAC;YACvC,KAAK,IAAI,aAAa,IAAI,MAAM,CAAC,IAAI,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,SAAS,CAAC,KAAK,CAAC,CAAC;YAEzE,iEAAiE;YACjE,IAAI,UAAU,EAAE;gBACd,GAAG,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,aAAa,CAAC,EAAE;oBACzD,QAAQ,EAAE,KAAK;iBAChB,CAAC,CAAC;gBACH,IAAA,wBAAa,EAAC,cAAc,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;aACnD;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAlDD,+BAkDC","sourcesContent":["import { readJsonSync, writeJsonSync } from 'fs-extra';\nimport { extname } from 'path';\nimport minimatch from 'minimatch';\nimport type { Plugin } from 'rollup';\n\nexport default function appReexports(opts: {\n from: string;\n to: string;\n include: string[];\n exclude?: string[];\n mapFilename?: (filename: string) => string;\n exports?: (filename: string) => string[] | string | undefined;\n}): Plugin {\n return {\n name: 'app-reexports',\n generateBundle(_, bundle) {\n let pkg = readJsonSync('package.json');\n let appJS: Record<string, string> = {};\n for (let addonFilename of Object.keys(bundle)) {\n let appFilename = opts.mapFilename?.(addonFilename) ?? addonFilename;\n let appExports = opts.exports?.(addonFilename) || ['default'];\n\n let computedExports =\n typeof appExports === 'string'\n ? appExports\n : `{ ${appExports.join(', ')} }`;\n\n if (\n opts.include.some((glob) => minimatch(addonFilename, glob)) &&\n !minimatch(addonFilename, '**/*.d.ts') &&\n opts.exclude?.some((glob) => minimatch(addonFilename, glob)) !== true\n ) {\n appJS[`./${appFilename}`] = `./dist/_app_/${appFilename}`;\n this.emitFile({\n type: 'asset',\n fileName: `_app_/${appFilename}`,\n source: `export ${computedExports} from \"${\n pkg.name\n }/${addonFilename.slice(0, -extname(addonFilename).length)}\";\\n`,\n });\n }\n }\n let originalAppJS = pkg['ember-addon']?.['app-js'];\n\n let hasChanges = JSON.stringify(originalAppJS) !== JSON.stringify(appJS);\n\n // Don't cause a file i/o event unless something actually changed\n if (hasChanges) {\n pkg['ember-addon'] = Object.assign({}, pkg['ember-addon'], {\n 'app-js': appJS,\n });\n writeJsonSync('package.json', pkg, { spaces: 2 });\n }\n },\n };\n}\n"]}
|
|
@@ -16,6 +16,7 @@ function publicEntrypoints(args) {
|
|
|
16
16
|
this.addWatchFile(args.srcDir);
|
|
17
17
|
let matches = (0, walk_sync_1.default)(args.srcDir, {
|
|
18
18
|
globs: [...args.include, '**/*.hbs', '**/*.ts', '**/*.gts', '**/*.gjs'],
|
|
19
|
+
ignore: args.exclude,
|
|
19
20
|
});
|
|
20
21
|
for (let name of matches) {
|
|
21
22
|
// the matched file, but with the extension swapped with .js
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-public-entrypoints.js","sourceRoot":"","sources":["rollup-public-entrypoints.ts"],"names":[],"mappings":";;;;;AAAA,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,
|
|
1
|
+
{"version":3,"file":"rollup-public-entrypoints.js","sourceRoot":"","sources":["rollup-public-entrypoints.ts"],"names":[],"mappings":";;;;;AAAA,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,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,KAAK,CAAC,UAAU;YACd,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAE/B,IAAI,OAAO,GAAG,IAAA,mBAAQ,EAAC,IAAI,CAAC,MAAM,EAAE;gBAClC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,U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AAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;wBAChC,QAAQ,EAAE,cAAc;qBACzB,CAAC,CAAC;oBAEH,SAAS;iBACV;aACF;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAlED,oCAkEC;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 return {\n name: 'addon-modules',\n async buildStart() {\n this.addWatchFile(args.srcDir);\n\n let matches = walkSync(args.srcDir, {\n globs: [...args.include, '**/*.hbs', '**/*.ts', '**/*.gts', '**/*.gjs'],\n ignore: args.exclude,\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 = args.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
CHANGED
|
@@ -9,8 +9,11 @@ export declare class Addon {
|
|
|
9
9
|
appReexports(patterns: string[], opts?: {
|
|
10
10
|
mapFilename?: (fileName: string) => string;
|
|
11
11
|
exports?: (filename: string) => string[] | string | undefined;
|
|
12
|
+
exclude?: string[];
|
|
12
13
|
}): Plugin;
|
|
13
|
-
publicEntrypoints(patterns: string[]
|
|
14
|
+
publicEntrypoints(patterns: string[], opts?: {
|
|
15
|
+
exclude?: string[];
|
|
16
|
+
}): Plugin<any>;
|
|
14
17
|
hbs(): Plugin<any>;
|
|
15
18
|
gjs(): Plugin<any>;
|
|
16
19
|
clean(options: DelOptions): Plugin<any>;
|
package/src/rollup.js
CHANGED
|
@@ -42,13 +42,18 @@ class Addon {
|
|
|
42
42
|
include: patterns,
|
|
43
43
|
mapFilename: opts.mapFilename,
|
|
44
44
|
exports: opts.exports,
|
|
45
|
+
exclude: opts.exclude,
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
// This configures rollup to emit public entrypoints for each module in your
|
|
48
49
|
// srcDir that matches one of the given globs. Typical addons will want to
|
|
49
50
|
// match patterns like "components/**/*.js", "index.js", and "test-support.js".
|
|
50
|
-
publicEntrypoints(patterns) {
|
|
51
|
-
return (0, rollup_public_entrypoints_1.default)({
|
|
51
|
+
publicEntrypoints(patterns, opts = {}) {
|
|
52
|
+
return (0, rollup_public_entrypoints_1.default)({
|
|
53
|
+
srcDir: __classPrivateFieldGet(this, _Addon_srcDir, "f"),
|
|
54
|
+
include: patterns,
|
|
55
|
+
exclude: opts.exclude,
|
|
56
|
+
});
|
|
52
57
|
}
|
|
53
58
|
// This wraps standalone .hbs files as Javascript files using inline
|
|
54
59
|
// templates. This means special resolving rules for .hbs files aren't
|
package/src/rollup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,4EAAqD;AACrD,4EAAqD;AACrD,4FAA2E;AAC3E,kFAAiE;AAEjE,gFAAwD;AACxD,8EAA6D;AAC7D,4FAAsE;AACtE,kFAAiE;AAGjE,MAAa,KAAK;IAIhB,YAAY,SAAgD,EAAE;;QAH9D,gCAAgB;QAChB,iCAAiB;QAGf,uBAAA,IAAI,iBAAW,MAAA,MAAM,CAAC,MAAM,mCAAI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CAAC;IACL,CAAC;IAED,oEAAoE;IACpE,sEAAsE;IACtE,8DAA8D;IAC9D,GAAG;QACD,OAAO,IAAA,2BAAG,GAAE,CAAC;IACf,CAAC;IAED,GAAG;QACD,OAAO,IAAA,2BAAG,GAAE,CAAC;IACf,CAAC;IAED,6EAA6E;IAC7E,aAAa;IACb,KAAK,CAAC,OAAmB;QACvB,OAAO,IAAA,8BAAK,EAAC,EAAE,OAAO,EAAE,GAAG,uBAAA,IAAI,sBAAS,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,4EAA4E;IAC5E,6EAA6E;IAC7E,6EAA6E;IAC7E,UAAU;IACV,UAAU,CAAC,QAAkB;QAC3B,OAAO,IAAA,4BAAU,EAAC;YAChB,IAAI,EAAE,uBAAA,IAAI,qBAAQ;YAClB,OAAO,EAAE,QAAQ;SAClB,CAAC,CAAC;IACL,CAAC;IAED,8EAA8E;IAC9E,2EAA2E;IAC3E,4EAA4E;IAC5E,UAAU;IACV,EAAE;IACF,wFAAwF;IACxF,qDAAqD;IACrD,qFAAqF;IACrF,sBAAsB;IACtB,MAAM;QACJ,OAAO;YACL,GAAG,EAAE,uBAAA,IAAI,sBAAS;YAClB,cAAc,EAAE,QAAQ;YACxB,wBAAwB,EAAE,CAAC;YAC3B,MAAM,EAAE,IAAI;YACZ,sBAAsB,EAAE,KAAK;YAC7B,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;IAED,YAAY;QACV,OAAO,IAAA,mCAAY,GAAE,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,IAAY,EAAE,IAA8C;QACvE,OAAO,IAAA,8BAAY,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AAhGD,sBAgGC","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 type { Options as DelOptions } from 'rollup-plugin-delete';\nimport { default as clean } from 'rollup-plugin-delete';\nimport { default as keepAssets } from './rollup-keep-assets';\nimport { default as dependencies } from './rollup-addon-dependencies';\nimport { default as publicAssets } from './rollup-public-assets';\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() {\n return hbs();\n }\n\n gjs() {\n return gjs();\n }\n\n // By default rollup does not clear the output directory between builds. This\n // does that.\n clean(options: DelOptions) {\n return clean({ targets: `${this.#destDir}/*`, ...options });\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[]) {\n return keepAssets({\n from: this.#srcDir,\n include: patterns,\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: { include: string[]; exclude: string[] }) {\n return publicAssets(path, opts);\n }\n}\n"]}
|