capnpc-ts
Version:
Cap'n Proto schema compiler for TypeScript.
160 lines (158 loc) • 5.28 kB
JavaScript
"use strict";
/**
* @author jdiaz5513
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.VOID_TYPE = exports.VALUE = exports.TS_FILE_ID = exports.THIS = exports.STRUCT = exports.STRING_TYPE = exports.STATIC = exports.SOURCE_COMMENT = exports.READONLY = exports.OBJECT_SIZE = exports.NUMBER_TYPE = exports.Primitive = exports.LENGTH = exports.EXPORT = exports.ConcreteListType = exports.CAPNP = exports.BOOLEAN_TYPE = exports.__ = void 0;
const tslib_1 = require("tslib");
const s = tslib_1.__importStar(require("capnp-ts/src/std/schema.capnp.js"));
const debug_1 = tslib_1.__importDefault(require("debug"));
const typescript_1 = tslib_1.__importDefault(require("typescript"));
const trace = debug_1.default("capnpc:constants");
trace("load");
/** undefined */
exports.__ = undefined;
/** boolean */
exports.BOOLEAN_TYPE = typescript_1.default.createTypeReferenceNode("boolean", exports.__);
/** capnp */
exports.CAPNP = typescript_1.default.createIdentifier("capnp");
/** A Mapping of various types to their list type constructor. */
exports.ConcreteListType = {
[]: "capnp.AnyPointerList",
[]: "capnp.BoolList",
[]: "capnp.DataList",
[]: "capnp.Uint16List",
[]: "capnp.Float32List",
[]: "capnp.Float64List",
[]: "capnp.Int16List",
[]: "capnp.Int32List",
[]: "capnp.Int64List",
[]: "capnp.Int8List",
[]: "capnp.InterfaceList",
[]: "capnp.PointerList",
[]: "capnp.CompositeList",
[]: "capnp.TextList",
[]: "capnp.Uint16List",
[]: "capnp.Uint32List",
[]: "capnp.Uint64List",
[]: "capnp.Uint8List",
[]: "capnp.VoidList",
};
/** export */
exports.EXPORT = typescript_1.default.createToken(typescript_1.default.SyntaxKind.ExportKeyword);
/** length */
exports.LENGTH = typescript_1.default.createIdentifier("length");
/** Some data used to help generate code for primitive struct fields. */
exports.Primitive = {
[]: {
byteLength: 1,
getter: "getBit",
mask: "getBitMask",
setter: "setBit",
},
[]: {
byteLength: 2,
getter: "getUint16",
mask: "getUint16Mask",
setter: "setUint16",
},
[]: {
byteLength: 4,
getter: "getFloat32",
mask: "getFloat32Mask",
setter: "setFloat32",
},
[]: {
byteLength: 8,
getter: "getFloat64",
mask: "getFloat64Mask",
setter: "setFloat64",
},
[]: {
byteLength: 2,
getter: "getInt16",
mask: "getInt16Mask",
setter: "setInt16",
},
[]: {
byteLength: 4,
getter: "getInt32",
mask: "getInt32Mask",
setter: "setInt32",
},
[]: {
byteLength: 8,
getter: "getInt64",
mask: "getInt64Mask",
setter: "setInt64",
},
[]: {
byteLength: 1,
getter: "getInt8",
mask: "getInt8Mask",
setter: "setInt8",
},
[]: {
byteLength: 2,
getter: "getUint16",
mask: "getUint16Mask",
setter: "setUint16",
},
[]: {
byteLength: 4,
getter: "getUint32",
mask: "getUint32Mask",
setter: "setUint32",
},
[]: {
byteLength: 8,
getter: "getUint64",
mask: "getUint64Mask",
setter: "setUint64",
},
[]: {
byteLength: 1,
getter: "getUint8",
mask: "getUint8Mask",
setter: "setUint8",
},
[]: {
byteLength: 0,
getter: "getVoid",
mask: "getVoidMask",
setter: "setVoid",
},
};
/** number */
exports.NUMBER_TYPE = typescript_1.default.createTypeReferenceNode("number", exports.__);
/** __O */
// This is referenced so frequently it gets a shorthand!
exports.OBJECT_SIZE = typescript_1.default.createIdentifier("__O");
/** readonly */
exports.READONLY = typescript_1.default.createToken(typescript_1.default.SyntaxKind.ReadonlyKeyword);
/** No... comment? */
exports.SOURCE_COMMENT = `/* tslint:disable */
/**
* This file has been automatically generated by the [capnpc-ts utility](https://github.com/jdiaz5513/capnp-ts).
*/
`;
/** static */
exports.STATIC = typescript_1.default.createToken(typescript_1.default.SyntaxKind.StaticKeyword);
/** string */
exports.STRING_TYPE = typescript_1.default.createTypeReferenceNode("string", exports.__);
/** __S */
// This is referenced so frequently it gets a shorthand!
exports.STRUCT = typescript_1.default.createIdentifier("__S");
/** this */
exports.THIS = typescript_1.default.createThis();
/**
* Used to look up the ts.capnp file by its ID.
*
* NOTE: The file ID should never change.
*/
exports.TS_FILE_ID = "e37ded525a68a7c9";
/** value */
exports.VALUE = typescript_1.default.createIdentifier("value");
/** void */
exports.VOID_TYPE = typescript_1.default.createTypeReferenceNode("void", exports.__);
//# sourceMappingURL=constants.js.map