@needle-tools/gltf-build-pipeline 2.2.1-alpha.2 → 2.2.1-alpha.3

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.
Files changed (104) hide show
  1. package/.temp/Go2.bin +0 -0
  2. package/.temp/textures/0_1.exr +0 -0
  3. package/.temp/textures/1_1.jpg +0 -0
  4. package/CHANGELOG.md +395 -394
  5. package/README.md +35 -35
  6. package/dist/cache/cache.d.ts +54 -54
  7. package/dist/cache/cache.js +257 -257
  8. package/dist/cache/index.d.ts +1 -1
  9. package/dist/cache/index.js +1 -1
  10. package/dist/cli/index.d.ts +2 -2
  11. package/dist/cli/index.js +154 -154
  12. package/dist/config/index.d.ts +53 -53
  13. package/dist/config/index.js +152 -152
  14. package/dist/constants.d.ts +5 -5
  15. package/dist/constants.js +5 -5
  16. package/dist/extensions/NEEDLE_compression_texture/NEEDLE_compression_texture.d.ts +24 -24
  17. package/dist/extensions/NEEDLE_compression_texture/NEEDLE_compression_texture.js +54 -54
  18. package/dist/extensions/NEEDLE_compression_texture/index.d.ts +1 -1
  19. package/dist/extensions/NEEDLE_compression_texture/index.js +1 -1
  20. package/dist/extensions/NEEDLE_mesh_compression/NEEDLE_mesh_compression.d.ts +26 -26
  21. package/dist/extensions/NEEDLE_mesh_compression/NEEDLE_mesh_compression.js +85 -85
  22. package/dist/extensions/NEEDLE_mesh_compression/index.d.ts +1 -1
  23. package/dist/extensions/NEEDLE_mesh_compression/index.js +1 -1
  24. package/dist/extensions/NEEDLE_opaque/NEEDLE_opaque.d.ts +27 -27
  25. package/dist/extensions/NEEDLE_opaque/NEEDLE_opaque.js +897 -897
  26. package/dist/extensions/NEEDLE_opaque/index.d.ts +3 -3
  27. package/dist/extensions/NEEDLE_opaque/index.js +28 -28
  28. package/dist/extensions/NEEDLE_progressive/NEEDLE_progressive.d.ts +48 -48
  29. package/dist/extensions/NEEDLE_progressive/NEEDLE_progressive.js +69 -69
  30. package/dist/extensions/NEEDLE_progressive/index.d.ts +1 -1
  31. package/dist/extensions/NEEDLE_progressive/index.js +1 -1
  32. package/dist/extensions/NEEDLE_progressive_mesh_settings/index.d.ts +23 -23
  33. package/dist/extensions/NEEDLE_progressive_mesh_settings/index.js +41 -41
  34. package/dist/extensions/NEEDLE_progressive_texture_settings/index.d.ts +25 -25
  35. package/dist/extensions/NEEDLE_progressive_texture_settings/index.js +67 -67
  36. package/dist/extensions/index.d.ts +7 -7
  37. package/dist/extensions/index.js +17 -17
  38. package/dist/extensions/utils.d.ts +6 -6
  39. package/dist/extensions/utils.js +72 -72
  40. package/dist/functions/weld.3.d.ts +76 -76
  41. package/dist/functions/weld.3.js +414 -414
  42. package/dist/index.d.ts +8 -8
  43. package/dist/index.js +8 -8
  44. package/dist/scripts/index.d.ts +2 -2
  45. package/dist/scripts/index.js +2 -2
  46. package/dist/scripts/pack-gltf.d.ts +16 -16
  47. package/dist/scripts/pack-gltf.js +120 -120
  48. package/dist/scripts/stats.d.ts +2 -2
  49. package/dist/scripts/stats.js +18 -18
  50. package/dist/transforms/index.d.ts +9 -9
  51. package/dist/transforms/index.js +9 -9
  52. package/dist/transforms/needle_animation_transform.d.ts +2 -2
  53. package/dist/transforms/needle_animation_transform.js +5 -5
  54. package/dist/transforms/needle_asset.d.ts +3 -3
  55. package/dist/transforms/needle_asset.js +35 -35
  56. package/dist/transforms/needle_common.d.ts +16 -16
  57. package/dist/transforms/needle_common.js +1 -1
  58. package/dist/transforms/needle_mesh_transform.d.ts +10 -10
  59. package/dist/transforms/needle_mesh_transform.js +140 -140
  60. package/dist/transforms/needle_progressive.d.ts +42 -42
  61. package/dist/transforms/needle_progressive.js +921 -921
  62. package/dist/transforms/needle_texture_transform.d.ts +13 -13
  63. package/dist/transforms/needle_texture_transform.js +202 -196
  64. package/dist/transforms/needle_toktx.d.ts +25 -25
  65. package/dist/transforms/needle_toktx.js +230 -230
  66. package/dist/transforms/needle_webp.d.ts +13 -13
  67. package/dist/transforms/needle_webp.js +37 -37
  68. package/dist/transforms/toktx.d.ts +52 -52
  69. package/dist/transforms/toktx.js +221 -221
  70. package/dist/transforms/toktx_types.d.ts +78 -78
  71. package/dist/transforms/toktx_types.js +62 -62
  72. package/dist/transforms/util.d.ts +21 -21
  73. package/dist/transforms/util.js +90 -90
  74. package/dist/utils/compression_utils.d.ts +2 -2
  75. package/dist/utils/compression_utils.js +6 -6
  76. package/dist/utils/fileutils.d.ts +6 -6
  77. package/dist/utils/fileutils.js +141 -141
  78. package/dist/utils/guid.d.ts +1 -1
  79. package/dist/utils/guid.js +5 -5
  80. package/dist/utils/index.d.ts +10 -9
  81. package/dist/utils/index.js +10 -9
  82. package/dist/utils/merge.d.ts +12 -12
  83. package/dist/utils/merge.js +31 -31
  84. package/dist/utils/mesh.d.ts +13 -13
  85. package/dist/utils/mesh.js +107 -107
  86. package/dist/utils/nodeio.d.ts +5 -5
  87. package/dist/utils/nodeio.js +14 -14
  88. package/dist/utils/stats.d.ts +54 -53
  89. package/dist/utils/stats.js +191 -166
  90. package/dist/utils/texture.d.ts +2 -2
  91. package/dist/utils/texture.js +8 -8
  92. package/dist/utils/validate.d.ts +5 -0
  93. package/dist/utils/validate.js +16 -0
  94. package/dist/utils/version.d.ts +1 -1
  95. package/dist/utils/version.js +5 -5
  96. package/package.json +77 -76
  97. package/scripts/clear-caches.mjs +3 -3
  98. package/scripts/defaults.mjs +11 -11
  99. package/scripts/fileutils.mjs +5 -5
  100. package/scripts/index.mjs +41 -41
  101. package/scripts/limit-caches.mjs +3 -3
  102. package/scripts/make-progressive.mjs +16 -16
  103. package/scripts/pack-gltf.mjs +107 -107
  104. package/tsconfig.json +19 -19
@@ -1,166 +1,191 @@
1
- import { getVersion } from "./version.js";
2
- import { Document, ImageUtils } from "@gltf-transform/core";
3
- import { getFileName } from "./fileutils.js";
4
- import { statSync, writeFileSync } from "fs";
5
- export function printStats(stats, logger, config) {
6
- const duration = Date.now() - stats.startTime;
7
- const durationInMinutes = duration / 1000 / 60;
8
- const msg = `[Needle Build Pipeline] v${getVersion()} — Finished compression \"${config?.usecase}\" of ${stats.totalFilesProcessed} files in ${durationInMinutes.toFixed(1)} minutes; total size ${stats.totalFileSizeInMBBefore.toFixed(1)} MB → ${stats.totalFileSizeInMB.toFixed(1)} MB, total GPU memory: ${stats.totalGPUMemoryInMB.toFixed(1)} MB`;
9
- if (logger)
10
- logger.info(msg);
11
- else
12
- console.log(msg);
13
- }
14
- class Stats {
15
- /** Size in bytes */
16
- size;
17
- asset;
18
- nodes;
19
- materials;
20
- meshes;
21
- textures;
22
- constructor(document, size) {
23
- const root = document.getRoot();
24
- const asset = root.getAsset();
25
- this.asset = {
26
- generator: asset.generator,
27
- version: asset.version,
28
- copyright: asset.copyright,
29
- extras: asset.extras,
30
- };
31
- this.size = size;
32
- this.nodes = root.listNodes().length;
33
- this.materials = root.listMaterials().length;
34
- this.meshes = calculateMeshInfo(document);
35
- this.textures = calculateTextureInfo(document);
36
- }
37
- static combine(others) {
38
- const res = new Stats(new Document(), 0);
39
- for (const other of others) {
40
- res.size += other.size;
41
- res.nodes += other.nodes;
42
- res.materials += other.materials;
43
- res.meshes.addTo(other.meshes);
44
- res.textures.addTo(other.textures);
45
- }
46
- return res;
47
- }
48
- }
49
- export class FileStats extends Stats {
50
- filename;
51
- constructor(file, document) {
52
- super(document, statSync(file).size);
53
- this.filename = getFileName(file);
54
- }
55
- }
56
- export class MeshInfo {
57
- count = 0;
58
- primitives = 0;
59
- vertices = 0;
60
- triangles = 0;
61
- memory = 0;
62
- formats = [];
63
- addTo(other) {
64
- this.count += other.count;
65
- this.primitives += other.primitives;
66
- this.vertices += other.vertices;
67
- this.triangles += other.triangles;
68
- this.memory += other.memory;
69
- this.formats = Array.from(new Set(this.formats.concat(other.formats)));
70
- }
71
- }
72
- export class TextureInfo {
73
- count = 0;
74
- memory = 0;
75
- gpu_memory = 0;
76
- formats = [];
77
- addTo(other) {
78
- this.count += other.count;
79
- this.memory += other.memory;
80
- this.gpu_memory += other.gpu_memory;
81
- this.formats = Array.from(new Set(this.formats.concat(other.formats)));
82
- }
83
- }
84
- /**
85
- * Create a new filestats object from a file and a document
86
- */
87
- export function createNewFilestats(file, document) {
88
- const filestats = new FileStats(file, document);
89
- return filestats;
90
- }
91
- export function writeFileStatsToFile(filestats, output_path) {
92
- if (output_path == undefined) {
93
- console.error("No stats output path provided");
94
- return null;
95
- }
96
- const res = {
97
- summary: Stats.combine(filestats),
98
- files: filestats,
99
- };
100
- const json = JSON.stringify(res);
101
- writeFileSync(output_path, json);
102
- return json;
103
- }
104
- function calculateMeshInfo(document) {
105
- const root = document.getRoot();
106
- const meshes = root.listMeshes();
107
- const res = new MeshInfo();
108
- res.count = meshes.length;
109
- for (const mesh of root.listMeshes()) {
110
- const primitives = mesh.listPrimitives();
111
- res.primitives += primitives.length;
112
- for (const prim of primitives) {
113
- const positions = prim.getAttribute('POSITION');
114
- const indices = prim.getIndices();
115
- if (positions) {
116
- res.vertices += positions.getCount();
117
- }
118
- if (indices) {
119
- res.triangles += indices.getCount() / 3;
120
- }
121
- else {
122
- res.triangles += positions.getCount() / 3;
123
- }
124
- const semantics = prim.listSemantics();
125
- for (const semantic of semantics) {
126
- const accessor = prim.getAttribute(semantic);
127
- if (accessor) {
128
- const buffer = accessor.getByteLength();
129
- res.memory += buffer;
130
- }
131
- }
132
- }
133
- }
134
- const extensions = root.listExtensionsUsed();
135
- for (const ext of extensions) {
136
- if (ext.extensionName.startsWith("EXT_meshopt_compression")) {
137
- res.formats.push("meshopt");
138
- }
139
- else if (ext.extensionName.startsWith("KHR_draco_mesh_compression")) {
140
- res.formats.push("draco");
141
- }
142
- }
143
- // filter formats so we only have unique values
144
- res.formats = Array.from(new Set(res.formats));
145
- return res;
146
- }
147
- function calculateTextureInfo(document) {
148
- const root = document.getRoot();
149
- const textures = root.listTextures();
150
- const res = new TextureInfo();
151
- res.count = textures.length;
152
- res.formats = textures.map(t => t.getMimeType());
153
- res.gpu_memory = 0;
154
- res.memory = 0;
155
- for (const texture of textures) {
156
- const image = texture.getImage();
157
- const mimetype = texture.getMimeType();
158
- if (image && mimetype) {
159
- res.gpu_memory += ImageUtils.getVRAMByteLength(image, mimetype);
160
- res.memory += image.byteLength;
161
- }
162
- }
163
- // filter formats so we only have unique values
164
- res.formats = Array.from(new Set(res.formats));
165
- return res;
166
- }
1
+ import { getVersion } from "./version.js";
2
+ import { Document, ImageUtils } from "@gltf-transform/core";
3
+ import { getFileName } from "./fileutils.js";
4
+ import { statSync, writeFileSync } from "fs";
5
+ import { isLOD } from "../transforms/needle_progressive.js";
6
+ export function printStats(stats, logger, config) {
7
+ const duration = Date.now() - stats.startTime;
8
+ const durationInMinutes = duration / 1000 / 60;
9
+ const msg = `[Needle Build Pipeline] v${getVersion()} — Finished compression \"${config?.usecase}\" of ${stats.totalFilesProcessed} files in ${durationInMinutes.toFixed(1)} minutes; total size ${stats.totalFileSizeInMBBefore.toFixed(1)} MB → ${stats.totalFileSizeInMB.toFixed(1)} MB, total GPU memory: ${stats.totalGPUMemoryInMB.toFixed(1)} MB`;
10
+ if (logger)
11
+ logger.info(msg);
12
+ else
13
+ console.log(msg);
14
+ }
15
+ class Stats {
16
+ /** Size in bytes */
17
+ size;
18
+ asset;
19
+ nodes;
20
+ materials;
21
+ meshes;
22
+ textures;
23
+ constructor(document, size) {
24
+ const root = document.getRoot();
25
+ const asset = root.getAsset();
26
+ this.asset = {
27
+ generator: asset.generator,
28
+ version: asset.version,
29
+ copyright: asset.copyright,
30
+ extras: asset.extras,
31
+ };
32
+ this.size = size;
33
+ this.nodes = root.listNodes().length;
34
+ this.materials = root.listMaterials().length;
35
+ this.meshes = calculateMeshInfo(document);
36
+ this.textures = calculateTextureInfo(document);
37
+ }
38
+ static combine(others, type) {
39
+ const res = new Stats(new Document(), 0);
40
+ let foundAny = false;
41
+ for (const other of others) {
42
+ if (type != undefined) {
43
+ const filename = other.filename;
44
+ if (filename) {
45
+ // skip main files if we only want LODs
46
+ if (isLOD(filename)) {
47
+ if (type === "main")
48
+ continue;
49
+ }
50
+ // skip LODs if we only want main files
51
+ else {
52
+ if (type === "lods")
53
+ continue;
54
+ }
55
+ }
56
+ }
57
+ foundAny = true;
58
+ res.size += other.size;
59
+ res.nodes += other.nodes;
60
+ res.materials += other.materials;
61
+ res.meshes.addTo(other.meshes);
62
+ res.textures.addTo(other.textures);
63
+ }
64
+ if (!foundAny) {
65
+ return null;
66
+ }
67
+ return res;
68
+ }
69
+ }
70
+ export class FileStats extends Stats {
71
+ filename;
72
+ isLOD;
73
+ constructor(file, document) {
74
+ super(document, statSync(file).size);
75
+ this.filename = getFileName(file);
76
+ this.isLOD = isLOD(this.filename);
77
+ }
78
+ }
79
+ export class MeshInfo {
80
+ count = 0;
81
+ primitives = 0;
82
+ vertices = 0;
83
+ triangles = 0;
84
+ memory = 0;
85
+ formats = [];
86
+ addTo(other) {
87
+ this.count += other.count;
88
+ this.primitives += other.primitives;
89
+ this.vertices += other.vertices;
90
+ this.triangles += other.triangles;
91
+ this.memory += other.memory;
92
+ this.formats = Array.from(new Set(this.formats.concat(other.formats)));
93
+ }
94
+ }
95
+ export class TextureInfo {
96
+ count = 0;
97
+ memory = 0;
98
+ gpu_memory = 0;
99
+ formats = [];
100
+ addTo(other) {
101
+ this.count += other.count;
102
+ this.memory += other.memory;
103
+ this.gpu_memory += other.gpu_memory;
104
+ this.formats = Array.from(new Set(this.formats.concat(other.formats)));
105
+ }
106
+ }
107
+ /**
108
+ * Create a new filestats object from a file and a document
109
+ */
110
+ export function createNewFilestats(file, document) {
111
+ const filestats = new FileStats(file, document);
112
+ return filestats;
113
+ }
114
+ export function writeFileStatsToFile(filestats, output_path) {
115
+ if (output_path == undefined) {
116
+ console.error("No stats output path provided");
117
+ return null;
118
+ }
119
+ const res = {
120
+ sum: Stats.combine(filestats),
121
+ // main: Stats.combine(filestats, "main"),
122
+ // lods: Stats.combine(filestats, "lods"),
123
+ files: filestats,
124
+ };
125
+ const json = JSON.stringify(res);
126
+ writeFileSync(output_path, json);
127
+ return json;
128
+ }
129
+ function calculateMeshInfo(document) {
130
+ const root = document.getRoot();
131
+ const meshes = root.listMeshes();
132
+ const res = new MeshInfo();
133
+ res.count = meshes.length;
134
+ for (const mesh of root.listMeshes()) {
135
+ const primitives = mesh.listPrimitives();
136
+ res.primitives += primitives.length;
137
+ for (const prim of primitives) {
138
+ const positions = prim.getAttribute('POSITION');
139
+ const indices = prim.getIndices();
140
+ if (positions) {
141
+ res.vertices += positions.getCount();
142
+ }
143
+ if (indices) {
144
+ res.triangles += indices.getCount() / 3;
145
+ }
146
+ else {
147
+ res.triangles += positions.getCount() / 3;
148
+ }
149
+ const semantics = prim.listSemantics();
150
+ for (const semantic of semantics) {
151
+ const accessor = prim.getAttribute(semantic);
152
+ if (accessor) {
153
+ const buffer = accessor.getByteLength();
154
+ res.memory += buffer;
155
+ }
156
+ }
157
+ }
158
+ }
159
+ const extensions = root.listExtensionsUsed();
160
+ for (const ext of extensions) {
161
+ if (ext.extensionName.startsWith("EXT_meshopt_compression")) {
162
+ res.formats.push("meshopt");
163
+ }
164
+ else if (ext.extensionName.startsWith("KHR_draco_mesh_compression")) {
165
+ res.formats.push("draco");
166
+ }
167
+ }
168
+ // filter formats so we only have unique values
169
+ res.formats = Array.from(new Set(res.formats));
170
+ return res;
171
+ }
172
+ function calculateTextureInfo(document) {
173
+ const root = document.getRoot();
174
+ const textures = root.listTextures();
175
+ const res = new TextureInfo();
176
+ res.count = textures.length;
177
+ res.formats = textures.map(t => t.getMimeType());
178
+ res.gpu_memory = 0;
179
+ res.memory = 0;
180
+ for (const texture of textures) {
181
+ const image = texture.getImage();
182
+ const mimetype = texture.getMimeType();
183
+ if (image && mimetype) {
184
+ res.gpu_memory += ImageUtils.getVRAMByteLength(image, mimetype);
185
+ res.memory += image.byteLength;
186
+ }
187
+ }
188
+ // filter formats so we only have unique values
189
+ res.formats = Array.from(new Set(res.formats));
190
+ return res;
191
+ }
@@ -1,2 +1,2 @@
1
- export declare function isMultipleOfFour(value: number): boolean;
2
- export declare function ceilMultipleOfFour(value: number): number;
1
+ export declare function isMultipleOfFour(value: number): boolean;
2
+ export declare function ceilMultipleOfFour(value: number): number;
@@ -1,8 +1,8 @@
1
- export function isMultipleOfFour(value) {
2
- return value % 4 === 0;
3
- }
4
- export function ceilMultipleOfFour(value) {
5
- if (value <= 4)
6
- return 4;
7
- return value % 4 ? value + 4 - (value % 4) : value;
8
- }
1
+ export function isMultipleOfFour(value) {
2
+ return value % 4 === 0;
3
+ }
4
+ export function ceilMultipleOfFour(value) {
5
+ if (value <= 4)
6
+ return 4;
7
+ return value % 4 ? value + 4 - (value % 4) : value;
8
+ }
@@ -0,0 +1,5 @@
1
+ export declare function validateImageMimeType(mimetype: string, image: Uint8Array): {
2
+ error: boolean;
3
+ message: string;
4
+ mimeType: string;
5
+ };
@@ -0,0 +1,16 @@
1
+ import { ImageUtils } from "@gltf-transform/core";
2
+ export function validateImageMimeType(mimetype, image) {
3
+ const actualMimeType = ImageUtils.getMimeType(image);
4
+ if (actualMimeType != null && actualMimeType != mimetype) {
5
+ console.error(`Expected image to be of type ${mimetype}, but was ${actualMimeType}`);
6
+ return {
7
+ error: true,
8
+ message: `Expected image to be of type ${mimetype}, but was ${actualMimeType}`,
9
+ mimeType: actualMimeType
10
+ };
11
+ }
12
+ else if (actualMimeType === null) {
13
+ console.warn("Could not determine image type");
14
+ }
15
+ return null;
16
+ }
@@ -1 +1 @@
1
- export declare function getVersion(_marklocal?: boolean): string;
1
+ export declare function getVersion(_marklocal?: boolean): string;
@@ -1,5 +1,5 @@
1
- import packageJson from "#package.json" assert { type: "json" };
2
- export function getVersion(_marklocal = true) {
3
- let res = packageJson.version;
4
- return res;
5
- }
1
+ import packageJson from "#package.json" assert { type: "json" };
2
+ export function getVersion(_marklocal = true) {
3
+ let res = packageJson.version;
4
+ return res;
5
+ }
package/package.json CHANGED
@@ -1,76 +1,77 @@
1
- {
2
- "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "2.2.1-alpha.2",
4
- "description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
5
- "main": "dist/index.js",
6
- "type": "module",
7
- "readme": "README.md",
8
- "author": {
9
- "name": "Needle",
10
- "email": "help@needle.tools",
11
- "url": "https://needle.tools/"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/needle-tools/needle-gltf-extensions.git"
16
- },
17
- "bin": {
18
- "gltf-build-pipeline": "dist/cli/index.js",
19
- "needle-gltf": "dist/cli/index.js"
20
- },
21
- "imports": {
22
- "#package.json": "./package.json"
23
- },
24
- "scripts": {
25
- "start": "node scripts/index.mjs",
26
- "dev": "npm-watch compile",
27
- "compile": "node tools/prebuild.mjs && (tsc || exit 1) && node tools/postbuild.mjs",
28
- "clear-caches": "node scripts/clear-caches.mjs",
29
- "limit-caches": "node scripts/limit-caches.mjs",
30
- "transform": "node scripts/index.mjs",
31
- "transform:make-progressive": "node scripts/make-progressive.mjs",
32
- "transform:pack-gltf": "node --no-experimental-fetch scripts/pack-gltf.mjs",
33
- "pack-gltf": "node --no-experimental-fetch scripts/pack-gltf.mjs",
34
- "dev:pack-gltf": "npm run compile && node scripts/pack-gltf.mjs"
35
- },
36
- "devDependencies": {
37
- "@types/node": "^18.7.23",
38
- "npm-watch": "^0.13.0",
39
- "typescript": "^4.9.5"
40
- },
41
- "optionalDependencies": {
42
- "@img/sharp-darwin-arm64": "^0.33.4",
43
- "@img/sharp-darwin-x64": "^0.33.4",
44
- "@img/sharp-linux-arm": "^0.33.4",
45
- "@img/sharp-win32-x64": "^0.33.4"
46
- },
47
- "dependencies": {
48
- "@donmccurdy/caporal": "~0.0.10",
49
- "@gltf-transform/core": "^4.0.1",
50
- "@gltf-transform/extensions": "^4.0.1",
51
- "@gltf-transform/functions": "^4.0.1",
52
- "command-exists": "^1.2.9",
53
- "command-line-args": "^5.2.1",
54
- "draco3dgltf": "^1.5.3",
55
- "glob": "^7.2.0",
56
- "meshoptimizer": "^0.18.1",
57
- "micromatch": "^4.0.5",
58
- "ndarray": "^1.0.19",
59
- "ndarray-lanczos": "^0.3.0",
60
- "ndarray-pixels": "^2.0.1",
61
- "p-limit": "3.1.0",
62
- "semver": "^7.3.7",
63
- "sharp": "^0.33.4",
64
- "tmp": "^0.2.1",
65
- "uuid": "^9.0.1"
66
- },
67
- "watch": {
68
- "compile": {
69
- "patterns": [
70
- "src"
71
- ],
72
- "extensions": "ts",
73
- "quiet": false
74
- }
75
- }
76
- }
1
+ {
2
+ "name": "@needle-tools/gltf-build-pipeline",
3
+ "version": "2.2.1-alpha.3",
4
+ "description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "readme": "README.md",
8
+ "author": {
9
+ "name": "Needle",
10
+ "email": "help@needle.tools",
11
+ "url": "https://needle.tools/"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/needle-tools/needle-gltf-extensions.git"
16
+ },
17
+ "bin": {
18
+ "gltf-build-pipeline": "dist/cli/index.js",
19
+ "needle-gltf": "dist/cli/index.js"
20
+ },
21
+ "imports": {
22
+ "#package.json": "./package.json"
23
+ },
24
+ "scripts": {
25
+ "start": "node scripts/index.mjs",
26
+ "dev": "npm-watch compile",
27
+ "publish": "npm run compile && npm publish --access public",
28
+ "compile": "node tools/prebuild.mjs && (tsc || exit 1) && node tools/postbuild.mjs",
29
+ "clear-caches": "node scripts/clear-caches.mjs",
30
+ "limit-caches": "node scripts/limit-caches.mjs",
31
+ "transform": "node scripts/index.mjs",
32
+ "transform:make-progressive": "node scripts/make-progressive.mjs",
33
+ "transform:pack-gltf": "node --no-experimental-fetch scripts/pack-gltf.mjs",
34
+ "pack-gltf": "node --no-experimental-fetch scripts/pack-gltf.mjs",
35
+ "dev:pack-gltf": "npm run compile && node scripts/pack-gltf.mjs"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^18.7.23",
39
+ "npm-watch": "^0.13.0",
40
+ "typescript": "^4.9.5"
41
+ },
42
+ "optionalDependencies": {
43
+ "@img/sharp-darwin-arm64": "^0.33.4",
44
+ "@img/sharp-darwin-x64": "^0.33.4",
45
+ "@img/sharp-linux-arm": "^0.33.4",
46
+ "@img/sharp-win32-x64": "^0.33.4"
47
+ },
48
+ "dependencies": {
49
+ "@donmccurdy/caporal": "~0.0.10",
50
+ "@gltf-transform/core": "^4.0.1",
51
+ "@gltf-transform/extensions": "^4.0.1",
52
+ "@gltf-transform/functions": "^4.0.1",
53
+ "command-exists": "^1.2.9",
54
+ "command-line-args": "^5.2.1",
55
+ "draco3dgltf": "^1.5.3",
56
+ "glob": "^7.2.0",
57
+ "meshoptimizer": "^0.18.1",
58
+ "micromatch": "^4.0.5",
59
+ "ndarray": "^1.0.19",
60
+ "ndarray-lanczos": "^0.3.0",
61
+ "ndarray-pixels": "^2.0.1",
62
+ "p-limit": "3.1.0",
63
+ "semver": "^7.3.7",
64
+ "sharp": "^0.33.4",
65
+ "tmp": "^0.2.1",
66
+ "uuid": "^9.0.1"
67
+ },
68
+ "watch": {
69
+ "compile": {
70
+ "patterns": [
71
+ "src"
72
+ ],
73
+ "extensions": "ts",
74
+ "quiet": false
75
+ }
76
+ }
77
+ }
@@ -1,4 +1,4 @@
1
-
2
- import { clearCache } from '../dist/cache/index.js';
3
-
1
+
2
+ import { clearCache } from '../dist/cache/index.js';
3
+
4
4
  clearCache();
@@ -1,12 +1,12 @@
1
- import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
2
- import { ALL_EXTENSIONS as NEEDLE_EXTENSIONS } from "../dist/extensions/NEEDLE_opaque/index.js";
3
- import { NEEDLE_progressive } from '../dist/index.js';
4
-
5
-
6
- export function registerExtensions(node) {
7
- node.registerExtensions(ALL_EXTENSIONS);
8
- node.registerExtensions(NEEDLE_EXTENSIONS);
9
- node.registerExtensions([
10
- NEEDLE_progressive
11
- ])
1
+ import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
2
+ import { ALL_EXTENSIONS as NEEDLE_EXTENSIONS } from "../dist/extensions/NEEDLE_opaque/index.js";
3
+ import { NEEDLE_progressive } from '../dist/index.js';
4
+
5
+
6
+ export function registerExtensions(node) {
7
+ node.registerExtensions(ALL_EXTENSIONS);
8
+ node.registerExtensions(NEEDLE_EXTENSIONS);
9
+ node.registerExtensions([
10
+ NEEDLE_progressive
11
+ ])
12
12
  }
@@ -1,6 +1,6 @@
1
- import { foreachGLTF as foreach } from '../dist/index.js';
2
-
3
-
4
- export function foreachGLTF(args, callback) {
5
- return foreach(args, callback);
1
+ import { foreachGLTF as foreach } from '../dist/index.js';
2
+
3
+
4
+ export function foreachGLTF(args, callback) {
5
+ return foreach(args, callback);
6
6
  }