From c4bd2cdd3719cdb9a99c86da29b8e8fef05c41e6 Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Wed, 7 Mar 2018 11:28:28 -0800 Subject: [PATCH 01/18] Fix microsoft/monaco-editor#688. (*) is not commet --- src/fsharp.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp.ts b/src/fsharp.ts index 281385b0..26a8da6c 100644 --- a/src/fsharp.ts +++ b/src/fsharp.ts @@ -121,7 +121,7 @@ export const language = { whitespace: [ [/[ \t\r\n]+/, ''], - [/\(\*/, 'comment', '@comment'], + [/\(\*(?!\))/, 'comment', '@comment'], [/\/\/.*$/, 'comment'], ], From acfa9cf274a592847540dfc63b49d9b9b86d623e Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Wed, 7 Mar 2018 15:36:22 -0800 Subject: [PATCH 02/18] Re Microsoft/monaco-editor#688 test case update. --- test/fsharp.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/fsharp.test.ts b/test/fsharp.test.ts index cb4a14c0..60fe175c 100644 --- a/test/fsharp.test.ts +++ b/test/fsharp.test.ts @@ -184,7 +184,9 @@ testTokenization('fsharp', [ { startIndex: 1, type: '' }, { startIndex: 2, type: 'delimiter.fs' }, { startIndex: 3, type: '' }, - { startIndex: 4, type: 'comment.fs' } + { startIndex: 4, type: 'delimiter.parenthesis.fs' }, + { startIndex: 5, type: 'delimiter.fs' }, + { startIndex: 6, type: 'delimiter.parenthesis.fs' } ] }], From 51df390edc83e6e7496e172edc3743b1d6726b71 Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Wed, 7 Mar 2018 15:36:57 -0800 Subject: [PATCH 03/18] Fix microsoft/monaco-editor#703. c++ 11 raw string literal. --- src/cpp.ts | 15 +++++++++++++++ test/cpp.test.ts | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/src/cpp.ts b/src/cpp.ts index fe8614dc..799e1bdc 100644 --- a/src/cpp.ts +++ b/src/cpp.ts @@ -240,10 +240,14 @@ export const language = { escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, integersuffix: /(ll|LL|u|U|l|L)?(ll|LL|u|U|l|L)?/, floatsuffix: /[fFlL]?/, + encoding: /u|u8|U|L/, // The main tokenizer for our languages tokenizer: { root: [ + // C++ 11 Raw String + [/@encoding?R\"(?:([^ ()\\\t]*))\(/, { token: 'string.raw.begin', next: '@raw.$1' }], + // identifiers and keywords [/[a-zA-Z_]\w*/, { cases: { @@ -318,5 +322,16 @@ export const language = { [/\\./, 'string.escape.invalid'], [/"/, 'string', '@pop'] ], + + raw: [ + [/(.*)(\))(?:([^ ()\\\t]*))(\")/, { + cases: { + '$3==$S2': ['string.raw', 'string.raw.end', 'string.raw.end', { token: 'string.raw.end', next: '@pop' }], + '@default': ['string.raw', 'string.raw', 'string.raw', 'string.raw'] + } + } + ], + [/.*/, 'string.raw'] + ] }, }; diff --git a/test/cpp.test.ts b/test/cpp.test.ts index 9eb51ab5..043f12b5 100644 --- a/test/cpp.test.ts +++ b/test/cpp.test.ts @@ -776,5 +776,13 @@ testTokenization('cpp', [ { startIndex: 25, type: 'identifier.cpp' }, { startIndex: 26, type: 'delimiter.parenthesis.cpp' } ] + }, { + line: 'uR"V0G0N(abc)V0G0N"def', + tokens: [ + { startIndex: 0, type: 'string.raw.begin.cpp' }, + { startIndex: 9, type: 'string.raw.cpp' }, + { startIndex: 12, type: 'string.raw.end.cpp' }, + { startIndex: 19, type: 'identifier.cpp' } + ] }] ]); From fb489d416fc0a930c5df246e34456d75434fa87e Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Wed, 7 Mar 2018 15:37:15 -0800 Subject: [PATCH 04/18] Ruby squiggly heredoc. --- src/ruby.ts | 2 +- test/ruby.test.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ruby.ts b/src/ruby.ts index b91cd16a..bc5b14c1 100644 --- a/src/ruby.ts +++ b/src/ruby.ts @@ -179,7 +179,7 @@ export const language = { [/@@[\w]*/, 'namespace.class.identifier'], // class // here document - [/<<-(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }], + [/<<[-~](@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }], [/[ \t\r\n]+<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }], [/^<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }], diff --git a/test/ruby.test.ts b/test/ruby.test.ts index 9365f091..a67586b1 100644 --- a/test/ruby.test.ts +++ b/test/ruby.test.ts @@ -134,5 +134,13 @@ testTokenization('ruby', [ { startIndex: 0, type: 'identifier.ruby' }, { startIndex: 1, type: 'string.heredoc.delimiter.ruby' } ] + }], + + [{ + line: 'x<<~HERE', + tokens: [ + { startIndex: 0, type: 'identifier.ruby' }, + { startIndex: 1, type: 'string.heredoc.delimiter.ruby' } + ] }] ]); From bf7c78973cb2c7ebfd2d528b97451fc1664394b9 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 12 Mar 2018 11:41:11 +0100 Subject: [PATCH 05/18] Reorganize project --- gulpfile.js | 104 ++++++++++--------------- package.json | 8 +- {test => src/test}/assert.d.ts | 0 {test => src/test}/bat.test.ts | 0 {test => src/test}/coffee.test.ts | 0 {test => src/test}/cpp.test.ts | 0 {test => src/test}/csharp.test.ts | 0 {test => src/test}/csp.test.ts | 0 {test => src/test}/css.test.ts | 0 {test => src/test}/dockerfile.test.ts | 0 {test => src/test}/fsharp.test.ts | 0 {test => src/test}/go.test.ts | 0 {test => src/test}/handlebars.test.ts | 0 {test => src/test}/html.test.ts | 0 {test => src/test}/java.test.ts | 0 {test => src/test}/less.test.ts | 0 {test => src/test}/lua.test.ts | 0 {test => src/test}/markdown.test.ts | 0 {test => src/test}/mocha.d.ts | 0 {test => src/test}/msdax.test.ts | 0 {test => src/test}/mysql.test.ts | 0 {test => src/test}/objective-c.test.ts | 0 {test => src/test}/pgsql.test.ts | 0 {test => src/test}/php.test.ts | 0 {test => src/test}/postiats.test.ts | 0 {test => src/test}/powershell.test.ts | 0 {test => src/test}/pug.test.ts | 0 {test => src/test}/python.test.ts | 0 {test => src/test}/r.test.ts | 0 {test => src/test}/razor.test.ts | 0 {test => src/test}/redis.test.ts | 0 {test => src/test}/redshift.test.ts | 0 {test => src/test}/ruby.test.ts | 0 {test => src/test}/sb.test.ts | 0 {test => src/test}/scss.test.ts | 0 {test => src/test}/solidity.test.ts | 0 {test => src/test}/sql.test.ts | 0 {test => src/test}/swift.test.ts | 0 {test => src/test}/testRunner.ts | 2 +- {test => src/test}/vb.test.ts | 0 {test => src/test}/xml.test.ts | 0 {test => src/test}/yaml.test.ts | 0 tsconfig.json => src/tsconfig.json | 7 +- test/all.js | 74 +++++++++--------- 44 files changed, 88 insertions(+), 107 deletions(-) rename {test => src/test}/assert.d.ts (100%) rename {test => src/test}/bat.test.ts (100%) rename {test => src/test}/coffee.test.ts (100%) rename {test => src/test}/cpp.test.ts (100%) rename {test => src/test}/csharp.test.ts (100%) rename {test => src/test}/csp.test.ts (100%) rename {test => src/test}/css.test.ts (100%) rename {test => src/test}/dockerfile.test.ts (100%) rename {test => src/test}/fsharp.test.ts (100%) rename {test => src/test}/go.test.ts (100%) rename {test => src/test}/handlebars.test.ts (100%) rename {test => src/test}/html.test.ts (100%) rename {test => src/test}/java.test.ts (100%) rename {test => src/test}/less.test.ts (100%) rename {test => src/test}/lua.test.ts (100%) rename {test => src/test}/markdown.test.ts (100%) rename {test => src/test}/mocha.d.ts (100%) rename {test => src/test}/msdax.test.ts (100%) rename {test => src/test}/mysql.test.ts (100%) rename {test => src/test}/objective-c.test.ts (100%) rename {test => src/test}/pgsql.test.ts (100%) rename {test => src/test}/php.test.ts (100%) rename {test => src/test}/postiats.test.ts (100%) rename {test => src/test}/powershell.test.ts (100%) rename {test => src/test}/pug.test.ts (100%) rename {test => src/test}/python.test.ts (100%) rename {test => src/test}/r.test.ts (100%) rename {test => src/test}/razor.test.ts (100%) rename {test => src/test}/redis.test.ts (100%) rename {test => src/test}/redshift.test.ts (100%) rename {test => src/test}/ruby.test.ts (100%) rename {test => src/test}/sb.test.ts (100%) rename {test => src/test}/scss.test.ts (100%) rename {test => src/test}/solidity.test.ts (100%) rename {test => src/test}/sql.test.ts (100%) rename {test => src/test}/swift.test.ts (100%) rename {test => src/test}/testRunner.ts (93%) rename {test => src/test}/vb.test.ts (100%) rename {test => src/test}/xml.test.ts (100%) rename {test => src/test}/yaml.test.ts (100%) rename tsconfig.json => src/tsconfig.json (51%) diff --git a/gulpfile.js b/gulpfile.js index 12d7511e..975c68b0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -15,7 +15,7 @@ var rimraf = require('rimraf'); var es = require('event-stream'); gulp.task('clean-release', function(cb) { rimraf('release', { maxBusyTries: 1 }, cb); }); -gulp.task('release', ['clean-release','compile'], function() { +gulp.task('release', ['clean-release'], function() { var sha1 = getGitVersion(__dirname); var semver = require('./package.json').version; @@ -33,56 +33,56 @@ gulp.task('release', ['clean-release','compile'], function() { function bundleOne(moduleId, exclude) { return rjs({ - baseUrl: '/out/', + baseUrl: '/out/amd/', name: 'vs/basic-languages/' + moduleId, out: moduleId + '.js', exclude: exclude, paths: { - 'vs/basic-languages': __dirname + '/out' + 'vs/basic-languages': __dirname + '/out/amd' } }) } return merge( - bundleOne('src/monaco.contribution'), - bundleOne('src/bat'), - bundleOne('src/css'), - bundleOne('src/coffee'), - bundleOne('src/cpp'), - bundleOne('src/csharp'), - bundleOne('src/dockerfile'), - bundleOne('src/fsharp'), - bundleOne('src/go'), - bundleOne('src/handlebars'), - bundleOne('src/html'), - bundleOne('src/ini'), - bundleOne('src/pug'), - bundleOne('src/java'), - bundleOne('src/less'), - bundleOne('src/lua'), - bundleOne('src/markdown'), - bundleOne('src/msdax'), - bundleOne('src/objective-c'), - bundleOne('src/php'), - bundleOne('src/powershell'), - bundleOne('src/postiats'), - bundleOne('src/python'), - bundleOne('src/r'), - bundleOne('src/razor'), - bundleOne('src/ruby'), - bundleOne('src/scss'), - bundleOne('src/sql'), - bundleOne('src/swift'), - bundleOne('src/vb'), - bundleOne('src/xml'), - bundleOne('src/yaml'), - bundleOne('src/solidity'), - bundleOne('src/sb'), - bundleOne('src/mysql'), - bundleOne('src/redshift'), - bundleOne('src/pgsql'), - bundleOne('src/redis'), - bundleOne('src/csp') + bundleOne('monaco.contribution'), + bundleOne('bat'), + bundleOne('css'), + bundleOne('coffee'), + bundleOne('cpp'), + bundleOne('csharp'), + bundleOne('dockerfile'), + bundleOne('fsharp'), + bundleOne('go'), + bundleOne('handlebars'), + bundleOne('html'), + bundleOne('ini'), + bundleOne('pug'), + bundleOne('java'), + bundleOne('less'), + bundleOne('lua'), + bundleOne('markdown'), + bundleOne('msdax'), + bundleOne('objective-c'), + bundleOne('php'), + bundleOne('powershell'), + bundleOne('postiats'), + bundleOne('python'), + bundleOne('r'), + bundleOne('razor'), + bundleOne('ruby'), + bundleOne('scss'), + bundleOne('sql'), + bundleOne('swift'), + bundleOne('vb'), + bundleOne('xml'), + bundleOne('yaml'), + bundleOne('solidity'), + bundleOne('sb'), + bundleOne('mysql'), + bundleOne('redshift'), + bundleOne('pgsql'), + bundleOne('redis'), + bundleOne('csp') ) .pipe(uglify({ output: { @@ -96,25 +96,7 @@ gulp.task('release', ['clean-release','compile'], function() { ); this.emit('data', data); })) - .pipe(gulp.dest('./release/')); -}); - - -var compilation = tsb.create(assign({ verbose: true }, require('./tsconfig.json').compilerOptions)); - -var tsSources = require('./tsconfig.json').include.concat(require('./tsconfig.json').files); - -function compileTask() { - return merge( - gulp.src(tsSources, { base: '.' }).pipe(compilation()) - ) - .pipe(gulp.dest('out')); -} -gulp.task('clean-out', function(cb) { rimraf('out', { maxBusyTries: 1 }, cb); }); -gulp.task('compile', ['clean-out'], compileTask); -gulp.task('compile-without-clean', compileTask); -gulp.task('watch', ['compile'], function() { - gulp.watch(tsSources, ['compile-without-clean']); + .pipe(gulp.dest('./release/min/')); }); function getGitVersion(repo) { diff --git a/package.json b/package.json index 52703a83..42ce843e 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,10 @@ "version": "0.9.0", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { - "compile": "node_modules/.bin/gulp compile", - "watch": "node_modules/.bin/gulp watch", - "test": "node_modules/.bin/mocha", - "prepublish": "node_modules/.bin/gulp release" + "compile": "tsc -p ./src", + "watch": "tsc -p ./src --watch", + "test": "mocha", + "prepublish": "npm run compile && gulp release" }, "author": "Microsoft Corporation", "license": "MIT", diff --git a/test/assert.d.ts b/src/test/assert.d.ts similarity index 100% rename from test/assert.d.ts rename to src/test/assert.d.ts diff --git a/test/bat.test.ts b/src/test/bat.test.ts similarity index 100% rename from test/bat.test.ts rename to src/test/bat.test.ts diff --git a/test/coffee.test.ts b/src/test/coffee.test.ts similarity index 100% rename from test/coffee.test.ts rename to src/test/coffee.test.ts diff --git a/test/cpp.test.ts b/src/test/cpp.test.ts similarity index 100% rename from test/cpp.test.ts rename to src/test/cpp.test.ts diff --git a/test/csharp.test.ts b/src/test/csharp.test.ts similarity index 100% rename from test/csharp.test.ts rename to src/test/csharp.test.ts diff --git a/test/csp.test.ts b/src/test/csp.test.ts similarity index 100% rename from test/csp.test.ts rename to src/test/csp.test.ts diff --git a/test/css.test.ts b/src/test/css.test.ts similarity index 100% rename from test/css.test.ts rename to src/test/css.test.ts diff --git a/test/dockerfile.test.ts b/src/test/dockerfile.test.ts similarity index 100% rename from test/dockerfile.test.ts rename to src/test/dockerfile.test.ts diff --git a/test/fsharp.test.ts b/src/test/fsharp.test.ts similarity index 100% rename from test/fsharp.test.ts rename to src/test/fsharp.test.ts diff --git a/test/go.test.ts b/src/test/go.test.ts similarity index 100% rename from test/go.test.ts rename to src/test/go.test.ts diff --git a/test/handlebars.test.ts b/src/test/handlebars.test.ts similarity index 100% rename from test/handlebars.test.ts rename to src/test/handlebars.test.ts diff --git a/test/html.test.ts b/src/test/html.test.ts similarity index 100% rename from test/html.test.ts rename to src/test/html.test.ts diff --git a/test/java.test.ts b/src/test/java.test.ts similarity index 100% rename from test/java.test.ts rename to src/test/java.test.ts diff --git a/test/less.test.ts b/src/test/less.test.ts similarity index 100% rename from test/less.test.ts rename to src/test/less.test.ts diff --git a/test/lua.test.ts b/src/test/lua.test.ts similarity index 100% rename from test/lua.test.ts rename to src/test/lua.test.ts diff --git a/test/markdown.test.ts b/src/test/markdown.test.ts similarity index 100% rename from test/markdown.test.ts rename to src/test/markdown.test.ts diff --git a/test/mocha.d.ts b/src/test/mocha.d.ts similarity index 100% rename from test/mocha.d.ts rename to src/test/mocha.d.ts diff --git a/test/msdax.test.ts b/src/test/msdax.test.ts similarity index 100% rename from test/msdax.test.ts rename to src/test/msdax.test.ts diff --git a/test/mysql.test.ts b/src/test/mysql.test.ts similarity index 100% rename from test/mysql.test.ts rename to src/test/mysql.test.ts diff --git a/test/objective-c.test.ts b/src/test/objective-c.test.ts similarity index 100% rename from test/objective-c.test.ts rename to src/test/objective-c.test.ts diff --git a/test/pgsql.test.ts b/src/test/pgsql.test.ts similarity index 100% rename from test/pgsql.test.ts rename to src/test/pgsql.test.ts diff --git a/test/php.test.ts b/src/test/php.test.ts similarity index 100% rename from test/php.test.ts rename to src/test/php.test.ts diff --git a/test/postiats.test.ts b/src/test/postiats.test.ts similarity index 100% rename from test/postiats.test.ts rename to src/test/postiats.test.ts diff --git a/test/powershell.test.ts b/src/test/powershell.test.ts similarity index 100% rename from test/powershell.test.ts rename to src/test/powershell.test.ts diff --git a/test/pug.test.ts b/src/test/pug.test.ts similarity index 100% rename from test/pug.test.ts rename to src/test/pug.test.ts diff --git a/test/python.test.ts b/src/test/python.test.ts similarity index 100% rename from test/python.test.ts rename to src/test/python.test.ts diff --git a/test/r.test.ts b/src/test/r.test.ts similarity index 100% rename from test/r.test.ts rename to src/test/r.test.ts diff --git a/test/razor.test.ts b/src/test/razor.test.ts similarity index 100% rename from test/razor.test.ts rename to src/test/razor.test.ts diff --git a/test/redis.test.ts b/src/test/redis.test.ts similarity index 100% rename from test/redis.test.ts rename to src/test/redis.test.ts diff --git a/test/redshift.test.ts b/src/test/redshift.test.ts similarity index 100% rename from test/redshift.test.ts rename to src/test/redshift.test.ts diff --git a/test/ruby.test.ts b/src/test/ruby.test.ts similarity index 100% rename from test/ruby.test.ts rename to src/test/ruby.test.ts diff --git a/test/sb.test.ts b/src/test/sb.test.ts similarity index 100% rename from test/sb.test.ts rename to src/test/sb.test.ts diff --git a/test/scss.test.ts b/src/test/scss.test.ts similarity index 100% rename from test/scss.test.ts rename to src/test/scss.test.ts diff --git a/test/solidity.test.ts b/src/test/solidity.test.ts similarity index 100% rename from test/solidity.test.ts rename to src/test/solidity.test.ts diff --git a/test/sql.test.ts b/src/test/sql.test.ts similarity index 100% rename from test/sql.test.ts rename to src/test/sql.test.ts diff --git a/test/swift.test.ts b/src/test/swift.test.ts similarity index 100% rename from test/swift.test.ts rename to src/test/swift.test.ts diff --git a/test/testRunner.ts b/src/test/testRunner.ts similarity index 93% rename from test/testRunner.ts rename to src/test/testRunner.ts index 35a860ca..15011a2f 100644 --- a/test/testRunner.ts +++ b/src/test/testRunner.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import {loadLanguage} from '../src/monaco.contribution'; +import {loadLanguage} from '../monaco.contribution'; import * as assert from 'assert'; // Allow for running under nodejs/requirejs in tests diff --git a/test/vb.test.ts b/src/test/vb.test.ts similarity index 100% rename from test/vb.test.ts rename to src/test/vb.test.ts diff --git a/test/xml.test.ts b/src/test/xml.test.ts similarity index 100% rename from test/xml.test.ts rename to src/test/xml.test.ts diff --git a/test/yaml.test.ts b/src/test/yaml.test.ts similarity index 100% rename from test/yaml.test.ts rename to src/test/yaml.test.ts diff --git a/tsconfig.json b/src/tsconfig.json similarity index 51% rename from tsconfig.json rename to src/tsconfig.json index 3534ffba..ebdf3791 100644 --- a/tsconfig.json +++ b/src/tsconfig.json @@ -1,14 +1,13 @@ { "compilerOptions": { "module": "amd", - "outDir": "out", + "outDir": "../out/amd", "target": "es5" }, "include": [ - "src/*.ts", - "test/*.ts" + "**/*.ts" ], "files": [ - "node_modules/monaco-editor-core/monaco.d.ts" + "../node_modules/monaco-editor-core/monaco.d.ts" ] } diff --git a/test/all.js b/test/all.js index be1e6fd1..048e396d 100644 --- a/test/all.js +++ b/test/all.js @@ -27,43 +27,43 @@ requirejs([ 'vs/editor/editor.main' ], function() { requirejs([ - 'out/test/bat.test', - 'out/test/css.test', - 'out/test/coffee.test', - 'out/test/cpp.test', - 'out/test/csharp.test', - 'out/test/dockerfile.test', - 'out/test/fsharp.test', - 'out/test/go.test', - 'out/test/handlebars.test', - 'out/test/html.test', - 'out/test/pug.test', - 'out/test/java.test', - 'out/test/less.test', - 'out/test/lua.test', - 'out/test/markdown.test', - 'out/test/msdax.test', - 'out/test/objective-c.test', - 'out/test/php.test', - 'out/test/postiats.test', - 'out/test/powershell.test', - 'out/test/python.test', - 'out/test/r.test', - 'out/test/razor.test', - 'out/test/ruby.test', - 'out/test/scss.test', - 'out/test/swift.test', - 'out/test/sql.test', - 'out/test/vb.test', - 'out/test/xml.test', - 'out/test/yaml.test', - 'out/test/solidity.test', - 'out/test/sb.test', - 'out/test/mysql.test', - 'out/test/pgsql.test', - 'out/test/redshift.test', - 'out/test/redis.test', - 'out/test/csp.test', + 'out/amd/test/bat.test', + 'out/amd/test/css.test', + 'out/amd/test/coffee.test', + 'out/amd/test/cpp.test', + 'out/amd/test/csharp.test', + 'out/amd/test/dockerfile.test', + 'out/amd/test/fsharp.test', + 'out/amd/test/go.test', + 'out/amd/test/handlebars.test', + 'out/amd/test/html.test', + 'out/amd/test/pug.test', + 'out/amd/test/java.test', + 'out/amd/test/less.test', + 'out/amd/test/lua.test', + 'out/amd/test/markdown.test', + 'out/amd/test/msdax.test', + 'out/amd/test/objective-c.test', + 'out/amd/test/php.test', + 'out/amd/test/postiats.test', + 'out/amd/test/powershell.test', + 'out/amd/test/python.test', + 'out/amd/test/r.test', + 'out/amd/test/razor.test', + 'out/amd/test/ruby.test', + 'out/amd/test/scss.test', + 'out/amd/test/swift.test', + 'out/amd/test/sql.test', + 'out/amd/test/vb.test', + 'out/amd/test/xml.test', + 'out/amd/test/yaml.test', + 'out/amd/test/solidity.test', + 'out/amd/test/sb.test', + 'out/amd/test/mysql.test', + 'out/amd/test/pgsql.test', + 'out/amd/test/redshift.test', + 'out/amd/test/redis.test', + 'out/amd/test/csp.test', ], function() { run(); // We can launch the tests! }); From bcc10f842537bd067d222248547077bdecb3def9 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 12 Mar 2018 11:58:04 +0100 Subject: [PATCH 06/18] Ship ESM variant --- package-lock.json | 322 ++++++++++++++++++++++++++++++++++++++++++ package.json | 19 +-- scripts/bundle.js | 86 +++++++++++ scripts/copy.js | 30 ++++ scripts/git.js | 52 +++++++ scripts/rmdir.js | 28 ++++ src/tsconfig.esm.json | 13 ++ src/tsconfig.json | 2 +- 8 files changed, 538 insertions(+), 14 deletions(-) create mode 100644 package-lock.json create mode 100644 scripts/bundle.js create mode 100644 scripts/copy.js create mode 100644 scripts/git.js create mode 100644 scripts/rmdir.js create mode 100644 src/tsconfig.esm.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..5e07edc2 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,322 @@ +{ + "name": "monaco-languages", + "version": "0.9.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "requires": { + "graceful-readlink": "1.0.1" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "diff": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, + "growl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "json3": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, + "lodash._baseassign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "dev": true, + "requires": { + "lodash._basecopy": "3.0.1", + "lodash.keys": "3.1.2" + } + }, + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basecreate": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", + "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.create": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", + "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", + "dev": true, + "requires": { + "lodash._baseassign": "3.2.0", + "lodash._basecreate": "3.0.3", + "lodash._isiterateecall": "3.0.9" + } + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "3.9.1", + "lodash.isarguments": "3.1.0", + "lodash.isarray": "3.0.4" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.11" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "mocha": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", + "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.9.0", + "debug": "2.6.8", + "diff": "3.2.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.1", + "growl": "1.9.2", + "he": "1.1.1", + "json3": "3.3.2", + "lodash.create": "3.1.1", + "mkdirp": "0.5.1", + "supports-color": "3.1.2" + } + }, + "monaco-editor-core": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.11.1.tgz", + "integrity": "sha512-zbi+FI4Bm1B48AvAVjir0XUJlH85ZyFHaBcXvZjfy+mui8VaE7Run2ai/l9cvb6oqzTKQwg/UpYDu0BWyB8K5w==", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "requirejs": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.5.tgz", + "integrity": "sha512-svnO+aNcR/an9Dpi44C7KSAy5fFGLtmPbaaCeQaklUz8BQhS64tWWIIlvEA5jrWICzlO/X9KSzSeXFnZdBu8nw==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + }, + "typescript": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", + "dev": true + }, + "uglify-js": { + "version": "3.3.14", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.14.tgz", + "integrity": "sha512-OY8VPQU25q09gQRbC+Ekk3xgEVBmYFEfVcgS47ksjTiNht2LmLlUkWutyi38ZsDSToJHwbe76kDGwmD226Z2Fg==", + "dev": true, + "requires": { + "commander": "2.14.1", + "source-map": "0.6.1" + }, + "dependencies": { + "commander": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.14.1.tgz", + "integrity": "sha512-+YR16o3rK53SmWHU3rEM3tPAh2rwb1yPcQX5irVn7mb0gXbwuCCrnkbV5+PBfETdfg1vui07nM6PCG1zndcjQw==", + "dev": true + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + } + } +} diff --git a/package.json b/package.json index 42ce843e..d780ab4f 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,10 @@ "version": "0.9.0", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { - "compile": "tsc -p ./src", + "compile": "node ./scripts/rmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json", "watch": "tsc -p ./src --watch", "test": "mocha", - "prepublish": "npm run compile && gulp release" + "prepublish": "npm run compile && node ./scripts/bundle" }, "author": "Microsoft Corporation", "license": "MIT", @@ -18,17 +18,10 @@ "url": "https://github.com/Microsoft/monaco-languages/issues" }, "devDependencies": { - "event-stream": "^3.3.4", - "gulp": "^3.9.1", - "gulp-requirejs": "^1.0.0-rc2", - "gulp-tsb": "^2.0.3", - "gulp-uglify": "^3.0.0", - "jsdom-no-contextify": "^3.1.0", - "merge-stream": "^1.0.1", "mocha": "^3.4.2", - "monaco-editor-core": "^0.10.0", - "object-assign": "^4.1.1", - "rimraf": "^2.6.1", - "typescript": "2.3.4" + "monaco-editor-core": "0.11.1", + "requirejs": "^2.3.5", + "typescript": "2.7.2", + "uglify-js": "^3.3.14" } } diff --git a/scripts/bundle.js b/scripts/bundle.js new file mode 100644 index 00000000..6cb50163 --- /dev/null +++ b/scripts/bundle.js @@ -0,0 +1,86 @@ +const requirejs = require('requirejs'); +const path = require('path'); +const fs = require('fs'); +const UglifyJS = require("uglify-js"); +const git = require('./git'); + +const REPO_ROOT = path.resolve(__dirname, '..'); + +const sha1 = git.getGitVersion(REPO_ROOT); +const semver = require('../package.json').version; +const headerVersion = semver + '(' + sha1 + ')'; + +const BUNDLED_FILE_HEADER = [ + '/*!-----------------------------------------------------------------------------', + ' * Copyright (c) Microsoft Corporation. All rights reserved.', + ' * monaco-typescript version: ' + headerVersion, + ' * Released under the MIT license', + ' * https://github.com/Microsoft/monaco-typescript/blob/master/LICENSE.md', + ' *-----------------------------------------------------------------------------*/', + '' +].join('\n'); + +bundleOne('monaco.contribution'); +bundleOne('bat'); +bundleOne('css'); +bundleOne('coffee'); +bundleOne('cpp'); +bundleOne('csharp'); +bundleOne('dockerfile'); +bundleOne('fsharp'); +bundleOne('go'); +bundleOne('handlebars'); +bundleOne('html'); +bundleOne('ini'); +bundleOne('pug'); +bundleOne('java'); +bundleOne('less'); +bundleOne('lua'); +bundleOne('markdown'); +bundleOne('msdax'); +bundleOne('objective-c'); +bundleOne('php'); +bundleOne('powershell'); +bundleOne('postiats'); +bundleOne('python'); +bundleOne('r'); +bundleOne('razor'); +bundleOne('ruby'); +bundleOne('scss'); +bundleOne('sql'); +bundleOne('swift'); +bundleOne('vb'); +bundleOne('xml'); +bundleOne('yaml'); +bundleOne('solidity'); +bundleOne('sb'); +bundleOne('mysql'); +bundleOne('redshift'); +bundleOne('pgsql'); +bundleOne('redis'); +bundleOne('csp'); + +function bundleOne(moduleId, exclude) { + requirejs.optimize({ + baseUrl: 'release/dev/', + name: 'vs/basic-languages/' + moduleId, + out: 'release/min/' + moduleId + '.js', + exclude: exclude, + paths: { + 'vs/basic-languages': REPO_ROOT + '/release/dev' + }, + optimize: 'none' + }, function(buildResponse) { + const filePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js'); + const fileContents = fs.readFileSync(filePath).toString(); + console.log(); + console.log(`Minifying ${filePath}...`); + const result = UglifyJS.minify(fileContents, { + output: { + comments: 'some' + } + }); + console.log(`Done.`); + fs.writeFileSync(filePath, BUNDLED_FILE_HEADER + result.code); + }) +} diff --git a/scripts/copy.js b/scripts/copy.js new file mode 100644 index 00000000..154d8562 --- /dev/null +++ b/scripts/copy.js @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +const fs = require('fs'); +const path = require('path'); + +const source = path.join(process.cwd(), process.argv[2]); +const destination = path.join(process.cwd(), process.argv[3]); + +// ensure target dir +(function () { + let dirs = []; + let dirname = path.dirname(destination); + while (dirname !== process.cwd()) { + dirs.push(dirname); + dirname = path.dirname(dirname); + } + + dirs.reverse(); + + dirs.forEach((dir) => { + try { fs.mkdirSync(dir); } catch (err) { } + }) +})(); + +fs.writeFileSync(destination, fs.readFileSync(source)); + +console.log(`Copied ${process.argv[2]} to ${process.argv[3]}`); diff --git a/scripts/git.js b/scripts/git.js new file mode 100644 index 00000000..f7d46f1d --- /dev/null +++ b/scripts/git.js @@ -0,0 +1,52 @@ +const path = require('path'); +const fs = require('fs'); + +exports.getGitVersion = function(repo) { + var git = path.join(repo, '.git'); + var headPath = path.join(git, 'HEAD'); + var head; + + try { + head = fs.readFileSync(headPath, 'utf8').trim(); + } catch (e) { + return void 0; + } + + if (/^[0-9a-f]{40}$/i.test(head)) { + return head; + } + + var refMatch = /^ref: (.*)$/.exec(head); + + if (!refMatch) { + return void 0; + } + + var ref = refMatch[1]; + var refPath = path.join(git, ref); + + try { + return fs.readFileSync(refPath, 'utf8').trim(); + } catch (e) { + // noop + } + + var packedRefsPath = path.join(git, 'packed-refs'); + var refsRaw; + + try { + refsRaw = fs.readFileSync(packedRefsPath, 'utf8').trim(); + } catch (e) { + return void 0; + } + + var refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm; + var refsMatch; + var refs = {}; + + while (refsMatch = refsRegex.exec(refsRaw)) { + refs[refsMatch[2]] = refsMatch[1]; + } + + return refs[ref]; +}; diff --git a/scripts/rmdir.js b/scripts/rmdir.js new file mode 100644 index 00000000..6bb4855d --- /dev/null +++ b/scripts/rmdir.js @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +const fs = require('fs'); +const path = require('path'); + +const target = path.join(process.cwd(), process.argv[2]); +if (fs.existsSync(target)) { + rmDir(target); +} +console.log(`Deleted ${process.argv[2]}`); + +function rmDir(dirPath) { + let entries = fs.readdirSync(dirPath); + if (entries.length > 0) { + for (var i = 0; i < entries.length; i++) { + var filePath = path.join(dirPath, entries[i]); + if (fs.statSync(filePath).isFile()) { + fs.unlinkSync(filePath); + } else { + rmDir(filePath); + } + } + } + fs.rmdirSync(dirPath); +} diff --git a/src/tsconfig.esm.json b/src/tsconfig.esm.json new file mode 100644 index 00000000..0ec54b20 --- /dev/null +++ b/src/tsconfig.esm.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "module": "es6", + "outDir": "../release/esm", + "target": "es5" + }, + "include": [ + "**/*.ts" + ], + "files": [ + "../node_modules/monaco-editor-core/monaco.d.ts" + ] +} diff --git a/src/tsconfig.json b/src/tsconfig.json index ebdf3791..3b443093 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "amd", - "outDir": "../out/amd", + "outDir": "../release/dev", "target": "es5" }, "include": [ From dfbeb258552f643803b979d975277bbcd5c2a38f Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 12 Mar 2018 12:08:09 +0100 Subject: [PATCH 07/18] Restore test running --- .gitignore | 1 - .npmignore | 3 +- gulpfile.js | 150 ------------ package-lock.json | 592 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + test/all.js | 48 +--- test/css.mock.js | 5 - test/nls.mock.js | 15 -- test/setup.js | 74 ++++++ 9 files changed, 671 insertions(+), 218 deletions(-) delete mode 100644 gulpfile.js delete mode 100644 test/css.mock.js delete mode 100644 test/nls.mock.js create mode 100644 test/setup.js diff --git a/.gitignore b/.gitignore index d9ef910d..79b9535b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ /node_modules/ -/out/ /release/ diff --git a/.npmignore b/.npmignore index c315bcb6..9990f304 100644 --- a/.npmignore +++ b/.npmignore @@ -1,6 +1,5 @@ /.vscode/ -/out/ -/test/ +/release/**/test/ /gulpfile.js /tsconfig.json /.npmignore diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index 975c68b0..00000000 --- a/gulpfile.js +++ /dev/null @@ -1,150 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -var gulp = require('gulp'); -var tsb = require('gulp-tsb'); -var assign = require('object-assign'); -var fs = require('fs'); -var path = require('path'); -var merge = require('merge-stream'); -var rjs = require('gulp-requirejs'); -var uglify = require('gulp-uglify'); -var rimraf = require('rimraf'); -var es = require('event-stream'); - -gulp.task('clean-release', function(cb) { rimraf('release', { maxBusyTries: 1 }, cb); }); -gulp.task('release', ['clean-release'], function() { - - var sha1 = getGitVersion(__dirname); - var semver = require('./package.json').version; - var headerVersion = semver + '(' + sha1 + ')'; - - var BUNDLED_FILE_HEADER = [ - '/*!-----------------------------------------------------------------------------', - ' * Copyright (c) Microsoft Corporation. All rights reserved.', - ' * monaco-languages version: ' + headerVersion, - ' * Released under the MIT license', - ' * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md', - ' *-----------------------------------------------------------------------------*/', - '' - ].join('\n'); - - function bundleOne(moduleId, exclude) { - return rjs({ - baseUrl: '/out/amd/', - name: 'vs/basic-languages/' + moduleId, - out: moduleId + '.js', - exclude: exclude, - paths: { - 'vs/basic-languages': __dirname + '/out/amd' - } - }) - } - - return merge( - bundleOne('monaco.contribution'), - bundleOne('bat'), - bundleOne('css'), - bundleOne('coffee'), - bundleOne('cpp'), - bundleOne('csharp'), - bundleOne('dockerfile'), - bundleOne('fsharp'), - bundleOne('go'), - bundleOne('handlebars'), - bundleOne('html'), - bundleOne('ini'), - bundleOne('pug'), - bundleOne('java'), - bundleOne('less'), - bundleOne('lua'), - bundleOne('markdown'), - bundleOne('msdax'), - bundleOne('objective-c'), - bundleOne('php'), - bundleOne('powershell'), - bundleOne('postiats'), - bundleOne('python'), - bundleOne('r'), - bundleOne('razor'), - bundleOne('ruby'), - bundleOne('scss'), - bundleOne('sql'), - bundleOne('swift'), - bundleOne('vb'), - bundleOne('xml'), - bundleOne('yaml'), - bundleOne('solidity'), - bundleOne('sb'), - bundleOne('mysql'), - bundleOne('redshift'), - bundleOne('pgsql'), - bundleOne('redis'), - bundleOne('csp') - ) - .pipe(uglify({ - output: { - comments: /^!/ - } - })) - .pipe(es.through(function(data) { - data.contents = new Buffer( - BUNDLED_FILE_HEADER - + data.contents.toString() - ); - this.emit('data', data); - })) - .pipe(gulp.dest('./release/min/')); -}); - -function getGitVersion(repo) { - var git = path.join(repo, '.git'); - var headPath = path.join(git, 'HEAD'); - var head; - - try { - head = fs.readFileSync(headPath, 'utf8').trim(); - } catch (e) { - return void 0; - } - - if (/^[0-9a-f]{40}$/i.test(head)) { - return head; - } - - var refMatch = /^ref: (.*)$/.exec(head); - - if (!refMatch) { - return void 0; - } - - var ref = refMatch[1]; - var refPath = path.join(git, ref); - - try { - return fs.readFileSync(refPath, 'utf8').trim(); - } catch (e) { - // noop - } - - var packedRefsPath = path.join(git, 'packed-refs'); - var refsRaw; - - try { - refsRaw = fs.readFileSync(packedRefsPath, 'utf8').trim(); - } catch (e) { - return void 0; - } - - var refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm; - var refsMatch; - var refs = {}; - - while (refsMatch = refsRegex.exec(refsRaw)) { - refs[refsMatch[2]] = refsMatch[1]; - } - - return refs[ref]; -} diff --git a/package-lock.json b/package-lock.json index 5e07edc2..f3b02eef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,12 +4,73 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.1.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", + "dev": true + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", + "dev": true + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "boom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", + "dev": true, + "requires": { + "hoek": "4.2.1" + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -20,12 +81,39 @@ "concat-map": "0.0.1" } }, + "browser-request": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/browser-request/-/browser-request-0.3.3.tgz", + "integrity": "sha1-ns5bWsqJopkyJC4Yv5M975h2zBc=", + "dev": true + }, "browser-stdout": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", "dev": true }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, "commander": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", @@ -41,6 +129,56 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cryptiles": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "dev": true, + "requires": { + "boom": "5.2.0" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "dev": true, + "requires": { + "hoek": "4.2.1" + } + } + } + }, + "cssom": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.2.tgz", + "integrity": "sha1-uANhcMefB6kP8vFuIihAJ6JDhIs=", + "dev": true + }, + "cssstyle": { + "version": "0.2.37", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz", + "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", + "dev": true, + "requires": { + "cssom": "0.3.2" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + } + }, "debug": { "version": "2.6.8", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", @@ -50,24 +188,139 @@ "ms": "2.0.0" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, "diff": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", "dev": true }, + "dom-serializer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", + "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", + "dev": true, + "requires": { + "domelementtype": "1.1.3", + "entities": "1.1.1" + }, + "dependencies": { + "domelementtype": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", + "dev": true + } + } + }, + "domelementtype": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", + "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", + "dev": true + }, + "domhandler": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.1.tgz", + "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", + "dev": true, + "requires": { + "domelementtype": "1.3.0" + } + }, + "domutils": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", + "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", + "dev": true, + "requires": { + "dom-serializer": "0.1.0", + "domelementtype": "1.3.0" + } + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "entities": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", + "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", + "dev": true + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "dev": true + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.6", + "mime-types": "2.1.18" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + } + }, "glob": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", @@ -94,18 +347,77 @@ "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", "dev": true }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "dev": true, + "requires": { + "ajv": "5.5.2", + "har-schema": "2.0.0" + } + }, "has-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", "dev": true }, + "hawk": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "dev": true, + "requires": { + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.1", + "sntp": "2.1.0" + } + }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", "dev": true }, + "hoek": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", + "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", + "dev": true + }, + "htmlparser2": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", + "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", + "dev": true, + "requires": { + "domelementtype": "1.3.0", + "domhandler": "2.4.1", + "domutils": "1.7.0", + "entities": "1.1.1", + "inherits": "2.0.3", + "readable-stream": "2.3.5" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -122,12 +434,84 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, + "optional": true + }, + "jsdom-no-contextify": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsdom-no-contextify/-/jsdom-no-contextify-3.1.0.tgz", + "integrity": "sha1-DYvq9hDC/yOJT1Tfp/id0i/Q96s=", + "dev": true, + "requires": { + "browser-request": "0.3.3", + "cssom": "0.3.2", + "cssstyle": "0.2.37", + "htmlparser2": "3.9.2", + "nwmatcher": "1.4.3", + "parse5": "1.5.1", + "request": "2.85.0", + "xml-name-validator": "1.0.0", + "xmlhttprequest": "1.8.0" + } + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, "json3": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", "dev": true }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, "lodash._baseassign": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", @@ -196,6 +580,21 @@ "lodash.isarray": "3.0.4" } }, + "mime-db": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", + "dev": true + }, + "mime-types": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "dev": true, + "requires": { + "mime-db": "1.33.0" + } + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -252,6 +651,18 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, + "nwmatcher": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz", + "integrity": "sha512-IKdSTiDWCarf2JTS5e9e2+5tPZGdkRJ79XjYV0pzK8Q9BpsFyBq1RGKxzs7Q8UBushGw7m6TzVKz6fcY99iSWw==", + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -261,24 +672,145 @@ "wrappy": "1.0.2" } }, + "parse5": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz", + "integrity": "sha1-m387DeMr543CQBsXVzzK8Pb1nZQ=", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "dev": true + }, + "readable-stream": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.5.tgz", + "integrity": "sha512-tK0yDhrkygt/knjowCUiWP9YdV7c5R+8cR0r/kt9ZhBU906Fs6RpQJCEilamRJj1Nx2rWI6LkW9gKqjTkshhEw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, + "request": { + "version": "2.85.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz", + "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", + "dev": true, + "requires": { + "aws-sign2": "0.7.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.6", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.2", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.18", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.1", + "safe-buffer": "5.1.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.4", + "tunnel-agent": "0.6.0", + "uuid": "3.2.1" + } + }, "requirejs": { "version": "2.3.5", "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.5.tgz", "integrity": "sha512-svnO+aNcR/an9Dpi44C7KSAy5fFGLtmPbaaCeQaklUz8BQhS64tWWIIlvEA5jrWICzlO/X9KSzSeXFnZdBu8nw==", "dev": true }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + }, + "sntp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "dev": true, + "requires": { + "hoek": "4.2.1" + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, + "sshpk": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", + "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "dev": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", + "dev": true + }, "supports-color": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", @@ -288,6 +820,31 @@ "has-flag": "1.0.0" } }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "dev": true, + "requires": { + "punycode": "1.4.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, + "optional": true + }, "typescript": { "version": "2.7.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", @@ -312,11 +869,46 @@ } } }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "uuid": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", + "dev": true + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true + }, + "xml-name-validator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-1.0.0.tgz", + "integrity": "sha1-3Pgu4JIyKVHvjMG6WWycv9FKg/E=", + "dev": true + }, + "xmlhttprequest": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", + "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=", + "dev": true } } } diff --git a/package.json b/package.json index d780ab4f..7183dcef 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "url": "https://github.com/Microsoft/monaco-languages/issues" }, "devDependencies": { + "jsdom-no-contextify": "^3.1.0", "mocha": "^3.4.2", "monaco-editor-core": "0.11.1", "requirejs": "^2.3.5", diff --git a/test/all.js b/test/all.js index 048e396d..ac92ab6d 100644 --- a/test/all.js +++ b/test/all.js @@ -17,54 +17,12 @@ global.document.queryCommandSupported = function() {}; global.self = global.window = global.document.parentWindow; global.navigator = global.window.navigator; global.window.require = requirejs; -global.doNotInitLoader = true; function MyWorker() {} MyWorker.prototype.postMessage = function() {}; global.Worker = MyWorker; -requirejs([ - 'vs/editor/editor.main' -], function() { - requirejs([ - 'out/amd/test/bat.test', - 'out/amd/test/css.test', - 'out/amd/test/coffee.test', - 'out/amd/test/cpp.test', - 'out/amd/test/csharp.test', - 'out/amd/test/dockerfile.test', - 'out/amd/test/fsharp.test', - 'out/amd/test/go.test', - 'out/amd/test/handlebars.test', - 'out/amd/test/html.test', - 'out/amd/test/pug.test', - 'out/amd/test/java.test', - 'out/amd/test/less.test', - 'out/amd/test/lua.test', - 'out/amd/test/markdown.test', - 'out/amd/test/msdax.test', - 'out/amd/test/objective-c.test', - 'out/amd/test/php.test', - 'out/amd/test/postiats.test', - 'out/amd/test/powershell.test', - 'out/amd/test/python.test', - 'out/amd/test/r.test', - 'out/amd/test/razor.test', - 'out/amd/test/ruby.test', - 'out/amd/test/scss.test', - 'out/amd/test/swift.test', - 'out/amd/test/sql.test', - 'out/amd/test/vb.test', - 'out/amd/test/xml.test', - 'out/amd/test/yaml.test', - 'out/amd/test/solidity.test', - 'out/amd/test/sb.test', - 'out/amd/test/mysql.test', - 'out/amd/test/pgsql.test', - 'out/amd/test/redshift.test', - 'out/amd/test/redis.test', - 'out/amd/test/csp.test', - ], function() { - run(); // We can launch the tests! - }); +requirejs(['./test/setup'], function() { +}, function(err) { + console.log(err); }); diff --git a/test/css.mock.js b/test/css.mock.js deleted file mode 100644 index e2fb94f9..00000000 --- a/test/css.mock.js +++ /dev/null @@ -1,5 +0,0 @@ -define('vs/css', [], { - load: function(name, req, load) { - load({}); - } -}); diff --git a/test/nls.mock.js b/test/nls.mock.js deleted file mode 100644 index 54349559..00000000 --- a/test/nls.mock.js +++ /dev/null @@ -1,15 +0,0 @@ -define('vs/nls', [], { - create: function() { - return { - localize: function() { - return 'NO_LOCALIZATION_FOR_YOU'; - } - }; - }, - localize: function() { - return 'NO_LOCALIZATION_FOR_YOU'; - }, - load: function(name, req, load) { - load({}); - } -}); diff --git a/test/setup.js b/test/setup.js new file mode 100644 index 00000000..713a321f --- /dev/null +++ b/test/setup.js @@ -0,0 +1,74 @@ + +define('vs/css', [], { + load: function (name, req, load) { + load({}); + } +}); + +define('vs/nls', [], { + create: function () { + return { + localize: function () { + return 'NO_LOCALIZATION_FOR_YOU'; + } + }; + }, + localize: function () { + return 'NO_LOCALIZATION_FOR_YOU'; + }, + load: function (name, req, load) { + load({}); + } +}); + +define(['require'], function (require) { + requirejs([ + 'vs/editor/editor.main' + ], function () { + requirejs([ + 'release/dev/test/bat.test', + 'release/dev/test/css.test', + 'release/dev/test/coffee.test', + 'release/dev/test/cpp.test', + 'release/dev/test/csharp.test', + 'release/dev/test/dockerfile.test', + 'release/dev/test/fsharp.test', + 'release/dev/test/go.test', + 'release/dev/test/handlebars.test', + 'release/dev/test/html.test', + 'release/dev/test/pug.test', + 'release/dev/test/java.test', + 'release/dev/test/less.test', + 'release/dev/test/lua.test', + 'release/dev/test/markdown.test', + 'release/dev/test/msdax.test', + 'release/dev/test/objective-c.test', + 'release/dev/test/php.test', + 'release/dev/test/postiats.test', + 'release/dev/test/powershell.test', + 'release/dev/test/python.test', + 'release/dev/test/r.test', + 'release/dev/test/razor.test', + 'release/dev/test/ruby.test', + 'release/dev/test/scss.test', + 'release/dev/test/swift.test', + 'release/dev/test/sql.test', + 'release/dev/test/vb.test', + 'release/dev/test/xml.test', + 'release/dev/test/yaml.test', + 'release/dev/test/solidity.test', + 'release/dev/test/sb.test', + 'release/dev/test/mysql.test', + 'release/dev/test/pgsql.test', + 'release/dev/test/redshift.test', + 'release/dev/test/redis.test', + 'release/dev/test/csp.test', + ], function () { + run(); // We can launch the tests! + }, function (err) { + console.log(err); + }); + }, function (err) { + console.log(err); + }); +}); From 2ad83718b7b703e9a8f6c7bb4da4768b6167110d Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 12 Mar 2018 12:23:51 +0100 Subject: [PATCH 08/18] Spell out dynamic imports --- .travis.yml | 2 +- src/monaco.contribution.ts | 95 ++++++++++++++++++-------------------- src/tsconfig.esm.json | 10 +++- src/tsconfig.json | 8 +++- 4 files changed, 61 insertions(+), 54 deletions(-) diff --git a/.travis.yml b/.travis.yml index 22bdf91f..1568bc80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - "5.10" + - "8.9.3" script: - npm run compile - npm run test diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index a74e2e1f..4c3f4065 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -4,13 +4,11 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -declare var require: (moduleId: [string], callback: (module: T) => void, error: (err: any) => void) => void; - // Allow for running under nodejs/requirejs in tests const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); interface ILang extends monaco.languages.ILanguageExtensionPoint { - module: string; + loader: () => monaco.Promise; } interface ILangImpl { @@ -21,13 +19,10 @@ interface ILangImpl { let languageDefinitions: { [languageId: string]: ILang } = {}; function _loadLanguage(languageId: string): monaco.Promise { - let module = languageDefinitions[languageId].module; - return new _monaco.Promise((c, e, p) => { - require([module], (mod) => { - _monaco.languages.setMonarchTokensProvider(languageId, mod.language); - _monaco.languages.setLanguageConfiguration(languageId, mod.conf); - c(void 0); - }, e); + const loader = languageDefinitions[languageId].loader; + return loader().then((mod) => { + _monaco.languages.setMonarchTokensProvider(languageId, mod.language); + _monaco.languages.setLanguageConfiguration(languageId, mod.conf); }); } @@ -55,174 +50,174 @@ registerLanguage({ id: 'bat', extensions: ['.bat', '.cmd'], aliases: ['Batch', 'bat'], - module: './bat' + loader: () => _monaco.Promise.wrap(import('./bat')) }); registerLanguage({ id: 'coffeescript', extensions: ['.coffee'], aliases: ['CoffeeScript', 'coffeescript', 'coffee'], mimetypes: ['text/x-coffeescript', 'text/coffeescript'], - module: './coffee' + loader: () => _monaco.Promise.wrap(import('./coffee')) }); registerLanguage({ id: 'c', extensions: ['.c', '.h'], aliases: ['C', 'c'], - module: './cpp' + loader: () => _monaco.Promise.wrap(import('./cpp')) }); registerLanguage({ id: 'cpp', extensions: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx'], aliases: ['C++', 'Cpp', 'cpp'], - module: './cpp' + loader: () => _monaco.Promise.wrap(import('./cpp')) }); registerLanguage({ id: 'csharp', extensions: ['.cs', '.csx'], aliases: ['C#', 'csharp'], - module: './csharp' + loader: () => _monaco.Promise.wrap(import('./csharp')) }); registerLanguage({ id: 'dockerfile', extensions: ['.dockerfile'], filenames: ['Dockerfile'], aliases: ['Dockerfile'], - module: './dockerfile' + loader: () => _monaco.Promise.wrap(import('./dockerfile')) }); registerLanguage({ id: 'fsharp', extensions: ['.fs', '.fsi', '.ml', '.mli', '.fsx', '.fsscript'], aliases: ['F#', 'FSharp', 'fsharp'], - module: './fsharp' + loader: () => _monaco.Promise.wrap(import('./fsharp')) }); registerLanguage({ id: 'go', extensions: ['.go'], aliases: ['Go'], - module: './go' + loader: () => _monaco.Promise.wrap(import('./go')) }); registerLanguage({ id: 'handlebars', extensions: ['.handlebars', '.hbs'], aliases: ['Handlebars', 'handlebars'], mimetypes: ['text/x-handlebars-template'], - module: './handlebars' + loader: () => _monaco.Promise.wrap(import('./handlebars')) }); registerLanguage({ id: 'html', extensions: ['.html', '.htm', '.shtml', '.xhtml', '.mdoc', '.jsp', '.asp', '.aspx', '.jshtm'], aliases: ['HTML', 'htm', 'html', 'xhtml'], mimetypes: ['text/html', 'text/x-jshtm', 'text/template', 'text/ng-template'], - module: './html' + loader: () => _monaco.Promise.wrap(import('./html')) }); registerLanguage({ id: 'ini', extensions: ['.ini', '.properties', '.gitconfig'], filenames: ['config', '.gitattributes', '.gitconfig', '.editorconfig'], aliases: ['Ini', 'ini'], - module: './ini' + loader: () => _monaco.Promise.wrap(import('./ini')) }); registerLanguage({ id: 'pug', extensions: ['.jade', '.pug'], aliases: ['Pug', 'Jade', 'jade'], - module: './pug' + loader: () => _monaco.Promise.wrap(import('./pug')) }); registerLanguage({ id: 'java', extensions: ['.java', '.jav'], aliases: ['Java', 'java'], mimetypes: ['text/x-java-source', 'text/x-java'], - module: './java' + loader: () => _monaco.Promise.wrap(import('./java')) }); registerLanguage({ id: 'lua', extensions: ['.lua'], aliases: ['Lua', 'lua'], - module: './lua' + loader: () => _monaco.Promise.wrap(import('./lua')) }); registerLanguage({ id: 'markdown', extensions: ['.md', '.markdown', '.mdown', '.mkdn', '.mkd', '.mdwn', '.mdtxt', '.mdtext'], aliases: ['Markdown', 'markdown'], - module: './markdown' + loader: () => _monaco.Promise.wrap(import('./markdown')) }); registerLanguage({ id: 'msdax', extensions: ['.dax', '.msdax'], aliases: ['DAX', 'MSDAX'], - module: './msdax' + loader: () => _monaco.Promise.wrap(import('./msdax')) }); registerLanguage({ id: 'objective-c', extensions: ['.m'], aliases: ['Objective-C'], - module: './objective-c' + loader: () => _monaco.Promise.wrap(import('./objective-c')) }); registerLanguage({ id: 'postiats', extensions: ['.dats', '.sats', '.hats'], aliases: ['ATS', 'ATS/Postiats'], - module: './postiats' + loader: () => _monaco.Promise.wrap(import('./postiats')) }); registerLanguage({ id: 'php', extensions: ['.php', '.php4', '.php5', '.phtml', '.ctp'], aliases: ['PHP', 'php'], mimetypes: ['application/x-php'], - module: './php' + loader: () => _monaco.Promise.wrap(import('./php')) }); registerLanguage({ id: 'powershell', extensions: ['.ps1', '.psm1', '.psd1'], aliases: ['PowerShell', 'powershell', 'ps', 'ps1'], - module: './powershell' + loader: () => _monaco.Promise.wrap(import('./powershell')) }); registerLanguage({ id: 'python', extensions: ['.py', '.rpy', '.pyw', '.cpy', '.gyp', '.gypi'], aliases: ['Python', 'py'], firstLine: '^#!/.*\\bpython[0-9.-]*\\b', - module: './python' + loader: () => _monaco.Promise.wrap(import('./python')) }); registerLanguage({ id: 'r', extensions: ['.r', '.rhistory', '.rprofile', '.rt'], aliases: ['R', 'r'], - module: './r' + loader: () => _monaco.Promise.wrap(import('./r')) }); registerLanguage({ id: 'razor', extensions: ['.cshtml'], aliases: ['Razor', 'razor'], mimetypes: ['text/x-cshtml'], - module: './razor' + loader: () => _monaco.Promise.wrap(import('./razor')) }); registerLanguage({ id: 'ruby', extensions: ['.rb', '.rbx', '.rjs', '.gemspec', '.pp'], filenames: ['rakefile'], aliases: ['Ruby', 'rb'], - module: './ruby' + loader: () => _monaco.Promise.wrap(import('./ruby')) }); registerLanguage({ id: 'swift', aliases: ['Swift', 'swift'], extensions: ['.swift'], mimetypes: ['text/swift'], - module: './swift' + loader: () => _monaco.Promise.wrap(import('./swift')) }); registerLanguage({ id: 'sql', extensions: ['.sql'], aliases: ['SQL'], - module: './sql' + loader: () => _monaco.Promise.wrap(import('./sql')) }); registerLanguage({ id: 'vb', extensions: ['.vb'], aliases: ['Visual Basic', 'vb'], - module: './vb' + loader: () => _monaco.Promise.wrap(import('./vb')) }); registerLanguage({ id: 'xml', @@ -230,80 +225,80 @@ registerLanguage({ firstLine: '(\\<\\?xml.*)|(\\ _monaco.Promise.wrap(import('./xml')) }); registerLanguage({ id: 'less', extensions: ['.less'], aliases: ['Less', 'less'], mimetypes: ['text/x-less', 'text/less'], - module: './less' + loader: () => _monaco.Promise.wrap(import('./less')) }); registerLanguage({ id: 'scss', extensions: ['.scss'], aliases: ['Sass', 'sass', 'scss'], mimetypes: ['text/x-scss', 'text/scss'], - module: './scss' + loader: () => _monaco.Promise.wrap(import('./scss')) }); registerLanguage({ id: 'css', extensions: ['.css'], aliases: ['CSS', 'css'], mimetypes: ['text/css'], - module: './css' + loader: () => _monaco.Promise.wrap(import('./css')) }); registerLanguage({ id: 'yaml', extensions: ['.yaml', '.yml'], aliases: ['YAML', 'yaml', 'YML', 'yml'], mimetypes: ['application/x-yaml'], - module: './yaml' + loader: () => _monaco.Promise.wrap(import('./yaml')) }); registerLanguage({ id: 'sol', extensions: ['.sol'], aliases: ['sol', 'solidity', 'Solidity'], - module: './solidity' + loader: () => _monaco.Promise.wrap(import('./solidity')) }); registerLanguage({ id: 'sb', extensions: ['.sb'], aliases: ['Small Basic', 'sb'], - module: './sb' + loader: () => _monaco.Promise.wrap(import('./sb')) }); registerLanguage({ id: 'mysql', extensions: [], aliases: ['MySQL', 'mysql'], - module: './mysql' + loader: () => _monaco.Promise.wrap(import('./mysql')) }); registerLanguage({ id: 'pgsql', extensions: [], aliases: ['PostgreSQL', 'postgres', 'pg', 'postgre'], - module: './pgsql' + loader: () => _monaco.Promise.wrap(import('./pgsql')) }); registerLanguage({ id: 'redshift', extensions: [], aliases: ['Redshift', 'redshift'], - module: './redshift' + loader: () => _monaco.Promise.wrap(import('./redshift')) }); registerLanguage({ id: 'redis', extensions: ['.redis'], aliases: ['redis'], - module: './redis' + loader: () => _monaco.Promise.wrap(import('./redis')) }); registerLanguage({ id: 'csp', extensions: [], aliases: ['CSP', 'csp'], - module: './csp' -}); \ No newline at end of file + loader: () => _monaco.Promise.wrap(import('./csp')) +}); diff --git a/src/tsconfig.esm.json b/src/tsconfig.esm.json index 0ec54b20..0c69d882 100644 --- a/src/tsconfig.esm.json +++ b/src/tsconfig.esm.json @@ -1,8 +1,14 @@ { "compilerOptions": { - "module": "es6", + "module": "esnext", "outDir": "../release/esm", - "target": "es5" + "target": "es5", + "lib": [ + "dom", + "es5", + "es2015.collection", + "es2015.promise" + ] }, "include": [ "**/*.ts" diff --git a/src/tsconfig.json b/src/tsconfig.json index 3b443093..db440f34 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -2,7 +2,13 @@ "compilerOptions": { "module": "amd", "outDir": "../release/dev", - "target": "es5" + "target": "es5", + "lib": [ + "dom", + "es5", + "es2015.collection", + "es2015.promise" + ] }, "include": [ "**/*.ts" From a8741f55a939acf1a754e6415c47153fffe7b0d3 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 12 Mar 2018 13:52:13 +0100 Subject: [PATCH 09/18] Adopt monaco-plugin-helpers --- package-lock.json | 9 ++++++++ package.json | 3 ++- scripts/bundle.js | 4 ++-- scripts/copy.js | 30 --------------------------- scripts/git.js | 52 ----------------------------------------------- scripts/rmdir.js | 28 ------------------------- 6 files changed, 13 insertions(+), 113 deletions(-) delete mode 100644 scripts/copy.js delete mode 100644 scripts/git.js delete mode 100644 scripts/rmdir.js diff --git a/package-lock.json b/package-lock.json index f3b02eef..36f1d224 100644 --- a/package-lock.json +++ b/package-lock.json @@ -645,6 +645,15 @@ "integrity": "sha512-zbi+FI4Bm1B48AvAVjir0XUJlH85ZyFHaBcXvZjfy+mui8VaE7Run2ai/l9cvb6oqzTKQwg/UpYDu0BWyB8K5w==", "dev": true }, + "monaco-plugin-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/monaco-plugin-helpers/-/monaco-plugin-helpers-1.0.2.tgz", + "integrity": "sha512-7kUx8dtd5qVNVgUARBRhnM8oftPglYwlINfigC4yGUiuzqtIN22u1tly8umiOCIPR0eFiBLjt6aN23oZh2QJgg==", + "dev": true, + "requires": { + "typescript": "2.7.2" + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", diff --git a/package.json b/package.json index 7183dcef..70962ecc 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.9.0", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { - "compile": "node ./scripts/rmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json", + "compile": "mrmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json", "watch": "tsc -p ./src --watch", "test": "mocha", "prepublish": "npm run compile && node ./scripts/bundle" @@ -21,6 +21,7 @@ "jsdom-no-contextify": "^3.1.0", "mocha": "^3.4.2", "monaco-editor-core": "0.11.1", + "monaco-plugin-helpers": "^1.0.2", "requirejs": "^2.3.5", "typescript": "2.7.2", "uglify-js": "^3.3.14" diff --git a/scripts/bundle.js b/scripts/bundle.js index 6cb50163..1d3ad68a 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -2,11 +2,11 @@ const requirejs = require('requirejs'); const path = require('path'); const fs = require('fs'); const UglifyJS = require("uglify-js"); -const git = require('./git'); +const helpers = require('monaco-plugin-helpers'); const REPO_ROOT = path.resolve(__dirname, '..'); -const sha1 = git.getGitVersion(REPO_ROOT); +const sha1 = helpers.getGitVersion(REPO_ROOT); const semver = require('../package.json').version; const headerVersion = semver + '(' + sha1 + ')'; diff --git a/scripts/copy.js b/scripts/copy.js deleted file mode 100644 index 154d8562..00000000 --- a/scripts/copy.js +++ /dev/null @@ -1,30 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -const fs = require('fs'); -const path = require('path'); - -const source = path.join(process.cwd(), process.argv[2]); -const destination = path.join(process.cwd(), process.argv[3]); - -// ensure target dir -(function () { - let dirs = []; - let dirname = path.dirname(destination); - while (dirname !== process.cwd()) { - dirs.push(dirname); - dirname = path.dirname(dirname); - } - - dirs.reverse(); - - dirs.forEach((dir) => { - try { fs.mkdirSync(dir); } catch (err) { } - }) -})(); - -fs.writeFileSync(destination, fs.readFileSync(source)); - -console.log(`Copied ${process.argv[2]} to ${process.argv[3]}`); diff --git a/scripts/git.js b/scripts/git.js deleted file mode 100644 index f7d46f1d..00000000 --- a/scripts/git.js +++ /dev/null @@ -1,52 +0,0 @@ -const path = require('path'); -const fs = require('fs'); - -exports.getGitVersion = function(repo) { - var git = path.join(repo, '.git'); - var headPath = path.join(git, 'HEAD'); - var head; - - try { - head = fs.readFileSync(headPath, 'utf8').trim(); - } catch (e) { - return void 0; - } - - if (/^[0-9a-f]{40}$/i.test(head)) { - return head; - } - - var refMatch = /^ref: (.*)$/.exec(head); - - if (!refMatch) { - return void 0; - } - - var ref = refMatch[1]; - var refPath = path.join(git, ref); - - try { - return fs.readFileSync(refPath, 'utf8').trim(); - } catch (e) { - // noop - } - - var packedRefsPath = path.join(git, 'packed-refs'); - var refsRaw; - - try { - refsRaw = fs.readFileSync(packedRefsPath, 'utf8').trim(); - } catch (e) { - return void 0; - } - - var refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm; - var refsMatch; - var refs = {}; - - while (refsMatch = refsRegex.exec(refsRaw)) { - refs[refsMatch[2]] = refsMatch[1]; - } - - return refs[ref]; -}; diff --git a/scripts/rmdir.js b/scripts/rmdir.js deleted file mode 100644 index 6bb4855d..00000000 --- a/scripts/rmdir.js +++ /dev/null @@ -1,28 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -const fs = require('fs'); -const path = require('path'); - -const target = path.join(process.cwd(), process.argv[2]); -if (fs.existsSync(target)) { - rmDir(target); -} -console.log(`Deleted ${process.argv[2]}`); - -function rmDir(dirPath) { - let entries = fs.readdirSync(dirPath); - if (entries.length > 0) { - for (var i = 0; i < entries.length; i++) { - var filePath = path.join(dirPath, entries[i]); - if (fs.statSync(filePath).isFile()) { - fs.unlinkSync(filePath); - } else { - rmDir(filePath); - } - } - } - fs.rmdirSync(dirPath); -} From 043283146c5c4bcded4219ea71eef75d5b0bf865 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 12 Mar 2018 13:52:25 +0100 Subject: [PATCH 10/18] 1.0.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 36f1d224..82df8089 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "0.9.0", + "version": "1.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 70962ecc..06faba6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "0.9.0", + "version": "1.0.0", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { "compile": "mrmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json", From f8781eda2eef83e8b2a1cf5e90cb02d6427256e0 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 12 Mar 2018 17:17:40 +0100 Subject: [PATCH 11/18] Improve npmignore --- .npmignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.npmignore b/.npmignore index 9990f304..52d413d3 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,9 @@ /.vscode/ /release/**/test/ +/scripts/ +/src/ +/test/ /gulpfile.js /tsconfig.json /.npmignore +/.travis.yml From 49f22838945ac582d25bd80161a96109497f3ebc Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 13 Mar 2018 16:23:41 +0100 Subject: [PATCH 12/18] Fix header --- scripts/bundle.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/bundle.js b/scripts/bundle.js index 1d3ad68a..505f4f2e 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -13,9 +13,9 @@ const headerVersion = semver + '(' + sha1 + ')'; const BUNDLED_FILE_HEADER = [ '/*!-----------------------------------------------------------------------------', ' * Copyright (c) Microsoft Corporation. All rights reserved.', - ' * monaco-typescript version: ' + headerVersion, + ' * monaco-languages version: ' + headerVersion, ' * Released under the MIT license', - ' * https://github.com/Microsoft/monaco-typescript/blob/master/LICENSE.md', + ' * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md', ' *-----------------------------------------------------------------------------*/', '' ].join('\n'); From 93c48edcccff90b59bdb99e5f200d88e378318f9 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 13 Mar 2018 16:58:42 +0100 Subject: [PATCH 13/18] Reorganize project --- .npmignore | 2 +- README.md | 21 +- scripts/bundle.js | 76 ++-- src/_.contribution.ts | 46 +++ src/bat/bat.contribution.ts | 17 + src/{test => bat}/bat.test.ts | 2 +- src/{ => bat}/bat.ts | 0 src/coffee/coffee.contribution.ts | 18 + src/{test => coffee}/coffee.test.ts | 2 +- src/{ => coffee}/coffee.ts | 0 src/cpp/cpp.contribution.ts | 23 ++ src/{test => cpp}/cpp.test.ts | 2 +- src/{ => cpp}/cpp.ts | 0 src/csharp/csharp.contribution.ts | 17 + src/{test => csharp}/csharp.test.ts | 2 +- src/{ => csharp}/csharp.ts | 0 src/csp/csp.contribution.ts | 17 + src/{test => csp}/csp.test.ts | 2 +- src/{ => csp}/csp.ts | 0 src/css/css.contribution.ts | 18 + src/{test => css}/css.test.ts | 2 +- src/{ => css}/css.ts | 0 src/dockerfile/dockerfile.contribution.ts | 18 + src/{test => dockerfile}/dockerfile.test.ts | 2 +- src/{ => dockerfile}/dockerfile.ts | 0 src/fsharp/fsharp.contribution.ts | 17 + src/{test => fsharp}/fsharp.test.ts | 2 +- src/{ => fsharp}/fsharp.ts | 0 src/go/go.contribution.ts | 17 + src/{test => go}/go.test.ts | 2 +- src/{ => go}/go.ts | 0 src/handlebars/handlebars.contribution.ts | 18 + src/{test => handlebars}/handlebars.test.ts | 2 +- src/{ => handlebars}/handlebars.ts | 0 src/html/html.contribution.ts | 18 + src/{test => html}/html.test.ts | 2 +- src/{ => html}/html.ts | 0 src/ini/ini.contribution.ts | 18 + src/{ => ini}/ini.ts | 0 src/java/java.contribution.ts | 18 + src/{test => java}/java.test.ts | 2 +- src/{ => java}/java.ts | 0 src/less/less.contribution.ts | 18 + src/{test => less}/less.test.ts | 2 +- src/{ => less}/less.ts | 0 src/lua/lua.contribution.ts | 17 + src/{test => lua}/lua.test.ts | 2 +- src/{ => lua}/lua.ts | 0 src/markdown/markdown.contribution.ts | 17 + src/{test => markdown}/markdown.test.ts | 2 +- src/{ => markdown}/markdown.ts | 0 src/{test => }/mocha.d.ts | 0 src/monaco.contribution.ts | 336 ++---------------- src/msdax/msdax.contribution.ts | 17 + src/{test => msdax}/msdax.test.ts | 2 +- src/{ => msdax}/msdax.ts | 0 src/mysql/mysql.contribution.ts | 17 + src/{test => mysql}/mysql.test.ts | 2 +- src/{ => mysql}/mysql.ts | 0 src/objective-c/objective-c.contribution.ts | 17 + src/{test => objective-c}/objective-c.test.ts | 2 +- src/{ => objective-c}/objective-c.ts | 0 src/pgsql/pgsql.contribution.ts | 17 + src/{test => pgsql}/pgsql.test.ts | 2 +- src/{ => pgsql}/pgsql.ts | 0 src/php/php.contribution.ts | 18 + src/{test => php}/php.test.ts | 2 +- src/{ => php}/php.ts | 0 src/postiats/postiats.contribution.ts | 17 + src/{test => postiats}/postiats.test.ts | 2 +- src/{ => postiats}/postiats.ts | 0 src/powershell/powershell.contribution.ts | 17 + src/{test => powershell}/powershell.test.ts | 2 +- src/{ => powershell}/powershell.ts | 0 src/pug/pug.contribution.ts | 17 + src/{test => pug}/pug.test.ts | 2 +- src/{ => pug}/pug.ts | 0 src/python/python.contribution.ts | 18 + src/{test => python}/python.test.ts | 2 +- src/{ => python}/python.ts | 0 src/r/r.contribution.ts | 17 + src/{test => r}/r.test.ts | 2 +- src/{ => r}/r.ts | 0 src/razor/razor.contribution.ts | 18 + src/{test => razor}/razor.test.ts | 2 +- src/{ => razor}/razor.ts | 0 src/redis/redis.contribution.ts | 17 + src/{test => redis}/redis.test.ts | 2 +- src/{ => redis}/redis.ts | 0 src/redshift/redshift.contribution.ts | 17 + src/{test => redshift}/redshift.test.ts | 2 +- src/{ => redshift}/redshift.ts | 0 src/ruby/ruby.contribution.ts | 18 + src/{test => ruby}/ruby.test.ts | 2 +- src/{ => ruby}/ruby.ts | 0 src/sb/sb.contribution.ts | 17 + src/{test => sb}/sb.test.ts | 2 +- src/{ => sb}/sb.ts | 0 src/scss/scss.contribution.ts | 18 + src/{test => scss}/scss.test.ts | 2 +- src/{ => scss}/scss.ts | 0 src/solidity/solidity.contribution.ts | 17 + src/{test => solidity}/solidity.test.ts | 2 +- src/{ => solidity}/solidity.ts | 0 src/sql/sql.contribution.ts | 17 + src/{test => sql}/sql.test.ts | 2 +- src/{ => sql}/sql.ts | 0 src/swift/swift.contribution.ts | 18 + src/{test => swift}/swift.test.ts | 2 +- src/{ => swift}/swift.ts | 0 src/test/testRunner.ts | 3 +- src/vb/vb.contribution.ts | 17 + src/{test => vb}/vb.test.ts | 2 +- src/{ => vb}/vb.ts | 0 src/xml/xml.contribution.ts | 19 + src/{test => xml}/xml.test.ts | 2 +- src/{ => xml}/xml.ts | 0 src/yaml/yaml.contribution.ts | 18 + src/{test => yaml}/yaml.test.ts | 2 +- src/{ => yaml}/yaml.ts | 0 test/setup.js | 74 ++-- 121 files changed, 875 insertions(+), 426 deletions(-) create mode 100644 src/_.contribution.ts create mode 100644 src/bat/bat.contribution.ts rename src/{test => bat}/bat.test.ts (94%) rename src/{ => bat}/bat.ts (100%) create mode 100644 src/coffee/coffee.contribution.ts rename src/{test => coffee}/coffee.test.ts (99%) rename src/{ => coffee}/coffee.ts (100%) create mode 100644 src/cpp/cpp.contribution.ts rename src/{test => cpp}/cpp.test.ts (99%) rename src/{ => cpp}/cpp.ts (100%) create mode 100644 src/csharp/csharp.contribution.ts rename src/{test => csharp}/csharp.test.ts (99%) rename src/{ => csharp}/csharp.ts (100%) create mode 100644 src/csp/csp.contribution.ts rename src/{test => csp}/csp.test.ts (87%) rename src/{ => csp}/csp.ts (100%) create mode 100644 src/css/css.contribution.ts rename src/{test => css}/css.test.ts (96%) rename src/{ => css}/css.ts (100%) create mode 100644 src/dockerfile/dockerfile.contribution.ts rename src/{test => dockerfile}/dockerfile.test.ts (99%) rename src/{ => dockerfile}/dockerfile.ts (100%) create mode 100644 src/fsharp/fsharp.contribution.ts rename src/{test => fsharp}/fsharp.test.ts (99%) rename src/{ => fsharp}/fsharp.ts (100%) create mode 100644 src/go/go.contribution.ts rename src/{test => go}/go.test.ts (99%) rename src/{ => go}/go.ts (100%) create mode 100644 src/handlebars/handlebars.contribution.ts rename src/{test => handlebars}/handlebars.test.ts (96%) rename src/{ => handlebars}/handlebars.ts (100%) create mode 100644 src/html/html.contribution.ts rename src/{test => html}/html.test.ts (96%) rename src/{ => html}/html.ts (100%) create mode 100644 src/ini/ini.contribution.ts rename src/{ => ini}/ini.ts (100%) create mode 100644 src/java/java.contribution.ts rename src/{test => java}/java.test.ts (99%) rename src/{ => java}/java.ts (100%) create mode 100644 src/less/less.contribution.ts rename src/{test => less}/less.test.ts (96%) rename src/{ => less}/less.ts (100%) create mode 100644 src/lua/lua.contribution.ts rename src/{test => lua}/lua.test.ts (97%) rename src/{ => lua}/lua.ts (100%) create mode 100644 src/markdown/markdown.contribution.ts rename src/{test => markdown}/markdown.test.ts (94%) rename src/{ => markdown}/markdown.ts (100%) rename src/{test => }/mocha.d.ts (100%) create mode 100644 src/msdax/msdax.contribution.ts rename src/{test => msdax}/msdax.test.ts (99%) rename src/{ => msdax}/msdax.ts (100%) create mode 100644 src/mysql/mysql.contribution.ts rename src/{test => mysql}/mysql.test.ts (99%) rename src/{ => mysql}/mysql.ts (100%) create mode 100644 src/objective-c/objective-c.contribution.ts rename src/{test => objective-c}/objective-c.test.ts (99%) rename src/{ => objective-c}/objective-c.ts (100%) create mode 100644 src/pgsql/pgsql.contribution.ts rename src/{test => pgsql}/pgsql.test.ts (99%) rename src/{ => pgsql}/pgsql.ts (100%) create mode 100644 src/php/php.contribution.ts rename src/{test => php}/php.test.ts (96%) rename src/{ => php}/php.ts (100%) create mode 100644 src/postiats/postiats.contribution.ts rename src/{test => postiats}/postiats.test.ts (99%) rename src/{ => postiats}/postiats.ts (100%) create mode 100644 src/powershell/powershell.contribution.ts rename src/{test => powershell}/powershell.test.ts (99%) rename src/{ => powershell}/powershell.ts (100%) create mode 100644 src/pug/pug.contribution.ts rename src/{test => pug}/pug.test.ts (99%) rename src/{ => pug}/pug.ts (100%) create mode 100644 src/python/python.contribution.ts rename src/{test => python}/python.test.ts (97%) rename src/{ => python}/python.ts (100%) create mode 100644 src/r/r.contribution.ts rename src/{test => r}/r.test.ts (99%) rename src/{ => r}/r.ts (100%) create mode 100644 src/razor/razor.contribution.ts rename src/{test => razor}/razor.test.ts (95%) rename src/{ => razor}/razor.ts (100%) create mode 100644 src/redis/redis.contribution.ts rename src/{test => redis}/redis.test.ts (98%) rename src/{ => redis}/redis.ts (100%) create mode 100644 src/redshift/redshift.contribution.ts rename src/{test => redshift}/redshift.test.ts (99%) rename src/{ => redshift}/redshift.ts (100%) create mode 100644 src/ruby/ruby.contribution.ts rename src/{test => ruby}/ruby.test.ts (98%) rename src/{ => ruby}/ruby.ts (100%) create mode 100644 src/sb/sb.contribution.ts rename src/{test => sb}/sb.test.ts (99%) rename src/{ => sb}/sb.ts (100%) create mode 100644 src/scss/scss.contribution.ts rename src/{test => scss}/scss.test.ts (97%) rename src/{ => scss}/scss.ts (100%) create mode 100644 src/solidity/solidity.contribution.ts rename src/{test => solidity}/solidity.test.ts (99%) rename src/{ => solidity}/solidity.ts (100%) create mode 100644 src/sql/sql.contribution.ts rename src/{test => sql}/sql.test.ts (99%) rename src/{ => sql}/sql.ts (100%) create mode 100644 src/swift/swift.contribution.ts rename src/{test => swift}/swift.test.ts (99%) rename src/{ => swift}/swift.ts (100%) create mode 100644 src/vb/vb.contribution.ts rename src/{test => vb}/vb.test.ts (99%) rename src/{ => vb}/vb.ts (100%) create mode 100644 src/xml/xml.contribution.ts rename src/{test => xml}/xml.test.ts (99%) rename src/{ => xml}/xml.ts (100%) create mode 100644 src/yaml/yaml.contribution.ts rename src/{test => yaml}/yaml.test.ts (98%) rename src/{ => yaml}/yaml.ts (100%) diff --git a/.npmignore b/.npmignore index 52d413d3..e8e47dc4 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,5 @@ /.vscode/ -/release/**/test/ +/release/**/*.test.js/ /scripts/ /src/ /test/ diff --git a/README.md b/README.md index 0cfdc1f8..059e3add 100644 --- a/README.md +++ b/README.md @@ -52,25 +52,18 @@ This npm module is bundled and distributed in the [monaco-editor](https://www.np ## Dev: Adding a new language -* create `$/src/myLang.ts` -* create `$/test/myLang.test.ts` +* create `$/src/myLang/myLang.contribution.ts` +* create `$/src/myLang/myLang.ts` +* create `$/src/myLang/myLang.test.ts` * restart compilation with `$> npm run watch` * edit `$/src/monaco.contribution.ts` and register your new language: +* edit `$/test/setup.js` and load your new language while testing ```js - registerLanguage({ - id: 'sql', - extensions: [ '.sql' ], - aliases: [ 'SQL' ], - module: './sql' - }); + 'release/dev/sql/sql.test', ``` -* edit `$/test/all.js` and load your new language while testing +* edit `$/scripts/bundle.js` and ship your new language ```js - 'out/test/sql.test', -``` -* edit `$/gulpfile.js` and ship your new language -```js - bundleOne('src/sql'), + bundleOne('sql/sql'), ``` ## Code of Conduct diff --git a/scripts/bundle.js b/scripts/bundle.js index 505f4f2e..d9ae2b70 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -21,44 +21,44 @@ const BUNDLED_FILE_HEADER = [ ].join('\n'); bundleOne('monaco.contribution'); -bundleOne('bat'); -bundleOne('css'); -bundleOne('coffee'); -bundleOne('cpp'); -bundleOne('csharp'); -bundleOne('dockerfile'); -bundleOne('fsharp'); -bundleOne('go'); -bundleOne('handlebars'); -bundleOne('html'); -bundleOne('ini'); -bundleOne('pug'); -bundleOne('java'); -bundleOne('less'); -bundleOne('lua'); -bundleOne('markdown'); -bundleOne('msdax'); -bundleOne('objective-c'); -bundleOne('php'); -bundleOne('powershell'); -bundleOne('postiats'); -bundleOne('python'); -bundleOne('r'); -bundleOne('razor'); -bundleOne('ruby'); -bundleOne('scss'); -bundleOne('sql'); -bundleOne('swift'); -bundleOne('vb'); -bundleOne('xml'); -bundleOne('yaml'); -bundleOne('solidity'); -bundleOne('sb'); -bundleOne('mysql'); -bundleOne('redshift'); -bundleOne('pgsql'); -bundleOne('redis'); -bundleOne('csp'); +bundleOne('bat/bat'); +bundleOne('css/css'); +bundleOne('coffee/coffee'); +bundleOne('cpp/cpp'); +bundleOne('csharp/csharp'); +bundleOne('dockerfile/dockerfile'); +bundleOne('fsharp/fsharp'); +bundleOne('go/go'); +bundleOne('handlebars/handlebars'); +bundleOne('html/html'); +bundleOne('ini/ini'); +bundleOne('pug/pug'); +bundleOne('java/java'); +bundleOne('less/less'); +bundleOne('lua/lua'); +bundleOne('markdown/markdown'); +bundleOne('msdax/msdax'); +bundleOne('objective-c/objective-c'); +bundleOne('php/php'); +bundleOne('powershell/powershell'); +bundleOne('postiats/postiats'); +bundleOne('python/python'); +bundleOne('r/r'); +bundleOne('razor/razor'); +bundleOne('ruby/ruby'); +bundleOne('scss/scss'); +bundleOne('sql/sql'); +bundleOne('swift/swift'); +bundleOne('vb/vb'); +bundleOne('xml/xml'); +bundleOne('yaml/yaml'); +bundleOne('solidity/solidity'); +bundleOne('sb/sb'); +bundleOne('mysql/mysql'); +bundleOne('redshift/redshift'); +bundleOne('pgsql/pgsql'); +bundleOne('redis/redis'); +bundleOne('csp/csp'); function bundleOne(moduleId, exclude) { requirejs.optimize({ diff --git a/src/_.contribution.ts b/src/_.contribution.ts new file mode 100644 index 00000000..80594a56 --- /dev/null +++ b/src/_.contribution.ts @@ -0,0 +1,46 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +interface ILang extends monaco.languages.ILanguageExtensionPoint { + loader: () => monaco.Promise; +} + +interface ILangImpl { + conf: monaco.languages.LanguageConfiguration; + language: monaco.languages.IMonarchLanguage; +} + +let languageDefinitions: { [languageId: string]: ILang } = {}; + +function _loadLanguage(languageId: string): monaco.Promise { + const loader = languageDefinitions[languageId].loader; + return loader().then((mod) => { + _monaco.languages.setMonarchTokensProvider(languageId, mod.language); + _monaco.languages.setLanguageConfiguration(languageId, mod.conf); + }); +} + +let languagePromises: { [languageId: string]: monaco.Promise } = {}; + +export function loadLanguage(languageId: string): monaco.Promise { + if (!languagePromises[languageId]) { + languagePromises[languageId] = _loadLanguage(languageId); + } + return languagePromises[languageId]; +} + +export function registerLanguage(def: ILang): void { + let languageId = def.id; + + languageDefinitions[languageId] = def; + _monaco.languages.register(def); + _monaco.languages.onLanguage(languageId, () => { + loadLanguage(languageId); + }); +} diff --git a/src/bat/bat.contribution.ts b/src/bat/bat.contribution.ts new file mode 100644 index 00000000..91261712 --- /dev/null +++ b/src/bat/bat.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'bat', + extensions: ['.bat', '.cmd'], + aliases: ['Batch', 'bat'], + loader: () => _monaco.Promise.wrap(import('./bat')) +}); diff --git a/src/test/bat.test.ts b/src/bat/bat.test.ts similarity index 94% rename from src/test/bat.test.ts rename to src/bat/bat.test.ts index 9307c63e..06d3e26a 100644 --- a/src/test/bat.test.ts +++ b/src/bat/bat.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('bat', [ // Keywords diff --git a/src/bat.ts b/src/bat/bat.ts similarity index 100% rename from src/bat.ts rename to src/bat/bat.ts diff --git a/src/coffee/coffee.contribution.ts b/src/coffee/coffee.contribution.ts new file mode 100644 index 00000000..2e180f64 --- /dev/null +++ b/src/coffee/coffee.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'coffeescript', + extensions: ['.coffee'], + aliases: ['CoffeeScript', 'coffeescript', 'coffee'], + mimetypes: ['text/x-coffeescript', 'text/coffeescript'], + loader: () => _monaco.Promise.wrap(import('./coffee')) +}); diff --git a/src/test/coffee.test.ts b/src/coffee/coffee.test.ts similarity index 99% rename from src/test/coffee.test.ts rename to src/coffee/coffee.test.ts index 8c37ce24..51b2ad01 100644 --- a/src/test/coffee.test.ts +++ b/src/coffee/coffee.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('coffeescript', [ // Comments diff --git a/src/coffee.ts b/src/coffee/coffee.ts similarity index 100% rename from src/coffee.ts rename to src/coffee/coffee.ts diff --git a/src/cpp/cpp.contribution.ts b/src/cpp/cpp.contribution.ts new file mode 100644 index 00000000..e69b052b --- /dev/null +++ b/src/cpp/cpp.contribution.ts @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'c', + extensions: ['.c', '.h'], + aliases: ['C', 'c'], + loader: () => _monaco.Promise.wrap(import('./cpp')) +}); +registerLanguage({ + id: 'cpp', + extensions: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx'], + aliases: ['C++', 'Cpp', 'cpp'], + loader: () => _monaco.Promise.wrap(import('./cpp')) +}); diff --git a/src/test/cpp.test.ts b/src/cpp/cpp.test.ts similarity index 99% rename from src/test/cpp.test.ts rename to src/cpp/cpp.test.ts index 043f12b5..27e8d9da 100644 --- a/src/test/cpp.test.ts +++ b/src/cpp/cpp.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('cpp', [ // Keywords diff --git a/src/cpp.ts b/src/cpp/cpp.ts similarity index 100% rename from src/cpp.ts rename to src/cpp/cpp.ts diff --git a/src/csharp/csharp.contribution.ts b/src/csharp/csharp.contribution.ts new file mode 100644 index 00000000..2ac1a2a8 --- /dev/null +++ b/src/csharp/csharp.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'csharp', + extensions: ['.cs', '.csx'], + aliases: ['C#', 'csharp'], + loader: () => _monaco.Promise.wrap(import('./csharp')) +}); diff --git a/src/test/csharp.test.ts b/src/csharp/csharp.test.ts similarity index 99% rename from src/test/csharp.test.ts rename to src/csharp/csharp.test.ts index 2ba71661..4ca578a3 100644 --- a/src/test/csharp.test.ts +++ b/src/csharp/csharp.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('csharp', [ diff --git a/src/csharp.ts b/src/csharp/csharp.ts similarity index 100% rename from src/csharp.ts rename to src/csharp/csharp.ts diff --git a/src/csp/csp.contribution.ts b/src/csp/csp.contribution.ts new file mode 100644 index 00000000..3deef58d --- /dev/null +++ b/src/csp/csp.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'csp', + extensions: [], + aliases: ['CSP', 'csp'], + loader: () => _monaco.Promise.wrap(import('./csp')) +}); diff --git a/src/test/csp.test.ts b/src/csp/csp.test.ts similarity index 87% rename from src/test/csp.test.ts rename to src/csp/csp.test.ts index cfcd8219..0866d10c 100644 --- a/src/test/csp.test.ts +++ b/src/csp/csp.test.ts @@ -5,6 +5,6 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('csp', []); diff --git a/src/csp.ts b/src/csp/csp.ts similarity index 100% rename from src/csp.ts rename to src/csp/csp.ts diff --git a/src/css/css.contribution.ts b/src/css/css.contribution.ts new file mode 100644 index 00000000..bb39d00f --- /dev/null +++ b/src/css/css.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'css', + extensions: ['.css'], + aliases: ['CSS', 'css'], + mimetypes: ['text/css'], + loader: () => _monaco.Promise.wrap(import('./css')) +}); diff --git a/src/test/css.test.ts b/src/css/css.test.ts similarity index 96% rename from src/test/css.test.ts rename to src/css/css.test.ts index 7a6901f1..4499001b 100644 --- a/src/test/css.test.ts +++ b/src/css/css.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('css', [ // Skip whitespace diff --git a/src/css.ts b/src/css/css.ts similarity index 100% rename from src/css.ts rename to src/css/css.ts diff --git a/src/dockerfile/dockerfile.contribution.ts b/src/dockerfile/dockerfile.contribution.ts new file mode 100644 index 00000000..d4200e08 --- /dev/null +++ b/src/dockerfile/dockerfile.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'dockerfile', + extensions: ['.dockerfile'], + filenames: ['Dockerfile'], + aliases: ['Dockerfile'], + loader: () => _monaco.Promise.wrap(import('./dockerfile')) +}); diff --git a/src/test/dockerfile.test.ts b/src/dockerfile/dockerfile.test.ts similarity index 99% rename from src/test/dockerfile.test.ts rename to src/dockerfile/dockerfile.test.ts index 7245358d..68d32b4f 100644 --- a/src/test/dockerfile.test.ts +++ b/src/dockerfile/dockerfile.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('dockerfile', [ // All diff --git a/src/dockerfile.ts b/src/dockerfile/dockerfile.ts similarity index 100% rename from src/dockerfile.ts rename to src/dockerfile/dockerfile.ts diff --git a/src/fsharp/fsharp.contribution.ts b/src/fsharp/fsharp.contribution.ts new file mode 100644 index 00000000..bd9a0c05 --- /dev/null +++ b/src/fsharp/fsharp.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'fsharp', + extensions: ['.fs', '.fsi', '.ml', '.mli', '.fsx', '.fsscript'], + aliases: ['F#', 'FSharp', 'fsharp'], + loader: () => _monaco.Promise.wrap(import('./fsharp')) +}); diff --git a/src/test/fsharp.test.ts b/src/fsharp/fsharp.test.ts similarity index 99% rename from src/test/fsharp.test.ts rename to src/fsharp/fsharp.test.ts index 60fe175c..2fe82857 100644 --- a/src/test/fsharp.test.ts +++ b/src/fsharp/fsharp.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('fsharp', [ // comments - single line diff --git a/src/fsharp.ts b/src/fsharp/fsharp.ts similarity index 100% rename from src/fsharp.ts rename to src/fsharp/fsharp.ts diff --git a/src/go/go.contribution.ts b/src/go/go.contribution.ts new file mode 100644 index 00000000..2e0bd2cd --- /dev/null +++ b/src/go/go.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'go', + extensions: ['.go'], + aliases: ['Go'], + loader: () => _monaco.Promise.wrap(import('./go')) +}); diff --git a/src/test/go.test.ts b/src/go/go.test.ts similarity index 99% rename from src/test/go.test.ts rename to src/go/go.test.ts index ece692ca..3fa373cb 100644 --- a/src/test/go.test.ts +++ b/src/go/go.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('go', [ // Tests diff --git a/src/go.ts b/src/go/go.ts similarity index 100% rename from src/go.ts rename to src/go/go.ts diff --git a/src/handlebars/handlebars.contribution.ts b/src/handlebars/handlebars.contribution.ts new file mode 100644 index 00000000..a0252eed --- /dev/null +++ b/src/handlebars/handlebars.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'handlebars', + extensions: ['.handlebars', '.hbs'], + aliases: ['Handlebars', 'handlebars'], + mimetypes: ['text/x-handlebars-template'], + loader: () => _monaco.Promise.wrap(import('./handlebars')) +}); diff --git a/src/test/handlebars.test.ts b/src/handlebars/handlebars.test.ts similarity index 96% rename from src/test/handlebars.test.ts rename to src/handlebars/handlebars.test.ts index 852cbc3c..21dacb6e 100644 --- a/src/test/handlebars.test.ts +++ b/src/handlebars/handlebars.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization(['handlebars', 'css'], [ diff --git a/src/handlebars.ts b/src/handlebars/handlebars.ts similarity index 100% rename from src/handlebars.ts rename to src/handlebars/handlebars.ts diff --git a/src/html/html.contribution.ts b/src/html/html.contribution.ts new file mode 100644 index 00000000..a9eabe15 --- /dev/null +++ b/src/html/html.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'html', + extensions: ['.html', '.htm', '.shtml', '.xhtml', '.mdoc', '.jsp', '.asp', '.aspx', '.jshtm'], + aliases: ['HTML', 'htm', 'html', 'xhtml'], + mimetypes: ['text/html', 'text/x-jshtm', 'text/template', 'text/ng-template'], + loader: () => _monaco.Promise.wrap(import('./html')) +}); diff --git a/src/test/html.test.ts b/src/html/html.test.ts similarity index 96% rename from src/test/html.test.ts rename to src/html/html.test.ts index d3c2d335..07c7fe56 100644 --- a/src/test/html.test.ts +++ b/src/html/html.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization(['html', 'css'], [ diff --git a/src/html.ts b/src/html/html.ts similarity index 100% rename from src/html.ts rename to src/html/html.ts diff --git a/src/ini/ini.contribution.ts b/src/ini/ini.contribution.ts new file mode 100644 index 00000000..a8344d48 --- /dev/null +++ b/src/ini/ini.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'ini', + extensions: ['.ini', '.properties', '.gitconfig'], + filenames: ['config', '.gitattributes', '.gitconfig', '.editorconfig'], + aliases: ['Ini', 'ini'], + loader: () => _monaco.Promise.wrap(import('./ini')) +}); diff --git a/src/ini.ts b/src/ini/ini.ts similarity index 100% rename from src/ini.ts rename to src/ini/ini.ts diff --git a/src/java/java.contribution.ts b/src/java/java.contribution.ts new file mode 100644 index 00000000..866a69be --- /dev/null +++ b/src/java/java.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'java', + extensions: ['.java', '.jav'], + aliases: ['Java', 'java'], + mimetypes: ['text/x-java-source', 'text/x-java'], + loader: () => _monaco.Promise.wrap(import('./java')) +}); diff --git a/src/test/java.test.ts b/src/java/java.test.ts similarity index 99% rename from src/test/java.test.ts rename to src/java/java.test.ts index 498571aa..f9271e49 100644 --- a/src/test/java.test.ts +++ b/src/java/java.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('java', [ // Comments - single line diff --git a/src/java.ts b/src/java/java.ts similarity index 100% rename from src/java.ts rename to src/java/java.ts diff --git a/src/less/less.contribution.ts b/src/less/less.contribution.ts new file mode 100644 index 00000000..cc61fbce --- /dev/null +++ b/src/less/less.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'less', + extensions: ['.less'], + aliases: ['Less', 'less'], + mimetypes: ['text/x-less', 'text/less'], + loader: () => _monaco.Promise.wrap(import('./less')) +}); diff --git a/src/test/less.test.ts b/src/less/less.test.ts similarity index 96% rename from src/test/less.test.ts rename to src/less/less.test.ts index 6b9ceb6d..3b9eff59 100644 --- a/src/test/less.test.ts +++ b/src/less/less.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization(['less'], [ diff --git a/src/less.ts b/src/less/less.ts similarity index 100% rename from src/less.ts rename to src/less/less.ts diff --git a/src/lua/lua.contribution.ts b/src/lua/lua.contribution.ts new file mode 100644 index 00000000..bec757e0 --- /dev/null +++ b/src/lua/lua.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'lua', + extensions: ['.lua'], + aliases: ['Lua', 'lua'], + loader: () => _monaco.Promise.wrap(import('./lua')) +}); diff --git a/src/test/lua.test.ts b/src/lua/lua.test.ts similarity index 97% rename from src/test/lua.test.ts rename to src/lua/lua.test.ts index eb57ab33..c040aac6 100644 --- a/src/test/lua.test.ts +++ b/src/lua/lua.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('lua', [ diff --git a/src/lua.ts b/src/lua/lua.ts similarity index 100% rename from src/lua.ts rename to src/lua/lua.ts diff --git a/src/markdown/markdown.contribution.ts b/src/markdown/markdown.contribution.ts new file mode 100644 index 00000000..0aa96e6d --- /dev/null +++ b/src/markdown/markdown.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'markdown', + extensions: ['.md', '.markdown', '.mdown', '.mkdn', '.mkd', '.mdwn', '.mdtxt', '.mdtext'], + aliases: ['Markdown', 'markdown'], + loader: () => _monaco.Promise.wrap(import('./markdown')) +}); diff --git a/src/test/markdown.test.ts b/src/markdown/markdown.test.ts similarity index 94% rename from src/test/markdown.test.ts rename to src/markdown/markdown.test.ts index cd1bba58..5e802682 100644 --- a/src/test/markdown.test.ts +++ b/src/markdown/markdown.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('markdown', [ diff --git a/src/markdown.ts b/src/markdown/markdown.ts similarity index 100% rename from src/markdown.ts rename to src/markdown/markdown.ts diff --git a/src/test/mocha.d.ts b/src/mocha.d.ts similarity index 100% rename from src/test/mocha.d.ts rename to src/mocha.d.ts diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index 4c3f4065..00ee430c 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -4,301 +4,41 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -// Allow for running under nodejs/requirejs in tests -const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); - -interface ILang extends monaco.languages.ILanguageExtensionPoint { - loader: () => monaco.Promise; -} - -interface ILangImpl { - conf: monaco.languages.LanguageConfiguration; - language: monaco.languages.IMonarchLanguage; -} - -let languageDefinitions: { [languageId: string]: ILang } = {}; - -function _loadLanguage(languageId: string): monaco.Promise { - const loader = languageDefinitions[languageId].loader; - return loader().then((mod) => { - _monaco.languages.setMonarchTokensProvider(languageId, mod.language); - _monaco.languages.setLanguageConfiguration(languageId, mod.conf); - }); -} - -let languagePromises: { [languageId: string]: monaco.Promise } = {}; - -export function loadLanguage(languageId: string): monaco.Promise { - if (!languagePromises[languageId]) { - languagePromises[languageId] = _loadLanguage(languageId); - } - return languagePromises[languageId]; -} - -function registerLanguage(def: ILang): void { - let languageId = def.id; - - languageDefinitions[languageId] = def; - _monaco.languages.register(def); - _monaco.languages.onLanguage(languageId, () => { - loadLanguage(languageId); - }); -} - - -registerLanguage({ - id: 'bat', - extensions: ['.bat', '.cmd'], - aliases: ['Batch', 'bat'], - loader: () => _monaco.Promise.wrap(import('./bat')) -}); -registerLanguage({ - id: 'coffeescript', - extensions: ['.coffee'], - aliases: ['CoffeeScript', 'coffeescript', 'coffee'], - mimetypes: ['text/x-coffeescript', 'text/coffeescript'], - loader: () => _monaco.Promise.wrap(import('./coffee')) -}); -registerLanguage({ - id: 'c', - extensions: ['.c', '.h'], - aliases: ['C', 'c'], - loader: () => _monaco.Promise.wrap(import('./cpp')) -}); -registerLanguage({ - id: 'cpp', - extensions: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx'], - aliases: ['C++', 'Cpp', 'cpp'], - loader: () => _monaco.Promise.wrap(import('./cpp')) -}); -registerLanguage({ - id: 'csharp', - extensions: ['.cs', '.csx'], - aliases: ['C#', 'csharp'], - loader: () => _monaco.Promise.wrap(import('./csharp')) -}); -registerLanguage({ - id: 'dockerfile', - extensions: ['.dockerfile'], - filenames: ['Dockerfile'], - aliases: ['Dockerfile'], - loader: () => _monaco.Promise.wrap(import('./dockerfile')) -}); -registerLanguage({ - id: 'fsharp', - extensions: ['.fs', '.fsi', '.ml', '.mli', '.fsx', '.fsscript'], - aliases: ['F#', 'FSharp', 'fsharp'], - loader: () => _monaco.Promise.wrap(import('./fsharp')) -}); -registerLanguage({ - id: 'go', - extensions: ['.go'], - aliases: ['Go'], - loader: () => _monaco.Promise.wrap(import('./go')) -}); -registerLanguage({ - id: 'handlebars', - extensions: ['.handlebars', '.hbs'], - aliases: ['Handlebars', 'handlebars'], - mimetypes: ['text/x-handlebars-template'], - loader: () => _monaco.Promise.wrap(import('./handlebars')) -}); -registerLanguage({ - id: 'html', - extensions: ['.html', '.htm', '.shtml', '.xhtml', '.mdoc', '.jsp', '.asp', '.aspx', '.jshtm'], - aliases: ['HTML', 'htm', 'html', 'xhtml'], - mimetypes: ['text/html', 'text/x-jshtm', 'text/template', 'text/ng-template'], - loader: () => _monaco.Promise.wrap(import('./html')) -}); -registerLanguage({ - id: 'ini', - extensions: ['.ini', '.properties', '.gitconfig'], - filenames: ['config', '.gitattributes', '.gitconfig', '.editorconfig'], - aliases: ['Ini', 'ini'], - loader: () => _monaco.Promise.wrap(import('./ini')) -}); -registerLanguage({ - id: 'pug', - extensions: ['.jade', '.pug'], - aliases: ['Pug', 'Jade', 'jade'], - loader: () => _monaco.Promise.wrap(import('./pug')) -}); -registerLanguage({ - id: 'java', - extensions: ['.java', '.jav'], - aliases: ['Java', 'java'], - mimetypes: ['text/x-java-source', 'text/x-java'], - loader: () => _monaco.Promise.wrap(import('./java')) -}); -registerLanguage({ - id: 'lua', - extensions: ['.lua'], - aliases: ['Lua', 'lua'], - loader: () => _monaco.Promise.wrap(import('./lua')) -}); -registerLanguage({ - id: 'markdown', - extensions: ['.md', '.markdown', '.mdown', '.mkdn', '.mkd', '.mdwn', '.mdtxt', '.mdtext'], - aliases: ['Markdown', 'markdown'], - loader: () => _monaco.Promise.wrap(import('./markdown')) -}); -registerLanguage({ - id: 'msdax', - extensions: ['.dax', '.msdax'], - aliases: ['DAX', 'MSDAX'], - loader: () => _monaco.Promise.wrap(import('./msdax')) -}); -registerLanguage({ - id: 'objective-c', - extensions: ['.m'], - aliases: ['Objective-C'], - loader: () => _monaco.Promise.wrap(import('./objective-c')) -}); -registerLanguage({ - id: 'postiats', - extensions: ['.dats', '.sats', '.hats'], - aliases: ['ATS', 'ATS/Postiats'], - loader: () => _monaco.Promise.wrap(import('./postiats')) -}); -registerLanguage({ - id: 'php', - extensions: ['.php', '.php4', '.php5', '.phtml', '.ctp'], - aliases: ['PHP', 'php'], - mimetypes: ['application/x-php'], - loader: () => _monaco.Promise.wrap(import('./php')) -}); -registerLanguage({ - id: 'powershell', - extensions: ['.ps1', '.psm1', '.psd1'], - aliases: ['PowerShell', 'powershell', 'ps', 'ps1'], - loader: () => _monaco.Promise.wrap(import('./powershell')) -}); -registerLanguage({ - id: 'python', - extensions: ['.py', '.rpy', '.pyw', '.cpy', '.gyp', '.gypi'], - aliases: ['Python', 'py'], - firstLine: '^#!/.*\\bpython[0-9.-]*\\b', - loader: () => _monaco.Promise.wrap(import('./python')) -}); -registerLanguage({ - id: 'r', - extensions: ['.r', '.rhistory', '.rprofile', '.rt'], - aliases: ['R', 'r'], - loader: () => _monaco.Promise.wrap(import('./r')) -}); -registerLanguage({ - id: 'razor', - extensions: ['.cshtml'], - aliases: ['Razor', 'razor'], - mimetypes: ['text/x-cshtml'], - loader: () => _monaco.Promise.wrap(import('./razor')) -}); -registerLanguage({ - id: 'ruby', - extensions: ['.rb', '.rbx', '.rjs', '.gemspec', '.pp'], - filenames: ['rakefile'], - aliases: ['Ruby', 'rb'], - loader: () => _monaco.Promise.wrap(import('./ruby')) -}); -registerLanguage({ - id: 'swift', - aliases: ['Swift', 'swift'], - extensions: ['.swift'], - mimetypes: ['text/swift'], - loader: () => _monaco.Promise.wrap(import('./swift')) -}); -registerLanguage({ - id: 'sql', - extensions: ['.sql'], - aliases: ['SQL'], - loader: () => _monaco.Promise.wrap(import('./sql')) -}); -registerLanguage({ - id: 'vb', - extensions: ['.vb'], - aliases: ['Visual Basic', 'vb'], - loader: () => _monaco.Promise.wrap(import('./vb')) -}); -registerLanguage({ - id: 'xml', - extensions: ['.xml', '.dtd', '.ascx', '.csproj', '.config', '.wxi', '.wxl', '.wxs', '.xaml', '.svg', '.svgz'], - firstLine: '(\\<\\?xml.*)|(\\ _monaco.Promise.wrap(import('./xml')) -}); -registerLanguage({ - id: 'less', - extensions: ['.less'], - aliases: ['Less', 'less'], - mimetypes: ['text/x-less', 'text/less'], - loader: () => _monaco.Promise.wrap(import('./less')) -}); -registerLanguage({ - id: 'scss', - extensions: ['.scss'], - aliases: ['Sass', 'sass', 'scss'], - mimetypes: ['text/x-scss', 'text/scss'], - loader: () => _monaco.Promise.wrap(import('./scss')) -}); -registerLanguage({ - id: 'css', - extensions: ['.css'], - aliases: ['CSS', 'css'], - mimetypes: ['text/css'], - loader: () => _monaco.Promise.wrap(import('./css')) -}); -registerLanguage({ - id: 'yaml', - extensions: ['.yaml', '.yml'], - aliases: ['YAML', 'yaml', 'YML', 'yml'], - mimetypes: ['application/x-yaml'], - loader: () => _monaco.Promise.wrap(import('./yaml')) -}); -registerLanguage({ - id: 'sol', - extensions: ['.sol'], - aliases: ['sol', 'solidity', 'Solidity'], - loader: () => _monaco.Promise.wrap(import('./solidity')) -}); -registerLanguage({ - id: 'sb', - extensions: ['.sb'], - aliases: ['Small Basic', 'sb'], - loader: () => _monaco.Promise.wrap(import('./sb')) -}); - -registerLanguage({ - id: 'mysql', - extensions: [], - aliases: ['MySQL', 'mysql'], - loader: () => _monaco.Promise.wrap(import('./mysql')) -}); - -registerLanguage({ - id: 'pgsql', - extensions: [], - aliases: ['PostgreSQL', 'postgres', 'pg', 'postgre'], - loader: () => _monaco.Promise.wrap(import('./pgsql')) -}); - -registerLanguage({ - id: 'redshift', - extensions: [], - aliases: ['Redshift', 'redshift'], - loader: () => _monaco.Promise.wrap(import('./redshift')) -}); - -registerLanguage({ - id: 'redis', - extensions: ['.redis'], - aliases: ['redis'], - loader: () => _monaco.Promise.wrap(import('./redis')) -}); - -registerLanguage({ - id: 'csp', - extensions: [], - aliases: ['CSP', 'csp'], - loader: () => _monaco.Promise.wrap(import('./csp')) -}); +import './bat/bat.contribution'; +import './coffee/coffee.contribution'; +import './cpp/cpp.contribution'; +import './csharp/csharp.contribution'; +import './csp/csp.contribution'; +import './css/css.contribution'; +import './dockerfile/dockerfile.contribution'; +import './fsharp/fsharp.contribution'; +import './go/go.contribution'; +import './handlebars/handlebars.contribution'; +import './html/html.contribution'; +import './ini/ini.contribution'; +import './java/java.contribution'; +import './less/less.contribution'; +import './lua/lua.contribution'; +import './markdown/markdown.contribution'; +import './msdax/msdax.contribution'; +import './mysql/mysql.contribution'; +import './objective-c/objective-c.contribution'; +import './pgsql/pgsql.contribution'; +import './php/php.contribution'; +import './postiats/postiats.contribution'; +import './powershell/powershell.contribution'; +import './pug/pug.contribution'; +import './python/python.contribution'; +import './r/r.contribution'; +import './razor/razor.contribution'; +import './redis/redis.contribution'; +import './redshift/redshift.contribution'; +import './ruby/ruby.contribution'; +import './sb/sb.contribution'; +import './scss/scss.contribution'; +import './solidity/solidity.contribution'; +import './sql/sql.contribution'; +import './swift/swift.contribution'; +import './vb/vb.contribution'; +import './xml/xml.contribution'; +import './yaml/yaml.contribution'; diff --git a/src/msdax/msdax.contribution.ts b/src/msdax/msdax.contribution.ts new file mode 100644 index 00000000..69df2d00 --- /dev/null +++ b/src/msdax/msdax.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'msdax', + extensions: ['.dax', '.msdax'], + aliases: ['DAX', 'MSDAX'], + loader: () => _monaco.Promise.wrap(import('./msdax')) +}); diff --git a/src/test/msdax.test.ts b/src/msdax/msdax.test.ts similarity index 99% rename from src/test/msdax.test.ts rename to src/msdax/msdax.test.ts index 68408305..208ecd2d 100644 --- a/src/test/msdax.test.ts +++ b/src/msdax/msdax.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('msdax', [ // Comments diff --git a/src/msdax.ts b/src/msdax/msdax.ts similarity index 100% rename from src/msdax.ts rename to src/msdax/msdax.ts diff --git a/src/mysql/mysql.contribution.ts b/src/mysql/mysql.contribution.ts new file mode 100644 index 00000000..f1476d28 --- /dev/null +++ b/src/mysql/mysql.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'mysql', + extensions: [], + aliases: ['MySQL', 'mysql'], + loader: () => _monaco.Promise.wrap(import('./mysql')) +}); diff --git a/src/test/mysql.test.ts b/src/mysql/mysql.test.ts similarity index 99% rename from src/test/mysql.test.ts rename to src/mysql/mysql.test.ts index 18ec3b9d..3bf59414 100644 --- a/src/test/mysql.test.ts +++ b/src/mysql/mysql.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('mysql', [ // Comments diff --git a/src/mysql.ts b/src/mysql/mysql.ts similarity index 100% rename from src/mysql.ts rename to src/mysql/mysql.ts diff --git a/src/objective-c/objective-c.contribution.ts b/src/objective-c/objective-c.contribution.ts new file mode 100644 index 00000000..e57176f0 --- /dev/null +++ b/src/objective-c/objective-c.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'objective-c', + extensions: ['.m'], + aliases: ['Objective-C'], + loader: () => _monaco.Promise.wrap(import('./objective-c')) +}); diff --git a/src/test/objective-c.test.ts b/src/objective-c/objective-c.test.ts similarity index 99% rename from src/test/objective-c.test.ts rename to src/objective-c/objective-c.test.ts index cd44bbfd..732cba14 100644 --- a/src/test/objective-c.test.ts +++ b/src/objective-c/objective-c.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('objective-c', [ // Keywords diff --git a/src/objective-c.ts b/src/objective-c/objective-c.ts similarity index 100% rename from src/objective-c.ts rename to src/objective-c/objective-c.ts diff --git a/src/pgsql/pgsql.contribution.ts b/src/pgsql/pgsql.contribution.ts new file mode 100644 index 00000000..f3ff6b4c --- /dev/null +++ b/src/pgsql/pgsql.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'pgsql', + extensions: [], + aliases: ['PostgreSQL', 'postgres', 'pg', 'postgre'], + loader: () => _monaco.Promise.wrap(import('./pgsql')) +}); diff --git a/src/test/pgsql.test.ts b/src/pgsql/pgsql.test.ts similarity index 99% rename from src/test/pgsql.test.ts rename to src/pgsql/pgsql.test.ts index d8958603..163c3032 100644 --- a/src/test/pgsql.test.ts +++ b/src/pgsql/pgsql.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('sql', [ // Comments diff --git a/src/pgsql.ts b/src/pgsql/pgsql.ts similarity index 100% rename from src/pgsql.ts rename to src/pgsql/pgsql.ts diff --git a/src/php/php.contribution.ts b/src/php/php.contribution.ts new file mode 100644 index 00000000..c5df88db --- /dev/null +++ b/src/php/php.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'php', + extensions: ['.php', '.php4', '.php5', '.phtml', '.ctp'], + aliases: ['PHP', 'php'], + mimetypes: ['application/x-php'], + loader: () => _monaco.Promise.wrap(import('./php')) +}); diff --git a/src/test/php.test.ts b/src/php/php.test.ts similarity index 96% rename from src/test/php.test.ts rename to src/php/php.test.ts index 72323f2e..1e3c29db 100644 --- a/src/test/php.test.ts +++ b/src/php/php.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization(['php', 'css'], [ // Bug 13596:[ErrorTelemetry] Stream did not advance while tokenizing. Mode id is php (stuck) diff --git a/src/php.ts b/src/php/php.ts similarity index 100% rename from src/php.ts rename to src/php/php.ts diff --git a/src/postiats/postiats.contribution.ts b/src/postiats/postiats.contribution.ts new file mode 100644 index 00000000..77e7c2b7 --- /dev/null +++ b/src/postiats/postiats.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'postiats', + extensions: ['.dats', '.sats', '.hats'], + aliases: ['ATS', 'ATS/Postiats'], + loader: () => _monaco.Promise.wrap(import('./postiats')) +}); diff --git a/src/test/postiats.test.ts b/src/postiats/postiats.test.ts similarity index 99% rename from src/test/postiats.test.ts rename to src/postiats/postiats.test.ts index 14ad8e0c..e4624729 100644 --- a/src/test/postiats.test.ts +++ b/src/postiats/postiats.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('postiats', [ // Keywords diff --git a/src/postiats.ts b/src/postiats/postiats.ts similarity index 100% rename from src/postiats.ts rename to src/postiats/postiats.ts diff --git a/src/powershell/powershell.contribution.ts b/src/powershell/powershell.contribution.ts new file mode 100644 index 00000000..7b83a61e --- /dev/null +++ b/src/powershell/powershell.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'powershell', + extensions: ['.ps1', '.psm1', '.psd1'], + aliases: ['PowerShell', 'powershell', 'ps', 'ps1'], + loader: () => _monaco.Promise.wrap(import('./powershell')) +}); diff --git a/src/test/powershell.test.ts b/src/powershell/powershell.test.ts similarity index 99% rename from src/test/powershell.test.ts rename to src/powershell/powershell.test.ts index 88478f02..295733c7 100644 --- a/src/test/powershell.test.ts +++ b/src/powershell/powershell.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('powershell', [ // Comments - single line diff --git a/src/powershell.ts b/src/powershell/powershell.ts similarity index 100% rename from src/powershell.ts rename to src/powershell/powershell.ts diff --git a/src/pug/pug.contribution.ts b/src/pug/pug.contribution.ts new file mode 100644 index 00000000..f1e0e9d5 --- /dev/null +++ b/src/pug/pug.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'pug', + extensions: ['.jade', '.pug'], + aliases: ['Pug', 'Jade', 'jade'], + loader: () => _monaco.Promise.wrap(import('./pug')) +}); diff --git a/src/test/pug.test.ts b/src/pug/pug.test.ts similarity index 99% rename from src/test/pug.test.ts rename to src/pug/pug.test.ts index 998d2e36..80f85662 100644 --- a/src/test/pug.test.ts +++ b/src/pug/pug.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('pug', [ // Tags [Pug] diff --git a/src/pug.ts b/src/pug/pug.ts similarity index 100% rename from src/pug.ts rename to src/pug/pug.ts diff --git a/src/python/python.contribution.ts b/src/python/python.contribution.ts new file mode 100644 index 00000000..10c25580 --- /dev/null +++ b/src/python/python.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'python', + extensions: ['.py', '.rpy', '.pyw', '.cpy', '.gyp', '.gypi'], + aliases: ['Python', 'py'], + firstLine: '^#!/.*\\bpython[0-9.-]*\\b', + loader: () => _monaco.Promise.wrap(import('./python')) +}); diff --git a/src/test/python.test.ts b/src/python/python.test.ts similarity index 97% rename from src/test/python.test.ts rename to src/python/python.test.ts index 8a4ea9b9..f4e9ea9d 100644 --- a/src/test/python.test.ts +++ b/src/python/python.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('python', [ // Keywords diff --git a/src/python.ts b/src/python/python.ts similarity index 100% rename from src/python.ts rename to src/python/python.ts diff --git a/src/r/r.contribution.ts b/src/r/r.contribution.ts new file mode 100644 index 00000000..7857845a --- /dev/null +++ b/src/r/r.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'r', + extensions: ['.r', '.rhistory', '.rprofile', '.rt'], + aliases: ['R', 'r'], + loader: () => _monaco.Promise.wrap(import('./r')) +}); diff --git a/src/test/r.test.ts b/src/r/r.test.ts similarity index 99% rename from src/test/r.test.ts rename to src/r/r.test.ts index e2ad5ba1..929fb76a 100644 --- a/src/test/r.test.ts +++ b/src/r/r.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('r', [ // Keywords diff --git a/src/r.ts b/src/r/r.ts similarity index 100% rename from src/r.ts rename to src/r/r.ts diff --git a/src/razor/razor.contribution.ts b/src/razor/razor.contribution.ts new file mode 100644 index 00000000..96d762f2 --- /dev/null +++ b/src/razor/razor.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'razor', + extensions: ['.cshtml'], + aliases: ['Razor', 'razor'], + mimetypes: ['text/x-cshtml'], + loader: () => _monaco.Promise.wrap(import('./razor')) +}); diff --git a/src/test/razor.test.ts b/src/razor/razor.test.ts similarity index 95% rename from src/test/razor.test.ts rename to src/razor/razor.test.ts index fc534798..78582417 100644 --- a/src/test/razor.test.ts +++ b/src/razor/razor.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('razor', [ diff --git a/src/razor.ts b/src/razor/razor.ts similarity index 100% rename from src/razor.ts rename to src/razor/razor.ts diff --git a/src/redis/redis.contribution.ts b/src/redis/redis.contribution.ts new file mode 100644 index 00000000..f9cbed66 --- /dev/null +++ b/src/redis/redis.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'redis', + extensions: ['.redis'], + aliases: ['redis'], + loader: () => _monaco.Promise.wrap(import('./redis')) +}); diff --git a/src/test/redis.test.ts b/src/redis/redis.test.ts similarity index 98% rename from src/test/redis.test.ts rename to src/redis/redis.test.ts index 83a96b83..a016deb9 100644 --- a/src/test/redis.test.ts +++ b/src/redis/redis.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('redis', [ diff --git a/src/redis.ts b/src/redis/redis.ts similarity index 100% rename from src/redis.ts rename to src/redis/redis.ts diff --git a/src/redshift/redshift.contribution.ts b/src/redshift/redshift.contribution.ts new file mode 100644 index 00000000..f40d0803 --- /dev/null +++ b/src/redshift/redshift.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'redshift', + extensions: [], + aliases: ['Redshift', 'redshift'], + loader: () => _monaco.Promise.wrap(import('./redshift')) +}); diff --git a/src/test/redshift.test.ts b/src/redshift/redshift.test.ts similarity index 99% rename from src/test/redshift.test.ts rename to src/redshift/redshift.test.ts index d8958603..163c3032 100644 --- a/src/test/redshift.test.ts +++ b/src/redshift/redshift.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('sql', [ // Comments diff --git a/src/redshift.ts b/src/redshift/redshift.ts similarity index 100% rename from src/redshift.ts rename to src/redshift/redshift.ts diff --git a/src/ruby/ruby.contribution.ts b/src/ruby/ruby.contribution.ts new file mode 100644 index 00000000..24e290ff --- /dev/null +++ b/src/ruby/ruby.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'ruby', + extensions: ['.rb', '.rbx', '.rjs', '.gemspec', '.pp'], + filenames: ['rakefile'], + aliases: ['Ruby', 'rb'], + loader: () => _monaco.Promise.wrap(import('./ruby')) +}); diff --git a/src/test/ruby.test.ts b/src/ruby/ruby.test.ts similarity index 98% rename from src/test/ruby.test.ts rename to src/ruby/ruby.test.ts index a67586b1..df528c9a 100644 --- a/src/test/ruby.test.ts +++ b/src/ruby/ruby.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('ruby', [ // Keywords diff --git a/src/ruby.ts b/src/ruby/ruby.ts similarity index 100% rename from src/ruby.ts rename to src/ruby/ruby.ts diff --git a/src/sb/sb.contribution.ts b/src/sb/sb.contribution.ts new file mode 100644 index 00000000..d35dc0b9 --- /dev/null +++ b/src/sb/sb.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'sb', + extensions: ['.sb'], + aliases: ['Small Basic', 'sb'], + loader: () => _monaco.Promise.wrap(import('./sb')) +}); diff --git a/src/test/sb.test.ts b/src/sb/sb.test.ts similarity index 99% rename from src/test/sb.test.ts rename to src/sb/sb.test.ts index 1f1a7cae..923d1185 100644 --- a/src/test/sb.test.ts +++ b/src/sb/sb.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('sb', [ diff --git a/src/sb.ts b/src/sb/sb.ts similarity index 100% rename from src/sb.ts rename to src/sb/sb.ts diff --git a/src/scss/scss.contribution.ts b/src/scss/scss.contribution.ts new file mode 100644 index 00000000..bc9634fc --- /dev/null +++ b/src/scss/scss.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'scss', + extensions: ['.scss'], + aliases: ['Sass', 'sass', 'scss'], + mimetypes: ['text/x-scss', 'text/scss'], + loader: () => _monaco.Promise.wrap(import('./scss')) +}); diff --git a/src/test/scss.test.ts b/src/scss/scss.test.ts similarity index 97% rename from src/test/scss.test.ts rename to src/scss/scss.test.ts index ec3dd166..9110e37f 100644 --- a/src/test/scss.test.ts +++ b/src/scss/scss.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { testTokenization as actualTestTokenization, ITestItem } from './testRunner'; +import { testTokenization as actualTestTokenization, ITestItem } from '../test/testRunner'; function testTokenization(_language: string | string[], tests: ITestItem[][]): void { tests = tests.map(t => { diff --git a/src/scss.ts b/src/scss/scss.ts similarity index 100% rename from src/scss.ts rename to src/scss/scss.ts diff --git a/src/solidity/solidity.contribution.ts b/src/solidity/solidity.contribution.ts new file mode 100644 index 00000000..98d465de --- /dev/null +++ b/src/solidity/solidity.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'sol', + extensions: ['.sol'], + aliases: ['sol', 'solidity', 'Solidity'], + loader: () => _monaco.Promise.wrap(import('./solidity')) +}); diff --git a/src/test/solidity.test.ts b/src/solidity/solidity.test.ts similarity index 99% rename from src/test/solidity.test.ts rename to src/solidity/solidity.test.ts index ecb8add6..7f39dd07 100644 --- a/src/test/solidity.test.ts +++ b/src/solidity/solidity.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('sol', [ // Keywords diff --git a/src/solidity.ts b/src/solidity/solidity.ts similarity index 100% rename from src/solidity.ts rename to src/solidity/solidity.ts diff --git a/src/sql/sql.contribution.ts b/src/sql/sql.contribution.ts new file mode 100644 index 00000000..629782f4 --- /dev/null +++ b/src/sql/sql.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'sql', + extensions: ['.sql'], + aliases: ['SQL'], + loader: () => _monaco.Promise.wrap(import('./sql')) +}); diff --git a/src/test/sql.test.ts b/src/sql/sql.test.ts similarity index 99% rename from src/test/sql.test.ts rename to src/sql/sql.test.ts index 01811965..0d1f4f36 100644 --- a/src/test/sql.test.ts +++ b/src/sql/sql.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('sql', [ // Comments diff --git a/src/sql.ts b/src/sql/sql.ts similarity index 100% rename from src/sql.ts rename to src/sql/sql.ts diff --git a/src/swift/swift.contribution.ts b/src/swift/swift.contribution.ts new file mode 100644 index 00000000..d6ffb098 --- /dev/null +++ b/src/swift/swift.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'swift', + aliases: ['Swift', 'swift'], + extensions: ['.swift'], + mimetypes: ['text/swift'], + loader: () => _monaco.Promise.wrap(import('./swift')) +}); diff --git a/src/test/swift.test.ts b/src/swift/swift.test.ts similarity index 99% rename from src/test/swift.test.ts rename to src/swift/swift.test.ts index 18c82b98..b20f073a 100644 --- a/src/test/swift.test.ts +++ b/src/swift/swift.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('swift', [ diff --git a/src/swift.ts b/src/swift/swift.ts similarity index 100% rename from src/swift.ts rename to src/swift/swift.ts diff --git a/src/test/testRunner.ts b/src/test/testRunner.ts index 15011a2f..f425a0b6 100644 --- a/src/test/testRunner.ts +++ b/src/test/testRunner.ts @@ -3,7 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import {loadLanguage} from '../monaco.contribution'; +import '../monaco.contribution'; +import {loadLanguage} from '../_.contribution'; import * as assert from 'assert'; // Allow for running under nodejs/requirejs in tests diff --git a/src/vb/vb.contribution.ts b/src/vb/vb.contribution.ts new file mode 100644 index 00000000..744e2958 --- /dev/null +++ b/src/vb/vb.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'vb', + extensions: ['.vb'], + aliases: ['Visual Basic', 'vb'], + loader: () => _monaco.Promise.wrap(import('./vb')) +}); diff --git a/src/test/vb.test.ts b/src/vb/vb.test.ts similarity index 99% rename from src/test/vb.test.ts rename to src/vb/vb.test.ts index f5503c22..b6d0e0a1 100644 --- a/src/test/vb.test.ts +++ b/src/vb/vb.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('vb', [ diff --git a/src/vb.ts b/src/vb/vb.ts similarity index 100% rename from src/vb.ts rename to src/vb/vb.ts diff --git a/src/xml/xml.contribution.ts b/src/xml/xml.contribution.ts new file mode 100644 index 00000000..35e8ad07 --- /dev/null +++ b/src/xml/xml.contribution.ts @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'xml', + extensions: ['.xml', '.dtd', '.ascx', '.csproj', '.config', '.wxi', '.wxl', '.wxs', '.xaml', '.svg', '.svgz'], + firstLine: '(\\<\\?xml.*)|(\\ _monaco.Promise.wrap(import('./xml')) +}); diff --git a/src/test/xml.test.ts b/src/xml/xml.test.ts similarity index 99% rename from src/test/xml.test.ts rename to src/xml/xml.test.ts index 25f25ea7..5607a10d 100644 --- a/src/test/xml.test.ts +++ b/src/xml/xml.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('xml', [ // Complete Start Tag with Whitespace diff --git a/src/xml.ts b/src/xml/xml.ts similarity index 100% rename from src/xml.ts rename to src/xml/xml.ts diff --git a/src/yaml/yaml.contribution.ts b/src/yaml/yaml.contribution.ts new file mode 100644 index 00000000..6d3c37a2 --- /dev/null +++ b/src/yaml/yaml.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'yaml', + extensions: ['.yaml', '.yml'], + aliases: ['YAML', 'yaml', 'YML', 'yml'], + mimetypes: ['application/x-yaml'], + loader: () => _monaco.Promise.wrap(import('./yaml')) +}); diff --git a/src/test/yaml.test.ts b/src/yaml/yaml.test.ts similarity index 98% rename from src/test/yaml.test.ts rename to src/yaml/yaml.test.ts index 4e2d5d2c..553d4fff 100644 --- a/src/test/yaml.test.ts +++ b/src/yaml/yaml.test.ts @@ -1,4 +1,4 @@ -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('yaml', [ // YAML directive diff --git a/src/yaml.ts b/src/yaml/yaml.ts similarity index 100% rename from src/yaml.ts rename to src/yaml/yaml.ts diff --git a/test/setup.js b/test/setup.js index 713a321f..b446648f 100644 --- a/test/setup.js +++ b/test/setup.js @@ -26,43 +26,43 @@ define(['require'], function (require) { 'vs/editor/editor.main' ], function () { requirejs([ - 'release/dev/test/bat.test', - 'release/dev/test/css.test', - 'release/dev/test/coffee.test', - 'release/dev/test/cpp.test', - 'release/dev/test/csharp.test', - 'release/dev/test/dockerfile.test', - 'release/dev/test/fsharp.test', - 'release/dev/test/go.test', - 'release/dev/test/handlebars.test', - 'release/dev/test/html.test', - 'release/dev/test/pug.test', - 'release/dev/test/java.test', - 'release/dev/test/less.test', - 'release/dev/test/lua.test', - 'release/dev/test/markdown.test', - 'release/dev/test/msdax.test', - 'release/dev/test/objective-c.test', - 'release/dev/test/php.test', - 'release/dev/test/postiats.test', - 'release/dev/test/powershell.test', - 'release/dev/test/python.test', - 'release/dev/test/r.test', - 'release/dev/test/razor.test', - 'release/dev/test/ruby.test', - 'release/dev/test/scss.test', - 'release/dev/test/swift.test', - 'release/dev/test/sql.test', - 'release/dev/test/vb.test', - 'release/dev/test/xml.test', - 'release/dev/test/yaml.test', - 'release/dev/test/solidity.test', - 'release/dev/test/sb.test', - 'release/dev/test/mysql.test', - 'release/dev/test/pgsql.test', - 'release/dev/test/redshift.test', - 'release/dev/test/redis.test', - 'release/dev/test/csp.test', + 'release/dev/bat/bat.test', + 'release/dev/css/css.test', + 'release/dev/coffee/coffee.test', + 'release/dev/cpp/cpp.test', + 'release/dev/csharp/csharp.test', + 'release/dev/dockerfile/dockerfile.test', + 'release/dev/fsharp/fsharp.test', + 'release/dev/go/go.test', + 'release/dev/handlebars/handlebars.test', + 'release/dev/html/html.test', + 'release/dev/pug/pug.test', + 'release/dev/java/java.test', + 'release/dev/less/less.test', + 'release/dev/lua/lua.test', + 'release/dev/markdown/markdown.test', + 'release/dev/msdax/msdax.test', + 'release/dev/objective-c/objective-c.test', + 'release/dev/php/php.test', + 'release/dev/postiats/postiats.test', + 'release/dev/powershell/powershell.test', + 'release/dev/python/python.test', + 'release/dev/r/r.test', + 'release/dev/razor/razor.test', + 'release/dev/ruby/ruby.test', + 'release/dev/scss/scss.test', + 'release/dev/swift/swift.test', + 'release/dev/sql/sql.test', + 'release/dev/vb/vb.test', + 'release/dev/xml/xml.test', + 'release/dev/yaml/yaml.test', + 'release/dev/solidity/solidity.test', + 'release/dev/sb/sb.test', + 'release/dev/mysql/mysql.test', + 'release/dev/pgsql/pgsql.test', + 'release/dev/redshift/redshift.test', + 'release/dev/redis/redis.test', + 'release/dev/csp/csp.test', ], function () { run(); // We can launch the tests! }, function (err) { From 596f52b4d9ed58368f2ce1913db8d04d2bd4092a Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 13 Mar 2018 16:58:51 +0100 Subject: [PATCH 14/18] 1.0.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 82df8089..73ec6700 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 06faba6b..55dc89e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.0.0", + "version": "1.0.1", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { "compile": "mrmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json", From ec369b424a06a22890cf38776fe7654c7da25d32 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 13 Mar 2018 17:14:37 +0100 Subject: [PATCH 15/18] Improve npmignore --- .npmignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.npmignore b/.npmignore index e8e47dc4..fa3b24da 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,6 @@ /.vscode/ -/release/**/*.test.js/ +/release/**/*.test.js +/release/**/test/ /scripts/ /src/ /test/ From 46247f86ca136a65baa98618a2f947de7124deae Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 13 Mar 2018 17:14:42 +0100 Subject: [PATCH 16/18] 1.0.2 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 73ec6700..bfd0411e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.0.1", + "version": "1.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 55dc89e1..27e5931e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.0.1", + "version": "1.0.2", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { "compile": "mrmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json", From 21ac5f13ecd724d0fed47b65464c13106837ebb2 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 14 Mar 2018 11:52:52 +0100 Subject: [PATCH 17/18] Add folding rules --- src/bat/bat.ts | 8 +++++++- src/coffee/coffee.ts | 8 +++++++- src/cpp/cpp.ts | 8 +++++++- src/csharp/csharp.ts | 8 +++++++- src/css/css.ts | 9 ++++++++- src/fsharp/fsharp.ts | 8 +++++++- src/html/html.ts | 7 +++++++ src/java/java.ts | 8 +++++++- src/less/less.ts | 8 +++++++- src/markdown/markdown.ts | 8 +++++++- src/php/php.ts | 9 ++++++++- src/powershell/powershell.ts | 8 +++++++- src/pug/pug.ts | 5 ++++- src/python/python.ts | 9 ++++++++- src/scss/scss.ts | 8 +++++++- src/vb/vb.ts | 8 +++++++- src/yaml/yaml.ts | 3 +++ 17 files changed, 115 insertions(+), 15 deletions(-) diff --git a/src/bat/bat.ts b/src/bat/bat.ts index 953aab2c..69408bab 100644 --- a/src/bat/bat.ts +++ b/src/bat/bat.ts @@ -27,7 +27,13 @@ export const conf: IRichLanguageConfiguration = { { open: '[', close: ']' }, { open: '(', close: ')' }, { open: '"', close: '"' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*(::\\s*|REM\\s+)#region"), + end: new RegExp("^\\s*(::\\s*|REM\\s+)#endregion") + } + } }; export const language = { diff --git a/src/coffee/coffee.ts b/src/coffee/coffee.ts index 7dc780cc..e64cd1ca 100644 --- a/src/coffee/coffee.ts +++ b/src/coffee/coffee.ts @@ -32,7 +32,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*#region\\b"), + end: new RegExp("^\\s*#endregion\\b") + } + } }; export const language = { diff --git a/src/cpp/cpp.ts b/src/cpp/cpp.ts index 799e1bdc..7e631cbc 100644 --- a/src/cpp/cpp.ts +++ b/src/cpp/cpp.ts @@ -31,7 +31,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*#pragma\\s+region\\b"), + end: new RegExp("^\\s*#pragma\\s+endregion\\b") + } + } }; export const language = { diff --git a/src/csharp/csharp.ts b/src/csharp/csharp.ts index d07e5f5c..00747ed7 100644 --- a/src/csharp/csharp.ts +++ b/src/csharp/csharp.ts @@ -33,7 +33,13 @@ export const conf: IRichLanguageConfiguration = { { open: '<', close: '>' }, { open: '\'', close: '\'' }, { open: '"', close: '"' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*#region\\b"), + end: new RegExp("^\\s*#endregion\\b") + } + } }; export const language = { diff --git a/src/css/css.ts b/src/css/css.ts index f6b6c0ae..c987d8be 100644 --- a/src/css/css.ts +++ b/src/css/css.ts @@ -35,7 +35,14 @@ export const conf: LanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' } - ] + ], + + folding: { + markers: { + start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"), + end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/") + } + } }; export const language = { diff --git a/src/fsharp/fsharp.ts b/src/fsharp/fsharp.ts index 26a8da6c..42fce872 100644 --- a/src/fsharp/fsharp.ts +++ b/src/fsharp/fsharp.ts @@ -30,7 +30,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' } - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*//\\s*#region\\b|^\\s*\\(\\*\\s*#region(.*)\\*\\)"), + end: new RegExp("^\\s*//\\s*#endregion\\b|^\\s*\\(\\*\\s*#endregion\\s*\\*\\)") + } + } }; export const language = { diff --git a/src/html/html.ts b/src/html/html.ts index 0a56e243..e8a45486 100644 --- a/src/html/html.ts +++ b/src/html/html.ts @@ -55,6 +55,13 @@ export const conf: IRichLanguageConfiguration = { action: { indentAction: _monaco.languages.IndentAction.Indent } } ], + + folding: { + markers: { + start: new RegExp("^\\s*"), + end: new RegExp("^\\s*") + } + } }; export const language = { diff --git a/src/java/java.ts b/src/java/java.ts index 893b072e..521dd7e1 100644 --- a/src/java/java.ts +++ b/src/java/java.ts @@ -34,7 +34,13 @@ export const conf: IRichLanguageConfiguration = { { open: '"', close: '"' }, { open: '\'', close: '\'' }, { open: '<', close: '>' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:))") + } + } }; export const language = { diff --git a/src/less/less.ts b/src/less/less.ts index 03ee4256..d3c3a79f 100644 --- a/src/less/less.ts +++ b/src/less/less.ts @@ -32,7 +32,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"), + end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/") + } + } }; export const language = { diff --git a/src/markdown/markdown.ts b/src/markdown/markdown.ts index fe51ce74..9edf2d66 100644 --- a/src/markdown/markdown.ts +++ b/src/markdown/markdown.ts @@ -44,7 +44,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '[', close: ']' }, { open: '`', close: '`' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*"), + end: new RegExp("^\\s*") + } + } }; export const language = { diff --git a/src/php/php.ts b/src/php/php.ts index f05217a7..5848206a 100644 --- a/src/php/php.ts +++ b/src/php/php.ts @@ -28,7 +28,14 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')', notIn: ['string'] }, { open: '"', close: '"', notIn: ['string'] }, { open: '\'', close: '\'', notIn: ['string', 'comment'] } - ] + ], + + folding: { + markers: { + start: new RegExp("^\\s*(#|\/\/)region\\b"), + end: new RegExp("^\\s*(#|\/\/)endregion\\b") + } + } }; export const language = { diff --git a/src/powershell/powershell.ts b/src/powershell/powershell.ts index 41eba309..21311c60 100644 --- a/src/powershell/powershell.ts +++ b/src/powershell/powershell.ts @@ -33,7 +33,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*#region\\b"), + end: new RegExp("^\\s*#endregion\\b") + } + } }; export const language = { diff --git a/src/pug/pug.ts b/src/pug/pug.ts index ea625616..26b1b77b 100644 --- a/src/pug/pug.ts +++ b/src/pug/pug.ts @@ -19,7 +19,10 @@ export const conf: IRichLanguageConfiguration = { { open: '{', close: '}', notIn: ['string', 'comment'] }, { open: '[', close: ']', notIn: ['string', 'comment'] }, { open: '(', close: ')', notIn: ['string', 'comment'] }, - ] + ], + folding: { + offSide: true + } }; export const language = { diff --git a/src/python/python.ts b/src/python/python.ts index 25fe4fcb..06c715ea 100644 --- a/src/python/python.ts +++ b/src/python/python.ts @@ -31,7 +31,14 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, - ] + ], + folding: { + offSide: true, + markers: { + start: new RegExp("^\\s*#region\\b"), + end: new RegExp("^\\s*#endregion\\b") + } + } }; export const language = { diff --git a/src/scss/scss.ts b/src/scss/scss.ts index 6f54e861..1fb6d860 100644 --- a/src/scss/scss.ts +++ b/src/scss/scss.ts @@ -32,7 +32,13 @@ export const conf: LanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"), + end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/") + } + } }; export const language = { diff --git a/src/vb/vb.ts b/src/vb/vb.ts index 53fb67ad..ba0c83c4 100644 --- a/src/vb/vb.ts +++ b/src/vb/vb.ts @@ -47,7 +47,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')', notIn: ['string', 'comment'] }, { open: '"', close: '"', notIn: ['string', 'comment'] }, { open: '<', close: '>', notIn: ['string', 'comment'] }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*#Region\\b"), + end: new RegExp("^\\s*#End Region\\b") + } + } }; export const language = { diff --git a/src/yaml/yaml.ts b/src/yaml/yaml.ts index 2cc6f499..ee6f8fe5 100644 --- a/src/yaml/yaml.ts +++ b/src/yaml/yaml.ts @@ -24,6 +24,9 @@ export const conf: IRichLanguageConfiguration = { { open: '"', close: '"' }, { open: '\'', close: '\'' }, ], + folding: { + offSide: true + } }; export const language = { From 1fb34177ec69e80e55087be155922721b33f1fbf Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 14 Mar 2018 11:52:58 +0100 Subject: [PATCH 18/18] 1.0.3 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index bfd0411e..e527b393 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 27e5931e..0995cc83 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monaco-languages", - "version": "1.0.2", + "version": "1.0.3", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { "compile": "mrmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json",