islands-core 0.1.3

Server-side SSR primitives for islands.rs: island markers, the page shell, the asset manifest, and streaming Suspense.
Documentation
//! `page_shell_static` renders a shell for a non-interactive page: it loads the
//! shared core module (so client navigation still works) but emits **no** page
//! WASM module import — the distinction from `page_shell`.

use islands_core::{page_shell, page_shell_static, Manifest};

#[test]
fn static_shell_loads_core_but_no_page_module() {
    let manifest = Manifest::default();
    let html = page_shell_static("Dashboard", "<main>hi</main>", &manifest, "", false);

    // Shared core still loads (nav, etc.).
    assert!(
        html.contains("import core_init from \"/static/islands-core/islands_core.js\""),
        "core module must load:\n{html}"
    );
    // No page-module import / init — the whole point of the static shell.
    assert!(
        !html.contains("page_init"),
        "static shell must not import a page module:\n{html}"
    );
    // Base stylesheet linked; no per-page stylesheet.
    assert!(html.contains("/static/css/base.css"), "base css linked:\n{html}");
    assert!(
        !html.contains("<link rel=\"stylesheet\" href=\"/static/counter"),
        "static shell links no per-page css:\n{html}"
    );
    assert!(html.contains("<main>hi</main>"), "body is spliced in:\n{html}");
}

#[test]
fn interactive_shell_loads_both_core_and_page() {
    let manifest = Manifest::default();
    let html = page_shell(
        "Home",
        "<main>hi</main>",
        "counter/page-home",
        &manifest,
        "",
        false,
    );
    assert!(html.contains("import core_init from"), "core loads:\n{html}");
    assert!(html.contains("import page_init from"), "page loads:\n{html}");
}

#[test]
fn asset_prefix_is_applied_to_static_shell() {
    let manifest = Manifest::default();
    let html = page_shell_static("Dashboard", "", &manifest, "https://cdn.example", false);
    assert!(
        html.contains("https://cdn.example/static/islands-core/islands_core.js"),
        "asset prefix prepended to core URL:\n{html}"
    );
}