@rspack/cli 1.2.6 → 1.2.7

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,6 +1,6 @@
1
1
  "use strict";
2
2
  exports.ids = [
3
- '618'
3
+ '197'
4
4
  ];
5
5
  exports.modules = {
6
6
  "./src/utils/profile.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
@@ -1,5 +1,5 @@
1
1
  export const ids = [
2
- '618'
2
+ '197'
3
3
  ];
4
4
  export const modules = {
5
5
  "./src/utils/profile.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
package/dist/index.js CHANGED
@@ -135,6 +135,18 @@ var __webpack_exports__ = {};
135
135
  describe: "config file",
136
136
  alias: "c"
137
137
  },
138
+ configName: {
139
+ type: "array",
140
+ string: true,
141
+ describe: "Name of the configuration to use."
142
+ },
143
+ configLoader: {
144
+ type: "string",
145
+ default: "register",
146
+ describe: "Specify the loader to load the config file, can be `native` or `register`."
147
+ }
148
+ });
149
+ const commonOptionsForBuildAndServe = (yargs)=>yargs.options({
138
150
  entry: {
139
151
  type: "array",
140
152
  string: true,
@@ -170,57 +182,11 @@ var __webpack_exports__ = {};
170
182
  default: false,
171
183
  describe: "devtool",
172
184
  alias: "d"
173
- },
174
- configName: {
175
- type: "array",
176
- string: true,
177
- describe: "Name of the configuration to use."
178
- },
179
- configLoader: {
180
- type: "string",
181
- default: "register",
182
- describe: "Specify the loader to load the config file, can be `native` or `register`."
183
185
  }
184
186
  }).alias({
185
187
  v: "version",
186
188
  h: "help"
187
189
  });
188
- const previewOptions = (yargs)=>yargs.positional("dir", {
189
- type: "string",
190
- describe: "directory want to preview"
191
- }).options({
192
- publicPath: {
193
- type: "string",
194
- describe: "static resource server path"
195
- },
196
- config: {
197
- g: true,
198
- type: "string",
199
- describe: "config file",
200
- alias: "c"
201
- },
202
- port: {
203
- type: "number",
204
- describe: "preview server port"
205
- },
206
- host: {
207
- type: "string",
208
- describe: "preview server host"
209
- },
210
- open: {
211
- type: "boolean",
212
- describe: "open browser"
213
- },
214
- server: {
215
- type: "string",
216
- describe: "Configuration items for the server."
217
- },
218
- configName: {
219
- type: "array",
220
- string: true,
221
- describe: "Name of the configuration to use."
222
- }
223
- });
224
190
  function normalizeEnv(argv) {
225
191
  function parseValue(previous, value) {
226
192
  const [allKeys, val] = value.split(/=(.+)/, 2);
@@ -263,7 +229,8 @@ var __webpack_exports__ = {};
263
229
  "$0",
264
230
  "bundle",
265
231
  "b"
266
- ], "run the rspack build", (yargs)=>commonOptions(yargs).options({
232
+ ], "run the rspack build", (yargs)=>{
233
+ commonOptionsForBuildAndServe(commonOptions(yargs)).options({
267
234
  analyze: {
268
235
  type: "boolean",
269
236
  default: false,
@@ -277,7 +244,8 @@ var __webpack_exports__ = {};
277
244
  default: false,
278
245
  describe: "capture timing information for each module"
279
246
  }
280
- }), async (options)=>{
247
+ });
248
+ }, async (options)=>{
281
249
  const env = ensureEnvObject(options);
282
250
  if (options.watch) setBuiltinEnvArg(env, "WATCH", true);
283
251
  else {
@@ -332,6 +300,34 @@ var __webpack_exports__ = {};
332
300
  });
333
301
  }
334
302
  }
303
+ const previewOptions = (yargs)=>{
304
+ yargs.positional("dir", {
305
+ type: "string",
306
+ describe: "directory want to preview"
307
+ });
308
+ return commonOptions(yargs).options({
309
+ publicPath: {
310
+ type: "string",
311
+ describe: "static resource server path"
312
+ },
313
+ port: {
314
+ type: "number",
315
+ describe: "preview server port"
316
+ },
317
+ host: {
318
+ type: "string",
319
+ describe: "preview server host"
320
+ },
321
+ open: {
322
+ type: "boolean",
323
+ describe: "open browser"
324
+ },
325
+ server: {
326
+ type: "string",
327
+ describe: "Configuration items for the server."
328
+ }
329
+ });
330
+ };
335
331
  const defaultRoot = "dist";
336
332
  class PreviewCommand {
337
333
  async apply(cli) {
@@ -341,8 +337,7 @@ var __webpack_exports__ = {};
341
337
  "p"
342
338
  ], "run the rspack server for build output", previewOptions, async (options)=>{
343
339
  const rspackOptions = {
344
- config: options.config,
345
- configName: options.configName,
340
+ ...options,
346
341
  argv: {
347
342
  ...options
348
343
  }
@@ -397,7 +392,7 @@ var __webpack_exports__ = {};
397
392
  "server",
398
393
  "s",
399
394
  "dev"
400
- ], "run the rspack dev server.", (yargs)=>commonOptions(yargs).options({
395
+ ], "run the rspack dev server.", (yargs)=>commonOptionsForBuildAndServe(commonOptions(yargs)).options({
401
396
  hot: {
402
397
  coerce: (arg)=>{
403
398
  if ("boolean" == typeof arg || "only" === arg) return arg;
@@ -661,7 +656,7 @@ var __webpack_exports__ = {};
661
656
  }
662
657
  if (options.profile) item.profile = true;
663
658
  if (process.env.RSPACK_PROFILE) {
664
- const { applyProfile } = await __webpack_require__.e("618").then(__webpack_require__.bind(__webpack_require__, "./src/utils/profile.ts"));
659
+ const { applyProfile } = await __webpack_require__.e("197").then(__webpack_require__.bind(__webpack_require__, "./src/utils/profile.ts"));
665
660
  await applyProfile(process.env.RSPACK_PROFILE, item);
666
661
  }
667
662
  if (options.watch) item.watch = options.watch;
package/dist/index.mjs CHANGED
@@ -111,6 +111,18 @@ const commonOptions = (yargs)=>yargs.options({
111
111
  describe: "config file",
112
112
  alias: "c"
113
113
  },
114
+ configName: {
115
+ type: "array",
116
+ string: true,
117
+ describe: "Name of the configuration to use."
118
+ },
119
+ configLoader: {
120
+ type: "string",
121
+ default: "register",
122
+ describe: "Specify the loader to load the config file, can be `native` or `register`."
123
+ }
124
+ });
125
+ const commonOptionsForBuildAndServe = (yargs)=>yargs.options({
114
126
  entry: {
115
127
  type: "array",
116
128
  string: true,
@@ -146,57 +158,11 @@ const commonOptions = (yargs)=>yargs.options({
146
158
  default: false,
147
159
  describe: "devtool",
148
160
  alias: "d"
149
- },
150
- configName: {
151
- type: "array",
152
- string: true,
153
- describe: "Name of the configuration to use."
154
- },
155
- configLoader: {
156
- type: "string",
157
- default: "register",
158
- describe: "Specify the loader to load the config file, can be `native` or `register`."
159
161
  }
160
162
  }).alias({
161
163
  v: "version",
162
164
  h: "help"
163
165
  });
164
- const previewOptions = (yargs)=>yargs.positional("dir", {
165
- type: "string",
166
- describe: "directory want to preview"
167
- }).options({
168
- publicPath: {
169
- type: "string",
170
- describe: "static resource server path"
171
- },
172
- config: {
173
- g: true,
174
- type: "string",
175
- describe: "config file",
176
- alias: "c"
177
- },
178
- port: {
179
- type: "number",
180
- describe: "preview server port"
181
- },
182
- host: {
183
- type: "string",
184
- describe: "preview server host"
185
- },
186
- open: {
187
- type: "boolean",
188
- describe: "open browser"
189
- },
190
- server: {
191
- type: "string",
192
- describe: "Configuration items for the server."
193
- },
194
- configName: {
195
- type: "array",
196
- string: true,
197
- describe: "Name of the configuration to use."
198
- }
199
- });
200
166
  function normalizeEnv(argv) {
201
167
  function parseValue(previous, value) {
202
168
  const [allKeys, val] = value.split(/=(.+)/, 2);
@@ -239,7 +205,8 @@ class BuildCommand {
239
205
  "$0",
240
206
  "bundle",
241
207
  "b"
242
- ], "run the rspack build", (yargs)=>commonOptions(yargs).options({
208
+ ], "run the rspack build", (yargs)=>{
209
+ commonOptionsForBuildAndServe(commonOptions(yargs)).options({
243
210
  analyze: {
244
211
  type: "boolean",
245
212
  default: false,
@@ -253,7 +220,8 @@ class BuildCommand {
253
220
  default: false,
254
221
  describe: "capture timing information for each module"
255
222
  }
256
- }), async (options)=>{
223
+ });
224
+ }, async (options)=>{
257
225
  const env = ensureEnvObject(options);
258
226
  if (options.watch) setBuiltinEnvArg(env, "WATCH", true);
259
227
  else {
@@ -308,6 +276,34 @@ class BuildCommand {
308
276
  });
309
277
  }
310
278
  }
279
+ const previewOptions = (yargs)=>{
280
+ yargs.positional("dir", {
281
+ type: "string",
282
+ describe: "directory want to preview"
283
+ });
284
+ return commonOptions(yargs).options({
285
+ publicPath: {
286
+ type: "string",
287
+ describe: "static resource server path"
288
+ },
289
+ port: {
290
+ type: "number",
291
+ describe: "preview server port"
292
+ },
293
+ host: {
294
+ type: "string",
295
+ describe: "preview server host"
296
+ },
297
+ open: {
298
+ type: "boolean",
299
+ describe: "open browser"
300
+ },
301
+ server: {
302
+ type: "string",
303
+ describe: "Configuration items for the server."
304
+ }
305
+ });
306
+ };
311
307
  const defaultRoot = "dist";
312
308
  class PreviewCommand {
313
309
  async apply(cli) {
@@ -317,8 +313,7 @@ class PreviewCommand {
317
313
  "p"
318
314
  ], "run the rspack server for build output", previewOptions, async (options)=>{
319
315
  const rspackOptions = {
320
- config: options.config,
321
- configName: options.configName,
316
+ ...options,
322
317
  argv: {
323
318
  ...options
324
319
  }
@@ -373,7 +368,7 @@ class ServeCommand {
373
368
  "server",
374
369
  "s",
375
370
  "dev"
376
- ], "run the rspack dev server.", (yargs)=>commonOptions(yargs).options({
371
+ ], "run the rspack dev server.", (yargs)=>commonOptionsForBuildAndServe(commonOptions(yargs)).options({
377
372
  hot: {
378
373
  coerce: (arg)=>{
379
374
  if ("boolean" == typeof arg || "only" === arg) return arg;
@@ -637,7 +632,7 @@ class RspackCLI {
637
632
  }
638
633
  if (options.profile) item.profile = true;
639
634
  if (process.env.RSPACK_PROFILE) {
640
- const { applyProfile } = await __webpack_require__.e("618").then(__webpack_require__.bind(__webpack_require__, "./src/utils/profile.ts"));
635
+ const { applyProfile } = await __webpack_require__.e("197").then(__webpack_require__.bind(__webpack_require__, "./src/utils/profile.ts"));
641
636
  await applyProfile(process.env.RSPACK_PROFILE, item);
642
637
  }
643
638
  if (options.watch) item.watch = options.watch;
@@ -1,11 +1,29 @@
1
1
  import type yargs from "yargs";
2
- export declare const commonOptions: (yargs: yargs.Argv) => yargs.Argv<yargs.Omit<{}, "entry" | "devtool" | "mode" | "watch" | "env" | "nodeEnv" | "outputPath" | "config" | "configName" | "configLoader"> & yargs.InferredOptionTypes<{
2
+ /**
3
+ * Apply common options for all commands
4
+ */
5
+ export declare const commonOptions: (yargs: yargs.Argv) => yargs.Argv<yargs.Omit<{}, "config" | "configName" | "configLoader"> & yargs.InferredOptionTypes<{
3
6
  config: {
4
7
  g: boolean;
5
8
  type: "string";
6
9
  describe: string;
7
10
  alias: string;
8
11
  };
12
+ configName: {
13
+ type: "array";
14
+ string: true;
15
+ describe: string;
16
+ };
17
+ configLoader: {
18
+ type: "string";
19
+ default: string;
20
+ describe: string;
21
+ };
22
+ }>>;
23
+ /**
24
+ * Apply common options for `build` and `serve` commands
25
+ */
26
+ export declare const commonOptionsForBuildAndServe: (yargs: yargs.Argv) => yargs.Argv<yargs.Omit<{}, "entry" | "devtool" | "mode" | "watch" | "env" | "nodeEnv" | "outputPath"> & yargs.InferredOptionTypes<{
9
27
  entry: {
10
28
  type: "array";
11
29
  string: true;
@@ -42,51 +60,6 @@ export declare const commonOptions: (yargs: yargs.Argv) => yargs.Argv<yargs.Omit
42
60
  describe: string;
43
61
  alias: string;
44
62
  };
45
- configName: {
46
- type: "array";
47
- string: true;
48
- describe: string;
49
- };
50
- configLoader: {
51
- type: "string";
52
- default: string;
53
- describe: string;
54
- };
55
- }>>;
56
- export declare const previewOptions: (yargs: yargs.Argv) => yargs.Argv<yargs.Omit<{
57
- dir: string | undefined;
58
- }, "port" | "host" | "open" | "server" | "publicPath" | "config" | "configName"> & yargs.InferredOptionTypes<{
59
- publicPath: {
60
- type: "string";
61
- describe: string;
62
- };
63
- config: {
64
- g: boolean;
65
- type: "string";
66
- describe: string;
67
- alias: string;
68
- };
69
- port: {
70
- type: "number";
71
- describe: string;
72
- };
73
- host: {
74
- type: "string";
75
- describe: string;
76
- };
77
- open: {
78
- type: "boolean";
79
- describe: string;
80
- };
81
- server: {
82
- type: "string";
83
- describe: string;
84
- };
85
- configName: {
86
- type: "array";
87
- string: true;
88
- describe: string;
89
- };
90
63
  }>>;
91
64
  export declare function normalizeEnv(argv: yargs.Arguments): void;
92
65
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/cli",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "CLI for rspack",
5
5
  "homepage": "https://rspack.dev",
6
6
  "bugs": "https://github.com/web-infra-dev/rspack/issues",
@@ -38,7 +38,7 @@
38
38
  "yargs": "17.7.2"
39
39
  },
40
40
  "devDependencies": {
41
- "@rslib/core": "0.5.1",
41
+ "@rslib/core": "0.5.2",
42
42
  "@types/interpret": "^1.1.3",
43
43
  "@types/rechoir": "^0.6.4",
44
44
  "@types/webpack-bundle-analyzer": "^4.7.0",
@@ -48,8 +48,8 @@
48
48
  "execa": "^5.1.1",
49
49
  "ts-node": "^10.9.2",
50
50
  "typescript": "^5.7.3",
51
- "@rspack/tracing": "1.2.6",
52
- "@rspack/core": "1.2.6"
51
+ "@rspack/tracing": "1.2.7",
52
+ "@rspack/core": "1.2.7"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@rspack/core": "^1.0.0-alpha || ^1.x",