@embroider/addon-dev 3.1.3-unstable.f032c58 → 3.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/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": "3.1.3-unstable.f032c58",
3
+ "version": "3.2.0",
4
4
  "description": "Utilities for addon authors",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,34 +22,35 @@
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.1.4-unstable.f032c58",
30
26
  "@rollup/pluginutils": "^4.1.1",
31
27
  "assert-never": "^1.2.1",
28
+ "content-tag": "^1.0.0",
32
29
  "fs-extra": "^10.0.0",
33
30
  "minimatch": "^3.0.4",
34
31
  "rollup-plugin-copy-assets": "^2.0.3",
35
32
  "rollup-plugin-delete": "^2.0.0",
36
33
  "walk-sync": "^3.0.0",
37
- "yargs": "^17.0.1"
34
+ "yargs": "^17.0.1",
35
+ "@embroider/core": "^3.2.0"
38
36
  },
39
37
  "devDependencies": {
40
- "@embroider/test-support": "workspace:*",
41
38
  "@glimmer/syntax": "^0.84.2",
42
39
  "@types/fs-extra": "^9.0.12",
43
40
  "@types/minimatch": "^3.0.4",
44
41
  "@types/yargs": "^17.0.3",
45
42
  "rollup": "^3.23.0",
46
43
  "tmp": "^0.1.0",
47
- "typescript": "^5.1.6"
44
+ "typescript": "^5.1.6",
45
+ "@embroider/test-support": "0.36.0"
48
46
  },
49
47
  "engines": {
50
48
  "node": "12.* || 14.* || >= 16"
51
49
  },
52
50
  "volta": {
53
51
  "extends": "../../package.json"
52
+ },
53
+ "scripts": {
54
+ "test": "jest"
54
55
  }
55
- }
56
+ }
@@ -0,0 +1,2 @@
1
+ import type { Plugin } from 'rollup';
2
+ export default function rollupGjsPlugin(): Plugin;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const pluginutils_1 = require("@rollup/pluginutils");
4
+ const fs_1 = require("fs");
5
+ const content_tag_1 = require("content-tag");
6
+ const PLUGIN_NAME = 'rollup-gjs-plugin';
7
+ const processor = new content_tag_1.Preprocessor();
8
+ // import { parse as pathParse } from 'path';
9
+ function rollupGjsPlugin() {
10
+ return {
11
+ name: PLUGIN_NAME,
12
+ async resolveId(source, importer, options) {
13
+ let resolution = await this.resolve(source, importer, {
14
+ skipSelf: true,
15
+ ...options,
16
+ });
17
+ if (resolution) {
18
+ return maybeRewriteGJS(resolution);
19
+ }
20
+ },
21
+ load(id) {
22
+ const meta = getMeta(this, id);
23
+ if (!meta) {
24
+ return;
25
+ }
26
+ this.addWatchFile(meta.originalId);
27
+ let input = (0, fs_1.readFileSync)(meta.originalId, 'utf8');
28
+ let code = processor.process(input);
29
+ return {
30
+ code,
31
+ };
32
+ },
33
+ };
34
+ }
35
+ exports.default = rollupGjsPlugin;
36
+ function getMeta(context, id) {
37
+ var _a, _b;
38
+ const meta = (_b = (_a = context.getModuleInfo(id)) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b[PLUGIN_NAME];
39
+ if (meta) {
40
+ return meta;
41
+ }
42
+ else {
43
+ return null;
44
+ }
45
+ }
46
+ const gjsFilter = (0, pluginutils_1.createFilter)('**/*.g{j,t}s');
47
+ function maybeRewriteGJS(resolution) {
48
+ if (!gjsFilter(resolution.id)) {
49
+ return null;
50
+ }
51
+ let id;
52
+ if (resolution.id.endsWith('.gjs')) {
53
+ id = resolution.id.replace(/\.gjs$/, '.js');
54
+ }
55
+ else if (resolution.id.endsWith('.gts')) {
56
+ id = resolution.id.replace(/\.gts$/, '.ts');
57
+ }
58
+ else {
59
+ throw new Error('Unexpected issues in the plugin-rollup-gjs - an unexpected file made its way throught the pluginUtils filter');
60
+ }
61
+ // This creates an `*.js` or `*.ts` that **replaces** the .gjs or .gts file that we will populate in `load()` hook.
62
+ return {
63
+ ...resolution,
64
+ id,
65
+ meta: {
66
+ [PLUGIN_NAME]: {
67
+ originalId: resolution.id,
68
+ },
69
+ },
70
+ };
71
+ }
72
+ //# sourceMappingURL=rollup-gjs-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup-gjs-plugin.js","sourceRoot":"","sources":["rollup-gjs-plugin.ts"],"names":[],"mappings":";;AAAA,qDAAmD;AAEnD,2BAAkC;AAClC,6CAA2C;AAE3C,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAExC,MAAM,SAAS,GAAG,IAAI,0BAAY,EAAE,CAAC;AACrC,6CAA6C;AAE7C,SAAwB,eAAe;IACrC,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,KAA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AE;QAClC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;KAC7C;SAAM,IAAI,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACzC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;KAC7C;SAAM;QACL,MAAM,IAAI,KAAK,CACb,8GAA8G,CAC/G,CAAC;KACH;IAED,mHAAmH;IACnH,OAAO;QACL,GAAG,UAAU;QACb,EAAE;QACF,IAAI,EAAE;YACJ,CAAC,WAAW,CAAC,EAAE;gBACb,UAAU,EAAE,UAAU,CAAC,EAAE;aAC1B;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { createFilter } from '@rollup/pluginutils';\nimport type { Plugin, PluginContext, ResolvedId } from 'rollup';\nimport { readFileSync } from 'fs';\nimport { Preprocessor } from 'content-tag';\n\nconst PLUGIN_NAME = 'rollup-gjs-plugin';\n\nconst processor = new Preprocessor();\n// import { parse as pathParse } from 'path';\n\nexport default function rollupGjsPlugin(): Plugin {\n return {\n name: PLUGIN_NAME,\n async resolveId(source: string, importer: string | undefined, options) {\n let resolution = await this.resolve(source, importer, {\n skipSelf: true,\n ...options,\n });\n\n if (resolution) {\n return maybeRewriteGJS(resolution);\n }\n },\n\n load(id: string) {\n const meta = getMeta(this, id);\n if (!meta) {\n return;\n }\n\n this.addWatchFile(meta.originalId);\n let input = readFileSync(meta.originalId, 'utf8');\n let code = processor.process(input);\n return {\n code,\n };\n },\n };\n}\n\ntype Meta = {\n originalId: string;\n};\n\nfunction getMeta(context: PluginContext, id: string): Meta | null {\n const meta = context.getModuleInfo(id)?.meta?.[PLUGIN_NAME];\n if (meta) {\n return meta as Meta;\n } else {\n return null;\n }\n}\n\nconst gjsFilter = createFilter('**/*.g{j,t}s');\n\nfunction maybeRewriteGJS(resolution: ResolvedId) {\n if (!gjsFilter(resolution.id)) {\n return null;\n }\n\n let id;\n\n if (resolution.id.endsWith('.gjs')) {\n id = resolution.id.replace(/\\.gjs$/, '.js');\n } else if (resolution.id.endsWith('.gts')) {\n id = resolution.id.replace(/\\.gts$/, '.ts');\n } else {\n throw new Error(\n 'Unexpected issues in the plugin-rollup-gjs - an unexpected file made its way throught the pluginUtils filter'\n );\n }\n\n // This creates an `*.js` or `*.ts` that **replaces** the .gjs or .gts file that we will populate in `load()` hook.\n return {\n ...resolution,\n id,\n meta: {\n [PLUGIN_NAME]: {\n originalId: resolution.id,\n },\n },\n };\n}\n"]}
package/src/rollup.d.ts CHANGED
@@ -10,6 +10,7 @@ export declare class Addon {
10
10
  }): Plugin;
11
11
  publicEntrypoints(patterns: string[]): Plugin;
12
12
  hbs(): Plugin;
13
+ gjs(): Plugin;
13
14
  clean(): Plugin;
14
15
  keepAssets(patterns: string[]): Plugin;
15
16
  output(): {
package/src/rollup.js CHANGED
@@ -17,6 +17,7 @@ var _Addon_srcDir, _Addon_destDir;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.Addon = void 0;
19
19
  const rollup_hbs_plugin_1 = __importDefault(require("./rollup-hbs-plugin"));
20
+ const rollup_gjs_plugin_1 = __importDefault(require("./rollup-gjs-plugin"));
20
21
  const rollup_public_entrypoints_1 = __importDefault(require("./rollup-public-entrypoints"));
21
22
  const rollup_app_reexports_1 = __importDefault(require("./rollup-app-reexports"));
22
23
  const rollup_plugin_delete_1 = __importDefault(require("rollup-plugin-delete"));
@@ -54,6 +55,9 @@ class Addon {
54
55
  hbs() {
55
56
  return (0, rollup_hbs_plugin_1.default)();
56
57
  }
58
+ gjs() {
59
+ return (0, rollup_gjs_plugin_1.default)();
60
+ }
57
61
  // By default rollup does not clear the output directory between builds. This
58
62
  // does that.
59
63
  clean() {
package/src/rollup.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.js","sourceRoot":"","sources":["rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;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,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;AAlFD,sBAkFC","sourcesContent":["import { default as hbs } from './rollup-hbs-plugin';\nimport { default as publicEntrypoints } from './rollup-public-entrypoints';\nimport { default as appReexports } from './rollup-app-reexports';\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 // By default rollup does not clear the output directory between builds. This\n // does that.\n clean() {\n return clean({ targets: `${this.#destDir}/*` });\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;AACjE,gFAAwD;AACxD,8EAA6D;AAC7D,4FAAsE;AACtE,kFAAiE;AAGjE,MAAa,KAAK;IAIhB,YAAY,SAAgD,EAAE;;QAH9D,gCAAgB;QAChB,iCAAiB;QAGf,uBAAA,IAAI,iBAAW,MAAA,MAAM,CAAC,MAAM,mCAAI,KAAK,MAAA,CAAC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M;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 { 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() {\n return clean({ targets: `${this.#destDir}/*` });\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"]}