@modern-js/utils 1.6.0 → 1.7.0

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 (84) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/compiled/globby/index.d.ts +1 -1
  3. package/compiled/lodash/index.js +4 -8
  4. package/compiled/semver/classes/comparator.d.ts +17 -0
  5. package/compiled/semver/classes/range.d.ts +21 -0
  6. package/compiled/semver/classes/semver.d.ts +62 -0
  7. package/compiled/semver/functions/clean.d.ts +8 -0
  8. package/compiled/semver/functions/cmp.d.ts +16 -0
  9. package/compiled/semver/functions/coerce.d.ts +12 -0
  10. package/compiled/semver/functions/compare-build.d.ts +16 -0
  11. package/compiled/semver/functions/compare-loose.d.ts +5 -0
  12. package/compiled/semver/functions/compare.d.ts +20 -0
  13. package/compiled/semver/functions/diff.d.ts +13 -0
  14. package/compiled/semver/functions/eq.d.ts +9 -0
  15. package/compiled/semver/functions/gt.d.ts +9 -0
  16. package/compiled/semver/functions/gte.d.ts +9 -0
  17. package/compiled/semver/functions/inc.d.ts +15 -0
  18. package/compiled/semver/functions/lt.d.ts +9 -0
  19. package/compiled/semver/functions/lte.d.ts +8 -0
  20. package/compiled/semver/functions/major.d.ts +9 -0
  21. package/compiled/semver/functions/minor.d.ts +9 -0
  22. package/compiled/semver/functions/neq.d.ts +9 -0
  23. package/compiled/semver/functions/parse.d.ts +12 -0
  24. package/compiled/semver/functions/patch.d.ts +9 -0
  25. package/compiled/semver/functions/prerelease.d.ts +12 -0
  26. package/compiled/semver/functions/rcompare.d.ts +15 -0
  27. package/compiled/semver/functions/rsort.d.ts +9 -0
  28. package/compiled/semver/functions/satisfies.d.ts +14 -0
  29. package/compiled/semver/functions/sort.d.ts +9 -0
  30. package/compiled/semver/functions/valid.d.ts +11 -0
  31. package/compiled/semver/index.d.ts +133 -0
  32. package/compiled/semver/index.js +1 -0
  33. package/compiled/semver/internals/identifiers.d.ts +13 -0
  34. package/compiled/semver/license +15 -0
  35. package/compiled/semver/package.json +1 -0
  36. package/compiled/semver/ranges/gtr.d.ts +14 -0
  37. package/compiled/semver/ranges/intersects.d.ts +13 -0
  38. package/compiled/semver/ranges/ltr.d.ts +14 -0
  39. package/compiled/semver/ranges/max-satisfying.d.ts +14 -0
  40. package/compiled/semver/ranges/min-satisfying.d.ts +14 -0
  41. package/compiled/semver/ranges/min-version.d.ts +10 -0
  42. package/compiled/semver/ranges/outside.d.ts +15 -0
  43. package/compiled/semver/ranges/simplify.d.ts +14 -0
  44. package/compiled/semver/ranges/subset.d.ts +13 -0
  45. package/compiled/semver/ranges/to-comparators.d.ts +9 -0
  46. package/compiled/semver/ranges/valid.d.ts +12 -0
  47. package/dist/alias.js +4 -1
  48. package/dist/analyzeProject.js +3 -12
  49. package/dist/compiled.d.ts +1 -0
  50. package/dist/compiled.js +3 -1
  51. package/dist/emptyDir.js +4 -13
  52. package/dist/format.js +6 -1
  53. package/dist/getEntryOptions.js +2 -1
  54. package/dist/getPackageManager.js +19 -30
  55. package/dist/getPort.js +3 -12
  56. package/dist/getServerConfig.js +2 -11
  57. package/dist/logger.d.ts +3 -0
  58. package/dist/logger.js +21 -6
  59. package/dist/monorepo.js +4 -1
  60. package/dist/nodeEnv.js +24 -39
  61. package/dist/runtimeExports.js +1 -1
  62. package/dist/watch.js +9 -18
  63. package/package.json +33 -10
  64. package/tsconfig.json +1 -0
  65. package/compiled/globby/@nodelib/fs.scandir/out/adapters/fs.d.ts +0 -20
  66. package/compiled/globby/@nodelib/fs.scandir/out/index.d.ts +0 -12
  67. package/compiled/globby/@nodelib/fs.scandir/out/providers/async.d.ts +0 -7
  68. package/compiled/globby/@nodelib/fs.scandir/out/settings.d.ts +0 -20
  69. package/compiled/globby/@nodelib/fs.scandir/out/types/index.d.ts +0 -20
  70. package/compiled/globby/@nodelib/fs.stat/out/adapters/fs.d.ts +0 -13
  71. package/compiled/globby/@nodelib/fs.stat/out/index.d.ts +0 -12
  72. package/compiled/globby/@nodelib/fs.stat/out/providers/async.d.ts +0 -4
  73. package/compiled/globby/@nodelib/fs.stat/out/settings.d.ts +0 -16
  74. package/compiled/globby/@nodelib/fs.stat/out/types/index.d.ts +0 -4
  75. package/compiled/globby/@nodelib/fs.walk/out/index.d.ts +0 -14
  76. package/compiled/globby/@nodelib/fs.walk/out/providers/async.d.ts +0 -12
  77. package/compiled/globby/@nodelib/fs.walk/out/readers/async.d.ts +0 -30
  78. package/compiled/globby/@nodelib/fs.walk/out/readers/reader.d.ts +0 -6
  79. package/compiled/globby/@nodelib/fs.walk/out/settings.d.ts +0 -30
  80. package/compiled/globby/@nodelib/fs.walk/out/types/index.d.ts +0 -8
  81. package/compiled/globby/fast-glob/index.d.ts +0 -27
  82. package/compiled/globby/fast-glob/managers/tasks.d.ts +0 -22
  83. package/compiled/globby/fast-glob/settings.d.ts +0 -164
  84. package/compiled/globby/fast-glob/types/index.d.ts +0 -31
@@ -1,30 +0,0 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- import * as fsScandir from '../../../@nodelib/fs.scandir';
4
- import type Settings from '../settings';
5
- import type { Entry, Errno } from '../types';
6
- import Reader from './reader';
7
- declare type EntryEventCallback = (entry: Entry) => void;
8
- declare type ErrorEventCallback = (error: Errno) => void;
9
- declare type EndEventCallback = () => void;
10
- export default class AsyncReader extends Reader {
11
- protected readonly _settings: Settings;
12
- protected readonly _scandir: typeof fsScandir.scandir;
13
- protected readonly _emitter: EventEmitter;
14
- private readonly _queue;
15
- private _isFatalError;
16
- private _isDestroyed;
17
- constructor(_root: string, _settings: Settings);
18
- read(): EventEmitter;
19
- get isDestroyed(): boolean;
20
- destroy(): void;
21
- onEntry(callback: EntryEventCallback): void;
22
- onError(callback: ErrorEventCallback): void;
23
- onEnd(callback: EndEventCallback): void;
24
- private _pushToQueue;
25
- private _worker;
26
- private _handleError;
27
- private _handleEntry;
28
- private _emitEntry;
29
- }
30
- export {};
@@ -1,6 +0,0 @@
1
- import type Settings from '../settings';
2
- export default class Reader {
3
- protected readonly _root: string;
4
- protected readonly _settings: Settings;
5
- constructor(_root: string, _settings: Settings);
6
- }
@@ -1,30 +0,0 @@
1
- import * as fsScandir from '../../@nodelib/fs.scandir';
2
- import type { Entry, Errno } from './types';
3
- export declare type FilterFunction<T> = (value: T) => boolean;
4
- export declare type DeepFilterFunction = FilterFunction<Entry>;
5
- export declare type EntryFilterFunction = FilterFunction<Entry>;
6
- export declare type ErrorFilterFunction = FilterFunction<Errno>;
7
- export interface Options {
8
- basePath?: string;
9
- concurrency?: number;
10
- deepFilter?: DeepFilterFunction;
11
- entryFilter?: EntryFilterFunction;
12
- errorFilter?: ErrorFilterFunction;
13
- followSymbolicLinks?: boolean;
14
- fs?: Partial<fsScandir.FileSystemAdapter>;
15
- pathSegmentSeparator?: string;
16
- stats?: boolean;
17
- throwErrorOnBrokenSymbolicLink?: boolean;
18
- }
19
- export default class Settings {
20
- private readonly _options;
21
- readonly basePath?: string;
22
- readonly concurrency: number;
23
- readonly deepFilter: DeepFilterFunction | null;
24
- readonly entryFilter: EntryFilterFunction | null;
25
- readonly errorFilter: ErrorFilterFunction | null;
26
- readonly pathSegmentSeparator: string;
27
- readonly fsScandirSettings: fsScandir.Settings;
28
- constructor(_options?: Options);
29
- private _getValue;
30
- }
@@ -1,8 +0,0 @@
1
- /// <reference types="node" />
2
- import type * as scandir from '../../../@nodelib/fs.scandir';
3
- export declare type Entry = scandir.Entry;
4
- export declare type Errno = NodeJS.ErrnoException;
5
- export interface QueueItem {
6
- directory: string;
7
- base?: string;
8
- }
@@ -1,27 +0,0 @@
1
- /// <reference types="node" />
2
- import * as taskManager from './managers/tasks';
3
- import { Options as OptionsInternal } from './settings';
4
- import { Entry as EntryInternal, FileSystemAdapter as FileSystemAdapterInternal, Pattern as PatternInternal } from './types';
5
- declare type EntryObjectModePredicate = {
6
- [TKey in keyof Pick<OptionsInternal, 'objectMode'>]-?: true;
7
- };
8
- declare type EntryStatsPredicate = {
9
- [TKey in keyof Pick<OptionsInternal, 'stats'>]-?: true;
10
- };
11
- declare type EntryObjectPredicate = EntryObjectModePredicate | EntryStatsPredicate;
12
- declare function FastGlob(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): Promise<EntryInternal[]>;
13
- declare function FastGlob(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Promise<string[]>;
14
- declare namespace FastGlob {
15
- type Options = OptionsInternal;
16
- type Entry = EntryInternal;
17
- type Task = taskManager.Task;
18
- type Pattern = PatternInternal;
19
- type FileSystemAdapter = FileSystemAdapterInternal;
20
- function sync(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): EntryInternal[];
21
- function sync(source: PatternInternal | PatternInternal[], options?: OptionsInternal): string[];
22
- function stream(source: PatternInternal | PatternInternal[], options?: OptionsInternal): NodeJS.ReadableStream;
23
- function generateTasks(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Task[];
24
- function isDynamicPattern(source: PatternInternal, options?: OptionsInternal): boolean;
25
- function escapePath(source: PatternInternal): PatternInternal;
26
- }
27
- export = FastGlob;
@@ -1,22 +0,0 @@
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;
@@ -1,164 +0,0 @@
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
- }
@@ -1,31 +0,0 @@
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;