@gravity-ui/app-builder 0.4.3 → 0.5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.1](https://github.com/gravity-ui/app-builder/compare/v0.5.0...v0.5.1) (2023-06-26)
4
+
5
+
6
+ ### Features
7
+
8
+ * added the ability to disable entries for webpack lazy compilation ([#32](https://github.com/gravity-ui/app-builder/issues/32)) ([fed462a](https://github.com/gravity-ui/app-builder/commit/fed462a9803f4891ea0aff300133dec45c708fb9))
9
+
10
+ ## [0.5.0](https://github.com/gravity-ui/app-builder/compare/v0.4.3...v0.5.0) (2023-06-17)
11
+
12
+
13
+ ### Features
14
+
15
+ * **build:** remove the use of @babel/plugin-proposal-decorators ([#27](https://github.com/gravity-ui/app-builder/issues/27)) ([2b09510](https://github.com/gravity-ui/app-builder/commit/2b09510130232578e503cc8042010e8995cb237f))
16
+
3
17
  ## [0.4.3](https://github.com/gravity-ui/app-builder/compare/v0.4.2...v0.4.3) (2023-06-05)
4
18
 
5
19
 
package/README.md CHANGED
@@ -201,6 +201,11 @@ With this `{rootDir}/src/ui/tsconfig.json`:
201
201
  - `watchPackages` (`boolean`) - watch all changes in `node_modules`.
202
202
  - `disableReactRefresh` (`boolean`) — disable `react-refresh` in dev mode.
203
203
  - `detectCircularDependencies` (`true | CircularDependenciesOptions`) - detect modules with circular dependencies, [more](https://github.com/aackerman/circular-dependency-plugin)
204
+ - `lazyCompilation` (`true | LazyCompilationConfig`) — enable experimental [lazy compilation](https://webpack.js.org/configuration/experiments/#experimentslazycompilation) feature
205
+ - `true` — enable feature
206
+ - `LazyCompilationConfig`
207
+ - `port` (`number`) — port where to listen to from the server
208
+ - `entries` (`boolean=true`) — if `false` - disables lazy compilation for `src/ui/entries` folder content
204
209
 
205
210
  ##### Production build
206
211
 
@@ -33,6 +33,7 @@ async function buildWebpackServer(config) {
33
33
  liveReload: false,
34
34
  hot: true,
35
35
  client: {
36
+ logging: config.verbose ? 'log' : 'error',
36
37
  webSocketURL: { pathname: webSocketPath },
37
38
  overlay: {
38
39
  runtimeErrors: config.verbose,
@@ -43,14 +43,6 @@ module.exports = function (_context, options = {}) {
43
43
  ],
44
44
  ].filter(Boolean);
45
45
  const plugins = [
46
- isTypeScriptEnabled && [
47
- require.resolve('@babel/plugin-proposal-decorators'),
48
- {
49
- // @decorator
50
- // export class Foo {}
51
- decoratorsBeforeExport: true,
52
- },
53
- ],
54
46
  // Polyfills the runtime needed for async/await and generators
55
47
  [require.resolve('@babel/plugin-transform-runtime'), runtimeOptions],
56
48
  isEnvProduction && [
@@ -257,7 +257,9 @@ function buildLibrary(config) {
257
257
  const componentDefFile = getFilePath(file, { dir: paths_1.default.libCompiledAssetsEsm, ext: 'd.ts' });
258
258
  if (svgoRegEx.test(iconFile)) {
259
259
  try {
260
- const component = await (0, core_1.transform)(fs_1.default.readFileSync(iconFile, 'utf-8'));
260
+ const component = await (0, core_1.transform)(fs_1.default.readFileSync(iconFile, 'utf-8'), {
261
+ jsxRuntime: config.lib.newJsxTransform ? 'automatic' : 'classic',
262
+ });
261
263
  babel.transform(component, {
262
264
  filename: iconFile,
263
265
  presets: [(0, babel_1.babelPreset)(config.lib)],
@@ -183,7 +183,12 @@ export type NormalizedClientConfig = Omit<ClientConfig, 'publicPathPrefix' | 'hi
183
183
  hiddenSourceMap: boolean;
184
184
  svgr: NonNullable<ClientConfig['svgr']>;
185
185
  lazyCompilation?: {
186
- port: number;
186
+ port?: number;
187
+ /**
188
+ * @default true
189
+ * disable lazy compilation for entries
190
+ */
191
+ entries?: boolean;
187
192
  };
188
193
  devServer: Omit<DevServerConfig, 'port' | 'type' | 'options'> & {
189
194
  port?: number;
@@ -87,18 +87,7 @@ function webpackConfigFactory(webpackMode, config, { logger } = {}) {
87
87
  level: 'verbose',
88
88
  }
89
89
  : undefined,
90
- experiments: isEnvDevelopment
91
- ? {
92
- lazyCompilation: config.lazyCompilation
93
- ? {
94
- backend: {
95
- client: require.resolve('./lazy-client.js'),
96
- listen: config.lazyCompilation,
97
- },
98
- }
99
- : undefined,
100
- }
101
- : undefined,
90
+ experiments: configureExperiments(helperOptions),
102
91
  snapshot: {
103
92
  managedPaths: config.watchOptions?.watchPackages ? [] : undefined,
104
93
  },
@@ -170,6 +159,36 @@ function configureWatchOptions({ config }) {
170
159
  delete watchOptions.watchPackages;
171
160
  return watchOptions;
172
161
  }
162
+ function configureExperiments({ config, isEnvProduction, }) {
163
+ if (isEnvProduction) {
164
+ return undefined;
165
+ }
166
+ let lazyCompilation;
167
+ let port;
168
+ let entries;
169
+ if (config.lazyCompilation) {
170
+ if (typeof config.lazyCompilation === 'object') {
171
+ port = config.lazyCompilation.port;
172
+ entries = config.lazyCompilation.entries;
173
+ }
174
+ lazyCompilation = {
175
+ backend: {
176
+ client: require.resolve('./lazy-client.js'),
177
+ ...(port
178
+ ? {
179
+ listen: {
180
+ port,
181
+ },
182
+ }
183
+ : {}),
184
+ },
185
+ entries,
186
+ };
187
+ }
188
+ return {
189
+ lazyCompilation,
190
+ };
191
+ }
173
192
  function configureResolve({ isEnvProduction, config, tsLinkedPackages, }) {
174
193
  let alias = config.alias || {};
175
194
  alias = Object.entries(alias).reduce((result, [key, value]) => {
@@ -8,6 +8,6 @@ export declare function configureWebpackConfigForStorybook(mode: Mode, userConfi
8
8
  rules: Webpack.RuleSetRule[];
9
9
  };
10
10
  resolve: Webpack.ResolveOptions;
11
- plugins: (((this: Webpack.Compiler, compiler: Webpack.Compiler) => void) | Webpack.WebpackPluginInstance)[];
11
+ plugins: (false | "" | 0 | ((this: Webpack.Compiler, compiler: Webpack.Compiler) => void) | Webpack.WebpackPluginInstance | null | undefined)[];
12
12
  }>;
13
13
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.4.3",
3
+ "version": "0.5.1",
4
4
  "description": "Develop and build your React client-server projects, powered by typescript and webpack",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -68,8 +68,8 @@
68
68
  "@babel/runtime": "^7.21.0",
69
69
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
70
70
  "@statoscope/webpack-plugin": "^5.26.2",
71
- "@svgr/core": "^7.0.0",
72
- "@svgr/webpack": "^7.0.0",
71
+ "@svgr/core": "^8.0.0",
72
+ "@svgr/webpack": "^8.0.1",
73
73
  "babel-loader": "^9.1.2",
74
74
  "babel-plugin-inline-react-svg": "^2.0.2",
75
75
  "babel-plugin-lodash": "^3.3.4",
@@ -81,9 +81,9 @@
81
81
  "common-tags": "^1.8.2",
82
82
  "cosmiconfig": "^8.1.3",
83
83
  "cosmiconfig-typescript-loader": "^4.3.0",
84
- "css-loader": "^6.7.3",
85
- "css-minimizer-webpack-plugin": "^4.2.2",
86
- "dotenv": "^16.0.3",
84
+ "css-loader": "^6.8.1",
85
+ "css-minimizer-webpack-plugin": "^5.0.0",
86
+ "dotenv": "^16.1.4",
87
87
  "execa": "^5.1.1",
88
88
  "fast-glob": "^3.2.12",
89
89
  "file-type": "^16.5.3",
@@ -92,62 +92,62 @@
92
92
  "get-port": "^5.1.1",
93
93
  "lodash": "^4.17.21",
94
94
  "mime-types": "^2.1.35",
95
- "mini-css-extract-plugin": "^2.7.5",
95
+ "mini-css-extract-plugin": "^2.7.6",
96
96
  "moment-timezone-data-webpack-plugin": "^1.5.1",
97
97
  "nodemon": "^2.0.22",
98
98
  "p-map": "^4.0.0",
99
99
  "p-queue": "^6.6.2",
100
100
  "pino-pretty": "^10.0.0",
101
101
  "postcss": "^8.4.23",
102
- "postcss-loader": "^7.2.4",
103
- "postcss-preset-env": "^8.3.2",
102
+ "postcss-loader": "^7.3.2",
103
+ "postcss-preset-env": "^8.4.2",
104
104
  "react": "^18.2.0",
105
105
  "react-dom": "^18.2.0",
106
106
  "react-refresh": "^0.14.0",
107
107
  "resolve-url-loader": "^5.0.0",
108
108
  "rimraf": "^5.0.0",
109
- "sass": "^1.61.0",
110
- "sass-loader": "^13.2.2",
109
+ "sass": "^1.62.1",
110
+ "sass-loader": "^13.3.1",
111
111
  "semver": "^7.5.0",
112
112
  "signal-exit": "^3.0.7",
113
113
  "source-map-loader": "^4.0.1",
114
114
  "strip-ansi": "^6.0.1",
115
- "style-loader": "^3.3.2",
115
+ "style-loader": "^3.3.3",
116
116
  "svgo": "^3.0.2",
117
117
  "ts-node": "10.9.1",
118
118
  "tslib": "^2.5.0",
119
- "typescript": "^5.0.4",
120
- "webpack": "^5.81.0",
119
+ "typescript": "^5.1.3",
120
+ "webpack": "^5.85.1",
121
121
  "webpack-assets-manifest": "^5.1.0",
122
- "webpack-bundle-analyzer": "^4.8.0",
123
- "webpack-dev-server": "^4.13.3",
122
+ "webpack-bundle-analyzer": "^4.9.0",
123
+ "webpack-dev-server": "^4.15.0",
124
124
  "webpack-manifest-plugin": "^5.0.0",
125
125
  "worker-loader": "^3.0.8",
126
126
  "yargs": "^17.7.2"
127
127
  },
128
128
  "devDependencies": {
129
- "@commitlint/cli": "^17.6.3",
130
- "@commitlint/config-conventional": "^17.6.3",
129
+ "@commitlint/cli": "^17.6.5",
130
+ "@commitlint/config-conventional": "^17.6.5",
131
131
  "@gravity-ui/eslint-config": "^1.0.2",
132
132
  "@gravity-ui/prettier-config": "^1.0.1",
133
133
  "@gravity-ui/tsconfig": "^1.0.0",
134
134
  "@types/circular-dependency-plugin": "^5.0.5",
135
135
  "@types/common-tags": "^1.8.1",
136
136
  "@types/fs-extra": "^11.0.1",
137
- "@types/jest": "^29.5.1",
138
- "@types/lodash": "^4.14.194",
137
+ "@types/jest": "^29.5.2",
138
+ "@types/lodash": "^4.14.195",
139
139
  "@types/mime-types": "^2.1.1",
140
140
  "@types/node": "^14.18.45",
141
141
  "@types/nodemon": "^1.19.2",
142
142
  "@types/sass": "^1.45.0",
143
- "@types/semver": "^7.3.13",
143
+ "@types/semver": "^7.5.0",
144
144
  "@types/signal-exit": "^3.0.1",
145
145
  "@types/terser-webpack-plugin": "^5.2.0",
146
146
  "@types/webpack-assets-manifest": "^5.1.0",
147
147
  "@types/webpack-bundle-analyzer": "^4.6.0",
148
148
  "@types/webpack-manifest-plugin": "^3.0.5",
149
149
  "@types/yargs": "17.0.11",
150
- "eslint": "^8.40.0",
150
+ "eslint": "^8.42.0",
151
151
  "husky": "^8.0.3",
152
152
  "jest": "^29.5.0",
153
153
  "monaco-editor-webpack-plugin": "^6.0.0",