@spfn/core 0.2.0-beta.66 → 0.2.0-beta.67

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/db/index.js CHANGED
@@ -519,6 +519,11 @@ async function createDatabaseFromEnv(options) {
519
519
  throw new Error("No database pattern detected despite passing config check");
520
520
  }
521
521
 
522
+ // src/db/manager/path-utils.ts
523
+ function toPosixPath(path) {
524
+ return path.split("\\").join("/");
525
+ }
526
+
522
527
  // src/db/manager/global-state.ts
523
528
  var getWriteInstance = () => globalThis.__SPFN_DB_WRITE__;
524
529
  var setWriteInstance = (instance) => {
@@ -808,7 +813,7 @@ function getCallerInfo() {
808
813
  if (!stack) return void 0;
809
814
  const lines = stack.split("\n");
810
815
  for (let i = STACK_TRACE_SKIP_LINES; i < lines.length; i++) {
811
- const line = lines[i];
816
+ const line = toPosixPath(lines[i]);
812
817
  if (!line.includes("node_modules") && !line.includes("/db/manager/")) {
813
818
  const match = line.match(STACK_TRACE_PATTERNS.withParens) || line.match(STACK_TRACE_PATTERNS.withoutParens);
814
819
  if (match) {
@@ -1203,17 +1208,15 @@ var BARREL_FILE_PATTERNS = [
1203
1208
  "/index.ts",
1204
1209
  "/index.js",
1205
1210
  "/index.mjs",
1206
- "\\index",
1207
- "\\index.ts",
1208
- "\\index.js",
1209
- "\\index.mjs",
1210
- "\\config.ts",
1211
- "\\config.js",
1212
- "\\config.mjs"
1211
+ "/config",
1212
+ "/config.ts",
1213
+ "/config.js",
1214
+ "/config.mjs"
1213
1215
  ];
1214
1216
  var SUPPORTED_EXTENSIONS = [".ts", ".js", ".mjs"];
1215
1217
  function isBarrelFile(filePath) {
1216
- return BARREL_FILE_PATTERNS.some((pattern) => filePath.endsWith(pattern));
1218
+ const posixPath = toPosixPath(filePath);
1219
+ return BARREL_FILE_PATTERNS.some((pattern) => posixPath.endsWith(pattern));
1217
1220
  }
1218
1221
  function isAbsolutePath(path) {
1219
1222
  if (path.startsWith("/")) return true;
@@ -1383,7 +1386,7 @@ function getDrizzleConfig(options = {}) {
1383
1386
  if (options.packageFilter) {
1384
1387
  const packageSchemas2 = options.disablePackageDiscovery ? [] : discoverPackageSchemas(options.cwd ?? process.cwd());
1385
1388
  const filteredSchemas = packageSchemas2.filter(
1386
- (schemaPath) => schemaPath.includes(`node_modules/${options.packageFilter}/`)
1389
+ (schemaPath) => toPosixPath(schemaPath).includes(`node_modules/${options.packageFilter}/`)
1387
1390
  );
1388
1391
  if (filteredSchemas.length === 0) {
1389
1392
  throw new Error(