Hello, since 2019 the upstream tsc.js has moved its internals around and
removed chakra support. So no matter the fuzz setting, the tsc.patch
from quickjs-typescript-linux-x86 makes a broken tsc because of context
mismatches. Attaching a patch for the patch that makes it apply with
typescript-3.9.2 and 4.0.0-dev.
Resulting typescript executable prints help and builds my scripts ok.
Can't build third-party libraries however:
git clone https://github.com/bikeshaving/crank
cd crank
~/tsc -m system --outFile _ src/index.ts
# InternalError: stack overflow
# at onSubstituteNode (tsc.js:66922)
Please look if that's fixable.
~/tsc --version; qjsc
# Version 3.9.2
# QuickJS Compiler version 2020-04-12
--- quickjs-typescript-linux-x86/src/tsc.patch 2019-08-18 12:44:21.000000000
+0300
+++ tsc.patch 2020-05-14 23:25:14.722574581 +0300
@@ -1,6 +1,4 @@
---- tsc.js.org 2019-08-10 01:15:50.000000000 +0200
-+++ tsc.js 2019-08-11 15:53:17.366727951 +0200
-@@ -12,9 +12,9 @@
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
+--- tsc.js.org 2020-05-14 22:51:23.690645468 +0300
++++ tsc.js 2020-05-14 23:25:09.574574760 +0300
+@@ -14,5 +14,5 @@
*****************************************************************************
*/
@@ -11,8 +9,4 @@
-"use strict";
- var __assign = (this && this.__assign) || function () {
- __assign = Object.assign || function(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
-@@ -1741,7 +1741,7 @@
- }
- Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
+ var __spreadArrays = (this && this.__spreadArrays) || function () {
+@@ -1737,3 +1737,3 @@
function fail(message, stackCrawlMark) {
@@ -21,8 +15,4 @@
var e = new Error(message ? "Debug Failure. " + message : "Debug
Failure.");
- if (Error.captureStackTrace) {
- Error.captureStackTrace(e, stackCrawlMark || fail);
-@@ -3198,6 +3198,145 @@
- realpath: realpath
- };
- }
+@@ -3189,2 +3189,141 @@
+ var byteOrderMarkIndicator = "\uFEFF";
+ function getQuickJSSystem() {
@@ -166,16 +156,7 @@
+ }
- function recursiveCreateDirectory(directoryPath, sys) {
- var basePath = ts.getDirectoryPath(directoryPath);
- var shouldCreateParent = basePath !== "" && directoryPath !==
basePath && !sys.directoryExists(basePath);
-@@ -3209,7 +3348,10 @@
- }
- }
- var sys;
-- if (typeof ChakraHost !== "undefined") {
-+ if (typeof os !== "undefined") {
+ function getNodeSystem() {
+@@ -3661,2 +3800,4 @@
+ sys = getNodeSystem();
++ } else if (typeof os !== "undefined") {
+ sys = getQuickJSSystem();
-+ }
-+ else if (typeof ChakraHost !== "undefined") {
- sys = getChakraSystem();
}
- else if (typeof process !== "undefined" && process.nextTick &&
!process.browser && typeof require !== "undefined") {