-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate-ipso-blob.pl
executable file
·71 lines (60 loc) · 1.27 KB
/
generate-ipso-blob.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /usr/bin/perl -w
use 5.006;
use strict;
system(q[
perl -i -wpe'
s/"module": "commonjs"/"module": "es2015"/
' tsconfig.json
]) == 0
or die "tsconfig.json substitution failed: $?";
system(q[
rm -rf lib/
]) == 0
or die "Removing lib/ failed: $?";
system(q[
npx tsc > /dev/null
]) == 512
or die "Compiling with 'tsc' gave an unexpected status code: $?";
system(q[
perl -i -wpe'
s/"module": "es2015"/"module": "commonjs"/
' tsconfig.json
]) == 0
or die "tsconfig.json back-substitution failed: $?";
-e "lib"
or die "lib/ wasn't created as expected";
my @files = qw<
value
tokenize
parse-value
prims
forms
env
expr
parse-expr
zip
std-env
kont
state
evaluate
>;
my $path = "../website-ipso/ipso.js";
open my $OUT, ">", $path
or die "Couldn't open $path for writing: $!";
for my $file (@files) {
open my $IN, "<", "lib/src/$file.js"
or die "Couldn't open lib/src/$file.js for reading: $!";
while (<$IN>) {
next if /^import /;
if ($file eq "std-env") {
next if /^export \{/;
}
else {
s/^export \{/const $file = {/;
}
s/^export //;
print {$OUT} $_;
}
close $IN;
}
close $OUT;