@communities-webruntime/services
Version:
If you would like to run Lightning Web Runtime without the CLI, we expose some of our programmatic APIs available in Node.js. If you're looking for the CLI documentation [you can find that here](https://www.npmjs.com/package/@communities-webruntime/cli).
23 lines • 1.15 kB
JavaScript
/**
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
import { assert } from '../utils/assert.js';
import { DefaultComponentTemplateGenerator } from './default-component-template-generator.js';
const templateGeneratorRegistry = [];
const defaultComponentTemplateGenerator = new DefaultComponentTemplateGenerator();
function registerTemplateGenerators(...templateGenerators) {
templateGenerators.forEach((tg) => templateGeneratorRegistry.push(tg));
}
function getTemplateGenerators() {
return templateGeneratorRegistry;
}
function getTemplateGenerator(componentName) {
assert(!(componentName === null || componentName === undefined), `Cannot retrieve template generator for ${componentName}`);
return (templateGeneratorRegistry.filter((item) => item.getComponentName() === componentName)[0] ||
defaultComponentTemplateGenerator);
}
export { registerTemplateGenerators, getTemplateGenerators, getTemplateGenerator };
//# sourceMappingURL=template-generator-registry.js.map