Start renaming
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@fresh/build-id",
|
||||
"name": "@paulaboks/sweet-build-id",
|
||||
"version": "1.0.1",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
|
||||
@@ -8,9 +8,9 @@ Learn more about the Fresh framework here:
|
||||
## Usage: Island example
|
||||
|
||||
```tsx
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
// Import the island function
|
||||
import { DemoIsland } from "jsr:@fresh/examples/island";
|
||||
import { DemoIsland } from "jsr:@paulaboks/sweet-examples/island";
|
||||
|
||||
export const app = new App({ root: import.meta.url })
|
||||
.use(staticFiles());
|
||||
@@ -24,10 +24,10 @@ await app.listen();
|
||||
## Usage: App1 or App2 example
|
||||
|
||||
```tsx
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
// Import the example apps
|
||||
import { app1 } from "jsr:@fresh/examples/app1";
|
||||
import { app2 } from "jsr:@fresh/examples/app2";
|
||||
import { app1 } from "jsr:@paulaboks/sweet-examples/app1";
|
||||
import { app2 } from "jsr:@paulaboks/sweet-examples/app2";
|
||||
|
||||
export const app = new App({ root: import.meta.url })
|
||||
.use(staticFiles());
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "@fresh/examples",
|
||||
"name": "@paulaboks/sweet-examples",
|
||||
"version": "1.0.1",
|
||||
"license": "MIT",
|
||||
"imports": {
|
||||
"fresh": "jsr:@fresh/core@^2.0.0",
|
||||
"sweet": "jsr:@paulaboks/sweet@^2.0.0",
|
||||
"preact": "npm:preact@^10.27.0",
|
||||
"@preact/signals": "npm:@preact/signals@^2.2.1"
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @module
|
||||
*/
|
||||
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
import { Doc } from "./shared.tsx";
|
||||
|
||||
/** App that renders a sample HTML document */
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @module
|
||||
*/
|
||||
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
import { Doc } from "./shared.tsx";
|
||||
|
||||
/** App that renders a sample HTML document */
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* import { App } from "fresh";
|
||||
* import { DemoIsland } from "jsr:@fresh/examples/island";
|
||||
* import { App } from "sweet";
|
||||
* import { DemoIsland } from "jsr:@paulaboks/sweet-examples/island";
|
||||
*
|
||||
* const app = new App();
|
||||
*
|
||||
|
||||
@@ -8,17 +8,17 @@ web applications.
|
||||
|
||||
## Usage
|
||||
|
||||
Generate a new Fresh project with `@fresh/init`:
|
||||
Generate a new Fresh project with `@paulaboks/sweet-init`:
|
||||
|
||||
```sh
|
||||
deno run -Ar jsr:@fresh/init
|
||||
deno run -Ar jsr:@paulaboks/sweet-init
|
||||
```
|
||||
|
||||
Add middleware, routes, & endpoints as needed via the `routes/` folder or
|
||||
directly on the `App` instance.
|
||||
|
||||
```tsx
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.get("/", () => new Response("hello world"))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@fresh/core",
|
||||
"name": "@paulaboks/sweet",
|
||||
"version": "2.3.3",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
|
||||
@@ -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 ? " " : "";
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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();`,
|
||||
});
|
||||
|
||||
|
||||
@@ -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}";
|
||||
|
||||
|
||||
@@ -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,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";
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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,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";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { App, staticFiles } from "sweet";
|
||||
import {
|
||||
ALL_ISLAND_DIR,
|
||||
assertNotSelector,
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from "./test_utils.tsx";
|
||||
|
||||
import { FakeServer } from "../src/test_utils.ts";
|
||||
import { Partial } from "fresh/runtime";
|
||||
import { Partial } from "sweet/runtime";
|
||||
|
||||
const allIslandCache = await buildProd({ islandDir: ALL_ISLAND_DIR });
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ Deno.test("Docs Code example checks", async () => {
|
||||
const denoJson = {
|
||||
lock: false,
|
||||
imports: {
|
||||
fresh: `jsr:@fresh/core@${FRESH_VERSION}`,
|
||||
"@fresh/plugin-tailwind-v3":
|
||||
`jsr:@fresh/plugin-tailwind@^${twDenoJson.version}`,
|
||||
"@fresh/plugin-tailwind":
|
||||
`jsr:@fresh/plugin-tailwind@^${twDenoJson.version}`,
|
||||
fresh: `jsr:@paulaboks/sweet@${FRESH_VERSION}`,
|
||||
"@paulaboks/sweet-tailwind-v3":
|
||||
`jsr:@paulaboks/sweet-tailwind@^${twDenoJson.version}`,
|
||||
"@paulaboks/sweet-tailwind":
|
||||
`jsr:@paulaboks/sweet-tailwind@^${twDenoJson.version}`,
|
||||
preact: `npm:preact@^${PREACT_VERSION}`,
|
||||
"@deno/gfm": "jsr:@deno/gfm@^0.11.0",
|
||||
"@std/expect": "jsr:@std/expect@^1.0.16",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function DynamicMetaIsland() {
|
||||
const [count, setCount] = useState(0);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function LinkIsland() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function MetaIsland() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function MultiHeadA() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function MultiHeadB() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function StyleIdIsland() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function TemplateIsland() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function TitleIsland() {
|
||||
const [s, set] = useState(0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PageProps } from "@fresh/core";
|
||||
import type { PageProps } from "@paulaboks/sweet";
|
||||
|
||||
export default function Page({ Component }: PageProps) {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect } from "preact/hooks";
|
||||
import { useSignal } from "@preact/signals";
|
||||
import { IS_BROWSER } from "fresh/runtime";
|
||||
import { IS_BROWSER } from "sweet/runtime";
|
||||
|
||||
export function NodeProcess() {
|
||||
const active = useSignal(false);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Partial } from "fresh/runtime";
|
||||
import { Partial } from "sweet/runtime";
|
||||
|
||||
export function PartialInIsland() {
|
||||
return (
|
||||
|
||||
@@ -5,7 +5,7 @@ import rootConfig from "../../../deno.json" with { type: "json" };
|
||||
import freshConfig from "../deno.json" with { type: "json" };
|
||||
|
||||
Deno.test("Fresh version consistency", () => {
|
||||
const freshImport: string = rootConfig.imports.fresh;
|
||||
const freshImport: string = rootConfig.imports.sweet;
|
||||
const rangeStr = freshImport.split("@").pop()!;
|
||||
const importRange = tryParseRange(rangeStr);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { App, staticFiles } from "sweet";
|
||||
import { Head } from "sweet/runtime";
|
||||
import {
|
||||
buildProd,
|
||||
parseHtml,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { App, staticFiles } from "sweet";
|
||||
import { BlockIsland } from "./fixtures_islands/BlockIsland.tsx";
|
||||
import { Counter } from "./fixtures_islands/Counter.tsx";
|
||||
import { IslandInIsland } from "./fixtures_islands/IslandInIsland.tsx";
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* and has no element with `f-client-nav="true"`. The full Fresh client runtime
|
||||
* (fresh-runtime.js + inline boot script) must only appear when actually needed.
|
||||
*/
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
import { signal } from "@preact/signals";
|
||||
import { Counter } from "./fixtures_islands/Counter.tsx";
|
||||
import { expect } from "@std/expect";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { Partial } from "fresh/runtime";
|
||||
import { App, staticFiles } from "sweet";
|
||||
import { Partial } from "sweet/runtime";
|
||||
import {
|
||||
ALL_ISLAND_DIR,
|
||||
assertMetaContent,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
This is a CLI tool to bootstrap a new Fresh project. To do so, run this command:
|
||||
|
||||
```sh
|
||||
deno run -Ar jsr:@fresh/init
|
||||
deno run -Ar jsr:@paulaboks/sweet-init
|
||||
```
|
||||
|
||||
Go to [https://usefresh.dev/](https://usefresh.dev/) for more information about
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@fresh/init",
|
||||
"name": "@paulaboks/sweet-init",
|
||||
"version": "2.3.3",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
|
||||
+29
-28
@@ -37,24 +37,24 @@ export const HELP_TEXT = `
|
||||
${
|
||||
colors.bgRgb8(
|
||||
colors.rgb8(
|
||||
` 🍋 @fresh/init${colors.rgb8(`@${initConfig.version}`, 248)} `,
|
||||
` 🍋 @paulaboks/sweet-init${colors.rgb8(`@${initConfig.version}`, 248)} `,
|
||||
0,
|
||||
),
|
||||
121,
|
||||
)
|
||||
}
|
||||
|
||||
Initialize a new Fresh project. This will create all the necessary files
|
||||
Initialize a new Sweet project. This will create all the necessary files
|
||||
for a new project.
|
||||
|
||||
To generate a project in the './foobar' subdirectory:
|
||||
${colors.rgb8("deno run -Ar jsr:@fresh/init ./foobar", 245)}
|
||||
${colors.rgb8("deno run -Ar jsr:@paulaboks/sweet-init ./foobar", 245)}
|
||||
|
||||
To generate a project in the current directory:
|
||||
${colors.rgb8("deno run -Ar jsr:@fresh/init .", 245)}
|
||||
${colors.rgb8("deno run -Ar jsr:@paulaboks/sweet-init .", 245)}
|
||||
|
||||
${colors.rgb8("USAGE:", 3)}
|
||||
${colors.rgb8("deno run -Ar jsr:@fresh/init [DIRECTORY]", 245)}
|
||||
${colors.rgb8("deno run -Ar jsr:@paulaboks/sweet-init [DIRECTORY]", 245)}
|
||||
|
||||
${colors.rgb8("OPTIONS:", 3)}
|
||||
${colors.rgb8("--force", 2)} Overwrite existing files
|
||||
@@ -89,7 +89,10 @@ export async function initProject(
|
||||
skipInstall?: boolean | null;
|
||||
} = {},
|
||||
): Promise<void> {
|
||||
const freshVersion = await getLatestVersion("@fresh/core", FRESH_VERSION);
|
||||
const freshVersion = await getLatestVersion(
|
||||
"@paulaboks/sweet",
|
||||
FRESH_VERSION,
|
||||
);
|
||||
|
||||
if (flags.help || flags.h) {
|
||||
console.log(HELP_TEXT);
|
||||
@@ -99,7 +102,7 @@ export async function initProject(
|
||||
console.log();
|
||||
console.log(
|
||||
colors.bgRgb8(
|
||||
colors.rgb8(" 🍋 Fresh: The next-gen web framework. ", 0),
|
||||
colors.rgb8(" 🍬 Sweet: The next-gen web framework. ", 0),
|
||||
121,
|
||||
),
|
||||
);
|
||||
@@ -171,7 +174,7 @@ export async function initProject(
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# Fresh build directory
|
||||
# Sweet build directory
|
||||
_fresh/
|
||||
# npm + other dependencies
|
||||
node_modules/
|
||||
@@ -395,7 +398,7 @@ import "./assets/styles.css";`,
|
||||
// Skip this and be silent if there is a network issue.
|
||||
}
|
||||
|
||||
const MAIN_TS = `import { App, staticFiles } from "fresh";
|
||||
const MAIN_TS = `import { App, staticFiles } from "sweet";
|
||||
import { define, type State } from "./utils.ts";
|
||||
|
||||
export const app = new App<State>();
|
||||
@@ -447,7 +450,7 @@ export function Button(props: ButtonProps) {
|
||||
}`;
|
||||
await writeFile("components/Button.tsx", COMPONENTS_BUTTON_TSX);
|
||||
|
||||
const UTILS_TS = `import { createDefine } from "fresh";
|
||||
const UTILS_TS = `import { createDefine } from "sweet";
|
||||
|
||||
// This specifies the type of "ctx.state" which is used to share
|
||||
// data among middlewares, layouts and routes.
|
||||
@@ -459,7 +462,7 @@ export const define = createDefine<State>();`;
|
||||
await writeFile("utils.ts", UTILS_TS);
|
||||
|
||||
const ROUTES_HOME = `import { useSignal } from "@preact/signals";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
import { define } from "../utils.ts";
|
||||
import Counter from "../islands/Counter.tsx";
|
||||
|
||||
@@ -471,7 +474,7 @@ export default define.page(function Home(ctx) {
|
||||
return (
|
||||
<div class="px-4 py-8 mx-auto fresh-gradient min-h-screen">
|
||||
<Head>
|
||||
<title>Fresh counter</title>
|
||||
<title>Sweet counter</title>
|
||||
</Head>
|
||||
<div class="max-w-screen-md mx-auto flex flex-col items-center justify-center">
|
||||
<img
|
||||
@@ -479,9 +482,9 @@ export default define.page(function Home(ctx) {
|
||||
src="/logo.svg"
|
||||
width="128"
|
||||
height="128"
|
||||
alt="the Fresh logo: a sliced lemon dripping with juice"
|
||||
alt="the Sweet logo"
|
||||
/>
|
||||
<h1 class="text-4xl font-bold">Welcome to Fresh</h1>
|
||||
<h1 class="text-4xl font-bold">Welcome to Sweet</h1>
|
||||
<p class="my-4">
|
||||
Try updating this message in the
|
||||
<code class="mx-2">./routes/index.tsx</code> file, and refresh.
|
||||
@@ -544,8 +547,8 @@ export default function Counter(props: CounterProps) {
|
||||
await writeFile("islands/Counter.tsx", ISLANDS_COUNTER_TSX);
|
||||
|
||||
const DEV_TS = `#!/usr/bin/env -S deno run -A --watch=static/,routes/
|
||||
${useTailwind ? `import { tailwind } from "@fresh/plugin-tailwind";\n` : ""}
|
||||
import { Builder } from "fresh/dev";
|
||||
${useTailwind ? `import { tailwind } from "@paulaboks/sweet-tailwind";\n` : ""}
|
||||
import { Builder } from "sweet/dev";
|
||||
|
||||
const builder = new Builder();
|
||||
${useTailwind ? "tailwind(builder);" : ""}
|
||||
@@ -566,7 +569,6 @@ if (Deno.args.includes("build")) {
|
||||
dev: "deno run -A --watch=static/,routes/ dev.ts",
|
||||
build: "deno run -A dev.ts build",
|
||||
start: "deno serve -A _fresh/server.js",
|
||||
update: "deno run -A -r jsr:@fresh/update .",
|
||||
},
|
||||
lint: {
|
||||
rules: {
|
||||
@@ -576,7 +578,7 @@ if (Deno.args.includes("build")) {
|
||||
exclude: ["**/_fresh/*"],
|
||||
imports: {
|
||||
"@/": "./",
|
||||
"fresh": `jsr:@fresh/core@^${freshVersion}`,
|
||||
"sweet": `jsr:@paulaboks/sweet@^${freshVersion}`,
|
||||
"preact": `npm:preact@^${PREACT_VERSION}`,
|
||||
"@preact/signals": `npm:@preact/signals@^${PREACT_SIGNALS_VERSION}`,
|
||||
} as Record<string, string>,
|
||||
@@ -609,12 +611,12 @@ if (Deno.args.includes("build")) {
|
||||
denoJson.tasks.build = "vite build";
|
||||
|
||||
const vitePluginVersion = await getLatestVersion(
|
||||
"@fresh/plugin-vite",
|
||||
"@paulaboks/sweet-vite",
|
||||
FRESH_VITE_PLUGIN,
|
||||
);
|
||||
|
||||
denoJson.imports["@fresh/plugin-vite"] =
|
||||
`jsr:@fresh/plugin-vite@^${vitePluginVersion}`;
|
||||
denoJson.imports["@paulaboks/sweet-vite"] =
|
||||
`jsr:@paulaboks/sweet-vite@^${vitePluginVersion}`;
|
||||
denoJson.imports["vite"] = "npm:vite@^7.1.3";
|
||||
denoJson.imports["@types/babel__core"] = "npm:@types/babel__core@^7.20.5";
|
||||
|
||||
@@ -625,8 +627,8 @@ if (Deno.args.includes("build")) {
|
||||
}
|
||||
} else if (useTailwind) {
|
||||
denoJson.imports["tailwindcss"] = `npm:tailwindcss@^${TAILWINDCSS_VERSION}`;
|
||||
denoJson.imports["@fresh/plugin-tailwind"] =
|
||||
`jsr:@fresh/plugin-tailwind@^${FRESH_TAILWIND_VERSION}`;
|
||||
denoJson.imports["@paulaboks/sweet-tailwind"] =
|
||||
`jsr:@paulaboks/sweet-tailwind@^${FRESH_TAILWIND_VERSION}`;
|
||||
denoJson.imports["@tailwindcss/postcss"] =
|
||||
`npm:@tailwindcss/postcss@^${TAILWINDCSS_POSTCSS_VERSION}`;
|
||||
denoJson.imports["postcss"] = `npm:postcss@^${POSTCSS_VERSION}`;
|
||||
@@ -636,23 +638,22 @@ if (Deno.args.includes("build")) {
|
||||
|
||||
if (useVite) {
|
||||
let viteConfig = `import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";\n`;
|
||||
import { sweet } from "@paulaboks/sweet-vite";\n`;
|
||||
|
||||
if (useTailwind) {
|
||||
viteConfig += `import tailwindcss from "@tailwindcss/vite";\n`;
|
||||
}
|
||||
|
||||
viteConfig += `\nexport default defineConfig({
|
||||
plugins: [fresh()${useTailwind ? ", tailwindcss()" : ""}],
|
||||
plugins: [sweet()${useTailwind ? ", tailwindcss()" : ""}],
|
||||
});`;
|
||||
|
||||
await writeFile("vite.config.ts", viteConfig);
|
||||
}
|
||||
|
||||
const README_MD = `# Fresh project
|
||||
const README_MD = `# Sweet project
|
||||
|
||||
Your new Fresh project is ready to go. You can follow the Fresh "Getting
|
||||
Started" guide here: https://usefresh.dev/docs/getting-started
|
||||
Your new Sweet project is ready to go.
|
||||
|
||||
### Usage
|
||||
|
||||
|
||||
@@ -80,6 +80,14 @@ async function patchProject(dir: string): Promise<void> {
|
||||
ignore,
|
||||
);
|
||||
|
||||
if (json.imports?.["@paulaboks/sweet-tailwind"]) {
|
||||
await copyRecursive(
|
||||
path.join(import.meta.dirname!, "..", "..", "plugin-tailwindcss"),
|
||||
path.join(linkedDir, "plugin-tailwindcss"),
|
||||
ignore,
|
||||
);
|
||||
}
|
||||
|
||||
json.workspace = ["./_linked/*"];
|
||||
json.exclude = [...json.exclude ?? [], "**/_linked/*"];
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { parseArgs } from "@std/cli/parse-args";
|
||||
import { initProject } from "./init.ts";
|
||||
import { InitError } from "./init.ts";
|
||||
|
||||
// Note: "deno run -Ar jsr:@fresh/init" is the recommended way to create a new project.
|
||||
// Note: "deno run -Ar jsr:@paulaboks/sweet-init" is the recommended way to create a new project.
|
||||
|
||||
const flags = parseArgs(Deno.args, {
|
||||
boolean: ["force", "tailwind", "vscode", "docker", "help", "builder"],
|
||||
|
||||
@@ -9,8 +9,8 @@ A Tailwind CSS v3 plugin to use in Fresh.
|
||||
|
||||
```ts
|
||||
// dev.ts
|
||||
import { Builder } from "fresh/dev";
|
||||
import { tailwind } from "@fresh/plugin-tailwind-v3";
|
||||
import { Builder } from "sweet/dev";
|
||||
import { tailwind } from "@paulaboks/sweet-tailwind-v3";
|
||||
|
||||
const builder = new Builder();
|
||||
tailwind(builder);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@fresh/plugin-tailwind-v3",
|
||||
"name": "@paulaboks/sweet-tailwind-v3",
|
||||
"version": "1.1.0",
|
||||
"license": "MIT",
|
||||
"exports": "./src/mod.ts",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Builder, ResolvedBuildConfig } from "fresh/dev";
|
||||
import type { Builder, ResolvedBuildConfig } from "sweet/dev";
|
||||
import tailwindCss, { type Config } from "tailwindcss";
|
||||
import postcss from "postcss";
|
||||
import cssnano from "cssnano";
|
||||
|
||||
@@ -6,9 +6,9 @@ A Tailwind CSS plugin to use in Fresh.
|
||||
|
||||
```ts
|
||||
// dev.ts
|
||||
import { Builder } from "fresh/dev";
|
||||
import { Builder } from "sweet/dev";
|
||||
import { app } from "./main.ts";
|
||||
import { tailwind } from "@fresh/plugin-tailwind";
|
||||
import { tailwind } from "@paulaboks/sweet-tailwind";
|
||||
|
||||
const builder = new Builder();
|
||||
tailwind(builder, app);
|
||||
@@ -24,9 +24,9 @@ if (Deno.args.includes("build")) {
|
||||
|
||||
```ts
|
||||
// dev.ts
|
||||
import { Builder } from "fresh/dev";
|
||||
import { Builder } from "sweet/dev";
|
||||
import { app } from "./main.ts";
|
||||
import { tailwind } from "@fresh/plugin-tailwind";
|
||||
import { tailwind } from "@paulaboks/sweet-tailwind";
|
||||
|
||||
const builder = new Builder();
|
||||
tailwind(builder, app, {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@fresh/plugin-tailwind",
|
||||
"name": "@paulaboks/sweet-tailwind",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"exports": "./src/mod.ts"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Builder } from "fresh/dev";
|
||||
import type { Builder } from "sweet/dev";
|
||||
import twPostcss from "@tailwindcss/postcss";
|
||||
import postcss from "postcss";
|
||||
import type { TailwindPluginOptions } from "./types.ts";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OnTransformOptions } from "fresh/dev";
|
||||
import type { OnTransformOptions } from "sweet/dev";
|
||||
|
||||
// based on the original code, this type is used to define options for the Tailwind plugin
|
||||
type PluginOptions = {
|
||||
|
||||
@@ -4,13 +4,13 @@ Vite plugin for [Fresh](https://usefresh.dev).
|
||||
|
||||
## Usage
|
||||
|
||||
1. Run `deno install jsr:@fresh/plugin-vite npm:vite`
|
||||
1. Run `deno install jsr:@paulaboks/sweet-vite npm:vite`
|
||||
2. Ensure that your `deno.json` has the `fresh` import mapping:
|
||||
|
||||
```json
|
||||
{
|
||||
"imports": {
|
||||
"fresh": "jsr:@fresh/core"
|
||||
"sweet": "jsr:@paulaboks/sweet"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -19,7 +19,7 @@ Vite plugin for [Fresh](https://usefresh.dev).
|
||||
|
||||
```diff
|
||||
import { defineConfig } from "vite";
|
||||
+ import { fresh } from "@fresh/plugin-vite";
|
||||
+ import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function HeadCounter() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function HeadMeta() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { App, staticFiles, trailingSlashes } from "fresh";
|
||||
import { App, staticFiles, trailingSlashes } from "sweet";
|
||||
|
||||
export const app = new App()
|
||||
.use(staticFiles())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PageProps } from "fresh";
|
||||
import type { PageProps } from "sweet";
|
||||
import { AppNav } from "../islands/AppNav.tsx";
|
||||
|
||||
export default function App({ Component }: PageProps) {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { BUILD_ID } from "@fresh/build-id";
|
||||
import { BUILD_ID } from "@paulaboks/sweet-build-id";
|
||||
|
||||
export const handler = () => new Response(BUILD_ID);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Middleware } from "@fresh/core";
|
||||
import type { Middleware } from "@paulaboks/sweet";
|
||||
|
||||
const middleware1: Middleware<{ text: string }> = async (ctx) => {
|
||||
ctx.state.text = "A";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { HandlerFn } from "@fresh/core";
|
||||
import type { HandlerFn } from "@paulaboks/sweet";
|
||||
|
||||
export const handler: HandlerFn<null, { text: string }> = (ctx) =>
|
||||
new Response(ctx.state.text);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Partial } from "@fresh/core/runtime";
|
||||
import { Partial } from "@paulaboks/sweet/runtime";
|
||||
import { ReadyIsland } from "../../islands/tests/Ready.tsx";
|
||||
|
||||
export default function Page() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Partial } from "@fresh/core/runtime";
|
||||
import { Partial } from "@paulaboks/sweet/runtime";
|
||||
import { CounterHooks } from "../../islands/tests/CounterHooks.tsx";
|
||||
|
||||
export default function Page() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createDefine } from "@fresh/core";
|
||||
import { createDefine } from "@paulaboks/sweet";
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
export const define = createDefine<any>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
import inspect from "vite-plugin-inspect";
|
||||
import tailwind from "@tailwindcss/vite";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@fresh/plugin-vite",
|
||||
"name": "@paulaboks/sweet-vite",
|
||||
"version": "1.1.2",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
@@ -33,7 +33,7 @@
|
||||
"@types/node": "npm:@types/node@^24.1.0",
|
||||
"@types/qs": "npm:@types/qs@^6.14.0",
|
||||
"feed": "npm:feed@^5.1.0",
|
||||
"fresh": "jsr:@fresh/core@^2.0.0",
|
||||
"sweet": "jsr:@paulaboks/sweet@^2.0.0",
|
||||
"ioredis": "npm:ioredis@^5.7.0",
|
||||
"mime-db": "npm:mime-db@^1.54.0",
|
||||
"pg": "npm:pg@^8.16.3",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Used internally by the `@fresh/plugin-vite` to add HMR support
|
||||
* Used internally by the `@paulaboks/sweet-vite` to add HMR support
|
||||
* for Fresh running in the browser.
|
||||
*
|
||||
* **Do not** import this module directly.
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
UniqueNamer,
|
||||
UPDATE_INTERVAL,
|
||||
updateCheck,
|
||||
} from "@fresh/core/internal-dev";
|
||||
} from "@paulaboks/sweet/internal-dev";
|
||||
import { checkImports } from "./plugins/verify_imports.ts";
|
||||
import { isBuiltin } from "node:module";
|
||||
import { load as stdLoadEnv } from "@std/dotenv";
|
||||
@@ -45,7 +45,7 @@ export type {
|
||||
* @example Basic usage
|
||||
* ```ts vite.config.ts
|
||||
* import { defineConfig } from "vite";
|
||||
* import { fresh } from "@fresh/plugin-vite";
|
||||
* import { fresh } from "@paulaboks/sweet-vite";
|
||||
*
|
||||
* export default defineConfig({
|
||||
* plugins: [
|
||||
@@ -282,3 +282,6 @@ async function loadEnvFile(envPath: string) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
/** Alias of {@linkcode fresh}: the Vite plugin for Sweet. */
|
||||
export { fresh as sweet };
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { Plugin } from "vite";
|
||||
export function buildIdPlugin(): Plugin {
|
||||
let buildId = "";
|
||||
|
||||
const regex = /^(jsr:)?@fresh\/build-id(@.*)?$/;
|
||||
const regex = /^(jsr:)?@paulaboks\/sweet-build-id(@.*)?$/;
|
||||
|
||||
return {
|
||||
name: "fresh:build-id",
|
||||
|
||||
@@ -28,7 +28,7 @@ export function clientEntryPlugin(options: ResolvedFreshViteConfig): Plugin {
|
||||
if (id === modName) {
|
||||
return `\0${modName}`;
|
||||
} else if (id === "fresh:client-quirks") {
|
||||
return "@fresh/plugin-vite/client";
|
||||
return "@paulaboks/sweet-vite/client";
|
||||
} else if (id === modNameUser) {
|
||||
return clientEntry;
|
||||
}
|
||||
@@ -49,9 +49,9 @@ export function clientEntryPlugin(options: ResolvedFreshViteConfig): Plugin {
|
||||
|
||||
return `
|
||||
${isDev ? 'import "preact/debug"' : ""}
|
||||
export * from "fresh/runtime-client";
|
||||
export * from "sweet/runtime-client";
|
||||
${exists ? `import "fresh:client-entry-user";` : ""}
|
||||
import "@fresh/plugin-vite/client";`;
|
||||
import "@paulaboks/sweet-vite/client";`;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Plugin, ViteDevServer } from "vite";
|
||||
import { pathWithRoot, type ResolvedFreshViteConfig } from "../utils.ts";
|
||||
import { crawlFsItem, specToName } from "fresh/internal-dev";
|
||||
import { crawlFsItem, specToName } from "sweet/internal-dev";
|
||||
import * as path from "@std/path";
|
||||
|
||||
export function clientSnapshot(options: ResolvedFreshViteConfig): Plugin[] {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { DevEnvironment, Plugin } from "vite";
|
||||
import * as path from "@std/path";
|
||||
import { contentType as getStdContentType } from "@std/media-types/content-type";
|
||||
import { ASSET_CACHE_BUST_KEY, upgradeSourceMap } from "fresh/internal";
|
||||
import { ASSET_CACHE_BUST_KEY, upgradeSourceMap } from "sweet/internal";
|
||||
import { createRequest, sendResponse } from "@remix-run/node-fetch-server";
|
||||
import { hashCode } from "../shared.ts";
|
||||
import type { ResolvedFreshViteConfig } from "../utils.ts";
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
type PendingStaticFile,
|
||||
prepareStaticFile,
|
||||
writeCompiledEntry,
|
||||
} from "fresh/internal-dev";
|
||||
} from "sweet/internal-dev";
|
||||
import { pathWithRoot, type ResolvedFreshViteConfig } from "../utils.ts";
|
||||
import * as path from "@std/path";
|
||||
|
||||
@@ -92,7 +92,7 @@ export function registerStaticFile(prepared) {
|
||||
|
||||
if (isDev) {
|
||||
code = `import "preact/debug";
|
||||
import { setErrorInterceptor as internalErrorIntercept } from "fresh/internal";
|
||||
import { setErrorInterceptor as internalErrorIntercept } from "sweet/internal";
|
||||
${code}
|
||||
|
||||
export function setErrorInterceptor(fn) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
specToName,
|
||||
toPosix,
|
||||
UniqueNamer,
|
||||
} from "fresh/internal-dev";
|
||||
} from "sweet/internal-dev";
|
||||
import {
|
||||
JS_REG,
|
||||
pathWithRoot,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as path from "@std/path";
|
||||
import type { FsRouteFileNoMod, UniqueNamer } from "fresh/internal-dev";
|
||||
import type { FsRouteFileNoMod, UniqueNamer } from "sweet/internal-dev";
|
||||
import type { ImportCheck } from "./plugins/verify_imports.ts";
|
||||
|
||||
export const JS_REG = /\.([tj]sx?|[mc]?[tj]s)(\?.*)?$/;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { App, staticFiles } from "@fresh/core";
|
||||
import { App, staticFiles } from "@paulaboks/sweet";
|
||||
|
||||
export const app = new App({ basePath: "/ui" })
|
||||
.use(staticFiles())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
base: "/ui/",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { App, staticFiles } from "@fresh/core";
|
||||
import { App, staticFiles } from "@paulaboks/sweet";
|
||||
|
||||
export const app = new App()
|
||||
.use(staticFiles())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [fresh()],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { App, staticFiles } from "@fresh/core";
|
||||
import { App, staticFiles } from "@paulaboks/sweet";
|
||||
|
||||
export const app = new App()
|
||||
.use(staticFiles())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [fresh()],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"imports": {
|
||||
"fresh": "jsr:@fresh/core",
|
||||
"sweet": "jsr:@paulaboks/sweet",
|
||||
"@preact/signals": "npm:@preact/signals@^1.3.0",
|
||||
"preact": "npm:preact@^10.26.1",
|
||||
"preact/": "npm:/preact@^10.26.1/"
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
|
||||
export const app = new App().fsRoutes();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [fresh()],
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
import { App } from "@fresh/core";
|
||||
import { App } from "@paulaboks/sweet";
|
||||
|
||||
export const app = new App().fsRoutes();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [fresh()],
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
import { App } from "@fresh/core";
|
||||
import { App } from "@paulaboks/sweet";
|
||||
|
||||
export const app = new App().get("/", () => new Response("ok"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [fresh()],
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
import { App } from "@fresh/core";
|
||||
import { App } from "@paulaboks/sweet";
|
||||
|
||||
export const app = new App().get("/ok", () => new Response("ok")).fsRoutes();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [fresh()],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { App, staticFiles } from "@fresh/core";
|
||||
import { App, staticFiles } from "@paulaboks/sweet";
|
||||
|
||||
export const app = new App()
|
||||
.use(staticFiles())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [fresh()],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { App, staticFiles } from "@fresh/core";
|
||||
import { App, staticFiles } from "@paulaboks/sweet";
|
||||
|
||||
export const app = new App()
|
||||
.use(staticFiles())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PageProps } from "fresh";
|
||||
import type { PageProps } from "sweet";
|
||||
import { CssModulesNonIsland } from "../components/CssModuleNonIsland.tsx";
|
||||
|
||||
export default function App({ Component }: PageProps) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createDefine } from "@fresh/core";
|
||||
import { createDefine } from "@paulaboks/sweet";
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
export const define = createDefine<any>();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user