From a9e5de07dc17f4bdd55493216dcf789777cf4dab Mon Sep 17 00:00:00 2001 From: gioboa Date: Sat, 16 Nov 2024 20:20:16 +0100 Subject: [PATCH] fix: fix up imports type --- src/lib/sandbox/index.ts | 6 +++--- src/lib/sandbox/main-access-handler.ts | 12 ++++++------ src/lib/sandbox/main-custom-element.ts | 2 +- src/lib/sandbox/main-forward-trigger.ts | 2 +- src/lib/sandbox/main-instances.ts | 2 +- src/lib/sandbox/main-register-window.ts | 6 +++--- src/lib/sandbox/main-serialization.ts | 14 +++++++------- src/lib/sandbox/on-messenge-from-worker.ts | 8 ++++---- src/lib/sandbox/read-main-platform.ts | 2 +- src/lib/sandbox/read-main-scripts.ts | 8 ++++---- src/lib/service-worker/sync-create-messenger-sw.ts | 8 ++++---- src/lib/web-worker/index.ts | 2 +- src/lib/web-worker/media/canvas.ts | 2 +- src/lib/web-worker/media/media.ts | 8 ++++---- src/lib/web-worker/worker-anchor.ts | 2 +- src/lib/web-worker/worker-css-style-declaration.ts | 2 +- src/lib/web-worker/worker-document.ts | 5 ++--- src/lib/web-worker/worker-environment.ts | 2 +- src/lib/web-worker/worker-exec.ts | 14 +++++++------- src/lib/web-worker/worker-iframe.ts | 6 +++--- src/lib/web-worker/worker-location.ts | 2 +- src/lib/web-worker/worker-named-node-map.ts | 10 +++++----- 22 files changed, 62 insertions(+), 63 deletions(-) diff --git a/src/lib/sandbox/index.ts b/src/lib/sandbox/index.ts index e62ed10a..caa0fd35 100644 --- a/src/lib/sandbox/index.ts +++ b/src/lib/sandbox/index.ts @@ -4,9 +4,9 @@ import { libPath, mainWindow } from './main-globals'; import { logMain } from '../log'; import { mainAccessHandler } from './main-access-handler'; import { - MessageFromWorkerToSandbox, - MessengerRequestCallback, - PartytownWebWorker, + type MessageFromWorkerToSandbox, + type MessengerRequestCallback, + type PartytownWebWorker, WorkerMessageType, } from '../types'; import { registerWindow } from './main-register-window'; diff --git a/src/lib/sandbox/main-access-handler.ts b/src/lib/sandbox/main-access-handler.ts index 255cd53f..d7c4d372 100644 --- a/src/lib/sandbox/main-access-handler.ts +++ b/src/lib/sandbox/main-access-handler.ts @@ -1,11 +1,11 @@ import { - ApplyPath, + type ApplyPath, ApplyPathType, - MainAccessRequest, - MainAccessResponse, - MainAccessTask, - PartytownWebWorker, - WinId, + type MainAccessRequest, + type MainAccessResponse, + type MainAccessTask, + type PartytownWebWorker, + type WinId, } from '../types'; import { debug, getConstructorName, isPromise, len } from '../utils'; import { defineCustomElement } from './main-custom-element'; diff --git a/src/lib/sandbox/main-custom-element.ts b/src/lib/sandbox/main-custom-element.ts index 4bbbc477..107b1a29 100644 --- a/src/lib/sandbox/main-custom-element.ts +++ b/src/lib/sandbox/main-custom-element.ts @@ -1,4 +1,4 @@ -import { CustomElementData, PartytownWebWorker, WinId, WorkerMessageType } from '../types'; +import { type CustomElementData, type PartytownWebWorker, type WinId, WorkerMessageType } from '../types'; import { defineConstructorName } from '../utils'; import { getAndSetInstanceId } from './main-instances'; import { winCtxs } from './main-constants'; diff --git a/src/lib/sandbox/main-forward-trigger.ts b/src/lib/sandbox/main-forward-trigger.ts index 2aaef22b..cd788145 100644 --- a/src/lib/sandbox/main-forward-trigger.ts +++ b/src/lib/sandbox/main-forward-trigger.ts @@ -4,7 +4,7 @@ import { len, resolvePartytownForwardProperty, } from '../utils'; -import { MainWindow, PartytownWebWorker, WinId, WorkerMessageType } from '../types'; +import { type MainWindow, type PartytownWebWorker, type WinId, WorkerMessageType } from '../types'; import { serializeForWorker } from './main-serialization'; export const mainForwardTrigger = (worker: PartytownWebWorker, $winId$: WinId, win: MainWindow) => { diff --git a/src/lib/sandbox/main-instances.ts b/src/lib/sandbox/main-instances.ts index d0aad999..c128f8b9 100644 --- a/src/lib/sandbox/main-instances.ts +++ b/src/lib/sandbox/main-instances.ts @@ -1,5 +1,5 @@ import { CreatedKey, InstanceIdKey, instances, winCtxs, windowIds } from './main-constants'; -import { InstanceId, MainWindowContext, WinDocId, WinId } from '../types'; +import { type InstanceId, type MainWindowContext, WinDocId, type WinId } from '../types'; import { randomId } from '../utils'; export const getAndSetInstanceId = (instance: any, instanceId?: InstanceId) => { diff --git a/src/lib/sandbox/main-register-window.ts b/src/lib/sandbox/main-register-window.ts index 74c0d0b3..365822a8 100644 --- a/src/lib/sandbox/main-register-window.ts +++ b/src/lib/sandbox/main-register-window.ts @@ -1,9 +1,9 @@ import { debug } from '../utils'; import { logMain, normalizedWinId } from '../log'; import { - MainWindow, - PartytownWebWorker, - WinId, + type MainWindow, + type PartytownWebWorker, + type WinId, WorkerMessageType, LocationUpdateType, } from '../types'; diff --git a/src/lib/sandbox/main-serialization.ts b/src/lib/sandbox/main-serialization.ts index 780d4631..57728715 100644 --- a/src/lib/sandbox/main-serialization.ts +++ b/src/lib/sandbox/main-serialization.ts @@ -2,14 +2,14 @@ import { getConstructorName, getNodeName, isValidMemberName, startsWith } from ' import { getInstance, getAndSetInstanceId } from './main-instances'; import { mainRefs } from './main-constants'; import { - PartytownWebWorker, - SerializedCSSRule, - SerializedInstance, - SerializedObject, - SerializedRefTransferData, - SerializedTransfer, + type PartytownWebWorker, + type SerializedCSSRule, + type SerializedInstance, + type SerializedObject, + type SerializedRefTransferData, + type SerializedTransfer, SerializedType, - WinId, + type WinId, WorkerMessageType, } from '../types'; diff --git a/src/lib/sandbox/on-messenge-from-worker.ts b/src/lib/sandbox/on-messenge-from-worker.ts index 6187aaa5..9dc11870 100644 --- a/src/lib/sandbox/on-messenge-from-worker.ts +++ b/src/lib/sandbox/on-messenge-from-worker.ts @@ -1,10 +1,10 @@ import { initializedWorkerScript, readNextScript } from './read-main-scripts'; import { mainWindow } from './main-globals'; import { - MainWindowContext, - MessageFromWorkerToSandbox, - PartytownWebWorker, - WinId, + type MainWindowContext, + type MessageFromWorkerToSandbox, + type PartytownWebWorker, + type WinId, WorkerMessageType, } from '../types'; import { randomId } from '../utils'; diff --git a/src/lib/sandbox/read-main-platform.ts b/src/lib/sandbox/read-main-platform.ts index bc4c85f1..cfe8b45a 100644 --- a/src/lib/sandbox/read-main-platform.ts +++ b/src/lib/sandbox/read-main-platform.ts @@ -7,7 +7,7 @@ import { serializeConfig, } from '../utils'; import { config, docImpl, libPath, mainWindow } from './main-globals'; -import { InterfaceType, InterfaceInfo, InterfaceMember, InitWebWorkerData } from '../types'; +import { InterfaceType, type InterfaceInfo, type InterfaceMember, type InitWebWorkerData } from '../types'; export const readMainPlatform = () => { const elm = docImpl.createElement('i'); diff --git a/src/lib/sandbox/read-main-scripts.ts b/src/lib/sandbox/read-main-scripts.ts index 17d94187..040c3f94 100644 --- a/src/lib/sandbox/read-main-scripts.ts +++ b/src/lib/sandbox/read-main-scripts.ts @@ -1,10 +1,10 @@ import { debug, SCRIPT_TYPE, SCRIPT_TYPE_EXEC } from '../utils'; import { getAndSetInstanceId } from './main-instances'; import { - InitializeScriptData, - InstanceId, - MainWindowContext, - PartytownWebWorker, + type InitializeScriptData, + type InstanceId, + type MainWindowContext, + type PartytownWebWorker, WorkerMessageType, } from '../types'; import { mainForwardTrigger } from './main-forward-trigger'; diff --git a/src/lib/service-worker/sync-create-messenger-sw.ts b/src/lib/service-worker/sync-create-messenger-sw.ts index 1fff050f..0077701d 100644 --- a/src/lib/service-worker/sync-create-messenger-sw.ts +++ b/src/lib/service-worker/sync-create-messenger-sw.ts @@ -1,8 +1,8 @@ import { - MainAccessRequest, - MessageFromWorkerToSandbox, - Messenger, - PartytownWebWorker, + type MainAccessRequest, + type MessageFromWorkerToSandbox, + type Messenger, + type PartytownWebWorker, WorkerMessageType, } from '../types'; import { onMessageFromWebWorker } from '../sandbox/on-messenge-from-worker'; diff --git a/src/lib/web-worker/index.ts b/src/lib/web-worker/index.ts index 89ce7d65..b863600f 100644 --- a/src/lib/web-worker/index.ts +++ b/src/lib/web-worker/index.ts @@ -3,7 +3,7 @@ import { callWorkerRefHandler } from './worker-serialization'; import { createEnvironment } from './worker-environment'; import { debug } from '../utils'; import { environments, webWorkerCtx } from './worker-constants'; -import { ForwardMainTriggerData, MessageFromSandboxToWorker, WorkerMessageType } from '../types'; +import { type ForwardMainTriggerData, type MessageFromSandboxToWorker, WorkerMessageType } from '../types'; import { initNextScriptsInWebWorker } from './worker-exec'; import { initWebWorker } from './init-web-worker'; import { logWorker, normalizedWinId } from '../log'; diff --git a/src/lib/web-worker/media/canvas.ts b/src/lib/web-worker/media/canvas.ts index 65d41912..e8e32b71 100644 --- a/src/lib/web-worker/media/canvas.ts +++ b/src/lib/web-worker/media/canvas.ts @@ -8,7 +8,7 @@ import { randomId, } from './bridge'; import { ContextKey, defineCstr, notImpl } from './utils'; -import { CallType, WorkerConstructor, WorkerInstance, WorkerWindow } from '../../types'; +import { CallType, type WorkerConstructor, type WorkerInstance, type WorkerWindow } from '../../types'; export const initCanvas = (WorkerBase: WorkerConstructor, win: WorkerWindow) => { const HTMLCanvasDescriptorMap: PropertyDescriptorMap & ThisType = { diff --git a/src/lib/web-worker/media/media.ts b/src/lib/web-worker/media/media.ts index 64acd676..3d69906f 100644 --- a/src/lib/web-worker/media/media.ts +++ b/src/lib/web-worker/media/media.ts @@ -1,9 +1,9 @@ import { CallType, - MediaSelf, - WebWorkerEnvironment, - WorkerConstructor, - WorkerWindow, + type MediaSelf, + type WebWorkerEnvironment, + type WorkerConstructor, + type WorkerWindow, } from '../../types'; import { defineCstr, diff --git a/src/lib/web-worker/worker-anchor.ts b/src/lib/web-worker/worker-anchor.ts index 83c2e8e3..8d60ee26 100644 --- a/src/lib/web-worker/worker-anchor.ts +++ b/src/lib/web-worker/worker-anchor.ts @@ -3,7 +3,7 @@ import { definePrototypePropertyDescriptor, isValidUrl } from '../utils'; import { getInstanceStateValue, setInstanceStateValue } from './worker-state'; import { getter, setter } from './worker-proxy'; import { resolveToUrl } from './worker-exec'; -import { StateProp, WebWorkerEnvironment, WorkerNode } from '../types'; +import { StateProp, type WebWorkerEnvironment, type WorkerNode } from '../types'; export const patchHTMLAnchorElement = (WorkerHTMLAnchorElement: any, env: WebWorkerEnvironment) => { const HTMLAnchorDescriptorMap: PropertyDescriptorMap & ThisType = {}; diff --git a/src/lib/web-worker/worker-css-style-declaration.ts b/src/lib/web-worker/worker-css-style-declaration.ts index 1192148a..ff060ff5 100644 --- a/src/lib/web-worker/worker-css-style-declaration.ts +++ b/src/lib/web-worker/worker-css-style-declaration.ts @@ -1,4 +1,4 @@ -import { ApplyPath, CallType, InstanceId, WinId, WorkerConstructor } from '../types'; +import { type ApplyPath, CallType, type InstanceId, type WinId, type WorkerConstructor } from '../types'; import { cachedDimensions, InstanceDataKey } from './worker-constants'; import { callMethod, getter, setter } from './worker-proxy'; import { defineConstructorName } from '../utils'; diff --git a/src/lib/web-worker/worker-document.ts b/src/lib/web-worker/worker-document.ts index cb4eac1a..ea45f991 100644 --- a/src/lib/web-worker/worker-document.ts +++ b/src/lib/web-worker/worker-document.ts @@ -3,9 +3,8 @@ import { CallType, NodeName, StateProp, - WebWorkerEnvironment, - WinDocId, - WorkerNode, + type WebWorkerEnvironment, + type WorkerNode, } from '../types'; import { cachedProps, diff --git a/src/lib/web-worker/worker-environment.ts b/src/lib/web-worker/worker-environment.ts index 82e1995f..5eb38fe1 100644 --- a/src/lib/web-worker/worker-environment.ts +++ b/src/lib/web-worker/worker-environment.ts @@ -1,7 +1,7 @@ import { createWindow } from './worker-window'; import { debug } from '../utils'; import { environments, webWorkerCtx } from './worker-constants'; -import { InitializeEnvironmentData, WorkerMessageType } from '../types'; +import { type InitializeEnvironmentData, WorkerMessageType } from '../types'; import { logWorker, normalizedWinId } from '../log'; export const createEnvironment = ( diff --git a/src/lib/web-worker/worker-exec.ts b/src/lib/web-worker/worker-exec.ts index 9caee6de..2d5c37cb 100644 --- a/src/lib/web-worker/worker-exec.ts +++ b/src/lib/web-worker/worker-exec.ts @@ -1,15 +1,15 @@ import { VERSION } from '../build-modules/version'; import { logWorker } from '../log'; import { - EventHandler, - InitializeScriptData, - InstanceId, + type EventHandler, + type InitializeScriptData, + type InstanceId, NodeName, - ResolveUrlType, + type ResolveUrlType, StateProp, - WebWorkerEnvironment, - WinId, - WorkerInstance, + type WebWorkerEnvironment, + type WinId, + type WorkerInstance, WorkerMessageType, } from '../types'; import { debug } from '../utils'; diff --git a/src/lib/web-worker/worker-iframe.ts b/src/lib/web-worker/worker-iframe.ts index c57eb6b9..a9154404 100644 --- a/src/lib/web-worker/worker-iframe.ts +++ b/src/lib/web-worker/worker-iframe.ts @@ -13,10 +13,10 @@ import { HTMLSrcElementDescriptorMap } from './worker-src-element'; import { setInstanceStateValue, getInstanceStateValue } from './worker-state'; import { StateProp, - WebWorkerEnvironment, - WorkerInstance, + type WebWorkerEnvironment, + type WorkerInstance, WorkerMessageType, - WorkerNode, + type WorkerNode, } from '../types'; export const patchHTMLIFrameElement = (WorkerHTMLIFrameElement: any, env: WebWorkerEnvironment) => { diff --git a/src/lib/web-worker/worker-location.ts b/src/lib/web-worker/worker-location.ts index 7965c9a7..d8379e4c 100644 --- a/src/lib/web-worker/worker-location.ts +++ b/src/lib/web-worker/worker-location.ts @@ -1,4 +1,4 @@ -import { LocationUpdateData, LocationUpdateType, WebWorkerEnvironment } from '../types'; +import { type LocationUpdateData, LocationUpdateType, type WebWorkerEnvironment } from '../types'; export function forwardLocationChange( $winId$: number, diff --git a/src/lib/web-worker/worker-named-node-map.ts b/src/lib/web-worker/worker-named-node-map.ts index a27df698..8f1e1b7c 100644 --- a/src/lib/web-worker/worker-named-node-map.ts +++ b/src/lib/web-worker/worker-named-node-map.ts @@ -1,10 +1,10 @@ import { - ApplyPath, + type ApplyPath, CallType, - InstanceId, - WinId, - WorkerConstructor, - WorkerInstance, + type InstanceId, + type WinId, + type WorkerConstructor, + type WorkerInstance, } from '../types'; import { defineConstructorName } from '../utils'; import { callMethod, getter, setter } from './worker-proxy';