goscript 0.0.76 → 0.0.77
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/compiler/analysis.go +100 -33
- package/compiler/analysis_test.go +2 -7
- package/compiler/code-writer.go +2 -2
- package/compiler/compiler.go +4 -4
- package/compiler/composite-lit.go +4 -6
- package/compiler/constraint.go +2 -4
- package/compiler/expr-call-async.go +4 -0
- package/compiler/expr-call-helpers.go +98 -8
- package/compiler/expr-call-make.go +4 -4
- package/compiler/expr-call.go +3 -0
- package/compiler/expr-type.go +42 -0
- package/compiler/gs_dependencies_test.go +3 -14
- package/compiler/index.ts +20 -5
- package/compiler/protobuf.go +21 -21
- package/compiler/spec-struct.go +22 -30
- package/compiler/spec.go +2 -2
- package/compiler/stmt-assign.go +2 -2
- package/compiler/type-info.go +20 -3
- package/compiler/type-utils.go +2 -4
- package/compiler/type.go +3 -4
- package/dist/compiler/index.js +13 -4
- package/dist/compiler/index.js.map +1 -1
- package/dist/gs/builtin/slice.js +2 -3
- package/dist/gs/builtin/slice.js.map +1 -1
- package/dist/gs/builtin/type.d.ts +1 -0
- package/dist/gs/builtin/type.js +8 -14
- package/dist/gs/builtin/type.js.map +1 -1
- package/dist/gs/bytes/buffer.gs.d.ts +1 -0
- package/dist/gs/bytes/buffer.gs.js +20 -0
- package/dist/gs/bytes/buffer.gs.js.map +1 -1
- package/dist/gs/github.com/aperturerobotics/protobuf-go-lite/index.d.ts +5 -0
- package/dist/gs/github.com/aperturerobotics/protobuf-go-lite/index.js +10 -0
- package/dist/gs/github.com/aperturerobotics/protobuf-go-lite/index.js.map +1 -0
- package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/browser/browser.d.ts +50 -0
- package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/browser/browser.js +221 -0
- package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/browser/browser.js.map +1 -0
- package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/browser/index.d.ts +1 -0
- package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/browser/index.js +2 -0
- package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/browser/index.js.map +1 -0
- package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/index.d.ts +1 -0
- package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/index.js +2 -0
- package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/index.js.map +1 -0
- package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/runtime.d.ts +56 -0
- package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/runtime.js +17 -0
- package/dist/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/runtime.js.map +1 -0
- package/dist/gs/io/fs/format.js +2 -6
- package/dist/gs/io/fs/format.js.map +1 -1
- package/dist/gs/io/fs/glob.js +18 -23
- package/dist/gs/io/fs/glob.js.map +1 -1
- package/dist/gs/path/match.js +9 -22
- package/dist/gs/path/match.js.map +1 -1
- package/dist/gs/reflect/index.d.ts +1 -1
- package/dist/gs/reflect/index.js +1 -1
- package/dist/gs/reflect/index.js.map +1 -1
- package/dist/gs/reflect/type.d.ts +1 -0
- package/dist/gs/reflect/type.js +52 -23
- package/dist/gs/reflect/type.js.map +1 -1
- package/dist/gs/strings/iter.js +1 -1
- package/dist/gs/strings/iter.js.map +1 -1
- package/dist/gs/strings/reader.js +1 -1
- package/dist/gs/strings/reader.js.map +1 -1
- package/dist/gs/strings/replace.js +9 -20
- package/dist/gs/strings/replace.js.map +1 -1
- package/dist/gs/time/time.js +2 -2
- package/dist/gs/time/time.js.map +1 -1
- package/go.mod +1 -1
- package/go.sum +2 -2
- package/gs/builtin/slice.ts +2 -2
- package/gs/builtin/type.ts +14 -14
- package/gs/bytes/buffer.gs.ts +21 -1
- package/gs/fmt/fmt.test.ts +1 -1
- package/gs/github.com/aperturerobotics/protobuf-go-lite/index.ts +14 -0
- package/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/browser/browser.ts +238 -0
- package/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/browser/index.ts +1 -0
- package/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/browser/meta.json +12 -0
- package/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/index.ts +1 -0
- package/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/meta.json +8 -0
- package/gs/github.com/aperturerobotics/wasivm/wazero/kernel/runtime/runtime.ts +94 -0
- package/gs/io/fs/format.ts +2 -5
- package/gs/io/fs/glob.ts +18 -21
- package/gs/path/match.ts +9 -22
- package/gs/reflect/index.ts +1 -0
- package/gs/reflect/type.ts +62 -25
- package/gs/strings/iter.ts +1 -1
- package/gs/strings/reader.ts +1 -1
- package/gs/strings/replace.ts +13 -18
- package/gs/time/time.ts +2 -2
- package/package.json +18 -15
package/gs/io/fs/format.ts
CHANGED
|
@@ -16,12 +16,9 @@ export function FormatFileInfo(info: FileInfo): string {
|
|
|
16
16
|
b.push(' ')
|
|
17
17
|
|
|
18
18
|
let size = info!.Size()
|
|
19
|
-
|
|
20
|
-
if (size
|
|
21
|
-
usize = size as number
|
|
22
|
-
} else {
|
|
19
|
+
const usize = size >= 0 ? size : -size
|
|
20
|
+
if (size < 0) {
|
|
23
21
|
b.push('-')
|
|
24
|
-
usize = -size as number
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
b.push(usize.toString())
|
package/gs/io/fs/glob.ts
CHANGED
|
@@ -70,7 +70,6 @@ export function globWithLimit(
|
|
|
70
70
|
depth: number,
|
|
71
71
|
): [$.Slice<string>, $.GoError] {
|
|
72
72
|
let matches: $.Slice<string> = null
|
|
73
|
-
let err: $.GoError = null
|
|
74
73
|
{
|
|
75
74
|
// This limit is added to prevent stack exhaustion issues. See
|
|
76
75
|
// CVE-2022-30630.
|
|
@@ -87,15 +86,15 @@ export function globWithLimit(
|
|
|
87
86
|
|
|
88
87
|
// Check pattern is well-formed.
|
|
89
88
|
{
|
|
90
|
-
|
|
91
|
-
if (
|
|
92
|
-
return [null,
|
|
89
|
+
const [, matchErr] = path.Match(pattern, '')
|
|
90
|
+
if (matchErr != null) {
|
|
91
|
+
return [null, matchErr]
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
94
|
if (!hasMeta(pattern)) {
|
|
96
95
|
{
|
|
97
|
-
|
|
98
|
-
if (
|
|
96
|
+
const [, statErr] = Stat(fsys, pattern)
|
|
97
|
+
if (statErr != null) {
|
|
99
98
|
return [null, null]
|
|
100
99
|
}
|
|
101
100
|
}
|
|
@@ -114,21 +113,21 @@ export function globWithLimit(
|
|
|
114
113
|
return [null, path.ErrBadPattern]
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return [null, err]
|
|
116
|
+
const [dirs, dirErr] = globWithLimit(fsys, dir, depth + 1)
|
|
117
|
+
if (dirErr != null) {
|
|
118
|
+
return [null, dirErr]
|
|
121
119
|
}
|
|
122
|
-
for (let _i = 0; _i < $.len(
|
|
123
|
-
const d =
|
|
120
|
+
for (let _i = 0; _i < $.len(dirs); _i++) {
|
|
121
|
+
const d = dirs![_i]
|
|
124
122
|
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
const [nextMatches, globErr] = glob(fsys, d, file, matches)
|
|
124
|
+
matches = nextMatches
|
|
125
|
+
if (globErr != null) {
|
|
126
|
+
return [matches, globErr]
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
|
-
return [matches,
|
|
130
|
+
return [matches, null]
|
|
132
131
|
}
|
|
133
132
|
}
|
|
134
133
|
|
|
@@ -155,15 +154,13 @@ export function glob(
|
|
|
155
154
|
pattern: string,
|
|
156
155
|
matches: $.Slice<string>,
|
|
157
156
|
): [$.Slice<string>, $.GoError] {
|
|
158
|
-
let m
|
|
159
|
-
let e: $.GoError = null
|
|
157
|
+
let m = matches
|
|
160
158
|
{
|
|
161
|
-
m = matches
|
|
162
159
|
let [infos, err] = ReadDir(fs, dir)
|
|
163
160
|
|
|
164
161
|
// ignore I/O error
|
|
165
162
|
if (err != null) {
|
|
166
|
-
return [m,
|
|
163
|
+
return [m, null]
|
|
167
164
|
}
|
|
168
165
|
|
|
169
166
|
for (let _i = 0; _i < $.len(infos); _i++) {
|
|
@@ -179,7 +176,7 @@ export function glob(
|
|
|
179
176
|
}
|
|
180
177
|
}
|
|
181
178
|
}
|
|
182
|
-
return [m,
|
|
179
|
+
return [m, null]
|
|
183
180
|
}
|
|
184
181
|
}
|
|
185
182
|
|
package/gs/path/match.ts
CHANGED
|
@@ -45,13 +45,7 @@ export function Match(pattern: string, name: string): [boolean, $.GoError] {
|
|
|
45
45
|
// Before returning false with no error,
|
|
46
46
|
// check that the remainder of the pattern is syntactically valid.
|
|
47
47
|
Pattern: for (; $.len(pattern) > 0; ) {
|
|
48
|
-
|
|
49
|
-
let chunk: string = ''
|
|
50
|
-
let rest: string = ''
|
|
51
|
-
let scanResult = scanChunk(pattern)
|
|
52
|
-
star = scanResult[0]
|
|
53
|
-
chunk = scanResult[1]
|
|
54
|
-
rest = scanResult[2]
|
|
48
|
+
const [star, chunk, rest] = scanChunk(pattern)
|
|
55
49
|
pattern = rest
|
|
56
50
|
|
|
57
51
|
// Trailing * matches rest of string unless it has a /.
|
|
@@ -104,13 +98,7 @@ export function Match(pattern: string, name: string): [boolean, $.GoError] {
|
|
|
104
98
|
// Before returning false with no error,
|
|
105
99
|
// check that the remainder of the pattern is syntactically valid.
|
|
106
100
|
for (; $.len(pattern) > 0; ) {
|
|
107
|
-
|
|
108
|
-
let chunk2: string = ''
|
|
109
|
-
let rest2: string = ''
|
|
110
|
-
let scanResult2 = scanChunk(pattern)
|
|
111
|
-
// star2 = scanResult2[0]
|
|
112
|
-
chunk2 = scanResult2[1]
|
|
113
|
-
rest2 = scanResult2[2]
|
|
101
|
+
const [, chunk2, rest2] = scanChunk(pattern)
|
|
114
102
|
pattern = rest2
|
|
115
103
|
{
|
|
116
104
|
let [, , err] = matchChunk(chunk2, '')
|
|
@@ -135,7 +123,7 @@ export function scanChunk(pattern: string): [boolean, string, string] {
|
|
|
135
123
|
star = true
|
|
136
124
|
}
|
|
137
125
|
let inrange = false
|
|
138
|
-
let i: number
|
|
126
|
+
let i: number
|
|
139
127
|
|
|
140
128
|
// error check handled in matchChunk: bad pattern.
|
|
141
129
|
Scan: for (i = 0; i < $.len(pattern); i++) {
|
|
@@ -174,7 +162,7 @@ export function matchChunk(
|
|
|
174
162
|
chunk: string,
|
|
175
163
|
s: string,
|
|
176
164
|
): [string, boolean, $.GoError] {
|
|
177
|
-
let err: $.GoError
|
|
165
|
+
let err: $.GoError
|
|
178
166
|
{
|
|
179
167
|
// failed records whether the match has failed.
|
|
180
168
|
// After the match fails, the loop continues on processing chunk,
|
|
@@ -200,10 +188,9 @@ export function matchChunk(
|
|
|
200
188
|
case 91: {
|
|
201
189
|
let r: number = 0
|
|
202
190
|
if (!failed) {
|
|
203
|
-
|
|
204
|
-
let decoded = utf8.DecodeRuneInString(s)
|
|
191
|
+
const decoded = utf8.DecodeRuneInString(s)
|
|
205
192
|
r = decoded[0]
|
|
206
|
-
n = decoded[1]
|
|
193
|
+
const n = decoded[1]
|
|
207
194
|
s = $.sliceString(s, n, undefined)
|
|
208
195
|
}
|
|
209
196
|
chunk = $.sliceString(chunk, 1, undefined)
|
|
@@ -223,10 +210,10 @@ export function matchChunk(
|
|
|
223
210
|
chunk = $.sliceString(chunk, 1, undefined)
|
|
224
211
|
break
|
|
225
212
|
}
|
|
226
|
-
let lo: number
|
|
227
|
-
let hi: number
|
|
213
|
+
let lo: number
|
|
214
|
+
let hi: number
|
|
228
215
|
{
|
|
229
|
-
|
|
216
|
+
const escResult = getEsc(chunk)
|
|
230
217
|
lo = escResult[0]
|
|
231
218
|
chunk = escResult[1]
|
|
232
219
|
err = escResult[2]
|
package/gs/reflect/index.ts
CHANGED
package/gs/reflect/type.ts
CHANGED
|
@@ -1492,7 +1492,10 @@ function typeImplementsInterface(
|
|
|
1492
1492
|
interfaceType: Type,
|
|
1493
1493
|
): boolean {
|
|
1494
1494
|
// Get the interface name and look it up in the type registry
|
|
1495
|
-
const interfaceName =
|
|
1495
|
+
const interfaceName =
|
|
1496
|
+
interfaceType instanceof InterfaceType ?
|
|
1497
|
+
interfaceType.registeredName() || interfaceType.String()
|
|
1498
|
+
: interfaceType.String()
|
|
1496
1499
|
const interfaceTypeInfo = builtinGetTypeByName(interfaceName)
|
|
1497
1500
|
|
|
1498
1501
|
if (!interfaceTypeInfo || !isInterfaceTypeInfo(interfaceTypeInfo)) {
|
|
@@ -1797,7 +1800,10 @@ class ChannelType implements Type {
|
|
|
1797
1800
|
|
|
1798
1801
|
// Interface type implementation
|
|
1799
1802
|
class InterfaceType implements Type {
|
|
1800
|
-
constructor(
|
|
1803
|
+
constructor(
|
|
1804
|
+
private _name: string = 'interface{}',
|
|
1805
|
+
private _registeredName?: string,
|
|
1806
|
+
) {}
|
|
1801
1807
|
|
|
1802
1808
|
public String(): string {
|
|
1803
1809
|
return this._name
|
|
@@ -1820,10 +1826,30 @@ class InterfaceType implements Type {
|
|
|
1820
1826
|
}
|
|
1821
1827
|
|
|
1822
1828
|
public PkgPath?(): string {
|
|
1829
|
+
if (
|
|
1830
|
+
this._name === 'interface{}' ||
|
|
1831
|
+
this._name.startsWith('interface {')
|
|
1832
|
+
) {
|
|
1833
|
+
return ''
|
|
1834
|
+
}
|
|
1835
|
+
const dotIndex = this._name.lastIndexOf('.')
|
|
1836
|
+
if (dotIndex > 0) {
|
|
1837
|
+
return this._name.substring(0, dotIndex)
|
|
1838
|
+
}
|
|
1823
1839
|
return ''
|
|
1824
1840
|
}
|
|
1825
1841
|
|
|
1826
1842
|
public Name(): string {
|
|
1843
|
+
if (
|
|
1844
|
+
this._name === 'interface{}' ||
|
|
1845
|
+
this._name.startsWith('interface {')
|
|
1846
|
+
) {
|
|
1847
|
+
return this._name
|
|
1848
|
+
}
|
|
1849
|
+
const dotIndex = this._name.lastIndexOf('.')
|
|
1850
|
+
if (dotIndex >= 0) {
|
|
1851
|
+
return this._name.substring(dotIndex + 1)
|
|
1852
|
+
}
|
|
1827
1853
|
return this._name
|
|
1828
1854
|
}
|
|
1829
1855
|
|
|
@@ -1868,6 +1894,10 @@ class InterfaceType implements Type {
|
|
|
1868
1894
|
public Bits(): number {
|
|
1869
1895
|
throw new Error('reflect: call of reflect.Type.Bits on interface Type')
|
|
1870
1896
|
}
|
|
1897
|
+
|
|
1898
|
+
public registeredName(): string | undefined {
|
|
1899
|
+
return this._registeredName
|
|
1900
|
+
}
|
|
1871
1901
|
}
|
|
1872
1902
|
|
|
1873
1903
|
function getTypeOf(value: ReflectValue): Type {
|
|
@@ -2161,30 +2191,37 @@ export function TypeFor(): Type {
|
|
|
2161
2191
|
export function getInterfaceTypeByName(name: string): Type {
|
|
2162
2192
|
const typeInfo = builtinGetTypeByName(name)
|
|
2163
2193
|
if (typeInfo && typeInfo.kind === TypeKind.Interface) {
|
|
2164
|
-
|
|
2194
|
+
return new InterfaceType(name, name)
|
|
2195
|
+
}
|
|
2196
|
+
return new InterfaceType('interface{}')
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
export function getInterfaceLiteralTypeByName(name: string): Type {
|
|
2200
|
+
const typeInfo = builtinGetTypeByName(name)
|
|
2201
|
+
if (typeInfo && typeInfo.kind === TypeKind.Interface) {
|
|
2165
2202
|
const methods = (typeInfo as any).methods || []
|
|
2166
|
-
if (methods.length
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
}
|
|
2183
|
-
|
|
2184
|
-
})
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
}
|
|
2203
|
+
if (methods.length === 0) {
|
|
2204
|
+
return new InterfaceType('interface{}', name)
|
|
2205
|
+
}
|
|
2206
|
+
const methodSigs = methods
|
|
2207
|
+
.map((m: any) => {
|
|
2208
|
+
const args =
|
|
2209
|
+
m.args
|
|
2210
|
+
?.map((a: any) => (typeof a === 'string' ? a : 'any'))
|
|
2211
|
+
.join(', ') || ''
|
|
2212
|
+
const returns = m.returns?.map((r: any) =>
|
|
2213
|
+
typeof r === 'string' ? r : 'any',
|
|
2214
|
+
)
|
|
2215
|
+
let returnSig = ''
|
|
2216
|
+
if (returns && returns.length === 1) {
|
|
2217
|
+
returnSig = ` ${returns[0]}`
|
|
2218
|
+
} else if (returns && returns.length > 1) {
|
|
2219
|
+
returnSig = ` (${returns.join(', ')})`
|
|
2220
|
+
}
|
|
2221
|
+
return `${m.name}(${args})${returnSig}`
|
|
2222
|
+
})
|
|
2223
|
+
.join('; ')
|
|
2224
|
+
return new InterfaceType(`interface { ${methodSigs} }`, name)
|
|
2188
2225
|
}
|
|
2189
2226
|
return new InterfaceType('interface{}')
|
|
2190
2227
|
}
|
package/gs/strings/iter.ts
CHANGED
|
@@ -25,7 +25,7 @@ const asciiSpace: { [key: number]: boolean } = {
|
|
|
25
25
|
export function Lines(s: string): iter.Seq<string> {
|
|
26
26
|
return (_yield: ((p0: string) => boolean) | null): void => {
|
|
27
27
|
for (; $.len(s) > 0; ) {
|
|
28
|
-
let line: string
|
|
28
|
+
let line: string
|
|
29
29
|
{
|
|
30
30
|
let i = IndexByte(s, 10)
|
|
31
31
|
if (i >= 0) {
|
package/gs/strings/reader.ts
CHANGED
package/gs/strings/replace.ts
CHANGED
|
@@ -395,15 +395,13 @@ class trieNode {
|
|
|
395
395
|
// First byte differs, start a new lookup table here. Looking up
|
|
396
396
|
// what is currently t.prefix[0] will lead to prefixNode, and
|
|
397
397
|
// looking up key[0] will lead to keyNode.
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
})
|
|
406
|
-
}
|
|
398
|
+
const prefixNode =
|
|
399
|
+
$.len(t!.prefix) == 1
|
|
400
|
+
? t!.next
|
|
401
|
+
: new trieNode({
|
|
402
|
+
next: t!.next,
|
|
403
|
+
prefix: $.sliceString(t!.prefix, 1, undefined),
|
|
404
|
+
})
|
|
407
405
|
let keyNode = new trieNode()
|
|
408
406
|
t!.table = $.makeSlice<trieNode | null>(r!.tableSize)
|
|
409
407
|
t!.table![r!.mapping![$.indexString(t!.prefix, 0)]] = prefixNode
|
|
@@ -578,9 +576,7 @@ class genericReplacer {
|
|
|
578
576
|
const r = this
|
|
579
577
|
let sw = getStringWriter(w)
|
|
580
578
|
let last: number = 0
|
|
581
|
-
let wn: number = 0
|
|
582
579
|
let n: number = 0
|
|
583
|
-
let err: $.GoError | null = null
|
|
584
580
|
let prevMatchEmpty: boolean = false
|
|
585
581
|
for (let i = 0; i <= $.len(s); ) {
|
|
586
582
|
// Fast path: s[i] is not a prefix of any pattern.
|
|
@@ -599,7 +595,7 @@ class genericReplacer {
|
|
|
599
595
|
)
|
|
600
596
|
prevMatchEmpty = match && keylen == 0
|
|
601
597
|
if (match) {
|
|
602
|
-
|
|
598
|
+
let [wn, err] = sw!.WriteString($.sliceString(s, last, i))
|
|
603
599
|
n += wn
|
|
604
600
|
if (err != null) {
|
|
605
601
|
return [n, err]
|
|
@@ -616,10 +612,11 @@ class genericReplacer {
|
|
|
616
612
|
i++
|
|
617
613
|
}
|
|
618
614
|
if (last != $.len(s)) {
|
|
619
|
-
|
|
615
|
+
const [wn, err] = sw!.WriteString($.sliceString(s, last, undefined))
|
|
620
616
|
n += wn
|
|
617
|
+
return [n, err]
|
|
621
618
|
}
|
|
622
|
-
return [n,
|
|
619
|
+
return [n, null]
|
|
623
620
|
}
|
|
624
621
|
}
|
|
625
622
|
|
|
@@ -761,15 +758,13 @@ class singleStringReplacer {
|
|
|
761
758
|
const r = this
|
|
762
759
|
let sw = getStringWriter(w)
|
|
763
760
|
let i: number = 0
|
|
764
|
-
let wn: number = 0
|
|
765
761
|
let n: number = 0
|
|
766
|
-
let err: $.GoError | null = null
|
|
767
762
|
for (;;) {
|
|
768
763
|
let match = r!.finder!.next($.sliceString(s, i, undefined))
|
|
769
764
|
if (match == -1) {
|
|
770
765
|
break
|
|
771
766
|
}
|
|
772
|
-
|
|
767
|
+
let [wn, err] = sw!.WriteString($.sliceString(s, i, i + match))
|
|
773
768
|
n += wn
|
|
774
769
|
if (err != null) {
|
|
775
770
|
return [n, err]
|
|
@@ -781,7 +776,7 @@ class singleStringReplacer {
|
|
|
781
776
|
}
|
|
782
777
|
i += match + $.len(r!.finder!.pattern)
|
|
783
778
|
}
|
|
784
|
-
|
|
779
|
+
const [wn, err] = sw!.WriteString($.sliceString(s, i, undefined))
|
|
785
780
|
n += wn
|
|
786
781
|
return [n, err]
|
|
787
782
|
}
|
package/gs/time/time.ts
CHANGED
|
@@ -215,9 +215,9 @@ export class Time {
|
|
|
215
215
|
const ampmLower = ampmUpper.toLowerCase()
|
|
216
216
|
|
|
217
217
|
// Timezone offset calculation - use the location's offset if available
|
|
218
|
-
let tzOffsetSeconds
|
|
218
|
+
let tzOffsetSeconds: number
|
|
219
219
|
let tzName = this._location.name
|
|
220
|
-
let isUTC
|
|
220
|
+
let isUTC: boolean
|
|
221
221
|
|
|
222
222
|
if (this._location.offsetSeconds !== undefined) {
|
|
223
223
|
// Use the fixed offset from the location
|
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.77",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Aperture Robotics LLC.",
|
|
7
7
|
"email": "support@aperture.us",
|
|
@@ -92,22 +92,25 @@
|
|
|
92
92
|
"./{src,builtin,example}/**/(*.ts|*.tsx|*.html|*.css|*.scss)": "prettier --config .prettierrc.yaml --write"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@aptre/protobuf-es-lite": "^1.0.
|
|
95
|
+
"@aptre/protobuf-es-lite": "^1.0.2",
|
|
96
96
|
"@eslint/js": "^10.0.0",
|
|
97
|
-
"@types/node": "^25.
|
|
98
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
99
|
-
"@typescript-eslint/parser": "^8.
|
|
100
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
101
|
-
"@vitest/browser": "^4.
|
|
102
|
-
"@vitest/browser-playwright": "^4.
|
|
103
|
-
"@vitest/browser-preview": "^4.
|
|
104
|
-
"eslint": "^10.
|
|
97
|
+
"@types/node": "^25.5.2",
|
|
98
|
+
"@typescript-eslint/eslint-plugin": "^8.58.0",
|
|
99
|
+
"@typescript-eslint/parser": "^8.58.0",
|
|
100
|
+
"@typescript/native-preview": "^7.0.0-dev.20260404.1",
|
|
101
|
+
"@vitest/browser": "^4.1.2",
|
|
102
|
+
"@vitest/browser-playwright": "^4.1.2",
|
|
103
|
+
"@vitest/browser-preview": "^4.1.2",
|
|
104
|
+
"eslint": "^10.2.0",
|
|
105
105
|
"eslint-config-prettier": "^10.0.2",
|
|
106
106
|
"husky": "^9.1.7",
|
|
107
|
-
"lint-staged": "^16.
|
|
108
|
-
"prettier": "^3.
|
|
109
|
-
"typescript": "^
|
|
110
|
-
"typescript-eslint": "^8.
|
|
111
|
-
"vitest": "^4.
|
|
107
|
+
"lint-staged": "^16.4.0",
|
|
108
|
+
"prettier": "^3.8.1",
|
|
109
|
+
"typescript": "^6.0.0",
|
|
110
|
+
"typescript-eslint": "^8.58.0",
|
|
111
|
+
"vitest": "^4.1.2"
|
|
112
|
+
},
|
|
113
|
+
"dependencies": {
|
|
114
|
+
"globals": "^17.4.0"
|
|
112
115
|
}
|
|
113
116
|
}
|