xhs-mp-pack 1.1.0 → 1.1.2
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/dist/PluginManager.js
CHANGED
|
@@ -39,6 +39,9 @@ const cleverMerge_1 = require("@/base/cleverMerge");
|
|
|
39
39
|
const LazyModuleFactoryPlugin_1 = __importDefault(require("./module/LazyModuleFactoryPlugin"));
|
|
40
40
|
// runtime
|
|
41
41
|
const APIPlugin_1 = __importDefault(require("./plugins/APIPlugin"));
|
|
42
|
+
// import WebpackIsIncludedPlugin from './WebpackIsIncludedPlugin'
|
|
43
|
+
// uri
|
|
44
|
+
const ResolverCachePlugin_1 = __importDefault(require("./cache/ResolverCachePlugin"));
|
|
42
45
|
// dependencies
|
|
43
46
|
const DynamicEntryPlugin_1 = __importDefault(require("./dependencies/entry/DynamicEntryPlugin"));
|
|
44
47
|
// output library
|
|
@@ -72,6 +75,11 @@ const RealContentHashPlugin_1 = __importDefault(require("./plugins/optimize/Real
|
|
|
72
75
|
const NoEmitOnErrorsPlugin_1 = __importDefault(require("./plugins/optimize/NoEmitOnErrorsPlugin"));
|
|
73
76
|
// cache
|
|
74
77
|
const AddManagedPathsPlugin_1 = __importDefault(require("./cache/AddManagedPathsPlugin"));
|
|
78
|
+
const MemoryWithGcCachePlugin_1 = __importDefault(require("./cache/MemoryWithGcCachePlugin"));
|
|
79
|
+
const MemoryCachePlugin_1 = __importDefault(require("./cache/MemoryCachePlugin"));
|
|
80
|
+
const AddBuildDependenciesPlugin_1 = __importDefault(require("./cache/AddBuildDependenciesPlugin"));
|
|
81
|
+
const IdleFileCachePlugin_1 = __importDefault(require("./cache/IdleFileCachePlugin"));
|
|
82
|
+
const PackFileCacheStrategy_1 = __importDefault(require("./cache/PackFileCacheStrategy"));
|
|
75
83
|
const NodeStuffPlugin_1 = __importDefault(require("./plugins/NodeStuffPlugin"));
|
|
76
84
|
// stat
|
|
77
85
|
class PluginManager {
|
|
@@ -213,56 +221,51 @@ class PluginManager {
|
|
|
213
221
|
setupCachePlugins(compiler, options) {
|
|
214
222
|
if (options.cache && typeof options.cache === 'object') {
|
|
215
223
|
// cache
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
// }
|
|
224
|
+
if (isFinite(options.maxGenerations)) {
|
|
225
|
+
const MemoryWithGcCachePlugin = require('./cache/MemoryWithGcCachePlugin').default;
|
|
226
|
+
new MemoryWithGcCachePlugin({
|
|
227
|
+
maxGenerations: options.maxGenerations,
|
|
228
|
+
}).apply(compiler);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
const MemoryCachePlugin = require('./cache/MemoryCachePlugin').default;
|
|
232
|
+
new MemoryCachePlugin().apply(compiler);
|
|
233
|
+
}
|
|
234
|
+
if (options.cacheUnaffected) {
|
|
235
|
+
if (!options.experiments.cacheUnaffected) {
|
|
236
|
+
throw new Error("'cache.cacheUnaffected: true' is only allowed when 'experiments.cacheUnaffected' is enabled");
|
|
237
|
+
}
|
|
238
|
+
compiler.moduleMemCaches = new Map();
|
|
239
|
+
}
|
|
233
240
|
// filesystem
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
// cacheOptions.idleTimeoutForInitialStore,
|
|
263
|
-
// cacheOptions.idleTimeoutAfterLargeChanges,
|
|
264
|
-
// ).apply(compiler)
|
|
265
|
-
// new ResolverCachePlugin().apply(compiler)
|
|
241
|
+
const cacheOptions = options.cache;
|
|
242
|
+
for (const key in cacheOptions.buildDependencies) {
|
|
243
|
+
const list = cacheOptions.buildDependencies[key];
|
|
244
|
+
new AddBuildDependenciesPlugin_1.default(list).apply(compiler);
|
|
245
|
+
}
|
|
246
|
+
if (!isFinite(cacheOptions.maxMemoryGenerations)) {
|
|
247
|
+
new MemoryCachePlugin_1.default().apply(compiler);
|
|
248
|
+
}
|
|
249
|
+
else if (cacheOptions.maxMemoryGenerations !== 0) {
|
|
250
|
+
new MemoryWithGcCachePlugin_1.default({
|
|
251
|
+
maxGenerations: cacheOptions.maxMemoryGenerations,
|
|
252
|
+
}).apply(compiler);
|
|
253
|
+
}
|
|
254
|
+
new IdleFileCachePlugin_1.default(new PackFileCacheStrategy_1.default({
|
|
255
|
+
compiler,
|
|
256
|
+
fs: compiler.intermediateFileSystem,
|
|
257
|
+
context: options.context,
|
|
258
|
+
cacheLocation: cacheOptions.cacheLocation,
|
|
259
|
+
version: cacheOptions.version,
|
|
260
|
+
logger: compiler.getInfrastructureLogger('webpack.cache.PackFileCacheStrategy'),
|
|
261
|
+
snapshot: options.snapshot,
|
|
262
|
+
maxAge: cacheOptions.maxAge,
|
|
263
|
+
profile: cacheOptions.profile,
|
|
264
|
+
allowCollectingMemory: cacheOptions.allowCollectingMemory,
|
|
265
|
+
compression: cacheOptions.compression,
|
|
266
|
+
readonly: cacheOptions.readonly,
|
|
267
|
+
}), cacheOptions.idleTimeout, cacheOptions.idleTimeoutForInitialStore, cacheOptions.idleTimeoutAfterLargeChanges).apply(compiler);
|
|
268
|
+
new ResolverCachePlugin_1.default().apply(compiler);
|
|
266
269
|
}
|
|
267
270
|
}
|
|
268
271
|
setupSourceMap(compiler, options) {
|
|
@@ -248,7 +248,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
248
248
|
object.hash = compilation.hash;
|
|
249
249
|
},
|
|
250
250
|
version: object => {
|
|
251
|
-
object.version = require('
|
|
251
|
+
object.version = require('../../package.json').version;
|
|
252
252
|
},
|
|
253
253
|
env: (object, compilation, context, { _env }) => {
|
|
254
254
|
object.env = _env;
|
|
@@ -69,7 +69,7 @@ exports.default = {
|
|
|
69
69
|
createFileSerializer: (fs, hashFunction) => {
|
|
70
70
|
registerSerializers();
|
|
71
71
|
const Serializer = getSerializer();
|
|
72
|
-
const FileMiddleware = require('@/serialization/middlewares/FileMiddleware');
|
|
72
|
+
const FileMiddleware = require('@/serialization/middlewares/FileMiddleware').default;
|
|
73
73
|
const fileMiddleware = new FileMiddleware(fs, hashFunction);
|
|
74
74
|
const binaryMiddleware = getBinaryMiddlewareInstance();
|
|
75
75
|
const SerializerMiddleware = getSerializerMiddleware();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xhs-mp-pack",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "xhs mp compiler core.",
|
|
5
5
|
"preferGlobal": true,
|
|
6
6
|
"category": "esm",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"postcss": "^8.4.31",
|
|
56
56
|
"cssnano": "^6.0.1",
|
|
57
57
|
"webpack-sources": "^3.2.3",
|
|
58
|
-
"xhs-mp-compiler-utils": "1.1.
|
|
59
|
-
"xhs-mp-project": "^1.1.
|
|
58
|
+
"xhs-mp-compiler-utils": "1.1.2",
|
|
59
|
+
"xhs-mp-project": "^1.1.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/babel__generator": "7.6.3",
|