parse-tmx 2.3.0 → 2.4.1
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/LICENSE +201 -201
- package/README.md +125 -125
- package/dist/index.d.ts +10 -63
- package/dist/index.js +3 -3
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2020-present Jimmy Chen
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2020-present Jimmy Chen
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
# parse-tmx
|
|
2
|
-
|
|
3
|
-
[![Apache-2.0 licensed][badge-license]][url-license]
|
|
4
|
-
[![NPM version][badge-npm-version]][url-npm]
|
|
5
|
-
[![NPM downloads][badge-npm-downloads]][url-npm]
|
|
6
|
-
[![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
|
|
7
|
-
|
|
8
|
-
Inspired by [tmx-map-parser](https://github.com/praghus/tmx-map-parser).
|
|
9
|
-
A parser for [Tiled Map Editor](http://www.mapeditor.org/) \*.tmx files.
|
|
10
|
-
|
|
11
|
-
### Table of Contents
|
|
12
|
-
|
|
13
|
-
- 🚀 [Getting Started](#getting-started)
|
|
14
|
-
- 📖 [Documentation](#documentation)
|
|
15
|
-
- ⚖️ [License](#license)
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## <a name="getting-started">🚀 Getting Started</a>
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
pnpm i parse-tmx
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## <a name="documentation">📖 Documentation</a>
|
|
26
|
-
|
|
27
|
-
We highly recommend you take a look at the [documentation](https://esposter.com/docs/modules/parse_tmx.html) to level up.
|
|
28
|
-
|
|
29
|
-
### Usage
|
|
30
|
-
|
|
31
|
-
The basic implementation:
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
import { parseTmx } from "parse-tmx";
|
|
35
|
-
// The *.tmx file can be loaded as a string or URL encoded data
|
|
36
|
-
import map from "map.tmx";
|
|
37
|
-
|
|
38
|
-
// Translates the tile flips in the layer data (default: false)
|
|
39
|
-
const translateFlips = true;
|
|
40
|
-
|
|
41
|
-
const loadMap = async () => {
|
|
42
|
-
const data = await parseTmx(map, translateFlips);
|
|
43
|
-
...
|
|
44
|
-
};
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Example data
|
|
48
|
-
|
|
49
|
-
[TMX Map Format documentation](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/)
|
|
50
|
-
|
|
51
|
-
```js
|
|
52
|
-
{
|
|
53
|
-
tiledversion: "1.8.0",
|
|
54
|
-
tilewidth: 16,
|
|
55
|
-
tileheight: 16,
|
|
56
|
-
version: 1.8,
|
|
57
|
-
width: 512,
|
|
58
|
-
height: 128,
|
|
59
|
-
infinite: 0,
|
|
60
|
-
nextlayerid: 5,
|
|
61
|
-
nextobjectid: 165,
|
|
62
|
-
orientation: "orthogonal",
|
|
63
|
-
renderorder: "right-down",
|
|
64
|
-
properties: {
|
|
65
|
-
property1: 'value',
|
|
66
|
-
property2: 0.5
|
|
67
|
-
},
|
|
68
|
-
layers: [{
|
|
69
|
-
id: 1,
|
|
70
|
-
name: "layer name",
|
|
71
|
-
type: "layer",
|
|
72
|
-
visible: 1,
|
|
73
|
-
data: [0, 1, 1, 10, 10, 10, 1, 1, 0, 0, 0, 0, …],
|
|
74
|
-
// When the translateFlips parameter is enabled
|
|
75
|
-
flips: [
|
|
76
|
-
{H: false, V: false, D: false},
|
|
77
|
-
{H: true, V: false, D: true},
|
|
78
|
-
{H: false, V: false, D: false},
|
|
79
|
-
{…}
|
|
80
|
-
],
|
|
81
|
-
width: 512,
|
|
82
|
-
height: 128,
|
|
83
|
-
opacity: 0.77,
|
|
84
|
-
properties: {
|
|
85
|
-
property1: 'value',
|
|
86
|
-
property2: false
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
id: 2,
|
|
90
|
-
name: "objects",
|
|
91
|
-
type: "objectgroup",
|
|
92
|
-
visible: 1,
|
|
93
|
-
objects: [{…}, {…}, {…}],
|
|
94
|
-
properties: {
|
|
95
|
-
property1: 'value',
|
|
96
|
-
property2: false
|
|
97
|
-
}
|
|
98
|
-
}, {
|
|
99
|
-
…
|
|
100
|
-
}],
|
|
101
|
-
tilesets: [{
|
|
102
|
-
columns: 32,
|
|
103
|
-
firstgid: 1,
|
|
104
|
-
image: {source: "tiles.png", width: 512, height: 512},
|
|
105
|
-
name: "tiles",
|
|
106
|
-
tilecount: 1024,
|
|
107
|
-
tilewidth: 16,
|
|
108
|
-
tileheight: 16,
|
|
109
|
-
tiles: [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
|
|
110
|
-
}, {
|
|
111
|
-
…
|
|
112
|
-
}]
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## <a name="license">⚖️ License</a>
|
|
117
|
-
|
|
118
|
-
This project is licensed under the [Apache-2.0 license](https://github.com/Esposter/Esposter/blob/main/LICENSE).
|
|
119
|
-
|
|
120
|
-
[badge-license]: https://img.shields.io/github/license/Esposter/Esposter.svg?color=blue
|
|
121
|
-
[url-license]: https://github.com/Esposter/Esposter/blob/main/LICENSE
|
|
122
|
-
[badge-npm-version]: https://img.shields.io/npm/v/parse-tmx/latest?color=brightgreen
|
|
123
|
-
[url-npm]: https://www.npmjs.com/package/parse-tmx/v/latest
|
|
124
|
-
[badge-npm-unpacked-size]: https://img.shields.io/npm/unpacked-size/parse-tmx/latest?label=npm
|
|
125
|
-
[badge-npm-downloads]: https://img.shields.io/npm/dm/parse-tmx.svg
|
|
1
|
+
# parse-tmx
|
|
2
|
+
|
|
3
|
+
[![Apache-2.0 licensed][badge-license]][url-license]
|
|
4
|
+
[![NPM version][badge-npm-version]][url-npm]
|
|
5
|
+
[![NPM downloads][badge-npm-downloads]][url-npm]
|
|
6
|
+
[![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
|
|
7
|
+
|
|
8
|
+
Inspired by [tmx-map-parser](https://github.com/praghus/tmx-map-parser).
|
|
9
|
+
A parser for [Tiled Map Editor](http://www.mapeditor.org/) \*.tmx files.
|
|
10
|
+
|
|
11
|
+
### Table of Contents
|
|
12
|
+
|
|
13
|
+
- 🚀 [Getting Started](#getting-started)
|
|
14
|
+
- 📖 [Documentation](#documentation)
|
|
15
|
+
- ⚖️ [License](#license)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## <a name="getting-started">🚀 Getting Started</a>
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm i parse-tmx
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## <a name="documentation">📖 Documentation</a>
|
|
26
|
+
|
|
27
|
+
We highly recommend you take a look at the [documentation](https://esposter.com/docs/modules/parse_tmx.html) to level up.
|
|
28
|
+
|
|
29
|
+
### Usage
|
|
30
|
+
|
|
31
|
+
The basic implementation:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { parseTmx } from "parse-tmx";
|
|
35
|
+
// The *.tmx file can be loaded as a string or URL encoded data
|
|
36
|
+
import map from "map.tmx";
|
|
37
|
+
|
|
38
|
+
// Translates the tile flips in the layer data (default: false)
|
|
39
|
+
const translateFlips = true;
|
|
40
|
+
|
|
41
|
+
const loadMap = async () => {
|
|
42
|
+
const data = await parseTmx(map, translateFlips);
|
|
43
|
+
...
|
|
44
|
+
};
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Example data
|
|
48
|
+
|
|
49
|
+
[TMX Map Format documentation](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/)
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
{
|
|
53
|
+
tiledversion: "1.8.0",
|
|
54
|
+
tilewidth: 16,
|
|
55
|
+
tileheight: 16,
|
|
56
|
+
version: 1.8,
|
|
57
|
+
width: 512,
|
|
58
|
+
height: 128,
|
|
59
|
+
infinite: 0,
|
|
60
|
+
nextlayerid: 5,
|
|
61
|
+
nextobjectid: 165,
|
|
62
|
+
orientation: "orthogonal",
|
|
63
|
+
renderorder: "right-down",
|
|
64
|
+
properties: {
|
|
65
|
+
property1: 'value',
|
|
66
|
+
property2: 0.5
|
|
67
|
+
},
|
|
68
|
+
layers: [{
|
|
69
|
+
id: 1,
|
|
70
|
+
name: "layer name",
|
|
71
|
+
type: "layer",
|
|
72
|
+
visible: 1,
|
|
73
|
+
data: [0, 1, 1, 10, 10, 10, 1, 1, 0, 0, 0, 0, …],
|
|
74
|
+
// When the translateFlips parameter is enabled
|
|
75
|
+
flips: [
|
|
76
|
+
{H: false, V: false, D: false},
|
|
77
|
+
{H: true, V: false, D: true},
|
|
78
|
+
{H: false, V: false, D: false},
|
|
79
|
+
{…}
|
|
80
|
+
],
|
|
81
|
+
width: 512,
|
|
82
|
+
height: 128,
|
|
83
|
+
opacity: 0.77,
|
|
84
|
+
properties: {
|
|
85
|
+
property1: 'value',
|
|
86
|
+
property2: false
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
id: 2,
|
|
90
|
+
name: "objects",
|
|
91
|
+
type: "objectgroup",
|
|
92
|
+
visible: 1,
|
|
93
|
+
objects: [{…}, {…}, {…}],
|
|
94
|
+
properties: {
|
|
95
|
+
property1: 'value',
|
|
96
|
+
property2: false
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
…
|
|
100
|
+
}],
|
|
101
|
+
tilesets: [{
|
|
102
|
+
columns: 32,
|
|
103
|
+
firstgid: 1,
|
|
104
|
+
image: {source: "tiles.png", width: 512, height: 512},
|
|
105
|
+
name: "tiles",
|
|
106
|
+
tilecount: 1024,
|
|
107
|
+
tilewidth: 16,
|
|
108
|
+
tileheight: 16,
|
|
109
|
+
tiles: [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
|
|
110
|
+
}, {
|
|
111
|
+
…
|
|
112
|
+
}]
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## <a name="license">⚖️ License</a>
|
|
117
|
+
|
|
118
|
+
This project is licensed under the [Apache-2.0 license](https://github.com/Esposter/Esposter/blob/main/LICENSE).
|
|
119
|
+
|
|
120
|
+
[badge-license]: https://img.shields.io/github/license/Esposter/Esposter.svg?color=blue
|
|
121
|
+
[url-license]: https://github.com/Esposter/Esposter/blob/main/LICENSE
|
|
122
|
+
[badge-npm-version]: https://img.shields.io/npm/v/parse-tmx/latest?color=brightgreen
|
|
123
|
+
[url-npm]: https://www.npmjs.com/package/parse-tmx/v/latest
|
|
124
|
+
[badge-npm-unpacked-size]: https://img.shields.io/npm/unpacked-size/parse-tmx/latest?label=npm
|
|
125
|
+
[badge-npm-downloads]: https://img.shields.io/npm/dm/parse-tmx.svg
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
//#region src/models/tmx/parsed/TMXEditorSettingsParsed.d.ts
|
|
2
2
|
interface TMXEditorSettingsParsed extends Record<string, unknown> {}
|
|
3
|
-
|
|
4
3
|
//#endregion
|
|
5
4
|
//#region src/models/tmx/parsed/TMXFlipsParsed.d.ts
|
|
6
5
|
interface TMXFlipsParsed {
|
|
@@ -8,7 +7,6 @@ interface TMXFlipsParsed {
|
|
|
8
7
|
H: boolean;
|
|
9
8
|
V: boolean;
|
|
10
9
|
}
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
11
|
//#region src/models/tmx/shared/TMXImageShared.d.ts
|
|
14
12
|
interface TMXImageShared {
|
|
@@ -16,11 +14,9 @@ interface TMXImageShared {
|
|
|
16
14
|
source: string;
|
|
17
15
|
width: number;
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
//#endregion
|
|
21
18
|
//#region src/models/tmx/parsed/TMXImageParsed.d.ts
|
|
22
19
|
interface TMXImageParsed extends TMXImageShared {}
|
|
23
|
-
|
|
24
20
|
//#endregion
|
|
25
21
|
//#region src/models/Shape.d.ts
|
|
26
22
|
declare enum Shape {
|
|
@@ -29,11 +25,9 @@ declare enum Shape {
|
|
|
29
25
|
Polygon = "polygon",
|
|
30
26
|
Rectangle = "rectangle",
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
//#endregion
|
|
34
29
|
//#region src/models/tmx/parsed/TMXPropertiesParsed.d.ts
|
|
35
30
|
type TMXPropertiesParsed = Record<string, unknown>[];
|
|
36
|
-
|
|
37
31
|
//#endregion
|
|
38
32
|
//#region src/models/tmx/shared/TMXObjectShared.d.ts
|
|
39
33
|
interface TMXObjectShared {
|
|
@@ -45,7 +39,6 @@ interface TMXObjectShared {
|
|
|
45
39
|
x: number;
|
|
46
40
|
y: number;
|
|
47
41
|
}
|
|
48
|
-
|
|
49
42
|
//#endregion
|
|
50
43
|
//#region src/models/tmx/parsed/TMXObjectParsed.d.ts
|
|
51
44
|
interface TMXObjectParsed extends TMXObjectShared {
|
|
@@ -57,7 +50,6 @@ interface TMXObjectParsed extends TMXObjectShared {
|
|
|
57
50
|
text?: string;
|
|
58
51
|
value: string;
|
|
59
52
|
}
|
|
60
|
-
|
|
61
53
|
//#endregion
|
|
62
54
|
//#region src/models/tmx/shared/TMXLayerShared.d.ts
|
|
63
55
|
interface TMXLayerShared {
|
|
@@ -77,7 +69,6 @@ interface TMXLayerShared {
|
|
|
77
69
|
x?: number;
|
|
78
70
|
y?: number;
|
|
79
71
|
}
|
|
80
|
-
|
|
81
72
|
//#endregion
|
|
82
73
|
//#region src/models/tmx/parsed/TMXLayerParsed.d.ts
|
|
83
74
|
interface TMXLayerParsed extends TMXLayerShared {
|
|
@@ -87,7 +78,6 @@ interface TMXLayerParsed extends TMXLayerShared {
|
|
|
87
78
|
objects?: TMXObjectParsed[];
|
|
88
79
|
properties?: TMXPropertiesParsed;
|
|
89
80
|
}
|
|
90
|
-
|
|
91
81
|
//#endregion
|
|
92
82
|
//#region src/models/tmx/shared/TMXGroupLayerShared.d.ts
|
|
93
83
|
interface TMXGroupLayerShared {
|
|
@@ -95,14 +85,12 @@ interface TMXGroupLayerShared {
|
|
|
95
85
|
name: string;
|
|
96
86
|
type: string;
|
|
97
87
|
}
|
|
98
|
-
|
|
99
88
|
//#endregion
|
|
100
89
|
//#region src/models/tmx/parsed/TMXGroupLayerParsed.d.ts
|
|
101
90
|
interface TMXGroupLayerParsed extends TMXGroupLayerShared {
|
|
102
91
|
layers: TMXLayerParsed[];
|
|
103
92
|
properties?: TMXPropertiesParsed;
|
|
104
93
|
}
|
|
105
|
-
|
|
106
94
|
//#endregion
|
|
107
95
|
//#region src/models/tmx/shared/TMXTileShared.d.ts
|
|
108
96
|
interface TMXTileShared {
|
|
@@ -110,7 +98,6 @@ interface TMXTileShared {
|
|
|
110
98
|
id: number;
|
|
111
99
|
probability?: number;
|
|
112
100
|
}
|
|
113
|
-
|
|
114
101
|
//#endregion
|
|
115
102
|
//#region src/models/tmx/parsed/TMXTileParsed.d.ts
|
|
116
103
|
interface TMXTileParsed extends TMXTileShared {
|
|
@@ -122,13 +109,11 @@ interface TMXTileParsed extends TMXTileShared {
|
|
|
122
109
|
properties?: TMXPropertiesParsed;
|
|
123
110
|
type: string;
|
|
124
111
|
}
|
|
125
|
-
|
|
126
112
|
//#endregion
|
|
127
113
|
//#region src/models/tmx/shared/TMXBaseTilesetShared.d.ts
|
|
128
114
|
interface TMXBaseTilesetShared {
|
|
129
115
|
firstgid: number;
|
|
130
116
|
}
|
|
131
|
-
|
|
132
117
|
//#endregion
|
|
133
118
|
//#region src/models/tmx/shared/TMXEmbeddedTilesetShared.d.ts
|
|
134
119
|
interface TMXEmbeddedTilesetShared extends TMXBaseTilesetShared {
|
|
@@ -142,28 +127,23 @@ interface TMXEmbeddedTilesetShared extends TMXBaseTilesetShared {
|
|
|
142
127
|
tileheight: number;
|
|
143
128
|
tilewidth: number;
|
|
144
129
|
}
|
|
145
|
-
|
|
146
130
|
//#endregion
|
|
147
131
|
//#region src/models/tmx/parsed/TMXEmbeddedTilesetParsed.d.ts
|
|
148
132
|
interface TMXEmbeddedTilesetParsed extends TMXEmbeddedTilesetShared {
|
|
149
133
|
image: TMXImageParsed;
|
|
150
134
|
tiles: TMXTileParsed[];
|
|
151
135
|
}
|
|
152
|
-
|
|
153
136
|
//#endregion
|
|
154
137
|
//#region src/models/tmx/shared/TMXExternalTilesetShared.d.ts
|
|
155
138
|
interface TMXExternalTilesetShared extends TMXBaseTilesetShared {
|
|
156
139
|
source: string;
|
|
157
140
|
}
|
|
158
|
-
|
|
159
141
|
//#endregion
|
|
160
142
|
//#region src/models/tmx/parsed/TMXExternalTilesetParsed.d.ts
|
|
161
143
|
interface TMXExternalTilesetParsed extends TMXExternalTilesetShared {}
|
|
162
|
-
|
|
163
144
|
//#endregion
|
|
164
145
|
//#region src/models/tmx/parsed/TMXTilesetParsed.d.ts
|
|
165
146
|
type TMXTilesetParsed = TMXEmbeddedTilesetParsed | TMXExternalTilesetParsed;
|
|
166
|
-
|
|
167
147
|
//#endregion
|
|
168
148
|
//#region src/models/tmx/shared/TMXMapShared.d.ts
|
|
169
149
|
declare class TMXMapShared {
|
|
@@ -179,7 +159,6 @@ declare class TMXMapShared {
|
|
|
179
159
|
version: number;
|
|
180
160
|
width: number;
|
|
181
161
|
}
|
|
182
|
-
|
|
183
162
|
//#endregion
|
|
184
163
|
//#region src/models/tmx/parsed/TMXMapParsed.d.ts
|
|
185
164
|
declare class TMXMapParsed extends TMXMapShared {
|
|
@@ -189,32 +168,29 @@ declare class TMXMapParsed extends TMXMapShared {
|
|
|
189
168
|
tilesets: TMXTilesetParsed[];
|
|
190
169
|
constructor(init?: Partial<TMXMapParsed>);
|
|
191
170
|
}
|
|
192
|
-
|
|
193
171
|
//#endregion
|
|
194
172
|
//#region src/models/tmx/parsed/TMXParsed.d.ts
|
|
195
173
|
declare class TMXParsed {
|
|
196
174
|
map: TMXMapParsed;
|
|
197
175
|
constructor(map?: TMXMapParsed);
|
|
198
176
|
}
|
|
199
|
-
|
|
200
177
|
//#endregion
|
|
201
178
|
//#region src/parseTmx.d.ts
|
|
179
|
+
// We will match phaser's tmx => json tilemap export transformation
|
|
180
|
+
// but also support extra functionality like using external tilesets
|
|
202
181
|
declare const parseTmx: (xmlString: string, translateFlips?: boolean) => Promise<TMXParsed>;
|
|
203
|
-
|
|
204
182
|
//#endregion
|
|
205
183
|
//#region src/models/Compression.d.ts
|
|
206
184
|
declare enum Compression {
|
|
207
185
|
Gzip = "gzip",
|
|
208
186
|
Zlib = "zlib",
|
|
209
187
|
}
|
|
210
|
-
|
|
211
188
|
//#endregion
|
|
212
189
|
//#region src/models/Encoding.d.ts
|
|
213
190
|
declare enum Encoding {
|
|
214
191
|
Base64 = "base64",
|
|
215
192
|
Csv = "csv",
|
|
216
193
|
}
|
|
217
|
-
|
|
218
194
|
//#endregion
|
|
219
195
|
//#region src/models/Flipped.d.ts
|
|
220
196
|
declare enum Flipped {
|
|
@@ -222,25 +198,27 @@ declare enum Flipped {
|
|
|
222
198
|
Horizontally = 2147483648,
|
|
223
199
|
Vertically = 1073741824,
|
|
224
200
|
}
|
|
225
|
-
|
|
226
201
|
//#endregion
|
|
227
202
|
//#region src/util/isExternalTileset.d.ts
|
|
228
203
|
declare const isExternalTileset: (tileset: TMXEmbeddedTilesetShared | TMXExternalTilesetShared) => tileset is TMXExternalTilesetShared;
|
|
229
|
-
|
|
230
204
|
//#endregion
|
|
231
205
|
//#region src/models/tmx/node/BaseTMXNode.d.ts
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
232
207
|
declare class BaseTMXNode<T> {
|
|
233
208
|
#private;
|
|
209
|
+
// We add indexable signature because we can't access #name properly
|
|
210
|
+
// due to typescript shenanigans with private properties >:C
|
|
234
211
|
[key: string]: unknown;
|
|
235
212
|
$: T;
|
|
236
213
|
}
|
|
237
|
-
|
|
238
214
|
//#endregion
|
|
239
215
|
//#region src/models/tmx/node/TMXNode.d.ts
|
|
216
|
+
// For convenience's sake, we will assume that parsing xml will always have
|
|
217
|
+
// explicitChildren && preserveChildrenOrder set to true and we will type that instead
|
|
218
|
+
// We deal with dynamic xml data by typing it explicitly in the specific types that extend this interface
|
|
240
219
|
type TMXNode<T, TChildNode extends BaseTMXNode<unknown> | undefined = undefined> = BaseTMXNode<T> & {
|
|
241
220
|
$$: TChildNode extends undefined ? undefined : TChildNode[];
|
|
242
221
|
};
|
|
243
|
-
|
|
244
222
|
//#endregion
|
|
245
223
|
//#region src/models/tmx/node/TMXDataNode.d.ts
|
|
246
224
|
interface TMXDataNode extends TMXNode<{
|
|
@@ -249,24 +227,22 @@ interface TMXDataNode extends TMXNode<{
|
|
|
249
227
|
}> {
|
|
250
228
|
_: string;
|
|
251
229
|
}
|
|
252
|
-
|
|
253
230
|
//#endregion
|
|
254
231
|
//#region src/models/tmx/node/TMXImageNode.d.ts
|
|
255
232
|
interface TMXImageNode extends TMXNode<TMXImageShared> {}
|
|
256
|
-
|
|
257
233
|
//#endregion
|
|
258
234
|
//#region src/models/tmx/node/TMXPropertyNode.d.ts
|
|
259
235
|
interface TMXPropertyNode extends TMXNode<{
|
|
260
236
|
name: string;
|
|
261
237
|
value?: string;
|
|
262
238
|
}> {
|
|
239
|
+
// Phaser stores string with special unicode values as data
|
|
240
|
+
// instead of the value attribute, which is why value can be undefined
|
|
263
241
|
_: string;
|
|
264
242
|
}
|
|
265
|
-
|
|
266
243
|
//#endregion
|
|
267
244
|
//#region src/models/tmx/node/TMXPropertiesNode.d.ts
|
|
268
245
|
interface TMXPropertiesNode extends TMXNode<Record<string, never>, TMXPropertyNode> {}
|
|
269
|
-
|
|
270
246
|
//#endregion
|
|
271
247
|
//#region src/models/tmx/node/TMXObjectNode.d.ts
|
|
272
248
|
interface TMXObjectNode extends TMXNode<TMXObjectShared, TMXDataNode | TMXPropertiesNode> {
|
|
@@ -278,7 +254,6 @@ interface TMXObjectNode extends TMXNode<TMXObjectShared, TMXDataNode | TMXProper
|
|
|
278
254
|
}[];
|
|
279
255
|
text?: TMXDataNode[];
|
|
280
256
|
}
|
|
281
|
-
|
|
282
257
|
//#endregion
|
|
283
258
|
//#region src/models/tmx/node/TMXTileNode.d.ts
|
|
284
259
|
interface TMXTileNode extends TMXNode<TMXTileShared, TMXPropertiesNode> {
|
|
@@ -288,21 +263,17 @@ interface TMXTileNode extends TMXNode<TMXTileShared, TMXPropertiesNode> {
|
|
|
288
263
|
property: TMXPropertyNode[];
|
|
289
264
|
}[];
|
|
290
265
|
}
|
|
291
|
-
|
|
292
266
|
//#endregion
|
|
293
267
|
//#region src/models/tmx/node/TMXEmbeddedTilesetNode.d.ts
|
|
294
268
|
interface TMXEmbeddedTilesetNode extends TMXNode<TMXEmbeddedTilesetShared, TMXImageNode | TMXTileNode> {
|
|
295
269
|
tile?: TMXTileNode[];
|
|
296
270
|
}
|
|
297
|
-
|
|
298
271
|
//#endregion
|
|
299
272
|
//#region src/util/isTMXEmbeddedTilesetNode.d.ts
|
|
300
273
|
declare const isTMXEmbeddedTilesetNode: (node: TMXDataNode | TMXEmbeddedTilesetNode) => node is TMXEmbeddedTilesetNode;
|
|
301
|
-
|
|
302
274
|
//#endregion
|
|
303
275
|
//#region src/util/parseFlips.d.ts
|
|
304
276
|
declare const parseFlips: (gid: number) => TMXFlipsParsed;
|
|
305
|
-
|
|
306
277
|
//#endregion
|
|
307
278
|
//#region src/models/tmx/node/TMXLayerNode.d.ts
|
|
308
279
|
interface TMXLayerNode extends TMXNode<TMXLayerShared, TMXDataNode | TMXEmbeddedTilesetNode | TMXPropertiesNode> {
|
|
@@ -313,7 +284,6 @@ interface TMXLayerNode extends TMXNode<TMXLayerShared, TMXDataNode | TMXEmbedded
|
|
|
313
284
|
property: TMXPropertyNode[];
|
|
314
285
|
}[];
|
|
315
286
|
}
|
|
316
|
-
|
|
317
287
|
//#endregion
|
|
318
288
|
//#region src/models/tmx/node/TMXGroupLayerNode.d.ts
|
|
319
289
|
interface TMXGroupLayerNode extends TMXNode<TMXGroupLayerShared, TMXLayerNode> {
|
|
@@ -321,94 +291,73 @@ interface TMXGroupLayerNode extends TMXNode<TMXGroupLayerShared, TMXLayerNode> {
|
|
|
321
291
|
property: TMXPropertyNode[];
|
|
322
292
|
}[];
|
|
323
293
|
}
|
|
324
|
-
|
|
325
294
|
//#endregion
|
|
326
295
|
//#region src/util/parseGroup.d.ts
|
|
327
296
|
declare const parseGroup: (node: TMXGroupLayerNode, expectedCount: number, translateFlips: boolean) => Promise<TMXGroupLayerParsed>;
|
|
328
|
-
|
|
329
297
|
//#endregion
|
|
330
298
|
//#region src/util/parseLayer.d.ts
|
|
331
299
|
declare const parseLayer: (node: TMXLayerNode) => TMXLayerParsed;
|
|
332
|
-
|
|
333
300
|
//#endregion
|
|
334
301
|
//#region src/util/parseNode.d.ts
|
|
335
302
|
declare const parseNode: <TNode extends TMXGroupLayerNode | TMXLayerNode, TParsedNode = (TNode extends TMXLayerNode ? TMXLayerParsed : TMXGroupLayerParsed)>(node: TNode, expectedCount: number, translateFlips: boolean) => Promise<TParsedNode> | TParsedNode;
|
|
336
|
-
|
|
337
303
|
//#endregion
|
|
338
304
|
//#region src/util/parseObject.d.ts
|
|
339
305
|
declare const parseObject: (node: TMXObjectNode) => TMXObjectParsed;
|
|
340
|
-
|
|
341
306
|
//#endregion
|
|
342
307
|
//#region src/util/parseObjectShape.d.ts
|
|
343
308
|
declare const parseObjectShape: (node: TMXObjectNode) => Shape;
|
|
344
|
-
|
|
345
309
|
//#endregion
|
|
346
310
|
//#region src/util/parseProperties.d.ts
|
|
347
311
|
declare const parseProperties: (properties: {
|
|
348
312
|
property: TMXPropertyNode[];
|
|
349
313
|
}[]) => TMXPropertiesParsed;
|
|
350
|
-
|
|
351
314
|
//#endregion
|
|
352
315
|
//#region src/util/parseTile.d.ts
|
|
353
316
|
declare const parseTile: (node: TMXTileNode) => TMXTileParsed;
|
|
354
|
-
|
|
355
317
|
//#endregion
|
|
356
318
|
//#region src/util/parseTileId.d.ts
|
|
357
319
|
declare const parseTileId: (gid: number) => number;
|
|
358
|
-
|
|
359
320
|
//#endregion
|
|
360
321
|
//#region src/util/parseTileLayer.d.ts
|
|
361
322
|
declare const parseTileLayer: (node: TMXLayerNode, expectedCount: number, translateFlips: boolean) => Promise<TMXLayerParsed>;
|
|
362
|
-
|
|
363
323
|
//#endregion
|
|
364
324
|
//#region src/models/tmx/node/TMXExternalTilesetNode.d.ts
|
|
365
325
|
interface TMXExternalTilesetNode extends TMXNode<TMXExternalTilesetShared> {}
|
|
366
|
-
|
|
367
326
|
//#endregion
|
|
368
327
|
//#region src/models/tmx/node/TMXTilesetNode.d.ts
|
|
369
328
|
type TMXTilesetNode = TMXEmbeddedTilesetNode | TMXExternalTilesetNode;
|
|
370
|
-
|
|
371
329
|
//#endregion
|
|
372
330
|
//#region src/util/parseTileset.d.ts
|
|
373
331
|
declare const parseTileset: (node: TMXTilesetNode) => TMXTilesetParsed;
|
|
374
|
-
|
|
375
332
|
//#endregion
|
|
376
333
|
//#region src/util/parseXmlString.d.ts
|
|
377
334
|
declare const parseXmlString: <T extends object>(xmlString: string) => Promise<T>;
|
|
378
|
-
|
|
379
335
|
//#endregion
|
|
380
336
|
//#region src/util/parseXmlValue.d.ts
|
|
381
337
|
declare const parseXmlValue: (value: string) => boolean | number | string;
|
|
382
|
-
|
|
383
338
|
//#endregion
|
|
384
339
|
//#region src/util/unpackTileBytes.d.ts
|
|
385
340
|
declare const unpackTileBytes: (buffer: Buffer, expectedCount: number) => number[];
|
|
386
|
-
|
|
387
341
|
//#endregion
|
|
388
342
|
//#region src/models/tmx/shared/TMXExportShared.d.ts
|
|
389
343
|
interface TMXExportShared {
|
|
390
344
|
format: string;
|
|
391
345
|
target: string;
|
|
392
346
|
}
|
|
393
|
-
|
|
394
347
|
//#endregion
|
|
395
348
|
//#region src/models/tmx/node/TMXExportNode.d.ts
|
|
396
349
|
interface TMXExportNode extends TMXNode<TMXExportShared> {}
|
|
397
|
-
|
|
398
350
|
//#endregion
|
|
399
351
|
//#region src/models/tmx/node/TMXEditorSettingsNode.d.ts
|
|
400
352
|
interface TMXEditorSettingsNode extends TMXNode<Record<string, never>, TMXExportNode> {}
|
|
401
|
-
|
|
402
353
|
//#endregion
|
|
403
354
|
//#region src/models/tmx/node/TMXMapNode.d.ts
|
|
404
355
|
interface TMXMapNode extends TMXNode<TMXMapShared, TMXEditorSettingsNode | TMXGroupLayerNode | TMXPropertiesNode | TMXTilesetNode> {}
|
|
405
|
-
|
|
406
356
|
//#endregion
|
|
407
357
|
//#region src/models/tmx/node/TMX.d.ts
|
|
408
358
|
interface TMX {
|
|
409
359
|
map: TMXMapNode;
|
|
410
360
|
}
|
|
411
|
-
|
|
412
361
|
//#endregion
|
|
413
362
|
//#region src/models/tmx/node/TMXNodeType.d.ts
|
|
414
363
|
declare enum TMXNodeType {
|
|
@@ -425,10 +374,8 @@ declare enum TMXNodeType {
|
|
|
425
374
|
Property = "property",
|
|
426
375
|
Tileset = "tileset",
|
|
427
376
|
}
|
|
428
|
-
|
|
429
377
|
//#endregion
|
|
430
378
|
//#region src/models/tmx/parsed/TMXExportParsed.d.ts
|
|
431
379
|
interface TMXExportParsed extends TMXExportShared {}
|
|
432
|
-
|
|
433
380
|
//#endregion
|
|
434
381
|
export { BaseTMXNode, Compression, Encoding, Flipped, Shape, TMX, TMXBaseTilesetShared, TMXDataNode, TMXEditorSettingsNode, TMXEditorSettingsParsed, TMXEmbeddedTilesetNode, TMXEmbeddedTilesetParsed, TMXEmbeddedTilesetShared, TMXExportNode, TMXExportParsed, TMXExportShared, TMXExternalTilesetNode, TMXExternalTilesetParsed, TMXExternalTilesetShared, TMXFlipsParsed, TMXGroupLayerNode, TMXGroupLayerParsed, TMXGroupLayerShared, TMXImageNode, TMXImageParsed, TMXImageShared, TMXLayerNode, TMXLayerParsed, TMXLayerShared, TMXMapNode, TMXMapParsed, TMXMapShared, TMXNode, TMXNodeType, TMXObjectNode, TMXObjectParsed, TMXObjectShared, TMXParsed, TMXPropertiesNode, TMXPropertiesParsed, TMXPropertyNode, TMXTileNode, TMXTileParsed, TMXTileShared, TMXTilesetNode, TMXTilesetParsed, isExternalTileset, isTMXEmbeddedTilesetNode, parseFlips, parseGroup, parseLayer, parseNode, parseObject, parseObjectShape, parseProperties, parseTile, parseTileId, parseTileLayer, parseTileset, parseTmx, parseXmlString, parseXmlValue, unpackTileBytes };
|
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
|
-
})(
|
|
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" ?
|
|
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 {
|
|
@@ -58904,7 +58904,7 @@ var require_parser = __commonJS$1({ "../../node_modules/.pnpm/data-urls@5.0.0/no
|
|
|
58904
58904
|
|
|
58905
58905
|
//#endregion
|
|
58906
58906
|
//#region src/util/parseXmlString.ts
|
|
58907
|
-
var import_parser = __toESM$1(require_parser());
|
|
58907
|
+
var import_parser = __toESM$1(require_parser(), 1);
|
|
58908
58908
|
const parseXmlString = (xmlString) => {
|
|
58909
58909
|
const xml = (0, import_parser.default)(xmlString) ?? xmlString;
|
|
58910
58910
|
return parseStringPromise(xml, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parse-tmx",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
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.
|
|
38
|
+
"@esposter/xml2js": "2.4.1",
|
|
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": "
|
|
45
|
+
"gitHead": "a21ed2057213eae49ea366f8866dfae2e5041163"
|
|
46
46
|
}
|