@sypnia/telemetry 0.0.0-stage → 0.3.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.
@@ -0,0 +1,2 @@
1
+ export { routeNamer } from './chunk-2RMEOMSD.js';
2
+ import './chunk-P5DK2OU7.js';
@@ -0,0 +1,35 @@
1
+ import { pathnameOf, routeOf } from './chunk-P5DK2OU7.js';
2
+ import { readFileSync } from 'fs';
3
+ import { resolve } from 'path';
4
+
5
+ function compile(routes) {
6
+ const out = [];
7
+ for (const route of routes ?? []) {
8
+ if (typeof route.page !== "string" || typeof route.regex !== "string") continue;
9
+ try {
10
+ out.push({ page: route.page, pattern: new RegExp(route.regex) });
11
+ } catch {
12
+ }
13
+ }
14
+ return out;
15
+ }
16
+ function routeResolver(manifest, basePath = "") {
17
+ const base = typeof manifest.basePath === "string" && manifest.basePath ? manifest.basePath : basePath;
18
+ const routes = [...compile(manifest.staticRoutes), ...compile(manifest.dynamicRoutes)];
19
+ return (pathname) => {
20
+ let path = pathnameOf(pathname);
21
+ if (base && (path === base || path.startsWith(`${base}/`))) path = path.slice(base.length) || "/";
22
+ const found = routes.find((route) => route.pattern.test(path));
23
+ return found ? found.page : routeOf(path);
24
+ };
25
+ }
26
+ function loadRouteResolver(distDir, basePath, cwd = process.cwd()) {
27
+ try {
28
+ const manifest = JSON.parse(readFileSync(resolve(cwd, distDir, "routes-manifest.json"), "utf8"));
29
+ return routeResolver(manifest, basePath);
30
+ } catch {
31
+ return null;
32
+ }
33
+ }
34
+
35
+ export { loadRouteResolver, routeResolver };
@@ -0,0 +1,2 @@
1
+ export { startNode } from './chunk-LBKUMS7U.js';
2
+ import './chunk-WUAOTFVV.js';
package/package.json CHANGED
@@ -1,6 +1,105 @@
1
1
  {
2
2
  "name": "@sypnia/telemetry",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.0",
4
+ "description": "Sypnia Telemetry: errors, sessions, replays, performance and traces for the browser, Node and Next.js, in one package.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "homepage": "https://telemetry.docs.sypnia.com",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/sespinosav/sypnia-js.git",
11
+ "directory": "packages/telemetry"
12
+ },
13
+ "keywords": [
14
+ "sypnia",
15
+ "telemetry",
16
+ "observability",
17
+ "errors",
18
+ "session-replay",
19
+ "tracing",
20
+ "nextjs"
21
+ ],
22
+ "sideEffects": false,
23
+ "exports": {
24
+ "./browser": {
25
+ "types": "./dist/browser/index.d.ts",
26
+ "import": "./dist/browser/index.js"
27
+ },
28
+ "./node": {
29
+ "types": "./dist/node/index.d.ts",
30
+ "import": "./dist/node/index.js"
31
+ },
32
+ "./next": {
33
+ "types": "./dist/next/index.d.ts",
34
+ "import": "./dist/next/index.js"
35
+ },
36
+ "./next/client": {
37
+ "types": "./dist/next/client.d.ts",
38
+ "import": "./dist/next/client.js"
39
+ },
40
+ "./next/server": {
41
+ "types": "./dist/next/server.d.ts",
42
+ "import": "./dist/next/server.js"
43
+ },
44
+ "./next/opennext": {
45
+ "types": "./dist/next/opennext.d.ts",
46
+ "import": "./dist/next/opennext.js"
47
+ },
48
+ "./package.json": "./package.json"
49
+ },
50
+ "typesVersions": {
51
+ "*": {
52
+ "browser": [
53
+ "./dist/browser/index.d.ts"
54
+ ],
55
+ "node": [
56
+ "./dist/node/index.d.ts"
57
+ ],
58
+ "next": [
59
+ "./dist/next/index.d.ts"
60
+ ],
61
+ "next/client": [
62
+ "./dist/next/client.d.ts"
63
+ ],
64
+ "next/server": [
65
+ "./dist/next/server.d.ts"
66
+ ],
67
+ "next/opennext": [
68
+ "./dist/next/opennext.d.ts"
69
+ ]
70
+ }
71
+ },
72
+ "files": [
73
+ "dist",
74
+ "README.md",
75
+ "CHANGELOG.md",
76
+ "LICENSE"
77
+ ],
78
+ "engines": {
79
+ "node": ">=20"
80
+ },
81
+ "scripts": {
82
+ "build": "tsup",
83
+ "typecheck": "tsc -p tsconfig.json"
84
+ },
85
+ "dependencies": {
86
+ "rrweb": "2.1.6",
87
+ "rrweb-snapshot": "2.1.6"
88
+ },
89
+ "peerDependencies": {
90
+ "next": ">=15.3"
91
+ },
92
+ "peerDependenciesMeta": {
93
+ "next": {
94
+ "optional": true
95
+ }
96
+ },
97
+ "publishConfig": {
98
+ "access": "public"
99
+ },
100
+ "devDependencies": {
101
+ "@sypnia/shared": "workspace:*",
102
+ "pg": "^8.13.0",
103
+ "@types/pg": "^8.11.0"
104
+ }
105
+ }