@embroider/addon-dev 4.1.4-unstable.7619120 → 4.1.4-unstable.a9f892a

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": "4.1.4-unstable.7619120",
3
+ "version": "4.1.4-unstable.a9f892a",
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.7619120",
29
+ "@embroider/core": "3.4.4-unstable.a9f892a",
30
30
  "@rollup/pluginutils": "^4.1.1",
31
31
  "content-tag": "^1.1.2",
32
32
  "fs-extra": "^10.0.0",
@@ -4,4 +4,5 @@ export default function appReexports(opts: {
4
4
  to: string;
5
5
  include: string[];
6
6
  mapFilename?: (filename: string) => string;
7
+ exports?: (filename: string) => string[] | string | undefined;
7
8
  }): Plugin;
@@ -10,22 +10,26 @@ function appReexports(opts) {
10
10
  return {
11
11
  name: 'app-reexports',
12
12
  generateBundle(_, bundle) {
13
- var _a, _b, _c;
13
+ var _a, _b, _c, _d;
14
14
  let pkg = (0, fs_extra_1.readJsonSync)('package.json');
15
15
  let appJS = {};
16
16
  for (let addonFilename of Object.keys(bundle)) {
17
17
  let appFilename = (_b = (_a = opts.mapFilename) === null || _a === void 0 ? void 0 : _a.call(opts, addonFilename)) !== null && _b !== void 0 ? _b : addonFilename;
18
+ let appExports = ((_c = opts.exports) === null || _c === void 0 ? void 0 : _c.call(opts, addonFilename)) || ['default'];
19
+ let computedExports = typeof appExports === 'string'
20
+ ? appExports
21
+ : `{ ${appExports.join(', ')} }`;
18
22
  if (opts.include.some((glob) => (0, minimatch_1.default)(addonFilename, glob)) &&
19
23
  !(0, minimatch_1.default)(addonFilename, '**/*.d.ts')) {
20
24
  appJS[`./${appFilename}`] = `./dist/_app_/${appFilename}`;
21
25
  this.emitFile({
22
26
  type: 'asset',
23
27
  fileName: `_app_/${appFilename}`,
24
- source: `export { default } from "${pkg.name}/${addonFilename.slice(0, -(0, path_1.extname)(addonFilename).length)}";\n`,
28
+ source: `export ${computedExports} from "${pkg.name}/${addonFilename.slice(0, -(0, path_1.extname)(addonFilename).length)}";\n`,
25
29
  });
26
30
  }
27
31
  }
28
- let originalAppJS = (_c = pkg['ember-addon']) === null || _c === void 0 ? void 0 : _c['app-js'];
32
+ let originalAppJS = (_d = pkg['ember-addon']) === null || _d === void 0 ? void 0 : _d['app-js'];
29
33
  let hasChanges = JSON.stringify(originalAppJS) !== JSON.stringify(appJS);
30
34
  // Don't cause a file i/o event unless something actually changed
31
35
  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,IAKpC;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,CAAC,MAAM,CAAC,EAAE;gBAC7C,IAAI,WAAW,GAAG,MAAA,MAAA,IAAI,CAAC,WAAW,qDAAG,aAAa,CAAC,mCAAI,aAAa,CAAC;gBAErE,IACE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAS,EAAC,aAAa,EAAE,IAAI,CAAC,CAAC;oBAC3D,CAAC,IAAA,mBAAS,EAAC,aAAa,EAAE,WAAW,CAAC,EACtC;oBACA,KAAK,CAAC,KAAK,WAAW,EAAE,CAAC,GAAG,gBAAgB,WAAW,EAAE,CAAC;oBAC1D,IAAI,CAAC,QAAQ,CAAC;wBACZ,IAAI,EAAE,OAAO;wBACb,QAAQ,EAAE,SAAS,WAAW,EAAE;wBAChC,MAAM,EAAE,4BAA4B,GAAG,CAAC,IAAI,IAAI,aAAa,CAAC,KAAK,CACjE,CAAC,EACD,CAAC,IAAA,cAAO,EAAC,aAAa,CAAC,CAAC,MAAM,CAC/B,MAAM;qBACR,CAAC,CAAC;iBACJ;aACF;YACD,IAAI,aAAa,GAAG,MAAA,GAAG,CAAC,aAAa,CAAC,0CAAG,QAAQ,CAAC,CAAC;YAEnD,IAAI,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,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;AA1CD,+BA0CC","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 mapFilename?: (filename: string) => string;\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\n if (\n opts.include.some((glob) => minimatch(addonFilename, glob)) &&\n !minimatch(addonFilename, '**/*.d.ts')\n ) {\n appJS[`./${appFilename}`] = `./dist/_app_/${appFilename}`;\n this.emitFile({\n type: 'asset',\n fileName: `_app_/${appFilename}`,\n source: `export { default } from \"${pkg.name}/${addonFilename.slice(\n 0,\n -extname(addonFilename).length\n )}\";\\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"]}
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,IAMpC;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,CAAC,MAAM,CAAC,EAAE;gBAC7C,IAAI,WAAW,GAAG,MAAA,MAAA,IAAI,CAAC,WAAW,qDAAG,aAAa,CAAC,mCAAI,aAAa,CAAC;gBACrE,IAAI,UAAU,GAAG,CAAA,MAAA,IAAI,CAAC,OAAO,qDAAG,aAAa,CAAC,KAAI,CAAC,SAAS,CAAC,CAAC;gBAE9D,IAAI,eAAe,GACjB,OAAO,UAAU,KAAK,QAAQ;oBAC5B,CAAC,CAAC,UAAU;oBACZ,CAAC,CAAC,KAAK,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAErC,IACE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAS,EAAC,aAAa,EAAE,IAAI,CAAC,CAAC;oBAC3D,CAAC,IAAA,mBAAS,EAAC,aAAa,EAAE,WAAW,CAAC,EACtC;oBACA,KAAK,CAAC,KAAK,WAAW,EAAE,CAAC,GAAG,gBAAgB,WAAW,EAAE,CAAC;oBAC1D,IAAI,CAAC,QAAQ,CAAC;wBACZ,IAAI,EAAE,OAAO;wBACb,QAAQ,EAAE,SAAS,WAAW,EAAE;wBAChC,MAAM,EAAE,UAAU,eAAe,UAC/B,GAAG,CAAC,IACN,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAA,cAAO,EAAC,aAAa,CAAC,CAAC,MAAM,CAAC,MAAM;qBACjE,CAAC,CAAC;iBACJ;aACF;YACD,IAAI,aAAa,GAAG,MAAA,GAAG,CAAC,aAAa,CAAC,0CAAG,QAAQ,CAAC,CAAC;YAEnD,IAAI,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,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;AAhDD,+BAgDC","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 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 ) {\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"]}
package/src/rollup.d.ts CHANGED
@@ -8,6 +8,7 @@ export declare class Addon {
8
8
  });
9
9
  appReexports(patterns: string[], opts?: {
10
10
  mapFilename?: (fileName: string) => string;
11
+ exports?: (filename: string) => string[] | string | undefined;
11
12
  }): Plugin;
12
13
  publicEntrypoints(patterns: string[]): Plugin<any>;
13
14
  hbs(): Plugin<any>;
package/src/rollup.js CHANGED
@@ -41,6 +41,7 @@ class Addon {
41
41
  to: __classPrivateFieldGet(this, _Addon_destDir, "f"),
42
42
  include: patterns,
43
43
  mapFilename: opts.mapFilename,
44
+ exports: opts.exports,
44
45
  });
45
46
  }
46
47
  // This configures rollup to emit public entrypoints for each module in your
package/src/rollup.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.js","sourceRoot":"","sources":["rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,4EAAqD;AACrD,4EAAqD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U,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;AAtFD,sBAsFC","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: { mapFilename?: (fileName: string) => string } = {}\n ): Plugin {\n return appReexports({\n from: this.#srcDir,\n to: this.#destDir,\n include: patterns,\n mapFilename: opts.mapFilename,\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[]) {\n return publicEntrypoints({ srcDir: this.#srcDir, include: patterns });\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"]}
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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,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;AA1FD,sBA0FC","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 } = {}\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 });\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[]) {\n return publicEntrypoints({ srcDir: this.#srcDir, include: patterns });\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"]}