Don't make users call finishAddingInputs
This commit is contained in:
Родитель
c6fbb3ba43
Коммит
394b030598
|
@ -1,37 +1,35 @@
|
|||
{
|
||||
"name": "quicktype-core",
|
||||
"version": "1.0.2",
|
||||
"description": "EXPERIMENTAL: The quicktype engine as a library",
|
||||
"license": "Apache-2.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"repository": "https://github.com/quicktype/quicktype",
|
||||
"scripts": {
|
||||
"clean": "rm -rf dist node_modules *~",
|
||||
"prepare": "npm run build",
|
||||
"build": "cd ../../src/quicktype-core ; tsc",
|
||||
"tslint": "cd ../../src/quicktype-core ; tslint --project . --exclude 'get-stream/**'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/urijs": "github:quicktype/types-urijs",
|
||||
"immutable": "^4.0.0-rc.9",
|
||||
"js-base64": "^2.4.3",
|
||||
"pako": "^1.0.6",
|
||||
"pluralize": "^7.0.0",
|
||||
"stream-json": "0.5.2",
|
||||
"string-to-stream": "^1.1.0",
|
||||
"unicode-properties": "github:quicktype/unicode-properties#dist",
|
||||
"urijs": "^1.19.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-base64": "^2.3.1",
|
||||
"@types/node": "^8.10.10",
|
||||
"@types/pako": "^1.0.0",
|
||||
"@types/pluralize": "0.0.28",
|
||||
"typescript": "~2.8.3",
|
||||
"tslint": "^5.9.1"
|
||||
},
|
||||
"files": [
|
||||
"dist/**"
|
||||
]
|
||||
"name": "quicktype-core",
|
||||
"version": "1.0.4",
|
||||
"description": "EXPERIMENTAL: The quicktype engine as a library",
|
||||
"license": "Apache-2.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"repository": "https://github.com/quicktype/quicktype",
|
||||
"scripts": {
|
||||
"clean": "rm -rf dist node_modules *~",
|
||||
"prepare": "npm run build",
|
||||
"build": "cd ../../src/quicktype-core ; tsc",
|
||||
"tslint": "cd ../../src/quicktype-core ; tslint --project . --exclude 'get-stream/**'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/urijs": "github:quicktype/types-urijs",
|
||||
"immutable": "^4.0.0-rc.9",
|
||||
"js-base64": "^2.4.3",
|
||||
"pako": "^1.0.6",
|
||||
"pluralize": "^7.0.0",
|
||||
"stream-json": "0.5.2",
|
||||
"string-to-stream": "^1.1.0",
|
||||
"unicode-properties": "github:quicktype/unicode-properties#dist",
|
||||
"urijs": "^1.19.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-base64": "^2.3.1",
|
||||
"@types/node": "^8.10.10",
|
||||
"@types/pako": "^1.0.0",
|
||||
"@types/pluralize": "0.0.28",
|
||||
"typescript": "~2.8.3",
|
||||
"tslint": "^5.9.1"
|
||||
},
|
||||
"files": ["dist/**"]
|
||||
}
|
||||
|
|
|
@ -652,8 +652,6 @@ async function makeInputData(sources: TypeSource[], targetLanguage: TargetLangua
|
|||
}
|
||||
}
|
||||
|
||||
await inputData.finishAddingInputs();
|
||||
|
||||
return inputData;
|
||||
}
|
||||
|
||||
|
|
|
@ -244,11 +244,14 @@ class Run {
|
|||
}
|
||||
|
||||
public async run(): Promise<OrderedMap<string, SerializedRenderResult>> {
|
||||
// FIXME: This makes quicktype not quite reentrant
|
||||
initTypeNames();
|
||||
|
||||
const targetLanguage = getTargetLanguage(this._options.lang);
|
||||
const inputData = this._options.inputData;
|
||||
|
||||
await inputData.finishAddingInputs();
|
||||
|
||||
const needIR = inputData.needIR || targetLanguage.names.indexOf("schema") < 0;
|
||||
|
||||
const schemaString = needIR ? undefined : inputData.singleStringSchemaSource();
|
||||
|
|
|
@ -333,7 +333,6 @@ export class InputData {
|
|||
await input.addSource(source);
|
||||
}
|
||||
|
||||
// FIXME: Any reason we can't do this at the beginning of `addTypes`?
|
||||
async finishAddingInputs(): Promise<void> {
|
||||
await forEachSync(this._inputs, async input => {
|
||||
await input.finishAddingInputs();
|
||||
|
|
Загрузка…
Ссылка в новой задаче