dirsql 0.4.40 → 0.4.42

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.
@@ -11,7 +11,7 @@
11
11
  // dispatches those to `dirsql interpret`, whose handshake already carries
12
12
  // resolved paths.
13
13
  import { existsSync } from "node:fs";
14
- import { configPathsFromArgv } from "./config-paths-from-argv.js";
14
+ import { getCore } from "../core.js";
15
15
  // Config extensions the binary dispatches to `dirsql interpret`; never
16
16
  // pre-resolved here (that path resolves via the handshake).
17
17
  const NATIVE_CONFIG_SUFFIXES = [".py", ".js", ".mjs", ".cjs"];
@@ -25,7 +25,9 @@ export async function withResolvedExtensions(argv) {
25
25
  if (argv[0] === "init") {
26
26
  return argv;
27
27
  }
28
- const configPaths = configPathsFromArgv(argv).filter((p) => !NATIVE_CONFIG_SUFFIXES.some((s) => p.endsWith(s)));
28
+ const configPaths = getCore()
29
+ .configPathsFromArgv(argv)
30
+ .filter((p) => !NATIVE_CONFIG_SUFFIXES.some((s) => p.endsWith(s)));
29
31
  // The shared resolver pulls in smol-toml, which only a TOML config on disk
30
32
  // can need. Guarding on the same `existsSync` the resolver itself starts
31
33
  // with keeps the parser off the common launch path entirely (#720); the
package/dist/core.d.ts CHANGED
@@ -12,5 +12,6 @@ export interface NativeDirSQLConstructor {
12
12
  }
13
13
  export interface CoreModule {
14
14
  DirSQL: NativeDirSQLConstructor;
15
+ configPathsFromArgv(argv: string[]): string[];
15
16
  }
16
17
  export declare function getCore(): CoreModule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dirsql",
3
- "version": "0.4.40",
3
+ "version": "0.4.42",
4
4
  "description": "Ephemeral SQL index over a local directory",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/thekevinscott/dirsql",
@@ -222,10 +222,10 @@
222
222
  ]
223
223
  },
224
224
  "optionalDependencies": {
225
- "@dirsql/lib-linux-x64-gnu": "0.4.40",
226
- "@dirsql/lib-linux-arm64-gnu": "0.4.40",
227
- "@dirsql/lib-darwin-x64": "0.4.40",
228
- "@dirsql/lib-darwin-arm64": "0.4.40",
229
- "@dirsql/lib-win32-x64-msvc": "0.4.40"
225
+ "@dirsql/lib-linux-x64-gnu": "0.4.42",
226
+ "@dirsql/lib-linux-arm64-gnu": "0.4.42",
227
+ "@dirsql/lib-darwin-x64": "0.4.42",
228
+ "@dirsql/lib-darwin-arm64": "0.4.42",
229
+ "@dirsql/lib-win32-x64-msvc": "0.4.42"
230
230
  }
231
231
  }
@@ -1,5 +0,0 @@
1
- /**
2
- * Every config value in argv, in order (`--config X`, `--config=X`, `-c X`,
3
- * `-c=X`, `-cX`), or the default when none are given.
4
- */
5
- export declare function configPathsFromArgv(argv: string[]): string[];
@@ -1,31 +0,0 @@
1
- // The `-c`/`--config` flag is repeatable, so the scan collects every
2
- // occurrence, in argv order.
3
- /**
4
- * Every config value in argv, in order (`--config X`, `--config=X`, `-c X`,
5
- * `-c=X`, `-cX`), or the default when none are given.
6
- */
7
- export function configPathsFromArgv(argv) {
8
- const paths = [];
9
- let expectValue = false;
10
- for (const a of argv) {
11
- if (expectValue) {
12
- paths.push(a);
13
- expectValue = false;
14
- }
15
- else if (a === "--config" || a === "-c") {
16
- expectValue = true;
17
- }
18
- else if (a.startsWith("--config=")) {
19
- paths.push(a.slice("--config=".length));
20
- }
21
- else if (a.startsWith("-c")) {
22
- const value = a.slice("-c".length);
23
- paths.push(value.startsWith("=") ? value.slice("=".length) : value);
24
- }
25
- }
26
- if (expectValue) {
27
- // A bare trailing flag (no following value) yields "".
28
- paths.push("");
29
- }
30
- return paths.length > 0 ? paths : ["./.dirsql.toml"];
31
- }