weifuwu 0.19.2 → 0.19.5

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.
@@ -1,11 +1,7 @@
1
- import { join } from 'node:path'
2
- import { loadEnv, serve, liveReload } from '../../index.ts'
1
+ import { loadEnv, serve } from '../../index.ts'
3
2
  import { app } from './app.ts'
4
3
 
5
4
  loadEnv()
6
- if (process.env.NODE_ENV !== 'production') {
7
- app.use(liveReload({ dirs: [join(import.meta.dirname, 'ui')] }))
8
- }
9
5
  const port = Number(process.env.PORT) || 3000
10
6
  const server = serve(app.handler(), { port, websocket: app.websocketHandler() })
11
7
  await server.ready
package/cli.ts CHANGED
@@ -46,8 +46,7 @@ async function cmdInit(name: string) {
46
46
  .replace(/const _ui = join\(import\.meta\.dirname, 'ui'\)\n/gm, '')
47
47
  .replace(/const _loc = join\(import\.meta\.dirname, 'locales'\)\n\n/, '')
48
48
  .replace(/preferences\(\{ dir: _loc, locale: \{ default: 'en' \}, theme: \{ default: 'system' \} \}\)/g, "preferences({ dir: './locales' })")
49
- .replace(/tailwind\(_ui\)/g, "tailwind('./ui')")
50
- .replace(/layout\(join\(_ui, 'layout\.tsx'\)\)/g, "layout('./ui/layout.tsx')")
49
+ .replace(/rootLayout\(_ui\)/g, "rootLayout('./ui')")
51
50
  .replace(/ssr\(join\(_ui, 'page\.tsx'\)\)/g, "ssr('./ui/page.tsx')")
52
51
  .replace(/join\(import\.meta\.dirname, 'ui'\)/g, "'./ui'")
53
52
  await writeFile(fp, content)
package/dist/cli.js CHANGED
@@ -31,7 +31,7 @@ async function cmdInit(name) {
31
31
  for (const file of ["app.ts", "index.ts", "ui/page.tsx"]) {
32
32
  const fp = join(targetDir, file);
33
33
  let content = await readFile(fp, "utf-8");
34
- content = content.replace(/from '\.\.\/\.\.\/index\.ts'/g, "from 'weifuwu'").replace(/from '\.\.\/\.\.\/\.\.\/react\.ts'/g, "from 'weifuwu/react'").replace(/import \{ join \} from 'node:path'\n/gm, "").replace(/const _ui = join\(import\.meta\.dirname, 'ui'\)\n/gm, "").replace(/const _loc = join\(import\.meta\.dirname, 'locales'\)\n\n/, "").replace(/preferences\(\{ dir: _loc, locale: \{ default: 'en' \}, theme: \{ default: 'system' \} \}\)/g, "preferences({ dir: './locales' })").replace(/tailwind\(_ui\)/g, "tailwind('./ui')").replace(/layout\(join\(_ui, 'layout\.tsx'\)\)/g, "layout('./ui/layout.tsx')").replace(/ssr\(join\(_ui, 'page\.tsx'\)\)/g, "ssr('./ui/page.tsx')").replace(/join\(import\.meta\.dirname, 'ui'\)/g, "'./ui'");
34
+ content = content.replace(/from '\.\.\/\.\.\/index\.ts'/g, "from 'weifuwu'").replace(/from '\.\.\/\.\.\/\.\.\/react\.ts'/g, "from 'weifuwu/react'").replace(/import \{ join \} from 'node:path'\n/gm, "").replace(/const _ui = join\(import\.meta\.dirname, 'ui'\)\n/gm, "").replace(/const _loc = join\(import\.meta\.dirname, 'locales'\)\n\n/, "").replace(/preferences\(\{ dir: _loc, locale: \{ default: 'en' \}, theme: \{ default: 'system' \} \}\)/g, "preferences({ dir: './locales' })").replace(/rootLayout\(_ui\)/g, "rootLayout('./ui')").replace(/ssr\(join\(_ui, 'page\.tsx'\)\)/g, "ssr('./ui/page.tsx')").replace(/join\(import\.meta\.dirname, 'ui'\)/g, "'./ui'");
35
35
  await writeFile(fp, content);
36
36
  }
37
37
  await writeFile(join(targetDir, "package.json"), JSON.stringify({
package/dist/compile.d.ts CHANGED
@@ -3,6 +3,8 @@ export declare function clearCompileCache(): void;
3
3
  export declare function compileTsx(path: string): Promise<any>;
4
4
  /** Dev hot-reload: CJS + in-memory + vm (faster than ESM + disk + import) */
5
5
  export declare function compileTsxDev(path: string): Promise<any>;
6
+ /** Auto-select dev (vm) or prod (ESM + import) compilation */
7
+ export declare function compile(path: string): Promise<any>;
6
8
  /** Build a single vendor bundle containing all needed vendor modules */
7
9
  export declare function compileVendorBundle(): Promise<string>;
8
10
  /** Hot-reload: ESM bundle, calls __WFW_REFRESH on import */
@@ -2,35 +2,26 @@ import type { IncomingMessage } from 'node:http';
2
2
  import type { Duplex } from 'node:stream';
3
3
  import type { Handler } from '../types.ts';
4
4
  export interface DeployConfig {
5
- domain: string;
5
+ domain?: string;
6
6
  port?: number;
7
- ssl?: {
8
- email: string;
9
- staging?: boolean;
10
- };
11
7
  deployToken?: string;
12
- webhookSecret?: string;
13
- appsDir?: string;
14
8
  defaultApp?: string;
15
9
  apps: Record<string, AppConfig>;
16
10
  }
17
11
  export interface AppConfig {
18
- repo: string;
19
- branch?: string;
20
- subdomain?: string;
12
+ dir?: string;
13
+ port?: number;
14
+ entry?: string;
21
15
  path?: string;
22
- port: number;
23
- ports?: [number, number];
24
- entry: string;
25
16
  env?: Record<string, string>;
26
17
  healthEndpoint?: string;
27
18
  buildCommand?: string;
19
+ ports?: [number, number];
28
20
  }
29
21
  export interface AppStatus {
30
22
  name: string;
31
23
  status: 'starting' | 'running' | 'stopped' | 'error';
32
24
  port: number;
33
- subdomain?: string;
34
25
  path?: string;
35
26
  pid?: number;
36
27
  uptime?: number;
package/dist/index.d.ts CHANGED
@@ -68,9 +68,8 @@ export type { LogdbOptions, LogdbModule, LogEntry, LogEntryInput, } from './logd
68
68
  export { iii, createWorker, registerWorker } from './iii/index.ts';
69
69
  export type { IIIModule, IIIOptions, WorkerInfo, FunctionInfo, TriggerInfo, FunctionHandler, FunctionContext, TriggerInput, RemoteWorker, TriggerRequest, } from './iii/types.ts';
70
70
  export { ssr } from './ssr.ts';
71
+ export { rootLayout } from './root-layout.ts';
71
72
  export { layout } from './layout.ts';
72
- export { liveReload } from './live.ts';
73
- export { tailwind } from './tailwind.ts';
74
73
  export { notFound } from './not-found.ts';
75
74
  export { errorBoundary } from './error-boundary.ts';
76
75
  export { clearCompileCache } from './compile.ts';