@gravity-ui/app-builder 0.30.0 → 0.30.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 (58) hide show
  1. package/dist/cli.js +20 -15
  2. package/dist/commands/build/build-lib.js +8 -5
  3. package/dist/commands/build/build-service/client.js +6 -3
  4. package/dist/commands/build/build-service/index.js +7 -4
  5. package/dist/commands/build/build-service/server.js +17 -11
  6. package/dist/commands/build/index.js +6 -3
  7. package/dist/commands/dev/client.js +63 -34
  8. package/dist/commands/dev/index.js +50 -21
  9. package/dist/commands/dev/server.js +42 -13
  10. package/dist/common/babel/index.js +4 -1
  11. package/dist/common/babel/ui-preset.d.ts +1 -1
  12. package/dist/common/babel/ui-preset.js +1 -0
  13. package/dist/common/child-process/controllable-script.js +32 -5
  14. package/dist/common/child-process/utils.js +30 -4
  15. package/dist/common/command.js +2 -1
  16. package/dist/common/config.js +49 -19
  17. package/dist/common/env.js +5 -3
  18. package/dist/common/library/babel-plugin-replace-paths.js +4 -2
  19. package/dist/common/library/index.js +95 -66
  20. package/dist/common/logger/colors.js +8 -2
  21. package/dist/common/logger/index.js +24 -17
  22. package/dist/common/logger/log-config.js +6 -3
  23. package/dist/common/logger/pretty-time.js +6 -2
  24. package/dist/common/models/index.d.ts +1 -1
  25. package/dist/common/models/index.js +8 -3
  26. package/dist/common/paths.js +28 -3
  27. package/dist/common/s3-upload/compress.js +12 -8
  28. package/dist/common/s3-upload/create-plugin.js +30 -4
  29. package/dist/common/s3-upload/index.js +9 -3
  30. package/dist/common/s3-upload/s3-client.js +37 -11
  31. package/dist/common/s3-upload/upload.js +38 -9
  32. package/dist/common/s3-upload/webpack-plugin.js +9 -5
  33. package/dist/common/swc/compile.js +12 -9
  34. package/dist/common/swc/index.js +7 -2
  35. package/dist/common/swc/utils.js +13 -6
  36. package/dist/common/swc/watch.js +9 -6
  37. package/dist/common/typescript/compile.js +14 -11
  38. package/dist/common/typescript/diagnostic.js +37 -11
  39. package/dist/common/typescript/transformers.js +29 -3
  40. package/dist/common/typescript/utils.js +18 -8
  41. package/dist/common/typescript/watch.js +13 -10
  42. package/dist/common/utils.js +25 -14
  43. package/dist/common/webpack/compile.js +22 -16
  44. package/dist/common/webpack/config.js +113 -80
  45. package/dist/common/webpack/node-externals.js +34 -5
  46. package/dist/common/webpack/progress-plugin.js +6 -3
  47. package/dist/common/webpack/public-path.d.ts +1 -0
  48. package/dist/common/webpack/public-path.js +1 -0
  49. package/dist/common/webpack/rspack.js +5 -1
  50. package/dist/common/webpack/runtime-versioning-plugin.js +3 -1
  51. package/dist/common/webpack/storybook.js +51 -21
  52. package/dist/common/webpack/utils.js +36 -9
  53. package/dist/common/webpack/worker/public-path.worker.d.ts +1 -0
  54. package/dist/common/webpack/worker/public-path.worker.js +1 -0
  55. package/dist/common/webpack/worker/worker-loader.js +34 -4
  56. package/dist/create-cli.js +48 -19
  57. package/dist/index.js +27 -5
  58. package/package.json +1 -2
@@ -1,35 +1,68 @@
1
- import * as path from 'node:path';
2
- import * as fs from 'node:fs';
3
- import * as webpack from 'webpack';
4
- import { CleanWebpackPlugin } from 'clean-webpack-plugin';
5
- import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
6
- import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
7
- import MiniCSSExtractPlugin from 'mini-css-extract-plugin';
8
- import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
9
- import WebpackAssetsManifest from 'webpack-assets-manifest';
10
- import { RspackManifestPlugin } from 'rspack-manifest-plugin';
11
- import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
12
- import MomentTimezoneDataPlugin from 'moment-timezone-data-webpack-plugin';
13
- import StatoscopeWebpackPlugin from '@statoscope/webpack-plugin';
14
- import CircularDependencyPlugin from 'circular-dependency-plugin';
15
- import { rspack } from '@rspack/core';
16
- import { generateAssetsManifest } from './rspack';
17
- import { TsCheckerRspackPlugin } from 'ts-checker-rspack-plugin';
18
- import ReactRefreshRspackPlugin from '@rspack/plugin-react-refresh';
19
- import paths from '../paths';
20
- import { babelPreset } from '../babel';
21
- import { createProgressPlugin } from './progress-plugin';
22
- import { resolveTsConfigPathsToAlias } from './utils';
23
- import { createS3UploadPlugins } from '../s3-upload';
24
- import { logConfig } from '../logger/log-config';
25
- import { resolveTypescript } from '../typescript/utils';
26
- import { nodeExternals } from './node-externals';
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;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.webpackConfigFactory = webpackConfigFactory;
30
+ exports.rspackConfigFactory = rspackConfigFactory;
31
+ exports.configureModuleRules = configureModuleRules;
32
+ exports.configureResolve = configureResolve;
33
+ exports.configureOptimization = configureOptimization;
34
+ const path = __importStar(require("node:path"));
35
+ const fs = __importStar(require("node:fs"));
36
+ const webpack = __importStar(require("webpack"));
37
+ const clean_webpack_plugin_1 = require("clean-webpack-plugin");
38
+ const webpack_manifest_plugin_1 = require("webpack-manifest-plugin");
39
+ const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
40
+ const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
41
+ const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
42
+ const webpack_assets_manifest_1 = __importDefault(require("webpack-assets-manifest"));
43
+ const rspack_manifest_plugin_1 = require("rspack-manifest-plugin");
44
+ const react_refresh_webpack_plugin_1 = __importDefault(require("@pmmmwh/react-refresh-webpack-plugin"));
45
+ const moment_timezone_data_webpack_plugin_1 = __importDefault(require("moment-timezone-data-webpack-plugin"));
46
+ const webpack_plugin_1 = __importDefault(require("@statoscope/webpack-plugin"));
47
+ const circular_dependency_plugin_1 = __importDefault(require("circular-dependency-plugin"));
48
+ const core_1 = require("@rspack/core");
49
+ const rspack_1 = require("./rspack");
50
+ const ts_checker_rspack_plugin_1 = require("ts-checker-rspack-plugin");
51
+ const plugin_react_refresh_1 = __importDefault(require("@rspack/plugin-react-refresh"));
52
+ const paths_1 = __importDefault(require("../paths"));
53
+ const babel_1 = require("../babel");
54
+ const progress_plugin_1 = require("./progress-plugin");
55
+ const utils_1 = require("./utils");
56
+ const s3_upload_1 = require("../s3-upload");
57
+ const log_config_1 = require("../logger/log-config");
58
+ const utils_2 = require("../typescript/utils");
59
+ const node_externals_1 = require("./node-externals");
27
60
  const imagesSizeLimit = 2048;
28
61
  const fontSizeLimit = 8192;
29
62
  function getHelperOptions({ webpackMode, config, logger, isSsr = false, configPath, }) {
30
63
  const isEnvDevelopment = webpackMode === "development" /* WebpackMode.Dev */;
31
64
  const isEnvProduction = webpackMode === "production" /* WebpackMode.Prod */;
32
- let buildDirectory = config.outputPath || (isSsr ? paths.appSsrBuild : paths.appBuild);
65
+ let buildDirectory = config.outputPath || (isSsr ? paths_1.default.appSsrBuild : paths_1.default.appBuild);
33
66
  if (config.moduleFederation) {
34
67
  buildDirectory = path.resolve(buildDirectory, config.moduleFederation.name);
35
68
  }
@@ -40,7 +73,7 @@ function getHelperOptions({ webpackMode, config, logger, isSsr = false, configPa
40
73
  isEnvProduction,
41
74
  configType: webpackMode,
42
75
  buildDirectory,
43
- entriesDirectory: isSsr ? paths.appSsrEntry : paths.appEntry,
76
+ entriesDirectory: isSsr ? paths_1.default.appSsrEntry : paths_1.default.appEntry,
44
77
  isSsr,
45
78
  configPath,
46
79
  };
@@ -51,7 +84,7 @@ function configureExternals({ config, isSsr }) {
51
84
  externals =
52
85
  config.ssr?.noExternal === true
53
86
  ? undefined
54
- : nodeExternals({
87
+ : (0, node_externals_1.nodeExternals)({
55
88
  noExternal: config.ssr?.noExternal,
56
89
  module: config.ssr?.moduleType === 'esm',
57
90
  });
@@ -76,13 +109,13 @@ function configureWebpackCache(options) {
76
109
  }
77
110
  return cache;
78
111
  }
79
- export async function webpackConfigFactory(options) {
112
+ async function webpackConfigFactory(options) {
80
113
  const { config } = options;
81
114
  const helperOptions = getHelperOptions(options);
82
115
  const { isSsr, isEnvProduction } = helperOptions;
83
116
  let webpackConfig = {
84
117
  mode: isEnvProduction ? 'production' : 'development',
85
- context: paths.app,
118
+ context: paths_1.default.app,
86
119
  bail: isEnvProduction,
87
120
  target: isSsr ? 'node' : undefined,
88
121
  devtool: configureDevTool(helperOptions),
@@ -115,11 +148,11 @@ export async function webpackConfigFactory(options) {
115
148
  isSsr,
116
149
  });
117
150
  if (config.debugWebpack) {
118
- logConfig('Preview webpack config', webpackConfig);
151
+ (0, log_config_1.logConfig)('Preview webpack config', webpackConfig);
119
152
  }
120
153
  return webpackConfig;
121
154
  }
122
- export async function rspackConfigFactory(options) {
155
+ async function rspackConfigFactory(options) {
123
156
  const { config } = options;
124
157
  const helperOptions = getHelperOptions(options);
125
158
  const { isSsr, isEnvProduction, isEnvDevelopment } = helperOptions;
@@ -127,7 +160,7 @@ export async function rspackConfigFactory(options) {
127
160
  const cache = Boolean(config.cache) || (isEnvDevelopment && Boolean(config.lazyCompilation));
128
161
  let rspackConfig = {
129
162
  mode: isEnvProduction ? 'production' : 'development',
130
- context: paths.app,
163
+ context: paths_1.default.app,
131
164
  bail: isEnvProduction,
132
165
  target: isSsr ? 'node' : undefined,
133
166
  devtool: configureDevTool(helperOptions),
@@ -157,11 +190,11 @@ export async function rspackConfigFactory(options) {
157
190
  isSsr,
158
191
  });
159
192
  if (config.debugWebpack) {
160
- logConfig('Preview rspack config', rspackConfig);
193
+ (0, log_config_1.logConfig)('Preview rspack config', rspackConfig);
161
194
  }
162
195
  return rspackConfig;
163
196
  }
164
- export async function configureModuleRules(helperOptions, additionalRules = []) {
197
+ async function configureModuleRules(helperOptions, additionalRules = []) {
165
198
  const jsLoader = await createJavaScriptLoader(helperOptions);
166
199
  return [
167
200
  ...createSourceMapRules(!helperOptions.config.disableSourceMapGeneration),
@@ -202,10 +235,10 @@ function getCacheBuildDependencies({ config, configPath }) {
202
235
  const buildDependencies = {};
203
236
  const dependenciesGroups = {
204
237
  appBuilderConfig: configPath ? [configPath] : [],
205
- packageJson: [path.join(paths.app, 'package.json')],
238
+ packageJson: [path.join(paths_1.default.app, 'package.json')],
206
239
  tsconfig: [
207
- path.join(paths.app, 'tsconfig.json'),
208
- path.join(paths.appClient, 'tsconfig.json'),
240
+ path.join(paths_1.default.app, 'tsconfig.json'),
241
+ path.join(paths_1.default.appClient, 'tsconfig.json'),
209
242
  ],
210
243
  };
211
244
  for (const [group, filePaths] of Object.entries(dependenciesGroups)) {
@@ -296,16 +329,16 @@ function configureRspackExperiments(options) {
296
329
  lazyCompilation,
297
330
  };
298
331
  }
299
- export function configureResolve({ isEnvProduction, config }) {
332
+ function configureResolve({ isEnvProduction, config }) {
300
333
  const alias = { ...config.alias };
301
334
  for (const [key, value] of Object.entries(alias)) {
302
- alias[key] = path.resolve(paths.app, value);
335
+ alias[key] = path.resolve(paths_1.default.app, value);
303
336
  }
304
337
  if (isEnvProduction && config.reactProfiling) {
305
338
  alias['react-dom$'] = 'react-dom/profiling';
306
339
  alias['scheduler/tracing'] = 'scheduler/tracing-profiling';
307
340
  }
308
- const { aliases, modules = [] } = resolveTsConfigPathsToAlias(paths.appClient);
341
+ const { aliases, modules = [] } = (0, utils_1.resolveTsConfigPathsToAlias)(paths_1.default.appClient);
309
342
  return {
310
343
  alias: {
311
344
  ...aliases,
@@ -501,7 +534,7 @@ async function createJavaScriptLoader({ isEnvProduction, isEnvDevelopment, confi
501
534
  }
502
535
  }
503
536
  const babelTransformOptions = await config.babel({
504
- presets: [babelPreset({ newJsxTransform: config.newJsxTransform, isSsr })],
537
+ presets: [(0, babel_1.babelPreset)({ newJsxTransform: config.newJsxTransform, isSsr })],
505
538
  plugins,
506
539
  }, { configType, isSsr });
507
540
  return {
@@ -520,9 +553,9 @@ async function createJavaScriptLoader({ isEnvProduction, isEnvDevelopment, confi
520
553
  }
521
554
  function createJavaScriptRule({ config, isEnvProduction }, jsLoader) {
522
555
  const include = [
523
- paths.appClient,
556
+ paths_1.default.appClient,
524
557
  ...(config.monaco && isEnvProduction
525
- ? [path.resolve(paths.appNodeModules, 'monaco-editor/esm/vs')]
558
+ ? [path.resolve(paths_1.default.appNodeModules, 'monaco-editor/esm/vs')]
526
559
  : []),
527
560
  ...(config.includes || []),
528
561
  ];
@@ -579,7 +612,7 @@ function createSassStylesRule(options) {
579
612
  options: {
580
613
  sourceMap: true, // must be always true for work with resolve-url-loader
581
614
  sassOptions: {
582
- loadPaths: [paths.appClient],
615
+ loadPaths: [paths_1.default.appClient],
583
616
  },
584
617
  },
585
618
  },
@@ -652,7 +685,7 @@ function getCssLoaders({ isEnvDevelopment, isEnvProduction, config, isSsr }, add
652
685
  });
653
686
  if (isEnvProduction) {
654
687
  loaders.unshift({
655
- loader: isRspack ? rspack.CssExtractRspackPlugin.loader : MiniCSSExtractPlugin.loader,
688
+ loader: isRspack ? core_1.rspack.CssExtractRspackPlugin.loader : mini_css_extract_plugin_1.default.loader,
656
689
  options: { emit: !isSsr },
657
690
  });
658
691
  }
@@ -660,8 +693,8 @@ function getCssLoaders({ isEnvDevelopment, isEnvProduction, config, isSsr }, add
660
693
  if (isSsr || config.ssr) {
661
694
  loaders.unshift({
662
695
  loader: isRspack
663
- ? rspack.CssExtractRspackPlugin.loader
664
- : MiniCSSExtractPlugin.loader,
696
+ ? core_1.rspack.CssExtractRspackPlugin.loader
697
+ : mini_css_extract_plugin_1.default.loader,
665
698
  options: { emit: !isSsr },
666
699
  });
667
700
  }
@@ -719,7 +752,7 @@ function createIconsRule({ isEnvProduction, config, isSsr }, jsLoader) {
719
752
  function createAssetsRules({ isEnvProduction, config, isSsr }) {
720
753
  const imagesRule = {
721
754
  test: /\.(ico|bmp|gif|jpe?g|png|svg)$/,
722
- include: [paths.appClient, ...(config.images || [])],
755
+ include: [paths_1.default.appClient, ...(config.images || [])],
723
756
  type: 'asset',
724
757
  parser: {
725
758
  dataUrlCondition: {
@@ -733,7 +766,7 @@ function createAssetsRules({ isEnvProduction, config, isSsr }) {
733
766
  };
734
767
  const fontsRule = {
735
768
  test: /\.(ttf|eot|woff2?)$/,
736
- include: [paths.appClient],
769
+ include: [paths_1.default.appClient],
737
770
  type: 'asset',
738
771
  parser: {
739
772
  dataUrlCondition: {
@@ -752,7 +785,7 @@ function createAssetsRules({ isEnvProduction, config, isSsr }) {
752
785
  rules.unshift({
753
786
  test: /\.(ico|bmp|gif|jpe?g|png|svg)$/,
754
787
  issuer: /\.s?css$/,
755
- include: [paths.appClient, ...(config.images || [])],
788
+ include: [paths_1.default.appClient, ...(config.images || [])],
756
789
  type: 'asset',
757
790
  parser: {
758
791
  dataUrlCondition: {
@@ -767,7 +800,7 @@ function createAssetsRules({ isEnvProduction, config, isSsr }) {
767
800
  }, {
768
801
  test: /\.(ttf|eot|woff2?)$/,
769
802
  issuer: /\.s?css$/,
770
- include: [paths.appClient],
803
+ include: [paths_1.default.appClient],
771
804
  type: 'asset',
772
805
  parser: {
773
806
  dataUrlCondition: {
@@ -816,7 +849,7 @@ function createMomentTimezoneDataPlugin(options = {}) {
816
849
  // https://momentjs.com/timezone/docs/#/use-it/webpack/
817
850
  const startYear = options.startYear ?? currentYear;
818
851
  const endYear = options.endYear ?? currentYear;
819
- return new MomentTimezoneDataPlugin({ ...options, startYear, endYear });
852
+ return new moment_timezone_data_webpack_plugin_1.default({ ...options, startYear, endYear });
820
853
  }
821
854
  function getDefinitions({ config, isSsr }) {
822
855
  return {
@@ -856,8 +889,8 @@ function getForkTsCheckerOptions({ config, }) {
856
889
  : {
857
890
  ...config.forkTsChecker,
858
891
  typescript: {
859
- typescriptPath: resolveTypescript(),
860
- configFile: path.resolve(paths.appClient, 'tsconfig.json'),
892
+ typescriptPath: (0, utils_2.resolveTypescript)(),
893
+ configFile: path.resolve(paths_1.default.appClient, 'tsconfig.json'),
861
894
  diagnosticOptions: {
862
895
  syntactic: true,
863
896
  },
@@ -880,7 +913,7 @@ function configureCommonPlugins(options, bundlerPlugins) {
880
913
  const excludeFromClean = config.excludeFromClean || [];
881
914
  const forkTsCheckerOptions = getForkTsCheckerOptions(options);
882
915
  const plugins = [
883
- new CleanWebpackPlugin({
916
+ new clean_webpack_plugin_1.CleanWebpackPlugin({
884
917
  verbose: config.verbose,
885
918
  cleanOnceBeforeBuildPatterns: [
886
919
  '**/*',
@@ -904,7 +937,7 @@ function configureCommonPlugins(options, bundlerPlugins) {
904
937
  if (typeof config.detectCircularDependencies === 'object') {
905
938
  circularPluginOptions = config.detectCircularDependencies;
906
939
  }
907
- plugins.push(new CircularDependencyPlugin(circularPluginOptions));
940
+ plugins.push(new circular_dependency_plugin_1.default(circularPluginOptions));
908
941
  }
909
942
  if (isEnvProduction || isSsr || config.ssr) {
910
943
  plugins.push(new bundlerPlugins.CSSExtractPlugin(getCssExtractPluginOptions(options)));
@@ -957,7 +990,7 @@ function configureCommonPlugins(options, bundlerPlugins) {
957
990
  }
958
991
  if (isEnvProduction) {
959
992
  if (config.analyzeBundle === 'true') {
960
- plugins.push(new BundleAnalyzerPlugin({
993
+ plugins.push(new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
961
994
  openAnalyzer: false,
962
995
  analyzerMode: 'static',
963
996
  reportFilename: 'stats.html',
@@ -965,7 +998,7 @@ function configureCommonPlugins(options, bundlerPlugins) {
965
998
  }
966
999
  if (config.analyzeBundle === 'statoscope') {
967
1000
  const customStatoscopeConfig = config.statoscopeConfig || {};
968
- plugins.push(new StatoscopeWebpackPlugin({
1001
+ plugins.push(new webpack_plugin_1.default({
969
1002
  saveReportTo: path.resolve(options.buildDirectory, 'report.html'),
970
1003
  saveStatsTo: path.resolve(options.buildDirectory, 'stats.json'),
971
1004
  open: false,
@@ -986,7 +1019,7 @@ function configureCommonPlugins(options, bundlerPlugins) {
986
1019
  }
987
1020
  }
988
1021
  if (config.cdn) {
989
- plugins.push(...createS3UploadPlugins(config, options.logger));
1022
+ plugins.push(...(0, s3_upload_1.createS3UploadPlugins)(config, options.logger));
990
1023
  }
991
1024
  return plugins;
992
1025
  }
@@ -996,17 +1029,17 @@ function configureWebpackPlugins(options) {
996
1029
  DefinePlugin: webpack.DefinePlugin,
997
1030
  ContextReplacementPlugin: webpack.ContextReplacementPlugin,
998
1031
  ProvidePlugin: webpack.ProvidePlugin,
999
- ProgressPlugin: createProgressPlugin(webpack.ProgressPlugin),
1000
- ManifestPlugin: WebpackManifestPlugin,
1001
- TsCheckerPlugin: ForkTsCheckerWebpackPlugin,
1002
- CSSExtractPlugin: MiniCSSExtractPlugin,
1032
+ ProgressPlugin: (0, progress_plugin_1.createProgressPlugin)(webpack.ProgressPlugin),
1033
+ ManifestPlugin: webpack_manifest_plugin_1.WebpackManifestPlugin,
1034
+ TsCheckerPlugin: fork_ts_checker_webpack_plugin_1.default,
1035
+ CSSExtractPlugin: mini_css_extract_plugin_1.default,
1003
1036
  RSDoctorPlugin: require('@rsdoctor/webpack-plugin').RsdoctorWebpackPlugin,
1004
1037
  ModuleFederationPlugin: require('@module-federation/enhanced/webpack')
1005
1038
  .ModuleFederationPlugin,
1006
1039
  };
1007
1040
  const webpackPlugins = [
1008
1041
  ...configureCommonPlugins(options, plugins),
1009
- new WebpackAssetsManifest(isEnvProduction
1042
+ new webpack_assets_manifest_1.default(isEnvProduction
1010
1043
  ? {
1011
1044
  entrypoints: true,
1012
1045
  output: config.assetsManifestFile,
@@ -1024,34 +1057,34 @@ function configureWebpackPlugins(options) {
1024
1057
  overlay: { sockPath: webSocketPath },
1025
1058
  exclude: [/node_modules/, /\.worker\.[jt]sx?$/],
1026
1059
  });
1027
- webpackPlugins.push(new ReactRefreshWebpackPlugin(reactRefreshConfig));
1060
+ webpackPlugins.push(new react_refresh_webpack_plugin_1.default(reactRefreshConfig));
1028
1061
  }
1029
1062
  return webpackPlugins;
1030
1063
  }
1031
1064
  function configureRspackPlugins(options) {
1032
1065
  const { isEnvDevelopment, isEnvProduction, config, isSsr } = options;
1033
1066
  const plugins = {
1034
- DefinePlugin: rspack.DefinePlugin,
1035
- ContextReplacementPlugin: rspack.ContextReplacementPlugin,
1036
- ProvidePlugin: rspack.ProvidePlugin,
1037
- ProgressPlugin: createProgressPlugin(rspack.ProgressPlugin),
1038
- ManifestPlugin: RspackManifestPlugin,
1039
- TsCheckerPlugin: TsCheckerRspackPlugin,
1040
- CSSExtractPlugin: rspack.CssExtractRspackPlugin,
1067
+ DefinePlugin: core_1.rspack.DefinePlugin,
1068
+ ContextReplacementPlugin: core_1.rspack.ContextReplacementPlugin,
1069
+ ProvidePlugin: core_1.rspack.ProvidePlugin,
1070
+ ProgressPlugin: (0, progress_plugin_1.createProgressPlugin)(core_1.rspack.ProgressPlugin),
1071
+ ManifestPlugin: rspack_manifest_plugin_1.RspackManifestPlugin,
1072
+ TsCheckerPlugin: ts_checker_rspack_plugin_1.TsCheckerRspackPlugin,
1073
+ CSSExtractPlugin: core_1.rspack.CssExtractRspackPlugin,
1041
1074
  RSDoctorPlugin: require('@rsdoctor/rspack-plugin').RsdoctorRspackPlugin,
1042
1075
  ModuleFederationPlugin: require('@module-federation/enhanced/rspack')
1043
1076
  .ModuleFederationPlugin,
1044
1077
  };
1045
1078
  const rspackPlugins = [
1046
1079
  ...configureCommonPlugins(options, plugins),
1047
- new RspackManifestPlugin({
1080
+ new rspack_manifest_plugin_1.RspackManifestPlugin({
1048
1081
  fileName: isEnvProduction
1049
1082
  ? config.assetsManifestFile
1050
1083
  : path.resolve(options.buildDirectory, config.assetsManifestFile),
1051
1084
  writeToFileEmit: true,
1052
1085
  useLegacyEmit: true,
1053
1086
  publicPath: '',
1054
- generate: generateAssetsManifest,
1087
+ generate: rspack_1.generateAssetsManifest,
1055
1088
  }),
1056
1089
  ];
1057
1090
  if (!isSsr && isEnvDevelopment && config.reactRefresh !== false) {
@@ -1060,7 +1093,7 @@ function configureRspackPlugins(options) {
1060
1093
  overlay: { sockPath: webSocketPath },
1061
1094
  exclude: [/node_modules/, /\.worker\.[jt]sx?$/],
1062
1095
  });
1063
- rspackPlugins.push(new ReactRefreshRspackPlugin({
1096
+ rspackPlugins.push(new plugin_react_refresh_1.default({
1064
1097
  ...reactRefreshConfig,
1065
1098
  overlay: typeof overlay === 'object'
1066
1099
  ? {
@@ -1121,7 +1154,7 @@ function getOptimizationSplitChunks({ config }) {
1121
1154
  },
1122
1155
  };
1123
1156
  }
1124
- export function configureOptimization(helperOptions) {
1157
+ function configureOptimization(helperOptions) {
1125
1158
  const { config, isSsr } = helperOptions;
1126
1159
  if (isSsr) {
1127
1160
  return {};
@@ -1201,7 +1234,7 @@ function configureRspackOptimization(helperOptions) {
1201
1234
  if (typeof lightningCssMinimizerOptions === 'function') {
1202
1235
  lightningCssMinifyOptions = lightningCssMinimizerOptions(lightningCssMinifyOptions);
1203
1236
  }
1204
- cssMinimizer = new rspack.LightningCssMinimizerRspackPlugin(lightningCssMinifyOptions);
1237
+ cssMinimizer = new core_1.rspack.LightningCssMinimizerRspackPlugin(lightningCssMinifyOptions);
1205
1238
  }
1206
1239
  else {
1207
1240
  const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
@@ -1234,7 +1267,7 @@ function configureRspackOptimization(helperOptions) {
1234
1267
  const optimization = {
1235
1268
  splitChunks: getOptimizationSplitChunks(helperOptions),
1236
1269
  runtimeChunk: helperOptions.config.moduleFederation ? false : 'single',
1237
- minimizer: [new rspack.SwcJsMinimizerRspackPlugin(swcMinifyOptions), cssMinimizer],
1270
+ minimizer: [new core_1.rspack.SwcJsMinimizerRspackPlugin(swcMinifyOptions), cssMinimizer],
1238
1271
  };
1239
1272
  return optimization;
1240
1273
  }
@@ -1,10 +1,39 @@
1
- import * as fs from 'node:fs';
2
- import * as path from 'node:path';
3
- import paths from '../paths';
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;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.nodeExternals = nodeExternals;
30
+ const fs = __importStar(require("node:fs"));
31
+ const path = __importStar(require("node:path"));
32
+ const paths_1 = __importDefault(require("../paths"));
4
33
  const webpackInternal = /^webpack\/container\/reference\//;
5
- export function nodeExternals({ noExternal = [], module }) {
34
+ function nodeExternals({ noExternal = [], module }) {
6
35
  const noExternals = Array().concat(webpackInternal).concat(noExternal);
7
- const nodeModules = readPackagesNames(paths.appNodeModules);
36
+ const nodeModules = readPackagesNames(paths_1.default.appNodeModules);
8
37
  return async (data) => {
9
38
  const { request, dependencyType } = data;
10
39
  if (!request) {
@@ -1,5 +1,8 @@
1
- import { elapsedTime } from '../logger/pretty-time';
2
- export function createProgressPlugin(BaseClass) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createProgressPlugin = createProgressPlugin;
4
+ const pretty_time_1 = require("../logger/pretty-time");
5
+ function createProgressPlugin(BaseClass) {
3
6
  return class ProgressPlugin extends BaseClass {
4
7
  logger;
5
8
  state = {};
@@ -27,7 +30,7 @@ export function createProgressPlugin(BaseClass) {
27
30
  this.logger.verbose(`Invalidate file: ${fileName} at ${changeTime}`);
28
31
  });
29
32
  hook(compiler, 'done', (stats) => {
30
- const time = this.state.start ? ' in ' + elapsedTime(this.state.start) : '';
33
+ const time = this.state.start ? ' in ' + (0, pretty_time_1.elapsedTime)(this.state.start) : '';
31
34
  const hasErrors = stats.hasErrors();
32
35
  if (hasErrors) {
33
36
  this.logger.error('Compiled with some errors' + time);
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  /* eslint-disable camelcase, no-implicit-globals */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
3
4
  // @ts-expect-error
4
5
  __webpack_public_path__ = globalThis.__PUBLIC_PATH__ ?? '/build/';
@@ -1,4 +1,7 @@
1
- export const generateAssetsManifest = (seed, files, entries) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateAssetsManifest = void 0;
4
+ const generateAssetsManifest = (seed, files, entries) => {
2
5
  const manifestFiles = files.reduce((manifest, file) => {
3
6
  manifest[file.name] = file.path;
4
7
  return manifest;
@@ -19,3 +22,4 @@ export const generateAssetsManifest = (seed, files, entries) => {
19
22
  entrypoints,
20
23
  };
21
24
  };
25
+ exports.generateAssetsManifest = generateAssetsManifest;
@@ -1,4 +1,6 @@
1
+ "use strict";
1
2
  /* global window */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
2
4
  const RuntimeVersioningPlugin = () => {
3
5
  return {
4
6
  name: 'runtime-versioning-plugin',
@@ -17,4 +19,4 @@ const RuntimeVersioningPlugin = () => {
17
19
  },
18
20
  };
19
21
  };
20
- export default RuntimeVersioningPlugin;
22
+ exports.default = RuntimeVersioningPlugin;