@embroider/addon-dev 8.2.0 → 8.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/addon-dev",
3
- "version": "8.2.0",
3
+ "version": "8.3.1",
4
4
  "description": "Utilities for addon authors",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,29 +36,33 @@
36
36
  "execa": "^5.1.1",
37
37
  "fs-extra": "^10.0.0",
38
38
  "minimatch": "^3.0.4",
39
+ "package-up": "^5.0.0",
39
40
  "rollup-plugin-copy-assets": "^2.0.3",
40
41
  "walk-sync": "^3.0.0",
41
42
  "yargs": "^17.0.1",
42
- "@embroider/core": "^4.4.2"
43
+ "@embroider/core": "^4.6.2"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@glimmer/syntax": "^0.94.9",
46
47
  "@glint/core": "^1.5.0",
47
- "@glint/template": "^1.5.0",
48
+ "@glint/ember-tsc": "^1.0.8",
49
+ "@glint/tsserver-plugin": "^2.0.8",
48
50
  "@glint/environment-ember-loose": "^1.5.0",
49
51
  "@glint/environment-ember-template-imports": "^1.5.0",
52
+ "@glint/template": "^1.5.0",
50
53
  "@types/fs-extra": "^9.0.12",
51
54
  "@types/minimatch": "^3.0.4",
52
55
  "@types/yargs": "^17.0.3",
53
56
  "rollup": "^3.23.0",
54
57
  "scenario-tester": "^4.0.0",
55
58
  "typescript": "^5.4.5",
59
+ "vitest": "^4.0.16",
56
60
  "@embroider/test-support": "0.36.0"
57
61
  },
58
62
  "engines": {
59
63
  "node": "12.* || 14.* || >= 16"
60
64
  },
61
65
  "scripts": {
62
- "test": "jest"
66
+ "test": "vitest"
63
67
  }
64
68
  }
package/src/commands.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  export {};
3
+ //# sourceMappingURL=commands.d.ts.map
@@ -1,2 +1,3 @@
1
1
  import type { Plugin } from 'rollup';
2
2
  export default function emberExternals(): Plugin;
3
+ //# sourceMappingURL=rollup-addon-dependencies.d.ts.map
@@ -7,3 +7,4 @@ export default function appReexports(opts: {
7
7
  mapFilename?: (filename: string) => string;
8
8
  exports?: (filename: string) => string[] | string | undefined;
9
9
  }): Plugin;
10
+ //# sourceMappingURL=rollup-app-reexports.d.ts.map
@@ -1,2 +1,10 @@
1
1
  import type { Plugin } from 'rollup';
2
- export default function rollupDeclarationsPlugin(declarationsDir: string, command?: string): Plugin;
2
+ export default function rollupDeclarationsPlugin(declarationsDir: string,
3
+ /**
4
+ * The command to use to generate types.
5
+ * Defaults to:
6
+ * - glint --declaration # for glint v1
7
+ * - ember-tsc --declaration # for glint v2
8
+ */
9
+ command?: string): Plugin;
10
+ //# sourceMappingURL=rollup-declarations.d.ts.map
@@ -8,13 +8,54 @@ const execa_1 = __importDefault(require("execa"));
8
8
  const walk_sync_1 = __importDefault(require("walk-sync"));
9
9
  const promises_1 = require("fs/promises");
10
10
  const fs_1 = require("fs");
11
- function rollupDeclarationsPlugin(declarationsDir, command = 'glint --declaration') {
11
+ const package_up_1 = require("package-up");
12
+ let glint1 = 'glint --declaration';
13
+ let glint2 = 'ember-tsc --declaration';
14
+ function rollupDeclarationsPlugin(declarationsDir,
15
+ /**
16
+ * The command to use to generate types.
17
+ * Defaults to:
18
+ * - glint --declaration # for glint v1
19
+ * - ember-tsc --declaration # for glint v2
20
+ */
21
+ command) {
12
22
  let glintPromise;
23
+ let commandToRun = command;
24
+ async function determineCommand() {
25
+ if (commandToRun)
26
+ return;
27
+ let manifestPath = await (0, package_up_1.packageUp)();
28
+ if (!manifestPath) {
29
+ /**
30
+ * Historical default is to use glint v1
31
+ */
32
+ commandToRun = glint1;
33
+ return;
34
+ }
35
+ let manifestBuffer = (0, fs_1.readFileSync)(manifestPath);
36
+ let manifest = JSON.parse(manifestBuffer.toString());
37
+ let deps = {
38
+ ...manifest.devDependencies,
39
+ ...manifest.dependencies,
40
+ };
41
+ if (deps['@glint/ember-tsc']) {
42
+ commandToRun = glint2;
43
+ return;
44
+ }
45
+ if (deps['@glint/core']) {
46
+ commandToRun = glint1;
47
+ return;
48
+ }
49
+ throw new Error(`Cannot use addon.declarations() plugin without glint present or an explicit command set as the second parameter. e.g.: addon.declarations('declarations', 'tsc --declaration')`);
50
+ }
13
51
  return {
14
52
  name: 'declarations',
15
53
  buildStart() {
16
54
  const runGlint = async () => {
17
- let { exitCode, escapedCommand } = await execa_1.default.command(command, {
55
+ await determineCommand();
56
+ if (!commandToRun)
57
+ return;
58
+ let { exitCode, escapedCommand } = await execa_1.default.command(commandToRun, {
18
59
  // using stdio: inherit is the only way to retain color output from the
19
60
  // underlying tsc process.
20
61
  // However, the viewer of the error will not know which plugin it comes from.
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-declarations.js","sourceRoot":"","sources":["rollup-declarations.ts"],"names":[],"mappings":";;;;;AAMA,2CA6CC;AAlDD,kDAA0B;AAC1B,0DAAiC;AACjC,0CAAkD;AAClD,2BAAgC;AAEhC,SAAwB,wBAAwB,CAC9C,eAAuB,EACvB,OAAO,GAAG,qBAAqB;IAE/B,IAAI,YAA2B,CAAC;IAEhC,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,UAAU;YACR,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;gBAC1B,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,eAAK,CAAC,OAAO,CAAC,OAAO,EAAE;oBAC9D,uEAAuE;oBACvE,0BAA0B;oBAC1B,6EAA6E;oBAC7E,qDAAqD;oBACrD,KAAK,EAAE,SAAS;oBAChB,WAAW,EAAE,IAAI;oBACjB,qDAAqD;oBACrD,MAAM,EAAE,KAAK;iBACd,CAAC,CAAC;gBAEH,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;oBACjB,IAAI,GAAG,GAAG,yCAAyC,cAAc,IAAI,CAAC;oBAEtE,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,C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,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 type { Plugin } from 'rollup';\nimport execa from 'execa';\nimport walkSync from 'walk-sync';\nimport { readFile, writeFile } from 'fs/promises';\nimport { existsSync } from 'fs';\n\nexport default function rollupDeclarationsPlugin(\n declarationsDir: string,\n command = 'glint --declaration'\n): Plugin {\n let glintPromise: Promise<void>;\n\n return {\n name: 'declarations',\n buildStart() {\n const runGlint = async () => {\n let { exitCode, escapedCommand } = await execa.command(command, {\n // using stdio: inherit is the only way to retain color output from the\n // underlying tsc process.\n // However, the viewer of the error will not know which plugin it comes from.\n // So that's why we have the additional logging below\n stdio: 'inherit',\n preferLocal: true,\n // Without reject, execa would throw a hard exception\n reject: false,\n });\n\n if (exitCode > 0) {\n let msg = `Failed to generate declarations via \\`${escapedCommand}\\``;\n\n if (this.meta.watchMode) {\n this.warn(msg);\n } else {\n this.error(msg);\n }\n }\n\n await fixDeclarationsInMatchingFiles(declarationsDir);\n if (exitCode === 0) {\n this.info(`\\`${escapedCommand}\\` succeeded`);\n }\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 // can't fix what doesn't exist\n // (happens when glint errors and doesn't output a ${dir} directory\n if (!existsSync(dir)) {\n return;\n }\n\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
+ {"version":3,"file":"rollup-declarations.js","sourceRoot":"","sources":["rollup-declarations.ts"],"names":[],"mappings":";;;;;AAUA,2CA0FC;AAnGD,kDAA0B;AAC1B,0DAAiC;AACjC,0CAAkD;AAClD,2BAA8C;AAC9C,2CAAuC;AAEvC,IAAI,MAAM,GAAG,qBAAqB,CAAC;AACnC,IAAI,MAAM,GAAG,yBAAyB,CAAC;AAEvC,SAAwB,wBAAwB,CAC9C,eAAuB;AACvB;;;;;GAKG;AACH,OAAgB;IAEhB,IAAI,YAA2B,CAAC;IAEhC,IAAI,YAAY,GAAG,OAAO,CAAC;IAE3B,KAAK,UAAU,gBAAgB;QAC7B,IAAI,YAAY;YAAE,OAAO;QAEzB,IAAI,YAAY,GAAG,MAAM,IAAA,sBAAS,GAAE,CAAC;QACrC,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB;;eAEG;YACH,YAAY,GAAG,MAAM,CAAC;YACtB,OAAO;QACT,CAAC;QAED,IAAI,cAAc,GAAG,IAAA,iBAAY,EAAC,YAAY,CAAC,CAAC;QAChD,IAAI,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrD,IAAI,IAAI,GAAG;YACT,GAAG,QAAQ,CAAC,eAAe;YAC3B,GAAG,QAAQ,CAAC,YAAY;SACzB,CAAC;QAEF,IAAI,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAC7B,YAAY,GAAG,M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CAAC,YAAY;KAChC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,8BAA8B,CAAC,GAAW;IACvD,+BAA+B;IAC/B,mEAAmE;IACnE,IAAI,CAAC,IAAA,eAAU,EAAC,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IAED,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 type { Plugin } from 'rollup';\nimport execa from 'execa';\nimport walkSync from 'walk-sync';\nimport { readFile, writeFile } from 'fs/promises';\nimport { existsSync, readFileSync } from 'fs';\nimport { packageUp } from 'package-up';\n\nlet glint1 = 'glint --declaration';\nlet glint2 = 'ember-tsc --declaration';\n\nexport default function rollupDeclarationsPlugin(\n declarationsDir: string,\n /**\n * The command to use to generate types.\n * Defaults to:\n * - glint --declaration # for glint v1\n * - ember-tsc --declaration # for glint v2\n */\n command?: string\n): Plugin {\n let glintPromise: Promise<void>;\n\n let commandToRun = command;\n\n async function determineCommand() {\n if (commandToRun) return;\n\n let manifestPath = await packageUp();\n if (!manifestPath) {\n /**\n * Historical default is to use glint v1\n */\n commandToRun = glint1;\n return;\n }\n\n let manifestBuffer = readFileSync(manifestPath);\n let manifest = JSON.parse(manifestBuffer.toString());\n let deps = {\n ...manifest.devDependencies,\n ...manifest.dependencies,\n };\n\n if (deps['@glint/ember-tsc']) {\n commandToRun = glint2;\n return;\n }\n if (deps['@glint/core']) {\n commandToRun = glint1;\n return;\n }\n\n throw new Error(\n `Cannot use addon.declarations() plugin without glint present or an explicit command set as the second parameter. e.g.: addon.declarations('declarations', 'tsc --declaration')`\n );\n }\n\n return {\n name: 'declarations',\n buildStart() {\n const runGlint = async () => {\n await determineCommand();\n\n if (!commandToRun) return;\n\n let { exitCode, escapedCommand } = await execa.command(commandToRun, {\n // using stdio: inherit is the only way to retain color output from the\n // underlying tsc process.\n // However, the viewer of the error will not know which plugin it comes from.\n // So that's why we have the additional logging below\n stdio: 'inherit',\n preferLocal: true,\n // Without reject, execa would throw a hard exception\n reject: false,\n });\n\n if (exitCode > 0) {\n let msg = `Failed to generate declarations via \\`${escapedCommand}\\``;\n\n if (this.meta.watchMode) {\n this.warn(msg);\n } else {\n this.error(msg);\n }\n }\n\n await fixDeclarationsInMatchingFiles(declarationsDir);\n if (exitCode === 0) {\n this.info(`\\`${escapedCommand}\\` succeeded`);\n }\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 // can't fix what doesn't exist\n // (happens when glint errors and doesn't output a ${dir} directory\n if (!existsSync(dir)) {\n return;\n }\n\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,2 +1,3 @@
1
1
  import type { Plugin } from 'rollup';
2
2
  export default function rollupGjsPlugin(): Plugin;
3
+ //# sourceMappingURL=rollup-gjs-plugin.d.ts.map
@@ -2,3 +2,4 @@ import type { Plugin } from 'rollup';
2
2
  export default function rollupHbsPlugin({ excludeColocation, }: {
3
3
  excludeColocation?: string[];
4
4
  }): Plugin;
5
+ //# sourceMappingURL=rollup-hbs-plugin.d.ts.map
@@ -1,2 +1,3 @@
1
1
  import type { Plugin } from 'rollup';
2
2
  export default function incremental(): Plugin;
3
+ //# sourceMappingURL=rollup-incremental-plugin.d.ts.map
@@ -4,3 +4,4 @@ export default function keepAssets({ from, include, exports, }: {
4
4
  include: string[];
5
5
  exports?: undefined | 'default' | '*';
6
6
  }): Plugin;
7
+ //# sourceMappingURL=rollup-keep-assets.d.ts.map
@@ -20,3 +20,4 @@ export interface PublicAssetsOptions {
20
20
  * @returns
21
21
  */
22
22
  export default function publicAssets(path: string, opts?: PublicAssetsOptions): Plugin;
23
+ //# sourceMappingURL=rollup-public-assets.d.ts.map
@@ -23,7 +23,7 @@ function publicAssets(path, opts) {
23
23
  buildStart() {
24
24
  this.addWatchFile(path);
25
25
  },
26
- generateBundle() {
26
+ closeBundle() {
27
27
  var _a;
28
28
  let pkg = (0, fs_extra_1.readJsonSync)('package.json');
29
29
  const filenames = (0, walk_sync_1.default)(path, {
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-public-assets.js","sourceRoot":"","sources":["rollup-public-assets.ts"],"names":[],"mappings":";;;;;AA4BA,+BA+CC;AA3ED,uCAAuD;AACvD,0DAAiC;AAEjC,sCAA2C;AAmB3C;;;;;GAKG;AACH,SAAwB,YAAY,CAClC,IAAY,EACZ,IAA0B;IAE1B,MAAM,mBAAmB,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAC;IAC1C,MAAM,oBAAoB,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,KAAI,EAAE,CAAC;IAEjD,OAAO;QACL,IAAI,EAAE,uBAAuB;QAE7B,2EAA2E;QAC3E,+BAA+B;QAC/B,UAAU;YACR,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAED,cAAc;;YACZ,IAAI,GAAG,GAAG,IAAA,uBAAY,EAAC,cAAc,CAAC,CAAC;YACvC,MAAM,SAAS,GAAG,IAAA,mBAAQ,EAAC,IAAI,EAAE;gBAC/B,WAAW,EAAE,KAAK;gBAClB,KAAK,EAAE,mBAAmB;gBAC1B,MAAM,EAAE,oBAAoB;aAC7B,CAAC,CAAC;YACH,MAAM,YAAY,GAA2B,SAAS,CAAC,MAAM,CAC3D,CAAC,GAA2B,EAAE,CAAC,EAA0B,EAAE;;gBACzD,MAAM,SAAS,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,mCAAI,GAAG,CAAC,IAAI,CAAC;gBAE9C,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC,GAAG,IAAA,eAAO,EAAC,GAAG,GAAG,IAAA,YAAI,EAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC1D,OAAO,GAAG,CAAC;YACb,CAAC,EACD,EAAE,CACH,CAAC;YAEF,IAAI,oBAAoB,GAAG,MAAA,GAAG,CAAC,aAAa,CAAC,0CAAG,eAAe,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 generateBundle() {\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"]}
1
+ {"version":3,"file":"rollup-public-assets.js","sourceRoot":"","sources":["rollup-public-assets.ts"],"names":[],"mappings":";;;;;AA4BA,+BA+CC;AA3ED,uCAAuD;AACvD,0DAAiC;AAEjC,sCAA2C;AAmB3C;;;;;GAKG;AACH,SAAwB,YAAY,CAClC,IAAY,EACZ,IAA0B;IAE1B,MAAM,mBAAmB,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAC;IAC1C,MAAM,oBAAoB,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,KAAI,EAAE,CAAC;IAEjD,OAAO;QACL,IAAI,EAAE,uBAAuB;QAE7B,2EAA2E;QAC3E,+BAA+B;QAC/B,UAAU;YACR,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAED,WAAW;;YACT,IAAI,GAAG,GAAG,IAAA,uBAAY,EAAC,cAAc,CAAC,CAAC;YACvC,MAAM,SAAS,GAAG,IAAA,mBAAQ,EAAC,IAAI,EAAE;gBAC/B,WAAW,EAAE,KAAK;gBAClB,KAAK,EAAE,mBAAmB;gBAC1B,MAAM,EAAE,oBAAoB;aAC7B,CAAC,CAAC;YACH,MAAM,YAAY,GAA2B,SAAS,CAAC,MAAM,CAC3D,CAAC,GAA2B,EAAE,CAAC,EAA0B,EAAE;;gBACzD,MAAM,SAAS,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,mCAAI,GAAG,CAAC,IAAI,CAAC;gBAE9C,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC,GAAG,IAAA,eAAO,EAAC,GAAG,GAAG,IAAA,YAAI,EAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC1D,OAAO,GAAG,CAAC;YACb,CAAC,EACD,EAAE,CACH,CAAC;YAEF,IAAI,oBAAoB,GAAG,MAAA,GAAG,CAAC,aAAa,CAAC,0CAAG,eAAe,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"]}
@@ -4,3 +4,4 @@ export default function publicEntrypoints(args: {
4
4
  include: string[];
5
5
  exclude?: string[];
6
6
  }): Plugin;
7
+ //# sourceMappingURL=rollup-public-entrypoints.d.ts.map
package/src/rollup.d.ts CHANGED
@@ -30,3 +30,4 @@ export declare class Addon {
30
30
  publicAssets(path: string, opts?: PublicAssetsOptions): Plugin<any>;
31
31
  declarations(path: string, command?: string): Plugin<any>;
32
32
  }
33
+ //# sourceMappingURL=rollup.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import { templateColocationPlugin, Options as TemplateColocationPluginOptions } from '@embroider/core';
2
2
  export { TemplateColocationPluginOptions as Options };
3
3
  export default templateColocationPlugin;
4
+ //# sourceMappingURL=template-colocation-plugin.d.ts.map