mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 00:31:20 -08:00
fix(types): PKG-CHAPTER-04 preserve CJS ESM and legacy consumer contracts
This commit is contained in:
1 parent
48660c4e12
commit
bab80ff886
41 files changed
+1087
-119
No files matched your search
@@ -22,8 +22,10 @@ export restrictions and shared Emitter behavior. Public property descriptors and
|
||||
default configuration are compared against the fixed published core/chapter.
|
||||
This is a targeted compatibility check, not a complete behavioral API comparison.
|
||||
|
||||
Public, chapter-options, language and legacy-plugin TypeScript consumers run with
|
||||
TS 5.9.3 (Node10, NodeNext CJS/ESM and Bundler) and TS 4.3.5 (Node10). Exact known
|
||||
Public, chapter-options, chapter-exports, language and legacy-plugin consumers run with
|
||||
TS 5.9.3 (Node10, NodeNext CJS/ESM and Bundler) and TS 4.3.5 (Node10). NodeNext CJS also
|
||||
checks import-equals/require and namespaced types. PKG-CHAPTER-04 resolved the initial
|
||||
type failures; all five groups now require zero diagnostics. Exact known
|
||||
diagnostics are referenced by `known-types.json` and `test/types/known-diagnostics.json`.
|
||||
Unexpected errors and unexpectedly removed errors both require investigation.
|
||||
Remove a known case when its owning task fixes it; keep frozen release evidence intact.
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
{
|
||||
"note": "Exact published diagnostic references, not release waivers. Remove a case only with a verified fix; never edit the frozen baseline to accept a candidate regression.",
|
||||
"cases": [
|
||||
{ "mode": "node10-commonjs", "fixture": "legacy-plugin.ts", "risk": "BASE-TYPE-03" },
|
||||
{ "mode": "nodenext-esm", "fixture": "legacy-plugin.ts", "risk": "BASE-TYPE-01" },
|
||||
{ "mode": "nodenext-esm", "fixture": "language.ts", "risk": "BASE-TYPE-01" }
|
||||
]
|
||||
"cases": []
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import type { Option as PlayerOption } from 'artplayer'
|
||||
import type { Chapters, Option, Result } from 'artplayer-plugin-chapter'
|
||||
import Artplayer from 'artplayer'
|
||||
import ArtplayerLegacy from 'artplayer/legacy'
|
||||
import chapter from 'artplayer-plugin-chapter'
|
||||
import chapterLegacy from 'artplayer-plugin-chapter/legacy'
|
||||
|
||||
const chapters: Chapters = [{ start: 0, end: Infinity, title: 'First' }]
|
||||
const option: Option = { chapters }
|
||||
const playerOption: PlayerOption = { container: '#player', url: 'video.mp4', plugins: [chapter(option)] }
|
||||
const art: Artplayer = new ArtplayerLegacy(playerOption)
|
||||
const legacy: ArtplayerLegacy = new Artplayer(playerOption)
|
||||
const result: Result = chapter(option)(art)
|
||||
const oldEntry: Result = chapterLegacy()(legacy)
|
||||
result.update(option)
|
||||
oldEntry.update({})
|
||||
|
||||
// @ts-expect-error Result name is a stable literal, not an arbitrary string.
|
||||
const invalidName: Result['name'] = 'chapter'
|
||||
// @ts-expect-error Required update option remains required through the legacy entry.
|
||||
oldEntry.update()
|
||||
// @ts-expect-error Chapters do not accept string endpoints.
|
||||
const invalid: Chapters = [{ start: 0, end: '8', title: 'Bad' }]
|
||||
void [invalidName, invalid]
|
||||
@@ -0,0 +1,13 @@
|
||||
import Artplayer = require('artplayer')
|
||||
import chapter = require('artplayer-plugin-chapter')
|
||||
import legacy = require('artplayer-plugin-chapter/legacy')
|
||||
import french = require('artplayer/i18n/fr')
|
||||
|
||||
const option: Artplayer.Option = { container: '#player', url: 'video.mp4', i18n: { fr: french } }
|
||||
const art: Artplayer = new Artplayer(option)
|
||||
const result: chapter.Result = chapter()(art)
|
||||
const old: legacy.Result = legacy()(art)
|
||||
result.update({})
|
||||
old.update({})
|
||||
// @ts-expect-error CommonJS callers retain strict endpoint types.
|
||||
chapter({ chapters: [{ start: '0', end: 8, title: 'Invalid' }] })
|
||||
@@ -5,49 +5,6 @@
|
||||
"CORE-07",
|
||||
"PKG-CHAPTER-04"
|
||||
],
|
||||
"scope": "Existing workspace NodeNext ESM failure, not a candidate waiver. Remove expected failures when a documented fix adds passing consumer assertions.",
|
||||
"diagnostics": [
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 2349,
|
||||
"line": 8,
|
||||
"message": "This expression is not callable.\n Type 'typeof import(\"<workspace>/packages/artplayer-plugin-chapter/types/artplayer-plugin-chapter\")' has no call signatures."
|
||||
},
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 2351,
|
||||
"line": 10,
|
||||
"message": "This expression is not constructable.\n Type 'typeof import(\"<workspace>/packages/artplayer/types/artplayer\")' has no construct signatures."
|
||||
},
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 7006,
|
||||
"line": 10,
|
||||
"message": "Parameter 'player' implicitly has an 'any' type."
|
||||
},
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 2709,
|
||||
"line": 12,
|
||||
"message": "Cannot use namespace 'Artplayer' as a type."
|
||||
},
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 2683,
|
||||
"line": 12,
|
||||
"message": "'this' implicitly has type 'any' because it does not have a type annotation."
|
||||
},
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 2339,
|
||||
"line": 17,
|
||||
"message": "Property 'html' does not exist on type 'typeof import(\"<workspace>/packages/artplayer/types/artplayer\")'."
|
||||
},
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 2349,
|
||||
"line": 18,
|
||||
"message": "This expression is not callable.\n Type 'typeof import(\"<workspace>/packages/artplayer-plugin-chapter/types/artplayer-plugin-chapter\")' has no call signatures."
|
||||
}
|
||||
]
|
||||
"scope": "Resolved by PKG-CHAPTER-04. Historical failures remain frozen under refactor/baselines/consumers.json; current consumers must have zero diagnostics.",
|
||||
"diagnostics": []
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { I18n } from 'artplayer'
|
||||
import french from 'artplayer/i18n/fr'
|
||||
|
||||
const dictionary: NonNullable<I18n['en']> = french
|
||||
const close: string | undefined = french.Close
|
||||
// @ts-expect-error Translation values cannot be numbers.
|
||||
const numeric: number = french.Close
|
||||
// @ts-expect-error Language values do not have a permissive arbitrary-key index.
|
||||
const missing = french.notATranslation
|
||||
void [dictionary, close, numeric, missing]
|
||||
Reference in new issue
Block a user