kaitai-struct-compiler 0.10.0-SNAPSHOT20220707.221105.bdee2103 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -21
- package/kaitai-struct-compiler.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ a nice, easy-to-comprehend API.
|
|
|
16
16
|
|
|
17
17
|
For more info on Kaitai Struct, please refer to http://kaitai.io/
|
|
18
18
|
|
|
19
|
-
Note that reference Kaitai Struct compiler is written Scala, and thus
|
|
19
|
+
Note that reference Kaitai Struct compiler is written in Scala, and thus
|
|
20
20
|
can be compiled for a variety of platforms, such as JVM, JavaScript
|
|
21
21
|
and native binaries. This package is compiled to be run JavaScript
|
|
22
22
|
environments.
|
|
@@ -33,7 +33,8 @@ the compiler). If you:
|
|
|
33
33
|
(compiling it on the fly) => use
|
|
34
34
|
[Kaitai Struct loader for JavaScript](https://github.com/kaitai-io/kaitai-struct-loader).
|
|
35
35
|
* want to integrate compiler into your build flow => use a JVM-based
|
|
36
|
-
desktop compiler, which can be called
|
|
36
|
+
[desktop compiler](https://kaitai.io/#download), which can be called
|
|
37
|
+
as a command-line utility
|
|
37
38
|
|
|
38
39
|
## Installation
|
|
39
40
|
|
|
@@ -53,9 +54,9 @@ Our [examples repository](https://github.com/kaitai-io/kaitai_struct_examples) c
|
|
|
53
54
|
|
|
54
55
|
## Plugging in
|
|
55
56
|
|
|
56
|
-
We publish the compiler as
|
|
57
|
+
We publish the compiler as a [UMD module](https://github.com/umdjs/umd), so it works from various environments, including server-side (e.g. Node.js) and client-side (e.g. web browser) ones.
|
|
57
58
|
|
|
58
|
-
Note: currently we don't publish the compiler as standard ES module. This will probably change in the future. If you need ES module please comment on [this issue](https://github.com/kaitai-io/kaitai_struct/issues/180).
|
|
59
|
+
Note: currently we don't publish the compiler as standard ES module. This will probably change in the future. If you need ES module, please comment on [this issue](https://github.com/kaitai-io/kaitai_struct/issues/180).
|
|
59
60
|
|
|
60
61
|
### node
|
|
61
62
|
|
|
@@ -67,18 +68,18 @@ var compiler = new KaitaiStructCompiler();
|
|
|
67
68
|
### browser using script tags
|
|
68
69
|
|
|
69
70
|
```html
|
|
70
|
-
<script src="node_modules/kaitai-struct-compiler/kaitai-struct-compiler.js"></script>
|
|
71
|
+
<script src="node_modules/kaitai-struct-compiler/kaitai-struct-compiler.js"></script>
|
|
71
72
|
<script>
|
|
72
73
|
var compiler = new KaitaiStructCompiler();
|
|
73
74
|
</script>
|
|
74
75
|
```
|
|
75
76
|
|
|
76
|
-
### browser using AMD loader (
|
|
77
|
+
### browser using AMD loader (e.g. require.js)
|
|
77
78
|
|
|
78
79
|
```html
|
|
79
80
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
|
|
80
81
|
<script>
|
|
81
|
-
requirejs.config({
|
|
82
|
+
requirejs.config({
|
|
82
83
|
paths: {
|
|
83
84
|
'kaitai-struct-compiler': 'node_modules/kaitai-struct-compiler/kaitai-struct-compiler'
|
|
84
85
|
}
|
|
@@ -132,32 +133,45 @@ yamlImporter.importYaml("import_outer.ksy").then(function(ksy) {
|
|
|
132
133
|
|
|
133
134
|
### Debug mode
|
|
134
135
|
|
|
135
|
-
You can compile in debug mode
|
|
136
|
+
You can compile `.ksy` source files in debug mode by setting the `debugMode` parameter to `true`. This has two effects (these can be controlled separately in the JVM-based desktop compiler since 0.9 - see [#332](https://github.com/kaitai-io/kaitai_struct/issues/332#issuecomment-454795155), but not yet in this JS compiler):
|
|
136
137
|
|
|
137
|
-
|
|
138
|
+
* objects created from user-defined `types` (and the top-level type with name specified in `/meta/id`) in the .ksy file will have a `_debug` map, which stores start and end offsets of each attribute - this is used in visualizers.
|
|
139
|
+
|
|
140
|
+
On the JVM-based desktop compiler, this can be enabled with `--read-pos`.
|
|
141
|
+
|
|
142
|
+
* the `_read` method (responsible for reading the `seq` structure defined in the .ksy file) will no longer be automatically called from constructors in the generated parser code, so you have to call it manually like this:
|
|
143
|
+
|
|
144
|
+
```diff
|
|
145
|
+
var g = new Gif(new KaitaiStream(data));
|
|
146
|
+
+g._read();
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
On the JVM-based desktop compiler, this can be enabled with `--no-auto-read`.
|
|
150
|
+
|
|
151
|
+
## Licensing
|
|
138
152
|
|
|
139
153
|
### Main code
|
|
140
154
|
|
|
141
|
-
Kaitai Struct compiler itself is copyright (C) 2015-
|
|
155
|
+
Kaitai Struct compiler itself is copyright (C) 2015-2022 Kaitai
|
|
142
156
|
Project.
|
|
143
157
|
|
|
144
158
|
This program is free software: you can redistribute it and/or modify
|
|
145
159
|
it under the terms of the GNU General Public License as published by
|
|
146
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
147
|
-
your option) any later version.
|
|
160
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
161
|
+
(at your option) any later version.
|
|
148
162
|
|
|
149
|
-
This program is distributed in the hope that it will be useful,
|
|
150
|
-
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
151
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
152
|
-
General Public License for more details.
|
|
163
|
+
This program is distributed in the hope that it will be useful,
|
|
164
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
165
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
166
|
+
GNU General Public License for more details.
|
|
153
167
|
|
|
154
168
|
You should have received a copy of the GNU General Public License
|
|
155
|
-
along with this program. If not, see <
|
|
169
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
156
170
|
|
|
157
171
|
### FastParse
|
|
158
172
|
|
|
159
173
|
Portions of Kaitai Struct compiler are loosely based on
|
|
160
|
-
[pythonparse](https://github.com/lihaoyi/fastparse/tree/
|
|
174
|
+
[pythonparse](https://github.com/com-lihaoyi/fastparse/tree/1.0.0/pythonparse/shared/src/main/scala/pythonparse)
|
|
161
175
|
from [FastParse](https://com-lihaoyi.github.io/fastparse/) and are copyright
|
|
162
176
|
(c) 2014 Li Haoyi (haoyi.sg@gmail.com).
|
|
163
177
|
|
|
@@ -182,11 +196,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
182
196
|
|
|
183
197
|
### Libraries used
|
|
184
198
|
|
|
185
|
-
Kaitai Struct compiler depends on the following libraries:
|
|
199
|
+
Kaitai Struct compiler in JavaScript depends on the following libraries:
|
|
186
200
|
|
|
187
|
-
* [scopt](https://github.com/scopt/scopt) — MIT license
|
|
188
201
|
* [fastparse](https://com-lihaoyi.github.io/fastparse/) — MIT license
|
|
189
|
-
* [snakeyaml](https://bitbucket.org/asomov/snakeyaml) — Apache 2.0 license
|
|
190
202
|
|
|
191
203
|
---
|
|
192
204
|
|
|
@@ -4395,9 +4395,9 @@ function $h_Lio_kaitai_struct_Version$() {
|
|
|
4395
4395
|
$h_Lio_kaitai_struct_Version$.prototype = $c_Lio_kaitai_struct_Version$.prototype;
|
|
4396
4396
|
$c_Lio_kaitai_struct_Version$.prototype.init___ = (function() {
|
|
4397
4397
|
this.name$1 = "kaitai-struct-compiler-js";
|
|
4398
|
-
this.version$1 = "0.10
|
|
4399
|
-
this.gitCommit$1 = "
|
|
4400
|
-
this.gitTime$1 = "2022-07-
|
|
4398
|
+
this.version$1 = "0.10";
|
|
4399
|
+
this.gitCommit$1 = "59a7d156";
|
|
4400
|
+
this.gitTime$1 = "2022-07-08T16:31:07+00:00";
|
|
4401
4401
|
return this
|
|
4402
4402
|
});
|
|
4403
4403
|
var $d_Lio_kaitai_struct_Version$ = new $TypeData().initClass({
|
package/package.json
CHANGED