26 lines
1.0 KiB
JavaScript
26 lines
1.0 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const service_routes_1 = __importDefault(require("../proxy/service-routes"));
|
|
const read_file_relative_1 = require("read-file-relative");
|
|
const get_asset_path_1 = __importDefault(require("./get-asset-path"));
|
|
const serviceRouteValues = Object.values(service_routes_1.default);
|
|
const loadedScriptsCache = {};
|
|
function get(key) {
|
|
if (loadedScriptsCache[key])
|
|
return loadedScriptsCache[key];
|
|
const script = (0, read_file_relative_1.readSync)(key);
|
|
loadedScriptsCache[key] = script;
|
|
return script;
|
|
}
|
|
function default_1(name, devMode) {
|
|
if (!serviceRouteValues.includes(name))
|
|
throw new Error(`Unknown service route value: ${name}`);
|
|
const resultPath = `../client${(0, get_asset_path_1.default)(name, devMode)}`;
|
|
return get(resultPath);
|
|
}
|
|
exports.default = default_1;module.exports = exports.default;
|
|
|