@doracli/rspack 0.0.2 → 0.0.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/README.md +1 -2
- package/lib/cjs/index.js +918 -510
- package/lib/esm/index.js +877 -505
- package/lib/type/index.d.ts +130 -54
- package/package.json +11 -11
package/lib/type/index.d.ts
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import type { TAny } from '@cclr/lang';
|
|
2
|
+
import type { ConfigCtx } from '@doracli/helper';
|
|
3
|
+
import { CompilerBase } from '@doracli/helper';
|
|
4
|
+
import type * as _doracli_type from '@doracli/type';
|
|
5
|
+
import type { TModule as TModule$1 } from '@doracli/type';
|
|
6
|
+
import type * as _rspack_core from '@rspack/core';
|
|
7
|
+
import type {
|
|
8
|
+
Compiler as Compiler$1,
|
|
9
|
+
Configuration,
|
|
10
|
+
DevServer,
|
|
11
|
+
RspackOptions,
|
|
12
|
+
Stats,
|
|
13
|
+
Watching,
|
|
14
|
+
} from '@rspack/core';
|
|
15
|
+
import type {
|
|
16
|
+
Configuration as Configuration$1,
|
|
17
|
+
RspackDevServer,
|
|
18
|
+
} from '@rspack/dev-server';
|
|
19
|
+
import type { Options } from '@rspack/plugin-html';
|
|
9
20
|
|
|
10
21
|
type TAction = 'build' | 'server' | 'lib';
|
|
11
22
|
type TEnvParams = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
action: TAction;
|
|
24
|
+
workRootDir: string;
|
|
25
|
+
format?: TModule$1;
|
|
15
26
|
};
|
|
16
27
|
|
|
17
28
|
type TMode = Configuration['mode'];
|
|
@@ -27,30 +38,43 @@ type TPlugins = Configuration['plugins'];
|
|
|
27
38
|
type TOptimization = Configuration['optimization'];
|
|
28
39
|
|
|
29
40
|
type TBuildResult = {
|
|
30
|
-
|
|
31
|
-
|
|
41
|
+
err: Error;
|
|
42
|
+
stats: Stats;
|
|
32
43
|
};
|
|
33
|
-
declare class Compiler extends CompilerBase<
|
|
44
|
+
declare class Compiler extends CompilerBase<
|
|
45
|
+
RspackOptions,
|
|
46
|
+
{
|
|
34
47
|
build: Promise<TBuildResult>;
|
|
35
48
|
watch: Watching;
|
|
36
49
|
server: Promise<RspackDevServer>;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
}
|
|
51
|
+
> {
|
|
52
|
+
context: (rspackConfig: Configuration) => Promise<{
|
|
53
|
+
rebuild: () => Promise<TBuildResult>;
|
|
54
|
+
cancel: () => Promise<void>;
|
|
55
|
+
}>;
|
|
56
|
+
inOutMap: (inputOutputMap: Record<string, string>) => Promise<TBuildResult>;
|
|
57
|
+
input: (input: string) => Promise<{
|
|
58
|
+
output: (output: TOutput) => Promise<TBuildResult>;
|
|
59
|
+
}>;
|
|
60
|
+
build: (rspackConfig: RspackOptions) => Promise<TBuildResult>;
|
|
61
|
+
watch: (
|
|
62
|
+
watchOptions: Configuration['watchOptions'],
|
|
63
|
+
rspackConfig: Configuration,
|
|
64
|
+
cb?: (err: Error | null, stats?: Stats) => void
|
|
65
|
+
) => Watching;
|
|
66
|
+
server: (
|
|
67
|
+
serverOptions: DevServer,
|
|
68
|
+
rspackConfig?: Configuration
|
|
69
|
+
) => Promise<RspackDevServer>;
|
|
49
70
|
}
|
|
50
71
|
|
|
51
72
|
declare const getDevServer: (serviceConfig: Configuration$1) => Configuration$1;
|
|
52
73
|
|
|
53
|
-
declare const getDevtool: (
|
|
74
|
+
declare const getDevtool: (
|
|
75
|
+
envParams: TEnvParams,
|
|
76
|
+
devtoolConfig?: TDevtool
|
|
77
|
+
) => TDevtool;
|
|
54
78
|
|
|
55
79
|
declare const getEntry: (params: TEnvParams, input?: string) => TEntry;
|
|
56
80
|
|
|
@@ -58,9 +82,12 @@ declare const getExternals: (externals: TExternals) => TExternals;
|
|
|
58
82
|
|
|
59
83
|
declare const getMode: (envParams: TEnvParams, modeConfig?: TMode) => TMode;
|
|
60
84
|
|
|
61
|
-
declare const getCssBaseLoader: (
|
|
85
|
+
declare const getCssBaseLoader: (
|
|
86
|
+
envParams: TEnvParams,
|
|
87
|
+
options?: {
|
|
62
88
|
postcssPluginExtra?: TAny[];
|
|
63
|
-
}
|
|
89
|
+
}
|
|
90
|
+
) => any[];
|
|
64
91
|
|
|
65
92
|
declare const cssLoader: string;
|
|
66
93
|
declare const postcssLoader: string;
|
|
@@ -69,31 +96,35 @@ declare const lessLoader: string;
|
|
|
69
96
|
declare const swcLoader: string;
|
|
70
97
|
declare const postcssPresetEnv: string;
|
|
71
98
|
|
|
72
|
-
declare const getReactModulePreset: (
|
|
99
|
+
declare const getReactModulePreset: (
|
|
100
|
+
envParams: TEnvParams,
|
|
101
|
+
options?: {
|
|
73
102
|
postcssPluginExtra?: TAny[];
|
|
74
|
-
}
|
|
103
|
+
}
|
|
104
|
+
) => _rspack_core.ModuleOptions;
|
|
75
105
|
|
|
76
|
-
declare const getOptimization: (params: {
|
|
77
|
-
minimize: boolean;
|
|
78
|
-
}) => TOptimization;
|
|
106
|
+
declare const getOptimization: (params: { minimize: boolean }) => TOptimization;
|
|
79
107
|
|
|
80
108
|
declare const getOutput: (envParams: TEnvParams, output?: TOutput) => TOutput;
|
|
81
109
|
|
|
82
110
|
declare const getHtmlWebpackPlugin: (params: Options) => any;
|
|
83
111
|
|
|
84
112
|
declare class TsconfigPlugin {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
113
|
+
private workRootDir;
|
|
114
|
+
constructor(workRootDir: string);
|
|
115
|
+
apply(compiler: Compiler$1): void;
|
|
88
116
|
}
|
|
89
117
|
|
|
90
118
|
declare const getTsconfigPlugin: (envParams: TEnvParams) => TsconfigPlugin;
|
|
91
119
|
|
|
92
|
-
declare const getReactPluginsPreset: (
|
|
120
|
+
declare const getReactPluginsPreset: (
|
|
121
|
+
envParams: TEnvParams,
|
|
122
|
+
options: {
|
|
93
123
|
minimize?: boolean;
|
|
94
124
|
WebpackBundleAnalyzerOptions?: TAny;
|
|
95
125
|
HtmlWebpackPluginOptions?: Options;
|
|
96
|
-
}
|
|
126
|
+
}
|
|
127
|
+
) => TPlugins;
|
|
97
128
|
|
|
98
129
|
/**
|
|
99
130
|
* 获取webpack的resolve配置
|
|
@@ -105,25 +136,70 @@ declare const getResolve: (resolveConfig: TResolve) => TResolve;
|
|
|
105
136
|
declare const getResolveLoader: () => TResolveLoader;
|
|
106
137
|
|
|
107
138
|
declare class Ctx {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
139
|
+
configCtx: ConfigCtx;
|
|
140
|
+
rspackConfig: Configuration;
|
|
141
|
+
devServerConfig: Configuration$1;
|
|
142
|
+
envParams: TEnvParams;
|
|
143
|
+
constructor(configCtx: ConfigCtx);
|
|
144
|
+
updateEnvParams(argv: Partial<TEnvParams>): void;
|
|
145
|
+
updateRspackConfig(config: Configuration): void;
|
|
146
|
+
updateDevServerConfig(config: Configuration$1): void;
|
|
147
|
+
getDoraConfig(): _doracli_type.TDoraConfig;
|
|
148
|
+
geTDoraConfigRspack(): _doracli_type.TDoraConfigWebpack;
|
|
118
149
|
}
|
|
119
150
|
|
|
120
|
-
declare const mergeRspackConfigs: <T extends Partial<Configuration>>(
|
|
151
|
+
declare const mergeRspackConfigs: <T extends Partial<Configuration>>(
|
|
152
|
+
first: T | undefined,
|
|
153
|
+
second: T | undefined
|
|
154
|
+
) => Partial<Configuration>;
|
|
121
155
|
/**
|
|
122
156
|
* 合并多个 devServer 配置
|
|
123
157
|
* @param configs
|
|
124
158
|
* @returns
|
|
125
159
|
*/
|
|
126
|
-
declare const mergeServerConfig: <T extends Partial<DevServer>>(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
160
|
+
declare const mergeServerConfig: <T extends Partial<DevServer>>(
|
|
161
|
+
...configs: (T | undefined)[]
|
|
162
|
+
) => DevServer;
|
|
163
|
+
|
|
164
|
+
export {
|
|
165
|
+
Compiler,
|
|
166
|
+
cssLoader,
|
|
167
|
+
Ctx,
|
|
168
|
+
getCssBaseLoader,
|
|
169
|
+
getDevServer,
|
|
170
|
+
getDevtool,
|
|
171
|
+
getEntry,
|
|
172
|
+
getExternals,
|
|
173
|
+
getHtmlWebpackPlugin,
|
|
174
|
+
getMode,
|
|
175
|
+
getOptimization,
|
|
176
|
+
getOutput,
|
|
177
|
+
getReactModulePreset,
|
|
178
|
+
getReactPluginsPreset,
|
|
179
|
+
getResolve,
|
|
180
|
+
getResolveLoader,
|
|
181
|
+
getTsconfigPlugin,
|
|
182
|
+
lessLoader,
|
|
183
|
+
mergeRspackConfigs,
|
|
184
|
+
mergeServerConfig,
|
|
185
|
+
postcssLoader,
|
|
186
|
+
postcssPresetEnv,
|
|
187
|
+
styleLoader,
|
|
188
|
+
swcLoader,
|
|
189
|
+
};
|
|
190
|
+
export type {
|
|
191
|
+
TAction,
|
|
192
|
+
TBuildResult,
|
|
193
|
+
TDevtool,
|
|
194
|
+
TEntry,
|
|
195
|
+
TEnvParams,
|
|
196
|
+
TExperiments,
|
|
197
|
+
TExternals,
|
|
198
|
+
TMode,
|
|
199
|
+
TModule,
|
|
200
|
+
TOptimization,
|
|
201
|
+
TOutput,
|
|
202
|
+
TPlugins,
|
|
203
|
+
TResolve,
|
|
204
|
+
TResolveLoader,
|
|
205
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doracli/rspack",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "use rspack",
|
|
5
5
|
"author": "cclr <18843152354@163.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -28,24 +28,24 @@
|
|
|
28
28
|
"build": "ccf build"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@cclr/lang": "^0.1.
|
|
32
|
-
"@cclr/utils": "^0.1.
|
|
31
|
+
"@cclr/lang": "^0.1.44",
|
|
32
|
+
"@cclr/utils": "^0.1.44",
|
|
33
33
|
"@dorabag/file-pro": "^1.0.10",
|
|
34
|
-
"@dorabag/open-browser": "^1.0.
|
|
35
|
-
"@doracli/helper": "^0.0.
|
|
36
|
-
"@doracli/preset-babel": "^0.0.
|
|
37
|
-
"@doracli/type": "^0.0.
|
|
38
|
-
"@rspack/core": "^1.
|
|
34
|
+
"@dorabag/open-browser": "^1.0.16",
|
|
35
|
+
"@doracli/helper": "^0.0.4",
|
|
36
|
+
"@doracli/preset-babel": "^0.0.4",
|
|
37
|
+
"@doracli/type": "^0.0.4",
|
|
38
|
+
"@rspack/core": "^1.6.8",
|
|
39
39
|
"@rspack/dev-server": "^1.1.4",
|
|
40
40
|
"@rspack/plugin-html": "^0.5.8",
|
|
41
41
|
"css-loader": "^7.1.2",
|
|
42
|
-
"less": "^4.
|
|
42
|
+
"less": "^4.5.1",
|
|
43
43
|
"less-loader": "^12.3.0",
|
|
44
44
|
"postcss-loader": "^8.2.0",
|
|
45
|
-
"postcss-preset-env": "^10.
|
|
45
|
+
"postcss-preset-env": "^10.5.0",
|
|
46
46
|
"style-loader": "^4.0.0",
|
|
47
47
|
"swc-loader": "^0.2.6",
|
|
48
48
|
"webpack-bundle-analyzer": "^4.10.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "a978bb7e7b32c192b1eb527dae5f25bbe1a2af86"
|
|
51
51
|
}
|