mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 17:25:39 +01:00
Merge pull request #49 from ecraig12345/remove-require
Remove another require call
This commit is contained in:
commit
40dcf9d8a0
4 changed files with 22 additions and 4 deletions
|
|
@ -34,10 +34,24 @@ const TYPESCRIPT_LIB_DESTINATION = path.join(__dirname, '../src/lib');
|
||||||
tsServices.replace(/\n ts\.sys =([^]*)\n \}\)\(\);/m, `\n // MONACOCHANGE\n ts.sys = undefined;\n // END MONACOCHANGE`)
|
tsServices.replace(/\n ts\.sys =([^]*)\n \}\)\(\);/m, `\n // MONACOCHANGE\n ts.sys = undefined;\n // END MONACOCHANGE`)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Eliminate another require() call...
|
// Eliminate more require() calls...
|
||||||
tsServices = (
|
tsServices = (
|
||||||
tsServices.replace(/return require\(fileNameToRequire\);/, `// MONACOCHANGE\n return undefined;\n // END MONACOCHANGE`)
|
tsServices.replace(/return require\(fileNameToRequire\);/, `// MONACOCHANGE\n return undefined;\n // END MONACOCHANGE`)
|
||||||
);
|
);
|
||||||
|
tsServices = tsServices.replace(/^( +)etwModule = require\(.*$/m, '$1// MONACOCHANGE\n$1etwModule = undefined;\n$1// END MONACOCHANGE');
|
||||||
|
|
||||||
|
// Flag any new require calls (outside comments) so they can be corrected preemptively.
|
||||||
|
// To avoid missing cases (or using an even more complex regex), temporarily remove comments
|
||||||
|
// about require() and then check for lines actually calling require().
|
||||||
|
// \/[*/] matches the start of a comment (single or multi-line).
|
||||||
|
// ^\s+\*[^/] matches (presumably) a later line of a multi-line comment.
|
||||||
|
const tsServicesNoCommentedRequire = tsServices.replace(/(\/[*/]|^\s+\*[^/]).*\brequire\(.*/gm, '');
|
||||||
|
const linesWithRequire = tsServicesNoCommentedRequire.match(/^.*?\brequire\(.*$/gm);
|
||||||
|
if (linesWithRequire && linesWithRequire.length) {
|
||||||
|
console.error('Found new require() calls on the following lines. These should be removed to avoid breaking webpack builds.\n');
|
||||||
|
console.error(linesWithRequire.join('\n'));
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure process.args don't get called in the browser, this
|
// Make sure process.args don't get called in the browser, this
|
||||||
// should only happen in TS 2.6.2
|
// should only happen in TS 2.6.2
|
||||||
|
|
|
||||||
|
|
@ -2417,7 +2417,9 @@ var ts;
|
||||||
try {
|
try {
|
||||||
// require() will throw an exception if the module is not installed
|
// require() will throw an exception if the module is not installed
|
||||||
// It may also return undefined if not installed properly
|
// It may also return undefined if not installed properly
|
||||||
etwModule = require("@microsoft/typescript-etw"); // tslint:disable-line:no-implicit-dependencies
|
// MONACOCHANGE
|
||||||
|
etwModule = undefined;
|
||||||
|
// END MONACOCHANGE
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
etwModule = undefined;
|
etwModule = undefined;
|
||||||
|
|
|
||||||
|
|
@ -2417,7 +2417,9 @@ var ts;
|
||||||
try {
|
try {
|
||||||
// require() will throw an exception if the module is not installed
|
// require() will throw an exception if the module is not installed
|
||||||
// It may also return undefined if not installed properly
|
// It may also return undefined if not installed properly
|
||||||
etwModule = require("@microsoft/typescript-etw"); // tslint:disable-line:no-implicit-dependencies
|
// MONACOCHANGE
|
||||||
|
etwModule = undefined;
|
||||||
|
// END MONACOCHANGE
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
etwModule = undefined;
|
etwModule = undefined;
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
export const typescriptVersion = "3.5.1";
|
export const typescriptVersion = "3.6.2";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue