@rsdoctor/webpack-plugin 1.5.3-alpha.0 → 1.5.4
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/constants.d.ts +48 -1
- package/dist/index.cjs +110 -112
- package/dist/index.js +9 -17
- package/package.json +8 -8
package/dist/constants.d.ts
CHANGED
|
@@ -4,4 +4,51 @@ export declare const pluginTapPostOptions: Tap;
|
|
|
4
4
|
export declare const pluginTapPreOptions: Tap;
|
|
5
5
|
export declare const internalPluginTapPreOptions: (namespace: string) => Tap;
|
|
6
6
|
export declare const internalPluginTapPostOptions: (namespace: string) => Tap;
|
|
7
|
-
export declare const pkg:
|
|
7
|
+
export declare const pkg: {
|
|
8
|
+
name: string;
|
|
9
|
+
version: string;
|
|
10
|
+
repository: {
|
|
11
|
+
type: string;
|
|
12
|
+
url: string;
|
|
13
|
+
directory: string;
|
|
14
|
+
};
|
|
15
|
+
license: string;
|
|
16
|
+
main: string;
|
|
17
|
+
types: string;
|
|
18
|
+
files: string[];
|
|
19
|
+
type: string;
|
|
20
|
+
exports: {
|
|
21
|
+
".": {
|
|
22
|
+
types: string;
|
|
23
|
+
import: string;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
scripts: {
|
|
28
|
+
dev: string;
|
|
29
|
+
build: string;
|
|
30
|
+
start: string;
|
|
31
|
+
test: string;
|
|
32
|
+
};
|
|
33
|
+
dependencies: {
|
|
34
|
+
"@rsdoctor/core": string;
|
|
35
|
+
"@rsdoctor/graph": string;
|
|
36
|
+
"@rsdoctor/sdk": string;
|
|
37
|
+
"@rsdoctor/types": string;
|
|
38
|
+
"@rsdoctor/utils": string;
|
|
39
|
+
};
|
|
40
|
+
devDependencies: {
|
|
41
|
+
"@types/node": string;
|
|
42
|
+
"@types/tapable": string;
|
|
43
|
+
tslib: string;
|
|
44
|
+
typescript: string;
|
|
45
|
+
webpack: string;
|
|
46
|
+
};
|
|
47
|
+
peerDependencies: {
|
|
48
|
+
webpack: string;
|
|
49
|
+
};
|
|
50
|
+
publishConfig: {
|
|
51
|
+
access: string;
|
|
52
|
+
registry: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
let globalController;
|
|
2
3
|
const __rslib_import_meta_url__ = "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
3
|
-
var
|
|
4
|
-
"./package.json" (module) {
|
|
5
|
-
module.exports = JSON.parse('{"name":"@rsdoctor/webpack-plugin","version":"1.5.3-alpha.0","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/webpack-plugin"},"license":"MIT","main":"dist/index.cjs","types":"dist/index.d.ts","files":["dist"],"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.cjs"}},"scripts":{"dev":"npm run start","build":"rslib build","start":"rslib build -w","test":"rstest run"},"dependencies":{"@rsdoctor/core":"workspace:*","@rsdoctor/graph":"workspace:*","@rsdoctor/sdk":"workspace:*","@rsdoctor/types":"workspace:*","@rsdoctor/utils":"workspace:*"},"devDependencies":{"@types/node":"^22.8.1","@types/tapable":"2.2.7","tslib":"2.8.1","typescript":"^5.9.2","webpack":"^5.97.1"},"peerDependencies":{"webpack":"5.x"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
|
|
6
|
-
}
|
|
7
|
-
}, __webpack_module_cache__ = {};
|
|
8
|
-
function __webpack_require__(moduleId) {
|
|
9
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
10
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
-
exports: {}
|
|
13
|
-
};
|
|
14
|
-
return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
|
|
15
|
-
}
|
|
4
|
+
var __webpack_require__ = {};
|
|
16
5
|
__webpack_require__.n = (module)=>{
|
|
17
6
|
var getter = module && module.__esModule ? ()=>module.default : ()=>module;
|
|
18
7
|
return __webpack_require__.d(getter, {
|
|
@@ -31,110 +20,119 @@ __webpack_require__.n = (module)=>{
|
|
|
31
20
|
});
|
|
32
21
|
};
|
|
33
22
|
var __webpack_exports__ = {};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
name
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
23
|
+
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
24
|
+
RsdoctorWebpackMultiplePlugin: ()=>RsdoctorWebpackMultiplePlugin,
|
|
25
|
+
RsdoctorWebpackPlugin: ()=>RsdoctorWebpackPlugin,
|
|
26
|
+
defineRule: ()=>rules_namespaceObject.defineRule,
|
|
27
|
+
LinterType: ()=>rules_namespaceObject.LinterType
|
|
28
|
+
});
|
|
29
|
+
const build_utils_namespaceObject = require("@rsdoctor/core/build-utils"), plugins_namespaceObject = require("@rsdoctor/core/plugins"), graph_namespaceObject = require("@rsdoctor/graph"), sdk_namespaceObject = require("@rsdoctor/sdk"), types_namespaceObject = require("@rsdoctor/types"), build_namespaceObject = require("@rsdoctor/utils/build"), common_namespaceObject = require("@rsdoctor/utils/common"), logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
30
|
+
var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/webpack-plugin","version":"1.5.4","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/webpack-plugin"},"license":"MIT","main":"dist/index.cjs","types":"dist/index.d.ts","files":["dist"],"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.cjs"}},"scripts":{"dev":"npm run start","build":"rslib build","start":"rslib build -w","test":"rstest run"},"dependencies":{"@rsdoctor/core":"workspace:*","@rsdoctor/graph":"workspace:*","@rsdoctor/sdk":"workspace:*","@rsdoctor/types":"workspace:*","@rsdoctor/utils":"workspace:*"},"devDependencies":{"@types/node":"^22.8.1","@types/tapable":"2.3.0","tslib":"2.8.1","typescript":"^5.9.2","webpack":"^5.105.4"},"peerDependencies":{"webpack":"5.x"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
|
|
31
|
+
const pluginTapName = 'RsdoctorWebpackPlugin', pluginTapPostOptions = {
|
|
32
|
+
name: pluginTapName,
|
|
33
|
+
stage: 999
|
|
34
|
+
}, pluginTapPreOptions = null, internalPluginTapPreOptions = (namespace)=>({
|
|
35
|
+
name: `${pluginTapName}:${namespace}`,
|
|
36
|
+
stage: -998
|
|
37
|
+
}), internalPluginTapPostOptions = (namespace)=>({
|
|
38
|
+
name: `${pluginTapName}:${namespace}`,
|
|
39
|
+
stage: 1000
|
|
40
|
+
}), pkg = package_namespaceObject, external_path_namespaceObject = require("path");
|
|
41
|
+
var external_path_default = __webpack_require__.n(external_path_namespaceObject);
|
|
42
|
+
let hasGreeted = !1;
|
|
43
|
+
class RsdoctorWebpackPlugin {
|
|
44
|
+
name = pluginTapName;
|
|
45
|
+
options;
|
|
46
|
+
sdk;
|
|
47
|
+
isRsdoctorPlugin;
|
|
48
|
+
modulesGraph;
|
|
49
|
+
_bootstrapTask;
|
|
50
|
+
browserIsOpened = !1;
|
|
51
|
+
chunkGraph;
|
|
52
|
+
outsideInstance;
|
|
53
|
+
constructor(options){
|
|
54
|
+
this.options = (0, plugins_namespaceObject.normalizeUserConfig)(options);
|
|
55
|
+
const { port, output, innerClientPath, printLog, sdkInstance } = this.options;
|
|
56
|
+
this.sdk = sdkInstance ?? new sdk_namespaceObject.RsdoctorSDK({
|
|
57
|
+
port: port,
|
|
58
|
+
name: pluginTapName,
|
|
59
|
+
root: process.cwd(),
|
|
60
|
+
type: output.reportCodeType,
|
|
61
|
+
config: {
|
|
62
|
+
innerClientPath: innerClientPath,
|
|
63
|
+
printLog: printLog,
|
|
64
|
+
mode: output.mode,
|
|
65
|
+
brief: output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && output.options || void 0,
|
|
66
|
+
features: {
|
|
67
|
+
treeShaking: this.options.features.treeShaking
|
|
71
68
|
}
|
|
72
|
-
}), this.modulesGraph = new graph_namespaceObject.ModuleGraph(), this.chunkGraph = new graph_namespaceObject.ChunkGraph(), this.isRsdoctorPlugin = !0;
|
|
73
|
-
}
|
|
74
|
-
apply(compiler) {
|
|
75
|
-
hasGreeted || compiler.isChild() || (hasGreeted = !0, logger_namespaceObject.logger.greet(`
|
|
76
|
-
\nRsdoctor v${pkg.version}\n`)), this._bootstrapTask || (this._bootstrapTask = this.sdk.bootstrap()), (0, plugins_namespaceObject.setSDK)(this.sdk), new plugins_namespaceObject.InternalSummaryPlugin(this).apply(compiler), this.options.features.loader && (new build_utils_namespaceObject.Loader.ProbeLoaderPlugin().apply(compiler), this.sdk.addClientRoutes([
|
|
77
|
-
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
|
|
78
|
-
]), common_namespaceObject.Loader.isVue(compiler) || new plugins_namespaceObject.InternalLoaderPlugin(this).apply(compiler)), this.options.features.resolver && new plugins_namespaceObject.InternalResolverPlugin(this).apply(compiler), this.options.features.plugins && new plugins_namespaceObject.InternalPluginsPlugin(this).apply(compiler), this.options.features.bundle && (new plugins_namespaceObject.InternalBundlePlugin(this).apply(compiler), new plugins_namespaceObject.InternalBundleTagPlugin(this).apply(compiler)), new plugins_namespaceObject.InternalErrorReporterPlugin(this).apply(compiler), new plugins_namespaceObject.InternalRulesPlugin(this).apply(compiler), new plugins_namespaceObject.InternalProgressPlugin(this).apply(compiler), compiler.hooks.afterPlugins.tap(pluginTapPostOptions, this.afterPlugins), compiler.hooks.watchRun.tapPromise(pluginTapPostOptions, this.beforeRun), compiler.hooks.beforeRun.tapPromise(pluginTapPostOptions, this.beforeRun), compiler.hooks.done.tapPromise({
|
|
79
|
-
...pluginTapPostOptions,
|
|
80
|
-
stage: pluginTapPostOptions.stage + 100
|
|
81
|
-
}, this.done.bind(this, compiler));
|
|
82
|
-
}
|
|
83
|
-
afterPlugins = (compiler)=>{
|
|
84
|
-
if (compiler.isChild()) return;
|
|
85
|
-
let configuration = (0, plugins_namespaceObject.processCompilerConfig)(compiler.options), rspackVersion = 'rspackVersion' in compiler.webpack ? compiler.webpack.rspackVersion : void 0, webpackVersion = compiler.webpack?.version;
|
|
86
|
-
this.sdk.reportConfiguration({
|
|
87
|
-
name: rspackVersion ? 'rspack' : 'webpack',
|
|
88
|
-
version: rspackVersion || webpackVersion || 'unknown',
|
|
89
|
-
config: configuration,
|
|
90
|
-
root: (0, sdk_namespaceObject.findRoot)() || ''
|
|
91
|
-
}), configuration.name && this.sdk.setName(configuration.name);
|
|
92
|
-
};
|
|
93
|
-
beforeRun = async (compiler)=>{
|
|
94
|
-
compiler.isChild() || await this._bootstrapTask.then(()=>{
|
|
95
|
-
this.options.disableClientServer || this.browserIsOpened || this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] || (this.browserIsOpened = !0, this.sdk.server.openClientPage());
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
ensureModulesChunksGraphApplied(compiler) {
|
|
99
|
-
(0, plugins_namespaceObject.ensureModulesChunksGraphFn)(compiler, this);
|
|
100
|
-
}
|
|
101
|
-
done = async (compiler)=>{
|
|
102
|
-
try {
|
|
103
|
-
this.sdk.server.broadcast(), logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[Before Write Manifest]'`), this.outsideInstance && 'parent' in this.sdk && this.sdk.parent.master.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] ? '' : `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`)), this.sdk.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] ? '' : `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`)), await this.sdk.writeStore(), logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After Write Manifest]'`), this.options.disableClientServer || this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && Array.isArray(this.options.output.options?.type) && 1 === this.options.output.options.type.length && 'json' === this.options.output.options.type[0] ? (await this.sdk.dispose(), logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After SDK Dispose]'`)) : this.options.output.mode !== types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] || this.options.disableClientServer || await (0, plugins_namespaceObject.handleBriefModeReport)(this.sdk, this.options, this.options.disableClientServer);
|
|
104
|
-
} catch (e) {
|
|
105
|
-
console.error("[Rsdoctor] Webpack plugin this.done error", e);
|
|
106
69
|
}
|
|
107
|
-
};
|
|
70
|
+
}), this.modulesGraph = new graph_namespaceObject.ModuleGraph(), this.chunkGraph = new graph_namespaceObject.ChunkGraph(), this.isRsdoctorPlugin = !0;
|
|
108
71
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
72
|
+
apply(compiler) {
|
|
73
|
+
hasGreeted || compiler.isChild() || (hasGreeted = !0, logger_namespaceObject.logger.greet(`
|
|
74
|
+
\nRsdoctor v${package_namespaceObject.version}\n`)), this._bootstrapTask || (this._bootstrapTask = this.sdk.bootstrap()), (0, plugins_namespaceObject.setSDK)(this.sdk), new plugins_namespaceObject.InternalSummaryPlugin(this).apply(compiler), this.options.features.loader && (new build_utils_namespaceObject.Loader.ProbeLoaderPlugin().apply(compiler), this.sdk.addClientRoutes([
|
|
75
|
+
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
|
|
76
|
+
]), common_namespaceObject.Loader.isVue(compiler) || new plugins_namespaceObject.InternalLoaderPlugin(this).apply(compiler)), this.options.features.resolver && new plugins_namespaceObject.InternalResolverPlugin(this).apply(compiler), this.options.features.plugins && new plugins_namespaceObject.InternalPluginsPlugin(this).apply(compiler), this.options.features.bundle && (new plugins_namespaceObject.InternalBundlePlugin(this).apply(compiler), new plugins_namespaceObject.InternalBundleTagPlugin(this).apply(compiler)), new plugins_namespaceObject.InternalErrorReporterPlugin(this).apply(compiler), new plugins_namespaceObject.InternalRulesPlugin(this).apply(compiler), new plugins_namespaceObject.InternalProgressPlugin(this).apply(compiler), compiler.hooks.afterPlugins.tap(pluginTapPostOptions, this.afterPlugins), compiler.hooks.watchRun.tapPromise(pluginTapPostOptions, this.beforeRun), compiler.hooks.beforeRun.tapPromise(pluginTapPostOptions, this.beforeRun), compiler.hooks.done.tapPromise({
|
|
77
|
+
...pluginTapPostOptions,
|
|
78
|
+
stage: pluginTapPostOptions.stage + 100
|
|
79
|
+
}, this.done.bind(this, compiler));
|
|
80
|
+
}
|
|
81
|
+
afterPlugins = (compiler)=>{
|
|
82
|
+
if (compiler.isChild()) return;
|
|
83
|
+
let configuration = (0, plugins_namespaceObject.processCompilerConfig)(compiler.options), rspackVersion = 'rspackVersion' in compiler.webpack ? compiler.webpack.rspackVersion : void 0, webpackVersion = compiler.webpack?.version;
|
|
84
|
+
this.sdk.reportConfiguration({
|
|
85
|
+
name: rspackVersion ? 'rspack' : 'webpack',
|
|
86
|
+
version: rspackVersion || webpackVersion || 'unknown',
|
|
87
|
+
config: configuration,
|
|
88
|
+
root: (0, sdk_namespaceObject.findRoot)() || ''
|
|
89
|
+
}), configuration.name && this.sdk.setName(configuration.name);
|
|
90
|
+
};
|
|
91
|
+
beforeRun = async (compiler)=>{
|
|
92
|
+
compiler.isChild() || await this._bootstrapTask.then(()=>{
|
|
93
|
+
this.options.disableClientServer || this.browserIsOpened || this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] || (this.browserIsOpened = !0, this.sdk.server.openClientPage());
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
ensureModulesChunksGraphApplied(compiler) {
|
|
97
|
+
(0, plugins_namespaceObject.ensureModulesChunksGraphFn)(compiler, this);
|
|
98
|
+
}
|
|
99
|
+
done = async (compiler)=>{
|
|
100
|
+
try {
|
|
101
|
+
this.sdk.server.broadcast(), logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[Before Write Manifest]'`), this.outsideInstance && 'parent' in this.sdk && this.sdk.parent.master.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] ? '' : `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`)), this.sdk.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] ? '' : `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`)), await this.sdk.writeStore(), logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After Write Manifest]'`), this.options.disableClientServer || this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && Array.isArray(this.options.output.options?.type) && 1 === this.options.output.options.type.length && 'json' === this.options.output.options.type[0] ? (await this.sdk.dispose(), logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After SDK Dispose]'`)) : this.options.output.mode !== types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] || this.options.disableClientServer || await (0, plugins_namespaceObject.handleBriefModeReport)(this.sdk, this.options, this.options.disableClientServer);
|
|
102
|
+
} catch (e) {
|
|
103
|
+
console.error("[Rsdoctor] Webpack plugin this.done error", e);
|
|
134
104
|
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
class RsdoctorWebpackMultiplePlugin extends RsdoctorWebpackPlugin {
|
|
108
|
+
controller;
|
|
109
|
+
constructor(options = {}){
|
|
110
|
+
const controller = (()=>{
|
|
111
|
+
if (globalController) return globalController;
|
|
112
|
+
let controller = new sdk_namespaceObject.RsdoctorSDKController();
|
|
113
|
+
return globalController = controller, controller;
|
|
114
|
+
})(), normallizedOptions = (0, plugins_namespaceObject.normalizeUserConfig)(options), instance = controller.createSlave({
|
|
115
|
+
name: options.name || 'Builder',
|
|
116
|
+
stage: options.stage,
|
|
117
|
+
extraConfig: {
|
|
118
|
+
innerClientPath: normallizedOptions.innerClientPath,
|
|
119
|
+
printLog: normallizedOptions.printLog,
|
|
120
|
+
mode: normallizedOptions.output.mode ? normallizedOptions.output.mode : void 0,
|
|
121
|
+
brief: normallizedOptions.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && normallizedOptions.output.options || void 0
|
|
122
|
+
},
|
|
123
|
+
type: normallizedOptions.output.reportCodeType
|
|
124
|
+
});
|
|
125
|
+
super({
|
|
126
|
+
...options,
|
|
127
|
+
sdkInstance: instance
|
|
128
|
+
}), this.controller = controller;
|
|
135
129
|
}
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
apply(compiler) {
|
|
131
|
+
'dependencies' in compiler.options && (this.sdk.dependencies = compiler.options.dependencies), super.apply(compiler);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const rules_namespaceObject = require("@rsdoctor/core/rules");
|
|
135
|
+
for(var __rspack_i in exports.LinterType = __webpack_exports__.LinterType, exports.RsdoctorWebpackMultiplePlugin = __webpack_exports__.RsdoctorWebpackMultiplePlugin, exports.RsdoctorWebpackPlugin = __webpack_exports__.RsdoctorWebpackPlugin, exports.defineRule = __webpack_exports__.defineRule, __webpack_exports__)-1 === [
|
|
138
136
|
"LinterType",
|
|
139
137
|
"RsdoctorWebpackMultiplePlugin",
|
|
140
138
|
"RsdoctorWebpackPlugin",
|
package/dist/index.js
CHANGED
|
@@ -8,23 +8,11 @@ import { Process } from "@rsdoctor/utils/build";
|
|
|
8
8
|
import { Loader as common_Loader } from "@rsdoctor/utils/common";
|
|
9
9
|
import { logger } from "@rsdoctor/utils/logger";
|
|
10
10
|
import path from "path";
|
|
11
|
-
|
|
12
|
-
var __webpack_modules__ = {
|
|
13
|
-
"./package.json" (module) {
|
|
14
|
-
module.exports = JSON.parse('{"name":"@rsdoctor/webpack-plugin","version":"1.5.3-alpha.0","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/webpack-plugin"},"license":"MIT","main":"dist/index.cjs","types":"dist/index.d.ts","files":["dist"],"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.cjs"}},"scripts":{"dev":"npm run start","build":"rslib build","start":"rslib build -w","test":"rstest run"},"dependencies":{"@rsdoctor/core":"workspace:*","@rsdoctor/graph":"workspace:*","@rsdoctor/sdk":"workspace:*","@rsdoctor/types":"workspace:*","@rsdoctor/utils":"workspace:*"},"devDependencies":{"@types/node":"^22.8.1","@types/tapable":"2.2.7","tslib":"2.8.1","typescript":"^5.9.2","webpack":"^5.97.1"},"peerDependencies":{"webpack":"5.x"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
|
|
15
|
-
}
|
|
16
|
-
}, __webpack_module_cache__ = {};
|
|
11
|
+
var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/webpack-plugin","version":"1.5.4","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/webpack-plugin"},"license":"MIT","main":"dist/index.cjs","types":"dist/index.d.ts","files":["dist"],"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.cjs"}},"scripts":{"dev":"npm run start","build":"rslib build","start":"rslib build -w","test":"rstest run"},"dependencies":{"@rsdoctor/core":"workspace:*","@rsdoctor/graph":"workspace:*","@rsdoctor/sdk":"workspace:*","@rsdoctor/types":"workspace:*","@rsdoctor/utils":"workspace:*"},"devDependencies":{"@types/node":"^22.8.1","@types/tapable":"2.3.0","tslib":"2.8.1","typescript":"^5.9.2","webpack":"^5.105.4"},"peerDependencies":{"webpack":"5.x"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
|
|
17
12
|
let pluginTapName = 'RsdoctorWebpackPlugin', pluginTapPostOptions = {
|
|
18
13
|
name: pluginTapName,
|
|
19
14
|
stage: 999
|
|
20
|
-
},
|
|
21
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
22
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
23
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
24
|
-
exports: {}
|
|
25
|
-
};
|
|
26
|
-
return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
|
|
27
|
-
}("./package.json"), hasGreeted = !1;
|
|
15
|
+
}, hasGreeted = !1;
|
|
28
16
|
class RsdoctorWebpackPlugin {
|
|
29
17
|
name = pluginTapName;
|
|
30
18
|
options;
|
|
@@ -47,13 +35,16 @@ class RsdoctorWebpackPlugin {
|
|
|
47
35
|
innerClientPath: innerClientPath,
|
|
48
36
|
printLog: printLog,
|
|
49
37
|
mode: output.mode,
|
|
50
|
-
brief: output.mode === SDK.IMode[SDK.IMode.brief] && output.options || void 0
|
|
38
|
+
brief: output.mode === SDK.IMode[SDK.IMode.brief] && output.options || void 0,
|
|
39
|
+
features: {
|
|
40
|
+
treeShaking: this.options.features.treeShaking
|
|
41
|
+
}
|
|
51
42
|
}
|
|
52
43
|
}), this.modulesGraph = new ModuleGraph(), this.chunkGraph = new ChunkGraph(), this.isRsdoctorPlugin = !0;
|
|
53
44
|
}
|
|
54
45
|
apply(compiler) {
|
|
55
46
|
hasGreeted || compiler.isChild() || (hasGreeted = !0, logger.greet(`
|
|
56
|
-
\nRsdoctor v${
|
|
47
|
+
\nRsdoctor v${package_namespaceObject.version}\n`)), this._bootstrapTask || (this._bootstrapTask = this.sdk.bootstrap()), setSDK(this.sdk), new InternalSummaryPlugin(this).apply(compiler), this.options.features.loader && (new Loader.ProbeLoaderPlugin().apply(compiler), this.sdk.addClientRoutes([
|
|
57
48
|
Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
|
|
58
49
|
]), common_Loader.isVue(compiler) || new InternalLoaderPlugin(this).apply(compiler)), this.options.features.resolver && new InternalResolverPlugin(this).apply(compiler), this.options.features.plugins && new InternalPluginsPlugin(this).apply(compiler), this.options.features.bundle && (new InternalBundlePlugin(this).apply(compiler), new InternalBundleTagPlugin(this).apply(compiler)), new InternalErrorReporterPlugin(this).apply(compiler), new InternalRulesPlugin(this).apply(compiler), new InternalProgressPlugin(this).apply(compiler), compiler.hooks.afterPlugins.tap(pluginTapPostOptions, this.afterPlugins), compiler.hooks.watchRun.tapPromise(pluginTapPostOptions, this.beforeRun), compiler.hooks.beforeRun.tapPromise(pluginTapPostOptions, this.beforeRun), compiler.hooks.done.tapPromise({
|
|
59
50
|
...pluginTapPostOptions,
|
|
@@ -113,4 +104,5 @@ class RsdoctorWebpackMultiplePlugin extends RsdoctorWebpackPlugin {
|
|
|
113
104
|
'dependencies' in compiler.options && (this.sdk.dependencies = compiler.options.dependencies), super.apply(compiler);
|
|
114
105
|
}
|
|
115
106
|
}
|
|
116
|
-
export { LinterType,
|
|
107
|
+
export { LinterType, defineRule } from "@rsdoctor/core/rules";
|
|
108
|
+
export { RsdoctorWebpackMultiplePlugin, RsdoctorWebpackPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/webpack-plugin",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@rsdoctor/core": "1.5.
|
|
25
|
-
"@rsdoctor/
|
|
26
|
-
"@rsdoctor/
|
|
27
|
-
"@rsdoctor/
|
|
28
|
-
"@rsdoctor/
|
|
24
|
+
"@rsdoctor/core": "1.5.4",
|
|
25
|
+
"@rsdoctor/graph": "1.5.4",
|
|
26
|
+
"@rsdoctor/sdk": "1.5.4",
|
|
27
|
+
"@rsdoctor/types": "1.5.4",
|
|
28
|
+
"@rsdoctor/utils": "1.5.4"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^22.8.1",
|
|
32
|
-
"@types/tapable": "2.
|
|
32
|
+
"@types/tapable": "2.3.0",
|
|
33
33
|
"tslib": "2.8.1",
|
|
34
34
|
"typescript": "^5.9.2",
|
|
35
|
-
"webpack": "^5.
|
|
35
|
+
"webpack": "^5.105.4"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"webpack": "5.x"
|