@rslib/core 0.0.13 → 0.0.15

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.
@@ -2,7 +2,7 @@ type Formatter = (input: string | number | null | undefined) => string
2
2
 
3
3
  interface Colors {
4
4
  isColorSupported: boolean
5
-
5
+
6
6
  reset: Formatter
7
7
  bold: Formatter
8
8
  dim: Formatter
@@ -11,7 +11,7 @@ interface Colors {
11
11
  inverse: Formatter
12
12
  hidden: Formatter
13
13
  strikethrough: Formatter
14
-
14
+
15
15
  black: Formatter
16
16
  red: Formatter
17
17
  green: Formatter
@@ -21,7 +21,7 @@ interface Colors {
21
21
  cyan: Formatter
22
22
  white: Formatter
23
23
  gray: Formatter
24
-
24
+
25
25
  bgBlack: Formatter
26
26
  bgRed: Formatter
27
27
  bgGreen: Formatter
@@ -32,23 +32,22 @@ interface Colors {
32
32
  bgWhite: Formatter
33
33
 
34
34
  blackBright: Formatter
35
- redBright: Formatter
36
- greenBright: Formatter
37
- yellowBright: Formatter
38
- blueBright: Formatter
39
- magentaBright: Formatter
40
- cyanBright: Formatter
41
- whiteBright: Formatter
35
+ redBright: Formatter
36
+ greenBright: Formatter
37
+ yellowBright: Formatter
38
+ blueBright: Formatter
39
+ magentaBright: Formatter
40
+ cyanBright: Formatter
41
+ whiteBright: Formatter
42
42
 
43
43
  bgBlackBright: Formatter
44
- bgRedBright: Formatter
45
- bgGreenBright: Formatter
46
- bgYellowBright: Formatter
47
- bgBlueBright: Formatter
48
- bgMagentaBright: Formatter
49
- bgCyanBright: Formatter
50
- bgWhiteBright: Formatter
51
-
44
+ bgRedBright: Formatter
45
+ bgGreenBright: Formatter
46
+ bgYellowBright: Formatter
47
+ bgBlueBright: Formatter
48
+ bgMagentaBright: Formatter
49
+ bgCyanBright: Formatter
50
+ bgWhiteBright: Formatter
52
51
  }
53
52
 
54
53
  declare const picocolors: Colors & { createColors: (enabled?: boolean) => Colors }
@@ -1,32 +1,22 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 78:
5
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
4
+ /***/ 209:
5
+ /***/ ((module) => {
6
6
 
7
- let argv = process.argv || [],
8
- env = process.env
7
+ let p = process || {}, argv = p.argv || [], env = p.env || {}
9
8
  let isColorSupported =
10
- !("NO_COLOR" in env || argv.includes("--no-color")) &&
11
- ("FORCE_COLOR" in env ||
12
- argv.includes("--color") ||
13
- process.platform === "win32" ||
14
- (require != null && (__nccwpck_require__(224).isatty)(1) && env.TERM !== "dumb") ||
15
- "CI" in env)
9
+ !(!!env.NO_COLOR || argv.includes("--no-color")) &&
10
+ (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI)
16
11
 
17
- let formatter =
18
- (open, close, replace = open) =>
12
+ let formatter = (open, close, replace = open) =>
19
13
  input => {
20
- let string = "" + input
21
- let index = string.indexOf(close, open.length)
22
- return ~index
23
- ? open + replaceClose(string, close, replace, index) + close
24
- : open + string + close
14
+ let string = "" + input, index = string.indexOf(close, open.length)
15
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close
25
16
  }
26
17
 
27
18
  let replaceClose = (string, close, replace, index) => {
28
- let result = ""
29
- let cursor = 0
19
+ let result = "", cursor = 0
30
20
  do {
31
21
  result += string.substring(cursor, index) + replace
32
22
  cursor = index + close.length
@@ -36,54 +26,54 @@ let replaceClose = (string, close, replace, index) => {
36
26
  }
37
27
 
38
28
  let createColors = (enabled = isColorSupported) => {
39
- let init = enabled ? formatter : () => String
29
+ let f = enabled ? formatter : () => String
40
30
  return {
41
31
  isColorSupported: enabled,
42
- reset: init("\x1b[0m", "\x1b[0m"),
43
- bold: init("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
44
- dim: init("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
45
- italic: init("\x1b[3m", "\x1b[23m"),
46
- underline: init("\x1b[4m", "\x1b[24m"),
47
- inverse: init("\x1b[7m", "\x1b[27m"),
48
- hidden: init("\x1b[8m", "\x1b[28m"),
49
- strikethrough: init("\x1b[9m", "\x1b[29m"),
50
-
51
- black: init("\x1b[30m", "\x1b[39m"),
52
- red: init("\x1b[31m", "\x1b[39m"),
53
- green: init("\x1b[32m", "\x1b[39m"),
54
- yellow: init("\x1b[33m", "\x1b[39m"),
55
- blue: init("\x1b[34m", "\x1b[39m"),
56
- magenta: init("\x1b[35m", "\x1b[39m"),
57
- cyan: init("\x1b[36m", "\x1b[39m"),
58
- white: init("\x1b[37m", "\x1b[39m"),
59
- gray: init("\x1b[90m", "\x1b[39m"),
60
-
61
- bgBlack: init("\x1b[40m", "\x1b[49m"),
62
- bgRed: init("\x1b[41m", "\x1b[49m"),
63
- bgGreen: init("\x1b[42m", "\x1b[49m"),
64
- bgYellow: init("\x1b[43m", "\x1b[49m"),
65
- bgBlue: init("\x1b[44m", "\x1b[49m"),
66
- bgMagenta: init("\x1b[45m", "\x1b[49m"),
67
- bgCyan: init("\x1b[46m", "\x1b[49m"),
68
- bgWhite: init("\x1b[47m", "\x1b[49m"),
69
-
70
- blackBright: init("\x1b[90m", "\x1b[39m"),
71
- redBright: init("\x1b[91m", "\x1b[39m"),
72
- greenBright: init("\x1b[92m", "\x1b[39m"),
73
- yellowBright: init("\x1b[93m", "\x1b[39m"),
74
- blueBright: init("\x1b[94m", "\x1b[39m"),
75
- magentaBright: init("\x1b[95m", "\x1b[39m"),
76
- cyanBright: init("\x1b[96m", "\x1b[39m"),
77
- whiteBright: init("\x1b[97m", "\x1b[39m"),
78
-
79
- bgBlackBright: init("\x1b[100m","\x1b[49m"),
80
- bgRedBright: init("\x1b[101m","\x1b[49m"),
81
- bgGreenBright: init("\x1b[102m","\x1b[49m"),
82
- bgYellowBright: init("\x1b[103m","\x1b[49m"),
83
- bgBlueBright: init("\x1b[104m","\x1b[49m"),
84
- bgMagentaBright: init("\x1b[105m","\x1b[49m"),
85
- bgCyanBright: init("\x1b[106m","\x1b[49m"),
86
- bgWhiteBright: init("\x1b[107m","\x1b[49m"),
32
+ reset: f("\x1b[0m", "\x1b[0m"),
33
+ bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
34
+ dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
35
+ italic: f("\x1b[3m", "\x1b[23m"),
36
+ underline: f("\x1b[4m", "\x1b[24m"),
37
+ inverse: f("\x1b[7m", "\x1b[27m"),
38
+ hidden: f("\x1b[8m", "\x1b[28m"),
39
+ strikethrough: f("\x1b[9m", "\x1b[29m"),
40
+
41
+ black: f("\x1b[30m", "\x1b[39m"),
42
+ red: f("\x1b[31m", "\x1b[39m"),
43
+ green: f("\x1b[32m", "\x1b[39m"),
44
+ yellow: f("\x1b[33m", "\x1b[39m"),
45
+ blue: f("\x1b[34m", "\x1b[39m"),
46
+ magenta: f("\x1b[35m", "\x1b[39m"),
47
+ cyan: f("\x1b[36m", "\x1b[39m"),
48
+ white: f("\x1b[37m", "\x1b[39m"),
49
+ gray: f("\x1b[90m", "\x1b[39m"),
50
+
51
+ bgBlack: f("\x1b[40m", "\x1b[49m"),
52
+ bgRed: f("\x1b[41m", "\x1b[49m"),
53
+ bgGreen: f("\x1b[42m", "\x1b[49m"),
54
+ bgYellow: f("\x1b[43m", "\x1b[49m"),
55
+ bgBlue: f("\x1b[44m", "\x1b[49m"),
56
+ bgMagenta: f("\x1b[45m", "\x1b[49m"),
57
+ bgCyan: f("\x1b[46m", "\x1b[49m"),
58
+ bgWhite: f("\x1b[47m", "\x1b[49m"),
59
+
60
+ blackBright: f("\x1b[90m", "\x1b[39m"),
61
+ redBright: f("\x1b[91m", "\x1b[39m"),
62
+ greenBright: f("\x1b[92m", "\x1b[39m"),
63
+ yellowBright: f("\x1b[93m", "\x1b[39m"),
64
+ blueBright: f("\x1b[94m", "\x1b[39m"),
65
+ magentaBright: f("\x1b[95m", "\x1b[39m"),
66
+ cyanBright: f("\x1b[96m", "\x1b[39m"),
67
+ whiteBright: f("\x1b[97m", "\x1b[39m"),
68
+
69
+ bgBlackBright: f("\x1b[100m", "\x1b[49m"),
70
+ bgRedBright: f("\x1b[101m", "\x1b[49m"),
71
+ bgGreenBright: f("\x1b[102m", "\x1b[49m"),
72
+ bgYellowBright: f("\x1b[103m", "\x1b[49m"),
73
+ bgBlueBright: f("\x1b[104m", "\x1b[49m"),
74
+ bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
75
+ bgCyanBright: f("\x1b[106m", "\x1b[49m"),
76
+ bgWhiteBright: f("\x1b[107m", "\x1b[49m"),
87
77
  }
88
78
  }
89
79
 
@@ -91,14 +81,6 @@ module.exports = createColors()
91
81
  module.exports.createColors = createColors
92
82
 
93
83
 
94
- /***/ }),
95
-
96
- /***/ 224:
97
- /***/ ((module) => {
98
-
99
- "use strict";
100
- module.exports = require("tty");
101
-
102
84
  /***/ })
103
85
 
104
86
  /******/ });
@@ -143,7 +125,7 @@ module.exports = require("tty");
143
125
  /******/ // startup
144
126
  /******/ // Load entry module and return exports
145
127
  /******/ // This entry module is referenced by other modules so it can't be inlined
146
- /******/ var __webpack_exports__ = __nccwpck_require__(78);
128
+ /******/ var __webpack_exports__ = __nccwpck_require__(209);
147
129
  /******/ module.exports = __webpack_exports__;
148
130
  /******/
149
131
  /******/ })()
@@ -1 +1 @@
1
- {"name":"picocolors","author":"Alexey Raspopov","version":"1.1.0","license":"ISC","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"picocolors","author":"Alexey Raspopov","version":"1.1.1","license":"ISC","types":"index.d.ts","type":"commonjs"}
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js__ from "../compiled/picocolors/index.js";
6
6
  import * as __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__ from "../compiled/commander/index.js";
7
7
  import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core__ from "@rsbuild/core";
8
- import * as __WEBPACK_EXTERNAL_MODULE__compiled_fast_glob_index_js__ from "../compiled/fast-glob/index.js";
8
+ import * as __WEBPACK_EXTERNAL_MODULE_tinyglobby__ from "tinyglobby";
9
9
  import * as __WEBPACK_EXTERNAL_MODULE_node_module__ from "node:module";
10
10
  import * as __WEBPACK_EXTERNAL_MODULE_module__ from "module";
11
11
  /**
@@ -150,7 +150,7 @@ function prepareCli() {
150
150
  // Some package managers automatically output a blank line, some do not.
151
151
  const { npm_execpath } = process.env;
152
152
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
153
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.greet(` Rslib v0.0.13\n`);
153
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.greet(` Rslib v0.0.15\n`);
154
154
  }
155
155
  const DEFAULT_CONFIG_NAME = 'rslib.config';
156
156
  const DEFAULT_CONFIG_EXTENSIONS = [
@@ -518,6 +518,8 @@ function transformSyntaxToRspackTarget(syntax) {
518
518
  // The latest EcmaScript version supported by Rspack's `target` is es2022.
519
519
  // Higher versions are treated as es2022.
520
520
  if (RSPACK_TARGET_UNLISTED_MODERN_ECMA_VERSIONS.includes(normalizedSyntaxItem)) return 'es2022';
521
+ // The es6 is the same as es2015, compatible with rspack API schema
522
+ if ('es6' === normalizedSyntaxItem) return 'es2015';
521
523
  return normalizedSyntaxItem;
522
524
  }
523
525
  throw new Error(`Unsupported ES version: ${syntaxItem}`);
@@ -1430,7 +1432,8 @@ function composeMinifyConfig(config) {
1430
1432
  jsOptions: {
1431
1433
  minimizerOptions: {
1432
1434
  mangle: false,
1433
- minify: false,
1435
+ // MF assets are loaded over the network, which means they will not be compressed by the project. Therefore, minifying them is necessary.
1436
+ minify: 'mf' === format,
1434
1437
  compress: {
1435
1438
  defaults: false,
1436
1439
  unused: true,
@@ -1512,10 +1515,19 @@ async function createConstantRsbuildConfig() {
1512
1515
  dev: {
1513
1516
  progressBar: false
1514
1517
  },
1518
+ performance: {
1519
+ chunkSplit: {
1520
+ strategy: 'custom'
1521
+ }
1522
+ },
1515
1523
  tools: {
1516
1524
  htmlPlugin: false,
1517
1525
  rspack: {
1518
1526
  optimization: {
1527
+ splitChunks: {
1528
+ // Splitted "sync" chunks will make entry modules can't be inlined.
1529
+ chunks: 'async'
1530
+ },
1519
1531
  moduleIds: 'named',
1520
1532
  nodeEnv: false
1521
1533
  },
@@ -1728,7 +1740,10 @@ const composeExternalsConfig = (format, externals)=>{
1728
1740
  esm: 'module-import',
1729
1741
  cjs: 'commonjs',
1730
1742
  umd: 'umd',
1731
- mf: 'var'
1743
+ // If use 'var', when projects import an external package like '@pkg', this will cause a syntax error such as 'var pkg = @pkg'.
1744
+ // If use 'umd', the judgement conditions may be affected by other packages that define variables like 'define'.
1745
+ // Therefore, we use 'global' to satisfy both web and node environments.
1746
+ mf: 'global'
1732
1747
  };
1733
1748
  switch(format){
1734
1749
  case 'esm':
@@ -1821,8 +1836,9 @@ const composeEntryConfig = async (entries, bundle, root, cssModulesAuto)=>{
1821
1836
  ] : null;
1822
1837
  if (!entryFiles) throw new Error('Entry can only be a string or an array of strings for now');
1823
1838
  // Turn entries in array into each separate entry.
1824
- const globEntryFiles = await (0, __WEBPACK_EXTERNAL_MODULE__compiled_fast_glob_index_js__["default"])(entryFiles, {
1825
- cwd: root
1839
+ const globEntryFiles = await (0, __WEBPACK_EXTERNAL_MODULE_tinyglobby__.glob)(entryFiles, {
1840
+ cwd: root,
1841
+ absolute: true
1826
1842
  });
1827
1843
  // Filter the glob resolved entry files based on the allowed extensions
1828
1844
  const resolvedEntryFiles = globEntryFiles.filter((file)=>ENTRY_EXTENSIONS_PATTERN.test(file));
@@ -1893,13 +1909,19 @@ const composeBundleConfig = (jsExtension, redirect, cssModulesAuto, bundle)=>{
1893
1909
  };
1894
1910
  };
1895
1911
  const composeDtsConfig = async (libConfig, dtsExtension)=>{
1896
- const { dts, bundle, output, autoExternal, banner, footer } = libConfig;
1912
+ const { output, autoExternal, banner, footer } = libConfig;
1913
+ let { dts } = libConfig;
1897
1914
  if (false === dts || void 0 === dts) return {};
1915
+ // DTS default to bundleless whether js is bundle or not
1916
+ if (true === dts) dts = {
1917
+ bundle: false
1918
+ };
1898
1919
  const { pluginDts } = await import("rsbuild-plugin-dts");
1899
1920
  return {
1900
1921
  plugins: [
1901
1922
  pluginDts({
1902
- bundle: dts?.bundle ?? bundle,
1923
+ // Only setting ⁠dts.bundle to true will generate the bundled d.ts.
1924
+ bundle: dts?.bundle ?? false,
1903
1925
  distPath: dts?.distPath ?? output?.distPath?.root ?? './dist',
1904
1926
  abortOnError: dts?.abortOnError ?? true,
1905
1927
  dtsExtension: dts?.autoExtension ? dtsExtension : '.d.ts',
@@ -2096,7 +2118,7 @@ const applyCommonOptions = (command)=>{
2096
2118
  command.option('-c --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file');
2097
2119
  };
2098
2120
  function runCli() {
2099
- __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.0.13");
2121
+ __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.0.15");
2100
2122
  const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('build');
2101
2123
  const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('inspect');
2102
2124
  [
@@ -2138,6 +2160,6 @@ function runCli() {
2138
2160
  });
2139
2161
  __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.parse();
2140
2162
  }
2141
- const src_version = "0.0.13";
2163
+ const src_version = "0.0.15";
2142
2164
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger;
2143
2165
  export { build, defineConfig, loadConfig, prepareCli, runCli, src_version as version, __webpack_exports__logger as logger };
@@ -121,5 +121,5 @@ const pitch = function(request, _, _data) {
121
121
  handleExports(exports);
122
122
  });
123
123
  };
124
- /* harmony default export */ const libCssExtractLoader = libCssExtractLoader_loader;
124
+ /* ESM default export */ const libCssExtractLoader = libCssExtractLoader_loader;
125
125
  export { libCssExtractLoader as default, pitch };
@@ -8,7 +8,7 @@ export type RsbuildConfigOutputTarget = NonNullable<RsbuildConfig['output']>['ta
8
8
  export type Syntax = EcmaScriptVersion | string[];
9
9
  export type Dts = (Pick<PluginDtsOptions, 'bundle' | 'distPath' | 'abortOnError'> & {
10
10
  autoExtension?: boolean;
11
- }) | false;
11
+ }) | boolean;
12
12
  export type AutoExternal = boolean | {
13
13
  dependencies?: boolean;
14
14
  devDependencies?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslib/core",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "The Rspack-based library build tool.",
5
5
  "homepage": "https://lib.rsbuild.dev",
6
6
  "bugs": {
@@ -32,19 +32,19 @@
32
32
  "compiled"
33
33
  ],
34
34
  "dependencies": {
35
- "@rsbuild/core": "~1.0.14",
36
- "rsbuild-plugin-dts": "0.0.13"
35
+ "@rsbuild/core": "~1.0.18",
36
+ "tinyglobby": "^0.2.10",
37
+ "rsbuild-plugin-dts": "0.0.15"
37
38
  },
38
39
  "devDependencies": {
39
40
  "@rspack/core": "1.0.8",
40
41
  "@types/fs-extra": "^11.0.4",
41
42
  "commander": "^12.1.0",
42
- "fast-glob": "^3.3.2",
43
43
  "fs-extra": "^11.2.0",
44
44
  "memfs": "^4.14.0",
45
- "picocolors": "1.1.0",
45
+ "picocolors": "1.1.1",
46
46
  "prebundle": "1.2.2",
47
- "rslib": "npm:@rslib/core@0.0.12",
47
+ "rslib": "npm:@rslib/core@0.0.14",
48
48
  "rslog": "^1.2.3",
49
49
  "tsconfck": "3.1.4",
50
50
  "typescript": "^5.6.3",
@@ -1,237 +0,0 @@
1
- /// <reference types="node" />
2
- import * as fs from 'fs';
3
-
4
- declare type ErrnoException$1 = NodeJS.ErrnoException;
5
-
6
- declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException$1 | null, stats: fs.Stats) => void) => void;
7
- declare type StatSynchronousMethod = (path: string) => fs.Stats;
8
- interface FileSystemAdapter$2 {
9
- lstat: StatAsynchronousMethod;
10
- stat: StatAsynchronousMethod;
11
- lstatSync: StatSynchronousMethod;
12
- statSync: StatSynchronousMethod;
13
- }
14
-
15
- interface Entry$2 {
16
- dirent: Dirent;
17
- name: string;
18
- path: string;
19
- stats?: Stats;
20
- }
21
- declare type Stats = fs.Stats;
22
- declare type ErrnoException = NodeJS.ErrnoException;
23
- interface Dirent {
24
- isBlockDevice: () => boolean;
25
- isCharacterDevice: () => boolean;
26
- isDirectory: () => boolean;
27
- isFIFO: () => boolean;
28
- isFile: () => boolean;
29
- isSocket: () => boolean;
30
- isSymbolicLink: () => boolean;
31
- name: string;
32
- }
33
-
34
- interface ReaddirAsynchronousMethod {
35
- (filepath: string, options: {
36
- withFileTypes: true;
37
- }, callback: (error: ErrnoException | null, files: Dirent[]) => void): void;
38
- (filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void;
39
- }
40
- interface ReaddirSynchronousMethod {
41
- (filepath: string, options: {
42
- withFileTypes: true;
43
- }): Dirent[];
44
- (filepath: string): string[];
45
- }
46
- declare type FileSystemAdapter$1 = FileSystemAdapter$2 & {
47
- readdir: ReaddirAsynchronousMethod;
48
- readdirSync: ReaddirSynchronousMethod;
49
- };
50
-
51
- declare type Entry$1 = Entry$2;
52
-
53
- type Entry = Entry$1;
54
- type Pattern = string;
55
- type FileSystemAdapter = FileSystemAdapter$1;
56
-
57
- type Options = {
58
- /**
59
- * Return the absolute path for entries.
60
- *
61
- * @default false
62
- */
63
- absolute?: boolean;
64
- /**
65
- * If set to `true`, then patterns without slashes will be matched against
66
- * the basename of the path if it contains slashes.
67
- *
68
- * @default false
69
- */
70
- baseNameMatch?: boolean;
71
- /**
72
- * Enables Bash-like brace expansion.
73
- *
74
- * @default true
75
- */
76
- braceExpansion?: boolean;
77
- /**
78
- * Enables a case-sensitive mode for matching files.
79
- *
80
- * @default true
81
- */
82
- caseSensitiveMatch?: boolean;
83
- /**
84
- * Specifies the maximum number of concurrent requests from a reader to read
85
- * directories.
86
- *
87
- * @default os.cpus().length
88
- */
89
- concurrency?: number;
90
- /**
91
- * The current working directory in which to search.
92
- *
93
- * @default process.cwd()
94
- */
95
- cwd?: string;
96
- /**
97
- * Specifies the maximum depth of a read directory relative to the start
98
- * directory.
99
- *
100
- * @default Infinity
101
- */
102
- deep?: number;
103
- /**
104
- * Allow patterns to match entries that begin with a period (`.`).
105
- *
106
- * @default false
107
- */
108
- dot?: boolean;
109
- /**
110
- * Enables Bash-like `extglob` functionality.
111
- *
112
- * @default true
113
- */
114
- extglob?: boolean;
115
- /**
116
- * Indicates whether to traverse descendants of symbolic link directories.
117
- *
118
- * @default true
119
- */
120
- followSymbolicLinks?: boolean;
121
- /**
122
- * Custom implementation of methods for working with the file system.
123
- *
124
- * @default fs.*
125
- */
126
- fs?: Partial<FileSystemAdapter>;
127
- /**
128
- * Enables recursively repeats a pattern containing `**`.
129
- * If `false`, `**` behaves exactly like `*`.
130
- *
131
- * @default true
132
- */
133
- globstar?: boolean;
134
- /**
135
- * An array of glob patterns to exclude matches.
136
- * This is an alternative way to use negative patterns.
137
- *
138
- * @default []
139
- */
140
- ignore?: Pattern[];
141
- /**
142
- * Mark the directory path with the final slash.
143
- *
144
- * @default false
145
- */
146
- markDirectories?: boolean;
147
- /**
148
- * Returns objects (instead of strings) describing entries.
149
- *
150
- * @default false
151
- */
152
- objectMode?: boolean;
153
- /**
154
- * Return only directories.
155
- *
156
- * @default false
157
- */
158
- onlyDirectories?: boolean;
159
- /**
160
- * Return only files.
161
- *
162
- * @default true
163
- */
164
- onlyFiles?: boolean;
165
- /**
166
- * Enables an object mode (`objectMode`) with an additional `stats` field.
167
- *
168
- * @default false
169
- */
170
- stats?: boolean;
171
- /**
172
- * By default this package suppress only `ENOENT` errors.
173
- * Set to `true` to suppress any error.
174
- *
175
- * @default false
176
- */
177
- suppressErrors?: boolean;
178
- /**
179
- * Throw an error when symbolic link is broken if `true` or safely
180
- * return `lstat` call if `false`.
181
- *
182
- * @default false
183
- */
184
- throwErrorOnBrokenSymbolicLink?: boolean;
185
- /**
186
- * Ensures that the returned entries are unique.
187
- *
188
- * @default true
189
- */
190
- unique?: boolean;
191
- };
192
-
193
- type Task = {
194
- base: string;
195
- dynamic: boolean;
196
- patterns: Pattern[];
197
- positive: Pattern[];
198
- negative: Pattern[];
199
- };
200
-
201
- type EntryObjectModePredicate = {
202
- [TKey in keyof Pick<Options, 'objectMode'>]-?: true;
203
- };
204
- type EntryStatsPredicate = {
205
- [TKey in keyof Pick<Options, 'stats'>]-?: true;
206
- };
207
- type EntryObjectPredicate = EntryObjectModePredicate | EntryStatsPredicate;
208
- declare function FastGlob(source: Pattern | Pattern[], options: Options & EntryObjectPredicate): Promise<Entry[]>;
209
- declare function FastGlob(source: Pattern | Pattern[], options?: Options): Promise<string[]>;
210
- declare namespace FastGlob {
211
- type Options = Options;
212
- type Entry = Entry;
213
- type Task = Task;
214
- type Pattern = Pattern;
215
- type FileSystemAdapter = FileSystemAdapter;
216
- const glob: typeof FastGlob;
217
- const globSync: typeof sync;
218
- const globStream: typeof stream;
219
- const async: typeof FastGlob;
220
- function sync(source: Pattern | Pattern[], options: Options & EntryObjectPredicate): Entry[];
221
- function sync(source: Pattern | Pattern[], options?: Options): string[];
222
- function stream(source: Pattern | Pattern[], options?: Options): NodeJS.ReadableStream;
223
- function generateTasks(source: Pattern | Pattern[], options?: Options): Task[];
224
- function isDynamicPattern(source: Pattern, options?: Options): boolean;
225
- function escapePath(source: string): Pattern;
226
- function convertPathToPattern(source: string): Pattern;
227
- namespace posix {
228
- function escapePath(source: string): Pattern;
229
- function convertPathToPattern(source: string): Pattern;
230
- }
231
- namespace win32 {
232
- function escapePath(source: string): Pattern;
233
- function convertPathToPattern(source: string): Pattern;
234
- }
235
- }
236
-
237
- export { FastGlob as default };