@driftengine/assets 4.8.7 → 4.9.0
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.
- package/README.md +1 -1
- package/dist/bcLoad.d.ts +2 -1
- package/dist/bcLoad.js +3 -2
- package/dist/bcWorkers.d.ts +7 -1
- package/dist/drftLoader.d.ts +1 -1
- package/package.json +9 -4
- package/src/bcLoad.ts +3 -2
- package/src/bcWorkers.ts +7 -1
- package/src/drftLoader.ts +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Model readers for nine formats — `.blend` among them, read from the file's own DNA — and the streaming loader that uploads them.
|
|
4
4
|
|
|
5
|
-
**Cost:
|
|
5
|
+
**Cost: 25.9 KB gzipped on top of core.** Measured by `scripts/size-gate.test.mjs`, which fails if it drifts more than
|
|
6
6
|
3% — the number is a fact about the build rather than a claim in a document.
|
|
7
7
|
|
|
8
8
|
Part of [DriftEngine](../../README.md). See [`docs/ARCHITECTURE.md`](../../docs/ARCHITECTURE.md)
|
package/dist/bcLoad.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface BcDecoder {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* A decoder over a worker `spawn` starts, or on the main thread where it is null — the default, since
|
|
28
|
-
* the worker's factory lives behind its own specifier (
|
|
28
|
+
* the worker's factory lives behind its own specifier (`@driftengine/assets/bcWorkers`) and a caller
|
|
29
|
+
* names it.
|
|
29
30
|
*/
|
|
30
31
|
export declare function createBcDecoder(spawn?: (() => BcWorker) | null): BcDecoder;
|
package/dist/bcLoad.js
CHANGED
|
@@ -38,7 +38,8 @@ function settle(reply, pending) {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* A decoder over a worker `spawn` starts, or on the main thread where it is null — the default, since
|
|
41
|
-
* the worker's factory lives behind its own specifier (
|
|
41
|
+
* the worker's factory lives behind its own specifier (`@driftengine/assets/bcWorkers`) and a caller
|
|
42
|
+
* names it.
|
|
42
43
|
*/
|
|
43
44
|
export function createBcDecoder(spawn = null) {
|
|
44
45
|
let worker = null;
|
|
@@ -56,7 +57,7 @@ export function createBcDecoder(spawn = null) {
|
|
|
56
57
|
if (spawn === null) {
|
|
57
58
|
reason =
|
|
58
59
|
'BC textures decode on the main thread: no worker was named. Pass `bcWorker: spawnBcWorker`, ' +
|
|
59
|
-
|
|
60
|
+
"exported by '@driftengine/assets/bcWorkers', to decode them off it";
|
|
60
61
|
}
|
|
61
62
|
else {
|
|
62
63
|
try {
|
package/dist/bcWorkers.d.ts
CHANGED
|
@@ -13,11 +13,17 @@
|
|
|
13
13
|
*
|
|
14
14
|
* ```ts
|
|
15
15
|
* import { DrftLoader } from '@driftengine/assets';
|
|
16
|
-
* import { spawnBcWorker } from '@driftengine/assets/
|
|
16
|
+
* import { spawnBcWorker } from '@driftengine/assets/bcWorkers';
|
|
17
17
|
*
|
|
18
18
|
* const loader = new DrftLoader(renderer, { bcWorker: spawnBcWorker });
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
|
+
* **A declared subpath, so it resolves the way the barrel does**: to the build by default and to
|
|
22
|
+
* this file under `drift-source`. The path into `src/` that 4.8.7 documented still resolves, through
|
|
23
|
+
* the manifest's `./*` passthrough, and hands every consumer TypeScript inside `node_modules`, which
|
|
24
|
+
* is the default the 2026-09-13 flip took away from the barrels; a resolver that maps a package's
|
|
25
|
+
* subpaths into `src/` also doubled it, to `src/src/bcWorkers.ts`.
|
|
26
|
+
*
|
|
21
27
|
* Without it BC textures decode on the main thread, and the loader says so once. **What that costs**
|
|
22
28
|
* is the decode of a texture the device cannot take as blocks, which on a phone is every BC texture:
|
|
23
29
|
* a 2048² BC7 image is 262,144 blocks.
|
package/dist/drftLoader.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export interface DrftLoaderOptions {
|
|
|
51
51
|
readonly fetchImpl?: FetchLike;
|
|
52
52
|
/**
|
|
53
53
|
* What starts the worker a BC texture the device cannot take as blocks is decoded in:
|
|
54
|
-
* `spawnBcWorker`, from `@driftengine/assets/
|
|
54
|
+
* `spawnBcWorker`, from `@driftengine/assets/bcWorkers`. Absent, they decode on the main
|
|
55
55
|
* thread and the loader says so once — the factory is behind its own specifier so a consumer that
|
|
56
56
|
* never names it has no worker in its build. See `bcWorkers.ts`.
|
|
57
57
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driftengine/assets",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "Model readers and the streaming loader for the .drft container",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"default": "./dist/index.js"
|
|
14
14
|
},
|
|
15
|
+
"./bcWorkers": {
|
|
16
|
+
"drift-source": "./src/bcWorkers.ts",
|
|
17
|
+
"types": "./dist/bcWorkers.d.ts",
|
|
18
|
+
"default": "./dist/bcWorkers.js"
|
|
19
|
+
},
|
|
15
20
|
"./package.json": "./package.json",
|
|
16
21
|
"./*": "./*"
|
|
17
22
|
},
|
|
@@ -27,11 +32,11 @@
|
|
|
27
32
|
],
|
|
28
33
|
"sideEffects": false,
|
|
29
34
|
"dependencies": {
|
|
30
|
-
"@driftengine/drft": "4.
|
|
31
|
-
"@driftengine/texture": "4.
|
|
35
|
+
"@driftengine/drft": "4.9.0",
|
|
36
|
+
"@driftengine/texture": "4.9.0"
|
|
32
37
|
},
|
|
33
38
|
"peerDependencies": {
|
|
34
|
-
"@driftengine/core": "4.
|
|
39
|
+
"@driftengine/core": "4.9.0"
|
|
35
40
|
},
|
|
36
41
|
"author": "Drift Technologies",
|
|
37
42
|
"repository": {
|
package/src/bcLoad.ts
CHANGED
|
@@ -76,7 +76,8 @@ function settle(reply: BcReply, pending: Pending): void {
|
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* A decoder over a worker `spawn` starts, or on the main thread where it is null — the default, since
|
|
79
|
-
* the worker's factory lives behind its own specifier (
|
|
79
|
+
* the worker's factory lives behind its own specifier (`@driftengine/assets/bcWorkers`) and a caller
|
|
80
|
+
* names it.
|
|
80
81
|
*/
|
|
81
82
|
export function createBcDecoder(spawn: (() => BcWorker) | null = null): BcDecoder {
|
|
82
83
|
let worker: BcWorker | null = null;
|
|
@@ -96,7 +97,7 @@ export function createBcDecoder(spawn: (() => BcWorker) | null = null): BcDecode
|
|
|
96
97
|
if (spawn === null) {
|
|
97
98
|
reason =
|
|
98
99
|
'BC textures decode on the main thread: no worker was named. Pass `bcWorker: spawnBcWorker`, ' +
|
|
99
|
-
|
|
100
|
+
"exported by '@driftengine/assets/bcWorkers', to decode them off it";
|
|
100
101
|
} else {
|
|
101
102
|
try {
|
|
102
103
|
worker = spawn();
|
package/src/bcWorkers.ts
CHANGED
|
@@ -13,11 +13,17 @@
|
|
|
13
13
|
*
|
|
14
14
|
* ```ts
|
|
15
15
|
* import { DrftLoader } from '@driftengine/assets';
|
|
16
|
-
* import { spawnBcWorker } from '@driftengine/assets/
|
|
16
|
+
* import { spawnBcWorker } from '@driftengine/assets/bcWorkers';
|
|
17
17
|
*
|
|
18
18
|
* const loader = new DrftLoader(renderer, { bcWorker: spawnBcWorker });
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
|
+
* **A declared subpath, so it resolves the way the barrel does**: to the build by default and to
|
|
22
|
+
* this file under `drift-source`. The path into `src/` that 4.8.7 documented still resolves, through
|
|
23
|
+
* the manifest's `./*` passthrough, and hands every consumer TypeScript inside `node_modules`, which
|
|
24
|
+
* is the default the 2026-09-13 flip took away from the barrels; a resolver that maps a package's
|
|
25
|
+
* subpaths into `src/` also doubled it, to `src/src/bcWorkers.ts`.
|
|
26
|
+
*
|
|
21
27
|
* Without it BC textures decode on the main thread, and the loader says so once. **What that costs**
|
|
22
28
|
* is the decode of a texture the device cannot take as blocks, which on a phone is every BC texture:
|
|
23
29
|
* a 2048² BC7 image is 262,144 blocks.
|
package/src/drftLoader.ts
CHANGED
|
@@ -84,7 +84,7 @@ export interface DrftLoaderOptions {
|
|
|
84
84
|
readonly fetchImpl?: FetchLike;
|
|
85
85
|
/**
|
|
86
86
|
* What starts the worker a BC texture the device cannot take as blocks is decoded in:
|
|
87
|
-
* `spawnBcWorker`, from `@driftengine/assets/
|
|
87
|
+
* `spawnBcWorker`, from `@driftengine/assets/bcWorkers`. Absent, they decode on the main
|
|
88
88
|
* thread and the loader says so once — the factory is behind its own specifier so a consumer that
|
|
89
89
|
* never names it has no worker in its build. See `bcWorkers.ts`.
|
|
90
90
|
*/
|