dirsql 0.4.47 → 0.4.48

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/core.d.ts CHANGED
@@ -36,6 +36,6 @@ export interface CoreModule {
36
36
  configPathsFromArgv(argv: string[]): string[];
37
37
  planConfigExtensions(configs: ConfigSource[]): ExtensionPlanEntry[] | null;
38
38
  selectLoadable(name: string, dirs: string[], candidates: string[]): string;
39
- isBareName(path: string): boolean;
39
+ planExtensionPath(path: string, base: string, resolveRelative: boolean): ExtensionPlanEntry;
40
40
  }
41
41
  export declare function getCore(): CoreModule;
@@ -1,6 +1,8 @@
1
1
  // Resolve an extension entry's `path` to a concrete loadable file.
2
2
  //
3
- // Resolution is an ordered probe (file-first, then package):
3
+ // Resolution is an ordered probe (file-first, then package), planned by the
4
+ // core (`planExtensionPath`) and carried out here: only locating an installed
5
+ // package is host-specific.
4
6
  //
5
7
  // 1. Path-looking (contains a separator, or ends in `.so` / `.dylib` /
6
8
  // `.dll` / `.node`) -> returned as a file path: made absolute against
@@ -8,14 +10,10 @@
8
10
  // verbatim (programmatic entries).
9
11
  // 2. Bare package name -> a same-named local file under `base` shadows the
10
12
  // package; otherwise the package dir is located via `require.resolve`
11
- // and the current platform's loadable is globbed from inside it. Zero
12
- // matches and multiple matches are both hard errors -- disambiguate
13
- // with a literal path.
14
- import { existsSync, statSync } from "node:fs";
15
- import { isAbsolute, resolve as resolvePath } from "node:path";
13
+ // and the current platform's loadable is picked from inside it.
16
14
  import { getCore } from "./core.js";
17
15
  import { defaultResolver } from "./default-resolver.js";
18
- import { resolvePackage } from "./resolve-package.js";
16
+ import { planEntryPath } from "./plan-entry-path.js";
19
17
  /**
20
18
  * Resolve an extension `path` to a concrete file. `base` is the directory a
21
19
  * relative path and the bare-name shadow probe resolve against (a config file's
@@ -24,15 +22,5 @@ import { resolvePackage } from "./resolve-package.js";
24
22
  * when false it is returned verbatim (programmatic semantics).
25
23
  */
26
24
  export function resolveExtensionPath(path, base, resolveRelative, resolver = defaultResolver()) {
27
- if (!getCore().isBareName(path)) {
28
- if (resolveRelative && !isAbsolute(path)) {
29
- return resolvePath(base, path);
30
- }
31
- return path;
32
- }
33
- const local = resolvePath(base, path);
34
- if (existsSync(local) && statSync(local).isFile()) {
35
- return local;
36
- }
37
- return resolvePackage(path, resolver);
25
+ return planEntryPath(getCore().planExtensionPath(path, base, resolveRelative), resolver);
38
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dirsql",
3
- "version": "0.4.47",
3
+ "version": "0.4.48",
4
4
  "description": "Ephemeral SQL index over a local directory",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/thekevinscott/dirsql",
@@ -221,10 +221,10 @@
221
221
  ]
222
222
  },
223
223
  "optionalDependencies": {
224
- "@dirsql/lib-linux-x64-gnu": "0.4.47",
225
- "@dirsql/lib-linux-arm64-gnu": "0.4.47",
226
- "@dirsql/lib-darwin-x64": "0.4.47",
227
- "@dirsql/lib-darwin-arm64": "0.4.47",
228
- "@dirsql/lib-win32-x64-msvc": "0.4.47"
224
+ "@dirsql/lib-linux-x64-gnu": "0.4.48",
225
+ "@dirsql/lib-linux-arm64-gnu": "0.4.48",
226
+ "@dirsql/lib-darwin-x64": "0.4.48",
227
+ "@dirsql/lib-darwin-arm64": "0.4.48",
228
+ "@dirsql/lib-win32-x64-msvc": "0.4.48"
229
229
  }
230
230
  }