wexts 4.0.0 → 4.1.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.
- package/README.md +49 -49
- package/bin/wexts.cjs +2 -2
- package/package.json +153 -148
- package/templates/.dockerignore +43 -43
- package/templates/.env.example +17 -17
- package/templates/Dockerfile +60 -60
- package/templates/Procfile +1 -1
- package/templates/README.md +67 -67
- package/templates/api-sdk.ts +115 -115
- package/templates/docker-compose.yml +34 -34
- package/templates/nestjs-api/.env.example +3 -3
- package/templates/nestjs-api/README.md +87 -87
- package/templates/nestjs-api/nest-cli.json +6 -6
- package/templates/nestjs-api/package.json +40 -40
- package/templates/nestjs-api/prisma/migrations/20251123205437_init/migration.sql +24 -24
- package/templates/nestjs-api/prisma/migrations/migration_lock.toml +3 -3
- package/templates/nestjs-api/prisma/schema.prisma +29 -29
- package/templates/nestjs-api/src/app.module.ts +17 -17
- package/templates/nestjs-api/src/auth/auth.controller.ts +27 -27
- package/templates/nestjs-api/src/auth/auth.module.ts +37 -37
- package/templates/nestjs-api/src/auth/auth.service.ts +86 -86
- package/templates/nestjs-api/src/auth/dto/auth.dto.ts +22 -22
- package/templates/nestjs-api/src/auth/guards/jwt-auth.guard.ts +5 -5
- package/templates/nestjs-api/src/auth/strategies/jwt.strategy.ts +27 -27
- package/templates/nestjs-api/src/main.ts +32 -32
- package/templates/nestjs-api/src/prisma/prisma.module.ts +9 -9
- package/templates/nestjs-api/src/prisma/prisma.service.ts +14 -14
- package/templates/nestjs-api/src/todos/dto/todo.dto.ts +24 -24
- package/templates/nestjs-api/src/todos/todos.controller.ts +39 -39
- package/templates/nestjs-api/src/todos/todos.module.ts +11 -11
- package/templates/nestjs-api/src/todos/todos.service.ts +53 -53
- package/templates/nestjs-api/src/users/users.controller.ts +14 -14
- package/templates/nestjs-api/src/users/users.module.ts +12 -12
- package/templates/nestjs-api/src/users/users.service.ts +19 -19
- package/templates/nestjs-api/tsconfig.json +39 -39
- package/templates/nextjs-web/README.md +76 -76
- package/templates/nextjs-web/app/actions/auth.ts +108 -108
- package/templates/nextjs-web/app/dashboard/error.tsx +39 -39
- package/templates/nextjs-web/app/dashboard/loading.tsx +14 -14
- package/templates/nextjs-web/app/dashboard/page.tsx +5 -5
- package/templates/nextjs-web/app/globals.css +93 -93
- package/templates/nextjs-web/app/layout.tsx +29 -29
- package/templates/nextjs-web/app/login/page.tsx +5 -5
- package/templates/nextjs-web/app/page.tsx +28 -28
- package/templates/nextjs-web/app/register/page.tsx +5 -5
- package/templates/nextjs-web/components/ui/button.tsx +56 -56
- package/templates/nextjs-web/components/ui/card.tsx +79 -79
- package/templates/nextjs-web/components/ui/input.tsx +25 -25
- package/templates/nextjs-web/components/ui/label.tsx +24 -24
- package/templates/nextjs-web/features/auth/LoginForm.tsx +140 -140
- package/templates/nextjs-web/features/auth/RegisterForm.tsx +159 -159
- package/templates/nextjs-web/features/auth/api.ts +35 -35
- package/templates/nextjs-web/features/auth/index.ts +3 -3
- package/templates/nextjs-web/features/dashboard/DashboardView.tsx +204 -204
- package/templates/nextjs-web/features/dashboard/api.ts +9 -9
- package/templates/nextjs-web/features/dashboard/components.tsx +74 -74
- package/templates/nextjs-web/features/dashboard/index.ts +3 -3
- package/templates/nextjs-web/hooks/index.ts +4 -4
- package/templates/nextjs-web/lib/api-client.ts +89 -89
- package/templates/nextjs-web/lib/api.ts +115 -115
- package/templates/nextjs-web/lib/axios-global-config.ts +17 -17
- package/templates/nextjs-web/lib/utils.ts +6 -6
- package/templates/nextjs-web/lib/wexts-client.ts +4 -4
- package/templates/nextjs-web/next-env.d.ts +6 -6
- package/templates/nextjs-web/next.config.ts +20 -20
- package/templates/nextjs-web/package.json +37 -37
- package/templates/nextjs-web/postcss.config.js +6 -6
- package/templates/nextjs-web/tailwind.config.ts +69 -69
- package/templates/nextjs-web/tsconfig.json +41 -41
- package/templates/nixpacks.toml +11 -11
- package/templates/root-package.json +31 -31
- package/templates/server.ts +66 -66
- package/templates/tsconfig.json +30 -30
- package/dist/chunk-2KAQYLVN.js +0 -1
- package/dist/chunk-2KAQYLVN.js.map +0 -1
- package/dist/chunk-2LJVUMXW.js +0 -228
- package/dist/chunk-2LJVUMXW.js.map +0 -1
- package/dist/chunk-7QKLIVRF.js +0 -94
- package/dist/chunk-7QKLIVRF.js.map +0 -1
- package/dist/chunk-7WULUGLH.mjs +0 -22
- package/dist/chunk-7WULUGLH.mjs.map +0 -1
- package/dist/chunk-BG56B4DE.js +0 -106
- package/dist/chunk-BG56B4DE.js.map +0 -1
- package/dist/chunk-CLM5PNSG.mjs +0 -496
- package/dist/chunk-CLM5PNSG.mjs.map +0 -1
- package/dist/chunk-DNLGCKTT.js +0 -31
- package/dist/chunk-DNLGCKTT.js.map +0 -1
- package/dist/chunk-JHOVXH3X.mjs +0 -65
- package/dist/chunk-JHOVXH3X.mjs.map +0 -1
- package/dist/chunk-MXINIFPC.js +0 -105
- package/dist/chunk-MXINIFPC.js.map +0 -1
- package/dist/chunk-SE32ZPOZ.js +0 -496
- package/dist/chunk-SE32ZPOZ.js.map +0 -1
- package/dist/chunk-UAL54DVV.mjs +0 -106
- package/dist/chunk-UAL54DVV.mjs.map +0 -1
- package/dist/chunk-WCKSKU3C.js +0 -65
- package/dist/chunk-WCKSKU3C.js.map +0 -1
- package/dist/chunk-WU6FW77M.mjs +0 -105
- package/dist/chunk-WU6FW77M.mjs.map +0 -1
- package/dist/chunk-XE4OXN2W.js +0 -12
- package/dist/chunk-XE4OXN2W.js.map +0 -1
- package/dist/chunk-YBM3IJEA.mjs +0 -94
- package/dist/chunk-YBM3IJEA.mjs.map +0 -1
- package/dist/chunk-YN6WIWNQ.mjs +0 -228
- package/dist/chunk-YN6WIWNQ.mjs.map +0 -1
- package/dist/chunk-YSLEF5C5.mjs +0 -1
- package/dist/chunk-YSLEF5C5.mjs.map +0 -1
- package/dist/chunk-ZX7QIN24.mjs +0 -31
- package/dist/chunk-ZX7QIN24.mjs.map +0 -1
- package/dist/cli/index.d.mts +0 -11
- package/dist/cli/index.d.ts +0 -11
- package/dist/cli/index.js +0 -332
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/index.mjs +0 -334
- package/dist/cli/index.mjs.map +0 -1
- package/dist/client/index.d.mts +0 -21
- package/dist/client/index.d.ts +0 -21
- package/dist/client/index.js +0 -12
- package/dist/client/index.js.map +0 -1
- package/dist/client/index.mjs +0 -12
- package/dist/client/index.mjs.map +0 -1
- package/dist/codegen/index.d.mts +0 -2
- package/dist/codegen/index.d.ts +0 -2
- package/dist/codegen/index.js +0 -15
- package/dist/codegen/index.js.map +0 -1
- package/dist/codegen/index.mjs +0 -15
- package/dist/codegen/index.mjs.map +0 -1
- package/dist/decorators-BT1FFqN0.d.mts +0 -29
- package/dist/decorators-DvS58PqC.d.ts +0 -29
- package/dist/dev-server/index.d.mts +0 -1
- package/dist/dev-server/index.d.ts +0 -1
- package/dist/dev-server/index.js +0 -13
- package/dist/dev-server/index.js.map +0 -1
- package/dist/dev-server/index.mjs +0 -13
- package/dist/dev-server/index.mjs.map +0 -1
- package/dist/index-7QeQEf37.d.ts +0 -92
- package/dist/index-7RvU-jGE.d.mts +0 -66
- package/dist/index-7RvU-jGE.d.ts +0 -66
- package/dist/index-8nzxy0NN.d.mts +0 -92
- package/dist/index-Co5ZsLqq.d.ts +0 -58
- package/dist/index-D94W1__r.d.mts +0 -58
- package/dist/index-DQmyVp6F.d.mts +0 -27
- package/dist/index-KL_1BrQb.d.ts +0 -27
- package/dist/index.d.mts +0 -258
- package/dist/index.d.ts +0 -258
- package/dist/index.js +0 -410
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -410
- package/dist/index.mjs.map +0 -1
- package/dist/nest/index.d.mts +0 -3
- package/dist/nest/index.d.ts +0 -3
- package/dist/nest/index.js +0 -38
- package/dist/nest/index.js.map +0 -1
- package/dist/nest/index.mjs +0 -38
- package/dist/nest/index.mjs.map +0 -1
- package/dist/next/index.d.mts +0 -66
- package/dist/next/index.d.ts +0 -66
- package/dist/next/index.js +0 -226
- package/dist/next/index.js.map +0 -1
- package/dist/next/index.mjs +0 -188
- package/dist/next/index.mjs.map +0 -1
- package/dist/rpc/index.d.mts +0 -2
- package/dist/rpc/index.d.ts +0 -2
- package/dist/rpc/index.js +0 -23
- package/dist/rpc/index.js.map +0 -1
- package/dist/rpc/index.mjs +0 -23
- package/dist/rpc/index.mjs.map +0 -1
- package/dist/runtime/index.d.mts +0 -55
- package/dist/runtime/index.d.ts +0 -55
- package/dist/runtime/index.js +0 -213
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/index.mjs +0 -213
- package/dist/runtime/index.mjs.map +0 -1
- package/dist/types/index.d.mts +0 -12
- package/dist/types/index.d.ts +0 -12
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -3
- package/dist/types/index.mjs.map +0 -1
- package/dist/types-7d_fC-C3.d.mts +0 -32
- package/dist/types-7d_fC-C3.d.ts +0 -32
- package/dist/vercel-builder/index.d.mts +0 -58
- package/dist/vercel-builder/index.d.ts +0 -58
- package/dist/vercel-builder/index.js +0 -330
- package/dist/vercel-builder/index.js.map +0 -1
- package/dist/vercel-builder/index.mjs +0 -330
- package/dist/vercel-builder/index.mjs.map +0 -1
- package/templates/nestjs-api/package-lock.json +0 -5623
- package/templates/nextjs-web/package-lock.json +0 -3254
package/dist/chunk-YN6WIWNQ.mjs
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
logger
|
|
3
|
-
} from "./chunk-JHOVXH3X.mjs";
|
|
4
|
-
import {
|
|
5
|
-
__export,
|
|
6
|
-
__name
|
|
7
|
-
} from "./chunk-7WULUGLH.mjs";
|
|
8
|
-
|
|
9
|
-
// src/dev-server/index.ts
|
|
10
|
-
var dev_server_exports = {};
|
|
11
|
-
__export(dev_server_exports, {
|
|
12
|
-
FusionDevServer: () => FusionDevServer,
|
|
13
|
-
ProcessRunner: () => ProcessRunner,
|
|
14
|
-
ProxyServer: () => ProxyServer
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// src/dev-server/process-runner.ts
|
|
18
|
-
import { spawn } from "child_process";
|
|
19
|
-
import * as pc from "picocolors";
|
|
20
|
-
var ProcessRunner = class {
|
|
21
|
-
static {
|
|
22
|
-
__name(this, "ProcessRunner");
|
|
23
|
-
}
|
|
24
|
-
processes = /* @__PURE__ */ new Map();
|
|
25
|
-
colors = {
|
|
26
|
-
cyan: pc.cyan,
|
|
27
|
-
green: pc.green,
|
|
28
|
-
yellow: pc.yellow,
|
|
29
|
-
magenta: pc.magenta,
|
|
30
|
-
blue: pc.blue
|
|
31
|
-
};
|
|
32
|
-
async run(configs) {
|
|
33
|
-
logger.info("\u{1F680} Starting development servers...\n");
|
|
34
|
-
for (const config of configs) {
|
|
35
|
-
this.startProcess(config);
|
|
36
|
-
}
|
|
37
|
-
process.on("SIGINT", () => this.stopAll());
|
|
38
|
-
process.on("SIGTERM", () => this.stopAll());
|
|
39
|
-
}
|
|
40
|
-
startProcess(config) {
|
|
41
|
-
const { name, command, args, cwd, color, env } = config;
|
|
42
|
-
const colorFn = this.colors[color];
|
|
43
|
-
const prefix = colorFn(`[${name}]`);
|
|
44
|
-
logger.info(`${prefix} Starting...`);
|
|
45
|
-
const proc = spawn(command, args, {
|
|
46
|
-
cwd,
|
|
47
|
-
stdio: "pipe",
|
|
48
|
-
shell: true,
|
|
49
|
-
env: {
|
|
50
|
-
...process.env,
|
|
51
|
-
...env
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
this.processes.set(name, proc);
|
|
55
|
-
proc.stdout?.on("data", (data) => {
|
|
56
|
-
const lines = data.toString().split("\n").filter((l) => l.trim());
|
|
57
|
-
lines.forEach((line) => {
|
|
58
|
-
console.log(`${prefix} ${line}`);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
proc.stderr?.on("data", (data) => {
|
|
62
|
-
const lines = data.toString().split("\n").filter((l) => l.trim());
|
|
63
|
-
lines.forEach((line) => {
|
|
64
|
-
console.error(`${prefix} ${pc.red(line)}`);
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
proc.on("exit", (code) => {
|
|
68
|
-
if (code !== 0 && code !== null) {
|
|
69
|
-
logger.error(`${prefix} Exited with code ${code}`);
|
|
70
|
-
}
|
|
71
|
-
this.processes.delete(name);
|
|
72
|
-
});
|
|
73
|
-
proc.on("error", (error) => {
|
|
74
|
-
logger.error(`${prefix} Error:`, error.message);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
stopAll() {
|
|
78
|
-
logger.info("\n\u{1F6D1} Stopping all processes...");
|
|
79
|
-
for (const [name, proc] of this.processes.entries()) {
|
|
80
|
-
logger.info(`Stopping ${name}...`);
|
|
81
|
-
proc.kill("SIGTERM");
|
|
82
|
-
}
|
|
83
|
-
setTimeout(() => {
|
|
84
|
-
process.exit(0);
|
|
85
|
-
}, 1e3);
|
|
86
|
-
}
|
|
87
|
-
isRunning(name) {
|
|
88
|
-
return this.processes.has(name);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
// src/dev-server/dev-server.ts
|
|
93
|
-
import * as path from "path";
|
|
94
|
-
import * as fs from "fs";
|
|
95
|
-
var FusionDevServer = class {
|
|
96
|
-
static {
|
|
97
|
-
__name(this, "FusionDevServer");
|
|
98
|
-
}
|
|
99
|
-
processRunner;
|
|
100
|
-
constructor() {
|
|
101
|
-
this.processRunner = new ProcessRunner();
|
|
102
|
-
}
|
|
103
|
-
async start(config) {
|
|
104
|
-
const { apiPath, webPath, webPort = 3e3, apiPort = 5050, useProxy = false } = config;
|
|
105
|
-
if (useProxy) {
|
|
106
|
-
throw new Error("The legacy dev proxy is disabled because it conflicts with the Next.js port. Use the production runtime for single-port serving.");
|
|
107
|
-
}
|
|
108
|
-
if (!fs.existsSync(apiPath)) {
|
|
109
|
-
throw new Error(`API path not found: ${apiPath}`);
|
|
110
|
-
}
|
|
111
|
-
if (!fs.existsSync(webPath)) {
|
|
112
|
-
throw new Error(`Web path not found: ${webPath}`);
|
|
113
|
-
}
|
|
114
|
-
const processes = [];
|
|
115
|
-
processes.push({
|
|
116
|
-
name: "API",
|
|
117
|
-
command: "npm",
|
|
118
|
-
args: [
|
|
119
|
-
"run",
|
|
120
|
-
"start:dev"
|
|
121
|
-
],
|
|
122
|
-
cwd: path.resolve(apiPath),
|
|
123
|
-
color: "cyan",
|
|
124
|
-
env: {
|
|
125
|
-
PORT: apiPort.toString()
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
processes.push({
|
|
129
|
-
name: "Web",
|
|
130
|
-
command: "npm",
|
|
131
|
-
args: [
|
|
132
|
-
"run",
|
|
133
|
-
"dev",
|
|
134
|
-
"--",
|
|
135
|
-
"-p",
|
|
136
|
-
webPort.toString()
|
|
137
|
-
],
|
|
138
|
-
cwd: path.resolve(webPath),
|
|
139
|
-
color: "green",
|
|
140
|
-
env: {
|
|
141
|
-
NEXT_PUBLIC_API_URL: `http://localhost:${apiPort}`
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
await this.processRunner.run(processes);
|
|
145
|
-
logger.info("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
|
|
146
|
-
logger.info("\u2551 Fusion Development Server Ready \u2551");
|
|
147
|
-
logger.info("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n");
|
|
148
|
-
logger.info(`\u{1F310} Web: http://localhost:${webPort}`);
|
|
149
|
-
logger.info(`\u{1F50C} API: http://localhost:${apiPort}`);
|
|
150
|
-
logger.info("\n");
|
|
151
|
-
}
|
|
152
|
-
stop() {
|
|
153
|
-
this.processRunner.stopAll();
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
// src/dev-server/proxy.ts
|
|
158
|
-
import http from "http";
|
|
159
|
-
import httpProxy from "http-proxy";
|
|
160
|
-
import * as pc2 from "picocolors";
|
|
161
|
-
var ProxyServer = class {
|
|
162
|
-
static {
|
|
163
|
-
__name(this, "ProxyServer");
|
|
164
|
-
}
|
|
165
|
-
server = null;
|
|
166
|
-
proxy = null;
|
|
167
|
-
async start(config) {
|
|
168
|
-
const { port, apiTarget, apiPrefix } = config;
|
|
169
|
-
this.proxy = httpProxy.createProxyServer({
|
|
170
|
-
target: apiTarget,
|
|
171
|
-
changeOrigin: true,
|
|
172
|
-
ws: true
|
|
173
|
-
});
|
|
174
|
-
this.proxy.on("error", (err, req, res) => {
|
|
175
|
-
logger.error("Proxy error:", err.message);
|
|
176
|
-
if (res && "headersSent" in res && !res.headersSent) {
|
|
177
|
-
res.writeHead(502, {
|
|
178
|
-
"Content-Type": "text/plain"
|
|
179
|
-
});
|
|
180
|
-
res.end("Bad Gateway - API server unavailable");
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
this.server = http.createServer((req, res) => {
|
|
184
|
-
if (req.url?.startsWith(apiPrefix)) {
|
|
185
|
-
const newUrl = req.url.substring(apiPrefix.length) || "/";
|
|
186
|
-
req.url = newUrl;
|
|
187
|
-
logger.info(pc2.gray(`\u2192 ${req.method} ${apiPrefix}${newUrl}`));
|
|
188
|
-
this.proxy.web(req, res);
|
|
189
|
-
} else {
|
|
190
|
-
res.writeHead(404);
|
|
191
|
-
res.end("Not Found");
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
this.server.on("upgrade", (req, socket, head) => {
|
|
195
|
-
if (req.url?.startsWith(apiPrefix)) {
|
|
196
|
-
const newUrl = req.url.substring(apiPrefix.length) || "/";
|
|
197
|
-
req.url = newUrl;
|
|
198
|
-
this.proxy.ws(req, socket, head);
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
return new Promise((resolve2) => {
|
|
202
|
-
this.server.listen(port, () => {
|
|
203
|
-
logger.success(`\u2705 Proxy server running on port ${port}`);
|
|
204
|
-
logger.info(` Forwarding ${pc2.cyan(apiPrefix + "/*")} \u2192 ${pc2.cyan(apiTarget)}
|
|
205
|
-
`);
|
|
206
|
-
resolve2();
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
stop() {
|
|
211
|
-
if (this.server) {
|
|
212
|
-
this.server.close();
|
|
213
|
-
this.server = null;
|
|
214
|
-
}
|
|
215
|
-
if (this.proxy) {
|
|
216
|
-
this.proxy.close();
|
|
217
|
-
this.proxy = null;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
export {
|
|
223
|
-
ProcessRunner,
|
|
224
|
-
FusionDevServer,
|
|
225
|
-
ProxyServer,
|
|
226
|
-
dev_server_exports
|
|
227
|
-
};
|
|
228
|
-
//# sourceMappingURL=chunk-YN6WIWNQ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev-server/index.ts","../src/dev-server/process-runner.ts","../src/dev-server/dev-server.ts","../src/dev-server/proxy.ts"],"sourcesContent":["export * from './dev-server';\nexport * from './process-runner';\nexport * from './proxy';\n","import { spawn, ChildProcess } from 'child_process';\nimport { logger } from '../core/logger';\nimport * as pc from 'picocolors';\n\nexport interface ProcessConfig {\n name: string;\n command: string;\n args: string[];\n cwd: string;\n color: 'cyan' | 'green' | 'yellow' | 'magenta' | 'blue';\n env?: Record<string, string>;\n}\n\n/**\n * Run multiple processes concurrently with colored output\n */\nexport class ProcessRunner {\n private processes: Map<string, ChildProcess> = new Map();\n private colors = {\n cyan: pc.cyan,\n green: pc.green,\n yellow: pc.yellow,\n magenta: pc.magenta,\n blue: pc.blue,\n };\n\n async run(configs: ProcessConfig[]): Promise<void> {\n logger.info('🚀 Starting development servers...\\n');\n\n for (const config of configs) {\n this.startProcess(config);\n }\n\n // Handle graceful shutdown\n process.on('SIGINT', () => this.stopAll());\n process.on('SIGTERM', () => this.stopAll());\n }\n\n private startProcess(config: ProcessConfig): void {\n const { name, command, args, cwd, color, env } = config;\n\n const colorFn = this.colors[color];\n const prefix = colorFn(`[${name}]`);\n\n logger.info(`${prefix} Starting...`);\n\n const proc = spawn(command, args, {\n cwd,\n stdio: 'pipe',\n shell: true,\n env: { ...process.env, ...env },\n });\n\n this.processes.set(name, proc);\n\n // Handle stdout\n proc.stdout?.on('data', (data) => {\n const lines = data.toString().split('\\n').filter((l: string) => l.trim());\n lines.forEach((line: string) => {\n console.log(`${prefix} ${line}`);\n });\n });\n\n // Handle stderr\n proc.stderr?.on('data', (data) => {\n const lines = data.toString().split('\\n').filter((l: string) => l.trim());\n lines.forEach((line: string) => {\n console.error(`${prefix} ${pc.red(line)}`);\n });\n });\n\n // Handle exit\n proc.on('exit', (code) => {\n if (code !== 0 && code !== null) {\n logger.error(`${prefix} Exited with code ${code}`);\n }\n this.processes.delete(name);\n });\n\n // Handle errors\n proc.on('error', (error) => {\n logger.error(`${prefix} Error:`, error.message);\n });\n }\n\n stopAll(): void {\n logger.info('\\n🛑 Stopping all processes...');\n\n for (const [name, proc] of this.processes.entries()) {\n logger.info(`Stopping ${name}...`);\n proc.kill('SIGTERM');\n }\n\n setTimeout(() => {\n process.exit(0);\n }, 1000);\n }\n\n isRunning(name: string): boolean {\n return this.processes.has(name);\n }\n}\n","import { ProcessRunner, ProcessConfig } from './process-runner';\nimport { logger } from '../core/logger';\nimport * as path from 'path';\nimport * as fs from 'fs';\n\nexport interface DevServerConfig {\n apiPath: string;\n webPath: string;\n webPort?: number;\n apiPort?: number;\n useProxy?: boolean;\n}\n\n/**\n * Unified development server for Fusion projects\n */\nexport class FusionDevServer {\n private processRunner: ProcessRunner;\n\n constructor() {\n this.processRunner = new ProcessRunner();\n }\n\n async start(config: DevServerConfig): Promise<void> {\n const {\n apiPath,\n webPath,\n webPort = 3000,\n apiPort = 5050,\n useProxy = false,\n } = config;\n\n if (useProxy) {\n throw new Error('The legacy dev proxy is disabled because it conflicts with the Next.js port. Use the production runtime for single-port serving.');\n }\n\n // Validate paths\n if (!fs.existsSync(apiPath)) {\n throw new Error(`API path not found: ${apiPath}`);\n }\n if (!fs.existsSync(webPath)) {\n throw new Error(`Web path not found: ${webPath}`);\n }\n\n const processes: ProcessConfig[] = [];\n\n // Add API server\n processes.push({\n name: 'API',\n command: 'npm',\n args: ['run', 'start:dev'],\n cwd: path.resolve(apiPath),\n color: 'cyan',\n env: {\n PORT: apiPort.toString(),\n },\n });\n\n // Add Web server\n processes.push({\n name: 'Web',\n command: 'npm',\n args: ['run', 'dev', '--', '-p', webPort.toString()],\n cwd: path.resolve(webPath),\n color: 'green',\n env: {\n NEXT_PUBLIC_API_URL: `http://localhost:${apiPort}`,\n },\n });\n\n // Start processes\n await this.processRunner.run(processes);\n\n // Log info\n logger.info('╔═══════════════════════════════════════╗');\n logger.info('║ Fusion Development Server Ready ║');\n logger.info('╚═══════════════════════════════════════╝\\n');\n logger.info(`🌐 Web: http://localhost:${webPort}`);\n logger.info(`🔌 API: http://localhost:${apiPort}`);\n logger.info('\\n');\n }\n\n stop(): void {\n this.processRunner.stopAll();\n }\n}\n","import http from 'http';\nimport httpProxy from 'http-proxy';\nimport { logger } from '../core/logger';\nimport * as pc from 'picocolors';\n\nexport interface ProxyConfig {\n port: number;\n apiTarget: string;\n apiPrefix: string;\n}\n\n/**\n * Proxy server to forward API requests from Next.js to NestJS\n */\nexport class ProxyServer {\n private server: http.Server | null = null;\n private proxy: httpProxy | null = null;\n\n async start(config: ProxyConfig): Promise<void> {\n const { port, apiTarget, apiPrefix } = config;\n\n this.proxy = httpProxy.createProxyServer({\n target: apiTarget,\n changeOrigin: true,\n ws: true, // WebSocket support\n });\n\n // Handle proxy errors\n this.proxy.on('error', (err, req, res) => {\n logger.error('Proxy error:', err.message);\n if (res && 'headersSent' in res && !(res as any).headersSent) {\n (res as http.ServerResponse).writeHead(502, { 'Content-Type': 'text/plain' });\n (res as http.ServerResponse).end('Bad Gateway - API server unavailable');\n }\n });\n\n this.server = http.createServer((req, res) => {\n // Check if request is for API\n if (req.url?.startsWith(apiPrefix)) {\n // Remove prefix before forwarding\n const newUrl = req.url.substring(apiPrefix.length) || '/';\n req.url = newUrl;\n\n logger.info(pc.gray(`→ ${req.method} ${apiPrefix}${newUrl}`));\n this.proxy!.web(req, res);\n } else {\n // Not an API request - should not happen\n res.writeHead(404);\n res.end('Not Found');\n }\n });\n\n // Handle WebSocket upgrade\n this.server.on('upgrade', (req, socket, head) => {\n if (req.url?.startsWith(apiPrefix)) {\n const newUrl = req.url.substring(apiPrefix.length) || '/';\n req.url = newUrl;\n this.proxy!.ws(req, socket, head);\n }\n });\n\n return new Promise((resolve) => {\n this.server!.listen(port, () => {\n logger.success(`✅ Proxy server running on port ${port}`);\n logger.info(` Forwarding ${pc.cyan(apiPrefix + '/*')} → ${pc.cyan(apiTarget)}\\n`);\n resolve();\n });\n });\n }\n\n stop(): void {\n if (this.server) {\n this.server.close();\n this.server = null;\n }\n if (this.proxy) {\n this.proxy.close();\n this.proxy = null;\n }\n }\n}\n"],"mappings":";;;;;;;;;AAAA;;;;;;;;ACAA,SAASA,aAA2B;AAEpC,YAAYC,QAAQ;AAcb,IAAMC,gBAAN,MAAMA;EAhBb,OAgBaA;;;EACDC,YAAuC,oBAAIC,IAAAA;EAC3CC,SAAS;IACbC,MAASA;IACTC,OAAUA;IACVC,QAAWA;IACXC,SAAYA;IACZC,MAASA;EACb;EAEA,MAAMC,IAAIC,SAAyC;AAC/CC,WAAOC,KAAK,6CAAA;AAEZ,eAAWC,UAAUH,SAAS;AAC1B,WAAKI,aAAaD,MAAAA;IACtB;AAGAE,YAAQC,GAAG,UAAU,MAAM,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AIiB,MAAM,IAAIzB,SAAAA,GAAYoB,MAAAA,EAAQ,CAAA;AAC3D,aAAKzB,MAAO+B,IAAIlB,KAAKC,GAAAA;MACzB,OAAO;AAEHA,YAAIK,UAAU,GAAA;AACdL,YAAIM,IAAI,WAAA;MACZ;IACJ,CAAA;AAGA,SAAKrB,OAAOY,GAAG,WAAW,CAACE,KAAKmB,QAAQC,SAAAA;AACpC,UAAIpB,IAAIU,KAAKC,WAAWnB,SAAAA,GAAY;AAChC,cAAMoB,SAASZ,IAAIU,IAAIG,UAAUrB,UAAUsB,MAAM,KAAK;AACtDd,YAAIU,MAAME;AACV,aAAKzB,MAAOU,GAAGG,KAAKmB,QAAQC,IAAAA;MAChC;IACJ,CAAA;AAEA,WAAO,IAAIC,QAAQ,CAACC,aAAAA;AAChB,WAAKpC,OAAQqC,OAAOjC,MAAM,MAAA;AACtBY,eAAOsB,QAAQ,uCAAkClC,IAAAA,EAAM;AACvDY,eAAOa,KAAK,iBAAoBU,SAAKjC,YAAY,IAAA,CAAA,WAAciC,SAAKlC,SAAAA,CAAAA;CAAc;AAClF+B,QAAAA,SAAAA;MACJ,CAAA;IACJ,CAAA;EACJ;EAEAI,OAAa;AACT,QAAI,KAAKxC,QAAQ;AACb,WAAKA,OAAOyC,MAAK;AACjB,WAAKzC,SAAS;IAClB;AACA,QAAI,KAAKC,OAAO;AACZ,WAAKA,MAAMwC,MAAK;AAChB,WAAKxC,QAAQ;IACjB;EACJ;AACJ;","names":["spawn","pc","ProcessRunner","processes","Map","colors","cyan","green","yellow","magenta","blue","run","configs","logger","info","config","startProcess","process","on","stopAll","name","command","args","cwd","color","env","colorFn","prefix","proc","spawn","stdio","shell","set","stdout","data","lines","toString","split","filter","l","trim","forEach","line","console","log","stderr","error","red","code","delete","message","entries","kill","setTimeout","exit","isRunning","has","path","fs","FusionDevServer","processRunner","ProcessRunner","start","config","apiPath","webPath","webPort","apiPort","useProxy","Error","existsSync","processes","push","name","command","args","cwd","resolve","color","env","PORT","toString","NEXT_PUBLIC_API_URL","run","logger","info","stop","stopAll","http","httpProxy","pc","ProxyServer","server","proxy","start","config","port","apiTarget","apiPrefix","httpProxy","createProxyServer","target","changeOrigin","ws","on","err","req","res","logger","error","message","headersSent","writeHead","end","http","createServer","url","startsWith","newUrl","substring","length","info","gray","method","web","socket","head","Promise","resolve","listen","success","cyan","stop","close"]}
|
package/dist/chunk-YSLEF5C5.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-YSLEF5C5.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/chunk-ZX7QIN24.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RequireAuth,
|
|
3
|
-
RpcMethod,
|
|
4
|
-
RpcService,
|
|
5
|
-
WextsRpc,
|
|
6
|
-
WextsRpcService,
|
|
7
|
-
getRpcAuthPolicy,
|
|
8
|
-
getRuntimeRpcMethodsMetadata,
|
|
9
|
-
getRuntimeRpcServiceMetadata
|
|
10
|
-
} from "./chunk-YBM3IJEA.mjs";
|
|
11
|
-
import {
|
|
12
|
-
__export
|
|
13
|
-
} from "./chunk-7WULUGLH.mjs";
|
|
14
|
-
|
|
15
|
-
// src/rpc/index.ts
|
|
16
|
-
var rpc_exports = {};
|
|
17
|
-
__export(rpc_exports, {
|
|
18
|
-
RequireAuth: () => RequireAuth,
|
|
19
|
-
RpcMethod: () => RpcMethod,
|
|
20
|
-
RpcService: () => RpcService,
|
|
21
|
-
WextsRpc: () => WextsRpc,
|
|
22
|
-
WextsRpcService: () => WextsRpcService,
|
|
23
|
-
getRpcAuthPolicy: () => getRpcAuthPolicy,
|
|
24
|
-
getRuntimeRpcMethodsMetadata: () => getRuntimeRpcMethodsMetadata,
|
|
25
|
-
getRuntimeRpcServiceMetadata: () => getRuntimeRpcServiceMetadata
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export {
|
|
29
|
-
rpc_exports
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=chunk-ZX7QIN24.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rpc/index.ts"],"sourcesContent":["export * from './decorators';\nexport * from './types';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;","names":[]}
|
package/dist/cli/index.d.mts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
|
|
4
|
-
declare function createCliProgram(): Command;
|
|
5
|
-
interface DoctorResult {
|
|
6
|
-
errors: string[];
|
|
7
|
-
warnings: string[];
|
|
8
|
-
}
|
|
9
|
-
declare function runDoctor(cwd: string, security?: boolean): DoctorResult;
|
|
10
|
-
|
|
11
|
-
export { type DoctorResult, createCliProgram, runDoctor };
|
package/dist/cli/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
|
|
4
|
-
declare function createCliProgram(): Command;
|
|
5
|
-
interface DoctorResult {
|
|
6
|
-
errors: string[];
|
|
7
|
-
warnings: string[];
|
|
8
|
-
}
|
|
9
|
-
declare function runDoctor(cwd: string, security?: boolean): DoctorResult;
|
|
10
|
-
|
|
11
|
-
export { type DoctorResult, createCliProgram, runDoctor };
|
package/dist/cli/index.js
DELETED
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
3
|
-
|
|
4
|
-
var _chunkWCKSKU3Cjs = require('../chunk-WCKSKU3C.js');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkXE4OXN2Wjs = require('../chunk-XE4OXN2W.js');
|
|
8
|
-
|
|
9
|
-
// src/cli/index.ts
|
|
10
|
-
var _commander = require('commander');
|
|
11
|
-
var _fs = require('fs'); var fs = _interopRequireWildcard(_fs);
|
|
12
|
-
var _path = require('path'); var path = _interopRequireWildcard(_path);
|
|
13
|
-
var _child_process = require('child_process');
|
|
14
|
-
var _module = require('module');
|
|
15
|
-
function createCliProgram() {
|
|
16
|
-
const program = new (0, _commander.Command)();
|
|
17
|
-
program.name("wexts").description("Wexts - production-focused single-runtime Next.js + NestJS toolkit").version("3.0.3");
|
|
18
|
-
program.command("create <project-name>").description("Create a compatibility project from bundled legacy templates").option("-t, --template <template>", "Legacy template to use (monorepo|api|web)", "monorepo").option("--skip-install", "Skip dependency installation", false).action(async (projectName, options) => {
|
|
19
|
-
await createProject(projectName, options.template, {
|
|
20
|
-
skipInstall: options.skipInstall
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
program.command("dev").description("Start local development processes").option("-a, --api <path>", "Path to API project", "./apps/api").option("-w, --web <path>", "Path to Web project", "./apps/web").option("-p, --port <port>", "Port for web server", "3000").option("--api-port <port>", "Port for API server", "5050").option("--proxy", "Enable development proxy on a separate proxy port", false).action(async (options) => {
|
|
24
|
-
const { FusionDevServer } = await Promise.resolve().then(() => _interopRequireWildcard(require("../dev-server/index.js")));
|
|
25
|
-
const server = new FusionDevServer();
|
|
26
|
-
await server.start({
|
|
27
|
-
apiPath: options.api,
|
|
28
|
-
webPath: options.web,
|
|
29
|
-
webPort: Number(options.port),
|
|
30
|
-
apiPort: Number(options.apiPort),
|
|
31
|
-
useProxy: options.proxy
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
program.command("generate [type] [name]").alias("g").description("Generate RPC manifest/client, or scaffold a minimal RPC service").option("-p, --project <path>", "Path to NestJS project", "./apps/api").option("-o, --output <path>", "Output directory for generated RPC client", "./apps/web/lib/wexts").action(async (type, name, options) => {
|
|
35
|
-
if (!type || type === "rpc") {
|
|
36
|
-
const { generateRpcClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("../codegen/index.js")));
|
|
37
|
-
const manifest = await generateRpcClient({
|
|
38
|
-
projectPath: path.resolve(options.project),
|
|
39
|
-
outputPath: path.resolve(options.output)
|
|
40
|
-
});
|
|
41
|
-
_chunkWCKSKU3Cjs.logger.success(`Generated Wexts RPC client for ${manifest.services.length} service(s).`);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (type === "service") {
|
|
45
|
-
if (!name) throw new Error("Service name is required: wexts generate service hello");
|
|
46
|
-
await scaffoldRpcService(path.resolve(options.project), name);
|
|
47
|
-
_chunkWCKSKU3Cjs.logger.success(`Created RPC service ${name}. Run wexts generate to update the client.`);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
throw new Error(`Unknown generator "${type}". Supported generators: rpc, service.`);
|
|
51
|
-
});
|
|
52
|
-
program.command("codegen").description("Alias for wexts generate rpc").option("-p, --project <path>", "Path to NestJS project", "./apps/api").option("-o, --output <path>", "Output directory for generated RPC client", "./apps/web/lib/wexts").action(async (options) => {
|
|
53
|
-
const { generateRpcClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("../codegen/index.js")));
|
|
54
|
-
const manifest = await generateRpcClient({
|
|
55
|
-
projectPath: path.resolve(options.project),
|
|
56
|
-
outputPath: path.resolve(options.output)
|
|
57
|
-
});
|
|
58
|
-
_chunkWCKSKU3Cjs.logger.success(`Generated Wexts RPC client for ${manifest.services.length} service(s).`);
|
|
59
|
-
});
|
|
60
|
-
program.command("build").description("Build a Wexts project for production").option("--skip-generate", "Skip RPC generation before build", false).option("-p, --project <path>", "Path to NestJS project", "./apps/api").option("-o, --output <path>", "Output directory for generated RPC client", "./apps/web/lib/wexts").action(async (options) => {
|
|
61
|
-
if (!options.skipGenerate && fs.existsSync(options.project)) {
|
|
62
|
-
const { generateRpcClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("../codegen/index.js")));
|
|
63
|
-
await generateRpcClient({
|
|
64
|
-
projectPath: path.resolve(options.project),
|
|
65
|
-
outputPath: path.resolve(options.output)
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
runScript("build", {
|
|
69
|
-
cwd: process.cwd()
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
program.command("start").description("Start the production Wexts runtime").option("-c, --config <path>", "Runtime config module path", "./wexts.runtime.js").option("-p, --port <port>", "Port to listen on", _nullishCoalesce(process.env.PORT, () => ( "3000"))).action(async (options) => {
|
|
73
|
-
const { startWextsRuntime } = await Promise.resolve().then(() => _interopRequireWildcard(require("../runtime/index.js")));
|
|
74
|
-
const configPath = path.resolve(options.config);
|
|
75
|
-
const runtimeConfig = fs.existsSync(configPath) ? await loadRuntimeConfig(configPath) : {};
|
|
76
|
-
await startWextsRuntime({
|
|
77
|
-
...runtimeConfig,
|
|
78
|
-
port: Number(options.port),
|
|
79
|
-
dev: false
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
program.command("vercel-build").description("Build for Vercel using Build Output API v3").option("-p, --project <path>", "Path to NestJS project", "./apps/api").option("-o, --output <path>", "Output dir for RPC client", "./apps/web/lib/wexts").option("-c, --config <path>", "Runtime config module path", "./wexts.runtime.js").option("--skip-codegen", "Skip RPC generation", false).option("--skip-build", "Skip project build step", false).option("--node-version <version>", "Node.js version for Vercel function", "20").option("--max-duration <seconds>", "Max duration for serverless function", "30").action(async (options) => {
|
|
83
|
-
const { buildVercelOutput } = await Promise.resolve().then(() => _interopRequireWildcard(require("../vercel-builder/index.js")));
|
|
84
|
-
const result = await buildVercelOutput({
|
|
85
|
-
rootDir: process.cwd(),
|
|
86
|
-
apiProjectPath: options.project,
|
|
87
|
-
rpcOutputPath: options.output,
|
|
88
|
-
runtimeConfigPath: options.config,
|
|
89
|
-
skipCodegen: options.skipCodegen,
|
|
90
|
-
skipBuild: options.skipBuild,
|
|
91
|
-
nodeVersion: options.nodeVersion,
|
|
92
|
-
maxDuration: Number(options.maxDuration)
|
|
93
|
-
});
|
|
94
|
-
if (result.warnings.length > 0) {
|
|
95
|
-
for (const warning of result.warnings) _chunkWCKSKU3Cjs.logger.warn(warning);
|
|
96
|
-
}
|
|
97
|
-
if (result.errors.length > 0) {
|
|
98
|
-
for (const error of result.errors) _chunkWCKSKU3Cjs.logger.error(error);
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
_chunkWCKSKU3Cjs.logger.success("Vercel build output ready at .vercel/output");
|
|
102
|
-
});
|
|
103
|
-
program.command("doctor").description("Validate Wexts project configuration").option("--security", "Run security-specific checks", false).action(async (options) => {
|
|
104
|
-
const result = runDoctor(process.cwd(), options.security);
|
|
105
|
-
for (const warning of result.warnings) _chunkWCKSKU3Cjs.logger.warn(warning);
|
|
106
|
-
for (const error of result.errors) _chunkWCKSKU3Cjs.logger.error(error);
|
|
107
|
-
if (result.errors.length > 0) process.exit(1);
|
|
108
|
-
_chunkWCKSKU3Cjs.logger.success(options.security ? "Security doctor passed." : "Doctor passed.");
|
|
109
|
-
});
|
|
110
|
-
return program;
|
|
111
|
-
}
|
|
112
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, createCliProgram, "createCliProgram");
|
|
113
|
-
function runDoctor(cwd, security = false) {
|
|
114
|
-
const result = {
|
|
115
|
-
errors: [],
|
|
116
|
-
warnings: []
|
|
117
|
-
};
|
|
118
|
-
const pkgPath = path.join(cwd, "package.json");
|
|
119
|
-
if (!fs.existsSync(pkgPath)) {
|
|
120
|
-
result.errors.push("package.json not found.");
|
|
121
|
-
return result;
|
|
122
|
-
}
|
|
123
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
124
|
-
if (!_optionalChain([pkg, 'access', _ => _.packageManager, 'optionalAccess', _2 => _2.startsWith, 'call', _3 => _3("pnpm@")])) {
|
|
125
|
-
result.warnings.push("packageManager should pin pnpm.");
|
|
126
|
-
}
|
|
127
|
-
for (const dir of [
|
|
128
|
-
"apps/api",
|
|
129
|
-
"apps/web"
|
|
130
|
-
]) {
|
|
131
|
-
if (!fs.existsSync(path.join(cwd, dir))) {
|
|
132
|
-
result.warnings.push(`${dir} not found; some Wexts commands may need explicit paths.`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (fs.existsSync(path.join(cwd, "apps/api")) && fs.existsSync(path.join(cwd, "apps/web"))) {
|
|
136
|
-
result.warnings.push("Development mode starts separate web/API processes. Single-port serving is the production `wexts start` runtime path.");
|
|
137
|
-
}
|
|
138
|
-
if (security) {
|
|
139
|
-
const source = readAllText(cwd, [
|
|
140
|
-
"apps/api/src",
|
|
141
|
-
"packages/templates/nestjs-api/src"
|
|
142
|
-
]);
|
|
143
|
-
if (source.includes("default-secret")) {
|
|
144
|
-
result.errors.push('JWT fallback "default-secret" found. Production apps must fail without a strong JWT_SECRET.');
|
|
145
|
-
}
|
|
146
|
-
if (/origin:\s*['"]\*['"]/.test(source)) {
|
|
147
|
-
result.errors.push("Wildcard CORS origin found. Use an explicit origin allowlist.");
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return result;
|
|
151
|
-
}
|
|
152
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, runDoctor, "runDoctor");
|
|
153
|
-
async function createProject(projectName, template, options) {
|
|
154
|
-
const projectPath = path.join(process.cwd(), projectName);
|
|
155
|
-
if (fs.existsSync(projectPath)) {
|
|
156
|
-
throw new Error(`Directory already exists: ${projectName}`);
|
|
157
|
-
}
|
|
158
|
-
const templatePath = findTemplatePath();
|
|
159
|
-
if (!templatePath) {
|
|
160
|
-
throw new Error("Template directory not found in package.");
|
|
161
|
-
}
|
|
162
|
-
fs.mkdirSync(projectPath, {
|
|
163
|
-
recursive: true
|
|
164
|
-
});
|
|
165
|
-
if (template === "monorepo") {
|
|
166
|
-
fs.mkdirSync(path.join(projectPath, "apps"), {
|
|
167
|
-
recursive: true
|
|
168
|
-
});
|
|
169
|
-
fs.cpSync(path.join(templatePath, "nestjs-api"), path.join(projectPath, "apps/api"), {
|
|
170
|
-
recursive: true
|
|
171
|
-
});
|
|
172
|
-
fs.cpSync(path.join(templatePath, "nextjs-web"), path.join(projectPath, "apps/web"), {
|
|
173
|
-
recursive: true
|
|
174
|
-
});
|
|
175
|
-
fs.writeFileSync(path.join(projectPath, "pnpm-workspace.yaml"), "packages:\n - 'apps/*'\n");
|
|
176
|
-
fs.writeFileSync(path.join(projectPath, "package.json"), JSON.stringify({
|
|
177
|
-
name: projectName,
|
|
178
|
-
private: true,
|
|
179
|
-
packageManager: "pnpm@10.22.0",
|
|
180
|
-
scripts: {
|
|
181
|
-
dev: "wexts dev",
|
|
182
|
-
generate: "wexts generate",
|
|
183
|
-
build: "wexts build",
|
|
184
|
-
start: "wexts start",
|
|
185
|
-
doctor: "wexts doctor"
|
|
186
|
-
},
|
|
187
|
-
devDependencies: {
|
|
188
|
-
wexts: "latest"
|
|
189
|
-
}
|
|
190
|
-
}, null, 2));
|
|
191
|
-
} else if (template === "api") {
|
|
192
|
-
fs.cpSync(path.join(templatePath, "nestjs-api"), projectPath, {
|
|
193
|
-
recursive: true
|
|
194
|
-
});
|
|
195
|
-
} else if (template === "web") {
|
|
196
|
-
fs.cpSync(path.join(templatePath, "nextjs-web"), projectPath, {
|
|
197
|
-
recursive: true
|
|
198
|
-
});
|
|
199
|
-
} else {
|
|
200
|
-
throw new Error(`Unknown template "${template}".`);
|
|
201
|
-
}
|
|
202
|
-
if (!options.skipInstall) {
|
|
203
|
-
runCommand(detectPackageManager(projectPath), [
|
|
204
|
-
"install"
|
|
205
|
-
], projectPath);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, createProject, "createProject");
|
|
209
|
-
async function scaffoldRpcService(apiProjectPath, rawName) {
|
|
210
|
-
const serviceName = toKebabCase(rawName);
|
|
211
|
-
const className = `${toPascalCase(serviceName)}Service`;
|
|
212
|
-
const dir = path.join(apiProjectPath, "src", serviceName);
|
|
213
|
-
fs.mkdirSync(dir, {
|
|
214
|
-
recursive: true
|
|
215
|
-
});
|
|
216
|
-
fs.writeFileSync(path.join(dir, `${serviceName}.service.ts`), `import { Injectable } from '@nestjs/common';
|
|
217
|
-
import { RpcMethod, RpcService } from 'wexts/nest';
|
|
218
|
-
|
|
219
|
-
@Injectable()
|
|
220
|
-
@RpcService({ name: '${toCamelCase(serviceName)}', requireAuth: false })
|
|
221
|
-
export class ${className} {
|
|
222
|
-
@RpcMethod()
|
|
223
|
-
async sayHello(name: string): Promise<string> {
|
|
224
|
-
return \`Hello, \${name}!\`;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
`);
|
|
228
|
-
}
|
|
229
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, scaffoldRpcService, "scaffoldRpcService");
|
|
230
|
-
function runScript(script, options) {
|
|
231
|
-
const cwd = _nullishCoalesce(options.cwd, () => ( process.cwd()));
|
|
232
|
-
const packageManager = detectPackageManager(cwd);
|
|
233
|
-
const args = packageManager === "npm" ? [
|
|
234
|
-
"run",
|
|
235
|
-
script
|
|
236
|
-
] : [
|
|
237
|
-
"run",
|
|
238
|
-
script
|
|
239
|
-
];
|
|
240
|
-
runCommand(packageManager, args, cwd);
|
|
241
|
-
}
|
|
242
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, runScript, "runScript");
|
|
243
|
-
function runCommand(command, args, cwd) {
|
|
244
|
-
const result = _child_process.spawnSync.call(void 0, command, args, {
|
|
245
|
-
cwd,
|
|
246
|
-
stdio: "inherit",
|
|
247
|
-
shell: process.platform === "win32"
|
|
248
|
-
});
|
|
249
|
-
if (result.status !== 0) {
|
|
250
|
-
throw new Error(`${command} ${args.join(" ")} failed with exit code ${result.status}`);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, runCommand, "runCommand");
|
|
254
|
-
function detectPackageManager(cwd) {
|
|
255
|
-
if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
256
|
-
return "npm";
|
|
257
|
-
}
|
|
258
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, detectPackageManager, "detectPackageManager");
|
|
259
|
-
function findTemplatePath() {
|
|
260
|
-
const candidates = [
|
|
261
|
-
path.resolve(__dirname, "../../templates"),
|
|
262
|
-
path.resolve(__dirname, "../templates"),
|
|
263
|
-
path.resolve(process.cwd(), "packages/templates")
|
|
264
|
-
];
|
|
265
|
-
return candidates.find((candidate) => fs.existsSync(candidate));
|
|
266
|
-
}
|
|
267
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, findTemplatePath, "findTemplatePath");
|
|
268
|
-
function readAllText(cwd, dirs) {
|
|
269
|
-
let text = "";
|
|
270
|
-
for (const dir of dirs) {
|
|
271
|
-
const absolute = path.join(cwd, dir);
|
|
272
|
-
if (!fs.existsSync(absolute)) continue;
|
|
273
|
-
for (const file of walk(absolute)) {
|
|
274
|
-
if (file.endsWith(".ts") || file.endsWith(".tsx") || file.endsWith(".js")) {
|
|
275
|
-
text += fs.readFileSync(file, "utf8");
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return text;
|
|
280
|
-
}
|
|
281
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, readAllText, "readAllText");
|
|
282
|
-
function walk(dir) {
|
|
283
|
-
return fs.readdirSync(dir, {
|
|
284
|
-
withFileTypes: true
|
|
285
|
-
}).flatMap((entry) => {
|
|
286
|
-
const absolute = path.join(dir, entry.name);
|
|
287
|
-
if (entry.isDirectory()) return walk(absolute);
|
|
288
|
-
return [
|
|
289
|
-
absolute
|
|
290
|
-
];
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, walk, "walk");
|
|
294
|
-
function toKebabCase(value) {
|
|
295
|
-
return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[_\s]+/g, "-").toLowerCase();
|
|
296
|
-
}
|
|
297
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, toKebabCase, "toKebabCase");
|
|
298
|
-
function toPascalCase(value) {
|
|
299
|
-
return toKebabCase(value).split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
300
|
-
}
|
|
301
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, toPascalCase, "toPascalCase");
|
|
302
|
-
function toCamelCase(value) {
|
|
303
|
-
const pascal = toPascalCase(value);
|
|
304
|
-
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
305
|
-
}
|
|
306
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, toCamelCase, "toCamelCase");
|
|
307
|
-
function pathToFileUrl(filePath) {
|
|
308
|
-
return `file://${filePath}`;
|
|
309
|
-
}
|
|
310
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, pathToFileUrl, "pathToFileUrl");
|
|
311
|
-
async function loadRuntimeConfig(configPath) {
|
|
312
|
-
if (configPath.endsWith(".mjs")) {
|
|
313
|
-
const mod2 = await Promise.resolve().then(() => _interopRequireWildcard(require(pathToFileUrl(configPath))));
|
|
314
|
-
return _nullishCoalesce(mod2.default, () => ( mod2));
|
|
315
|
-
}
|
|
316
|
-
const require2 = _module.createRequire.call(void 0, __filename);
|
|
317
|
-
const mod = require2(configPath);
|
|
318
|
-
return _nullishCoalesce(mod.default, () => ( mod));
|
|
319
|
-
}
|
|
320
|
-
_chunkXE4OXN2Wjs.__name.call(void 0, loadRuntimeConfig, "loadRuntimeConfig");
|
|
321
|
-
var invokedAsCli = process.argv[1] && (path.basename(process.argv[1]) === "wexts" || path.basename(process.argv[1]) === "wexts.cjs" || path.resolve(process.argv[1]).includes(`${path.sep}dist${path.sep}cli${path.sep}index`));
|
|
322
|
-
if (invokedAsCli && !process.env.VITEST) {
|
|
323
|
-
createCliProgram().parseAsync(process.argv).catch((error) => {
|
|
324
|
-
_chunkWCKSKU3Cjs.logger.error(error instanceof Error ? error.message : String(error));
|
|
325
|
-
process.exit(1);
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
exports.createCliProgram = createCliProgram; exports.runDoctor = runDoctor;
|
|
332
|
-
//# sourceMappingURL=index.js.map
|