Skip to content

Requiring capnp files not working. #122

@LiamKarlMitchell

Description

@LiamKarlMitchell

Wanting to make a custom compiler plugin for capnp with node v12.2.0 running on Windows 10.

Intent: I would be generating source output for js or typescript with extra features added in regarding the annotations that can be supplied in the capnp schema.

Looks like the loader for require capnp files is not working, any thoughts did I set something up wrong?

Used example from readme.

const capnp = require('capnp-ts');
const schema = require("./capnp/schema.capnp").CodeGeneratorRequest;
# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors
^

SyntaxError: Invalid or unexpected token
    at Module._compile (internal/modules/cjs/loader.js:703:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (D:\Source\OperationSpatial\capnp-to-jsbuffer\index.js:11:16)
    at Module._compile (internal/modules/cjs/loader.js:756:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)

Looking at the address book example in packages dir it requires a .js file which must first be generated.

Needed to use this command as capnpc was not found.

capnp compile -o js addressbook.capnp

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