@techdocs/cli 0.8.14 → 0.8.17-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/README.md +45 -9
- package/dist/cjs/{PublisherConfig-a09bdfcc.cjs.js → PublisherConfig-162efac5.cjs.js} +1 -1
- package/dist/cjs/{PublisherConfig-a09bdfcc.cjs.js.map → PublisherConfig-162efac5.cjs.js.map} +1 -1
- package/dist/cjs/{generate-86756c8c.cjs.js → generate-143a6de3.cjs.js} +9 -5
- package/dist/cjs/generate-143a6de3.cjs.js.map +1 -0
- package/dist/cjs/{migrate-04a51fb3.cjs.js → migrate-181e95f5.cjs.js} +5 -5
- package/dist/cjs/migrate-181e95f5.cjs.js.map +1 -0
- package/dist/cjs/{mkdocs-f1cf9408.cjs.js → mkdocs-30f530ff.cjs.js} +3 -3
- package/dist/cjs/{mkdocs-f1cf9408.cjs.js.map → mkdocs-30f530ff.cjs.js.map} +1 -1
- package/dist/cjs/{mkdocsServer-7058189d.cjs.js → mkdocsServer-758a3ae9.cjs.js} +1 -1
- package/dist/cjs/{mkdocsServer-7058189d.cjs.js.map → mkdocsServer-758a3ae9.cjs.js.map} +1 -1
- package/dist/cjs/{publish-d1ccb001.cjs.js → publish-7bf1e5f7.cjs.js} +5 -5
- package/dist/cjs/publish-7bf1e5f7.cjs.js.map +1 -0
- package/dist/cjs/{serve-be4ef843.cjs.js → serve-21d1e885.cjs.js} +3 -3
- package/dist/cjs/serve-21d1e885.cjs.js.map +1 -0
- package/dist/cjs/{utility-6042a9ba.cjs.js → utility-51f4a306.cjs.js} +1 -1
- package/dist/cjs/utility-51f4a306.cjs.js.map +1 -0
- package/dist/embedded-app/.config-schema.json +20 -4
- package/dist/embedded-app/index.html +1 -1
- package/dist/embedded-app/static/{1553.fa9923dc.chunk.js → 1553.b7bcb06c.chunk.js} +2 -2
- package/dist/embedded-app/static/{1553.fa9923dc.chunk.js.map → 1553.b7bcb06c.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{1959.8e2ecef7.chunk.js → 1959.6c1762da.chunk.js} +2 -2
- package/dist/embedded-app/static/{1959.8e2ecef7.chunk.js.map → 1959.6c1762da.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{2426.d0d6bb5f.chunk.js → 2426.92f98d58.chunk.js} +2 -2
- package/dist/embedded-app/static/{2426.d0d6bb5f.chunk.js.map → 2426.92f98d58.chunk.js.map} +1 -1
- package/dist/embedded-app/static/3696.77a82030.chunk.js +3 -0
- package/dist/embedded-app/static/{5011.c8e98520.chunk.js.map → 3696.77a82030.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{390.97c3e130.chunk.js → 390.b97bc67e.chunk.js} +2 -2
- package/dist/embedded-app/static/{390.97c3e130.chunk.js.map → 390.b97bc67e.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{4022.e2c5dac7.chunk.js → 4022.482a5f92.chunk.js} +2 -2
- package/dist/embedded-app/static/{4022.e2c5dac7.chunk.js.map → 4022.482a5f92.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{6105.1f3a3239.chunk.js → 6105.6eda23ad.chunk.js} +1 -1
- package/dist/embedded-app/static/{6105.1f3a3239.chunk.js.map → 6105.6eda23ad.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{6235.8b138ebd.chunk.js → 6235.a1086c98.chunk.js} +2 -2
- package/dist/embedded-app/static/{6235.8b138ebd.chunk.js.map → 6235.a1086c98.chunk.js.map} +1 -1
- package/dist/embedded-app/static/6583.035b49a3.chunk.js +3 -0
- package/dist/embedded-app/static/6583.035b49a3.chunk.js.map +1 -0
- package/dist/embedded-app/static/7110.cac06b1c.chunk.js +3 -0
- package/dist/embedded-app/static/7110.cac06b1c.chunk.js.map +1 -0
- package/dist/embedded-app/static/7758.cb484a7b.chunk.js +3 -0
- package/dist/embedded-app/static/{7758.2b30237f.chunk.js.map → 7758.cb484a7b.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{8061.a42aa0fc.chunk.js → 8061.b8ba1848.chunk.js} +2 -2
- package/dist/embedded-app/static/{8061.a42aa0fc.chunk.js.map → 8061.b8ba1848.chunk.js.map} +1 -1
- package/dist/embedded-app/static/8718.71563d4c.chunk.js +4 -0
- package/dist/embedded-app/static/8718.71563d4c.chunk.js.map +1 -0
- package/dist/embedded-app/static/{8792.38f45fc1.chunk.js → 8792.e74d00e0.chunk.js} +2 -2
- package/dist/embedded-app/static/{8792.38f45fc1.chunk.js.map → 8792.e74d00e0.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{9028.8bd42f34.chunk.js → 9028.0f028f46.chunk.js} +2 -2
- package/dist/embedded-app/static/{9028.8bd42f34.chunk.js.map → 9028.0f028f46.chunk.js.map} +1 -1
- package/dist/embedded-app/static/main.a81ffeda.js +444 -0
- package/dist/embedded-app/static/main.a81ffeda.js.map +1 -0
- package/dist/embedded-app/static/{module-react-dom.a4f98d7b.js → module-hot-loader.7c7a4226.js} +5 -5
- package/dist/embedded-app/static/{module-react-dom.a4f98d7b.js.map → module-hot-loader.7c7a4226.js.map} +1 -1
- package/dist/embedded-app/static/{module-lodash.055be129.js → module-lodash.f158b49a.js} +1 -1
- package/dist/embedded-app/static/{module-lodash.055be129.js.map → module-lodash.f158b49a.js.map} +1 -1
- package/dist/embedded-app/static/{module-material-ui.c5231eb9.js → module-material-ui.3c0e2d92.js} +6 -6
- package/dist/embedded-app/static/module-material-ui.3c0e2d92.js.map +1 -0
- package/dist/embedded-app/static/{module-react-beautiful-dnd.bcb66a0c.js → module-react-beautiful-dnd.2ab2ffc2.js} +2 -2
- package/dist/embedded-app/static/{module-react-beautiful-dnd.bcb66a0c.js.map → module-react-beautiful-dnd.2ab2ffc2.js.map} +1 -1
- package/dist/embedded-app/static/{module-yaml.57b26e04.js → module-yaml.574c3290.js} +1 -1
- package/dist/embedded-app/static/{module-yaml.57b26e04.js.map → module-yaml.574c3290.js.map} +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter/{lowlight-import.051a03b1.chunk.js → lowlight-import.c14d776e.chunk.js} +3 -3
- package/dist/embedded-app/static/react-syntax-highlighter/lowlight-import.c14d776e.chunk.js.map +1 -0
- package/dist/embedded-app/static/{runtime.c2217354.js → runtime.a81ffeda.js} +2 -2
- package/dist/embedded-app/static/runtime.a81ffeda.js.map +1 -0
- package/dist/embedded-app/static/vendor.a81ffeda.js +140 -0
- package/dist/embedded-app/static/vendor.a81ffeda.js.map +1 -0
- package/dist/index.cjs.js +8 -8
- package/dist/index.cjs.js.map +1 -1
- package/package.json +16 -13
- package/dist/cjs/generate-86756c8c.cjs.js.map +0 -1
- package/dist/cjs/migrate-04a51fb3.cjs.js.map +0 -1
- package/dist/cjs/publish-d1ccb001.cjs.js.map +0 -1
- package/dist/cjs/serve-be4ef843.cjs.js.map +0 -1
- package/dist/cjs/utility-6042a9ba.cjs.js.map +0 -1
- package/dist/embedded-app/static/5011.c8e98520.chunk.js +0 -3
- package/dist/embedded-app/static/6650.7b3bb14a.chunk.js +0 -3
- package/dist/embedded-app/static/6650.7b3bb14a.chunk.js.map +0 -1
- package/dist/embedded-app/static/7758.2b30237f.chunk.js +0 -3
- package/dist/embedded-app/static/8718.34386313.chunk.js +0 -4
- package/dist/embedded-app/static/8718.34386313.chunk.js.map +0 -1
- package/dist/embedded-app/static/main.c2217354.js +0 -173
- package/dist/embedded-app/static/main.c2217354.js.map +0 -1
- package/dist/embedded-app/static/module-material-ui.c5231eb9.js.map +0 -1
- package/dist/embedded-app/static/react-syntax-highlighter/lowlight-import.051a03b1.chunk.js.map +0 -1
- package/dist/embedded-app/static/runtime.c2217354.js.map +0 -1
- package/dist/embedded-app/static/vendor.c2217354.js +0 -140
- package/dist/embedded-app/static/vendor.c2217354.js.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var program = require('commander');
|
|
4
|
-
var
|
|
4
|
+
var pluginTechdocsNode = require('@backstage/plugin-techdocs-node');
|
|
5
5
|
|
|
6
6
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
7
7
|
|
|
8
8
|
var program__default = /*#__PURE__*/_interopDefaultLegacy(program);
|
|
9
9
|
|
|
10
|
-
const defaultDockerImage =
|
|
10
|
+
const defaultDockerImage = pluginTechdocsNode.TechdocsGenerator.defaultDockerImage;
|
|
11
11
|
function registerCommands(program) {
|
|
12
|
-
program.command("generate").description("Generate TechDocs documentation site using MkDocs.").option("--source-dir <PATH>", "Source directory containing mkdocs.yml and docs/ directory.", ".").option("--output-dir <PATH>", "Output directory containing generated TechDocs site.", "./site/").option("--docker-image <DOCKER_IMAGE>", "The mkdocs docker container to use", defaultDockerImage).option("--no-pull", "Do not pull the latest docker image", false).option("--no-docker", "Do not use Docker, use MkDocs executable and plugins in current user environment.").option("--techdocs-ref <HOST_TYPE:URL>", "The repository hosting documentation source files e.g.
|
|
13
|
-
program.command("migrate").description("Migrate objects with case-sensitive entity triplets to lower-case versions.").requiredOption("--publisher-type <TYPE>", "(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml").requiredOption("--storage-name <BUCKET/CONTAINER NAME>", "(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName").option("--azureAccountName <AZURE ACCOUNT NAME>", "(Required for Azure) specify when --publisher-type azureBlobStorage").option("--azureAccountKey <AZURE ACCOUNT KEY>", "Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.").option("--awsRoleArn <AWS ROLE ARN>", "Optional AWS ARN of role to be assumed.").option("--awsEndpoint <AWS ENDPOINT>", "Optional AWS endpoint to send requests to.").option("--awsS3ForcePathStyle", "Optional AWS S3 option to force path style.").option("--awsBucketRootPath", "Optional sub-directory to store files in Amazon S3").option("--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--osAuthUrl <OPENSTACK SWIFT AUTHURL>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--removeOriginal", "Optional Files are copied by default. If flag is set, files are renamed/moved instead.", false).option("--concurrency <MAX CONCURRENT REQS>", "Optional Controls the number of API requests allowed to be performed simultaneously.", "25").option("-v --verbose", "Enable verbose output.", false).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/migrate-
|
|
14
|
-
program.command("publish").description("Publish generated TechDocs site to an external storage AWS S3, Google GCS, etc.").requiredOption("--publisher-type <TYPE>", "(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml").requiredOption("--storage-name <BUCKET/CONTAINER NAME>", "(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName").requiredOption("--entity <NAMESPACE/KIND/NAME>", "(Required always) Entity uid separated by / in namespace/kind/name order (case-sensitive). Example: default/Component/myEntity ").option("--legacyUseCaseSensitiveTripletPaths", "Publishes objects with cased entity triplet prefix when set (e.g. namespace/Kind/name). Only use if your TechDocs backend is configured the same way.", false).option("--azureAccountName <AZURE ACCOUNT NAME>", "(Required for Azure) specify when --publisher-type azureBlobStorage").option("--azureAccountKey <AZURE ACCOUNT KEY>", "Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.").option("--awsRoleArn <AWS ROLE ARN>", "Optional AWS ARN of role to be assumed.").option("--awsEndpoint <AWS ENDPOINT>", "Optional AWS endpoint to send requests to.").option("--awsS3sse <AWS SSE>", "Optional AWS S3 Server Side Encryption.").option("--awsS3ForcePathStyle", "Optional AWS S3 option to force path style.").option("--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--osAuthUrl <OPENSTACK SWIFT AUTHURL>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--gcsBucketRootPath", "Optional sub-directory to store files in Google cloud storage").option("--directory <PATH>", "Path of the directory containing generated files to publish", "./site/").action(lazy(() => Promise.resolve().then(function () { return require('./cjs/publish-
|
|
15
|
-
program.command("serve:mkdocs").description("Serve a documentation project locally using MkDocs serve.").option("-i, --docker-image <DOCKER_IMAGE>", "The mkdocs docker container to use", defaultDockerImage).option("--no-docker", "Do not use Docker, run `mkdocs serve` in current user environment.").option("-p, --port <PORT>", "Port to serve documentation locally", "8000").option("-v --verbose", "Enable verbose output.", false).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/mkdocs-
|
|
16
|
-
program.command("serve").description("Serve a documentation project locally in a Backstage app-like environment").option("-i, --docker-image <DOCKER_IMAGE>", "The mkdocs docker container to use", defaultDockerImage).option("--no-docker", "Do not use Docker, use MkDocs executable in current user environment.").option("--mkdocs-port <PORT>", "Port for MkDocs server to use", "8000").option("-v --verbose", "Enable verbose output.", false).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/serve-
|
|
12
|
+
program.command("generate").description("Generate TechDocs documentation site using MkDocs.").option("--source-dir <PATH>", "Source directory containing mkdocs.yml and docs/ directory.", ".").option("--output-dir <PATH>", "Output directory containing generated TechDocs site.", "./site/").option("--docker-image <DOCKER_IMAGE>", "The mkdocs docker container to use", defaultDockerImage).option("--no-pull", "Do not pull the latest docker image", false).option("--no-docker", "Do not use Docker, use MkDocs executable and plugins in current user environment.").option("--techdocs-ref <HOST_TYPE:URL>", "The repository hosting documentation source files e.g. url:https://ghe.mycompany.net.com/org/repo.\nThis value is same as the backstage.io/techdocs-ref annotation of the corresponding Backstage entity.\nIt is completely fine to skip this as it is only being used to set repo_url in mkdocs.yml if not found.\n").option("--etag <ETAG>", "A unique identifier for the prepared tree e.g. commit SHA. If provided it will be stored in techdocs_metadata.json.").option("-v --verbose", "Enable verbose output.", false).option("--omitTechdocsCoreMkdocsPlugin", "Don't patch MkDocs file automatically with techdocs-core plugin.", false).alias("build").action(lazy(() => Promise.resolve().then(function () { return require('./cjs/generate-143a6de3.cjs.js'); }).then((m) => m.default)));
|
|
13
|
+
program.command("migrate").description("Migrate objects with case-sensitive entity triplets to lower-case versions.").requiredOption("--publisher-type <TYPE>", "(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml").requiredOption("--storage-name <BUCKET/CONTAINER NAME>", "(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName").option("--azureAccountName <AZURE ACCOUNT NAME>", "(Required for Azure) specify when --publisher-type azureBlobStorage").option("--azureAccountKey <AZURE ACCOUNT KEY>", "Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.").option("--awsRoleArn <AWS ROLE ARN>", "Optional AWS ARN of role to be assumed.").option("--awsEndpoint <AWS ENDPOINT>", "Optional AWS endpoint to send requests to.").option("--awsS3ForcePathStyle", "Optional AWS S3 option to force path style.").option("--awsBucketRootPath", "Optional sub-directory to store files in Amazon S3").option("--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--osAuthUrl <OPENSTACK SWIFT AUTHURL>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--removeOriginal", "Optional Files are copied by default. If flag is set, files are renamed/moved instead.", false).option("--concurrency <MAX CONCURRENT REQS>", "Optional Controls the number of API requests allowed to be performed simultaneously.", "25").option("-v --verbose", "Enable verbose output.", false).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/migrate-181e95f5.cjs.js'); }).then((m) => m.default)));
|
|
14
|
+
program.command("publish").description("Publish generated TechDocs site to an external storage AWS S3, Google GCS, etc.").requiredOption("--publisher-type <TYPE>", "(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml").requiredOption("--storage-name <BUCKET/CONTAINER NAME>", "(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName").requiredOption("--entity <NAMESPACE/KIND/NAME>", "(Required always) Entity uid separated by / in namespace/kind/name order (case-sensitive). Example: default/Component/myEntity ").option("--legacyUseCaseSensitiveTripletPaths", "Publishes objects with cased entity triplet prefix when set (e.g. namespace/Kind/name). Only use if your TechDocs backend is configured the same way.", false).option("--azureAccountName <AZURE ACCOUNT NAME>", "(Required for Azure) specify when --publisher-type azureBlobStorage").option("--azureAccountKey <AZURE ACCOUNT KEY>", "Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.").option("--awsRoleArn <AWS ROLE ARN>", "Optional AWS ARN of role to be assumed.").option("--awsEndpoint <AWS ENDPOINT>", "Optional AWS endpoint to send requests to.").option("--awsS3sse <AWS SSE>", "Optional AWS S3 Server Side Encryption.").option("--awsS3ForcePathStyle", "Optional AWS S3 option to force path style.").option("--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--osAuthUrl <OPENSTACK SWIFT AUTHURL>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>", "(Required for OpenStack) specify when --publisher-type openStackSwift").option("--gcsBucketRootPath", "Optional sub-directory to store files in Google cloud storage").option("--directory <PATH>", "Path of the directory containing generated files to publish", "./site/").action(lazy(() => Promise.resolve().then(function () { return require('./cjs/publish-7bf1e5f7.cjs.js'); }).then((m) => m.default)));
|
|
15
|
+
program.command("serve:mkdocs").description("Serve a documentation project locally using MkDocs serve.").option("-i, --docker-image <DOCKER_IMAGE>", "The mkdocs docker container to use", defaultDockerImage).option("--no-docker", "Do not use Docker, run `mkdocs serve` in current user environment.").option("-p, --port <PORT>", "Port to serve documentation locally", "8000").option("-v --verbose", "Enable verbose output.", false).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/mkdocs-30f530ff.cjs.js'); }).then((m) => m.default)));
|
|
16
|
+
program.command("serve").description("Serve a documentation project locally in a Backstage app-like environment").option("-i, --docker-image <DOCKER_IMAGE>", "The mkdocs docker container to use", defaultDockerImage).option("--no-docker", "Do not use Docker, use MkDocs executable in current user environment.").option("--mkdocs-port <PORT>", "Port for MkDocs server to use", "8000").option("-v --verbose", "Enable verbose output.", false).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/serve-21d1e885.cjs.js'); }).then((m) => m.default)));
|
|
17
17
|
}
|
|
18
18
|
function lazy(getActionFunc) {
|
|
19
19
|
return async (...args) => {
|
|
@@ -28,7 +28,7 @@ function lazy(getActionFunc) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
var version = "0.8.
|
|
31
|
+
var version = "0.8.17-next.0";
|
|
32
32
|
|
|
33
33
|
const main = (argv) => {
|
|
34
34
|
program__default["default"].name("techdocs-cli").version(version);
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/commands/index.ts","../src/index.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 { CommanderStatic } from 'commander';\nimport { TechdocsGenerator } from '@backstage/techdocs-common';\n\nconst defaultDockerImage = TechdocsGenerator.defaultDockerImage;\n\nexport function registerCommands(program: CommanderStatic) {\n program\n .command('generate')\n .description('Generate TechDocs documentation site using MkDocs.')\n .option(\n '--source-dir <PATH>',\n 'Source directory containing mkdocs.yml and docs/ directory.',\n '.',\n )\n .option(\n '--output-dir <PATH>',\n 'Output directory containing generated TechDocs site.',\n './site/',\n )\n .option(\n '--docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option('--no-pull', 'Do not pull the latest docker image', false)\n .option(\n '--no-docker',\n 'Do not use Docker, use MkDocs executable and plugins in current user environment.',\n )\n .option(\n '--techdocs-ref <HOST_TYPE:URL>',\n 'The repository hosting documentation source files e.g. github:https://ghe.mycompany.net.com/org/repo.' +\n '\\nThis value is same as the backstage.io/techdocs-ref annotation of the corresponding Backstage entity.' +\n '\\nIt is completely fine to skip this as it is only being used to set repo_url in mkdocs.yml if not found.\\n',\n )\n .option(\n '--etag <ETAG>',\n 'A unique identifier for the prepared tree e.g. commit SHA. If provided it will be stored in techdocs_metadata.json.',\n )\n .option('-v --verbose', 'Enable verbose output.', false)\n .alias('build')\n .action(lazy(() => import('./generate/generate').then(m => m.default)));\n\n program\n .command('migrate')\n .description(\n 'Migrate objects with case-sensitive entity triplets to lower-case versions.',\n )\n .requiredOption(\n '--publisher-type <TYPE>',\n '(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml',\n )\n .requiredOption(\n '--storage-name <BUCKET/CONTAINER NAME>',\n '(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName',\n )\n .option(\n '--azureAccountName <AZURE ACCOUNT NAME>',\n '(Required for Azure) specify when --publisher-type azureBlobStorage',\n )\n .option(\n '--azureAccountKey <AZURE ACCOUNT KEY>',\n 'Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.',\n )\n .option(\n '--awsRoleArn <AWS ROLE ARN>',\n 'Optional AWS ARN of role to be assumed.',\n )\n .option(\n '--awsEndpoint <AWS ENDPOINT>',\n 'Optional AWS endpoint to send requests to.',\n )\n .option(\n '--awsS3ForcePathStyle',\n 'Optional AWS S3 option to force path style.',\n )\n .option(\n '--awsBucketRootPath',\n 'Optional sub-directory to store files in Amazon S3',\n )\n .option(\n '--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osAuthUrl <OPENSTACK SWIFT AUTHURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--removeOriginal',\n 'Optional Files are copied by default. If flag is set, files are renamed/moved instead.',\n false,\n )\n .option(\n '--concurrency <MAX CONCURRENT REQS>',\n 'Optional Controls the number of API requests allowed to be performed simultaneously.',\n '25',\n )\n .option('-v --verbose', 'Enable verbose output.', false)\n .action(lazy(() => import('./migrate/migrate').then(m => m.default)));\n\n program\n .command('publish')\n .description(\n 'Publish generated TechDocs site to an external storage AWS S3, Google GCS, etc.',\n )\n .requiredOption(\n '--publisher-type <TYPE>',\n '(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml',\n )\n .requiredOption(\n '--storage-name <BUCKET/CONTAINER NAME>',\n '(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName',\n )\n .requiredOption(\n '--entity <NAMESPACE/KIND/NAME>',\n '(Required always) Entity uid separated by / in namespace/kind/name order (case-sensitive). Example: default/Component/myEntity ',\n )\n .option(\n '--legacyUseCaseSensitiveTripletPaths',\n 'Publishes objects with cased entity triplet prefix when set (e.g. namespace/Kind/name). Only use if your TechDocs backend is configured the same way.',\n false,\n )\n .option(\n '--azureAccountName <AZURE ACCOUNT NAME>',\n '(Required for Azure) specify when --publisher-type azureBlobStorage',\n )\n .option(\n '--azureAccountKey <AZURE ACCOUNT KEY>',\n 'Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.',\n )\n .option(\n '--awsRoleArn <AWS ROLE ARN>',\n 'Optional AWS ARN of role to be assumed.',\n )\n .option(\n '--awsEndpoint <AWS ENDPOINT>',\n 'Optional AWS endpoint to send requests to.',\n )\n .option('--awsS3sse <AWS SSE>', 'Optional AWS S3 Server Side Encryption.')\n .option(\n '--awsS3ForcePathStyle',\n 'Optional AWS S3 option to force path style.',\n )\n .option(\n '--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osAuthUrl <OPENSTACK SWIFT AUTHURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--gcsBucketRootPath',\n 'Optional sub-directory to store files in Google cloud storage',\n )\n .option(\n '--directory <PATH>',\n 'Path of the directory containing generated files to publish',\n './site/',\n )\n .action(lazy(() => import('./publish/publish').then(m => m.default)));\n\n program\n .command('serve:mkdocs')\n .description('Serve a documentation project locally using MkDocs serve.')\n .option(\n '-i, --docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option(\n '--no-docker',\n 'Do not use Docker, run `mkdocs serve` in current user environment.',\n )\n .option('-p, --port <PORT>', 'Port to serve documentation locally', '8000')\n .option('-v --verbose', 'Enable verbose output.', false)\n .action(lazy(() => import('./serve/mkdocs').then(m => m.default)));\n\n program\n .command('serve')\n .description(\n 'Serve a documentation project locally in a Backstage app-like environment',\n )\n .option(\n '-i, --docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option(\n '--no-docker',\n 'Do not use Docker, use MkDocs executable in current user environment.',\n )\n .option('--mkdocs-port <PORT>', 'Port for MkDocs server to use', '8000')\n .option('-v --verbose', 'Enable verbose output.', false)\n .action(lazy(() => import('./serve/serve').then(m => m.default)));\n}\n\n// Wraps an action function so that it always exits and handles errors\n// Humbly taken from backstage-cli's registerCommands\nfunction lazy(\n getActionFunc: () => Promise<(...args: any[]) => Promise<void>>,\n): (...args: any[]) => Promise<never> {\n return async (...args: any[]) => {\n try {\n const actionFunc = await getActionFunc();\n await actionFunc(...args);\n process.exit(0);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error.message);\n process.exit(1);\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 program from 'commander';\nimport { registerCommands } from './commands';\nimport { version } from '../package.json';\n\nconst main = (argv: string[]) => {\n program.name('techdocs-cli').version(version);\n\n registerCommands(program);\n\n program.parse(argv);\n};\n\nmain(process.argv);\n"],"names":["TechdocsGenerator","program"],"mappings":";;;;;;;;;AAmBA,MAAM,qBAAqBA,iCAAkB;0BAEZ,SAA0B;AACzD,UACG,QAAQ,YACR,YAAY,sDACZ,OACC,uBACA,+DACA,KAED,OACC,uBACA,wDACA,WAED,OACC,iCACA,sCACA,oBAED,OAAO,aAAa,uCAAuC,OAC3D,OACC,eACA,qFAED,OACC,kCACA,2TAID,OACC,iBACA,uHAED,OAAO,gBAAgB,0BAA0B,OACjD,MAAM,SACN,OAAO,KAAK,MAAM,oDAAO,sCAAuB,KAAK,OAAK,EAAE;AAE/D,UACG,QAAQ,WACR,YACC,+EAED,eACC,2BACA,0IAED,eACC,0CACA,iJAED,OACC,2CACA,uEAED,OACC,yCACA,wKAED,OACC,+BACA,2CAED,OACC,gCACA,8CAED,OACC,yBACA,+CAED,OACC,uBACA,sDAED,OACC,gEACA,yEAED,OACC,8DACA,yEAED,OACC,yCACA,yEAED,OACC,2CACA,yEAED,OACC,oBACA,0FACA,OAED,OACC,uCACA,wFACA,MAED,OAAO,gBAAgB,0BAA0B,OACjD,OAAO,KAAK,MAAM,oDAAO,qCAAqB,KAAK,OAAK,EAAE;AAE7D,UACG,QAAQ,WACR,YACC,mFAED,eACC,2BACA,0IAED,eACC,0CACA,iJAED,eACC,kCACA,mIAED,OACC,wCACA,yJACA,OAED,OACC,2CACA,uEAED,OACC,yCACA,wKAED,OACC,+BACA,2CAED,OACC,gCACA,8CAED,OAAO,wBAAwB,2CAC/B,OACC,yBACA,+CAED,OACC,gEACA,yEAED,OACC,8DACA,yEAED,OACC,yCACA,yEAED,OACC,2CACA,yEAED,OACC,uBACA,iEAED,OACC,sBACA,+DACA,WAED,OAAO,KAAK,MAAM,oDAAO,qCAAqB,KAAK,OAAK,EAAE;AAE7D,UACG,QAAQ,gBACR,YAAY,6DACZ,OACC,qCACA,sCACA,oBAED,OACC,eACA,sEAED,OAAO,qBAAqB,uCAAuC,QACnE,OAAO,gBAAgB,0BAA0B,OACjD,OAAO,KAAK,MAAM,oDAAO,oCAAkB,KAAK,OAAK,EAAE;AAE1D,UACG,QAAQ,SACR,YACC,6EAED,OACC,qCACA,sCACA,oBAED,OACC,eACA,yEAED,OAAO,wBAAwB,iCAAiC,QAChE,OAAO,gBAAgB,0BAA0B,OACjD,OAAO,KAAK,MAAM,oDAAO,mCAAiB,KAAK,OAAK,EAAE;AAAA;AAK3D,cACE,eACoC;AACpC,SAAO,UAAU,SAAgB;AAC/B,QAAI;AACF,YAAM,aAAa,MAAM;AACzB,YAAM,WAAW,GAAG;AACpB,cAAQ,KAAK;AAAA,aACN,OAAP;AAEA,cAAQ,MAAM,MAAM;AACpB,cAAQ,KAAK;AAAA;AAAA;AAAA;;;;AC/NnB,MAAM,OAAO,CAAC,SAAmB;AAC/B,8BAAQ,KAAK,gBAAgB,QAAQ;AAErC,mBAAiBC;AAEjB,8BAAQ,MAAM;AAAA;AAGhB,KAAK,QAAQ;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/commands/index.ts","../src/index.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 { CommanderStatic } from 'commander';\nimport { TechdocsGenerator } from '@backstage/plugin-techdocs-node';\n\nconst defaultDockerImage = TechdocsGenerator.defaultDockerImage;\n\nexport function registerCommands(program: CommanderStatic) {\n program\n .command('generate')\n .description('Generate TechDocs documentation site using MkDocs.')\n .option(\n '--source-dir <PATH>',\n 'Source directory containing mkdocs.yml and docs/ directory.',\n '.',\n )\n .option(\n '--output-dir <PATH>',\n 'Output directory containing generated TechDocs site.',\n './site/',\n )\n .option(\n '--docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option('--no-pull', 'Do not pull the latest docker image', false)\n .option(\n '--no-docker',\n 'Do not use Docker, use MkDocs executable and plugins in current user environment.',\n )\n .option(\n '--techdocs-ref <HOST_TYPE:URL>',\n 'The repository hosting documentation source files e.g. url:https://ghe.mycompany.net.com/org/repo.' +\n '\\nThis value is same as the backstage.io/techdocs-ref annotation of the corresponding Backstage entity.' +\n '\\nIt is completely fine to skip this as it is only being used to set repo_url in mkdocs.yml if not found.\\n',\n )\n .option(\n '--etag <ETAG>',\n 'A unique identifier for the prepared tree e.g. commit SHA. If provided it will be stored in techdocs_metadata.json.',\n )\n .option('-v --verbose', 'Enable verbose output.', false)\n .option(\n '--omitTechdocsCoreMkdocsPlugin',\n \"Don't patch MkDocs file automatically with techdocs-core plugin.\",\n false,\n )\n .alias('build')\n .action(lazy(() => import('./generate/generate').then(m => m.default)));\n\n program\n .command('migrate')\n .description(\n 'Migrate objects with case-sensitive entity triplets to lower-case versions.',\n )\n .requiredOption(\n '--publisher-type <TYPE>',\n '(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml',\n )\n .requiredOption(\n '--storage-name <BUCKET/CONTAINER NAME>',\n '(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName',\n )\n .option(\n '--azureAccountName <AZURE ACCOUNT NAME>',\n '(Required for Azure) specify when --publisher-type azureBlobStorage',\n )\n .option(\n '--azureAccountKey <AZURE ACCOUNT KEY>',\n 'Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.',\n )\n .option(\n '--awsRoleArn <AWS ROLE ARN>',\n 'Optional AWS ARN of role to be assumed.',\n )\n .option(\n '--awsEndpoint <AWS ENDPOINT>',\n 'Optional AWS endpoint to send requests to.',\n )\n .option(\n '--awsS3ForcePathStyle',\n 'Optional AWS S3 option to force path style.',\n )\n .option(\n '--awsBucketRootPath',\n 'Optional sub-directory to store files in Amazon S3',\n )\n .option(\n '--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osAuthUrl <OPENSTACK SWIFT AUTHURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--removeOriginal',\n 'Optional Files are copied by default. If flag is set, files are renamed/moved instead.',\n false,\n )\n .option(\n '--concurrency <MAX CONCURRENT REQS>',\n 'Optional Controls the number of API requests allowed to be performed simultaneously.',\n '25',\n )\n .option('-v --verbose', 'Enable verbose output.', false)\n .action(lazy(() => import('./migrate/migrate').then(m => m.default)));\n\n program\n .command('publish')\n .description(\n 'Publish generated TechDocs site to an external storage AWS S3, Google GCS, etc.',\n )\n .requiredOption(\n '--publisher-type <TYPE>',\n '(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml',\n )\n .requiredOption(\n '--storage-name <BUCKET/CONTAINER NAME>',\n '(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName',\n )\n .requiredOption(\n '--entity <NAMESPACE/KIND/NAME>',\n '(Required always) Entity uid separated by / in namespace/kind/name order (case-sensitive). Example: default/Component/myEntity ',\n )\n .option(\n '--legacyUseCaseSensitiveTripletPaths',\n 'Publishes objects with cased entity triplet prefix when set (e.g. namespace/Kind/name). Only use if your TechDocs backend is configured the same way.',\n false,\n )\n .option(\n '--azureAccountName <AZURE ACCOUNT NAME>',\n '(Required for Azure) specify when --publisher-type azureBlobStorage',\n )\n .option(\n '--azureAccountKey <AZURE ACCOUNT KEY>',\n 'Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.',\n )\n .option(\n '--awsRoleArn <AWS ROLE ARN>',\n 'Optional AWS ARN of role to be assumed.',\n )\n .option(\n '--awsEndpoint <AWS ENDPOINT>',\n 'Optional AWS endpoint to send requests to.',\n )\n .option('--awsS3sse <AWS SSE>', 'Optional AWS S3 Server Side Encryption.')\n .option(\n '--awsS3ForcePathStyle',\n 'Optional AWS S3 option to force path style.',\n )\n .option(\n '--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osAuthUrl <OPENSTACK SWIFT AUTHURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--gcsBucketRootPath',\n 'Optional sub-directory to store files in Google cloud storage',\n )\n .option(\n '--directory <PATH>',\n 'Path of the directory containing generated files to publish',\n './site/',\n )\n .action(lazy(() => import('./publish/publish').then(m => m.default)));\n\n program\n .command('serve:mkdocs')\n .description('Serve a documentation project locally using MkDocs serve.')\n .option(\n '-i, --docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option(\n '--no-docker',\n 'Do not use Docker, run `mkdocs serve` in current user environment.',\n )\n .option('-p, --port <PORT>', 'Port to serve documentation locally', '8000')\n .option('-v --verbose', 'Enable verbose output.', false)\n .action(lazy(() => import('./serve/mkdocs').then(m => m.default)));\n\n program\n .command('serve')\n .description(\n 'Serve a documentation project locally in a Backstage app-like environment',\n )\n .option(\n '-i, --docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option(\n '--no-docker',\n 'Do not use Docker, use MkDocs executable in current user environment.',\n )\n .option('--mkdocs-port <PORT>', 'Port for MkDocs server to use', '8000')\n .option('-v --verbose', 'Enable verbose output.', false)\n .action(lazy(() => import('./serve/serve').then(m => m.default)));\n}\n\n// Wraps an action function so that it always exits and handles errors\n// Humbly taken from backstage-cli's registerCommands\nfunction lazy(\n getActionFunc: () => Promise<(...args: any[]) => Promise<void>>,\n): (...args: any[]) => Promise<never> {\n return async (...args: any[]) => {\n try {\n const actionFunc = await getActionFunc();\n await actionFunc(...args);\n process.exit(0);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error.message);\n process.exit(1);\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 program from 'commander';\nimport { registerCommands } from './commands';\nimport { version } from '../package.json';\n\nconst main = (argv: string[]) => {\n program.name('techdocs-cli').version(version);\n\n registerCommands(program);\n\n program.parse(argv);\n};\n\nmain(process.argv);\n"],"names":["TechdocsGenerator","program"],"mappings":";;;;;;;;;AAmBA,MAAM,qBAAqBA,qCAAkB;0BAEZ,SAA0B;AACzD,UACG,QAAQ,YACR,YAAY,sDACZ,OACC,uBACA,+DACA,KAED,OACC,uBACA,wDACA,WAED,OACC,iCACA,sCACA,oBAED,OAAO,aAAa,uCAAuC,OAC3D,OACC,eACA,qFAED,OACC,kCACA,wTAID,OACC,iBACA,uHAED,OAAO,gBAAgB,0BAA0B,OACjD,OACC,kCACA,oEACA,OAED,MAAM,SACN,OAAO,KAAK,MAAM,oDAAO,sCAAuB,KAAK,OAAK,EAAE;AAE/D,UACG,QAAQ,WACR,YACC,+EAED,eACC,2BACA,0IAED,eACC,0CACA,iJAED,OACC,2CACA,uEAED,OACC,yCACA,wKAED,OACC,+BACA,2CAED,OACC,gCACA,8CAED,OACC,yBACA,+CAED,OACC,uBACA,sDAED,OACC,gEACA,yEAED,OACC,8DACA,yEAED,OACC,yCACA,yEAED,OACC,2CACA,yEAED,OACC,oBACA,0FACA,OAED,OACC,uCACA,wFACA,MAED,OAAO,gBAAgB,0BAA0B,OACjD,OAAO,KAAK,MAAM,oDAAO,qCAAqB,KAAK,OAAK,EAAE;AAE7D,UACG,QAAQ,WACR,YACC,mFAED,eACC,2BACA,0IAED,eACC,0CACA,iJAED,eACC,kCACA,mIAED,OACC,wCACA,yJACA,OAED,OACC,2CACA,uEAED,OACC,yCACA,wKAED,OACC,+BACA,2CAED,OACC,gCACA,8CAED,OAAO,wBAAwB,2CAC/B,OACC,yBACA,+CAED,OACC,gEACA,yEAED,OACC,8DACA,yEAED,OACC,yCACA,yEAED,OACC,2CACA,yEAED,OACC,uBACA,iEAED,OACC,sBACA,+DACA,WAED,OAAO,KAAK,MAAM,oDAAO,qCAAqB,KAAK,OAAK,EAAE;AAE7D,UACG,QAAQ,gBACR,YAAY,6DACZ,OACC,qCACA,sCACA,oBAED,OACC,eACA,sEAED,OAAO,qBAAqB,uCAAuC,QACnE,OAAO,gBAAgB,0BAA0B,OACjD,OAAO,KAAK,MAAM,oDAAO,oCAAkB,KAAK,OAAK,EAAE;AAE1D,UACG,QAAQ,SACR,YACC,6EAED,OACC,qCACA,sCACA,oBAED,OACC,eACA,yEAED,OAAO,wBAAwB,iCAAiC,QAChE,OAAO,gBAAgB,0BAA0B,OACjD,OAAO,KAAK,MAAM,oDAAO,mCAAiB,KAAK,OAAK,EAAE;AAAA;AAK3D,cACE,eACoC;AACpC,SAAO,UAAU,SAAgB;AAC/B,QAAI;AACF,YAAM,aAAa,MAAM;AACzB,YAAM,WAAW,GAAG;AACpB,cAAQ,KAAK;AAAA,aACN,OAAP;AAEA,cAAQ,MAAM,MAAM;AACpB,cAAQ,KAAK;AAAA;AAAA;AAAA;;;;ACpOnB,MAAM,OAAO,CAAC,SAAmB;AAC/B,8BAAQ,KAAK,gBAAgB,QAAQ;AAErC,mBAAiBC;AAEjB,8BAAQ,MAAM;AAAA;AAGhB,KAAK,QAAQ;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@techdocs/cli",
|
|
3
3
|
"description": "Utility CLI for managing TechDocs sites in Backstage.",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.17-next.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -27,16 +27,17 @@
|
|
|
27
27
|
"build": "backstage-cli package build",
|
|
28
28
|
"clean": "backstage-cli package clean",
|
|
29
29
|
"lint": "backstage-cli package lint",
|
|
30
|
-
"test": "backstage-cli package test
|
|
31
|
-
"test:e2e": "backstage-cli test
|
|
32
|
-
"test:e2e:ci": "backstage-cli test --watchAll=false --ci
|
|
30
|
+
"test": "backstage-cli package test",
|
|
31
|
+
"test:e2e": "backstage-cli test --config e2e-test.config.js",
|
|
32
|
+
"test:e2e:ci": "backstage-cli test --config e2e-test.config.js --watchAll=false --ci",
|
|
33
|
+
"test:cypress": "cypress open",
|
|
33
34
|
"prepack": "./scripts/prepack.sh"
|
|
34
35
|
},
|
|
35
36
|
"bin": {
|
|
36
37
|
"techdocs-cli": "bin/techdocs-cli"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@backstage/cli": "^0.
|
|
40
|
+
"@backstage/cli": "^0.15.2-next.0",
|
|
40
41
|
"@types/commander": "^2.12.2",
|
|
41
42
|
"@types/fs-extra": "^9.0.6",
|
|
42
43
|
"@types/http-proxy": "^1.17.4",
|
|
@@ -44,9 +45,11 @@
|
|
|
44
45
|
"@types/node": "^14.14.32",
|
|
45
46
|
"@types/serve-handler": "^6.1.0",
|
|
46
47
|
"@types/webpack-env": "^1.15.3",
|
|
48
|
+
"cypress": "^9.5.0",
|
|
49
|
+
"cypress-plugin-snapshots": "^1.4.4",
|
|
47
50
|
"find-process": "^1.4.5",
|
|
48
51
|
"nodemon": "^2.0.2",
|
|
49
|
-
"techdocs-cli-embedded-app": "^0.2.
|
|
52
|
+
"techdocs-cli-embedded-app": "^0.2.67-next.0",
|
|
50
53
|
"ts-node": "^10.0.0"
|
|
51
54
|
},
|
|
52
55
|
"files": [
|
|
@@ -59,19 +62,19 @@
|
|
|
59
62
|
"ext": "ts"
|
|
60
63
|
},
|
|
61
64
|
"dependencies": {
|
|
62
|
-
"@backstage/backend-common": "^0.
|
|
63
|
-
"@backstage/catalog-model": "^0.
|
|
64
|
-
"@backstage/cli-common": "^0.1.
|
|
65
|
-
"@backstage/config": "^0.1.
|
|
66
|
-
"@backstage/techdocs-
|
|
65
|
+
"@backstage/backend-common": "^0.13.0-next.0",
|
|
66
|
+
"@backstage/catalog-model": "^0.13.0-next.0",
|
|
67
|
+
"@backstage/cli-common": "^0.1.8",
|
|
68
|
+
"@backstage/config": "^0.1.15",
|
|
69
|
+
"@backstage/plugin-techdocs-node": "^0.11.12-next.0",
|
|
67
70
|
"@types/dockerode": "^3.3.0",
|
|
68
71
|
"commander": "^6.1.0",
|
|
69
72
|
"dockerode": "^3.3.1",
|
|
70
|
-
"fs-extra": "^
|
|
73
|
+
"fs-extra": "^10.0.1",
|
|
71
74
|
"http-proxy": "^1.18.1",
|
|
72
75
|
"react-dev-utils": "^12.0.0-next.60",
|
|
73
76
|
"serve-handler": "^6.1.3",
|
|
74
77
|
"winston": "^3.2.1"
|
|
75
78
|
},
|
|
76
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "e90d3ed129ebfce978f1adfa40c1dc2cef3f7e65"
|
|
77
80
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-86756c8c.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 { Command } from 'commander';\nimport fs from 'fs-extra';\nimport Docker from 'dockerode';\nimport {\n TechdocsGenerator,\n ParsedLocationAnnotation,\n} from '@backstage/techdocs-common';\nimport { DockerContainerRunner } from '@backstage/backend-common';\nimport { ConfigReader } from '@backstage/config';\nimport {\n convertTechDocsRefToLocationAnnotation,\n createLogger,\n} from '../../lib/utility';\nimport { stdout } from 'process';\n\nexport default async function generate(cmd: Command) {\n // Use techdocs-common 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: cmd.verbose });\n\n const sourceDir = resolve(cmd.sourceDir);\n const outputDir = resolve(cmd.outputDir);\n const dockerImage = cmd.dockerImage;\n const pullImage = cmd.pull;\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 config = new ConfigReader({\n techdocs: {\n generator: {\n runIn: cmd.docker ? 'docker' : 'local',\n dockerImage,\n pullImage,\n },\n },\n });\n\n // Docker client (conditionally) used by the generators, based on techdocs.generators config.\n const dockerClient = new Docker();\n const containerRunner = new DockerContainerRunner({ dockerClient });\n\n let parsedLocationAnnotation = {} as ParsedLocationAnnotation;\n if (cmd.techdocsRef) {\n try {\n parsedLocationAnnotation = convertTechDocsRefToLocationAnnotation(\n cmd.techdocsRef,\n );\n } catch (err) {\n logger.error(err.message);\n }\n }\n\n // Generate docs using @backstage/techdocs-common\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 ...(cmd.techdocsRef\n ? {\n parsedLocationAnnotation,\n }\n : {}),\n logger,\n etag: cmd.etag,\n ...(process.env.LOG_LEVEL === 'debug' ? { logStream: stdout } : {}),\n });\n\n logger.info('Done!');\n}\n"],"names":["createLogger","resolve","fs","config","ConfigReader","Docker","DockerContainerRunner","convertTechDocsRefToLocationAnnotation","TechdocsGenerator","stdout"],"mappings":";;;;;;;;;;;;;;;;;wBAgCuC,KAAc;AAKnD,QAAM,SAASA,qBAAa,EAAE,SAAS,IAAI;AAE3C,QAAM,YAAYC,aAAQ,IAAI;AAC9B,QAAM,YAAYA,aAAQ,IAAI;AAC9B,QAAM,cAAc,IAAI;AACxB,QAAM,YAAY,IAAI;AAEtB,SAAO,KAAK,oBAAoB;AAChC,SAAO,KAAK,kCAAkC;AAE9C,SAAO,QAAQ;AAEf,QAAMC,uBAAG,UAAU;AAEnB,QAAMC,WAAS,IAAIC,oBAAa;AAAA,IAC9B,UAAU;AAAA,MACR,WAAW;AAAA,QACT,OAAO,IAAI,SAAS,WAAW;AAAA,QAC/B;AAAA,QACA;AAAA;AAAA;AAAA;AAMN,QAAM,eAAe,IAAIC;AACzB,QAAM,kBAAkB,IAAIC,oCAAsB,EAAE;AAEpD,MAAI,2BAA2B;AAC/B,MAAI,IAAI,aAAa;AACnB,QAAI;AACF,iCAA2BC,+CACzB,IAAI;AAAA,aAEC,KAAP;AACA,aAAO,MAAM,IAAI;AAAA;AAAA;AAKrB,QAAM,oBAAoB,MAAMC,iCAAkB,WAAWL,UAAQ;AAAA,IACnE;AAAA,IACA;AAAA;AAGF,SAAO,KAAK;AAEZ,QAAM,kBAAkB,IAAI;AAAA,IAC1B,UAAU;AAAA,IACV;AAAA,OACI,IAAI,cACJ;AAAA,MACE;AAAA,QAEF;AAAA,IACJ;AAAA,IACA,MAAM,IAAI;AAAA,OACN,QAAQ,IAAI,cAAc,UAAU,EAAE,WAAWM,qBAAW;AAAA;AAGlE,SAAO,KAAK;AAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-04a51fb3.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/techdocs-common';\nimport { Command } from 'commander';\nimport { createLogger } from '../../lib/utility';\nimport { PublisherConfig } from '../../lib/PublisherConfig';\n\nexport default async function migrate(cmd: Command) {\n const logger = createLogger({ verbose: cmd.verbose });\n\n const config = PublisherConfig.getValidConfig(cmd);\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 ${cmd.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 = cmd.removeOriginal;\n const numericConcurrency = parseInt(cmd.concurrency, 10);\n\n if (!Number.isInteger(numericConcurrency) || numericConcurrency <= 0) {\n throw new Error(\n `Concurrency must be a number greater than 1. ${cmd.concurrency} provided.`,\n );\n }\n\n await publisher.migrateDocsCase({\n concurrency: numericConcurrency,\n removeOriginal,\n });\n}\n"],"names":["createLogger","PublisherConfig","SingleHostDiscovery","Publisher"],"mappings":";;;;;;;;;uBAsBsC,KAAc;AAClD,QAAM,SAASA,qBAAa,EAAE,SAAS,IAAI;AAE3C,QAAM,SAASC,gCAAgB,eAAe;AAC9C,QAAM,YAAYC,kCAAoB,WAAW;AACjD,QAAM,YAAY,MAAMC,yBAAU,WAAW,QAAQ,EAAE,QAAQ;AAE/D,MAAI,CAAC,UAAU,iBAAiB;AAC9B,UAAM,IAAI,MAAM,iCAAiC,IAAI;AAAA;AAIvD,QAAM,EAAE,gBAAgB,MAAM,UAAU;AACxC,MAAI,CAAC,aAAa;AAEhB,UAAM,IAAI,MAAM;AAAA;AAIlB,QAAM,iBAAiB,IAAI;AAC3B,QAAM,qBAAqB,SAAS,IAAI,aAAa;AAErD,MAAI,CAAC,OAAO,UAAU,uBAAuB,sBAAsB,GAAG;AACpE,UAAM,IAAI,MACR,gDAAgD,IAAI;AAAA;AAIxD,QAAM,UAAU,gBAAgB;AAAA,IAC9B,aAAa;AAAA,IACb;AAAA;AAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publish-d1ccb001.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 { Command } from 'commander';\nimport { createLogger } from '../../lib/utility';\nimport { SingleHostDiscovery } from '@backstage/backend-common';\nimport { Publisher } from '@backstage/techdocs-common';\nimport { Entity } from '@backstage/catalog-model';\nimport { PublisherConfig } from '../../lib/PublisherConfig';\n\nexport default async function publish(cmd: Command): Promise<any> {\n const logger = createLogger({ verbose: cmd.verbose });\n\n const config = PublisherConfig.getValidConfig(cmd);\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] = cmd.entity.split('/');\n const entity = {\n kind,\n metadata: {\n namespace,\n name,\n },\n } as Entity;\n\n const directory = resolve(cmd.directory);\n await publisher.publish({ entity, directory });\n\n return true;\n}\n"],"names":["createLogger","PublisherConfig","SingleHostDiscovery","Publisher","resolve"],"mappings":";;;;;;;;;;uBAwBsC,KAA4B;AAChE,QAAM,SAASA,qBAAa,EAAE,SAAS,IAAI;AAE3C,QAAM,SAASC,gCAAgB,eAAe;AAC9C,QAAM,YAAYC,kCAAoB,WAAW;AACjD,QAAM,YAAY,MAAMC,yBAAU,WAAW,QAAQ,EAAE,QAAQ;AAG/D,QAAM,EAAE,gBAAgB,MAAM,UAAU;AACxC,MAAI,CAAC,aAAa;AAEhB,WAAO,QAAQ,OAAO,IAAI,MAAM;AAAA;AAGlC,QAAM,CAAC,WAAW,MAAM,QAAQ,IAAI,OAAO,MAAM;AACjD,QAAM,SAAS;AAAA,IACb;AAAA,IACA,UAAU;AAAA,MACR;AAAA,MACA;AAAA;AAAA;AAIJ,QAAM,YAAYC,aAAQ,IAAI;AAC9B,QAAM,UAAU,QAAQ,EAAE,QAAQ;AAElC,SAAO;AAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serve-be4ef843.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 mkdocsPort: number;\n private readonly verbose: boolean;\n\n constructor(\n backstageBundleDir: string,\n backstagePort: number,\n mkdocsPort: number,\n verbose: boolean,\n ) {\n this.proxyEndpoint = '/api/';\n this.backstageBundleDir = backstageBundleDir;\n this.backstagePort = backstagePort;\n this.mkdocsPort = mkdocsPort;\n this.verbose = verbose;\n }\n\n // Create a Proxy for mkdocs server\n private createProxy() {\n const proxy = httpProxy.createProxyServer({\n target: `http://localhost:${this.mkdocsPort}`,\n });\n\n return (request: http.IncomingMessage): [httpProxy, string] => {\n // If the request goes to /api/ we want to remove /api/ from the prefix of the request URL.\n // e.g. ['/', 'api', pathChunks]\n const [, , ...pathChunks] = request.url?.split('/') ?? [];\n const forwardPath = pathChunks.join('/');\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 { Command } 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';\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 return findPaths(__dirname).resolveOwn('dist/embedded-app');\n }\n}\n\nexport default async function serve(cmd: Command) {\n const logger = createLogger({ verbose: cmd.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 // TODO: Backstage app port should also be configurable as a CLI option. However, since we bundle\n // a backstage app, we define app.baseUrl in the app-config.yaml.\n // Hence, it is complicated to make this configurable.\n const backstagePort = 3000;\n const backstageBackendPort = 7007;\n\n const mkdocsDockerAddr = `http://0.0.0.0:${cmd.mkdocsPort}`;\n const mkdocsLocalAddr = `http://127.0.0.1:${cmd.mkdocsPort}`;\n const mkdocsExpectedDevAddr = cmd.docker ? mkdocsDockerAddr : mkdocsLocalAddr;\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 = cmd.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: cmd.mkdocsPort,\n dockerImage: cmd.dockerImage,\n useDocker: cmd.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 : backstagePort;\n const httpServer = new HTTPServer(\n findPreviewBundlePath(),\n port,\n cmd.mkdocsPort,\n cmd.verbose,\n );\n\n httpServer\n .serve()\n .catch(err => {\n logger.error(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"],"names":["httpProxy","http","createLogger","path","findPaths","runMkdocsServer","waitForSignal"],"mappings":";;;;;;;;;;;;;;;;;;;;;iBAqBgC;AAAA,EAO9B,YACE,oBACA,eACA,YACA,SACA;AACA,SAAK,gBAAgB;AACrB,SAAK,qBAAqB;AAC1B,SAAK,gBAAgB;AACrB,SAAK,aAAa;AAClB,SAAK,UAAU;AAAA;AAAA,EAIT,cAAc;AACpB,UAAM,QAAQA,8BAAU,kBAAkB;AAAA,MACxC,QAAQ,oBAAoB,KAAK;AAAA;AAGnC,WAAO,CAAC,YAAuD;AA/CnE;AAkDM,YAAM,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Content":["/*\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/techdocs-common';\nimport * as winston from 'winston';\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"],"names":["winston"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;MAqBa,yCAAyC,CACpD,gBAC6B;AAG7B,QAAM,CAAC,MAAM,UAAU,YAAY,MAAM;AAKzC,MAAI,CAAC,QAAQ,CAAC,QAAQ;AACpB,UAAM,IAAI,MACR,gCAAgC;AAAA;AAIpC,SAAO,EAAE,MAAM;AAAA;MAGJ,eAAe,CAAC;AAAA,EAC3B,UAAU;AAAA,MAGU;AACpB,QAAM,SAASA,mBAAQ,aAAa;AAAA,IAClC,OAAO,UAAU,YAAY;AAAA,IAC7B,YAAY;AAAA,MACV,IAAIA,mBAAQ,WAAW,QAAQ,EAAE,QAAQA,mBAAQ,OAAO;AAAA;AAAA;AAI5D,SAAO;AAAA;;;;;"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[5011],{3509:function(He,Ie,J){J.d(Ie,{O:function(){return Oe}});var oe=J(2784);function ge(X,ae){return typeof X=="function"?X(ae):X}var Q=J(29862);function Te(X){var ae=(0,oe.useState)(X),N=ae[0],V=ae[1],ce=(0,Q.t)();return[N,(0,oe.useCallback)(function(de){ce()&&V(de)},[])]}function Oe(X){X===void 0&&(X=!1);var ae=Te(X),N=ae[0],V=ae[1];return[N,(0,oe.useCallback)(function(ce){V(function(de){return typeof ce=="undefined"?!de:Boolean(ge(ce,de))})},[])]}},7688:function(He,Ie,J){var oe=J(2784),ge=function(E,v){if(!(E instanceof v))throw new TypeError("Cannot call a class as a function")},Q=function(){function E(v,O){for(var M=0;M<O.length;M++){var z=O[M];z.enumerable=z.enumerable||!1,z.configurable=!0,"value"in z&&(z.writable=!0),Object.defineProperty(v,z.key,z)}}return function(v,O,M){return O&&E(v.prototype,O),M&&E(v,M),v}}(),Te=Object.assign||function(E){for(var v=1;v<arguments.length;v++){var O=arguments[v];for(var M in O)Object.prototype.hasOwnProperty.call(O,M)&&(E[M]=O[M])}return E},Oe=function(E,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);E.prototype=Object.create(v&&v.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(E,v):E.__proto__=v)},X=function(E,v){if(!E)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:E},ae=function(){function E(v,O){var M=[],z=!0,te=!1,Y=void 0;try{for(var G=v[Symbol.iterator](),K;!(z=(K=G.next()).done)&&(M.push(K.value),!(O&&M.length===O));z=!0);}catch(j){te=!0,Y=j}finally{try{!z&&G.return&&G.return()}finally{if(te)throw Y}}return M}return function(v,O){if(Array.isArray(v))return v;if(Symbol.iterator in Object(v))return E(v,O);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),N=void 0;typeof window!="undefined"?N=window:typeof self!="undefined"?N=self:N=J.g;var V=null,ce=null,de=20,pe=N.clearTimeout,be=N.setTimeout,we=N.cancelAnimationFrame||N.mozCancelAnimationFrame||N.webkitCancelAnimationFrame,Ae=N.requestAnimationFrame||N.mozRequestAnimationFrame||N.webkitRequestAnimationFrame;we==null||Ae==null?(V=pe,ce=function(v){return be(v,de)}):(V=function(v){var O=ae(v,2),M=O[0],z=O[1];we(M),pe(z)},ce=function(v){var O=Ae(function(){pe(M),v()}),M=be(function(){we(O),v()},de);return[O,M]});function Se(E){var v=void 0,O=void 0,M=void 0,z=void 0,te=void 0,Y=void 0,G=void 0,K=typeof document!="undefined"&&document.attachEvent;if(!K){Y=function(h){var H=h.__resizeTriggers__,q=H.firstElementChild,D=H.lastElementChild,he=q.firstElementChild;D.scrollLeft=D.scrollWidth,D.scrollTop=D.scrollHeight,he.style.width=q.offsetWidth+1+"px",he.style.height=q.offsetHeight+1+"px",q.scrollLeft=q.scrollWidth,q.scrollTop=q.scrollHeight},te=function(h){return h.offsetWidth!==h.__resizeLast__.width||h.offsetHeight!==h.__resizeLast__.height},G=function(h){if(!(h.target.className&&typeof h.target.className.indexOf=="function"&&h.target.className.indexOf("contract-trigger")<0&&h.target.className.indexOf("expand-trigger")<0)){var H=this;Y(this),this.__resizeRAF__&&V(this.__resizeRAF__),this.__resizeRAF__=ce(function(){te(H)&&(H.__resizeLast__.width=H.offsetWidth,H.__resizeLast__.height=H.offsetHeight,H.__resizeListeners__.forEach(function(he){he.call(H,h)}))})}};var j=!1,Z="";M="animationstart";var se="Webkit Moz O ms".split(" "),fe="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),ne="";{var re=document.createElement("fakeelement");if(re.style.animationName!==void 0&&(j=!0),j===!1){for(var le=0;le<se.length;le++)if(re.style[se[le]+"AnimationName"]!==void 0){ne=se[le],Z="-"+ne.toLowerCase()+"-",M=fe[le],j=!0;break}}}O="resizeanim",v="@"+Z+"keyframes "+O+" { from { opacity: 0; } to { opacity: 0; } } ",z=Z+"animation: 1ms "+O+"; "}var Re=function(h){if(!h.getElementById("detectElementResize")){var H=(v||"")+".resize-triggers { "+(z||"")+'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',q=h.head||h.getElementsByTagName("head")[0],D=h.createElement("style");D.id="detectElementResize",D.type="text/css",E!=null&&D.setAttribute("nonce",E),D.styleSheet?D.styleSheet.cssText=H:D.appendChild(h.createTextNode(H)),q.appendChild(D)}},xe=function(h,H){if(K)h.attachEvent("onresize",H);else{if(!h.__resizeTriggers__){var q=h.ownerDocument,D=N.getComputedStyle(h);D&&D.position==="static"&&(h.style.position="relative"),Re(q),h.__resizeLast__={},h.__resizeListeners__=[],(h.__resizeTriggers__=q.createElement("div")).className="resize-triggers";var he=q.createElement("div");he.className="expand-trigger",he.appendChild(q.createElement("div"));var We=q.createElement("div");We.className="contract-trigger",h.__resizeTriggers__.appendChild(he),h.__resizeTriggers__.appendChild(We),h.appendChild(h.__resizeTriggers__),Y(h),h.addEventListener("scroll",G,!0),M&&(h.__resizeTriggers__.__animationListener__=function(Ne){Ne.animationName===O&&Y(h)},h.__resizeTriggers__.addEventListener(M,h.__resizeTriggers__.__animationListener__))}h.__resizeListeners__.push(H)}},Ee=function(h,H){if(K)h.detachEvent("onresize",H);else if(h.__resizeListeners__.splice(h.__resizeListeners__.indexOf(H),1),!h.__resizeListeners__.length){h.removeEventListener("scroll",G,!0),h.__resizeTriggers__.__animationListener__&&(h.__resizeTriggers__.removeEventListener(M,h.__resizeTriggers__.__animationListener__),h.__resizeTriggers__.__animationListener__=null);try{h.__resizeTriggers__=!h.removeChild(h.__resizeTriggers__)}catch{}}};return{addResizeListener:xe,removeResizeListener:Ee}}var _e=function(E){Oe(v,E);function v(){var O,M,z,te;ge(this,v);for(var Y=arguments.length,G=Array(Y),K=0;K<Y;K++)G[K]=arguments[K];return te=(M=(z=X(this,(O=v.__proto__||Object.getPrototypeOf(v)).call.apply(O,[this].concat(G))),z),z.state={height:z.props.defaultHeight||0,width:z.props.defaultWidth||0},z._onResize=function(){var j=z.props,Z=j.disableHeight,se=j.disableWidth,fe=j.onResize;if(z._parentNode){var ne=z._parentNode.offsetHeight||0,re=z._parentNode.offsetWidth||0,le=window.getComputedStyle(z._parentNode)||{},Re=parseInt(le.paddingLeft,10)||0,xe=parseInt(le.paddingRight,10)||0,Ee=parseInt(le.paddingTop,10)||0,ve=parseInt(le.paddingBottom,10)||0,h=ne-Ee-ve,H=re-Re-xe;(!Z&&z.state.height!==h||!se&&z.state.width!==H)&&(z.setState({height:ne-Ee-ve,width:re-Re-xe}),fe({height:ne,width:re}))}},z._setRef=function(j){z._autoSizer=j},M),X(z,te)}return Q(v,[{key:"componentDidMount",value:function(){var M=this.props.nonce;this._autoSizer&&this._autoSizer.parentNode&&this._autoSizer.parentNode.ownerDocument&&this._autoSizer.parentNode.ownerDocument.defaultView&&this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement&&(this._parentNode=this._autoSizer.parentNode,this._detectElementResize=Se(M),this._detectElementResize.addResizeListener(this._parentNode,this._onResize),this._onResize())}},{key:"componentWillUnmount",value:function(){this._detectElementResize&&this._parentNode&&this._detectElementResize.removeResizeListener(this._parentNode,this._onResize)}},{key:"render",value:function(){var M=this.props,z=M.children,te=M.className,Y=M.disableHeight,G=M.disableWidth,K=M.style,j=this.state,Z=j.height,se=j.width,fe={overflow:"visible"},ne={},re=!1;return Y||(Z===0&&(re=!0),fe.height=0,ne.height=Z),G||(se===0&&(re=!0),fe.width=0,ne.width=se),(0,oe.createElement)("div",{className:te,ref:this._setRef,style:Te({},fe,K)},!re&&z(ne))}}]),v}(oe.PureComponent);_e.defaultProps={onResize:function(){},disableHeight:!1,disableWidth:!1,style:{}},Ie.Z=_e},8301:function(He,Ie,J){J.d(Ie,{t7:function(){return $e}});var oe=J(7896),ge=J(81665),Q=J(80753),Te=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function Oe(o,e){return!!(o===e||Te(o)&&Te(e))}function X(o,e){if(o.length!==e.length)return!1;for(var t=0;t<o.length;t++)if(!Oe(o[t],e[t]))return!1;return!0}function ae(o,e){e===void 0&&(e=X);var t,r=[],i,l=!1;function s(){for(var u=[],c=0;c<arguments.length;c++)u[c]=arguments[c];return l&&t===this&&e(u,r)||(i=o.apply(this,u),l=!0,t=this,r=u),i}return s}var N=ae,V=J(2784),ce=typeof performance=="object"&&typeof performance.now=="function",de=ce?function(){return performance.now()}:function(){return Date.now()};function pe(o){cancelAnimationFrame(o.id)}function be(o,e){var t=de();function r(){de()-t>=e?o.call(null):i.id=requestAnimationFrame(r)}var i={id:requestAnimationFrame(r)};return i}var we=-1;function Ae(o){if(o===void 0&&(o=!1),we===-1||o){var e=document.createElement("div"),t=e.style;t.width="50px",t.height="50px",t.overflow="scroll",document.body.appendChild(e),we=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return we}var Se=null;function _e(o){if(o===void 0&&(o=!1),Se===null||o){var e=document.createElement("div"),t=e.style;t.width="50px",t.height="50px",t.overflow="scroll",t.direction="rtl";var r=document.createElement("div"),i=r.style;return i.width="100px",i.height="100px",e.appendChild(r),document.body.appendChild(e),e.scrollLeft>0?Se="positive-descending":(e.scrollLeft=1,e.scrollLeft===0?Se="negative":Se="positive-ascending"),document.body.removeChild(e),Se}return Se}var E=150,v=function(e){var t=e.columnIndex,r=e.data,i=e.rowIndex;return i+":"+t},O=null,M=null,z=null;function te(o){var e,t,r=o.getColumnOffset,i=o.getColumnStartIndexForOffset,l=o.getColumnStopIndexForStartIndex,s=o.getColumnWidth,u=o.getEstimatedTotalHeight,c=o.getEstimatedTotalWidth,p=o.getOffsetForColumnAndAlignment,m=o.getOffsetForRowAndAlignment,I=o.getRowHeight,g=o.getRowOffset,A=o.getRowStartIndexForOffset,F=o.getRowStopIndexForStartIndex,y=o.initInstanceProps,a=o.shouldResetStyleCacheOnItemSizeChange,w=o.validateProps;return t=e=function(C){(0,ge.Z)(R,C);function R(b){var n;return n=C.call(this,b)||this,n._instanceProps=y(n.props,(0,Q.Z)((0,Q.Z)(n))),n._resetIsScrollingTimeoutId=null,n._outerRef=void 0,n.state={instance:(0,Q.Z)((0,Q.Z)(n)),isScrolling:!1,horizontalScrollDirection:"forward",scrollLeft:typeof n.props.initialScrollLeft=="number"?n.props.initialScrollLeft:0,scrollTop:typeof n.props.initialScrollTop=="number"?n.props.initialScrollTop:0,scrollUpdateWasRequested:!1,verticalScrollDirection:"forward"},n._callOnItemsRendered=void 0,n._callOnItemsRendered=N(function(f,d,S,x,_,W,P,$){return n.props.onItemsRendered({overscanColumnStartIndex:f,overscanColumnStopIndex:d,overscanRowStartIndex:S,overscanRowStopIndex:x,visibleColumnStartIndex:_,visibleColumnStopIndex:W,visibleRowStartIndex:P,visibleRowStopIndex:$})}),n._callOnScroll=void 0,n._callOnScroll=N(function(f,d,S,x,_){return n.props.onScroll({horizontalScrollDirection:S,scrollLeft:f,scrollTop:d,verticalScrollDirection:x,scrollUpdateWasRequested:_})}),n._getItemStyle=void 0,n._getItemStyle=function(f,d){var S=n.props,x=S.columnWidth,_=S.direction,W=S.rowHeight,P=n._getItemStyleCache(a&&x,a&&_,a&&W),$=f+":"+d,k;if(P.hasOwnProperty($))k=P[$];else{var U=r(n.props,d,n._instanceProps),L=_==="rtl";P[$]=k={position:"absolute",left:L?void 0:U,right:L?U:void 0,top:g(n.props,f,n._instanceProps),height:I(n.props,f,n._instanceProps),width:s(n.props,d,n._instanceProps)}}return k},n._getItemStyleCache=void 0,n._getItemStyleCache=N(function(f,d,S){return{}}),n._onScroll=function(f){var d=f.currentTarget,S=d.clientHeight,x=d.clientWidth,_=d.scrollLeft,W=d.scrollTop,P=d.scrollHeight,$=d.scrollWidth;n.setState(function(k){if(k.scrollLeft===_&&k.scrollTop===W)return null;var U=n.props.direction,L=_;if(U==="rtl")switch(_e()){case"negative":L=-_;break;case"positive-descending":L=$-x-_;break}L=Math.max(0,Math.min(L,$-x));var B=Math.max(0,Math.min(W,P-S));return{isScrolling:!0,horizontalScrollDirection:k.scrollLeft<_?"forward":"backward",scrollLeft:L,scrollTop:B,verticalScrollDirection:k.scrollTop<W?"forward":"backward",scrollUpdateWasRequested:!1}},n._resetIsScrollingDebounced)},n._outerRefSetter=function(f){var d=n.props.outerRef;n._outerRef=f,typeof d=="function"?d(f):d!=null&&typeof d=="object"&&d.hasOwnProperty("current")&&(d.current=f)},n._resetIsScrollingDebounced=function(){n._resetIsScrollingTimeoutId!==null&&pe(n._resetIsScrollingTimeoutId),n._resetIsScrollingTimeoutId=be(n._resetIsScrolling,E)},n._resetIsScrolling=function(){n._resetIsScrollingTimeoutId=null,n.setState({isScrolling:!1},function(){n._getItemStyleCache(-1)})},n}R.getDerivedStateFromProps=function(n,f){return Y(n,f),w(n),null};var T=R.prototype;return T.scrollTo=function(n){var f=n.scrollLeft,d=n.scrollTop;f!==void 0&&(f=Math.max(0,f)),d!==void 0&&(d=Math.max(0,d)),this.setState(function(S){return f===void 0&&(f=S.scrollLeft),d===void 0&&(d=S.scrollTop),S.scrollLeft===f&&S.scrollTop===d?null:{horizontalScrollDirection:S.scrollLeft<f?"forward":"backward",scrollLeft:f,scrollTop:d,scrollUpdateWasRequested:!0,verticalScrollDirection:S.scrollTop<d?"forward":"backward"}},this._resetIsScrollingDebounced)},T.scrollToItem=function(n){var f=n.align,d=f===void 0?"auto":f,S=n.columnIndex,x=n.rowIndex,_=this.props,W=_.columnCount,P=_.height,$=_.rowCount,k=_.width,U=this.state,L=U.scrollLeft,B=U.scrollTop,ee=Ae();S!==void 0&&(S=Math.max(0,Math.min(S,W-1))),x!==void 0&&(x=Math.max(0,Math.min(x,$-1)));var ue=u(this.props,this._instanceProps),ie=c(this.props,this._instanceProps),Ce=ie>k?ee:0,ze=ue>P?ee:0;this.scrollTo({scrollLeft:S!==void 0?p(this.props,S,d,L,this._instanceProps,ze):L,scrollTop:x!==void 0?m(this.props,x,d,B,this._instanceProps,Ce):B})},T.componentDidMount=function(){var n=this.props,f=n.initialScrollLeft,d=n.initialScrollTop;if(this._outerRef!=null){var S=this._outerRef;typeof f=="number"&&(S.scrollLeft=f),typeof d=="number"&&(S.scrollTop=d)}this._callPropsCallbacks()},T.componentDidUpdate=function(){var n=this.props.direction,f=this.state,d=f.scrollLeft,S=f.scrollTop,x=f.scrollUpdateWasRequested;if(x&&this._outerRef!=null){var _=this._outerRef;if(n==="rtl")switch(_e()){case"negative":_.scrollLeft=-d;break;case"positive-ascending":_.scrollLeft=d;break;default:var W=_.clientWidth,P=_.scrollWidth;_.scrollLeft=P-W-d;break}else _.scrollLeft=Math.max(0,d);_.scrollTop=Math.max(0,S)}this._callPropsCallbacks()},T.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&pe(this._resetIsScrollingTimeoutId)},T.render=function(){var n=this.props,f=n.children,d=n.className,S=n.columnCount,x=n.direction,_=n.height,W=n.innerRef,P=n.innerElementType,$=n.innerTagName,k=n.itemData,U=n.itemKey,L=U===void 0?v:U,B=n.outerElementType,ee=n.outerTagName,ue=n.rowCount,ie=n.style,Ce=n.useIsScrolling,ze=n.width,Me=this.state.isScrolling,me=this._getHorizontalRangeToRender(),ye=me[0],Ze=me[1],ke=this._getVerticalRangeToRender(),je=ke[0],Be=ke[1],Ue=[];if(S>0&&ue)for(var Fe=je;Fe<=Be;Fe++)for(var Le=ye;Le<=Ze;Le++)Ue.push((0,V.createElement)(f,{columnIndex:Le,data:k,isScrolling:Ce?Me:void 0,key:L({columnIndex:Le,data:k,rowIndex:Fe}),rowIndex:Fe,style:this._getItemStyle(Fe,Le)}));var Ve=u(this.props,this._instanceProps),Ke=c(this.props,this._instanceProps);return(0,V.createElement)(B||ee||"div",{className:d,onScroll:this._onScroll,ref:this._outerRefSetter,style:(0,oe.Z)({position:"relative",height:_,width:ze,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:x},ie)},(0,V.createElement)(P||$||"div",{children:Ue,ref:W,style:{height:Ve,pointerEvents:Me?"none":void 0,width:Ke}}))},T._callPropsCallbacks=function(){var n=this.props,f=n.columnCount,d=n.onItemsRendered,S=n.onScroll,x=n.rowCount;if(typeof d=="function"&&f>0&&x>0){var _=this._getHorizontalRangeToRender(),W=_[0],P=_[1],$=_[2],k=_[3],U=this._getVerticalRangeToRender(),L=U[0],B=U[1],ee=U[2],ue=U[3];this._callOnItemsRendered(W,P,L,B,$,k,ee,ue)}if(typeof S=="function"){var ie=this.state,Ce=ie.horizontalScrollDirection,ze=ie.scrollLeft,Me=ie.scrollTop,me=ie.scrollUpdateWasRequested,ye=ie.verticalScrollDirection;this._callOnScroll(ze,Me,Ce,ye,me)}},T._getHorizontalRangeToRender=function(){var n=this.props,f=n.columnCount,d=n.overscanColumnCount,S=n.overscanColumnsCount,x=n.overscanCount,_=n.rowCount,W=this.state,P=W.horizontalScrollDirection,$=W.isScrolling,k=W.scrollLeft,U=d||S||x||1;if(f===0||_===0)return[0,0,0,0];var L=i(this.props,k,this._instanceProps),B=l(this.props,L,k,this._instanceProps),ee=!$||P==="backward"?Math.max(1,U):1,ue=!$||P==="forward"?Math.max(1,U):1;return[Math.max(0,L-ee),Math.max(0,Math.min(f-1,B+ue)),L,B]},T._getVerticalRangeToRender=function(){var n=this.props,f=n.columnCount,d=n.overscanCount,S=n.overscanRowCount,x=n.overscanRowsCount,_=n.rowCount,W=this.state,P=W.isScrolling,$=W.verticalScrollDirection,k=W.scrollTop,U=S||x||d||1;if(f===0||_===0)return[0,0,0,0];var L=A(this.props,k,this._instanceProps),B=F(this.props,L,k,this._instanceProps),ee=!P||$==="backward"?Math.max(1,U):1,ue=!P||$==="forward"?Math.max(1,U):1;return[Math.max(0,L-ee),Math.max(0,Math.min(_-1,B+ue)),L,B]},R}(V.PureComponent),e.defaultProps={direction:"ltr",itemData:void 0,useIsScrolling:!1},t}var Y=function(e,t){var r=e.children,i=e.direction,l=e.height,s=e.innerTagName,u=e.outerTagName,c=e.overscanColumnsCount,p=e.overscanCount,m=e.overscanRowsCount,I=e.width,g=t.instance},G=50,K=function(e,t){var r=e.rowCount,i=t.rowMetadataMap,l=t.estimatedRowHeight,s=t.lastMeasuredRowIndex,u=0;if(s>=r&&(s=r-1),s>=0){var c=i[s];u=c.offset+c.size}var p=r-s-1,m=p*l;return u+m},j=function(e,t){var r=e.columnCount,i=t.columnMetadataMap,l=t.estimatedColumnWidth,s=t.lastMeasuredColumnIndex,u=0;if(s>=r&&(s=r-1),s>=0){var c=i[s];u=c.offset+c.size}var p=r-s-1,m=p*l;return u+m},Z=function(e,t,r,i){var l,s,u;if(e==="column"?(l=i.columnMetadataMap,s=t.columnWidth,u=i.lastMeasuredColumnIndex):(l=i.rowMetadataMap,s=t.rowHeight,u=i.lastMeasuredRowIndex),r>u){var c=0;if(u>=0){var p=l[u];c=p.offset+p.size}for(var m=u+1;m<=r;m++){var I=s(m);l[m]={offset:c,size:I},c+=I}e==="column"?i.lastMeasuredColumnIndex=r:i.lastMeasuredRowIndex=r}return l[r]},se=function(e,t,r,i){var l,s;e==="column"?(l=r.columnMetadataMap,s=r.lastMeasuredColumnIndex):(l=r.rowMetadataMap,s=r.lastMeasuredRowIndex);var u=s>0?l[s].offset:0;return u>=i?fe(e,t,r,s,0,i):ne(e,t,r,Math.max(0,s),i)},fe=function(e,t,r,i,l,s){for(;l<=i;){var u=l+Math.floor((i-l)/2),c=Z(e,t,u,r).offset;if(c===s)return u;c<s?l=u+1:c>s&&(i=u-1)}return l>0?l-1:0},ne=function(e,t,r,i,l){for(var s=e==="column"?t.columnCount:t.rowCount,u=1;i<s&&Z(e,t,i,r).offset<l;)i+=u,u*=2;return fe(e,t,r,Math.min(i,s-1),Math.floor(i/2),l)},re=function(e,t,r,i,l,s,u){var c=e==="column"?t.width:t.height,p=Z(e,t,r,s),m=e==="column"?j(t,s):K(t,s),I=Math.max(0,Math.min(m-c,p.offset)),g=Math.max(0,p.offset-c+u+p.size);switch(i==="smart"&&(l>=g-c&&l<=I+c?i="auto":i="center"),i){case"start":return I;case"end":return g;case"center":return Math.round(g+(I-g)/2);case"auto":default:return l>=g&&l<=I?l:g>I||l<g?g:I}},le=te({getColumnOffset:function(e,t,r){return Z("column",e,t,r).offset},getColumnStartIndexForOffset:function(e,t,r){return se("column",e,r,t)},getColumnStopIndexForStartIndex:function(e,t,r,i){for(var l=e.columnCount,s=e.width,u=Z("column",e,t,i),c=r+s,p=u.offset+u.size,m=t;m<l-1&&p<c;)m++,p+=Z("column",e,m,i).size;return m},getColumnWidth:function(e,t,r){return r.columnMetadataMap[t].size},getEstimatedTotalHeight:K,getEstimatedTotalWidth:j,getOffsetForColumnAndAlignment:function(e,t,r,i,l,s){return re("column",e,t,r,i,l,s)},getOffsetForRowAndAlignment:function(e,t,r,i,l,s){return re("row",e,t,r,i,l,s)},getRowOffset:function(e,t,r){return Z("row",e,t,r).offset},getRowHeight:function(e,t,r){return r.rowMetadataMap[t].size},getRowStartIndexForOffset:function(e,t,r){return se("row",e,r,t)},getRowStopIndexForStartIndex:function(e,t,r,i){for(var l=e.rowCount,s=e.height,u=Z("row",e,t,i),c=r+s,p=u.offset+u.size,m=t;m<l-1&&p<c;)m++,p+=Z("row",e,m,i).size;return m},initInstanceProps:function(e,t){var r=e,i=r.estimatedColumnWidth,l=r.estimatedRowHeight,s={columnMetadataMap:{},estimatedColumnWidth:i||G,estimatedRowHeight:l||G,lastMeasuredColumnIndex:-1,lastMeasuredRowIndex:-1,rowMetadataMap:{}};return t.resetAfterColumnIndex=function(u,c){c===void 0&&(c=!0),t.resetAfterIndices({columnIndex:u,shouldForceUpdate:c})},t.resetAfterRowIndex=function(u,c){c===void 0&&(c=!0),t.resetAfterIndices({rowIndex:u,shouldForceUpdate:c})},t.resetAfterIndices=function(u){var c=u.columnIndex,p=u.rowIndex,m=u.shouldForceUpdate,I=m===void 0?!0:m;typeof c=="number"&&(s.lastMeasuredColumnIndex=Math.min(s.lastMeasuredColumnIndex,c-1)),typeof p=="number"&&(s.lastMeasuredRowIndex=Math.min(s.lastMeasuredRowIndex,p-1)),t._getItemStyleCache(-1),I&&t.forceUpdate()},s},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(e){var t=e.columnWidth,r=e.rowHeight}}),Re=150,xe=function(e,t){return e},Ee=null,ve=null;function h(o){var e,t,r=o.getItemOffset,i=o.getEstimatedTotalSize,l=o.getItemSize,s=o.getOffsetForIndexAndAlignment,u=o.getStartIndexForOffset,c=o.getStopIndexForStartIndex,p=o.initInstanceProps,m=o.shouldResetStyleCacheOnItemSizeChange,I=o.validateProps;return t=e=function(g){(0,ge.Z)(A,g);function A(y){var a;return a=g.call(this,y)||this,a._instanceProps=p(a.props,(0,Q.Z)((0,Q.Z)(a))),a._outerRef=void 0,a._resetIsScrollingTimeoutId=null,a.state={instance:(0,Q.Z)((0,Q.Z)(a)),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof a.props.initialScrollOffset=="number"?a.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},a._callOnItemsRendered=void 0,a._callOnItemsRendered=N(function(w,C,R,T){return a.props.onItemsRendered({overscanStartIndex:w,overscanStopIndex:C,visibleStartIndex:R,visibleStopIndex:T})}),a._callOnScroll=void 0,a._callOnScroll=N(function(w,C,R){return a.props.onScroll({scrollDirection:w,scrollOffset:C,scrollUpdateWasRequested:R})}),a._getItemStyle=void 0,a._getItemStyle=function(w){var C=a.props,R=C.direction,T=C.itemSize,b=C.layout,n=a._getItemStyleCache(m&&T,m&&b,m&&R),f;if(n.hasOwnProperty(w))f=n[w];else{var d=r(a.props,w,a._instanceProps),S=l(a.props,w,a._instanceProps),x=R==="horizontal"||b==="horizontal",_=R==="rtl",W=x?d:0;n[w]=f={position:"absolute",left:_?void 0:W,right:_?W:void 0,top:x?0:d,height:x?"100%":S,width:x?S:"100%"}}return f},a._getItemStyleCache=void 0,a._getItemStyleCache=N(function(w,C,R){return{}}),a._onScrollHorizontal=function(w){var C=w.currentTarget,R=C.clientWidth,T=C.scrollLeft,b=C.scrollWidth;a.setState(function(n){if(n.scrollOffset===T)return null;var f=a.props.direction,d=T;if(f==="rtl")switch(_e()){case"negative":d=-T;break;case"positive-descending":d=b-R-T;break}return d=Math.max(0,Math.min(d,b-R)),{isScrolling:!0,scrollDirection:n.scrollOffset<T?"forward":"backward",scrollOffset:d,scrollUpdateWasRequested:!1}},a._resetIsScrollingDebounced)},a._onScrollVertical=function(w){var C=w.currentTarget,R=C.clientHeight,T=C.scrollHeight,b=C.scrollTop;a.setState(function(n){if(n.scrollOffset===b)return null;var f=Math.max(0,Math.min(b,T-R));return{isScrolling:!0,scrollDirection:n.scrollOffset<f?"forward":"backward",scrollOffset:f,scrollUpdateWasRequested:!1}},a._resetIsScrollingDebounced)},a._outerRefSetter=function(w){var C=a.props.outerRef;a._outerRef=w,typeof C=="function"?C(w):C!=null&&typeof C=="object"&&C.hasOwnProperty("current")&&(C.current=w)},a._resetIsScrollingDebounced=function(){a._resetIsScrollingTimeoutId!==null&&pe(a._resetIsScrollingTimeoutId),a._resetIsScrollingTimeoutId=be(a._resetIsScrolling,Re)},a._resetIsScrolling=function(){a._resetIsScrollingTimeoutId=null,a.setState({isScrolling:!1},function(){a._getItemStyleCache(-1,null)})},a}A.getDerivedStateFromProps=function(a,w){return H(a,w),I(a),null};var F=A.prototype;return F.scrollTo=function(a){a=Math.max(0,a),this.setState(function(w){return w.scrollOffset===a?null:{scrollDirection:w.scrollOffset<a?"forward":"backward",scrollOffset:a,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},F.scrollToItem=function(a,w){w===void 0&&(w="auto");var C=this.props.itemCount,R=this.state.scrollOffset;a=Math.max(0,Math.min(a,C-1)),this.scrollTo(s(this.props,a,w,R,this._instanceProps))},F.componentDidMount=function(){var a=this.props,w=a.direction,C=a.initialScrollOffset,R=a.layout;if(typeof C=="number"&&this._outerRef!=null){var T=this._outerRef;w==="horizontal"||R==="horizontal"?T.scrollLeft=C:T.scrollTop=C}this._callPropsCallbacks()},F.componentDidUpdate=function(){var a=this.props,w=a.direction,C=a.layout,R=this.state,T=R.scrollOffset,b=R.scrollUpdateWasRequested;if(b&&this._outerRef!=null){var n=this._outerRef;if(w==="horizontal"||C==="horizontal")if(w==="rtl")switch(_e()){case"negative":n.scrollLeft=-T;break;case"positive-ascending":n.scrollLeft=T;break;default:var f=n.clientWidth,d=n.scrollWidth;n.scrollLeft=d-f-T;break}else n.scrollLeft=T;else n.scrollTop=T}this._callPropsCallbacks()},F.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&pe(this._resetIsScrollingTimeoutId)},F.render=function(){var a=this.props,w=a.children,C=a.className,R=a.direction,T=a.height,b=a.innerRef,n=a.innerElementType,f=a.innerTagName,d=a.itemCount,S=a.itemData,x=a.itemKey,_=x===void 0?xe:x,W=a.layout,P=a.outerElementType,$=a.outerTagName,k=a.style,U=a.useIsScrolling,L=a.width,B=this.state.isScrolling,ee=R==="horizontal"||W==="horizontal",ue=ee?this._onScrollHorizontal:this._onScrollVertical,ie=this._getRangeToRender(),Ce=ie[0],ze=ie[1],Me=[];if(d>0)for(var me=Ce;me<=ze;me++)Me.push((0,V.createElement)(w,{data:S,key:_(me,S),index:me,isScrolling:U?B:void 0,style:this._getItemStyle(me)}));var ye=i(this.props,this._instanceProps);return(0,V.createElement)(P||$||"div",{className:C,onScroll:ue,ref:this._outerRefSetter,style:(0,oe.Z)({position:"relative",height:T,width:L,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:R},k)},(0,V.createElement)(n||f||"div",{children:Me,ref:b,style:{height:ee?"100%":ye,pointerEvents:B?"none":void 0,width:ee?ye:"100%"}}))},F._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var a=this.props.itemCount;if(a>0){var w=this._getRangeToRender(),C=w[0],R=w[1],T=w[2],b=w[3];this._callOnItemsRendered(C,R,T,b)}}if(typeof this.props.onScroll=="function"){var n=this.state,f=n.scrollDirection,d=n.scrollOffset,S=n.scrollUpdateWasRequested;this._callOnScroll(f,d,S)}},F._getRangeToRender=function(){var a=this.props,w=a.itemCount,C=a.overscanCount,R=this.state,T=R.isScrolling,b=R.scrollDirection,n=R.scrollOffset;if(w===0)return[0,0,0,0];var f=u(this.props,n,this._instanceProps),d=c(this.props,f,n,this._instanceProps),S=!T||b==="backward"?Math.max(1,C):1,x=!T||b==="forward"?Math.max(1,C):1;return[Math.max(0,f-S),Math.max(0,Math.min(w-1,d+x)),f,d]},A}(V.PureComponent),e.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var H=function(e,t){var r=e.children,i=e.direction,l=e.height,s=e.layout,u=e.innerTagName,c=e.outerTagName,p=e.width,m=t.instance;if(!1)var I},q=50,D=function(e,t,r){var i=e,l=i.itemSize,s=r.itemMetadataMap,u=r.lastMeasuredIndex;if(t>u){var c=0;if(u>=0){var p=s[u];c=p.offset+p.size}for(var m=u+1;m<=t;m++){var I=l(m);s[m]={offset:c,size:I},c+=I}r.lastMeasuredIndex=t}return s[t]},he=function(e,t,r){var i=t.itemMetadataMap,l=t.lastMeasuredIndex,s=l>0?i[l].offset:0;return s>=r?We(e,t,l,0,r):Pe(e,t,Math.max(0,l),r)},We=function(e,t,r,i,l){for(;i<=r;){var s=i+Math.floor((r-i)/2),u=D(e,s,t).offset;if(u===l)return s;u<l?i=s+1:u>l&&(r=s-1)}return i>0?i-1:0},Pe=function(e,t,r,i){for(var l=e.itemCount,s=1;r<l&&D(e,r,t).offset<i;)r+=s,s*=2;return We(e,t,Math.min(r,l-1),Math.floor(r/2),i)},Ne=function(e,t){var r=e.itemCount,i=t.itemMetadataMap,l=t.estimatedItemSize,s=t.lastMeasuredIndex,u=0;if(s>=r&&(s=r-1),s>=0){var c=i[s];u=c.offset+c.size}var p=r-s-1,m=p*l;return u+m},Ge=h({getItemOffset:function(e,t,r){return D(e,t,r).offset},getItemSize:function(e,t,r){return r.itemMetadataMap[t].size},getEstimatedTotalSize:Ne,getOffsetForIndexAndAlignment:function(e,t,r,i,l){var s=e.direction,u=e.height,c=e.layout,p=e.width,m=s==="horizontal"||c==="horizontal",I=m?p:u,g=D(e,t,l),A=Ne(e,l),F=Math.max(0,Math.min(A-I,g.offset)),y=Math.max(0,g.offset-I+g.size);switch(r==="smart"&&(i>=y-I&&i<=F+I?r="auto":r="center"),r){case"start":return F;case"end":return y;case"center":return Math.round(y+(F-y)/2);case"auto":default:return i>=y&&i<=F?i:i<y?y:F}},getStartIndexForOffset:function(e,t,r){return he(e,r,t)},getStopIndexForStartIndex:function(e,t,r,i){for(var l=e.direction,s=e.height,u=e.itemCount,c=e.layout,p=e.width,m=l==="horizontal"||c==="horizontal",I=m?p:s,g=D(e,t,i),A=r+I,F=g.offset+g.size,y=t;y<u-1&&F<A;)y++,F+=D(e,y,i).size;return y},initInstanceProps:function(e,t){var r=e,i=r.estimatedItemSize,l={itemMetadataMap:{},estimatedItemSize:i||q,lastMeasuredIndex:-1};return t.resetAfterIndex=function(s,u){u===void 0&&(u=!0),l.lastMeasuredIndex=Math.min(l.lastMeasuredIndex,s-1),t._getItemStyleCache(-1),u&&t.forceUpdate()},l},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(e){var t=e.itemSize}}),Je=te({getColumnOffset:function(e,t){var r=e.columnWidth;return t*r},getColumnWidth:function(e,t){var r=e.columnWidth;return r},getRowOffset:function(e,t){var r=e.rowHeight;return t*r},getRowHeight:function(e,t){var r=e.rowHeight;return r},getEstimatedTotalHeight:function(e){var t=e.rowCount,r=e.rowHeight;return r*t},getEstimatedTotalWidth:function(e){var t=e.columnCount,r=e.columnWidth;return r*t},getOffsetForColumnAndAlignment:function(e,t,r,i,l,s){var u=e.columnCount,c=e.columnWidth,p=e.width,m=Math.max(0,u*c-p),I=Math.min(m,t*c),g=Math.max(0,t*c-p+s+c);switch(r==="smart"&&(i>=g-p&&i<=I+p?r="auto":r="center"),r){case"start":return I;case"end":return g;case"center":var A=Math.round(g+(I-g)/2);return A<Math.ceil(p/2)?0:A>m+Math.floor(p/2)?m:A;case"auto":default:return i>=g&&i<=I?i:g>I||i<g?g:I}},getOffsetForRowAndAlignment:function(e,t,r,i,l,s){var u=e.rowHeight,c=e.height,p=e.rowCount,m=Math.max(0,p*u-c),I=Math.min(m,t*u),g=Math.max(0,t*u-c+s+u);switch(r==="smart"&&(i>=g-c&&i<=I+c?r="auto":r="center"),r){case"start":return I;case"end":return g;case"center":var A=Math.round(g+(I-g)/2);return A<Math.ceil(c/2)?0:A>m+Math.floor(c/2)?m:A;case"auto":default:return i>=g&&i<=I?i:g>I||i<g?g:I}},getColumnStartIndexForOffset:function(e,t){var r=e.columnWidth,i=e.columnCount;return Math.max(0,Math.min(i-1,Math.floor(t/r)))},getColumnStopIndexForStartIndex:function(e,t,r){var i=e.columnWidth,l=e.columnCount,s=e.width,u=t*i,c=Math.ceil((s+r-u)/i);return Math.max(0,Math.min(l-1,t+c-1))},getRowStartIndexForOffset:function(e,t){var r=e.rowHeight,i=e.rowCount;return Math.max(0,Math.min(i-1,Math.floor(t/r)))},getRowStopIndexForStartIndex:function(e,t,r){var i=e.rowHeight,l=e.rowCount,s=e.height,u=t*i,c=Math.ceil((s+r-u)/i);return Math.max(0,Math.min(l-1,t+c-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){var t=e.columnWidth,r=e.rowHeight}}),$e=h({getItemOffset:function(e,t){var r=e.itemSize;return t*r},getItemSize:function(e,t){var r=e.itemSize;return r},getEstimatedTotalSize:function(e){var t=e.itemCount,r=e.itemSize;return r*t},getOffsetForIndexAndAlignment:function(e,t,r,i){var l=e.direction,s=e.height,u=e.itemCount,c=e.itemSize,p=e.layout,m=e.width,I=l==="horizontal"||p==="horizontal",g=I?m:s,A=Math.max(0,u*c-g),F=Math.min(A,t*c),y=Math.max(0,t*c-g+c);switch(r==="smart"&&(i>=y-g&&i<=F+g?r="auto":r="center"),r){case"start":return F;case"end":return y;case"center":{var a=Math.round(y+(F-y)/2);return a<Math.ceil(g/2)?0:a>A+Math.floor(g/2)?A:a}case"auto":default:return i>=y&&i<=F?i:i<y?y:F}},getStartIndexForOffset:function(e,t){var r=e.itemCount,i=e.itemSize;return Math.max(0,Math.min(r-1,Math.floor(t/i)))},getStopIndexForStartIndex:function(e,t,r){var i=e.direction,l=e.height,s=e.itemCount,u=e.itemSize,c=e.layout,p=e.width,m=i==="horizontal"||c==="horizontal",I=t*u,g=m?p:l,A=Math.ceil((g+r-I)/u);return Math.max(0,Math.min(s-1,t+A-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){var t=e.itemSize}});function De(o,e){for(var t in o)if(!(t in e))return!0;for(var r in e)if(o[r]!==e[r])return!0;return!1}function qe(o,e){var t=o.style,r=_objectWithoutPropertiesLoose(o,["style"]),i=e.style,l=_objectWithoutPropertiesLoose(e,["style"]);return!De(t,i)&&!De(r,l)}function Qe(o,e){return!qe(this.props,o)||De(this.state,e)}},4903:function(He,Ie,J){J.d(Ie,{Z:function(){return oe}});function oe({onlyFirst:ge=!1}={}){const Q=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(Q,ge?void 0:"g")}}}]);})();
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=5011.c8e98520.chunk.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[6650],{76650:function(l,e,t){t.r(e),t.d(e,{CatalogEntityPage:function(){return d}});var n=t(2784),a=t(10289),c=t(31423);function d(){return n.createElement(c.AsyncEntityProvider,{...(0,c.useEntityFromUrl)()},n.createElement(a.j3,null))}}}]);})();
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=6650.7b3bb14a.chunk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://techdocs-cli-embedded-app/../node_modules/@sucrase/webpack-loader/dist/plugins/catalog/src/components/CatalogEntityPage/CatalogEntityPage.tsx"],"names":[],"mappings":"8OAwBO,YAA6B,CAClC,MACE,iBAAoB,sBAAqB,IAAK,0BAC1C,gBAAoB,KAAQ","file":"static/6650.7b3bb14a.chunk.js","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 React from 'react';\nimport { Outlet } from 'react-router';\nimport {\n useEntityFromUrl,\n AsyncEntityProvider,\n} from '@backstage/plugin-catalog-react';\n\n/** @public */\nexport function CatalogEntityPage() {\n return (\n React.createElement(AsyncEntityProvider, { ...useEntityFromUrl(),}\n , React.createElement(Outlet, null )\n )\n );\n}\n"],"sourceRoot":""}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[7758],{7758:function(h,r,t){t.r(r),t.d(r,{CatalogPage:function(){return f},DefaultCatalogPage:function(){return i}});var e=t(2784),E=t(10289),l=t(9118),a=t(36964),n=t(31423),g=t(47851),d=t(91730),o=t(26997),C=t(49782);function i(c){var s;const{columns:u,actions:y,initiallySelectedFilter:P="owned"}=c,v=(s=(0,a.useApi)(a.configApiRef).getOptionalString("organization.name"))!=null?s:"Backstage",m=(0,a.useRouteRef)(g.y);return e.createElement(l.PageWithHeader,{title:`${v} Catalog`,themeId:"home"},e.createElement(n.EntityListProvider,null,e.createElement(l.Content,null,e.createElement(l.ContentHeader,{titleComponent:e.createElement(C.K,null)},e.createElement(l.CreateButton,{title:"Create Component",to:m&&m()}),e.createElement(l.SupportButton,null,"All your software catalog entities")),e.createElement(o.q7,null,e.createElement(o.Gh,null,e.createElement(n.EntityTypePicker,null),e.createElement(n.UserListPicker,{initialFilter:P}),e.createElement(n.EntityOwnerPicker,null),e.createElement(n.EntityLifecyclePicker,null),e.createElement(n.EntityTagPicker,null)),e.createElement(o.Nz,null,e.createElement(d.E,{columns:u,actions:y}))))))}function f(c){return(0,E.pC)()||e.createElement(i,{...c})}}}]);})();
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=7758.2b30237f.chunk.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";(()=>{var ue=Object.defineProperty;var de=(k,m,c)=>m in k?ue(k,m,{enumerable:!0,configurable:!0,writable:!0,value:c}):k[m]=c;var y=(k,m,c)=>(de(k,typeof m!="symbol"?m+"":m,c),c);(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[8718],{98718:function(k,m,c){c.r(m),c.d(m,{RealLogViewer:function(){return ae}});var a=c(2784),S=c(61837),V=c(19353),w=c(7688),U=c(8301),W=c(4903);const L=(0,W.Z)(),E=/\n\r?/g,C=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 Z{constructor(t=1,n=[]){y(this,"text");this.lineNumber=t,this.chunks=n,this.text=n.map(s=>s.text).join("").toLocaleLowerCase("en-US")}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"))}}class D{constructor(){y(this,"text","");y(this,"lines",[]);y(this,"processLines",(t,n={},s=1)=>{var r;const o=[];let i=n,l=s,u=0;for(E.lastIndex=0;;){const f=E.exec(t);if(!f){const g=this.processText(t.slice(u),i);return o.push(new Z(l,g)),o}const d=t.slice(u,f.index);u=f.index+f[0].length;const x=this.processText(d,i);o.push(new Z(l,x)),i=(r=x[x.length-1].modifiers)!=null?r:i,l+=1}});y(this,"processText",(t,n)=>{const s=[];let o=n,i=0;for(L.lastIndex=0;;){const l=L.exec(t);if(!l)return s.push({text:t.slice(i),modifiers:o}),s;const u=t.slice(i,l.index);s.push({text:u,modifiers:o}),i=l.index+l[0].length,o=this.processCode(l[0],o)}});y(this,"processCode",(t,n)=>{var s,o;return(o=(s=C[t])==null?void 0:s.call(C,n))!=null?o:n})}process(t){var n,s,o;if(this.text===t)return this.lines;if(t.startsWith(this.text)){const i=this.lines.length>0?this.lines.length-1:0,l=(n=this.lines[i])!=null?n:new Z,u=l.lastChunk(),r=this.processLines(((s=u==null?void 0:u.text)!=null?s:"")+t.slice(this.text.length),u==null?void 0:u.modifiers,l==null?void 0:l.lineNumber);l.replaceLastChunk((o=r[0])==null?void 0:o.chunks),this.lines[i]=l,this.lines.push(...r.slice(1))}else this.lines=this.processLines(t);return this.text=t,this.lines}}var G=c(79692),I=c(41128),v=c(31754),B=c(66054),F=c(81463),R=c(34505),M=c(57186),N=c(32720),A=c(92901),T=c(45410);const j=40,P=(0,G.Z)(e=>({root:{background:e.palette.background.paper},header:{height:j,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,I.Fq)(e.palette.info.main,.15)},textSelectedHighlight:{background:(0,I.Fq)(e.palette.info.main,.4)},modifierBold:{fontWeight:e.typography.fontWeightBold},modifierItalic:{fontStyle:"italic"},modifierUnderline:{textDecoration:"underline"},modifierForegroundBlack:{color:v.Z.black},modifierForegroundRed:{color:B.Z[500]},modifierForegroundGreen:{color:F.Z[500]},modifierForegroundYellow:{color:R.Z[500]},modifierForegroundBlue:{color:M.Z[500]},modifierForegroundMagenta:{color:N.Z[500]},modifierForegroundCyan:{color:A.Z[500]},modifierForegroundWhite:{color:v.Z.white},modifierForegroundGrey:{color:T.Z[500]},modifierBackgroundBlack:{background:v.Z.black},modifierBackgroundRed:{background:B.Z[500]},modifierBackgroundGreen:{background:F.Z[500]},modifierBackgroundYellow:{background:R.Z[500]},modifierBackgroundBlue:{background:M.Z[500]},modifierBackgroundMagenta:{background:N.Z[500]},modifierBackgroundCyan:{background:A.Z[500]},modifierBackgroundWhite:{background:v.Z.white},modifierBackgroundGrey:{background:T.Z[500]}}),{name:"BackstageLogViewer"});var $=c(72779),z=c.n($),Y=c(74600),K=c.n(Y);function J(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${K()(t.foreground)}`;n.push(e[s])}if(t.background){const s=`modifierBackground${K()(t.background)}`;n.push(e[s])}return n.length>0?n.join(" "):void 0}function Q(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 i=o+t.length;n.push({start:o,end:i}),s=i}return n}function X(e,t){const n=Q(e.text,t);if(!n)return e.chunks;const s=new Array;let o=0,i=0,l=n[i];for(const u of e.chunks){const{text:r,modifiers:f}=u;if(!l||o+r.length<l.start){s.push(u),o+=r.length;continue}let d=0;for(;l;){const g=Math.max(l.start-o,0);if(g>r.length)break;const p=Math.min(l.end-o,r.length);if(g>d&&s.push({text:r.slice(d,g),modifiers:f}),p>g&&s.push({modifiers:f,highlight:i,text:r.slice(g,p)}),d=p,l.end-o===p)i+=1,l=n[i];else break}d<r.length&&s.push({text:r.slice(d),modifiers:f}),o+=r.length}return s}function q({line:e,classes:t,searchText:n,highlightResultIndex:s}){const o=(0,a.useMemo)(()=>X(e,n),[e,n]),i=(0,a.useMemo)(()=>o.map(({text:l,modifiers:u,highlight:r},f)=>a.createElement("span",{key:f,className:z()(J(t,u),r!==void 0&&(r===s?t.textSelectedHighlight:t.textHighlight))},l)),[o,s,t]);return a.createElement(a.Fragment,null,i)}var _=c(86619),ee=c(90436),te=c(48049),ne=c(51209),O=c(36444);function oe(e){var l;const{resultCount:t,resultIndexStep:n,toggleShouldFilter:s}=e,o=(l=e.resultIndex)!=null?l:0,i=u=>{u.key==="Enter"&&(u.metaKey||u.ctrlKey||u.altKey?s():n(u.shiftKey))};return a.createElement(a.Fragment,null,t!==void 0&&a.createElement(a.Fragment,null,a.createElement(S.Z,{size:"small",onClick:()=>n(!0)},a.createElement(te.Z,null)),a.createElement(ee.Z,null,Math.min(o+1,t),"/",t),a.createElement(S.Z,{size:"small",onClick:()=>n()},a.createElement(ne.Z,null))),a.createElement(_.Z,{size:"small",variant:"standard",placeholder:"Search",value:e.searchInput,onKeyPress:i,onChange:u=>e.setSearchInput(u.target.value)}),a.createElement(S.Z,{size:"small",onClick:s},e.shouldFilter?a.createElement(O.Z,{color:"primary"}):a.createElement(O.Z,{color:"disabled"})))}var re=c(3509);function se(e,t){if(!t)return{lines:e};const n=[],s=[];for(const o of e)if(o.text.includes(t)){n.push(o);let i=0,l=0;for(;;){const u=o.text.indexOf(t,i);if(u===-1)break;s.push({lineNumber:o.lineNumber,lineIndex:l++}),i=u+t.length}}return{lines:n,results:s}}function le(e){var g;const[t,n]=(0,a.useState)(""),s=t.toLocaleLowerCase("en-US"),[o,i]=(0,a.useState)(0),[l,u]=(0,re.O)(!1),r=(0,a.useMemo)(()=>se(e,s),[e,s]),f=r.results?r.results[Math.min(o,r.results.length-1)]:void 0,d=(g=r.results)==null?void 0:g.length,x=p=>{if(p){if(d!==void 0){const h=Math.min(o-1,d-2);i(h<0?d-1:h)}}else if(d!==void 0){const h=o+1;i(h>=d?0:h)}};return{lines:l?r.lines:e,searchText:s,searchInput:t,setSearchInput:n,shouldFilter:l,toggleShouldFilter:u,resultCount:d,resultIndex:o,resultIndexStep:x,resultLine:f==null?void 0:f.lineNumber,resultLineIndex:f==null?void 0:f.lineIndex}}var H=c(36964),ie=c(55295);function ce(e){const t=(0,H.useApi)(H.errorApiRef),[n,s]=(0,a.useState)(),o=n?Math.min(n.start,n.end):void 0,i=n?Math.max(n.start,n.end):void 0,[{error:l},u]=(0,ie.Z)();return(0,a.useEffect)(()=>{l&&t.post(l)},[l,t]),{shouldShowButton(r){return o===r||i===r},isSelected(r){return n?o<=r&&r<=i:!1},setSelection(r,f){s(f?d=>d?{start:d.start,end:r}:{start:r,end:r}:d=>(d==null?void 0:d.start)===r&&(d==null?void 0:d.end)===r?void 0:{start:r,end:r})},copySelection(){if(n){const r=e.slice(Math.min(n.start,n.end)-1,Math.max(n.start,n.end)).map(f=>f.chunks.map(d=>d.text).join("")).join(`
|
|
2
|
-
`);u(r),s(void 0)}}}}function ae(e){const t=P({classes:e.classes}),n=(0,a.useRef)(null),o=(0,a.useMemo)(()=>new D,[]).process(e.text),i=le(o),l=ce(o);(0,a.useEffect)(()=>{i.resultLine!==void 0&&n.current&&n.current.scrollToItem(i.resultLine-1,"center")},[i.resultLine]);const u=(r,f)=>{f.preventDefault(),l.setSelection(r,f.shiftKey)};return a.createElement(w.Z,null,({height:r,width:f})=>a.createElement("div",{style:{width:f,height:r},className:t.root},a.createElement("div",{className:t.header},a.createElement(oe,{...i})),a.createElement(U.t7,{ref:n,className:t.log,height:r-j,width:f,itemData:i.lines,itemSize:20,itemCount:i.lines.length},({index:d,style:x,data:g})=>{const p=g[d],{lineNumber:h}=p;return a.createElement("div",{style:{...x},className:z()(t.line,{[t.lineSelected]:l.isSelected(h)})},l.shouldShowButton(h)&&a.createElement(S.Z,{"data-testid":"copy-button",size:"small",className:t.lineCopyButton,onClick:()=>l.copySelection()},a.createElement(V.Z,{fontSize:"inherit"})),a.createElement("a",{role:"row",target:"_self",href:`#line-${h}`,className:t.lineNumber,onClick:b=>u(h,b),onKeyPress:b=>u(h,b)},h),a.createElement(q,{line:p,classes:t,searchText:i.searchText,highlightResultIndex:i.resultLine===h?i.resultLineIndex:void 0}))})))}}}]);})();
|
|
3
|
-
|
|
4
|
-
//# sourceMappingURL=8718.34386313.chunk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/AnsiProcessor.ts","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/styles.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/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"],"names":[],"mappings":"qbAkBA,KAAM,GAAY,UACZ,EAAe,SAGf,EAAgB,OAAO,YAC3B,OAAO,QAAQ,CACb,EAAG,GAAM,KAAK,EAAG,KAAM,KACvB,EAAG,GAAM,KAAK,EAAG,OAAQ,KACzB,EAAG,GAAM,KAAK,EAAG,UAAW,KAC5B,GAAI,CAAC,CAAE,KAAM,KAAM,KAAQ,EAC3B,GAAI,CAAC,CAAE,OAAQ,KAAM,KAAQ,EAC7B,GAAI,CAAC,CAAE,UAAW,KAAM,KAAQ,EAChC,GAAI,GAAM,KAAK,EAAG,WAAY,UAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,QAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,UAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,WAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,SAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,YAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,SAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,UAC9B,GAAI,CAAC,CAAE,WAAY,KAAM,KAAQ,EACjC,GAAI,GAAM,KAAK,EAAG,WAAY,SAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,UAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,QAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,UAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,WAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,SAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,YAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,SAC9B,GAAI,GAAM,KAAK,EAAG,WAAY,UAC9B,GAAI,CAAC,CAAE,WAAY,KAAM,KAAQ,IAC/B,IACF,CAAC,CAAC,EAAM,KAA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KAAM,MACN,OAAQ,QACR,KAAM,SAAS,IACf,UAAW,EAAQ,WACnB,QAAS,GAAS,EAAiB,EAAY,GAC/C,WAAY,GAAS,EAAiB,EAAY,IAEhD,GAEF,gBAAoB,EAAS,CAC7B,KAAM,EACN,QAAS,EACT,WAAY,EAAO,WACnB,qBACE,EAAO,aAAe,EAClB,EAAO,gBACP","file":"static/8718.34386313.chunk.js","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 } ).map(\n ([code, modifier]) => [`\\x1b[${code}m`, modifier],\n ),\n);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nexport class AnsiLine {\n text;\n\n constructor(\n lineNumber = 1,\n chunks = [],\n ) {;this.lineNumber = lineNumber;this.chunks = chunks;\n this.text = chunks\n .map(c => c.text)\n .join('')\n .toLocaleLowerCase('en-US');\n }\n\n lastChunk() {\n return this.chunks[this.chunks.length - 1];\n }\n\n replaceLastChunk(newChunks) {\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 text = '';\n lines = [];\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) {\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 processLines = (\n text,\n modifiers = {},\n startingLineNumber = 1,\n ) => {\n const lines = [];\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 processText = (\n fullText,\n modifiers,\n ) => {\n const chunks = [];\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 processCode = (\n code,\n modifiers,\n ) => {\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 { 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 */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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 React, { useMemo } from 'react';\n\nimport startCase from 'lodash/startCase';\nimport classnames from 'classnames';\n\n\nexport function getModifierClasses(\n classes,\n modifiers,\n) {\n const classNames = new Array();\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 )}` ;\n classNames.push(classes[key]);\n }\n if (modifiers.background) {\n const key = `modifierBackground${startCase(\n modifiers.background,\n )}` ;\n classNames.push(classes[key]);\n }\n return classNames.length > 0 ? classNames.join(' ') : undefined;\n}\n\nexport function findSearchResults(text, searchText) {\n if (!searchText || !text.includes(searchText)) {\n return undefined;\n }\n const searchResults = new Array();\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\n\n\n\n\nexport function calculateHighlightedChunks(\n line,\n searchText,\n) {\n const results = findSearchResults(line.text, searchText);\n if (!results) {\n return line.chunks;\n }\n\n const chunks = new Array();\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\n\n\n\n\n\n\n\nexport function LogLine({\n line,\n classes,\n searchText,\n highlightResultIndex,\n}) {\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 React.createElement('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 )\n )),\n [chunks, highlightResultIndex, classes],\n );\n\n return React.createElement(React.Fragment, null, 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';\n\n\n\n\nexport function LogViewerControls(props) {\n const { resultCount, resultIndexStep, toggleShouldFilter } = props;\n const resultIndex = props.resultIndex ?? 0;\n\n const handleKeyPress = (event) => {\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 React.createElement(React.Fragment, null\n , resultCount !== undefined && (\n React.createElement(React.Fragment, null\n , React.createElement(IconButton, { size: \"small\", onClick: () => resultIndexStep(true),}\n , React.createElement(ChevronLeftIcon, null )\n )\n , React.createElement(Typography, null\n , Math.min(resultIndex + 1, resultCount), \"/\", resultCount\n )\n , React.createElement(IconButton, { size: \"small\", onClick: () => resultIndexStep(),}\n , React.createElement(ChevronRightIcon, null )\n )\n )\n )\n , React.createElement(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 , React.createElement(IconButton, { size: \"small\", onClick: toggleShouldFilter,}\n , props.shouldFilter ? (\n React.createElement(FilterListIcon, { color: \"primary\",} )\n ) : (\n React.createElement(FilterListIcon, { color: \"disabled\",} )\n )\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 */\n\nimport { useMemo, useState } from 'react';\nimport { useToggle } from '@react-hookz/web';\n\n\nexport function applySearchFilter(lines, searchText) {\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nexport function useLogViewerSearch(lines) {\n const [searchInput, setSearchInput] = useState('');\n const searchText = searchInput.toLocaleLowerCase('en-US');\n\n const [resultIndex, setResultIndex] = useState(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) => {\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';\n\n\nexport function useLogViewerSelection(lines) {\n const errorApi = useApi(errorApiRef);\n const [sel, setSelection] = useState();\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) {\n return start === line || end === line;\n },\n isSelected(line) {\n if (!sel) {\n return false;\n }\n return start <= line && line <= end;\n },\n setSelection(line, add) {\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 */\n\nimport React, { useEffect, useMemo, useRef } from 'react';\nimport IconButton from '@material-ui/core/IconButton';\nimport CopyIcon from '@material-ui/icons/FileCopy';\nimport AutoSizer from 'react-virtualized-auto-sizer';\nimport { FixedSizeList } from 'react-window';\nimport { AnsiProcessor } from './AnsiProcessor';\nimport { HEADER_SIZE, useStyles } from './styles';\nimport classnames from 'classnames';\nimport { LogLine } from './LogLine';\nimport { LogViewerControls } from './LogViewerControls';\nimport { useLogViewerSearch } from './useLogViewerSearch';\nimport { useLogViewerSelection } from './useLogViewerSelection';\n\n\n\n\n\n\nexport function RealLogViewer(props) {\n const classes = useStyles({ classes: props.classes });\n const listRef = useRef(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\n useEffect(() => {\n if (search.resultLine !== undefined && listRef.current) {\n listRef.current.scrollToItem(search.resultLine - 1, 'center');\n }\n }, [search.resultLine]);\n\n const handleSelectLine = (\n line,\n event,\n ) => {\n event.preventDefault();\n selection.setSelection(line, event.shiftKey);\n };\n\n return (\n React.createElement(AutoSizer, null\n , ({ height, width }) => (\n React.createElement('div', { style: { width, height }, className: classes.root,}\n , React.createElement('div', { className: classes.header,}\n , React.createElement(LogViewerControls, { ...search,} )\n )\n , React.createElement(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 React.createElement('div', {\n style: { ...style },\n className: classnames(classes.line, {\n [classes.lineSelected]: selection.isSelected(lineNumber),\n }),}\n \n , selection.shouldShowButton(lineNumber) && (\n React.createElement(IconButton, {\n 'data-testid': \"copy-button\",\n size: \"small\",\n className: classes.lineCopyButton,\n onClick: () => selection.copySelection(),}\n \n , React.createElement(CopyIcon, { fontSize: \"inherit\",} )\n )\n )\n , React.createElement('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 )\n , React.createElement(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 )\n );\n }\n )\n )\n )\n )\n );\n}\n"],"sourceRoot":""}
|