@react-pug/react-pug-core
v0.1.10
Published
Shared transformation and mapping engine for the `react-pug` toolchain.
Readme
@react-pug/react-pug-core
Shared transformation and mapping engine for the react-pug toolchain.
This package is the low-level core used by:
@react-pug/typescript-plugin-react-pug@react-pug/babel-plugin-react-pug@react-pug/swc-plugin-react-pug@react-pug/esbuild-plugin-react-pug@react-pug/eslint-plugin-react-pug
Install
npm i @react-pug/react-pug-coreWhat It Provides
- extraction of
pug\...`` template regions from JS/TS files - compilation of Pug to JSX/TSX-compatible output
- shadow document generation for editor tooling
- source range and diagnostic remapping back to original Pug locations
- compiler-facing source map generation for downstream transforms
Main Exports
transformSourceFile(...)buildShadowDocument(...)createTransformSourceMap(...)- mapping helpers from
mapping,positionMapping, anddiagnosticMapping
Common Options
Core transforms expose:
tagFunction: tagged template function name, defaultpugrequirePugImport: boolean, defaultfalseremoveTagImport: boolean, defaulttrueclassShorthandProperty:auto | className | class | styleNameclassShorthandMerge:auto | concatenate | classnamesstartupjsCssxjs:never | auto | forcecomponentPathFromUppercaseClassShorthand: boolean, defaulttrue
When removeTagImport is enabled, used pug imports are removed from transformed/shadow output. If the removed specifier was the only runtime import from that module, the declaration is rewritten to a side-effect import.
Intended Audience
Most users should use one of the higher-level packages instead of consuming this package directly.
Use this package directly if you are building:
- an editor integration
- a custom compiler adapter
- a lint/diagnostic pipeline that needs original Pug positions
Notes
Published output is in dist/.
