Code Monkey home page Code Monkey logo

lockfile's Introduction

lockfile's People

Contributors

antongolub avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lockfile's Issues

Error "inconsistent snapshot"

I'm using @antongolub/lockfile in my application to parse some dependencies and their sub-dependencies.
When I execute the analyze function, it throws the following exception:

Uncaught Error: inconsistent snapshot: string-width ^4.1.0
(anonymous function) 	analyze.ts:65
walk                 	analyze.ts:62
walk                 	analyze.ts:76
walk                 	analyze.ts:76
walk                 	analyze.ts:76
(anonymous function) 	analyze.ts:123
analyze              	analyze.ts:123
getDependencyTree    	build.mjs:61
copyDependencies     	build.mjs:69
(anonymous function) 	build.mjs:74
run                  	module_job:194
Async call from await
runMainESM           	run_main:60
executeUserEntryPoint	run_main:83
(anonymous function) 	run_main_module:23

Here is my code:

const dependencies = [
    'zip-lib'
]

function getDependencyTree() {

    const lf = fse.readFileSync('../yarn.lock', 'utf-8')
    const pkg = fse.readFileSync('../package.json', 'utf-8')

    const snapshot = parse(lf, pkg) // Holds JSON-friendly TEntries[]
    const idx = analyze(snapshot)   // An index to represent repo dep graphs
    let tree = idx.tree;
    return Object.keys(tree)
        .filter(s => s.split(',').length > 1 && dependencies.indexOf(s.split(',')[1]) !== -1)
        .map(s => tree[s].chunks[tree[s].chunks.length - 1]);
}

function copyDependencies() {
    let tree = getDependencyTree()
    console.log(1)
}

//copy depts what angular not include
copyDependencies()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.