@soda-gql/builder 0.11.26 → 0.12.0
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.cjs +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/plugin-support.cjs +1 -1
- package/dist/plugin-support.d.cts.map +1 -1
- package/dist/plugin-support.mjs +1 -1
- package/dist/{service-B381lWB2.mjs → service-CqUHXFUE.mjs} +1972 -74
- package/dist/service-CqUHXFUE.mjs.map +1 -0
- package/dist/{service-BKOjRyct.cjs → service-acu0uwVA.cjs} +1882 -12
- package/dist/service-acu0uwVA.cjs.map +1 -0
- package/package.json +14 -11
- package/dist/service-B381lWB2.mjs.map +0 -1
- package/dist/service-BKOjRyct.cjs.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "node:module";
|
|
1
2
|
import { existsSync, readFileSync, realpathSync, statSync, unlinkSync } from "node:fs";
|
|
2
3
|
import { readFile, stat } from "node:fs/promises";
|
|
3
4
|
import { err, ok } from "neverthrow";
|
|
@@ -5,7 +6,7 @@ import { z } from "zod";
|
|
|
5
6
|
import { createHash } from "node:crypto";
|
|
6
7
|
import { extname, join, normalize, resolve } from "node:path";
|
|
7
8
|
import { Script, createContext } from "node:vm";
|
|
8
|
-
import { CanonicalIdSchema, Effect, Effects, ParallelEffect, cachedFn, createAliasResolver, createAsyncScheduler, createCanonicalId, createCanonicalTracker, createSyncScheduler, getPortableFS, getPortableHasher, isExternalSpecifier, isRelativeSpecifier, normalizePath, parseCanonicalId, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences, validateCanonicalId } from "@soda-gql/common";
|
|
9
|
+
import { CanonicalIdSchema, Effect, Effects, ParallelEffect, cachedFn, createAliasResolver, createAsyncScheduler, createCanonicalId, createCanonicalTracker, createSwcSpanConverter, createSyncScheduler, getPortableFS, getPortableHasher, isExternalSpecifier, isRelativeSpecifier, normalizePath, parseCanonicalId, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences, validateCanonicalId } from "@soda-gql/common";
|
|
9
10
|
import { parseSync, transformSync } from "@swc/core";
|
|
10
11
|
import * as sandboxCore from "@soda-gql/core";
|
|
11
12
|
import { Fragment, GqlDefine, GqlElement, Operation } from "@soda-gql/core";
|
|
@@ -15,6 +16,34 @@ import * as sandboxRuntime from "@soda-gql/runtime";
|
|
|
15
16
|
import ts from "typescript";
|
|
16
17
|
import fg from "fast-glob";
|
|
17
18
|
|
|
19
|
+
//#region rolldown:runtime
|
|
20
|
+
var __create = Object.create;
|
|
21
|
+
var __defProp = Object.defineProperty;
|
|
22
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
23
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
24
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
25
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
26
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
30
|
+
key = keys[i];
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
32
|
+
__defProp(to, key, {
|
|
33
|
+
get: ((k) => from[k]).bind(null, key),
|
|
34
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return to;
|
|
40
|
+
};
|
|
41
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
42
|
+
value: mod,
|
|
43
|
+
enumerable: true
|
|
44
|
+
}) : target, mod));
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
18
47
|
//#region packages/builder/src/schemas/artifact.ts
|
|
19
48
|
const BuilderArtifactElementMetadataSchema = z.object({
|
|
20
49
|
sourcePath: z.string(),
|
|
@@ -1681,9 +1710,9 @@ const createPathTracker = () => {
|
|
|
1681
1710
|
* Create an export bindings map from module exports.
|
|
1682
1711
|
* Maps local variable names to their exported names.
|
|
1683
1712
|
*/
|
|
1684
|
-
const createExportBindingsMap = (exports) => {
|
|
1713
|
+
const createExportBindingsMap = (exports$1) => {
|
|
1685
1714
|
const exportBindings = new Map();
|
|
1686
|
-
exports.forEach((exp) => {
|
|
1715
|
+
exports$1.forEach((exp) => {
|
|
1687
1716
|
if (exp.kind === "named" && exp.local && !exp.isTypeOnly) {
|
|
1688
1717
|
exportBindings.set(exp.local, exp.exported);
|
|
1689
1718
|
}
|
|
@@ -1697,7 +1726,7 @@ const createExportBindingsMap = (exports) => {
|
|
|
1697
1726
|
* SWC adapter for the analyzer core.
|
|
1698
1727
|
* Implements parser-specific logic using the SWC parser.
|
|
1699
1728
|
*/
|
|
1700
|
-
const collectImports$1 = (module) => {
|
|
1729
|
+
const collectImports$1 = (module$1) => {
|
|
1701
1730
|
const imports = [];
|
|
1702
1731
|
const handle = (declaration) => {
|
|
1703
1732
|
const source = declaration.source.value;
|
|
@@ -1730,7 +1759,7 @@ const collectImports$1 = (module) => {
|
|
|
1730
1759
|
}
|
|
1731
1760
|
});
|
|
1732
1761
|
};
|
|
1733
|
-
module.body.forEach((item) => {
|
|
1762
|
+
module$1.body.forEach((item) => {
|
|
1734
1763
|
if (item.type === "ImportDeclaration") {
|
|
1735
1764
|
handle(item);
|
|
1736
1765
|
return;
|
|
@@ -1741,14 +1770,14 @@ const collectImports$1 = (module) => {
|
|
|
1741
1770
|
});
|
|
1742
1771
|
return imports;
|
|
1743
1772
|
};
|
|
1744
|
-
const collectExports$1 = (module) => {
|
|
1745
|
-
const exports = [];
|
|
1773
|
+
const collectExports$1 = (module$1) => {
|
|
1774
|
+
const exports$1 = [];
|
|
1746
1775
|
const handle = (declaration) => {
|
|
1747
1776
|
if (declaration.type === "ExportDeclaration") {
|
|
1748
1777
|
if (declaration.declaration.type === "VariableDeclaration") {
|
|
1749
1778
|
declaration.declaration.declarations.forEach((decl) => {
|
|
1750
1779
|
if (decl.id.type === "Identifier") {
|
|
1751
|
-
exports.push({
|
|
1780
|
+
exports$1.push({
|
|
1752
1781
|
kind: "named",
|
|
1753
1782
|
exported: decl.id.value,
|
|
1754
1783
|
local: decl.id.value,
|
|
@@ -1760,7 +1789,7 @@ const collectExports$1 = (module) => {
|
|
|
1760
1789
|
if (declaration.declaration.type === "FunctionDeclaration") {
|
|
1761
1790
|
const ident = declaration.declaration.identifier;
|
|
1762
1791
|
if (ident) {
|
|
1763
|
-
exports.push({
|
|
1792
|
+
exports$1.push({
|
|
1764
1793
|
kind: "named",
|
|
1765
1794
|
exported: ident.value,
|
|
1766
1795
|
local: ident.value,
|
|
@@ -1779,7 +1808,7 @@ const collectExports$1 = (module) => {
|
|
|
1779
1808
|
const exported = specifier.exported ? specifier.exported.value : specifier.orig.value;
|
|
1780
1809
|
const local = specifier.orig.value;
|
|
1781
1810
|
if (source) {
|
|
1782
|
-
exports.push({
|
|
1811
|
+
exports$1.push({
|
|
1783
1812
|
kind: "reexport",
|
|
1784
1813
|
exported,
|
|
1785
1814
|
local,
|
|
@@ -1788,7 +1817,7 @@ const collectExports$1 = (module) => {
|
|
|
1788
1817
|
});
|
|
1789
1818
|
return;
|
|
1790
1819
|
}
|
|
1791
|
-
exports.push({
|
|
1820
|
+
exports$1.push({
|
|
1792
1821
|
kind: "named",
|
|
1793
1822
|
exported,
|
|
1794
1823
|
local,
|
|
@@ -1798,7 +1827,7 @@ const collectExports$1 = (module) => {
|
|
|
1798
1827
|
return;
|
|
1799
1828
|
}
|
|
1800
1829
|
if (declaration.type === "ExportAllDeclaration") {
|
|
1801
|
-
exports.push({
|
|
1830
|
+
exports$1.push({
|
|
1802
1831
|
kind: "reexport",
|
|
1803
1832
|
exported: "*",
|
|
1804
1833
|
source: declaration.source.value,
|
|
@@ -1807,7 +1836,7 @@ const collectExports$1 = (module) => {
|
|
|
1807
1836
|
return;
|
|
1808
1837
|
}
|
|
1809
1838
|
if (declaration.type === "ExportDefaultDeclaration" || declaration.type === "ExportDefaultExpression") {
|
|
1810
|
-
exports.push({
|
|
1839
|
+
exports$1.push({
|
|
1811
1840
|
kind: "named",
|
|
1812
1841
|
exported: "default",
|
|
1813
1842
|
local: "default",
|
|
@@ -1815,7 +1844,7 @@ const collectExports$1 = (module) => {
|
|
|
1815
1844
|
});
|
|
1816
1845
|
}
|
|
1817
1846
|
};
|
|
1818
|
-
module.body.forEach((item) => {
|
|
1847
|
+
module$1.body.forEach((item) => {
|
|
1819
1848
|
if (item.type === "ExportDeclaration" || item.type === "ExportNamedDeclaration" || item.type === "ExportAllDeclaration" || item.type === "ExportDefaultDeclaration" || item.type === "ExportDefaultExpression") {
|
|
1820
1849
|
handle(item);
|
|
1821
1850
|
return;
|
|
@@ -1827,17 +1856,17 @@ const collectExports$1 = (module) => {
|
|
|
1827
1856
|
}
|
|
1828
1857
|
}
|
|
1829
1858
|
});
|
|
1830
|
-
return exports;
|
|
1859
|
+
return exports$1;
|
|
1831
1860
|
};
|
|
1832
|
-
const collectGqlIdentifiers = (module, helper) => {
|
|
1861
|
+
const collectGqlIdentifiers = (module$1, helper) => {
|
|
1833
1862
|
const identifiers = new Set();
|
|
1834
|
-
module.body.forEach((item) => {
|
|
1863
|
+
module$1.body.forEach((item) => {
|
|
1835
1864
|
const declaration = item.type === "ImportDeclaration" ? item : "declaration" in item && item.declaration && item.declaration.type === "ImportDeclaration" ? item.declaration : null;
|
|
1836
1865
|
if (!declaration) {
|
|
1837
1866
|
return;
|
|
1838
1867
|
}
|
|
1839
1868
|
if (!helper.isGraphqlSystemImportSpecifier({
|
|
1840
|
-
filePath: module.__filePath,
|
|
1869
|
+
filePath: module$1.__filePath,
|
|
1841
1870
|
specifier: declaration.source.value
|
|
1842
1871
|
})) {
|
|
1843
1872
|
return;
|
|
@@ -1890,7 +1919,7 @@ const unwrapMethodChains$1 = (identifiers, node) => {
|
|
|
1890
1919
|
}
|
|
1891
1920
|
return unwrapMethodChains$1(identifiers, callee.object);
|
|
1892
1921
|
};
|
|
1893
|
-
const collectAllDefinitions$1 = ({ module, gqlIdentifiers, imports: _imports, exports, source, baseDir }) => {
|
|
1922
|
+
const collectAllDefinitions$1 = ({ module: module$1, gqlIdentifiers, imports: _imports, exports: exports$1, source, baseDir }) => {
|
|
1894
1923
|
const getPropertyName$1 = (property) => {
|
|
1895
1924
|
if (!property) {
|
|
1896
1925
|
return null;
|
|
@@ -1905,9 +1934,9 @@ const collectAllDefinitions$1 = ({ module, gqlIdentifiers, imports: _imports, ex
|
|
|
1905
1934
|
};
|
|
1906
1935
|
const pending = [];
|
|
1907
1936
|
const handledCalls = [];
|
|
1908
|
-
const exportBindings = createExportBindingsMap(exports);
|
|
1937
|
+
const exportBindings = createExportBindingsMap(exports$1);
|
|
1909
1938
|
const tracker = createCanonicalTracker({
|
|
1910
|
-
filePath: module.__filePath,
|
|
1939
|
+
filePath: module$1.__filePath,
|
|
1911
1940
|
baseDir,
|
|
1912
1941
|
getExportName: (localName) => exportBindings.get(localName)
|
|
1913
1942
|
});
|
|
@@ -1934,9 +1963,10 @@ const collectAllDefinitions$1 = ({ module, gqlIdentifiers, imports: _imports, ex
|
|
|
1934
1963
|
}
|
|
1935
1964
|
};
|
|
1936
1965
|
const expressionFromCall = (call) => {
|
|
1937
|
-
const spanOffset = module.__spanOffset;
|
|
1938
|
-
|
|
1939
|
-
|
|
1966
|
+
const spanOffset = module$1.__spanOffset;
|
|
1967
|
+
const converter = module$1.__spanConverter;
|
|
1968
|
+
let start = converter.byteOffsetToCharIndex(call.span.start - spanOffset);
|
|
1969
|
+
const end = converter.byteOffsetToCharIndex(call.span.end - spanOffset);
|
|
1940
1970
|
if (start > 0 && source[start] === "q" && source[start - 1] === "g" && source.slice(start, start + 3) === "ql.") {
|
|
1941
1971
|
start -= 1;
|
|
1942
1972
|
}
|
|
@@ -2079,11 +2109,11 @@ const collectAllDefinitions$1 = ({ module, gqlIdentifiers, imports: _imports, ex
|
|
|
2079
2109
|
}
|
|
2080
2110
|
}
|
|
2081
2111
|
};
|
|
2082
|
-
module.body.forEach((statement) => {
|
|
2112
|
+
module$1.body.forEach((statement) => {
|
|
2083
2113
|
visit(statement, []);
|
|
2084
2114
|
});
|
|
2085
2115
|
const definitions = pending.map((item) => ({
|
|
2086
|
-
canonicalId: createCanonicalId(module.__filePath, item.astPath, { baseDir }),
|
|
2116
|
+
canonicalId: createCanonicalId(module$1.__filePath, item.astPath, { baseDir }),
|
|
2087
2117
|
astPath: item.astPath,
|
|
2088
2118
|
isTopLevel: item.isTopLevel,
|
|
2089
2119
|
isExported: item.isExported,
|
|
@@ -2098,9 +2128,10 @@ const collectAllDefinitions$1 = ({ module, gqlIdentifiers, imports: _imports, ex
|
|
|
2098
2128
|
/**
|
|
2099
2129
|
* Get location from an SWC node span
|
|
2100
2130
|
*/
|
|
2101
|
-
const getLocation$1 = (module, span) => {
|
|
2102
|
-
const
|
|
2103
|
-
const
|
|
2131
|
+
const getLocation$1 = (module$1, span) => {
|
|
2132
|
+
const converter = module$1.__spanConverter;
|
|
2133
|
+
const start = converter.byteOffsetToCharIndex(span.start - module$1.__spanOffset);
|
|
2134
|
+
const end = converter.byteOffsetToCharIndex(span.end - module$1.__spanOffset);
|
|
2104
2135
|
return {
|
|
2105
2136
|
start,
|
|
2106
2137
|
end
|
|
@@ -2109,32 +2140,32 @@ const getLocation$1 = (module, span) => {
|
|
|
2109
2140
|
/**
|
|
2110
2141
|
* Collect diagnostics for invalid import patterns from graphql-system
|
|
2111
2142
|
*/
|
|
2112
|
-
const collectImportDiagnostics$1 = (module, helper) => {
|
|
2143
|
+
const collectImportDiagnostics$1 = (module$1, helper) => {
|
|
2113
2144
|
const diagnostics = [];
|
|
2114
|
-
module.body.forEach((item) => {
|
|
2145
|
+
module$1.body.forEach((item) => {
|
|
2115
2146
|
const declaration = item.type === "ImportDeclaration" ? item : "declaration" in item && item.declaration && "type" in item.declaration && item.declaration.type === "ImportDeclaration" ? item.declaration : null;
|
|
2116
2147
|
if (!declaration) {
|
|
2117
2148
|
return;
|
|
2118
2149
|
}
|
|
2119
2150
|
if (!helper.isGraphqlSystemImportSpecifier({
|
|
2120
|
-
filePath: module.__filePath,
|
|
2151
|
+
filePath: module$1.__filePath,
|
|
2121
2152
|
specifier: declaration.source.value
|
|
2122
2153
|
})) {
|
|
2123
2154
|
return;
|
|
2124
2155
|
}
|
|
2125
2156
|
declaration.specifiers?.forEach((specifier) => {
|
|
2126
2157
|
if (specifier.type === "ImportDefaultSpecifier") {
|
|
2127
|
-
diagnostics.push(createStandardDiagnostic("DEFAULT_IMPORT", getLocation$1(module, specifier.span), undefined));
|
|
2158
|
+
diagnostics.push(createStandardDiagnostic("DEFAULT_IMPORT", getLocation$1(module$1, specifier.span), undefined));
|
|
2128
2159
|
return;
|
|
2129
2160
|
}
|
|
2130
2161
|
if (specifier.type === "ImportNamespaceSpecifier") {
|
|
2131
|
-
diagnostics.push(createStandardDiagnostic("STAR_IMPORT", getLocation$1(module, specifier.span), { namespaceAlias: specifier.local.value }));
|
|
2162
|
+
diagnostics.push(createStandardDiagnostic("STAR_IMPORT", getLocation$1(module$1, specifier.span), { namespaceAlias: specifier.local.value }));
|
|
2132
2163
|
return;
|
|
2133
2164
|
}
|
|
2134
2165
|
if (specifier.type === "ImportSpecifier") {
|
|
2135
2166
|
const imported = specifier.imported ? specifier.imported.value : specifier.local.value;
|
|
2136
2167
|
if (imported === "gql" && specifier.imported) {
|
|
2137
|
-
diagnostics.push(createStandardDiagnostic("RENAMED_IMPORT", getLocation$1(module, specifier.span), { importedAs: specifier.local.value }));
|
|
2168
|
+
diagnostics.push(createStandardDiagnostic("RENAMED_IMPORT", getLocation$1(module$1, specifier.span), { importedAs: specifier.local.value }));
|
|
2138
2169
|
}
|
|
2139
2170
|
}
|
|
2140
2171
|
});
|
|
@@ -2185,14 +2216,14 @@ const getArgumentType$1 = (node) => {
|
|
|
2185
2216
|
/**
|
|
2186
2217
|
* Collect diagnostics for invalid gql call patterns
|
|
2187
2218
|
*/
|
|
2188
|
-
const collectCallDiagnostics$1 = (module, gqlIdentifiers) => {
|
|
2219
|
+
const collectCallDiagnostics$1 = (module$1, gqlIdentifiers) => {
|
|
2189
2220
|
const diagnostics = [];
|
|
2190
2221
|
const visit = (node) => {
|
|
2191
2222
|
if (!node || typeof node !== "object") {
|
|
2192
2223
|
return;
|
|
2193
2224
|
}
|
|
2194
2225
|
if (node.type === "CallExpression") {
|
|
2195
|
-
const diagnostic = checkCallExpression$1(module, node, gqlIdentifiers);
|
|
2226
|
+
const diagnostic = checkCallExpression$1(module$1, node, gqlIdentifiers);
|
|
2196
2227
|
if (diagnostic) {
|
|
2197
2228
|
diagnostics.push(diagnostic);
|
|
2198
2229
|
}
|
|
@@ -2207,23 +2238,23 @@ const collectCallDiagnostics$1 = (module, gqlIdentifiers) => {
|
|
|
2207
2238
|
}
|
|
2208
2239
|
}
|
|
2209
2240
|
};
|
|
2210
|
-
module.body.forEach(visit);
|
|
2241
|
+
module$1.body.forEach(visit);
|
|
2211
2242
|
return diagnostics;
|
|
2212
2243
|
};
|
|
2213
2244
|
/**
|
|
2214
2245
|
* Check a call expression for invalid gql patterns
|
|
2215
2246
|
*/
|
|
2216
|
-
const checkCallExpression$1 = (module, call, gqlIdentifiers) => {
|
|
2247
|
+
const checkCallExpression$1 = (module$1, call, gqlIdentifiers) => {
|
|
2217
2248
|
const callee = call.callee;
|
|
2218
2249
|
if (callee.type === "Identifier" && gqlIdentifiers.has(callee.value)) {
|
|
2219
|
-
return createStandardDiagnostic("NON_MEMBER_CALLEE", getLocation$1(module, call.span), undefined);
|
|
2250
|
+
return createStandardDiagnostic("NON_MEMBER_CALLEE", getLocation$1(module$1, call.span), undefined);
|
|
2220
2251
|
}
|
|
2221
2252
|
if (callee.type === "OptionalChainingExpression") {
|
|
2222
2253
|
const base = callee.base;
|
|
2223
2254
|
if (base?.type === "MemberExpression") {
|
|
2224
2255
|
const object$1 = base.object;
|
|
2225
2256
|
if (object$1?.type === "Identifier" && gqlIdentifiers.has(object$1.value)) {
|
|
2226
|
-
return createStandardDiagnostic("OPTIONAL_CHAINING", getLocation$1(module, call.span), undefined);
|
|
2257
|
+
return createStandardDiagnostic("OPTIONAL_CHAINING", getLocation$1(module$1, call.span), undefined);
|
|
2227
2258
|
}
|
|
2228
2259
|
}
|
|
2229
2260
|
return null;
|
|
@@ -2234,11 +2265,11 @@ const checkCallExpression$1 = (module, call, gqlIdentifiers) => {
|
|
|
2234
2265
|
const object = callee.object;
|
|
2235
2266
|
const property = callee.property;
|
|
2236
2267
|
if (property?.type === "Computed" && object?.type === "Identifier" && gqlIdentifiers.has(object.value)) {
|
|
2237
|
-
return createStandardDiagnostic("COMPUTED_PROPERTY", getLocation$1(module, call.span), undefined);
|
|
2268
|
+
return createStandardDiagnostic("COMPUTED_PROPERTY", getLocation$1(module$1, call.span), undefined);
|
|
2238
2269
|
}
|
|
2239
2270
|
if (object?.type !== "Identifier") {
|
|
2240
2271
|
if (containsGqlIdentifier$1(object, gqlIdentifiers)) {
|
|
2241
|
-
return createStandardDiagnostic("DYNAMIC_CALLEE", getLocation$1(module, call.span), undefined);
|
|
2272
|
+
return createStandardDiagnostic("DYNAMIC_CALLEE", getLocation$1(module$1, call.span), undefined);
|
|
2242
2273
|
}
|
|
2243
2274
|
return null;
|
|
2244
2275
|
}
|
|
@@ -2246,28 +2277,28 @@ const checkCallExpression$1 = (module, call, gqlIdentifiers) => {
|
|
|
2246
2277
|
return null;
|
|
2247
2278
|
}
|
|
2248
2279
|
if (!call.arguments || call.arguments.length === 0) {
|
|
2249
|
-
return createStandardDiagnostic("MISSING_ARGUMENT", getLocation$1(module, call.span), undefined);
|
|
2280
|
+
return createStandardDiagnostic("MISSING_ARGUMENT", getLocation$1(module$1, call.span), undefined);
|
|
2250
2281
|
}
|
|
2251
2282
|
const firstArg = call.arguments[0];
|
|
2252
2283
|
const firstArgAny = firstArg;
|
|
2253
2284
|
if (firstArgAny?.spread) {
|
|
2254
|
-
return createStandardDiagnostic("SPREAD_ARGUMENT", getLocation$1(module, call.span), undefined);
|
|
2285
|
+
return createStandardDiagnostic("SPREAD_ARGUMENT", getLocation$1(module$1, call.span), undefined);
|
|
2255
2286
|
}
|
|
2256
2287
|
const expression = firstArgAny?.expression;
|
|
2257
2288
|
if (expression && expression.type !== "ArrowFunctionExpression") {
|
|
2258
2289
|
const actualType = getArgumentType$1(expression);
|
|
2259
|
-
return createStandardDiagnostic("INVALID_ARGUMENT_TYPE", getLocation$1(module, call.span), { actualType });
|
|
2290
|
+
return createStandardDiagnostic("INVALID_ARGUMENT_TYPE", getLocation$1(module$1, call.span), { actualType });
|
|
2260
2291
|
}
|
|
2261
2292
|
if (call.arguments.length > 1) {
|
|
2262
2293
|
const extraCount = call.arguments.length - 1;
|
|
2263
|
-
return createStandardDiagnostic("EXTRA_ARGUMENTS", getLocation$1(module, call.span), { extraCount: String(extraCount) });
|
|
2294
|
+
return createStandardDiagnostic("EXTRA_ARGUMENTS", getLocation$1(module$1, call.span), { extraCount: String(extraCount) });
|
|
2264
2295
|
}
|
|
2265
2296
|
return null;
|
|
2266
2297
|
};
|
|
2267
2298
|
/**
|
|
2268
2299
|
* Collect diagnostics for gql calls in class properties
|
|
2269
2300
|
*/
|
|
2270
|
-
const collectClassPropertyDiagnostics$1 = (module, gqlIdentifiers) => {
|
|
2301
|
+
const collectClassPropertyDiagnostics$1 = (module$1, gqlIdentifiers) => {
|
|
2271
2302
|
const diagnostics = [];
|
|
2272
2303
|
const containsGqlCall = (node) => {
|
|
2273
2304
|
if (!node || typeof node !== "object") {
|
|
@@ -2299,7 +2330,7 @@ const collectClassPropertyDiagnostics$1 = (module, gqlIdentifiers) => {
|
|
|
2299
2330
|
node.body?.forEach((member) => {
|
|
2300
2331
|
if (member.type === "ClassProperty" && member.value) {
|
|
2301
2332
|
if (containsGqlCall(member.value)) {
|
|
2302
|
-
diagnostics.push(createStandardDiagnostic("CLASS_PROPERTY", getLocation$1(module, member.span), undefined));
|
|
2333
|
+
diagnostics.push(createStandardDiagnostic("CLASS_PROPERTY", getLocation$1(module$1, member.span), undefined));
|
|
2303
2334
|
}
|
|
2304
2335
|
}
|
|
2305
2336
|
});
|
|
@@ -2314,7 +2345,7 @@ const collectClassPropertyDiagnostics$1 = (module, gqlIdentifiers) => {
|
|
|
2314
2345
|
}
|
|
2315
2346
|
}
|
|
2316
2347
|
};
|
|
2317
|
-
module.body.forEach(visit);
|
|
2348
|
+
module$1.body.forEach(visit);
|
|
2318
2349
|
return diagnostics;
|
|
2319
2350
|
};
|
|
2320
2351
|
/**
|
|
@@ -2333,18 +2364,20 @@ const swcAdapter = { analyze(input, helper) {
|
|
|
2333
2364
|
if (program.type !== "Module") {
|
|
2334
2365
|
return null;
|
|
2335
2366
|
}
|
|
2336
|
-
const
|
|
2367
|
+
const converter = createSwcSpanConverter(input.source);
|
|
2368
|
+
const spanOffset = program.span.end - converter.byteLength + 1;
|
|
2337
2369
|
const swcModule = program;
|
|
2338
2370
|
swcModule.__filePath = input.filePath;
|
|
2339
2371
|
swcModule.__spanOffset = spanOffset;
|
|
2372
|
+
swcModule.__spanConverter = converter;
|
|
2340
2373
|
const gqlIdentifiers = collectGqlIdentifiers(swcModule, helper);
|
|
2341
2374
|
const imports = collectImports$1(swcModule);
|
|
2342
|
-
const exports = collectExports$1(swcModule);
|
|
2375
|
+
const exports$1 = collectExports$1(swcModule);
|
|
2343
2376
|
const { definitions } = collectAllDefinitions$1({
|
|
2344
2377
|
module: swcModule,
|
|
2345
2378
|
gqlIdentifiers,
|
|
2346
2379
|
imports,
|
|
2347
|
-
exports,
|
|
2380
|
+
exports: exports$1,
|
|
2348
2381
|
source: input.source,
|
|
2349
2382
|
baseDir: input.baseDir
|
|
2350
2383
|
});
|
|
@@ -2355,7 +2388,7 @@ const swcAdapter = { analyze(input, helper) {
|
|
|
2355
2388
|
];
|
|
2356
2389
|
return {
|
|
2357
2390
|
imports,
|
|
2358
|
-
exports,
|
|
2391
|
+
exports: exports$1,
|
|
2359
2392
|
definitions,
|
|
2360
2393
|
diagnostics
|
|
2361
2394
|
};
|
|
@@ -2436,14 +2469,14 @@ const collectImports = (sourceFile) => {
|
|
|
2436
2469
|
return imports;
|
|
2437
2470
|
};
|
|
2438
2471
|
const collectExports = (sourceFile) => {
|
|
2439
|
-
const exports = [];
|
|
2472
|
+
const exports$1 = [];
|
|
2440
2473
|
sourceFile.statements.forEach((statement) => {
|
|
2441
2474
|
if (ts.isExportDeclaration(statement)) {
|
|
2442
2475
|
const moduleSpecifier = statement.moduleSpecifier ? statement.moduleSpecifier.text : undefined;
|
|
2443
2476
|
if (statement.exportClause && ts.isNamedExports(statement.exportClause)) {
|
|
2444
2477
|
statement.exportClause.elements.forEach((element) => {
|
|
2445
2478
|
if (moduleSpecifier) {
|
|
2446
|
-
exports.push({
|
|
2479
|
+
exports$1.push({
|
|
2447
2480
|
kind: "reexport",
|
|
2448
2481
|
exported: element.name.text,
|
|
2449
2482
|
local: element.propertyName ? element.propertyName.text : undefined,
|
|
@@ -2451,7 +2484,7 @@ const collectExports = (sourceFile) => {
|
|
|
2451
2484
|
isTypeOnly: Boolean(statement.isTypeOnly || element.isTypeOnly)
|
|
2452
2485
|
});
|
|
2453
2486
|
} else {
|
|
2454
|
-
exports.push({
|
|
2487
|
+
exports$1.push({
|
|
2455
2488
|
kind: "named",
|
|
2456
2489
|
exported: element.name.text,
|
|
2457
2490
|
local: element.propertyName ? element.propertyName.text : element.name.text,
|
|
@@ -2462,7 +2495,7 @@ const collectExports = (sourceFile) => {
|
|
|
2462
2495
|
return;
|
|
2463
2496
|
}
|
|
2464
2497
|
if (moduleSpecifier) {
|
|
2465
|
-
exports.push({
|
|
2498
|
+
exports$1.push({
|
|
2466
2499
|
kind: "reexport",
|
|
2467
2500
|
exported: "*",
|
|
2468
2501
|
source: moduleSpecifier,
|
|
@@ -2472,7 +2505,7 @@ const collectExports = (sourceFile) => {
|
|
|
2472
2505
|
return;
|
|
2473
2506
|
}
|
|
2474
2507
|
if (ts.isExportAssignment(statement)) {
|
|
2475
|
-
exports.push({
|
|
2508
|
+
exports$1.push({
|
|
2476
2509
|
kind: "named",
|
|
2477
2510
|
exported: "default",
|
|
2478
2511
|
local: "default",
|
|
@@ -2482,7 +2515,7 @@ const collectExports = (sourceFile) => {
|
|
|
2482
2515
|
if (ts.isVariableStatement(statement) && statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)) {
|
|
2483
2516
|
statement.declarationList.declarations.forEach((declaration) => {
|
|
2484
2517
|
if (ts.isIdentifier(declaration.name)) {
|
|
2485
|
-
exports.push({
|
|
2518
|
+
exports$1.push({
|
|
2486
2519
|
kind: "named",
|
|
2487
2520
|
exported: declaration.name.text,
|
|
2488
2521
|
local: declaration.name.text,
|
|
@@ -2492,7 +2525,7 @@ const collectExports = (sourceFile) => {
|
|
|
2492
2525
|
});
|
|
2493
2526
|
}
|
|
2494
2527
|
if (ts.isFunctionDeclaration(statement) && statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) && statement.name) {
|
|
2495
|
-
exports.push({
|
|
2528
|
+
exports$1.push({
|
|
2496
2529
|
kind: "named",
|
|
2497
2530
|
exported: statement.name.text,
|
|
2498
2531
|
local: statement.name.text,
|
|
@@ -2500,7 +2533,7 @@ const collectExports = (sourceFile) => {
|
|
|
2500
2533
|
});
|
|
2501
2534
|
}
|
|
2502
2535
|
});
|
|
2503
|
-
return exports;
|
|
2536
|
+
return exports$1;
|
|
2504
2537
|
};
|
|
2505
2538
|
/**
|
|
2506
2539
|
* Unwrap NonNullExpression nodes to get the underlying expression.
|
|
@@ -2559,10 +2592,10 @@ const getPropertyName = (name) => {
|
|
|
2559
2592
|
/**
|
|
2560
2593
|
* Collect all gql definitions (exported, non-exported, top-level, nested)
|
|
2561
2594
|
*/
|
|
2562
|
-
const collectAllDefinitions = ({ sourceFile, identifiers, exports, baseDir }) => {
|
|
2595
|
+
const collectAllDefinitions = ({ sourceFile, identifiers, exports: exports$1, baseDir }) => {
|
|
2563
2596
|
const pending = [];
|
|
2564
2597
|
const handledCalls = [];
|
|
2565
|
-
const exportBindings = createExportBindingsMap(exports);
|
|
2598
|
+
const exportBindings = createExportBindingsMap(exports$1);
|
|
2566
2599
|
const tracker = createCanonicalTracker({
|
|
2567
2600
|
filePath: sourceFile.fileName,
|
|
2568
2601
|
baseDir,
|
|
@@ -2909,11 +2942,11 @@ const typescriptAdapter = { analyze(input, helper) {
|
|
|
2909
2942
|
const sourceFile = createSourceFile(input.filePath, input.source);
|
|
2910
2943
|
const gqlIdentifiers = collectGqlImports(sourceFile, helper);
|
|
2911
2944
|
const imports = collectImports(sourceFile);
|
|
2912
|
-
const exports = collectExports(sourceFile);
|
|
2945
|
+
const exports$1 = collectExports(sourceFile);
|
|
2913
2946
|
const { definitions } = collectAllDefinitions({
|
|
2914
2947
|
sourceFile,
|
|
2915
2948
|
identifiers: gqlIdentifiers,
|
|
2916
|
-
exports,
|
|
2949
|
+
exports: exports$1,
|
|
2917
2950
|
baseDir: input.baseDir
|
|
2918
2951
|
});
|
|
2919
2952
|
const diagnostics = [
|
|
@@ -2923,7 +2956,7 @@ const typescriptAdapter = { analyze(input, helper) {
|
|
|
2923
2956
|
];
|
|
2924
2957
|
return {
|
|
2925
2958
|
imports,
|
|
2926
|
-
exports,
|
|
2959
|
+
exports: exports$1,
|
|
2927
2960
|
definitions,
|
|
2928
2961
|
diagnostics
|
|
2929
2962
|
};
|
|
@@ -3739,6 +3772,1856 @@ const discoverModulesAsync = async (options) => {
|
|
|
3739
3772
|
return ok(result.value);
|
|
3740
3773
|
};
|
|
3741
3774
|
|
|
3775
|
+
//#endregion
|
|
3776
|
+
//#region node_modules/picomatch/lib/constants.js
|
|
3777
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3778
|
+
const WIN_SLASH = "\\\\/";
|
|
3779
|
+
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
3780
|
+
/**
|
|
3781
|
+
* Posix glob regex
|
|
3782
|
+
*/
|
|
3783
|
+
const DOT_LITERAL = "\\.";
|
|
3784
|
+
const PLUS_LITERAL = "\\+";
|
|
3785
|
+
const QMARK_LITERAL = "\\?";
|
|
3786
|
+
const SLASH_LITERAL = "\\/";
|
|
3787
|
+
const ONE_CHAR = "(?=.)";
|
|
3788
|
+
const QMARK = "[^/]";
|
|
3789
|
+
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
3790
|
+
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
3791
|
+
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
3792
|
+
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
3793
|
+
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
3794
|
+
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
3795
|
+
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
3796
|
+
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
3797
|
+
const STAR = `${QMARK}*?`;
|
|
3798
|
+
const SEP = "/";
|
|
3799
|
+
const POSIX_CHARS = {
|
|
3800
|
+
DOT_LITERAL,
|
|
3801
|
+
PLUS_LITERAL,
|
|
3802
|
+
QMARK_LITERAL,
|
|
3803
|
+
SLASH_LITERAL,
|
|
3804
|
+
ONE_CHAR,
|
|
3805
|
+
QMARK,
|
|
3806
|
+
END_ANCHOR,
|
|
3807
|
+
DOTS_SLASH,
|
|
3808
|
+
NO_DOT,
|
|
3809
|
+
NO_DOTS,
|
|
3810
|
+
NO_DOT_SLASH,
|
|
3811
|
+
NO_DOTS_SLASH,
|
|
3812
|
+
QMARK_NO_DOT,
|
|
3813
|
+
STAR,
|
|
3814
|
+
START_ANCHOR,
|
|
3815
|
+
SEP
|
|
3816
|
+
};
|
|
3817
|
+
/**
|
|
3818
|
+
* Windows glob regex
|
|
3819
|
+
*/
|
|
3820
|
+
const WINDOWS_CHARS = {
|
|
3821
|
+
...POSIX_CHARS,
|
|
3822
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
3823
|
+
QMARK: WIN_NO_SLASH,
|
|
3824
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
3825
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
3826
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
3827
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
3828
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
3829
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
3830
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
3831
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
3832
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
3833
|
+
SEP: "\\"
|
|
3834
|
+
};
|
|
3835
|
+
/**
|
|
3836
|
+
* POSIX Bracket Regex
|
|
3837
|
+
*/
|
|
3838
|
+
const POSIX_REGEX_SOURCE$1 = {
|
|
3839
|
+
alnum: "a-zA-Z0-9",
|
|
3840
|
+
alpha: "a-zA-Z",
|
|
3841
|
+
ascii: "\\x00-\\x7F",
|
|
3842
|
+
blank: " \\t",
|
|
3843
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
3844
|
+
digit: "0-9",
|
|
3845
|
+
graph: "\\x21-\\x7E",
|
|
3846
|
+
lower: "a-z",
|
|
3847
|
+
print: "\\x20-\\x7E ",
|
|
3848
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
3849
|
+
space: " \\t\\r\\n\\v\\f",
|
|
3850
|
+
upper: "A-Z",
|
|
3851
|
+
word: "A-Za-z0-9_",
|
|
3852
|
+
xdigit: "A-Fa-f0-9"
|
|
3853
|
+
};
|
|
3854
|
+
module.exports = {
|
|
3855
|
+
MAX_LENGTH: 1024 * 64,
|
|
3856
|
+
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
|
3857
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
3858
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
3859
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
3860
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
3861
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
3862
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
3863
|
+
REPLACEMENTS: {
|
|
3864
|
+
__proto__: null,
|
|
3865
|
+
"***": "*",
|
|
3866
|
+
"**/**": "**",
|
|
3867
|
+
"**/**/**": "**"
|
|
3868
|
+
},
|
|
3869
|
+
CHAR_0: 48,
|
|
3870
|
+
CHAR_9: 57,
|
|
3871
|
+
CHAR_UPPERCASE_A: 65,
|
|
3872
|
+
CHAR_LOWERCASE_A: 97,
|
|
3873
|
+
CHAR_UPPERCASE_Z: 90,
|
|
3874
|
+
CHAR_LOWERCASE_Z: 122,
|
|
3875
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
3876
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
3877
|
+
CHAR_ASTERISK: 42,
|
|
3878
|
+
CHAR_AMPERSAND: 38,
|
|
3879
|
+
CHAR_AT: 64,
|
|
3880
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
3881
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
3882
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
3883
|
+
CHAR_COLON: 58,
|
|
3884
|
+
CHAR_COMMA: 44,
|
|
3885
|
+
CHAR_DOT: 46,
|
|
3886
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
3887
|
+
CHAR_EQUAL: 61,
|
|
3888
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
3889
|
+
CHAR_FORM_FEED: 12,
|
|
3890
|
+
CHAR_FORWARD_SLASH: 47,
|
|
3891
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
3892
|
+
CHAR_HASH: 35,
|
|
3893
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
3894
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
3895
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
3896
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
3897
|
+
CHAR_LINE_FEED: 10,
|
|
3898
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
3899
|
+
CHAR_PERCENT: 37,
|
|
3900
|
+
CHAR_PLUS: 43,
|
|
3901
|
+
CHAR_QUESTION_MARK: 63,
|
|
3902
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
3903
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
3904
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
3905
|
+
CHAR_SEMICOLON: 59,
|
|
3906
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
3907
|
+
CHAR_SPACE: 32,
|
|
3908
|
+
CHAR_TAB: 9,
|
|
3909
|
+
CHAR_UNDERSCORE: 95,
|
|
3910
|
+
CHAR_VERTICAL_LINE: 124,
|
|
3911
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
3912
|
+
extglobChars(chars) {
|
|
3913
|
+
return {
|
|
3914
|
+
"!": {
|
|
3915
|
+
type: "negate",
|
|
3916
|
+
open: "(?:(?!(?:",
|
|
3917
|
+
close: `))${chars.STAR})`
|
|
3918
|
+
},
|
|
3919
|
+
"?": {
|
|
3920
|
+
type: "qmark",
|
|
3921
|
+
open: "(?:",
|
|
3922
|
+
close: ")?"
|
|
3923
|
+
},
|
|
3924
|
+
"+": {
|
|
3925
|
+
type: "plus",
|
|
3926
|
+
open: "(?:",
|
|
3927
|
+
close: ")+"
|
|
3928
|
+
},
|
|
3929
|
+
"*": {
|
|
3930
|
+
type: "star",
|
|
3931
|
+
open: "(?:",
|
|
3932
|
+
close: ")*"
|
|
3933
|
+
},
|
|
3934
|
+
"@": {
|
|
3935
|
+
type: "at",
|
|
3936
|
+
open: "(?:",
|
|
3937
|
+
close: ")"
|
|
3938
|
+
}
|
|
3939
|
+
};
|
|
3940
|
+
},
|
|
3941
|
+
globChars(win32) {
|
|
3942
|
+
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
3943
|
+
}
|
|
3944
|
+
};
|
|
3945
|
+
}));
|
|
3946
|
+
|
|
3947
|
+
//#endregion
|
|
3948
|
+
//#region node_modules/picomatch/lib/utils.js
|
|
3949
|
+
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3950
|
+
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
3951
|
+
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
3952
|
+
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
3953
|
+
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
3954
|
+
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
3955
|
+
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
3956
|
+
exports.isWindows = () => {
|
|
3957
|
+
if (typeof navigator !== "undefined" && navigator.platform) {
|
|
3958
|
+
const platform = navigator.platform.toLowerCase();
|
|
3959
|
+
return platform === "win32" || platform === "windows";
|
|
3960
|
+
}
|
|
3961
|
+
if (typeof process !== "undefined" && process.platform) {
|
|
3962
|
+
return process.platform === "win32";
|
|
3963
|
+
}
|
|
3964
|
+
return false;
|
|
3965
|
+
};
|
|
3966
|
+
exports.removeBackslashes = (str) => {
|
|
3967
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
3968
|
+
return match === "\\" ? "" : match;
|
|
3969
|
+
});
|
|
3970
|
+
};
|
|
3971
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
3972
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
3973
|
+
if (idx === -1) return input;
|
|
3974
|
+
if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
|
3975
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
3976
|
+
};
|
|
3977
|
+
exports.removePrefix = (input, state = {}) => {
|
|
3978
|
+
let output = input;
|
|
3979
|
+
if (output.startsWith("./")) {
|
|
3980
|
+
output = output.slice(2);
|
|
3981
|
+
state.prefix = "./";
|
|
3982
|
+
}
|
|
3983
|
+
return output;
|
|
3984
|
+
};
|
|
3985
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
3986
|
+
const prepend = options.contains ? "" : "^";
|
|
3987
|
+
const append = options.contains ? "" : "$";
|
|
3988
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
3989
|
+
if (state.negated === true) {
|
|
3990
|
+
output = `(?:^(?!${output}).*$)`;
|
|
3991
|
+
}
|
|
3992
|
+
return output;
|
|
3993
|
+
};
|
|
3994
|
+
exports.basename = (path, { windows } = {}) => {
|
|
3995
|
+
const segs = path.split(windows ? /[\\/]/ : "/");
|
|
3996
|
+
const last = segs[segs.length - 1];
|
|
3997
|
+
if (last === "") {
|
|
3998
|
+
return segs[segs.length - 2];
|
|
3999
|
+
}
|
|
4000
|
+
return last;
|
|
4001
|
+
};
|
|
4002
|
+
}));
|
|
4003
|
+
|
|
4004
|
+
//#endregion
|
|
4005
|
+
//#region node_modules/picomatch/lib/scan.js
|
|
4006
|
+
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4007
|
+
const utils$3 = require_utils();
|
|
4008
|
+
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
4009
|
+
const isPathSeparator = (code) => {
|
|
4010
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
4011
|
+
};
|
|
4012
|
+
const depth = (token) => {
|
|
4013
|
+
if (token.isPrefix !== true) {
|
|
4014
|
+
token.depth = token.isGlobstar ? Infinity : 1;
|
|
4015
|
+
}
|
|
4016
|
+
};
|
|
4017
|
+
/**
|
|
4018
|
+
* Quickly scans a glob pattern and returns an object with a handful of
|
|
4019
|
+
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
4020
|
+
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
|
4021
|
+
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
|
4022
|
+
*
|
|
4023
|
+
* ```js
|
|
4024
|
+
* const pm = require('picomatch');
|
|
4025
|
+
* console.log(pm.scan('foo/bar/*.js'));
|
|
4026
|
+
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
4027
|
+
* ```
|
|
4028
|
+
* @param {String} `str`
|
|
4029
|
+
* @param {Object} `options`
|
|
4030
|
+
* @return {Object} Returns an object with tokens and regex source string.
|
|
4031
|
+
* @api public
|
|
4032
|
+
*/
|
|
4033
|
+
const scan$1 = (input, options) => {
|
|
4034
|
+
const opts = options || {};
|
|
4035
|
+
const length = input.length - 1;
|
|
4036
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
4037
|
+
const slashes = [];
|
|
4038
|
+
const tokens = [];
|
|
4039
|
+
const parts = [];
|
|
4040
|
+
let str = input;
|
|
4041
|
+
let index = -1;
|
|
4042
|
+
let start = 0;
|
|
4043
|
+
let lastIndex = 0;
|
|
4044
|
+
let isBrace = false;
|
|
4045
|
+
let isBracket = false;
|
|
4046
|
+
let isGlob = false;
|
|
4047
|
+
let isExtglob = false;
|
|
4048
|
+
let isGlobstar = false;
|
|
4049
|
+
let braceEscaped = false;
|
|
4050
|
+
let backslashes = false;
|
|
4051
|
+
let negated = false;
|
|
4052
|
+
let negatedExtglob = false;
|
|
4053
|
+
let finished = false;
|
|
4054
|
+
let braces = 0;
|
|
4055
|
+
let prev;
|
|
4056
|
+
let code;
|
|
4057
|
+
let token = {
|
|
4058
|
+
value: "",
|
|
4059
|
+
depth: 0,
|
|
4060
|
+
isGlob: false
|
|
4061
|
+
};
|
|
4062
|
+
const eos = () => index >= length;
|
|
4063
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
4064
|
+
const advance = () => {
|
|
4065
|
+
prev = code;
|
|
4066
|
+
return str.charCodeAt(++index);
|
|
4067
|
+
};
|
|
4068
|
+
while (index < length) {
|
|
4069
|
+
code = advance();
|
|
4070
|
+
let next;
|
|
4071
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
4072
|
+
backslashes = token.backslashes = true;
|
|
4073
|
+
code = advance();
|
|
4074
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
4075
|
+
braceEscaped = true;
|
|
4076
|
+
}
|
|
4077
|
+
continue;
|
|
4078
|
+
}
|
|
4079
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
4080
|
+
braces++;
|
|
4081
|
+
while (eos() !== true && (code = advance())) {
|
|
4082
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
4083
|
+
backslashes = token.backslashes = true;
|
|
4084
|
+
advance();
|
|
4085
|
+
continue;
|
|
4086
|
+
}
|
|
4087
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
4088
|
+
braces++;
|
|
4089
|
+
continue;
|
|
4090
|
+
}
|
|
4091
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
4092
|
+
isBrace = token.isBrace = true;
|
|
4093
|
+
isGlob = token.isGlob = true;
|
|
4094
|
+
finished = true;
|
|
4095
|
+
if (scanToEnd === true) {
|
|
4096
|
+
continue;
|
|
4097
|
+
}
|
|
4098
|
+
break;
|
|
4099
|
+
}
|
|
4100
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
4101
|
+
isBrace = token.isBrace = true;
|
|
4102
|
+
isGlob = token.isGlob = true;
|
|
4103
|
+
finished = true;
|
|
4104
|
+
if (scanToEnd === true) {
|
|
4105
|
+
continue;
|
|
4106
|
+
}
|
|
4107
|
+
break;
|
|
4108
|
+
}
|
|
4109
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
4110
|
+
braces--;
|
|
4111
|
+
if (braces === 0) {
|
|
4112
|
+
braceEscaped = false;
|
|
4113
|
+
isBrace = token.isBrace = true;
|
|
4114
|
+
finished = true;
|
|
4115
|
+
break;
|
|
4116
|
+
}
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4119
|
+
if (scanToEnd === true) {
|
|
4120
|
+
continue;
|
|
4121
|
+
}
|
|
4122
|
+
break;
|
|
4123
|
+
}
|
|
4124
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
4125
|
+
slashes.push(index);
|
|
4126
|
+
tokens.push(token);
|
|
4127
|
+
token = {
|
|
4128
|
+
value: "",
|
|
4129
|
+
depth: 0,
|
|
4130
|
+
isGlob: false
|
|
4131
|
+
};
|
|
4132
|
+
if (finished === true) continue;
|
|
4133
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
4134
|
+
start += 2;
|
|
4135
|
+
continue;
|
|
4136
|
+
}
|
|
4137
|
+
lastIndex = index + 1;
|
|
4138
|
+
continue;
|
|
4139
|
+
}
|
|
4140
|
+
if (opts.noext !== true) {
|
|
4141
|
+
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
4142
|
+
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
4143
|
+
isGlob = token.isGlob = true;
|
|
4144
|
+
isExtglob = token.isExtglob = true;
|
|
4145
|
+
finished = true;
|
|
4146
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
4147
|
+
negatedExtglob = true;
|
|
4148
|
+
}
|
|
4149
|
+
if (scanToEnd === true) {
|
|
4150
|
+
while (eos() !== true && (code = advance())) {
|
|
4151
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
4152
|
+
backslashes = token.backslashes = true;
|
|
4153
|
+
code = advance();
|
|
4154
|
+
continue;
|
|
4155
|
+
}
|
|
4156
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
4157
|
+
isGlob = token.isGlob = true;
|
|
4158
|
+
finished = true;
|
|
4159
|
+
break;
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
continue;
|
|
4163
|
+
}
|
|
4164
|
+
break;
|
|
4165
|
+
}
|
|
4166
|
+
}
|
|
4167
|
+
if (code === CHAR_ASTERISK) {
|
|
4168
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
4169
|
+
isGlob = token.isGlob = true;
|
|
4170
|
+
finished = true;
|
|
4171
|
+
if (scanToEnd === true) {
|
|
4172
|
+
continue;
|
|
4173
|
+
}
|
|
4174
|
+
break;
|
|
4175
|
+
}
|
|
4176
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
4177
|
+
isGlob = token.isGlob = true;
|
|
4178
|
+
finished = true;
|
|
4179
|
+
if (scanToEnd === true) {
|
|
4180
|
+
continue;
|
|
4181
|
+
}
|
|
4182
|
+
break;
|
|
4183
|
+
}
|
|
4184
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
4185
|
+
while (eos() !== true && (next = advance())) {
|
|
4186
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
4187
|
+
backslashes = token.backslashes = true;
|
|
4188
|
+
advance();
|
|
4189
|
+
continue;
|
|
4190
|
+
}
|
|
4191
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
4192
|
+
isBracket = token.isBracket = true;
|
|
4193
|
+
isGlob = token.isGlob = true;
|
|
4194
|
+
finished = true;
|
|
4195
|
+
break;
|
|
4196
|
+
}
|
|
4197
|
+
}
|
|
4198
|
+
if (scanToEnd === true) {
|
|
4199
|
+
continue;
|
|
4200
|
+
}
|
|
4201
|
+
break;
|
|
4202
|
+
}
|
|
4203
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
4204
|
+
negated = token.negated = true;
|
|
4205
|
+
start++;
|
|
4206
|
+
continue;
|
|
4207
|
+
}
|
|
4208
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
4209
|
+
isGlob = token.isGlob = true;
|
|
4210
|
+
if (scanToEnd === true) {
|
|
4211
|
+
while (eos() !== true && (code = advance())) {
|
|
4212
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
4213
|
+
backslashes = token.backslashes = true;
|
|
4214
|
+
code = advance();
|
|
4215
|
+
continue;
|
|
4216
|
+
}
|
|
4217
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
4218
|
+
finished = true;
|
|
4219
|
+
break;
|
|
4220
|
+
}
|
|
4221
|
+
}
|
|
4222
|
+
continue;
|
|
4223
|
+
}
|
|
4224
|
+
break;
|
|
4225
|
+
}
|
|
4226
|
+
if (isGlob === true) {
|
|
4227
|
+
finished = true;
|
|
4228
|
+
if (scanToEnd === true) {
|
|
4229
|
+
continue;
|
|
4230
|
+
}
|
|
4231
|
+
break;
|
|
4232
|
+
}
|
|
4233
|
+
}
|
|
4234
|
+
if (opts.noext === true) {
|
|
4235
|
+
isExtglob = false;
|
|
4236
|
+
isGlob = false;
|
|
4237
|
+
}
|
|
4238
|
+
let base = str;
|
|
4239
|
+
let prefix = "";
|
|
4240
|
+
let glob = "";
|
|
4241
|
+
if (start > 0) {
|
|
4242
|
+
prefix = str.slice(0, start);
|
|
4243
|
+
str = str.slice(start);
|
|
4244
|
+
lastIndex -= start;
|
|
4245
|
+
}
|
|
4246
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
4247
|
+
base = str.slice(0, lastIndex);
|
|
4248
|
+
glob = str.slice(lastIndex);
|
|
4249
|
+
} else if (isGlob === true) {
|
|
4250
|
+
base = "";
|
|
4251
|
+
glob = str;
|
|
4252
|
+
} else {
|
|
4253
|
+
base = str;
|
|
4254
|
+
}
|
|
4255
|
+
if (base && base !== "" && base !== "/" && base !== str) {
|
|
4256
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
4257
|
+
base = base.slice(0, -1);
|
|
4258
|
+
}
|
|
4259
|
+
}
|
|
4260
|
+
if (opts.unescape === true) {
|
|
4261
|
+
if (glob) glob = utils$3.removeBackslashes(glob);
|
|
4262
|
+
if (base && backslashes === true) {
|
|
4263
|
+
base = utils$3.removeBackslashes(base);
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
const state = {
|
|
4267
|
+
prefix,
|
|
4268
|
+
input,
|
|
4269
|
+
start,
|
|
4270
|
+
base,
|
|
4271
|
+
glob,
|
|
4272
|
+
isBrace,
|
|
4273
|
+
isBracket,
|
|
4274
|
+
isGlob,
|
|
4275
|
+
isExtglob,
|
|
4276
|
+
isGlobstar,
|
|
4277
|
+
negated,
|
|
4278
|
+
negatedExtglob
|
|
4279
|
+
};
|
|
4280
|
+
if (opts.tokens === true) {
|
|
4281
|
+
state.maxDepth = 0;
|
|
4282
|
+
if (!isPathSeparator(code)) {
|
|
4283
|
+
tokens.push(token);
|
|
4284
|
+
}
|
|
4285
|
+
state.tokens = tokens;
|
|
4286
|
+
}
|
|
4287
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
4288
|
+
let prevIndex;
|
|
4289
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
4290
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
4291
|
+
const i = slashes[idx];
|
|
4292
|
+
const value = input.slice(n, i);
|
|
4293
|
+
if (opts.tokens) {
|
|
4294
|
+
if (idx === 0 && start !== 0) {
|
|
4295
|
+
tokens[idx].isPrefix = true;
|
|
4296
|
+
tokens[idx].value = prefix;
|
|
4297
|
+
} else {
|
|
4298
|
+
tokens[idx].value = value;
|
|
4299
|
+
}
|
|
4300
|
+
depth(tokens[idx]);
|
|
4301
|
+
state.maxDepth += tokens[idx].depth;
|
|
4302
|
+
}
|
|
4303
|
+
if (idx !== 0 || value !== "") {
|
|
4304
|
+
parts.push(value);
|
|
4305
|
+
}
|
|
4306
|
+
prevIndex = i;
|
|
4307
|
+
}
|
|
4308
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
4309
|
+
const value = input.slice(prevIndex + 1);
|
|
4310
|
+
parts.push(value);
|
|
4311
|
+
if (opts.tokens) {
|
|
4312
|
+
tokens[tokens.length - 1].value = value;
|
|
4313
|
+
depth(tokens[tokens.length - 1]);
|
|
4314
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
4315
|
+
}
|
|
4316
|
+
}
|
|
4317
|
+
state.slashes = slashes;
|
|
4318
|
+
state.parts = parts;
|
|
4319
|
+
}
|
|
4320
|
+
return state;
|
|
4321
|
+
};
|
|
4322
|
+
module.exports = scan$1;
|
|
4323
|
+
}));
|
|
4324
|
+
|
|
4325
|
+
//#endregion
|
|
4326
|
+
//#region node_modules/picomatch/lib/parse.js
|
|
4327
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4328
|
+
const constants$1 = require_constants();
|
|
4329
|
+
const utils$2 = require_utils();
|
|
4330
|
+
/**
|
|
4331
|
+
* Constants
|
|
4332
|
+
*/
|
|
4333
|
+
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants$1;
|
|
4334
|
+
/**
|
|
4335
|
+
* Helpers
|
|
4336
|
+
*/
|
|
4337
|
+
const expandRange = (args, options) => {
|
|
4338
|
+
if (typeof options.expandRange === "function") {
|
|
4339
|
+
return options.expandRange(...args, options);
|
|
4340
|
+
}
|
|
4341
|
+
args.sort();
|
|
4342
|
+
const value = `[${args.join("-")}]`;
|
|
4343
|
+
try {
|
|
4344
|
+
new RegExp(value);
|
|
4345
|
+
} catch (ex) {
|
|
4346
|
+
return args.map((v) => utils$2.escapeRegex(v)).join("..");
|
|
4347
|
+
}
|
|
4348
|
+
return value;
|
|
4349
|
+
};
|
|
4350
|
+
/**
|
|
4351
|
+
* Create the message for a syntax error
|
|
4352
|
+
*/
|
|
4353
|
+
const syntaxError = (type, char) => {
|
|
4354
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
4355
|
+
};
|
|
4356
|
+
/**
|
|
4357
|
+
* Parse the given input string.
|
|
4358
|
+
* @param {String} input
|
|
4359
|
+
* @param {Object} options
|
|
4360
|
+
* @return {Object}
|
|
4361
|
+
*/
|
|
4362
|
+
const parse$1 = (input, options) => {
|
|
4363
|
+
if (typeof input !== "string") {
|
|
4364
|
+
throw new TypeError("Expected a string");
|
|
4365
|
+
}
|
|
4366
|
+
input = REPLACEMENTS[input] || input;
|
|
4367
|
+
const opts = { ...options };
|
|
4368
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
4369
|
+
let len = input.length;
|
|
4370
|
+
if (len > max) {
|
|
4371
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
4372
|
+
}
|
|
4373
|
+
const bos = {
|
|
4374
|
+
type: "bos",
|
|
4375
|
+
value: "",
|
|
4376
|
+
output: opts.prepend || ""
|
|
4377
|
+
};
|
|
4378
|
+
const tokens = [bos];
|
|
4379
|
+
const capture = opts.capture ? "" : "?:";
|
|
4380
|
+
const PLATFORM_CHARS = constants$1.globChars(opts.windows);
|
|
4381
|
+
const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
|
|
4382
|
+
const { DOT_LITERAL: DOT_LITERAL$1, PLUS_LITERAL: PLUS_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT: NO_DOT$1, NO_DOT_SLASH: NO_DOT_SLASH$1, NO_DOTS_SLASH: NO_DOTS_SLASH$1, QMARK: QMARK$1, QMARK_NO_DOT: QMARK_NO_DOT$1, STAR: STAR$1, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS;
|
|
4383
|
+
const globstar = (opts$1) => {
|
|
4384
|
+
return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
|
|
4385
|
+
};
|
|
4386
|
+
const nodot = opts.dot ? "" : NO_DOT$1;
|
|
4387
|
+
const qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT$1;
|
|
4388
|
+
let star = opts.bash === true ? globstar(opts) : STAR$1;
|
|
4389
|
+
if (opts.capture) {
|
|
4390
|
+
star = `(${star})`;
|
|
4391
|
+
}
|
|
4392
|
+
if (typeof opts.noext === "boolean") {
|
|
4393
|
+
opts.noextglob = opts.noext;
|
|
4394
|
+
}
|
|
4395
|
+
const state = {
|
|
4396
|
+
input,
|
|
4397
|
+
index: -1,
|
|
4398
|
+
start: 0,
|
|
4399
|
+
dot: opts.dot === true,
|
|
4400
|
+
consumed: "",
|
|
4401
|
+
output: "",
|
|
4402
|
+
prefix: "",
|
|
4403
|
+
backtrack: false,
|
|
4404
|
+
negated: false,
|
|
4405
|
+
brackets: 0,
|
|
4406
|
+
braces: 0,
|
|
4407
|
+
parens: 0,
|
|
4408
|
+
quotes: 0,
|
|
4409
|
+
globstar: false,
|
|
4410
|
+
tokens
|
|
4411
|
+
};
|
|
4412
|
+
input = utils$2.removePrefix(input, state);
|
|
4413
|
+
len = input.length;
|
|
4414
|
+
const extglobs = [];
|
|
4415
|
+
const braces = [];
|
|
4416
|
+
const stack = [];
|
|
4417
|
+
let prev = bos;
|
|
4418
|
+
let value;
|
|
4419
|
+
/**
|
|
4420
|
+
* Tokenizing helpers
|
|
4421
|
+
*/
|
|
4422
|
+
const eos = () => state.index === len - 1;
|
|
4423
|
+
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
4424
|
+
const advance = state.advance = () => input[++state.index] || "";
|
|
4425
|
+
const remaining = () => input.slice(state.index + 1);
|
|
4426
|
+
const consume = (value$1 = "", num = 0) => {
|
|
4427
|
+
state.consumed += value$1;
|
|
4428
|
+
state.index += num;
|
|
4429
|
+
};
|
|
4430
|
+
const append = (token) => {
|
|
4431
|
+
state.output += token.output != null ? token.output : token.value;
|
|
4432
|
+
consume(token.value);
|
|
4433
|
+
};
|
|
4434
|
+
const negate = () => {
|
|
4435
|
+
let count = 1;
|
|
4436
|
+
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
4437
|
+
advance();
|
|
4438
|
+
state.start++;
|
|
4439
|
+
count++;
|
|
4440
|
+
}
|
|
4441
|
+
if (count % 2 === 0) {
|
|
4442
|
+
return false;
|
|
4443
|
+
}
|
|
4444
|
+
state.negated = true;
|
|
4445
|
+
state.start++;
|
|
4446
|
+
return true;
|
|
4447
|
+
};
|
|
4448
|
+
const increment = (type) => {
|
|
4449
|
+
state[type]++;
|
|
4450
|
+
stack.push(type);
|
|
4451
|
+
};
|
|
4452
|
+
const decrement = (type) => {
|
|
4453
|
+
state[type]--;
|
|
4454
|
+
stack.pop();
|
|
4455
|
+
};
|
|
4456
|
+
/**
|
|
4457
|
+
* Push tokens onto the tokens array. This helper speeds up
|
|
4458
|
+
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
|
4459
|
+
* and 2) helping us avoid creating extra tokens when consecutive
|
|
4460
|
+
* characters are plain text. This improves performance and simplifies
|
|
4461
|
+
* lookbehinds.
|
|
4462
|
+
*/
|
|
4463
|
+
const push = (tok) => {
|
|
4464
|
+
if (prev.type === "globstar") {
|
|
4465
|
+
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
4466
|
+
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
4467
|
+
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
4468
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
4469
|
+
prev.type = "star";
|
|
4470
|
+
prev.value = "*";
|
|
4471
|
+
prev.output = star;
|
|
4472
|
+
state.output += prev.output;
|
|
4473
|
+
}
|
|
4474
|
+
}
|
|
4475
|
+
if (extglobs.length && tok.type !== "paren") {
|
|
4476
|
+
extglobs[extglobs.length - 1].inner += tok.value;
|
|
4477
|
+
}
|
|
4478
|
+
if (tok.value || tok.output) append(tok);
|
|
4479
|
+
if (prev && prev.type === "text" && tok.type === "text") {
|
|
4480
|
+
prev.output = (prev.output || prev.value) + tok.value;
|
|
4481
|
+
prev.value += tok.value;
|
|
4482
|
+
return;
|
|
4483
|
+
}
|
|
4484
|
+
tok.prev = prev;
|
|
4485
|
+
tokens.push(tok);
|
|
4486
|
+
prev = tok;
|
|
4487
|
+
};
|
|
4488
|
+
const extglobOpen = (type, value$1) => {
|
|
4489
|
+
const token = {
|
|
4490
|
+
...EXTGLOB_CHARS[value$1],
|
|
4491
|
+
conditions: 1,
|
|
4492
|
+
inner: ""
|
|
4493
|
+
};
|
|
4494
|
+
token.prev = prev;
|
|
4495
|
+
token.parens = state.parens;
|
|
4496
|
+
token.output = state.output;
|
|
4497
|
+
const output = (opts.capture ? "(" : "") + token.open;
|
|
4498
|
+
increment("parens");
|
|
4499
|
+
push({
|
|
4500
|
+
type,
|
|
4501
|
+
value: value$1,
|
|
4502
|
+
output: state.output ? "" : ONE_CHAR$1
|
|
4503
|
+
});
|
|
4504
|
+
push({
|
|
4505
|
+
type: "paren",
|
|
4506
|
+
extglob: true,
|
|
4507
|
+
value: advance(),
|
|
4508
|
+
output
|
|
4509
|
+
});
|
|
4510
|
+
extglobs.push(token);
|
|
4511
|
+
};
|
|
4512
|
+
const extglobClose = (token) => {
|
|
4513
|
+
let output = token.close + (opts.capture ? ")" : "");
|
|
4514
|
+
let rest;
|
|
4515
|
+
if (token.type === "negate") {
|
|
4516
|
+
let extglobStar = star;
|
|
4517
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
|
|
4518
|
+
extglobStar = globstar(opts);
|
|
4519
|
+
}
|
|
4520
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
4521
|
+
output = token.close = `)$))${extglobStar}`;
|
|
4522
|
+
}
|
|
4523
|
+
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
4524
|
+
const expression = parse$1(rest, {
|
|
4525
|
+
...options,
|
|
4526
|
+
fastpaths: false
|
|
4527
|
+
}).output;
|
|
4528
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
4529
|
+
}
|
|
4530
|
+
if (token.prev.type === "bos") {
|
|
4531
|
+
state.negatedExtglob = true;
|
|
4532
|
+
}
|
|
4533
|
+
}
|
|
4534
|
+
push({
|
|
4535
|
+
type: "paren",
|
|
4536
|
+
extglob: true,
|
|
4537
|
+
value,
|
|
4538
|
+
output
|
|
4539
|
+
});
|
|
4540
|
+
decrement("parens");
|
|
4541
|
+
};
|
|
4542
|
+
/**
|
|
4543
|
+
* Fast paths
|
|
4544
|
+
*/
|
|
4545
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
4546
|
+
let backslashes = false;
|
|
4547
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
4548
|
+
if (first === "\\") {
|
|
4549
|
+
backslashes = true;
|
|
4550
|
+
return m;
|
|
4551
|
+
}
|
|
4552
|
+
if (first === "?") {
|
|
4553
|
+
if (esc) {
|
|
4554
|
+
return esc + first + (rest ? QMARK$1.repeat(rest.length) : "");
|
|
4555
|
+
}
|
|
4556
|
+
if (index === 0) {
|
|
4557
|
+
return qmarkNoDot + (rest ? QMARK$1.repeat(rest.length) : "");
|
|
4558
|
+
}
|
|
4559
|
+
return QMARK$1.repeat(chars.length);
|
|
4560
|
+
}
|
|
4561
|
+
if (first === ".") {
|
|
4562
|
+
return DOT_LITERAL$1.repeat(chars.length);
|
|
4563
|
+
}
|
|
4564
|
+
if (first === "*") {
|
|
4565
|
+
if (esc) {
|
|
4566
|
+
return esc + first + (rest ? star : "");
|
|
4567
|
+
}
|
|
4568
|
+
return star;
|
|
4569
|
+
}
|
|
4570
|
+
return esc ? m : `\\${m}`;
|
|
4571
|
+
});
|
|
4572
|
+
if (backslashes === true) {
|
|
4573
|
+
if (opts.unescape === true) {
|
|
4574
|
+
output = output.replace(/\\/g, "");
|
|
4575
|
+
} else {
|
|
4576
|
+
output = output.replace(/\\+/g, (m) => {
|
|
4577
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
4578
|
+
});
|
|
4579
|
+
}
|
|
4580
|
+
}
|
|
4581
|
+
if (output === input && opts.contains === true) {
|
|
4582
|
+
state.output = input;
|
|
4583
|
+
return state;
|
|
4584
|
+
}
|
|
4585
|
+
state.output = utils$2.wrapOutput(output, state, options);
|
|
4586
|
+
return state;
|
|
4587
|
+
}
|
|
4588
|
+
/**
|
|
4589
|
+
* Tokenize input until we reach end-of-string
|
|
4590
|
+
*/
|
|
4591
|
+
while (!eos()) {
|
|
4592
|
+
value = advance();
|
|
4593
|
+
if (value === "\0") {
|
|
4594
|
+
continue;
|
|
4595
|
+
}
|
|
4596
|
+
/**
|
|
4597
|
+
* Escaped characters
|
|
4598
|
+
*/
|
|
4599
|
+
if (value === "\\") {
|
|
4600
|
+
const next = peek();
|
|
4601
|
+
if (next === "/" && opts.bash !== true) {
|
|
4602
|
+
continue;
|
|
4603
|
+
}
|
|
4604
|
+
if (next === "." || next === ";") {
|
|
4605
|
+
continue;
|
|
4606
|
+
}
|
|
4607
|
+
if (!next) {
|
|
4608
|
+
value += "\\";
|
|
4609
|
+
push({
|
|
4610
|
+
type: "text",
|
|
4611
|
+
value
|
|
4612
|
+
});
|
|
4613
|
+
continue;
|
|
4614
|
+
}
|
|
4615
|
+
const match = /^\\+/.exec(remaining());
|
|
4616
|
+
let slashes = 0;
|
|
4617
|
+
if (match && match[0].length > 2) {
|
|
4618
|
+
slashes = match[0].length;
|
|
4619
|
+
state.index += slashes;
|
|
4620
|
+
if (slashes % 2 !== 0) {
|
|
4621
|
+
value += "\\";
|
|
4622
|
+
}
|
|
4623
|
+
}
|
|
4624
|
+
if (opts.unescape === true) {
|
|
4625
|
+
value = advance();
|
|
4626
|
+
} else {
|
|
4627
|
+
value += advance();
|
|
4628
|
+
}
|
|
4629
|
+
if (state.brackets === 0) {
|
|
4630
|
+
push({
|
|
4631
|
+
type: "text",
|
|
4632
|
+
value
|
|
4633
|
+
});
|
|
4634
|
+
continue;
|
|
4635
|
+
}
|
|
4636
|
+
}
|
|
4637
|
+
/**
|
|
4638
|
+
* If we're inside a regex character class, continue
|
|
4639
|
+
* until we reach the closing bracket.
|
|
4640
|
+
*/
|
|
4641
|
+
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
4642
|
+
if (opts.posix !== false && value === ":") {
|
|
4643
|
+
const inner = prev.value.slice(1);
|
|
4644
|
+
if (inner.includes("[")) {
|
|
4645
|
+
prev.posix = true;
|
|
4646
|
+
if (inner.includes(":")) {
|
|
4647
|
+
const idx = prev.value.lastIndexOf("[");
|
|
4648
|
+
const pre = prev.value.slice(0, idx);
|
|
4649
|
+
const rest$1 = prev.value.slice(idx + 2);
|
|
4650
|
+
const posix = POSIX_REGEX_SOURCE[rest$1];
|
|
4651
|
+
if (posix) {
|
|
4652
|
+
prev.value = pre + posix;
|
|
4653
|
+
state.backtrack = true;
|
|
4654
|
+
advance();
|
|
4655
|
+
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
4656
|
+
bos.output = ONE_CHAR$1;
|
|
4657
|
+
}
|
|
4658
|
+
continue;
|
|
4659
|
+
}
|
|
4660
|
+
}
|
|
4661
|
+
}
|
|
4662
|
+
}
|
|
4663
|
+
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
|
|
4664
|
+
value = `\\${value}`;
|
|
4665
|
+
}
|
|
4666
|
+
if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
|
4667
|
+
value = `\\${value}`;
|
|
4668
|
+
}
|
|
4669
|
+
if (opts.posix === true && value === "!" && prev.value === "[") {
|
|
4670
|
+
value = "^";
|
|
4671
|
+
}
|
|
4672
|
+
prev.value += value;
|
|
4673
|
+
append({ value });
|
|
4674
|
+
continue;
|
|
4675
|
+
}
|
|
4676
|
+
/**
|
|
4677
|
+
* If we're inside a quoted string, continue
|
|
4678
|
+
* until we reach the closing double quote.
|
|
4679
|
+
*/
|
|
4680
|
+
if (state.quotes === 1 && value !== "\"") {
|
|
4681
|
+
value = utils$2.escapeRegex(value);
|
|
4682
|
+
prev.value += value;
|
|
4683
|
+
append({ value });
|
|
4684
|
+
continue;
|
|
4685
|
+
}
|
|
4686
|
+
/**
|
|
4687
|
+
* Double quotes
|
|
4688
|
+
*/
|
|
4689
|
+
if (value === "\"") {
|
|
4690
|
+
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
4691
|
+
if (opts.keepQuotes === true) {
|
|
4692
|
+
push({
|
|
4693
|
+
type: "text",
|
|
4694
|
+
value
|
|
4695
|
+
});
|
|
4696
|
+
}
|
|
4697
|
+
continue;
|
|
4698
|
+
}
|
|
4699
|
+
/**
|
|
4700
|
+
* Parentheses
|
|
4701
|
+
*/
|
|
4702
|
+
if (value === "(") {
|
|
4703
|
+
increment("parens");
|
|
4704
|
+
push({
|
|
4705
|
+
type: "paren",
|
|
4706
|
+
value
|
|
4707
|
+
});
|
|
4708
|
+
continue;
|
|
4709
|
+
}
|
|
4710
|
+
if (value === ")") {
|
|
4711
|
+
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
4712
|
+
throw new SyntaxError(syntaxError("opening", "("));
|
|
4713
|
+
}
|
|
4714
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
4715
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
4716
|
+
extglobClose(extglobs.pop());
|
|
4717
|
+
continue;
|
|
4718
|
+
}
|
|
4719
|
+
push({
|
|
4720
|
+
type: "paren",
|
|
4721
|
+
value,
|
|
4722
|
+
output: state.parens ? ")" : "\\)"
|
|
4723
|
+
});
|
|
4724
|
+
decrement("parens");
|
|
4725
|
+
continue;
|
|
4726
|
+
}
|
|
4727
|
+
/**
|
|
4728
|
+
* Square brackets
|
|
4729
|
+
*/
|
|
4730
|
+
if (value === "[") {
|
|
4731
|
+
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
4732
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
4733
|
+
throw new SyntaxError(syntaxError("closing", "]"));
|
|
4734
|
+
}
|
|
4735
|
+
value = `\\${value}`;
|
|
4736
|
+
} else {
|
|
4737
|
+
increment("brackets");
|
|
4738
|
+
}
|
|
4739
|
+
push({
|
|
4740
|
+
type: "bracket",
|
|
4741
|
+
value
|
|
4742
|
+
});
|
|
4743
|
+
continue;
|
|
4744
|
+
}
|
|
4745
|
+
if (value === "]") {
|
|
4746
|
+
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
4747
|
+
push({
|
|
4748
|
+
type: "text",
|
|
4749
|
+
value,
|
|
4750
|
+
output: `\\${value}`
|
|
4751
|
+
});
|
|
4752
|
+
continue;
|
|
4753
|
+
}
|
|
4754
|
+
if (state.brackets === 0) {
|
|
4755
|
+
if (opts.strictBrackets === true) {
|
|
4756
|
+
throw new SyntaxError(syntaxError("opening", "["));
|
|
4757
|
+
}
|
|
4758
|
+
push({
|
|
4759
|
+
type: "text",
|
|
4760
|
+
value,
|
|
4761
|
+
output: `\\${value}`
|
|
4762
|
+
});
|
|
4763
|
+
continue;
|
|
4764
|
+
}
|
|
4765
|
+
decrement("brackets");
|
|
4766
|
+
const prevValue = prev.value.slice(1);
|
|
4767
|
+
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
|
|
4768
|
+
value = `/${value}`;
|
|
4769
|
+
}
|
|
4770
|
+
prev.value += value;
|
|
4771
|
+
append({ value });
|
|
4772
|
+
if (opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) {
|
|
4773
|
+
continue;
|
|
4774
|
+
}
|
|
4775
|
+
const escaped = utils$2.escapeRegex(prev.value);
|
|
4776
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
4777
|
+
if (opts.literalBrackets === true) {
|
|
4778
|
+
state.output += escaped;
|
|
4779
|
+
prev.value = escaped;
|
|
4780
|
+
continue;
|
|
4781
|
+
}
|
|
4782
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
4783
|
+
state.output += prev.value;
|
|
4784
|
+
continue;
|
|
4785
|
+
}
|
|
4786
|
+
/**
|
|
4787
|
+
* Braces
|
|
4788
|
+
*/
|
|
4789
|
+
if (value === "{" && opts.nobrace !== true) {
|
|
4790
|
+
increment("braces");
|
|
4791
|
+
const open = {
|
|
4792
|
+
type: "brace",
|
|
4793
|
+
value,
|
|
4794
|
+
output: "(",
|
|
4795
|
+
outputIndex: state.output.length,
|
|
4796
|
+
tokensIndex: state.tokens.length
|
|
4797
|
+
};
|
|
4798
|
+
braces.push(open);
|
|
4799
|
+
push(open);
|
|
4800
|
+
continue;
|
|
4801
|
+
}
|
|
4802
|
+
if (value === "}") {
|
|
4803
|
+
const brace = braces[braces.length - 1];
|
|
4804
|
+
if (opts.nobrace === true || !brace) {
|
|
4805
|
+
push({
|
|
4806
|
+
type: "text",
|
|
4807
|
+
value,
|
|
4808
|
+
output: value
|
|
4809
|
+
});
|
|
4810
|
+
continue;
|
|
4811
|
+
}
|
|
4812
|
+
let output = ")";
|
|
4813
|
+
if (brace.dots === true) {
|
|
4814
|
+
const arr = tokens.slice();
|
|
4815
|
+
const range = [];
|
|
4816
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
4817
|
+
tokens.pop();
|
|
4818
|
+
if (arr[i].type === "brace") {
|
|
4819
|
+
break;
|
|
4820
|
+
}
|
|
4821
|
+
if (arr[i].type !== "dots") {
|
|
4822
|
+
range.unshift(arr[i].value);
|
|
4823
|
+
}
|
|
4824
|
+
}
|
|
4825
|
+
output = expandRange(range, opts);
|
|
4826
|
+
state.backtrack = true;
|
|
4827
|
+
}
|
|
4828
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
4829
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
4830
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
4831
|
+
brace.value = brace.output = "\\{";
|
|
4832
|
+
value = output = "\\}";
|
|
4833
|
+
state.output = out;
|
|
4834
|
+
for (const t of toks) {
|
|
4835
|
+
state.output += t.output || t.value;
|
|
4836
|
+
}
|
|
4837
|
+
}
|
|
4838
|
+
push({
|
|
4839
|
+
type: "brace",
|
|
4840
|
+
value,
|
|
4841
|
+
output
|
|
4842
|
+
});
|
|
4843
|
+
decrement("braces");
|
|
4844
|
+
braces.pop();
|
|
4845
|
+
continue;
|
|
4846
|
+
}
|
|
4847
|
+
/**
|
|
4848
|
+
* Pipes
|
|
4849
|
+
*/
|
|
4850
|
+
if (value === "|") {
|
|
4851
|
+
if (extglobs.length > 0) {
|
|
4852
|
+
extglobs[extglobs.length - 1].conditions++;
|
|
4853
|
+
}
|
|
4854
|
+
push({
|
|
4855
|
+
type: "text",
|
|
4856
|
+
value
|
|
4857
|
+
});
|
|
4858
|
+
continue;
|
|
4859
|
+
}
|
|
4860
|
+
/**
|
|
4861
|
+
* Commas
|
|
4862
|
+
*/
|
|
4863
|
+
if (value === ",") {
|
|
4864
|
+
let output = value;
|
|
4865
|
+
const brace = braces[braces.length - 1];
|
|
4866
|
+
if (brace && stack[stack.length - 1] === "braces") {
|
|
4867
|
+
brace.comma = true;
|
|
4868
|
+
output = "|";
|
|
4869
|
+
}
|
|
4870
|
+
push({
|
|
4871
|
+
type: "comma",
|
|
4872
|
+
value,
|
|
4873
|
+
output
|
|
4874
|
+
});
|
|
4875
|
+
continue;
|
|
4876
|
+
}
|
|
4877
|
+
/**
|
|
4878
|
+
* Slashes
|
|
4879
|
+
*/
|
|
4880
|
+
if (value === "/") {
|
|
4881
|
+
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
4882
|
+
state.start = state.index + 1;
|
|
4883
|
+
state.consumed = "";
|
|
4884
|
+
state.output = "";
|
|
4885
|
+
tokens.pop();
|
|
4886
|
+
prev = bos;
|
|
4887
|
+
continue;
|
|
4888
|
+
}
|
|
4889
|
+
push({
|
|
4890
|
+
type: "slash",
|
|
4891
|
+
value,
|
|
4892
|
+
output: SLASH_LITERAL$1
|
|
4893
|
+
});
|
|
4894
|
+
continue;
|
|
4895
|
+
}
|
|
4896
|
+
/**
|
|
4897
|
+
* Dots
|
|
4898
|
+
*/
|
|
4899
|
+
if (value === ".") {
|
|
4900
|
+
if (state.braces > 0 && prev.type === "dot") {
|
|
4901
|
+
if (prev.value === ".") prev.output = DOT_LITERAL$1;
|
|
4902
|
+
const brace = braces[braces.length - 1];
|
|
4903
|
+
prev.type = "dots";
|
|
4904
|
+
prev.output += value;
|
|
4905
|
+
prev.value += value;
|
|
4906
|
+
brace.dots = true;
|
|
4907
|
+
continue;
|
|
4908
|
+
}
|
|
4909
|
+
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
4910
|
+
push({
|
|
4911
|
+
type: "text",
|
|
4912
|
+
value,
|
|
4913
|
+
output: DOT_LITERAL$1
|
|
4914
|
+
});
|
|
4915
|
+
continue;
|
|
4916
|
+
}
|
|
4917
|
+
push({
|
|
4918
|
+
type: "dot",
|
|
4919
|
+
value,
|
|
4920
|
+
output: DOT_LITERAL$1
|
|
4921
|
+
});
|
|
4922
|
+
continue;
|
|
4923
|
+
}
|
|
4924
|
+
/**
|
|
4925
|
+
* Question marks
|
|
4926
|
+
*/
|
|
4927
|
+
if (value === "?") {
|
|
4928
|
+
const isGroup = prev && prev.value === "(";
|
|
4929
|
+
if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
4930
|
+
extglobOpen("qmark", value);
|
|
4931
|
+
continue;
|
|
4932
|
+
}
|
|
4933
|
+
if (prev && prev.type === "paren") {
|
|
4934
|
+
const next = peek();
|
|
4935
|
+
let output = value;
|
|
4936
|
+
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
|
4937
|
+
output = `\\${value}`;
|
|
4938
|
+
}
|
|
4939
|
+
push({
|
|
4940
|
+
type: "text",
|
|
4941
|
+
value,
|
|
4942
|
+
output
|
|
4943
|
+
});
|
|
4944
|
+
continue;
|
|
4945
|
+
}
|
|
4946
|
+
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
4947
|
+
push({
|
|
4948
|
+
type: "qmark",
|
|
4949
|
+
value,
|
|
4950
|
+
output: QMARK_NO_DOT$1
|
|
4951
|
+
});
|
|
4952
|
+
continue;
|
|
4953
|
+
}
|
|
4954
|
+
push({
|
|
4955
|
+
type: "qmark",
|
|
4956
|
+
value,
|
|
4957
|
+
output: QMARK$1
|
|
4958
|
+
});
|
|
4959
|
+
continue;
|
|
4960
|
+
}
|
|
4961
|
+
/**
|
|
4962
|
+
* Exclamation
|
|
4963
|
+
*/
|
|
4964
|
+
if (value === "!") {
|
|
4965
|
+
if (opts.noextglob !== true && peek() === "(") {
|
|
4966
|
+
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
4967
|
+
extglobOpen("negate", value);
|
|
4968
|
+
continue;
|
|
4969
|
+
}
|
|
4970
|
+
}
|
|
4971
|
+
if (opts.nonegate !== true && state.index === 0) {
|
|
4972
|
+
negate();
|
|
4973
|
+
continue;
|
|
4974
|
+
}
|
|
4975
|
+
}
|
|
4976
|
+
/**
|
|
4977
|
+
* Plus
|
|
4978
|
+
*/
|
|
4979
|
+
if (value === "+") {
|
|
4980
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
4981
|
+
extglobOpen("plus", value);
|
|
4982
|
+
continue;
|
|
4983
|
+
}
|
|
4984
|
+
if (prev && prev.value === "(" || opts.regex === false) {
|
|
4985
|
+
push({
|
|
4986
|
+
type: "plus",
|
|
4987
|
+
value,
|
|
4988
|
+
output: PLUS_LITERAL$1
|
|
4989
|
+
});
|
|
4990
|
+
continue;
|
|
4991
|
+
}
|
|
4992
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
4993
|
+
push({
|
|
4994
|
+
type: "plus",
|
|
4995
|
+
value
|
|
4996
|
+
});
|
|
4997
|
+
continue;
|
|
4998
|
+
}
|
|
4999
|
+
push({
|
|
5000
|
+
type: "plus",
|
|
5001
|
+
value: PLUS_LITERAL$1
|
|
5002
|
+
});
|
|
5003
|
+
continue;
|
|
5004
|
+
}
|
|
5005
|
+
/**
|
|
5006
|
+
* Plain text
|
|
5007
|
+
*/
|
|
5008
|
+
if (value === "@") {
|
|
5009
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
5010
|
+
push({
|
|
5011
|
+
type: "at",
|
|
5012
|
+
extglob: true,
|
|
5013
|
+
value,
|
|
5014
|
+
output: ""
|
|
5015
|
+
});
|
|
5016
|
+
continue;
|
|
5017
|
+
}
|
|
5018
|
+
push({
|
|
5019
|
+
type: "text",
|
|
5020
|
+
value
|
|
5021
|
+
});
|
|
5022
|
+
continue;
|
|
5023
|
+
}
|
|
5024
|
+
/**
|
|
5025
|
+
* Plain text
|
|
5026
|
+
*/
|
|
5027
|
+
if (value !== "*") {
|
|
5028
|
+
if (value === "$" || value === "^") {
|
|
5029
|
+
value = `\\${value}`;
|
|
5030
|
+
}
|
|
5031
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
5032
|
+
if (match) {
|
|
5033
|
+
value += match[0];
|
|
5034
|
+
state.index += match[0].length;
|
|
5035
|
+
}
|
|
5036
|
+
push({
|
|
5037
|
+
type: "text",
|
|
5038
|
+
value
|
|
5039
|
+
});
|
|
5040
|
+
continue;
|
|
5041
|
+
}
|
|
5042
|
+
/**
|
|
5043
|
+
* Stars
|
|
5044
|
+
*/
|
|
5045
|
+
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
5046
|
+
prev.type = "star";
|
|
5047
|
+
prev.star = true;
|
|
5048
|
+
prev.value += value;
|
|
5049
|
+
prev.output = star;
|
|
5050
|
+
state.backtrack = true;
|
|
5051
|
+
state.globstar = true;
|
|
5052
|
+
consume(value);
|
|
5053
|
+
continue;
|
|
5054
|
+
}
|
|
5055
|
+
let rest = remaining();
|
|
5056
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
5057
|
+
extglobOpen("star", value);
|
|
5058
|
+
continue;
|
|
5059
|
+
}
|
|
5060
|
+
if (prev.type === "star") {
|
|
5061
|
+
if (opts.noglobstar === true) {
|
|
5062
|
+
consume(value);
|
|
5063
|
+
continue;
|
|
5064
|
+
}
|
|
5065
|
+
const prior = prev.prev;
|
|
5066
|
+
const before = prior.prev;
|
|
5067
|
+
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
5068
|
+
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
5069
|
+
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
5070
|
+
push({
|
|
5071
|
+
type: "star",
|
|
5072
|
+
value,
|
|
5073
|
+
output: ""
|
|
5074
|
+
});
|
|
5075
|
+
continue;
|
|
5076
|
+
}
|
|
5077
|
+
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
5078
|
+
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
5079
|
+
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
5080
|
+
push({
|
|
5081
|
+
type: "star",
|
|
5082
|
+
value,
|
|
5083
|
+
output: ""
|
|
5084
|
+
});
|
|
5085
|
+
continue;
|
|
5086
|
+
}
|
|
5087
|
+
while (rest.slice(0, 3) === "/**") {
|
|
5088
|
+
const after = input[state.index + 4];
|
|
5089
|
+
if (after && after !== "/") {
|
|
5090
|
+
break;
|
|
5091
|
+
}
|
|
5092
|
+
rest = rest.slice(3);
|
|
5093
|
+
consume("/**", 3);
|
|
5094
|
+
}
|
|
5095
|
+
if (prior.type === "bos" && eos()) {
|
|
5096
|
+
prev.type = "globstar";
|
|
5097
|
+
prev.value += value;
|
|
5098
|
+
prev.output = globstar(opts);
|
|
5099
|
+
state.output = prev.output;
|
|
5100
|
+
state.globstar = true;
|
|
5101
|
+
consume(value);
|
|
5102
|
+
continue;
|
|
5103
|
+
}
|
|
5104
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
|
5105
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
5106
|
+
prior.output = `(?:${prior.output}`;
|
|
5107
|
+
prev.type = "globstar";
|
|
5108
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
5109
|
+
prev.value += value;
|
|
5110
|
+
state.globstar = true;
|
|
5111
|
+
state.output += prior.output + prev.output;
|
|
5112
|
+
consume(value);
|
|
5113
|
+
continue;
|
|
5114
|
+
}
|
|
5115
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
5116
|
+
const end = rest[1] !== void 0 ? "|$" : "";
|
|
5117
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
5118
|
+
prior.output = `(?:${prior.output}`;
|
|
5119
|
+
prev.type = "globstar";
|
|
5120
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL$1}|${SLASH_LITERAL$1}${end})`;
|
|
5121
|
+
prev.value += value;
|
|
5122
|
+
state.output += prior.output + prev.output;
|
|
5123
|
+
state.globstar = true;
|
|
5124
|
+
consume(value + advance());
|
|
5125
|
+
push({
|
|
5126
|
+
type: "slash",
|
|
5127
|
+
value: "/",
|
|
5128
|
+
output: ""
|
|
5129
|
+
});
|
|
5130
|
+
continue;
|
|
5131
|
+
}
|
|
5132
|
+
if (prior.type === "bos" && rest[0] === "/") {
|
|
5133
|
+
prev.type = "globstar";
|
|
5134
|
+
prev.value += value;
|
|
5135
|
+
prev.output = `(?:^|${SLASH_LITERAL$1}|${globstar(opts)}${SLASH_LITERAL$1})`;
|
|
5136
|
+
state.output = prev.output;
|
|
5137
|
+
state.globstar = true;
|
|
5138
|
+
consume(value + advance());
|
|
5139
|
+
push({
|
|
5140
|
+
type: "slash",
|
|
5141
|
+
value: "/",
|
|
5142
|
+
output: ""
|
|
5143
|
+
});
|
|
5144
|
+
continue;
|
|
5145
|
+
}
|
|
5146
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
5147
|
+
prev.type = "globstar";
|
|
5148
|
+
prev.output = globstar(opts);
|
|
5149
|
+
prev.value += value;
|
|
5150
|
+
state.output += prev.output;
|
|
5151
|
+
state.globstar = true;
|
|
5152
|
+
consume(value);
|
|
5153
|
+
continue;
|
|
5154
|
+
}
|
|
5155
|
+
const token = {
|
|
5156
|
+
type: "star",
|
|
5157
|
+
value,
|
|
5158
|
+
output: star
|
|
5159
|
+
};
|
|
5160
|
+
if (opts.bash === true) {
|
|
5161
|
+
token.output = ".*?";
|
|
5162
|
+
if (prev.type === "bos" || prev.type === "slash") {
|
|
5163
|
+
token.output = nodot + token.output;
|
|
5164
|
+
}
|
|
5165
|
+
push(token);
|
|
5166
|
+
continue;
|
|
5167
|
+
}
|
|
5168
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
5169
|
+
token.output = value;
|
|
5170
|
+
push(token);
|
|
5171
|
+
continue;
|
|
5172
|
+
}
|
|
5173
|
+
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
5174
|
+
if (prev.type === "dot") {
|
|
5175
|
+
state.output += NO_DOT_SLASH$1;
|
|
5176
|
+
prev.output += NO_DOT_SLASH$1;
|
|
5177
|
+
} else if (opts.dot === true) {
|
|
5178
|
+
state.output += NO_DOTS_SLASH$1;
|
|
5179
|
+
prev.output += NO_DOTS_SLASH$1;
|
|
5180
|
+
} else {
|
|
5181
|
+
state.output += nodot;
|
|
5182
|
+
prev.output += nodot;
|
|
5183
|
+
}
|
|
5184
|
+
if (peek() !== "*") {
|
|
5185
|
+
state.output += ONE_CHAR$1;
|
|
5186
|
+
prev.output += ONE_CHAR$1;
|
|
5187
|
+
}
|
|
5188
|
+
}
|
|
5189
|
+
push(token);
|
|
5190
|
+
}
|
|
5191
|
+
while (state.brackets > 0) {
|
|
5192
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
5193
|
+
state.output = utils$2.escapeLast(state.output, "[");
|
|
5194
|
+
decrement("brackets");
|
|
5195
|
+
}
|
|
5196
|
+
while (state.parens > 0) {
|
|
5197
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
|
|
5198
|
+
state.output = utils$2.escapeLast(state.output, "(");
|
|
5199
|
+
decrement("parens");
|
|
5200
|
+
}
|
|
5201
|
+
while (state.braces > 0) {
|
|
5202
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
|
|
5203
|
+
state.output = utils$2.escapeLast(state.output, "{");
|
|
5204
|
+
decrement("braces");
|
|
5205
|
+
}
|
|
5206
|
+
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
|
5207
|
+
push({
|
|
5208
|
+
type: "maybe_slash",
|
|
5209
|
+
value: "",
|
|
5210
|
+
output: `${SLASH_LITERAL$1}?`
|
|
5211
|
+
});
|
|
5212
|
+
}
|
|
5213
|
+
if (state.backtrack === true) {
|
|
5214
|
+
state.output = "";
|
|
5215
|
+
for (const token of state.tokens) {
|
|
5216
|
+
state.output += token.output != null ? token.output : token.value;
|
|
5217
|
+
if (token.suffix) {
|
|
5218
|
+
state.output += token.suffix;
|
|
5219
|
+
}
|
|
5220
|
+
}
|
|
5221
|
+
}
|
|
5222
|
+
return state;
|
|
5223
|
+
};
|
|
5224
|
+
/**
|
|
5225
|
+
* Fast paths for creating regular expressions for common glob patterns.
|
|
5226
|
+
* This can significantly speed up processing and has very little downside
|
|
5227
|
+
* impact when none of the fast paths match.
|
|
5228
|
+
*/
|
|
5229
|
+
parse$1.fastpaths = (input, options) => {
|
|
5230
|
+
const opts = { ...options };
|
|
5231
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
5232
|
+
const len = input.length;
|
|
5233
|
+
if (len > max) {
|
|
5234
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
5235
|
+
}
|
|
5236
|
+
input = REPLACEMENTS[input] || input;
|
|
5237
|
+
const { DOT_LITERAL: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT: NO_DOT$1, NO_DOTS: NO_DOTS$1, NO_DOTS_SLASH: NO_DOTS_SLASH$1, STAR: STAR$1, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(opts.windows);
|
|
5238
|
+
const nodot = opts.dot ? NO_DOTS$1 : NO_DOT$1;
|
|
5239
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH$1 : NO_DOT$1;
|
|
5240
|
+
const capture = opts.capture ? "" : "?:";
|
|
5241
|
+
const state = {
|
|
5242
|
+
negated: false,
|
|
5243
|
+
prefix: ""
|
|
5244
|
+
};
|
|
5245
|
+
let star = opts.bash === true ? ".*?" : STAR$1;
|
|
5246
|
+
if (opts.capture) {
|
|
5247
|
+
star = `(${star})`;
|
|
5248
|
+
}
|
|
5249
|
+
const globstar = (opts$1) => {
|
|
5250
|
+
if (opts$1.noglobstar === true) return star;
|
|
5251
|
+
return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
|
|
5252
|
+
};
|
|
5253
|
+
const create = (str) => {
|
|
5254
|
+
switch (str) {
|
|
5255
|
+
case "*": return `${nodot}${ONE_CHAR$1}${star}`;
|
|
5256
|
+
case ".*": return `${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
5257
|
+
case "*.*": return `${nodot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
5258
|
+
case "*/*": return `${nodot}${star}${SLASH_LITERAL$1}${ONE_CHAR$1}${slashDot}${star}`;
|
|
5259
|
+
case "**": return nodot + globstar(opts);
|
|
5260
|
+
case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${ONE_CHAR$1}${star}`;
|
|
5261
|
+
case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
5262
|
+
case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
5263
|
+
default: {
|
|
5264
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
5265
|
+
if (!match) return;
|
|
5266
|
+
const source$1 = create(match[1]);
|
|
5267
|
+
if (!source$1) return;
|
|
5268
|
+
return source$1 + DOT_LITERAL$1 + match[2];
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5271
|
+
};
|
|
5272
|
+
const output = utils$2.removePrefix(input, state);
|
|
5273
|
+
let source = create(output);
|
|
5274
|
+
if (source && opts.strictSlashes !== true) {
|
|
5275
|
+
source += `${SLASH_LITERAL$1}?`;
|
|
5276
|
+
}
|
|
5277
|
+
return source;
|
|
5278
|
+
};
|
|
5279
|
+
module.exports = parse$1;
|
|
5280
|
+
}));
|
|
5281
|
+
|
|
5282
|
+
//#endregion
|
|
5283
|
+
//#region node_modules/picomatch/lib/picomatch.js
|
|
5284
|
+
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5285
|
+
const scan = require_scan();
|
|
5286
|
+
const parse = require_parse();
|
|
5287
|
+
const utils$1 = require_utils();
|
|
5288
|
+
const constants = require_constants();
|
|
5289
|
+
const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
5290
|
+
/**
|
|
5291
|
+
* Creates a matcher function from one or more glob patterns. The
|
|
5292
|
+
* returned function takes a string to match as its first argument,
|
|
5293
|
+
* and returns true if the string is a match. The returned matcher
|
|
5294
|
+
* function also takes a boolean as the second argument that, when true,
|
|
5295
|
+
* returns an object with additional information.
|
|
5296
|
+
*
|
|
5297
|
+
* ```js
|
|
5298
|
+
* const picomatch = require('picomatch');
|
|
5299
|
+
* // picomatch(glob[, options]);
|
|
5300
|
+
*
|
|
5301
|
+
* const isMatch = picomatch('*.!(*a)');
|
|
5302
|
+
* console.log(isMatch('a.a')); //=> false
|
|
5303
|
+
* console.log(isMatch('a.b')); //=> true
|
|
5304
|
+
* ```
|
|
5305
|
+
* @name picomatch
|
|
5306
|
+
* @param {String|Array} `globs` One or more glob patterns.
|
|
5307
|
+
* @param {Object=} `options`
|
|
5308
|
+
* @return {Function=} Returns a matcher function.
|
|
5309
|
+
* @api public
|
|
5310
|
+
*/
|
|
5311
|
+
const picomatch$2 = (glob, options, returnState = false) => {
|
|
5312
|
+
if (Array.isArray(glob)) {
|
|
5313
|
+
const fns = glob.map((input) => picomatch$2(input, options, returnState));
|
|
5314
|
+
const arrayMatcher = (str) => {
|
|
5315
|
+
for (const isMatch of fns) {
|
|
5316
|
+
const state$1 = isMatch(str);
|
|
5317
|
+
if (state$1) return state$1;
|
|
5318
|
+
}
|
|
5319
|
+
return false;
|
|
5320
|
+
};
|
|
5321
|
+
return arrayMatcher;
|
|
5322
|
+
}
|
|
5323
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
5324
|
+
if (glob === "" || typeof glob !== "string" && !isState) {
|
|
5325
|
+
throw new TypeError("Expected pattern to be a non-empty string");
|
|
5326
|
+
}
|
|
5327
|
+
const opts = options || {};
|
|
5328
|
+
const posix = opts.windows;
|
|
5329
|
+
const regex = isState ? picomatch$2.compileRe(glob, options) : picomatch$2.makeRe(glob, options, false, true);
|
|
5330
|
+
const state = regex.state;
|
|
5331
|
+
delete regex.state;
|
|
5332
|
+
let isIgnored = () => false;
|
|
5333
|
+
if (opts.ignore) {
|
|
5334
|
+
const ignoreOpts = {
|
|
5335
|
+
...options,
|
|
5336
|
+
ignore: null,
|
|
5337
|
+
onMatch: null,
|
|
5338
|
+
onResult: null
|
|
5339
|
+
};
|
|
5340
|
+
isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
|
|
5341
|
+
}
|
|
5342
|
+
const matcher = (input, returnObject = false) => {
|
|
5343
|
+
const { isMatch, match, output } = picomatch$2.test(input, regex, options, {
|
|
5344
|
+
glob,
|
|
5345
|
+
posix
|
|
5346
|
+
});
|
|
5347
|
+
const result = {
|
|
5348
|
+
glob,
|
|
5349
|
+
state,
|
|
5350
|
+
regex,
|
|
5351
|
+
posix,
|
|
5352
|
+
input,
|
|
5353
|
+
output,
|
|
5354
|
+
match,
|
|
5355
|
+
isMatch
|
|
5356
|
+
};
|
|
5357
|
+
if (typeof opts.onResult === "function") {
|
|
5358
|
+
opts.onResult(result);
|
|
5359
|
+
}
|
|
5360
|
+
if (isMatch === false) {
|
|
5361
|
+
result.isMatch = false;
|
|
5362
|
+
return returnObject ? result : false;
|
|
5363
|
+
}
|
|
5364
|
+
if (isIgnored(input)) {
|
|
5365
|
+
if (typeof opts.onIgnore === "function") {
|
|
5366
|
+
opts.onIgnore(result);
|
|
5367
|
+
}
|
|
5368
|
+
result.isMatch = false;
|
|
5369
|
+
return returnObject ? result : false;
|
|
5370
|
+
}
|
|
5371
|
+
if (typeof opts.onMatch === "function") {
|
|
5372
|
+
opts.onMatch(result);
|
|
5373
|
+
}
|
|
5374
|
+
return returnObject ? result : true;
|
|
5375
|
+
};
|
|
5376
|
+
if (returnState) {
|
|
5377
|
+
matcher.state = state;
|
|
5378
|
+
}
|
|
5379
|
+
return matcher;
|
|
5380
|
+
};
|
|
5381
|
+
/**
|
|
5382
|
+
* Test `input` with the given `regex`. This is used by the main
|
|
5383
|
+
* `picomatch()` function to test the input string.
|
|
5384
|
+
*
|
|
5385
|
+
* ```js
|
|
5386
|
+
* const picomatch = require('picomatch');
|
|
5387
|
+
* // picomatch.test(input, regex[, options]);
|
|
5388
|
+
*
|
|
5389
|
+
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
5390
|
+
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
5391
|
+
* ```
|
|
5392
|
+
* @param {String} `input` String to test.
|
|
5393
|
+
* @param {RegExp} `regex`
|
|
5394
|
+
* @return {Object} Returns an object with matching info.
|
|
5395
|
+
* @api public
|
|
5396
|
+
*/
|
|
5397
|
+
picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
|
|
5398
|
+
if (typeof input !== "string") {
|
|
5399
|
+
throw new TypeError("Expected input to be a string");
|
|
5400
|
+
}
|
|
5401
|
+
if (input === "") {
|
|
5402
|
+
return {
|
|
5403
|
+
isMatch: false,
|
|
5404
|
+
output: ""
|
|
5405
|
+
};
|
|
5406
|
+
}
|
|
5407
|
+
const opts = options || {};
|
|
5408
|
+
const format = opts.format || (posix ? utils$1.toPosixSlashes : null);
|
|
5409
|
+
let match = input === glob;
|
|
5410
|
+
let output = match && format ? format(input) : input;
|
|
5411
|
+
if (match === false) {
|
|
5412
|
+
output = format ? format(input) : input;
|
|
5413
|
+
match = output === glob;
|
|
5414
|
+
}
|
|
5415
|
+
if (match === false || opts.capture === true) {
|
|
5416
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
5417
|
+
match = picomatch$2.matchBase(input, regex, options, posix);
|
|
5418
|
+
} else {
|
|
5419
|
+
match = regex.exec(output);
|
|
5420
|
+
}
|
|
5421
|
+
}
|
|
5422
|
+
return {
|
|
5423
|
+
isMatch: Boolean(match),
|
|
5424
|
+
match,
|
|
5425
|
+
output
|
|
5426
|
+
};
|
|
5427
|
+
};
|
|
5428
|
+
/**
|
|
5429
|
+
* Match the basename of a filepath.
|
|
5430
|
+
*
|
|
5431
|
+
* ```js
|
|
5432
|
+
* const picomatch = require('picomatch');
|
|
5433
|
+
* // picomatch.matchBase(input, glob[, options]);
|
|
5434
|
+
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
5435
|
+
* ```
|
|
5436
|
+
* @param {String} `input` String to test.
|
|
5437
|
+
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
5438
|
+
* @return {Boolean}
|
|
5439
|
+
* @api public
|
|
5440
|
+
*/
|
|
5441
|
+
picomatch$2.matchBase = (input, glob, options) => {
|
|
5442
|
+
const regex = glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options);
|
|
5443
|
+
return regex.test(utils$1.basename(input));
|
|
5444
|
+
};
|
|
5445
|
+
/**
|
|
5446
|
+
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
5447
|
+
*
|
|
5448
|
+
* ```js
|
|
5449
|
+
* const picomatch = require('picomatch');
|
|
5450
|
+
* // picomatch.isMatch(string, patterns[, options]);
|
|
5451
|
+
*
|
|
5452
|
+
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
5453
|
+
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
5454
|
+
* ```
|
|
5455
|
+
* @param {String|Array} str The string to test.
|
|
5456
|
+
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
5457
|
+
* @param {Object} [options] See available [options](#options).
|
|
5458
|
+
* @return {Boolean} Returns true if any patterns match `str`
|
|
5459
|
+
* @api public
|
|
5460
|
+
*/
|
|
5461
|
+
picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
|
|
5462
|
+
/**
|
|
5463
|
+
* Parse a glob pattern to create the source string for a regular
|
|
5464
|
+
* expression.
|
|
5465
|
+
*
|
|
5466
|
+
* ```js
|
|
5467
|
+
* const picomatch = require('picomatch');
|
|
5468
|
+
* const result = picomatch.parse(pattern[, options]);
|
|
5469
|
+
* ```
|
|
5470
|
+
* @param {String} `pattern`
|
|
5471
|
+
* @param {Object} `options`
|
|
5472
|
+
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
5473
|
+
* @api public
|
|
5474
|
+
*/
|
|
5475
|
+
picomatch$2.parse = (pattern, options) => {
|
|
5476
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch$2.parse(p, options));
|
|
5477
|
+
return parse(pattern, {
|
|
5478
|
+
...options,
|
|
5479
|
+
fastpaths: false
|
|
5480
|
+
});
|
|
5481
|
+
};
|
|
5482
|
+
/**
|
|
5483
|
+
* Scan a glob pattern to separate the pattern into segments.
|
|
5484
|
+
*
|
|
5485
|
+
* ```js
|
|
5486
|
+
* const picomatch = require('picomatch');
|
|
5487
|
+
* // picomatch.scan(input[, options]);
|
|
5488
|
+
*
|
|
5489
|
+
* const result = picomatch.scan('!./foo/*.js');
|
|
5490
|
+
* console.log(result);
|
|
5491
|
+
* { prefix: '!./',
|
|
5492
|
+
* input: '!./foo/*.js',
|
|
5493
|
+
* start: 3,
|
|
5494
|
+
* base: 'foo',
|
|
5495
|
+
* glob: '*.js',
|
|
5496
|
+
* isBrace: false,
|
|
5497
|
+
* isBracket: false,
|
|
5498
|
+
* isGlob: true,
|
|
5499
|
+
* isExtglob: false,
|
|
5500
|
+
* isGlobstar: false,
|
|
5501
|
+
* negated: true }
|
|
5502
|
+
* ```
|
|
5503
|
+
* @param {String} `input` Glob pattern to scan.
|
|
5504
|
+
* @param {Object} `options`
|
|
5505
|
+
* @return {Object} Returns an object with
|
|
5506
|
+
* @api public
|
|
5507
|
+
*/
|
|
5508
|
+
picomatch$2.scan = (input, options) => scan(input, options);
|
|
5509
|
+
/**
|
|
5510
|
+
* Compile a regular expression from the `state` object returned by the
|
|
5511
|
+
* [parse()](#parse) method.
|
|
5512
|
+
*
|
|
5513
|
+
* @param {Object} `state`
|
|
5514
|
+
* @param {Object} `options`
|
|
5515
|
+
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
5516
|
+
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
|
5517
|
+
* @return {RegExp}
|
|
5518
|
+
* @api public
|
|
5519
|
+
*/
|
|
5520
|
+
picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
5521
|
+
if (returnOutput === true) {
|
|
5522
|
+
return state.output;
|
|
5523
|
+
}
|
|
5524
|
+
const opts = options || {};
|
|
5525
|
+
const prepend = opts.contains ? "" : "^";
|
|
5526
|
+
const append = opts.contains ? "" : "$";
|
|
5527
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
5528
|
+
if (state && state.negated === true) {
|
|
5529
|
+
source = `^(?!${source}).*$`;
|
|
5530
|
+
}
|
|
5531
|
+
const regex = picomatch$2.toRegex(source, options);
|
|
5532
|
+
if (returnState === true) {
|
|
5533
|
+
regex.state = state;
|
|
5534
|
+
}
|
|
5535
|
+
return regex;
|
|
5536
|
+
};
|
|
5537
|
+
/**
|
|
5538
|
+
* Create a regular expression from a parsed glob pattern.
|
|
5539
|
+
*
|
|
5540
|
+
* ```js
|
|
5541
|
+
* const picomatch = require('picomatch');
|
|
5542
|
+
* const state = picomatch.parse('*.js');
|
|
5543
|
+
* // picomatch.compileRe(state[, options]);
|
|
5544
|
+
*
|
|
5545
|
+
* console.log(picomatch.compileRe(state));
|
|
5546
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
5547
|
+
* ```
|
|
5548
|
+
* @param {String} `state` The object returned from the `.parse` method.
|
|
5549
|
+
* @param {Object} `options`
|
|
5550
|
+
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
|
5551
|
+
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
|
5552
|
+
* @return {RegExp} Returns a regex created from the given pattern.
|
|
5553
|
+
* @api public
|
|
5554
|
+
*/
|
|
5555
|
+
picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
5556
|
+
if (!input || typeof input !== "string") {
|
|
5557
|
+
throw new TypeError("Expected a non-empty string");
|
|
5558
|
+
}
|
|
5559
|
+
let parsed = {
|
|
5560
|
+
negated: false,
|
|
5561
|
+
fastpaths: true
|
|
5562
|
+
};
|
|
5563
|
+
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
5564
|
+
parsed.output = parse.fastpaths(input, options);
|
|
5565
|
+
}
|
|
5566
|
+
if (!parsed.output) {
|
|
5567
|
+
parsed = parse(input, options);
|
|
5568
|
+
}
|
|
5569
|
+
return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
|
|
5570
|
+
};
|
|
5571
|
+
/**
|
|
5572
|
+
* Create a regular expression from the given regex source string.
|
|
5573
|
+
*
|
|
5574
|
+
* ```js
|
|
5575
|
+
* const picomatch = require('picomatch');
|
|
5576
|
+
* // picomatch.toRegex(source[, options]);
|
|
5577
|
+
*
|
|
5578
|
+
* const { output } = picomatch.parse('*.js');
|
|
5579
|
+
* console.log(picomatch.toRegex(output));
|
|
5580
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
5581
|
+
* ```
|
|
5582
|
+
* @param {String} `source` Regular expression source string.
|
|
5583
|
+
* @param {Object} `options`
|
|
5584
|
+
* @return {RegExp}
|
|
5585
|
+
* @api public
|
|
5586
|
+
*/
|
|
5587
|
+
picomatch$2.toRegex = (source, options) => {
|
|
5588
|
+
try {
|
|
5589
|
+
const opts = options || {};
|
|
5590
|
+
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
5591
|
+
} catch (err$1) {
|
|
5592
|
+
if (options && options.debug === true) throw err$1;
|
|
5593
|
+
return /$^/;
|
|
5594
|
+
}
|
|
5595
|
+
};
|
|
5596
|
+
/**
|
|
5597
|
+
* Picomatch constants.
|
|
5598
|
+
* @return {Object}
|
|
5599
|
+
*/
|
|
5600
|
+
picomatch$2.constants = constants;
|
|
5601
|
+
/**
|
|
5602
|
+
* Expose "picomatch"
|
|
5603
|
+
*/
|
|
5604
|
+
module.exports = picomatch$2;
|
|
5605
|
+
}));
|
|
5606
|
+
|
|
5607
|
+
//#endregion
|
|
5608
|
+
//#region node_modules/picomatch/index.js
|
|
5609
|
+
var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5610
|
+
const pico = require_picomatch$1();
|
|
5611
|
+
const utils = require_utils();
|
|
5612
|
+
function picomatch$1(glob, options, returnState = false) {
|
|
5613
|
+
if (options && (options.windows === null || options.windows === undefined)) {
|
|
5614
|
+
options = {
|
|
5615
|
+
...options,
|
|
5616
|
+
windows: utils.isWindows()
|
|
5617
|
+
};
|
|
5618
|
+
}
|
|
5619
|
+
return pico(glob, options, returnState);
|
|
5620
|
+
}
|
|
5621
|
+
Object.assign(picomatch$1, pico);
|
|
5622
|
+
module.exports = picomatch$1;
|
|
5623
|
+
}));
|
|
5624
|
+
|
|
3742
5625
|
//#endregion
|
|
3743
5626
|
//#region packages/builder/src/utils/glob.ts
|
|
3744
5627
|
/**
|
|
@@ -3763,6 +5646,7 @@ const scanGlob = (patterns, cwd = process.cwd()) => {
|
|
|
3763
5646
|
|
|
3764
5647
|
//#endregion
|
|
3765
5648
|
//#region packages/builder/src/discovery/entry-paths.ts
|
|
5649
|
+
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
3766
5650
|
/**
|
|
3767
5651
|
* Resolve entry file paths from glob patterns or direct paths.
|
|
3768
5652
|
* Used by the discovery system to find entry points for module traversal.
|
|
@@ -3770,8 +5654,9 @@ const scanGlob = (patterns, cwd = process.cwd()) => {
|
|
|
3770
5654
|
* Uses Node.js normalize() + backslash replacement to match normalizePath from @soda-gql/common.
|
|
3771
5655
|
*
|
|
3772
5656
|
* @param entries - Include patterns (glob or direct paths). Supports negation patterns (e.g., "!./path/to/exclude.ts")
|
|
5657
|
+
* @param exclude - Exclude patterns from config.exclude. Converted to negation globs for filtering.
|
|
3773
5658
|
*/
|
|
3774
|
-
const resolveEntryPaths = (entries) => {
|
|
5659
|
+
const resolveEntryPaths = (entries, exclude = []) => {
|
|
3775
5660
|
const directPaths = [];
|
|
3776
5661
|
const globPatterns = [];
|
|
3777
5662
|
for (const entry of entries) {
|
|
@@ -3786,6 +5671,19 @@ const resolveEntryPaths = (entries) => {
|
|
|
3786
5671
|
globPatterns.push(entry);
|
|
3787
5672
|
}
|
|
3788
5673
|
}
|
|
5674
|
+
if (exclude.length > 0 && directPaths.length > 0) {
|
|
5675
|
+
const excludePatterns = exclude.map((p) => {
|
|
5676
|
+
const raw = p.startsWith("!") ? p.slice(1) : p;
|
|
5677
|
+
return normalize(resolve(raw)).replace(/\\/g, "/");
|
|
5678
|
+
});
|
|
5679
|
+
const isExcluded = (0, import_picomatch.default)(excludePatterns);
|
|
5680
|
+
const filtered = directPaths.filter((p) => !isExcluded(p));
|
|
5681
|
+
directPaths.length = 0;
|
|
5682
|
+
directPaths.push(...filtered);
|
|
5683
|
+
}
|
|
5684
|
+
for (const pattern of exclude) {
|
|
5685
|
+
globPatterns.push(pattern.startsWith("!") ? pattern : `!${pattern}`);
|
|
5686
|
+
}
|
|
3789
5687
|
const globMatches = globPatterns.length > 0 ? scanGlob(globPatterns, process.cwd()).map((match) => {
|
|
3790
5688
|
return normalize(resolve(match)).replace(/\\/g, "/");
|
|
3791
5689
|
}) : [];
|
|
@@ -3812,7 +5710,7 @@ const resolveEntryPaths = (entries) => {
|
|
|
3812
5710
|
const createFileTracker = () => {
|
|
3813
5711
|
let currentScan = { files: new Map() };
|
|
3814
5712
|
let nextScan = null;
|
|
3815
|
-
const scan = (extraPaths) => {
|
|
5713
|
+
const scan$2 = (extraPaths) => {
|
|
3816
5714
|
const allPathsToScan = new Set([...extraPaths, ...currentScan.files.keys()]);
|
|
3817
5715
|
const files = new Map();
|
|
3818
5716
|
for (const path of allPathsToScan) {
|
|
@@ -3853,12 +5751,12 @@ const createFileTracker = () => {
|
|
|
3853
5751
|
removed
|
|
3854
5752
|
};
|
|
3855
5753
|
};
|
|
3856
|
-
const update = (scan$
|
|
3857
|
-
currentScan = scan$
|
|
5754
|
+
const update = (scan$3) => {
|
|
5755
|
+
currentScan = scan$3;
|
|
3858
5756
|
nextScan = null;
|
|
3859
5757
|
};
|
|
3860
5758
|
return {
|
|
3861
|
-
scan,
|
|
5759
|
+
scan: scan$2,
|
|
3862
5760
|
detectChanges,
|
|
3863
5761
|
update
|
|
3864
5762
|
};
|
|
@@ -4062,7 +5960,7 @@ const createBuilderSession = (options) => {
|
|
|
4062
5960
|
* Returns either a skip result or the input for buildGen.
|
|
4063
5961
|
*/
|
|
4064
5962
|
const prepareBuildInput = (force) => {
|
|
4065
|
-
const entryPathsResult = resolveEntryPaths(Array.from(entrypoints));
|
|
5963
|
+
const entryPathsResult = resolveEntryPaths(Array.from(entrypoints), config.exclude);
|
|
4066
5964
|
if (entryPathsResult.isErr()) {
|
|
4067
5965
|
return err(entryPathsResult.error);
|
|
4068
5966
|
}
|
|
@@ -4341,4 +6239,4 @@ const createBuilderService = ({ config, entrypointsOverride }) => {
|
|
|
4341
6239
|
|
|
4342
6240
|
//#endregion
|
|
4343
6241
|
export { getSeverity as _, createGraphqlSystemIdentifyHelper as a, BuilderArtifactSchema as b, BuilderEffects as c, formatBuilderErrorForCLI as d, formatBuilderErrorStructured as f, diagnosticMessages as g, createStandardDiagnostic as h, extractModuleAdjacency as i, FileReadEffect as l, createDiagnostic as m, createBuilderSession as n, __clearGqlCache as o, builderErrors as p, collectAffectedFiles as r, executeSandbox as s, createBuilderService as t, FileStatEffect as u, loadArtifact as v, loadArtifactSync as y };
|
|
4344
|
-
//# sourceMappingURL=service-
|
|
6242
|
+
//# sourceMappingURL=service-CqUHXFUE.mjs.map
|