Skip to content

fix: externalize CSS preprocessors#200

Merged
ocavue merged 1 commit intomainfrom
ocavue/sass-sp
Mar 6, 2026
Merged

fix: externalize CSS preprocessors#200
ocavue merged 1 commit intomainfrom
ocavue/sass-sp

Conversation

@ocavue
Copy link
Copy Markdown
Collaborator

@ocavue ocavue commented Mar 6, 2026

  • This PR contains AI-generated code, but I have carefully reviewed it myself. Otherwise, my PR may be closed.
    • I understand that my PR is more likely to be rejected or requested for changes if it contains AI-generated code that I do not fully understand.

Description

Mark .sass, .scss files, etc., as externalized.

Linked Issues

rolldown/tsdown#801

Additional context

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 6, 2026

Open in StackBlitz

npm i https://pkg.pr.new/rolldown-plugin-dts@200

commit: 41a7d64

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the plugin’s “CSS import externalization” handling to include common CSS preprocessor extensions (e.g., .scss, .sass, .less, .styl*), and adds a regression test to ensure SCSS imports don’t get inlined into generated declaration output.

Changes:

  • Extend RE_CSS to match additional stylesheet/preprocessor extensions.
  • Add a fixture and a test case covering SCSS imports being externalized.
  • Update Jest snapshot to include the new SCSS test output.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/index.test.ts Adds a new test asserting SCSS imports are externalized and not inlined.
tests/fixtures/css-scss/styles.scss New SCSS fixture used by the test.
tests/fixtures/css-scss/index.ts Imports the SCSS fixture to exercise the behavior under test.
tests/snapshots/index.test.ts.snap Adds snapshot output for the new test.
src/filename.ts Extends the stylesheet-matching regex to include preprocessors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

export const RE_DTS_MAP: RegExp = /\.d\.([cm]?)ts\.map$/
export const RE_NODE_MODULES: RegExp = /[\\/]node_modules[\\/]/
export const RE_CSS: RegExp = /\.css$/
export const RE_CSS: RegExp = /\.(?:css|scss|sass|less|styl|stylus)$/
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RE_CSS now matches multiple stylesheet/preprocessor extensions (scss/sass/less/styl*), so the constant name is slightly misleading. Consider renaming it to something like RE_STYLE/RE_STYLESHEET (and updating imports/usages) to better reflect what it matches.

Suggested change
export const RE_CSS: RegExp = /\.(?:css|scss|sass|less|styl|stylus)$/
export const RE_STYLESHEET: RegExp = /\.(?:css|scss|sass|less|styl|stylus)$/
export const RE_CSS: RegExp = RE_STYLESHEET

Copilot uses AI. Check for mistakes.
@ocavue ocavue merged commit 5b55803 into main Mar 6, 2026
18 checks passed
@ocavue ocavue deleted the ocavue/sass-sp branch March 6, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants