@vibe-validate/utils 0.18.3 → 0.18.4-rc.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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/path-helpers.d.ts +20 -0
- package/dist/path-helpers.d.ts.map +1 -1
- package/dist/path-helpers.js +24 -5
- package/dist/path-helpers.js.map +1 -1
- package/dist/test-helpers.d.ts +20 -0
- package/dist/test-helpers.d.ts.map +1 -0
- package/dist/test-helpers.js +28 -0
- package/dist/test-helpers.js.map +1 -0
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* @package @vibe-validate/utils
|
|
8
8
|
*/
|
|
9
9
|
export { safeExecSync, safeExecFromString, safeExecResult, isToolAvailable, getToolVersion, hasShellSyntax, CommandExecutionError, type SafeExecOptions, type SafeExecResult } from './safe-exec.js';
|
|
10
|
-
export { normalizedTmpdir, mkdirSyncReal, normalizePath } from './path-helpers.js';
|
|
10
|
+
export { normalizedTmpdir, mkdirSyncReal, normalizePath, toForwardSlash } from './path-helpers.js';
|
|
11
11
|
export { isProcessRunning } from './process-check.js';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,gBAAgB,EACjB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// Safe command execution (security-critical)
|
|
10
10
|
export { safeExecSync, safeExecFromString, safeExecResult, isToolAvailable, getToolVersion, hasShellSyntax, CommandExecutionError } from './safe-exec.js';
|
|
11
11
|
// Cross-platform path helpers (Windows 8.3 short name handling)
|
|
12
|
-
export { normalizedTmpdir, mkdirSyncReal, normalizePath } from './path-helpers.js';
|
|
12
|
+
export { normalizedTmpdir, mkdirSyncReal, normalizePath, toForwardSlash } from './path-helpers.js';
|
|
13
13
|
// Process checking (cross-platform)
|
|
14
14
|
export { isProcessRunning } from './process-check.js';
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,6CAA6C;AAC7C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,qBAAqB,EAGtB,MAAM,gBAAgB,CAAC;AAExB,gEAAgE;AAChE,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,6CAA6C;AAC7C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,qBAAqB,EAGtB,MAAM,gBAAgB,CAAC;AAExB,gEAAgE;AAChE,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACf,MAAM,mBAAmB,CAAC;AAE3B,oCAAoC;AACpC,OAAO,EACL,gBAAgB,EACjB,MAAM,oBAAoB,CAAC"}
|
package/dist/path-helpers.d.ts
CHANGED
|
@@ -87,4 +87,24 @@ export declare function mkdirSyncReal(path: string, options?: Parameters<typeof
|
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
89
|
export declare function normalizePath(...paths: string[]): string;
|
|
90
|
+
/**
|
|
91
|
+
* Convert a path to forward slashes
|
|
92
|
+
*
|
|
93
|
+
* Windows accepts both forward slashes and backslashes as path separators.
|
|
94
|
+
* This function normalizes all paths to use forward slashes for consistency.
|
|
95
|
+
* Useful for glob pattern matching, cross-platform comparisons, and string operations.
|
|
96
|
+
*
|
|
97
|
+
* @param p - Path to convert
|
|
98
|
+
* @returns Path with forward slashes
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* toForwardSlash('C:\\Users\\docs\\README.md')
|
|
103
|
+
* // Returns: 'C:/Users/docs/README.md'
|
|
104
|
+
*
|
|
105
|
+
* toForwardSlash('/project/docs/README.md')
|
|
106
|
+
* // Returns: '/project/docs/README.md' (unchanged)
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare function toForwardSlash(p: string): string;
|
|
90
110
|
//# 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;AAMlD;;;;;;;;;;;;;;;;;;;;;;;;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;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|
package/dist/path-helpers.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { mkdirSync, realpathSync } from 'node:fs';
|
|
10
10
|
import { tmpdir } from 'node:os';
|
|
11
|
+
import { resolve } from 'node:path';
|
|
11
12
|
/**
|
|
12
13
|
* Get normalized temp directory path
|
|
13
14
|
*
|
|
@@ -42,7 +43,6 @@ export function normalizedTmpdir() {
|
|
|
42
43
|
catch {
|
|
43
44
|
// Fallback to regular realpathSync
|
|
44
45
|
try {
|
|
45
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe: temp is from tmpdir()
|
|
46
46
|
return realpathSync(temp);
|
|
47
47
|
}
|
|
48
48
|
catch {
|
|
@@ -83,7 +83,6 @@ export function normalizedTmpdir() {
|
|
|
83
83
|
* ```
|
|
84
84
|
*/
|
|
85
85
|
export function mkdirSyncReal(path, options) {
|
|
86
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- This IS the mkdirSyncReal() implementation
|
|
87
86
|
mkdirSync(path, options);
|
|
88
87
|
try {
|
|
89
88
|
// Use native OS realpath for better Windows compatibility
|
|
@@ -92,7 +91,6 @@ export function mkdirSyncReal(path, options) {
|
|
|
92
91
|
catch {
|
|
93
92
|
// Fallback to regular realpathSync
|
|
94
93
|
try {
|
|
95
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe: path is function parameter
|
|
96
94
|
return realpathSync(path);
|
|
97
95
|
}
|
|
98
96
|
catch {
|
|
@@ -126,7 +124,7 @@ export function normalizePath(...paths) {
|
|
|
126
124
|
// First resolve to absolute path (handles multiple segments)
|
|
127
125
|
const resolved = paths.length === 1
|
|
128
126
|
? paths[0]
|
|
129
|
-
:
|
|
127
|
+
: resolve(...paths);
|
|
130
128
|
try {
|
|
131
129
|
// Use native OS realpath for better Windows compatibility
|
|
132
130
|
return realpathSync.native(resolved);
|
|
@@ -134,7 +132,6 @@ export function normalizePath(...paths) {
|
|
|
134
132
|
catch {
|
|
135
133
|
// Fallback to regular realpathSync
|
|
136
134
|
try {
|
|
137
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe: resolved is from path.resolve
|
|
138
135
|
return realpathSync(resolved);
|
|
139
136
|
}
|
|
140
137
|
catch {
|
|
@@ -143,4 +140,26 @@ export function normalizePath(...paths) {
|
|
|
143
140
|
}
|
|
144
141
|
}
|
|
145
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Convert a path to forward slashes
|
|
145
|
+
*
|
|
146
|
+
* Windows accepts both forward slashes and backslashes as path separators.
|
|
147
|
+
* This function normalizes all paths to use forward slashes for consistency.
|
|
148
|
+
* Useful for glob pattern matching, cross-platform comparisons, and string operations.
|
|
149
|
+
*
|
|
150
|
+
* @param p - Path to convert
|
|
151
|
+
* @returns Path with forward slashes
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* toForwardSlash('C:\\Users\\docs\\README.md')
|
|
156
|
+
* // Returns: 'C:/Users/docs/README.md'
|
|
157
|
+
*
|
|
158
|
+
* toForwardSlash('/project/docs/README.md')
|
|
159
|
+
* // Returns: '/project/docs/README.md' (unchanged)
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
export function toForwardSlash(p) {
|
|
163
|
+
return p.replaceAll('\\', '/');
|
|
164
|
+
}
|
|
146
165
|
//# 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;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,gBAAgB;IAE9B,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC;QACH,0DAA0D;QAC1D,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,mCAAmC;QACnC,IAAI,CAAC;YAEH,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,+BAA+B;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,OAAyC;IAGzC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEzB,IAAI,CAAC;QACH,0DAA0D;QAC1D,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,mCAAmC;QACnC,IAAI,CAAC;YAEH,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,+BAA+B;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,aAAa,CAAC,GAAG,KAAe;IAC9C,6DAA6D;IAC7D,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC;QACjC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QACV,CAAC,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IAEtB,IAAI,CAAC;QACH,0DAA0D;QAC1D,OAAO,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,mCAAmC;QACnC,IAAI,CAAC;YAEH,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;QAAC,MAAM,CAAC;YACP,iEAAiE;YACjE,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,cAAc,CAAC,CAAS;IACtC,OAAO,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Test Helpers
|
|
3
|
+
*
|
|
4
|
+
* Common utilities for tests across all packages
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Create a unique temporary test directory
|
|
8
|
+
*
|
|
9
|
+
* @returns Path to the created temporary directory
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* let testDir: string;
|
|
14
|
+
* beforeEach(async () => {
|
|
15
|
+
* testDir = await createTempTestDir();
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function createTempTestDir(): Promise<string>;
|
|
20
|
+
//# sourceMappingURL=test-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../src/test-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAKzD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Test Helpers
|
|
3
|
+
*
|
|
4
|
+
* Common utilities for tests across all packages
|
|
5
|
+
*/
|
|
6
|
+
import { mkdir } from 'node:fs/promises';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
import { normalizedTmpdir } from './path-helpers.js';
|
|
9
|
+
/**
|
|
10
|
+
* Create a unique temporary test directory
|
|
11
|
+
*
|
|
12
|
+
* @returns Path to the created temporary directory
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* let testDir: string;
|
|
17
|
+
* beforeEach(async () => {
|
|
18
|
+
* testDir = await createTempTestDir();
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export async function createTempTestDir() {
|
|
23
|
+
// eslint-disable-next-line sonarjs/pseudo-random -- Safe for test directory uniqueness
|
|
24
|
+
const testDir = join(normalizedTmpdir(), `vibe-validate-test-${Date.now()}-${Math.random()}`);
|
|
25
|
+
await mkdir(testDir, { recursive: true });
|
|
26
|
+
return testDir;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=test-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helpers.js","sourceRoot":"","sources":["../src/test-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,uFAAuF;IACvF,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,EAAE,EAAE,sBAAsB,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC9F,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-validate/utils",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.4-rc.2",
|
|
4
4
|
"description": "Common utilities for vibe-validate packages (command execution, path normalization)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./test-helpers": {
|
|
14
|
+
"types": "./dist/test-helpers.d.ts",
|
|
15
|
+
"import": "./dist/test-helpers.js"
|
|
12
16
|
}
|
|
13
17
|
},
|
|
14
18
|
"files": [
|