-
-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathdeclarations.js
More file actions
86 lines (83 loc) · 2.96 KB
/
declarations.js
File metadata and controls
86 lines (83 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import * as fs from 'node:fs';
import * as path from 'node:path';
import { argv } from 'node:process';
const files = [
'materials/nodes/manager/NodeMaterialObserver',
'nodes/accessors/BufferAttributeNode',
'nodes/core/constants',
'nodes/core/Node',
'nodes/core/NodeAttribute',
'nodes/core/NodeCache',
'nodes/core/NodeParser',
'nodes/core/NodeUniform',
'nodes/core/NodeVar',
'nodes/core/NodeVarying',
'nodes/core/StructType',
'nodes/core/StructTypeNode',
'nodes/core/UniformNode',
'renderers/common/nodes/NodeBuilderState',
'renderers/common/nodes/NodeLibrary',
'renderers/common/nodes/NodeManager',
'renderers/common/nodes/NodeUniform',
'renderers/common/nodes/NodeUniformsGroup',
'renderers/common/Animation',
'renderers/common/Attributes',
'renderers/common/Background',
'renderers/common/BindGroup',
'renderers/common/Binding',
'renderers/common/Bindings',
'renderers/common/Buffer',
'renderers/common/BufferUtils',
'renderers/common/BundleGroup',
'renderers/common/CanvasTarget',
'renderers/common/ChainMap',
'renderers/common/ClippingContext',
'renderers/common/Color4',
'renderers/common/ComputePipeline',
'renderers/common/Constants',
'renderers/common/CubeRenderTarget',
'renderers/common/DataMap',
'renderers/common/Geometries',
'renderers/common/Info',
'renderers/common/InspectorBase',
'renderers/common/Pipeline',
'renderers/common/Pipelines',
'renderers/common/ProgrammableStage',
'renderers/common/RenderBundle',
'renderers/common/RenderBundles',
'renderers/common/RenderContext',
'renderers/common/RenderContexts',
'renderers/common/Renderer',
'renderers/common/RenderList',
'renderers/common/RenderLists',
'renderers/common/RenderObject',
'renderers/common/RenderObjects',
'renderers/common/RenderPipeline',
'renderers/common/Textures',
'renderers/common/TimestampQueryPool',
'renderers/common/Uniform',
'renderers/common/UniformBuffer',
'renderers/common/UniformsGroup',
'renderers/common/XRManager',
'renderers/common/XRRenderTarget',
'renderers/webgpu/nodes/BasicNodeLibrary',
'renderers/webgpu/nodes/StandardNodeLibrary',
];
const inDir = './src';
const outDir = '../types/three/src';
for (const file of files) {
console.log(file);
const fileContents = fs.readFileSync(path.join(inDir, `${file}.d.ts`), { encoding: 'utf-8' });
const outFile = path.join(outDir, `${file}.d.ts`);
if (argv[2] === 'copy') {
fs.mkdirSync(path.dirname(outFile), { recursive: true });
fs.writeFileSync(outFile, fileContents);
} else if (argv[2] === 'check') {
const outFileContents = fs.readFileSync(outFile, { encoding: 'utf-8' });
if (fileContents !== outFileContents) {
throw new Error(`The built declaration file for ${file} differs.`);
}
} else {
throw new Error('Expected program argument.');
}
}