mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Add internal definitions to a diffrent .d.ts files
This commit is contained in:
parent
004cea8293
commit
42c05453bd
38
Jakefile
38
Jakefile
@ -95,6 +95,13 @@ var definitionsRoots = [
|
||||
"services/services.d.ts",
|
||||
];
|
||||
|
||||
var internalDefinitionsRoots = [
|
||||
"compiler/core.d.ts",
|
||||
"compiler/sys.d.ts",
|
||||
"compiler/utilities.d.ts",
|
||||
"services/utilities.d.ts",
|
||||
];
|
||||
|
||||
var harnessSources = [
|
||||
"harness.ts",
|
||||
"sourceMapRecorder.ts",
|
||||
@ -322,6 +329,8 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
|
||||
|
||||
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
|
||||
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
|
||||
var internalNodeDefinitionsFile = path.join(builtLocalDirectory, "typescript_internal.d.ts");
|
||||
var internalStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices_internal.d.ts");
|
||||
var tempDirPath = path.join(builtLocalDirectory, "temptempdir");
|
||||
compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
|
||||
/*prefixes*/ undefined,
|
||||
@ -333,16 +342,25 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright
|
||||
/*keepComments*/ true,
|
||||
/*noResolve*/ true,
|
||||
/*callback*/ function () {
|
||||
concatenateFiles(standaloneDefinitionsFile, definitionsRoots.map(function (f) {
|
||||
return path.join(tempDirPath, f);
|
||||
}));
|
||||
prependFile(copyright, standaloneDefinitionsFile);
|
||||
function makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile) {
|
||||
// Create the standalone definition file
|
||||
concatenateFiles(standaloneDefinitionsFile, definitionsRoots.map(function (f) {
|
||||
return path.join(tempDirPath, f);
|
||||
}));
|
||||
prependFile(copyright, standaloneDefinitionsFile);
|
||||
|
||||
// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
|
||||
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
|
||||
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
|
||||
definitionFileContents = definitionFileContents.replace(/declare module ts/g, 'declare module "typescript"');
|
||||
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
|
||||
// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
|
||||
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
|
||||
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
|
||||
definitionFileContents = definitionFileContents.replace(/declare module ts/g, 'declare module "typescript"');
|
||||
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
|
||||
}
|
||||
|
||||
// Create the public definition files
|
||||
makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile);
|
||||
|
||||
// Create the internal definition files
|
||||
makeDefinitionFiles(internalDefinitionsRoots, internalStandaloneDefinitionsFile, internalNodeDefinitionsFile);
|
||||
|
||||
// Delete the temp dir
|
||||
jake.rmRf(tempDirPath, {silent: true});
|
||||
@ -401,7 +419,7 @@ task("generate-spec", [specMd])
|
||||
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
|
||||
desc("Makes a new LKG out of the built js files");
|
||||
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
|
||||
var expectedFiles = [tscFile, servicesFile, nodeDefinitionsFile, standaloneDefinitionsFile].concat(libraryTargets);
|
||||
var expectedFiles = [tscFile, servicesFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets);
|
||||
var missingFiles = expectedFiles.filter(function (f) {
|
||||
return !fs.existsSync(f);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user