MCPcopy Index your code
hub / github.com/tinyplex/tinybase / getJs

Function getJs

site/demo.ts:114–143  ·  view source on GitHub ↗
(
  esbuild: any,
  path: string,
  source: string,
  solid = false,
)

Source from the content-addressed store, hash-verified

112const getHtmlDoc = (html: string): string => html.trim();
113
114const getJs = (
115 esbuild: any,
116 path: string,
117 source: string,
118 solid = false,
119): string => {
120 const jsx = path.endsWith('.jsx') || path.endsWith('.tsx');
121 const code = esbuild.transformSync(source, {
122 loader: path.endsWith('.tsx')
123 ? 'tsx'
124 : path.endsWith('.ts')
125 ? 'ts'
126 : path.endsWith('.jsx')
127 ? 'jsx'
128 : 'js',
129 format: 'esm',
130 logOverride: {'unsupported-jsx-comment': 'silent'},
131 jsx: solid && jsx ? 'preserve' : 'automatic',
132 }).code;
133 return (
134 solid && jsx
135 ? (transformSync(code, {
136 filename: path,
137 presets: [['solid', {delegateEvents: false}]],
138 })?.code ?? '')
139 : code
140 )
141 .replace(PURE_REGEX, '')
142 .trim();
143};
144
145const getBundle = async (
146 esbuild: any,

Callers 1

getDemoDocFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…