@niledatabase/nextjs 5.0.0-alpha.4 → 5.0.0-alpha.5

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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.0.0-alpha.5](https://github.com/niledatabase/nile-js/compare/v5.0.0-alpha.4...v5.0.0-alpha.5) (2025-06-10)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **nextjs:** build and export correctly ([c522c5e](https://github.com/niledatabase/nile-js/commit/c522c5e485bea75b0fdf86cfcd6b0af662f5a0b5))
11
+
6
12
  # [5.0.0-alpha.4](https://github.com/niledatabase/nile-js/compare/v5.0.0-alpha.3...v5.0.0-alpha.4) (2025-06-10)
7
13
 
8
14
  ### Features
@@ -0,0 +1,7 @@
1
+ import { Server } from '@niledatabase/server';
2
+
3
+ declare function nextJs(instance: Server): {
4
+ onRequest: () => Promise<void>;
5
+ };
6
+
7
+ export { nextJs };
@@ -0,0 +1,7 @@
1
+ import { Server } from '@niledatabase/server';
2
+
3
+ declare function nextJs(instance: Server): {
4
+ onRequest: () => Promise<void>;
5
+ };
6
+
7
+ export { nextJs };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";var c=Object.create;var r=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var o in e)r(t,o,{get:e[o],enumerable:!0})},s=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of C(e))!k.call(t,n)&&n!==o&&r(t,n,{get:()=>e[n],enumerable:!(a=x(e,n))||a.enumerable});return t};var d=(t,e,o)=>(o=t!=null?c(f(t)):{},s(e||!t||!t.__esModule?r(o,"default",{value:t,enumerable:!0}):o,t)),m=t=>s(r({},"__esModule",{value:!0}),t);var v={};u(v,{nextJs:()=>p});module.exports=m(v);var i=require("@niledatabase/server");function p(t){return{onRequest:async()=>{let{cookies:e,headers:o}=await import("next/headers");if(t.setContext(await o()),!t.getContext().tenantId){let n=(await e()).get(i.TENANT_COOKIE);n&&t.setContext({tenantId:n.value})}}}}0&&(module.exports={nextJs});
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Server, TENANT_COOKIE } from '@niledatabase/server';\n\nexport function nextJs(instance: Server) {\n return {\n onRequest: async () => {\n const { cookies, headers } = await import('next/headers');\n instance.setContext(await headers());\n if (!instance.getContext().tenantId) {\n const cooks = await cookies();\n const tenantCookie = cooks.get(TENANT_COOKIE);\n if (tenantCookie) {\n instance.setContext({ tenantId: tenantCookie.value });\n }\n }\n },\n };\n}\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAsC,gCAE/B,SAASF,EAAOG,EAAkB,CACvC,MAAO,CACL,UAAW,SAAY,CACrB,GAAM,CAAE,QAAAC,EAAS,QAAAC,CAAQ,EAAI,KAAM,QAAO,cAAc,EAExD,GADAF,EAAS,WAAW,MAAME,EAAQ,CAAC,EAC/B,CAACF,EAAS,WAAW,EAAE,SAAU,CAEnC,IAAMG,GADQ,MAAMF,EAAQ,GACD,IAAI,eAAa,EACxCE,GACFH,EAAS,WAAW,CAAE,SAAUG,EAAa,KAAM,CAAC,CAExD,CACF,CACF,CACF","names":["index_exports","__export","nextJs","__toCommonJS","import_server","instance","cookies","headers","tenantCookie"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import{TENANT_COOKIE as r}from"@niledatabase/server";function c(t){return{onRequest:async()=>{let{cookies:o,headers:n}=await import("next/headers");if(t.setContext(await n()),!t.getContext().tenantId){let e=(await o()).get(r);e&&t.setContext({tenantId:e.value})}}}}export{c as nextJs};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Server, TENANT_COOKIE } from '@niledatabase/server';\n\nexport function nextJs(instance: Server) {\n return {\n onRequest: async () => {\n const { cookies, headers } = await import('next/headers');\n instance.setContext(await headers());\n if (!instance.getContext().tenantId) {\n const cooks = await cookies();\n const tenantCookie = cooks.get(TENANT_COOKIE);\n if (tenantCookie) {\n instance.setContext({ tenantId: tenantCookie.value });\n }\n }\n },\n };\n}\n"],"mappings":"AAAA,OAAiB,iBAAAA,MAAqB,uBAE/B,SAASC,EAAOC,EAAkB,CACvC,MAAO,CACL,UAAW,SAAY,CACrB,GAAM,CAAE,QAAAC,EAAS,QAAAC,CAAQ,EAAI,KAAM,QAAO,cAAc,EAExD,GADAF,EAAS,WAAW,MAAME,EAAQ,CAAC,EAC/B,CAACF,EAAS,WAAW,EAAE,SAAU,CAEnC,IAAMG,GADQ,MAAMF,EAAQ,GACD,IAAIH,CAAa,EACxCK,GACFH,EAAS,WAAW,CAAE,SAAUG,EAAa,KAAM,CAAC,CAExD,CACF,CACF,CACF","names":["TENANT_COOKIE","nextJs","instance","cookies","headers","tenantCookie"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@niledatabase/nextjs",
3
- "version": "5.0.0-alpha.4",
3
+ "version": "5.0.0-alpha.5",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -17,6 +17,7 @@
17
17
  "singleQuote": true,
18
18
  "trailingComma": "es5"
19
19
  },
20
+ "sideEffects": false,
20
21
  "scripts": {
21
22
  "build": "tsup src/index.ts"
22
23
  },
@@ -30,13 +31,12 @@
30
31
  "access": "public"
31
32
  },
32
33
  "peerDependencies": {
33
- "@niledatabase/server": "*"
34
- },
35
- "dependencies": {
34
+ "@niledatabase/server": "*",
36
35
  "next": "^15"
37
36
  },
38
37
  "devDependencies": {
38
+ "next": "^15.3.3",
39
39
  "tsup": "^8.5.0"
40
40
  },
41
- "gitHead": "29f1ac308f3d044534470bcf5418971ac9858eb2"
41
+ "gitHead": "4538e8af0bdf4dabd7c8b8507714214ec4dfc8fb"
42
42
  }
package/src/index.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Server, TENANT_COOKIE } from '@niledatabase/server';
2
- import { cookies, headers } from 'next/headers';
3
2
 
4
3
  export function nextJs(instance: Server) {
5
4
  return {
6
5
  onRequest: async () => {
6
+ const { cookies, headers } = await import('next/headers');
7
7
  instance.setContext(await headers());
8
8
  if (!instance.getContext().tenantId) {
9
9
  const cooks = await cookies();
package/tsconfig.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "extends": "../../tsconfig",
3
+ // see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
4
+ "include": ["src/**/*"],
5
+ "compilerOptions": {
6
+ "importHelpers": true,
7
+ // output .d.ts declaration files for consumers
8
+ "declaration": true,
9
+ // output .js.map sourcemap files for consumers
10
+ "sourceMap": true,
11
+ // stricter type-checking for stronger correctness. Recommended by TS
12
+ "strict": true,
13
+ // linter checks for common issues
14
+ "noImplicitReturns": true,
15
+ "noFallthroughCasesInSwitch": true,
16
+ // noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
17
+ "noUnusedLocals": false,
18
+ // set to false for code generation
19
+ "noUnusedParameters": false,
20
+ // interop between ESM and CJS modules. Recommended by TS
21
+ "esModuleInterop": true,
22
+ // significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
23
+ "skipLibCheck": true,
24
+ // error out if import and file system have a casing mismatch. Recommended by TS
25
+ "forceConsistentCasingInFileNames": true,
26
+ // `dts build` ignores this option, but it is commonly used when type-checking separately with `tsc`
27
+ "noEmit": false,
28
+ }
29
+
30
+ }
package/tsup.config.js CHANGED
@@ -3,13 +3,8 @@ import { defineConfig } from 'tsup';
3
3
  export default defineConfig({
4
4
  minify: true,
5
5
  target: 'es2022',
6
- external: ['react'],
7
6
  sourcemap: true,
8
7
  dts: true,
9
8
  format: ['esm', 'cjs'],
10
- esbuildOptions(options) {
11
- options.banner = {
12
- js: '"use client"',
13
- };
14
- },
9
+ external: ['next', 'next/headers', 'next/navigation', 'next/server'],
15
10
  });