Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler won't work outside of src repo #174

Open
madhavajay opened this issue Jan 10, 2023 · 2 comments
Open

Compiler won't work outside of src repo #174

madhavajay opened this issue Jan 10, 2023 · 2 comments

Comments

@madhavajay
Copy link

I am trying to use the capnpc-ts compiler but it only works if I run it from inside a checkout of https://github.com/jdiaz5513/capnp-ts.

For example:

$ pwd
/Users/madhavajay/dev/capnp-ts
$ capnpc -o ./node_modules/capnpc-ts/bin/capnpc-ts.js address.capnp
$ ls | grep address
address.capnp
address.capnp.d.ts
address.capnp.js

However if I use either:

$ npm install -g capnpc-ts
$ pwd
/Users/madhavajay/dev/my_project
$ capnpc -o ts address.capnp

or the same with:

$ capnpc -o ts./node_modules/capnpc-ts/bin/capnpc-ts.js address.capnp

Error:

DeprecationWarning: 'createTypeReferenceNode' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createIdentifier' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createToken' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createThis' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createNamespaceImport' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createImportClause' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createLiteral' has been deprecated since v4.0.0. Use `factory.createStringLiteral`, `factory.createStringLiteralFromNode`, `factory.createNumericLiteral`, `factory.createBigIntLiteral`, `factory.createTrue`, `factory.createFalse`, or the factory supplied by your transformation context instead.
DeprecationWarning: 'createImportDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createExpressionStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createVariableDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createVariableDeclarationList' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createVariableStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createPropertyAssignment' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createNumericLiteral' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createNewExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createObjectLiteralExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createPropertyDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: '' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createCallExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createReturnStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createBlock' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createMethodDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createParameterDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createBinaryExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createExpressionWithTypeArguments' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createHeritageClause' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createClassDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
TypeError: Cannot create property 'pos' on string 'Foo'
    at setTextRangePos (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:21342:19)
    at Object.setTextRangePosEnd (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:21360:32)
    at createNodeArray (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:22985:16)
    at asNodeArray (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:27581:28)
    at createBaseGenericNamedDeclaration (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:23037:35)
    at createBaseInterfaceOrClassLikeDeclaration (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:23072:24)
    at createBaseClassLikeDeclaration (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:23078:24)
    at Object.createClassDeclaration (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:25474:24)
    at Object.createClassDeclaration (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:3138:29)
    at generateStructNode (/Users/madhavajay/my_proj/node_modules/capnpc-ts/src/generators.js:488:36)
./node_modules/capnpc-ts/bin/capnpc-ts.js: plugin failed: exit code 1

I have tried copying a few of the tsconfig files over but I think im missing something more obvious.

package.json

{
  "name": "js",
  "version": "1.0.0",
  "description": "",
  "main": "testing.js",
  "dependencies": {
    "capnp-ts": "^0.7.0",
    "capnpc-ts": "^0.7.0",
    "fetch": "^1.1.0",
    "goog": "^0.2.1",
    "node-fetch": "^3.1.0",
    "system-sleep": "^1.3.7"
  },
  "devDependencies": {
    "ts-node": "^9.1.1",
    "typescript": "^4.2.4"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "type": "module",
  "author": "",
  "license": "ISC"
}
@Zk2u
Copy link

Zk2u commented Jan 13, 2023

Also getting this same issue

@SarantopoulosKon
Copy link

I'm getting same error TypeError: Cannot create property 'pos' on string 'Query' with the latest version 0.7.0. Haven't tested with local build, master is ahead by 3 commits so i wonder if there is a fix there, that's why it's working for @madhavajay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants