@caprail-dev/analytics 0.1.0 → 0.2.1
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/next.d.ts.map +1 -1
- package/dist/next.js +8 -1
- package/dist/next.js.map +1 -1
- package/package.json +2 -1
package/dist/next.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,QAAQ,CAAC;AAEpE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,QAAQ,CAAC;AAEpE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,aAAa,IAUlC,KAAK,WAAW,EAAE,IAAI,cAAc,2BAoBhE"}
|
package/dist/next.js
CHANGED
|
@@ -24,8 +24,15 @@ import { collect, resolveConfig } from "./core";
|
|
|
24
24
|
* URL and key the middleware is a transparent no-op.
|
|
25
25
|
*/
|
|
26
26
|
export function createCaprailMiddleware(options) {
|
|
27
|
+
// Reference the env vars literally (not via a `process.env` alias) so Next.js
|
|
28
|
+
// statically inlines them into the Edge bundle. A dynamic lookup is dropped
|
|
29
|
+
// there, which would make the no-arg form a silent no-op. Resolved once at
|
|
30
|
+
// module load since the values are static for the lifetime of the worker.
|
|
31
|
+
const config = resolveConfig({
|
|
32
|
+
url: options?.url ?? process.env.CAPRAIL_INGEST_URL,
|
|
33
|
+
key: options?.key ?? process.env.CAPRAIL_INGEST_KEY,
|
|
34
|
+
});
|
|
27
35
|
return function middleware(req, ev) {
|
|
28
|
-
const config = resolveConfig(options);
|
|
29
36
|
if (config) {
|
|
30
37
|
const ua = req.headers.get("user-agent");
|
|
31
38
|
ev.waitUntil(collect({
|
package/dist/next.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.js","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,YAAY,GAGb,MAAM,aAAa,CAAC;AAErB,OAAO,EAAsB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAuB;IAC7D,
|
|
1
|
+
{"version":3,"file":"next.js","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,YAAY,GAGb,MAAM,aAAa,CAAC;AAErB,OAAO,EAAsB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAuB;IAC7D,8EAA8E;IAC9E,4EAA4E;IAC5E,2EAA2E;IAC3E,0EAA0E;IAC1E,MAAM,MAAM,GAAG,aAAa,CAAC;QAC3B,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB;QACnD,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB;KACpD,CAAC,CAAC;IAEH,OAAO,SAAS,UAAU,CAAC,GAAgB,EAAE,EAAkB;QAC7D,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YACzC,EAAE,CAAC,SAAS,CACV,OAAO,CACL;gBACE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ;gBAC1B,MAAM,EAAE,GAAG,EAAE,iDAAiD;gBAC9D,SAAS,EAAE,EAAE,IAAI,SAAS;gBAC1B,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,SAAS;aAC7D,EACD,MAAM,CACP,CACF,CAAC;QACJ,CAAC;QAED,OAAO,YAAY,CAAC,IAAI,EAAE,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caprail-dev/analytics",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Edge collector for Caprail — see which AI agents access your site.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsc -p tsconfig.json",
|
|
33
|
+
"prepublishOnly": "bun run build",
|
|
33
34
|
"test": "bun test"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|