MCPcopy
hub / github.com/esm-dev/esm.sh / transformSolid

Function transformSolid

test/solid-js-1.5/test.ts:7–24  ·  view source on GitHub ↗
(rawCode: string)

Source from the content-addressed store, hash-verified

5import { renderToString } from "http://localhost:8080/solid-js@1.5.1/web";
6
7function transformSolid(rawCode: string): string {
8 const { code } = transform(rawCode, {
9 presets: [
10 [babelPresetSolid, {
11 generate: "ssr",
12 hydratable: false,
13 }],
14 ["typescript", { onlyRemoveTypeImports: true }],
15 ],
16 filename: "main.jsx",
17 });
18 if (!code) {
19 throw new Error("code is empty");
20 }
21 return code
22 .replaceAll(`"solid-js"`, `"http://localhost:8080/solid-js@1.5.1"`)
23 .replaceAll(`"solid-js/web"`, `"http://localhost:8080/solid-js@1.5.1/web"`);
24}
25
26Deno.test("solid-js@1.5 ssr", async () => {
27 const code = `import { createSignal } from "solid-js";

Callers 1

test.tsFile · 0.70

Calls 1

transformFunction · 0.85

Tested by

no test coverage detected