noodl-loader
Version:
Loader for noodl applications
32 lines • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const yaml_1 = tslib_1.__importDefault(require("yaml"));
const is = tslib_1.__importStar(require("../../utils/is"));
const constants_1 = require("../../constants");
const extractScripts = (key, node, path, { cadlEndpoint, createAsset }) => {
if (yaml_1.default.isScalar(node)) {
if (typeof node.value === 'string') {
if (is.script(node.value)) {
const url = node.value.startsWith('http')
? node.value
: `${cadlEndpoint === null || cadlEndpoint === void 0 ? void 0 : cadlEndpoint.assetsUrl}${node.value}`;
createAsset({
type: constants_1.ExtractType.Asset,
id: url,
props: { url, value: node.value },
});
}
}
}
if (yaml_1.default.isMap(node) && node.has('path')) {
const type = node.get('type', false);
if (typeof type === 'string') {
if (/plugin/i.test(type)) {
//
}
}
}
};
exports.default = extractScripts;
//# sourceMappingURL=extract-scripts.js.map