@frdt/frdt 0.2.1 → 0.2.3

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 CHANGED
@@ -77,6 +77,44 @@ const imported = out.import(out.root(), [source])
77
77
  out.rebuildTypes()
78
78
  ```
79
79
 
80
+ ### 部分木を、新しいファイルとして切り出す
81
+
82
+ ```ts
83
+ const saved = Document.open(savedBytes)
84
+ const part = saved.extract(saved.root().children()[0], { unresolved: 'error' })
85
+ // part.document() のルートは最初の子の写し。使うアセットだけが残る
86
+ writeFileSync('unit.brson', part.document().writeBrson())
87
+ ```
88
+
89
+ ### 雛形からコンポーネントを写す
90
+
91
+ ```ts
92
+ const templates = Document.open(templateBytes)
93
+ const added = out.copyComponent(out.root(), templates.root().children()[0], 0)
94
+ out.root().setComponentValue(added.index, 'VariableName', { kind: 'string', value: 'Static.Main' })
95
+ ```
96
+
97
+ フィールドと型の版は雛形のとおりになります。値は写したあとに書き換えます。
98
+
99
+ ### まとめるときの選択肢と、書き出す前の仕上げ
100
+
101
+ ```ts
102
+ import { compare, Document } from '@frdt/frdt'
103
+
104
+ // 写さなかったものを指す参照があれば失敗し、VersionNumber などが違えば新しい方を取る
105
+ const strict = out.import(out.root(), [source], { unresolved: 'error', versions: 'newer' })
106
+ for (const m of strict.mismatches()) {
107
+ console.warn(`${m.kind} ${m.name ?? ''}: ${m.destination ?? '(none)'} -> ${m.source ?? '(none)'}`)
108
+ }
109
+
110
+ out.renumberIds(0) // 同じ中身なら同じバイト列になる
111
+ for (const d of compare(out, Document.open(expectedBytes))) {
112
+ console.log(d.path, d.item, d.left ?? '(none)', d.right ?? '(none)')
113
+ }
114
+ ```
115
+
116
+ `unresolved` は `'keep'`(既定、文字列のまま残す)、`'error'`、`'null'`。`versions` は `'keep'`(既定、付け先の値を残す)と `'newer'`。食い違いは、どちらでも `mismatches()` に入ります。
117
+
80
118
  ## 値の形
81
119
 
82
120
  フィールドの値は `{ kind, value }` で渡し、受け取ります。
package/frdt.wasi.cjs CHANGED
@@ -1,4 +1,4 @@
1
- // napi-rs-artifact-metadata:{"version":2,"rootEntry":"index.js","exports":["Document","Import","Slot","summarize","versionDate"],"managedRootEntries":["browser.js","index.js","frdt.wasm","frdt.debug.wasm"]}
1
+ // napi-rs-artifact-metadata:{"version":2,"rootEntry":"index.js","exports":["Document","Extract","Import","Slot","compare","compareVersions","summarize","versionDate"],"managedRootEntries":["browser.js","index.js","frdt.wasm","frdt.debug.wasm"]}
2
2
  /* eslint-disable */
3
3
  /* auto-generated by NAPI-RS */
4
4
 
@@ -2138,7 +2138,10 @@ try {
2138
2138
  }
2139
2139
  module.exports = __napiModule.exports
2140
2140
  module.exports.Document = __napiModule.exports.Document
2141
+ module.exports.Extract = __napiModule.exports.Extract
2141
2142
  module.exports.Import = __napiModule.exports.Import
2142
2143
  module.exports.Slot = __napiModule.exports.Slot
2144
+ module.exports.compare = __napiModule.exports.compare
2145
+ module.exports.compareVersions = __napiModule.exports.compareVersions
2143
2146
  module.exports.summarize = __napiModule.exports.summarize
2144
2147
  module.exports.versionDate = __napiModule.exports.versionDate
Binary file
package/index.d.ts CHANGED
@@ -24,18 +24,59 @@ export declare class Document {
24
24
  slotCount(): number
25
25
  componentCount(): number
26
26
  assets(): Array<AssetInfo>
27
- /** Copy `slots` (all from one document) under `parent`, renumbering ids. */
28
- import(parent: Slot, slots: Array<Slot>): Import
27
+ /**
28
+ * Copy `slots` (all from one document) under `parent`, renumbering ids.
29
+ * `options.unresolved` and `options.versions` default to `"keep"`.
30
+ */
31
+ import(parent: Slot, slots: Array<Slot>, options?: ImportOptions | undefined | null): Import
32
+ /**
33
+ * Append a copy of the `component`-th component of `source` (a slot in
34
+ * this or another document) to `slot`. Ids are renumbered, the type and
35
+ * its `TypeVersions` entry come along, and so do the assets it uses.
36
+ * Values are copied as they are; change them with `setComponentValue`.
37
+ * `options` work as for `import`.
38
+ */
39
+ copyComponent(slot: Slot, source: Slot, component: number, options?: ImportOptions | undefined | null): CopiedComponent
29
40
  addSlot(parent: Slot, name: string): Slot
30
41
  addComponent(slot: Slot, typeName: string, typeVersion: number | undefined | null, fields: Array<Field>): NewComponent
31
42
  moveSlot(slot: Slot, newParent: Slot): void
32
43
  removeSlot(slot: Slot): void
33
44
  /** Trim `Types` and `TypeVersions` to what remains. Returns removed names. */
34
45
  rebuildTypes(): Array<string>
46
+ /**
47
+ * A new document whose root is a copy of `slot` and its subtree. Ids are
48
+ * kept, only the assets the subtree uses are kept, and `Types` and
49
+ * `TypeVersions` are rebuilt. `VersionNumber`, `FeatureFlags`, and other
50
+ * root fields are copied. This document is not modified.
51
+ */
52
+ extract(slot: Slot, options?: ExtractOptions | undefined | null): Extract
53
+ /**
54
+ * Give every id a value computed from `seed` (default 0) and the order the
55
+ * ids are defined in, and rewrite every reference to them. The same
56
+ * content writes the same bytes. Call it last, before `writeBrson`.
57
+ * Returns the number of ids renumbered.
58
+ */
59
+ renumberIds(seed?: number | undefined | null): number
60
+ /** Replace `VersionNumber` (`year.month.day[.build]`). */
61
+ setVersionNumber(versionNumber: string): void
62
+ /** Replace `FeatureFlags`, written in the order given. */
63
+ setFeatureFlags(featureFlags: Array<FeatureFlag>): void
35
64
  /** The Resonite `.brson` bytes. */
36
65
  writeBrson(): Buffer
37
66
  }
38
67
 
68
+ /** What `Document.extract` made. */
69
+ export declare class Extract {
70
+ /** The new document. Its root is the copy of the extracted slot. */
71
+ document(): Document
72
+ /**
73
+ * Ids the copy refers to that the source defines outside the extracted
74
+ * subtree and its assets, sorted. With `unresolved: 'null'` these were
75
+ * written as null.
76
+ */
77
+ unresolved(): Array<string>
78
+ }
79
+
39
80
  /** What `Document.import` copied. */
40
81
  export declare class Import {
41
82
  /** The copied slots in the destination, in the order given. */
@@ -45,6 +86,11 @@ export declare class Import {
45
86
  /** Source ids the copy still names but that were not copied. */
46
87
  unresolved(): Array<string>
47
88
  assetCount(): number
89
+ /**
90
+ * Where the source's `VersionNumber`, `FeatureFlags`, or `TypeVersions`
91
+ * differed from the destination's before the import.
92
+ */
93
+ mismatches(): Array<Mismatch>
48
94
  }
49
95
 
50
96
  /** A slot in a `Document`. It keeps pointing at the same slot across edits. */
@@ -60,6 +106,13 @@ export declare class Slot {
60
106
  set(field: string, value: Value): void
61
107
  /** A field of the `component`-th component. `null` when the value is null. */
62
108
  componentValue(component: number, field: string): Value | null
109
+ /**
110
+ * Like `componentValue`, but `undefined` when the component has no such
111
+ * field instead of an error. `null` when the field is null.
112
+ */
113
+ tryComponentValue(component: number, field: string): Value | null | undefined
114
+ /** Field names of the `component`-th component, without its ids. */
115
+ componentFieldNames(component: number): Array<string>
63
116
  setComponentValue(component: number, field: string, value?: Value | undefined | null): void
64
117
  }
65
118
 
@@ -68,6 +121,19 @@ export interface AssetInfo {
68
121
  typeIndex?: number
69
122
  }
70
123
 
124
+ /**
125
+ * Compare two documents by structure: slot tree, names, values, component
126
+ * types and fields, and what each reference points at. Ids themselves do not
127
+ * take part, so a renumbered copy compares equal.
128
+ */
129
+ export declare function compare(a: Document, b: Document): Array<Difference>
130
+
131
+ /**
132
+ * Compare two `VersionNumber` strings part by part as numbers: negative when
133
+ * `a` is older, 0 when equal, positive when `a` is newer.
134
+ */
135
+ export declare function compareVersions(a: string, b: string): number
136
+
71
137
  export interface ComponentInfo {
72
138
  typeIndex: number
73
139
  typeName: string
@@ -75,6 +141,34 @@ export interface ComponentInfo {
75
141
  references: Array<string>
76
142
  }
77
143
 
144
+ /** What `copyComponent` added. */
145
+ export interface CopiedComponent {
146
+ /** Position in `Slot.components()` of the target slot. */
147
+ index: number
148
+ id: string
149
+ /** Source ids the component refers to that were not copied. */
150
+ unresolved: Array<string>
151
+ assetCount: number
152
+ /** As `Import.mismatches()`. */
153
+ mismatches: Array<Mismatch>
154
+ }
155
+
156
+ /**
157
+ * One entry that differs between two documents. `left` is from the first,
158
+ * `right` from the second; absent when the entry is missing on that side.
159
+ */
160
+ export interface Difference {
161
+ /** `"document"`, a slot path such as `Root/0:Main/2:DV`, or an asset. */
162
+ path: string
163
+ /**
164
+ * A root field, a slot field, `slot`, or `#i type` / `#i <field>` for the
165
+ * slot's i-th component.
166
+ */
167
+ item: string
168
+ left?: string
169
+ right?: string
170
+ }
171
+
78
172
  export interface DynamicVariable {
79
173
  /** `"value"`, `"reference"`, or `"space"`. */
80
174
  kind: string
@@ -85,6 +179,15 @@ export interface DynamicVariable {
85
179
  reference?: Value
86
180
  }
87
181
 
182
+ /** Options for `extract`. */
183
+ export interface ExtractOptions {
184
+ /**
185
+ * What to do with a reference to an id the source defines outside the
186
+ * subtree: keep the string (default), fail, or write null.
187
+ */
188
+ unresolved?: 'keep' | 'error' | 'null'
189
+ }
190
+
88
191
  export interface FeatureFlag {
89
192
  name: string
90
193
  value: number
@@ -96,6 +199,33 @@ export interface Field {
96
199
  value?: Value | null
97
200
  }
98
201
 
202
+ /** Options for `import`. */
203
+ export interface ImportOptions {
204
+ /**
205
+ * What to do with a reference from the copy to a source id that was not
206
+ * copied: keep the string (default), fail without changing anything, or
207
+ * write null.
208
+ */
209
+ unresolved?: 'keep' | 'error' | 'null'
210
+ /**
211
+ * What to do when `VersionNumber`, `FeatureFlags`, or `TypeVersions`
212
+ * differ: keep the destination's (default), or take the newer side of
213
+ * each. `Import.mismatches()` lists the differences either way.
214
+ */
215
+ versions?: 'keep' | 'newer'
216
+ }
217
+
218
+ /** A root field on which the destination and an imported source disagreed. */
219
+ export interface Mismatch {
220
+ kind: 'versionNumber' | 'featureFlag' | 'typeVersion'
221
+ /** The flag or type name. Absent for `versionNumber`. */
222
+ name?: string
223
+ /** The destination's value before the import; absent when it had none. */
224
+ destination?: string
225
+ /** The source's value; absent when it had none. */
226
+ source?: string
227
+ }
228
+
99
229
  export interface NewComponent {
100
230
  /** Position in `Slot.components()`. */
101
231
  index: number
package/index.js CHANGED
@@ -89,8 +89,8 @@ function requireNative() {
89
89
  try {
90
90
  const binding = require('@frdt/binding-android-arm64')
91
91
  const bindingPackageVersion = require('@frdt/binding-android-arm64/package.json').version
92
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
93
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
92
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
93
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
94
94
  }
95
95
  return binding
96
96
  } catch (e) {
@@ -105,8 +105,8 @@ function requireNative() {
105
105
  try {
106
106
  const binding = require('@frdt/binding-android-arm-eabi')
107
107
  const bindingPackageVersion = require('@frdt/binding-android-arm-eabi/package.json').version
108
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
109
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
108
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
109
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
110
110
  }
111
111
  return binding
112
112
  } catch (e) {
@@ -126,8 +126,8 @@ function requireNative() {
126
126
  try {
127
127
  const binding = require('@frdt/binding-win32-x64-gnu')
128
128
  const bindingPackageVersion = require('@frdt/binding-win32-x64-gnu/package.json').version
129
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
130
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
129
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
130
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
131
131
  }
132
132
  return binding
133
133
  } catch (e) {
@@ -142,8 +142,8 @@ function requireNative() {
142
142
  try {
143
143
  const binding = require('@frdt/binding-win32-x64-msvc')
144
144
  const bindingPackageVersion = require('@frdt/binding-win32-x64-msvc/package.json').version
145
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
146
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
145
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
146
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
147
147
  }
148
148
  return binding
149
149
  } catch (e) {
@@ -159,8 +159,8 @@ function requireNative() {
159
159
  try {
160
160
  const binding = require('@frdt/binding-win32-ia32-msvc')
161
161
  const bindingPackageVersion = require('@frdt/binding-win32-ia32-msvc/package.json').version
162
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
162
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
164
164
  }
165
165
  return binding
166
166
  } catch (e) {
@@ -175,8 +175,8 @@ function requireNative() {
175
175
  try {
176
176
  const binding = require('@frdt/binding-win32-arm64-msvc')
177
177
  const bindingPackageVersion = require('@frdt/binding-win32-arm64-msvc/package.json').version
178
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
179
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
178
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
179
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
180
180
  }
181
181
  return binding
182
182
  } catch (e) {
@@ -194,8 +194,8 @@ function requireNative() {
194
194
  try {
195
195
  const binding = require('@frdt/binding-darwin-universal')
196
196
  const bindingPackageVersion = require('@frdt/binding-darwin-universal/package.json').version
197
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
198
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
197
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
198
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
199
199
  }
200
200
  return binding
201
201
  } catch (e) {
@@ -210,8 +210,8 @@ function requireNative() {
210
210
  try {
211
211
  const binding = require('@frdt/binding-darwin-x64')
212
212
  const bindingPackageVersion = require('@frdt/binding-darwin-x64/package.json').version
213
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
214
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
213
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
214
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
215
215
  }
216
216
  return binding
217
217
  } catch (e) {
@@ -226,8 +226,8 @@ function requireNative() {
226
226
  try {
227
227
  const binding = require('@frdt/binding-darwin-arm64')
228
228
  const bindingPackageVersion = require('@frdt/binding-darwin-arm64/package.json').version
229
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
230
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
229
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
230
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
231
231
  }
232
232
  return binding
233
233
  } catch (e) {
@@ -246,8 +246,8 @@ function requireNative() {
246
246
  try {
247
247
  const binding = require('@frdt/binding-freebsd-x64')
248
248
  const bindingPackageVersion = require('@frdt/binding-freebsd-x64/package.json').version
249
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
250
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
249
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
250
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
251
251
  }
252
252
  return binding
253
253
  } catch (e) {
@@ -262,8 +262,8 @@ function requireNative() {
262
262
  try {
263
263
  const binding = require('@frdt/binding-freebsd-arm64')
264
264
  const bindingPackageVersion = require('@frdt/binding-freebsd-arm64/package.json').version
265
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
265
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
267
267
  }
268
268
  return binding
269
269
  } catch (e) {
@@ -283,8 +283,8 @@ function requireNative() {
283
283
  try {
284
284
  const binding = require('@frdt/binding-linux-x64-musl')
285
285
  const bindingPackageVersion = require('@frdt/binding-linux-x64-musl/package.json').version
286
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
286
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
288
288
  }
289
289
  return binding
290
290
  } catch (e) {
@@ -299,8 +299,8 @@ function requireNative() {
299
299
  try {
300
300
  const binding = require('@frdt/binding-linux-x64-gnu')
301
301
  const bindingPackageVersion = require('@frdt/binding-linux-x64-gnu/package.json').version
302
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
303
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
302
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
303
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
304
304
  }
305
305
  return binding
306
306
  } catch (e) {
@@ -317,8 +317,8 @@ function requireNative() {
317
317
  try {
318
318
  const binding = require('@frdt/binding-linux-arm64-musl')
319
319
  const bindingPackageVersion = require('@frdt/binding-linux-arm64-musl/package.json').version
320
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
321
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
320
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
321
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
322
322
  }
323
323
  return binding
324
324
  } catch (e) {
@@ -333,8 +333,8 @@ function requireNative() {
333
333
  try {
334
334
  const binding = require('@frdt/binding-linux-arm64-gnu')
335
335
  const bindingPackageVersion = require('@frdt/binding-linux-arm64-gnu/package.json').version
336
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
337
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
336
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
337
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
338
338
  }
339
339
  return binding
340
340
  } catch (e) {
@@ -351,8 +351,8 @@ function requireNative() {
351
351
  try {
352
352
  const binding = require('@frdt/binding-linux-arm-musleabihf')
353
353
  const bindingPackageVersion = require('@frdt/binding-linux-arm-musleabihf/package.json').version
354
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
355
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
354
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
355
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
356
356
  }
357
357
  return binding
358
358
  } catch (e) {
@@ -367,8 +367,8 @@ function requireNative() {
367
367
  try {
368
368
  const binding = require('@frdt/binding-linux-arm-gnueabihf')
369
369
  const bindingPackageVersion = require('@frdt/binding-linux-arm-gnueabihf/package.json').version
370
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
371
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
370
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
371
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
372
372
  }
373
373
  return binding
374
374
  } catch (e) {
@@ -385,8 +385,8 @@ function requireNative() {
385
385
  try {
386
386
  const binding = require('@frdt/binding-linux-loong64-musl')
387
387
  const bindingPackageVersion = require('@frdt/binding-linux-loong64-musl/package.json').version
388
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
389
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
388
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
389
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
390
390
  }
391
391
  return binding
392
392
  } catch (e) {
@@ -401,8 +401,8 @@ function requireNative() {
401
401
  try {
402
402
  const binding = require('@frdt/binding-linux-loong64-gnu')
403
403
  const bindingPackageVersion = require('@frdt/binding-linux-loong64-gnu/package.json').version
404
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
405
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
404
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
405
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
406
406
  }
407
407
  return binding
408
408
  } catch (e) {
@@ -419,8 +419,8 @@ function requireNative() {
419
419
  try {
420
420
  const binding = require('@frdt/binding-linux-riscv64-musl')
421
421
  const bindingPackageVersion = require('@frdt/binding-linux-riscv64-musl/package.json').version
422
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
423
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
422
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
423
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
424
424
  }
425
425
  return binding
426
426
  } catch (e) {
@@ -435,8 +435,8 @@ function requireNative() {
435
435
  try {
436
436
  const binding = require('@frdt/binding-linux-riscv64-gnu')
437
437
  const bindingPackageVersion = require('@frdt/binding-linux-riscv64-gnu/package.json').version
438
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
439
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
438
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
439
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
440
440
  }
441
441
  return binding
442
442
  } catch (e) {
@@ -452,8 +452,8 @@ function requireNative() {
452
452
  try {
453
453
  const binding = require('@frdt/binding-linux-ppc64-gnu')
454
454
  const bindingPackageVersion = require('@frdt/binding-linux-ppc64-gnu/package.json').version
455
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
456
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
455
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
456
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
457
457
  }
458
458
  return binding
459
459
  } catch (e) {
@@ -468,8 +468,8 @@ function requireNative() {
468
468
  try {
469
469
  const binding = require('@frdt/binding-linux-s390x-gnu')
470
470
  const bindingPackageVersion = require('@frdt/binding-linux-s390x-gnu/package.json').version
471
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
472
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
471
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
472
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
473
473
  }
474
474
  return binding
475
475
  } catch (e) {
@@ -488,8 +488,8 @@ function requireNative() {
488
488
  try {
489
489
  const binding = require('@frdt/binding-openharmony-arm64')
490
490
  const bindingPackageVersion = require('@frdt/binding-openharmony-arm64/package.json').version
491
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
492
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
491
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
492
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
493
493
  }
494
494
  return binding
495
495
  } catch (e) {
@@ -504,8 +504,8 @@ function requireNative() {
504
504
  try {
505
505
  const binding = require('@frdt/binding-openharmony-x64')
506
506
  const bindingPackageVersion = require('@frdt/binding-openharmony-x64/package.json').version
507
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
508
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
507
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
508
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
509
509
  }
510
510
  return binding
511
511
  } catch (e) {
@@ -520,8 +520,8 @@ function requireNative() {
520
520
  try {
521
521
  const binding = require('@frdt/binding-openharmony-arm')
522
522
  const bindingPackageVersion = require('@frdt/binding-openharmony-arm/package.json').version
523
- if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
524
- throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
523
+ if (bindingPackageVersion !== '0.2.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
524
+ throw new Error(`Native binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
525
525
  }
526
526
  return binding
527
527
  } catch (e) {
@@ -661,8 +661,8 @@ if (!nativeBinding || forceWasi) {
661
661
  if (!candidateFailed) {
662
662
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
663
663
  const bindingPackageVersion = require('@frdt/binding-wasm32-wasi/package.json').version
664
- if (bindingPackageVersion !== '0.2.1') {
665
- throw new Error(`WASI binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
664
+ if (bindingPackageVersion !== '0.2.3') {
665
+ throw new Error(`WASI binding package version mismatch, expected 0.2.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
666
666
  }
667
667
  }
668
668
  wasiBinding = require('@frdt/binding-wasm32-wasi')
@@ -779,7 +779,10 @@ function __napiStampBindingTarget(exportsObject, target) {
779
779
  module.exports.__napiBindingTarget = __napiStampBindingTarget(nativeBinding, __napiLoadedBindingTarget)
780
780
  module.exports = nativeBinding
781
781
  module.exports.Document = nativeBinding.Document
782
+ module.exports.Extract = nativeBinding.Extract
782
783
  module.exports.Import = nativeBinding.Import
783
784
  module.exports.Slot = nativeBinding.Slot
785
+ module.exports.compare = nativeBinding.compare
786
+ module.exports.compareVersions = nativeBinding.compareVersions
784
787
  module.exports.summarize = nativeBinding.summarize
785
788
  module.exports.versionDate = nativeBinding.versionDate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frdt/frdt",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Read and edit Resonite .brson (FrDT) files without expanding them into JSON",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -31,9 +31,9 @@
31
31
  "@napi-rs/wasm-runtime": "^1.2.4"
32
32
  },
33
33
  "optionalDependencies": {
34
- "@frdt/binding-win32-x64-msvc": "0.2.1",
35
- "@frdt/binding-linux-x64-gnu": "0.2.1",
36
- "@frdt/binding-linux-x64-musl": "0.2.1",
37
- "@frdt/binding-darwin-arm64": "0.2.1"
34
+ "@frdt/binding-win32-x64-msvc": "0.2.3",
35
+ "@frdt/binding-linux-x64-gnu": "0.2.3",
36
+ "@frdt/binding-linux-x64-musl": "0.2.3",
37
+ "@frdt/binding-darwin-arm64": "0.2.3"
38
38
  }
39
39
  }