@@ -7,6 +7,11 @@ const path = require('path');
77const fs = require ( 'fs' ) ;
88const child_process = require ( 'child_process' ) ;
99
10+ const generatedNote = `//
11+ // **NOTE**: Do not edit directly! This file is generated using \`npm run import-typescript\`
12+ //
13+ ` ;
14+
1015const TYPESCRIPT_LIB_SOURCE = path . join ( __dirname , '../node_modules/typescript/lib' ) ;
1116const TYPESCRIPT_LIB_DESTINATION = path . join ( __dirname , '../src/lib' ) ;
1217
@@ -23,7 +28,8 @@ const TYPESCRIPT_LIB_DESTINATION = path.join(__dirname, '../src/lib');
2328
2429 fs . writeFileSync (
2530 path . join ( TYPESCRIPT_LIB_DESTINATION , 'typescriptServicesMetadata.ts' ) ,
26- `export const typescriptVersion = "${ typeScriptDependencyVersion } ";\n`
31+ `${ generatedNote }
32+ export const typescriptVersion = "${ typeScriptDependencyVersion } ";\n`
2733 ) ;
2834
2935 var tsServices = fs . readFileSync ( path . join ( TYPESCRIPT_LIB_SOURCE , 'typescriptServices.js' ) ) . toString ( ) ;
@@ -57,7 +63,7 @@ const TYPESCRIPT_LIB_DESTINATION = path.join(__dirname, '../src/lib');
5763 const afterProcess = `// MONACOCHANGE\n ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify([]));\n// END MONACOCHANGE`
5864 tsServices = tsServices . replace ( beforeProcess , afterProcess ) ;
5965
60- var tsServices_amd = tsServices +
66+ var tsServices_amd = generatedNote + tsServices +
6167 `
6268// MONACOCHANGE
6369// Defining the entire module name because r.js has an issue and cannot bundle this file
@@ -67,7 +73,7 @@ define("vs/language/typescript/lib/typescriptServices", [], function() { return
6773` ;
6874 fs . writeFileSync ( path . join ( TYPESCRIPT_LIB_DESTINATION , 'typescriptServices-amd.js' ) , tsServices_amd ) ;
6975
70- var tsServices_esm = tsServices +
76+ var tsServices_esm = generatedNote + tsServices +
7177 `
7278// MONACOCHANGE
7379export var createClassifier = ts.createClassifier;
@@ -90,7 +96,7 @@ export var TokenClass = ts.TokenClass;
9096export = ts;
9197// END MONACOCHANGE
9298` ;
93- fs . writeFileSync ( path . join ( TYPESCRIPT_LIB_DESTINATION , 'typescriptServices.d.ts' ) , dtsServices ) ;
99+ fs . writeFileSync ( path . join ( TYPESCRIPT_LIB_DESTINATION , 'typescriptServices.d.ts' ) , generatedNote + dtsServices ) ;
94100
95101} ) ( ) ;
96102
@@ -164,7 +170,7 @@ function importLibs() {
164170 * Copyright (c) Microsoft Corporation. All rights reserved.
165171 * Licensed under the MIT License. See License.txt in the project root for license information.
166172 *--------------------------------------------------------------------------------------------*/
167- ` ;
173+ ${ generatedNote } `;
168174 // Do a topological sort
169175 while ( result . length > 0 ) {
170176 for ( let i = result . length - 1 ; i >= 0 ; i -- ) {
@@ -189,6 +195,14 @@ function importLibs() {
189195 }
190196 }
191197
198+ strResult += `
199+ /** This is the DTS which is used when the target is ES6 or below */
200+ export const lib_es5_bundled_dts = lib_dts;
201+
202+ /** This is the DTS which is used by default in monaco-typescript, and when the target is 2015 or above */
203+ export const lib_es2015_bundled_dts = lib_es2015_dts + "" + lib_dom_dts + "" + lib_webworker_importscripts_dts + "" + lib_scripthost_dts + "";
204+ `
205+
192206 var dstPath = path . join ( TYPESCRIPT_LIB_DESTINATION , 'lib.ts' ) ;
193207 fs . writeFileSync ( dstPath , strResult ) ;
194208}
0 commit comments