@backstage/cli-module-build 0.0.0-nightly-20260317031259
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +23 -0
- package/bin/backstage-cli-module-build +32 -0
- package/config/webpack-public-path.js +31 -0
- package/dist/commands/buildWorkspace.cjs.js +53 -0
- package/dist/commands/buildWorkspace.cjs.js.map +1 -0
- package/dist/commands/package/build/command.cjs.js +136 -0
- package/dist/commands/package/build/command.cjs.js.map +1 -0
- package/dist/commands/package/build/index.cjs.js +10 -0
- package/dist/commands/package/build/index.cjs.js.map +1 -0
- package/dist/commands/package/bundle/command.cjs.js +691 -0
- package/dist/commands/package/bundle/command.cjs.js.map +1 -0
- package/dist/commands/package/bundle/index.cjs.js +10 -0
- package/dist/commands/package/bundle/index.cjs.js.map +1 -0
- package/dist/commands/package/clean.cjs.js +21 -0
- package/dist/commands/package/clean.cjs.js.map +1 -0
- package/dist/commands/package/postpack.cjs.js +15 -0
- package/dist/commands/package/postpack.cjs.js.map +1 -0
- package/dist/commands/package/prepack.cjs.js +29 -0
- package/dist/commands/package/prepack.cjs.js.map +1 -0
- package/dist/commands/package/start/command.cjs.js +80 -0
- package/dist/commands/package/start/command.cjs.js.map +1 -0
- package/dist/commands/package/start/index.cjs.js +10 -0
- package/dist/commands/package/start/index.cjs.js.map +1 -0
- package/dist/commands/package/start/resolveLinkedWorkspace.cjs.js +34 -0
- package/dist/commands/package/start/resolveLinkedWorkspace.cjs.js.map +1 -0
- package/dist/commands/package/start/startBackend.cjs.js +46 -0
- package/dist/commands/package/start/startBackend.cjs.js.map +1 -0
- package/dist/commands/package/start/startFrontend.cjs.js +49 -0
- package/dist/commands/package/start/startFrontend.cjs.js.map +1 -0
- package/dist/commands/package/start/startPackage.cjs.js +53 -0
- package/dist/commands/package/start/startPackage.cjs.js.map +1 -0
- package/dist/commands/repo/build.cjs.js +149 -0
- package/dist/commands/repo/build.cjs.js.map +1 -0
- package/dist/commands/repo/clean.cjs.js +41 -0
- package/dist/commands/repo/clean.cjs.js.map +1 -0
- package/dist/commands/repo/start.cjs.js +199 -0
- package/dist/commands/repo/start.cjs.js.map +1 -0
- package/dist/index.cjs.js +74 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/lib/buildBackend.cjs.js +81 -0
- package/dist/lib/buildBackend.cjs.js.map +1 -0
- package/dist/lib/buildFrontend.cjs.js +49 -0
- package/dist/lib/buildFrontend.cjs.js.map +1 -0
- package/dist/lib/builder/config.cjs.js +257 -0
- package/dist/lib/builder/config.cjs.js.map +1 -0
- package/dist/lib/builder/packager.cjs.js +131 -0
- package/dist/lib/builder/packager.cjs.js.map +1 -0
- package/dist/lib/builder/plugins.cjs.js +125 -0
- package/dist/lib/builder/plugins.cjs.js.map +1 -0
- package/dist/lib/builder/types.cjs.js +10 -0
- package/dist/lib/builder/types.cjs.js.map +1 -0
- package/dist/lib/bundler/ConfigInjectingHtmlWebpackPlugin.cjs.js +43 -0
- package/dist/lib/bundler/ConfigInjectingHtmlWebpackPlugin.cjs.js.map +1 -0
- package/dist/lib/bundler/bundle.cjs.js +189 -0
- package/dist/lib/bundler/bundle.cjs.js.map +1 -0
- package/dist/lib/bundler/config.cjs.js +309 -0
- package/dist/lib/bundler/config.cjs.js.map +1 -0
- package/dist/lib/bundler/hasReactDomClient.cjs.js +17 -0
- package/dist/lib/bundler/hasReactDomClient.cjs.js.map +1 -0
- package/dist/lib/bundler/linkWorkspaces.cjs.js +34 -0
- package/dist/lib/bundler/linkWorkspaces.cjs.js.map +1 -0
- package/dist/lib/bundler/moduleFederation.cjs.js +135 -0
- package/dist/lib/bundler/moduleFederation.cjs.js.map +1 -0
- package/dist/lib/bundler/optimization.cjs.js +68 -0
- package/dist/lib/bundler/optimization.cjs.js.map +1 -0
- package/dist/lib/bundler/packageDetection.cjs.js +124 -0
- package/dist/lib/bundler/packageDetection.cjs.js.map +1 -0
- package/dist/lib/bundler/paths.cjs.js +62 -0
- package/dist/lib/bundler/paths.cjs.js.map +1 -0
- package/dist/lib/bundler/server.cjs.js +231 -0
- package/dist/lib/bundler/server.cjs.js.map +1 -0
- package/dist/lib/bundler/transforms.cjs.js +145 -0
- package/dist/lib/bundler/transforms.cjs.js.map +1 -0
- package/dist/lib/config.cjs.js +94 -0
- package/dist/lib/config.cjs.js.map +1 -0
- package/dist/lib/entryPoints.cjs.js +49 -0
- package/dist/lib/entryPoints.cjs.js.map +1 -0
- package/dist/lib/ipc/IpcServer.cjs.js +60 -0
- package/dist/lib/ipc/IpcServer.cjs.js.map +1 -0
- package/dist/lib/ipc/ServerDataStore.cjs.js +36 -0
- package/dist/lib/ipc/ServerDataStore.cjs.js.map +1 -0
- package/dist/lib/optionsParser.cjs.js +22 -0
- package/dist/lib/optionsParser.cjs.js.map +1 -0
- package/dist/lib/packager/createDistWorkspace.cjs.js +252 -0
- package/dist/lib/packager/createDistWorkspace.cjs.js.map +1 -0
- package/dist/lib/packager/productionPack.cjs.js +160 -0
- package/dist/lib/packager/productionPack.cjs.js.map +1 -0
- package/dist/lib/publishing.cjs.js +40 -0
- package/dist/lib/publishing.cjs.js.map +1 -0
- package/dist/lib/role.cjs.js +24 -0
- package/dist/lib/role.cjs.js.map +1 -0
- package/dist/lib/runner/runBackend.cjs.js +136 -0
- package/dist/lib/runner/runBackend.cjs.js.map +1 -0
- package/dist/lib/typeDistProject.cjs.js +89 -0
- package/dist/lib/typeDistProject.cjs.js.map +1 -0
- package/dist/lib/urls.cjs.js +13 -0
- package/dist/lib/urls.cjs.js.map +1 -0
- package/dist/package.json.cjs.js +143 -0
- package/dist/package.json.cjs.js.map +1 -0
- package/package.json +113 -0
- package/templates/serve_index.html +27 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fs = require('fs-extra');
|
|
4
|
+
var cliCommon = require('@backstage/cli-common');
|
|
5
|
+
var cliNode = require('@backstage/cli-node');
|
|
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
|
+
async function findRoleFromCommand(opts) {
|
|
12
|
+
if (opts.role) {
|
|
13
|
+
return cliNode.PackageRoles.getRoleInfo(opts.role).role;
|
|
14
|
+
}
|
|
15
|
+
const pkg = await fs__default.default.readJson(cliCommon.targetPaths.resolve("package.json"));
|
|
16
|
+
const info = cliNode.PackageRoles.getRoleFromPackage(pkg);
|
|
17
|
+
if (!info) {
|
|
18
|
+
throw new Error(`Target package must have 'backstage.role' set`);
|
|
19
|
+
}
|
|
20
|
+
return info;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.findRoleFromCommand = findRoleFromCommand;
|
|
24
|
+
//# sourceMappingURL=role.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.cjs.js","sources":["../../src/lib/role.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from 'fs-extra';\nimport { targetPaths } from '@backstage/cli-common';\n\nimport { PackageRoles, PackageRole } from '@backstage/cli-node';\n\nexport async function findRoleFromCommand(opts: {\n role?: string;\n}): Promise<PackageRole> {\n if (opts.role) {\n return PackageRoles.getRoleInfo(opts.role).role;\n }\n\n const pkg = await fs.readJson(targetPaths.resolve('package.json'));\n const info = PackageRoles.getRoleFromPackage(pkg);\n if (!info) {\n throw new Error(`Target package must have 'backstage.role' set`);\n }\n return info;\n}\n"],"names":["PackageRoles","fs","targetPaths"],"mappings":";;;;;;;;;;AAqBA,eAAsB,oBAAoB,IAAA,EAEjB;AACvB,EAAA,IAAI,KAAK,IAAA,EAAM;AACb,IAAA,OAAOA,oBAAA,CAAa,WAAA,CAAY,IAAA,CAAK,IAAI,CAAA,CAAE,IAAA;AAAA,EAC7C;AAEA,EAAA,MAAM,MAAM,MAAMC,mBAAA,CAAG,SAASC,qBAAA,CAAY,OAAA,CAAQ,cAAc,CAAC,CAAA;AACjE,EAAA,MAAM,IAAA,GAAOF,oBAAA,CAAa,kBAAA,CAAmB,GAAG,CAAA;AAChD,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,MAAM,IAAI,MAAM,CAAA,6CAAA,CAA+C,CAAA;AAAA,EACjE;AACA,EAAA,OAAO,IAAA;AACT;;;;"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chokidar = require('chokidar');
|
|
4
|
+
var ctrlcWindows = require('ctrlc-windows');
|
|
5
|
+
var IpcServer = require('../ipc/IpcServer.cjs.js');
|
|
6
|
+
var ServerDataStore = require('../ipc/ServerDataStore.cjs.js');
|
|
7
|
+
var debounce = require('lodash/debounce');
|
|
8
|
+
var node_url = require('node:url');
|
|
9
|
+
var node_path = require('node:path');
|
|
10
|
+
var cliCommon = require('@backstage/cli-common');
|
|
11
|
+
var spawn = require('cross-spawn');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
14
|
+
|
|
15
|
+
var debounce__default = /*#__PURE__*/_interopDefaultCompat(debounce);
|
|
16
|
+
var spawn__default = /*#__PURE__*/_interopDefaultCompat(spawn);
|
|
17
|
+
|
|
18
|
+
const loaderArgs = [
|
|
19
|
+
"--enable-source-maps",
|
|
20
|
+
"--require",
|
|
21
|
+
require.resolve("@backstage/cli-node/config/nodeTransform.cjs")
|
|
22
|
+
// TODO: Support modules, although there's currently no way to load them since import() is transpiled to require()
|
|
23
|
+
];
|
|
24
|
+
async function runBackend(options) {
|
|
25
|
+
const envEnv = process.env;
|
|
26
|
+
if (!envEnv.NODE_ENV) {
|
|
27
|
+
envEnv.NODE_ENV = "development";
|
|
28
|
+
}
|
|
29
|
+
const server = new IpcServer.IpcServer();
|
|
30
|
+
ServerDataStore.ServerDataStore.bind(server);
|
|
31
|
+
let exiting = false;
|
|
32
|
+
let firstStart = true;
|
|
33
|
+
let child;
|
|
34
|
+
let watcher = void 0;
|
|
35
|
+
let shutdownPromise = void 0;
|
|
36
|
+
const watchedPaths = /* @__PURE__ */ new Set();
|
|
37
|
+
const restart = debounce__default.default(async () => {
|
|
38
|
+
if (firstStart) {
|
|
39
|
+
firstStart = false;
|
|
40
|
+
} else {
|
|
41
|
+
console.log();
|
|
42
|
+
console.log("Change detected, restarting the development server...");
|
|
43
|
+
console.log();
|
|
44
|
+
}
|
|
45
|
+
if (shutdownPromise) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (child && !child.killed && child.exitCode === null) {
|
|
49
|
+
shutdownPromise = new Promise((resolve) => child.once("exit", resolve));
|
|
50
|
+
if (process.platform === "win32" && child.pid) {
|
|
51
|
+
ctrlcWindows.ctrlc(child.pid);
|
|
52
|
+
} else {
|
|
53
|
+
child.kill();
|
|
54
|
+
}
|
|
55
|
+
await shutdownPromise;
|
|
56
|
+
shutdownPromise = void 0;
|
|
57
|
+
}
|
|
58
|
+
if (exiting) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const optionArgs = new Array();
|
|
62
|
+
if (options.inspectEnabled) {
|
|
63
|
+
const inspect = typeof options.inspectEnabled === "string" ? `--inspect=${options.inspectEnabled}` : "--inspect";
|
|
64
|
+
optionArgs.push(inspect);
|
|
65
|
+
} else if (options.inspectBrkEnabled) {
|
|
66
|
+
const inspect = typeof options.inspectBrkEnabled === "string" ? `--inspect-brk=${options.inspectBrkEnabled}` : "--inspect-brk";
|
|
67
|
+
optionArgs.push(inspect);
|
|
68
|
+
}
|
|
69
|
+
if (options.require) {
|
|
70
|
+
const requires = [options.require].flat();
|
|
71
|
+
for (const r of requires) {
|
|
72
|
+
optionArgs.push(`--require=${r}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!envEnv.NODE_OPTIONS?.includes("--node-snapshot")) {
|
|
76
|
+
optionArgs.push("--no-node-snapshot");
|
|
77
|
+
}
|
|
78
|
+
const userArgs = process.argv.slice(["node", "backstage-cli", "package", "start"].length).filter((arg) => !optionArgs.includes(arg));
|
|
79
|
+
child = spawn__default.default(
|
|
80
|
+
process.execPath,
|
|
81
|
+
[...loaderArgs, ...optionArgs, options.entry, ...userArgs],
|
|
82
|
+
{
|
|
83
|
+
stdio: ["ignore", "inherit", "inherit", "ipc"],
|
|
84
|
+
cwd: options.targetDir,
|
|
85
|
+
env: {
|
|
86
|
+
...process.env,
|
|
87
|
+
BACKSTAGE_CLI_LINKED_WORKSPACE: options.linkedWorkspace,
|
|
88
|
+
BACKSTAGE_CLI_CHANNEL: "1",
|
|
89
|
+
ESBK_TSCONFIG_PATH: cliCommon.targetPaths.resolveRoot("tsconfig.json")
|
|
90
|
+
},
|
|
91
|
+
serialization: "advanced"
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
server.addChild(child);
|
|
95
|
+
child.on("message", (data) => {
|
|
96
|
+
if (!watcher) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (typeof data === "object" && data?.type === "watch") {
|
|
100
|
+
let path = data.path;
|
|
101
|
+
if (path.startsWith("file:")) {
|
|
102
|
+
path = node_url.fileURLToPath(path);
|
|
103
|
+
}
|
|
104
|
+
if (node_path.isAbsolute(path) && !watchedPaths.has(path)) {
|
|
105
|
+
watchedPaths.add(path);
|
|
106
|
+
watcher.add(path);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}, 100);
|
|
111
|
+
restart();
|
|
112
|
+
watcher = chokidar.watch(["./package.json"], {
|
|
113
|
+
cwd: process.cwd(),
|
|
114
|
+
ignoreInitial: true,
|
|
115
|
+
ignorePermissionErrors: true
|
|
116
|
+
}).on("all", restart);
|
|
117
|
+
process.stdin.on("data", restart);
|
|
118
|
+
const exitPromise = new Promise((resolveExitPromise) => {
|
|
119
|
+
async function handleSignal(signal) {
|
|
120
|
+
exiting = true;
|
|
121
|
+
if (child && child.exitCode === null) {
|
|
122
|
+
await new Promise((resolve) => {
|
|
123
|
+
child.on("close", resolve);
|
|
124
|
+
child.kill(signal);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
resolveExitPromise();
|
|
128
|
+
}
|
|
129
|
+
process.once("SIGINT", handleSignal);
|
|
130
|
+
process.once("SIGTERM", handleSignal);
|
|
131
|
+
});
|
|
132
|
+
return () => exitPromise;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
exports.runBackend = runBackend;
|
|
136
|
+
//# sourceMappingURL=runBackend.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runBackend.cjs.js","sources":["../../../src/lib/runner/runBackend.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FSWatcher, watch } from 'chokidar';\nimport type { ChildProcess } from 'node:child_process';\nimport { ctrlc } from 'ctrlc-windows';\nimport { IpcServer, ServerDataStore } from '../ipc';\nimport debounce from 'lodash/debounce';\nimport { fileURLToPath } from 'node:url';\nimport { isAbsolute as isAbsolutePath } from 'node:path';\nimport { targetPaths } from '@backstage/cli-common';\n\nimport spawn from 'cross-spawn';\n\nconst loaderArgs = [\n '--enable-source-maps',\n '--require',\n require.resolve('@backstage/cli-node/config/nodeTransform.cjs'),\n // TODO: Support modules, although there's currently no way to load them since import() is transpiled to require()\n];\n\nexport type RunBackendOptions = {\n /** The directory to run the backend process in, defaults to cwd */\n targetDir?: string;\n /** relative entry point path without extension, e.g. 'src/index' */\n entry: string;\n /** Whether to forward the --inspect flag to the node process */\n inspectEnabled?: boolean | string;\n /** Whether to forward the --inspect-brk flag to the node process */\n inspectBrkEnabled?: boolean | string;\n /** Additional module to require via the --require flag to the node process */\n require?: string | string[];\n /** An external linked workspace to override module resolution towards */\n linkedWorkspace?: string;\n};\n\nexport async function runBackend(options: RunBackendOptions) {\n const envEnv = process.env as { NODE_ENV: string; NODE_OPTIONS?: string };\n if (!envEnv.NODE_ENV) {\n envEnv.NODE_ENV = 'development';\n }\n\n // Set up the parent IPC server and bind the available services\n const server = new IpcServer();\n ServerDataStore.bind(server);\n\n let exiting = false;\n let firstStart = true;\n let child: ChildProcess | undefined;\n let watcher: FSWatcher | undefined = undefined;\n let shutdownPromise: Promise<void> | undefined = undefined;\n\n const watchedPaths = new Set<string>();\n\n const restart = debounce(async () => {\n if (firstStart) {\n firstStart = false;\n } else {\n console.log();\n console.log('Change detected, restarting the development server...');\n console.log();\n }\n // If a re-trigger happens during an existing shutdown, we just ignore it\n if (shutdownPromise) {\n return;\n }\n\n if (child && !child.killed && child.exitCode === null) {\n // We always wait for the existing process to exit, to make sure we don't get IPC conflicts\n shutdownPromise = new Promise(resolve => child!.once('exit', resolve));\n if (process.platform === 'win32' && child.pid) {\n ctrlc(child.pid);\n } else {\n child.kill();\n }\n await shutdownPromise;\n shutdownPromise = undefined;\n }\n\n // We've received a shutdown signal\n if (exiting) {\n return;\n }\n\n const optionArgs = new Array<string>();\n if (options.inspectEnabled) {\n const inspect =\n typeof options.inspectEnabled === 'string'\n ? `--inspect=${options.inspectEnabled}`\n : '--inspect';\n optionArgs.push(inspect);\n } else if (options.inspectBrkEnabled) {\n const inspect =\n typeof options.inspectBrkEnabled === 'string'\n ? `--inspect-brk=${options.inspectBrkEnabled}`\n : '--inspect-brk';\n optionArgs.push(inspect);\n }\n if (options.require) {\n const requires = [options.require].flat();\n for (const r of requires) {\n optionArgs.push(`--require=${r}`);\n }\n }\n\n // Unless the user explicitly toggles node-snapshot, default to provide --no-node-snapshot to reduce number of steps to run scaffolder\n // on Node LTS.\n if (!envEnv.NODE_OPTIONS?.includes('--node-snapshot')) {\n optionArgs.push('--no-node-snapshot');\n }\n\n const userArgs = process.argv\n .slice(['node', 'backstage-cli', 'package', 'start'].length)\n .filter(arg => !optionArgs.includes(arg));\n\n child = spawn(\n process.execPath,\n [...loaderArgs, ...optionArgs, options.entry, ...userArgs],\n {\n stdio: ['ignore', 'inherit', 'inherit', 'ipc'],\n cwd: options.targetDir,\n env: {\n ...process.env,\n BACKSTAGE_CLI_LINKED_WORKSPACE: options.linkedWorkspace,\n BACKSTAGE_CLI_CHANNEL: '1',\n ESBK_TSCONFIG_PATH: targetPaths.resolveRoot('tsconfig.json'),\n },\n serialization: 'advanced',\n },\n );\n\n server.addChild(child);\n\n // This captures messages sent by @esbuild-kit/cjs-loader\n child.on('message', (data: { type?: string } | null) => {\n if (!watcher) {\n return;\n }\n if (typeof data === 'object' && data?.type === 'watch') {\n let path = (data as { path: string }).path;\n if (path.startsWith('file:')) {\n path = fileURLToPath(path);\n }\n\n if (isAbsolutePath(path) && !watchedPaths.has(path)) {\n watchedPaths.add(path);\n watcher.add(path);\n }\n }\n });\n }, 100);\n\n restart();\n\n watcher = watch(['./package.json'], {\n cwd: process.cwd(),\n ignoreInitial: true,\n ignorePermissionErrors: true,\n }).on('all', restart);\n\n // Trigger restart on hitting enter in the terminal\n process.stdin.on('data', restart);\n\n const exitPromise = new Promise<void>(resolveExitPromise => {\n async function handleSignal(signal: NodeJS.Signals) {\n exiting = true;\n\n // Forward signals to child and wait for it to exit if still running\n if (child && child.exitCode === null) {\n await new Promise(resolve => {\n child!.on('close', resolve);\n child!.kill(signal);\n });\n }\n\n resolveExitPromise();\n }\n\n process.once('SIGINT', handleSignal);\n process.once('SIGTERM', handleSignal);\n });\n\n return () => exitPromise;\n}\n"],"names":["IpcServer","ServerDataStore","debounce","ctrlc","spawn","targetPaths","fileURLToPath","isAbsolutePath","watch"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,MAAM,UAAA,GAAa;AAAA,EACjB,sBAAA;AAAA,EACA,WAAA;AAAA,EACA,OAAA,CAAQ,QAAQ,8CAA8C;AAAA;AAEhE,CAAA;AAiBA,eAAsB,WAAW,OAAA,EAA4B;AAC3D,EAAA,MAAM,SAAS,OAAA,CAAQ,GAAA;AACvB,EAAA,IAAI,CAAC,OAAO,QAAA,EAAU;AACpB,IAAA,MAAA,CAAO,QAAA,GAAW,aAAA;AAAA,EACpB;AAGA,EAAA,MAAM,MAAA,GAAS,IAAIA,mBAAA,EAAU;AAC7B,EAAAC,+BAAA,CAAgB,KAAK,MAAM,CAAA;AAE3B,EAAA,IAAI,OAAA,GAAU,KAAA;AACd,EAAA,IAAI,UAAA,GAAa,IAAA;AACjB,EAAA,IAAI,KAAA;AACJ,EAAA,IAAI,OAAA,GAAiC,MAAA;AACrC,EAAA,IAAI,eAAA,GAA6C,MAAA;AAEjD,EAAA,MAAM,YAAA,uBAAmB,GAAA,EAAY;AAErC,EAAA,MAAM,OAAA,GAAUC,0BAAS,YAAY;AACnC,IAAA,IAAI,UAAA,EAAY;AACd,MAAA,UAAA,GAAa,KAAA;AAAA,IACf,CAAA,MAAO;AACL,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,OAAA,CAAQ,IAAI,uDAAuD,CAAA;AACnE,MAAA,OAAA,CAAQ,GAAA,EAAI;AAAA,IACd;AAEA,IAAA,IAAI,eAAA,EAAiB;AACnB,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,SAAS,CAAC,KAAA,CA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|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cliNode = require('@backstage/cli-node');
|
|
4
|
+
var node_path = require('node:path');
|
|
5
|
+
var tsMorph = require('ts-morph');
|
|
6
|
+
var cliCommon = require('@backstage/cli-common');
|
|
7
|
+
|
|
8
|
+
const createTypeDistProject = async () => {
|
|
9
|
+
return new tsMorph.Project({
|
|
10
|
+
tsConfigFilePath: cliCommon.targetPaths.resolveRoot("tsconfig.json"),
|
|
11
|
+
skipAddingFilesFromTsConfig: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
const targetPackageRoles = [
|
|
15
|
+
"backend-plugin",
|
|
16
|
+
"backend-plugin-module",
|
|
17
|
+
"frontend-plugin",
|
|
18
|
+
"frontend-plugin-module",
|
|
19
|
+
"web-library",
|
|
20
|
+
"node-library"
|
|
21
|
+
];
|
|
22
|
+
const getEntryPointDefaultFeatureType = (role, packageDir, project, entryPoint) => {
|
|
23
|
+
if (isTargetPackageRole(role)) {
|
|
24
|
+
const distPath = node_path.resolve(packageDir, entryPoint);
|
|
25
|
+
try {
|
|
26
|
+
const defaultFeatureType = getSourceFileDefaultFeatureType(
|
|
27
|
+
project.addSourceFileAtPath(distPath)
|
|
28
|
+
);
|
|
29
|
+
if (defaultFeatureType) {
|
|
30
|
+
return defaultFeatureType;
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error(
|
|
34
|
+
`Failed to extract default feature type from ${distPath}, ${error}. Your package will publish fine but it may be missing metadata about its default feature.`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
};
|
|
40
|
+
function getSourceFileDefaultFeatureType(sourceFile) {
|
|
41
|
+
for (const exportSymbol of sourceFile.getExportSymbols()) {
|
|
42
|
+
const declaration = exportSymbol.getDeclarations()[0];
|
|
43
|
+
const exportName = declaration.getSymbol()?.getName();
|
|
44
|
+
if (exportName !== "default") {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
let exportType;
|
|
48
|
+
if (declaration) {
|
|
49
|
+
if (declaration.isKind(tsMorph.SyntaxKind.ExportAssignment)) {
|
|
50
|
+
exportType = declaration.getExpression().getType();
|
|
51
|
+
} else if (declaration.isKind(tsMorph.SyntaxKind.ExportSpecifier)) {
|
|
52
|
+
if (!declaration.isTypeOnly()) {
|
|
53
|
+
exportType = declaration.getType();
|
|
54
|
+
}
|
|
55
|
+
} else if (declaration.isKind(tsMorph.SyntaxKind.VariableDeclaration)) {
|
|
56
|
+
exportType = declaration.getType();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (exportName && exportType) {
|
|
60
|
+
const $$type = getBackstagePackageFeature$$TypeFromType(exportType);
|
|
61
|
+
if ($$type) {
|
|
62
|
+
return $$type;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
function getBackstagePackageFeature$$TypeFromType(type) {
|
|
69
|
+
const exportType = type.getTargetType() ?? type;
|
|
70
|
+
for (const property of exportType.getProperties()) {
|
|
71
|
+
if (property.getName() === "$$type") {
|
|
72
|
+
const $$type = property.getValueDeclaration()?.getText().match(/(\$\$type: '(?<type>.+)')/)?.groups?.type;
|
|
73
|
+
if ($$type && isTargetFeatureType($$type)) {
|
|
74
|
+
return $$type;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
function isTargetPackageRole(role) {
|
|
81
|
+
return !!role && targetPackageRoles.includes(role);
|
|
82
|
+
}
|
|
83
|
+
function isTargetFeatureType(type) {
|
|
84
|
+
return !!type && cliNode.packageFeatureType.includes(type);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
exports.createTypeDistProject = createTypeDistProject;
|
|
88
|
+
exports.getEntryPointDefaultFeatureType = getEntryPointDefaultFeatureType;
|
|
89
|
+
//# sourceMappingURL=typeDistProject.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeDistProject.cjs.js","sources":["../../src/lib/typeDistProject.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n BackstagePackageFeatureType,\n packageFeatureType,\n PackageRole,\n} from '@backstage/cli-node';\nimport { resolve as resolvePath } from 'node:path';\nimport { Project, SourceFile, SyntaxKind, ts, Type } from 'ts-morph';\nimport { targetPaths } from '@backstage/cli-common';\n\nexport const createTypeDistProject = async () => {\n return new Project({\n tsConfigFilePath: targetPaths.resolveRoot('tsconfig.json'),\n skipAddingFilesFromTsConfig: true,\n });\n};\n\n// A list of the package roles we want to extract features for\nconst targetPackageRoles: PackageRole[] = [\n 'backend-plugin',\n 'backend-plugin-module',\n 'frontend-plugin',\n 'frontend-plugin-module',\n 'web-library',\n 'node-library',\n];\n\nexport const getEntryPointDefaultFeatureType = (\n role: PackageRole,\n packageDir: string,\n project: Project,\n entryPoint: string,\n): BackstagePackageFeatureType | null => {\n if (isTargetPackageRole(role)) {\n const distPath = resolvePath(packageDir, entryPoint);\n\n try {\n const defaultFeatureType = getSourceFileDefaultFeatureType(\n project.addSourceFileAtPath(distPath),\n );\n\n if (defaultFeatureType) {\n return defaultFeatureType;\n }\n } catch (error) {\n console.error(\n `Failed to extract default feature type from ${distPath}, ${error}. ` +\n 'Your package will publish fine but it may be missing metadata about its default feature.',\n );\n }\n }\n\n return null;\n};\n\n// Returns all exports (default and named) from an entry point\n// that are valid Backstage package features\nfunction getSourceFileDefaultFeatureType(\n sourceFile: SourceFile,\n): BackstagePackageFeatureType | null {\n for (const exportSymbol of sourceFile.getExportSymbols()) {\n const declaration = exportSymbol.getDeclarations()[0];\n const exportName = declaration.getSymbol()?.getName();\n\n if (exportName !== 'default') {\n continue;\n }\n\n let exportType: Type<ts.Type> | undefined;\n\n if (declaration) {\n if (declaration.isKind(SyntaxKind.ExportAssignment)) {\n exportType = declaration.getExpression().getType();\n } else if (declaration.isKind(SyntaxKind.ExportSpecifier)) {\n if (!declaration.isTypeOnly()) {\n exportType = declaration.getType();\n }\n } else if (declaration.isKind(SyntaxKind.VariableDeclaration)) {\n exportType = declaration.getType();\n }\n }\n\n if (exportName && exportType) {\n const $$type = getBackstagePackageFeature$$TypeFromType(exportType);\n\n if ($$type) {\n return $$type;\n }\n }\n }\n\n return null;\n}\n\n// Given a TS type, returns the Backstage package feature $$type value\nfunction getBackstagePackageFeature$$TypeFromType(\n type: Type,\n): BackstagePackageFeatureType | null {\n // Returns the concrete type of a generic type\n const exportType = type.getTargetType() ?? type;\n\n for (const property of exportType.getProperties()) {\n if (property.getName() === '$$type') {\n const $$type = property\n .getValueDeclaration()\n ?.getText()\n .match(/(\\$\\$type: '(?<type>.+)')/)?.groups?.type;\n\n if ($$type && isTargetFeatureType($$type)) {\n return $$type;\n }\n }\n }\n\n return null;\n}\n\n// Condition for a package role matches a target package role\nfunction isTargetPackageRole(role: PackageRole): boolean {\n return !!role && targetPackageRoles.includes(role);\n}\n\n// Returns whether an export is a valid Backstage package feature type\nfunction isTargetFeatureType(\n type: string | BackstagePackageFeatureType,\n): type is BackstagePackageFeatureType {\n return (\n !!type && packageFeatureType.includes(type as BackstagePackageFeatureType)\n );\n}\n"],"names":["Project","targetPaths","resolvePath","SyntaxKind","packageFeatureType"],"mappings":";;;;;;;AAwBO,MAAM,wBAAwB,YAAY;AAC/C,EAAA,OAAO,IAAIA,eAAA,CAAQ;AAAA,IACjB,gBAAA,EAAkBC,qBAAA,CAAY,WAAA,CAAY,eAAe,CAAA;AAAA,IACzD,2BAAA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AC,CAAC,IAAA,IAAQC,0BAAA,CAAmB,SAAS,IAAmC,CAAA;AAE7E;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urls.cjs.js","sources":["../../src/lib/urls.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function isValidUrl(url: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n"],"names":[],"mappings":";;AAgBO,SAAS,WAAW,GAAA,EAAsB;AAC/C,EAAA,IAAI;AAEF,IAAA,IAAI,IAAI,GAAG,CAAA;AACX,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;;;;"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var name = "@backstage/cli-module-build";
|
|
6
|
+
var version = "0.0.0-nightly-20260317031259";
|
|
7
|
+
var description = "CLI module for Backstage CLI";
|
|
8
|
+
var backstage = {
|
|
9
|
+
role: "cli-module"
|
|
10
|
+
};
|
|
11
|
+
var publishConfig = {
|
|
12
|
+
access: "public",
|
|
13
|
+
main: "dist/index.cjs.js",
|
|
14
|
+
types: "dist/index.d.ts"
|
|
15
|
+
};
|
|
16
|
+
var homepage = "https://backstage.io";
|
|
17
|
+
var repository = {
|
|
18
|
+
type: "git",
|
|
19
|
+
url: "https://github.com/backstage/backstage",
|
|
20
|
+
directory: "packages/cli-module-build"
|
|
21
|
+
};
|
|
22
|
+
var license = "Apache-2.0";
|
|
23
|
+
var main = "src/index.ts";
|
|
24
|
+
var types = "src/index.ts";
|
|
25
|
+
var bin = "bin/backstage-cli-module-build";
|
|
26
|
+
var files = [
|
|
27
|
+
"dist",
|
|
28
|
+
"bin",
|
|
29
|
+
"config",
|
|
30
|
+
"templates"
|
|
31
|
+
];
|
|
32
|
+
var scripts = {
|
|
33
|
+
build: "backstage-cli package build",
|
|
34
|
+
clean: "backstage-cli package clean",
|
|
35
|
+
lint: "backstage-cli package lint",
|
|
36
|
+
prepack: "backstage-cli package prepack",
|
|
37
|
+
postpack: "backstage-cli package postpack",
|
|
38
|
+
test: "backstage-cli package test"
|
|
39
|
+
};
|
|
40
|
+
var dependencies = {
|
|
41
|
+
"@backstage/cli-common": "workspace:*",
|
|
42
|
+
"@backstage/cli-node": "workspace:*",
|
|
43
|
+
"@backstage/config": "workspace:*",
|
|
44
|
+
"@backstage/config-loader": "workspace:*",
|
|
45
|
+
"@backstage/errors": "workspace:*",
|
|
46
|
+
"@backstage/module-federation-common": "workspace:*",
|
|
47
|
+
"@manypkg/get-packages": "^1.1.3",
|
|
48
|
+
"@module-federation/enhanced": "^0.21.6",
|
|
49
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.6.0",
|
|
50
|
+
"@rollup/plugin-commonjs": "^26.0.0",
|
|
51
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
52
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
53
|
+
"@rollup/plugin-yaml": "^4.0.0",
|
|
54
|
+
"@rspack/core": "^1.4.11",
|
|
55
|
+
"@rspack/dev-server": "^1.1.4",
|
|
56
|
+
"@rspack/plugin-react-refresh": "^1.4.3",
|
|
57
|
+
"@swc/core": "^1.15.6",
|
|
58
|
+
bfj: "^9.0.2",
|
|
59
|
+
buffer: "^6.0.3",
|
|
60
|
+
chalk: "^4.0.0",
|
|
61
|
+
chokidar: "^3.3.1",
|
|
62
|
+
cleye: "^2.3.0",
|
|
63
|
+
"cross-spawn": "^7.0.3",
|
|
64
|
+
"css-loader": "^6.5.1",
|
|
65
|
+
"ctrlc-windows": "^2.1.0",
|
|
66
|
+
"esbuild-loader": "^4.0.0",
|
|
67
|
+
"eslint-rspack-plugin": "^4.2.1",
|
|
68
|
+
"eslint-webpack-plugin": "^4.2.0",
|
|
69
|
+
"fork-ts-checker-webpack-plugin": "^9.0.0",
|
|
70
|
+
"fs-extra": "^11.2.0",
|
|
71
|
+
glob: "^7.1.7",
|
|
72
|
+
"html-webpack-plugin": "^5.6.3",
|
|
73
|
+
lodash: "^4.17.21",
|
|
74
|
+
"mini-css-extract-plugin": "^2.4.2",
|
|
75
|
+
"node-stdlib-browser": "^1.3.1",
|
|
76
|
+
"npm-packlist": "^5.0.0",
|
|
77
|
+
"p-queue": "^6.6.2",
|
|
78
|
+
postcss: "^8.1.0",
|
|
79
|
+
"postcss-import": "^16.1.0",
|
|
80
|
+
process: "^0.11.10",
|
|
81
|
+
"raw-loader": "^4.0.2",
|
|
82
|
+
"react-dev-utils": "^12.0.0-next.60",
|
|
83
|
+
"react-refresh": "^0.18.0",
|
|
84
|
+
rollup: "^4.27.3",
|
|
85
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
86
|
+
"rollup-plugin-esbuild": "^6.1.1",
|
|
87
|
+
"rollup-plugin-postcss": "^4.0.0",
|
|
88
|
+
"rollup-pluginutils": "^2.8.2",
|
|
89
|
+
"shell-quote": "^1.8.1",
|
|
90
|
+
"style-loader": "^3.3.1",
|
|
91
|
+
"swc-loader": "^0.2.3",
|
|
92
|
+
tar: "^7.5.6",
|
|
93
|
+
"ts-checker-rspack-plugin": "^1.1.5",
|
|
94
|
+
"ts-morph": "^24.0.0",
|
|
95
|
+
util: "^0.12.3",
|
|
96
|
+
webpack: "~5.105.0",
|
|
97
|
+
"webpack-dev-server": "^5.0.0",
|
|
98
|
+
"yml-loader": "^2.1.0",
|
|
99
|
+
yn: "^4.0.0"
|
|
100
|
+
};
|
|
101
|
+
var devDependencies = {
|
|
102
|
+
"@backstage/backend-test-utils": "workspace:*",
|
|
103
|
+
"@backstage/cli": "workspace:*",
|
|
104
|
+
"@types/fs-extra": "^11.0.0",
|
|
105
|
+
"@types/lodash": "^4.14.151",
|
|
106
|
+
"@types/npm-packlist": "^3.0.0",
|
|
107
|
+
"@types/shell-quote": "^1.7.5"
|
|
108
|
+
};
|
|
109
|
+
var packageJson = {
|
|
110
|
+
name: name,
|
|
111
|
+
version: version,
|
|
112
|
+
description: description,
|
|
113
|
+
backstage: backstage,
|
|
114
|
+
publishConfig: publishConfig,
|
|
115
|
+
homepage: homepage,
|
|
116
|
+
repository: repository,
|
|
117
|
+
license: license,
|
|
118
|
+
main: main,
|
|
119
|
+
types: types,
|
|
120
|
+
bin: bin,
|
|
121
|
+
files: files,
|
|
122
|
+
scripts: scripts,
|
|
123
|
+
dependencies: dependencies,
|
|
124
|
+
devDependencies: devDependencies
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
exports.backstage = backstage;
|
|
128
|
+
exports.bin = bin;
|
|
129
|
+
exports.default = packageJson;
|
|
130
|
+
exports.dependencies = dependencies;
|
|
131
|
+
exports.description = description;
|
|
132
|
+
exports.devDependencies = devDependencies;
|
|
133
|
+
exports.files = files;
|
|
134
|
+
exports.homepage = homepage;
|
|
135
|
+
exports.license = license;
|
|
136
|
+
exports.main = main;
|
|
137
|
+
exports.name = name;
|
|
138
|
+
exports.publishConfig = publishConfig;
|
|
139
|
+
exports.repository = repository;
|
|
140
|
+
exports.scripts = scripts;
|
|
141
|
+
exports.types = types;
|
|
142
|
+
exports.version = version;
|
|
143
|
+
//# sourceMappingURL=package.json.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.json.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backstage/cli-module-build",
|
|
3
|
+
"version": "0.0.0-nightly-20260317031259",
|
|
4
|
+
"description": "CLI module for Backstage CLI",
|
|
5
|
+
"backstage": {
|
|
6
|
+
"role": "cli-module"
|
|
7
|
+
},
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"main": "dist/index.cjs.js",
|
|
11
|
+
"types": "dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://backstage.io",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/backstage/backstage",
|
|
17
|
+
"directory": "packages/cli-module-build"
|
|
18
|
+
},
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
|
+
"main": "dist/index.cjs.js",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"bin": "bin/backstage-cli-module-build",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"bin",
|
|
26
|
+
"config",
|
|
27
|
+
"templates"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "backstage-cli package build",
|
|
31
|
+
"clean": "backstage-cli package clean",
|
|
32
|
+
"lint": "backstage-cli package lint",
|
|
33
|
+
"prepack": "backstage-cli package prepack",
|
|
34
|
+
"postpack": "backstage-cli package postpack",
|
|
35
|
+
"test": "backstage-cli package test"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@backstage/cli-common": "0.0.0-nightly-20260317031259",
|
|
39
|
+
"@backstage/cli-node": "0.0.0-nightly-20260317031259",
|
|
40
|
+
"@backstage/config": "1.3.6",
|
|
41
|
+
"@backstage/config-loader": "0.0.0-nightly-20260317031259",
|
|
42
|
+
"@backstage/errors": "1.2.7",
|
|
43
|
+
"@backstage/module-federation-common": "0.0.0-nightly-20260317031259",
|
|
44
|
+
"@manypkg/get-packages": "^1.1.3",
|
|
45
|
+
"@module-federation/enhanced": "^0.21.6",
|
|
46
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.6.0",
|
|
47
|
+
"@rollup/plugin-commonjs": "^26.0.0",
|
|
48
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
49
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
50
|
+
"@rollup/plugin-yaml": "^4.0.0",
|
|
51
|
+
"@rspack/core": "^1.4.11",
|
|
52
|
+
"@rspack/dev-server": "^1.1.4",
|
|
53
|
+
"@rspack/plugin-react-refresh": "^1.4.3",
|
|
54
|
+
"@swc/core": "^1.15.6",
|
|
55
|
+
"bfj": "^9.0.2",
|
|
56
|
+
"buffer": "^6.0.3",
|
|
57
|
+
"chalk": "^4.0.0",
|
|
58
|
+
"chokidar": "^3.3.1",
|
|
59
|
+
"cleye": "^2.3.0",
|
|
60
|
+
"cross-spawn": "^7.0.3",
|
|
61
|
+
"css-loader": "^6.5.1",
|
|
62
|
+
"ctrlc-windows": "^2.1.0",
|
|
63
|
+
"esbuild-loader": "^4.0.0",
|
|
64
|
+
"eslint-rspack-plugin": "^4.2.1",
|
|
65
|
+
"eslint-webpack-plugin": "^4.2.0",
|
|
66
|
+
"fork-ts-checker-webpack-plugin": "^9.0.0",
|
|
67
|
+
"fs-extra": "^11.2.0",
|
|
68
|
+
"glob": "^7.1.7",
|
|
69
|
+
"html-webpack-plugin": "^5.6.3",
|
|
70
|
+
"lodash": "^4.17.21",
|
|
71
|
+
"mini-css-extract-plugin": "^2.4.2",
|
|
72
|
+
"node-stdlib-browser": "^1.3.1",
|
|
73
|
+
"npm-packlist": "^5.0.0",
|
|
74
|
+
"p-queue": "^6.6.2",
|
|
75
|
+
"postcss": "^8.1.0",
|
|
76
|
+
"postcss-import": "^16.1.0",
|
|
77
|
+
"process": "^0.11.10",
|
|
78
|
+
"raw-loader": "^4.0.2",
|
|
79
|
+
"react-dev-utils": "^12.0.0-next.60",
|
|
80
|
+
"react-refresh": "^0.18.0",
|
|
81
|
+
"rollup": "^4.27.3",
|
|
82
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
83
|
+
"rollup-plugin-esbuild": "^6.1.1",
|
|
84
|
+
"rollup-plugin-postcss": "^4.0.0",
|
|
85
|
+
"rollup-pluginutils": "^2.8.2",
|
|
86
|
+
"shell-quote": "^1.8.1",
|
|
87
|
+
"style-loader": "^3.3.1",
|
|
88
|
+
"swc-loader": "^0.2.3",
|
|
89
|
+
"tar": "^7.5.6",
|
|
90
|
+
"ts-checker-rspack-plugin": "^1.1.5",
|
|
91
|
+
"ts-morph": "^24.0.0",
|
|
92
|
+
"util": "^0.12.3",
|
|
93
|
+
"webpack": "~5.105.0",
|
|
94
|
+
"webpack-dev-server": "^5.0.0",
|
|
95
|
+
"yml-loader": "^2.1.0",
|
|
96
|
+
"yn": "^4.0.0"
|
|
97
|
+
},
|
|
98
|
+
"devDependencies": {
|
|
99
|
+
"@backstage/backend-test-utils": "0.0.0-nightly-20260317031259",
|
|
100
|
+
"@backstage/cli": "0.0.0-nightly-20260317031259",
|
|
101
|
+
"@types/fs-extra": "^11.0.0",
|
|
102
|
+
"@types/lodash": "^4.14.151",
|
|
103
|
+
"@types/npm-packlist": "^3.0.0",
|
|
104
|
+
"@types/shell-quote": "^1.7.5"
|
|
105
|
+
},
|
|
106
|
+
"typesVersions": {
|
|
107
|
+
"*": {
|
|
108
|
+
"package.json": [
|
|
109
|
+
"package.json"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="theme-color" content="#000000" />
|
|
7
|
+
<meta
|
|
8
|
+
name="description"
|
|
9
|
+
content="Backstage is an open source framework for building developer portals"
|
|
10
|
+
/>
|
|
11
|
+
<title>Backstage</title>
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
15
|
+
<div id="root"></div>
|
|
16
|
+
<!--
|
|
17
|
+
This HTML file is a template.
|
|
18
|
+
If you open it directly in the browser, you will see an empty page.
|
|
19
|
+
|
|
20
|
+
You can add webfonts, meta tags, or analytics to this file.
|
|
21
|
+
The build step will place the bundled scripts into the <body> tag.
|
|
22
|
+
|
|
23
|
+
To begin the development, run `yarn start`.
|
|
24
|
+
To create a production bundle, use `yarn build`.
|
|
25
|
+
-->
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|