feat: add inline sourcemap option to script and style compilers#112
Open
yusasa16 wants to merge 21 commits into
Open
feat: add inline sourcemap option to script and style compilers#112yusasa16 wants to merge 21 commits into
yusasa16 wants to merge 21 commits into
Conversation
Add an opt-in `sourcemap?: boolean` option that emits an inline source map (data URI appended as `//# sourceMappingURL=...`) when set to `true` (default: `false`). esbuild adjusts mappings to account for the banner automatically.
Add an opt-in `sourcemap?: boolean` option that emits an inline source map appended to the output when set to `true` (default: `false`). When enabled, feed the banner through PostCSS as a `/*!` important comment so cssnano preserves it and the inline source map line offsets stay correct.
…ching Add the new `sourcemap` option to the createStyleCompiler and createScriptCompiler sections in both the English and Japanese READMEs, and add a "Switching options per command" subsection showing how to branch on `process.argv` to vary compiler options between `kamado server` and `kamado build`.
Extend `sourcemap` from `boolean` to `boolean | 'onServer'`. When set to `'onServer'`, the inline source map is emitted only while kamado runs in serve mode (`context.mode === 'serve'`).
Extend `sourcemap` from `boolean` to `boolean | 'onServer'`. When set to `'onServer'`, the inline source map is emitted only while kamado runs in serve mode (`context.mode === 'serve'`).
…mmand example Add the `'onServer'` value to the compiler sourcemap descriptions, and replace the `process.argv`-based per-command switching example with a sourcemap-only example that relies on the new built-in `'onServer'` value.
…ap flag
Previously the banner was prepended through PostCSS only when sourcemap was on,
and appended verbatim after processing when it was off — so cssnano touched the
banner in one path but not the other, producing slightly different output.
Always feed the banner into the PostCSS input via a new normalizeBanner() that
coerces it into a `/*! ... */` important comment, so cssnano preserves it in
both paths. The sourcemap option now only toggles `map: { inline: true }`.
Also notes that enableSourcemap is fixed for the lifetime of a command.
…y CompileFunction type
… CompileFunction type
YusukeHirao
approved these changes
May 18, 2026
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
sourcemap?: booleanoption to@kamado-io/script-compilerand@kamado-io/style-compiler. Defaultfalse; whentrue, emits an inline source map appended to the output.script-compiler: passessourcemap: 'inline'to esbuild — banner offsets are handled automatically by esbuild.style-compiler: feeds the banner through PostCSS as a/*!important comment when sourcemap is enabled, so cssnano preserves it and the inline source map's line offsets stay correct.process.argv.includes('server')to vary options betweenkamado serverandkamado build.Test plan
🤖 Generated with Claude Code