Skip to content

bin/condense does not support reading node modules #213

@Raynos

Description

@Raynos

This line ( https://github.com/marijnh/tern/blob/6844cfa8b05d3dc3f62eb3fa4736348852b33b4e/bin/condense#L68 ) uses path.resolve which won't work if you require("fs") or anything from npm.

Using resolve instead, which is the full node resolution algorithm would allow it to support build in modules and npm modules

The error I have is

$ ./node_modules/tern/bin/condense --plugin node index.js 

fs.js:338
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory '/home/raynos/Documents/send-data/buffer'
    at Object.fs.openSync (fs.js:338:18)
    at Object.fs.readFileSync (fs.js:182:15)
    at Object.tern.Server.getFile (/home/raynos/Documents/send-data/node_modules/tern/bin/condense:68:39)
    at ensureFile (/home/raynos/Documents/send-data/node_modules/tern/lib/tern.js:229:36)
    at Object.signal.mixin.addFile (/home/raynos/Documents/send-data/node_modules/tern/lib/tern.js:103:7)
    at resolveModule (/home/raynos/Documents/send-data/node_modules/tern/plugin/node.js:70:16)
    at tern.registerPlugin.server._node.modules (/home/raynos/Documents/send-data/node_modules/tern/plugin/node.js:97:16)
    at Object.exports.IsCallee.constraint.addType (/home/raynos/Documents/send-data/node_modules/tern/lib/infer.js:271:9)
    at withWorklist (/home/raynos/Documents/send-data/node_modules/tern/lib/infer.js:639:21)
    at Object.extend.propagate (/home/raynos/Documents/send-data/node_modules/tern/lib/infer.js:88:25)

Which is what happens when it tries to parse this line ( https://github.com/Raynos/send-data/blob/a3bad95e8e018a8e9f82f76868a17df1926b9375/index.js#L1 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions