@embroider/test-setup 3.0.4-unstable.fad2387 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +9 -10
  3. package/src/index.js +5 -22
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Edward Faulkner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/test-setup",
3
- "version": "3.0.4-unstable.fad2387",
3
+ "version": "4.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/embroider-build/embroider.git",
@@ -12,20 +12,19 @@
12
12
  "src/index.js"
13
13
  ],
14
14
  "dependencies": {
15
- "broccoli-plugin": "^4.0.7",
16
15
  "lodash": "^4.17.21",
17
16
  "resolve": "^1.20.0"
18
17
  },
19
18
  "devDependencies": {
20
- "@embroider/compat": "3.4.8-unstable.fad2387",
21
- "@embroider/core": "3.4.8-unstable.fad2387",
22
- "@embroider/webpack": "3.2.4-unstable.fad2387",
23
- "@types/lodash": "^4.14.170"
19
+ "@types/lodash": "^4.14.170",
20
+ "@embroider/compat": "^3.4.8",
21
+ "@embroider/core": "^3.4.8",
22
+ "@embroider/webpack": "^4.0.0"
24
23
  },
25
24
  "peerDependencies": {
26
- "@embroider/compat": "3.4.8-unstable.fad2387",
27
- "@embroider/core": "3.4.8-unstable.fad2387",
28
- "@embroider/webpack": "3.2.4-unstable.fad2387"
25
+ "@embroider/core": "^3.4.8",
26
+ "@embroider/compat": "^3.4.8",
27
+ "@embroider/webpack": "^4.0.0"
29
28
  },
30
29
  "peerDependenciesMeta": {
31
30
  "@embroider/compat": {
@@ -41,4 +40,4 @@
41
40
  "engines": {
42
41
  "node": "12.* || 14.* || >= 16"
43
42
  }
44
- }
43
+ }
package/src/index.js CHANGED
@@ -1,11 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  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");
9
4
  // eslint-disable-next-line @typescript-eslint/no-require-imports
10
5
  const ourPeerDeps = require('../package.json').peerDependencies;
11
6
  const embroiderDevDeps = {
@@ -29,6 +24,10 @@ function maybeEmbroider(app, opts = {}) {
29
24
  // - we don't want to load any of these things until they're actually needed;
30
25
  // - we can't use `await import()` because this function needs to be synchronous to go inside ember-cli-build.js
31
26
  /* 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
+ }));
32
31
  let Compat = require(require.resolve('@embroider/compat', {
33
32
  paths: [app.project.root],
34
33
  // eslint-disable-next-line @typescript-eslint/consistent-type-imports
@@ -46,25 +45,9 @@ function maybeEmbroider(app, opts = {}) {
46
45
  throw new Error(`No such scenario EMBROIDER_TEST_SETUP_OPTIONS=${process.env.EMBROIDER_TEST_SETUP_OPTIONS}`);
47
46
  }
48
47
  }
49
- if (process.env.EMBROIDER_PREBUILD) {
50
- return Compat.prebuild(app, opts);
51
- }
52
- return new BuildWithVite([]);
48
+ return Compat.compatBuild(app, Webpack, opts);
53
49
  }
54
50
  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
- }
68
51
  function embroiderSafe(extension) {
69
52
  return extendScenario({
70
53
  name: 'embroider-safe',