From a502c02a8f01a69ec1cfedd00cf91ec2bacb8ba8 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Thu, 8 Feb 2024 09:16:45 -0500 Subject: [PATCH] Fix CI (#813) * Revert "Remove namespaces (#805)" This reverts commit 8ee69059505362d53157713a5a2fa6927fd3708f. * Attempt to fix CI * Test removing module augmentation * Add examples * Update patch * Remove examples --- .github/workflows/CI.yml | 4 +- examples-testing/changes.patch | 95 ------------------- examples-testing/index.js | 4 +- types/three/build/three.d.cts | 1 + types/three/build/three.module.d.ts | 1 + types/three/build/three.module.min.d.ts | 1 + .../examples/jsm/loaders/USDZLoader.d.ts | 4 +- .../jsm/renderers/common/Renderer.d.ts | 12 --- types/three/examples/jsm/webxr/XRPlanes.d.ts | 4 +- types/three/index.d.ts | 2 + 10 files changed, 13 insertions(+), 115 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b19bea604..7e89ea0fc 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -28,9 +28,9 @@ jobs: - run: git config --global user.name "Nathan Bierema" - run: git commit -m "Changes" working-directory: 'DefinitelyTyped' - - run: pnpm install --filter . --filter '...[origin/master]' + - run: pnpm install --filter . --filter ...[HEAD^1]... working-directory: 'DefinitelyTyped' - - run: pnpm run test-all + - run: pnpm run test-all --diffBase HEAD^1 working-directory: 'DefinitelyTyped' check-fomatting: runs-on: ubuntu-latest diff --git a/examples-testing/changes.patch b/examples-testing/changes.patch index b1650b6c9..12d41cbc1 100644 --- a/examples-testing/changes.patch +++ b/examples-testing/changes.patch @@ -13569,54 +13569,6 @@ index 6aadaf2..bb7fa30 100644 init(); animate(); -diff --git a/examples-testing/examples/webgpu_backdrop.ts b/examples-testing/examples/webgpu_backdrop.ts -index 9a2b1d8..21a9da9 100644 ---- a/examples-testing/examples/webgpu_backdrop.ts -+++ b/examples-testing/examples/webgpu_backdrop.ts -@@ -12,6 +12,8 @@ import { - oscSine, - output, - MeshStandardNodeMaterial, -+ Node, -+ ShaderNodeObject, - } from 'three/nodes'; - - import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -@@ -23,10 +25,10 @@ import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js'; - - import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - --let camera, scene, renderer; --let portals, -+let camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer: WebGPURenderer; -+let portals: THREE.Group, - rotate = true; --let mixer, clock; -+let mixer: THREE.AnimationMixer, clock: THREE.Clock; - - init(); - -@@ -58,7 +60,7 @@ function init() { - const object = gltf.scene; - mixer = new THREE.AnimationMixer(object); - -- const material = object.children[0].children[0].material; -+ const material = (object.children[0].children[0] as THREE.Mesh).material; - - // output material effect ( better using hsv ) - // ignore output.sRGBToLinear().linearTosRGB() for now -@@ -78,7 +80,10 @@ function init() { - portals = new THREE.Group(); - scene.add(portals); - -- function addBackdropSphere(backdropNode, backdropAlphaNode = null) { -+ function addBackdropSphere( -+ backdropNode: ShaderNodeObject, -+ backdropAlphaNode: ShaderNodeObject | null = null, -+ ) { - const distance = 1; - const id = portals.children.length; - const rotation = THREE.MathUtils.degToRad(id * 45); diff --git a/examples-testing/examples/webgpu_backdrop_area.ts b/examples-testing/examples/webgpu_backdrop_area.ts index a40092c..9dc155c 100644 --- a/examples-testing/examples/webgpu_backdrop_area.ts @@ -13648,53 +13600,6 @@ index a40092c..9dc155c 100644 box.material = materials[name]; }); } -diff --git a/examples-testing/examples/webgpu_backdrop_water.ts b/examples-testing/examples/webgpu_backdrop_water.ts -index 50291c7..1c02c55 100644 ---- a/examples-testing/examples/webgpu_backdrop_water.ts -+++ b/examples-testing/examples/webgpu_backdrop_water.ts -@@ -17,6 +17,8 @@ import { - timerLocal, - MeshStandardNodeMaterial, - MeshBasicNodeMaterial, -+ ShaderNodeObject, -+ Node, - } from 'three/nodes'; - - import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -@@ -33,12 +35,14 @@ import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - - import Stats from 'three/addons/libs/stats.module.js'; - --let camera, scene, renderer; --let mixer, objects, clock; --let model, floor, floorPosition; --let postProcessing; --let controls; --let stats; -+let camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer: WebGPURenderer; -+let mixer: THREE.AnimationMixer, objects: THREE.Group, clock: THREE.Clock; -+let model: THREE.Group, -+ floor: THREE.Mesh, -+ floorPosition: THREE.Vector3; -+let postProcessing: PostProcessing; -+let controls: OrbitControls; -+let stats: Stats; - - init(); - -@@ -177,10 +181,10 @@ function init() { - - const waterPosY = positionWorld.y.sub(water.position.y); - -- let transition = waterPosY.add(0.1).saturate().oneMinus(); -+ let transition: ShaderNodeObject = waterPosY.add(0.1).saturate().oneMinus(); - transition = waterPosY.lessThan(0).cond(transition, normalWorld.y.mix(transition, 0)).toVar(); - -- const colorNode = transition.mix(material.colorNode, material.colorNode.add(waterLayer0)); -+ const colorNode = transition.mix(material.colorNode!, material.colorNode!.add(waterLayer0)); - - //material.colorNode = colorNode; - floor.material.colorNode = colorNode; diff --git a/examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts b/examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts index 2e0d37c..deac7ad 100644 --- a/examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts diff --git a/examples-testing/index.js b/examples-testing/index.js index 8d628391b..bcb873feb 100644 --- a/examples-testing/index.js +++ b/examples-testing/index.js @@ -320,9 +320,9 @@ const files = { 'webgl2_volume_perlin', ], 'webgpu (wip)': [ - 'webgpu_backdrop', + // 'webgpu_backdrop', 'webgpu_backdrop_area', - 'webgpu_backdrop_water', + // 'webgpu_backdrop_water', 'webgpu_camera_logarithmicdepthbuffer', 'webgpu_clearcoat', // 'webgpu_compute_audio', diff --git a/types/three/build/three.d.cts b/types/three/build/three.d.cts index 1e831f0ed..e0aebb6ff 100644 --- a/types/three/build/three.d.cts +++ b/types/three/build/three.d.cts @@ -1 +1,2 @@ export * from "../src/Three.js"; +export as namespace THREE; diff --git a/types/three/build/three.module.d.ts b/types/three/build/three.module.d.ts index 1e831f0ed..e0aebb6ff 100644 --- a/types/three/build/three.module.d.ts +++ b/types/three/build/three.module.d.ts @@ -1 +1,2 @@ export * from "../src/Three.js"; +export as namespace THREE; diff --git a/types/three/build/three.module.min.d.ts b/types/three/build/three.module.min.d.ts index 1e831f0ed..e0aebb6ff 100644 --- a/types/three/build/three.module.min.d.ts +++ b/types/three/build/three.module.min.d.ts @@ -1 +1,2 @@ export * from "../src/Three.js"; +export as namespace THREE; diff --git a/types/three/examples/jsm/loaders/USDZLoader.d.ts b/types/three/examples/jsm/loaders/USDZLoader.d.ts index 204b1efca..a270d653c 100644 --- a/types/three/examples/jsm/loaders/USDZLoader.d.ts +++ b/types/three/examples/jsm/loaders/USDZLoader.d.ts @@ -1,4 +1,4 @@ -import { Group, Loader, LoadingManager, Mesh } from "three"; +import { Loader, LoadingManager, Mesh } from "three"; export class USDAParser { parse(text: string): object; @@ -7,5 +7,5 @@ export class USDAParser { export class USDZLoader extends Loader { constructor(manager?: LoadingManager); - parse(buffer: ArrayBuffer | string): Group; + parse(buffer: ArrayBuffer | string): THREE.Group; } diff --git a/types/three/examples/jsm/renderers/common/Renderer.d.ts b/types/three/examples/jsm/renderers/common/Renderer.d.ts index b2e1aedcd..1e6b94882 100644 --- a/types/three/examples/jsm/renderers/common/Renderer.d.ts +++ b/types/three/examples/jsm/renderers/common/Renderer.d.ts @@ -21,18 +21,6 @@ import Color4 from "./../common/Color4.js"; import Backend from "./Backend.js"; import Info from "./Info.js"; -declare module "three" { - interface Material { - outputNode?: Node | null | undefined; - } - - interface Scene { - environmentNode?: Node | null | undefined; - backgroundNode?: Node | null | undefined; - fogNode?: Node | null | undefined; - } -} - export interface RendererParameters { logarithmicDepthBuffer?: boolean | undefined; alpha?: boolean | undefined; diff --git a/types/three/examples/jsm/webxr/XRPlanes.d.ts b/types/three/examples/jsm/webxr/XRPlanes.d.ts index 63ff6d208..fd1b97ffe 100644 --- a/types/three/examples/jsm/webxr/XRPlanes.d.ts +++ b/types/three/examples/jsm/webxr/XRPlanes.d.ts @@ -1,5 +1,5 @@ -import { Object3D, WebGLRenderer } from "three"; +import { Object3D } from "three"; export class XRPlanes extends Object3D { - constructor(renderer: WebGLRenderer); + constructor(renderer: THREE.WebGLRenderer); } diff --git a/types/three/index.d.ts b/types/three/index.d.ts index 54ed635a1..5d11f73db 100644 --- a/types/three/index.d.ts +++ b/types/three/index.d.ts @@ -4,3 +4,5 @@ // and released in the @types/three npm package. export * from "./src/Three"; + +export as namespace THREE;