v0.1.2: bundler-neutral XSD load (unblocks Vite/Rollup/Workers consumers)#8
Merged
Conversation
…consumers)
The bun `import xsd from "./x.xsd" with { type: "text" }` is bun-only — Vite/
Rollup reject it ("Expression expected; need plugins to import non-JS"), so any
consumer bundling the e-SLOG validation path (e.g. fiscalize-demo's SvelteKit/
adapter-cloudflare vite build) failed.
Fix: inline each XSD as a JS string (JSON-stringified, generated from the
vendored .xsd by scripts/gen-xsd-modules.ts) and import those .ts modules. No
text-import / ?raw / fs — loads under any bundler/runtime. Removed the now-dead
`declare module "*.xsd"` ambient + its triple-slash ref.
Verified: validateEslogXml still passes (inlined XSD byte-identical, 44/1 tests,
tsc clean) AND a consumer SvelteKit `vite build` now succeeds (was failing on
0.1.1). Consumers on ^0.1.x auto-inherit; bump to ^0.1.2 to build.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unblocks
fiscalize-demo's deploy (and any Vite/Rollup/Workers consumer). The bunimport … with { type: "text" }XSD load is bun-only — a consumer'svite buildfails: "xmldsig-core-schema.xsd (1:0): Expression expected (need plugins to import non-JS)". Verified failing on 0.1.1, fixed here.Fix: inline each XSD as a JS string (JSON-stringified, generated from the vendored
.xsdbyscripts/gen-xsd-modules.ts) and import those.tsmodules — no text-import /?raw/ fs, loads under any bundler/runtime. Removed the now-dead*.xsdambient + its triple-slash ref.Verified:
bun test44 pass / 1 skip,tscclean —validateEslogXmlstill passes (inlined XSD byte-identical to the file).vite buildnow succeeds (✓ builtwith thebuildEInvoiceroute bundled; was failing on 0.1.1) — tested against this exact build.Consumers on
^0.1.xauto-inherit; bump to^0.1.2to build..xsdfiles kept for provenance;.tsare generated (regen viabun run scripts/gen-xsd-modules.ts).🤖 Generated with Claude Code