@umijs/bundler-webpack 4.0.0-rc.12 → 4.0.0-rc.15
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/client/client/client.js +15 -7
- package/compiled/fork-ts-checker-webpack-plugin/index.js +1 -1
- package/compiled/webpack/BasicEffectRulePlugin.js +1 -0
- package/compiled/webpack/BasicMatcherRulePlugin.js +1 -0
- package/compiled/webpack/ObjectMatcherRulePlugin.js +1 -0
- package/compiled/webpack/RuleSetCompiler.js +1 -0
- package/compiled/webpack/UseEffectRulePlugin.js +1 -0
- package/compiled/webpack/deepImports.json +6 -1
- package/compiled/webpack/index.js +68 -52
- package/compiled/webpack/types.d.ts +606 -171
- package/compiled/webpack-manifest-plugin/index.js +1 -1
- package/dist/build.d.ts +1 -0
- package/dist/build.js +48 -57
- package/dist/cli.js +6 -15
- package/dist/client/client.js +48 -53
- package/dist/config/_sampleFeature.js +6 -17
- package/dist/config/assetRules.js +44 -55
- package/dist/config/bundleAnalyzerPlugin.js +12 -23
- package/dist/config/compressPlugin.js +68 -76
- package/dist/config/config.d.ts +2 -0
- package/dist/config/config.js +177 -182
- package/dist/config/copyPlugin.js +29 -40
- package/dist/config/cssRules.js +93 -83
- package/dist/config/definePlugin.js +11 -19
- package/dist/config/detectDeadCodePlugin.js +16 -21
- package/dist/config/fastRefreshPlugin.js +11 -22
- package/dist/config/forkTSCheckerPlugin.js +11 -22
- package/dist/config/harmonyLinkingErrorPlugin.js +3 -14
- package/dist/config/ignorePlugin.js +10 -21
- package/dist/config/javaScriptRules.d.ts +1 -0
- package/dist/config/javaScriptRules.js +149 -136
- package/dist/config/manifestPlugin.js +10 -18
- package/dist/config/miniCSSExtractPlugin.js +12 -23
- package/dist/config/nodePolyfill.js +14 -20
- package/dist/config/nodePrefixPlugin.js +8 -19
- package/dist/config/progressPlugin.js +7 -18
- package/dist/config/purgecssWebpackPlugin.js +15 -26
- package/dist/config/speedMeasureWebpackPlugin.js +12 -23
- package/dist/config/svgRules.js +43 -47
- package/dist/dev.d.ts +1 -0
- package/dist/dev.js +103 -99
- package/dist/loader/svgr.js +4 -13
- package/dist/loader/swc.js +9 -14
- package/dist/plugins/ESBuildCSSMinifyPlugin.js +23 -34
- package/dist/plugins/ParcelCSSMinifyPlugin.js +30 -32
- package/dist/schema.js +2 -0
- package/dist/server/server.d.ts +1 -1
- package/dist/server/server.js +161 -182
- package/dist/server/ws.d.ts +3 -1
- package/dist/types.d.ts +3 -6
- package/package.json +8 -10
- package/compiled/tapable/LICENSE +0 -21
- package/compiled/tapable/index.js +0 -1
- package/compiled/tapable/package.json +0 -1
- package/compiled/tapable/tapable.d.ts +0 -116
- package/dist/server/https.d.ts +0 -5
- package/dist/server/https.js +0 -73
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
type FixedSizeArray<T extends number, U> = T extends 0
|
|
2
|
-
? void[]
|
|
3
|
-
: ReadonlyArray<U> & {
|
|
4
|
-
0: U;
|
|
5
|
-
length: T;
|
|
6
|
-
};
|
|
7
|
-
type Measure<T extends number> = T extends 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
|
|
8
|
-
? T
|
|
9
|
-
: never;
|
|
10
|
-
type Append<T extends any[], U> = {
|
|
11
|
-
0: [U];
|
|
12
|
-
1: [T[0], U];
|
|
13
|
-
2: [T[0], T[1], U];
|
|
14
|
-
3: [T[0], T[1], T[2], U];
|
|
15
|
-
4: [T[0], T[1], T[2], T[3], U];
|
|
16
|
-
5: [T[0], T[1], T[2], T[3], T[4], U];
|
|
17
|
-
6: [T[0], T[1], T[2], T[3], T[4], T[5], U];
|
|
18
|
-
7: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], U];
|
|
19
|
-
8: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], U];
|
|
20
|
-
}[Measure<T["length"]>];
|
|
21
|
-
type AsArray<T> = T extends any[] ? T : [T];
|
|
22
|
-
|
|
23
|
-
declare class UnsetAdditionalOptions {
|
|
24
|
-
_UnsetAdditionalOptions: true
|
|
25
|
-
}
|
|
26
|
-
type IfSet<X> = X extends UnsetAdditionalOptions ? {} : X;
|
|
27
|
-
|
|
28
|
-
type Callback<E, T> = (error: E | null, result?: T) => void;
|
|
29
|
-
type InnerCallback<E, T> = (error?: E | null | false, result?: T) => void;
|
|
30
|
-
|
|
31
|
-
type FullTap = Tap & {
|
|
32
|
-
type: "sync" | "async" | "promise",
|
|
33
|
-
fn: Function
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
type Tap = TapOptions & {
|
|
37
|
-
name: string;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
type TapOptions = {
|
|
41
|
-
before?: string;
|
|
42
|
-
stage?: number;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
interface HookInterceptor<T, R, AdditionalOptions = UnsetAdditionalOptions> {
|
|
46
|
-
name?: string;
|
|
47
|
-
tap?: (tap: FullTap & IfSet<AdditionalOptions>) => void;
|
|
48
|
-
call?: (...args: any[]) => void;
|
|
49
|
-
loop?: (...args: any[]) => void;
|
|
50
|
-
error?: (err: Error) => void;
|
|
51
|
-
result?: (result: R) => void;
|
|
52
|
-
done?: () => void;
|
|
53
|
-
register?: (tap: FullTap & IfSet<AdditionalOptions>) => FullTap & IfSet<AdditionalOptions>;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
type ArgumentNames<T extends any[]> = FixedSizeArray<T["length"], string>;
|
|
57
|
-
|
|
58
|
-
declare class Hook<T, R, AdditionalOptions = UnsetAdditionalOptions> {
|
|
59
|
-
constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
|
|
60
|
-
name: string | undefined;
|
|
61
|
-
taps: FullTap[];
|
|
62
|
-
intercept(interceptor: HookInterceptor<T, R, AdditionalOptions>): void;
|
|
63
|
-
isUsed(): boolean;
|
|
64
|
-
callAsync(...args: Append<AsArray<T>, Callback<Error, R>>): void;
|
|
65
|
-
promise(...args: AsArray<T>): Promise<R>;
|
|
66
|
-
tap(options: string | Tap & IfSet<AdditionalOptions>, fn: (...args: AsArray<T>) => R): void;
|
|
67
|
-
withOptions(options: TapOptions & IfSet<AdditionalOptions>): Omit<this, "call" | "callAsync" | "promise">;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export class SyncHook<T, R = void, AdditionalOptions = UnsetAdditionalOptions> extends Hook<T, R, AdditionalOptions> {
|
|
71
|
-
call(...args: AsArray<T>): R;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export class SyncBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends SyncHook<T, R, AdditionalOptions> {}
|
|
75
|
-
export class SyncLoopHook<T, AdditionalOptions = UnsetAdditionalOptions> extends SyncHook<T, void, AdditionalOptions> {}
|
|
76
|
-
export class SyncWaterfallHook<T, AdditionalOptions = UnsetAdditionalOptions> extends SyncHook<T, AsArray<T>[0], AdditionalOptions> {}
|
|
77
|
-
|
|
78
|
-
declare class AsyncHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends Hook<T, R, AdditionalOptions> {
|
|
79
|
-
tapAsync(
|
|
80
|
-
options: string | Tap & IfSet<AdditionalOptions>,
|
|
81
|
-
fn: (...args: Append<AsArray<T>, InnerCallback<Error, R>>) => void
|
|
82
|
-
): void;
|
|
83
|
-
tapPromise(
|
|
84
|
-
options: string | Tap & IfSet<AdditionalOptions>,
|
|
85
|
-
fn: (...args: AsArray<T>) => Promise<R>
|
|
86
|
-
): void;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export class AsyncParallelHook<T, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<T, void, AdditionalOptions> {}
|
|
90
|
-
export class AsyncParallelBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<T, R, AdditionalOptions> {}
|
|
91
|
-
export class AsyncSeriesHook<T, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<T, void, AdditionalOptions> {}
|
|
92
|
-
export class AsyncSeriesBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<T, R, AdditionalOptions> {}
|
|
93
|
-
export class AsyncSeriesLoopHook<T, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<T, void, AdditionalOptions> {}
|
|
94
|
-
export class AsyncSeriesWaterfallHook<T, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<T, AsArray<T>[0], AdditionalOptions> {}
|
|
95
|
-
|
|
96
|
-
type HookFactory<H> = (key: any, hook?: H) => H;
|
|
97
|
-
|
|
98
|
-
interface HookMapInterceptor<H> {
|
|
99
|
-
factory?: HookFactory<H>;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export class HookMap<H> {
|
|
103
|
-
constructor(factory: HookFactory<H>, name?: string);
|
|
104
|
-
name: string | undefined;
|
|
105
|
-
get(key: any): H | undefined;
|
|
106
|
-
for(key: any): H;
|
|
107
|
-
intercept(interceptor: HookMapInterceptor<H>): void;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export class MultiHook<H> {
|
|
111
|
-
constructor(hooks: H[], name?: string);
|
|
112
|
-
name: string | undefined;
|
|
113
|
-
tap(options: string | Tap, fn?: Function): void;
|
|
114
|
-
tapAsync(options: string | Tap, fn?: Function): void;
|
|
115
|
-
tapPromise(options: string | Tap, fn?: Function): void;
|
|
116
|
-
}
|
package/dist/server/https.d.ts
DELETED
package/dist/server/https.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.createHttpsServer = void 0;
|
|
16
|
-
const utils_1 = require("@umijs/utils");
|
|
17
|
-
const fs_1 = require("fs");
|
|
18
|
-
const https_1 = __importDefault(require("https"));
|
|
19
|
-
const path_1 = require("path");
|
|
20
|
-
const defaultHttpsHosts = ['localhost', '127.0.0.1'];
|
|
21
|
-
function createHttpsServer(app, httpsConfig) {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
utils_1.logger.wait('[HTTPS] Starting service in https mode...');
|
|
24
|
-
// Check if mkcert is installed
|
|
25
|
-
try {
|
|
26
|
-
yield utils_1.execa.execa('mkcert', ['--version']);
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
utils_1.logger.error('[HTTPS] The mkcert has not been installed.');
|
|
30
|
-
utils_1.logger.info('[HTTPS] Please follow the guide to install manually.');
|
|
31
|
-
switch (process.platform) {
|
|
32
|
-
case 'darwin':
|
|
33
|
-
console.log(utils_1.chalk.green('$ brew install mkcert'));
|
|
34
|
-
console.log(utils_1.chalk.gray('# If you use firefox, please install nss.'));
|
|
35
|
-
console.log(utils_1.chalk.green('$ brew install nss'));
|
|
36
|
-
console.log(utils_1.chalk.green('$ mkcert -install'));
|
|
37
|
-
break;
|
|
38
|
-
case 'win32':
|
|
39
|
-
console.log(utils_1.chalk.green('Checkout https://github.com/FiloSottile/mkcert#windows'));
|
|
40
|
-
break;
|
|
41
|
-
case 'linux':
|
|
42
|
-
console.log(utils_1.chalk.green('Checkout https://github.com/FiloSottile/mkcert#linux'));
|
|
43
|
-
break;
|
|
44
|
-
default:
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
throw new Error(`[HTTPS] mkcert not found.`);
|
|
48
|
-
}
|
|
49
|
-
let { key, cert, hosts } = httpsConfig;
|
|
50
|
-
hosts = hosts || defaultHttpsHosts;
|
|
51
|
-
if (!key || !cert) {
|
|
52
|
-
key = (0, path_1.join)(__dirname, 'umi.key.pem');
|
|
53
|
-
cert = (0, path_1.join)(__dirname, 'umi.pem');
|
|
54
|
-
}
|
|
55
|
-
// Generate cert and key files if they are not exist.
|
|
56
|
-
if (!(0, fs_1.existsSync)(key) || !(0, fs_1.existsSync)(cert)) {
|
|
57
|
-
utils_1.logger.wait('[HTTPS] Generating cert and key files...');
|
|
58
|
-
yield utils_1.execa.execa('mkcert', [
|
|
59
|
-
'-cert-file',
|
|
60
|
-
cert,
|
|
61
|
-
'-key-file',
|
|
62
|
-
key,
|
|
63
|
-
...hosts,
|
|
64
|
-
]);
|
|
65
|
-
}
|
|
66
|
-
// Create server
|
|
67
|
-
return https_1.default.createServer({
|
|
68
|
-
key: (0, fs_1.readFileSync)(key, 'utf-8'),
|
|
69
|
-
cert: (0, fs_1.readFileSync)(cert, 'utf-8'),
|
|
70
|
-
}, app);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
exports.createHttpsServer = createHttpsServer;
|