Repository navigation
fix(ci): inline parser JSON assets + copy tut-alert partial in option-tail-leak test - #3041
Merged
Merged
Conversation
…eak test
Follow-up after the first round fixed B/C/E but left A and D red.
A (5 srv-qa suites, 'Cannot find module ./icon-allowlist.json'):
directives/ui.ts and reference-links.ts loaded icon-allowlist.json /
api-libs.json via createRequire('./x.json') at runtime, but neither
parsers bundle (srv-qa/lib + srv/lib/_shared, both built from
scripts/parsers/*) ships the JSON beside the .mjs, so the runtime require
fails. Switch to static default JSON imports (tsconfig has
resolveJsonModule) — esbuild/vite/tsx all inline the JSON into the bundle,
removing the sidecar-file dependency for BOTH bundles and also removing the
createRequire imports that caused the earlier banner collision.
D (option-tail-leak.test.ts, 'Hugo build failed exit 1'):
render-blockquote.html now delegates alerts to the tut-alert
partial (#2595/#71a8d70bc), but the test's temp Hugo site never copied
tut-alert.html, so was unresolvable and the
build died. Copy tut-alert.html into the temp layouts/partials/ dir.
Verified by reproducing the real Hugo pipeline: build now exits 0 and
renders exactly 2 <aside class="alert alert-tip">.
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.
Third and final follow-up unblocking the DEV
unitjob. #3036 fixed the bundle-step crash; #3039 fixed 3 of the 5 surfaced failures (hugocontains, blockquote-hook/css stale tests). This PR fixes the last 2.A — 5 srv-qa suites fail at module load:
Cannot find module './icon-allowlist.json'Once #3039's banner-alias cleared the
createRequirecollision, the next error surfaced:parsers.bundle.mjsdoescreateRequire('./icon-allowlist.json')/'./api-libs.json'at runtime, but neither parsers bundle (srv-qa/lib/parsers.bundle.mjsfrom the package.json inline script, norsrv/lib/_shared/parsers.bundle.mjsfrombundle-shared.cjs) ships the JSON beside the.mjs. So the require fails at load → all 5 srv-qa suites error before any test runs.Fix:
scripts/parsers/directives/ui.ts+reference-links.tsnow use static default JSON imports (import x from './x.json') instead ofcreateRequire.tsconfighasresolveJsonModule: true; esbuild, Vite (Vitest) and tsx all inline the JSON into the bundle at build time — removing the sidecar-file dependency for both bundles, and removing thecreateRequireimports that caused the earlier collision in the first place.Verified: rebuilt the bundle → 0 runtime
require('./*.json'), both JSON payloads inlined,node --checkpasses.D — option-tail-leak.test.ts:
Hugo build failed (exit 1)The test builds a temp Hugo site copying the render hooks.
render-blockquote.htmlnow delegates> [!TYPE]alerts topartials/tut-alert.html(#2595/#71a8d70bc), but the test never copied that partial →partial "tut-alert.html"was unresolvable → build died (the test only captured WARN lines, masking the real error).Fix: create
layouts/partials/in the temp site and copytut-alert.htmlinto it.Verified by reproducing the real Hugo pipeline with the hana-clients TIP shape: build now exits 0 and renders exactly 2
<aside class="alert alert-tip">(matching #3039's updated assertion).Net
With this + #3036 + #3039, all 6 originally-failing unit suites are addressed. CI on this PR should show the
unitjob green.🤖 Generated with Claude Code