@lincyaw/kernel 1.0.0-rc.8 → 1.0.0-rc.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/preview-frame.ts +11 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -41,7 +41,7 @@ export { ANCHOR_LOCK_PATH, AnchorLock } from './lock.ts'
|
|
|
41
41
|
export { prefixedLogger } from './logging.ts'
|
|
42
42
|
export { lowerMyst, roleMark } from './lower-myst.ts'
|
|
43
43
|
export type { LinkedType, LoweredMarkdown, LowerOptions } from './lower-myst.ts'
|
|
44
|
-
export { connectPreviewFrame, isPreviewActive, isPreviewEmbedded, previewAppearance, previewFrameAncestors, reportPreview } from './preview-frame.ts'
|
|
44
|
+
export { connectPreviewFrame, isPreviewActive, isPreviewEmbedded, previewAppearance, previewFrameAncestors, reportPreview, reportStaleModule } from './preview-frame.ts'
|
|
45
45
|
export { keyBelongsToTarget, watchFocusSource } from './keyboard.ts'
|
|
46
46
|
export type { PreviewFrame, PreviewPage, PreviewProblem, PreviewTextEdit, PreviewTextHandle } from './preview-frame.ts'
|
|
47
47
|
export { previewEditBinding } from './preview-edit.ts'
|
package/src/preview-frame.ts
CHANGED
|
@@ -1221,3 +1221,14 @@ export function connectPreviewFrame(page: PreviewPage): PreviewFrame | undefined
|
|
|
1221
1221
|
},
|
|
1222
1222
|
}
|
|
1223
1223
|
}
|
|
1224
|
+
|
|
1225
|
+
const STALE_MODULE = /dynamically imported module|Importing a module script failed|error loading dynamically imported module/i
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* A module that failed to load because a new deployment removed the version this (cached) page names: the page asks to
|
|
1229
|
+
* load again (`vite:preloadError`, which the page's head answers with one reload). Other failures are left alone.
|
|
1230
|
+
*/
|
|
1231
|
+
export function reportStaleModule(error: unknown): void {
|
|
1232
|
+
if (typeof window === 'undefined' || !STALE_MODULE.test(String(error instanceof Error ? error.message : error))) return
|
|
1233
|
+
window.dispatchEvent(new Event('vite:preloadError', { cancelable: true }))
|
|
1234
|
+
}
|