dev-dep-tool
Advanced tools
Comparing version 0.0.14 to 0.1.0-dev.0
@@ -8,3 +8,3 @@ var e=require("path") | ||
var s=require("dr-js/library/node/file/Modify") | ||
const a=(i,r={packageJSON:{},exportFilePairList:[],installFilePairList:[]},o=new Set)=>{const n=i.endsWith(".json")?i:(0,e.join)(i,"package.json") | ||
const a=(i,r=(()=>({packageJSON:{},exportFilePairList:[],installFilePairList:[]}))(),o=new Set)=>{const n=i.endsWith(".json")?i:(0,e.join)(i,"package.json") | ||
i.endsWith(".json")&&(i=(0,e.dirname)(i)) | ||
@@ -11,0 +11,0 @@ if(o.has(n))return r |
var e=require("path") | ||
var t=require("fs") | ||
var i=(o=require("uglify-es"))&&o.__esModule?o:{default:o} | ||
var o | ||
var r=require("dr-js/library/common/time") | ||
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) | ||
var i=require("fs") | ||
var t=function(e){return e&&e.__esModule?e:{default:e}}(require("uglify-es")) | ||
var o=require("dr-js/library/common/time") | ||
var r=require("dr-js/library/common/format") | ||
exports.getUglifyESOption=(({isDevelopment:e=!1,isModule:i=!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)},inline:!1},mangle:!i&&{toplevel:!0},output:i?{ecma:8,beautify:!0,indent_level:2,width:240}:{ecma:8,beautify:!1,semicolons:!1},sourceMap:!1}}) | ||
const l=({filePath:e,option:r,logger:l})=>{const n=(0,o.clock)() | ||
const s=(0,i.readFileSync)(e,{encoding:"utf8"}) | ||
const{error:a,code:c}=t.default.minify(s,r) | ||
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: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`) | ||
throw a}(0,i.writeFileSync)(e,c) | ||
const f=(0,o.clock)() | ||
return{sizeSource:Buffer.byteLength(s),sizeOutput:Buffer.byteLength(c),timeStart:n,timeEnd:f}} | ||
exports.minifyWithUglifyEs=l | ||
exports.minifyFileListWithUglifyEs=(async({fileList:i,option:t,rootPath:n="",logger:s})=>{s.padLog(`minify ${i.length} file with uglify-es`) | ||
const a=[] | ||
let c=(0,r.clock)() | ||
let c=(0,o.clock)() | ||
let f=0 | ||
let u=0 | ||
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 | ||
for(const o of i){const{sizeSource:i,sizeOutput:c,timeStart:p,timeEnd:d}=l({filePath:o,option:t,logger:s}) | ||
const m=c-i | ||
a.push([`∆ ${(100*m/i).toFixed(2)}% (${(0,r.binary)(m)}B)`,(0,r.time)(d-p),`${(0,e.relative)(n,o)}`]) | ||
f+=i | ||
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]})}`)}) | ||
a.push([`∆ ${(100*u/f).toFixed(2)}% (${(0,r.binary)(u)}B)`,(0,r.time)((0,o.clock)()-c),`TOTAL of ${i.length} file (${(0,r.binary)(f)}B)`]) | ||
s.log(`result:\n ${(0,r.padTable)({table:a,cellPad:" | ",rowPad:"\n ",padFuncList:[(e,i)=>e.padEnd(i),void 0,e=>e]})}`)}) |
var e=require("fs") | ||
var t=(r=require("webpack"))&&r.__esModule?r:{default:r} | ||
var r | ||
var o=require("dr-js/library/common/format") | ||
var s=require("dr-js/library/node/system/ProcessExitListener") | ||
const a=(e,t)=>(r,o)=>{if(r)return e(r) | ||
var t=function(e){return e&&e.__esModule?e:{default:e}}(require("webpack")) | ||
var r=require("dr-js/library/common/format") | ||
var o=require("dr-js/library/node/system/ProcessExitListener") | ||
const s=(e,t)=>(r,o)=>{if(r)return e(r) | ||
if(o.hasErrors()||o.hasWarnings()){const{errors:t=[],warnings:r=[]}=o.toJson() | ||
@@ -11,17 +10,17 @@ t.forEach(e=>console.error(e)) | ||
if(o.hasErrors())return e(new Error("webpack stats Error"))}t(o)} | ||
exports.compileWithWebpack=(async({config:r,isWatch:i,profileOutput:n,logger:c})=>{n&&i&&c.log("[watch] warning: skipped generate profileOutput") | ||
n&&(r.profile=!0) | ||
const l=(0,t.default)(r) | ||
const p=((e,t)=>{const r=({compilation:{assets:r},startTime:s,endTime:a})=>{e&&t.padLog("watch") | ||
Object.entries(r).forEach(([e,r])=>r.emitted&&t.log(`emitted asset: ${e} [${(0,o.binary)(r.size())}B]`)) | ||
s&&a&&t.log(`compile time: ${(0,o.time)(a-s)}`)} | ||
return e=>{if(e.compilation)r(e) | ||
exports.compileWithWebpack=(async({config:i,isWatch:a,profileOutput:n,logger:c})=>{n&&a&&c.log("[watch] warning: skipped generate profileOutput") | ||
n&&(i.profile=!0) | ||
const l=(0,t.default)(i) | ||
const p=((e,t)=>{const o=({compilation:{assets:o},startTime:s,endTime:i})=>{e&&t.padLog("watch") | ||
Object.entries(o).forEach(([e,o])=>o.emitted&&t.log(`emitted asset: ${e} [${(0,r.binary)(o.size())}B]`)) | ||
s&&i&&t.log(`compile time: ${(0,r.time)(i-s)}`)} | ||
return e=>{if(e.compilation)o(e) | ||
else{if(!e.stats){console.warn("[getLogStats] unexpected statData",e) | ||
throw new Error("[getLogStats] unexpected statData")}e.stats.map(r)}}})(i,c) | ||
if(i){c.log("[watch] start") | ||
const{eventType:e,code:t}=await new Promise(e=>{l.watch({aggregateTimeout:300,poll:void 0},a(e=>c.log(`error: ${e}`),p));(0,s.setProcessExitListener)({listenerSync:e})}) | ||
throw new Error("[getLogStats] unexpected statData")}e.stats.map(o)}}})(a,c) | ||
if(a){c.log("[watch] start") | ||
const{eventType:e,code:t}=await new Promise(e=>{l.watch({aggregateTimeout:300,poll:void 0},s(e=>c.log(`error: ${e}`),p));(0,o.setProcessExitListener)({listenerSync:e})}) | ||
c.log(`[watch] exit with eventType: ${e}, code: ${t}`) | ||
return null}const u=await new Promise((e,t)=>l.run(a(t,e))) | ||
return null}const u=await new Promise((e,t)=>l.run(s(t,e))) | ||
p(u) | ||
if(n){(0,e.writeFileSync)(n,JSON.stringify(u.toJson())) | ||
c.log(`generated profileOutput: ${n}`)}return u}) |
@@ -1,1 +0,1 @@ | ||
{"name":"dev-dep-tool","version":"0.0.14","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.1.0-dev.0","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.2"},"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
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
21006
303
Updateddr-js@^0.12.1-dev.2