@absolutejs/absolute 0.20.0-beta.164 → 0.20.0-beta.166

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/dist/cli/index.js CHANGED
@@ -233,7 +233,7 @@ if (command === "dev") {
233
233
  setupMkcert();
234
234
  } else if (command === "tunnel-relay") {
235
235
  sendTelemetryEvent("cli:command", { command });
236
- const { tunnelRelay } = await import("./tunnelRelay-19ay0fxn.js");
236
+ const { tunnelRelay } = await import("./tunnelRelay-23zsvsfm.js");
237
237
  tunnelRelay();
238
238
  } else {
239
239
  const message = command ? `Unknown command: ${command}` : "No command specified";
@@ -7,6 +7,16 @@ import {
7
7
  } from "./index-hg54jyts.js";
8
8
 
9
9
  // src/dev/tunnel/relay.ts
10
+ var parseTunnelPublicRoutes = (value) => {
11
+ const routes = JSON.parse(value);
12
+ if (!Array.isArray(routes))
13
+ throw new Error("Tunnel public routes must be an array");
14
+ return routes.map((route) => {
15
+ if (!route || typeof route !== "object" || !("path" in route) || !("method" in route) || typeof route.path !== "string" || typeof route.method !== "string" || !/^[A-Z]+$/.test(route.method) || !/^\/(?:[A-Za-z0-9_.~-]+\/?)*$/.test(route.path) || new URL(route.path, "https://relay.invalid").pathname !== route.path || route.path === TUNNEL_CONTROL_PATH)
16
+ throw new Error("Tunnel public routes require an exact canonical path and uppercase method");
17
+ return { method: route.method, path: route.path };
18
+ });
19
+ };
10
20
  var DEFAULT_RELAY_PORT = 8787;
11
21
  var DEFAULT_REQUEST_TIMEOUT_MS = 30000;
12
22
  var headersToObject = (headers) => {
@@ -17,6 +27,9 @@ var headersToObject = (headers) => {
17
27
  return out;
18
28
  };
19
29
  var startTunnelRelay = (options) => {
30
+ if (options.healthPath !== undefined)
31
+ parseTunnelPublicRoutes(JSON.stringify([{ method: "GET", path: options.healthPath }]));
32
+ const publicRoutes = options.publicRoutes === undefined ? undefined : parseTunnelPublicRoutes(JSON.stringify(options.publicRoutes));
20
33
  const port = options.port ?? (Number(process.env.PORT) || DEFAULT_RELAY_PORT);
21
34
  const requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
22
35
  let client = null;
@@ -104,6 +117,8 @@ var startTunnelRelay = (options) => {
104
117
  },
105
118
  async fetch(request, srv) {
106
119
  const url = new URL(request.url);
120
+ if (options.healthPath && url.pathname === options.healthPath && request.method === "GET")
121
+ return new Response(null, { status: 204 });
107
122
  if (url.pathname === TUNNEL_CONTROL_PATH) {
108
123
  if (url.searchParams.get("token") !== options.token) {
109
124
  return new Response("Forbidden", { status: 403 });
@@ -113,6 +128,8 @@ var startTunnelRelay = (options) => {
113
128
  });
114
129
  return upgraded ? undefined : new Response("Upgrade failed", { status: 426 });
115
130
  }
131
+ if (publicRoutes && (isWebSocketUpgrade(request) || !publicRoutes.some((route) => route.path === url.pathname && route.method === request.method)))
132
+ return new Response("Not found", { status: 404 });
116
133
  if (!client) {
117
134
  return new Response("Tunnel offline: no dev client connected.", { status: 503 });
118
135
  }
@@ -169,8 +186,11 @@ var tunnelRelay = () => {
169
186
  console.error("[tunnel-relay] ABSOLUTE_TUNNEL_TOKEN is required.");
170
187
  process.exit(1);
171
188
  }
189
+ const routes = process.env.ABSOLUTE_TUNNEL_PUBLIC_ROUTES;
172
190
  startTunnelRelay({
191
+ healthPath: process.env.ABSOLUTE_TUNNEL_HEALTH_PATH,
173
192
  port: Number(process.env.PORT) || undefined,
193
+ publicRoutes: routes === undefined ? undefined : parseTunnelPublicRoutes(routes),
174
194
  publicUrl: process.env.ABSOLUTE_TUNNEL_PUBLIC_URL,
175
195
  token
176
196
  });
package/dist/index.js CHANGED
@@ -17018,7 +17018,7 @@ var resolveBuildDevelopmentMode = (mode, nodeEnv) => mode === "development" || m
17018
17018
  __VUE_OPTIONS_API__: "true",
17019
17019
  __VUE_PROD_DEVTOOLS__: development ? "true" : "false",
17020
17020
  __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: development ? "true" : "false"
17021
- });
17021
+ }), resolveClientDefine = (development, define = {}) => development ? define : { ...define, "process.env.NODE_ENV": '"production"' };
17022
17022
 
17023
17023
  // src/utils/commonAncestor.ts
17024
17024
  var commonAncestor = (paths, fallback) => {
@@ -26413,6 +26413,8 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
26413
26413
  const buildStart = performance.now();
26414
26414
  const isDev = resolveBuildDevelopmentMode(mode, env3.NODE_ENV);
26415
26415
  const vueFeatureFlags = resolveVueFeatureFlags(isDev);
26416
+ const clientDefine = resolveClientDefine(isDev);
26417
+ const clientDefineWithVue = resolveClientDefine(isDev, vueDirectory ? vueFeatureFlags : {});
26416
26418
  const projectRoot = cwd();
26417
26419
  const devServerExternalsPlugins = isDev ? [
26418
26420
  createDevServerExternalsPlugin({
@@ -27201,6 +27203,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
27201
27203
  const htmlScriptPlugin = hmr ? createHTMLScriptHMRPlugin(htmlDir, htmxDir) : undefined;
27202
27204
  const reactBuildConfig = reactClientEntryPoints.length > 0 ? mergeBunBuildConfig({
27203
27205
  banner: pwaArtifacts?.bootstrapBanner,
27206
+ define: clientDefine,
27204
27207
  entrypoints: reactClientEntryPoints,
27205
27208
  external: [
27206
27209
  ...new Set([
@@ -27279,7 +27282,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
27279
27282
  nonReactClientEntryPoints.length > 0 ? tracePhase("bun/non-react-client", () => bunBuild7(mergeBunBuildConfig({
27280
27283
  banner: pwaArtifacts?.bootstrapBanner,
27281
27284
  conditions: svelteResolveConditions,
27282
- define: vueDirectory ? vueFeatureFlags : undefined,
27285
+ define: clientDefineWithVue,
27283
27286
  entrypoints: nonReactClientEntryPoints,
27284
27287
  external: Object.keys(nonReactExternalPaths),
27285
27288
  format: "esm",
@@ -27308,6 +27311,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
27308
27311
  }, resolveBunBuildOverride(bunBuildConfig, "nonReactClient")))) : undefined,
27309
27312
  urlReferencedFiles.length > 0 ? tracePhase("bun/worker-client", () => bunBuild7(mergeBunBuildConfig({
27310
27313
  conditions: svelteResolveConditions,
27314
+ define: clientDefine,
27311
27315
  entrypoints: urlReferencedFiles,
27312
27316
  external: Object.keys(nonReactExternalPaths),
27313
27317
  format: "esm",
@@ -27325,7 +27329,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
27325
27329
  islandClientEntryPoints.length > 0 ? tracePhase("bun/island-client", () => bunBuild7(mergeBunBuildConfig({
27326
27330
  banner: pwaArtifacts?.bootstrapBanner,
27327
27331
  conditions: svelteResolveConditions,
27328
- define: vueDirectory ? vueFeatureFlags : undefined,
27332
+ define: clientDefineWithVue,
27329
27333
  entrypoints: islandClientEntryPoints,
27330
27334
  external: Object.keys(nonReactExternalPaths),
27331
27335
  format: "esm",
@@ -44200,5 +44204,5 @@ export {
44200
44204
  wrapPageHandlerWithStreamingSlots
44201
44205
  };
44202
44206
 
44203
- //# debugId=213BD413FC42A0A164756E2164756E21
44207
+ //# debugId=0EC9A0E0BF56988964756E2164756E21
44204
44208
  //# sourceMappingURL=index.js.map