x3d-tidy 1.0.9 → 1.0.11
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 +10 -7
- package/package.json +16 -6
- package/src/convert.js +20 -7
package/README.md
CHANGED
|
@@ -46,13 +46,16 @@ If set, remove metadata.
|
|
|
46
46
|
|
|
47
47
|
## Supported Input File Types
|
|
48
48
|
|
|
49
|
-
|
|
|
50
|
-
|
|
51
|
-
| XML | .x3d, .x3dz | model/x3d+xml |
|
|
52
|
-
| JSON | .x3dj, .x3djz | model/x3d+json |
|
|
53
|
-
| Classic VRML | .x3dv, .x3dvz | model/x3d+vrml |
|
|
54
|
-
| VRML
|
|
55
|
-
| glTF
|
|
49
|
+
| Encoding | File Extension | MIME Type |
|
|
50
|
+
|------------------|----------------|-----------------|
|
|
51
|
+
| X3D XML | .x3d, .x3dz | model/x3d+xml |
|
|
52
|
+
| X3D JSON | .x3dj, .x3djz | model/x3d+json |
|
|
53
|
+
| X3D Classic VRML | .x3dv, .x3dvz | model/x3d+vrml |
|
|
54
|
+
| VRML | .wrl, .wrz | model/vrml |
|
|
55
|
+
| glTF | .gltf, .glb | model/gltf+json |
|
|
56
|
+
| Wavefront OBJ | .obj | model/obj |
|
|
57
|
+
| STL | .stl | model/stl |
|
|
58
|
+
| SVG Document | .svg, .svgz | image/svg+xml |
|
|
56
59
|
|
|
57
60
|
## Supported Output File Types
|
|
58
61
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x3d-tidy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "X3D Converter, Beautifier and Minimizer",
|
|
5
5
|
"bin": {
|
|
6
6
|
"x3d-tidy": "bin/x3d-tidy.js"
|
|
@@ -15,11 +15,21 @@
|
|
|
15
15
|
"url": "git+https://github.com/create3000/x3d-tidy.git"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
"Compressor",
|
|
19
|
+
"glTF2",
|
|
20
|
+
"JSON",
|
|
21
|
+
"STL",
|
|
22
|
+
"VRML",
|
|
23
|
+
"Wavefront-OBJ",
|
|
24
|
+
"wrl",
|
|
25
|
+
"XML",
|
|
21
26
|
"beautifier",
|
|
22
|
-
"
|
|
27
|
+
"converter",
|
|
28
|
+
"GLB",
|
|
29
|
+
"Minimizer",
|
|
30
|
+
"SVG",
|
|
31
|
+
"tidy",
|
|
32
|
+
"X3D"
|
|
23
33
|
],
|
|
24
34
|
"author": "Holger Seelig",
|
|
25
35
|
"license": "GPL-3.0",
|
|
@@ -28,7 +38,7 @@
|
|
|
28
38
|
},
|
|
29
39
|
"homepage": "https://github.com/create3000/x3d-tidy#readme",
|
|
30
40
|
"dependencies": {
|
|
31
|
-
"electron": "^
|
|
41
|
+
"electron": "^23.0.0",
|
|
32
42
|
"x_ite": "latest",
|
|
33
43
|
"yargs": "^17.6.2"
|
|
34
44
|
}
|
package/src/convert.js
CHANGED
|
@@ -9,7 +9,10 @@ const
|
|
|
9
9
|
yargs = require ("yargs"),
|
|
10
10
|
path = require ("path"),
|
|
11
11
|
fs = require ("fs"),
|
|
12
|
-
zlib = require ("zlib")
|
|
12
|
+
zlib = require ("zlib"),
|
|
13
|
+
DEBUG = false
|
|
14
|
+
|
|
15
|
+
// DEBUG: npm start -- --version` to reset cache.
|
|
13
16
|
|
|
14
17
|
process .exit = (status) => electron .ipcRenderer .send (status ? "error" : "ready", "")
|
|
15
18
|
|
|
@@ -31,9 +34,9 @@ async function main (argv)
|
|
|
31
34
|
|
|
32
35
|
async function convert (argv)
|
|
33
36
|
{
|
|
34
|
-
console .log =
|
|
35
|
-
console .warn =
|
|
36
|
-
console .error =
|
|
37
|
+
console .log = output .bind (null, process .stdout)
|
|
38
|
+
console .warn = output .bind (null, process .stdout)
|
|
39
|
+
console .error = output .bind (null, process .stderr)
|
|
37
40
|
|
|
38
41
|
const args = yargs (argv)
|
|
39
42
|
.scriptName ("x3d-tidy")
|
|
@@ -91,15 +94,20 @@ async function convert (argv)
|
|
|
91
94
|
.help ()
|
|
92
95
|
.alias ("help", "h") .argv;
|
|
93
96
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
if (!DEBUG)
|
|
98
|
+
{
|
|
99
|
+
console .log = Function .prototype
|
|
100
|
+
console .warn = Function .prototype
|
|
101
|
+
console .error = Function .prototype
|
|
102
|
+
}
|
|
97
103
|
|
|
98
104
|
const
|
|
99
105
|
Browser = X3D .createBrowser () .browser,
|
|
100
106
|
input = path .resolve (process .cwd (), args .input)
|
|
101
107
|
|
|
102
108
|
Browser .endUpdate ()
|
|
109
|
+
Browser .setBrowserOption ("PrimitiveQuality", "HIGH");
|
|
110
|
+
Browser .setBrowserOption ("TextureQuality", "HIGH");
|
|
103
111
|
|
|
104
112
|
await Browser .loadURL (new X3D .MFString (input))
|
|
105
113
|
|
|
@@ -154,3 +162,8 @@ function getContents ({ scene, type, style, precision, doublePrecision })
|
|
|
154
162
|
return zlib .gzipSync (scene .toJSONString ({ style: style || "CLEAN", precision: precision, doublePrecision: doublePrecision }))
|
|
155
163
|
}
|
|
156
164
|
}
|
|
165
|
+
|
|
166
|
+
function output (stdout, ... args)
|
|
167
|
+
{
|
|
168
|
+
stdout .write (args .join (" ") + "\n")
|
|
169
|
+
}
|