@doracli/rspack 0.0.4 → 0.0.6

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,24 +1,24 @@
1
- <!DOCTYPE html>
2
- <html lang="zh-CN">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>cclr</title>
8
- <!-- 引入样式 -->
9
- <% for (var i in htmlWebpackPlugin.options.headBeforeStyle) { %>
10
- <link
11
- href="<%= htmlWebpackPlugin.options.headBeforeStyle[i] %>"
12
- rel="stylesheet"
13
- />
14
- <% } %>
15
-
16
- <!-- 引入js -->
17
- <% for (var i in htmlWebpackPlugin.options.headAfterScript) { %>
18
- <script src="<%= htmlWebpackPlugin.options.headAfterScript[i] %>"></script>
19
- <% } %>
20
- </head>
21
- <body>
22
- <div id="main">welcome use cclr !!</div>
23
- </body>
24
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>cclr</title>
8
+ <!-- 引入样式 -->
9
+ <% for (var i in htmlWebpackPlugin.options.headBeforeStyle) { %>
10
+ <link
11
+ href="<%= htmlWebpackPlugin.options.headBeforeStyle[i] %>"
12
+ rel="stylesheet"
13
+ />
14
+ <% } %>
15
+
16
+ <!-- 引入js -->
17
+ <% for (var i in htmlWebpackPlugin.options.headAfterScript) { %>
18
+ <script src="<%= htmlWebpackPlugin.options.headAfterScript[i] %>"></script>
19
+ <% } %>
20
+ </head>
21
+ <body>
22
+ <div id="main">welcome use cclr !!</div>
23
+ </body>
24
+ </html>
@@ -1,205 +1,205 @@
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';
20
-
21
- type TAction = 'build' | 'server' | 'lib';
22
- type TEnvParams = {
23
- action: TAction;
24
- workRootDir: string;
25
- format?: TModule$1;
26
- };
27
-
28
- type TMode = Configuration['mode'];
29
- type TEntry = Configuration['entry'];
30
- type TOutput = Configuration['output'];
31
- type TDevtool = Configuration['devtool'];
32
- type TExternals = Configuration['externals'];
33
- type TExperiments = Configuration['experiments'];
34
- type TResolve = Configuration['resolve'];
35
- type TResolveLoader = Configuration['resolveLoader'];
36
- type TModule = Configuration['module'];
37
- type TPlugins = Configuration['plugins'];
38
- type TOptimization = Configuration['optimization'];
39
-
40
- type TBuildResult = {
41
- err: Error;
42
- stats: Stats;
43
- };
44
- declare class Compiler extends CompilerBase<
45
- RspackOptions,
46
- {
47
- build: Promise<TBuildResult>;
48
- watch: Watching;
49
- 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>;
70
- }
71
-
72
- declare const getDevServer: (serviceConfig: Configuration$1) => Configuration$1;
73
-
74
- declare const getDevtool: (
75
- envParams: TEnvParams,
76
- devtoolConfig?: TDevtool
77
- ) => TDevtool;
78
-
79
- declare const getEntry: (params: TEnvParams, input?: string) => TEntry;
80
-
81
- declare const getExternals: (externals: TExternals) => TExternals;
82
-
83
- declare const getMode: (envParams: TEnvParams, modeConfig?: TMode) => TMode;
84
-
85
- declare const getCssBaseLoader: (
86
- envParams: TEnvParams,
87
- options?: {
88
- postcssPluginExtra?: TAny[];
89
- }
90
- ) => any[];
91
-
92
- declare const cssLoader: string;
93
- declare const postcssLoader: string;
94
- declare const styleLoader: string;
95
- declare const lessLoader: string;
96
- declare const swcLoader: string;
97
- declare const postcssPresetEnv: string;
98
-
99
- declare const getReactModulePreset: (
100
- envParams: TEnvParams,
101
- options?: {
102
- postcssPluginExtra?: TAny[];
103
- }
104
- ) => _rspack_core.ModuleOptions;
105
-
106
- declare const getOptimization: (params: { minimize: boolean }) => TOptimization;
107
-
108
- declare const getOutput: (envParams: TEnvParams, output?: TOutput) => TOutput;
109
-
110
- declare const getHtmlWebpackPlugin: (params: Options) => any;
111
-
112
- declare class TsconfigPlugin {
113
- private workRootDir;
114
- constructor(workRootDir: string);
115
- apply(compiler: Compiler$1): void;
116
- }
117
-
118
- declare const getTsconfigPlugin: (envParams: TEnvParams) => TsconfigPlugin;
119
-
120
- declare const getReactPluginsPreset: (
121
- envParams: TEnvParams,
122
- options: {
123
- minimize?: boolean;
124
- WebpackBundleAnalyzerOptions?: TAny;
125
- HtmlWebpackPluginOptions?: Options;
126
- }
127
- ) => TPlugins;
128
-
129
- /**
130
- * 获取webpack的resolve配置
131
- * @param userResolve
132
- * @returns
133
- */
134
- declare const getResolve: (resolveConfig: TResolve) => TResolve;
135
-
136
- declare const getResolveLoader: () => TResolveLoader;
137
-
138
- 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;
149
- }
150
-
151
- declare const mergeRspackConfigs: <T extends Partial<Configuration>>(
152
- first: T | undefined,
153
- second: T | undefined
154
- ) => Partial<Configuration>;
155
- /**
156
- * 合并多个 devServer 配置
157
- * @param configs
158
- * @returns
159
- */
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
- };
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';
20
+
21
+ type TAction = 'build' | 'server' | 'lib';
22
+ type TEnvParams = {
23
+ action: TAction;
24
+ workRootDir: string;
25
+ format?: TModule$1;
26
+ };
27
+
28
+ type TMode = Configuration['mode'];
29
+ type TEntry = Configuration['entry'];
30
+ type TOutput = Configuration['output'];
31
+ type TDevtool = Configuration['devtool'];
32
+ type TExternals = Configuration['externals'];
33
+ type TExperiments = Configuration['experiments'];
34
+ type TResolve = Configuration['resolve'];
35
+ type TResolveLoader = Configuration['resolveLoader'];
36
+ type TModule = Configuration['module'];
37
+ type TPlugins = Configuration['plugins'];
38
+ type TOptimization = Configuration['optimization'];
39
+
40
+ type TBuildResult = {
41
+ err: Error;
42
+ stats: Stats;
43
+ };
44
+ declare class Compiler extends CompilerBase<
45
+ RspackOptions,
46
+ {
47
+ build: Promise<TBuildResult>;
48
+ watch: Watching;
49
+ 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>;
70
+ }
71
+
72
+ declare const getDevServer: (serviceConfig: Configuration$1) => Configuration$1;
73
+
74
+ declare const getDevtool: (
75
+ envParams: TEnvParams,
76
+ devtoolConfig?: TDevtool
77
+ ) => TDevtool;
78
+
79
+ declare const getEntry: (params: TEnvParams, input?: string) => TEntry;
80
+
81
+ declare const getExternals: (externals: TExternals) => TExternals;
82
+
83
+ declare const getMode: (envParams: TEnvParams, modeConfig?: TMode) => TMode;
84
+
85
+ declare const getCssBaseLoader: (
86
+ envParams: TEnvParams,
87
+ options?: {
88
+ postcssPluginExtra?: TAny[];
89
+ }
90
+ ) => any[];
91
+
92
+ declare const cssLoader: string;
93
+ declare const postcssLoader: string;
94
+ declare const styleLoader: string;
95
+ declare const lessLoader: string;
96
+ declare const swcLoader: string;
97
+ declare const postcssPresetEnv: string;
98
+
99
+ declare const getReactModulePreset: (
100
+ envParams: TEnvParams,
101
+ options?: {
102
+ postcssPluginExtra?: TAny[];
103
+ }
104
+ ) => _rspack_core.ModuleOptions;
105
+
106
+ declare const getOptimization: (params: { minimize: boolean }) => TOptimization;
107
+
108
+ declare const getOutput: (envParams: TEnvParams, output?: TOutput) => TOutput;
109
+
110
+ declare const getHtmlWebpackPlugin: (params: Options) => any;
111
+
112
+ declare class TsconfigPlugin {
113
+ private workRootDir;
114
+ constructor(workRootDir: string);
115
+ apply(compiler: Compiler$1): void;
116
+ }
117
+
118
+ declare const getTsconfigPlugin: (envParams: TEnvParams) => TsconfigPlugin;
119
+
120
+ declare const getReactPluginsPreset: (
121
+ envParams: TEnvParams,
122
+ options: {
123
+ minimize?: boolean;
124
+ WebpackBundleAnalyzerOptions?: TAny;
125
+ HtmlWebpackPluginOptions?: Options;
126
+ }
127
+ ) => TPlugins;
128
+
129
+ /**
130
+ * 获取webpack的resolve配置
131
+ * @param userResolve
132
+ * @returns
133
+ */
134
+ declare const getResolve: (resolveConfig: TResolve) => TResolve;
135
+
136
+ declare const getResolveLoader: () => TResolveLoader;
137
+
138
+ 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;
149
+ }
150
+
151
+ declare const mergeRspackConfigs: <T extends Partial<Configuration>>(
152
+ first: T | undefined,
153
+ second: T | undefined
154
+ ) => Partial<Configuration>;
155
+ /**
156
+ * 合并多个 devServer 配置
157
+ * @param configs
158
+ * @returns
159
+ */
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.4",
3
+ "version": "0.0.6",
4
4
  "description": "use rspack",
5
5
  "author": "cclr <18843152354@163.com>",
6
6
  "homepage": "",
@@ -25,16 +25,16 @@
25
25
  "scripts": {
26
26
  "test": "vitest",
27
27
  "g:test": "vitest run",
28
- "build": "ccf build"
28
+ "build": "drr build"
29
29
  },
30
30
  "dependencies": {
31
- "@cclr/lang": "^0.1.44",
32
- "@cclr/utils": "^0.1.44",
33
- "@dorabag/file-pro": "^1.0.10",
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",
31
+ "@cclr/lang": "^0.1.50",
32
+ "@cclr/utils": "^0.1.50",
33
+ "@dorabag/file-pro": "^1.0.18",
34
+ "@dorabag/open-browser": "^1.0.18",
35
+ "@doracli/helper": "^0.0.6",
36
+ "@doracli/preset-babel": "^0.0.6",
37
+ "@doracli/type": "^0.0.6",
38
38
  "@rspack/core": "^1.6.8",
39
39
  "@rspack/dev-server": "^1.1.4",
40
40
  "@rspack/plugin-html": "^0.5.8",
@@ -47,5 +47,5 @@
47
47
  "swc-loader": "^0.2.6",
48
48
  "webpack-bundle-analyzer": "^4.10.2"
49
49
  },
50
- "gitHead": "a978bb7e7b32c192b1eb527dae5f25bbe1a2af86"
50
+ "gitHead": "b387668fa2986c56f245bc53bcb7072fd53b62e1"
51
51
  }