@eslint/config-array
Advanced tools
Comparing version
@@ -27,2 +27,3 @@ export { ObjectSchema } from "@eslint/object-schema"; | ||
* @param {Array<string>} [options.extraConfigTypes] List of config types supported. | ||
* @throws {TypeError} When the `basePath` is not a non-empty string, | ||
*/ | ||
@@ -29,0 +30,0 @@ constructor(configs: Iterable<any> | Function | any, { basePath, normalized, schema: customSchema, extraConfigTypes, }?: { |
@@ -704,3 +704,3 @@ // @ts-self-types="./index.d.ts" | ||
* @returns {void} | ||
* @throws {Error} When the config types array is invalid. | ||
* @throws {TypeError} When the config types array is invalid. | ||
*/ | ||
@@ -727,3 +727,3 @@ function assertExtraConfigTypes(extraConfigTypes) { | ||
* @returns {PathImpl} Path-handling implementations for the specified path. | ||
* @throws An error is thrown if the specified argument is not an absolute path. | ||
* @throws {Error} An error is thrown if the specified argument is not an absolute path. | ||
*/ | ||
@@ -806,2 +806,3 @@ function getPathImpl(fileOrDirPath) { | ||
* @param {Array<string>} [options.extraConfigTypes] List of config types supported. | ||
* @throws {TypeError} When the `basePath` is not a non-empty string, | ||
*/ | ||
@@ -1130,3 +1131,3 @@ constructor( | ||
let matchFound = false; | ||
const universalPattern = /^\*$|\/\*{1,2}$/u; | ||
const universalPattern = /^\*$|^!|\/\*{1,2}$/u; | ||
@@ -1162,6 +1163,34 @@ this.forEach((config, index) => { | ||
const universalFiles = config.files.filter(pattern => | ||
universalPattern.test(pattern), | ||
); | ||
const nonUniversalFiles = []; | ||
const universalFiles = config.files.filter(element => { | ||
if (Array.isArray(element)) { | ||
/* | ||
* filePath matches an element that is an array only if it matches | ||
* all patterns in it (AND operation). Therefore, if there is at least | ||
* one non-universal pattern in the array, and filePath matches the array, | ||
* then we know for sure that filePath matches at least one non-universal | ||
* pattern, so we can consider the entire array to be non-universal. | ||
* In other words, all patterns in the array need to be universal | ||
* for it to be considered universal. | ||
*/ | ||
if ( | ||
element.every(pattern => universalPattern.test(pattern)) | ||
) { | ||
return true; | ||
} | ||
nonUniversalFiles.push(element); | ||
return false; | ||
} | ||
// element is a string | ||
if (universalPattern.test(element)) { | ||
return true; | ||
} | ||
nonUniversalFiles.push(element); | ||
return false; | ||
}); | ||
// universal patterns were found so we need to check the config twice | ||
@@ -1171,6 +1200,2 @@ if (universalFiles.length) { | ||
const nonUniversalFiles = config.files.filter( | ||
pattern => !universalPattern.test(pattern), | ||
); | ||
// check that the config matches without the non-universal files first | ||
@@ -1177,0 +1202,0 @@ if ( |
@@ -1,2 +0,2 @@ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// Copyright the Browserify authors. MIT License. | ||
@@ -9,3 +9,3 @@ function assertPath(path) { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -48,3 +48,33 @@ function stripSuffix(name, suffix) { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
function assertArg$3(url) { | ||
url = url instanceof URL ? url : new URL(url); | ||
if (url.protocol !== "file:") { | ||
throw new TypeError(`URL must be a file URL: received "${url.protocol}"`); | ||
} | ||
return url; | ||
} | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
/** | ||
* Converts a file URL to a path string. | ||
* | ||
* @example Usage | ||
* ```ts | ||
* import { fromFileUrl } from "@std/path/posix/from-file-url"; | ||
* import { assertEquals } from "@std/assert"; | ||
* | ||
* assertEquals(fromFileUrl(new URL("file:///home/foo")), "/home/foo"); | ||
* ``` | ||
* | ||
* @param url The file URL to convert. | ||
* @returns The path string. | ||
*/ function fromFileUrl(url) { | ||
url = assertArg$3(url); | ||
return decodeURIComponent(url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25")); | ||
} | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// Copyright the Browserify authors. MIT License. | ||
@@ -68,3 +98,3 @@ // Ported from https://github.com/browserify/path-browserify/ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// Copyright the Browserify authors. MIT License. | ||
@@ -78,3 +108,3 @@ // Ported from https://github.com/browserify/path-browserify/ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// Copyright the Browserify authors. MIT License. | ||
@@ -87,3 +117,3 @@ // Ported from https://github.com/browserify/path-browserify/ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -102,2 +132,4 @@ /** | ||
* assertEquals(basename("/home/user/Documents/image.png", ".png"), "image"); | ||
* assertEquals(basename(new URL("file:///home/user/Documents/image.png")), "image.png"); | ||
* assertEquals(basename(new URL("file:///home/user/Documents/image.png"), ".png"), "image"); | ||
* ``` | ||
@@ -122,5 +154,2 @@ * | ||
* | ||
* Note: If you are working with file URLs, | ||
* use the new version of `basename` from `@std/path/posix/unstable-basename`. | ||
* | ||
* @param path The path to extract the name from. | ||
@@ -130,2 +159,5 @@ * @param suffix The suffix to remove from extracted name. | ||
*/ function basename(path, suffix = "") { | ||
if (path instanceof URL) { | ||
path = fromFileUrl(path); | ||
} | ||
assertArgs$1(path, suffix); | ||
@@ -137,3 +169,3 @@ const lastSegment = lastPathSegment(path, isPosixPathSeparator); | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -150,5 +182,5 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
function assertArg$3(path) { | ||
function assertArg$2(path) { | ||
assertPath(path); | ||
@@ -158,3 +190,3 @@ if (path.length === 0) return "."; | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -172,2 +204,3 @@ /** | ||
* assertEquals(dirname("https://deno.land/std/path/mod.ts"), "https://deno.land/std/path"); | ||
* assertEquals(dirname(new URL("file:///home/user/Documents/image.png")), "/home/user/Documents"); | ||
* ``` | ||
@@ -186,9 +219,9 @@ * | ||
* | ||
* Note: If you are working with file URLs, | ||
* use the new version of `dirname` from `@std/path/posix/unstable-dirname`. | ||
* | ||
* @param path The path to get the directory from. | ||
* @returns The directory path. | ||
*/ function dirname(path) { | ||
assertArg$3(path); | ||
if (path instanceof URL) { | ||
path = fromFileUrl(path); | ||
} | ||
assertArg$2(path); | ||
let end = -1; | ||
@@ -219,3 +252,3 @@ let matchedNonSeparator = false; | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -233,2 +266,5 @@ /** | ||
* assertEquals(extname("/home/user/Documents/image.png"), ".png"); | ||
* assertEquals(extname(new URL("file:///home/user/Documents/file.ts")), ".ts"); | ||
* assertEquals(extname(new URL("file:///home/user/Documents/file.ts?a=b")), ".ts"); | ||
* assertEquals(extname(new URL("file:///home/user/Documents/file.ts#header")), ".ts"); | ||
* ``` | ||
@@ -252,8 +288,8 @@ * | ||
* | ||
* Note: If you are working with file URLs, | ||
* use the new version of `extname` from `@std/path/posix/unstable-extname`. | ||
* | ||
* @param path The path to get the extension from. | ||
* @returns The extension (ex. for `file.ts` returns `.ts`). | ||
*/ function extname(path) { | ||
if (path instanceof URL) { | ||
path = fromFileUrl(path); | ||
} | ||
assertPath(path); | ||
@@ -302,3 +338,3 @@ let startDot = -1; | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -313,3 +349,3 @@ function _format(sep, pathObject) { | ||
} | ||
function assertArg$2(pathObject) { | ||
function assertArg$1(pathObject) { | ||
if (pathObject === null || typeof pathObject !== "object") { | ||
@@ -320,3 +356,3 @@ throw new TypeError(`The "pathObject" argument must be of type Object, received type "${typeof pathObject}"`); | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -344,39 +380,9 @@ /** | ||
*/ function format(pathObject) { | ||
assertArg$2(pathObject); | ||
assertArg$1(pathObject); | ||
return _format("/", pathObject); | ||
} | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
function assertArg$1(url) { | ||
url = url instanceof URL ? url : new URL(url); | ||
if (url.protocol !== "file:") { | ||
throw new TypeError(`URL must be a file URL: received "${url.protocol}"`); | ||
} | ||
return url; | ||
} | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// This module is browser compatible. | ||
/** | ||
* Converts a file URL to a path string. | ||
* | ||
* @example Usage | ||
* ```ts | ||
* import { fromFileUrl } from "@std/path/posix/from-file-url"; | ||
* import { assertEquals } from "@std/assert"; | ||
* | ||
* assertEquals(fromFileUrl(new URL("file:///home/foo")), "/home/foo"); | ||
* ``` | ||
* | ||
* @param url The file URL to convert. | ||
* @returns The path string. | ||
*/ function fromFileUrl(url) { | ||
url = assertArg$1(url); | ||
return decodeURIComponent(url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25")); | ||
} | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// This module is browser compatible. | ||
/** | ||
* Verifies whether provided path is absolute. | ||
@@ -400,3 +406,3 @@ * | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -408,3 +414,3 @@ function assertArg(path) { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// Copyright the Browserify authors. MIT License. | ||
@@ -468,3 +474,3 @@ // Ported from https://github.com/browserify/path-browserify/ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -481,4 +487,4 @@ /** | ||
* | ||
* const path = normalize("/foo/bar//baz/asdf/quux/.."); | ||
* assertEquals(path, "/foo/bar/baz/asdf"); | ||
* assertEquals(normalize("/foo/bar//baz/asdf/quux/.."), "/foo/bar/baz/asdf"); | ||
* assertEquals(normalize(new URL("file:///foo/bar//baz/asdf/quux/..")), "/foo/bar/baz/asdf/"); | ||
* ``` | ||
@@ -504,8 +510,8 @@ * | ||
* | ||
* Note: If you are working with file URLs, | ||
* use the new version of `normalize` from `@std/path/posix/unstable-normalize`. | ||
* | ||
* @param path The path to normalize. | ||
* @returns The normalized path. | ||
*/ function normalize(path) { | ||
if (path instanceof URL) { | ||
path = fromFileUrl(path); | ||
} | ||
assertArg(path); | ||
@@ -522,3 +528,3 @@ const isAbsolute = isPosixPathSeparator(path.charCodeAt(0)); | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -533,4 +539,4 @@ /** | ||
* | ||
* const path = join("/foo", "bar", "baz/asdf", "quux", ".."); | ||
* assertEquals(path, "/foo/bar/baz/asdf"); | ||
* assertEquals(join("/foo", "bar", "baz/asdf", "quux", ".."), "/foo/bar/baz/asdf"); | ||
* assertEquals(join(new URL("file:///foo"), "bar", "baz/asdf", "quux", ".."), "/foo/bar/baz/asdf"); | ||
* ``` | ||
@@ -551,9 +557,14 @@ * | ||
* | ||
* Note: If you are working with file URLs, | ||
* use the new version of `join` from `@std/path/posix/unstable-join`. | ||
* | ||
* @param path The path to join. This can be string or file URL. | ||
* @param paths The paths to join. | ||
* @returns The joined path. | ||
*/ function join(...paths) { | ||
if (paths.length === 0) return "."; | ||
*/ function join(path, ...paths) { | ||
if (path === undefined) return "."; | ||
if (path instanceof URL) { | ||
path = fromFileUrl(path); | ||
} | ||
paths = path ? [ | ||
path, | ||
...paths | ||
] : paths; | ||
paths.forEach((path)=>assertPath(path)); | ||
@@ -564,3 +575,3 @@ const joined = paths.filter((path)=>path.length > 0).join("/"); | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -669,3 +680,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -719,3 +730,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -728,3 +739,3 @@ function assertArgs(from, to) { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -820,3 +831,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -837,3 +848,3 @@ const WHITESPACE_ENCODINGS = { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -863,3 +874,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -884,3 +895,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -909,3 +920,3 @@ function common$1(paths, sep) { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -932,3 +943,3 @@ /** Determines the common path from a set of paths for POSIX systems. | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1146,3 +1157,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1230,3 +1241,3 @@ const constants = { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1276,3 +1287,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1307,3 +1318,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1310,0 +1321,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// Copyright the Browserify authors. MIT License. | ||
@@ -9,3 +9,3 @@ function assertPath(path) { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -48,3 +48,3 @@ function stripSuffix(name, suffix) { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// Copyright the Browserify authors. MIT License. | ||
@@ -65,3 +65,3 @@ // Ported from https://github.com/browserify/path-browserify/ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// Copyright the Browserify authors. MIT License. | ||
@@ -85,3 +85,3 @@ // Ported from https://github.com/browserify/path-browserify/ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// Copyright the Browserify authors. MIT License. | ||
@@ -100,5 +100,44 @@ // Ported from https://github.com/browserify/path-browserify/ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
function assertArg$3(url) { | ||
url = url instanceof URL ? url : new URL(url); | ||
if (url.protocol !== "file:") { | ||
throw new TypeError(`URL must be a file URL: received "${url.protocol}"`); | ||
} | ||
return url; | ||
} | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
/** | ||
* Converts a file URL to a path string. | ||
* | ||
* @example Usage | ||
* ```ts | ||
* import { fromFileUrl } from "@std/path/windows/from-file-url"; | ||
* import { assertEquals } from "@std/assert"; | ||
* | ||
* assertEquals(fromFileUrl("file:///home/foo"), "\\home\\foo"); | ||
* assertEquals(fromFileUrl("file:///C:/Users/foo"), "C:\\Users\\foo"); | ||
* assertEquals(fromFileUrl("file://localhost/home/foo"), "\\home\\foo"); | ||
* ``` | ||
* | ||
* @param url The file URL to convert. | ||
* @returns The path string. | ||
*/ function fromFileUrl(url) { | ||
url = assertArg$3(url); | ||
let path = decodeURIComponent(url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\"); | ||
if (url.hostname !== "") { | ||
// Note: The `URL` implementation guarantees that the drive letter and | ||
// hostname are mutually exclusive. Otherwise it would not have been valid | ||
// to append the hostname and path like this. | ||
path = `\\\\${url.hostname}${path}`; | ||
} | ||
return path; | ||
} | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
/** | ||
* Return the last portion of a `path`. | ||
@@ -115,7 +154,6 @@ * Trailing directory separators are ignored, and optional suffix is removed. | ||
* assertEquals(basename("C:\\user\\Documents\\image.png", ".png"), "image"); | ||
* assertEquals(basename(new URL("file:///C:/user/Documents/image.png")), "image.png"); | ||
* assertEquals(basename(new URL("file:///C:/user/Documents/image.png"), ".png"), "image"); | ||
* ``` | ||
* | ||
* Note: If you are working with file URLs, | ||
* use the new version of `basename` from `@std/path/windows/unstable-basename`. | ||
* | ||
* @param path The path to extract the name from. | ||
@@ -125,2 +163,5 @@ * @param suffix The suffix to remove from extracted name. | ||
*/ function basename(path, suffix = "") { | ||
if (path instanceof URL) { | ||
path = fromFileUrl(path); | ||
} | ||
assertArgs$1(path, suffix); | ||
@@ -142,3 +183,3 @@ // Check for a drive letter prefix so as not to mistake the following | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -155,5 +196,5 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
function assertArg$3(path) { | ||
function assertArg$2(path) { | ||
assertPath(path); | ||
@@ -163,3 +204,3 @@ if (path.length === 0) return "."; | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -174,13 +215,13 @@ /** | ||
* | ||
* const dir = dirname("C:\\foo\\bar\\baz.ext"); | ||
* assertEquals(dir, "C:\\foo\\bar"); | ||
* assertEquals(dirname("C:\\foo\\bar\\baz.ext"), "C:\\foo\\bar"); | ||
* assertEquals(dirname(new URL("file:///C:/foo/bar/baz.ext")), "C:\\foo\\bar"); | ||
* ``` | ||
* | ||
* Note: If you are working with file URLs, | ||
* use the new version of `dirname` from `@std/path/windows/unstable-dirname`. | ||
* | ||
* @param path The path to get the directory from. | ||
* @returns The directory path. | ||
*/ function dirname(path) { | ||
assertArg$3(path); | ||
if (path instanceof URL) { | ||
path = fromFileUrl(path); | ||
} | ||
assertArg$2(path); | ||
const len = path.length; | ||
@@ -264,3 +305,3 @@ let rootEnd = -1; | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -275,12 +316,12 @@ /** | ||
* | ||
* const ext = extname("file.ts"); | ||
* assertEquals(ext, ".ts"); | ||
* assertEquals(extname("file.ts"), ".ts"); | ||
* assertEquals(extname(new URL("file:///C:/foo/bar/baz.ext")), ".ext"); | ||
* ``` | ||
* | ||
* Note: If you are working with file URLs, | ||
* use the new version of `extname` from `@std/path/windows/unstable-extname`. | ||
* | ||
* @param path The path to get the extension from. | ||
* @returns The extension of the `path`. | ||
*/ function extname(path) { | ||
if (path instanceof URL) { | ||
path = fromFileUrl(path); | ||
} | ||
assertPath(path); | ||
@@ -336,3 +377,3 @@ let start = 0; | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -347,3 +388,3 @@ function _format(sep, pathObject) { | ||
} | ||
function assertArg$2(pathObject) { | ||
function assertArg$1(pathObject) { | ||
if (pathObject === null || typeof pathObject !== "object") { | ||
@@ -354,3 +395,3 @@ throw new TypeError(`The "pathObject" argument must be of type Object, received type "${typeof pathObject}"`); | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -378,48 +419,9 @@ /** | ||
*/ function format(pathObject) { | ||
assertArg$2(pathObject); | ||
assertArg$1(pathObject); | ||
return _format("\\", pathObject); | ||
} | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
function assertArg$1(url) { | ||
url = url instanceof URL ? url : new URL(url); | ||
if (url.protocol !== "file:") { | ||
throw new TypeError(`URL must be a file URL: received "${url.protocol}"`); | ||
} | ||
return url; | ||
} | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// This module is browser compatible. | ||
/** | ||
* Converts a file URL to a path string. | ||
* | ||
* @example Usage | ||
* ```ts | ||
* import { fromFileUrl } from "@std/path/windows/from-file-url"; | ||
* import { assertEquals } from "@std/assert"; | ||
* | ||
* assertEquals(fromFileUrl("file:///home/foo"), "\\home\\foo"); | ||
* assertEquals(fromFileUrl("file:///C:/Users/foo"), "C:\\Users\\foo"); | ||
* assertEquals(fromFileUrl("file://localhost/home/foo"), "\\home\\foo"); | ||
* ``` | ||
* | ||
* @param url The file URL to convert. | ||
* @returns The path string. | ||
*/ function fromFileUrl(url) { | ||
url = assertArg$1(url); | ||
let path = decodeURIComponent(url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\"); | ||
if (url.hostname !== "") { | ||
// Note: The `URL` implementation guarantees that the drive letter and | ||
// hostname are mutually exclusive. Otherwise it would not have been valid | ||
// to append the hostname and path like this. | ||
path = `\\\\${url.hostname}${path}`; | ||
} | ||
return path; | ||
} | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// This module is browser compatible. | ||
/** | ||
* Verifies whether provided path is absolute. | ||
@@ -454,3 +456,3 @@ * | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -462,3 +464,3 @@ function assertArg(path) { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// Copyright the Browserify authors. MIT License. | ||
@@ -522,3 +524,3 @@ // Ported from https://github.com/browserify/path-browserify/ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -535,12 +537,12 @@ /** | ||
* | ||
* const normalized = normalize("C:\\foo\\..\\bar"); | ||
* assertEquals(normalized, "C:\\bar"); | ||
* assertEquals(normalize("C:\\foo\\..\\bar"), "C:\\bar"); | ||
* assertEquals(normalize(new URL("file:///C:/foo/../bar")), "C:\\bar"); | ||
* ``` | ||
* | ||
* Note: If you are working with file URLs, | ||
* use the new version of `normalize` from `@std/path/windows/unstable-normalize`. | ||
* | ||
* @param path The path to normalize | ||
* @returns The normalized path | ||
*/ function normalize(path) { | ||
if (path instanceof URL) { | ||
path = fromFileUrl(path); | ||
} | ||
assertArg(path); | ||
@@ -640,3 +642,3 @@ const len = path.length; | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -651,12 +653,17 @@ /** | ||
* | ||
* const joined = join("C:\\foo", "bar", "baz\\.."); | ||
* assertEquals(joined, "C:\\foo\\bar"); | ||
* assertEquals(join("C:\\foo", "bar", "baz\\.."), "C:\\foo\\bar"); | ||
* assertEquals(join(new URL("file:///C:/foo"), "bar", "baz\\.."), "C:\\foo\\bar"); | ||
* ``` | ||
* | ||
* Note: If you are working with file URLs, | ||
* use the new version of `join` from `@std/path/windows/unstable-join`. | ||
* | ||
* @param path The path to join. This can be string or file URL. | ||
* @param paths The paths to join. | ||
* @returns The joined path. | ||
*/ function join(...paths) { | ||
*/ function join(path, ...paths) { | ||
if (path instanceof URL) { | ||
path = fromFileUrl(path); | ||
} | ||
paths = path ? [ | ||
path, | ||
...paths | ||
] : paths; | ||
paths.forEach((path)=>assertPath(path)); | ||
@@ -709,3 +716,3 @@ paths = paths.filter((path)=>path.length > 0); | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -871,3 +878,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1006,3 +1013,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1015,3 +1022,3 @@ function assertArgs(from, to) { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1129,3 +1136,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1146,3 +1153,3 @@ const WHITESPACE_ENCODINGS = { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1179,3 +1186,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1222,3 +1229,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1247,3 +1254,3 @@ function common$1(paths, sep) { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1271,3 +1278,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1485,3 +1492,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1570,3 +1577,3 @@ const constants = { | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1616,3 +1623,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1647,3 +1654,3 @@ /** | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// Copyright 2018-2025 the Deno authors. MIT license. | ||
// This module is browser compatible. | ||
@@ -1650,0 +1657,0 @@ /** |
{ | ||
"name": "@eslint/config-array", | ||
"version": "0.20.0", | ||
"version": "0.20.1", | ||
"description": "General purpose glob-based configuration matching.", | ||
@@ -27,3 +27,4 @@ "author": "Nicholas C. Zakas", | ||
"type": "git", | ||
"url": "git+https://github.com/eslint/rewrite.git" | ||
"url": "git+https://github.com/eslint/rewrite.git", | ||
"directory": "packages/config-array" | ||
}, | ||
@@ -33,3 +34,3 @@ "bugs": { | ||
}, | ||
"homepage": "https://github.com/eslint/rewrite#readme", | ||
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/config-array#readme", | ||
"scripts": { | ||
@@ -36,0 +37,0 @@ "build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js", |
@@ -20,3 +20,3 @@ # Config Array | ||
# or | ||
bun install @eslint/config-array | ||
bun add @eslint/config-array | ||
``` | ||
@@ -351,7 +351,8 @@ | ||
<h3>Platinum Sponsors</h3> | ||
<h3>Diamond Sponsors</h3> | ||
<p><a href="https://www.ag-grid.com/"><img src="https://images.opencollective.com/ag-grid/bec0580/logo.png" alt="AG Grid" height="128"></a></p><h3>Platinum Sponsors</h3> | ||
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3> | ||
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3> | ||
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3> | ||
<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nolebase.ayaka.io"><img src="https://avatars.githubusercontent.com/u/11081491" alt="Neko" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p> | ||
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3> | ||
<p><a href="https://sentry.io"><img src="https://github.com/getsentry.png" alt="Sentry" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nolebase.ayaka.io"><img src="https://avatars.githubusercontent.com/u/11081491" alt="Neko" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p> | ||
<h3>Technology Sponsors</h3> | ||
@@ -358,0 +359,0 @@ Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
319671
0.34%8442
0.97%360
0.28%