MCPcopy
hub / github.com/prisma/prisma / onResolve

Function onResolve

helpers/compile/plugins/fill-plugin/fillPlugin.ts:100–116  ·  view source on GitHub ↗

* Handles the resolution step where esbuild resolves the imports before * bundling them. This allows us to inject a filler via its `path` if it was * provided. If not, we proceed to the next `onLoad` step. * @param fillers to use the path from * @param args from esbuild * @returns

(fillers: Fillers, args: esbuild.OnResolveArgs, namespace: string)

Source from the content-addressed store, hash-verified

98 * @returns
99 */
100function onResolve(fillers: Fillers, args: esbuild.OnResolveArgs, namespace: string): esbuild.OnResolveResult {
101 // removes trailing slashes in imports paths
102 const path = args.path.replace(/\/$/, '')
103 const item = fillers[path]
104
105 // if a path is provided, we just replace it
106 if (item.imports !== undefined) {
107 return { path: item.imports }
108 }
109
110 // if not, we defer action to the loaders cb
111 return {
112 namespace,
113 path: path,
114 pluginData: args.importer,
115 }
116}
117
118/**
119 * Handles the load step where esbuild loads the contents of the imports before

Callers 1

setupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected