@embroider/addon-dev 7.0.1-unstable.e6197c7 → 7.1.1

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 CHANGED
@@ -22,26 +22,6 @@ For a guide on porting a V1 addon to V2, see https://github.com/embroider-build/
22
22
 
23
23
  A rollup plugin to expose a folder of assets. `path` is a required to define which folder to expose. `options.include` is a glob pattern passed to `walkSync.include` to pick files. `options.exlude` is a glob pattern passed to `walkSync.ignore` to exclude files. `options.namespace` is the namespace to expose files, defaults to the package name + the path that you provided e.g. if you call `addon.publicAssets('public')` in a v2 addon named `super-addon` then your namespace will default to `super-addon/public`.
24
24
 
25
- ### addon.keepAssets(patterns: string[], exports?: 'default' | '*')
26
-
27
- A rollup plugin to preserve imports of non-Javascript assets unchanged in your published package. For example, the v2-addon-blueprint uses:
28
-
29
- ```js
30
- addon.keepAssets(['**/*.css'])
31
- ```
32
-
33
- so that the line `import "./my.css"` in your addon will be preserved and the corresponding CSS file will get included at the right path.
34
-
35
- `keepAssets` is intended to compose correctly with other plugins that synthesize CSS imports, like `glimmer-scoped-css`. It will capture their output and produce real CSS files in your published package.
36
-
37
- The `exports` option defaults to `undefined` which means the assets are used for side-effect only and don't export any values. This is the supported way to use CSS in v2 addons. But you can also preserve assets that present themselves as having default exports with the value `"default"` or arbitrary named exports with the value `"*"`. For example:
38
-
39
- ```js
40
- addon.keepAssets(["**/*.png"], "default")
41
- ```
42
-
43
- lets you say `import imageURL from './my-image.png'`. Not that this pattern is **not** automatically supported in V2 addons and you would need to tell apps that consume your addon to handle it in a custom way.
44
-
45
25
  ## addon-dev command
46
26
 
47
27
  The `addon-dev` command helps with common tasks in v2 addons.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/addon-dev",
3
- "version": "7.0.1-unstable.e6197c7",
3
+ "version": "7.1.1",
4
4
  "description": "Utilities for addon authors",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,22 +31,27 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "@rollup/pluginutils": "^5.1.0",
34
+ "@rollup/pluginutils": "^4.1.1",
35
35
  "content-tag": "^3.0.0",
36
+ "execa": "^5.1.1",
36
37
  "fs-extra": "^10.0.0",
37
38
  "minimatch": "^3.0.4",
38
39
  "rollup-plugin-copy-assets": "^2.0.3",
39
40
  "walk-sync": "^3.0.0",
40
41
  "yargs": "^17.0.1",
41
- "@embroider/core": "^3.4.20-unstable.e6197c7"
42
+ "@embroider/core": "^3.4.20"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@glimmer/syntax": "^0.84.2",
46
+ "@glint/core": "^1.5.0",
47
+ "@glint/template": "^1.5.0",
48
+ "@glint/environment-ember-loose": "^1.5.0",
49
+ "@glint/environment-ember-template-imports": "^1.5.0",
45
50
  "@types/fs-extra": "^9.0.12",
46
51
  "@types/minimatch": "^3.0.4",
47
52
  "@types/yargs": "^17.0.3",
48
53
  "rollup": "^3.23.0",
49
- "tmp": "^0.1.0",
54
+ "scenario-tester": "^4.0.0",
50
55
  "typescript": "^5.4.5",
51
56
  "@embroider/test-support": "0.36.0"
52
57
  },
@@ -0,0 +1,5 @@
1
+ export default function rollupDeclarationsPlugin(declarationsDir: string): {
2
+ name: string;
3
+ buildStart: () => void;
4
+ writeBundle: () => Promise<void>;
5
+ };
@@ -0,0 +1,50 @@
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 = rollupDeclarationsPlugin;
7
+ const execa_1 = __importDefault(require("execa"));
8
+ const walk_sync_1 = __importDefault(require("walk-sync"));
9
+ const promises_1 = require("fs/promises");
10
+ function rollupDeclarationsPlugin(declarationsDir) {
11
+ let glintPromise;
12
+ return {
13
+ name: 'glint-dts',
14
+ buildStart: () => {
15
+ const runGlint = async () => {
16
+ await (0, execa_1.default)('glint', ['--declaration'], {
17
+ stdio: 'inherit',
18
+ preferLocal: true,
19
+ });
20
+ await fixDeclarationsInMatchingFiles(declarationsDir);
21
+ };
22
+ // We just kick off glint here early in the rollup process, without making rollup wait for this to finish, by not returning the promise
23
+ // The output of this is not relevant to further stages of the rollup build, this is just happening in parallel to other rollup compilation
24
+ glintPromise = runGlint();
25
+ },
26
+ // Make rollup wait for glint to have finished before calling the build job done
27
+ writeBundle: () => glintPromise,
28
+ };
29
+ }
30
+ async function fixDeclarationsInMatchingFiles(dir) {
31
+ const dtsFiles = (0, walk_sync_1.default)(dir, {
32
+ globs: ['**/*.d.ts'],
33
+ directories: false,
34
+ includeBasePath: true,
35
+ });
36
+ return Promise.all(dtsFiles.map(async (file) => {
37
+ const content = await (0, promises_1.readFile)(file, { encoding: 'utf8' });
38
+ await (0, promises_1.writeFile)(file, fixDeclarations(content));
39
+ }));
40
+ }
41
+ // Strip any .gts extension from imports in d.ts files, as these won't resolve. See https://github.com/typed-ember/glint/issues/628
42
+ // Once Glint v2 is available, this shouldn't be needed anymore.
43
+ function fixDeclarations(content) {
44
+ return content
45
+ .replace(/from\s+'([^']+)\.gts'/g, `from '$1'`)
46
+ .replace(/from\s+"([^"]+)\.gts"/g, `from '$1'`)
47
+ .replace(/import\("([^"]+)\.gts"\)/g, `import('$1')`)
48
+ .replace(/import\('([^']+)\.gts'\)/g, `import('$1')`);
49
+ }
50
+ //# sourceMappingURL=rollup-declarations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup-declarations.js","sourceRoot":"","sources":["rollup-declarations.ts"],"names":[],"mappings":";;;;;AAIA,2CAuBC;AA3BD,kDAA0B;AAC1B,0DAAiC;AACjC,0CAAkD;AAElD,SAAwB,wBAAwB,CAAC,eAAuB;IACtE,IAAI,YAA2B,CAAC;IAEhC,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,UAAU,EAAE,GAAG,EAAE;YACf,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;gBAC1B,MAAM,IAAA,eAAK,EAAC,OAAO,EAAE,CAAC,eAAe,CAAC,EAAE;oBACtC,KAAK,EAAE,SAAS;oBAChB,WAAW,EAAE,IAAI;iBAClB,CAAC,CAAC;gBAEH,MAAM,8BAA8B,CAAC,eAAe,CAAC,CAAC;YACxD,CAAC,CAAC;YAEF,uIAAuI;YACvI,2IAA2I;YAC3I,YAAY,GAAG,QAAQ,EAAE,CAAC;QAC5B,CAAC;QAED,gFAAgF;QAChF,WAAW,EAAE,GAAG,EAAE,CAAC,YAAY;KAChC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,8BAA8B,CAAC,GAAW;IACvD,MAAM,QAAQ,GAAG,IAAA,mBAAQ,EAAC,GAAG,EAAE;QAC7B,KAAK,EAAE,CAAC,WAAW,CAAC;QACpB,WAAW,EAAE,KAAK;QAClB,eAAe,EAAE,IAAI;KACtB,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,GAAG,CAChB,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC1B,MAAM,OAAO,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAE3D,MAAM,IAAA,oBAAS,EAAC,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,mIAAmI;AACnI,gEAAgE;AAChE,SAAS,eAAe,CAAC,OAAe;IACtC,OAAO,OAAO;SACX,OAAO,CAAC,wBAAwB,EAAE,WAAW,CAAC;SAC9C,OAAO,CAAC,wBAAwB,EAAE,WAAW,CAAC;SAC9C,OAAO,CAAC,2BAA2B,EAAE,cAAc,CAAC;SACpD,OAAO,CAAC,2BAA2B,EAAE,cAAc,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import execa from 'execa';\nimport walkSync from 'walk-sync';\nimport { readFile, writeFile } from 'fs/promises';\n\nexport default function rollupDeclarationsPlugin(declarationsDir: string) {\n let glintPromise: Promise<void>;\n\n return {\n name: 'glint-dts',\n buildStart: () => {\n const runGlint = async () => {\n await execa('glint', ['--declaration'], {\n stdio: 'inherit',\n preferLocal: true,\n });\n\n await fixDeclarationsInMatchingFiles(declarationsDir);\n };\n\n // We just kick off glint here early in the rollup process, without making rollup wait for this to finish, by not returning the promise\n // The output of this is not relevant to further stages of the rollup build, this is just happening in parallel to other rollup compilation\n glintPromise = runGlint();\n },\n\n // Make rollup wait for glint to have finished before calling the build job done\n writeBundle: () => glintPromise,\n };\n}\n\nasync function fixDeclarationsInMatchingFiles(dir: string) {\n const dtsFiles = walkSync(dir, {\n globs: ['**/*.d.ts'],\n directories: false,\n includeBasePath: true,\n });\n\n return Promise.all(\n dtsFiles.map(async (file) => {\n const content = await readFile(file, { encoding: 'utf8' });\n\n await writeFile(file, fixDeclarations(content));\n })\n );\n}\n\n// Strip any .gts extension from imports in d.ts files, as these won't resolve. See https://github.com/typed-ember/glint/issues/628\n// Once Glint v2 is available, this shouldn't be needed anymore.\nfunction fixDeclarations(content: string) {\n return content\n .replace(/from\\s+'([^']+)\\.gts'/g, `from '$1'`)\n .replace(/from\\s+\"([^\"]+)\\.gts\"/g, `from '$1'`)\n .replace(/import\\(\"([^\"]+)\\.gts\"\\)/g, `import('$1')`)\n .replace(/import\\('([^']+)\\.gts'\\)/g, `import('$1')`);\n}\n"]}
@@ -1,6 +1,5 @@
1
1
  import type { Plugin } from 'rollup';
2
- export default function keepAssets({ from, include, exports, }: {
2
+ export default function keepAssets({ from, include, }: {
3
3
  from: string;
4
4
  include: string[];
5
- exports?: undefined | 'default' | '*';
6
5
  }): Plugin;
@@ -4,77 +4,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = keepAssets;
7
- const minimatch_1 = __importDefault(require("minimatch"));
7
+ const walk_sync_1 = __importDefault(require("walk-sync"));
8
+ const fs_1 = require("fs");
8
9
  const path_1 = require("path");
9
- // randomly chosen, we're just looking to have high-entropy identifiers that
10
- // won't collide with anyting else in the source
11
- let counter = 11559;
12
- function keepAssets({ from, include, exports, }) {
13
- const marker = `__copy_asset_marker_${counter++}__`;
10
+ const minimatch_1 = __importDefault(require("minimatch"));
11
+ function keepAssets({ from, include, }) {
14
12
  return {
15
13
  name: 'copy-assets',
16
- transform(code, id) {
17
- if (include.some((pattern) => (0, minimatch_1.default)(id, pattern))) {
18
- let ref = this.emitFile({
14
+ // imports of assets should be left alone in the source code. This can cover
15
+ // the case of .css as defined in the embroider v2 addon spec.
16
+ async resolveId(source, importer, options) {
17
+ const resolution = await this.resolve(source, importer, {
18
+ skipSelf: true,
19
+ ...options,
20
+ });
21
+ if (resolution &&
22
+ importer &&
23
+ include.some((pattern) => (0, minimatch_1.default)(resolution.id, pattern))) {
24
+ return { id: (0, path_1.resolve)((0, path_1.dirname)(importer), source), external: 'relative' };
25
+ }
26
+ return resolution;
27
+ },
28
+ // the assets go into the output directory in the same relative locations as
29
+ // in the input directory
30
+ async generateBundle() {
31
+ for (let name of (0, walk_sync_1.default)(from, {
32
+ globs: include,
33
+ directories: false,
34
+ })) {
35
+ this.addWatchFile((0, path_1.join)(from, name));
36
+ this.emitFile({
19
37
  type: 'asset',
20
- fileName: (0, path_1.relative)(from, id),
21
- source: code,
38
+ fileName: name,
39
+ source: (0, fs_1.readFileSync)((0, path_1.join)(from, name)),
22
40
  });
23
- if (exports === '*') {
24
- return `export * from ${marker}("${ref}")`;
25
- }
26
- else if (exports === 'default') {
27
- return `export default ${marker}("${ref}")`;
28
- }
29
- else {
30
- // side-effect only
31
- return `${marker}("${ref}")`;
32
- }
33
41
  }
34
42
  },
35
- renderChunk(code, chunk) {
36
- const { getName, imports } = nameTracker(code, exports);
37
- code = code.replace(new RegExp(`${marker}\\("([^"]+)"\\)`, 'g'), (_x, ref) => {
38
- var _a;
39
- let assetFileName = this.getFileName(ref);
40
- let relativeName = './' + (0, path_1.relative)((0, path_1.dirname)(chunk.fileName), assetFileName);
41
- return (_a = getName(relativeName)) !== null && _a !== void 0 ? _a : '';
42
- });
43
- return imports() + code;
44
- },
45
43
  };
46
44
  }
47
- function nameTracker(code, exports) {
48
- let counter = 0;
49
- let assets = new Map();
50
- function getName(assetName) {
51
- if (assets.has(assetName)) {
52
- return assets.get(assetName);
53
- }
54
- if (!exports) {
55
- assets.set(assetName, undefined);
56
- return undefined;
57
- }
58
- while (true) {
59
- let candidate = `_asset_${counter++}_`;
60
- if (!code.includes(candidate)) {
61
- assets.set(assetName, candidate);
62
- return candidate;
63
- }
64
- }
65
- }
66
- function imports() {
67
- return ([...assets]
68
- .map(([assetName, importedName]) => {
69
- if (importedName) {
70
- return `import ${importedName} from "${assetName}"`;
71
- }
72
- else {
73
- return `import "${assetName}"`;
74
- }
75
- })
76
- .join('\n') + '\n');
77
- }
78
- return { getName, imports };
79
- }
80
45
  //# sourceMappingURL=rollup-keep-assets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-keep-assets.js","sourceRoot":"","sources":["rollup-keep-assets.ts"],"names":[],"mappings":";;;;;AAQA,6BA8CC;AArDD,0DAAkC;AAClC,+BAAyC;AAEzC,4EAA4E;AAC5E,gDAAgD;AAChD,IAAI,OAAO,GAAG,KAAK,CAAC;AAEpB,SAAwB,UAAU,CAAC,EACjC,IAAI,EACJ,OAAO,EACP,OAAO,GAKR;IACC,MAAM,MAAM,GAAG,uBAAuB,OAAO,EAAE,IAAI,CAAC;IAEpD,OAAO;QACL,IAAI,EAAE,aAAa;QAEnB,SAAS,CAAC,IAAY,EAAE,EAAU;YAChC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,mBAAS,EAAC,EAAE,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;gBACtD,IAAI,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC;oBACtB,IAAI,EAAE,OAAO;oBACb,QAAQ,EAAE,I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AC,SAAS,CAAC,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC;QAChC,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,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';\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 = `__copy_asset_marker_${counter++}__`;\n\n return {\n name: 'copy-assets',\n\n transform(code: string, id: string) {\n if (include.some((pattern) => minimatch(id, pattern))) {\n let ref = this.emitFile({\n type: 'asset',\n fileName: relative(from, id),\n source: code,\n });\n if (exports === '*') {\n return `export * from ${marker}(\"${ref}\")`;\n } else if (exports === 'default') {\n return `export default ${marker}(\"${ref}\")`;\n } else {\n // side-effect only\n return `${marker}(\"${ref}\")`;\n }\n }\n },\n renderChunk(code, chunk) {\n const { getName, imports } = nameTracker(code, exports);\n\n code = code.replace(\n new RegExp(`${marker}\\\\(\"([^\"]+)\"\\\\)`, 'g'),\n (_x, ref) => {\n let assetFileName = this.getFileName(ref);\n let relativeName =\n './' + relative(dirname(chunk.fileName), assetFileName);\n return getName(relativeName) ?? '';\n }\n );\n return imports() + code;\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"]}
1
+ {"version":3,"file":"rollup-keep-assets.js","sourceRoot":"","sources":["rollup-keep-assets.ts"],"names":[],"mappings":";;;;;AAMA,6BA4CC;AAlDD,0DAAiC;AAEjC,2BAAkC;AAClC,+BAA8C;AAC9C,0DAAkC;AAElC,SAAwB,UAAU,CAAC,EACjC,IAAI,EACJ,OAAO,GAIR;IACC,OAAO;QACL,IAAI,EAAE,aAAa;QAEnB,4EAA4E;QAC5E,8DAA8D;QAC9D,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO;YACvC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE;gBACtD,QAAQ,EAAE,IAAI;gBACd,GAAG,OAAO;aACX,CAAC,CAAC;YACH,IACE,UAAU;gBACV,QAAQ;gBACR,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,mBAAS,EAAC,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,EAC5D,CAAC;gBACD,OAAO,EAAE,EAAE,EAAE,IAAA,cAAO,EAAC,IAAA,cAAO,EAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;YAC1E,CAAC;YACD,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,4EAA4E;QAC5E,yBAAyB;QACzB,KAAK,CAAC,cAAc;YAClB,KAAK,IAAI,IAAI,IAAI,IAAA,mBAAQ,EAAC,IAAI,EAAE;gBAC9B,KAAK,EAAE,OAAO;gBACd,WAAW,EAAE,KAAK;aACnB,CAAC,EAAE,CAAC;gBACH,IAAI,CAAC,YAAY,CAAC,IAAA,WAAI,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;gBAEpC,IAAI,CAAC,QAAQ,CAAC;oBACZ,IAAI,EAAE,OAAO;oBACb,QAAQ,EAAE,IAAI;oBACd,MAAM,EAAE,IAAA,iBAAY,EAAC,IAAA,WAAI,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;iBACvC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import walkSync from 'walk-sync';\nimport type { Plugin } from 'rollup';\nimport { readFileSync } from 'fs';\nimport { dirname, join, resolve } from 'path';\nimport minimatch from 'minimatch';\n\nexport default function keepAssets({\n from,\n include,\n}: {\n from: string;\n include: string[];\n}): Plugin {\n return {\n name: 'copy-assets',\n\n // imports of assets should be left alone in the source code. This can cover\n // the case of .css as defined in the embroider v2 addon spec.\n async resolveId(source, importer, options) {\n const resolution = await this.resolve(source, importer, {\n skipSelf: true,\n ...options,\n });\n if (\n resolution &&\n importer &&\n include.some((pattern) => minimatch(resolution.id, pattern))\n ) {\n return { id: resolve(dirname(importer), source), external: 'relative' };\n }\n return resolution;\n },\n\n // the assets go into the output directory in the same relative locations as\n // in the input directory\n async generateBundle() {\n for (let name of walkSync(from, {\n globs: include,\n directories: false,\n })) {\n this.addWatchFile(join(from, name));\n\n this.emitFile({\n type: 'asset',\n fileName: name,\n source: readFileSync(join(from, name)),\n });\n }\n },\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-public-entrypoints.js","sourceRoot":"","sources":["rollup-public-entrypoints.ts"],"names":[],"mappings":";;;;;AAUA,oCAkEC;AA5ED,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;QAErB,KAAK,CAAC,UAAU;YACd,IAAI,OAAO,GAAG,IAAA,mBAAQ,EAAC,IAAI,CAAC,MAAM,EAAE;gBAClC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC;gBACvE,MAAM,EAAE,IAAI,CAAC,OAAO;aACrB,CAAC,CAAC;YAEH,KAAK,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;gBACzB,IAAI,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;gBAChD,4DAA4D;gBAC5D,IAAI,cAAc,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBAE5C,6EAA6E;gBAC7E,6EAA6E;gBAC7E,IAAI,IAAI,GAAG,cAAc,CAAC,OAAO,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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\n async buildStart() {\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 this.addWatchFile(path.join(args.srcDir, name));\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"]}
1
+ {"version":3,"file":"rollup-public-entrypoints.js","sourceRoot":"","sources":["rollup-public-entrypoints.ts"],"names":[],"mappings":";;;;;AAUA,oCAkEC;AA5ED,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,OAAO,GAAG,IAAA,mBAAQ,EAAC,IAAI,CAAC,MAAM,EAAE;gBAClC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,U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,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 return {\n name: 'addon-modules',\n async buildStart() {\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 this.addWatchFile(path.join(args.srcDir, name));\n\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
@@ -17,7 +17,7 @@ export declare class Addon {
17
17
  hbs(options?: {}): Plugin<any>;
18
18
  gjs(): Plugin<any>;
19
19
  clean(): Plugin<any>;
20
- keepAssets(patterns: string[], exports?: undefined | 'default' | '*'): Plugin<any>;
20
+ keepAssets(patterns: string[]): Plugin<any>;
21
21
  output(): {
22
22
  dir: string;
23
23
  entryFileNames: string;
@@ -28,4 +28,9 @@ export declare class Addon {
28
28
  };
29
29
  dependencies(): Plugin<any>;
30
30
  publicAssets(path: string, opts?: PublicAssetsOptions): Plugin<any>;
31
+ declarations(path: string): {
32
+ name: string;
33
+ buildStart: () => void;
34
+ writeBundle: () => Promise<void>;
35
+ };
31
36
  }
package/src/rollup.js CHANGED
@@ -21,6 +21,7 @@ const rollup_gjs_plugin_1 = __importDefault(require("./rollup-gjs-plugin"));
21
21
  const rollup_public_entrypoints_1 = __importDefault(require("./rollup-public-entrypoints"));
22
22
  const rollup_app_reexports_1 = __importDefault(require("./rollup-app-reexports"));
23
23
  const rollup_keep_assets_1 = __importDefault(require("./rollup-keep-assets"));
24
+ const rollup_declarations_1 = __importDefault(require("./rollup-declarations"));
24
25
  const rollup_addon_dependencies_1 = __importDefault(require("./rollup-addon-dependencies"));
25
26
  const rollup_public_assets_1 = __importDefault(require("./rollup-public-assets"));
26
27
  const rollup_incremental_plugin_1 = __importDefault(require("./rollup-incremental-plugin"));
@@ -74,11 +75,10 @@ class Addon {
74
75
  // to leave those imports alone and to make sure the corresponding .css files
75
76
  // are kept in the same relative locations in the destDir as they were in the
76
77
  // srcDir.
77
- keepAssets(patterns, exports) {
78
+ keepAssets(patterns) {
78
79
  return (0, rollup_keep_assets_1.default)({
79
80
  from: __classPrivateFieldGet(this, _Addon_srcDir, "f"),
80
81
  include: patterns,
81
- exports: exports,
82
82
  });
83
83
  }
84
84
  // This is the default `output` configuration you should pass to rollup. We're
@@ -106,6 +106,9 @@ class Addon {
106
106
  publicAssets(path, opts) {
107
107
  return (0, rollup_public_assets_1.default)(path, opts);
108
108
  }
109
+ declarations(path) {
110
+ return (0, rollup_declarations_1.default)(path);
111
+ }
109
112
  }
110
113
  exports.Addon = Addon;
111
114
  _Addon_srcDir = new WeakMap(), _Addon_destDir = new WeakMap();
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;AACjE,8EAA6D;AAC7D,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;YACvB,MAAM,EAAE,uBAAA,IAAI,qBAAQ;YACpB,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;IAED,oEAAoE;IACpE,sEAAsE;IACtE,8DAA8D;IAC9D,GAAG,CAAC,OAAO,GAAG,EAAE;QACd,OAAO,IAAA,2BAAG,EAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAED,GAAG;QACD,OAAO,IAAA,2BAAG,GAAE,CAAC;IACf,CAAC;IAED,mHAAmH;IACnH,2DAA2D;IAC3D,oCAAoC;IACpC,KAAK;QACH,OAAO,IAAA,mCAAK,GAAE,CAAC;IACjB,CAAC;IAED,4EAA4E;IAC5E,6EAA6E;IAC7E,6EAA6E;IAC7E,UAAU;IACV,UAAU,CAAC,QAAkB,EAAE,OAAqC;QAClE,OAAO,IAAA,4BAAU,EAAC;YAChB,IAAI,EAAE,uBAAA,IAAI,qBAAQ;YAClB,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,OAAO;SACjB,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,IAA0B;QACnD,OAAO,IAAA,8BAAY,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AAlGD,sBAkGC","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 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"]}
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;YACvB,MAAM,EAAE,uBAAA,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ent":["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[]) {\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?: PublicAssetsOptions) {\n return publicAssets(path, opts);\n }\n\n declarations(path: string) {\n return declarations(path);\n }\n}\n"]}