@techdocs/cli 1.4.0 → 1.4.1-next.1
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 +23 -0
- package/README.md +8 -0
- package/dist/cjs/{index/PublisherConfig-9dfc07ee.cjs.js → PublisherConfig-a2649fb7.cjs.js} +1 -1
- package/dist/cjs/PublisherConfig-a2649fb7.cjs.js.map +1 -0
- package/dist/cjs/{index/generate-8722d4c2.cjs.js → generate-d9c4c0d9.cjs.js} +2 -2
- package/dist/cjs/generate-d9c4c0d9.cjs.js.map +1 -0
- package/dist/cjs/{index/migrate-5312e76c.cjs.js → migrate-0697fdb4.cjs.js} +3 -3
- package/dist/cjs/migrate-0697fdb4.cjs.js.map +1 -0
- package/dist/cjs/{index/mkdocs-b897f254.cjs.js → mkdocs-582c42fd.cjs.js} +3 -3
- package/dist/cjs/mkdocs-582c42fd.cjs.js.map +1 -0
- package/dist/cjs/{index/mkdocsServer-db7109fb.cjs.js → mkdocsServer-99ec8af2.cjs.js} +1 -1
- package/dist/cjs/mkdocsServer-99ec8af2.cjs.js.map +1 -0
- package/dist/cjs/{index/publish-f0f203ef.cjs.js → publish-ac098b56.cjs.js} +3 -3
- package/dist/cjs/publish-ac098b56.cjs.js.map +1 -0
- package/dist/cjs/{index/serve-8c722cc8.cjs.js → serve-461aaf60.cjs.js} +3 -3
- package/dist/cjs/serve-461aaf60.cjs.js.map +1 -0
- package/dist/cjs/{index/utility-2edd5bff.cjs.js → utility-3c0df5a9.cjs.js} +1 -1
- package/dist/cjs/utility-3c0df5a9.cjs.js.map +1 -0
- package/dist/embedded-app/.config-schema.json +5 -0
- package/dist/embedded-app/index.html +1 -1
- package/dist/embedded-app/static/6051.002ec2c4.chunk.js +4 -0
- package/dist/embedded-app/static/6051.002ec2c4.chunk.js.map +1 -0
- package/dist/embedded-app/static/{8951.4ffeac5f.chunk.js → 8951.dd51135b.chunk.js} +2 -2
- package/dist/embedded-app/static/{8951.4ffeac5f.chunk.js.map → 8951.dd51135b.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{9323.a4a386cd.chunk.js → 9323.6577088c.chunk.js} +2 -2
- package/dist/embedded-app/static/{9323.a4a386cd.chunk.js.map → 9323.6577088c.chunk.js.map} +1 -1
- package/dist/embedded-app/static/main.3a433f5b.js +508 -0
- package/dist/embedded-app/static/main.3a433f5b.js.map +1 -0
- package/dist/embedded-app/static/{module-material-ui.617f168b.js → module-material-ui.1f3c23cb.js} +2 -2
- package/dist/embedded-app/static/{module-material-ui.617f168b.js.map → module-material-ui.1f3c23cb.js.map} +1 -1
- package/dist/embedded-app/static/module-react-router-dom.87e15add.js +21 -0
- package/dist/embedded-app/static/module-react-router-dom.87e15add.js.map +1 -0
- package/dist/embedded-app/static/module-react-router.3fa3d41e.js +21 -0
- package/dist/embedded-app/static/module-react-router.3fa3d41e.js.map +1 -0
- package/dist/embedded-app/static/module-yaml.feabae04.js +136 -0
- package/dist/embedded-app/static/module-yaml.feabae04.js.map +1 -0
- package/dist/embedded-app/static/module-zod.49079951.js +3 -0
- package/dist/embedded-app/static/module-zod.49079951.js.map +1 -0
- package/dist/embedded-app/static/{react-syntax-highlighter_languages_highlight_java.0c380b2f.chunk.js → react-syntax-highlighter_languages_highlight_java.a244ed31.chunk.js} +2 -2
- package/dist/embedded-app/static/{react-syntax-highlighter_languages_highlight_java.0c380b2f.chunk.js.map → react-syntax-highlighter_languages_highlight_java.a244ed31.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{runtime.08eb1867.js → runtime.3a433f5b.js} +2 -2
- package/dist/embedded-app/static/{runtime.08eb1867.js.map → runtime.3a433f5b.js.map} +1 -1
- package/dist/embedded-app/static/{vendor.08eb1867.js → vendor.3a433f5b.js} +99 -99
- package/dist/embedded-app/static/vendor.3a433f5b.js.map +1 -0
- package/dist/index.cjs.js +6 -6
- package/dist/index.cjs.js.map +1 -1
- package/package.json +5 -4
- package/dist/cjs/index/PublisherConfig-9dfc07ee.cjs.js.map +0 -1
- package/dist/cjs/index/generate-8722d4c2.cjs.js.map +0 -1
- package/dist/cjs/index/migrate-5312e76c.cjs.js.map +0 -1
- package/dist/cjs/index/mkdocs-b897f254.cjs.js.map +0 -1
- package/dist/cjs/index/mkdocsServer-db7109fb.cjs.js.map +0 -1
- package/dist/cjs/index/publish-f0f203ef.cjs.js.map +0 -1
- package/dist/cjs/index/serve-8c722cc8.cjs.js.map +0 -1
- package/dist/cjs/index/utility-2edd5bff.cjs.js.map +0 -1
- package/dist/embedded-app/static/6051.3a9f0bec.chunk.js +0 -4
- package/dist/embedded-app/static/6051.3a9f0bec.chunk.js.map +0 -1
- package/dist/embedded-app/static/main.08eb1867.js +0 -503
- package/dist/embedded-app/static/main.08eb1867.js.map +0 -1
- package/dist/embedded-app/static/module-react-router-dom.34e67991.js +0 -30
- package/dist/embedded-app/static/module-react-router-dom.34e67991.js.map +0 -1
- package/dist/embedded-app/static/module-yaml.2570b3eb.js +0 -136
- package/dist/embedded-app/static/module-yaml.2570b3eb.js.map +0 -1
- package/dist/embedded-app/static/module-zod.cdb212b6.js +0 -3
- package/dist/embedded-app/static/module-zod.cdb212b6.js.map +0 -1
- package/dist/embedded-app/static/vendor.08eb1867.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @techdocs/cli
|
|
2
2
|
|
|
3
|
+
## 1.4.1-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/backend-common@0.18.4-next.1
|
|
9
|
+
- @backstage/catalog-model@1.2.1
|
|
10
|
+
- @backstage/cli-common@0.1.12
|
|
11
|
+
- @backstage/config@1.0.7
|
|
12
|
+
- @backstage/plugin-techdocs-node@1.6.1-next.1
|
|
13
|
+
|
|
14
|
+
## 1.4.1-next.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- b348420a804: Adding global-agent to enable the ability to publish through a proxy
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @backstage/backend-common@0.18.4-next.0
|
|
21
|
+
- @backstage/config@1.0.7
|
|
22
|
+
- @backstage/catalog-model@1.2.1
|
|
23
|
+
- @backstage/cli-common@0.1.12
|
|
24
|
+
- @backstage/plugin-techdocs-node@1.6.1-next.0
|
|
25
|
+
|
|
3
26
|
## 1.4.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -40,6 +40,14 @@ yarn start
|
|
|
40
40
|
yarn techdocs-cli:dev [...options]
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
### Connecting behind a proxy
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
# Prior to executing the techdocs-cli command
|
|
47
|
+
export GLOBAL_AGENT_HTTPS_PROXY=${HTTP_PROXY}
|
|
48
|
+
export GLOBAL_AGENT_NO_PROXY=${NO_PROXY}
|
|
49
|
+
```
|
|
50
|
+
|
|
43
51
|
### Using an example docs project
|
|
44
52
|
|
|
45
53
|
For the purpose of local development, we have created an example documentation project. You are of course also free to create your own local test site - all it takes is a `docs/index.md` and an `mkdocs.yml` in a directory.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublisherConfig-a2649fb7.cjs.js","sources":["../../src/lib/PublisherConfig.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\nimport { ConfigReader } from '@backstage/config';\nimport { OptionValues } from 'commander';\n\ntype Publisher = keyof (typeof PublisherConfig)['configFactories'];\ntype PublisherConfiguration = {\n [p in Publisher]?: any;\n} & {\n type: Publisher;\n};\n\n/**\n * Helper when working with publisher-related configurations.\n */\nexport class PublisherConfig {\n /**\n * Maps publisher-specific config keys to config getters.\n */\n private static configFactories = {\n awsS3: PublisherConfig.getValidAwsS3Config,\n azureBlobStorage: PublisherConfig.getValidAzureConfig,\n googleGcs: PublisherConfig.getValidGoogleGcsConfig,\n openStackSwift: PublisherConfig.getValidOpenStackSwiftConfig,\n };\n\n /**\n * Returns Backstage config suitable for use when instantiating a Publisher. If\n * there are any missing or invalid options provided, an error is thrown.\n *\n * Note: This assumes that proper credentials are set in Environment\n * variables for the respective GCS/AWS clients to work.\n */\n static getValidConfig(opts: OptionValues): ConfigReader {\n const publisherType = opts.publisherType;\n\n if (!PublisherConfig.isKnownPublisher(publisherType)) {\n throw new Error(`Unknown publisher type ${opts.publisherType}`);\n }\n\n return new ConfigReader({\n // This backend config is not used at all. Just something needed a create a mock discovery instance.\n backend: {\n baseUrl: 'http://localhost:7007',\n listen: {\n port: 7007,\n },\n },\n techdocs: {\n publisher: PublisherConfig.configFactories[publisherType](opts),\n legacyUseCaseSensitiveTripletPaths:\n opts.legacyUseCaseSensitiveTripletPaths,\n },\n });\n }\n\n /**\n * Typeguard to ensure the publisher has a known config getter.\n */\n private static isKnownPublisher(\n type: string,\n ): type is keyof (typeof PublisherConfig)['configFactories'] {\n return PublisherConfig.configFactories.hasOwnProperty(type);\n }\n\n /**\n * Retrieve valid AWS S3 configuration based on the command.\n */\n private static getValidAwsS3Config(\n opts: OptionValues,\n ): PublisherConfiguration {\n return {\n type: 'awsS3',\n awsS3: {\n bucketName: opts.storageName,\n ...(opts.awsBucketRootPath && {\n bucketRootPath: opts.awsBucketRootPath,\n }),\n ...(opts.awsRoleArn && { credentials: { roleArn: opts.awsRoleArn } }),\n ...(opts.awsEndpoint && { endpoint: opts.awsEndpoint }),\n ...(opts.awsS3ForcePathStyle && { s3ForcePathStyle: true }),\n ...(opts.awsS3sse && { sse: opts.awsS3sse }),\n ...(opts.awsProxy && { httpsProxy: opts.awsProxy }),\n },\n };\n }\n\n /**\n * Retrieve valid Azure Blob Storage configuration based on the command.\n */\n private static getValidAzureConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n if (!opts.azureAccountName) {\n throw new Error(\n `azureBlobStorage requires --azureAccountName to be specified`,\n );\n }\n\n return {\n type: 'azureBlobStorage',\n azureBlobStorage: {\n containerName: opts.storageName,\n credentials: {\n accountName: opts.azureAccountName,\n accountKey: opts.azureAccountKey,\n },\n },\n };\n }\n\n /**\n * Retrieve valid GCS configuration based on the command.\n */\n private static getValidGoogleGcsConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n return {\n type: 'googleGcs',\n googleGcs: {\n bucketName: opts.storageName,\n ...(opts.gcsBucketRootPath && {\n bucketRootPath: opts.gcsBucketRootPath,\n }),\n },\n };\n }\n\n /**\n * Retrieves valid OpenStack Swift configuration based on the command.\n */\n private static getValidOpenStackSwiftConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n const missingParams = [\n 'osCredentialId',\n 'osSecret',\n 'osAuthUrl',\n 'osSwiftUrl',\n ].filter((param: string) => !opts[param]);\n\n if (missingParams.length) {\n throw new Error(\n `openStackSwift requires the following params to be specified: ${missingParams.join(\n ', ',\n )}`,\n );\n }\n\n return {\n type: 'openStackSwift',\n openStackSwift: {\n containerName: opts.storageName,\n credentials: {\n id: opts.osCredentialId,\n secret: opts.osSecret,\n },\n authUrl: opts.osAuthUrl,\n swiftUrl: opts.osSwiftUrl,\n },\n };\n }\n}\n"],"names":["ConfigReader"],"mappings":";;;;AA6BO,MAAM,mBAAN,MAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkB3B,OAAO,eAAe,IAAkC,EAAA;AACtD,IAAA,MAAM,gBAAgB,IAAK,CAAA,aAAA,CAAA;AAE3B,IAAA,IAAI,CAAC,gBAAA,CAAgB,gBAAiB,CAAA,aAAa,CAAG,EAAA;AACpD,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L,IAAM,EAAA,gBAAA;AAAA,MACN,cAAgB,EAAA;AAAA,QACd,eAAe,IAAK,CAAA,WAAA;AAAA,QACpB,WAAa,EAAA;AAAA,UACX,IAAI,IAAK,CAAA,cAAA;AAAA,UACT,QAAQ,IAAK,CAAA,QAAA;AAAA,SACf;AAAA,QACA,SAAS,IAAK,CAAA,SAAA;AAAA,QACd,UAAU,IAAK,CAAA,UAAA;AAAA,OACjB;AAAA,KACF,CAAA;AAAA,GACF;AACF,CAAA,CAAA;AAnJO,IAAM,eAAN,GAAA,iBAAA;AAAA;AAAA;AAAA;AAAM,eAAA,CAII,eAAkB,GAAA;AAAA,EAC/B,OAAO,gBAAgB,CAAA,mBAAA;AAAA,EACvB,kBAAkB,gBAAgB,CAAA,mBAAA;AAAA,EAClC,WAAW,gBAAgB,CAAA,uBAAA;AAAA,EAC3B,gBAAgB,gBAAgB,CAAA,4BAAA;AAClC,CAAA;;;;"}
|
|
@@ -6,7 +6,7 @@ var Docker = require('dockerode');
|
|
|
6
6
|
var pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
7
7
|
var backendCommon = require('@backstage/backend-common');
|
|
8
8
|
var config = require('@backstage/config');
|
|
9
|
-
var utility = require('./utility-
|
|
9
|
+
var utility = require('./utility-3c0df5a9.cjs.js');
|
|
10
10
|
require('winston');
|
|
11
11
|
require('stream');
|
|
12
12
|
require('process');
|
|
@@ -84,4 +84,4 @@ async function generate(opts) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
exports["default"] = generate;
|
|
87
|
-
//# sourceMappingURL=generate-
|
|
87
|
+
//# sourceMappingURL=generate-d9c4c0d9.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-d9c4c0d9.cjs.js","sources":["../../src/commands/generate/generate.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 { resolve } from 'path';\nimport { OptionValues } from 'commander';\nimport fs from 'fs-extra';\nimport Docker from 'dockerode';\nimport {\n TechdocsGenerator,\n ParsedLocationAnnotation,\n getMkdocsYml,\n} from '@backstage/plugin-techdocs-node';\nimport {\n ContainerRunner,\n DockerContainerRunner,\n} from '@backstage/backend-common';\nimport { ConfigReader } from '@backstage/config';\nimport {\n convertTechDocsRefToLocationAnnotation,\n createLogger,\n getLogStream,\n} from '../../lib/utility';\n\nexport default async function generate(opts: OptionValues) {\n // Use techdocs-node package to generate docs. Keep consistency between Backstage and CI generating docs.\n // Docs can be prepared using actions/checkout or git clone, or similar paradigms on CI. The TechDocs CI workflow\n // will run on the CI pipeline containing the documentation files.\n\n const logger = createLogger({ verbose: opts.verbose });\n\n const sourceDir = resolve(opts.sourceDir);\n const outputDir = resolve(opts.outputDir);\n const omitTechdocsCorePlugin = opts.omitTechdocsCoreMkdocsPlugin;\n const dockerImage = opts.dockerImage;\n const pullImage = opts.pull;\n const legacyCopyReadmeMdToIndexMd = opts.legacyCopyReadmeMdToIndexMd;\n\n logger.info(`Using source dir ${sourceDir}`);\n logger.info(`Will output generated files in ${outputDir}`);\n\n logger.verbose('Creating output directory if it does not exist.');\n\n await fs.ensureDir(outputDir);\n\n const { path: mkdocsYmlPath, configIsTemporary } = await getMkdocsYml(\n sourceDir,\n );\n\n const config = new ConfigReader({\n techdocs: {\n generator: {\n runIn: opts.docker ? 'docker' : 'local',\n dockerImage,\n pullImage,\n mkdocs: {\n legacyCopyReadmeMdToIndexMd,\n omitTechdocsCorePlugin,\n },\n },\n },\n });\n\n // Docker client (conditionally) used by the generators, based on techdocs.generators config.\n let containerRunner: ContainerRunner | undefined;\n\n if (opts.docker) {\n const dockerClient = new Docker();\n containerRunner = new DockerContainerRunner({ dockerClient });\n }\n\n let parsedLocationAnnotation = {} as ParsedLocationAnnotation;\n if (opts.techdocsRef) {\n try {\n parsedLocationAnnotation = convertTechDocsRefToLocationAnnotation(\n opts.techdocsRef,\n );\n } catch (err) {\n logger.error(err.message);\n }\n }\n\n // Generate docs using @backstage/plugin-techdocs-node\n const techdocsGenerator = await TechdocsGenerator.fromConfig(config, {\n logger,\n containerRunner,\n });\n\n logger.info('Generating documentation...');\n\n await techdocsGenerator.run({\n inputDir: sourceDir,\n outputDir,\n ...(opts.techdocsRef\n ? {\n parsedLocationAnnotation,\n }\n : {}),\n logger,\n etag: opts.etag,\n logStream: getLogStream(logger),\n siteOptions: { name: opts.siteName },\n });\n\n if (configIsTemporary) {\n process.on('exit', async () => {\n fs.rmSync(mkdocsYmlPath, {});\n });\n }\n\n logger.info('Done!');\n}\n"],"names":["createLogger","resolve","fs","getMkdocsYml","config","ConfigReader","Docker","DockerContainerRunner","convertTechDocsRefToLocationAnnotation","TechdocsGenerator","getLogStream"],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,eAA8B,SAAS,IAAoB,EAAA;AAKzD,EAAA,MAAM,SAASA,oBAAa,CAAA,EAAE,OAAS,EAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AAErD,EAAM,MAAA,SAAA,GAAYC,YAAQ,CAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AACxC,EAAM,MAAA,SAAA,GAAYA,YAAQ,CAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AACxC,EAAA,MAAM,yBAAyB,IAAK,CAAA,4BAAA,CAAA;AACpC,EAAA,MAAM,cAAc,IAAK,CAAA,WAAA,CAAA;AACzB,EAAA,MAAM,YAAY,IAAK,CAAA,IAAA,CAAA;AACvB,EAAA,MAAM,8BAA8B,IAAK,CAAA,2BAAA,CAAA;AAEzC,EAAO,MAAA,CAAA,IAAA,CAAK,oBAAoB,SAAW,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AAA,IACA,eAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAA,MAAA,CAAO,KAAK,6BAA6B,CAAA,CAAA;AAEzC,EAAA,MAAM,kBAAkB,GAAI,CAAA;AAAA,IAC1B,QAAU,EAAA,SAAA;AAAA,IACV,SAAA;AAAA,IACA,GAAI,KAAK,WACL,GAAA;AAAA,MACE,wBAAA;AAAA,QAEF,EAAC;AAAA,IACL,MAAA;AAAA,IACA,MAAM,IAAK,CAAA,IAAA;AAAA,IACX,SAAA,EAAWM,qBAAa,MAAM,CAAA;AAAA,IAC9B,WAAa,EAAA,EAAE,IAAM,EAAA,IAAA,CAAK,QAAS,EAAA;AAAA,GACpC,CAAA,CAAA;AAED,EAAA,IAAI,iBAAmB,EAAA;AACrB,IAAQ,OAAA,CAAA,EAAA,CAAG,QAAQ,YAAY;AAC7B,MAAGR,sBAAA,CAAA,MAAA,CAAO,aAAe,EAAA,EAAE,CAAA,CAAA;AAAA,KAC5B,CAAA,CAAA;AAAA,GACH;AAEA,EAAA,MAAA,CAAO,KAAK,OAAO,CAAA,CAAA;AACrB;;;;"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var backendCommon = require('@backstage/backend-common');
|
|
4
4
|
var pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
5
|
-
var utility = require('./utility-
|
|
6
|
-
var PublisherConfig = require('./PublisherConfig-
|
|
5
|
+
var utility = require('./utility-3c0df5a9.cjs.js');
|
|
6
|
+
var PublisherConfig = require('./PublisherConfig-a2649fb7.cjs.js');
|
|
7
7
|
require('winston');
|
|
8
8
|
require('stream');
|
|
9
9
|
require('process');
|
|
@@ -35,4 +35,4 @@ async function migrate(opts) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
exports["default"] = migrate;
|
|
38
|
-
//# sourceMappingURL=migrate-
|
|
38
|
+
//# sourceMappingURL=migrate-0697fdb4.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-0697fdb4.cjs.js","sources":["../../src/commands/migrate/migrate.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\nimport { SingleHostDiscovery } from '@backstage/backend-common';\nimport { Publisher } from '@backstage/plugin-techdocs-node';\nimport { OptionValues } from 'commander';\nimport { createLogger } from '../../lib/utility';\nimport { PublisherConfig } from '../../lib/PublisherConfig';\n\nexport default async function migrate(opts: OptionValues) {\n const logger = createLogger({ verbose: opts.verbose });\n\n const config = PublisherConfig.getValidConfig(opts);\n const discovery = SingleHostDiscovery.fromConfig(config);\n const publisher = await Publisher.fromConfig(config, { logger, discovery });\n\n if (!publisher.migrateDocsCase) {\n throw new Error(`Migration not implemented for ${opts.publisherType}`);\n }\n\n // Check that the publisher's underlying storage is ready and available.\n const { isAvailable } = await publisher.getReadiness();\n if (!isAvailable) {\n // Error messages printed in getReadiness() call. This ensures exit code 1.\n throw new Error('');\n }\n\n // Validate and parse migration arguments.\n const removeOriginal = opts.removeOriginal;\n const numericConcurrency = parseInt(opts.concurrency, 10);\n\n if (!Number.isInteger(numericConcurrency) || numericConcurrency <= 0) {\n throw new Error(\n `Concurrency must be a number greater than 1. ${opts.concurrency} provided.`,\n );\n }\n\n await publisher.migrateDocsCase({\n concurrency: numericConcurrency,\n removeOriginal,\n });\n}\n"],"names":["createLogger","PublisherConfig","SingleHostDiscovery","Publisher"],"mappings":";;;;;;;;;;;AAsBA,eAA8B,QAAQ,IAAoB,EAAA;AACxD,EAAA,MAAM,SAASA,oBAAa,CAAA,EAAE,OAAS,EAAA,IAAA,CAA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|
4
|
+
var utility = require('./utility-3c0df5a9.cjs.js');
|
|
5
|
+
var mkdocsServer = require('./mkdocsServer-99ec8af2.cjs.js');
|
|
6
6
|
var pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
7
7
|
var fs = require('fs-extra');
|
|
8
8
|
require('winston');
|
|
@@ -60,4 +60,4 @@ Starting mkdocs server on ${localAddr}
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
exports["default"] = serveMkdocs;
|
|
63
|
-
//# sourceMappingURL=mkdocs-
|
|
63
|
+
//# sourceMappingURL=mkdocs-582c42fd.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mkdocs-582c42fd.cjs.js","sources":["../../src/commands/serve/mkdocs.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 { OptionValues } from 'commander';\nimport openBrowser from 'react-dev-utils/openBrowser';\nimport { createLogger } from '../../lib/utility';\nimport { runMkdocsServer } from '../../lib/mkdocsServer';\nimport { LogFunc, waitForSignal } from '../../lib/run';\nimport { getMkdocsYml } from '@backstage/plugin-techdocs-node';\nimport fs from 'fs-extra';\n\nexport default async function serveMkdocs(opts: OptionValues) {\n const logger = createLogger({ verbose: opts.verbose });\n\n const dockerAddr = `http://0.0.0.0:${opts.port}`;\n const localAddr = `http://127.0.0.1:${opts.port}`;\n const expectedDevAddr = opts.docker ? dockerAddr : localAddr;\n\n const { path: mkdocsYmlPath, configIsTemporary } = await getMkdocsYml(\n './',\n opts.siteName,\n );\n\n // We want to open browser only once based on a log.\n let boolOpenBrowserTriggered = false;\n\n const logFunc: LogFunc = data => {\n // Sometimes the lines contain an unnecessary extra new line in between\n const logLines = data.toString().split('\\n');\n const logPrefix = opts.docker ? '[docker/mkdocs]' : '[mkdocs]';\n logLines.forEach(line => {\n if (line === '') {\n return;\n }\n\n // Logs from container is verbose.\n logger.verbose(`${logPrefix} ${line}`);\n\n // When the server has started, open a new browser tab for the user.\n if (\n !boolOpenBrowserTriggered &&\n line.includes(`Serving on ${expectedDevAddr}`)\n ) {\n // Always open the local address, since 0.0.0.0 belongs to docker\n logger.info(`\\nStarting mkdocs server on ${localAddr}\\n`);\n openBrowser(localAddr);\n boolOpenBrowserTriggered = true;\n }\n });\n };\n // mkdocs writes all of its logs to stderr by default, and not stdout.\n // https://github.com/mkdocs/mkdocs/issues/879#issuecomment-203536006\n // Had me questioning this whole implementation for half an hour.\n\n // Commander stores --no-docker in cmd.docker variable\n const childProcess = await runMkdocsServer({\n port: opts.port,\n dockerImage: opts.dockerImage,\n dockerEntrypoint: opts.dockerEntrypoint,\n dockerOptions: opts.dockerOption,\n useDocker: opts.docker,\n stdoutLogFunc: logFunc,\n stderrLogFunc: logFunc,\n });\n\n // Keep waiting for user to cancel the process\n await waitForSignal([childProcess]);\n\n if (configIsTemporary) {\n process.on('exit', async () => {\n fs.rmSync(mkdocsYmlPath, {});\n });\n }\n}\n"],"names":["createLogger","getMkdocsYml","openBrowser","runMkdocsServer","waitForSignal","fs"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,eAA8B,YAAY,IAAoB,EAAA;AAC5D,EAAA,MAAM,SAASA,oBAAa,CAAA,EAAE,OAAS,EAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AAErD,EAAM,MAAA,UAAA,GAAa,kBAAkB,IAAK,CAAA,IAAA,CAAA,CAAA,CAAA;AAC1C,EAAM,MAAA,SAAA,GAAY,oBAAoB,IAAK,CAAA,IAAA,CAAA,CAAA,CAAA;AAC3C,EAAM,MAAA,eAAA,GAAkB,IAAK,CAA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AChB,aAAe,EAAA,OAAA;AAAA,IACf,aAAe,EAAA,OAAA;AAAA,GAChB,CAAA,CAAA;AAGD,EAAM,MAAAC,0BAAA,CAAc,CAAC,YAAY,CAAC,CAAA,CAAA;AAElC,EAAA,IAAI,iBAAmB,EAAA;AACrB,IAAQ,OAAA,CAAA,EAAA,CAAG,QAAQ,YAAY;AAC7B,MAAGC,sBAAA,CAAA,MAAA,CAAO,aAAe,EAAA,EAAE,CAAA,CAAA;AAAA,KAC5B,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mkdocsServer-99ec8af2.cjs.js","sources":["../../src/lib/run.ts","../../src/lib/mkdocsServer.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 */\nimport { spawn, SpawnOptions, ChildProcess } from 'child_process';\n\nexport type LogFunc = (data: Buffer | string) => void;\ntype SpawnOptionsPartialEnv = Omit<SpawnOptions, 'env'> & {\n env?: Partial<NodeJS.ProcessEnv>;\n // Pipe stdout to this log function\n stdoutLogFunc?: LogFunc;\n // Pipe stderr to this log function\n stderrLogFunc?: LogFunc;\n};\n\n// TODO: Accept log functions to pipe logs with.\n// Runs a child command, returning the child process instance.\n// Use it along with waitForSignal to run a long running process e.g. mkdocs serve\nexport const run = async (\n name: string,\n args: string[] = [],\n options: SpawnOptionsPartialEnv = {},\n): Promise<ChildProcess> => {\n const { stdoutLogFunc, stderrLogFunc } = options;\n\n const env: NodeJS.ProcessEnv = {\n ...process.env,\n FORCE_COLOR: 'true',\n ...(options.env ?? {}),\n };\n\n // Refer: https://nodejs.org/api/child_process.html#child_process_subprocess_stdio\n const stdio = [\n 'inherit',\n stdoutLogFunc ? 'pipe' : 'inherit',\n stderrLogFunc ? 'pipe' : 'inherit',\n ] as ('inherit' | 'pipe')[];\n\n const childProcess = spawn(name, args, {\n stdio: stdio,\n ...options,\n env,\n });\n\n if (stdoutLogFunc && childProcess.stdout) {\n childProcess.stdout.on('data', stdoutLogFunc);\n }\n if (stderrLogFunc && childProcess.stderr) {\n childProcess.stderr.on('data', stderrLogFunc);\n }\n\n return childProcess;\n};\n\n// Block indefinitely and wait for a signal to stop the child process(es)\n// Throw error if any child process errors\n// Resolves only when all processes exit with status code 0\nexport async function waitForSignal(\n childProcesses: Array<ChildProcess>,\n): Promise<void> {\n const promises: Array<Promise<void>> = [];\n\n for (const signal of ['SIGINT', 'SIGTERM'] as const) {\n process.on(signal, () => {\n childProcesses.forEach(childProcess => {\n childProcess.kill();\n });\n });\n }\n\n childProcesses.forEach(childProcess => {\n if (typeof childProcess.exitCode === 'number') {\n if (childProcess.exitCode) {\n throw new Error(`Non zero exit code from child process`);\n }\n return;\n }\n\n promises.push(\n new Promise<void>((resolve, reject) => {\n childProcess.once('error', reject);\n childProcess.once('exit', resolve);\n }),\n );\n });\n\n await Promise.all(promises);\n}\n","/*\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 { ChildProcess } from 'child_process';\nimport { run, LogFunc } from './run';\n\nexport const runMkdocsServer = async (options: {\n port?: string;\n useDocker?: boolean;\n dockerImage?: string;\n dockerEntrypoint?: string;\n dockerOptions?: string[];\n stdoutLogFunc?: LogFunc;\n stderrLogFunc?: LogFunc;\n}): Promise<ChildProcess> => {\n const port = options.port ?? '8000';\n const useDocker = options.useDocker ?? true;\n const dockerImage = options.dockerImage ?? 'spotify/techdocs';\n\n if (useDocker) {\n return await run(\n 'docker',\n [\n 'run',\n '--rm',\n '-w',\n '/content',\n '-v',\n `${process.cwd()}:/content`,\n '-p',\n `${port}:${port}`,\n '-it',\n ...(options.dockerEntrypoint\n ? ['--entrypoint', options.dockerEntrypoint]\n : []),\n ...(options.dockerOptions || []),\n dockerImage,\n 'serve',\n '--dev-addr',\n `0.0.0.0:${port}`,\n ],\n {\n stdoutLogFunc: options.stdoutLogFunc,\n stderrLogFunc: options.stderrLogFunc,\n },\n );\n }\n\n return await run('mkdocs', ['serve', '--dev-addr', `127.0.0.1:${port}`], {\n stdoutLogFunc: options.stdoutLogFunc,\n stderrLogFunc: options.stderrLogFunc,\n });\n};\n"],"names":["spawn"],"mappings":";;;;AA6Ba,MAAA,GAAA,GAAM,OACjB,IACA,EAAA,IAAA,GAAiB,EACjB,EAAA,OAAA,GAAkC,EACR,KAAA;AAjC5B,EAAA,IAAA,EAAA,CAAA;AAkCE,EAAM,MAAA,EAAE,aAAe,EAAA,aAAA,EAAkB,GAAA,OAAA,CAAA;AAEzC,EAAA,MAAM,GAAyB,GAAA;AAAA,IAC7B,GAAG,OAAQ,CAAA,GAAA;AAAA,IACX,WAAa,EAAA,MAAA;AAAA,IACb,GAAI,CAAA,EAAA,GAAA,OAAA,CAAQ,GAAR,KAAA,IAAA,GAAA,EAAA,GAAe,EAAC;AAAA,GACtB,CAAA;AAGA,EAAA,MAAM,KAAQ,GAAA;AAAA,IACZ,SAAA;AAAA,IACA,gBAAgB,MAAS,GAAA,SAAA;AAAA,IACzB,gBAAgB,MAAS,GAAA,SAAA;AAAA,GAC3B,CAAA;AAEA,EAAM,MAAA,YAAA,GAAeA,mBAAM,CAAA,IAAA,EAAM,IAAM,EAAA;AAAA,IACrC,KAAA;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,MAAM,IAAI,QAAU,EAAA,CAAC,SAAS,YAAc,EAAA,CAAA,UAAA,EAAa,MAAM,CAAG,EAAA;AAAA,IACvE,eAAe,OAAQ,CAAA,aAAA;AAAA,IACvB,eAAe,OAAQ,CAAA,aAAA;AAAA,GACxB,CAAA,CAAA;AACH;;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var path = require('path');
|
|
4
|
-
var utility = require('./utility-
|
|
4
|
+
var utility = require('./utility-3c0df5a9.cjs.js');
|
|
5
5
|
var backendCommon = require('@backstage/backend-common');
|
|
6
6
|
var pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
7
|
-
var PublisherConfig = require('./PublisherConfig-
|
|
7
|
+
var PublisherConfig = require('./PublisherConfig-a2649fb7.cjs.js');
|
|
8
8
|
require('winston');
|
|
9
9
|
require('stream');
|
|
10
10
|
require('process');
|
|
@@ -33,4 +33,4 @@ async function publish(opts) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
exports["default"] = publish;
|
|
36
|
-
//# sourceMappingURL=publish-
|
|
36
|
+
//# sourceMappingURL=publish-ac098b56.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-ac098b56.cjs.js","sources":["../../src/commands/publish/publish.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 { resolve } from 'path';\nimport { OptionValues } from 'commander';\nimport { createLogger } from '../../lib/utility';\nimport { SingleHostDiscovery } from '@backstage/backend-common';\nimport { Publisher } from '@backstage/plugin-techdocs-node';\nimport { Entity } from '@backstage/catalog-model';\nimport { PublisherConfig } from '../../lib/PublisherConfig';\n\nexport default async function publish(opts: OptionValues): Promise<any> {\n const logger = createLogger({ verbose: opts.verbose });\n\n const config = PublisherConfig.getValidConfig(opts);\n const discovery = SingleHostDiscovery.fromConfig(config);\n const publisher = await Publisher.fromConfig(config, { logger, discovery });\n\n // Check that the publisher's underlying storage is ready and available.\n const { isAvailable } = await publisher.getReadiness();\n if (!isAvailable) {\n // Error messages printed in getReadiness() call. This ensures exit code 1.\n return Promise.reject(new Error(''));\n }\n\n const [namespace, kind, name] = opts.entity.split('/');\n const entity = {\n kind,\n metadata: {\n namespace,\n name,\n },\n } as Entity;\n\n const directory = resolve(opts.directory);\n await publisher.publish({ entity, directory });\n\n return true;\n}\n"],"names":["createLogger","PublisherConfig","SingleHostDiscovery","Publisher","resolve"],"mappings":";;;;;;;;;;;;AAwBA,eAA8B,QAAQ,IAAkC,EAAA;AACtE,EAAA,MAAM,SAASA,oBAAa,CAAA,EAAE,OAAS,EAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AAErD,EAAM,MAAA,MAAA,GAASC,+BAAgB,CAAA,cAAA,CAAe,IAAI,CAAA,CAAA;AAClD,EAAM,MAAA,SAAA,GAAYC,iCAAoB,CAAA,UAAA,CAAW,MAAM,CAAA,CAAA;AACvD,EAAM,MAAA,SAAA,GAAY,MAAMC,4BAAU,CAAA,UAAA,CAAW,QAAQ,EAAE,MAAA,EAAQ,WAAW,CAAA,CAAA;AAG1E,EAAA,MAAM,EAAE,WAAA,EAAgB,GAAA,MAAM,UAAU,YAAa,EAAA,CAAA;AACrD,EAAA,IAAI,CAAC,WAAa,EAAA;AAEhB,IAAA,OAAO,OAAQ,CAAA,MAAA,CAAO,IAAI,KAAA,CAAM,EAAE,CAAC,CAAA,CAAA;AAAA,GACrC;AAEA,EAAM,MAAA,CAAC,WAAW,IAAM,EAAA,IAAI,IAAI,IAAK,CAAA,MAAA,CAAO,MAAM,GAAG,CAAA,CAAA;AACrD,EAAA,MAAM,MAAS,GAAA;AAAA,IACb,IAAA;AAAA,IACA,QAAU,EAAA;AAAA,MACR,SAAA;AAAA,MACA,IAAA;AAAA,KACF;AAAA,GACF,CAAA;AAEA,EAAM,MAAA,SAAA,GAAYC,YAAQ,CAAA,IAAA,CAAK,SAAS,CAAA,CAAA;AACxC,EAAA,MAAM,SAAU,CAAA,OAAA,CAAQ,EAAE,MAAA,EAAQ,WAAW,CAAA,CAAA;AAE7C,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
|
|
@@ -6,8 +6,8 @@ var cliCommon = require('@backstage/cli-common');
|
|
|
6
6
|
var serveHandler = require('serve-handler');
|
|
7
7
|
var http = require('http');
|
|
8
8
|
var httpProxy = require('http-proxy');
|
|
9
|
-
var utility = require('./utility-
|
|
10
|
-
var mkdocsServer = require('./mkdocsServer-
|
|
9
|
+
var utility = require('./utility-3c0df5a9.cjs.js');
|
|
10
|
+
var mkdocsServer = require('./mkdocsServer-99ec8af2.cjs.js');
|
|
11
11
|
var pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
12
12
|
var fs = require('fs-extra');
|
|
13
13
|
require('winston');
|
|
@@ -178,4 +178,4 @@ Opening browser.`
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
exports["default"] = serve;
|
|
181
|
-
//# sourceMappingURL=serve-
|
|
181
|
+
//# sourceMappingURL=serve-461aaf60.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve-461aaf60.cjs.js","sources":["../../src/lib/httpServer.ts","../../src/commands/serve/serve.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 serveHandler from 'serve-handler';\nimport http from 'http';\nimport httpProxy from 'http-proxy';\nimport { createLogger } from './utility';\n\nexport default class HTTPServer {\n private readonly proxyEndpoint: string;\n private readonly backstageBundleDir: string;\n private readonly backstagePort: number;\n private readonly mkdocsTargetAddress: string;\n private readonly verbose: boolean;\n\n constructor(\n backstageBundleDir: string,\n backstagePort: number,\n mkdocsTargetAddress: string,\n verbose: boolean,\n ) {\n this.proxyEndpoint = '/api/techdocs/';\n this.backstageBundleDir = backstageBundleDir;\n this.backstagePort = backstagePort;\n this.mkdocsTargetAddress = mkdocsTargetAddress;\n this.verbose = verbose;\n }\n\n // Create a Proxy for mkdocs server\n private createProxy() {\n const proxy = httpProxy.createProxyServer({\n target: this.mkdocsTargetAddress,\n });\n\n return (request: http.IncomingMessage): [httpProxy, string] => {\n // If the request path is prefixed with this.proxyEndpoint, remove it.\n const proxyEndpointPath = new RegExp(`^${this.proxyEndpoint}`, 'i');\n const forwardPath = request.url?.replace(proxyEndpointPath, '') || '';\n\n return [proxy, forwardPath];\n };\n }\n\n public async serve(): Promise<http.Server> {\n return new Promise<http.Server>((resolve, reject) => {\n const proxyHandler = this.createProxy();\n const server = http.createServer(\n (request: http.IncomingMessage, response: http.ServerResponse) => {\n if (request.url?.startsWith(this.proxyEndpoint)) {\n const [proxy, forwardPath] = proxyHandler(request);\n\n proxy.on('error', (error: Error) => {\n reject(error);\n });\n\n response.setHeader('Access-Control-Allow-Origin', '*');\n response.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n\n request.url = forwardPath;\n proxy.web(request, response);\n return;\n }\n\n // This endpoint is used by the frontend to detect where the backend is running.\n if (request.url === '/.detect') {\n response.setHeader('Content-Type', 'text/plain');\n response.end('techdocs-cli-server');\n return;\n }\n\n serveHandler(request, response, {\n public: this.backstageBundleDir,\n trailingSlash: true,\n rewrites: [{ source: '**', destination: 'index.html' }],\n });\n },\n );\n\n const logger = createLogger({ verbose: false });\n server.listen(this.backstagePort, () => {\n if (this.verbose) {\n logger.info(\n `[techdocs-preview-bundle] Running local version of Backstage at http://localhost:${this.backstagePort}`,\n );\n }\n resolve(server);\n });\n\n server.on('error', (error: Error) => {\n reject(error);\n });\n });\n }\n}\n","/*\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 { OptionValues } from 'commander';\nimport path from 'path';\nimport openBrowser from 'react-dev-utils/openBrowser';\nimport { findPaths } from '@backstage/cli-common';\nimport HTTPServer from '../../lib/httpServer';\nimport { runMkdocsServer } from '../../lib/mkdocsServer';\nimport { LogFunc, waitForSignal } from '../../lib/run';\nimport { createLogger } from '../../lib/utility';\nimport { getMkdocsYml } from '@backstage/plugin-techdocs-node';\nimport fs from 'fs-extra';\n\nfunction findPreviewBundlePath(): string {\n try {\n return path.join(\n path.dirname(require.resolve('techdocs-cli-embedded-app/package.json')),\n 'dist',\n );\n } catch {\n // If the techdocs-cli-embedded-app package is not available it means we're\n // running a published package. For published packages the preview bundle is\n // copied to dist/embedded-app be the prepack script.\n //\n // This can be tested by running `yarn pack` and extracting the resulting tarball into a directory.\n // Within the extracted directory, run `npm install --only=prod`.\n // Once that's done you can test the CLI in any directory using `node <tmp-dir>/package <command>`.\n // eslint-disable-next-line no-restricted-syntax\n return findPaths(__dirname).resolveOwn('dist/embedded-app');\n }\n}\n\nfunction getPreviewAppPath(opts: OptionValues): string {\n return opts.previewAppBundlePath ?? findPreviewBundlePath();\n}\n\nexport default async function serve(opts: OptionValues) {\n const logger = createLogger({ verbose: opts.verbose });\n\n // Determine if we want to run in local dev mode or not\n // This will run the backstage http server on a different port and only used\n // for proxying mkdocs to the backstage app running locally (e.g. with webpack-dev-server)\n const isDevMode = Object.keys(process.env).includes('TECHDOCS_CLI_DEV_MODE')\n ? true\n : false;\n\n const backstageBackendPort = 7007;\n\n const mkdocsDockerAddr = `http://0.0.0.0:${opts.mkdocsPort}`;\n const mkdocsLocalAddr = `http://127.0.0.1:${opts.mkdocsPort}`;\n const mkdocsExpectedDevAddr = opts.docker\n ? mkdocsDockerAddr\n : mkdocsLocalAddr;\n\n const { path: mkdocsYmlPath, configIsTemporary } = await getMkdocsYml(\n './',\n opts.siteName,\n );\n\n let mkdocsServerHasStarted = false;\n const mkdocsLogFunc: LogFunc = data => {\n // Sometimes the lines contain an unnecessary extra new line\n const logLines = data.toString().split('\\n');\n const logPrefix = opts.docker ? '[docker/mkdocs]' : '[mkdocs]';\n logLines.forEach(line => {\n if (line === '') {\n return;\n }\n\n logger.verbose(`${logPrefix} ${line}`);\n\n // When the server has started, open a new browser tab for the user.\n if (\n !mkdocsServerHasStarted &&\n line.includes(`Serving on ${mkdocsExpectedDevAddr}`)\n ) {\n mkdocsServerHasStarted = true;\n }\n });\n };\n // mkdocs writes all of its logs to stderr by default, and not stdout.\n // https://github.com/mkdocs/mkdocs/issues/879#issuecomment-203536006\n // Had me questioning this whole implementation for half an hour.\n logger.info('Starting mkdocs server.');\n const mkdocsChildProcess = await runMkdocsServer({\n port: opts.mkdocsPort,\n dockerImage: opts.dockerImage,\n dockerEntrypoint: opts.dockerEntrypoint,\n dockerOptions: opts.dockerOption,\n useDocker: opts.docker,\n stdoutLogFunc: mkdocsLogFunc,\n stderrLogFunc: mkdocsLogFunc,\n });\n\n // Wait until mkdocs server has started so that Backstage starts with docs loaded\n // Takes 1-5 seconds\n for (let attempt = 0; attempt < 30; attempt++) {\n await new Promise(r => setTimeout(r, 3000));\n if (mkdocsServerHasStarted) {\n break;\n }\n logger.info('Waiting for mkdocs server to start...');\n }\n\n if (!mkdocsServerHasStarted) {\n logger.error(\n 'mkdocs server did not start. Exiting. Try re-running command with -v option for more details.',\n );\n }\n\n const port = isDevMode ? backstageBackendPort : opts.previewAppPort;\n const previewAppPath = getPreviewAppPath(opts);\n const httpServer = new HTTPServer(\n previewAppPath,\n port,\n mkdocsExpectedDevAddr,\n opts.verbose,\n );\n\n httpServer\n .serve()\n .catch(err => {\n logger.error('Failed to start HTTP server', err);\n mkdocsChildProcess.kill();\n process.exit(1);\n })\n .then(() => {\n // The last three things default/component/local/ don't matter. They can be anything.\n openBrowser(`http://localhost:${port}/docs/default/component/local/`);\n logger.info(\n `Serving docs in Backstage at http://localhost:${port}/docs/default/component/local/\\nOpening browser.`,\n );\n });\n\n await waitForSignal([mkdocsChildProcess]);\n\n if (configIsTemporary) {\n process.on('exit', async () => {\n fs.rmSync(mkdocsYmlPath, {});\n });\n }\n}\n"],"names":["httpProxy","http","serveHandler","createLogger","path","findPaths","getMkdocsYml","runMkdocsServer","openBrowser","waitForSignal","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAqB,UAAW,CAAA;AAAA,EAO9B,WACE,CAAA,kBAAA,EACA,aACA,EAAA,mBAAA,EACA,OACA,EAAA;AACA,IAAA,IAAA,CAAK,aAAgB,GAAA,gBAAA,CAAA;AACrB,IAAA,IAAA,CAAK,kBAAqB,GAAA,kBAAA,CAAA;AAC1B,IAAA,IAAA,CAAK,aAAgB,GAAA,aAAA,CAAA;AACrB,IAAA,IAAA,CAAK,mBAAsB,GAAA,mBAAA,CAAA;AAC3B,IAAA,IAAA,CAAK,OAAU,GAAA,OAAA,CAAA;AAAA,GACjB;AAAA;AAAA,EAGQ,WAAc,GAAA;AACpB,IAAM,MAAA,KAAA,GAAQA,8BAAU,iBAAkB,CAAA;AAAA,MACxC,QAAQ,IAAK,CAAA,mBAAA;AAAA,KACd,CAAA,CAAA;AAED,IAAA,OAAO,CAAC,OA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AAY,GAAA,oBAAA,GAAuB,IAAK,CAAA,cAAA,CAAA;AACrD,EAAM,MAAA,cAAA,GAAiB,kBAAkB,IAAI,CAAA,CAAA;AAC7C,EAAA,MAAM,aAAa,IAAI,UAAA;AAAA,IACrB,cAAA;AAAA,IACA,IAAA;AAAA,IACA,qBAAA;AAAA,IACA,IAAK,CAAA,OAAA;AAAA,GACP,CAAA;AAEA,EACG,UAAA,CAAA,KAAA,EACA,CAAA,KAAA,CAAM,CAAO,GAAA,KAAA;AACZ,IAAO,MAAA,CAAA,KAAA,CAAM,+BAA+B,GAAG,CAAA,CAAA;AAC/C,IAAA,kBAAA,CAAmB,IAAK,EAAA,CAAA;AACxB,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA;AAAA,GACf,CACA,CAAA,IAAA,CAAK,MAAM;AAEV,IAAAC,+BAAA,CAAY,oBAAoB,IAAoC,CAAA,8BAAA,CAAA,CAAA,CAAA;AACpE,IAAO,MAAA,CAAA,IAAA;AAAA,MACL,CAAiD,8CAAA,EAAA,IAAA,CAAA;AAAA,gBAAA,CAAA;AAAA,KACnD,CAAA;AAAA,GACD,CAAA,CAAA;AAEH,EAAM,MAAAC,0BAAA,CAAc,CAAC,kBAAkB,CAAC,CAAA,CAAA;AAExC,EAAA,IAAI,iBAAmB,EAAA;AACrB,IAAQ,OAAA,CAAA,EAAA,CAAG,QAAQ,YAAY;AAC7B,MAAGC,sBAAA,CAAA,MAAA,CAAO,aAAe,EAAA,EAAE,CAAA,CAAA;AAAA,KAC5B,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
|
|
@@ -60,4 +60,4 @@ const getLogStream = (logger) => {
|
|
|
60
60
|
exports.convertTechDocsRefToLocationAnnotation = convertTechDocsRefToLocationAnnotation;
|
|
61
61
|
exports.createLogger = createLogger;
|
|
62
62
|
exports.getLogStream = getLogStream;
|
|
63
|
-
//# sourceMappingURL=utility-
|
|
63
|
+
//# sourceMappingURL=utility-3c0df5a9.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility-3c0df5a9.cjs.js","sources":["../../src/lib/utility.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 */\nimport {\n RemoteProtocol,\n ParsedLocationAnnotation,\n} from '@backstage/plugin-techdocs-node';\nimport * as winston from 'winston';\nimport { Writable } from 'stream';\nimport { stdout } from 'process';\n\nexport const convertTechDocsRefToLocationAnnotation = (\n techdocsRef: string,\n): ParsedLocationAnnotation => {\n // Split on the first colon for the protocol and the rest after the first split\n // is the location.\n const [type, target] = techdocsRef.split(/:(.+)/) as [\n RemoteProtocol?,\n string?,\n ];\n\n if (!type || !target) {\n throw new Error(\n `Can not parse --techdocs-ref ${techdocsRef}. Should be of type HOST:URL.`,\n );\n }\n\n return { type, target };\n};\n\nexport const createLogger = ({\n verbose = false,\n}: {\n verbose: boolean;\n}): winston.Logger => {\n const logger = winston.createLogger({\n level: verbose ? 'verbose' : 'info',\n transports: [\n new winston.transports.Console({ format: winston.format.simple() }),\n ],\n });\n\n return logger;\n};\n\nexport const getLogStream = (logger: winston.Logger): Writable => {\n if (process.env.LOG_LEVEL === 'debug') {\n return stdout;\n }\n\n return new Writable({\n defaultEncoding: 'utf8',\n write(chunk, _encoding, next) {\n logger.verbose(chunk.toString().trim());\n next();\n },\n });\n};\n"],"names":["winston","stdout","Writable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBa,MAAA,sCAAA,GAAyC,CACpD,WAC6B,KAAA;AAG7B,EAAA,MAAM,CAAC,IAAM,EAAA,MAAM,CAAI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edirectFlow": {
|
|
264
|
+
"description": "$ Enable redirect authentication flow type, instead of a popup for authentication\n default value: 'false'",
|
|
265
|
+
"visibility": "frontend",
|
|
266
|
+
"type": "boolean"
|
|
262
267
|
}
|
|
263
268
|
},
|
|
264
269
|
"required": [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Backstage is an open platform for building developer portals"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.ico"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/><title>Techdocs Preview App</title><script defer="defer" src="/static/runtime.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Backstage is an open platform for building developer portals"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.ico"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/><title>Techdocs Preview App</title><script defer="defer" src="/static/runtime.3a433f5b.js"></script><script defer="defer" src="/static/module-material-ui.1f3c23cb.js"></script><script defer="defer" src="/static/module-lodash.b0e3bf8c.js"></script><script defer="defer" src="/static/module-date-fns.eeb6d2d2.js"></script><script defer="defer" src="/static/module-yaml.feabae04.js"></script><script defer="defer" src="/static/module-ajv.be583887.js"></script><script defer="defer" src="/static/module-material-table.2aa637a9.js"></script><script defer="defer" src="/static/module-luxon.f096b58d.js"></script><script defer="defer" src="/static/module-octokit.10809b9e.js"></script><script defer="defer" src="/static/module-react-dom.d698fbed.js"></script><script defer="defer" src="/static/module-react-router.3fa3d41e.js"></script><script defer="defer" src="/static/module-react-router-dom.87e15add.js"></script><script defer="defer" src="/static/module-zod.49079951.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.c3c3faee.js"></script><script defer="defer" src="/static/vendor.3a433f5b.js"></script><script defer="defer" src="/static/main.3a433f5b.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[6051],{76051:function(fe,b,d){d.r(b),d.d(b,{RealLogViewer:function(){return he}});var h=d(52322),C=d(95544),k=d(61837),W=d(19353),D=d(72779),L=d.n(D),g=d(2784),G=d(73557),P=d(7688),$=d(50166),v=d(47842),Y=d(46212);const B=(0,Y.Z)(),I=/\n\r?/g,R=Object.fromEntries(Object.entries({1:e=>({...e,bold:!0}),3:e=>({...e,italic:!0}),4:e=>({...e,underline:!0}),22:({bold:e,...t})=>t,23:({italic:e,...t})=>t,24:({underline:e,...t})=>t,30:e=>({...e,foreground:"black"}),31:e=>({...e,foreground:"red"}),32:e=>({...e,foreground:"green"}),33:e=>({...e,foreground:"yellow"}),34:e=>({...e,foreground:"blue"}),35:e=>({...e,foreground:"magenta"}),36:e=>({...e,foreground:"cyan"}),37:e=>({...e,foreground:"white"}),39:({foreground:e,...t})=>t,90:e=>({...e,foreground:"grey"}),40:e=>({...e,background:"black"}),41:e=>({...e,background:"red"}),42:e=>({...e,background:"green"}),43:e=>({...e,background:"yellow"}),44:e=>({...e,background:"blue"}),45:e=>({...e,background:"magenta"}),46:e=>({...e,background:"cyan"}),47:e=>({...e,background:"white"}),49:({background:e,...t})=>t}).map(([e,t])=>[`\x1B[${e}m`,t]));class j{lastChunk(){return this.chunks[this.chunks.length-1]}replaceLastChunk(t){t&&(this.chunks.splice(this.chunks.length-1,1,...t),this.text=this.chunks.map(n=>n.text).join("").toLocaleLowerCase("en-US"))}constructor(t=1,n=[]){(0,v.Z)(this,"lineNumber",void 0),(0,v.Z)(this,"chunks",void 0),(0,v.Z)(this,"text",void 0),this.lineNumber=t,this.chunks=n,this.text=n.map(s=>s.text).join("").toLocaleLowerCase("en-US")}}class J{process(t){if(this.text===t)return this.lines;if(t.startsWith(this.text)){var n;const r=this.lines.length>0?this.lines.length-1:0;var s;const i=(s=this.lines[r])!==null&&s!==void 0?s:new j,c=i.lastChunk();var o;const l=this.processLines(((o=c==null?void 0:c.text)!==null&&o!==void 0?o:"")+t.slice(this.text.length),c==null?void 0:c.modifiers,i==null?void 0:i.lineNumber);i.replaceLastChunk((n=l[0])===null||n===void 0?void 0:n.chunks),this.lines[r]=i,this.lines.push(...l.slice(1))}else this.lines=this.processLines(t);return this.text=t,this.lines}constructor(){(0,v.Z)(this,"text",""),(0,v.Z)(this,"lines",[]),(0,v.Z)(this,"processLines",(t,n={},s=1)=>{const o=[];let r=n,i=s,c=0;for(I.lastIndex=0;;){const u=I.exec(t);if(!u){const m=this.processText(t.slice(c),r);return o.push(new j(i,m)),o}const a=t.slice(c,u.index);c=u.index+u[0].length;const f=this.processText(a,r);o.push(new j(i,f));var l;r=(l=f[f.length-1].modifiers)!==null&&l!==void 0?l:r,i+=1}}),(0,v.Z)(this,"processText",(t,n)=>{const s=[];let o=n,r=0;for(B.lastIndex=0;;){const i=B.exec(t);if(!i)return s.push({text:t.slice(r),modifiers:o}),s;const c=t.slice(r,i.index);s.push({text:c,modifiers:o}),r=i.index+i[0].length,o=this.processCode(i[0],o)}}),(0,v.Z)(this,"processCode",(t,n)=>{var s,o;return(o=(s=R[t])===null||s===void 0?void 0:s.call(R,n))!==null&&o!==void 0?o:n})}}var Q=d(74600),F=d.n(Q);function X(e,t){const n=new Array;if(t.bold&&n.push(e.modifierBold),t.italic&&n.push(e.modifierItalic),t.underline&&n.push(e.modifierUnderline),t.foreground){const s=`modifierForeground${F()(t.foreground)}`;n.push(e[s])}if(t.background){const s=`modifierBackground${F()(t.background)}`;n.push(e[s])}return n.length>0?n.join(" "):void 0}function w(e,t){if(!t||!e.includes(t))return;const n=new Array;let s=0;for(;;){const o=e.indexOf(t,s);if(o===-1)break;const r=o+t.length;n.push({start:o,end:r}),s=r}return n}function q(e,t){const n=w(e.text,t);if(!n)return e.chunks;const s=new Array;let o=0,r=0,i=n[r];for(const c of e.chunks){const{text:l,modifiers:u}=c;if(!i||o+l.length<i.start){s.push(c),o+=l.length;continue}let a=0;for(;i;){const m=Math.max(i.start-o,0);if(m>l.length)break;const p=Math.min(i.end-o,l.length);if(m>a&&s.push({text:l.slice(a,m),modifiers:u}),p>m&&s.push({modifiers:u,highlight:r,text:l.slice(m,p)}),a=p,i.end-o===p)r+=1,i=n[r];else break}a<l.length&&s.push({text:l.slice(a),modifiers:u}),o+=l.length}return s}function _({line:e,classes:t,searchText:n,highlightResultIndex:s}){const o=(0,g.useMemo)(()=>q(e,n),[e,n]),r=(0,g.useMemo)(()=>o.map(({text:i,modifiers:c,highlight:l},u)=>(0,h.jsx)("span",{className:L()(X(t,c),l!==void 0&&(l===s?t.textSelectedHighlight:t.textHighlight)),children:i},u)),[o,s,t]);return(0,h.jsx)(h.Fragment,{children:r})}var ee=d(86619),te=d(90436),ne=d(48049),oe=d(51209),M=d(36444);function se(e){const{resultCount:t,resultIndexStep:n,toggleShouldFilter:s}=e;var o;const r=(o=e.resultIndex)!==null&&o!==void 0?o:0,i=c=>{c.key==="Enter"&&(c.metaKey||c.ctrlKey||c.altKey?s():n(c.shiftKey))};return(0,h.jsxs)(h.Fragment,{children:[t!==void 0&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(k.Z,{size:"small",onClick:()=>n(!0),children:(0,h.jsx)(ne.Z,{})}),(0,h.jsxs)(te.Z,{children:[Math.min(r+1,t),"/",t]}),(0,h.jsx)(k.Z,{size:"small",onClick:()=>n(),children:(0,h.jsx)(oe.Z,{})})]}),(0,h.jsx)(ee.Z,{size:"small",variant:"standard",placeholder:"Search",value:e.searchInput,onKeyPress:i,onChange:c=>e.setSearchInput(c.target.value)}),(0,h.jsx)(k.Z,{size:"small",onClick:s,children:e.shouldFilter?(0,h.jsx)(M.Z,{color:"primary"}):(0,h.jsx)(M.Z,{color:"disabled"})})]})}var re=d(79692),N=d(41128),Z=d(31754),T=d(66054),A=d(81463),E=d(34505),z=d(57186),K=d(32720),H=d(92901),O=d(45410);const V=40,ie=(0,re.Z)(e=>({root:{background:e.palette.background.paper},header:{height:V,display:"flex",alignItems:"center",justifyContent:"flex-end"},log:{fontFamily:'"Monaco", monospace',fontSize:e.typography.pxToRem(12)},line:{position:"relative",whiteSpace:"pre","&:hover":{background:e.palette.action.hover}},lineSelected:{background:e.palette.action.selected,"&:hover":{background:e.palette.action.selected}},lineCopyButton:{position:"absolute",paddingTop:0,paddingBottom:0},lineNumber:{display:"inline-block",textAlign:"end",width:60,marginRight:e.spacing(1),cursor:"pointer"},textHighlight:{background:(0,N.Fq)(e.palette.info.main,.15)},textSelectedHighlight:{background:(0,N.Fq)(e.palette.info.main,.4)},modifierBold:{fontWeight:e.typography.fontWeightBold},modifierItalic:{fontStyle:"italic"},modifierUnderline:{textDecoration:"underline"},modifierForegroundBlack:{color:Z.Z.black},modifierForegroundRed:{color:T.Z[500]},modifierForegroundGreen:{color:A.Z[500]},modifierForegroundYellow:{color:E.Z[500]},modifierForegroundBlue:{color:z.Z[500]},modifierForegroundMagenta:{color:K.Z[500]},modifierForegroundCyan:{color:H.Z[500]},modifierForegroundWhite:{color:Z.Z.white},modifierForegroundGrey:{color:O.Z[500]},modifierBackgroundBlack:{background:Z.Z.black},modifierBackgroundRed:{background:T.Z[500]},modifierBackgroundGreen:{background:A.Z[500]},modifierBackgroundYellow:{background:E.Z[500]},modifierBackgroundBlue:{background:z.Z[500]},modifierBackgroundMagenta:{background:K.Z[500]},modifierBackgroundCyan:{background:H.Z[500]},modifierBackgroundWhite:{background:Z.Z.white},modifierBackgroundGrey:{background:O.Z[500]}}),{name:"BackstageLogViewer"});var le=d(96686);function ce(e,t){if(!t)return{lines:e};const n=[],s=[];for(const o of e)if(o.text.includes(t)){n.push(o);let r=0,i=0;for(;;){const c=o.text.indexOf(t,r);if(c===-1)break;s.push({lineNumber:o.lineNumber,lineIndex:i++}),r=c+t.length}}return{lines:n,results:s}}function de(e){var t;const[n,s]=(0,g.useState)(""),o=n.toLocaleLowerCase("en-US"),[r,i]=(0,g.useState)(0),[c,l]=(0,le.O)(!1),u=(0,g.useMemo)(()=>ce(e,o),[e,o]),a=u.results?u.results[Math.min(r,u.results.length-1)]:void 0,f=(t=u.results)===null||t===void 0?void 0:t.length,m=p=>{if(p){if(f!==void 0){const x=Math.min(r-1,f-2);i(x<0?f-1:x)}}else if(f!==void 0){const x=r+1;i(x>=f?0:x)}};return{lines:c?u.lines:e,searchText:o,searchInput:n,setSearchInput:s,shouldFilter:c,toggleShouldFilter:l,resultCount:f,resultIndex:r,resultIndexStep:m,resultLine:a==null?void 0:a.lineNumber,resultLineIndex:a==null?void 0:a.lineIndex}}var U=d(60871),ae=d(95074);function ue(e){const t=(0,U.h_)(U.VE),[n,s]=(0,g.useState)(),o=n?Math.min(n.start,n.end):void 0,r=n?Math.max(n.start,n.end):void 0,[{error:i},c]=(0,ae.Z)();return(0,g.useEffect)(()=>{i&&t.post(i)},[i,t]),{shouldShowButton(l){return o===l||r===l},isSelected(l){return n?o<=l&&l<=r:!1},setSelection(l,u){s(u?a=>a?{start:a.start,end:l}:{start:l,end:l}:a=>(a==null?void 0:a.start)===l&&(a==null?void 0:a.end)===l?void 0:{start:l,end:l})},copySelection(){if(n){const l=e.slice(Math.min(n.start,n.end)-1,Math.max(n.start,n.end)).map(u=>u.chunks.map(a=>a.text).join("")).join(`
|
|
2
|
+
`);c(l),s(void 0)}}}}function he(e){const t=ie({classes:e.classes}),n=(0,g.useRef)(null),o=(0,g.useMemo)(()=>new J,[]).process(e.text),r=de(o),i=ue(o),c=(0,G.TH)();(0,g.useEffect)(()=>{r.resultLine!==void 0&&n.current&&n.current.scrollToItem(r.resultLine-1,"center")},[r.resultLine]),(0,g.useEffect)(()=>{if(c.hash){const u=parseInt(c.hash.replace(/\D/g,""),10);i.setSelection(u,!1)}},[]);const l=(u,a)=>{i.setSelection(u,a.shiftKey)};return(0,h.jsx)(P.Z,{children:({height:u,width:a})=>(0,h.jsxs)(C.Z,{style:{width:a,height:u},className:t.root,children:[(0,h.jsx)(C.Z,{className:t.header,children:(0,h.jsx)(se,{...r})}),(0,h.jsx)($.t7,{ref:n,className:t.log,height:u-V,width:a,itemData:r.lines,itemSize:20,itemCount:r.lines.length,children:({index:f,style:m,data:p})=>{const x=p[f],{lineNumber:y}=x;return(0,h.jsxs)(C.Z,{style:{...m},className:L()(t.line,{[t.lineSelected]:i.isSelected(y)}),children:[i.shouldShowButton(y)&&(0,h.jsx)(k.Z,{"data-testid":"copy-button",size:"small",className:t.lineCopyButton,onClick:()=>i.copySelection(),children:(0,h.jsx)(W.Z,{fontSize:"inherit"})}),(0,h.jsx)("a",{role:"row",target:"_self",href:`#line-${y}`,className:t.lineNumber,onClick:S=>l(y,S),onKeyPress:S=>l(y,S),children:y}),(0,h.jsx)(_,{line:x,classes:t,searchText:r.searchText,highlightResultIndex:r.resultLine===y?r.resultLineIndex:void 0})]})}})]})})}}}]);})();
|
|
3
|
+
|
|
4
|
+
//# sourceMappingURL=6051.002ec2c4.chunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static/6051.002ec2c4.chunk.js","mappings":"4UAkBA,MAAMA,KAAYC,EAAAA,GAAe,EAC3BC,EAAe,SAGfC,EAAgBC,OA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YAEvC,OAAC0B,EAAAA,EAAQA,CAACnG,SAAS,S,QAGvB,OAACoG,IAAAA,CACCC,KAAK,MACLvH,OAAO,QACPwH,KAAM,SAASlN,IACf4D,UAAWnC,EAAQzB,WACnB6E,QAASP,GAAS8H,EAAiBpM,EAAYsE,CAAK,EACpDgB,WAAYhB,GAAS8H,EAAiBpM,EAAYsE,CAAK,E,SAEtDtE,C,MAEH,OAACuD,EAAOA,CACNnC,KAAMA,EACNK,QAASA,EACTU,WAAYwJ,EAAOxJ,WACnBqB,qBACEmI,EAAOvB,aAAepK,EAClB2L,EAAOtB,gBACPpI,M,KAKd,C,OAMZ,C","sources":["webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/AnsiProcessor.ts","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/LogLine.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/LogViewerControls.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/styles.ts","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/useLogViewerSearch.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/useLogViewerSelection.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/RealLogViewer.tsx"],"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\nimport ansiRegexMaker from 'ansi-regex';\n\nconst ansiRegex = ansiRegexMaker();\nconst newlineRegex = /\\n\\r?/g;\n\n// A mapping of how each escape code changes the modifiers\nconst codeModifiers = Object.fromEntries(\n Object.entries({\n 1: m => ({ ...m, bold: true }),\n 3: m => ({ ...m, italic: true }),\n 4: m => ({ ...m, underline: true }),\n 22: ({ bold: _, ...m }) => m,\n 23: ({ italic: _, ...m }) => m,\n 24: ({ underline: _, ...m }) => m,\n 30: m => ({ ...m, foreground: 'black' }),\n 31: m => ({ ...m, foreground: 'red' }),\n 32: m => ({ ...m, foreground: 'green' }),\n 33: m => ({ ...m, foreground: 'yellow' }),\n 34: m => ({ ...m, foreground: 'blue' }),\n 35: m => ({ ...m, foreground: 'magenta' }),\n 36: m => ({ ...m, foreground: 'cyan' }),\n 37: m => ({ ...m, foreground: 'white' }),\n 39: ({ foreground: _, ...m }) => m,\n 90: m => ({ ...m, foreground: 'grey' }),\n 40: m => ({ ...m, background: 'black' }),\n 41: m => ({ ...m, background: 'red' }),\n 42: m => ({ ...m, background: 'green' }),\n 43: m => ({ ...m, background: 'yellow' }),\n 44: m => ({ ...m, background: 'blue' }),\n 45: m => ({ ...m, background: 'magenta' }),\n 46: m => ({ ...m, background: 'cyan' }),\n 47: m => ({ ...m, background: 'white' }),\n 49: ({ background: _, ...m }) => m,\n } as Record<string, (m: ChunkModifiers) => ChunkModifiers>).map(\n ([code, modifier]) => [`\\x1b[${code}m`, modifier],\n ),\n);\n\nexport type AnsiColor =\n | 'black'\n | 'red'\n | 'green'\n | 'yellow'\n | 'blue'\n | 'magenta'\n | 'cyan'\n | 'white'\n | 'grey';\n\nexport interface ChunkModifiers {\n foreground?: AnsiColor;\n background?: AnsiColor;\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n}\n\nexport interface AnsiChunk {\n text: string;\n modifiers: ChunkModifiers;\n}\n\nexport class AnsiLine {\n text: string;\n\n constructor(\n readonly lineNumber: number = 1,\n readonly chunks: AnsiChunk[] = [],\n ) {\n this.text = chunks\n .map(c => c.text)\n .join('')\n .toLocaleLowerCase('en-US');\n }\n\n lastChunk(): AnsiChunk | undefined {\n return this.chunks[this.chunks.length - 1];\n }\n\n replaceLastChunk(newChunks?: AnsiChunk[]) {\n if (newChunks) {\n this.chunks.splice(this.chunks.length - 1, 1, ...newChunks);\n this.text = this.chunks\n .map(c => c.text)\n .join('')\n .toLocaleLowerCase('en-US');\n }\n }\n}\n\nexport class AnsiProcessor {\n private text: string = '';\n private lines: AnsiLine[] = [];\n\n /**\n * Processes a chunk of text while keeping internal state that optimizes\n * subsequent processing that appends to the text.\n */\n process(text: string): AnsiLine[] {\n if (this.text === text) {\n return this.lines;\n }\n\n if (text.startsWith(this.text)) {\n const lastLineIndex = this.lines.length > 0 ? this.lines.length - 1 : 0;\n const lastLine = this.lines[lastLineIndex] ?? new AnsiLine();\n const lastChunk = lastLine.lastChunk();\n\n const newLines = this.processLines(\n (lastChunk?.text ?? '') + text.slice(this.text.length),\n lastChunk?.modifiers,\n lastLine?.lineNumber,\n );\n lastLine.replaceLastChunk(newLines[0]?.chunks);\n\n this.lines[lastLineIndex] = lastLine;\n this.lines.push(...newLines.slice(1));\n } else {\n this.lines = this.processLines(text);\n }\n this.text = text;\n\n return this.lines;\n }\n\n // Split a chunk of text up into lines and process each line individually\n private processLines = (\n text: string,\n modifiers: ChunkModifiers = {},\n startingLineNumber: number = 1,\n ): AnsiLine[] => {\n const lines: AnsiLine[] = [];\n\n let currentModifiers = modifiers;\n let currentLineNumber = startingLineNumber;\n\n let prevIndex = 0;\n newlineRegex.lastIndex = 0;\n for (;;) {\n const match = newlineRegex.exec(text);\n if (!match) {\n const chunks = this.processText(\n text.slice(prevIndex),\n currentModifiers,\n );\n lines.push(new AnsiLine(currentLineNumber, chunks));\n return lines;\n }\n\n const line = text.slice(prevIndex, match.index);\n prevIndex = match.index + match[0].length;\n\n const chunks = this.processText(line, currentModifiers);\n lines.push(new AnsiLine(currentLineNumber, chunks));\n\n // Modifiers that are active in the last chunk are carried over to the next line\n currentModifiers =\n chunks[chunks.length - 1].modifiers ?? currentModifiers;\n currentLineNumber += 1;\n }\n };\n\n // Processing of a one individual text chunk\n private processText = (\n fullText: string,\n modifiers: ChunkModifiers,\n ): AnsiChunk[] => {\n const chunks: AnsiChunk[] = [];\n\n let currentModifiers = modifiers;\n\n let prevIndex = 0;\n ansiRegex.lastIndex = 0;\n for (;;) {\n const match = ansiRegex.exec(fullText);\n if (!match) {\n chunks.push({\n text: fullText.slice(prevIndex),\n modifiers: currentModifiers,\n });\n return chunks;\n }\n\n const text = fullText.slice(prevIndex, match.index);\n chunks.push({ text, modifiers: currentModifiers });\n\n // For every escape code that we encounter we keep track of where the\n // next chunk of text starts, and what modifiers it has\n prevIndex = match.index + match[0].length;\n currentModifiers = this.processCode(match[0], currentModifiers);\n }\n };\n\n private processCode = (\n code: string,\n modifiers: ChunkModifiers,\n ): ChunkModifiers => {\n return codeModifiers[code]?.(modifiers) ?? modifiers;\n };\n}\n","/*\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\nimport React, { useMemo } from 'react';\nimport { AnsiChunk, AnsiLine, ChunkModifiers } from './AnsiProcessor';\nimport startCase from 'lodash/startCase';\nimport classnames from 'classnames';\nimport { useStyles } from './styles';\n\nexport function getModifierClasses(\n classes: ReturnType<typeof useStyles>,\n modifiers: ChunkModifiers,\n) {\n const classNames = new Array<string>();\n if (modifiers.bold) {\n classNames.push(classes.modifierBold);\n }\n if (modifiers.italic) {\n classNames.push(classes.modifierItalic);\n }\n if (modifiers.underline) {\n classNames.push(classes.modifierUnderline);\n }\n if (modifiers.foreground) {\n const key = `modifierForeground${startCase(\n modifiers.foreground,\n )}` as keyof typeof classes;\n classNames.push(classes[key]);\n }\n if (modifiers.background) {\n const key = `modifierBackground${startCase(\n modifiers.background,\n )}` as keyof typeof classes;\n classNames.push(classes[key]);\n }\n return classNames.length > 0 ? classNames.join(' ') : undefined;\n}\n\nexport function findSearchResults(text: string, searchText: string) {\n if (!searchText || !text.includes(searchText)) {\n return undefined;\n }\n const searchResults = new Array<{ start: number; end: number }>();\n let offset = 0;\n for (;;) {\n const start = text.indexOf(searchText, offset);\n if (start === -1) {\n break;\n }\n const end = start + searchText.length;\n searchResults.push({ start, end });\n offset = end;\n }\n return searchResults;\n}\n\nexport interface HighlightAnsiChunk extends AnsiChunk {\n highlight?: number;\n}\n\nexport function calculateHighlightedChunks(\n line: AnsiLine,\n searchText: string,\n): HighlightAnsiChunk[] {\n const results = findSearchResults(line.text, searchText);\n if (!results) {\n return line.chunks;\n }\n\n const chunks = new Array<HighlightAnsiChunk>();\n\n let lineOffset = 0;\n let resultIndex = 0;\n let result = results[resultIndex];\n for (const chunk of line.chunks) {\n const { text, modifiers } = chunk;\n if (!result || lineOffset + text.length < result.start) {\n chunks.push(chunk);\n lineOffset += text.length;\n continue;\n }\n\n let localOffset = 0;\n while (result) {\n const localStart = Math.max(result.start - lineOffset, 0);\n if (localStart > text.length) {\n break; // The next result is not in this chunk\n }\n\n const localEnd = Math.min(result.end - lineOffset, text.length);\n\n const hasTextBeforeResult = localStart > localOffset;\n if (hasTextBeforeResult) {\n chunks.push({ text: text.slice(localOffset, localStart), modifiers });\n }\n const hasResultText = localEnd > localStart;\n if (hasResultText) {\n chunks.push({\n modifiers,\n highlight: resultIndex,\n text: text.slice(localStart, localEnd),\n });\n }\n\n localOffset = localEnd;\n\n const foundCompleteResult = result.end - lineOffset === localEnd;\n if (foundCompleteResult) {\n resultIndex += 1;\n result = results[resultIndex];\n } else {\n break; // The rest of the result is in the following chunks\n }\n }\n\n const hasTextAfterResult = localOffset < text.length;\n if (hasTextAfterResult) {\n chunks.push({ text: text.slice(localOffset), modifiers });\n }\n\n lineOffset += text.length;\n }\n\n return chunks;\n}\n\nexport interface LogLineProps {\n line: AnsiLine;\n classes: ReturnType<typeof useStyles>;\n searchText: string;\n highlightResultIndex?: number;\n}\n\nexport function LogLine({\n line,\n classes,\n searchText,\n highlightResultIndex,\n}: LogLineProps) {\n const chunks = useMemo(\n () => calculateHighlightedChunks(line, searchText),\n [line, searchText],\n );\n\n const elements = useMemo(\n () =>\n chunks.map(({ text, modifiers, highlight }, index) => (\n // eslint-disable-next-line react/forbid-elements\n <span\n key={index}\n className={classnames(\n getModifierClasses(classes, modifiers),\n highlight !== undefined &&\n (highlight === highlightResultIndex\n ? classes.textSelectedHighlight\n : classes.textHighlight),\n )}\n >\n {text}\n </span>\n )),\n [chunks, highlightResultIndex, classes],\n );\n\n return <>{elements}</>;\n}\n","/*\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\nimport React from 'react';\nimport IconButton from '@material-ui/core/IconButton';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport ChevronLeftIcon from '@material-ui/icons/ChevronLeft';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport FilterListIcon from '@material-ui/icons/FilterList';\nimport { LogViewerSearch } from './useLogViewerSearch';\n\nexport interface LogViewerControlsProps extends LogViewerSearch {}\n\nexport function LogViewerControls(props: LogViewerControlsProps) {\n const { resultCount, resultIndexStep, toggleShouldFilter } = props;\n const resultIndex = props.resultIndex ?? 0;\n\n const handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n if (event.metaKey || event.ctrlKey || event.altKey) {\n toggleShouldFilter();\n } else {\n resultIndexStep(event.shiftKey);\n }\n }\n };\n\n return (\n <>\n {resultCount !== undefined && (\n <>\n <IconButton size=\"small\" onClick={() => resultIndexStep(true)}>\n <ChevronLeftIcon />\n </IconButton>\n <Typography>\n {Math.min(resultIndex + 1, resultCount)}/{resultCount}\n </Typography>\n <IconButton size=\"small\" onClick={() => resultIndexStep()}>\n <ChevronRightIcon />\n </IconButton>\n </>\n )}\n <TextField\n size=\"small\"\n variant=\"standard\"\n placeholder=\"Search\"\n value={props.searchInput}\n onKeyPress={handleKeyPress}\n onChange={e => props.setSearchInput(e.target.value)}\n />\n <IconButton size=\"small\" onClick={toggleShouldFilter}>\n {props.shouldFilter ? (\n <FilterListIcon color=\"primary\" />\n ) : (\n <FilterListIcon color=\"disabled\" />\n )}\n </IconButton>\n </>\n );\n}\n","/*\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\nimport { alpha, makeStyles } from '@material-ui/core/styles';\nimport * as colors from '@material-ui/core/colors';\n\nexport const HEADER_SIZE = 40;\n\n/** @public Class keys for overriding LogViewer styles */\nexport type LogViewerClassKey =\n | 'root'\n | 'header'\n | 'log'\n | 'line'\n | 'lineSelected'\n | 'lineCopyButton'\n | 'lineNumber'\n | 'textHighlight'\n | 'textSelectedHighlight'\n | 'modifierBold'\n | 'modifierItalic'\n | 'modifierUnderline'\n | 'modifierForegroundBlack'\n | 'modifierForegroundRed'\n | 'modifierForegroundGreen'\n | 'modifierForegroundYellow'\n | 'modifierForegroundBlue'\n | 'modifierForegroundMagenta'\n | 'modifierForegroundCyan'\n | 'modifierForegroundWhite'\n | 'modifierForegroundGrey'\n | 'modifierBackgroundBlack'\n | 'modifierBackgroundRed'\n | 'modifierBackgroundGreen'\n | 'modifierBackgroundYellow'\n | 'modifierBackgroundBlue'\n | 'modifierBackgroundMagenta'\n | 'modifierBackgroundCyan'\n | 'modifierBackgroundWhite'\n | 'modifierBackgroundGrey';\n\nexport const useStyles = makeStyles(\n theme => ({\n root: {\n background: theme.palette.background.paper,\n },\n header: {\n height: HEADER_SIZE,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end',\n },\n log: {\n fontFamily: '\"Monaco\", monospace',\n fontSize: theme.typography.pxToRem(12),\n },\n line: {\n position: 'relative',\n whiteSpace: 'pre',\n\n '&:hover': {\n background: theme.palette.action.hover,\n },\n },\n lineSelected: {\n background: theme.palette.action.selected,\n\n '&:hover': {\n background: theme.palette.action.selected,\n },\n },\n lineCopyButton: {\n position: 'absolute',\n paddingTop: 0,\n paddingBottom: 0,\n },\n lineNumber: {\n display: 'inline-block',\n textAlign: 'end',\n width: 60,\n marginRight: theme.spacing(1),\n cursor: 'pointer',\n },\n textHighlight: {\n background: alpha(theme.palette.info.main, 0.15),\n },\n textSelectedHighlight: {\n background: alpha(theme.palette.info.main, 0.4),\n },\n modifierBold: {\n fontWeight: theme.typography.fontWeightBold,\n },\n modifierItalic: {\n fontStyle: 'italic',\n },\n modifierUnderline: {\n textDecoration: 'underline',\n },\n modifierForegroundBlack: {\n color: colors.common.black,\n },\n modifierForegroundRed: {\n color: colors.red[500],\n },\n modifierForegroundGreen: {\n color: colors.green[500],\n },\n modifierForegroundYellow: {\n color: colors.yellow[500],\n },\n modifierForegroundBlue: {\n color: colors.blue[500],\n },\n modifierForegroundMagenta: {\n color: colors.purple[500],\n },\n modifierForegroundCyan: {\n color: colors.cyan[500],\n },\n modifierForegroundWhite: {\n color: colors.common.white,\n },\n modifierForegroundGrey: {\n color: colors.grey[500],\n },\n modifierBackgroundBlack: {\n background: colors.common.black,\n },\n modifierBackgroundRed: {\n background: colors.red[500],\n },\n modifierBackgroundGreen: {\n background: colors.green[500],\n },\n modifierBackgroundYellow: {\n background: colors.yellow[500],\n },\n modifierBackgroundBlue: {\n background: colors.blue[500],\n },\n modifierBackgroundMagenta: {\n background: colors.purple[500],\n },\n modifierBackgroundCyan: {\n background: colors.cyan[500],\n },\n modifierBackgroundWhite: {\n background: colors.common.white,\n },\n modifierBackgroundGrey: {\n background: colors.grey[500],\n },\n }),\n { name: 'BackstageLogViewer' },\n);\n","/*\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\nimport { useMemo, useState } from 'react';\nimport { useToggle } from '@react-hookz/web';\nimport { AnsiLine } from './AnsiProcessor';\n\nexport function applySearchFilter(lines: AnsiLine[], searchText: string) {\n if (!searchText) {\n return { lines };\n }\n\n const matchingLines = [];\n const searchResults = [];\n for (const line of lines) {\n if (line.text.includes(searchText)) {\n matchingLines.push(line);\n\n let offset = 0;\n let lineResultIndex = 0;\n for (;;) {\n const start = line.text.indexOf(searchText, offset);\n if (start === -1) {\n break;\n }\n searchResults.push({\n lineNumber: line.lineNumber,\n lineIndex: lineResultIndex++,\n });\n offset = start + searchText.length;\n }\n }\n }\n\n return {\n lines: matchingLines,\n results: searchResults,\n };\n}\n\nexport interface LogViewerSearch {\n lines: AnsiLine[];\n\n searchText: string;\n searchInput: string;\n setSearchInput: (searchInput: string) => void;\n\n shouldFilter: boolean;\n toggleShouldFilter: () => void;\n\n resultCount: number | undefined;\n resultIndex: number | undefined;\n resultIndexStep: (decrement?: boolean) => void;\n\n resultLine: number | undefined;\n resultLineIndex: number | undefined;\n}\n\nexport function useLogViewerSearch(lines: AnsiLine[]): LogViewerSearch {\n const [searchInput, setSearchInput] = useState('');\n const searchText = searchInput.toLocaleLowerCase('en-US');\n\n const [resultIndex, setResultIndex] = useState<number>(0);\n\n const [shouldFilter, toggleShouldFilter] = useToggle(false);\n\n const filter = useMemo(\n () => applySearchFilter(lines, searchText),\n [lines, searchText],\n );\n\n const searchResult = filter.results\n ? filter.results[Math.min(resultIndex, filter.results.length - 1)]\n : undefined;\n const resultCount = filter.results?.length;\n\n const resultIndexStep = (decrement?: boolean) => {\n if (decrement) {\n if (resultCount !== undefined) {\n const next = Math.min(resultIndex - 1, resultCount - 2);\n setResultIndex(next < 0 ? resultCount - 1 : next);\n }\n } else {\n if (resultCount !== undefined) {\n const next = resultIndex + 1;\n setResultIndex(next >= resultCount ? 0 : next);\n }\n }\n };\n\n return {\n lines: shouldFilter ? filter.lines : lines,\n searchText,\n searchInput,\n setSearchInput,\n shouldFilter,\n toggleShouldFilter,\n resultCount,\n resultIndex,\n resultIndexStep,\n resultLine: searchResult?.lineNumber,\n resultLineIndex: searchResult?.lineIndex,\n };\n}\n","/*\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\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useEffect, useState } from 'react';\nimport useCopyToClipboard from 'react-use/lib/useCopyToClipboard';\nimport { AnsiLine } from './AnsiProcessor';\n\nexport function useLogViewerSelection(lines: AnsiLine[]) {\n const errorApi = useApi(errorApiRef);\n const [sel, setSelection] = useState<{ start: number; end: number }>();\n const start = sel ? Math.min(sel.start, sel.end) : undefined;\n const end = sel ? Math.max(sel.start, sel.end) : undefined;\n\n const [{ error }, copyToClipboard] = useCopyToClipboard();\n\n useEffect(() => {\n if (error) {\n errorApi.post(error);\n }\n }, [error, errorApi]);\n\n return {\n shouldShowButton(line: number) {\n return start === line || end === line;\n },\n isSelected(line: number) {\n if (!sel) {\n return false;\n }\n return start! <= line && line <= end!;\n },\n setSelection(line: number, add: boolean) {\n if (add) {\n setSelection(s =>\n s ? { start: s.start, end: line } : { start: line, end: line },\n );\n } else {\n setSelection(s =>\n s?.start === line && s?.end === line\n ? undefined\n : { start: line, end: line },\n );\n }\n },\n copySelection() {\n if (sel) {\n const copyText = lines\n .slice(Math.min(sel.start, sel.end) - 1, Math.max(sel.start, sel.end))\n .map(l => l.chunks.map(c => c.text).join(''))\n .join('\\n');\n copyToClipboard(copyText);\n setSelection(undefined);\n }\n },\n };\n}\n","/*\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 */\nimport Box from '@material-ui/core/Box';\nimport IconButton from '@material-ui/core/IconButton';\nimport CopyIcon from '@material-ui/icons/FileCopy';\nimport classnames from 'classnames';\nimport React, { useEffect, useMemo, useRef } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport AutoSizer from 'react-virtualized-auto-sizer';\nimport { FixedSizeList } from 'react-window';\n\nimport { AnsiProcessor } from './AnsiProcessor';\nimport { LogLine } from './LogLine';\nimport { LogViewerControls } from './LogViewerControls';\nimport { HEADER_SIZE, useStyles } from './styles';\nimport { useLogViewerSearch } from './useLogViewerSearch';\nimport { useLogViewerSelection } from './useLogViewerSelection';\n\nexport interface RealLogViewerProps {\n text: string;\n classes?: { root?: string };\n}\n\nexport function RealLogViewer(props: RealLogViewerProps) {\n const classes = useStyles({ classes: props.classes });\n const listRef = useRef<FixedSizeList | null>(null);\n\n // The processor keeps state that optimizes appending to the text\n const processor = useMemo(() => new AnsiProcessor(), []);\n const lines = processor.process(props.text);\n\n const search = useLogViewerSearch(lines);\n const selection = useLogViewerSelection(lines);\n const location = useLocation();\n\n useEffect(() => {\n if (search.resultLine !== undefined && listRef.current) {\n listRef.current.scrollToItem(search.resultLine - 1, 'center');\n }\n }, [search.resultLine]);\n\n useEffect(() => {\n if (location.hash) {\n // #line-6 -> 6\n const line = parseInt(location.hash.replace(/\\D/g, ''), 10);\n selection.setSelection(line, false);\n }\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleSelectLine = (\n line: number,\n event: { shiftKey: boolean; preventDefault: () => void },\n ) => {\n selection.setSelection(line, event.shiftKey);\n };\n\n return (\n <AutoSizer>\n {({ height, width }) => (\n <Box style={{ width, height }} className={classes.root}>\n <Box className={classes.header}>\n <LogViewerControls {...search} />\n </Box>\n <FixedSizeList\n ref={listRef}\n className={classes.log}\n height={height - HEADER_SIZE}\n width={width}\n itemData={search.lines}\n itemSize={20}\n itemCount={search.lines.length}\n >\n {({ index, style, data }) => {\n const line = data[index];\n const { lineNumber } = line;\n return (\n <Box\n style={{ ...style }}\n className={classnames(classes.line, {\n [classes.lineSelected]: selection.isSelected(lineNumber),\n })}\n >\n {selection.shouldShowButton(lineNumber) && (\n <IconButton\n data-testid=\"copy-button\"\n size=\"small\"\n className={classes.lineCopyButton}\n onClick={() => selection.copySelection()}\n >\n <CopyIcon fontSize=\"inherit\" />\n </IconButton>\n )}\n <a\n role=\"row\"\n target=\"_self\"\n href={`#line-${lineNumber}`}\n className={classes.lineNumber}\n onClick={event => handleSelectLine(lineNumber, event)}\n onKeyPress={event => handleSelectLine(lineNumber, event)}\n >\n {lineNumber}\n </a>\n <LogLine\n line={line}\n classes={classes}\n searchText={search.searchText}\n highlightResultIndex={\n search.resultLine === lineNumber\n ? search.resultLineIndex\n : undefined\n }\n />\n </Box>\n );\n }}\n </FixedSizeList>\n </Box>\n )}\n </AutoSizer>\n );\n}\n"],"names":["ansiRegex","ansiRegexMaker","newlineRegex","codeModifiers","Object","fromEntries","entries","m","bold","italic","underline","_","foreground","background","map","code","modifier","AnsiLine","lastChunk","chunks","length","replaceLastChunk","newChunks","splice","text","c","join","toLocaleLowerCase","constructor","lineNumber","AnsiProcessor","process","lines","startsWith","newLines","lastLineIndex","lastLine","processLines","slice","modifiers","push","startingLineNumber","currentModifiers","currentLineNumber","prevIndex","lastIndex","match","exec","processText","line","index","fullText","processCode","getModifierClasses","classes","classNames","Array","modifierBold","modifierItalic","modifierUnderline","key","startCase","undefined","findSearchResults","searchText","includes","searchResults","offset","start","indexOf","end","calculateHighlightedChunks","results","lineOffset","resultIndex","result","chunk","localOffset","localStart","Math","max","localEnd","min","highlight","LogLine","highlightResultIndex","useMemo","elements","span","className","classnames","textSelectedHighlight","textHighlight","LogViewerControls","props","resultCount","resultIndexStep","toggleShouldFilter","handleKeyPress","event","metaKey","ctrlKey","altKey","shiftKey","IconButton","size","onClick","ChevronLeftIcon","Typography","ChevronRightIcon","TextField","variant","placeholder","value","searchInput","onKeyPress","onChange","e","setSearchInput","target","shouldFilter","FilterListIcon","color","HEADER_SIZE","useStyles","makeStyles","theme","root","palette","paper","header","height","display","alignItems","justifyContent","log","fontFamily","fontSize","typography","pxToRem","position","whiteSpace","action","hover","lineSelected","selected","lineCopyButton","paddingTop","paddingBottom","textAlign","width","marginRight","spacing","cursor","alpha","info","main","fontWeight","fontWeightBold","fontStyle","textDecoration","modifierForegroundBlack","colors","modifierForegroundRed","modifierForegroundGreen","modifierForegroundYellow","modifierForegroundBlue","modifierForegroundMagenta","modifierForegroundCyan","modifierForegroundWhite","modifierForegroundGrey","modifierBackgroundBlack","modifierBackgroundRed","modifierBackgroundGreen","modifierBackgroundYellow","modifierBackgroundBlue","modifierBackgroundMagenta","modifierBackgroundCyan","modifierBackgroundWhite","modifierBackgroundGrey","name","applySearchFilter","matchingLines","lineResultIndex","lineIndex","useLogViewerSearch","filter","useState","setResultIndex","useToggle","searchResult","decrement","next","resultLine","resultLineIndex","useLogViewerSelection","errorApi","useApi","errorApiRef","sel","setSelection","error","copyToClipboard","useCopyToClipboard","useEffect","post","shouldShowButton","isSelected","add","s","copySelection","copyText","l","RealLogViewer","listRef","useRef","search","selection","location","useLocation","current","scrollToItem","hash","parseInt","replace","handleSelectLine","AutoSizer","Box","style","FixedSizeList","ref","itemData","itemSize","itemCount","data","data-testid","CopyIcon","a","role","href"],"sourceRoot":""}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[8951],{78951:function(j,o,t){t.r(o),t.d(o,{CatalogEntityPage:function(){return E}});var r=t(52322),v=t(2784),a=t(
|
|
1
|
+
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[8951],{78951:function(j,o,t){t.r(o),t.d(o,{CatalogEntityPage:function(){return E}});var r=t(52322),v=t(2784),a=t(73557),e=t(40303),n=t(60871),y=t(77446);const m=()=>{const{kind:c,namespace:i,name:s}=(0,n.Oi)(e.wi),d=(0,a.s0)(),l=(0,n.h_)(n.VE),u=(0,n.h_)(e.Ah),{value:h,error:f,loading:g,retry:p}=(0,y.Z)(()=>u.getEntityByRef({kind:c,namespace:i,name:s}),[u,c,i,s]);return(0,v.useEffect)(()=>{s||(l.post(new Error("No name provided!")),d("/"))},[l,d,f,g,h,s]),{entity:h,loading:g,error:f,refresh:p}};function E(){return(0,r.jsx)(e.h$,{...m(),children:(0,r.jsx)(a.j3,{})})}}}]);})();
|
|
2
2
|
|
|
3
|
-
//# sourceMappingURL=8951.
|
|
3
|
+
//# sourceMappingURL=8951.dd51135b.chunk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static/8951.
|
|
1
|
+
{"version":3,"file":"static/8951.dd51135b.chunk.js","mappings":"+QA8BO,MAAMA,EAAmB,IAA2B,CACzD,KAAM,CAAEC,KAAAA,EAAMC,UAAAA,EAAWC,KAAAA,CAAK,KAAIC,EAAAA,IAAkBC,EAAAA,EAAcA,EAC5DC,KAAWC,EAAAA,IAAY,EACvBC,KAAWC,EAAAA,IAAOC,EAAAA,EAAWA,EAC7BC,KAAaF,EAAAA,IAAOG,EAAAA,EAAaA,EAEjC,CACJC,MAAOC,EACPC,MAAAA,EACAC,QAAAA,EACAC,MAAOC,CAAO,KACZC,EAAAA,GACF,IAAMR,EAAWS,eAAe,CAAEnB,KAAAA,EAAMC,UAAAA,EAAWC,KAAAA,CAAK,CAAC,EACzD,CAACQ,EAAYV,EAAMC,EAAWC,C,CAAK,EAGrCkB,SAAAA,EAAAA,WAAU,IAAM,CACTlB,IACHK,EAASc,KAAK,IAAIC,MAAM,mBAAmB,CAAC,EAC5CjB,EAAS,GAAG,EAEhB,EAAG,CAACE,EAAUF,EAAUS,EAAOC,EAASF,EAAQX,C,CAAK,EAE9C,CAAEW,OAAAA,EAAQE,QAAAA,EAASD,MAAAA,EAAOG,QAAAA,CAAQ,CAC3C,EChCO,SAASM,GAAoB,CAClC,SACE,OAACC,EAAAA,GAAmBA,CAAE,GAAGzB,EAAiB,E,YACxC,OAAC0B,EAAAA,GAAMA,CAAAA,CAAAA,C,EAGb,C","sources":["webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogEntityPage/useEntityFromUrl.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogEntityPage/CatalogEntityPage.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n errorApiRef,\n useApi,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n EntityLoadingStatus,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport { useEffect } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport useAsyncRetry from 'react-use/lib/useAsyncRetry';\n\nexport const useEntityFromUrl = (): EntityLoadingStatus => {\n const { kind, namespace, name } = useRouteRefParams(entityRouteRef);\n const navigate = useNavigate();\n const errorApi = useApi(errorApiRef);\n const catalogApi = useApi(catalogApiRef);\n\n const {\n value: entity,\n error,\n loading,\n retry: refresh,\n } = useAsyncRetry(\n () => catalogApi.getEntityByRef({ kind, namespace, name }),\n [catalogApi, kind, namespace, name],\n );\n\n useEffect(() => {\n if (!name) {\n errorApi.post(new Error('No name provided!'));\n navigate('/');\n }\n }, [errorApi, navigate, error, loading, entity, name]);\n\n return { entity, loading, error, refresh };\n};\n","/*\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 React from 'react';\nimport { Outlet } from 'react-router-dom';\nimport { AsyncEntityProvider } from '@backstage/plugin-catalog-react';\nimport { useEntityFromUrl } from './useEntityFromUrl';\n\n/** @public */\nexport function CatalogEntityPage() {\n return (\n <AsyncEntityProvider {...useEntityFromUrl()}>\n <Outlet />\n </AsyncEntityProvider>\n );\n}\n"],"names":["useEntityFromUrl","kind","namespace","name","useRouteRefParams","entityRouteRef","navigate","useNavigate","errorApi","useApi","errorApiRef","catalogApi","catalogApiRef","value","entity","error","loading","retry","refresh","useAsyncRetry","getEntityByRef","useEffect","post","Error","CatalogEntityPage","AsyncEntityProvider","Outlet"],"sourceRoot":""}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[9323],{89323:function(P,e,n){n.r(e),n.d(e,{CatalogPage:function(){return m},DefaultCatalogPage:function(){return c}});var t=n(52322),D=n(2784),g=n(
|
|
1
|
+
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[9323],{89323:function(P,e,n){n.r(e),n.d(e,{CatalogPage:function(){return m},DefaultCatalogPage:function(){return c}});var t=n(52322),D=n(2784),g=n(73557),l=n(23196),o=n(60871),s=n(40303),u=n(19625),j=n(86359),x=n(64355);const h=()=>(0,x.y)();function c(i){const{columns:d,actions:C,initiallySelectedFilter:f="owned",initialKind:p="component",tableOptions:v={},emptyContent:y}=i;var a;const O=(a=(0,o.h_)(o.Ds).getOptionalString("organization.name"))!==null&&a!==void 0?a:"Backstage",r=(0,o.tg)(u.yw),{createButtonTitle:F}=h();return(0,t.jsx)(l.g9,{title:`${O} Catalog`,themeId:"home",children:(0,t.jsxs)(l.VY,{children:[(0,t.jsxs)(l.yW,{title:"",children:[(0,t.jsx)(l.XF,{title:F,to:r&&r()}),(0,t.jsx)(l.qt,{children:"All your software catalog entities"})]}),(0,t.jsx)(s.UO,{children:(0,t.jsxs)(s._i,{children:[(0,t.jsxs)(s._i.Filters,{children:[(0,t.jsx)(s.tW,{initialFilter:p}),(0,t.jsx)(s.sL,{}),(0,t.jsx)(s.EW,{initialFilter:f}),(0,t.jsx)(s.dq,{}),(0,t.jsx)(s.df,{}),(0,t.jsx)(s.xE,{}),(0,t.jsx)(s.nl,{})]}),(0,t.jsx)(s._i.Content,{children:(0,t.jsx)(j.E,{columns:d,actions:C,tableOptions:v,emptyContent:y})})]})})]})})}function m(i){return(0,g.pC)()||(0,t.jsx)(c,{...i})}}}]);})();
|
|
2
2
|
|
|
3
|
-
//# sourceMappingURL=9323.
|
|
3
|
+
//# sourceMappingURL=9323.6577088c.chunk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static/9323.
|
|
1
|
+
{"version":3,"file":"static/9323.6577088c.chunk.js","mappings":"kVA2BO,MAAMA,EAA0B,OACrCC,EAAAA,GAAgBA,EC6BX,SAASC,EAAmBC,EAAgC,CACjE,KAAM,CACJC,QAAAA,EACAC,QAAAA,EACAC,wBAAAA,EAA0B,QAC1BC,YAAAA,EAAc,YACdC,aAAAA,EAAe,CAAC,EAChBC,aAAAA,CAAY,EACVN,E,IAEFO,EADF,MAAMC,GACJD,KAAAA,EAAAA,IAAOE,EAAAA,EAAYA,EAAEC,kBAAkB,mBAAmB,KAAnB,MAAvCH,IAAAA,OAAAA,EAA+D,YAC3DI,KAAsBC,EAAAA,IAAYC,EAAAA,EAAuBA,EAEzD,CAAEC,kBAAAA,CAAkB,EAAIjB,EAAwB,EAEtD,SACE,OAACkB,EAAAA,GAAcA,CAACC,MAAO,GAAGR,YAAmBS,QAAQ,O,YACnD,QAACC,EAAAA,GAAOA,C,aACN,QAACC,EAAAA,GAAaA,CAACH,MAAM,G,aACnB,OAACI,EAAAA,GAAYA,CACXJ,MAAOF,EACPO,GAAIV,GAAuBA,EAAoB,C,MAEjD,OAACW,EAAAA,GAAaA,C,SAAC,oC,SAEjB,OAACC,EAAAA,GAAkBA,C,YACjB,QAACC,EAAAA,GAAmBA,C,aAClB,QAACA,EAAAA,GAAAA,QAA2B,C,aAC1B,OAACC,EAAAA,GAAgBA,CAACC,cAAetB,C,MACjC,OAACuB,EAAAA,GAAgBA,CAAAA,CAAAA,KACjB,OAACC,EAAAA,GAAcA,CAACF,cAAevB,C,MAC/B,OAAC0B,EAAAA,GAAiBA,CAAAA,CAAAA,KAClB,OAACC,EAAAA,GAAqBA,CAAAA,CAAAA,KACtB,OAACC,EAAAA,GAAeA,CAAAA,CAAAA,KAChB,OAACC,EAAAA,GAA4BA,CAAAA,CAAAA,C,OAE/B,OAACR,EAAAA,GAAAA,QAA2B,C,YAC1B,OAACS,EAAAA,EAAYA,CACXhC,QAASA,EACTC,QAASA,EACTG,aAAcA,EACdC,aAAcA,C,cAQ9B,CCnFO,SAAS4B,EAAYlC,EAAgC,CAG1D,SAFemC,EAAAA,IAAU,MAER,OAACpC,EAAkBA,CAAE,GAAGC,C,EAC3C,C","sources":["webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/options.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogPage/CatalogPage.tsx"],"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 { usePluginOptions } from '@backstage/core-plugin-api/alpha';\n\nexport type CatalogPluginOptions = {\n createButtonTitle: string;\n};\n\n/** @ignore */\nexport type CatalogInputPluginOptions = {\n createButtonTitle: string;\n};\n\nexport const useCatalogPluginOptions = () =>\n usePluginOptions<CatalogPluginOptions>();\n","/*\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\nimport {\n Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n CatalogFilterLayout,\n EntityLifecyclePicker,\n EntityListProvider,\n EntityProcessingStatusPicker,\n EntityOwnerPicker,\n EntityTagPicker,\n EntityTypePicker,\n UserListFilterKind,\n UserListPicker,\n EntityKindPicker,\n} from '@backstage/plugin-catalog-react';\nimport React, { ReactNode } from 'react';\nimport { createComponentRouteRef } from '../../routes';\nimport { CatalogTable, CatalogTableRow } from '../CatalogTable';\nimport { useCatalogPluginOptions } from '../../options';\n\n/**\n * Props for root catalog pages.\n *\n * @public\n */\nexport interface DefaultCatalogPageProps {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[];\n actions?: TableProps<CatalogTableRow>['actions'];\n initialKind?: string;\n tableOptions?: TableProps<CatalogTableRow>['options'];\n emptyContent?: ReactNode;\n}\n\nexport function DefaultCatalogPage(props: DefaultCatalogPageProps) {\n const {\n columns,\n actions,\n initiallySelectedFilter = 'owned',\n initialKind = 'component',\n tableOptions = {},\n emptyContent,\n } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n\n const { createButtonTitle } = useCatalogPluginOptions();\n\n return (\n <PageWithHeader title={`${orgName} Catalog`} themeId=\"home\">\n <Content>\n <ContentHeader title=\"\">\n <CreateButton\n title={createButtonTitle}\n to={createComponentLink && createComponentLink()}\n />\n <SupportButton>All your software catalog entities</SupportButton>\n </ContentHeader>\n <EntityListProvider>\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <EntityKindPicker initialFilter={initialKind} />\n <EntityTypePicker />\n <UserListPicker initialFilter={initiallySelectedFilter} />\n <EntityOwnerPicker />\n <EntityLifecyclePicker />\n <EntityTagPicker />\n <EntityProcessingStatusPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n emptyContent={emptyContent}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </EntityListProvider>\n </Content>\n </PageWithHeader>\n );\n}\n","/*\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\nimport React from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport {\n DefaultCatalogPage,\n DefaultCatalogPageProps,\n} from './DefaultCatalogPage';\n\nexport function CatalogPage(props: DefaultCatalogPageProps) {\n const outlet = useOutlet();\n\n return outlet || <DefaultCatalogPage {...props} />;\n}\n"],"names":["useCatalogPluginOptions","usePluginOptions","DefaultCatalogPage","props","columns","actions","initiallySelectedFilter","initialKind","tableOptions","emptyContent","useApi","orgName","configApiRef","getOptionalString","createComponentLink","useRouteRef","createComponentRouteRef","createButtonTitle","PageWithHeader","title","themeId","Content","ContentHeader","CreateButton","to","SupportButton","EntityListProvider","CatalogFilterLayout","EntityKindPicker","initialFilter","EntityTypePicker","UserListPicker","EntityOwnerPicker","EntityLifecyclePicker","EntityTagPicker","EntityProcessingStatusPicker","CatalogTable","CatalogPage","useOutlet"],"sourceRoot":""}
|