diff --git a/frontend/src/forms/components/FormErrors.test.tsx b/frontend/src/forms/components/FormErrors.test.tsx new file mode 100644 index 000000000..81081abaa --- /dev/null +++ b/frontend/src/forms/components/FormErrors.test.tsx @@ -0,0 +1,15 @@ +import { describe, it, expect } from "vitest"; +import { render, screen } from "@testing-library/react"; +import FormErrors from "./FormErrors"; + +describe("FormErrors", () => { + it("renders the _form error as an alert", () => { + render(); + expect(screen.getByRole("alert").textContent).toBe("Form is invalid."); + }); + + it("renders nothing without a form-level error", () => { + const { container } = render(); + expect(container.innerHTML).toBe(""); + }); +}); diff --git a/frontend/src/forms/components/FormErrors.tsx b/frontend/src/forms/components/FormErrors.tsx new file mode 100644 index 000000000..cb37f904f --- /dev/null +++ b/frontend/src/forms/components/FormErrors.tsx @@ -0,0 +1,19 @@ +import type React from "react"; +import { FORM_ERROR_KEY } from "../zodValidate"; + +export interface FormErrorsProps { + errors: Partial>; +} + +/** Renders the form-level (`_form`) validation error, if any. */ +const FormErrors: React.FC = ({ errors }) => { + const message = errors[FORM_ERROR_KEY]; + if (!message) return null; + return ( +
+ {message} +
+ ); +}; + +export default FormErrors; diff --git a/frontend/src/forms/index.ts b/frontend/src/forms/index.ts index bfafa0338..7d4be36eb 100644 --- a/frontend/src/forms/index.ts +++ b/frontend/src/forms/index.ts @@ -1,10 +1,13 @@ export { useForm } from "./useForm"; +export { FORM_ERROR_KEY } from "./zodValidate"; +export type { FormErrors as FormErrorMap } from "./zodValidate"; export { validate } from "./validate"; export type { ValidationRule, ValidationSchema } from "./validate"; export { default as FormField } from "./components/FormField"; export { default as FormSelect } from "./components/FormSelect"; export { default as FormTextarea } from "./components/FormTextarea"; +export { default as FormErrors } from "./components/FormErrors"; export { default as SubmitButton } from "./components/SubmitButton"; export type { FormFieldProps } from "./components/FormField"; diff --git a/frontend/src/forms/schemas/settingsFormSchema.ts b/frontend/src/forms/schemas/settingsFormSchema.ts deleted file mode 100644 index 0fe5ea792..000000000 --- a/frontend/src/forms/schemas/settingsFormSchema.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { z } from "zod"; -import { - SLIPPAGE_RANGE_ERROR, - isValidSlippagePercent, -} from "./slippageSchema"; - -export const settingsFormSchema = z.object({ - username: z - .string() - .min(3, "Username must be at least 3 characters.") - .max(30, "Username cannot exceed 30 characters.") - .regex(/^[a-zA-Z0-9_-]+$/, "Username can only contain letters, numbers, underscores, and hyphens."), - email: z.string().email("Please enter a valid email address."), - slippageTolerance: z - .string() - .refine((val) => isValidSlippagePercent(Number(val)), { - message: SLIPPAGE_RANGE_ERROR, - }), - currency: z.enum(["USD", "EUR", "GBP", "XLM"], { - error: () => ({ message: "Please select a supported currency." }), - }), -}); - -export type SettingsFormValues = z.infer; diff --git a/frontend/src/forms/useForm.test.tsx b/frontend/src/forms/useForm.test.tsx index bea44aea4..831b76f4f 100644 --- a/frontend/src/forms/useForm.test.tsx +++ b/frontend/src/forms/useForm.test.tsx @@ -226,3 +226,20 @@ describe("useForm", () => { expect(result.current.errors.amount).toBeUndefined(); }); }); + +describe("useForm form-level zod errors", () => { + it("surfaces object-level refine errors under _form and fails validateAll", async () => { + const { z } = await import("zod"); + const { renderHook, act } = await import("@testing-library/react"); + const schema = z + .object({ a: z.string(), b: z.string() }) + .refine((v) => v.a === v.b, { message: "A must equal B." }); + const { result } = renderHook(() => useForm({ a: "x", b: "y" }, schema)); + let ok = true; + act(() => { + ok = result.current.validateAll(); + }); + expect(ok).toBe(false); + expect(result.current.errors._form).toBe("A must equal B."); + }); +}); diff --git a/frontend/src/forms/useForm.ts b/frontend/src/forms/useForm.ts index 6ac5aee84..6c146f9dc 100644 --- a/frontend/src/forms/useForm.ts +++ b/frontend/src/forms/useForm.ts @@ -1,7 +1,7 @@ import { useCallback, useEffect, useRef, useState } from "react"; import type { ChangeEvent, FocusEvent, FormEvent } from "react"; import { type ValidationSchema, validate } from "./validate"; -import { zodValidate } from "./zodValidate"; +import { FORM_ERROR_KEY, zodValidate, type FormErrors } from "./zodValidate"; import { z } from "zod"; export type FormSchema = ValidationSchema | z.ZodSchema; @@ -10,11 +10,11 @@ export type SubmitStatus = "idle" | "loading" | "success" | "error"; function runSchemaValidation( schema: FormSchema, values: T -): Partial> { +): FormErrors { if ("safeParse" in schema && typeof schema.safeParse === "function") { return zodValidate(schema as z.ZodSchema, values); } - return validate(schema as ValidationSchema, values); + return validate(schema as ValidationSchema, values) as FormErrors; } /** @@ -25,7 +25,7 @@ export function useForm( schema: FormSchema ) { const [values, setValuesState] = useState(initialValues); - const [errors, setErrors] = useState>>({}); + const [errors, setErrors] = useState>({}); const [touched, setTouched] = useState>>({}); const [isSubmitting, setIsSubmitting] = useState(false); const [submitStatus, setSubmitStatus] = useState("idle"); @@ -46,12 +46,12 @@ export function useForm( const filterTouchedErrors = useCallback( ( - allErrors: Partial>, + allErrors: FormErrors, touchedMap: Partial> - ): Partial> => + ): FormErrors => Object.fromEntries( - Object.entries(allErrors).filter(([field]) => touchedMap[field as keyof T]) - ) as Partial>, + Object.entries(allErrors).filter(([field]) => field === FORM_ERROR_KEY || touchedMap[field as keyof T]) + ) as FormErrors, [] ); diff --git a/frontend/src/forms/useZodForm.test.ts b/frontend/src/forms/useZodForm.test.ts deleted file mode 100644 index e6c574a80..000000000 --- a/frontend/src/forms/useZodForm.test.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { describe, it, expect, vi } from "vitest"; -import { renderHook, act } from "@testing-library/react"; -import type { FormEvent } from "react"; -import { useForm } from "./useForm"; -import { settingsFormSchema } from "./schemas/settingsFormSchema"; - -describe("Zod Form Validation & Submission States", () => { - const initialValues = { - username: "", - email: "invalid-email", - slippageTolerance: "55.0", - currency: "USD" as const, - }; - - it("validates fields using Zod schema on validateAll", () => { - const { result } = renderHook(() => useForm(initialValues, settingsFormSchema)); - - let isValid = false; - act(() => { - isValid = result.current.validateAll(); - }); - - expect(isValid).toBe(false); - expect(result.current.errors.username).toBe("Username must be at least 3 characters."); - expect(result.current.errors.email).toBe("Please enter a valid email address."); - expect(result.current.errors.slippageTolerance).toBe("Slippage tolerance must be between 0.1% and 50%."); - }); - - it("clears field errors when valid data is entered", () => { - const { result } = renderHook(() => useForm(initialValues, settingsFormSchema)); - - act(() => { - result.current.setValues({ - username: "valid_user", - email: "user@example.com", - slippageTolerance: "0.5", - currency: "USD", - }); - }); - - let isValid = false; - act(() => { - isValid = result.current.validateAll(); - }); - - expect(isValid).toBe(true); - expect(result.current.errors).toEqual({}); - }); - - it("tracks submission status (loading, success, error)", async () => { - const validValues = { - username: "valid_user", - email: "user@example.com", - slippageTolerance: "0.5", - currency: "USD" as const, - }; - - const { result } = renderHook(() => useForm(validValues, settingsFormSchema)); - - const onSubmitSuccess = vi.fn().mockResolvedValue(undefined); - - const fakeEvent = { preventDefault: vi.fn() } as unknown as FormEvent; - - await act(async () => { - await result.current.handleSubmit(onSubmitSuccess)(fakeEvent); - }); - - expect(onSubmitSuccess).toHaveBeenCalledWith(validValues); - expect(result.current.submitStatus).toBe("success"); - expect(result.current.isSubmitting).toBe(false); - }); -}); diff --git a/frontend/src/forms/zodValidate.test.ts b/frontend/src/forms/zodValidate.test.ts new file mode 100644 index 000000000..53ef321c0 --- /dev/null +++ b/frontend/src/forms/zodValidate.test.ts @@ -0,0 +1,34 @@ +import { describe, it, expect } from "vitest"; +import { z } from "zod"; +import { zodValidate, FORM_ERROR_KEY } from "./zodValidate"; + +const schema = z + .object({ + from: z.string().min(1, "From is required."), + to: z.string().min(1, "To is required."), + }) + .refine((v) => v.from !== v.to, { message: "From and To must differ." }); + +describe("zodValidate", () => { + it("returns no errors for valid values", () => { + expect(zodValidate(schema, { from: "a", to: "b" })).toEqual({}); + }); + + it("reports object-level refine errors under _form", () => { + expect(zodValidate(schema, { from: "a", to: "a" })).toEqual({ + [FORM_ERROR_KEY]: "From and To must differ.", + }); + }); + + it("reports field errors by path[0] and keeps the first message", () => { + const errors = zodValidate(schema, { from: "", to: "b" }); + expect(errors.from).toBe("From is required."); + expect(errors._form).toBeUndefined(); + }); + + it("handles falsy index-0 path keys (array schemas)", () => { + const arr = z.array(z.string().min(2, "Too short.")); + const errors = zodValidate(arr as unknown as z.ZodSchema, ["a", "bb"]); + expect((errors as Record)["0"]).toBe("Too short."); + }); +}); diff --git a/frontend/src/forms/zodValidate.ts b/frontend/src/forms/zodValidate.ts index e18efa393..5e935ee78 100644 --- a/frontend/src/forms/zodValidate.ts +++ b/frontend/src/forms/zodValidate.ts @@ -1,27 +1,36 @@ import { z } from "zod"; +/** Reserved errors key for issues that are not tied to a single field (e.g. object-level refine). */ +export const FORM_ERROR_KEY = "_form"; + +export type FormErrors = Partial< + Record +>; + /** * Validates form values using a Zod schema. - * Returns a map of fieldName -> first error message string. + * Returns a map of fieldName -> first error message string. Issues with an + * empty path are reported under the reserved `_form` key. */ export function zodValidate( schema: z.ZodSchema, values: TValues -): Partial> { +): FormErrors { const result = schema.safeParse(values); if (result.success) { return {}; } - const errors: Partial> = {}; + const errors: Record = {}; for (const issue of result.error.issues) { - const fieldName = issue.path[0] as keyof TValues; - if (fieldName && !errors[fieldName]) { - errors[fieldName] = issue.message; + const first = issue.path[0]; + const key = first === undefined ? FORM_ERROR_KEY : String(first); + if (!(key in errors)) { + errors[key] = issue.message; } } - return errors; + return errors as FormErrors; } export default zodValidate; diff --git a/node_modules/.bin/commitlint b/node_modules/.bin/commitlint index 561e6ad62..6a09cda83 120000 --- a/node_modules/.bin/commitlint +++ b/node_modules/.bin/commitlint @@ -1 +1,16 @@ -../@commitlint/cli/cli.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../@commitlint/cli/cli.js" "$@" +else + exec node "$basedir/../@commitlint/cli/cli.js" "$@" +fi diff --git a/node_modules/.bin/commitlint.cmd b/node_modules/.bin/commitlint.cmd new file mode 100644 index 000000000..aa0b356a2 --- /dev/null +++ b/node_modules/.bin/commitlint.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@commitlint\cli\cli.js" %* diff --git a/node_modules/.bin/commitlint.ps1 b/node_modules/.bin/commitlint.ps1 new file mode 100644 index 000000000..efbe66d60 --- /dev/null +++ b/node_modules/.bin/commitlint.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../@commitlint/cli/cli.js" $args + } else { + & "$basedir/node$exe" "$basedir/../@commitlint/cli/cli.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../@commitlint/cli/cli.js" $args + } else { + & "node$exe" "$basedir/../@commitlint/cli/cli.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/conc b/node_modules/.bin/conc index e9da68781..1333ac0d6 120000 --- a/node_modules/.bin/conc +++ b/node_modules/.bin/conc @@ -1 +1,16 @@ -../concurrently/dist/bin/concurrently.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../concurrently/dist/bin/concurrently.js" "$@" +else + exec node "$basedir/../concurrently/dist/bin/concurrently.js" "$@" +fi diff --git a/node_modules/.bin/conc.cmd b/node_modules/.bin/conc.cmd new file mode 100644 index 000000000..3bf6fba12 --- /dev/null +++ b/node_modules/.bin/conc.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\concurrently\dist\bin\concurrently.js" %* diff --git a/node_modules/.bin/conc.ps1 b/node_modules/.bin/conc.ps1 new file mode 100644 index 000000000..4ca0e5d14 --- /dev/null +++ b/node_modules/.bin/conc.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../concurrently/dist/bin/concurrently.js" $args + } else { + & "$basedir/node$exe" "$basedir/../concurrently/dist/bin/concurrently.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../concurrently/dist/bin/concurrently.js" $args + } else { + & "node$exe" "$basedir/../concurrently/dist/bin/concurrently.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/concurrently b/node_modules/.bin/concurrently index e9da68781..1333ac0d6 120000 --- a/node_modules/.bin/concurrently +++ b/node_modules/.bin/concurrently @@ -1 +1,16 @@ -../concurrently/dist/bin/concurrently.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../concurrently/dist/bin/concurrently.js" "$@" +else + exec node "$basedir/../concurrently/dist/bin/concurrently.js" "$@" +fi diff --git a/node_modules/.bin/concurrently.cmd b/node_modules/.bin/concurrently.cmd new file mode 100644 index 000000000..3bf6fba12 --- /dev/null +++ b/node_modules/.bin/concurrently.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\concurrently\dist\bin\concurrently.js" %* diff --git a/node_modules/.bin/concurrently.ps1 b/node_modules/.bin/concurrently.ps1 new file mode 100644 index 000000000..4ca0e5d14 --- /dev/null +++ b/node_modules/.bin/concurrently.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../concurrently/dist/bin/concurrently.js" $args + } else { + & "$basedir/node$exe" "$basedir/../concurrently/dist/bin/concurrently.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../concurrently/dist/bin/concurrently.js" $args + } else { + & "node$exe" "$basedir/../concurrently/dist/bin/concurrently.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/conventional-commits-parser b/node_modules/.bin/conventional-commits-parser index fe4635183..41e702a17 120000 --- a/node_modules/.bin/conventional-commits-parser +++ b/node_modules/.bin/conventional-commits-parser @@ -1 +1,16 @@ -../conventional-commits-parser/dist/cli/index.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../conventional-commits-parser/dist/cli/index.js" "$@" +else + exec node "$basedir/../conventional-commits-parser/dist/cli/index.js" "$@" +fi diff --git a/node_modules/.bin/conventional-commits-parser.cmd b/node_modules/.bin/conventional-commits-parser.cmd new file mode 100644 index 000000000..d336b4717 --- /dev/null +++ b/node_modules/.bin/conventional-commits-parser.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\conventional-commits-parser\dist\cli\index.js" %* diff --git a/node_modules/.bin/conventional-commits-parser.ps1 b/node_modules/.bin/conventional-commits-parser.ps1 new file mode 100644 index 000000000..874483f95 --- /dev/null +++ b/node_modules/.bin/conventional-commits-parser.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../conventional-commits-parser/dist/cli/index.js" $args + } else { + & "$basedir/node$exe" "$basedir/../conventional-commits-parser/dist/cli/index.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../conventional-commits-parser/dist/cli/index.js" $args + } else { + & "node$exe" "$basedir/../conventional-commits-parser/dist/cli/index.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/esbuild b/node_modules/.bin/esbuild index c83ac0707..63bb6d40f 120000 --- a/node_modules/.bin/esbuild +++ b/node_modules/.bin/esbuild @@ -1 +1,16 @@ -../esbuild/bin/esbuild \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../esbuild/bin/esbuild" "$@" +else + exec node "$basedir/../esbuild/bin/esbuild" "$@" +fi diff --git a/node_modules/.bin/husky b/node_modules/.bin/husky index d5c33f5e4..d1e0e8849 120000 --- a/node_modules/.bin/husky +++ b/node_modules/.bin/husky @@ -1 +1,16 @@ -../husky/bin.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../husky/bin.js" "$@" +else + exec node "$basedir/../husky/bin.js" "$@" +fi diff --git a/node_modules/.bin/jiti b/node_modules/.bin/jiti index 18f28cf34..f4ef06fbb 120000 --- a/node_modules/.bin/jiti +++ b/node_modules/.bin/jiti @@ -1 +1,16 @@ -../jiti/lib/jiti-cli.mjs \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../jiti/lib/jiti-cli.mjs" "$@" +else + exec node "$basedir/../jiti/lib/jiti-cli.mjs" "$@" +fi diff --git a/node_modules/.bin/jiti.cmd b/node_modules/.bin/jiti.cmd new file mode 100644 index 000000000..b2360f3fe --- /dev/null +++ b/node_modules/.bin/jiti.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\jiti\lib\jiti-cli.mjs" %* diff --git a/node_modules/.bin/jiti.ps1 b/node_modules/.bin/jiti.ps1 new file mode 100644 index 000000000..baf5345c2 --- /dev/null +++ b/node_modules/.bin/jiti.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../jiti/lib/jiti-cli.mjs" $args + } else { + & "$basedir/node$exe" "$basedir/../jiti/lib/jiti-cli.mjs" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../jiti/lib/jiti-cli.mjs" $args + } else { + & "node$exe" "$basedir/../jiti/lib/jiti-cli.mjs" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/js-yaml b/node_modules/.bin/js-yaml index 9dbd010d4..82416ef1f 120000 --- a/node_modules/.bin/js-yaml +++ b/node_modules/.bin/js-yaml @@ -1 +1,16 @@ -../js-yaml/bin/js-yaml.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../js-yaml/bin/js-yaml.js" "$@" +else + exec node "$basedir/../js-yaml/bin/js-yaml.js" "$@" +fi diff --git a/node_modules/.bin/js-yaml.cmd b/node_modules/.bin/js-yaml.cmd new file mode 100644 index 000000000..453312b6d --- /dev/null +++ b/node_modules/.bin/js-yaml.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\js-yaml\bin\js-yaml.js" %* diff --git a/node_modules/.bin/js-yaml.ps1 b/node_modules/.bin/js-yaml.ps1 new file mode 100644 index 000000000..2acfc61c3 --- /dev/null +++ b/node_modules/.bin/js-yaml.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args + } else { + & "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args + } else { + & "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/license-checker b/node_modules/.bin/license-checker index 8b86cb3d8..80ef60f3c 120000 --- a/node_modules/.bin/license-checker +++ b/node_modules/.bin/license-checker @@ -1 +1,16 @@ -../license-checker/bin/license-checker \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../license-checker/bin/license-checker" "$@" +else + exec node "$basedir/../license-checker/bin/license-checker" "$@" +fi diff --git a/node_modules/.bin/license-checker.cmd b/node_modules/.bin/license-checker.cmd new file mode 100644 index 000000000..7d7bbfdbc --- /dev/null +++ b/node_modules/.bin/license-checker.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\license-checker\bin\license-checker" %* diff --git a/node_modules/.bin/license-checker.ps1 b/node_modules/.bin/license-checker.ps1 new file mode 100644 index 000000000..b3cfb7507 --- /dev/null +++ b/node_modules/.bin/license-checker.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../license-checker/bin/license-checker" $args + } else { + & "$basedir/node$exe" "$basedir/../license-checker/bin/license-checker" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../license-checker/bin/license-checker" $args + } else { + & "node$exe" "$basedir/../license-checker/bin/license-checker" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/lint-staged b/node_modules/.bin/lint-staged index f29009ba4..f5b5bd716 120000 --- a/node_modules/.bin/lint-staged +++ b/node_modules/.bin/lint-staged @@ -1 +1,16 @@ -../lint-staged/bin/lint-staged.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../lint-staged/bin/lint-staged.js" "$@" +else + exec node "$basedir/../lint-staged/bin/lint-staged.js" "$@" +fi diff --git a/node_modules/.bin/lint-staged.cmd b/node_modules/.bin/lint-staged.cmd new file mode 100644 index 000000000..7cbe2178d --- /dev/null +++ b/node_modules/.bin/lint-staged.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\lint-staged\bin\lint-staged.js" %* diff --git a/node_modules/.bin/lint-staged.ps1 b/node_modules/.bin/lint-staged.ps1 new file mode 100644 index 000000000..fbce61011 --- /dev/null +++ b/node_modules/.bin/lint-staged.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../lint-staged/bin/lint-staged.js" $args + } else { + & "$basedir/node$exe" "$basedir/../lint-staged/bin/lint-staged.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../lint-staged/bin/lint-staged.js" $args + } else { + & "node$exe" "$basedir/../lint-staged/bin/lint-staged.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/mkdirp b/node_modules/.bin/mkdirp index 017896ceb..1ab9c81af 120000 --- a/node_modules/.bin/mkdirp +++ b/node_modules/.bin/mkdirp @@ -1 +1,16 @@ -../mkdirp/bin/cmd.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@" +else + exec node "$basedir/../mkdirp/bin/cmd.js" "$@" +fi diff --git a/node_modules/.bin/mkdirp.cmd b/node_modules/.bin/mkdirp.cmd new file mode 100644 index 000000000..a865dd9f3 --- /dev/null +++ b/node_modules/.bin/mkdirp.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %* diff --git a/node_modules/.bin/mkdirp.ps1 b/node_modules/.bin/mkdirp.ps1 new file mode 100644 index 000000000..911e85466 --- /dev/null +++ b/node_modules/.bin/mkdirp.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args + } else { + & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args + } else { + & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/nanoid b/node_modules/.bin/nanoid index e2be547bc..46220bdb5 120000 --- a/node_modules/.bin/nanoid +++ b/node_modules/.bin/nanoid @@ -1 +1,16 @@ -../nanoid/bin/nanoid.cjs \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../nanoid/bin/nanoid.cjs" "$@" +else + exec node "$basedir/../nanoid/bin/nanoid.cjs" "$@" +fi diff --git a/node_modules/.bin/nopt b/node_modules/.bin/nopt index 6b6566ea7..0808130fb 120000 --- a/node_modules/.bin/nopt +++ b/node_modules/.bin/nopt @@ -1 +1,16 @@ -../nopt/bin/nopt.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@" +else + exec node "$basedir/../nopt/bin/nopt.js" "$@" +fi diff --git a/node_modules/.bin/nopt.cmd b/node_modules/.bin/nopt.cmd new file mode 100644 index 000000000..a7f38b3da --- /dev/null +++ b/node_modules/.bin/nopt.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nopt\bin\nopt.js" %* diff --git a/node_modules/.bin/nopt.ps1 b/node_modules/.bin/nopt.ps1 new file mode 100644 index 000000000..9d6ba56f6 --- /dev/null +++ b/node_modules/.bin/nopt.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args + } else { + & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../nopt/bin/nopt.js" $args + } else { + & "node$exe" "$basedir/../nopt/bin/nopt.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/resolve b/node_modules/.bin/resolve index b6afda6c7..c043cba00 120000 --- a/node_modules/.bin/resolve +++ b/node_modules/.bin/resolve @@ -1 +1,16 @@ -../resolve/bin/resolve \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../resolve/bin/resolve" "$@" +else + exec node "$basedir/../resolve/bin/resolve" "$@" +fi diff --git a/node_modules/.bin/resolve.cmd b/node_modules/.bin/resolve.cmd new file mode 100644 index 000000000..1a017c403 --- /dev/null +++ b/node_modules/.bin/resolve.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\resolve\bin\resolve" %* diff --git a/node_modules/.bin/resolve.ps1 b/node_modules/.bin/resolve.ps1 new file mode 100644 index 000000000..f22b2d317 --- /dev/null +++ b/node_modules/.bin/resolve.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../resolve/bin/resolve" $args + } else { + & "$basedir/node$exe" "$basedir/../resolve/bin/resolve" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../resolve/bin/resolve" $args + } else { + & "node$exe" "$basedir/../resolve/bin/resolve" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/rolldown b/node_modules/.bin/rolldown index 7725012ce..e7853eec2 120000 --- a/node_modules/.bin/rolldown +++ b/node_modules/.bin/rolldown @@ -1 +1,16 @@ -../rolldown/bin/cli.mjs \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../rolldown/bin/cli.mjs" "$@" +else + exec node "$basedir/../rolldown/bin/cli.mjs" "$@" +fi diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver index 5aaadf42c..97c53279f 120000 --- a/node_modules/.bin/semver +++ b/node_modules/.bin/semver @@ -1 +1,16 @@ -../semver/bin/semver.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@" +else + exec node "$basedir/../semver/bin/semver.js" "$@" +fi diff --git a/node_modules/.bin/semver.cmd b/node_modules/.bin/semver.cmd new file mode 100644 index 000000000..9913fa9d0 --- /dev/null +++ b/node_modules/.bin/semver.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %* diff --git a/node_modules/.bin/semver.ps1 b/node_modules/.bin/semver.ps1 new file mode 100644 index 000000000..314717ad4 --- /dev/null +++ b/node_modules/.bin/semver.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args + } else { + & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../semver/bin/semver.js" $args + } else { + & "node$exe" "$basedir/../semver/bin/semver.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/specificity b/node_modules/.bin/specificity index ee9d3afb1..0bf97acb9 120000 --- a/node_modules/.bin/specificity +++ b/node_modules/.bin/specificity @@ -1 +1,16 @@ -../@bramus/specificity/bin/cli.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../@bramus/specificity/bin/cli.js" "$@" +else + exec node "$basedir/../@bramus/specificity/bin/cli.js" "$@" +fi diff --git a/node_modules/.bin/tldts b/node_modules/.bin/tldts index 85001241b..16058dc0e 120000 --- a/node_modules/.bin/tldts +++ b/node_modules/.bin/tldts @@ -1 +1,16 @@ -../tldts/bin/cli.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../tldts/bin/cli.js" "$@" +else + exec node "$basedir/../tldts/bin/cli.js" "$@" +fi diff --git a/node_modules/.bin/tree-kill b/node_modules/.bin/tree-kill index 26dcd2c05..6bcf984e6 120000 --- a/node_modules/.bin/tree-kill +++ b/node_modules/.bin/tree-kill @@ -1 +1,16 @@ -../tree-kill/cli.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../tree-kill/cli.js" "$@" +else + exec node "$basedir/../tree-kill/cli.js" "$@" +fi diff --git a/node_modules/.bin/tree-kill.cmd b/node_modules/.bin/tree-kill.cmd new file mode 100644 index 000000000..dcb9aa69d --- /dev/null +++ b/node_modules/.bin/tree-kill.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\tree-kill\cli.js" %* diff --git a/node_modules/.bin/tree-kill.ps1 b/node_modules/.bin/tree-kill.ps1 new file mode 100644 index 000000000..61d62ddb8 --- /dev/null +++ b/node_modules/.bin/tree-kill.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../tree-kill/cli.js" $args + } else { + & "$basedir/node$exe" "$basedir/../tree-kill/cli.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../tree-kill/cli.js" $args + } else { + & "node$exe" "$basedir/../tree-kill/cli.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/tsc b/node_modules/.bin/tsc index 0863208a6..c4864b9a0 120000 --- a/node_modules/.bin/tsc +++ b/node_modules/.bin/tsc @@ -1 +1,16 @@ -../typescript/bin/tsc \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@" +else + exec node "$basedir/../typescript/bin/tsc" "$@" +fi diff --git a/node_modules/.bin/tsc.cmd b/node_modules/.bin/tsc.cmd new file mode 100644 index 000000000..40bf12845 --- /dev/null +++ b/node_modules/.bin/tsc.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\typescript\bin\tsc" %* diff --git a/node_modules/.bin/tsc.ps1 b/node_modules/.bin/tsc.ps1 new file mode 100644 index 000000000..112413b58 --- /dev/null +++ b/node_modules/.bin/tsc.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args + } else { + & "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../typescript/bin/tsc" $args + } else { + & "node$exe" "$basedir/../typescript/bin/tsc" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/tsx b/node_modules/.bin/tsx index f7282dd89..590318c39 120000 --- a/node_modules/.bin/tsx +++ b/node_modules/.bin/tsx @@ -1 +1,16 @@ -../tsx/dist/cli.mjs \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../tsx/dist/cli.mjs" "$@" +else + exec node "$basedir/../tsx/dist/cli.mjs" "$@" +fi diff --git a/node_modules/.bin/vite b/node_modules/.bin/vite index 6d1e3beaf..014463f96 120000 --- a/node_modules/.bin/vite +++ b/node_modules/.bin/vite @@ -1 +1,16 @@ -../vite/bin/vite.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@" +else + exec node "$basedir/../vite/bin/vite.js" "$@" +fi diff --git a/node_modules/.bin/vitest b/node_modules/.bin/vitest index 227349794..5c079d247 120000 --- a/node_modules/.bin/vitest +++ b/node_modules/.bin/vitest @@ -1 +1,16 @@ -../vitest/vitest.mjs \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../vitest/vitest.mjs" "$@" +else + exec node "$basedir/../vitest/vitest.mjs" "$@" +fi diff --git a/node_modules/.bin/why-is-node-running b/node_modules/.bin/why-is-node-running index f08a594c7..f908619eb 120000 --- a/node_modules/.bin/why-is-node-running +++ b/node_modules/.bin/why-is-node-running @@ -1 +1,16 @@ -../why-is-node-running/cli.js \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../why-is-node-running/cli.js" "$@" +else + exec node "$basedir/../why-is-node-running/cli.js" "$@" +fi diff --git a/node_modules/.bin/yaml b/node_modules/.bin/yaml index 036832479..c68b081f7 120000 --- a/node_modules/.bin/yaml +++ b/node_modules/.bin/yaml @@ -1 +1,16 @@ -../yaml/bin.mjs \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../yaml/bin.mjs" "$@" +else + exec node "$basedir/../yaml/bin.mjs" "$@" +fi diff --git a/node_modules/.bin/yaml.cmd b/node_modules/.bin/yaml.cmd new file mode 100644 index 000000000..f76090fc6 --- /dev/null +++ b/node_modules/.bin/yaml.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\yaml\bin.mjs" %* diff --git a/node_modules/.bin/yaml.ps1 b/node_modules/.bin/yaml.ps1 new file mode 100644 index 000000000..682058284 --- /dev/null +++ b/node_modules/.bin/yaml.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../yaml/bin.mjs" $args + } else { + & "$basedir/node$exe" "$basedir/../yaml/bin.mjs" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../yaml/bin.mjs" $args + } else { + & "node$exe" "$basedir/../yaml/bin.mjs" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 3d7a9f670..eeb784417 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -450,7 +450,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=20.19.0" }, @@ -495,23 +494,11 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=20.19.0" } }, - "node_modules/@emnapi/wasi-threads": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz", - "integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@esbuild/linux-x64": { + "node_modules/@esbuild/win32-x64": { "version": "0.28.1", "cpu": [ "x64" @@ -520,7 +507,7 @@ "license": "MIT", "optional": true, "os": [ - "linux" + "win32" ], "engines": { "node": ">=18" @@ -555,7 +542,7 @@ "url": "https://github.com/sponsors/Boshen" } }, - "node_modules/@rolldown/binding-linux-x64-gnu": { + "node_modules/@rolldown/binding-win32-x64-msvc": { "version": "1.1.3", "cpu": [ "x64" @@ -564,7 +551,7 @@ "license": "MIT", "optional": true, "os": [ - "linux" + "win32" ], "engines": { "node": "^20.19.0 || >=22.12.0" @@ -639,10 +626,10 @@ "undici-types": "~8.9.0" } }, - "node_modules/@typescript/typescript-linux-x64": { + "node_modules/@typescript/typescript-win32-x64": { "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz", - "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz", + "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==", "cpu": [ "x64" ], @@ -650,8 +637,9 @@ "license": "Apache-2.0", "optional": true, "os": [ - "linux" + "win32" ], + "peer": true, "engines": { "node": ">=16.20.0" } @@ -1173,7 +1161,6 @@ "integrity": "sha512-gtTZxTDau1wL7Y7zifc2dd8jHSK/k6BTx/2Xp/BpdlAdnlYWFVt7qhJqgwi7637yRwRQ3qL4ZidbB4I8tA5VOg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "env-paths": "^2.2.1", "import-fresh": "^3.3.0", @@ -1755,7 +1742,6 @@ "version": "29.1.1", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@asamuzakjp/css-color": "^5.1.11", "@asamuzakjp/dom-selector": "^7.1.1", @@ -1933,7 +1919,7 @@ "lightningcss-win32-x64-msvc": "1.32.0" } }, - "node_modules/lightningcss-linux-x64-gnu": { + "node_modules/lightningcss-win32-x64-msvc": { "version": "1.32.0", "cpu": [ "x64" @@ -1942,7 +1928,7 @@ "license": "MPL-2.0", "optional": true, "os": [ - "linux" + "win32" ], "engines": { "node": ">= 12.0.0" @@ -2750,7 +2736,6 @@ "version": "4.22.4", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "~0.28.0" }, @@ -2813,7 +2798,8 @@ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/util-extend": { "version": "1.0.3", @@ -2850,7 +2836,6 @@ "version": "8.1.0", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "lightningcss": "^1.32.0", "picomatch": "^4.0.4", diff --git a/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json b/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json deleted file mode 100644 index ebb85bc0d..000000000 --- a/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +++ /dev/null @@ -1 +0,0 @@ -{"version":"4.1.9","results":[[":scripts/validate-incident-severity.test.ts",{"duration":13.491262000000006,"failed":false}]]} \ No newline at end of file diff --git a/node_modules/@emnapi/wasi-threads/LICENSE b/node_modules/@emnapi/wasi-threads/LICENSE deleted file mode 100644 index 05a594416..000000000 --- a/node_modules/@emnapi/wasi-threads/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021-present Toyobayashi - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@emnapi/wasi-threads/README.md b/node_modules/@emnapi/wasi-threads/README.md deleted file mode 100644 index d7ab93560..000000000 --- a/node_modules/@emnapi/wasi-threads/README.md +++ /dev/null @@ -1,203 +0,0 @@ -# @emnapi/wasi-threads - -This package makes [wasi-threads proposal](https://github.com/WebAssembly/wasi-threads) based WASI modules work in Node.js and browser. - -## Quick Start - -`index.html` - -```html - - - -``` - -If your application will block browser main thread (for example `pthread_join`), please run it in worker instead. - -```html - -``` - -`index.js` - -```js -const ENVIRONMENT_IS_NODE = - typeof process === 'object' && process !== null && - typeof process.versions === 'object' && process.versions !== null && - typeof process.versions.node === 'string'; - -(function (main) { - if (ENVIRONMENT_IS_NODE) { - main(require) - } else { - if (typeof importScripts === 'function') { - importScripts('./node_modules/@tybys/wasm-util/dist/wasm-util.js') - importScripts('./node_modules/@emnapi/wasi-threads/dist/wasi-threads.js') - } - const nodeWasi = { WASI: globalThis.wasmUtil.WASI } - const nodeWorkerThreads = { - Worker: globalThis.Worker - } - const _require = function (request) { - if (request === 'node:wasi' || request === 'wasi') return nodeWasi - if (request === 'node:worker_threads' || request === 'worker_threads') return nodeWorkerThreads - if (request === '@emnapi/wasi-threads') return globalThis.wasiThreads - throw new Error('Can not find module: ' + request) - } - main(_require) - } -})(async function (require) { - const { WASI } = require('wasi') - const { Worker } = require('worker_threads') - const { WASIThreads } = require('@emnapi/wasi-threads') - - const wasi = new WASI({ - version: 'preview1' - }) - const wasiThreads = new WASIThreads({ - wasi, - - /** - * avoid Atomics.wait() deadlock during thread creation in browser - * see https://emscripten.org/docs/tools_reference/settings_reference.html#pthread-pool-size - */ - reuseWorker: ENVIRONMENT_IS_NODE - ? false - : { - size: 4 /** greater than actual needs (2) */, - strict: true - }, - - /** - * Synchronous thread creation - * pthread_create will not return until thread worker actually starts - */ - waitThreadStart: typeof window === 'undefined' ? 1000 : false, - - onCreateWorker: () => { - return new Worker('./worker.js', { - execArgv: ['--experimental-wasi-unstable-preview1'] - }) - } - }) - const memory = new WebAssembly.Memory({ - initial: 16777216 / 65536, - maximum: 2147483648 / 65536, - shared: true - }) - let input - const file = 'path/to/your/wasi-module.wasm' - try { - input = require('fs').readFileSync(require('path').join(__dirname, file)) - } catch (err) { - const response = await fetch(file) - input = await response.arrayBuffer() - } - let { module, instance } = await WebAssembly.instantiate(input, { - env: { memory }, - wasi_snapshot_preview1: wasi.wasiImport, - ...wasiThreads.getImportObject() - }) - - wasiThreads.setup(instance, module, memory) - await wasiThreads.preloadWorkers() - - if (typeof instance.exports._start === 'function') { - return wasi.start(instance) - } else { - wasi.initialize(instance) - // instance.exports.exported_wasm_function() - } -}) -``` - -`worker.js` - -```js -(function (main) { - const ENVIRONMENT_IS_NODE = - typeof process === 'object' && process !== null && - typeof process.versions === 'object' && process.versions !== null && - typeof process.versions.node === 'string' - - if (ENVIRONMENT_IS_NODE) { - const _require = function (request) { - return require(request) - } - - const _init = function () { - const nodeWorkerThreads = require('worker_threads') - const parentPort = nodeWorkerThreads.parentPort - - parentPort.on('message', (data) => { - globalThis.onmessage({ data }) - }) - - Object.assign(globalThis, { - self: globalThis, - require, - Worker: nodeWorkerThreads.Worker, - importScripts: function (f) { - (0, eval)(require('fs').readFileSync(f, 'utf8') + '//# sourceURL=' + f) - }, - postMessage: function (msg) { - parentPort.postMessage(msg) - } - }) - } - - main(_require, _init) - } else { - importScripts('./node_modules/@tybys/wasm-util/dist/wasm-util.js') - importScripts('./node_modules/@emnapi/wasi-threads/dist/wasi-threads.js') - - const nodeWasi = { WASI: globalThis.wasmUtil.WASI } - const _require = function (request) { - if (request === '@emnapi/wasi-threads') return globalThis.wasiThreads - if (request === 'node:wasi' || request === 'wasi') return nodeWasi - throw new Error('Can not find module: ' + request) - } - const _init = function () {} - main(_require, _init) - } -})(function main (require, init) { - init() - - const { WASI } = require('wasi') - const { ThreadMessageHandler, WASIThreads } = require('@emnapi/wasi-threads') - - const handler = new ThreadMessageHandler({ - async onLoad ({ wasmModule, wasmMemory }) { - const wasi = new WASI({ - version: 'preview1' - }) - - const wasiThreads = new WASIThreads({ - wasi, - childThread: true - }) - - const originalInstance = await WebAssembly.instantiate(wasmModule, { - env: { - memory: wasmMemory, - }, - wasi_snapshot_preview1: wasi.wasiImport, - ...wasiThreads.getImportObject() - }) - - // must call `initialize` instead of `start` in child thread - const instance = wasiThreads.initialize(originalInstance, wasmModule, wasmMemory) - - return { module: wasmModule, instance } - } - }) - - globalThis.onmessage = function (e) { - handler.handle(e) - // handle other messages - } -}) -``` diff --git a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.js b/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.js deleted file mode 100644 index 96a1d87f7..000000000 --- a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.js +++ /dev/null @@ -1,885 +0,0 @@ -const _WebAssembly = typeof WebAssembly !== 'undefined' - ? WebAssembly - : typeof WXWebAssembly !== 'undefined' - ? WXWebAssembly - : undefined; -const ENVIRONMENT_IS_NODE = typeof process === 'object' && process !== null && - typeof process.versions === 'object' && process.versions !== null && - typeof process.versions.node === 'string'; -function getPostMessage(options) { - return typeof (options === null || options === void 0 ? void 0 : options.postMessage) === 'function' - ? options.postMessage - : typeof postMessage === 'function' - ? postMessage - : undefined; -} -function serizeErrorToBuffer(sab, code, error) { - const i32array = new Int32Array(sab); - Atomics.store(i32array, 0, code); - if (code > 1 && error) { - const name = error.name; - const message = error.message; - const stack = error.stack; - const nameBuffer = new TextEncoder().encode(name); - const messageBuffer = new TextEncoder().encode(message); - const stackBuffer = new TextEncoder().encode(stack); - Atomics.store(i32array, 1, nameBuffer.length); - Atomics.store(i32array, 2, messageBuffer.length); - Atomics.store(i32array, 3, stackBuffer.length); - const buffer = new Uint8Array(sab); - buffer.set(nameBuffer, 16); - buffer.set(messageBuffer, 16 + nameBuffer.length); - buffer.set(stackBuffer, 16 + nameBuffer.length + messageBuffer.length); - } -} -function deserizeErrorFromBuffer(sab) { - var _a, _b; - const i32array = new Int32Array(sab); - const status = Atomics.load(i32array, 0); - if (status <= 1) { - return null; - } - const nameLength = Atomics.load(i32array, 1); - const messageLength = Atomics.load(i32array, 2); - const stackLength = Atomics.load(i32array, 3); - const buffer = new Uint8Array(sab); - const nameBuffer = buffer.slice(16, 16 + nameLength); - const messageBuffer = buffer.slice(16 + nameLength, 16 + nameLength + messageLength); - const stackBuffer = buffer.slice(16 + nameLength + messageLength, 16 + nameLength + messageLength + stackLength); - const name = new TextDecoder().decode(nameBuffer); - const message = new TextDecoder().decode(messageBuffer); - const stack = new TextDecoder().decode(stackBuffer); - const ErrorConstructor = (_a = globalThis[name]) !== null && _a !== void 0 ? _a : (name === 'RuntimeError' ? ((_b = _WebAssembly.RuntimeError) !== null && _b !== void 0 ? _b : Error) : Error); - const error = new ErrorConstructor(message); - Object.defineProperty(error, 'stack', { - value: stack, - writable: true, - enumerable: false, - configurable: true - }); - return error; -} -function isSharedArrayBuffer(value) { - return ((typeof SharedArrayBuffer === 'function' && value instanceof SharedArrayBuffer) || - (Object.prototype.toString.call(value) === '[object SharedArrayBuffer]')); -} -function isTrapError(e) { - try { - return e instanceof _WebAssembly.RuntimeError; - } - catch (_) { - return false; - } -} - -function createMessage(type, payload) { - return { - __emnapi__: { - type, - payload - } - }; -} - -const WASI_THREADS_MAX_TID = 0x1FFFFFFF; -function checkSharedWasmMemory(wasmMemory) { - if (wasmMemory) { - if (!isSharedArrayBuffer(wasmMemory.buffer)) { - throw new Error('Multithread features require shared wasm memory. ' + - 'Try to compile with `-matomics -mbulk-memory` and use `--import-memory --shared-memory` during linking, ' + - 'then create WebAssembly.Memory with `shared: true` option'); - } - } - else { - if (typeof SharedArrayBuffer === 'undefined') { - throw new Error('Current environment does not support SharedArrayBuffer, threads are not available!'); - } - } -} -function getReuseWorker(value) { - var _a; - if (typeof value === 'boolean') { - return value ? { size: 0, strict: false } : false; - } - if (typeof value === 'number') { - if (!(value >= 0)) { - throw new RangeError('reuseWorker: size must be a non-negative integer'); - } - return { size: value, strict: false }; - } - if (!value) { - return false; - } - const size = (_a = Number(value.size)) !== null && _a !== void 0 ? _a : 0; - const strict = Boolean(value.strict); - if (!(size > 0) && strict) { - throw new RangeError('reuseWorker: size must be set to positive integer if strict is set to true'); - } - return { size, strict }; -} -let nextWorkerID = 0; -class ThreadManager { - get nextWorkerID() { return nextWorkerID; } - constructor(options) { - var _a; - this.unusedWorkers = []; - this.pthreads = Object.create(null); - this.wasmModule = null; - this.wasmMemory = null; - this.messageEvents = new WeakMap(); - if (!options) { - throw new TypeError('ThreadManager(): options is not provided'); - } - if ('childThread' in options) { - this._childThread = Boolean(options.childThread); - } - else { - this._childThread = false; - } - if (this._childThread) { - this._onCreateWorker = undefined; - this._reuseWorker = false; - this._beforeLoad = undefined; - } - else { - this._onCreateWorker = options.onCreateWorker; - this._reuseWorker = getReuseWorker(options.reuseWorker); - this._beforeLoad = options.beforeLoad; - } - this.printErr = (_a = options.printErr) !== null && _a !== void 0 ? _a : console.error.bind(console); - this.threadSpawn = options.threadSpawn; - } - init() { - if (!this._childThread) { - this.initMainThread(); - } - } - initMainThread() { - this.preparePool(); - } - preparePool() { - if (this._reuseWorker) { - if (this._reuseWorker.size) { - let pthreadPoolSize = this._reuseWorker.size; - while (pthreadPoolSize--) { - const worker = this.allocateUnusedWorker(); - if (ENVIRONMENT_IS_NODE) { - worker.once('message', () => { }); - worker.unref(); - } - } - } - } - } - shouldPreloadWorkers() { - return !this._childThread && this._reuseWorker && this._reuseWorker.size > 0; - } - loadWasmModuleToAllWorkers() { - const promises = Array(this.unusedWorkers.length); - for (let i = 0; i < this.unusedWorkers.length; ++i) { - const worker = this.unusedWorkers[i]; - if (ENVIRONMENT_IS_NODE) - worker.ref(); - promises[i] = this.loadWasmModuleToWorker(worker).then((w) => { - if (ENVIRONMENT_IS_NODE) - worker.unref(); - return w; - }, (e) => { - if (ENVIRONMENT_IS_NODE) - worker.unref(); - throw e; - }); - } - return Promise.all(promises).catch((err) => { - this.terminateAllThreads(); - throw err; - }); - } - preloadWorkers() { - if (this.shouldPreloadWorkers()) { - return this.loadWasmModuleToAllWorkers(); - } - return Promise.resolve([]); - } - setup(wasmModule, wasmMemory) { - this.wasmModule = wasmModule; - this.wasmMemory = wasmMemory; - } - markId(worker) { - if (worker.__emnapi_tid) - return worker.__emnapi_tid; - const tid = nextWorkerID + 43; - nextWorkerID = (nextWorkerID + 1) % (WASI_THREADS_MAX_TID - 42); - this.pthreads[tid] = worker; - worker.__emnapi_tid = tid; - return tid; - } - returnWorkerToPool(worker) { - var tid = worker.__emnapi_tid; - if (tid !== undefined) { - delete this.pthreads[tid]; - } - this.unusedWorkers.push(worker); - delete worker.__emnapi_tid; - if (ENVIRONMENT_IS_NODE) { - worker.unref(); - } - } - loadWasmModuleToWorker(worker, sab) { - if (worker.whenLoaded) - return worker.whenLoaded; - const err = this.printErr; - const beforeLoad = this._beforeLoad; - const _this = this; - worker.whenLoaded = new Promise((resolve, reject) => { - const handleError = function (e) { - let message = 'worker sent an error!'; - if (worker.__emnapi_tid !== undefined) { - message = 'worker (tid = ' + worker.__emnapi_tid + ') sent an error!'; - } - if ('message' in e) { - err(message + ' ' + e.message); - if (e.message.indexOf('RuntimeError') !== -1 || e.message.indexOf('unreachable') !== -1) { - try { - _this.terminateAllThreads(); - } - catch (_) { } - } - } - else { - err(message); - } - reject(e); - throw e; - }; - const handleMessage = (data) => { - if (data.__emnapi__) { - const type = data.__emnapi__.type; - const payload = data.__emnapi__.payload; - if (type === 'loaded') { - worker.loaded = true; - if (ENVIRONMENT_IS_NODE && !worker.__emnapi_tid) { - worker.unref(); - } - resolve(worker); - } - else if (type === 'cleanup-thread') { - if (payload.tid in this.pthreads) { - this.cleanThread(worker, payload.tid); - } - } - else if (type === 'spawn-thread') { - this.threadSpawn(payload.startArg, payload.errorOrTid); - } - else if (type === 'terminate-all-threads') { - this.terminateAllThreads(); - } - } - }; - worker.onmessage = (e) => { - handleMessage(e.data); - this.fireMessageEvent(worker, e); - }; - worker.onerror = handleError; - if (ENVIRONMENT_IS_NODE) { - worker.on('message', function (data) { - var _a, _b; - (_b = (_a = worker).onmessage) === null || _b === void 0 ? void 0 : _b.call(_a, { - data - }); - }); - worker.on('error', function (e) { - var _a, _b; - (_b = (_a = worker).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, e); - }); - worker.on('detachedExit', function () { }); - } - if (typeof beforeLoad === 'function') { - beforeLoad(worker); - } - try { - worker.postMessage(createMessage('load', { - wasmModule: this.wasmModule, - wasmMemory: this.wasmMemory, - sab - })); - } - catch (err) { - checkSharedWasmMemory(this.wasmMemory); - throw err; - } - }); - return worker.whenLoaded; - } - allocateUnusedWorker() { - const _onCreateWorker = this._onCreateWorker; - if (typeof _onCreateWorker !== 'function') { - throw new TypeError('`options.onCreateWorker` is not provided'); - } - const worker = _onCreateWorker({ type: 'thread', name: 'emnapi-pthread' }); - this.unusedWorkers.push(worker); - return worker; - } - getNewWorker(sab) { - if (this._reuseWorker) { - if (this.unusedWorkers.length === 0) { - if (this._reuseWorker.strict) { - if (!ENVIRONMENT_IS_NODE) { - const err = this.printErr; - err('Tried to spawn a new thread, but the thread pool is exhausted.\n' + - 'This might result in a deadlock unless some threads eventually exit or the code explicitly breaks out to the event loop.'); - return; - } - } - const worker = this.allocateUnusedWorker(); - this.loadWasmModuleToWorker(worker, sab); - } - return this.unusedWorkers.pop(); - } - const worker = this.allocateUnusedWorker(); - this.loadWasmModuleToWorker(worker, sab); - return this.unusedWorkers.pop(); - } - cleanThread(worker, tid, force) { - if (!force && this._reuseWorker) { - this.returnWorkerToPool(worker); - } - else { - delete this.pthreads[tid]; - this.terminateWorker(worker); - delete worker.__emnapi_tid; - } - } - terminateWorker(worker) { - var _a; - const tid = worker.__emnapi_tid; - worker.terminate(); - (_a = this.messageEvents.get(worker)) === null || _a === void 0 ? void 0 : _a.clear(); - this.messageEvents.delete(worker); - worker.onmessage = (e) => { - if (e.data.__emnapi__) { - const err = this.printErr; - err('received "' + e.data.__emnapi__.type + '" command from terminated worker: ' + tid); - } - }; - } - terminateAllThreads() { - const runningWorkers = Object.values(this.pthreads); - for (let i = 0; i < runningWorkers.length; ++i) { - this.terminateWorker(runningWorkers[i]); - } - for (let i = 0; i < this.unusedWorkers.length; ++i) { - this.terminateWorker(this.unusedWorkers[i]); - } - this.unusedWorkers = []; - this.pthreads = Object.create(null); - this.preparePool(); - } - addMessageEventListener(worker, onMessage) { - let listeners = this.messageEvents.get(worker); - if (!listeners) { - listeners = new Set(); - this.messageEvents.set(worker, listeners); - } - listeners.add(onMessage); - return () => { - listeners === null || listeners === void 0 ? void 0 : listeners.delete(onMessage); - }; - } - fireMessageEvent(worker, e) { - const listeners = this.messageEvents.get(worker); - if (!listeners) - return; - const err = this.printErr; - listeners.forEach((listener) => { - try { - listener(e); - } - catch (e) { - err(e.stack); - } - }); - } -} - -const kIsProxy = Symbol('kIsProxy'); -function createInstanceProxy(instance, memory) { - if (instance[kIsProxy]) - return instance; - const originalExports = instance.exports; - const createHandler = function (target) { - const handlers = [ - 'apply', - 'construct', - 'defineProperty', - 'deleteProperty', - 'get', - 'getOwnPropertyDescriptor', - 'getPrototypeOf', - 'has', - 'isExtensible', - 'ownKeys', - 'preventExtensions', - 'set', - 'setPrototypeOf' - ]; - const handler = {}; - for (let i = 0; i < handlers.length; i++) { - const name = handlers[i]; - handler[name] = function () { - const args = Array.prototype.slice.call(arguments, 1); - args.unshift(target); - return Reflect[name].apply(Reflect, args); - }; - } - return handler; - }; - const handler = createHandler(originalExports); - const _initialize = () => { }; - const _start = () => 0; - handler.get = function (_target, p, receiver) { - var _a; - if (p === 'memory') { - return (_a = (typeof memory === 'function' ? memory() : memory)) !== null && _a !== void 0 ? _a : Reflect.get(originalExports, p, receiver); - } - if (p === '_initialize') { - return p in originalExports ? _initialize : undefined; - } - if (p === '_start') { - return p in originalExports ? _start : undefined; - } - return Reflect.get(originalExports, p, receiver); - }; - handler.has = function (_target, p) { - if (p === 'memory') - return true; - return Reflect.has(originalExports, p); - }; - const exportsProxy = new Proxy(Object.create(null), handler); - return new Proxy(instance, { - get(target, p, receiver) { - if (p === 'exports') { - return exportsProxy; - } - if (p === kIsProxy) { - return true; - } - return Reflect.get(target, p, receiver); - } - }); -} - -const patchedWasiInstances = new WeakMap(); -class WASIThreads { - constructor(options) { - if (!options) { - throw new TypeError('WASIThreads(): options is not provided'); - } - if (!options.wasi) { - throw new TypeError('WASIThreads(): options.wasi is not provided'); - } - patchedWasiInstances.set(this, new WeakSet()); - const wasi = options.wasi; - patchWasiInstance(this, wasi); - this.wasi = wasi; - if ('childThread' in options) { - this.childThread = Boolean(options.childThread); - } - else { - this.childThread = false; - } - this.PThread = undefined; - if ('threadManager' in options) { - if (typeof options.threadManager === 'function') { - this.PThread = options.threadManager(); - } - else { - this.PThread = options.threadManager; - } - } - else { - if (!this.childThread) { - this.PThread = new ThreadManager(options); - this.PThread.init(); - } - } - let waitThreadStart = false; - if ('waitThreadStart' in options) { - waitThreadStart = typeof options.waitThreadStart === 'number' ? options.waitThreadStart : Boolean(options.waitThreadStart); - } - const postMessage = getPostMessage(options); - if (this.childThread && typeof postMessage !== 'function') { - throw new TypeError('options.postMessage is not a function'); - } - this.postMessage = postMessage; - const wasm64 = Boolean(options.wasm64); - const threadSpawn = (startArg, errorOrTid) => { - var _a; - const EAGAIN = 6; - const isNewABI = errorOrTid !== undefined; - try { - checkSharedWasmMemory(this.wasmMemory); - } - catch (err) { - (_a = this.PThread) === null || _a === void 0 ? void 0 : _a.printErr(err.stack); - if (isNewABI) { - const struct = new Int32Array(this.wasmMemory.buffer, errorOrTid, 2); - Atomics.store(struct, 0, 1); - Atomics.store(struct, 1, EAGAIN); - Atomics.notify(struct, 1); - return 1; - } - else { - return -EAGAIN; - } - } - if (!isNewABI) { - const malloc = this.wasmInstance.exports.malloc; - errorOrTid = wasm64 ? Number(malloc(BigInt(8))) : (malloc(8) >>> 0); - if (!errorOrTid) { - return -48; - } - } - const _free = this.wasmInstance.exports.free; - const free = wasm64 ? (ptr) => { _free(BigInt(ptr)); } : _free; - const struct = new Int32Array(this.wasmMemory.buffer, errorOrTid, 2); - Atomics.store(struct, 0, 0); - Atomics.store(struct, 1, 0); - if (this.childThread) { - postMessage(createMessage('spawn-thread', { - startArg, - errorOrTid: errorOrTid - })); - Atomics.wait(struct, 1, 0); - const isError = Atomics.load(struct, 0); - const result = Atomics.load(struct, 1); - if (isNewABI) { - return isError; - } - free(errorOrTid); - return isError ? -result : result; - } - const shouldWait = waitThreadStart || (waitThreadStart === 0); - let sab; - if (shouldWait) { - sab = new Int32Array(new SharedArrayBuffer(16 + 8192)); - Atomics.store(sab, 0, 0); - } - let worker; - let tid; - const PThread = this.PThread; - try { - worker = PThread.getNewWorker(sab); - if (!worker) { - throw new Error('failed to get new worker'); - } - tid = PThread.markId(worker); - if (ENVIRONMENT_IS_NODE) { - worker.unref(); - } - worker.postMessage(createMessage('start', { - tid, - arg: startArg, - sab - })); - if (shouldWait) { - if (typeof waitThreadStart === 'number') { - const waitResult = Atomics.wait(sab, 0, 0, waitThreadStart); - if (waitResult === 'timed-out') { - throw new Error('Spawning thread timed out. Please check if the worker is created successfully and if message is handled properly in the worker.'); - } - } - else { - Atomics.wait(sab, 0, 0); - } - const r = Atomics.load(sab, 0); - if (r > 1) { - throw deserizeErrorFromBuffer(sab.buffer); - } - } - } - catch (e) { - if (worker !== undefined && tid !== undefined) { - try { - PThread.cleanThread(worker, tid, true); - } - catch (_) { } - } - Atomics.store(struct, 0, 1); - Atomics.store(struct, 1, EAGAIN); - Atomics.notify(struct, 1); - PThread === null || PThread === void 0 ? void 0 : PThread.printErr(e.stack); - if (isNewABI) { - return 1; - } - free(errorOrTid); - return -EAGAIN; - } - Atomics.store(struct, 0, 0); - Atomics.store(struct, 1, tid); - Atomics.notify(struct, 1); - if (!shouldWait) { - worker.whenLoaded.catch((err) => { - delete worker.whenLoaded; - PThread.cleanThread(worker, tid, true); - throw err; - }); - } - if (isNewABI) { - return 0; - } - free(errorOrTid); - return tid; - }; - this.threadSpawn = threadSpawn; - if (this.PThread) { - this.PThread.threadSpawn = threadSpawn; - } - } - getImportObject() { - return { - wasi: { - 'thread-spawn': this.threadSpawn - } - }; - } - setup(wasmInstance, wasmModule, wasmMemory) { - wasmMemory !== null && wasmMemory !== void 0 ? wasmMemory : (wasmMemory = wasmInstance.exports.memory); - this.wasmInstance = wasmInstance; - this.wasmMemory = wasmMemory; - if (this.PThread) { - this.PThread.setup(wasmModule, wasmMemory); - } - } - preloadWorkers() { - if (this.PThread) { - return this.PThread.preloadWorkers(); - } - return Promise.resolve([]); - } - initialize(instance, module, memory) { - const exports = instance.exports; - memory !== null && memory !== void 0 ? memory : (memory = exports.memory); - if (this.childThread) { - instance = createInstanceProxy(instance, memory); - } - this.setup(instance, module, memory); - const wasi = this.wasi; - if (('_start' in exports) && (typeof exports._start === 'function')) { - if (this.childThread) { - wasi.start(instance); - try { - const kStarted = getWasiSymbol(wasi, 'kStarted'); - wasi[kStarted] = false; - } - catch (_) { } - } - else { - setupInstance(wasi, instance); - } - } - else { - wasi.initialize(instance); - } - return instance; - } - start(instance, module, memory) { - const exports = instance.exports; - memory !== null && memory !== void 0 ? memory : (memory = exports.memory); - if (this.childThread) { - instance = createInstanceProxy(instance, memory); - } - this.setup(instance, module, memory); - const exitCode = this.wasi.start(instance); - return { exitCode, instance }; - } - terminateAllThreads() { - var _a; - if (!this.childThread) { - (_a = this.PThread) === null || _a === void 0 ? void 0 : _a.terminateAllThreads(); - } - else { - this.postMessage(createMessage('terminate-all-threads', {})); - } - } -} -function patchWasiInstance(wasiThreads, wasi) { - const patched = patchedWasiInstances.get(wasiThreads); - if (patched.has(wasi)) { - return; - } - const _this = wasiThreads; - const wasiImport = wasi.wasiImport; - if (wasiImport) { - const proc_exit = wasiImport.proc_exit; - wasiImport.proc_exit = function (code) { - _this.terminateAllThreads(); - return proc_exit.call(this, code); - }; - } - if (!_this.childThread) { - const start = wasi.start; - if (typeof start === 'function') { - wasi.start = function (instance) { - try { - return start.call(this, instance); - } - catch (err) { - if (isTrapError(err)) { - _this.terminateAllThreads(); - } - throw err; - } - }; - } - } - patched.add(wasi); -} -function getWasiSymbol(wasi, description) { - const symbols = Object.getOwnPropertySymbols(wasi); - const selectDescription = (description) => (s) => { - if (s.description) { - return s.description === description; - } - return s.toString() === `Symbol(${description})`; - }; - if (Array.isArray(description)) { - return description.map(d => symbols.filter(selectDescription(d))[0]); - } - return symbols.filter(selectDescription(description))[0]; -} -function setupInstance(wasi, instance) { - const [kInstance, kSetMemory] = getWasiSymbol(wasi, ['kInstance', 'kSetMemory']); - wasi[kInstance] = instance; - wasi[kSetMemory](instance.exports.memory); -} - -class ThreadMessageHandler { - constructor(options) { - const postMsg = getPostMessage(options); - if (typeof postMsg !== 'function') { - throw new TypeError('options.postMessage is not a function'); - } - this.postMessage = postMsg; - this.onLoad = options === null || options === void 0 ? void 0 : options.onLoad; - this.onError = typeof (options === null || options === void 0 ? void 0 : options.onError) === 'function' ? options.onError : (_type, err) => { throw err; }; - this.instance = undefined; - this.messagesBeforeLoad = []; - } - instantiate(data) { - if (typeof this.onLoad === 'function') { - return this.onLoad(data); - } - throw new Error('ThreadMessageHandler.prototype.instantiate is not implemented'); - } - handle(e) { - var _a; - if ((_a = e === null || e === void 0 ? void 0 : e.data) === null || _a === void 0 ? void 0 : _a.__emnapi__) { - const type = e.data.__emnapi__.type; - const payload = e.data.__emnapi__.payload; - try { - if (type === 'load') { - this._load(payload); - } - else if (type === 'start') { - this.handleAfterLoad(e, () => { - this._start(payload); - }); - } - } - catch (err) { - this.onError(err, type); - } - } - } - _load(payload) { - if (this.instance !== undefined) - return; - let source; - try { - source = this.instantiate(payload); - } - catch (err) { - this._loaded(err, null, payload); - return; - } - const then = source && 'then' in source ? source.then : undefined; - if (typeof then === 'function') { - then.call(source, (source) => { this._loaded(null, source, payload); }, (err) => { this._loaded(err, null, payload); }); - } - else { - this._loaded(null, source, payload); - } - } - _start(payload) { - const wasi_thread_start = this.instance.exports.wasi_thread_start; - if (typeof wasi_thread_start !== 'function') { - const err = new TypeError('wasi_thread_start is not exported'); - notifyPthreadCreateResult(payload.sab, 2, err); - throw err; - } - const postMessage = this.postMessage; - const tid = payload.tid; - const startArg = payload.arg; - notifyPthreadCreateResult(payload.sab, 1); - try { - wasi_thread_start(tid, startArg); - } - catch (err) { - if (err !== 'unwind') { - throw err; - } - else { - return; - } - } - postMessage(createMessage('cleanup-thread', { tid })); - } - _loaded(err, source, payload) { - if (err) { - notifyPthreadCreateResult(payload.sab, 2, err); - throw err; - } - if (source == null) { - const err = new TypeError('onLoad should return an object'); - notifyPthreadCreateResult(payload.sab, 2, err); - throw err; - } - const instance = source.instance; - if (!instance) { - const err = new TypeError('onLoad should return an object which includes "instance"'); - notifyPthreadCreateResult(payload.sab, 2, err); - throw err; - } - this.instance = instance; - const postMessage = this.postMessage; - postMessage(createMessage('loaded', {})); - const messages = this.messagesBeforeLoad; - this.messagesBeforeLoad = []; - for (let i = 0; i < messages.length; i++) { - const data = messages[i]; - this.handle({ data }); - } - } - handleAfterLoad(e, f) { - if (this.instance !== undefined) { - f.call(this, e); - } - else { - this.messagesBeforeLoad.push(e.data); - } - } -} -function notifyPthreadCreateResult(sab, result, error) { - if (sab) { - serizeErrorToBuffer(sab.buffer, result, error); - Atomics.notify(sab, 0); - } -} - -exports.ThreadManager = ThreadManager; -exports.ThreadMessageHandler = ThreadMessageHandler; -exports.WASIThreads = WASIThreads; -exports.createInstanceProxy = createInstanceProxy; -exports.isSharedArrayBuffer = isSharedArrayBuffer; -exports.isTrapError = isTrapError; diff --git a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.d.ts b/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.d.ts deleted file mode 100644 index 1d3951c36..000000000 --- a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.d.ts +++ /dev/null @@ -1,271 +0,0 @@ -/// - -import type { Worker as Worker_2 } from 'worker_threads'; - -/** @public */ -export declare interface BaseOptions { - wasi: WASIInstance; - version?: 'preview1'; - wasm64?: boolean; -} - -/** @public */ -export declare interface ChildThreadOptions extends BaseOptions { - childThread: true; - postMessage?: (data: any) => void; -} - -/** @public */ -export declare interface CleanupThreadPayload { - tid: number; -} - -/** @public */ -export declare interface CommandInfo { - type: T; - payload: CommandPayloadMap[T]; -} - -/** @public */ -export declare interface CommandPayloadMap { - load: LoadPayload; - loaded: LoadedPayload; - start: StartPayload; - 'cleanup-thread': CleanupThreadPayload; - 'terminate-all-threads': TerminateAllThreadsPayload; - 'spawn-thread': SpawnThreadPayload; -} - -/** @public */ -export declare type CommandType = keyof CommandPayloadMap; - -/** @public */ -export declare function createInstanceProxy(instance: WebAssembly.Instance, memory?: WebAssembly.Memory | (() => WebAssembly.Memory)): WebAssembly.Instance; - -/** @public */ -export declare function isSharedArrayBuffer(value: any): value is SharedArrayBuffer; - -/** @public */ -export declare function isTrapError(e: Error): e is WebAssembly.RuntimeError; - -/** @public */ -export declare interface LoadedPayload { -} - -/** @public */ -export declare interface LoadPayload { - wasmModule: WebAssembly.Module; - wasmMemory: WebAssembly.Memory; - sab?: Int32Array; -} - -/** @public */ -export declare interface MainThreadBaseOptions extends BaseOptions { - waitThreadStart?: boolean | number; -} - -/** @public */ -export declare type MainThreadOptions = MainThreadOptionsWithThreadManager | MainThreadOptionsCreateThreadManager; - -/** @public */ -export declare interface MainThreadOptionsCreateThreadManager extends MainThreadBaseOptions, ThreadManagerOptionsMain { -} - -/** @public */ -export declare interface MainThreadOptionsWithThreadManager extends MainThreadBaseOptions { - threadManager?: ThreadManager | (() => ThreadManager); -} - -/** @public */ -export declare interface MessageEventData { - __emnapi__: CommandInfo; -} - -/** @public */ -export declare interface ReuseWorkerOptions { - /** - * @see {@link https://emscripten.org/docs/tools_reference/settings_reference.html#pthread-pool-size | PTHREAD_POOL_SIZE} - */ - size: number; - /** - * @see {@link https://emscripten.org/docs/tools_reference/settings_reference.html#pthread-pool-size-strict | PTHREAD_POOL_SIZE_STRICT} - */ - strict?: boolean; -} - -/** @public */ -export declare interface SpawnThreadPayload { - startArg: number; - errorOrTid: number; -} - -/** @public */ -export declare interface StartPayload { - tid: number; - arg: number; - sab?: Int32Array; -} - -/** @public */ -export declare interface StartResult { - exitCode: number; - instance: WebAssembly.Instance; -} - -/** @public */ -export declare interface TerminateAllThreadsPayload { -} - -/** @public */ -export declare class ThreadManager { - unusedWorkers: WorkerLike[]; - pthreads: Record; - get nextWorkerID(): number; - wasmModule: WebAssembly.Module | null; - wasmMemory: WebAssembly.Memory | null; - private readonly messageEvents; - private readonly _childThread; - private readonly _onCreateWorker; - private readonly _reuseWorker; - private readonly _beforeLoad?; - /* Excluded from this release type: printErr */ - threadSpawn?: ((startArg: number, errorOrTid?: number) => number); - constructor(options: ThreadManagerOptions); - init(): void; - initMainThread(): void; - private preparePool; - shouldPreloadWorkers(): boolean; - loadWasmModuleToAllWorkers(): Promise; - preloadWorkers(): Promise; - setup(wasmModule: WebAssembly.Module, wasmMemory: WebAssembly.Memory): void; - markId(worker: WorkerLike): number; - returnWorkerToPool(worker: WorkerLike): void; - loadWasmModuleToWorker(worker: WorkerLike, sab?: Int32Array): Promise; - allocateUnusedWorker(): WorkerLike; - getNewWorker(sab?: Int32Array): WorkerLike | undefined; - cleanThread(worker: WorkerLike, tid: number, force?: boolean): void; - terminateWorker(worker: WorkerLike): void; - terminateAllThreads(): void; - addMessageEventListener(worker: WorkerLike, onMessage: (e: WorkerMessageEvent) => void): () => void; - fireMessageEvent(worker: WorkerLike, e: WorkerMessageEvent): void; -} - -/** @public */ -export declare type ThreadManagerOptions = ThreadManagerOptionsMain | ThreadManagerOptionsChild; - -/** @public */ -export declare interface ThreadManagerOptionsBase { - printErr?: (message: string) => void; - threadSpawn?: (startArg: number, errorOrTid?: number) => number; -} - -/** @public */ -export declare interface ThreadManagerOptionsChild extends ThreadManagerOptionsBase { - childThread: true; -} - -/** @public */ -export declare interface ThreadManagerOptionsMain extends ThreadManagerOptionsBase { - beforeLoad?: (worker: WorkerLike) => any; - reuseWorker?: boolean | number | ReuseWorkerOptions; - onCreateWorker: WorkerFactory; - childThread?: false; -} - -/** @public */ -export declare class ThreadMessageHandler { - protected instance: WebAssembly.Instance | undefined; - private messagesBeforeLoad; - protected postMessage: (message: any) => void; - protected onLoad?: (data: LoadPayload) => WebAssembly.WebAssemblyInstantiatedSource | PromiseLike; - protected onError: (error: Error, type: WorkerMessageType) => void; - constructor(options?: ThreadMessageHandlerOptions); - /** @virtual */ - instantiate(data: LoadPayload): WebAssembly.WebAssemblyInstantiatedSource | PromiseLike; - /** @virtual */ - handle(e: WorkerMessageEvent>): void; - private _load; - private _start; - protected _loaded(err: Error | null, source: WebAssembly.WebAssemblyInstantiatedSource | null, payload: LoadPayload): void; - protected handleAfterLoad(e: E, f: (e: E) => void): void; -} - -/** @public */ -export declare interface ThreadMessageHandlerOptions { - onLoad?: (data: LoadPayload) => WebAssembly.WebAssemblyInstantiatedSource | PromiseLike; - onError?: (error: Error, type: WorkerMessageType) => void; - postMessage?: (message: any) => void; -} - -/** @public */ -export declare interface WASIInstance { - readonly wasiImport?: Record; - initialize(instance: object): void; - start(instance: object): number; - getImportObject?(): any; -} - -/** @public */ -export declare class WASIThreads { - PThread: ThreadManager | undefined; - private wasmMemory; - private wasmInstance; - private readonly threadSpawn; - readonly childThread: boolean; - private readonly postMessage; - readonly wasi: WASIInstance; - constructor(options: WASIThreadsOptions); - getImportObject(): { - wasi: WASIThreadsImports; - }; - setup(wasmInstance: WebAssembly.Instance, wasmModule: WebAssembly.Module, wasmMemory?: WebAssembly.Memory): void; - preloadWorkers(): Promise; - /** - * It's ok to call this method to a WASI command module. - * - * in child thread, must call this method instead of {@link WASIThreads.start} even if it's a WASI command module - * - * @returns A proxied WebAssembly instance if in child thread, other wise the original instance - */ - initialize(instance: WebAssembly.Instance, module: WebAssembly.Module, memory?: WebAssembly.Memory): WebAssembly.Instance; - /** - * Equivalent to calling {@link WASIThreads.initialize} and then calling {@link WASIInstance.start} - * ```js - * this.initialize(instance, module, memory) - * this.wasi.start(instance) - * ``` - */ - start(instance: WebAssembly.Instance, module: WebAssembly.Module, memory?: WebAssembly.Memory): StartResult; - terminateAllThreads(): void; -} - -/** @public */ -export declare interface WASIThreadsImports { - 'thread-spawn': (startArg: number, errorOrTid?: number) => number; -} - -/** @public */ -export declare type WASIThreadsOptions = MainThreadOptions | ChildThreadOptions; - -/** @public */ -export declare type WorkerFactory = (ctx: { - type: string; - name: string; -}) => WorkerLike; - -/** @public */ -export declare type WorkerLike = (Worker | Worker_2) & { - whenLoaded?: Promise; - loaded?: boolean; - __emnapi_tid?: number; -}; - -/** @public */ -export declare interface WorkerMessageEvent { - data: T; -} - -/** @public */ -export declare type WorkerMessageType = 'load' | 'start'; - -export { } diff --git a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.js b/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.js deleted file mode 100644 index e7a7901d0..000000000 --- a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.js +++ /dev/null @@ -1 +0,0 @@ -const e="undefined"!=typeof WebAssembly?WebAssembly:"undefined"!=typeof WXWebAssembly?WXWebAssembly:void 0,t="object"==typeof process&&null!==process&&"object"==typeof process.versions&&null!==process.versions&&"string"==typeof process.versions.node;function r(e){return"function"==typeof(null==e?void 0:e.postMessage)?e.postMessage:"function"==typeof postMessage?postMessage:void 0}function s(e){return"function"==typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||"[object SharedArrayBuffer]"===Object.prototype.toString.call(e)}function o(t){try{return t instanceof e.RuntimeError}catch(e){return!1}}function n(e,t){return{__emnapi__:{type:e,payload:t}}}function i(e){if(e){if(!s(e.buffer))throw new Error("Multithread features require shared wasm memory. Try to compile with `-matomics -mbulk-memory` and use `--import-memory --shared-memory` during linking, then create WebAssembly.Memory with `shared: true` option")}else if("undefined"==typeof SharedArrayBuffer)throw new Error("Current environment does not support SharedArrayBuffer, threads are not available!")}let a=0;class d{get nextWorkerID(){return a}constructor(e){var t;if(this.unusedWorkers=[],this.pthreads=Object.create(null),this.wasmModule=null,this.wasmMemory=null,this.messageEvents=new WeakMap,!e)throw new TypeError("ThreadManager(): options is not provided");this._childThread="childThread"in e&&Boolean(e.childThread),this._childThread?(this._onCreateWorker=void 0,this._reuseWorker=!1,this._beforeLoad=void 0):(this._onCreateWorker=e.onCreateWorker,this._reuseWorker=function(e){var t;if("boolean"==typeof e)return!!e&&{size:0,strict:!1};if("number"==typeof e){if(!(e>=0))throw new RangeError("reuseWorker: size must be a non-negative integer");return{size:e,strict:!1}}if(!e)return!1;const r=null!==(t=Number(e.size))&&void 0!==t?t:0,s=Boolean(e.strict);if(!(r>0)&&s)throw new RangeError("reuseWorker: size must be set to positive integer if strict is set to true");return{size:r,strict:s}}(e.reuseWorker),this._beforeLoad=e.beforeLoad),this.printErr=null!==(t=e.printErr)&&void 0!==t?t:console.error.bind(console),this.threadSpawn=e.threadSpawn}init(){this._childThread||this.initMainThread()}initMainThread(){this.preparePool()}preparePool(){if(this._reuseWorker&&this._reuseWorker.size){let e=this._reuseWorker.size;for(;e--;){const e=this.allocateUnusedWorker();t&&(e.once("message",()=>{}),e.unref())}}}shouldPreloadWorkers(){return!this._childThread&&this._reuseWorker&&this._reuseWorker.size>0}loadWasmModuleToAllWorkers(){const e=Array(this.unusedWorkers.length);for(let r=0;r(t&&s.unref(),e),e=>{throw t&&s.unref(),e})}return Promise.all(e).catch(e=>{throw this.terminateAllThreads(),e})}preloadWorkers(){return this.shouldPreloadWorkers()?this.loadWasmModuleToAllWorkers():Promise.resolve([])}setup(e,t){this.wasmModule=e,this.wasmMemory=t}markId(e){if(e.__emnapi_tid)return e.__emnapi_tid;const t=a+43;return a=(a+1)%536870869,this.pthreads[t]=e,e.__emnapi_tid=t,t}returnWorkerToPool(e){var r=e.__emnapi_tid;void 0!==r&&delete this.pthreads[r],this.unusedWorkers.push(e),delete e.__emnapi_tid,t&&e.unref()}loadWasmModuleToWorker(e,r){if(e.whenLoaded)return e.whenLoaded;const s=this.printErr,o=this._beforeLoad,a=this;return e.whenLoaded=new Promise((d,h)=>{const l=r=>{if(r.__emnapi__){const s=r.__emnapi__.type,o=r.__emnapi__.payload;"loaded"===s?(e.loaded=!0,t&&!e.__emnapi_tid&&e.unref(),d(e)):"cleanup-thread"===s?o.tid in this.pthreads&&this.cleanThread(e,o.tid):"spawn-thread"===s?this.threadSpawn(o.startArg,o.errorOrTid):"terminate-all-threads"===s&&this.terminateAllThreads()}};e.onmessage=t=>{l(t.data),this.fireMessageEvent(e,t)},e.onerror=function(t){let r="worker sent an error!";if(void 0!==e.__emnapi_tid&&(r="worker (tid = "+e.__emnapi_tid+") sent an error!"),"message"in t){if(s(r+" "+t.message),-1!==t.message.indexOf("RuntimeError")||-1!==t.message.indexOf("unreachable"))try{a.terminateAllThreads()}catch(e){}}else s(r);throw h(t),t},t&&(e.on("message",function(t){var r,s;null===(s=(r=e).onmessage)||void 0===s||s.call(r,{data:t})}),e.on("error",function(t){var r,s;null===(s=(r=e).onerror)||void 0===s||s.call(r,t)}),e.on("detachedExit",function(){})),"function"==typeof o&&o(e);try{e.postMessage(n("load",{wasmModule:this.wasmModule,wasmMemory:this.wasmMemory,sab:r}))}catch(e){throw i(this.wasmMemory),e}}),e.whenLoaded}allocateUnusedWorker(){const e=this._onCreateWorker;if("function"!=typeof e)throw new TypeError("`options.onCreateWorker` is not provided");const t=e({type:"thread",name:"emnapi-pthread"});return this.unusedWorkers.push(t),t}getNewWorker(e){if(this._reuseWorker){if(0===this.unusedWorkers.length){if(this._reuseWorker.strict&&!t){return void(0,this.printErr)("Tried to spawn a new thread, but the thread pool is exhausted.\nThis might result in a deadlock unless some threads eventually exit or the code explicitly breaks out to the event loop.")}const r=this.allocateUnusedWorker();this.loadWasmModuleToWorker(r,e)}return this.unusedWorkers.pop()}const r=this.allocateUnusedWorker();return this.loadWasmModuleToWorker(r,e),this.unusedWorkers.pop()}cleanThread(e,t,r){!r&&this._reuseWorker?this.returnWorkerToPool(e):(delete this.pthreads[t],this.terminateWorker(e),delete e.__emnapi_tid)}terminateWorker(e){var t;const r=e.__emnapi_tid;e.terminate(),null===(t=this.messageEvents.get(e))||void 0===t||t.clear(),this.messageEvents.delete(e),e.onmessage=e=>{if(e.data.__emnapi__){(0,this.printErr)('received "'+e.data.__emnapi__.type+'" command from terminated worker: '+r)}}}terminateAllThreads(){const e=Object.values(this.pthreads);for(let t=0;t{null==r||r.delete(t)}}fireMessageEvent(e,t){const r=this.messageEvents.get(e);if(!r)return;const s=this.printErr;r.forEach(e=>{try{e(t)}catch(e){s(e.stack)}})}}const h=Symbol("kIsProxy");function l(e,t){if(e[h])return e;const r=e.exports,s=function(e){const t=["apply","construct","defineProperty","deleteProperty","get","getOwnPropertyDescriptor","getPrototypeOf","has","isExtensible","ownKeys","preventExtensions","set","setPrototypeOf"],r={};for(let s=0;s{},n=()=>0;s.get=function(e,s,i){var a;return"memory"===s?null!==(a="function"==typeof t?t():t)&&void 0!==a?a:Reflect.get(r,s,i):"_initialize"===s?s in r?o:void 0:"_start"===s?s in r?n:void 0:Reflect.get(r,s,i)},s.has=function(e,t){return"memory"===t||Reflect.has(r,t)};const i=new Proxy(Object.create(null),s);return new Proxy(e,{get:(e,t,r)=>"exports"===t?i:t===h||Reflect.get(e,t,r)})}const c=new WeakMap;function u(e,t){const r=Object.getOwnPropertySymbols(e),s=e=>t=>t.description?t.description===e:t.toString()===`Symbol(${e})`;return Array.isArray(t)?t.map(e=>r.filter(s(e))[0]):r.filter(s(t))[0]}function f(e,t,r){e&&(!function(e,t,r){const s=new Int32Array(e);if(Atomics.store(s,0,t),t>1&&r){const t=r.name,o=r.message,n=r.stack,i=(new TextEncoder).encode(t),a=(new TextEncoder).encode(o),d=(new TextEncoder).encode(n);Atomics.store(s,1,i.length),Atomics.store(s,2,a.length),Atomics.store(s,3,d.length);const h=new Uint8Array(e);h.set(i,16),h.set(a,16+i.length),h.set(d,16+i.length+a.length)}}(e.buffer,t,r),Atomics.notify(e,0))}exports.ThreadManager=d,exports.ThreadMessageHandler=class{constructor(e){const t=r(e);if("function"!=typeof t)throw new TypeError("options.postMessage is not a function");this.postMessage=t,this.onLoad=null==e?void 0:e.onLoad,this.onError="function"==typeof(null==e?void 0:e.onError)?e.onError:(e,t)=>{throw t},this.instance=void 0,this.messagesBeforeLoad=[]}instantiate(e){if("function"==typeof this.onLoad)return this.onLoad(e);throw new Error("ThreadMessageHandler.prototype.instantiate is not implemented")}handle(e){var t;if(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.__emnapi__){const t=e.data.__emnapi__.type,r=e.data.__emnapi__.payload;try{"load"===t?this._load(r):"start"===t&&this.handleAfterLoad(e,()=>{this._start(r)})}catch(e){this.onError(e,t)}}}_load(e){if(void 0!==this.instance)return;let t;try{t=this.instantiate(e)}catch(t){return void this._loaded(t,null,e)}const r=t&&"then"in t?t.then:void 0;"function"==typeof r?r.call(t,t=>{this._loaded(null,t,e)},t=>{this._loaded(t,null,e)}):this._loaded(null,t,e)}_start(e){const t=this.instance.exports.wasi_thread_start;if("function"!=typeof t){const t=new TypeError("wasi_thread_start is not exported");throw f(e.sab,2,t),t}const r=this.postMessage,s=e.tid,o=e.arg;f(e.sab,1);try{t(s,o)}catch(e){if("unwind"!==e)throw e;return}r(n("cleanup-thread",{tid:s}))}_loaded(e,t,r){if(e)throw f(r.sab,2,e),e;if(null==t){const e=new TypeError("onLoad should return an object");throw f(r.sab,2,e),e}const s=t.instance;if(!s){const e=new TypeError('onLoad should return an object which includes "instance"');throw f(r.sab,2,e),e}this.instance=s;(0,this.postMessage)(n("loaded",{}));const o=this.messagesBeforeLoad;this.messagesBeforeLoad=[];for(let e=0;e{var o;const a=void 0!==s;try{i(this.wasmMemory)}catch(e){if(null===(o=this.PThread)||void 0===o||o.printErr(e.stack),a){const e=new Int32Array(this.wasmMemory.buffer,s,2);return Atomics.store(e,0,1),Atomics.store(e,1,6),Atomics.notify(e,1),1}return-6}if(!a){const e=this.wasmInstance.exports.malloc;if(!(s=u?Number(e(BigInt(8))):e(8)>>>0))return-48}const d=this.wasmInstance.exports.free,c=u?e=>{d(BigInt(e))}:d,f=new Int32Array(this.wasmMemory.buffer,s,2);if(Atomics.store(f,0,0),Atomics.store(f,1,0),this.childThread){l(n("spawn-thread",{startArg:r,errorOrTid:s})),Atomics.wait(f,1,0);const e=Atomics.load(f,0),t=Atomics.load(f,1);return a?e:(c(s),e?-t:t)}const p=h||0===h;let m,w,y;p&&(m=new Int32Array(new SharedArrayBuffer(8208)),Atomics.store(m,0,0));const _=this.PThread;try{if(w=_.getNewWorker(m),!w)throw new Error("failed to get new worker");if(y=_.markId(w),t&&w.unref(),w.postMessage(n("start",{tid:y,arg:r,sab:m})),p){if("number"==typeof h){if("timed-out"===Atomics.wait(m,0,0,h))throw new Error("Spawning thread timed out. Please check if the worker is created successfully and if message is handled properly in the worker.")}else Atomics.wait(m,0,0);if(Atomics.load(m,0)>1)throw function(t){var r,s;const o=new Int32Array(t);if(Atomics.load(o,0)<=1)return null;const n=Atomics.load(o,1),i=Atomics.load(o,2),a=Atomics.load(o,3),d=new Uint8Array(t),h=d.slice(16,16+n),l=d.slice(16+n,16+n+i),c=d.slice(16+n+i,16+n+i+a),u=(new TextDecoder).decode(h),f=(new TextDecoder).decode(l),p=(new TextDecoder).decode(c),m=new(null!==(r=globalThis[u])&&void 0!==r?r:"RuntimeError"===u&&null!==(s=e.RuntimeError)&&void 0!==s?s:Error)(f);return Object.defineProperty(m,"stack",{value:p,writable:!0,enumerable:!1,configurable:!0}),m}(m.buffer)}}catch(e){if(void 0!==w&&void 0!==y)try{_.cleanThread(w,y,!0)}catch(e){}return Atomics.store(f,0,1),Atomics.store(f,1,6),Atomics.notify(f,1),null==_||_.printErr(e.stack),a?1:(c(s),-6)}return Atomics.store(f,0,0),Atomics.store(f,1,y),Atomics.notify(f,1),p||w.whenLoaded.catch(e=>{throw delete w.whenLoaded,_.cleanThread(w,y,!0),e}),a?0:(c(s),y)};this.threadSpawn=f,this.PThread&&(this.PThread.threadSpawn=f)}getImportObject(){return{wasi:{"thread-spawn":this.threadSpawn}}}setup(e,t,r){null!=r||(r=e.exports.memory),this.wasmInstance=e,this.wasmMemory=r,this.PThread&&this.PThread.setup(t,r)}preloadWorkers(){return this.PThread?this.PThread.preloadWorkers():Promise.resolve([])}initialize(e,t,r){const s=e.exports;null!=r||(r=s.memory),this.childThread&&(e=l(e,r)),this.setup(e,t,r);const o=this.wasi;if("_start"in s&&"function"==typeof s._start)if(this.childThread){o.start(e);try{o[u(o,"kStarted")]=!1}catch(e){}}else!function(e,t){const[r,s]=u(e,["kInstance","kSetMemory"]);e[r]=t,e[s](t.exports.memory)}(o,e);else o.initialize(e);return e}start(e,t,r){const s=e.exports;null!=r||(r=s.memory),this.childThread&&(e=l(e,r)),this.setup(e,t,r);return{exitCode:this.wasi.start(e),instance:e}}terminateAllThreads(){var e;this.childThread?this.postMessage(n("terminate-all-threads",{})):null===(e=this.PThread)||void 0===e||e.terminateAllThreads()}},exports.createInstanceProxy=l,exports.isSharedArrayBuffer=s,exports.isTrapError=o; diff --git a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.mts b/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.mts deleted file mode 100644 index 1d3951c36..000000000 --- a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.mts +++ /dev/null @@ -1,271 +0,0 @@ -/// - -import type { Worker as Worker_2 } from 'worker_threads'; - -/** @public */ -export declare interface BaseOptions { - wasi: WASIInstance; - version?: 'preview1'; - wasm64?: boolean; -} - -/** @public */ -export declare interface ChildThreadOptions extends BaseOptions { - childThread: true; - postMessage?: (data: any) => void; -} - -/** @public */ -export declare interface CleanupThreadPayload { - tid: number; -} - -/** @public */ -export declare interface CommandInfo { - type: T; - payload: CommandPayloadMap[T]; -} - -/** @public */ -export declare interface CommandPayloadMap { - load: LoadPayload; - loaded: LoadedPayload; - start: StartPayload; - 'cleanup-thread': CleanupThreadPayload; - 'terminate-all-threads': TerminateAllThreadsPayload; - 'spawn-thread': SpawnThreadPayload; -} - -/** @public */ -export declare type CommandType = keyof CommandPayloadMap; - -/** @public */ -export declare function createInstanceProxy(instance: WebAssembly.Instance, memory?: WebAssembly.Memory | (() => WebAssembly.Memory)): WebAssembly.Instance; - -/** @public */ -export declare function isSharedArrayBuffer(value: any): value is SharedArrayBuffer; - -/** @public */ -export declare function isTrapError(e: Error): e is WebAssembly.RuntimeError; - -/** @public */ -export declare interface LoadedPayload { -} - -/** @public */ -export declare interface LoadPayload { - wasmModule: WebAssembly.Module; - wasmMemory: WebAssembly.Memory; - sab?: Int32Array; -} - -/** @public */ -export declare interface MainThreadBaseOptions extends BaseOptions { - waitThreadStart?: boolean | number; -} - -/** @public */ -export declare type MainThreadOptions = MainThreadOptionsWithThreadManager | MainThreadOptionsCreateThreadManager; - -/** @public */ -export declare interface MainThreadOptionsCreateThreadManager extends MainThreadBaseOptions, ThreadManagerOptionsMain { -} - -/** @public */ -export declare interface MainThreadOptionsWithThreadManager extends MainThreadBaseOptions { - threadManager?: ThreadManager | (() => ThreadManager); -} - -/** @public */ -export declare interface MessageEventData { - __emnapi__: CommandInfo; -} - -/** @public */ -export declare interface ReuseWorkerOptions { - /** - * @see {@link https://emscripten.org/docs/tools_reference/settings_reference.html#pthread-pool-size | PTHREAD_POOL_SIZE} - */ - size: number; - /** - * @see {@link https://emscripten.org/docs/tools_reference/settings_reference.html#pthread-pool-size-strict | PTHREAD_POOL_SIZE_STRICT} - */ - strict?: boolean; -} - -/** @public */ -export declare interface SpawnThreadPayload { - startArg: number; - errorOrTid: number; -} - -/** @public */ -export declare interface StartPayload { - tid: number; - arg: number; - sab?: Int32Array; -} - -/** @public */ -export declare interface StartResult { - exitCode: number; - instance: WebAssembly.Instance; -} - -/** @public */ -export declare interface TerminateAllThreadsPayload { -} - -/** @public */ -export declare class ThreadManager { - unusedWorkers: WorkerLike[]; - pthreads: Record; - get nextWorkerID(): number; - wasmModule: WebAssembly.Module | null; - wasmMemory: WebAssembly.Memory | null; - private readonly messageEvents; - private readonly _childThread; - private readonly _onCreateWorker; - private readonly _reuseWorker; - private readonly _beforeLoad?; - /* Excluded from this release type: printErr */ - threadSpawn?: ((startArg: number, errorOrTid?: number) => number); - constructor(options: ThreadManagerOptions); - init(): void; - initMainThread(): void; - private preparePool; - shouldPreloadWorkers(): boolean; - loadWasmModuleToAllWorkers(): Promise; - preloadWorkers(): Promise; - setup(wasmModule: WebAssembly.Module, wasmMemory: WebAssembly.Memory): void; - markId(worker: WorkerLike): number; - returnWorkerToPool(worker: WorkerLike): void; - loadWasmModuleToWorker(worker: WorkerLike, sab?: Int32Array): Promise; - allocateUnusedWorker(): WorkerLike; - getNewWorker(sab?: Int32Array): WorkerLike | undefined; - cleanThread(worker: WorkerLike, tid: number, force?: boolean): void; - terminateWorker(worker: WorkerLike): void; - terminateAllThreads(): void; - addMessageEventListener(worker: WorkerLike, onMessage: (e: WorkerMessageEvent) => void): () => void; - fireMessageEvent(worker: WorkerLike, e: WorkerMessageEvent): void; -} - -/** @public */ -export declare type ThreadManagerOptions = ThreadManagerOptionsMain | ThreadManagerOptionsChild; - -/** @public */ -export declare interface ThreadManagerOptionsBase { - printErr?: (message: string) => void; - threadSpawn?: (startArg: number, errorOrTid?: number) => number; -} - -/** @public */ -export declare interface ThreadManagerOptionsChild extends ThreadManagerOptionsBase { - childThread: true; -} - -/** @public */ -export declare interface ThreadManagerOptionsMain extends ThreadManagerOptionsBase { - beforeLoad?: (worker: WorkerLike) => any; - reuseWorker?: boolean | number | ReuseWorkerOptions; - onCreateWorker: WorkerFactory; - childThread?: false; -} - -/** @public */ -export declare class ThreadMessageHandler { - protected instance: WebAssembly.Instance | undefined; - private messagesBeforeLoad; - protected postMessage: (message: any) => void; - protected onLoad?: (data: LoadPayload) => WebAssembly.WebAssemblyInstantiatedSource | PromiseLike; - protected onError: (error: Error, type: WorkerMessageType) => void; - constructor(options?: ThreadMessageHandlerOptions); - /** @virtual */ - instantiate(data: LoadPayload): WebAssembly.WebAssemblyInstantiatedSource | PromiseLike; - /** @virtual */ - handle(e: WorkerMessageEvent>): void; - private _load; - private _start; - protected _loaded(err: Error | null, source: WebAssembly.WebAssemblyInstantiatedSource | null, payload: LoadPayload): void; - protected handleAfterLoad(e: E, f: (e: E) => void): void; -} - -/** @public */ -export declare interface ThreadMessageHandlerOptions { - onLoad?: (data: LoadPayload) => WebAssembly.WebAssemblyInstantiatedSource | PromiseLike; - onError?: (error: Error, type: WorkerMessageType) => void; - postMessage?: (message: any) => void; -} - -/** @public */ -export declare interface WASIInstance { - readonly wasiImport?: Record; - initialize(instance: object): void; - start(instance: object): number; - getImportObject?(): any; -} - -/** @public */ -export declare class WASIThreads { - PThread: ThreadManager | undefined; - private wasmMemory; - private wasmInstance; - private readonly threadSpawn; - readonly childThread: boolean; - private readonly postMessage; - readonly wasi: WASIInstance; - constructor(options: WASIThreadsOptions); - getImportObject(): { - wasi: WASIThreadsImports; - }; - setup(wasmInstance: WebAssembly.Instance, wasmModule: WebAssembly.Module, wasmMemory?: WebAssembly.Memory): void; - preloadWorkers(): Promise; - /** - * It's ok to call this method to a WASI command module. - * - * in child thread, must call this method instead of {@link WASIThreads.start} even if it's a WASI command module - * - * @returns A proxied WebAssembly instance if in child thread, other wise the original instance - */ - initialize(instance: WebAssembly.Instance, module: WebAssembly.Module, memory?: WebAssembly.Memory): WebAssembly.Instance; - /** - * Equivalent to calling {@link WASIThreads.initialize} and then calling {@link WASIInstance.start} - * ```js - * this.initialize(instance, module, memory) - * this.wasi.start(instance) - * ``` - */ - start(instance: WebAssembly.Instance, module: WebAssembly.Module, memory?: WebAssembly.Memory): StartResult; - terminateAllThreads(): void; -} - -/** @public */ -export declare interface WASIThreadsImports { - 'thread-spawn': (startArg: number, errorOrTid?: number) => number; -} - -/** @public */ -export declare type WASIThreadsOptions = MainThreadOptions | ChildThreadOptions; - -/** @public */ -export declare type WorkerFactory = (ctx: { - type: string; - name: string; -}) => WorkerLike; - -/** @public */ -export declare type WorkerLike = (Worker | Worker_2) & { - whenLoaded?: Promise; - loaded?: boolean; - __emnapi_tid?: number; -}; - -/** @public */ -export declare interface WorkerMessageEvent { - data: T; -} - -/** @public */ -export declare type WorkerMessageType = 'load' | 'start'; - -export { } diff --git a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts b/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts deleted file mode 100644 index 23b1fe32d..000000000 --- a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +++ /dev/null @@ -1,273 +0,0 @@ -/// - -import type { Worker as Worker_2 } from 'worker_threads'; - -/** @public */ -export declare interface BaseOptions { - wasi: WASIInstance; - version?: 'preview1'; - wasm64?: boolean; -} - -/** @public */ -export declare interface ChildThreadOptions extends BaseOptions { - childThread: true; - postMessage?: (data: any) => void; -} - -/** @public */ -export declare interface CleanupThreadPayload { - tid: number; -} - -/** @public */ -export declare interface CommandInfo { - type: T; - payload: CommandPayloadMap[T]; -} - -/** @public */ -export declare interface CommandPayloadMap { - load: LoadPayload; - loaded: LoadedPayload; - start: StartPayload; - 'cleanup-thread': CleanupThreadPayload; - 'terminate-all-threads': TerminateAllThreadsPayload; - 'spawn-thread': SpawnThreadPayload; -} - -/** @public */ -export declare type CommandType = keyof CommandPayloadMap; - -/** @public */ -export declare function createInstanceProxy(instance: WebAssembly.Instance, memory?: WebAssembly.Memory | (() => WebAssembly.Memory)): WebAssembly.Instance; - -/** @public */ -export declare function isSharedArrayBuffer(value: any): value is SharedArrayBuffer; - -/** @public */ -export declare function isTrapError(e: Error): e is WebAssembly.RuntimeError; - -/** @public */ -export declare interface LoadedPayload { -} - -/** @public */ -export declare interface LoadPayload { - wasmModule: WebAssembly.Module; - wasmMemory: WebAssembly.Memory; - sab?: Int32Array; -} - -/** @public */ -export declare interface MainThreadBaseOptions extends BaseOptions { - waitThreadStart?: boolean | number; -} - -/** @public */ -export declare type MainThreadOptions = MainThreadOptionsWithThreadManager | MainThreadOptionsCreateThreadManager; - -/** @public */ -export declare interface MainThreadOptionsCreateThreadManager extends MainThreadBaseOptions, ThreadManagerOptionsMain { -} - -/** @public */ -export declare interface MainThreadOptionsWithThreadManager extends MainThreadBaseOptions { - threadManager?: ThreadManager | (() => ThreadManager); -} - -/** @public */ -export declare interface MessageEventData { - __emnapi__: CommandInfo; -} - -/** @public */ -export declare interface ReuseWorkerOptions { - /** - * @see {@link https://emscripten.org/docs/tools_reference/settings_reference.html#pthread-pool-size | PTHREAD_POOL_SIZE} - */ - size: number; - /** - * @see {@link https://emscripten.org/docs/tools_reference/settings_reference.html#pthread-pool-size-strict | PTHREAD_POOL_SIZE_STRICT} - */ - strict?: boolean; -} - -/** @public */ -export declare interface SpawnThreadPayload { - startArg: number; - errorOrTid: number; -} - -/** @public */ -export declare interface StartPayload { - tid: number; - arg: number; - sab?: Int32Array; -} - -/** @public */ -export declare interface StartResult { - exitCode: number; - instance: WebAssembly.Instance; -} - -/** @public */ -export declare interface TerminateAllThreadsPayload { -} - -/** @public */ -export declare class ThreadManager { - unusedWorkers: WorkerLike[]; - pthreads: Record; - get nextWorkerID(): number; - wasmModule: WebAssembly.Module | null; - wasmMemory: WebAssembly.Memory | null; - private readonly messageEvents; - private readonly _childThread; - private readonly _onCreateWorker; - private readonly _reuseWorker; - private readonly _beforeLoad?; - /* Excluded from this release type: printErr */ - threadSpawn?: ((startArg: number, errorOrTid?: number) => number); - constructor(options: ThreadManagerOptions); - init(): void; - initMainThread(): void; - private preparePool; - shouldPreloadWorkers(): boolean; - loadWasmModuleToAllWorkers(): Promise; - preloadWorkers(): Promise; - setup(wasmModule: WebAssembly.Module, wasmMemory: WebAssembly.Memory): void; - markId(worker: WorkerLike): number; - returnWorkerToPool(worker: WorkerLike): void; - loadWasmModuleToWorker(worker: WorkerLike, sab?: Int32Array): Promise; - allocateUnusedWorker(): WorkerLike; - getNewWorker(sab?: Int32Array): WorkerLike | undefined; - cleanThread(worker: WorkerLike, tid: number, force?: boolean): void; - terminateWorker(worker: WorkerLike): void; - terminateAllThreads(): void; - addMessageEventListener(worker: WorkerLike, onMessage: (e: WorkerMessageEvent) => void): () => void; - fireMessageEvent(worker: WorkerLike, e: WorkerMessageEvent): void; -} - -/** @public */ -export declare type ThreadManagerOptions = ThreadManagerOptionsMain | ThreadManagerOptionsChild; - -/** @public */ -export declare interface ThreadManagerOptionsBase { - printErr?: (message: string) => void; - threadSpawn?: (startArg: number, errorOrTid?: number) => number; -} - -/** @public */ -export declare interface ThreadManagerOptionsChild extends ThreadManagerOptionsBase { - childThread: true; -} - -/** @public */ -export declare interface ThreadManagerOptionsMain extends ThreadManagerOptionsBase { - beforeLoad?: (worker: WorkerLike) => any; - reuseWorker?: boolean | number | ReuseWorkerOptions; - onCreateWorker: WorkerFactory; - childThread?: false; -} - -/** @public */ -export declare class ThreadMessageHandler { - protected instance: WebAssembly.Instance | undefined; - private messagesBeforeLoad; - protected postMessage: (message: any) => void; - protected onLoad?: (data: LoadPayload) => WebAssembly.WebAssemblyInstantiatedSource | PromiseLike; - protected onError: (error: Error, type: WorkerMessageType) => void; - constructor(options?: ThreadMessageHandlerOptions); - /** @virtual */ - instantiate(data: LoadPayload): WebAssembly.WebAssemblyInstantiatedSource | PromiseLike; - /** @virtual */ - handle(e: WorkerMessageEvent>): void; - private _load; - private _start; - protected _loaded(err: Error | null, source: WebAssembly.WebAssemblyInstantiatedSource | null, payload: LoadPayload): void; - protected handleAfterLoad(e: E, f: (e: E) => void): void; -} - -/** @public */ -export declare interface ThreadMessageHandlerOptions { - onLoad?: (data: LoadPayload) => WebAssembly.WebAssemblyInstantiatedSource | PromiseLike; - onError?: (error: Error, type: WorkerMessageType) => void; - postMessage?: (message: any) => void; -} - -/** @public */ -export declare interface WASIInstance { - readonly wasiImport?: Record; - initialize(instance: object): void; - start(instance: object): number; - getImportObject?(): any; -} - -/** @public */ -export declare class WASIThreads { - PThread: ThreadManager | undefined; - private wasmMemory; - private wasmInstance; - private readonly threadSpawn; - readonly childThread: boolean; - private readonly postMessage; - readonly wasi: WASIInstance; - constructor(options: WASIThreadsOptions); - getImportObject(): { - wasi: WASIThreadsImports; - }; - setup(wasmInstance: WebAssembly.Instance, wasmModule: WebAssembly.Module, wasmMemory?: WebAssembly.Memory): void; - preloadWorkers(): Promise; - /** - * It's ok to call this method to a WASI command module. - * - * in child thread, must call this method instead of {@link WASIThreads.start} even if it's a WASI command module - * - * @returns A proxied WebAssembly instance if in child thread, other wise the original instance - */ - initialize(instance: WebAssembly.Instance, module: WebAssembly.Module, memory?: WebAssembly.Memory): WebAssembly.Instance; - /** - * Equivalent to calling {@link WASIThreads.initialize} and then calling {@link WASIInstance.start} - * ```js - * this.initialize(instance, module, memory) - * this.wasi.start(instance) - * ``` - */ - start(instance: WebAssembly.Instance, module: WebAssembly.Module, memory?: WebAssembly.Memory): StartResult; - terminateAllThreads(): void; -} - -/** @public */ -export declare interface WASIThreadsImports { - 'thread-spawn': (startArg: number, errorOrTid?: number) => number; -} - -/** @public */ -export declare type WASIThreadsOptions = MainThreadOptions | ChildThreadOptions; - -/** @public */ -export declare type WorkerFactory = (ctx: { - type: string; - name: string; -}) => WorkerLike; - -/** @public */ -export declare type WorkerLike = (Worker | Worker_2) & { - whenLoaded?: Promise; - loaded?: boolean; - __emnapi_tid?: number; -}; - -/** @public */ -export declare interface WorkerMessageEvent { - data: T; -} - -/** @public */ -export declare type WorkerMessageType = 'load' | 'start'; - -export { } - -export as namespace wasiThreads; diff --git a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.esm-bundler.js b/node_modules/@emnapi/wasi-threads/dist/wasi-threads.esm-bundler.js deleted file mode 100644 index f2bc4d05a..000000000 --- a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.esm-bundler.js +++ /dev/null @@ -1,933 +0,0 @@ -var _WebAssembly = typeof WebAssembly !== 'undefined' - ? WebAssembly - : typeof WXWebAssembly !== 'undefined' - ? WXWebAssembly - : undefined; -var ENVIRONMENT_IS_NODE = typeof process === 'object' && process !== null && - typeof process.versions === 'object' && process.versions !== null && - typeof process.versions.node === 'string'; -function getPostMessage(options) { - return typeof (options === null || options === void 0 ? void 0 : options.postMessage) === 'function' - ? options.postMessage - : typeof postMessage === 'function' - ? postMessage - : undefined; -} -function serizeErrorToBuffer(sab, code, error) { - var i32array = new Int32Array(sab); - Atomics.store(i32array, 0, code); - if (code > 1 && error) { - var name_1 = error.name; - var message = error.message; - var stack = error.stack; - var nameBuffer = new TextEncoder().encode(name_1); - var messageBuffer = new TextEncoder().encode(message); - var stackBuffer = new TextEncoder().encode(stack); - Atomics.store(i32array, 1, nameBuffer.length); - Atomics.store(i32array, 2, messageBuffer.length); - Atomics.store(i32array, 3, stackBuffer.length); - var buffer = new Uint8Array(sab); - buffer.set(nameBuffer, 16); - buffer.set(messageBuffer, 16 + nameBuffer.length); - buffer.set(stackBuffer, 16 + nameBuffer.length + messageBuffer.length); - } -} -function deserizeErrorFromBuffer(sab) { - var _a, _b; - var i32array = new Int32Array(sab); - var status = Atomics.load(i32array, 0); - if (status <= 1) { - return null; - } - var nameLength = Atomics.load(i32array, 1); - var messageLength = Atomics.load(i32array, 2); - var stackLength = Atomics.load(i32array, 3); - var buffer = new Uint8Array(sab); - var nameBuffer = buffer.slice(16, 16 + nameLength); - var messageBuffer = buffer.slice(16 + nameLength, 16 + nameLength + messageLength); - var stackBuffer = buffer.slice(16 + nameLength + messageLength, 16 + nameLength + messageLength + stackLength); - var name = new TextDecoder().decode(nameBuffer); - var message = new TextDecoder().decode(messageBuffer); - var stack = new TextDecoder().decode(stackBuffer); - var ErrorConstructor = (_a = globalThis[name]) !== null && _a !== void 0 ? _a : (name === 'RuntimeError' ? ((_b = _WebAssembly.RuntimeError) !== null && _b !== void 0 ? _b : Error) : Error); - var error = new ErrorConstructor(message); - Object.defineProperty(error, 'stack', { - value: stack, - writable: true, - enumerable: false, - configurable: true - }); - return error; -} -/** @public */ -function isSharedArrayBuffer(value) { - return ((typeof SharedArrayBuffer === 'function' && value instanceof SharedArrayBuffer) || - (Object.prototype.toString.call(value) === '[object SharedArrayBuffer]')); -} -/** @public */ -function isTrapError(e) { - try { - return e instanceof _WebAssembly.RuntimeError; - } - catch (_) { - return false; - } -} - -function createMessage(type, payload) { - return { - __emnapi__: { - type: type, - payload: payload - } - }; -} - -var WASI_THREADS_MAX_TID = 0x1FFFFFFF; -function checkSharedWasmMemory(wasmMemory) { - if (wasmMemory) { - if (!isSharedArrayBuffer(wasmMemory.buffer)) { - throw new Error('Multithread features require shared wasm memory. ' + - 'Try to compile with `-matomics -mbulk-memory` and use `--import-memory --shared-memory` during linking, ' + - 'then create WebAssembly.Memory with `shared: true` option'); - } - } - else { - if (typeof SharedArrayBuffer === 'undefined') { - throw new Error('Current environment does not support SharedArrayBuffer, threads are not available!'); - } - } -} -function getReuseWorker(value) { - var _a; - if (typeof value === 'boolean') { - return value ? { size: 0, strict: false } : false; - } - if (typeof value === 'number') { - if (!(value >= 0)) { - throw new RangeError('reuseWorker: size must be a non-negative integer'); - } - return { size: value, strict: false }; - } - if (!value) { - return false; - } - var size = (_a = Number(value.size)) !== null && _a !== void 0 ? _a : 0; - var strict = Boolean(value.strict); - if (!(size > 0) && strict) { - throw new RangeError('reuseWorker: size must be set to positive integer if strict is set to true'); - } - return { size: size, strict: strict }; -} -var nextWorkerID = 0; -/** @public */ -var ThreadManager = /*#__PURE__*/ (function () { - function ThreadManager(options) { - var _a; - this.unusedWorkers = []; - this.pthreads = Object.create(null); - this.wasmModule = null; - this.wasmMemory = null; - this.messageEvents = new WeakMap(); - if (!options) { - throw new TypeError('ThreadManager(): options is not provided'); - } - if ('childThread' in options) { - this._childThread = Boolean(options.childThread); - } - else { - this._childThread = false; - } - if (this._childThread) { - this._onCreateWorker = undefined; - this._reuseWorker = false; - this._beforeLoad = undefined; - } - else { - this._onCreateWorker = options.onCreateWorker; - this._reuseWorker = getReuseWorker(options.reuseWorker); - this._beforeLoad = options.beforeLoad; - } - this.printErr = (_a = options.printErr) !== null && _a !== void 0 ? _a : console.error.bind(console); - this.threadSpawn = options.threadSpawn; - } - Object.defineProperty(ThreadManager.prototype, "nextWorkerID", { - get: function () { return nextWorkerID; }, - enumerable: false, - configurable: true - }); - ThreadManager.prototype.init = function () { - if (!this._childThread) { - this.initMainThread(); - } - }; - ThreadManager.prototype.initMainThread = function () { - this.preparePool(); - }; - ThreadManager.prototype.preparePool = function () { - if (this._reuseWorker) { - if (this._reuseWorker.size) { - var pthreadPoolSize = this._reuseWorker.size; - while (pthreadPoolSize--) { - var worker = this.allocateUnusedWorker(); - if (ENVIRONMENT_IS_NODE) { - // https://github.com/nodejs/node/issues/53036 - worker.once('message', function () { }); - worker.unref(); - } - } - } - } - }; - ThreadManager.prototype.shouldPreloadWorkers = function () { - return !this._childThread && this._reuseWorker && this._reuseWorker.size > 0; - }; - ThreadManager.prototype.loadWasmModuleToAllWorkers = function () { - var _this_1 = this; - var promises = Array(this.unusedWorkers.length); - var _loop_1 = function (i) { - var worker = this_1.unusedWorkers[i]; - if (ENVIRONMENT_IS_NODE) - worker.ref(); - promises[i] = this_1.loadWasmModuleToWorker(worker).then(function (w) { - if (ENVIRONMENT_IS_NODE) - worker.unref(); - return w; - }, function (e) { - if (ENVIRONMENT_IS_NODE) - worker.unref(); - throw e; - }); - }; - var this_1 = this; - for (var i = 0; i < this.unusedWorkers.length; ++i) { - _loop_1(i); - } - return Promise.all(promises).catch(function (err) { - _this_1.terminateAllThreads(); - throw err; - }); - }; - ThreadManager.prototype.preloadWorkers = function () { - if (this.shouldPreloadWorkers()) { - return this.loadWasmModuleToAllWorkers(); - } - return Promise.resolve([]); - }; - ThreadManager.prototype.setup = function (wasmModule, wasmMemory) { - this.wasmModule = wasmModule; - this.wasmMemory = wasmMemory; - }; - ThreadManager.prototype.markId = function (worker) { - if (worker.__emnapi_tid) - return worker.__emnapi_tid; - var tid = nextWorkerID + 43; - nextWorkerID = (nextWorkerID + 1) % (WASI_THREADS_MAX_TID - 42); - this.pthreads[tid] = worker; - worker.__emnapi_tid = tid; - return tid; - }; - ThreadManager.prototype.returnWorkerToPool = function (worker) { - var tid = worker.__emnapi_tid; - if (tid !== undefined) { - delete this.pthreads[tid]; - } - this.unusedWorkers.push(worker); - delete worker.__emnapi_tid; - if (ENVIRONMENT_IS_NODE) { - worker.unref(); - } - }; - ThreadManager.prototype.loadWasmModuleToWorker = function (worker, sab) { - var _this_1 = this; - if (worker.whenLoaded) - return worker.whenLoaded; - var err = this.printErr; - var beforeLoad = this._beforeLoad; - // eslint-disable-next-line @typescript-eslint/no-this-alias - var _this = this; - worker.whenLoaded = new Promise(function (resolve, reject) { - var handleError = function (e) { - var message = 'worker sent an error!'; - if (worker.__emnapi_tid !== undefined) { - message = 'worker (tid = ' + worker.__emnapi_tid + ') sent an error!'; - } - if ('message' in e) { - err(message + ' ' + e.message); - if (e.message.indexOf('RuntimeError') !== -1 || e.message.indexOf('unreachable') !== -1) { - try { - _this.terminateAllThreads(); - } - catch (_) { } - } - } - else { - err(message); - } - reject(e); - throw e; - }; - var handleMessage = function (data) { - if (data.__emnapi__) { - var type = data.__emnapi__.type; - var payload = data.__emnapi__.payload; - if (type === 'loaded') { - worker.loaded = true; - if (ENVIRONMENT_IS_NODE && !worker.__emnapi_tid) { - worker.unref(); - } - resolve(worker); - // if (payload.err) { - // err('failed to load in child thread: ' + (payload.err.message || payload.err)) - // } - } - else if (type === 'cleanup-thread') { - if (payload.tid in _this_1.pthreads) { - _this_1.cleanThread(worker, payload.tid); - } - } - else if (type === 'spawn-thread') { - _this_1.threadSpawn(payload.startArg, payload.errorOrTid); - } - else if (type === 'terminate-all-threads') { - _this_1.terminateAllThreads(); - } - } - }; - worker.onmessage = function (e) { - handleMessage(e.data); - _this_1.fireMessageEvent(worker, e); - }; - worker.onerror = handleError; - if (ENVIRONMENT_IS_NODE) { - worker.on('message', function (data) { - var _a, _b; - (_b = (_a = worker).onmessage) === null || _b === void 0 ? void 0 : _b.call(_a, { - data: data - }); - }); - worker.on('error', function (e) { - var _a, _b; - (_b = (_a = worker).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, e); - }); - worker.on('detachedExit', function () { }); - } - if (typeof beforeLoad === 'function') { - beforeLoad(worker); - } - try { - worker.postMessage(createMessage('load', { - wasmModule: _this_1.wasmModule, - wasmMemory: _this_1.wasmMemory, - sab: sab - })); - } - catch (err) { - checkSharedWasmMemory(_this_1.wasmMemory); - throw err; - } - }); - return worker.whenLoaded; - }; - ThreadManager.prototype.allocateUnusedWorker = function () { - var _onCreateWorker = this._onCreateWorker; - if (typeof _onCreateWorker !== 'function') { - throw new TypeError('`options.onCreateWorker` is not provided'); - } - var worker = _onCreateWorker({ type: 'thread', name: 'emnapi-pthread' }); - this.unusedWorkers.push(worker); - return worker; - }; - ThreadManager.prototype.getNewWorker = function (sab) { - if (this._reuseWorker) { - if (this.unusedWorkers.length === 0) { - if (this._reuseWorker.strict) { - if (!ENVIRONMENT_IS_NODE) { - var err = this.printErr; - err('Tried to spawn a new thread, but the thread pool is exhausted.\n' + - 'This might result in a deadlock unless some threads eventually exit or the code explicitly breaks out to the event loop.'); - return; - } - } - var worker_1 = this.allocateUnusedWorker(); - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.loadWasmModuleToWorker(worker_1, sab); - } - return this.unusedWorkers.pop(); - } - var worker = this.allocateUnusedWorker(); - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.loadWasmModuleToWorker(worker, sab); - return this.unusedWorkers.pop(); - }; - ThreadManager.prototype.cleanThread = function (worker, tid, force) { - if (!force && this._reuseWorker) { - this.returnWorkerToPool(worker); - } - else { - delete this.pthreads[tid]; - this.terminateWorker(worker); - delete worker.__emnapi_tid; - } - }; - ThreadManager.prototype.terminateWorker = function (worker) { - var _this_1 = this; - var _a; - var tid = worker.__emnapi_tid; - // eslint-disable-next-line @typescript-eslint/no-floating-promises - worker.terminate(); - (_a = this.messageEvents.get(worker)) === null || _a === void 0 ? void 0 : _a.clear(); - this.messageEvents.delete(worker); - worker.onmessage = function (e) { - if (e.data.__emnapi__) { - var err = _this_1.printErr; - err('received "' + e.data.__emnapi__.type + '" command from terminated worker: ' + tid); - } - }; - }; - ThreadManager.prototype.terminateAllThreads = function () { - var runningWorkers = Object.values(this.pthreads); - for (var i = 0; i < runningWorkers.length; ++i) { - this.terminateWorker(runningWorkers[i]); - } - for (var i = 0; i < this.unusedWorkers.length; ++i) { - this.terminateWorker(this.unusedWorkers[i]); - } - this.unusedWorkers = []; - this.pthreads = Object.create(null); - this.preparePool(); - }; - ThreadManager.prototype.addMessageEventListener = function (worker, onMessage) { - var listeners = this.messageEvents.get(worker); - if (!listeners) { - listeners = new Set(); - this.messageEvents.set(worker, listeners); - } - listeners.add(onMessage); - return function () { - listeners === null || listeners === void 0 ? void 0 : listeners.delete(onMessage); - }; - }; - ThreadManager.prototype.fireMessageEvent = function (worker, e) { - var listeners = this.messageEvents.get(worker); - if (!listeners) - return; - var err = this.printErr; - listeners.forEach(function (listener) { - try { - listener(e); - } - catch (e) { - err(e.stack); - } - }); - }; - return ThreadManager; -}()); - -var kIsProxy = Symbol('kIsProxy'); -/** @public */ -function createInstanceProxy(instance, memory) { - if (instance[kIsProxy]) - return instance; - // https://github.com/nodejs/help/issues/4102 - var originalExports = instance.exports; - var createHandler = function (target) { - var handlers = [ - 'apply', - 'construct', - 'defineProperty', - 'deleteProperty', - 'get', - 'getOwnPropertyDescriptor', - 'getPrototypeOf', - 'has', - 'isExtensible', - 'ownKeys', - 'preventExtensions', - 'set', - 'setPrototypeOf' - ]; - var handler = {}; - var _loop_1 = function (i) { - var name_1 = handlers[i]; - handler[name_1] = function () { - var args = Array.prototype.slice.call(arguments, 1); - args.unshift(target); - return Reflect[name_1].apply(Reflect, args); - }; - }; - for (var i = 0; i < handlers.length; i++) { - _loop_1(i); - } - return handler; - }; - var handler = createHandler(originalExports); - var _initialize = function () { }; - var _start = function () { return 0; }; - handler.get = function (_target, p, receiver) { - var _a; - if (p === 'memory') { - return (_a = (typeof memory === 'function' ? memory() : memory)) !== null && _a !== void 0 ? _a : Reflect.get(originalExports, p, receiver); - } - if (p === '_initialize') { - return p in originalExports ? _initialize : undefined; - } - if (p === '_start') { - return p in originalExports ? _start : undefined; - } - return Reflect.get(originalExports, p, receiver); - }; - handler.has = function (_target, p) { - if (p === 'memory') - return true; - return Reflect.has(originalExports, p); - }; - var exportsProxy = new Proxy(Object.create(null), handler); - return new Proxy(instance, { - get: function (target, p, receiver) { - if (p === 'exports') { - return exportsProxy; - } - if (p === kIsProxy) { - return true; - } - return Reflect.get(target, p, receiver); - } - }); -} - -var patchedWasiInstances = new WeakMap(); -/** @public */ -var WASIThreads = /*#__PURE__*/ (function () { - function WASIThreads(options) { - var _this_1 = this; - if (!options) { - throw new TypeError('WASIThreads(): options is not provided'); - } - if (!options.wasi) { - throw new TypeError('WASIThreads(): options.wasi is not provided'); - } - patchedWasiInstances.set(this, new WeakSet()); - var wasi = options.wasi; - patchWasiInstance(this, wasi); - this.wasi = wasi; - if ('childThread' in options) { - this.childThread = Boolean(options.childThread); - } - else { - this.childThread = false; - } - this.PThread = undefined; - if ('threadManager' in options) { - if (typeof options.threadManager === 'function') { - this.PThread = options.threadManager(); - } - else { - this.PThread = options.threadManager; - } - } - else { - if (!this.childThread) { - this.PThread = new ThreadManager(options); - this.PThread.init(); - } - } - var waitThreadStart = false; - if ('waitThreadStart' in options) { - waitThreadStart = typeof options.waitThreadStart === 'number' ? options.waitThreadStart : Boolean(options.waitThreadStart); - } - var postMessage = getPostMessage(options); - if (this.childThread && typeof postMessage !== 'function') { - throw new TypeError('options.postMessage is not a function'); - } - this.postMessage = postMessage; - var wasm64 = Boolean(options.wasm64); - var threadSpawn = function (startArg, errorOrTid) { - var _a; - var EAGAIN = 6; - var isNewABI = errorOrTid !== undefined; - try { - checkSharedWasmMemory(_this_1.wasmMemory); - } - catch (err) { - (_a = _this_1.PThread) === null || _a === void 0 ? void 0 : _a.printErr(err.stack); - if (isNewABI) { - var struct_1 = new Int32Array(_this_1.wasmMemory.buffer, errorOrTid, 2); - Atomics.store(struct_1, 0, 1); - Atomics.store(struct_1, 1, EAGAIN); - Atomics.notify(struct_1, 1); - return 1; - } - else { - return -EAGAIN; - } - } - if (!isNewABI) { - var malloc = _this_1.wasmInstance.exports.malloc; - errorOrTid = wasm64 ? Number(malloc(BigInt(8))) : (malloc(8) >>> 0); - if (!errorOrTid) { - return -48; /* ENOMEM */ - } - } - var _free = _this_1.wasmInstance.exports.free; - var free = wasm64 ? function (ptr) { _free(BigInt(ptr)); } : _free; - var struct = new Int32Array(_this_1.wasmMemory.buffer, errorOrTid, 2); - Atomics.store(struct, 0, 0); - Atomics.store(struct, 1, 0); - if (_this_1.childThread) { - postMessage(createMessage('spawn-thread', { - startArg: startArg, - errorOrTid: errorOrTid - })); - Atomics.wait(struct, 1, 0); - var isError = Atomics.load(struct, 0); - var result = Atomics.load(struct, 1); - if (isNewABI) { - return isError; - } - free(errorOrTid); - return isError ? -result : result; - } - var shouldWait = waitThreadStart || (waitThreadStart === 0); - var sab; - if (shouldWait) { - sab = new Int32Array(new SharedArrayBuffer(16 + 8192)); - Atomics.store(sab, 0, 0); - } - var worker; - var tid; - var PThread = _this_1.PThread; - try { - worker = PThread.getNewWorker(sab); - if (!worker) { - throw new Error('failed to get new worker'); - } - tid = PThread.markId(worker); - if (ENVIRONMENT_IS_NODE) { - worker.unref(); - } - worker.postMessage(createMessage('start', { - tid: tid, - arg: startArg, - sab: sab - })); - if (shouldWait) { - if (typeof waitThreadStart === 'number') { - var waitResult = Atomics.wait(sab, 0, 0, waitThreadStart); - if (waitResult === 'timed-out') { - throw new Error('Spawning thread timed out. Please check if the worker is created successfully and if message is handled properly in the worker.'); - } - } - else { - Atomics.wait(sab, 0, 0); - } - var r = Atomics.load(sab, 0); - if (r > 1) { - throw deserizeErrorFromBuffer(sab.buffer); - } - } - } - catch (e) { - if (worker !== undefined && tid !== undefined) { - try { - PThread.cleanThread(worker, tid, true); - } - catch (_) { } - } - Atomics.store(struct, 0, 1); - Atomics.store(struct, 1, EAGAIN); - Atomics.notify(struct, 1); - PThread === null || PThread === void 0 ? void 0 : PThread.printErr(e.stack); - if (isNewABI) { - return 1; - } - free(errorOrTid); - return -EAGAIN; - } - Atomics.store(struct, 0, 0); - Atomics.store(struct, 1, tid); - Atomics.notify(struct, 1); - if (!shouldWait) { - worker.whenLoaded.catch(function (err) { - delete worker.whenLoaded; - PThread.cleanThread(worker, tid, true); - throw err; - }); - } - if (isNewABI) { - return 0; - } - free(errorOrTid); - return tid; - }; - this.threadSpawn = threadSpawn; - if (this.PThread) { - this.PThread.threadSpawn = threadSpawn; - } - } - WASIThreads.prototype.getImportObject = function () { - return { - wasi: { - 'thread-spawn': this.threadSpawn - } - }; - }; - WASIThreads.prototype.setup = function (wasmInstance, wasmModule, wasmMemory) { - wasmMemory !== null && wasmMemory !== void 0 ? wasmMemory : (wasmMemory = wasmInstance.exports.memory); - this.wasmInstance = wasmInstance; - this.wasmMemory = wasmMemory; - if (this.PThread) { - this.PThread.setup(wasmModule, wasmMemory); - } - }; - WASIThreads.prototype.preloadWorkers = function () { - if (this.PThread) { - return this.PThread.preloadWorkers(); - } - return Promise.resolve([]); - }; - /** - * It's ok to call this method to a WASI command module. - * - * in child thread, must call this method instead of {@link WASIThreads.start} even if it's a WASI command module - * - * @returns A proxied WebAssembly instance if in child thread, other wise the original instance - */ - WASIThreads.prototype.initialize = function (instance, module, memory) { - var exports = instance.exports; - memory !== null && memory !== void 0 ? memory : (memory = exports.memory); - if (this.childThread) { - instance = createInstanceProxy(instance, memory); - } - this.setup(instance, module, memory); - var wasi = this.wasi; - if (('_start' in exports) && (typeof exports._start === 'function')) { - if (this.childThread) { - wasi.start(instance); - try { - var kStarted = getWasiSymbol(wasi, 'kStarted'); - wasi[kStarted] = false; - } - catch (_) { } - } - else { - setupInstance(wasi, instance); - } - } - else { - wasi.initialize(instance); - } - return instance; - }; - /** - * Equivalent to calling {@link WASIThreads.initialize} and then calling {@link WASIInstance.start} - * ```js - * this.initialize(instance, module, memory) - * this.wasi.start(instance) - * ``` - */ - WASIThreads.prototype.start = function (instance, module, memory) { - var exports = instance.exports; - memory !== null && memory !== void 0 ? memory : (memory = exports.memory); - if (this.childThread) { - instance = createInstanceProxy(instance, memory); - } - this.setup(instance, module, memory); - var exitCode = this.wasi.start(instance); - return { exitCode: exitCode, instance: instance }; - }; - WASIThreads.prototype.terminateAllThreads = function () { - var _a; - if (!this.childThread) { - (_a = this.PThread) === null || _a === void 0 ? void 0 : _a.terminateAllThreads(); - } - else { - this.postMessage(createMessage('terminate-all-threads', {})); - } - }; - return WASIThreads; -}()); -function patchWasiInstance(wasiThreads, wasi) { - var patched = patchedWasiInstances.get(wasiThreads); - if (patched.has(wasi)) { - return; - } - var _this = wasiThreads; - var wasiImport = wasi.wasiImport; - if (wasiImport) { - var proc_exit_1 = wasiImport.proc_exit; - wasiImport.proc_exit = function (code) { - _this.terminateAllThreads(); - return proc_exit_1.call(this, code); - }; - } - if (!_this.childThread) { - var start_1 = wasi.start; - if (typeof start_1 === 'function') { - wasi.start = function (instance) { - try { - return start_1.call(this, instance); - } - catch (err) { - if (isTrapError(err)) { - _this.terminateAllThreads(); - } - throw err; - } - }; - } - } - patched.add(wasi); -} -function getWasiSymbol(wasi, description) { - var symbols = Object.getOwnPropertySymbols(wasi); - var selectDescription = function (description) { return function (s) { - if (s.description) { - return s.description === description; - } - return s.toString() === "Symbol(".concat(description, ")"); - }; }; - if (Array.isArray(description)) { - return description.map(function (d) { return symbols.filter(selectDescription(d))[0]; }); - } - return symbols.filter(selectDescription(description))[0]; -} -function setupInstance(wasi, instance) { - var _a = getWasiSymbol(wasi, ['kInstance', 'kSetMemory']), kInstance = _a[0], kSetMemory = _a[1]; - wasi[kInstance] = instance; - wasi[kSetMemory](instance.exports.memory); -} - -/** @public */ -var ThreadMessageHandler = /*#__PURE__*/ (function () { - function ThreadMessageHandler(options) { - var postMsg = getPostMessage(options); - if (typeof postMsg !== 'function') { - throw new TypeError('options.postMessage is not a function'); - } - this.postMessage = postMsg; - this.onLoad = options === null || options === void 0 ? void 0 : options.onLoad; - this.onError = typeof (options === null || options === void 0 ? void 0 : options.onError) === 'function' ? options.onError : function (_type, err) { throw err; }; - this.instance = undefined; - // this.module = undefined - this.messagesBeforeLoad = []; - } - /** @virtual */ - ThreadMessageHandler.prototype.instantiate = function (data) { - if (typeof this.onLoad === 'function') { - return this.onLoad(data); - } - throw new Error('ThreadMessageHandler.prototype.instantiate is not implemented'); - }; - /** @virtual */ - ThreadMessageHandler.prototype.handle = function (e) { - var _this = this; - var _a; - if ((_a = e === null || e === void 0 ? void 0 : e.data) === null || _a === void 0 ? void 0 : _a.__emnapi__) { - var type = e.data.__emnapi__.type; - var payload_1 = e.data.__emnapi__.payload; - try { - if (type === 'load') { - this._load(payload_1); - } - else if (type === 'start') { - this.handleAfterLoad(e, function () { - _this._start(payload_1); - }); - } - } - catch (err) { - this.onError(err, type); - } - } - }; - ThreadMessageHandler.prototype._load = function (payload) { - var _this = this; - if (this.instance !== undefined) - return; - var source; - try { - source = this.instantiate(payload); - } - catch (err) { - this._loaded(err, null, payload); - return; - } - var then = source && 'then' in source ? source.then : undefined; - if (typeof then === 'function') { - // eslint-disable-next-line @typescript-eslint/no-floating-promises - then.call(source, function (source) { _this._loaded(null, source, payload); }, function (err) { _this._loaded(err, null, payload); }); - } - else { - this._loaded(null, source, payload); - } - }; - ThreadMessageHandler.prototype._start = function (payload) { - var wasi_thread_start = this.instance.exports.wasi_thread_start; - if (typeof wasi_thread_start !== 'function') { - var err = new TypeError('wasi_thread_start is not exported'); - notifyPthreadCreateResult(payload.sab, 2, err); - throw err; - } - var postMessage = this.postMessage; - var tid = payload.tid; - var startArg = payload.arg; - notifyPthreadCreateResult(payload.sab, 1); - try { - wasi_thread_start(tid, startArg); - } - catch (err) { - if (err !== 'unwind') { - throw err; - } - else { - return; - } - } - postMessage(createMessage('cleanup-thread', { tid: tid })); - }; - ThreadMessageHandler.prototype._loaded = function (err, source, payload) { - if (err) { - notifyPthreadCreateResult(payload.sab, 2, err); - throw err; - } - if (source == null) { - var err_1 = new TypeError('onLoad should return an object'); - notifyPthreadCreateResult(payload.sab, 2, err_1); - throw err_1; - } - var instance = source.instance; - if (!instance) { - var err_2 = new TypeError('onLoad should return an object which includes "instance"'); - notifyPthreadCreateResult(payload.sab, 2, err_2); - throw err_2; - } - this.instance = instance; - var postMessage = this.postMessage; - postMessage(createMessage('loaded', {})); - var messages = this.messagesBeforeLoad; - this.messagesBeforeLoad = []; - for (var i = 0; i < messages.length; i++) { - var data = messages[i]; - this.handle({ data: data }); - } - }; - ThreadMessageHandler.prototype.handleAfterLoad = function (e, f) { - if (this.instance !== undefined) { - f.call(this, e); - } - else { - this.messagesBeforeLoad.push(e.data); - } - }; - return ThreadMessageHandler; -}()); -function notifyPthreadCreateResult(sab, result, error) { - if (sab) { - serizeErrorToBuffer(sab.buffer, result, error); - Atomics.notify(sab, 0); - } -} - -export { ThreadManager, ThreadMessageHandler, WASIThreads, createInstanceProxy, isSharedArrayBuffer, isTrapError }; diff --git a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js b/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js deleted file mode 100644 index 312cb1855..000000000 --- a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +++ /dev/null @@ -1,945 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.wasiThreads = {})); -})(this, (function (exports) { - var _WebAssembly = typeof WebAssembly !== 'undefined' - ? WebAssembly - : typeof WXWebAssembly !== 'undefined' - ? WXWebAssembly - : undefined; - var ENVIRONMENT_IS_NODE = typeof process === 'object' && process !== null && - typeof process.versions === 'object' && process.versions !== null && - typeof process.versions.node === 'string'; - function getPostMessage(options) { - return typeof (options === null || options === void 0 ? void 0 : options.postMessage) === 'function' - ? options.postMessage - : typeof postMessage === 'function' - ? postMessage - : undefined; - } - function serizeErrorToBuffer(sab, code, error) { - var i32array = new Int32Array(sab); - Atomics.store(i32array, 0, code); - if (code > 1 && error) { - var name_1 = error.name; - var message = error.message; - var stack = error.stack; - var nameBuffer = new TextEncoder().encode(name_1); - var messageBuffer = new TextEncoder().encode(message); - var stackBuffer = new TextEncoder().encode(stack); - Atomics.store(i32array, 1, nameBuffer.length); - Atomics.store(i32array, 2, messageBuffer.length); - Atomics.store(i32array, 3, stackBuffer.length); - var buffer = new Uint8Array(sab); - buffer.set(nameBuffer, 16); - buffer.set(messageBuffer, 16 + nameBuffer.length); - buffer.set(stackBuffer, 16 + nameBuffer.length + messageBuffer.length); - } - } - function deserizeErrorFromBuffer(sab) { - var _a, _b; - var i32array = new Int32Array(sab); - var status = Atomics.load(i32array, 0); - if (status <= 1) { - return null; - } - var nameLength = Atomics.load(i32array, 1); - var messageLength = Atomics.load(i32array, 2); - var stackLength = Atomics.load(i32array, 3); - var buffer = new Uint8Array(sab); - var nameBuffer = buffer.slice(16, 16 + nameLength); - var messageBuffer = buffer.slice(16 + nameLength, 16 + nameLength + messageLength); - var stackBuffer = buffer.slice(16 + nameLength + messageLength, 16 + nameLength + messageLength + stackLength); - var name = new TextDecoder().decode(nameBuffer); - var message = new TextDecoder().decode(messageBuffer); - var stack = new TextDecoder().decode(stackBuffer); - var ErrorConstructor = (_a = globalThis[name]) !== null && _a !== void 0 ? _a : (name === 'RuntimeError' ? ((_b = _WebAssembly.RuntimeError) !== null && _b !== void 0 ? _b : Error) : Error); - var error = new ErrorConstructor(message); - Object.defineProperty(error, 'stack', { - value: stack, - writable: true, - enumerable: false, - configurable: true - }); - return error; - } - /** @public */ - function isSharedArrayBuffer(value) { - return ((typeof SharedArrayBuffer === 'function' && value instanceof SharedArrayBuffer) || - (Object.prototype.toString.call(value) === '[object SharedArrayBuffer]')); - } - /** @public */ - function isTrapError(e) { - try { - return e instanceof _WebAssembly.RuntimeError; - } - catch (_) { - return false; - } - } - - function createMessage(type, payload) { - return { - __emnapi__: { - type: type, - payload: payload - } - }; - } - - var WASI_THREADS_MAX_TID = 0x1FFFFFFF; - function checkSharedWasmMemory(wasmMemory) { - if (wasmMemory) { - if (!isSharedArrayBuffer(wasmMemory.buffer)) { - throw new Error('Multithread features require shared wasm memory. ' + - 'Try to compile with `-matomics -mbulk-memory` and use `--import-memory --shared-memory` during linking, ' + - 'then create WebAssembly.Memory with `shared: true` option'); - } - } - else { - if (typeof SharedArrayBuffer === 'undefined') { - throw new Error('Current environment does not support SharedArrayBuffer, threads are not available!'); - } - } - } - function getReuseWorker(value) { - var _a; - if (typeof value === 'boolean') { - return value ? { size: 0, strict: false } : false; - } - if (typeof value === 'number') { - if (!(value >= 0)) { - throw new RangeError('reuseWorker: size must be a non-negative integer'); - } - return { size: value, strict: false }; - } - if (!value) { - return false; - } - var size = (_a = Number(value.size)) !== null && _a !== void 0 ? _a : 0; - var strict = Boolean(value.strict); - if (!(size > 0) && strict) { - throw new RangeError('reuseWorker: size must be set to positive integer if strict is set to true'); - } - return { size: size, strict: strict }; - } - var nextWorkerID = 0; - /** @public */ - var ThreadManager = /*#__PURE__*/ (function () { - function ThreadManager(options) { - var _a; - this.unusedWorkers = []; - this.pthreads = Object.create(null); - this.wasmModule = null; - this.wasmMemory = null; - this.messageEvents = new WeakMap(); - if (!options) { - throw new TypeError('ThreadManager(): options is not provided'); - } - if ('childThread' in options) { - this._childThread = Boolean(options.childThread); - } - else { - this._childThread = false; - } - if (this._childThread) { - this._onCreateWorker = undefined; - this._reuseWorker = false; - this._beforeLoad = undefined; - } - else { - this._onCreateWorker = options.onCreateWorker; - this._reuseWorker = getReuseWorker(options.reuseWorker); - this._beforeLoad = options.beforeLoad; - } - this.printErr = (_a = options.printErr) !== null && _a !== void 0 ? _a : console.error.bind(console); - this.threadSpawn = options.threadSpawn; - } - Object.defineProperty(ThreadManager.prototype, "nextWorkerID", { - get: function () { return nextWorkerID; }, - enumerable: false, - configurable: true - }); - ThreadManager.prototype.init = function () { - if (!this._childThread) { - this.initMainThread(); - } - }; - ThreadManager.prototype.initMainThread = function () { - this.preparePool(); - }; - ThreadManager.prototype.preparePool = function () { - if (this._reuseWorker) { - if (this._reuseWorker.size) { - var pthreadPoolSize = this._reuseWorker.size; - while (pthreadPoolSize--) { - var worker = this.allocateUnusedWorker(); - if (ENVIRONMENT_IS_NODE) { - // https://github.com/nodejs/node/issues/53036 - worker.once('message', function () { }); - worker.unref(); - } - } - } - } - }; - ThreadManager.prototype.shouldPreloadWorkers = function () { - return !this._childThread && this._reuseWorker && this._reuseWorker.size > 0; - }; - ThreadManager.prototype.loadWasmModuleToAllWorkers = function () { - var _this_1 = this; - var promises = Array(this.unusedWorkers.length); - var _loop_1 = function (i) { - var worker = this_1.unusedWorkers[i]; - if (ENVIRONMENT_IS_NODE) - worker.ref(); - promises[i] = this_1.loadWasmModuleToWorker(worker).then(function (w) { - if (ENVIRONMENT_IS_NODE) - worker.unref(); - return w; - }, function (e) { - if (ENVIRONMENT_IS_NODE) - worker.unref(); - throw e; - }); - }; - var this_1 = this; - for (var i = 0; i < this.unusedWorkers.length; ++i) { - _loop_1(i); - } - return Promise.all(promises).catch(function (err) { - _this_1.terminateAllThreads(); - throw err; - }); - }; - ThreadManager.prototype.preloadWorkers = function () { - if (this.shouldPreloadWorkers()) { - return this.loadWasmModuleToAllWorkers(); - } - return Promise.resolve([]); - }; - ThreadManager.prototype.setup = function (wasmModule, wasmMemory) { - this.wasmModule = wasmModule; - this.wasmMemory = wasmMemory; - }; - ThreadManager.prototype.markId = function (worker) { - if (worker.__emnapi_tid) - return worker.__emnapi_tid; - var tid = nextWorkerID + 43; - nextWorkerID = (nextWorkerID + 1) % (WASI_THREADS_MAX_TID - 42); - this.pthreads[tid] = worker; - worker.__emnapi_tid = tid; - return tid; - }; - ThreadManager.prototype.returnWorkerToPool = function (worker) { - var tid = worker.__emnapi_tid; - if (tid !== undefined) { - delete this.pthreads[tid]; - } - this.unusedWorkers.push(worker); - delete worker.__emnapi_tid; - if (ENVIRONMENT_IS_NODE) { - worker.unref(); - } - }; - ThreadManager.prototype.loadWasmModuleToWorker = function (worker, sab) { - var _this_1 = this; - if (worker.whenLoaded) - return worker.whenLoaded; - var err = this.printErr; - var beforeLoad = this._beforeLoad; - // eslint-disable-next-line @typescript-eslint/no-this-alias - var _this = this; - worker.whenLoaded = new Promise(function (resolve, reject) { - var handleError = function (e) { - var message = 'worker sent an error!'; - if (worker.__emnapi_tid !== undefined) { - message = 'worker (tid = ' + worker.__emnapi_tid + ') sent an error!'; - } - if ('message' in e) { - err(message + ' ' + e.message); - if (e.message.indexOf('RuntimeError') !== -1 || e.message.indexOf('unreachable') !== -1) { - try { - _this.terminateAllThreads(); - } - catch (_) { } - } - } - else { - err(message); - } - reject(e); - throw e; - }; - var handleMessage = function (data) { - if (data.__emnapi__) { - var type = data.__emnapi__.type; - var payload = data.__emnapi__.payload; - if (type === 'loaded') { - worker.loaded = true; - if (ENVIRONMENT_IS_NODE && !worker.__emnapi_tid) { - worker.unref(); - } - resolve(worker); - // if (payload.err) { - // err('failed to load in child thread: ' + (payload.err.message || payload.err)) - // } - } - else if (type === 'cleanup-thread') { - if (payload.tid in _this_1.pthreads) { - _this_1.cleanThread(worker, payload.tid); - } - } - else if (type === 'spawn-thread') { - _this_1.threadSpawn(payload.startArg, payload.errorOrTid); - } - else if (type === 'terminate-all-threads') { - _this_1.terminateAllThreads(); - } - } - }; - worker.onmessage = function (e) { - handleMessage(e.data); - _this_1.fireMessageEvent(worker, e); - }; - worker.onerror = handleError; - if (ENVIRONMENT_IS_NODE) { - worker.on('message', function (data) { - var _a, _b; - (_b = (_a = worker).onmessage) === null || _b === void 0 ? void 0 : _b.call(_a, { - data: data - }); - }); - worker.on('error', function (e) { - var _a, _b; - (_b = (_a = worker).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, e); - }); - worker.on('detachedExit', function () { }); - } - if (typeof beforeLoad === 'function') { - beforeLoad(worker); - } - try { - worker.postMessage(createMessage('load', { - wasmModule: _this_1.wasmModule, - wasmMemory: _this_1.wasmMemory, - sab: sab - })); - } - catch (err) { - checkSharedWasmMemory(_this_1.wasmMemory); - throw err; - } - }); - return worker.whenLoaded; - }; - ThreadManager.prototype.allocateUnusedWorker = function () { - var _onCreateWorker = this._onCreateWorker; - if (typeof _onCreateWorker !== 'function') { - throw new TypeError('`options.onCreateWorker` is not provided'); - } - var worker = _onCreateWorker({ type: 'thread', name: 'emnapi-pthread' }); - this.unusedWorkers.push(worker); - return worker; - }; - ThreadManager.prototype.getNewWorker = function (sab) { - if (this._reuseWorker) { - if (this.unusedWorkers.length === 0) { - if (this._reuseWorker.strict) { - if (!ENVIRONMENT_IS_NODE) { - var err = this.printErr; - err('Tried to spawn a new thread, but the thread pool is exhausted.\n' + - 'This might result in a deadlock unless some threads eventually exit or the code explicitly breaks out to the event loop.'); - return; - } - } - var worker_1 = this.allocateUnusedWorker(); - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.loadWasmModuleToWorker(worker_1, sab); - } - return this.unusedWorkers.pop(); - } - var worker = this.allocateUnusedWorker(); - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.loadWasmModuleToWorker(worker, sab); - return this.unusedWorkers.pop(); - }; - ThreadManager.prototype.cleanThread = function (worker, tid, force) { - if (!force && this._reuseWorker) { - this.returnWorkerToPool(worker); - } - else { - delete this.pthreads[tid]; - this.terminateWorker(worker); - delete worker.__emnapi_tid; - } - }; - ThreadManager.prototype.terminateWorker = function (worker) { - var _this_1 = this; - var _a; - var tid = worker.__emnapi_tid; - // eslint-disable-next-line @typescript-eslint/no-floating-promises - worker.terminate(); - (_a = this.messageEvents.get(worker)) === null || _a === void 0 ? void 0 : _a.clear(); - this.messageEvents.delete(worker); - worker.onmessage = function (e) { - if (e.data.__emnapi__) { - var err = _this_1.printErr; - err('received "' + e.data.__emnapi__.type + '" command from terminated worker: ' + tid); - } - }; - }; - ThreadManager.prototype.terminateAllThreads = function () { - var runningWorkers = Object.values(this.pthreads); - for (var i = 0; i < runningWorkers.length; ++i) { - this.terminateWorker(runningWorkers[i]); - } - for (var i = 0; i < this.unusedWorkers.length; ++i) { - this.terminateWorker(this.unusedWorkers[i]); - } - this.unusedWorkers = []; - this.pthreads = Object.create(null); - this.preparePool(); - }; - ThreadManager.prototype.addMessageEventListener = function (worker, onMessage) { - var listeners = this.messageEvents.get(worker); - if (!listeners) { - listeners = new Set(); - this.messageEvents.set(worker, listeners); - } - listeners.add(onMessage); - return function () { - listeners === null || listeners === void 0 ? void 0 : listeners.delete(onMessage); - }; - }; - ThreadManager.prototype.fireMessageEvent = function (worker, e) { - var listeners = this.messageEvents.get(worker); - if (!listeners) - return; - var err = this.printErr; - listeners.forEach(function (listener) { - try { - listener(e); - } - catch (e) { - err(e.stack); - } - }); - }; - return ThreadManager; - }()); - - var kIsProxy = Symbol('kIsProxy'); - /** @public */ - function createInstanceProxy(instance, memory) { - if (instance[kIsProxy]) - return instance; - // https://github.com/nodejs/help/issues/4102 - var originalExports = instance.exports; - var createHandler = function (target) { - var handlers = [ - 'apply', - 'construct', - 'defineProperty', - 'deleteProperty', - 'get', - 'getOwnPropertyDescriptor', - 'getPrototypeOf', - 'has', - 'isExtensible', - 'ownKeys', - 'preventExtensions', - 'set', - 'setPrototypeOf' - ]; - var handler = {}; - var _loop_1 = function (i) { - var name_1 = handlers[i]; - handler[name_1] = function () { - var args = Array.prototype.slice.call(arguments, 1); - args.unshift(target); - return Reflect[name_1].apply(Reflect, args); - }; - }; - for (var i = 0; i < handlers.length; i++) { - _loop_1(i); - } - return handler; - }; - var handler = createHandler(originalExports); - var _initialize = function () { }; - var _start = function () { return 0; }; - handler.get = function (_target, p, receiver) { - var _a; - if (p === 'memory') { - return (_a = (typeof memory === 'function' ? memory() : memory)) !== null && _a !== void 0 ? _a : Reflect.get(originalExports, p, receiver); - } - if (p === '_initialize') { - return p in originalExports ? _initialize : undefined; - } - if (p === '_start') { - return p in originalExports ? _start : undefined; - } - return Reflect.get(originalExports, p, receiver); - }; - handler.has = function (_target, p) { - if (p === 'memory') - return true; - return Reflect.has(originalExports, p); - }; - var exportsProxy = new Proxy(Object.create(null), handler); - return new Proxy(instance, { - get: function (target, p, receiver) { - if (p === 'exports') { - return exportsProxy; - } - if (p === kIsProxy) { - return true; - } - return Reflect.get(target, p, receiver); - } - }); - } - - var patchedWasiInstances = new WeakMap(); - /** @public */ - var WASIThreads = /*#__PURE__*/ (function () { - function WASIThreads(options) { - var _this_1 = this; - if (!options) { - throw new TypeError('WASIThreads(): options is not provided'); - } - if (!options.wasi) { - throw new TypeError('WASIThreads(): options.wasi is not provided'); - } - patchedWasiInstances.set(this, new WeakSet()); - var wasi = options.wasi; - patchWasiInstance(this, wasi); - this.wasi = wasi; - if ('childThread' in options) { - this.childThread = Boolean(options.childThread); - } - else { - this.childThread = false; - } - this.PThread = undefined; - if ('threadManager' in options) { - if (typeof options.threadManager === 'function') { - this.PThread = options.threadManager(); - } - else { - this.PThread = options.threadManager; - } - } - else { - if (!this.childThread) { - this.PThread = new ThreadManager(options); - this.PThread.init(); - } - } - var waitThreadStart = false; - if ('waitThreadStart' in options) { - waitThreadStart = typeof options.waitThreadStart === 'number' ? options.waitThreadStart : Boolean(options.waitThreadStart); - } - var postMessage = getPostMessage(options); - if (this.childThread && typeof postMessage !== 'function') { - throw new TypeError('options.postMessage is not a function'); - } - this.postMessage = postMessage; - var wasm64 = Boolean(options.wasm64); - var threadSpawn = function (startArg, errorOrTid) { - var _a; - var EAGAIN = 6; - var isNewABI = errorOrTid !== undefined; - try { - checkSharedWasmMemory(_this_1.wasmMemory); - } - catch (err) { - (_a = _this_1.PThread) === null || _a === void 0 ? void 0 : _a.printErr(err.stack); - if (isNewABI) { - var struct_1 = new Int32Array(_this_1.wasmMemory.buffer, errorOrTid, 2); - Atomics.store(struct_1, 0, 1); - Atomics.store(struct_1, 1, EAGAIN); - Atomics.notify(struct_1, 1); - return 1; - } - else { - return -EAGAIN; - } - } - if (!isNewABI) { - var malloc = _this_1.wasmInstance.exports.malloc; - errorOrTid = wasm64 ? Number(malloc(BigInt(8))) : (malloc(8) >>> 0); - if (!errorOrTid) { - return -48; /* ENOMEM */ - } - } - var _free = _this_1.wasmInstance.exports.free; - var free = wasm64 ? function (ptr) { _free(BigInt(ptr)); } : _free; - var struct = new Int32Array(_this_1.wasmMemory.buffer, errorOrTid, 2); - Atomics.store(struct, 0, 0); - Atomics.store(struct, 1, 0); - if (_this_1.childThread) { - postMessage(createMessage('spawn-thread', { - startArg: startArg, - errorOrTid: errorOrTid - })); - Atomics.wait(struct, 1, 0); - var isError = Atomics.load(struct, 0); - var result = Atomics.load(struct, 1); - if (isNewABI) { - return isError; - } - free(errorOrTid); - return isError ? -result : result; - } - var shouldWait = waitThreadStart || (waitThreadStart === 0); - var sab; - if (shouldWait) { - sab = new Int32Array(new SharedArrayBuffer(16 + 8192)); - Atomics.store(sab, 0, 0); - } - var worker; - var tid; - var PThread = _this_1.PThread; - try { - worker = PThread.getNewWorker(sab); - if (!worker) { - throw new Error('failed to get new worker'); - } - tid = PThread.markId(worker); - if (ENVIRONMENT_IS_NODE) { - worker.unref(); - } - worker.postMessage(createMessage('start', { - tid: tid, - arg: startArg, - sab: sab - })); - if (shouldWait) { - if (typeof waitThreadStart === 'number') { - var waitResult = Atomics.wait(sab, 0, 0, waitThreadStart); - if (waitResult === 'timed-out') { - throw new Error('Spawning thread timed out. Please check if the worker is created successfully and if message is handled properly in the worker.'); - } - } - else { - Atomics.wait(sab, 0, 0); - } - var r = Atomics.load(sab, 0); - if (r > 1) { - throw deserizeErrorFromBuffer(sab.buffer); - } - } - } - catch (e) { - if (worker !== undefined && tid !== undefined) { - try { - PThread.cleanThread(worker, tid, true); - } - catch (_) { } - } - Atomics.store(struct, 0, 1); - Atomics.store(struct, 1, EAGAIN); - Atomics.notify(struct, 1); - PThread === null || PThread === void 0 ? void 0 : PThread.printErr(e.stack); - if (isNewABI) { - return 1; - } - free(errorOrTid); - return -EAGAIN; - } - Atomics.store(struct, 0, 0); - Atomics.store(struct, 1, tid); - Atomics.notify(struct, 1); - if (!shouldWait) { - worker.whenLoaded.catch(function (err) { - delete worker.whenLoaded; - PThread.cleanThread(worker, tid, true); - throw err; - }); - } - if (isNewABI) { - return 0; - } - free(errorOrTid); - return tid; - }; - this.threadSpawn = threadSpawn; - if (this.PThread) { - this.PThread.threadSpawn = threadSpawn; - } - } - WASIThreads.prototype.getImportObject = function () { - return { - wasi: { - 'thread-spawn': this.threadSpawn - } - }; - }; - WASIThreads.prototype.setup = function (wasmInstance, wasmModule, wasmMemory) { - wasmMemory !== null && wasmMemory !== void 0 ? wasmMemory : (wasmMemory = wasmInstance.exports.memory); - this.wasmInstance = wasmInstance; - this.wasmMemory = wasmMemory; - if (this.PThread) { - this.PThread.setup(wasmModule, wasmMemory); - } - }; - WASIThreads.prototype.preloadWorkers = function () { - if (this.PThread) { - return this.PThread.preloadWorkers(); - } - return Promise.resolve([]); - }; - /** - * It's ok to call this method to a WASI command module. - * - * in child thread, must call this method instead of {@link WASIThreads.start} even if it's a WASI command module - * - * @returns A proxied WebAssembly instance if in child thread, other wise the original instance - */ - WASIThreads.prototype.initialize = function (instance, module, memory) { - var exports = instance.exports; - memory !== null && memory !== void 0 ? memory : (memory = exports.memory); - if (this.childThread) { - instance = createInstanceProxy(instance, memory); - } - this.setup(instance, module, memory); - var wasi = this.wasi; - if (('_start' in exports) && (typeof exports._start === 'function')) { - if (this.childThread) { - wasi.start(instance); - try { - var kStarted = getWasiSymbol(wasi, 'kStarted'); - wasi[kStarted] = false; - } - catch (_) { } - } - else { - setupInstance(wasi, instance); - } - } - else { - wasi.initialize(instance); - } - return instance; - }; - /** - * Equivalent to calling {@link WASIThreads.initialize} and then calling {@link WASIInstance.start} - * ```js - * this.initialize(instance, module, memory) - * this.wasi.start(instance) - * ``` - */ - WASIThreads.prototype.start = function (instance, module, memory) { - var exports = instance.exports; - memory !== null && memory !== void 0 ? memory : (memory = exports.memory); - if (this.childThread) { - instance = createInstanceProxy(instance, memory); - } - this.setup(instance, module, memory); - var exitCode = this.wasi.start(instance); - return { exitCode: exitCode, instance: instance }; - }; - WASIThreads.prototype.terminateAllThreads = function () { - var _a; - if (!this.childThread) { - (_a = this.PThread) === null || _a === void 0 ? void 0 : _a.terminateAllThreads(); - } - else { - this.postMessage(createMessage('terminate-all-threads', {})); - } - }; - return WASIThreads; - }()); - function patchWasiInstance(wasiThreads, wasi) { - var patched = patchedWasiInstances.get(wasiThreads); - if (patched.has(wasi)) { - return; - } - var _this = wasiThreads; - var wasiImport = wasi.wasiImport; - if (wasiImport) { - var proc_exit_1 = wasiImport.proc_exit; - wasiImport.proc_exit = function (code) { - _this.terminateAllThreads(); - return proc_exit_1.call(this, code); - }; - } - if (!_this.childThread) { - var start_1 = wasi.start; - if (typeof start_1 === 'function') { - wasi.start = function (instance) { - try { - return start_1.call(this, instance); - } - catch (err) { - if (isTrapError(err)) { - _this.terminateAllThreads(); - } - throw err; - } - }; - } - } - patched.add(wasi); - } - function getWasiSymbol(wasi, description) { - var symbols = Object.getOwnPropertySymbols(wasi); - var selectDescription = function (description) { return function (s) { - if (s.description) { - return s.description === description; - } - return s.toString() === "Symbol(".concat(description, ")"); - }; }; - if (Array.isArray(description)) { - return description.map(function (d) { return symbols.filter(selectDescription(d))[0]; }); - } - return symbols.filter(selectDescription(description))[0]; - } - function setupInstance(wasi, instance) { - var _a = getWasiSymbol(wasi, ['kInstance', 'kSetMemory']), kInstance = _a[0], kSetMemory = _a[1]; - wasi[kInstance] = instance; - wasi[kSetMemory](instance.exports.memory); - } - - /** @public */ - var ThreadMessageHandler = /*#__PURE__*/ (function () { - function ThreadMessageHandler(options) { - var postMsg = getPostMessage(options); - if (typeof postMsg !== 'function') { - throw new TypeError('options.postMessage is not a function'); - } - this.postMessage = postMsg; - this.onLoad = options === null || options === void 0 ? void 0 : options.onLoad; - this.onError = typeof (options === null || options === void 0 ? void 0 : options.onError) === 'function' ? options.onError : function (_type, err) { throw err; }; - this.instance = undefined; - // this.module = undefined - this.messagesBeforeLoad = []; - } - /** @virtual */ - ThreadMessageHandler.prototype.instantiate = function (data) { - if (typeof this.onLoad === 'function') { - return this.onLoad(data); - } - throw new Error('ThreadMessageHandler.prototype.instantiate is not implemented'); - }; - /** @virtual */ - ThreadMessageHandler.prototype.handle = function (e) { - var _this = this; - var _a; - if ((_a = e === null || e === void 0 ? void 0 : e.data) === null || _a === void 0 ? void 0 : _a.__emnapi__) { - var type = e.data.__emnapi__.type; - var payload_1 = e.data.__emnapi__.payload; - try { - if (type === 'load') { - this._load(payload_1); - } - else if (type === 'start') { - this.handleAfterLoad(e, function () { - _this._start(payload_1); - }); - } - } - catch (err) { - this.onError(err, type); - } - } - }; - ThreadMessageHandler.prototype._load = function (payload) { - var _this = this; - if (this.instance !== undefined) - return; - var source; - try { - source = this.instantiate(payload); - } - catch (err) { - this._loaded(err, null, payload); - return; - } - var then = source && 'then' in source ? source.then : undefined; - if (typeof then === 'function') { - // eslint-disable-next-line @typescript-eslint/no-floating-promises - then.call(source, function (source) { _this._loaded(null, source, payload); }, function (err) { _this._loaded(err, null, payload); }); - } - else { - this._loaded(null, source, payload); - } - }; - ThreadMessageHandler.prototype._start = function (payload) { - var wasi_thread_start = this.instance.exports.wasi_thread_start; - if (typeof wasi_thread_start !== 'function') { - var err = new TypeError('wasi_thread_start is not exported'); - notifyPthreadCreateResult(payload.sab, 2, err); - throw err; - } - var postMessage = this.postMessage; - var tid = payload.tid; - var startArg = payload.arg; - notifyPthreadCreateResult(payload.sab, 1); - try { - wasi_thread_start(tid, startArg); - } - catch (err) { - if (err !== 'unwind') { - throw err; - } - else { - return; - } - } - postMessage(createMessage('cleanup-thread', { tid: tid })); - }; - ThreadMessageHandler.prototype._loaded = function (err, source, payload) { - if (err) { - notifyPthreadCreateResult(payload.sab, 2, err); - throw err; - } - if (source == null) { - var err_1 = new TypeError('onLoad should return an object'); - notifyPthreadCreateResult(payload.sab, 2, err_1); - throw err_1; - } - var instance = source.instance; - if (!instance) { - var err_2 = new TypeError('onLoad should return an object which includes "instance"'); - notifyPthreadCreateResult(payload.sab, 2, err_2); - throw err_2; - } - this.instance = instance; - var postMessage = this.postMessage; - postMessage(createMessage('loaded', {})); - var messages = this.messagesBeforeLoad; - this.messagesBeforeLoad = []; - for (var i = 0; i < messages.length; i++) { - var data = messages[i]; - this.handle({ data: data }); - } - }; - ThreadMessageHandler.prototype.handleAfterLoad = function (e, f) { - if (this.instance !== undefined) { - f.call(this, e); - } - else { - this.messagesBeforeLoad.push(e.data); - } - }; - return ThreadMessageHandler; - }()); - function notifyPthreadCreateResult(sab, result, error) { - if (sab) { - serizeErrorToBuffer(sab.buffer, result, error); - Atomics.notify(sab, 0); - } - } - - exports.ThreadManager = ThreadManager; - exports.ThreadMessageHandler = ThreadMessageHandler; - exports.WASIThreads = WASIThreads; - exports.createInstanceProxy = createInstanceProxy; - exports.isSharedArrayBuffer = isSharedArrayBuffer; - exports.isTrapError = isTrapError; - -})); diff --git a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.d.mts b/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.d.mts deleted file mode 100644 index 1d3951c36..000000000 --- a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.d.mts +++ /dev/null @@ -1,271 +0,0 @@ -/// - -import type { Worker as Worker_2 } from 'worker_threads'; - -/** @public */ -export declare interface BaseOptions { - wasi: WASIInstance; - version?: 'preview1'; - wasm64?: boolean; -} - -/** @public */ -export declare interface ChildThreadOptions extends BaseOptions { - childThread: true; - postMessage?: (data: any) => void; -} - -/** @public */ -export declare interface CleanupThreadPayload { - tid: number; -} - -/** @public */ -export declare interface CommandInfo { - type: T; - payload: CommandPayloadMap[T]; -} - -/** @public */ -export declare interface CommandPayloadMap { - load: LoadPayload; - loaded: LoadedPayload; - start: StartPayload; - 'cleanup-thread': CleanupThreadPayload; - 'terminate-all-threads': TerminateAllThreadsPayload; - 'spawn-thread': SpawnThreadPayload; -} - -/** @public */ -export declare type CommandType = keyof CommandPayloadMap; - -/** @public */ -export declare function createInstanceProxy(instance: WebAssembly.Instance, memory?: WebAssembly.Memory | (() => WebAssembly.Memory)): WebAssembly.Instance; - -/** @public */ -export declare function isSharedArrayBuffer(value: any): value is SharedArrayBuffer; - -/** @public */ -export declare function isTrapError(e: Error): e is WebAssembly.RuntimeError; - -/** @public */ -export declare interface LoadedPayload { -} - -/** @public */ -export declare interface LoadPayload { - wasmModule: WebAssembly.Module; - wasmMemory: WebAssembly.Memory; - sab?: Int32Array; -} - -/** @public */ -export declare interface MainThreadBaseOptions extends BaseOptions { - waitThreadStart?: boolean | number; -} - -/** @public */ -export declare type MainThreadOptions = MainThreadOptionsWithThreadManager | MainThreadOptionsCreateThreadManager; - -/** @public */ -export declare interface MainThreadOptionsCreateThreadManager extends MainThreadBaseOptions, ThreadManagerOptionsMain { -} - -/** @public */ -export declare interface MainThreadOptionsWithThreadManager extends MainThreadBaseOptions { - threadManager?: ThreadManager | (() => ThreadManager); -} - -/** @public */ -export declare interface MessageEventData { - __emnapi__: CommandInfo; -} - -/** @public */ -export declare interface ReuseWorkerOptions { - /** - * @see {@link https://emscripten.org/docs/tools_reference/settings_reference.html#pthread-pool-size | PTHREAD_POOL_SIZE} - */ - size: number; - /** - * @see {@link https://emscripten.org/docs/tools_reference/settings_reference.html#pthread-pool-size-strict | PTHREAD_POOL_SIZE_STRICT} - */ - strict?: boolean; -} - -/** @public */ -export declare interface SpawnThreadPayload { - startArg: number; - errorOrTid: number; -} - -/** @public */ -export declare interface StartPayload { - tid: number; - arg: number; - sab?: Int32Array; -} - -/** @public */ -export declare interface StartResult { - exitCode: number; - instance: WebAssembly.Instance; -} - -/** @public */ -export declare interface TerminateAllThreadsPayload { -} - -/** @public */ -export declare class ThreadManager { - unusedWorkers: WorkerLike[]; - pthreads: Record; - get nextWorkerID(): number; - wasmModule: WebAssembly.Module | null; - wasmMemory: WebAssembly.Memory | null; - private readonly messageEvents; - private readonly _childThread; - private readonly _onCreateWorker; - private readonly _reuseWorker; - private readonly _beforeLoad?; - /* Excluded from this release type: printErr */ - threadSpawn?: ((startArg: number, errorOrTid?: number) => number); - constructor(options: ThreadManagerOptions); - init(): void; - initMainThread(): void; - private preparePool; - shouldPreloadWorkers(): boolean; - loadWasmModuleToAllWorkers(): Promise; - preloadWorkers(): Promise; - setup(wasmModule: WebAssembly.Module, wasmMemory: WebAssembly.Memory): void; - markId(worker: WorkerLike): number; - returnWorkerToPool(worker: WorkerLike): void; - loadWasmModuleToWorker(worker: WorkerLike, sab?: Int32Array): Promise; - allocateUnusedWorker(): WorkerLike; - getNewWorker(sab?: Int32Array): WorkerLike | undefined; - cleanThread(worker: WorkerLike, tid: number, force?: boolean): void; - terminateWorker(worker: WorkerLike): void; - terminateAllThreads(): void; - addMessageEventListener(worker: WorkerLike, onMessage: (e: WorkerMessageEvent) => void): () => void; - fireMessageEvent(worker: WorkerLike, e: WorkerMessageEvent): void; -} - -/** @public */ -export declare type ThreadManagerOptions = ThreadManagerOptionsMain | ThreadManagerOptionsChild; - -/** @public */ -export declare interface ThreadManagerOptionsBase { - printErr?: (message: string) => void; - threadSpawn?: (startArg: number, errorOrTid?: number) => number; -} - -/** @public */ -export declare interface ThreadManagerOptionsChild extends ThreadManagerOptionsBase { - childThread: true; -} - -/** @public */ -export declare interface ThreadManagerOptionsMain extends ThreadManagerOptionsBase { - beforeLoad?: (worker: WorkerLike) => any; - reuseWorker?: boolean | number | ReuseWorkerOptions; - onCreateWorker: WorkerFactory; - childThread?: false; -} - -/** @public */ -export declare class ThreadMessageHandler { - protected instance: WebAssembly.Instance | undefined; - private messagesBeforeLoad; - protected postMessage: (message: any) => void; - protected onLoad?: (data: LoadPayload) => WebAssembly.WebAssemblyInstantiatedSource | PromiseLike; - protected onError: (error: Error, type: WorkerMessageType) => void; - constructor(options?: ThreadMessageHandlerOptions); - /** @virtual */ - instantiate(data: LoadPayload): WebAssembly.WebAssemblyInstantiatedSource | PromiseLike; - /** @virtual */ - handle(e: WorkerMessageEvent>): void; - private _load; - private _start; - protected _loaded(err: Error | null, source: WebAssembly.WebAssemblyInstantiatedSource | null, payload: LoadPayload): void; - protected handleAfterLoad(e: E, f: (e: E) => void): void; -} - -/** @public */ -export declare interface ThreadMessageHandlerOptions { - onLoad?: (data: LoadPayload) => WebAssembly.WebAssemblyInstantiatedSource | PromiseLike; - onError?: (error: Error, type: WorkerMessageType) => void; - postMessage?: (message: any) => void; -} - -/** @public */ -export declare interface WASIInstance { - readonly wasiImport?: Record; - initialize(instance: object): void; - start(instance: object): number; - getImportObject?(): any; -} - -/** @public */ -export declare class WASIThreads { - PThread: ThreadManager | undefined; - private wasmMemory; - private wasmInstance; - private readonly threadSpawn; - readonly childThread: boolean; - private readonly postMessage; - readonly wasi: WASIInstance; - constructor(options: WASIThreadsOptions); - getImportObject(): { - wasi: WASIThreadsImports; - }; - setup(wasmInstance: WebAssembly.Instance, wasmModule: WebAssembly.Module, wasmMemory?: WebAssembly.Memory): void; - preloadWorkers(): Promise; - /** - * It's ok to call this method to a WASI command module. - * - * in child thread, must call this method instead of {@link WASIThreads.start} even if it's a WASI command module - * - * @returns A proxied WebAssembly instance if in child thread, other wise the original instance - */ - initialize(instance: WebAssembly.Instance, module: WebAssembly.Module, memory?: WebAssembly.Memory): WebAssembly.Instance; - /** - * Equivalent to calling {@link WASIThreads.initialize} and then calling {@link WASIInstance.start} - * ```js - * this.initialize(instance, module, memory) - * this.wasi.start(instance) - * ``` - */ - start(instance: WebAssembly.Instance, module: WebAssembly.Module, memory?: WebAssembly.Memory): StartResult; - terminateAllThreads(): void; -} - -/** @public */ -export declare interface WASIThreadsImports { - 'thread-spawn': (startArg: number, errorOrTid?: number) => number; -} - -/** @public */ -export declare type WASIThreadsOptions = MainThreadOptions | ChildThreadOptions; - -/** @public */ -export declare type WorkerFactory = (ctx: { - type: string; - name: string; -}) => WorkerLike; - -/** @public */ -export declare type WorkerLike = (Worker | Worker_2) & { - whenLoaded?: Promise; - loaded?: boolean; - __emnapi_tid?: number; -}; - -/** @public */ -export declare interface WorkerMessageEvent { - data: T; -} - -/** @public */ -export declare type WorkerMessageType = 'load' | 'start'; - -export { } diff --git a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.js b/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.js deleted file mode 100644 index 8de84f3cf..000000000 --- a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).wasiThreads={})}(this,function(e){var t="undefined"!=typeof WebAssembly?WebAssembly:"undefined"!=typeof WXWebAssembly?WXWebAssembly:void 0,r="object"==typeof process&&null!==process&&"object"==typeof process.versions&&null!==process.versions&&"string"==typeof process.versions.node;function o(e){return"function"==typeof(null==e?void 0:e.postMessage)?e.postMessage:"function"==typeof postMessage?postMessage:void 0}function n(e){return"function"==typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||"[object SharedArrayBuffer]"===Object.prototype.toString.call(e)}function i(e){try{return e instanceof t.RuntimeError}catch(e){return!1}}function a(e,t){return{__emnapi__:{type:e,payload:t}}}function s(e){if(e){if(!n(e.buffer))throw new Error("Multithread features require shared wasm memory. Try to compile with `-matomics -mbulk-memory` and use `--import-memory --shared-memory` during linking, then create WebAssembly.Memory with `shared: true` option")}else if("undefined"==typeof SharedArrayBuffer)throw new Error("Current environment does not support SharedArrayBuffer, threads are not available!")}var d=0,h=function(){function e(e){var t;if(this.unusedWorkers=[],this.pthreads=Object.create(null),this.wasmModule=null,this.wasmMemory=null,this.messageEvents=new WeakMap,!e)throw new TypeError("ThreadManager(): options is not provided");this._childThread="childThread"in e&&Boolean(e.childThread),this._childThread?(this._onCreateWorker=void 0,this._reuseWorker=!1,this._beforeLoad=void 0):(this._onCreateWorker=e.onCreateWorker,this._reuseWorker=function(e){var t;if("boolean"==typeof e)return!!e&&{size:0,strict:!1};if("number"==typeof e){if(!(e>=0))throw new RangeError("reuseWorker: size must be a non-negative integer");return{size:e,strict:!1}}if(!e)return!1;var r=null!==(t=Number(e.size))&&void 0!==t?t:0,o=Boolean(e.strict);if(!(r>0)&&o)throw new RangeError("reuseWorker: size must be set to positive integer if strict is set to true");return{size:r,strict:o}}(e.reuseWorker),this._beforeLoad=e.beforeLoad),this.printErr=null!==(t=e.printErr)&&void 0!==t?t:console.error.bind(console),this.threadSpawn=e.threadSpawn}return Object.defineProperty(e.prototype,"nextWorkerID",{get:function(){return d},enumerable:!1,configurable:!0}),e.prototype.init=function(){this._childThread||this.initMainThread()},e.prototype.initMainThread=function(){this.preparePool()},e.prototype.preparePool=function(){if(this._reuseWorker&&this._reuseWorker.size)for(var e=this._reuseWorker.size;e--;){var t=this.allocateUnusedWorker();r&&(t.once("message",function(){}),t.unref())}},e.prototype.shouldPreloadWorkers=function(){return!this._childThread&&this._reuseWorker&&this._reuseWorker.size>0},e.prototype.loadWasmModuleToAllWorkers=function(){for(var e=this,t=Array(this.unusedWorkers.length),o=function(e){var o=n.unusedWorkers[e];r&&o.ref(),t[e]=n.loadWasmModuleToWorker(o).then(function(e){return r&&o.unref(),e},function(e){throw r&&o.unref(),e})},n=this,i=0;i>>0))return-48}var p=n.wasmInstance.exports.free,m=f?function(e){p(BigInt(e))}:p,y=new Int32Array(n.wasmMemory.buffer,o,2);if(Atomics.store(y,0,0),Atomics.store(y,1,0),n.childThread){l(a("spawn-thread",{startArg:e,errorOrTid:o})),Atomics.wait(y,1,0);var v=Atomics.load(y,0),w=Atomics.load(y,1);return d?v:(m(o),v?-w:w)}var _,g,T,k=u||0===u;k&&(_=new Int32Array(new SharedArrayBuffer(8208)),Atomics.store(_,0,0));var W=n.PThread;try{if(!(g=W.getNewWorker(_)))throw new Error("failed to get new worker");if(T=W.markId(g),r&&g.unref(),g.postMessage(a("start",{tid:T,arg:e,sab:_})),k){if("number"==typeof u){if("timed-out"===Atomics.wait(_,0,0,u))throw new Error("Spawning thread timed out. Please check if the worker is created successfully and if message is handled properly in the worker.")}else Atomics.wait(_,0,0);if(Atomics.load(_,0)>1)throw function(e){var r,o,n=new Int32Array(e);if(Atomics.load(n,0)<=1)return null;var i=Atomics.load(n,1),a=Atomics.load(n,2),s=Atomics.load(n,3),d=new Uint8Array(e),h=d.slice(16,16+i),u=d.slice(16+i,16+i+a),l=d.slice(16+i+a,16+i+a+s),c=(new TextDecoder).decode(h),f=(new TextDecoder).decode(u),p=(new TextDecoder).decode(l),m=new(null!==(r=globalThis[c])&&void 0!==r?r:"RuntimeError"===c&&null!==(o=t.RuntimeError)&&void 0!==o?o:Error)(f);return Object.defineProperty(m,"stack",{value:p,writable:!0,enumerable:!1,configurable:!0}),m}(_.buffer)}}catch(e){if(void 0!==g&&void 0!==T)try{W.cleanThread(g,T,!0)}catch(e){}return Atomics.store(y,0,1),Atomics.store(y,1,6),Atomics.notify(y,1),null==W||W.printErr(e.stack),d?1:(m(o),-6)}return Atomics.store(y,0,0),Atomics.store(y,1,T),Atomics.notify(y,1),k||g.whenLoaded.catch(function(e){throw delete g.whenLoaded,W.cleanThread(g,T,!0),e}),d?0:(m(o),T)};this.threadSpawn=p,this.PThread&&(this.PThread.threadSpawn=p)}return e.prototype.getImportObject=function(){return{wasi:{"thread-spawn":this.threadSpawn}}},e.prototype.setup=function(e,t,r){null!=r||(r=e.exports.memory),this.wasmInstance=e,this.wasmMemory=r,this.PThread&&this.PThread.setup(t,r)},e.prototype.preloadWorkers=function(){return this.PThread?this.PThread.preloadWorkers():Promise.resolve([])},e.prototype.initialize=function(e,t,r){var o=e.exports;null!=r||(r=o.memory),this.childThread&&(e=l(e,r)),this.setup(e,t,r);var n=this.wasi;if("_start"in o&&"function"==typeof o._start)if(this.childThread){n.start(e);try{n[p(n,"kStarted")]=!1}catch(e){}}else!function(e,t){var r=p(e,["kInstance","kSetMemory"]),o=r[0],n=r[1];e[o]=t,e[n](t.exports.memory)}(n,e);else n.initialize(e);return e},e.prototype.start=function(e,t,r){var o=e.exports;return null!=r||(r=o.memory),this.childThread&&(e=l(e,r)),this.setup(e,t,r),{exitCode:this.wasi.start(e),instance:e}},e.prototype.terminateAllThreads=function(){var e;this.childThread?this.postMessage(a("terminate-all-threads",{})):null===(e=this.PThread)||void 0===e||e.terminateAllThreads()},e}();function p(e,t){var r=Object.getOwnPropertySymbols(e),o=function(e){return function(t){return t.description?t.description===e:t.toString()==="Symbol(".concat(e,")")}};return Array.isArray(t)?t.map(function(e){return r.filter(o(e))[0]}):r.filter(o(t))[0]}var m=function(){function e(e){var t=o(e);if("function"!=typeof t)throw new TypeError("options.postMessage is not a function");this.postMessage=t,this.onLoad=null==e?void 0:e.onLoad,this.onError="function"==typeof(null==e?void 0:e.onError)?e.onError:function(e,t){throw t},this.instance=void 0,this.messagesBeforeLoad=[]}return e.prototype.instantiate=function(e){if("function"==typeof this.onLoad)return this.onLoad(e);throw new Error("ThreadMessageHandler.prototype.instantiate is not implemented")},e.prototype.handle=function(e){var t,r=this;if(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.__emnapi__){var o=e.data.__emnapi__.type,n=e.data.__emnapi__.payload;try{"load"===o?this._load(n):"start"===o&&this.handleAfterLoad(e,function(){r._start(n)})}catch(e){this.onError(e,o)}}},e.prototype._load=function(e){var t=this;if(void 0===this.instance){var r;try{r=this.instantiate(e)}catch(t){return void this._loaded(t,null,e)}var o=r&&"then"in r?r.then:void 0;"function"==typeof o?o.call(r,function(r){t._loaded(null,r,e)},function(r){t._loaded(r,null,e)}):this._loaded(null,r,e)}},e.prototype._start=function(e){var t=this.instance.exports.wasi_thread_start;if("function"!=typeof t){var r=new TypeError("wasi_thread_start is not exported");throw y(e.sab,2,r),r}var o=this.postMessage,n=e.tid,i=e.arg;y(e.sab,1);try{t(n,i)}catch(r){if("unwind"!==r)throw r;return}o(a("cleanup-thread",{tid:n}))},e.prototype._loaded=function(e,t,r){if(e)throw y(r.sab,2,e),e;if(null==t){var o=new TypeError("onLoad should return an object");throw y(r.sab,2,o),o}var n=t.instance;if(!n){var i=new TypeError('onLoad should return an object which includes "instance"');throw y(r.sab,2,i),i}this.instance=n,(0,this.postMessage)(a("loaded",{}));var s=this.messagesBeforeLoad;this.messagesBeforeLoad=[];for(var d=0;d1&&r){var n=r.name,i=r.message,a=r.stack,s=(new TextEncoder).encode(n),d=(new TextEncoder).encode(i),h=(new TextEncoder).encode(a);Atomics.store(o,1,s.length),Atomics.store(o,2,d.length),Atomics.store(o,3,h.length);var u=new Uint8Array(e);u.set(s,16),u.set(d,16+s.length),u.set(h,16+s.length+d.length)}}(e.buffer,t,r),Atomics.notify(e,0))}e.ThreadManager=h,e.ThreadMessageHandler=m,e.WASIThreads=f,e.createInstanceProxy=l,e.isSharedArrayBuffer=n,e.isTrapError=i}); diff --git a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.mjs b/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.mjs deleted file mode 100644 index ed9dd0026..000000000 --- a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.mjs +++ /dev/null @@ -1 +0,0 @@ -const e="undefined"!=typeof WebAssembly?WebAssembly:"undefined"!=typeof WXWebAssembly?WXWebAssembly:void 0,t="object"==typeof process&&null!==process&&"object"==typeof process.versions&&null!==process.versions&&"string"==typeof process.versions.node;function r(e){return"function"==typeof(null==e?void 0:e.postMessage)?e.postMessage:"function"==typeof postMessage?postMessage:void 0}function s(e){return"function"==typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||"[object SharedArrayBuffer]"===Object.prototype.toString.call(e)}function o(t){try{return t instanceof e.RuntimeError}catch(e){return!1}}function n(e,t){return{__emnapi__:{type:e,payload:t}}}function i(e){if(e){if(!s(e.buffer))throw new Error("Multithread features require shared wasm memory. Try to compile with `-matomics -mbulk-memory` and use `--import-memory --shared-memory` during linking, then create WebAssembly.Memory with `shared: true` option")}else if("undefined"==typeof SharedArrayBuffer)throw new Error("Current environment does not support SharedArrayBuffer, threads are not available!")}let a=0;class h{get nextWorkerID(){return a}constructor(e){var t;if(this.unusedWorkers=[],this.pthreads=Object.create(null),this.wasmModule=null,this.wasmMemory=null,this.messageEvents=new WeakMap,!e)throw new TypeError("ThreadManager(): options is not provided");this._childThread="childThread"in e&&Boolean(e.childThread),this._childThread?(this._onCreateWorker=void 0,this._reuseWorker=!1,this._beforeLoad=void 0):(this._onCreateWorker=e.onCreateWorker,this._reuseWorker=function(e){var t;if("boolean"==typeof e)return!!e&&{size:0,strict:!1};if("number"==typeof e){if(!(e>=0))throw new RangeError("reuseWorker: size must be a non-negative integer");return{size:e,strict:!1}}if(!e)return!1;const r=null!==(t=Number(e.size))&&void 0!==t?t:0,s=Boolean(e.strict);if(!(r>0)&&s)throw new RangeError("reuseWorker: size must be set to positive integer if strict is set to true");return{size:r,strict:s}}(e.reuseWorker),this._beforeLoad=e.beforeLoad),this.printErr=null!==(t=e.printErr)&&void 0!==t?t:console.error.bind(console),this.threadSpawn=e.threadSpawn}init(){this._childThread||this.initMainThread()}initMainThread(){this.preparePool()}preparePool(){if(this._reuseWorker&&this._reuseWorker.size){let e=this._reuseWorker.size;for(;e--;){const e=this.allocateUnusedWorker();t&&(e.once("message",()=>{}),e.unref())}}}shouldPreloadWorkers(){return!this._childThread&&this._reuseWorker&&this._reuseWorker.size>0}loadWasmModuleToAllWorkers(){const e=Array(this.unusedWorkers.length);for(let r=0;r(t&&s.unref(),e),e=>{throw t&&s.unref(),e})}return Promise.all(e).catch(e=>{throw this.terminateAllThreads(),e})}preloadWorkers(){return this.shouldPreloadWorkers()?this.loadWasmModuleToAllWorkers():Promise.resolve([])}setup(e,t){this.wasmModule=e,this.wasmMemory=t}markId(e){if(e.__emnapi_tid)return e.__emnapi_tid;const t=a+43;return a=(a+1)%536870869,this.pthreads[t]=e,e.__emnapi_tid=t,t}returnWorkerToPool(e){var r=e.__emnapi_tid;void 0!==r&&delete this.pthreads[r],this.unusedWorkers.push(e),delete e.__emnapi_tid,t&&e.unref()}loadWasmModuleToWorker(e,r){if(e.whenLoaded)return e.whenLoaded;const s=this.printErr,o=this._beforeLoad,a=this;return e.whenLoaded=new Promise((h,d)=>{const l=r=>{if(r.__emnapi__){const s=r.__emnapi__.type,o=r.__emnapi__.payload;"loaded"===s?(e.loaded=!0,t&&!e.__emnapi_tid&&e.unref(),h(e)):"cleanup-thread"===s?o.tid in this.pthreads&&this.cleanThread(e,o.tid):"spawn-thread"===s?this.threadSpawn(o.startArg,o.errorOrTid):"terminate-all-threads"===s&&this.terminateAllThreads()}};e.onmessage=t=>{l(t.data),this.fireMessageEvent(e,t)},e.onerror=function(t){let r="worker sent an error!";if(void 0!==e.__emnapi_tid&&(r="worker (tid = "+e.__emnapi_tid+") sent an error!"),"message"in t){if(s(r+" "+t.message),-1!==t.message.indexOf("RuntimeError")||-1!==t.message.indexOf("unreachable"))try{a.terminateAllThreads()}catch(e){}}else s(r);throw d(t),t},t&&(e.on("message",function(t){var r,s;null===(s=(r=e).onmessage)||void 0===s||s.call(r,{data:t})}),e.on("error",function(t){var r,s;null===(s=(r=e).onerror)||void 0===s||s.call(r,t)}),e.on("detachedExit",function(){})),"function"==typeof o&&o(e);try{e.postMessage(n("load",{wasmModule:this.wasmModule,wasmMemory:this.wasmMemory,sab:r}))}catch(e){throw i(this.wasmMemory),e}}),e.whenLoaded}allocateUnusedWorker(){const e=this._onCreateWorker;if("function"!=typeof e)throw new TypeError("`options.onCreateWorker` is not provided");const t=e({type:"thread",name:"emnapi-pthread"});return this.unusedWorkers.push(t),t}getNewWorker(e){if(this._reuseWorker){if(0===this.unusedWorkers.length){if(this._reuseWorker.strict&&!t){return void(0,this.printErr)("Tried to spawn a new thread, but the thread pool is exhausted.\nThis might result in a deadlock unless some threads eventually exit or the code explicitly breaks out to the event loop.")}const r=this.allocateUnusedWorker();this.loadWasmModuleToWorker(r,e)}return this.unusedWorkers.pop()}const r=this.allocateUnusedWorker();return this.loadWasmModuleToWorker(r,e),this.unusedWorkers.pop()}cleanThread(e,t,r){!r&&this._reuseWorker?this.returnWorkerToPool(e):(delete this.pthreads[t],this.terminateWorker(e),delete e.__emnapi_tid)}terminateWorker(e){var t;const r=e.__emnapi_tid;e.terminate(),null===(t=this.messageEvents.get(e))||void 0===t||t.clear(),this.messageEvents.delete(e),e.onmessage=e=>{if(e.data.__emnapi__){(0,this.printErr)('received "'+e.data.__emnapi__.type+'" command from terminated worker: '+r)}}}terminateAllThreads(){const e=Object.values(this.pthreads);for(let t=0;t{null==r||r.delete(t)}}fireMessageEvent(e,t){const r=this.messageEvents.get(e);if(!r)return;const s=this.printErr;r.forEach(e=>{try{e(t)}catch(e){s(e.stack)}})}}const d=Symbol("kIsProxy");function l(e,t){if(e[d])return e;const r=e.exports,s=function(e){const t=["apply","construct","defineProperty","deleteProperty","get","getOwnPropertyDescriptor","getPrototypeOf","has","isExtensible","ownKeys","preventExtensions","set","setPrototypeOf"],r={};for(let s=0;s{},n=()=>0;s.get=function(e,s,i){var a;return"memory"===s?null!==(a="function"==typeof t?t():t)&&void 0!==a?a:Reflect.get(r,s,i):"_initialize"===s?s in r?o:void 0:"_start"===s?s in r?n:void 0:Reflect.get(r,s,i)},s.has=function(e,t){return"memory"===t||Reflect.has(r,t)};const i=new Proxy(Object.create(null),s);return new Proxy(e,{get:(e,t,r)=>"exports"===t?i:t===d||Reflect.get(e,t,r)})}const c=new WeakMap;class u{constructor(s){if(!s)throw new TypeError("WASIThreads(): options is not provided");if(!s.wasi)throw new TypeError("WASIThreads(): options.wasi is not provided");c.set(this,new WeakSet);const a=s.wasi;!function(e,t){const r=c.get(e);if(r.has(t))return;const s=e,n=t.wasiImport;if(n){const e=n.proc_exit;n.proc_exit=function(t){return s.terminateAllThreads(),e.call(this,t)}}if(!s.childThread){const e=t.start;"function"==typeof e&&(t.start=function(t){try{return e.call(this,t)}catch(e){throw o(e)&&s.terminateAllThreads(),e}})}r.add(t)}(this,a),this.wasi=a,this.childThread="childThread"in s&&Boolean(s.childThread),this.PThread=void 0,"threadManager"in s?"function"==typeof s.threadManager?this.PThread=s.threadManager():this.PThread=s.threadManager:this.childThread||(this.PThread=new h(s),this.PThread.init());let d=!1;"waitThreadStart"in s&&(d="number"==typeof s.waitThreadStart?s.waitThreadStart:Boolean(s.waitThreadStart));const l=r(s);if(this.childThread&&"function"!=typeof l)throw new TypeError("options.postMessage is not a function");this.postMessage=l;const u=Boolean(s.wasm64),f=(r,s)=>{var o;const a=void 0!==s;try{i(this.wasmMemory)}catch(e){if(null===(o=this.PThread)||void 0===o||o.printErr(e.stack),a){const e=new Int32Array(this.wasmMemory.buffer,s,2);return Atomics.store(e,0,1),Atomics.store(e,1,6),Atomics.notify(e,1),1}return-6}if(!a){const e=this.wasmInstance.exports.malloc;if(!(s=u?Number(e(BigInt(8))):e(8)>>>0))return-48}const h=this.wasmInstance.exports.free,c=u?e=>{h(BigInt(e))}:h,f=new Int32Array(this.wasmMemory.buffer,s,2);if(Atomics.store(f,0,0),Atomics.store(f,1,0),this.childThread){l(n("spawn-thread",{startArg:r,errorOrTid:s})),Atomics.wait(f,1,0);const e=Atomics.load(f,0),t=Atomics.load(f,1);return a?e:(c(s),e?-t:t)}const p=d||0===d;let m,w,y;p&&(m=new Int32Array(new SharedArrayBuffer(8208)),Atomics.store(m,0,0));const _=this.PThread;try{if(w=_.getNewWorker(m),!w)throw new Error("failed to get new worker");if(y=_.markId(w),t&&w.unref(),w.postMessage(n("start",{tid:y,arg:r,sab:m})),p){if("number"==typeof d){if("timed-out"===Atomics.wait(m,0,0,d))throw new Error("Spawning thread timed out. Please check if the worker is created successfully and if message is handled properly in the worker.")}else Atomics.wait(m,0,0);if(Atomics.load(m,0)>1)throw function(t){var r,s;const o=new Int32Array(t);if(Atomics.load(o,0)<=1)return null;const n=Atomics.load(o,1),i=Atomics.load(o,2),a=Atomics.load(o,3),h=new Uint8Array(t),d=h.slice(16,16+n),l=h.slice(16+n,16+n+i),c=h.slice(16+n+i,16+n+i+a),u=(new TextDecoder).decode(d),f=(new TextDecoder).decode(l),p=(new TextDecoder).decode(c),m=new(null!==(r=globalThis[u])&&void 0!==r?r:"RuntimeError"===u&&null!==(s=e.RuntimeError)&&void 0!==s?s:Error)(f);return Object.defineProperty(m,"stack",{value:p,writable:!0,enumerable:!1,configurable:!0}),m}(m.buffer)}}catch(e){if(void 0!==w&&void 0!==y)try{_.cleanThread(w,y,!0)}catch(e){}return Atomics.store(f,0,1),Atomics.store(f,1,6),Atomics.notify(f,1),null==_||_.printErr(e.stack),a?1:(c(s),-6)}return Atomics.store(f,0,0),Atomics.store(f,1,y),Atomics.notify(f,1),p||w.whenLoaded.catch(e=>{throw delete w.whenLoaded,_.cleanThread(w,y,!0),e}),a?0:(c(s),y)};this.threadSpawn=f,this.PThread&&(this.PThread.threadSpawn=f)}getImportObject(){return{wasi:{"thread-spawn":this.threadSpawn}}}setup(e,t,r){null!=r||(r=e.exports.memory),this.wasmInstance=e,this.wasmMemory=r,this.PThread&&this.PThread.setup(t,r)}preloadWorkers(){return this.PThread?this.PThread.preloadWorkers():Promise.resolve([])}initialize(e,t,r){const s=e.exports;null!=r||(r=s.memory),this.childThread&&(e=l(e,r)),this.setup(e,t,r);const o=this.wasi;if("_start"in s&&"function"==typeof s._start)if(this.childThread){o.start(e);try{o[f(o,"kStarted")]=!1}catch(e){}}else!function(e,t){const[r,s]=f(e,["kInstance","kSetMemory"]);e[r]=t,e[s](t.exports.memory)}(o,e);else o.initialize(e);return e}start(e,t,r){const s=e.exports;null!=r||(r=s.memory),this.childThread&&(e=l(e,r)),this.setup(e,t,r);return{exitCode:this.wasi.start(e),instance:e}}terminateAllThreads(){var e;this.childThread?this.postMessage(n("terminate-all-threads",{})):null===(e=this.PThread)||void 0===e||e.terminateAllThreads()}}function f(e,t){const r=Object.getOwnPropertySymbols(e),s=e=>t=>t.description?t.description===e:t.toString()===`Symbol(${e})`;return Array.isArray(t)?t.map(e=>r.filter(s(e))[0]):r.filter(s(t))[0]}class p{constructor(e){const t=r(e);if("function"!=typeof t)throw new TypeError("options.postMessage is not a function");this.postMessage=t,this.onLoad=null==e?void 0:e.onLoad,this.onError="function"==typeof(null==e?void 0:e.onError)?e.onError:(e,t)=>{throw t},this.instance=void 0,this.messagesBeforeLoad=[]}instantiate(e){if("function"==typeof this.onLoad)return this.onLoad(e);throw new Error("ThreadMessageHandler.prototype.instantiate is not implemented")}handle(e){var t;if(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.__emnapi__){const t=e.data.__emnapi__.type,r=e.data.__emnapi__.payload;try{"load"===t?this._load(r):"start"===t&&this.handleAfterLoad(e,()=>{this._start(r)})}catch(e){this.onError(e,t)}}}_load(e){if(void 0!==this.instance)return;let t;try{t=this.instantiate(e)}catch(t){return void this._loaded(t,null,e)}const r=t&&"then"in t?t.then:void 0;"function"==typeof r?r.call(t,t=>{this._loaded(null,t,e)},t=>{this._loaded(t,null,e)}):this._loaded(null,t,e)}_start(e){const t=this.instance.exports.wasi_thread_start;if("function"!=typeof t){const t=new TypeError("wasi_thread_start is not exported");throw m(e.sab,2,t),t}const r=this.postMessage,s=e.tid,o=e.arg;m(e.sab,1);try{t(s,o)}catch(e){if("unwind"!==e)throw e;return}r(n("cleanup-thread",{tid:s}))}_loaded(e,t,r){if(e)throw m(r.sab,2,e),e;if(null==t){const e=new TypeError("onLoad should return an object");throw m(r.sab,2,e),e}const s=t.instance;if(!s){const e=new TypeError('onLoad should return an object which includes "instance"');throw m(r.sab,2,e),e}this.instance=s;(0,this.postMessage)(n("loaded",{}));const o=this.messagesBeforeLoad;this.messagesBeforeLoad=[];for(let e=0;e1&&r){const t=r.name,o=r.message,n=r.stack,i=(new TextEncoder).encode(t),a=(new TextEncoder).encode(o),h=(new TextEncoder).encode(n);Atomics.store(s,1,i.length),Atomics.store(s,2,a.length),Atomics.store(s,3,h.length);const d=new Uint8Array(e);d.set(i,16),d.set(a,16+i.length),d.set(h,16+i.length+a.length)}}(e.buffer,t,r),Atomics.notify(e,0))}export{h as ThreadManager,p as ThreadMessageHandler,u as WASIThreads,l as createInstanceProxy,s as isSharedArrayBuffer,o as isTrapError}; diff --git a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.mjs b/node_modules/@emnapi/wasi-threads/dist/wasi-threads.mjs deleted file mode 100644 index dd8c52915..000000000 --- a/node_modules/@emnapi/wasi-threads/dist/wasi-threads.mjs +++ /dev/null @@ -1,880 +0,0 @@ -const _WebAssembly = typeof WebAssembly !== 'undefined' - ? WebAssembly - : typeof WXWebAssembly !== 'undefined' - ? WXWebAssembly - : undefined; -const ENVIRONMENT_IS_NODE = typeof process === 'object' && process !== null && - typeof process.versions === 'object' && process.versions !== null && - typeof process.versions.node === 'string'; -function getPostMessage(options) { - return typeof (options === null || options === void 0 ? void 0 : options.postMessage) === 'function' - ? options.postMessage - : typeof postMessage === 'function' - ? postMessage - : undefined; -} -function serizeErrorToBuffer(sab, code, error) { - const i32array = new Int32Array(sab); - Atomics.store(i32array, 0, code); - if (code > 1 && error) { - const name = error.name; - const message = error.message; - const stack = error.stack; - const nameBuffer = new TextEncoder().encode(name); - const messageBuffer = new TextEncoder().encode(message); - const stackBuffer = new TextEncoder().encode(stack); - Atomics.store(i32array, 1, nameBuffer.length); - Atomics.store(i32array, 2, messageBuffer.length); - Atomics.store(i32array, 3, stackBuffer.length); - const buffer = new Uint8Array(sab); - buffer.set(nameBuffer, 16); - buffer.set(messageBuffer, 16 + nameBuffer.length); - buffer.set(stackBuffer, 16 + nameBuffer.length + messageBuffer.length); - } -} -function deserizeErrorFromBuffer(sab) { - var _a, _b; - const i32array = new Int32Array(sab); - const status = Atomics.load(i32array, 0); - if (status <= 1) { - return null; - } - const nameLength = Atomics.load(i32array, 1); - const messageLength = Atomics.load(i32array, 2); - const stackLength = Atomics.load(i32array, 3); - const buffer = new Uint8Array(sab); - const nameBuffer = buffer.slice(16, 16 + nameLength); - const messageBuffer = buffer.slice(16 + nameLength, 16 + nameLength + messageLength); - const stackBuffer = buffer.slice(16 + nameLength + messageLength, 16 + nameLength + messageLength + stackLength); - const name = new TextDecoder().decode(nameBuffer); - const message = new TextDecoder().decode(messageBuffer); - const stack = new TextDecoder().decode(stackBuffer); - const ErrorConstructor = (_a = globalThis[name]) !== null && _a !== void 0 ? _a : (name === 'RuntimeError' ? ((_b = _WebAssembly.RuntimeError) !== null && _b !== void 0 ? _b : Error) : Error); - const error = new ErrorConstructor(message); - Object.defineProperty(error, 'stack', { - value: stack, - writable: true, - enumerable: false, - configurable: true - }); - return error; -} -function isSharedArrayBuffer(value) { - return ((typeof SharedArrayBuffer === 'function' && value instanceof SharedArrayBuffer) || - (Object.prototype.toString.call(value) === '[object SharedArrayBuffer]')); -} -function isTrapError(e) { - try { - return e instanceof _WebAssembly.RuntimeError; - } - catch (_) { - return false; - } -} - -function createMessage(type, payload) { - return { - __emnapi__: { - type, - payload - } - }; -} - -const WASI_THREADS_MAX_TID = 0x1FFFFFFF; -function checkSharedWasmMemory(wasmMemory) { - if (wasmMemory) { - if (!isSharedArrayBuffer(wasmMemory.buffer)) { - throw new Error('Multithread features require shared wasm memory. ' + - 'Try to compile with `-matomics -mbulk-memory` and use `--import-memory --shared-memory` during linking, ' + - 'then create WebAssembly.Memory with `shared: true` option'); - } - } - else { - if (typeof SharedArrayBuffer === 'undefined') { - throw new Error('Current environment does not support SharedArrayBuffer, threads are not available!'); - } - } -} -function getReuseWorker(value) { - var _a; - if (typeof value === 'boolean') { - return value ? { size: 0, strict: false } : false; - } - if (typeof value === 'number') { - if (!(value >= 0)) { - throw new RangeError('reuseWorker: size must be a non-negative integer'); - } - return { size: value, strict: false }; - } - if (!value) { - return false; - } - const size = (_a = Number(value.size)) !== null && _a !== void 0 ? _a : 0; - const strict = Boolean(value.strict); - if (!(size > 0) && strict) { - throw new RangeError('reuseWorker: size must be set to positive integer if strict is set to true'); - } - return { size, strict }; -} -let nextWorkerID = 0; -class ThreadManager { - get nextWorkerID() { return nextWorkerID; } - constructor(options) { - var _a; - this.unusedWorkers = []; - this.pthreads = Object.create(null); - this.wasmModule = null; - this.wasmMemory = null; - this.messageEvents = new WeakMap(); - if (!options) { - throw new TypeError('ThreadManager(): options is not provided'); - } - if ('childThread' in options) { - this._childThread = Boolean(options.childThread); - } - else { - this._childThread = false; - } - if (this._childThread) { - this._onCreateWorker = undefined; - this._reuseWorker = false; - this._beforeLoad = undefined; - } - else { - this._onCreateWorker = options.onCreateWorker; - this._reuseWorker = getReuseWorker(options.reuseWorker); - this._beforeLoad = options.beforeLoad; - } - this.printErr = (_a = options.printErr) !== null && _a !== void 0 ? _a : console.error.bind(console); - this.threadSpawn = options.threadSpawn; - } - init() { - if (!this._childThread) { - this.initMainThread(); - } - } - initMainThread() { - this.preparePool(); - } - preparePool() { - if (this._reuseWorker) { - if (this._reuseWorker.size) { - let pthreadPoolSize = this._reuseWorker.size; - while (pthreadPoolSize--) { - const worker = this.allocateUnusedWorker(); - if (ENVIRONMENT_IS_NODE) { - worker.once('message', () => { }); - worker.unref(); - } - } - } - } - } - shouldPreloadWorkers() { - return !this._childThread && this._reuseWorker && this._reuseWorker.size > 0; - } - loadWasmModuleToAllWorkers() { - const promises = Array(this.unusedWorkers.length); - for (let i = 0; i < this.unusedWorkers.length; ++i) { - const worker = this.unusedWorkers[i]; - if (ENVIRONMENT_IS_NODE) - worker.ref(); - promises[i] = this.loadWasmModuleToWorker(worker).then((w) => { - if (ENVIRONMENT_IS_NODE) - worker.unref(); - return w; - }, (e) => { - if (ENVIRONMENT_IS_NODE) - worker.unref(); - throw e; - }); - } - return Promise.all(promises).catch((err) => { - this.terminateAllThreads(); - throw err; - }); - } - preloadWorkers() { - if (this.shouldPreloadWorkers()) { - return this.loadWasmModuleToAllWorkers(); - } - return Promise.resolve([]); - } - setup(wasmModule, wasmMemory) { - this.wasmModule = wasmModule; - this.wasmMemory = wasmMemory; - } - markId(worker) { - if (worker.__emnapi_tid) - return worker.__emnapi_tid; - const tid = nextWorkerID + 43; - nextWorkerID = (nextWorkerID + 1) % (WASI_THREADS_MAX_TID - 42); - this.pthreads[tid] = worker; - worker.__emnapi_tid = tid; - return tid; - } - returnWorkerToPool(worker) { - var tid = worker.__emnapi_tid; - if (tid !== undefined) { - delete this.pthreads[tid]; - } - this.unusedWorkers.push(worker); - delete worker.__emnapi_tid; - if (ENVIRONMENT_IS_NODE) { - worker.unref(); - } - } - loadWasmModuleToWorker(worker, sab) { - if (worker.whenLoaded) - return worker.whenLoaded; - const err = this.printErr; - const beforeLoad = this._beforeLoad; - const _this = this; - worker.whenLoaded = new Promise((resolve, reject) => { - const handleError = function (e) { - let message = 'worker sent an error!'; - if (worker.__emnapi_tid !== undefined) { - message = 'worker (tid = ' + worker.__emnapi_tid + ') sent an error!'; - } - if ('message' in e) { - err(message + ' ' + e.message); - if (e.message.indexOf('RuntimeError') !== -1 || e.message.indexOf('unreachable') !== -1) { - try { - _this.terminateAllThreads(); - } - catch (_) { } - } - } - else { - err(message); - } - reject(e); - throw e; - }; - const handleMessage = (data) => { - if (data.__emnapi__) { - const type = data.__emnapi__.type; - const payload = data.__emnapi__.payload; - if (type === 'loaded') { - worker.loaded = true; - if (ENVIRONMENT_IS_NODE && !worker.__emnapi_tid) { - worker.unref(); - } - resolve(worker); - } - else if (type === 'cleanup-thread') { - if (payload.tid in this.pthreads) { - this.cleanThread(worker, payload.tid); - } - } - else if (type === 'spawn-thread') { - this.threadSpawn(payload.startArg, payload.errorOrTid); - } - else if (type === 'terminate-all-threads') { - this.terminateAllThreads(); - } - } - }; - worker.onmessage = (e) => { - handleMessage(e.data); - this.fireMessageEvent(worker, e); - }; - worker.onerror = handleError; - if (ENVIRONMENT_IS_NODE) { - worker.on('message', function (data) { - var _a, _b; - (_b = (_a = worker).onmessage) === null || _b === void 0 ? void 0 : _b.call(_a, { - data - }); - }); - worker.on('error', function (e) { - var _a, _b; - (_b = (_a = worker).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, e); - }); - worker.on('detachedExit', function () { }); - } - if (typeof beforeLoad === 'function') { - beforeLoad(worker); - } - try { - worker.postMessage(createMessage('load', { - wasmModule: this.wasmModule, - wasmMemory: this.wasmMemory, - sab - })); - } - catch (err) { - checkSharedWasmMemory(this.wasmMemory); - throw err; - } - }); - return worker.whenLoaded; - } - allocateUnusedWorker() { - const _onCreateWorker = this._onCreateWorker; - if (typeof _onCreateWorker !== 'function') { - throw new TypeError('`options.onCreateWorker` is not provided'); - } - const worker = _onCreateWorker({ type: 'thread', name: 'emnapi-pthread' }); - this.unusedWorkers.push(worker); - return worker; - } - getNewWorker(sab) { - if (this._reuseWorker) { - if (this.unusedWorkers.length === 0) { - if (this._reuseWorker.strict) { - if (!ENVIRONMENT_IS_NODE) { - const err = this.printErr; - err('Tried to spawn a new thread, but the thread pool is exhausted.\n' + - 'This might result in a deadlock unless some threads eventually exit or the code explicitly breaks out to the event loop.'); - return; - } - } - const worker = this.allocateUnusedWorker(); - this.loadWasmModuleToWorker(worker, sab); - } - return this.unusedWorkers.pop(); - } - const worker = this.allocateUnusedWorker(); - this.loadWasmModuleToWorker(worker, sab); - return this.unusedWorkers.pop(); - } - cleanThread(worker, tid, force) { - if (!force && this._reuseWorker) { - this.returnWorkerToPool(worker); - } - else { - delete this.pthreads[tid]; - this.terminateWorker(worker); - delete worker.__emnapi_tid; - } - } - terminateWorker(worker) { - var _a; - const tid = worker.__emnapi_tid; - worker.terminate(); - (_a = this.messageEvents.get(worker)) === null || _a === void 0 ? void 0 : _a.clear(); - this.messageEvents.delete(worker); - worker.onmessage = (e) => { - if (e.data.__emnapi__) { - const err = this.printErr; - err('received "' + e.data.__emnapi__.type + '" command from terminated worker: ' + tid); - } - }; - } - terminateAllThreads() { - const runningWorkers = Object.values(this.pthreads); - for (let i = 0; i < runningWorkers.length; ++i) { - this.terminateWorker(runningWorkers[i]); - } - for (let i = 0; i < this.unusedWorkers.length; ++i) { - this.terminateWorker(this.unusedWorkers[i]); - } - this.unusedWorkers = []; - this.pthreads = Object.create(null); - this.preparePool(); - } - addMessageEventListener(worker, onMessage) { - let listeners = this.messageEvents.get(worker); - if (!listeners) { - listeners = new Set(); - this.messageEvents.set(worker, listeners); - } - listeners.add(onMessage); - return () => { - listeners === null || listeners === void 0 ? void 0 : listeners.delete(onMessage); - }; - } - fireMessageEvent(worker, e) { - const listeners = this.messageEvents.get(worker); - if (!listeners) - return; - const err = this.printErr; - listeners.forEach((listener) => { - try { - listener(e); - } - catch (e) { - err(e.stack); - } - }); - } -} - -const kIsProxy = Symbol('kIsProxy'); -function createInstanceProxy(instance, memory) { - if (instance[kIsProxy]) - return instance; - const originalExports = instance.exports; - const createHandler = function (target) { - const handlers = [ - 'apply', - 'construct', - 'defineProperty', - 'deleteProperty', - 'get', - 'getOwnPropertyDescriptor', - 'getPrototypeOf', - 'has', - 'isExtensible', - 'ownKeys', - 'preventExtensions', - 'set', - 'setPrototypeOf' - ]; - const handler = {}; - for (let i = 0; i < handlers.length; i++) { - const name = handlers[i]; - handler[name] = function () { - const args = Array.prototype.slice.call(arguments, 1); - args.unshift(target); - return Reflect[name].apply(Reflect, args); - }; - } - return handler; - }; - const handler = createHandler(originalExports); - const _initialize = () => { }; - const _start = () => 0; - handler.get = function (_target, p, receiver) { - var _a; - if (p === 'memory') { - return (_a = (typeof memory === 'function' ? memory() : memory)) !== null && _a !== void 0 ? _a : Reflect.get(originalExports, p, receiver); - } - if (p === '_initialize') { - return p in originalExports ? _initialize : undefined; - } - if (p === '_start') { - return p in originalExports ? _start : undefined; - } - return Reflect.get(originalExports, p, receiver); - }; - handler.has = function (_target, p) { - if (p === 'memory') - return true; - return Reflect.has(originalExports, p); - }; - const exportsProxy = new Proxy(Object.create(null), handler); - return new Proxy(instance, { - get(target, p, receiver) { - if (p === 'exports') { - return exportsProxy; - } - if (p === kIsProxy) { - return true; - } - return Reflect.get(target, p, receiver); - } - }); -} - -const patchedWasiInstances = new WeakMap(); -class WASIThreads { - constructor(options) { - if (!options) { - throw new TypeError('WASIThreads(): options is not provided'); - } - if (!options.wasi) { - throw new TypeError('WASIThreads(): options.wasi is not provided'); - } - patchedWasiInstances.set(this, new WeakSet()); - const wasi = options.wasi; - patchWasiInstance(this, wasi); - this.wasi = wasi; - if ('childThread' in options) { - this.childThread = Boolean(options.childThread); - } - else { - this.childThread = false; - } - this.PThread = undefined; - if ('threadManager' in options) { - if (typeof options.threadManager === 'function') { - this.PThread = options.threadManager(); - } - else { - this.PThread = options.threadManager; - } - } - else { - if (!this.childThread) { - this.PThread = new ThreadManager(options); - this.PThread.init(); - } - } - let waitThreadStart = false; - if ('waitThreadStart' in options) { - waitThreadStart = typeof options.waitThreadStart === 'number' ? options.waitThreadStart : Boolean(options.waitThreadStart); - } - const postMessage = getPostMessage(options); - if (this.childThread && typeof postMessage !== 'function') { - throw new TypeError('options.postMessage is not a function'); - } - this.postMessage = postMessage; - const wasm64 = Boolean(options.wasm64); - const threadSpawn = (startArg, errorOrTid) => { - var _a; - const EAGAIN = 6; - const isNewABI = errorOrTid !== undefined; - try { - checkSharedWasmMemory(this.wasmMemory); - } - catch (err) { - (_a = this.PThread) === null || _a === void 0 ? void 0 : _a.printErr(err.stack); - if (isNewABI) { - const struct = new Int32Array(this.wasmMemory.buffer, errorOrTid, 2); - Atomics.store(struct, 0, 1); - Atomics.store(struct, 1, EAGAIN); - Atomics.notify(struct, 1); - return 1; - } - else { - return -EAGAIN; - } - } - if (!isNewABI) { - const malloc = this.wasmInstance.exports.malloc; - errorOrTid = wasm64 ? Number(malloc(BigInt(8))) : (malloc(8) >>> 0); - if (!errorOrTid) { - return -48; - } - } - const _free = this.wasmInstance.exports.free; - const free = wasm64 ? (ptr) => { _free(BigInt(ptr)); } : _free; - const struct = new Int32Array(this.wasmMemory.buffer, errorOrTid, 2); - Atomics.store(struct, 0, 0); - Atomics.store(struct, 1, 0); - if (this.childThread) { - postMessage(createMessage('spawn-thread', { - startArg, - errorOrTid: errorOrTid - })); - Atomics.wait(struct, 1, 0); - const isError = Atomics.load(struct, 0); - const result = Atomics.load(struct, 1); - if (isNewABI) { - return isError; - } - free(errorOrTid); - return isError ? -result : result; - } - const shouldWait = waitThreadStart || (waitThreadStart === 0); - let sab; - if (shouldWait) { - sab = new Int32Array(new SharedArrayBuffer(16 + 8192)); - Atomics.store(sab, 0, 0); - } - let worker; - let tid; - const PThread = this.PThread; - try { - worker = PThread.getNewWorker(sab); - if (!worker) { - throw new Error('failed to get new worker'); - } - tid = PThread.markId(worker); - if (ENVIRONMENT_IS_NODE) { - worker.unref(); - } - worker.postMessage(createMessage('start', { - tid, - arg: startArg, - sab - })); - if (shouldWait) { - if (typeof waitThreadStart === 'number') { - const waitResult = Atomics.wait(sab, 0, 0, waitThreadStart); - if (waitResult === 'timed-out') { - throw new Error('Spawning thread timed out. Please check if the worker is created successfully and if message is handled properly in the worker.'); - } - } - else { - Atomics.wait(sab, 0, 0); - } - const r = Atomics.load(sab, 0); - if (r > 1) { - throw deserizeErrorFromBuffer(sab.buffer); - } - } - } - catch (e) { - if (worker !== undefined && tid !== undefined) { - try { - PThread.cleanThread(worker, tid, true); - } - catch (_) { } - } - Atomics.store(struct, 0, 1); - Atomics.store(struct, 1, EAGAIN); - Atomics.notify(struct, 1); - PThread === null || PThread === void 0 ? void 0 : PThread.printErr(e.stack); - if (isNewABI) { - return 1; - } - free(errorOrTid); - return -EAGAIN; - } - Atomics.store(struct, 0, 0); - Atomics.store(struct, 1, tid); - Atomics.notify(struct, 1); - if (!shouldWait) { - worker.whenLoaded.catch((err) => { - delete worker.whenLoaded; - PThread.cleanThread(worker, tid, true); - throw err; - }); - } - if (isNewABI) { - return 0; - } - free(errorOrTid); - return tid; - }; - this.threadSpawn = threadSpawn; - if (this.PThread) { - this.PThread.threadSpawn = threadSpawn; - } - } - getImportObject() { - return { - wasi: { - 'thread-spawn': this.threadSpawn - } - }; - } - setup(wasmInstance, wasmModule, wasmMemory) { - wasmMemory !== null && wasmMemory !== void 0 ? wasmMemory : (wasmMemory = wasmInstance.exports.memory); - this.wasmInstance = wasmInstance; - this.wasmMemory = wasmMemory; - if (this.PThread) { - this.PThread.setup(wasmModule, wasmMemory); - } - } - preloadWorkers() { - if (this.PThread) { - return this.PThread.preloadWorkers(); - } - return Promise.resolve([]); - } - initialize(instance, module, memory) { - const exports = instance.exports; - memory !== null && memory !== void 0 ? memory : (memory = exports.memory); - if (this.childThread) { - instance = createInstanceProxy(instance, memory); - } - this.setup(instance, module, memory); - const wasi = this.wasi; - if (('_start' in exports) && (typeof exports._start === 'function')) { - if (this.childThread) { - wasi.start(instance); - try { - const kStarted = getWasiSymbol(wasi, 'kStarted'); - wasi[kStarted] = false; - } - catch (_) { } - } - else { - setupInstance(wasi, instance); - } - } - else { - wasi.initialize(instance); - } - return instance; - } - start(instance, module, memory) { - const exports = instance.exports; - memory !== null && memory !== void 0 ? memory : (memory = exports.memory); - if (this.childThread) { - instance = createInstanceProxy(instance, memory); - } - this.setup(instance, module, memory); - const exitCode = this.wasi.start(instance); - return { exitCode, instance }; - } - terminateAllThreads() { - var _a; - if (!this.childThread) { - (_a = this.PThread) === null || _a === void 0 ? void 0 : _a.terminateAllThreads(); - } - else { - this.postMessage(createMessage('terminate-all-threads', {})); - } - } -} -function patchWasiInstance(wasiThreads, wasi) { - const patched = patchedWasiInstances.get(wasiThreads); - if (patched.has(wasi)) { - return; - } - const _this = wasiThreads; - const wasiImport = wasi.wasiImport; - if (wasiImport) { - const proc_exit = wasiImport.proc_exit; - wasiImport.proc_exit = function (code) { - _this.terminateAllThreads(); - return proc_exit.call(this, code); - }; - } - if (!_this.childThread) { - const start = wasi.start; - if (typeof start === 'function') { - wasi.start = function (instance) { - try { - return start.call(this, instance); - } - catch (err) { - if (isTrapError(err)) { - _this.terminateAllThreads(); - } - throw err; - } - }; - } - } - patched.add(wasi); -} -function getWasiSymbol(wasi, description) { - const symbols = Object.getOwnPropertySymbols(wasi); - const selectDescription = (description) => (s) => { - if (s.description) { - return s.description === description; - } - return s.toString() === `Symbol(${description})`; - }; - if (Array.isArray(description)) { - return description.map(d => symbols.filter(selectDescription(d))[0]); - } - return symbols.filter(selectDescription(description))[0]; -} -function setupInstance(wasi, instance) { - const [kInstance, kSetMemory] = getWasiSymbol(wasi, ['kInstance', 'kSetMemory']); - wasi[kInstance] = instance; - wasi[kSetMemory](instance.exports.memory); -} - -class ThreadMessageHandler { - constructor(options) { - const postMsg = getPostMessage(options); - if (typeof postMsg !== 'function') { - throw new TypeError('options.postMessage is not a function'); - } - this.postMessage = postMsg; - this.onLoad = options === null || options === void 0 ? void 0 : options.onLoad; - this.onError = typeof (options === null || options === void 0 ? void 0 : options.onError) === 'function' ? options.onError : (_type, err) => { throw err; }; - this.instance = undefined; - this.messagesBeforeLoad = []; - } - instantiate(data) { - if (typeof this.onLoad === 'function') { - return this.onLoad(data); - } - throw new Error('ThreadMessageHandler.prototype.instantiate is not implemented'); - } - handle(e) { - var _a; - if ((_a = e === null || e === void 0 ? void 0 : e.data) === null || _a === void 0 ? void 0 : _a.__emnapi__) { - const type = e.data.__emnapi__.type; - const payload = e.data.__emnapi__.payload; - try { - if (type === 'load') { - this._load(payload); - } - else if (type === 'start') { - this.handleAfterLoad(e, () => { - this._start(payload); - }); - } - } - catch (err) { - this.onError(err, type); - } - } - } - _load(payload) { - if (this.instance !== undefined) - return; - let source; - try { - source = this.instantiate(payload); - } - catch (err) { - this._loaded(err, null, payload); - return; - } - const then = source && 'then' in source ? source.then : undefined; - if (typeof then === 'function') { - then.call(source, (source) => { this._loaded(null, source, payload); }, (err) => { this._loaded(err, null, payload); }); - } - else { - this._loaded(null, source, payload); - } - } - _start(payload) { - const wasi_thread_start = this.instance.exports.wasi_thread_start; - if (typeof wasi_thread_start !== 'function') { - const err = new TypeError('wasi_thread_start is not exported'); - notifyPthreadCreateResult(payload.sab, 2, err); - throw err; - } - const postMessage = this.postMessage; - const tid = payload.tid; - const startArg = payload.arg; - notifyPthreadCreateResult(payload.sab, 1); - try { - wasi_thread_start(tid, startArg); - } - catch (err) { - if (err !== 'unwind') { - throw err; - } - else { - return; - } - } - postMessage(createMessage('cleanup-thread', { tid })); - } - _loaded(err, source, payload) { - if (err) { - notifyPthreadCreateResult(payload.sab, 2, err); - throw err; - } - if (source == null) { - const err = new TypeError('onLoad should return an object'); - notifyPthreadCreateResult(payload.sab, 2, err); - throw err; - } - const instance = source.instance; - if (!instance) { - const err = new TypeError('onLoad should return an object which includes "instance"'); - notifyPthreadCreateResult(payload.sab, 2, err); - throw err; - } - this.instance = instance; - const postMessage = this.postMessage; - postMessage(createMessage('loaded', {})); - const messages = this.messagesBeforeLoad; - this.messagesBeforeLoad = []; - for (let i = 0; i < messages.length; i++) { - const data = messages[i]; - this.handle({ data }); - } - } - handleAfterLoad(e, f) { - if (this.instance !== undefined) { - f.call(this, e); - } - else { - this.messagesBeforeLoad.push(e.data); - } - } -} -function notifyPthreadCreateResult(sab, result, error) { - if (sab) { - serizeErrorToBuffer(sab.buffer, result, error); - Atomics.notify(sab, 0); - } -} - -export { ThreadManager, ThreadMessageHandler, WASIThreads, createInstanceProxy, isSharedArrayBuffer, isTrapError }; diff --git a/node_modules/@emnapi/wasi-threads/index.js b/node_modules/@emnapi/wasi-threads/index.js deleted file mode 100644 index 7e6eabd6a..000000000 --- a/node_modules/@emnapi/wasi-threads/index.js +++ /dev/null @@ -1,5 +0,0 @@ -if (typeof process !== 'undefined' && process.env.NODE_ENV === 'production') { - module.exports = require('./dist/wasi-threads.cjs.min.js') -} else { - module.exports = require('./dist/wasi-threads.cjs.js') -} diff --git a/node_modules/@emnapi/wasi-threads/package.json b/node_modules/@emnapi/wasi-threads/package.json deleted file mode 100644 index 71731b599..000000000 --- a/node_modules/@emnapi/wasi-threads/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "@emnapi/wasi-threads", - "version": "1.2.2", - "description": "WASI threads proposal implementation in JavaScript", - "main": "index.js", - "module": "./dist/wasi-threads.esm-bundler.js", - "types": "./dist/wasi-threads.d.ts", - "sideEffects": false, - "exports": { - ".": { - "types": { - "module": "./dist/wasi-threads.d.ts", - "import": "./dist/wasi-threads.d.mts", - "default": "./dist/wasi-threads.d.ts" - }, - "module": "./dist/wasi-threads.esm-bundler.js", - "import": "./dist/wasi-threads.mjs", - "default": "./index.js" - }, - "./dist/wasi-threads.cjs.min": { - "types": "./dist/wasi-threads.d.ts", - "default": "./dist/wasi-threads.cjs.min.js" - }, - "./dist/wasi-threads.min.mjs": { - "types": "./dist/wasi-threads.d.mts", - "default": "./dist/wasi-threads.min.mjs" - } - }, - "dependencies": { - "tslib": "^2.4.0" - }, - "scripts": { - "build": "node ./script/build.js", - "build:test": "node ./test/build.js", - "test": "node ./test/index.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/toyobayashi/emnapi.git" - }, - "author": "toyobayashi", - "license": "MIT", - "bugs": { - "url": "https://github.com/toyobayashi/emnapi/issues" - }, - "homepage": "https://github.com/toyobayashi/emnapi#readme", - "publishConfig": { - "access": "public" - } -} diff --git a/node_modules/@esbuild/linux-x64/README.md b/node_modules/@esbuild/linux-x64/README.md deleted file mode 100644 index b2f193004..000000000 --- a/node_modules/@esbuild/linux-x64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# esbuild - -This is the Linux 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details. diff --git a/node_modules/@esbuild/win32-x64/README.md b/node_modules/@esbuild/win32-x64/README.md new file mode 100644 index 000000000..a99ee7cf8 --- /dev/null +++ b/node_modules/@esbuild/win32-x64/README.md @@ -0,0 +1,3 @@ +# esbuild + +This is the Windows 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details. diff --git a/node_modules/@esbuild/linux-x64/bin/esbuild b/node_modules/@esbuild/win32-x64/esbuild.exe old mode 100755 new mode 100644 similarity index 64% rename from node_modules/@esbuild/linux-x64/bin/esbuild rename to node_modules/@esbuild/win32-x64/esbuild.exe index 71fe4f831..5af34ef67 Binary files a/node_modules/@esbuild/linux-x64/bin/esbuild and b/node_modules/@esbuild/win32-x64/esbuild.exe differ diff --git a/node_modules/@esbuild/linux-x64/package.json b/node_modules/@esbuild/win32-x64/package.json similarity index 66% rename from node_modules/@esbuild/linux-x64/package.json rename to node_modules/@esbuild/win32-x64/package.json index 1ce7bc3be..ef65a96e2 100644 --- a/node_modules/@esbuild/linux-x64/package.json +++ b/node_modules/@esbuild/win32-x64/package.json @@ -1,7 +1,7 @@ { - "name": "@esbuild/linux-x64", + "name": "@esbuild/win32-x64", "version": "0.28.1", - "description": "The Linux 64-bit binary for esbuild, a JavaScript bundler.", + "description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.", "repository": { "type": "git", "url": "git+https://github.com/evanw/esbuild.git" @@ -12,7 +12,7 @@ "node": ">=18" }, "os": [ - "linux" + "win32" ], "cpu": [ "x64" diff --git a/node_modules/@rolldown/binding-linux-x64-gnu/README.md b/node_modules/@rolldown/binding-linux-x64-gnu/README.md deleted file mode 100644 index deea4245f..000000000 --- a/node_modules/@rolldown/binding-linux-x64-gnu/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@rolldown/binding-linux-x64-gnu` - -This is the **x86_64-unknown-linux-gnu** binary for `@rolldown/binding` diff --git a/node_modules/@rolldown/binding-win32-x64-msvc/README.md b/node_modules/@rolldown/binding-win32-x64-msvc/README.md new file mode 100644 index 000000000..ce38f8ea0 --- /dev/null +++ b/node_modules/@rolldown/binding-win32-x64-msvc/README.md @@ -0,0 +1,3 @@ +# `@rolldown/binding-win32-x64-msvc` + +This is the **x86_64-pc-windows-msvc** binary for `@rolldown/binding` diff --git a/node_modules/@rolldown/binding-linux-x64-gnu/package.json b/node_modules/@rolldown/binding-win32-x64-msvc/package.json similarity index 78% rename from node_modules/@rolldown/binding-linux-x64-gnu/package.json rename to node_modules/@rolldown/binding-win32-x64-msvc/package.json index 834cd2c22..67358da07 100644 --- a/node_modules/@rolldown/binding-linux-x64-gnu/package.json +++ b/node_modules/@rolldown/binding-win32-x64-msvc/package.json @@ -1,12 +1,12 @@ { - "name": "@rolldown/binding-linux-x64-gnu", + "name": "@rolldown/binding-win32-x64-msvc", "version": "1.1.3", "cpu": [ "x64" ], - "main": "rolldown-binding.linux-x64-gnu.node", + "main": "rolldown-binding.win32-x64-msvc.node", "files": [ - "rolldown-binding.linux-x64-gnu.node" + "rolldown-binding.win32-x64-msvc.node" ], "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.", "keywords": [ @@ -32,9 +32,6 @@ "access": "public" }, "os": [ - "linux" - ], - "libc": [ - "glibc" + "win32" ] } \ No newline at end of file diff --git a/node_modules/@rolldown/binding-linux-x64-gnu/rolldown-binding.linux-x64-gnu.node b/node_modules/@rolldown/binding-win32-x64-msvc/rolldown-binding.win32-x64-msvc.node similarity index 64% rename from node_modules/@rolldown/binding-linux-x64-gnu/rolldown-binding.linux-x64-gnu.node rename to node_modules/@rolldown/binding-win32-x64-msvc/rolldown-binding.win32-x64-msvc.node index a3be1a3fa..b48e00069 100644 Binary files a/node_modules/@rolldown/binding-linux-x64-gnu/rolldown-binding.linux-x64-gnu.node and b/node_modules/@rolldown/binding-win32-x64-msvc/rolldown-binding.win32-x64-msvc.node differ diff --git a/node_modules/@typescript/typescript-linux-x64/README.md b/node_modules/@typescript/typescript-linux-x64/README.md deleted file mode 100644 index 35143f5d1..000000000 --- a/node_modules/@typescript/typescript-linux-x64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@typescript/typescript-linux-x64` - -This package provides linux-x64 support for [typescript](https://www.npmjs.com/package/typescript). diff --git a/node_modules/@typescript/typescript-linux-x64/lib/tsc.sig b/node_modules/@typescript/typescript-linux-x64/lib/tsc.sig deleted file mode 100644 index 76d30265c..000000000 --- a/node_modules/@typescript/typescript-linux-x64/lib/tsc.sig +++ /dev/null @@ -1,11 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: BSN Pgp v1.0.0.0 - -iQEcBAABCAAGBQJqTebQAAoJEOs+lK2+EinPblgH/2BOzf1BzBVbTd3OXCX29bdK -5uN+q3moUGjznK/FknvlEqlhxo7V7BX+kgTbL2WGcsmcq4jx1zcEDAQkjJM8xDlh -arpq1acM9rFWRbVyMwSUspKtOqNO83Rtk4WvPO90edmxdbVnOgHSMRNnvMbJCq0B -cQkVjNQEUu1WZJ0xdC154JmvqVoyJDz+kkN0iDocrKDNPI9uEaHmnAO7+yBItU3D -59IBlL6l6Wwx2vyLDyy/ns534wX8STJSsByz86cCr9pWtugSahC6seXhNflpDFZq -O3N+VtgpoHbBYRwXAtIbqqlR6Y04O2TCaYlxRoyYZwkCVd3RSTw6rCsHwB26QbQ= -=y9Bn ------END PGP SIGNATURE----- diff --git a/node_modules/@typescript/typescript-linux-x64/LICENSE b/node_modules/@typescript/typescript-win32-x64/LICENSE similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/LICENSE rename to node_modules/@typescript/typescript-win32-x64/LICENSE diff --git a/node_modules/@typescript/typescript-linux-x64/NOTICE.txt b/node_modules/@typescript/typescript-win32-x64/NOTICE.txt similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/NOTICE.txt rename to node_modules/@typescript/typescript-win32-x64/NOTICE.txt diff --git a/node_modules/@typescript/typescript-win32-x64/README.md b/node_modules/@typescript/typescript-win32-x64/README.md new file mode 100644 index 000000000..6cca5c186 --- /dev/null +++ b/node_modules/@typescript/typescript-win32-x64/README.md @@ -0,0 +1,3 @@ +# `@typescript/typescript-win32-x64` + +This package provides win32-x64 support for [typescript](https://www.npmjs.com/package/typescript). diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.decorators.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.decorators.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.decorators.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.decorators.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.decorators.legacy.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.decorators.legacy.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.decorators.legacy.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.decorators.legacy.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.dom.asynciterable.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.dom.asynciterable.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.dom.asynciterable.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.dom.asynciterable.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.dom.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.dom.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.dom.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.dom.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.dom.iterable.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.dom.iterable.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.dom.iterable.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.dom.iterable.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.collection.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.collection.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.collection.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.collection.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.core.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.core.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.core.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.core.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.generator.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.generator.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.generator.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.generator.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.iterable.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.iterable.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.iterable.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.iterable.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.promise.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.promise.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.promise.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.promise.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.proxy.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.proxy.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.proxy.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.proxy.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.reflect.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.reflect.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.reflect.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.reflect.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.symbol.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.symbol.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.symbol.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.symbol.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.symbol.wellknown.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.symbol.wellknown.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2015.symbol.wellknown.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2015.symbol.wellknown.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2016.array.include.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2016.array.include.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2016.array.include.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2016.array.include.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2016.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2016.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2016.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2016.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2016.full.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2016.full.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2016.full.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2016.full.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2016.intl.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2016.intl.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2016.intl.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2016.intl.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.arraybuffer.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.arraybuffer.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.arraybuffer.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.arraybuffer.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.date.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.date.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.date.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.date.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.full.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.full.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.full.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.full.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.intl.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.intl.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.intl.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.intl.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.object.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.object.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.object.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.object.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.sharedmemory.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.sharedmemory.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.sharedmemory.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.sharedmemory.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.string.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.string.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.string.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.string.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.typedarrays.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.typedarrays.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2017.typedarrays.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2017.typedarrays.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.asyncgenerator.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.asyncgenerator.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.asyncgenerator.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.asyncgenerator.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.asynciterable.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.asynciterable.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.asynciterable.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.asynciterable.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.full.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.full.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.full.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.full.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.intl.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.intl.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.intl.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.intl.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.promise.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.promise.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.promise.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.promise.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.regexp.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.regexp.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2018.regexp.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2018.regexp.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.array.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.array.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.array.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.array.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.full.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.full.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.full.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.full.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.intl.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.intl.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.intl.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.intl.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.object.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.object.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.object.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.object.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.string.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.string.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.string.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.string.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.symbol.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.symbol.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2019.symbol.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2019.symbol.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.bigint.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.bigint.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.bigint.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.bigint.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.date.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.date.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.date.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.date.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.full.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.full.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.full.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.full.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.intl.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.intl.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.intl.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.intl.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.number.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.number.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.number.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.number.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.promise.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.promise.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.promise.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.promise.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.sharedmemory.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.sharedmemory.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.sharedmemory.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.sharedmemory.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.string.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.string.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.string.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.string.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.symbol.wellknown.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.symbol.wellknown.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2020.symbol.wellknown.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2020.symbol.wellknown.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2021.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2021.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2021.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2021.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2021.full.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2021.full.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2021.full.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2021.full.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2021.intl.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2021.intl.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2021.intl.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2021.intl.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2021.promise.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2021.promise.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2021.promise.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2021.promise.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2021.string.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2021.string.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2021.string.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2021.string.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2021.weakref.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2021.weakref.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2021.weakref.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2021.weakref.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.array.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.array.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.array.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.array.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.error.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.error.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.error.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.error.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.full.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.full.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.full.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.full.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.intl.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.intl.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.intl.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.intl.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.object.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.object.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.object.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.object.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.regexp.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.regexp.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.regexp.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.regexp.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.string.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.string.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2022.string.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2022.string.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2023.array.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2023.array.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2023.array.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2023.array.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2023.collection.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2023.collection.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2023.collection.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2023.collection.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2023.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2023.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2023.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2023.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2023.full.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2023.full.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2023.full.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2023.full.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2023.intl.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2023.intl.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2023.intl.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2023.intl.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.arraybuffer.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.arraybuffer.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.arraybuffer.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.arraybuffer.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.collection.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.collection.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.collection.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.collection.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.full.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.full.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.full.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.full.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.object.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.object.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.object.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.object.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.promise.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.promise.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.promise.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.promise.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.regexp.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.regexp.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.regexp.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.regexp.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.sharedmemory.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.sharedmemory.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.sharedmemory.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.sharedmemory.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.string.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.string.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2024.string.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2024.string.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.collection.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.collection.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.collection.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.collection.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.float16.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.float16.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.float16.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.float16.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.full.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.full.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.full.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.full.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.intl.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.intl.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.intl.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.intl.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.iterator.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.iterator.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.iterator.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.iterator.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.promise.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.promise.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.promise.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.promise.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.regexp.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.regexp.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es2025.regexp.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es2025.regexp.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es5.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es5.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es5.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es5.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.es6.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.es6.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.es6.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.es6.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.array.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.array.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.array.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.array.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.collection.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.collection.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.collection.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.collection.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.date.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.date.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.date.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.date.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.decorators.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.decorators.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.decorators.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.decorators.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.disposable.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.disposable.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.disposable.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.disposable.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.error.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.error.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.error.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.error.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.full.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.full.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.full.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.full.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.intl.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.intl.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.intl.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.intl.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.sharedmemory.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.sharedmemory.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.sharedmemory.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.sharedmemory.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.temporal.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.temporal.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.temporal.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.temporal.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.typedarrays.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.typedarrays.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.esnext.typedarrays.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.esnext.typedarrays.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.scripthost.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.scripthost.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.scripthost.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.scripthost.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.webworker.asynciterable.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.webworker.asynciterable.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.webworker.asynciterable.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.webworker.asynciterable.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.webworker.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.webworker.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.webworker.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.webworker.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.webworker.importscripts.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.webworker.importscripts.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.webworker.importscripts.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.webworker.importscripts.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/lib.webworker.iterable.d.ts b/node_modules/@typescript/typescript-win32-x64/lib/lib.webworker.iterable.d.ts similarity index 100% rename from node_modules/@typescript/typescript-linux-x64/lib/lib.webworker.iterable.d.ts rename to node_modules/@typescript/typescript-win32-x64/lib/lib.webworker.iterable.d.ts diff --git a/node_modules/@typescript/typescript-linux-x64/lib/tsc b/node_modules/@typescript/typescript-win32-x64/lib/tsc.exe old mode 100755 new mode 100644 similarity index 71% rename from node_modules/@typescript/typescript-linux-x64/lib/tsc rename to node_modules/@typescript/typescript-win32-x64/lib/tsc.exe index 3cf53c3be..86f4af476 Binary files a/node_modules/@typescript/typescript-linux-x64/lib/tsc and b/node_modules/@typescript/typescript-win32-x64/lib/tsc.exe differ diff --git a/node_modules/@typescript/typescript-linux-x64/package.json b/node_modules/@typescript/typescript-win32-x64/package.json similarity index 93% rename from node_modules/@typescript/typescript-linux-x64/package.json rename to node_modules/@typescript/typescript-win32-x64/package.json index 0d4d64e2a..30dd64ae0 100644 --- a/node_modules/@typescript/typescript-linux-x64/package.json +++ b/node_modules/@typescript/typescript-win32-x64/package.json @@ -1,5 +1,5 @@ { - "name": "@typescript/typescript-linux-x64", + "name": "@typescript/typescript-win32-x64", "version": "7.0.2", "license": "Apache-2.0", "author": "Microsoft Corp.", @@ -37,7 +37,7 @@ "tag": "latest" }, "os": [ - "linux" + "win32" ], "cpu": [ "x64" diff --git a/node_modules/esbuild/bin/esbuild b/node_modules/esbuild/bin/esbuild index 71fe4f831..0045b52bd 100755 Binary files a/node_modules/esbuild/bin/esbuild and b/node_modules/esbuild/bin/esbuild differ diff --git a/node_modules/license-checker/node_modules/.bin/semver b/node_modules/license-checker/node_modules/.bin/semver index 317eb293d..384db49d8 120000 --- a/node_modules/license-checker/node_modules/.bin/semver +++ b/node_modules/license-checker/node_modules/.bin/semver @@ -1 +1,16 @@ -../semver/bin/semver \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../semver/bin/semver" "$@" +else + exec node "$basedir/../semver/bin/semver" "$@" +fi diff --git a/node_modules/license-checker/node_modules/.bin/semver.cmd b/node_modules/license-checker/node_modules/.bin/semver.cmd new file mode 100644 index 000000000..22d9286cd --- /dev/null +++ b/node_modules/license-checker/node_modules/.bin/semver.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver" %* diff --git a/node_modules/license-checker/node_modules/.bin/semver.ps1 b/node_modules/license-checker/node_modules/.bin/semver.ps1 new file mode 100644 index 000000000..98c1b093f --- /dev/null +++ b/node_modules/license-checker/node_modules/.bin/semver.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args + } else { + & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../semver/bin/semver" $args + } else { + & "node$exe" "$basedir/../semver/bin/semver" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/lightningcss-linux-x64-gnu/README.md b/node_modules/lightningcss-linux-x64-gnu/README.md deleted file mode 100644 index 84f87d329..000000000 --- a/node_modules/lightningcss-linux-x64-gnu/README.md +++ /dev/null @@ -1 +0,0 @@ -This is the x86_64-unknown-linux-gnu build of lightningcss. See https://github.com/parcel-bundler/lightningcss for details. \ No newline at end of file diff --git a/node_modules/lightningcss-linux-x64-gnu/LICENSE b/node_modules/lightningcss-win32-x64-msvc/LICENSE similarity index 100% rename from node_modules/lightningcss-linux-x64-gnu/LICENSE rename to node_modules/lightningcss-win32-x64-msvc/LICENSE diff --git a/node_modules/lightningcss-win32-x64-msvc/README.md b/node_modules/lightningcss-win32-x64-msvc/README.md new file mode 100644 index 000000000..71b89387e --- /dev/null +++ b/node_modules/lightningcss-win32-x64-msvc/README.md @@ -0,0 +1 @@ +This is the x86_64-pc-windows-msvc build of lightningcss. See https://github.com/parcel-bundler/lightningcss for details. \ No newline at end of file diff --git a/node_modules/lightningcss-linux-x64-gnu/lightningcss.linux-x64-gnu.node b/node_modules/lightningcss-win32-x64-msvc/lightningcss.win32-x64-msvc.node similarity index 51% rename from node_modules/lightningcss-linux-x64-gnu/lightningcss.linux-x64-gnu.node rename to node_modules/lightningcss-win32-x64-msvc/lightningcss.win32-x64-msvc.node index fc7c4fb1c..ab1e99d78 100644 Binary files a/node_modules/lightningcss-linux-x64-gnu/lightningcss.linux-x64-gnu.node and b/node_modules/lightningcss-win32-x64-msvc/lightningcss.win32-x64-msvc.node differ diff --git a/node_modules/lightningcss-linux-x64-gnu/package.json b/node_modules/lightningcss-win32-x64-msvc/package.json similarity index 77% rename from node_modules/lightningcss-linux-x64-gnu/package.json rename to node_modules/lightningcss-win32-x64-msvc/package.json index c3566987a..ab27506a7 100644 --- a/node_modules/lightningcss-linux-x64-gnu/package.json +++ b/node_modules/lightningcss-win32-x64-msvc/package.json @@ -1,9 +1,9 @@ { - "name": "lightningcss-linux-x64-gnu", + "name": "lightningcss-win32-x64-msvc", "version": "1.32.0", "license": "MPL-2.0", "description": "A CSS parser, transformer, and minifier written in Rust", - "main": "lightningcss.linux-x64-gnu.node", + "main": "lightningcss.win32-x64-msvc.node", "browserslist": "last 2 versions, not dead", "publishConfig": { "access": "public" @@ -20,18 +20,15 @@ "node": ">= 12.0.0" }, "files": [ - "lightningcss.linux-x64-gnu.node" + "lightningcss.win32-x64-msvc.node" ], "resolutions": { "lightningcss": "link:." }, "os": [ - "linux" + "win32" ], "cpu": [ "x64" - ], - "libc": [ - "glibc" ] } diff --git a/node_modules/normalize-package-data/node_modules/.bin/semver b/node_modules/normalize-package-data/node_modules/.bin/semver index 317eb293d..384db49d8 120000 --- a/node_modules/normalize-package-data/node_modules/.bin/semver +++ b/node_modules/normalize-package-data/node_modules/.bin/semver @@ -1 +1,16 @@ -../semver/bin/semver \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../semver/bin/semver" "$@" +else + exec node "$basedir/../semver/bin/semver" "$@" +fi diff --git a/node_modules/normalize-package-data/node_modules/.bin/semver.cmd b/node_modules/normalize-package-data/node_modules/.bin/semver.cmd new file mode 100644 index 000000000..22d9286cd --- /dev/null +++ b/node_modules/normalize-package-data/node_modules/.bin/semver.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver" %* diff --git a/node_modules/normalize-package-data/node_modules/.bin/semver.ps1 b/node_modules/normalize-package-data/node_modules/.bin/semver.ps1 new file mode 100644 index 000000000..98c1b093f --- /dev/null +++ b/node_modules/normalize-package-data/node_modules/.bin/semver.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args + } else { + & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../semver/bin/semver" $args + } else { + & "node$exe" "$basedir/../semver/bin/semver" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/read-installed/node_modules/.bin/semver b/node_modules/read-installed/node_modules/.bin/semver index 317eb293d..384db49d8 120000 --- a/node_modules/read-installed/node_modules/.bin/semver +++ b/node_modules/read-installed/node_modules/.bin/semver @@ -1 +1,16 @@ -../semver/bin/semver \ No newline at end of file +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../semver/bin/semver" "$@" +else + exec node "$basedir/../semver/bin/semver" "$@" +fi diff --git a/node_modules/read-installed/node_modules/.bin/semver.cmd b/node_modules/read-installed/node_modules/.bin/semver.cmd new file mode 100644 index 000000000..22d9286cd --- /dev/null +++ b/node_modules/read-installed/node_modules/.bin/semver.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver" %* diff --git a/node_modules/read-installed/node_modules/.bin/semver.ps1 b/node_modules/read-installed/node_modules/.bin/semver.ps1 new file mode 100644 index 000000000..98c1b093f --- /dev/null +++ b/node_modules/read-installed/node_modules/.bin/semver.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args + } else { + & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../semver/bin/semver" $args + } else { + & "node$exe" "$basedir/../semver/bin/semver" $args + } + $ret=$LASTEXITCODE +} +exit $ret