MCPcopy Create free account
hub / github.com/Sandpack/nodebox-runtime / setup

Function setup

internals/esbuild-plugins/inline-file.ts:34–55  ·  view source on GitHub ↗
(build)

Source from the content-addressed store, hash-verified

32 return {
33 name: 'esbuild-inline-plugin',
34 setup(build) {
35 build.onResolve({ filter }, (args) => {
36 const realPath = args.path.replace(filter, '');
37 return {
38 path: path.resolve(args.resolveDir, realPath),
39 namespace,
40 };
41 });
42
43 build.onLoad({ filter: /.*/, namespace }, async (args) => {
44 let contents = await fs.readFile(args.path, 'utf8');
45
46 if (typeof transform === 'function') {
47 contents = await transform(contents, args);
48 }
49
50 return {
51 contents,
52 loader: 'text',
53 };
54 });
55 },
56 };
57}

Callers

nothing calls this directly

Calls 1

readFileMethod · 0.80

Tested by

no test coverage detected