refactor(core): [CORE-21] generate compatible public and editor declarations

This commit is contained in:
Harvey Zhao committed 2026-09-11 17:56:05 +08:00
1 parent ee895a558f
commit faaa3e8c2d
123 files changed
+31305 -1712

No files matched your search

+10
View File
@@ -38,6 +38,16 @@ Remove a known case when its owning task fixes it; keep frozen release evidence
`yarn test:package:release` additionally rejects any remaining known type errors.
Passing this command alone is not authorization or sufficient evidence to publish.
The optional core `artplayer/runtime` entry has eight additional strict consumer
groups: TS 5.1.6 and 5.9.3 each check Node10 CommonJS, NodeNext CJS/ESM and Bundler.
These fixtures cover accurate returns and getter/setter types, construction-stage
callback hosts, both old and new module augmentations, old chapter factories and
the shared modern/legacy constructor. The old root remains isolated from modern
accessor syntax and retains its five original consumer groups. Runtime checks
verify the added entries reuse existing JS module and constructor identities;
`runtime/types` remains type-only. All generated core declarations are packaged,
while their authored `public/` source graph and internal implementation are excluded.
Reports, archives, installed artifact copies and build/install logs are under
`refactor/.cache/packages/run-*`; `latest.json` points to the last successful
compatibility run (a strict release rejection still leaves its report). For browser
+13
View File
@@ -27,6 +27,19 @@ const vm = require('node:vm');
const legacy = await import('artplayer/legacy')
const pluginLegacy = await import('artplayer-plugin-chapter/legacy')
check('DIST.esm-legacy', legacy.default.version === core.version && typeof pluginLegacy.default({}) === 'function')
if (!expected.baseline) {
const precise = require('artplayer/runtime')
const preciseEsm = await import('artplayer/runtime')
const preciseLegacy = require('artplayer/runtime/legacy')
const preciseLegacyEsm = await import('artplayer/runtime/legacy')
check('DIST.runtime-cjs-identity', precise === core && require.resolve('artplayer/runtime') === require.resolve('artplayer'))
check('DIST.runtime-esm-identity', preciseEsm === esm && preciseEsm.default === esm.default)
check('DIST.runtime-legacy-identity', preciseLegacy === require('artplayer/legacy') && preciseLegacyEsm === legacy)
check('DIST.runtime-shared-statics', precise.instances === core.instances && preciseEsm.default.instances === esm.default.instances && preciseLegacy.instances === legacy.default.instances)
assert.throws(() => require('artplayer/runtime/types'), error => error.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')
await assert.rejects(import('artplayer/runtime/types'), error => error.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')
check('DIST.runtime-types-only', true)
}
for (const [name, filename, globalName] of [
['core', 'artplayer/dist/artplayer.js', 'Artplayer'],
['core-legacy', 'artplayer/dist/artplayer.legacy.js', 'Artplayer'],