@tarojs/webpack5-runner 4.2.1-beta.1 → 4.2.1-beta.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/plugins/AsyncSubPackagePlugin.js +489 -0
- package/dist/plugins/AsyncSubPackagePlugin.js.map +1 -0
- package/dist/plugins/BuildNativePlugin.js +15 -11
- package/dist/plugins/BuildNativePlugin.js.map +1 -1
- package/dist/plugins/MiniPlugin.js +33 -4
- package/dist/plugins/MiniPlugin.js.map +1 -1
- package/dist/plugins/SubPackageIndiePlugin.js +230 -46
- package/dist/plugins/SubPackageIndiePlugin.js.map +1 -1
- package/dist/utils/asyncSubPackage.js +106 -0
- package/dist/utils/asyncSubPackage.js.map +1 -0
- package/package.json +12 -12
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAsyncCommonChunkName = exports.getSingleAsyncRootForModules = exports.getAsyncRootForModule = exports.getSourceRootForResource = exports.normalizePathForAsyncSubPackage = exports.getAsyncRootAssetNames = void 0;
|
|
4
|
+
function getAsyncRootAssetNames(assets, asyncRoot) {
|
|
5
|
+
return Object.keys(assets).filter(name => name.startsWith(`${asyncRoot}/`) && name.endsWith('.js'));
|
|
6
|
+
}
|
|
7
|
+
exports.getAsyncRootAssetNames = getAsyncRootAssetNames;
|
|
8
|
+
function normalizePathForAsyncSubPackage(value) {
|
|
9
|
+
return value.replace(/\\/g, '/');
|
|
10
|
+
}
|
|
11
|
+
exports.normalizePathForAsyncSubPackage = normalizePathForAsyncSubPackage;
|
|
12
|
+
function getSourceRootForResource(resource, sourceDir, asyncRootMap) {
|
|
13
|
+
if (!resource)
|
|
14
|
+
return null;
|
|
15
|
+
const normalizedResource = normalizePathForAsyncSubPackage(resource);
|
|
16
|
+
const normalizedSourceDir = normalizePathForAsyncSubPackage(sourceDir).replace(/\/$/, '');
|
|
17
|
+
let relativeResource = normalizedResource;
|
|
18
|
+
if (normalizedResource.startsWith(`${normalizedSourceDir}/`)) {
|
|
19
|
+
relativeResource = normalizedResource.slice(normalizedSourceDir.length + 1);
|
|
20
|
+
}
|
|
21
|
+
const sourceRoots = Array.from(asyncRootMap.keys()).sort((a, b) => b.length - a.length);
|
|
22
|
+
for (const sourceRoot of sourceRoots) {
|
|
23
|
+
const normalizedSourceRoot = normalizePathForAsyncSubPackage(sourceRoot);
|
|
24
|
+
if (relativeResource === normalizedSourceRoot || relativeResource.startsWith(`${normalizedSourceRoot}/`) || relativeResource.startsWith(`${normalizedSourceRoot}.`)) {
|
|
25
|
+
return sourceRoot;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
exports.getSourceRootForResource = getSourceRootForResource;
|
|
31
|
+
function getAsyncRootForModule(module, sourceDir, asyncRootMap, moduleGraph, visited = new Set(), cache) {
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
if (!module || visited.has(module))
|
|
34
|
+
return undefined;
|
|
35
|
+
if (cache === null || cache === void 0 ? void 0 : cache.has(module))
|
|
36
|
+
return cache.get(module);
|
|
37
|
+
visited.add(module);
|
|
38
|
+
const resource = module.resource || ((_a = module.nameForCondition) === null || _a === void 0 ? void 0 : _a.call(module));
|
|
39
|
+
const normalizedSourceDir = normalizePathForAsyncSubPackage(sourceDir).replace(/\/$/, '');
|
|
40
|
+
const normalizedResource = resource ? normalizePathForAsyncSubPackage(resource) : '';
|
|
41
|
+
const isProjectSource = normalizedResource.startsWith(`${normalizedSourceDir}/`);
|
|
42
|
+
const sourceRoot = getSourceRootForResource(resource, sourceDir, asyncRootMap);
|
|
43
|
+
if (sourceRoot) {
|
|
44
|
+
const asyncRoot = asyncRootMap.get(sourceRoot);
|
|
45
|
+
cache === null || cache === void 0 ? void 0 : cache.set(module, asyncRoot);
|
|
46
|
+
return asyncRoot;
|
|
47
|
+
}
|
|
48
|
+
const asyncRoots = new Set();
|
|
49
|
+
let hasBlockingProjectIssuer = false;
|
|
50
|
+
const issuerModules = new Set();
|
|
51
|
+
const incomingConnections = (_b = moduleGraph === null || moduleGraph === void 0 ? void 0 : moduleGraph.getIncomingConnections) === null || _b === void 0 ? void 0 : _b.call(moduleGraph, module);
|
|
52
|
+
if (incomingConnections) {
|
|
53
|
+
for (const connection of incomingConnections) {
|
|
54
|
+
if (connection === null || connection === void 0 ? void 0 : connection.originModule)
|
|
55
|
+
issuerModules.add(connection.originModule);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const issuer = (_c = moduleGraph === null || moduleGraph === void 0 ? void 0 : moduleGraph.getIssuer) === null || _c === void 0 ? void 0 : _c.call(moduleGraph, module);
|
|
59
|
+
if (issuer)
|
|
60
|
+
issuerModules.add(issuer);
|
|
61
|
+
for (const issuerModule of issuerModules) {
|
|
62
|
+
const asyncRoot = getAsyncRootForModule(issuerModule, sourceDir, asyncRootMap, moduleGraph, new Set(visited), cache);
|
|
63
|
+
if (asyncRoot === null) {
|
|
64
|
+
hasBlockingProjectIssuer = true;
|
|
65
|
+
}
|
|
66
|
+
else if (asyncRoot) {
|
|
67
|
+
asyncRoots.add(asyncRoot);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
let result;
|
|
71
|
+
if (hasBlockingProjectIssuer || asyncRoots.size > 1) {
|
|
72
|
+
result = null;
|
|
73
|
+
}
|
|
74
|
+
else if (asyncRoots.size === 1) {
|
|
75
|
+
result = Array.from(asyncRoots)[0];
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
result = isProjectSource ? null : undefined;
|
|
79
|
+
}
|
|
80
|
+
cache === null || cache === void 0 ? void 0 : cache.set(module, result);
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
exports.getAsyncRootForModule = getAsyncRootForModule;
|
|
84
|
+
function getSingleAsyncRootForModules(modules, sourceDir, asyncRootMap, moduleGraph, cache) {
|
|
85
|
+
const asyncRoots = new Set();
|
|
86
|
+
for (const module of modules) {
|
|
87
|
+
const asyncRoot = getAsyncRootForModule(module, sourceDir, asyncRootMap, moduleGraph, undefined, cache);
|
|
88
|
+
if (asyncRoot === null)
|
|
89
|
+
return null;
|
|
90
|
+
if (asyncRoot) {
|
|
91
|
+
asyncRoots.add(asyncRoot);
|
|
92
|
+
if (asyncRoots.size > 1)
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (asyncRoots.size !== 1)
|
|
97
|
+
return null;
|
|
98
|
+
return Array.from(asyncRoots)[0];
|
|
99
|
+
}
|
|
100
|
+
exports.getSingleAsyncRootForModules = getSingleAsyncRootForModules;
|
|
101
|
+
function createAsyncCommonChunkName(asyncRoot, chunkName) {
|
|
102
|
+
const safeChunkName = (chunkName || 'common').replace(/[^a-zA-Z0-9_/-]/g, '_').replace(/\//g, '_');
|
|
103
|
+
return `${asyncRoot}/async-${safeChunkName}`;
|
|
104
|
+
}
|
|
105
|
+
exports.createAsyncCommonChunkName = createAsyncCommonChunkName;
|
|
106
|
+
//# sourceMappingURL=asyncSubPackage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncSubPackage.js","sourceRoot":"","sources":["../../src/utils/asyncSubPackage.ts"],"names":[],"mappings":";;;AAAA,SAAgB,sBAAsB,CAAE,MAA2B,EAAE,SAAiB;IACpF,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;AACrG,CAAC;AAFD,wDAEC;AAED,SAAgB,+BAA+B,CAAE,KAAa;IAC5D,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AAClC,CAAC;AAFD,0EAEC;AAED,SAAgB,wBAAwB,CAAE,QAA4B,EAAE,SA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+C;IAE/C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAA;IAEpC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,SAAS,GAAG,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,CAAC,CAAA;QACvG,IAAI,SAAS,KAAK,IAAI;YAAE,OAAO,IAAI,CAAA;QACnC,IAAI,SAAS,EAAE,CAAC;YACd,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;YACzB,IAAI,UAAU,CAAC,IAAI,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAA;QACtC,CAAC;IACH,CAAC;IAED,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACtC,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;AAClC,CAAC;AApBD,oEAoBC;AAED,SAAgB,0BAA0B,CAAE,SAAiB,EAAE,SAA6B;IAC1F,MAAM,aAAa,GAAG,CAAC,SAAS,IAAI,QAAQ,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAClG,OAAO,GAAG,SAAS,UAAU,aAAa,EAAE,CAAA;AAC9C,CAAC;AAHD,gEAGC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/webpack5-runner",
|
|
3
|
-
"version": "4.2.1-beta.
|
|
3
|
+
"version": "4.2.1-beta.2",
|
|
4
4
|
"description": "Taro app runner",
|
|
5
5
|
"author": "O2Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
"webpack-format-messages": "^3.0.1",
|
|
63
63
|
"webpackbar": "^5.0.2",
|
|
64
64
|
"webpack-virtual-modules": "^0.6.1",
|
|
65
|
-
"@tarojs/
|
|
66
|
-
"@tarojs/runner-utils": "4.2.1-beta.
|
|
67
|
-
"@tarojs/
|
|
68
|
-
"@tarojs/
|
|
69
|
-
"postcss-
|
|
70
|
-
"postcss-
|
|
71
|
-
"postcss-
|
|
72
|
-
"@tarojs/
|
|
65
|
+
"@tarojs/helper": "4.2.1-beta.2",
|
|
66
|
+
"@tarojs/runner-utils": "4.2.1-beta.2",
|
|
67
|
+
"@tarojs/shared": "4.2.1-beta.2",
|
|
68
|
+
"@tarojs/webpack5-prebundle": "4.2.1-beta.2",
|
|
69
|
+
"postcss-html-transform": "4.2.1-beta.2",
|
|
70
|
+
"postcss-plugin-constparse": "4.2.1-beta.2",
|
|
71
|
+
"postcss-pxtransform": "4.2.1-beta.2",
|
|
72
|
+
"@tarojs/taro-loader": "4.2.1-beta.2"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@babel/core": "^7.24.4",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"stylus": "^0.63.0",
|
|
81
81
|
"jest-transform-css": "^6.0.1",
|
|
82
82
|
"webpack": "5.91.0",
|
|
83
|
-
"@tarojs/
|
|
84
|
-
"@tarojs/
|
|
83
|
+
"@tarojs/taro": "4.2.1-beta.2",
|
|
84
|
+
"@tarojs/runtime": "4.2.1-beta.2"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@babel/core": "^7.12.0",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"sass": "^1.3.0",
|
|
91
91
|
"stylus": ">=0.52.4",
|
|
92
92
|
"webpack": "5.91.0",
|
|
93
|
-
"@tarojs/runtime": "4.2.1-beta.
|
|
93
|
+
"@tarojs/runtime": "4.2.1-beta.2"
|
|
94
94
|
},
|
|
95
95
|
"peerDependenciesMeta": {
|
|
96
96
|
"less": {
|