@backstage/cli 0.28.0-next.1 → 0.28.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.
Files changed (131) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/config/jest.js +9 -1
  3. package/config/jestCacheResultProcessor.cjs +23 -0
  4. package/config/jestSwcTransform.js +4 -1
  5. package/dist/commands/build/buildBackend.cjs.js +65 -0
  6. package/dist/commands/build/buildFrontend.cjs.js +56 -0
  7. package/dist/commands/build/command.cjs.js +72 -0
  8. package/dist/commands/build/index.cjs.js +8 -0
  9. package/dist/commands/buildWorkspace.cjs.js +24 -0
  10. package/dist/commands/clean/clean.cjs.js +19 -0
  11. package/dist/{cjs/docs-BGyA6jwW.cjs.js → commands/config/docs.cjs.js} +4 -12
  12. package/dist/{cjs/print-Dd6aChXU.cjs.js → commands/config/print.cjs.js} +4 -12
  13. package/dist/{cjs/schema-D93FRhBL.cjs.js → commands/config/schema.cjs.js} +4 -12
  14. package/dist/commands/config/validate.cjs.js +19 -0
  15. package/dist/{cjs/index-j193pV_Y.cjs.js → commands/create-github-app/GithubCreateAppServer.cjs.js} +2 -110
  16. package/dist/commands/create-github-app/index.cjs.js +117 -0
  17. package/dist/commands/index.cjs.js +231 -0
  18. package/dist/{cjs/info-DuAv1Tsx.cjs.js → commands/info.cjs.js} +13 -17
  19. package/dist/{cjs/lint-BwiDJkjE.cjs.js → commands/lint.cjs.js} +10 -10
  20. package/dist/commands/migrate/packageExports.cjs.js +17 -0
  21. package/dist/{cjs/packageLintConfigs-DeUGBP17.cjs.js → commands/migrate/packageLintConfigs.cjs.js} +2 -10
  22. package/dist/{cjs/packageRole-Iuv9NRii.cjs.js → commands/migrate/packageRole.cjs.js} +5 -8
  23. package/dist/{cjs/packageScripts-DX6dilK6.cjs.js → commands/migrate/packageScripts.cjs.js} +1 -1
  24. package/dist/{cjs/reactRouterDeps-CR-hjviw.cjs.js → commands/migrate/reactRouterDeps.cjs.js} +1 -1
  25. package/dist/commands/new/new.cjs.js +101 -0
  26. package/dist/commands/pack.cjs.js +29 -0
  27. package/dist/commands/repo/build.cjs.js +113 -0
  28. package/dist/{cjs/clean-a6Q4k9Vm.cjs.js → commands/repo/clean.cjs.js} +5 -10
  29. package/dist/{cjs/fix-COitqgqm.cjs.js → commands/repo/fix.cjs.js} +8 -13
  30. package/dist/commands/repo/lint.cjs.js +193 -0
  31. package/dist/{cjs/list-deprecations-CtUaQgaP.cjs.js → commands/repo/list-deprecations.cjs.js} +7 -12
  32. package/dist/commands/repo/optionsParser.cjs.js +37 -0
  33. package/dist/commands/repo/test.cjs.js +274 -0
  34. package/dist/commands/start/command.cjs.js +48 -0
  35. package/dist/commands/start/index.cjs.js +8 -0
  36. package/dist/commands/start/startBackend.cjs.js +112 -0
  37. package/dist/commands/start/startFrontend.cjs.js +47 -0
  38. package/dist/{cjs/test-COxIko8N.cjs.js → commands/test.cjs.js} +6 -12
  39. package/dist/{cjs/bump-BHEh5ytx.cjs.js → commands/versions/bump.cjs.js} +21 -190
  40. package/dist/commands/versions/migrate.cjs.js +112 -0
  41. package/dist/index.cjs.js +29 -7
  42. package/dist/lib/builder/config.cjs.js +199 -0
  43. package/dist/lib/builder/packager.cjs.js +131 -0
  44. package/dist/lib/builder/plugins.cjs.js +71 -0
  45. package/dist/lib/builder/types.cjs.js +11 -0
  46. package/dist/lib/bundler/LinkedPackageResolvePlugin.cjs.js +47 -0
  47. package/dist/lib/bundler/backend.cjs.js +36 -0
  48. package/dist/{cjs/buildBackend-CkhZWCz1.cjs.js → lib/bundler/bundle.cjs.js} +26 -113
  49. package/dist/lib/bundler/config.cjs.js +469 -0
  50. package/dist/lib/bundler/hasReactDomClient.cjs.js +13 -0
  51. package/dist/lib/bundler/moduleFederation.cjs.js +28 -0
  52. package/dist/lib/bundler/optimization.cjs.js +63 -0
  53. package/dist/lib/bundler/packageDetection.cjs.js +117 -0
  54. package/dist/lib/bundler/paths.cjs.js +60 -0
  55. package/dist/lib/bundler/server.cjs.js +246 -0
  56. package/dist/lib/bundler/transforms.cjs.js +171 -0
  57. package/dist/lib/codeowners/codeowners.cjs.js +92 -0
  58. package/dist/{cjs/config-DBpmZirN.cjs.js → lib/config.cjs.js} +6 -6
  59. package/dist/{cjs/entryPoints-coip0t-x.cjs.js → lib/entryPoints.cjs.js} +1 -1
  60. package/dist/lib/errors.cjs.js +45 -0
  61. package/dist/lib/experimental/IpcServer.cjs.js +60 -0
  62. package/dist/lib/experimental/ServerDataStore.cjs.js +36 -0
  63. package/dist/lib/experimental/startBackendExperimental.cjs.js +128 -0
  64. package/dist/lib/new/FactoryRegistry.cjs.js +96 -0
  65. package/dist/lib/new/factories/backendModule.cjs.js +82 -0
  66. package/dist/lib/new/factories/backendPlugin.cjs.js +78 -0
  67. package/dist/lib/new/factories/common/prompts.cjs.js +57 -0
  68. package/dist/lib/new/factories/common/tasks.cjs.js +66 -0
  69. package/dist/lib/new/factories/common/util.cjs.js +16 -0
  70. package/dist/lib/new/factories/frontendPlugin.cjs.js +107 -0
  71. package/dist/lib/new/factories/index.cjs.js +24 -0
  72. package/dist/lib/new/factories/nodeLibraryPackage.cjs.js +57 -0
  73. package/dist/lib/new/factories/pluginCommon.cjs.js +58 -0
  74. package/dist/lib/new/factories/pluginNode.cjs.js +58 -0
  75. package/dist/lib/new/factories/pluginWeb.cjs.js +58 -0
  76. package/dist/lib/new/factories/scaffolderModule.cjs.js +90 -0
  77. package/dist/lib/new/factories/webLibraryPackage.cjs.js +57 -0
  78. package/dist/lib/new/types.cjs.js +8 -0
  79. package/dist/lib/packager/createDistWorkspace.cjs.js +219 -0
  80. package/dist/{cjs/productionPack-BxoMbBkH.cjs.js → lib/packager/productionPack.cjs.js} +8 -96
  81. package/dist/{cjs/parallel-BszNaKyc.cjs.js → lib/parallel.cjs.js} +2 -1
  82. package/dist/lib/paths.cjs.js +8 -0
  83. package/dist/{cjs/publishing-DQtsKTbc.cjs.js → lib/publishing.cjs.js} +1 -1
  84. package/dist/{cjs/role-BjiBExhi.cjs.js → lib/role.cjs.js} +3 -3
  85. package/dist/{cjs/run-CpZGNJQr.cjs.js → lib/run.cjs.js} +6 -5
  86. package/dist/{cjs/svgrTemplate-BTjBQ3by.cjs.js → lib/svgrTemplate.cjs.js} +1 -1
  87. package/dist/lib/tasks.cjs.js +188 -0
  88. package/dist/lib/typeDistProject.cjs.js +94 -0
  89. package/dist/lib/urls.cjs.js +13 -0
  90. package/dist/lib/version.cjs.js +86 -0
  91. package/dist/{cjs/yarn-6FNAgNBK.cjs.js → lib/versioning/Lockfile.cjs.js} +1 -31
  92. package/dist/lib/versioning/packages.cjs.js +75 -0
  93. package/dist/lib/yarn.cjs.js +34 -0
  94. package/dist/packages/backend-defaults/package.json.cjs.js +6 -0
  95. package/dist/packages/backend-plugin-api/package.json.cjs.js +6 -0
  96. package/dist/packages/backend-test-utils/package.json.cjs.js +6 -0
  97. package/dist/packages/cli/package.json.cjs.js +159 -0
  98. package/dist/packages/config/package.json.cjs.js +6 -0
  99. package/dist/packages/core-app-api/package.json.cjs.js +6 -0
  100. package/dist/packages/core-components/package.json.cjs.js +6 -0
  101. package/dist/packages/core-plugin-api/package.json.cjs.js +6 -0
  102. package/dist/packages/dev-utils/package.json.cjs.js +6 -0
  103. package/dist/packages/test-utils/package.json.cjs.js +6 -0
  104. package/dist/packages/theme/package.json.cjs.js +6 -0
  105. package/dist/plugins/auth-backend/package.json.cjs.js +6 -0
  106. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +6 -0
  107. package/dist/plugins/scaffolder-node/package.json.cjs.js +6 -0
  108. package/package.json +13 -11
  109. package/dist/cjs/build-CQdcGuBr.cjs.js +0 -194
  110. package/dist/cjs/buildWorkspace-CZPp9oRm.cjs.js +0 -53
  111. package/dist/cjs/clean-W6nxsHeK.cjs.js +0 -22
  112. package/dist/cjs/createDistWorkspace-DdHPGSMS.cjs.js +0 -576
  113. package/dist/cjs/index-BXv4Xa2e.cjs.js +0 -625
  114. package/dist/cjs/index-CGuAP7nv.cjs.js +0 -131
  115. package/dist/cjs/index-b1ouG3q6.cjs.js +0 -518
  116. package/dist/cjs/lint-Dsiocf9K.cjs.js +0 -91
  117. package/dist/cjs/moduleFederation-DmStnvEg.cjs.js +0 -910
  118. package/dist/cjs/new-CEnFhTT-.cjs.js +0 -1043
  119. package/dist/cjs/pack-XLRcGJqH.cjs.js +0 -34
  120. package/dist/cjs/packageExports-BJBwdvUH.cjs.js +0 -27
  121. package/dist/cjs/test-JcLI2pPM.cjs.js +0 -126
  122. package/dist/cjs/validate-CELljsEX.cjs.js +0 -28
  123. /package/templates/default-backend-module/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  124. /package/templates/default-backend-plugin/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  125. /package/templates/default-common-plugin-package/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  126. /package/templates/default-node-plugin-package/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  127. /package/templates/default-plugin/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  128. /package/templates/default-react-plugin-package/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  129. /package/templates/node-library-package/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  130. /package/templates/scaffolder-module/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  131. /package/templates/web-library-package/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs-extra');
4
+ var path = require('path');
5
+ var paths = require('../paths.cjs.js');
6
+
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
+
9
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
10
+
11
+ function resolveBundlingPaths(options) {
12
+ const { entry, targetDir = paths.paths.targetDir } = options;
13
+ const resolveTargetModule = (pathString) => {
14
+ for (const ext of ["mjs", "js", "ts", "tsx", "jsx"]) {
15
+ const filePath = path.resolve(targetDir, `${pathString}.${ext}`);
16
+ if (fs__default.default.pathExistsSync(filePath)) {
17
+ return filePath;
18
+ }
19
+ }
20
+ return path.resolve(targetDir, `${pathString}.js`);
21
+ };
22
+ let targetPublic = void 0;
23
+ let targetHtml = path.resolve(targetDir, "public/index.html");
24
+ if (fs__default.default.pathExistsSync(targetHtml)) {
25
+ targetPublic = path.resolve(targetDir, "public");
26
+ } else {
27
+ targetHtml = path.resolve(targetDir, `${entry}.html`);
28
+ if (!fs__default.default.pathExistsSync(targetHtml)) {
29
+ targetHtml = paths.paths.resolveOwn("templates/serve_index.html");
30
+ }
31
+ }
32
+ const targetRunFile = path.resolve(targetDir, "src/run.ts");
33
+ const runFileExists = fs__default.default.pathExistsSync(targetRunFile);
34
+ return {
35
+ targetHtml,
36
+ targetPublic,
37
+ targetPath: path.resolve(targetDir, "."),
38
+ targetRunFile: runFileExists ? targetRunFile : void 0,
39
+ targetDist: path.resolve(targetDir, options.dist ?? "dist"),
40
+ targetAssets: path.resolve(targetDir, "assets"),
41
+ targetSrc: path.resolve(targetDir, "src"),
42
+ targetDev: path.resolve(targetDir, "dev"),
43
+ targetEntry: resolveTargetModule(entry),
44
+ targetTsConfig: paths.paths.resolveTargetRoot("tsconfig.json"),
45
+ targetPackageJson: path.resolve(targetDir, "package.json"),
46
+ rootNodeModules: paths.paths.resolveTargetRoot("node_modules"),
47
+ root: paths.paths.targetRoot
48
+ };
49
+ }
50
+ async function resolveOptionalBundlingPaths(options) {
51
+ const resolvedPaths = resolveBundlingPaths(options);
52
+ if (await fs__default.default.pathExists(resolvedPaths.targetEntry)) {
53
+ return resolvedPaths;
54
+ }
55
+ return void 0;
56
+ }
57
+
58
+ exports.resolveBundlingPaths = resolveBundlingPaths;
59
+ exports.resolveOptionalBundlingPaths = resolveOptionalBundlingPaths;
60
+ //# sourceMappingURL=paths.cjs.js.map
@@ -0,0 +1,246 @@
1
+ 'use strict';
2
+
3
+ var chalk = require('chalk');
4
+ var fs = require('fs-extra');
5
+ var openBrowser = require('react-dev-utils/openBrowser');
6
+ var webpack = require('webpack');
7
+ var WebpackDevServer = require('webpack-dev-server');
8
+ var paths$1 = require('../paths.cjs.js');
9
+ var config = require('../config.cjs.js');
10
+ var config$1 = require('./config.cjs.js');
11
+ var packageDetection = require('./packageDetection.cjs.js');
12
+ var paths = require('./paths.cjs.js');
13
+ var hasReactDomClient = require('./hasReactDomClient.cjs.js');
14
+
15
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
16
+
17
+ var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
18
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
19
+ var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
20
+ var webpack__default = /*#__PURE__*/_interopDefaultCompat(webpack);
21
+ var WebpackDevServer__default = /*#__PURE__*/_interopDefaultCompat(WebpackDevServer);
22
+
23
+ async function serveBundle(options) {
24
+ const paths$2 = paths.resolveBundlingPaths(options);
25
+ const targetPkg = await fs__default.default.readJson(paths$2.targetPackageJson);
26
+ if (options.verifyVersions) {
27
+ if (targetPkg.dependencies?.["react-router"]?.includes("beta") || targetPkg.dependencies?.["react-router-dom"]?.includes("beta")) {
28
+ console.warn(
29
+ chalk__default.default.yellow(`
30
+ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be removed in a future release.
31
+ Please migrate to use React Router v6 stable.
32
+ See https://backstage.io/docs/tutorials/react-router-stable-migration
33
+ `)
34
+ );
35
+ }
36
+ }
37
+ checkReactVersion();
38
+ const { name } = await fs__default.default.readJson(paths$1.paths.resolveTarget("package.json"));
39
+ let webpackServer = void 0;
40
+ let viteServer = void 0;
41
+ let latestFrontendAppConfigs = [];
42
+ const cliConfig = await config.loadCliConfig({
43
+ args: options.configPaths,
44
+ fromPackage: name,
45
+ withFilteredKeys: true,
46
+ watch(appConfigs) {
47
+ latestFrontendAppConfigs = appConfigs;
48
+ webpackServer?.invalidate();
49
+ viteServer?.restart();
50
+ }
51
+ });
52
+ latestFrontendAppConfigs = cliConfig.frontendAppConfigs;
53
+ const appBaseUrl = cliConfig.frontendConfig.getOptionalString("app.baseUrl");
54
+ const backendBaseUrl = cliConfig.frontendConfig.getOptionalString("backend.baseUrl");
55
+ if (appBaseUrl && appBaseUrl === backendBaseUrl) {
56
+ console.log(
57
+ chalk__default.default.yellow(
58
+ `\u26A0\uFE0F Conflict between app baseUrl and backend baseUrl:
59
+
60
+ app.baseUrl: ${appBaseUrl}
61
+ backend.baseUrl: ${backendBaseUrl}
62
+
63
+ Must have unique hostname and/or ports.
64
+
65
+ This can be resolved by changing app.baseUrl and backend.baseUrl to point to their respective local development ports.
66
+ `
67
+ )
68
+ );
69
+ }
70
+ const { frontendConfig, fullConfig } = cliConfig;
71
+ const url = config$1.resolveBaseUrl(frontendConfig, options.moduleFederation);
72
+ const { host, port } = config$1.resolveEndpoint(
73
+ frontendConfig,
74
+ options.moduleFederation
75
+ );
76
+ const detectedModulesEntryPoint = await packageDetection.createDetectedModulesEntryPoint({
77
+ config: fullConfig,
78
+ targetPath: paths$2.targetPath,
79
+ watch() {
80
+ webpackServer?.invalidate();
81
+ viteServer?.restart();
82
+ }
83
+ });
84
+ const commonConfigOptions = {
85
+ ...options,
86
+ checksEnabled: options.checksEnabled,
87
+ isDev: true,
88
+ baseUrl: url,
89
+ frontendConfig,
90
+ getFrontendAppConfigs: () => {
91
+ return latestFrontendAppConfigs;
92
+ }
93
+ };
94
+ const config$2 = await config$1.createConfig(paths$2, {
95
+ ...commonConfigOptions,
96
+ additionalEntryPoints: detectedModulesEntryPoint,
97
+ moduleFederation: options.moduleFederation
98
+ });
99
+ if (process.env.EXPERIMENTAL_VITE) {
100
+ const vite = require("vite");
101
+ const { default: viteReact } = require("@vitejs/plugin-react");
102
+ const {
103
+ nodePolyfills: viteNodePolyfills
104
+ } = require("vite-plugin-node-polyfills");
105
+ const { createHtmlPlugin: viteHtml } = require("vite-plugin-html");
106
+ viteServer = await vite.createServer({
107
+ define: {
108
+ global: "window",
109
+ "process.argv": JSON.stringify(process.argv),
110
+ "process.env.APP_CONFIG": JSON.stringify(cliConfig.frontendAppConfigs),
111
+ // This allows for conditional imports of react-dom/client, since there's no way
112
+ // to check for presence of it in source code without module resolution errors.
113
+ "process.env.HAS_REACT_DOM_CLIENT": JSON.stringify(hasReactDomClient.hasReactDomClient())
114
+ },
115
+ plugins: [
116
+ viteReact(),
117
+ viteNodePolyfills(),
118
+ viteHtml({
119
+ entry: paths$2.targetEntry,
120
+ // todo(blam): we should look at contributing to thPe plugin here
121
+ // to support absolute paths, but works in the interim at least.
122
+ template: "public/index.html",
123
+ inject: {
124
+ data: {
125
+ config: frontendConfig,
126
+ publicPath: config$2.output?.publicPath
127
+ }
128
+ }
129
+ })
130
+ ],
131
+ server: {
132
+ host,
133
+ port
134
+ },
135
+ publicDir: paths$2.targetPublic,
136
+ root: paths$2.targetPath
137
+ });
138
+ } else {
139
+ const publicPaths = await paths.resolveOptionalBundlingPaths({
140
+ entry: "src/index-public-experimental",
141
+ dist: "dist/public"
142
+ });
143
+ if (publicPaths) {
144
+ console.log(
145
+ chalk__default.default.yellow(
146
+ `\u26A0\uFE0F WARNING: The app /public entry point is an experimental feature that may receive immediate breaking changes.`
147
+ )
148
+ );
149
+ }
150
+ const compiler = publicPaths ? webpack__default.default([config$2, await config$1.createConfig(publicPaths, commonConfigOptions)]) : webpack__default.default(config$2);
151
+ webpackServer = new WebpackDevServer__default.default(
152
+ {
153
+ hot: !process.env.CI,
154
+ devMiddleware: {
155
+ publicPath: config$2.output?.publicPath,
156
+ stats: "errors-warnings"
157
+ },
158
+ static: paths$2.targetPublic ? {
159
+ publicPath: config$2.output?.publicPath,
160
+ directory: paths$2.targetPublic
161
+ } : void 0,
162
+ historyApiFallback: options.moduleFederation?.mode === "remote" ? false : {
163
+ // Paths with dots should still use the history fallback.
164
+ // See https://github.com/facebookincubator/create-react-app/issues/387.
165
+ disableDotRule: true,
166
+ // The index needs to be rewritten relative to the new public path, including subroutes.
167
+ index: `${config$2.output?.publicPath}index.html`
168
+ },
169
+ server: url.protocol === "https:" ? {
170
+ type: "https",
171
+ options: {
172
+ cert: fullConfig.getString("app.https.certificate.cert"),
173
+ key: fullConfig.getString("app.https.certificate.key")
174
+ }
175
+ } : {},
176
+ host,
177
+ port,
178
+ proxy: targetPkg.proxy,
179
+ // When the dev server is behind a proxy, the host and public hostname differ
180
+ allowedHosts: [url.hostname],
181
+ client: {
182
+ webSocketURL: { hostname: host, port }
183
+ },
184
+ headers: {
185
+ "Access-Control-Allow-Origin": "*",
186
+ "Access-Control-Allow-Methods": "GET, OPTIONS",
187
+ "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
188
+ }
189
+ },
190
+ compiler
191
+ );
192
+ }
193
+ await viteServer?.listen();
194
+ await new Promise(async (resolve, reject) => {
195
+ if (webpackServer) {
196
+ webpackServer.startCallback((err) => {
197
+ if (err) {
198
+ reject(err);
199
+ return;
200
+ }
201
+ resolve();
202
+ });
203
+ } else {
204
+ resolve();
205
+ }
206
+ });
207
+ if (!options.skipOpenBrowser) {
208
+ openBrowser__default.default(url.href);
209
+ }
210
+ const waitForExit = async () => {
211
+ for (const signal of ["SIGINT", "SIGTERM"]) {
212
+ process.on(signal, () => {
213
+ webpackServer?.stop();
214
+ viteServer?.close();
215
+ process.exit();
216
+ });
217
+ }
218
+ return new Promise(() => {
219
+ });
220
+ };
221
+ return waitForExit;
222
+ }
223
+ function checkReactVersion() {
224
+ try {
225
+ const reactPkgPath = require.resolve("react/package.json", {
226
+ paths: [paths$1.paths.targetRoot]
227
+ });
228
+ const reactPkg = require(reactPkgPath);
229
+ if (reactPkg.version.startsWith("16.")) {
230
+ console.log(
231
+ chalk__default.default.yellow(
232
+ `
233
+ \u26A0\uFE0F \u26A0\uFE0F
234
+ \u26A0\uFE0F You are using React version 16, which is deprecated for use in Backstage. \u26A0\uFE0F
235
+ \u26A0\uFE0F Please upgrade to React 17 by updating your packages/app dependencies. \u26A0\uFE0F
236
+ \u26A0\uFE0F \u26A0\uFE0F
237
+ `
238
+ )
239
+ );
240
+ }
241
+ } catch {
242
+ }
243
+ }
244
+
245
+ exports.serveBundle = serveBundle;
246
+ //# sourceMappingURL=server.cjs.js.map
@@ -0,0 +1,171 @@
1
+ 'use strict';
2
+
3
+ var MiniCssExtractPlugin = require('mini-css-extract-plugin');
4
+ var svgrTemplate = require('../svgrTemplate.cjs.js');
5
+
6
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
+
8
+ var MiniCssExtractPlugin__default = /*#__PURE__*/_interopDefaultCompat(MiniCssExtractPlugin);
9
+
10
+ const transforms = (options) => {
11
+ const { isDev, isBackend } = options;
12
+ function insertBeforeJssStyles(element) {
13
+ const head = document.head;
14
+ const firstJssNode = head.querySelector("style[data-jss]");
15
+ if (!firstJssNode) {
16
+ head.appendChild(element);
17
+ } else {
18
+ head.insertBefore(element, firstJssNode);
19
+ }
20
+ }
21
+ const loaders = [
22
+ {
23
+ test: /\.(tsx?)$/,
24
+ exclude: /node_modules/,
25
+ use: [
26
+ {
27
+ loader: require.resolve("swc-loader"),
28
+ options: {
29
+ jsc: {
30
+ target: "es2022",
31
+ externalHelpers: !isBackend,
32
+ parser: {
33
+ syntax: "typescript",
34
+ tsx: !isBackend,
35
+ dynamicImport: true
36
+ },
37
+ transform: {
38
+ react: isBackend ? void 0 : {
39
+ runtime: "automatic",
40
+ refresh: isDev
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ test: /\.(jsx?|mjs|cjs)$/,
50
+ exclude: /node_modules/,
51
+ use: [
52
+ {
53
+ loader: require.resolve("swc-loader"),
54
+ options: {
55
+ jsc: {
56
+ target: "es2022",
57
+ externalHelpers: !isBackend,
58
+ parser: {
59
+ syntax: "ecmascript",
60
+ jsx: !isBackend,
61
+ dynamicImport: true
62
+ },
63
+ transform: {
64
+ react: isBackend ? void 0 : {
65
+ runtime: "automatic",
66
+ refresh: isDev
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ test: /\.(js|mjs|cjs)$/,
76
+ resolve: {
77
+ fullySpecified: false
78
+ }
79
+ },
80
+ {
81
+ test: [/\.icon\.svg$/],
82
+ use: [
83
+ {
84
+ loader: require.resolve("swc-loader"),
85
+ options: {
86
+ jsc: {
87
+ target: "es2022",
88
+ externalHelpers: !isBackend,
89
+ parser: {
90
+ syntax: "ecmascript",
91
+ jsx: !isBackend,
92
+ dynamicImport: true
93
+ }
94
+ }
95
+ }
96
+ },
97
+ {
98
+ loader: require.resolve("@svgr/webpack"),
99
+ options: { babel: false, template: svgrTemplate.svgrTemplate }
100
+ }
101
+ ]
102
+ },
103
+ {
104
+ test: [
105
+ /\.bmp$/,
106
+ /\.gif$/,
107
+ /\.jpe?g$/,
108
+ /\.png$/,
109
+ /\.frag$/,
110
+ /\.vert$/,
111
+ { and: [/\.svg$/, { not: [/\.icon\.svg$/] }] },
112
+ /\.xml$/,
113
+ /\.ico$/
114
+ ],
115
+ type: "asset/resource",
116
+ generator: {
117
+ filename: "static/[name].[hash:8].[ext]"
118
+ }
119
+ },
120
+ {
121
+ test: /\.(eot|woff|woff2|ttf)$/i,
122
+ type: "asset/resource",
123
+ generator: {
124
+ filename: "static/[name].[hash][ext][query]"
125
+ }
126
+ },
127
+ {
128
+ test: /\.ya?ml$/,
129
+ use: require.resolve("yml-loader")
130
+ },
131
+ {
132
+ include: /\.(md)$/,
133
+ type: "asset/resource",
134
+ generator: {
135
+ filename: "static/[name].[hash][ext][query]"
136
+ }
137
+ },
138
+ {
139
+ test: /\.css$/i,
140
+ use: [
141
+ isDev ? {
142
+ loader: require.resolve("style-loader"),
143
+ options: {
144
+ insert: insertBeforeJssStyles
145
+ }
146
+ } : MiniCssExtractPlugin__default.default.loader,
147
+ {
148
+ loader: require.resolve("css-loader"),
149
+ options: {
150
+ sourceMap: true
151
+ }
152
+ }
153
+ ]
154
+ }
155
+ ];
156
+ const plugins = new Array();
157
+ if (!isDev) {
158
+ plugins.push(
159
+ new MiniCssExtractPlugin__default.default({
160
+ filename: "static/[name].[contenthash:8].css",
161
+ chunkFilename: "static/[name].[id].[contenthash:8].css",
162
+ insert: insertBeforeJssStyles
163
+ // Only applies to async chunks
164
+ })
165
+ );
166
+ }
167
+ return { loaders, plugins };
168
+ };
169
+
170
+ exports.transforms = transforms;
171
+ //# sourceMappingURL=transforms.cjs.js.map
@@ -0,0 +1,92 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs-extra');
4
+ var path = require('path');
5
+ var paths = require('../paths.cjs.js');
6
+
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
+
9
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
10
+ var path__default = /*#__PURE__*/_interopDefaultCompat(path);
11
+
12
+ const TEAM_ID_RE = /^@[-\w]+\/[-\w]+$/;
13
+ const USER_ID_RE = /^@[-\w]+$/;
14
+ const EMAIL_RE = /^[^@]+@[-.\w]+\.[-\w]+$/i;
15
+ const DEFAULT_OWNER = "@backstage/maintainers";
16
+ async function getCodeownersFilePath(rootDir) {
17
+ const possiblePaths = [
18
+ path__default.default.join(rootDir, ".github", "CODEOWNERS"),
19
+ path__default.default.join(rootDir, ".gitlab", "CODEOWNERS"),
20
+ path__default.default.join(rootDir, "docs", "CODEOWNERS"),
21
+ path__default.default.join(rootDir, "CODEOWNERS")
22
+ ];
23
+ for (const p of possiblePaths) {
24
+ if (await fs__default.default.pathExists(p)) {
25
+ return p;
26
+ }
27
+ }
28
+ return void 0;
29
+ }
30
+ function isValidSingleOwnerId(id) {
31
+ if (!id || typeof id !== "string") {
32
+ return false;
33
+ }
34
+ return TEAM_ID_RE.test(id) || USER_ID_RE.test(id) || EMAIL_RE.test(id);
35
+ }
36
+ function parseOwnerIds(spaceSeparatedOwnerIds) {
37
+ if (!spaceSeparatedOwnerIds || typeof spaceSeparatedOwnerIds !== "string") {
38
+ return void 0;
39
+ }
40
+ const ids = spaceSeparatedOwnerIds.split(" ").filter(Boolean);
41
+ if (!ids.every(isValidSingleOwnerId)) {
42
+ return void 0;
43
+ }
44
+ return ids;
45
+ }
46
+ async function addCodeownersEntry(ownedPath, ownerStr, codeownersFilePath) {
47
+ const ownerIds = parseOwnerIds(ownerStr);
48
+ if (!ownerIds || ownerIds.length === 0) {
49
+ return false;
50
+ }
51
+ let filePath = codeownersFilePath;
52
+ if (!filePath) {
53
+ filePath = await getCodeownersFilePath(paths.paths.targetRoot);
54
+ if (!filePath) {
55
+ return false;
56
+ }
57
+ }
58
+ const allLines = (await fs__default.default.readFile(filePath, "utf8")).split("\n");
59
+ const commentLines = [];
60
+ for (const line of allLines) {
61
+ if (line[0] !== "#") {
62
+ break;
63
+ }
64
+ commentLines.push(line);
65
+ }
66
+ const oldDeclarationEntries = allLines.filter((line) => line[0] !== "#").map((line) => line.split(/\s+/).filter(Boolean)).filter((tokens) => tokens.length >= 2).map((tokens) => ({
67
+ ownedPath: tokens[0],
68
+ ownerIds: tokens.slice(1)
69
+ }));
70
+ const newDeclarationEntries = oldDeclarationEntries.filter((entry) => entry.ownedPath !== "*").concat([{ ownedPath, ownerIds }]).sort((l1, l2) => l1.ownedPath.localeCompare(l2.ownedPath));
71
+ newDeclarationEntries.unshift({
72
+ ownedPath: "*",
73
+ ownerIds: [DEFAULT_OWNER]
74
+ });
75
+ const longestOwnedPath = newDeclarationEntries.reduce(
76
+ (length, entry) => Math.max(length, entry.ownedPath.length),
77
+ 0
78
+ );
79
+ const newDeclarationLines = newDeclarationEntries.map((entry) => {
80
+ const entryPath = entry.ownedPath + " ".repeat(longestOwnedPath - entry.ownedPath.length);
81
+ return [entryPath, ...entry.ownerIds].join(" ");
82
+ });
83
+ const newLines = [...commentLines, "", ...newDeclarationLines, ""];
84
+ await fs__default.default.writeFile(filePath, newLines.join("\n"), "utf8");
85
+ return true;
86
+ }
87
+
88
+ exports.addCodeownersEntry = addCodeownersEntry;
89
+ exports.getCodeownersFilePath = getCodeownersFilePath;
90
+ exports.isValidSingleOwnerId = isValidSingleOwnerId;
91
+ exports.parseOwnerIds = parseOwnerIds;
92
+ //# sourceMappingURL=codeowners.cjs.js.map
@@ -2,12 +2,12 @@
2
2
 
3
3
  var configLoader = require('@backstage/config-loader');
4
4
  var config = require('@backstage/config');
5
- var index = require('./index-b1ouG3q6.cjs.js');
5
+ var paths = require('./paths.cjs.js');
6
6
  var getPackages = require('@manypkg/get-packages');
7
7
  var cliNode = require('@backstage/cli-node');
8
8
 
9
9
  async function loadCliConfig(options) {
10
- const { packages } = await getPackages.getPackages(index.paths.targetDir);
10
+ const { packages } = await getPackages.getPackages(paths.paths.targetDir);
11
11
  let localPackageNames;
12
12
  if (options.fromPackage) {
13
13
  if (packages.length) {
@@ -29,15 +29,15 @@ async function loadCliConfig(options) {
29
29
  const schema = await configLoader.loadConfigSchema({
30
30
  dependencies: localPackageNames,
31
31
  // Include the package.json in the project root if it exists
32
- packagePaths: [index.paths.resolveTargetRoot("package.json")],
32
+ packagePaths: [paths.paths.resolveTargetRoot("package.json")],
33
33
  noUndeclaredProperties: options.strict
34
34
  });
35
35
  const source = configLoader.ConfigSources.default({
36
36
  allowMissingDefaultConfig: true,
37
37
  substitutionFunc: options.mockEnv ? async (name) => process.env[name] || "x" : void 0,
38
38
  watch: Boolean(options.watch),
39
- rootDir: index.paths.targetRoot,
40
- argv: options.args.flatMap((t) => ["--config", index.paths.resolveTarget(t)])
39
+ rootDir: paths.paths.targetRoot,
40
+ argv: options.args.flatMap((t) => ["--config", paths.paths.resolveTarget(t)])
41
41
  });
42
42
  const appConfigs = await new Promise((resolve, reject) => {
43
43
  async function loadConfigReaderLoop() {
@@ -105,4 +105,4 @@ async function loadCliConfig(options) {
105
105
  }
106
106
 
107
107
  exports.loadCliConfig = loadCliConfig;
108
- //# sourceMappingURL=config-DBpmZirN.cjs.js.map
108
+ //# sourceMappingURL=config.cjs.js.map
@@ -44,4 +44,4 @@ function readEntryPoints(pkg) {
44
44
  }
45
45
 
46
46
  exports.readEntryPoints = readEntryPoints;
47
- //# sourceMappingURL=entryPoints-coip0t-x.cjs.js.map
47
+ //# sourceMappingURL=entryPoints.cjs.js.map
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ var chalk = require('chalk');
4
+
5
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
6
+
7
+ var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
8
+
9
+ class CustomError extends Error {
10
+ get name() {
11
+ return this.constructor.name;
12
+ }
13
+ }
14
+ class ExitCodeError extends CustomError {
15
+ code;
16
+ constructor(code, command) {
17
+ super(
18
+ command ? `Command '${command}' exited with code ${code}` : `Child exited with code ${code}`
19
+ );
20
+ this.code = code;
21
+ }
22
+ }
23
+ function exitWithError(error) {
24
+ if (error instanceof ExitCodeError) {
25
+ process.stderr.write(`
26
+ ${chalk__default.default.red(error.message)}
27
+
28
+ `);
29
+ process.exit(error.code);
30
+ } else {
31
+ process.stderr.write(`
32
+ ${chalk__default.default.red(`${error}`)}
33
+
34
+ `);
35
+ process.exit(1);
36
+ }
37
+ }
38
+ class NotFoundError extends CustomError {
39
+ }
40
+
41
+ exports.CustomError = CustomError;
42
+ exports.ExitCodeError = ExitCodeError;
43
+ exports.NotFoundError = NotFoundError;
44
+ exports.exitWithError = exitWithError;
45
+ //# sourceMappingURL=errors.cjs.js.map