@backstage/plugin-techdocs-backend 2.4.0-next.2 → 2.4.1-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 CHANGED
@@ -1,5 +1,39 @@
1
1
  # @backstage/plugin-techdocs-backend
2
2
 
3
+ ## 2.4.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 4d7a3fe: Clarified in the config schema which `techdocs.generator.mkdocs` settings also apply to the Zensical engine: `legacyCopyReadmeMdToIndexMd`, `dangerouslyAllowAdditionalKeys` and `dangerouslyAllowAdditionalPlugins`.
8
+ - Updated dependencies
9
+ - @backstage/plugin-techdocs-node@2.2.0-next.0
10
+ - @backstage/backend-plugin-api@1.11.1-next.0
11
+ - @backstage/plugin-catalog-node@2.2.7-next.0
12
+
13
+ ## 2.4.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 4d4f987: Add engine abstraction layer for multi-engine TechDocs support. Introduces `--engine` flag, engine config map, generator registry with `backstage.io/techdocs-engine` annotation support, `engine` field in `techdocs_metadata.json`, `serve:raw` command, and live-reload adapter interface. MkDocs remains the default with no behavior change.
18
+
19
+ The built-in generator is now registered under `mkdocs`; the previous `techdocs` key is kept as an alias, so existing `generators.register('techdocs', ...)` calls continue to work. The CLI's `--engine` flag takes precedence over the `backstage.io/techdocs-engine` annotation for all commands, and `serve:mkdocs` and the `--mkdocs-parameter-*` flags now print deprecation warnings.
20
+
21
+ - 45b0b89: Added a `get-techdocs-metadata` action to the TechDocs backend plugin, registered with the Actions Registry Service (alpha).
22
+
23
+ ### Patch Changes
24
+
25
+ - 685aee1: Fixed TechDocs asset caching on reused HTTP connections to avoid listener leaks and cross-request response corruption. Existing cached assets are refreshed automatically.
26
+ - Updated dependencies
27
+ - @backstage/integration@2.1.3
28
+ - @backstage/backend-plugin-api@1.11.0
29
+ - @backstage/plugin-techdocs-node@2.1.0
30
+ - @backstage/catalog-client@1.16.3
31
+ - @backstage/config@1.3.10
32
+ - @backstage/errors@1.3.2
33
+ - @backstage/plugin-techdocs-common@0.1.2
34
+ - @backstage/catalog-model@1.10.2
35
+ - @backstage/plugin-catalog-node@2.2.6
36
+
3
37
  ## 2.4.0-next.2
4
38
 
5
39
  ### Minor Changes
@@ -62,12 +62,16 @@
62
62
  "description": "Credentials for private registries",
63
63
  "visibility": "secret"
64
64
  },
65
+ "defaultEngine": {
66
+ "type": "string",
67
+ "description": "Defines the default document generation engine behind TechDocs, used for entities without a backstage.io/techdocs-engine annotation. Must match a registered generator. Defaults to \"mkdocs\"."
68
+ },
65
69
  "mkdocs": {
66
70
  "type": "object",
67
71
  "properties": {
68
72
  "legacyCopyReadmeMdToIndexMd": {
69
73
  "type": "boolean",
70
- "description": "(Optional and not recommended) Configures the techdocs generator to attempt to ensure an index.md exists falling back to using <docs-dir>/README.md or README.md in case a default <docs-dir>/index.md is not provided. Note that https://www.mkdocs.org/user-guide/configuration/#edit_uri behavior will be broken in these scenarios."
74
+ "description": "(Optional and not recommended) Configures the techdocs generator to attempt to ensure an index.md exists falling back to using <docs-dir>/README.md or README.md in case a default <docs-dir>/index.md is not provided. Note that https://www.mkdocs.org/user-guide/configuration/#edit_uri behavior will be broken in these scenarios.\n\nAlso applies to the Zensical engine."
71
75
  },
72
76
  "defaultPlugins": {
73
77
  "type": "array",
@@ -81,21 +85,21 @@
81
85
  "items": {
82
86
  "type": "string"
83
87
  },
84
- "description": "List of additional MkDocs configuration keys to allow beyond the default safe allowlist. This can introduce security vulnerabilities.\n\nWARNING: Some MkDocs configuration keys can execute arbitrary code. For example, the 'hooks' key allows running arbitrary Python code during documentation generation. Only use this in trusted environments where all mkdocs.yml files are audited."
88
+ "description": "List of additional MkDocs configuration keys to allow beyond the default safe allowlist. This can introduce security vulnerabilities.\n\nWARNING: Some MkDocs configuration keys can execute arbitrary code. For example, the 'hooks' key allows running arbitrary Python code during documentation generation. Only use this in trusted environments where all mkdocs.yml files are audited.\n\nAlso applies to the Zensical engine, which reads the same mkdocs.yml, so this configuration will affect both."
85
89
  },
86
90
  "dangerouslyAllowAdditionalPlugins": {
87
91
  "type": "array",
88
92
  "items": {
89
93
  "type": "string"
90
94
  },
91
- "description": "List of additional MkDocs plugins to allow beyond the default set. Plugins not in this list or the default set will be removed from mkdocs.yml before documentation generation.\n\nWARNING: Some MkDocs plugins can make outbound HTTP requests or execute arbitrary code during documentation generation. Only allow plugins that have been audited for use in your environment, including the configuration options that documentation authors can supply."
95
+ "description": "List of additional MkDocs plugins to allow beyond the default set. Plugins not in this list or the default set will be removed from mkdocs.yml before documentation generation.\n\nWARNING: Some MkDocs plugins can make outbound HTTP requests or execute arbitrary code during documentation generation. Only allow plugins that have been audited for use in your environment, including the configuration options that documentation authors can supply.\n\nAlso applies to the Zensical engine, which reads the same mkdocs.yml, so this configuration will affect both."
92
96
  },
93
97
  "disableExternalFonts": {
94
98
  "type": "boolean",
95
99
  "description": "Disable external fonts for all TechDocs sites. If not set, the default value is false. If set to true, the external font will be disabled for all TechDocs sites. If set to false, the external font will be enabled for all TechDocs sites."
96
100
  }
97
101
  },
98
- "description": "Override behavior specific to mkdocs."
102
+ "description": "Override behavior for mkdocs.yml-based builds. Unless noted otherwise, these settings apply to the MkDocs engine only."
99
103
  }
100
104
  },
101
105
  "required": [
@@ -27,12 +27,26 @@ const techdocsPlugin = backendPluginApi.createBackendPlugin({
27
27
  }
28
28
  });
29
29
  let customTechdocsGenerator;
30
+ const customGenerators = /* @__PURE__ */ new Map();
30
31
  env.registerExtensionPoint(pluginTechdocsNode.techdocsGeneratorExtensionPoint, {
31
32
  setTechdocsGenerator(generator) {
32
33
  if (customTechdocsGenerator) {
33
34
  throw new Error("TechdocsGenerator may only be set once");
34
35
  }
35
36
  customTechdocsGenerator = generator;
37
+ },
38
+ registerGenerator(key, generator) {
39
+ if (key === "mkdocs" || key === "techdocs") {
40
+ throw new Error(
41
+ `Cannot register a generator for the built-in "${key}" engine; use setTechdocsGenerator to replace the default MkDocs generator`
42
+ );
43
+ }
44
+ if (customGenerators.has(key)) {
45
+ throw new Error(
46
+ `Generator for engine "${key}" is already registered`
47
+ );
48
+ }
49
+ customGenerators.set(key, generator);
36
50
  }
37
51
  });
38
52
  const customPreparers = /* @__PURE__ */ new Map();
@@ -95,6 +109,20 @@ const techdocsPlugin = backendPluginApi.createBackendPlugin({
95
109
  logger,
96
110
  customGenerator: customTechdocsGenerator
97
111
  });
112
+ for (const [key, generator] of customGenerators.entries()) {
113
+ generators.register(key, generator);
114
+ }
115
+ const defaultEngine = config.getOptionalString("techdocs.generator.defaultEngine") ?? "mkdocs";
116
+ const registeredEngines = [
117
+ "mkdocs",
118
+ "techdocs",
119
+ ...customGenerators.keys()
120
+ ];
121
+ if (!registeredEngines.includes(defaultEngine)) {
122
+ logger.warn(
123
+ `techdocs.generator.defaultEngine is set to "${defaultEngine}", but no generator is registered for it. Builds for entities without a backstage.io/techdocs-engine annotation will fail. Install the backend module that provides this engine.`
124
+ );
125
+ }
98
126
  const publisher = await pluginTechdocsNode.Publisher.fromConfig(config, {
99
127
  logger,
100
128
  discovery,
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { actionsRegistryServiceRef } from '@backstage/backend-plugin-api/alpha';\nimport {\n DocsBuildStrategy,\n Generators,\n PreparerBase,\n Preparers,\n Publisher,\n PublisherBase,\n PublisherSettings,\n PublisherType,\n RemoteProtocol,\n techdocsBuildsExtensionPoint,\n TechdocsGenerator,\n techdocsGeneratorExtensionPoint,\n techdocsPreparerExtensionPoint,\n techdocsPublisherExtensionPoint,\n} from '@backstage/plugin-techdocs-node';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node';\nimport * as winston from 'winston';\nimport { createRouter } from './service/router';\nimport { createTechdocsActions } from './actions';\n\n/**\n * The TechDocs plugin is responsible for serving and building documentation for any entity.\n * @public\n */\nexport const techdocsPlugin = createBackendPlugin({\n pluginId: 'techdocs',\n register(env) {\n let docsBuildStrategy: DocsBuildStrategy | undefined;\n let buildLogTransport: winston.transport | undefined;\n env.registerExtensionPoint(techdocsBuildsExtensionPoint, {\n setBuildStrategy(buildStrategy: DocsBuildStrategy) {\n if (docsBuildStrategy) {\n throw new Error('DocsBuildStrategy may only be set once');\n }\n docsBuildStrategy = buildStrategy;\n },\n setBuildLogTransport(transport: winston.transport) {\n if (buildLogTransport) {\n throw new Error('BuildLogTransport may only be set once');\n }\n buildLogTransport = transport;\n },\n });\n\n let customTechdocsGenerator: TechdocsGenerator | undefined;\n env.registerExtensionPoint(techdocsGeneratorExtensionPoint, {\n setTechdocsGenerator(generator: TechdocsGenerator) {\n if (customTechdocsGenerator) {\n throw new Error('TechdocsGenerator may only be set once');\n }\n\n customTechdocsGenerator = generator;\n },\n });\n\n const customPreparers = new Map<RemoteProtocol, PreparerBase>();\n env.registerExtensionPoint(techdocsPreparerExtensionPoint, {\n registerPreparer(protocol: RemoteProtocol, preparer: PreparerBase) {\n if (customPreparers.has(protocol)) {\n throw new Error(\n `Preparer for protocol ${protocol} is already registered`,\n );\n }\n customPreparers.set(protocol, preparer);\n },\n });\n\n let customTechdocsPublisher: PublisherBase | undefined;\n const publisherSettings: PublisherSettings = {};\n env.registerExtensionPoint(techdocsPublisherExtensionPoint, {\n registerPublisher(type: PublisherType, publisher: PublisherBase) {\n if (customTechdocsPublisher) {\n throw new Error(`Publisher for type ${type} is already registered`);\n }\n customTechdocsPublisher = publisher;\n },\n registerPublisherSettings<T extends keyof PublisherSettings>(\n publisher: T,\n settings: PublisherSettings[T],\n ) {\n publisherSettings[publisher] = settings;\n },\n });\n\n env.registerInit({\n deps: {\n config: coreServices.rootConfig,\n logger: coreServices.logger,\n urlReader: coreServices.urlReader,\n http: coreServices.httpRouter,\n discovery: coreServices.discovery,\n cache: coreServices.cache,\n httpAuth: coreServices.httpAuth,\n auth: coreServices.auth,\n catalog: catalogServiceRef,\n actionsRegistry: actionsRegistryServiceRef,\n },\n async init({\n config,\n logger,\n urlReader,\n http,\n discovery,\n cache,\n httpAuth,\n auth,\n catalog,\n actionsRegistry,\n }) {\n // Preparers are responsible for fetching source files for documentation.\n const preparers = await Preparers.fromConfig(config, {\n reader: urlReader,\n logger: logger,\n });\n for (const [protocol, preparer] of customPreparers.entries()) {\n preparers.register(protocol, preparer);\n }\n\n // Generators are used for generating documentation sites.\n const generators = await Generators.fromConfig(config, {\n logger: logger,\n customGenerator: customTechdocsGenerator,\n });\n\n // Publisher is used for\n // 1. Publishing generated files to storage\n // 2. Fetching files from storage and passing them to TechDocs frontend.\n const publisher = await Publisher.fromConfig(config, {\n logger: logger,\n discovery: discovery,\n customPublisher: customTechdocsPublisher,\n publisherSettings,\n });\n\n // checks if the publisher is working and logs the result\n await publisher.getReadiness();\n\n http.use(\n await createRouter({\n logger: logger,\n cache,\n docsBuildStrategy,\n buildLogTransport,\n preparers,\n generators,\n publisher,\n config,\n discovery,\n httpAuth,\n auth,\n catalog,\n }),\n );\n\n http.addAuthPolicy({\n path: '/static',\n allow: 'user-cookie',\n });\n\n // Register MCP actions for techdocs\n createTechdocsActions({\n actionsRegistry,\n auth,\n discovery,\n });\n },\n });\n },\n});\n"],"names":["createBackendPlugin","techdocsBuildsExtensionPoint","techdocsGeneratorExtensionPoint","techdocsPreparerExtensionPoint","techdocsPublisherExtensionPoint","coreServices","catalogServiceRef","actionsRegistryServiceRef","Preparers","Generators","Publisher","createRouter","createTechdocsActions"],"mappings":";;;;;;;;;AA8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AAQ,CAAA,IAAK,eAAA,CAAgB,SAAQ,EAAG;AAC5D,UAAA,SAAA,CAAU,QAAA,CAAS,UAAU,QAAQ,CAAA;AAAA,QACvC;AAGA,QAAA,MAAM,UAAA,GAAa,MAAMC,6BAAA,CAAW,UAAA,CAAW,MAAA,EAAQ;AAAA,UACrD,MAAA;AAAA,UACA,eAAA,EAAiB;AAAA,SAClB,CAAA;AAKD,QAAA,MAAM,SAAA,GAAY,MAAMC,4BAAA,CAAU,UAAA,CAAW,MAAA,EAAQ;AAAA,UACnD,MAAA;AAAA,UACA,SAAA;AAAA,UACA,eAAA,EAAiB,uBAAA;AAAA,UACjB;AAAA,SACD,CAAA;AAGD,QAAA,MAAM,UAAU,YAAA,EAAa;AAE7B,QAAA,IAAA,CAAK,GAAA;AAAA,UACH,MAAMC,mBAAA,CAAa;AAAA,YACjB,MAAA;AAAA,YACA,KAAA;AAAA,YACA,iBAAA;AAAA,YACA,iBAAA;AAAA,YACA,SAAA;AAAA,YACA,UAAA;AAAA,YACA,SAAA;AAAA,YACA,MAAA;AAAA,YACA,SAAA;AAAA,YACA,QAAA;AAAA,YACA,IAAA;AAAA,YACA;AAAA,WACD;AAAA,SACH;AAEA,QAAA,IAAA,CAAK,aAAA,CAAc;AAAA,UACjB,IAAA,EAAM,SAAA;AAAA,UACN,KAAA,EAAO;AAAA,SACR,CAAA;AAGD,QAAAC,2BAAA,CAAsB;AAAA,UACpB,eAAA;AAAA,UACA,IAAA;AAAA,UACA;AAAA,SACD,CAAA;AAAA,MACH;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { actionsRegistryServiceRef } from '@backstage/backend-plugin-api/alpha';\nimport {\n DocsBuildStrategy,\n GeneratorBase,\n Generators,\n PreparerBase,\n Preparers,\n Publisher,\n PublisherBase,\n PublisherSettings,\n PublisherType,\n RemoteProtocol,\n SupportedGeneratorKey,\n techdocsBuildsExtensionPoint,\n techdocsGeneratorExtensionPoint,\n techdocsPreparerExtensionPoint,\n techdocsPublisherExtensionPoint,\n} from '@backstage/plugin-techdocs-node';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node';\nimport * as winston from 'winston';\nimport { createRouter } from './service/router';\nimport { createTechdocsActions } from './actions';\n\n/**\n * The TechDocs plugin is responsible for serving and building documentation for any entity.\n * @public\n */\nexport const techdocsPlugin = createBackendPlugin({\n pluginId: 'techdocs',\n register(env) {\n let docsBuildStrategy: DocsBuildStrategy | undefined;\n let buildLogTransport: winston.transport | undefined;\n env.registerExtensionPoint(techdocsBuildsExtensionPoint, {\n setBuildStrategy(buildStrategy: DocsBuildStrategy) {\n if (docsBuildStrategy) {\n throw new Error('DocsBuildStrategy may only be set once');\n }\n docsBuildStrategy = buildStrategy;\n },\n setBuildLogTransport(transport: winston.transport) {\n if (buildLogTransport) {\n throw new Error('BuildLogTransport may only be set once');\n }\n buildLogTransport = transport;\n },\n });\n\n let customTechdocsGenerator: GeneratorBase | undefined;\n const customGenerators = new Map<SupportedGeneratorKey, GeneratorBase>();\n env.registerExtensionPoint(techdocsGeneratorExtensionPoint, {\n setTechdocsGenerator(generator: GeneratorBase) {\n if (customTechdocsGenerator) {\n throw new Error('TechdocsGenerator may only be set once');\n }\n customTechdocsGenerator = generator;\n },\n registerGenerator(key: SupportedGeneratorKey, generator: GeneratorBase) {\n if (key === 'mkdocs' || key === 'techdocs') {\n throw new Error(\n `Cannot register a generator for the built-in \"${key}\" engine; use setTechdocsGenerator to replace the default MkDocs generator`,\n );\n }\n if (customGenerators.has(key)) {\n throw new Error(\n `Generator for engine \"${key}\" is already registered`,\n );\n }\n customGenerators.set(key, generator);\n },\n });\n\n const customPreparers = new Map<RemoteProtocol, PreparerBase>();\n env.registerExtensionPoint(techdocsPreparerExtensionPoint, {\n registerPreparer(protocol: RemoteProtocol, preparer: PreparerBase) {\n if (customPreparers.has(protocol)) {\n throw new Error(\n `Preparer for protocol ${protocol} is already registered`,\n );\n }\n customPreparers.set(protocol, preparer);\n },\n });\n\n let customTechdocsPublisher: PublisherBase | undefined;\n const publisherSettings: PublisherSettings = {};\n env.registerExtensionPoint(techdocsPublisherExtensionPoint, {\n registerPublisher(type: PublisherType, publisher: PublisherBase) {\n if (customTechdocsPublisher) {\n throw new Error(`Publisher for type ${type} is already registered`);\n }\n customTechdocsPublisher = publisher;\n },\n registerPublisherSettings<T extends keyof PublisherSettings>(\n publisher: T,\n settings: PublisherSettings[T],\n ) {\n publisherSettings[publisher] = settings;\n },\n });\n\n env.registerInit({\n deps: {\n config: coreServices.rootConfig,\n logger: coreServices.logger,\n urlReader: coreServices.urlReader,\n http: coreServices.httpRouter,\n discovery: coreServices.discovery,\n cache: coreServices.cache,\n httpAuth: coreServices.httpAuth,\n auth: coreServices.auth,\n catalog: catalogServiceRef,\n actionsRegistry: actionsRegistryServiceRef,\n },\n async init({\n config,\n logger,\n urlReader,\n http,\n discovery,\n cache,\n httpAuth,\n auth,\n catalog,\n actionsRegistry,\n }) {\n // Preparers are responsible for fetching source files for documentation.\n const preparers = await Preparers.fromConfig(config, {\n reader: urlReader,\n logger: logger,\n });\n for (const [protocol, preparer] of customPreparers.entries()) {\n preparers.register(protocol, preparer);\n }\n\n // Generators are used for generating documentation sites.\n const generators = await Generators.fromConfig(config, {\n logger: logger,\n customGenerator: customTechdocsGenerator,\n });\n for (const [key, generator] of customGenerators.entries()) {\n generators.register(key, generator);\n }\n const defaultEngine =\n config.getOptionalString('techdocs.generator.defaultEngine') ??\n 'mkdocs';\n const registeredEngines = [\n 'mkdocs',\n 'techdocs',\n ...customGenerators.keys(),\n ];\n if (!registeredEngines.includes(defaultEngine)) {\n logger.warn(\n `techdocs.generator.defaultEngine is set to \"${defaultEngine}\", but no generator is registered for it. ` +\n `Builds for entities without a backstage.io/techdocs-engine annotation will fail. ` +\n `Install the backend module that provides this engine.`,\n );\n }\n\n // Publisher is used for\n // 1. Publishing generated files to storage\n // 2. Fetching files from storage and passing them to TechDocs frontend.\n const publisher = await Publisher.fromConfig(config, {\n logger: logger,\n discovery: discovery,\n customPublisher: customTechdocsPublisher,\n publisherSettings,\n });\n\n // checks if the publisher is working and logs the result\n await publisher.getReadiness();\n\n http.use(\n await createRouter({\n logger: logger,\n cache,\n docsBuildStrategy,\n buildLogTransport,\n preparers,\n generators,\n publisher,\n config,\n discovery,\n httpAuth,\n auth,\n catalog,\n }),\n );\n\n http.addAuthPolicy({\n path: '/static',\n allow: 'user-cookie',\n });\n\n // Register MCP actions for techdocs\n createTechdocsActions({\n actionsRegistry,\n auth,\n discovery,\n });\n },\n });\n },\n});\n"],"names":["createBackendPlugin","techdocsBuildsExtensionPoint","techdocsGeneratorExtensionPoint","techdocsPreparerExtensionPoint","techdocsPublisherExtensionPoint","coreServices","catalogServiceRef","actionsRegistryServiceRef","Preparers","Generators","Publisher","createRouter","createTechdocsActions"],"mappings":";;;;;;;;;AA+CO,MAAM,iBAAiBA,oCAAA,CAAoB;AAAA,EAChD,QAAA,EAAU,UAAA;AAAA,EACV,SAAS,GAAA,EAAK;AACZ,IAAA,IAAI,iBAAA;AACJ,IAAA,IAAI,iBAAA;AACJ,IAAA,GAAA,CAAI,uBAAuBC,+CAAA,EAA8B;AAAA,MACvD,iBAAiB,aAAA,EAAkC;AACjD,QAAA,IAAI,iBAAA,EAAmB;AACrB,UAAA,MAAM,IAAI,MAAM,wCAAwC,CAAA;AAAA,QAC1D;AAC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YACA,iBAAA;AAAA,YACA,iBAAA;AAAA,YACA,SAAA;AAAA,YACA,UAAA;AAAA,YACA,SAAA;AAAA,YACA,MAAA;AAAA,YACA,SAAA;AAAA,YACA,QAAA;AAAA,YACA,IAAA;AAAA,YACA;AAAA,WACD;AAAA,SACH;AAEA,QAAA,IAAA,CAAK,aAAA,CAAc;AAAA,UACjB,IAAA,EAAM,SAAA;AAAA,UACN,KAAA,EAAO;AAAA,SACR,CAAA;AAGD,QAAAC,2BAAA,CAAsB;AAAA,UACpB,eAAA;AAAA,UACA,IAAA;AAAA,UACA;AAAA,SACD,CAAA;AAAA,MACH;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-techdocs-backend",
3
- "version": "2.4.0-next.2",
3
+ "version": "2.4.1-next.0",
4
4
  "description": "The Backstage backend plugin that renders technical documentation for your components",
5
5
  "backstage": {
6
6
  "role": "backend-plugin",
@@ -75,15 +75,15 @@
75
75
  "test": "backstage-cli package test"
76
76
  },
77
77
  "dependencies": {
78
- "@backstage/backend-plugin-api": "1.11.0-next.1",
79
- "@backstage/catalog-client": "1.16.3-next.0",
80
- "@backstage/catalog-model": "1.10.2-next.0",
81
- "@backstage/config": "1.3.10-next.0",
82
- "@backstage/errors": "1.3.2-next.0",
83
- "@backstage/integration": "2.1.3-next.1",
84
- "@backstage/plugin-catalog-node": "2.2.6-next.1",
85
- "@backstage/plugin-techdocs-common": "0.1.2-next.0",
86
- "@backstage/plugin-techdocs-node": "2.0.3-next.2",
78
+ "@backstage/backend-plugin-api": "1.11.1-next.0",
79
+ "@backstage/catalog-client": "1.16.3",
80
+ "@backstage/catalog-model": "1.10.2",
81
+ "@backstage/config": "1.3.10",
82
+ "@backstage/errors": "1.3.2",
83
+ "@backstage/integration": "2.1.3",
84
+ "@backstage/plugin-catalog-node": "2.2.7-next.0",
85
+ "@backstage/plugin-techdocs-common": "0.1.2",
86
+ "@backstage/plugin-techdocs-node": "2.2.0-next.0",
87
87
  "@backstage/types": "1.2.2",
88
88
  "express": "^4.22.0",
89
89
  "express-promise-router": "^4.1.0",
@@ -93,9 +93,9 @@
93
93
  "winston": "^3.2.1"
94
94
  },
95
95
  "devDependencies": {
96
- "@backstage/backend-defaults": "0.18.1-next.2",
97
- "@backstage/backend-test-utils": "1.11.8-next.1",
98
- "@backstage/cli": "0.36.7-next.0",
96
+ "@backstage/backend-defaults": "0.18.2-next.0",
97
+ "@backstage/backend-test-utils": "1.11.9-next.0",
98
+ "@backstage/cli": "0.36.8-next.0",
99
99
  "@types/compression": "^1.7.5",
100
100
  "@types/express": "^4.17.6",
101
101
  "compression": "^1.7.4",