From 140cf8e1614fac4e1dfe5a4b14d81d3468c39bfe Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Wed, 11 Dec 2024 11:35:57 +0900 Subject: [PATCH] chore: add jsdoc to runtime --- packages/vite/misc/rolldown-runtime.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/vite/misc/rolldown-runtime.js b/packages/vite/misc/rolldown-runtime.js index 8e5ccbdcb49af5..2dd968ae9adf50 100644 --- a/packages/vite/misc/rolldown-runtime.js +++ b/packages/vite/misc/rolldown-runtime.js @@ -82,10 +82,30 @@ var __toBinary = /* @__PURE__ */ (() => { } })() +/** + * @typedef {(runtime: unknown) => void} ModuleFactory + * @typedef {Record} ModuleFactoryMap + * @typedef {{ exports: unknown, parents: string[], hot: any }} ModuleCacheEntry + * @typedef {Record} ModuleCache + */ + self.__rolldown_runtime = { + /** + * @type {string[]} + */ executeModuleStack: [], + /** + * @type {ModuleCache} + */ moduleCache: {}, + /** + * @type {ModuleFactoryMap} + */ moduleFactoryMap: {}, + /** + * @param {string} id + * @returns {unknown} + */ require: function (id) { const parent = this.executeModuleStack.at(-1) if (this.moduleCache[id]) { @@ -134,6 +154,9 @@ self.__rolldown_runtime = { this.executeModuleStack.pop() return module.exports }, + /** + * @param {ModuleFactoryMap} newModuleFactoryMap + */ patch: function (newModuleFactoryMap) { var boundaries = [] var invalidModuleIds = []