@gravity-ui/app-builder 0.8.6 → 0.9.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/README.md CHANGED
@@ -238,6 +238,7 @@ With this `{rootDir}/src/ui/tsconfig.json`:
238
238
  - `locale`: (`string[]=['ru']`) — list of `moment.js` or `day.js` locales to include, e.g. `['de', 'es']`. Locale `En` is always present.
239
239
  - `safari10` (`boolean`) — Enables `safari10` terser's option. [Terser options](https://github.com/terser/terser#minify-options)
240
240
  - `transformCssWithLightningCss` (`boolean`) — use [Lighting CSS](https://lightningcss.dev) to transform and minimize css instead of PostCSS and cssnano
241
+ - `terser` (`(options: TerserOptions) => TerserOptions`) - modify or return a custom [Terser options](https://github.com/terser/terser#minify-options).
241
242
 
242
243
  ##### Monaco editor support
243
244
 
@@ -13,6 +13,7 @@ import type { Options as StatoscopeOptions } from '@statoscope/webpack-plugin';
13
13
  import type { SentryWebpackPluginOptions } from '@sentry/webpack-plugin';
14
14
  import type { WebpackMode } from '../webpack/config';
15
15
  import type { UploadOptions } from '../s3-upload/upload';
16
+ import type { TerserOptions } from 'terser-webpack-plugin';
16
17
  export interface Entities<T> {
17
18
  data: Record<string, T>;
18
19
  keys: string[];
@@ -122,6 +123,8 @@ export interface ClientConfig {
122
123
  symlinks?: boolean;
123
124
  /**
124
125
  * Enables `safari10` terser's option. [Terser options](https://github.com/terser/terser#minify-options)
126
+ *
127
+ * @deprecated use `terser` option instead
125
128
  */
126
129
  safari10?: boolean;
127
130
  /**
@@ -187,6 +190,10 @@ export interface ClientConfig {
187
190
  babel?: (config: Babel.TransformOptions, options: {
188
191
  configType: `${WebpackMode}`;
189
192
  }) => Babel.TransformOptions | Promise<Babel.TransformOptions>;
193
+ /**
194
+ * Modify or return a custom [Terser options](https://github.com/terser/terser#minify-options).
195
+ */
196
+ terser?: (options: TerserOptions) => TerserOptions;
190
197
  }
191
198
  export interface CdnUploadConfig {
192
199
  bucket: string;
@@ -42,7 +42,6 @@ const react_refresh_webpack_plugin_1 = __importDefault(require("@pmmmwh/react-re
42
42
  const moment_timezone_data_webpack_plugin_1 = __importDefault(require("moment-timezone-data-webpack-plugin"));
43
43
  const webpack_plugin_1 = __importDefault(require("@statoscope/webpack-plugin"));
44
44
  const circular_dependency_plugin_1 = __importDefault(require("circular-dependency-plugin"));
45
- const webpack_plugin_2 = require("@sentry/webpack-plugin");
46
45
  const paths_1 = __importDefault(require("../paths"));
47
46
  const tempData_1 = __importDefault(require("../tempData"));
48
47
  const babel_1 = require("../babel");
@@ -595,6 +594,7 @@ function configurePlugins(options) {
595
594
  if (config.monaco) {
596
595
  const MonacoEditorWebpackPlugin = require('monaco-editor-webpack-plugin');
597
596
  plugins.push(new MonacoEditorWebpackPlugin({
597
+ filename: isEnvProduction ? '[name].[hash:8].worker.js' : undefined,
598
598
  ...config.monaco,
599
599
  // currently, workers located on cdn are not working properly, so we are enforcing loading workers from
600
600
  // service instead
@@ -642,7 +642,8 @@ function configurePlugins(options) {
642
642
  ignoreOrder: true,
643
643
  }));
644
644
  if (config.sentryConfig) {
645
- plugins.push((0, webpack_plugin_2.sentryWebpackPlugin)({ ...config.sentryConfig }));
645
+ const sentryPlugin = require('@sentry/webpack-plugin');
646
+ plugins.push(sentryPlugin({ ...config.sentryConfig }));
646
647
  }
647
648
  if (config.analyzeBundle === 'true') {
648
649
  plugins.push(new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
@@ -794,15 +795,18 @@ function configureOptimization({ config }) {
794
795
  (compiler) => {
795
796
  // Lazy load the Terser plugin
796
797
  const TerserPlugin = require('terser-webpack-plugin');
797
- new TerserPlugin({
798
- terserOptions: {
799
- compress: {
800
- passes: 2,
801
- },
802
- safari10: config.safari10,
803
- mangle: !config.reactProfiling,
798
+ let terserOptions = {
799
+ compress: {
800
+ passes: 2,
804
801
  },
805
- }).apply(compiler);
802
+ safari10: config.safari10,
803
+ mangle: !config.reactProfiling,
804
+ };
805
+ const { terser } = config;
806
+ if (typeof terser === 'function') {
807
+ terserOptions = terser(terserOptions);
808
+ }
809
+ new TerserPlugin({ terserOptions }).apply(compiler);
806
810
  },
807
811
  ],
808
812
  };
@@ -20,7 +20,7 @@ function generateWorkerLoader(url) {
20
20
  const publicPath = __webpack_public_path__;
21
21
  const workerPublicPath = publicPath.match(/^https?:\/\//)
22
22
  ? publicPath
23
- : new URL(publicPath, window.location.href).toString();
23
+ : new URL(publicPath, window.location.origin).toString();
24
24
  const objectURL = URL.createObjectURL(new Blob([
25
25
  [
26
26
  `self.__PUBLIC_PATH__ = ${JSON.stringify(workerPublicPath)}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.8.6",
3
+ "version": "0.9.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,7 +70,6 @@
70
70
  "@babel/runtime": "^7.22.0",
71
71
  "@okikio/sharedworker": "^1.0.4",
72
72
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
73
- "@sentry/webpack-plugin": "^2.7.1",
74
73
  "@statoscope/webpack-plugin": "^5.27.0",
75
74
  "@svgr/core": "^8.1.0",
76
75
  "@svgr/plugin-jsx": "^8.1.0",
@@ -97,7 +96,6 @@
97
96
  "fork-ts-checker-webpack-plugin": "^8.0.0",
98
97
  "fs-extra": "^11.1.1",
99
98
  "get-port": "^7.0.0",
100
- "lightningcss": "^1.21.5",
101
99
  "lodash": "^4.17.21",
102
100
  "mime-types": "^2.1.35",
103
101
  "mini-css-extract-plugin": "^2.7.6",
@@ -140,6 +138,7 @@
140
138
  "@gravity-ui/eslint-config": "^3.0.0",
141
139
  "@gravity-ui/prettier-config": "^1.1.0",
142
140
  "@gravity-ui/tsconfig": "^1.0.0",
141
+ "@sentry/webpack-plugin": "^2.7.1",
143
142
  "@types/babel__helper-plugin-utils": "^7.10.1",
144
143
  "@types/circular-dependency-plugin": "^5.0.6",
145
144
  "@types/common-tags": "^1.8.2",
@@ -159,6 +158,7 @@
159
158
  "eslint": "^8.49.0",
160
159
  "husky": "^8.0.3",
161
160
  "jest": "^29.5.0",
161
+ "lightningcss": "^1.21.5",
162
162
  "monaco-editor-webpack-plugin": "^6.0.0",
163
163
  "nano-staged": "^0.8.0",
164
164
  "npm-run-all": "^4.1.5",
@@ -166,11 +166,19 @@
166
166
  "ts-jest": "^29.1.0"
167
167
  },
168
168
  "peerDependencies": {
169
- "monaco-editor-webpack-plugin": "*"
169
+ "lightningcss": "^1.21.5",
170
+ "monaco-editor-webpack-plugin": "*",
171
+ "@sentry/webpack-plugin": "^2.7.1"
170
172
  },
171
173
  "peerDependenciesMeta": {
174
+ "lightningcss": {
175
+ "optional": true
176
+ },
172
177
  "monaco-editor-webpack-plugin": {
173
178
  "optional": true
179
+ },
180
+ "@sentry/webpack-plugin": {
181
+ "optional": true
174
182
  }
175
183
  },
176
184
  "nano-staged": {