@gravity-ui/app-builder 0.14.2-beta.0 → 0.15.1-beta.1
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.
- package/dist/commands/build/build-service/client.js +1 -4
- package/dist/commands/dev/client.js +24 -8
- package/dist/common/config.js +8 -7
- package/dist/common/logger/colors.d.ts +1 -1
- package/dist/common/logger/index.d.ts +1 -1
- package/dist/common/models/index.d.ts +1 -0
- package/dist/common/s3-upload/webpack-plugin.d.ts +2 -2
- package/dist/common/s3-upload/webpack-plugin.js +2 -3
- package/dist/common/typescript/compile.js +7 -7
- package/dist/common/typescript/watch.js +6 -6
- package/dist/common/webpack/compile.d.ts +1 -1
- package/dist/common/webpack/compile.js +34 -10
- package/dist/common/webpack/config.d.ts +8 -3
- package/dist/common/webpack/config.js +373 -117
- package/dist/common/webpack/node-externals.d.ts +4 -2
- package/dist/common/webpack/node-externals.js +5 -5
- package/dist/common/webpack/progress-plugin.d.ts +4 -5
- package/dist/common/webpack/progress-plugin.js +11 -33
- package/dist/common/webpack/rspack.d.ts +7 -0
- package/dist/common/{rspack/utils.js → webpack/rspack.js} +57 -27
- package/dist/common/webpack/storybook.d.ts +1 -1
- package/dist/common/webpack/utils.d.ts +2 -2
- package/dist/common/webpack/utils.js +4 -2
- package/dist/common/webpack/worker/worker-loader.d.ts +2 -2
- package/dist/common/webpack/worker/worker-loader.js +17 -17
- package/dist/create-cli.d.ts +2 -2
- package/package.json +1 -3
- package/dist/common/rspack/compile.d.ts +0 -2
- package/dist/common/rspack/compile.js +0 -27
- package/dist/common/rspack/config.d.ts +0 -24
- package/dist/common/rspack/config.js +0 -772
- package/dist/common/rspack/lazy-client.d.ts +0 -1
- package/dist/common/rspack/lazy-client.js +0 -63
- package/dist/common/rspack/progress-plugin.d.ts +0 -11
- package/dist/common/rspack/progress-plugin.js +0 -43
- package/dist/common/rspack/public-path.d.ts +0 -1
- package/dist/common/rspack/public-path.js +0 -4
- package/dist/common/rspack/utils.d.ts +0 -4
- package/dist/common/rspack/worker/public-path.worker.d.ts +0 -1
- package/dist/common/rspack/worker/public-path.worker.js +0 -3
- package/dist/common/rspack/worker/web-worker.d.mts +0 -8
- package/dist/common/rspack/worker/web-worker.mjs +0 -32
- package/dist/common/rspack/worker/worker-loader.d.ts +0 -4
- package/dist/common/rspack/worker/worker-loader.js +0 -177
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildClient = buildClient;
|
|
4
4
|
const compile_1 = require("../../../common/webpack/compile");
|
|
5
|
-
const compile_2 = require("../../../common/rspack/compile");
|
|
6
5
|
function buildClient(config) {
|
|
7
|
-
return config.client
|
|
8
|
-
? (0, compile_1.webpackCompile)(config.client)
|
|
9
|
-
: (0, compile_2.rspackCompile)(config.client);
|
|
6
|
+
return (0, compile_1.clientCompile)(config.client);
|
|
10
7
|
}
|
|
@@ -40,8 +40,7 @@ const dev_server_1 = require("@rspack/dev-server");
|
|
|
40
40
|
const paths_1 = __importDefault(require("../../common/paths"));
|
|
41
41
|
const logger_1 = require("../../common/logger");
|
|
42
42
|
const config_1 = require("../../common/webpack/config");
|
|
43
|
-
const
|
|
44
|
-
const utils_2 = require("../../common/rspack/utils");
|
|
43
|
+
const rspack_1 = require("../../common/webpack/rspack");
|
|
45
44
|
async function watchClientCompilation(config, onManifestReady) {
|
|
46
45
|
const clientCompilation = await buildDevServer(config);
|
|
47
46
|
const compiler = clientCompilation.compiler;
|
|
@@ -50,24 +49,41 @@ async function watchClientCompilation(config, onManifestReady) {
|
|
|
50
49
|
}
|
|
51
50
|
async function buildDevServer(config) {
|
|
52
51
|
const bundler = config.client.bundler;
|
|
53
|
-
const logger = new logger_1.Logger(
|
|
52
|
+
const logger = new logger_1.Logger('client', config.verbose);
|
|
54
53
|
const { webSocketPath = path.normalize(`/${config.client.publicPathPrefix}/build/sockjs-node`), writeToDisk, ...devServer } = config.client.devServer || {};
|
|
55
54
|
const normalizedConfig = { ...config.client, devServer: { ...devServer, webSocketPath } };
|
|
56
55
|
const isSsr = Boolean(normalizedConfig.ssr);
|
|
57
56
|
let webpackConfigs = [];
|
|
58
57
|
let rspackConfigs = [];
|
|
59
58
|
if (bundler === 'webpack') {
|
|
60
|
-
webpackConfigs = [
|
|
59
|
+
webpackConfigs = [
|
|
60
|
+
await (0, config_1.webpackConfigFactory)({
|
|
61
|
+
webpackMode: "development" /* WebpackMode.Dev */,
|
|
62
|
+
config: normalizedConfig,
|
|
63
|
+
logger,
|
|
64
|
+
}),
|
|
65
|
+
];
|
|
61
66
|
if (isSsr) {
|
|
62
|
-
const
|
|
63
|
-
webpackConfigs.push(await (0, config_1.webpackConfigFactory)(
|
|
67
|
+
const ssrLogger = new logger_1.Logger('webpack(SSR)', config.verbose);
|
|
68
|
+
webpackConfigs.push(await (0, config_1.webpackConfigFactory)({
|
|
69
|
+
webpackMode: "development" /* WebpackMode.Dev */,
|
|
70
|
+
config: normalizedConfig,
|
|
71
|
+
logger: ssrLogger,
|
|
72
|
+
isSsr,
|
|
73
|
+
}));
|
|
64
74
|
}
|
|
65
75
|
}
|
|
66
76
|
else {
|
|
67
77
|
if (isSsr) {
|
|
68
78
|
throw new Error(`SSR is not supported in ${bundler}`);
|
|
69
79
|
}
|
|
70
|
-
rspackConfigs = [
|
|
80
|
+
rspackConfigs = [
|
|
81
|
+
await (0, config_1.rspackConfigFactory)({
|
|
82
|
+
webpackMode: "development" /* WebpackMode.Dev */,
|
|
83
|
+
config: normalizedConfig,
|
|
84
|
+
logger,
|
|
85
|
+
}),
|
|
86
|
+
];
|
|
71
87
|
}
|
|
72
88
|
const publicPath = path.normalize(config.client.publicPathPrefix + '/build/');
|
|
73
89
|
const staticFolder = path.resolve(paths_1.default.appDist, 'public');
|
|
@@ -151,7 +167,7 @@ async function buildDevServer(config) {
|
|
|
151
167
|
const compiler = (0, core_1.rspack)(rspackConfigs[0]);
|
|
152
168
|
server = new dev_server_1.RspackDevServer(options, compiler);
|
|
153
169
|
// Need to clean cache before start. https://github.com/web-infra-dev/rspack/issues/9025
|
|
154
|
-
(0,
|
|
170
|
+
(0, rspack_1.clearCacheDirectory)(rspackConfigs[0], logger);
|
|
155
171
|
}
|
|
156
172
|
else {
|
|
157
173
|
const compiler = (0, webpack_1.default)(webpackConfigs);
|
package/dist/common/config.js
CHANGED
|
@@ -22,15 +22,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
26
|
exports.getProjectConfig = getProjectConfig;
|
|
30
27
|
exports.normalizeConfig = normalizeConfig;
|
|
31
|
-
/* eslint-disable complexity */
|
|
32
28
|
const path = __importStar(require("node:path"));
|
|
33
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
34
29
|
const cosmiconfig_1 = require("cosmiconfig");
|
|
35
30
|
const cosmiconfig_typescript_loader_1 = require("cosmiconfig-typescript-loader");
|
|
36
31
|
const models_1 = require("./models");
|
|
@@ -42,7 +37,13 @@ function remapPaths(paths) {
|
|
|
42
37
|
return splitPaths(paths).map((p) => path.resolve(process.cwd(), p));
|
|
43
38
|
}
|
|
44
39
|
function omitUndefined(obj) {
|
|
45
|
-
|
|
40
|
+
const newObj = {};
|
|
41
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
42
|
+
if (value !== undefined) {
|
|
43
|
+
newObj[key] = value;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return newObj;
|
|
46
47
|
}
|
|
47
48
|
function getModuleLoader({ storybook } = {}) {
|
|
48
49
|
if (!storybook) {
|
|
@@ -176,7 +177,7 @@ async function normalizeConfig(userConfig, mode) {
|
|
|
176
177
|
};
|
|
177
178
|
return config;
|
|
178
179
|
}
|
|
179
|
-
const config =
|
|
180
|
+
const config = structuredClone(userConfig);
|
|
180
181
|
config.lib.newJsxTransform = config.lib.newJsxTransform ?? true;
|
|
181
182
|
return config;
|
|
182
183
|
}
|
|
@@ -5,7 +5,7 @@ export declare const colors: chalk.Chalk & chalk.ChalkFunction & {
|
|
|
5
5
|
Color: ("black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright") | ("bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright");
|
|
6
6
|
ForegroundColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
|
|
7
7
|
BackgroundColor: "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright";
|
|
8
|
-
Modifiers: "bold" | "
|
|
8
|
+
Modifiers: "bold" | "reset" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "visible";
|
|
9
9
|
stderr: chalk.Chalk & {
|
|
10
10
|
supportsColor: chalk.ColorSupport | false;
|
|
11
11
|
};
|
|
@@ -12,7 +12,7 @@ export declare class Logger implements BaseLogger {
|
|
|
12
12
|
Color: ("black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright") | ("bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright");
|
|
13
13
|
ForegroundColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
|
|
14
14
|
BackgroundColor: "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright";
|
|
15
|
-
Modifiers: "bold" | "
|
|
15
|
+
Modifiers: "bold" | "reset" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "visible";
|
|
16
16
|
stderr: import("chalk").Chalk & {
|
|
17
17
|
supportsColor: import("chalk").ColorSupport | false;
|
|
18
18
|
};
|
|
@@ -189,6 +189,7 @@ export interface ClientConfig {
|
|
|
189
189
|
*/
|
|
190
190
|
rspack?: (config: RspackConfiguration, options: {
|
|
191
191
|
configType: `${WebpackMode}`;
|
|
192
|
+
isSsr?: boolean;
|
|
192
193
|
}) => RspackConfiguration | Promise<RspackConfiguration>;
|
|
193
194
|
/**
|
|
194
195
|
* Modify or return a custom Babel config.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as Webpack from 'webpack';
|
|
2
2
|
import type { Logger } from '../logger/index.js';
|
|
3
3
|
import type { UploadOptions } from './upload.js';
|
|
4
4
|
import type { S3ClientOptions } from './s3-client.js';
|
|
@@ -14,7 +14,7 @@ interface S3UploadPluginOptions {
|
|
|
14
14
|
export declare class S3UploadPlugin {
|
|
15
15
|
private options;
|
|
16
16
|
constructor(options: S3UploadPluginOptions);
|
|
17
|
-
apply(compiler: Compiler): void;
|
|
17
|
+
apply(compiler: Webpack.Compiler): void;
|
|
18
18
|
private isIncludeAndNotExclude;
|
|
19
19
|
}
|
|
20
20
|
type Rule = RegExp | string | ((s: string) => boolean);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.S3UploadPlugin = void 0;
|
|
4
|
-
const webpack_1 = require("webpack");
|
|
5
4
|
const fast_glob_1 = require("fast-glob");
|
|
6
5
|
const upload_js_1 = require("./upload.js");
|
|
7
6
|
class S3UploadPlugin {
|
|
@@ -12,7 +11,7 @@ class S3UploadPlugin {
|
|
|
12
11
|
apply(compiler) {
|
|
13
12
|
compiler.hooks.done.tapPromise('s3-upload-plugin', async (stats) => {
|
|
14
13
|
if (stats.hasErrors()) {
|
|
15
|
-
stats.compilation.warnings.push(new
|
|
14
|
+
stats.compilation.warnings.push(new compiler.webpack.WebpackError('s3-upload-plugin: skipped upload to s3 due to compilation errors'));
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
18
17
|
let fileNames = Object.keys(stats.compilation.assets);
|
|
@@ -39,7 +38,7 @@ class S3UploadPlugin {
|
|
|
39
38
|
this.options.logger?.success(`Files successfully uploaded to bucket ${this.options.s3UploadOptions.bucket}`);
|
|
40
39
|
}
|
|
41
40
|
catch (e) {
|
|
42
|
-
const error = new
|
|
41
|
+
const error = new compiler.webpack.WebpackError(`s3-upload-plugin: ${e instanceof Error ? e.message : e}`);
|
|
43
42
|
stats.compilation.errors.push(error);
|
|
44
43
|
}
|
|
45
44
|
});
|
|
@@ -24,7 +24,7 @@ function compile(ts, { projectPath, configFileName = 'tsconfig.json', optionsToE
|
|
|
24
24
|
const program = ts.createProgram(parsedConfig.fileNames, parsedConfig.options, compilerHost);
|
|
25
25
|
// @ts-expect-error
|
|
26
26
|
const filesCount = compilerHost.readFile.disableDisplay();
|
|
27
|
-
|
|
27
|
+
let allDiagnostics = ts.getPreEmitDiagnostics(program);
|
|
28
28
|
logger.verbose(`Program created, read ${filesCount} files`);
|
|
29
29
|
if (!hasErrors(allDiagnostics)) {
|
|
30
30
|
logger.verbose('We finished making the program! Emitting...');
|
|
@@ -34,7 +34,7 @@ function compile(ts, { projectPath, configFileName = 'tsconfig.json', optionsToE
|
|
|
34
34
|
afterDeclarations: [transformPathsToLocalModules],
|
|
35
35
|
});
|
|
36
36
|
logger.verbose('Emit complete!');
|
|
37
|
-
allDiagnostics.
|
|
37
|
+
allDiagnostics = ts.sortAndDeduplicateDiagnostics(allDiagnostics.concat(emitResult.diagnostics));
|
|
38
38
|
}
|
|
39
39
|
allDiagnostics.forEach(reportDiagnostic);
|
|
40
40
|
if (hasErrors(allDiagnostics)) {
|
|
@@ -44,12 +44,12 @@ function compile(ts, { projectPath, configFileName = 'tsconfig.json', optionsToE
|
|
|
44
44
|
else {
|
|
45
45
|
logger.success(`Compiled successfully in ${(0, pretty_time_1.elapsedTime)(start)}`);
|
|
46
46
|
}
|
|
47
|
-
const formatHost = {
|
|
48
|
-
getCanonicalFileName: (path) => path,
|
|
49
|
-
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
|
50
|
-
getNewLine: () => ts.sys.newLine,
|
|
51
|
-
};
|
|
52
47
|
function reportDiagnostic(diagnostic) {
|
|
48
|
+
const formatHost = {
|
|
49
|
+
getCanonicalFileName: (path) => path,
|
|
50
|
+
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
|
51
|
+
getNewLine: () => ts.sys.newLine,
|
|
52
|
+
};
|
|
53
53
|
if (logger.isVerbose) {
|
|
54
54
|
logger.message(ts.formatDiagnosticsWithColorAndContext([diagnostic], formatHost));
|
|
55
55
|
}
|
|
@@ -9,11 +9,6 @@ function watch(ts, projectPath, { logger, onAfterFilesEmitted, enableSourceMap,
|
|
|
9
9
|
logger.message(`Typescript v${ts.version}`);
|
|
10
10
|
const configPath = (0, utils_1.getTsProjectConfigPath)(ts, projectPath);
|
|
11
11
|
const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram;
|
|
12
|
-
const formatHost = {
|
|
13
|
-
getCanonicalFileName: (path) => path,
|
|
14
|
-
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
|
15
|
-
getNewLine: () => ts.sys.newLine,
|
|
16
|
-
};
|
|
17
12
|
const host = ts.createWatchCompilerHost(configPath, {
|
|
18
13
|
noEmit: false,
|
|
19
14
|
noEmitOnError: false,
|
|
@@ -46,6 +41,11 @@ function watch(ts, projectPath, { logger, onAfterFilesEmitted, enableSourceMap,
|
|
|
46
41
|
// the program over time.
|
|
47
42
|
ts.createWatchProgram(host);
|
|
48
43
|
function reportDiagnostic(diagnostic) {
|
|
44
|
+
const formatHost = {
|
|
45
|
+
getCanonicalFileName: (path) => path,
|
|
46
|
+
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
|
47
|
+
getNewLine: () => ts.sys.newLine,
|
|
48
|
+
};
|
|
49
49
|
if (logger.isVerbose) {
|
|
50
50
|
logger.message(ts.formatDiagnosticsWithColorAndContext([diagnostic], formatHost));
|
|
51
51
|
}
|
|
@@ -59,7 +59,7 @@ function watch(ts, projectPath, { logger, onAfterFilesEmitted, enableSourceMap,
|
|
|
59
59
|
*/
|
|
60
60
|
function reportWatchStatusChanged(diagnostic) {
|
|
61
61
|
if (diagnostic.messageText) {
|
|
62
|
-
logger.message(ts.flattenDiagnosticMessageText(diagnostic.messageText,
|
|
62
|
+
logger.message(ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { NormalizedClientConfig } from '../models';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function clientCompile(config: NormalizedClientConfig): Promise<void>;
|
|
@@ -3,24 +3,48 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.clientCompile = clientCompile;
|
|
7
7
|
const webpack_1 = __importDefault(require("webpack"));
|
|
8
|
+
const core_1 = require("@rspack/core");
|
|
8
9
|
const logger_1 = require("../logger");
|
|
9
10
|
const config_1 = require("./config");
|
|
10
11
|
const utils_1 = require("./utils");
|
|
11
|
-
async function
|
|
12
|
-
const logger = new logger_1.Logger('
|
|
13
|
-
const webpackConfigs = [
|
|
12
|
+
async function clientCompile(config) {
|
|
13
|
+
const logger = new logger_1.Logger('client', config.verbose);
|
|
14
|
+
const webpackConfigs = [];
|
|
15
|
+
const rspackConfigs = [];
|
|
14
16
|
const isSsr = Boolean(config.ssr);
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
if (config.bundler === 'rspack') {
|
|
18
|
+
rspackConfigs.push(await (0, config_1.rspackConfigFactory)({ webpackMode: "production" /* WebpackMode.Prod */, config, logger }));
|
|
19
|
+
if (isSsr) {
|
|
20
|
+
const ssrLogger = new logger_1.Logger('client(SSR)', config.verbose);
|
|
21
|
+
rspackConfigs.push(await (0, config_1.rspackConfigFactory)({
|
|
22
|
+
webpackMode: "production" /* WebpackMode.Prod */,
|
|
23
|
+
config,
|
|
24
|
+
logger: ssrLogger,
|
|
25
|
+
isSsr,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
webpackConfigs.push(await (0, config_1.webpackConfigFactory)({ webpackMode: "production" /* WebpackMode.Prod */, config, logger }));
|
|
31
|
+
if (isSsr) {
|
|
32
|
+
const ssrLogger = new logger_1.Logger('client(SSR)', config.verbose);
|
|
33
|
+
webpackConfigs.push(await (0, config_1.webpackConfigFactory)({
|
|
34
|
+
webpackMode: "production" /* WebpackMode.Prod */,
|
|
35
|
+
config,
|
|
36
|
+
logger: ssrLogger,
|
|
37
|
+
isSsr,
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
18
40
|
}
|
|
19
41
|
logger.verbose('Config created');
|
|
20
42
|
return new Promise((resolve) => {
|
|
21
|
-
const compiler =
|
|
22
|
-
|
|
23
|
-
|
|
43
|
+
const compiler = config.bundler === 'rspack'
|
|
44
|
+
? (0, core_1.rspack)(rspackConfigs) // TODO add compiler factory
|
|
45
|
+
: (0, webpack_1.default)(webpackConfigs, (0, utils_1.webpackCompilerHandlerFactory)(logger, async () => {
|
|
46
|
+
resolve();
|
|
47
|
+
}));
|
|
24
48
|
process.on('SIGINT', async () => {
|
|
25
49
|
compiler.close(() => {
|
|
26
50
|
process.exit(1);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as webpack from 'webpack';
|
|
2
|
+
import { Configuration as RspackConfiguration } from '@rspack/core';
|
|
2
3
|
import type { NormalizedClientConfig } from '../models';
|
|
3
4
|
import type { Logger } from '../logger';
|
|
4
5
|
export interface HelperOptions {
|
|
@@ -15,12 +16,16 @@ export declare const enum WebpackMode {
|
|
|
15
16
|
Prod = "production",
|
|
16
17
|
Dev = "development"
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
type ClientFactoryOptions = {
|
|
20
|
+
webpackMode: WebpackMode;
|
|
21
|
+
config: NormalizedClientConfig;
|
|
19
22
|
logger?: Logger;
|
|
20
23
|
isSsr?: boolean;
|
|
21
|
-
}
|
|
24
|
+
};
|
|
25
|
+
export declare function webpackConfigFactory(options: ClientFactoryOptions): Promise<webpack.Configuration>;
|
|
26
|
+
export declare function rspackConfigFactory(options: ClientFactoryOptions): Promise<RspackConfiguration>;
|
|
22
27
|
export declare function configureModuleRules(helperOptions: HelperOptions, additionalRules?: NonNullable<webpack.RuleSetRule['oneOf']>): webpack.RuleSetRule[];
|
|
23
28
|
export declare function configureResolve({ isEnvProduction, config }: HelperOptions): webpack.ResolveOptions;
|
|
24
29
|
type Optimization = NonNullable<webpack.Configuration['optimization']>;
|
|
25
|
-
export declare function configureOptimization(
|
|
30
|
+
export declare function configureOptimization(helperOptions: HelperOptions): Optimization;
|
|
26
31
|
export {};
|