@vitest/utils 5.0.0-beta.1 → 5.0.0-beta.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/helpers.d.ts CHANGED
@@ -75,6 +75,7 @@ declare function ordinal(i: number): string;
75
75
  */
76
76
  declare function deepMerge<T extends object = object>(target: T, ...sources: any[]): T;
77
77
  declare function unique<T>(array: T[]): T[];
78
+ declare function sanitizeFilePath(s: string): string;
78
79
 
79
- export { assertTypes, cleanUrl, clone, createDefer, createSimpleStackTrace, deepClone, deepMerge, filterOutComments, getCallLastIndex, getOwnProperties, getType, isBareImport, isExternalUrl, isNegativeNaN, isObject, isPrimitive, nanoid, noop, notNullish, objectAttr, ordinal, shuffle, slash, splitFileAndPostfix, toArray, unique, unwrapId, withTrailingSlash, wrapId };
80
+ export { assertTypes, cleanUrl, clone, createDefer, createSimpleStackTrace, deepClone, deepMerge, filterOutComments, getCallLastIndex, getOwnProperties, getType, isBareImport, isExternalUrl, isNegativeNaN, isObject, isPrimitive, nanoid, noop, notNullish, objectAttr, ordinal, sanitizeFilePath, shuffle, slash, splitFileAndPostfix, toArray, unique, unwrapId, withTrailingSlash, wrapId };
80
81
  export type { DeferPromise };
package/dist/helpers.js CHANGED
@@ -340,5 +340,9 @@ function deepMerge(target, ...sources) {
340
340
  function unique(array) {
341
341
  return Array.from(new Set(array));
342
342
  }
343
+ function sanitizeFilePath(s) {
344
+ // eslint-disable-next-line no-control-regex
345
+ return s.replace(/[\x00-\x2C\x2E\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/g, "-");
346
+ }
343
347
 
344
- export { assertTypes, cleanUrl, clone, createDefer, createSimpleStackTrace, deepClone, deepMerge, filterOutComments, getCallLastIndex, getOwnProperties, getType, isBareImport, isExternalUrl, isNegativeNaN, isObject, isPrimitive, nanoid, noop, notNullish, objectAttr, ordinal, shuffle, slash, splitFileAndPostfix, toArray, unique, unwrapId, withTrailingSlash, wrapId };
348
+ export { assertTypes, cleanUrl, clone, createDefer, createSimpleStackTrace, deepClone, deepMerge, filterOutComments, getCallLastIndex, getOwnProperties, getType, isBareImport, isExternalUrl, isNegativeNaN, isObject, isPrimitive, nanoid, noop, notNullish, objectAttr, ordinal, sanitizeFilePath, shuffle, slash, splitFileAndPostfix, toArray, unique, unwrapId, withTrailingSlash, wrapId };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/utils",
3
3
  "type": "module",
4
- "version": "5.0.0-beta.1",
4
+ "version": "5.0.0-beta.2",
5
5
  "description": "Shared Vitest utility functions",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -86,7 +86,7 @@
86
86
  "dependencies": {
87
87
  "convert-source-map": "^2.0.0",
88
88
  "tinyrainbow": "^3.1.0",
89
- "@vitest/pretty-format": "5.0.0-beta.1"
89
+ "@vitest/pretty-format": "5.0.0-beta.2"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@jridgewell/trace-mapping": "0.3.31",