New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dev-dep-tool

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dev-dep-tool - npm Package Compare versions

Comparing version 0.1.1-dev.1 to 0.1.1-dev.2

56

library/ExportIndex/generateInfo.js

@@ -1,29 +0,27 @@

var t=require("dr-js/library/common/compare")
const e=t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`
const o=t=>/[A-Z]/.test(t.charAt(0))
const r=({name:e},{name:o})=>(0,t.compareString)(e,o)
exports.generateIndexScript=(({sourceRouteMap:t})=>{const s={}
Object.values(t).forEach(({routeList:t,directoryList:p,fileList:n})=>{const i=[]
const c=[]
p.forEach(t=>{const o=e(t)
i.push(`import * as ${o} from './${t}'`)
c.push(o)})
n.sort(r).map(({name:t,exportList:r})=>{if(p.length||o(t)){const o=e(t)
i.push(`import * as ${o} from './${t}'`)
c.push(o)}else i.push(`export { ${r.join(", ")} } from './${t}'`)})
c.length&&i.push(`export { ${c.join(", ")} }`)
s[[...t,"index.js"].join("/")]=i.join("\n")})
return s})
exports.HOIST_LIST_KEY="@@|hoist"
exports.EXPORT_LIST_KEY="@@|export"
exports.EXPORT_HOIST_LIST_KEY="@@|export-hoist"
exports.generateExportInfo=(({sourceRouteMap:t})=>{const s={}
const p=(...t)=>{const e=t.join("/")
s[e]||(s[e]={})
return s[e]}
Object.values(t).forEach(({routeList:t,directoryList:s,fileList:n})=>{const i=p(...t)
s.forEach(o=>{i[e(o)]=p(...t,o)})
n.sort(r).map(({name:r,exportList:n})=>{if(s.length||o(r))i[e(r)]={"@@|export":n}
else{i[r]={"@@|hoist":n}
i["@@|export-hoist"]=[...i["@@|export-hoist"]||[],...n]}p(...t,r)["@@|export"]=n})})
return s})
const t=t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`
const e=t=>/[A-Z]/.test(t.charAt(0))
exports.generateIndexScript=(({sourceRouteMap:o})=>{const r={}
Object.values(o).forEach(({routeList:o,directoryList:s,fileList:p})=>{const n=[]
const i=[]
s.forEach(e=>{const o=t(e)
n.push(`import * as ${o} from './${e}'`)
i.push(o)})
p.map(({name:o,exportList:r})=>{if(s.length||e(o)){const e=t(o)
n.push(`import * as ${e} from './${o}'`)
i.push(e)}else n.push(`export { ${r.join(", ")} } from './${o}'`)})
i.length&&n.push(`export { ${i.join(", ")} }`)
r[[...o,"index.js"].join("/")]=n.join("\n")})
return r})
exports.HOIST_LIST_KEY="~hoist"
exports.EXPORT_LIST_KEY="~export"
exports.EXPORT_HOIST_LIST_KEY="~export-hoist"
exports.generateExportInfo=(({sourceRouteMap:o})=>{const r={}
const s=(...t)=>{const e=t.join("/")
r[e]||(r[e]={})
return r[e]}
Object.values(o).forEach(({routeList:o,directoryList:r,fileList:p})=>{const n=s(...o)
r.forEach(e=>{n[t(e)]=s(...o,e)})
p.map(({name:p,exportList:i})=>{if(r.length||e(p))n[t(p)]={"~export":i}
else{n[p]={"~hoist":i}
n["~export-hoist"]=[...n["~export-hoist"]||[],...i]}s(...o,p)["~export"]=i})})
return r})
var e=require("path")
var r=require("fs")
var t=require("babylon")
var o=require("dr-js/library/node/file/File")
exports.createExportParser=(({babylonPluginList:s,logger:i})=>{const a={}
var o=require("dr-js/library/common/compare")
var i=require("dr-js/library/common/mutable/Object")
var s=require("dr-js/library/node/file/File")
exports.createExportParser=(({babylonPluginList:a,logger:c})=>{let n={}
const p=e=>{const r=e.join("/")
a[r]||(a[r]={routeList:e,directoryList:[],fileList:[]})
return a[r]}
return{parseExport:async a=>{const n=await(0,o.getPathType)(a)
const c=a.split(e.sep)
const l=c.pop()
if(o.FILE_TYPE.Directory===n){i.devLog(`[directory] ${a}`)
p(c).directoryList.push(l)}else if(o.FILE_TYPE.File===n&&l.endsWith(".js")){const e=((e,r,o)=>{const s=(0,t.parse)(e,{sourceFilename:r,sourceType:"module",plugins:o||["objectRestSpread","classProperties","exportDefaultFrom","exportNamespaceFrom","jsx"]}).program.body.filter(({type:e})=>"ExportNamedDeclaration"===e)
return[].concat(...s.map(({specifiers:e,declaration:r})=>r?r.declarations.map(({id:{name:e}})=>e):e.map(({exported:{name:e}})=>e)))})((0,r.readFileSync)(a,{encoding:"utf8"}),a,s)
i.devLog(`[file] ${a}`)
n[r]||(n[r]={routeList:e,directoryList:[],fileList:[]})
return n[r]}
return{parseExport:async o=>{const i=await(0,s.getPathType)(o)
const n=o.split(e.sep)
const l=n.pop()
if(s.FILE_TYPE.Directory===i){c.devLog(`[directory] ${o}`)
p(n).directoryList.push(l)}else if(s.FILE_TYPE.File===i&&l.endsWith(".js")){const e=((e,r,o)=>{const i=(0,t.parse)(e,{sourceFilename:r,sourceType:"module",plugins:o||["objectRestSpread","classProperties","exportDefaultFrom","exportNamespaceFrom","jsx"]}).program.body.filter(({type:e})=>"ExportNamedDeclaration"===e)
return[].concat(...i.map(({specifiers:e,declaration:r})=>r?r.declarations.map(({id:{name:e}})=>e):e.map(({exported:{name:e}})=>e)))})((0,r.readFileSync)(o,{encoding:"utf8"}),o,a)
c.devLog(`[file] ${o}`)
if(!e.length)return
p(c).fileList.push({name:l.slice(0,-3),exportList:e})
i.devLog(` export [${e.length}]: ${e.join(", ")}`)}else i.devLog(`[skipped] ${a} (${n})`)},getSourceRouteMap:()=>a}})
p(n).fileList.push({name:l.slice(0,-3),exportList:e})
c.devLog(` export [${e.length}]: ${e.join(", ")}`)}else c.devLog(`[skipped] ${o} (${i})`)},getSourceRouteMap:()=>{const e=(e=>{Object.values(e).forEach(({routeList:e,directoryList:r,fileList:t})=>{r.sort(o.compareString)
t.sort(({name:e},{name:r})=>(0,o.compareString)(e,r))
t.forEach(({exportList:e})=>e.sort(o.compareString))});(0,i.objectSortKey)(e)
return e})(n)
n={}
return e}}})

@@ -1,1 +0,1 @@

{"name":"dev-dep-tool","version":"0.1.1-dev.1","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.13.0-dev.0"},"sideEffects":false}
{"name":"dev-dep-tool","version":"0.1.1-dev.2","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.13.0-dev.1"},"sideEffects":false}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc