UNPKG

st-bundle

Version:

CLI for watching and bundling SpringType projects.

25 lines (24 loc) 853 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const pluginUtils_1 = require("../pluginUtils"); function pluginReplace(a, b) { const [opts, matcher] = pluginUtils_1.parsePluginOptions(a, b, {}); return (ctx) => { ctx.ict.on('assemble_fast_analysis', props => { // filter out options if (matcher && !matcher.test(props.module.props.absPath)) { return; } const { module } = props; ctx.log.info('pluginReplace', 'replacing in $file', { file: module.props.absPath, }); module.read(); for (let key in opts) { module.contents = module.contents.replace(key, opts[key]); } return props; }); }; } exports.pluginReplace = pluginReplace;