perf: reduce 3D runtime artifacts (#7)

This commit is contained in:
2026-07-29 11:04:42 +09:00
parent fc2871ce4c
commit 0c656808e0
20 changed files with 148 additions and 309 deletions
+18 -14
View File
@@ -1,5 +1,5 @@
import { createHash } from 'node:crypto';
import { readFileSync, statSync } from 'node:fs';
import { existsSync, readFileSync, statSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';
@@ -11,21 +11,25 @@ function sha256(path: string): string {
}
describe('decoder staging', () => {
it('copies decoder binaries byte-for-byte without executable permission', () => {
const threeRoot = resolve(
dirname(fileURLToPath(import.meta.resolve('three'))),
'..',
);
it('stages only the single-thread IFC runtime', () => {
expect(
existsSync(
resolve(projectRoot, 'apps/viewer-3d/public/web-ifc/web-ifc-mt.wasm'),
),
).toBe(false);
});
it('does not stage decoder copies already bundled by Three.js', () => {
for (const directory of ['draco', 'basis']) {
expect(
existsSync(resolve(projectRoot, 'apps/viewer-3d/public', directory)),
).toBe(false);
}
});
it('copies the IFC binary byte-for-byte without executable permission', () => {
const ifcRoot = dirname(fileURLToPath(import.meta.resolve('web-ifc')));
const pairs = [
[
resolve(threeRoot, 'examples/jsm/libs/draco/gltf/draco_decoder.wasm'),
resolve(projectRoot, 'apps/viewer-3d/public/draco/draco_decoder.wasm'),
],
[
resolve(threeRoot, 'examples/jsm/libs/basis/basis_transcoder.wasm'),
resolve(projectRoot, 'apps/viewer-3d/public/basis/basis_transcoder.wasm'),
],
[
resolve(ifcRoot, 'web-ifc.wasm'),
resolve(projectRoot, 'apps/viewer-3d/public/web-ifc/web-ifc.wasm'),