@rsdoctor/core 0.0.0-next-20240620044732
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/LICENSE +21 -0
- package/README.md +22 -0
- package/dist/build-utils/build/chunks/assetsModules.d.ts +4 -0
- package/dist/build-utils/build/chunks/assetsModules.d.ts.map +1 -0
- package/dist/build-utils/build/chunks/assetsModules.js +36 -0
- package/dist/build-utils/build/chunks/chunkTransform.d.ts +5 -0
- package/dist/build-utils/build/chunks/chunkTransform.d.ts.map +1 -0
- package/dist/build-utils/build/chunks/chunkTransform.js +31 -0
- package/dist/build-utils/build/chunks/generateTileGraph.d.ts +11 -0
- package/dist/build-utils/build/chunks/generateTileGraph.d.ts.map +1 -0
- package/dist/build-utils/build/chunks/generateTileGraph.js +71 -0
- package/dist/build-utils/build/chunks/index.d.ts +4 -0
- package/dist/build-utils/build/chunks/index.d.ts.map +1 -0
- package/dist/build-utils/build/chunks/index.js +26 -0
- package/dist/build-utils/build/index.d.ts +5 -0
- package/dist/build-utils/build/index.d.ts.map +1 -0
- package/dist/build-utils/build/index.js +47 -0
- package/dist/build-utils/build/module-graph/index.d.ts +4 -0
- package/dist/build-utils/build/module-graph/index.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/index.js +26 -0
- package/dist/build-utils/build/module-graph/parser.d.ts +3 -0
- package/dist/build-utils/build/module-graph/parser.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/parser.js +44 -0
- package/dist/build-utils/build/module-graph/transform.d.ts +5 -0
- package/dist/build-utils/build/module-graph/transform.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/transform.js +37 -0
- package/dist/build-utils/build/module-graph/treeShaking.d.ts +4 -0
- package/dist/build-utils/build/module-graph/treeShaking.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/treeShaking.js +132 -0
- package/dist/build-utils/build/module-graph/utils.d.ts +4 -0
- package/dist/build-utils/build/module-graph/utils.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/utils.js +113 -0
- package/dist/build-utils/build/module-graph/webpack/transform.d.ts +12 -0
- package/dist/build-utils/build/module-graph/webpack/transform.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/webpack/transform.js +195 -0
- package/dist/build-utils/build/utils/index.d.ts +4 -0
- package/dist/build-utils/build/utils/index.d.ts.map +1 -0
- package/dist/build-utils/build/utils/index.js +26 -0
- package/dist/build-utils/build/utils/loader.d.ts +19 -0
- package/dist/build-utils/build/utils/loader.d.ts.map +1 -0
- package/dist/build-utils/build/utils/loader.js +299 -0
- package/dist/build-utils/build/utils/parseBundle.d.ts +13 -0
- package/dist/build-utils/build/utils/parseBundle.d.ts.map +1 -0
- package/dist/build-utils/build/utils/parseBundle.js +367 -0
- package/dist/build-utils/build/utils/plugin.d.ts +6 -0
- package/dist/build-utils/build/utils/plugin.d.ts.map +1 -0
- package/dist/build-utils/build/utils/plugin.js +63 -0
- package/dist/build-utils/common/chunks/assetsContent.d.ts +5 -0
- package/dist/build-utils/common/chunks/assetsContent.d.ts.map +1 -0
- package/dist/build-utils/common/chunks/assetsContent.js +34 -0
- package/dist/build-utils/common/chunks/assetsModules.d.ts +24 -0
- package/dist/build-utils/common/chunks/assetsModules.d.ts.map +1 -0
- package/dist/build-utils/common/chunks/assetsModules.js +107 -0
- package/dist/build-utils/common/chunks/chunkTransform.d.ts +6 -0
- package/dist/build-utils/common/chunks/chunkTransform.d.ts.map +1 -0
- package/dist/build-utils/common/chunks/chunkTransform.js +73 -0
- package/dist/build-utils/common/chunks/index.d.ts +4 -0
- package/dist/build-utils/common/chunks/index.d.ts.map +1 -0
- package/dist/build-utils/common/chunks/index.js +26 -0
- package/dist/build-utils/common/index.d.ts +6 -0
- package/dist/build-utils/common/index.d.ts.map +1 -0
- package/dist/build-utils/common/index.js +50 -0
- package/dist/build-utils/common/module-graph/compatible.d.ts +10 -0
- package/dist/build-utils/common/module-graph/compatible.d.ts.map +1 -0
- package/dist/build-utils/common/module-graph/compatible.js +63 -0
- package/dist/build-utils/common/module-graph/index.d.ts +4 -0
- package/dist/build-utils/common/module-graph/index.d.ts.map +1 -0
- package/dist/build-utils/common/module-graph/index.js +26 -0
- package/dist/build-utils/common/module-graph/transform.d.ts +8 -0
- package/dist/build-utils/common/module-graph/transform.d.ts.map +1 -0
- package/dist/build-utils/common/module-graph/transform.js +200 -0
- package/dist/build-utils/common/module-graph/utils.d.ts +16 -0
- package/dist/build-utils/common/module-graph/utils.d.ts.map +1 -0
- package/dist/build-utils/common/module-graph/utils.js +62 -0
- package/dist/build-utils/common/trans-utils/index.d.ts +2 -0
- package/dist/build-utils/common/trans-utils/index.d.ts.map +1 -0
- package/dist/build-utils/common/trans-utils/index.js +22 -0
- package/dist/build-utils/common/trans-utils/transStats.d.ts +7 -0
- package/dist/build-utils/common/trans-utils/transStats.d.ts.map +1 -0
- package/dist/build-utils/common/trans-utils/transStats.js +35 -0
- package/dist/build-utils/common/webpack/compatible.d.ts +27 -0
- package/dist/build-utils/common/webpack/compatible.d.ts.map +1 -0
- package/dist/build-utils/common/webpack/compatible.js +181 -0
- package/dist/build-utils/index.d.ts +3 -0
- package/dist/build-utils/index.d.ts.map +1 -0
- package/dist/build-utils/index.js +41 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/inner-plugins/constants.d.ts +7 -0
- package/dist/inner-plugins/constants.d.ts.map +1 -0
- package/dist/inner-plugins/constants.js +52 -0
- package/dist/inner-plugins/index.d.ts +3 -0
- package/dist/inner-plugins/index.d.ts.map +1 -0
- package/dist/inner-plugins/index.js +24 -0
- package/dist/inner-plugins/loaders/proxy.d.ts +5 -0
- package/dist/inner-plugins/loaders/proxy.d.ts.map +1 -0
- package/dist/inner-plugins/loaders/proxy.js +115 -0
- package/dist/inner-plugins/plugins/base.d.ts +14 -0
- package/dist/inner-plugins/plugins/base.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/base.js +45 -0
- package/dist/inner-plugins/plugins/bundle.d.ts +15 -0
- package/dist/inner-plugins/plugins/bundle.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/bundle.js +92 -0
- package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts +7 -0
- package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/bundleTagPlugin.js +81 -0
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +10 -0
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +126 -0
- package/dist/inner-plugins/plugins/errors.d.ts +12 -0
- package/dist/inner-plugins/plugins/errors.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/errors.js +85 -0
- package/dist/inner-plugins/plugins/index.d.ts +11 -0
- package/dist/inner-plugins/plugins/index.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/index.js +40 -0
- package/dist/inner-plugins/plugins/loader.d.ts +12 -0
- package/dist/inner-plugins/plugins/loader.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/loader.js +161 -0
- package/dist/inner-plugins/plugins/plugins.d.ts +9 -0
- package/dist/inner-plugins/plugins/plugins.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/plugins.js +60 -0
- package/dist/inner-plugins/plugins/progress.d.ts +9 -0
- package/dist/inner-plugins/plugins/progress.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/progress.js +59 -0
- package/dist/inner-plugins/plugins/rules.d.ts +9 -0
- package/dist/inner-plugins/plugins/rules.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/rules.js +85 -0
- package/dist/inner-plugins/plugins/summary.d.ts +15 -0
- package/dist/inner-plugins/plugins/summary.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/summary.js +115 -0
- package/dist/inner-plugins/utils/circleDetect.d.ts +5 -0
- package/dist/inner-plugins/utils/circleDetect.d.ts.map +1 -0
- package/dist/inner-plugins/utils/circleDetect.js +42 -0
- package/dist/inner-plugins/utils/config.d.ts +8 -0
- package/dist/inner-plugins/utils/config.d.ts.map +1 -0
- package/dist/inner-plugins/utils/config.js +151 -0
- package/dist/inner-plugins/utils/index.d.ts +6 -0
- package/dist/inner-plugins/utils/index.d.ts.map +1 -0
- package/dist/inner-plugins/utils/index.js +30 -0
- package/dist/inner-plugins/utils/loader.d.ts +12 -0
- package/dist/inner-plugins/utils/loader.d.ts.map +1 -0
- package/dist/inner-plugins/utils/loader.js +201 -0
- package/dist/inner-plugins/utils/plugin.d.ts +6 -0
- package/dist/inner-plugins/utils/plugin.d.ts.map +1 -0
- package/dist/inner-plugins/utils/plugin.js +126 -0
- package/dist/inner-plugins/utils/sdk.d.ts +4 -0
- package/dist/inner-plugins/utils/sdk.d.ts.map +1 -0
- package/dist/inner-plugins/utils/sdk.js +43 -0
- package/dist/rules/index.d.ts +4 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +33 -0
- package/dist/rules/linter.d.ts +10 -0
- package/dist/rules/linter.d.ts.map +1 -0
- package/dist/rules/linter.js +74 -0
- package/dist/rules/rule.d.ts +28 -0
- package/dist/rules/rule.d.ts.map +1 -0
- package/dist/rules/rule.js +143 -0
- package/dist/rules/rules/default-import-check/index.d.ts +5 -0
- package/dist/rules/rules/default-import-check/index.d.ts.map +1 -0
- package/dist/rules/rules/default-import-check/index.js +124 -0
- package/dist/rules/rules/default-import-check/types.d.ts +5 -0
- package/dist/rules/rules/default-import-check/types.d.ts.map +1 -0
- package/dist/rules/rules/default-import-check/types.js +16 -0
- package/dist/rules/rules/default-import-check/utils.d.ts +11 -0
- package/dist/rules/rules/default-import-check/utils.d.ts.map +1 -0
- package/dist/rules/rules/default-import-check/utils.js +93 -0
- package/dist/rules/rules/duplicate-package/index.d.ts +5 -0
- package/dist/rules/rules/duplicate-package/index.d.ts.map +1 -0
- package/dist/rules/rules/duplicate-package/index.js +71 -0
- package/dist/rules/rules/duplicate-package/types.d.ts +25 -0
- package/dist/rules/rules/duplicate-package/types.d.ts.map +1 -0
- package/dist/rules/rules/duplicate-package/types.js +51 -0
- package/dist/rules/rules/duplicate-package/utils.d.ts +4 -0
- package/dist/rules/rules/duplicate-package/utils.d.ts.map +1 -0
- package/dist/rules/rules/duplicate-package/utils.js +89 -0
- package/dist/rules/rules/ecma-version-check/index.d.ts +5 -0
- package/dist/rules/rules/ecma-version-check/index.d.ts.map +1 -0
- package/dist/rules/rules/ecma-version-check/index.js +82 -0
- package/dist/rules/rules/ecma-version-check/types.d.ts +8 -0
- package/dist/rules/rules/ecma-version-check/types.d.ts.map +1 -0
- package/dist/rules/rules/ecma-version-check/types.js +16 -0
- package/dist/rules/rules/ecma-version-check/utils.d.ts +3 -0
- package/dist/rules/rules/ecma-version-check/utils.d.ts.map +1 -0
- package/dist/rules/rules/ecma-version-check/utils.js +31 -0
- package/dist/rules/rules/index.d.ts +2 -0
- package/dist/rules/rules/index.d.ts.map +1 -0
- package/dist/rules/rules/index.js +37 -0
- package/dist/rules/rules/loader-performance-optimization/index.d.ts +5 -0
- package/dist/rules/rules/loader-performance-optimization/index.d.ts.map +1 -0
- package/dist/rules/rules/loader-performance-optimization/index.js +124 -0
- package/dist/rules/rules/loader-performance-optimization/types.d.ts +23 -0
- package/dist/rules/rules/loader-performance-optimization/types.d.ts.map +1 -0
- package/dist/rules/rules/loader-performance-optimization/types.js +16 -0
- package/dist/rules/rules/loader-performance-optimization/utils.d.ts +2 -0
- package/dist/rules/rules/loader-performance-optimization/utils.d.ts.map +1 -0
- package/dist/rules/rules/loader-performance-optimization/utils.js +38 -0
- package/dist/rules/utils.d.ts +4 -0
- package/dist/rules/utils.d.ts.map +1 -0
- package/dist/rules/utils.js +44 -0
- package/dist/types/chunks.d.ts +12 -0
- package/dist/types/chunks.d.ts.map +1 -0
- package/dist/types/chunks.js +16 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +30 -0
- package/dist/types/loader.d.ts +20 -0
- package/dist/types/loader.d.ts.map +1 -0
- package/dist/types/loader.js +16 -0
- package/dist/types/plugin.d.ts +96 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +16 -0
- package/dist/types/rules.d.ts +8 -0
- package/dist/types/rules.d.ts.map +1 -0
- package/dist/types/rules.js +16 -0
- package/dist/types/webpack.d.ts +15 -0
- package/dist/types/webpack.d.ts.map +1 -0
- package/dist/types/webpack.js +16 -0
- package/package.json +112 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var chunkTransform_exports = {};
|
|
20
|
+
__export(chunkTransform_exports, {
|
|
21
|
+
chunkTransform: () => chunkTransform
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(chunkTransform_exports);
|
|
24
|
+
var import_graph = require("@rsdoctor/graph");
|
|
25
|
+
var import_lodash = require("lodash");
|
|
26
|
+
const FILTER_ASSETS_TYPE = "assets by status";
|
|
27
|
+
function chunkTransform(assetMap, bundleStats) {
|
|
28
|
+
const chunkGraph = new import_graph.ChunkGraph();
|
|
29
|
+
(0, import_lodash.forEach)(bundleStats.chunks, (_chunk) => {
|
|
30
|
+
const parsedSize = 0;
|
|
31
|
+
const chunk = new import_graph.Chunk(
|
|
32
|
+
String(_chunk.id),
|
|
33
|
+
_chunk.names?.join("") || _chunk.files?.join("| ") || "",
|
|
34
|
+
_chunk.size,
|
|
35
|
+
_chunk.initial,
|
|
36
|
+
_chunk.entry
|
|
37
|
+
);
|
|
38
|
+
chunk.setParsedSize(parsedSize);
|
|
39
|
+
chunkGraph.addChunk(chunk);
|
|
40
|
+
});
|
|
41
|
+
(0, import_lodash.forEach)(bundleStats.assets, (_asset) => {
|
|
42
|
+
if (_asset.type === FILTER_ASSETS_TYPE) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const chunks = _asset.chunks?.map((ck) => {
|
|
46
|
+
const chunk = chunkGraph.getChunkById(String(ck));
|
|
47
|
+
return chunk;
|
|
48
|
+
}).filter((chunk) => !!chunk) || [];
|
|
49
|
+
const { content = "" } = assetMap.get(_asset.name) || {};
|
|
50
|
+
const asset = new import_graph.Asset(_asset.name, _asset.size, chunks, content);
|
|
51
|
+
chunks.forEach((chunk) => chunk?.addAsset(asset));
|
|
52
|
+
chunkGraph.addAsset(asset);
|
|
53
|
+
});
|
|
54
|
+
(0, import_lodash.forEach)(bundleStats.entrypoints, (_entrypoint, key) => {
|
|
55
|
+
const entrypoint = new import_graph.EntryPoint(_entrypoint.name || key);
|
|
56
|
+
(0, import_lodash.forEach)(_entrypoint.chunks, (chunkId) => {
|
|
57
|
+
const ck = chunkGraph.getChunkById(`${chunkId}`);
|
|
58
|
+
if (ck)
|
|
59
|
+
entrypoint.addChunk(ck);
|
|
60
|
+
});
|
|
61
|
+
(0, import_lodash.forEach)(_entrypoint.assets, (_asset) => {
|
|
62
|
+
const asset = chunkGraph.getAssetByPath(_asset.name);
|
|
63
|
+
if (asset)
|
|
64
|
+
entrypoint.addAsset(asset);
|
|
65
|
+
});
|
|
66
|
+
chunkGraph.addEntryPoint(entrypoint);
|
|
67
|
+
});
|
|
68
|
+
return chunkGraph;
|
|
69
|
+
}
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
chunkTransform
|
|
73
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/chunks/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var chunks_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(chunks_exports);
|
|
18
|
+
__reExport(chunks_exports, require("./assetsModules"), module.exports);
|
|
19
|
+
__reExport(chunks_exports, require("./chunkTransform"), module.exports);
|
|
20
|
+
__reExport(chunks_exports, require("./assetsContent"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./assetsModules"),
|
|
24
|
+
...require("./chunkTransform"),
|
|
25
|
+
...require("./assetsContent")
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/build-utils/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var common_exports = {};
|
|
30
|
+
__export(common_exports, {
|
|
31
|
+
Chunks: () => Chunks,
|
|
32
|
+
ModuleGraph: () => ModuleGraph,
|
|
33
|
+
TransUtils: () => TransUtils,
|
|
34
|
+
Types: () => Types,
|
|
35
|
+
Webpack: () => Webpack
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(common_exports);
|
|
38
|
+
var Chunks = __toESM(require("./chunks"));
|
|
39
|
+
var Types = __toESM(require("../../types"));
|
|
40
|
+
var ModuleGraph = __toESM(require("./module-graph"));
|
|
41
|
+
var TransUtils = __toESM(require("./trans-utils"));
|
|
42
|
+
var Webpack = __toESM(require("./webpack/compatible"));
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
Chunks,
|
|
46
|
+
ModuleGraph,
|
|
47
|
+
TransUtils,
|
|
48
|
+
Types,
|
|
49
|
+
Webpack
|
|
50
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Plugin, SDK } from '@rsdoctor/types';
|
|
2
|
+
/**
|
|
3
|
+
* Reverse decode the location (loc) information.
|
|
4
|
+
* baseon
|
|
5
|
+
* // TODO::
|
|
6
|
+
* @link https://github.com/webpack/webpack/blob/main/lib/formatLocation.js#L30-L66
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPositionByStatsLocation(loc: string): SDK.SourceRange | undefined;
|
|
9
|
+
export declare function isWebpack5orRspack(compilation: Plugin.BaseCompilation): Boolean;
|
|
10
|
+
//# sourceMappingURL=compatible.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compatible.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/module-graph/compatible.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,GACV,GAAG,CAAC,WAAW,GAAG,SAAS,CAqC7B;AAED,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,CAAC,eAAe,GAClC,OAAO,CAET"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var compatible_exports = {};
|
|
20
|
+
__export(compatible_exports, {
|
|
21
|
+
getPositionByStatsLocation: () => getPositionByStatsLocation,
|
|
22
|
+
isWebpack5orRspack: () => isWebpack5orRspack
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(compatible_exports);
|
|
25
|
+
function getPositionByStatsLocation(loc) {
|
|
26
|
+
function formatPosition(loc2) {
|
|
27
|
+
const [line, column] = loc2.split(":");
|
|
28
|
+
return { line: Number(line), column: Number(column) };
|
|
29
|
+
}
|
|
30
|
+
if (loc.includes("-")) {
|
|
31
|
+
const positionString = loc.split("-");
|
|
32
|
+
const start = formatPosition(positionString[0]);
|
|
33
|
+
const end = formatPosition(positionString[1]);
|
|
34
|
+
return {
|
|
35
|
+
start,
|
|
36
|
+
end: Number.isNaN(end.column) ? {
|
|
37
|
+
line: start.line,
|
|
38
|
+
column: end.line
|
|
39
|
+
} : end
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (loc.includes(":")) {
|
|
43
|
+
return {
|
|
44
|
+
start: formatPosition(loc)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (loc.includes("[")) {
|
|
48
|
+
const result = loc.match(/\[(\d+)\]/);
|
|
49
|
+
return {
|
|
50
|
+
start: {
|
|
51
|
+
index: Number(result[1])
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function isWebpack5orRspack(compilation) {
|
|
57
|
+
return "moduleGraph" in compilation && Boolean(compilation.moduleGraph);
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
getPositionByStatsLocation,
|
|
62
|
+
isWebpack5orRspack
|
|
63
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/module-graph/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var module_graph_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(module_graph_exports);
|
|
18
|
+
__reExport(module_graph_exports, require("./transform"), module.exports);
|
|
19
|
+
__reExport(module_graph_exports, require("./compatible"), module.exports);
|
|
20
|
+
__reExport(module_graph_exports, require("./utils"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./transform"),
|
|
24
|
+
...require("./compatible"),
|
|
25
|
+
...require("./utils")
|
|
26
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Plugin } from '@rsdoctor/types';
|
|
2
|
+
import { ModuleGraph, ChunkGraph } from '@rsdoctor/graph';
|
|
3
|
+
export declare function getModulesFromArray(modules: Plugin.StatsModule[], collectedModules: Plugin.StatsModule[]): void;
|
|
4
|
+
/**
|
|
5
|
+
* this function can run in browser & node.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getModuleGraphByStats({ modules, chunks }: Plugin.StatsCompilation, root: string, chunkGraph: ChunkGraph): ModuleGraph;
|
|
8
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/module-graph/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAqB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAqC7E,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,EAC7B,gBAAgB,EAAE,MAAM,CAAC,WAAW,EAAE,QAKvC;AAaD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,gBAAgB,EAC5C,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,UAAU,eAqKvB"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var transform_exports = {};
|
|
30
|
+
__export(transform_exports, {
|
|
31
|
+
getModuleGraphByStats: () => getModuleGraphByStats,
|
|
32
|
+
getModulesFromArray: () => getModulesFromArray
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(transform_exports);
|
|
35
|
+
var import_types = require("@rsdoctor/types");
|
|
36
|
+
var import_path_browserify = __toESM(require("path-browserify"));
|
|
37
|
+
var import_graph = require("@rsdoctor/graph");
|
|
38
|
+
var import_utils = require("./utils");
|
|
39
|
+
var import_compatible = require("./compatible");
|
|
40
|
+
function getCanSkip(data) {
|
|
41
|
+
if (!data.identifier || !(data?.nameForCondition || data.name) || data.identifier.startsWith("webpack/runtime") || data?.name?.startsWith("(webpack)")) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function getGetModuleName(root, data) {
|
|
46
|
+
if (data.nameForCondition) {
|
|
47
|
+
return data.nameForCondition.replace("\0", "");
|
|
48
|
+
}
|
|
49
|
+
const name = data.name.replace(/ ?\+ ?\d+ ?modules$/, "");
|
|
50
|
+
return import_path_browserify.default.isAbsolute(name) ? name : import_path_browserify.default.join(root, name);
|
|
51
|
+
}
|
|
52
|
+
function getModuleFromChildren(module2, collectedModules) {
|
|
53
|
+
if (module2.type === "module" || typeof module2.type === "undefined") {
|
|
54
|
+
collectedModules.push(module2);
|
|
55
|
+
} else if ("children" in module2 && module2.children) {
|
|
56
|
+
getModulesFromArray(
|
|
57
|
+
module2.children,
|
|
58
|
+
collectedModules
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function getModulesFromArray(modules, collectedModules) {
|
|
63
|
+
modules.forEach((module2) => {
|
|
64
|
+
getModuleFromChildren(module2, collectedModules);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function getModulesFromChunks(chunks, collectedModules) {
|
|
68
|
+
chunks?.forEach((chunk) => {
|
|
69
|
+
if (chunk.modules?.length) {
|
|
70
|
+
collectedModules.push(...chunk.modules);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function getModuleGraphByStats({ modules, chunks }, root, chunkGraph) {
|
|
75
|
+
import_graph.ModuleGraph.init();
|
|
76
|
+
const moduleGraph = new import_graph.ModuleGraph();
|
|
77
|
+
const allModules = [];
|
|
78
|
+
const collectedModules = [];
|
|
79
|
+
getModulesFromArray(modules ?? [], collectedModules);
|
|
80
|
+
getModulesFromChunks(chunks ?? [], collectedModules);
|
|
81
|
+
for (const data of collectedModules ?? []) {
|
|
82
|
+
if (getCanSkip(data)) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (moduleGraph.getModuleByWebpackId(data.identifier)) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
allModules.push(data);
|
|
89
|
+
const isConcatenated = Boolean(data.modules && data.modules.length > 0);
|
|
90
|
+
const concatenatedModule = new import_graph.Module(
|
|
91
|
+
data.identifier,
|
|
92
|
+
getGetModuleName(root, data),
|
|
93
|
+
data.depth === 0,
|
|
94
|
+
isConcatenated ? import_types.SDK.ModuleKind.Concatenation : import_types.SDK.ModuleKind.Normal
|
|
95
|
+
);
|
|
96
|
+
data.chunks?.forEach((_chunkId) => {
|
|
97
|
+
const chunk = chunkGraph.getChunkById(String(_chunkId));
|
|
98
|
+
chunk && concatenatedModule.addChunk(chunk);
|
|
99
|
+
});
|
|
100
|
+
moduleGraph.addModule(concatenatedModule);
|
|
101
|
+
if (data.source) {
|
|
102
|
+
concatenatedModule.setSource({
|
|
103
|
+
transformed: Buffer.isBuffer(data.source) ? data.source.toString() : data.source
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (typeof data.size === "number") {
|
|
107
|
+
concatenatedModule.setSize({
|
|
108
|
+
sourceSize: data.size,
|
|
109
|
+
transformedSize: data.size
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
for (const normal of data.modules ?? []) {
|
|
113
|
+
if (getCanSkip(normal)) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
allModules.push(normal);
|
|
117
|
+
const webpackId = normal.identifier;
|
|
118
|
+
const normalModule = moduleGraph.getModuleByWebpackId(webpackId) ?? new import_graph.Module(
|
|
119
|
+
webpackId,
|
|
120
|
+
getGetModuleName(root, normal),
|
|
121
|
+
normal.depth === 0,
|
|
122
|
+
import_types.SDK.ModuleKind.Normal
|
|
123
|
+
);
|
|
124
|
+
if (normal.chunks?.length) {
|
|
125
|
+
normal.chunks?.forEach((_chunkId) => {
|
|
126
|
+
const chunk = chunkGraph.getChunkById(String(_chunkId));
|
|
127
|
+
chunk && normalModule.addChunk(chunk);
|
|
128
|
+
});
|
|
129
|
+
} else {
|
|
130
|
+
data.chunks?.forEach((_chunkId) => {
|
|
131
|
+
const chunk = chunkGraph.getChunkById(String(_chunkId));
|
|
132
|
+
chunk && normalModule.addChunk(chunk);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
if (normal.source) {
|
|
136
|
+
normalModule.setSource({
|
|
137
|
+
transformed: Buffer.isBuffer(normal.source) ? normal.source.toString() : normal.source
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (typeof normal.size === "number") {
|
|
141
|
+
normalModule.setSize({
|
|
142
|
+
sourceSize: normal.size,
|
|
143
|
+
transformedSize: normal.size
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
moduleGraph.addModule(normalModule);
|
|
147
|
+
concatenatedModule.addNormalModule(normalModule);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
for (const module2 of allModules) {
|
|
151
|
+
const currentModule = moduleGraph.getModuleByWebpackId(
|
|
152
|
+
module2.identifier ?? ""
|
|
153
|
+
);
|
|
154
|
+
if (!currentModule) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const dependencies = (module2.reasons ?? []).filter(import_utils.isImportDependency).filter((item) => Boolean(item.moduleIdentifier && item.userRequest));
|
|
158
|
+
(module2.reasons ?? []).filter((item) => item.type === "from origin").forEach(
|
|
159
|
+
(dep) => dep?.children?.forEach(
|
|
160
|
+
(_d) => dependencies.push({ ...dep, ..._d, children: void 0 })
|
|
161
|
+
)
|
|
162
|
+
);
|
|
163
|
+
for (const dep of dependencies) {
|
|
164
|
+
const rawRequest = dep.userRequest;
|
|
165
|
+
const requestModule = moduleGraph.getModuleByWebpackId(
|
|
166
|
+
dep.moduleIdentifier
|
|
167
|
+
);
|
|
168
|
+
if (!requestModule) {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (!requestModule.getDependencyByRequest(rawRequest)) {
|
|
172
|
+
const data = requestModule.addDependency(
|
|
173
|
+
rawRequest,
|
|
174
|
+
currentModule,
|
|
175
|
+
(0, import_utils.getImportKind)(dep)
|
|
176
|
+
);
|
|
177
|
+
if (data) {
|
|
178
|
+
moduleGraph.addDependency(data);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const dependency = requestModule.getDependencyByRequest(rawRequest);
|
|
182
|
+
if (dependency && dep?.loc) {
|
|
183
|
+
const position = (0, import_compatible.getPositionByStatsLocation)(dep.loc);
|
|
184
|
+
if (position) {
|
|
185
|
+
dependency.addStatement(
|
|
186
|
+
new import_graph.Statement(requestModule, {
|
|
187
|
+
transformed: position
|
|
188
|
+
})
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return moduleGraph;
|
|
195
|
+
}
|
|
196
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
197
|
+
0 && (module.exports = {
|
|
198
|
+
getModuleGraphByStats,
|
|
199
|
+
getModulesFromArray
|
|
200
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SDK } from '@rsdoctor/types';
|
|
2
|
+
import type { ModuleGraph } from '@rsdoctor/graph';
|
|
3
|
+
interface DependencyData {
|
|
4
|
+
type?: string;
|
|
5
|
+
}
|
|
6
|
+
/** Determine whether it is the import statement itself */
|
|
7
|
+
export declare function isImportDependency({ type }: DependencyData): boolean;
|
|
8
|
+
export declare function getImportKind(dep: DependencyData): SDK.DependencyKind;
|
|
9
|
+
/**
|
|
10
|
+
* Remove the css module without connection
|
|
11
|
+
* - This will happen when the user uses the mini-css plug-in.
|
|
12
|
+
*/
|
|
13
|
+
export declare function removeNoImportStyle(graph: ModuleGraph): void;
|
|
14
|
+
export declare function isStyleExt(path: string): boolean;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/module-graph/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,0DAA0D;AAC1D,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE,cAAc,WAS1D;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,GAAG,CAAC,cAAc,CAwBrE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,QAMrD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,WAEtC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
getImportKind: () => getImportKind,
|
|
22
|
+
isImportDependency: () => isImportDependency,
|
|
23
|
+
isStyleExt: () => isStyleExt,
|
|
24
|
+
removeNoImportStyle: () => removeNoImportStyle
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(utils_exports);
|
|
27
|
+
var import_types = require("@rsdoctor/types");
|
|
28
|
+
function isImportDependency({ type }) {
|
|
29
|
+
return type === "harmony side effect evaluation" || type === "cjs require" || type === "cjs full require" || type === "cjs export require" || type === "provided" || type === "esm import";
|
|
30
|
+
}
|
|
31
|
+
function getImportKind(dep) {
|
|
32
|
+
const { type } = dep;
|
|
33
|
+
if (!type) {
|
|
34
|
+
return import_types.SDK.DependencyKind.Unknown;
|
|
35
|
+
}
|
|
36
|
+
if (type.includes("harmony")) {
|
|
37
|
+
return import_types.SDK.DependencyKind.ImportStatement;
|
|
38
|
+
}
|
|
39
|
+
if (type.includes("cjs")) {
|
|
40
|
+
return import_types.SDK.DependencyKind.RequireCall;
|
|
41
|
+
}
|
|
42
|
+
if (type.includes("import()")) {
|
|
43
|
+
return import_types.SDK.DependencyKind.DynamicImport;
|
|
44
|
+
}
|
|
45
|
+
if (type.includes("amd")) {
|
|
46
|
+
return import_types.SDK.DependencyKind.AMDRequire;
|
|
47
|
+
}
|
|
48
|
+
return import_types.SDK.DependencyKind.Unknown;
|
|
49
|
+
}
|
|
50
|
+
function removeNoImportStyle(graph) {
|
|
51
|
+
graph.getModules().filter((module2) => isStyleExt(module2.path)).filter((item) => item.getImported().length === 0).forEach((item) => graph.removeModule(item));
|
|
52
|
+
}
|
|
53
|
+
function isStyleExt(path) {
|
|
54
|
+
return /\.(c|le|sa|sc)ss(\?.*)?$/.test(path);
|
|
55
|
+
}
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
getImportKind,
|
|
59
|
+
isImportDependency,
|
|
60
|
+
isStyleExt,
|
|
61
|
+
removeNoImportStyle
|
|
62
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/trans-utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var trans_utils_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(trans_utils_exports);
|
|
18
|
+
__reExport(trans_utils_exports, require("./transStats"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./transStats")
|
|
22
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ChunkGraph } from '@rsdoctor/graph';
|
|
2
|
+
import { Plugin } from '@rsdoctor/types';
|
|
3
|
+
export declare function transStats(json: Plugin.StatsCompilation): Promise<{
|
|
4
|
+
chunkGraph: ChunkGraph;
|
|
5
|
+
moduleGraph: import("@rsdoctor/graph").ModuleGraph;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=transStats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transStats.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/trans-utils/transStats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,gBAAgB;;;GAO7D"}
|