@janit/fu 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,6 +49,7 @@ deno task todo:start # serve its build on :1337
49
49
 
50
50
  deno task test # 41 unit tests
51
51
  deno task check # types + tests + jsr publish dry-run
52
+ deno task check:pkg # build and serve a real app from the packed npm artefact
52
53
  ```
53
54
 
54
55
  Both example apps build against **this checkout's `src/`**, never a published
package/dist/app.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Ctx, Middleware } from "./types.ts";
1
+ import type { Ctx, Middleware } from "./types.js";
2
2
  export declare function compose<S>(middleware: readonly Middleware<S>[], terminal: (ctx: Ctx<S>) => Response | Promise<Response>): (ctx: Ctx<S>) => Promise<Response>;
3
3
  /**
4
4
  * The application: an ordered middleware chain.
package/dist/build.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { FuOptions } from "./types.ts";
1
+ import type { FuOptions } from "./types.js";
2
2
  export declare function build(opts: FuOptions): Promise<void>;
3
3
  /** Concatenate collected stylesheets into one hashed file. Returns its name. */
4
4
  export declare function writeSheets(dir: string, sheets: Map<string, string>): string | null;
package/dist/dev.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import type { FuOptions } from "./types.ts";
1
+ import type { FuOptions } from "./types.js";
2
2
  export declare function dev(opts: FuOptions): Promise<void>;
package/dist/errors.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { RouteError } from "./types.ts";
1
+ import type { RouteError } from "./types.js";
2
2
  /**
3
3
  * Throw from a handler or middleware to produce a specific status.
4
4
  *
package/dist/mod.d.ts CHANGED
@@ -5,10 +5,10 @@
5
5
  * and an asset list, both plain data. Drivers live in `./build.ts` and
6
6
  * `./dev.ts`.
7
7
  */
8
- export { App, compose } from "./app.ts";
9
- export { HttpError, statusText, toRouteError } from "./errors.ts";
10
- export { createHandler, document, renderError } from "./render.ts";
11
- export type { HandlerParts, ShellProps } from "./render.ts";
12
- export { buildRoutes, filePathToPattern, match } from "./router.ts";
13
- export type { Matched, Route } from "./router.ts";
14
- export type { Asset, Assets, Ctx, FuOptions, Head, Middleware, PageContext, RouteError, RouteHandler, RouteManifest, RouteModule, } from "./types.ts";
8
+ export { App, compose } from "./app.js";
9
+ export { HttpError, statusText, toRouteError } from "./errors.js";
10
+ export { createHandler, document, renderError } from "./render.js";
11
+ export type { HandlerParts, ShellProps } from "./render.js";
12
+ export { buildRoutes, filePathToPattern, match } from "./router.js";
13
+ export type { Matched, Route } from "./router.js";
14
+ export type { Asset, Assets, Ctx, FuOptions, Head, Middleware, PageContext, RouteError, RouteHandler, RouteManifest, RouteModule, } from "./types.js";
package/dist/render.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type ComponentType } from "preact";
2
- import type { App } from "./app.ts";
3
- import type { Assets, Ctx, Head, RouteManifest } from "./types.ts";
2
+ import type { App } from "./app.js";
3
+ import type { Assets, Ctx, Head, RouteManifest } from "./types.js";
4
4
  /** Optional root wrapper (`routes/_app.tsx`) around every page. */
5
5
  export interface ShellProps<S = Record<string, unknown>> {
6
6
  ctx: Ctx<S>;
package/dist/router.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { RouteManifest, RouteModule } from "./types.ts";
1
+ import type { RouteManifest, RouteModule } from "./types.js";
2
2
  export interface Route<S = Record<string, unknown>> {
3
3
  /** URLPattern pathname, e.g. "/blog/:slug". */
4
4
  pattern: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janit/fu",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "description": "A minimal islands framework on Preact 11, rolldown and Nitro. Runs on Deno, Node and Bun.",
6
6
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
  "./package.json": "./package.json"
45
45
  },
46
46
  "bin": {
47
- "fu": "./src/cli.ts"
47
+ "fu": "./dist/cli.js"
48
48
  },
49
49
  "dependencies": {
50
50
  "crossws": "^0.4.12",
@@ -91,7 +91,7 @@
91
91
  "framework"
92
92
  ],
93
93
  "scripts": {
94
- "build": "tsc -p tsconfig.build.json && cp src/hmr-runtime.js dist/hmr-runtime.js",
94
+ "build": "tsc -p tsconfig.build.json && cp src/hmr-runtime.js dist/hmr-runtime.js && sed -i -E 's|(from \"\\./[^\"]+)\\.ts\"|\\1.js\"|g' dist/*.d.ts",
95
95
  "prepack": "rm -rf dist && npm run build"
96
96
  },
97
97
  "main": "./dist/mod.js"
package/src/cli.ts DELETED
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env -S deno run -A
2
- import { build } from "./build.ts";
3
- import { dev } from "./dev.ts";
4
-
5
- export async function main(argv: string[]): Promise<void> {
6
- const [cmd = "dev", ...rest] = argv;
7
- const portArg = rest.find((a) => a.startsWith("--port="));
8
- const hostArg = rest.find((a) => a.startsWith("--host="));
9
- const rootArg = rest.find((a) => !a.startsWith("-"));
10
- const opts = {
11
- root: rootArg ?? Deno?.cwd?.() ?? process.cwd(),
12
- port: portArg ? Number(portArg.slice("--port=".length)) : undefined,
13
- hostname: hostArg ? hostArg.slice("--host=".length) : undefined,
14
- };
15
- if (cmd === "build") await build(opts);
16
- else if (cmd === "dev") await dev(opts);
17
- else {
18
- console.error(`fu: unknown command "${cmd}" (expected dev|build)`);
19
- throw new Error(`unknown command: ${cmd}`);
20
- }
21
- }
22
-
23
- declare const Deno: { cwd?: () => string } | undefined;
24
-
25
- if (import.meta.main) await main(globalThis.process?.argv.slice(2) ?? []);