@rspack/cli 0.0.0-20221025163913 → 0.0.0-20221025165902

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.
@@ -0,0 +1,2 @@
1
+ export declare function runCLI(argv: string[]): Promise<void>;
2
+ //# sourceMappingURL=bootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAEA,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,iBAG1C"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runCLI = void 0;
4
+ const rspack_cli_1 = require("./rspack-cli");
5
+ async function runCLI(argv) {
6
+ const cli = new rspack_cli_1.RspackCLI();
7
+ await cli.run(argv);
8
+ }
9
+ exports.runCLI = runCLI;
10
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAElC,KAAK,UAAU,MAAM,CAAC,IAAc;IAC1C,MAAM,GAAG,GAAG,IAAI,sBAAS,EAAE,CAAC;IAC5B,MAAM,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;AAHD,wBAGC"}
@@ -0,0 +1,6 @@
1
+ import type { RspackCLI } from "../rspack-cli";
2
+ import { RspackCommand } from "../types";
3
+ export declare class BuildCommand implements RspackCommand {
4
+ apply(cli: RspackCLI): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,qBAAa,YAAa,YAAW,aAAa;IAC3C,KAAK,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAgB1C"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BuildCommand = void 0;
7
+ const util_1 = __importDefault(require("util"));
8
+ const options_1 = require("../utils/options");
9
+ class BuildCommand {
10
+ async apply(cli) {
11
+ cli.program.command(["build [entry..]", "$0", "bundle", "b"], "run the rspack build", options_1.commonOptions, async (options) => {
12
+ console.time("build");
13
+ const compiler = await cli.createCompiler(options);
14
+ const stats = await util_1.default.promisify(compiler.build.bind(compiler))();
15
+ if (stats.errors.length > 0) {
16
+ throw new Error(stats.errors.map(x => x.message).join("\n"));
17
+ }
18
+ console.timeEnd("build");
19
+ });
20
+ }
21
+ }
22
+ exports.BuildCommand = BuildCommand;
23
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,8CAAiD;AACjD,MAAa,YAAY;IACxB,KAAK,CAAC,KAAK,CAAC,GAAc;QACzB,GAAG,CAAC,OAAO,CAAC,OAAO,CAClB,CAAC,iBAAiB,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,EACxC,sBAAsB,EACtB,uBAAa,EACb,KAAK,EAAC,OAAO,EAAC,EAAE;YACf,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACnD,MAAM,KAAK,GAAG,MAAM,cAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YACpE,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC5B,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;aAC7D;YACD,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC,CACD,CAAC;IACH,CAAC;CACD;AAjBD,oCAiBC"}
@@ -0,0 +1,6 @@
1
+ import type { RspackCLI } from "../rspack-cli";
2
+ import { RspackCommand } from "../types";
3
+ export declare class ServeCommand implements RspackCommand {
4
+ apply(cli: RspackCLI): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=serve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,qBAAa,YAAa,YAAW,aAAa;IAC3C,KAAK,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAa1C"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServeCommand = void 0;
4
+ const dev_server_1 = require("@rspack/dev-server");
5
+ const options_1 = require("../utils/options");
6
+ const core_1 = require("@rspack/core");
7
+ class ServeCommand {
8
+ async apply(cli) {
9
+ cli.program.command(["serve [entry..]", "server", "s"], "run the rspack dev server.", options_1.commonOptions, async (options) => {
10
+ const config = await cli.loadConfig(options);
11
+ const compiler = (0, core_1.createCompiler)(config);
12
+ const server = new dev_server_1.RspackDevServer(compiler);
13
+ await server.start();
14
+ });
15
+ }
16
+ }
17
+ exports.ServeCommand = ServeCommand;
18
+ //# sourceMappingURL=serve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":";;;AACA,mDAAqD;AAErD,8CAAiD;AACjD,uCAA8C;AAC9C,MAAa,YAAY;IACxB,KAAK,CAAC,KAAK,CAAC,GAAc;QACzB,GAAG,CAAC,OAAO,CAAC,OAAO,CAClB,CAAC,iBAAiB,EAAE,QAAQ,EAAE,GAAG,CAAC,EAClC,4BAA4B,EAC5B,uBAAa,EACb,KAAK,EAAC,OAAO,EAAC,EAAE;YACf,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAC7C,MAAM,QAAQ,GAAG,IAAA,qBAAc,EAAC,MAAM,CAAC,CAAC;YACxC,MAAM,MAAM,GAAG,IAAI,4BAAe,CAAC,QAAQ,CAAC,CAAC;YAC7C,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC,CACD,CAAC;IACH,CAAC;CACD;AAdD,oCAcC"}
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export { RspackCLI } from "./rspack-cli";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.RspackCLI = void 0;
18
+ __exportStar(require("./types"), exports);
19
+ var rspack_cli_1 = require("./rspack-cli");
20
+ Object.defineProperty(exports, "RspackCLI", { enumerable: true, get: function () { return rspack_cli_1.RspackCLI; } });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,0CAAwB;AACxB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA"}
@@ -0,0 +1,14 @@
1
+ import yargs from "yargs";
2
+ import { RspackCLIColors, RspackCLILogger, RspackCLIOptions } from "./types";
3
+ export declare class RspackCLI {
4
+ colors: RspackCLIColors;
5
+ program: yargs.Argv<{}>;
6
+ constructor();
7
+ createCompiler(options: RspackCLIOptions): Promise<import("@rspack/core/dist/compiler").Compiler>;
8
+ createColors(useColor?: boolean): RspackCLIColors;
9
+ getLogger(): RspackCLILogger;
10
+ run(argv: string[]): Promise<void>;
11
+ registerCommands(): Promise<void>;
12
+ loadConfig(options: RspackCLIOptions): Promise<any>;
13
+ }
14
+ //# sourceMappingURL=rspack-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rspack-cli.d.ts","sourceRoot":"","sources":["../src/rspack-cli.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAO7E,qBAAa,SAAS;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;;IAKlB,cAAc,CAAC,OAAO,EAAE,gBAAgB;IAK9C,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,eAAe;IAgBjD,SAAS,IAAI,eAAe;IAWtB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE;IAMlB,gBAAgB;IAMhB,UAAU,CAAC,OAAO,EAAE,gBAAgB;CAgC1C"}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RspackCLI = void 0;
7
+ const helpers_1 = require("yargs/helpers");
8
+ const yargs_1 = __importDefault(require("yargs"));
9
+ const util_1 = __importDefault(require("util"));
10
+ const path_1 = __importDefault(require("path"));
11
+ const fs_1 = __importDefault(require("fs"));
12
+ const build_1 = require("./commands/build");
13
+ const serve_1 = require("./commands/serve");
14
+ const core_1 = require("@rspack/core");
15
+ const defaultConfig = "rspack.config.js";
16
+ const defaultEntry = "src/index.js";
17
+ class RspackCLI {
18
+ constructor() {
19
+ this.colors = this.createColors();
20
+ this.program = (0, yargs_1.default)();
21
+ }
22
+ async createCompiler(options) {
23
+ let config = await this.loadConfig(options);
24
+ const compiler = (0, core_1.createCompiler)(config);
25
+ return compiler;
26
+ }
27
+ createColors(useColor) {
28
+ const { createColors, isColorSupported } = require("colorette");
29
+ let shouldUseColor;
30
+ if (useColor) {
31
+ shouldUseColor = useColor;
32
+ }
33
+ else {
34
+ shouldUseColor = isColorSupported;
35
+ }
36
+ return {
37
+ ...createColors({ useColor: shouldUseColor }),
38
+ isColorSupported: shouldUseColor
39
+ };
40
+ }
41
+ getLogger() {
42
+ return {
43
+ error: val => console.error(`[rspack-cli] ${this.colors.red(util_1.default.format(val))}`),
44
+ warn: val => console.warn(`[rspack-cli] ${this.colors.yellow(val)}`),
45
+ info: val => console.info(`[rspack-cli] ${this.colors.cyan(val)}`),
46
+ success: val => console.log(`[rspack-cli] ${this.colors.green(val)}`),
47
+ log: val => console.log(`[rspack-cli] ${val}`),
48
+ raw: val => console.log(val)
49
+ };
50
+ }
51
+ async run(argv) {
52
+ this.program.usage("[options]");
53
+ this.program.scriptName("rspack");
54
+ this.registerCommands();
55
+ await this.program.parseAsync((0, helpers_1.hideBin)(argv));
56
+ }
57
+ async registerCommands() {
58
+ const builtinCommands = [new build_1.BuildCommand(), new serve_1.ServeCommand()];
59
+ for (const command of builtinCommands) {
60
+ command.apply(this);
61
+ }
62
+ }
63
+ async loadConfig(options) {
64
+ let loadedConfig;
65
+ // if we pass config paras
66
+ if (options.config) {
67
+ const resolvedConfigPath = path_1.default.resolve(process.cwd(), options.config);
68
+ if (!fs_1.default.existsSync(resolvedConfigPath)) {
69
+ throw new Error(`config file "${resolvedConfigPath}" not exists`);
70
+ }
71
+ loadedConfig = require(resolvedConfigPath);
72
+ }
73
+ else {
74
+ let defaultConfigPath = path_1.default.resolve(process.cwd(), defaultConfig);
75
+ if (fs_1.default.existsSync(defaultConfigPath)) {
76
+ loadedConfig = require(defaultConfigPath);
77
+ }
78
+ else {
79
+ let entry = {};
80
+ if (options.entry) {
81
+ console.log("entry:", options.entry);
82
+ entry = {
83
+ main: options.entry.map(x => path_1.default.resolve(process.cwd(), x))[0] // Fix me when entry supports array
84
+ };
85
+ }
86
+ else {
87
+ entry = {
88
+ main: path_1.default.resolve(process.cwd(), defaultEntry)
89
+ };
90
+ }
91
+ loadedConfig = {
92
+ entry
93
+ };
94
+ }
95
+ }
96
+ return loadedConfig;
97
+ }
98
+ }
99
+ exports.RspackCLI = RspackCLI;
100
+ //# sourceMappingURL=rspack-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rspack-cli.js","sourceRoot":"","sources":["../src/rspack-cli.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAwC;AACxC,kDAA0B;AAC1B,gDAAwB;AACxB,gDAAwB;AACxB,4CAAoB;AAEpB,4CAAgD;AAChD,4CAAgD;A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;aAClE;YACD,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;SAC3C;aAAM;YACN,IAAI,iBAAiB,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC;YACnE,IAAI,YAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;gBACrC,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;aAC1C;iBAAM;gBACN,IAAI,KAAK,GAA2B,EAAE,CAAC;gBACvC,IAAI,OAAO,CAAC,KAAK,EAAE;oBAClB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;oBACrC,KAAK,GAAG;wBACP,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAmC;qBACnG,CAAC;iBACF;qBAAM;oBACN,KAAK,GAAG;wBACP,IAAI,EAAE,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC;qBAC/C,CAAC;iBACF;gBACD,YAAY,GAAG;oBACd,KAAK;iBACL,CAAC;aACF;SACD;QACD,OAAO,YAAY,CAAC;IACrB,CAAC;CACD;AAnFD,8BAmFC"}
@@ -0,0 +1,31 @@
1
+ import { Colorette } from "colorette";
2
+ import { RspackCLI } from "./rspack-cli";
3
+ import { WebpackOptionsNormalized } from "webpack";
4
+ import { Configuration as DevServerConfig } from "webpack-dev-server";
5
+ export interface IRspackCLI {
6
+ runRspack(): Promise<void>;
7
+ }
8
+ export declare type LogHandler = (value: any) => void;
9
+ export interface RspackCLIColors extends Colorette {
10
+ isColorSupported: boolean;
11
+ }
12
+ export interface RspackCLILogger {
13
+ error: LogHandler;
14
+ warn: LogHandler;
15
+ info: LogHandler;
16
+ success: LogHandler;
17
+ log: LogHandler;
18
+ raw: LogHandler;
19
+ }
20
+ export interface RspackCLIOptions {
21
+ entry?: string[];
22
+ config?: string;
23
+ devtool?: boolean;
24
+ mode?: string;
25
+ watch?: boolean;
26
+ }
27
+ export interface RspackCommand {
28
+ apply(cli: RspackCLI): Promise<void>;
29
+ }
30
+ export declare type RspackDevServerOptions = DevServerConfig & WebpackOptionsNormalized;
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,MAAM,WAAW,UAAU;IAC1B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AACD,oBAAY,UAAU,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;AAC9C,MAAM,WAAW,eAAgB,SAAQ,SAAS;IACjD,gBAAgB,EAAE,OAAO,CAAC;CAC1B;AACD,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,UAAU,CAAC;IACpB,GAAG,EAAE,UAAU,CAAC;IAChB,GAAG,EAAE,UAAU,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAChC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC7B,KAAK,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AACD,oBAAY,sBAAsB,GAAG,eAAe,GAAG,wBAAwB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ import yargs from "yargs";
2
+ export declare const commonOptions: (yargs: yargs.Argv<{}>) => yargs.Argv<yargs.Omit<{
3
+ entry: string[];
4
+ }, "config" | "watch" | "mode" | "devtool"> & yargs.InferredOptionTypes<{
5
+ config: {
6
+ g: boolean;
7
+ type: "string";
8
+ describe: string;
9
+ alias: string;
10
+ };
11
+ mode: {
12
+ type: "string";
13
+ default: string;
14
+ describe: string;
15
+ };
16
+ watch: {
17
+ type: "boolean";
18
+ default: boolean;
19
+ describe: string;
20
+ };
21
+ devtool: {
22
+ type: "boolean";
23
+ default: boolean;
24
+ describe: string;
25
+ };
26
+ }>>;
27
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/utils/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;GA0BzB,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.commonOptions = void 0;
4
+ const commonOptions = (yargs) => {
5
+ return yargs
6
+ .positional("entry", {
7
+ type: "string",
8
+ array: true,
9
+ describe: "entry"
10
+ })
11
+ .options({
12
+ config: {
13
+ g: true,
14
+ type: "string",
15
+ describe: "config file",
16
+ alias: "c"
17
+ },
18
+ mode: { type: "string", default: "none", describe: "mode" },
19
+ watch: {
20
+ type: "boolean",
21
+ default: false,
22
+ describe: "watch"
23
+ },
24
+ devtool: {
25
+ type: "boolean",
26
+ default: false,
27
+ describe: "devtool"
28
+ }
29
+ });
30
+ };
31
+ exports.commonOptions = commonOptions;
32
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/utils/options.ts"],"names":[],"mappings":";;;AACO,MAAM,aAAa,GAAG,CAAC,KAAqB,EAAE,EAAE;IACtD,OAAO,KAAK;SACV,UAAU,CAAC,OAAO,EAAE;QACpB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,OAAO;KACjB,CAAC;SACD,OAAO,CAAC;QACR,MAAM,EAAE;YACP,CAAC,EAAE,IAAI;YACP,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,aAAa;YACvB,KAAK,EAAE,GAAG;SACV;QACD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE;QAC3D,KAAK,EAAE;YACN,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,OAAO;SACjB;QACD,OAAO,EAAE;YACR,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,SAAS;SACnB;KACD,CAAC,CAAC;AACL,CAAC,CAAC;AA1BW,QAAA,aAAa,iBA0BxB"}
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@rspack/cli",
3
- "version": "0.0.0-20221025163913",
3
+ "version": "0.0.0-20221025165902",
4
4
  "bin": {
5
5
  "rspack": "./bin/rspack"
6
6
  },
7
7
  "main": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "files": [
10
- "lib"
10
+ "bin",
11
+ "dist"
11
12
  ],
12
13
  "devDependencies": {
13
14
  "internal-ip": "6.2.0",
@@ -16,16 +17,16 @@
16
17
  "source-map-support": "^0.5.19"
17
18
  },
18
19
  "dependencies": {
19
- "@rspack/core": "0.0.0-20221025163913",
20
- "@rspack/dev-server": "0.0.0-20221025163913",
20
+ "@rspack/core": "0.0.0-20221025165902",
21
+ "@rspack/dev-server": "0.0.0-20221025165902",
21
22
  "colorette": "2.0.19",
22
23
  "yargs": "17.5.1",
23
24
  "webpack-dev-server": "4.11.1",
24
25
  "webpack": "5.74.0"
25
26
  },
26
27
  "scripts": {
27
- "build": "rm -rf lib/ && tsc",
28
- "dev": "tsc -w",
28
+ "build": "rm -rf dist/ && tsc -b --force",
29
+ "dev": "tsc -w -b",
29
30
  "test": "jest --verbose"
30
31
  }
31
32
  }