@justanalyticsapp/node 0.2.1 → 0.3.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/client.d.ts +23 -1
- package/dist/client.js +139 -1
- package/dist/client.js.map +1 -1
- package/dist/integrations/axios-integration.d.ts +53 -0
- package/dist/integrations/axios-integration.js +217 -0
- package/dist/integrations/axios-integration.js.map +1 -0
- package/dist/integrations/drizzle.d.ts +54 -0
- package/dist/integrations/drizzle.js +236 -0
- package/dist/integrations/drizzle.js.map +1 -0
- package/dist/integrations/http.d.ts +3 -1
- package/dist/integrations/http.js +12 -1
- package/dist/integrations/http.js.map +1 -1
- package/dist/integrations/mongodb.d.ts +50 -0
- package/dist/integrations/mongodb.js +256 -0
- package/dist/integrations/mongodb.js.map +1 -0
- package/dist/integrations/mysql.d.ts +56 -0
- package/dist/integrations/mysql.js +298 -0
- package/dist/integrations/mysql.js.map +1 -0
- package/dist/integrations/next.d.ts +41 -0
- package/dist/integrations/next.js +204 -0
- package/dist/integrations/next.js.map +1 -1
- package/dist/integrations/pg.d.ts +31 -3
- package/dist/integrations/pg.js +100 -29
- package/dist/integrations/pg.js.map +1 -1
- package/dist/integrations/postgres-js.d.ts +57 -0
- package/dist/integrations/postgres-js.js +306 -0
- package/dist/integrations/postgres-js.js.map +1 -0
- package/dist/integrations/prisma.d.ts +54 -0
- package/dist/integrations/prisma.js +182 -0
- package/dist/integrations/prisma.js.map +1 -0
- package/dist/integrations/redis.d.ts +6 -0
- package/dist/integrations/redis.js +21 -35
- package/dist/integrations/redis.js.map +1 -1
- package/dist/integrations/upstash-redis.d.ts +43 -0
- package/dist/integrations/upstash-redis.js +166 -0
- package/dist/integrations/upstash-redis.js.map +1 -0
- package/dist/utils/safe-require.d.ts +22 -0
- package/dist/utils/safe-require.js +36 -0
- package/dist/utils/safe-require.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file packages/node-sdk/src/utils/safe-require.ts
|
|
4
|
+
* @description Bundler-opaque dynamic require utility.
|
|
5
|
+
*
|
|
6
|
+
* Turbopack, Webpack, esbuild, and Rollup all statically analyze `require('...')`
|
|
7
|
+
* calls and try to resolve the module at build time -- even inside try/catch.
|
|
8
|
+
* This causes build errors for applications that don't have all of our optional
|
|
9
|
+
* peer dependencies installed.
|
|
10
|
+
*
|
|
11
|
+
* Using `new Function('id', 'return require(id)')` creates an indirect require
|
|
12
|
+
* call that no bundler can statically analyze, so the module path is resolved
|
|
13
|
+
* only at runtime. If the module is not installed, `safeRequire` returns `null`
|
|
14
|
+
* instead of throwing.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.safeRequire = safeRequire;
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
19
|
+
const dynamicRequire = new Function('id', 'return require(id)');
|
|
20
|
+
/**
|
|
21
|
+
* Dynamically require a module without being traced by bundlers.
|
|
22
|
+
* Returns `null` if the module is not installed or cannot be loaded.
|
|
23
|
+
*
|
|
24
|
+
* @param id - The module specifier (e.g., 'pg', '@prisma/client', 'ioredis')
|
|
25
|
+
* @returns The module exports, or `null` if the module is unavailable
|
|
26
|
+
*/
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
function safeRequire(id) {
|
|
29
|
+
try {
|
|
30
|
+
return dynamicRequire(id);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=safe-require.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-require.js","sourceRoot":"","sources":["../../src/utils/safe-require.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAaH,kCAMC;AAjBD,8DAA8D;AAC9D,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAwB,CAAC;AAEvF;;;;;;GAMG;AACH,8DAA8D;AAC9D,SAAgB,WAAW,CAAC,EAAU;IACpC,IAAI,CAAC;QACH,OAAO,cAAc,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|