mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
fix(types): [PKG-FACTORY-01] preserve published factory compatibility
This commit is contained in:
1 parent
1117107032
commit
c4c7491e16
35 files changed
+670
-229
No files matched your search
@@ -53,22 +53,36 @@ video/canvas with a lexical native RAF observer across published cores 5.1.7/5.4
|
||||
and candidate core in Chromium/Firefox/WebKit. Proxy/device and complete packed
|
||||
browser/demo acceptance remain tasks 05-06; see `refactor/ambilight-validation.md`.
|
||||
|
||||
Public types merge a callable value with a type-only namespace. An optional first
|
||||
overload permits omitted/undefined options; the required final overload preserves
|
||||
the published 1.1.0 `Parameters` extraction. Do not reorder these signatures. The
|
||||
runtime factory has a self-referencing `default` property to support both historical
|
||||
CommonJS forms. `.d.mts`/`.d.cts` forward to the same declaration for the actual ESM/
|
||||
CommonJS entry kinds; `typesVersions` supplies `/legacy` to older resolvers. The
|
||||
editor global is generated by `yarn build:ts` through the semantic plugin generator.
|
||||
Root and `/legacy` public types preserve the exact published 1.1.0 required-option
|
||||
factory and result. Do not add an optional overload or a required `default`
|
||||
property: preserving `Parameters` alone does not preserve reverse assignment of
|
||||
ordinary replacement factories. The JavaScript factory still has its historical
|
||||
self-referencing `default` property and accepts omitted options.
|
||||
|
||||
`RuntimeFactory` and `/runtime` describe those optional calls and the self alias.
|
||||
The subpath maps to the same production files as root, with `runtime.d.mts` for
|
||||
native ESM and `runtime.d.cts` for CommonJS. `runtime.d.ts` provides Node10's
|
||||
export-assignment shape through `typesVersions`. Root and `/legacy` use a
|
||||
types-first mapping to the original default-export declaration, retaining 1.1.0's
|
||||
NodeNext ESM namespace shape. The editor global is generated from the root
|
||||
declaration by `yarn build:ts`; it likewise requires an options argument.
|
||||
|
||||
This follows the approved `refactor/type-compatibility-policy.md` and ADR-025.
|
||||
The earlier 1.0.0 export-assignment and required-field conflicts have migration
|
||||
examples in README. No source, emitted JavaScript, defaults, or old JS entrypoint
|
||||
changes are part of this type repair.
|
||||
|
||||
Run `node --test refactor/scripts/ambilight-types.test.mjs` for public/editor/format
|
||||
contracts and `yarn test:ambilight-types-package` for offline tarball installations
|
||||
outside the workspace. The latter verifies two actual published plugin archives and
|
||||
candidate against the same packed candidate core, five compiler modes plus two
|
||||
candidate modes with interop disabled, and ten negative uses. Published 1.1.0 fails
|
||||
NodeNext ESM with its old declarations; candidate must not inherit that failure.
|
||||
Published 1.0.0 required all option fields; 1.1.0 already made them optional. Current
|
||||
inference follows 1.1.0 while retaining valid calls from both generations.
|
||||
candidate modes with interop disabled, and fifteen negative uses at their exact
|
||||
statement lines. Published 1.1.0 has four NodeNext ESM diagnostics for the frozen
|
||||
direct-call fixture; candidate preserves those codes and its valid namespace
|
||||
consumer. Earlier 1.0.0 raw `import = require` root calls are separately checked:
|
||||
they compile against 1.0.0 and retain the 1.1.0/candidate non-callable diagnostic.
|
||||
Candidate `/runtime` raw require and native ESM calls compile successfully.
|
||||
Published 1.0.0 required all option fields; 1.1.0 already made them optional.
|
||||
|
||||
`test/ambilight-proxy.test.js` and `test/browser/ambilight-proxy.spec.js` protect
|
||||
resized output geometry. Browser tests play real video with the actual workspace
|
||||
|
||||
Reference in new issue
Block a user