dev-dep-tool
Advanced tools
Comparing version 0.0.14-dev.9 to 0.0.14-dev.10
@@ -11,4 +11,4 @@ #!/usr/bin/env node | ||
r&&await(0,a.doPack)({pathInput:p("path-input"),pathOutput:p("path-output"),outputName:i("output-name"),outputVersion:i("output-version"),outputDescription:i("output-description"),isPublish:i("publish"),isPublishDev:i("publish-dev")}) | ||
n||r||console.log((0,t.formatUsage)())}catch(t){console.warn("[Error]",t) | ||
!n&&!r&&console.log((0,t.formatUsage)())}catch(t){console.warn("[Error]",t) | ||
process.exit(2)}})().catch(e=>{console.warn((0,t.formatUsage)(e.stack||e.message||e.toString())) | ||
process.exit(1)}) |
@@ -9,5 +9,6 @@ var e=require("fs") | ||
const{size:a}=i?(0,e.statSync)(t):{size:0} | ||
o.devLog(`∆${(a/n).toFixed(2)}(${(0,r.binary)(a-n)}B)`,`${(0,r.binary)(n)}B → ${(0,r.binary)(a)}B`,`${t}`) | ||
const p=a-n | ||
o.devLog(`∆${(a/n).toFixed(2)}(${(0,r.binary)(p)}B)`,`${(0,r.binary)(n)}B → ${(0,r.binary)(a)}B`,`${t}`) | ||
return a-n}) | ||
exports.fileProcessorBabel=(e=>e.replace(/['"]use strict['"];?\s*/g,"").replace(/Object\.defineProperty\(exports,\s*['"]__esModule['"],\s*{\s*value:\s*(true|!0)\s*}\);?\s*/g,"").replace(/(exports\.\w+\s*=\s*)+(undefined|void 0);?\s*/g,"").replace(/[\n\r]{2,}/g,"\n").replace(/^[\n\r]+/,"")) | ||
exports.fileProcessorWebpack=(e=>e.replace(/function\(\){return\s*([\w$]+)}/g,"()=>$1")) |
@@ -6,26 +6,23 @@ var e=require("path") | ||
var r=require("dr-js/library/common/time") | ||
var s=require("dr-js/library/common/format") | ||
const l={ecma:8,toplevel:!0,parse:{ecma:8},compress:{ecma:8,toplevel:!0,join_vars:!1,sequences:!1},mangle:!1,output:{ecma:8,beautify:!0,indent_level:2,width:240},sourceMap:!1} | ||
exports.MODULE_OPTION=l | ||
const n=Object.assign({},l,{mangle:{toplevel:!0},output:{ecma:8,beautify:!1,semicolons:!1}}) | ||
exports.LIBRARY_OPTION=n | ||
const a=({filePath:e,option:o,logger:s})=>{const l=(0,r.clock)() | ||
var l=require("dr-js/library/common/format") | ||
exports.getUglifyESOption=(({isDevelopment:e=!1,isModule:t=!1})=>{return{ecma:8,toplevel:!0,parse:{ecma:8},compress:{ecma:8,toplevel:!0,join_vars:!1,sequences:!1,global_defs:{"process.env.NODE_ENV":e?"development":"production",__DEV__:Boolean(e)}},mangle:!t&&{toplevel:!0},output:t?{ecma:8,beautify:!0,indent_level:2,width:240}:{ecma:8,beautify:!1,semicolons:!1},sourceMap:!1}}) | ||
const s=({filePath:e,option:o,logger:l})=>{const s=(0,r.clock)() | ||
const n=(0,t.readFileSync)(e,{encoding:"utf8"}) | ||
const{error:a,code:c}=i.default.minify(n,o) | ||
if(a){s.log(`[minifyWithUglifyEs] failed to minify file: ${e}`) | ||
if(a){l.log(`[minifyWithUglifyEs] failed to minify file: ${e}`) | ||
throw a}(0,t.writeFileSync)(e,c) | ||
const f=(0,r.clock)() | ||
return{sizeSource:Buffer.byteLength(n),sizeOutput:Buffer.byteLength(c),timeStart:l,timeEnd:f}} | ||
exports.minifyWithUglifyEs=a | ||
exports.minifyFileListWithUglifyEs=(async({fileList:t,option:i=n,rootPath:o="",logger:l})=>{l.padLog(`minify ${t.length} file with uglify-es`) | ||
const c=[] | ||
let f=(0,r.clock)() | ||
return{sizeSource:Buffer.byteLength(n),sizeOutput:Buffer.byteLength(c),timeStart:s,timeEnd:f}} | ||
exports.minifyWithUglifyEs=s | ||
exports.minifyFileListWithUglifyEs=(async({fileList:t,option:i,rootPath:o="",logger:n})=>{n.padLog(`minify ${t.length} file with uglify-es`) | ||
const a=[] | ||
let c=(0,r.clock)() | ||
let f=0 | ||
let u=0 | ||
let p=0 | ||
for(const r of t){const{sizeSource:t,sizeOutput:n,timeStart:f,timeEnd:m}=a({filePath:r,option:i,logger:l}) | ||
const y=n-t | ||
c.push([`∆ ${(100*y/t).toFixed(2)}% (${(0,s.binary)(y)}B)`,(0,s.time)(m-f),`${(0,e.relative)(o,r)}`]) | ||
u+=t | ||
p+=y}c.push(["--","--","--"]) | ||
c.push([`∆ ${(100*p/u).toFixed(2)}% (${(0,s.binary)(p)}B)`,(0,s.time)((0,r.clock)()-f),`TOTAL of ${t.length} file (${(0,s.binary)(u)}B)`]) | ||
l.log(`result:\n ${(0,s.padTable)({table:c,cellPad:" | ",rowPad:"\n ",padFuncList:[(e,t)=>e.padEnd(t),void 0,e=>e]})}`)}) | ||
for(const r of t){const{sizeSource:t,sizeOutput:c,timeStart:p,timeEnd:d}=s({filePath:r,option:i,logger:n}) | ||
const m=c-t | ||
a.push([`∆ ${(100*m/t).toFixed(2)}% (${(0,l.binary)(m)}B)`,(0,l.time)(d-p),`${(0,e.relative)(o,r)}`]) | ||
f+=t | ||
u+=m}a.push(["--","--","--"]) | ||
a.push([`∆ ${(100*u/f).toFixed(2)}% (${(0,l.binary)(u)}B)`,(0,l.time)((0,r.clock)()-c),`TOTAL of ${t.length} file (${(0,l.binary)(f)}B)`]) | ||
n.log(`result:\n ${(0,l.padTable)({table:a,cellPad:" | ",rowPad:"\n ",padFuncList:[(e,t)=>e.padEnd(t),void 0,e=>e]})}`)}) |
@@ -1,1 +0,1 @@ | ||
{"name":"dev-dep-tool","version":"0.0.14-dev.9","author":"dr-js","license":"MIT","description":"Provide common package devDependencies","keywords":["Dr","Dr-js","JavaScript"],"repository":"https://github.com/dr-js/dev-dep.git","homepage":"https://github.com/dr-js/dev-dep#readme","bugs":"https://github.com/dr-js/dev-dep/issues","bin":"bin/index.js","dependencies":{"dr-js":"^0.12.1-dev.0"},"sideEffects":false} | ||
{"name":"dev-dep-tool","version":"0.0.14-dev.10","author":"dr-js","license":"MIT","description":"Provide common package devDependencies","keywords":["Dr","Dr-js","JavaScript"],"repository":"https://github.com/dr-js/dev-dep.git","homepage":"https://github.com/dr-js/dev-dep#readme","bugs":"https://github.com/dr-js/dev-dep/issues","bin":"bin/index.js","dependencies":{"dr-js":"^0.12.1-dev.0"},"sideEffects":false} |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
20944
305
5