st-bundle
Version:
CLI for watching and bundling SpringType projects.
36 lines (35 loc) • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const pluginUtils_1 = require("../pluginUtils");
const angularURLReplacer_1 = require("../../frameworks/angular/angularURLReplacer");
function pluginAngular(target, options) {
let matcher;
if (typeof target === 'string') {
matcher = pluginUtils_1.simplifiedRegExp(target);
}
else
matcher = target;
options = options || {};
function handleModule(module) {
if (!matcher.test(module.props.absPath)) {
return;
}
module.contents = angularURLReplacer_1.angularURLReplacer({ content: module.read() });
return true;
}
return (ctx) => {
ctx.ict.on('assemble_module_ftl_init', props => {
if (handleModule(props.module)) {
ctx.log.info('angular ftl', props.module.props.absPath);
}
return props;
});
ctx.ict.on('assemble_module_init', props => {
if (handleModule(props.module)) {
ctx.log.info('angular', props.module.props.absPath);
}
return props;
});
};
}
exports.pluginAngular = pluginAngular;