x3d-tidy 1.0.37 → 1.0.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x3d-tidy",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "X3D Converter, Beautifier and Minimizer",
5
5
  "bin": {
6
6
  "x3d-tidy": "bin/x3d-tidy.js"
@@ -40,8 +40,8 @@
40
40
  },
41
41
  "homepage": "https://www.npmjs.com/package/x3d-tidy",
42
42
  "dependencies": {
43
- "electron": "^24.4.0",
44
- "x_ite": "^8.7.9",
43
+ "electron": "^25.1.0",
44
+ "x_ite": "^8.8.0",
45
45
  "yargs": "^17.7.2"
46
46
  }
47
47
  }
package/src/infer.js CHANGED
@@ -38,7 +38,7 @@ function getProfileAndComponentsFromUsedComponents (browser, usedComponents)
38
38
  const profiles = ["Interactive", "Interchange", "Immersive"] .map (name =>
39
39
  {
40
40
  return { profile: browser .getProfile (name), components: new Set (usedComponents) }
41
- });
41
+ })
42
42
 
43
43
  profiles .forEach (object =>
44
44
  {
@@ -58,7 +58,7 @@ function getProfileAndComponentsFromUsedComponents (browser, usedComponents)
58
58
  { count: Number .POSITIVE_INFINITY })
59
59
 
60
60
  return {
61
- profile: min .object .profile,
61
+ profile: min .object .profile,
62
62
  components: Array .from (min .object .components) .sort () .map (name => browser .getSupportedComponents () .get (name)),
63
63
  }
64
64
  }
package/src/traverse.js CHANGED
@@ -85,30 +85,17 @@ module .exports = class Traverse
85
85
 
86
86
  seen .add (node)
87
87
 
88
- for (const field of node .getFields ())
89
- {
90
- switch (field .getType ())
91
- {
92
- case X3D .X3DConstants .SFNode:
93
- {
94
- if (this .traverseNode (field .getValue (), flags, callback, seen) === false)
95
- return false
88
+ if (this .traverseFields (node .getUserDefinedFields (), flags, callback, seen) === false)
89
+ return false
96
90
 
97
- break
98
- }
99
- case X3D .X3DConstants .MFNode:
100
- {
101
- if (this .traverseNodes (field, flags, callback, seen) === false)
102
- return false
91
+ if (this .traverseFields (node .getPredefinedFields (), flags, callback, seen) === false)
92
+ return false
103
93
 
104
- break
105
- }
106
- }
107
- }
94
+ const type = node .getType ()
108
95
 
109
- for (const type of node .getType () .slice () .reverse ())
96
+ for (let t = type .length - 1; t >= 0; -- t)
110
97
  {
111
- switch (type)
98
+ switch (type [t])
112
99
  {
113
100
  case X3D .X3DConstants .X3DProtoDeclaration:
114
101
  {
@@ -141,4 +128,30 @@ module .exports = class Traverse
141
128
 
142
129
  return callback (node) !== false
143
130
  }
131
+
132
+ static traverseFields (fields, flags, callback, seen)
133
+ {
134
+ for (const field of fields)
135
+ {
136
+ switch (field .getType ())
137
+ {
138
+ case X3D .X3DConstants .SFNode:
139
+ {
140
+ if (this .traverseNode (field .getValue (), flags, callback, seen) === false)
141
+ return false
142
+
143
+ break
144
+ }
145
+ case X3D .X3DConstants .MFNode:
146
+ {
147
+ if (this .traverseNodes (field, flags, callback, seen) === false)
148
+ return false
149
+
150
+ break
151
+ }
152
+ }
153
+ }
154
+
155
+ return true
156
+ }
144
157
  }