From 13fb3f4b6cc8a2d3a047990f0a08bc837beb02f1 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 13 Mar 2018 11:35:55 +0100 Subject: [PATCH] Adopt latest monaco-editor-core --- gulpfile.js | 34 +++++++++++++++++++++++----------- metadata.js | 2 +- package-lock.json | 6 +++--- package.json | 2 +- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 12f60280..0bd700e2 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -33,6 +33,9 @@ gulp.task('release', ['clean-release'], function() { // min folder releaseOne('min'), + // // esm folder + // releaseESM(), + // package.json gulp.src('package.json') .pipe(es.through(function(data) { @@ -71,6 +74,12 @@ function releaseOne(type) { ) } +// function releaseESM() { +// // return es.merge( +// // gulp.src('node_modules/monaco-editor-core/esm/**/*') +// // ) +// } + function pluginStreams(type, destinationPath) { return es.merge( metadata.METADATA.PLUGINS.map(function(plugin) { @@ -95,7 +104,7 @@ function pluginStream(plugin, type, destinationPath) { /** * Edit editor.main.js: * - rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main' - * - append contribs from plugins + * - append monaco.contribution modules from plugins * - append new AMD module 'vs/editor/editor.main' that stiches things together */ function addPluginContribs(type) { @@ -118,22 +127,25 @@ function addPluginContribs(type) { var contribPath = path.join(__dirname, pluginPath, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js'; var contribContents = fs.readFileSync(contribPath).toString(); - // Check for the anonymous define call case - var contribDefineIndexCase0 = contribContents.indexOf('define(function'); - if (contribDefineIndexCase0 >= 0) { + // Check for the anonymous define call case 1 + // transform define(function() {...}) to define("moduleId",["require"],function() {...}) + var anonymousContribDefineCase1 = contribContents.indexOf('define(function'); + if (anonymousContribDefineCase1 >= 0) { contribContents = ( - contribContents.substring(0, contribDefineIndexCase0) + contribContents.substring(0, anonymousContribDefineCase1) + `define("${plugin.contrib}",["require"],function` - + contribContents.substring(contribDefineIndexCase0 + 'define(function'.length) + + contribContents.substring(anonymousContribDefineCase1 + 'define(function'.length) ); } - var contribDefineIndexCase1 = contribContents.indexOf('define(['); - if (contribDefineIndexCase1 >= 0) { + // Check for the anonymous define call case 2 + // transform define([ to define("moduleId",[ + var anonymousContribDefineCase2 = contribContents.indexOf('define(['); + if (anonymousContribDefineCase2 >= 0) { contribContents = ( - contribContents.substring(0, contribDefineIndexCase1) + contribContents.substring(0, anonymousContribDefineCase2) + `define("${plugin.contrib}",[` - + contribContents.substring(contribDefineIndexCase1 + 'define(['.length) + + contribContents.substring(anonymousContribDefineCase2 + 'define(['.length) ); } @@ -149,7 +161,7 @@ function addPluginContribs(type) { process.exit(-1); } - contribContents = contribContents.substring(0, depsEndIndex) + ',"vs/editor/edcore.main"' + contribContents.substring(depsEndIndex); + contribContents = contribContents.substring(0, depsEndIndex) + ',"vs/editor/editor.api"' + contribContents.substring(depsEndIndex); extraContent.push(contribContents); }); diff --git a/metadata.js b/metadata.js index 28ec2247..68f576a6 100644 --- a/metadata.js +++ b/metadata.js @@ -35,7 +35,7 @@ contrib: 'vs/language/json/monaco.contribution', modulePrefix: 'vs/language/json', paths: { - src: '/monaco-json/release/min', + src: '/monaco-json/release/dev', 'npm/dev': 'node_modules/monaco-json/release/dev', 'npm/min': 'node_modules/monaco-json/release/min', } diff --git a/package-lock.json b/package-lock.json index 4228665e..996eb6dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2377,9 +2377,9 @@ "dev": true }, "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==", + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.11.3.tgz", + "integrity": "sha512-e6o/TInK+sRgWaWNj8kIaNinfmTC1vQdwF6QUaZ7h0OT+xILM6zxl+4B0imIbKm7iBYSZR2avH8Hbg8h6qQ2+g==", "dev": true }, "monaco-html": { diff --git a/package.json b/package.json index 74713318..579d8da3 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "gulp-typedoc": "^2.0.0", "http-server": "^0.9.0", "monaco-css": "2.0.0", - "monaco-editor-core": "0.11.1", + "monaco-editor-core": "0.11.3", "monaco-html": "2.0.1", "monaco-json": "2.0.0", "monaco-languages": "1.0.0",