reroute-js 0.26.0 → 0.27.0
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 +12 -8
- package/cli/bin.d.ts +1 -1
- package/cli/bin.js +136 -40
- package/cli/bin.js.map +16 -13
- package/cli/index.d.ts +1 -1
- package/cli/index.js +4 -4
- package/cli/index.js.map +1 -1
- package/cli/src/cli.d.ts +1 -1
- package/cli/src/commands/analyze.d.ts +1 -1
- package/cli/src/commands/build.d.ts +1 -1
- package/cli/src/commands/build.d.ts.map +1 -1
- package/cli/src/commands/dev.d.ts +1 -1
- package/cli/src/commands/gen.d.ts +1 -1
- package/cli/src/commands/gen.d.ts.map +1 -1
- package/cli/src/commands/index.d.ts +1 -1
- package/cli/src/commands/init.d.ts +1 -1
- package/cli/src/commands/lib/assets.d.ts +1 -1
- package/cli/src/commands/lib/bundler.d.ts +1 -1
- package/cli/src/commands/lib/command.d.ts +1 -1
- package/cli/src/commands/lib/env.d.ts +1 -1
- package/cli/src/commands/lib/index.d.ts +1 -1
- package/cli/src/commands/lib/log.d.ts +1 -1
- package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
- package/cli/src/commands/lib/markdown/index.d.ts +1 -1
- package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
- package/cli/src/commands/lib/production.d.ts +1 -1
- package/cli/src/commands/lib/server.d.ts +1 -1
- package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
- package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
- package/cli/src/commands/lib/tailwind.d.ts +1 -1
- package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
- package/cli/src/commands/lib/version.d.ts +1 -1
- package/cli/src/commands/og.d.ts +1 -1
- package/cli/src/commands/start.d.ts +1 -1
- package/cli/src/index.d.ts +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +96 -9
- package/core/index.js.map +14 -11
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +41 -13
- package/core/src/config.d.ts.map +1 -1
- package/core/src/content/discovery.d.ts +1 -1
- package/core/src/content/index.d.ts +1 -1
- package/core/src/content/metadata.d.ts +1 -1
- package/core/src/index.d.ts +1 -1
- package/core/src/llms/extractor.d.ts +1 -1
- package/core/src/llms/formatter.d.ts +1 -1
- package/core/src/llms/full-generator.d.ts +1 -1
- package/core/src/llms/index-generator.d.ts +1 -1
- package/core/src/llms/index.d.ts +1 -1
- package/core/src/og/discovery.d.ts +1 -1
- package/core/src/og/index.d.ts +1 -1
- package/core/src/og/meta.d.ts +1 -1
- package/core/src/og/render.d.ts +1 -1
- package/core/src/og/types.d.ts +1 -1
- package/core/src/robots/discovery.d.ts +1 -1
- package/core/src/robots/generator.d.ts +1 -1
- package/core/src/robots/index.d.ts +1 -1
- package/core/src/robots/policies.d.ts +1 -1
- package/core/src/rss/discovery.d.ts +1 -1
- package/core/src/rss/generator.d.ts +1 -1
- package/core/src/rss/index.d.ts +1 -1
- package/core/src/sitemap/discovery.d.ts +1 -1
- package/core/src/sitemap/generator.d.ts +1 -1
- package/core/src/sitemap/index.d.ts +1 -1
- package/core/src/ssr/index.d.ts +1 -1
- package/core/src/ssr/lib/cache.d.ts +1 -1
- package/core/src/ssr/lib/collections.d.ts +1 -1
- package/core/src/ssr/lib/compression.d.ts +1 -1
- package/core/src/ssr/lib/compute/content.d.ts +1 -1
- package/core/src/ssr/lib/compute/index.d.ts +1 -1
- package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
- package/core/src/ssr/lib/compute/routes.d.ts +1 -1
- package/core/src/ssr/lib/data.d.ts +1 -1
- package/core/src/ssr/lib/html.d.ts +1 -1
- package/core/src/ssr/lib/imports.d.ts +1 -1
- package/core/src/ssr/lib/index.d.ts +1 -1
- package/core/src/ssr/lib/layouts.d.ts +1 -1
- package/core/src/ssr/lib/metadata.d.ts +1 -1
- package/core/src/ssr/lib/mime.d.ts +1 -1
- package/core/src/ssr/lib/modules.d.ts +1 -1
- package/core/src/ssr/lib/path.d.ts +1 -1
- package/core/src/ssr/lib/preload.d.ts +1 -1
- package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
- package/core/src/ssr/lib/scripts/data.d.ts +5 -2
- package/core/src/ssr/lib/scripts/data.d.ts.map +1 -1
- package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
- package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
- package/core/src/ssr/lib/scripts/index.d.ts +1 -1
- package/core/src/ssr/lib/seed.d.ts +1 -1
- package/core/src/ssr/lib/serialize.d.ts +17 -0
- package/core/src/ssr/lib/serialize.d.ts.map +1 -0
- package/core/src/ssr/lib/setup.d.ts +5 -2
- package/core/src/ssr/lib/setup.d.ts.map +1 -1
- package/core/src/ssr/lib/styles.d.ts +1 -1
- package/core/src/ssr/lib/template.d.ts +1 -1
- package/core/src/ssr/lib/types.d.ts +1 -1
- package/core/src/ssr/render.d.ts +1 -1
- package/core/src/ssr/render.d.ts.map +1 -1
- package/core/src/ssr/stream.d.ts +1 -1
- package/core/src/ssr/stream.d.ts.map +1 -1
- package/elysia/index.d.ts +1 -1
- package/elysia/index.js +96 -9
- package/elysia/index.js.map +14 -11
- package/elysia/src/index.d.ts +1 -1
- package/elysia/src/libs/assets.d.ts +1 -1
- package/elysia/src/libs/cache.d.ts +1 -1
- package/elysia/src/libs/caching.d.ts +1 -1
- package/elysia/src/libs/http.d.ts +1 -1
- package/elysia/src/libs/image.d.ts +1 -1
- package/elysia/src/libs/index.d.ts +1 -1
- package/elysia/src/libs/llms.d.ts +1 -1
- package/elysia/src/libs/response.d.ts +1 -1
- package/elysia/src/libs/serving.d.ts +1 -1
- package/elysia/src/plugin.d.ts +1 -1
- package/elysia/src/routes/artifacts.d.ts +1 -1
- package/elysia/src/routes/content.d.ts +1 -1
- package/elysia/src/routes/image.d.ts +1 -1
- package/elysia/src/routes/index.d.ts +1 -1
- package/elysia/src/routes/internal.d.ts +1 -1
- package/elysia/src/routes/llms.d.ts +1 -1
- package/elysia/src/routes/og.d.ts +1 -1
- package/elysia/src/routes/redirects.d.ts +1 -1
- package/elysia/src/routes/robots.d.ts +1 -1
- package/elysia/src/routes/rss.d.ts +1 -1
- package/elysia/src/routes/search.d.ts +1 -1
- package/elysia/src/routes/sitemap.d.ts +1 -1
- package/elysia/src/routes/ssr.d.ts +1 -1
- package/elysia/src/routes/static.d.ts +1 -1
- package/elysia/src/types.d.ts +1 -1
- package/package.json +9 -13
- package/react/index.d.ts +1 -1
- package/react/index.js +2 -2
- package/react/index.js.map +1 -1
- package/react/src/components/ClientOnly.d.ts +1 -1
- package/react/src/components/ContentRoute.d.ts +1 -1
- package/react/src/components/Image.d.ts +1 -1
- package/react/src/components/LazyRoute.d.ts +1 -1
- package/react/src/components/Link.d.ts +1 -1
- package/react/src/components/Markdown.d.ts +1 -1
- package/react/src/components/Outlet.d.ts +1 -1
- package/react/src/components/index.d.ts +1 -1
- package/react/src/hooks/index.d.ts +1 -1
- package/react/src/hooks/useContent.d.ts +1 -1
- package/react/src/hooks/useData.d.ts +1 -1
- package/react/src/hooks/useFeed.d.ts +1 -1
- package/react/src/hooks/useLayoutData.d.ts +1 -1
- package/react/src/hooks/useLlms.d.ts +1 -1
- package/react/src/hooks/useNavigate.d.ts +1 -1
- package/react/src/hooks/useParams.d.ts +1 -1
- package/react/src/hooks/useRouter.d.ts +1 -1
- package/react/src/hooks/useSearch.d.ts +1 -1
- package/react/src/hooks/useSearchParams.d.ts +1 -1
- package/react/src/hooks/useToc.d.ts +1 -1
- package/react/src/index.d.ts +1 -1
- package/react/src/lib/collection.d.ts +1 -1
- package/react/src/lib/content.d.ts +1 -1
- package/react/src/lib/head.d.ts +1 -1
- package/react/src/lib/index.d.ts +1 -1
- package/react/src/lib/lazy-route.d.ts +1 -1
- package/react/src/lib/route-loader.d.ts +1 -1
- package/react/src/providers/ContentProvider.d.ts +1 -1
- package/react/src/providers/RerouteProvider.d.ts +1 -1
- package/react/src/providers/RouterProvider.d.ts +1 -1
- package/react/src/providers/index.d.ts +1 -1
- package/react/src/types/any.d.ts +1 -1
- package/react/src/types/index.d.ts +1 -1
- package/react/src/types/router.d.ts +1 -1
- package/telemetry/react.d.ts +1 -1
- package/telemetry/react.js +539 -30
- package/telemetry/react.js.map +7 -6
- package/telemetry/server.d.ts +1 -1
- package/telemetry/server.js +304 -20
- package/telemetry/server.js.map +12 -10
- package/telemetry/src/react/api.d.ts +3 -2
- package/telemetry/src/react/api.d.ts.map +1 -1
- package/telemetry/src/react/context.d.ts +62 -0
- package/telemetry/src/react/context.d.ts.map +1 -0
- package/telemetry/src/react/index.d.ts +2 -1
- package/telemetry/src/react/index.d.ts.map +1 -1
- package/telemetry/src/react/telemetry.d.ts +4 -53
- package/telemetry/src/react/telemetry.d.ts.map +1 -1
- package/telemetry/src/server/context.d.ts +61 -0
- package/telemetry/src/server/context.d.ts.map +1 -0
- package/telemetry/src/server/index.d.ts +3 -1
- package/telemetry/src/server/index.d.ts.map +1 -1
- package/telemetry/src/server/instrumentation.d.ts +27 -2
- package/telemetry/src/server/instrumentation.d.ts.map +1 -1
- package/telemetry/src/server/plugin.d.ts +1 -1
- package/telemetry/src/server/plugin.d.ts.map +1 -1
- package/telemetry/src/server/sourcemap.d.ts +55 -0
- package/telemetry/src/server/sourcemap.d.ts.map +1 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Reroute
|
|
2
2
|
|
|
3
|
-
Reroute is a
|
|
3
|
+
Reroute is a feature-rich file-based routing framework for building fullstack React apps on top of Bun and Elysia.
|
|
4
4
|
|
|
5
5
|
## 📚 Table of Contents
|
|
6
6
|
|
|
@@ -48,6 +48,10 @@ Reroute is a dead-simple file-based routing framework for building full-stack Re
|
|
|
48
48
|
- [CLI Preview](#cli-preview)
|
|
49
49
|
- [URLs & Meta Tags](#urls--meta-tags)
|
|
50
50
|
- [Default Template](#default-template)
|
|
51
|
+
- [📊 OpenTelemetry](#-opentelemetry-optional)
|
|
52
|
+
- [Server Telemetry](#server-telemetry)
|
|
53
|
+
- [Custom Instrumentation](#custom-instrumentation)
|
|
54
|
+
- [Reroute SSR Tracing](#reroute-ssr-tracing)
|
|
51
55
|
- [📖 Learn More](#-learn-more)
|
|
52
56
|
- [📝 License](#-license)
|
|
53
57
|
|
|
@@ -1477,7 +1481,7 @@ If no `[og].tsx` exists for a route, uses built-in template with:
|
|
|
1477
1481
|
- Avatar and siteName from config
|
|
1478
1482
|
- Clean black card design
|
|
1479
1483
|
|
|
1480
|
-
## 📊 OpenTelemetry
|
|
1484
|
+
## 📊 OpenTelemetry
|
|
1481
1485
|
|
|
1482
1486
|
### Server Telemetry
|
|
1483
1487
|
|
|
@@ -1487,7 +1491,8 @@ Track HTTP requests, errors, and system metrics.
|
|
|
1487
1491
|
|
|
1488
1492
|
```bash
|
|
1489
1493
|
# Server telemetry packages
|
|
1490
|
-
bun add
|
|
1494
|
+
bun add source-map \
|
|
1495
|
+
@opentelemetry/api \
|
|
1491
1496
|
@opentelemetry/api-logs \
|
|
1492
1497
|
@opentelemetry/exporter-logs-otlp-proto \
|
|
1493
1498
|
@opentelemetry/exporter-metrics-otlp-proto \
|
|
@@ -1496,7 +1501,8 @@ bun add @opentelemetry/api \
|
|
|
1496
1501
|
@opentelemetry/sdk-logs \
|
|
1497
1502
|
@opentelemetry/sdk-metrics \
|
|
1498
1503
|
@opentelemetry/sdk-trace-node \
|
|
1499
|
-
@opentelemetry/semantic-conventions
|
|
1504
|
+
@opentelemetry/semantic-conventions \
|
|
1505
|
+
|
|
1500
1506
|
```
|
|
1501
1507
|
|
|
1502
1508
|
**Configuration** in `reroute.config.ts`:
|
|
@@ -1518,7 +1524,7 @@ export default defineConfig({
|
|
|
1518
1524
|
// Browser telemetry proxy (avoids CORS and ad blockers)
|
|
1519
1525
|
proxy: {
|
|
1520
1526
|
enabled: true, // Default when proxy is an object
|
|
1521
|
-
pathname: '/
|
|
1527
|
+
pathname: '/__reroute/telemetry', // Default
|
|
1522
1528
|
verbose: false, // Log proxy requests
|
|
1523
1529
|
},
|
|
1524
1530
|
|
|
@@ -1527,7 +1533,7 @@ export default defineConfig({
|
|
|
1527
1533
|
enabled: true,
|
|
1528
1534
|
serviceName: 'my-app-browser',
|
|
1529
1535
|
environment: process.env.NODE_ENV || 'development',
|
|
1530
|
-
otlpEndpoint: '/
|
|
1536
|
+
otlpEndpoint: '/__reroute/telemetry', // Must match proxy.pathname
|
|
1531
1537
|
enableConsoleCapture: true,
|
|
1532
1538
|
},
|
|
1533
1539
|
},
|
|
@@ -1578,8 +1584,6 @@ import { TelemetryProvider } from 'reroute-js/telemetry/react/react';
|
|
|
1578
1584
|
</TelemetryProvider>
|
|
1579
1585
|
```
|
|
1580
1586
|
|
|
1581
|
-
See [examples/landing](./examples/landing) for a complete example.
|
|
1582
|
-
|
|
1583
1587
|
### Custom Instrumentation
|
|
1584
1588
|
|
|
1585
1589
|
Create custom spans for API calls, database queries, or any operation:
|
package/cli/bin.d.ts
CHANGED
package/cli/bin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
3
|
/**
|
|
4
|
-
* reroute-js v0.
|
|
4
|
+
* reroute-js v0.27.0
|
|
5
5
|
*
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @copyright 2025 stewones <hi@stewan.io>
|
|
@@ -48,7 +48,7 @@ async function getVersionString() {
|
|
|
48
48
|
}
|
|
49
49
|
async function getVersion() {
|
|
50
50
|
if (true) {
|
|
51
|
-
return "0.
|
|
51
|
+
return "0.27.0";
|
|
52
52
|
}
|
|
53
53
|
const possiblePaths = [
|
|
54
54
|
path.join(import.meta.dir, "../../../../package.json"),
|
|
@@ -66,7 +66,7 @@ async function getVersion() {
|
|
|
66
66
|
}
|
|
67
67
|
async function getCommit() {
|
|
68
68
|
if (true) {
|
|
69
|
-
return "
|
|
69
|
+
return "f0b4a6d";
|
|
70
70
|
}
|
|
71
71
|
return "dev";
|
|
72
72
|
}
|
|
@@ -500,6 +500,13 @@ var init_content = __esm(() => {
|
|
|
500
500
|
init_metadata();
|
|
501
501
|
});
|
|
502
502
|
|
|
503
|
+
// packages/telemetry/src/server/context.ts
|
|
504
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
505
|
+
var contextStorage;
|
|
506
|
+
var init_context = __esm(() => {
|
|
507
|
+
contextStorage = new AsyncLocalStorage;
|
|
508
|
+
});
|
|
509
|
+
|
|
503
510
|
// packages/telemetry/src/server/instrumentation.ts
|
|
504
511
|
import { context, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
505
512
|
function isOtelAvailable() {
|
|
@@ -599,13 +606,38 @@ async function withParentSpan(parentSpan, fn) {
|
|
|
599
606
|
const ctx = trace.setSpan(context.active(), parentSpan);
|
|
600
607
|
return context.with(ctx, fn);
|
|
601
608
|
}
|
|
609
|
+
function getTraceContextForInjection(span) {
|
|
610
|
+
if (!(isOtelAvailable() && span))
|
|
611
|
+
return;
|
|
612
|
+
try {
|
|
613
|
+
const { propagation } = __require("@opentelemetry/api");
|
|
614
|
+
const carrier = {};
|
|
615
|
+
const ctx = trace.setSpan(context.active(), span);
|
|
616
|
+
propagation.inject(ctx, carrier);
|
|
617
|
+
return {
|
|
618
|
+
traceparent: carrier.traceparent,
|
|
619
|
+
tracestate: carrier.tracestate
|
|
620
|
+
};
|
|
621
|
+
} catch (error) {
|
|
622
|
+
console.error("[telemetry] Failed to get trace context for injection:", error);
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
602
626
|
var otelAvailable, noopSpan;
|
|
603
627
|
var init_instrumentation = __esm(() => {
|
|
604
628
|
noopSpan = new NoopSpan;
|
|
605
629
|
});
|
|
606
630
|
|
|
631
|
+
// packages/telemetry/src/server/sourcemap.ts
|
|
632
|
+
import { SourceMapConsumer } from "source-map";
|
|
633
|
+
var sourcemapCache;
|
|
634
|
+
var init_sourcemap = __esm(() => {
|
|
635
|
+
sourcemapCache = new Map;
|
|
636
|
+
});
|
|
637
|
+
|
|
607
638
|
// packages/telemetry/src/server/plugin.ts
|
|
608
639
|
import {
|
|
640
|
+
context as context2,
|
|
609
641
|
metrics,
|
|
610
642
|
SpanStatusCode as SpanStatusCode2,
|
|
611
643
|
trace as trace2
|
|
@@ -634,12 +666,17 @@ import {
|
|
|
634
666
|
import { ATTR_HOST_NAME } from "@opentelemetry/semantic-conventions/incubating";
|
|
635
667
|
var init_plugin = __esm(() => {
|
|
636
668
|
init_core();
|
|
669
|
+
init_context();
|
|
670
|
+
init_instrumentation();
|
|
671
|
+
init_sourcemap();
|
|
637
672
|
});
|
|
638
673
|
|
|
639
674
|
// packages/telemetry/src/server/index.ts
|
|
640
675
|
var init_server = __esm(() => {
|
|
676
|
+
init_context();
|
|
641
677
|
init_instrumentation();
|
|
642
678
|
init_plugin();
|
|
679
|
+
init_sourcemap();
|
|
643
680
|
});
|
|
644
681
|
|
|
645
682
|
// packages/telemetry/server.ts
|
|
@@ -2475,13 +2512,26 @@ function createTelemetryConfigScript(browserTelemetryConfig) {
|
|
|
2475
2512
|
return "";
|
|
2476
2513
|
}
|
|
2477
2514
|
}
|
|
2478
|
-
function
|
|
2515
|
+
function createTraceContextScript(traceContext) {
|
|
2516
|
+
if (!traceContext?.traceparent || typeof traceContext.traceparent !== "string") {
|
|
2517
|
+
return "";
|
|
2518
|
+
}
|
|
2519
|
+
try {
|
|
2520
|
+
const contextJson = escapeJsonForScript(JSON.stringify(traceContext));
|
|
2521
|
+
return `<script>(function(){try{var w=(typeof window!=='undefined'?window:globalThis);w.__REROUTE_TRACE_CONTEXT__=${contextJson};}catch(e){}})();</script>`;
|
|
2522
|
+
} catch (error) {
|
|
2523
|
+
console.error("[reroute] Failed to serialize trace context:", error);
|
|
2524
|
+
return "";
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
function createDataScript(ssrData, errorMsg, pathname, browserTelemetryConfig, traceContext) {
|
|
2479
2528
|
let script = "";
|
|
2480
2529
|
script += createContentCaptureScript();
|
|
2481
2530
|
if (pathname) {
|
|
2482
2531
|
script += createSSRExportsScript(pathname);
|
|
2483
2532
|
}
|
|
2484
2533
|
script += createTelemetryConfigScript(browserTelemetryConfig);
|
|
2534
|
+
script += createTraceContextScript(traceContext);
|
|
2485
2535
|
if (ssrData && Object.keys(ssrData).length > 0) {
|
|
2486
2536
|
try {
|
|
2487
2537
|
const duplicatedData = duplicateQueryParamData(ssrData);
|
|
@@ -2704,10 +2754,10 @@ function generateCollectionScripts(byCollectionForSSR) {
|
|
|
2704
2754
|
} catch {}
|
|
2705
2755
|
return "";
|
|
2706
2756
|
}
|
|
2707
|
-
function generateHydrationScripts(ssrData, isWatchMode, ssrError, collectionScripts = "", preloadScript = "", bundleUrl = "", pathname = "", browserTelemetryConfig) {
|
|
2757
|
+
function generateHydrationScripts(ssrData, isWatchMode, ssrError, collectionScripts = "", preloadScript = "", bundleUrl = "", pathname = "", browserTelemetryConfig, traceContext) {
|
|
2708
2758
|
let scripts = preloadScript;
|
|
2709
2759
|
scripts += collectionScripts;
|
|
2710
|
-
scripts += createDataScript(ssrData, isWatchMode ? ssrError : undefined, pathname, browserTelemetryConfig);
|
|
2760
|
+
scripts += createDataScript(ssrData, isWatchMode ? ssrError : undefined, pathname, browserTelemetryConfig, traceContext);
|
|
2711
2761
|
scripts += createFeedsScript();
|
|
2712
2762
|
scripts += createLlmsScript();
|
|
2713
2763
|
if (bundleUrl) {
|
|
@@ -2764,6 +2814,36 @@ var init_lib = __esm(() => {
|
|
|
2764
2814
|
init_styles();
|
|
2765
2815
|
});
|
|
2766
2816
|
|
|
2817
|
+
// packages/core/src/ssr/lib/serialize.ts
|
|
2818
|
+
var exports_serialize = {};
|
|
2819
|
+
__export(exports_serialize, {
|
|
2820
|
+
serializeBrowserTelemetryConfig: () => serializeBrowserTelemetryConfig
|
|
2821
|
+
});
|
|
2822
|
+
function serializeBrowserTelemetryConfig(config) {
|
|
2823
|
+
if (!config)
|
|
2824
|
+
return;
|
|
2825
|
+
const serialized = {};
|
|
2826
|
+
for (const [key, value] of Object.entries(config)) {
|
|
2827
|
+
if (key === "ignoreRoutes" && Array.isArray(value)) {
|
|
2828
|
+
serialized[key] = value.map((pattern) => {
|
|
2829
|
+
if (typeof pattern === "string") {
|
|
2830
|
+
return { type: "string", value: pattern };
|
|
2831
|
+
}
|
|
2832
|
+
if (pattern instanceof RegExp) {
|
|
2833
|
+
return { type: "regex", value: pattern.source, flags: pattern.flags };
|
|
2834
|
+
}
|
|
2835
|
+
if (typeof pattern === "function") {
|
|
2836
|
+
return { type: "function", value: pattern.toString() };
|
|
2837
|
+
}
|
|
2838
|
+
return pattern;
|
|
2839
|
+
});
|
|
2840
|
+
} else {
|
|
2841
|
+
serialized[key] = value;
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
return serialized;
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2767
2847
|
// packages/core/src/ssr/render.ts
|
|
2768
2848
|
import dedent from "dedent";
|
|
2769
2849
|
import { cloneElement } from "react";
|
|
@@ -2815,9 +2895,12 @@ async function renderSSRDocument(options) {
|
|
|
2815
2895
|
});
|
|
2816
2896
|
const collectionScripts = generateCollectionScripts(setup2.byCollectionForSSR);
|
|
2817
2897
|
const config = await loadConfig(cwd);
|
|
2818
|
-
const
|
|
2898
|
+
const browserTelemetryConfigRaw = config.telemetry?.browser;
|
|
2899
|
+
const { serializeBrowserTelemetryConfig: serializeBrowserTelemetryConfig2 } = await Promise.resolve().then(() => exports_serialize);
|
|
2900
|
+
const browserTelemetryConfig = serializeBrowserTelemetryConfig2(browserTelemetryConfigRaw);
|
|
2901
|
+
const traceContext = getTraceContextForInjection(options.parentSpan);
|
|
2819
2902
|
const hydrationScript = await withSpan("ssr.generate.scripts", async (span) => {
|
|
2820
|
-
const script = generateHydrationScripts(setup2.ssrData, isWatchMode, setup2.ssrError, collectionScripts, setup2.preloadHydrationScript, bundleUrl, pathname, browserTelemetryConfig);
|
|
2903
|
+
const script = generateHydrationScripts(setup2.ssrData, isWatchMode, setup2.ssrError, collectionScripts, setup2.preloadHydrationScript, bundleUrl, pathname, browserTelemetryConfig, traceContext);
|
|
2821
2904
|
span.setAttribute("reroute.scripts.size", script.length);
|
|
2822
2905
|
return script;
|
|
2823
2906
|
});
|
|
@@ -4829,7 +4912,10 @@ async function renderSSRDocumentStream(options) {
|
|
|
4829
4912
|
headWithLang = headWithLang.replace(/<meta\s+name\s*=\s*['"]description['"][^>]*>/i, "");
|
|
4830
4913
|
}
|
|
4831
4914
|
const config = await loadConfig(cwd);
|
|
4832
|
-
const
|
|
4915
|
+
const browserTelemetryConfigRaw = config.telemetry?.browser;
|
|
4916
|
+
const { serializeBrowserTelemetryConfig: serializeBrowserTelemetryConfig2 } = await Promise.resolve().then(() => exports_serialize);
|
|
4917
|
+
const browserTelemetryConfig = serializeBrowserTelemetryConfig2(browserTelemetryConfigRaw);
|
|
4918
|
+
const traceContext = getTraceContextForInjection(options.parentSpan);
|
|
4833
4919
|
streamSSRContent(writer, encoder, {
|
|
4834
4920
|
rootComponent,
|
|
4835
4921
|
pathname,
|
|
@@ -4850,6 +4936,7 @@ async function renderSSRDocumentStream(options) {
|
|
|
4850
4936
|
byCollectionForSSR: setup2.byCollectionForSSR,
|
|
4851
4937
|
preloadHydrationScript: setup2.preloadHydrationScript,
|
|
4852
4938
|
browserTelemetryConfig,
|
|
4939
|
+
traceContext,
|
|
4853
4940
|
parentSpan: options.parentSpan
|
|
4854
4941
|
});
|
|
4855
4942
|
if (debug)
|
|
@@ -4954,7 +5041,7 @@ function buildStreamingScripts(ctx) {
|
|
|
4954
5041
|
ssrDataSnapshot[key] = value;
|
|
4955
5042
|
}
|
|
4956
5043
|
}
|
|
4957
|
-
const dataScript = createDataScript(ssrDataSnapshot, ctx.isWatchMode ? ctx.ssrError : undefined, ctx.pathname, ctx.browserTelemetryConfig);
|
|
5044
|
+
const dataScript = createDataScript(ssrDataSnapshot, ctx.isWatchMode ? ctx.ssrError : undefined, ctx.pathname, ctx.browserTelemetryConfig, ctx.traceContext);
|
|
4958
5045
|
const feedsScript = createFeedsScript();
|
|
4959
5046
|
const llmsScript = createLlmsScript();
|
|
4960
5047
|
let allScripts = dataScript + feedsScript + llmsScript + collectionScripts + ctx.preloadHydrationScript;
|
|
@@ -6774,7 +6861,15 @@ async function buildEntrypointBundle(cwd, args = []) {
|
|
|
6774
6861
|
"import.meta.env.MODE": isProd ? '"production"' : '"development"',
|
|
6775
6862
|
...envDefines
|
|
6776
6863
|
},
|
|
6777
|
-
...isProd ? {
|
|
6864
|
+
...isProd ? {
|
|
6865
|
+
drop: [
|
|
6866
|
+
"console.log",
|
|
6867
|
+
"console.debug",
|
|
6868
|
+
"console.info",
|
|
6869
|
+
"console.warn",
|
|
6870
|
+
"debugger"
|
|
6871
|
+
]
|
|
6872
|
+
} : {}
|
|
6778
6873
|
});
|
|
6779
6874
|
if (!result.success) {
|
|
6780
6875
|
console.error("[reroute/gen] Entrypoint build failed:");
|
|
@@ -80776,12 +80871,12 @@ var require_lcd = __commonJS((exports, module) => {
|
|
|
80776
80871
|
}
|
|
80777
80872
|
return flipped;
|
|
80778
80873
|
}
|
|
80779
|
-
function Draw(
|
|
80780
|
-
|
|
80781
|
-
|
|
80874
|
+
function Draw(context4, elements) {
|
|
80875
|
+
context4.clearRect(this.X, this.Y, this.Width, this.Height);
|
|
80876
|
+
context4.save();
|
|
80782
80877
|
var elementWidth = this.CalcElementDimensions().Width;
|
|
80783
|
-
|
|
80784
|
-
|
|
80878
|
+
context4.translate(this.X, this.Y);
|
|
80879
|
+
context4.translate(this.Padding, this.Padding);
|
|
80785
80880
|
for (var i = 0;i < elements.length; i++) {
|
|
80786
80881
|
var element = elements[i];
|
|
80787
80882
|
for (var s = 0;s < this.Points.length; s++) {
|
|
@@ -80789,28 +80884,28 @@ var require_lcd = __commonJS((exports, module) => {
|
|
|
80789
80884
|
var stroke = element & 1 << s ? this.StrokeLight : this.StrokeDark;
|
|
80790
80885
|
if (stroke == this.StrokeDark)
|
|
80791
80886
|
continue;
|
|
80792
|
-
|
|
80793
|
-
|
|
80794
|
-
|
|
80795
|
-
|
|
80796
|
-
|
|
80797
|
-
|
|
80887
|
+
context4.lineWidth = this.StrokeWidth;
|
|
80888
|
+
context4.strokeStyle = stroke;
|
|
80889
|
+
context4.fillStyle = color;
|
|
80890
|
+
context4.moveTo(0, 0);
|
|
80891
|
+
context4.beginPath();
|
|
80892
|
+
context4.moveTo(this.Points[s][0].x, this.Points[s][0].y);
|
|
80798
80893
|
var maxX = 0;
|
|
80799
80894
|
for (var p = 1;p < this.Points[s].length; p++) {
|
|
80800
80895
|
if (this.Points[s][p].x > maxX)
|
|
80801
80896
|
maxX = this.Points[s][p].x;
|
|
80802
|
-
|
|
80897
|
+
context4.lineTo(Math.round(this.Points[s][p].x), Math.round(this.Points[s][p].y));
|
|
80803
80898
|
}
|
|
80804
|
-
|
|
80805
|
-
|
|
80806
|
-
|
|
80899
|
+
context4.closePath();
|
|
80900
|
+
context4.fill();
|
|
80901
|
+
context4.stroke();
|
|
80807
80902
|
if (this.StrokeWidth > 0) {
|
|
80808
|
-
|
|
80903
|
+
context4.stroke();
|
|
80809
80904
|
}
|
|
80810
80905
|
}
|
|
80811
|
-
|
|
80906
|
+
context4.translate(elementWidth + this.Spacing, 0);
|
|
80812
80907
|
}
|
|
80813
|
-
|
|
80908
|
+
context4.restore();
|
|
80814
80909
|
}
|
|
80815
80910
|
function CalcPoints() {
|
|
80816
80911
|
var w = this.ElementWidth, h = this.ElementHeight, sw = this.SegmentWidth * w, si = this.SegmentInterval * w, bw = this.BevelWidth * sw, ib = this.SideBevelEnabled ? 1 : 0, sf = sw * 0.8, slope = h / w, sqrt2 = Math.SQRT2, sqrt3 = Math.sqrt(3);
|
|
@@ -96849,11 +96944,11 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
96849
96944
|
function unicodeWords(string) {
|
|
96850
96945
|
return string.match(reUnicodeWord) || [];
|
|
96851
96946
|
}
|
|
96852
|
-
var runInContext = function runInContext(
|
|
96853
|
-
|
|
96854
|
-
var { Array: Array2, Date: Date2, Error: Error2, Function: Function2, Math: Math2, Object: Object2, RegExp: RegExp2, String: String2, TypeError: TypeError2 } =
|
|
96947
|
+
var runInContext = function runInContext(context4) {
|
|
96948
|
+
context4 = context4 == null ? root : _.defaults(root.Object(), context4, _.pick(root, contextProps));
|
|
96949
|
+
var { Array: Array2, Date: Date2, Error: Error2, Function: Function2, Math: Math2, Object: Object2, RegExp: RegExp2, String: String2, TypeError: TypeError2 } = context4;
|
|
96855
96950
|
var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
|
|
96856
|
-
var coreJsData =
|
|
96951
|
+
var coreJsData = context4["__core-js_shared__"];
|
|
96857
96952
|
var funcToString = funcProto.toString;
|
|
96858
96953
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
96859
96954
|
var idCounter = 0;
|
|
@@ -96865,7 +96960,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
96865
96960
|
var objectCtorString = funcToString.call(Object2);
|
|
96866
96961
|
var oldDash = root._;
|
|
96867
96962
|
var reIsNative = RegExp2("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
|
96868
|
-
var Buffer2 = moduleExports ?
|
|
96963
|
+
var Buffer2 = moduleExports ? context4.Buffer : undefined2, Symbol2 = context4.Symbol, Uint8Array2 = context4.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
|
|
96869
96964
|
var defineProperty = function() {
|
|
96870
96965
|
try {
|
|
96871
96966
|
var func = getNative(Object2, "defineProperty");
|
|
@@ -96873,9 +96968,9 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
96873
96968
|
return func;
|
|
96874
96969
|
} catch (e) {}
|
|
96875
96970
|
}();
|
|
96876
|
-
var ctxClearTimeout =
|
|
96877
|
-
var { ceil: nativeCeil, floor: nativeFloor } = Math2, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite =
|
|
96878
|
-
var DataView = getNative(
|
|
96971
|
+
var ctxClearTimeout = context4.clearTimeout !== root.clearTimeout && context4.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context4.setTimeout !== root.setTimeout && context4.setTimeout;
|
|
96972
|
+
var { ceil: nativeCeil, floor: nativeFloor } = Math2, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context4.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context4.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
|
|
96973
|
+
var DataView = getNative(context4, "DataView"), Map2 = getNative(context4, "Map"), Promise2 = getNative(context4, "Promise"), Set2 = getNative(context4, "Set"), WeakMap2 = getNative(context4, "WeakMap"), nativeCreate = getNative(Object2, "create");
|
|
96879
96974
|
var metaMap = WeakMap2 && new WeakMap2;
|
|
96880
96975
|
var realNames = {};
|
|
96881
96976
|
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
|
|
@@ -102492,6 +102587,7 @@ async function buildBundle(cwd, buildArgs) {
|
|
|
102492
102587
|
entrypoints: [join13(cwd, ".reroute/entry.ts")],
|
|
102493
102588
|
target: "bun",
|
|
102494
102589
|
outdir: join13(cwd, "dist"),
|
|
102590
|
+
sourcemap: "external",
|
|
102495
102591
|
...getCommonBuildOptions(),
|
|
102496
102592
|
external: ["sharp", ...buildArgs.externalArgs],
|
|
102497
102593
|
naming: getNamingConfig({
|
|
@@ -105175,7 +105271,7 @@ async function getVersionString2() {
|
|
|
105175
105271
|
}
|
|
105176
105272
|
async function getVersion2() {
|
|
105177
105273
|
if (true) {
|
|
105178
|
-
return "0.
|
|
105274
|
+
return "0.27.0";
|
|
105179
105275
|
}
|
|
105180
105276
|
const possiblePaths = [
|
|
105181
105277
|
path3.join(import.meta.dir, "../../../package.json"),
|
|
@@ -105192,10 +105288,10 @@ async function getVersion2() {
|
|
|
105192
105288
|
}
|
|
105193
105289
|
async function getCommit2() {
|
|
105194
105290
|
if (true) {
|
|
105195
|
-
return "
|
|
105291
|
+
return "f0b4a6d";
|
|
105196
105292
|
}
|
|
105197
105293
|
return "dev";
|
|
105198
105294
|
}
|
|
105199
105295
|
main();
|
|
105200
105296
|
|
|
105201
|
-
//# debugId=
|
|
105297
|
+
//# debugId=5DDD55BE309F0B0C64756E2164756E21
|