@gravity-ui/app-builder 0.14.0 → 0.14.2-beta.0
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 +4 -1
- package/dist/commands/dev/client.d.ts +2 -1
- package/dist/commands/dev/client.js +57 -24
- package/dist/common/babel/index.js +1 -1
- package/dist/common/babel/ui-preset.js +0 -14
- package/dist/common/config.js +2 -0
- package/dist/common/library/index.js +1 -0
- 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 +13 -0
- package/dist/common/rspack/compile.d.ts +2 -0
- package/dist/common/rspack/compile.js +27 -0
- package/dist/common/rspack/config.d.ts +24 -0
- package/dist/common/rspack/config.js +772 -0
- package/dist/common/rspack/lazy-client.d.ts +1 -0
- package/dist/common/rspack/lazy-client.js +63 -0
- package/dist/common/rspack/progress-plugin.d.ts +11 -0
- package/dist/common/rspack/progress-plugin.js +43 -0
- package/dist/common/rspack/public-path.d.ts +1 -0
- package/dist/common/rspack/public-path.js +4 -0
- package/dist/common/rspack/utils.d.ts +4 -0
- package/dist/common/rspack/utils.js +81 -0
- package/dist/common/rspack/worker/public-path.worker.d.ts +1 -0
- package/dist/common/rspack/worker/public-path.worker.js +3 -0
- package/dist/common/rspack/worker/web-worker.d.mts +8 -0
- package/dist/common/rspack/worker/web-worker.mjs +32 -0
- package/dist/common/rspack/worker/worker-loader.d.ts +4 -0
- package/dist/common/rspack/worker/worker-loader.js +177 -0
- package/dist/common/s3-upload/create-plugin.d.ts +3 -0
- package/dist/common/s3-upload/create-plugin.js +47 -0
- package/dist/common/s3-upload/index.d.ts +1 -0
- package/dist/common/s3-upload/index.js +3 -1
- package/dist/common/webpack/config.js +1 -40
- package/dist/common/webpack/progress-plugin.d.ts +3 -1
- package/dist/common/webpack/progress-plugin.js +9 -2
- package/dist/common/webpack/storybook.d.ts +1 -1
- package/package.json +14 -10
|
@@ -2,6 +2,9 @@
|
|
|
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");
|
|
5
6
|
function buildClient(config) {
|
|
6
|
-
return
|
|
7
|
+
return config.client.bundler === 'webpack'
|
|
8
|
+
? (0, compile_1.webpackCompile)(config.client)
|
|
9
|
+
: (0, compile_2.rspackCompile)(config.client);
|
|
7
10
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import WebpackDevServer from 'webpack-dev-server';
|
|
2
|
+
import { RspackDevServer } from '@rspack/dev-server';
|
|
2
3
|
import type { NormalizedServiceConfig } from '../../common/models';
|
|
3
|
-
export declare function watchClientCompilation(config: NormalizedServiceConfig, onManifestReady: () => void): Promise<WebpackDevServer<import("express").Application, import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse
|
|
4
|
+
export declare function watchClientCompilation(config: NormalizedServiceConfig, onManifestReady: () => void): Promise<WebpackDevServer<import("express").Application, import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>> | RspackDevServer>;
|
|
@@ -34,26 +34,40 @@ const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
|
|
|
34
34
|
const webpack_manifest_plugin_1 = require("webpack-manifest-plugin");
|
|
35
35
|
const webpack_assets_manifest_1 = __importDefault(require("webpack-assets-manifest"));
|
|
36
36
|
const utils_1 = require("../../common/utils");
|
|
37
|
+
const rspack_manifest_plugin_1 = require("rspack-manifest-plugin");
|
|
38
|
+
const core_1 = require("@rspack/core");
|
|
39
|
+
const dev_server_1 = require("@rspack/dev-server");
|
|
37
40
|
const paths_1 = __importDefault(require("../../common/paths"));
|
|
38
41
|
const logger_1 = require("../../common/logger");
|
|
39
42
|
const config_1 = require("../../common/webpack/config");
|
|
43
|
+
const config_2 = require("../../common/rspack/config");
|
|
44
|
+
const utils_2 = require("../../common/rspack/utils");
|
|
40
45
|
async function watchClientCompilation(config, onManifestReady) {
|
|
41
|
-
const clientCompilation = await
|
|
46
|
+
const clientCompilation = await buildDevServer(config);
|
|
42
47
|
const compiler = clientCompilation.compiler;
|
|
43
48
|
subscribeToManifestReadyEvent(compiler, onManifestReady);
|
|
44
49
|
return clientCompilation;
|
|
45
50
|
}
|
|
46
|
-
async function
|
|
47
|
-
const
|
|
51
|
+
async function buildDevServer(config) {
|
|
52
|
+
const bundler = config.client.bundler;
|
|
53
|
+
const logger = new logger_1.Logger(bundler, config.verbose);
|
|
48
54
|
const { webSocketPath = path.normalize(`/${config.client.publicPathPrefix}/build/sockjs-node`), writeToDisk, ...devServer } = config.client.devServer || {};
|
|
49
55
|
const normalizedConfig = { ...config.client, devServer: { ...devServer, webSocketPath } };
|
|
50
|
-
const webpackConfigs = [
|
|
51
|
-
await (0, config_1.webpackConfigFactory)("development" /* WebpackMode.Dev */, normalizedConfig, { logger }),
|
|
52
|
-
];
|
|
53
56
|
const isSsr = Boolean(normalizedConfig.ssr);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
let webpackConfigs = [];
|
|
58
|
+
let rspackConfigs = [];
|
|
59
|
+
if (bundler === 'webpack') {
|
|
60
|
+
webpackConfigs = [await (0, config_1.webpackConfigFactory)("development" /* WebpackMode.Dev */, normalizedConfig, { logger })];
|
|
61
|
+
if (isSsr) {
|
|
62
|
+
const logger = new logger_1.Logger('webpack(SSR)', config.verbose);
|
|
63
|
+
webpackConfigs.push(await (0, config_1.webpackConfigFactory)("development" /* WebpackMode.Dev */, normalizedConfig, { logger, isSsr }));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
if (isSsr) {
|
|
68
|
+
throw new Error(`SSR is not supported in ${bundler}`);
|
|
69
|
+
}
|
|
70
|
+
rspackConfigs = [await (0, config_2.rspackConfigFactory)("development" /* RspackMode.Dev */, normalizedConfig, { logger })];
|
|
57
71
|
}
|
|
58
72
|
const publicPath = path.normalize(config.client.publicPathPrefix + '/build/');
|
|
59
73
|
const staticFolder = path.resolve(paths_1.default.appDist, 'public');
|
|
@@ -131,41 +145,60 @@ async function buildWebpackServer(config) {
|
|
|
131
145
|
});
|
|
132
146
|
}
|
|
133
147
|
options.proxy = proxy;
|
|
134
|
-
|
|
135
|
-
|
|
148
|
+
let server;
|
|
149
|
+
if (bundler === 'rspack') {
|
|
150
|
+
// Rspack multicompiler dont work with lazy compilation
|
|
151
|
+
const compiler = (0, core_1.rspack)(rspackConfigs[0]);
|
|
152
|
+
server = new dev_server_1.RspackDevServer(options, compiler);
|
|
153
|
+
// Need to clean cache before start. https://github.com/web-infra-dev/rspack/issues/9025
|
|
154
|
+
(0, utils_2.clearCacheDirectory)(rspackConfigs[0], logger);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
const compiler = (0, webpack_1.default)(webpackConfigs);
|
|
158
|
+
server = new webpack_dev_server_1.default(options, compiler);
|
|
159
|
+
}
|
|
136
160
|
try {
|
|
137
161
|
await server.start();
|
|
138
162
|
}
|
|
139
163
|
catch (e) {
|
|
140
|
-
logger.logError(
|
|
164
|
+
logger.logError(`Cannot start ${bundler} dev server`, e);
|
|
141
165
|
}
|
|
142
166
|
if (options.ipc && typeof options.ipc === 'string') {
|
|
143
167
|
fs.chmod(options.ipc, 0o666, (e) => logger.logError('', e));
|
|
144
168
|
}
|
|
145
169
|
return server;
|
|
146
170
|
}
|
|
147
|
-
function
|
|
171
|
+
function isRspackCompiler(compiler) {
|
|
172
|
+
return 'rspack' in compiler;
|
|
173
|
+
}
|
|
174
|
+
function subscribeToManifestReadyEvent(compiler, onManifestReady) {
|
|
148
175
|
const promises = [];
|
|
149
|
-
const options = Array.isArray(
|
|
150
|
-
|
|
151
|
-
: [webpackCompiler.options];
|
|
152
|
-
const compilers = 'compilers' in webpackCompiler ? webpackCompiler.compilers : [webpackCompiler];
|
|
176
|
+
const options = Array.isArray(compiler.options) ? compiler.options : [compiler.options];
|
|
177
|
+
const compilers = 'compilers' in compiler ? compiler.compilers : [compiler];
|
|
153
178
|
for (let i = 0; i < options.length; i++) {
|
|
154
179
|
const config = options[i];
|
|
155
180
|
const compiler = compilers[i];
|
|
156
181
|
if (!config || !compiler) {
|
|
157
182
|
throw new Error('Something goes wrong!');
|
|
158
183
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
184
|
+
if (!isRspackCompiler(compiler)) {
|
|
185
|
+
const assetsManifestPlugin = config.plugins.find((plugin) => plugin instanceof webpack_assets_manifest_1.default);
|
|
186
|
+
if (assetsManifestPlugin) {
|
|
187
|
+
const assetsManifestReady = (0, utils_1.deferredPromise)();
|
|
188
|
+
promises.push(assetsManifestReady.promise);
|
|
189
|
+
assetsManifestPlugin.hooks.done.tap('app-builder', assetsManifestReady.resolve);
|
|
190
|
+
}
|
|
164
191
|
}
|
|
165
192
|
const manifestReady = (0, utils_1.deferredPromise)();
|
|
166
193
|
promises.push(manifestReady.promise);
|
|
167
|
-
|
|
168
|
-
|
|
194
|
+
if (isRspackCompiler(compiler)) {
|
|
195
|
+
const { afterEmit } = (0, rspack_manifest_plugin_1.getCompilerHooks)(compiler);
|
|
196
|
+
afterEmit.tap('app-builder', manifestReady.resolve);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
const { afterEmit } = (0, webpack_manifest_plugin_1.getCompilerHooks)(compiler);
|
|
200
|
+
afterEmit.tap('app-builder', manifestReady.resolve);
|
|
201
|
+
}
|
|
169
202
|
}
|
|
170
203
|
Promise.all(promises).then(() => onManifestReady());
|
|
171
204
|
}
|
|
@@ -10,7 +10,7 @@ function babelPreset(config) {
|
|
|
10
10
|
bugfixes: true,
|
|
11
11
|
targets: config.isSsr ? { node: 'current' } : undefined,
|
|
12
12
|
},
|
|
13
|
-
runtime: { version: '^7.
|
|
13
|
+
runtime: { version: '^7.26.0' },
|
|
14
14
|
typescript: true,
|
|
15
15
|
react: {
|
|
16
16
|
runtime: config.newJsxTransform ? 'automatic' : 'classic',
|
|
@@ -16,20 +16,6 @@ module.exports = function (_context, options = {}) {
|
|
|
16
16
|
const isTypeScriptEnabled = getOption(options.typescript, false);
|
|
17
17
|
const reactOptions = getOption(options.react, {});
|
|
18
18
|
const presets = [
|
|
19
|
-
[
|
|
20
|
-
() => ({
|
|
21
|
-
/**
|
|
22
|
-
* Safari 15 has a buggy implementation of class properties,
|
|
23
|
-
* but @babel/compat-data marks it as stable.
|
|
24
|
-
* Can be removed once the issue is fixed and released.
|
|
25
|
-
* @see https://github.com/babel/babel/issues/14289
|
|
26
|
-
*/
|
|
27
|
-
plugins: [
|
|
28
|
-
require.resolve('@babel/plugin-transform-private-methods'),
|
|
29
|
-
require.resolve('@babel/plugin-transform-class-properties'),
|
|
30
|
-
],
|
|
31
|
-
}),
|
|
32
|
-
],
|
|
33
19
|
// Latest stable ECMAScript features
|
|
34
20
|
(isEnvDevelopment || isEnvProduction) && [require.resolve('@babel/preset-env'), envOptions],
|
|
35
21
|
// ES features necessary for current Node version
|
package/dist/common/config.js
CHANGED
|
@@ -196,9 +196,11 @@ async function normalizeClientConfig(client, mode) {
|
|
|
196
196
|
svgr: client.svgr ?? {},
|
|
197
197
|
entryFilter: client.entryFilter && splitPaths(client.entryFilter),
|
|
198
198
|
webpack: typeof client.webpack === 'function' ? client.webpack : (config) => config,
|
|
199
|
+
rspack: typeof client.rspack === 'function' ? client.rspack : (config) => config,
|
|
199
200
|
babel: typeof client.babel === 'function' ? client.babel : (config) => config,
|
|
200
201
|
devServer: undefined,
|
|
201
202
|
lazyCompilation: undefined,
|
|
203
|
+
bundler: client.bundler || 'webpack',
|
|
202
204
|
};
|
|
203
205
|
if (mode === 'dev') {
|
|
204
206
|
if (client.lazyCompilation) {
|
|
@@ -129,6 +129,7 @@ function compileStyles(inputDir, outputDir, onFinish, additionalGlobs = []) {
|
|
|
129
129
|
const sassTransformed = sass_1.default.compile(scssFile, {
|
|
130
130
|
sourceMap: true,
|
|
131
131
|
sourceMapIncludeSources: true,
|
|
132
|
+
silenceDeprecations: ['legacy-js-api'],
|
|
132
133
|
importers: [
|
|
133
134
|
{
|
|
134
135
|
findFileUrl(url) {
|
|
@@ -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" | "reset" | "dim" | "italic" | "underline" | "inverse" | "
|
|
8
|
+
Modifiers: "bold" | "hidden" | "reset" | "dim" | "italic" | "underline" | "inverse" | "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" | "reset" | "dim" | "italic" | "underline" | "inverse" | "
|
|
15
|
+
Modifiers: "bold" | "hidden" | "reset" | "dim" | "italic" | "underline" | "inverse" | "strikethrough" | "visible";
|
|
16
16
|
stderr: import("chalk").Chalk & {
|
|
17
17
|
supportsColor: import("chalk").ColorSupport | false;
|
|
18
18
|
};
|
|
@@ -3,6 +3,7 @@ import type { EditorFeature } from 'monaco-editor-webpack-plugin/out/features';
|
|
|
3
3
|
import type { IFeatureDefinition } from 'monaco-editor-webpack-plugin/out/types';
|
|
4
4
|
import type { Options as MomentTzOptions } from 'moment-timezone-data-webpack-plugin';
|
|
5
5
|
import type { Configuration, DefinePlugin, FileCacheOptions, MemoryCacheOptions, ResolveOptions } from 'webpack';
|
|
6
|
+
import type { Configuration as RspackConfiguration } from '@rspack/core';
|
|
6
7
|
import type * as Babel from '@babel/core';
|
|
7
8
|
import type { ServerConfiguration } from 'webpack-dev-server';
|
|
8
9
|
import type { Options as CircularDependenciesOptions } from 'circular-dependency-plugin';
|
|
@@ -14,6 +15,7 @@ import type { WebpackMode } from '../webpack/config';
|
|
|
14
15
|
import type { UploadOptions } from '../s3-upload/upload';
|
|
15
16
|
import type { TerserOptions } from 'terser-webpack-plugin';
|
|
16
17
|
import type { ReactRefreshPluginOptions } from '@pmmmwh/react-refresh-webpack-plugin/types/lib/types';
|
|
18
|
+
type Bundler = 'webpack' | 'rspack';
|
|
17
19
|
export interface Entities<T> {
|
|
18
20
|
data: Record<string, T>;
|
|
19
21
|
keys: string[];
|
|
@@ -182,6 +184,12 @@ export interface ClientConfig {
|
|
|
182
184
|
configType: `${WebpackMode}`;
|
|
183
185
|
isSsr?: boolean;
|
|
184
186
|
}) => Configuration | Promise<Configuration>;
|
|
187
|
+
/**
|
|
188
|
+
* Modify or return a custom Rspack config.
|
|
189
|
+
*/
|
|
190
|
+
rspack?: (config: RspackConfiguration, options: {
|
|
191
|
+
configType: `${WebpackMode}`;
|
|
192
|
+
}) => RspackConfiguration | Promise<RspackConfiguration>;
|
|
185
193
|
/**
|
|
186
194
|
* Modify or return a custom Babel config.
|
|
187
195
|
*/
|
|
@@ -197,6 +205,7 @@ export interface ClientConfig {
|
|
|
197
205
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
198
206
|
moduleType?: 'commonjs' | 'esm';
|
|
199
207
|
};
|
|
208
|
+
bundler?: Bundler;
|
|
200
209
|
}
|
|
201
210
|
export interface CdnUploadConfig {
|
|
202
211
|
bucket: string;
|
|
@@ -225,6 +234,7 @@ export interface ServiceConfig {
|
|
|
225
234
|
verbose?: boolean;
|
|
226
235
|
}
|
|
227
236
|
export type NormalizedClientConfig = Omit<ClientConfig, 'publicPathPrefix' | 'hiddenSourceMap' | 'svgr' | 'lazyCompilation' | 'devServer' | 'disableForkTsChecker' | 'disableReactRefresh'> & {
|
|
237
|
+
bundler: Bundler;
|
|
228
238
|
publicPathPrefix: string;
|
|
229
239
|
hiddenSourceMap: boolean;
|
|
230
240
|
svgr: NonNullable<ClientConfig['svgr']>;
|
|
@@ -238,6 +248,9 @@ export type NormalizedClientConfig = Omit<ClientConfig, 'publicPathPrefix' | 'hi
|
|
|
238
248
|
configType: `${WebpackMode}`;
|
|
239
249
|
isSsr: boolean;
|
|
240
250
|
}) => Configuration | Promise<Configuration>;
|
|
251
|
+
rspack: (config: RspackConfiguration, options: {
|
|
252
|
+
configType: `${WebpackMode}`;
|
|
253
|
+
}) => RspackConfiguration | Promise<RspackConfiguration>;
|
|
241
254
|
debugWebpack?: boolean;
|
|
242
255
|
babel: (config: Babel.TransformOptions, options: {
|
|
243
256
|
configType: `${WebpackMode}`;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rspackCompile = rspackCompile;
|
|
4
|
+
const core_1 = require("@rspack/core");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
const config_1 = require("./config");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
async function rspackCompile(config) {
|
|
9
|
+
const logger = new logger_1.Logger('rspack', config.verbose);
|
|
10
|
+
const rspackConfigs = [await (0, config_1.rspackConfigFactory)("production" /* RspackMode.Prod */, config, { logger })];
|
|
11
|
+
logger.verbose('Config created');
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
const compiler = (0, core_1.rspack)(rspackConfigs, (0, utils_1.rspackCompilerHandlerFactory)(logger, async () => {
|
|
14
|
+
resolve();
|
|
15
|
+
}));
|
|
16
|
+
process.on('SIGINT', async () => {
|
|
17
|
+
compiler?.close(() => {
|
|
18
|
+
process.exit(1);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
process.on('SIGTERM', async () => {
|
|
22
|
+
compiler?.close(() => {
|
|
23
|
+
process.exit(1);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Configuration, ResolveOptions, RuleSetRule } from '@rspack/core';
|
|
2
|
+
import { ManifestPluginOptions } from 'rspack-manifest-plugin';
|
|
3
|
+
import type { NormalizedClientConfig } from '../models';
|
|
4
|
+
import type { Logger } from '../logger';
|
|
5
|
+
export declare const generateManifest: ManifestPluginOptions['generate'];
|
|
6
|
+
export interface HelperOptions {
|
|
7
|
+
config: NormalizedClientConfig;
|
|
8
|
+
logger?: Logger;
|
|
9
|
+
isEnvDevelopment: boolean;
|
|
10
|
+
isEnvProduction: boolean;
|
|
11
|
+
configType: `${RspackMode}`;
|
|
12
|
+
}
|
|
13
|
+
export declare const enum RspackMode {
|
|
14
|
+
Prod = "production",
|
|
15
|
+
Dev = "development"
|
|
16
|
+
}
|
|
17
|
+
export declare function rspackConfigFactory(rspackMode: RspackMode, config: NormalizedClientConfig, { logger }?: {
|
|
18
|
+
logger?: Logger;
|
|
19
|
+
}): Promise<Configuration>;
|
|
20
|
+
export declare function configureModuleRules(helperOptions: HelperOptions, additionalRules?: NonNullable<RuleSetRule['oneOf']>): RuleSetRule[];
|
|
21
|
+
export declare function configureResolve({ isEnvProduction, config }: HelperOptions): ResolveOptions;
|
|
22
|
+
type Optimization = NonNullable<Configuration['optimization']>;
|
|
23
|
+
export declare function configureOptimization({ config }: HelperOptions): Optimization;
|
|
24
|
+
export {};
|