@embroider/addon-dev 4.1.3-unstable.efd9117 → 4.1.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Edward Faulkner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/addon-dev",
3
- "version": "4.1.3-unstable.efd9117",
3
+ "version": "4.1.3",
4
4
  "description": "Utilities for addon authors",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,11 +22,7 @@
22
22
  "src/**/*.d.ts",
23
23
  "src/**/*.js.map"
24
24
  ],
25
- "scripts": {
26
- "test": "jest"
27
- },
28
25
  "dependencies": {
29
- "@embroider/core": "3.4.3-unstable.efd9117",
30
26
  "@rollup/pluginutils": "^4.1.1",
31
27
  "content-tag": "^1.1.2",
32
28
  "fs-extra": "^10.0.0",
@@ -34,19 +30,23 @@
34
30
  "rollup-plugin-copy-assets": "^2.0.3",
35
31
  "rollup-plugin-delete": "^2.0.0",
36
32
  "walk-sync": "^3.0.0",
37
- "yargs": "^17.0.1"
33
+ "yargs": "^17.0.1",
34
+ "@embroider/core": "^3.4.3"
38
35
  },
39
36
  "devDependencies": {
40
- "@embroider/test-support": "workspace:*",
41
37
  "@glimmer/syntax": "^0.84.2",
42
38
  "@types/fs-extra": "^9.0.12",
43
39
  "@types/minimatch": "^3.0.4",
44
40
  "@types/yargs": "^17.0.3",
45
41
  "rollup": "^3.23.0",
46
42
  "tmp": "^0.1.0",
47
- "typescript": "^5.1.6"
43
+ "typescript": "^5.1.6",
44
+ "@embroider/test-support": "0.36.0"
48
45
  },
49
46
  "engines": {
50
47
  "node": "12.* || 14.* || >= 16"
48
+ },
49
+ "scripts": {
50
+ "test": "jest"
51
51
  }
52
- }
52
+ }
@@ -19,9 +19,13 @@ function resolvableDependencies() {
19
19
  return deps;
20
20
  }
21
21
  function emberExternals() {
22
- let deps = resolvableDependencies();
22
+ let deps;
23
23
  return {
24
24
  name: 'ember-externals',
25
+ buildStart() {
26
+ this.addWatchFile('package.json');
27
+ deps = resolvableDependencies();
28
+ },
25
29
  async resolveId(source) {
26
30
  let pkgName = (0, core_1.packageName)(source);
27
31
  if (!pkgName) {
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-addon-dependencies.js","sourceRoot":"","sources":["rollup-addon-dependencies.ts"],"names":[],"mappings":";;AACA,uCAAwC;AACxC,0CAKyB;AAEzB,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAChC,iCAA0B,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAChD,CAAC;AAEF,SAAS,sBAAsB;IAC7B,IAAI,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;IACrB,IAAI,GAAG,GAAG,IAAA,uBAAY,EAAC,cAAc,CAAC,CAAC;IACvC,IAAI,GAAG,CAAC,YAAY,EAAE;QACpB,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YAC9C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAChB;KACF;IACD,IAAI,GAAG,CAAC,gBAAgB,EAAE;QACxB,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE;YAClD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAChB;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAwB,cAAc;IACpC,IAAI,IAAI,GAAG,sBAAsB,EAAE,CAAC;IAEpC,OAAO;QACL,IAAI,EAAE,iBAAiB;QAEvB,KAAK,CAAC,SAAS,CAAC,MAAM;YACpB,IAAI,OAAO,GAAG,IAAA,kBAAW,EAAC,MAAM,CAAC,CAAC;YAClC,IAAI,CAAC,OAAO,EAAE;gBACZ,wEAAwE;gBACxE,qBAAqB;gBACrB,OAAO;aACR;YAED,IACE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;gBACjB,2BAAoB,CAAC,GAAG,CAAC,OAAO,CAAC;gBACjC,2BAAoB,CAAC,GAAG,CAAC,OAAO,CAAC;gBACjC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,EAC/B;gBACA,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;aACvC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAxBD,iCAwBC","sourcesContent":["import type { Plugin } from 'rollup';\nimport { readJsonSync } from 'fs-extra';\nimport {\n emberVirtualPackages,\n emberVirtualPeerDeps,\n packageName,\n templateCompilationModules,\n} from '@embroider/core';\n\nconst compilationModules = new Set(\n templateCompilationModules.map((m) => m.module)\n);\n\nfunction resolvableDependencies() {\n let deps = new Set();\n let pkg = readJsonSync('package.json');\n if (pkg.dependencies) {\n for (let name of Object.keys(pkg.dependencies)) {\n deps.add(name);\n }\n }\n if (pkg.peerDependencies) {\n for (let name of Object.keys(pkg.peerDependencies)) {\n deps.add(name);\n }\n }\n return deps;\n}\n\nexport default function emberExternals(): Plugin {\n let deps = resolvableDependencies();\n\n return {\n name: 'ember-externals',\n\n async resolveId(source) {\n let pkgName = packageName(source);\n if (!pkgName) {\n // No package name found means this is a relative import, which we don't\n // need to deal with.\n return;\n }\n\n if (\n deps.has(pkgName) ||\n emberVirtualPeerDeps.has(pkgName) ||\n emberVirtualPackages.has(pkgName) ||\n compilationModules.has(pkgName)\n ) {\n return { id: source, external: true };\n }\n },\n };\n}\n"]}
1
+ {"version":3,"file":"rollup-addon-dependencies.js","sourceRoot":"","sources":["rollup-addon-dependencies.ts"],"names":[],"mappings":";;AACA,uCAAwC;AACxC,0CAKyB;AAEzB,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAChC,iCAA0B,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAChD,CAAC;AAEF,SAAS,sBAAsB;IAC7B,IAAI,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC7B,IAAI,GAAG,GAAG,IAAA,uBAAY,EAAC,cAAc,CAAC,CAAC;IACvC,IAAI,GAAG,CAAC,YAAY,EAAE;QACpB,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YAC9C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAChB;KACF;IACD,IAAI,GAAG,CAAC,gBAAgB,EAAE;QACxB,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE;YAClD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAChB;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAwB,cAAc;IACpC,IAAI,IAAiB,CAAC;IAEtB,OAAO;QACL,IAAI,EAAE,iBAAiB;QAEvB,UAAU;YACR,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;YAClC,IAAI,GAAG,sBAAsB,EAAE,CAAC;QAClC,CAAC;QAED,KAAK,CAAC,SAAS,CAAC,MAAM;YACpB,IAAI,OAAO,GAAG,IAAA,kBAAW,EAAC,MAAM,CAAC,CAAC;YAClC,IAAI,CAAC,OAAO,EAAE;gBACZ,wEAAwE;gBACxE,qBAAqB;gBACrB,OAAO;aACR;YAED,IACE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;gBACjB,2BAAoB,CAAC,GAAG,CAAC,OAAO,CAAC;gBACjC,2BAAoB,CAAC,GAAG,CAAC,OAAO,CAAC;gBACjC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,EAC/B;gBACA,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;aACvC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AA7BD,iCA6BC","sourcesContent":["import type { Plugin } from 'rollup';\nimport { readJsonSync } from 'fs-extra';\nimport {\n emberVirtualPackages,\n emberVirtualPeerDeps,\n packageName,\n templateCompilationModules,\n} from '@embroider/core';\n\nconst compilationModules = new Set(\n templateCompilationModules.map((m) => m.module)\n);\n\nfunction resolvableDependencies(): Set<string> {\n let deps = new Set<string>();\n let pkg = readJsonSync('package.json');\n if (pkg.dependencies) {\n for (let name of Object.keys(pkg.dependencies)) {\n deps.add(name);\n }\n }\n if (pkg.peerDependencies) {\n for (let name of Object.keys(pkg.peerDependencies)) {\n deps.add(name);\n }\n }\n return deps;\n}\n\nexport default function emberExternals(): Plugin {\n let deps: Set<string>;\n\n return {\n name: 'ember-externals',\n\n buildStart() {\n this.addWatchFile('package.json');\n deps = resolvableDependencies();\n },\n\n async resolveId(source) {\n let pkgName = packageName(source);\n if (!pkgName) {\n // No package name found means this is a relative import, which we don't\n // need to deal with.\n return;\n }\n\n if (\n deps.has(pkgName) ||\n emberVirtualPeerDeps.has(pkgName) ||\n emberVirtualPackages.has(pkgName) ||\n compilationModules.has(pkgName)\n ) {\n return { id: source, external: true };\n }\n },\n };\n}\n"]}
@@ -10,6 +10,11 @@ const minimatch_1 = __importDefault(require("minimatch"));
10
10
  function keepAssets({ from, include, }) {
11
11
  return {
12
12
  name: 'copy-assets',
13
+ // Prior to https://github.com/rollup/rollup/pull/5270, we cannot call this
14
+ // from within `generateBundle`
15
+ buildStart() {
16
+ this.addWatchFile(from);
17
+ },
13
18
  // imports of assets should be left alone in the source code. This can cover
14
19
  // the case of .css as defined in the embroider v2 addon spec.
15
20
  async resolveId(source, importer, options) {
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-keep-assets.js","sourceRoot":"","sources":["rollup-keep-assets.ts"],"names":[],"mappings":";;;;;AAAA,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;gBACA,OAAO,EAAE,EAAE,EAAE,IAAA,cAAO,EAAC,IAAA,cAAO,EAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;aACzE;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;gBACF,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;aACJ;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AA1CD,6BA0CC","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.emitFile({\n type: 'asset',\n fileName: name,\n source: readFileSync(join(from, name)),\n });\n }\n },\n };\n}\n"]}
1
+ {"version":3,"file":"rollup-keep-assets.js","sourceRoot":"","sources":["rollup-keep-assets.ts"],"names":[],"mappings":";;;;;AAAA,0DAAiC;AAEjC,2BAAkC;AAClC,+BAA8C;AAC9C,0DAAkC;AAElC,SAAwB,UAAU,CAAC,EACjC,IAAI,EACJ,OAAO,GAIR;IACC,OAAO;QACL,IAAI,EAAE,aAAa;QAEnB,2EAA2E;QAC3E,+BAA+B;QAC/B,UAAU;YACR,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAED,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;gBACA,OAAO,EAAE,EAAE,EAAE,IAAA,cAAO,EAAC,IAAA,cAAO,EAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;aACzE;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;gBACF,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;aACJ;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAhDD,6BAgDC","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 // Prior to https://github.com/rollup/rollup/pull/5270, we cannot call this\n // from within `generateBundle`\n buildStart() {\n this.addWatchFile(from);\n },\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.emitFile({\n type: 'asset',\n fileName: name,\n source: readFileSync(join(from, name)),\n });\n }\n },\n };\n}\n"]}
@@ -10,6 +10,11 @@ function publicAssets(path, opts) {
10
10
  const excludedGlobPatterns = (opts === null || opts === void 0 ? void 0 : opts.exclude) || [];
11
11
  return {
12
12
  name: 'public-assets-bundler',
13
+ // Prior to https://github.com/rollup/rollup/pull/5270, we cannot call this
14
+ // from within `generateBundle`
15
+ buildStart() {
16
+ this.addWatchFile(path);
17
+ },
13
18
  generateBundle() {
14
19
  var _a;
15
20
  let pkg = (0, fs_extra_1.readJsonSync)('package.json');
@@ -19,7 +24,7 @@ function publicAssets(path, opts) {
19
24
  ignore: excludedGlobPatterns,
20
25
  });
21
26
  const publicAssets = filenames.reduce((acc, v) => {
22
- acc[`./${path}/${v}`] = ['/', pkg.name, '/', v].join('');
27
+ acc[`./${path}/${v}`] = ['/', pkg.name, '/', path, '/', v].join('');
23
28
  return acc;
24
29
  }, {});
25
30
  let originalPublicAssets = (_a = pkg['ember-addon']) === null || _a === void 0 ? void 0 : _a['public-assets'];
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-public-assets.js","sourceRoot":"","sources":["roll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BAEH,IAAA,wBAAa,EAAC,cAAc,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;aACnD;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAtCD,+BAsCC","sourcesContent":["import { readJsonSync, writeJsonSync } from 'fs-extra';\nimport walkSync from 'walk-sync';\nimport type { Plugin } from 'rollup';\n\nexport default function publicAssets(\n path: string,\n opts: { include: string[]; exclude: string[] }\n): Plugin {\n const includeGlobPatterns = opts?.include;\n const excludedGlobPatterns = opts?.exclude || [];\n\n return {\n name: 'public-assets-bundler',\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 acc[`./${path}/${v}`] = ['/', pkg.name, '/', v].join('');\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":";;;;;AAAA,uCAAuD;AACvD,0DAAiC;AAGjC,SAAwB,YAAY,CAClC,IAAY,EACZ,IAA8C;IAE9C,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,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACpE,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;gBACd,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;aACnD;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AA7CD,+BA6CC","sourcesContent":["import { readJsonSync, writeJsonSync } from 'fs-extra';\nimport walkSync from 'walk-sync';\nimport type { Plugin } from 'rollup';\n\nexport default function publicAssets(\n path: string,\n opts: { include: string[]; exclude: string[] }\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 acc[`./${path}/${v}`] = ['/', pkg.name, '/', path, '/', v].join('');\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"]}
@@ -13,6 +13,7 @@ function publicEntrypoints(args) {
13
13
  return {
14
14
  name: 'addon-modules',
15
15
  async buildStart() {
16
+ this.addWatchFile(args.srcDir);
16
17
  let matches = (0, walk_sync_1.default)(args.srcDir, {
17
18
  globs: [...args.include, '**/*.hbs', '**/*.ts', '**/*.gts', '**/*.gjs'],
18
19
  });
@@ -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,IAGzC;IACC,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,KAAK,CAAC,UAA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,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;iBACV;aACF;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AA9DD,oCA8DC;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}): 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 });\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"]}
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,CAA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;gBAC7E,IAAI,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CACpD,IAAA,mBAAS,EAAC,cAAc,EAAE,OAAO,CAAC,CACnC,CAAC;gBAEF,IAAI,aAAa,IAAI,iBAAiB,EAAE;oBACtC,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;iBACV;aACF;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAhED,oCAgEC;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}): 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 });\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"]}