mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 17:25:39 +01:00
Optimize how external libs are handled and allow for custom languages:
* Adding/removing extra libs does not trigger a full worker refresh * Manual control over when the extra libs are sent to the worker * Adding a new lib with the same name replaces it inplace Also included, the capability to define custom languages
This commit is contained in:
parent
505232c7c8
commit
e39fa719bc
7 changed files with 167 additions and 59 deletions
|
|
@ -29,6 +29,8 @@ bundleOne('monaco.contribution');
|
|||
bundleOne('tsMode');
|
||||
bundleOne('tsWorker');
|
||||
|
||||
updateImports('monaco.contribution');
|
||||
|
||||
function bundleOne(moduleId, exclude) {
|
||||
requirejs.optimize({
|
||||
baseUrl: 'release/dev/',
|
||||
|
|
@ -36,7 +38,8 @@ function bundleOne(moduleId, exclude) {
|
|||
out: 'release/min/' + moduleId + '.js',
|
||||
exclude: exclude,
|
||||
paths: {
|
||||
'vs/language/typescript': REPO_ROOT + '/release/dev'
|
||||
'vs/language/typescript': REPO_ROOT + '/release/dev',
|
||||
'vs/basic-languages': REPO_ROOT + '/node_modules/monaco-languages/release/dev'
|
||||
},
|
||||
optimize: 'none'
|
||||
}, function(buildResponse) {
|
||||
|
|
@ -53,3 +56,11 @@ function bundleOne(moduleId, exclude) {
|
|||
fs.writeFileSync(filePath, BUNDLED_FILE_HEADER + result.code);
|
||||
})
|
||||
}
|
||||
|
||||
function updateImports(moduleId) {
|
||||
console.log(`ESM: updating relative imports paths for ${moduleId}...`);
|
||||
const filePath = path.join(REPO_ROOT, 'release/esm/' + moduleId + '.js');
|
||||
var fileContents = fs.readFileSync(filePath).toString();
|
||||
fileContents = fileContents.replace(/vs\/basic-languages\//g, "../../basic-languages/");
|
||||
fs.writeFileSync(filePath, fileContents);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue