📦 模块导出相关
- 判断模块是否提供某个导出(
isExportProvided)
- 获取模块整体的导出信息(
getExportsInfo)
- 获取具体某个导出的信息(
getExportInfo)
- 获取某个导出的只读信息(
getReadOnlyExportInfo)
- 获取模块在某运行时下被使用的导出(
getUsedExports)
🧭 模块遍历索引相关
- 获取/设置先序索引(
getPreOrderIndex、setPreOrderIndex)
- 如果未设置则设置先序索引(
setPreOrderIndexIfUnset)
- 获取/设置后序索引(
getPostOrderIndex、setPostOrderIndex)
- 如果未设置则设置后序索引(
setPostOrderIndexIfUnset)
🌲 模块图深度相关
- 获取模块深度(
getDepth)
- 设置模块深度(
setDepth)
- 如果当前深度更大则更新为较小的值(
setDepthIfLower)
⏱ 模块异步状态
- 判断模块是否为异步(
isAsync)
- 设置模块为异步(
setAsync)
🧠 元信息存储
- 获取或创建任意对象的元信息(
getMeta)
- 获取已存在的元信息(
getMetaIfExisting)
🧊 缓存机制
- 启用缓存(冻结模块图)(
freeze)
- 禁用缓存(解冻模块图)(
unfreeze)
- 带缓存的计算函数调用(
cached)
🧩 模块级内存缓存
- 设置模块级的内存缓存映射(
setModuleMemCaches)

isExportProvided(module, exportName) {
const mgm = this._getModuleGraphModule(module);
const result = mgm.exports.isExportProvided(exportName);
return result === undefined ? null : result;
}
getExportsInfo(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.exports;
}
getExportInfo(module, exportName) {
const mgm = this._getModuleGraphModule(module);
return mgm.exports.getExportInfo(exportName);
}
getReadOnlyExportInfo(module, exportName) {
const mgm = this._getModuleGraphModule(module);
return mgm.exports.getReadOnlyExportInfo(exportName);
}
getUsedExports(module, runtime) {
const mgm = this._getModuleGraphModule(module);
return mgm.exports.getUsedExports(runtime);
}
getPreOrderIndex(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.preOrderIndex;
}
getPostOrderIndex(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.postOrderIndex;
}
setPreOrderIndex(module, index) {
const mgm = this._getModuleGraphModule(module);
mgm.preOrderIndex = index;
}
setPreOrderIndexIfUnset(module, index) {
const mgm = this._getModuleGraphModule(module);
if (mgm.preOrderIndex === null) {
mgm.preOrderIndex = index;
return true;
}
return false;
}
setPostOrderIndex(module, index) {
const mgm = this._getModuleGraphModule(module);
mgm.postOrderIndex = index;
}
setPostOrderIndexIfUnset(module, index) {
const mgm = this._getModuleGraphModule(module);
if (mgm.postOrderIndex === null) {
mgm.postOrderIndex = index;
return true;
}
return false;
}
getDepth(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.depth;
}
setDepth(module, depth) {
const mgm = this._getModuleGraphModule(module);
mgm.depth = depth;
}
setDepthIfLower(module, depth) {
const mgm = this._getModuleGraphModule(module);
if (mgm.depth === null || mgm.depth > depth) {
mgm.depth = depth;
return true;
}
return false;
}
isAsync(module) {
const mgm = this._getModuleGraphModule(module);
return mgm.async;
}
setAsync(module) {
const mgm = this._getModuleGraphModule(module);
mgm.async = true;
}
getMeta(thing) {
let meta = this._metaMap.get(thing);
if (meta === undefined) {
meta = Object.create(null);
this._metaMap.set(thing, (meta));
}
return (meta);
}
getMetaIfExisting(thing) {
return this._metaMap.get(thing);
}
freeze(cacheStage) {
this._cache = new WeakTupleMap();
this._cacheStage = cacheStage;
}
unfreeze() {
this._cache = undefined;
this._cacheStage = undefined;
}
cached(fn, ...args) {
if (this._cache === undefined) return fn(this, ...args);
return this._cache.provide(fn, ...args, () => fn(this, ...args));
}
setModuleMemCaches(moduleMemCaches) {
this._moduleMemCaches = moduleMemCaches;
}