Introduce LibFiles and adopt in DefinitionAdapter

This commit is contained in:
Alex Dima 2020-08-28 09:58:22 +02:00
parent a7f23c2eba
commit 6a18fe6517
No known key found for this signature in database
GPG key ID: 6E58D7B045760DA0
5 changed files with 173 additions and 9 deletions

View file

@ -106,7 +106,7 @@ function importLibs() {
return fs.readFileSync(srcPath).toString();
}
var strResult = `/*---------------------------------------------------------------------------------------------
var strLibResult = `/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
@ -115,17 +115,29 @@ ${generatedNote}
/** Contains all the lib files */
export const libFileMap: Record<string, string> = {}
`
;
var strIndexResult = `/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
${generatedNote}
/** Contains all the lib files */
export const libFileSet: Record<string, boolean> = {}
`
;
var dtsFiles = fs.readdirSync(TYPESCRIPT_LIB_SOURCE).filter(f => f.includes("lib."));
while (dtsFiles.length > 0) {
var name = dtsFiles.shift();
var output = readLibFile(name);
strResult += `libFileMap['${name}'] = "${escapeText(output)}";\n`;
strLibResult += `libFileMap['${name}'] = "${escapeText(output)}";\n`;
strIndexResult += `libFileSet['${name}'] = true;\n`;
}
var dstPath = path.join(TYPESCRIPT_LIB_DESTINATION, 'lib.ts');
fs.writeFileSync(dstPath, strResult);
fs.writeFileSync(path.join(TYPESCRIPT_LIB_DESTINATION, 'lib.ts'), strLibResult);
fs.writeFileSync(path.join(TYPESCRIPT_LIB_DESTINATION, 'lib.index.ts'), strIndexResult);
}
/**