uss-xsd-engine 0.1.0-rc.2 → 0.1.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * uss-xsd-engine v0.1.0-rc.2
2
+ * uss-xsd-engine v0.1.0
3
3
  * (c) 2026 Bernard Mumble
4
4
  * MIT License
5
5
  */
@@ -583,6 +583,33 @@ function lookupInImportedSchemas(bucketName, schema, namespaceUri3, localName3,
583
583
  }
584
584
  return null;
585
585
  }
586
+ function lookupInImportedSchemasForUnprefixed(bucketName, schema, localName3, visited = /* @__PURE__ */ new Set()) {
587
+ if (!schema || !localName3) return null;
588
+ if (visited.has(schema)) return null;
589
+ visited.add(schema);
590
+ const targetNs = schema.targetNamespace || null;
591
+ for (const importedSchema of schema.importedSchemas || []) {
592
+ if (!importedSchema) continue;
593
+ const importedNs = importedSchema.targetNamespace || null;
594
+ if (importedNs === targetNs) {
595
+ const direct = lookupInSchemaBucket(
596
+ bucketName,
597
+ importedSchema,
598
+ importedNs,
599
+ localName3
600
+ );
601
+ if (direct) return direct;
602
+ }
603
+ const nested = lookupInImportedSchemasForUnprefixed(
604
+ bucketName,
605
+ importedSchema,
606
+ localName3,
607
+ visited
608
+ );
609
+ if (nested) return nested;
610
+ }
611
+ return null;
612
+ }
586
613
  function lookupByQName(bucketName, schema, name) {
587
614
  if (!schema || !name) return null;
588
615
  const parsed = parseQName(name);
@@ -615,6 +642,12 @@ function lookupByQName(bucketName, schema, name) {
615
642
  localName3
616
643
  );
617
644
  if (hostNamespaceDecl) return hostNamespaceDecl;
645
+ const importedSameNamespaceDecl = lookupInImportedSchemasForUnprefixed(
646
+ bucketName,
647
+ schema,
648
+ localName3
649
+ );
650
+ if (importedSameNamespaceDecl) return importedSameNamespaceDecl;
618
651
  }
619
652
  return null;
620
653
  }
@@ -2407,7 +2440,7 @@ function runSchemaDiagnostics(schema, options = {}) {
2407
2440
  }
2408
2441
 
2409
2442
  // src/version.js
2410
- var ENGINE_VERSION = "v0.1.0-rc.2";
2443
+ var ENGINE_VERSION = "v0.1.0";
2411
2444
 
2412
2445
  // src/utils/result.js
2413
2446
  function summarizeIssues(issues = []) {
@@ -3404,6 +3437,14 @@ function generateXmlFromSchema(schema, options = {}, helpers = {}) {
3404
3437
  state,
3405
3438
  true
3406
3439
  );
3440
+ if (rootNode) {
3441
+ const finalNsAttrs = buildRootNamespaceAttributes(schema, root, state);
3442
+ rootNode.attributes = {
3443
+ ...finalNsAttrs,
3444
+ ...rootNode.attributes
3445
+ // preserve any existing attrs
3446
+ };
3447
+ }
3407
3448
  return {
3408
3449
  rootElementName: root.name,
3409
3450
  rootNode
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * uss-xsd-engine v0.1.0-rc.2
2
+ * uss-xsd-engine v0.1.0
3
3
  * (c) 2026 Bernard Mumble
4
4
  * MIT License
5
5
  */
@@ -610,6 +610,33 @@ var UssXsdEngine = (() => {
610
610
  }
611
611
  return null;
612
612
  }
613
+ function lookupInImportedSchemasForUnprefixed(bucketName, schema, localName3, visited = /* @__PURE__ */ new Set()) {
614
+ if (!schema || !localName3) return null;
615
+ if (visited.has(schema)) return null;
616
+ visited.add(schema);
617
+ const targetNs = schema.targetNamespace || null;
618
+ for (const importedSchema of schema.importedSchemas || []) {
619
+ if (!importedSchema) continue;
620
+ const importedNs = importedSchema.targetNamespace || null;
621
+ if (importedNs === targetNs) {
622
+ const direct = lookupInSchemaBucket(
623
+ bucketName,
624
+ importedSchema,
625
+ importedNs,
626
+ localName3
627
+ );
628
+ if (direct) return direct;
629
+ }
630
+ const nested = lookupInImportedSchemasForUnprefixed(
631
+ bucketName,
632
+ importedSchema,
633
+ localName3,
634
+ visited
635
+ );
636
+ if (nested) return nested;
637
+ }
638
+ return null;
639
+ }
613
640
  function lookupByQName(bucketName, schema, name) {
614
641
  if (!schema || !name) return null;
615
642
  const parsed = parseQName(name);
@@ -642,6 +669,12 @@ var UssXsdEngine = (() => {
642
669
  localName3
643
670
  );
644
671
  if (hostNamespaceDecl) return hostNamespaceDecl;
672
+ const importedSameNamespaceDecl = lookupInImportedSchemasForUnprefixed(
673
+ bucketName,
674
+ schema,
675
+ localName3
676
+ );
677
+ if (importedSameNamespaceDecl) return importedSameNamespaceDecl;
645
678
  }
646
679
  return null;
647
680
  }
@@ -2434,7 +2467,7 @@ var UssXsdEngine = (() => {
2434
2467
  }
2435
2468
 
2436
2469
  // src/version.js
2437
- var ENGINE_VERSION = "v0.1.0-rc.2";
2470
+ var ENGINE_VERSION = "v0.1.0";
2438
2471
 
2439
2472
  // src/utils/result.js
2440
2473
  function summarizeIssues(issues = []) {
@@ -3431,6 +3464,14 @@ var UssXsdEngine = (() => {
3431
3464
  state,
3432
3465
  true
3433
3466
  );
3467
+ if (rootNode) {
3468
+ const finalNsAttrs = buildRootNamespaceAttributes(schema, root, state);
3469
+ rootNode.attributes = {
3470
+ ...finalNsAttrs,
3471
+ ...rootNode.attributes
3472
+ // preserve any existing attrs
3473
+ };
3474
+ }
3434
3475
  return {
3435
3476
  rootElementName: root.name,
3436
3477
  rootNode
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uss-xsd-engine",
3
- "version": "0.1.0-rc.2",
3
+ "version": "0.1.0",
4
4
  "description": "Browser-first XSD engine for schema diagnostics, tree extraction, sample XML generation, and XML validation.",
5
5
  "type": "module",
6
6
  "main": "dist/uss-xsd-engine.esm.js",