@backstage/cli 0.13.1-next.1 → 0.14.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 (63) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/config/eslint.backend.js +1 -12
  3. package/config/eslint.js +6 -17
  4. package/config/jest.js +4 -3
  5. package/config/jestSucraseTransform.js +60 -39
  6. package/dist/cjs/PackageGraph-d7b9d768.cjs.js +143 -0
  7. package/dist/cjs/backend-7919a693.cjs.js +36 -0
  8. package/dist/cjs/build-29fe454d.cjs.js +59 -0
  9. package/dist/cjs/{build-cda9d14b.cjs.js → build-30d6e823.cjs.js} +9 -4
  10. package/dist/cjs/build-8fe538f0.cjs.js +173 -0
  11. package/dist/cjs/{build-a0537ac0.cjs.js → build-ef788e26.cjs.js} +9 -4
  12. package/dist/cjs/buildBackend-1727e26d.cjs.js +84 -0
  13. package/dist/cjs/buildWorkspace-cdb5a92d.cjs.js +54 -0
  14. package/dist/cjs/bump-3e73eb63.cjs.js +348 -0
  15. package/dist/cjs/{build-0e234c9c.cjs.js → bundle-cfe3be2c.cjs.js} +10 -49
  16. package/dist/cjs/{bundle-82ebca5c.cjs.js → bundle-f5e5afd4.cjs.js} +16 -11
  17. package/dist/cjs/{clean-2a744d8e.cjs.js → clean-677131a4.cjs.js} +2 -2
  18. package/dist/cjs/{config-08b1d0e3.cjs.js → config-147bac17.cjs.js} +3 -3
  19. package/dist/cjs/{create-3c1059f8.cjs.js → create-95febe68.cjs.js} +4 -4
  20. package/dist/cjs/createDistWorkspace-59a08943.cjs.js +211 -0
  21. package/dist/cjs/{createPlugin-98d2404a.cjs.js → createPlugin-fd799616.cjs.js} +4 -4
  22. package/dist/cjs/{dev-35175ac8.cjs.js → dev-70024fd0.cjs.js} +8 -33
  23. package/dist/cjs/{diff-0f4d8b16.cjs.js → diff-4cf33d7e.cjs.js} +8 -8
  24. package/dist/cjs/{docs-1df9fa22.cjs.js → docs-1ce5cd6c.cjs.js} +7 -4
  25. package/dist/cjs/index-1823ab16.cjs.js +94 -0
  26. package/dist/cjs/{index-db3186f9.cjs.js → index-2b8588e8.cjs.js} +88 -59
  27. package/dist/cjs/{index-4fd2a731.cjs.js → index-9879526e.cjs.js} +2 -2
  28. package/dist/cjs/index-ba0436fb.cjs.js +125 -0
  29. package/dist/cjs/{info-0c58ae61.cjs.js → info-da6c4aef.cjs.js} +3 -3
  30. package/dist/cjs/{install-8bc1ba18.cjs.js → install-28e7640d.cjs.js} +4 -4
  31. package/dist/cjs/lint-985567f6.cjs.js +92 -0
  32. package/dist/cjs/{lint-9da50914.cjs.js → lint-a9e3c169.cjs.js} +3 -3
  33. package/dist/cjs/lint-ad2a1c74.cjs.js +35 -0
  34. package/dist/cjs/{build-f89d7092.cjs.js → oldBuild-a88f7903.cjs.js} +11 -6
  35. package/dist/cjs/{pack-8ef0a3ba.cjs.js → pack-b252bbb6.cjs.js} +2 -2
  36. package/dist/cjs/packageRole-5f116d95.cjs.js +54 -0
  37. package/dist/cjs/packageRoles-f375a99e.cjs.js +158 -0
  38. package/dist/cjs/packageScripts-890cd7af.cjs.js +97 -0
  39. package/dist/cjs/{packager-89d7686b.cjs.js → packager-8f82846e.cjs.js} +141 -58
  40. package/dist/cjs/{packages-fd09251d.cjs.js → packages-572642d7.cjs.js} +5 -4
  41. package/dist/cjs/parallel-d8e5bcbf.cjs.js +171 -0
  42. package/dist/cjs/{paths-f273ca03.cjs.js → paths-8e0b151d.cjs.js} +20 -19
  43. package/dist/cjs/{print-bd48d728.cjs.js → print-b7e68297.cjs.js} +7 -4
  44. package/dist/cjs/{run-448b5912.cjs.js → run-d3528c59.cjs.js} +2 -2
  45. package/dist/cjs/{schema-c5b2f512.cjs.js → schema-0d43bb71.cjs.js} +7 -4
  46. package/dist/cjs/{serve-32362ee1.cjs.js → serve-b7ae013f.cjs.js} +8 -8
  47. package/dist/cjs/{serve-b11d7c66.cjs.js → serve-cd62a6bb.cjs.js} +9 -9
  48. package/dist/cjs/{server-114c20ca.cjs.js → server-894abd58.cjs.js} +2 -2
  49. package/dist/cjs/svgrTemplate-b7a4ee52.cjs.js +21 -0
  50. package/dist/cjs/{tasks-f57f3a8c.cjs.js → tasks-f55f3d7e.cjs.js} +2 -2
  51. package/dist/cjs/{testCommand-a0ab3b2f.cjs.js → testCommand-f9b311fb.cjs.js} +11 -4
  52. package/dist/cjs/{validate-dfd64471.cjs.js → validate-cff0ae61.cjs.js} +7 -4
  53. package/dist/index.cjs.js +1 -1
  54. package/package.json +31 -22
  55. package/templates/default-backend-plugin/package.json.hbs +1 -1
  56. package/templates/default-plugin/package.json.hbs +1 -1
  57. package/dist/cjs/PackageGraph-7a0d3a83.cjs.js +0 -73
  58. package/dist/cjs/buildWorkspace-5494b433.cjs.js +0 -35
  59. package/dist/cjs/bump-ab6e31e7.cjs.js +0 -240
  60. package/dist/cjs/index-c868bb2d.cjs.js +0 -106
  61. package/dist/cjs/lint-f037ffc0.cjs.js +0 -29
  62. package/dist/cjs/parallel-7e32a8d0.cjs.js +0 -25
  63. package/dist/cjs/svgrTemplate-f19e974c.cjs.js +0 -25
package/CHANGELOG.md CHANGED
@@ -1,5 +1,93 @@
1
1
  # @backstage/cli
2
2
 
3
+ ## 0.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1fc0cd3896: Bumped Webpack and Rollup `svgr` dependencies and updated the AST template for `.icon.svg` modules. This means that SVG icon imports are now using SVGO v2.
8
+
9
+ ### Patch Changes
10
+
11
+ - 0b74c72987: Added a new experimental and hidden `backstage-cli repo lint` command that can be used to lint all packages in the project, similar to `lerna run lint`.
12
+ - 532dae9c4c: The `versions:bump --release next` command is updated to compare the `main` and `next` release manifests and prefer the latest.
13
+ - 1ed305728b: Bump `node-fetch` to version 2.6.7 and `cross-fetch` to version 3.1.5
14
+ - c77c5c7eb6: Added `backstage.role` to `package.json`
15
+ - 22862486de: The `versions:bump` command now filters out `npm_` environment configuration when running `yarn install`. This has the effect of allowing it to consider local configuration files within the repository, which is the behavior that one would expect.
16
+ - 22862486de: The `versions:bump` command now also considers the root `package.json` when searching for updates. It has also received updates to its output, including a link the [Backstage upgrade helper](https://backstage.github.io/upgrade-helper) and silenced `yarn install` output.
17
+ - 7410e12268: Several changes were made to the new experimental package roles system. Unless you have been experimenting with using this new system, these changes have no affect on your project.
18
+
19
+ Renamed the `backstage-cli migrate package-role` command to `backstage-cli migrate package-roles`.
20
+
21
+ Updated the package role definitions by renaming `app` to `frontend`, `plugin-frontend` to `frontend-plugin`, `plugin-frontend-module` to `frontend-plugin-module`, `plugin-backend` to `backend-plugin`, and `plugin-backend-module` to `backend-plugin-module`
22
+
23
+ The `backstage-cli migrate package-scripts` received several tweaks to make it more accurate. It now tries to maintain existing script arguments, like `--config` parameters for `build` and `start` scripts.
24
+
25
+ The `script` command category has been renamed to `package`.
26
+
27
+ The `backstage-cli package build` command set an incorrect target directory for `app` and `backend` packages, which has been fixed.
28
+
29
+ The `backend:bundle` and `repo build` command for the `backend` role was previously ignoring building of bundled packages that had migrated to use package roles and the standard build script, this has now been fixed.
30
+
31
+ - c6bbafb516: Updated the default [sucrase](https://github.com/alangpierce/sucrase)-based Jest transform to include source maps if the environment variable `ENABLE_SOURCE_MAPS` is non-empty. This can be used to better support editor test debugging integrations.
32
+ - 7410e12268: The `test` command now automatically adds `--passWithNoTests` to the Jest invocation. To revert this behavior, pass `--passWithNoTests=false` or `--no-passWithNoTests`.
33
+ - Updated dependencies
34
+ - @backstage/config-loader@0.9.4
35
+ - @backstage/errors@0.2.1
36
+ - @backstage/release-manifests@0.0.2
37
+ - @backstage/cli-common@0.1.7
38
+ - @backstage/config@0.1.14
39
+ - @backstage/types@0.1.2
40
+
41
+ ## 0.13.2
42
+
43
+ ### Patch Changes
44
+
45
+ - bbbaa8ed61: The `plugin:diff` command no longer validates the existence of any of the files within `dev/` or `src/`.
46
+ - eaf67f0578: Introduced initial support for an experimental `backstage.role` field in package.json, as well as experimental and hidden `migrate` and `script` sub-commands. We do not recommend usage of any of these additions yet.
47
+ - aeb5c69abb: Introduces a new `--release` parameter to the `backstage-cli versions:bump` command.
48
+ The release can be either a specific version, for example `0.99.1`, or the latest `main` or `next` release.
49
+ The default behavior is to bump to the latest `main` release.
50
+ - d59b90852a: The experimental types build enabled by `--experimental-type-build` now runs in a separate worker thread.
51
+ - 50a19ff8dd: The file path printed by the default lint formatter is now relative to the repository root, rather than the individual package.
52
+ - 63181dee79: Tweaked frontend bundling configuration to avoid leaking declarations into global scope.
53
+ - fae2aee878: Removed the `import/no-duplicates` lint rule from the frontend and backend ESLint configurations. This rule is quite expensive to execute and only provides a purely cosmetic benefit, so we opted to remove it from the set of default rules. If you would like to keep this rule you can add it back in your local ESLint configuration:
54
+
55
+ ```js
56
+ 'import/no-duplicates': 'warn'
57
+ ```
58
+
59
+ - b906f98119: Rather than calling `yarn pack`, the `build-workspace` and `backend-bundle` commands now move files directly whenever possible. This cuts out several `yarn` invocations and speeds the packing process up by several orders of magnitude.
60
+ - d0c71e2aa4: Switched the `lint` command to invoke ESLint directly through its Node.js API rather than spawning a new process.
61
+ - d59b90852a: Introduced an experimental and hidden `repo` sub-command, that contains commands that operate on an entire monorepo rather than individual packages.
62
+ - Updated dependencies
63
+ - @backstage/release-manifests@0.0.1
64
+
65
+ ## 0.13.2-next.0
66
+
67
+ ### Patch Changes
68
+
69
+ - bbbaa8ed61: The `plugin:diff` command no longer validates the existence of any of the files within `dev/` or `src/`.
70
+ - eaf67f0578: Introduced initial support for an experimental `backstage.role` field in package.json, as well as experimental and hidden `migrate` and `script` sub-commands. We do not recommend usage of any of these additions yet.
71
+ - d59b90852a: The experimental types build enabled by `--experimental-type-build` now runs in a separate worker thread.
72
+ - 50a19ff8dd: The file path printed by the default lint formatter is now relative to the repository root, rather than the individual package.
73
+ - 63181dee79: Tweaked frontend bundling configuration to avoid leaking declarations into global scope.
74
+ - fae2aee878: Removed the `import/no-duplicates` lint rule from the frontend and backend ESLint configurations. This rule is quite expensive to execute and only provides a purely cosmetic benefit, so we opted to remove it from the set of default rules. If you would like to keep this rule you can add it back in your local ESLint configuration:
75
+
76
+ ```js
77
+ 'import/no-duplicates': 'warn'
78
+ ```
79
+
80
+ - b906f98119: Rather than calling `yarn pack`, the `build-workspace` and `backend-bundle` commands now move files directly whenever possible. This cuts out several `yarn` invocations and speeds the packing process up by several orders of magnitude.
81
+ - d0c71e2aa4: Switched the `lint` command to invoke ESLint directly through its Node.js API rather than spawning a new process.
82
+ - d59b90852a: Introduced an experimental and hidden `repo` sub-command, that contains commands that operate on an entire monorepo rather than individual packages.
83
+
84
+ ## 0.13.1
85
+
86
+ ### Patch Changes
87
+
88
+ - 5bd0ce9e62: chore(deps): bump `inquirer` from 7.3.3 to 8.2.0
89
+ - 80f510caee: Log warning if unable to parse yarn.lock
90
+
3
91
  ## 0.13.1-next.1
4
92
 
5
93
  ### Patch Changes
@@ -54,11 +54,10 @@ module.exports = {
54
54
  'no-console': 0, // Permitted in console programs
55
55
  'new-cap': ['error', { capIsNew: false }], // Because Express constructs things e.g. like 'const r = express.Router()'
56
56
  'import/newline-after-import': 'error',
57
- 'import/no-duplicates': 'warn',
58
57
  'import/no-extraneous-dependencies': [
59
58
  'error',
60
59
  {
61
- devDependencies: false,
60
+ devDependencies: ['**/*.test.*', 'src/setupTests.*', 'dev/**'],
62
61
  optionalDependencies: true,
63
62
  peerDependencies: true,
64
63
  bundledDependencies: true,
@@ -97,16 +96,6 @@ module.exports = {
97
96
  {
98
97
  files: ['*.test.*', 'src/setupTests.*', 'dev/**'],
99
98
  rules: {
100
- // Tests are allowed to import dev dependencies
101
- 'import/no-extraneous-dependencies': [
102
- 'error',
103
- {
104
- devDependencies: true,
105
- optionalDependencies: true,
106
- peerDependencies: true,
107
- bundledDependencies: true,
108
- },
109
- ],
110
99
  'no-restricted-syntax': ['error', ...globalRestrictedSyntax],
111
100
  },
112
101
  },
package/config/eslint.js CHANGED
@@ -49,11 +49,15 @@ module.exports = {
49
49
  '@typescript-eslint/no-redeclare': 'error',
50
50
  'no-undef': 'off',
51
51
  'import/newline-after-import': 'error',
52
- 'import/no-duplicates': 'warn',
53
52
  'import/no-extraneous-dependencies': [
54
53
  'error',
55
54
  {
56
- devDependencies: false,
55
+ devDependencies: [
56
+ '**/*.test.*',
57
+ '**/*.stories.*',
58
+ 'src/setupTests.*',
59
+ 'dev/**',
60
+ ],
57
61
  optionalDependencies: true,
58
62
  peerDependencies: true,
59
63
  bundledDependencies: true,
@@ -101,20 +105,5 @@ module.exports = {
101
105
  'no-undef': 'off',
102
106
  },
103
107
  },
104
- {
105
- files: ['*.test.*', '*.stories.*', 'src/setupTests.*', 'dev/**'],
106
- rules: {
107
- // Tests are allowed to import dev dependencies
108
- 'import/no-extraneous-dependencies': [
109
- 'error',
110
- {
111
- devDependencies: true,
112
- optionalDependencies: true,
113
- peerDependencies: true,
114
- bundledDependencies: true,
115
- },
116
- ],
117
- },
118
- },
119
108
  ],
120
109
  };
package/config/jest.js CHANGED
@@ -102,9 +102,10 @@ async function getProjectConfig(targetPath, displayName) {
102
102
  },
103
103
 
104
104
  transform: {
105
- '\\.(js|jsx|ts|tsx|mjs|cjs)$': require.resolve(
106
- './jestSucraseTransform.js',
107
- ),
105
+ '\\.(js|jsx|ts|tsx|mjs|cjs)$': [
106
+ require.resolve('./jestSucraseTransform.js'),
107
+ { enableSourceMaps: Boolean(process.env.ENABLE_SOURCE_MAPS) },
108
+ ],
108
109
  '\\.(bmp|gif|jpg|jpeg|png|frag|xml|svg|eot|woff|woff2|ttf)$':
109
110
  require.resolve('./jestFileTransform.js'),
110
111
  '\\.(yaml)$': require.resolve('jest-transform-yaml'),
@@ -21,50 +21,71 @@ const sucrasePluginPkg = require('@sucrase/jest-plugin/package.json');
21
21
 
22
22
  const ESM_REGEX = /\b(?:import|export)\b/;
23
23
 
24
- function process(source, filePath) {
25
- let transforms;
24
+ function createTransformer(config) {
25
+ const process = (source, filePath) => {
26
+ let transforms;
26
27
 
27
- if (filePath.endsWith('.esm.js')) {
28
- transforms = ['imports'];
29
- } else if (filePath.endsWith('.js')) {
30
- // This is a very rough filter to avoid transforming things that we quickly
31
- // can be sure are definitely not ESM modules.
32
- if (ESM_REGEX.test(source)) {
33
- transforms = ['imports', 'jsx']; // JSX within .js is currently allowed
28
+ if (filePath.endsWith('.esm.js')) {
29
+ transforms = ['imports'];
30
+ } else if (filePath.endsWith('.js')) {
31
+ // This is a very rough filter to avoid transforming things that we quickly
32
+ // can be sure are definitely not ESM modules.
33
+ if (ESM_REGEX.test(source)) {
34
+ transforms = ['imports', 'jsx']; // JSX within .js is currently allowed
35
+ }
36
+ } else if (filePath.endsWith('.jsx')) {
37
+ transforms = ['jsx', 'imports'];
38
+ } else if (filePath.endsWith('.ts')) {
39
+ transforms = ['typescript', 'imports'];
40
+ } else if (filePath.endsWith('.tsx')) {
41
+ transforms = ['typescript', 'jsx', 'imports'];
34
42
  }
35
- } else if (filePath.endsWith('.jsx')) {
36
- transforms = ['jsx', 'imports'];
37
- } else if (filePath.endsWith('.ts')) {
38
- transforms = ['typescript', 'imports'];
39
- } else if (filePath.endsWith('.tsx')) {
40
- transforms = ['typescript', 'jsx', 'imports'];
41
- }
42
43
 
43
- // Only apply the jest transform to the test files themselves
44
- if (transforms && filePath.includes('.test.')) {
45
- transforms.push('jest');
46
- }
44
+ // Only apply the jest transform to the test files themselves
45
+ if (transforms && filePath.includes('.test.')) {
46
+ transforms.push('jest');
47
+ }
48
+
49
+ if (transforms) {
50
+ const { code, sourceMap: map } = transform(source, {
51
+ transforms,
52
+ filePath,
53
+ disableESTransforms: true,
54
+ sourceMapOptions: {
55
+ compiledFilename: filePath,
56
+ },
57
+ });
58
+ if (config.enableSourceMaps) {
59
+ const b64 = Buffer.from(JSON.stringify(map), 'utf8').toString('base64');
60
+ const suffix = `//# sourceMappingURL=data:application/json;charset=utf-8;base64,${b64}`;
61
+ // Include both inline and object source maps, as inline source maps are
62
+ // needed for support of some editor integrations.
63
+ return { code: `${code}\n${suffix}`, map };
64
+ }
65
+ // We only return the `map` result if source maps are enabled, as they
66
+ // have a negative impact on the coverage accuracy.
67
+ return code;
68
+ }
47
69
 
48
- if (transforms) {
49
- return transform(source, {
50
- transforms,
51
- filePath,
52
- disableESTransforms: true,
53
- }).code;
54
- }
70
+ return source;
71
+ };
55
72
 
56
- return source;
57
- }
73
+ // TODO: contribute something like this to @sucrase/jest-plugin
74
+ const getCacheKey = sourceText => {
75
+ return createHash('md5')
76
+ .update(sourceText)
77
+ .update(Buffer.alloc(1))
78
+ .update(sucrasePkg.version)
79
+ .update(Buffer.alloc(1))
80
+ .update(sucrasePluginPkg.version)
81
+ .update(Buffer.alloc(1))
82
+ .update(JSON.stringify(config))
83
+ .update(Buffer.alloc(1))
84
+ .update('1') // increment whenever the transform logic in this file changes
85
+ .digest('hex');
86
+ };
58
87
 
59
- // TODO: contribute something like this to @sucrase/jest-plugin
60
- function getCacheKey(sourceText) {
61
- return createHash('md5')
62
- .update(sourceText)
63
- .update(Buffer.alloc(1))
64
- .update(sucrasePkg.version)
65
- .update(Buffer.alloc(1))
66
- .update(sucrasePluginPkg.version)
67
- .digest('hex');
88
+ return { process, getCacheKey };
68
89
  }
69
90
 
70
- module.exports = { process, getCacheKey };
91
+ module.exports = { createTransformer };
@@ -0,0 +1,143 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var getPackages = require('@manypkg/get-packages');
5
+ var index = require('./index-2b8588e8.cjs.js');
6
+ var errors = require('@backstage/errors');
7
+ var child_process = require('child_process');
8
+ var util = require('util');
9
+
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
13
+
14
+ const execFile = util.promisify(child_process.execFile);
15
+ async function runGit(...args) {
16
+ var _a, _b;
17
+ try {
18
+ const { stdout } = await execFile("git", args, {
19
+ shell: true,
20
+ cwd: index.paths.targetRoot
21
+ });
22
+ return stdout.trim().split(/\r\n|\r|\n/);
23
+ } catch (error) {
24
+ errors.assertError(error);
25
+ if (error.stderr || typeof error.code === "number") {
26
+ const stderr = (_a = error.stderr) == null ? void 0 : _a.toString("utf8");
27
+ const msg = (_b = stderr == null ? void 0 : stderr.trim()) != null ? _b : `with exit code ${error.code}`;
28
+ throw new Error(`git ${args[0]} failed, ${msg}`);
29
+ }
30
+ throw new errors.ForwardedError("Unknown execution error", error);
31
+ }
32
+ }
33
+ async function listChangedFiles(ref) {
34
+ if (!ref) {
35
+ throw new Error("ref is required");
36
+ }
37
+ const [base] = await runGit("merge-base", "HEAD", ref);
38
+ const tracked = await runGit("diff", "--name-only", base);
39
+ const untracked = await runGit("ls-files", "--others", "--exclude-standard");
40
+ return Array.from(/* @__PURE__ */ new Set([...tracked, ...untracked]));
41
+ }
42
+
43
+ class PackageGraph extends Map {
44
+ static async listTargetPackages() {
45
+ const { packages } = await getPackages.getPackages(index.paths.targetDir);
46
+ return packages;
47
+ }
48
+ static fromPackages(packages) {
49
+ const graph = new PackageGraph();
50
+ for (const pkg of packages) {
51
+ const name = pkg.packageJson.name;
52
+ const existingPkg = graph.get(name);
53
+ if (existingPkg) {
54
+ throw new Error(`Duplicate package name '${name}' at ${pkg.dir} and ${existingPkg.dir}`);
55
+ }
56
+ graph.set(name, {
57
+ name,
58
+ dir: pkg.dir,
59
+ packageJson: pkg.packageJson,
60
+ allLocalDependencies: /* @__PURE__ */ new Map(),
61
+ publishedLocalDependencies: /* @__PURE__ */ new Map(),
62
+ localDependencies: /* @__PURE__ */ new Map(),
63
+ localDevDependencies: /* @__PURE__ */ new Map(),
64
+ localOptionalDependencies: /* @__PURE__ */ new Map()
65
+ });
66
+ }
67
+ for (const node of graph.values()) {
68
+ for (const depName of Object.keys(node.packageJson.dependencies || {})) {
69
+ const depPkg = graph.get(depName);
70
+ if (depPkg) {
71
+ node.allLocalDependencies.set(depName, depPkg);
72
+ node.publishedLocalDependencies.set(depName, depPkg);
73
+ node.localDependencies.set(depName, depPkg);
74
+ }
75
+ }
76
+ for (const depName of Object.keys(node.packageJson.devDependencies || {})) {
77
+ const depPkg = graph.get(depName);
78
+ if (depPkg) {
79
+ node.allLocalDependencies.set(depName, depPkg);
80
+ node.localDevDependencies.set(depName, depPkg);
81
+ }
82
+ }
83
+ for (const depName of Object.keys(node.packageJson.optionalDependencies || {})) {
84
+ const depPkg = graph.get(depName);
85
+ if (depPkg) {
86
+ node.allLocalDependencies.set(depName, depPkg);
87
+ node.publishedLocalDependencies.set(depName, depPkg);
88
+ node.localOptionalDependencies.set(depName, depPkg);
89
+ }
90
+ }
91
+ }
92
+ return graph;
93
+ }
94
+ collectPackageNames(startingPackageNames, collectFn) {
95
+ const targets = /* @__PURE__ */ new Set();
96
+ const searchNames = startingPackageNames.slice();
97
+ while (searchNames.length) {
98
+ const name = searchNames.pop();
99
+ if (targets.has(name)) {
100
+ continue;
101
+ }
102
+ const node = this.get(name);
103
+ if (!node) {
104
+ throw new Error(`Package '${name}' not found`);
105
+ }
106
+ targets.add(name);
107
+ const collected = collectFn(node);
108
+ if (collected) {
109
+ searchNames.push(...collected);
110
+ }
111
+ }
112
+ return targets;
113
+ }
114
+ async listChangedPackages(options) {
115
+ var _a, _b;
116
+ const changedFiles = await listChangedFiles(options.ref);
117
+ const dirMap = new Map(Array.from(this.values()).map((pkg) => [
118
+ path__default["default"].relative(index.paths.targetRoot, pkg.dir).split(path__default["default"].sep).join(path__default["default"].posix.sep) + path__default["default"].posix.sep,
119
+ pkg
120
+ ]));
121
+ const packageDirs = Array.from(dirMap.keys());
122
+ const result = new Array();
123
+ let searchIndex = 0;
124
+ changedFiles.sort();
125
+ packageDirs.sort();
126
+ for (const packageDir of packageDirs) {
127
+ while (searchIndex < changedFiles.length && changedFiles[searchIndex] < packageDir) {
128
+ searchIndex += 1;
129
+ }
130
+ if ((_a = changedFiles[searchIndex]) == null ? void 0 : _a.startsWith(packageDir)) {
131
+ searchIndex += 1;
132
+ result.push(dirMap.get(packageDir));
133
+ while ((_b = changedFiles[searchIndex]) == null ? void 0 : _b.startsWith(packageDir)) {
134
+ searchIndex += 1;
135
+ }
136
+ }
137
+ }
138
+ return result;
139
+ }
140
+ }
141
+
142
+ exports.PackageGraph = PackageGraph;
143
+ //# sourceMappingURL=PackageGraph-d7b9d768.cjs.js.map
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ var webpack = require('webpack');
4
+ var paths = require('./paths-8e0b151d.cjs.js');
5
+
6
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
7
+
8
+ var webpack__default = /*#__PURE__*/_interopDefaultLegacy(webpack);
9
+
10
+ async function serveBackend(options) {
11
+ const paths$1 = paths.resolveBundlingPaths(options);
12
+ const config = await paths.createBackendConfig(paths$1, {
13
+ ...options,
14
+ isDev: true
15
+ });
16
+ const compiler = webpack__default["default"](config, (err) => {
17
+ if (err) {
18
+ console.error(err);
19
+ } else
20
+ console.log("Build succeeded");
21
+ });
22
+ const waitForExit = async () => {
23
+ for (const signal of ["SIGINT", "SIGTERM"]) {
24
+ process.on(signal, () => {
25
+ compiler.close(() => console.log("Stopped watcher"));
26
+ process.exit();
27
+ });
28
+ }
29
+ return new Promise(() => {
30
+ });
31
+ };
32
+ return waitForExit;
33
+ }
34
+
35
+ exports.serveBackend = serveBackend;
36
+ //# sourceMappingURL=backend-7919a693.cjs.js.map
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs-extra');
4
+ require('webpack');
5
+ require('chalk');
6
+ require('path');
7
+ require('fork-ts-checker-webpack-plugin');
8
+ require('html-webpack-plugin');
9
+ require('react-dev-utils/ModuleScopePlugin');
10
+ require('run-script-webpack-plugin');
11
+ require('webpack-node-externals');
12
+ require('@backstage/cli-common');
13
+ require('@manypkg/get-packages');
14
+ require('./paths-8e0b151d.cjs.js');
15
+ require('mini-css-extract-plugin');
16
+ var index = require('./index-2b8588e8.cjs.js');
17
+ require('./run-d3528c59.cjs.js');
18
+ require('eslint-webpack-plugin');
19
+ require('lodash/pickBy');
20
+ var bundle = require('./bundle-cfe3be2c.cjs.js');
21
+ require('webpack-dev-server');
22
+ require('react-dev-utils/openBrowser');
23
+ var parallel = require('./parallel-d8e5bcbf.cjs.js');
24
+ var config = require('./config-147bac17.cjs.js');
25
+ require('./svgrTemplate-b7a4ee52.cjs.js');
26
+ require('commander');
27
+ require('semver');
28
+ require('@backstage/config/package.json');
29
+ require('@backstage/errors');
30
+ require('child_process');
31
+ require('util');
32
+ require('yn');
33
+ require('react-dev-utils/FileSizeReporter');
34
+ require('react-dev-utils/formatWebpackMessages');
35
+ require('os');
36
+ require('worker_threads');
37
+ require('@backstage/config-loader');
38
+ require('@backstage/config');
39
+ require('./PackageGraph-d7b9d768.cjs.js');
40
+
41
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
42
+
43
+ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
44
+
45
+ var build = async (cmd) => {
46
+ const { name } = await fs__default["default"].readJson(index.paths.resolveTarget("package.json"));
47
+ await bundle.buildBundle({
48
+ entry: "src/index",
49
+ parallelism: parallel.getEnvironmentParallelism(),
50
+ statsJsonEnabled: cmd.stats,
51
+ ...await config.loadCliConfig({
52
+ args: cmd.config,
53
+ fromPackage: name
54
+ })
55
+ });
56
+ };
57
+
58
+ exports["default"] = build;
59
+ //# sourceMappingURL=build-29fe454d.cjs.js.map
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var packager = require('./packager-89d7686b.cjs.js');
3
+ var packager = require('./packager-8f82846e.cjs.js');
4
4
  require('fs-extra');
5
5
  require('rollup');
6
6
  require('chalk');
7
7
  require('path');
8
- require('./index-db3186f9.cjs.js');
8
+ require('./index-2b8588e8.cjs.js');
9
9
  require('commander');
10
10
  require('semver');
11
11
  require('@backstage/cli-common');
@@ -21,7 +21,12 @@ require('rollup-plugin-dts');
21
21
  require('@rollup/plugin-json');
22
22
  require('@rollup/plugin-yaml');
23
23
  require('rollup-pluginutils');
24
- require('./svgrTemplate-f19e974c.cjs.js');
24
+ require('./svgrTemplate-b7a4ee52.cjs.js');
25
+ require('./parallel-d8e5bcbf.cjs.js');
26
+ require('os');
27
+ require('worker_threads');
28
+ require('./packageRoles-f375a99e.cjs.js');
29
+ require('zod');
25
30
 
26
31
  var build = async (cmd) => {
27
32
  await packager.buildPackage({
@@ -32,4 +37,4 @@ var build = async (cmd) => {
32
37
  };
33
38
 
34
39
  exports["default"] = build;
35
- //# sourceMappingURL=build-cda9d14b.cjs.js.map
40
+ //# sourceMappingURL=build-30d6e823.cjs.js.map