'use strict';

function createBackendModule(options) {
  function getRegistrations() {
    const extensionPoints = [];
    let init = void 0;
    options.register({
      registerExtensionPoint(ext, impl) {
        if (init) {
          throw new Error("registerExtensionPoint called after registerInit");
        }
        extensionPoints.push([ext, impl]);
      },
      registerInit(regInit) {
        if (init) {
          throw new Error("registerInit must only be called once");
        }
        init = {
          deps: regInit.deps,
          func: regInit.init
        };
      }
    });
    if (!init) {
      throw new Error(
        `registerInit was not called by register in ${options.moduleId} module for ${options.pluginId}`
      );
    }
    return [
      {
        type: "module",
        pluginId: options.pluginId,
        moduleId: options.moduleId,
        extensionPoints,
        init
      }
    ];
  }
  return {
    $$type: "@backstage/BackendFeature",
    featureType: "registrations",
    version: "v1",
    getRegistrations
  };
}

exports.createBackendModule = createBackendModule;
//# sourceMappingURL=createBackendModule.cjs.js.map
