@embroider/addon-dev 0.50.1 → 1.2.0

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
@@ -2,6 +2,8 @@
2
2
 
3
3
  Utilities for working on v2 addons.
4
4
 
5
+ For a guide on porting a V1 addon to V2, see https://github.com/embroider-build/embroider/blob/main/PORTING-ADDONS-TO-V2.md
6
+
5
7
  ## Rollup Utilities
6
8
 
7
9
  `@embroider/addon-dev/rollup` exports utilities for building addons with rollup. To use them:
@@ -14,6 +16,7 @@ Utilities for working on v2 addons.
14
16
  - @rollup/plugin-babel
15
17
 
16
18
  2. Copy the `./sample-rollup.config.js` in this repo to your own `rollup.config.js`.
19
+ 3. Copy the `./sample-babel.config..json` in this repo to your own `babel.config.json`.
17
20
 
18
21
  ## addon-dev command
19
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/addon-dev",
3
- "version": "0.50.1",
3
+ "version": "1.2.0",
4
4
  "description": "Utilities for addon authors",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,7 +23,7 @@
23
23
  "src/**/*.js.map"
24
24
  ],
25
25
  "dependencies": {
26
- "@embroider/shared-internals": "^0.50.1",
26
+ "@embroider/shared-internals": "^1.2.0",
27
27
  "@rollup/pluginutils": "^4.1.1",
28
28
  "fs-extra": "^10.0.0",
29
29
  "minimatch": "^3.0.4",
@@ -24,8 +24,10 @@ export default {
24
24
  // This babel config should *not* apply presets or compile away ES modules.
25
25
  // It exists only to provide development niceties for you, like automatic
26
26
  // template colocation.
27
+ //
28
+ // By default, this will load the actual babel config from the file
29
+ // babel.config.json.
27
30
  babel({
28
- plugins: ['@embroider/addon-dev/template-colocation-plugin'],
29
31
  babelHelpers: 'bundled',
30
32
  }),
31
33
 
package/src/commands.js CHANGED
File without changes
@@ -12,7 +12,8 @@ function appReexports(opts) {
12
12
  let pkg = (0, fs_extra_1.readJsonSync)('package.json');
13
13
  let appJS = {};
14
14
  for (let filename of Object.keys(bundle)) {
15
- if (opts.include.some((glob) => (0, minimatch_1.default)(filename, glob))) {
15
+ if (opts.include.some((glob) => (0, minimatch_1.default)(filename, glob)) &&
16
+ !(0, minimatch_1.default)(filename, '**/*.d.ts')) {
16
17
  appJS[`./${filename}`] = `./dist/_app_/${filename}`;
17
18
  this.emitFile({
18
19
  type: 'asset',
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-app-reexports.js","sourceRoot":"","sources":["rollup-app-reexports.ts"],"names":[],"mappings":";;;;;AAAA,uCAAuD;AACvD,0DAAkC;AAGlC,SAAwB,YAAY,CAAC,IAIpC;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,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;gBACxC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAS,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE;oBAC1D,KAAK,CAAC,KAAK,QAAQ,EAAE,CAAC,GAAG,gBAAgB,QAAQ,EAAE,CAAC;oBACpD,IAAI,CAAC,QAAQ,CAAC;wBACZ,IAAI,EAAE,OAAO;wBACb,QAAQ,EAAE,SAAS,QAAQ,EAAE;wBAC7B,MAAM,EAAE,4BAA4B,GAAG,CAAC,IAAI,IAAI,QAAQ,MAAM;qBAC/D,CAAC,CAAC;iBACJ;aACF;YACD,GAAG,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,aAAa,CAAC,EAAE;gBACzD,QAAQ,EAAE,KAAK;aAChB,CAAC,CAAC;YACH,IAAA,wBAAa,EAAC,cAAc,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;AACJ,CAAC;AA1BD,+BA0BC","sourcesContent":["import { readJsonSync, writeJsonSync } from 'fs-extra';\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}): 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 filename of Object.keys(bundle)) {\n if (opts.include.some((glob) => minimatch(filename, glob))) {\n appJS[`./${filename}`] = `./dist/_app_/${filename}`;\n this.emitFile({\n type: 'asset',\n fileName: `_app_/${filename}`,\n source: `export { default } from \"${pkg.name}/${filename}\";\\n`,\n });\n }\n }\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"]}
1
+ {"version":3,"file":"rollup-app-reexports.js","sourceRoot":"","sources":["rollup-app-reexports.ts"],"names":[],"mappings":";;;;;AAAA,uCAAuD;AACvD,0DAAkC;AAGlC,SAAwB,YAAY,CAAC,IAIpC;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,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;gBACxC,IACE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAS,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;oBACtD,CAAC,IAAA,mBAAS,EAAC,QAAQ,EAAE,WAAW,CAAC,EACjC;oBACA,KAAK,CAAC,KAAK,QAAQ,EAAE,CAAC,GAAG,gBAAgB,QAAQ,EAAE,CAAC;oBACpD,IAAI,CAAC,QAAQ,CAAC;wBACZ,IAAI,EAAE,OAAO;wBACb,QAAQ,EAAE,SAAS,QAAQ,EAAE;wBAC7B,MAAM,EAAE,4BAA4B,GAAG,CAAC,IAAI,IAAI,QAAQ,MAAM;qBAC/D,CAAC,CAAC;iBACJ;aACF;YACD,GAAG,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,aAAa,CAAC,EAAE;gBACzD,QAAQ,EAAE,KAAK;aAChB,CAAC,CAAC;YACH,IAAA,wBAAa,EAAC,cAAc,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;AACJ,CAAC;AA7BD,+BA6BC","sourcesContent":["import { readJsonSync, writeJsonSync } from 'fs-extra';\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}): 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 filename of Object.keys(bundle)) {\n if (\n opts.include.some((glob) => minimatch(filename, glob)) &&\n !minimatch(filename, '**/*.d.ts')\n ) {\n appJS[`./${filename}`] = `./dist/_app_/${filename}`;\n this.emitFile({\n type: 'asset',\n fileName: `_app_/${filename}`,\n source: `export { default } from \"${pkg.name}/${filename}\";\\n`,\n });\n }\n }\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"]}
@@ -5,6 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const walk_sync_1 = __importDefault(require("walk-sync"));
7
7
  const path_1 = require("path");
8
+ function normalizeFileExt(fileName) {
9
+ return fileName.replace(/\.ts|\.gts|\.gjs$/, '.js');
10
+ }
8
11
  function publicEntrypoints(args) {
9
12
  return {
10
13
  name: 'addon-modules',
@@ -15,7 +18,7 @@ function publicEntrypoints(args) {
15
18
  this.emitFile({
16
19
  type: 'chunk',
17
20
  id: (0, path_1.join)(args.srcDir, name),
18
- fileName: name,
21
+ fileName: normalizeFileExt(name),
19
22
  });
20
23
  }
21
24
  },
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-public-entrypoints.js","sourceRoot":"","sources":["rollup-public-entrypoints.ts"],"names":[],"mappings":";;;;;AAAA,0DAAiC;AAEjC,+BAA4B;AAE5B,SAAwB,iBAAiB,CAAC,IAGzC;IACC,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,UAAU;YACR,KAAK,IAAI,IAAI,IAAI,IAAA,mBAAQ,EAAC,IAAI,CAAC,MAAM,EAAE;gBACrC,KAAK,EAAE,IAAI,CAAC,OAAO;aACpB,CAAC,EAAE;gBACF,IAAI,CAAC,QAAQ,CAAC;oBACZ,IAAI,EAAE,OAAO;oBACb,EAAE,EAAE,IAAA,WAAI,EAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;oBAC3B,QAAQ,EAAE,IAAI;iBACf,CAAC,CAAC;aACJ;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAlBD,oCAkBC","sourcesContent":["import walkSync from 'walk-sync';\nimport type { Plugin } from 'rollup';\nimport { join } from 'path';\n\nexport default function publicEntrypoints(args: {\n srcDir: string;\n include: string[];\n}): Plugin {\n return {\n name: 'addon-modules',\n buildStart() {\n for (let name of walkSync(args.srcDir, {\n globs: args.include,\n })) {\n this.emitFile({\n type: 'chunk',\n id: join(args.srcDir, name),\n fileName: name,\n });\n }\n },\n };\n}\n"]}
1
+ {"version":3,"file":"rollup-public-entrypoints.js","sourceRoot":"","sources":["rollup-public-entrypoints.ts"],"names":[],"mappings":";;;;;AAAA,0DAAiC;AAEjC,+BAA4B;AAE5B,SAAS,gBAAgB,CAAC,QAAgB;IACxC,OAAO,QAAQ,CAAC,OAAO,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;AACtD,CAAC;AAED,SAAwB,iBAAiB,CAAC,IAGzC;IACC,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,UAAU;YACR,KAAK,IAAI,IAAI,IAAI,IAAA,mBAAQ,EAAC,IAAI,CAAC,MAAM,EAAE;gBACrC,KAAK,EAAE,IAAI,CAAC,OAAO;aACpB,CAAC,EAAE;gBACF,IAAI,CAAC,QAAQ,CAAC;oBACZ,IAAI,EAAE,OAAO;oBACb,EAAE,EAAE,IAAA,WAAI,EAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;oBAC3B,QAAQ,EAAE,gBAAgB,CAAC,IAAI,CAAC;iBACjC,CAAC,CAAC;aACJ;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAlBD,oCAkBC","sourcesContent":["import walkSync from 'walk-sync';\nimport type { Plugin } from 'rollup';\nimport { join } from 'path';\n\nfunction normalizeFileExt(fileName: string) {\n return fileName.replace(/\\.ts|\\.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 buildStart() {\n for (let name of walkSync(args.srcDir, {\n globs: args.include,\n })) {\n this.emitFile({\n type: 'chunk',\n id: join(args.srcDir, name),\n fileName: normalizeFileExt(name),\n });\n }\n },\n };\n}\n"]}