refactor: remove dynamic module imports and storage manager initialization from worker

- Eliminated dynamic imports for StorageManager and builderConfig within the worker process.
- Removed the initialization of the storage manager, streamlining the worker's setup process.
- Maintained the restoration of shared data structures from the main process.

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-06-17 16:42:30 +08:00
parent be6fdce89a
commit 066d9ef961

View File

@@ -47,15 +47,6 @@ export async function runAsWorker() {
const buffer = Buffer.from(serializedData.data)
const sharedData = deserialize(buffer) as SharedData
// 动态导入所需模块
const [{ StorageManager }, { builderConfig }] = await Promise.all([
import('./storage/index.js'),
import('@builder'),
])
// 在 worker 中初始化存储管理器
storageManager = new StorageManager(builderConfig.storage)
// 从主进程接收的共享数据中恢复数据结构(数据已经是正确的类型)
imageObjects = sharedData.imageObjects
existingManifestMap = sharedData.existingManifestMap