@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.
@@ -1,17 +1,28 @@
1
- import { CompilerBase, ConfigCtx } from '@doracli/helper';
2
- import * as _rspack_core from '@rspack/core';
3
- import { Configuration, Stats, RspackOptions, Watching, DevServer, Compiler as Compiler$1 } from '@rspack/core';
4
- import { RspackDevServer, Configuration as Configuration$1 } from '@rspack/dev-server';
5
- import * as _doracli_type from '@doracli/type';
6
- import { TModule as TModule$1 } from '@doracli/type';
7
- import { TAny } from '@cclr/lang';
8
- import { Options } from '@rspack/plugin-html';
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
- action: TAction;
13
- workRootDir: string;
14
- format?: TModule$1;
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
- err: Error;
31
- stats: Stats;
41
+ err: Error;
42
+ stats: Stats;
32
43
  };
33
- declare class Compiler extends CompilerBase<RspackOptions, {
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
- context: (rspackConfig: Configuration) => Promise<{
39
- rebuild: () => Promise<TBuildResult>;
40
- cancel: () => Promise<void>;
41
- }>;
42
- inOutMap: (inputOutputMap: Record<string, string>) => Promise<TBuildResult>;
43
- input: (input: string) => Promise<{
44
- output: (output: TOutput) => Promise<TBuildResult>;
45
- }>;
46
- build: (rspackConfig: RspackOptions) => Promise<TBuildResult>;
47
- watch: (watchOptions: Configuration["watchOptions"], rspackConfig: Configuration, cb?: (err: Error | null, stats?: Stats) => void) => Watching;
48
- server: (serverOptions: DevServer, rspackConfig?: Configuration) => Promise<RspackDevServer>;
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: (envParams: TEnvParams, devtoolConfig?: TDevtool) => TDevtool;
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: (envParams: TEnvParams, options?: {
85
+ declare const getCssBaseLoader: (
86
+ envParams: TEnvParams,
87
+ options?: {
62
88
  postcssPluginExtra?: TAny[];
63
- }) => any[];
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: (envParams: TEnvParams, options?: {
99
+ declare const getReactModulePreset: (
100
+ envParams: TEnvParams,
101
+ options?: {
73
102
  postcssPluginExtra?: TAny[];
74
- }) => _rspack_core.ModuleOptions;
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
- private workRootDir;
86
- constructor(workRootDir: string);
87
- apply(compiler: Compiler$1): void;
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: (envParams: TEnvParams, options: {
120
+ declare const getReactPluginsPreset: (
121
+ envParams: TEnvParams,
122
+ options: {
93
123
  minimize?: boolean;
94
124
  WebpackBundleAnalyzerOptions?: TAny;
95
125
  HtmlWebpackPluginOptions?: Options;
96
- }) => TPlugins;
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
- configCtx: ConfigCtx;
109
- rspackConfig: Configuration;
110
- devServerConfig: Configuration$1;
111
- envParams: TEnvParams;
112
- constructor(configCtx: ConfigCtx);
113
- updateEnvParams(argv: Partial<TEnvParams>): void;
114
- updateRspackConfig(config: Configuration): void;
115
- updateDevServerConfig(config: Configuration$1): void;
116
- getDoraConfig(): _doracli_type.TDoraConfig;
117
- geTDoraConfigRspack(): _doracli_type.TDoraConfigWebpack;
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>>(first: T | undefined, second: T | undefined) => 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>>(...configs: (T | undefined)[]) => DevServer;
127
-
128
- export { Compiler, Ctx, cssLoader, getCssBaseLoader, getDevServer, getDevtool, getEntry, getExternals, getHtmlWebpackPlugin, getMode, getOptimization, getOutput, getReactModulePreset, getReactPluginsPreset, getResolve, getResolveLoader, getTsconfigPlugin, lessLoader, mergeRspackConfigs, mergeServerConfig, postcssLoader, postcssPresetEnv, styleLoader, swcLoader };
129
- export type { TAction, TBuildResult, TDevtool, TEntry, TEnvParams, TExperiments, TExternals, TMode, TModule, TOptimization, TOutput, TPlugins, TResolve, TResolveLoader };
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.2",
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.28",
32
- "@cclr/utils": "^0.1.28",
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.10",
35
- "@doracli/helper": "^0.0.2",
36
- "@doracli/preset-babel": "^0.0.2",
37
- "@doracli/type": "^0.0.2",
38
- "@rspack/core": "^1.5.8",
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.4.2",
42
+ "less": "^4.5.1",
43
43
  "less-loader": "^12.3.0",
44
44
  "postcss-loader": "^8.2.0",
45
- "postcss-preset-env": "^10.4.0",
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": "912cb44292b64679630a799974d18c22b2e69738"
50
+ "gitHead": "a978bb7e7b32c192b1eb527dae5f25bbe1a2af86"
51
51
  }