@backstage/cli 0.33.2-next.0 → 0.34.0-next.2
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 +51 -0
- package/asset-types/asset-types.d.ts +0 -38
- package/config/nodeTransformHooks.mjs +12 -0
- package/dist/lib/version.cjs.js +20 -14
- package/dist/modules/build/commands/package/build/command.cjs.js +3 -3
- package/dist/modules/build/commands/package/start/startFrontend.cjs.js +4 -7
- package/dist/modules/build/commands/repo/build.cjs.js +2 -3
- package/dist/modules/build/lib/buildFrontend.cjs.js +7 -10
- package/dist/modules/build/lib/builder/config.cjs.js +0 -7
- package/dist/modules/build/lib/bundler/bundle.cjs.js +24 -29
- package/dist/modules/build/lib/bundler/config.cjs.js +40 -28
- package/dist/modules/build/lib/bundler/optimization.cjs.js +6 -5
- package/dist/modules/build/lib/bundler/packageDetection.cjs.js +4 -9
- package/dist/modules/build/lib/bundler/server.cjs.js +18 -22
- package/dist/modules/build/lib/bundler/transforms.cjs.js +7 -35
- package/dist/packages/cli/package.json.cjs.js +15 -19
- package/dist/packages/core-components/package.json.cjs.js +1 -1
- package/dist/packages/frontend-defaults/package.json.cjs.js +6 -0
- package/dist/packages/frontend-plugin-api/package.json.cjs.js +6 -0
- package/dist/packages/frontend-test-utils/package.json.cjs.js +6 -0
- package/package.json +46 -26
- package/templates/new-frontend-plugin/.eslintrc.js.hbs +1 -0
- package/templates/new-frontend-plugin/README.md.hbs +20 -0
- package/templates/new-frontend-plugin/dev/index.tsx +10 -0
- package/templates/new-frontend-plugin/package.json.hbs +49 -0
- package/templates/new-frontend-plugin/portable-template.yaml +5 -0
- package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +28 -0
- package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +37 -0
- package/templates/new-frontend-plugin/src/components/ExampleComponent/index.ts +1 -0
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +19 -0
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +308 -0
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/index.ts +1 -0
- package/templates/new-frontend-plugin/src/index.ts.hbs +1 -0
- package/templates/new-frontend-plugin/src/plugin.test.ts.hbs +7 -0
- package/templates/new-frontend-plugin/src/plugin.tsx.hbs +26 -0
- package/templates/new-frontend-plugin/src/routes.ts +3 -0
- package/templates/new-frontend-plugin/src/setupTests.ts +1 -0
- package/templates/new-frontend-plugin-module/.eslintrc.js.hbs +1 -0
- package/templates/new-frontend-plugin-module/README.md.hbs +5 -0
- package/templates/new-frontend-plugin-module/package.json.hbs +35 -0
- package/templates/new-frontend-plugin-module/portable-template.yaml +5 -0
- package/templates/new-frontend-plugin-module/src/index.ts.hbs +1 -0
- package/templates/new-frontend-plugin-module/src/module.tsx.hbs +8 -0
- package/templates/new-frontend-plugin-module/src/setupTests.ts +1 -0
- package/dist/lib/svgrTemplate.cjs.js +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @backstage/cli
|
|
2
2
|
|
|
3
|
+
## 0.34.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 923ceb2: **BREAKING**: The new app build based on [Rspack](https://rspack.dev/) is now the default, and the `EXPERIMENTAL_RSPACK` flag has been removed. To revert to the old behavior, set the `LEGACY_WEBPACK_BUILD` environment flag and install the following optional dependencies:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@module-federation/enhanced": "^0.9.0",
|
|
13
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
|
|
14
|
+
"esbuild-loader": "^4.0.0",
|
|
15
|
+
"eslint-webpack-plugin": "^4.2.0",
|
|
16
|
+
"fork-ts-checker-webpack-plugin": "^9.0.0",
|
|
17
|
+
"mini-css-extract-plugin": "^2.4.2",
|
|
18
|
+
"terser-webpack-plugin": "^5.1.3",
|
|
19
|
+
"webpack": "^5.96.0",
|
|
20
|
+
"webpack-dev-server": "^5.0.0"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
If you do encounter a blocking issue that forces you to use the old WebPack build, please [open an issue](https://github.com/backstage/backstage/issues) explaining the problem. The WebPack build will be removed in a future release.
|
|
26
|
+
|
|
27
|
+
- eda80c7: **BREAKING**: Removed support for `.icon.svg` imports, which have been deprecated since the 1.19 release.
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- 8b1bf6e: Deprecated new frontend system config setting `app.experimental.packages` to just `app.packages`. The old config will continue working for the time being, but may be removed in a future release.
|
|
32
|
+
- ead626f: The Node.js transform in `@backstage/cli/config/nodeTransformHooks.mjs` now supports the built-in type stripping in Node.js, which is enabled by default from v22.18.0.
|
|
33
|
+
|
|
34
|
+
## 0.34.0-next.1
|
|
35
|
+
|
|
36
|
+
### Minor Changes
|
|
37
|
+
|
|
38
|
+
- 38b4243: Added plugin and module templates for the new frontend system. These templates are not included by default, but can be included by adding `@backstage/cli/templates/new-frontend-plugin` and `@backstage/cli/templates/new-frontend-plugin-module` as [custom templates](https://backstage.io/docs/tooling/cli/templates#installing-custom-templates).
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies
|
|
43
|
+
- @backstage/catalog-model@1.7.5
|
|
44
|
+
- @backstage/cli-common@0.1.15
|
|
45
|
+
- @backstage/cli-node@0.2.13
|
|
46
|
+
- @backstage/config@1.3.3
|
|
47
|
+
- @backstage/config-loader@1.10.2
|
|
48
|
+
- @backstage/errors@1.2.7
|
|
49
|
+
- @backstage/eslint-plugin@0.1.11
|
|
50
|
+
- @backstage/integration@1.17.1
|
|
51
|
+
- @backstage/release-manifests@0.0.13
|
|
52
|
+
- @backstage/types@1.2.1
|
|
53
|
+
|
|
3
54
|
## 0.33.2-next.0
|
|
4
55
|
|
|
5
56
|
### Patch Changes
|
|
@@ -65,44 +65,6 @@ declare module '*.yaml' {
|
|
|
65
65
|
export default src;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated support for .icon.svg extensions are being removed, inline the SVG elements in a MUI SvgIcon instead.
|
|
70
|
-
* @example
|
|
71
|
-
* ```tsx
|
|
72
|
-
* import SvgIcon from '@material-ui/core/SvgIcon';
|
|
73
|
-
*
|
|
74
|
-
* const MyIcon = () => (
|
|
75
|
-
* <SvgIcon>
|
|
76
|
-
* <g>
|
|
77
|
-
* <path d="..." />
|
|
78
|
-
* </g>
|
|
79
|
-
* </SvgIcon>
|
|
80
|
-
* )
|
|
81
|
-
* ```
|
|
82
|
-
*/
|
|
83
|
-
declare module '*.icon.svg' {
|
|
84
|
-
import { ComponentType } from 'react';
|
|
85
|
-
import { SvgIconProps } from '@material-ui/core';
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* @deprecated support for .icon.svg extensions are being removed, inline the SVG elements in a MUI SvgIcon instead.
|
|
89
|
-
* @example
|
|
90
|
-
* ```tsx
|
|
91
|
-
* import SvgIcon from '@material-ui/core/SvgIcon';
|
|
92
|
-
*
|
|
93
|
-
* const MyIcon = () => (
|
|
94
|
-
* <SvgIcon>
|
|
95
|
-
* <g>
|
|
96
|
-
* <path d="..." />
|
|
97
|
-
* </g>
|
|
98
|
-
* </SvgIcon>
|
|
99
|
-
* )
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
const Icon: ComponentType<SvgIconProps>;
|
|
103
|
-
export default Icon;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
68
|
declare module '*.svg' {
|
|
107
69
|
const src: string;
|
|
108
70
|
export default src;
|
|
@@ -255,6 +255,18 @@ export async function load(url, context, nextLoad) {
|
|
|
255
255
|
return nextLoad(url, { ...context, format });
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
// If the Node.js version we're running supports TypeScript, i.e. type
|
|
259
|
+
// stripping, we hand over to the default loader. This is done for all cases
|
|
260
|
+
// except if we're loading a .ts file that's been resolved to CommonJS format.
|
|
261
|
+
// This is because these files aren't actually CommonJS in the Backstage build
|
|
262
|
+
// system, and need to be transformed to CommonJS.
|
|
263
|
+
if (
|
|
264
|
+
format === 'module-typescript' ||
|
|
265
|
+
(format === 'module-commonjs' && ext !== '.ts')
|
|
266
|
+
) {
|
|
267
|
+
return nextLoad(url, { ...context, format });
|
|
268
|
+
}
|
|
269
|
+
|
|
258
270
|
const transformed = await transformFile(fileURLToPath(url), {
|
|
259
271
|
sourceMaps: 'inline',
|
|
260
272
|
module: {
|
package/dist/lib/version.cjs.js
CHANGED
|
@@ -13,13 +13,16 @@ var _package$7 = require('../packages/core-components/package.json.cjs.js');
|
|
|
13
13
|
var _package$8 = require('../packages/core-plugin-api/package.json.cjs.js');
|
|
14
14
|
var _package$9 = require('../packages/dev-utils/package.json.cjs.js');
|
|
15
15
|
var _package$a = require('../packages/errors/package.json.cjs.js');
|
|
16
|
-
var _package$b = require('../packages/
|
|
17
|
-
var _package$
|
|
18
|
-
var _package$
|
|
19
|
-
var _package$
|
|
20
|
-
var _package$g = require('../plugins/
|
|
21
|
-
var _package$h = require('../plugins/
|
|
22
|
-
var _package$
|
|
16
|
+
var _package$b = require('../packages/frontend-defaults/package.json.cjs.js');
|
|
17
|
+
var _package$c = require('../packages/frontend-plugin-api/package.json.cjs.js');
|
|
18
|
+
var _package$d = require('../packages/frontend-test-utils/package.json.cjs.js');
|
|
19
|
+
var _package$e = require('../packages/test-utils/package.json.cjs.js');
|
|
20
|
+
var _package$g = require('../plugins/scaffolder-node/package.json.cjs.js');
|
|
21
|
+
var _package$h = require('../plugins/scaffolder-node-test-utils/package.json.cjs.js');
|
|
22
|
+
var _package$i = require('../plugins/auth-backend/package.json.cjs.js');
|
|
23
|
+
var _package$j = require('../plugins/auth-backend-module-guest-provider/package.json.cjs.js');
|
|
24
|
+
var _package$k = require('../plugins/catalog-node/package.json.cjs.js');
|
|
25
|
+
var _package$f = require('../packages/theme/package.json.cjs.js');
|
|
23
26
|
var _package = require('../packages/backend-defaults/package.json.cjs.js');
|
|
24
27
|
|
|
25
28
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -39,13 +42,16 @@ const packageVersions = {
|
|
|
39
42
|
"@backstage/core-plugin-api": _package$8.version,
|
|
40
43
|
"@backstage/dev-utils": _package$9.version,
|
|
41
44
|
"@backstage/errors": _package$a.version,
|
|
42
|
-
"@backstage/
|
|
43
|
-
"@backstage/
|
|
44
|
-
"@backstage/
|
|
45
|
-
"@backstage/
|
|
46
|
-
"@backstage/
|
|
47
|
-
"@backstage/plugin-
|
|
48
|
-
"@backstage/plugin-
|
|
45
|
+
"@backstage/frontend-defaults": _package$b.version,
|
|
46
|
+
"@backstage/frontend-plugin-api": _package$c.version,
|
|
47
|
+
"@backstage/frontend-test-utils": _package$d.version,
|
|
48
|
+
"@backstage/test-utils": _package$e.version,
|
|
49
|
+
"@backstage/theme": _package$f.version,
|
|
50
|
+
"@backstage/plugin-scaffolder-node": _package$g.version,
|
|
51
|
+
"@backstage/plugin-scaffolder-node-test-utils": _package$h.version,
|
|
52
|
+
"@backstage/plugin-auth-backend": _package$i.version,
|
|
53
|
+
"@backstage/plugin-auth-backend-module-guest-provider": _package$j.version,
|
|
54
|
+
"@backstage/plugin-catalog-node": _package$k.version
|
|
49
55
|
};
|
|
50
56
|
function findVersion() {
|
|
51
57
|
const pkgContent = fs__default.default.readFileSync(paths.paths.resolveOwn("package.json"), "utf8");
|
|
@@ -15,7 +15,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
15
|
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
16
16
|
|
|
17
17
|
async function command(opts) {
|
|
18
|
-
const
|
|
18
|
+
const webpack = process.env.LEGACY_WEBPACK_BUILD ? require("webpack") : void 0;
|
|
19
19
|
const role$1 = await role.findRoleFromCommand(opts);
|
|
20
20
|
if (role$1 === "frontend" || role$1 === "backend") {
|
|
21
21
|
const configPaths = opts.config.map((arg) => {
|
|
@@ -29,7 +29,7 @@ async function command(opts) {
|
|
|
29
29
|
targetDir: paths.paths.targetDir,
|
|
30
30
|
configPaths,
|
|
31
31
|
writeStats: Boolean(opts.stats),
|
|
32
|
-
|
|
32
|
+
webpack
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
return buildBackend.buildBackend({
|
|
@@ -50,7 +50,7 @@ async function command(opts) {
|
|
|
50
50
|
configPaths: [],
|
|
51
51
|
writeStats: Boolean(opts.stats),
|
|
52
52
|
isModuleFederationRemote: true,
|
|
53
|
-
|
|
53
|
+
webpack
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
const roleInfo = cliNode.PackageRoles.getRoleInfo(role$1);
|
|
@@ -3,20 +3,17 @@
|
|
|
3
3
|
var fs = require('fs-extra');
|
|
4
4
|
var path = require('path');
|
|
5
5
|
require('yn');
|
|
6
|
-
require('
|
|
6
|
+
require('@rspack/core');
|
|
7
7
|
require('react-dev-utils/FileSizeReporter');
|
|
8
8
|
require('react-dev-utils/formatWebpackMessages');
|
|
9
|
-
require('eslint-
|
|
10
|
-
require('
|
|
9
|
+
require('eslint-rspack-plugin');
|
|
10
|
+
require('ts-checker-rspack-plugin');
|
|
11
11
|
require('html-webpack-plugin');
|
|
12
|
-
require('@module-federation/enhanced/webpack');
|
|
13
12
|
require('react-dev-utils/ModuleScopePlugin');
|
|
14
|
-
require('@
|
|
13
|
+
require('@module-federation/enhanced/rspack');
|
|
15
14
|
var paths = require('../../../../../lib/paths.cjs.js');
|
|
16
|
-
require('../../../lib/bundler/optimization.cjs.js');
|
|
17
15
|
require('lodash/pickBy');
|
|
18
16
|
require('../../../../../lib/run.cjs.js');
|
|
19
|
-
require('mini-css-extract-plugin');
|
|
20
17
|
require('../../../../../lib/version.cjs.js');
|
|
21
18
|
var hasReactDomClient = require('../../../lib/bundler/hasReactDomClient.cjs.js');
|
|
22
19
|
require('@manypkg/get-packages');
|
|
@@ -16,8 +16,7 @@ var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
|
16
16
|
|
|
17
17
|
async function command(opts, cmd) {
|
|
18
18
|
let packages = await cliNode.PackageGraph.listTargetPackages();
|
|
19
|
-
const
|
|
20
|
-
const rspack = shouldUseRspack ? require("@rspack/core") : void 0;
|
|
19
|
+
const webpack = process.env.LEGACY_WEBPACK_BUILD ? require("webpack") : void 0;
|
|
21
20
|
if (opts.since) {
|
|
22
21
|
const graph = cliNode.PackageGraph.fromPackages(packages);
|
|
23
22
|
const changedPackages = await graph.listChangedPackages({
|
|
@@ -86,7 +85,7 @@ async function command(opts, cmd) {
|
|
|
86
85
|
targetDir: pkg.dir,
|
|
87
86
|
configPaths: buildOptions.config ?? [],
|
|
88
87
|
writeStats: Boolean(buildOptions.stats),
|
|
89
|
-
|
|
88
|
+
webpack
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
91
|
});
|
|
@@ -6,20 +6,17 @@ var bundle = require('./bundler/bundle.cjs.js');
|
|
|
6
6
|
var moduleFederation = require('./bundler/moduleFederation.cjs.js');
|
|
7
7
|
require('chalk');
|
|
8
8
|
require('react-dev-utils/openBrowser');
|
|
9
|
-
require('
|
|
10
|
-
require('
|
|
9
|
+
require('@rspack/core');
|
|
10
|
+
require('@rspack/dev-server');
|
|
11
11
|
require('../../../lib/paths.cjs.js');
|
|
12
12
|
var config = require('../../config/lib/config.cjs.js');
|
|
13
|
-
require('eslint-
|
|
14
|
-
require('
|
|
13
|
+
require('eslint-rspack-plugin');
|
|
14
|
+
require('ts-checker-rspack-plugin');
|
|
15
15
|
require('html-webpack-plugin');
|
|
16
|
-
require('@module-federation/enhanced/webpack');
|
|
17
16
|
require('react-dev-utils/ModuleScopePlugin');
|
|
18
|
-
require('@
|
|
19
|
-
require('./bundler/optimization.cjs.js');
|
|
17
|
+
require('@module-federation/enhanced/rspack');
|
|
20
18
|
require('lodash/pickBy');
|
|
21
19
|
require('../../../lib/run.cjs.js');
|
|
22
|
-
require('mini-css-extract-plugin');
|
|
23
20
|
require('../../../lib/version.cjs.js');
|
|
24
21
|
require('yn');
|
|
25
22
|
require('@manypkg/get-packages');
|
|
@@ -31,7 +28,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
31
28
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
32
29
|
|
|
33
30
|
async function buildFrontend(options) {
|
|
34
|
-
const { targetDir, writeStats, configPaths,
|
|
31
|
+
const { targetDir, writeStats, configPaths, webpack } = options;
|
|
35
32
|
const packageJson = await fs__default.default.readJson(
|
|
36
33
|
path.resolve(targetDir, "package.json")
|
|
37
34
|
);
|
|
@@ -49,7 +46,7 @@ async function buildFrontend(options) {
|
|
|
49
46
|
args: configPaths,
|
|
50
47
|
fromPackage: packageJson.name
|
|
51
48
|
}),
|
|
52
|
-
|
|
49
|
+
webpack
|
|
53
50
|
});
|
|
54
51
|
}
|
|
55
52
|
|
|
@@ -7,14 +7,12 @@ var commonjs = require('@rollup/plugin-commonjs');
|
|
|
7
7
|
var resolve = require('@rollup/plugin-node-resolve');
|
|
8
8
|
var postcss = require('rollup-plugin-postcss');
|
|
9
9
|
var esbuild = require('rollup-plugin-esbuild');
|
|
10
|
-
var svgr = require('@svgr/rollup');
|
|
11
10
|
var dts = require('rollup-plugin-dts');
|
|
12
11
|
var json = require('@rollup/plugin-json');
|
|
13
12
|
var yaml = require('@rollup/plugin-yaml');
|
|
14
13
|
var plugins = require('./plugins.cjs.js');
|
|
15
14
|
var types = require('./types.cjs.js');
|
|
16
15
|
var paths = require('../../../../lib/paths.cjs.js');
|
|
17
|
-
var svgrTemplate = require('../../../../lib/svgrTemplate.cjs.js');
|
|
18
16
|
var entryPoints = require('../../../../lib/entryPoints.cjs.js');
|
|
19
17
|
|
|
20
18
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -25,7 +23,6 @@ var commonjs__default = /*#__PURE__*/_interopDefaultCompat(commonjs);
|
|
|
25
23
|
var resolve__default = /*#__PURE__*/_interopDefaultCompat(resolve);
|
|
26
24
|
var postcss__default = /*#__PURE__*/_interopDefaultCompat(postcss);
|
|
27
25
|
var esbuild__default = /*#__PURE__*/_interopDefaultCompat(esbuild);
|
|
28
|
-
var svgr__default = /*#__PURE__*/_interopDefaultCompat(svgr);
|
|
29
26
|
var dts__default = /*#__PURE__*/_interopDefaultCompat(dts);
|
|
30
27
|
var json__default = /*#__PURE__*/_interopDefaultCompat(json);
|
|
31
28
|
var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
|
|
@@ -201,10 +198,6 @@ async function makeRollupConfigs(options) {
|
|
|
201
198
|
}),
|
|
202
199
|
json__default.default(),
|
|
203
200
|
yaml__default.default(),
|
|
204
|
-
svgr__default.default({
|
|
205
|
-
include: /\.icon\.svg$/,
|
|
206
|
-
template: svgrTemplate.svgrTemplate
|
|
207
|
-
}),
|
|
208
201
|
esbuild__default.default({
|
|
209
202
|
target: "ES2022",
|
|
210
203
|
minify: options.minify
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var yn = require('yn');
|
|
4
4
|
var fs = require('fs-extra');
|
|
5
5
|
var path = require('path');
|
|
6
|
-
var
|
|
6
|
+
var core = require('@rspack/core');
|
|
7
7
|
var FileSizeReporter = require('react-dev-utils/FileSizeReporter');
|
|
8
8
|
var formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
|
|
9
9
|
var config = require('./config.cjs.js');
|
|
@@ -15,7 +15,6 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
15
|
|
|
16
16
|
var yn__default = /*#__PURE__*/_interopDefaultCompat(yn);
|
|
17
17
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
18
|
-
var webpack__default = /*#__PURE__*/_interopDefaultCompat(webpack);
|
|
19
18
|
var formatWebpackMessages__default = /*#__PURE__*/_interopDefaultCompat(formatWebpackMessages);
|
|
20
19
|
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
21
20
|
|
|
@@ -26,7 +25,7 @@ function applyContextToError(error, moduleName) {
|
|
|
26
25
|
${error}`;
|
|
27
26
|
}
|
|
28
27
|
async function buildBundle(options) {
|
|
29
|
-
const { statsJsonEnabled, schema: configSchema,
|
|
28
|
+
const { statsJsonEnabled, schema: configSchema, webpack } = options;
|
|
30
29
|
const paths$1 = paths.resolveBundlingPaths(options);
|
|
31
30
|
const publicPaths = await paths.resolveOptionalBundlingPaths({
|
|
32
31
|
targetDir: options.targetDir,
|
|
@@ -91,12 +90,10 @@ async function buildBundle(options) {
|
|
|
91
90
|
{ spaces: 2 }
|
|
92
91
|
);
|
|
93
92
|
}
|
|
94
|
-
if (
|
|
95
|
-
console.log(
|
|
96
|
-
chalk__default.default.yellow(`\u26A0\uFE0F WARNING: Using experimental RSPack bundler.`)
|
|
97
|
-
);
|
|
93
|
+
if (webpack) {
|
|
94
|
+
console.log(chalk__default.default.yellow(`\u26A0\uFE0F WARNING: Using legacy WebPack bundler`));
|
|
98
95
|
}
|
|
99
|
-
const { stats } = await build(configs, isCi,
|
|
96
|
+
const { stats } = await build(configs, isCi, webpack);
|
|
100
97
|
if (!stats) {
|
|
101
98
|
throw new Error("No stats returned");
|
|
102
99
|
}
|
|
@@ -124,29 +121,27 @@ async function buildBundle(options) {
|
|
|
124
121
|
);
|
|
125
122
|
}
|
|
126
123
|
}
|
|
127
|
-
async function build(configs, isCi,
|
|
128
|
-
const bundler =
|
|
129
|
-
const stats = await new Promise(
|
|
130
|
-
(
|
|
131
|
-
|
|
132
|
-
if (err) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
throw new Error(errors2[0]);
|
|
141
|
-
} else {
|
|
142
|
-
reject(err);
|
|
143
|
-
}
|
|
124
|
+
async function build(configs, isCi, webpack) {
|
|
125
|
+
const bundler = webpack ?? core.rspack;
|
|
126
|
+
const stats = await new Promise((resolve, reject) => {
|
|
127
|
+
bundler(configs, (err, buildStats) => {
|
|
128
|
+
if (err) {
|
|
129
|
+
if (err.message) {
|
|
130
|
+
const { errors: errors2 } = formatWebpackMessages__default.default({
|
|
131
|
+
errors: [err.message],
|
|
132
|
+
warnings: new Array(),
|
|
133
|
+
_showErrors: true,
|
|
134
|
+
_showWarnings: true
|
|
135
|
+
});
|
|
136
|
+
throw new Error(errors2[0]);
|
|
144
137
|
} else {
|
|
145
|
-
|
|
138
|
+
reject(err);
|
|
146
139
|
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
140
|
+
} else {
|
|
141
|
+
resolve(buildStats);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
});
|
|
150
145
|
if (!stats) {
|
|
151
146
|
throw new Error("Failed to compile: No stats provided");
|
|
152
147
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var path = require('path');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var core = require('@rspack/core');
|
|
5
|
+
var ESLintRspackPlugin = require('eslint-rspack-plugin');
|
|
6
|
+
var tsCheckerRspackPlugin = require('ts-checker-rspack-plugin');
|
|
7
7
|
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
8
|
-
var webpack = require('@module-federation/enhanced/webpack');
|
|
9
8
|
var ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
|
10
|
-
var
|
|
9
|
+
var rspack = require('@module-federation/enhanced/rspack');
|
|
11
10
|
var paths = require('../../../../lib/paths.cjs.js');
|
|
12
11
|
var fs = require('fs-extra');
|
|
13
12
|
var optimization = require('./optimization.cjs.js');
|
|
@@ -22,12 +21,9 @@ var ConfigInjectingHtmlWebpackPlugin = require('./ConfigInjectingHtmlWebpackPlug
|
|
|
22
21
|
|
|
23
22
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
24
23
|
|
|
25
|
-
var
|
|
26
|
-
var ESLintPlugin__default = /*#__PURE__*/_interopDefaultCompat(ESLintPlugin);
|
|
27
|
-
var ForkTsCheckerWebpackPlugin__default = /*#__PURE__*/_interopDefaultCompat(ForkTsCheckerWebpackPlugin);
|
|
24
|
+
var ESLintRspackPlugin__default = /*#__PURE__*/_interopDefaultCompat(ESLintRspackPlugin);
|
|
28
25
|
var HtmlWebpackPlugin__default = /*#__PURE__*/_interopDefaultCompat(HtmlWebpackPlugin);
|
|
29
26
|
var ModuleScopePlugin__default = /*#__PURE__*/_interopDefaultCompat(ModuleScopePlugin);
|
|
30
|
-
var ReactRefreshPlugin__default = /*#__PURE__*/_interopDefaultCompat(ReactRefreshPlugin);
|
|
31
27
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
32
28
|
var pickBy__default = /*#__PURE__*/_interopDefaultCompat(pickBy);
|
|
33
29
|
var yn__default = /*#__PURE__*/_interopDefaultCompat(yn);
|
|
@@ -83,7 +79,7 @@ async function createConfig(paths, options) {
|
|
|
83
79
|
frontendConfig,
|
|
84
80
|
moduleFederation,
|
|
85
81
|
publicSubPath = "",
|
|
86
|
-
|
|
82
|
+
webpack
|
|
87
83
|
} = options;
|
|
88
84
|
const { plugins, loaders } = transforms.transforms(options);
|
|
89
85
|
const validBaseUrl = resolveBaseUrl(frontendConfig, moduleFederation);
|
|
@@ -103,25 +99,30 @@ async function createConfig(paths, options) {
|
|
|
103
99
|
sockPort: port
|
|
104
100
|
}
|
|
105
101
|
};
|
|
106
|
-
if (
|
|
102
|
+
if (webpack) {
|
|
103
|
+
const ReactRefreshPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
|
|
104
|
+
plugins.push(new ReactRefreshPlugin(refreshOptions));
|
|
105
|
+
} else {
|
|
107
106
|
const RspackReactRefreshPlugin = require("@rspack/plugin-react-refresh");
|
|
108
107
|
plugins.push(new RspackReactRefreshPlugin(refreshOptions));
|
|
109
|
-
} else {
|
|
110
|
-
plugins.push(new ReactRefreshPlugin__default.default(refreshOptions));
|
|
111
108
|
}
|
|
112
109
|
}
|
|
113
110
|
if (checksEnabled) {
|
|
111
|
+
const TsCheckerPlugin = webpack ? require("fork-ts-checker-webpack-plugin") : tsCheckerRspackPlugin.TsCheckerRspackPlugin;
|
|
112
|
+
const ESLintPlugin = webpack ? require("eslint-webpack-plugin") : ESLintRspackPlugin__default.default;
|
|
114
113
|
plugins.push(
|
|
115
|
-
new
|
|
116
|
-
typescript: { configFile: paths.targetTsConfig, memoryLimit:
|
|
114
|
+
new TsCheckerPlugin({
|
|
115
|
+
typescript: { configFile: paths.targetTsConfig, memoryLimit: 8192 }
|
|
117
116
|
}),
|
|
118
|
-
new
|
|
117
|
+
new ESLintPlugin({
|
|
118
|
+
cache: false,
|
|
119
|
+
// Cache seems broken
|
|
119
120
|
context: paths.targetPath,
|
|
120
121
|
files: ["**/*.(ts|tsx|mts|cts|js|jsx|mjs|cjs)"]
|
|
121
122
|
})
|
|
122
123
|
);
|
|
123
124
|
}
|
|
124
|
-
const bundler =
|
|
125
|
+
const bundler = webpack ? webpack : core.rspack;
|
|
125
126
|
plugins.push(
|
|
126
127
|
new bundler.ProvidePlugin({
|
|
127
128
|
process: require.resolve("process/browser"),
|
|
@@ -139,15 +140,15 @@ async function createConfig(paths, options) {
|
|
|
139
140
|
config: frontendConfig
|
|
140
141
|
}
|
|
141
142
|
};
|
|
142
|
-
if (
|
|
143
|
+
if (webpack) {
|
|
144
|
+
plugins.push(new HtmlWebpackPlugin__default.default(templateOptions));
|
|
145
|
+
} else {
|
|
143
146
|
plugins.push(
|
|
144
147
|
new ConfigInjectingHtmlWebpackPlugin.ConfigInjectingHtmlWebpackPlugin(
|
|
145
148
|
templateOptions,
|
|
146
149
|
options.getFrontendAppConfigs
|
|
147
150
|
)
|
|
148
151
|
);
|
|
149
|
-
} else {
|
|
150
|
-
plugins.push(new HtmlWebpackPlugin__default.default(templateOptions));
|
|
151
152
|
}
|
|
152
153
|
plugins.push(
|
|
153
154
|
new HtmlWebpackPlugin__default.default({
|
|
@@ -165,7 +166,7 @@ async function createConfig(paths, options) {
|
|
|
165
166
|
}
|
|
166
167
|
if (options.moduleFederation) {
|
|
167
168
|
const isRemote = options.moduleFederation?.mode === "remote";
|
|
168
|
-
const AdaptedModuleFederationPlugin =
|
|
169
|
+
const AdaptedModuleFederationPlugin = webpack ? require("@module-federation/enhanced/webpack").ModuleFederationPlugin : rspack.ModuleFederationPlugin;
|
|
169
170
|
const exposes = options.moduleFederation?.exposes ? Object.fromEntries(
|
|
170
171
|
Object.entries(options.moduleFederation?.exposes).map(([k, v]) => [
|
|
171
172
|
k,
|
|
@@ -233,15 +234,26 @@ async function createConfig(paths, options) {
|
|
|
233
234
|
}
|
|
234
235
|
const buildInfo = await readBuildInfo();
|
|
235
236
|
plugins.push(
|
|
236
|
-
new
|
|
237
|
+
webpack ? new webpack.DefinePlugin({
|
|
237
238
|
"process.env.BUILD_INFO": JSON.stringify(buildInfo),
|
|
238
|
-
"process.env.APP_CONFIG":
|
|
239
|
+
"process.env.APP_CONFIG": webpack.DefinePlugin.runtimeValue(
|
|
239
240
|
() => JSON.stringify(options.getFrontendAppConfigs()),
|
|
240
241
|
true
|
|
241
242
|
),
|
|
242
243
|
// This allows for conditional imports of react-dom/client, since there's no way
|
|
243
244
|
// to check for presence of it in source code without module resolution errors.
|
|
244
|
-
"process.env.HAS_REACT_DOM_CLIENT": JSON.stringify(
|
|
245
|
+
"process.env.HAS_REACT_DOM_CLIENT": JSON.stringify(
|
|
246
|
+
hasReactDomClient.hasReactDomClient()
|
|
247
|
+
)
|
|
248
|
+
}) : new bundler.DefinePlugin({
|
|
249
|
+
"process.env.BUILD_INFO": JSON.stringify(buildInfo),
|
|
250
|
+
"process.env.APP_CONFIG": JSON.stringify([]),
|
|
251
|
+
// Inject via index.html instead
|
|
252
|
+
// This allows for conditional imports of react-dom/client, since there's no way
|
|
253
|
+
// to check for presence of it in source code without module resolution errors.
|
|
254
|
+
"process.env.HAS_REACT_DOM_CLIENT": JSON.stringify(
|
|
255
|
+
hasReactDomClient.hasReactDomClient()
|
|
256
|
+
)
|
|
245
257
|
})
|
|
246
258
|
);
|
|
247
259
|
if (options.linkedWorkspace) {
|
|
@@ -252,7 +264,7 @@ async function createConfig(paths, options) {
|
|
|
252
264
|
)
|
|
253
265
|
);
|
|
254
266
|
}
|
|
255
|
-
const reactRefreshFiles =
|
|
267
|
+
const reactRefreshFiles = webpack ? [
|
|
256
268
|
require.resolve(
|
|
257
269
|
"@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js"
|
|
258
270
|
),
|
|
@@ -260,7 +272,7 @@ async function createConfig(paths, options) {
|
|
|
260
272
|
"@pmmmwh/react-refresh-webpack-plugin/overlay/index.js"
|
|
261
273
|
),
|
|
262
274
|
require.resolve("react-refresh")
|
|
263
|
-
];
|
|
275
|
+
] : [];
|
|
264
276
|
const mode = isDev ? "development" : "production";
|
|
265
277
|
const optimization$1 = optimization.optimization(options);
|
|
266
278
|
return {
|
|
@@ -304,7 +316,7 @@ async function createConfig(paths, options) {
|
|
|
304
316
|
util: require.resolve("util/")
|
|
305
317
|
},
|
|
306
318
|
// FIXME: see also https://github.com/web-infra-dev/rspack/issues/3408
|
|
307
|
-
|
|
319
|
+
...webpack && {
|
|
308
320
|
plugins: [
|
|
309
321
|
new ModuleScopePlugin__default.default(
|
|
310
322
|
[paths.targetSrc, paths.targetDev],
|
|
@@ -331,7 +343,7 @@ async function createConfig(paths, options) {
|
|
|
331
343
|
},
|
|
332
344
|
experiments: {
|
|
333
345
|
lazyCompilation: yn__default.default(process.env.EXPERIMENTAL_LAZY_COMPILATION),
|
|
334
|
-
|
|
346
|
+
...!webpack && {
|
|
335
347
|
// We're still using `style-loader` for custom `insert` option
|
|
336
348
|
css: false
|
|
337
349
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var core = require('@rspack/core');
|
|
4
|
+
|
|
4
5
|
const optimization = (options) => {
|
|
5
|
-
const { isDev,
|
|
6
|
-
const MinifyPlugin =
|
|
6
|
+
const { isDev, webpack } = options;
|
|
7
|
+
const MinifyPlugin = webpack ? require("esbuild-loader").EsbuildPlugin : core.SwcJsMinimizerRspackPlugin;
|
|
7
8
|
return {
|
|
8
9
|
minimize: !isDev,
|
|
9
10
|
minimizer: [
|
|
@@ -18,7 +19,7 @@ const optimization = (options) => {
|
|
|
18
19
|
format: void 0,
|
|
19
20
|
include: "remoteEntry.js"
|
|
20
21
|
}),
|
|
21
|
-
|
|
22
|
+
webpack ? void 0 : new core.LightningCssMinimizerRspackPlugin()
|
|
22
23
|
],
|
|
23
24
|
runtimeChunk: "single",
|
|
24
25
|
splitChunks: {
|
|
@@ -44,7 +45,7 @@ const optimization = (options) => {
|
|
|
44
45
|
priority: 10,
|
|
45
46
|
minSize: 1e5,
|
|
46
47
|
minChunks: 1,
|
|
47
|
-
|
|
48
|
+
...webpack && {
|
|
48
49
|
maxAsyncRequests: Infinity,
|
|
49
50
|
maxInitialRequests: Infinity
|
|
50
51
|
}
|
|
@@ -15,27 +15,22 @@ var PQueue__default = /*#__PURE__*/_interopDefaultCompat(PQueue);
|
|
|
15
15
|
|
|
16
16
|
const DETECTED_MODULES_MODULE_NAME = "__backstage-autodetected-plugins__";
|
|
17
17
|
function readPackageDetectionConfig(config$1) {
|
|
18
|
-
const packages = config$1.getOptional("app.experimental.packages");
|
|
18
|
+
const packages = config$1.getOptional("app.packages") ?? config$1.getOptional("app.experimental.packages");
|
|
19
19
|
if (packages === void 0 || packages === null) {
|
|
20
20
|
return void 0;
|
|
21
21
|
}
|
|
22
22
|
if (typeof packages === "string") {
|
|
23
23
|
if (packages !== "all") {
|
|
24
24
|
throw new Error(
|
|
25
|
-
`Invalid app.
|
|
25
|
+
`Invalid app.packages mode, got '${packages}', expected 'all'`
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
return {};
|
|
29
29
|
}
|
|
30
30
|
if (typeof packages !== "object" || Array.isArray(packages)) {
|
|
31
|
-
throw new Error(
|
|
32
|
-
"Invalid config at 'app.experimental.packages', expected object"
|
|
33
|
-
);
|
|
31
|
+
throw new Error("Invalid config at 'app.packages', expected object");
|
|
34
32
|
}
|
|
35
|
-
const packagesConfig = new config.ConfigReader(
|
|
36
|
-
packages,
|
|
37
|
-
"app.experimental.packages"
|
|
38
|
-
);
|
|
33
|
+
const packagesConfig = new config.ConfigReader(packages, "app.packages");
|
|
39
34
|
return {
|
|
40
35
|
include: packagesConfig.getOptionalStringArray("include"),
|
|
41
36
|
exclude: packagesConfig.getOptionalStringArray("exclude")
|