Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/md/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Plugin, ResolvedConfig, ViteDevServer } from "vite";
import { normalizePath, type Plugin, type ResolvedConfig, type ViteDevServer } from "vite";
import { createHash } from "node:crypto";
import { existsSync, readFileSync, readdirSync } from "node:fs";
import { dirname, join, relative, resolve } from "node:path";
Expand Down Expand Up @@ -297,7 +297,7 @@ export function useFrontmatter() { return useContext(FrontmatterContext) ?? {};
}
for (const imp of islandImports) {
const absPath = resolve(dirname(_id), imp.specifier);
imp.islandId = relative(root, absPath).replace(/\.[^.]+$/, "");
imp.islandId = normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "");
}

const { compile } = await import("./compile");
Expand Down
10 changes: 6 additions & 4 deletions packages/react/src/plugin-islands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Plugin } from "vite";
import { normalizePath, type Plugin } from "vite";
import { existsSync, readFileSync } from "node:fs";
import { dirname, resolve, relative } from "node:path";
import { scanPages, resolveEffectiveLayoutChain } from "void/pages";
Expand Down Expand Up @@ -76,7 +76,7 @@ export function islandsPlugin(pagesDir: string): Plugin[] {
const strategy = m[2].slice(1, -1);
const absPath = resolveSpecifier(spec, importerDir, COMPONENT_EXTENSIONS);
if (absPath) {
const islandId = relative(root, absPath).replace(/\.[^.]+$/, "");
const islandId = normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "");
islandManifest.set(islandId, {
componentPath: absPath,
islandId,
Expand Down Expand Up @@ -198,15 +198,17 @@ export function islandsPlugin(pagesDir: string): Plugin[] {
// Resolve to absolute path for the island manifest
const absPath = resolveSpecifier(spec, importerDir, COMPONENT_EXTENSIONS);
if (absPath) {
const islandId = relative(root, absPath).replace(/\.[^.]+$/, "");
const islandId = normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "");
islandManifest.set(islandId, {
componentPath: absPath,
islandId,
hydrate: strategy,
});
}

const islandId = absPath ? relative(root, absPath).replace(/\.[^.]+$/, "") : spec;
const islandId = absPath
? normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "")
: spec;

// Replace the import with a renamed import
const replacement = `import ${rawName} from ${specRaw}`;
Expand Down
10 changes: 6 additions & 4 deletions packages/solid/src/plugin-islands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Plugin } from "vite";
import { normalizePath, type Plugin } from "vite";
import { existsSync, readFileSync } from "node:fs";
import { dirname, resolve, relative } from "node:path";
import { scanPages, resolveEffectiveLayoutChain } from "void/pages";
Expand Down Expand Up @@ -95,7 +95,7 @@ export function islandsPlugin(pagesDir: string): Plugin[] {
const strategy = m[2].slice(1, -1);
const absPath = resolveSpecifier(spec, importerDir, COMPONENT_EXTENSIONS);
if (absPath) {
const islandId = relative(root, absPath).replace(/\.[^.]+$/, "");
const islandId = normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "");
islandManifest.set(islandId, {
componentPath: absPath,
islandId,
Expand Down Expand Up @@ -226,15 +226,17 @@ export function islandsPlugin(pagesDir: string): Plugin[] {
// Resolve to absolute path for the island manifest
const absPath = resolveSpecifier(spec, importerDir, COMPONENT_EXTENSIONS);
if (absPath) {
const islandId = relative(root, absPath).replace(/\.[^.]+$/, "");
const islandId = normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "");
islandManifest.set(islandId, {
componentPath: absPath,
islandId,
hydrate: strategy,
});
}

const islandId = absPath ? relative(root, absPath).replace(/\.[^.]+$/, "") : spec;
const islandId = absPath
? normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "")
: spec;

// Rewrite import to point to virtual wrapper component.
// Use a clean .tsx path (no query params) so rolldown can detect the
Expand Down
10 changes: 6 additions & 4 deletions packages/svelte/src/plugin-islands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Plugin } from "vite";
import { normalizePath, type Plugin } from "vite";
import { existsSync, readFileSync } from "node:fs";
import { dirname, resolve, relative } from "node:path";
import { scanPages, resolveEffectiveLayoutChain } from "void/pages";
Expand Down Expand Up @@ -85,7 +85,7 @@ export function islandsPlugin(pagesDir: string): Plugin[] {
const strategy = m[2].slice(1, -1);
const absPath = resolveSpecifier(spec, importerDir, COMPONENT_EXTENSIONS);
if (absPath) {
const islandId = relative(root, absPath).replace(/\.[^.]+$/, "");
const islandId = normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "");
islandManifest.set(islandId, {
componentPath: absPath,
islandId,
Expand Down Expand Up @@ -215,15 +215,17 @@ export function islandsPlugin(pagesDir: string): Plugin[] {
// Resolve to absolute path for the island manifest
const absPath = resolveSpecifier(spec, importerDir, COMPONENT_EXTENSIONS);
if (absPath) {
const islandId = relative(root, absPath).replace(/\.[^.]+$/, "");
const islandId = normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "");
islandManifest.set(islandId, {
componentPath: absPath,
islandId,
hydrate: strategy,
});
}

const islandId = absPath ? relative(root, absPath).replace(/\.[^.]+$/, "") : spec;
const islandId = absPath
? normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "")
: spec;

// Rewrite import to point to virtual wrapper component
const wrapperUrl =
Expand Down
10 changes: 6 additions & 4 deletions packages/vue/src/plugin-islands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Plugin } from "vite";
import { normalizePath, type Plugin } from "vite";
import { existsSync, readFileSync } from "node:fs";
import { dirname, resolve, relative } from "node:path";
import { scanPages, resolveEffectiveLayoutChain } from "void/pages";
Expand Down Expand Up @@ -114,7 +114,7 @@ export function islandsPlugin(pagesDir: string): Plugin[] {
const strategy = m[2].slice(1, -1);
const absPath = resolveSpecifier(spec, importerDir, COMPONENT_EXTENSIONS);
if (absPath) {
const islandId = relative(root, absPath).replace(/\.[^.]+$/, "");
const islandId = normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "");
islandManifest.set(islandId, {
componentPath: absPath,
islandId,
Expand Down Expand Up @@ -236,15 +236,17 @@ export function islandsPlugin(pagesDir: string): Plugin[] {
// Resolve to absolute path for the island manifest
const absPath = resolveSpecifier(spec, importerDir, COMPONENT_EXTENSIONS);
if (absPath) {
const islandId = relative(root, absPath).replace(/\.[^.]+$/, "");
const islandId = normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "");
islandManifest.set(islandId, {
componentPath: absPath,
islandId,
hydrate: strategy,
});
}

const islandId = absPath ? relative(root, absPath).replace(/\.[^.]+$/, "") : spec;
const islandId = absPath
? normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "")
: spec;

// Replace the import with a renamed import
const replacement = `import ${rawName} from ${specRaw}`;
Expand Down
Loading