keyv-registry 2.0.1 → 2.0.2
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/cjs/utils.js +6 -2
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/utils.js +6 -2
- package/dist/esm/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/utils.js
CHANGED
|
@@ -19,6 +19,7 @@ _export(exports, {
|
|
|
19
19
|
var _nodefs = /*#__PURE__*/ _interop_require_wildcard(require("node:fs"));
|
|
20
20
|
var _nodeos = /*#__PURE__*/ _interop_require_wildcard(require("node:os"));
|
|
21
21
|
var _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
|
|
22
|
+
var _nodeurl = require("node:url");
|
|
22
23
|
function _array_like_to_array(arr, len) {
|
|
23
24
|
if (len == null || len > arr.length) len = arr.length;
|
|
24
25
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -99,9 +100,12 @@ function resolveFilePath(url) {
|
|
|
99
100
|
var filePath = url.pathname;
|
|
100
101
|
// Handle ~ for home directory
|
|
101
102
|
if (url.host === '~') {
|
|
102
|
-
filePath = _nodepath.join(_nodeos.homedir(), filePath.slice(1));
|
|
103
|
+
filePath = _nodepath.join(_nodeos.homedir(), decodeURIComponent(filePath.slice(1)));
|
|
103
104
|
} else if (url.host === '.') {
|
|
104
|
-
filePath = _nodepath.join(process.cwd(), filePath.slice(1));
|
|
105
|
+
filePath = _nodepath.join(process.cwd(), decodeURIComponent(filePath.slice(1)));
|
|
106
|
+
} else {
|
|
107
|
+
// File-backed adapters such as duckdb use the same native path conversion.
|
|
108
|
+
filePath = (0, _nodeurl.fileURLToPath)(new URL("file://".concat(url.host).concat(url.pathname)));
|
|
105
109
|
}
|
|
106
110
|
// Ensure directory exists
|
|
107
111
|
_nodefs.mkdirSync(_nodepath.dirname(filePath), {
|
package/dist/cjs/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/keyv/keyv-registry/src/utils.ts"],"sourcesContent":["import * as fs from 'node:fs';\nimport * as os from 'node:os';\nimport * as path from 'node:path';\n\n/**\n * Resolve file path from URL, handling ~ and . prefixes\n */\nexport function resolveFilePath(url: URL): string {\n let filePath = url.pathname;\n\n // Handle ~ for home directory\n if (url.host === '~') {\n filePath = path.join(os.homedir(), filePath.slice(1));\n }\n // Handle . for current directory\n else if (url.host === '.') {\n filePath = path.join(process.cwd(), filePath.slice(1));\n }\n\n // Ensure directory exists\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n\n return filePath;\n}\n\n/**\n * Parse URL search params into options object with type conversion\n */\nexport function parseUriOptions(url: URL): Record<string, unknown> {\n const options: Record<string, unknown> = {};\n\n for (const [key, value] of url.searchParams) {\n // Auto-convert types\n if (value === 'true') options[key] = true;\n else if (value === 'false') options[key] = false;\n else if (/^\\d+$/.test(value)) options[key] = Number.parseInt(value, 10);\n else if (/^\\d+\\.\\d+$/.test(value)) options[key] = Number.parseFloat(value);\n else options[key] = value;\n }\n\n return options;\n}\n"],"names":["parseUriOptions","resolveFilePath","url","filePath","pathname","host","path","join","os","homedir","slice","process","cwd","fs","mkdirSync","dirname","recursive","options","searchParams","key","value","test","Number","parseInt","parseFloat"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/keyv/keyv-registry/src/utils.ts"],"sourcesContent":["import * as fs from 'node:fs';\nimport * as os from 'node:os';\nimport * as path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\n/**\n * Resolve file path from URL, handling ~ and . prefixes\n */\nexport function resolveFilePath(url: URL): string {\n let filePath = url.pathname;\n\n // Handle ~ for home directory\n if (url.host === '~') {\n filePath = path.join(os.homedir(), decodeURIComponent(filePath.slice(1)));\n }\n // Handle . for current directory\n else if (url.host === '.') {\n filePath = path.join(process.cwd(), decodeURIComponent(filePath.slice(1)));\n } else {\n // File-backed adapters such as duckdb use the same native path conversion.\n filePath = fileURLToPath(new URL(`file://${url.host}${url.pathname}`));\n }\n\n // Ensure directory exists\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n\n return filePath;\n}\n\n/**\n * Parse URL search params into options object with type conversion\n */\nexport function parseUriOptions(url: URL): Record<string, unknown> {\n const options: Record<string, unknown> = {};\n\n for (const [key, value] of url.searchParams) {\n // Auto-convert types\n if (value === 'true') options[key] = true;\n else if (value === 'false') options[key] = false;\n else if (/^\\d+$/.test(value)) options[key] = Number.parseInt(value, 10);\n else if (/^\\d+\\.\\d+$/.test(value)) options[key] = Number.parseFloat(value);\n else options[key] = value;\n }\n\n return options;\n}\n"],"names":["parseUriOptions","resolveFilePath","url","filePath","pathname","host","path","join","os","homedir","decodeURIComponent","slice","process","cwd","fileURLToPath","URL","fs","mkdirSync","dirname","recursive","options","searchParams","key","value","test","Number","parseInt","parseFloat"],"mappings":";;;;;;;;;;;QAgCgBA;eAAAA;;QAxBAC;eAAAA;;;8DARI;8DACA;gEACE;uBACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKvB,SAASA,gBAAgBC,GAAQ;IACtC,IAAIC,WAAWD,IAAIE,QAAQ;IAE3B,8BAA8B;IAC9B,IAAIF,IAAIG,IAAI,KAAK,KAAK;QACpBF,WAAWG,UAAKC,IAAI,CAACC,QAAGC,OAAO,IAAIC,mBAAmBP,SAASQ,KAAK,CAAC;IACvE,OAEK,IAAIT,IAAIG,IAAI,KAAK,KAAK;QACzBF,WAAWG,UAAKC,IAAI,CAACK,QAAQC,GAAG,IAAIH,mBAAmBP,SAASQ,KAAK,CAAC;IACxE,OAAO;QACL,2EAA2E;QAC3ER,WAAWW,IAAAA,sBAAa,EAAC,IAAIC,IAAI,AAAC,UAAoBb,OAAXA,IAAIG,IAAI,EAAgB,OAAbH,IAAIE,QAAQ;IACpE;IAEA,0BAA0B;IAC1BY,QAAGC,SAAS,CAACX,UAAKY,OAAO,CAACf,WAAW;QAAEgB,WAAW;IAAK;IAEvD,OAAOhB;AACT;AAKO,SAASH,gBAAgBE,GAAQ;IACtC,IAAMkB,UAAmC,CAAC;QAErC,kCAAA,2BAAA;;QAAL,QAAK,YAAsBlB,IAAImB,YAAY,qBAAtC,SAAA,6BAAA,QAAA,yBAAA,iCAAwC;YAAxC,mCAAA,iBAAOC,sBAAKC;YACf,qBAAqB;YACrB,IAAIA,UAAU,QAAQH,OAAO,CAACE,IAAI,GAAG;iBAChC,IAAIC,UAAU,SAASH,OAAO,CAACE,IAAI,GAAG;iBACtC,IAAI,QAAQE,IAAI,CAACD,QAAQH,OAAO,CAACE,IAAI,GAAGG,OAAOC,QAAQ,CAACH,OAAO;iBAC/D,IAAI,aAAaC,IAAI,CAACD,QAAQH,OAAO,CAACE,IAAI,GAAGG,OAAOE,UAAU,CAACJ;iBAC/DH,OAAO,CAACE,IAAI,GAAGC;QACtB;;QAPK;QAAA;;;iBAAA,6BAAA;gBAAA;;;gBAAA;sBAAA;;;;IASL,OAAOH;AACT"}
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import * as os from 'node:os';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
4
5
|
/**
|
|
5
6
|
* Resolve file path from URL, handling ~ and . prefixes
|
|
6
7
|
*/ export function resolveFilePath(url) {
|
|
7
8
|
let filePath = url.pathname;
|
|
8
9
|
// Handle ~ for home directory
|
|
9
10
|
if (url.host === '~') {
|
|
10
|
-
filePath = path.join(os.homedir(), filePath.slice(1));
|
|
11
|
+
filePath = path.join(os.homedir(), decodeURIComponent(filePath.slice(1)));
|
|
11
12
|
} else if (url.host === '.') {
|
|
12
|
-
filePath = path.join(process.cwd(), filePath.slice(1));
|
|
13
|
+
filePath = path.join(process.cwd(), decodeURIComponent(filePath.slice(1)));
|
|
14
|
+
} else {
|
|
15
|
+
// File-backed adapters such as duckdb use the same native path conversion.
|
|
16
|
+
filePath = fileURLToPath(new URL(`file://${url.host}${url.pathname}`));
|
|
13
17
|
}
|
|
14
18
|
// Ensure directory exists
|
|
15
19
|
fs.mkdirSync(path.dirname(filePath), {
|
package/dist/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/keyv/keyv-registry/src/utils.ts"],"sourcesContent":["import * as fs from 'node:fs';\nimport * as os from 'node:os';\nimport * as path from 'node:path';\n\n/**\n * Resolve file path from URL, handling ~ and . prefixes\n */\nexport function resolveFilePath(url: URL): string {\n let filePath = url.pathname;\n\n // Handle ~ for home directory\n if (url.host === '~') {\n filePath = path.join(os.homedir(), filePath.slice(1));\n }\n // Handle . for current directory\n else if (url.host === '.') {\n filePath = path.join(process.cwd(), filePath.slice(1));\n }\n\n // Ensure directory exists\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n\n return filePath;\n}\n\n/**\n * Parse URL search params into options object with type conversion\n */\nexport function parseUriOptions(url: URL): Record<string, unknown> {\n const options: Record<string, unknown> = {};\n\n for (const [key, value] of url.searchParams) {\n // Auto-convert types\n if (value === 'true') options[key] = true;\n else if (value === 'false') options[key] = false;\n else if (/^\\d+$/.test(value)) options[key] = Number.parseInt(value, 10);\n else if (/^\\d+\\.\\d+$/.test(value)) options[key] = Number.parseFloat(value);\n else options[key] = value;\n }\n\n return options;\n}\n"],"names":["fs","os","path","resolveFilePath","url","filePath","pathname","host","join","homedir","slice","process","cwd","mkdirSync","dirname","recursive","parseUriOptions","options","key","value","searchParams","test","Number","parseInt","parseFloat"],"mappings":"AAAA,YAAYA,QAAQ,UAAU;AAC9B,YAAYC,QAAQ,UAAU;AAC9B,YAAYC,UAAU,YAAY;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/keyv/keyv-registry/src/utils.ts"],"sourcesContent":["import * as fs from 'node:fs';\nimport * as os from 'node:os';\nimport * as path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\n/**\n * Resolve file path from URL, handling ~ and . prefixes\n */\nexport function resolveFilePath(url: URL): string {\n let filePath = url.pathname;\n\n // Handle ~ for home directory\n if (url.host === '~') {\n filePath = path.join(os.homedir(), decodeURIComponent(filePath.slice(1)));\n }\n // Handle . for current directory\n else if (url.host === '.') {\n filePath = path.join(process.cwd(), decodeURIComponent(filePath.slice(1)));\n } else {\n // File-backed adapters such as duckdb use the same native path conversion.\n filePath = fileURLToPath(new URL(`file://${url.host}${url.pathname}`));\n }\n\n // Ensure directory exists\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n\n return filePath;\n}\n\n/**\n * Parse URL search params into options object with type conversion\n */\nexport function parseUriOptions(url: URL): Record<string, unknown> {\n const options: Record<string, unknown> = {};\n\n for (const [key, value] of url.searchParams) {\n // Auto-convert types\n if (value === 'true') options[key] = true;\n else if (value === 'false') options[key] = false;\n else if (/^\\d+$/.test(value)) options[key] = Number.parseInt(value, 10);\n else if (/^\\d+\\.\\d+$/.test(value)) options[key] = Number.parseFloat(value);\n else options[key] = value;\n }\n\n return options;\n}\n"],"names":["fs","os","path","fileURLToPath","resolveFilePath","url","filePath","pathname","host","join","homedir","decodeURIComponent","slice","process","cwd","URL","mkdirSync","dirname","recursive","parseUriOptions","options","key","value","searchParams","test","Number","parseInt","parseFloat"],"mappings":"AAAA,YAAYA,QAAQ,UAAU;AAC9B,YAAYC,QAAQ,UAAU;AAC9B,YAAYC,UAAU,YAAY;AAClC,SAASC,aAAa,QAAQ,WAAW;AAEzC;;CAEC,GACD,OAAO,SAASC,gBAAgBC,GAAQ;IACtC,IAAIC,WAAWD,IAAIE,QAAQ;IAE3B,8BAA8B;IAC9B,IAAIF,IAAIG,IAAI,KAAK,KAAK;QACpBF,WAAWJ,KAAKO,IAAI,CAACR,GAAGS,OAAO,IAAIC,mBAAmBL,SAASM,KAAK,C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