fix: convert island filePath to valid variable name (#2984)
I only added a unit test, but maybe it's testing internals too much? Should I add a more E2E test in `tests/` with real files? Closes #2971
This commit is contained in:
+2
-3
@@ -1,4 +1,3 @@
|
||||
import * as path from "@std/path";
|
||||
import { type ComponentType, h } from "preact";
|
||||
import { renderToString } from "preact-render-to-string";
|
||||
import { trace } from "@opentelemetry/api";
|
||||
@@ -17,7 +16,7 @@ import { type BuildCache, ProdBuildCache } from "./build_cache.ts";
|
||||
import type { ServerIslandRegistry } from "./context.ts";
|
||||
import { FinishSetup, ForgotBuild } from "./finish_setup.tsx";
|
||||
import { HttpError } from "./error.ts";
|
||||
import { mergePaths } from "./utils.ts";
|
||||
import { mergePaths, pathToExportName } from "./utils.ts";
|
||||
|
||||
// TODO: Completed type clashes in older Deno versions
|
||||
// deno-lint-ignore no-explicit-any
|
||||
@@ -159,7 +158,7 @@ export class App<State> {
|
||||
|
||||
// Create unique island name
|
||||
let name = exportName === "default"
|
||||
? path.basename(filePath, path.extname(filePath))
|
||||
? pathToExportName(filePath)
|
||||
: exportName;
|
||||
if (this.#islandNames.has(name)) {
|
||||
let i = 0;
|
||||
|
||||
Reference in New Issue
Block a user