st-bundle
Version:
CLI for watching and bundling SpringType projects.
29 lines (28 loc) • 980 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const pluginUtils_1 = require("../pluginUtils");
const pluginStrings_1 = require("../pluginStrings");
function pluginRawHandler(props) {
if (!props.module.captured) {
const module = props.module;
// read the contents
module.read();
module.contents = pluginStrings_1.wrapContents(JSON.stringify(module.contents), props.opts.useDefault);
}
}
exports.pluginRawHandler = pluginRawHandler;
function pluginRaw(a, b) {
let [opts, matcher] = pluginUtils_1.parsePluginOptions(a, b, {
useDefault: false,
});
return (ctx) => {
ctx.ict.on('bundle_resolve_module', props => {
if (!matcher || (matcher && matcher.test(props.module.props.absPath))) {
pluginRawHandler({ ctx, module: props.module, opts });
return;
}
return props;
});
};
}
exports.pluginRaw = pluginRaw;