@tinyactors/sxml 0.2.0 → 0.3.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 CHANGED
@@ -71,7 +71,7 @@ not exist (`err:XPST0017`), or the specification's fallback applies.
71
71
  | `full-text` | XQuery and XPath Full Text 3.0: `contains text` and score variables in XPath and XQuery, with stemming, stop words and thesauri |
72
72
  | `dtd-validation` | The `dtd-validation` option of `fn:doc` and `fn:parse-xml` |
73
73
  | `builtin-schemas` | The schemas that `fn:json-to-xml` with `validate`, the typed results of `fn:analyze-string`, and lax validation without an in-scope schema use |
74
- | `source-code` | `sxml:parse-code` and `sxml:code-languages` (namespace `urn:sxml`): source code in JSON, JavaScript, TypeScript, TSX, Python, C, CSS, HTML, Go or Markdown as a document of its syntax tree, with highlights and code inside code, and any other tree-sitter language from its WebAssembly file (see [Code languages](#code-languages)) |
74
+ | `source-code` | `tree-sitter:parse` and `tree-sitter:languages` (namespace `urn:sxml:tree-sitter`, prefix `tree-sitter`): source code in JSON, JavaScript, TypeScript, TSX, Python, C, CSS, HTML, Go or Markdown as a document of its syntax tree, with highlights and code inside code, and any other tree-sitter language from its WebAssembly file (see [Code languages](#code-languages)) |
75
75
  | `uca-collation` | UCA collation URIs (Unicode Collation Algorithm 16.0) over the DUCET, which the package ships; the CLDR root collation and the CLDR tailorings by language when the resolver gives their files (resource kind `'collation-data'`) |
76
76
  | `timezone-database` | IANA time zone names in `fn:civil-timezone` and in the `$place` argument of `fn:format-dateTime` (resource kind `'timezone-data'`) |
77
77
  | `localization` | Month and day names, calendars and number words in other languages in `fn:format-date`, `fn:format-integer` and `xsl:number` (resource kind `'locale-data'`) |
@@ -340,10 +340,101 @@ processor.evaluate('/book/@year instance of attribute(*, xs:gYear)', { context:
340
340
  // 'true()'
341
341
  ```
342
342
 
343
+ ## Schematron validation
344
+
345
+ `processor.compileSchematron(schema, { phase, parameters, baseUri })`
346
+ compiles a Schematron schema (ISO/IEC 19757-3:2025): its text, `{ text,
347
+ uri }`, or `{ uri }`, which the resolver is asked for, as are the
348
+ documents its `include` and `extends href` elements name (kind
349
+ `'xml-document'`). `phase` is a phase id, `'#ALL'`, `'#ANY'` or
350
+ `'#DEFAULT'` (the default); `parameters` gives schema parameters their
351
+ values. If the schema has errors, a `SchemaError` is thrown with every
352
+ one in its `reports`, with codes such as `'schematron:syntax'` or
353
+ `'err:XPST0003'`. The schema's `title`, `schemaVersion`,
354
+ `schematronEdition`, `queryBinding` and `phase` are on the result, and
355
+ its `warnings`: reports with the code `'schematron:compatibility'` for
356
+ the deviations of real rule sets that are read as meant (a parameter
357
+ named twice in one pattern instance, a pattern's `let` read by another
358
+ pattern, a rule's `let` after its assertions).
359
+
360
+ `schematron.validate(input, { uri, firedRules, svrl })` checks XML text
361
+ (parsed with its locations) or a node and gives `{ valid, phase,
362
+ findings, svrl }`. Each finding has its `kind`, `id`, `role`, `flag`,
363
+ `severity`, `isError`, `message`, `diagnostics`, `properties`,
364
+ `patternId`, `test`, `path`, the `document` its node is in (the URI of
365
+ a subordinate document for a pattern with `documents`), the node's
366
+ `lineNumber` and `columnNumber` there,
367
+ and the assertion's `schemaLineNumber` and `schemaColumnNumber`. `valid`
368
+ is false when a finding is an error: its severity is `fatal` or
369
+ `error`, or without a severity its role or a flag is, or it has neither.
370
+
371
+ ```js
372
+ const rules = processor.compileSchematron(`
373
+ <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron">
374
+ <sch:pattern>
375
+ <sch:rule context="line">
376
+ <sch:assert test="@quantity > 0" id="positive">A line orders at least one item.</sch:assert>
377
+ </sch:rule>
378
+ </sch:pattern>
379
+ </sch:schema>`);
380
+ const result = rules.validate('<order>\n<line quantity="0"/>\n</order>');
381
+ result.valid; // false
382
+ result.findings.map(({ id, lineNumber, message }) => `${lineNumber} ${id}: ${message}`);
383
+ // ['2 positive: A line orders at least one item.']
384
+ ```
385
+
386
+ A stylesheet with errors also throws a `SchemaError` from
387
+ `compileStylesheet`, with every error in `reports`.
388
+
389
+ ## EXI
390
+
391
+ `processor.encodeExi(node, options)` encodes a document or element node as
392
+ an EXI stream (Efficient XML Interchange 1.0) and returns its bytes as a
393
+ `Uint8Array`. `processor.parseExi(stream, options)` decodes a stream into a
394
+ new document and returns its document node, as `parse` does for XML text;
395
+ `options.uri` is its document URI. A stream that is not EXI throws an
396
+ `SxmlError` with status `'MALFORMED_INPUT'`.
397
+
398
+ The options are EXI's (section 5.4). Each option that is left out has its
399
+ default: bit-packed, nothing preserved, a document, no limits on the
400
+ string tables, and the built-in grammars.
401
+
402
+ - `alignment`: `'bit-packed'` (the default), `'byte-alignment'`,
403
+ `'pre-compression'` or `'compression'` (DEFLATE).
404
+ - `preserve`: a list of `'comments'`, `'pis'`, `'dtd'`, `'prefixes'` and
405
+ `'lexical-values'`. Without `'prefixes'`, the decoder names prefixes
406
+ `ns0`, `ns1` and so on.
407
+ - `fragment`, `strict`, `selfContained`: booleans.
408
+ - `blockSize`, `valueMaxLength`, `valuePartitionCapacity`: integers.
409
+ - `includeCookie`, `includeOptions`, `includeSchemaId` (encoding only):
410
+ the `$EXI` cookie, the options in the header, the schemaId among them.
411
+ - `canonical`, with `omitOptionsDocument` and `utcTime` (encoding only):
412
+ Canonical EXI, one stream for one document and one set of options.
413
+ - `selfContainedElements` (encoding only, with `selfContained`): the
414
+ names of the elements written so that each can be read on its own, an
415
+ NCName or `Q{uri}local` each.
416
+ - `schema`: a `Schema` of the same processor, for schema-informed grammars.
417
+
418
+ A stream whose header has no options is decoded with the options given to
419
+ `parseExi`, which must be the options that it was encoded with. An unknown
420
+ `alignment` or `preserve` item throws a `TypeError`; a count that is not an
421
+ integer from 0 to 2^32 - 1 throws a `RangeError`. In XPath and XQuery, the
422
+ functions `exi:serialize` and `exi:parse` do the same (the prefix `exi` is
423
+ bound to `urn:sxml:exi`).
424
+
425
+ ```js
426
+ const order = processor.parse('<order id="A-1"><line sku="KB-104">2</line><!-- note --></order>');
427
+ const stream = processor.encodeExi(order, { alignment: 'byte-alignment', preserve: ['comments'] });
428
+ processor.parseExi(stream, { alignment: 'byte-alignment', preserve: ['comments'] })
429
+ .serialize({ method: 'xml', omitXmlDeclaration: true });
430
+ // '<order id="A-1"><line sku="KB-104">2</line><!-- note --></order>'
431
+ ```
432
+
343
433
  ## Code languages
344
434
 
345
- `sxml:parse-code` (the `source-code` feature; the prefix `sxml` is bound
346
- to `urn:sxml`) parses a dozen languages built in. Any other tree-sitter
435
+ `tree-sitter:parse` (the `source-code` feature; the prefix `tree-sitter`
436
+ is bound to `urn:sxml:tree-sitter`, and `sxml`, of the `sxml:token`
437
+ elements, to `urn:sxml`) parses a dozen languages built in. Any other tree-sitter
347
438
  grammar can be loaded from its WebAssembly language file,
348
439
  `tree-sitter-NAME.wasm`, as `tree-sitter build --wasm` writes it (many
349
440
  grammar repositories ship it with their releases), together with the
@@ -357,7 +448,7 @@ const rust = await sxml.loadCodeLanguage({
357
448
  });
358
449
  rust.name; // 'rust', from the file's tree_sitter_rust()
359
450
  const processor = sxml.createProcessor({ codeLanguages: [rust] });
360
- processor.evaluate('sxml:parse-code("fn main() {}", "rust")//function_item/identifier ! string()');
451
+ processor.evaluate('tree-sitter:parse("fn main() {}", "rust")//function_item/identifier ! string()');
361
452
  ```
362
453
 
363
454
  `loadCodeLanguage` links the file into the running `sxml.wasm`: the
@@ -445,6 +536,23 @@ default bound, while a loop that reads no more input still stops (D295).
445
536
  const processor = sxml.createProcessor({ maximumEvaluationStepCount: 1_000_000_000 });
446
537
  ```
447
538
 
539
+ ## Source locations
540
+
541
+ `fn:location` gives the line and column of a node of a parsed document
542
+ when the document kept them. `createProcessor({ locations })` decides
543
+ which do: `'automatic'` (the default) keeps them for a document parsed
544
+ before any program is compiled with the processor, and for the
545
+ documents of a program that can ask for them (it calls `fn:location`,
546
+ can look up functions with `fn:function-lookup`, `fn:transform` or
547
+ `xsl:evaluate`, or validates); `'always'` keeps them for every document;
548
+ `'never'` for none. They cost 32 bytes a node (D313, D318).
549
+
550
+ ```js
551
+ const processor = sxml.createProcessor({ locations: 'always' });
552
+ const book = processor.parse('<book>\n <title>XPath</title>\n</book>');
553
+ processor.evaluate('location(//title)?line-number', { context: book }).toString(); // '2'
554
+ ```
555
+
448
556
  ## Memory
449
557
 
450
558
  Processors, expressions, queries, stylesheets, schemas and values own
@@ -460,7 +568,7 @@ documents) are yours to dispose.
460
568
  | --- | --- |
461
569
  | `load({ wasm, collationData })` | Loads a module; returns an `Sxml` |
462
570
  | `Sxml.version`, `Sxml.features` | The library version and the module's optional features |
463
- | `Sxml.createProcessor({ resolver, features, codeLanguages, outputChunkByteCount, maximumEvaluationStepCount })` | A new `Processor` |
571
+ | `Sxml.createProcessor({ resolver, features, codeLanguages, outputChunkByteCount, maximumEvaluationStepCount, locations })` | A new `Processor` |
464
572
  | `Sxml.loadCodeLanguage({ wasm, name, highlights, locals, injections, injectionRegex })` | A `CodeLanguage` (`name`, `abiVersion`) from a tree-sitter WebAssembly language file |
465
573
  | `Processor.parse(xml, { uri })` | A document node |
466
574
  | `Processor.compile(expression, options)` | An `XPathExpression`, with `evaluate(options)` and `variables` |
@@ -468,6 +576,8 @@ documents) are yours to dispose.
468
576
  | `Processor.compileQuery(text, options)` | An `XQuery`, with `evaluate`, `serialize`, `run` and `isUpdating` |
469
577
  | `Processor.compileStylesheet(text, options)` | A `Stylesheet`, with `transform` |
470
578
  | `Processor.compileSchema(documents, options)` | A `Schema`, with `validate` |
579
+ | `Processor.compileSchematron(schema, options)` | A `Schematron`, with `validate` and its `title`, `phase` and edition |
580
+ | `Processor.encodeExi(node, options)`, `Processor.parseExi(stream, options)` | An EXI stream of a node, and the document of a stream |
471
581
  | `Processor.value(data)` | JavaScript data as a value |
472
582
  | `Processor.serialize(value, options)` | The same as `value.serialize(options)` |
473
583
  | `Value.toString()`, `Value.serialize(options)` | The value's text |
package/dist/index.d.ts CHANGED
@@ -57,7 +57,7 @@ export interface ProcessorOptions {
57
57
  * feature, sxml behaves as the specifications say a processor without
58
58
  * it does. */
59
59
  features?: string[];
60
- /** tree-sitter languages for sxml:parse-code beside the built-in ones,
60
+ /** tree-sitter languages for tree-sitter:parse beside the built-in ones,
61
61
  * loaded with Sxml.loadCodeLanguage; one with a built-in language's
62
62
  * name replaces it. Default: none. */
63
63
  codeLanguages?: CodeLanguage[];
@@ -70,6 +70,14 @@ export interface ProcessorOptions {
70
70
  * seconds of work. A streamed document grants 500 steps more for each
71
71
  * element it reads, so long streams run within it (D295). */
72
72
  maximumEvaluationStepCount?: number;
73
+ /** Which documents keep the line and column of each node, for
74
+ * fn:location and for errors that name a node (the C processor setting
75
+ * source_location_policy; D313, D318): 'automatic', the default, keeps
76
+ * them for a document parsed before any program is compiled and for
77
+ * the documents of a program that can ask (it calls fn:location, can
78
+ * look up functions or validates); 'always'; 'never'. They cost 32
79
+ * bytes a node. */
80
+ locations?: 'automatic' | 'always' | 'never';
73
81
  /** For tests: fail this allocation (counted from 1) with out of memory. */
74
82
  failingAllocationNumber?: number;
75
83
  }
@@ -79,7 +87,7 @@ export interface CodeLanguageOptions {
79
87
  * (tree-sitter-NAME.wasm): a URL or path, the bytes, a compiled
80
88
  * module, or a fetch Response. */
81
89
  wasm: WasmSource;
82
- /** The language's name in sxml:parse-code: ASCII letters, digits, '_',
90
+ /** The language's name in tree-sitter:parse: ASCII letters, digits, '_',
83
91
  * '-', '+' and '.'. Default: NAME of the file's tree_sitter_NAME
84
92
  * function. */
85
93
  name?: string;
@@ -305,6 +313,138 @@ export interface ValidationResult {
305
313
  * annotated with their types (XDM 4.0, 3.3). */
306
314
  document: Value | undefined;
307
315
  }
316
+ export interface SchematronCompileOptions {
317
+ /** The phase: an id, '#ALL', '#ANY' (each validation takes the first
318
+ * phase whose when holds for the document) or '#DEFAULT' (the
319
+ * default: the schema's defaultPhase, else '#ALL'). */
320
+ phase?: string;
321
+ /** Against which a schema given by URI resolves. */
322
+ baseUri?: string;
323
+ /** Values of schema parameters by name: query fragments, each put in
324
+ * place of its param's value. */
325
+ parameters?: Record<string, string>;
326
+ }
327
+ export interface SchematronValidateOptions {
328
+ /** The document URI of text input. */
329
+ uri?: string;
330
+ /** Also list each rule that fires, as a finding of kind 'fired-rule'. */
331
+ firedRules?: boolean;
332
+ /** Also give the SVRL report (ISO/IEC 19757-3, annex D). */
333
+ svrl?: boolean;
334
+ }
335
+ /** A diagnostic an assertion names, evaluated for the finding. */
336
+ export interface SchematronDiagnostic {
337
+ id: string;
338
+ language: string;
339
+ text: string;
340
+ }
341
+ /** A property an assertion names, evaluated for the finding. */
342
+ export interface SchematronProperty {
343
+ id: string;
344
+ role: string;
345
+ scheme: string;
346
+ text: string;
347
+ }
348
+ /** A failed assert, a successful report, or (with firedRules) a rule that
349
+ * fired. Empty strings for attributes the assertion does not have. */
350
+ export interface SchematronFinding {
351
+ kind: 'failed-assert' | 'successful-report' | 'fired-rule';
352
+ id: string;
353
+ role: string;
354
+ flag: string;
355
+ severity: string;
356
+ /** An error finding: its severity is 'fatal' or 'error'; without one,
357
+ * its role or a flag is, or it has neither role nor flag. */
358
+ isError: boolean;
359
+ message: string;
360
+ diagnostics: SchematronDiagnostic[];
361
+ properties: SchematronProperty[];
362
+ patternId: string;
363
+ /** The test as compiled, placeholders replaced. */
364
+ test: string;
365
+ /** The subject node as fn:path gives it. */
366
+ path: string;
367
+ /** The node's place in the document (0 when the tree keeps none). */
368
+ sourceName: string;
369
+ /** The URI of the document the node is in: a subordinate document's for
370
+ * a pattern with documents, or one a rule read with doc(); else the
371
+ * validated document's (empty when it has none). lineNumber and
372
+ * columnNumber are of this document. */
373
+ document: string;
374
+ lineNumber: number;
375
+ columnNumber: number;
376
+ /** The assertion's place in the Schematron schema. */
377
+ schemaSourceName: string;
378
+ schemaLineNumber: number;
379
+ schemaColumnNumber: number;
380
+ }
381
+ export interface SchematronResult {
382
+ /** No error finding. */
383
+ valid: boolean;
384
+ /** The phase in force (under '#ANY', the one chosen). */
385
+ phase: string;
386
+ findings: SchematronFinding[];
387
+ /** With options.svrl. */
388
+ svrl?: string;
389
+ }
390
+ /** The EXI options of Processor.encodeExi and Processor.parseExi
391
+ * (Efficient XML Interchange 1.0, section 5.4). Every option left out has
392
+ * its EXI default: bit-packed, nothing preserved, not strict, a document,
393
+ * unbounded string tables, built-in grammars. In parseExi, a stream whose
394
+ * header carries its options is read with those instead. */
395
+ export interface ExiOptions {
396
+ /** How events and values are laid out (EXI 1.0, 5.4 and 9): 'bit-packed'
397
+ * (default), 'byte-alignment', 'pre-compression' (values in channels,
398
+ * not compressed) or 'compression' (the channels compressed with
399
+ * DEFLATE). */
400
+ alignment?: 'bit-packed' | 'byte-alignment' | 'pre-compression' | 'compression';
401
+ /** The fidelity options (EXI 1.0, 6.3): what the stream keeps besides
402
+ * elements, attributes and text. 'dtd' writes nothing from a tree,
403
+ * which has no document type declaration; without 'prefixes' a decoder
404
+ * names the prefixes ns0, ns1 and so on. */
405
+ preserve?: ('comments' | 'pis' | 'dtd' | 'prefixes' | 'lexical-values')[];
406
+ /** A fragment (EXI 1.0, 8.4.2): zero or more elements, comments and
407
+ * processing instructions, not a document. */
408
+ fragment?: boolean;
409
+ /** strict: schema-informed grammars without their undeclared
410
+ * productions; it means nothing with the built-in grammars. */
411
+ strict?: boolean;
412
+ /** selfContained: self-contained elements are allowed (EXI 1.0,
413
+ * 8.5.4.4.1). */
414
+ selfContained?: boolean;
415
+ /** blockSize: the values per compression block (default 1,000,000). */
416
+ blockSize?: number;
417
+ /** valueMaxLength: the longest value the string tables keep (default
418
+ * unbounded). */
419
+ valueMaxLength?: number;
420
+ /** valuePartitionCapacity: how many values the global string table
421
+ * keeps (default unbounded). */
422
+ valuePartitionCapacity?: number;
423
+ /** encodeExi: the header starts with the EXI cookie '$EXI' (EXI 1.0,
424
+ * 5.1). */
425
+ includeCookie?: boolean;
426
+ /** encodeExi: the header carries the options, so that a decoder need
427
+ * not know them. */
428
+ includeOptions?: boolean;
429
+ /** encodeExi: the stream is Canonical EXI (W3C Recommendation 7 June
430
+ * 2018). */
431
+ canonical?: boolean;
432
+ /** encodeExi: the header's options name the schemaId (EXI 1.0, 5.4). */
433
+ includeSchemaId?: boolean;
434
+ /** encodeExi, with canonical: the header leaves the options document
435
+ * out (Canonical EXI, omitOptionsDocument). */
436
+ omitOptionsDocument?: boolean;
437
+ /** encodeExi, with canonical: date-times are written in UTC (Canonical
438
+ * EXI, utcTime). */
439
+ utcTime?: boolean;
440
+ /** encodeExi, with selfContained: the elements written self-contained,
441
+ * so that each can be read on its own (EXI 1.0, 8.5.4.4.1), each an
442
+ * NCName in no namespace or Q{uri}local. */
443
+ selfContainedElements?: string[];
444
+ /** Schema-informed grammars from a compiled schema of this processor
445
+ * (Processor.compileSchema); without it the built-in grammars. */
446
+ schema?: Schema;
447
+ }
308
448
  /** A failure in sxml: a static, dynamic or type error of the expression
309
449
  * (with its error code), a document that is not well-formed, a limit, or
310
450
  * out of memory. */
@@ -352,7 +492,7 @@ export declare class Sxml {
352
492
  /**
353
493
  * Loads a tree-sitter language file (tree-sitter-NAME.wasm, as
354
494
  * `tree-sitter build --wasm` writes it) into this module for
355
- * sxml:parse-code: links it into sxml.wasm (src/linker.ts) and checks
495
+ * tree-sitter:parse: links it into sxml.wasm (src/linker.ts) and checks
356
496
  * its ABI and queries. Give it to processors with createProcessor({
357
497
  * codeLanguages }). It stays loaded as long as this Sxml. Rejects with
358
498
  * an Error that says what is wrong with the file, the name or a query.
@@ -362,7 +502,7 @@ export declare class Sxml {
362
502
  /** A tree-sitter language loaded by Sxml.loadCodeLanguage, for
363
503
  * createProcessor({ codeLanguages }). */
364
504
  export declare class CodeLanguage {
365
- /** Its name in sxml:parse-code. */
505
+ /** Its name in tree-sitter:parse. */
366
506
  readonly name: string;
367
507
  /** The grammar's tree-sitter language ABI, 13 to 15. */
368
508
  readonly abiVersion: number;
@@ -388,7 +528,9 @@ export declare class Processor {
388
528
  compileQuery(query: string, options?: QueryCompileOptions): XQuery;
389
529
  /** Compiles an XSLT 4.0 stylesheet, with the modules it includes and
390
530
  * imports (kind 'xslt-module') and the packages it uses (kind
391
- * 'xslt-package'), for running it many times. */
531
+ * 'xslt-package'), for running it many times. A stylesheet with errors
532
+ * throws a SchemaError with every error as its reports (codes with
533
+ * their prefix, such as 'err:XPST0003'). */
392
534
  compileStylesheet(stylesheet: string | Uint8Array, options?: StylesheetCompileOptions): Stylesheet;
393
535
  /** Compiles an XSD 1.1 schema from one or more schema documents (a
394
536
  * string is a document's text), with every document they include,
@@ -396,6 +538,14 @@ export declare class Processor {
396
538
  * 'schema-document'). Throws a SchemaError with every report when the
397
539
  * schema has errors. */
398
540
  compileSchema(documents: string | SchemaDocument | (string | SchemaDocument)[], options?: SchemaCompileOptions): Schema;
541
+ /** Compiles a Schematron schema (ISO/IEC 19757-3:2025) from its text or
542
+ * its URI (the resolver is asked, kind 'xml-document', for it and for
543
+ * the documents its include and extends href name), for the phase
544
+ * options.phase names (an id, '#ALL', '#ANY', or '#DEFAULT', the
545
+ * default) with the schema parameters options.parameters gives. Throws a
546
+ * SchemaError with every error when it does not compile (codes such as
547
+ * 'schematron:syntax', 'err:XPST0003'). */
548
+ compileSchematron(schema: string | SchemaDocument, options?: SchematronCompileOptions): Schematron;
399
549
  /** Converts JSON-like data to a value (see JsonData). */
400
550
  value(data: Input): Value;
401
551
  /** Serializes a value: by the adaptive method without options, else as
@@ -404,6 +554,21 @@ export declare class Processor {
404
554
  /** Serializes a value as serialize() does, writing the output to sink a
405
555
  * chunk at a time instead of returning it (D294). */
406
556
  serializeTo(value: Value, sink: OutputSink, options?: SerializationOptions): void;
557
+ /** Encodes a document or element node as an EXI stream (Efficient XML
558
+ * Interchange 1.0) with options: by default bit-packed, with the
559
+ * built-in grammars, keeping elements, attributes and text only. Throws
560
+ * a TypeError or RangeError for options it does not take, and an
561
+ * SxmlError for a value that is not one document or element node or
562
+ * content the options cannot represent. */
563
+ encodeExi(node: Value, options?: ExiOptions): Uint8Array;
564
+ /** Decodes an EXI stream into a new document and returns its document
565
+ * node, as parse() does for XML text. options are those the stream was
566
+ * encoded with, needed when its header does not carry them;
567
+ * options.uri is the document URI. A stream that is not EXI throws an
568
+ * SxmlError with status 'MALFORMED_INPUT'. */
569
+ parseExi(stream: Uint8Array, options?: ExiOptions & {
570
+ uri?: string;
571
+ }): Value;
407
572
  /** Releases the processor and every value and expression made with it. */
408
573
  dispose(): void;
409
574
  /** The allocations the processor holds, for leak checks in tests; after
@@ -471,6 +636,30 @@ export declare class Schema {
471
636
  * is not well-formed throws, as Processor.parse does. */
472
637
  validate(input: Value | string | Uint8Array, options?: ValidateOptions): ValidationResult;
473
638
  dispose(): void;
639
+ }
640
+ /** A compiled Schematron schema (include/sxml/schematron.h).
641
+ * Processor.compileSchematron makes it. */
642
+ export declare class Schematron {
643
+ readonly processor: Processor;
644
+ private handle;
645
+ /** The schema's title, schemaVersion, schematronEdition (any value, as
646
+ * written) and queryBinding; empty when absent. */
647
+ title: string;
648
+ schemaVersion: string;
649
+ schematronEdition: string;
650
+ queryBinding: string;
651
+ /** The phase compiled ('#DEFAULT' resolved). */
652
+ phase: string;
653
+ /** The schema's warnings (code 'schematron:compatibility'): a parameter
654
+ * named twice in one pattern instance, a pattern's let read by another
655
+ * pattern, a rule's let after its assertions. Read as their authors
656
+ * mean them; each names the clause it deviates from. */
657
+ warnings: readonly SchemaReport[];
658
+ /** Validates a document: XML text, parsed with its locations, or a node
659
+ * of this processor. Findings are not exceptions: see the result. A
660
+ * dynamic error in the rules, or text that is not well-formed, throws. */
661
+ validate(input: Value | string | Uint8Array, options?: SchematronValidateOptions): SchematronResult;
662
+ dispose(): void;
474
663
  private address;
475
664
  }
476
665
  /** An XDM value: a sequence of items in its processor (a parsed document,
package/dist/index.js CHANGED
@@ -11,7 +11,8 @@
11
11
  //
12
12
  // The one module has every language and every optional feature (D272):
13
13
  // XQuery 4.0 (Processor.compileQuery), XSLT 4.0 (Processor.compileStylesheet)
14
- // and XSD 1.1 validation (Processor.compileSchema) besides XPath.
14
+ // and XSD 1.1 validation (Processor.compileSchema) besides XPath, and EXI
15
+ // (Processor.encodeExi and Processor.parseExi, D333).
15
16
  //
16
17
  // Every object that owns memory in the module (Processor, XPathExpression,
17
18
  // XQuery, Stylesheet, Schema, Value) has dispose(); one that is never disposed is released when it is
@@ -21,6 +22,63 @@ import { linkLanguageModule } from "./linker.js";
21
22
  import { ChunkReader, OutputRouter, readWhole, } from "./stream.js";
22
23
  import { wasiImports } from "./wasi.js";
23
24
  export { nodeStreamSink, outputReadableStream, textSink, writableStreamSink, } from "./stream.js";
25
+ /** The alignments of ExiOptions, in sxml_exi_alignment's order. */
26
+ const exi_alignments = ['bit-packed', 'byte-alignment', 'pre-compression', 'compression'];
27
+ /** The items of ExiOptions.preserve, in the order of the words of
28
+ * sxml_host_exi_options. */
29
+ const exi_preserved_items = ['comments', 'pis', 'dtd', 'prefixes', 'lexical-values'];
30
+ /** The two words of an optional count of ExiOptions (whether it is given,
31
+ * its value); a RangeError for a number that is not an integer from 0 to
32
+ * 2^32 - 1. */
33
+ function exiCountWords(name, count) {
34
+ if (count === undefined) {
35
+ return [0, 0];
36
+ }
37
+ if (typeof count !== 'number') {
38
+ throw new TypeError(`sxml: the EXI option ${name} is not a number`);
39
+ }
40
+ if (!Number.isInteger(count) || count < 0 || count > 0xffffffff) {
41
+ throw new RangeError(`sxml: the EXI option ${name} is not an integer from 0 to 4294967295`);
42
+ }
43
+ return [1, count];
44
+ }
45
+ /** Whether an optional flag of ExiOptions is set; a TypeError for a value
46
+ * that is not a boolean. */
47
+ function exiFlag(name, flag) {
48
+ if (flag !== undefined && typeof flag !== 'boolean') {
49
+ throw new TypeError(`sxml: the EXI option ${name} is not a boolean`);
50
+ }
51
+ return flag === true;
52
+ }
53
+ /** The sixteen words of sxml_host_exi_options, checked: a TypeError for
54
+ * an unknown alignment or preserve item, a RangeError for a count out of
55
+ * range. The schema's handle is the last word. */
56
+ function exiOptionWords(options, schemaAddress) {
57
+ const alignment = exi_alignments.indexOf(options.alignment ?? 'bit-packed');
58
+ if (alignment < 0) {
59
+ throw new TypeError(`sxml: unknown EXI alignment ${String(options.alignment)}`);
60
+ }
61
+ const preserve = options.preserve ?? [];
62
+ if (!Array.isArray(preserve)) {
63
+ throw new TypeError('sxml: the EXI option preserve is not an array');
64
+ }
65
+ for (const item of preserve) {
66
+ if (typeof item !== 'string' || !exi_preserved_items.includes(item)) {
67
+ throw new TypeError(`sxml: unknown EXI preserve item ${String(item)}`);
68
+ }
69
+ }
70
+ return [
71
+ alignment,
72
+ ...exi_preserved_items.map((item) => (preserve.includes(item) ? 1 : 0)),
73
+ exiFlag('fragment', options.fragment) ? 1 : 0,
74
+ exiFlag('strict', options.strict) ? 1 : 0,
75
+ exiFlag('selfContained', options.selfContained) ? 1 : 0,
76
+ ...exiCountWords('blockSize', options.blockSize),
77
+ ...exiCountWords('valueMaxLength', options.valueMaxLength),
78
+ ...exiCountWords('valuePartitionCapacity', options.valuePartitionCapacity),
79
+ schemaAddress,
80
+ ];
81
+ }
24
82
  // ----------------------------------------------------------------- Errors
25
83
  /** A failure in sxml: a static, dynamic or type error of the expression
26
84
  * (with its error code), a document that is not well-formed, a limit, or
@@ -100,11 +158,15 @@ const decoder = new TextDecoder();
100
158
  /** The conventional prefixes of the optional features' namespaces, bound
101
159
  * for XPath and XQuery wherever the feature is present, as the sxml
102
160
  * command binds them (EXPath Binary 4.0, 1.5; EXPath File 4.0, 1.7;
103
- * D235): feature name, prefix, namespace URI. */
161
+ * D235; tree-sitter for tree-sitter:parse and sxml for the elements of
162
+ * its documents, D307; exi for exi:serialize, exi:parse and the output
163
+ * method exi:exi, D333): feature name, prefix, namespace URI. */
104
164
  const featurePrefixes = [
105
165
  ['expath-binary', 'bin', 'http://expath.org/ns/binary'],
106
166
  ['source-code', 'sxml', 'urn:sxml'],
167
+ ['source-code', 'tree-sitter', 'urn:sxml:tree-sitter'],
107
168
  ['expath-file', 'file', 'http://expath.org/ns/file'],
169
+ ['exi', 'exi', 'urn:sxml:exi'],
108
170
  ];
109
171
  class ProcessorState {
110
172
  module;
@@ -175,6 +237,9 @@ class ProcessorState {
175
237
  case 'schema':
176
238
  exports.sxml_javascript_schema_destroy?.(address);
177
239
  break;
240
+ case 'schematron':
241
+ exports.sxml_javascript_schematron_destroy?.(address);
242
+ break;
178
243
  }
179
244
  }
180
245
  destroy() {
@@ -348,6 +413,10 @@ export class Sxml {
348
413
  if (!Number.isSafeInteger(stepCount) || stepCount < 0) {
349
414
  throw new RangeError('sxml: maximumEvaluationStepCount must be a whole number from 0 to 2^53 - 1');
350
415
  }
416
+ const locationPolicy = locationPolicies.indexOf(options.locations ?? 'automatic');
417
+ if (locationPolicy < 0) {
418
+ throw new RangeError("sxml: locations must be 'automatic', 'always' or 'never'");
419
+ }
351
420
  const codeLanguageView = this.codeLanguageView(options.codeLanguages ?? []);
352
421
  // sxml_javascript_processor_request (sxml_javascript.h): four words
353
422
  // and the step count's two, low first.
@@ -358,7 +427,7 @@ export class Sxml {
358
427
  }
359
428
  throw outOfMemory();
360
429
  }
361
- this.words().set([options.failingAllocationNumber ?? 0, featureMask >>> 0, codeLanguageView, 0, stepCount % 2 ** 32, Math.floor(stepCount / 2 ** 32)], request / 4);
430
+ this.words().set([options.failingAllocationNumber ?? 0, featureMask >>> 0, codeLanguageView, locationPolicy, stepCount % 2 ** 32, Math.floor(stepCount / 2 ** 32)], request / 4);
362
431
  const address = this.exports.sxml_javascript_processor_create(request);
363
432
  this.exports.free(request);
364
433
  if (address === 0) {
@@ -384,7 +453,7 @@ export class Sxml {
384
453
  /**
385
454
  * Loads a tree-sitter language file (tree-sitter-NAME.wasm, as
386
455
  * `tree-sitter build --wasm` writes it) into this module for
387
- * sxml:parse-code: links it into sxml.wasm (src/linker.ts) and checks
456
+ * tree-sitter:parse: links it into sxml.wasm (src/linker.ts) and checks
388
457
  * its ABI and queries. Give it to processors with createProcessor({
389
458
  * codeLanguages }). It stays loaded as long as this Sxml. Rejects with
390
459
  * an Error that says what is wrong with the file, the name or a query.
@@ -615,6 +684,9 @@ const resource_form_byte_reader = 4;
615
684
  const code_language_byte_count = 44;
616
685
  /** sizeof(sxml_javascript_processor_request) on wasm32 (D295). */
617
686
  const processor_request_byte_count = 24;
687
+ /** The values of ProcessorOptions.locations, in the order of the C
688
+ * enumeration sxml_source_location_policy. */
689
+ const locationPolicies = ['automatic', 'always', 'never'];
618
690
  /** sxml_source_code_language_problem, as the sxml command words it
619
691
  * (apps/sxml/code_languages.c). */
620
692
  function codeLanguageProblem(problem, { name, abiVersion, byteOffset }) {
@@ -634,7 +706,7 @@ export class CodeLanguage {
634
706
  module;
635
707
  /** @internal Its sxml_source_code_language in the module's memory. */
636
708
  address;
637
- /** Its name in sxml:parse-code. */
709
+ /** Its name in tree-sitter:parse. */
638
710
  name;
639
711
  /** The grammar's tree-sitter language ABI, 13 to 15. */
640
712
  abiVersion;
@@ -806,7 +878,9 @@ export class Processor {
806
878
  }
807
879
  /** Compiles an XSLT 4.0 stylesheet, with the modules it includes and
808
880
  * imports (kind 'xslt-module') and the packages it uses (kind
809
- * 'xslt-package'), for running it many times. */
881
+ * 'xslt-package'), for running it many times. A stylesheet with errors
882
+ * throws a SchemaError with every error as its reports (codes with
883
+ * their prefix, such as 'err:XPST0003'). */
810
884
  compileStylesheet(stylesheet, options = {}) {
811
885
  const exports = this.exports();
812
886
  const state = this.enter();
@@ -821,7 +895,10 @@ export class Processor {
821
895
  ]);
822
896
  address = exports.sxml_javascript_stylesheet_compile(state.address, request);
823
897
  if (address === 0) {
824
- throw this.failure();
898
+ // Every error of the compilation (D320), on the exception.
899
+ const reports = schemaReports(this.sideResults(exports.sxml_javascript_compile_reports_of(state.address) / 4));
900
+ const failure = this.failure();
901
+ throw failure instanceof SxmlError && reports.length > 0 ? new SchemaError(failure, reports) : failure;
825
902
  }
826
903
  }
827
904
  finally {
@@ -879,6 +956,71 @@ export class Processor {
879
956
  }
880
957
  return schema;
881
958
  }
959
+ /** Compiles a Schematron schema (ISO/IEC 19757-3:2025) from its text or
960
+ * its URI (the resolver is asked, kind 'xml-document', for it and for
961
+ * the documents its include and extends href name), for the phase
962
+ * options.phase names (an id, '#ALL', '#ANY', or '#DEFAULT', the
963
+ * default) with the schema parameters options.parameters gives. Throws a
964
+ * SchemaError with every error when it does not compile (codes such as
965
+ * 'schematron:syntax', 'err:XPST0003'). */
966
+ compileSchematron(schema, options = {}) {
967
+ const exports = this.exports();
968
+ const state = this.enter();
969
+ const address = exports.sxml_javascript_schematron_create(state.address);
970
+ if (address === 0) {
971
+ throw outOfMemory();
972
+ }
973
+ const compiled = new Schematron(this, address);
974
+ this.track(compiled, 'schematron', address);
975
+ const scratch = new Scratch(state);
976
+ try {
977
+ const { text, uri } = typeof schema === 'string' ? { text: schema, uri: '' } : schema;
978
+ const parameterWords = [];
979
+ const parameters = Object.entries(options.parameters ?? {});
980
+ for (const [name, value] of parameters) {
981
+ parameterWords.push(...scratch.view(name), ...scratch.view(value));
982
+ }
983
+ const request = scratch.words([
984
+ ...(text === undefined ? [0, 0] : scratch.view(text)),
985
+ ...scratch.view(uri ?? ''),
986
+ ...scratch.view(options.baseUri ?? ''),
987
+ ...scratch.view(options.phase ?? ''),
988
+ parameterWords.length > 0 ? scratch.words(parameterWords) : 0,
989
+ parameters.length,
990
+ 0,
991
+ 0,
992
+ ]);
993
+ const status = exports.sxml_javascript_schematron_compile(address, request);
994
+ const reports = schemaReports(this.sideResults(request / 4 + 10));
995
+ const warnings = reports.filter(isSchematronWarning);
996
+ if (status !== status_ok) {
997
+ const failure = this.failure();
998
+ throw failure instanceof SxmlError
999
+ ? new SchemaError(failure, reports.filter((report) => !isSchematronWarning(report)))
1000
+ : failure;
1001
+ }
1002
+ const description = scratch.words([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
1003
+ exports.sxml_javascript_schematron_describe(address, description);
1004
+ const words = state.module.words();
1005
+ const field = (index) => state.module.text(words[description / 4 + index * 2] ?? 0, words[description / 4 + index * 2 + 1] ?? 0);
1006
+ compiled.describe({
1007
+ title: field(0),
1008
+ schemaVersion: field(1),
1009
+ schematronEdition: field(2),
1010
+ queryBinding: field(3),
1011
+ phase: field(4),
1012
+ warnings,
1013
+ });
1014
+ }
1015
+ catch (exception) {
1016
+ compiled.dispose();
1017
+ throw exception;
1018
+ }
1019
+ finally {
1020
+ scratch.release();
1021
+ }
1022
+ return compiled;
1023
+ }
882
1024
  /** Converts JSON-like data to a value (see JsonData). */
883
1025
  value(data) {
884
1026
  if (data instanceof Value) {
@@ -933,6 +1075,58 @@ export class Processor {
933
1075
  optionsValue?.dispose();
934
1076
  }
935
1077
  }
1078
+ /** Encodes a document or element node as an EXI stream (Efficient XML
1079
+ * Interchange 1.0) with options: by default bit-packed, with the
1080
+ * built-in grammars, keeping elements, attributes and text only. Throws
1081
+ * a TypeError or RangeError for options it does not take, and an
1082
+ * SxmlError for a value that is not one document or element node or
1083
+ * content the options cannot represent. */
1084
+ encodeExi(node, options = {}) {
1085
+ this.check(node);
1086
+ const words = exiOptionWords(options, this.exiSchemaAddress(options));
1087
+ const names = options.selfContainedElements ?? [];
1088
+ if (!Array.isArray(names) || names.some((name) => typeof name !== 'string')) {
1089
+ throw new TypeError('sxml: the EXI option selfContainedElements is not an array of strings');
1090
+ }
1091
+ const headerWords = [
1092
+ exiFlag('includeCookie', options.includeCookie) ? 1 : 0,
1093
+ exiFlag('includeOptions', options.includeOptions) ? 1 : 0,
1094
+ exiFlag('canonical', options.canonical) ? 1 : 0,
1095
+ exiFlag('includeSchemaId', options.includeSchemaId) ? 1 : 0,
1096
+ exiFlag('omitOptionsDocument', options.omitOptionsDocument) ? 1 : 0,
1097
+ exiFlag('utcTime', options.utcTime) ? 1 : 0,
1098
+ ];
1099
+ const state = this.enter();
1100
+ const scratch = new Scratch(state);
1101
+ try {
1102
+ const nameViews = names.length === 0 ? 0 : scratch.words(names.flatMap((name) => scratch.view(name)));
1103
+ const request = scratch.words([node.address(), ...words, ...headerWords, nameViews, names.length]);
1104
+ if (state.module.exports.sxml_javascript_exi_encode(state.address, request) !== status_ok) {
1105
+ throw this.failure();
1106
+ }
1107
+ return this.outputBytes();
1108
+ }
1109
+ finally {
1110
+ scratch.release();
1111
+ }
1112
+ }
1113
+ /** Decodes an EXI stream into a new document and returns its document
1114
+ * node, as parse() does for XML text. options are those the stream was
1115
+ * encoded with, needed when its header does not carry them;
1116
+ * options.uri is the document URI. A stream that is not EXI throws an
1117
+ * SxmlError with status 'MALFORMED_INPUT'. */
1118
+ parseExi(stream, options = {}) {
1119
+ const words = exiOptionWords(options, this.exiSchemaAddress(options));
1120
+ const state = this.enter();
1121
+ const scratch = new Scratch(state);
1122
+ try {
1123
+ const request = scratch.words([...scratch.view(stream), ...scratch.view(options.uri ?? ''), ...words]);
1124
+ return this.adopt(state.module.exports.sxml_javascript_exi_parse(state.address, request));
1125
+ }
1126
+ finally {
1127
+ scratch.release();
1128
+ }
1129
+ }
936
1130
  /** Releases the processor and every value and expression made with it. */
937
1131
  dispose() {
938
1132
  this.state.module.untrack(this);
@@ -1110,6 +1304,30 @@ export class Processor {
1110
1304
  const words = module.words();
1111
1305
  return module.text(words[output] ?? 0, words[output + 1] ?? 0);
1112
1306
  }
1307
+ /** @internal A copy of the bytes of the processor's last
1308
+ * serialization. */
1309
+ outputBytes() {
1310
+ const module = this.state.module;
1311
+ const output = module.exports.sxml_javascript_output_of(this.state.address) / 4;
1312
+ const words = module.words();
1313
+ const address = words[output] ?? 0;
1314
+ return module.bytes().slice(address, address + (words[output + 1] ?? 0));
1315
+ }
1316
+ /** @internal The handle of options.schema, a schema of this processor;
1317
+ * 0 for none. */
1318
+ exiSchemaAddress(options) {
1319
+ const schema = options.schema;
1320
+ if (schema === undefined) {
1321
+ return 0;
1322
+ }
1323
+ if (!(schema instanceof Schema)) {
1324
+ throw new TypeError('sxml: the EXI option schema is not a Schema');
1325
+ }
1326
+ if (schema.processor !== this) {
1327
+ throw new Error('sxml: the schema belongs to another processor');
1328
+ }
1329
+ return schema.address();
1330
+ }
1113
1331
  /** @internal An input as a value of this processor; values it made are
1114
1332
  * pushed to made, for the caller to dispose. */
1115
1333
  input(data, made) {
@@ -1569,6 +1787,11 @@ export class Stylesheet {
1569
1787
  }
1570
1788
  }
1571
1789
  // ------------------------------------------------------------------- XSD
1790
+ /** A Schematron compile report that is a warning, not an error: a known
1791
+ * deviation of real rule sets, read as its authors mean it. */
1792
+ function isSchematronWarning(report) {
1793
+ return report.code === 'schematron:compatibility';
1794
+ }
1572
1795
  /** The SCHEMA_REPORT side results as reports. */
1573
1796
  function schemaReports(results) {
1574
1797
  return results
@@ -1639,6 +1862,7 @@ export class Schema {
1639
1862
  this.handle = 0;
1640
1863
  }
1641
1864
  }
1865
+ /** @internal The handle, checked usable. */
1642
1866
  address() {
1643
1867
  if (this.handle === 0) {
1644
1868
  throw disposed('schema');
@@ -1646,6 +1870,85 @@ export class Schema {
1646
1870
  return this.handle;
1647
1871
  }
1648
1872
  }
1873
+ // ------------------------------------------------------------ Schematron
1874
+ /** A compiled Schematron schema (include/sxml/schematron.h).
1875
+ * Processor.compileSchematron makes it. */
1876
+ export class Schematron {
1877
+ processor;
1878
+ handle;
1879
+ /** The schema's title, schemaVersion, schematronEdition (any value, as
1880
+ * written) and queryBinding; empty when absent. */
1881
+ title = '';
1882
+ schemaVersion = '';
1883
+ schematronEdition = '';
1884
+ queryBinding = '';
1885
+ /** The phase compiled ('#DEFAULT' resolved). */
1886
+ phase = '';
1887
+ /** The schema's warnings (code 'schematron:compatibility'): a parameter
1888
+ * named twice in one pattern instance, a pattern's let read by another
1889
+ * pattern, a rule's let after its assertions. Read as their authors
1890
+ * mean them; each names the clause it deviates from. */
1891
+ warnings = [];
1892
+ /** @internal Use Processor.compileSchematron(). */
1893
+ constructor(processor, address) {
1894
+ this.processor = processor;
1895
+ this.handle = address;
1896
+ }
1897
+ /** @internal */
1898
+ describe(fields) {
1899
+ this.warnings = Object.freeze(fields.warnings);
1900
+ this.title = fields.title;
1901
+ this.schemaVersion = fields.schemaVersion;
1902
+ this.schematronEdition = fields.schematronEdition;
1903
+ this.queryBinding = fields.queryBinding;
1904
+ this.phase = fields.phase;
1905
+ }
1906
+ /** Validates a document: XML text, parsed with its locations, or a node
1907
+ * of this processor. Findings are not exceptions: see the result. A
1908
+ * dynamic error in the rules, or text that is not well-formed, throws. */
1909
+ validate(input, options = {}) {
1910
+ const processor = this.processor;
1911
+ const exports = processor.exports();
1912
+ const address = this.address();
1913
+ if (input instanceof Value) {
1914
+ processor.check(input);
1915
+ }
1916
+ const state = processor.enter();
1917
+ const scratch = new Scratch(state);
1918
+ let status = status_ok;
1919
+ let output = '';
1920
+ try {
1921
+ const request = scratch.words([
1922
+ input instanceof Value ? input.address() : 0,
1923
+ ...(input instanceof Value ? [0, 0] : scratch.view(input)),
1924
+ ...scratch.view(options.uri ?? ''),
1925
+ options.firedRules === true ? 1 : 0,
1926
+ options.svrl === true ? 1 : 0,
1927
+ ]);
1928
+ status = exports.sxml_javascript_schematron_validate(address, request);
1929
+ output = status === status_ok ? processor.output() : '';
1930
+ }
1931
+ finally {
1932
+ scratch.release();
1933
+ }
1934
+ if (status !== status_ok) {
1935
+ throw processor.failure();
1936
+ }
1937
+ return JSON.parse(output);
1938
+ }
1939
+ dispose() {
1940
+ if (this.handle !== 0) {
1941
+ this.processor.releaseHandle(this, 'schematron', this.handle);
1942
+ this.handle = 0;
1943
+ }
1944
+ }
1945
+ address() {
1946
+ if (this.handle === 0) {
1947
+ throw disposed('schematron');
1948
+ }
1949
+ return this.handle;
1950
+ }
1951
+ }
1649
1952
  // ----------------------------------------------------------------- Values
1650
1953
  /** An XDM value: a sequence of items in its processor (a parsed document,
1651
1954
  * an evaluation's result). */
package/dist/sxml.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "@tinyactors/sxml",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "sxml for JavaScript: XML, XPath 4.0, XQuery 4.0, XSLT 4.0 and XSD 1.1 in Node.js and browsers, over WebAssembly",
5
5
  "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/tinyactors-dev/sxml.git",
9
+ "directory": "bindings/javascript"
10
+ },
11
+ "homepage": "https://sxml.tinyactors.dev",
6
12
  "type": "module",
7
13
  "exports": {
8
14
  ".": {