parse-tmx 2.4.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 +0 -63
- package/dist/index.js +1 -1
- 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,34 +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
|
|
202
179
|
// We will match phaser's tmx => json tilemap export transformation
|
|
203
180
|
// but also support extra functionality like using external tilesets
|
|
204
181
|
declare const parseTmx: (xmlString: string, translateFlips?: boolean) => Promise<TMXParsed>;
|
|
205
|
-
|
|
206
182
|
//#endregion
|
|
207
183
|
//#region src/models/Compression.d.ts
|
|
208
184
|
declare enum Compression {
|
|
209
185
|
Gzip = "gzip",
|
|
210
186
|
Zlib = "zlib",
|
|
211
187
|
}
|
|
212
|
-
|
|
213
188
|
//#endregion
|
|
214
189
|
//#region src/models/Encoding.d.ts
|
|
215
190
|
declare enum Encoding {
|
|
216
191
|
Base64 = "base64",
|
|
217
192
|
Csv = "csv",
|
|
218
193
|
}
|
|
219
|
-
|
|
220
194
|
//#endregion
|
|
221
195
|
//#region src/models/Flipped.d.ts
|
|
222
196
|
declare enum Flipped {
|
|
@@ -224,11 +198,9 @@ declare enum Flipped {
|
|
|
224
198
|
Horizontally = 2147483648,
|
|
225
199
|
Vertically = 1073741824,
|
|
226
200
|
}
|
|
227
|
-
|
|
228
201
|
//#endregion
|
|
229
202
|
//#region src/util/isExternalTileset.d.ts
|
|
230
203
|
declare const isExternalTileset: (tileset: TMXEmbeddedTilesetShared | TMXExternalTilesetShared) => tileset is TMXExternalTilesetShared;
|
|
231
|
-
|
|
232
204
|
//#endregion
|
|
233
205
|
//#region src/models/tmx/node/BaseTMXNode.d.ts
|
|
234
206
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
|
|
@@ -239,7 +211,6 @@ declare class BaseTMXNode<T> {
|
|
|
239
211
|
[key: string]: unknown;
|
|
240
212
|
$: T;
|
|
241
213
|
}
|
|
242
|
-
|
|
243
214
|
//#endregion
|
|
244
215
|
//#region src/models/tmx/node/TMXNode.d.ts
|
|
245
216
|
// For convenience's sake, we will assume that parsing xml will always have
|
|
@@ -248,7 +219,6 @@ declare class BaseTMXNode<T> {
|
|
|
248
219
|
type TMXNode<T, TChildNode extends BaseTMXNode<unknown> | undefined = undefined> = BaseTMXNode<T> & {
|
|
249
220
|
$$: TChildNode extends undefined ? undefined : TChildNode[];
|
|
250
221
|
};
|
|
251
|
-
|
|
252
222
|
//#endregion
|
|
253
223
|
//#region src/models/tmx/node/TMXDataNode.d.ts
|
|
254
224
|
interface TMXDataNode extends TMXNode<{
|
|
@@ -257,11 +227,9 @@ interface TMXDataNode extends TMXNode<{
|
|
|
257
227
|
}> {
|
|
258
228
|
_: string;
|
|
259
229
|
}
|
|
260
|
-
|
|
261
230
|
//#endregion
|
|
262
231
|
//#region src/models/tmx/node/TMXImageNode.d.ts
|
|
263
232
|
interface TMXImageNode extends TMXNode<TMXImageShared> {}
|
|
264
|
-
|
|
265
233
|
//#endregion
|
|
266
234
|
//#region src/models/tmx/node/TMXPropertyNode.d.ts
|
|
267
235
|
interface TMXPropertyNode extends TMXNode<{
|
|
@@ -272,11 +240,9 @@ interface TMXPropertyNode extends TMXNode<{
|
|
|
272
240
|
// instead of the value attribute, which is why value can be undefined
|
|
273
241
|
_: string;
|
|
274
242
|
}
|
|
275
|
-
|
|
276
243
|
//#endregion
|
|
277
244
|
//#region src/models/tmx/node/TMXPropertiesNode.d.ts
|
|
278
245
|
interface TMXPropertiesNode extends TMXNode<Record<string, never>, TMXPropertyNode> {}
|
|
279
|
-
|
|
280
246
|
//#endregion
|
|
281
247
|
//#region src/models/tmx/node/TMXObjectNode.d.ts
|
|
282
248
|
interface TMXObjectNode extends TMXNode<TMXObjectShared, TMXDataNode | TMXPropertiesNode> {
|
|
@@ -288,7 +254,6 @@ interface TMXObjectNode extends TMXNode<TMXObjectShared, TMXDataNode | TMXProper
|
|
|
288
254
|
}[];
|
|
289
255
|
text?: TMXDataNode[];
|
|
290
256
|
}
|
|
291
|
-
|
|
292
257
|
//#endregion
|
|
293
258
|
//#region src/models/tmx/node/TMXTileNode.d.ts
|
|
294
259
|
interface TMXTileNode extends TMXNode<TMXTileShared, TMXPropertiesNode> {
|
|
@@ -298,21 +263,17 @@ interface TMXTileNode extends TMXNode<TMXTileShared, TMXPropertiesNode> {
|
|
|
298
263
|
property: TMXPropertyNode[];
|
|
299
264
|
}[];
|
|
300
265
|
}
|
|
301
|
-
|
|
302
266
|
//#endregion
|
|
303
267
|
//#region src/models/tmx/node/TMXEmbeddedTilesetNode.d.ts
|
|
304
268
|
interface TMXEmbeddedTilesetNode extends TMXNode<TMXEmbeddedTilesetShared, TMXImageNode | TMXTileNode> {
|
|
305
269
|
tile?: TMXTileNode[];
|
|
306
270
|
}
|
|
307
|
-
|
|
308
271
|
//#endregion
|
|
309
272
|
//#region src/util/isTMXEmbeddedTilesetNode.d.ts
|
|
310
273
|
declare const isTMXEmbeddedTilesetNode: (node: TMXDataNode | TMXEmbeddedTilesetNode) => node is TMXEmbeddedTilesetNode;
|
|
311
|
-
|
|
312
274
|
//#endregion
|
|
313
275
|
//#region src/util/parseFlips.d.ts
|
|
314
276
|
declare const parseFlips: (gid: number) => TMXFlipsParsed;
|
|
315
|
-
|
|
316
277
|
//#endregion
|
|
317
278
|
//#region src/models/tmx/node/TMXLayerNode.d.ts
|
|
318
279
|
interface TMXLayerNode extends TMXNode<TMXLayerShared, TMXDataNode | TMXEmbeddedTilesetNode | TMXPropertiesNode> {
|
|
@@ -323,7 +284,6 @@ interface TMXLayerNode extends TMXNode<TMXLayerShared, TMXDataNode | TMXEmbedded
|
|
|
323
284
|
property: TMXPropertyNode[];
|
|
324
285
|
}[];
|
|
325
286
|
}
|
|
326
|
-
|
|
327
287
|
//#endregion
|
|
328
288
|
//#region src/models/tmx/node/TMXGroupLayerNode.d.ts
|
|
329
289
|
interface TMXGroupLayerNode extends TMXNode<TMXGroupLayerShared, TMXLayerNode> {
|
|
@@ -331,94 +291,73 @@ interface TMXGroupLayerNode extends TMXNode<TMXGroupLayerShared, TMXLayerNode> {
|
|
|
331
291
|
property: TMXPropertyNode[];
|
|
332
292
|
}[];
|
|
333
293
|
}
|
|
334
|
-
|
|
335
294
|
//#endregion
|
|
336
295
|
//#region src/util/parseGroup.d.ts
|
|
337
296
|
declare const parseGroup: (node: TMXGroupLayerNode, expectedCount: number, translateFlips: boolean) => Promise<TMXGroupLayerParsed>;
|
|
338
|
-
|
|
339
297
|
//#endregion
|
|
340
298
|
//#region src/util/parseLayer.d.ts
|
|
341
299
|
declare const parseLayer: (node: TMXLayerNode) => TMXLayerParsed;
|
|
342
|
-
|
|
343
300
|
//#endregion
|
|
344
301
|
//#region src/util/parseNode.d.ts
|
|
345
302
|
declare const parseNode: <TNode extends TMXGroupLayerNode | TMXLayerNode, TParsedNode = (TNode extends TMXLayerNode ? TMXLayerParsed : TMXGroupLayerParsed)>(node: TNode, expectedCount: number, translateFlips: boolean) => Promise<TParsedNode> | TParsedNode;
|
|
346
|
-
|
|
347
303
|
//#endregion
|
|
348
304
|
//#region src/util/parseObject.d.ts
|
|
349
305
|
declare const parseObject: (node: TMXObjectNode) => TMXObjectParsed;
|
|
350
|
-
|
|
351
306
|
//#endregion
|
|
352
307
|
//#region src/util/parseObjectShape.d.ts
|
|
353
308
|
declare const parseObjectShape: (node: TMXObjectNode) => Shape;
|
|
354
|
-
|
|
355
309
|
//#endregion
|
|
356
310
|
//#region src/util/parseProperties.d.ts
|
|
357
311
|
declare const parseProperties: (properties: {
|
|
358
312
|
property: TMXPropertyNode[];
|
|
359
313
|
}[]) => TMXPropertiesParsed;
|
|
360
|
-
|
|
361
314
|
//#endregion
|
|
362
315
|
//#region src/util/parseTile.d.ts
|
|
363
316
|
declare const parseTile: (node: TMXTileNode) => TMXTileParsed;
|
|
364
|
-
|
|
365
317
|
//#endregion
|
|
366
318
|
//#region src/util/parseTileId.d.ts
|
|
367
319
|
declare const parseTileId: (gid: number) => number;
|
|
368
|
-
|
|
369
320
|
//#endregion
|
|
370
321
|
//#region src/util/parseTileLayer.d.ts
|
|
371
322
|
declare const parseTileLayer: (node: TMXLayerNode, expectedCount: number, translateFlips: boolean) => Promise<TMXLayerParsed>;
|
|
372
|
-
|
|
373
323
|
//#endregion
|
|
374
324
|
//#region src/models/tmx/node/TMXExternalTilesetNode.d.ts
|
|
375
325
|
interface TMXExternalTilesetNode extends TMXNode<TMXExternalTilesetShared> {}
|
|
376
|
-
|
|
377
326
|
//#endregion
|
|
378
327
|
//#region src/models/tmx/node/TMXTilesetNode.d.ts
|
|
379
328
|
type TMXTilesetNode = TMXEmbeddedTilesetNode | TMXExternalTilesetNode;
|
|
380
|
-
|
|
381
329
|
//#endregion
|
|
382
330
|
//#region src/util/parseTileset.d.ts
|
|
383
331
|
declare const parseTileset: (node: TMXTilesetNode) => TMXTilesetParsed;
|
|
384
|
-
|
|
385
332
|
//#endregion
|
|
386
333
|
//#region src/util/parseXmlString.d.ts
|
|
387
334
|
declare const parseXmlString: <T extends object>(xmlString: string) => Promise<T>;
|
|
388
|
-
|
|
389
335
|
//#endregion
|
|
390
336
|
//#region src/util/parseXmlValue.d.ts
|
|
391
337
|
declare const parseXmlValue: (value: string) => boolean | number | string;
|
|
392
|
-
|
|
393
338
|
//#endregion
|
|
394
339
|
//#region src/util/unpackTileBytes.d.ts
|
|
395
340
|
declare const unpackTileBytes: (buffer: Buffer, expectedCount: number) => number[];
|
|
396
|
-
|
|
397
341
|
//#endregion
|
|
398
342
|
//#region src/models/tmx/shared/TMXExportShared.d.ts
|
|
399
343
|
interface TMXExportShared {
|
|
400
344
|
format: string;
|
|
401
345
|
target: string;
|
|
402
346
|
}
|
|
403
|
-
|
|
404
347
|
//#endregion
|
|
405
348
|
//#region src/models/tmx/node/TMXExportNode.d.ts
|
|
406
349
|
interface TMXExportNode extends TMXNode<TMXExportShared> {}
|
|
407
|
-
|
|
408
350
|
//#endregion
|
|
409
351
|
//#region src/models/tmx/node/TMXEditorSettingsNode.d.ts
|
|
410
352
|
interface TMXEditorSettingsNode extends TMXNode<Record<string, never>, TMXExportNode> {}
|
|
411
|
-
|
|
412
353
|
//#endregion
|
|
413
354
|
//#region src/models/tmx/node/TMXMapNode.d.ts
|
|
414
355
|
interface TMXMapNode extends TMXNode<TMXMapShared, TMXEditorSettingsNode | TMXGroupLayerNode | TMXPropertiesNode | TMXTilesetNode> {}
|
|
415
|
-
|
|
416
356
|
//#endregion
|
|
417
357
|
//#region src/models/tmx/node/TMX.d.ts
|
|
418
358
|
interface TMX {
|
|
419
359
|
map: TMXMapNode;
|
|
420
360
|
}
|
|
421
|
-
|
|
422
361
|
//#endregion
|
|
423
362
|
//#region src/models/tmx/node/TMXNodeType.d.ts
|
|
424
363
|
declare enum TMXNodeType {
|
|
@@ -435,10 +374,8 @@ declare enum TMXNodeType {
|
|
|
435
374
|
Property = "property",
|
|
436
375
|
Tileset = "tileset",
|
|
437
376
|
}
|
|
438
|
-
|
|
439
377
|
//#endregion
|
|
440
378
|
//#region src/models/tmx/parsed/TMXExportParsed.d.ts
|
|
441
379
|
interface TMXExportParsed extends TMXExportShared {}
|
|
442
|
-
|
|
443
380
|
//#endregion
|
|
444
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
|
@@ -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.4.
|
|
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.4.
|
|
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
|
}
|