@rsdoctor/rspack-plugin 0.2.2 → 0.2.3
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/plugin.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class RsdoctorRspackPlugin<Rules extends Linter.ExtendRuleData[]>
|
|
|
10
10
|
protected browserIsOpened: boolean;
|
|
11
11
|
modulesGraph: ModuleGraph;
|
|
12
12
|
options: RsdoctorPluginOptionsNormalized<Rules>;
|
|
13
|
+
outsideInstance: boolean;
|
|
13
14
|
constructor(options?: RsdoctorRspackPluginOptions<Rules>);
|
|
14
15
|
apply(compiler: unknown): unknown;
|
|
15
16
|
/**
|
package/dist/plugin.js
CHANGED
|
@@ -38,7 +38,7 @@ var import_types = require("@rsdoctor/types");
|
|
|
38
38
|
var import_path = __toESM(require("path"));
|
|
39
39
|
var import_constants = require("./constants");
|
|
40
40
|
var import_lodash = require("lodash");
|
|
41
|
-
var
|
|
41
|
+
var import_probeLoaderPlugin = require("./probeLoaderPlugin");
|
|
42
42
|
var import_common = require("@rsdoctor/utils/common");
|
|
43
43
|
class RsdoctorRspackPlugin {
|
|
44
44
|
constructor(options) {
|
|
@@ -60,8 +60,15 @@ class RsdoctorRspackPlugin {
|
|
|
60
60
|
this.sdk.addClientRoutes([
|
|
61
61
|
import_types.Manifest.RsdoctorManifestClientRoutes.Overall
|
|
62
62
|
]);
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
if (this.outsideInstance && "parent" in this.sdk) {
|
|
64
|
+
this.sdk.parent.master.setOutputDir(
|
|
65
|
+
import_path.default.resolve(
|
|
66
|
+
compiler.outputPath,
|
|
67
|
+
`./${import_types.Constants.RsdoctorOutputFolder}`
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
this.sdk.setOutputDir(
|
|
65
72
|
import_path.default.resolve(compiler.outputPath, `./${import_types.Constants.RsdoctorOutputFolder}`)
|
|
66
73
|
);
|
|
67
74
|
await this.sdk.writeStore();
|
|
@@ -80,6 +87,7 @@ class RsdoctorRspackPlugin {
|
|
|
80
87
|
config: { disableTOSUpload: this.options.disableTOSUpload },
|
|
81
88
|
innerClientPath: this.options.innerClientPath
|
|
82
89
|
});
|
|
90
|
+
this.outsideInstance = Boolean(this.options.sdkInstance);
|
|
83
91
|
this.modulesGraph = new import_graph.ModuleGraph();
|
|
84
92
|
}
|
|
85
93
|
apply(compiler) {
|
|
@@ -99,6 +107,7 @@ class RsdoctorRspackPlugin {
|
|
|
99
107
|
);
|
|
100
108
|
new import_plugins.InternalSummaryPlugin(this).apply(compiler);
|
|
101
109
|
if (this.options.features.loader && !import_common.Loader.isVue(compiler)) {
|
|
110
|
+
new import_probeLoaderPlugin.ProbeLoaderPlugin().apply(compiler);
|
|
102
111
|
new import_plugins.InternalLoaderPlugin(this).apply(compiler);
|
|
103
112
|
}
|
|
104
113
|
if (this.options.features.plugins) {
|
|
@@ -108,9 +117,7 @@ class RsdoctorRspackPlugin {
|
|
|
108
117
|
new import_plugins.InternalBundlePlugin(this).apply(compiler);
|
|
109
118
|
}
|
|
110
119
|
new import_plugins.InternalRulesPlugin(this).apply(compiler);
|
|
111
|
-
|
|
112
|
-
new import_builtinLoaderPlugin.BuiltinLoaderPlugin().apply(compiler);
|
|
113
|
-
}
|
|
120
|
+
new import_plugins.InternalErrorReporterPlugin(this).apply(compiler);
|
|
114
121
|
}
|
|
115
122
|
/**
|
|
116
123
|
* @description Generate ModuleGraph and ChunkGraph from stats and webpack module apis;
|
|
@@ -26,19 +26,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
|
|
29
|
+
var probeLoaderPlugin_exports = {};
|
|
30
|
+
__export(probeLoaderPlugin_exports, {
|
|
31
|
+
ProbeLoaderPlugin: () => ProbeLoaderPlugin
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(probeLoaderPlugin_exports);
|
|
34
34
|
var import_build_utils = require("@rsdoctor/core/build-utils");
|
|
35
35
|
var import_path = __toESM(require("path"));
|
|
36
36
|
const BuiltinLoaderName = "builtin:swc-loader";
|
|
37
|
-
|
|
37
|
+
const ESMLoaderFile = ".mjs";
|
|
38
|
+
class ProbeLoaderPlugin {
|
|
38
39
|
apply(compiler) {
|
|
39
40
|
compiler.hooks.beforeRun.tap(
|
|
40
41
|
{
|
|
41
|
-
name: "
|
|
42
|
+
name: "ProbeLoaderPlugin"
|
|
42
43
|
},
|
|
43
44
|
() => {
|
|
44
45
|
this.addProbeLoader(compiler);
|
|
@@ -46,7 +47,7 @@ class BuiltinLoaderPlugin {
|
|
|
46
47
|
);
|
|
47
48
|
compiler.hooks.watchRun.tap(
|
|
48
49
|
{
|
|
49
|
-
name: "
|
|
50
|
+
name: "ProbeLoaderPlugin"
|
|
50
51
|
},
|
|
51
52
|
() => {
|
|
52
53
|
this.addProbeLoader(compiler);
|
|
@@ -78,14 +79,20 @@ class BuiltinLoaderPlugin {
|
|
|
78
79
|
}
|
|
79
80
|
return rule;
|
|
80
81
|
};
|
|
81
|
-
compiler.options.module.rules = import_build_utils.Utils.
|
|
82
|
+
compiler.options.module.rules = import_build_utils.Utils.addProbeLoader2Rules(
|
|
82
83
|
rules,
|
|
83
84
|
BuiltinLoaderName,
|
|
84
85
|
appendRule
|
|
85
86
|
);
|
|
87
|
+
compiler.options.module.rules = import_build_utils.Utils.addProbeLoader2Rules(
|
|
88
|
+
rules,
|
|
89
|
+
ESMLoaderFile,
|
|
90
|
+
appendRule,
|
|
91
|
+
false
|
|
92
|
+
);
|
|
86
93
|
}
|
|
87
94
|
}
|
|
88
95
|
// Annotate the CommonJS export names for ESM import in node:
|
|
89
96
|
0 && (module.exports = {
|
|
90
|
-
|
|
97
|
+
ProbeLoaderPlugin
|
|
91
98
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/rspack-plugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"loader-utils": "^2.0.4",
|
|
17
17
|
"lodash": "^4.17.21",
|
|
18
|
-
"@rsdoctor/core": "0.2.
|
|
19
|
-
"@rsdoctor/graph": "0.2.
|
|
20
|
-
"@rsdoctor/utils": "0.2.
|
|
21
|
-
"@rsdoctor/sdk": "0.2.
|
|
18
|
+
"@rsdoctor/core": "0.2.3",
|
|
19
|
+
"@rsdoctor/graph": "0.2.3",
|
|
20
|
+
"@rsdoctor/utils": "0.2.3",
|
|
21
|
+
"@rsdoctor/sdk": "0.2.3"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@rspack/core": "0.5.1",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@types/tapable": "2.2.2",
|
|
29
29
|
"tslib": "2.4.1",
|
|
30
30
|
"typescript": "^5.2.2",
|
|
31
|
-
"@rsdoctor/types": "0.2.
|
|
31
|
+
"@rsdoctor/types": "0.2.3"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@rspack/core": "^0.5.1"
|