mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 05:50:11 +01:00
repairs esm and amd build (#4950)
This commit is contained in:
parent
f420968fc9
commit
e56ad4b588
43 changed files with 2302 additions and 856 deletions
|
|
@ -1,7 +1,5 @@
|
|||
/// <reference path="../../out/monaco-editor/monaco.d.ts" />
|
||||
define(['require', './samples'], function (require, SAMPLES) {
|
||||
const domutils = require('vs/base/browser/dom');
|
||||
|
||||
let model = monaco.editor.createModel('', 'plaintext');
|
||||
|
||||
monaco.languages.typescript.typescriptDefaults.setInlayHintsOptions({
|
||||
|
|
@ -167,7 +165,7 @@ define(['require', './samples'], function (require, SAMPLES) {
|
|||
editor.setScrollTop(r);
|
||||
|
||||
if (speed >= 0) {
|
||||
domutils.scheduleAtNextAnimationFrame(scroll);
|
||||
requestAnimationFrame(scroll);
|
||||
} else {
|
||||
isRunning = false;
|
||||
}
|
||||
|
|
@ -179,7 +177,7 @@ define(['require', './samples'], function (require, SAMPLES) {
|
|||
isRunning = true;
|
||||
r = editor.getScrollTop();
|
||||
lastTime = new Date().getTime();
|
||||
domutils.runAtThisOrScheduleAtNextAnimationFrame(scroll);
|
||||
requestAnimationFrame(scroll);
|
||||
}
|
||||
};
|
||||
})()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// which can do work on a bg thread.
|
||||
|
||||
// This version of the vfs edits the global scope (in the case of a webworker, this is 'self')
|
||||
importScripts('https://unpkg.com/@typescript/vfs@1.3.0/dist/vfs.globals.js');
|
||||
import 'https://unpkg.com/@typescript/vfs@1.3.0/dist/vfs.globals.js';
|
||||
|
||||
/** @type { import("@typescript/vfs") } */
|
||||
const tsvfs = globalThis.tsvfs;
|
||||
|
|
|
|||
|
|
@ -42,13 +42,13 @@ async function runTests() {
|
|||
// uncomment to shortcircuit and run a specific combo
|
||||
// await runTest('webpack', 'chromium'); return;
|
||||
/** @type {PackagerKind[]} */
|
||||
const testTypes = ['amd', 'webpack', 'esbuild', 'vite'];
|
||||
const testTypes = ['webpack', 'esbuild', 'vite'];
|
||||
// TODO: add parcel! (this currently fails because parcel replaces process with {})
|
||||
|
||||
for (const type of testTypes) {
|
||||
await runTest(type, 'chromium');
|
||||
await runTest(type, 'firefox');
|
||||
await runTest(type, 'webkit');
|
||||
// await runTest(type, 'firefox');
|
||||
// await runTest(type, 'webkit');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
const requirejs = require('requirejs');
|
||||
const jsdom = require('jsdom');
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
|
||||
requirejs.config({
|
||||
baseUrl: '',
|
||||
paths: {
|
||||
'vs/fillers/monaco-editor-core': 'out/languages/amd-tsc/fillers/monaco-editor-core-amd',
|
||||
'vs/basic-languages': 'out/languages/amd-tsc/basic-languages',
|
||||
vs: './node_modules/monaco-editor-core/dev/vs'
|
||||
},
|
||||
nodeRequire: require
|
||||
});
|
||||
|
||||
const tmp = new jsdom.JSDOM('<!DOCTYPE html><html><body></body></html>');
|
||||
global.AMD = true;
|
||||
global.document = tmp.window.document;
|
||||
global.navigator = tmp.window.navigator;
|
||||
global.self = global;
|
||||
global.document.queryCommandSupported = function () {
|
||||
return false;
|
||||
};
|
||||
global.UIEvent = tmp.window.UIEvent;
|
||||
|
||||
global.window = {
|
||||
location: {},
|
||||
navigator: tmp.window.navigator,
|
||||
document: {
|
||||
body: tmp.window.document.body,
|
||||
addEventListener: (...args) => tmp.window.document.addEventListener(...args)
|
||||
},
|
||||
matchMedia: function () {
|
||||
return {
|
||||
matches: false,
|
||||
addEventListener: function () {}
|
||||
};
|
||||
},
|
||||
setInterval: function () {},
|
||||
setTimeout: function () {}
|
||||
};
|
||||
|
||||
requirejs(
|
||||
['test/unit/setup'],
|
||||
function () {
|
||||
glob(
|
||||
'out/languages/amd-tsc/basic-languages/*/*.test.js',
|
||||
{ cwd: path.join(__dirname, '../../') },
|
||||
function (err, files) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return;
|
||||
}
|
||||
requirejs(
|
||||
files.map((f) => f.replace(/^out\/languages\/amd-tsc/, 'vs').replace(/\.js$/, '')),
|
||||
function () {
|
||||
run(); // We can launch the tests!
|
||||
},
|
||||
function (err) {
|
||||
console.log(err);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
function (err) {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
}
|
||||
);
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
define('vs/css', [], {
|
||||
load: function (name, req, load) {
|
||||
load({});
|
||||
}
|
||||
});
|
||||
|
||||
define('vs/nls', [], {
|
||||
create: function () {
|
||||
return {
|
||||
localize: function () {
|
||||
return 'NO_LOCALIZATION_FOR_YOU';
|
||||
},
|
||||
localize2: function () {
|
||||
return 'NO_LOCALIZATION_FOR_YOU';
|
||||
},
|
||||
getConfiguredDefaultLocale: function () {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
},
|
||||
localize: function () {
|
||||
return 'NO_LOCALIZATION_FOR_YOU';
|
||||
},
|
||||
localize2: function (key, message) {
|
||||
return { value: 'NO_LOCALIZATION_FOR_YOU', original: message };
|
||||
},
|
||||
load: function (name, req, load) {
|
||||
load({});
|
||||
}
|
||||
});
|
||||
|
||||
define(['vs/editor/editor.main'], function (api) {
|
||||
global.monaco = api;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue