Skip to content

Commit 207df95

Browse files
authored
es2024 (#1552)
* es2024 support * ✨ feat: enhance array utils and buffer handling Added ES2024 array features and SharedArrayBuffer support.
1 parent a2e5d9f commit 207df95

24 files changed

Lines changed: 101 additions & 46 deletions

File tree

docs/genaisrc/jsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"compilerOptions": {
33
"lib": [
4-
"ES2022"
4+
"ES2024"
55
],
6-
"target": "ES2022",
6+
"target": "ES2024",
77
"module": "ES2022",
88
"moduleDetection": "force",
99
"checkJs": true,

docs/genaisrc/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"compilerOptions": {
33
"lib": [
4-
"ES2022"
4+
"ES2024"
55
],
6-
"target": "ES2023",
6+
"target": "ES2024",
77
"module": "NodeNext",
88
"moduleDetection": "force",
99
"moduleResolution": "nodenext",

eval/extrism/genaisrc/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"compilerOptions": {
33
"lib": [
4-
"ES2022"
4+
"ES2024"
55
],
6-
"target": "ES2023",
6+
"target": "ES2024",
77
"module": "NodeNext",
88
"moduleDetection": "force",
99
"moduleResolution": "nodenext",

genaisrc/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"compilerOptions": {
33
"lib": [
4-
"ES2022"
4+
"ES2024"
55
],
6-
"target": "ES2023",
6+
"target": "ES2024",
77
"module": "NodeNext",
88
"moduleDetection": "force",
99
"moduleResolution": "nodenext",

packages/auto/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"compilerOptions": {
33
"lib": [
4-
"ES2022"
4+
"ES2024"
55
],
6-
"target": "ES2023",
6+
"target": "ES2024",
77
"module": "NodeNext",
88
"moduleDetection": "force",
99
"moduleResolution": "nodenext",

packages/cli/src/runtime.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
* This module provides core functionality for text classification, data transformation,
66
* PDF processing, and file system operations in the GenAIScript environment.
77
*/
8-
import { delay, uniq, uniqBy, chunk, groupBy } from "es-toolkit"
8+
import { delay, uniq, uniqBy, chunk } from "es-toolkit"
99
import { z } from "zod"
1010

1111
/**
1212
* Utility functions exported for general use
1313
*/
14-
export { delay, uniq, uniqBy, z, chunk, groupBy }
15-
14+
export { delay, uniq, uniqBy, z, chunk }
1615
/**
1716
* Options for classifying data using AI models.
1817
*

packages/cli/src/server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,10 @@ window.vscodeWebviewPlaygroundNonce = ${JSON.stringify(nonce)};
824824
const serverHash = apiKey ? `#api-key:${encodeURIComponent(apiKey)}` : ""
825825
httpServer.listen(port, serverHost, () => {
826826
console.log(`GenAIScript server v${CORE_VERSION}`)
827+
if (remote)
828+
console.log(
829+
`│ Remote: ${remote}${options.remoteBranch ? `#${options.remoteBranch}` : ""}`
830+
)
827831
console.log(`│ Local http://${serverHost}:${port}/${serverHash}`)
828832
if (options.network) {
829833
console.log(`│ Host http://localhost:${port}/${serverHash}`)

packages/core/bundleprompts.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ async function main() {
6767
"jsconfig.json": JSON.stringify(
6868
{
6969
compilerOptions: {
70-
lib: ["ES2022"],
71-
target: "ES2022",
70+
lib: ["ES2024"],
71+
target: "ES2024",
7272
module: "ES2022",
7373
moduleDetection: "force",
7474
checkJs: true,
@@ -83,8 +83,8 @@ async function main() {
8383
"tsconfig.json": JSON.stringify(
8484
{
8585
compilerOptions: {
86-
lib: ["ES2022"],
87-
target: "ES2023",
86+
lib: ["ES2024"],
87+
target: "ES2024",
8888
module: "NodeNext",
8989
moduleDetection: "force",
9090
moduleResolution: "nodenext",

packages/core/src/bufferlike.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ import { extname } from "node:path"
55
import { genaiscriptDebug } from "./debug"
66
const dbg = genaiscriptDebug("buffer")
77

8-
async function bufferTryFrom(data: Uint8Array | Buffer | ArrayBuffer) {
8+
async function bufferTryFrom(
9+
data: Uint8Array | Buffer | ArrayBuffer | SharedArrayBuffer
10+
) {
911
if (data === undefined) return undefined
12+
if (data instanceof Buffer) return data
13+
if (data instanceof ArrayBuffer) return Buffer.from(data)
14+
if (data instanceof SharedArrayBuffer) return Buffer.from(data)
1015
return Buffer.from(data)
1116
}
1217

@@ -32,6 +37,8 @@ export async function resolveBufferLike(
3237
return bufferTryFrom(await new Response(stream).arrayBuffer())
3338
} else if (bufferLike instanceof ArrayBuffer)
3439
return bufferTryFrom(bufferLike)
40+
else if (bufferLike instanceof SharedArrayBuffer)
41+
return bufferTryFrom(bufferLike)
3542
else if (bufferLike instanceof Uint8Array) return bufferTryFrom(bufferLike)
3643
else if (
3744
typeof bufferLike === "object" &&

packages/core/src/git.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import debug from "debug"
2-
const dbg = debug("genaiscript:git")
3-
41
// This file contains the GitClient class, which provides methods to interact with Git repositories.
52
// It includes functionality to find modified files, execute Git commands, and manage branches.
63

@@ -23,6 +20,8 @@ import { packageResolveInstall } from "./packagemanagers"
2320
import { normalizeInt } from "./cleaners"
2421
import { dotGenaiscriptPath } from "./workdir"
2522
import { join } from "node:path"
23+
import { genaiscriptDebug } from "./debug"
24+
const dbg = genaiscriptDebug("git")
2625

2726
async function checkDirectoryExists(directory: string): Promise<boolean> {
2827
const stat = await tryStat(directory)
@@ -528,7 +527,7 @@ ${await this.diff({ ...options, nameOnly: true })}
528527
if (branch) directory = join(directory, branch)
529528
logVerbose(`git: shallow cloning ${repository} to ${directory}`)
530529
if (await checkDirectoryExists(directory)) {
531-
if (!force) {
530+
if (!force && !install) {
532531
dbg(`directory already exists`)
533532
return new GitClient(directory)
534533
}

0 commit comments

Comments
 (0)