Skip to content

Commit

Permalink
chore(deps): Update to svelte 5 (#1608)
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy authored Feb 7, 2025
1 parent 48546eb commit 6df69ad
Show file tree
Hide file tree
Showing 13 changed files with 613 additions and 569 deletions.
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packageRules": [
{
"description": "Requires updates to tweakpane-plugin-thumbnail-list",
"matchPackageNames": ["tweakpane"],
"matchPackageNames": ["tweakpane", "@tweakpane/core"],
"enabled": false
},
{
Expand Down
3 changes: 2 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import tseslint from 'typescript-eslint';
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
// @ts-ignore
...sveltelint.configs['flat/recommended'],
prettier,
{
rules: {
'@typescript-eslint/no-empty-object-type': ['off'],
'@typescript-eslint/no-non-null-assertion': ['off'],
'@typescript-eslint/no-this-alias': ['off'],
'@typescript-eslint/no-unused-expressions': ['off'],
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': ['off'],
Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,25 @@
"docs:deploy": "yarn dist && vercel"
},
"devDependencies": {
"@eslint/js": "^9.15.0",
"@tweakpane/core": "^2.0.5",
"@eslint/js": "^9.19.0",
"@tweakpane/core": "<2.0.0",
"@types/command-exists": "1.2.3",
"@types/d3-dsv": "^3.0.7",
"@types/draco3dgltf": "1.4.3",
"@types/jsdom": "^21.1.7",
"@types/ndarray": "1.0.14",
"@types/node": "22.10.1",
"@types/node": "22.13.1",
"@types/node-gzip": "1.1.3",
"@types/semver": "^7",
"@types/three": "^0.170.0",
"@types/semver": "^7.5.8",
"@types/three": "^0.173.0",
"@types/wrap-ansi": "^8.1.0",
"ava": "^6.2.0",
"c8": "^10.1.2",
"c8": "^10.1.3",
"d3-dsv": "^3.0.1",
"draco3dgltf": "1.5.7",
"eslint": "9.15.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-svelte": "^2.46.0",
"eslint": "9.19.0",
"eslint-config-prettier": "10.0.1",
"eslint-plugin-svelte": "^2.46.1",
"gl-matrix": "^3.4.3",
"gltf-validator": "2.0.0-dev.3.10",
"jsdom": "^26.0.0",
Expand All @@ -59,19 +59,19 @@
"meshoptimizer": "0.22.0",
"microbundle": "0.15.1",
"mikktspace": "1.1.1",
"prettier": "3.4.1",
"prettier-plugin-svelte": "^3.3.2",
"prettier": "3.4.2",
"prettier-plugin-svelte": "^3.3.3",
"rimraf": "^6.0.1",
"semver": "^7.6.3",
"semver": "^7.7.1",
"simple-dropzone": "^0.8.3",
"three": "^0.171.0",
"tinybench": "^3.0.6",
"three": "^0.173.0",
"tinybench": "^3.1.1",
"tsx": "^4.19.2",
"tweakpane": "^4.0.5",
"tweakpane": "<4.0.0",
"tweakpane-plugin-thumbnail-list": "^0.3.0",
"typescript": "5.6.3",
"typescript-eslint": "^7.18.0",
"vite": "^5.4.11"
"typescript": "5.7.3",
"typescript-eslint": "^8.23.0",
"vite": "^6.1.0"
},
"ava": {
"extensions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"gltf-validator": "~2.0.0-dev.3.10",
"keyframe-resample": "~0.1.0",
"ktx-parse": "~0.7.1",
"language-tags": "~2.0.0",
"language-tags": "~2.0.1",
"listr2": "~8.2.5",
"meshoptimizer": "~0.22.0",
"micromatch": "~4.0.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types/gltf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Module for glTF 2.0 Interface
*/
export declare module GLTF {
export declare namespace GLTF {
/** Data type of the values composing each element in the accessor. */
type AccessorComponentType = 5120 | 5121 | 5122 | 5123 | 5125 | 5126;
/** Element type contained by the accessor (SCALAR, VEC2, ...). */
Expand Down
14 changes: 7 additions & 7 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
"@gltf-transform/functions": "^4.1.1",
"@greendoc/parse": "^0.4.1",
"@greendoc/svelte": "^0.4.1",
"@sveltejs/adapter-static": "^3.0.6",
"@sveltejs/kit": "^2.8.5",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@sveltejs/adapter-static": "^3.0.8",
"@sveltejs/kit": "^2.17.1",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@types/he": "^1.2.3",
"he": "^1.2.0",
"highlight.js": "^11.10.0",
"highlight.js": "^11.11.1",
"mdsvex": "^0.12.3",
"svelte": "^4.2.19",
"svelte-check": "^4.1.0",
"svelte": "^5.19.9",
"svelte-check": "^4.1.4",
"ts-morph": "^22.0.0",
"tslib": "^2.8.1",
"vite": "^5.4.11"
"vite": "^6.1.0"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/docs/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</a>
</li>
{/if}
<li class="flex" />
<li class="flex"></li>
{#if innerWidth > LG}
{#each resources as resource}
<li>
Expand Down
17 changes: 5 additions & 12 deletions packages/docs/src/routes/[slug]/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import { render } from 'svelte/server';
import { error } from '@sveltejs/kit';

export const load = async ({ params }) => {
let html = '';
let metadata;

try {
const page = await import(`../../lib/pages/${params.slug}.md`);
html = page.default.render().html;
metadata = page.metadata;
} catch (e) {
//
const { default: Page } = await import(`../../lib/pages/${params.slug}.md`);
return render(Page);
} catch {
error(404, 'Not found');
}

if (!html) error(404, 'Not found');

return { html, metadata };
};
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function decodeAttribute(

const ptr = decoderModule._malloc(byteLength);
decoder.GetAttributeDataArrayForAllPoints(mesh, attribute, dataType, byteLength, ptr);
// @ts-expect-error Incorrect types.
const array: TypedArray = new ArrayCtor(decoderModule.HEAPF32.buffer, ptr, numValues).slice();
decoderModule._free(ptr);

Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/prune.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ async function getTextureFactor(texture: Texture): Promise<vec4 | null> {
async function maybeGetPixels(texture: Texture): Promise<NdArray<Uint8Array> | null> {
try {
return await getPixels(texture.getImage()!, texture.getMimeType());
} catch (e) {
} catch {
return null;
}
}
22 changes: 11 additions & 11 deletions packages/view/examples/material-pane.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Document, Material, Texture } from '@gltf-transform/core';
import { ColorUtils, Document, Material, Texture } from '@gltf-transform/core';
import { KHRMaterialsClearcoat, KHRMaterialsIOR, KHRMaterialsSheen, KHRMaterialsSpecular, KHRMaterialsTransmission, KHRMaterialsUnlit, KHRMaterialsVolume } from '@gltf-transform/extensions';
import { FolderApi, Pane } from 'tweakpane';
import * as TweakpanePluginThumbnailList from 'tweakpane-plugin-thumbnail-list';
Expand Down Expand Up @@ -46,11 +46,11 @@ export function createMaterialPane(_pane: Pane, document: Document, material: Ma

const params = {
// Core.
baseColorFactor: material.getBaseColorHex(),
baseColorFactor: ColorUtils.factorToHex(material.getBaseColorFactor()),
baseColorTexture: textureValue(material.getBaseColorTexture(), textureOptions),
alpha: material.getAlpha(),
alphaMode: material.getAlphaMode(),
emissiveFactor: material.getEmissiveHex(),
emissiveFactor: ColorUtils.factorToHex(material.getEmissiveFactor()),
emissiveTexture: textureValue(material.getEmissiveTexture(), textureOptions),
roughnessFactor: material.getRoughnessFactor(),
metallicFactor: material.getMetallicFactor(),
Expand All @@ -75,7 +75,7 @@ export function createMaterialPane(_pane: Pane, document: Document, material: Ma

// Sheen.
sheenEnabled: !!material.getExtension('KHR_materials_sheen'),
sheenColorFactor: sheen.getSheenColorHex(),
sheenColorFactor: ColorUtils.factorToHex(sheen.getSheenColorFactor()),
sheenColorTexture: textureValue(sheen.getSheenColorTexture(), textureOptions),
sheenRoughnessFactor: sheen.getSheenRoughnessFactor(),
sheenRoughnessTexture: textureValue(sheen.getSheenRoughnessTexture(), textureOptions),
Expand All @@ -84,7 +84,7 @@ export function createMaterialPane(_pane: Pane, document: Document, material: Ma
specularEnabled: !!material.getExtension('KHR_materials_specular'),
specularFactor: specular.getSpecularFactor(),
specularTexture: textureValue(specular.getSpecularTexture(), textureOptions),
specularColorFactor: specular.getSpecularColorHex(),
specularColorFactor: ColorUtils.factorToHex(specular.getSpecularColorFactor()),
specularColorTexture: textureValue(specular.getSpecularColorTexture(), textureOptions),

// Transmission.
Expand All @@ -96,7 +96,7 @@ export function createMaterialPane(_pane: Pane, document: Document, material: Ma
volumeEnabled: !!material.getExtension('KHR_materials_volume'),
thicknessFactor: volume.getThicknessFactor(),
thicknessTexture: textureValue(volume.getThicknessTexture(), textureOptions),
attenuationColorFactor: volume.getAttenuationColorHex(),
attenuationColorFactor: ColorUtils.factorToHex(volume.getAttenuationColor()),
attenuationDistance: Number.isFinite(volume.getAttenuationDistance())
? volume.getAttenuationDistance()
: 0,
Expand All @@ -107,7 +107,7 @@ export function createMaterialPane(_pane: Pane, document: Document, material: Ma

const coreFolder = pane.addFolder({title: 'Basic'});
coreFolder.addInput(params, 'baseColorFactor', {view: 'color'})
.on('change', () => material.setBaseColorHex(params.baseColorFactor));
.on('change', () => material.setBaseColorFactor(ColorUtils.hexToFactor(params.baseColorFactor, [0, 0, 0, 0])));
coreFolder.addInput(params, 'baseColorTexture', {view: 'thumbnail-list', options: textureOptions})
.on('change', (ev) => material.setBaseColorTexture(textureFromEvent(ev)));
coreFolder.addSeparator();
Expand All @@ -117,7 +117,7 @@ export function createMaterialPane(_pane: Pane, document: Document, material: Ma
.on('change', () => material.setAlphaMode(params.alphaMode));
coreFolder.addSeparator();
coreFolder.addInput(params, 'emissiveFactor', {view: 'color'})
.on('change', () => material.setEmissiveHex(params.emissiveFactor));
.on('change', () => material.setEmissiveFactor(ColorUtils.hexToFactor(params.emissiveFactor, [0, 0, 0])));
coreFolder.addInput(params, 'emissiveTexture', {view: 'thumbnail-list', options: textureOptions})
.on('change', (ev) => material.setEmissiveTexture(textureFromEvent(ev)));
coreFolder.addSeparator();
Expand Down Expand Up @@ -181,7 +181,7 @@ export function createMaterialPane(_pane: Pane, document: Document, material: Ma
sheenFolder.on('change', () => {
material.setExtension('KHR_materials_sheen', params.sheenEnabled ? sheen : null);
sheen
.setSheenColorHex(params.sheenColorFactor)
.setSheenColorFactor(ColorUtils.hexToFactor(params.sheenColorFactor, [0, 0, 0]))
.setSheenRoughnessFactor(params.sheenRoughnessFactor);
});

Expand All @@ -199,7 +199,7 @@ export function createMaterialPane(_pane: Pane, document: Document, material: Ma
material.setExtension('KHR_materials_specular', params.specularEnabled ? specular : null);
specular
.setSpecularFactor(params.specularFactor)
.setSpecularColorHex(params.specularColorFactor);
.setSpecularColorFactor(ColorUtils.hexToFactor(params.specularColorFactor, [0, 0, 0]));
});

const transmissionFolder = pane.addFolder({title: 'KHR_materials_transmission', expanded: false});
Expand All @@ -226,7 +226,7 @@ export function createMaterialPane(_pane: Pane, document: Document, material: Ma
material.setExtension('KHR_materials_volume', params.volumeEnabled ? volume : null);
volume
.setThicknessFactor(params.thicknessFactor)
.setAttenuationColorHex(params.attenuationColorFactor)
.setAttenuationColor(ColorUtils.hexToFactor(params.attenuationColorFactor, [0, 0, 0]))
.setAttenuationDistance(params.attenuationDistance);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"scripts": {
"dist": "microbundle --no-compress --format modern",
"watch": "microbundle watch --no-compress --format modern",
"dev": "concurrently \"yarn watch\" \"vite -c examples/vite.config.js\""
"dev": "vite -c examples/vite.config.js"
},
"files": [
"dist/",
Expand Down
Loading

0 comments on commit 6df69ad

Please sign in to comment.