@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.
Files changed (44) hide show
  1. package/dist/commands/build/build-service/client.js +1 -4
  2. package/dist/commands/dev/client.js +24 -8
  3. package/dist/common/config.js +8 -7
  4. package/dist/common/logger/colors.d.ts +1 -1
  5. package/dist/common/logger/index.d.ts +1 -1
  6. package/dist/common/models/index.d.ts +1 -0
  7. package/dist/common/s3-upload/webpack-plugin.d.ts +2 -2
  8. package/dist/common/s3-upload/webpack-plugin.js +2 -3
  9. package/dist/common/typescript/compile.js +7 -7
  10. package/dist/common/typescript/watch.js +6 -6
  11. package/dist/common/webpack/compile.d.ts +1 -1
  12. package/dist/common/webpack/compile.js +34 -10
  13. package/dist/common/webpack/config.d.ts +8 -3
  14. package/dist/common/webpack/config.js +373 -117
  15. package/dist/common/webpack/node-externals.d.ts +4 -2
  16. package/dist/common/webpack/node-externals.js +5 -5
  17. package/dist/common/webpack/progress-plugin.d.ts +4 -5
  18. package/dist/common/webpack/progress-plugin.js +11 -33
  19. package/dist/common/webpack/rspack.d.ts +7 -0
  20. package/dist/common/{rspack/utils.js → webpack/rspack.js} +57 -27
  21. package/dist/common/webpack/storybook.d.ts +1 -1
  22. package/dist/common/webpack/utils.d.ts +2 -2
  23. package/dist/common/webpack/utils.js +4 -2
  24. package/dist/common/webpack/worker/worker-loader.d.ts +2 -2
  25. package/dist/common/webpack/worker/worker-loader.js +17 -17
  26. package/dist/create-cli.d.ts +2 -2
  27. package/package.json +1 -3
  28. package/dist/common/rspack/compile.d.ts +0 -2
  29. package/dist/common/rspack/compile.js +0 -27
  30. package/dist/common/rspack/config.d.ts +0 -24
  31. package/dist/common/rspack/config.js +0 -772
  32. package/dist/common/rspack/lazy-client.d.ts +0 -1
  33. package/dist/common/rspack/lazy-client.js +0 -63
  34. package/dist/common/rspack/progress-plugin.d.ts +0 -11
  35. package/dist/common/rspack/progress-plugin.js +0 -43
  36. package/dist/common/rspack/public-path.d.ts +0 -1
  37. package/dist/common/rspack/public-path.js +0 -4
  38. package/dist/common/rspack/utils.d.ts +0 -4
  39. package/dist/common/rspack/worker/public-path.worker.d.ts +0 -1
  40. package/dist/common/rspack/worker/public-path.worker.js +0 -3
  41. package/dist/common/rspack/worker/web-worker.d.mts +0 -8
  42. package/dist/common/rspack/worker/web-worker.mjs +0 -32
  43. package/dist/common/rspack/worker/worker-loader.d.ts +0 -4
  44. package/dist/common/rspack/worker/worker-loader.js +0 -177
@@ -35,7 +35,7 @@ function nodeExternals({ noExternal = [], module }) {
35
35
  const noExternals = Array().concat(webpackInternal).concat(noExternal);
36
36
  const nodeModules = readPackagesNames(paths_1.default.appNodeModules);
37
37
  return async (data) => {
38
- const { request } = data;
38
+ const { request, dependencyType } = data;
39
39
  if (!request) {
40
40
  return undefined;
41
41
  }
@@ -46,14 +46,14 @@ function nodeExternals({ noExternal = [], module }) {
46
46
  return undefined;
47
47
  }
48
48
  if (!module) {
49
- return `commonjs ${data.request}`;
49
+ return `commonjs ${request}`;
50
50
  }
51
- if (data.dependencyType === 'commonjs' ||
51
+ if (dependencyType === 'commonjs' ||
52
52
  // lodash/something without extension can't be imported so always require it
53
53
  (moduleName === 'lodash' && request.match(/^lodash\/[\w_]+($|\/[\w_]+$)/))) {
54
- return `node-commonjs ${data.request}`;
54
+ return `node-commonjs ${request}`;
55
55
  }
56
- return `module-import ${data.request}`;
56
+ return `module-import ${request}`;
57
57
  };
58
58
  }
59
59
  function readPackagesNames(dirName) {
@@ -1,13 +1,12 @@
1
- import * as webpack from 'webpack';
1
+ import webpack from 'webpack';
2
+ import type * as Webpack from 'webpack';
2
3
  import type { Logger } from '../logger';
3
4
  export declare class ProgressPlugin extends webpack.ProgressPlugin {
4
5
  private _logger;
5
- private _bundler;
6
6
  private _state;
7
- constructor({ logger, bundler }: {
7
+ constructor({ logger }: {
8
8
  logger: Logger;
9
- bundler?: string;
10
9
  });
11
10
  handler: (percent: number, message: string, ...details: string[]) => void;
12
- apply(compiler: webpack.Compiler): void;
11
+ apply(compiler: Webpack.Compiler): void;
13
12
  }
@@ -1,39 +1,17 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
25
5
  Object.defineProperty(exports, "__esModule", { value: true });
26
6
  exports.ProgressPlugin = void 0;
27
- const webpack = __importStar(require("webpack"));
7
+ const webpack_1 = __importDefault(require("webpack"));
28
8
  const pretty_time_1 = require("../logger/pretty-time");
29
- class ProgressPlugin extends webpack.ProgressPlugin {
9
+ class ProgressPlugin extends webpack_1.default.ProgressPlugin {
30
10
  _logger;
31
- _bundler;
32
11
  _state = {};
33
- constructor({ logger, bundler = 'webpack' }) {
12
+ constructor({ logger }) {
34
13
  super();
35
14
  this._logger = logger;
36
- this._bundler = bundler;
37
15
  }
38
16
  handler = (percent, message, ...details) => {
39
17
  const progress = Math.floor(percent * 100);
@@ -43,12 +21,12 @@ class ProgressPlugin extends webpack.ProgressPlugin {
43
21
  super.apply(compiler);
44
22
  hook(compiler, 'compile', () => {
45
23
  this._logger.message('Start compilation');
46
- // @ts-ignore
47
- const compilerVersipn = this._bundler === 'webpack'
48
- ? compiler.webpack.version
49
- : // @ts-ignore
50
- compiler.webpack.rspackVersion;
51
- this._logger.message(`${this._bundler} v${compilerVersipn}`);
24
+ if ('rspackVersion' in compiler.webpack) {
25
+ this._logger.message(`Rspack v${compiler.webpack.rspackVersion}`);
26
+ }
27
+ else {
28
+ this._logger.message(`Webpack v${compiler.webpack.version}`);
29
+ }
52
30
  this._state.start = process.hrtime.bigint();
53
31
  });
54
32
  hook(compiler, 'invalid', (fileName, changeTime) => {
@@ -0,0 +1,7 @@
1
+ import { ManifestPluginOptions } from 'rspack-manifest-plugin';
2
+ import type { RuleSetRule as WebpackRuleSetRule } from 'webpack';
3
+ import type { Configuration, RuleSetRule as RspackRuleSetRule } from '@rspack/core';
4
+ import type { Logger } from '../logger';
5
+ export declare function clearCacheDirectory(config: Configuration, logger: Logger): void;
6
+ export declare const generateAssetsManifest: ManifestPluginOptions['generate'];
7
+ export declare function prepareRspackRules(webpackRules: (undefined | null | false | '' | 0 | WebpackRuleSetRule | '...')[]): (RspackRuleSetRule | '...')[];
@@ -26,9 +26,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.generateAssetsManifest = void 0;
29
30
  exports.clearCacheDirectory = clearCacheDirectory;
30
- exports.rspackCompilerHandlerFactory = rspackCompilerHandlerFactory;
31
- const pretty_time_1 = require("../logger/pretty-time");
31
+ exports.prepareRspackRules = prepareRspackRules;
32
32
  const fs = __importStar(require("node:fs"));
33
33
  const path = __importStar(require("node:path"));
34
34
  const paths_1 = __importDefault(require("../../common/paths"));
@@ -47,35 +47,65 @@ function clearCacheDirectory(config, logger) {
47
47
  logger.message(`Rspack cache ${cacheDirectory} successfully cleared`);
48
48
  }
49
49
  }
50
- function rspackCompilerHandlerFactory(logger, onCompilationEnd) {
51
- return async (err, stats) => {
52
- if (err) {
53
- logger.panic(err.message, err);
50
+ const generateAssetsManifest = (seed, files, entries) => {
51
+ const manifestFiles = files.reduce((manifest, file) => {
52
+ manifest[file.name] = file.path;
53
+ return manifest;
54
+ }, seed);
55
+ const entrypoints = Object.keys(entries).reduce((previous, name) => {
56
+ return {
57
+ ...previous,
58
+ [name]: {
59
+ assets: {
60
+ js: entries[name].filter((file) => file.endsWith('.js')),
61
+ css: entries[name].filter((file) => file.endsWith('.css')),
62
+ },
63
+ },
64
+ };
65
+ }, {});
66
+ return {
67
+ files: manifestFiles,
68
+ entrypoints,
69
+ };
70
+ };
71
+ exports.generateAssetsManifest = generateAssetsManifest;
72
+ function prepareRspackUse(webpackUse) {
73
+ if (typeof webpackUse === 'string') {
74
+ if (webpackUse === 'swc-loader') {
75
+ return 'builtin:swc-loader';
54
76
  }
55
- if (stats) {
56
- logger.message('Stats:\n' +
57
- stats.toString({
58
- preset: 'errors-warnings',
59
- colors: process.stdout.isTTY,
60
- assets: logger.isVerbose,
61
- modules: logger.isVerbose,
62
- entrypoints: logger.isVerbose,
63
- timings: logger.isVerbose,
64
- }));
65
- if (stats.hasErrors()) {
66
- process.exit(1);
77
+ return webpackUse;
78
+ }
79
+ if (Array.isArray(webpackUse)) {
80
+ for (const item of webpackUse) {
81
+ if (item) {
82
+ prepareRspackUse(item);
67
83
  }
68
84
  }
69
- if (onCompilationEnd) {
70
- await onCompilationEnd();
85
+ }
86
+ return webpackUse;
87
+ }
88
+ function prepareRspackRules(webpackRules) {
89
+ const rspackRules = [];
90
+ for (const webpackRule of webpackRules) {
91
+ if (!webpackRule) {
92
+ continue;
71
93
  }
72
- const [clientStats] = stats?.stats ?? [];
73
- if (clientStats) {
74
- const time = (clientStats.endTime || 0) - (clientStats.startTime || 0);
75
- logger.success(`Client was successfully compiled in ${(0, pretty_time_1.prettyTime)(BigInt(time) * BigInt(1_000_000))}`);
94
+ if (typeof webpackRule === 'string') {
95
+ rspackRules.push(webpackRule);
96
+ continue;
76
97
  }
77
- if (!clientStats) {
78
- logger.success(`Client was successfully compiled`);
98
+ const rspackRule = webpackRule;
99
+ if (webpackRule.oneOf) {
100
+ rspackRule.oneOf = prepareRspackRules(webpackRule.oneOf);
79
101
  }
80
- };
102
+ if (webpackRule.rules) {
103
+ rspackRule.rules = prepareRspackRules(webpackRule.rules);
104
+ }
105
+ if (webpackRule.use) {
106
+ rspackRule.use = prepareRspackUse(webpackRule.use);
107
+ }
108
+ rspackRules.push(rspackRule);
109
+ }
110
+ return rspackRules;
81
111
  }
@@ -11,7 +11,7 @@ export declare function configureWebpackConfigForStorybook(mode: Mode, userConfi
11
11
  resolve: Webpack.ResolveOptions;
12
12
  plugins: (false | "" | 0 | ((this: Webpack.Compiler, compiler: Webpack.Compiler) => void) | Webpack.WebpackPluginInstance | null | undefined)[];
13
13
  optimization: {
14
- minimizer: (false | "" | 0 | Webpack.WebpackPluginInstance | "..." | ((this: Webpack.Compiler, compiler: Webpack.Compiler) => void) | null | undefined)[] | undefined;
14
+ minimizer: (false | "" | 0 | "..." | Webpack.WebpackPluginInstance | ((this: Webpack.Compiler, compiler: Webpack.Compiler) => void) | null | undefined)[] | undefined;
15
15
  };
16
16
  }>;
17
17
  export {};
@@ -1,6 +1,6 @@
1
- import type webpack from 'webpack';
1
+ import type * as Webpack from 'webpack';
2
2
  import type { Logger } from '../logger';
3
- export declare function webpackCompilerHandlerFactory(logger: Logger, onCompilationEnd?: () => void): (err?: Error | null, stats?: webpack.MultiStats) => Promise<void>;
3
+ export declare function webpackCompilerHandlerFactory(logger: Logger, onCompilationEnd?: () => void): (err?: Error | null, stats?: Webpack.MultiStats) => Promise<void>;
4
4
  export declare function resolveTsConfigPathsToAlias(projectPath: string, filename?: string): {
5
5
  aliases?: undefined;
6
6
  modules?: undefined;
@@ -53,11 +53,13 @@ function webpackCompilerHandlerFactory(logger, onCompilationEnd) {
53
53
  }
54
54
  const [clientStats, ssrStats] = stats?.stats ?? [];
55
55
  if (clientStats) {
56
- const time = clientStats.endTime - clientStats.startTime;
56
+ const { startTime = 0, endTime = 0 } = clientStats;
57
+ const time = endTime - startTime;
57
58
  logger.success(`Client was successfully compiled in ${(0, pretty_time_1.prettyTime)(BigInt(time) * BigInt(1_000_000))}`);
58
59
  }
59
60
  if (ssrStats) {
60
- const time = ssrStats.endTime - ssrStats.startTime;
61
+ const { startTime = 0, endTime = 0 } = ssrStats;
62
+ const time = endTime - startTime;
61
63
  logger.success(`SSR: Client was successfully compiled in ${(0, pretty_time_1.prettyTime)(BigInt(time) * BigInt(1_000_000))}`);
62
64
  }
63
65
  if (!clientStats && !ssrStats) {
@@ -1,2 +1,2 @@
1
- import webpack from 'webpack';
2
- export declare const pitch: webpack.PitchLoaderDefinitionFunction;
1
+ import type * as Webpack from 'webpack';
2
+ export declare const pitch: Webpack.PitchLoaderDefinitionFunction;
@@ -28,11 +28,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.pitch = void 0;
30
30
  const path = __importStar(require("node:path"));
31
- const webpack_1 = __importDefault(require("webpack"));
32
- const NodeTargetPlugin_1 = __importDefault(require("webpack/lib/node/NodeTargetPlugin"));
33
- const WebWorkerTemplatePlugin_1 = __importDefault(require("webpack/lib/webworker/WebWorkerTemplatePlugin"));
34
- const FetchCompileWasmPlugin_1 = __importDefault(require("webpack/lib/web/FetchCompileWasmPlugin"));
35
- const FetchCompileAsyncWasmPlugin_1 = __importDefault(require("webpack/lib/web/FetchCompileAsyncWasmPlugin"));
36
31
  const paths_1 = __importDefault(require("../../paths"));
37
32
  const pluginId = 'APP_BUILDER_WORKER_LOADER';
38
33
  const publicPath = path.resolve(__dirname, 'public-path.worker.js');
@@ -41,7 +36,7 @@ const pitch = function (request) {
41
36
  if (!this._compiler || !this._compilation) {
42
37
  throw new Error('Something went wrong');
43
38
  }
44
- const compilerOptions = this._compiler.options;
39
+ const { options: compilerOptions, webpack } = this._compiler;
45
40
  const logger = this.getLogger(pluginId);
46
41
  if (compilerOptions.output.globalObject === 'window') {
47
42
  logger.warn('Warning (app-builder-worker-loader): output.globalObject is set to "window". It should be set to "self" or "this" to support HMR in Workers.');
@@ -59,17 +54,22 @@ const pitch = function (request) {
59
54
  devtoolNamespace: path.resolve('/', path.relative(paths_1.default.app, this.resource)),
60
55
  };
61
56
  const workerCompiler = this._compilation.createChildCompiler(`worker ${request}`, workerOptions);
62
- new WebWorkerTemplatePlugin_1.default().apply(workerCompiler);
57
+ const { EntryPlugin, node: { NodeTargetPlugin }, web: { FetchCompileWasmPlugin, FetchCompileAsyncWasmPlugin }, webworker: { WebWorkerTemplatePlugin }, } = webpack;
58
+ new WebWorkerTemplatePlugin().apply(workerCompiler);
63
59
  if (this.target !== 'webworker' && this.target !== 'web') {
64
- new NodeTargetPlugin_1.default().apply(workerCompiler);
60
+ new NodeTargetPlugin().apply(workerCompiler);
61
+ }
62
+ if (FetchCompileWasmPlugin) {
63
+ new FetchCompileWasmPlugin({
64
+ mangleImports: this._compiler.options.optimization.mangleWasmImports,
65
+ }).apply(workerCompiler);
66
+ }
67
+ if (FetchCompileAsyncWasmPlugin) {
68
+ new FetchCompileAsyncWasmPlugin().apply(workerCompiler);
65
69
  }
66
- new FetchCompileWasmPlugin_1.default({
67
- mangleImports: this._compiler.options.optimization.mangleWasmImports,
68
- }).apply(workerCompiler);
69
- new FetchCompileAsyncWasmPlugin_1.default().apply(workerCompiler);
70
70
  const bundleName = path.parse(this.resourcePath).name;
71
- new webpack_1.default.EntryPlugin(this.context, `!!${publicPath}`, bundleName).apply(workerCompiler);
72
- new webpack_1.default.EntryPlugin(this.context, `!!${request}`, bundleName).apply(workerCompiler);
71
+ new EntryPlugin(this.context, `!!${publicPath}`, bundleName).apply(workerCompiler);
72
+ new EntryPlugin(this.context, `!!${request}`, bundleName).apply(workerCompiler);
73
73
  configureSourceMap(workerCompiler);
74
74
  const cb = this.async();
75
75
  workerCompiler.compile((err, compilation) => {
@@ -130,10 +130,10 @@ const pitch = function (request) {
130
130
  if ([filename, mapFile, licenseFile].includes(assetName)) {
131
131
  continue;
132
132
  }
133
- if (parentCompilation.assetsInfo.has(assetName)) {
133
+ if (parentCompilation.getAsset(assetName)) {
134
134
  continue;
135
135
  }
136
- parentCompilation.emitAsset(assetName, asset, compilation.assetsInfo.get(assetName));
136
+ parentCompilation.emitAsset(assetName, asset, compilation.getAsset(assetName)?.info);
137
137
  }
138
138
  }
139
139
  return cache.store(cacheIdent, cacheETag, { content, map: map?.toString() }, (storeCacheError) => {
@@ -163,7 +163,7 @@ function configureSourceMap(compiler) {
163
163
  const inline = devtool.includes('inline');
164
164
  const cheap = devtool.includes('cheap');
165
165
  const moduleMaps = devtool.includes('module');
166
- new webpack_1.default.SourceMapDevToolPlugin({
166
+ new compiler.webpack.SourceMapDevToolPlugin({
167
167
  filename: inline ? null : compiler.options.output.sourceMapFilename,
168
168
  moduleFilenameTemplate: compiler.options.output.devtoolModuleFilenameTemplate,
169
169
  fallbackModuleFilenameTemplate: compiler.options.output.devtoolFallbackModuleFilenameTemplate,
@@ -5,8 +5,8 @@ export declare function createCli(argv: string[]): {
5
5
  cdn: string | undefined;
6
6
  env: string[] | undefined;
7
7
  target: "client" | "server" | undefined;
8
- inspect: number | undefined;
9
8
  c: unknown;
9
+ inspect: number | undefined;
10
10
  inspectBrk: number | undefined;
11
11
  "inspect-brk": number | undefined;
12
12
  entryFilter: string[] | undefined;
@@ -33,8 +33,8 @@ export declare function createCli(argv: string[]): {
33
33
  cdn: string | undefined;
34
34
  env: string[] | undefined;
35
35
  target: "client" | "server" | undefined;
36
- inspect: number | undefined;
37
36
  c: unknown;
37
+ inspect: number | undefined;
38
38
  inspectBrk: number | undefined;
39
39
  "inspect-brk": number | undefined;
40
40
  entryFilter: string[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.14.2-beta.0",
3
+ "version": "0.15.1-beta.1",
4
4
  "description": "Develop and build your React client-server projects, powered by typescript and webpack",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -98,7 +98,6 @@
98
98
  "fork-ts-checker-webpack-plugin": "^9.0.2",
99
99
  "fs-extra": "^11.2.0",
100
100
  "get-port": "^7.1.0",
101
- "lodash": "^4.17.21",
102
101
  "mime-types": "^2.1.35",
103
102
  "mini-css-extract-plugin": "^2.9.1",
104
103
  "moment-timezone-data-webpack-plugin": "^1.5.1",
@@ -149,7 +148,6 @@
149
148
  "@types/common-tags": "^1.8.4",
150
149
  "@types/fs-extra": "^11.0.4",
151
150
  "@types/jest": "^29.5.2",
152
- "@types/lodash": "^4.17.10",
153
151
  "@types/mime-types": "^2.1.4",
154
152
  "@types/node": "^18",
155
153
  "@types/nodemon": "^1.19.6",
@@ -1,2 +0,0 @@
1
- import type { NormalizedClientConfig } from '../models';
2
- export declare function rspackCompile(config: NormalizedClientConfig): Promise<void>;
@@ -1,27 +0,0 @@
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
- }
@@ -1,24 +0,0 @@
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 {};