@gravity-ui/app-builder 0.14.2-beta.0 → 0.15.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 +1 -4
- package/dist/commands/dev/client.d.ts +1 -2
- package/dist/commands/dev/client.js +25 -55
- package/dist/common/config.js +8 -9
- package/dist/common/library/index.js +0 -1
- 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 +0 -13
- package/dist/common/s3-upload/index.d.ts +0 -1
- package/dist/common/s3-upload/index.js +1 -3
- 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 +5 -5
- package/dist/common/webpack/config.js +40 -2
- 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/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/package.json +1 -9
- 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/utils.js +0 -81
- 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
- package/dist/common/s3-upload/create-plugin.d.ts +0 -3
- package/dist/common/s3-upload/create-plugin.js +0 -47
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
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?:
|
|
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
|
|
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
|
|
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
|
|
2
|
-
export declare const pitch:
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
72
|
-
new
|
|
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.
|
|
133
|
+
if (parentCompilation.getAsset(assetName)) {
|
|
134
134
|
continue;
|
|
135
135
|
}
|
|
136
|
-
parentCompilation.emitAsset(assetName, asset, compilation.
|
|
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
|
|
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,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/app-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Develop and build your React client-server projects, powered by typescript and webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -70,9 +70,6 @@
|
|
|
70
70
|
"@babel/runtime": "^7.26.0",
|
|
71
71
|
"@okikio/sharedworker": "^1.0.7",
|
|
72
72
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
|
|
73
|
-
"@rspack/core": "^1.2.2",
|
|
74
|
-
"@rspack/dev-server": "^1.0.10",
|
|
75
|
-
"@rspack/plugin-react-refresh": "^1.0.0",
|
|
76
73
|
"@statoscope/webpack-plugin": "^5.28.2",
|
|
77
74
|
"@svgr/core": "^8.1.0",
|
|
78
75
|
"@svgr/plugin-jsx": "^8.1.0",
|
|
@@ -98,7 +95,6 @@
|
|
|
98
95
|
"fork-ts-checker-webpack-plugin": "^9.0.2",
|
|
99
96
|
"fs-extra": "^11.2.0",
|
|
100
97
|
"get-port": "^7.1.0",
|
|
101
|
-
"lodash": "^4.17.21",
|
|
102
98
|
"mime-types": "^2.1.35",
|
|
103
99
|
"mini-css-extract-plugin": "^2.9.1",
|
|
104
100
|
"moment-timezone-data-webpack-plugin": "^1.5.1",
|
|
@@ -114,7 +110,6 @@
|
|
|
114
110
|
"react-refresh": "^0.14.2",
|
|
115
111
|
"resolve-url-loader": "^5.0.0",
|
|
116
112
|
"rimraf": "^5.0.7",
|
|
117
|
-
"rspack-manifest-plugin": "^5.0.1",
|
|
118
113
|
"sass": "^1.79.0",
|
|
119
114
|
"sass-loader": "^16.0.0",
|
|
120
115
|
"semver": "^7.6.3",
|
|
@@ -124,7 +119,6 @@
|
|
|
124
119
|
"style-loader": "^4.0.0",
|
|
125
120
|
"svgo": "^3.3.2",
|
|
126
121
|
"terser-webpack-plugin": "5.3.10",
|
|
127
|
-
"ts-checker-rspack-plugin": "^1.1.1",
|
|
128
122
|
"ts-node": "10.9.2",
|
|
129
123
|
"tslib": "^2.6.2",
|
|
130
124
|
"typescript": "~5.6.0",
|
|
@@ -134,7 +128,6 @@
|
|
|
134
128
|
"webpack-dev-server": "^5.1.0",
|
|
135
129
|
"webpack-manifest-plugin": "^5.0.0",
|
|
136
130
|
"worker-loader": "^3.0.8",
|
|
137
|
-
"worker-rspack-loader": "^3.1.2",
|
|
138
131
|
"yargs": "^17.7.2"
|
|
139
132
|
},
|
|
140
133
|
"devDependencies": {
|
|
@@ -149,7 +142,6 @@
|
|
|
149
142
|
"@types/common-tags": "^1.8.4",
|
|
150
143
|
"@types/fs-extra": "^11.0.4",
|
|
151
144
|
"@types/jest": "^29.5.2",
|
|
152
|
-
"@types/lodash": "^4.17.10",
|
|
153
145
|
"@types/mime-types": "^2.1.4",
|
|
154
146
|
"@types/node": "^18",
|
|
155
147
|
"@types/nodemon": "^1.19.6",
|
|
@@ -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 {};
|