SIGN IN SIGN UP

Rewatch: restore backward compatibility for bsconfig.json (#8368)

* Rewatch: restore backward compatibility for bsconfig.json

Accept the legacy config file name and the old field aliases
(bs-dependencies, bs-dev-dependencies, bsc-flags) so existing
packages continue to build. Emit a deprecation warning on the
legacy field names pointing at the modern replacements.

Co-Authored-By: Claude <noreply@anthropic.com>

* Format

Co-Authored-By: Claude <noreply@anthropic.com>

* Rewatch: deprecation warning when bsconfig.json filename is used

Co-Authored-By: Claude <noreply@anthropic.com>

* Rewatch: fall back to bsconfig.json for package name lookup; update legacy-config test

read_package_name now also looks inside bsconfig.json if neither
package.json nor rescript.json carry the package name. The
warn_legacy_config build test is updated to assert the new behavior
(build succeeds + deprecation warning is printed).

Co-Authored-By: Claude <noreply@anthropic.com>

* Rewatch: surface bsconfig/bs-* deprecations for external packages too

External packages can't fix these themselves, so the warning now
fires for any package (local or external). For external packages we
also look up an issue tracker URL from bugs/repository in package.json
and include it so users can report the issue upstream.

Co-Authored-By: Claude <noreply@anthropic.com>

* Rewatch: sort packages alphabetically when logging config warnings; refresh snapshots

Sorting the package iteration makes the warning output stable across
runs (AHashMap iteration order is otherwise nondeterministic). Snapshot
files are updated to reflect both the new deprecation messages
(bs-dependencies/bs-dev-dependencies/bsc-flags for @testrepo/deprecated-config,
and for the external rescript-nodejs + sury packages plus the
bsconfig.json filename deprecation on rescript-nodejs) and the new
sorted order.

Co-Authored-By: Claude <noreply@anthropic.com>

* Rewatch: trigger full rebuild on bsconfig.json changes in watch mode

Previously watch mode only upgraded rescript.json changes to a full
rebuild. In a bsconfig-only project, editing config fields did not
trigger recompilation, so the running watcher kept stale build state
until restarted.

Co-Authored-By: Claude <noreply@anthropic.com>

* Rewatch: consolidate per-package deprecation warnings into one block

Previously each deprecated field/filename printed its own paragraph,
which was noisy (especially for packages with multiple legacy fields,
like rescript-nodejs). The issue-tracker URL was also repeated per
warning. Collapsed into a single block per package:

  Package 'foo' uses deprecated config (support will be removed in a future version):
    - field 'bs-dependencies' — use 'dependencies' instead
    - filename 'bsconfig.json' — rename to 'rescript.json'
  Please report this to the package maintainer: https://…/issues

Snapshots and the warn_legacy_config build test are updated to match.

Co-Authored-By: Claude <noreply@anthropic.com>

* Format warn_legacy_config/input.js per biome

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
J
Jaap Frolich committed
d0d1a8fbbb4e6bdc0347f93da1dc221acf164956
Parent: c6bf334
Committed by GitHub <noreply@github.com> on 4/20/2026, 7:59:54 AM