mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 09:20:10 +01:00
Fixes #871
This commit is contained in:
parent
1b82be2abf
commit
5142ee6c30
3 changed files with 49 additions and 42 deletions
83
gulpfile.js
83
gulpfile.js
|
|
@ -203,7 +203,11 @@ function addPluginContribs(type) {
|
||||||
|
|
||||||
function ESM_release() {
|
function ESM_release() {
|
||||||
return es.merge(
|
return es.merge(
|
||||||
gulp.src('node_modules/monaco-editor-core/esm/**/*')
|
gulp.src([
|
||||||
|
'node_modules/monaco-editor-core/esm/**/*',
|
||||||
|
// we will create our own editor.api.d.ts which also contains the plugins API
|
||||||
|
'!node_modules/monaco-editor-core/esm/vs/editor/editor.api.d.ts'
|
||||||
|
])
|
||||||
.pipe(ESM_addImportSuffix())
|
.pipe(ESM_addImportSuffix())
|
||||||
.pipe(ESM_addPluginContribs('release/esm'))
|
.pipe(ESM_addPluginContribs('release/esm'))
|
||||||
.pipe(gulp.dest('release/esm')),
|
.pipe(gulp.dest('release/esm')),
|
||||||
|
|
@ -414,43 +418,11 @@ function addPluginDTS() {
|
||||||
|
|
||||||
data.contents = new Buffer(contents);
|
data.contents = new Buffer(contents);
|
||||||
|
|
||||||
{
|
this.emit('data', new File({
|
||||||
let lines = contents.split('\n');
|
path: path.join(path.dirname(data.path), 'esm/vs/editor/editor.api.d.ts'),
|
||||||
let killNextCloseCurlyBrace = false;
|
base: data.base,
|
||||||
for (let i = 0; i < lines.length; i++) {
|
contents: new Buffer(toExternalDTS(contents))
|
||||||
let line = lines[i];
|
}));
|
||||||
|
|
||||||
if (killNextCloseCurlyBrace) {
|
|
||||||
if ('}' === line) {
|
|
||||||
lines[i] = '';
|
|
||||||
killNextCloseCurlyBrace = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line.indexOf(' ') === 0) {
|
|
||||||
lines[i] = line.substr(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('declare namespace monaco {' === line) {
|
|
||||||
lines[i] = '';
|
|
||||||
killNextCloseCurlyBrace = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line.indexOf('declare namespace monaco.') === 0) {
|
|
||||||
lines[i] = line.replace('declare namespace monaco.', 'export namespace ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.emit('data', new File({
|
|
||||||
path: path.join(path.dirname(data.path), 'esm/vs/editor/editor.api.d.ts'),
|
|
||||||
base: data.base,
|
|
||||||
contents: new Buffer(lines.join('\n'))
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync('website/playground/monaco.d.ts.txt', contents);
|
fs.writeFileSync('website/playground/monaco.d.ts.txt', contents);
|
||||||
fs.writeFileSync('monaco.d.ts', contents);
|
fs.writeFileSync('monaco.d.ts', contents);
|
||||||
|
|
@ -458,6 +430,41 @@ function addPluginDTS() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toExternalDTS(contents) {
|
||||||
|
let lines = contents.split('\n');
|
||||||
|
let killNextCloseCurlyBrace = false;
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
let line = lines[i];
|
||||||
|
|
||||||
|
if (killNextCloseCurlyBrace) {
|
||||||
|
if ('}' === line) {
|
||||||
|
lines[i] = '';
|
||||||
|
killNextCloseCurlyBrace = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.indexOf(' ') === 0) {
|
||||||
|
lines[i] = line.substr(4);
|
||||||
|
} else if (line.charAt(0) === '\t') {
|
||||||
|
lines[i] = line.substr(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('declare namespace monaco {' === line) {
|
||||||
|
lines[i] = '';
|
||||||
|
killNextCloseCurlyBrace = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.indexOf('declare namespace monaco.') === 0) {
|
||||||
|
lines[i] = line.replace('declare namespace monaco.', 'export namespace ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalize line endings and ensure consistent 4 spaces indentation
|
* Normalize line endings and ensure consistent 4 spaces indentation
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
6
package-lock.json
generated
6
package-lock.json
generated
|
|
@ -2327,9 +2327,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"monaco-editor-core": {
|
"monaco-editor-core": {
|
||||||
"version": "0.13.1",
|
"version": "0.13.2",
|
||||||
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.13.2.tgz",
|
||||||
"integrity": "sha512-K+cmar8dUF/YcaQXt/3PWKQxA/i7qQLLq5GBWxBKheuW9uOCi25zYInVRgZROeA+jjB6UAowqgYr7ydsbPjbFQ==",
|
"integrity": "sha512-UwUpmT+37fryykVcfuG/KA3sUV/Siip2V+kzzH/F6gzi6QGAe/A/qvr5sfTALdoW55V5aVpUNctPFUw5Bm1Qeg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"monaco-html": {
|
"monaco-html": {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
"gulp-typedoc": "^2.0.0",
|
"gulp-typedoc": "^2.0.0",
|
||||||
"http-server": "^0.11.1",
|
"http-server": "^0.11.1",
|
||||||
"monaco-css": "2.1.1",
|
"monaco-css": "2.1.1",
|
||||||
"monaco-editor-core": "0.13.1",
|
"monaco-editor-core": "0.13.2",
|
||||||
"monaco-html": "2.1.1",
|
"monaco-html": "2.1.1",
|
||||||
"monaco-json": "2.1.1",
|
"monaco-json": "2.1.1",
|
||||||
"monaco-languages": "1.3.1",
|
"monaco-languages": "1.3.1",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue