@doracli/rspack 0.0.5 → 0.0.8

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,28 +1,17 @@
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';
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';
20
9
 
21
10
  type TAction = 'build' | 'server' | 'lib';
22
11
  type TEnvParams = {
23
- action: TAction;
24
- workRootDir: string;
25
- format?: TModule$1;
12
+ action: TAction;
13
+ workRootDir: string;
14
+ format?: TModule$1;
26
15
  };
27
16
 
28
17
  type TMode = Configuration['mode'];
@@ -38,43 +27,30 @@ type TPlugins = Configuration['plugins'];
38
27
  type TOptimization = Configuration['optimization'];
39
28
 
40
29
  type TBuildResult = {
41
- err: Error;
42
- stats: Stats;
30
+ err: Error;
31
+ stats: Stats;
43
32
  };
44
- declare class Compiler extends CompilerBase<
45
- RspackOptions,
46
- {
33
+ declare class Compiler extends CompilerBase<RspackOptions, {
47
34
  build: Promise<TBuildResult>;
48
35
  watch: Watching;
49
36
  server: 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>;
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>;
70
49
  }
71
50
 
72
51
  declare const getDevServer: (serviceConfig: Configuration$1) => Configuration$1;
73
52
 
74
- declare const getDevtool: (
75
- envParams: TEnvParams,
76
- devtoolConfig?: TDevtool
77
- ) => TDevtool;
53
+ declare const getDevtool: (envParams: TEnvParams, devtoolConfig?: TDevtool) => TDevtool;
78
54
 
79
55
  declare const getEntry: (params: TEnvParams, input?: string) => TEntry;
80
56
 
@@ -82,12 +58,9 @@ declare const getExternals: (externals: TExternals) => TExternals;
82
58
 
83
59
  declare const getMode: (envParams: TEnvParams, modeConfig?: TMode) => TMode;
84
60
 
85
- declare const getCssBaseLoader: (
86
- envParams: TEnvParams,
87
- options?: {
61
+ declare const getCssBaseLoader: (envParams: TEnvParams, options?: {
88
62
  postcssPluginExtra?: TAny[];
89
- }
90
- ) => any[];
63
+ }) => any[];
91
64
 
92
65
  declare const cssLoader: string;
93
66
  declare const postcssLoader: string;
@@ -96,35 +69,31 @@ declare const lessLoader: string;
96
69
  declare const swcLoader: string;
97
70
  declare const postcssPresetEnv: string;
98
71
 
99
- declare const getReactModulePreset: (
100
- envParams: TEnvParams,
101
- options?: {
72
+ declare const getReactModulePreset: (envParams: TEnvParams, options?: {
102
73
  postcssPluginExtra?: TAny[];
103
- }
104
- ) => _rspack_core.ModuleOptions;
74
+ }) => _rspack_core.ModuleOptions;
105
75
 
106
- declare const getOptimization: (params: { minimize: boolean }) => TOptimization;
76
+ declare const getOptimization: (params: {
77
+ minimize: boolean;
78
+ }) => TOptimization;
107
79
 
108
80
  declare const getOutput: (envParams: TEnvParams, output?: TOutput) => TOutput;
109
81
 
110
82
  declare const getHtmlWebpackPlugin: (params: Options) => any;
111
83
 
112
84
  declare class TsconfigPlugin {
113
- private workRootDir;
114
- constructor(workRootDir: string);
115
- apply(compiler: Compiler$1): void;
85
+ private workRootDir;
86
+ constructor(workRootDir: string);
87
+ apply(compiler: Compiler$1): void;
116
88
  }
117
89
 
118
90
  declare const getTsconfigPlugin: (envParams: TEnvParams) => TsconfigPlugin;
119
91
 
120
- declare const getReactPluginsPreset: (
121
- envParams: TEnvParams,
122
- options: {
92
+ declare const getReactPluginsPreset: (envParams: TEnvParams, options: {
123
93
  minimize?: boolean;
124
94
  WebpackBundleAnalyzerOptions?: TAny;
125
95
  HtmlWebpackPluginOptions?: Options;
126
- }
127
- ) => TPlugins;
96
+ }) => TPlugins;
128
97
 
129
98
  /**
130
99
  * 获取webpack的resolve配置
@@ -136,70 +105,25 @@ declare const getResolve: (resolveConfig: TResolve) => TResolve;
136
105
  declare const getResolveLoader: () => TResolveLoader;
137
106
 
138
107
  declare class Ctx {
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;
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;
149
118
  }
150
119
 
151
- declare const mergeRspackConfigs: <T extends Partial<Configuration>>(
152
- first: T | undefined,
153
- second: T | undefined
154
- ) => Partial<Configuration>;
120
+ declare const mergeRspackConfigs: <T extends Partial<Configuration>>(first: T | undefined, second: T | undefined) => Partial<Configuration>;
155
121
  /**
156
122
  * 合并多个 devServer 配置
157
123
  * @param configs
158
124
  * @returns
159
125
  */
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
- };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doracli/rspack",
3
- "version": "0.0.5",
3
+ "version": "0.0.8",
4
4
  "description": "use rspack",
5
5
  "author": "cclr <18843152354@163.com>",
6
6
  "homepage": "",
@@ -25,27 +25,28 @@
25
25
  "scripts": {
26
26
  "test": "vitest",
27
27
  "g:test": "vitest run",
28
- "build": "drr build"
28
+ "build": "drr build",
29
+ "g:build": "drr build"
29
30
  },
30
31
  "dependencies": {
31
- "@cclr/lang": "^0.1.49",
32
- "@cclr/utils": "^0.1.49",
33
- "@dorabag/file-pro": "^1.0.10",
34
- "@dorabag/open-browser": "^1.0.16",
35
- "@doracli/helper": "^0.0.5",
36
- "@doracli/preset-babel": "^0.0.5",
37
- "@doracli/type": "^0.0.5",
38
- "@rspack/core": "^1.6.8",
39
- "@rspack/dev-server": "^1.1.4",
32
+ "@cclr/lang": "^0.1.52",
33
+ "@cclr/utils": "^0.1.52",
34
+ "@dorabag/file-pro": "^1.0.18",
35
+ "@dorabag/open-browser": "^1.0.18",
36
+ "@doracli/helper": "^0.0.8",
37
+ "@doracli/preset-babel": "^0.0.8",
38
+ "@doracli/type": "^0.0.8",
39
+ "@rspack/core": "^1.7.0",
40
+ "@rspack/dev-server": "^1.1.5",
40
41
  "@rspack/plugin-html": "^0.5.8",
41
42
  "css-loader": "^7.1.2",
42
43
  "less": "^4.5.1",
43
44
  "less-loader": "^12.3.0",
44
45
  "postcss-loader": "^8.2.0",
45
- "postcss-preset-env": "^10.5.0",
46
+ "postcss-preset-env": "^10.6.0",
46
47
  "style-loader": "^4.0.0",
47
48
  "swc-loader": "^0.2.6",
48
49
  "webpack-bundle-analyzer": "^4.10.2"
49
50
  },
50
- "gitHead": "ac4c6829b2cec621ecf66b6324843773e8b5141f"
51
+ "gitHead": "f0bd0475ac70c3c95336633ffdab4a4ec9794ca7"
51
52
  }