UNPKG

dicebox

Version:

build tool for typescript based RPG Maker MV plugins

26 lines 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Bundler = require("parcel-bundler"); const fs = require("fs"); const docs_1 = require("./docs"); function createParcelBundlerForProject(inputFiles, outDir, pluginConf, { watch = false } = {}) { const outFile = `${pluginConf.pluginFilename}.js`; const pluginDocs = docs_1.createDocsForPlugin(pluginConf); const bundler = new Bundler(inputFiles, { outDir, outFile, watch, minify: true, hmr: false, sourceMaps: false }); bundler.on('bundled', bundle => { const bundles = Array.from(bundle.childBundles).concat([bundle]); const jsBundle = bundles.find(bundle => bundle.entryAsset && bundle.entryAsset.type === 'js'); const jsCode = fs.readFileSync(jsBundle.name); fs.writeFileSync(jsBundle.name, `${pluginDocs}\n${jsCode}`); }); return bundler; } exports.createParcelBundlerForProject = createParcelBundlerForProject; //# sourceMappingURL=parcel.js.map