diff --git a/.prettierignore b/.prettierignore
index 97905e42c2..dab25cd2a2 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,2 +1 @@
-js/msg_generated.ts
js/flatbuffers.js
diff --git a/BUILD.gn b/BUILD.gn
index 848dc6a59a..824c505335 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -194,11 +194,11 @@ run_node("bundle") {
"js/dispatch.ts",
"js/globals.ts",
"js/main.ts",
- "js/msg_generated.ts",
"js/os.ts",
"js/runtime.ts",
"js/types.ts",
"js/util.ts",
+ "src/msg.fbs",
"rollup.config.js",
"tsconfig.json",
]
@@ -207,7 +207,7 @@ run_node("bundle") {
out_dir + "main.js.map",
]
deps = [
- ":flatbufferjs",
+ ":msg_ts",
]
args = [
"./node_modules/rollup/bin/rollup",
@@ -237,34 +237,6 @@ source_set("libdeno_nosnapshot") {
defines = [ "BUNDLE_LOCATION=\"$bundle_location\"" ]
}
-# Generates flatbuffer TypeScript code.
-# TODO(ry) Ideally flatc output files should be written into
-# target_gen_dir, but its difficult to get this working in a way that the
-# bundler can resolve their location. (The bundler does not support NODE_PATH?)
-# Therefore this hack: write the msg_generated.ts output
-# into the js/ folder, and we check it into the repo. Hopefully this hack can
-# be removed at some point. If msg.fps is changed, commit changes to the
-# generated JS files. The stamp file is just to make gn work.
-action("flatbufferjs") {
- script = "//tools/flatbufferjs_hack.py"
- sources = [
- "src/msg.fbs",
- ]
- outputs = [
- "$target_gen_dir/flatbufferjs_hack.stamp",
- ]
-
- args = [
- rebase_path("$target_gen_dir/msg_generated.ts", root_build_dir),
- rebase_path("js/msg_generated.ts", root_build_dir),
- rebase_path(outputs[0], root_build_dir),
- ]
-
- deps = [
- ":msg_ts",
- ]
-}
-
ts_flatbuffer("msg_ts") {
sources = [
"src/msg.fbs",
diff --git a/js/main.ts b/js/main.ts
index 7c6fc7dc57..f5fa0b6acb 100644
--- a/js/main.ts
+++ b/js/main.ts
@@ -2,7 +2,7 @@
// tslint:disable-next-line:no-reference
///
import { flatbuffers } from "flatbuffers";
-import { deno as fbs } from "./msg_generated";
+import { deno as fbs } from "gen/msg_generated";
import { assert, log } from "./util";
import * as runtime from "./runtime";
diff --git a/js/msg_generated.ts b/js/msg_generated.ts
deleted file mode 100644
index 83d75490f2..0000000000
--- a/js/msg_generated.ts
+++ /dev/null
@@ -1,1812 +0,0 @@
-// automatically generated by the FlatBuffers compiler, do not modify
-
-/**
- * @enum
- */
-export namespace deno{
-export enum Any{
- NONE= 0,
- Start= 1,
- StartRes= 2,
- CodeFetch= 3,
- CodeFetchRes= 4,
- CodeCache= 5,
- Exit= 6,
- TimerStart= 7,
- TimerReady= 8,
- TimerClear= 9,
- FetchReq= 10,
- FetchRes= 11,
- ReadFileSync= 12,
- ReadFileSyncRes= 13,
- WriteFileSync= 14
-}};
-
-/**
- * @constructor
- */
-export namespace deno{
-export class Base {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {Base}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):Base {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {Base=} obj
- * @returns {Base}
- */
-static getRootAsBase(bb:flatbuffers.ByteBuffer, obj?:Base):Base {
- return (obj || new Base).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @returns {number}
- */
-cmdId():number {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
-};
-
-/**
- * @param {number} value
- * @returns {boolean}
- */
-mutate_cmdId(value:number):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 4);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeUint32(this.bb_pos + offset, value);
- return true;
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-error():string|null
-error(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-error(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @returns {deno.Any}
- */
-msgType():deno.Any {
- var offset = this.bb!.__offset(this.bb_pos, 8);
- return offset ? /** @type {deno.Any} */ (this.bb!.readUint8(this.bb_pos + offset)) : deno.Any.NONE;
-};
-
-/**
- * @param {deno.Any} value
- * @returns {boolean}
- */
-mutate_msg_type(value:deno.Any):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 8);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeUint8(this.bb_pos + offset, value);
- return true;
-};
-
-/**
- * @param {flatbuffers.Table} obj
- * @returns {?flatbuffers.Table}
- */
-msg(obj:T):T|null {
- var offset = this.bb!.__offset(this.bb_pos, 10);
- return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startBase(builder:flatbuffers.Builder) {
- builder.startObject(4);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} cmdId
- */
-static addCmdId(builder:flatbuffers.Builder, cmdId:number) {
- builder.addFieldInt32(0, cmdId, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} errorOffset
- */
-static addError(builder:flatbuffers.Builder, errorOffset:flatbuffers.Offset) {
- builder.addFieldOffset(1, errorOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {deno.Any} msgType
- */
-static addMsgType(builder:flatbuffers.Builder, msgType:deno.Any) {
- builder.addFieldInt8(2, msgType, deno.Any.NONE);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} msgOffset
- */
-static addMsg(builder:flatbuffers.Builder, msgOffset:flatbuffers.Offset) {
- builder.addFieldOffset(3, msgOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endBase(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class Start {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {Start}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):Start {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {Start=} obj
- * @returns {Start}
- */
-static getRootAsStart(bb:flatbuffers.ByteBuffer, obj?:Start):Start {
- return (obj || new Start).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @returns {number}
- */
-unused():number {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.readInt8(this.bb_pos + offset) : 0;
-};
-
-/**
- * @param {number} value
- * @returns {boolean}
- */
-mutate_unused(value:number):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 4);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeInt8(this.bb_pos + offset, value);
- return true;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startStart(builder:flatbuffers.Builder) {
- builder.startObject(1);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} unused
- */
-static addUnused(builder:flatbuffers.Builder, unused:number) {
- builder.addFieldInt8(0, unused, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endStart(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class StartRes {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {StartRes}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):StartRes {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {StartRes=} obj
- * @returns {StartRes}
- */
-static getRootAsStartRes(bb:flatbuffers.ByteBuffer, obj?:StartRes):StartRes {
- return (obj || new StartRes).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-cwd():string|null
-cwd(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-cwd(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {number} index
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array}
- */
-argv(index: number):string
-argv(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
-argv(index: number,optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
-};
-
-/**
- * @returns {number}
- */
-argvLength():number {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
-};
-
-/**
- * @returns {boolean}
- */
-debugFlag():boolean {
- var offset = this.bb!.__offset(this.bb_pos, 8);
- return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
-};
-
-/**
- * @param {boolean} value
- * @returns {boolean}
- */
-mutate_debug_flag(value:boolean):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 8);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeInt8(this.bb_pos + offset, +value);
- return true;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startStartRes(builder:flatbuffers.Builder) {
- builder.startObject(3);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} cwdOffset
- */
-static addCwd(builder:flatbuffers.Builder, cwdOffset:flatbuffers.Offset) {
- builder.addFieldOffset(0, cwdOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} argvOffset
- */
-static addArgv(builder:flatbuffers.Builder, argvOffset:flatbuffers.Offset) {
- builder.addFieldOffset(1, argvOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {Array.} data
- * @returns {flatbuffers.Offset}
- */
-static createArgvVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
- builder.startVector(4, data.length, 4);
- for (var i = data.length - 1; i >= 0; i--) {
- builder.addOffset(data[i]);
- }
- return builder.endVector();
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} numElems
- */
-static startArgvVector(builder:flatbuffers.Builder, numElems:number) {
- builder.startVector(4, numElems, 4);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {boolean} debugFlag
- */
-static addDebugFlag(builder:flatbuffers.Builder, debugFlag:boolean) {
- builder.addFieldInt8(2, +debugFlag, +false);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endStartRes(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class CodeFetch {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {CodeFetch}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):CodeFetch {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {CodeFetch=} obj
- * @returns {CodeFetch}
- */
-static getRootAsCodeFetch(bb:flatbuffers.ByteBuffer, obj?:CodeFetch):CodeFetch {
- return (obj || new CodeFetch).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-moduleSpecifier():string|null
-moduleSpecifier(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-moduleSpecifier(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-containingFile():string|null
-containingFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-containingFile(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startCodeFetch(builder:flatbuffers.Builder) {
- builder.startObject(2);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} moduleSpecifierOffset
- */
-static addModuleSpecifier(builder:flatbuffers.Builder, moduleSpecifierOffset:flatbuffers.Offset) {
- builder.addFieldOffset(0, moduleSpecifierOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} containingFileOffset
- */
-static addContainingFile(builder:flatbuffers.Builder, containingFileOffset:flatbuffers.Offset) {
- builder.addFieldOffset(1, containingFileOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endCodeFetch(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class CodeFetchRes {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {CodeFetchRes}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):CodeFetchRes {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {CodeFetchRes=} obj
- * @returns {CodeFetchRes}
- */
-static getRootAsCodeFetchRes(bb:flatbuffers.ByteBuffer, obj?:CodeFetchRes):CodeFetchRes {
- return (obj || new CodeFetchRes).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-moduleName():string|null
-moduleName(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-moduleName(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-filename():string|null
-filename(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-filename(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-sourceCode():string|null
-sourceCode(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-sourceCode(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 8);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-outputCode():string|null
-outputCode(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-outputCode(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 10);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startCodeFetchRes(builder:flatbuffers.Builder) {
- builder.startObject(4);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} moduleNameOffset
- */
-static addModuleName(builder:flatbuffers.Builder, moduleNameOffset:flatbuffers.Offset) {
- builder.addFieldOffset(0, moduleNameOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} filenameOffset
- */
-static addFilename(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset) {
- builder.addFieldOffset(1, filenameOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} sourceCodeOffset
- */
-static addSourceCode(builder:flatbuffers.Builder, sourceCodeOffset:flatbuffers.Offset) {
- builder.addFieldOffset(2, sourceCodeOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} outputCodeOffset
- */
-static addOutputCode(builder:flatbuffers.Builder, outputCodeOffset:flatbuffers.Offset) {
- builder.addFieldOffset(3, outputCodeOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endCodeFetchRes(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class CodeCache {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {CodeCache}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):CodeCache {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {CodeCache=} obj
- * @returns {CodeCache}
- */
-static getRootAsCodeCache(bb:flatbuffers.ByteBuffer, obj?:CodeCache):CodeCache {
- return (obj || new CodeCache).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-filename():string|null
-filename(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-filename(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-sourceCode():string|null
-sourceCode(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-sourceCode(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-outputCode():string|null
-outputCode(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-outputCode(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 8);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startCodeCache(builder:flatbuffers.Builder) {
- builder.startObject(3);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} filenameOffset
- */
-static addFilename(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset) {
- builder.addFieldOffset(0, filenameOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} sourceCodeOffset
- */
-static addSourceCode(builder:flatbuffers.Builder, sourceCodeOffset:flatbuffers.Offset) {
- builder.addFieldOffset(1, sourceCodeOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} outputCodeOffset
- */
-static addOutputCode(builder:flatbuffers.Builder, outputCodeOffset:flatbuffers.Offset) {
- builder.addFieldOffset(2, outputCodeOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endCodeCache(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class Exit {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {Exit}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):Exit {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {Exit=} obj
- * @returns {Exit}
- */
-static getRootAsExit(bb:flatbuffers.ByteBuffer, obj?:Exit):Exit {
- return (obj || new Exit).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @returns {number}
- */
-code():number {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
-};
-
-/**
- * @param {number} value
- * @returns {boolean}
- */
-mutate_code(value:number):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 4);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeInt32(this.bb_pos + offset, value);
- return true;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startExit(builder:flatbuffers.Builder) {
- builder.startObject(1);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} code
- */
-static addCode(builder:flatbuffers.Builder, code:number) {
- builder.addFieldInt32(0, code, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endExit(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class TimerStart {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {TimerStart}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):TimerStart {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {TimerStart=} obj
- * @returns {TimerStart}
- */
-static getRootAsTimerStart(bb:flatbuffers.ByteBuffer, obj?:TimerStart):TimerStart {
- return (obj || new TimerStart).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @returns {number}
- */
-id():number {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
-};
-
-/**
- * @param {number} value
- * @returns {boolean}
- */
-mutate_id(value:number):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 4);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeUint32(this.bb_pos + offset, value);
- return true;
-};
-
-/**
- * @returns {boolean}
- */
-interval():boolean {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
-};
-
-/**
- * @param {boolean} value
- * @returns {boolean}
- */
-mutate_interval(value:boolean):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 6);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeInt8(this.bb_pos + offset, +value);
- return true;
-};
-
-/**
- * @returns {number}
- */
-delay():number {
- var offset = this.bb!.__offset(this.bb_pos, 8);
- return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
-};
-
-/**
- * @param {number} value
- * @returns {boolean}
- */
-mutate_delay(value:number):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 8);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeInt32(this.bb_pos + offset, value);
- return true;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startTimerStart(builder:flatbuffers.Builder) {
- builder.startObject(3);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} id
- */
-static addId(builder:flatbuffers.Builder, id:number) {
- builder.addFieldInt32(0, id, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {boolean} interval
- */
-static addInterval(builder:flatbuffers.Builder, interval:boolean) {
- builder.addFieldInt8(1, +interval, +false);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} delay
- */
-static addDelay(builder:flatbuffers.Builder, delay:number) {
- builder.addFieldInt32(2, delay, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endTimerStart(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class TimerReady {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {TimerReady}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):TimerReady {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {TimerReady=} obj
- * @returns {TimerReady}
- */
-static getRootAsTimerReady(bb:flatbuffers.ByteBuffer, obj?:TimerReady):TimerReady {
- return (obj || new TimerReady).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @returns {number}
- */
-id():number {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
-};
-
-/**
- * @param {number} value
- * @returns {boolean}
- */
-mutate_id(value:number):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 4);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeUint32(this.bb_pos + offset, value);
- return true;
-};
-
-/**
- * @returns {boolean}
- */
-done():boolean {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
-};
-
-/**
- * @param {boolean} value
- * @returns {boolean}
- */
-mutate_done(value:boolean):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 6);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeInt8(this.bb_pos + offset, +value);
- return true;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startTimerReady(builder:flatbuffers.Builder) {
- builder.startObject(2);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} id
- */
-static addId(builder:flatbuffers.Builder, id:number) {
- builder.addFieldInt32(0, id, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {boolean} done
- */
-static addDone(builder:flatbuffers.Builder, done:boolean) {
- builder.addFieldInt8(1, +done, +false);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endTimerReady(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class TimerClear {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {TimerClear}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):TimerClear {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {TimerClear=} obj
- * @returns {TimerClear}
- */
-static getRootAsTimerClear(bb:flatbuffers.ByteBuffer, obj?:TimerClear):TimerClear {
- return (obj || new TimerClear).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @returns {number}
- */
-id():number {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
-};
-
-/**
- * @param {number} value
- * @returns {boolean}
- */
-mutate_id(value:number):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 4);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeUint32(this.bb_pos + offset, value);
- return true;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startTimerClear(builder:flatbuffers.Builder) {
- builder.startObject(1);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} id
- */
-static addId(builder:flatbuffers.Builder, id:number) {
- builder.addFieldInt32(0, id, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endTimerClear(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class FetchReq {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {FetchReq}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):FetchReq {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {FetchReq=} obj
- * @returns {FetchReq}
- */
-static getRootAsFetchReq(bb:flatbuffers.ByteBuffer, obj?:FetchReq):FetchReq {
- return (obj || new FetchReq).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @returns {number}
- */
-id():number {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
-};
-
-/**
- * @param {number} value
- * @returns {boolean}
- */
-mutate_id(value:number):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 4);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeUint32(this.bb_pos + offset, value);
- return true;
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-url():string|null
-url(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-url(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startFetchReq(builder:flatbuffers.Builder) {
- builder.startObject(2);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} id
- */
-static addId(builder:flatbuffers.Builder, id:number) {
- builder.addFieldInt32(0, id, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} urlOffset
- */
-static addUrl(builder:flatbuffers.Builder, urlOffset:flatbuffers.Offset) {
- builder.addFieldOffset(1, urlOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endFetchReq(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class FetchRes {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {FetchRes}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):FetchRes {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {FetchRes=} obj
- * @returns {FetchRes}
- */
-static getRootAsFetchRes(bb:flatbuffers.ByteBuffer, obj?:FetchRes):FetchRes {
- return (obj || new FetchRes).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @returns {number}
- */
-id():number {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
-};
-
-/**
- * @param {number} value
- * @returns {boolean}
- */
-mutate_id(value:number):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 4);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeUint32(this.bb_pos + offset, value);
- return true;
-};
-
-/**
- * @returns {number}
- */
-status():number {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
-};
-
-/**
- * @param {number} value
- * @returns {boolean}
- */
-mutate_status(value:number):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 6);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeInt32(this.bb_pos + offset, value);
- return true;
-};
-
-/**
- * @param {number} index
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array}
- */
-headerLine(index: number):string
-headerLine(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
-headerLine(index: number,optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 8);
- return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
-};
-
-/**
- * @returns {number}
- */
-headerLineLength():number {
- var offset = this.bb!.__offset(this.bb_pos, 8);
- return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
-};
-
-/**
- * @param {number} index
- * @returns {number}
- */
-body(index: number):number|null {
- var offset = this.bb!.__offset(this.bb_pos, 10);
- return offset ? this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
-};
-
-/**
- * @returns {number}
- */
-bodyLength():number {
- var offset = this.bb!.__offset(this.bb_pos, 10);
- return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
-};
-
-/**
- * @returns {Int8Array}
- */
-bodyArray():Int8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 10);
- return offset ? new Int8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startFetchRes(builder:flatbuffers.Builder) {
- builder.startObject(4);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} id
- */
-static addId(builder:flatbuffers.Builder, id:number) {
- builder.addFieldInt32(0, id, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} status
- */
-static addStatus(builder:flatbuffers.Builder, status:number) {
- builder.addFieldInt32(1, status, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} headerLineOffset
- */
-static addHeaderLine(builder:flatbuffers.Builder, headerLineOffset:flatbuffers.Offset) {
- builder.addFieldOffset(2, headerLineOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {Array.} data
- * @returns {flatbuffers.Offset}
- */
-static createHeaderLineVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
- builder.startVector(4, data.length, 4);
- for (var i = data.length - 1; i >= 0; i--) {
- builder.addOffset(data[i]);
- }
- return builder.endVector();
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} numElems
- */
-static startHeaderLineVector(builder:flatbuffers.Builder, numElems:number) {
- builder.startVector(4, numElems, 4);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} bodyOffset
- */
-static addBody(builder:flatbuffers.Builder, bodyOffset:flatbuffers.Offset) {
- builder.addFieldOffset(3, bodyOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {Array.} data
- * @returns {flatbuffers.Offset}
- */
-static createBodyVector(builder:flatbuffers.Builder, data:number[] | Uint8Array):flatbuffers.Offset {
- builder.startVector(1, data.length, 1);
- for (var i = data.length - 1; i >= 0; i--) {
- builder.addInt8(data[i]);
- }
- return builder.endVector();
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} numElems
- */
-static startBodyVector(builder:flatbuffers.Builder, numElems:number) {
- builder.startVector(1, numElems, 1);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endFetchRes(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class ReadFileSync {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {ReadFileSync}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):ReadFileSync {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {ReadFileSync=} obj
- * @returns {ReadFileSync}
- */
-static getRootAsReadFileSync(bb:flatbuffers.ByteBuffer, obj?:ReadFileSync):ReadFileSync {
- return (obj || new ReadFileSync).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-filename():string|null
-filename(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-filename(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startReadFileSync(builder:flatbuffers.Builder) {
- builder.startObject(1);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} filenameOffset
- */
-static addFilename(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset) {
- builder.addFieldOffset(0, filenameOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endReadFileSync(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class ReadFileSyncRes {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {ReadFileSyncRes}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):ReadFileSyncRes {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {ReadFileSyncRes=} obj
- * @returns {ReadFileSyncRes}
- */
-static getRootAsReadFileSyncRes(bb:flatbuffers.ByteBuffer, obj?:ReadFileSyncRes):ReadFileSyncRes {
- return (obj || new ReadFileSyncRes).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @param {number} index
- * @returns {number}
- */
-data(index: number):number|null {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
-};
-
-/**
- * @returns {number}
- */
-dataLength():number {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
-};
-
-/**
- * @returns {Int8Array}
- */
-dataArray():Int8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? new Int8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startReadFileSyncRes(builder:flatbuffers.Builder) {
- builder.startObject(1);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} dataOffset
- */
-static addData(builder:flatbuffers.Builder, dataOffset:flatbuffers.Offset) {
- builder.addFieldOffset(0, dataOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {Array.} data
- * @returns {flatbuffers.Offset}
- */
-static createDataVector(builder:flatbuffers.Builder, data:number[] | Uint8Array):flatbuffers.Offset {
- builder.startVector(1, data.length, 1);
- for (var i = data.length - 1; i >= 0; i--) {
- builder.addInt8(data[i]);
- }
- return builder.endVector();
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} numElems
- */
-static startDataVector(builder:flatbuffers.Builder, numElems:number) {
- builder.startVector(1, numElems, 1);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endReadFileSyncRes(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
-/**
- * @constructor
- */
-export namespace deno{
-export class WriteFileSync {
- /**
- * @type {flatbuffers.ByteBuffer}
- */
- bb: flatbuffers.ByteBuffer|null = null;
-
- /**
- * @type {number}
- */
- bb_pos:number = 0;
-/**
- * @param {number} i
- * @param {flatbuffers.ByteBuffer} bb
- * @returns {WriteFileSync}
- */
-__init(i:number, bb:flatbuffers.ByteBuffer):WriteFileSync {
- this.bb_pos = i;
- this.bb = bb;
- return this;
-};
-
-/**
- * @param {flatbuffers.ByteBuffer} bb
- * @param {WriteFileSync=} obj
- * @returns {WriteFileSync}
- */
-static getRootAsWriteFileSync(bb:flatbuffers.ByteBuffer, obj?:WriteFileSync):WriteFileSync {
- return (obj || new WriteFileSync).__init(bb.readInt32(bb.position()) + bb.position(), bb);
-};
-
-/**
- * @param {flatbuffers.Encoding=} optionalEncoding
- * @returns {string|Uint8Array|null}
- */
-filename():string|null
-filename(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
-filename(optionalEncoding?:any):string|Uint8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 4);
- return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
-};
-
-/**
- * @param {number} index
- * @returns {number}
- */
-data(index: number):number|null {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
-};
-
-/**
- * @returns {number}
- */
-dataLength():number {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
-};
-
-/**
- * @returns {Int8Array}
- */
-dataArray():Int8Array|null {
- var offset = this.bb!.__offset(this.bb_pos, 6);
- return offset ? new Int8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
-};
-
-/**
- * @returns {number}
- */
-perm():number {
- var offset = this.bb!.__offset(this.bb_pos, 8);
- return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
-};
-
-/**
- * @param {number} value
- * @returns {boolean}
- */
-mutate_perm(value:number):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 8);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeUint32(this.bb_pos + offset, value);
- return true;
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- */
-static startWriteFileSync(builder:flatbuffers.Builder) {
- builder.startObject(3);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} filenameOffset
- */
-static addFilename(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset) {
- builder.addFieldOffset(0, filenameOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {flatbuffers.Offset} dataOffset
- */
-static addData(builder:flatbuffers.Builder, dataOffset:flatbuffers.Offset) {
- builder.addFieldOffset(1, dataOffset, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {Array.} data
- * @returns {flatbuffers.Offset}
- */
-static createDataVector(builder:flatbuffers.Builder, data:number[] | Uint8Array):flatbuffers.Offset {
- builder.startVector(1, data.length, 1);
- for (var i = data.length - 1; i >= 0; i--) {
- builder.addInt8(data[i]);
- }
- return builder.endVector();
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} numElems
- */
-static startDataVector(builder:flatbuffers.Builder, numElems:number) {
- builder.startVector(1, numElems, 1);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @param {number} perm
- */
-static addPerm(builder:flatbuffers.Builder, perm:number) {
- builder.addFieldInt32(2, perm, 0);
-};
-
-/**
- * @param {flatbuffers.Builder} builder
- * @returns {flatbuffers.Offset}
- */
-static endWriteFileSync(builder:flatbuffers.Builder):flatbuffers.Offset {
- var offset = builder.endObject();
- return offset;
-};
-
-}
-}
diff --git a/js/os.ts b/js/os.ts
index d13519584a..0dc9aeadc4 100644
--- a/js/os.ts
+++ b/js/os.ts
@@ -1,6 +1,6 @@
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
import { ModuleInfo } from "./types";
-import { deno as fbs } from "./msg_generated";
+import { deno as fbs } from "gen/msg_generated";
import { assert } from "./util";
import * as util from "./util";
import { flatbuffers } from "flatbuffers";
diff --git a/rollup.config.js b/rollup.config.js
index 835203d218..eb7dc043d6 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -13,6 +13,16 @@ const typescriptPath = `${
process.env.BASEPATH
}/third_party/node_modules/typescript/lib/typescript.js`;
+// We will allow generated modules to be resolvable by TypeScript based on
+// the current build path
+const tsconfigOverride = {
+ compilerOptions: {
+ paths: {
+ "*": ["*", path.join(process.cwd(), "*")]
+ }
+ }
+};
+
// this is a rollup plugin which will look for imports ending with `!string` and resolve
// them with a module that will inline the contents of the file as a string. Needed to
// support `js/assets.ts`.
@@ -48,6 +58,23 @@ function strings({ include, exclude } = {}) {
};
}
+// This plugin resolves at bundle time any generated resources that are
+// in the build path under `gen` and specified with a MID starting with `gen/`.
+// The plugin assumes that the MID needs to have the `.ts` extension appended.
+function resolveGenerated() {
+ return {
+ name: "resolve-msg-generated",
+ resolveId(importee) {
+ if (importee.startsWith("gen/")) {
+ const resolved = path.resolve(
+ path.join(process.cwd(), `${importee}.ts`)
+ );
+ return resolved;
+ }
+ }
+ };
+}
+
export default function makeConfig(commandOptions) {
return {
output: {
@@ -70,6 +97,9 @@ export default function makeConfig(commandOptions) {
module: mockPath
}),
+ // Resolves any resources that have been generated at build time
+ resolveGenerated(),
+
// Allows rollup to resolve modules based on Node.js resolution
nodeResolve({
jsnext: true,
@@ -93,15 +123,18 @@ export default function makeConfig(commandOptions) {
}),
typescript({
- // The build script is invoked from `out/Target` and so config is located alongside this file
+ // The build script is invoked from `out/:target` so passing an absolute file path is needed
tsconfig,
+ // This provides any overrides to the `tsconfig.json` that are needed to bundle
+ tsconfigOverride,
+
// By default, the include path only includes the cwd and below, need to include the root of the project
- // to be passed to this plugin. This is different front tsconfig.json include
- include: ["*.ts", `${__dirname}/**/*.ts`],
+ // and build path to be passed to this plugin. This is different front tsconfig.json include
+ include: ["*.ts", `${__dirname}/**/*.ts`, `${process.cwd()}/**/*.ts`],
// d.ts files are not bundled and by default like include, it only includes the cwd and below
- exclude: ["*.d.ts", `${__dirname}/**/*.d.ts`]
+ exclude: ["*.d.ts", `${__dirname}/**/*.d.ts`, `${process.cwd()}/**/*.d.ts`]
}),
// Provides inlining of file contents for `js/assets.ts`
diff --git a/tools/flatbufferjs_hack.py b/tools/flatbufferjs_hack.py
deleted file mode 100755
index 163a1893cb..0000000000
--- a/tools/flatbufferjs_hack.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env python
-"""
-gn can only run python scripts.
-
-Generates flatbuffer TypeScript code.
-"""
-import subprocess
-import sys
-import os
-import shutil
-import util
-
-# TODO(ry) Ideally flatc output files should be written into target_gen_dir, but
-# its difficult to get this working in a way that parcel can resolve their
-# location. (Parcel does not support NODE_PATH.) Therefore this hack: write the
-# generated msg_generated.ts outputs into the js/ folder, and we check them into
-# the repo. Hopefully this hack can be removed at some point. If msg.fps is
-# changed, commit changes to the generated JS file.
-
-src = sys.argv[1]
-dst = sys.argv[2]
-stamp_file = sys.argv[3]
-
-shutil.copyfile(src, dst)
-
-util.touch(stamp_file)
diff --git a/tools/format.py b/tools/format.py
index 2bbc95bed4..c25a78051d 100755
--- a/tools/format.py
+++ b/tools/format.py
@@ -23,7 +23,7 @@ run(["yapf", "-i"] + find_exts("tools/", ".py") +
find_exts("build_extra", ".py"))
run(["node", prettier, "--write"] + find_exts("js/", ".js", ".ts") +
- ["tsconfig.json", "tslint.json"])
+ ["rollup.config.js", "tsconfig.json", "tslint.json"])
# Set RUSTFMT_FLAGS for extra flags.
rustfmt_extra_args = []
diff --git a/tsconfig.json b/tsconfig.json
index d78a817640..adc2b8bf37 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"allowJs": true,
+ "baseUrl": ".",
"module": "esnext",
"noImplicitAny": true,
"sourceMap": true,
@@ -12,7 +13,10 @@
"pretty": true,
"noFallthroughCasesInSwitch": true,
"allowUnreachableCode": false,
- "experimentalDecorators": true
+ "experimentalDecorators": true,
+ "paths": {
+ "*": [ "*", "out/debug/*", "out/default/*", "out/release/*" ]
+ }
},
"include": ["js/main.ts"],
"exclude": ["node_modules"]