Repository navigation
feat!: migrate to ESM, require Node.js 22.12+, update htmlparser2/postcss-safe-parser, and restrict deep imports - #163
Merged
Merged
Conversation
…ge exports htmlparser2 v9 changed the attribute endIndex passed to onattribend to point one past the closing quote, so the style attribute guard in extract-styles is adjusted accordingly. As a side effect, declarations parsed from style attributes now get a proper source.end position (previously undefined). htmlparser2 v10+ and js-tokens v10 are ESM-only, so v9 is the ceiling for both while this package remains CommonJS. The new exports field restricts deep imports into lib/. Co-Authored-By: Claude Fable 5 <[email protected]>
stylelint 17 removed the standalone result.output property (fixed code
is on result.code), and stylelint-config-standard v40 is ESM-only so
require() returns a module namespace object.
The recommended-vue fixture needs a top-level rules: {} because
stylelint 17 resolves the formatter option by evaluating the config
without a target file, and an overrides-only config fails that
evaluation with a ConfigurationError.
Co-Authored-By: Claude Fable 5 <[email protected]>
The package now requires Node.js ^22.12 || >=24. CommonJS consumers on those versions keep working: require(esm) is unflagged there, and the entry point declares the 'module.exports' interop export so require() returns the same callable API as v1 (verified by test/cjs-interop.cjs). stylelint 16/17 load custom syntaxes via import(), so they are unaffected. Coverage moves from nyc to c8 because nyc's require-hook based instrumentation cannot see ES modules. The explorer app needs webpack >=5.109 to handle the string-named export, and a NormalModuleReplacementPlugin so its browser shims also apply to node:-prefixed builtin imports. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
Adopts the automerged chai 6 / mocha 11 / mocha-chai-jest-snapshot 1.1.7 updates; the ESM tests switch to chai's named exports because chai 6 has no default export. Co-Authored-By: Claude Fable 5 <[email protected]>
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.
Preparation for the v2 major release, following the Node.js support change in #162.
The package is now an ES module. The Node.js requirement rises to
^22.12 || >=24, the versions whererequire(esm)is enabled by default. CommonJS consumers keep working unchanged: the entry point declares the'module.exports'interop export, sorequire("postcss-html")returns the same callable API as v1. A dedicated CommonJS test (test/cjs-interop.cjs) covers this path. stylelint 16/17 load custom syntaxes viaimport()and are unaffected. Staying CommonJS would have pinned htmlparser2 and js-tokens to their last CJS-compatible majors, since both are ESM-only upstream now.Runtime dependency updates that were blocked by the old Node.js floor:
endIndexone past the closing quote, so the style-attribute guard inextract-styles.jscompensates withparser.endIndex - 1. A side effect: declarations parsed fromstyleattributes now get a correctsource.endposition, which wasundefinedbefore (visible in the AST snapshot updates; possibly relevant to sourcemaps are broken and this can throw with the latest PostCSS version #89).Deep imports into
lib/are no longer possible: the newexportsfield restricts consumers to the package root.The stylelint integration tests now run against stylelint 17 and stylelint-config-standard 40 instead of stylelint 14, which is what current users actually install. This required adapting to stylelint 17 API changes (
result.outputremoved in favor ofresult.code; ESM-only shareable configs). One finding worth attention: with stylelint 17, an overrides-only config such asstylelint-config-recommended-vuefails withConfigurationError: No rules found within configurationas soon as the CLI resolves the formatter, because that resolution evaluates the config without a target file. The fixture works around it with a top-levelrules: {}, but this looks like a real compatibility issue between stylelint 17 and stylelint-config-recommended-vue that affects end users. Relatedly, stylelint-config-recommended-vue's peerDependencies currently allow onlypostcss-html: ^1.0.0and will need an update when v2 ships.Remaining housekeeping visible in the diff: coverage moves from nyc to c8 because nyc's require-hook instrumentation cannot see ES modules; the deprecated and unused
codecovpackage is removed; the explorer app needs webpack >=5.109 to handle the string-named export plus aNormalModuleReplacementPluginso its browser shims also apply tonode:-prefixed builtin imports.🤖 Generated with Claude Code