weifuwu 0.18.1 → 0.18.2

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.
@@ -0,0 +1,2 @@
1
+ import type { Middleware } from '../types.ts';
2
+ export declare function layout(path: string): Middleware;
@@ -0,0 +1,6 @@
1
+ import { Router } from '../router.ts';
2
+ export declare function liveReload(opts: {
3
+ dirs: string[];
4
+ }): Router & {
5
+ close: () => void;
6
+ };
@@ -0,0 +1,2 @@
1
+ import type { Handler } from '../types.ts';
2
+ export declare function notFound(path?: string): Handler;
@@ -0,0 +1,3 @@
1
+ import type { Handler } from '../types.ts';
2
+ export declare function ssr(path: string): Handler;
3
+ export declare function ssrBundleHandler(): Handler;
@@ -0,0 +1,14 @@
1
+ import type { Context } from '../types.ts';
2
+ export interface StreamOpts {
3
+ ctx: Context;
4
+ base: string;
5
+ compiledTailwindCss?: string;
6
+ isDev: boolean;
7
+ status?: number;
8
+ bundle?: {
9
+ url: string;
10
+ } | null;
11
+ loaderData?: Record<string, unknown>;
12
+ }
13
+ export declare function readStream(stream: ReadableStream): Promise<string>;
14
+ export declare function streamResponse(reactStream: ReadableStream, opts: StreamOpts): Response;
@@ -0,0 +1,2 @@
1
+ import type { Middleware } from '../types.ts';
2
+ export declare function tailwind(cssPath: string, scanDir?: string): Middleware;
package/dist/types.d.ts CHANGED
@@ -8,6 +8,11 @@ export interface Context {
8
8
  setPref?: (name: string, value: string) => Response;
9
9
  prefs?: Record<string, string>;
10
10
  env?: Record<string, string>;
11
+ layoutStack?: {
12
+ path: string;
13
+ component: any;
14
+ }[];
15
+ [key: string]: unknown;
11
16
  }
12
17
  export type Handler = (req: Request, ctx: Context) => Response | Promise<Response>;
13
18
  export type Middleware = (req: Request, ctx: Context, next: Handler) => Response | Promise<Response>;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "weifuwu",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "description": "Web-standard HTTP framework for Node.js — (req, ctx) => Response",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "exports": {
8
8
  ".": "./dist/index.js",
9
- "./react": "./dist/react.js"
9
+ "./react": "./dist/react.js",
10
+ "./ssr": "./dist/ssr/index.js"
10
11
  },
11
12
  "bin": {
12
13
  "weifuwu": "dist/cli.js"
@@ -18,7 +19,7 @@
18
19
  "LICENSE"
19
20
  ],
20
21
  "scripts": {
21
- "build": "esbuild index.ts --bundle --format=esm --platform=node --outfile=dist/index.js --packages=external && esbuild cli.ts --bundle --format=esm --platform=node --outfile=dist/cli.js --packages=external && esbuild react.ts --bundle --format=esm --outfile=dist/react.js --external:react --external:react-dom",
22
+ "build": "esbuild index.ts --bundle --format=esm --platform=node --outfile=dist/index.js --packages=external && esbuild cli.ts --bundle --format=esm --platform=node --outfile=dist/cli.js --packages=external && esbuild react.ts --bundle --format=esm --outfile=dist/react.js --external:react --external:react-dom && esbuild ssr/index.ts --bundle --format=esm --platform=node --outfile=dist/ssr/index.js --packages=external",
22
23
  "prepublishOnly": "npm run build && tsc --emitDeclarationOnly --outdir dist",
23
24
  "test": "node --test 'test/**/*.test.ts'"
24
25
  },