u-space 0.0.32 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -129,7 +129,7 @@ pnpm dev
129
129
 
130
130
  ```typescript
131
131
  import { version } from 'u-space';
132
- console.log(version); // e.g. '0.0.32'
132
+ console.log(version); // e.g. '0.0.33'
133
133
 
134
134
  // 也可以通过全局变量访问
135
135
  console.log(window.__USPACE__.version);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u-space",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "type": "module",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "module": "dist/index.js",
@@ -1 +0,0 @@
1
- "use strict";function h(n){const r=n.nodes??[];if(r.length>1e5)throw new Error(`Decoded glTF contains ${r.length} nodes; the safe limit is 100000.`);const D=new Uint8Array(r.length);for(let e=0;e<r.length;e++){const d=r[e].children??[],c=new Set;for(const o of d){if(!Number.isInteger(o)||o<0||o>=r.length)throw new Error(`Decoded glTF node ${e} references invalid child ${o}.`);if(c.has(o))throw new Error(`Decoded glTF node ${e} repeats child ${o}.`);if(c.add(o),D[o]++,D[o]>1)throw new Error(`Decoded glTF node ${o} has multiple parents.`)}}const t=new Uint8Array(r.length),E=(e,d)=>{if(d>512)throw new Error("Decoded glTF node graph exceeds the safe depth of 512.");if(t[e]===1)throw new Error(`Decoded glTF node graph contains a cycle at ${e}.`);if(t[e]!==2){t[e]=1;for(const c of r[e].children??[])E(c,d+1);t[e]=2}};for(let e=0;e<r.length;e++)E(e,1);const s=n.scene??0,l=n.scenes?.[s];if(!l)throw new Error(`Decoded glTF references missing scene ${s}.`);const i=new Set;for(const e of l.nodes??[]){if(!Number.isInteger(e)||e<0||e>=r.length)throw new Error(`Decoded glTF scene ${s} references invalid node ${e}.`);if(i.has(e))throw new Error(`Decoded glTF scene ${s} repeats root node ${e}.`);if(i.add(e),D[e]>0)throw new Error(`Decoded glTF scene root ${e} is also referenced as a child.`)}}class a extends Error{name="UnsupportedModelDecodeError";constructor(r){super(r)}}exports.MODEL_DECODE_PROTOCOL_VERSION=3;exports.UnsupportedModelDecodeError=a;exports.validateDecodedGltfNodeGraph=h;
@@ -1,56 +0,0 @@
1
- const h = 3;
2
- function a(n) {
3
- const r = n.nodes ?? [];
4
- if (r.length > 1e5)
5
- throw new Error(
6
- `Decoded glTF contains ${r.length} nodes; the safe limit is 100000.`
7
- );
8
- const D = new Uint8Array(r.length);
9
- for (let e = 0; e < r.length; e++) {
10
- const c = r[e].children ?? [], d = /* @__PURE__ */ new Set();
11
- for (const o of c) {
12
- if (!Number.isInteger(o) || o < 0 || o >= r.length)
13
- throw new Error(`Decoded glTF node ${e} references invalid child ${o}.`);
14
- if (d.has(o))
15
- throw new Error(`Decoded glTF node ${e} repeats child ${o}.`);
16
- if (d.add(o), D[o]++, D[o] > 1)
17
- throw new Error(`Decoded glTF node ${o} has multiple parents.`);
18
- }
19
- }
20
- const t = new Uint8Array(r.length), i = (e, c) => {
21
- if (c > 512)
22
- throw new Error(
23
- "Decoded glTF node graph exceeds the safe depth of 512."
24
- );
25
- if (t[e] === 1)
26
- throw new Error(`Decoded glTF node graph contains a cycle at ${e}.`);
27
- if (t[e] !== 2) {
28
- t[e] = 1;
29
- for (const d of r[e].children ?? []) i(d, c + 1);
30
- t[e] = 2;
31
- }
32
- };
33
- for (let e = 0; e < r.length; e++) i(e, 1);
34
- const s = n.scene ?? 0, l = n.scenes?.[s];
35
- if (!l) throw new Error(`Decoded glTF references missing scene ${s}.`);
36
- const E = /* @__PURE__ */ new Set();
37
- for (const e of l.nodes ?? []) {
38
- if (!Number.isInteger(e) || e < 0 || e >= r.length)
39
- throw new Error(`Decoded glTF scene ${s} references invalid node ${e}.`);
40
- if (E.has(e))
41
- throw new Error(`Decoded glTF scene ${s} repeats root node ${e}.`);
42
- if (E.add(e), D[e] > 0)
43
- throw new Error(`Decoded glTF scene root ${e} is also referenced as a child.`);
44
- }
45
- }
46
- class f extends Error {
47
- name = "UnsupportedModelDecodeError";
48
- constructor(r) {
49
- super(r);
50
- }
51
- }
52
- export {
53
- h as M,
54
- f as U,
55
- a as v
56
- };