mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Adopt latest modules
This commit is contained in:
parent
d899dc15be
commit
be4df5641b
7 changed files with 5849 additions and 1189 deletions
48
gulpfile.js
48
gulpfile.js
|
|
@ -65,27 +65,28 @@ gulp.task('release', ['clean-release'], function() {
|
||||||
function releaseOne(type) {
|
function releaseOne(type) {
|
||||||
return es.merge(
|
return es.merge(
|
||||||
gulp.src('node_modules/monaco-editor-core/' + type + '/**/*')
|
gulp.src('node_modules/monaco-editor-core/' + type + '/**/*')
|
||||||
.pipe(addPluginContribs())
|
.pipe(addPluginContribs(type))
|
||||||
.pipe(gulp.dest('release/' + type)),
|
.pipe(gulp.dest('release/' + type)),
|
||||||
pluginStreams('release/' + type + '/')
|
pluginStreams(type, 'release/' + type + '/')
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function pluginStreams(destinationPath) {
|
function pluginStreams(type, destinationPath) {
|
||||||
return es.merge(
|
return es.merge(
|
||||||
metadata.METADATA.PLUGINS.map(function(plugin) {
|
metadata.METADATA.PLUGINS.map(function(plugin) {
|
||||||
return pluginStream(plugin, destinationPath);
|
return pluginStream(plugin, type, destinationPath);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pluginStream(plugin, destinationPath) {
|
function pluginStream(plugin, type, destinationPath) {
|
||||||
var contribPath = path.join(plugin.paths.npm, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js';
|
var pluginPath = plugin.paths[`npm/${type}`]; // npm/dev or npm/min
|
||||||
|
var contribPath = path.join(pluginPath, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js';
|
||||||
return (
|
return (
|
||||||
gulp.src([
|
gulp.src([
|
||||||
plugin.paths.npm + '/**/*',
|
pluginPath + '/**/*',
|
||||||
'!' + contribPath,
|
'!' + contribPath,
|
||||||
'!' + plugin.paths.npm + '/**/monaco.d.ts'
|
'!' + pluginPath + '/**/monaco.d.ts'
|
||||||
])
|
])
|
||||||
.pipe(gulp.dest(destinationPath + plugin.modulePrefix))
|
.pipe(gulp.dest(destinationPath + plugin.modulePrefix))
|
||||||
);
|
);
|
||||||
|
|
@ -97,7 +98,7 @@ function pluginStream(plugin, destinationPath) {
|
||||||
* - append contribs from plugins
|
* - append contribs from plugins
|
||||||
* - append new AMD module 'vs/editor/editor.main' that stiches things together
|
* - append new AMD module 'vs/editor/editor.main' that stiches things together
|
||||||
*/
|
*/
|
||||||
function addPluginContribs() {
|
function addPluginContribs(type) {
|
||||||
return es.through(function(data) {
|
return es.through(function(data) {
|
||||||
if (!/editor\.main\.js$/.test(data.path)) {
|
if (!/editor\.main\.js$/.test(data.path)) {
|
||||||
this.emit('data', data);
|
this.emit('data', data);
|
||||||
|
|
@ -113,18 +114,38 @@ function addPluginContribs() {
|
||||||
|
|
||||||
metadata.METADATA.PLUGINS.forEach(function(plugin) {
|
metadata.METADATA.PLUGINS.forEach(function(plugin) {
|
||||||
allPluginsModuleIds.push(plugin.contrib);
|
allPluginsModuleIds.push(plugin.contrib);
|
||||||
var contribPath = path.join(__dirname, plugin.paths.npm, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js';
|
var pluginPath = plugin.paths[`npm/${type}`]; // npm/dev or npm/min
|
||||||
|
var contribPath = path.join(__dirname, pluginPath, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js';
|
||||||
var contribContents = fs.readFileSync(contribPath).toString();
|
var contribContents = fs.readFileSync(contribPath).toString();
|
||||||
|
|
||||||
|
// Check for the anonymous define call case
|
||||||
|
var contribDefineIndexCase0 = contribContents.indexOf('define(function');
|
||||||
|
if (contribDefineIndexCase0 >= 0) {
|
||||||
|
contribContents = (
|
||||||
|
contribContents.substring(0, contribDefineIndexCase0)
|
||||||
|
+ `define("${plugin.contrib}",["require"],function`
|
||||||
|
+ contribContents.substring(contribDefineIndexCase0 + 'define(function'.length)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var contribDefineIndexCase1 = contribContents.indexOf('define([');
|
||||||
|
if (contribDefineIndexCase1 >= 0) {
|
||||||
|
contribContents = (
|
||||||
|
contribContents.substring(0, contribDefineIndexCase1)
|
||||||
|
+ `define("${plugin.contrib}",[`
|
||||||
|
+ contribContents.substring(contribDefineIndexCase1 + 'define(['.length)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
var contribDefineIndex = contribContents.indexOf('define("' + plugin.contrib);
|
var contribDefineIndex = contribContents.indexOf('define("' + plugin.contrib);
|
||||||
if (contribDefineIndex === -1) {
|
if (contribDefineIndex === -1) {
|
||||||
console.error('(1) CANNOT DETERMINE AMD define location for contribution', plugin);
|
console.error('(1) CANNOT DETERMINE AMD define location for contribution', pluginPath);
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var depsEndIndex = contribContents.indexOf(']', contribDefineIndex);
|
var depsEndIndex = contribContents.indexOf(']', contribDefineIndex);
|
||||||
if (contribDefineIndex === -1) {
|
if (contribDefineIndex === -1) {
|
||||||
console.error('(2) CANNOT DETERMINE AMD define location for contribution', plugin);
|
console.error('(2) CANNOT DETERMINE AMD define location for contribution', pluginPath);
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -159,7 +180,8 @@ function addPluginDTS() {
|
||||||
|
|
||||||
var extraContent = [];
|
var extraContent = [];
|
||||||
metadata.METADATA.PLUGINS.forEach(function(plugin) {
|
metadata.METADATA.PLUGINS.forEach(function(plugin) {
|
||||||
var dtsPath = path.join(plugin.paths.npm, 'monaco.d.ts');
|
var pluginPath = plugin.paths[`npm/min`]; // npm/dev or npm/min
|
||||||
|
var dtsPath = path.join(pluginPath, '../monaco.d.ts');
|
||||||
try {
|
try {
|
||||||
extraContent.push(fs.readFileSync(dtsPath).toString());
|
extraContent.push(fs.readFileSync(dtsPath).toString());
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
||||||
31
metadata.js
31
metadata.js
|
|
@ -3,9 +3,9 @@
|
||||||
var METADATA = {
|
var METADATA = {
|
||||||
CORE: {
|
CORE: {
|
||||||
paths: {
|
paths: {
|
||||||
npm: 'node_modules/monaco-editor-core/min/vs',
|
src: '/vscode/out/vs',
|
||||||
// npm: 'node_modules/monaco-editor-core/dev/vs',
|
'npm/dev': 'node_modules/monaco-editor-core/dev/vs',
|
||||||
dev: '/vscode/out/vs',
|
'npm/min': 'node_modules/monaco-editor-core/min/vs',
|
||||||
built: '/vscode/out-monaco-editor-core/min/vs',
|
built: '/vscode/out-monaco-editor-core/min/vs',
|
||||||
releaseDev: 'release/dev/vs',
|
releaseDev: 'release/dev/vs',
|
||||||
releaseMin: 'release/min/vs',
|
releaseMin: 'release/min/vs',
|
||||||
|
|
@ -17,24 +17,27 @@
|
||||||
modulePrefix: 'vs/language/typescript',
|
modulePrefix: 'vs/language/typescript',
|
||||||
thirdPartyNotices: 'node_modules/monaco-typescript/ThirdPartyNotices.txt',
|
thirdPartyNotices: 'node_modules/monaco-typescript/ThirdPartyNotices.txt',
|
||||||
paths: {
|
paths: {
|
||||||
npm: 'node_modules/monaco-typescript/release',
|
src: '/monaco-typescript/release/dev',
|
||||||
dev: '/monaco-typescript/release/dev'
|
'npm/dev': 'node_modules/monaco-typescript/release/dev',
|
||||||
|
'npm/min': 'node_modules/monaco-typescript/release/min',
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
name: 'monaco-css',
|
name: 'monaco-css',
|
||||||
contrib: 'vs/language/css/monaco.contribution',
|
contrib: 'vs/language/css/monaco.contribution',
|
||||||
modulePrefix: 'vs/language/css',
|
modulePrefix: 'vs/language/css',
|
||||||
paths: {
|
paths: {
|
||||||
npm: 'node_modules/monaco-css/release/min',
|
src: '/monaco-css/release/dev',
|
||||||
dev: '/monaco-css/release/dev'
|
'npm/dev': 'node_modules/monaco-css/release/dev',
|
||||||
|
'npm/min': 'node_modules/monaco-css/release/min',
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
name: 'monaco-json',
|
name: 'monaco-json',
|
||||||
contrib: 'vs/language/json/monaco.contribution',
|
contrib: 'vs/language/json/monaco.contribution',
|
||||||
modulePrefix: 'vs/language/json',
|
modulePrefix: 'vs/language/json',
|
||||||
paths: {
|
paths: {
|
||||||
npm: 'node_modules/monaco-json/release/min',
|
src: '/monaco-json/release/min',
|
||||||
dev: '/monaco-json/release/min'
|
'npm/dev': 'node_modules/monaco-json/release/dev',
|
||||||
|
'npm/min': 'node_modules/monaco-json/release/min',
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
name: 'monaco-html',
|
name: 'monaco-html',
|
||||||
|
|
@ -42,8 +45,9 @@
|
||||||
modulePrefix: 'vs/language/html',
|
modulePrefix: 'vs/language/html',
|
||||||
thirdPartyNotices: 'node_modules/monaco-html/ThirdPartyNotices.txt',
|
thirdPartyNotices: 'node_modules/monaco-html/ThirdPartyNotices.txt',
|
||||||
paths: {
|
paths: {
|
||||||
npm: 'node_modules/monaco-html/release/min',
|
src: '/monaco-html/release/dev',
|
||||||
dev: '/monaco-html/release/dev'
|
'npm/dev': 'node_modules/monaco-html/release/dev',
|
||||||
|
'npm/min': 'node_modules/monaco-html/release/min',
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
name: 'monaco-languages',
|
name: 'monaco-languages',
|
||||||
|
|
@ -51,8 +55,9 @@
|
||||||
modulePrefix: 'vs/basic-languages',
|
modulePrefix: 'vs/basic-languages',
|
||||||
thirdPartyNotices: 'node_modules/monaco-languages/ThirdPartyNotices.txt',
|
thirdPartyNotices: 'node_modules/monaco-languages/ThirdPartyNotices.txt',
|
||||||
paths: {
|
paths: {
|
||||||
npm: 'node_modules/monaco-languages/release',
|
src: '/monaco-languages/release/dev',
|
||||||
dev: '/monaco-languages/release/dev'
|
'npm/dev': 'node_modules/monaco-languages/release/dev',
|
||||||
|
'npm/min': 'node_modules/monaco-languages/release/min',
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1324
monaco.d.ts
vendored
1324
monaco.d.ts
vendored
File diff suppressed because it is too large
Load diff
4289
package-lock.json
generated
Normal file
4289
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
12
package.json
12
package.json
|
|
@ -21,12 +21,12 @@
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-typedoc": "^2.0.0",
|
"gulp-typedoc": "^2.0.0",
|
||||||
"http-server": "^0.9.0",
|
"http-server": "^0.9.0",
|
||||||
"monaco-css": "1.3.3",
|
"monaco-css": "2.0.0",
|
||||||
"monaco-editor-core": "0.10.1",
|
"monaco-editor-core": "0.11.1",
|
||||||
"monaco-html": "1.3.2",
|
"monaco-html": "2.0.1",
|
||||||
"monaco-json": "1.3.2",
|
"monaco-json": "2.0.0",
|
||||||
"monaco-languages": "0.9.0",
|
"monaco-languages": "1.0.0",
|
||||||
"monaco-typescript": "2.3.0",
|
"monaco-typescript": "3.0.0",
|
||||||
"rimraf": "^2.5.2",
|
"rimraf": "^2.5.2",
|
||||||
"typedoc": "^0.8.0",
|
"typedoc": "^0.8.0",
|
||||||
"uncss": "^0.14.1"
|
"uncss": "^0.14.1"
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,9 @@
|
||||||
}
|
}
|
||||||
var overwrites = parseQueryString();
|
var overwrites = parseQueryString();
|
||||||
var result = {};
|
var result = {};
|
||||||
result['editor'] = overwrites['editor'] || 'npm';
|
result['editor'] = overwrites['editor'] || 'npm/dev';
|
||||||
METADATA.PLUGINS.map(function(plugin) {
|
METADATA.PLUGINS.map(function(plugin) {
|
||||||
result[plugin.name] = overwrites[plugin.name] || 'npm';
|
result[plugin.name] = overwrites[plugin.name] || 'npm/dev';
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
})();
|
})();
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
};
|
};
|
||||||
Component.prototype.getResolvedPath = function() {
|
Component.prototype.getResolvedPath = function() {
|
||||||
var resolvedPath = this.paths[this.selectedPath];
|
var resolvedPath = this.paths[this.selectedPath];
|
||||||
if (this.selectedPath === 'npm' || this.isRelease()) {
|
if (this.selectedPath === 'npm/dev' || this.selectedPath === 'npm/min' || this.isRelease()) {
|
||||||
if (IS_FILE_PROTOCOL) {
|
if (IS_FILE_PROTOCOL) {
|
||||||
resolvedPath = DIRNAME + '/../' + resolvedPath;
|
resolvedPath = DIRNAME + '/../' + resolvedPath;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -76,9 +76,9 @@
|
||||||
Component.prototype.generateUrlForPath = function(pathName) {
|
Component.prototype.generateUrlForPath = function(pathName) {
|
||||||
var NEW_LOADER_OPTS = {};
|
var NEW_LOADER_OPTS = {};
|
||||||
Object.keys(LOADER_OPTS).forEach(function(key) {
|
Object.keys(LOADER_OPTS).forEach(function(key) {
|
||||||
NEW_LOADER_OPTS[key] = (LOADER_OPTS[key] === 'npm' ? undefined : LOADER_OPTS[key]);
|
NEW_LOADER_OPTS[key] = (LOADER_OPTS[key] === 'npm/dev' ? undefined : LOADER_OPTS[key]);
|
||||||
});
|
});
|
||||||
NEW_LOADER_OPTS[this.name] = (pathName === 'npm' ? undefined : pathName);
|
NEW_LOADER_OPTS[this.name] = (pathName === 'npm/dev' ? undefined : pathName);
|
||||||
|
|
||||||
var search = Object.keys(NEW_LOADER_OPTS).map(function(key) {
|
var search = Object.keys(NEW_LOADER_OPTS).map(function(key) {
|
||||||
var value = NEW_LOADER_OPTS[key];
|
var value = NEW_LOADER_OPTS[key];
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue