( esbuild: any, path: string, source: string, solid = false, )
| 112 | const getHtmlDoc = (html: string): string => html.trim(); |
| 113 | |
| 114 | const 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 | |
| 145 | const getBundle = async ( |
| 146 | esbuild: any, |
no outgoing calls
no test coverage detected
searching dependent graphs…