@embroider/macros 0.32.0 → 0.33.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 +3 -3
- package/src/ember-addon-main.js +9 -9
- package/src/ember-addon-main.js.map +1 -1
- package/src/index.d.ts +0 -3
- package/src/index.js +1 -16
- package/src/index.js.map +1 -1
- package/src/node.d.ts +3 -0
- package/src/node.js +21 -0
- package/src/node.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embroider/macros",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Standardized build-time macros for ember apps.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@babel/core": "^7.12.3",
|
|
28
28
|
"@babel/traverse": "^7.12.1",
|
|
29
29
|
"@babel/types": "^7.12.1",
|
|
30
|
-
"@embroider/core": "0.
|
|
30
|
+
"@embroider/core": "0.33.0",
|
|
31
31
|
"assert-never": "^1.1.0",
|
|
32
32
|
"ember-cli-babel": "^7.23.0",
|
|
33
33
|
"lodash": "^4.17.10",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"semver": "^7.3.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@embroider/test-support": "0.
|
|
38
|
+
"@embroider/test-support": "0.33.0",
|
|
39
39
|
"@types/babel__core": "^7.1.10",
|
|
40
40
|
"@types/babel__generator": "^7.6.2",
|
|
41
41
|
"@types/babel__template": "^7.0.3",
|
package/src/ember-addon-main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const path_1 = require("path");
|
|
3
|
-
const
|
|
3
|
+
const node_1 = require("./node");
|
|
4
4
|
module.exports = {
|
|
5
5
|
name: '@embroider/macros',
|
|
6
6
|
included(parent) {
|
|
@@ -9,19 +9,19 @@ module.exports = {
|
|
|
9
9
|
let parentOptions = (parent.options = parent.options || {});
|
|
10
10
|
let ownOptions = (parentOptions['@embroider/macros'] = parentOptions['@embroider/macros'] || {});
|
|
11
11
|
const appInstance = this._findHost();
|
|
12
|
-
this.setMacrosConfig(
|
|
12
|
+
this.setMacrosConfig(node_1.MacrosConfig.for(appInstance));
|
|
13
13
|
// if parent is an addon it has root. If it's an app it has project.root.
|
|
14
14
|
let source = parent.root || parent.project.root;
|
|
15
15
|
if (ownOptions.setOwnConfig) {
|
|
16
|
-
|
|
16
|
+
node_1.MacrosConfig.for(appInstance).setOwnConfig(source, ownOptions.setOwnConfig);
|
|
17
17
|
}
|
|
18
18
|
if (ownOptions.setConfig) {
|
|
19
19
|
for (let [packageName, config] of Object.entries(ownOptions.setConfig)) {
|
|
20
|
-
|
|
20
|
+
node_1.MacrosConfig.for(appInstance).setConfig(source, packageName, config);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
if (appInstance.env !== 'production') {
|
|
24
|
-
let macros =
|
|
24
|
+
let macros = node_1.MacrosConfig.for(appInstance);
|
|
25
25
|
// tell the macros where our app is
|
|
26
26
|
macros.enableAppDevelopment(path_1.join(appInstance.project.configPath(), '..', '..'));
|
|
27
27
|
// also tell them our root project is under development. This can be
|
|
@@ -44,7 +44,7 @@ module.exports = {
|
|
|
44
44
|
// that timing.
|
|
45
45
|
const originalToTree = appInstance.toTree;
|
|
46
46
|
appInstance.toTree = function () {
|
|
47
|
-
|
|
47
|
+
node_1.MacrosConfig.for(appInstance).finalize();
|
|
48
48
|
return originalToTree.apply(appInstance, arguments);
|
|
49
49
|
};
|
|
50
50
|
},
|
|
@@ -57,10 +57,10 @@ module.exports = {
|
|
|
57
57
|
installBabelPlugin(appOrAddonInstance) {
|
|
58
58
|
let babelOptions = (appOrAddonInstance.options.babel = appOrAddonInstance.options.babel || {});
|
|
59
59
|
let babelPlugins = (babelOptions.plugins = babelOptions.plugins || []);
|
|
60
|
-
if (!babelPlugins.some(
|
|
60
|
+
if (!babelPlugins.some(node_1.isEmbroiderMacrosPlugin)) {
|
|
61
61
|
let appInstance = this._findHost();
|
|
62
62
|
let source = appOrAddonInstance.root || appOrAddonInstance.project.root;
|
|
63
|
-
babelPlugins.unshift(
|
|
63
|
+
babelPlugins.unshift(node_1.MacrosConfig.for(appInstance).babelPluginConfig(source));
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
setupPreprocessorRegistry(type, registry) {
|
|
@@ -72,7 +72,7 @@ module.exports = {
|
|
|
72
72
|
// MacrosConfig.astPlugins is static because in classic ember-cli, at this
|
|
73
73
|
// point there's not yet an appInstance, so we defer getting it and
|
|
74
74
|
// calling setConfig until our included hook.
|
|
75
|
-
let { plugins, setConfig } =
|
|
75
|
+
let { plugins, setConfig } = node_1.MacrosConfig.astPlugins(this.parent.root);
|
|
76
76
|
this.setMacrosConfig = setConfig;
|
|
77
77
|
plugins.forEach((plugin, index) => {
|
|
78
78
|
registry.add('htmlbars-ast-plugin', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ember-addon-main.js","sourceRoot":"","sources":["ember-addon-main.ts"],"names":[],"mappings":";AAAA,+BAA4B;AAC5B,
|
|
1
|
+
{"version":3,"file":"ember-addon-main.js","sourceRoot":"","sources":["ember-addon-main.ts"],"names":[],"mappings":";AAAA,+BAA4B;AAC5B,iCAA+D;AAE/D,iBAAS;IACP,IAAI,EAAE,mBAAmB;IACzB,QAAQ,CAAY,MAAW;QAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QACrC,IAAI,aAAa,GAAG,CAAC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;QAC5D,IAAI,UAAU,GAAG,CAAC,a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,qEAAqE;YACrE,uEAAuE;YACvE,sBAAsB;YACtB,EAAE;YACF,0EAA0E;YAC1E,mEAAmE;YACnE,6CAA6C;YAC7C,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,mBAAY,CAAC,UAAU,CAAE,IAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAChF,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;YACjC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;gBAChC,QAAQ,CAAC,GAAG,CAAC,qBAAqB,EAAE;oBAClC,IAAI,EAAE,qBAAqB,KAAK,EAAE;oBAClC,MAAM;oBACN,OAAO;wBACL,OAAO,WAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;oBAC/B,CAAC;iBACF,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IACD,OAAO,EAAE,EAAE;CACZ,CAAC"}
|
package/src/index.d.ts
CHANGED
|
@@ -9,6 +9,3 @@ export declare function isDevelopingApp(): boolean;
|
|
|
9
9
|
export declare function isTesting(): boolean;
|
|
10
10
|
export declare function failBuild(message: string): void;
|
|
11
11
|
export declare function moduleExists(packageName: string): boolean;
|
|
12
|
-
export { default as MacrosConfig, Merger } from './macros-config';
|
|
13
|
-
import { PluginItem } from '@babel/core';
|
|
14
|
-
export declare function isEmbroiderMacrosPlugin(item: PluginItem): any;
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Macro Type Signatures */
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
4
|
+
exports.moduleExists = exports.failBuild = exports.isTesting = exports.isDevelopingApp = exports.getGlobalConfig = exports.getOwnConfig = exports.getConfig = exports.importSync = exports.each = exports.macroCondition = exports.dependencySatisfies = void 0;
|
|
8
5
|
/*
|
|
9
6
|
CAUTION: this code is not necessarily what you are actually running. In
|
|
10
7
|
general, the macros are implemented at build time using babel, and so calls to
|
|
@@ -73,16 +70,4 @@ class Oops extends Error {
|
|
|
73
70
|
this.params = params;
|
|
74
71
|
}
|
|
75
72
|
}
|
|
76
|
-
// Entrypoint for managing the macro config within Node.
|
|
77
|
-
var macros_config_1 = require("./macros-config");
|
|
78
|
-
Object.defineProperty(exports, "MacrosConfig", { enumerable: true, get: function () { return __importDefault(macros_config_1).default; } });
|
|
79
|
-
function isEmbroiderMacrosPlugin(item) {
|
|
80
|
-
return ((Array.isArray(item) &&
|
|
81
|
-
item.length > 1 &&
|
|
82
|
-
item[1] &&
|
|
83
|
-
typeof item[1] === 'object' &&
|
|
84
|
-
item[1].embroiderMacrosConfigMarker) ||
|
|
85
|
-
(item && typeof item === 'function' && item.embroiderMacrosASTMarker));
|
|
86
|
-
}
|
|
87
|
-
exports.isEmbroiderMacrosPlugin = isEmbroiderMacrosPlugin;
|
|
88
73
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA,2BAA2B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA,2BAA2B;;;AAE3B;;;;;;;;;;;;;;EAcE;AAEF,SAAgB,mBAAmB,CAAC,WAAmB,EAAE,WAAmB;IAC1E,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC3C,CAAC;AAFD,kDAEC;AAED,SAAgB,cAAc,CAAC,SAAkB;IAC/C,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;AAC5B,CAAC;AAFD,wCAEC;AAED,SAAgB,IAAI,CAAI,KAAU;IAChC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC;AAFD,oBAEC;AAED,4BAA4B;AAC5B,mFAAmF;AACnF,kDAAkD;AAClD,SAAgB,UAAU,CAAC,SAAiB;IAC1C,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;AAC5B,CAAC;AAFD,gCAEC;AAED,SAAgB,SAAS,CAAI,WAAmB;IAC9C,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC;AAC9B,CAAC;AAFD,8BAEC;AAED,SAAgB,YAAY;IAC1B,MAAM,IAAI,IAAI,EAAE,CAAC;AACnB,CAAC;AAFD,oCAEC;AAED,SAAgB,eAAe;IAC7B,MAAM,IAAI,IAAI,EAAE,CAAC;AACnB,CAAC;AAFD,0CAEC;AAED,SAAgB,eAAe;IAC7B,MAAM,IAAI,IAAI,EAAE,CAAC;AACnB,CAAC;AAFD,0CAEC;AAED,SAAgB,SAAS;IACvB,MAAM,IAAI,IAAI,EAAE,CAAC;AACnB,CAAC;AAFD,8BAEC;AAED,SAAgB,SAAS,CAAC,OAAe;IACvC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAFD,8BAEC;AAED,SAAgB,YAAY,CAAC,WAAmB;IAC9C,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC;AAC9B,CAAC;AAFD,oCAEC;AAED,MAAM,IAAK,SAAQ,KAAK;IAEtB,YAAY,GAAG,MAAa;QAC1B,KAAK,CACH,6HAA6H,CAC9H,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF"}
|
package/src/node.d.ts
ADDED
package/src/node.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// this is the public entrypoint for Node-side code, as opposed to index.ts
|
|
3
|
+
// which is our browser-visible public entrypoint
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.isEmbroiderMacrosPlugin = exports.MacrosConfig = void 0;
|
|
9
|
+
// Entrypoint for managing the macro config within Node.
|
|
10
|
+
var macros_config_1 = require("./macros-config");
|
|
11
|
+
Object.defineProperty(exports, "MacrosConfig", { enumerable: true, get: function () { return __importDefault(macros_config_1).default; } });
|
|
12
|
+
function isEmbroiderMacrosPlugin(item) {
|
|
13
|
+
return ((Array.isArray(item) &&
|
|
14
|
+
item.length > 1 &&
|
|
15
|
+
item[1] &&
|
|
16
|
+
typeof item[1] === 'object' &&
|
|
17
|
+
item[1].embroiderMacrosConfigMarker) ||
|
|
18
|
+
(item && typeof item === 'function' && item.embroiderMacrosASTMarker));
|
|
19
|
+
}
|
|
20
|
+
exports.isEmbroiderMacrosPlugin = isEmbroiderMacrosPlugin;
|
|
21
|
+
//# sourceMappingURL=node.js.map
|
package/src/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["node.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,iDAAiD;;;;;;AAEjD,wDAAwD;AACxD,iDAAkE;AAAzD,8HAAA,OAAO,OAAgB;AAIhC,SAAgB,uBAAuB,CAAC,IAAgB;IACtD,OAAO,CACL,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,CAAC;QACf,IAAI,CAAC,CAAC,CAAC;QACP,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ;QAC1B,IAAI,CAAC,CAAC,CAAS,CAAC,2BAA2B,CAAC;QAC/C,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,UAAU,IAAK,IAAY,CAAC,wBAAwB,CAAC,CAC/E,CAAC;AACJ,CAAC;AATD,0DASC"}
|