mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 12:45:39 +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) {
|
||||
return es.merge(
|
||||
gulp.src('node_modules/monaco-editor-core/' + type + '/**/*')
|
||||
.pipe(addPluginContribs())
|
||||
.pipe(addPluginContribs(type))
|
||||
.pipe(gulp.dest('release/' + type)),
|
||||
pluginStreams('release/' + type + '/')
|
||||
pluginStreams(type, 'release/' + type + '/')
|
||||
)
|
||||
}
|
||||
|
||||
function pluginStreams(destinationPath) {
|
||||
function pluginStreams(type, destinationPath) {
|
||||
return es.merge(
|
||||
metadata.METADATA.PLUGINS.map(function(plugin) {
|
||||
return pluginStream(plugin, destinationPath);
|
||||
return pluginStream(plugin, type, destinationPath);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
function pluginStream(plugin, destinationPath) {
|
||||
var contribPath = path.join(plugin.paths.npm, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js';
|
||||
function pluginStream(plugin, type, destinationPath) {
|
||||
var pluginPath = plugin.paths[`npm/${type}`]; // npm/dev or npm/min
|
||||
var contribPath = path.join(pluginPath, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js';
|
||||
return (
|
||||
gulp.src([
|
||||
plugin.paths.npm + '/**/*',
|
||||
pluginPath + '/**/*',
|
||||
'!' + contribPath,
|
||||
'!' + plugin.paths.npm + '/**/monaco.d.ts'
|
||||
'!' + pluginPath + '/**/monaco.d.ts'
|
||||
])
|
||||
.pipe(gulp.dest(destinationPath + plugin.modulePrefix))
|
||||
);
|
||||
|
|
@ -97,7 +98,7 @@ function pluginStream(plugin, destinationPath) {
|
|||
* - append contribs from plugins
|
||||
* - append new AMD module 'vs/editor/editor.main' that stiches things together
|
||||
*/
|
||||
function addPluginContribs() {
|
||||
function addPluginContribs(type) {
|
||||
return es.through(function(data) {
|
||||
if (!/editor\.main\.js$/.test(data.path)) {
|
||||
this.emit('data', data);
|
||||
|
|
@ -113,18 +114,38 @@ function addPluginContribs() {
|
|||
|
||||
metadata.METADATA.PLUGINS.forEach(function(plugin) {
|
||||
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();
|
||||
|
||||
// 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);
|
||||
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);
|
||||
}
|
||||
|
||||
var depsEndIndex = contribContents.indexOf(']', contribDefineIndex);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +180,8 @@ function addPluginDTS() {
|
|||
|
||||
var extraContent = [];
|
||||
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 {
|
||||
extraContent.push(fs.readFileSync(dtsPath).toString());
|
||||
} catch (err) {
|
||||
|
|
|
|||
31
metadata.js
31
metadata.js
|
|
@ -3,9 +3,9 @@
|
|||
var METADATA = {
|
||||
CORE: {
|
||||
paths: {
|
||||
npm: 'node_modules/monaco-editor-core/min/vs',
|
||||
// npm: 'node_modules/monaco-editor-core/dev/vs',
|
||||
dev: '/vscode/out/vs',
|
||||
src: '/vscode/out/vs',
|
||||
'npm/dev': 'node_modules/monaco-editor-core/dev/vs',
|
||||
'npm/min': 'node_modules/monaco-editor-core/min/vs',
|
||||
built: '/vscode/out-monaco-editor-core/min/vs',
|
||||
releaseDev: 'release/dev/vs',
|
||||
releaseMin: 'release/min/vs',
|
||||
|
|
@ -17,24 +17,27 @@
|
|||
modulePrefix: 'vs/language/typescript',
|
||||
thirdPartyNotices: 'node_modules/monaco-typescript/ThirdPartyNotices.txt',
|
||||
paths: {
|
||||
npm: 'node_modules/monaco-typescript/release',
|
||||
dev: '/monaco-typescript/release/dev'
|
||||
src: '/monaco-typescript/release/dev',
|
||||
'npm/dev': 'node_modules/monaco-typescript/release/dev',
|
||||
'npm/min': 'node_modules/monaco-typescript/release/min',
|
||||
}
|
||||
},{
|
||||
name: 'monaco-css',
|
||||
contrib: 'vs/language/css/monaco.contribution',
|
||||
modulePrefix: 'vs/language/css',
|
||||
paths: {
|
||||
npm: 'node_modules/monaco-css/release/min',
|
||||
dev: '/monaco-css/release/dev'
|
||||
src: '/monaco-css/release/dev',
|
||||
'npm/dev': 'node_modules/monaco-css/release/dev',
|
||||
'npm/min': 'node_modules/monaco-css/release/min',
|
||||
}
|
||||
},{
|
||||
name: 'monaco-json',
|
||||
contrib: 'vs/language/json/monaco.contribution',
|
||||
modulePrefix: 'vs/language/json',
|
||||
paths: {
|
||||
npm: 'node_modules/monaco-json/release/min',
|
||||
dev: '/monaco-json/release/min'
|
||||
src: '/monaco-json/release/min',
|
||||
'npm/dev': 'node_modules/monaco-json/release/dev',
|
||||
'npm/min': 'node_modules/monaco-json/release/min',
|
||||
}
|
||||
},{
|
||||
name: 'monaco-html',
|
||||
|
|
@ -42,8 +45,9 @@
|
|||
modulePrefix: 'vs/language/html',
|
||||
thirdPartyNotices: 'node_modules/monaco-html/ThirdPartyNotices.txt',
|
||||
paths: {
|
||||
npm: 'node_modules/monaco-html/release/min',
|
||||
dev: '/monaco-html/release/dev'
|
||||
src: '/monaco-html/release/dev',
|
||||
'npm/dev': 'node_modules/monaco-html/release/dev',
|
||||
'npm/min': 'node_modules/monaco-html/release/min',
|
||||
}
|
||||
},{
|
||||
name: 'monaco-languages',
|
||||
|
|
@ -51,8 +55,9 @@
|
|||
modulePrefix: 'vs/basic-languages',
|
||||
thirdPartyNotices: 'node_modules/monaco-languages/ThirdPartyNotices.txt',
|
||||
paths: {
|
||||
npm: 'node_modules/monaco-languages/release',
|
||||
dev: '/monaco-languages/release/dev'
|
||||
src: '/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-typedoc": "^2.0.0",
|
||||
"http-server": "^0.9.0",
|
||||
"monaco-css": "1.3.3",
|
||||
"monaco-editor-core": "0.10.1",
|
||||
"monaco-html": "1.3.2",
|
||||
"monaco-json": "1.3.2",
|
||||
"monaco-languages": "0.9.0",
|
||||
"monaco-typescript": "2.3.0",
|
||||
"monaco-css": "2.0.0",
|
||||
"monaco-editor-core": "0.11.1",
|
||||
"monaco-html": "2.0.1",
|
||||
"monaco-json": "2.0.0",
|
||||
"monaco-languages": "1.0.0",
|
||||
"monaco-typescript": "3.0.0",
|
||||
"rimraf": "^2.5.2",
|
||||
"typedoc": "^0.8.0",
|
||||
"uncss": "^0.14.1"
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@
|
|||
}
|
||||
var overwrites = parseQueryString();
|
||||
var result = {};
|
||||
result['editor'] = overwrites['editor'] || 'npm';
|
||||
result['editor'] = overwrites['editor'] || 'npm/dev';
|
||||
METADATA.PLUGINS.map(function(plugin) {
|
||||
result[plugin.name] = overwrites[plugin.name] || 'npm';
|
||||
result[plugin.name] = overwrites[plugin.name] || 'npm/dev';
|
||||
});
|
||||
return result;
|
||||
})();
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
};
|
||||
Component.prototype.getResolvedPath = function() {
|
||||
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) {
|
||||
resolvedPath = DIRNAME + '/../' + resolvedPath;
|
||||
} else {
|
||||
|
|
@ -76,9 +76,9 @@
|
|||
Component.prototype.generateUrlForPath = function(pathName) {
|
||||
var NEW_LOADER_OPTS = {};
|
||||
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 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