@vibe-validate/utils 0.17.6 → 0.18.0-rc.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/dist/path-helpers.d.ts +9 -4
- package/dist/path-helpers.d.ts.map +1 -1
- package/dist/path-helpers.js +47 -18
- package/dist/path-helpers.js.map +1 -1
- package/package.json +1 -1
package/dist/path-helpers.d.ts
CHANGED
|
@@ -69,17 +69,22 @@ export declare function mkdirSyncReal(path: string, options?: Parameters<typeof
|
|
|
69
69
|
* Normalize any path (resolve short names on Windows)
|
|
70
70
|
*
|
|
71
71
|
* Utility to normalize paths without creating directories.
|
|
72
|
-
*
|
|
72
|
+
* Accepts multiple path segments like path.resolve() for convenience.
|
|
73
73
|
*
|
|
74
|
-
* @param
|
|
75
|
-
* @returns Real (normalized) path, or
|
|
74
|
+
* @param paths - Path segments to join and normalize
|
|
75
|
+
* @returns Real (normalized) path, or resolved path if normalization fails
|
|
76
76
|
*
|
|
77
77
|
* @example
|
|
78
78
|
* ```typescript
|
|
79
|
+
* // Single path
|
|
79
80
|
* const shortPath = 'C:\\PROGRA~1\\nodejs';
|
|
80
81
|
* const longPath = normalizePath(shortPath);
|
|
81
82
|
* // Result: 'C:\\Program Files\\nodejs'
|
|
83
|
+
*
|
|
84
|
+
* // Multiple segments (like path.resolve)
|
|
85
|
+
* const cliPath = normalizePath(__dirname, '../../dist/bin.js');
|
|
86
|
+
* // Resolves to absolute path AND normalizes short names
|
|
82
87
|
* ```
|
|
83
88
|
*/
|
|
84
|
-
export declare function normalizePath(
|
|
89
|
+
export declare function normalizePath(...paths: string[]): string;
|
|
85
90
|
//# sourceMappingURL=path-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-helpers.d.ts","sourceRoot":"","sources":["../src/path-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAgB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"path-helpers.d.ts","sourceRoot":"","sources":["../src/path-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAgB,MAAM,SAAS,CAAC;AAKlD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAgBzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,GACxC,MAAM,CAiBR;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAmBxD"}
|
package/dist/path-helpers.js
CHANGED
|
@@ -36,13 +36,19 @@ import { tmpdir } from 'node:os';
|
|
|
36
36
|
export function normalizedTmpdir() {
|
|
37
37
|
const temp = tmpdir();
|
|
38
38
|
try {
|
|
39
|
-
//
|
|
40
|
-
return realpathSync(temp);
|
|
39
|
+
// Use native OS realpath for better Windows compatibility
|
|
40
|
+
return realpathSync.native(temp);
|
|
41
41
|
}
|
|
42
42
|
catch {
|
|
43
|
-
// Fallback
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
// Fallback to regular realpathSync
|
|
44
|
+
try {
|
|
45
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe: temp is from tmpdir()
|
|
46
|
+
return realpathSync(temp);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// Last resort: return original
|
|
50
|
+
return temp;
|
|
51
|
+
}
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
/**
|
|
@@ -77,41 +83,64 @@ export function normalizedTmpdir() {
|
|
|
77
83
|
* ```
|
|
78
84
|
*/
|
|
79
85
|
export function mkdirSyncReal(path, options) {
|
|
80
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename --
|
|
86
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- This IS the mkdirSyncReal() implementation
|
|
81
87
|
mkdirSync(path, options);
|
|
82
88
|
try {
|
|
83
|
-
//
|
|
84
|
-
return realpathSync(path);
|
|
89
|
+
// Use native OS realpath for better Windows compatibility
|
|
90
|
+
return realpathSync.native(path);
|
|
85
91
|
}
|
|
86
92
|
catch {
|
|
87
|
-
// Fallback
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
// Fallback to regular realpathSync
|
|
94
|
+
try {
|
|
95
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe: path is function parameter
|
|
96
|
+
return realpathSync(path);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// Last resort: return original
|
|
100
|
+
return path;
|
|
101
|
+
}
|
|
90
102
|
}
|
|
91
103
|
}
|
|
92
104
|
/**
|
|
93
105
|
* Normalize any path (resolve short names on Windows)
|
|
94
106
|
*
|
|
95
107
|
* Utility to normalize paths without creating directories.
|
|
96
|
-
*
|
|
108
|
+
* Accepts multiple path segments like path.resolve() for convenience.
|
|
97
109
|
*
|
|
98
|
-
* @param
|
|
99
|
-
* @returns Real (normalized) path, or
|
|
110
|
+
* @param paths - Path segments to join and normalize
|
|
111
|
+
* @returns Real (normalized) path, or resolved path if normalization fails
|
|
100
112
|
*
|
|
101
113
|
* @example
|
|
102
114
|
* ```typescript
|
|
115
|
+
* // Single path
|
|
103
116
|
* const shortPath = 'C:\\PROGRA~1\\nodejs';
|
|
104
117
|
* const longPath = normalizePath(shortPath);
|
|
105
118
|
* // Result: 'C:\\Program Files\\nodejs'
|
|
119
|
+
*
|
|
120
|
+
* // Multiple segments (like path.resolve)
|
|
121
|
+
* const cliPath = normalizePath(__dirname, '../../dist/bin.js');
|
|
122
|
+
* // Resolves to absolute path AND normalizes short names
|
|
106
123
|
* ```
|
|
107
124
|
*/
|
|
108
|
-
export function normalizePath(
|
|
125
|
+
export function normalizePath(...paths) {
|
|
126
|
+
// First resolve to absolute path (handles multiple segments)
|
|
127
|
+
const resolved = paths.length === 1
|
|
128
|
+
? paths[0]
|
|
129
|
+
: require('node:path').resolve(...paths);
|
|
109
130
|
try {
|
|
110
|
-
//
|
|
111
|
-
return realpathSync(
|
|
131
|
+
// Use native OS realpath for better Windows compatibility
|
|
132
|
+
return realpathSync.native(resolved);
|
|
112
133
|
}
|
|
113
134
|
catch {
|
|
114
|
-
|
|
135
|
+
// Fallback to regular realpathSync
|
|
136
|
+
try {
|
|
137
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe: resolved is from path.resolve
|
|
138
|
+
return realpathSync(resolved);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
// Last resort: return resolved path (better than original input)
|
|
142
|
+
return resolved;
|
|
143
|
+
}
|
|
115
144
|
}
|
|
116
145
|
}
|
|
117
146
|
//# sourceMappingURL=path-helpers.js.map
|
package/dist/path-helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-helpers.js","sourceRoot":"","sources":["../src/path-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"path-helpers.js","sourceRoot":"","sources":["../src/path-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIjC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,gBAAgB;IAE9B,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC;QACH,0DAA0D;QAC1D,OAAO,YAAY,CAAC,MAAM,CAAC,IA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