@embroider/addon-dev 0.46.2 → 0.48.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/package.json +2 -2
- package/sample-rollup.config.js +6 -0
- package/src/commands.js +0 -0
- package/src/rollup-addon-dependencies.d.ts +2 -0
- package/src/rollup-addon-dependencies.js +42 -0
- package/src/rollup-addon-dependencies.js.map +1 -0
- package/src/rollup.d.ts +1 -0
- package/src/rollup.js +4 -0
- package/src/rollup.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embroider/addon-dev",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.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.
|
|
26
|
+
"@embroider/shared-internals": "^0.48.0",
|
|
27
27
|
"@rollup/pluginutils": "^4.1.1",
|
|
28
28
|
"fs-extra": "^10.0.0",
|
|
29
29
|
"minimatch": "^3.0.4",
|
package/sample-rollup.config.js
CHANGED
|
@@ -26,8 +26,14 @@ export default {
|
|
|
26
26
|
// template colocation.
|
|
27
27
|
babel({
|
|
28
28
|
plugins: ['@embroider/addon-dev/template-colocation-plugin'],
|
|
29
|
+
babelHelpers: 'bundled',
|
|
29
30
|
}),
|
|
30
31
|
|
|
32
|
+
// Follow the V2 Addon rules about dependencies. Your code can import from
|
|
33
|
+
// `dependencies` and `peerDependencies` as well as standard Ember-provided
|
|
34
|
+
// package names.
|
|
35
|
+
addon.dependencies(),
|
|
36
|
+
|
|
31
37
|
// Ensure that standalone .hbs files are properly integrated as Javascript.
|
|
32
38
|
addon.hbs(),
|
|
33
39
|
|
package/src/commands.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fs_extra_1 = require("fs-extra");
|
|
4
|
+
const shared_internals_1 = require("@embroider/shared-internals");
|
|
5
|
+
const compilationModules = new Set(shared_internals_1.templateCompilationModules.map((m) => m.module));
|
|
6
|
+
function resolvableDependencies() {
|
|
7
|
+
let deps = new Set();
|
|
8
|
+
let pkg = (0, fs_extra_1.readJsonSync)('package.json');
|
|
9
|
+
if (pkg.dependencies) {
|
|
10
|
+
for (let name of Object.keys(pkg.dependencies)) {
|
|
11
|
+
deps.add(name);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (pkg.peerDependencies) {
|
|
15
|
+
for (let name of Object.keys(pkg.peerDependencies)) {
|
|
16
|
+
deps.add(name);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return deps;
|
|
20
|
+
}
|
|
21
|
+
function emberExternals() {
|
|
22
|
+
let deps = resolvableDependencies();
|
|
23
|
+
return {
|
|
24
|
+
name: 'ember-externals',
|
|
25
|
+
async resolveId(source) {
|
|
26
|
+
let pkgName = (0, shared_internals_1.packageName)(source);
|
|
27
|
+
if (!pkgName) {
|
|
28
|
+
// No package name found means this is a relative import, which we don't
|
|
29
|
+
// need to deal with.
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (deps.has(pkgName) ||
|
|
33
|
+
shared_internals_1.emberVirtualPeerDeps.has(pkgName) ||
|
|
34
|
+
shared_internals_1.emberVirtualPackages.has(pkgName) ||
|
|
35
|
+
compilationModules.has(pkgName)) {
|
|
36
|
+
return { id: source, external: true };
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
exports.default = emberExternals;
|
|
42
|
+
//# sourceMappingURL=rollup-addon-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup-addon-dependencies.js","sour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,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/shared-internals';\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"]}
|
package/src/rollup.d.ts
CHANGED
package/src/rollup.js
CHANGED
|
@@ -21,6 +21,7 @@ const rollup_public_entrypoints_1 = __importDefault(require("./rollup-public-ent
|
|
|
21
21
|
const rollup_app_reexports_1 = __importDefault(require("./rollup-app-reexports"));
|
|
22
22
|
const rollup_plugin_delete_1 = __importDefault(require("rollup-plugin-delete"));
|
|
23
23
|
const rollup_keep_assets_1 = __importDefault(require("./rollup-keep-assets"));
|
|
24
|
+
const rollup_addon_dependencies_1 = __importDefault(require("./rollup-addon-dependencies"));
|
|
24
25
|
class Addon {
|
|
25
26
|
constructor(params = {}) {
|
|
26
27
|
var _a, _b;
|
|
@@ -73,6 +74,9 @@ class Addon {
|
|
|
73
74
|
output() {
|
|
74
75
|
return { dir: __classPrivateFieldGet(this, _Addon_destDir, "f"), format: 'es', entryFileNames: '[name]' };
|
|
75
76
|
}
|
|
77
|
+
dependencies() {
|
|
78
|
+
return (0, rollup_addon_dependencies_1.default)();
|
|
79
|
+
}
|
|
76
80
|
}
|
|
77
81
|
exports.Addon = Addon;
|
|
78
82
|
_Addon_srcDir = new WeakMap(), _Addon_destDir = new WeakMap();
|
package/src/rollup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,4EAAqD;AACrD,4FAA2E;AAC3E,kFAAiE;AACjE,gFAAwD;AACxD,8EAA6D;
|
|
1
|
+
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,4EAAqD;AACrD,4FAA2E;AAC3E,kFAAiE;AACjE,gFAAwD;AACxD,8EAA6D;AAC7D,4FAAsE;AAGtE,MAAa,KAAK;IAIhB,YAAY,SAAgD,EAAE;;QAH9D,gCAAgB;QAChB,iCAAiB;QAGf,uBAAA,IAAI,iBAAW,MAAA,MAAM,CAAC,MAAM,mCAAI,KAAK,MAAA,CAAC;QACtC,uBAAA,IAAI,kBAAY,MAAA,MAAM,CAAC,OAAO,mCAAI,MAAM,MAAA,CAAC;IAC3C,CAAC;IAED,0EAA0E;IAC1E,yEAAyE;IACzE,0CAA0C;IAC1C,YAAY,CAAC,QAAkB;QAC7B,OAAO,IAAA,8BAAY,EAAC;YAClB,IAAI,EAAE,uBAAA,IAAI,qBAAQ;YAClB,EAAE,EAAE,uBAAA,IAAI,sBAAS;YACjB,OAAO,EAAE,QAAQ;SAClB,CAAC,CAAC;IACL,CAAC;IAED,4EAA4E;IAC5E,0EAA0E;IAC1E,+EAA+E;IAC/E,iBAAiB,CAAC,QAAkB;QAClC,OAAO,IAAA,mCAAiB,EAAC,EAAE,MAAM,EAAE,uBAAA,IAAI,qBAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,oEAAoE;IACpE,sEAAsE;IACtE,8DAA8D;IAC9D,GAAG;QACD,OAAO,IAAA,2BAAG,GAAE,CAAC;IACf,CAAC;IAED,6EAA6E;IAC7E,aAAa;IACb,KAAK;QACH,OAAO,IAAA,8BAAK,EAAC,EAAE,OAAO,EAAE,GAAG,uBAAA,IAAI,sBAAS,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,4EAA4E;IAC5E,6EAA6E;IAC7E,6EAA6E;IAC7E,UAAU;IACV,UAAU,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,MAAM;QACJ,OAAO,EAAE,GAAG,EAAE,uBAAA,IAAI,sBAAS,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;IACxE,CAAC;IAED,YAAY;QACV,OAAO,IAAA,mCAAY,GAAE,CAAC;IACxB,CAAC;CACF;AA9DD,sBA8DC","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 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(patterns: string[]): Plugin {\n return appReexports({\n from: this.#srcDir,\n to: this.#destDir,\n include: patterns,\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 output() {\n return { dir: this.#destDir, format: 'es', entryFileNames: '[name]' };\n }\n\n dependencies() {\n return dependencies();\n }\n}\n"]}
|