nitro-nightly 4.0.0-20251010-091516-7cafddba → 4.0.0-20251030-091344-d4418b98
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/{_chunks/build2.mjs → _build/build.mjs} +108 -58
- package/dist/_build/build2.mjs +556 -0
- package/dist/_build/info.mjs +1002 -0
- package/dist/_build/prepare.mjs +1511 -0
- package/dist/_build/snapshot.mjs +185 -0
- package/dist/{_chunks/plugin.mjs → _build/vite.mjs} +295 -296
- package/dist/_build/vite2.mjs +149 -0
- package/dist/_chunks/_deps/@jridgewell/gen-mapping.mjs +189 -0
- package/dist/_chunks/_deps/@jridgewell/remapping.mjs +137 -0
- package/dist/_chunks/_deps/@jridgewell/resolve-uri.mjs +231 -0
- package/dist/_chunks/_deps/@jridgewell/sourcemap-codec.mjs +173 -0
- package/dist/_chunks/_deps/@jridgewell/trace-mapping.mjs +170 -0
- package/dist/_chunks/_deps/@pi0/vite-plugin-fullstack.mjs +575 -0
- package/dist/_chunks/_deps/@rollup/plugin-alias.mjs +89 -0
- package/dist/_chunks/_deps/@rollup/plugin-commonjs.mjs +2376 -0
- package/dist/_chunks/{index2.mjs → _deps/@rollup/plugin-inject.mjs} +5 -90
- package/dist/_chunks/_deps/@rollup/plugin-json.mjs +37 -0
- package/dist/_chunks/_deps/@rollup/plugin-node-resolve.mjs +1386 -0
- package/dist/_chunks/_deps/@rollup/plugin-replace.mjs +133 -0
- package/dist/_chunks/_deps/@rollup/pluginutils.mjs +346 -0
- package/dist/_chunks/_deps/acorn.mjs +6225 -0
- package/dist/_chunks/_deps/c12.mjs +510 -0
- package/dist/_chunks/_deps/chokidar.mjs +1428 -0
- package/dist/_chunks/_deps/citty.mjs +460 -0
- package/dist/_chunks/_deps/commondir.mjs +77 -0
- package/dist/_chunks/_deps/compatx.mjs +76 -0
- package/dist/_chunks/_deps/confbox.mjs +300 -0
- package/dist/_chunks/_deps/debug.mjs +885 -0
- package/dist/_chunks/_deps/deepmerge.mjs +147 -0
- package/dist/_chunks/_deps/depd.mjs +550 -0
- package/dist/_chunks/_deps/dot-prop.mjs +282 -0
- package/dist/_chunks/_deps/dotenv.mjs +555 -0
- package/dist/_chunks/_deps/duplexer.mjs +1 -0
- package/dist/_chunks/_deps/ee-first.mjs +104 -0
- package/dist/_chunks/_deps/encodeurl.mjs +69 -0
- package/dist/_chunks/_deps/escape-html.mjs +87 -0
- package/dist/_chunks/_deps/escape-string-regexp.mjs +13 -0
- package/dist/_chunks/_deps/estree-walker.mjs +433 -0
- package/dist/_chunks/_deps/etag.mjs +147 -0
- package/dist/_chunks/_deps/exsolve.mjs +1416 -0
- package/dist/_chunks/_deps/fdir.mjs +569 -0
- package/dist/_chunks/_deps/fresh.mjs +145 -0
- package/dist/_chunks/_deps/function-bind.mjs +106 -0
- package/dist/_chunks/{index4.mjs → _deps/giget.mjs} +21 -776
- package/dist/_chunks/_deps/gzip-size.mjs +19 -0
- package/dist/_chunks/_deps/hasown.mjs +19 -0
- package/dist/_chunks/_deps/http-errors.mjs +307 -0
- package/dist/_chunks/_deps/httpxy.mjs +580 -0
- package/dist/_chunks/_deps/inherits.mjs +57 -0
- package/dist/_chunks/_deps/is-core-module.mjs +596 -0
- package/dist/_chunks/_deps/is-module.mjs +25 -0
- package/dist/_chunks/_deps/is-reference.mjs +31 -0
- package/dist/_chunks/_deps/js-tokens.mjs +411 -0
- package/dist/_chunks/_deps/klona.mjs +137 -0
- package/dist/_chunks/_deps/knitwork.mjs +172 -0
- package/dist/_chunks/_deps/local-pkg.mjs +163 -0
- package/dist/_chunks/_deps/magic-string.mjs +1296 -0
- package/dist/_chunks/_deps/mime-db.mjs +11685 -0
- package/dist/_chunks/_deps/mime-types.mjs +287 -0
- package/dist/_chunks/_deps/mime.mjs +1172 -0
- package/dist/_chunks/_deps/mlly.mjs +2413 -0
- package/dist/_chunks/_deps/ms.mjs +172 -0
- package/dist/_chunks/_deps/node-fetch-native.mjs +3 -0
- package/dist/_chunks/_deps/nypm.mjs +219 -0
- package/dist/_chunks/_deps/on-finished.mjs +246 -0
- package/dist/_chunks/_deps/parseurl.mjs +168 -0
- package/dist/_chunks/_deps/path-parse.mjs +85 -0
- package/dist/_chunks/{pathe.M-eThtNZ.mjs → _deps/pathe.mjs} +48 -1
- package/dist/_chunks/_deps/perfect-debounce.mjs +88 -0
- package/dist/_chunks/_deps/picomatch.mjs +2144 -0
- package/dist/_chunks/_deps/pkg-types.mjs +247 -0
- package/dist/_chunks/{snapshot.mjs → _deps/pretty-bytes.mjs} +1 -105
- package/dist/_chunks/_deps/quansync.mjs +99 -0
- package/dist/_chunks/_deps/range-parser.mjs +171 -0
- package/dist/_chunks/_deps/rc9.mjs +219 -0
- package/dist/_chunks/_deps/readdirp.mjs +245 -0
- package/dist/_chunks/_deps/resolve.mjs +1260 -0
- package/dist/_chunks/_deps/rou3.mjs +326 -0
- package/dist/_chunks/_deps/send.mjs +1022 -0
- package/dist/_chunks/_deps/serve-static.mjs +228 -0
- package/dist/_chunks/_deps/setprototypeof.mjs +26 -0
- package/dist/_chunks/_deps/statuses.mjs +457 -0
- package/dist/_chunks/_deps/std-env.mjs +3 -0
- package/dist/_chunks/_deps/strip-literal.mjs +67 -0
- package/dist/_chunks/_deps/supports-color.mjs +44 -0
- package/dist/_chunks/_deps/tinyexec.mjs +552 -0
- package/dist/_chunks/_deps/tinyglobby.mjs +293 -0
- package/dist/_chunks/_deps/toidentifier.mjs +41 -0
- package/dist/_chunks/_deps/ultrahtml.mjs +3 -0
- package/dist/_chunks/_deps/unimport.mjs +2267 -0
- package/dist/_chunks/_deps/unplugin-utils.mjs +65 -0
- package/dist/_chunks/_deps/unplugin.mjs +1294 -0
- package/dist/_chunks/_deps/untyped.mjs +375 -0
- package/dist/_chunks/{info.mjs → _deps/unwasm.mjs} +8 -4206
- package/dist/_chunks/_deps/webpack-virtual-modules.mjs +360 -0
- package/dist/_chunks/_presets/_all.mjs +59 -0
- package/dist/_chunks/_presets/_nitro.mjs +74 -0
- package/dist/_chunks/_presets/_resolve.mjs +64 -0
- package/dist/_chunks/_presets/_static.mjs +69 -0
- package/dist/_chunks/_presets/_types.mjs +3 -0
- package/dist/_chunks/_presets/_utils.mjs +31 -0
- package/dist/_chunks/_presets/alwaysdata.mjs +17 -0
- package/dist/_chunks/_presets/aws-amplify.mjs +111 -0
- package/dist/_chunks/_presets/aws-lambda.mjs +23 -0
- package/dist/_chunks/_presets/azure.mjs +162 -0
- package/dist/_chunks/_presets/bun.mjs +19 -0
- package/dist/_chunks/_presets/cleavr.mjs +15 -0
- package/dist/_chunks/_presets/cloudflare.mjs +608 -0
- package/dist/_chunks/_presets/deno.mjs +196 -0
- package/dist/_chunks/_presets/digitalocean.mjs +14 -0
- package/dist/_chunks/_presets/firebase.mjs +47 -0
- package/dist/_chunks/_presets/flightcontrol.mjs +14 -0
- package/dist/_chunks/_presets/genezio.mjs +13 -0
- package/dist/_chunks/_presets/heroku.mjs +14 -0
- package/dist/_chunks/_presets/iis.mjs +194 -0
- package/dist/_chunks/_presets/index.mjs +62 -0
- package/dist/_chunks/_presets/koyeb.mjs +14 -0
- package/dist/_chunks/_presets/netlify.mjs +241 -0
- package/dist/_chunks/_presets/node.mjs +54 -0
- package/dist/_chunks/_presets/platform.mjs +14 -0
- package/dist/_chunks/_presets/render.mjs +14 -0
- package/dist/_chunks/_presets/standard.mjs +23 -0
- package/dist/_chunks/_presets/stormkit.mjs +18 -0
- package/dist/_chunks/_presets/vercel.mjs +375 -0
- package/dist/_chunks/_presets/winterjs.mjs +22 -0
- package/dist/_chunks/_presets/zeabur.mjs +69 -0
- package/dist/_chunks/_presets/zerops.mjs +27 -0
- package/dist/_chunks/app.mjs +9 -19206
- package/dist/_chunks/{index3.mjs → builder.mjs} +560 -970
- package/dist/_chunks/server.mjs +6 -4
- package/dist/{cli → _cli}/build.mjs +3 -8
- package/dist/{cli → _cli}/dev.mjs +38 -12
- package/dist/{cli/index2.mjs → _cli/index.mjs} +1 -2
- package/dist/{cli → _cli}/list.mjs +3 -4
- package/dist/{cli → _cli}/prepare.mjs +3 -4
- package/dist/{cli → _cli}/run.mjs +3 -4
- package/dist/{index.d.mts → builder.d.mts} +11 -11
- package/dist/builder.mjs +117 -0
- package/dist/cli/index.mjs +7 -464
- package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
- package/dist/node_modules/@speed-highlight/core/package.json +7 -3
- package/dist/node_modules/cookie-es/dist/index.mjs +262 -0
- package/dist/node_modules/cookie-es/package.json +37 -0
- package/dist/node_modules/hookable/dist/index.mjs +243 -266
- package/dist/node_modules/hookable/package.json +29 -26
- package/dist/node_modules/rendu/dist/index.mjs +380 -0
- package/dist/node_modules/rendu/package.json +47 -0
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +4 -7
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +5 -4
- package/dist/presets/azure/runtime/azure-swa.mjs +1 -1
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +7 -6
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +4 -5
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +7 -10
- package/dist/presets/cloudflare/runtime/shims/workers.dev.d.mts +21 -0
- package/dist/presets/cloudflare/runtime/shims/workers.dev.mjs +27 -0
- package/dist/presets/node/runtime/node-server.mjs +1 -1
- package/dist/runtime/index.d.mts +1 -1
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/internal/app.d.mts +3 -1
- package/dist/runtime/internal/app.mjs +90 -64
- package/dist/runtime/internal/error/prod.d.mts +3 -2
- package/dist/runtime/internal/error/prod.mjs +9 -13
- package/dist/runtime/internal/renderer.mjs +4 -4
- package/dist/runtime/internal/routes/dev-tasks.d.mts +30 -2
- package/dist/runtime/internal/shutdown.d.mts +1 -2
- package/dist/runtime/internal/shutdown.mjs +3 -2
- package/dist/runtime/internal/task.mjs +1 -2
- package/dist/types/index.d.mts +1603 -10
- package/dist/vite.d.mts +5 -0
- package/dist/vite.mjs +94 -30
- package/lib/index.mjs +1 -0
- package/lib/indexd.mts +1 -0
- package/lib/runtime/meta.mjs +35 -0
- package/package.json +40 -41
- package/dist/_chunks/build.mjs +0 -84
- package/dist/_chunks/build3.mjs +0 -6452
- package/dist/_chunks/detect-acorn.mjs +0 -503
- package/dist/_chunks/index.mjs +0 -22242
- package/dist/_chunks/json5.mjs +0 -68
- package/dist/_chunks/jsonc.mjs +0 -51
- package/dist/_chunks/toml.mjs +0 -259
- package/dist/_chunks/yaml.mjs +0 -86
- package/dist/index.mjs +0 -55
- package/dist/node_modules/klona/dist/index.mjs +0 -81
- package/dist/node_modules/klona/full/index.mjs +0 -53
- package/dist/node_modules/klona/package.json +0 -74
- package/dist/node_modules/std-env/dist/index.mjs +0 -1
- package/dist/node_modules/std-env/package.json +0 -46
- package/dist/presets.mjs +0 -2460
- package/dist/runtime/internal/debug.d.mts +0 -2
- package/dist/runtime/internal/debug.mjs +0 -5
- package/lib/runtime-meta.mjs +0 -38
- /package/dist/{cli → _cli}/common.mjs +0 -0
- /package/lib/{runtime-meta.d.mts → runtime/meta.d.mts} +0 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import V__default from 'fs';
|
|
2
|
+
import sysPath__default, { posix } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { B as Builder } from './fdir.mjs';
|
|
5
|
+
import { p as pm } from './picomatch.mjs';
|
|
6
|
+
|
|
7
|
+
//#region src/utils.ts
|
|
8
|
+
const isReadonlyArray = Array.isArray;
|
|
9
|
+
const isWin = process.platform === "win32";
|
|
10
|
+
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
11
|
+
function getPartialMatcher(patterns, options = {}) {
|
|
12
|
+
const patternsCount = patterns.length;
|
|
13
|
+
const patternsParts = Array(patternsCount);
|
|
14
|
+
const matchers = Array(patternsCount);
|
|
15
|
+
const globstarEnabled = !options.noglobstar;
|
|
16
|
+
for (let i = 0; i < patternsCount; i++) {
|
|
17
|
+
const parts = splitPattern(patterns[i]);
|
|
18
|
+
patternsParts[i] = parts;
|
|
19
|
+
const partsCount = parts.length;
|
|
20
|
+
const partMatchers = Array(partsCount);
|
|
21
|
+
for (let j = 0; j < partsCount; j++) partMatchers[j] = pm(parts[j], options);
|
|
22
|
+
matchers[i] = partMatchers;
|
|
23
|
+
}
|
|
24
|
+
return (input) => {
|
|
25
|
+
const inputParts = input.split("/");
|
|
26
|
+
if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
|
|
27
|
+
for (let i = 0; i < patterns.length; i++) {
|
|
28
|
+
const patternParts = patternsParts[i];
|
|
29
|
+
const matcher = matchers[i];
|
|
30
|
+
const inputPatternCount = inputParts.length;
|
|
31
|
+
const minParts = Math.min(inputPatternCount, patternParts.length);
|
|
32
|
+
let j = 0;
|
|
33
|
+
while (j < minParts) {
|
|
34
|
+
const part = patternParts[j];
|
|
35
|
+
if (part.includes("/")) return true;
|
|
36
|
+
const match = matcher[j](inputParts[j]);
|
|
37
|
+
if (!match) break;
|
|
38
|
+
if (globstarEnabled && part === "**") return true;
|
|
39
|
+
j++;
|
|
40
|
+
}
|
|
41
|
+
if (j === inputPatternCount) return true;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/* node:coverage ignore next 2 */
|
|
47
|
+
const WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
|
|
48
|
+
const isRoot = isWin ? (p) => WIN32_ROOT_DIR.test(p) : (p) => p === "/";
|
|
49
|
+
function buildFormat(cwd, root, absolute) {
|
|
50
|
+
if (cwd === root || root.startsWith(`${cwd}/`)) {
|
|
51
|
+
if (absolute) {
|
|
52
|
+
const start = isRoot(cwd) ? cwd.length : cwd.length + 1;
|
|
53
|
+
return (p, isDir) => p.slice(start, isDir ? -1 : void 0) || ".";
|
|
54
|
+
}
|
|
55
|
+
const prefix = root.slice(cwd.length + 1);
|
|
56
|
+
if (prefix) return (p, isDir) => {
|
|
57
|
+
if (p === ".") return prefix;
|
|
58
|
+
const result = `${prefix}/${p}`;
|
|
59
|
+
return isDir ? result.slice(0, -1) : result;
|
|
60
|
+
};
|
|
61
|
+
return (p, isDir) => isDir && p !== "." ? p.slice(0, -1) : p;
|
|
62
|
+
}
|
|
63
|
+
if (absolute) return (p) => posix.relative(cwd, p) || ".";
|
|
64
|
+
return (p) => posix.relative(cwd, `${root}/${p}`) || ".";
|
|
65
|
+
}
|
|
66
|
+
function buildRelative(cwd, root) {
|
|
67
|
+
if (root.startsWith(`${cwd}/`)) {
|
|
68
|
+
const prefix = root.slice(cwd.length + 1);
|
|
69
|
+
return (p) => `${prefix}/${p}`;
|
|
70
|
+
}
|
|
71
|
+
return (p) => {
|
|
72
|
+
const result = posix.relative(cwd, `${root}/${p}`);
|
|
73
|
+
if (p.endsWith("/") && result !== "") return `${result}/`;
|
|
74
|
+
return result || ".";
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const splitPatternOptions = { parts: true };
|
|
78
|
+
function splitPattern(path$1) {
|
|
79
|
+
var _result$parts;
|
|
80
|
+
const result = pm.scan(path$1, splitPatternOptions);
|
|
81
|
+
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
|
|
82
|
+
}
|
|
83
|
+
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
84
|
+
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
85
|
+
const escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
86
|
+
const escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
87
|
+
/**
|
|
88
|
+
* Escapes a path's special characters depending on the platform.
|
|
89
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
90
|
+
*/
|
|
91
|
+
/* node:coverage ignore next */
|
|
92
|
+
const escapePath = isWin ? escapeWin32Path : escapePosixPath;
|
|
93
|
+
/**
|
|
94
|
+
* Checks if a pattern has dynamic parts.
|
|
95
|
+
*
|
|
96
|
+
* Has a few minor differences with [`fast-glob`](https://github.com/mrmlnc/fast-glob) for better accuracy:
|
|
97
|
+
*
|
|
98
|
+
* - Doesn't necessarily return `false` on patterns that include `\`.
|
|
99
|
+
* - Returns `true` if the pattern includes parentheses, regardless of them representing one single pattern or not.
|
|
100
|
+
* - Returns `true` for unfinished glob extensions i.e. `(h`, `+(h`.
|
|
101
|
+
* - Returns `true` for unfinished brace expansions as long as they include `,` or `..`.
|
|
102
|
+
*
|
|
103
|
+
* @see {@link https://superchupu.dev/tinyglobby/documentation#isDynamicPattern}
|
|
104
|
+
*/
|
|
105
|
+
function isDynamicPattern(pattern, options) {
|
|
106
|
+
const scan = pm.scan(pattern);
|
|
107
|
+
return scan.isGlob || scan.negated;
|
|
108
|
+
}
|
|
109
|
+
function log(...tasks) {
|
|
110
|
+
console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/index.ts
|
|
115
|
+
const PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
|
116
|
+
const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
117
|
+
const BACKSLASHES = /\\/g;
|
|
118
|
+
function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
119
|
+
let result = pattern;
|
|
120
|
+
if (pattern.endsWith("/")) result = pattern.slice(0, -1);
|
|
121
|
+
if (!result.endsWith("*") && expandDirectories) result += "/**";
|
|
122
|
+
const escapedCwd = escapePath(cwd);
|
|
123
|
+
if (sysPath__default.isAbsolute(result.replace(ESCAPING_BACKSLASHES, ""))) result = posix.relative(escapedCwd, result);
|
|
124
|
+
else result = posix.normalize(result);
|
|
125
|
+
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
|
126
|
+
const parts = splitPattern(result);
|
|
127
|
+
if (parentDirectoryMatch === null || parentDirectoryMatch === void 0 ? void 0 : parentDirectoryMatch[0]) {
|
|
128
|
+
const n = (parentDirectoryMatch[0].length + 1) / 3;
|
|
129
|
+
let i = 0;
|
|
130
|
+
const cwdParts = escapedCwd.split("/");
|
|
131
|
+
while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
|
|
132
|
+
result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
|
|
133
|
+
i++;
|
|
134
|
+
}
|
|
135
|
+
const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(i * 3));
|
|
136
|
+
if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
|
|
137
|
+
props.root = potentialRoot;
|
|
138
|
+
props.depthOffset = -n + i;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (!isIgnore && props.depthOffset >= 0) {
|
|
142
|
+
var _props$commonPath;
|
|
143
|
+
(_props$commonPath = props.commonPath) !== null && _props$commonPath !== void 0 || (props.commonPath = parts);
|
|
144
|
+
const newCommonPath = [];
|
|
145
|
+
const length = Math.min(props.commonPath.length, parts.length);
|
|
146
|
+
for (let i = 0; i < length; i++) {
|
|
147
|
+
const part = parts[i];
|
|
148
|
+
if (part === "**" && !parts[i + 1]) {
|
|
149
|
+
newCommonPath.pop();
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
|
|
153
|
+
newCommonPath.push(part);
|
|
154
|
+
}
|
|
155
|
+
props.depthOffset = newCommonPath.length;
|
|
156
|
+
props.commonPath = newCommonPath;
|
|
157
|
+
props.root = newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd;
|
|
158
|
+
}
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
function processPatterns({ patterns = ["**/*"], ignore = [], expandDirectories = true }, cwd, props) {
|
|
162
|
+
if (typeof patterns === "string") patterns = [patterns];
|
|
163
|
+
if (typeof ignore === "string") ignore = [ignore];
|
|
164
|
+
const matchPatterns = [];
|
|
165
|
+
const ignorePatterns = [];
|
|
166
|
+
for (const pattern of ignore) {
|
|
167
|
+
if (!pattern) continue;
|
|
168
|
+
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, true));
|
|
169
|
+
}
|
|
170
|
+
for (const pattern of patterns) {
|
|
171
|
+
if (!pattern) continue;
|
|
172
|
+
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, expandDirectories, cwd, props, false));
|
|
173
|
+
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), expandDirectories, cwd, props, true));
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
match: matchPatterns,
|
|
177
|
+
ignore: ignorePatterns
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function formatPaths(paths, relative) {
|
|
181
|
+
for (let i = paths.length - 1; i >= 0; i--) {
|
|
182
|
+
const path$1 = paths[i];
|
|
183
|
+
paths[i] = relative(path$1);
|
|
184
|
+
}
|
|
185
|
+
return paths;
|
|
186
|
+
}
|
|
187
|
+
function normalizeCwd(cwd) {
|
|
188
|
+
if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
|
|
189
|
+
if (cwd instanceof URL) return fileURLToPath(cwd).replace(BACKSLASHES, "/");
|
|
190
|
+
return sysPath__default.resolve(cwd).replace(BACKSLASHES, "/");
|
|
191
|
+
}
|
|
192
|
+
function getCrawler(patterns, inputOptions = {}) {
|
|
193
|
+
const options = process.env.TINYGLOBBY_DEBUG ? {
|
|
194
|
+
...inputOptions,
|
|
195
|
+
debug: true
|
|
196
|
+
} : inputOptions;
|
|
197
|
+
const cwd = normalizeCwd(options.cwd);
|
|
198
|
+
if (options.debug) log("globbing with:", {
|
|
199
|
+
patterns,
|
|
200
|
+
options,
|
|
201
|
+
cwd
|
|
202
|
+
});
|
|
203
|
+
if (Array.isArray(patterns) && patterns.length === 0) return [{
|
|
204
|
+
sync: () => [],
|
|
205
|
+
withPromise: async () => []
|
|
206
|
+
}, false];
|
|
207
|
+
const props = {
|
|
208
|
+
root: cwd,
|
|
209
|
+
commonPath: null,
|
|
210
|
+
depthOffset: 0
|
|
211
|
+
};
|
|
212
|
+
const processed = processPatterns({
|
|
213
|
+
...options,
|
|
214
|
+
patterns
|
|
215
|
+
}, cwd, props);
|
|
216
|
+
if (options.debug) log("internal processing patterns:", processed);
|
|
217
|
+
const matchOptions = {
|
|
218
|
+
dot: options.dot,
|
|
219
|
+
nobrace: options.braceExpansion === false,
|
|
220
|
+
nocase: options.caseSensitiveMatch === false,
|
|
221
|
+
noextglob: options.extglob === false,
|
|
222
|
+
noglobstar: options.globstar === false,
|
|
223
|
+
posix: true
|
|
224
|
+
};
|
|
225
|
+
const matcher = pm(processed.match, {
|
|
226
|
+
...matchOptions,
|
|
227
|
+
ignore: processed.ignore
|
|
228
|
+
});
|
|
229
|
+
const ignore = pm(processed.ignore, matchOptions);
|
|
230
|
+
const partialMatcher = getPartialMatcher(processed.match, matchOptions);
|
|
231
|
+
const format = buildFormat(cwd, props.root, options.absolute);
|
|
232
|
+
const formatExclude = options.absolute ? format : buildFormat(cwd, props.root, true);
|
|
233
|
+
const fdirOptions = {
|
|
234
|
+
filters: [options.debug ? (p, isDirectory) => {
|
|
235
|
+
const path$1 = format(p, isDirectory);
|
|
236
|
+
const matches = matcher(path$1);
|
|
237
|
+
if (matches) log(`matched ${path$1}`);
|
|
238
|
+
return matches;
|
|
239
|
+
} : (p, isDirectory) => matcher(format(p, isDirectory))],
|
|
240
|
+
exclude: options.debug ? (_, p) => {
|
|
241
|
+
const relativePath = formatExclude(p, true);
|
|
242
|
+
const skipped = relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
243
|
+
if (skipped) log(`skipped ${p}`);
|
|
244
|
+
else log(`crawling ${p}`);
|
|
245
|
+
return skipped;
|
|
246
|
+
} : (_, p) => {
|
|
247
|
+
const relativePath = formatExclude(p, true);
|
|
248
|
+
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
249
|
+
},
|
|
250
|
+
fs: options.fs ? {
|
|
251
|
+
readdir: options.fs.readdir || V__default.readdir,
|
|
252
|
+
readdirSync: options.fs.readdirSync || V__default.readdirSync,
|
|
253
|
+
realpath: options.fs.realpath || V__default.realpath,
|
|
254
|
+
realpathSync: options.fs.realpathSync || V__default.realpathSync,
|
|
255
|
+
stat: options.fs.stat || V__default.stat,
|
|
256
|
+
statSync: options.fs.statSync || V__default.statSync
|
|
257
|
+
} : void 0,
|
|
258
|
+
pathSeparator: "/",
|
|
259
|
+
relativePaths: true,
|
|
260
|
+
resolveSymlinks: true,
|
|
261
|
+
signal: options.signal
|
|
262
|
+
};
|
|
263
|
+
if (options.deep !== void 0) fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
|
|
264
|
+
if (options.absolute) {
|
|
265
|
+
fdirOptions.relativePaths = false;
|
|
266
|
+
fdirOptions.resolvePaths = true;
|
|
267
|
+
fdirOptions.includeBasePath = true;
|
|
268
|
+
}
|
|
269
|
+
if (options.followSymbolicLinks === false) {
|
|
270
|
+
fdirOptions.resolveSymlinks = false;
|
|
271
|
+
fdirOptions.excludeSymlinks = true;
|
|
272
|
+
}
|
|
273
|
+
if (options.onlyDirectories) {
|
|
274
|
+
fdirOptions.excludeFiles = true;
|
|
275
|
+
fdirOptions.includeDirs = true;
|
|
276
|
+
} else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
|
|
277
|
+
props.root = props.root.replace(BACKSLASHES, "");
|
|
278
|
+
const root = props.root;
|
|
279
|
+
if (options.debug) log("internal properties:", props);
|
|
280
|
+
const relative = cwd !== root && !options.absolute && buildRelative(cwd, props.root);
|
|
281
|
+
return [new Builder(fdirOptions).crawl(root), relative];
|
|
282
|
+
}
|
|
283
|
+
async function glob(patternsOrOptions, options) {
|
|
284
|
+
if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
285
|
+
const isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === "string";
|
|
286
|
+
const opts = isModern ? options : patternsOrOptions;
|
|
287
|
+
const patterns = isModern ? patternsOrOptions : patternsOrOptions.patterns;
|
|
288
|
+
const [crawler, relative] = getCrawler(patterns, opts);
|
|
289
|
+
if (!relative) return crawler.withPromise();
|
|
290
|
+
return formatPaths(await crawler.withPromise(), relative);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export { glob as g };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* toidentifier
|
|
3
|
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
4
|
+
* MIT Licensed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var toidentifier;
|
|
8
|
+
var hasRequiredToidentifier;
|
|
9
|
+
|
|
10
|
+
function requireToidentifier () {
|
|
11
|
+
if (hasRequiredToidentifier) return toidentifier;
|
|
12
|
+
hasRequiredToidentifier = 1;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Module exports.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
toidentifier = toIdentifier;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Trasform the given string into a JavaScript identifier
|
|
23
|
+
*
|
|
24
|
+
* @param {string} str
|
|
25
|
+
* @returns {string}
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
function toIdentifier (str) {
|
|
30
|
+
return str
|
|
31
|
+
.split(' ')
|
|
32
|
+
.map(function (token) {
|
|
33
|
+
return token.slice(0, 1).toUpperCase() + token.slice(1)
|
|
34
|
+
})
|
|
35
|
+
.join('')
|
|
36
|
+
.replace(/[^ _0-9a-z]/gi, '')
|
|
37
|
+
}
|
|
38
|
+
return toidentifier;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { requireToidentifier as r };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var D=new Set(["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),x=new Set(["script","style"]),o=/(?:<(\/?)([a-zA-Z][a-zA-Z0-9\:-]*)(?:\s([^>]*?))?((?:\s*\/)?)>|(<\!\-\-)([\s\S]*?)(\-\->)|(<\!)([\s\S]*?)(>))/gm,b=/[\@\.a-z0-9_\:\-]/i;function I(e){let t={};if(e){let i="none",r,n="",a,l;for(let c=0;c<e.length;c++){let d=e[c];i==="none"?b.test(d)?(r&&(t[r]=n,r=void 0,n=""),a=c,i="key"):d==="="&&r&&(i="value"):i==="key"?b.test(d)||(r=e.substring(a,c),d==="="?i="value":i="none"):d===l&&c>0&&e[c-1]!=="\\"?l&&(n=e.substring(a,c),l=void 0,i="none"):(d==='"'||d==="'")&&!l&&(a=c+1,l=d);}i==="key"&&a!=null&&a<e.length&&(r=e.substring(a,e.length)),r&&(t[r]=n);}return t}function P(e){let t=typeof e=="string"?e:e.value,i,r,n,a,l,c,d,m,s,u=[];o.lastIndex=0,r=i={type:0,children:[]};let g=0;function h(){a=t.substring(g,o.lastIndex-n[0].length),a&&r.children.push({type:2,value:a,parent:r});}for(;n=o.exec(t);){if(c=n[5]||n[8],d=n[6]||n[9],m=n[7]||n[10],x.has(r.name)&&n[2]!==r.name){l=o.lastIndex-n[0].length,r.children.length>0&&(r.children[0].value+=n[0]);continue}else if(c==="<!--"){if(l=o.lastIndex-n[0].length,x.has(r.name))continue;s={type:3,value:d,parent:r,loc:[{start:l,end:l+c.length},{start:o.lastIndex-m.length,end:o.lastIndex}]},u.push(s),s.parent.children.push(s);}else if(c==="<!")l=o.lastIndex-n[0].length,s={type:4,value:d,parent:r,loc:[{start:l,end:l+c.length},{start:o.lastIndex-m.length,end:o.lastIndex}]},u.push(s),s.parent.children.push(s);else if(n[1]!=="/")if(h(),x.has(r.name)){g=o.lastIndex,h();continue}else s={type:1,name:n[2]+"",attributes:I(n[3]),parent:r,children:[],loc:[{start:o.lastIndex-n[0].length,end:o.lastIndex}]},u.push(s),s.parent.children.push(s),n[4]&&n[4].indexOf("/")>-1||D.has(s.name)?(s.loc[1]=s.loc[0],s.isSelfClosingTag=true):r=s;else h(),n[2]+""===r.name?(s=r,r=s.parent,s.loc.push({start:o.lastIndex-n[0].length,end:o.lastIndex}),a=t.substring(s.loc[0].end,s.loc[1].start),s.children.length===0&&s.children.push({type:2,value:a,parent:r})):n[2]+""===u[u.length-1].name&&u[u.length-1].isSelfClosingTag===true&&(s=u[u.length-1],s.loc.push({start:o.lastIndex-n[0].length,end:o.lastIndex}));g=o.lastIndex;}return a=t.slice(g),r.children.push({type:2,value:a,parent:r}),i}var T=class{constructor(t){this.callback=t;}async visit(t,i,r){if(await this.callback(t,i,r),Array.isArray(t.children)){let n=[];for(let a=0;a<t.children.length;a++){let l=t.children[a];n.push(this.visit(l,t,a));}await Promise.all(n);}}};function z(e,t){return new T(t).visit(e)}
|
|
2
|
+
|
|
3
|
+
export { P, z };
|