refactor(types): JSDoc source of truth + declaration emit - #4480
Open
joshgoebel wants to merge 5 commits into
Open
refactor(types): JSDoc source of truth + declaration emit#4480joshgoebel wants to merge 5 commits into
joshgoebel wants to merge 5 commits into
Conversation
Add tsconfig.emit.json and npm run types:emit for a declaration-only build of leaf modules. Annotate modes exports for clean Mode-typed output; tighten regex JSDoc. Generated files land in types/generated/ for inspection; published types/index.d.ts is unchanged. Refs #3157
Define public/private types in src/lib/hljs_types.js; source imports those instead of ambient highlight.js modules. Expand types:emit to core + lib, replace types/index.d.ts with a thin barrel over types/generated, and ship generated decls in the node build. Refs #3157
Drop MatchType/Keyword* typedef re-exports from highlight.js; use inline import() for internals. Barrel lists public types only; private types ship as types/private.d.ts (exports ./private). Refs #3157
Vue support lives in highlightjs/vue-plugin; it was never on the core runtime export. Refs #3157
Build Size ReportChanges to minified artifacts in 7 files changedTotal change +59 B View Changes
|
install() does not create parent dirs; types/generated/lib/** failed on CI with ENOENT. Refs #3157
Build Size ReportChanges to minified artifacts in 7 files changedTotal change +62 B View Changes
|
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.
Summary
src/lib/hljs_types.js(JSDoc) and stop treating hand-written ambienttypes/index.d.tsas the source of truth (Future: Possibly more automated type compilation #3157).npm run types:emit(tsconfig.emit.json) to generatetypes/generated/**; package entry is a thin barrel over that output.types/private.d.ts(exports["./private"]); drop unusedvuePluginfrom the public type surface.Notes
"types": "./types/index.d.ts"; named public types are explicit exports; private aliases arehighlight.js/privateonly.types:emit && git diff --exit-code) is a natural follow-up.Test plan
npm run types:emit(exit 0)npm run test-parsertscconsumer: default export +Mode/HLJSApi; private types not on main entrynpm test/ node build pack types check