revert: not check entry.

This commit is contained in:
Ansolve 2023-12-31 00:44:14 +08:00
parent 4acae6af06
commit 4b3449bd27
No known key found for this signature in database
GPG Key ID: 2F2873AC9538CC2D
1 changed files with 1 additions and 7 deletions

View File

@ -33,13 +33,7 @@ function generateImportFunction(type, pathParser) {
const modeContent = await import(pathParser(name)); const modeContent = await import(pathParser(name));
if (!modeContent.type) return; if (!modeContent.type) return;
if (modeContent.type !== type) throw new Error(`Loaded Content doesnt conform to "${type}"`); if (modeContent.type !== type) throw new Error(`Loaded Content doesnt conform to "${type}"`);
// TODO: 设想的新导入名称,用`export function entry() {...}`将内容暴露出去 await game.import(type, modeContent.default);
if ('entry' in modeContent) await game.import(type, (lib, game, ui, get, ai, _status) => {
// TODO: 第一个参数打算提供一些信息,用于直接判断;后面依然提供六个全局变量,用于一些其他方式制作的扩展
return modeContent.entry({}, {lib, game, ui, get, ai, _status})
})
// 不好说要不要保留
else await game.import(type, modeContent.default);
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }