Git Product home page Git Product logo

fs-merger's People

Contributors

chriseppstein avatar rwjblue avatar sparshithnr avatar stefanpenner avatar swornimbarahi avatar thoov avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fs-merger's Issues

Accessing `at` using `FSMerger.fs` proxy causes error.

let fsMerger = new FSMerger([`a`,`b`]);
let fileAt = fsMerger.fs.at(1).readFileSync('test.txt'); //errors
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type number
      at validateString (internal/validators.js:112:11)
      at Object.isAbsolute (path.js:1030:5)
      at FSMerger.handleOperation (node_modules/fs-merger/dist/index.js:51:15)

`FSMerger.prototype.entries()` should likely not error

Running: this.input.entries() currently throws with:

> this.input.entries()
NodeError: The "path" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Object.isAbsolute (path.js:1136:5)
    at FSMerger.handleOperation (/Users/spenner/src/stefanpenner/gql-experiment/node_modules/fs-merger/dist/index.js:54:39)
    at eval (eval at build (/Users/spenner/src/stefanpenner/gql-experiment/index.js:7:5), <anonymous>:1:12)
    at GQL.build (/Users/spenner/src/stefanpenner/gql-experiment/index.js:7:5)
    at TransformNodeWrapper.build (/Users/spenner/src/stefanpenner/gql-experiment/node_modules/broccoli/dist/wrappers/transform-node.js:70:39)
    at pipeline.then (/Users/spenner/src/stefanpenner/gql-experiment/node_modules/broccoli/dist/builder.js:118:30)
    at process._tickCallback (internal/process/next_tick.js:68:7)

This isn't super helpful, it should likely rather just assume the caller wants all relevant entries.

this.input.entries() should likely perform like this.input.entries('.')


sh

Error about unsupported API's seems incorrect

https://github.com/SparshithNR/fs-merger/blob/021b9075fe08d28edb99c550bdae6b41080e3fa4/index.js#L72

This error that is thrown suggests that only whitelisted operations are allowed. The operations in this constant are:

https://github.com/SparshithNR/fs-merger/blob/021b9075fe08d28edb99c550bdae6b41080e3fa4/index.js#L6-L12

However, we also allow the end consumer to call any method on the fs-merger itself:

https://github.com/SparshithNR/fs-merger/blob/021b9075fe08d28edb99c550bdae6b41080e3fa4/index.js#L48-L55

This means that users in broccoli-land could do this.input.readdir (note: not the sync version) and get this implementation:

https://github.com/SparshithNR/fs-merger/blob/021b9075fe08d28edb99c550bdae6b41080e3fa4/index.js#L156

When multiple trees contain a given file, which should win?

In general with broccoli-merge-trees rules, the "last one wins" (but only if you've specified { overwrite: true }. This library also supports "last wins", but it still reads from each tree. See implementation here:

https://github.com/SparshithNR/fs-merger/blob/021b9075fe08d28edb99c550bdae6b41080e3fa4/index.js#L78-L89

If we do indeed intend to support "last wins" we should update the implementations to avoid reading files only to throw away those results (e.g. we should iterate backwards and return the first match).

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.