refactor(site): [SITE-CONSOLE-01] restore typed console and lifecycle ownership

This commit is contained in:
Harvey Zhao committed 2026-09-15 06:15:32 +08:00
1 parent 6cd2d0ffbe
commit 3dba82a453
29 files changed
+1884 -36

No files matched your search

+5 -2
View File
@@ -61,6 +61,9 @@ The repository generators have different ownership:
- `scripts/build-i18n.js`: typed standalone language builds, staged before replacing
distribution and `docs/compiled/i18n/` together; legacy globals and paths remain.
- `scripts/build-docs.js`: this VitePress build through pinned Yarn and staged output.
- `scripts/build-console.mjs`: owned desktop console TS entry/view and shared log
lifecycle, keeping the original React/Parcel runtime. Run `build:console` after
edits and `check:console` for drift. See [console maintenance](../../scripts/site-vendor/console/README.md).
- `scripts/build-llm.js`: offline source-preserving `docs/llms.txt` and fingerprint
manifest. `yarn check:llm` checks drift in CI; `ci:build` regenerates after types.
- `scripts/trans-docs.js`: local plan by default; explicit `--remote` creates a
@@ -94,8 +97,8 @@ current rules and verified scope. Full site/search acceptance remains SITE-05.
SITE-07 now checks frozen Monaco/vConsole files and generates verbatim upstream
texts under `docs/licenses/` with `build:site-notices` / `check:site-notices`.
See `scripts/site-vendor/README.md`: the vConsole upstream LICENSE is incomplete,
and its WebKit destruction regression remains open. The notices index explicitly
See `scripts/site-vendor/README.md`: vConsole sources/notices and its destruction
fix now have separate evidence. The notices index explicitly
does not clear the console bundle, fonts, media or the rest of the site.
`scripts/projects.js` excludes this workspace from the 21 library builds.
@@ -70,7 +70,9 @@ Imports preserve sequential JS/CSS insertion and the last lowercased `[name]` la
Unsupported extensions are ignored; local labels are not persistable dependency URLs.
File errors now reject, cancellation removes handlers, and batches are serialized.
On non-persisted pagehide the editor cleans listeners, models, declaration libraries,
FileReaders, imported nodes and players. Executed script globals cannot be undone by
FileReaders, imported nodes, players and the desktop console viewer. The optional
`consoleLog.unmount` adapter releases its hook and pending work; older console
bundles without the adapter remain loadable. Executed script globals cannot be undone by
removing script nodes. Persisted pagehide keeps state; synthetic lifecycle tests do
not certify physical-device BFCache behavior.
@@ -25,7 +25,7 @@ export type EditorHost = Window & {
}
monaco: typeof Monaco
require: AmdLoader
consoleLog: (element: HTMLElement) => void
consoleLog: ((element: HTMLElement) => unknown) & { unmount?: (element: HTMLElement) => boolean }
ArtplayerDocsLoader: ReturnType<typeof createLibraryLoader> & {
exampleSource: typeof exampleSource
parameters: typeof parameters
@@ -25,6 +25,9 @@ export async function installEditor(host: EditorHost): Promise<void> {
host.consoleLog(output)
const controller = new AbortController()
const cleanups: (() => void)[] = []
cleanups.push(() => {
host.consoleLog.unmount?.(output)
})
const listen = (
target: EventTarget,
type: string,