Start renaming

This commit is contained in:
2026-11-11 11:45:20 -03:00
parent ae22ec5276
commit 216d54a0ae
179 changed files with 890 additions and 449 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import { trace } from "@opentelemetry/api";
import { DENO_DEPLOYMENT_ID } from "@fresh/build-id";
import { DENO_DEPLOYMENT_ID } from "@paulaboks/sweet-build-id";
import * as colors from "@std/fmt/colors";
import type { MaybeLazyMiddleware, Middleware } from "./middlewares/mod.ts";
import {
@@ -100,7 +100,7 @@ export function createOnListen(
console.log();
// deno-lint-ignore no-console
console.log(
colors.bgRgb8(colors.rgb8(" 🍋 Fresh ready ", 0), 121),
colors.bgRgb8(colors.rgb8(" 🍬 Sweet ready ", 0), 121),
);
const sep = options.remoteAddress ? "" : "\n";
const space = options.remoteAddress ? " " : "";
+1 -1
View File
@@ -4,7 +4,7 @@ import { fsItemsToCommands, type FsRouteFile } from "./fs_routes.ts";
import type { ServerIslandRegistry } from "./context.ts";
import type { AnyComponent } from "preact";
import { UniqueNamer } from "./utils.ts";
import { setBuildId } from "@fresh/build-id";
import { setBuildId } from "@paulaboks/sweet-build-id";
export interface FileSnapshot {
name: string;
+1 -1
View File
@@ -59,7 +59,7 @@ export interface WebSocketUpgradeOptions {
}
/**
* Side channel used by `@fresh/plugin-vite` (and any other adapter sitting on
* Side channel used by `@paulaboks/sweet-vite` (and any other adapter sitting on
* top of `node:http`) to hand a raw socket + buffered head to `ctx.upgrade()`.
* `Deno.upgradeWebSocket()` normally pulls these off the request handled by
* `Deno.serve`, but a request synthesized from `node:http` carries neither, so
+3 -3
View File
@@ -1,9 +1,9 @@
import { expect } from "@std/expect";
import { Context } from "./context.ts";
import { App } from "fresh";
import { asset } from "fresh/runtime";
import { App } from "sweet";
import { asset } from "sweet/runtime";
import { FakeServer } from "./test_utils.ts";
import { BUILD_ID } from "@fresh/build-id";
import { BUILD_ID } from "@paulaboks/sweet-build-id";
import { parseHtml } from "../tests/test_utils.tsx";
Deno.test("FreshReqContext.prototype.redirect", () => {
+2 -2
View File
@@ -34,7 +34,7 @@ export interface Define<State> {
* returned from the handler is of the correct type:
*
* ```ts
* import { page } from "fresh";
* import { page } from "sweet";
* import { define } from "../utils.ts";
*
* export const handler = define.handlers<{ slug: string }>({
@@ -80,7 +80,7 @@ export interface Define<State> {
* return type of the handler method.
*
* ```ts
* import { page } from "fresh";
* import { page } from "sweet";
* import { define } from "../utils.ts";
*
* export const handler = define.handlers({
+1 -1
View File
@@ -22,7 +22,7 @@ import {
type FsRoute,
MemoryBuildCache,
} from "./dev_build_cache.ts";
import { BUILD_ID } from "@fresh/build-id";
import { BUILD_ID } from "@paulaboks/sweet-build-id";
import { updateCheck } from "./update_check.ts";
import { devErrorOverlay } from "./middlewares/error_overlay/middleware.tsx";
import { automaticWorkspaceFolders } from "./middlewares/automatic_workspace_folders.ts";
+13 -13
View File
@@ -3,7 +3,7 @@ import * as path from "@std/path";
import { Builder, specToName } from "./builder.ts";
import { App } from "../app.ts";
import { DEV_ERROR_OVERLAY_URL } from "../constants.ts";
import { BUILD_ID } from "@fresh/build-id";
import { BUILD_ID } from "@paulaboks/sweet-build-id";
import { integrationTest, withTmpDir, writeFiles } from "../test_utils.ts";
import {
getStdOutput,
@@ -285,7 +285,7 @@ integrationTest("Builder - write prod routePattern", async () => {
await writeFiles(tmp, {
"routes/foo/index.ts": `export const handler = () => new Response("ok")`,
"main.ts": `import { App } from "fresh";
"main.ts": `import { App } from "sweet";
export const app = new App().fsRoutes()`,
});
@@ -317,7 +317,7 @@ integrationTest("Builder - file:// islands", async () => {
"other/Foo.tsx": `export default () => <h1>ok</h1>;`,
"routes/index.tsx": `import Foo from "../other/Foo.tsx";
export default () => <Foo />;`,
"main.ts": `import { App } from "fresh";
"main.ts": `import { App } from "sweet";
export const app = new App().fsRoutes()`,
});
@@ -470,7 +470,7 @@ integrationTest(
const tmp = _tmp.dir;
await writeFiles(tmp, {
"main.ts": `import { App, staticFiles } from "fresh";
"main.ts": `import { App, staticFiles } from "sweet";
export const app = new App()
.use(staticFiles());`,
"static/foo.txt": "ok",
@@ -559,7 +559,7 @@ integrationTest(
const tmp = _tmp.dir;
await writeFiles(tmp, {
"main.ts": `import { App, staticFiles } from "fresh";
"main.ts": `import { App, staticFiles } from "sweet";
export const app = new App()
.use(staticFiles());`,
"static_a/a.txt": "from a",
@@ -598,7 +598,7 @@ integrationTest("Builder - custom server entry", async () => {
const tmp = _tmp.dir;
await writeFiles(tmp, {
"other.ts": `import { App, staticFiles } from "fresh";
"other.ts": `import { App, staticFiles } from "sweet";
export const app = new App()
.get("/", () => new Response("ok"));`,
});
@@ -666,7 +666,7 @@ integrationTest({
"other/Foo.tsx": `export default () => <h1>ok</h1>;`,
"routes/index.tsx": `import Foo from "foo-island";
export default () => <Foo />;`,
"main.ts": `import { App } from "fresh";
"main.ts": `import { App } from "sweet";
export const app = new App().fsRoutes()`,
"deno.json": JSON.stringify({
imports: { "foo-island": "other/Foo.tsx" },
@@ -702,7 +702,7 @@ integrationTest("Builder - source maps", async () => {
await writeFiles(tmp, {
"islands/Foo.tsx": `export const Foo = () => <h1>hello</h1>`,
"routes/index.ts": `export const handler = () => new Response("ok")`,
"main.ts": `import { App } from "fresh";
"main.ts": `import { App } from "sweet";
export const app = new App().fsRoutes()`,
});
@@ -761,7 +761,7 @@ integrationTest("Builder - compile entry", async () => {
jsxImportSource: "preact",
},
imports: {
"fresh": "jsr:@fresh/core@*",
"sweet": "jsr:@paulaboks/sweet@*",
"preact": "npm:preact@*",
"@preact/signals": "npm:@preact/signals@*",
},
@@ -769,7 +769,7 @@ integrationTest("Builder - compile entry", async () => {
"islands/Foo.tsx": `export const Foo = () => <h1>hello</h1>`,
"routes/index.ts": `export const handler = () => new Response("ok")`,
"static/foo.txt": "ok",
"main.ts": `import { App, staticFiles } from "fresh";
"main.ts": `import { App, staticFiles } from "sweet";
export const app = new App()
.use(staticFiles())
.fsRoutes();`,
@@ -835,7 +835,7 @@ integrationTest("Builder - island that imports json entry", async () => {
jsxImportSource: "preact",
},
imports: {
"fresh": "jsr:@fresh/core@*",
"sweet": "jsr:@paulaboks/sweet@*",
"preact": "npm:preact@*",
"@preact/signals": "npm:@preact/signals@*",
"mime-db": "npm:mime-db@*",
@@ -847,7 +847,7 @@ export const Foo = () => {
return <h1>ok</h1>
}`,
"routes/index.ts": `export default () => <Foo />`,
"main.ts": `import { App, staticFiles } from "fresh";
"main.ts": `import { App, staticFiles } from "sweet";
export const app = new App()
.use(staticFiles())
.fsRoutes();`,
@@ -943,7 +943,7 @@ export default function Map() {
}`,
"routes/index.tsx": `import Map from "../islands/Map.tsx";
export default () => <Map />;`,
"main.ts": `import { App } from "fresh";
"main.ts": `import { App } from "sweet";
export const app = new App().fsRoutes();`,
});
+2 -2
View File
@@ -530,7 +530,7 @@ export async function generateSnapshotServer(
: "";
return `${EDIT_WARNING}
import { IslandPreparer } from "fresh/internal";
import { IslandPreparer } from "sweet/internal";
${islandImports}
${fsRouteImports}
@@ -615,7 +615,7 @@ export function generateServerEntry(
}
return `${EDIT_WARNING}
import { setBuildCache, ProdBuildCache, path } from "fresh/internal";
import { setBuildCache, ProdBuildCache, path } from "sweet/internal";
import * as snapshot from "${snapshotSpecifier}";
import { app } from "${serverEntry}";
+9 -6
View File
@@ -170,12 +170,15 @@ function buildIdPlugin(buildId: string): EsbuildPlugin {
return {
name: "fresh-build-id",
setup(build) {
build.onResolve({ filter: /^(jsr:)?@fresh\/build-id/ }, (args) => {
return {
path: args.path,
namespace: "fresh-internal-build-id",
};
});
build.onResolve(
{ filter: /^(jsr:)?@paulaboks\/sweet-build-id/ },
(args) => {
return {
path: args.path,
namespace: "fresh-internal-build-id",
};
},
);
build.onLoad({
filter: /.*/,
namespace: "fresh-internal-build-id",
+1 -1
View File
@@ -1,6 +1,6 @@
import { globToRegExp, isGlob } from "@std/path";
import type { FsAdapter } from "../fs.ts";
import { BUILD_ID } from "@fresh/build-id";
import { BUILD_ID } from "@paulaboks/sweet-build-id";
import { assetInternal } from "../runtime/shared_internal.ts";
export type TransformMode = "development" | "production";
+6 -5
View File
@@ -36,14 +36,15 @@ function getHomeDir(): string | null {
function getFreshCacheDir(): string | null {
const home = getHomeDir();
if (home) return path.join(home, "fresh");
if (home) return path.join(home, "sweet");
return null;
}
async function fetchLatestVersion(): Promise<string> {
const res = await fetch("https://dl.deno.land/fresh/release-latest.txt");
const res = await fetch("https://jsr.io/@paulaboks/sweet/meta.json");
if (res.ok) {
return (await res.text()).trim().replace(/^v/, "");
const meta = (await res.json()) as { latest: string | null };
if (meta.latest) return meta.latest;
}
throw new Error(`Could not fetch latest version.`);
@@ -128,11 +129,11 @@ export async function updateCheck(
const latest = colors.bold(colors.rgb8(checkFile.latest_version, 121));
// deno-lint-ignore no-console
console.log(
` Fresh ${latest} is available. You're on ${current}`,
` Sweet ${latest} is available. You're on ${current}`,
);
// deno-lint-ignore no-console
console.log(
` To upgrade, run: deno run -A -r jsr:@fresh/update`,
` To upgrade, bump the "sweet" version in your deno.json`,
);
// deno-lint-ignore no-console
console.log();
+2 -2
View File
@@ -10,7 +10,7 @@ export type { ErrorStatus };
*
* @example Basic usage
* ```ts
* import { App, HttpError } from "fresh";
* import { App, HttpError } from "sweet";
* import { expect } from "@std/expect";
*
* const app = new App()
@@ -36,7 +36,7 @@ export class HttpError extends Error {
*
* @example Basic usage
* ```ts
* import { App, HttpError } from "fresh";
* import { App, HttpError } from "sweet";
* import { expect } from "@std/expect";
*
* const app = new App()
+1 -1
View File
@@ -40,7 +40,7 @@ export type CORSOptions<State> = {
* @example Basic usage
* ```ts
* // main.ts or routes/_middleware.ts
* import { cors } from 'fresh';
* import { cors } from 'sweet';
*
* export const handler = [
* cors({ origin: '*' }), // Allow all origins
@@ -1,6 +1,6 @@
import type { Middleware } from "./mod.ts";
import { ASSET_CACHE_BUST_KEY } from "../constants.ts";
import { BUILD_ID } from "@fresh/build-id";
import { BUILD_ID } from "@paulaboks/sweet-build-id";
import { tracer } from "../otel.ts";
import { getBuildCache } from "../context.ts";
@@ -3,7 +3,7 @@ import { FakeServer, serveMiddleware } from "../test_utils.ts";
import type { BuildCache, StaticFile } from "../build_cache.ts";
import { expect } from "@std/expect";
import { ASSET_CACHE_BUST_KEY } from "../constants.ts";
import { BUILD_ID } from "@fresh/build-id";
import { BUILD_ID } from "@paulaboks/sweet-build-id";
import type { Command } from "../commands.ts";
import type { ServerIslandRegistry } from "../context.ts";
import {
+2 -2
View File
@@ -33,7 +33,7 @@ function reconnect() {
if (backoffIdx === 0) {
// deno-lint-ignore no-console
console.log(
`%c Fresh %c Connection closed. Trying to reconnect...`,
`%c Sweet %c Connection closed. Trying to reconnect...`,
"background-color: #86efac; color: black",
"color: inherit",
);
@@ -85,7 +85,7 @@ function handleMessage(e: MessageEvent) {
if (revision === 0) {
// deno-lint-ignore no-console
console.log(
`%c Fresh %c Connected to development server.`,
`%c Sweet %c Connected to development server.`,
"background-color: #86efac; color: black",
"color: inherit",
);
@@ -5,7 +5,7 @@ import {
type InternalPreactOptions,
OptionsType,
} from "../shared_internal.ts";
import { BUILD_ID } from "@fresh/build-id";
import { BUILD_ID } from "@paulaboks/sweet-build-id";
import { renderToString } from "preact-render-to-string";
import { useContext, useEffect } from "preact/hooks";
import { HeadContext } from "../head.ts";
+1 -1
View File
@@ -176,7 +176,7 @@ export function boot(
: `partial "${root.name}"`;
// deno-lint-ignore no-console
console.error(
`Fresh hydration error: the ${label} has invalid HTML nesting. ` +
`Sweet hydration error: the ${label} has invalid HTML nesting. ` +
`Its start and end markers were reparented by the browser into ` +
`different DOM nodes. This is usually caused by placing a ` +
`block-level element (like <div>) inside an inline element ` +
@@ -24,7 +24,7 @@ import {
setActiveUrl,
} from "../shared_internal.ts";
import type { BuildCache } from "../../build_cache.ts";
import { BUILD_ID } from "@fresh/build-id";
import { BUILD_ID } from "@paulaboks/sweet-build-id";
import {
DEV_ERROR_OVERLAY_URL,
PARTIAL_SEARCH_PARAM,
+1 -1
View File
@@ -1,5 +1,5 @@
import type { ComponentChildren, VNode } from "preact";
import { BUILD_ID } from "@fresh/build-id";
import { BUILD_ID } from "@paulaboks/sweet-build-id";
import { assetInternal, assetSrcSetInternal } from "./shared_internal.ts";
export { HttpError } from "../error.ts";