@rsbuild/core 2.0.0-beta.1 → 2.0.0-beta.11

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.
Files changed (132) hide show
  1. package/compiled/chokidar/index.d.ts +197 -29
  2. package/compiled/chokidar/package.json +1 -1
  3. package/compiled/connect-next/index.d.ts +56 -0
  4. package/compiled/connect-next/license +26 -0
  5. package/compiled/connect-next/package.json +1 -0
  6. package/compiled/cors/index.d.ts +56 -0
  7. package/compiled/cors/license +22 -0
  8. package/compiled/cors/package.json +1 -0
  9. package/compiled/css-loader/index.js +2 -2
  10. package/compiled/css-loader/package.json +1 -1
  11. package/compiled/html-rspack-plugin/index.js +29 -74
  12. package/compiled/html-rspack-plugin/package.json +1 -1
  13. package/compiled/jiti/LICENSE +21 -0
  14. package/compiled/jiti/README.md +243 -0
  15. package/compiled/jiti/dist/babel.cjs +46699 -0
  16. package/compiled/jiti/dist/jiti.cjs +4842 -0
  17. package/compiled/jiti/lib/jiti-cli.mjs +19 -0
  18. package/compiled/jiti/lib/jiti-hooks.mjs +89 -0
  19. package/compiled/jiti/lib/jiti-native.mjs +76 -0
  20. package/compiled/jiti/lib/jiti-register.d.mts +1 -0
  21. package/compiled/jiti/lib/jiti-register.mjs +2 -0
  22. package/compiled/jiti/lib/jiti.cjs +24 -0
  23. package/compiled/jiti/lib/jiti.d.cts +8 -0
  24. package/compiled/jiti/lib/jiti.d.mts +8 -0
  25. package/compiled/jiti/lib/jiti.mjs +23 -0
  26. package/compiled/jiti/lib/types.d.ts +363 -0
  27. package/compiled/jiti/package.json +133 -0
  28. package/compiled/postcss/index.js +1 -1
  29. package/compiled/postcss/lib/at-rule.d.ts +1 -1
  30. package/compiled/postcss/lib/comment.d.ts +1 -1
  31. package/compiled/postcss/lib/container.d.ts +1 -1
  32. package/compiled/postcss/lib/css-syntax-error.d.ts +1 -1
  33. package/compiled/postcss/lib/declaration.d.ts +1 -1
  34. package/compiled/postcss/lib/document.d.ts +1 -1
  35. package/compiled/postcss/lib/input.d.ts +1 -1
  36. package/compiled/postcss/lib/lazy-result.d.ts +1 -1
  37. package/compiled/postcss/lib/no-work-result.d.ts +1 -1
  38. package/compiled/postcss/lib/node.d.ts +1 -1
  39. package/compiled/postcss/lib/previous-map.d.ts +1 -1
  40. package/compiled/postcss/lib/processor.d.ts +1 -1
  41. package/compiled/postcss/lib/result.d.ts +1 -1
  42. package/compiled/postcss/lib/root.d.ts +1 -1
  43. package/compiled/postcss/lib/rule.d.ts +1 -1
  44. package/compiled/postcss/lib/stringifier.d.ts +1 -1
  45. package/compiled/postcss/lib/warning.d.ts +1 -1
  46. package/compiled/postcss/package.json +1 -1
  47. package/compiled/postcss-loader/index.js +10 -9
  48. package/compiled/postcss-loader/package.json +1 -1
  49. package/compiled/rslog/index.d.ts +34 -3
  50. package/compiled/rslog/package.json +1 -1
  51. package/compiled/rspack-chain/package.json +1 -1
  52. package/compiled/rspack-chain/types/index.d.ts +0 -5
  53. package/compiled/rspack-manifest-plugin/index.d.ts +48 -0
  54. package/compiled/rspack-manifest-plugin/license +21 -0
  55. package/compiled/rspack-manifest-plugin/package.json +1 -0
  56. package/compiled/style-loader/index.js +37 -94
  57. package/compiled/style-loader/package.json +1 -1
  58. package/dist/{rslib-runtime.js → 1~rslib-runtime.js} +4 -4
  59. package/dist/{131.js → 552.js} +1753 -1573
  60. package/dist/chokidar.js +60 -57
  61. package/dist/client/hmr.js +3 -3
  62. package/dist/client/overlay.js +2 -2
  63. package/dist/connect-next.js +264 -0
  64. package/dist/{connect.js.LICENSE.txt → connect-next.js.LICENSE.txt} +3 -13
  65. package/dist/cors.js +3 -3
  66. package/dist/debug.js +503 -0
  67. package/dist/http-proxy-middleware.js +2947 -0
  68. package/dist/http-proxy-middleware.js.LICENSE.txt +69 -0
  69. package/dist/index.js +1 -1
  70. package/dist/launch-editor-middleware.js +81 -20
  71. package/dist/manifest-plugin.js +12 -19
  72. package/dist/memfs.js +223 -781
  73. package/dist/open.js +32 -28
  74. package/dist/range-parser.js +3 -3
  75. package/dist/remapping.js +2 -2
  76. package/dist/sirv.js +18 -18
  77. package/dist/tinyglobby.js +115 -70
  78. package/dist/transformLoader.mjs +38 -1
  79. package/dist/transformRawLoader.mjs +1 -1
  80. package/dist/ws.js +1513 -0
  81. package/dist-types/createContext.d.ts +3 -2
  82. package/dist-types/helpers/format.d.ts +2 -1
  83. package/dist-types/helpers/fs.d.ts +2 -1
  84. package/dist-types/helpers/index.d.ts +1 -1
  85. package/dist-types/helpers/stats.d.ts +4 -3
  86. package/dist-types/helpers/vendors.d.ts +0 -2
  87. package/dist-types/hooks.d.ts +3 -3
  88. package/dist-types/index.d.ts +4 -3
  89. package/dist-types/initPlugins.d.ts +2 -1
  90. package/dist-types/logger.d.ts +9 -3
  91. package/dist-types/pluginManager.d.ts +2 -1
  92. package/dist-types/restart.d.ts +4 -2
  93. package/dist-types/server/assets-middleware/index.d.ts +3 -2
  94. package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +2 -1
  95. package/dist-types/server/cliShortcuts.d.ts +4 -1
  96. package/dist-types/server/devMiddlewares.d.ts +4 -6
  97. package/dist-types/server/devServer.d.ts +8 -42
  98. package/dist-types/server/helper.d.ts +50 -16
  99. package/dist-types/server/historyApiFallback.d.ts +2 -1
  100. package/dist-types/server/middlewares.d.ts +5 -3
  101. package/dist-types/server/open.d.ts +4 -2
  102. package/dist-types/server/previewServer.d.ts +4 -0
  103. package/dist-types/server/proxy.d.ts +3 -2
  104. package/dist-types/server/runner/asModule.d.ts +1 -1
  105. package/dist-types/server/serverSetup.d.ts +2 -0
  106. package/dist-types/server/socketServer.d.ts +4 -1
  107. package/dist-types/server/watchFiles.d.ts +1 -1
  108. package/dist-types/types/config.d.ts +110 -17
  109. package/dist-types/types/context.d.ts +3 -0
  110. package/dist-types/types/hooks.d.ts +17 -15
  111. package/dist-types/types/plugin.d.ts +14 -11
  112. package/dist-types/types/rsbuild.d.ts +11 -4
  113. package/dist-types/types/thirdParty.d.ts +15 -6
  114. package/package.json +25 -28
  115. package/types.d.ts +1 -1
  116. package/compiled/chokidar/handler.d.ts +0 -90
  117. package/compiled/http-proxy-middleware/index.js +0 -6132
  118. package/compiled/ws/index.d.ts +0 -437
  119. package/compiled/ws/index.js +0 -3166
  120. package/compiled/ws/license +0 -20
  121. package/compiled/ws/package.json +0 -1
  122. package/dist/397.js +0 -11
  123. package/dist/7.js +0 -1
  124. package/dist/743.js +0 -7
  125. package/dist/88.js +0 -40
  126. package/dist/connect.js +0 -581
  127. package/dist-types/server/prodServer.d.ts +0 -24
  128. /package/compiled/html-rspack-plugin/{loader.js → htmlLoader.js} +0 -0
  129. /package/dist/{131.js.LICENSE.txt → 552.js.LICENSE.txt} +0 -0
  130. /package/dist/client/{59.js → 797.js} +0 -0
  131. /package/dist/{710.js → mrmime.js} +0 -0
  132. /package/dist/{31.js → trace-mapping.js} +0 -0
package/dist/open.js CHANGED
@@ -1,20 +1,23 @@
1
1
  let isDockerCached, cachedResult, canAccessPowerShellPromise, mountPoint, defaultMountPoint;
2
- import { __webpack_require__ } from "./rslib-runtime.js";
3
- import node_child_process, { execFile } from "node:child_process";
4
- import { node_process, node_os, external_node_util_promisify } from "./131.js";
5
- import "./743.js";
6
- import { constants, promises } from "./7.js";
7
- let external_node_fs_ = __webpack_require__("node:fs");
2
+ import node_process from "node:process";
3
+ import node_path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import node_child_process, { execFile as external_node_child_process_execFile } from "node:child_process";
6
+ import promises, { constants } from "node:fs/promises";
7
+ import { promisify } from "node:util";
8
+ import node_os from "node:os";
9
+ import node_fs from "node:fs";
10
+ import { Buffer } from "node:buffer";
8
11
  function hasDockerEnv() {
9
12
  try {
10
- return external_node_fs_.default.statSync('/.dockerenv'), !0;
13
+ return node_fs.statSync('/.dockerenv'), !0;
11
14
  } catch {
12
15
  return !1;
13
16
  }
14
17
  }
15
18
  function hasDockerCGroup() {
16
19
  try {
17
- return external_node_fs_.default.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
20
+ return node_fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
18
21
  } catch {
19
22
  return !1;
20
23
  }
@@ -25,7 +28,7 @@ function isDocker() {
25
28
  function isInsideContainer() {
26
29
  return void 0 === cachedResult && (cachedResult = (()=>{
27
30
  try {
28
- return external_node_fs_.default.statSync('/run/.containerenv'), !0;
31
+ return node_fs.statSync('/run/.containerenv'), !0;
29
32
  } catch {
30
33
  return !1;
31
34
  }
@@ -35,13 +38,12 @@ let isWsl = ()=>{
35
38
  if ('linux' !== node_process.platform) return !1;
36
39
  if (node_os.release().toLowerCase().includes('microsoft')) return !isInsideContainer();
37
40
  try {
38
- return !!external_node_fs_.default.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft') && !isInsideContainer();
39
- } catch {
40
- return !1;
41
- }
42
- }, is_wsl = node_process.env.__IS_WSL_TEST__ ? isWsl : isWsl(), external_node_buffer_ = __webpack_require__("node:buffer"), powershell_utils_execFile = external_node_util_promisify(node_child_process.execFile), powerShellPath = ()=>`${node_process.env.SYSTEMROOT || node_process.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, executePowerShell = async (command, options = {})=>{
41
+ if (node_fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) return !isInsideContainer();
42
+ } catch {}
43
+ return !!(node_fs.existsSync('/proc/sys/fs/binfmt_misc/WSLInterop') || node_fs.existsSync('/run/WSL')) && !isInsideContainer();
44
+ }, is_wsl = node_process.env.__IS_WSL_TEST__ ? isWsl : isWsl(), execFile = promisify(node_child_process.execFile), powerShellPath = ()=>`${node_process.env.SYSTEMROOT || node_process.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, executePowerShell = async (command, options = {})=>{
43
45
  let { powerShellPath: psPath, ...execFileOptions } = options, encodedCommand = executePowerShell.encodeCommand(command);
44
- return powershell_utils_execFile(psPath ?? powerShellPath(), [
46
+ return execFile(psPath ?? powerShellPath(), [
45
47
  ...executePowerShell.argumentsPrefix,
46
48
  encodedCommand
47
49
  ], {
@@ -62,8 +64,8 @@ executePowerShell.argumentsPrefix = [
62
64
  '-ExecutionPolicy',
63
65
  'Bypass',
64
66
  '-EncodedCommand'
65
- ], executePowerShell.encodeCommand = (command)=>external_node_buffer_.Buffer.from(command, 'utf16le').toString('base64'), executePowerShell.escapeArgument = (value)=>`'${String(value).replaceAll('\'', '\'\'')}'`;
66
- let wsl_utils_execFile = external_node_util_promisify(node_child_process.execFile), wslDrivesMountPoint = (defaultMountPoint = '/mnt/', async function() {
67
+ ], executePowerShell.encodeCommand = (command)=>Buffer.from(command, 'utf16le').toString('base64'), executePowerShell.escapeArgument = (value)=>`'${String(value).replaceAll('\'', '\'\'')}'`;
68
+ let wsl_utils_execFile = promisify(node_child_process.execFile), wslDrivesMountPoint = (defaultMountPoint = '/mnt/', async function() {
67
69
  if (mountPoint) return mountPoint;
68
70
  let configFilePath = '/etc/wsl.conf', isConfigFileExists = !1;
69
71
  try {
@@ -121,7 +123,7 @@ function defineLazyProperty(object, propertyName, valueGetter) {
121
123
  }
122
124
  }), object;
123
125
  }
124
- let execFileAsync = external_node_util_promisify(execFile);
126
+ let execFileAsync = promisify(external_node_child_process_execFile);
125
127
  async function defaultBrowserId() {
126
128
  if ('darwin' !== node_process.platform) throw Error('macOS only');
127
129
  let { stdout } = await execFileAsync('defaults', [
@@ -131,7 +133,7 @@ async function defaultBrowserId() {
131
133
  ]), match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout), browserId = match?.groups.id ?? 'com.apple.Safari';
132
134
  return 'com.apple.safari' === browserId ? 'com.apple.Safari' : browserId;
133
135
  }
134
- let run_applescript_execFileAsync = external_node_util_promisify(execFile);
136
+ let run_applescript_execFileAsync = promisify(external_node_child_process_execFile);
135
137
  async function runAppleScript(script, { humanReadableOutput = !0, signal } = {}) {
136
138
  if ('darwin' !== node_process.platform) throw Error('macOS only');
137
139
  let execOptions = {};
@@ -148,7 +150,7 @@ async function runAppleScript(script, { humanReadableOutput = !0, signal } = {})
148
150
  async function bundleName(bundleId) {
149
151
  return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
150
152
  }
151
- let windows_execFileAsync = external_node_util_promisify(execFile), windowsBrowserProgIds = {
153
+ let windows_execFileAsync = promisify(external_node_child_process_execFile), windowsBrowserProgIds = {
152
154
  MSEdgeHTM: {
153
155
  name: 'Edge',
154
156
  id: 'com.microsoft.edge'
@@ -224,11 +226,13 @@ async function defaultBrowser(_execFileAsync = windows_execFileAsync) {
224
226
  'ProgId'
225
227
  ]), match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
226
228
  if (!match) throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
227
- let { id } = match.groups, browser = windowsBrowserProgIds[id];
228
- if (!browser) throw new UnknownBrowserError(`Unknown browser ID: ${id}`);
229
- return browser;
229
+ let { id } = match.groups, dotIndex = id.lastIndexOf('.'), hyphenIndex = id.lastIndexOf('-'), baseIdByDot = -1 === dotIndex ? void 0 : id.slice(0, dotIndex), baseIdByHyphen = -1 === hyphenIndex ? void 0 : id.slice(0, hyphenIndex);
230
+ return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? {
231
+ name: id,
232
+ id
233
+ };
230
234
  }
231
- let default_browser_execFileAsync = external_node_util_promisify(execFile);
235
+ let default_browser_execFileAsync = promisify(external_node_child_process_execFile);
232
236
  async function default_browser_defaultBrowser() {
233
237
  if ('darwin' === node_process.platform) {
234
238
  let id = await defaultBrowserId();
@@ -251,7 +255,7 @@ async function default_browser_defaultBrowser() {
251
255
  if ('win32' === node_process.platform) return defaultBrowser();
252
256
  throw Error('Only macOS, Linux, and Windows are supported');
253
257
  }
254
- let isInSsh = !!(node_process.env.SSH_CONNECTION || node_process.env.SSH_CLIENT || node_process.env.SSH_TTY), external_node_path_ = __webpack_require__("node:path"), external_node_url_ = __webpack_require__("node:url"), fallbackAttemptSymbol = Symbol('fallbackAttempt'), open_dirname = import.meta.url ? external_node_path_.default.dirname((0, external_node_url_.fileURLToPath)(import.meta.url)) : '', localXdgOpenPath = external_node_path_.default.join(open_dirname, 'xdg-open'), { platform: platform, arch: arch } = node_process, tryEachApp = async (apps, opener)=>{
258
+ let isInSsh = !!(node_process.env.SSH_CONNECTION || node_process.env.SSH_CLIENT || node_process.env.SSH_TTY), fallbackAttemptSymbol = Symbol('fallbackAttempt'), open_dirname = import.meta.url ? node_path.dirname(fileURLToPath(import.meta.url)) : '', localXdgOpenPath = node_path.join(open_dirname, 'xdg-open'), { platform: platform, arch: arch } = node_process, tryEachApp = async (apps, opener)=>{
255
259
  if (0 === apps.length) return;
256
260
  let errors = [];
257
261
  for (let app of apps)try {
@@ -425,11 +429,11 @@ defineLazyProperty(open_apps, 'chrome', ()=>detectPlatformBinary({
425
429
  })), defineLazyProperty(open_apps, 'safari', ()=>detectPlatformBinary({
426
430
  darwin: 'Safari'
427
431
  }));
428
- let node_modules_open = (target, options)=>{
432
+ export default ((target, options)=>{
429
433
  if ('string' != typeof target) throw TypeError('Expected a `target`');
430
434
  return baseOpen({
431
435
  ...options,
432
436
  target
433
437
  });
434
- };
435
- export { node_modules_open, open_apps };
438
+ });
439
+ export { open_apps as apps };
@@ -1,5 +1,5 @@
1
- /*! For license information please see range-parser.js.LICENSE.txt */
2
- import { __webpack_require__ } from "./rslib-runtime.js";
1
+ /*! LICENSE: range-parser.js.LICENSE.txt */
2
+ import { __webpack_require__ } from "./1~rslib-runtime.js";
3
3
  __webpack_require__.add({
4
4
  "../../node_modules/.pnpm/range-parser@1.2.1/node_modules/range-parser/index.js" (module) {
5
5
  function combineRanges(ranges) {
@@ -46,4 +46,4 @@ __webpack_require__.add({
46
46
  return ranges.length < 1 ? -1 : options && options.combine ? combineRanges(ranges) : ranges;
47
47
  };
48
48
  }
49
- });
49
+ }), __webpack_require__("../../node_modules/.pnpm/range-parser@1.2.1/node_modules/range-parser/index.js");
package/dist/remapping.js CHANGED
@@ -1,4 +1,4 @@
1
- import { decodedMappings as trace_mapping_decodedMappings, sourcemap_codec_encode, traceSegment, TraceMap as trace_mapping_TraceMap } from "./31.js";
1
+ import { decodedMappings as trace_mapping_decodedMappings, sourcemap_codec_encode, traceSegment, TraceMap as trace_mapping_TraceMap } from "./trace-mapping.js";
2
2
  var SetArray = class {
3
3
  constructor(){
4
4
  this._indexes = {
@@ -193,4 +193,4 @@ function remapping(input, loader, options) {
193
193
  decodedMappings: !1
194
194
  });
195
195
  }
196
- export { remapping };
196
+ export default remapping;
package/dist/sirv.js CHANGED
@@ -1,14 +1,14 @@
1
- import { __webpack_require__ } from "./rslib-runtime.js";
2
- import { parse } from "node:querystring";
3
- import "./131.js";
4
- import { lookup as mrmime_lookup } from "./710.js";
5
- let external_path_ = __webpack_require__("path"), external_fs_ = __webpack_require__("fs");
1
+ import { join, normalize, resolve, sep } from "node:path";
2
+ import { join as external_path_join, resolve as external_path_resolve } from "path";
3
+ import { readdirSync, statSync } from "fs";
4
+ import { lookup as mrmime_lookup } from "./mrmime.js";
5
+ import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
6
+ import * as __rspack_external_node_querystring_aeb3c0b4 from "node:querystring";
6
7
  function totalist(dir, callback, pre = '') {
7
- dir = (0, external_path_.resolve)('.', dir);
8
- let arr = (0, external_fs_.readdirSync)(dir), i = 0, abs, stats;
9
- for(; i < arr.length; i++)abs = (0, external_path_.join)(dir, arr[i]), (stats = (0, external_fs_.statSync)(abs)).isDirectory() ? totalist(abs, callback, (0, external_path_.join)(pre, arr[i])) : callback((0, external_path_.join)(pre, arr[i]), abs, stats);
8
+ let arr = readdirSync(dir = external_path_resolve('.', dir)), i = 0, abs, stats;
9
+ for(; i < arr.length; i++)(stats = statSync(abs = external_path_join(dir, arr[i]))).isDirectory() ? totalist(abs, callback, external_path_join(pre, arr[i])) : callback(external_path_join(pre, arr[i]), abs, stats);
10
10
  }
11
- function build_parse(req) {
11
+ function parse(req) {
12
12
  let raw = req.url;
13
13
  if (null == raw) return;
14
14
  let prev = req._parsedUrl;
@@ -16,7 +16,7 @@ function build_parse(req) {
16
16
  let pathname = raw, search = '', query, hash;
17
17
  if (raw.length > 1) {
18
18
  let idx = raw.indexOf('#', 1);
19
- -1 !== idx && (hash = raw.substring(idx), pathname = raw.substring(0, idx)), -1 !== (idx = pathname.indexOf('?', 1)) && (search = pathname.substring(idx), pathname = pathname.substring(0, idx), search.length > 1 && (query = parse(search.substring(1))));
19
+ -1 !== idx && (hash = raw.substring(idx), pathname = raw.substring(0, idx)), -1 !== (idx = pathname.indexOf('?', 1)) && (search = pathname.substring(idx), pathname = pathname.substring(0, idx), search.length > 1 && (query = __rspack_external_node_querystring_aeb3c0b4.parse(search.substring(1))));
20
20
  }
21
21
  return req._parsedUrl = {
22
22
  pathname,
@@ -26,7 +26,7 @@ function build_parse(req) {
26
26
  raw
27
27
  };
28
28
  }
29
- let external_node_fs_ = __webpack_require__("node:fs"), external_node_path_ = __webpack_require__("node:path"), noop = ()=>{};
29
+ let noop = ()=>{};
30
30
  function isMatch(uri, arr) {
31
31
  for(let i = 0; i < arr.length; i++)if (arr[i].test(uri)) return !0;
32
32
  }
@@ -43,8 +43,8 @@ function viaCache(cache, uri, extns) {
43
43
  }
44
44
  function viaLocal(dir, isEtag, uri, extns) {
45
45
  let abs, stats, name, headers, i = 0, arr = toAssume(uri, extns);
46
- for(; i < arr.length; i++)if ((abs = (0, external_node_path_.normalize)((0, external_node_path_.join)(dir, name = arr[i]))).startsWith(dir) && external_node_fs_.existsSync(abs)) {
47
- if ((stats = external_node_fs_.statSync(abs)).isDirectory()) continue;
46
+ for(; i < arr.length; i++)if ((abs = normalize(join(dir, name = arr[i]))).startsWith(dir) && __rspack_external_node_fs_5ea92f0c.existsSync(abs)) {
47
+ if ((stats = __rspack_external_node_fs_5ea92f0c.statSync(abs)).isDirectory()) continue;
48
48
  return (headers = toHeaders(name, stats, isEtag))['Cache-Control'] = isEtag ? 'no-cache' : 'no-store', {
49
49
  abs,
50
50
  stats,
@@ -66,7 +66,7 @@ function send(req, res, file, stats, headers) {
66
66
  if (end >= stats.size && (end = stats.size - 1), start >= stats.size) return res.setHeader('Content-Range', `bytes */${stats.size}`), res.statusCode = 416, res.end();
67
67
  headers['Content-Range'] = `bytes ${start}-${end}/${stats.size}`, headers['Content-Length'] = end - start + 1, headers['Accept-Ranges'] = 'bytes';
68
68
  }
69
- res.writeHead(code, headers), external_node_fs_.createReadStream(file, opts).pipe(res);
69
+ res.writeHead(code, headers), __rspack_external_node_fs_5ea92f0c.createReadStream(file, opts).pipe(res);
70
70
  }
71
71
  let ENCODING = {
72
72
  '.br': 'br',
@@ -83,7 +83,7 @@ function toHeaders(name, stats, isEtag) {
83
83
  return enc && (headers['Content-Encoding'] = enc), isEtag && (headers.ETag = `W/"${stats.size}-${stats.mtime.getTime()}"`), headers;
84
84
  }
85
85
  function build(dir, opts = {}) {
86
- dir = (0, external_node_path_.resolve)(dir || '.');
86
+ dir = resolve(dir || '.');
87
87
  let isNotFound = opts.onNoMatch || is404, setHeaders = opts.setHeaders || noop, extensions = opts.extensions || [
88
88
  'html',
89
89
  'htm'
@@ -107,11 +107,11 @@ function build(dir, opts = {}) {
107
107
  headers
108
108
  };
109
109
  });
110
- let lookup = opts.dev ? viaLocal.bind(0, dir + external_node_path_.sep, isEtag) : viaCache.bind(0, FILES);
110
+ let lookup = opts.dev ? viaLocal.bind(0, dir + sep, isEtag) : viaCache.bind(0, FILES);
111
111
  return function(req, res, next) {
112
112
  let extns = [
113
113
  ''
114
- ], pathname = build_parse(req).pathname, val = req.headers['accept-encoding'] || '';
114
+ ], pathname = parse(req).pathname, val = req.headers['accept-encoding'] || '';
115
115
  if (gzips && val.includes('gzip') && extns.unshift(...gzips), brots && /(br|brotli)/i.test(val) && extns.unshift(...brots), extns.push(...extensions), -1 !== pathname.indexOf('%')) try {
116
116
  pathname = decodeURI(pathname);
117
117
  } catch (err) {}
@@ -119,4 +119,4 @@ function build(dir, opts = {}) {
119
119
  return data ? isEtag && req.headers['if-none-match'] === data.headers.ETag ? (res.writeHead(304), res.end()) : void ((gzips || brots) && res.setHeader('Vary', 'Accept-Encoding'), setHeaders(res, pathname, data.stats), send(req, res, data.abs, data.stats, data.headers)) : next ? next() : isNotFound(req, res);
120
120
  };
121
121
  }
122
- export { build };
122
+ export default build;
@@ -1,6 +1,8 @@
1
- import { __webpack_require__ } from "./rslib-runtime.js";
1
+ import fs_0, * as __rspack_external_fs from "fs";
2
+ import path_0, { basename, dirname, normalize, posix, relative as external_path_relative, resolve, sep } from "path";
3
+ import { fileURLToPath } from "url";
2
4
  import { createRequire } from "module";
3
- import "./131.js";
5
+ import { __webpack_require__ } from "./1~rslib-runtime.js";
4
6
  __webpack_require__.add({
5
7
  "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
6
8
  let pico = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js"), utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js");
@@ -942,11 +944,10 @@ __webpack_require__.add({
942
944
  };
943
945
  }
944
946
  });
945
- let external_path_ = __webpack_require__("path"), external_fs_ = __webpack_require__("fs");
946
947
  var __require = createRequire(import.meta.url);
947
948
  function cleanPath(path) {
948
- let normalized = (0, external_path_.normalize)(path);
949
- return normalized.length > 1 && normalized[normalized.length - 1] === external_path_.sep && (normalized = normalized.substring(0, normalized.length - 1)), normalized;
949
+ let normalized = normalize(path);
950
+ return normalized.length > 1 && normalized[normalized.length - 1] === sep && (normalized = normalized.substring(0, normalized.length - 1)), normalized;
950
951
  }
951
952
  let SLASHES_REGEX = /[\\/]/g;
952
953
  function convertSlashes(path, separator) {
@@ -958,14 +959,14 @@ function isRootDirectory(path) {
958
959
  }
959
960
  function normalizePath(path, options) {
960
961
  let { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options, pathNeedsCleaning = "win32" === process.platform && path.includes("/") || path.startsWith(".");
961
- return (resolvePaths && (path = (0, external_path_.resolve)(path)), (normalizePath$1 || pathNeedsCleaning) && (path = cleanPath(path)), "." === path) ? "" : convertSlashes(path[path.length - 1] !== pathSeparator ? path + pathSeparator : path, pathSeparator);
962
+ return (resolvePaths && (path = resolve(path)), (normalizePath$1 || pathNeedsCleaning) && (path = cleanPath(path)), "." === path) ? "" : convertSlashes(path[path.length - 1] !== pathSeparator ? path + pathSeparator : path, pathSeparator);
962
963
  }
963
964
  function joinPathWithBasePath(filename, directoryPath) {
964
965
  return directoryPath + filename;
965
966
  }
966
967
  function joinPathWithRelativePath(root, options) {
967
968
  return function(filename, directoryPath) {
968
- return directoryPath.startsWith(root) ? directoryPath.slice(root.length) + filename : convertSlashes((0, external_path_.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
969
+ return directoryPath.startsWith(root) ? directoryPath.slice(root.length) + filename : convertSlashes(external_path_relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
969
970
  };
970
971
  }
971
972
  function joinPath(filename) {
@@ -1050,10 +1051,10 @@ function build$2(options, isSynchronous) {
1050
1051
  }
1051
1052
  function isRecursive(path, resolved, state) {
1052
1053
  if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
1053
- let parent = (0, external_path_.dirname)(path), depth = 1;
1054
+ let parent = dirname(path), depth = 1;
1054
1055
  for(; parent !== state.root && depth < 2;){
1055
1056
  let resolvedPath = state.symlinks.get(parent);
1056
- resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath)) ? depth++ : parent = (0, external_path_.dirname)(parent);
1057
+ resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath)) ? depth++ : parent = dirname(parent);
1057
1058
  }
1058
1059
  return state.symlinks.set(path, resolved), depth > 1;
1059
1060
  }
@@ -1152,7 +1153,7 @@ var Queue = class {
1152
1153
  ""
1153
1154
  ].slice(0, 0),
1154
1155
  controller: new Aborter(),
1155
- fs: options.fs || external_fs_
1156
+ fs: options.fs || __rspack_external_fs
1156
1157
  }, this.joinPath = build$7(this.root, options), this.pushDirectory = build$6(this.root, options), this.pushFile = build$5(options), this.getArray = build$4(options), this.groupFiles = build$3(options), this.resolveSymlink = build$2(options, this.isSynchronous), this.walkDirectory = build(this.isSynchronous);
1157
1158
  }
1158
1159
  start() {
@@ -1176,8 +1177,7 @@ var Queue = class {
1176
1177
  this.resolveSymlink(path, this.state, (stat, resolvedPath)=>{
1177
1178
  if (stat.isDirectory()) resolvedPath = normalizePath(resolvedPath, this.state.options), exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator) || this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
1178
1179
  else {
1179
- resolvedPath = useRealPaths ? resolvedPath : path;
1180
- let filename = (0, external_path_.basename)(resolvedPath), directoryPath$1 = normalizePath((0, external_path_.dirname)(resolvedPath), this.state.options);
1180
+ let filename = basename(resolvedPath = useRealPaths ? resolvedPath : path), directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options);
1181
1181
  resolvedPath = this.joinPath(filename, directoryPath$1), this.pushFile(resolvedPath, files, this.state.counts, filters);
1182
1182
  }
1183
1183
  });
@@ -1197,7 +1197,7 @@ function promise(root, options) {
1197
1197
  function callback(root, options, callback$1) {
1198
1198
  new Walker(root, options, callback$1).start();
1199
1199
  }
1200
- function dist_sync(root, options) {
1200
+ function sync(root, options) {
1201
1201
  return new Walker(root, options).start();
1202
1202
  }
1203
1203
  var APIBuilder = class {
@@ -1211,7 +1211,7 @@ var APIBuilder = class {
1211
1211
  callback(this.root, this.options, cb);
1212
1212
  }
1213
1213
  sync() {
1214
- return dist_sync(this.root, this.options);
1214
+ return sync(this.root, this.options);
1215
1215
  }
1216
1216
  };
1217
1217
  let pm = null;
@@ -1223,7 +1223,7 @@ var Builder = class {
1223
1223
  options = {
1224
1224
  maxDepth: 1 / 0,
1225
1225
  suppressErrors: !0,
1226
- pathSeparator: external_path_.sep,
1226
+ pathSeparator: sep,
1227
1227
  filters: []
1228
1228
  };
1229
1229
  globFunction;
@@ -1305,26 +1305,26 @@ var Builder = class {
1305
1305
  return isMatch || (isMatch = globFn(patterns, ...options), this.globCache[patterns.join("\0")] = isMatch), this.options.filters.push((path)=>isMatch(path)), this;
1306
1306
  }
1307
1307
  };
1308
- let picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js"), ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
1309
- function getPartialMatcher(patterns, options) {
1310
- let patternsCount = patterns.length, patternsParts = Array(patternsCount), regexes = Array(patternsCount);
1308
+ let picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js"), isReadonlyArray = Array.isArray, isWin = "win32" === process.platform, ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
1309
+ function getPartialMatcher(patterns, options = {}) {
1310
+ let patternsCount = patterns.length, patternsParts = Array(patternsCount), matchers = Array(patternsCount), globstarEnabled = !options.noglobstar;
1311
1311
  for(let i = 0; i < patternsCount; i++){
1312
1312
  let parts = splitPattern(patterns[i]);
1313
1313
  patternsParts[i] = parts;
1314
- let partsCount = parts.length, partRegexes = Array(partsCount);
1315
- for(let j = 0; j < partsCount; j++)partRegexes[j] = picomatch.makeRe(parts[j], options);
1316
- regexes[i] = partRegexes;
1314
+ let partsCount = parts.length, partMatchers = Array(partsCount);
1315
+ for(let j = 0; j < partsCount; j++)partMatchers[j] = picomatch(parts[j], options);
1316
+ matchers[i] = partMatchers;
1317
1317
  }
1318
1318
  return (input)=>{
1319
1319
  let inputParts = input.split("/");
1320
1320
  if (".." === inputParts[0] && ONLY_PARENT_DIRECTORIES.test(input)) return !0;
1321
1321
  for(let i = 0; i < patterns.length; i++){
1322
- let patternParts = patternsParts[i], regex = regexes[i], inputPatternCount = inputParts.length, minParts = Math.min(inputPatternCount, patternParts.length), j = 0;
1322
+ let patternParts = patternsParts[i], matcher = matchers[i], inputPatternCount = inputParts.length, minParts = Math.min(inputPatternCount, patternParts.length), j = 0;
1323
1323
  for(; j < minParts;){
1324
1324
  let part = patternParts[j];
1325
1325
  if (part.includes("/")) return !0;
1326
- if (!regex[j].test(inputParts[j])) break;
1327
- if ("**" === part) return !0;
1326
+ if (!matcher[j](inputParts[j])) break;
1327
+ if (globstarEnabled && "**" === part) return !0;
1328
1328
  j++;
1329
1329
  }
1330
1330
  if (j === inputPatternCount) return !0;
@@ -1332,6 +1332,32 @@ function getPartialMatcher(patterns, options) {
1332
1332
  return !1;
1333
1333
  };
1334
1334
  }
1335
+ let WIN32_ROOT_DIR = /^[A-Z]:\/$/i, isRoot = isWin ? (p)=>WIN32_ROOT_DIR.test(p) : (p)=>"/" === p;
1336
+ function buildFormat(cwd, root, absolute) {
1337
+ if (cwd === root || root.startsWith(`${cwd}/`)) {
1338
+ if (absolute) {
1339
+ let start = isRoot(cwd) ? cwd.length : cwd.length + 1;
1340
+ return (p, isDir)=>p.slice(start, isDir ? -1 : void 0) || ".";
1341
+ }
1342
+ let prefix = root.slice(cwd.length + 1);
1343
+ return prefix ? (p, isDir)=>{
1344
+ if ("." === p) return prefix;
1345
+ let result = `${prefix}/${p}`;
1346
+ return isDir ? result.slice(0, -1) : result;
1347
+ } : (p, isDir)=>isDir && "." !== p ? p.slice(0, -1) : p;
1348
+ }
1349
+ return absolute ? (p)=>posix.relative(cwd, p) || "." : (p)=>posix.relative(cwd, `${root}/${p}`) || ".";
1350
+ }
1351
+ function buildRelative(cwd, root) {
1352
+ if (root.startsWith(`${cwd}/`)) {
1353
+ let prefix = root.slice(cwd.length + 1);
1354
+ return (p)=>`${prefix}/${p}`;
1355
+ }
1356
+ return (p)=>{
1357
+ let result = posix.relative(cwd, `${root}/${p}`);
1358
+ return p.endsWith("/") && "" !== result ? `${result}/` : result || ".";
1359
+ };
1360
+ }
1335
1361
  let splitPatternOptions = {
1336
1362
  parts: !0
1337
1363
  };
@@ -1342,7 +1368,7 @@ function splitPattern(path$1) {
1342
1368
  path$1
1343
1369
  ];
1344
1370
  }
1345
- let isWin = "win32" === process.platform, POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g, WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g, escapePath = isWin ? (path$1)=>path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&") : (path$1)=>path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
1371
+ let POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g, WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g, escapePath = isWin ? (path$1)=>path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&") : (path$1)=>path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
1346
1372
  function isDynamicPattern(pattern, options) {
1347
1373
  if ((null == options ? void 0 : options.caseSensitiveMatch) === !1) return !0;
1348
1374
  let scan = picomatch.scan(pattern);
@@ -1356,12 +1382,12 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
1356
1382
  let result = pattern;
1357
1383
  pattern.endsWith("/") && (result = pattern.slice(0, -1)), !result.endsWith("*") && expandDirectories && (result += "/**");
1358
1384
  let escapedCwd = escapePath(cwd);
1359
- result = external_path_.default.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? external_path_.posix.relative(escapedCwd, result) : external_path_.posix.normalize(result);
1385
+ result = path_0.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
1360
1386
  let parentDirectoryMatch = PARENT_DIRECTORY.exec(result), parts = splitPattern(result);
1361
1387
  if (null == parentDirectoryMatch ? void 0 : parentDirectoryMatch[0]) {
1362
1388
  let n = (parentDirectoryMatch[0].length + 1) / 3, i = 0, cwdParts = escapedCwd.split("/");
1363
1389
  for(; i < n && parts[i + n] === cwdParts[cwdParts.length + i - n];)result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".", i++;
1364
- let potentialRoot = external_path_.posix.join(cwd, parentDirectoryMatch[0].slice(3 * i));
1390
+ let potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(3 * i));
1365
1391
  !potentialRoot.startsWith(".") && props.root.length > potentialRoot.length && (props.root = potentialRoot, props.depthOffset = -n + i);
1366
1392
  }
1367
1393
  if (!isIgnore && props.depthOffset >= 0) {
@@ -1376,15 +1402,15 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
1376
1402
  if (part !== props.commonPath[i] || isDynamicPattern(part) || i === parts.length - 1) break;
1377
1403
  newCommonPath.push(part);
1378
1404
  }
1379
- props.depthOffset = newCommonPath.length, props.commonPath = newCommonPath, props.root = newCommonPath.length > 0 ? external_path_.default.posix.join(cwd, ...newCommonPath) : cwd;
1405
+ props.depthOffset = newCommonPath.length, props.commonPath = newCommonPath, props.root = newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd;
1380
1406
  }
1381
1407
  return result;
1382
1408
  }
1383
- function processPatterns({ patterns, ignore = [], expandDirectories = !0 }, cwd, props) {
1384
- "string" == typeof patterns ? patterns = [
1409
+ function processPatterns({ patterns = [
1410
+ "**/*"
1411
+ ], ignore = [], expandDirectories = !0 }, cwd, props) {
1412
+ "string" == typeof patterns && (patterns = [
1385
1413
  patterns
1386
- ] : patterns || (patterns = [
1387
- "**/*"
1388
1414
  ]), "string" == typeof ignore && (ignore = [
1389
1415
  ignore
1390
1416
  ]);
@@ -1396,76 +1422,95 @@ function processPatterns({ patterns, ignore = [], expandDirectories = !0 }, cwd,
1396
1422
  ignore: ignorePatterns
1397
1423
  };
1398
1424
  }
1399
- function getRelativePath(path$1, cwd, root) {
1400
- return external_path_.posix.relative(cwd, `${root}/${path$1}`) || ".";
1401
- }
1402
- function processPath(path$1, cwd, root, isDirectory, absolute) {
1403
- let relativePath = absolute ? path$1.slice("/" === root ? 1 : root.length + 1) || "." : path$1;
1404
- return root === cwd ? isDirectory && "." !== relativePath ? relativePath.slice(0, -1) : relativePath : getRelativePath(relativePath, cwd, root);
1405
- }
1406
- function formatPaths(paths, cwd, root) {
1425
+ function formatPaths(paths, relative) {
1407
1426
  for(let i = paths.length - 1; i >= 0; i--){
1408
1427
  let path$1 = paths[i];
1409
- paths[i] = getRelativePath(path$1, cwd, root) + (!path$1 || path$1.endsWith("/") ? "/" : "");
1428
+ paths[i] = relative(path$1);
1410
1429
  }
1411
1430
  return paths;
1412
1431
  }
1413
- function crawl(options, cwd, sync) {
1414
- if (process.env.TINYGLOBBY_DEBUG && (options.debug = !0), options.debug && log("globbing with options:", options, "cwd:", cwd), Array.isArray(options.patterns) && 0 === options.patterns.length) return sync ? [] : Promise.resolve([]);
1432
+ function normalizeCwd(cwd) {
1433
+ return cwd ? cwd instanceof URL ? fileURLToPath(cwd).replace(BACKSLASHES, "/") : path_0.resolve(cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
1434
+ }
1435
+ function getCrawler(patterns, inputOptions = {}) {
1436
+ let options = process.env.TINYGLOBBY_DEBUG ? {
1437
+ ...inputOptions,
1438
+ debug: !0
1439
+ } : inputOptions, cwd = normalizeCwd(options.cwd);
1440
+ if (options.debug && log("globbing with:", {
1441
+ patterns,
1442
+ options,
1443
+ cwd
1444
+ }), Array.isArray(patterns) && 0 === patterns.length) return [
1445
+ {
1446
+ sync: ()=>[],
1447
+ withPromise: async ()=>[]
1448
+ },
1449
+ !1
1450
+ ];
1415
1451
  let props = {
1416
1452
  root: cwd,
1417
1453
  commonPath: null,
1418
1454
  depthOffset: 0
1419
- }, processed = processPatterns(options, cwd, props), nocase = !1 === options.caseSensitiveMatch;
1455
+ }, processed = processPatterns({
1456
+ ...options,
1457
+ patterns
1458
+ }, cwd, props);
1420
1459
  options.debug && log("internal processing patterns:", processed);
1421
- let matcher = picomatch(processed.match, {
1460
+ let matchOptions = {
1422
1461
  dot: options.dot,
1423
- nocase,
1462
+ nobrace: !1 === options.braceExpansion,
1463
+ nocase: !1 === options.caseSensitiveMatch,
1464
+ noextglob: !1 === options.extglob,
1465
+ noglobstar: !1 === options.globstar,
1466
+ posix: !0
1467
+ }, matcher = picomatch(processed.match, {
1468
+ ...matchOptions,
1424
1469
  ignore: processed.ignore
1425
- }), ignore = picomatch(processed.ignore, {
1426
- dot: options.dot,
1427
- nocase
1428
- }), partialMatcher = getPartialMatcher(processed.match, {
1429
- dot: options.dot,
1430
- nocase
1431
- }), fdirOptions = {
1470
+ }), ignore = picomatch(processed.ignore, matchOptions), partialMatcher = getPartialMatcher(processed.match, matchOptions), format = buildFormat(cwd, props.root, options.absolute), formatExclude = options.absolute ? format : buildFormat(cwd, props.root, !0), fdirOptions = {
1432
1471
  filters: [
1433
1472
  options.debug ? (p, isDirectory)=>{
1434
- let path$1 = processPath(p, cwd, props.root, isDirectory, options.absolute), matches = matcher(path$1);
1473
+ let path$1 = format(p, isDirectory), matches = matcher(path$1);
1435
1474
  return matches && log(`matched ${path$1}`), matches;
1436
- } : (p, isDirectory)=>matcher(processPath(p, cwd, props.root, isDirectory, options.absolute))
1475
+ } : (p, isDirectory)=>matcher(format(p, isDirectory))
1437
1476
  ],
1438
1477
  exclude: options.debug ? (_, p)=>{
1439
- let relativePath = processPath(p, cwd, props.root, !0, !0), skipped = "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
1478
+ let relativePath = formatExclude(p, !0), skipped = "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
1440
1479
  return skipped ? log(`skipped ${p}`) : log(`crawling ${p}`), skipped;
1441
1480
  } : (_, p)=>{
1442
- let relativePath = processPath(p, cwd, props.root, !0, !0);
1481
+ let relativePath = formatExclude(p, !0);
1443
1482
  return "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
1444
1483
  },
1484
+ fs: options.fs ? {
1485
+ readdir: options.fs.readdir || fs_0.readdir,
1486
+ readdirSync: options.fs.readdirSync || fs_0.readdirSync,
1487
+ realpath: options.fs.realpath || fs_0.realpath,
1488
+ realpathSync: options.fs.realpathSync || fs_0.realpathSync,
1489
+ stat: options.fs.stat || fs_0.stat,
1490
+ statSync: options.fs.statSync || fs_0.statSync
1491
+ } : void 0,
1445
1492
  pathSeparator: "/",
1446
1493
  relativePaths: !0,
1447
- resolveSymlinks: !0
1494
+ resolveSymlinks: !0,
1495
+ signal: options.signal
1448
1496
  };
1449
1497
  void 0 !== options.deep && (fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset)), options.absolute && (fdirOptions.relativePaths = !1, fdirOptions.resolvePaths = !0, fdirOptions.includeBasePath = !0), !1 === options.followSymbolicLinks && (fdirOptions.resolveSymlinks = !1, fdirOptions.excludeSymlinks = !0), options.onlyDirectories ? (fdirOptions.excludeFiles = !0, fdirOptions.includeDirs = !0) : !1 === options.onlyFiles && (fdirOptions.includeDirs = !0), props.root = props.root.replace(BACKSLASHES, "");
1450
1498
  let root = props.root;
1451
1499
  options.debug && log("internal properties:", props);
1452
- let api = new Builder(fdirOptions).crawl(root);
1453
- return cwd === root || options.absolute ? sync ? api.sync() : api.withPromise() : sync ? formatPaths(api.sync(), cwd, root) : api.withPromise().then((paths)=>formatPaths(paths, cwd, root));
1500
+ let relative = cwd !== root && !options.absolute && buildRelative(cwd, props.root);
1501
+ return [
1502
+ new Builder(fdirOptions).crawl(root),
1503
+ relative
1504
+ ];
1454
1505
  }
1455
1506
  async function glob(patternsOrOptions, options) {
1456
1507
  if (patternsOrOptions && (null == options ? void 0 : options.patterns)) throw Error("Cannot pass patterns as both an argument and an option");
1457
- let opts = Array.isArray(patternsOrOptions) || "string" == typeof patternsOrOptions ? {
1458
- ...options,
1459
- patterns: patternsOrOptions
1460
- } : patternsOrOptions, cwd = opts.cwd ? external_path_.default.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
1461
- return crawl(opts, cwd, !1);
1508
+ let isModern = isReadonlyArray(patternsOrOptions) || "string" == typeof patternsOrOptions, opts = isModern ? options : patternsOrOptions, [crawler, relative] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
1509
+ return relative ? formatPaths(await crawler.withPromise(), relative) : crawler.withPromise();
1462
1510
  }
1463
1511
  function globSync(patternsOrOptions, options) {
1464
1512
  if (patternsOrOptions && (null == options ? void 0 : options.patterns)) throw Error("Cannot pass patterns as both an argument and an option");
1465
- let opts = Array.isArray(patternsOrOptions) || "string" == typeof patternsOrOptions ? {
1466
- ...options,
1467
- patterns: patternsOrOptions
1468
- } : patternsOrOptions, cwd = opts.cwd ? external_path_.default.resolve(opts.cwd).replace(BACKSLASHES, "/") : process.cwd().replace(BACKSLASHES, "/");
1469
- return crawl(opts, cwd, !0);
1513
+ let isModern = isReadonlyArray(patternsOrOptions) || "string" == typeof patternsOrOptions, opts = isModern ? options : patternsOrOptions, [crawler, relative] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
1514
+ return relative ? formatPaths(crawler.sync(), relative) : crawler.sync();
1470
1515
  }
1471
1516
  export { glob, globSync };