Skip to content

import keyword doesn't work #1

@chris-codaio

Description

@chris-codaio

Attempting to parse a jsonnet file which imports a second file appears to be broken in the node.js version.

Given something like "wrapper.js":

var path = require('path');
var Jsonnet = require('jsonnet');
var jsonnet = new Jsonnet();

if (process.argv.length != 3) {
  console.log("Usage: node wrapper.js <filename>\n");
  process.exit(1);
}
var full_path = path.resolve(process.argv[2]);
var result = jsonnet.evalFile(full_path);
console.log(result);

And files "test.jsonnet":

local test2 = import "test2.jsonnet";
{
  "lookup": test2["key"]
}

"test2.jsonnet":

{
  "key": "value"
}

Running
node wrapper.js test.jsonnet
Results in:

Error: RUNTIME ERROR: Couldn't open import "test2.jsonnet": No such file or directory
    snippet:1:15-78 thunk <test2>
    snippet:4:13-17 object <anonymous>
    During manifestation    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions