nitro-nightly 3.0.1-20260106-182834-5019d347 → 3.0.1-20260106-205209-b085a480
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/_build/common.mjs +24899 -0
- package/dist/_build/rolldown.mjs +5 -18
- package/dist/_build/rollup.mjs +5 -52
- package/dist/_build/vite.build.mjs +2 -21
- package/dist/{_dev.mjs → _chunks/dev.mjs} +4 -7
- package/dist/{_nitro.mjs → _chunks/nitro.mjs} +16 -195
- package/dist/_chunks/nitro2.mjs +101 -0
- package/dist/_chunks/utils.mjs +278 -0
- package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +32 -4
- package/dist/_libs/@jridgewell/gen-mapping.mjs +304 -2
- package/dist/_libs/@jridgewell/remapping.mjs +1 -2
- package/dist/_libs/@rollup/plugin-commonjs.mjs +75 -31
- package/dist/_libs/@rollup/plugin-inject.mjs +1 -3
- package/dist/_libs/@rollup/plugin-json.mjs +1 -1
- package/dist/_libs/@rollup/plugin-node-resolve.mjs +1111 -7
- package/dist/_libs/c12.mjs +597 -41
- package/dist/_libs/chokidar.mjs +235 -2
- package/dist/_libs/confbox.mjs +454 -1476
- package/dist/_libs/estree-walker.mjs +1 -144
- package/dist/_libs/giget.mjs +2235 -1377
- package/dist/_libs/httpxy.mjs +1 -1
- package/dist/_libs/unimport.mjs +1547 -1772
- package/dist/_presets.mjs +3 -9
- package/dist/builder.mjs +7 -12
- package/dist/cli/_chunks/build.mjs +1 -1
- package/dist/cli/_chunks/dev.mjs +3 -5
- package/dist/cli/_chunks/list.mjs +1 -1
- package/dist/cli/_chunks/prepare.mjs +1 -1
- package/dist/cli/_chunks/run.mjs +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/vite.mjs +14 -1128
- package/package.json +2 -2
- package/dist/_build/shared.mjs +0 -60
- package/dist/_build/shared2.mjs +0 -40
- package/dist/_build/shared3.mjs +0 -68
- package/dist/_libs/@jridgewell/resolve-uri.mjs +0 -166
- package/dist/_libs/@jridgewell/sourcemap-codec.mjs +0 -167
- package/dist/_libs/@jridgewell/trace-mapping.mjs +0 -141
- package/dist/_libs/@rolldown/pluginutils.mjs +0 -31
- package/dist/_libs/@rollup/plugin-replace.mjs +0 -104
- package/dist/_libs/@rollup/pluginutils.mjs +0 -241
- package/dist/_libs/acorn.mjs +0 -5034
- package/dist/_libs/commondir.mjs +0 -22
- package/dist/_libs/deepmerge.mjs +0 -86
- package/dist/_libs/dot-prop.mjs +0 -138
- package/dist/_libs/dotenv.mjs +0 -345
- package/dist/_libs/duplexer.mjs +0 -71
- package/dist/_libs/etag.mjs +0 -80
- package/dist/_libs/exsolve.mjs +0 -1007
- package/dist/_libs/fdir.mjs +0 -514
- package/dist/_libs/function-bind.mjs +0 -63
- package/dist/_libs/gzip-size.mjs +0 -21
- package/dist/_libs/hasown.mjs +0 -14
- package/dist/_libs/is-core-module.mjs +0 -220
- package/dist/_libs/is-module.mjs +0 -13
- package/dist/_libs/is-reference.mjs +0 -33
- package/dist/_libs/js-tokens.mjs +0 -382
- package/dist/_libs/knitwork.mjs +0 -124
- package/dist/_libs/local-pkg.mjs +0 -125
- package/dist/_libs/magic-string.mjs +0 -939
- package/dist/_libs/mime.mjs +0 -1391
- package/dist/_libs/mlly.mjs +0 -1415
- package/dist/_libs/node-fetch-native.mjs +0 -7
- package/dist/_libs/nypm.mjs +0 -239
- package/dist/_libs/path-parse.mjs +0 -47
- package/dist/_libs/pathe.mjs +0 -202
- package/dist/_libs/perfect-debounce.mjs +0 -89
- package/dist/_libs/picomatch.mjs +0 -1673
- package/dist/_libs/pkg-types.mjs +0 -197
- package/dist/_libs/pretty-bytes.mjs +0 -116
- package/dist/_libs/quansync.mjs +0 -90
- package/dist/_libs/rc9.mjs +0 -136
- package/dist/_libs/readdirp.mjs +0 -237
- package/dist/_libs/resolve.mjs +0 -689
- package/dist/_libs/std-env.mjs +0 -158
- package/dist/_libs/strip-literal.mjs +0 -51
- package/dist/_libs/tinyexec.mjs +0 -627
- package/dist/_libs/tinyglobby.mjs +0 -292
- package/dist/_libs/unplugin-utils.mjs +0 -61
- package/dist/_libs/unplugin.mjs +0 -1225
- package/dist/_libs/untyped.mjs +0 -271
- package/dist/_libs/unwasm.mjs +0 -5895
- package/dist/_libs/webpack-virtual-modules.mjs +0 -272
- package/dist/_nitro2.mjs +0 -303
- /package/dist/{_rolldown.mjs → _common.mjs} +0 -0
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
import { i as __toESM } from "../_rolldown.mjs";
|
|
2
|
-
import { t as Builder } from "./fdir.mjs";
|
|
3
|
-
import { t as require_picomatch } from "./picomatch.mjs";
|
|
4
|
-
import nativeFs from "fs";
|
|
5
|
-
import path, { posix } from "path";
|
|
6
|
-
import { fileURLToPath } from "url";
|
|
7
|
-
|
|
8
|
-
//#region node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs
|
|
9
|
-
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
10
|
-
const isReadonlyArray = Array.isArray;
|
|
11
|
-
const isWin = process.platform === "win32";
|
|
12
|
-
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
13
|
-
function getPartialMatcher(patterns, options = {}) {
|
|
14
|
-
const patternsCount = patterns.length;
|
|
15
|
-
const patternsParts = Array(patternsCount);
|
|
16
|
-
const matchers = Array(patternsCount);
|
|
17
|
-
const globstarEnabled = !options.noglobstar;
|
|
18
|
-
for (let i = 0; i < patternsCount; i++) {
|
|
19
|
-
const parts = splitPattern(patterns[i]);
|
|
20
|
-
patternsParts[i] = parts;
|
|
21
|
-
const partsCount = parts.length;
|
|
22
|
-
const partMatchers = Array(partsCount);
|
|
23
|
-
for (let j = 0; j < partsCount; j++) partMatchers[j] = (0, import_picomatch.default)(parts[j], options);
|
|
24
|
-
matchers[i] = partMatchers;
|
|
25
|
-
}
|
|
26
|
-
return (input) => {
|
|
27
|
-
const inputParts = input.split("/");
|
|
28
|
-
if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
|
|
29
|
-
for (let i = 0; i < patterns.length; i++) {
|
|
30
|
-
const patternParts = patternsParts[i];
|
|
31
|
-
const matcher = matchers[i];
|
|
32
|
-
const inputPatternCount = inputParts.length;
|
|
33
|
-
const minParts = Math.min(inputPatternCount, patternParts.length);
|
|
34
|
-
let j = 0;
|
|
35
|
-
while (j < minParts) {
|
|
36
|
-
const part = patternParts[j];
|
|
37
|
-
if (part.includes("/")) return true;
|
|
38
|
-
if (!matcher[j](inputParts[j])) break;
|
|
39
|
-
if (globstarEnabled && part === "**") return true;
|
|
40
|
-
j++;
|
|
41
|
-
}
|
|
42
|
-
if (j === inputPatternCount) return true;
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
/* node:coverage ignore next 2 */
|
|
48
|
-
const WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
|
|
49
|
-
const isRoot = isWin ? (p) => WIN32_ROOT_DIR.test(p) : (p) => p === "/";
|
|
50
|
-
function buildFormat(cwd, root, absolute) {
|
|
51
|
-
if (cwd === root || root.startsWith(`${cwd}/`)) {
|
|
52
|
-
if (absolute) {
|
|
53
|
-
const start = isRoot(cwd) ? cwd.length : cwd.length + 1;
|
|
54
|
-
return (p, isDir) => p.slice(start, isDir ? -1 : void 0) || ".";
|
|
55
|
-
}
|
|
56
|
-
const prefix = root.slice(cwd.length + 1);
|
|
57
|
-
if (prefix) return (p, isDir) => {
|
|
58
|
-
if (p === ".") return prefix;
|
|
59
|
-
const result = `${prefix}/${p}`;
|
|
60
|
-
return isDir ? result.slice(0, -1) : result;
|
|
61
|
-
};
|
|
62
|
-
return (p, isDir) => isDir && p !== "." ? p.slice(0, -1) : p;
|
|
63
|
-
}
|
|
64
|
-
if (absolute) return (p) => posix.relative(cwd, p) || ".";
|
|
65
|
-
return (p) => posix.relative(cwd, `${root}/${p}`) || ".";
|
|
66
|
-
}
|
|
67
|
-
function buildRelative(cwd, root) {
|
|
68
|
-
if (root.startsWith(`${cwd}/`)) {
|
|
69
|
-
const prefix = root.slice(cwd.length + 1);
|
|
70
|
-
return (p) => `${prefix}/${p}`;
|
|
71
|
-
}
|
|
72
|
-
return (p) => {
|
|
73
|
-
const result = posix.relative(cwd, `${root}/${p}`);
|
|
74
|
-
if (p.endsWith("/") && result !== "") return `${result}/`;
|
|
75
|
-
return result || ".";
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
const splitPatternOptions = { parts: true };
|
|
79
|
-
function splitPattern(path$1) {
|
|
80
|
-
var _result$parts;
|
|
81
|
-
const result = import_picomatch.default.scan(path$1, splitPatternOptions);
|
|
82
|
-
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
|
|
83
|
-
}
|
|
84
|
-
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
85
|
-
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
86
|
-
const escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
87
|
-
const escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
88
|
-
/**
|
|
89
|
-
* Escapes a path's special characters depending on the platform.
|
|
90
|
-
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
91
|
-
*/
|
|
92
|
-
/* node:coverage ignore next */
|
|
93
|
-
const escapePath = isWin ? escapeWin32Path : escapePosixPath;
|
|
94
|
-
/**
|
|
95
|
-
* Checks if a pattern has dynamic parts.
|
|
96
|
-
*
|
|
97
|
-
* Has a few minor differences with [`fast-glob`](https://github.com/mrmlnc/fast-glob) for better accuracy:
|
|
98
|
-
*
|
|
99
|
-
* - Doesn't necessarily return `false` on patterns that include `\`.
|
|
100
|
-
* - Returns `true` if the pattern includes parentheses, regardless of them representing one single pattern or not.
|
|
101
|
-
* - Returns `true` for unfinished glob extensions i.e. `(h`, `+(h`.
|
|
102
|
-
* - Returns `true` for unfinished brace expansions as long as they include `,` or `..`.
|
|
103
|
-
*
|
|
104
|
-
* @see {@link https://superchupu.dev/tinyglobby/documentation#isDynamicPattern}
|
|
105
|
-
*/
|
|
106
|
-
function isDynamicPattern(pattern, options) {
|
|
107
|
-
if ((options === null || options === void 0 ? void 0 : options.caseSensitiveMatch) === false) return true;
|
|
108
|
-
const scan = import_picomatch.default.scan(pattern);
|
|
109
|
-
return scan.isGlob || scan.negated;
|
|
110
|
-
}
|
|
111
|
-
function log(...tasks) {
|
|
112
|
-
console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
|
|
113
|
-
}
|
|
114
|
-
const PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
|
115
|
-
const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
116
|
-
const BACKSLASHES = /\\/g;
|
|
117
|
-
function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
118
|
-
let result = pattern;
|
|
119
|
-
if (pattern.endsWith("/")) result = pattern.slice(0, -1);
|
|
120
|
-
if (!result.endsWith("*") && expandDirectories) result += "/**";
|
|
121
|
-
const escapedCwd = escapePath(cwd);
|
|
122
|
-
if (path.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapedCwd, result);
|
|
123
|
-
else result = posix.normalize(result);
|
|
124
|
-
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
|
125
|
-
const parts = splitPattern(result);
|
|
126
|
-
if (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {
|
|
127
|
-
const n = (parentDirectoryMatch[0].length + 1) / 3;
|
|
128
|
-
let i = 0;
|
|
129
|
-
const cwdParts = escapedCwd.split("/");
|
|
130
|
-
while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
|
|
131
|
-
result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
|
|
132
|
-
i++;
|
|
133
|
-
}
|
|
134
|
-
const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i * 3));
|
|
135
|
-
if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
|
|
136
|
-
props.root = potentialRoot;
|
|
137
|
-
props.depthOffset = -n + i;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
if (!isIgnore && props.depthOffset >= 0) {
|
|
141
|
-
var _props$commonPath;
|
|
142
|
-
(_props$commonPath = props.commonPath) !== null && _props$commonPath !== void 0 || (props.commonPath = parts);
|
|
143
|
-
const newCommonPath = [];
|
|
144
|
-
const length = Math.min(props.commonPath.length, parts.length);
|
|
145
|
-
for (let i = 0; i < length; i++) {
|
|
146
|
-
const part = parts[i];
|
|
147
|
-
if (part === "**" && !parts[i + 1]) {
|
|
148
|
-
newCommonPath.pop();
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
|
|
152
|
-
newCommonPath.push(part);
|
|
153
|
-
}
|
|
154
|
-
props.depthOffset = newCommonPath.length;
|
|
155
|
-
props.commonPath = newCommonPath;
|
|
156
|
-
props.root = newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd;
|
|
157
|
-
}
|
|
158
|
-
return result;
|
|
159
|
-
}
|
|
160
|
-
function processPatterns({ patterns = ["**/*"], ignore = [], expandDirectories = true }, cwd, props) {
|
|
161
|
-
if (typeof patterns === "string") patterns = [patterns];
|
|
162
|
-
if (typeof ignore === "string") ignore = [ignore];
|
|
163
|
-
const matchPatterns = [];
|
|
164
|
-
const ignorePatterns = [];
|
|
165
|
-
for (const pattern of ignore) {
|
|
166
|
-
if (!pattern) continue;
|
|
167
|
-
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
|
|
168
|
-
}
|
|
169
|
-
for (const pattern of patterns) {
|
|
170
|
-
if (!pattern) continue;
|
|
171
|
-
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
|
|
172
|
-
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
|
|
173
|
-
}
|
|
174
|
-
return {
|
|
175
|
-
match: matchPatterns,
|
|
176
|
-
ignore: ignorePatterns
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
function formatPaths(paths, relative$1) {
|
|
180
|
-
for (let i = paths.length - 1; i >= 0; i--) {
|
|
181
|
-
const path$1 = paths[i];
|
|
182
|
-
paths[i] = relative$1(path$1);
|
|
183
|
-
}
|
|
184
|
-
return paths;
|
|
185
|
-
}
|
|
186
|
-
function normalizeCwd(cwd) {
|
|
187
|
-
if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
|
|
188
|
-
if (cwd instanceof URL) return fileURLToPath(cwd).replace(BACKSLASHES, "/");
|
|
189
|
-
return path.resolve(cwd).replace(BACKSLASHES, "/");
|
|
190
|
-
}
|
|
191
|
-
function getCrawler(patterns, inputOptions = {}) {
|
|
192
|
-
const options = process.env.TINYGLOBBY_DEBUG ? {
|
|
193
|
-
...inputOptions,
|
|
194
|
-
debug: true
|
|
195
|
-
} : inputOptions;
|
|
196
|
-
const cwd = normalizeCwd(options.cwd);
|
|
197
|
-
if (options.debug) log("globbing with:", {
|
|
198
|
-
patterns,
|
|
199
|
-
options,
|
|
200
|
-
cwd
|
|
201
|
-
});
|
|
202
|
-
if (Array.isArray(patterns) && patterns.length === 0) return [{
|
|
203
|
-
sync: () => [],
|
|
204
|
-
withPromise: async () => []
|
|
205
|
-
}, false];
|
|
206
|
-
const props = {
|
|
207
|
-
root: cwd,
|
|
208
|
-
commonPath: null,
|
|
209
|
-
depthOffset: 0
|
|
210
|
-
};
|
|
211
|
-
const processed = processPatterns({
|
|
212
|
-
...options,
|
|
213
|
-
patterns
|
|
214
|
-
}, cwd, props);
|
|
215
|
-
if (options.debug) log("internal processing patterns:", processed);
|
|
216
|
-
const matchOptions = {
|
|
217
|
-
dot: options.dot,
|
|
218
|
-
nobrace: options.braceExpansion === false,
|
|
219
|
-
nocase: options.caseSensitiveMatch === false,
|
|
220
|
-
noextglob: options.extglob === false,
|
|
221
|
-
noglobstar: options.globstar === false,
|
|
222
|
-
posix: true
|
|
223
|
-
};
|
|
224
|
-
const matcher = (0, import_picomatch.default)(processed.match, {
|
|
225
|
-
...matchOptions,
|
|
226
|
-
ignore: processed.ignore
|
|
227
|
-
});
|
|
228
|
-
const ignore = (0, import_picomatch.default)(processed.ignore, matchOptions);
|
|
229
|
-
const partialMatcher = getPartialMatcher(processed.match, matchOptions);
|
|
230
|
-
const format = buildFormat(cwd, props.root, options.absolute);
|
|
231
|
-
const formatExclude = options.absolute ? format : buildFormat(cwd, props.root, true);
|
|
232
|
-
const fdirOptions = {
|
|
233
|
-
filters: [options.debug ? (p, isDirectory) => {
|
|
234
|
-
const path$1 = format(p, isDirectory);
|
|
235
|
-
const matches = matcher(path$1);
|
|
236
|
-
if (matches) log(`matched ${path$1}`);
|
|
237
|
-
return matches;
|
|
238
|
-
} : (p, isDirectory) => matcher(format(p, isDirectory))],
|
|
239
|
-
exclude: options.debug ? (_, p) => {
|
|
240
|
-
const relativePath = formatExclude(p, true);
|
|
241
|
-
const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
242
|
-
if (skipped) log(`skipped ${p}`);
|
|
243
|
-
else log(`crawling ${p}`);
|
|
244
|
-
return skipped;
|
|
245
|
-
} : (_, p) => {
|
|
246
|
-
const relativePath = formatExclude(p, true);
|
|
247
|
-
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
248
|
-
},
|
|
249
|
-
fs: options.fs ? {
|
|
250
|
-
readdir: options.fs.readdir || nativeFs.readdir,
|
|
251
|
-
readdirSync: options.fs.readdirSync || nativeFs.readdirSync,
|
|
252
|
-
realpath: options.fs.realpath || nativeFs.realpath,
|
|
253
|
-
realpathSync: options.fs.realpathSync || nativeFs.realpathSync,
|
|
254
|
-
stat: options.fs.stat || nativeFs.stat,
|
|
255
|
-
statSync: options.fs.statSync || nativeFs.statSync
|
|
256
|
-
} : void 0,
|
|
257
|
-
pathSeparator: "/",
|
|
258
|
-
relativePaths: true,
|
|
259
|
-
resolveSymlinks: true,
|
|
260
|
-
signal: options.signal
|
|
261
|
-
};
|
|
262
|
-
if (options.deep !== void 0) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
|
|
263
|
-
if (options.absolute) {
|
|
264
|
-
fdirOptions.relativePaths = false;
|
|
265
|
-
fdirOptions.resolvePaths = true;
|
|
266
|
-
fdirOptions.includeBasePath = true;
|
|
267
|
-
}
|
|
268
|
-
if (options.followSymbolicLinks === false) {
|
|
269
|
-
fdirOptions.resolveSymlinks = false;
|
|
270
|
-
fdirOptions.excludeSymlinks = true;
|
|
271
|
-
}
|
|
272
|
-
if (options.onlyDirectories) {
|
|
273
|
-
fdirOptions.excludeFiles = true;
|
|
274
|
-
fdirOptions.includeDirs = true;
|
|
275
|
-
} else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
|
|
276
|
-
props.root = props.root.replace(BACKSLASHES, "");
|
|
277
|
-
const root = props.root;
|
|
278
|
-
if (options.debug) log("internal properties:", props);
|
|
279
|
-
const relative$1 = cwd !== root && !options.absolute && buildRelative(cwd, props.root);
|
|
280
|
-
return [new Builder(fdirOptions).crawl(root), relative$1];
|
|
281
|
-
}
|
|
282
|
-
async function glob(patternsOrOptions, options) {
|
|
283
|
-
if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
284
|
-
const isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === "string";
|
|
285
|
-
const opts = isModern ? options : patternsOrOptions;
|
|
286
|
-
const [crawler, relative$1] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
|
|
287
|
-
if (!relative$1) return crawler.withPromise();
|
|
288
|
-
return formatPaths(await crawler.withPromise(), relative$1);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
//#endregion
|
|
292
|
-
export { glob as t };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { i as __toESM } from "../_rolldown.mjs";
|
|
2
|
-
import { a as isAbsolute, o as join, u as resolve } from "./pathe.mjs";
|
|
3
|
-
import { t as require_picomatch } from "./picomatch.mjs";
|
|
4
|
-
|
|
5
|
-
//#region node_modules/.pnpm/unplugin-utils@0.3.1/node_modules/unplugin-utils/dist/index.js
|
|
6
|
-
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
7
|
-
/**
|
|
8
|
-
* Converts path separators to forward slash.
|
|
9
|
-
*/
|
|
10
|
-
function normalizePath(filename) {
|
|
11
|
-
return filename.replaceAll("\\", "/");
|
|
12
|
-
}
|
|
13
|
-
const isArray = Array.isArray;
|
|
14
|
-
function toArray(thing) {
|
|
15
|
-
if (isArray(thing)) return thing;
|
|
16
|
-
if (thing == null) return [];
|
|
17
|
-
return [thing];
|
|
18
|
-
}
|
|
19
|
-
const escapeMark = "[_#EsCaPe#_]";
|
|
20
|
-
function getMatcherString(id, resolutionBase) {
|
|
21
|
-
if (resolutionBase === false || isAbsolute(id) || id.startsWith("**")) return normalizePath(id);
|
|
22
|
-
return join(normalizePath(resolve(resolutionBase || "")).replaceAll(/[-^$*+?.()|[\]{}]/g, `${escapeMark}$&`), normalizePath(id)).replaceAll(escapeMark, "\\");
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Constructs a filter function which can be used to determine whether or not
|
|
26
|
-
* certain modules should be operated upon.
|
|
27
|
-
* @param include If `include` is omitted or has zero length, filter will return `true` by default.
|
|
28
|
-
* @param exclude ID must not match any of the `exclude` patterns.
|
|
29
|
-
* @param options Additional options.
|
|
30
|
-
* @param options.resolve Optionally resolves the patterns against a directory other than `process.cwd()`.
|
|
31
|
-
* If a `string` is specified, then the value will be used as the base directory.
|
|
32
|
-
* Relative paths will be resolved against `process.cwd()` first.
|
|
33
|
-
* If `false`, then the patterns will not be resolved against any directory.
|
|
34
|
-
* This can be useful if you want to create a filter for virtual module names.
|
|
35
|
-
*/
|
|
36
|
-
function createFilter(include, exclude, options) {
|
|
37
|
-
const resolutionBase = options && options.resolve;
|
|
38
|
-
const getMatcher = (id) => id instanceof RegExp ? id : { test: (what) => {
|
|
39
|
-
return (0, import_picomatch.default)(getMatcherString(id, resolutionBase), { dot: true })(what);
|
|
40
|
-
} };
|
|
41
|
-
const includeMatchers = toArray(include).map(getMatcher);
|
|
42
|
-
const excludeMatchers = toArray(exclude).map(getMatcher);
|
|
43
|
-
if (!includeMatchers.length && !excludeMatchers.length) return (id) => typeof id === "string" && !id.includes("\0");
|
|
44
|
-
return function result(id) {
|
|
45
|
-
if (typeof id !== "string") return false;
|
|
46
|
-
if (id.includes("\0")) return false;
|
|
47
|
-
const pathId = normalizePath(id);
|
|
48
|
-
for (const matcher of excludeMatchers) {
|
|
49
|
-
if (matcher instanceof RegExp) matcher.lastIndex = 0;
|
|
50
|
-
if (matcher.test(pathId)) return false;
|
|
51
|
-
}
|
|
52
|
-
for (const matcher of includeMatchers) {
|
|
53
|
-
if (matcher instanceof RegExp) matcher.lastIndex = 0;
|
|
54
|
-
if (matcher.test(pathId)) return true;
|
|
55
|
-
}
|
|
56
|
-
return !includeMatchers.length;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
//#endregion
|
|
61
|
-
export { createFilter as t };
|