Skip to content

Commit

Permalink
chore: add jsdoc to runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Dec 11, 2024
1 parent 5b9deb5 commit 140cf8e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/vite/misc/rolldown-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,30 @@ var __toBinary = /* @__PURE__ */ (() => {
}
})()

/**
* @typedef {(runtime: unknown) => void} ModuleFactory
* @typedef {Record<string, ModuleFactory>} ModuleFactoryMap
* @typedef {{ exports: unknown, parents: string[], hot: any }} ModuleCacheEntry
* @typedef {Record<string, ModuleCacheEntry>} 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]) {
Expand Down Expand Up @@ -134,6 +154,9 @@ self.__rolldown_runtime = {
this.executeModuleStack.pop()
return module.exports
},
/**
* @param {ModuleFactoryMap} newModuleFactoryMap
*/
patch: function (newModuleFactoryMap) {
var boundaries = []
var invalidModuleIds = []
Expand Down

0 comments on commit 140cf8e

Please sign in to comment.