3D engine that AI agents drive
JavaScript 3d3d-engineagentic-aiai-agentsblenderclaude-codegame-enginegaussian-splattinggltfjavascriptmcpmcp-servermodel-context-protocolpath-tracerpath-tracingpbrrenderingthreejs-alternativewebgl2webgpu
Record the three.js addon size and pin its snippet count and ceiling (#986)
Nguyen Xuan An89e7c3ad1888
diff --git a/changes/986.md b/changes/986.mdnew file mode 100644index 00000000..4a35c066--- /dev/null+++ b/changes/986.md@@ -0,0 +1 @@+- The three.js addon test pins the addon at 10 or more snippets that each draw a frame, and its source under 40,000 bytes, so growth shows up in review (#986)diff --git a/changes/986.size.md b/changes/986.size.mdnew file mode 100644index 00000000..d126cfea--- /dev/null+++ b/changes/986.size.md@@ -0,0 +1 @@+- three-compat addon (`packages/three-compat/index.mjs`): 33,076 bytes of source, 9,259 bytes gzip, measured after the Lambert and Phong material support landed. No core bundle imports it, and `npm run size -- --base origin/main` reports that no bundle grew.diff --git a/tests/three-compat.test.js b/tests/three-compat.test.jsindex f4800db5..4e75f219 100644--- a/tests/three-compat.test.js+++ b/tests/three-compat.test.js@@ -1,6 +1,7 @@import test from 'node:test';import assert from 'node:assert/strict';-import { existsSync } from 'node:fs';+import { existsSync, statSync } from 'node:fs';+import { readFile } from 'node:fs/promises';import { constants, setPriority } from 'node:os';import * as RealThree from 'three';import * as core from '../src/index.js';@@ -330,3 +331,11 @@ test('a torus with radius 0 throws an error that names the radius', () => {assert.throws(() => new THREE.TorusGeometry(Number.NaN, 0.4), /TorusGeometry radius is NaN/);assert.doesNotThrow(() => new THREE.TorusGeometry(2, 0.4));});++test('the addon stays outside the core bundles and under its size ceiling', async () => {+ const addonBytes = statSync(new URL('../packages/three-compat/index.mjs', import.meta.url)).size;+ assert.ok(addonBytes < 40000, `the addon is ${addonBytes} bytes; record the growth in changes/986.size.md and raise this ceiling`);+ assert.ok(snippets.length >= 10, `only ${snippets.length} three.js-style snippets; the issue asks for at least 10`);+ const coreSource = await readFile(new URL('../src/index.js', import.meta.url), 'utf8');+ assert.ok(!coreSource.includes('three-compat'), 'the core must not import the addon');+});