diff --git a/packages/artplayer-plugin-vtt-thumbnail/ARCHITECTURE.md b/packages/artplayer-plugin-vtt-thumbnail/ARCHITECTURE.md index a1ef7baa5..35e45e3f8 100644 --- a/packages/artplayer-plugin-vtt-thumbnail/ARCHITECTURE.md +++ b/packages/artplayer-plugin-vtt-thumbnail/ARCHITECTURE.md @@ -66,9 +66,13 @@ a type, not an additional runtime global. Do not hand-edit generated editor decl The installed-consumer command packs both core and plugin, installs outside the workspace, verifies member hashes, and repeats an offline frozen install. It tests five actual old npm -declarations with classic default-import consumers on TS 4.3/5.9 and seven candidate modes. -Historical NodeNext and raw require type replacement forms still need investigation in 04; -these checks do not prove all historical compiler/module combinations. +declarations in five modes on TS 4.3/5.9 and seven candidate modes: 32 default-import cells, +including one expected 1.1.0 NodeNext ESM declaration failure. Candidate ESM passes that cell. +Another 36 direct/default CommonJS extraction/replacement forms reproduce the opposing 1.0.x +export-assignment and 1.1.0 default declaration shapes. Candidate preserves the latter. +Earlier type-only direct module extraction remains an explicit decision in task 04; a broken +historical JS direct call does not waive that type-only consumer. See the module-forms change +record for the concrete required/optional default-property alternatives and migration proposal. ## Compatibility and intentional fixes @@ -126,5 +130,6 @@ Pure parser comparison can use ARTPLAYER_VTT_PARSER_BASELINE=1, which loads the parser from the 524ddf78 resource checkpoint. Bundle-mode parser tests also run malformed payloads and extended registration through the actual factory; pure parsing assertions still target source and must not be described as tests of an installed tarball. -See ../../refactor/baselines/vtt-thumbnail-contract.md and the task 03 change record for +See ../../refactor/changes/2026-09-13-PKG-VTT-THUMB-04-module-forms.md, +../../refactor/baselines/vtt-thumbnail-contract.md and the task 03 change record for historical evidence and outstanding acceptance work. diff --git a/refactor/baselines/vtt-thumbnail-module-forms.json b/refactor/baselines/vtt-thumbnail-module-forms.json new file mode 100644 index 000000000..c274a0d20 --- /dev/null +++ b/refactor/baselines/vtt-thumbnail-module-forms.json @@ -0,0 +1,823 @@ +{ + "schemaVersion": 1, + "task": "PKG-VTT-THUMB-04", + "status": "doing", + "parentCommit": "db358a3ae416714cf6b75e000547f42546bcc68b", + "decision": { + "status": "pending-user", + "scope": "Retain latest 1.1.0 module type shape and document migration of earlier 1.0.x direct module type extraction. All valid historical CommonJS default calls work through the candidate alias. Earlier type-only extraction is not waived by the historical direct runtime call failure." + }, + "checks": [ + { + "command": "yarn test:vtt-thumbnail-types-package", + "file": "refactor/.cache/vtt-thumbnail04-module-matrix-final.log", + "sha256": "64c6a90f8f5985064a89387d601824a3e26c8b514fed3a019bb3625987a2e4bf", + "report": { + "file": "refactor/.cache/vtt-thumbnail-package-types-Rs0Vms/report.json", + "sha256": "98cb3dc31928e1077d37eb650f980540e36a76ddd8bf8fd73cfeb9669d44003d" + }, + "packages": [ + { + "name": "artplayer", + "archive": "D:\\github\\ArtPlayer\\refactor\\.cache\\vtt-thumbnail-package-types-Rs0Vms\\artplayer.tgz", + "sha256": "7be178936e4e12fc59d0af15402bf4b36adcd6dcf40f3ef90e73bbe6aaaf0d49", + "files": { + "package/ARCHITECTURE.md": "e19079b3d419d82c86e65d6e05c826020c06286b7edfb1cce185e62ce3c50d30", + "package/README.md": "1e185e65f67fc2081b4182bbc6c4558ea05b6e3fa3acc5dd0c3ac7df1d542b09", + "package/THIRD_PARTY_NOTICES": "b77b5b46b79fa0cda850b0781f78c3b1112c4ed9672fa291956fe8eff53098e7", + "package/dist/artplayer.cts": "0e91e907d021db02a68004603e6190505fdc0806d873ebb6af171aa089a81da7", + "package/dist/artplayer.js": "4b29968839ba816db09910a908d1d6b8ec6cf1edaad418c96e1f407545a19bf9", + "package/dist/artplayer.legacy.js": "2dc2eb7cb26012ef1d780680d622aba61a79b7ac3b37bb1ca7a6047834513dd9", + "package/dist/artplayer.mjs": "574749f090251b7d7bddb507a3ca3cc91a759f694e7f4865d19ef1162d330626", + "package/dist/artplayer.mts": "f6292596a9ccb1d43a6d6a12c35f859b1889ad15924c5ae0f9f280941aade313", + "package/dist/artplayer.ts": "26a42ac66811e70f68a8ebe62cbf304eb1993451b3e658961be98e7106162527", + "package/dist/component.ts": "aa1c43be67322781b4b355b143bc69d9f29d22e578e4974d6a13e957a7c0334f", + "package/dist/config.ts": "c4fd8681bf32b10c743e3e561c532520c8f32e43fd765524850b15e55cb91c72", + "package/dist/cssVar.ts": "e027d82fb4f01c9ce7559cf679b2d5ee1962d3f7e5b4dd64ca21f472b933efb6", + "package/dist/emitter.ts": "9c62551cdcc6dd3966bed8a7a85dd477435db977c91a294d2ac8f162f9592537", + "package/dist/events.ts": "af191f862af4ec8933b09113b8c074603ae254a8b70460d0f3006646cd74ae42", + "package/dist/i18n.ts": "34b0c684668044f7600c80b9d3979f8fb730138007b7cb4e7034326b340156fb", + "package/dist/i18n/ar.js": "bd0bef65f4f7dc3f8ed562904cc6fa9071ff4537fb64c1e0fc3d554141bcd3cb", + "package/dist/i18n/ar.mjs": "59310b7bbeea83bbb7d73aadc5ca82a6ec269c3530d19aa741c94d5c64fc5da8", + "package/dist/i18n/cs.js": "6e2c93daba24c2e48dfa206bcf4f2f2a8a02713b856e404d2e4e4ecd8309ca2f", + "package/dist/i18n/cs.mjs": "c73fba18797d62d7b2581e67fe7340c35fe84510b2250ff1ecaad253d9cabbac", + "package/dist/i18n/es.js": "f4133ac6ea06b69a474b33c4a1809a4066e2376bb9464a3f3aa8330f01f1944a", + "package/dist/i18n/es.mjs": "1390bca3def2be115e811de337df0a0c3f63998e51359f283023246245c552a7", + "package/dist/i18n/fa.js": "8d3ef2e0f0cc0ea480c2167b6fcb87cdf444e90759c3519e8daa139fec576da4", + "package/dist/i18n/fa.mjs": "ab441e8a2d79043b29ceca87c783bf06874bb9d3a149c1604bc167eb481be2a9", + "package/dist/i18n/fr.js": "89dc4194a6c0a962b9ce756b52c90401c1acf3b159f265f3bc0d7d6d7d987f03", + "package/dist/i18n/fr.mjs": "99491878430fb7b6f2b7bf93da0588a831704b412e01116f23ba1d9d45863816", + "package/dist/i18n/id.js": "4c6dc86db741bcc2857df55a9d037e82e91d375fa6fd22e0562809ff621b92db", + "package/dist/i18n/id.mjs": "383e5803a6b6686c6de4e867770241de75b6f517dcca2bdedc6f2004bf6e1fb3", + "package/dist/i18n/pl.js": "3a38828b1c3d719c0aca9906cf6a46c23555a8411f8d57645f0e0ce8147dc664", + "package/dist/i18n/pl.mjs": "079ed96732979035297af387c64a7b99519b5a43107fb86735a654ea4fe8e9b5", + "package/dist/i18n/ru.js": "62fac9dddb302eb16382e6e9301fc4b2c66f5f69d4a358a26b67026a5fa4e787", + "package/dist/i18n/ru.mjs": "a893aeaee1d79409db72e324fbff200e3864f33ed168f04d91d25f7cf2efa765", + "package/dist/i18n/tr.js": "1492c36b069a7d73db4f3913bd18085faff7afd8b3c158138fe264e31600e38c", + "package/dist/i18n/tr.mjs": "a90478cac078836b76c2a98261907610fee07f3e4b28671b8e7dbf533778f918", + "package/dist/i18n/vi.js": "c7216ef7e608a79b7e2c479a07bf310d4ab79577947ac4a62d676faaced0e9cf", + "package/dist/i18n/vi.mjs": "66270fdfa0b5da396322d1769169b7df37a030ba15ac18eb30bd87b3af8074ec", + "package/dist/i18n/zh-tw.js": "11c49857d6d40a5ffd224ffa59c9026e71621b345f63c5a086326db80a22371a", + "package/dist/i18n/zh-tw.mjs": "a38e630cb96de96c15d824686aec750e25cf6c8ada01285a292442a81566314f", + "package/dist/icons.ts": "0d8e8e52e52130dd4a29bab551dd7a2a954797e42e92a6e068c85d583e23e6a4", + "package/dist/language.cts": "2248040d86a8e34626755c4ecf53ea0174706c653073cf0e15884a030d173120", + "package/dist/language.mts": "c391e863012c77769e661afbf8fa949e9373aa88d17f58cbba7f5696edb8077f", + "package/dist/legacy/language.ts": "c452ffd764ff9b29b819b3475c42395d2ea7a33560d8c186ef5df3844b9524c3", + "package/dist/option.ts": "850e5264219b8b438c80694402225b690b131786677a5da0d22739ec2352d263", + "package/dist/playback.ts": "1ceaed3aa1cef511fe8b20f4874647f6065c723ad805b742a0a9247e16bb1bb5", + "package/dist/player.ts": "f1e50257df2ea592d0a0e1f36078dda77eaf2cf3b3d795307501396562d99f28", + "package/dist/plugin.ts": "2a57e148fda00ee687da5036b890b0f611cb94bb403a1ed52602179060259d35", + "package/dist/quality.ts": "7ed6ed78cea52991b2f6ddd2bd3b7bd8c5146fdfff7486fe8b814c3e632f1567", + "package/dist/runtime.cts": "52cfff1daeb6841a90212c8fa8d46ca46d6650bb7ed1b59b62115d854b8ad652", + "package/dist/runtime.mts": "1b09bc0ee0f0ee2f788689eaff441bdeda1fab0ce783e71b61b9792d81072b03", + "package/dist/runtime.ts": "ec4b1d56993eb482a77eb0f94b701047549d009e6ba6433f27e7d464fef30c2b", + "package/dist/runtime/component.ts": "840213299c942fe058eb5436977ceec066b9dccda24c55ae9f464b399c979e39", + "package/dist/runtime/construction.ts": "24cc5cda1f614314db382271a9b0d5583b781894cfdf6c548700b1b5270467ee", + "package/dist/runtime/events.ts": "52848f57d35eb1037cf74c8877521edf99a015bcd77f30ef6bbcba1807a99bfe", + "package/dist/runtime/media.ts": "8828f80953aec3e95328cefe691661e8897cb27cb309483cf806ec45a8549ae3", + "package/dist/runtime/option.ts": "bb672e49ffe74a6fc78543217f6de80d7d738890146df0857c709d4dc283e4ce", + "package/dist/runtime/player.ts": "a4a24794e26cfb9e4310bf0f459a7a407e85bf81b4f3a4feb6294331af8036fb", + "package/dist/runtime/plugin.ts": "9ad482f2a77914a91450419680b8af6b314b926f0831c2f7f6d7c466690f95c9", + "package/dist/runtime/services.ts": "8e4648d8c61bff47343f9e1c2b995af69fc00947264b826109ceadcbaf553254", + "package/dist/runtime/setting.ts": "c48d20957b57f79f985ef76a2950cc8a5cfa25dafa8ec5939e562661778e6218", + "package/dist/runtime/subtitle.ts": "13241c4f9a87517aa2cf7b3e0bb8cedaa12fa0b4d3f8934285797583b752557e", + "package/dist/runtime/template.ts": "da9975513a1938e7f386f4f65f718f0fc595164bfeac8f0cd99a3e97a54919a1", + "package/dist/runtime/utils.ts": "cab9916f5224a3b047812b9f759cc9cc62105662599744067a6955020ab36916", + "package/dist/setting.ts": "d12a75b656fff70cbb30be4bffec46d9c4273636e8722bce971a4d2b188712a1", + "package/dist/subtitle.ts": "d25b470e47d6a9bd696d9c1ad8adb58e56a208f05695186d513bc8c43c2e8acf", + "package/dist/template.ts": "68aed9e97d006d6be4fabb8504ca84dafab770b0925f4d6e7319e67c82f21b0d", + "package/dist/utils.ts": "494ec447ab467a07ddd7a2c2abf778b3fce69fd28a09aaa8ced9759f8de2e3f6", + "package/package.json": "82e92699e7c29847f32ac6767ece0401290e7d7a12854722bdbcfd09b90b7954", + "package/types/COMPATIBILITY.md": "a7da9e102a116104b513df4f7451247b7759bc502d3375f30bd5b14a541826e0", + "package/types/README.md": "1bd9868e773610e6312fd48a1c5aa20772d29df0af40c3db66e75b7ab4a1aee0", + "package/types/artplayer.d.cts": "3685065e4263abcfd9d953176e461d5b3eb990b0363b54689a7f55deba770fef", + "package/types/artplayer.d.mts": "b664fec51ee5c5381f2ceab25d99d52aee56feab04a2ee7b4ea5b2145ea5fa0e", + "package/types/artplayer.d.ts": "5d0162adf7ac6d0f2bb9b5cfe361f28657c4d9c540cadbf36eba3cc954ce50f8", + "package/types/component.d.ts": "ae5bc1ddeaa1ee1ebbc62573e32423993727079205c64751a5a314170e588a32", + "package/types/config.d.ts": "36f9a84cd436f17701a0d11d3417fc1fe0414e0c52c80083b94a85dfc329e37e", + "package/types/cssVar.d.ts": "93217860fff2ebf750f606d95ddd22220a58837119e63bdf2f5f78fd7488458b", + "package/types/emitter.d.ts": "7e1f9a2a8ce65feb95734f1ed52d1334e57aa388bbef2a43d8bc53a9b6f6623c", + "package/types/events.d.ts": "f83624c9268a284477e8bd793fe3562a2363b72f2a44d5c64fe8c6a6cede8830", + "package/types/i18n.d.ts": "f4f2f05bdfda73c74fef34767cb18ee8e11b743120b1c4598e9714d7846018e5", + "package/types/icons.d.ts": "326a67ba7bdcf52862c5b2a269e540140aff98d05c7b96196485a77f84fe5960", + "package/types/language.d.cts": "f7928e108cf7b7814c2d75cb0a525333e95873fca6cd6d89a740450656b9c1cd", + "package/types/language.d.mts": "6619a26d604b7cccbe2f596243d87ae37cfaae33b8b52874ec071d9787446f9e", + "package/types/legacy/language.d.ts": "c7abda4d506fd933c350e9030290bf9e64347a921d683a66115da1995ebe0a81", + "package/types/option.d.ts": "ccf2c8ddc537dc65c9682d39f044726e23bff18f476b622512d7e6a4b949b5f6", + "package/types/playback.d.ts": "58705c273df6e76a77a6575e769a9ec6c013785c25080f2551aa22415788d870", + "package/types/player.d.ts": "92b00211b70ac71336e495899df972a0519dd138111846044fe4e0f967966177", + "package/types/plugin.d.ts": "fc3594a41c51d8248713e33c486fb1f6a518ac5c7ce31be6988a6cd8d052c5f3", + "package/types/quality.d.ts": "1ac1a48b4f74ff9ba1ce60443e1463d50d1c6a2e5d87d63dc7d2a8eb7f4c2c34", + "package/types/runtime.d.cts": "7ee988dfea9a0ac71a34a656f96f7b74e78aa92547cfdfab7ff7e1139a77d4a3", + "package/types/runtime.d.mts": "dcb85f59a8b7714918ced0c1d18c2bb24e8b80b56d8c594e019dcbdb5ad88b08", + "package/types/runtime.d.ts": "9c6ccd39a1be293f17ae46dae8ea077053e12635ee79d73a5e3b3a559230fcff", + "package/types/runtime/component.d.ts": "1b4c0cee44568649e80140fe778febfcae88af0ac85515f1cbeff78ab0c6d14f", + "package/types/runtime/construction.d.ts": "7a87bedf6f7ffff0c46078aa5f1551e0077d35574e286516121f5f935e2d9ce4", + "package/types/runtime/events.d.ts": "a1e2f9d387475453eaf95c2a5ee79e228636c0bb859bda3fcc46da46574a0c31", + "package/types/runtime/media.d.ts": "8fc89401be7fe25542c169d07dd5675f10916ed20be8493e19695966cf3864a8", + "package/types/runtime/option.d.ts": "6e334e1a76fdcc40b4665c02523bd31c3994d96078fadeb40e23422aa54c1a1d", + "package/types/runtime/player.d.ts": "8ac6383502e4872e83659838844856903031a81a0adc8e8535feb78453aa042c", + "package/types/runtime/plugin.d.ts": "8528f2b17843149f42f9cc16d6fd70baa238c9dc2c329b67d2c38096799c69bd", + "package/types/runtime/services.d.ts": "604c9f8e4b6c0da818f96576bf9f4b0e96085a9003927b2f7ba30027b1ba237e", + "package/types/runtime/setting.d.ts": "349c1fcb205ad312916bd3ee55e6bf241ea8a569fb2ab6c80822e69fc518f7d7", + "package/types/runtime/subtitle.d.ts": "269ff84678d327b3a9dc2f5bc6cc0d731d1e081b85422e474621d5d792efb153", + "package/types/runtime/template.d.ts": "7a62f968a38b4bf9109a4439557c02074eb1d62ba1f6e21a8eb194e91f0badfe", + "package/types/runtime/utils.d.ts": "6bf731705d86853e066dbaf3b8d4003b6548423fe615b7412b722bd0d3a6e48b", + "package/types/setting.d.ts": "08305a75dff96f06490430e099338b463df471b550c1d0dac3abc8995b39eb09", + "package/types/subtitle.d.ts": "b18314e2d64efdb6045830b6e12f615ae2ed585416130e562329ad3ea337f6ce", + "package/types/template.d.ts": "4792bc0c2cbcb7966e4375118bd34b326166e0831862e94ace4cf6b1bbe6a8c8", + "package/types/utils.d.ts": "fca0d3d814df94a25f9eb067c86fa0cf272e2791bac793b91229d57680797712" + } + }, + { + "name": "artplayer-plugin-vtt-thumbnail", + "archive": "D:\\github\\ArtPlayer\\refactor\\.cache\\vtt-thumbnail-package-types-Rs0Vms\\artplayer-plugin-vtt-thumbnail.tgz", + "sha256": "cc4b04e263c9ecc49e586f70399911cf2c701544f339fa995bf125c332577148", + "files": { + "package/ARCHITECTURE.md": "90f333e03d6eaa341976c9ff55222c0e3a44d172ecccdb69ecccf8605b215fa0", + "package/README.md": "2291765836cf2399b057c506bc728f34b6ec14607e93c0de5d511a925b5005f3", + "package/dist/artplayer-plugin-vtt-thumbnail.js": "df70ccb5261fd988ba8c2c2d689ca58653bb5426242ffd1076569a1d225997a7", + "package/dist/artplayer-plugin-vtt-thumbnail.legacy.js": "732ade2c647281cf26446d6c7433e916f8189e2fdf2687127a56556c415544b1", + "package/dist/artplayer-plugin-vtt-thumbnail.mjs": "d35e28015df65e27da0fc01d06db07bad58e08d498b2d11fedfea35e6c4339c1", + "package/package.json": "8ebbeacaa7fa442b31cbda0012d77b5db9a2c04d588a86df0e124fd945145066", + "package/types/artplayer-plugin-vtt-thumbnail.d.cts": "56139aa2d39bfaa2aab9e1f1d22391278872e718b90290b81b6ab7eb0800a0ca", + "package/types/artplayer-plugin-vtt-thumbnail.d.mts": "56139aa2d39bfaa2aab9e1f1d22391278872e718b90290b81b6ab7eb0800a0ca", + "package/types/artplayer-plugin-vtt-thumbnail.d.ts": "76cd4e24fa734dadd9dac6528804216b793fe85dfbc37a6875a3d04498ca53c0", + "package/types/runtime.d.cts": "d99c2628bd086c99403f0d63e9fdbc2b8e58541b00926b08acfc6c1aa19fb2ce", + "package/types/runtime.d.mts": "b70486975dbe4329e1b9078f87ca7f3019ceb89d412714fe1c8e107e67b2365f", + "package/types/runtime.d.ts": "b70486975dbe4329e1b9078f87ca7f3019ceb89d412714fe1c8e107e67b2365f" + } + } + ], + "published": [ + { + "label": "published-1.0.3", + "archive": "D:\\github\\ArtPlayer\\refactor\\.cache\\releases\\artplayer-plugin-vtt-thumbnail-1.0.3.tgz", + "sha256": "286ba11db6adaeb85a4b3fef198af9a10ed0a548566d57ef7efa77c4b4f05f83", + "missingEntrypoints": {} + }, + { + "label": "published-1.0.2", + "archive": "D:\\github\\ArtPlayer\\refactor\\.cache\\releases\\artplayer-plugin-vtt-thumbnail-1.0.2.tgz", + "sha256": "a2230637d991731cef5f5f133bcb93a2e41bacb8a1a361b60b5c901a267fcbf1", + "missingEntrypoints": {} + }, + { + "label": "published-1.0.1", + "archive": "D:\\github\\ArtPlayer\\refactor\\.cache\\releases\\artplayer-plugin-vtt-thumbnail-1.0.1.tgz", + "sha256": "2827599516c48fa17c3e8c917164df8ea3f9a3a5ef2643e079fd0df73a171175", + "missingEntrypoints": {} + }, + { + "label": "published-1.0.0", + "archive": "D:\\github\\ArtPlayer\\refactor\\.cache\\releases\\artplayer-plugin-vtt-thumbnail-1.0.0.tgz", + "sha256": "18440510636529d76d97cd653433e65f795173e2e134d24caf0612845328dca1", + "missingEntrypoints": {} + }, + { + "label": "published-1.1.0", + "archive": "D:\\github\\ArtPlayer\\refactor\\.cache\\releases\\artplayer-plugin-vtt-thumbnail-1.1.0.tgz", + "sha256": "e2df36283538bbffc2c37fe28a8af0fe6fc0fa68a5f6cf93042929ee64d55765", + "missingEntrypoints": {} + } + ], + "defaultImportCells": { + "total": 32, + "compiled": 31, + "expectedHistoricalFailure": 1 + }, + "commonjsForms": { + "total": 36, + "compiled": 18, + "expectedDeclarationFailures": 18 + }, + "matrix": [ + { + "plugin": "published-1.0.3", + "compiler": "5.9.3", + "mode": "node10-commonjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": true, + "diagnostics": [] + }, + "default": { + "typeChecks": false, + "diagnostics": [ + 2339 + ] + } + } + }, + { + "plugin": "published-1.0.3", + "compiler": "5.9.3", + "mode": "nodenext-cjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": true, + "diagnostics": [] + }, + "default": { + "typeChecks": false, + "diagnostics": [ + 2339 + ] + } + } + }, + { + "plugin": "published-1.0.3", + "compiler": "5.9.3", + "mode": "nodenext-esm", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": {} + }, + { + "plugin": "published-1.0.3", + "compiler": "5.9.3", + "mode": "bundler-esm", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": {} + }, + { + "plugin": "published-1.0.3", + "compiler": "4.3.5", + "mode": "node10-commonjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": true, + "diagnostics": [] + }, + "default": { + "typeChecks": false, + "diagnostics": [ + 2339 + ] + } + } + }, + { + "plugin": "published-1.0.2", + "compiler": "5.9.3", + "mode": "node10-commonjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": true, + "diagnostics": [] + }, + "default": { + "typeChecks": false, + "diagnostics": [ + 2339 + ] + } + } + }, + { + "plugin": "published-1.0.2", + "compiler": "5.9.3", + "mode": "nodenext-cjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": true, + "diagnostics": [] + }, + "default": { + "typeChecks": false, + "diagnostics": [ + 2339 + ] + } + } + }, + { + "plugin": "published-1.0.2", + "compiler": "5.9.3", + "mode": "nodenext-esm", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": {} + }, + { + "plugin": "published-1.0.2", + "compiler": "5.9.3", + "mode": "bundler-esm", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": {} + }, + { + "plugin": "published-1.0.2", + "compiler": "4.3.5", + "mode": "node10-commonjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": true, + "diagnostics": [] + }, + "default": { + "typeChecks": false, + "diagnostics": [ + 2339 + ] + } + } + }, + { + "plugin": "published-1.0.1", + "compiler": "5.9.3", + "mode": "node10-commonjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": true, + "diagnostics": [] + }, + "default": { + "typeChecks": false, + "diagnostics": [ + 2339 + ] + } + } + }, + { + "plugin": "published-1.0.1", + "compiler": "5.9.3", + "mode": "nodenext-cjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": true, + "diagnostics": [] + }, + "default": { + "typeChecks": false, + "diagnostics": [ + 2339 + ] + } + } + }, + { + "plugin": "published-1.0.1", + "compiler": "5.9.3", + "mode": "nodenext-esm", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": {} + }, + { + "plugin": "published-1.0.1", + "compiler": "5.9.3", + "mode": "bundler-esm", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": {} + }, + { + "plugin": "published-1.0.1", + "compiler": "4.3.5", + "mode": "node10-commonjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": true, + "diagnostics": [] + }, + "default": { + "typeChecks": false, + "diagnostics": [ + 2339 + ] + } + } + }, + { + "plugin": "published-1.0.0", + "compiler": "5.9.3", + "mode": "node10-commonjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": true, + "diagnostics": [] + }, + "default": { + "typeChecks": false, + "diagnostics": [ + 2339 + ] + } + } + }, + { + "plugin": "published-1.0.0", + "compiler": "5.9.3", + "mode": "nodenext-cjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": true, + "diagnostics": [] + }, + "default": { + "typeChecks": false, + "diagnostics": [ + 2339 + ] + } + } + }, + { + "plugin": "published-1.0.0", + "compiler": "5.9.3", + "mode": "nodenext-esm", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": {} + }, + { + "plugin": "published-1.0.0", + "compiler": "5.9.3", + "mode": "bundler-esm", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": {} + }, + { + "plugin": "published-1.0.0", + "compiler": "4.3.5", + "mode": "node10-commonjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": true, + "diagnostics": [] + }, + "default": { + "typeChecks": false, + "diagnostics": [ + 2339 + ] + } + } + }, + { + "plugin": "published-1.1.0", + "compiler": "5.9.3", + "mode": "node10-commonjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": false, + "diagnostics": [ + 2322, + 2344, + 2344, + 2322, + 2344, + 2349 + ] + }, + "default": { + "typeChecks": true, + "diagnostics": [] + } + } + }, + { + "plugin": "published-1.1.0", + "compiler": "5.9.3", + "mode": "nodenext-cjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": false, + "diagnostics": [ + 2322, + 2344, + 2344, + 2322, + 2344, + 2349 + ] + }, + "default": { + "typeChecks": true, + "diagnostics": [] + } + } + }, + { + "plugin": "published-1.1.0", + "compiler": "5.9.3", + "mode": "nodenext-esm", + "defaultImportDiagnostics": [ + 2322, + 2344, + 2349, + 2344, + 2322, + 2344, + 2349 + ], + "historicalFailure": true, + "candidateNegativeDiagnostics": [], + "commonjs": {} + }, + { + "plugin": "published-1.1.0", + "compiler": "5.9.3", + "mode": "bundler-esm", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": {} + }, + { + "plugin": "published-1.1.0", + "compiler": "4.3.5", + "mode": "node10-commonjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [], + "commonjs": { + "direct": { + "typeChecks": false, + "diagnostics": [ + 2322, + 2344, + 2344, + 2741, + 2344, + 2349 + ] + }, + "default": { + "typeChecks": true, + "diagnostics": [] + } + } + }, + { + "plugin": "candidate", + "compiler": "5.9.3", + "mode": "node10-commonjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [ + 2322, + 2739, + 2339, + 2554, + 2345, + 2322, + 2322, + 2353, + 2554, + 2741 + ], + "commonjs": { + "direct": { + "typeChecks": false, + "diagnostics": [ + 2322, + 2344, + 2344, + 2322, + 2344, + 2349 + ] + }, + "default": { + "typeChecks": true, + "diagnostics": [] + } + } + }, + { + "plugin": "candidate", + "compiler": "5.9.3", + "mode": "nodenext-cjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [ + 2322, + 2739, + 2339, + 2554, + 2345, + 2322, + 2322, + 2353, + 2554, + 2741 + ], + "commonjs": { + "direct": { + "typeChecks": false, + "diagnostics": [ + 2322, + 2344, + 2344, + 2322, + 2344, + 2349 + ] + }, + "default": { + "typeChecks": true, + "diagnostics": [] + } + } + }, + { + "plugin": "candidate", + "compiler": "5.9.3", + "mode": "nodenext-esm", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [ + 2322, + 2739, + 2339, + 2554, + 2345, + 2322, + 2322, + 2353, + 2554, + 2741 + ], + "commonjs": {} + }, + { + "plugin": "candidate", + "compiler": "5.9.3", + "mode": "bundler-esm", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [ + 2322, + 2739, + 2339, + 2554, + 2345, + 2322, + 2322, + 2353, + 2554, + 2741 + ], + "commonjs": {} + }, + { + "plugin": "candidate", + "compiler": "4.3.5", + "mode": "node10-commonjs", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [ + 2322, + 2739, + 2339, + 2554, + 2345, + 2322, + 2322, + 2345, + 2554, + 2741 + ], + "commonjs": { + "direct": { + "typeChecks": false, + "diagnostics": [ + 2322, + 2344, + 2344, + 2741, + 2344, + 2349 + ] + }, + "default": { + "typeChecks": true, + "diagnostics": [] + } + } + }, + { + "plugin": "candidate", + "compiler": "5.9.3", + "mode": "node10-commonjs-no-interop", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [ + 2322, + 2739, + 2339, + 2554, + 2345, + 2322, + 2322, + 2353, + 2554, + 2741 + ], + "commonjs": {} + }, + { + "plugin": "candidate", + "compiler": "4.3.5", + "mode": "node10-commonjs-no-interop", + "defaultImportDiagnostics": [], + "historicalFailure": false, + "candidateNegativeDiagnostics": [ + 2322, + 2739, + 2339, + 2554, + 2345, + 2322, + 2322, + 2345, + 2554, + 2741 + ], + "commonjs": {} + } + ] + }, + { + "command": "node --test refactor/scripts/vtt-thumbnail-types.test.mjs", + "tests": 5, + "pass": 5, + "file": "refactor/.cache/vtt-thumbnail04-module-types.log", + "sha256": "612fc0c0ba47c4cbf143e3411092840ef42dc9e35660845f8156f9390b2d6f3a" + }, + { + "command": "explicit lint of changed scripts and consumer fixtures", + "file": "refactor/.cache/vtt-thumbnail04-module-lint-verified.log", + "sha256": "9b18be65f3a59b87d30edef987cc64f5f2e58cd6acb9d37be5189f259c110c62" + } + ], + "inheritedProductionEvidence": { + "file": "refactor/baselines/vtt-thumbnail-public-types.json", + "sha256": "dea4c08cab14f95f8c23aa28af84fa1e0dd1cf1b637b011218ccec4a3853ee74", + "sourceTypesEntrypointsAndArtifactsUnchanged": true, + "scope": "Production and 54 browser checks are inherited from db358a3a, not rerun for this test/document-only checkpoint. Full CI 2069 was for that parent; this checkpoint reports focused tests separately." + }, + "inputs": { + "refactor/scripts/vtt-thumbnail-package-types.mjs": "2c782bf8ec797fc0d5811c22e4a7a5a1c5981ae3e78edcdaf9c405de0dbba9fe", + "refactor/scripts/vtt-thumbnail-types.test.mjs": "c865ae9420e878ea52c9b7dcf7e3bd730ad60219ab8df3050e885263b343c6aa", + "refactor/fixtures/consumers/vtt-thumbnail-commonjs.ts": "4e076da108d9cd722990511318f0baf2db0c2ea8bd0037fa77febff058ea4027", + "refactor/fixtures/consumers/vtt-thumbnail-export-alternatives.ts": "8a33934839371bee21b24ec6888e3d17909ea0b3cfc3405be2a7758a24f5d7f5" + } +} diff --git a/refactor/changes/2026-09-13-PKG-VTT-THUMB-04-module-forms.md b/refactor/changes/2026-09-13-PKG-VTT-THUMB-04-module-forms.md new file mode 100644 index 000000000..a7ab54900 --- /dev/null +++ b/refactor/changes/2026-09-13-PKG-VTT-THUMB-04-module-forms.md @@ -0,0 +1,54 @@ +# PKG-VTT-THUMB-04 历史模块形式与待决类型差异 + +## 已验证事实 + +在仓库外分别安装五个真实历史 npm 包和当前候选包,核心使用实际 packed candidate。 +逐成员核对字节,并执行 offline/frozen 重装;验证脚本仍为 +`yarn test:vtt-thumbnail-types-package`。本次从 17 格扩至 32 格默认导入矩阵,包含 +TS 5.9.3 classic、NodeNext CJS/ESM、bundler,以及 TS 4.3.5 classic。 +候选另含两个关闭 interop 的 classic 格。31 格编译通过,1 格准确复现历史错误: +1.1.0 NodeNext ESM 的声明被解释成不可调用的模块对象。候选成对声明已通过该格。 + +同一安装环境另验证 36 个 CommonJS 直接/default 类型提取与替换工厂形式,明确区分 +历史声明和真实运行时。表中的直接调用指 `const value = require(package); value({})`; +default 调用指 `value.default({})`。类型侧使用 `import plugin = require(package)`, +同时检查 Parameters、ReturnType 和普通替换函数赋值。 + +| 版本 | 直接形式声明 | 直接调用运行时 | default 形式声明 | default 调用运行时 | +| --- | --- | --- | --- | --- | +| 1.0.1–1.0.3 | 通过 | TypeError,模块是对象 | TS2339,无 default 类型 | 可用 | +| 1.1.0 | 不可调用模块类型 | 可用 | 通过 | 无 default 函数 | +| 当前候选 | 保持 1.1.0 模块类型 | 可用 | 通过 | 可用 | + +1.0.0 声明与其他 1.0.x 相同,但真实 bundle 加载即发生无效正则 SyntaxError,不能把其 +声明通过算作运行时通过。历史复现断言与候选成功分开,不能把预期错误计作兼容批准。 + +## 需要保留为待决的边界 + +1.0.x 的 `Parameters`、`typeof plugin` 替换工厂可以只用于类型操作, +即使其声明描述的直接 JS 调用本来不可用,这些类型操作本身仍然成立。不能因此删掉它们 +的兼容责任。1.1.0 已经改变这种形状,候选目前沿用 1.1.0;这不是本次新增的运行时回归, +但从 1.0.x 直接升级仍有类型迁移差异。 + +已验证两种简单合并方案的代价(TS 5.9 classic/NodeNext CJS、TS 4.3 classic): + +- `Factory & { default: Factory }` 让普通替换工厂缺少必需的 default 属性,TS2322。 +- `Factory & { default?: Factory }` 保留该赋值,却让未经判空的 default 调用报 TS2722。 + +这些实验说明上述两种方案不能直接替换旧入口,不是对所有可能声明设计的数学证明。 +没有修改全局 Function、引入 any 或关闭 strict 来掩盖冲突。 + +建议保留当前 1.1.0 默认导入/模块类型和实际运行时兼容别名,并明确记录较早类型消费者的 +迁移方法:`import vtt from 'artplayer-plugin-vtt-thumbnail'` 后从 `typeof vtt` 提取, +或直接 `import type { Factory } from 'artplayer-plugin-vtt-thumbnail'`。需要准确异步结果时 +使用 `/runtime`。这个建议尚需用户决定;未经确认不将 04 或 TYPE 风险标为完成。 + +## 本次交付与验证 + +新增可重跑的 CommonJS 消费者夹具,安装矩阵固定历史错误码;新增合并方案反例,固定 +错误位置与错误码。默认/default 可用调用和候选所有正反例继续检查,不缩减前次范围。 +结果见 [验证](../baselines/vtt-thumbnail-module-forms.json)。 + +生产源码、公开声明、manifest、dist 和 demo 均未改变,因此复用 db358a3a 的生产及 +54 项浏览器证据;本次测试/文档检查不能替代后续设备与组合验收。包内架构和进度同步。 +无新依赖,不推送或发布。回退本检查点只移除扩展矩阵/反例和记录,不改变生产行为。 diff --git a/refactor/fixtures/consumers/vtt-thumbnail-commonjs.ts b/refactor/fixtures/consumers/vtt-thumbnail-commonjs.ts new file mode 100644 index 000000000..9e2691072 --- /dev/null +++ b/refactor/fixtures/consumers/vtt-thumbnail-commonjs.ts @@ -0,0 +1,11 @@ +import type Artplayer from 'artplayer' +// eslint-disable-next-line ts/no-require-imports -- Exercise historical export-assignment consumers. +import plugin = require('artplayer-plugin-vtt-thumbnail') + +const vtt = plugin +declare const art: Artplayer +const options: Parameters[0] = {} +const result: ReturnType> = { name: 'artplayerPluginVttThumbnail' } +const replacement: typeof vtt = (_option: Parameters[0]) => (_art: Artplayer) => result +void vtt(options)(art).name +void replacement diff --git a/refactor/fixtures/consumers/vtt-thumbnail-export-alternatives.ts b/refactor/fixtures/consumers/vtt-thumbnail-export-alternatives.ts new file mode 100644 index 000000000..ebc778bd5 --- /dev/null +++ b/refactor/fixtures/consumers/vtt-thumbnail-export-alternatives.ts @@ -0,0 +1,7 @@ +import type { Factory } from 'artplayer-plugin-vtt-thumbnail' + +declare const replacement: Factory +const required: Factory & { default: Factory } = replacement +const optional: Factory & { default?: Factory } = replacement +optional.default({}) +void required diff --git a/refactor/plan.md b/refactor/plan.md index cfbe4be60..64c04bebf 100644 --- a/refactor/plan.md +++ b/refactor/plan.md @@ -500,7 +500,7 @@ - PKG-VTT-THUMB-01: [记录](baselines/vtt-thumbnail-release.json) [记录](baselines/vtt-thumbnail-contract.md) [记录](changes/2026-09-13-PKG-VTT-THUMB-01-contract.md) - PKG-VTT-THUMB-02: [记录](baselines/vtt-thumbnail-failures.json) [记录](changes/2026-09-13-PKG-VTT-THUMB-02-failures.md) - PKG-VTT-THUMB-03: [记录](changes/2026-09-13-PKG-VTT-THUMB-03-resources.md) [记录](baselines/vtt-thumbnail-resources.json) [记录](changes/2026-09-13-PKG-VTT-THUMB-03-parser.md) [记录](baselines/vtt-thumbnail-parser.json) -- PKG-VTT-THUMB-04: [记录](changes/2026-09-13-PKG-VTT-THUMB-04-runtime-types.md) [记录](baselines/vtt-thumbnail-runtime-types.json) [记录](changes/2026-09-13-PKG-VTT-THUMB-04-public-types.md) [记录](baselines/vtt-thumbnail-public-types.json) +- PKG-VTT-THUMB-04: [记录](changes/2026-09-13-PKG-VTT-THUMB-04-runtime-types.md) [记录](baselines/vtt-thumbnail-runtime-types.json) [记录](changes/2026-09-13-PKG-VTT-THUMB-04-public-types.md) [记录](baselines/vtt-thumbnail-public-types.json) [记录](changes/2026-09-13-PKG-VTT-THUMB-04-module-forms.md) [记录](baselines/vtt-thumbnail-module-forms.json) - PKG-HLS-01: [记录](baselines/hls-control-contract.md) [记录](baselines/hls-control-release.json) [记录](changes/2026-09-11-PKG-HLS-01-contract.md) - PKG-HLS-02: [记录](hls-validation.md) [记录](baselines/hls-sdk.json) [记录](baselines/hls-validation.json) [记录](changes/2026-09-11-PKG-HLS-02-tests.md) - PKG-HLS-03: [记录](changes/2026-09-12-PKG-HLS-03-modules.md) [记录](baselines/hls-modules-validation.json) [记录](hls-validation.md) diff --git a/refactor/progress.md b/refactor/progress.md index a22ecc898..a7bf90071 100644 --- a/refactor/progress.md +++ b/refactor/progress.md @@ -1,5 +1,20 @@ # 进度与证据 +## PKG-VTT-THUMB-04 历史模块形式核对(doing,类型取舍待用户决定) + +实际仓库外安装矩阵扩至 32 格默认导入:31 编译通过,1 格复现 1.1.0 NodeNext ESM +旧声明错误;候选该格通过。另核对 36 个 CommonJS 直接/default 提取和替换形式, +18 编译通过、18 准确复现两代声明差异,预期失败不等于兼容批准。 +1.0.x 直接模块类型操作虽可通过、真实 CJS 直接调用却失败;1.1.0 改为 default 类型。 +候选保留 1.1.0 类型,并使直接/default 两种 JS 调用均可用;早期纯类型提取仍有迁移差异。 +已测试必需/可选 default 合并方案的具体代价,并向用户请求确认保留最新形状的建议。 +5 项公开类型测试和显式 lint 通过;生产源码/声明/入口/产物不变,复用上一提交的生产 +与浏览器证据,不声称本次重跑全量 CI。见[变更](changes/2026-09-13-PKG-VTT-THUMB-04-module-forms.md) +和[验证](baselines/vtt-thumbnail-module-forms.json)。任务与 TYPE/EXPORT 风险保持未完成。 +222 项:117 done、13 doing、92 todo;独立本地检查点提交,不推送、不发布。 +若决定尚未返回,可先进入依赖已完成的 PKG-MULTI-SUB-01,不以等待暂停整个重构。 + + ## PKG-VTT-THUMB-04 公开类型与安装消费者检查点(doing) 保留 root/legacy 旧参数、同步结果类型及替换工厂赋值,新增 /runtime 表达真实 Promise, diff --git a/refactor/risks.json b/refactor/risks.json index 94b7d72df..9777fd311 100644 --- a/refactor/risks.json +++ b/refactor/risks.json @@ -4205,7 +4205,9 @@ "refactor/baselines/vtt-thumbnail-runtime-types.json", "refactor/changes/2026-09-13-PKG-VTT-THUMB-04-public-types.md", "refactor/baselines/vtt-thumbnail-public-types.json", - "refactor/scripts/vtt-thumbnail-package-types.mjs" + "refactor/scripts/vtt-thumbnail-package-types.mjs", + "refactor/changes/2026-09-13-PKG-VTT-THUMB-04-module-forms.md", + "refactor/baselines/vtt-thumbnail-module-forms.json" ], "compatibleResolution": "Preserve valid consumers and actual async runtime, with explicit decisions for irreconcilable inference changes.", "closureCriteria": "Isolated old/new compiler and installed consumers verify options, styles, callback and result forms." @@ -4226,7 +4228,9 @@ "refactor/scripts/vtt-thumbnail-contract.test.mjs", "refactor/changes/2026-09-13-PKG-VTT-THUMB-04-public-types.md", "refactor/baselines/vtt-thumbnail-public-types.json", - "refactor/scripts/vtt-thumbnail-package-types.mjs" + "refactor/scripts/vtt-thumbnail-package-types.mjs", + "refactor/changes/2026-09-13-PKG-VTT-THUMB-04-module-forms.md", + "refactor/baselines/vtt-thumbnail-module-forms.json" ], "compatibleResolution": "Validate historical import forms and control integrations before selecting compatibility adapters.", "closureCriteria": "Actual package consumers and old/new cores prove supported forms; unresolved differences stay explicit." diff --git a/refactor/scripts/vtt-thumbnail-package-types.mjs b/refactor/scripts/vtt-thumbnail-package-types.mjs index 64b042b41..0ea6194c7 100644 --- a/refactor/scripts/vtt-thumbnail-package-types.mjs +++ b/refactor/scripts/vtt-thumbnail-package-types.mjs @@ -55,12 +55,15 @@ assert.equal(require('artplayer-plugin-vtt-thumbnail/runtime'), require('artplay Promise.all(['artplayer-plugin-vtt-thumbnail', 'artplayer-plugin-vtt-thumbnail/runtime', 'artplayer-plugin-vtt-thumbnail/legacy'].map(name => import(name))).then(([root, runtime, legacy]) => { assert.deepEqual(Object.keys(root), ['default']); assert.deepEqual(Object.keys(runtime), ['default']); assert.equal(runtime.default, root.default); assert.equal(root.default.default, root.default); assert.equal(legacy.default, require('artplayer-plugin-vtt-thumbnail/legacy')); assert.equal(legacy.default.default, legacy.default); }).catch(error => { console.error(error); process.exitCode = 1; });` : plugin.version === '1.0.0' ? `const assert = require('node:assert/strict'); assert.throws(() => require('artplayer-plugin-vtt-thumbnail'), error => error.name === 'SyntaxError' && error.message.includes('Invalid regular expression')); console.log('Expected historical 1.0.0 invalid runtime syntax preserved');` - : `const assert = require('node:assert/strict'); const value = require('artplayer-plugin-vtt-thumbnail'); assert.equal(typeof value, '${plugin.version === '1.1.0' ? 'function' : 'object'}'); assert.equal(typeof (value.default || value)({}), 'function');`) + : `const assert = require('node:assert/strict'); const value = require('artplayer-plugin-vtt-thumbnail'); assert.equal(typeof value, '${plugin.version === '1.1.0' ? 'function' : 'object'}'); assert.equal(typeof (value.default || value)({}), 'function'); ${plugin.version === '1.1.0' ? '' : 'assert.throws(() => value({}), { name: \'TypeError\', message: \'value is not a function\' });'}`) + if (plugin.version && plugin.version !== '1.0.0') + fs.appendFileSync(runtimeFile, `\nassert.equal(typeof value.default, '${plugin.version === '1.1.0' ? 'undefined' : 'function'}');`) fs.writeFileSync(path.join(output, `${plugin.label}-runtime.log`), run([runtimeFile], consumer)) const candidateModes = [[ts, 'node10-commonjs'], [ts, 'nodenext-cjs'], [ts, 'nodenext-esm'], [ts, 'bundler-esm'], [compat, 'node10-commonjs']] if (plugin.label === 'candidate') candidateModes.push([ts, 'node10-commonjs-no-interop'], [compat, 'node10-commonjs-no-interop']) - for (const [compiler, mode] of (plugin.label === 'candidate' ? candidateModes : [[ts, 'node10-commonjs'], [compat, 'node10-commonjs']])) { + const historicalModes = [[ts, 'node10-commonjs'], [ts, 'nodenext-cjs'], [ts, 'nodenext-esm'], [ts, 'bundler-esm'], [compat, 'node10-commonjs']] + for (const [compiler, mode] of (plugin.label === 'candidate' ? candidateModes : historicalModes)) { const next = mode.startsWith('nodenext') const extension = next ? mode.endsWith('-cjs') ? 'cts' : 'mts' : 'ts' const source = fs.readFileSync(path.join(workspace, plugin.label === 'candidate' ? 'test/types/vtt-thumbnail-public.ts' : 'refactor/fixtures/consumers/vtt-thumbnail-published.ts'), 'utf8') @@ -84,22 +87,36 @@ Promise.all(['artplayer-plugin-vtt-thumbnail', 'artplayer-plugin-vtt-thumbnail/r return compiler.getPreEmitDiagnostics(program).map(item => ({ code: item.code, message: compiler.flattenDiagnosticMessageText(item.messageText, '\n') })) } const diagnostics = compile(source) - const expected = [] - const historicalFailure = false + const historicalFailure = plugin.version === '1.1.0' && mode === 'nodenext-esm' + const expected = historicalFailure ? [2322, 2344, 2349, 2344, 2322, 2344, 2349] : [] writeJson(path.join(output, `${plugin.label}-${compiler.version}-${mode}-diagnostics.json`), { diagnostics, historicalFailure }) assert.deepEqual(diagnostics.map(item => item.code), expected, `${plugin.label} ${compiler.version} ${mode}`) const invalid = plugin.label === 'candidate' ? compile(source.replaceAll(/\/\/ @ts-expect-error[^\n]*\n/g, '')) : [] if (plugin.label === 'candidate') assert.equal(invalid.length, 10, 'Installed declarations must reject all invalid uses') - matrix.push({ plugin: plugin.label, compiler: compiler.version, mode, historicalFailure, diagnostics, invalid }) + const commonjs = {} + if (mode === 'node10-commonjs' || mode === 'nodenext-cjs') { + const fixture = fs.readFileSync(path.join(workspace, 'refactor/fixtures/consumers/vtt-thumbnail-commonjs.ts'), 'utf8') + const oldAssignment = plugin.version?.startsWith('1.0.') === true + for (const form of ['direct', 'default']) { + const consumer = form === 'direct' ? fixture : fixture.replace('const vtt = plugin', 'const vtt = plugin.default') + const diagnostics = compile(consumer) + const expected = form === 'default' + ? oldAssignment ? [2339] : [] + : oldAssignment ? [] : [2322, 2344, 2344, compiler === compat ? 2741 : 2322, 2344, 2349] + assert.deepEqual(diagnostics.map(item => item.code), expected, `${plugin.label} ${compiler.version} ${mode} require ${form}`) + commonjs[form] = { diagnostics, typeChecks: diagnostics.length === 0 } + } + } + matrix.push({ plugin: plugin.label, compiler: compiler.version, mode, historicalFailure, diagnostics, invalid, commonjs }) } } finally { removeConsumer(consumer) } } - writeJson(path.join(output, 'report.json'), { suite: 'vtt-thumbnail-isolated-package-types', introducedBy: 'PKG-VTT-THUMB-04', scope: 'Five actual published packages (classic default-import consumers on TS 4.3 and 5.9) and packed candidate (seven compiler modes) installed outside the workspace with packed core. Offline/frozen reinstall and byte identity are verified. Candidate provides an opt-in accurate runtime entry; 1.0.0 invalid bundle syntax is retained. Historical NodeNext variants, raw require type replacements, device and full distribution acceptance remain separate.', packages, published: candidates.slice(0, 5).map(pkg => ({ label: pkg.label, archive: pkg.archive, sha256: hash(fs.readFileSync(pkg.archive)), missingEntrypoints: pkg.missingEntrypoints })), matrix }) - console.log(`VTT thumbnail installed types passed: ${matrix.length} cases; ${output}`) + writeJson(path.join(output, 'report.json'), { suite: 'vtt-thumbnail-isolated-package-types', introducedBy: 'PKG-VTT-THUMB-04', scope: 'Five actual published packages in five compiler modes and packed candidate in seven modes, installed outside the workspace with packed core. Offline/frozen reinstall and byte identity are verified. One historical NodeNext ESM declaration failure is expected, not accepted as candidate success. Direct/default import=require extraction and replacement forms reproduce opposing 1.0.x and 1.1.0 declarations; the candidate preserves 1.1.0 forms. The 1.0.x direct module type difference remains unresolved, although old actual CommonJS direct calls already fail. Device and full distribution acceptance remain separate.', packages, published: candidates.slice(0, 5).map(pkg => ({ label: pkg.label, archive: pkg.archive, sha256: hash(fs.readFileSync(pkg.archive)), missingEntrypoints: pkg.missingEntrypoints })), matrix }) + console.log(`VTT thumbnail installed matrix verified: ${matrix.length} cases, including ${matrix.filter(item => item.historicalFailure).length} expected historical declaration failure; ${output}`) } main().catch((error) => { diff --git a/refactor/scripts/vtt-thumbnail-types.test.mjs b/refactor/scripts/vtt-thumbnail-types.test.mjs index 7d72745b8..7aec20a59 100644 --- a/refactor/scripts/vtt-thumbnail-types.test.mjs +++ b/refactor/scripts/vtt-thumbnail-types.test.mjs @@ -53,6 +53,14 @@ const promise: Promise<{name: 'artplayerPluginVttThumbnail'}> = first; legacy.default({})(art).name; void [promise, second];`), []) }) +test('VTT callable CommonJS alternatives expose replacement and optional-default conflicts explicitly', () => { + const source = fs.readFileSync('refactor/fixtures/consumers/vtt-thumbnail-export-alternatives.ts', 'utf8') + for (const [compiler, mode] of [[ts, 'node10-commonjs'], [ts, 'nodenext-cjs'], [compat, 'node10-commonjs']]) { + const diagnostics = checkConsumer(compiler, mode, source) + assert.deepEqual(diagnostics.map(item => ({ line: item.line, code: item.code })), [{ line: 4, code: 2322 }, { line: 6, code: 2722 }]) + } +}) + test('VTT all five historical declarations keep the same default-import consumers and replaceable old factory', async () => { const contract = await verifyVttThumbnailContract() const consumer = fs.readFileSync('refactor/fixtures/consumers/vtt-thumbnail-published.ts', 'utf8') diff --git a/refactor/tasks.json b/refactor/tasks.json index 81bbc93d7..9f95d7128 100644 --- a/refactor/tasks.json +++ b/refactor/tasks.json @@ -1929,7 +1929,9 @@ "changes/2026-09-13-PKG-VTT-THUMB-04-runtime-types.md", "baselines/vtt-thumbnail-runtime-types.json", "changes/2026-09-13-PKG-VTT-THUMB-04-public-types.md", - "baselines/vtt-thumbnail-public-types.json" + "baselines/vtt-thumbnail-public-types.json", + "changes/2026-09-13-PKG-VTT-THUMB-04-module-forms.md", + "baselines/vtt-thumbnail-module-forms.json" ] }, {