mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 23:13:02 +01:00
Ship ESM version
This commit is contained in:
parent
92af97ca38
commit
c45bf2eff6
11 changed files with 113125 additions and 24 deletions
|
|
@ -5,3 +5,4 @@
|
|||
/gulpfile.js
|
||||
/tsconfig.json
|
||||
/.npmignore
|
||||
/release/**/test/
|
||||
|
|
|
|||
29
gulpfile.js
29
gulpfile.js
|
|
@ -17,7 +17,7 @@ var es = require('event-stream');
|
|||
var TYPESCRIPT_LIB_SOURCE = path.join(__dirname, 'node_modules', 'typescript', 'lib');
|
||||
var TYPESCRIPT_LIB_DESTINATION = path.join(__dirname, 'src', 'lib');
|
||||
|
||||
gulp.task('clean-release', function(cb) { rimraf('release', { maxBusyTries: 1 }, cb); });
|
||||
gulp.task('clean-release', function(cb) { rimraf('release/min', { maxBusyTries: 1 }, cb); });
|
||||
gulp.task('release', ['clean-release'], function() {
|
||||
|
||||
var sha1 = getGitVersion(__dirname);
|
||||
|
|
@ -36,12 +36,12 @@ gulp.task('release', ['clean-release'], function() {
|
|||
|
||||
function bundleOne(moduleId, exclude) {
|
||||
return rjs({
|
||||
baseUrl: '/out/amd/',
|
||||
baseUrl: '/release/dev/',
|
||||
name: 'vs/language/typescript/' + moduleId,
|
||||
out: moduleId + '.js',
|
||||
exclude: exclude,
|
||||
paths: {
|
||||
'vs/language/typescript': __dirname + '/out/amd/'
|
||||
'vs/language/typescript': __dirname + '/release/dev/'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ gulp.task('release', ['clean-release'], function() {
|
|||
);
|
||||
this.emit('data', data);
|
||||
}))
|
||||
.pipe(gulp.dest('./release/')),
|
||||
.pipe(gulp.dest('./release/min/')),
|
||||
|
||||
gulp.src('src/monaco.d.ts').pipe(gulp.dest('./release/')),
|
||||
);
|
||||
|
|
@ -82,7 +82,8 @@ gulp.task('import-typescript', function() {
|
|||
importLibDeclarationFile('lib.es6.d.ts');
|
||||
|
||||
var tsServices = fs.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescriptServices.js')).toString();
|
||||
tsServices +=
|
||||
|
||||
var tsServices_amd = tsServices +
|
||||
`
|
||||
// MONACOCHANGE
|
||||
// Defining the entire module name because r.js has an issue and cannot bundle this file
|
||||
|
|
@ -90,7 +91,23 @@ gulp.task('import-typescript', function() {
|
|||
define("vs/language/typescript/lib/typescriptServices", [], function() { return ts; });
|
||||
// END MONACOCHANGE
|
||||
`;
|
||||
fs.writeFileSync(path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices.js'), tsServices);
|
||||
fs.writeFileSync(path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices-amd.js'), tsServices_amd);
|
||||
|
||||
var tsServices_esm = tsServices +
|
||||
`
|
||||
// MONACOCHANGE
|
||||
export const createClassifier = ts.createClassifier;
|
||||
export const createLanguageService = ts.createLanguageService;
|
||||
export const displayPartsToString = ts.displayPartsToString;
|
||||
export const EndOfLineState = ts.EndOfLineState;
|
||||
export const flattenDiagnosticMessageText = ts.flattenDiagnosticMessageText;
|
||||
export const IndentStyle = ts.IndentStyle;
|
||||
export const ScriptKind = ts.ScriptKind;
|
||||
export const ScriptTarget = ts.ScriptTarget;
|
||||
export const TokenClass = ts.TokenClass;
|
||||
// END MONACOCHANGE
|
||||
`;
|
||||
fs.writeFileSync(path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices.js'), tsServices_esm);
|
||||
|
||||
var dtsServices = fs.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescriptServices.d.ts')).toString();
|
||||
dtsServices +=
|
||||
|
|
|
|||
9537
package-lock.json
generated
9537
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
|
@ -4,7 +4,9 @@
|
|||
"description": "TypeScript and JavaScript language support for Monaco Editor",
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"compile": "node ./scripts/rmdir.js ./out && node ./scripts/copy.js ./src/lib/typescriptServices.js ./out/amd/lib/typescriptServices.js && tsc -p ./src",
|
||||
"compile-amd": "node ./scripts/copy.js ./src/lib/typescriptServices-amd.js ./release/dev/lib/typescriptServices.js && tsc -p ./src/tsconfig.json",
|
||||
"compile-esm": "node ./scripts/copy.js ./src/lib/typescriptServices.js ./release/esm/lib/typescriptServices.js && tsc -p ./src/tsconfig.esm.json",
|
||||
"compile": "node ./scripts/rmdir.js ./release && npm run compile-amd && npm run compile-esm",
|
||||
"watch": "tsc -p ./src --watch",
|
||||
"prepublish": "npm run compile && gulp release",
|
||||
"import-typescript": "gulp import-typescript"
|
||||
|
|
@ -29,6 +31,11 @@
|
|||
"monaco-editor-core": "^0.10.0",
|
||||
"object-assign": "^4.1.0",
|
||||
"rimraf": "^2.5.2",
|
||||
"typescript": "2.7.2"
|
||||
"typescript": "2.7.2",
|
||||
"webpack": "^4.1.1",
|
||||
"webpack-cli": "^2.0.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"webpack-bundle-analyzer": "^2.11.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ const fs = require('fs');
|
|||
const path = require('path');
|
||||
|
||||
const target = path.join(process.cwd(), process.argv[2]);
|
||||
rmDir(target);
|
||||
if (fs.existsSync(target)) {
|
||||
rmDir(target);
|
||||
}
|
||||
console.log(`Deleted ${process.argv[2]}`);
|
||||
|
||||
function rmDir(dirPath) {
|
||||
|
|
|
|||
103536
src/lib/typescriptServices-amd.js
Normal file
103536
src/lib/typescriptServices-amd.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -103530,7 +103530,13 @@ var TypeScript;
|
|||
var toolsVersion = ts.versionMajorMinor;
|
||||
|
||||
// MONACOCHANGE
|
||||
// Defining the entire module name because r.js has an issue and cannot bundle this file
|
||||
// correctly with an anonymous define call
|
||||
define("vs/language/typescript/lib/typescriptServices", [], function() { return ts; });
|
||||
export const createClassifier = ts.createClassifier;
|
||||
export const createLanguageService = ts.createLanguageService;
|
||||
export const displayPartsToString = ts.displayPartsToString;
|
||||
export const EndOfLineState = ts.EndOfLineState;
|
||||
export const flattenDiagnosticMessageText = ts.flattenDiagnosticMessageText;
|
||||
export const IndentStyle = ts.IndentStyle;
|
||||
export const ScriptKind = ts.ScriptKind;
|
||||
export const ScriptTarget = ts.ScriptTarget;
|
||||
export const TokenClass = ts.TokenClass;
|
||||
// END MONACOCHANGE
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import ts = require('./lib/typescriptServices');
|
||||
import * as ts from './lib/typescriptServices';
|
||||
|
||||
export enum Language {
|
||||
TypeScript,
|
||||
|
|
|
|||
13
src/tsconfig.esm.json
Normal file
13
src/tsconfig.esm.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "es6",
|
||||
"outDir": "../release/esm",
|
||||
"target": "es5"
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts"
|
||||
],
|
||||
"files": [
|
||||
"../node_modules/monaco-editor-core/monaco.d.ts"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "amd",
|
||||
"outDir": "../out/amd",
|
||||
"outDir": "../release/dev",
|
||||
"target": "es5"
|
||||
},
|
||||
"include": [
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import ts = require('./lib/typescriptServices');
|
||||
import * as ts from './lib/typescriptServices';
|
||||
import { contents as libdts } from './lib/lib-ts';
|
||||
import { contents as libes6ts } from './lib/lib-es6-ts';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue