@embroider/test-setup 3.0.4-unstable.e1142b1 → 3.0.4-unstable.ea2a455
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +8 -7
- package/src/index.js +22 -5
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@embroider/test-setup",
|
3
|
-
"version": "3.0.4-unstable.
|
3
|
+
"version": "3.0.4-unstable.ea2a455",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "https://github.com/embroider-build/embroider.git",
|
@@ -12,19 +12,20 @@
|
|
12
12
|
"src/index.js"
|
13
13
|
],
|
14
14
|
"dependencies": {
|
15
|
+
"broccoli-plugin": "^4.0.7",
|
15
16
|
"lodash": "^4.17.21",
|
16
17
|
"resolve": "^1.20.0"
|
17
18
|
},
|
18
19
|
"devDependencies": {
|
19
|
-
"@embroider/compat": "3.4.6-unstable.
|
20
|
-
"@embroider/core": "3.4.6-unstable.
|
21
|
-
"@embroider/webpack": "3.2.3-unstable.
|
20
|
+
"@embroider/compat": "3.4.6-unstable.ea2a455",
|
21
|
+
"@embroider/core": "3.4.6-unstable.ea2a455",
|
22
|
+
"@embroider/webpack": "3.2.3-unstable.ea2a455",
|
22
23
|
"@types/lodash": "^4.14.170"
|
23
24
|
},
|
24
25
|
"peerDependencies": {
|
25
|
-
"@embroider/compat": "3.4.6-unstable.
|
26
|
-
"@embroider/core": "3.4.6-unstable.
|
27
|
-
"@embroider/webpack": "3.2.3-unstable.
|
26
|
+
"@embroider/compat": "3.4.6-unstable.ea2a455",
|
27
|
+
"@embroider/core": "3.4.6-unstable.ea2a455",
|
28
|
+
"@embroider/webpack": "3.2.3-unstable.ea2a455"
|
28
29
|
},
|
29
30
|
"peerDependenciesMeta": {
|
30
31
|
"@embroider/compat": {
|
package/src/index.js
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.embroiderOptimized = exports.embroiderSafe = exports.maybeEmbroider = void 0;
|
7
|
+
const broccoli_plugin_1 = __importDefault(require("broccoli-plugin"));
|
8
|
+
const child_process_1 = require("child_process");
|
4
9
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
5
10
|
const ourPeerDeps = require('../package.json').peerDependencies;
|
6
11
|
const embroiderDevDeps = {
|
@@ -24,10 +29,6 @@ function maybeEmbroider(app, opts = {}) {
|
|
24
29
|
// - we don't want to load any of these things until they're actually needed;
|
25
30
|
// - we can't use `await import()` because this function needs to be synchronous to go inside ember-cli-build.js
|
26
31
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
27
|
-
let { Webpack } = require(require.resolve('@embroider/webpack', {
|
28
|
-
paths: [app.project.root],
|
29
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
30
|
-
}));
|
31
32
|
let Compat = require(require.resolve('@embroider/compat', {
|
32
33
|
paths: [app.project.root],
|
33
34
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
@@ -45,9 +46,25 @@ function maybeEmbroider(app, opts = {}) {
|
|
45
46
|
throw new Error(`No such scenario EMBROIDER_TEST_SETUP_OPTIONS=${process.env.EMBROIDER_TEST_SETUP_OPTIONS}`);
|
46
47
|
}
|
47
48
|
}
|
48
|
-
|
49
|
+
if (process.env.EMBROIDER_PREBUILD) {
|
50
|
+
return Compat.prebuild(app, opts);
|
51
|
+
}
|
52
|
+
return new BuildWithVite([]);
|
49
53
|
}
|
50
54
|
exports.maybeEmbroider = maybeEmbroider;
|
55
|
+
class BuildWithVite extends broccoli_plugin_1.default {
|
56
|
+
build() {
|
57
|
+
return new Promise((resolve, reject) => {
|
58
|
+
const child = (0, child_process_1.spawn)(`npx vite build --outDir ${this.outputPath}`, {
|
59
|
+
cwd: process.cwd(),
|
60
|
+
shell: true,
|
61
|
+
stdio: 'inherit',
|
62
|
+
env: { ...process.env },
|
63
|
+
});
|
64
|
+
child.on('exit', code => (code === 0 ? resolve() : reject(new Error('vite build failed'))));
|
65
|
+
});
|
66
|
+
}
|
67
|
+
}
|
51
68
|
function embroiderSafe(extension) {
|
52
69
|
return extendScenario({
|
53
70
|
name: 'embroider-safe',
|