goscript 0.0.24 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cmd/goscript/cmd_compile.go +17 -1
- package/compiler/analysis.go +1 -1
- package/compiler/builtin_test.go +2 -14
- package/compiler/compiler.go +251 -11
- package/compiler/compiler_test.go +60 -0
- package/compiler/decl.go +7 -1
- package/compiler/expr-call.go +212 -2
- package/compiler/expr.go +46 -2
- package/compiler/field.go +4 -4
- package/compiler/spec-value.go +1 -1
- package/compiler/stmt-range.go +204 -1
- package/compiler/type.go +47 -4
- package/dist/gs/builtin/builtin.d.ts +9 -0
- package/dist/gs/builtin/builtin.js +10 -1
- package/dist/gs/builtin/builtin.js.map +1 -1
- package/dist/gs/builtin/channel.d.ts +193 -0
- package/dist/gs/builtin/channel.js.map +1 -1
- package/dist/gs/builtin/defer.d.ts +38 -0
- package/dist/gs/builtin/defer.js.map +1 -1
- package/dist/gs/builtin/index.d.ts +1 -0
- package/dist/gs/builtin/index.js +2 -0
- package/dist/gs/builtin/index.js.map +1 -0
- package/dist/gs/builtin/io.d.ts +16 -0
- package/dist/gs/builtin/io.js.map +1 -1
- package/dist/gs/builtin/map.d.ts +33 -0
- package/dist/gs/builtin/map.js.map +1 -1
- package/dist/gs/builtin/slice.d.ts +173 -0
- package/dist/gs/builtin/slice.js +38 -24
- package/dist/gs/builtin/slice.js.map +1 -1
- package/dist/gs/builtin/type.d.ts +203 -0
- package/dist/gs/builtin/type.js +1 -2
- package/dist/gs/builtin/type.js.map +1 -1
- package/dist/gs/builtin/varRef.d.ts +14 -0
- package/dist/gs/builtin/varRef.js.map +1 -1
- package/dist/gs/cmp/index.d.ts +4 -0
- package/dist/gs/cmp/index.js +27 -0
- package/dist/gs/cmp/index.js.map +1 -0
- package/dist/gs/context/context.d.ts +26 -0
- package/dist/gs/context/context.js +297 -38
- package/dist/gs/context/context.js.map +1 -1
- package/dist/gs/context/index.d.ts +1 -0
- package/dist/gs/errors/errors.d.ts +8 -0
- package/dist/gs/errors/errors.js +190 -0
- package/dist/gs/errors/errors.js.map +1 -0
- package/dist/gs/errors/index.d.ts +1 -0
- package/dist/gs/errors/index.js +2 -0
- package/dist/gs/errors/index.js.map +1 -0
- package/dist/gs/internal/goarch/index.d.ts +6 -0
- package/dist/gs/internal/goarch/index.js +14 -0
- package/dist/gs/internal/goarch/index.js.map +1 -0
- package/dist/gs/iter/index.d.ts +1 -0
- package/dist/gs/iter/index.js +2 -0
- package/dist/gs/iter/index.js.map +1 -0
- package/dist/gs/iter/iter.d.ts +4 -0
- package/dist/gs/iter/iter.js +91 -0
- package/dist/gs/iter/iter.js.map +1 -0
- package/dist/gs/math/bits/index.d.ts +47 -0
- package/dist/gs/math/bits/index.js +300 -0
- package/dist/gs/math/bits/index.js.map +1 -0
- package/dist/gs/runtime/index.d.ts +1 -0
- package/dist/gs/runtime/runtime.d.ts +42 -0
- package/dist/gs/runtime/runtime.js +15 -18
- package/dist/gs/runtime/runtime.js.map +1 -1
- package/dist/gs/slices/index.d.ts +1 -0
- package/dist/gs/slices/index.js +2 -0
- package/dist/gs/slices/index.js.map +1 -0
- package/dist/gs/slices/slices.d.ts +8 -0
- package/dist/gs/slices/slices.js +20 -0
- package/dist/gs/slices/slices.js.map +1 -0
- package/dist/gs/time/index.d.ts +1 -0
- package/dist/gs/time/time.d.ts +57 -0
- package/dist/gs/time/time.js +108 -15
- package/dist/gs/time/time.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../gs/slices/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as $ from '@goscript/builtin/builtin.js';
|
|
2
|
+
/**
|
|
3
|
+
* All returns an iterator over index-value pairs in the slice.
|
|
4
|
+
* This is equivalent to Go's slices.All function.
|
|
5
|
+
* @param s The slice to iterate over
|
|
6
|
+
* @returns An iterator function that yields index-value pairs
|
|
7
|
+
*/
|
|
8
|
+
export declare function All<T>(s: $.Slice<T>): (yieldFunc: (index: number, value: T) => boolean) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// TypeScript implementation of Go's slices package
|
|
2
|
+
import * as $ from '@goscript/builtin/builtin.js';
|
|
3
|
+
/**
|
|
4
|
+
* All returns an iterator over index-value pairs in the slice.
|
|
5
|
+
* This is equivalent to Go's slices.All function.
|
|
6
|
+
* @param s The slice to iterate over
|
|
7
|
+
* @returns An iterator function that yields index-value pairs
|
|
8
|
+
*/
|
|
9
|
+
export function All(s) {
|
|
10
|
+
return function (_yield) {
|
|
11
|
+
const length = $.len(s);
|
|
12
|
+
for (let i = 0; i < length; i++) {
|
|
13
|
+
const value = s[i]; // Use proper indexing to avoid type issues
|
|
14
|
+
if (!_yield(i, value)) {
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=slices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slices.js","sourceRoot":"","sources":["../../../gs/slices/slices.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,KAAK,CAAC,MAAM,8BAA8B,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,UAAU,GAAG,CACjB,CAAa;IAEb,OAAO,UAAU,MAA4C;QAC3D,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,MAAM,KAAK,GAAI,CAAS,CAAC,CAAC,CAAM,CAAA,CAAC,2CAA2C;YAC5E,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;gBACtB,MAAK;YACP,CAAC;QACH,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './time.js';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare class Time {
|
|
2
|
+
private _date;
|
|
3
|
+
private _nsec;
|
|
4
|
+
private _monotonic?;
|
|
5
|
+
constructor(date: globalThis.Date, nsec?: number, monotonic?: number);
|
|
6
|
+
clone(): Time;
|
|
7
|
+
Sub(u: Time): Duration;
|
|
8
|
+
Add(d: Duration): Time;
|
|
9
|
+
Equal(u: Time): boolean;
|
|
10
|
+
Before(u: Time): boolean;
|
|
11
|
+
After(u: Time): boolean;
|
|
12
|
+
Round(d: Duration): Time;
|
|
13
|
+
Truncate(d: Duration): Time;
|
|
14
|
+
String(): string;
|
|
15
|
+
}
|
|
16
|
+
export declare class Duration {
|
|
17
|
+
private _nanoseconds;
|
|
18
|
+
constructor(nanoseconds: number);
|
|
19
|
+
lt(other: Duration): boolean;
|
|
20
|
+
static multiply(duration: Duration, multiplier: number): Duration;
|
|
21
|
+
multiply(multiplier: number): Duration;
|
|
22
|
+
valueOf(): number;
|
|
23
|
+
toString(): string;
|
|
24
|
+
}
|
|
25
|
+
export declare function multiplyDuration(duration: Duration, multiplier: number): Duration;
|
|
26
|
+
export declare class Location {
|
|
27
|
+
private _name;
|
|
28
|
+
constructor(name: string);
|
|
29
|
+
get name(): string;
|
|
30
|
+
}
|
|
31
|
+
export declare enum Month {
|
|
32
|
+
January = 1,
|
|
33
|
+
February = 2,
|
|
34
|
+
March = 3,
|
|
35
|
+
April = 4,
|
|
36
|
+
May = 5,
|
|
37
|
+
June = 6,
|
|
38
|
+
July = 7,
|
|
39
|
+
August = 8,
|
|
40
|
+
September = 9,
|
|
41
|
+
October = 10,
|
|
42
|
+
November = 11,
|
|
43
|
+
December = 12
|
|
44
|
+
}
|
|
45
|
+
export declare function Now(): Time;
|
|
46
|
+
export declare function Date(year: number, month: Month, day: number, hour: number, min: number, sec: number, nsec: number, loc: Location): Time;
|
|
47
|
+
export declare const UTC: Location;
|
|
48
|
+
export declare const Nanosecond: Duration;
|
|
49
|
+
export declare const Microsecond: Duration;
|
|
50
|
+
export declare const Millisecond: Duration;
|
|
51
|
+
export declare const Second: Duration;
|
|
52
|
+
export declare const Minute: Duration;
|
|
53
|
+
export declare const Hour: Duration;
|
|
54
|
+
export declare function Since(t: Time): Duration;
|
|
55
|
+
export declare function Until(t: Time): Duration;
|
|
56
|
+
export declare function Sleep(d: Duration): Promise<void>;
|
|
57
|
+
export declare const May = Month.May;
|
package/dist/gs/time/time.js
CHANGED
|
@@ -2,20 +2,80 @@
|
|
|
2
2
|
export class Time {
|
|
3
3
|
_date;
|
|
4
4
|
_nsec; // nanoseconds within the second
|
|
5
|
-
|
|
5
|
+
_monotonic; // high-resolution monotonic timestamp in nanoseconds
|
|
6
|
+
constructor(date, nsec = 0, monotonic) {
|
|
6
7
|
this._date = new globalThis.Date(date.getTime());
|
|
7
8
|
this._nsec = nsec;
|
|
9
|
+
this._monotonic = monotonic;
|
|
8
10
|
}
|
|
9
11
|
// clone returns a copy of this Time instance
|
|
10
12
|
clone() {
|
|
11
|
-
return new Time(this._date, this._nsec);
|
|
13
|
+
return new Time(this._date, this._nsec, this._monotonic);
|
|
12
14
|
}
|
|
13
15
|
// Sub returns the duration t-u
|
|
16
|
+
// If both times have monotonic readings, use them for accurate duration calculation
|
|
14
17
|
Sub(u) {
|
|
18
|
+
// If both times have monotonic readings, use them for more accurate duration calculation
|
|
19
|
+
if (this._monotonic !== undefined && u._monotonic !== undefined) {
|
|
20
|
+
const diffNs = this._monotonic - u._monotonic;
|
|
21
|
+
return new Duration(diffNs);
|
|
22
|
+
}
|
|
23
|
+
// Fallback to Date-based calculation
|
|
15
24
|
const diffMs = this._date.getTime() - u._date.getTime();
|
|
16
|
-
const diffNs =
|
|
25
|
+
const diffNs = this._nsec - u._nsec;
|
|
17
26
|
return new Duration(diffMs * 1000000 + diffNs); // Convert ms to ns and add ns difference
|
|
18
27
|
}
|
|
28
|
+
// Add adds the duration d to t, returning the sum
|
|
29
|
+
// Preserves monotonic reading if present
|
|
30
|
+
Add(d) {
|
|
31
|
+
const durationNs = d.valueOf();
|
|
32
|
+
const newDate = new globalThis.Date(this._date.getTime() + Math.floor(durationNs / 1000000));
|
|
33
|
+
const newNsec = this._nsec + (durationNs % 1000000);
|
|
34
|
+
const newMonotonic = this._monotonic !== undefined ? this._monotonic + durationNs : undefined;
|
|
35
|
+
return new Time(newDate, newNsec, newMonotonic);
|
|
36
|
+
}
|
|
37
|
+
// Equal reports whether t and u represent the same time instant
|
|
38
|
+
// Uses monotonic clock if both times have it
|
|
39
|
+
Equal(u) {
|
|
40
|
+
if (this._monotonic !== undefined && u._monotonic !== undefined) {
|
|
41
|
+
return this._monotonic === u._monotonic;
|
|
42
|
+
}
|
|
43
|
+
return this._date.getTime() === u._date.getTime() && this._nsec === u._nsec;
|
|
44
|
+
}
|
|
45
|
+
// Before reports whether the time instant t is before u
|
|
46
|
+
// Uses monotonic clock if both times have it
|
|
47
|
+
Before(u) {
|
|
48
|
+
if (this._monotonic !== undefined && u._monotonic !== undefined) {
|
|
49
|
+
return this._monotonic < u._monotonic;
|
|
50
|
+
}
|
|
51
|
+
const thisMs = this._date.getTime();
|
|
52
|
+
const uMs = u._date.getTime();
|
|
53
|
+
return thisMs < uMs || (thisMs === uMs && this._nsec < u._nsec);
|
|
54
|
+
}
|
|
55
|
+
// After reports whether the time instant t is after u
|
|
56
|
+
// Uses monotonic clock if both times have it
|
|
57
|
+
After(u) {
|
|
58
|
+
if (this._monotonic !== undefined && u._monotonic !== undefined) {
|
|
59
|
+
return this._monotonic > u._monotonic;
|
|
60
|
+
}
|
|
61
|
+
const thisMs = this._date.getTime();
|
|
62
|
+
const uMs = u._date.getTime();
|
|
63
|
+
return thisMs > uMs || (thisMs === uMs && this._nsec > u._nsec);
|
|
64
|
+
}
|
|
65
|
+
// Round returns the result of rounding t to the nearest multiple of d
|
|
66
|
+
// Strips monotonic reading as per Go specification
|
|
67
|
+
Round(d) {
|
|
68
|
+
// Implementation would round to nearest duration
|
|
69
|
+
// For now, simplified version that strips monotonic reading
|
|
70
|
+
return new Time(this._date, this._nsec);
|
|
71
|
+
}
|
|
72
|
+
// Truncate returns the result of rounding t down to a multiple of d
|
|
73
|
+
// Strips monotonic reading as per Go specification
|
|
74
|
+
Truncate(d) {
|
|
75
|
+
// Implementation would truncate to duration
|
|
76
|
+
// For now, simplified version that strips monotonic reading
|
|
77
|
+
return new Time(this._date, this._nsec);
|
|
78
|
+
}
|
|
19
79
|
// String returns the time formatted as a string
|
|
20
80
|
String() {
|
|
21
81
|
// Format as "YYYY-MM-DD HH:MM:SS +0000 UTC" to match Go's format
|
|
@@ -25,7 +85,12 @@ export class Time {
|
|
|
25
85
|
const hour = String(this._date.getUTCHours()).padStart(2, '0');
|
|
26
86
|
const minute = String(this._date.getUTCMinutes()).padStart(2, '0');
|
|
27
87
|
const second = String(this._date.getUTCSeconds()).padStart(2, '0');
|
|
28
|
-
|
|
88
|
+
let result = `${year}-${month}-${day} ${hour}:${minute}:${second} +0000 UTC`;
|
|
89
|
+
// Include monotonic reading in debug output as per Go specification
|
|
90
|
+
if (this._monotonic !== undefined) {
|
|
91
|
+
result += ` m=${this._monotonic}`;
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
29
94
|
}
|
|
30
95
|
}
|
|
31
96
|
// Duration represents a span of time
|
|
@@ -52,7 +117,7 @@ export class Duration {
|
|
|
52
117
|
}
|
|
53
118
|
// toString for string representation
|
|
54
119
|
toString() {
|
|
55
|
-
return this._nanoseconds.toString() +
|
|
120
|
+
return this._nanoseconds.toString() + 'ns';
|
|
56
121
|
}
|
|
57
122
|
}
|
|
58
123
|
// Override multiplication operator for Duration * number
|
|
@@ -69,9 +134,8 @@ export class Location {
|
|
|
69
134
|
return this._name;
|
|
70
135
|
}
|
|
71
136
|
}
|
|
72
|
-
export { Month };
|
|
73
137
|
// Month represents a month of the year
|
|
74
|
-
var Month;
|
|
138
|
+
export var Month;
|
|
75
139
|
(function (Month) {
|
|
76
140
|
Month[Month["January"] = 1] = "January";
|
|
77
141
|
Month[Month["February"] = 2] = "February";
|
|
@@ -86,16 +150,25 @@ var Month;
|
|
|
86
150
|
Month[Month["November"] = 11] = "November";
|
|
87
151
|
Month[Month["December"] = 12] = "December";
|
|
88
152
|
})(Month || (Month = {}));
|
|
89
|
-
// Now returns the current local time
|
|
153
|
+
// Now returns the current local time with monotonic clock reading
|
|
90
154
|
export function Now() {
|
|
91
|
-
|
|
155
|
+
const date = new globalThis.Date();
|
|
156
|
+
let monotonic;
|
|
157
|
+
// Use performance.now() for high-resolution monotonic timing if available
|
|
158
|
+
if (typeof performance !== 'undefined' && performance.now) {
|
|
159
|
+
// performance.now() returns milliseconds with sub-millisecond precision
|
|
160
|
+
// Convert to nanoseconds for consistency with Go's time package
|
|
161
|
+
monotonic = performance.now() * 1000000;
|
|
162
|
+
}
|
|
163
|
+
return new Time(date, 0, monotonic);
|
|
92
164
|
}
|
|
93
165
|
// Date returns the Time corresponding to
|
|
94
166
|
// yyyy-mm-dd hh:mm:ss + nsec nanoseconds
|
|
95
167
|
// in the appropriate zone for that time in the given location
|
|
168
|
+
// Does not include monotonic reading as per Go specification
|
|
96
169
|
export function Date(year, month, day, hour, min, sec, nsec, loc) {
|
|
97
170
|
let date;
|
|
98
|
-
if (loc.name ===
|
|
171
|
+
if (loc.name === 'UTC') {
|
|
99
172
|
// Use Date.UTC for proper UTC handling
|
|
100
173
|
const utcTime = globalThis.Date.UTC(year, month - 1, day, hour, min, sec, Math.floor(nsec / 1000000));
|
|
101
174
|
date = new globalThis.Date(utcTime);
|
|
@@ -104,12 +177,32 @@ export function Date(year, month, day, hour, min, sec, nsec, loc) {
|
|
|
104
177
|
// For local time or other timezones, use regular Date constructor
|
|
105
178
|
date = new globalThis.Date(year, month - 1, day, hour, min, sec, Math.floor(nsec / 1000000));
|
|
106
179
|
}
|
|
107
|
-
return new Time(date, nsec % 1000000);
|
|
180
|
+
return new Time(date, nsec % 1000000); // No monotonic reading
|
|
108
181
|
}
|
|
109
182
|
// Common locations
|
|
110
|
-
export const UTC = new Location(
|
|
111
|
-
// Common durations
|
|
112
|
-
export const
|
|
113
|
-
|
|
183
|
+
export const UTC = new Location('UTC');
|
|
184
|
+
// Common durations (matching Go's time package constants)
|
|
185
|
+
export const Nanosecond = new Duration(1);
|
|
186
|
+
export const Microsecond = new Duration(1000);
|
|
187
|
+
export const Millisecond = new Duration(1000000);
|
|
188
|
+
export const Second = new Duration(1000000000);
|
|
189
|
+
export const Minute = new Duration(60000000000);
|
|
190
|
+
export const Hour = new Duration(3600000000000);
|
|
191
|
+
// Since returns the time elapsed since t
|
|
192
|
+
// Uses monotonic clock if available for accurate measurement
|
|
193
|
+
export function Since(t) {
|
|
194
|
+
return Now().Sub(t);
|
|
195
|
+
}
|
|
196
|
+
// Until returns the duration until t
|
|
197
|
+
// Uses monotonic clock if available for accurate measurement
|
|
198
|
+
export function Until(t) {
|
|
199
|
+
return t.Sub(Now());
|
|
200
|
+
}
|
|
201
|
+
// Sleep pauses the current execution for at least the duration d
|
|
202
|
+
export async function Sleep(d) {
|
|
203
|
+
const ms = d.valueOf() / 1000000; // Convert nanoseconds to milliseconds
|
|
204
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
205
|
+
}
|
|
206
|
+
// Export month constants
|
|
114
207
|
export const May = Month.May;
|
|
115
208
|
//# sourceMappingURL=time.js.map
|
package/dist/gs/time/time.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../../gs/time/time.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,OAAO,IAAI;IACP,KAAK,
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../../gs/time/time.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,OAAO,IAAI;IACP,KAAK,CAAiB;IACtB,KAAK,CA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AM,MAAM,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAA;AAC/C,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,aAAa,CAAC,CAAA;AAE/C,yCAAyC;AACzC,6DAA6D;AAC7D,MAAM,UAAU,KAAK,CAAC,CAAO;IAC3B,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AACrB,CAAC;AAED,qCAAqC;AACrC,6DAA6D;AAC7D,MAAM,UAAU,KAAK,CAAC,CAAO;IAC3B,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAA;AACrB,CAAC;AAED,iEAAiE;AACjE,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,CAAW;IACrC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,GAAG,OAAO,CAAA,CAAC,sCAAsC;IACvE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAC1D,CAAC;AAED,yBAAyB;AACzB,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goscript",
|
|
3
3
|
"description": "Go to TypeScript transpiler",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.26",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Aperture Robotics LLC.",
|
|
7
7
|
"email": "support@aperture.us",
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
|
-
"build": "tsc -p tsconfig.build.json",
|
|
45
|
+
"build": "npm run build:updategover && tsc -p tsconfig.build.json",
|
|
46
|
+
"build:updategover": "node -e \"const fs = require('fs'); const { execSync } = require('child_process'); const goVersion = execSync('go mod edit -json', { encoding: 'utf8' }); const goData = JSON.parse(goVersion); const version = goData.Go; const runtimePath = 'gs/runtime/runtime.ts'; const content = fs.readFileSync(runtimePath, 'utf8'); const updatedContent = content.replace(/export const GOVERSION = 'go[^']*'/, \\`export const GOVERSION = 'go\\${version}'\\`); fs.writeFileSync(runtimePath, updatedContent);\"",
|
|
46
47
|
"prepublishOnly": "npm run build",
|
|
47
48
|
"example": "cd ./example/simple && bash run.bash",
|
|
48
49
|
"test": "npm run test:go && npm run test:js",
|