ant-app-builder
Advanced tools
Comparing version 1.5.2 to 1.5.3
@@ -10,3 +10,3 @@ | ||
const { FS } = require("./common") | ||
const buildFileLimit = 1024 * 1024 * 5 | ||
const buildFileLimit = 1024 * 1024 * 5 // = 5 MB | ||
const ant_require_rx = /defiant\.require\(['"](.+?)['"]\)/g | ||
@@ -35,3 +35,3 @@ | ||
let destDir = FS.path.dirname(dest) | ||
let _uglify = task._attributes.action === "uglify" || uglify | ||
let _uglify = task._attributes.action === "minify" || uglify | ||
@@ -311,39 +311,2 @@ let ant_require = async function(baseDir, reqStr, exclude) { | ||
// ** Monifies JS modules | ||
const Bundle = async (filePath) => { | ||
let parts = FS.path.parse(filePath) | ||
let destPath = FS.path.join(parts.dir, parts.name +".min"+ parts.ext) | ||
/**/ | ||
// rollup.js | ||
let bundle = await rollup.rollup({ input: filePath, treeshake: false }) | ||
let { output } = await bundle.generate({ format: "esm" }) | ||
console.time("Requires") | ||
// custom require-parser | ||
let code = output[0].code | ||
let requires = code.match(ant_require_rx) || [] | ||
// loop all requires | ||
await Promise.all(requires.map(async item => requireFile(dirPath, item))) | ||
// fix paths to app public folder | ||
code = code.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '$1'); | ||
code = code.replace(/\t/g, "") | ||
code = code.replace(/\n\n/gm, "") | ||
console.timeEnd("Requires") | ||
console.time("Terser") | ||
// terser.js | ||
let options = { compress: false, module: false, mangle: true } | ||
let parsed = terser.minify(code, options) | ||
console.timeEnd("Terser") | ||
await FS.writeFile(destPath, parsed.code) | ||
parts = FS.path.parse(destPath) | ||
return parts.base | ||
} | ||
// ** Builds def-ant application | ||
@@ -446,3 +409,2 @@ const Build = (srcDir, destDir, uglify) => { | ||
Build, | ||
Bundle, | ||
} |
{ | ||
"name": "ant-app-builder", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./lib", |
@@ -10,5 +10,2 @@ | ||
let runIt = async() => { | ||
// let src = path.join(srcDir, "/src/js/bundle.js") | ||
// await Bundle(src) | ||
let b = await Build(srcDir, destDir, uglify) | ||
@@ -15,0 +12,0 @@ //console.log(b) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52204
427