parse-tmx 2.3.0 → 2.4.0

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.d.ts CHANGED
@@ -199,6 +199,8 @@ declare class TMXParsed {
199
199
 
200
200
  //#endregion
201
201
  //#region src/parseTmx.d.ts
202
+ // We will match phaser's tmx => json tilemap export transformation
203
+ // but also support extra functionality like using external tilesets
202
204
  declare const parseTmx: (xmlString: string, translateFlips?: boolean) => Promise<TMXParsed>;
203
205
 
204
206
  //#endregion
@@ -229,14 +231,20 @@ declare const isExternalTileset: (tileset: TMXEmbeddedTilesetShared | TMXExterna
229
231
 
230
232
  //#endregion
231
233
  //#region src/models/tmx/node/BaseTMXNode.d.ts
234
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
232
235
  declare class BaseTMXNode<T> {
233
236
  #private;
237
+ // We add indexable signature because we can't access #name properly
238
+ // due to typescript shenanigans with private properties >:C
234
239
  [key: string]: unknown;
235
240
  $: T;
236
241
  }
237
242
 
238
243
  //#endregion
239
244
  //#region src/models/tmx/node/TMXNode.d.ts
245
+ // For convenience's sake, we will assume that parsing xml will always have
246
+ // explicitChildren && preserveChildrenOrder set to true and we will type that instead
247
+ // We deal with dynamic xml data by typing it explicitly in the specific types that extend this interface
240
248
  type TMXNode<T, TChildNode extends BaseTMXNode<unknown> | undefined = undefined> = BaseTMXNode<T> & {
241
249
  $$: TChildNode extends undefined ? undefined : TChildNode[];
242
250
  };
@@ -260,6 +268,8 @@ interface TMXPropertyNode extends TMXNode<{
260
268
  name: string;
261
269
  value?: string;
262
270
  }> {
271
+ // Phaser stores string with special unicode values as data
272
+ // instead of the value attribute, which is why value can be undefined
263
273
  _: string;
264
274
  }
265
275
 
package/dist/index.js CHANGED
@@ -407,7 +407,7 @@ const DefaultBuilderOptions = {
407
407
  var require_xmlbuilder2_min = __commonJS({ "../../node_modules/.pnpm/xmlbuilder2@3.1.1/node_modules/xmlbuilder2/lib/xmlbuilder2.min.js"(exports$1, module$1) {
408
408
  (function(e, t) {
409
409
  "object" == typeof exports$1 && "object" == typeof module$1 ? module$1.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports$1 ? exports$1.xmlbuilder2 = t() : e.xmlbuilder2 = t();
410
- })(exports$1, function() {
410
+ })(void 0, function() {
411
411
  return function(e) {
412
412
  var t = {};
413
413
  function r(n) {
@@ -21910,7 +21910,7 @@ var require_sax = __commonJS({ "../../node_modules/.pnpm/sax@1.4.1/node_modules/
21910
21910
  });
21911
21911
  else String.fromCodePoint = fromCodePoint;
21912
21912
  })();
21913
- })(typeof exports$1 === "undefined" ? exports$1.sax = {} : exports$1);
21913
+ })(typeof exports$1 === "undefined" ? (void 0).sax = {} : exports$1);
21914
21914
  } });
21915
21915
  var import_sax = __toESM(require_sax(), 1);
21916
21916
  var Parser = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parse-tmx",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "A parser for tmx.",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/Esposter/Esposter#readme",
@@ -35,12 +35,12 @@
35
35
  "export:gen": "ctix build --config ../configuration/.ctirc-ts"
36
36
  },
37
37
  "dependencies": {
38
- "@esposter/xml2js": "2.3.0",
38
+ "@esposter/xml2js": "2.4.0",
39
39
  "data-urls": "^5.0.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/data-urls": "^3.0.4",
43
43
  "@types/xml2js": "^0.4.14"
44
44
  },
45
- "gitHead": "5738dd0273ab8d7861296378a24903699b1fb4b8"
45
+ "gitHead": "b17224ff11ad2688c5406413ca6e066f3e565abf"
46
46
  }