From 3c06b2dddbe8dda94b46b860032e32847a384132 Mon Sep 17 00:00:00 2001 From: Liam Don Date: Fri, 20 Jun 2025 21:57:03 +0000 Subject: [PATCH 1/9] Migrate color.js to Typescript to demonstrate mixed JS/TS build --- examples/package-lock.json | 2 +- src/core/math/{color.js => color.ts} | 211 +++++++----------- src/core/math/float-packing.js | 2 +- src/extras/exporters/core-exporter.js | 2 +- src/extras/exporters/gltf-exporter.js | 2 +- src/extras/exporters/usdz-exporter.js | 2 +- src/extras/gizmo/color.js | 2 +- src/extras/gizmo/rotate-gizmo.js | 2 +- src/extras/gizmo/shape/shape.js | 4 +- src/extras/gizmo/transform-gizmo.js | 4 +- src/extras/gizmo/view-cube.js | 4 +- src/extras/render-passes/camera-frame.js | 2 +- src/extras/render-passes/render-pass-bloom.js | 2 +- .../render-passes/render-pass-camera-frame.js | 2 +- .../render-passes/render-pass-compose.js | 2 +- src/extras/render-passes/render-pass-dof.js | 2 +- .../render-passes/render-pass-prepass.js | 2 +- src/extras/render-passes/render-pass-ssao.js | 2 +- src/extras/renderers/outline-renderer.js | 2 +- src/framework/app-base.js | 2 +- .../components/anim/component-binder.js | 2 +- src/framework/components/button/component.js | 2 +- src/framework/components/button/data.js | 2 +- src/framework/components/camera/component.js | 2 +- src/framework/components/camera/system.js | 2 +- src/framework/components/element/component.js | 2 +- .../components/element/image-element.js | 2 +- src/framework/components/element/system.js | 2 +- .../components/element/text-element.js | 2 +- src/framework/components/light/component.js | 2 +- src/framework/components/light/data.js | 2 +- src/framework/components/light/system.js | 2 +- src/framework/components/sprite/component.js | 2 +- src/framework/components/sprite/system.js | 2 +- src/framework/components/system.js | 2 +- src/framework/font/canvas-font.js | 2 +- src/framework/graphics/picker.js | 2 +- .../lightmapper/bake-light-ambient.js | 2 +- src/framework/lightmapper/lightmapper.js | 2 +- src/framework/parsers/glb-parser.js | 2 +- .../material/json-standard-material.js | 2 +- src/framework/script/script-attributes.js | 2 +- src/framework/xr/xr-light-estimation.js | 2 +- src/index.js | 2 +- src/platform/graphics/graphics-device.js | 2 +- src/platform/graphics/render-pass.js | 2 +- .../graphics/webgl/webgl-graphics-device.js | 2 +- src/scene/camera.js | 2 +- src/scene/fog-params.js | 2 +- src/scene/gsplat/gsplat-data.js | 2 +- src/scene/light.js | 2 +- src/scene/lighting/world-clusters-debug.js | 2 +- src/scene/materials/standard-material.js | 2 +- src/scene/renderer/forward-renderer.js | 2 +- src/scene/renderer/shadow-renderer.js | 2 +- src/scene/scene.js | 2 +- tsconfig.json | 2 +- utils/rollup-build-target.mjs | 4 +- 58 files changed, 147 insertions(+), 186 deletions(-) rename src/core/math/{color.js => color.ts} (58%) diff --git a/examples/package-lock.json b/examples/package-lock.json index 5d2ad205b92..a6e14987982 100644 --- a/examples/package-lock.json +++ b/examples/package-lock.json @@ -43,7 +43,7 @@ }, "..": { "name": "playcanvas", - "version": "2.8.0-dev.0", + "version": "2.9.0-dev.0", "dev": true, "license": "MIT", "dependencies": { diff --git a/src/core/math/color.js b/src/core/math/color.ts similarity index 58% rename from src/core/math/color.js rename to src/core/math/color.ts index e08b06a1432..e532bef8da2 100644 --- a/src/core/math/color.js +++ b/src/core/math/color.ts @@ -13,66 +13,52 @@ import { math } from './math.js'; class Color { /** * The red component of the color. - * - * @type {number} */ - r; + r: number; /** * The green component of the color. - * - * @type {number} */ - g; + g: number; /** * The blue component of the color. - * - * @type {number} */ - b; + b: number; /** * The alpha component of the color. - * - * @type {number} */ - a; + a: number; /** * Creates a new Color instance. * - * @overload - * @param {number} [r] - The r value. Defaults to 0. - * @param {number} [g] - The g value. Defaults to 0. - * @param {number} [b] - The b value. Defaults to 0. - * @param {number} [a] - The a value. Defaults to 1. + * @param r - The r value. Defaults to 0. If r is an array of length 3 or + * 4, the array will be used to populate all components. + * @param g - The g value. Defaults to 0. + * @param b - The b value. Defaults to 0. + * @param a - The a value. Defaults to 1. * @example * const c1 = new pc.Color(); // defaults to 0, 0, 0, 1 * const c2 = new pc.Color(0.1, 0.2, 0.3, 0.4); - */ - /** - * Creates a new Color instance. - * - * @overload - * @param {number[]} arr - The array to set the color values from. * @example * const c = new pc.Color([0.1, 0.2, 0.3, 0.4]); */ - /** - * @param {number|number[]} [r] - The r value. Defaults to 0. If r is an array of length 3 or - * 4, the array will be used to populate all components. - * @param {number} [g] - The g value. Defaults to 0. - * @param {number} [b] - The b value. Defaults to 0. - * @param {number} [a] - The a value. Defaults to 1. - */ - constructor(r = 0, g = 0, b = 0, a = 1) { - const length = r.length; - if (length === 3 || length === 4) { - this.r = r[0]; - this.g = r[1]; - this.b = r[2]; - this.a = r[3] ?? 1; + constructor(r: number | number[] = 0, g: number = 0, b: number = 0, a: number = 1) { + if (Array.isArray(r)) { + const length = r.length; + if (length === 3 || length === 4) { + this.r = r[0]; + this.g = r[1]; + this.b = r[2]; + this.a = r[3] ?? 1; + } else { + this.r = 0; + this.g = 0; + this.b = 0; + this.a = 1; + } } else { this.r = r; this.g = g; @@ -84,19 +70,18 @@ class Color { /** * Returns a clone of the specified color. * - * @returns {this} A duplicate color object. + * @returns A duplicate color object. */ - clone() { - /** @type {this} */ - const cstr = this.constructor; + clone(): this { + const cstr = this.constructor as new (r: number, g: number, b: number, a: number) => this; return new cstr(this.r, this.g, this.b, this.a); } /** * Copies the contents of a source color to a destination color. * - * @param {Color} rhs - A color to copy to the specified color. - * @returns {Color} Self for chaining. + * @param rhs - A color to copy to the specified color. + * @returns Self for chaining. * @example * const src = new pc.Color(1, 0, 0, 1); * const dst = new pc.Color(); @@ -105,7 +90,7 @@ class Color { * * console.log("The two colors are " + (dst.equals(src) ? "equal" : "different")); */ - copy(rhs) { + copy(rhs: Color): Color { this.r = rhs.r; this.g = rhs.g; this.b = rhs.b; @@ -117,27 +102,27 @@ class Color { /** * Reports whether two colors are equal. * - * @param {Color} rhs - The color to compare to the specified color. - * @returns {boolean} True if the colors are equal and false otherwise. + * @param rhs - The color to compare to the specified color. + * @returns True if the colors are equal and false otherwise. * @example * const a = new pc.Color(1, 0, 0, 1); * const b = new pc.Color(1, 1, 0, 1); * console.log("The two colors are " + (a.equals(b) ? "equal" : "different")); */ - equals(rhs) { + equals(rhs: Color): boolean { return this.r === rhs.r && this.g === rhs.g && this.b === rhs.b && this.a === rhs.a; } /** * Assign values to the color components, including alpha. * - * @param {number} r - The value for red (0-1). - * @param {number} g - The value for blue (0-1). - * @param {number} b - The value for green (0-1). - * @param {number} [a] - The value for the alpha (0-1), defaults to 1. - * @returns {Color} Self for chaining. + * @param r - The value for red (0-1). + * @param g - The value for blue (0-1). + * @param b - The value for green (0-1). + * @param a - The value for the alpha (0-1), defaults to 1. + * @returns Self for chaining. */ - set(r, g, b, a = 1) { + set(r: number, g: number, b: number, a: number = 1): Color { this.r = r; this.g = g; this.b = b; @@ -149,12 +134,12 @@ class Color { /** * Returns the result of a linear interpolation between two specified colors. * - * @param {Color} lhs - The color to interpolate from. - * @param {Color} rhs - The color to interpolate to. - * @param {number} alpha - The value controlling the point of interpolation. Between 0 and 1, + * @param lhs - The color to interpolate from. + * @param rhs - The color to interpolate to. + * @param alpha - The value controlling the point of interpolation. Between 0 and 1, * the linear interpolant will occur on a straight line between lhs and rhs. Outside of this * range, the linear interpolant will occur on a ray extrapolated from this line. - * @returns {Color} Self for chaining. + * @returns Self for chaining. * @example * const a = new pc.Color(0, 0, 0); * const b = new pc.Color(1, 1, 0.5); @@ -164,7 +149,7 @@ class Color { * r.lerp(a, b, 0.5); // r is 0.5, 0.5, 0.25 * r.lerp(a, b, 1); // r is equal to b */ - lerp(lhs, rhs, alpha) { + lerp(lhs: Color, rhs: Color, alpha: number): Color { this.r = lhs.r + alpha * (rhs.r - lhs.r); this.g = lhs.g + alpha * (rhs.g - lhs.g); this.b = lhs.b + alpha * (rhs.b - lhs.b); @@ -176,11 +161,11 @@ class Color { /** * Converts the color from gamma to linear color space. * - * @param {Color} [src] - The color to convert to linear color space. If not set, the operation + * @param src - The color to convert to linear color space. If not set, the operation * is done in place. - * @returns {Color} Self for chaining. + * @returns Self for chaining. */ - linear(src = this) { + linear(src: Color = this): Color { this.r = Math.pow(src.r, 2.2); this.g = Math.pow(src.g, 2.2); this.b = Math.pow(src.b, 2.2); @@ -191,11 +176,11 @@ class Color { /** * Converts the color from linear to gamma color space. * - * @param {Color} [src] - The color to convert to gamma color space. If not set, the operation is + * @param src - The color to convert to gamma color space. If not set, the operation is * done in place. - * @returns {Color} Self for chaining. + * @returns Self for chaining. */ - gamma(src = this) { + gamma(src: Color = this): Color { this.r = Math.pow(src.r, 1 / 2.2); this.g = Math.pow(src.g, 1 / 2.2); this.b = Math.pow(src.b, 1 / 2.2); @@ -206,10 +191,10 @@ class Color { /** * Multiplies RGB elements of a Color by a number. Note that the alpha value is left unchanged. * - * @param {number} scalar - The number to multiply by. - * @returns {Color} Self for chaining. + * @param scalar - The number to multiply by. + * @returns Self for chaining. */ - mulScalar(scalar) { + mulScalar(scalar: number): Color { this.r *= scalar; this.g *= scalar; this.b *= scalar; @@ -219,14 +204,14 @@ class Color { /** * Set the values of the color from a string representation '#11223344' or '#112233'. * - * @param {string} hex - A string representation in the format '#RRGGBBAA' or '#RRGGBB'. Where + * @param hex - A string representation in the format '#RRGGBBAA' or '#RRGGBB'. Where * RR, GG, BB, AA are red, green, blue and alpha values. This is the same format used in * HTML/CSS. - * @returns {Color} Self for chaining. + * @returns Self for chaining. */ - fromString(hex) { + fromString(hex: string): Color { const i = parseInt(hex.replace('#', '0x'), 16); - let bytes; + let bytes: number[]; if (hex.length > 7) { bytes = math.intToBytes32(i); } else { @@ -242,16 +227,16 @@ class Color { /** * Set the values of the vector from an array. * - * @param {number[]} arr - The array to set the vector values from. - * @param {number} [offset] - The zero-based index at which to start copying elements from the + * @param arr - The array to set the vector values from. + * @param offset - The zero-based index at which to start copying elements from the * array. Default is 0. - * @returns {Color} Self for chaining. + * @returns Self for chaining. * @example * const c = new pc.Color(); * c.fromArray([1, 0, 1, 1]); * // c is set to [1, 0, 1, 1] */ - fromArray(arr, offset = 0) { + fromArray(arr: number[], offset: number = 0): Color { this.r = arr[offset] ?? this.r; this.g = arr[offset + 1] ?? this.g; this.b = arr[offset + 2] ?? this.b; @@ -265,15 +250,15 @@ class Color { * red, green, blue and alpha values. When the alpha value is not included (the default), this * is the same format as used in HTML/CSS. * - * @param {boolean} alpha - If true, the output string will include the alpha value. - * @param {boolean} [asArray] - If true, the output will be an array of numbers. Defaults to false. - * @returns {string} The color in string form. + * @param alpha - If true, the output string will include the alpha value. + * @param asArray - If true, the output will be an array of numbers. Defaults to false. + * @returns The color in string form. * @example * const c = new pc.Color(1, 1, 1); * // Outputs #ffffffff * console.log(c.toString()); */ - toString(alpha, asArray) { + toString(alpha?: boolean, asArray?: boolean): string { const { r, g, b, a } = this; @@ -297,98 +282,72 @@ class Color { /** * Converts the color to an array. * - * @param {number[]|ArrayBufferView} [arr] - The array to populate with the color's number + * @param arr - The array to populate with the color's number * components. If not specified, a new array is created. - * @param {number} [offset] - The zero-based index at which to start copying elements to the + * @param offset - The zero-based index at which to start copying elements to the * array. Default is 0. - * @param {boolean} [alpha] - If true, the output array will include the alpha value. - * @returns {number[]|ArrayBufferView} The color as an array. + * @param alpha - If true, the output array will include the alpha value. + * @returns The color as an array. * @example * const c = new pc.Color(1, 1, 1); * // Outputs [1, 1, 1, 1] * console.log(c.toArray()); */ - toArray(arr = [], offset = 0, alpha = true) { - arr[offset] = this.r; - arr[offset + 1] = this.g; - arr[offset + 2] = this.b; + toArray & { [key: number]: number } = number[]>(arr?: T, offset: number = 0, alpha: boolean = true): T { + const result = arr || [] as unknown as T; + result[offset] = this.r; + result[offset + 1] = this.g; + result[offset + 2] = this.b; if (alpha) { - arr[offset + 3] = this.a; + result[offset + 3] = this.a; } - return arr; + return result; } /** * A constant color set to black [0, 0, 0, 1]. - * - * @type {Color} - * @readonly */ - static BLACK = Object.freeze(new Color(0, 0, 0, 1)); + static readonly BLACK = Object.freeze(new Color(0, 0, 0, 1)); /** * A constant color set to blue [0, 0, 1, 1]. - * - * @type {Color} - * @readonly */ - static BLUE = Object.freeze(new Color(0, 0, 1, 1)); + static readonly BLUE = Object.freeze(new Color(0, 0, 1, 1)); /** * A constant color set to cyan [0, 1, 1, 1]. - * - * @type {Color} - * @readonly */ - static CYAN = Object.freeze(new Color(0, 1, 1, 1)); + static readonly CYAN = Object.freeze(new Color(0, 1, 1, 1)); /** * A constant color set to gray [0.5, 0.5, 0.5, 1]. - * - * @type {Color} - * @readonly */ - static GRAY = Object.freeze(new Color(0.5, 0.5, 0.5, 1)); + static readonly GRAY = Object.freeze(new Color(0.5, 0.5, 0.5, 1)); /** * A constant color set to green [0, 1, 0, 1]. - * - * @type {Color} - * @readonly */ - static GREEN = Object.freeze(new Color(0, 1, 0, 1)); + static readonly GREEN = Object.freeze(new Color(0, 1, 0, 1)); /** * A constant color set to magenta [1, 0, 1, 1]. - * - * @type {Color} - * @readonly */ - static MAGENTA = Object.freeze(new Color(1, 0, 1, 1)); + static readonly MAGENTA = Object.freeze(new Color(1, 0, 1, 1)); /** * A constant color set to red [1, 0, 0, 1]. - * - * @type {Color} - * @readonly */ - static RED = Object.freeze(new Color(1, 0, 0, 1)); + static readonly RED = Object.freeze(new Color(1, 0, 0, 1)); /** * A constant color set to white [1, 1, 1, 1]. - * - * @type {Color} - * @readonly */ - static WHITE = Object.freeze(new Color(1, 1, 1, 1)); + static readonly WHITE = Object.freeze(new Color(1, 1, 1, 1)); /** * A constant color set to yellow [1, 1, 0, 1]. - * - * @type {Color} - * @readonly */ - static YELLOW = Object.freeze(new Color(1, 1, 0, 1)); + static readonly YELLOW = Object.freeze(new Color(1, 1, 0, 1)); } -export { Color }; +export { Color }; \ No newline at end of file diff --git a/src/core/math/float-packing.js b/src/core/math/float-packing.js index f30fc013bb9..9d5b3c49ec5 100644 --- a/src/core/math/float-packing.js +++ b/src/core/math/float-packing.js @@ -1,5 +1,5 @@ /** - * @import { Color } from './color.js' + * @import { Color } from './color' */ const floatView = new Float32Array(1); diff --git a/src/extras/exporters/core-exporter.js b/src/extras/exporters/core-exporter.js index 6385d2f1567..06fd3ec759a 100644 --- a/src/extras/exporters/core-exporter.js +++ b/src/extras/exporters/core-exporter.js @@ -9,7 +9,7 @@ import { } from '../../platform/graphics/constants.js'; /** - * @import { Color } from '../../core/math/color.js' + * @import { Color } from '../../core/math/color' */ /** diff --git a/src/extras/exporters/gltf-exporter.js b/src/extras/exporters/gltf-exporter.js index b347d281e4c..2bb232c71ee 100644 --- a/src/extras/exporters/gltf-exporter.js +++ b/src/extras/exporters/gltf-exporter.js @@ -3,7 +3,7 @@ import { math } from '../../core/math/math.js'; import { Vec2 } from '../../core/math/vec2.js'; import { Vec3 } from '../../core/math/vec3.js'; import { Quat } from '../../core/math/quat.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { BoundingBox } from '../../core/shape/bounding-box.js'; import { CULLFACE_NONE, diff --git a/src/extras/exporters/usdz-exporter.js b/src/extras/exporters/usdz-exporter.js index 6cc75da123c..c4b0cb89434 100644 --- a/src/extras/exporters/usdz-exporter.js +++ b/src/extras/exporters/usdz-exporter.js @@ -1,6 +1,6 @@ import { CoreExporter } from './core-exporter.js'; import { zipSync, strToU8 } from 'fflate'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { SEMANTIC_POSITION, diff --git a/src/extras/gizmo/color.js b/src/extras/gizmo/color.js index 64d44342483..8dcee1d19b5 100644 --- a/src/extras/gizmo/color.js +++ b/src/extras/gizmo/color.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; export const COLOR_RED = Object.freeze(new Color(1, 0.3, 0.3)); export const COLOR_GREEN = Object.freeze(new Color(0.3, 1, 0.3)); diff --git a/src/extras/gizmo/rotate-gizmo.js b/src/extras/gizmo/rotate-gizmo.js index e268bf83ae9..88461f18e28 100644 --- a/src/extras/gizmo/rotate-gizmo.js +++ b/src/extras/gizmo/rotate-gizmo.js @@ -1,5 +1,5 @@ import { math } from '../../core/math/math.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Quat } from '../../core/math/quat.js'; import { Mat4 } from '../../core/math/mat4.js'; import { Vec3 } from '../../core/math/vec3.js'; diff --git a/src/extras/gizmo/shape/shape.js b/src/extras/gizmo/shape/shape.js index 8fb5e82d286..08f00110f6a 100644 --- a/src/extras/gizmo/shape/shape.js +++ b/src/extras/gizmo/shape/shape.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { Vec3 } from '../../../core/math/vec3.js'; import { ShaderMaterial } from '../../../scene/materials/shader-material.js'; import { MeshInstance } from '../../../scene/mesh-instance.js'; @@ -6,7 +6,7 @@ import { Entity } from '../../../framework/entity.js'; import { CULLFACE_BACK, SEMANTIC_POSITION, SEMANTIC_COLOR } from '../../../platform/graphics/constants.js'; import { BLEND_NORMAL } from '../../../scene/constants.js'; -import { COLOR_GRAY } from '../color.js'; +import { COLOR_GRAY } from '../color'; import { Mesh } from '../../../scene/mesh.js'; import { Geometry } from '../../../scene/geometry/geometry.js'; import { BoxGeometry } from '../../../scene/geometry/box-geometry.js'; diff --git a/src/extras/gizmo/transform-gizmo.js b/src/extras/gizmo/transform-gizmo.js index d6757b95753..5ec6e69121f 100644 --- a/src/extras/gizmo/transform-gizmo.js +++ b/src/extras/gizmo/transform-gizmo.js @@ -1,5 +1,5 @@ import { math } from '../../core/math/math.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Quat } from '../../core/math/quat.js'; import { Vec3 } from '../../core/math/vec3.js'; import { Ray } from '../../core/shape/ray.js'; @@ -14,7 +14,7 @@ import { COLOR_GRAY, color3from4, color4from3 -} from './color.js'; +} from './color'; import { GIZMOAXIS_FACE, GIZMOAXIS_X, GIZMOAXIS_XYZ, GIZMOAXIS_Y, GIZMOAXIS_Z } from './constants.js'; import { Gizmo } from './gizmo.js'; diff --git a/src/extras/gizmo/view-cube.js b/src/extras/gizmo/view-cube.js index cdc229ead08..f61ae8b7d6a 100644 --- a/src/extras/gizmo/view-cube.js +++ b/src/extras/gizmo/view-cube.js @@ -1,9 +1,9 @@ import { EventHandler } from '../../core/event-handler.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Mat4 } from '../../core/math/mat4.js'; import { Vec3 } from '../../core/math/vec3.js'; import { Vec4 } from '../../core/math/vec4.js'; -import { COLOR_BLUE, COLOR_GREEN, COLOR_RED } from './color.js'; +import { COLOR_BLUE, COLOR_GREEN, COLOR_RED } from './color'; const tmpV1 = new Vec3(); const tmpV2 = new Vec3(); diff --git a/src/extras/render-passes/camera-frame.js b/src/extras/render-passes/camera-frame.js index c0a0b56f986..14b4373e4a5 100644 --- a/src/extras/render-passes/camera-frame.js +++ b/src/extras/render-passes/camera-frame.js @@ -1,5 +1,5 @@ import { Debug } from '../../core/debug.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { math } from '../../core/math/math.js'; import { PIXELFORMAT_111110F, PIXELFORMAT_RGBA16F, PIXELFORMAT_RGBA32F } from '../../platform/graphics/constants.js'; import { SSAOTYPE_NONE } from './constants.js'; diff --git a/src/extras/render-passes/render-pass-bloom.js b/src/extras/render-passes/render-pass-bloom.js index 2d382110b69..3b4d679556b 100644 --- a/src/extras/render-passes/render-pass-bloom.js +++ b/src/extras/render-passes/render-pass-bloom.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Texture } from '../../platform/graphics/texture.js'; import { BlendState } from '../../platform/graphics/blend-state.js'; import { RenderTarget } from '../../platform/graphics/render-target.js'; diff --git a/src/extras/render-passes/render-pass-camera-frame.js b/src/extras/render-passes/render-pass-camera-frame.js index c98a8468d84..123c8dbb702 100644 --- a/src/extras/render-passes/render-pass-camera-frame.js +++ b/src/extras/render-passes/render-pass-camera-frame.js @@ -15,7 +15,7 @@ import { RenderPassSsao } from './render-pass-ssao.js'; import { SSAOTYPE_COMBINE, SSAOTYPE_LIGHTING, SSAOTYPE_NONE } from './constants.js'; import { Debug } from '../../core/debug.js'; import { RenderPassDownsample } from './render-pass-downsample.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; /** * Options used to configure the RenderPassCameraFrame. To modify these options, you must create diff --git a/src/extras/render-passes/render-pass-compose.js b/src/extras/render-passes/render-pass-compose.js index 4d94593e567..5715df3de94 100644 --- a/src/extras/render-passes/render-pass-compose.js +++ b/src/extras/render-passes/render-pass-compose.js @@ -1,5 +1,5 @@ import { math } from '../../core/math/math.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { RenderPassShaderQuad } from '../../scene/graphics/render-pass-shader-quad.js'; import { GAMMA_NONE, GAMMA_SRGB, gammaNames, TONEMAP_LINEAR, tonemapNames } from '../../scene/constants.js'; import { ShaderChunks } from '../../scene/shader-lib/shader-chunks.js'; diff --git a/src/extras/render-passes/render-pass-dof.js b/src/extras/render-passes/render-pass-dof.js index f6204307f86..6b469147d25 100644 --- a/src/extras/render-passes/render-pass-dof.js +++ b/src/extras/render-passes/render-pass-dof.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Texture } from '../../platform/graphics/texture.js'; import { RenderTarget } from '../../platform/graphics/render-target.js'; import { RenderPass } from '../../platform/graphics/render-pass.js'; diff --git a/src/extras/render-passes/render-pass-prepass.js b/src/extras/render-passes/render-pass-prepass.js index f4878273064..8c4a7adcb0c 100644 --- a/src/extras/render-passes/render-pass-prepass.js +++ b/src/extras/render-passes/render-pass-prepass.js @@ -12,7 +12,7 @@ import { LAYERID_DEPTH, SHADER_PREPASS } from '../../scene/constants.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { FloatPacking } from '../../core/math/float-packing.js'; /** diff --git a/src/extras/render-passes/render-pass-ssao.js b/src/extras/render-passes/render-pass-ssao.js index 0c3189a3b50..18ae6c985e4 100644 --- a/src/extras/render-passes/render-pass-ssao.js +++ b/src/extras/render-passes/render-pass-ssao.js @@ -1,5 +1,5 @@ import { BlueNoise } from '../../core/math/blue-noise.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { ADDRESS_CLAMP_TO_EDGE, FILTER_NEAREST, PIXELFORMAT_R8, SEMANTIC_POSITION, SHADERLANGUAGE_GLSL, SHADERLANGUAGE_WGSL diff --git a/src/extras/renderers/outline-renderer.js b/src/extras/renderers/outline-renderer.js index ea297fd3f48..9358e72d613 100644 --- a/src/extras/renderers/outline-renderer.js +++ b/src/extras/renderers/outline-renderer.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Entity } from '../../framework/entity.js'; import { BlendState } from '../../platform/graphics/blend-state.js'; import { diff --git a/src/framework/app-base.js b/src/framework/app-base.js index ae50e71d74f..27f00cc4d07 100644 --- a/src/framework/app-base.js +++ b/src/framework/app-base.js @@ -7,7 +7,7 @@ import { path } from '../core/path.js'; import { TRACEID_RENDER_FRAME, TRACEID_RENDER_FRAME_TIME } from '../core/constants.js'; import { Debug } from '../core/debug.js'; import { EventHandler } from '../core/event-handler.js'; -import { Color } from '../core/math/color.js'; +import { Color } from '../core/math/color'; import { Mat4 } from '../core/math/mat4.js'; import { math } from '../core/math/math.js'; import { Quat } from '../core/math/quat.js'; diff --git a/src/framework/components/anim/component-binder.js b/src/framework/components/anim/component-binder.js index e8ea67830f0..4e1fe509fea 100644 --- a/src/framework/components/anim/component-binder.js +++ b/src/framework/components/anim/component-binder.js @@ -2,7 +2,7 @@ import { AnimTarget } from '../../anim/evaluator/anim-target.js'; import { DefaultAnimBinder } from '../../anim/binder/default-anim-binder.js'; import { AnimBinder } from '../../anim/binder/anim-binder.js'; -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { Quat } from '../../../core/math/quat.js'; import { Vec2 } from '../../../core/math/vec2.js'; import { Vec3 } from '../../../core/math/vec3.js'; diff --git a/src/framework/components/button/component.js b/src/framework/components/button/component.js index 84de9f1b5a5..3f57a5d430c 100644 --- a/src/framework/components/button/component.js +++ b/src/framework/components/button/component.js @@ -1,6 +1,6 @@ import { now } from '../../../core/time.js'; import { math } from '../../../core/math/math.js'; -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { GraphNode } from '../../../scene/graph-node.js'; diff --git a/src/framework/components/button/data.js b/src/framework/components/button/data.js index 300ee807aa8..633c6721287 100644 --- a/src/framework/components/button/data.js +++ b/src/framework/components/button/data.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { Vec4 } from '../../../core/math/vec4.js'; import { BUTTON_TRANSITION_MODE_TINT } from './constants.js'; diff --git a/src/framework/components/camera/component.js b/src/framework/components/camera/component.js index 98d0b31efc1..c58aeeb7f5d 100644 --- a/src/framework/components/camera/component.js +++ b/src/framework/components/camera/component.js @@ -7,7 +7,7 @@ import { PostEffectQueue } from './post-effect-queue.js'; /** * @import { CameraComponentSystem } from './system.js' - * @import { Color } from '../../../core/math/color.js' + * @import { Color } from '../../../core/math/color' * @import { Entity } from '../../entity.js' * @import { EventHandle } from '../../../core/event-handle.js' * @import { Frustum } from '../../../core/shape/frustum.js' diff --git a/src/framework/components/camera/system.js b/src/framework/components/camera/system.js index 52b2312f0c5..9eee4e1764d 100644 --- a/src/framework/components/camera/system.js +++ b/src/framework/components/camera/system.js @@ -1,5 +1,5 @@ import { sortPriority } from '../../../core/sort.js'; -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { Vec4 } from '../../../core/math/vec4.js'; import { Component } from '../component.js'; import { ComponentSystem } from '../system.js'; diff --git a/src/framework/components/element/component.js b/src/framework/components/element/component.js index 0f737b24bc9..a606bf80753 100644 --- a/src/framework/components/element/component.js +++ b/src/framework/components/element/component.js @@ -17,7 +17,7 @@ import { TextElement } from './text-element.js'; /** * @import { BoundingBox } from '../../../core/shape/bounding-box.js' * @import { CanvasFont } from '../../../framework/font/canvas-font.js' - * @import { Color } from '../../../core/math/color.js' + * @import { Color } from '../../../core/math/color' * @import { ElementComponentData } from './data.js' * @import { ElementComponentSystem } from './system.js' * @import { EventHandle } from '../../../core/event-handle.js' diff --git a/src/framework/components/element/image-element.js b/src/framework/components/element/image-element.js index fa071663a85..7817e9feea9 100644 --- a/src/framework/components/element/image-element.js +++ b/src/framework/components/element/image-element.js @@ -1,7 +1,7 @@ import { Debug } from '../../../core/debug.js'; import { TRACEID_ELEMENT } from '../../../core/constants.js'; import { math } from '../../../core/math/math.js'; -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { Vec2 } from '../../../core/math/vec2.js'; import { Vec3 } from '../../../core/math/vec3.js'; import { Vec4 } from '../../../core/math/vec4.js'; diff --git a/src/framework/components/element/system.js b/src/framework/components/element/system.js index 39e3958502f..07416296cbf 100644 --- a/src/framework/components/element/system.js +++ b/src/framework/components/element/system.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { Vec2 } from '../../../core/math/vec2.js'; import { Vec4 } from '../../../core/math/vec4.js'; import { PIXELFORMAT_SRGBA8 } from '../../../platform/graphics/constants.js'; diff --git a/src/framework/components/element/text-element.js b/src/framework/components/element/text-element.js index da9c5a11cab..eb06d3ad81c 100644 --- a/src/framework/components/element/text-element.js +++ b/src/framework/components/element/text-element.js @@ -1,7 +1,7 @@ import { Debug } from '../../../core/debug.js'; import { string } from '../../../core/string.js'; import { math } from '../../../core/math/math.js'; -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { Vec2 } from '../../../core/math/vec2.js'; import { BoundingBox } from '../../../core/shape/bounding-box.js'; import { SEMANTIC_POSITION, SEMANTIC_TEXCOORD0, SEMANTIC_COLOR, SEMANTIC_ATTR8, SEMANTIC_ATTR9, TYPE_FLOAT32 } from '../../../platform/graphics/constants.js'; diff --git a/src/framework/components/light/component.js b/src/framework/components/light/component.js index f5bb1d752be..e574a954d7e 100644 --- a/src/framework/components/light/component.js +++ b/src/framework/components/light/component.js @@ -6,7 +6,7 @@ import { Component } from '../component.js'; import { properties } from './data.js'; /** - * @import { Color } from '../../../core/math/color.js' + * @import { Color } from '../../../core/math/color' * @import { EventHandle } from '../../../core/event-handle.js' * @import { LightComponentData } from './data.js' * @import { Light } from '../../../scene/light.js' diff --git a/src/framework/components/light/data.js b/src/framework/components/light/data.js index 1bb259013df..87bbfd9981e 100644 --- a/src/framework/components/light/data.js +++ b/src/framework/components/light/data.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { BLUR_GAUSSIAN, LAYERID_WORLD, diff --git a/src/framework/components/light/system.js b/src/framework/components/light/system.js index baa86c1550e..46b9bb7a244 100644 --- a/src/framework/components/light/system.js +++ b/src/framework/components/light/system.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { Vec2 } from '../../../core/math/vec2.js'; import { LIGHTSHAPE_PUNCTUAL } from '../../../scene/constants.js'; import { Light, lightTypes } from '../../../scene/light.js'; diff --git a/src/framework/components/sprite/component.js b/src/framework/components/sprite/component.js index ab3ba7fcc87..6f73585267b 100644 --- a/src/framework/components/sprite/component.js +++ b/src/framework/components/sprite/component.js @@ -1,6 +1,6 @@ import { Debug } from '../../../core/debug.js'; import { math } from '../../../core/math/math.js'; -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { Vec2 } from '../../../core/math/vec2.js'; import { Vec4 } from '../../../core/math/vec4.js'; import { diff --git a/src/framework/components/sprite/system.js b/src/framework/components/sprite/system.js index df3426607c3..d90c8772a11 100644 --- a/src/framework/components/sprite/system.js +++ b/src/framework/components/sprite/system.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { CULLFACE_NONE, PIXELFORMAT_SRGBA8 diff --git a/src/framework/components/system.js b/src/framework/components/system.js index 7ecfb4d4977..ed273a4bfea 100644 --- a/src/framework/components/system.js +++ b/src/framework/components/system.js @@ -1,5 +1,5 @@ import { EventHandler } from '../../core/event-handler.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Vec2 } from '../../core/math/vec2.js'; import { Vec3 } from '../../core/math/vec3.js'; import { Vec4 } from '../../core/math/vec4.js'; diff --git a/src/framework/font/canvas-font.js b/src/framework/font/canvas-font.js index 4bc6be6139b..7fd13147707 100644 --- a/src/framework/font/canvas-font.js +++ b/src/framework/font/canvas-font.js @@ -1,6 +1,6 @@ import { string } from '../../core/string.js'; import { EventHandler } from '../../core/event-handler.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { ADDRESS_CLAMP_TO_EDGE, FILTER_LINEAR, FILTER_LINEAR_MIPMAP_LINEAR, diff --git a/src/framework/graphics/picker.js b/src/framework/graphics/picker.js index 0b674d63fab..cd873bd59b5 100644 --- a/src/framework/graphics/picker.js +++ b/src/framework/graphics/picker.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { ADDRESS_CLAMP_TO_EDGE, FILTER_NEAREST, PIXELFORMAT_RGBA8 } from '../../platform/graphics/constants.js'; import { RenderTarget } from '../../platform/graphics/render-target.js'; import { Texture } from '../../platform/graphics/texture.js'; diff --git a/src/framework/lightmapper/bake-light-ambient.js b/src/framework/lightmapper/bake-light-ambient.js index b2795881890..8a910d6a684 100644 --- a/src/framework/lightmapper/bake-light-ambient.js +++ b/src/framework/lightmapper/bake-light-ambient.js @@ -1,6 +1,6 @@ import { Vec3 } from '../../core/math/vec3.js'; import { random } from '../../core/math/random.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Entity } from '../entity.js'; import { SHADOW_PCF3_32F } from '../../scene/constants.js'; import { BakeLight } from './bake-light.js'; diff --git a/src/framework/lightmapper/lightmapper.js b/src/framework/lightmapper/lightmapper.js index 4c5496b5d0d..ef26644f987 100644 --- a/src/framework/lightmapper/lightmapper.js +++ b/src/framework/lightmapper/lightmapper.js @@ -1,6 +1,6 @@ import { Debug } from '../../core/debug.js'; import { now } from '../../core/time.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { math } from '../../core/math/math.js'; import { Vec3 } from '../../core/math/vec3.js'; import { BoundingBox } from '../../core/shape/bounding-box.js'; diff --git a/src/framework/parsers/glb-parser.js b/src/framework/parsers/glb-parser.js index 1c725948e22..8c865690526 100644 --- a/src/framework/parsers/glb-parser.js +++ b/src/framework/parsers/glb-parser.js @@ -1,6 +1,6 @@ import { Debug } from '../../core/debug.js'; import { path } from '../../core/path.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Mat4 } from '../../core/math/mat4.js'; import { math } from '../../core/math/math.js'; import { Vec2 } from '../../core/math/vec2.js'; diff --git a/src/framework/parsers/material/json-standard-material.js b/src/framework/parsers/material/json-standard-material.js index 40331715b2c..d5a1b0b2384 100644 --- a/src/framework/parsers/material/json-standard-material.js +++ b/src/framework/parsers/material/json-standard-material.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { Vec2 } from '../../../core/math/vec2.js'; import { Vec3 } from '../../../core/math/vec3.js'; diff --git a/src/framework/script/script-attributes.js b/src/framework/script/script-attributes.js index a84bdd41209..6dc0aa91fff 100644 --- a/src/framework/script/script-attributes.js +++ b/src/framework/script/script-attributes.js @@ -1,5 +1,5 @@ import { Debug } from '../../core/debug.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Curve } from '../../core/math/curve.js'; import { CurveSet } from '../../core/math/curve-set.js'; import { Vec2 } from '../../core/math/vec2.js'; diff --git a/src/framework/xr/xr-light-estimation.js b/src/framework/xr/xr-light-estimation.js index 258eab8a48c..a2630203f0b 100644 --- a/src/framework/xr/xr-light-estimation.js +++ b/src/framework/xr/xr-light-estimation.js @@ -1,5 +1,5 @@ import { EventHandler } from '../../core/event-handler.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Mat4 } from '../../core/math/mat4.js'; import { Quat } from '../../core/math/quat.js'; import { Vec3 } from '../../core/math/vec3.js'; diff --git a/src/index.js b/src/index.js index 94e07da1eb4..eb223ebf6a4 100644 --- a/src/index.js +++ b/src/index.js @@ -81,7 +81,7 @@ export { Tracing } from './core/tracing.js'; // CORE / MATH export * from './core/math/constants.js'; export { math } from './core/math/math.js'; -export { Color } from './core/math/color.js'; +export { Color } from './core/math/color'; export { Curve } from './core/math/curve.js'; export { CurveSet } from './core/math/curve-set.js'; export { FloatPacking } from './core/math/float-packing.js'; diff --git a/src/platform/graphics/graphics-device.js b/src/platform/graphics/graphics-device.js index 5c620403d4b..31e95efe5ca 100644 --- a/src/platform/graphics/graphics-device.js +++ b/src/platform/graphics/graphics-device.js @@ -5,7 +5,7 @@ import { platform } from '../../core/platform.js'; import { now } from '../../core/time.js'; import { Vec2 } from '../../core/math/vec2.js'; import { Tracing } from '../../core/tracing.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { TRACEID_TEXTURES } from '../../core/constants.js'; import { CULLFACE_BACK, diff --git a/src/platform/graphics/render-pass.js b/src/platform/graphics/render-pass.js index 1cbda67fca8..d7d83e9d0a9 100644 --- a/src/platform/graphics/render-pass.js +++ b/src/platform/graphics/render-pass.js @@ -1,6 +1,6 @@ import { Debug } from '../../core/debug.js'; import { Tracing } from '../../core/tracing.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { TRACEID_RENDER_PASS, TRACEID_RENDER_PASS_DETAIL } from '../../core/constants.js'; import { isIntegerPixelFormat, pixelFormatInfo } from './constants.js'; diff --git a/src/platform/graphics/webgl/webgl-graphics-device.js b/src/platform/graphics/webgl/webgl-graphics-device.js index b39b1db586c..16f07e353e1 100644 --- a/src/platform/graphics/webgl/webgl-graphics-device.js +++ b/src/platform/graphics/webgl/webgl-graphics-device.js @@ -1,7 +1,7 @@ import { math } from '../../../core/math/math.js'; import { Debug } from '../../../core/debug.js'; import { platform } from '../../../core/platform.js'; -import { Color } from '../../../core/math/color.js'; +import { Color } from '../../../core/math/color'; import { CLEARFLAG_COLOR, CLEARFLAG_DEPTH, CLEARFLAG_STENCIL, CULLFACE_NONE, diff --git a/src/scene/camera.js b/src/scene/camera.js index f03a8fe6240..60d0c9be418 100644 --- a/src/scene/camera.js +++ b/src/scene/camera.js @@ -1,4 +1,4 @@ -import { Color } from '../core/math/color.js'; +import { Color } from '../core/math/color'; import { Mat4 } from '../core/math/mat4.js'; import { Vec3 } from '../core/math/vec3.js'; import { Vec4 } from '../core/math/vec4.js'; diff --git a/src/scene/fog-params.js b/src/scene/fog-params.js index 5867c2dd589..a3ad015d127 100644 --- a/src/scene/fog-params.js +++ b/src/scene/fog-params.js @@ -1,4 +1,4 @@ -import { Color } from '../core/math/color.js'; +import { Color } from '../core/math/color'; import { FOG_NONE } from './constants.js'; /** diff --git a/src/scene/gsplat/gsplat-data.js b/src/scene/gsplat/gsplat-data.js index e77497edb5f..04b1cadd5cc 100644 --- a/src/scene/gsplat/gsplat-data.js +++ b/src/scene/gsplat/gsplat-data.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Mat4 } from '../../core/math/mat4.js'; import { Quat } from '../../core/math/quat.js'; import { Vec3 } from '../../core/math/vec3.js'; diff --git a/src/scene/light.js b/src/scene/light.js index 71aa36e5249..bf00dd8f4ca 100644 --- a/src/scene/light.js +++ b/src/scene/light.js @@ -1,5 +1,5 @@ import { math } from '../core/math/math.js'; -import { Color } from '../core/math/color.js'; +import { Color } from '../core/math/color'; import { Mat4 } from '../core/math/mat4.js'; import { Vec2 } from '../core/math/vec2.js'; import { Vec3 } from '../core/math/vec3.js'; diff --git a/src/scene/lighting/world-clusters-debug.js b/src/scene/lighting/world-clusters-debug.js index 1fed326ac11..9cc41c30a18 100644 --- a/src/scene/lighting/world-clusters-debug.js +++ b/src/scene/lighting/world-clusters-debug.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Mat4 } from '../../core/math/mat4.js'; import { Vec3 } from '../../core/math/vec3.js'; diff --git a/src/scene/materials/standard-material.js b/src/scene/materials/standard-material.js index d563a3415d9..5decf169bc6 100644 --- a/src/scene/materials/standard-material.js +++ b/src/scene/materials/standard-material.js @@ -1,5 +1,5 @@ import { Debug } from '../../core/debug.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { math } from '../../core/math/math.js'; import { Vec2 } from '../../core/math/vec2.js'; import { ShaderProcessorOptions } from '../../platform/graphics/shader-processor-options.js'; diff --git a/src/scene/renderer/forward-renderer.js b/src/scene/renderer/forward-renderer.js index 196067730be..9ce7b0ec5c9 100644 --- a/src/scene/renderer/forward-renderer.js +++ b/src/scene/renderer/forward-renderer.js @@ -1,7 +1,7 @@ import { now } from '../../core/time.js'; import { Debug } from '../../core/debug.js'; import { Vec3 } from '../../core/math/vec3.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { DebugGraphics } from '../../platform/graphics/debug-graphics.js'; import { FOG_NONE, FOG_LINEAR, diff --git a/src/scene/renderer/shadow-renderer.js b/src/scene/renderer/shadow-renderer.js index 0c3ff02207b..f3b4d053e70 100644 --- a/src/scene/renderer/shadow-renderer.js +++ b/src/scene/renderer/shadow-renderer.js @@ -1,6 +1,6 @@ import { Debug } from '../../core/debug.js'; import { now } from '../../core/time.js'; -import { Color } from '../../core/math/color.js'; +import { Color } from '../../core/math/color'; import { Mat4 } from '../../core/math/mat4.js'; import { Vec3 } from '../../core/math/vec3.js'; import { Vec4 } from '../../core/math/vec4.js'; diff --git a/src/scene/scene.js b/src/scene/scene.js index 03ecd178c74..b8b7b8e7eb1 100644 --- a/src/scene/scene.js +++ b/src/scene/scene.js @@ -1,6 +1,6 @@ import { Debug } from '../core/debug.js'; import { EventHandler } from '../core/event-handler.js'; -import { Color } from '../core/math/color.js'; +import { Color } from '../core/math/color'; import { Vec3 } from '../core/math/vec3.js'; import { Quat } from '../core/math/quat.js'; import { math } from '../core/math/math.js'; diff --git a/tsconfig.json b/tsconfig.json index 12537d29c17..9a576e4c562 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,5 +14,5 @@ "target": "es6", "typeRoots": [ "./node_modules/@webgpu/types", "./node_modules/@types" ] }, - "include": ["src/**/*.js", "scripts/**/*.mjs", "rollup.config.mjs", "playcanvas.d.ts"], + "include": ["src/**/*.js", "src/**/*.ts", "scripts/**/*.mjs", "rollup.config.mjs", "playcanvas.d.ts"], } diff --git a/utils/rollup-build-target.mjs b/utils/rollup-build-target.mjs index 970a7eb3908..9d2ae35a679 100644 --- a/utils/rollup-build-target.mjs +++ b/utils/rollup-build-target.mjs @@ -255,7 +255,9 @@ function buildTarget({ moduleFormat, buildType, bundleState, input = 'src/index. entryFileNames: chunkInfo => `${chunkInfo.name.replace(/node_modules/g, 'modules')}.js` }, plugins: [ - resolve(), + resolve({ + extensions: ['.js', '.ts', '.json'] + }), jscc(getJSCCOptions(isMin ? 'release' : buildType, isUMD)), isUMD ? treeshakeIgnore(TREESHAKE_IGNORE_REGEXES) : undefined, isUMD ? dynamicImportLegacyBrowserSupport() : undefined, From 0c64d2a696eba9a1eacda447ccb8048cca661a8d Mon Sep 17 00:00:00 2001 From: Liam Don Date: Sat, 21 Jun 2025 16:17:16 +0000 Subject: [PATCH 2/9] Try to get mocha working --- package-lock.json | 224 ++++++++++++++++++++++++++++++++++++++++++---- package.json | 7 +- tsconfig.json | 6 ++ 3 files changed, 218 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 14f8fcd0385..01b6be6b1bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "fflate": "0.8.2", "globals": "16.0.0", "jsdom": "26.1.0", - "mocha": "11.1.0", + "mocha": "^11.1.0", "publint": "0.3.12", "rollup": "4.40.1", "rollup-plugin-dts": "6.2.1", @@ -35,6 +35,9 @@ "rollup-plugin-visualizer": "5.14.0", "serve": "14.2.4", "sinon": "19.0.5", + "ts-mocha": "^11.1.0", + "ts-node": "^10.9.2", + "tsconfig-paths": "^4.2.0", "typedoc": "0.28.3", "typedoc-plugin-mdn-links": "5.0.1", "typedoc-plugin-missing-exports": "4.0.0", @@ -98,6 +101,28 @@ "node": ">=18" } }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@csstools/color-helpers": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.0.1.tgz", @@ -1286,6 +1311,30 @@ "@swc/counter": "^0.1.3" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, "node_modules/@types/estree": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", @@ -1318,8 +1367,7 @@ "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/@types/node": { "version": "22.15.3", @@ -1396,6 +1444,18 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "dev": true, + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/agent-base": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", @@ -2356,6 +2416,12 @@ "dev": true, "license": "MIT" }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -2982,6 +3048,30 @@ "ms": "^2.1.1" } }, + "node_modules/eslint-plugin-import/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/eslint-plugin-import/node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, "node_modules/eslint-plugin-jsdoc": { "version": "50.6.11", "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-50.6.11.tgz", @@ -4506,16 +4596,15 @@ "license": "MIT" }, "node_modules/json5": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", - "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.0" - }, "bin": { "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" } }, "node_modules/just-extend": { @@ -4666,6 +4755,12 @@ "node": ">=10" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "node_modules/markdown-it": { "version": "14.1.0", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", @@ -4786,7 +4881,6 @@ "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.1.0.tgz", "integrity": "sha512-8uJR5RTC2NgpY3GrYcgpZrsEd9zKbPDpob1RezyR2upGHRQtHWofmzTMzTMSV6dru3tj5Ukt0+Vnq1qhFEEwAg==", "dev": true, - "license": "MIT", "dependencies": { "ansi-colors": "^4.1.3", "browser-stdout": "^1.3.1", @@ -6794,17 +6888,98 @@ "node": ">=18" } }, + "node_modules/ts-mocha": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/ts-mocha/-/ts-mocha-11.1.0.tgz", + "integrity": "sha512-yT7FfzNRCu8ZKkYvAOiH01xNma/vLq6Vit7yINKYFNVP8e5UyrYXSOMIipERTpzVKJQ4Qcos5bQo1tNERNZevQ==", + "dev": true, + "bin": { + "ts-mocha": "bin/ts-mocha" + }, + "engines": { + "node": ">= 6.X.X" + }, + "peerDependencies": { + "mocha": "^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X || ^11.X.X", + "ts-node": "^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X", + "tsconfig-paths": "^4.X.X" + }, + "peerDependenciesMeta": { + "tsconfig-paths": { + "optional": true + } + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/tsconfig-paths": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", - "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", + "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", "dev": true, - "license": "MIT", "dependencies": { - "@types/json5": "^0.0.29", - "json5": "^1.0.2", + "json5": "^2.2.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=6" } }, "node_modules/tunnel-agent": { @@ -7074,6 +7249,12 @@ "license": "MIT", "optional": true }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, "node_modules/v8-to-istanbul": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", @@ -7562,6 +7743,15 @@ "node": ">=8" } }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 8503b969641..a5396acba37 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "fflate": "0.8.2", "globals": "16.0.0", "jsdom": "26.1.0", - "mocha": "11.1.0", + "mocha": "^11.1.0", "publint": "0.3.12", "rollup": "4.40.1", "rollup-plugin-dts": "6.2.1", @@ -90,6 +90,9 @@ "rollup-plugin-visualizer": "5.14.0", "serve": "14.2.4", "sinon": "19.0.5", + "ts-mocha": "^11.1.0", + "ts-node": "^10.9.2", + "tsconfig-paths": "^4.2.0", "typedoc": "0.28.3", "typedoc-plugin-mdn-links": "5.0.1", "typedoc-plugin-missing-exports": "4.0.0", @@ -125,7 +128,7 @@ "lint": "eslint scripts src test utils build.mjs eslint.config.mjs rollup.config.mjs", "publint": "publint --level error", "serve": "serve build -l 51000 --cors", - "test": "mocha --ignore \"test/assets/scripts/*.js\" --recursive --require test/fixtures.mjs --timeout 5000", + "test": "ts-mocha -p ./tsconfig.test.json --ignore \"test/assets/scripts/*.js\" --recursive --require test/fixtures.mjs --timeout 5000", "test:coverage": "c8 npm test", "test:types": "tsc --pretty false build/playcanvas.d.ts" }, diff --git a/tsconfig.json b/tsconfig.json index 9a576e4c562..4a5a6522df7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,10 +9,16 @@ "noImplicitThis": true, "noUnusedLocals": true, "outDir": "types", + "strict": false, "strictNullChecks": true, + "resolveJsonModule": true, "strictPropertyInitialization": true, "target": "es6", "typeRoots": [ "./node_modules/@webgpu/types", "./node_modules/@types" ] }, + "ts-node": { + "esm": true, + "experimentalSpecifierResolution": "node", + }, "include": ["src/**/*.js", "src/**/*.ts", "scripts/**/*.mjs", "rollup.config.mjs", "playcanvas.d.ts"], } From 8505c22d4018b38f333acbb7e676a29721254e29 Mon Sep 17 00:00:00 2001 From: Liam Don Date: Mon, 23 Jun 2025 17:51:06 +0000 Subject: [PATCH 3/9] Add mocha config --- .mocharc.json | 10 ++ package-lock.json | 273 ++++++++-------------------------------------- package.json | 6 +- 3 files changed, 57 insertions(+), 232 deletions(-) create mode 100644 .mocharc.json diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 00000000000..b5588b87fcf --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,10 @@ +{ + "loader": "ts-node/esm", + "extensions": ["ts", "tsx"], + "spec": [ + "test/**/*.test.mjs" + ], + "watch-files": [ + "src" + ] +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 01b6be6b1bd..0d125980eee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "@rollup/plugin-terser": "0.4.4", "@rollup/pluginutils": "5.1.4", "@swc/core": "1.11.21", + "@types/mocha": "^10.0.10", "@types/node": "22.15.3", "c8": "10.1.3", "chai": "5.2.0", @@ -27,7 +28,7 @@ "fflate": "0.8.2", "globals": "16.0.0", "jsdom": "26.1.0", - "mocha": "^11.1.0", + "mocha": "^11.7.0", "publint": "0.3.12", "rollup": "4.40.1", "rollup-plugin-dts": "6.2.1", @@ -35,7 +36,6 @@ "rollup-plugin-visualizer": "5.14.0", "serve": "14.2.4", "sinon": "19.0.5", - "ts-mocha": "^11.1.0", "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", "typedoc": "0.28.3", @@ -1369,6 +1369,12 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "node_modules/@types/mocha": { + "version": "10.0.10", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", + "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", + "dev": true + }, "node_modules/@types/node": { "version": "22.15.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.3.tgz", @@ -1537,16 +1543,6 @@ "node": ">=8" } }, - "node_modules/ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/ansi-regex": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", @@ -1576,33 +1572,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/anymatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/arch": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", @@ -1830,19 +1799,6 @@ "license": "MIT", "optional": true }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -1902,19 +1858,6 @@ "concat-map": "0.0.1" } }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", @@ -2146,41 +2089,18 @@ } }, "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", "dev": true, - "license": "MIT", "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" + "readdirp": "^4.0.1" }, "engines": { - "node": ">= 8.10.0" + "node": ">= 14.16.0" }, "funding": { "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" } }, "node_modules/chownr": { @@ -2651,11 +2571,10 @@ } }, "node_modules/diff": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", - "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", + "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", "dev": true, - "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } @@ -3310,19 +3229,6 @@ "node": ">=16.0.0" } }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -3970,19 +3876,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "license": "MIT", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/is-boolean-object": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", @@ -4168,16 +4061,6 @@ "dev": true, "license": "MIT" }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, "node_modules/is-number-object": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", @@ -4877,28 +4760,28 @@ "optional": true }, "node_modules/mocha": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.1.0.tgz", - "integrity": "sha512-8uJR5RTC2NgpY3GrYcgpZrsEd9zKbPDpob1RezyR2upGHRQtHWofmzTMzTMSV6dru3tj5Ukt0+Vnq1qhFEEwAg==", + "version": "11.7.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.0.tgz", + "integrity": "sha512-bXfLy/mI8n4QICg+pWj1G8VduX5vC0SHRwFpiR5/Fxc8S2G906pSfkyMmHVsdJNQJQNh3LE67koad9GzEvkV6g==", "dev": true, "dependencies": { - "ansi-colors": "^4.1.3", "browser-stdout": "^1.3.1", - "chokidar": "^3.5.3", + "chokidar": "^4.0.1", "debug": "^4.3.5", - "diff": "^5.2.0", + "diff": "^7.0.0", "escape-string-regexp": "^4.0.0", "find-up": "^5.0.0", "glob": "^10.4.5", "he": "^1.2.0", "js-yaml": "^4.1.0", "log-symbols": "^4.1.0", - "minimatch": "^5.1.6", + "minimatch": "^9.0.5", "ms": "^2.1.3", + "picocolors": "^1.1.1", "serialize-javascript": "^6.0.2", "strip-json-comments": "^3.1.1", "supports-color": "^8.1.1", - "workerpool": "^6.5.1", + "workerpool": "^9.2.0", "yargs": "^17.7.2", "yargs-parser": "^21.1.1", "yargs-unparser": "^2.0.0" @@ -4912,26 +4795,27 @@ } }, "node_modules/mocha/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, - "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } }, "node_modules/mocha/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, - "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=10" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/mocha/node_modules/supports-color": { @@ -5046,16 +4930,6 @@ "license": "MIT", "optional": true }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -5662,29 +5536,16 @@ } }, "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/readdirp/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", "dev": true, - "license": "MIT", "engines": { - "node": ">=8.6" + "node": ">= 14.18.0" }, "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "type": "individual", + "url": "https://paulmillr.com/funding/" } }, "node_modules/refa": { @@ -6412,16 +6273,6 @@ "url": "https://opencollective.com/sinon" } }, - "node_modules/sinon/node_modules/diff": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", - "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/skip-regex": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/skip-regex/-/skip-regex-1.0.2.tgz", @@ -6849,19 +6700,6 @@ "dev": true, "license": "MIT" }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, "node_modules/tough-cookie": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.1.tgz", @@ -6888,28 +6726,6 @@ "node": ">=18" } }, - "node_modules/ts-mocha": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/ts-mocha/-/ts-mocha-11.1.0.tgz", - "integrity": "sha512-yT7FfzNRCu8ZKkYvAOiH01xNma/vLq6Vit7yINKYFNVP8e5UyrYXSOMIipERTpzVKJQ4Qcos5bQo1tNERNZevQ==", - "dev": true, - "bin": { - "ts-mocha": "bin/ts-mocha" - }, - "engines": { - "node": ">= 6.X.X" - }, - "peerDependencies": { - "mocha": "^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X || ^11.X.X", - "ts-node": "^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X", - "tsconfig-paths": "^4.X.X" - }, - "peerDependenciesMeta": { - "tsconfig-paths": { - "optional": true - } - } - }, "node_modules/ts-node": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", @@ -7471,11 +7287,10 @@ } }, "node_modules/workerpool": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", - "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==", - "dev": true, - "license": "Apache-2.0" + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.2.tgz", + "integrity": "sha512-Xz4Nm9c+LiBHhDR5bDLnNzmj6+5F+cyEAWPMkbs2awq/dYazR/efelZzUAjB/y3kNHL+uzkHvxVVpaOfGCPV7A==", + "dev": true }, "node_modules/wrap-ansi": { "version": "8.1.0", diff --git a/package.json b/package.json index a5396acba37..30421149a58 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "@rollup/plugin-terser": "0.4.4", "@rollup/pluginutils": "5.1.4", "@swc/core": "1.11.21", + "@types/mocha": "^10.0.10", "@types/node": "22.15.3", "c8": "10.1.3", "chai": "5.2.0", @@ -82,7 +83,7 @@ "fflate": "0.8.2", "globals": "16.0.0", "jsdom": "26.1.0", - "mocha": "^11.1.0", + "mocha": "^11.7.0", "publint": "0.3.12", "rollup": "4.40.1", "rollup-plugin-dts": "6.2.1", @@ -90,7 +91,6 @@ "rollup-plugin-visualizer": "5.14.0", "serve": "14.2.4", "sinon": "19.0.5", - "ts-mocha": "^11.1.0", "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", "typedoc": "0.28.3", @@ -128,7 +128,7 @@ "lint": "eslint scripts src test utils build.mjs eslint.config.mjs rollup.config.mjs", "publint": "publint --level error", "serve": "serve build -l 51000 --cors", - "test": "ts-mocha -p ./tsconfig.test.json --ignore \"test/assets/scripts/*.js\" --recursive --require test/fixtures.mjs --timeout 5000", + "test": "mocha --ignore \"test/assets/scripts/*.js\" --recursive --require test/fixtures.mjs --timeout 5000", "test:coverage": "c8 npm test", "test:types": "tsc --pretty false build/playcanvas.d.ts" }, From 41db342f88bf0a450d2b6cc019a9b9d602c27de6 Mon Sep 17 00:00:00 2001 From: Liam Don Date: Mon, 23 Jun 2025 17:58:46 +0000 Subject: [PATCH 4/9] Fix mocha tests --- test/framework/components/script/component.test.mjs | 2 +- tsconfig.json | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/framework/components/script/component.test.mjs b/test/framework/components/script/component.test.mjs index a2b69a3e70a..48323a3a268 100644 --- a/test/framework/components/script/component.test.mjs +++ b/test/framework/components/script/component.test.mjs @@ -2940,7 +2940,7 @@ describe('ScriptComponent', function () { it('correctly registers an ESM script with its scriptName', function () { class TestScript extends Script { - static scriptName = 'myTestScript'; + static __name = 'myTestScript'; } const a = new Entity(); a.addComponent('script', { enabled: true }); diff --git a/tsconfig.json b/tsconfig.json index 4a5a6522df7..51489b531d0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,6 +18,10 @@ }, "ts-node": { "esm": true, + // It is faster to skip typechecking. + // Remove if you want ts-node to do typechecking. + "transpileOnly": true, + "files": true, "experimentalSpecifierResolution": "node", }, "include": ["src/**/*.js", "src/**/*.ts", "scripts/**/*.mjs", "rollup.config.mjs", "playcanvas.d.ts"], From 34306cf785c2bb852a615b4005636d9280696564 Mon Sep 17 00:00:00 2001 From: Liam Don Date: Mon, 23 Jun 2025 18:27:39 +0000 Subject: [PATCH 5/9] Fix Mocha tests, and ESLint, and allow importing any .ts source with a .js extension for minimal repo changes --- eslint.config.mjs | 26 +- package-lock.json | 1019 ++++++++++++++++- package.json | 3 + src/core/math/color.ts | 2 +- src/extras/exporters/core-exporter.js | 2 +- src/extras/exporters/gltf-exporter.js | 2 +- src/extras/exporters/usdz-exporter.js | 2 +- src/extras/gizmo/color.js | 2 +- src/extras/gizmo/rotate-gizmo.js | 2 +- src/extras/gizmo/shape/shape.js | 4 +- src/extras/gizmo/transform-gizmo.js | 4 +- src/extras/gizmo/view-cube.js | 4 +- src/extras/render-passes/camera-frame.js | 2 +- src/extras/render-passes/render-pass-bloom.js | 2 +- .../render-passes/render-pass-camera-frame.js | 2 +- .../render-passes/render-pass-compose.js | 2 +- src/extras/render-passes/render-pass-dof.js | 2 +- .../render-passes/render-pass-prepass.js | 2 +- src/extras/render-passes/render-pass-ssao.js | 2 +- src/extras/renderers/outline-renderer.js | 2 +- src/framework/app-base.js | 2 +- .../components/anim/component-binder.js | 2 +- src/framework/components/button/component.js | 2 +- src/framework/components/button/data.js | 2 +- src/framework/components/camera/component.js | 2 +- src/framework/components/camera/system.js | 2 +- src/framework/components/element/component.js | 2 +- .../components/element/image-element.js | 2 +- src/framework/components/element/system.js | 2 +- .../components/element/text-element.js | 2 +- src/framework/components/light/component.js | 2 +- src/framework/components/light/data.js | 2 +- src/framework/components/light/system.js | 2 +- src/framework/components/sprite/component.js | 2 +- src/framework/components/sprite/system.js | 2 +- src/framework/components/system.js | 2 +- src/framework/font/canvas-font.js | 2 +- src/framework/graphics/picker.js | 2 +- .../lightmapper/bake-light-ambient.js | 2 +- src/framework/lightmapper/lightmapper.js | 2 +- src/framework/parsers/glb-parser.js | 2 +- .../material/json-standard-material.js | 2 +- src/framework/script/script-attributes.js | 2 +- src/framework/xr/xr-light-estimation.js | 2 +- src/index.js | 2 +- src/platform/graphics/graphics-device.js | 2 +- src/platform/graphics/render-pass.js | 2 +- .../graphics/webgl/webgl-graphics-device.js | 2 +- src/scene/camera.js | 2 +- src/scene/fog-params.js | 2 +- src/scene/gsplat/gsplat-data.js | 2 +- src/scene/light.js | 2 +- src/scene/lighting/world-clusters-debug.js | 2 +- src/scene/materials/standard-material.js | 2 +- src/scene/renderer/forward-renderer.js | 2 +- src/scene/renderer/shadow-renderer.js | 2 +- src/scene/scene.js | 2 +- utils/rollup-build-target.mjs | 2 + utils/typedoc/typedoc-plugin.mjs | 1 - 59 files changed, 1085 insertions(+), 80 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 8e59750a10c..1ac6414a169 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,5 +1,6 @@ import playcanvasConfig from '@playcanvas/eslint-config'; import globals from 'globals'; +import typescriptParser from '@typescript-eslint/parser'; // Extract or preserve existing JSDoc tags const jsdocRule = playcanvasConfig.find( @@ -10,7 +11,7 @@ const existingTags = jsdocRule?.rules['jsdoc/check-tag-names'][1]?.definedTags | export default [ ...playcanvasConfig, { - files: ['**/*.js', '**/*.mjs'], + files: ['**/*.js', '**/*.mjs', '**/*.ts'], languageOptions: { ecmaVersion: 2022, sourceType: 'module', @@ -36,6 +37,29 @@ export default [ definedTags: [...new Set([...existingTags, 'range', 'step', 'precision'])] } ] + }, + settings: { + 'import/resolver': { + typescript: { + // This allows .js imports to resolve to .ts files + project: './tsconfig.json' + } + } + } + }, + { + files: ['**/*.ts'], + languageOptions: { + parser: typescriptParser, + parserOptions: { + project: './tsconfig.json' + } + }, + rules: { + // TypeScript provides its own type information, so we don't need JSDoc types + 'jsdoc/require-param-type': 'off', + 'jsdoc/require-returns-type': 'off', + 'jsdoc/require-property-type': 'off' } }, { diff --git a/package-lock.json b/package-lock.json index 0d125980eee..912ab022f38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,9 +22,12 @@ "@swc/core": "1.11.21", "@types/mocha": "^10.0.10", "@types/node": "22.15.3", + "@typescript-eslint/eslint-plugin": "^8.35.0", + "@typescript-eslint/parser": "^8.35.0", "c8": "10.1.3", "chai": "5.2.0", "eslint": "9.25.1", + "eslint-import-resolver-typescript": "^4.4.3", "fflate": "0.8.2", "globals": "16.0.0", "jsdom": "26.1.0", @@ -238,6 +241,37 @@ "node": ">=18" } }, + "node_modules/@emnapi/core": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.4.3.tgz", + "integrity": "sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g==", + "dev": true, + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.0.2", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.4.3.tgz", + "integrity": "sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ==", + "dev": true, + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.0.2.tgz", + "integrity": "sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA==", + "dev": true, + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@es-joy/jsdoccomment": { "version": "0.49.0", "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.49.0.tgz", @@ -253,11 +287,10 @@ } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", - "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", + "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", "dev": true, - "license": "MIT", "dependencies": { "eslint-visitor-keys": "^3.4.3" }, @@ -586,6 +619,53 @@ "node": ">=4.2" } }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.11.tgz", + "integrity": "sha512-9DPkXtvHydrcOsopiYpUgPHpmj0HWZKMUnL2dZqpvC42lsratuBG06V5ipyno0fUek5VlFsNQ+AcFATSrJXgMA==", + "dev": true, + "optional": true, + "dependencies": { + "@emnapi/core": "^1.4.3", + "@emnapi/runtime": "^1.4.3", + "@tybys/wasm-util": "^0.9.0" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -1335,6 +1415,16 @@ "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", "dev": true }, + "node_modules/@tybys/wasm-util": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.9.0.tgz", + "integrity": "sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==", + "dev": true, + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@types/estree": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", @@ -1389,18 +1479,524 @@ "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", "dev": true, - "license": "MIT" + "license": "MIT" + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true + }, + "node_modules/@types/webxr": { + "version": "0.5.22", + "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.22.tgz", + "integrity": "sha512-Vr6Stjv5jPRqH690f5I5GLjVk8GSsoQSYJ2FVd/3jJF7KaqfwPi3ehfBS96mlQ2kPCwZaX6U0rG2+NGHBKkA/A==" + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.35.0.tgz", + "integrity": "sha512-ijItUYaiWuce0N1SoSMrEd0b6b6lYkYt99pqCPfybd+HKVXtEvYhICfLdwp42MhiI5mp0oq7PKEL+g1cNiz/Eg==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.35.0", + "@typescript-eslint/type-utils": "8.35.0", + "@typescript-eslint/utils": "8.35.0", + "@typescript-eslint/visitor-keys": "8.35.0", + "graphemer": "^1.4.0", + "ignore": "^7.0.0", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.35.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.35.0.tgz", + "integrity": "sha512-6sMvZePQrnZH2/cJkwRpkT7DxoAWh+g6+GFRK6bV3YQo7ogi3SX5rgF6099r5Q53Ma5qeT7LGmOmuIutF4t3lA==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "8.35.0", + "@typescript-eslint/types": "8.35.0", + "@typescript-eslint/typescript-estree": "8.35.0", + "@typescript-eslint/visitor-keys": "8.35.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.35.0.tgz", + "integrity": "sha512-41xatqRwWZuhUMF/aZm2fcUsOFKNcG28xqRSS6ZVr9BVJtGExosLAm5A1OxTjRMagx8nJqva+P5zNIGt8RIgbQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.35.0", + "@typescript-eslint/types": "^8.35.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.35.0.tgz", + "integrity": "sha512-+AgL5+mcoLxl1vGjwNfiWq5fLDZM1TmTPYs2UkyHfFhgERxBbqHlNjRzhThJqz+ktBqTChRYY6zwbMwy0591AA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.35.0", + "@typescript-eslint/visitor-keys": "8.35.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.35.0.tgz", + "integrity": "sha512-04k/7247kZzFraweuEirmvUj+W3bJLI9fX6fbo1Qm2YykuBvEhRTPl8tcxlYO8kZZW+HIXfkZNoasVb8EV4jpA==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.35.0.tgz", + "integrity": "sha512-ceNNttjfmSEoM9PW87bWLDEIaLAyR+E6BoYJQ5PfaDau37UGca9Nyq3lBk8Bw2ad0AKvYabz6wxc7DMTO2jnNA==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "8.35.0", + "@typescript-eslint/utils": "8.35.0", + "debug": "^4.3.4", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.35.0.tgz", + "integrity": "sha512-0mYH3emanku0vHw2aRLNGqe7EXh9WHEhi7kZzscrMDf6IIRUQ5Jk4wp1QrledE/36KtdZrVfKnE32eZCf/vaVQ==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.35.0.tgz", + "integrity": "sha512-F+BhnaBemgu1Qf8oHrxyw14wq6vbL8xwWKKMwTMwYIRmFFY/1n/9T/jpbobZL8vp7QyEUcC6xGrnAO4ua8Kp7w==", + "dev": true, + "dependencies": { + "@typescript-eslint/project-service": "8.35.0", + "@typescript-eslint/tsconfig-utils": "8.35.0", + "@typescript-eslint/types": "8.35.0", + "@typescript-eslint/visitor-keys": "8.35.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.35.0.tgz", + "integrity": "sha512-nqoMu7WWM7ki5tPgLVsmPM8CkqtoPUG6xXGeefM5t4x3XumOEKMoUZPdi+7F+/EotukN4R9OWdmDxN80fqoZeg==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.35.0", + "@typescript-eslint/types": "8.35.0", + "@typescript-eslint/typescript-estree": "8.35.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.35.0.tgz", + "integrity": "sha512-zTh2+1Y8ZpmeQaQVIc/ZZxsx8UzgKJyNg1PTvjzC7WMhPSVS8bfDX34k1SrwOf016qd5RU3az2UxUNue3IfQ5g==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.35.0", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@unrs/resolver-binding-android-arm-eabi": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-android-arm-eabi/-/resolver-binding-android-arm-eabi-1.9.1.tgz", + "integrity": "sha512-dd7yIp1hfJFX9ZlVLQRrh/Re9WMUHHmF9hrKD1yIvxcyNr2BhQ3xc1upAVhy8NijadnCswAxWQu8MkkSMC1qXQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@unrs/resolver-binding-android-arm64": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-android-arm64/-/resolver-binding-android-arm64-1.9.1.tgz", + "integrity": "sha512-EzUPcMFtDVlo5yrbzMqUsGq3HnLXw+3ZOhSd7CUaDmbTtnrzM+RO2ntw2dm2wjbbc5djWj3yX0wzbbg8pLhx8g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@unrs/resolver-binding-darwin-arm64": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-arm64/-/resolver-binding-darwin-arm64-1.9.1.tgz", + "integrity": "sha512-nB+dna3q4kOleKFcSZJ/wDXIsAd1kpMO9XrVAt8tG3RDWJ6vi+Ic6bpz4cmg5tWNeCfHEY4KuqJCB+pKejPEmQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@unrs/resolver-binding-darwin-x64": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.9.1.tgz", + "integrity": "sha512-aKWHCrOGaCGwZcekf3TnczQoBxk5w//W3RZ4EQyhux6rKDwBPgDU9Y2yGigCV1Z+8DWqZgVGQi+hdpnlSy3a1w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@unrs/resolver-binding-freebsd-x64": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.9.1.tgz", + "integrity": "sha512-4dIEMXrXt0UqDVgrsUd1I+NoIzVQWXy/CNhgpfS75rOOMK/4Abn0Mx2M2gWH4Mk9+ds/ASAiCmqoUFynmMY5hA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm-gnueabihf": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.9.1.tgz", + "integrity": "sha512-vtvS13IXPs1eE8DuS/soiosqMBeyh50YLRZ+p7EaIKAPPeevRnA9G/wu/KbVt01ZD5qiGjxS+CGIdVC7I6gTOw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm-musleabihf": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.9.1.tgz", + "integrity": "sha512-BfdnN6aZ7NcX8djW8SR6GOJc+K+sFhWRF4vJueVE0vbUu5N1bLnBpxJg1TGlhSyo+ImC4SR0jcNiKN0jdoxt+A==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm64-gnu": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.9.1.tgz", + "integrity": "sha512-Jhge7lFtH0QqfRz2PyJjJXWENqywPteITd+nOS0L6AhbZli+UmEyGBd2Sstt1c+l9C+j/YvKTl9wJo9PPmsFNg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm64-musl": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.9.1.tgz", + "integrity": "sha512-ofdK/ow+ZSbSU0pRoB7uBaiRHeaAOYQFU5Spp87LdcPL/P1RhbCTMSIYVb61XWzsVEmYKjHFtoIE0wxP6AFvrA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-ppc64-gnu": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.9.1.tgz", + "integrity": "sha512-eC8SXVn8de67HacqU7PoGdHA+9tGbqfEdD05AEFRAB81ejeQtNi5Fx7lPcxpLH79DW0BnMAHau3hi4RVkHfSCw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-gnu": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.9.1.tgz", + "integrity": "sha512-fIkwvAAQ41kfoGWfzeJ33iLGShl0JEDZHrMnwTHMErUcPkaaZRJYjQjsFhMl315NEQ4mmTlC+2nfK/J2IszDOw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-musl": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-musl/-/resolver-binding-linux-riscv64-musl-1.9.1.tgz", + "integrity": "sha512-RAAszxImSOFLk44aLwnSqpcOdce8sBcxASledSzuFAd8Q5ZhhVck472SisspnzHdc7THCvGXiUeZ2hOC7NUoBQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-s390x-gnu": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.9.1.tgz", + "integrity": "sha512-QoP9vkY+THuQdZi05bA6s6XwFd6HIz3qlx82v9bTOgxeqin/3C12Ye7f7EOD00RQ36OtOPWnhEMMm84sv7d1XQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-gnu": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.9.1.tgz", + "integrity": "sha512-/p77cGN/h9zbsfCseAP5gY7tK+7+DdM8fkPfr9d1ye1fsF6bmtGbtZN6e/8j4jCZ9NEIBBkT0GhdgixSelTK9g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-musl": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.9.1.tgz", + "integrity": "sha512-wInTqT3Bu9u50mDStEig1v8uxEL2Ht+K8pir/YhyyrM5ordJtxoqzsL1vR/CQzOJuDunUTrDkMM0apjW/d7/PA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-wasm32-wasi": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.9.1.tgz", + "integrity": "sha512-eNwqO5kUa+1k7yFIircwwiniKWA0UFHo2Cfm8LYgkh9km7uMad+0x7X7oXbQonJXlqfitBTSjhA0un+DsHIrhw==", + "cpu": [ + "wasm32" + ], + "dev": true, + "optional": true, + "dependencies": { + "@napi-rs/wasm-runtime": "^0.2.11" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@unrs/resolver-binding-win32-arm64-msvc": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.9.1.tgz", + "integrity": "sha512-Eaz1xMUnoa2mFqh20mPqSdbYl6crnk8HnIXDu6nsla9zpgZJZO8w3c1gvNN/4Eb0RXRq3K9OG6mu8vw14gIqiA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] }, - "node_modules/@types/unist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", - "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", - "dev": true + "node_modules/@unrs/resolver-binding-win32-ia32-msvc": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.9.1.tgz", + "integrity": "sha512-H/+d+5BGlnEQif0gnwWmYbYv7HJj563PUKJfn8PlmzF8UmF+8KxdvXdwCsoOqh4HHnENnoLrav9NYBrv76x1wQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] }, - "node_modules/@types/webxr": { - "version": "0.5.22", - "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.22.tgz", - "integrity": "sha512-Vr6Stjv5jPRqH690f5I5GLjVk8GSsoQSYJ2FVd/3jJF7KaqfwPi3ehfBS96mlQ2kPCwZaX6U0rG2+NGHBKkA/A==" + "node_modules/@unrs/resolver-binding-win32-x64-msvc": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.9.1.tgz", + "integrity": "sha512-rS86wI4R6cknYM3is3grCb/laE8XBEbpWAMSIPjYfmYp75KL5dT87jXF2orDa4tQYg5aajP5G8Fgh34dRyR+Rw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] }, "node_modules/@webgpu/types": { "version": "0.1.60", @@ -1858,6 +2454,18 @@ "concat-map": "0.0.1" } }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", @@ -2440,11 +3048,10 @@ } }, "node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", "dev": true, - "license": "MIT", "dependencies": { "ms": "^2.1.3" }, @@ -2873,6 +3480,30 @@ } } }, + "node_modules/eslint-import-context": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eslint-import-context/-/eslint-import-context-0.1.8.tgz", + "integrity": "sha512-bq+F7nyc65sKpZGT09dY0S0QrOnQtuDVIfyTGQ8uuvtMIF7oHp6CEP3mouN0rrnYF3Jqo6Ke0BfU/5wASZue1w==", + "dev": true, + "dependencies": { + "get-tsconfig": "^4.10.1", + "stable-hash-x": "^0.1.1" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-import-context" + }, + "peerDependencies": { + "unrs-resolver": "^1.0.0" + }, + "peerDependenciesMeta": { + "unrs-resolver": { + "optional": true + } + } + }, "node_modules/eslint-import-resolver-node": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", @@ -2895,6 +3526,40 @@ "ms": "^2.1.1" } }, + "node_modules/eslint-import-resolver-typescript": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-4.4.3.tgz", + "integrity": "sha512-elVDn1eWKFrWlzxlWl9xMt8LltjKl161Ix50JFC50tHXI5/TRP32SNEqlJ/bo/HV+g7Rou/tlPQU2AcRtIhrOg==", + "dev": true, + "dependencies": { + "debug": "^4.4.1", + "eslint-import-context": "^0.1.8", + "get-tsconfig": "^4.10.1", + "is-bun-module": "^2.0.0", + "stable-hash-x": "^0.1.1", + "tinyglobby": "^0.2.14", + "unrs-resolver": "^1.7.11" + }, + "engines": { + "node": "^16.17.0 || >=18.6.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-import-resolver-typescript" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*", + "eslint-plugin-import-x": "*" + }, + "peerDependenciesMeta": { + "eslint-plugin-import": { + "optional": true + }, + "eslint-plugin-import-x": { + "optional": true + } + } + }, "node_modules/eslint-module-utils": { "version": "2.12.0", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.0.tgz", @@ -3067,9 +3732,9 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3196,6 +3861,34 @@ "dev": true, "license": "MIT" }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -3209,6 +3902,29 @@ "dev": true, "license": "MIT" }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fdir": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", + "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "dev": true, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, "node_modules/fflate": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", @@ -3229,6 +3945,18 @@ "node": ">=16.0.0" } }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -3453,6 +4181,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-tsconfig": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.1.tgz", + "integrity": "sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==", + "dev": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/github-from-package": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", @@ -3562,6 +4302,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, "node_modules/has-bigints": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", @@ -3893,6 +4639,27 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-bun-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-bun-module/-/is-bun-module-2.0.0.tgz", + "integrity": "sha512-gNCGbnnnnFAUGKeZ9PdbyeGYJqewpmc2aKHUEMO5nQPWU9lOmv7jcmQIv+qHD8fXW6W7qfuCwX4rY9LNRjXrkQ==", + "dev": true, + "dependencies": { + "semver": "^7.7.1" + } + }, + "node_modules/is-bun-module/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -4061,6 +4828,15 @@ "dev": true, "license": "MIT" }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/is-number-object": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", @@ -4686,6 +5462,40 @@ "dev": true, "license": "MIT" }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -4858,6 +5668,21 @@ "license": "MIT", "optional": true }, + "node_modules/napi-postinstall": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/napi-postinstall/-/napi-postinstall-0.2.4.tgz", + "integrity": "sha512-ZEzHJwBhZ8qQSbknHqYcdtQVr8zUgGyM/q6h6qAyhtyVMNrSgDhrC4disf03dYW0e+czXyLnZINnCTEkWy0eJg==", + "dev": true, + "bin": { + "napi-postinstall": "lib/cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/napi-postinstall" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -5474,6 +6299,26 @@ "node": ">=6" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -5693,6 +6538,25 @@ "node": ">=4" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rollup": { "version": "4.40.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.40.1.tgz", @@ -5827,6 +6691,29 @@ "dev": true, "license": "MIT" }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/sade": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", @@ -6351,6 +7238,15 @@ "integrity": "sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg==", "dev": true }, + "node_modules/stable-hash-x": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/stable-hash-x/-/stable-hash-x-0.1.1.tgz", + "integrity": "sha512-l0x1D6vhnsNUGPFVDx45eif0y6eedVC8nm5uACTrVFJFtl2mLRW17aWtVyxFCpn5t94VUPkjU8vSLwIuwwqtJQ==", + "dev": true, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -6680,6 +7576,22 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/tinyglobby": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", + "dev": true, + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, "node_modules/tldts": { "version": "6.1.77", "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.77.tgz", @@ -6700,6 +7612,18 @@ "dev": true, "license": "MIT" }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/tough-cookie": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.1.tgz", @@ -6726,6 +7650,18 @@ "node": ">=18" } }, + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "dev": true, + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/ts-node": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", @@ -6798,6 +7734,13 @@ "node": ">=6" } }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "optional": true + }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -7037,6 +7980,40 @@ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", "dev": true }, + "node_modules/unrs-resolver": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/unrs-resolver/-/unrs-resolver-1.9.1.tgz", + "integrity": "sha512-4AZVxP05JGN6DwqIkSP4VKLOcwQa5l37SWHF/ahcuqBMbfxbpN1L1QKafEhWCziHhzKex9H/AR09H0OuVyU+9g==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "napi-postinstall": "^0.2.2" + }, + "funding": { + "url": "https://opencollective.com/unrs-resolver" + }, + "optionalDependencies": { + "@unrs/resolver-binding-android-arm-eabi": "1.9.1", + "@unrs/resolver-binding-android-arm64": "1.9.1", + "@unrs/resolver-binding-darwin-arm64": "1.9.1", + "@unrs/resolver-binding-darwin-x64": "1.9.1", + "@unrs/resolver-binding-freebsd-x64": "1.9.1", + "@unrs/resolver-binding-linux-arm-gnueabihf": "1.9.1", + "@unrs/resolver-binding-linux-arm-musleabihf": "1.9.1", + "@unrs/resolver-binding-linux-arm64-gnu": "1.9.1", + "@unrs/resolver-binding-linux-arm64-musl": "1.9.1", + "@unrs/resolver-binding-linux-ppc64-gnu": "1.9.1", + "@unrs/resolver-binding-linux-riscv64-gnu": "1.9.1", + "@unrs/resolver-binding-linux-riscv64-musl": "1.9.1", + "@unrs/resolver-binding-linux-s390x-gnu": "1.9.1", + "@unrs/resolver-binding-linux-x64-gnu": "1.9.1", + "@unrs/resolver-binding-linux-x64-musl": "1.9.1", + "@unrs/resolver-binding-wasm32-wasi": "1.9.1", + "@unrs/resolver-binding-win32-arm64-msvc": "1.9.1", + "@unrs/resolver-binding-win32-ia32-msvc": "1.9.1", + "@unrs/resolver-binding-win32-x64-msvc": "1.9.1" + } + }, "node_modules/update-check": { "version": "1.5.4", "resolved": "https://registry.npmjs.org/update-check/-/update-check-1.5.4.tgz", diff --git a/package.json b/package.json index 30421149a58..86a5db64188 100644 --- a/package.json +++ b/package.json @@ -77,9 +77,12 @@ "@swc/core": "1.11.21", "@types/mocha": "^10.0.10", "@types/node": "22.15.3", + "@typescript-eslint/eslint-plugin": "^8.35.0", + "@typescript-eslint/parser": "^8.35.0", "c8": "10.1.3", "chai": "5.2.0", "eslint": "9.25.1", + "eslint-import-resolver-typescript": "^4.4.3", "fflate": "0.8.2", "globals": "16.0.0", "jsdom": "26.1.0", diff --git a/src/core/math/color.ts b/src/core/math/color.ts index e532bef8da2..b9729db4608 100644 --- a/src/core/math/color.ts +++ b/src/core/math/color.ts @@ -350,4 +350,4 @@ class Color { static readonly YELLOW = Object.freeze(new Color(1, 1, 0, 1)); } -export { Color }; \ No newline at end of file +export { Color }; diff --git a/src/extras/exporters/core-exporter.js b/src/extras/exporters/core-exporter.js index 06fd3ec759a..6385d2f1567 100644 --- a/src/extras/exporters/core-exporter.js +++ b/src/extras/exporters/core-exporter.js @@ -9,7 +9,7 @@ import { } from '../../platform/graphics/constants.js'; /** - * @import { Color } from '../../core/math/color' + * @import { Color } from '../../core/math/color.js' */ /** diff --git a/src/extras/exporters/gltf-exporter.js b/src/extras/exporters/gltf-exporter.js index 2bb232c71ee..b347d281e4c 100644 --- a/src/extras/exporters/gltf-exporter.js +++ b/src/extras/exporters/gltf-exporter.js @@ -3,7 +3,7 @@ import { math } from '../../core/math/math.js'; import { Vec2 } from '../../core/math/vec2.js'; import { Vec3 } from '../../core/math/vec3.js'; import { Quat } from '../../core/math/quat.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { BoundingBox } from '../../core/shape/bounding-box.js'; import { CULLFACE_NONE, diff --git a/src/extras/exporters/usdz-exporter.js b/src/extras/exporters/usdz-exporter.js index c4b0cb89434..6cc75da123c 100644 --- a/src/extras/exporters/usdz-exporter.js +++ b/src/extras/exporters/usdz-exporter.js @@ -1,6 +1,6 @@ import { CoreExporter } from './core-exporter.js'; import { zipSync, strToU8 } from 'fflate'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { SEMANTIC_POSITION, diff --git a/src/extras/gizmo/color.js b/src/extras/gizmo/color.js index 8dcee1d19b5..64d44342483 100644 --- a/src/extras/gizmo/color.js +++ b/src/extras/gizmo/color.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; export const COLOR_RED = Object.freeze(new Color(1, 0.3, 0.3)); export const COLOR_GREEN = Object.freeze(new Color(0.3, 1, 0.3)); diff --git a/src/extras/gizmo/rotate-gizmo.js b/src/extras/gizmo/rotate-gizmo.js index 88461f18e28..e268bf83ae9 100644 --- a/src/extras/gizmo/rotate-gizmo.js +++ b/src/extras/gizmo/rotate-gizmo.js @@ -1,5 +1,5 @@ import { math } from '../../core/math/math.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Quat } from '../../core/math/quat.js'; import { Mat4 } from '../../core/math/mat4.js'; import { Vec3 } from '../../core/math/vec3.js'; diff --git a/src/extras/gizmo/shape/shape.js b/src/extras/gizmo/shape/shape.js index 08f00110f6a..8fb5e82d286 100644 --- a/src/extras/gizmo/shape/shape.js +++ b/src/extras/gizmo/shape/shape.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { Vec3 } from '../../../core/math/vec3.js'; import { ShaderMaterial } from '../../../scene/materials/shader-material.js'; import { MeshInstance } from '../../../scene/mesh-instance.js'; @@ -6,7 +6,7 @@ import { Entity } from '../../../framework/entity.js'; import { CULLFACE_BACK, SEMANTIC_POSITION, SEMANTIC_COLOR } from '../../../platform/graphics/constants.js'; import { BLEND_NORMAL } from '../../../scene/constants.js'; -import { COLOR_GRAY } from '../color'; +import { COLOR_GRAY } from '../color.js'; import { Mesh } from '../../../scene/mesh.js'; import { Geometry } from '../../../scene/geometry/geometry.js'; import { BoxGeometry } from '../../../scene/geometry/box-geometry.js'; diff --git a/src/extras/gizmo/transform-gizmo.js b/src/extras/gizmo/transform-gizmo.js index 5ec6e69121f..d6757b95753 100644 --- a/src/extras/gizmo/transform-gizmo.js +++ b/src/extras/gizmo/transform-gizmo.js @@ -1,5 +1,5 @@ import { math } from '../../core/math/math.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Quat } from '../../core/math/quat.js'; import { Vec3 } from '../../core/math/vec3.js'; import { Ray } from '../../core/shape/ray.js'; @@ -14,7 +14,7 @@ import { COLOR_GRAY, color3from4, color4from3 -} from './color'; +} from './color.js'; import { GIZMOAXIS_FACE, GIZMOAXIS_X, GIZMOAXIS_XYZ, GIZMOAXIS_Y, GIZMOAXIS_Z } from './constants.js'; import { Gizmo } from './gizmo.js'; diff --git a/src/extras/gizmo/view-cube.js b/src/extras/gizmo/view-cube.js index f61ae8b7d6a..cdc229ead08 100644 --- a/src/extras/gizmo/view-cube.js +++ b/src/extras/gizmo/view-cube.js @@ -1,9 +1,9 @@ import { EventHandler } from '../../core/event-handler.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Mat4 } from '../../core/math/mat4.js'; import { Vec3 } from '../../core/math/vec3.js'; import { Vec4 } from '../../core/math/vec4.js'; -import { COLOR_BLUE, COLOR_GREEN, COLOR_RED } from './color'; +import { COLOR_BLUE, COLOR_GREEN, COLOR_RED } from './color.js'; const tmpV1 = new Vec3(); const tmpV2 = new Vec3(); diff --git a/src/extras/render-passes/camera-frame.js b/src/extras/render-passes/camera-frame.js index 14b4373e4a5..c0a0b56f986 100644 --- a/src/extras/render-passes/camera-frame.js +++ b/src/extras/render-passes/camera-frame.js @@ -1,5 +1,5 @@ import { Debug } from '../../core/debug.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { math } from '../../core/math/math.js'; import { PIXELFORMAT_111110F, PIXELFORMAT_RGBA16F, PIXELFORMAT_RGBA32F } from '../../platform/graphics/constants.js'; import { SSAOTYPE_NONE } from './constants.js'; diff --git a/src/extras/render-passes/render-pass-bloom.js b/src/extras/render-passes/render-pass-bloom.js index 3b4d679556b..2d382110b69 100644 --- a/src/extras/render-passes/render-pass-bloom.js +++ b/src/extras/render-passes/render-pass-bloom.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Texture } from '../../platform/graphics/texture.js'; import { BlendState } from '../../platform/graphics/blend-state.js'; import { RenderTarget } from '../../platform/graphics/render-target.js'; diff --git a/src/extras/render-passes/render-pass-camera-frame.js b/src/extras/render-passes/render-pass-camera-frame.js index 123c8dbb702..c98a8468d84 100644 --- a/src/extras/render-passes/render-pass-camera-frame.js +++ b/src/extras/render-passes/render-pass-camera-frame.js @@ -15,7 +15,7 @@ import { RenderPassSsao } from './render-pass-ssao.js'; import { SSAOTYPE_COMBINE, SSAOTYPE_LIGHTING, SSAOTYPE_NONE } from './constants.js'; import { Debug } from '../../core/debug.js'; import { RenderPassDownsample } from './render-pass-downsample.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; /** * Options used to configure the RenderPassCameraFrame. To modify these options, you must create diff --git a/src/extras/render-passes/render-pass-compose.js b/src/extras/render-passes/render-pass-compose.js index 5715df3de94..4d94593e567 100644 --- a/src/extras/render-passes/render-pass-compose.js +++ b/src/extras/render-passes/render-pass-compose.js @@ -1,5 +1,5 @@ import { math } from '../../core/math/math.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { RenderPassShaderQuad } from '../../scene/graphics/render-pass-shader-quad.js'; import { GAMMA_NONE, GAMMA_SRGB, gammaNames, TONEMAP_LINEAR, tonemapNames } from '../../scene/constants.js'; import { ShaderChunks } from '../../scene/shader-lib/shader-chunks.js'; diff --git a/src/extras/render-passes/render-pass-dof.js b/src/extras/render-passes/render-pass-dof.js index 6b469147d25..f6204307f86 100644 --- a/src/extras/render-passes/render-pass-dof.js +++ b/src/extras/render-passes/render-pass-dof.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Texture } from '../../platform/graphics/texture.js'; import { RenderTarget } from '../../platform/graphics/render-target.js'; import { RenderPass } from '../../platform/graphics/render-pass.js'; diff --git a/src/extras/render-passes/render-pass-prepass.js b/src/extras/render-passes/render-pass-prepass.js index 8c4a7adcb0c..f4878273064 100644 --- a/src/extras/render-passes/render-pass-prepass.js +++ b/src/extras/render-passes/render-pass-prepass.js @@ -12,7 +12,7 @@ import { LAYERID_DEPTH, SHADER_PREPASS } from '../../scene/constants.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { FloatPacking } from '../../core/math/float-packing.js'; /** diff --git a/src/extras/render-passes/render-pass-ssao.js b/src/extras/render-passes/render-pass-ssao.js index 18ae6c985e4..0c3189a3b50 100644 --- a/src/extras/render-passes/render-pass-ssao.js +++ b/src/extras/render-passes/render-pass-ssao.js @@ -1,5 +1,5 @@ import { BlueNoise } from '../../core/math/blue-noise.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { ADDRESS_CLAMP_TO_EDGE, FILTER_NEAREST, PIXELFORMAT_R8, SEMANTIC_POSITION, SHADERLANGUAGE_GLSL, SHADERLANGUAGE_WGSL diff --git a/src/extras/renderers/outline-renderer.js b/src/extras/renderers/outline-renderer.js index 9358e72d613..ea297fd3f48 100644 --- a/src/extras/renderers/outline-renderer.js +++ b/src/extras/renderers/outline-renderer.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Entity } from '../../framework/entity.js'; import { BlendState } from '../../platform/graphics/blend-state.js'; import { diff --git a/src/framework/app-base.js b/src/framework/app-base.js index 27f00cc4d07..ae50e71d74f 100644 --- a/src/framework/app-base.js +++ b/src/framework/app-base.js @@ -7,7 +7,7 @@ import { path } from '../core/path.js'; import { TRACEID_RENDER_FRAME, TRACEID_RENDER_FRAME_TIME } from '../core/constants.js'; import { Debug } from '../core/debug.js'; import { EventHandler } from '../core/event-handler.js'; -import { Color } from '../core/math/color'; +import { Color } from '../core/math/color.js'; import { Mat4 } from '../core/math/mat4.js'; import { math } from '../core/math/math.js'; import { Quat } from '../core/math/quat.js'; diff --git a/src/framework/components/anim/component-binder.js b/src/framework/components/anim/component-binder.js index 4e1fe509fea..e8ea67830f0 100644 --- a/src/framework/components/anim/component-binder.js +++ b/src/framework/components/anim/component-binder.js @@ -2,7 +2,7 @@ import { AnimTarget } from '../../anim/evaluator/anim-target.js'; import { DefaultAnimBinder } from '../../anim/binder/default-anim-binder.js'; import { AnimBinder } from '../../anim/binder/anim-binder.js'; -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { Quat } from '../../../core/math/quat.js'; import { Vec2 } from '../../../core/math/vec2.js'; import { Vec3 } from '../../../core/math/vec3.js'; diff --git a/src/framework/components/button/component.js b/src/framework/components/button/component.js index 3f57a5d430c..84de9f1b5a5 100644 --- a/src/framework/components/button/component.js +++ b/src/framework/components/button/component.js @@ -1,6 +1,6 @@ import { now } from '../../../core/time.js'; import { math } from '../../../core/math/math.js'; -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { GraphNode } from '../../../scene/graph-node.js'; diff --git a/src/framework/components/button/data.js b/src/framework/components/button/data.js index 633c6721287..300ee807aa8 100644 --- a/src/framework/components/button/data.js +++ b/src/framework/components/button/data.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { Vec4 } from '../../../core/math/vec4.js'; import { BUTTON_TRANSITION_MODE_TINT } from './constants.js'; diff --git a/src/framework/components/camera/component.js b/src/framework/components/camera/component.js index c58aeeb7f5d..98d0b31efc1 100644 --- a/src/framework/components/camera/component.js +++ b/src/framework/components/camera/component.js @@ -7,7 +7,7 @@ import { PostEffectQueue } from './post-effect-queue.js'; /** * @import { CameraComponentSystem } from './system.js' - * @import { Color } from '../../../core/math/color' + * @import { Color } from '../../../core/math/color.js' * @import { Entity } from '../../entity.js' * @import { EventHandle } from '../../../core/event-handle.js' * @import { Frustum } from '../../../core/shape/frustum.js' diff --git a/src/framework/components/camera/system.js b/src/framework/components/camera/system.js index 9eee4e1764d..52b2312f0c5 100644 --- a/src/framework/components/camera/system.js +++ b/src/framework/components/camera/system.js @@ -1,5 +1,5 @@ import { sortPriority } from '../../../core/sort.js'; -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { Vec4 } from '../../../core/math/vec4.js'; import { Component } from '../component.js'; import { ComponentSystem } from '../system.js'; diff --git a/src/framework/components/element/component.js b/src/framework/components/element/component.js index a606bf80753..0f737b24bc9 100644 --- a/src/framework/components/element/component.js +++ b/src/framework/components/element/component.js @@ -17,7 +17,7 @@ import { TextElement } from './text-element.js'; /** * @import { BoundingBox } from '../../../core/shape/bounding-box.js' * @import { CanvasFont } from '../../../framework/font/canvas-font.js' - * @import { Color } from '../../../core/math/color' + * @import { Color } from '../../../core/math/color.js' * @import { ElementComponentData } from './data.js' * @import { ElementComponentSystem } from './system.js' * @import { EventHandle } from '../../../core/event-handle.js' diff --git a/src/framework/components/element/image-element.js b/src/framework/components/element/image-element.js index 7817e9feea9..fa071663a85 100644 --- a/src/framework/components/element/image-element.js +++ b/src/framework/components/element/image-element.js @@ -1,7 +1,7 @@ import { Debug } from '../../../core/debug.js'; import { TRACEID_ELEMENT } from '../../../core/constants.js'; import { math } from '../../../core/math/math.js'; -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { Vec2 } from '../../../core/math/vec2.js'; import { Vec3 } from '../../../core/math/vec3.js'; import { Vec4 } from '../../../core/math/vec4.js'; diff --git a/src/framework/components/element/system.js b/src/framework/components/element/system.js index 07416296cbf..39e3958502f 100644 --- a/src/framework/components/element/system.js +++ b/src/framework/components/element/system.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { Vec2 } from '../../../core/math/vec2.js'; import { Vec4 } from '../../../core/math/vec4.js'; import { PIXELFORMAT_SRGBA8 } from '../../../platform/graphics/constants.js'; diff --git a/src/framework/components/element/text-element.js b/src/framework/components/element/text-element.js index eb06d3ad81c..da9c5a11cab 100644 --- a/src/framework/components/element/text-element.js +++ b/src/framework/components/element/text-element.js @@ -1,7 +1,7 @@ import { Debug } from '../../../core/debug.js'; import { string } from '../../../core/string.js'; import { math } from '../../../core/math/math.js'; -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { Vec2 } from '../../../core/math/vec2.js'; import { BoundingBox } from '../../../core/shape/bounding-box.js'; import { SEMANTIC_POSITION, SEMANTIC_TEXCOORD0, SEMANTIC_COLOR, SEMANTIC_ATTR8, SEMANTIC_ATTR9, TYPE_FLOAT32 } from '../../../platform/graphics/constants.js'; diff --git a/src/framework/components/light/component.js b/src/framework/components/light/component.js index e574a954d7e..f5bb1d752be 100644 --- a/src/framework/components/light/component.js +++ b/src/framework/components/light/component.js @@ -6,7 +6,7 @@ import { Component } from '../component.js'; import { properties } from './data.js'; /** - * @import { Color } from '../../../core/math/color' + * @import { Color } from '../../../core/math/color.js' * @import { EventHandle } from '../../../core/event-handle.js' * @import { LightComponentData } from './data.js' * @import { Light } from '../../../scene/light.js' diff --git a/src/framework/components/light/data.js b/src/framework/components/light/data.js index 87bbfd9981e..1bb259013df 100644 --- a/src/framework/components/light/data.js +++ b/src/framework/components/light/data.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { BLUR_GAUSSIAN, LAYERID_WORLD, diff --git a/src/framework/components/light/system.js b/src/framework/components/light/system.js index 46b9bb7a244..baa86c1550e 100644 --- a/src/framework/components/light/system.js +++ b/src/framework/components/light/system.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { Vec2 } from '../../../core/math/vec2.js'; import { LIGHTSHAPE_PUNCTUAL } from '../../../scene/constants.js'; import { Light, lightTypes } from '../../../scene/light.js'; diff --git a/src/framework/components/sprite/component.js b/src/framework/components/sprite/component.js index 6f73585267b..ab3ba7fcc87 100644 --- a/src/framework/components/sprite/component.js +++ b/src/framework/components/sprite/component.js @@ -1,6 +1,6 @@ import { Debug } from '../../../core/debug.js'; import { math } from '../../../core/math/math.js'; -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { Vec2 } from '../../../core/math/vec2.js'; import { Vec4 } from '../../../core/math/vec4.js'; import { diff --git a/src/framework/components/sprite/system.js b/src/framework/components/sprite/system.js index d90c8772a11..df3426607c3 100644 --- a/src/framework/components/sprite/system.js +++ b/src/framework/components/sprite/system.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { CULLFACE_NONE, PIXELFORMAT_SRGBA8 diff --git a/src/framework/components/system.js b/src/framework/components/system.js index ed273a4bfea..7ecfb4d4977 100644 --- a/src/framework/components/system.js +++ b/src/framework/components/system.js @@ -1,5 +1,5 @@ import { EventHandler } from '../../core/event-handler.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Vec2 } from '../../core/math/vec2.js'; import { Vec3 } from '../../core/math/vec3.js'; import { Vec4 } from '../../core/math/vec4.js'; diff --git a/src/framework/font/canvas-font.js b/src/framework/font/canvas-font.js index 7fd13147707..4bc6be6139b 100644 --- a/src/framework/font/canvas-font.js +++ b/src/framework/font/canvas-font.js @@ -1,6 +1,6 @@ import { string } from '../../core/string.js'; import { EventHandler } from '../../core/event-handler.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { ADDRESS_CLAMP_TO_EDGE, FILTER_LINEAR, FILTER_LINEAR_MIPMAP_LINEAR, diff --git a/src/framework/graphics/picker.js b/src/framework/graphics/picker.js index cd873bd59b5..0b674d63fab 100644 --- a/src/framework/graphics/picker.js +++ b/src/framework/graphics/picker.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { ADDRESS_CLAMP_TO_EDGE, FILTER_NEAREST, PIXELFORMAT_RGBA8 } from '../../platform/graphics/constants.js'; import { RenderTarget } from '../../platform/graphics/render-target.js'; import { Texture } from '../../platform/graphics/texture.js'; diff --git a/src/framework/lightmapper/bake-light-ambient.js b/src/framework/lightmapper/bake-light-ambient.js index 8a910d6a684..b2795881890 100644 --- a/src/framework/lightmapper/bake-light-ambient.js +++ b/src/framework/lightmapper/bake-light-ambient.js @@ -1,6 +1,6 @@ import { Vec3 } from '../../core/math/vec3.js'; import { random } from '../../core/math/random.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Entity } from '../entity.js'; import { SHADOW_PCF3_32F } from '../../scene/constants.js'; import { BakeLight } from './bake-light.js'; diff --git a/src/framework/lightmapper/lightmapper.js b/src/framework/lightmapper/lightmapper.js index ef26644f987..4c5496b5d0d 100644 --- a/src/framework/lightmapper/lightmapper.js +++ b/src/framework/lightmapper/lightmapper.js @@ -1,6 +1,6 @@ import { Debug } from '../../core/debug.js'; import { now } from '../../core/time.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { math } from '../../core/math/math.js'; import { Vec3 } from '../../core/math/vec3.js'; import { BoundingBox } from '../../core/shape/bounding-box.js'; diff --git a/src/framework/parsers/glb-parser.js b/src/framework/parsers/glb-parser.js index 8c865690526..1c725948e22 100644 --- a/src/framework/parsers/glb-parser.js +++ b/src/framework/parsers/glb-parser.js @@ -1,6 +1,6 @@ import { Debug } from '../../core/debug.js'; import { path } from '../../core/path.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Mat4 } from '../../core/math/mat4.js'; import { math } from '../../core/math/math.js'; import { Vec2 } from '../../core/math/vec2.js'; diff --git a/src/framework/parsers/material/json-standard-material.js b/src/framework/parsers/material/json-standard-material.js index d5a1b0b2384..40331715b2c 100644 --- a/src/framework/parsers/material/json-standard-material.js +++ b/src/framework/parsers/material/json-standard-material.js @@ -1,4 +1,4 @@ -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { Vec2 } from '../../../core/math/vec2.js'; import { Vec3 } from '../../../core/math/vec3.js'; diff --git a/src/framework/script/script-attributes.js b/src/framework/script/script-attributes.js index 6dc0aa91fff..a84bdd41209 100644 --- a/src/framework/script/script-attributes.js +++ b/src/framework/script/script-attributes.js @@ -1,5 +1,5 @@ import { Debug } from '../../core/debug.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Curve } from '../../core/math/curve.js'; import { CurveSet } from '../../core/math/curve-set.js'; import { Vec2 } from '../../core/math/vec2.js'; diff --git a/src/framework/xr/xr-light-estimation.js b/src/framework/xr/xr-light-estimation.js index a2630203f0b..258eab8a48c 100644 --- a/src/framework/xr/xr-light-estimation.js +++ b/src/framework/xr/xr-light-estimation.js @@ -1,5 +1,5 @@ import { EventHandler } from '../../core/event-handler.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Mat4 } from '../../core/math/mat4.js'; import { Quat } from '../../core/math/quat.js'; import { Vec3 } from '../../core/math/vec3.js'; diff --git a/src/index.js b/src/index.js index eb223ebf6a4..94e07da1eb4 100644 --- a/src/index.js +++ b/src/index.js @@ -81,7 +81,7 @@ export { Tracing } from './core/tracing.js'; // CORE / MATH export * from './core/math/constants.js'; export { math } from './core/math/math.js'; -export { Color } from './core/math/color'; +export { Color } from './core/math/color.js'; export { Curve } from './core/math/curve.js'; export { CurveSet } from './core/math/curve-set.js'; export { FloatPacking } from './core/math/float-packing.js'; diff --git a/src/platform/graphics/graphics-device.js b/src/platform/graphics/graphics-device.js index 31e95efe5ca..5c620403d4b 100644 --- a/src/platform/graphics/graphics-device.js +++ b/src/platform/graphics/graphics-device.js @@ -5,7 +5,7 @@ import { platform } from '../../core/platform.js'; import { now } from '../../core/time.js'; import { Vec2 } from '../../core/math/vec2.js'; import { Tracing } from '../../core/tracing.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { TRACEID_TEXTURES } from '../../core/constants.js'; import { CULLFACE_BACK, diff --git a/src/platform/graphics/render-pass.js b/src/platform/graphics/render-pass.js index d7d83e9d0a9..1cbda67fca8 100644 --- a/src/platform/graphics/render-pass.js +++ b/src/platform/graphics/render-pass.js @@ -1,6 +1,6 @@ import { Debug } from '../../core/debug.js'; import { Tracing } from '../../core/tracing.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { TRACEID_RENDER_PASS, TRACEID_RENDER_PASS_DETAIL } from '../../core/constants.js'; import { isIntegerPixelFormat, pixelFormatInfo } from './constants.js'; diff --git a/src/platform/graphics/webgl/webgl-graphics-device.js b/src/platform/graphics/webgl/webgl-graphics-device.js index 16f07e353e1..b39b1db586c 100644 --- a/src/platform/graphics/webgl/webgl-graphics-device.js +++ b/src/platform/graphics/webgl/webgl-graphics-device.js @@ -1,7 +1,7 @@ import { math } from '../../../core/math/math.js'; import { Debug } from '../../../core/debug.js'; import { platform } from '../../../core/platform.js'; -import { Color } from '../../../core/math/color'; +import { Color } from '../../../core/math/color.js'; import { CLEARFLAG_COLOR, CLEARFLAG_DEPTH, CLEARFLAG_STENCIL, CULLFACE_NONE, diff --git a/src/scene/camera.js b/src/scene/camera.js index 60d0c9be418..f03a8fe6240 100644 --- a/src/scene/camera.js +++ b/src/scene/camera.js @@ -1,4 +1,4 @@ -import { Color } from '../core/math/color'; +import { Color } from '../core/math/color.js'; import { Mat4 } from '../core/math/mat4.js'; import { Vec3 } from '../core/math/vec3.js'; import { Vec4 } from '../core/math/vec4.js'; diff --git a/src/scene/fog-params.js b/src/scene/fog-params.js index a3ad015d127..5867c2dd589 100644 --- a/src/scene/fog-params.js +++ b/src/scene/fog-params.js @@ -1,4 +1,4 @@ -import { Color } from '../core/math/color'; +import { Color } from '../core/math/color.js'; import { FOG_NONE } from './constants.js'; /** diff --git a/src/scene/gsplat/gsplat-data.js b/src/scene/gsplat/gsplat-data.js index 04b1cadd5cc..e77497edb5f 100644 --- a/src/scene/gsplat/gsplat-data.js +++ b/src/scene/gsplat/gsplat-data.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Mat4 } from '../../core/math/mat4.js'; import { Quat } from '../../core/math/quat.js'; import { Vec3 } from '../../core/math/vec3.js'; diff --git a/src/scene/light.js b/src/scene/light.js index bf00dd8f4ca..71aa36e5249 100644 --- a/src/scene/light.js +++ b/src/scene/light.js @@ -1,5 +1,5 @@ import { math } from '../core/math/math.js'; -import { Color } from '../core/math/color'; +import { Color } from '../core/math/color.js'; import { Mat4 } from '../core/math/mat4.js'; import { Vec2 } from '../core/math/vec2.js'; import { Vec3 } from '../core/math/vec3.js'; diff --git a/src/scene/lighting/world-clusters-debug.js b/src/scene/lighting/world-clusters-debug.js index 9cc41c30a18..1fed326ac11 100644 --- a/src/scene/lighting/world-clusters-debug.js +++ b/src/scene/lighting/world-clusters-debug.js @@ -1,4 +1,4 @@ -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Mat4 } from '../../core/math/mat4.js'; import { Vec3 } from '../../core/math/vec3.js'; diff --git a/src/scene/materials/standard-material.js b/src/scene/materials/standard-material.js index 5decf169bc6..d563a3415d9 100644 --- a/src/scene/materials/standard-material.js +++ b/src/scene/materials/standard-material.js @@ -1,5 +1,5 @@ import { Debug } from '../../core/debug.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { math } from '../../core/math/math.js'; import { Vec2 } from '../../core/math/vec2.js'; import { ShaderProcessorOptions } from '../../platform/graphics/shader-processor-options.js'; diff --git a/src/scene/renderer/forward-renderer.js b/src/scene/renderer/forward-renderer.js index 9ce7b0ec5c9..196067730be 100644 --- a/src/scene/renderer/forward-renderer.js +++ b/src/scene/renderer/forward-renderer.js @@ -1,7 +1,7 @@ import { now } from '../../core/time.js'; import { Debug } from '../../core/debug.js'; import { Vec3 } from '../../core/math/vec3.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { DebugGraphics } from '../../platform/graphics/debug-graphics.js'; import { FOG_NONE, FOG_LINEAR, diff --git a/src/scene/renderer/shadow-renderer.js b/src/scene/renderer/shadow-renderer.js index f3b4d053e70..0c3ff02207b 100644 --- a/src/scene/renderer/shadow-renderer.js +++ b/src/scene/renderer/shadow-renderer.js @@ -1,6 +1,6 @@ import { Debug } from '../../core/debug.js'; import { now } from '../../core/time.js'; -import { Color } from '../../core/math/color'; +import { Color } from '../../core/math/color.js'; import { Mat4 } from '../../core/math/mat4.js'; import { Vec3 } from '../../core/math/vec3.js'; import { Vec4 } from '../../core/math/vec4.js'; diff --git a/src/scene/scene.js b/src/scene/scene.js index b8b7b8e7eb1..03ecd178c74 100644 --- a/src/scene/scene.js +++ b/src/scene/scene.js @@ -1,6 +1,6 @@ import { Debug } from '../core/debug.js'; import { EventHandler } from '../core/event-handler.js'; -import { Color } from '../core/math/color'; +import { Color } from '../core/math/color.js'; import { Vec3 } from '../core/math/vec3.js'; import { Quat } from '../core/math/quat.js'; import { math } from '../core/math/math.js'; diff --git a/utils/rollup-build-target.mjs b/utils/rollup-build-target.mjs index 9d2ae35a679..cd68f12ce9c 100644 --- a/utils/rollup-build-target.mjs +++ b/utils/rollup-build-target.mjs @@ -13,6 +13,7 @@ import { engineLayerImportValidation } from './plugins/rollup-import-validation. import { spacesToTabs } from './plugins/rollup-spaces-to-tabs.mjs'; import { dynamicImportLegacyBrowserSupport, dynamicImportBundlerSuppress } from './plugins/rollup-dynamic.mjs'; import { treeshakeIgnore } from './plugins/rollup-treeshake-ignore.mjs'; +import { resolveTsExtensions } from './plugins/rollup-resolve-ts-extensions.mjs'; import { version, revision } from './rollup-version-revision.mjs'; import { getBanner } from './rollup-get-banner.mjs'; @@ -255,6 +256,7 @@ function buildTarget({ moduleFormat, buildType, bundleState, input = 'src/index. entryFileNames: chunkInfo => `${chunkInfo.name.replace(/node_modules/g, 'modules')}.js` }, plugins: [ + resolveTsExtensions(), resolve({ extensions: ['.js', '.ts', '.json'] }), diff --git a/utils/typedoc/typedoc-plugin.mjs b/utils/typedoc/typedoc-plugin.mjs index 0008568d78b..548c8f7bd9c 100644 --- a/utils/typedoc/typedoc-plugin.mjs +++ b/utils/typedoc/typedoc-plugin.mjs @@ -1,7 +1,6 @@ import { readFileSync } from 'fs'; import { resolve } from 'path'; -/* eslint-disable-next-line import/no-unresolved */ import { ArrayType, Converter, DeclarationReflection, IntrinsicType, ReflectionFlag, ReflectionKind, ReferenceType, UnionType } from 'typedoc'; /** From d505de73f65a1229048d240800382fd3e55bad98 Mon Sep 17 00:00:00 2001 From: Liam Don Date: Mon, 23 Jun 2025 18:30:27 +0000 Subject: [PATCH 6/9] Add custom rollup resolver --- examples/package-lock.json | 8 +++- .../plugins/rollup-resolve-ts-extensions.mjs | 38 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 utils/plugins/rollup-resolve-ts-extensions.mjs diff --git a/examples/package-lock.json b/examples/package-lock.json index a6e14987982..e268a9ef644 100644 --- a/examples/package-lock.json +++ b/examples/package-lock.json @@ -58,14 +58,18 @@ "@rollup/plugin-terser": "0.4.4", "@rollup/pluginutils": "5.1.4", "@swc/core": "1.11.21", + "@types/mocha": "^10.0.10", "@types/node": "22.15.3", + "@typescript-eslint/eslint-plugin": "^8.35.0", + "@typescript-eslint/parser": "^8.35.0", "c8": "10.1.3", "chai": "5.2.0", "eslint": "9.25.1", + "eslint-import-resolver-typescript": "^4.4.3", "fflate": "0.8.2", "globals": "16.0.0", "jsdom": "26.1.0", - "mocha": "11.1.0", + "mocha": "^11.7.0", "publint": "0.3.12", "rollup": "4.40.1", "rollup-plugin-dts": "6.2.1", @@ -73,6 +77,8 @@ "rollup-plugin-visualizer": "5.14.0", "serve": "14.2.4", "sinon": "19.0.5", + "ts-node": "^10.9.2", + "tsconfig-paths": "^4.2.0", "typedoc": "0.28.3", "typedoc-plugin-mdn-links": "5.0.1", "typedoc-plugin-missing-exports": "4.0.0", diff --git a/utils/plugins/rollup-resolve-ts-extensions.mjs b/utils/plugins/rollup-resolve-ts-extensions.mjs new file mode 100644 index 00000000000..bda7b04fa39 --- /dev/null +++ b/utils/plugins/rollup-resolve-ts-extensions.mjs @@ -0,0 +1,38 @@ +import { existsSync } from 'fs'; +import { dirname, resolve } from 'path'; + +/** + * Rollup plugin to resolve .js imports to .ts files + * This allows TypeScript files to be imported with .js extensions + * + * @returns {import('rollup').Plugin} - The Rollup plugin. + */ +export function resolveTsExtensions() { + return { + name: 'resolve-ts-extensions', + resolveId(source, importer) { + // Only handle relative imports that end with .js + if (!source.startsWith('.') || !source.endsWith('.js')) { + return null; + } + + if (!importer) { + return null; + } + + // Resolve the full path + const importerDir = dirname(importer); + const fullPath = resolve(importerDir, source); + + // Try replacing .js with .ts + const tsPath = fullPath.replace(/\.js$/, '.ts'); + + if (existsSync(tsPath)) { + return tsPath; + } + + // Let other plugins handle it + return null; + } + }; +} From 17933903c0ea1fca00657d14aacd7da82e50ed90 Mon Sep 17 00:00:00 2001 From: Liam Don Date: Mon, 23 Jun 2025 18:31:26 +0000 Subject: [PATCH 7/9] Use correct color.js reference in float-packing.js --- src/core/math/float-packing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/math/float-packing.js b/src/core/math/float-packing.js index 9d5b3c49ec5..f30fc013bb9 100644 --- a/src/core/math/float-packing.js +++ b/src/core/math/float-packing.js @@ -1,5 +1,5 @@ /** - * @import { Color } from './color' + * @import { Color } from './color.js' */ const floatView = new Float32Array(1); From 462f02501533f785f97daa0c24f40263dc410d18 Mon Sep 17 00:00:00 2001 From: Liam Don Date: Mon, 23 Jun 2025 18:41:56 +0000 Subject: [PATCH 8/9] Clarify that ts-node usage is only for Mocha --- tsconfig.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 51489b531d0..1855358295f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,8 +18,9 @@ }, "ts-node": { "esm": true, - // It is faster to skip typechecking. - // Remove if you want ts-node to do typechecking. + // Note that ts-node is only used by the Mocha test runner. + // Remove if you want ts-node to do typechecking during Mocha tests, + // but this may require additional configuration like a separate tsconfig.json for tests. "transpileOnly": true, "files": true, "experimentalSpecifierResolution": "node", From 6687bfdc3e4b94f5eaf1268522180acf7a01b4a4 Mon Sep 17 00:00:00 2001 From: Liam Don Date: Tue, 24 Jun 2025 05:39:50 +0000 Subject: [PATCH 9/9] Dev mode examples load fresh .ts files as .js --- examples/package.json | 2 +- examples/scripts/serve.js | 206 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 207 insertions(+), 1 deletion(-) create mode 100755 examples/scripts/serve.js diff --git a/examples/package.json b/examples/package.json index d2694bb8f38..2353b276fe2 100644 --- a/examples/package.json +++ b/examples/package.json @@ -11,7 +11,7 @@ "clean": "node ./scripts/clean.mjs", "develop": "cross-env NODE_ENV=development concurrently --kill-others \"npm run watch\" \"npm run serve\"", "lint": "eslint .", - "serve": "serve dist -l 5555 --no-request-logging --config ../serve.json", + "serve": "PORT=5555 node scripts/serve.js", "watch": "npm run -s build:metadata && cross-env NODE_ENV=development rollup -c -w" }, "devDependencies": { diff --git a/examples/scripts/serve.js b/examples/scripts/serve.js new file mode 100755 index 00000000000..b57bcebbf18 --- /dev/null +++ b/examples/scripts/serve.js @@ -0,0 +1,206 @@ +#!/usr/bin/env node + +import { promises as fs } from 'fs'; +import http from 'http'; +import path from 'path'; +import { parse as parseUrl } from 'url'; + +import { transformSync } from '@swc/core'; +import serveHandler from 'serve-handler'; + +// Cache for transpiled TypeScript files +const cache = new Map(); + +// SWC configuration matching the project's existing setup +const swcOptions = { + jsc: { + parser: { + syntax: 'typescript', + tsx: false, + decorators: false, + dynamicImport: true + }, + target: 'es2022', + loose: false, + externalHelpers: false + }, + module: { + type: 'es6', + strict: false, + strictMode: true, + lazy: false, + noInterop: false + }, + sourceMaps: 'inline', + inlineSourcesContent: true +}; + +/** + * Check if a file exists + * @param {string} filePath - The path to the file + * @returns {Promise} Whether the file exists + */ +async function fileExists(filePath) { + try { + await fs.access(filePath); + return true; + } catch { + return false; + } +} + +/** + * Get file modification time + * @param {string} filePath - The path to the file + * @returns {Promise} The file modification time + */ +async function getMtime(filePath) { + try { + const stats = await fs.stat(filePath); + return stats.mtime.getTime(); + } catch { + return null; + } +} + +/** + * Transpile TypeScript file to JavaScript + * @param {string} tsPath - The path to the TypeScript file + * @param {string} jsPath - The path to the JavaScript file + * @returns {Promise} The transpiled JavaScript code + */ +async function transpileTypeScript(tsPath, jsPath) { + // Check cache + const cacheKey = tsPath; + const mtime = await getMtime(tsPath); + + if (cache.has(cacheKey)) { + const cached = cache.get(cacheKey); + if (cached.mtime === mtime) { + console.log(`[Serve] Cache hit: ${path.relative(process.cwd(), tsPath)}`); + return cached.content; + } + } + + console.log(`[Serve] Transpiling: ${path.relative(process.cwd(), tsPath)}`); + + try { + const tsContent = await fs.readFile(tsPath, 'utf8'); + // @ts-ignore + const result = transformSync(tsContent, { + ...swcOptions, + filename: tsPath + }); + + // Cache the result + cache.set(cacheKey, { + content: result.code, + mtime: mtime + }); + + return result.code; + } catch (error) { + console.error(`[Serve] Error transpiling ${tsPath}:`, error.message); + throw error; + } +} + +/** + * Custom request handler that intercepts .js requests + * @param {import('http').IncomingMessage} request - The incoming request + * @param {import('http').ServerResponse} response - The outgoing response + * @param {object} serveConfig - The serve configuration + * @param {string} rootDir - The root directory to serve + * @returns {Promise} + */ +async function handleRequest(request, response, serveConfig, rootDir) { + const parsedUrl = parseUrl(request.url ?? ''); + const requestPath = parsedUrl.pathname; + + // Only intercept .js file requests + if (requestPath?.endsWith('.js')) { + const absolutePath = path.join(rootDir, requestPath); + const jsExists = await fileExists(absolutePath); + + // If .js file doesn't exist, check for .ts file + if (!jsExists) { + const tsPath = absolutePath.replace(/\.js$/, '.ts'); + const tsExists = await fileExists(tsPath); + + if (tsExists) { + try { + const transpiledCode = await transpileTypeScript(tsPath, absolutePath); + + // Send the transpiled JavaScript + response.setHeader('Content-Type', 'application/javascript; charset=utf-8'); + response.setHeader('Cache-Control', 'no-cache'); + response.statusCode = 200; + response.end(transpiledCode); + return; + } catch (error) { + // Send error response + response.setHeader('Content-Type', 'text/plain; charset=utf-8'); + response.statusCode = 500; + response.end(`Error transpiling TypeScript file: ${error.message}`); + return; + } + } + } + } + + // Pass through to serve-handler for all other requests + return serveHandler(request, response, { + ...serveConfig, + public: rootDir + }); +} + +/** + * Start the server + */ +async function startServer() { + const port = process.env.PORT || 3000; + // Get directory to serve from command line args or environment variable + const args = process.argv.slice(2); + let rootDir = args[0] || process.env.SERVE_DIR || 'dist'; + + // Resolve to absolute path + rootDir = path.resolve(process.cwd(), rootDir); + + // Check if directory exists + if (!await fileExists(rootDir)) { + console.error(`[Serve] Error: Directory '${rootDir}' does not exist`); + process.exit(1); + } + + // Load serve configuration + let serveConfig = {}; + try { + const configPath = path.join(process.cwd(), 'serve.json'); + const configContent = await fs.readFile(configPath, 'utf8'); + serveConfig = JSON.parse(configContent); + } catch { + // No serve.json found, use defaults + } + + const server = http.createServer((request, response) => { + handleRequest(request, response, serveConfig, rootDir).catch((error) => { + console.error('[Serve] Server error:', error); + response.statusCode = 500; + response.end('Internal Server Error'); + }); + }); + + server.listen(port, () => { + console.log(`[Serve] TS-enabled server running at http://localhost:${port}`); + console.log(`[Serve] Serving directory: ${rootDir}`); + }); +} + +// Start the server +startServer().catch((error) => { + console.error('[Serve] Failed to start server:', error); + process.exit(1); +}); + +export { handleRequest, transpileTypeScript };