@drzl/analyzer 1.21.3 → 1.21.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/dist/index.cjs +17 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +17 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -470,6 +470,17 @@ function unknownColumnHint(reason) {
|
|
|
470
470
|
}
|
|
471
471
|
return "Open an issue naming the column type so it can be modelled, or declare it with .$type<T>() and turn on typedColumns.";
|
|
472
472
|
}
|
|
473
|
+
async function jitiCacheDir(fs, path) {
|
|
474
|
+
try {
|
|
475
|
+
const modules = path.join(process.cwd(), "node_modules");
|
|
476
|
+
await fs.stat(modules);
|
|
477
|
+
const dir = path.join(modules, ".cache", "jiti");
|
|
478
|
+
await fs.mkdir(dir, { recursive: true });
|
|
479
|
+
return dir;
|
|
480
|
+
} catch {
|
|
481
|
+
return void 0;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
473
484
|
var _SchemaAnalyzer = class _SchemaAnalyzer {
|
|
474
485
|
/**
|
|
475
486
|
* One path or several. The plural exists for drizzle-kit interop: kit's `schema` key names
|
|
@@ -1216,7 +1227,11 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
|
|
|
1216
1227
|
return { dialect: "unknown", tables: [], enums: [], relations: [], issues };
|
|
1217
1228
|
}
|
|
1218
1229
|
const { default: jiti } = await import("jiti");
|
|
1219
|
-
const
|
|
1230
|
+
const cacheDir = await jitiCacheDir(fs, path);
|
|
1231
|
+
const jit = jiti(import_meta.url, {
|
|
1232
|
+
moduleCache: false,
|
|
1233
|
+
...cacheDir ? { fsCache: cacheDir } : {}
|
|
1234
|
+
});
|
|
1220
1235
|
const exportsObj = {};
|
|
1221
1236
|
const exportOrigin = /* @__PURE__ */ new Map();
|
|
1222
1237
|
const duplicateDisagreement = (a, b) => {
|
|
@@ -1360,6 +1375,7 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
|
|
|
1360
1375
|
if (dialect === "sqlite") {
|
|
1361
1376
|
for (const view of viewTables) view.readOnly = true;
|
|
1362
1377
|
}
|
|
1378
|
+
for (const t of tables) t.dialect = dialect;
|
|
1363
1379
|
if (dialect === "unknown" && tables.length) {
|
|
1364
1380
|
issues.push({
|
|
1365
1381
|
code: "DRZL_ANL_DIALECT",
|
package/dist/index.d.cts
CHANGED
|
@@ -383,6 +383,16 @@ interface ForeignKey {
|
|
|
383
383
|
interface Table {
|
|
384
384
|
name: string;
|
|
385
385
|
tsName: string;
|
|
386
|
+
/**
|
|
387
|
+
* The engine this table was declared for, repeated from the `Analysis` that holds it.
|
|
388
|
+
*
|
|
389
|
+
* Duplication on purpose, and the same kind `Column` already carries: `maxBytes`, `allowsNaN` and
|
|
390
|
+
* `format` are all dialect-derived facts stamped onto the column so nothing downstream has to
|
|
391
|
+
* know which server it is looking at. The shared check helpers take a `Table` rather than an
|
|
392
|
+
* `Analysis`, and one thing they cannot read correctly without the engine is `length()`, which
|
|
393
|
+
* counts characters on Postgres and SQLite and BYTES on MySQL.
|
|
394
|
+
*/
|
|
395
|
+
dialect?: Dialect;
|
|
386
396
|
/**
|
|
387
397
|
* The SQL schema the table was declared in, from `pgSchema('reporting').table(...)` and the
|
|
388
398
|
* MySQL and SingleStore equivalents. Absent for a table declared with plain `pgTable`, which is
|
package/dist/index.d.ts
CHANGED
|
@@ -383,6 +383,16 @@ interface ForeignKey {
|
|
|
383
383
|
interface Table {
|
|
384
384
|
name: string;
|
|
385
385
|
tsName: string;
|
|
386
|
+
/**
|
|
387
|
+
* The engine this table was declared for, repeated from the `Analysis` that holds it.
|
|
388
|
+
*
|
|
389
|
+
* Duplication on purpose, and the same kind `Column` already carries: `maxBytes`, `allowsNaN` and
|
|
390
|
+
* `format` are all dialect-derived facts stamped onto the column so nothing downstream has to
|
|
391
|
+
* know which server it is looking at. The shared check helpers take a `Table` rather than an
|
|
392
|
+
* `Analysis`, and one thing they cannot read correctly without the engine is `length()`, which
|
|
393
|
+
* counts characters on Postgres and SQLite and BYTES on MySQL.
|
|
394
|
+
*/
|
|
395
|
+
dialect?: Dialect;
|
|
386
396
|
/**
|
|
387
397
|
* The SQL schema the table was declared in, from `pgSchema('reporting').table(...)` and the
|
|
388
398
|
* MySQL and SingleStore equivalents. Absent for a table declared with plain `pgTable`, which is
|
package/dist/index.js
CHANGED
|
@@ -427,6 +427,17 @@ function unknownColumnHint(reason) {
|
|
|
427
427
|
}
|
|
428
428
|
return "Open an issue naming the column type so it can be modelled, or declare it with .$type<T>() and turn on typedColumns.";
|
|
429
429
|
}
|
|
430
|
+
async function jitiCacheDir(fs, path) {
|
|
431
|
+
try {
|
|
432
|
+
const modules = path.join(process.cwd(), "node_modules");
|
|
433
|
+
await fs.stat(modules);
|
|
434
|
+
const dir = path.join(modules, ".cache", "jiti");
|
|
435
|
+
await fs.mkdir(dir, { recursive: true });
|
|
436
|
+
return dir;
|
|
437
|
+
} catch {
|
|
438
|
+
return void 0;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
430
441
|
var _SchemaAnalyzer = class _SchemaAnalyzer {
|
|
431
442
|
/**
|
|
432
443
|
* One path or several. The plural exists for drizzle-kit interop: kit's `schema` key names
|
|
@@ -1173,7 +1184,11 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
|
|
|
1173
1184
|
return { dialect: "unknown", tables: [], enums: [], relations: [], issues };
|
|
1174
1185
|
}
|
|
1175
1186
|
const { default: jiti } = await import("jiti");
|
|
1176
|
-
const
|
|
1187
|
+
const cacheDir = await jitiCacheDir(fs, path);
|
|
1188
|
+
const jit = jiti(import.meta.url, {
|
|
1189
|
+
moduleCache: false,
|
|
1190
|
+
...cacheDir ? { fsCache: cacheDir } : {}
|
|
1191
|
+
});
|
|
1177
1192
|
const exportsObj = {};
|
|
1178
1193
|
const exportOrigin = /* @__PURE__ */ new Map();
|
|
1179
1194
|
const duplicateDisagreement = (a, b) => {
|
|
@@ -1317,6 +1332,7 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
|
|
|
1317
1332
|
if (dialect === "sqlite") {
|
|
1318
1333
|
for (const view of viewTables) view.readOnly = true;
|
|
1319
1334
|
}
|
|
1335
|
+
for (const t of tables) t.dialect = dialect;
|
|
1320
1336
|
if (dialect === "unknown" && tables.length) {
|
|
1321
1337
|
issues.push({
|
|
1322
1338
|
code: "DRZL_ANL_DIALECT",
|