MCPcopy
hub / github.com/prisma/prisma / setup

Function setup

helpers/compile/plugins/fill-plugin/fillPlugin.ts:221–243  ·  view source on GitHub ↗
(build)

Source from the content-addressed store, hash-verified

219const fillPlugin = ({ fillerOverrides, defaultFillers = true }: FillPluginOptions): esbuild.Plugin => ({
220 name: 'fillPlugin',
221 setup(build) {
222 const uid = Math.random().toString(36).substring(7) + ''
223 const namespace = `fill-plugin-${uid}`
224
225 // overrides
226 const fillers = {
227 ...(defaultFillers ? defaultFillersConfig : {}),
228 ...fillerOverrides,
229 }
230
231 // our first step is to update options with basic injections
232 setInjectionsAndDefinitions(fillers, build.initialOptions)
233
234 // allows us to change the path of a filtered import by another
235 build.onResolve({ filter: createImportFilter(fillers) }, (args) => {
236 return onResolve(fillers, args, namespace)
237 })
238
239 // if no path was provided it defers to virtual nsp `fill-plugin`
240 build.onLoad({ filter: /.*/, namespace }, (args) => {
241 return onLoad(fillers, args)
242 })
243 },
244})
245
246export { fillPlugin }

Callers

nothing calls this directly

Calls 6

createImportFilterFunction · 0.85
onResolveFunction · 0.85
onLoadFunction · 0.85
randomMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected