@backstage/cli 0.36.0-next.2 → 0.36.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.
- package/CHANGELOG.md +95 -0
- package/config/eslint-factory.js +1 -0
- package/config/getJestEnvironment.js +7 -29
- package/config/jest-environment-jsdom/index.js +9 -43
- package/config/jest.js +7 -401
- package/config/jestCacheResultProcessor.cjs +10 -6
- package/config/jestCachingModuleLoader.js +11 -19
- package/config/jestFileTransform.js +11 -28
- package/config/jestRejectNetworkRequests.js +10 -53
- package/config/jestSucraseTransform.js +10 -70
- package/config/jestSwcTransform.js +10 -27
- package/config/jestYamlTransform.js +11 -24
- package/config/nodeTransform.cjs +10 -70
- package/config/nodeTransformHooks.mjs +4 -278
- package/config/webpack-public-path.js +10 -14
- package/dist/cli-internal/src/InternalCliModule.cjs.js +11 -0
- package/dist/cli-internal/src/InternalCommandNode.cjs.js +25 -0
- package/dist/cli-internal/src/knownPluginPackages.cjs.js +40 -0
- package/dist/index.cjs.js +21 -11
- package/dist/wiring/CliInitializer.cjs.js +61 -30
- package/dist/wiring/CommandGraph.cjs.js +81 -23
- package/dist/wiring/discoverCliModules.cjs.js +44 -0
- package/package.json +27 -160
- package/dist/modules/auth/commands/list.cjs.js +0 -23
- package/dist/modules/auth/commands/login.cjs.js +0 -316
- package/dist/modules/auth/commands/logout.cjs.js +0 -55
- package/dist/modules/auth/commands/printToken.cjs.js +0 -41
- package/dist/modules/auth/commands/select.cjs.js +0 -32
- package/dist/modules/auth/commands/show.cjs.js +0 -59
- package/dist/modules/auth/index.cjs.js +0 -44
- package/dist/modules/auth/lib/auth.cjs.js +0 -60
- package/dist/modules/auth/lib/http.cjs.js +0 -26
- package/dist/modules/auth/lib/localServer.cjs.js +0 -80
- package/dist/modules/auth/lib/pkce.cjs.js +0 -23
- package/dist/modules/auth/lib/prompt.cjs.js +0 -44
- package/dist/modules/auth/lib/secretStore.cjs.js +0 -81
- package/dist/modules/auth/lib/storage.cjs.js +0 -152
- package/dist/modules/build/commands/buildWorkspace.cjs.js +0 -53
- package/dist/modules/build/commands/package/build/command.cjs.js +0 -136
- package/dist/modules/build/commands/package/build/index.cjs.js +0 -10
- package/dist/modules/build/commands/package/clean.cjs.js +0 -21
- package/dist/modules/build/commands/package/postpack.cjs.js +0 -15
- package/dist/modules/build/commands/package/prepack.cjs.js +0 -29
- package/dist/modules/build/commands/package/start/command.cjs.js +0 -80
- package/dist/modules/build/commands/package/start/index.cjs.js +0 -10
- package/dist/modules/build/commands/package/start/resolveLinkedWorkspace.cjs.js +0 -34
- package/dist/modules/build/commands/package/start/startBackend.cjs.js +0 -46
- package/dist/modules/build/commands/package/start/startFrontend.cjs.js +0 -50
- package/dist/modules/build/commands/package/start/startPackage.cjs.js +0 -53
- package/dist/modules/build/commands/repo/build.cjs.js +0 -149
- package/dist/modules/build/commands/repo/clean.cjs.js +0 -41
- package/dist/modules/build/commands/repo/start.cjs.js +0 -199
- package/dist/modules/build/index.cjs.js +0 -68
- package/dist/modules/build/lib/buildBackend.cjs.js +0 -81
- package/dist/modules/build/lib/buildFrontend.cjs.js +0 -50
- package/dist/modules/build/lib/builder/config.cjs.js +0 -257
- package/dist/modules/build/lib/builder/packager.cjs.js +0 -131
- package/dist/modules/build/lib/builder/plugins.cjs.js +0 -125
- package/dist/modules/build/lib/builder/types.cjs.js +0 -10
- package/dist/modules/build/lib/bundler/ConfigInjectingHtmlWebpackPlugin.cjs.js +0 -43
- package/dist/modules/build/lib/bundler/bundle.cjs.js +0 -189
- package/dist/modules/build/lib/bundler/config.cjs.js +0 -308
- package/dist/modules/build/lib/bundler/hasReactDomClient.cjs.js +0 -17
- package/dist/modules/build/lib/bundler/linkWorkspaces.cjs.js +0 -34
- package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +0 -135
- package/dist/modules/build/lib/bundler/optimization.cjs.js +0 -68
- package/dist/modules/build/lib/bundler/packageDetection.cjs.js +0 -124
- package/dist/modules/build/lib/bundler/paths.cjs.js +0 -62
- package/dist/modules/build/lib/bundler/server.cjs.js +0 -231
- package/dist/modules/build/lib/bundler/transforms.cjs.js +0 -145
- package/dist/modules/build/lib/config.cjs.js +0 -94
- package/dist/modules/build/lib/entryPoints.cjs.js +0 -49
- package/dist/modules/build/lib/ipc/IpcServer.cjs.js +0 -60
- package/dist/modules/build/lib/ipc/ServerDataStore.cjs.js +0 -36
- package/dist/modules/build/lib/optionsParser.cjs.js +0 -22
- package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +0 -235
- package/dist/modules/build/lib/packager/productionPack.cjs.js +0 -160
- package/dist/modules/build/lib/publishing.cjs.js +0 -40
- package/dist/modules/build/lib/role.cjs.js +0 -24
- package/dist/modules/build/lib/runner/runBackend.cjs.js +0 -136
- package/dist/modules/build/lib/typeDistProject.cjs.js +0 -89
- package/dist/modules/build/lib/urls.cjs.js +0 -13
- package/dist/modules/config/commands/docs.cjs.js +0 -63
- package/dist/modules/config/commands/print.cjs.js +0 -81
- package/dist/modules/config/commands/schema.cjs.js +0 -56
- package/dist/modules/config/commands/validate.cjs.js +0 -50
- package/dist/modules/config/index.cjs.js +0 -51
- package/dist/modules/config/lib/config.cjs.js +0 -94
- package/dist/modules/create-github-app/commands/create-github-app/GithubCreateAppServer.cjs.js +0 -127
- package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +0 -126
- package/dist/modules/create-github-app/index.cjs.js +0 -19
- package/dist/modules/info/commands/info.cjs.js +0 -182
- package/dist/modules/info/index.cjs.js +0 -19
- package/dist/modules/lint/commands/package/lint.cjs.js +0 -78
- package/dist/modules/lint/commands/repo/lint.cjs.js +0 -282
- package/dist/modules/lint/index.cjs.js +0 -24
- package/dist/modules/lint/lib/optionsParser.cjs.js +0 -22
- package/dist/modules/maintenance/commands/repo/fix.cjs.js +0 -426
- package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +0 -90
- package/dist/modules/maintenance/index.cjs.js +0 -24
- package/dist/modules/migrate/commands/packageExports.cjs.js +0 -15
- package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +0 -77
- package/dist/modules/migrate/commands/packageRole.cjs.js +0 -57
- package/dist/modules/migrate/commands/packageScripts.cjs.js +0 -87
- package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +0 -51
- package/dist/modules/migrate/commands/versions/bump.cjs.js +0 -403
- package/dist/modules/migrate/commands/versions/migrate.cjs.js +0 -133
- package/dist/modules/migrate/index.cjs.js +0 -59
- package/dist/modules/migrate/lib/utils.cjs.js +0 -44
- package/dist/modules/migrate/lib/versioning/packages.cjs.js +0 -71
- package/dist/modules/migrate/lib/versioning/yarn.cjs.js +0 -28
- package/dist/modules/new/commands/new.cjs.js +0 -115
- package/dist/modules/new/index.cjs.js +0 -40
- package/dist/modules/new/lib/codeowners/codeowners.cjs.js +0 -92
- package/dist/modules/new/lib/createNewPackage.cjs.js +0 -32
- package/dist/modules/new/lib/defaultTemplates.cjs.js +0 -17
- package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +0 -89
- package/dist/modules/new/lib/execution/executePortableTemplate.cjs.js +0 -66
- package/dist/modules/new/lib/execution/installNewPackage.cjs.js +0 -127
- package/dist/modules/new/lib/execution/writeTemplateContents.cjs.js +0 -116
- package/dist/modules/new/lib/preparation/collectPortableTemplateInput.cjs.js +0 -157
- package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +0 -81
- package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +0 -132
- package/dist/modules/new/lib/preparation/resolvePackageParams.cjs.js +0 -40
- package/dist/modules/new/lib/preparation/selectTemplateInteractively.cjs.js +0 -38
- package/dist/modules/new/lib/tasks.cjs.js +0 -51
- package/dist/modules/new/lib/types.cjs.js +0 -19
- package/dist/modules/new/lib/version.cjs.js +0 -91
- package/dist/modules/test/commands/package/test.cjs.js +0 -59
- package/dist/modules/test/commands/repo/test.cjs.js +0 -299
- package/dist/modules/test/index.cjs.js +0 -24
- package/dist/modules/translations/commands/export.cjs.js +0 -128
- package/dist/modules/translations/commands/import.cjs.js +0 -165
- package/dist/modules/translations/index.cjs.js +0 -24
- package/dist/modules/translations/lib/discoverPackages.cjs.js +0 -121
- package/dist/modules/translations/lib/extractTranslations.cjs.js +0 -71
- package/dist/modules/translations/lib/messageFilePath.cjs.js +0 -43
- package/dist/packages/backend-defaults/package.json.cjs.js +0 -6
- package/dist/packages/backend-plugin-api/package.json.cjs.js +0 -6
- package/dist/packages/backend-test-utils/package.json.cjs.js +0 -6
- package/dist/packages/catalog-client/package.json.cjs.js +0 -6
- package/dist/packages/cli/package.json.cjs.js +0 -159
- package/dist/packages/config/package.json.cjs.js +0 -6
- package/dist/packages/core-app-api/package.json.cjs.js +0 -6
- package/dist/packages/core-components/package.json.cjs.js +0 -6
- package/dist/packages/core-plugin-api/package.json.cjs.js +0 -6
- package/dist/packages/dev-utils/package.json.cjs.js +0 -6
- package/dist/packages/errors/package.json.cjs.js +0 -6
- package/dist/packages/frontend-defaults/package.json.cjs.js +0 -6
- package/dist/packages/frontend-plugin-api/package.json.cjs.js +0 -6
- package/dist/packages/frontend-plugin-api/src/routing/describeParentCallSite.cjs.js +0 -26
- package/dist/packages/frontend-test-utils/package.json.cjs.js +0 -6
- package/dist/packages/test-utils/package.json.cjs.js +0 -6
- package/dist/packages/theme/package.json.cjs.js +0 -6
- package/dist/packages/types/package.json.cjs.js +0 -6
- package/dist/plugins/auth-backend/package.json.cjs.js +0 -6
- package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +0 -6
- package/dist/plugins/catalog-node/package.json.cjs.js +0 -6
- package/dist/plugins/scaffolder-node/package.json.cjs.js +0 -6
- package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +0 -6
- package/dist/wiring/CommandRegistry.cjs.js +0 -14
- package/dist/wiring/factory.cjs.js +0 -15
- package/dist/wiring/types.cjs.js +0 -11
- package/templates/backend-plugin/.eslintrc.js.hbs +0 -1
- package/templates/backend-plugin/README.md.hbs +0 -28
- package/templates/backend-plugin/dev/index.ts.hbs +0 -60
- package/templates/backend-plugin/package.json.hbs +0 -44
- package/templates/backend-plugin/portable-template.yaml +0 -5
- package/templates/backend-plugin/src/index.ts.hbs +0 -1
- package/templates/backend-plugin/src/plugin.test.ts.hbs +0 -129
- package/templates/backend-plugin/src/plugin.ts.hbs +0 -32
- package/templates/backend-plugin/src/router.test.ts +0 -67
- package/templates/backend-plugin/src/router.ts +0 -51
- package/templates/backend-plugin/src/services/TodoListService.ts +0 -155
- package/templates/backend-plugin/src/setupTests.ts +0 -1
- package/templates/backend-plugin-module/.eslintrc.js.hbs +0 -1
- package/templates/backend-plugin-module/README.md.hbs +0 -5
- package/templates/backend-plugin-module/package.json.hbs +0 -34
- package/templates/backend-plugin-module/portable-template.yaml +0 -5
- package/templates/backend-plugin-module/src/index.ts.hbs +0 -8
- package/templates/backend-plugin-module/src/module.ts.hbs +0 -17
- package/templates/catalog-provider-module/.eslintrc.js.hbs +0 -1
- package/templates/catalog-provider-module/README.md.hbs +0 -5
- package/templates/catalog-provider-module/config.d.ts.hbs +0 -34
- package/templates/catalog-provider-module/package.json.hbs +0 -36
- package/templates/catalog-provider-module/portable-template.yaml +0 -9
- package/templates/catalog-provider-module/src/index.ts.hbs +0 -8
- package/templates/catalog-provider-module/src/module.ts.hbs +0 -29
- package/templates/catalog-provider-module/src/provider/readProviderConfigs.ts.hbs +0 -78
- package/templates/catalog-provider-module/src/provider/{{providerClass}}.test.ts.hbs +0 -18
- package/templates/catalog-provider-module/src/provider/{{providerClass}}.ts.hbs +0 -109
- package/templates/frontend-plugin/.eslintrc.js.hbs +0 -1
- package/templates/frontend-plugin/README.md.hbs +0 -13
- package/templates/frontend-plugin/dev/index.tsx.hbs +0 -11
- package/templates/frontend-plugin/package.json.hbs +0 -54
- package/templates/frontend-plugin/portable-template.yaml +0 -6
- package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -28
- package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -37
- package/templates/frontend-plugin/src/components/ExampleComponent/index.ts +0 -1
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -19
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -308
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/index.ts +0 -1
- package/templates/frontend-plugin/src/index.ts.hbs +0 -1
- package/templates/frontend-plugin/src/plugin.test.ts.hbs +0 -7
- package/templates/frontend-plugin/src/plugin.ts.hbs +0 -22
- package/templates/frontend-plugin/src/routes.ts.hbs +0 -5
- package/templates/frontend-plugin/src/setupTests.ts +0 -1
- package/templates/new-frontend-plugin/.eslintrc.js.hbs +0 -1
- package/templates/new-frontend-plugin/README.md.hbs +0 -20
- package/templates/new-frontend-plugin/dev/index.tsx +0 -10
- package/templates/new-frontend-plugin/package.json.hbs +0 -49
- package/templates/new-frontend-plugin/portable-template.yaml +0 -5
- package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -28
- package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -37
- package/templates/new-frontend-plugin/src/components/ExampleComponent/index.ts +0 -1
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -19
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -308
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/index.ts +0 -1
- package/templates/new-frontend-plugin/src/index.ts.hbs +0 -1
- package/templates/new-frontend-plugin/src/plugin.test.ts.hbs +0 -7
- package/templates/new-frontend-plugin/src/plugin.tsx.hbs +0 -25
- package/templates/new-frontend-plugin/src/routes.ts +0 -3
- package/templates/new-frontend-plugin/src/setupTests.ts +0 -1
- package/templates/new-frontend-plugin-module/.eslintrc.js.hbs +0 -1
- package/templates/new-frontend-plugin-module/README.md.hbs +0 -5
- package/templates/new-frontend-plugin-module/package.json.hbs +0 -35
- package/templates/new-frontend-plugin-module/portable-template.yaml +0 -5
- package/templates/new-frontend-plugin-module/src/index.ts.hbs +0 -1
- package/templates/new-frontend-plugin-module/src/module.tsx.hbs +0 -8
- package/templates/new-frontend-plugin-module/src/setupTests.ts +0 -1
- package/templates/node-library/.eslintrc.js.hbs +0 -1
- package/templates/node-library/README.md.hbs +0 -12
- package/templates/node-library/package.json.hbs +0 -29
- package/templates/node-library/portable-template.yaml +0 -3
- package/templates/node-library/src/index.ts.hbs +0 -1
- package/templates/node-library/src/setupTests.ts +0 -1
- package/templates/plugin-common-library/.eslintrc.js.hbs +0 -1
- package/templates/plugin-common-library/README.md.hbs +0 -5
- package/templates/plugin-common-library/package.json.hbs +0 -31
- package/templates/plugin-common-library/portable-template.yaml +0 -3
- package/templates/plugin-common-library/src/index.ts.hbs +0 -19
- package/templates/plugin-common-library/src/setupTests.ts +0 -1
- package/templates/plugin-node-library/.eslintrc.js.hbs +0 -1
- package/templates/plugin-node-library/README.md.hbs +0 -5
- package/templates/plugin-node-library/package.json.hbs +0 -30
- package/templates/plugin-node-library/portable-template.yaml +0 -3
- package/templates/plugin-node-library/src/index.ts.hbs +0 -18
- package/templates/plugin-node-library/src/setupTests.ts +0 -1
- package/templates/plugin-web-library/.eslintrc.js.hbs +0 -1
- package/templates/plugin-web-library/README.md.hbs +0 -5
- package/templates/plugin-web-library/package.json.hbs +0 -42
- package/templates/plugin-web-library/portable-template.yaml +0 -3
- package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.test.tsx +0 -17
- package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.tsx +0 -28
- package/templates/plugin-web-library/src/components/ExampleComponent/index.ts +0 -2
- package/templates/plugin-web-library/src/components/index.ts +0 -5
- package/templates/plugin-web-library/src/hooks/index.ts +0 -5
- package/templates/plugin-web-library/src/hooks/useExample/index.ts +0 -1
- package/templates/plugin-web-library/src/hooks/useExample/useExample.ts +0 -15
- package/templates/plugin-web-library/src/index.ts.hbs +0 -12
- package/templates/plugin-web-library/src/setupTests.ts +0 -1
- package/templates/scaffolder-backend-module/.eslintrc.js.hbs +0 -1
- package/templates/scaffolder-backend-module/README.md.hbs +0 -5
- package/templates/scaffolder-backend-module/package.json.hbs +0 -36
- package/templates/scaffolder-backend-module/portable-template.yaml +0 -6
- package/templates/scaffolder-backend-module/src/actions/example.test.ts +0 -24
- package/templates/scaffolder-backend-module/src/actions/example.ts +0 -39
- package/templates/scaffolder-backend-module/src/index.ts.hbs +0 -8
- package/templates/scaffolder-backend-module/src/module.ts +0 -21
- package/templates/web-library/.eslintrc.js.hbs +0 -1
- package/templates/web-library/README.md.hbs +0 -12
- package/templates/web-library/package.json.hbs +0 -30
- package/templates/web-library/portable-template.yaml +0 -3
- package/templates/web-library/src/index.ts.hbs +0 -1
- package/templates/web-library/src/setupTests.ts +0 -1
- /package/dist/{packages/opaque-internal → opaque-internal}/src/OpaqueType.cjs.js +0 -0
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fs = require('fs-extra');
|
|
4
|
-
var path = require('node:path');
|
|
5
|
-
var cliCommon = require('@backstage/cli-common');
|
|
6
|
-
|
|
7
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
10
|
-
|
|
11
|
-
function resolveBundlingPaths(options) {
|
|
12
|
-
const { entry, targetDir = cliCommon.targetPaths.dir } = options;
|
|
13
|
-
const resolveTargetModule = (pathString) => {
|
|
14
|
-
for (const ext of ["mjs", "js", "ts", "tsx", "jsx"]) {
|
|
15
|
-
const filePath = path.resolve(targetDir, `${pathString}.${ext}`);
|
|
16
|
-
if (fs__default.default.pathExistsSync(filePath)) {
|
|
17
|
-
return filePath;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return path.resolve(targetDir, `${pathString}.js`);
|
|
21
|
-
};
|
|
22
|
-
let targetPublic = void 0;
|
|
23
|
-
let targetHtml = path.resolve(targetDir, "public/index.html");
|
|
24
|
-
if (fs__default.default.pathExistsSync(targetHtml)) {
|
|
25
|
-
targetPublic = path.resolve(targetDir, "public");
|
|
26
|
-
} else {
|
|
27
|
-
targetHtml = path.resolve(targetDir, `${entry}.html`);
|
|
28
|
-
if (!fs__default.default.pathExistsSync(targetHtml)) {
|
|
29
|
-
targetHtml = cliCommon.findOwnPaths(__dirname).resolve(
|
|
30
|
-
"templates/serve_index.html"
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const targetRunFile = path.resolve(targetDir, "src/run.ts");
|
|
35
|
-
const runFileExists = fs__default.default.pathExistsSync(targetRunFile);
|
|
36
|
-
return {
|
|
37
|
-
targetHtml,
|
|
38
|
-
targetPublic,
|
|
39
|
-
targetPath: path.resolve(targetDir, "."),
|
|
40
|
-
targetRunFile: runFileExists ? targetRunFile : void 0,
|
|
41
|
-
targetDist: path.resolve(targetDir, options.dist ?? "dist"),
|
|
42
|
-
targetAssets: path.resolve(targetDir, "assets"),
|
|
43
|
-
targetSrc: path.resolve(targetDir, "src"),
|
|
44
|
-
targetDev: path.resolve(targetDir, "dev"),
|
|
45
|
-
targetEntry: resolveTargetModule(entry),
|
|
46
|
-
targetTsConfig: cliCommon.targetPaths.resolveRoot("tsconfig.json"),
|
|
47
|
-
targetPackageJson: path.resolve(targetDir, "package.json"),
|
|
48
|
-
rootNodeModules: cliCommon.targetPaths.resolveRoot("node_modules"),
|
|
49
|
-
root: cliCommon.targetPaths.rootDir
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
async function resolveOptionalBundlingPaths(options) {
|
|
53
|
-
const resolvedPaths = resolveBundlingPaths(options);
|
|
54
|
-
if (await fs__default.default.pathExists(resolvedPaths.targetEntry)) {
|
|
55
|
-
return resolvedPaths;
|
|
56
|
-
}
|
|
57
|
-
return void 0;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
exports.resolveBundlingPaths = resolveBundlingPaths;
|
|
61
|
-
exports.resolveOptionalBundlingPaths = resolveOptionalBundlingPaths;
|
|
62
|
-
//# sourceMappingURL=paths.cjs.js.map
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chalk = require('chalk');
|
|
4
|
-
var fs = require('fs-extra');
|
|
5
|
-
var path = require('node:path');
|
|
6
|
-
var openBrowser = require('react-dev-utils/openBrowser');
|
|
7
|
-
var core = require('@rspack/core');
|
|
8
|
-
var devServer = require('@rspack/dev-server');
|
|
9
|
-
var cliCommon = require('@backstage/cli-common');
|
|
10
|
-
var config = require('../config.cjs.js');
|
|
11
|
-
var config$1 = require('./config.cjs.js');
|
|
12
|
-
var packageDetection = require('./packageDetection.cjs.js');
|
|
13
|
-
var paths = require('./paths.cjs.js');
|
|
14
|
-
var moduleFederation = require('./moduleFederation.cjs.js');
|
|
15
|
-
|
|
16
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
17
|
-
|
|
18
|
-
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
19
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
20
|
-
var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
|
|
21
|
-
|
|
22
|
-
async function serveBundle(options) {
|
|
23
|
-
const paths$1 = paths.resolveBundlingPaths(options);
|
|
24
|
-
const targetPkg = await fs__default.default.readJson(paths$1.targetPackageJson);
|
|
25
|
-
if (options.verifyVersions) {
|
|
26
|
-
if (targetPkg.dependencies?.["react-router"]?.includes("beta") || targetPkg.dependencies?.["react-router-dom"]?.includes("beta")) {
|
|
27
|
-
console.warn(
|
|
28
|
-
chalk__default.default.yellow(`
|
|
29
|
-
DEPRECATION WARNING: React Router Beta is deprecated and support for it will be removed in a future release.
|
|
30
|
-
Please migrate to use React Router v6 stable.
|
|
31
|
-
See https://backstage.io/docs/tutorials/react-router-stable-migration
|
|
32
|
-
`)
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
checkReactVersion();
|
|
37
|
-
const { name } = await fs__default.default.readJson(
|
|
38
|
-
path.resolve(options.targetDir ?? cliCommon.targetPaths.dir, "package.json")
|
|
39
|
-
);
|
|
40
|
-
let devServer$1 = void 0;
|
|
41
|
-
let latestFrontendAppConfigs = [];
|
|
42
|
-
const triggerReload = () => {
|
|
43
|
-
if (devServer$1) {
|
|
44
|
-
devServer$1.invalidate();
|
|
45
|
-
if (!process.env.LEGACY_WEBPACK_BUILD) {
|
|
46
|
-
devServer$1.sendMessage(
|
|
47
|
-
devServer$1.webSocketServer?.clients ?? [],
|
|
48
|
-
"static-changed"
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const cliConfig = await config.loadCliConfig({
|
|
54
|
-
args: options.configPaths,
|
|
55
|
-
targetDir: options.targetDir,
|
|
56
|
-
fromPackage: name,
|
|
57
|
-
withFilteredKeys: true,
|
|
58
|
-
watch(appConfigs) {
|
|
59
|
-
latestFrontendAppConfigs = appConfigs;
|
|
60
|
-
triggerReload();
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
latestFrontendAppConfigs = cliConfig.frontendAppConfigs;
|
|
64
|
-
const appBaseUrl = cliConfig.frontendConfig.getOptionalString("app.baseUrl");
|
|
65
|
-
const backendBaseUrl = cliConfig.frontendConfig.getOptionalString("backend.baseUrl");
|
|
66
|
-
if (appBaseUrl && appBaseUrl === backendBaseUrl) {
|
|
67
|
-
console.log(
|
|
68
|
-
chalk__default.default.yellow(
|
|
69
|
-
`\u26A0\uFE0F Conflict between app baseUrl and backend baseUrl:
|
|
70
|
-
|
|
71
|
-
app.baseUrl: ${appBaseUrl}
|
|
72
|
-
backend.baseUrl: ${backendBaseUrl}
|
|
73
|
-
|
|
74
|
-
Must have unique hostname and/or ports.
|
|
75
|
-
|
|
76
|
-
This can be resolved by changing app.baseUrl and backend.baseUrl to point to their respective local development ports.
|
|
77
|
-
`
|
|
78
|
-
)
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
const { frontendConfig, fullConfig } = cliConfig;
|
|
82
|
-
const url = config$1.resolveBaseUrl(frontendConfig, options.moduleFederationRemote);
|
|
83
|
-
const { host, port } = config$1.resolveEndpoint(
|
|
84
|
-
frontendConfig,
|
|
85
|
-
options.moduleFederationRemote
|
|
86
|
-
);
|
|
87
|
-
const detectedModulesEntryPoint = await packageDetection.createDetectedModulesEntryPoint({
|
|
88
|
-
config: fullConfig,
|
|
89
|
-
targetPath: paths$1.targetPath,
|
|
90
|
-
watch() {
|
|
91
|
-
triggerReload();
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
const moduleFederationSharedDependenciesEntryPoint = await moduleFederation.createRuntimeSharedDependenciesEntryPoint({
|
|
95
|
-
targetPath: paths$1.targetPath,
|
|
96
|
-
watch() {
|
|
97
|
-
triggerReload();
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
const webpack = process.env.LEGACY_WEBPACK_BUILD ? require("webpack") : void 0;
|
|
101
|
-
const commonConfigOptions = {
|
|
102
|
-
...options,
|
|
103
|
-
checksEnabled: options.checksEnabled,
|
|
104
|
-
isDev: true,
|
|
105
|
-
baseUrl: url,
|
|
106
|
-
frontendConfig,
|
|
107
|
-
webpack,
|
|
108
|
-
getFrontendAppConfigs: () => {
|
|
109
|
-
return latestFrontendAppConfigs;
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
const config$2 = await config$1.createConfig(paths$1, {
|
|
113
|
-
...commonConfigOptions,
|
|
114
|
-
additionalEntryPoints: [
|
|
115
|
-
...detectedModulesEntryPoint,
|
|
116
|
-
...moduleFederationSharedDependenciesEntryPoint
|
|
117
|
-
],
|
|
118
|
-
moduleFederationRemote: options.moduleFederationRemote
|
|
119
|
-
});
|
|
120
|
-
const bundler = webpack ?? core.rspack;
|
|
121
|
-
const DevServer = webpack ? require("webpack-dev-server") : devServer.RspackDevServer;
|
|
122
|
-
if (webpack) {
|
|
123
|
-
console.log(chalk__default.default.yellow(`\u26A0\uFE0F WARNING: Using legacy WebPack dev server.`));
|
|
124
|
-
}
|
|
125
|
-
const publicPaths = await paths.resolveOptionalBundlingPaths({
|
|
126
|
-
entry: "src/index-public-experimental",
|
|
127
|
-
dist: "dist/public"
|
|
128
|
-
});
|
|
129
|
-
if (publicPaths) {
|
|
130
|
-
console.log(
|
|
131
|
-
chalk__default.default.yellow(
|
|
132
|
-
`\u26A0\uFE0F WARNING: The app /public entry point is an experimental feature that may receive immediate breaking changes.`
|
|
133
|
-
)
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
const compiler = publicPaths ? bundler([config$2, await config$1.createConfig(publicPaths, commonConfigOptions)]) : bundler(config$2);
|
|
137
|
-
devServer$1 = new DevServer(
|
|
138
|
-
{
|
|
139
|
-
hot: !process.env.CI,
|
|
140
|
-
devMiddleware: {
|
|
141
|
-
publicPath: config$2.output?.publicPath,
|
|
142
|
-
stats: "errors-warnings"
|
|
143
|
-
},
|
|
144
|
-
static: paths$1.targetPublic ? {
|
|
145
|
-
publicPath: config$2.output?.publicPath,
|
|
146
|
-
directory: paths$1.targetPublic
|
|
147
|
-
} : void 0,
|
|
148
|
-
historyApiFallback: options.moduleFederationRemote ? false : {
|
|
149
|
-
// Paths with dots should still use the history fallback.
|
|
150
|
-
// See https://github.com/facebookincubator/create-react-app/issues/387.
|
|
151
|
-
disableDotRule: true,
|
|
152
|
-
// The index needs to be rewritten relative to the new public path, including subroutes.
|
|
153
|
-
index: `${config$2.output?.publicPath}index.html`
|
|
154
|
-
},
|
|
155
|
-
server: url.protocol === "https:" ? {
|
|
156
|
-
type: "https",
|
|
157
|
-
options: {
|
|
158
|
-
cert: fullConfig.getOptionalString(
|
|
159
|
-
"app.https.certificate.cert"
|
|
160
|
-
),
|
|
161
|
-
key: fullConfig.getOptionalString("app.https.certificate.key")
|
|
162
|
-
}
|
|
163
|
-
} : {},
|
|
164
|
-
host,
|
|
165
|
-
port,
|
|
166
|
-
proxy: targetPkg.proxy,
|
|
167
|
-
// When the dev server is behind a proxy, the host and public hostname differ
|
|
168
|
-
allowedHosts: [url.hostname],
|
|
169
|
-
client: {
|
|
170
|
-
webSocketURL: { hostname: host, port }
|
|
171
|
-
},
|
|
172
|
-
headers: {
|
|
173
|
-
"Access-Control-Allow-Origin": "*",
|
|
174
|
-
"Access-Control-Allow-Methods": "GET, OPTIONS",
|
|
175
|
-
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
compiler
|
|
179
|
-
);
|
|
180
|
-
await new Promise(async (resolve, reject) => {
|
|
181
|
-
if (devServer$1) {
|
|
182
|
-
devServer$1.startCallback((err) => {
|
|
183
|
-
if (err) {
|
|
184
|
-
reject(err);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
resolve();
|
|
188
|
-
});
|
|
189
|
-
} else {
|
|
190
|
-
resolve();
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
if (!options.skipOpenBrowser) {
|
|
194
|
-
openBrowser__default.default(url.href);
|
|
195
|
-
}
|
|
196
|
-
const waitForExit = async () => {
|
|
197
|
-
for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
198
|
-
process.on(signal, () => {
|
|
199
|
-
devServer$1?.stop();
|
|
200
|
-
process.exit();
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
return new Promise(() => {
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
return waitForExit;
|
|
207
|
-
}
|
|
208
|
-
function checkReactVersion() {
|
|
209
|
-
try {
|
|
210
|
-
const reactPkgPath = require.resolve("react/package.json", {
|
|
211
|
-
paths: [cliCommon.targetPaths.rootDir]
|
|
212
|
-
});
|
|
213
|
-
const reactPkg = require(reactPkgPath);
|
|
214
|
-
if (reactPkg.version.startsWith("16.")) {
|
|
215
|
-
console.log(
|
|
216
|
-
chalk__default.default.yellow(
|
|
217
|
-
`
|
|
218
|
-
\u26A0\uFE0F \u26A0\uFE0F
|
|
219
|
-
\u26A0\uFE0F You are using React version 16, which is deprecated for use in Backstage. \u26A0\uFE0F
|
|
220
|
-
\u26A0\uFE0F Please upgrade to React 17 by updating your packages/app dependencies. \u26A0\uFE0F
|
|
221
|
-
\u26A0\uFE0F \u26A0\uFE0F
|
|
222
|
-
`
|
|
223
|
-
)
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
} catch {
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
exports.serveBundle = serveBundle;
|
|
231
|
-
//# sourceMappingURL=server.cjs.js.map
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@rspack/core');
|
|
4
|
-
|
|
5
|
-
const transforms = (options) => {
|
|
6
|
-
const { isDev, isBackend, webpack } = options;
|
|
7
|
-
const CssExtractPlugin = webpack ? require("mini-css-extract-plugin") : core.CssExtractRspackPlugin;
|
|
8
|
-
function insertBeforeJssStyles(element) {
|
|
9
|
-
const head = document.head;
|
|
10
|
-
const firstJssNode = head.querySelector("style[data-jss]");
|
|
11
|
-
if (!firstJssNode) {
|
|
12
|
-
head.appendChild(element);
|
|
13
|
-
} else {
|
|
14
|
-
head.insertBefore(element, firstJssNode);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
const loaders = [
|
|
18
|
-
{
|
|
19
|
-
test: /\.(tsx?)$/,
|
|
20
|
-
exclude: /node_modules/,
|
|
21
|
-
use: [
|
|
22
|
-
{
|
|
23
|
-
loader: webpack ? require.resolve("swc-loader") : "builtin:swc-loader",
|
|
24
|
-
options: {
|
|
25
|
-
jsc: {
|
|
26
|
-
target: "es2023",
|
|
27
|
-
externalHelpers: !isBackend,
|
|
28
|
-
parser: {
|
|
29
|
-
syntax: "typescript",
|
|
30
|
-
tsx: !isBackend,
|
|
31
|
-
dynamicImport: true
|
|
32
|
-
},
|
|
33
|
-
transform: {
|
|
34
|
-
react: isBackend ? void 0 : {
|
|
35
|
-
runtime: "automatic",
|
|
36
|
-
refresh: isDev
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
test: /\.(jsx?|mjs|cjs)$/,
|
|
46
|
-
exclude: /node_modules/,
|
|
47
|
-
use: [
|
|
48
|
-
{
|
|
49
|
-
loader: webpack ? require.resolve("swc-loader") : "builtin:swc-loader",
|
|
50
|
-
options: {
|
|
51
|
-
jsc: {
|
|
52
|
-
target: "es2023",
|
|
53
|
-
externalHelpers: !isBackend,
|
|
54
|
-
parser: {
|
|
55
|
-
syntax: "ecmascript",
|
|
56
|
-
jsx: !isBackend,
|
|
57
|
-
dynamicImport: true
|
|
58
|
-
},
|
|
59
|
-
transform: {
|
|
60
|
-
react: isBackend ? void 0 : {
|
|
61
|
-
runtime: "automatic",
|
|
62
|
-
refresh: isDev
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
test: /\.(js|mjs|cjs)$/,
|
|
72
|
-
resolve: {
|
|
73
|
-
fullySpecified: false
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
test: [
|
|
78
|
-
/\.bmp$/,
|
|
79
|
-
/\.gif$/,
|
|
80
|
-
/\.jpe?g$/,
|
|
81
|
-
/\.png$/,
|
|
82
|
-
/\.frag$/,
|
|
83
|
-
/\.vert$/,
|
|
84
|
-
{ and: [/\.svg$/, { not: [/\.icon\.svg$/] }] },
|
|
85
|
-
/\.xml$/,
|
|
86
|
-
/\.ico$/,
|
|
87
|
-
/\.webp$/
|
|
88
|
-
],
|
|
89
|
-
type: "asset/resource",
|
|
90
|
-
generator: {
|
|
91
|
-
filename: "static/[name].[hash:8][ext]"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
test: /\.(eot|woff|woff2|ttf)$/i,
|
|
96
|
-
type: "asset/resource",
|
|
97
|
-
generator: {
|
|
98
|
-
filename: "static/[name].[hash][ext][query]"
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
test: /\.ya?ml$/,
|
|
103
|
-
use: require.resolve("yml-loader")
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
include: /\.(md)$/,
|
|
107
|
-
type: "asset/resource",
|
|
108
|
-
generator: {
|
|
109
|
-
filename: "static/[name].[hash][ext][query]"
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
test: /\.css$/i,
|
|
114
|
-
use: [
|
|
115
|
-
isDev ? {
|
|
116
|
-
loader: require.resolve("style-loader"),
|
|
117
|
-
options: {
|
|
118
|
-
insert: insertBeforeJssStyles
|
|
119
|
-
}
|
|
120
|
-
} : CssExtractPlugin.loader,
|
|
121
|
-
{
|
|
122
|
-
loader: require.resolve("css-loader"),
|
|
123
|
-
options: {
|
|
124
|
-
sourceMap: true
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
];
|
|
130
|
-
const plugins = new Array();
|
|
131
|
-
if (!isDev) {
|
|
132
|
-
plugins.push(
|
|
133
|
-
new CssExtractPlugin({
|
|
134
|
-
filename: "static/[name].[contenthash:8].css",
|
|
135
|
-
chunkFilename: "static/[name].[id].[contenthash:8].css",
|
|
136
|
-
insert: insertBeforeJssStyles
|
|
137
|
-
// Only applies to async chunks
|
|
138
|
-
})
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
return { loaders, plugins };
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
exports.transforms = transforms;
|
|
145
|
-
//# sourceMappingURL=transforms.cjs.js.map
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var configLoader = require('@backstage/config-loader');
|
|
4
|
-
var config = require('@backstage/config');
|
|
5
|
-
var cliCommon = require('@backstage/cli-common');
|
|
6
|
-
var getPackages = require('@manypkg/get-packages');
|
|
7
|
-
var cliNode = require('@backstage/cli-node');
|
|
8
|
-
var path = require('node:path');
|
|
9
|
-
|
|
10
|
-
async function loadCliConfig(options) {
|
|
11
|
-
const targetDir = options.targetDir ?? cliCommon.targetPaths.dir;
|
|
12
|
-
const { packages } = await getPackages.getPackages(targetDir);
|
|
13
|
-
let localPackageNames;
|
|
14
|
-
if (options.fromPackage) {
|
|
15
|
-
if (packages.length) {
|
|
16
|
-
const graph = cliNode.PackageGraph.fromPackages(packages);
|
|
17
|
-
localPackageNames = Array.from(
|
|
18
|
-
graph.collectPackageNames([options.fromPackage], (node) => {
|
|
19
|
-
if (node.name === "@backstage/cli") {
|
|
20
|
-
return void 0;
|
|
21
|
-
}
|
|
22
|
-
return node.localDependencies.keys();
|
|
23
|
-
})
|
|
24
|
-
);
|
|
25
|
-
} else {
|
|
26
|
-
localPackageNames = [options.fromPackage];
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
localPackageNames = packages.map((p) => p.packageJson.name);
|
|
30
|
-
}
|
|
31
|
-
const schema = await configLoader.loadConfigSchema({
|
|
32
|
-
dependencies: localPackageNames,
|
|
33
|
-
packagePaths: [cliCommon.targetPaths.resolveRoot("package.json")]
|
|
34
|
-
});
|
|
35
|
-
const source = configLoader.ConfigSources.default({
|
|
36
|
-
allowMissingDefaultConfig: true,
|
|
37
|
-
watch: Boolean(options.watch),
|
|
38
|
-
rootDir: cliCommon.targetPaths.rootDir,
|
|
39
|
-
argv: options.args.flatMap((t) => ["--config", path.resolve(targetDir, t)])
|
|
40
|
-
});
|
|
41
|
-
const appConfigs = await new Promise((resolve, reject) => {
|
|
42
|
-
async function loadConfigReaderLoop() {
|
|
43
|
-
let loaded = false;
|
|
44
|
-
try {
|
|
45
|
-
const abortController = new AbortController();
|
|
46
|
-
for await (const { configs } of source.readConfigData({
|
|
47
|
-
signal: abortController.signal
|
|
48
|
-
})) {
|
|
49
|
-
if (loaded) {
|
|
50
|
-
const newFrontendAppConfigs = schema.process(configs, {
|
|
51
|
-
visibility: ["frontend"],
|
|
52
|
-
withFilteredKeys: options.withFilteredKeys,
|
|
53
|
-
ignoreSchemaErrors: true
|
|
54
|
-
});
|
|
55
|
-
options.watch?.(newFrontendAppConfigs);
|
|
56
|
-
} else {
|
|
57
|
-
resolve(configs);
|
|
58
|
-
loaded = true;
|
|
59
|
-
if (!options.watch) {
|
|
60
|
-
abortController.abort();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
} catch (error) {
|
|
65
|
-
if (loaded) {
|
|
66
|
-
console.error(`Failed to reload configuration, ${error}`);
|
|
67
|
-
} else {
|
|
68
|
-
reject(error);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
loadConfigReaderLoop();
|
|
73
|
-
});
|
|
74
|
-
const configurationLoadedMessage = appConfigs.length ? `Loaded config from ${appConfigs.map((c) => c.context).join(", ")}` : `No configuration files found, running without config`;
|
|
75
|
-
process.stderr.write(`${configurationLoadedMessage}
|
|
76
|
-
`);
|
|
77
|
-
const frontendAppConfigs = schema.process(appConfigs, {
|
|
78
|
-
visibility: ["frontend"],
|
|
79
|
-
withFilteredKeys: options.withFilteredKeys,
|
|
80
|
-
ignoreSchemaErrors: true
|
|
81
|
-
});
|
|
82
|
-
const frontendConfig = config.ConfigReader.fromConfigs(frontendAppConfigs);
|
|
83
|
-
const fullConfig = config.ConfigReader.fromConfigs(appConfigs);
|
|
84
|
-
return {
|
|
85
|
-
schema,
|
|
86
|
-
appConfigs,
|
|
87
|
-
frontendConfig,
|
|
88
|
-
frontendAppConfigs,
|
|
89
|
-
fullConfig
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
exports.loadCliConfig = loadCliConfig;
|
|
94
|
-
//# sourceMappingURL=config.cjs.js.map
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var path = require('node:path');
|
|
4
|
-
|
|
5
|
-
const defaultIndex = {
|
|
6
|
-
mount: ".",
|
|
7
|
-
path: "src/index.ts",
|
|
8
|
-
name: "index",
|
|
9
|
-
ext: ".ts"
|
|
10
|
-
};
|
|
11
|
-
const SCRIPT_EXTS = [".js", ".jsx", ".ts", ".tsx"];
|
|
12
|
-
function parseEntryPoint(mount, path$1) {
|
|
13
|
-
const ext = path.extname(path$1);
|
|
14
|
-
let name = mount;
|
|
15
|
-
if (name === ".") {
|
|
16
|
-
name = "index";
|
|
17
|
-
} else if (name.startsWith("./")) {
|
|
18
|
-
name = name.slice(2);
|
|
19
|
-
}
|
|
20
|
-
if (name.includes("/") && SCRIPT_EXTS.includes(ext)) {
|
|
21
|
-
throw new Error(`Mount point '${mount}' may not contain multiple slashes`);
|
|
22
|
-
}
|
|
23
|
-
return { mount, path: path$1, name, ext };
|
|
24
|
-
}
|
|
25
|
-
function readEntryPoints(pkg) {
|
|
26
|
-
const exp = pkg.exports;
|
|
27
|
-
if (typeof exp === "string") {
|
|
28
|
-
return [defaultIndex];
|
|
29
|
-
} else if (exp && typeof exp === "object" && !Array.isArray(exp)) {
|
|
30
|
-
const entryPoints = new Array();
|
|
31
|
-
for (const mount of Object.keys(exp)) {
|
|
32
|
-
const path = exp[mount];
|
|
33
|
-
if (typeof path !== "string") {
|
|
34
|
-
throw new Error(
|
|
35
|
-
`Exports field value must be a string, got '${JSON.stringify(path)}'`
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
if (process.env.EXPERIMENTAL_TRIM_NEXT_ENTRY && mount === "./next") {
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
entryPoints.push(parseEntryPoint(mount, path));
|
|
42
|
-
}
|
|
43
|
-
return entryPoints;
|
|
44
|
-
}
|
|
45
|
-
return [defaultIndex];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
exports.readEntryPoints = readEntryPoints;
|
|
49
|
-
//# sourceMappingURL=entryPoints.cjs.js.map
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var errors = require('@backstage/errors');
|
|
4
|
-
|
|
5
|
-
const requestType = "@backstage/cli/channel/request";
|
|
6
|
-
const responseType = "@backstage/cli/channel/response";
|
|
7
|
-
class IpcServer {
|
|
8
|
-
#generation = 1;
|
|
9
|
-
#methods = /* @__PURE__ */ new Map();
|
|
10
|
-
addChild(child) {
|
|
11
|
-
const generation = this.#generation++;
|
|
12
|
-
const sendMessage = child.send?.bind(child);
|
|
13
|
-
if (!sendMessage) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const messageListener = (request) => {
|
|
17
|
-
if (request.type !== requestType) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const handler = this.#methods.get(request.method);
|
|
21
|
-
if (!handler) {
|
|
22
|
-
sendMessage({
|
|
23
|
-
type: responseType,
|
|
24
|
-
id: request.id,
|
|
25
|
-
error: {
|
|
26
|
-
name: "NotFoundError",
|
|
27
|
-
message: `No handler registered for method ${request.method}`
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
Promise.resolve().then(() => handler(request.body, { generation })).then(
|
|
33
|
-
(response) => sendMessage({
|
|
34
|
-
type: responseType,
|
|
35
|
-
id: request.id,
|
|
36
|
-
body: response
|
|
37
|
-
})
|
|
38
|
-
).catch(
|
|
39
|
-
(error) => sendMessage({
|
|
40
|
-
type: responseType,
|
|
41
|
-
id: request.id,
|
|
42
|
-
error: errors.serializeError(error)
|
|
43
|
-
})
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
child.addListener("message", messageListener);
|
|
47
|
-
child.addListener("exit", () => {
|
|
48
|
-
child.removeListener("message", messageListener);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
registerMethod(method, handler) {
|
|
52
|
-
if (this.#methods.has(method)) {
|
|
53
|
-
throw new Error(`A handler is already registered for method ${method}`);
|
|
54
|
-
}
|
|
55
|
-
this.#methods.set(method, handler);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
exports.IpcServer = IpcServer;
|
|
60
|
-
//# sourceMappingURL=IpcServer.cjs.js.map
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
class ServerDataStore {
|
|
4
|
-
static bind(server) {
|
|
5
|
-
const store = /* @__PURE__ */ new Map();
|
|
6
|
-
server.registerMethod(
|
|
7
|
-
"DevDataStore.save",
|
|
8
|
-
async (request, { generation }) => {
|
|
9
|
-
const { key, data } = request;
|
|
10
|
-
if (!key) {
|
|
11
|
-
throw new Error("Key is required in DevDataStore.save");
|
|
12
|
-
}
|
|
13
|
-
const item = store.get(key);
|
|
14
|
-
if (!item) {
|
|
15
|
-
store.set(key, { generation, data });
|
|
16
|
-
return { saved: true };
|
|
17
|
-
}
|
|
18
|
-
if (item.generation > generation) {
|
|
19
|
-
return { saved: false };
|
|
20
|
-
}
|
|
21
|
-
store.set(key, { generation, data });
|
|
22
|
-
return { saved: true };
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
server.registerMethod(
|
|
26
|
-
"DevDataStore.load",
|
|
27
|
-
async (request) => {
|
|
28
|
-
const item = store.get(request.key);
|
|
29
|
-
return { loaded: Boolean(item), data: item?.data };
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
exports.ServerDataStore = ServerDataStore;
|
|
36
|
-
//# sourceMappingURL=ServerDataStore.cjs.js.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var node_util = require('node:util');
|
|
4
|
-
var shellQuote = require('shell-quote');
|
|
5
|
-
|
|
6
|
-
function createScriptOptionsParser(commandPath, options) {
|
|
7
|
-
const expectedScript = `backstage-cli ${commandPath.join(" ")}`;
|
|
8
|
-
return (scriptStr) => {
|
|
9
|
-
if (!scriptStr || !scriptStr.startsWith(expectedScript)) {
|
|
10
|
-
return void 0;
|
|
11
|
-
}
|
|
12
|
-
const argsStr = scriptStr.slice(expectedScript.length).trim();
|
|
13
|
-
const args = argsStr ? shellQuote.parse(argsStr).filter(
|
|
14
|
-
(e) => typeof e === "string"
|
|
15
|
-
) : [];
|
|
16
|
-
const { values } = node_util.parseArgs({ args, strict: false, options });
|
|
17
|
-
return values;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
exports.createScriptOptionsParser = createScriptOptionsParser;
|
|
22
|
-
//# sourceMappingURL=optionsParser.cjs.js.map
|