@vibe-validate/utils 0.18.4-rc.1 → 0.18.4

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 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
@@ -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,EACd,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,gBAAgB,EACjB,MAAM,oBAAoB,CAAC"}
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,EACd,MAAM,mBAAmB,CAAC;AAE3B,oCAAoC;AACpC,OAAO,EACL,gBAAgB,EACjB,MAAM,oBAAoB,CAAC"}
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"}
@@ -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;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"}
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"}
@@ -43,7 +43,6 @@ export function normalizedTmpdir() {
43
43
  catch {
44
44
  // Fallback to regular realpathSync
45
45
  try {
46
- // eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe: temp is from tmpdir()
47
46
  return realpathSync(temp);
48
47
  }
49
48
  catch {
@@ -84,7 +83,6 @@ export function normalizedTmpdir() {
84
83
  * ```
85
84
  */
86
85
  export function mkdirSyncReal(path, options) {
87
- // eslint-disable-next-line security/detect-non-literal-fs-filename -- This IS the mkdirSyncReal() implementation
88
86
  mkdirSync(path, options);
89
87
  try {
90
88
  // Use native OS realpath for better Windows compatibility
@@ -93,7 +91,6 @@ export function mkdirSyncReal(path, options) {
93
91
  catch {
94
92
  // Fallback to regular realpathSync
95
93
  try {
96
- // eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe: path is function parameter
97
94
  return realpathSync(path);
98
95
  }
99
96
  catch {
@@ -135,7 +132,6 @@ export function normalizePath(...paths) {
135
132
  catch {
136
133
  // Fallback to regular realpathSync
137
134
  try {
138
- // eslint-disable-next-line security/detect-non-literal-fs-filename -- Safe: resolved is from path.resolve
139
135
  return realpathSync(resolved);
140
136
  }
141
137
  catch {
@@ -144,4 +140,26 @@ export function normalizePath(...paths) {
144
140
  }
145
141
  }
146
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
+ }
147
165
  //# sourceMappingURL=path-helpers.js.map
@@ -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;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;YACH,kGAAkG;YAClG,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;IAEzC,iHAAiH;IACjH,SAAS,CAAC,IAAI,EAAE,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AQ,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.4-rc.1",
3
+ "version": "0.18.4",
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": [