mirror of
https://github.com/valitydev/thrift-ts.git
synced 2024-11-06 00:35:23 +00:00
refactor thrift-parser wrapper
This commit is contained in:
parent
fa2397dbd7
commit
82d86f5972
@ -1,2 +1,3 @@
|
||||
package.json
|
||||
package-lock.json
|
||||
package-lock.json
|
||||
node_modules
|
@ -1,6 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "10"
|
||||
- "10"
|
||||
cache:
|
||||
directories:
|
||||
- "node_modules"
|
||||
directories:
|
||||
- "node_modules"
|
||||
|
@ -1,5 +1,5 @@
|
||||
import path = require("path");
|
||||
import thriftPraser = require("./thriftParser");
|
||||
import thriftPraser from "./thriftParser";
|
||||
import BaseCompiler from "./BaseCompiler";
|
||||
import ServiceCompiler from "./ServiceCompiler";
|
||||
import { File, CompileOptions } from "./types";
|
||||
|
11
src/thriftParser.d.ts
vendored
11
src/thriftParser.d.ts
vendored
@ -1,11 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
import { JsonAST } from "./ast";
|
||||
|
||||
interface ThriftFileParsingError extends Error {
|
||||
messgae: string;
|
||||
name: "THRIFT_FILE_PARSING_ERROR";
|
||||
}
|
||||
|
||||
declare function parser(str: string | Buffer): JsonAST;
|
||||
|
||||
export = parser;
|
@ -1,6 +0,0 @@
|
||||
// thrift-parser have some type-definition problems
|
||||
// we will not use it directly until they publish the new version
|
||||
// in this way, we can import our "correct" d.ts file
|
||||
// https://github.com/eleme/thrift-parser/commit/bb998c2836f20ee8dc431be38164c4d193320f87
|
||||
const parser = require("thrift-parser");
|
||||
module.exports = parser;
|
9
src/thriftParser.ts
Normal file
9
src/thriftParser.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import thriftParser from "thrift-parser";
|
||||
import { JsonAST } from "./ast";
|
||||
|
||||
export interface ThriftFileParsingError extends Error {
|
||||
messgae: string;
|
||||
name: "THRIFT_FILE_PARSING_ERROR";
|
||||
}
|
||||
|
||||
export default thriftParser as { (str: string | Buffer): JsonAST };
|
@ -1,5 +1,5 @@
|
||||
import BaseCompiler from "../src/BaseCompiler";
|
||||
import thriftPraser = require("../src/thriftParser");
|
||||
import thriftPraser from "../src/thriftParser";
|
||||
import * as sinon from "sinon";
|
||||
import * as chai from "chai";
|
||||
import * as fs from "fs";
|
||||
|
Loading…
Reference in New Issue
Block a user