@lensmcp/cluster 1.18.4 → 1.18.7
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/basic-ssl.js +1 -241
- package/build-scope-patterns.js +1 -40
- package/create-webpack-dev.js +1 -186
- package/create-webpack-prod.js +1 -169
- package/executors/build/build.impl.js +1 -98
- package/executors/gateway/gateway-errors.js +1 -43
- package/executors/gateway/gateway.impl.js +1 -53
- package/executors/gateway/gateway.lib.js +1 -29
- package/executors/gateway/health-check.js +1 -66
- package/executors/gateway/jwks-verify.js +1 -121
- package/executors/gateway/main.prod-gateway.js +2 -573
- package/executors/gateway/main.rollout.js +11 -117
- package/executors/gateway/manifest.js +1 -374
- package/executors/gateway/metrics.js +1 -56
- package/executors/gateway/otel-tracing.js +1 -74
- package/executors/gateway/prod-gateway.lib.js +1 -22
- package/executors/gateway/prod-runtime/access-log.js +1 -24
- package/executors/gateway/prod-runtime/app.js +1 -123
- package/executors/gateway/prod-runtime/auth.js +1 -51
- package/executors/gateway/prod-runtime/cors.js +1 -40
- package/executors/gateway/prod-runtime/edge.js +1 -65
- package/executors/gateway/prod-runtime/handler.js +1 -226
- package/executors/gateway/prod-runtime/hooks.js +1 -42
- package/executors/gateway/prod-runtime/observability.js +1 -125
- package/executors/gateway/prod-runtime/rollout.js +1 -103
- package/executors/gateway/prod-runtime/routing.js +1 -40
- package/executors/gateway/prod-runtime/server.js +1 -79
- package/executors/gateway/prod-runtime/trust.js +1 -32
- package/executors/gateway/prod-runtime/types.js +1 -2
- package/executors/gateway/prod-runtime/upgrade.js +4 -116
- package/executors/gateway/prod-runtime/upstream.js +1 -21
- package/executors/gateway/providers-prod.js +1 -232
- package/executors/gateway/rate-limit.js +2 -75
- package/executors/gateway/registry-source.js +1 -131
- package/executors/gateway/rollout-ops.js +2 -167
- package/executors/gateway/runtime/auth.js +1 -64
- package/executors/gateway/runtime/chooser.js +12 -45
- package/executors/gateway/runtime/control.js +1 -128
- package/executors/gateway/runtime/dev-auth.js +1 -108
- package/executors/gateway/runtime/discovery.js +1 -123
- package/executors/gateway/runtime/edge.js +1 -47
- package/executors/gateway/runtime/handler.js +1 -183
- package/executors/gateway/runtime/hooks.js +1 -55
- package/executors/gateway/runtime/lens-children.js +1 -651
- package/executors/gateway/runtime/lifecycle.js +3 -842
- package/executors/gateway/runtime/observability.js +2 -148
- package/executors/gateway/runtime/pod-env.js +2 -89
- package/executors/gateway/runtime/proxy.js +1 -457
- package/executors/gateway/runtime/route-registry.js +1 -72
- package/executors/gateway/runtime/scope.js +1 -117
- package/executors/gateway/runtime/server.js +3 -487
- package/executors/gateway/runtime/service-keys.js +1 -49
- package/executors/gateway/runtime/types.js +1 -151
- package/executors/gateway/runtime/upgrade.js +1 -71
- package/executors/gateway/runtime/workspace-registry.js +1 -99
- package/executors/gateway/ssrf-guard.js +1 -190
- package/executors/serve/serve.impl.js +1 -280
- package/executors/trust/trust.impl.js +4 -162
- package/gateway.js +1 -35
- package/index.js +1 -16
- package/main.devserver.js +10 -1117
- package/package.json +4 -3
- package/tsgo-check-plugin.js +4 -364
- package/typecheck-bus.js +4 -256
|
@@ -1,280 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const path = tslib_1.__importStar(require("node:path"));
|
|
5
|
-
const fs = tslib_1.__importStar(require("node:fs"));
|
|
6
|
-
const node_child_process_1 = require("node:child_process");
|
|
7
|
-
const yaml = tslib_1.__importStar(require("js-yaml"));
|
|
8
|
-
const create_webpack_dev_1 = require("../../create-webpack-dev");
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
10
|
-
const webpack = require('webpack');
|
|
11
|
-
/**
|
|
12
|
-
* Dev serve executor — webpack watch mode with integrated devserver.
|
|
13
|
-
*
|
|
14
|
-
* Owns the full devserver lifecycle:
|
|
15
|
-
* 1. Starts webpack in watch mode
|
|
16
|
-
* 2. On first successful build, forks main.devserver.js with proper env vars
|
|
17
|
-
* 3. On subsequent builds, POSTs /webpack/reload to devserver
|
|
18
|
-
* 4. On shutdown, cleans up devserver and webpack watcher
|
|
19
|
-
*/
|
|
20
|
-
async function* serveExecutor(options, context) {
|
|
21
|
-
process.env.NODE_ENV = 'development';
|
|
22
|
-
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
|
23
|
-
const workspaceRoot = context.root;
|
|
24
|
-
const projectRoot = path.join(workspaceRoot, projectConfig.root);
|
|
25
|
-
const outputPath = options.outputPath
|
|
26
|
-
? path.join(workspaceRoot, options.outputPath)
|
|
27
|
-
: path.join(workspaceRoot, 'dist', projectConfig.root);
|
|
28
|
-
// Resolve port and serviceName from config YAML
|
|
29
|
-
const configEnv = options.configEnv || 'development';
|
|
30
|
-
const configFilePath = path.join(workspaceRoot, 'config', `config.${configEnv}.yaml`);
|
|
31
|
-
const DEFAULT_PUBLIC_PORT = 3050;
|
|
32
|
-
let port = DEFAULT_PUBLIC_PORT;
|
|
33
|
-
let serviceName = context.projectName;
|
|
34
|
-
let yamlConfig = {};
|
|
35
|
-
if (fs.existsSync(configFilePath)) {
|
|
36
|
-
yamlConfig = yaml.load(fs.readFileSync(configFilePath, 'utf8'));
|
|
37
|
-
port = Number(yamlConfig.port) || port;
|
|
38
|
-
serviceName = yamlConfig.serviceName || serviceName;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
// No per-service config → the devserver's PUBLIC port falls back to the shared default. If TWO
|
|
42
|
-
// services both miss their config, both bind DEFAULT_PUBLIC_PORT and the loser crash-loops with a
|
|
43
|
-
// cryptic `EADDRINUSE :::3050` that the gateway surfaces as a "service error" — masquerading as a
|
|
44
|
-
// service bug. Warn loudly + actionably so the real cause (a missing `config/config.<env>.yaml`) is
|
|
45
|
-
// obvious. Fix: add `config/config.${configEnv}.yaml` with a distinct `port` (mirror its cluster decl).
|
|
46
|
-
console.warn(`[serve] ${context.projectName}: no config file at ${configFilePath} — public devserver port defaults to ${DEFAULT_PUBLIC_PORT}. ` +
|
|
47
|
-
`If another service also lacks its config, both bind ${DEFAULT_PUBLIC_PORT} → EADDRINUSE. ` +
|
|
48
|
-
`Add config/config.${configEnv}.yaml with a distinct \`port:\` (matching this project's cluster.port).`);
|
|
49
|
-
}
|
|
50
|
-
if (options.serviceName) {
|
|
51
|
-
serviceName = options.serviceName;
|
|
52
|
-
}
|
|
53
|
-
const servePrefix = options.servePrefix ?? '';
|
|
54
|
-
// Debug base port: pod #slot opens its inspector on debugPort+slot (workers on
|
|
55
|
-
// debugPort+20+i). Option wins over the LENSMCP_DEBUG_PORT env var so per-project
|
|
56
|
-
// config can give each service a distinct base in cluster mode. Even without it,
|
|
57
|
-
// POST /webpack/debug on the running devserver opens inspectors on demand.
|
|
58
|
-
const debugPort = options.debugPort ?? (Number(process.env.LENSMCP_DEBUG_PORT) || undefined);
|
|
59
|
-
// Log tee: every pod/worker line is also appended (ANSI-stripped) to this file so
|
|
60
|
-
// an IDE can tail it — WebStorm: Run/Debug configuration → Logs tab. Truncated
|
|
61
|
-
// here once per `nx serve` run; devserver crash-respawns keep appending.
|
|
62
|
-
const logFile = options.logFile
|
|
63
|
-
? path.resolve(workspaceRoot, options.logFile)
|
|
64
|
-
: process.env.LENSMCP_LOG_FILE || undefined;
|
|
65
|
-
if (logFile) {
|
|
66
|
-
fs.mkdirSync(path.dirname(logFile), { recursive: true });
|
|
67
|
-
fs.writeFileSync(logFile, '');
|
|
68
|
-
}
|
|
69
|
-
// Resolve gateway middleware
|
|
70
|
-
let gatewayMiddlewarePath;
|
|
71
|
-
let gatewayConfigJson;
|
|
72
|
-
if (options.gateway?.middleware) {
|
|
73
|
-
gatewayMiddlewarePath = path.resolve(projectRoot, options.gateway.middleware);
|
|
74
|
-
gatewayConfigJson = JSON.stringify(yamlConfig);
|
|
75
|
-
}
|
|
76
|
-
// Resolve entry/tsconfig relative to project root (absolute paths avoid
|
|
77
|
-
// NxAppWebpackPlugin's normalizeRelativePaths collision with executor options)
|
|
78
|
-
const entryFile = options.entryFile || './src/deployments/service/main.ts';
|
|
79
|
-
const tsConfigFile = options.tsConfigFile || './tsconfig.app.json';
|
|
80
|
-
const resolvedMain = path.resolve(projectRoot, entryFile);
|
|
81
|
-
const resolvedTsConfig = path.resolve(projectRoot, tsConfigFile);
|
|
82
|
-
// Map workers to additional entry points
|
|
83
|
-
const additionalEntryPoints = (options.workers || []).map((w) => ({
|
|
84
|
-
entryName: w.name,
|
|
85
|
-
entryPath: path.resolve(projectRoot, w.entryPath),
|
|
86
|
-
}));
|
|
87
|
-
// Build dev webpack config
|
|
88
|
-
const config = (0, create_webpack_dev_1.createDevWebpackConfig)({
|
|
89
|
-
appName: context.projectName,
|
|
90
|
-
appRoot: projectRoot,
|
|
91
|
-
outputDir: outputPath,
|
|
92
|
-
main: resolvedMain,
|
|
93
|
-
tsConfig: resolvedTsConfig,
|
|
94
|
-
assets: options.assets || [],
|
|
95
|
-
additionalEntryPoints,
|
|
96
|
-
port,
|
|
97
|
-
serviceName,
|
|
98
|
-
memoryLimit: options.memoryLimit || 8192,
|
|
99
|
-
buildLibsFromSource: options.buildLibsFromSource !== false,
|
|
100
|
-
workspaceRoot,
|
|
101
|
-
orgScopes: options.orgScopes || [],
|
|
102
|
-
bundlePackages: options.bundlePackages || [],
|
|
103
|
-
nodeExternalsConfig: options.nodeExternalsConfig,
|
|
104
|
-
webpackConfigPath: options.webpackConfigPath,
|
|
105
|
-
httpsReload: options.gateway?.https === true,
|
|
106
|
-
});
|
|
107
|
-
// State
|
|
108
|
-
let devserverProcess = null;
|
|
109
|
-
let firstBuildComplete = false;
|
|
110
|
-
// Path to the devserver script — resolve JS first, fall back to TS (local dev with swc-node)
|
|
111
|
-
const devserverScriptJs = path.join(__dirname, '../../main.devserver.js');
|
|
112
|
-
const devserverScriptTs = path.join(__dirname, '../../main.devserver.ts');
|
|
113
|
-
const runningFromSource = !fs.existsSync(devserverScriptJs) && fs.existsSync(devserverScriptTs);
|
|
114
|
-
const devserverScript = runningFromSource ? devserverScriptTs : devserverScriptJs;
|
|
115
|
-
// Absolute path to the webpack bundle the devserver should load
|
|
116
|
-
const bundlePath = path.join(outputPath, 'main.js');
|
|
117
|
-
function cleanup() {
|
|
118
|
-
if (devserverProcess && !devserverProcess.killed) {
|
|
119
|
-
devserverProcess.kill('SIGTERM');
|
|
120
|
-
devserverProcess = null;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// Register cleanup on process signals
|
|
124
|
-
const signals = ['SIGINT', 'SIGTERM', 'SIGHUP', 'SIGQUIT'];
|
|
125
|
-
const signalHandlers = signals.map((sig) => {
|
|
126
|
-
const handler = () => cleanup();
|
|
127
|
-
process.on(sig, handler);
|
|
128
|
-
return { sig, handler };
|
|
129
|
-
});
|
|
130
|
-
process.on('exit', cleanup);
|
|
131
|
-
function startDevServer() {
|
|
132
|
-
if (!fs.existsSync(devserverScript)) {
|
|
133
|
-
console.error(`[serve] devserver script not found at ${devserverScript}`);
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const execArgv = ['--enable-source-maps'];
|
|
137
|
-
if (runningFromSource) {
|
|
138
|
-
execArgv.unshift('--require', '@swc-node/register');
|
|
139
|
-
}
|
|
140
|
-
devserverProcess = (0, node_child_process_1.fork)(devserverScript, {
|
|
141
|
-
cwd: workspaceRoot,
|
|
142
|
-
env: {
|
|
143
|
-
...process.env,
|
|
144
|
-
PORT: String(port),
|
|
145
|
-
SERVICE_NAME: serviceName,
|
|
146
|
-
SERVE_PREFIX: servePrefix,
|
|
147
|
-
// Zero-touch lens identity + bus for pod children and workers: the
|
|
148
|
-
// injected @lensmcp/node-instrumentation (and the grafted nest module)
|
|
149
|
-
// attribute every event to this project and write to the shared file
|
|
150
|
-
// rendezvous — without these, nest trace events fall to the console
|
|
151
|
-
// sink and are lost in cluster mode.
|
|
152
|
-
LENSMCP_PROJECT: process.env.LENSMCP_PROJECT || context.projectName || serviceName,
|
|
153
|
-
LENSMCP_EVENT_FILE: process.env.LENSMCP_EVENT_FILE || path.join(workspaceRoot, '.lensmcp', 'events.jsonl'),
|
|
154
|
-
CHILD_COUNT: String(options.childCount || process.env.CHILD_COUNT || 1),
|
|
155
|
-
BUNDLE_PATH: bundlePath,
|
|
156
|
-
...(gatewayMiddlewarePath && { GATEWAY_MIDDLEWARE: gatewayMiddlewarePath }),
|
|
157
|
-
...(gatewayConfigJson && { GATEWAY_CONFIG: gatewayConfigJson }),
|
|
158
|
-
...(options.gateway?.routes?.length && { GATEWAY_ROUTES: JSON.stringify(options.gateway.routes) }),
|
|
159
|
-
...(options.gateway?.https && { GATEWAY_HTTPS: "1" }),
|
|
160
|
-
...(options.gateway?.extraPorts?.length && { GATEWAY_EXTRA_PORTS: JSON.stringify(options.gateway.extraPorts) }),
|
|
161
|
-
...(options.internalPort && { INTERNAL_PORT: String(options.internalPort) }),
|
|
162
|
-
...(debugPort && { LENSMCP_DEBUG_PORT: String(debugPort) }),
|
|
163
|
-
...(logFile && { LENSMCP_LOG_FILE: logFile }),
|
|
164
|
-
...((options.workers?.length) && { WORKERS: JSON.stringify(options.workers.map(w => w.name)) }),
|
|
165
|
-
},
|
|
166
|
-
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
167
|
-
execArgv,
|
|
168
|
-
});
|
|
169
|
-
devserverProcess.on('exit', (code, signal) => {
|
|
170
|
-
devserverProcess = null;
|
|
171
|
-
if (signal)
|
|
172
|
-
return; // ANY signal = intentional kill (TERM/INT/KILL) — never respawn a corpse
|
|
173
|
-
console.error(`[serve] devserver exited unexpectedly (code=${code}, signal=${signal}) — respawning in 1.5s`);
|
|
174
|
-
// Supervision: the watcher may sit idle (no rebuild event) forever —
|
|
175
|
-
// without this the service stays podless until a source edit.
|
|
176
|
-
setTimeout(() => {
|
|
177
|
-
if (!devserverProcess && firstBuildComplete)
|
|
178
|
-
startDevServer();
|
|
179
|
-
}, 1500).unref?.();
|
|
180
|
-
});
|
|
181
|
-
console.log(`[serve] Devserver started on port ${port} (service: ${serviceName}${servePrefix ? `, prefix: /${servePrefix}` : ''})`);
|
|
182
|
-
if (debugPort) {
|
|
183
|
-
console.log(`[serve] Debug: pod inspectors on 127.0.0.1:${debugPort}+ — click the "Debugger listening" link in the console, or attach WebStorm (Attach to Node.js/Chrome) to port ${debugPort}`);
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
console.log(`[serve] Debug on demand: POST http://localhost:${port}/webpack/debug (optionally ?port=<base>) opens pod inspectors without a restart`);
|
|
187
|
-
}
|
|
188
|
-
if (logFile) {
|
|
189
|
-
console.log(`[serve] Logs teed to ${logFile} — tail it in WebStorm via Run/Debug configuration → Logs tab`);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
193
|
-
function _notifyDevServerReload() {
|
|
194
|
-
if (!devserverProcess || devserverProcess.killed) {
|
|
195
|
-
console.log('[serve] Devserver not running, restarting...');
|
|
196
|
-
startDevServer();
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
fetch(`http://localhost:${port}/webpack/reload`, {
|
|
200
|
-
method: 'POST',
|
|
201
|
-
headers: { 'content-type': 'application/json' },
|
|
202
|
-
body: '{}',
|
|
203
|
-
})
|
|
204
|
-
.then(() => console.log('[serve] Notified devserver to reload'))
|
|
205
|
-
.catch((err) => {
|
|
206
|
-
console.warn('[serve] Failed to notify devserver, restarting...', err.message);
|
|
207
|
-
cleanup();
|
|
208
|
-
startDevServer();
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
// Start webpack in watch mode
|
|
212
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
213
|
-
const { watch: _watch, ...normalizedConfig } = config;
|
|
214
|
-
const compiler = webpack(normalizedConfig);
|
|
215
|
-
// Event queue for the async generator
|
|
216
|
-
let resolveNext = null;
|
|
217
|
-
const pendingResults = [];
|
|
218
|
-
function pushResult(result) {
|
|
219
|
-
if (resolveNext) {
|
|
220
|
-
const resolve = resolveNext;
|
|
221
|
-
resolveNext = null;
|
|
222
|
-
resolve(result);
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
pendingResults.push(result);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
function waitForNext() {
|
|
229
|
-
if (pendingResults.length > 0) {
|
|
230
|
-
return Promise.resolve(pendingResults.shift());
|
|
231
|
-
}
|
|
232
|
-
return new Promise((resolve) => { resolveNext = resolve; });
|
|
233
|
-
}
|
|
234
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
235
|
-
const watching = compiler.watch(config.watchOptions || {}, (err, stats) => {
|
|
236
|
-
if (err) {
|
|
237
|
-
console.error('[serve] Webpack error:', err);
|
|
238
|
-
pushResult({ success: false });
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
const hasErrors = stats.hasErrors();
|
|
242
|
-
console.info(stats.toString({ colors: true, chunks: false, assets: true }));
|
|
243
|
-
if (hasErrors) {
|
|
244
|
-
// Don't kill the devserver — keep the last good build running
|
|
245
|
-
pushResult({ success: false });
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
if (!firstBuildComplete || !devserverProcess) {
|
|
249
|
-
// first SUCCESSFUL build (a failed first compile must not strand the
|
|
250
|
-
// service devserver-less forever), or the devserver died while webpack
|
|
251
|
-
// recovered — fork it now.
|
|
252
|
-
firstBuildComplete = true;
|
|
253
|
-
startDevServer();
|
|
254
|
-
}
|
|
255
|
-
// Note: subsequent reloads are handled by DevServerReloadPlugin in webpack config
|
|
256
|
-
// which POSTs to /webpack/reload. We don't need to do it here since the plugin fires
|
|
257
|
-
// after each successful build.
|
|
258
|
-
pushResult({
|
|
259
|
-
success: true,
|
|
260
|
-
baseUrl: `http://localhost:${port}`,
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
// Main generator loop: yield each build result
|
|
264
|
-
try {
|
|
265
|
-
while (true) {
|
|
266
|
-
const result = await waitForNext();
|
|
267
|
-
yield result;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
finally {
|
|
271
|
-
// Generator was returned/thrown (Nx killed the executor)
|
|
272
|
-
watching.close(() => { });
|
|
273
|
-
cleanup();
|
|
274
|
-
// Remove signal handlers
|
|
275
|
-
signalHandlers.forEach(({ sig, handler }) => process.removeListener(sig, handler));
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
exports.default = serveExecutor;
|
|
279
|
-
module.exports = serveExecutor;
|
|
280
|
-
module.exports.default = serveExecutor;
|
|
1
|
+
"use strict";var Y=Object.defineProperty;var a=(e,o)=>Y(e,"name",{value:o,configurable:!0});var J=Object.defineProperty,c=a((e,o)=>J(e,"name",{value:o,configurable:!0}),"c");Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),path=tslib_1.__importStar(require("node:path")),fs=tslib_1.__importStar(require("node:fs")),node_child_process_1=require("node:child_process"),yaml=tslib_1.__importStar(require("js-yaml")),create_webpack_dev_1=require("../../create-webpack-dev"),webpack=require("webpack");async function*serveExecutor(e,o){process.env.NODE_ENV="development";const C=o.projectsConfigurations.projects[o.projectName],n=o.root,u=path.join(n,C.root),L=e.outputPath?path.join(n,e.outputPath):path.join(n,"dist",C.root),j=e.configEnv||"development",S=path.join(n,"config",`config.${j}.yaml`),_=3050;let i=_,l=o.projectName,m={};fs.existsSync(S)?(m=yaml.load(fs.readFileSync(S,"utf8")),i=Number(m.port)||i,l=m.serviceName||l):console.warn(`[serve] ${o.projectName}: no config file at ${S} \u2014 public devserver port defaults to ${_}. If another service also lacks its config, both bind ${_} \u2192 EADDRINUSE. Add config/config.${j}.yaml with a distinct \`port:\` (matching this project's cluster.port).`),e.serviceName&&(l=e.serviceName);const y=e.servePrefix??"",d=e.debugPort??(Number(process.env.LENSMCP_DEBUG_PORT)||void 0),p=e.logFile?path.resolve(n,e.logFile):process.env.LENSMCP_LOG_FILE||void 0;p&&(fs.mkdirSync(path.dirname(p),{recursive:!0}),fs.writeFileSync(p,""));let N,P;e.gateway?.middleware&&(N=path.resolve(u,e.gateway.middleware),P=JSON.stringify(m));const I=e.entryFile||"./src/deployments/service/main.ts",A=e.tsConfigFile||"./tsconfig.app.json",$=path.resolve(u,I),F=path.resolve(u,A),G=(e.workers||[]).map(t=>({entryName:t.name,entryPath:path.resolve(u,t.entryPath)})),k=(0,create_webpack_dev_1.createDevWebpackConfig)({appName:o.projectName,appRoot:u,outputDir:L,main:$,tsConfig:F,assets:e.assets||[],additionalEntryPoints:G,port:i,serviceName:l,memoryLimit:e.memoryLimit||8192,buildLibsFromSource:e.buildLibsFromSource!==!1,workspaceRoot:n,orgScopes:e.orgScopes||[],bundlePackages:e.bundlePackages||[],nodeExternalsConfig:e.nodeExternalsConfig,webpackConfigPath:e.webpackConfigPath,httpsReload:e.gateway?.https===!0});let s=null,b=!1;const R=path.join(__dirname,"../../main.devserver.js"),O=path.join(__dirname,"../../main.devserver.ts"),x=!fs.existsSync(R)&&fs.existsSync(O),w=x?O:R,M=path.join(L,"main.js");function v(){s&&!s.killed&&(s.kill("SIGTERM"),s=null)}a(v,"f"),c(v,"cleanup");const W=["SIGINT","SIGTERM","SIGHUP","SIGQUIT"].map(t=>{const r=c(()=>v(),"handler");return process.on(t,r),{sig:t,handler:r}});process.on("exit",v);function g(){if(!fs.existsSync(w)){console.error(`[serve] devserver script not found at ${w}`);return}const t=["--enable-source-maps"];x&&t.unshift("--require","@swc-node/register"),s=(0,node_child_process_1.fork)(w,{cwd:n,env:{...process.env,PORT:String(i),SERVICE_NAME:l,SERVE_PREFIX:y,LENSMCP_PROJECT:process.env.LENSMCP_PROJECT||o.projectName||l,LENSMCP_EVENT_FILE:process.env.LENSMCP_EVENT_FILE||path.join(n,".lensmcp","events.jsonl"),CHILD_COUNT:String(e.childCount||process.env.CHILD_COUNT||1),BUNDLE_PATH:M,...N&&{GATEWAY_MIDDLEWARE:N},...P&&{GATEWAY_CONFIG:P},...e.gateway?.routes?.length&&{GATEWAY_ROUTES:JSON.stringify(e.gateway.routes)},...e.gateway?.https&&{GATEWAY_HTTPS:"1"},...e.gateway?.extraPorts?.length&&{GATEWAY_EXTRA_PORTS:JSON.stringify(e.gateway.extraPorts)},...e.internalPort&&{INTERNAL_PORT:String(e.internalPort)},...d&&{LENSMCP_DEBUG_PORT:String(d)},...p&&{LENSMCP_LOG_FILE:p},...e.workers?.length&&{WORKERS:JSON.stringify(e.workers.map(r=>r.name))}},stdio:["inherit","inherit","inherit","ipc"],execArgv:t}),s.on("exit",(r,E)=>{s=null,!E&&(console.error(`[serve] devserver exited unexpectedly (code=${r}, signal=${E}) \u2014 respawning in 1.5s`),setTimeout(()=>{!s&&b&&g()},1500).unref?.())}),console.log(`[serve] Devserver started on port ${i} (service: ${l}${y?`, prefix: /${y}`:""})`),console.log(d?`[serve] Debug: pod inspectors on 127.0.0.1:${d}+ \u2014 click the "Debugger listening" link in the console, or attach WebStorm (Attach to Node.js/Chrome) to port ${d}`:`[serve] Debug on demand: POST http://localhost:${i}/webpack/debug (optionally ?port=<base>) opens pod inspectors without a restart`),p&&console.log(`[serve] Logs teed to ${p} \u2014 tail it in WebStorm via Run/Debug configuration \u2192 Logs tab`)}a(g,"v"),c(g,"startDevServer");function U(){if(!s||s.killed){console.log("[serve] Devserver not running, restarting..."),g();return}fetch(`http://localhost:${i}/webpack/reload`,{method:"POST",headers:{"content-type":"application/json"},body:"{}"}).then(()=>console.log("[serve] Notified devserver to reload")).catch(t=>{console.warn("[serve] Failed to notify devserver, restarting...",t.message),v(),g()})}a(U,"B"),c(U,"_notifyDevServerReload");const{watch:B,...q}=k,V=webpack(q);let f=null;const T=[];function h(t){if(f){const r=f;f=null,r(t)}else T.push(t)}a(h,"b"),c(h,"pushResult");function D(){return T.length>0?Promise.resolve(T.shift()):new Promise(t=>{f=t})}a(D,"W"),c(D,"waitForNext");const H=V.watch(k.watchOptions||{},(t,r)=>{if(t){console.error("[serve] Webpack error:",t),h({success:!1});return}const E=r.hasErrors();if(console.info(r.toString({colors:!0,chunks:!1,assets:!0})),E){h({success:!1});return}(!b||!s)&&(b=!0,g()),h({success:!0,baseUrl:`http://localhost:${i}`})});try{for(;;)yield await D()}finally{H.close(()=>{}),v(),W.forEach(({sig:t,handler:r})=>process.removeListener(t,r))}}a(serveExecutor,"serveExecutor"),c(serveExecutor,"serveExecutor"),exports.default=serveExecutor,module.exports=serveExecutor,module.exports.default=serveExecutor;
|
|
@@ -1,162 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const node_child_process_1 = require("node:child_process");
|
|
7
|
-
const fs = tslib_1.__importStar(require("node:fs"));
|
|
8
|
-
const path = tslib_1.__importStar(require("node:path"));
|
|
9
|
-
const basic_ssl_1 = require("../../basic-ssl");
|
|
10
|
-
/**
|
|
11
|
-
* `trust` executor — one idempotent command that makes the HTTPS dev gateway
|
|
12
|
-
* green in real browsers:
|
|
13
|
-
*
|
|
14
|
-
* 1. resolves the MACHINE-LEVEL dev CA (`~/.lensmcp/ca`) — minting it if
|
|
15
|
-
* missing, or promoting this workspace's legacy per-workspace CA so
|
|
16
|
-
* existing keychain trust carries over,
|
|
17
|
-
* 2. adds it ONCE PER MACHINE to the macOS System keychain (`sudo security
|
|
18
|
-
* add-trusted-cert`) — every leaf rotation / new hostname / new workspace
|
|
19
|
-
* then chains to it with no interstitial,
|
|
20
|
-
* 3. writes BOTH `/etc/hosts` families (`127.0.0.1` + `::1`) for every
|
|
21
|
-
* gateway route hostname — the missing `::1` line is what sends `.local`
|
|
22
|
-
* AAAA lookups to Bonjour/mDNS and costs ~5s per resolution,
|
|
23
|
-
* 4. flushes the DNS cache.
|
|
24
|
-
*
|
|
25
|
-
* Hostnames come from the project's serve target gateway routes (wildcards
|
|
26
|
-
* skipped — they can't live in /etc/hosts) plus any `hosts` option extras.
|
|
27
|
-
* Run it from a terminal: sudo prompts for your password inline.
|
|
28
|
-
*/
|
|
29
|
-
async function trustExecutor(options, context) {
|
|
30
|
-
// The workspace cert-cache dir is only the PROMOTION SOURCE now: ensureCaSync resolves the machine-level
|
|
31
|
-
// CA (~/.lensmcp/ca), adopting a pre-existing per-workspace CA from here so its keychain trust survives.
|
|
32
|
-
const cacheDir = path.join(context.root, 'node_modules', '.cache', 'davnx-webpack');
|
|
33
|
-
const caPath = (0, basic_ssl_1.ensureCaSync)(cacheDir);
|
|
34
|
-
// HOSTS-ONLY mode (set by the CLI when this workspace is a GUEST of a shared daemon): the daemon serves
|
|
35
|
-
// TLS with ITS own already-trusted CA, so this workspace's CA is unused — skip the keychain step + the
|
|
36
|
-
// (misleading) file-based CA verify, and set up /etc/hosts + DNS only. The CLI reports the REAL served-cert
|
|
37
|
-
// trust afterward.
|
|
38
|
-
const hostsOnly = process.env['LENSMCP_TRUST_HOSTS_ONLY'] === '1';
|
|
39
|
-
const hosts = collectHosts(options, context);
|
|
40
|
-
if (hosts.length === 0) {
|
|
41
|
-
console.log('[trust] no concrete hostnames found (only wildcards?) — keychain step only.');
|
|
42
|
-
}
|
|
43
|
-
if (process.platform !== 'darwin') {
|
|
44
|
-
console.log('[trust] non-macOS platform — do these manually:');
|
|
45
|
-
console.log(` • trust ${caPath} in your OS/browser store (Linux: update-ca-certificates / certutil)`);
|
|
46
|
-
for (const h of hosts)
|
|
47
|
-
console.log(` • /etc/hosts: "127.0.0.1 ${h}" and "::1 ${h}"`);
|
|
48
|
-
return { success: true };
|
|
49
|
-
}
|
|
50
|
-
// --- 1) CA into the System keychain (skip when already there, or in hosts-only/guest mode) -----------
|
|
51
|
-
// "Already there" must match by FINGERPRINT, not CN: every workspace mints its own CA under the same
|
|
52
|
-
// "lensmcp local dev CA" name, so a same-named cert from another workspace (or a pre-rotation stale one)
|
|
53
|
-
// would otherwise satisfy a name lookup while the CA this gateway actually serves stays untrusted —
|
|
54
|
-
// the browser interstitial with a green-looking trust log.
|
|
55
|
-
const fingerprint = caSha256Fingerprint(caPath);
|
|
56
|
-
const present = hostsOnly ||
|
|
57
|
-
(fingerprint !== undefined &&
|
|
58
|
-
(0, node_child_process_1.spawnSync)('security', ['find-certificate', '-a', '-c', 'lensmcp local dev CA', '-Z', '/Library/Keychains/System.keychain'], { encoding: 'utf8' }).stdout?.includes(fingerprint) === true);
|
|
59
|
-
if (hostsOnly) {
|
|
60
|
-
console.log('[trust] hosts-only: a shared daemon serves TLS with its own CA — skipping the keychain step.');
|
|
61
|
-
}
|
|
62
|
-
else if (present) {
|
|
63
|
-
console.log('[trust] CA already in the System keychain — skipping.');
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
console.log(`[trust] adding CA to the System keychain (sudo will prompt): ${caPath}`);
|
|
67
|
-
const r = (0, node_child_process_1.spawnSync)('sudo', ['security', 'add-trusted-cert', '-d', '-r', 'trustRoot', '-k', '/Library/Keychains/System.keychain', caPath], { stdio: 'inherit' });
|
|
68
|
-
if (r.status !== 0) {
|
|
69
|
-
console.error('[trust] add-trusted-cert failed — rerun in a terminal so sudo can prompt.');
|
|
70
|
-
return { success: false };
|
|
71
|
-
}
|
|
72
|
-
console.log('[trust] CA trusted. Restart your browser once (it caches certificate verdicts).');
|
|
73
|
-
}
|
|
74
|
-
// --- 2) /etc/hosts: both address families per hostname ------------------
|
|
75
|
-
const etcHosts = fs.readFileSync('/etc/hosts', 'utf8');
|
|
76
|
-
const hasEntry = (ip, host) => etcHosts.split('\n').some((line) => {
|
|
77
|
-
const t = line.trim();
|
|
78
|
-
if (t.startsWith('#'))
|
|
79
|
-
return false;
|
|
80
|
-
const cols = t.split(/\s+/);
|
|
81
|
-
return cols[0] === ip && cols.slice(1).includes(host);
|
|
82
|
-
});
|
|
83
|
-
const missing = [];
|
|
84
|
-
for (const h of hosts) {
|
|
85
|
-
if (!hasEntry('127.0.0.1', h))
|
|
86
|
-
missing.push(`127.0.0.1 ${h}`);
|
|
87
|
-
if (!hasEntry('::1', h))
|
|
88
|
-
missing.push(`::1 ${h}`);
|
|
89
|
-
}
|
|
90
|
-
if (missing.length === 0) {
|
|
91
|
-
console.log('[trust] /etc/hosts already complete (both families for every hostname).');
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
console.log(`[trust] appending to /etc/hosts (sudo):\n ${missing.join('\n ')}`);
|
|
95
|
-
const script = `printf '%s\\n' ${missing.map((l) => `'${l}'`).join(' ')} >> /etc/hosts`;
|
|
96
|
-
const r = (0, node_child_process_1.spawnSync)('sudo', ['sh', '-c', script], { stdio: 'inherit' });
|
|
97
|
-
if (r.status !== 0) {
|
|
98
|
-
console.error('[trust] /etc/hosts update failed.');
|
|
99
|
-
return { success: false };
|
|
100
|
-
}
|
|
101
|
-
// --- 3) flush DNS so the new entries take effect immediately ----------
|
|
102
|
-
(0, node_child_process_1.spawnSync)('sudo', ['sh', '-c', 'dscacheutil -flushcache; killall -HUP mDNSResponder'], { stdio: 'inherit' });
|
|
103
|
-
}
|
|
104
|
-
// --- 4) verify ------------------------------------------------------------
|
|
105
|
-
// Skip in hosts-only mode: verifying THIS workspace's (unused) CA file would falsely report "NOT TRUSTED"
|
|
106
|
-
// — the daemon serves with its own CA, and the CLI probes the real served cert's trust after this returns.
|
|
107
|
-
if (!hostsOnly) {
|
|
108
|
-
const verify = (0, node_child_process_1.spawnSync)('security', ['verify-cert', '-c', caPath, '-p', 'basic'], { stdio: 'ignore' });
|
|
109
|
-
console.log(`[trust] CA trust check: ${verify.status === 0 ? 'OK' : 'NOT TRUSTED YET (browser restart may be needed)'}`);
|
|
110
|
-
}
|
|
111
|
-
for (const h of hosts) {
|
|
112
|
-
console.log(`[trust] ${h} → https ready (hosts + cert SAN ride the gateway config)`);
|
|
113
|
-
}
|
|
114
|
-
return { success: true };
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* SHA-256 of the CA file as uppercase hex without separators — the exact format
|
|
118
|
-
* `security find-certificate -Z` prints ("SHA-256 hash: <hex>"), so the caller
|
|
119
|
-
* can substring-match the keychain listing. `undefined` when openssl can't read
|
|
120
|
-
* the file (caller then falls through to add-trusted-cert, which is idempotent).
|
|
121
|
-
*/
|
|
122
|
-
function caSha256Fingerprint(caPath) {
|
|
123
|
-
const r = (0, node_child_process_1.spawnSync)('openssl', ['x509', '-in', caPath, '-noout', '-fingerprint', '-sha256'], { encoding: 'utf8' });
|
|
124
|
-
if (r.status !== 0 || !r.stdout)
|
|
125
|
-
return undefined;
|
|
126
|
-
const hex = r.stdout.split('=')[1]?.replaceAll(':', '').trim().toUpperCase();
|
|
127
|
-
return hex && /^[0-9A-F]{64}$/.test(hex) ? hex : undefined;
|
|
128
|
-
}
|
|
129
|
-
function collectHosts(options, context) {
|
|
130
|
-
const found = [];
|
|
131
|
-
// 1) This project's embedded gateway routes (single-service setups).
|
|
132
|
-
const project = context.projectName
|
|
133
|
-
? context.projectsConfigurations?.projects[context.projectName]
|
|
134
|
-
: undefined;
|
|
135
|
-
const serveTarget = options.serveTarget ?? 'serve-hmr';
|
|
136
|
-
const routes = project?.targets?.[serveTarget]?.options?.gateway?.routes ?? [];
|
|
137
|
-
for (const r of routes) {
|
|
138
|
-
if (r.host && !r.host.includes('*'))
|
|
139
|
-
found.push(r.host);
|
|
140
|
-
}
|
|
141
|
-
// 2) Every project's `davnx` declaration — the workspace gateway picture.
|
|
142
|
-
for (const p of Object.values(context.projectsConfigurations?.projects ?? {})) {
|
|
143
|
-
try {
|
|
144
|
-
const raw = JSON.parse(fs.readFileSync(path.join(context.root, p.root, 'project.json'), 'utf8'));
|
|
145
|
-
const decl = raw.cluster ?? raw.davnx;
|
|
146
|
-
const h = decl?.host;
|
|
147
|
-
if (h && !h.includes('*')) {
|
|
148
|
-
found.push(h);
|
|
149
|
-
// socket-pool services also get internal.<host> (east-west, no middleware)
|
|
150
|
-
if (decl?.service && decl.internalHost !== false) {
|
|
151
|
-
found.push(typeof decl.internalHost === 'string' ? decl.internalHost : `internal.${h}`);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
/* projects without a project.json (package.json-inferred) — skip */
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
// The lens dashboard host is always served by the gateway (at lensmcp.local/<key>/),
|
|
160
|
-
// so it must resolve + be in the cert SANs like any other dev host.
|
|
161
|
-
return [...new Set([...found, 'lensmcp.local', ...(options.hosts ?? [])])];
|
|
162
|
-
}
|
|
1
|
+
"use strict";var v=Object.defineProperty;var p=(e,t)=>v(e,"name",{value:t,configurable:!0});var m=Object.defineProperty,d=p((e,t)=>m(e,"name",{value:t,configurable:!0}),"d");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=trustExecutor,exports.collectHosts=collectHosts;const tslib_1=require("tslib"),node_child_process_1=require("node:child_process"),fs=tslib_1.__importStar(require("node:fs")),path=tslib_1.__importStar(require("node:path")),basic_ssl_1=require("../../basic-ssl");async function trustExecutor(e,t){const o=path.join(t.root,"node_modules",".cache","davnx-webpack"),n=(0,basic_ssl_1.ensureCaSync)(o),u=process.env.LENSMCP_TRUST_HOSTS_ONLY==="1",a=collectHosts(e,t);if(a.length===0&&console.log("[trust] no concrete hostnames found (only wildcards?) \u2014 keychain step only."),process.platform!=="darwin"){console.log("[trust] non-macOS platform \u2014 do these manually:"),console.log(` \u2022 trust ${n} in your OS/browser store (Linux: update-ca-certificates / certutil)`);for(const s of a)console.log(` \u2022 /etc/hosts: "127.0.0.1 ${s}" and "::1 ${s}"`);return{success:!0}}const r=caSha256Fingerprint(n),h=u||r!==void 0&&(0,node_child_process_1.spawnSync)("security",["find-certificate","-a","-c","lensmcp local dev CA","-Z","/Library/Keychains/System.keychain"],{encoding:"utf8"}).stdout?.includes(r)===!0;if(u)console.log("[trust] hosts-only: a shared daemon serves TLS with its own CA \u2014 skipping the keychain step.");else if(h)console.log("[trust] CA already in the System keychain \u2014 skipping.");else{if(console.log(`[trust] adding CA to the System keychain (sudo will prompt): ${n}`),(0,node_child_process_1.spawnSync)("sudo",["security","add-trusted-cert","-d","-r","trustRoot","-k","/Library/Keychains/System.keychain",n],{stdio:"inherit"}).status!==0)return console.error("[trust] add-trusted-cert failed \u2014 rerun in a terminal so sudo can prompt."),{success:!1};console.log("[trust] CA trusted. Restart your browser once (it caches certificate verdicts).")}const c=fs.readFileSync("/etc/hosts","utf8"),i=d((s,f)=>c.split(`
|
|
2
|
+
`).some(S=>{const y=S.trim();if(y.startsWith("#"))return!1;const g=y.split(/\s+/);return g[0]===s&&g.slice(1).includes(f)}),"hasEntry"),l=[];for(const s of a)i("127.0.0.1",s)||l.push(`127.0.0.1 ${s}`),i("::1",s)||l.push(`::1 ${s}`);if(l.length===0)console.log("[trust] /etc/hosts already complete (both families for every hostname).");else{console.log(`[trust] appending to /etc/hosts (sudo):
|
|
3
|
+
${l.join(`
|
|
4
|
+
`)}`);const s=`printf '%s\\n' ${l.map(f=>`'${f}'`).join(" ")} >> /etc/hosts`;if((0,node_child_process_1.spawnSync)("sudo",["sh","-c",s],{stdio:"inherit"}).status!==0)return console.error("[trust] /etc/hosts update failed."),{success:!1};(0,node_child_process_1.spawnSync)("sudo",["sh","-c","dscacheutil -flushcache; killall -HUP mDNSResponder"],{stdio:"inherit"})}if(!u){const s=(0,node_child_process_1.spawnSync)("security",["verify-cert","-c",n,"-p","basic"],{stdio:"ignore"});console.log(`[trust] CA trust check: ${s.status===0?"OK":"NOT TRUSTED YET (browser restart may be needed)"}`)}for(const s of a)console.log(`[trust] ${s} \u2192 https ready (hosts + cert SAN ride the gateway config)`);return{success:!0}}p(trustExecutor,"trustExecutor"),d(trustExecutor,"trustExecutor");function caSha256Fingerprint(e){const t=(0,node_child_process_1.spawnSync)("openssl",["x509","-in",e,"-noout","-fingerprint","-sha256"],{encoding:"utf8"});if(t.status!==0||!t.stdout)return;const o=t.stdout.split("=")[1]?.replaceAll(":","").trim().toUpperCase();return o&&/^[0-9A-F]{64}$/.test(o)?o:void 0}p(caSha256Fingerprint,"caSha256Fingerprint"),d(caSha256Fingerprint,"caSha256Fingerprint");function collectHosts(e,t){const o=[],n=t.projectName?t.projectsConfigurations?.projects[t.projectName]:void 0,u=e.serveTarget??"serve-hmr",a=n?.targets?.[u]?.options?.gateway?.routes??[];for(const r of a)r.host&&!r.host.includes("*")&&o.push(r.host);for(const r of Object.values(t.projectsConfigurations?.projects??{}))try{const h=JSON.parse(fs.readFileSync(path.join(t.root,r.root,"project.json"),"utf8")),c=h.cluster??h.davnx,i=c?.host;i&&!i.includes("*")&&(o.push(i),c?.service&&c.internalHost!==!1&&o.push(typeof c.internalHost=="string"?c.internalHost:`internal.${i}`))}catch{}return[...new Set([...o,"lensmcp.local",...e.hosts??[]])]}p(collectHosts,"collectHosts"),d(collectHosts,"collectHosts");
|
package/gateway.js
CHANGED
|
@@ -1,35 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* `@lensmcp/cluster/gateway` — the PRODUCTION gateway's public, extendable surface.
|
|
4
|
-
*
|
|
5
|
-
* This is the **deployable edge** (`startProdGateway` — Fastify + undici reverse
|
|
6
|
-
* proxy, manifest-driven, the thing `Dockerfile.prod-gateway` runs). A consumer
|
|
7
|
-
* (e.g. tetros' `server/apps/gateway`) imports from here to run or extend it with
|
|
8
|
-
* its own providers/middleware and ship a specialized image.
|
|
9
|
-
*
|
|
10
|
-
* ⚠️ This is NOT the DEV cluster gateway. The dev gateway is the
|
|
11
|
-
* `@lensmcp/cluster:gateway` nx EXECUTOR (`gateway.lib.ts` → `startGateway`) — a
|
|
12
|
-
* local-only HTTPS front door on :443 that fronts unix-socket pods for
|
|
13
|
-
* development. The two share a routing core (`manifest.ts`) but are separate
|
|
14
|
-
* lifecycles: dev = an nx target you run locally; prod = a containerized service
|
|
15
|
-
* you deploy. Kept on a separate subpath so the build-time webpack-config exports
|
|
16
|
-
* in the main `@lensmcp/cluster` entry never pull in fastify/undici.
|
|
17
|
-
*/
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.manifestFromClusterDecl = exports.DEFAULT_REGISTRY_PREFIX = exports.redisRegistrySource = exports.createRegistryProviders = exports.endpointsPodProvider = exports.staticManifestProvider = exports.startProdGateway = void 0;
|
|
20
|
-
// The prod gateway engine + its option/handle contract.
|
|
21
|
-
var prod_gateway_lib_1 = require("./executors/gateway/prod-gateway.lib");
|
|
22
|
-
Object.defineProperty(exports, "startProdGateway", { enumerable: true, get: function () { return prod_gateway_lib_1.startProdGateway; } });
|
|
23
|
-
// Static (in-memory) providers — build a gateway from explicit manifests/endpoints.
|
|
24
|
-
var providers_prod_1 = require("./executors/gateway/providers-prod");
|
|
25
|
-
Object.defineProperty(exports, "staticManifestProvider", { enumerable: true, get: function () { return providers_prod_1.staticManifestProvider; } });
|
|
26
|
-
Object.defineProperty(exports, "endpointsPodProvider", { enumerable: true, get: function () { return providers_prod_1.endpointsPodProvider; } });
|
|
27
|
-
// Redis-backed registry providers — the prod path (manifests/rollout read live from Redis).
|
|
28
|
-
var registry_source_1 = require("./executors/gateway/registry-source");
|
|
29
|
-
Object.defineProperty(exports, "createRegistryProviders", { enumerable: true, get: function () { return registry_source_1.createRegistryProviders; } });
|
|
30
|
-
Object.defineProperty(exports, "redisRegistrySource", { enumerable: true, get: function () { return registry_source_1.redisRegistrySource; } });
|
|
31
|
-
Object.defineProperty(exports, "DEFAULT_REGISTRY_PREFIX", { enumerable: true, get: function () { return registry_source_1.DEFAULT_REGISTRY_PREFIX; } });
|
|
32
|
-
// Manifest/route types + the cluster-decl → manifest converter (derive prod
|
|
33
|
-
// manifests from the SAME project.json `cluster` declarations dev uses).
|
|
34
|
-
var manifest_1 = require("./executors/gateway/manifest");
|
|
35
|
-
Object.defineProperty(exports, "manifestFromClusterDecl", { enumerable: true, get: function () { return manifest_1.manifestFromClusterDecl; } });
|
|
1
|
+
"use strict";var s=Object.defineProperty;var i=(r,t)=>s(r,"name",{value:t,configurable:!0});var o=Object.defineProperty,e=i((r,t)=>o(r,"name",{value:t,configurable:!0}),"e");Object.defineProperty(exports,"__esModule",{value:!0}),exports.manifestFromClusterDecl=exports.DEFAULT_REGISTRY_PREFIX=exports.redisRegistrySource=exports.createRegistryProviders=exports.endpointsPodProvider=exports.staticManifestProvider=exports.startProdGateway=void 0;var prod_gateway_lib_1=require("./executors/gateway/prod-gateway.lib");Object.defineProperty(exports,"startProdGateway",{enumerable:!0,get:e(function(){return prod_gateway_lib_1.startProdGateway},"get")});var providers_prod_1=require("./executors/gateway/providers-prod");Object.defineProperty(exports,"staticManifestProvider",{enumerable:!0,get:e(function(){return providers_prod_1.staticManifestProvider},"get")}),Object.defineProperty(exports,"endpointsPodProvider",{enumerable:!0,get:e(function(){return providers_prod_1.endpointsPodProvider},"get")});var registry_source_1=require("./executors/gateway/registry-source");Object.defineProperty(exports,"createRegistryProviders",{enumerable:!0,get:e(function(){return registry_source_1.createRegistryProviders},"get")}),Object.defineProperty(exports,"redisRegistrySource",{enumerable:!0,get:e(function(){return registry_source_1.redisRegistrySource},"get")}),Object.defineProperty(exports,"DEFAULT_REGISTRY_PREFIX",{enumerable:!0,get:e(function(){return registry_source_1.DEFAULT_REGISTRY_PREFIX},"get")});var manifest_1=require("./executors/gateway/manifest");Object.defineProperty(exports,"manifestFromClusterDecl",{enumerable:!0,get:e(function(){return manifest_1.manifestFromClusterDecl},"get")});
|
package/index.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveEventFile = exports.publishTypecheckRun = exports.parseTscOutput = exports.parseTscDiagnosticLine = exports.buildTypecheckRunEvents = exports.appendTypecheckEvents = exports.createProdWebpackConfig = exports.createDevWebpackConfig = exports.buildScopePatterns = void 0;
|
|
4
|
-
var build_scope_patterns_1 = require("./build-scope-patterns");
|
|
5
|
-
Object.defineProperty(exports, "buildScopePatterns", { enumerable: true, get: function () { return build_scope_patterns_1.buildScopePatterns; } });
|
|
6
|
-
var create_webpack_dev_1 = require("./create-webpack-dev");
|
|
7
|
-
Object.defineProperty(exports, "createDevWebpackConfig", { enumerable: true, get: function () { return create_webpack_dev_1.createDevWebpackConfig; } });
|
|
8
|
-
var create_webpack_prod_1 = require("./create-webpack-prod");
|
|
9
|
-
Object.defineProperty(exports, "createProdWebpackConfig", { enumerable: true, get: function () { return create_webpack_prod_1.createProdWebpackConfig; } });
|
|
10
|
-
var typecheck_bus_1 = require("./typecheck-bus");
|
|
11
|
-
Object.defineProperty(exports, "appendTypecheckEvents", { enumerable: true, get: function () { return typecheck_bus_1.appendTypecheckEvents; } });
|
|
12
|
-
Object.defineProperty(exports, "buildTypecheckRunEvents", { enumerable: true, get: function () { return typecheck_bus_1.buildTypecheckRunEvents; } });
|
|
13
|
-
Object.defineProperty(exports, "parseTscDiagnosticLine", { enumerable: true, get: function () { return typecheck_bus_1.parseTscDiagnosticLine; } });
|
|
14
|
-
Object.defineProperty(exports, "parseTscOutput", { enumerable: true, get: function () { return typecheck_bus_1.parseTscOutput; } });
|
|
15
|
-
Object.defineProperty(exports, "publishTypecheckRun", { enumerable: true, get: function () { return typecheck_bus_1.publishTypecheckRun; } });
|
|
16
|
-
Object.defineProperty(exports, "resolveEventFile", { enumerable: true, get: function () { return typecheck_bus_1.resolveEventFile; } });
|
|
1
|
+
"use strict";var p=Object.defineProperty;var c=(t,r)=>p(t,"name",{value:r,configurable:!0});var n=Object.defineProperty,e=c((t,r)=>n(t,"name",{value:r,configurable:!0}),"e");Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveEventFile=exports.publishTypecheckRun=exports.parseTscOutput=exports.parseTscDiagnosticLine=exports.buildTypecheckRunEvents=exports.appendTypecheckEvents=exports.createProdWebpackConfig=exports.createDevWebpackConfig=exports.buildScopePatterns=void 0;var build_scope_patterns_1=require("./build-scope-patterns");Object.defineProperty(exports,"buildScopePatterns",{enumerable:!0,get:e(function(){return build_scope_patterns_1.buildScopePatterns},"get")});var create_webpack_dev_1=require("./create-webpack-dev");Object.defineProperty(exports,"createDevWebpackConfig",{enumerable:!0,get:e(function(){return create_webpack_dev_1.createDevWebpackConfig},"get")});var create_webpack_prod_1=require("./create-webpack-prod");Object.defineProperty(exports,"createProdWebpackConfig",{enumerable:!0,get:e(function(){return create_webpack_prod_1.createProdWebpackConfig},"get")});var typecheck_bus_1=require("./typecheck-bus");Object.defineProperty(exports,"appendTypecheckEvents",{enumerable:!0,get:e(function(){return typecheck_bus_1.appendTypecheckEvents},"get")}),Object.defineProperty(exports,"buildTypecheckRunEvents",{enumerable:!0,get:e(function(){return typecheck_bus_1.buildTypecheckRunEvents},"get")}),Object.defineProperty(exports,"parseTscDiagnosticLine",{enumerable:!0,get:e(function(){return typecheck_bus_1.parseTscDiagnosticLine},"get")}),Object.defineProperty(exports,"parseTscOutput",{enumerable:!0,get:e(function(){return typecheck_bus_1.parseTscOutput},"get")}),Object.defineProperty(exports,"publishTypecheckRun",{enumerable:!0,get:e(function(){return typecheck_bus_1.publishTypecheckRun},"get")}),Object.defineProperty(exports,"resolveEventFile",{enumerable:!0,get:e(function(){return typecheck_bus_1.resolveEventFile},"get")});
|