@shuvi/toolpack 1.0.0-rc.5 → 1.0.0-rc.8
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.
|
@@ -225,7 +225,7 @@ function baseWebpackChain({ dev, outputDir, parcelCss, experimental, compiler, p
|
|
|
225
225
|
if (dev) {
|
|
226
226
|
// For webpack-dev-middleware usage
|
|
227
227
|
config.watchOptions({
|
|
228
|
-
aggregateTimeout:
|
|
228
|
+
aggregateTimeout: 5,
|
|
229
229
|
ignored: ['**/.git/**']
|
|
230
230
|
});
|
|
231
231
|
config.set('infrastructureLogging', {
|
|
@@ -5,11 +5,11 @@ const base_1 = require("./base");
|
|
|
5
5
|
const external_1 = require("./parts/external");
|
|
6
6
|
const style_1 = require("./parts/style");
|
|
7
7
|
function createNodeWebpackChain(options) {
|
|
8
|
-
const { webpackHelpers, typescript } = options;
|
|
8
|
+
const { webpackHelpers, typescript, dev } = options;
|
|
9
9
|
const chain = (0, base_1.baseWebpackChain)(options);
|
|
10
10
|
const useTypeScript = !!(typescript === null || typescript === void 0 ? void 0 : typescript.useTypeScript);
|
|
11
11
|
chain.target('node');
|
|
12
|
-
chain.devtool(false);
|
|
12
|
+
chain.devtool(dev ? 'cheap-module-source-map' : false);
|
|
13
13
|
chain.resolve.extensions.merge([
|
|
14
14
|
...(useTypeScript ? ['.ts', '.tsx'] : []),
|
|
15
15
|
'.js',
|
|
@@ -75,7 +75,6 @@ class ModuleReplacePlugin {
|
|
|
75
75
|
moduleInfos.forEach(moduleInfo => {
|
|
76
76
|
moduleInfo.action = ModuleAction.RESTORE;
|
|
77
77
|
handler.pending.set(moduleInfo.compiler, false);
|
|
78
|
-
moduleInfo.compiler.hooks.invalid.call('noop', new Date().getTime());
|
|
79
78
|
});
|
|
80
79
|
return new Promise(resolve => {
|
|
81
80
|
handler.resolve = resolve;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shuvi/toolpack",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/shuvijs/shuvi.git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"node": ">= 12.0.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@shuvi/compiler": "1.0.0-rc.
|
|
23
|
+
"@shuvi/compiler": "1.0.0-rc.8",
|
|
24
24
|
"@babel/core": "7.12.10",
|
|
25
25
|
"@babel/plugin-proposal-class-properties": "7.12.1",
|
|
26
26
|
"@babel/plugin-proposal-nullish-coalescing-operator": "7.10.1",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@babel/preset-typescript": "7.12.7",
|
|
36
36
|
"@babel/runtime": "7.12.5",
|
|
37
37
|
"@parcel/css": "1.2.0",
|
|
38
|
-
"@shuvi/shared": "1.0.0-rc.
|
|
39
|
-
"@shuvi/utils": "1.0.0-rc.
|
|
38
|
+
"@shuvi/shared": "1.0.0-rc.8",
|
|
39
|
+
"@shuvi/utils": "1.0.0-rc.8",
|
|
40
40
|
"babel-loader": "8.2.2",
|
|
41
41
|
"babel-plugin-syntax-jsx": "6.18.0",
|
|
42
42
|
"babel-plugin-transform-define": "2.0.0",
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.buildToString = exports.build = void 0;
|
|
36
|
-
const file_1 = require("@shuvi/utils/lib/file");
|
|
37
|
-
const esbuild = __importStar(require("esbuild"));
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
const loader = {
|
|
40
|
-
'.js': 'jsx',
|
|
41
|
-
'.jsx': 'jsx',
|
|
42
|
-
'.json': 'json',
|
|
43
|
-
'.ts': 'ts',
|
|
44
|
-
'.tsx': 'tsx'
|
|
45
|
-
};
|
|
46
|
-
function build(dir, mode) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
yield esbuild.build({
|
|
49
|
-
entryPoints: [path.join(dir, 'loaders.js')],
|
|
50
|
-
format: 'esm',
|
|
51
|
-
platform: 'browser',
|
|
52
|
-
target: 'esnext',
|
|
53
|
-
loader,
|
|
54
|
-
watch: mode === 'development',
|
|
55
|
-
bundle: true,
|
|
56
|
-
logLevel: 'error',
|
|
57
|
-
external: ['react', '@shuvi/*'],
|
|
58
|
-
pure: ['loader'],
|
|
59
|
-
treeShaking: true,
|
|
60
|
-
outfile: path.join(dir, 'page-loaders.js'),
|
|
61
|
-
plugins: [
|
|
62
|
-
{
|
|
63
|
-
name: 'imports',
|
|
64
|
-
setup(build) {
|
|
65
|
-
let entry;
|
|
66
|
-
build.onResolve({ filter: /.*/ }, args => {
|
|
67
|
-
if (args.kind === 'entry-point')
|
|
68
|
-
entry = args.path;
|
|
69
|
-
if (args.kind === 'entry-point' || args.importer === entry) {
|
|
70
|
-
const resolved = (0, file_1.resolveFile)(path.resolve(args.resolveDir, args.path));
|
|
71
|
-
return { path: resolved };
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
path: !args.path.startsWith('.') && !args.path.startsWith('/')
|
|
75
|
-
? args.path
|
|
76
|
-
: path.resolve(args.resolveDir, args.path),
|
|
77
|
-
external: true,
|
|
78
|
-
sideEffects: false
|
|
79
|
-
};
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
exports.build = build;
|
|
88
|
-
function buildToString(entry) {
|
|
89
|
-
var _a;
|
|
90
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
const result = yield esbuild.build({
|
|
92
|
-
entryPoints: [entry],
|
|
93
|
-
format: 'esm',
|
|
94
|
-
platform: 'browser',
|
|
95
|
-
target: 'esnext',
|
|
96
|
-
loader,
|
|
97
|
-
bundle: true,
|
|
98
|
-
logLevel: 'error',
|
|
99
|
-
external: ['react', '@shuvi/*'],
|
|
100
|
-
pure: ['loader'],
|
|
101
|
-
treeShaking: true,
|
|
102
|
-
outdir: 'out',
|
|
103
|
-
write: false,
|
|
104
|
-
plugins: [
|
|
105
|
-
{
|
|
106
|
-
name: 'imports',
|
|
107
|
-
setup(build) {
|
|
108
|
-
let entry;
|
|
109
|
-
build.onResolve({ filter: /.*/ }, args => {
|
|
110
|
-
if (args.kind === 'entry-point')
|
|
111
|
-
entry = args.path;
|
|
112
|
-
if (args.kind === 'entry-point' || args.importer === entry) {
|
|
113
|
-
const resolved = (0, file_1.resolveFile)(path.resolve(args.resolveDir, args.path));
|
|
114
|
-
return { path: resolved };
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
path: !args.path.startsWith('.') && !args.path.startsWith('/')
|
|
118
|
-
? args.path
|
|
119
|
-
: path.resolve(args.resolveDir, args.path),
|
|
120
|
-
external: true,
|
|
121
|
-
sideEffects: false
|
|
122
|
-
};
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
]
|
|
127
|
-
});
|
|
128
|
-
return (_a = result.outputFiles[0]) === null || _a === void 0 ? void 0 : _a.text;
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
exports.buildToString = buildToString;
|