MCPcopy
hub / github.com/vitejs/vite / resolve

Method resolve

packages/vite/src/node/server/pluginContainer.ts:772–814  ·  view source on GitHub ↗
(
    id: string,
    importer?: string,
    options?: {
      attributes?: Record<string, string>
      custom?: CustomPluginOptions
      isEntry?: boolean
      skipSelf?: boolean
    },
  )

Source from the content-addressed store, hash-verified

770 }
771
772 async resolve(
773 id: string,
774 importer?: string,
775 options?: {
776 attributes?: Record<string, string>
777 custom?: CustomPluginOptions
778 isEntry?: boolean
779 skipSelf?: boolean
780 },
781 ): Promise<ResolvedId | null> {
782 let skipCalls: readonly SkipInformation[] | undefined
783 if (options?.skipSelf === false) {
784 skipCalls = this._resolveSkipCalls
785 } else if (this._resolveSkipCalls) {
786 const skipCallsTemp = [...this._resolveSkipCalls]
787 const sameCallIndex = this._resolveSkipCalls.findIndex(
788 (c) =>
789 c.id === id && c.importer === importer && c.plugin === this._plugin,
790 )
791 if (sameCallIndex !== -1) {
792 skipCallsTemp[sameCallIndex] = {
793 ...skipCallsTemp[sameCallIndex],
794 called: true,
795 }
796 } else {
797 skipCallsTemp.push({ id, importer, plugin: this._plugin })
798 }
799 skipCalls = skipCallsTemp
800 } else {
801 skipCalls = [{ id, importer, plugin: this._plugin }]
802 }
803
804 let out = await this._container.resolveId(id, importer, {
805 attributes: options?.attributes,
806 custom: options?.custom,
807 isEntry: !!options?.isEntry,
808 skip: this._resolveSkips,
809 skipCalls,
810 scan: this._scan,
811 })
812 if (typeof out === 'string') out = { id: out }
813 return out as ResolvedId | null
814 }
815
816 async load(
817 options: {

Callers

nothing calls this directly

Calls 1

resolveIdMethod · 0.45

Tested by

no test coverage detected