@backstage/backend-plugin-api
Advanced tools
| 'use strict'; | ||
| const ID_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/i; | ||
| const ID_PATTERN_OLD = /^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/i; | ||
| exports.ID_PATTERN = ID_PATTERN; | ||
| exports.ID_PATTERN_OLD = ID_PATTERN_OLD; | ||
| //# sourceMappingURL=constants.cjs.js.map |
| {"version":3,"file":"constants.cjs.js","sources":["../../src/wiring/constants.ts"],"sourcesContent":["/*\n * Copyright 2025 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\n// NOTE: changing any of these constants need to be reflected in\n// @backstage/frontend-plugin-api/src/wiring/constants.ts as well\n\n/**\n * The pattern that IDs must match.\n *\n * @remarks\n * ids must only contain the letters `a` through `z` and digits, in groups separated by\n * dashes. Additionally, the very first character of the first group\n * must be a letter, not a digit\n *\n * @public\n */\nexport const ID_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/i;\nexport const ID_PATTERN_OLD = /^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/i;\n"],"names":[],"mappings":";;AA6BO,MAAM,UAAA,GAAa;AACnB,MAAM,cAAA,GAAiB;;;;;"} |
| 'use strict'; | ||
| var constants = require('./constants.cjs.js'); | ||
| function createBackendModule(options) { | ||
| if (!constants.ID_PATTERN.test(options.moduleId)) { | ||
| console.warn( | ||
| `WARNING: The moduleId '${options.moduleId}' for plugin '${options.pluginId}', will be invalid soon, please change it to match the pattern ${constants.ID_PATTERN} (letters, digits, and dashes only, starting with a letter)` | ||
| ); | ||
| } | ||
| if (!constants.ID_PATTERN_OLD.test(options.moduleId)) { | ||
| throw new Error( | ||
| `Invalid moduleId '${options.moduleId}' for plugin '${options.pluginId}', must match the pattern ${constants.ID_PATTERN} (letters, digits, and dashes only, starting with a letter)` | ||
| ); | ||
| } | ||
| function getRegistrations() { | ||
@@ -5,0 +17,0 @@ const extensionPoints = []; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"createBackendModule.cjs.js","sources":["../../src/wiring/createBackendModule.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BackendFeature } from '../types';\nimport {\n BackendModuleRegistrationPoints,\n ExtensionPoint,\n ExtensionPointFactoryContext,\n InternalBackendModuleRegistrationV1_1,\n InternalBackendRegistrations,\n} from './types';\n\n/**\n * The configuration options passed to {@link createBackendModule}.\n *\n * @public\n * @see {@link https://backstage.io/docs/backend-system/architecture/modules | The architecture of modules}\n * @see {@link https://backstage.io/docs/backend-system/architecture/naming-patterns | Recommended naming patterns}\n */\nexport interface CreateBackendModuleOptions {\n /**\n * Should exactly match the `id` of the plugin that the module extends.\n *\n * @see {@link https://backstage.io/docs/backend-system/architecture/naming-patterns | Recommended naming patterns}\n */\n pluginId: string;\n\n /**\n * The ID of this module, used to identify the module and ensure that it is not installed twice.\n */\n moduleId: string;\n register(reg: BackendModuleRegistrationPoints): void;\n}\n\n/**\n * Creates a new backend module for a given plugin.\n *\n * @public\n * @see {@link https://backstage.io/docs/backend-system/architecture/modules | The architecture of modules}\n * @see {@link https://backstage.io/docs/backend-system/architecture/naming-patterns | Recommended naming patterns}\n */\nexport function createBackendModule(\n options: CreateBackendModuleOptions,\n): BackendFeature {\n function getRegistrations() {\n const extensionPoints: InternalBackendModuleRegistrationV1_1['extensionPoints'] =\n [];\n let init: InternalBackendModuleRegistrationV1_1['init'] | undefined =\n undefined;\n\n options.register({\n registerExtensionPoint<TExtensionPoint>(\n extOrOpts:\n | ExtensionPoint<TExtensionPoint>\n | {\n extensionPoint: ExtensionPoint<TExtensionPoint>;\n factory: (\n context: ExtensionPointFactoryContext,\n ) => TExtensionPoint;\n },\n impl?: TExtensionPoint,\n ) {\n if (init) {\n throw new Error('registerExtensionPoint called after registerInit');\n }\n if (\n typeof extOrOpts === 'object' &&\n extOrOpts !== null &&\n 'extensionPoint' in extOrOpts\n ) {\n extensionPoints.push({\n extensionPoint: extOrOpts.extensionPoint,\n factory: extOrOpts.factory as (\n context: ExtensionPointFactoryContext,\n ) => unknown,\n });\n } else {\n extensionPoints.push({\n extensionPoint: extOrOpts,\n factory: () => impl,\n });\n }\n },\n registerInit(regInit) {\n if (init) {\n throw new Error('registerInit must only be called once');\n }\n init = {\n deps: regInit.deps,\n func: regInit.init,\n };\n },\n });\n\n if (!init) {\n throw new Error(\n `registerInit was not called by register in ${options.moduleId} module for ${options.pluginId}`,\n );\n }\n\n return [\n {\n type: 'module-v1.1',\n pluginId: options.pluginId,\n moduleId: options.moduleId,\n extensionPoints,\n init,\n },\n ];\n }\n\n return {\n $$type: '@backstage/BackendFeature' as const,\n featureType: 'registrations',\n version: 'v1',\n getRegistrations,\n } as InternalBackendRegistrations;\n}\n"],"names":[],"mappings":";;AAsDO,SAAS,oBACd,OAAA,EACgB;AAChB,EAAA,SAAS,gBAAA,GAAmB;AAC1B,IAAA,MAAM,kBACJ,EAAC;AACH,IAAA,IAAI,IAAA,GACF,MAAA;AAEF,IAAA,OAAA,CAAQ,QAAA,CAAS;AAAA,MACf,sBAAA,CACE,WAQA,IAAA,EACA;AACA,QAAA,IAAI,IAAA,EAAM;AACR,UAAA,MAAM,IAAI,MAAM,kDAAkD,CAAA;AAAA,QACpE;AACA,QAAA,IACE,OAAO,SAAA,KAAc,QAAA,IACrB,SAAA,KAAc,IAAA,IACd,oBAAoB,SAAA,EACpB;AACA,UAAA,eAAA,CAAgB,IAAA,CAAK;AAAA,YACnB,gBAAgB,SAAA,CAAU,cAAA;AAAA,YAC1B,SAAS,SAAA,CAAU;AAAA,WAGpB,CAAA;AAAA,QACH,CAAA,MAAO;AACL,UAAA,eAAA,CAAgB,IAAA,CAAK;AAAA,YACnB,cAAA,EAAgB,SAAA;AAAA,YAChB,SAAS,MAAM;AAAA,WAChB,CAAA;AAAA,QACH;AAAA,MACF,CAAA;AAAA,MACA,aAAa,OAAA,EAAS;AACpB,QAAA,IAAI,IAAA,EAAM;AACR,UAAA,MAAM,IAAI,MAAM,uCAAuC,CAAA;AAAA,QACzD;AACA,QAAA,IAAA,GAAO;AAAA,UACL,MAAM,OAAA,CAAQ,IAAA;AAAA,UACd,MAAM,OAAA,CAAQ;AAAA,SAChB;AAAA,MACF;AAAA,KACD,CAAA;AAED,IAAA,IAAI,CAAC,IAAA,EAAM;AACT,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,2CAAA,EAA8C,OAAA,CAAQ,QAAQ,CAAA,YAAA,EAAe,QAAQ,QAAQ,CAAA;AAAA,OAC/F;AAAA,IACF;AAEA,IAAA,OAAO;AAAA,MACL;AAAA,QACE,IAAA,EAAM,aAAA;AAAA,QACN,UAAU,OAAA,CAAQ,QAAA;AAAA,QAClB,UAAU,OAAA,CAAQ,QAAA;AAAA,QAClB,eAAA;AAAA,QACA;AAAA;AACF,KACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,2BAAA;AAAA,IACR,WAAA,EAAa,eAAA;AAAA,IACb,OAAA,EAAS,IAAA;AAAA,IACT;AAAA,GACF;AACF;;;;"} | ||
| {"version":3,"file":"createBackendModule.cjs.js","sources":["../../src/wiring/createBackendModule.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BackendFeature } from '../types';\nimport { ID_PATTERN, ID_PATTERN_OLD } from './constants';\nimport {\n BackendModuleRegistrationPoints,\n ExtensionPoint,\n ExtensionPointFactoryContext,\n InternalBackendModuleRegistrationV1_1,\n InternalBackendRegistrations,\n} from './types';\n\n/**\n * The configuration options passed to {@link createBackendModule}.\n *\n * @public\n * @see {@link https://backstage.io/docs/backend-system/architecture/modules | The architecture of modules}\n * @see {@link https://backstage.io/docs/backend-system/architecture/naming-patterns | Recommended naming patterns}\n */\nexport interface CreateBackendModuleOptions {\n /**\n * Should exactly match the `id` of the plugin that the module extends.\n *\n * @see {@link https://backstage.io/docs/backend-system/architecture/naming-patterns | Recommended naming patterns}\n */\n pluginId: string;\n\n /**\n * The ID of this module, used to identify the module and ensure that it is not installed twice.\n */\n moduleId: string;\n register(reg: BackendModuleRegistrationPoints): void;\n}\n\n/**\n * Creates a new backend module for a given plugin.\n *\n * @public\n * @see {@link https://backstage.io/docs/backend-system/architecture/modules | The architecture of modules}\n * @see {@link https://backstage.io/docs/backend-system/architecture/naming-patterns | Recommended naming patterns}\n */\nexport function createBackendModule(\n options: CreateBackendModuleOptions,\n): BackendFeature {\n if (!ID_PATTERN.test(options.moduleId)) {\n console.warn(\n `WARNING: The moduleId '${options.moduleId}' for plugin '${options.pluginId}', will be invalid soon, please change it to match the pattern ${ID_PATTERN} (letters, digits, and dashes only, starting with a letter)`,\n );\n }\n if (!ID_PATTERN_OLD.test(options.moduleId)) {\n throw new Error(\n `Invalid moduleId '${options.moduleId}' for plugin '${options.pluginId}', must match the pattern ${ID_PATTERN} (letters, digits, and dashes only, starting with a letter)`,\n );\n }\n\n function getRegistrations() {\n const extensionPoints: InternalBackendModuleRegistrationV1_1['extensionPoints'] =\n [];\n let init: InternalBackendModuleRegistrationV1_1['init'] | undefined =\n undefined;\n\n options.register({\n registerExtensionPoint<TExtensionPoint>(\n extOrOpts:\n | ExtensionPoint<TExtensionPoint>\n | {\n extensionPoint: ExtensionPoint<TExtensionPoint>;\n factory: (\n context: ExtensionPointFactoryContext,\n ) => TExtensionPoint;\n },\n impl?: TExtensionPoint,\n ) {\n if (init) {\n throw new Error('registerExtensionPoint called after registerInit');\n }\n if (\n typeof extOrOpts === 'object' &&\n extOrOpts !== null &&\n 'extensionPoint' in extOrOpts\n ) {\n extensionPoints.push({\n extensionPoint: extOrOpts.extensionPoint,\n factory: extOrOpts.factory as (\n context: ExtensionPointFactoryContext,\n ) => unknown,\n });\n } else {\n extensionPoints.push({\n extensionPoint: extOrOpts,\n factory: () => impl,\n });\n }\n },\n registerInit(regInit) {\n if (init) {\n throw new Error('registerInit must only be called once');\n }\n init = {\n deps: regInit.deps,\n func: regInit.init,\n };\n },\n });\n\n if (!init) {\n throw new Error(\n `registerInit was not called by register in ${options.moduleId} module for ${options.pluginId}`,\n );\n }\n\n return [\n {\n type: 'module-v1.1',\n pluginId: options.pluginId,\n moduleId: options.moduleId,\n extensionPoints,\n init,\n },\n ];\n }\n\n return {\n $$type: '@backstage/BackendFeature' as const,\n featureType: 'registrations',\n version: 'v1',\n getRegistrations,\n } as InternalBackendRegistrations;\n}\n"],"names":["ID_PATTERN","ID_PATTERN_OLD"],"mappings":";;;;AAuDO,SAAS,oBACd,OAAA,EACgB;AAChB,EAAA,IAAI,CAACA,oBAAA,CAAW,IAAA,CAAK,OAAA,CAAQ,QAAQ,CAAA,EAAG;AACtC,IAAA,OAAA,CAAQ,IAAA;AAAA,MACN,0BAA0B,OAAA,CAAQ,QAAQ,iBAAiB,OAAA,CAAQ,QAAQ,kEAAkEA,oBAAU,CAAA,2DAAA;AAAA,KACzJ;AAAA,EACF;AACA,EAAA,IAAI,CAACC,wBAAA,CAAe,IAAA,CAAK,OAAA,CAAQ,QAAQ,CAAA,EAAG;AAC1C,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,qBAAqB,OAAA,CAAQ,QAAQ,iBAAiB,OAAA,CAAQ,QAAQ,6BAA6BD,oBAAU,CAAA,2DAAA;AAAA,KAC/G;AAAA,EACF;AAEA,EAAA,SAAS,gBAAA,GAAmB;AAC1B,IAAA,MAAM,kBACJ,EAAC;AACH,IAAA,IAAI,IAAA,GACF,MAAA;AAEF,IAAA,OAAA,CAAQ,QAAA,CAAS;AAAA,MACf,sBAAA,CACE,WAQA,IAAA,EACA;AACA,QAAA,IAAI,IAAA,EAAM;AACR,UAAA,MAAM,IAAI,MAAM,kDAAkD,CAAA;AAAA,QACpE;AACA,QAAA,IACE,OAAO,SAAA,KAAc,QAAA,IACrB,SAAA,KAAc,IAAA,IACd,oBAAoB,SAAA,EACpB;AACA,UAAA,eAAA,CAAgB,IAAA,CAAK;AAAA,YACnB,gBAAgB,SAAA,CAAU,cAAA;AAAA,YAC1B,SAAS,SAAA,CAAU;AAAA,WAGpB,CAAA;AAAA,QACH,CAAA,MAAO;AACL,UAAA,eAAA,CAAgB,IAAA,CAAK;AAAA,YACnB,cAAA,EAAgB,SAAA;AAAA,YAChB,SAAS,MAAM;AAAA,WAChB,CAAA;AAAA,QACH;AAAA,MACF,CAAA;AAAA,MACA,aAAa,OAAA,EAAS;AACpB,QAAA,IAAI,IAAA,EAAM;AACR,UAAA,MAAM,IAAI,MAAM,uCAAuC,CAAA;AAAA,QACzD;AACA,QAAA,IAAA,GAAO;AAAA,UACL,MAAM,OAAA,CAAQ,IAAA;AAAA,UACd,MAAM,OAAA,CAAQ;AAAA,SAChB;AAAA,MACF;AAAA,KACD,CAAA;AAED,IAAA,IAAI,CAAC,IAAA,EAAM;AACT,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,2CAAA,EAA8C,OAAA,CAAQ,QAAQ,CAAA,YAAA,EAAe,QAAQ,QAAQ,CAAA;AAAA,OAC/F;AAAA,IACF;AAEA,IAAA,OAAO;AAAA,MACL;AAAA,QACE,IAAA,EAAM,aAAA;AAAA,QACN,UAAU,OAAA,CAAQ,QAAA;AAAA,QAClB,UAAU,OAAA,CAAQ,QAAA;AAAA,QAClB,eAAA;AAAA,QACA;AAAA;AACF,KACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,2BAAA;AAAA,IACR,WAAA,EAAa,eAAA;AAAA,IACb,OAAA,EAAS,IAAA;AAAA,IACT;AAAA,GACF;AACF;;;;"} |
| 'use strict'; | ||
| var constants = require('./constants.cjs.js'); | ||
| function createBackendPlugin(options) { | ||
| if (!constants.ID_PATTERN.test(options.pluginId)) { | ||
| console.warn( | ||
| `WARNING: The pluginId '${options.pluginId}' will be invalid soon, please change it to match the pattern ${constants.ID_PATTERN} (letters, digits, and dashes only, starting with a letter)` | ||
| ); | ||
| } | ||
| if (!constants.ID_PATTERN_OLD.test(options.pluginId)) { | ||
| throw new Error( | ||
| `Invalid pluginId '${options.pluginId}', must match the pattern ${constants.ID_PATTERN} (letters, digits, and dashes only, starting with a letter)` | ||
| ); | ||
| } | ||
| function getRegistrations() { | ||
@@ -5,0 +17,0 @@ const extensionPoints = []; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"createBackendPlugin.cjs.js","sources":["../../src/wiring/createBackendPlugin.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BackendFeature } from '../types';\nimport {\n BackendPluginRegistrationPoints,\n ExtensionPoint,\n ExtensionPointFactoryContext,\n InternalBackendPluginRegistrationV1_1,\n InternalBackendRegistrations,\n} from './types';\n\n/**\n * The configuration options passed to {@link createBackendPlugin}.\n *\n * @public\n * @see {@link https://backstage.io/docs/backend-system/architecture/plugins | The architecture of plugins}\n * @see {@link https://backstage.io/docs/backend-system/architecture/naming-patterns | Recommended naming patterns}\n */\nexport interface CreateBackendPluginOptions {\n /**\n * The ID of this plugin.\n *\n * @see {@link https://backstage.io/docs/backend-system/architecture/naming-patterns | Recommended naming patterns}\n */\n pluginId: string;\n register(reg: BackendPluginRegistrationPoints): void;\n}\n\n/**\n * Creates a new backend plugin.\n *\n * @public\n * @see {@link https://backstage.io/docs/backend-system/architecture/plugins | The architecture of plugins}\n * @see {@link https://backstage.io/docs/backend-system/architecture/naming-patterns | Recommended naming patterns}\n */\nexport function createBackendPlugin(\n options: CreateBackendPluginOptions,\n): BackendFeature {\n function getRegistrations() {\n const extensionPoints: InternalBackendPluginRegistrationV1_1['extensionPoints'] =\n [];\n let init: InternalBackendPluginRegistrationV1_1['init'] | undefined =\n undefined;\n\n options.register({\n registerExtensionPoint<TExtensionPoint>(\n extOrOpts:\n | ExtensionPoint<TExtensionPoint>\n | {\n extensionPoint: ExtensionPoint<TExtensionPoint>;\n factory: (\n context: ExtensionPointFactoryContext,\n ) => TExtensionPoint;\n },\n impl?: TExtensionPoint,\n ) {\n if (init) {\n throw new Error('registerExtensionPoint called after registerInit');\n }\n if (\n typeof extOrOpts === 'object' &&\n extOrOpts !== null &&\n 'extensionPoint' in extOrOpts\n ) {\n extensionPoints.push({\n extensionPoint: extOrOpts.extensionPoint,\n factory: extOrOpts.factory as (\n context: ExtensionPointFactoryContext,\n ) => unknown,\n });\n } else {\n extensionPoints.push({\n extensionPoint: extOrOpts,\n factory: () => impl,\n });\n }\n },\n registerInit(regInit) {\n if (init) {\n throw new Error('registerInit must only be called once');\n }\n init = {\n deps: regInit.deps,\n func: regInit.init,\n };\n },\n });\n\n if (!init) {\n throw new Error(\n `registerInit was not called by register in ${options.pluginId}`,\n );\n }\n\n return [\n {\n type: 'plugin-v1.1',\n pluginId: options.pluginId,\n extensionPoints,\n init,\n },\n ];\n }\n\n return {\n $$type: '@backstage/BackendFeature' as const,\n version: 'v1',\n featureType: 'registrations',\n getRegistrations,\n } as InternalBackendRegistrations;\n}\n"],"names":[],"mappings":";;AAiDO,SAAS,oBACd,OAAA,EACgB;AAChB,EAAA,SAAS,gBAAA,GAAmB;AAC1B,IAAA,MAAM,kBACJ,EAAC;AACH,IAAA,IAAI,IAAA,GACF,MAAA;AAEF,IAAA,OAAA,CAAQ,QAAA,CAAS;AAAA,MACf,sBAAA,CACE,WAQA,IAAA,EACA;AACA,QAAA,IAAI,IAAA,EAAM;AACR,UAAA,MAAM,IAAI,MAAM,kDAAkD,CAAA;AAAA,QACpE;AACA,QAAA,IACE,OAAO,SAAA,KAAc,QAAA,IACrB,SAAA,KAAc,IAAA,IACd,oBAAoB,SAAA,EACpB;AACA,UAAA,eAAA,CAAgB,IAAA,CAAK;AAAA,YACnB,gBAAgB,SAAA,CAAU,cAAA;AAAA,YAC1B,SAAS,SAAA,CAAU;AAAA,WAGpB,CAAA;AAAA,QACH,CAAA,MAAO;AACL,UAAA,eAAA,CAAgB,IAAA,CAAK;AAAA,YACnB,cAAA,EAAgB,SAAA;AAAA,YAChB,SAAS,MAAM;AAAA,WAChB,CAAA;AAAA,QACH;AAAA,MACF,CAAA;AAAA,MACA,aAAa,OAAA,EAAS;AACpB,QAAA,IAAI,IAAA,EAAM;AACR,UAAA,MAAM,IAAI,MAAM,uCAAuC,CAAA;AAAA,QACzD;AACA,QAAA,IAAA,GAAO;AAAA,UACL,MAAM,OAAA,CAAQ,IAAA;AAAA,UACd,MAAM,OAAA,CAAQ;AAAA,SAChB;AAAA,MACF;AAAA,KACD,CAAA;AAED,IAAA,IAAI,CAAC,IAAA,EAAM;AACT,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,2CAAA,EAA8C,QAAQ,QAAQ,CAAA;AAAA,OAChE;AAAA,IACF;AAEA,IAAA,OAAO;AAAA,MACL;AAAA,QACE,IAAA,EAAM,aAAA;AAAA,QACN,UAAU,OAAA,CAAQ,QAAA;AAAA,QAClB,eAAA;AAAA,QACA;AAAA;AACF,KACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,2BAAA;AAAA,IACR,OAAA,EAAS,IAAA;AAAA,IACT,WAAA,EAAa,eAAA;AAAA,IACb;AAAA,GACF;AACF;;;;"} | ||
| {"version":3,"file":"createBackendPlugin.cjs.js","sources":["../../src/wiring/createBackendPlugin.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BackendFeature } from '../types';\nimport {\n BackendPluginRegistrationPoints,\n ExtensionPoint,\n ExtensionPointFactoryContext,\n InternalBackendPluginRegistrationV1_1,\n InternalBackendRegistrations,\n} from './types';\nimport { ID_PATTERN, ID_PATTERN_OLD } from './constants';\n\n/**\n * The configuration options passed to {@link createBackendPlugin}.\n *\n * @public\n * @see {@link https://backstage.io/docs/backend-system/architecture/plugins | The architecture of plugins}\n * @see {@link https://backstage.io/docs/backend-system/architecture/naming-patterns | Recommended naming patterns}\n */\nexport interface CreateBackendPluginOptions {\n /**\n * The ID of this plugin.\n *\n * @see {@link https://backstage.io/docs/backend-system/architecture/naming-patterns | Recommended naming patterns}\n */\n pluginId: string;\n register(reg: BackendPluginRegistrationPoints): void;\n}\n\n/**\n * Creates a new backend plugin.\n *\n * @public\n * @see {@link https://backstage.io/docs/backend-system/architecture/plugins | The architecture of plugins}\n * @see {@link https://backstage.io/docs/backend-system/architecture/naming-patterns | Recommended naming patterns}\n */\nexport function createBackendPlugin(\n options: CreateBackendPluginOptions,\n): BackendFeature {\n if (!ID_PATTERN.test(options.pluginId)) {\n console.warn(\n `WARNING: The pluginId '${options.pluginId}' will be invalid soon, please change it to match the pattern ${ID_PATTERN} (letters, digits, and dashes only, starting with a letter)`,\n );\n }\n if (!ID_PATTERN_OLD.test(options.pluginId)) {\n throw new Error(\n `Invalid pluginId '${options.pluginId}', must match the pattern ${ID_PATTERN} (letters, digits, and dashes only, starting with a letter)`,\n );\n }\n\n function getRegistrations() {\n const extensionPoints: InternalBackendPluginRegistrationV1_1['extensionPoints'] =\n [];\n let init: InternalBackendPluginRegistrationV1_1['init'] | undefined =\n undefined;\n\n options.register({\n registerExtensionPoint<TExtensionPoint>(\n extOrOpts:\n | ExtensionPoint<TExtensionPoint>\n | {\n extensionPoint: ExtensionPoint<TExtensionPoint>;\n factory: (\n context: ExtensionPointFactoryContext,\n ) => TExtensionPoint;\n },\n impl?: TExtensionPoint,\n ) {\n if (init) {\n throw new Error('registerExtensionPoint called after registerInit');\n }\n if (\n typeof extOrOpts === 'object' &&\n extOrOpts !== null &&\n 'extensionPoint' in extOrOpts\n ) {\n extensionPoints.push({\n extensionPoint: extOrOpts.extensionPoint,\n factory: extOrOpts.factory as (\n context: ExtensionPointFactoryContext,\n ) => unknown,\n });\n } else {\n extensionPoints.push({\n extensionPoint: extOrOpts,\n factory: () => impl,\n });\n }\n },\n registerInit(regInit) {\n if (init) {\n throw new Error('registerInit must only be called once');\n }\n init = {\n deps: regInit.deps,\n func: regInit.init,\n };\n },\n });\n\n if (!init) {\n throw new Error(\n `registerInit was not called by register in ${options.pluginId}`,\n );\n }\n\n return [\n {\n type: 'plugin-v1.1',\n pluginId: options.pluginId,\n extensionPoints,\n init,\n },\n ];\n }\n\n return {\n $$type: '@backstage/BackendFeature' as const,\n version: 'v1',\n featureType: 'registrations',\n getRegistrations,\n } as InternalBackendRegistrations;\n}\n"],"names":["ID_PATTERN","ID_PATTERN_OLD"],"mappings":";;;;AAkDO,SAAS,oBACd,OAAA,EACgB;AAChB,EAAA,IAAI,CAACA,oBAAA,CAAW,IAAA,CAAK,OAAA,CAAQ,QAAQ,CAAA,EAAG;AACtC,IAAA,OAAA,CAAQ,IAAA;AAAA,MACN,CAAA,uBAAA,EAA0B,OAAA,CAAQ,QAAQ,CAAA,8DAAA,EAAiEA,oBAAU,CAAA,2DAAA;AAAA,KACvH;AAAA,EACF;AACA,EAAA,IAAI,CAACC,wBAAA,CAAe,IAAA,CAAK,OAAA,CAAQ,QAAQ,CAAA,EAAG;AAC1C,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,kBAAA,EAAqB,OAAA,CAAQ,QAAQ,CAAA,0BAAA,EAA6BD,oBAAU,CAAA,2DAAA;AAAA,KAC9E;AAAA,EACF;AAEA,EAAA,SAAS,gBAAA,GAAmB;AAC1B,IAAA,MAAM,kBACJ,EAAC;AACH,IAAA,IAAI,IAAA,GACF,MAAA;AAEF,IAAA,OAAA,CAAQ,QAAA,CAAS;AAAA,MACf,sBAAA,CACE,WAQA,IAAA,EACA;AACA,QAAA,IAAI,IAAA,EAAM;AACR,UAAA,MAAM,IAAI,MAAM,kDAAkD,CAAA;AAAA,QACpE;AACA,QAAA,IACE,OAAO,SAAA,KAAc,QAAA,IACrB,SAAA,KAAc,IAAA,IACd,oBAAoB,SAAA,EACpB;AACA,UAAA,eAAA,CAAgB,IAAA,CAAK;AAAA,YACnB,gBAAgB,SAAA,CAAU,cAAA;AAAA,YAC1B,SAAS,SAAA,CAAU;AAAA,WAGpB,CAAA;AAAA,QACH,CAAA,MAAO;AACL,UAAA,eAAA,CAAgB,IAAA,CAAK;AAAA,YACnB,cAAA,EAAgB,SAAA;AAAA,YAChB,SAAS,MAAM;AAAA,WAChB,CAAA;AAAA,QACH;AAAA,MACF,CAAA;AAAA,MACA,aAAa,OAAA,EAAS;AACpB,QAAA,IAAI,IAAA,EAAM;AACR,UAAA,MAAM,IAAI,MAAM,uCAAuC,CAAA;AAAA,QACzD;AACA,QAAA,IAAA,GAAO;AAAA,UACL,MAAM,OAAA,CAAQ,IAAA;AAAA,UACd,MAAM,OAAA,CAAQ;AAAA,SAChB;AAAA,MACF;AAAA,KACD,CAAA;AAED,IAAA,IAAI,CAAC,IAAA,EAAM;AACT,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,2CAAA,EAA8C,QAAQ,QAAQ,CAAA;AAAA,OAChE;AAAA,IACF;AAEA,IAAA,OAAO;AAAA,MACL;AAAA,QACE,IAAA,EAAM,aAAA;AAAA,QACN,UAAU,OAAA,CAAQ,QAAA;AAAA,QAClB,eAAA;AAAA,QACA;AAAA;AACF,KACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,2BAAA;AAAA,IACR,OAAA,EAAS,IAAA;AAAA,IACT,WAAA,EAAa,eAAA;AAAA,IACb;AAAA,GACF;AACF;;;;"} |
+6
-6
| { | ||
| "name": "@backstage/backend-plugin-api", | ||
| "version": "1.7.0-next.0", | ||
| "version": "1.7.0-next.1", | ||
| "description": "Core API used by Backstage backend plugins", | ||
@@ -71,5 +71,5 @@ "backstage": { | ||
| "@backstage/errors": "1.2.7", | ||
| "@backstage/plugin-auth-node": "0.6.12-next.0", | ||
| "@backstage/plugin-permission-common": "0.9.5-next.0", | ||
| "@backstage/plugin-permission-node": "0.10.9-next.0", | ||
| "@backstage/plugin-auth-node": "0.6.13-next.0", | ||
| "@backstage/plugin-permission-common": "0.9.6-next.0", | ||
| "@backstage/plugin-permission-node": "0.10.10-next.0", | ||
| "@backstage/types": "1.2.2", | ||
@@ -85,6 +85,6 @@ "@types/express": "^4.17.6", | ||
| "devDependencies": { | ||
| "@backstage/backend-test-utils": "1.10.4-next.0", | ||
| "@backstage/cli": "0.35.3-next.0" | ||
| "@backstage/backend-test-utils": "1.10.5-next.0", | ||
| "@backstage/cli": "0.35.4-next.1" | ||
| }, | ||
| "configSchema": "config.d.ts" | ||
| } |
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
255667
2.06%37
5.71%2679
1.06%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed