UNPKG

@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).

78 lines 2.53 kB
"use strict"; /** @hidden */ /** * Copyright (c) 2019, 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 */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = __importDefault(require("path")); const common_1 = require("@communities-webruntime/common"); const context_validate_1 = require("./context-validate"); const EMPTY_BASE_PATH = ''; /** * Holds the template context configuration. * * The passed config is validated. * * templateDir is the only mandatory configuration, * all others can use default values. */ class WebruntimeContext { constructor(config) { this.config = { ...config }; if (this.config.basePath === '/') { this.config.basePath = ''; } context_validate_1.validateContext(this); } get basePath() { return this.config.basePath || EMPTY_BASE_PATH; } set basePath(basePath) { this.config.basePath = basePath; } get isDesignMode() { return this.config.isDesignMode || false; } get labels() { return this.config.labels || `${this.templateDir}/src/labels.json`; } get locales() { return this.config.locales || `${this.templateDir}/src/locales.json`; } get partials() { return this.config.partials || `${this.templateDir}/src/partials`; } get routes() { return this.config.routes || `${this.templateDir}/src/routes.json`; } get srcDir() { return this.config.srcDir || `${this.config.templateDir}/src`; } get templateDir() { return this.config.templateDir && path_1.default.resolve(this.config.templateDir); } get theme() { return this.config.theme || `${this.config.templateDir}/src/theme.json`; } get views() { return this.config.views || `${this.config.templateDir}/src/views`; } get versionKey() { return this.config.versionKey; } get isLockerEnabled() { var _a; return (_a = this.config.isLockerEnabled) !== null && _a !== void 0 ? _a : common_1.LOCKER_DEFAULT_ENABLED; } set versionKey(versionKey) { this.config.versionKey = versionKey; } } exports.default = WebruntimeContext; //# sourceMappingURL=webruntime-context.js.map