parse-tmx 1.0.21 → 1.0.24
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/dist/index.js +7 -7
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var esposterShared = require('esposter-shared');
|
|
4
4
|
var node_zlib = require('node:zlib');
|
|
5
5
|
|
|
6
6
|
var TMXNodeType;
|
|
@@ -195,12 +195,12 @@ const parseTileLayer = async (node, expectedCount, translateFlips) => {
|
|
|
195
195
|
layer.data = unpackTileBytes(buffer, expectedCount);
|
|
196
196
|
break;
|
|
197
197
|
default:
|
|
198
|
-
|
|
198
|
+
esposterShared.exhaustiveGuard(compression);
|
|
199
199
|
}
|
|
200
200
|
break;
|
|
201
201
|
}
|
|
202
202
|
default:
|
|
203
|
-
|
|
203
|
+
esposterShared.exhaustiveGuard(encoding);
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
if (translateFlips) {
|
|
@@ -225,7 +225,7 @@ const parseNode = (node, expectedCount, translateFlips) => {
|
|
|
225
225
|
case TMXNodeType.Objectgroup:
|
|
226
226
|
return parseLayer(node);
|
|
227
227
|
default:
|
|
228
|
-
throw new
|
|
228
|
+
throw new esposterShared.InvalidOperationError(esposterShared.Operation.Read, parseNode.name, tmxNodeType);
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
231
|
|
|
@@ -257,13 +257,13 @@ const parseTileset = (node) => {
|
|
|
257
257
|
const tiles = tile?.map((t) => parseTile(t)) ?? [];
|
|
258
258
|
return { ...$, image, tiles };
|
|
259
259
|
}
|
|
260
|
-
throw new
|
|
260
|
+
throw new esposterShared.InvalidOperationError(esposterShared.Operation.Read, parseTileset.name, $.name);
|
|
261
261
|
};
|
|
262
262
|
|
|
263
263
|
// We will try and match phaser's transform when exporting tmx => json tilemaps
|
|
264
264
|
// but also support extra functionality like using external tilesets
|
|
265
265
|
const parseTmx = async (xmlString, translateFlips = false) => {
|
|
266
|
-
const { map: { $, $$ }, } = (await
|
|
266
|
+
const { map: { $, $$ }, } = (await esposterShared.parseXmlString(xmlString));
|
|
267
267
|
const map = new TMXMapParsed(structuredClone($));
|
|
268
268
|
const expectedCount = map.width * map.height * 4;
|
|
269
269
|
await Promise.all($$.map(async (node) => {
|
|
@@ -299,7 +299,7 @@ const parseTmx = async (xmlString, translateFlips = false) => {
|
|
|
299
299
|
case TMXNodeType.Property:
|
|
300
300
|
break;
|
|
301
301
|
default:
|
|
302
|
-
|
|
302
|
+
esposterShared.exhaustiveGuard(tmxNodeType);
|
|
303
303
|
}
|
|
304
304
|
}));
|
|
305
305
|
return { map };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parse-tmx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"description": "A parser for tmx",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/Esposter/Esposter#readme",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"types:gen": "dts-bundle-generator -o dist/index.d.ts src/index.ts"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"esposter-shared": "1.0.
|
|
30
|
+
"esposter-shared": "1.0.24"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"rollup": "^4.17.2",
|
|
37
37
|
"typescript": "^5.4.5"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "b89237bd17467fee67e3ef598e3ff2326a8f573c"
|
|
40
40
|
}
|