chiark / gitweb /
fix ts build system to use tsconfig.json
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 4 Oct 2020 23:00:18 +0000 (00:00 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 4 Oct 2020 23:00:37 +0000 (00:00 +0100)
This thing ignores your tsconfig.json if you provide input files

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
.gitignore
Makefile
templates/bigfloat.ts
tsconfig.json

index 2580622c3878174949ba0919c8488791902c491b..2dd99c4ff846e6a674d8759d8c98042fdf7b510d 100644 (file)
@@ -6,3 +6,4 @@ templates/CC-BY-SA-4.0
 save/lock
 /library/*/*.usvg
 *.tmp
+.tsconfig.json
index 43b4554b633a7647209a1395a7e0a5ae713d16ae..4bb4c94c278c90525c1c011aaa4e03f869c4da69 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -80,8 +80,10 @@ $(CARGO_TARGET_DIR)/debug/server:
 $(CARGO_TARGET_DIR)/release/server:
        $(CARGO) build --release
 
-templates/script.js: $(TS_SRC_FILES) tsconfig.json
-       tsc --outfile $@.tmp $(TS_SRC_FILES) 2>&1 \
+templates/script.js: tsconfig.json $(TS_SRC_FILES)
+       sed <tsconfig.json >.tsconfig.json \
+               '/^ *"files":/ s#:.*#:[$(foreach f,$(TS_SRC_FILES),"$f",)]#'
+       tsc --outfile $@.tmp -p .tsconfig.json 2>&1 \
        | perl -pe 's/\((\d+),(\d+)\):/:$$1:$$2:/'; \
        test "$${PIPESTATUS[*]}" = "0 0"
        mv -f $@.tmp $@
index 0fafc01288d98420cb58d89de4f8d8f09402f4ea..9535f4728261c777199632648eb4090beb07347b 100644 (file)
@@ -62,6 +62,7 @@ namespace Bigfloats {
 
   export function unpack(p: Packed): Unpacked {
     let head = p.match(UNPACK_HEAD_RE);
+    if (head == null) throw('unpack Bigfloat '+p);
     UNPACK_LIMB_RE.lastIndex = 0;
     let limbs = [];
     let m;
@@ -116,8 +117,8 @@ namespace Bigfloats {
     let newlimb = ms_limb_from_sign(v);
     let adj = 0;
     while (i < 0) {
-      this.limbs.unshift(newlimb);
-      this.exponent++;
+      v.limbs.unshift(newlimb);
+      v.exponent++;
       i++;
       adj++;
     }
@@ -160,7 +161,7 @@ namespace Bigfloats {
       let ib = bv.exponent - e;
       if (ia >= av.limbs.length && ib >= bv.limbs.length) {
        // Oh actually these numbers are equal!
-       return function(){ return this.pack(); }
+       return function(){ return pack(av); }
       }
       let la = limb_lookup(av,ia);
       let lb = limb_lookup(bv,ib);
@@ -169,7 +170,7 @@ namespace Bigfloats {
 
       let current = clone(av);
       let i = ia + extend_left_so_index_valid(current, ia);
-      let step; // floating!
+      let step : number; // actual floating point!
       if (avail > count+1) {
        step = avail / (count+1);
       } else {
index de9dc7cf0b4485cd268b76428f3550d145853897..7331aebf89f2b4a70cf585bcfd5a1e044390c104 100644 (file)
@@ -8,6 +8,8 @@
             "dom"
         ],
         "strict": true,
-        "target": "es2015"
-    }
+        "target": "es2015",
+        "removeComments": false,
+    },
+    "files": "--substituted by Makefile--",
 }