cf-workers-native 0.1.4 → 0.1.6
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/README.md +2 -2
- package/dist/browser/documents/page-source.js +1 -1
- package/dist/browser/fetch/host-call.js +6 -1
- package/dist/browser/fetch/native-network.d.ts +1 -1
- package/dist/browser/fetch/relay.js +2 -0
- package/dist/browser/headers/index.d.ts +2 -0
- package/dist/browser/headers/index.js +5 -0
- package/dist/browser/isolated/transport.js +3 -2
- package/dist/browser/request/index.js +3 -2
- package/dist/browser/response/index.d.ts +2 -0
- package/dist/browser/response/index.js +11 -3
- package/dist/browser/structured-clone/index.d.ts +3 -0
- package/dist/browser/structured-clone/index.js +75 -7
- package/dist/browser/websocket/attachment-size.d.ts +3 -0
- package/dist/browser/websocket/attachment-size.js +336 -0
- package/dist/browser/websocket/brand.d.ts +4 -0
- package/dist/browser/websocket/brand.js +16 -0
- package/dist/browser/websocket/close-event.d.ts +7 -0
- package/dist/browser/websocket/close-event.js +30 -0
- package/dist/browser/websocket/compression.d.ts +5 -0
- package/dist/browser/websocket/compression.js +124 -0
- package/dist/browser/websocket/conversion.d.ts +2 -0
- package/dist/browser/websocket/conversion.js +13 -0
- package/dist/browser/websocket/endpoint.d.ts +39 -0
- package/dist/browser/websocket/endpoint.js +379 -0
- package/dist/browser/websocket/frames.d.ts +21 -0
- package/dist/browser/websocket/frames.js +121 -0
- package/dist/browser/websocket/native.d.ts +14 -0
- package/dist/browser/websocket/native.js +226 -0
- package/dist/cloudflare/apis/cloudflare-node/index.js +11 -23
- package/dist/cloudflare/workers/worker-runtime.js +2 -1
- package/dist/compat/console/index.d.ts +35 -0
- package/dist/compat/console/index.js +92 -0
- package/dist/compat/crypto/LICENSE-3RD-PARTY.md +39 -0
- package/dist/compat/crypto/LICENSE-APACHE +177 -0
- package/dist/compat/crypto/LICENSE.boringssl +238 -0
- package/dist/compat/crypto/LICENSE.emscripten +102 -0
- package/dist/compat/crypto/LICENSE.musl +193 -0
- package/dist/compat/crypto/LICENSE.ncrypto +21 -0
- package/dist/compat/crypto/LICENSE.openssl +177 -0
- package/dist/compat/crypto/asymmetric.d.ts +13 -0
- package/dist/compat/crypto/asymmetric.js +312 -0
- package/dist/compat/crypto/brorand.cjs +74 -0
- package/dist/compat/crypto/brorand.d.cts +6 -0
- package/dist/compat/crypto/certificate.d.ts +14 -0
- package/dist/compat/crypto/certificate.js +66 -0
- package/dist/compat/crypto/cipher-handle.d.ts +27 -0
- package/dist/compat/crypto/cipher-handle.js +239 -0
- package/dist/compat/crypto/cipher-info.d.ts +12 -0
- package/dist/compat/crypto/cipher-info.js +324 -0
- package/dist/compat/crypto/constants.d.ts +62 -0
- package/dist/compat/crypto/constants.js +68 -0
- package/dist/compat/crypto/dh-handle.d.ts +17 -0
- package/dist/compat/crypto/dh-handle.js +180 -0
- package/dist/compat/crypto/dh.d.ts +53 -0
- package/dist/compat/crypto/dh.js +138 -0
- package/dist/compat/crypto/digest-stream.d.ts +15 -0
- package/dist/compat/crypto/digest-stream.js +213 -0
- package/dist/compat/crypto/digests.d.ts +3 -0
- package/dist/compat/crypto/digests.js +32 -0
- package/dist/compat/crypto/ecdh.d.ts +25 -0
- package/dist/compat/crypto/ecdh.js +109 -0
- package/dist/compat/crypto/hash-handle.d.ts +23 -0
- package/dist/compat/crypto/hash-handle.js +70 -0
- package/dist/compat/crypto/hash.d.ts +37 -0
- package/dist/compat/crypto/hash.js +218 -0
- package/dist/compat/crypto/hkdf.d.ts +2 -0
- package/dist/compat/crypto/hkdf.js +78 -0
- package/dist/compat/crypto/index.cjs +2 -0
- package/dist/compat/crypto/index.d.cts +169 -0
- package/dist/compat/crypto/index.d.ts +213 -0
- package/dist/compat/crypto/index.js +96 -0
- package/dist/compat/crypto/key-errors.d.ts +10 -0
- package/dist/compat/crypto/key-errors.js +17 -0
- package/dist/compat/crypto/key-export.d.ts +8 -0
- package/dist/compat/crypto/key-export.js +49 -0
- package/dist/compat/crypto/key-formats.d.ts +7 -0
- package/dist/compat/crypto/key-formats.js +251 -0
- package/dist/compat/crypto/key-options.d.ts +1 -0
- package/dist/compat/crypto/key-options.js +74 -0
- package/dist/compat/crypto/key-state.d.ts +10 -0
- package/dist/compat/crypto/key-state.js +4 -0
- package/dist/compat/crypto/keys.d.ts +58 -0
- package/dist/compat/crypto/keys.js +278 -0
- package/dist/compat/crypto/metadata.d.ts +13 -0
- package/dist/compat/crypto/metadata.js +109 -0
- package/dist/compat/crypto/native-cipher.d.ts +17 -0
- package/dist/compat/crypto/native-cipher.js +192 -0
- package/dist/compat/crypto/native-crypto.d.ts +81 -0
- package/dist/compat/crypto/native-crypto.js +681 -0
- package/dist/compat/crypto/pbkdf2-handle.d.ts +4 -0
- package/dist/compat/crypto/pbkdf2-handle.js +26 -0
- package/dist/compat/crypto/pbkdf2.d.ts +5 -0
- package/dist/compat/crypto/pbkdf2.js +60 -0
- package/dist/compat/crypto/prime.d.ts +19 -0
- package/dist/compat/crypto/prime.js +146 -0
- package/dist/compat/crypto/random.d.ts +18 -0
- package/dist/compat/crypto/random.js +203 -0
- package/dist/compat/crypto/rsa.d.ts +21 -0
- package/dist/compat/crypto/rsa.js +177 -0
- package/dist/compat/crypto/scrypt.d.ts +25 -0
- package/dist/compat/crypto/scrypt.js +152 -0
- package/dist/compat/crypto/sign-errors.d.ts +8 -0
- package/dist/compat/crypto/sign-errors.js +13 -0
- package/dist/compat/crypto/sign-handle.d.ts +22 -0
- package/dist/compat/crypto/sign-handle.js +149 -0
- package/dist/compat/crypto/signatures.d.ts +34 -0
- package/dist/compat/crypto/signatures.js +252 -0
- package/dist/compat/crypto/subtle-digest.d.ts +1 -0
- package/dist/compat/crypto/subtle-digest.js +56 -0
- package/dist/compat/crypto/symmetric.d.ts +45 -0
- package/dist/compat/crypto/symmetric.js +239 -0
- package/dist/compat/crypto/validation.d.ts +7 -0
- package/dist/compat/crypto/validation.js +46 -0
- package/dist/compat/crypto/webcrypto.d.ts +13 -0
- package/dist/compat/crypto/webcrypto.js +51 -0
- package/dist/compat/crypto/x509.d.ts +30 -0
- package/dist/compat/crypto/x509.js +407 -0
- package/dist/compat/events/errors.d.ts +8 -0
- package/dist/compat/events/errors.js +39 -0
- package/dist/compat/events/index.cjs +2 -0
- package/dist/compat/events/index.d.cts +2 -0
- package/dist/compat/events/index.d.ts +64 -0
- package/dist/compat/events/index.js +792 -0
- package/dist/compat/events/intrinsics.d.ts +1 -0
- package/dist/compat/events/intrinsics.js +2 -0
- package/dist/compat/fs/LICENSE-3RD-PARTY.md +11 -0
- package/dist/compat/fs/LICENSE-APACHE +177 -0
- package/dist/compat/fs/directory-backend.d.ts +6 -0
- package/dist/compat/fs/directory-backend.js +51 -0
- package/dist/compat/fs/directory.d.ts +37 -0
- package/dist/compat/fs/directory.js +137 -0
- package/dist/compat/fs/embedded.d.ts +85 -0
- package/dist/compat/fs/embedded.js +260 -0
- package/dist/compat/fs/file-handle.d.ts +75 -0
- package/dist/compat/fs/file-handle.js +226 -0
- package/dist/compat/fs/glob-internal.d.ts +15 -0
- package/dist/compat/fs/glob-internal.js +417 -0
- package/dist/compat/fs/glob.d.ts +10 -0
- package/dist/compat/fs/glob.js +71 -0
- package/dist/compat/fs/index.d.ts +8 -82
- package/dist/compat/fs/index.js +736 -238
- package/dist/compat/fs/io-validation.d.ts +14 -0
- package/dist/compat/fs/io-validation.js +130 -0
- package/dist/compat/fs/io.d.ts +1 -0
- package/dist/compat/fs/io.js +282 -0
- package/dist/compat/fs/mode.d.ts +1 -0
- package/dist/compat/fs/mode.js +13 -0
- package/dist/compat/fs/promises/index.d.ts +3 -1
- package/dist/compat/fs/promises/index.js +1 -1
- package/dist/compat/fs/public-types.d.ts +120 -0
- package/dist/compat/fs/public-types.js +1 -0
- package/dist/compat/fs/stream-errors.d.ts +6 -0
- package/dist/compat/fs/stream-errors.js +8 -0
- package/dist/compat/fs/stream-utils.d.ts +16 -0
- package/dist/compat/fs/stream-utils.js +29 -0
- package/dist/compat/fs/streams.d.ts +104 -0
- package/dist/compat/fs/streams.js +794 -0
- package/dist/compat/fs/writable.d.ts +14 -0
- package/dist/compat/fs/writable.js +532 -0
- package/dist/compat/http/index.d.ts +11 -28
- package/dist/compat/http/index.js +81 -125
- package/dist/compat/http/server-options.d.ts +1 -0
- package/dist/compat/http/server-options.js +87 -0
- package/dist/compat/http/symbols.d.ts +5 -0
- package/dist/compat/http/symbols.js +9 -0
- package/dist/compat/http/unique-headers.d.ts +1 -0
- package/dist/compat/http/unique-headers.js +21 -0
- package/dist/compat/http-common/index.d.ts +37 -0
- package/dist/compat/http-common/index.js +43 -0
- package/dist/compat/http-outgoing/index.d.ts +14 -0
- package/dist/compat/http-outgoing/index.js +17 -0
- package/dist/compat/http-server/index.d.ts +18 -0
- package/dist/compat/http-server/index.js +26 -0
- package/dist/compat/https/index.d.ts +4 -2
- package/dist/compat/module/builtins.d.ts +1 -0
- package/dist/compat/module/builtins.js +101 -0
- package/dist/compat/module/index.d.ts +4 -2
- package/dist/compat/module/index.js +22 -17
- package/dist/compat/module/metadata.d.ts +44 -0
- package/dist/compat/module/metadata.js +127 -0
- package/dist/compat/net/internal-net.js +4 -0
- package/dist/compat/net/sockets.d.ts +5 -0
- package/dist/compat/net/sockets.js +153 -14
- package/dist/compat/net/validators.d.ts +1 -0
- package/dist/compat/net/validators.js +8 -0
- package/dist/compat/process/configuration.d.ts +113 -0
- package/dist/compat/process/configuration.js +115 -0
- package/dist/compat/process/directory.d.ts +4 -0
- package/dist/compat/process/directory.js +28 -0
- package/dist/compat/process/files.d.ts +3 -0
- package/dist/compat/process/files.js +10 -0
- package/dist/compat/process/index.cjs +2 -0
- package/dist/compat/process/index.d.cts +4 -0
- package/dist/compat/process/index.d.ts +20 -0
- package/dist/compat/process/index.js +113 -0
- package/dist/compat/process/metadata.d.ts +135 -0
- package/dist/compat/process/metadata.js +251 -0
- package/dist/compat/process/scheduling.d.ts +2 -0
- package/dist/compat/process/scheduling.js +60 -0
- package/dist/compat/process/state.d.ts +4 -0
- package/dist/compat/process/state.js +5 -0
- package/dist/compat/process/stdio.d.ts +18 -0
- package/dist/compat/process/stdio.js +66 -0
- package/dist/compat/stream/destroy.d.ts +1 -0
- package/dist/compat/stream/destroy.js +21 -1
- package/dist/compat/stream/readable.js +10 -2
- package/dist/compat/stream-web/LICENSE +22 -0
- package/dist/compat/stream-web/ponyfill.d.ts +1 -1
- package/dist/compat/stream-web/ponyfill.js +2369 -1775
- package/dist/compat/stream-web/runtime.d.ts +1 -1
- package/dist/compat/stream-web/runtime.js +3 -2
- package/dist/compat/stream-wrap/LICENSE-3RD-PARTY.md +11 -0
- package/dist/compat/stream-wrap/LICENSE-APACHE +177 -0
- package/dist/compat/stream-wrap/index.d.ts +1 -0
- package/dist/compat/stream-wrap/index.js +1 -0
- package/dist/compat/tls/LICENSE-3RD-PARTY.md +11 -0
- package/dist/compat/tls/LICENSE-APACHE +177 -0
- package/dist/compat/tls/constants.d.ts +7 -0
- package/dist/compat/tls/constants.js +14 -0
- package/dist/compat/tls/errors.d.ts +35 -0
- package/dist/compat/tls/errors.js +68 -0
- package/dist/compat/tls/helpers.d.ts +9 -0
- package/dist/compat/tls/helpers.js +207 -0
- package/dist/compat/tls/index.d.ts +26 -0
- package/dist/compat/tls/index.js +50 -0
- package/dist/compat/tls/jsstream.d.ts +19 -0
- package/dist/compat/tls/jsstream.js +196 -0
- package/dist/compat/tls/native-session.d.ts +3 -0
- package/dist/compat/tls/native-session.js +187 -0
- package/dist/compat/tls/wrap.d.ts +65 -0
- package/dist/compat/tls/wrap.js +541 -0
- package/dist/compat/tls-wrap/LICENSE-3RD-PARTY.md +11 -0
- package/dist/compat/tls-wrap/LICENSE-APACHE +177 -0
- package/dist/compat/tls-wrap/index.d.ts +7 -0
- package/dist/compat/tls-wrap/index.js +3 -0
- package/dist/compat/util/index.js +43 -1
- package/dist/compat/util/inspect.js +5 -1
- package/dist/compat/util/types/index.d.ts +3 -0
- package/dist/compat/util/types/index.js +5 -0
- package/dist/compat/zlib/LICENSE-3RD-PARTY.md +11 -0
- package/dist/compat/zlib/LICENSE-APACHE +177 -0
- package/dist/compat/zlib/LICENSE.brotli +19 -0
- package/dist/compat/zlib/LICENSE.emscripten +102 -0
- package/dist/compat/zlib/LICENSE.musl +193 -0
- package/dist/compat/zlib/LICENSE.zlib +22 -0
- package/dist/compat/zlib/LICENSE.zstd +30 -0
- package/dist/compat/zlib/classic-base.cjs +600 -0
- package/dist/compat/zlib/classic-base.d.cts +39 -0
- package/dist/compat/zlib/classic-binding.d.ts +28 -0
- package/dist/compat/zlib/classic-binding.js +105 -0
- package/dist/compat/zlib/classic.d.ts +44 -0
- package/dist/compat/zlib/classic.js +199 -0
- package/dist/compat/zlib/codec-binding.d.ts +33 -0
- package/dist/compat/zlib/codec-binding.js +141 -0
- package/dist/compat/zlib/compression.d.ts +26 -0
- package/dist/compat/zlib/compression.js +170 -0
- package/dist/compat/zlib/constants.d.ts +172 -0
- package/dist/compat/zlib/constants.js +173 -0
- package/dist/compat/zlib/errors.d.ts +21 -0
- package/dist/compat/zlib/errors.js +32 -0
- package/dist/compat/zlib/index.d.ts +544 -0
- package/dist/compat/zlib/index.js +194 -0
- package/dist/compat/zlib/input.d.ts +16 -0
- package/dist/compat/zlib/input.js +132 -0
- package/dist/compat/zlib/native-codecs.d.ts +24 -0
- package/dist/compat/zlib/native-codecs.js +180 -0
- package/dist/compat/zlib/native-zlib.d.ts +5 -0
- package/dist/compat/zlib/native-zlib.js +52 -0
- package/dist/compat/zlib/public-types.d.ts +48 -0
- package/dist/compat/zlib/public-types.js +1 -0
- package/dist/compat/zlib/validators.d.ts +3 -0
- package/dist/compat/zlib/validators.js +18 -0
- package/dist/shared/buffer-source.d.ts +5 -0
- package/dist/shared/buffer-source.js +70 -0
- package/dist/shared/globals/inject.d.ts +2 -1
- package/dist/shared/globals/inject.js +2 -1
- package/dist/shared/globals/platform.d.ts +8 -0
- package/dist/shared/globals/platform.js +1 -0
- package/dist/shared/globals/runtime.d.ts +1 -2
- package/dist/shared/globals/runtime.js +1 -2
- package/dist/shared/globals/web.js +5 -0
- package/dist/shared/request-context.d.ts +2 -0
- package/dist/shared/request-context.js +11 -0
- package/dist/shared/request-scope.d.ts +4 -0
- package/dist/shared/request-scope.js +14 -0
- package/dist/tooling/async.js +36 -14
- package/dist/tooling/shared.d.ts +1 -0
- package/dist/tooling/shared.js +26 -1
- package/dist/tooling/vite.js +8 -3
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkerSockets.java +92 -13
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkersCapacitorPlugin.java +4 -2
- package/native/ios/NetworkBridge.swift +11 -1
- package/native/ios/SocketBridge.swift +37 -2
- package/native/ios/WorkersCapacitorPlugin.swift +4 -0
- package/package.json +4 -2
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
// Copyright (c) 2026 Cloudflare, Inc.
|
|
2
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4
|
+
// Ported from workerd@5358e3d337336eaf696a48bc1563d808b10feba5 internal_fs_glob.ts.
|
|
5
|
+
// Adapted filesystem boundary; pattern matching and traversal retain the pinned upstream implementation.
|
|
6
|
+
import { readDirectory } from "./directory-backend.js";
|
|
7
|
+
// UV_DIRENT_DIR constant from internal_fs_constants
|
|
8
|
+
const UV_DIRENT_DIR = 2;
|
|
9
|
+
// Maximum recursion depth to prevent stack overflow on deeply nested VFS
|
|
10
|
+
const MAX_WALK_DEPTH = 256;
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// Brace Expansion
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Splits a string by top-level occurrences of a separator character,
|
|
15
|
+
// respecting nested braces/parens and backslash escapes.
|
|
16
|
+
function splitTopLevel(str, sep) {
|
|
17
|
+
const parts = [];
|
|
18
|
+
let depth = 0;
|
|
19
|
+
let current = "";
|
|
20
|
+
for (let i = 0; i < str.length; i++) {
|
|
21
|
+
const c = str.charAt(i);
|
|
22
|
+
if (c === "\\" && i + 1 < str.length) {
|
|
23
|
+
current += c + str.charAt(i + 1);
|
|
24
|
+
i++;
|
|
25
|
+
}
|
|
26
|
+
else if (c === "{" || c === "(") {
|
|
27
|
+
depth++;
|
|
28
|
+
current += c;
|
|
29
|
+
}
|
|
30
|
+
else if (c === "}" || c === ")") {
|
|
31
|
+
depth--;
|
|
32
|
+
current += c;
|
|
33
|
+
}
|
|
34
|
+
else if (c === sep && depth === 0) {
|
|
35
|
+
parts.push(current);
|
|
36
|
+
current = "";
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
current += c;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
parts.push(current);
|
|
43
|
+
return parts;
|
|
44
|
+
}
|
|
45
|
+
// Expands brace expressions in a glob pattern into multiple patterns.
|
|
46
|
+
export function expandBraces(pattern) {
|
|
47
|
+
let depth = 0;
|
|
48
|
+
let braceStart = -1;
|
|
49
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
50
|
+
const c = pattern[i];
|
|
51
|
+
if (c === "\\" && i + 1 < pattern.length) {
|
|
52
|
+
i++;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (c === "{") {
|
|
56
|
+
if (depth === 0)
|
|
57
|
+
braceStart = i;
|
|
58
|
+
depth++;
|
|
59
|
+
}
|
|
60
|
+
else if (c === "}") {
|
|
61
|
+
depth--;
|
|
62
|
+
if (depth === 0 && braceStart !== -1) {
|
|
63
|
+
const prefix = pattern.slice(0, braceStart);
|
|
64
|
+
const body = pattern.slice(braceStart + 1, i);
|
|
65
|
+
const suffix = pattern.slice(i + 1);
|
|
66
|
+
const alternatives = splitTopLevel(body, ",");
|
|
67
|
+
if (alternatives.length === 1) {
|
|
68
|
+
return [pattern];
|
|
69
|
+
}
|
|
70
|
+
const results = [];
|
|
71
|
+
for (const alt of alternatives) {
|
|
72
|
+
for (const expanded of expandBraces(prefix + alt + suffix)) {
|
|
73
|
+
results.push(expanded);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return results;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return [pattern];
|
|
81
|
+
}
|
|
82
|
+
// ============================================================================
|
|
83
|
+
// Pattern Normalization
|
|
84
|
+
// ============================================================================
|
|
85
|
+
export function normalizePattern(pattern) {
|
|
86
|
+
// Strip leading ./
|
|
87
|
+
if (pattern.startsWith("./")) {
|
|
88
|
+
pattern = pattern.slice(2);
|
|
89
|
+
}
|
|
90
|
+
// Collapse multiple slashes to single
|
|
91
|
+
pattern = pattern.replace(/\/\/+/g, "/");
|
|
92
|
+
// Strip trailing slash
|
|
93
|
+
if (pattern.endsWith("/") && pattern.length > 1) {
|
|
94
|
+
pattern = pattern.slice(0, -1);
|
|
95
|
+
}
|
|
96
|
+
return pattern;
|
|
97
|
+
}
|
|
98
|
+
// ============================================================================
|
|
99
|
+
// Segment-Level Regex (with extglob support)
|
|
100
|
+
// ============================================================================
|
|
101
|
+
// Converts a single path segment pattern to a RegExp.
|
|
102
|
+
// Supports: *, ?, [...], [!...], @(...), *(...), +(...), ?(...), !(...)
|
|
103
|
+
export function segmentToRegex(segment) {
|
|
104
|
+
const regex = segmentToRegexStr(segment);
|
|
105
|
+
return new RegExp("^" + regex + "$");
|
|
106
|
+
}
|
|
107
|
+
function segmentToRegexStr(segment) {
|
|
108
|
+
let regex = "";
|
|
109
|
+
let i = 0;
|
|
110
|
+
let inCharClass = false;
|
|
111
|
+
while (i < segment.length) {
|
|
112
|
+
const c = segment[i] ?? "";
|
|
113
|
+
// Handle escape sequences
|
|
114
|
+
if (c === "\\" && i + 1 < segment.length) {
|
|
115
|
+
regex += "\\" + escapeRegexChar(segment[i + 1] ?? "");
|
|
116
|
+
i += 2;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
// Inside character classes, most chars are literal
|
|
120
|
+
if (inCharClass) {
|
|
121
|
+
if (c === "]") {
|
|
122
|
+
regex += "]";
|
|
123
|
+
inCharClass = false;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
regex += c;
|
|
127
|
+
}
|
|
128
|
+
i++;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
// Check for extglob: @(...), *(...), +(...), ?(...), !(...)
|
|
132
|
+
if ((c === "@" || c === "*" || c === "+" || c === "?" || c === "!") &&
|
|
133
|
+
i + 1 < segment.length &&
|
|
134
|
+
segment[i + 1] === "(") {
|
|
135
|
+
const closeIdx = findMatchingParen(segment, i + 1);
|
|
136
|
+
if (closeIdx !== -1) {
|
|
137
|
+
const inner = segment.slice(i + 2, closeIdx);
|
|
138
|
+
// Convert pipe-separated alternatives, each may contain glob chars
|
|
139
|
+
const alts = splitTopLevel(inner, "|");
|
|
140
|
+
const altRegexes = alts.map((a) => segmentToRegexStr(a));
|
|
141
|
+
const group = altRegexes.join("|");
|
|
142
|
+
switch (c) {
|
|
143
|
+
case "@": // exactly one
|
|
144
|
+
regex += "(?:" + group + ")";
|
|
145
|
+
break;
|
|
146
|
+
case "*": // zero or more
|
|
147
|
+
regex += "(?:" + group + ")*";
|
|
148
|
+
break;
|
|
149
|
+
case "+": // one or more
|
|
150
|
+
regex += "(?:" + group + ")+";
|
|
151
|
+
break;
|
|
152
|
+
case "?": // zero or one
|
|
153
|
+
regex += "(?:" + group + ")?";
|
|
154
|
+
break;
|
|
155
|
+
case "!": // none of (negative lookahead)
|
|
156
|
+
regex += "(?!(?:" + group + ")$)[^/]*";
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
i = closeIdx + 1;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
switch (c) {
|
|
164
|
+
case "[":
|
|
165
|
+
inCharClass = true;
|
|
166
|
+
regex += "[";
|
|
167
|
+
if (i + 1 < segment.length && segment[i + 1] === "!") {
|
|
168
|
+
regex += "^";
|
|
169
|
+
i++;
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
case "*":
|
|
173
|
+
regex += "[^/]*";
|
|
174
|
+
break;
|
|
175
|
+
case "?":
|
|
176
|
+
regex += "[^/]";
|
|
177
|
+
break;
|
|
178
|
+
case ".":
|
|
179
|
+
case "+":
|
|
180
|
+
case "^":
|
|
181
|
+
case "$":
|
|
182
|
+
case "|":
|
|
183
|
+
case "(":
|
|
184
|
+
case ")":
|
|
185
|
+
case "{":
|
|
186
|
+
case "}":
|
|
187
|
+
regex += "\\" + c;
|
|
188
|
+
break;
|
|
189
|
+
default:
|
|
190
|
+
regex += c;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
i++;
|
|
194
|
+
}
|
|
195
|
+
return regex;
|
|
196
|
+
}
|
|
197
|
+
function findMatchingParen(str, openIdx) {
|
|
198
|
+
let depth = 0;
|
|
199
|
+
for (let i = openIdx; i < str.length; i++) {
|
|
200
|
+
if (str[i] === "\\" && i + 1 < str.length) {
|
|
201
|
+
i++;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (str[i] === "(")
|
|
205
|
+
depth++;
|
|
206
|
+
else if (str[i] === ")") {
|
|
207
|
+
depth--;
|
|
208
|
+
if (depth === 0)
|
|
209
|
+
return i;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return -1;
|
|
213
|
+
}
|
|
214
|
+
function escapeRegexChar(c) {
|
|
215
|
+
if (".+*?^$|()[]{}\\".includes(c)) {
|
|
216
|
+
return "\\" + c;
|
|
217
|
+
}
|
|
218
|
+
return c;
|
|
219
|
+
}
|
|
220
|
+
// ============================================================================
|
|
221
|
+
// Full-Path Regex (used for exclude pattern matching)
|
|
222
|
+
// ============================================================================
|
|
223
|
+
// Converts a full glob pattern (with /) to a single RegExp for exclude matching.
|
|
224
|
+
export function globToRegex(pattern) {
|
|
225
|
+
const normalized = normalizePattern(pattern);
|
|
226
|
+
const segments = normalized.split("/").filter((s) => s !== "");
|
|
227
|
+
const parts = [];
|
|
228
|
+
for (const seg of segments) {
|
|
229
|
+
if (seg === "**") {
|
|
230
|
+
// ** matches zero or more path segments
|
|
231
|
+
// We handle this by inserting a special marker
|
|
232
|
+
parts.push("**");
|
|
233
|
+
}
|
|
234
|
+
else if (seg === ".") {
|
|
235
|
+
// skip
|
|
236
|
+
}
|
|
237
|
+
else if (seg === "..") {
|
|
238
|
+
parts.pop();
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
parts.push(segmentToRegexStr(seg));
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// Now build regex from parts, handling ** markers
|
|
245
|
+
let regex = "";
|
|
246
|
+
for (let i = 0; i < parts.length; i++) {
|
|
247
|
+
const part = parts[i] ?? "";
|
|
248
|
+
const prevPart = i > 0 ? (parts[i - 1] ?? "") : "";
|
|
249
|
+
if (part === "**") {
|
|
250
|
+
if (parts.length === 1) {
|
|
251
|
+
// ** alone: match everything
|
|
252
|
+
regex = ".*";
|
|
253
|
+
}
|
|
254
|
+
else if (i === 0) {
|
|
255
|
+
// ** at start: match zero or more leading segments
|
|
256
|
+
regex += "(?:.*\\/)?";
|
|
257
|
+
}
|
|
258
|
+
else if (i === parts.length - 1) {
|
|
259
|
+
// ** at end: match zero or more trailing segments
|
|
260
|
+
regex += "(?:\\/.*)?";
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
// ** in middle: match zero or more middle segments
|
|
264
|
+
regex += "(?:\\/[^/]+)*(?:\\/)?";
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
if (i > 0 && prevPart !== "**") {
|
|
269
|
+
regex += "\\/";
|
|
270
|
+
}
|
|
271
|
+
regex += part;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return new RegExp("^" + regex + "$");
|
|
275
|
+
}
|
|
276
|
+
// ============================================================================
|
|
277
|
+
// Exclude Compiler
|
|
278
|
+
// ============================================================================
|
|
279
|
+
// Compiles an array of glob patterns into an exclude function.
|
|
280
|
+
// Only accepts string arrays — user-provided functions are handled
|
|
281
|
+
// separately in globSync to preserve their (string | Dirent) signature.
|
|
282
|
+
export function compileExcludePatterns(exclude) {
|
|
283
|
+
const regexes = [];
|
|
284
|
+
for (const pat of exclude) {
|
|
285
|
+
for (const expanded of expandBraces(pat)) {
|
|
286
|
+
regexes.push(globToRegex(expanded));
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return (path) => {
|
|
290
|
+
for (const re of regexes) {
|
|
291
|
+
if (re.test(path))
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
return false;
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function getDirectoryEntries(absPath, cache) {
|
|
298
|
+
const cached = cache.get(absPath);
|
|
299
|
+
if (cached !== undefined)
|
|
300
|
+
return cached;
|
|
301
|
+
try {
|
|
302
|
+
const entries = readDirectory(absPath, false);
|
|
303
|
+
cache.set(absPath, entries);
|
|
304
|
+
return entries;
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
const empty = [];
|
|
308
|
+
cache.set(absPath, empty);
|
|
309
|
+
return empty;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function isDirectory(entry) {
|
|
313
|
+
return entry.type === UV_DIRENT_DIR;
|
|
314
|
+
}
|
|
315
|
+
// Collapses consecutive '**' segments to prevent exponential blowup.
|
|
316
|
+
export function collapseGlobstars(segments) {
|
|
317
|
+
const result = [];
|
|
318
|
+
for (const seg of segments) {
|
|
319
|
+
if (seg === "**" && result[result.length - 1] === "**")
|
|
320
|
+
continue;
|
|
321
|
+
result.push(seg);
|
|
322
|
+
}
|
|
323
|
+
return result;
|
|
324
|
+
}
|
|
325
|
+
// Precompiles segment regexes for all non-special segments.
|
|
326
|
+
export function precompileSegmentRegexes(segments) {
|
|
327
|
+
return segments.map((seg) => {
|
|
328
|
+
if (seg === "**" || seg === "." || seg === "..")
|
|
329
|
+
return null;
|
|
330
|
+
return segmentToRegex(seg);
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
export function walkGlob(cwd, segments, segIdx, currentAbsPath, relativePath, results, cache, segmentRegexes, visitedGlobstar, depth = 0) {
|
|
334
|
+
// Guard against excessive recursion depth
|
|
335
|
+
if (depth >= MAX_WALK_DEPTH)
|
|
336
|
+
return;
|
|
337
|
+
// All segments consumed: this path is a match
|
|
338
|
+
if (segIdx >= segments.length) {
|
|
339
|
+
if (!results.has(relativePath)) {
|
|
340
|
+
// Resolve handle for the matched path by reading the parent directory
|
|
341
|
+
const lastSlash = currentAbsPath.lastIndexOf("/");
|
|
342
|
+
const parentDir = lastSlash > 0 ? currentAbsPath.slice(0, lastSlash) : currentAbsPath;
|
|
343
|
+
const basename = relativePath.split("/").pop() ?? "";
|
|
344
|
+
const entries = getDirectoryEntries(parentDir, cache);
|
|
345
|
+
const handle = entries.find((e) => e.name === basename) ?? null;
|
|
346
|
+
results.set(relativePath, { relativePath, handle });
|
|
347
|
+
}
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const seg = segments[segIdx] ?? "";
|
|
351
|
+
// Handle '.' — stay in current directory
|
|
352
|
+
if (seg === ".") {
|
|
353
|
+
walkGlob(cwd, segments, segIdx + 1, currentAbsPath, relativePath, results, cache, segmentRegexes, visitedGlobstar, depth);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
// Handle '..' — go up one directory (but don't escape cwd)
|
|
357
|
+
if (seg === "..") {
|
|
358
|
+
if (currentAbsPath === cwd || !currentAbsPath.startsWith(cwd + "/")) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
const lastSlash = currentAbsPath.lastIndexOf("/");
|
|
362
|
+
const newAbs = lastSlash > 0 ? currentAbsPath.slice(0, lastSlash) : "/";
|
|
363
|
+
const relParts = relativePath.split("/").filter(Boolean);
|
|
364
|
+
relParts.pop();
|
|
365
|
+
const newRel = relParts.join("/");
|
|
366
|
+
walkGlob(cwd, segments, segIdx + 1, newAbs, newRel, results, cache, segmentRegexes, visitedGlobstar, depth);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
// Handle '**' — match zero or more directory levels
|
|
370
|
+
if (seg === "**") {
|
|
371
|
+
const gsKey = `${currentAbsPath}:${String(segIdx)}`;
|
|
372
|
+
if (visitedGlobstar === undefined) {
|
|
373
|
+
visitedGlobstar = new Set();
|
|
374
|
+
}
|
|
375
|
+
if (visitedGlobstar.has(gsKey))
|
|
376
|
+
return;
|
|
377
|
+
visitedGlobstar.add(gsKey);
|
|
378
|
+
// Zero levels: advance to next segment at current path
|
|
379
|
+
walkGlob(cwd, segments, segIdx + 1, currentAbsPath, relativePath, results, cache, segmentRegexes, visitedGlobstar, depth);
|
|
380
|
+
// One or more levels: enumerate children
|
|
381
|
+
const entries = getDirectoryEntries(currentAbsPath, cache);
|
|
382
|
+
for (const entry of entries) {
|
|
383
|
+
const childAbs = currentAbsPath + "/" + entry.name;
|
|
384
|
+
const childRel = relativePath
|
|
385
|
+
? relativePath + "/" + entry.name
|
|
386
|
+
: entry.name;
|
|
387
|
+
// Try matching next segment against this child
|
|
388
|
+
walkGlob(cwd, segments, segIdx + 1, childAbs, childRel, results, cache, segmentRegexes, visitedGlobstar, depth + 1);
|
|
389
|
+
// If directory, recurse ** deeper
|
|
390
|
+
if (isDirectory(entry)) {
|
|
391
|
+
walkGlob(cwd, segments, segIdx, childAbs, childRel, results, cache, segmentRegexes, visitedGlobstar, depth + 1);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
// Regular segment: match against precompiled regex
|
|
397
|
+
const segRegex = segmentRegexes[segIdx] ?? segmentToRegex(seg);
|
|
398
|
+
const entries = getDirectoryEntries(currentAbsPath, cache);
|
|
399
|
+
for (const entry of entries) {
|
|
400
|
+
if (segRegex.test(entry.name)) {
|
|
401
|
+
const childAbs = currentAbsPath + "/" + entry.name;
|
|
402
|
+
const childRel = relativePath
|
|
403
|
+
? relativePath + "/" + entry.name
|
|
404
|
+
: entry.name;
|
|
405
|
+
if (segIdx + 1 >= segments.length) {
|
|
406
|
+
// This is the last segment — record match
|
|
407
|
+
if (!results.has(childRel)) {
|
|
408
|
+
results.set(childRel, { relativePath: childRel, handle: entry });
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
// More segments to match — recurse
|
|
413
|
+
walkGlob(cwd, segments, segIdx + 1, childAbs, childRel, results, cache, segmentRegexes, visitedGlobstar, depth + 1);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Dirent } from "./directory.js";
|
|
2
|
+
type GlobOptions = {
|
|
3
|
+
cwd?: string | URL;
|
|
4
|
+
withFileTypes?: boolean;
|
|
5
|
+
exclude?: string[] | ((path: any) => boolean);
|
|
6
|
+
};
|
|
7
|
+
type GlobOptionsWithFileTypes = GlobOptions;
|
|
8
|
+
type GlobOptionsWithoutFileTypes = GlobOptions;
|
|
9
|
+
export declare function globSync(pattern: string | readonly string[], options?: GlobOptions | GlobOptionsWithFileTypes | GlobOptionsWithoutFileTypes): string[] | Dirent[];
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { currentDirectory } from "./writable.js";
|
|
2
|
+
// Copyright (c) 2026 Cloudflare, Inc. Licensed under Apache-2.0.
|
|
3
|
+
// Ported from workerd@5358e3d337336eaf696a48bc1563d808b10feba5 internal_fs_sync.ts.
|
|
4
|
+
import { validateString, validateObject } from "../net/validators.js";
|
|
5
|
+
import { Dirent } from "./directory.js";
|
|
6
|
+
import { expandBraces, normalizePattern, walkGlob, compileExcludePatterns, collapseGlobstars, precompileSegmentRegexes, } from "./glob-internal.js";
|
|
7
|
+
export function globSync(pattern, options = {}) {
|
|
8
|
+
// Normalize pattern to array
|
|
9
|
+
const patterns = typeof pattern === "string" ? [pattern] : [...pattern];
|
|
10
|
+
for (const p of patterns) {
|
|
11
|
+
validateString(p, "pattern");
|
|
12
|
+
}
|
|
13
|
+
if (typeof options !== "object" || options === null) {
|
|
14
|
+
validateObject(options, "options");
|
|
15
|
+
}
|
|
16
|
+
const cwdOption = options.cwd;
|
|
17
|
+
const cwd = cwdOption instanceof URL
|
|
18
|
+
? cwdOption.pathname
|
|
19
|
+
: (cwdOption ?? currentDirectory());
|
|
20
|
+
validateString(cwd, "options.cwd");
|
|
21
|
+
const withFileTypes = options.withFileTypes ?? false;
|
|
22
|
+
// Exclude can be a user function or an array of glob patterns.
|
|
23
|
+
// Keep them as separate variables to preserve proper type signatures.
|
|
24
|
+
const excludeOption = options.exclude;
|
|
25
|
+
let excludeUserFn;
|
|
26
|
+
let excludePatternFn;
|
|
27
|
+
if (typeof excludeOption === "function") {
|
|
28
|
+
excludeUserFn = excludeOption;
|
|
29
|
+
}
|
|
30
|
+
else if (Array.isArray(excludeOption)) {
|
|
31
|
+
excludePatternFn = compileExcludePatterns(excludeOption);
|
|
32
|
+
}
|
|
33
|
+
// Pattern-driven directory walk
|
|
34
|
+
const results = new Map();
|
|
35
|
+
const dirCache = new Map();
|
|
36
|
+
for (const p of patterns) {
|
|
37
|
+
for (const expanded of expandBraces(p)) {
|
|
38
|
+
const normalized = normalizePattern(expanded);
|
|
39
|
+
const segments = collapseGlobstars(normalized.split("/").filter((s) => s !== ""));
|
|
40
|
+
if (segments.length === 0)
|
|
41
|
+
continue;
|
|
42
|
+
const segmentRegexes = precompileSegmentRegexes(segments);
|
|
43
|
+
walkGlob(cwd, segments, 0, cwd, "", results, dirCache, segmentRegexes);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Build final results, applying exclude filter
|
|
47
|
+
const stringResults = [];
|
|
48
|
+
const direntResults = [];
|
|
49
|
+
for (const [relPath, entry] of results) {
|
|
50
|
+
if (!relPath)
|
|
51
|
+
continue; // skip empty paths
|
|
52
|
+
if (excludePatternFn && excludePatternFn(relPath))
|
|
53
|
+
continue;
|
|
54
|
+
if (withFileTypes) {
|
|
55
|
+
const parts = relPath.split("/");
|
|
56
|
+
const name = parts.pop() ?? "";
|
|
57
|
+
const parentPath = cwd + (parts.length ? "/" + parts.join("/") : "");
|
|
58
|
+
const type = entry.handle?.type ?? 0;
|
|
59
|
+
const dirent = new Dirent(name, type, parentPath);
|
|
60
|
+
if (excludeUserFn && excludeUserFn(dirent))
|
|
61
|
+
continue;
|
|
62
|
+
direntResults.push(dirent);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
if (excludeUserFn && excludeUserFn(relPath))
|
|
66
|
+
continue;
|
|
67
|
+
stringResults.push(relPath);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return withFileTypes ? direntResults : stringResults;
|
|
71
|
+
}
|
|
@@ -1,85 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}>): void;
|
|
5
|
-
/** Test/reset helper. */
|
|
1
|
+
import type { FsPromises } from "./public-types.js";
|
|
2
|
+
import * as embedded from "./embedded.js";
|
|
3
|
+
export declare const registerVirtualFiles: typeof embedded.registerVirtualFiles;
|
|
6
4
|
export declare function clearVirtualFiles(): void;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
isSymbolicLink(): boolean;
|
|
13
|
-
isBlockDevice(): boolean;
|
|
14
|
-
isCharacterDevice(): boolean;
|
|
15
|
-
isFIFO(): boolean;
|
|
16
|
-
isSocket(): boolean;
|
|
17
|
-
get size(): number;
|
|
18
|
-
get mtime(): Date;
|
|
19
|
-
get mtimeMs(): number;
|
|
20
|
-
get birthtime(): Date;
|
|
21
|
-
get birthtimeMs(): number;
|
|
22
|
-
get ctime(): Date;
|
|
23
|
-
get ctimeMs(): number;
|
|
24
|
-
get atime(): Date;
|
|
25
|
-
get atimeMs(): number;
|
|
26
|
-
get mode(): 16877 | 33188;
|
|
27
|
-
get dev(): number;
|
|
28
|
-
get ino(): number;
|
|
29
|
-
get nlink(): number;
|
|
30
|
-
get uid(): number;
|
|
31
|
-
get gid(): number;
|
|
32
|
-
get rdev(): number;
|
|
33
|
-
get blksize(): number;
|
|
34
|
-
get blocks(): number;
|
|
35
|
-
}
|
|
36
|
-
export declare function readFileSync(path: unknown, options?: unknown): unknown;
|
|
37
|
-
export declare function readFile(path: unknown, options: unknown, callback?: (error: Error | null, data?: unknown) => void): void;
|
|
38
|
-
export declare function readdirSync(path: unknown): string[];
|
|
39
|
-
export declare function readdir(path: unknown, callback: (error: Error | null, entries?: string[]) => void): void;
|
|
40
|
-
export declare function existsSync(path: unknown): boolean;
|
|
41
|
-
export declare function statSync(path: unknown): Stats;
|
|
42
|
-
export declare function lstatSync(path: unknown): Stats;
|
|
43
|
-
export declare function stat(path: unknown, callback: (error: Error | null, stats?: Stats) => void): void;
|
|
44
|
-
export declare function realpathSync(path: unknown): string;
|
|
45
|
-
export declare const promises: {
|
|
46
|
-
readFile: (path: unknown, options?: unknown) => Promise<unknown>;
|
|
47
|
-
readdir: (path: unknown) => Promise<string[]>;
|
|
48
|
-
stat: (path: unknown) => Promise<Stats>;
|
|
49
|
-
lstat: (path: unknown) => Promise<Stats>;
|
|
50
|
-
realpath: (path: unknown) => Promise<string>;
|
|
51
|
-
access: (path: unknown) => Promise<void>;
|
|
52
|
-
};
|
|
53
|
-
export declare const constants: {
|
|
54
|
-
F_OK: number;
|
|
55
|
-
R_OK: number;
|
|
56
|
-
W_OK: number;
|
|
57
|
-
X_OK: number;
|
|
58
|
-
};
|
|
59
|
-
declare const _default: {
|
|
60
|
-
readFileSync: typeof readFileSync;
|
|
61
|
-
readFile: typeof readFile;
|
|
62
|
-
readdirSync: typeof readdirSync;
|
|
63
|
-
readdir: typeof readdir;
|
|
64
|
-
existsSync: typeof existsSync;
|
|
65
|
-
statSync: typeof statSync;
|
|
66
|
-
lstatSync: typeof lstatSync;
|
|
67
|
-
stat: typeof stat;
|
|
68
|
-
realpathSync: typeof realpathSync;
|
|
69
|
-
promises: {
|
|
70
|
-
readFile: (path: unknown, options?: unknown) => Promise<unknown>;
|
|
71
|
-
readdir: (path: unknown) => Promise<string[]>;
|
|
72
|
-
stat: (path: unknown) => Promise<Stats>;
|
|
73
|
-
lstat: (path: unknown) => Promise<Stats>;
|
|
74
|
-
realpath: (path: unknown) => Promise<string>;
|
|
75
|
-
access: (path: unknown) => Promise<void>;
|
|
76
|
-
};
|
|
77
|
-
constants: {
|
|
78
|
-
F_OK: number;
|
|
79
|
-
R_OK: number;
|
|
80
|
-
W_OK: number;
|
|
81
|
-
X_OK: number;
|
|
82
|
-
};
|
|
83
|
-
Stats: typeof Stats;
|
|
5
|
+
declare const promises: FsPromises;
|
|
6
|
+
export { promises };
|
|
7
|
+
export declare const Dir: any, Dirent: any, F_OK: any, FileReadStream: any, FileWriteStream: any, R_OK: any, ReadStream: any, Stats: any, W_OK: any, WriteStream: any, X_OK: any, access: any, accessSync: any, appendFile: any, appendFileSync: any, chmod: any, chmodSync: any, chown: any, chownSync: any, close: any, closeSync: any, constants: any, copyFile: any, copyFileSync: any, cp: any, cpSync: any, createReadStream: any, createWriteStream: any, exists: any, existsSync: any, fchmod: any, fchmodSync: any, fchown: any, fchownSync: any, fdatasync: any, fdatasyncSync: any, fstat: any, fstatSync: any, fsync: any, fsyncSync: any, ftruncate: any, ftruncateSync: any, futimes: any, futimesSync: any, glob: any, globSync: any, lchmod: any, lchmodSync: any, lchown: any, lchownSync: any, link: any, linkSync: any, lstat: any, lstatSync: any, lutimes: any, lutimesSync: any, mkdir: any, mkdirSync: any, mkdtemp: any, mkdtempSync: any, open: any, openAsBlob: any, openSync: any, opendir: any, opendirSync: any, read: any, readFile: any, readFileSync: any, readSync: any, readdir: any, readdirSync: any, readlink: any, readlinkSync: any, readv: any, readvSync: any, realpath: any, realpathSync: any, rename: any, renameSync: any, rm: any, rmSync: any, rmdir: any, rmdirSync: any, stat: any, statSync: any, statfs: any, statfsSync: any, symlink: any, symlinkSync: any, truncate: any, truncateSync: any, unlink: any, unlinkSync: any, unwatchFile: any, utimes: any, utimesSync: any, watch: any, watchFile: any, write: any, writeFile: any, writeFileSync: any, writeSync: any, writev: any, writevSync: any;
|
|
8
|
+
declare const _default: Record<string, any> & {
|
|
9
|
+
promises: FsPromises;
|
|
84
10
|
};
|
|
85
11
|
export default _default;
|