Skip to content

build!: modernize gulp-posthtml for posthtml 0.16/0.17 - #34

Open
voischev wants to merge 1 commit into
masterfrom
modernize
Open

voischev wants to merge 1 commit into
masterfrom
modernize

Conversation

@voischev

Copy link
Copy Markdown
Member

Modernizes the package (last release 3.0.5 in 2020, which bundles posthtml@^0.11). Proposed as 4.0.0.

Breaking

  • posthtml is a peer dependency ^0.16.0 || ^0.17.0: users install it next to the plugin and pick the version.
  • Node.js ^20.19.0 || >=22.12.0 (same as posthtml 0.17).
  • posthtml-load-config 1 → 2.

Fixes

  • Config loading errors and errors thrown by a config function are emitted as PluginError. Before, a rejected config promise was never handled and the stream hung. Closes Tests fall with posthtml version latest #18 (the failing tests there came from posthtml-sugarml fixtures parsing HTML includes since posthtml 0.12).
  • Malformed HTML generated #15 (attribute quotes) no longer reproduces with the current parser/renderer.

Internals

  • through2 → stream.Transform; plugin-error 2.
  • Tests: ava/nyc/standard → node:test, c8 (100% coverage gate), ESLint. 13 tests incl. null/stream files, options/from/to, config file lookup and config dir, and error paths. The custom parser test lives in its own file because posthtml ≤0.16 leaks custom parsers between calls (fixed in fix: scope custom parser and render to a single process call posthtml#421).
  • Travis → GitHub Actions: Node 20.19.0, 22.12.0, 22, 24, 26 with posthtml 0.16, plus posthtml 0.16.0 on Node 24.
  • files instead of .npmignore; removed generated PLUGIN.md; README rewritten (no sugarml), CHANGELOG, contributing guide.

Verified

  • npm run check with posthtml 0.16.0, 0.16.7 and posthtml master (0.17).
  • README examples run with real Gulp 5 (plugins+options, function, posthtml.config.js); with stream/promises pipeline a failing file fails the task with Error in plugin "gulp-posthtml" (documented in README).

🤖 Generated with Claude Code

- posthtml becomes a peer dependency (^0.16.0 || ^0.17.0)
- require Node.js ^20.19.0 || >=22.12.0
- emit config loading errors as PluginError instead of hanging (#18)
- replace through2 with stream.Transform, update plugin-error and
  posthtml-load-config
- node:test, c8 and ESLint instead of ava, nyc and standard
- GitHub Actions instead of Travis CI
- update README, CHANGELOG and contributing guide

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Tests fall with posthtml version latest

1 participant