@modern-js/utils 1.5.0 → 1.7.1-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/compiled/address/index.js +1 -0
  3. package/compiled/address/lib/address.d.ts +28 -0
  4. package/compiled/address/package.json +1 -0
  5. package/compiled/browserslist/index.js +1 -1
  6. package/compiled/dotenv/index.js +1 -0
  7. package/compiled/dotenv/license +23 -0
  8. package/compiled/dotenv/package.json +1 -0
  9. package/compiled/dotenv/types/index.d.ts +59 -0
  10. package/compiled/dotenv-expand/index.d.ts +15 -0
  11. package/compiled/dotenv-expand/index.js +1 -0
  12. package/compiled/dotenv-expand/license +24 -0
  13. package/compiled/dotenv-expand/package.json +1 -0
  14. package/compiled/fast-glob/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
  15. package/compiled/fast-glob/@nodelib/fs.scandir/out/index.d.ts +12 -0
  16. package/compiled/fast-glob/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
  17. package/compiled/fast-glob/@nodelib/fs.scandir/out/settings.d.ts +20 -0
  18. package/compiled/fast-glob/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
  19. package/compiled/fast-glob/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
  20. package/compiled/fast-glob/@nodelib/fs.stat/out/index.d.ts +12 -0
  21. package/compiled/fast-glob/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
  22. package/compiled/fast-glob/@nodelib/fs.stat/out/settings.d.ts +16 -0
  23. package/compiled/fast-glob/@nodelib/fs.stat/out/types/index.d.ts +4 -0
  24. package/compiled/fast-glob/@nodelib/fs.walk/out/index.d.ts +14 -0
  25. package/compiled/fast-glob/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
  26. package/compiled/fast-glob/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
  27. package/compiled/fast-glob/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
  28. package/compiled/fast-glob/@nodelib/fs.walk/out/settings.d.ts +30 -0
  29. package/compiled/fast-glob/@nodelib/fs.walk/out/types/index.d.ts +8 -0
  30. package/compiled/fast-glob/index.js +37 -0
  31. package/compiled/fast-glob/license +21 -0
  32. package/compiled/fast-glob/out/index.d.ts +27 -0
  33. package/compiled/fast-glob/out/managers/tasks.d.ts +22 -0
  34. package/compiled/fast-glob/out/settings.d.ts +164 -0
  35. package/compiled/fast-glob/out/types/index.d.ts +31 -0
  36. package/compiled/fast-glob/package.json +1 -0
  37. package/compiled/globby/index.d.ts +186 -0
  38. package/compiled/globby/index.js +1 -0
  39. package/compiled/globby/license +9 -0
  40. package/compiled/globby/package.json +1 -0
  41. package/compiled/inquirer/index.d.ts +997 -0
  42. package/compiled/inquirer/index.js +9 -0
  43. package/compiled/inquirer/lib/objects/choice.d.ts +65 -0
  44. package/compiled/inquirer/lib/objects/choices.d.ts +206 -0
  45. package/compiled/inquirer/lib/objects/separator.d.ts +37 -0
  46. package/compiled/inquirer/lib/ui/baseUI.d.ts +37 -0
  47. package/compiled/inquirer/lib/ui/bottom-bar.d.ts +65 -0
  48. package/compiled/inquirer/lib/ui/prompt.d.ts +104 -0
  49. package/compiled/inquirer/license +22 -0
  50. package/compiled/inquirer/package.json +1 -0
  51. package/compiled/inquirer/through/index.d.ts +25 -0
  52. package/compiled/json5/index.js +1 -0
  53. package/compiled/json5/lib/index.d.ts +4 -0
  54. package/compiled/json5/lib/parse.d.ts +15 -0
  55. package/compiled/json5/lib/stringify.d.ts +89 -0
  56. package/compiled/json5/package.json +1 -0
  57. package/compiled/lodash/index.js +4 -8
  58. package/compiled/mime-types/index.d.ts +14 -0
  59. package/compiled/mime-types/index.js +14 -0
  60. package/compiled/mime-types/license +23 -0
  61. package/compiled/mime-types/package.json +1 -0
  62. package/compiled/minimist/index.d.ts +95 -0
  63. package/compiled/minimist/index.js +1 -0
  64. package/compiled/minimist/license +18 -0
  65. package/compiled/minimist/package.json +1 -0
  66. package/compiled/ora/cli-spinners/index.d.ts +125 -0
  67. package/compiled/ora/index.d.ts +277 -0
  68. package/compiled/ora/index.js +3 -0
  69. package/compiled/ora/license +9 -0
  70. package/compiled/ora/package.json +1 -0
  71. package/compiled/semver/classes/comparator.d.ts +17 -0
  72. package/compiled/semver/classes/range.d.ts +21 -0
  73. package/compiled/semver/classes/semver.d.ts +62 -0
  74. package/compiled/semver/functions/clean.d.ts +8 -0
  75. package/compiled/semver/functions/cmp.d.ts +16 -0
  76. package/compiled/semver/functions/coerce.d.ts +12 -0
  77. package/compiled/semver/functions/compare-build.d.ts +16 -0
  78. package/compiled/semver/functions/compare-loose.d.ts +5 -0
  79. package/compiled/semver/functions/compare.d.ts +20 -0
  80. package/compiled/semver/functions/diff.d.ts +13 -0
  81. package/compiled/semver/functions/eq.d.ts +9 -0
  82. package/compiled/semver/functions/gt.d.ts +9 -0
  83. package/compiled/semver/functions/gte.d.ts +9 -0
  84. package/compiled/semver/functions/inc.d.ts +15 -0
  85. package/compiled/semver/functions/lt.d.ts +9 -0
  86. package/compiled/semver/functions/lte.d.ts +8 -0
  87. package/compiled/semver/functions/major.d.ts +9 -0
  88. package/compiled/semver/functions/minor.d.ts +9 -0
  89. package/compiled/semver/functions/neq.d.ts +9 -0
  90. package/compiled/semver/functions/parse.d.ts +12 -0
  91. package/compiled/semver/functions/patch.d.ts +9 -0
  92. package/compiled/semver/functions/prerelease.d.ts +12 -0
  93. package/compiled/semver/functions/rcompare.d.ts +15 -0
  94. package/compiled/semver/functions/rsort.d.ts +9 -0
  95. package/compiled/semver/functions/satisfies.d.ts +14 -0
  96. package/compiled/semver/functions/sort.d.ts +9 -0
  97. package/compiled/semver/functions/valid.d.ts +11 -0
  98. package/compiled/semver/index.d.ts +133 -0
  99. package/compiled/semver/index.js +1 -0
  100. package/compiled/semver/internals/identifiers.d.ts +13 -0
  101. package/compiled/semver/license +15 -0
  102. package/compiled/semver/package.json +1 -0
  103. package/compiled/semver/ranges/gtr.d.ts +14 -0
  104. package/compiled/semver/ranges/intersects.d.ts +13 -0
  105. package/compiled/semver/ranges/ltr.d.ts +14 -0
  106. package/compiled/semver/ranges/max-satisfying.d.ts +14 -0
  107. package/compiled/semver/ranges/min-satisfying.d.ts +14 -0
  108. package/compiled/semver/ranges/min-version.d.ts +10 -0
  109. package/compiled/semver/ranges/outside.d.ts +15 -0
  110. package/compiled/semver/ranges/simplify.d.ts +14 -0
  111. package/compiled/semver/ranges/subset.d.ts +13 -0
  112. package/compiled/semver/ranges/to-comparators.d.ts +9 -0
  113. package/compiled/semver/ranges/valid.d.ts +12 -0
  114. package/compiled/slash/index.d.ts +25 -0
  115. package/compiled/slash/index.js +1 -0
  116. package/compiled/slash/license +9 -0
  117. package/compiled/slash/package.json +1 -0
  118. package/compiled/url-join/index.d.ts +17 -0
  119. package/compiled/url-join/index.js +1 -0
  120. package/compiled/url-join/license +21 -0
  121. package/compiled/url-join/package.json +1 -0
  122. package/dist/alias.js +4 -1
  123. package/dist/analyzeProject.js +4 -17
  124. package/dist/compiled.d.ts +34 -17
  125. package/dist/compiled.js +59 -21
  126. package/dist/emptyDir.js +4 -13
  127. package/dist/ensureAbsolutePath.d.ts +1 -1
  128. package/dist/ensureAbsolutePath.js +1 -1
  129. package/dist/findExists.d.ts +1 -1
  130. package/dist/findExists.js +1 -1
  131. package/dist/format.js +11 -6
  132. package/dist/getEntryOptions.js +2 -1
  133. package/dist/getPackageManager.js +19 -30
  134. package/dist/getPort.js +3 -12
  135. package/dist/getServerConfig.js +2 -11
  136. package/dist/index.d.ts +1 -2
  137. package/dist/index.js +1 -2
  138. package/dist/logger.d.ts +3 -0
  139. package/dist/logger.js +21 -6
  140. package/dist/monorepo.js +9 -6
  141. package/dist/nodeEnv.js +24 -39
  142. package/dist/prettyInstructions.js +1 -1
  143. package/dist/readTsConfig.js +2 -2
  144. package/dist/runtimeExports.js +1 -1
  145. package/dist/{ssrHelpers.d.ts → ssr.d.ts} +3 -0
  146. package/dist/{ssrHelpers.js → ssr.js} +0 -0
  147. package/dist/watch.js +9 -18
  148. package/package.json +33 -50
  149. package/tsconfig.json +1 -0
  150. package/dist/getCacheIdentifier.d.ts +0 -7
  151. package/dist/getCacheIdentifier.js +0 -24
  152. package/modern.config.js +0 -6
@@ -0,0 +1,22 @@
1
+ import Settings from '../settings';
2
+ import { Pattern, PatternsGroup } from '../types';
3
+ export declare type Task = {
4
+ base: string;
5
+ dynamic: boolean;
6
+ patterns: Pattern[];
7
+ positive: Pattern[];
8
+ negative: Pattern[];
9
+ };
10
+ export declare function generate(patterns: Pattern[], settings: Settings): Task[];
11
+ /**
12
+ * Returns tasks grouped by basic pattern directories.
13
+ *
14
+ * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
15
+ * This is necessary because directory traversal starts at the base directory and goes deeper.
16
+ */
17
+ export declare function convertPatternsToTasks(positive: Pattern[], negative: Pattern[], dynamic: boolean): Task[];
18
+ export declare function getPositivePatterns(patterns: Pattern[]): Pattern[];
19
+ export declare function getNegativePatternsAsPositive(patterns: Pattern[], ignore: Pattern[]): Pattern[];
20
+ export declare function groupPatternsByBaseDirectory(patterns: Pattern[]): PatternsGroup;
21
+ export declare function convertPatternGroupsToTasks(positive: PatternsGroup, negative: Pattern[], dynamic: boolean): Task[];
22
+ export declare function convertPatternGroupToTask(base: string, positive: Pattern[], negative: Pattern[], dynamic: boolean): Task;
@@ -0,0 +1,164 @@
1
+ import { FileSystemAdapter, Pattern } from './types';
2
+ export declare const DEFAULT_FILE_SYSTEM_ADAPTER: FileSystemAdapter;
3
+ export declare type Options = {
4
+ /**
5
+ * Return the absolute path for entries.
6
+ *
7
+ * @default false
8
+ */
9
+ absolute?: boolean;
10
+ /**
11
+ * If set to `true`, then patterns without slashes will be matched against
12
+ * the basename of the path if it contains slashes.
13
+ *
14
+ * @default false
15
+ */
16
+ baseNameMatch?: boolean;
17
+ /**
18
+ * Enables Bash-like brace expansion.
19
+ *
20
+ * @default true
21
+ */
22
+ braceExpansion?: boolean;
23
+ /**
24
+ * Enables a case-sensitive mode for matching files.
25
+ *
26
+ * @default true
27
+ */
28
+ caseSensitiveMatch?: boolean;
29
+ /**
30
+ * Specifies the maximum number of concurrent requests from a reader to read
31
+ * directories.
32
+ *
33
+ * @default os.cpus().length
34
+ */
35
+ concurrency?: number;
36
+ /**
37
+ * The current working directory in which to search.
38
+ *
39
+ * @default process.cwd()
40
+ */
41
+ cwd?: string;
42
+ /**
43
+ * Specifies the maximum depth of a read directory relative to the start
44
+ * directory.
45
+ *
46
+ * @default Infinity
47
+ */
48
+ deep?: number;
49
+ /**
50
+ * Allow patterns to match entries that begin with a period (`.`).
51
+ *
52
+ * @default false
53
+ */
54
+ dot?: boolean;
55
+ /**
56
+ * Enables Bash-like `extglob` functionality.
57
+ *
58
+ * @default true
59
+ */
60
+ extglob?: boolean;
61
+ /**
62
+ * Indicates whether to traverse descendants of symbolic link directories.
63
+ *
64
+ * @default true
65
+ */
66
+ followSymbolicLinks?: boolean;
67
+ /**
68
+ * Custom implementation of methods for working with the file system.
69
+ *
70
+ * @default fs.*
71
+ */
72
+ fs?: Partial<FileSystemAdapter>;
73
+ /**
74
+ * Enables recursively repeats a pattern containing `**`.
75
+ * If `false`, `**` behaves exactly like `*`.
76
+ *
77
+ * @default true
78
+ */
79
+ globstar?: boolean;
80
+ /**
81
+ * An array of glob patterns to exclude matches.
82
+ * This is an alternative way to use negative patterns.
83
+ *
84
+ * @default []
85
+ */
86
+ ignore?: Pattern[];
87
+ /**
88
+ * Mark the directory path with the final slash.
89
+ *
90
+ * @default false
91
+ */
92
+ markDirectories?: boolean;
93
+ /**
94
+ * Returns objects (instead of strings) describing entries.
95
+ *
96
+ * @default false
97
+ */
98
+ objectMode?: boolean;
99
+ /**
100
+ * Return only directories.
101
+ *
102
+ * @default false
103
+ */
104
+ onlyDirectories?: boolean;
105
+ /**
106
+ * Return only files.
107
+ *
108
+ * @default true
109
+ */
110
+ onlyFiles?: boolean;
111
+ /**
112
+ * Enables an object mode (`objectMode`) with an additional `stats` field.
113
+ *
114
+ * @default false
115
+ */
116
+ stats?: boolean;
117
+ /**
118
+ * By default this package suppress only `ENOENT` errors.
119
+ * Set to `true` to suppress any error.
120
+ *
121
+ * @default false
122
+ */
123
+ suppressErrors?: boolean;
124
+ /**
125
+ * Throw an error when symbolic link is broken if `true` or safely
126
+ * return `lstat` call if `false`.
127
+ *
128
+ * @default false
129
+ */
130
+ throwErrorOnBrokenSymbolicLink?: boolean;
131
+ /**
132
+ * Ensures that the returned entries are unique.
133
+ *
134
+ * @default true
135
+ */
136
+ unique?: boolean;
137
+ };
138
+ export default class Settings {
139
+ private readonly _options;
140
+ readonly absolute: boolean;
141
+ readonly baseNameMatch: boolean;
142
+ readonly braceExpansion: boolean;
143
+ readonly caseSensitiveMatch: boolean;
144
+ readonly concurrency: number;
145
+ readonly cwd: string;
146
+ readonly deep: number;
147
+ readonly dot: boolean;
148
+ readonly extglob: boolean;
149
+ readonly followSymbolicLinks: boolean;
150
+ readonly fs: FileSystemAdapter;
151
+ readonly globstar: boolean;
152
+ readonly ignore: Pattern[];
153
+ readonly markDirectories: boolean;
154
+ readonly objectMode: boolean;
155
+ readonly onlyDirectories: boolean;
156
+ readonly onlyFiles: boolean;
157
+ readonly stats: boolean;
158
+ readonly suppressErrors: boolean;
159
+ readonly throwErrorOnBrokenSymbolicLink: boolean;
160
+ readonly unique: boolean;
161
+ constructor(_options?: Options);
162
+ private _getValue;
163
+ private _getFileSystemMethods;
164
+ }
@@ -0,0 +1,31 @@
1
+ /// <reference types="node" />
2
+ import * as fsWalk from '../../@nodelib/fs.walk';
3
+ export declare type ErrnoException = NodeJS.ErrnoException;
4
+ export declare type Entry = fsWalk.Entry;
5
+ export declare type EntryItem = string | Entry;
6
+ export declare type Pattern = string;
7
+ export declare type PatternRe = RegExp;
8
+ export declare type PatternsGroup = Record<string, Pattern[]>;
9
+ export declare type ReaderOptions = fsWalk.Options & {
10
+ transform(entry: Entry): EntryItem;
11
+ deepFilter: DeepFilterFunction;
12
+ entryFilter: EntryFilterFunction;
13
+ errorFilter: ErrorFilterFunction;
14
+ fs: FileSystemAdapter;
15
+ stats: boolean;
16
+ };
17
+ export declare type ErrorFilterFunction = fsWalk.ErrorFilterFunction;
18
+ export declare type EntryFilterFunction = fsWalk.EntryFilterFunction;
19
+ export declare type DeepFilterFunction = fsWalk.DeepFilterFunction;
20
+ export declare type EntryTransformerFunction = (entry: Entry) => EntryItem;
21
+ export declare type MicromatchOptions = {
22
+ dot?: boolean;
23
+ matchBase?: boolean;
24
+ nobrace?: boolean;
25
+ nocase?: boolean;
26
+ noext?: boolean;
27
+ noglobstar?: boolean;
28
+ posix?: boolean;
29
+ strictSlashes?: boolean;
30
+ };
31
+ export declare type FileSystemAdapter = fsWalk.FileSystemAdapter;
@@ -0,0 +1 @@
1
+ {"name":"fast-glob","author":{"name":"Denis Malinochkin","url":"https://mrmlnc.com"},"version":"3.2.11","license":"MIT","typings":"out/index.d.ts"}
@@ -0,0 +1,186 @@
1
+ import {Options as FastGlobOptions, Entry as FastGlobEntry} from '../fast-glob';
2
+
3
+ declare namespace globby {
4
+ type ExpandDirectoriesOption =
5
+ | boolean
6
+ | readonly string[]
7
+ | {files?: readonly string[]; extensions?: readonly string[]};
8
+
9
+ type Entry = FastGlobEntry;
10
+
11
+ interface GlobbyOptions extends FastGlobOptions {
12
+ /**
13
+ If set to `true`, `globby` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `Object` with `files` and `extensions` like in the example below.
14
+
15
+ Note that if you set this option to `false`, you won't get back matched directories unless you set `onlyFiles: false`.
16
+
17
+ @default true
18
+
19
+ @example
20
+ ```
21
+ import globby = require('./globby');
22
+
23
+ (async () => {
24
+ const paths = await globby('images', {
25
+ expandDirectories: {
26
+ files: ['cat', 'unicorn', '*.jpg'],
27
+ extensions: ['png']
28
+ }
29
+ });
30
+
31
+ console.log(paths);
32
+ //=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg']
33
+ })();
34
+ ```
35
+ */
36
+ readonly expandDirectories?: ExpandDirectoriesOption;
37
+
38
+ /**
39
+ Respect ignore patterns in `.gitignore` files that apply to the globbed files.
40
+
41
+ @default false
42
+ */
43
+ readonly gitignore?: boolean;
44
+ }
45
+
46
+ interface GlobTask {
47
+ readonly pattern: string;
48
+ readonly options: GlobbyOptions;
49
+ }
50
+
51
+ interface GitignoreOptions {
52
+ readonly cwd?: string;
53
+ readonly ignore?: readonly string[];
54
+ }
55
+
56
+ type FilterFunction = (path: string) => boolean;
57
+ }
58
+
59
+ interface Gitignore {
60
+ /**
61
+ @returns A filter function indicating whether a given path is ignored via a `.gitignore` file.
62
+ */
63
+ sync: (options?: globby.GitignoreOptions) => globby.FilterFunction;
64
+
65
+ /**
66
+ `.gitignore` files matched by the ignore config are not used for the resulting filter function.
67
+
68
+ @returns A filter function indicating whether a given path is ignored via a `.gitignore` file.
69
+
70
+ @example
71
+ ```
72
+ import {gitignore} from './globby';
73
+
74
+ (async () => {
75
+ const isIgnored = await gitignore();
76
+ console.log(isIgnored('some/file'));
77
+ })();
78
+ ```
79
+ */
80
+ (options?: globby.GitignoreOptions): Promise<globby.FilterFunction>;
81
+ }
82
+
83
+ declare const globby: {
84
+ /**
85
+ Find files and directories using glob patterns.
86
+
87
+ Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
88
+
89
+ @param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
90
+ @param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
91
+ @returns The matching paths.
92
+ */
93
+ sync: ((
94
+ patterns: string | readonly string[],
95
+ options: globby.GlobbyOptions & {objectMode: true}
96
+ ) => globby.Entry[]) & ((
97
+ patterns: string | readonly string[],
98
+ options?: globby.GlobbyOptions
99
+ ) => string[]);
100
+
101
+ /**
102
+ Find files and directories using glob patterns.
103
+
104
+ Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
105
+
106
+ @param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
107
+ @param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
108
+ @returns The stream of matching paths.
109
+
110
+ @example
111
+ ```
112
+ import globby = require('./globby');
113
+
114
+ (async () => {
115
+ for await (const path of globby.stream('*.tmp')) {
116
+ console.log(path);
117
+ }
118
+ })();
119
+ ```
120
+ */
121
+ stream: (
122
+ patterns: string | readonly string[],
123
+ options?: globby.GlobbyOptions
124
+ ) => NodeJS.ReadableStream;
125
+
126
+ /**
127
+ Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.
128
+
129
+ @param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
130
+ @param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
131
+ @returns An object in the format `{pattern: string, options: object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.
132
+ */
133
+ generateGlobTasks: (
134
+ patterns: string | readonly string[],
135
+ options?: globby.GlobbyOptions
136
+ ) => globby.GlobTask[];
137
+
138
+ /**
139
+ Note that the options affect the results.
140
+
141
+ This function is backed by [`fast-glob`](https://github.com/mrmlnc/fast-glob#isdynamicpatternpattern-options).
142
+
143
+ @param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
144
+ @param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3).
145
+ @returns Whether there are any special glob characters in the `patterns`.
146
+ */
147
+ hasMagic: (
148
+ patterns: string | readonly string[],
149
+ options?: FastGlobOptions
150
+ ) => boolean;
151
+
152
+ readonly gitignore: Gitignore;
153
+
154
+ (
155
+ patterns: string | readonly string[],
156
+ options: globby.GlobbyOptions & {objectMode: true}
157
+ ): Promise<globby.Entry[]>;
158
+
159
+ /**
160
+ Find files and directories using glob patterns.
161
+
162
+ Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
163
+
164
+ @param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
165
+ @param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
166
+ @returns The matching paths.
167
+
168
+ @example
169
+ ```
170
+ import globby = require('./globby');
171
+
172
+ (async () => {
173
+ const paths = await globby(['*', '!cake']);
174
+
175
+ console.log(paths);
176
+ //=> ['unicorn', 'rainbow']
177
+ })();
178
+ ```
179
+ */
180
+ (
181
+ patterns: string | readonly string[],
182
+ options?: globby.GlobbyOptions
183
+ ): Promise<string[]>;
184
+ };
185
+
186
+ export = globby;
@@ -0,0 +1 @@
1
+ (()=>{var t={337:t=>{"use strict";t.exports=(...t)=>[...new Set([].concat(...t))]},352:(t,e,r)=>{"use strict";const n=r(17);const s=r(223);const getExtensions=t=>t.length>1?`{${t.join(",")}}`:t[0];const getPath=(t,e)=>{const r=t[0]==="!"?t.slice(1):t;return n.isAbsolute(r)?r:n.join(e,r)};const addExtensions=(t,e)=>{if(n.extname(t)){return`**/${t}`}return`**/${t}.${getExtensions(e)}`};const getGlob=(t,e)=>{if(e.files&&!Array.isArray(e.files)){throw new TypeError(`Expected \`files\` to be of type \`Array\` but received type \`${typeof e.files}\``)}if(e.extensions&&!Array.isArray(e.extensions)){throw new TypeError(`Expected \`extensions\` to be of type \`Array\` but received type \`${typeof e.extensions}\``)}if(e.files&&e.extensions){return e.files.map((r=>n.posix.join(t,addExtensions(r,e.extensions))))}if(e.files){return e.files.map((e=>n.posix.join(t,`**/${e}`)))}if(e.extensions){return[n.posix.join(t,`**/*.${getExtensions(e.extensions)}`)]}return[n.posix.join(t,"**")]};t.exports=async(t,e)=>{e={cwd:process.cwd(),...e};if(typeof e.cwd!=="string"){throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof e.cwd}\``)}const r=await Promise.all([].concat(t).map((async t=>{const r=await s.isDirectory(getPath(t,e.cwd));return r?getGlob(t,e):t})));return[].concat.apply([],r)};t.exports.sync=(t,e)=>{e={cwd:process.cwd(),...e};if(typeof e.cwd!=="string"){throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof e.cwd}\``)}const r=[].concat(t).map((t=>s.isDirectorySync(getPath(t,e.cwd))?getGlob(t,e):t));return[].concat.apply([],r)}},153:(t,e,r)=>{"use strict";const{promisify:n}=r(837);const s=r(147);const o=r(17);const i=r(592);const c=r(302);const a=r(398);const p=["**/node_modules/**","**/flow-typed/**","**/coverage/**","**/.git"];const u=n(s.readFile);const mapGitIgnorePatternTo=t=>e=>{if(e.startsWith("!")){return"!"+o.posix.join(t,e.slice(1))}return o.posix.join(t,e)};const parseGitIgnore=(t,e)=>{const r=a(o.relative(e.cwd,o.dirname(e.fileName)));return t.split(/\r?\n/).filter(Boolean).filter((t=>!t.startsWith("#"))).map(mapGitIgnorePatternTo(r))};const reduceIgnore=t=>{const e=c();for(const r of t){e.add(parseGitIgnore(r.content,{cwd:r.cwd,fileName:r.filePath}))}return e};const ensureAbsolutePathForCwd=(t,e)=>{t=a(t);if(o.isAbsolute(e)){if(a(e).startsWith(t)){return e}throw new Error(`Path ${e} is not in cwd ${t}`)}return o.join(t,e)};const getIsIgnoredPredecate=(t,e)=>r=>t.ignores(a(o.relative(e,ensureAbsolutePathForCwd(e,r.path||r))));const getFile=async(t,e)=>{const r=o.join(e,t);const n=await u(r,"utf8");return{cwd:e,filePath:r,content:n}};const getFileSync=(t,e)=>{const r=o.join(e,t);const n=s.readFileSync(r,"utf8");return{cwd:e,filePath:r,content:n}};const normalizeOptions=({ignore:t=[],cwd:e=a(process.cwd())}={})=>({ignore:t,cwd:e});t.exports=async t=>{t=normalizeOptions(t);const e=await i("**/.gitignore",{ignore:p.concat(t.ignore),cwd:t.cwd});const r=await Promise.all(e.map((e=>getFile(e,t.cwd))));const n=reduceIgnore(r);return getIsIgnoredPredecate(n,t.cwd)};t.exports.sync=t=>{t=normalizeOptions(t);const e=i.sync("**/.gitignore",{ignore:p.concat(t.ignore),cwd:t.cwd});const r=e.map((e=>getFileSync(e,t.cwd)));const n=reduceIgnore(r);return getIsIgnoredPredecate(n,t.cwd)}},718:(t,e,r)=>{"use strict";const n=r(147);const s=r(337);const o=r(382);const i=r(592);const c=r(352);const a=r(153);const{FilterStream:p,UniqueStream:u}=r(546);const DEFAULT_FILTER=()=>false;const isNegative=t=>t[0]==="!";const assertPatternsInput=t=>{if(!t.every((t=>typeof t==="string"))){throw new TypeError("Patterns must be a string or an array of strings")}};const checkCwdOption=(t={})=>{if(!t.cwd){return}let e;try{e=n.statSync(t.cwd)}catch{return}if(!e.isDirectory()){throw new Error("The `cwd` option must be a path to a directory")}};const getPathString=t=>t.stats instanceof n.Stats?t.path:t;const generateGlobTasks=(t,e)=>{t=s([].concat(t));assertPatternsInput(t);checkCwdOption(e);const r=[];e={ignore:[],expandDirectories:true,...e};for(const[n,s]of t.entries()){if(isNegative(s)){continue}const o=t.slice(n).filter((t=>isNegative(t))).map((t=>t.slice(1)));const i={...e,ignore:e.ignore.concat(o)};r.push({pattern:s,options:i})}return r};const globDirs=(t,e)=>{let r={};if(t.options.cwd){r.cwd=t.options.cwd}if(Array.isArray(t.options.expandDirectories)){r={...r,files:t.options.expandDirectories}}else if(typeof t.options.expandDirectories==="object"){r={...r,...t.options.expandDirectories}}return e(t.pattern,r)};const getPattern=(t,e)=>t.options.expandDirectories?globDirs(t,e):[t.pattern];const getFilterSync=t=>t&&t.gitignore?a.sync({cwd:t.cwd,ignore:t.ignore}):DEFAULT_FILTER;const globToTask=t=>e=>{const{options:r}=t;if(r.ignore&&Array.isArray(r.ignore)&&r.expandDirectories){r.ignore=c.sync(r.ignore)}return{pattern:e,options:r}};t.exports=async(t,e)=>{const r=generateGlobTasks(t,e);const getFilter=async()=>e&&e.gitignore?a({cwd:e.cwd,ignore:e.ignore}):DEFAULT_FILTER;const getTasks=async()=>{const t=await Promise.all(r.map((async t=>{const e=await getPattern(t,c);return Promise.all(e.map(globToTask(t)))})));return s(...t)};const[n,o]=await Promise.all([getFilter(),getTasks()]);const p=await Promise.all(o.map((t=>i(t.pattern,t.options))));return s(...p).filter((t=>!n(getPathString(t))))};t.exports.sync=(t,e)=>{const r=generateGlobTasks(t,e);const n=[];for(const t of r){const e=getPattern(t,c.sync).map(globToTask(t));n.push(...e)}const o=getFilterSync(e);let a=[];for(const t of n){a=s(a,i.sync(t.pattern,t.options))}return a.filter((t=>!o(t)))};t.exports.stream=(t,e)=>{const r=generateGlobTasks(t,e);const n=[];for(const t of r){const e=getPattern(t,c.sync).map(globToTask(t));n.push(...e)}const s=getFilterSync(e);const a=new p((t=>!s(t)));const l=new u;return o(n.map((t=>i.stream(t.pattern,t.options)))).pipe(a).pipe(l)};t.exports.generateGlobTasks=generateGlobTasks;t.exports.hasMagic=(t,e)=>[].concat(t).some((t=>i.isDynamicPattern(t,e)));t.exports.gitignore=a},546:(t,e,r)=>{"use strict";const{Transform:n}=r(781);class ObjectTransform extends n{constructor(){super({objectMode:true})}}class FilterStream extends ObjectTransform{constructor(t){super();this._filter=t}_transform(t,e,r){if(this._filter(t)){this.push(t)}r()}}class UniqueStream extends ObjectTransform{constructor(){super();this._pushed=new Set}_transform(t,e,r){if(!this._pushed.has(t)){this.push(t);this._pushed.add(t)}r()}}t.exports={FilterStream:FilterStream,UniqueStream:UniqueStream}},302:t=>{function makeArray(t){return Array.isArray(t)?t:[t]}const e="";const r=" ";const n="\\";const s=/^\s+$/;const o=/^\\!/;const i=/^\\#/;const c=/\r?\n/g;const a=/^\.*\/|^\.+$/;const p="/";const u=typeof Symbol!=="undefined"?Symbol.for("node-ignore"):"node-ignore";const define=(t,e,r)=>Object.defineProperty(t,e,{value:r});const l=/([0-z])-([0-z])/g;const RETURN_FALSE=()=>false;const sanitizeRange=t=>t.replace(l,((t,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?t:e));const cleanRangeBackSlash=t=>{const{length:e}=t;return t.slice(0,e-e%2)};const f=[[/\\?\s+$/,t=>t.indexOf("\\")===0?r:e],[/\\\s/g,()=>r],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function startingReplacer(){return!/\/(?!$)/.test(this)?"(?:^|\\/)":"^"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)\\\*(?=.+)/g,(t,e)=>`${e}[^\\/]*`],[/\\\\\\(?=[$.|*+(){^])/g,()=>n],[/\\\\/g,()=>n],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,s,o)=>e===n?`\\[${r}${cleanRangeBackSlash(s)}${o}`:o==="]"?s.length%2===0?`[${sanitizeRange(r)}${s}]`:"[]":"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>{const r=e?`${e}[^/]+`:"[^/]*";return`${r}(?=$|\\/$)`}]];const d=Object.create(null);const makeRegex=(t,e)=>{let r=d[t];if(!r){r=f.reduce(((e,r)=>e.replace(r[0],r[1].bind(t))),t);d[t]=r}return e?new RegExp(r,"i"):new RegExp(r)};const isString=t=>typeof t==="string";const checkPattern=t=>t&&isString(t)&&!s.test(t)&&t.indexOf("#")!==0;const splitPattern=t=>t.split(c);class IgnoreRule{constructor(t,e,r,n){this.origin=t;this.pattern=e;this.negative=r;this.regex=n}}const createRule=(t,e)=>{const r=t;let n=false;if(t.indexOf("!")===0){n=true;t=t.substr(1)}t=t.replace(o,"!").replace(i,"#");const s=makeRegex(t,e);return new IgnoreRule(r,t,n,s)};const throwError=(t,e)=>{throw new e(t)};const checkPath=(t,e,r)=>{if(!isString(t)){return r(`path must be a string, but got \`${e}\``,TypeError)}if(!t){return r(`path must not be empty`,TypeError)}if(checkPath.isNotRelative(t)){const t="`path.relative()`d";return r(`path should be a ${t} string, but got "${e}"`,RangeError)}return true};const isNotRelative=t=>a.test(t);checkPath.isNotRelative=isNotRelative;checkPath.convert=t=>t;class Ignore{constructor({ignorecase:t=true,ignoreCase:e=t,allowRelativePaths:r=false}={}){define(this,u,true);this._rules=[];this._ignoreCase=e;this._allowRelativePaths=r;this._initCache()}_initCache(){this._ignoreCache=Object.create(null);this._testCache=Object.create(null)}_addPattern(t){if(t&&t[u]){this._rules=this._rules.concat(t._rules);this._added=true;return}if(checkPattern(t)){const e=createRule(t,this._ignoreCase);this._added=true;this._rules.push(e)}}add(t){this._added=false;makeArray(isString(t)?splitPattern(t):t).forEach(this._addPattern,this);if(this._added){this._initCache()}return this}addPattern(t){return this.add(t)}_testOne(t,e){let r=false;let n=false;this._rules.forEach((s=>{const{negative:o}=s;if(n===o&&r!==n||o&&!r&&!n&&!e){return}const i=s.regex.test(t);if(i){r=!o;n=o}}));return{ignored:r,unignored:n}}_test(t,e,r,n){const s=t&&checkPath.convert(t);checkPath(s,t,this._allowRelativePaths?RETURN_FALSE:throwError);return this._t(s,e,r,n)}_t(t,e,r,n){if(t in e){return e[t]}if(!n){n=t.split(p)}n.pop();if(!n.length){return e[t]=this._testOne(t,r)}const s=this._t(n.join(p)+p,e,r,n);return e[t]=s.ignored?s:this._testOne(t,r)}ignores(t){return this._test(t,this._ignoreCache,false).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return makeArray(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,true)}}const factory=t=>new Ignore(t);const isPathValid=t=>checkPath(t&&checkPath.convert(t),t,RETURN_FALSE);factory.isPathValid=isPathValid;factory.default=factory;t.exports=factory;if(typeof process!=="undefined"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){const makePosix=t=>/^\\\\\?\\/.test(t)||/["<>|\u0000-\u001F]+/u.test(t)?t:t.replace(/\\/g,"/");checkPath.convert=makePosix;const t=/^[a-z]:\//i;checkPath.isNotRelative=e=>t.test(e)||isNotRelative(e)}},382:(t,e,r)=>{"use strict";const n=r(781);const s=n.PassThrough;const o=Array.prototype.slice;t.exports=merge2;function merge2(){const t=[];const e=o.call(arguments);let r=false;let n=e[e.length-1];if(n&&!Array.isArray(n)&&n.pipe==null){e.pop()}else{n={}}const i=n.end!==false;const c=n.pipeError===true;if(n.objectMode==null){n.objectMode=true}if(n.highWaterMark==null){n.highWaterMark=64*1024}const a=s(n);function addStream(){for(let e=0,r=arguments.length;e<r;e++){t.push(pauseStreams(arguments[e],n))}mergeStream();return this}function mergeStream(){if(r){return}r=true;let e=t.shift();if(!e){process.nextTick(endStream);return}if(!Array.isArray(e)){e=[e]}let n=e.length+1;function next(){if(--n>0){return}r=false;mergeStream()}function pipe(t){function onend(){t.removeListener("merge2UnpipeEnd",onend);t.removeListener("end",onend);if(c){t.removeListener("error",onerror)}next()}function onerror(t){a.emit("error",t)}if(t._readableState.endEmitted){return next()}t.on("merge2UnpipeEnd",onend);t.on("end",onend);if(c){t.on("error",onerror)}t.pipe(a,{end:false});t.resume()}for(let t=0;t<e.length;t++){pipe(e[t])}next()}function endStream(){r=false;a.emit("queueDrain");if(i){a.end()}}a.setMaxListeners(0);a.add=addStream;a.on("unpipe",(function(t){t.emit("merge2UnpipeEnd")}));if(e.length){addStream.apply(null,e)}return a}function pauseStreams(t,e){if(!Array.isArray(t)){if(!t._readableState&&t.pipe){t=t.pipe(s(e))}if(!t._readableState||!t.pause||!t.pipe){throw new Error("Only readable stream can be merged.")}t.pause()}else{for(let r=0,n=t.length;r<n;r++){t[r]=pauseStreams(t[r],e)}}return t}},223:(t,e,r)=>{"use strict";const{promisify:n}=r(837);const s=r(147);async function isType(t,e,r){if(typeof r!=="string"){throw new TypeError(`Expected a string, got ${typeof r}`)}try{const o=await n(s[t])(r);return o[e]()}catch(t){if(t.code==="ENOENT"){return false}throw t}}function isTypeSync(t,e,r){if(typeof r!=="string"){throw new TypeError(`Expected a string, got ${typeof r}`)}try{return s[t](r)[e]()}catch(t){if(t.code==="ENOENT"){return false}throw t}}e.isFile=isType.bind(null,"stat","isFile");e.isDirectory=isType.bind(null,"stat","isDirectory");e.isSymlink=isType.bind(null,"lstat","isSymbolicLink");e.isFileSync=isTypeSync.bind(null,"statSync","isFile");e.isDirectorySync=isTypeSync.bind(null,"statSync","isDirectory");e.isSymlinkSync=isTypeSync.bind(null,"lstatSync","isSymbolicLink")},398:t=>{"use strict";t.exports=t=>{const e=/^\\\\\?\\/.test(t);const r=/[^\u0000-\u0080]+/.test(t);if(e||r){return t}return t.replace(/\\/g,"/")}},592:t=>{"use strict";t.exports=require("../fast-glob")},147:t=>{"use strict";t.exports=require("fs")},17:t=>{"use strict";t.exports=require("path")},781:t=>{"use strict";t.exports=require("stream")},837:t=>{"use strict";t.exports=require("util")}};var e={};function __nccwpck_require__(r){var n=e[r];if(n!==undefined){return n.exports}var s=e[r]={exports:{}};var o=true;try{t[r](s,s.exports,__nccwpck_require__);o=false}finally{if(o)delete e[r]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(718);module.exports=r})();
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ {"name":"globby","author":{"email":"sindresorhus@gmail.com","name":"Sindre Sorhus","url":"https://sindresorhus.com"},"version":"11.1.0","funding":"https://github.com/sponsors/sindresorhus","license":"MIT"}