Conversation
…services - Add tests for blacklist with autoAliases (#366): verifies blacklisted actions are skipped during auto-alias generation without crashing - Add tests for mergeParams with internal services (#332): verifies query params are properly merged for $node.* actions - Fix mergeParams logic: move action resolution before params merge so internal service detection works on the current request, not the next one. Also avoid mutating route.opts.mergeParams (side effect) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The `declare module "moleculer-web"` wrapper was incorrect since this is the module's own type definition file, not an ambient declaration. Removing it allows proper type inheritance and extension by consumers. Based on PR #357 by @atomstackjs, adapted for the next branch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Major updates: - eslint 9 → 10 (flat config only, added globals + @eslint/js deps) - @sinonjs/fake-timers 14 → 15 - @types/serve-static 1 → 2 (Express 5 aligned) - cross-env 7 → 10 - eslint-plugin-security 3 → 4 - npm-check-updates 18 → 19 - webpack-dev-middleware 7 → 8 Minor/patch updates: - @fastify/busboy, body-parser, compression, eslint-config-prettier, eslint-plugin-prettier, express, jest, jest-cli, jsonwebtoken, lodash, mime-types, nodemon, path-to-regexp, prettier, qs, @types/qs, serve-static, socket.io, supertest, webpack Also fixed eslint 10 new rule violations (no-useless-assignment, prettier) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update Node.js CI matrix: remove 18.x, add 24.x - Remove unused eslint-plugin-node and its rule - Add CHANGELOG entry for 0.11.0-beta4 - Add npm publish workflow (OIDC provenance) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates moleculer-web for compatibility with Moleculer v0.15.x, including the new streaming approach and the path-to-regexp v8 migration, alongside dependency/CI/tooling updates and formatting changes across tests/examples.
Changes:
- Update gateway internals for Moleculer v0.15 streaming (stream passed via call options; multipart fields/params via
ctx.params). - Migrate alias matching to
path-to-regexpv8 API and refresh TypeScript typings. - Modernize tooling: Node >= 20, ESLint 10 flat config, Prettier config, CI matrix and npm publish workflow.
Reviewed changes
Copilot reviewed 56 out of 61 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/index.js |
Updates request handling, param merging logic, streaming call behavior, and server lifecycle/error handling. |
src/alias.js |
Migrates route regex generation to path-to-regexp v8; updates multipart handling to new streaming solution. |
src/utils.js |
Refactors helpers/formatting; adjusts minor behaviors (e.g., catch binding). |
src/memory-store.js |
Minor cleanup/formatting. |
index.d.ts |
Major rewrite of TS definitions, module augmentation, and exports to match new behaviors/deps. |
package.json |
Bumps version, raises Node engine, updates dependencies and scripts (ncu). |
eslint.config.js |
Adds ESLint flat config and Prettier integration. |
prettier.config.js |
Adds Prettier configuration. |
.editorconfig |
Updates formatting rules (md/yml indentation rules added). |
.github/workflows/nodejs.yml |
Updates CI Node.js version matrix. |
.github/workflows/publish.yml |
Adds npm publish workflow using provenance/OIDC. |
CHANGELOG.md |
Adds 0.11.0-beta4 notes and migration guidance entries. |
test/unit/service/httpHandler.spec.js |
Updates tests/formatting around requestId propagation and logging assertions. |
test/unit/errors.spec.js |
Minor cleanup. |
test/services/test.service.js |
Formatting + minor header/object literal tweaks in test service behaviors. |
test/services/posts.service.js |
Formatting-only changes. |
test/services/multiRoute.service.js |
Formatting-only changes. |
test/services/math.service.js |
Formatting-only changes. |
examples/index.js |
Minor formatting. |
examples/simple/index.js |
Formatting-only changes. |
examples/www/index.js |
Updates mixins usage to array + formatting. |
examples/full/index.js |
Updates mixins usage to array + formatting tweaks. |
examples/rest/index.js |
Updates mixins usage to array + formatting. |
examples/routing/index.js |
Updates mixins usage to array + formatting. |
examples/raw/index.js |
Updates mixins usage to array + formatting. |
examples/ssl/index.js |
Updates mixins usage to array + formatting. |
examples/spdy/index.js |
Updates mixins usage to array + formatting. |
examples/socket.io/index.js |
Formatting-only changes. |
examples/express/index.js |
Updates mixins usage to array + formatting. |
examples/express/index2.js |
Formatting-only changes. |
examples/dev/index.js |
Formatting-only changes. |
examples/cors/index.js |
Formatting-only changes. |
examples/authorization/index.js |
Updates mixins usage to array + formatting. |
examples/authentication/index.js |
Updates mixins usage to array + formatting. |
examples/multi-auth/index.js |
Updates mixins usage to array + formatting. |
examples/middlewares/index.js |
Updates service creation pattern + formatting. |
examples/direct-calls/index.js |
Updates service creation pattern + formatting. |
examples/auto-aliases/index.js |
Updates service creation pattern + formatting. |
examples/sse/index.js |
Formatting-only changes. |
examples/sse/chat.service.js |
Formatting-only changes. |
examples/formidable/index.js |
Updates formidable import/streaming parameter passing to match new streaming solution. |
examples/file/index.js |
Updates mixins usage to array + adds GET file alias. |
examples/file.service.js |
Updates mkdirp usage and switches to ctx.stream/ctx.params per new streaming solution. |
examples/test.service.js |
Formatting-only changes + minor rest schema formatting. |
examples/post.service.js |
Formatting-only changes. |
examples/auth.service.js |
Formatting-only changes. |
examples/metrics.service.js |
Formatting-only changes. |
examples/math.service.js |
Formatting-only changes. |
examples/webpack/index.js |
Formatting-only changes. |
examples/webpack-vue/index.js |
Formatting-only changes. |
examples/webpack-vue/webpack.config.js |
Formatting-only changes. |
benchmarks/simple/index.js |
Formatting-only changes. |
benchmarks/cluster/index.js |
Formatting-only changes. |
benchmarks/cluster/worker.js |
Formatting-only changes. |
benchmarks/remote/api/index.js |
Formatting-only changes. |
benchmarks/remote/api/worker.js |
Formatting-only changes. |
benchmarks/remote/worker/index.js |
Formatting-only changes. |
benchmarks/remote/worker/worker.js |
Formatting-only changes. |
.eslintrc.js |
Removed (replaced by flat config). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/index.js
Outdated
| return new this.Promise(resolve => { | ||
| this.server.listen(this.settings.port, this.settings.ip, err => { | ||
| if (err) | ||
| return reject(err); | ||
| if (err) { | ||
| return this.broker.fatal( | ||
| `Server listening error on port ${this.settings.port}.`, | ||
| err, | ||
| true // Exit process | ||
| ); | ||
| } |
There was a problem hiding this comment.
In started(), if server.listen calls back with an error you call broker.fatal() but never resolve/reject the returned Promise. If broker.fatal doesn’t terminate the process (e.g., in tests or custom broker settings), service start can hang indefinitely. Consider rejecting the promise (or resolving after initiating shutdown) and keep fatal logging/exit as an option.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
If broker.fatal() doesn't terminate the process, the start promise would hang indefinitely. Now it also rejects with the error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Major release aligning moleculer-web with Moleculer v0.15.x.
Breaking Changes
path-to-regexpupgraded to v8 — alias path syntax has changed (migration guide)/:name?→{/:name}/*name→/:name*ctx.paramsinstead of meta, file stream available inctx.streamBug Fixes
Improvements
declare module "moleculer-web"wrapper from TypeScript definitions (based on this fixes typing issues for moeculer-web #357)Dependencies
eslint-plugin-node, add@eslint/jsandglobalsfor ESLint 10CI/CD
Test plan
🤖 Generated with Claude Code