@null3d/vite-plugin 0.1.0 → 0.1.1
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 +8 -1
- package/dist/shader-compiler.stamp.json +1 -1
- package/dist/shader-compiler.wasm +0 -0
- package/lib/assets.d.ts +3 -3
- package/lib/assets.js +3 -3
- package/lib/engine-shaders.d.ts +4 -2
- package/lib/engine-shaders.js +34 -7
- package/lib/hash-pool.d.ts +12 -0
- package/lib/hash-pool.js +17 -4
- package/lib/hash-worker.js +32 -9
- package/lib/hot.d.ts +12 -2
- package/lib/hot.js +25 -4
- package/lib/index.d.ts +9 -0
- package/lib/index.js +185 -43
- package/lib/material-builds.d.ts +2 -0
- package/lib/material-builds.js +2 -0
- package/lib/paragraphs.d.ts +9 -3
- package/lib/paragraphs.js +25 -11
- package/lib/shader-list.d.ts +127 -0
- package/lib/shader-list.js +352 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -43,7 +43,8 @@ of `.wgsl` and `?optimized` imports, add `@null3d/vite-plugin/client` to the `ty
|
|
|
43
43
|
`@null3d/cli` on the glTF model. The import gives the optimized model's address for
|
|
44
44
|
`assets.loadGltf`. Add the tool with `bun add -d @null3d/cli`.
|
|
45
45
|
- A production build compiles the sketch file for its worker, ships the engine's WebAssembly
|
|
46
|
-
core and drops the engine's development checks.
|
|
46
|
+
core and drops the engine's development checks. It copies the engine's compiled shader files
|
|
47
|
+
beside the page: all of them, or only the builds that the `shaders.list` option names. Each built page that loads the engine gets a
|
|
47
48
|
small script that starts the core's download at once. The build also writes the third-party
|
|
48
49
|
notices and a list of its files (`null3d-files.json`) for offline play.
|
|
49
50
|
|
|
@@ -51,6 +52,7 @@ of `.wgsl` and `?optimized` imports, add `@null3d/vite-plugin/client` to the `ty
|
|
|
51
52
|
|
|
52
53
|
```ts
|
|
53
54
|
null3d({ https: true, certDir: 'certs', assets: { lod: true, maxTextureSize: 1024 } });
|
|
55
|
+
null3d({ shaders: { list: 'shader-permutations.txt' } });
|
|
54
56
|
```
|
|
55
57
|
|
|
56
58
|
- `https` serves HTTPS on your local network, from both `vite` and `vite preview`. A phone or
|
|
@@ -63,6 +65,11 @@ null3d({ https: true, certDir: 'certs', assets: { lod: true, maxTextureSize: 102
|
|
|
63
65
|
its uniforms. It is on by default. Set it to false in a project without TypeScript.
|
|
64
66
|
- `assets` takes the asset tool's options for `?optimized` models, such as `lod`, `simplify` and
|
|
65
67
|
`maxTextureSize`.
|
|
68
|
+
- `shaders.list` names a list of the shader permutation words that the project's pages draw with,
|
|
69
|
+
relative to Vite's root. `bunx @null3d/cli shaders record` writes it. A production build then
|
|
70
|
+
copies only the builds of the listed words, and fails when the engine's shader set lacks a listed
|
|
71
|
+
word. Without it, a build copies the whole set, thousands of files and gigabytes, and warns with
|
|
72
|
+
the size that it copied.
|
|
66
73
|
- `urlSwitches` lets the page's address set the engine's test switches, such as `?gpu=`, in a
|
|
67
74
|
production build too. Leave it out for a shipped game. Development builds then read the
|
|
68
75
|
switches and production builds do not, so a link cannot change how the game runs. An explicit
|
|
Binary file
|
package/lib/assets.d.ts
CHANGED
|
@@ -68,9 +68,9 @@ export declare function modelKey(identity: string, options: object, files: reado
|
|
|
68
68
|
/**
|
|
69
69
|
* What the asset tool is: the version it reports and a hash of its own code, which is the module the
|
|
70
70
|
* plugin loads and the files that share its name, the WebAssembly file among them. The version alone
|
|
71
|
-
* is not enough, because it
|
|
72
|
-
* model encodes to without changing the key, and the cache would keep serving models that the
|
|
73
|
-
* wrote before the fix (code review H-17). A tool whose files cannot be read falls back to the
|
|
71
|
+
* is not enough, because it changes only at a release: a fix to the tool between releases can change
|
|
72
|
+
* what a model encodes to without changing the key, and the cache would keep serving models that the
|
|
73
|
+
* tool wrote before the fix (code review H-17). A tool whose files cannot be read falls back to the
|
|
74
74
|
* version it reports.
|
|
75
75
|
*/
|
|
76
76
|
export declare function toolIdentity(version: string): string;
|
package/lib/assets.js
CHANGED
|
@@ -49,9 +49,9 @@ export function modelKey(identity, options, files) {
|
|
|
49
49
|
/**
|
|
50
50
|
* What the asset tool is: the version it reports and a hash of its own code, which is the module the
|
|
51
51
|
* plugin loads and the files that share its name, the WebAssembly file among them. The version alone
|
|
52
|
-
* is not enough, because it
|
|
53
|
-
* model encodes to without changing the key, and the cache would keep serving models that the
|
|
54
|
-
* wrote before the fix (code review H-17). A tool whose files cannot be read falls back to the
|
|
52
|
+
* is not enough, because it changes only at a release: a fix to the tool between releases can change
|
|
53
|
+
* what a model encodes to without changing the key, and the cache would keep serving models that the
|
|
54
|
+
* tool wrote before the fix (code review H-17). A tool whose files cannot be read falls back to the
|
|
55
55
|
* version it reports.
|
|
56
56
|
*/
|
|
57
57
|
export function toolIdentity(version) {
|
package/lib/engine-shaders.d.ts
CHANGED
|
@@ -55,7 +55,9 @@ export interface TarEntry {
|
|
|
55
55
|
readonly directory: boolean;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* The entries of a tar archive, in its order. The reader takes the ustar form, with
|
|
59
|
-
*
|
|
58
|
+
* The entries of a tar archive, in its order. The reader takes the ustar form, with a long path in
|
|
59
|
+
* the prefix field. A name over 100 bytes comes in an entry of its own before its file's header:
|
|
60
|
+
* GNU's long-name entry, which the release's archive writes, or a pax header's `path`. Without
|
|
61
|
+
* them, every file whose name passes 100 bytes would take its name cut short.
|
|
60
62
|
*/
|
|
61
63
|
export declare function tarEntries(tar: Buffer): Generator<TarEntry>;
|
package/lib/engine-shaders.js
CHANGED
|
@@ -20,8 +20,11 @@ export function engineShadersRoot() {
|
|
|
20
20
|
* checkout that has them, and CI's package test, need neither the download nor a build.
|
|
21
21
|
*/
|
|
22
22
|
export const ENGINE_SHADERS_ENV = 'NULL3D_ENGINE_SHADERS';
|
|
23
|
-
/**
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The record of a set that a project may use. Its name carries the version of the archive reader,
|
|
25
|
+
* so a set that another version of the reader unpacked is downloaded and unpacked again.
|
|
26
|
+
*/
|
|
27
|
+
const MARKER = '.complete-2';
|
|
25
28
|
/** The answer for each engine package, so the download and the build happen once per build. */
|
|
26
29
|
const folders = new Map();
|
|
27
30
|
/**
|
|
@@ -141,11 +144,15 @@ function text(header, offset, length) {
|
|
|
141
144
|
return field.subarray(0, end < 0 ? field.length : end).toString('utf8');
|
|
142
145
|
}
|
|
143
146
|
/**
|
|
144
|
-
* The entries of a tar archive, in its order. The reader takes the ustar form, with
|
|
145
|
-
*
|
|
147
|
+
* The entries of a tar archive, in its order. The reader takes the ustar form, with a long path in
|
|
148
|
+
* the prefix field. A name over 100 bytes comes in an entry of its own before its file's header:
|
|
149
|
+
* GNU's long-name entry, which the release's archive writes, or a pax header's `path`. Without
|
|
150
|
+
* them, every file whose name passes 100 bytes would take its name cut short.
|
|
146
151
|
*/
|
|
147
152
|
export function* tarEntries(tar) {
|
|
148
153
|
let at = 0;
|
|
154
|
+
/** The name that a long-name entry gives the entry after it. */
|
|
155
|
+
let longName;
|
|
149
156
|
while (at + BLOCK <= tar.length) {
|
|
150
157
|
const header = tar.subarray(at, at + BLOCK);
|
|
151
158
|
// Two zero blocks end an archive; a block that cannot hold a name ends it too.
|
|
@@ -162,9 +169,29 @@ export function* tarEntries(tar) {
|
|
|
162
169
|
const end = start + size;
|
|
163
170
|
if (end > tar.length)
|
|
164
171
|
throw new Error(`the archive ends inside ${full}`);
|
|
165
|
-
const
|
|
172
|
+
const next = end + ((BLOCK - (size % BLOCK)) % BLOCK);
|
|
173
|
+
if (type === 'L' || type === 'x') {
|
|
174
|
+
const data = tar.subarray(start, end).toString('utf8');
|
|
175
|
+
const path = type === 'L' ? data.replace(/\0.*$/s, '') : paxPath(data);
|
|
176
|
+
if (path !== undefined)
|
|
177
|
+
longName = path;
|
|
178
|
+
at = next;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
const named = longName ?? full;
|
|
182
|
+
longName = undefined;
|
|
183
|
+
const directory = type === '5' || named.endsWith('/');
|
|
166
184
|
const bytes = directory ? Buffer.alloc(0) : tar.subarray(start, end);
|
|
167
|
-
yield { name:
|
|
168
|
-
at =
|
|
185
|
+
yield { name: named.replace(/^\.\//, '').replace(/\/$/, ''), bytes, directory };
|
|
186
|
+
at = next;
|
|
169
187
|
}
|
|
170
188
|
}
|
|
189
|
+
/** The `path` record of a pax header's data, whose records each read `<length> <key>=<value>\n`. */
|
|
190
|
+
function paxPath(data) {
|
|
191
|
+
for (const record of data.split('\n')) {
|
|
192
|
+
const match = /^\d+ path=(.*)$/s.exec(record);
|
|
193
|
+
if (match)
|
|
194
|
+
return match[1];
|
|
195
|
+
}
|
|
196
|
+
return undefined;
|
|
197
|
+
}
|
package/lib/hash-pool.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/** The workers of a pool by default: one for each core but one, at most `MOST_WORKERS`. */
|
|
2
2
|
export declare function defaultHashWorkers(): number;
|
|
3
|
+
/** What a scan of a file gives: its hash, and the permutation word of each build that it holds. */
|
|
4
|
+
export interface Scanned {
|
|
5
|
+
readonly hash: string;
|
|
6
|
+
readonly words: readonly number[];
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* Hashes files on worker threads, which start at the first file. An idle worker does not keep the
|
|
5
10
|
* process alive, so a build ends without `close`.
|
|
@@ -16,6 +21,13 @@ export declare class HashPool {
|
|
|
16
21
|
* read raised.
|
|
17
22
|
*/
|
|
18
23
|
hash(file: string): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* The file's hash, as `hash` gives it, and the permutation word of each build that the file
|
|
26
|
+
* holds, from each line of the form that the shader build writes.
|
|
27
|
+
*/
|
|
28
|
+
scan(file: string): Promise<Scanned>;
|
|
29
|
+
/** Sends one file to the worker with the fewest files waiting, and gives its answer. */
|
|
30
|
+
private read;
|
|
19
31
|
/** Stops every worker. A later hash starts them again. */
|
|
20
32
|
close(): Promise<void>;
|
|
21
33
|
/** The worker with the fewest files waiting, or a new one while there is room. */
|
package/lib/hash-pool.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// copies by a hash of the file, and the engine's set alone is thousands of files and gigabytes
|
|
3
3
|
// together: on the build's own thread that pass holds up module loading. The pool splits the files
|
|
4
4
|
// across a few workers, each of which reads its file in chunks, so the build hashes many files at
|
|
5
|
-
// once and keeps none of their bytes.
|
|
5
|
+
// once and keeps none of their bytes. A scan gives the permutation words of a file's builds as well,
|
|
6
|
+
// from the same read, for a build that narrows the set to a project's list.
|
|
6
7
|
import { availableParallelism } from 'node:os';
|
|
7
8
|
import { Worker } from 'node:worker_threads';
|
|
8
9
|
/** The most workers a pool starts, where a wider pool read no faster. */
|
|
@@ -28,13 +29,25 @@ export class HashPool {
|
|
|
28
29
|
* the whole file's bytes gives. A file that cannot be read rejects with the failure that the
|
|
29
30
|
* read raised.
|
|
30
31
|
*/
|
|
31
|
-
hash(file) {
|
|
32
|
+
async hash(file) {
|
|
33
|
+
return (await this.read(file, false)).hash;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The file's hash, as `hash` gives it, and the permutation word of each build that the file
|
|
37
|
+
* holds, from each line of the form that the shader build writes.
|
|
38
|
+
*/
|
|
39
|
+
async scan(file) {
|
|
40
|
+
const { hash, words = [] } = await this.read(file, true);
|
|
41
|
+
return { hash, words };
|
|
42
|
+
}
|
|
43
|
+
/** Sends one file to the worker with the fewest files waiting, and gives its answer. */
|
|
44
|
+
read(file, scan) {
|
|
32
45
|
const worker = this.pick();
|
|
33
46
|
const id = this.nextId++;
|
|
34
47
|
const { thread, waiting } = worker;
|
|
35
48
|
const answer = new Promise((resolve, reject) => waiting.set(id, { resolve, reject }));
|
|
36
49
|
thread.ref();
|
|
37
|
-
thread.postMessage({ id, file });
|
|
50
|
+
thread.postMessage({ id, file, scan });
|
|
38
51
|
return answer;
|
|
39
52
|
}
|
|
40
53
|
/** Stops every worker. A later hash starts them again. */
|
|
@@ -61,7 +74,7 @@ export class HashPool {
|
|
|
61
74
|
call.reject(Object.assign(new Error(answer.error?.message ?? ''), answer.error));
|
|
62
75
|
}
|
|
63
76
|
else
|
|
64
|
-
call.resolve(answer
|
|
77
|
+
call.resolve(answer);
|
|
65
78
|
if (worker.waiting.size === 0)
|
|
66
79
|
thread.unref();
|
|
67
80
|
});
|
package/lib/hash-worker.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// own and answers with the prefix of the file's SHA-256, so the build hashes many files at once and
|
|
3
3
|
// the page's thread reads no file and keeps none of their bytes. The buffer is reused for every
|
|
4
4
|
// file, so a worker holds no whole file and its memory does not grow with the number of files. The
|
|
5
|
-
// worker imports only Node's own modules, so the plugin runs under Node as well as Bun.
|
|
5
|
+
// worker imports only Node's own modules, so the plugin runs under Node as well as Bun. Asked to
|
|
6
|
+
// scan, it also gives the permutation word of each build that the file holds, from the same read.
|
|
6
7
|
import { createHash } from 'node:crypto';
|
|
7
8
|
import { open } from 'node:fs/promises';
|
|
8
9
|
import { parentPort } from 'node:worker_threads';
|
|
@@ -13,18 +14,40 @@ const CHUNK = 64 * 1024;
|
|
|
13
14
|
const chunk = Buffer.allocUnsafe(CHUNK);
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* bytes, whatever the chunks are.
|
|
17
|
+
* A line of a generated shader module that holds a build's permutation word: the same lines that
|
|
18
|
+
* `PERMUTATION_LINE` in `shader-list.ts` reads.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
const PERMUTATION_LINE = /^\t*permutation: (\d+),$/gm;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The first eight hexadecimal digits of the file's SHA-256, which is how a copied shader file's
|
|
24
|
+
* name carries its content, and, when `scan` is set, the permutation word of each build that the
|
|
25
|
+
* file holds. The digest is the same as a hash of the whole file's bytes, whatever the chunks are.
|
|
26
|
+
* A line that two chunks split is read whole, from the text left after the last line break.
|
|
27
|
+
*/
|
|
28
|
+
async function readFile(file, scan) {
|
|
21
29
|
const handle = await open(file, 'r');
|
|
22
30
|
try {
|
|
23
31
|
const hash = createHash('sha256');
|
|
32
|
+
const words = new Set();
|
|
33
|
+
const decoder = new TextDecoder();
|
|
34
|
+
let rest = '';
|
|
35
|
+
const lines = (text) => {
|
|
36
|
+
for (const match of text.matchAll(PERMUTATION_LINE)) words.add(Number(match[1]));
|
|
37
|
+
};
|
|
24
38
|
for (;;) {
|
|
25
39
|
const { bytesRead } = await handle.read(chunk, 0, CHUNK, null);
|
|
26
|
-
if (bytesRead === 0)
|
|
27
|
-
|
|
40
|
+
if (bytesRead === 0) {
|
|
41
|
+
if (scan) lines(rest + decoder.decode());
|
|
42
|
+
return { hash: hash.digest('hex').slice(0, 8), words: scan ? [...words] : undefined };
|
|
43
|
+
}
|
|
44
|
+
const bytes = chunk.subarray(0, bytesRead);
|
|
45
|
+
hash.update(bytes);
|
|
46
|
+
if (!scan) continue;
|
|
47
|
+
const text = rest + decoder.decode(bytes, { stream: true });
|
|
48
|
+
const end = text.lastIndexOf('\n');
|
|
49
|
+
lines(text.slice(0, end + 1));
|
|
50
|
+
rest = text.slice(end + 1);
|
|
28
51
|
}
|
|
29
52
|
} finally {
|
|
30
53
|
await handle.close();
|
|
@@ -32,9 +55,9 @@ async function hashFile(file) {
|
|
|
32
55
|
}
|
|
33
56
|
|
|
34
57
|
/** Answers one request with its file's hash, or with the failure that reading it raised. */
|
|
35
|
-
async function answer({ id, file }) {
|
|
58
|
+
async function answer({ id, file, scan }) {
|
|
36
59
|
try {
|
|
37
|
-
parentPort?.postMessage({ id,
|
|
60
|
+
parentPort?.postMessage({ id, ...(await readFile(file, scan === true)) });
|
|
38
61
|
} catch (error) {
|
|
39
62
|
// The pool raises the failure on the build's thread, which fails the build as a direct read
|
|
40
63
|
// does. The code lets a caller tell a vanished file from a worker that stopped.
|
package/lib/hot.d.ts
CHANGED
|
@@ -8,8 +8,18 @@ export declare const HOT_CLIENT = "virtual:null3d/hot";
|
|
|
8
8
|
export declare const HOT_CLIENT_ID = "\0virtual:null3d/hot";
|
|
9
9
|
/** The hot client's name or its module id, as Vite's hook filters match them. */
|
|
10
10
|
export declare const HOT_CLIENT_ADDRESS: RegExp;
|
|
11
|
-
/** The
|
|
12
|
-
export declare const
|
|
11
|
+
/** The event that carries a permutation word that a page draws with, from the page to the server. */
|
|
12
|
+
export declare const PERMUTATION_WORD_EVENT = "null3d:permutation";
|
|
13
|
+
/** The event that carries the dev server's warning about a word that the project's list lacks. */
|
|
14
|
+
export declare const UNLISTED_WORD_EVENT = "null3d:unlisted";
|
|
15
|
+
/**
|
|
16
|
+
* The hot client's code. It also closes Vite's overlay, which may show an earlier WGSL error. In a
|
|
17
|
+
* project with a shader list (`listed`), it also sends the dev server each permutation word that
|
|
18
|
+
* the page's engines draw with, once, and shows the server's warning about a word that the list
|
|
19
|
+
* lacks in the browser's console. A recording run adds its page's words to the list, so it sends
|
|
20
|
+
* none.
|
|
21
|
+
*/
|
|
22
|
+
export declare function hotClientCode(listed: boolean): string;
|
|
13
23
|
/** One hot update: the new compiled WGSL under its key. */
|
|
14
24
|
export interface WgslUpdate {
|
|
15
25
|
readonly key: string;
|
package/lib/hot.js
CHANGED
|
@@ -7,15 +7,36 @@ export const HOT_CLIENT = 'virtual:null3d/hot';
|
|
|
7
7
|
export const HOT_CLIENT_ID = `\0${HOT_CLIENT}`;
|
|
8
8
|
/** The hot client's name or its module id, as Vite's hook filters match them. */
|
|
9
9
|
export const HOT_CLIENT_ADDRESS = /^\0?virtual:null3d\/hot$/;
|
|
10
|
-
/** The
|
|
11
|
-
export const
|
|
12
|
-
|
|
10
|
+
/** The event that carries a permutation word that a page draws with, from the page to the server. */
|
|
11
|
+
export const PERMUTATION_WORD_EVENT = 'null3d:permutation';
|
|
12
|
+
/** The event that carries the dev server's warning about a word that the project's list lacks. */
|
|
13
|
+
export const UNLISTED_WORD_EVENT = 'null3d:unlisted';
|
|
14
|
+
/**
|
|
15
|
+
* The hot client's code. It also closes Vite's overlay, which may show an earlier WGSL error. In a
|
|
16
|
+
* project with a shader list (`listed`), it also sends the dev server each permutation word that
|
|
17
|
+
* the page's engines draw with, once, and shows the server's warning about a word that the list
|
|
18
|
+
* lacks in the browser's console. A recording run adds its page's words to the list, so it sends
|
|
19
|
+
* none.
|
|
20
|
+
*/
|
|
21
|
+
export function hotClientCode(listed) {
|
|
22
|
+
const wgsl = ` import.meta.hot.on(${JSON.stringify(WGSL_UPDATE_EVENT)}, ({ updates }) => {
|
|
13
23
|
for (const overlay of document.querySelectorAll('vite-error-overlay')) overlay.close();
|
|
14
24
|
globalThis.dispatchEvent(new CustomEvent(${JSON.stringify(WGSL_UPDATE_EVENT)}, { detail: updates }));
|
|
15
25
|
console.debug('[null3D] hot updated: ' + updates.map((update) => update.key).join(', '));
|
|
16
26
|
});
|
|
17
|
-
}
|
|
18
27
|
`;
|
|
28
|
+
const words = ` if (new URLSearchParams(location.search).get('permutations') !== 'record') {
|
|
29
|
+
const sent = new Set();
|
|
30
|
+
globalThis.addEventListener(${JSON.stringify(PERMUTATION_WORD_EVENT)}, ({ detail: word }) => {
|
|
31
|
+
if (sent.has(word)) return;
|
|
32
|
+
sent.add(word);
|
|
33
|
+
import.meta.hot.send(${JSON.stringify(PERMUTATION_WORD_EVENT)}, { word, page: location.pathname });
|
|
34
|
+
});
|
|
35
|
+
import.meta.hot.on(${JSON.stringify(UNLISTED_WORD_EVENT)}, ({ message }) => console.warn('[null3D] ' + message));
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
return `if (import.meta.hot) {\n${wgsl}${listed ? words : ''}}\n`;
|
|
39
|
+
}
|
|
19
40
|
/**
|
|
20
41
|
* The key of a project's WGSL: a `.wgsl` file's path from the project's root, or that of a script
|
|
21
42
|
* with the place of a tagged literal among the script's literals, from 0.
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Connect, HtmlTagDescriptor, Plugin, Rollup } from 'vite';
|
|
2
2
|
import { type AssetOptions } from './assets.js';
|
|
3
|
+
import { type ShaderOptions } from './shader-list.js';
|
|
3
4
|
export type { AssetOptions } from './assets.js';
|
|
4
5
|
export { FILES_LIST, type OfflineFiles } from './offline.js';
|
|
6
|
+
export type { ShaderOptions } from './shader-list.js';
|
|
5
7
|
export type * from './shader-types.js';
|
|
6
8
|
/** Headers that make a page cross-origin isolated, which shared memory and worker threads need. */
|
|
7
9
|
export declare const ISOLATION_HEADERS: Readonly<Record<string, string>>;
|
|
@@ -42,6 +44,13 @@ export interface Null3dPluginOptions {
|
|
|
42
44
|
* test and benchmark pages.
|
|
43
45
|
*/
|
|
44
46
|
urlSwitches?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Options for the engine's shader set. `list` names the file of the permutation words that the
|
|
49
|
+
* project's pages draw with, as `bunx @null3d/cli shaders record` writes it, relative to Vite's
|
|
50
|
+
* root. A production build then copies only the shader builds of those words. The dev server
|
|
51
|
+
* warns about each word that a page draws with and the list lacks.
|
|
52
|
+
*/
|
|
53
|
+
shaders?: ShaderOptions;
|
|
45
54
|
}
|
|
46
55
|
/** Sets the isolation headers on every response, including `.wasm` files and worker scripts. */
|
|
47
56
|
export declare const isolationMiddleware: Connect.NextHandleFunction;
|