eslint-plugin-slonik 1.6.0 → 1.6.1

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
@@ -184,7 +184,7 @@ pnpm add -D eslint-plugin-slonik libpg-query
184
184
  ### 2. Create your SQL tag with type aliases
185
185
 
186
186
  ```ts
187
- // src/db/sql.ts
187
+ // src/slonik.ts
188
188
  import { createSqlTag } from "slonik";
189
189
  import { z } from "zod";
190
190
 
@@ -231,8 +231,7 @@ export default tseslint.config(
231
231
  ### 4. Write validated queries
232
232
 
233
233
  ```ts
234
- import { sql } from "./db/sql";
235
- import { pool } from "./db/pool";
234
+ import { pool, sql } from "./slonik";
236
235
 
237
236
  // ✅ Valid - query matches schema
238
237
  const users = await pool.many(
package/dist/index.cjs CHANGED
@@ -1072,9 +1072,16 @@ function checkType(params) {
1072
1072
  `);
1073
1073
  }
1074
1074
 
1075
- const distDir = node_url.fileURLToPath(new URL("../../dist", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
1075
+ const currentDir = node_url.fileURLToPath(new URL(".", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
1076
+ const isSourceDir = currentDir.includes(path__default.sep + "src" + path__default.sep);
1077
+ function getWorkerPath(name) {
1078
+ if (isSourceDir) {
1079
+ return path__default.join(currentDir, "../../dist/workers", `${name}.worker.mjs`);
1080
+ }
1081
+ return path__default.join(currentDir, "workers", `${name}.worker.mjs`);
1082
+ }
1076
1083
  function defineWorker(params) {
1077
- return synckit.createSyncFn(path__default.join(distDir, `./workers/${params.name}.worker.mjs`), {
1084
+ return synckit.createSyncFn(getWorkerPath(params.name), {
1078
1085
  tsRunner: "tsx",
1079
1086
  timeout: params.timeout
1080
1087
  });