@niledatabase/nextjs 5.0.0-alpha.4 → 5.0.0-alpha.6
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 +12 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +5 -5
- package/src/index.ts +7 -2
- package/tsconfig.json +30 -0
- package/tsup.config.js +1 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.6](https://github.com/niledatabase/nile-js/compare/v5.0.0-alpha.5...v5.0.0-alpha.6) (2025-06-11)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **server:** move logging to the config object ([6e3e380](https://github.com/niledatabase/nile-js/commit/6e3e38014f5b9795552af0a7b97e2d3fe6cd1a88))
|
|
11
|
+
|
|
12
|
+
# [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)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **nextjs:** build and export correctly ([c522c5e](https://github.com/niledatabase/nile-js/commit/c522c5e485bea75b0fdf86cfcd6b0af662f5a0b5))
|
|
17
|
+
|
|
6
18
|
# [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
19
|
|
|
8
20
|
### Features
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as next_dist_server_web_spec_extension_adapters_headers from 'next/dist/server/web/spec-extension/adapters/headers';
|
|
2
|
+
import { Server } from '@niledatabase/server';
|
|
3
|
+
|
|
4
|
+
declare function nextJs(instance: Server): {
|
|
5
|
+
id: string;
|
|
6
|
+
onRequest: () => Promise<next_dist_server_web_spec_extension_adapters_headers.ReadonlyHeaders | undefined>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { nextJs };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as next_dist_server_web_spec_extension_adapters_headers from 'next/dist/server/web/spec-extension/adapters/headers';
|
|
2
|
+
import { Server } from '@niledatabase/server';
|
|
3
|
+
|
|
4
|
+
declare function nextJs(instance: Server): {
|
|
5
|
+
id: string;
|
|
6
|
+
onRequest: () => Promise<next_dist_server_web_spec_extension_adapters_headers.ReadonlyHeaders | undefined>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { nextJs };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var u=Object.create;var s=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var f=(t,e)=>{for(var o in e)s(t,o,{get:e[o],enumerable:!0})},i=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of d(e))!C.call(t,n)&&n!==o&&s(t,n,{get:()=>e[n],enumerable:!(r=x(e,n))||r.enumerable});return t};var p=(t,e,o)=>(o=t!=null?u(k(t)):{},i(e||!t||!t.__esModule?s(o,"default",{value:t,enumerable:!0}):o,t)),m=t=>i(s({},"__esModule",{value:!0}),t);var w={};f(w,{nextJs:()=>v});module.exports=m(w);var c=require("@niledatabase/server");function v(t){return{id:"next-js-cookies",onRequest:async()=>{let{cookies:e,headers:o}=await import("next/headers"),r=await o();if(t.setContext(r),!t.getContext().tenantId){let a=(await e()).get(c.TENANT_COOKIE);return a&&t.setContext({tenantId:a.value}),r}}}}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 id: 'next-js-cookies',\n onRequest: async () => {\n const { cookies, headers } = await import('next/headers');\n const headersHelper = await headers();\n instance.setContext(headersHelper);\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 // return this so that the initial request can still partake\n return headersHelper;\n }\n return;\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,GAAI,kBACJ,UAAW,SAAY,CACrB,GAAM,CAAE,QAAAC,EAAS,QAAAC,CAAQ,EAAI,KAAM,QAAO,cAAc,EAClDC,EAAgB,MAAMD,EAAQ,EAEpC,GADAF,EAAS,WAAWG,CAAa,EAC7B,CAACH,EAAS,WAAW,EAAE,SAAU,CAEnC,IAAMI,GADQ,MAAMH,EAAQ,GACD,IAAI,eAAa,EAC5C,OAAIG,GACFJ,EAAS,WAAW,CAAE,SAAUI,EAAa,KAAM,CAAC,EAG/CD,CACT,CAEF,CACF,CACF","names":["index_exports","__export","nextJs","__toCommonJS","import_server","instance","cookies","headers","headersHelper","tenantCookie"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{TENANT_COOKIE as s}from"@niledatabase/server";function u(t){return{id:"next-js-cookies",onRequest:async()=>{let{cookies:n,headers:r}=await import("next/headers"),e=await r();if(t.setContext(e),!t.getContext().tenantId){let o=(await n()).get(s);return o&&t.setContext({tenantId:o.value}),e}}}}export{u 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 id: 'next-js-cookies',\n onRequest: async () => {\n const { cookies, headers } = await import('next/headers');\n const headersHelper = await headers();\n instance.setContext(headersHelper);\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 // return this so that the initial request can still partake\n return headersHelper;\n }\n return;\n },\n };\n}\n"],"mappings":"AAAA,OAAiB,iBAAAA,MAAqB,uBAE/B,SAASC,EAAOC,EAAkB,CACvC,MAAO,CACL,GAAI,kBACJ,UAAW,SAAY,CACrB,GAAM,CAAE,QAAAC,EAAS,QAAAC,CAAQ,EAAI,KAAM,QAAO,cAAc,EAClDC,EAAgB,MAAMD,EAAQ,EAEpC,GADAF,EAAS,WAAWG,CAAa,EAC7B,CAACH,EAAS,WAAW,EAAE,SAAU,CAEnC,IAAMI,GADQ,MAAMH,EAAQ,GACD,IAAIH,CAAa,EAC5C,OAAIM,GACFJ,EAAS,WAAW,CAAE,SAAUI,EAAa,KAAM,CAAC,EAG/CD,CACT,CAEF,CACF,CACF","names":["TENANT_COOKIE","nextJs","instance","cookies","headers","headersHelper","tenantCookie"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@niledatabase/nextjs",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.6",
|
|
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": "
|
|
41
|
+
"gitHead": "33b4751621db9c1f92fd559e8b6def081f0c3cd4"
|
|
42
42
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
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 {
|
|
5
|
+
id: 'next-js-cookies',
|
|
6
6
|
onRequest: async () => {
|
|
7
|
-
|
|
7
|
+
const { cookies, headers } = await import('next/headers');
|
|
8
|
+
const headersHelper = await headers();
|
|
9
|
+
instance.setContext(headersHelper);
|
|
8
10
|
if (!instance.getContext().tenantId) {
|
|
9
11
|
const cooks = await cookies();
|
|
10
12
|
const tenantCookie = cooks.get(TENANT_COOKIE);
|
|
11
13
|
if (tenantCookie) {
|
|
12
14
|
instance.setContext({ tenantId: tenantCookie.value });
|
|
13
15
|
}
|
|
16
|
+
// return this so that the initial request can still partake
|
|
17
|
+
return headersHelper;
|
|
14
18
|
}
|
|
19
|
+
return;
|
|
15
20
|
},
|
|
16
21
|
};
|
|
17
22
|
}
|
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
|
-
|
|
11
|
-
options.banner = {
|
|
12
|
-
js: '"use client"',
|
|
13
|
-
};
|
|
14
|
-
},
|
|
9
|
+
external: ['next', 'next/headers', 'next/navigation', 'next/server'],
|
|
15
10
|
});
|