Skip to content

Declare default extensions in package manifests - #22

Open
colinhacks wants to merge 1 commit into
remcohaszing:mainfrom
colinhacks:content-mapper-extensions
Open

colinhacks wants to merge 1 commit into
remcohaszing:mainfrom
colinhacks:content-mapper-extensions

Conversation

@colinhacks

Copy link
Copy Markdown

Disclosure: made with Claude Code and verified locally against TypeScript 7.1.1-rc and the repo's test suite below.

TypeScript 7.1 RC (typescript@7.1.1-rc) reads a content mapper's default extensions from typescript.contentMapper.extensions in package.json (microsoft/TypeScript#65047), so a tsconfig.json entry can register each package by name alone without listing extensions.

Changes

  • Add typescript.contentMapper.extensions to each package's package.json, matching the lists already in each README:
    • css-modules-content-mapper: [".module.css"]
    • sass-content-mapper: [".module.scss", ".module.sass"]
    • less-content-mapper: [".module.less"]
  • Update all three README.md files to omit "extensions" from the tsconfig.json example and note the default extensions, overriding via extensions, and listing extensions on TypeScript versions before 7.1 RC.
  • Add a minor changeset (.changeset/quiet-files-map.md) covering all three packages.

Backward compatible: typescript@7.1.0-beta ignores the manifest field, and setting extensions in tsconfig.json still overrides the default on both beta and RC.

Verification

  • Against published css-modules-content-mapper@0.5.0, sass-content-mapper@0.3.0, and less-content-mapper@0.3.0 on typescript@7.1.1-rc with package-only tsconfig.json entries: each fails with TS18141 and the module imports fail with TS2307.
  • With npm pack tarballs of this branch on typescript@7.1.1-rc: .module.css, .module.scss, .module.sass, and .module.less imports get typed (planted TS2339/TS2551 errors on missing class names are reported), and setting "extensions": [".css"] in tsconfig.json overrides the default.
  • Repo checks pass locally: eslint, tsc --build, prettier, remark, and npm test (138 passed).

@changeset-bot

changeset-bot Bot commented Dec 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bde0918

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
css-modules-content-mapper Minor
less-content-mapper Minor
sass-content-mapper Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mrmckeb

mrmckeb commented Dec 6, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks @colinhacks, I'll chat with @remcohaszing about this and try to get back to you ASAP. I like that this also makes it easier for users.

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