@embroider/addon-dev 2.0.0 → 3.0.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embroider/addon-dev",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Utilities for addon authors",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
},
|
|
15
15
|
"exports": {
|
|
16
16
|
"./template-colocation-plugin": "./src/template-colocation-plugin.js",
|
|
17
|
-
"./template-transform-plugin": "./src/template-transform-plugin.js",
|
|
18
17
|
"./rollup": "./src/rollup.js"
|
|
19
18
|
},
|
|
20
19
|
"files": [
|
|
@@ -24,11 +23,10 @@
|
|
|
24
23
|
"src/**/*.js.map"
|
|
25
24
|
],
|
|
26
25
|
"scripts": {
|
|
27
|
-
"xprepare": "tsc",
|
|
28
26
|
"test": "jest"
|
|
29
27
|
},
|
|
30
28
|
"dependencies": {
|
|
31
|
-
"@embroider/core": "^
|
|
29
|
+
"@embroider/core": "^2.0.0",
|
|
32
30
|
"@rollup/pluginutils": "^4.1.1",
|
|
33
31
|
"assert-never": "^1.2.1",
|
|
34
32
|
"fs-extra": "^10.0.0",
|
|
@@ -45,15 +43,8 @@
|
|
|
45
43
|
"@types/minimatch": "^3.0.4",
|
|
46
44
|
"@types/yargs": "^17.0.3",
|
|
47
45
|
"rollup": "^2.58.0",
|
|
48
|
-
"tmp": "^0.1.0"
|
|
49
|
-
|
|
50
|
-
"peerDependencies": {
|
|
51
|
-
"ember-source": "*"
|
|
52
|
-
},
|
|
53
|
-
"peerDependenciesMeta": {
|
|
54
|
-
"ember-source": {
|
|
55
|
-
"optional": true
|
|
56
|
-
}
|
|
46
|
+
"tmp": "^0.1.0",
|
|
47
|
+
"typescript": "*"
|
|
57
48
|
},
|
|
58
49
|
"engines": {
|
|
59
50
|
"node": "12.* || 14.* || >= 16"
|
|
@@ -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
|
|
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,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;AAnCD,+BAmCC","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 pkg['ember-addon'] = Object.assign({}, pkg['ember-addon'], {\n 'app-js': appJS,\n });\n writeJsonSync('package.json', pkg, { spaces: 2 });\n },\n };\n}\n"]}
|
package/src/rollup.d.ts
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare type TemplateTransform = () => {
|
|
2
|
-
name: string;
|
|
3
|
-
visitor: {};
|
|
4
|
-
};
|
|
5
|
-
export declare type TemplateTransformPlugin = TemplateTransform | string;
|
|
6
|
-
export interface Options {
|
|
7
|
-
astTransforms?: TemplateTransformPlugin[];
|
|
8
|
-
compilerPath?: string;
|
|
9
|
-
}
|
|
10
|
-
declare const _default: {
|
|
11
|
-
(babel: typeof import("@babel/core")): unknown;
|
|
12
|
-
_parallelBabel: {
|
|
13
|
-
requireFile: string;
|
|
14
|
-
};
|
|
15
|
-
baseDir(): string;
|
|
16
|
-
};
|
|
17
|
-
export default _default;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const babel_plugin_stage1_inline_hbs_1 = __importDefault(require("@embroider/core/src/babel-plugin-stage1-inline-hbs"));
|
|
7
|
-
const core_1 = require("@embroider/core");
|
|
8
|
-
const load_ember_template_compiler_1 = require("@embroider/core/src/load-ember-template-compiler");
|
|
9
|
-
function resolvePlugins(plugins) {
|
|
10
|
-
return plugins.map((somePlugin) => {
|
|
11
|
-
// If it's a string attempt to resolve the path to a module.
|
|
12
|
-
return typeof somePlugin === 'string'
|
|
13
|
-
? require(require.resolve(somePlugin, { paths: [process.cwd()] })) // eslint-disable-line @typescript-eslint/no-require-imports
|
|
14
|
-
: somePlugin;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
exports.default = (0, babel_plugin_stage1_inline_hbs_1.default)((options) => {
|
|
18
|
-
let { astTransforms: somePlugins = [], compilerPath = 'ember-source/dist/ember-template-compiler', } = options;
|
|
19
|
-
compilerPath = require.resolve(compilerPath);
|
|
20
|
-
const astTransforms = resolvePlugins(somePlugins);
|
|
21
|
-
const params = {
|
|
22
|
-
EmberENV: {},
|
|
23
|
-
loadEmberTemplateCompiler: () => (0, load_ember_template_compiler_1.getEmberExports)(compilerPath),
|
|
24
|
-
plugins: {
|
|
25
|
-
ast: astTransforms,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
return new core_1.TemplateCompiler(params);
|
|
29
|
-
});
|
|
30
|
-
//# sourceMappingURL=template-transform-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template-transform-plugin.js","sourceRoot":"","sources":["template-transform-plugin.ts"],"names":[],"mappings":";;;;;AAAA,wHAAsE;AACtE,0CAA2E;AAC3E,mGAAmF;AAWnF,SAAS,cAAc,CAAC,OAAkC;IACxD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,UAAmC,EAAE,EAAE;QACzD,4DAA4D;QAC5D,OAAO,OAAO,UAAU,KAAK,QAAQ;YACnC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,4DAA4D;YAC/H,CAAC,CAAC,UAAU,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,kBAAe,IAAA,wCAAI,EAAC,CAAC,OAAgB,EAAE,EAAE;IACvC,IAAI,EACF,aAAa,EAAE,WAAW,GAAG,EAAE,EAC/B,YAAY,GAAG,2CAA2C,GAC3D,GAAG,OAAO,CAAC;IAEZ,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAE7C,MAAM,aAAa,GAAwB,cAAc,CAAC,WAAW,CAAC,CAAC;IAEvE,MAAM,MAAM,GAA2B;QACrC,QAAQ,EAAE,EAAE;QACZ,yBAAyB,EAAE,GAAG,EAAE,CAAC,IAAA,8CAAe,EAAC,YAAY,CAAC;QAC9D,OAAO,EAAE;YACP,GAAG,EAAE,aAAa;SACnB;KACF,CAAC;IAEF,OAAO,IAAI,uBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC,CAAC","sourcesContent":["import make from '@embroider/core/src/babel-plugin-stage1-inline-hbs';\nimport { TemplateCompiler, TemplateCompilerParams } from '@embroider/core';\nimport { getEmberExports } from '@embroider/core/src/load-ember-template-compiler';\n\nexport type TemplateTransform = () => { name: string; visitor: {} };\nexport type TemplateTransformPlugin = TemplateTransform | string;\nexport interface Options {\n // An array of either Glimmer AST plugins or paths that can be resolved to a plugin.\n astTransforms?: TemplateTransformPlugin[];\n // Defaults to 'ember-source/dist/ember-template-compiler'\n compilerPath?: string;\n}\n\nfunction resolvePlugins(plugins: TemplateTransformPlugin[]) {\n return plugins.map((somePlugin: TemplateTransformPlugin) => {\n // If it's a string attempt to resolve the path to a module.\n return typeof somePlugin === 'string'\n ? require(require.resolve(somePlugin, { paths: [process.cwd()] })) // eslint-disable-line @typescript-eslint/no-require-imports\n : somePlugin;\n });\n}\n\nexport default make((options: Options) => {\n let {\n astTransforms: somePlugins = [],\n compilerPath = 'ember-source/dist/ember-template-compiler',\n } = options;\n\n compilerPath = require.resolve(compilerPath);\n\n const astTransforms: TemplateTransform[] = resolvePlugins(somePlugins);\n\n const params: TemplateCompilerParams = {\n EmberENV: {},\n loadEmberTemplateCompiler: () => getEmberExports(compilerPath),\n plugins: {\n ast: astTransforms,\n },\n };\n\n return new TemplateCompiler(params);\n});\n"]}
|