@shuvi/toolpack 0.0.1-pre.1
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/lib/babel/plugins/auto-css-modules.d.ts +7 -0
- package/lib/babel/plugins/auto-css-modules.js +24 -0
- package/lib/babel/plugins/jsx-pragma.d.ts +4 -0
- package/lib/babel/plugins/jsx-pragma.js +77 -0
- package/lib/babel/plugins/loadable-plugin.d.ts +24 -0
- package/lib/babel/plugins/loadable-plugin.js +105 -0
- package/lib/babel/plugins/optimize-hook-destructuring.d.ts +4 -0
- package/lib/babel/plugins/optimize-hook-destructuring.js +59 -0
- package/lib/babel/preset.d.ts +14 -0
- package/lib/babel/preset.js +106 -0
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +3 -0
- package/lib/utils/emptyComponent.d.ts +1 -0
- package/lib/utils/emptyComponent.js +7 -0
- package/lib/utils/forkTsCheckerWebpackPlugin.d.ts +4 -0
- package/lib/utils/forkTsCheckerWebpackPlugin.js +9 -0
- package/lib/utils/formatWebpackMessages.d.ts +5 -0
- package/lib/utils/formatWebpackMessages.js +91 -0
- package/lib/utils/hotDevClient/eventsource.d.ts +1 -0
- package/lib/utils/hotDevClient/eventsource.js +63 -0
- package/lib/utils/hotDevClient/index.d.ts +4 -0
- package/lib/utils/hotDevClient/index.js +304 -0
- package/lib/utils/verifyTypeScriptSetup.d.ts +5 -0
- package/lib/utils/verifyTypeScriptSetup.js +229 -0
- package/lib/webpack/config/base.d.ts +16 -0
- package/lib/webpack/config/base.js +236 -0
- package/lib/webpack/config/browser.d.ts +8 -0
- package/lib/webpack/config/browser.js +147 -0
- package/lib/webpack/config/index.d.ts +4 -0
- package/lib/webpack/config/index.js +9 -0
- package/lib/webpack/config/node.d.ts +7 -0
- package/lib/webpack/config/node.js +55 -0
- package/lib/webpack/config/parts/external.d.ts +4 -0
- package/lib/webpack/config/parts/external.js +91 -0
- package/lib/webpack/config/parts/helpers.d.ts +3 -0
- package/lib/webpack/config/parts/helpers.js +48 -0
- package/lib/webpack/config/parts/resolve.d.ts +1 -0
- package/lib/webpack/config/parts/resolve.js +10 -0
- package/lib/webpack/config/parts/style.d.ts +9 -0
- package/lib/webpack/config/parts/style.js +217 -0
- package/lib/webpack/loaders/export-global-loader.d.ts +7 -0
- package/lib/webpack/loaders/export-global-loader.js +26 -0
- package/lib/webpack/loaders/route-component-loader.d.ts +7 -0
- package/lib/webpack/loaders/route-component-loader.js +14 -0
- package/lib/webpack/loaders/shuvi-babel-loader.d.ts +1 -0
- package/lib/webpack/loaders/shuvi-babel-loader.js +60 -0
- package/lib/webpack/plugins/build-manifest-plugin.d.ts +27 -0
- package/lib/webpack/plugins/build-manifest-plugin.js +215 -0
- package/lib/webpack/plugins/chunk-names-plugin.d.ts +4 -0
- package/lib/webpack/plugins/chunk-names-plugin.js +43 -0
- package/lib/webpack/plugins/fix-watching-plugin.d.ts +4 -0
- package/lib/webpack/plugins/fix-watching-plugin.js +23 -0
- package/lib/webpack/plugins/module-replace-plugin/index.d.ts +1 -0
- package/lib/webpack/plugins/module-replace-plugin/index.js +4 -0
- package/lib/webpack/plugins/module-replace-plugin/plugin.d.ts +31 -0
- package/lib/webpack/plugins/module-replace-plugin/plugin.js +177 -0
- package/lib/webpack/plugins/module-replace-plugin/stub-loader.d.ts +1 -0
- package/lib/webpack/plugins/module-replace-plugin/stub-loader.js +34 -0
- package/lib/webpack/plugins/prefer-resolver-plugin.d.ts +10 -0
- package/lib/webpack/plugins/prefer-resolver-plugin.js +47 -0
- package/lib/webpack/plugins/require-cache-hot-reloader-plugin.d.ts +6 -0
- package/lib/webpack/plugins/require-cache-hot-reloader-plugin.js +48 -0
- package/lib/webpack/types.d.ts +40 -0
- package/lib/webpack/types.js +2 -0
- package/package.json +80 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Compiler, Plugin } from 'webpack';
|
|
2
|
+
export declare type ConfigItem = {
|
|
3
|
+
resourceQuery: Function | RegExp;
|
|
4
|
+
module: string;
|
|
5
|
+
};
|
|
6
|
+
export interface ModuleReplacePluginOptions {
|
|
7
|
+
modules: ConfigItem[];
|
|
8
|
+
}
|
|
9
|
+
export interface Loader {
|
|
10
|
+
loader: string;
|
|
11
|
+
options: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
export interface ModuleInfo {
|
|
14
|
+
action: typeof ModuleAction[keyof typeof ModuleAction];
|
|
15
|
+
compiler: Compiler;
|
|
16
|
+
replacedModule: string;
|
|
17
|
+
loaders: Loader[];
|
|
18
|
+
}
|
|
19
|
+
declare const ModuleAction: {
|
|
20
|
+
readonly REPLACE: "replace";
|
|
21
|
+
readonly RESTORE: "restore";
|
|
22
|
+
};
|
|
23
|
+
export default class ModuleReplacePlugin implements Plugin {
|
|
24
|
+
private _options;
|
|
25
|
+
static restoreModule(id: string): false | Promise<any>;
|
|
26
|
+
constructor(options: Partial<ModuleReplacePluginOptions>);
|
|
27
|
+
apply(compiler: Compiler): void;
|
|
28
|
+
private _handleBuildModule;
|
|
29
|
+
private _collectModules;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const REPLACED = Symbol('replaced');
|
|
4
|
+
const stubLoader = require.resolve('./stub-loader');
|
|
5
|
+
const pitchLoader = stubLoader;
|
|
6
|
+
const toString = Object.prototype.toString;
|
|
7
|
+
function isRegExp(target) {
|
|
8
|
+
return toString.call(target) === `[object RegExp]`;
|
|
9
|
+
}
|
|
10
|
+
function isFunction(target) {
|
|
11
|
+
return toString.call(target) === `[object Function]`;
|
|
12
|
+
}
|
|
13
|
+
function getModuleId(wpModule) {
|
|
14
|
+
var _a;
|
|
15
|
+
return wpModule.rawRequest || ((_a = wpModule === null || wpModule === void 0 ? void 0 : wpModule.createData) === null || _a === void 0 ? void 0 : _a.rawRequest);
|
|
16
|
+
}
|
|
17
|
+
function isPitcher(loader) {
|
|
18
|
+
return loader.loader === pitchLoader;
|
|
19
|
+
}
|
|
20
|
+
function findReplacedModule(configs, query) {
|
|
21
|
+
for (let index = 0; index < configs.length; index++) {
|
|
22
|
+
const { resourceQuery, module } = configs[index];
|
|
23
|
+
let isMatch = false;
|
|
24
|
+
if (isRegExp(resourceQuery)) {
|
|
25
|
+
isMatch = resourceQuery.test(query);
|
|
26
|
+
}
|
|
27
|
+
else if (isFunction(resourceQuery)) {
|
|
28
|
+
isMatch = resourceQuery(query);
|
|
29
|
+
}
|
|
30
|
+
if (isMatch) {
|
|
31
|
+
return module;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const ModuleAction = {
|
|
37
|
+
REPLACE: 'replace',
|
|
38
|
+
RESTORE: 'restore'
|
|
39
|
+
};
|
|
40
|
+
// const knownModules = new Map<string, ModuleInfo>();
|
|
41
|
+
const moduleHandler = new Map();
|
|
42
|
+
const compilerInfo = new Map();
|
|
43
|
+
function getKnownModules(id) {
|
|
44
|
+
const res = [];
|
|
45
|
+
for (const compiler of compilerInfo.values()) {
|
|
46
|
+
const module = compiler.modules.get(id);
|
|
47
|
+
if (module) {
|
|
48
|
+
res.push(module);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return res;
|
|
52
|
+
}
|
|
53
|
+
// function forEachModule(id: string, cb: (mod: ModuleInfo) => void) {
|
|
54
|
+
// for (const compiler of compilerInfo.values()) {
|
|
55
|
+
// const mod = compiler.modules.get(id);
|
|
56
|
+
// if (mod) {
|
|
57
|
+
// cb(mod);
|
|
58
|
+
// }
|
|
59
|
+
// }
|
|
60
|
+
// }
|
|
61
|
+
class ModuleReplacePlugin {
|
|
62
|
+
constructor(options) {
|
|
63
|
+
this._options = Object.assign({ modules: [] }, options);
|
|
64
|
+
}
|
|
65
|
+
static restoreModule(id) {
|
|
66
|
+
const moduleInfos = getKnownModules(id).filter(m => m.action === ModuleAction.REPLACE);
|
|
67
|
+
if (moduleInfos.length < 1) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
const handler = {
|
|
71
|
+
resolve: null,
|
|
72
|
+
pending: new Map()
|
|
73
|
+
};
|
|
74
|
+
moduleHandler.set(id, handler);
|
|
75
|
+
moduleInfos.forEach(moduleInfo => {
|
|
76
|
+
moduleInfo.action = ModuleAction.RESTORE;
|
|
77
|
+
handler.pending.set(moduleInfo.compiler, false);
|
|
78
|
+
moduleInfo.compiler.hooks.invalid.call('noop', new Date().getTime());
|
|
79
|
+
});
|
|
80
|
+
return new Promise(resolve => {
|
|
81
|
+
handler.resolve = resolve;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
apply(compiler) {
|
|
85
|
+
var _a;
|
|
86
|
+
const { modules } = this._options;
|
|
87
|
+
// init compiler info
|
|
88
|
+
compilerInfo.set(compiler, {
|
|
89
|
+
modules: new Map()
|
|
90
|
+
});
|
|
91
|
+
const pitcher = {
|
|
92
|
+
loader: pitchLoader,
|
|
93
|
+
resourceQuery(query) {
|
|
94
|
+
const find = findReplacedModule(modules, query);
|
|
95
|
+
return !!find;
|
|
96
|
+
},
|
|
97
|
+
options: {}
|
|
98
|
+
};
|
|
99
|
+
// replace original rules
|
|
100
|
+
(_a = compiler.options.module.rules) === null || _a === void 0 ? void 0 : _a.unshift(pitcher);
|
|
101
|
+
compiler.hooks.done.tap('done', () => {
|
|
102
|
+
const finished = [];
|
|
103
|
+
for (const [id, handler] of moduleHandler) {
|
|
104
|
+
if (handler.pending.get(compiler)) {
|
|
105
|
+
handler.pending.delete(compiler);
|
|
106
|
+
}
|
|
107
|
+
if (handler.pending.size <= 0) {
|
|
108
|
+
handler.resolve();
|
|
109
|
+
finished.push(id);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
for (const id of finished) {
|
|
113
|
+
moduleHandler.delete(id);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
compiler.hooks.beforeCompile.tapAsync('ModuleReplacePlugin', ({ normalModuleFactory }, callback) => {
|
|
117
|
+
normalModuleFactory.hooks.afterResolve.tap('ModuleReplacePlugin', wpModule => {
|
|
118
|
+
this._collectModules(compiler, wpModule);
|
|
119
|
+
});
|
|
120
|
+
callback();
|
|
121
|
+
});
|
|
122
|
+
compiler.hooks.compilation.tap('ModuleReplacePlugin', compilation => {
|
|
123
|
+
compilation.hooks.buildModule.tap('ModuleReplacePlugin', wpModule => this._handleBuildModule(compiler, wpModule));
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
_handleBuildModule(compiler, wpModule) {
|
|
127
|
+
const knownModules = compilerInfo.get(compiler).modules;
|
|
128
|
+
const id = getModuleId(wpModule);
|
|
129
|
+
if (!id) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const moduleInfo = knownModules.get(id);
|
|
133
|
+
if (!moduleInfo) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (moduleInfo.action === ModuleAction.RESTORE) {
|
|
137
|
+
const handler = moduleHandler.get(id);
|
|
138
|
+
if (handler) {
|
|
139
|
+
handler.pending.set(compiler, true);
|
|
140
|
+
}
|
|
141
|
+
const pitcher = (wpModule.loaders || []).find(isPitcher);
|
|
142
|
+
if (pitcher) {
|
|
143
|
+
pitcher.options = {};
|
|
144
|
+
}
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (moduleInfo.action === ModuleAction.REPLACE) {
|
|
148
|
+
if (!wpModule.loaders || wpModule.loaders[REPLACED] !== true) {
|
|
149
|
+
wpModule.loaders[REPLACED] = true;
|
|
150
|
+
const pitcher = (wpModule.loaders || []).find(isPitcher);
|
|
151
|
+
if (pitcher) {
|
|
152
|
+
pitcher.options = {
|
|
153
|
+
replacedModule: moduleInfo.replacedModule
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
_collectModules(compiler, wpModule) {
|
|
160
|
+
const knownModules = compilerInfo.get(compiler).modules;
|
|
161
|
+
const id = getModuleId(wpModule);
|
|
162
|
+
if (knownModules.has(id) || !id) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const { createData: { resourceResolveData } } = wpModule;
|
|
166
|
+
const replacedModule = findReplacedModule(this._options.modules, resourceResolveData.query);
|
|
167
|
+
if (replacedModule) {
|
|
168
|
+
knownModules.set(id, {
|
|
169
|
+
action: ModuleAction.REPLACE,
|
|
170
|
+
replacedModule,
|
|
171
|
+
compiler,
|
|
172
|
+
loaders: []
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.default = ModuleReplacePlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const loader_utils_1 = __importDefault(require("loader-utils"));
|
|
7
|
+
const isSelfLoader = (l) => l.path !== __filename;
|
|
8
|
+
const genRequest = (loaderCtx, loaders) => {
|
|
9
|
+
const loaderStrings = [];
|
|
10
|
+
loaders.forEach(loader => {
|
|
11
|
+
const request = typeof loader === 'string' ? loader : loader.request;
|
|
12
|
+
// loader.request contains both the resolved loader path and its options
|
|
13
|
+
// query (e.g. ??ref-0)
|
|
14
|
+
loaderStrings.push(request);
|
|
15
|
+
});
|
|
16
|
+
return loader_utils_1.default.stringifyRequest(loaderCtx, '!' +
|
|
17
|
+
[...loaderStrings, loaderCtx.resourcePath + loaderCtx.resourceQuery].join('!'));
|
|
18
|
+
};
|
|
19
|
+
module.exports = (code) => code;
|
|
20
|
+
module.exports.pitch = function () {
|
|
21
|
+
this.cacheable(false);
|
|
22
|
+
const { replacedModule } = loader_utils_1.default.getOptions(this) || {};
|
|
23
|
+
let loaders = this.loaders;
|
|
24
|
+
// remove self
|
|
25
|
+
loaders = loaders.filter(isSelfLoader);
|
|
26
|
+
const request = replacedModule
|
|
27
|
+
? loader_utils_1.default.stringifyRequest(this, replacedModule)
|
|
28
|
+
: genRequest(this, loaders);
|
|
29
|
+
return `
|
|
30
|
+
import mod from ${request};
|
|
31
|
+
export * from ${request}
|
|
32
|
+
export default mod;
|
|
33
|
+
`.trim();
|
|
34
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ResolvePlugin, Resolver } from 'webpack';
|
|
2
|
+
interface Options {
|
|
3
|
+
suffix: string;
|
|
4
|
+
}
|
|
5
|
+
export default class PreferResolverPlugin implements ResolvePlugin {
|
|
6
|
+
private _options;
|
|
7
|
+
constructor(options: Options);
|
|
8
|
+
apply(resolver: Resolver): void;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class PreferResolverPlugin {
|
|
4
|
+
constructor(options) {
|
|
5
|
+
this._options = options;
|
|
6
|
+
}
|
|
7
|
+
apply(resolver) {
|
|
8
|
+
const target = resolver.ensureHook('resolve');
|
|
9
|
+
const { suffix } = this._options;
|
|
10
|
+
resolver
|
|
11
|
+
.getHook('described-resolve')
|
|
12
|
+
.tapAsync('FileExistsPlugin', (request, resolveContext, callback) => {
|
|
13
|
+
const innerRequest = request.request || request.path;
|
|
14
|
+
if (!innerRequest)
|
|
15
|
+
return callback();
|
|
16
|
+
if (innerRequest.endsWith('.' + suffix)) {
|
|
17
|
+
return callback();
|
|
18
|
+
}
|
|
19
|
+
const suffixList = [suffix];
|
|
20
|
+
const resolveWithPrefer = (append, cb) => {
|
|
21
|
+
const obj = Object.assign(Object.assign({}, request), { request: innerRequest + '.' + append, relativePath: request.relativePath && request.relativePath + '.' + append });
|
|
22
|
+
return resolver.doResolve(target, obj, 'resolve with prefer request', resolveContext, (err, result) => {
|
|
23
|
+
if (err)
|
|
24
|
+
return cb(err);
|
|
25
|
+
if (result)
|
|
26
|
+
return cb(null, result);
|
|
27
|
+
return cb();
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const next = (err, result) => {
|
|
31
|
+
if (err) {
|
|
32
|
+
return callback(err);
|
|
33
|
+
}
|
|
34
|
+
if (result) {
|
|
35
|
+
return callback(err, result);
|
|
36
|
+
}
|
|
37
|
+
const nextSuffix = suffixList.pop();
|
|
38
|
+
if (!nextSuffix) {
|
|
39
|
+
return callback();
|
|
40
|
+
}
|
|
41
|
+
resolveWithPrefer(nextSuffix, next);
|
|
42
|
+
};
|
|
43
|
+
next(null);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.default = PreferResolverPlugin;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ref: https://github.com/vercel/next.js/blob/canary/packages/next/build/webpack/plugins/nextjs-require-cache-hot-reloader.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const webpack_1 = require("webpack");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
function deleteCache(filePath) {
|
|
7
|
+
try {
|
|
8
|
+
delete require.cache[fs_1.realpathSync(filePath)];
|
|
9
|
+
}
|
|
10
|
+
catch (e) {
|
|
11
|
+
if (e.code !== 'ENOENT')
|
|
12
|
+
throw e;
|
|
13
|
+
}
|
|
14
|
+
finally {
|
|
15
|
+
delete require.cache[filePath];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const PLUGIN_NAME = 'RequireCacheHotReloader';
|
|
19
|
+
// This plugin flushes require.cache after emitting the files. Providing 'hot reloading' of server files.
|
|
20
|
+
class RequireCacheHotReloader {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.previousOutputPathsWebpack5 = new Set();
|
|
23
|
+
this.currentOutputPathsWebpack5 = new Set();
|
|
24
|
+
}
|
|
25
|
+
apply(compiler) {
|
|
26
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
27
|
+
compilation.hooks.additionalTreeRuntimeRequirements.tap(PLUGIN_NAME, (_chunk, runtimeRequirements) => {
|
|
28
|
+
// add this so that the server.js would be emitted after every compilation
|
|
29
|
+
// @ts-ignore webpack typing bug
|
|
30
|
+
runtimeRequirements.add(webpack_1.RuntimeGlobals.getFullHash);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
compiler.hooks.assetEmitted.tap(PLUGIN_NAME, (_file, { targetPath }) => {
|
|
34
|
+
this.currentOutputPathsWebpack5.add(targetPath);
|
|
35
|
+
deleteCache(targetPath);
|
|
36
|
+
});
|
|
37
|
+
compiler.hooks.afterEmit.tap(PLUGIN_NAME, compilation => {
|
|
38
|
+
for (const outputPath of this.previousOutputPathsWebpack5) {
|
|
39
|
+
if (!this.currentOutputPathsWebpack5.has(outputPath)) {
|
|
40
|
+
deleteCache(outputPath);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
this.previousOutputPathsWebpack5 = new Set(this.currentOutputPathsWebpack5);
|
|
44
|
+
this.currentOutputPathsWebpack5.clear();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.default = RequireCacheHotReloader;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import WebpackChain from 'webpack-chain';
|
|
2
|
+
export interface IModuleItem {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IModule {
|
|
7
|
+
files: string[];
|
|
8
|
+
children: IModuleItem[];
|
|
9
|
+
}
|
|
10
|
+
export declare type IAssetMap = {
|
|
11
|
+
js: string[];
|
|
12
|
+
css?: string[];
|
|
13
|
+
} & {
|
|
14
|
+
[ext: string]: string[];
|
|
15
|
+
};
|
|
16
|
+
export interface IChunk {
|
|
17
|
+
file: string;
|
|
18
|
+
request: string;
|
|
19
|
+
}
|
|
20
|
+
export interface IManifest {
|
|
21
|
+
entries: {
|
|
22
|
+
[s: string]: IAssetMap;
|
|
23
|
+
};
|
|
24
|
+
bundles: {
|
|
25
|
+
[name: string]: string;
|
|
26
|
+
};
|
|
27
|
+
chunkRequest: {
|
|
28
|
+
[file: string]: string;
|
|
29
|
+
};
|
|
30
|
+
loadble: {
|
|
31
|
+
[s: string]: IModule;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export declare type ExternalsFunction = (data: {
|
|
35
|
+
context: string;
|
|
36
|
+
request: string;
|
|
37
|
+
}, callback: (err: Error | null, result: string | undefined) => void) => void;
|
|
38
|
+
export interface IWebpackHelpers {
|
|
39
|
+
addExternals: (chain: WebpackChain, externalsFn: ExternalsFunction) => void;
|
|
40
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shuvi/toolpack",
|
|
3
|
+
"version": "0.0.1-pre.1",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/shuvijs/shuvi.git",
|
|
7
|
+
"directory": "packages/toolpack"
|
|
8
|
+
},
|
|
9
|
+
"author": "liximomo",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"files": [
|
|
12
|
+
"lib"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "tsc -p tsconfig.build.json -w",
|
|
16
|
+
"prebuild": "rimraf lib",
|
|
17
|
+
"build": "tsc -p tsconfig.build.json"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">= 12.0.0"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@babel/core": "7.12.10",
|
|
24
|
+
"@babel/plugin-proposal-class-properties": "7.12.1",
|
|
25
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "7.10.1",
|
|
26
|
+
"@babel/plugin-proposal-numeric-separator": "7.12.7",
|
|
27
|
+
"@babel/plugin-proposal-object-rest-spread": "7.12.1",
|
|
28
|
+
"@babel/plugin-proposal-optional-chaining": "7.12.7",
|
|
29
|
+
"@babel/plugin-syntax-bigint": "7.8.3",
|
|
30
|
+
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
|
31
|
+
"@babel/plugin-transform-runtime": "7.12.10",
|
|
32
|
+
"@babel/preset-env": "7.12.11",
|
|
33
|
+
"@babel/preset-react": "7.10.1",
|
|
34
|
+
"@babel/preset-typescript": "7.12.7",
|
|
35
|
+
"@babel/runtime": "7.12.5",
|
|
36
|
+
"@shuvi/shared": "0.0.1-pre.1",
|
|
37
|
+
"@shuvi/utils": "0.0.1-pre.1",
|
|
38
|
+
"babel-loader": "8.2.2",
|
|
39
|
+
"babel-plugin-syntax-jsx": "6.18.0",
|
|
40
|
+
"babel-plugin-transform-define": "2.0.0",
|
|
41
|
+
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
|
|
42
|
+
"buffer": "6.0.3",
|
|
43
|
+
"crypto-browserify": "3.12.0",
|
|
44
|
+
"css-loader": "5.0.1",
|
|
45
|
+
"file-loader": "6.2.0",
|
|
46
|
+
"fork-ts-checker-webpack-plugin": "6.0.8",
|
|
47
|
+
"ignore-loader": "0.1.2",
|
|
48
|
+
"loader-utils": "2.0.0",
|
|
49
|
+
"mini-css-extract-plugin": "1.3.9",
|
|
50
|
+
"path-browserify": "1.0.1",
|
|
51
|
+
"postcss": "8.2.3",
|
|
52
|
+
"postcss-flexbugs-fixes": "5.0.2",
|
|
53
|
+
"postcss-loader": "4.1.0",
|
|
54
|
+
"postcss-preset-env": "6.7.0",
|
|
55
|
+
"process": "0.11.10",
|
|
56
|
+
"react-error-overlay": "6.0.8",
|
|
57
|
+
"sass": "1.32.2",
|
|
58
|
+
"sass-loader": "10.1.0",
|
|
59
|
+
"stream-browserify": "3.0.0",
|
|
60
|
+
"strip-ansi": "6.0.0",
|
|
61
|
+
"style-loader": "2.0.0",
|
|
62
|
+
"terser-webpack-plugin": "5.1.1",
|
|
63
|
+
"vm-browserify": "1.1.2",
|
|
64
|
+
"webpack-bundle-analyzer": "4.3.0",
|
|
65
|
+
"webpack-chain": "6.5.1",
|
|
66
|
+
"webpack-sources": "2.2.0"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@types/loader-utils": "2.0.1",
|
|
70
|
+
"@types/mini-css-extract-plugin": "^1.2.2",
|
|
71
|
+
"@types/terser-webpack-plugin": "5.0.2",
|
|
72
|
+
"@types/webpack-bundle-analyzer": "^3.8.0",
|
|
73
|
+
"memfs": "^3.1.2",
|
|
74
|
+
"webpack": "5.36.0"
|
|
75
|
+
},
|
|
76
|
+
"peerDependencies": {
|
|
77
|
+
"webpack": "5.36.0"
|
|
78
|
+
},
|
|
79
|
+
"gitHead": "0bc0bc76e72ca5a339341e8b71d6bb6bb41409e8"
|
|
80
|
+
}
|