@embroider/core 0.29.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 +10 -6
- package/src/app-files.d.ts +3 -2
- package/src/app-files.js +37 -5
- package/src/app-files.js.map +1 -1
- package/src/app.d.ts +7 -7
- package/src/app.js +117 -60
- package/src/app.js.map +1 -1
- package/src/babel-plugin-adjust-imports.js +30 -20
- package/src/babel-plugin-adjust-imports.js.map +1 -1
- package/src/babel-plugin-inline-hbs.d.ts +17 -0
- package/src/babel-plugin-inline-hbs.js +1 -1
- package/src/babel-plugin-inline-hbs.js.map +1 -1
- package/src/build-stage.d.ts +2 -2
- package/src/index.d.ts +1 -1
- package/src/index.js +3 -2
- package/src/index.js.map +1 -1
- package/src/options.d.ts +5 -0
- package/src/options.js +2 -0
- package/src/options.js.map +1 -1
- package/src/package-cache.d.ts +1 -1
- package/src/package-cache.js.map +1 -1
- package/src/package.js +2 -2
- package/src/package.js.map +1 -1
- package/src/portable-babel-config.d.ts +5 -8
- package/src/portable-babel-config.js +68 -19
- package/src/portable-babel-config.js.map +1 -1
- package/src/portable-babel-launcher.d.ts +6 -0
- package/src/portable-babel-launcher.js +75 -0
- package/src/portable-babel-launcher.js.map +1 -0
- package/src/portable.d.ts +23 -0
- package/src/{portable-plugin-config.js → portable.js} +93 -65
- package/src/portable.js.map +1 -0
- package/src/resolver.d.ts +3 -2
- package/src/stage.d.ts +2 -2
- package/src/template-compiler.d.ts +11 -18
- package/src/template-compiler.js +26 -89
- package/src/template-compiler.js.map +1 -1
- package/src/wait-for-trees.d.ts +5 -4
- package/src/wait-for-trees.js +2 -2
- package/src/wait-for-trees.js.map +1 -1
- package/src/portable-plugin-config.d.ts +0 -15
- package/src/portable-plugin-config.js.map +0 -1
|
@@ -3,11 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
6
|
+
exports.makePortable = void 0;
|
|
7
|
+
const path_1 = require("path");
|
|
7
8
|
const resolve_1 = __importDefault(require("resolve"));
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const portable_1 = require("./portable");
|
|
10
|
+
function makePortable(config, resolveOptions, hints) {
|
|
11
|
+
return new PortableBabelConfig(resolveOptions, hints).convert(config);
|
|
12
|
+
}
|
|
13
|
+
exports.makePortable = makePortable;
|
|
14
|
+
class PortableBabelConfig {
|
|
15
|
+
constructor(resolveOptions, hints) {
|
|
16
|
+
this.hints = hints;
|
|
11
17
|
if ('resolve' in resolveOptions) {
|
|
12
18
|
this.resolve = resolveOptions.resolve;
|
|
13
19
|
}
|
|
@@ -16,23 +22,67 @@ class PortableBabelConfig extends portable_plugin_config_1.PortablePluginConfig
|
|
|
16
22
|
this.resolve = (name) => resolve_1.default.sync(name, { basedir: resolveOptions.basedir });
|
|
17
23
|
}
|
|
18
24
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
|
|
25
|
+
convert(config) {
|
|
26
|
+
let portable = new portable_1.Portable({
|
|
27
|
+
hints: this.hints,
|
|
28
|
+
dehydrate: (value, accessPath) => {
|
|
29
|
+
// this custom dehydrate hook handles babel plugins & presets. If we're
|
|
30
|
+
// not looking at plugins or presets, continue with stock Portable
|
|
31
|
+
// behavior
|
|
32
|
+
if (accessPath.length !== 2 || (accessPath[0] !== 'plugins' && accessPath[0] !== 'presets')) {
|
|
33
|
+
return undefined;
|
|
28
34
|
}
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
// standardize to always handle an array
|
|
36
|
+
if (!Array.isArray(value)) {
|
|
37
|
+
value = [value];
|
|
31
38
|
}
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
let [plugin, argument, asName] = value;
|
|
40
|
+
// string plugins need to get resolved correctly into absolute paths,
|
|
41
|
+
// so they will really be portable
|
|
42
|
+
if (typeof plugin === 'string') {
|
|
43
|
+
plugin = this.resolveBabelPlugin(plugin);
|
|
44
|
+
}
|
|
45
|
+
// next we deal with serializability. Our Portable system already
|
|
46
|
+
// understands the protocol used by ember-cli-babel to identify plugin
|
|
47
|
+
// classes and get back to their serializable forms, so this will
|
|
48
|
+
// handle that case.
|
|
49
|
+
let dehydrated = portable.dehydrate([plugin, argument, asName], accessPath.concat('_internal'));
|
|
50
|
+
if (dehydrated.needsHydrate) {
|
|
51
|
+
// we can eliminate the need for rehydration by going through our own
|
|
52
|
+
// portable babel launcher
|
|
53
|
+
return {
|
|
54
|
+
value: [
|
|
55
|
+
path_1.join(__dirname, 'portable-babel-launcher.js'),
|
|
56
|
+
{ module: dehydrated.value[0], arg: dehydrated.value[1], hints: this.hints },
|
|
57
|
+
dehydrated.value[2] || `portable-babel-launcher-${accessPath[1]}`,
|
|
58
|
+
],
|
|
59
|
+
needsHydrate: false,
|
|
60
|
+
isParallelSafe: dehydrated.isParallelSafe,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// trim back down our array, because trailing undefined will get
|
|
65
|
+
// converted into null via json.stringify, and babel will complain
|
|
66
|
+
// about that.
|
|
67
|
+
while (dehydrated.value[dehydrated.value.length - 1] == null) {
|
|
68
|
+
dehydrated.value.pop();
|
|
69
|
+
}
|
|
70
|
+
if (dehydrated.value.length === 1) {
|
|
71
|
+
dehydrated.value = dehydrated.value[0];
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
value: dehydrated.value,
|
|
75
|
+
needsHydrate: dehydrated.needsHydrate,
|
|
76
|
+
isParallelSafe: dehydrated.isParallelSafe,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
let result = portable.dehydrate(config);
|
|
82
|
+
if (result.needsHydrate) {
|
|
83
|
+
throw new Error(`bug: portable babel configs aren't supposed to need hydration`);
|
|
34
84
|
}
|
|
35
|
-
return
|
|
85
|
+
return { config: result.value, isParallelSafe: result.isParallelSafe };
|
|
36
86
|
}
|
|
37
87
|
// babel lets you use relative paths, absolute paths, package names, and
|
|
38
88
|
// package name shorthands.
|
|
@@ -80,5 +130,4 @@ class PortableBabelConfig extends portable_plugin_config_1.PortablePluginConfig
|
|
|
80
130
|
}
|
|
81
131
|
}
|
|
82
132
|
}
|
|
83
|
-
exports.default = PortableBabelConfig;
|
|
84
133
|
//# sourceMappingURL=portable-babel-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portable-babel-config.js","sourceRoot":"","sources":["portable-babel-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"portable-babel-config.js","sourceRoot":"","sources":["portable-babel-config.ts"],"names":[],"mappings":";;;;;;AACA,+BAA4B;AAC5B,sDAA8B;AAC9B,yCAAoD;AAIpD,SAAgB,YAAY,CAC1B,MAAwB,EACxB,cAA8B,EAC9B,KAAqB;IAErB,OAAO,IAAI,mBAAmB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACxE,CAAC;AAND,oCAMC;AAED,MAAM,mBAAmB;IAIvB,YAAY,cAA8B,EAAU,KAAqB;QAArB,UAAK,GAAL,KAAK,CAAgB;QACvE,IAAI,SAAS,IAAI,cAAc,EAAE;YAC/B,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC;SACvC;aAAM;YACL,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC;YACtC,IAAI,CAAC,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,iBAAO,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC;SAC1F;IACH,CAAC;IAED,OAAO,CAAC,MAAwB;QAC9B,IAAI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,CAAC,IAAI,KAAK,kBAAkB,EAAE;gBACnC,MAAM,GAAG,CAAC;aACX;YACD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;gBAChD,MAAM,GAAG,CAAC;aACX;YACD,IAAI;gBACF,IAAI,QAAQ,CAAC;gBACb,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;oBACxB,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAC5C,QAAQ,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;iBAC9D;qBAAM;oBACL,QAAQ,GAAG,gBAAgB,IAAI,EAAE,CAAC;iBACnC;gBACD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;aAC/B;YAAC,OAAO,IAAI,EAAE;gBACb,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,EAAE;oBACpC,MAAM,IAAI,CAAC;iBACZ;gBACD,IAAI,IAAI,CAAC,OAAO,EAAE;oBAChB,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,SAAS,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;iBAChF;qBAAM;oBACL,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,EAAE,CAAC,CAAC;iBAC3D;aACF;SACF;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const portable_1 = require("./portable");
|
|
4
|
+
function babelLauncher(babel, launch, key) {
|
|
5
|
+
let p = new portable_1.Portable({ hints: launch.hints });
|
|
6
|
+
let hydrated = p.hydrate(launch);
|
|
7
|
+
let module;
|
|
8
|
+
if (typeof hydrated.module === 'string') {
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
10
|
+
module = require(hydrated.module);
|
|
11
|
+
if (module.__esModule) {
|
|
12
|
+
module = module.default;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
module = hydrated.module;
|
|
17
|
+
}
|
|
18
|
+
let plugin = module.call(this, babel, hydrated.arg, key);
|
|
19
|
+
let innerStates = new WeakMap();
|
|
20
|
+
function convertState(state) {
|
|
21
|
+
let innerState = innerStates.get(state);
|
|
22
|
+
if (!innerState) {
|
|
23
|
+
innerState = Object.assign({}, state, { opts: hydrated.arg });
|
|
24
|
+
innerStates.set(state, innerState);
|
|
25
|
+
}
|
|
26
|
+
return innerState;
|
|
27
|
+
}
|
|
28
|
+
function wrap1(original) {
|
|
29
|
+
if (typeof original === 'function') {
|
|
30
|
+
return function (state) {
|
|
31
|
+
return original.call(this, convertState(state));
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function wrap2(original) {
|
|
36
|
+
return function (path, state) {
|
|
37
|
+
return original.call(this, path, convertState(state));
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
let visitorProxy = {
|
|
41
|
+
get(target, prop) {
|
|
42
|
+
let original = target[prop];
|
|
43
|
+
if (typeof original === 'function') {
|
|
44
|
+
return wrap2(original);
|
|
45
|
+
}
|
|
46
|
+
if (original && typeof original === 'object') {
|
|
47
|
+
let wrapped = {};
|
|
48
|
+
if (typeof original.exit === 'function') {
|
|
49
|
+
wrapped.exit = wrap2(original.exit);
|
|
50
|
+
}
|
|
51
|
+
if (typeof original.enter === 'function') {
|
|
52
|
+
wrapped.enter = wrap2(original.enter);
|
|
53
|
+
}
|
|
54
|
+
return wrapped;
|
|
55
|
+
}
|
|
56
|
+
return original;
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
return new Proxy(plugin, {
|
|
60
|
+
get(target, prop) {
|
|
61
|
+
let original = target[prop];
|
|
62
|
+
switch (prop) {
|
|
63
|
+
case 'pre':
|
|
64
|
+
case 'post':
|
|
65
|
+
return wrap1(original);
|
|
66
|
+
case 'visitor':
|
|
67
|
+
return new Proxy(original, visitorProxy);
|
|
68
|
+
default:
|
|
69
|
+
return original;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
exports.default = babelLauncher;
|
|
75
|
+
//# sourceMappingURL=portable-babel-launcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable-babel-launcher.js","sourceRoot":"","sources":["portable-babel-launcher.ts"],"names":[],"mappings":";;AAAA,yCAAoD;AAEpD,SAAwB,aAAa,CAEnC,KAAU,EACV,MAAwD,EACxD,GAAW;IAEX,IAAI,CAAC,GAAG,IAAI,mBAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9C,IAAI,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,MAAM,CAAC;IACX,IAAI,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE;QACvC,iEAAiE;QACjE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,MAAM,CAAC,UAAU,EAAE;YACrB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;SACzB;KACF;SAAM;QACL,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;KAC1B;IAED,IAAI,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACzD,IAAI,WAAW,GAAG,IAAI,OAAO,EAAE,CAAC;IAEhC,SAAS,YAAY,CAAC,KAAU;QAC9B,IAAI,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxC,IA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AC;iBACvC;gBACD,OAAO,OAAO,CAAC;aAChB;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF,CAAC;IAEF,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE;QACvB,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YAC5B,QAAQ,IAAI,EAAE;gBACZ,KAAK,KAAK,CAAC;gBACX,KAAK,MAAM;oBACT,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;gBACzB,KAAK,SAAS;oBACZ,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;gBAC3C;oBACE,OAAO,QAAQ,CAAC;aACnB;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AA/ED,gCA+EC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const protocol = "__embroider_portable_values__";
|
|
2
|
+
export interface PortableResult {
|
|
3
|
+
value: any;
|
|
4
|
+
isParallelSafe: boolean;
|
|
5
|
+
needsHydrate: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface PortableHint {
|
|
8
|
+
requireFile: string;
|
|
9
|
+
useMethod?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class Portable {
|
|
12
|
+
private opts;
|
|
13
|
+
constructor(opts?: {
|
|
14
|
+
dehydrate?: (value: any, accessPath: string[]) => PortableResult | undefined;
|
|
15
|
+
hydrate?: (value: any, accessPath: string[]) => {
|
|
16
|
+
value: any;
|
|
17
|
+
} | undefined;
|
|
18
|
+
hints?: PortableHint[];
|
|
19
|
+
});
|
|
20
|
+
dehydrate(value: any, accessPath?: string[]): PortableResult;
|
|
21
|
+
hydrate(input: any, accessPath?: string[]): any;
|
|
22
|
+
get foundHints(): Map<any, PortableHint>;
|
|
23
|
+
}
|
|
@@ -1,96 +1,93 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
2
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
10
|
};
|
|
5
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
const js_handlebars_1 = require("./js-handlebars");
|
|
12
|
+
exports.Portable = exports.protocol = void 0;
|
|
8
13
|
const mapValues_1 = __importDefault(require("lodash/mapValues"));
|
|
9
14
|
const assert_never_1 = __importDefault(require("assert-never"));
|
|
10
|
-
|
|
15
|
+
const typescript_memoize_1 = require("typescript-memoize");
|
|
16
|
+
exports.protocol = '__embroider_portable_values__';
|
|
11
17
|
const { globalValues, nonce } = setupGlobals();
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
`);
|
|
16
|
-
class PortablePluginConfig {
|
|
17
|
-
constructor(config) {
|
|
18
|
-
// these properties defined this way because we want getters that are
|
|
19
|
-
// enumerable own properties, such that they will run even when people do
|
|
20
|
-
// things like Object.assign us onto another object or json stringify us.
|
|
21
|
-
this.config = config;
|
|
22
|
-
this.here = __filename;
|
|
23
|
-
this.parallelSafeFlag = true;
|
|
24
|
-
this.portable = {}; // this just makes typescript happy, we overwrite it with the defineProperty below
|
|
25
|
-
Object.defineProperty(this, 'portable', {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get() {
|
|
28
|
-
return this.ensurePortable().portable;
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
this.isParallelSafe = true; // this just makes typescript happy, we overwrite it with the defineProperty below
|
|
32
|
-
Object.defineProperty(this, 'isParallelSafe', {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get() {
|
|
35
|
-
return this.ensurePortable().isParallelSafe;
|
|
36
|
-
},
|
|
37
|
-
});
|
|
18
|
+
class Portable {
|
|
19
|
+
constructor(opts = {}) {
|
|
20
|
+
this.opts = opts;
|
|
38
21
|
}
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
|
|
22
|
+
dehydrate(value, accessPath = []) {
|
|
23
|
+
if (this.opts.dehydrate) {
|
|
24
|
+
let result = this.opts.dehydrate.call(this, value, accessPath);
|
|
25
|
+
if (result) {
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
42
28
|
}
|
|
43
|
-
return { portable: this.cachedPortable, isParallelSafe: this.parallelSafeFlag };
|
|
44
|
-
}
|
|
45
|
-
serialize() {
|
|
46
|
-
// this call to ensurePortable is not strictly needed, but it's cheap
|
|
47
|
-
// because of the cache and it keeps typescript happy since typescript can't
|
|
48
|
-
// see into our defineProperties.
|
|
49
|
-
this.ensurePortable();
|
|
50
|
-
return template({ portable: this.portable, here: this.here });
|
|
51
|
-
}
|
|
52
|
-
makePortable(value, accessPath = []) {
|
|
53
29
|
if (value === null) {
|
|
54
|
-
return value;
|
|
30
|
+
return { value, isParallelSafe: true, needsHydrate: false };
|
|
55
31
|
}
|
|
56
32
|
let broccoli = maybeBroccoli(value);
|
|
57
33
|
if (broccoli) {
|
|
58
|
-
return broccoli;
|
|
34
|
+
return { value: broccoli, isParallelSafe: true, needsHydrate: true };
|
|
59
35
|
}
|
|
60
36
|
let htmlbars = maybeHTMLBars(value);
|
|
61
37
|
if (htmlbars) {
|
|
62
|
-
return htmlbars;
|
|
38
|
+
return { value: htmlbars, isParallelSafe: true, needsHydrate: true };
|
|
63
39
|
}
|
|
64
40
|
if (Array.isArray(value)) {
|
|
65
|
-
|
|
41
|
+
let results = value.map((element, index) => this.dehydrate(element, accessPath.concat(String(index))));
|
|
42
|
+
return {
|
|
43
|
+
value: results.map(r => r.value),
|
|
44
|
+
isParallelSafe: results.every(r => r.isParallelSafe),
|
|
45
|
+
needsHydrate: results.some(r => r.needsHydrate),
|
|
46
|
+
};
|
|
66
47
|
}
|
|
67
48
|
switch (typeof value) {
|
|
68
49
|
case 'string':
|
|
69
50
|
case 'number':
|
|
70
51
|
case 'boolean':
|
|
71
52
|
case 'undefined':
|
|
72
|
-
return value;
|
|
53
|
+
return { value, isParallelSafe: true, needsHydrate: false };
|
|
73
54
|
case 'object':
|
|
74
55
|
if (Object.getPrototypeOf(value) === Object.prototype) {
|
|
75
|
-
|
|
56
|
+
let isParallelSafe = true;
|
|
57
|
+
let needsHydrate = false;
|
|
58
|
+
let result = mapValues_1.default(value, (propertyValue, key) => {
|
|
59
|
+
let result = this.dehydrate(propertyValue, accessPath.concat(key));
|
|
60
|
+
isParallelSafe = isParallelSafe && result.isParallelSafe;
|
|
61
|
+
needsHydrate = needsHydrate || result.needsHydrate;
|
|
62
|
+
return result.value;
|
|
63
|
+
});
|
|
64
|
+
return { value: result, isParallelSafe, needsHydrate };
|
|
76
65
|
}
|
|
77
66
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
67
|
+
let found = this.foundHints.get(value);
|
|
68
|
+
if (found) {
|
|
69
|
+
return {
|
|
70
|
+
value: {
|
|
71
|
+
embroiderPlaceholder: true,
|
|
72
|
+
type: 'broccoli-parallel',
|
|
73
|
+
requireFile: found.requireFile,
|
|
74
|
+
useMethod: found.useMethod,
|
|
75
|
+
},
|
|
76
|
+
isParallelSafe: true,
|
|
77
|
+
needsHydrate: true,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return globalPlaceholder(value);
|
|
90
81
|
}
|
|
91
|
-
|
|
82
|
+
hydrate(input, accessPath = []) {
|
|
83
|
+
if (this.opts.hydrate) {
|
|
84
|
+
let result = this.opts.hydrate.call(this, input, accessPath);
|
|
85
|
+
if (result) {
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
92
89
|
if (Array.isArray(input)) {
|
|
93
|
-
return input.map(element => this.
|
|
90
|
+
return input.map((element, index) => this.hydrate(element, accessPath.concat(String(index))));
|
|
94
91
|
}
|
|
95
92
|
if (input && typeof input === 'object') {
|
|
96
93
|
if (input.embroiderPlaceholder) {
|
|
@@ -110,13 +107,30 @@ class PortablePluginConfig {
|
|
|
110
107
|
}
|
|
111
108
|
}
|
|
112
109
|
else {
|
|
113
|
-
return mapValues_1.default(input, value => this.
|
|
110
|
+
return mapValues_1.default(input, (value, key) => this.hydrate(value, accessPath.concat(key)));
|
|
114
111
|
}
|
|
115
112
|
}
|
|
116
113
|
return input;
|
|
117
114
|
}
|
|
115
|
+
get foundHints() {
|
|
116
|
+
let found = new Map();
|
|
117
|
+
if (this.opts.hints) {
|
|
118
|
+
for (let hint of this.opts.hints) {
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
120
|
+
let mod = require(hint.requireFile);
|
|
121
|
+
if (hint.useMethod) {
|
|
122
|
+
mod = mod[hint.useMethod];
|
|
123
|
+
}
|
|
124
|
+
found.set(mod, hint);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return found;
|
|
128
|
+
}
|
|
118
129
|
}
|
|
119
|
-
|
|
130
|
+
__decorate([
|
|
131
|
+
typescript_memoize_1.Memoize()
|
|
132
|
+
], Portable.prototype, "foundHints", null);
|
|
133
|
+
exports.Portable = Portable;
|
|
120
134
|
function setupGlobals() {
|
|
121
135
|
let G = global;
|
|
122
136
|
if (!G[exports.protocol]) {
|
|
@@ -184,4 +198,18 @@ function buildHTMLBars(parallelApiInfo) {
|
|
|
184
198
|
}
|
|
185
199
|
return requiredStuff[parallelApiInfo.buildUsing](parallelApiInfo.params);
|
|
186
200
|
}
|
|
187
|
-
|
|
201
|
+
function globalPlaceholder(value) {
|
|
202
|
+
let index = globalValues.length;
|
|
203
|
+
globalValues.push(value);
|
|
204
|
+
return {
|
|
205
|
+
value: {
|
|
206
|
+
embroiderPlaceholder: true,
|
|
207
|
+
type: 'global',
|
|
208
|
+
nonce,
|
|
209
|
+
index,
|
|
210
|
+
},
|
|
211
|
+
isParallelSafe: false,
|
|
212
|
+
needsHydrate: true,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=portable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable.js","sourceRoot":"","sources":["portable.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAAyC;AACzC,gEAAuC;AACvC,2DAA6C;AAEhC,QAAA,QAAQ,GAAG,+BAA+B,CAAC;AACxD,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC;AAa/C,MAAa,QAAQ;IACnB,YACU,OAIJ,EAAE;QAJE,SAAI,GAAJ,IAAI,CAIN;IACL,CAAC;IAEJ,SAAS,CAAC,KAAU,EAAE,aAAuB,EAAE;QAC7C,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACvB,IAAI,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;YAC/D,IAAI,MAAM,EAAE;gBACV,OAAO,MAAM,CAAC;aACf;SACF;QAED,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;SAC7D;QAED,IAAI,QAAQ,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,QAAQ,EAAE;YACZ,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,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H;AACH,CAAC;AAED,SAAS,aAAa,CAAC,eAA4C;IACjE,iEAAiE;IACjE,IAAI,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IACzD,IAAI,OAAO,aAAa,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,UAAU,EAAE;QACnE,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,eAAe,CAAC,UAAU,GAAG,8BAA8B,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;KAClH;IACD,OAAO,aAAa,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAU;IACnC,IAAI,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC;IAChC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,OAAO;QACL,KAAK,EAAE;YACL,oBAAoB,EAAE,IAAI;YAC1B,IAAI,EAAE,QAAQ;YACd,KAAK;YACL,KAAK;SACN;QACD,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE,IAAI;KACnB,CAAC;AACJ,CAAC"}
|
package/src/resolver.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import TemplateCompiler from './template-compiler';
|
|
1
|
+
import { TemplateCompiler } from './template-compiler';
|
|
2
2
|
export interface ResolvedDep {
|
|
3
3
|
runtimeName: string;
|
|
4
4
|
path: string;
|
|
@@ -7,5 +7,6 @@ export interface ResolvedDep {
|
|
|
7
7
|
export interface Resolver {
|
|
8
8
|
astTransformer(templateCompiler: TemplateCompiler): unknown;
|
|
9
9
|
dependenciesOf(moduleName: string): ResolvedDep[];
|
|
10
|
-
|
|
10
|
+
absPathToRuntimePath(absPath: string): string;
|
|
11
|
+
absPathToRuntimeName(absPath: string): string;
|
|
11
12
|
}
|
package/src/stage.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node } from 'broccoli-node-api';
|
|
2
2
|
import PackageCache from './package-cache';
|
|
3
3
|
export default interface Stage {
|
|
4
|
-
readonly tree:
|
|
4
|
+
readonly tree: Node;
|
|
5
5
|
readonly inputPath: string;
|
|
6
6
|
ready(): Promise<{
|
|
7
7
|
readonly outputPath: string;
|
|
@@ -1,33 +1,26 @@
|
|
|
1
1
|
import { Resolver, ResolvedDep } from './resolver';
|
|
2
|
-
import {
|
|
2
|
+
import { Node } from 'broccoli-node-api';
|
|
3
3
|
import { PluginItem } from '@babel/core';
|
|
4
|
+
import { PortableHint } from './portable';
|
|
4
5
|
export interface Plugins {
|
|
5
6
|
ast?: unknown[];
|
|
6
7
|
}
|
|
7
8
|
interface AST {
|
|
8
9
|
_deliberatelyOpaque: 'AST';
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
export declare function templateCompilerModule(params: TemplateCompilerParams, hints: PortableHint[]): {
|
|
12
|
+
src: string;
|
|
13
|
+
isParallelSafe: boolean;
|
|
14
|
+
};
|
|
15
|
+
export interface TemplateCompilerParams {
|
|
11
16
|
compilerPath: string;
|
|
12
17
|
resolver?: Resolver;
|
|
13
18
|
EmberENV: unknown;
|
|
14
19
|
plugins: Plugins;
|
|
15
20
|
}
|
|
16
|
-
export declare
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
private params;
|
|
20
|
-
isParallelSafe: boolean;
|
|
21
|
-
constructor(params: SetupCompilerParams);
|
|
22
|
-
private get portableConfig();
|
|
23
|
-
get _parallelBabel(): {
|
|
24
|
-
requireFile: string;
|
|
25
|
-
buildUsing: string;
|
|
26
|
-
params: {
|
|
27
|
-
portableParams: object;
|
|
28
|
-
};
|
|
29
|
-
} | undefined;
|
|
30
|
-
serialize(): string;
|
|
21
|
+
export declare class TemplateCompiler {
|
|
22
|
+
params: TemplateCompilerParams;
|
|
23
|
+
constructor(params: TemplateCompilerParams);
|
|
31
24
|
private get syntax();
|
|
32
25
|
get cacheKey(): string;
|
|
33
26
|
private setup;
|
|
@@ -39,7 +32,7 @@ export default class TemplateCompiler {
|
|
|
39
32
|
compile(moduleName: string, contents: string): string;
|
|
40
33
|
applyTransforms(moduleName: string, contents: string): string;
|
|
41
34
|
parse(moduleName: string, contents: string): AST;
|
|
42
|
-
applyTransformsToTree(tree:
|
|
35
|
+
applyTransformsToTree(tree: Node): Node;
|
|
43
36
|
inlineTransformsBabelPlugin(): PluginItem;
|
|
44
37
|
baseDir(): string;
|
|
45
38
|
static isInlinePrecompilePlugin(item: PluginItem): boolean;
|