@arbidocs/coedit 0.4.96 → 0.4.97

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/dist/index.cjs CHANGED
@@ -605,14 +605,30 @@ function materialize(doc, cache, changed = null) {
605
605
  defaults: new Map(doc.getMap("ctDefaults")),
606
606
  overrides: new Map(doc.getMap("ctOverrides"))
607
607
  };
608
- return {
608
+ return withMirroredOverrides({
609
609
  parts,
610
610
  partBytes,
611
611
  relationships,
612
612
  externalTargets,
613
613
  contentTypes,
614
614
  mainDocumentPart: main
615
- };
615
+ });
616
+ }
617
+ function withMirroredOverrides(pkg) {
618
+ const bytes = store.contentTypesPartBytes(pkg);
619
+ if (!bytes) return pkg;
620
+ const declared = new Set(
621
+ [...new TextDecoder().decode(bytes.bytes).matchAll(/PartName\s*=\s*["']([^"']+)["']/gi)].map(
622
+ (m) => m[1].toLowerCase()
623
+ )
624
+ );
625
+ let next = pkg;
626
+ for (const name of [...pkg.parts.keys(), ...pkg.partBytes.keys()]) {
627
+ const type = pkg.contentTypes.overrides.get(name.toLowerCase());
628
+ if (type && !declared.has(name.toLowerCase()))
629
+ next = store.withContentTypeOverride(next, name, type, { forceOverride: true });
630
+ }
631
+ return next;
616
632
  }
617
633
  var RegistryError = class extends Error {
618
634
  constructor(message) {