@arborium/dockerfile 2.10.0 → 2.12.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/grammar.js CHANGED
@@ -191,9 +191,10 @@ export function language_id() {
191
191
  }
192
192
 
193
193
  /**
194
- * Parses the text in a session and returns the result as a JS value.
194
+ * Parses the text in a session and returns spans with UTF-8 byte offsets.
195
195
  *
196
- * The result is a JavaScript object representation of ParseResult containing spans and injections.
196
+ * Use this for Rust code that needs to slice strings with `&source[start..end]`.
197
+ * For JavaScript interop, use `parse_utf16` instead.
197
198
  * @param {number} session
198
199
  * @returns {any}
199
200
  */
@@ -213,6 +214,30 @@ export function parse(session) {
213
214
  }
214
215
  }
215
216
 
217
+ /**
218
+ * Parses the text in a session and returns spans with UTF-16 code unit indices.
219
+ *
220
+ * Use this for JavaScript code that needs to use `String.prototype.slice()`.
221
+ * The offsets are compatible with JavaScript string APIs.
222
+ * @param {number} session
223
+ * @returns {any}
224
+ */
225
+ export function parse_utf16(session) {
226
+ try {
227
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
228
+ wasm.parse_utf16(retptr, session);
229
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
230
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
231
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
232
+ if (r2) {
233
+ throw takeObject(r1);
234
+ }
235
+ return takeObject(r0);
236
+ } finally {
237
+ wasm.__wbindgen_add_to_stack_pointer(16);
238
+ }
239
+ }
240
+
216
241
  /**
217
242
  * Sets the text for a parser session.
218
243
  * @param {number} session
package/grammar_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -42,5 +42,5 @@
42
42
  },
43
43
  "sideEffects": false,
44
44
  "type": "module",
45
- "version": "2.10.0"
45
+ "version": "2.12.0"
46
46
  }