cloudflare-next-intl 0.8.12 → 0.8.13

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/README.md CHANGED
@@ -760,7 +760,7 @@ npx cfni-db-codegen --check
760
760
  | `--out-file=` | `CFNI_DB_OUT_FILE` | `schema.ts` |
761
761
  | `--db-url=` | `CODEGEN_DATABASE_URL` | `postgresql://postgres:postgres@127.0.0.1:54322/postgres` |
762
762
  | `--drizzle-config=` | `CFNI_DB_DRIZZLE_CONFIG` | none |
763
- | `--rpc-dir=` | `CFNI_DB_RPC_DIR` | sibling of `--ddl-dir`, e.g. `supabase/rpc` |
763
+ | `--rpc-dir=` | `CFNI_DB_RPC_DIR` | inside `--ddl-dir`, e.g. `supabase/data-base/rpcs` |
764
764
  | `--rpc-file-name=` | `CFNI_DB_RPC_FILE_NAME` | `cfni_exec.sql` |
765
765
  | `--tests-dir=` | `CFNI_DB_TESTS_DIR` | sibling of `--ddl-dir`, e.g. `supabase/tests` |
766
766
  | `--tests-file-name=` | `CFNI_DB_TESTS_FILE_NAME` | `cfni_exec.sql` |
@@ -792,9 +792,9 @@ fallback entirely and fails loudly if that target is unreachable.
792
792
  After a successful (non-`--check`) run, `cfni-db-codegen` also copies
793
793
  `supabase/cfni_exec.sql` and its pgTAP test file (see
794
794
  [Testing `cfni_exec.sql` itself](#testing-cfni_execsql-itself) below) into
795
- your project — `--rpc-dir`/`--tests-dir` (defaulting to sibling folders of
796
- `--ddl-dir`, so `rpc`/`tests` next to `data-base`), each named `cfni_exec.sql`
797
- by default. This keeps a project that enables Supabase mode's raw-SQL path
795
+ your project — `--rpc-dir` (defaulting inside `--ddl-dir`, so `rpcs` under
796
+ `data-base`) and `--tests-dir` (defaulting to a sibling of `--ddl-dir`, so
797
+ `tests` next to `data-base`), each named `cfni_exec.sql` by default. This keeps a project that enables Supabase mode's raw-SQL path
798
798
  always holding the current version of the function, without a manual
799
799
  copy-paste step. Since the file now ships both `cfni_exec` and
800
800
  `cfni_exec_batch` (see
@@ -808,7 +808,7 @@ This step is gated on `db.supabase.rawSql` (see
808
808
  codegen reads your `next.config.*`'s `@intl-config` alias, opens the intl
809
809
  config file it points at, and looks for a literal `rawSql: true`/`rawSql:
810
810
  false`. If it's explicitly `false`, the copy is skipped entirely — no
811
- `supabase/rpc`/`supabase/tests` folders are created. If it can't be
811
+ `supabase/data-base/rpcs`/`supabase/tests` folders are created. If it can't be
812
812
  determined (no `next.config.*` found, no alias, or `rawSql` isn't a plain
813
813
  `true`/`false` literal in the source), a warning is printed and codegen
814
814
  assumes `true`, matching `withPublicDb`/`withUserDb`'s own default.
@@ -33,14 +33,14 @@
33
33
  import { createHash } from 'node:crypto';
34
34
  import { execFileSync } from 'node:child_process';
35
35
  import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
36
- import { join, relative } from 'node:path';
36
+ import { createRequire } from 'node:module';
37
+ import { dirname, join, relative } from 'node:path';
37
38
  import { Client } from 'pg';
38
39
  import resolveCodegenPaths from '../dist/src/db/codegen_paths.js';
39
40
  import { runInstallExecStep } from './install_exec_step.mjs';
40
41
  import { startEphemeralPostgres } from './ephemeral_pg.mjs';
41
42
  import { orderedSqlFiles } from './ddl_order.mjs';
42
43
 
43
- const PACKAGE_ROOT = new URL('..', import.meta.url).pathname;
44
44
  const paths = resolveCodegenPaths(process.argv.slice(2), process.env, process.cwd());
45
45
 
46
46
  async function isReachable(url) {
@@ -128,13 +128,21 @@ try {
128
128
  // drizzle-kit itself requires `drizzle-orm` at runtime. This package
129
129
  // depends on drizzle-orm, but npm doesn't guarantee that dependency gets
130
130
  // hoisted to the consuming project's own node_modules (it commonly stays
131
- // nested under node_modules/cloudflare-next-intl/node_modules) — so
132
- // running from *this* package's own directory, where it's guaranteed
133
- // resolvable, avoids "please install required packages: drizzle-orm"
134
- // when a consumer doesn't happen to have it hoisted.
135
- execFileSync('npx', ['drizzle-kit', 'pull', `--config=${configPath}`], {
131
+ // nested under node_modules/cloudflare-next-intl/node_modules). `npx
132
+ // drizzle-kit` resolves the binary through its own lookup rather than
133
+ // Node's normal upward node_modules walk from this file, which — even
134
+ // pinned to this package's own directory as cwd — resolved drizzle-orm
135
+ // inconsistently across runs. Resolving and invoking drizzle-kit's own
136
+ // installed binary directly sidesteps npx's resolution entirely: Node's
137
+ // ordinary require() from that file's real location always finds
138
+ // drizzle-orm right next to it in this package's own node_modules.
139
+ // `drizzle-kit/bin.cjs` isn't in the package's `exports` map, so it can't
140
+ // be require.resolve()'d directly — but its main entry point can, and
141
+ // `bin.cjs` always sits next to it (declared via `bin` in package.json).
142
+ const drizzleKitEntry = createRequire(import.meta.url).resolve('drizzle-kit');
143
+ const drizzleKitBin = join(dirname(drizzleKitEntry), 'bin.cjs');
144
+ execFileSync(process.execPath, [drizzleKitBin, 'pull', `--config=${configPath}`], {
136
145
  stdio: 'inherit',
137
- cwd: PACKAGE_ROOT,
138
146
  env: { ...process.env, CODEGEN_DATABASE_URL: effectiveDbUrl },
139
147
  });
140
148
  } finally {
@@ -33,10 +33,13 @@ export default function resolveCodegenPaths(argv, env, cwd) {
33
33
  const outDir = outDirs[0];
34
34
  const outFileName = flag(argv, 'out-file') ?? env.CFNI_DB_OUT_FILE ?? DEFAULT_OUT_FILE;
35
35
  const drizzleConfig = flag(argv, 'drizzle-config') ?? env.CFNI_DB_DRIZZLE_CONFIG ?? null;
36
- // Sibling of ddlDir (default `supabase/data-base` → `supabase`), matching
37
- // where `cfni_exec.sql` ships in this package's own `supabase/` folder.
36
+ // rpcDir defaults inside ddlDir itself (default `supabase/data-base` →
37
+ // `supabase/data-base/rpcs`), matching where a project's DDL walk (and
38
+ // this package's own `supabase/data-base/rpcs/`) actually keeps RPC
39
+ // definitions. testsDir stays a sibling of ddlDir (`supabase/tests`) —
40
+ // pgTAP tests aren't part of the DDL a project applies to its database.
38
41
  const supabaseRoot = dirname(ddlDir);
39
- const rpcDir = abs(cwd, flag(argv, 'rpc-dir') ?? env.CFNI_DB_RPC_DIR ?? join(supabaseRoot, 'rpc'));
42
+ const rpcDir = abs(cwd, flag(argv, 'rpc-dir') ?? env.CFNI_DB_RPC_DIR ?? join(ddlDir, 'rpcs'));
40
43
  const testsDir = abs(cwd, flag(argv, 'tests-dir') ?? env.CFNI_DB_TESTS_DIR ?? join(supabaseRoot, 'tests'));
41
44
  const rpcFileName = flag(argv, 'rpc-file-name') ?? env.CFNI_DB_RPC_FILE_NAME ?? DEFAULT_RPC_FILE_NAME;
42
45
  const testsFileName = flag(argv, 'tests-file-name') ?? env.CFNI_DB_TESTS_FILE_NAME ?? DEFAULT_TESTS_FILE_NAME;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudflare-next-intl",
3
- "version": "0.8.12",
3
+ "version": "0.8.13",
4
4
  "description": "Optimized Next Intl Package Special for App Router and Cloudflare",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -242,6 +242,7 @@
242
242
  "dependencies": {
243
243
  "@microsoft/clarity": "^1.0.2",
244
244
  "@supabase/supabase-js": "^2.112.3",
245
+ "drizzle-kit": "^0.31.10",
245
246
  "drizzle-orm": "^0.45.2",
246
247
  "embedded-postgres": "^18.4.0-beta.17",
247
248
  "firebase": "^12.17.0",
@@ -269,7 +270,6 @@
269
270
  "@types/react": "^19.0.0",
270
271
  "@types/react-dom": "^19.0.0",
271
272
  "@vitest/coverage-v8": "^3.2.7",
272
- "drizzle-kit": "^0.31.10",
273
273
  "eslint": "^9.28.0",
274
274
  "eslint-config-next": "15.3.3",
275
275
  "eslint-config-prettier": "^10.1.2",