@backstage/cli 0.29.5-next.1 → 0.30.0-next.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/config/jest.js +98 -62
  3. package/config/jestCachingModuleLoader.js +14 -0
  4. package/config/jestSwcTransform.js +6 -0
  5. package/config/nodeTransform.cjs +10 -1
  6. package/config/nodeTransformHooks.mjs +282 -0
  7. package/config/tsconfig.json +1 -0
  8. package/dist/commands/index.cjs.js +24 -34
  9. package/dist/commands/versions/bump.cjs.js +10 -9
  10. package/dist/lib/builder/config.cjs.js +60 -7
  11. package/dist/lib/builder/packager.cjs.js +1 -1
  12. package/dist/lib/bundler/server.cjs.js +56 -140
  13. package/dist/lib/lazy.cjs.js +4 -2
  14. package/dist/modules/config/index.cjs.js +4 -4
  15. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  16. package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
  17. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  18. package/dist/packages/catalog-client/package.json.cjs.js +1 -1
  19. package/dist/packages/cli/package.json.cjs.js +3 -6
  20. package/dist/packages/config/package.json.cjs.js +1 -1
  21. package/dist/packages/core-app-api/package.json.cjs.js +1 -1
  22. package/dist/packages/core-components/package.json.cjs.js +1 -1
  23. package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
  24. package/dist/packages/dev-utils/package.json.cjs.js +1 -1
  25. package/dist/packages/errors/package.json.cjs.js +1 -1
  26. package/dist/packages/test-utils/package.json.cjs.js +1 -1
  27. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  28. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
  29. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  30. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  31. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  32. package/package.json +31 -49
@@ -17,7 +17,7 @@ function registerRepoCommand(program) {
17
17
  ).option(
18
18
  "--minify",
19
19
  "Minify the generated code. Does not apply to app package (app is minified by default)."
20
- ).action(lazy.lazy(() => Promise.resolve().then(function () { return require('./repo/build.cjs.js'); }).then((m) => m.command)));
20
+ ).action(lazy.lazy(() => import('./repo/build.cjs.js'), "command"));
21
21
  command.command("lint").description("Lint all packages in the project").option(
22
22
  "--format <format>",
23
23
  "Lint report output format",
@@ -34,18 +34,16 @@ function registerRepoCommand(program) {
34
34
  ).option(
35
35
  "--successCacheDir <path>",
36
36
  "Set the success cache location, (default: node_modules/.cache/backstage-cli)"
37
- ).option("--fix", "Attempt to automatically fix violations").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./repo/lint.cjs.js'); }).then((m) => m.command)));
37
+ ).option("--fix", "Attempt to automatically fix violations").action(lazy.lazy(() => import('./repo/lint.cjs.js'), "command"));
38
38
  command.command("fix").description("Automatically fix packages in the project").option(
39
39
  "--publish",
40
40
  "Enable additional fixes that only apply when publishing packages"
41
41
  ).option(
42
42
  "--check",
43
43
  "Fail if any packages would have been changed by the command"
44
- ).action(lazy.lazy(() => Promise.resolve().then(function () { return require('./repo/fix.cjs.js'); }).then((m) => m.command)));
45
- command.command("clean").description("Delete cache and output directories").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./repo/clean.cjs.js'); }).then((m) => m.command)));
46
- command.command("list-deprecations").description("List deprecations").option("--json", "Output as JSON").action(
47
- lazy.lazy(() => Promise.resolve().then(function () { return require('./repo/list-deprecations.cjs.js'); }).then((m) => m.command))
48
- );
44
+ ).action(lazy.lazy(() => import('./repo/fix.cjs.js'), "command"));
45
+ command.command("clean").description("Delete cache and output directories").action(lazy.lazy(() => import('./repo/clean.cjs.js'), "command"));
46
+ command.command("list-deprecations").description("List deprecations").option("--json", "Output as JSON").action(lazy.lazy(() => import('./repo/list-deprecations.cjs.js'), "command"));
49
47
  command.command("test").allowUnknownOption(true).option(
50
48
  "--since <ref>",
51
49
  "Only test packages that changed since the specified ref"
@@ -58,14 +56,14 @@ function registerRepoCommand(program) {
58
56
  ).option(
59
57
  "--jest-help",
60
58
  "Show help for Jest CLI options, which are passed through"
61
- ).description("Run tests, forwarding args to Jest, defaulting to watch mode").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./repo/test.cjs.js'); }).then((m) => m.command)));
59
+ ).description("Run tests, forwarding args to Jest, defaulting to watch mode").action(lazy.lazy(() => import('./repo/test.cjs.js'), "command"));
62
60
  }
63
61
  function registerScriptCommand(program) {
64
62
  const command = program.command("package [command]").description("Lifecycle scripts for individual packages");
65
63
  command.command("start").description("Start a package for local development").option(...index.configOption).option("--role <name>", "Run the command with an explicit package role").option("--check", "Enable type checking and linting if available").option("--inspect [host]", "Enable debugger in Node.js environments").option(
66
64
  "--inspect-brk [host]",
67
65
  "Enable debugger in Node.js environments, breaking before code starts"
68
- ).option("--require <path>", "Add a --require argument to the node process").option("--link <path>", "Link an external workspace for module resolution").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./start/index.cjs.js'); }).then((m) => m.command)));
66
+ ).option("--require <path>", "Add a --require argument to the node process").option("--link <path>", "Link an external workspace for module resolution").action(lazy.lazy(() => import('./start/index.cjs.js'), "command"));
69
67
  command.command("build").description("Build a package for production deployment or publishing").option("--role <name>", "Run the command with an explicit package role").option(
70
68
  "--minify",
71
69
  "Minify the generated code. Does not apply to app package (app is minified by default)."
@@ -80,7 +78,7 @@ function registerScriptCommand(program) {
80
78
  "Config files to load instead of app-config.yaml. Applies to app packages only.",
81
79
  (opt, opts) => opts ? [...opts, opt] : [opt],
82
80
  Array()
83
- ).action(lazy.lazy(() => Promise.resolve().then(function () { return require('./build/index.cjs.js'); }).then((m) => m.command)));
81
+ ).action(lazy.lazy(() => import('./build/index.cjs.js'), "command"));
84
82
  command.command("lint [directories...]").option(
85
83
  "--format <format>",
86
84
  "Lint report output format",
@@ -91,31 +89,23 @@ function registerScriptCommand(program) {
91
89
  ).option("--fix", "Attempt to automatically fix violations").option(
92
90
  "--max-warnings <number>",
93
91
  "Fail if more than this number of warnings. -1 allows warnings. (default: 0)"
94
- ).description("Lint a package").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./lint.cjs.js'); }).then((m) => m.default)));
95
- command.command("test").allowUnknownOption(true).helpOption(", --backstage-cli-help").description("Run tests, forwarding args to Jest, defaulting to watch mode").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./test.cjs.js'); }).then((m) => m.default)));
96
- command.command("clean").description("Delete cache directories").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./clean/clean.cjs.js'); }).then((m) => m.default)));
97
- command.command("prepack").description("Prepares a package for packaging before publishing").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./pack.cjs.js'); }).then((m) => m.pre)));
98
- command.command("postpack").description("Restores the changes made by the prepack command").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./pack.cjs.js'); }).then((m) => m.post)));
92
+ ).description("Lint a package").action(lazy.lazy(() => import('./lint.cjs.js'), "default"));
93
+ command.command("test").allowUnknownOption(true).helpOption(", --backstage-cli-help").description("Run tests, forwarding args to Jest, defaulting to watch mode").action(lazy.lazy(() => import('./test.cjs.js'), "default"));
94
+ command.command("clean").description("Delete cache directories").action(lazy.lazy(() => import('./clean/clean.cjs.js'), "default"));
95
+ command.command("prepack").description("Prepares a package for packaging before publishing").action(lazy.lazy(() => import('./pack.cjs.js'), "pre"));
96
+ command.command("postpack").description("Restores the changes made by the prepack command").action(lazy.lazy(() => import('./pack.cjs.js'), "post"));
99
97
  }
100
98
  function registerMigrateCommand(program) {
101
99
  const command = program.command("migrate [command]").description("Migration utilities");
102
- command.command("package-roles").description(`Add package role field to packages that don't have it`).action(lazy.lazy(() => Promise.resolve().then(function () { return require('./migrate/packageRole.cjs.js'); }).then((m) => m.default)));
103
- command.command("package-scripts").description("Set package scripts according to each package role").action(
104
- lazy.lazy(() => Promise.resolve().then(function () { return require('./migrate/packageScripts.cjs.js'); }).then((m) => m.command))
105
- );
106
- command.command("package-exports").description("Synchronize package subpath export definitions").action(
107
- lazy.lazy(() => Promise.resolve().then(function () { return require('./migrate/packageExports.cjs.js'); }).then((m) => m.command))
108
- );
100
+ command.command("package-roles").description(`Add package role field to packages that don't have it`).action(lazy.lazy(() => import('./migrate/packageRole.cjs.js'), "default"));
101
+ command.command("package-scripts").description("Set package scripts according to each package role").action(lazy.lazy(() => import('./migrate/packageScripts.cjs.js'), "command"));
102
+ command.command("package-exports").description("Synchronize package subpath export definitions").action(lazy.lazy(() => import('./migrate/packageExports.cjs.js'), "command"));
109
103
  command.command("package-lint-configs").description(
110
104
  "Migrates all packages to use @backstage/cli/config/eslint-factory"
111
- ).action(
112
- lazy.lazy(() => Promise.resolve().then(function () { return require('./migrate/packageLintConfigs.cjs.js'); }).then((m) => m.command))
113
- );
105
+ ).action(lazy.lazy(() => import('./migrate/packageLintConfigs.cjs.js'), "command"));
114
106
  command.command("react-router-deps").description(
115
107
  "Migrates the react-router dependencies for all packages to be peer dependencies"
116
- ).action(
117
- lazy.lazy(() => Promise.resolve().then(function () { return require('./migrate/reactRouterDeps.cjs.js'); }).then((m) => m.command))
118
- );
108
+ ).action(lazy.lazy(() => import('./migrate/reactRouterDeps.cjs.js'), "command"));
119
109
  }
120
110
  function registerCommands(program) {
121
111
  program.command("new").storeOptionsAsProperties(false).description(
@@ -137,7 +127,7 @@ function registerCommands(program) {
137
127
  ).option(
138
128
  "--license <license>",
139
129
  "The license to use for any new packages (default: Apache-2.0)"
140
- ).option("--no-private", "Do not mark new packages as private").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./new/new.cjs.js'); }).then((m) => m.default)));
130
+ ).option("--no-private", "Do not mark new packages as private").action(lazy.lazy(() => import('./new/new.cjs.js'), "default"));
141
131
  index.registerCommands(program);
142
132
  registerRepoCommand(program);
143
133
  registerScriptCommand(program);
@@ -149,7 +139,7 @@ function registerCommands(program) {
149
139
  "--release <version|next|main>",
150
140
  "Bump to a specific Backstage release line or version",
151
141
  "main"
152
- ).option("--skip-install", "Skips yarn install step").option("--skip-migrate", "Skips migration of any moved packages").description("Bump Backstage packages to the latest versions").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./versions/bump.cjs.js'); }).then((m) => m.default)));
142
+ ).option("--skip-install", "Skips yarn install step").option("--skip-migrate", "Skips migration of any moved packages").description("Bump Backstage packages to the latest versions").action(lazy.lazy(() => import('./versions/bump.cjs.js'), "default"));
153
143
  program.command("versions:migrate").option(
154
144
  "--pattern <glob>",
155
145
  "Override glob for matching packages to upgrade"
@@ -158,7 +148,7 @@ function registerCommands(program) {
158
148
  "Skip code changes and only update package.json files"
159
149
  ).description(
160
150
  "Migrate any plugins that have been moved to the @backstage-community namespace automatically"
161
- ).action(lazy.lazy(() => Promise.resolve().then(function () { return require('./versions/migrate.cjs.js'); }).then((m) => m.default)));
151
+ ).action(lazy.lazy(() => import('./versions/migrate.cjs.js'), "default"));
162
152
  program.command("build-workspace <workspace-dir> [packages...]").addOption(
163
153
  new commander.Option(
164
154
  "--alwaysYarnPack",
@@ -167,9 +157,9 @@ function registerCommands(program) {
167
157
  ).option(
168
158
  "--alwaysPack",
169
159
  "Force workspace output to be a result of running `yarn pack` on each package (warning: very slow)"
170
- ).description("Builds a temporary dist workspace from the provided packages").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./buildWorkspace.cjs.js'); }).then((m) => m.default)));
171
- program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./create-github-app/index.cjs.js'); }).then((m) => m.default)));
172
- program.command("info").description("Show helpful information for debugging and reporting bugs").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./info.cjs.js'); }).then((m) => m.default)));
160
+ ).description("Builds a temporary dist workspace from the provided packages").action(lazy.lazy(() => import('./buildWorkspace.cjs.js'), "default"));
161
+ program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(lazy.lazy(() => import('./create-github-app/index.cjs.js'), "default"));
162
+ program.command("info").description("Show helpful information for debugging and reporting bugs").action(lazy.lazy(() => import('./info.cjs.js'), "default"));
173
163
  program.command("create").allowUnknownOption(true).action(removed("use 'backstage-cli new' instead"));
174
164
  program.command("create-plugin").allowUnknownOption(true).action(removed("use 'backstage-cli new' instead"));
175
165
  program.command("plugin:diff").allowUnknownOption(true).action(removed("use 'backstage-cli fix' instead"));
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var globalAgent = require('global-agent');
6
5
  var fs = require('fs-extra');
7
6
  var chalk = require('chalk');
8
7
  var semver = require('semver');
@@ -28,15 +27,17 @@ var semver__default = /*#__PURE__*/_interopDefaultCompat(semver);
28
27
  var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
29
28
  var z__default = /*#__PURE__*/_interopDefaultCompat(z);
30
29
 
31
- if (shouldUseGlobalAgent()) {
32
- globalAgent.bootstrap();
33
- }
34
- function shouldUseGlobalAgent() {
35
- const namespace = process.env.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE ?? "GLOBAL_AGENT_";
36
- if (process.env[`${namespace}HTTP_PROXY`] || process.env[`${namespace}HTTPS_PROXY`]) {
37
- return true;
30
+ maybeBootstrapProxy();
31
+ function maybeBootstrapProxy() {
32
+ const globalAgentNamespace = process.env.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE ?? "GLOBAL_AGENT_";
33
+ if (process.env[`${globalAgentNamespace}HTTP_PROXY`] || process.env[`${globalAgentNamespace}HTTPS_PROXY`]) {
34
+ const globalAgent = require("global-agent");
35
+ globalAgent.bootstrap();
36
+ }
37
+ if (process.env.HTTP_PROXY || process.env.HTTPS_PROXY) {
38
+ const { setGlobalDispatcher, EnvHttpProxyAgent } = require("undici");
39
+ setGlobalDispatcher(new EnvHttpProxyAgent());
38
40
  }
39
- return false;
40
41
  }
41
42
  const DEP_TYPES = [
42
43
  "dependencies",
@@ -31,6 +31,11 @@ var json__default = /*#__PURE__*/_interopDefaultCompat(json);
31
31
  var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
32
32
 
33
33
  const SCRIPT_EXTS = [".js", ".jsx", ".ts", ".tsx"];
34
+ const MODULE_EXTS = [".mjs", ".mts"];
35
+ const COMMONJS_EXTS = [".cjs", ".cts"];
36
+ const MOD_EXT = ".mjs";
37
+ const CJS_EXT = ".cjs";
38
+ const CJS_JS_EXT = ".cjs.js";
34
39
  function isFileImport(source) {
35
40
  if (source.startsWith(".")) {
36
41
  return true;
@@ -57,6 +62,29 @@ function buildInternalImportPattern(options) {
57
62
  const names = inlinedPackages.map((pkg) => pkg.packageJson.name);
58
63
  return new RegExp(`^(?:${names.join("|")})(?:$|/)`);
59
64
  }
65
+ function multiOutputFormat() {
66
+ return {
67
+ name: "backstage-multi-output-format",
68
+ generateBundle(opts, bundle) {
69
+ const filter = opts.format === "cjs" ? (s) => s.endsWith(MOD_EXT) : (s) => !s.endsWith(MOD_EXT);
70
+ for (const name in bundle) {
71
+ if (filter(name)) {
72
+ delete bundle[name];
73
+ delete bundle[`${name}.map`];
74
+ }
75
+ }
76
+ },
77
+ renderDynamicImport(opts) {
78
+ if (opts.format === "cjs") {
79
+ return {
80
+ left: "import(",
81
+ right: ")"
82
+ };
83
+ }
84
+ return void 0;
85
+ }
86
+ };
87
+ }
60
88
  async function makeRollupConfigs(options) {
61
89
  const configs = new Array();
62
90
  const targetDir = options.targetDir ?? paths.paths.targetDir;
@@ -89,16 +117,38 @@ async function makeRollupConfigs(options) {
89
117
  const mainFields = ["module", "main"];
90
118
  const rewriteNodeModules = (name) => name.replaceAll("node_modules", "node_modules_dist");
91
119
  if (options.outputs.has(types.Output.cjs)) {
92
- output.push({
120
+ const defaultExt = targetPkg.type === "module" ? MOD_EXT : CJS_JS_EXT;
121
+ const outputOpts = {
93
122
  dir: distDir,
94
- entryFileNames: (chunkInfo) => `${rewriteNodeModules(chunkInfo.name)}.cjs.js`,
95
- chunkFileNames: `cjs/[name]-[hash].cjs.js`,
96
- format: "commonjs",
97
- interop: "compat",
123
+ entryFileNames(chunkInfo) {
124
+ const cleanName = rewriteNodeModules(chunkInfo.name);
125
+ const inputId = chunkInfo.facadeModuleId;
126
+ if (!inputId) {
127
+ return cleanName + defaultExt;
128
+ }
129
+ const inputExt = path.extname(inputId);
130
+ if (MODULE_EXTS.includes(inputExt)) {
131
+ return cleanName + MOD_EXT;
132
+ }
133
+ if (COMMONJS_EXTS.includes(inputExt)) {
134
+ return cleanName + CJS_EXT;
135
+ }
136
+ return cleanName + defaultExt;
137
+ },
98
138
  sourcemap: true,
99
139
  preserveModules: true,
100
140
  preserveModulesRoot: `${targetDir}/src`,
101
- exports: "named"
141
+ interop: "compat",
142
+ exports: "named",
143
+ plugins: [multiOutputFormat()]
144
+ };
145
+ output.push({
146
+ ...outputOpts,
147
+ format: "cjs"
148
+ });
149
+ output.push({
150
+ ...outputOpts,
151
+ format: "module"
102
152
  });
103
153
  }
104
154
  if (options.outputs.has(types.Output.esm)) {
@@ -124,7 +174,10 @@ async function makeRollupConfigs(options) {
124
174
  // All module imports are always marked as external
125
175
  external,
126
176
  plugins: [
127
- resolve__default.default({ mainFields }),
177
+ resolve__default.default({
178
+ mainFields,
179
+ extensions: SCRIPT_EXTS
180
+ }),
128
181
  commonjs__default.default({
129
182
  include: /node_modules/,
130
183
  exclude: [/\/[^/]+\.(?:stories|test)\.[^/]+$/]
@@ -90,7 +90,7 @@ const buildPackage = async (options) => {
90
90
  } catch {
91
91
  }
92
92
  const rollupConfigs = await config.makeRollupConfigs(options);
93
- await fs__default.default.remove(paths.paths.resolveTarget("dist"));
93
+ await fs__default.default.remove(path.resolve(options.targetDir ?? paths.paths.targetDir, "dist"));
94
94
  const buildTasks = rollupConfigs.map(rollupBuild);
95
95
  await Promise.all(buildTasks);
96
96
  };
@@ -10,7 +10,6 @@ var config = require('../../modules/config/lib/config.cjs.js');
10
10
  var config$1 = require('./config.cjs.js');
11
11
  var packageDetection = require('./packageDetection.cjs.js');
12
12
  var paths = require('./paths.cjs.js');
13
- var hasReactDomClient = require('./hasReactDomClient.cjs.js');
14
13
 
15
14
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
16
15
 
@@ -37,12 +36,8 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
37
36
  checkReactVersion();
38
37
  const { name } = await fs__default.default.readJson(paths$1.paths.resolveTarget("package.json"));
39
38
  let webpackServer = void 0;
40
- let viteServer = void 0;
41
39
  let latestFrontendAppConfigs = [];
42
40
  const triggerReload = () => {
43
- if (viteServer) {
44
- viteServer.restart();
45
- }
46
41
  if (webpackServer) {
47
42
  webpackServer.invalidate();
48
43
  if (process.env.EXPERIMENTAL_RSPACK) {
@@ -110,144 +105,66 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
110
105
  additionalEntryPoints: detectedModulesEntryPoint,
111
106
  moduleFederation: options.moduleFederation
112
107
  });
113
- if (process.env.EXPERIMENTAL_VITE) {
114
- const vite = require("vite");
115
- const { default: viteReact } = require("@vitejs/plugin-react");
116
- const { default: viteYaml } = require("@modyfi/vite-plugin-yaml");
117
- const { nodePolyfills: viteNodePolyfills } = require("vite-plugin-node-polyfills");
118
- const { createHtmlPlugin: viteHtml } = require("vite-plugin-html");
119
- viteServer = await vite.createServer({
120
- define: {
121
- "process.argv": JSON.stringify(process.argv),
122
- "process.env.APP_CONFIG": JSON.stringify(cliConfig.frontendAppConfigs),
123
- // This allows for conditional imports of react-dom/client, since there's no way
124
- // to check for presence of it in source code without module resolution errors.
125
- "process.env.HAS_REACT_DOM_CLIENT": JSON.stringify(hasReactDomClient.hasReactDomClient())
126
- },
127
- optimizeDeps: {
128
- esbuildOptions: {
129
- plugins: [
130
- {
131
- name: "custom-define",
132
- setup(build) {
133
- const define = build.initialOptions.define ||= {};
134
- define["process.env.HAS_REACT_DOM_CLIENT"] = JSON.stringify(
135
- hasReactDomClient.hasReactDomClient()
136
- );
137
- define["process.env.NODE_ENV"] = JSON.stringify("development");
138
- }
139
- }
140
- ]
141
- }
108
+ const bundler = rspack ?? webpack__default.default;
109
+ const DevServer = rspack ? require("@rspack/dev-server").RspackDevServer : WebpackDevServer__default.default;
110
+ if (rspack) {
111
+ console.log(
112
+ chalk__default.default.yellow(`\u26A0\uFE0F WARNING: Using experimental RSPack dev server.`)
113
+ );
114
+ }
115
+ const publicPaths = await paths.resolveOptionalBundlingPaths({
116
+ entry: "src/index-public-experimental",
117
+ dist: "dist/public"
118
+ });
119
+ if (publicPaths) {
120
+ console.log(
121
+ chalk__default.default.yellow(
122
+ `\u26A0\uFE0F WARNING: The app /public entry point is an experimental feature that may receive immediate breaking changes.`
123
+ )
124
+ );
125
+ }
126
+ const compiler = publicPaths ? bundler([config$2, await config$1.createConfig(publicPaths, commonConfigOptions)]) : bundler(config$2);
127
+ webpackServer = new DevServer(
128
+ {
129
+ hot: !process.env.CI,
130
+ devMiddleware: {
131
+ publicPath: config$2.output?.publicPath,
132
+ stats: "errors-warnings"
142
133
  },
143
- plugins: [
144
- viteReact(),
145
- viteNodePolyfills({
146
- include: [
147
- "buffer",
148
- "events",
149
- "fs",
150
- "http",
151
- "https",
152
- "os",
153
- "path",
154
- "process",
155
- "querystring",
156
- "stream",
157
- "url",
158
- "util",
159
- "zlib"
160
- ],
161
- globals: {
162
- global: true,
163
- Buffer: true,
164
- process: true
165
- }
166
- }),
167
- viteYaml(),
168
- viteHtml({
169
- entry: paths$2.targetEntry,
170
- // todo(blam): we should look at contributing to thPe plugin here
171
- // to support absolute paths, but works in the interim at least.
172
- template: "public/index.html",
173
- inject: {
174
- data: {
175
- config: frontendConfig,
176
- publicPath: config$2.output?.publicPath
177
- }
178
- }
179
- })
180
- ],
181
- server: {
182
- host,
183
- port
134
+ static: paths$2.targetPublic ? {
135
+ publicPath: config$2.output?.publicPath,
136
+ directory: paths$2.targetPublic
137
+ } : void 0,
138
+ historyApiFallback: options.moduleFederation?.mode === "remote" ? false : {
139
+ // Paths with dots should still use the history fallback.
140
+ // See https://github.com/facebookincubator/create-react-app/issues/387.
141
+ disableDotRule: true,
142
+ // The index needs to be rewritten relative to the new public path, including subroutes.
143
+ index: `${config$2.output?.publicPath}index.html`
184
144
  },
185
- publicDir: paths$2.targetPublic,
186
- root: paths$2.targetPath
187
- });
188
- } else {
189
- const bundler = rspack ?? webpack__default.default;
190
- const DevServer = rspack ? require("@rspack/dev-server").RspackDevServer : WebpackDevServer__default.default;
191
- if (rspack) {
192
- console.log(
193
- chalk__default.default.yellow(`\u26A0\uFE0F WARNING: Using experimental RSPack dev server.`)
194
- );
195
- }
196
- const publicPaths = await paths.resolveOptionalBundlingPaths({
197
- entry: "src/index-public-experimental",
198
- dist: "dist/public"
199
- });
200
- if (publicPaths) {
201
- console.log(
202
- chalk__default.default.yellow(
203
- `\u26A0\uFE0F WARNING: The app /public entry point is an experimental feature that may receive immediate breaking changes.`
204
- )
205
- );
206
- }
207
- const compiler = publicPaths ? bundler([config$2, await config$1.createConfig(publicPaths, commonConfigOptions)]) : bundler(config$2);
208
- webpackServer = new DevServer(
209
- {
210
- hot: !process.env.CI,
211
- devMiddleware: {
212
- publicPath: config$2.output?.publicPath,
213
- stats: "errors-warnings"
214
- },
215
- static: paths$2.targetPublic ? {
216
- publicPath: config$2.output?.publicPath,
217
- directory: paths$2.targetPublic
218
- } : void 0,
219
- historyApiFallback: options.moduleFederation?.mode === "remote" ? false : {
220
- // Paths with dots should still use the history fallback.
221
- // See https://github.com/facebookincubator/create-react-app/issues/387.
222
- disableDotRule: true,
223
- // The index needs to be rewritten relative to the new public path, including subroutes.
224
- index: `${config$2.output?.publicPath}index.html`
225
- },
226
- server: url.protocol === "https:" ? {
227
- type: "https",
228
- options: {
229
- cert: fullConfig.getString("app.https.certificate.cert"),
230
- key: fullConfig.getString("app.https.certificate.key")
231
- }
232
- } : {},
233
- host,
234
- port,
235
- proxy: targetPkg.proxy,
236
- // When the dev server is behind a proxy, the host and public hostname differ
237
- allowedHosts: [url.hostname],
238
- client: {
239
- webSocketURL: { hostname: host, port }
240
- },
241
- headers: {
242
- "Access-Control-Allow-Origin": "*",
243
- "Access-Control-Allow-Methods": "GET, OPTIONS",
244
- "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
145
+ server: url.protocol === "https:" ? {
146
+ type: "https",
147
+ options: {
148
+ cert: fullConfig.getString("app.https.certificate.cert"),
149
+ key: fullConfig.getString("app.https.certificate.key")
245
150
  }
151
+ } : {},
152
+ host,
153
+ port,
154
+ proxy: targetPkg.proxy,
155
+ // When the dev server is behind a proxy, the host and public hostname differ
156
+ allowedHosts: [url.hostname],
157
+ client: {
158
+ webSocketURL: { hostname: host, port }
246
159
  },
247
- compiler
248
- );
249
- }
250
- await viteServer?.listen();
160
+ headers: {
161
+ "Access-Control-Allow-Origin": "*",
162
+ "Access-Control-Allow-Methods": "GET, OPTIONS",
163
+ "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
164
+ }
165
+ },
166
+ compiler
167
+ );
251
168
  await new Promise(async (resolve, reject) => {
252
169
  if (webpackServer) {
253
170
  webpackServer.startCallback((err) => {
@@ -268,7 +185,6 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
268
185
  for (const signal of ["SIGINT", "SIGTERM"]) {
269
186
  process.on(signal, () => {
270
187
  webpackServer?.stop();
271
- viteServer?.close();
272
188
  process.exit();
273
189
  });
274
190
  }
@@ -3,10 +3,12 @@
3
3
  var errors = require('@backstage/errors');
4
4
  var errors$1 = require('./errors.cjs.js');
5
5
 
6
- function lazy(getActionFunc) {
6
+ function lazy(moduleLoader, exportName) {
7
7
  return async (...args) => {
8
8
  try {
9
- const actionFunc = await getActionFunc();
9
+ const mod = await moduleLoader();
10
+ const actualModule = mod.default;
11
+ const actionFunc = actualModule[exportName];
10
12
  await actionFunc(...args);
11
13
  process.exit(0);
12
14
  } catch (error) {
@@ -12,14 +12,14 @@ function registerCommands(program) {
12
12
  program.command("config:docs").option(
13
13
  "--package <name>",
14
14
  "Only include the schema that applies to the given package"
15
- ).description("Browse the configuration reference documentation").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./commands/docs.cjs.js'); }).then((m) => m.default)));
15
+ ).description("Browse the configuration reference documentation").action(lazy.lazy(() => import('./commands/docs.cjs.js'), "default"));
16
16
  program.command("config:print").option(
17
17
  "--package <name>",
18
18
  "Only load config schema that applies to the given package"
19
19
  ).option("--lax", "Do not require environment variables to be set").option("--frontend", "Print only the frontend configuration").option("--with-secrets", "Include secrets in the printed configuration").option(
20
20
  "--format <format>",
21
21
  "Format to print the configuration in, either json or yaml [yaml]"
22
- ).option(...configOption).description("Print the app configuration for the current package").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./commands/print.cjs.js'); }).then((m) => m.default)));
22
+ ).option(...configOption).description("Print the app configuration for the current package").action(lazy.lazy(() => import('./commands/print.cjs.js'), "default"));
23
23
  program.command("config:check").option(
24
24
  "--package <name>",
25
25
  "Only load config schema that applies to the given package"
@@ -28,14 +28,14 @@ function registerCommands(program) {
28
28
  "Enable strict config validation, forbidding errors and unknown keys"
29
29
  ).option(...configOption).description(
30
30
  "Validate that the given configuration loads and matches schema"
31
- ).action(lazy.lazy(() => Promise.resolve().then(function () { return require('./commands/validate.cjs.js'); }).then((m) => m.default)));
31
+ ).action(lazy.lazy(() => import('./commands/validate.cjs.js'), "default"));
32
32
  program.command("config:schema").option(
33
33
  "--package <name>",
34
34
  "Only output config schema that applies to the given package"
35
35
  ).option(
36
36
  "--format <format>",
37
37
  "Format to print the schema in, either json or yaml [yaml]"
38
- ).option("--merge", "Print the config schemas merged", true).option("--no-merge", "Print the config schemas not merged").description("Print configuration schema").action(lazy.lazy(() => Promise.resolve().then(function () { return require('./commands/schema.cjs.js'); }).then((m) => m.default)));
38
+ ).option("--merge", "Print the config schemas merged", true).option("--no-merge", "Print the config schemas not merged").description("Print configuration schema").action(lazy.lazy(() => import('./commands/schema.cjs.js'), "default"));
39
39
  }
40
40
 
41
41
  exports.configOption = configOption;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.7.0-next.1";
3
+ var version = "0.8.0-next.0";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.1.1-next.1";
3
+ var version = "1.2.0-next.0";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.2.1-next.1";
3
+ var version = "1.3.0-next.0";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.9.1-next.0";
3
+ var version = "1.9.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.29.5-next.1";
3
+ var version = "0.30.0-next.0";
4
4
  var dependencies = {
5
5
  "@backstage/catalog-model": "workspace:^",
6
6
  "@backstage/cli-common": "workspace:^",
@@ -107,6 +107,7 @@ var dependencies = {
107
107
  tar: "^6.1.12",
108
108
  "terser-webpack-plugin": "^5.1.3",
109
109
  "ts-morph": "^24.0.0",
110
+ undici: "^7.2.3",
110
111
  util: "^0.12.3",
111
112
  webpack: "^5.94.0",
112
113
  "webpack-dev-server": "^5.0.0",
@@ -152,13 +153,9 @@ var devDependencies = {
152
153
  "@types/terser-webpack-plugin": "^5.0.4",
153
154
  "@types/webpack-sources": "^3.2.3",
154
155
  "@types/yarnpkg__lockfile": "^1.1.4",
155
- "@vitejs/plugin-react": "^4.3.1",
156
156
  del: "^8.0.0",
157
157
  msw: "^1.0.0",
158
- nodemon: "^3.0.1",
159
- vite: "^5.0.0",
160
- "vite-plugin-html": "^3.2.2",
161
- "vite-plugin-node-polyfills": "^0.22.0"
158
+ nodemon: "^3.0.1"
162
159
  };
163
160
 
164
161
  exports.dependencies = dependencies;