Skip to content
This repository was archived by the owner on Nov 5, 2021. It is now read-only.

Commit 60f85d7

Browse files
committed
Adds support for the requires in TS 4.1b
1 parent f92998e commit 60f85d7

8 files changed

+16532
-13789
lines changed

Diff for: package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"pretty-quick": "^3.0.0",
3333
"requirejs": "^2.3.6",
3434
"terser": "^5.3.0",
35-
"typescript": "^4.0.2"
35+
"typescript": "^4.1.0-dev.20200911"
3636
},
3737
"husky": {
3838
"hooks": {

Diff for: scripts/importTypescript.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n`
5959
'$1// MONACOCHANGE\n$1var result = undefined;\n$1// END MONACOCHANGE'
6060
);
6161

62+
tsServices = tsServices.replace(
63+
/^( +)fs = require\("fs"\);$/m,
64+
'$1// MONACOCHANGE\n$1fs = undefined;\n$1// END MONACOCHANGE'
65+
);
66+
6267
// Flag any new require calls (outside comments) so they can be corrected preemptively.
6368
// To avoid missing cases (or using an even more complex regex), temporarily remove comments
6469
// about require() and then check for lines actually calling require().
@@ -74,13 +79,13 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n`
7479

7580
// Allow error messages to include references to require() in their strings
7681
const runtimeRequires =
77-
linesWithRequire && linesWithRequire.filter((l) => !l.includes(': diag('));
82+
linesWithRequire && linesWithRequire.filter((l) => !l.includes(': diag(') && !l.includes("ts.DiagnosticCategory"));
7883

7984
if (runtimeRequires && runtimeRequires.length && linesWithRequire) {
8085
console.error(
8186
'Found new require() calls on the following lines. These should be removed to avoid breaking webpack builds.\n'
8287
);
83-
console.error(linesWithRequire.join('\n'));
88+
console.error(runtimeRequires.map(r => `${r} (${tsServicesNoCommentedRequire.indexOf(r)})`).join('\n'));
8489
process.exit(1);
8590
}
8691

Diff for: src/lib/lib.ts

+6-6
Large diffs are not rendered by default.

Diff for: src/lib/typescriptServices-amd.js

+8,124-6,783
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)