@boundaries/elements 1.2.0 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +223 -64
- package/dist/index.browser.d.mts +219 -309
- package/dist/index.browser.d.ts +219 -309
- package/dist/index.browser.js +413 -419
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +413 -419
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +219 -309
- package/dist/index.d.ts +219 -309
- package/dist/index.js +416 -426
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +413 -419
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -6
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
* Type representing a micromatch pattern, which can be a string or an array of strings.
|
|
3
3
|
*/
|
|
4
4
|
type MicromatchPattern = string | string[];
|
|
5
|
+
/**
|
|
6
|
+
* Type representing a micromatch pattern supporting null values
|
|
7
|
+
*/
|
|
8
|
+
type MicromatchPatternNullable = string | null | (string | null)[];
|
|
9
|
+
/**
|
|
10
|
+
* Type representing values that can be matched against micromatch patterns.
|
|
11
|
+
*/
|
|
12
|
+
type MicromatchMatchableValue = string | string[] | null | undefined | boolean;
|
|
5
13
|
/**
|
|
6
14
|
* Configuration options for categorizing dependencies as external or local.
|
|
7
15
|
*/
|
|
@@ -150,14 +158,17 @@ type ElementDescriptor = ElementDescriptorWithType | ElementDescriptorWithCatego
|
|
|
150
158
|
* Array of element descriptors.
|
|
151
159
|
*/
|
|
152
160
|
type ElementDescriptors = ElementDescriptor[];
|
|
161
|
+
type ElementDescriptionWithSource = ElementDescription & {
|
|
162
|
+
module?: string | null;
|
|
163
|
+
};
|
|
153
164
|
/**
|
|
154
165
|
* Serialized cache of element descriptions.
|
|
155
166
|
*/
|
|
156
|
-
type DescriptionsSerializedCache = Record<string, ElementDescription>;
|
|
167
|
+
type DescriptionsSerializedCache = Record<string, ElementDescription | ElementDescriptionWithSource>;
|
|
157
168
|
/**
|
|
158
169
|
* Serialized cache of file elements.
|
|
159
170
|
*/
|
|
160
|
-
type FileElementsSerializedCache = Record<string,
|
|
171
|
+
type FileElementsSerializedCache = Record<string, ElementDescription>;
|
|
161
172
|
/**
|
|
162
173
|
* Serialized cache for ElementsDescriptor class.
|
|
163
174
|
*/
|
|
@@ -189,17 +200,13 @@ type ElementOrigin = (typeof ELEMENT_ORIGINS_MAP)[keyof typeof ELEMENT_ORIGINS_M
|
|
|
189
200
|
/**
|
|
190
201
|
* Base element properties related to captured values
|
|
191
202
|
*/
|
|
192
|
-
type
|
|
203
|
+
type BaseElementDescription = {
|
|
193
204
|
/** Absolute path of the file. It might be null when a dependency path can't be resolved */
|
|
194
205
|
path: string | null;
|
|
195
206
|
/** Path of the file relative to the element, or null if the element is ignored or unknown */
|
|
196
207
|
elementPath: string | null;
|
|
197
208
|
/** Internal path of the file relative to the elementPath, or null if the element is ignored or unknown */
|
|
198
209
|
internalPath: string | null;
|
|
199
|
-
/** Source of the element when it is a dependency, or null if the element is not a dependency, or it is ignored or unknown */
|
|
200
|
-
source: string | null;
|
|
201
|
-
/** Base source of the element when it is an external or core dependency, null otherwise */
|
|
202
|
-
baseSource: string | null;
|
|
203
210
|
/** Type of the element, or null if the element is ignored or unknown */
|
|
204
211
|
type: string | null;
|
|
205
212
|
/** Category of the element, or null if the element is ignored or unknown */
|
|
@@ -231,7 +238,7 @@ type ElementParent = {
|
|
|
231
238
|
/**
|
|
232
239
|
* Description of an ignored element
|
|
233
240
|
*/
|
|
234
|
-
type IgnoredElement =
|
|
241
|
+
type IgnoredElement = BaseElementDescription & {
|
|
235
242
|
/** Type of the element */
|
|
236
243
|
type: null;
|
|
237
244
|
/** Category of the element */
|
|
@@ -248,7 +255,7 @@ type IgnoredElement = BaseElement & {
|
|
|
248
255
|
/**
|
|
249
256
|
* Description of an unknown local element
|
|
250
257
|
*/
|
|
251
|
-
type LocalElementUnknown =
|
|
258
|
+
type LocalElementUnknown = BaseElementDescription & {
|
|
252
259
|
/** Type of the element */
|
|
253
260
|
type: null;
|
|
254
261
|
/** Category of the element */
|
|
@@ -265,7 +272,7 @@ type LocalElementUnknown = BaseElement & {
|
|
|
265
272
|
/**
|
|
266
273
|
* Description of a local element (file)
|
|
267
274
|
*/
|
|
268
|
-
type LocalElementKnown =
|
|
275
|
+
type LocalElementKnown = BaseElementDescription & {
|
|
269
276
|
/** Path of the element */
|
|
270
277
|
path: string;
|
|
271
278
|
/** Captured values from the parent element */
|
|
@@ -284,65 +291,23 @@ type LocalElementKnown = BaseElement & {
|
|
|
284
291
|
isUnknown: false;
|
|
285
292
|
};
|
|
286
293
|
/**
|
|
287
|
-
*
|
|
288
|
-
*/
|
|
289
|
-
type BaseDependencyElement = BaseElement & {
|
|
290
|
-
/** Dependency source */
|
|
291
|
-
source: string;
|
|
292
|
-
/** Indicates that dependencies are not ignored */
|
|
293
|
-
isIgnored: false;
|
|
294
|
-
};
|
|
295
|
-
/**
|
|
296
|
-
* Description of a local dependency (known)
|
|
297
|
-
*/
|
|
298
|
-
type LocalDependencyElementKnown = LocalElementKnown & BaseDependencyElement;
|
|
299
|
-
/**
|
|
300
|
-
* Description of a local dependency (unknown)
|
|
294
|
+
* Description of an unknown external element.
|
|
301
295
|
*/
|
|
302
|
-
type
|
|
303
|
-
/**
|
|
304
|
-
* Description of a local dependency
|
|
305
|
-
*/
|
|
306
|
-
type LocalDependencyElement = LocalDependencyElementKnown | LocalDependencyElementUnknown;
|
|
307
|
-
/**
|
|
308
|
-
* Description of an external dependency
|
|
309
|
-
*/
|
|
310
|
-
type ExternalDependencyElement = BaseDependencyElement & {
|
|
311
|
-
/** Path of the dependency relative to the base module */
|
|
312
|
-
internalPath: string;
|
|
313
|
-
/** Base module of the external dependency */
|
|
314
|
-
baseSource: string;
|
|
315
|
-
/** Indicates that the dependency is external */
|
|
296
|
+
type ExternalElementDescription = BaseElementDescription & {
|
|
316
297
|
origin: typeof ELEMENT_ORIGINS_MAP.EXTERNAL;
|
|
298
|
+
isIgnored: false;
|
|
317
299
|
};
|
|
318
300
|
/**
|
|
319
|
-
* Description of
|
|
301
|
+
* Description of an unknown core element.
|
|
320
302
|
*/
|
|
321
|
-
type
|
|
322
|
-
/** Base module of the core dependency */
|
|
323
|
-
baseSource: string;
|
|
324
|
-
/** Indicates that the dependency is core */
|
|
303
|
+
type CoreElementDescription = BaseElementDescription & {
|
|
325
304
|
origin: typeof ELEMENT_ORIGINS_MAP.CORE;
|
|
305
|
+
isIgnored: false;
|
|
326
306
|
};
|
|
327
|
-
/**
|
|
328
|
-
* Description of an ignored dependency element
|
|
329
|
-
*/
|
|
330
|
-
type IgnoredDependencyElement = IgnoredElement & {
|
|
331
|
-
/** The source of the dependency */
|
|
332
|
-
source: string;
|
|
333
|
-
};
|
|
334
|
-
/**
|
|
335
|
-
* Description of a file
|
|
336
|
-
*/
|
|
337
|
-
type FileElement = IgnoredElement | LocalElementKnown | LocalElementUnknown;
|
|
338
|
-
/**
|
|
339
|
-
* Description of a dependency
|
|
340
|
-
*/
|
|
341
|
-
type DependencyElementDescription = IgnoredDependencyElement | CoreDependencyElement | LocalDependencyElement | ExternalDependencyElement;
|
|
342
307
|
/**
|
|
343
308
|
* Description of an element, either local or dependency
|
|
344
309
|
*/
|
|
345
|
-
type ElementDescription =
|
|
310
|
+
type ElementDescription = LocalElementKnown | LocalElementUnknown | IgnoredElement | ExternalElementDescription | CoreElementDescription;
|
|
346
311
|
|
|
347
312
|
/**
|
|
348
313
|
* Determines if the given value is a valid element descriptor mode.
|
|
@@ -385,7 +350,7 @@ declare function isElementDescriptor(value: unknown): value is ElementDescriptor
|
|
|
385
350
|
* @param value The value to check
|
|
386
351
|
* @returns True if the value is a valid BaseElement, false otherwise
|
|
387
352
|
*/
|
|
388
|
-
declare function isBaseElement(value: unknown): value is
|
|
353
|
+
declare function isBaseElement(value: unknown): value is BaseElementDescription;
|
|
389
354
|
/**
|
|
390
355
|
* Determines if the given value is an ignored element.
|
|
391
356
|
* @param value The element to check.
|
|
@@ -410,36 +375,30 @@ declare function isUnknownLocalElement(value: unknown): value is LocalElementUnk
|
|
|
410
375
|
* @returns True if the element is an unknown element, false otherwise.
|
|
411
376
|
*/
|
|
412
377
|
declare function isKnownLocalElement(value: unknown): value is LocalElementKnown;
|
|
413
|
-
/**
|
|
414
|
-
* Determines if the given value is a dependency element.
|
|
415
|
-
* @param value The element to check.
|
|
416
|
-
* @returns True if the element is a dependency element, false otherwise.
|
|
417
|
-
*/
|
|
418
|
-
declare function isDependencyElementDescription(value: unknown): value is DependencyElementDescription;
|
|
419
|
-
/**
|
|
420
|
-
* Determines if the given value is an element (local or dependency).
|
|
421
|
-
* @param value The value to check.
|
|
422
|
-
* @returns True if the value is an element, false otherwise.
|
|
423
|
-
*/
|
|
424
|
-
declare function isElementDescription(value: unknown): value is ElementDescription;
|
|
425
378
|
/**
|
|
426
379
|
* Determines if the given value is a local dependency element.
|
|
427
380
|
* @param value The value to check.
|
|
428
381
|
* @returns True if the element is a local dependency element, false otherwise.
|
|
429
382
|
*/
|
|
430
|
-
declare function isLocalDependencyElement(value: unknown): value is
|
|
383
|
+
declare function isLocalDependencyElement(value: unknown): value is LocalElementKnown | LocalElementUnknown;
|
|
431
384
|
/**
|
|
432
385
|
* Determines if the given value is an external element.
|
|
433
386
|
* @param value The value to check.
|
|
434
387
|
* @returns True if the element is an external dependency element, false otherwise.
|
|
435
388
|
*/
|
|
436
|
-
declare function isExternalDependencyElement(value: unknown): value is
|
|
389
|
+
declare function isExternalDependencyElement(value: unknown): value is ElementDescription;
|
|
437
390
|
/**
|
|
438
391
|
* Determines if the given value is a core element.
|
|
439
392
|
* @param value The value to check.
|
|
440
393
|
* @returns True if the element is a core dependency element, false otherwise.
|
|
441
394
|
*/
|
|
442
|
-
declare function isCoreDependencyElement(value: unknown): value is
|
|
395
|
+
declare function isCoreDependencyElement(value: unknown): value is ElementDescription;
|
|
396
|
+
/**
|
|
397
|
+
* Determines if the given value is an element (local or dependency).
|
|
398
|
+
* @param value The value to check.
|
|
399
|
+
* @returns True if the value is an element, false otherwise.
|
|
400
|
+
*/
|
|
401
|
+
declare function isElementDescription(value: unknown): value is ElementDescription;
|
|
443
402
|
|
|
444
403
|
declare const DEPENDENCY_KIND_TYPE: "type";
|
|
445
404
|
declare const DEPENDENCY_KIND_VALUE: "value";
|
|
@@ -488,6 +447,10 @@ declare const DEPENDENCY_RELATIONSHIPS_INVERTED_MAP: {
|
|
|
488
447
|
type DependencyRelationship = (typeof DEPENDENCY_RELATIONSHIPS_MAP)[keyof typeof DEPENDENCY_RELATIONSHIPS_MAP];
|
|
489
448
|
/** Information about a dependency between two elements */
|
|
490
449
|
type ElementsDependencyInfo = {
|
|
450
|
+
/** Source of the dependency (import/export path) */
|
|
451
|
+
source: string;
|
|
452
|
+
/** Base source of the dependency for external/core modules */
|
|
453
|
+
module: string | null;
|
|
491
454
|
/** Kind of the dependency */
|
|
492
455
|
kind: DependencyKind;
|
|
493
456
|
/** Type of the node creating the dependency in the dependent element */
|
|
@@ -507,9 +470,9 @@ type ElementsDependencyInfo = {
|
|
|
507
470
|
*/
|
|
508
471
|
type DependencyDescription = {
|
|
509
472
|
/** Source element of the dependency */
|
|
510
|
-
from:
|
|
473
|
+
from: ElementDescription;
|
|
511
474
|
/** Target element of the dependency */
|
|
512
|
-
to:
|
|
475
|
+
to: ElementDescription;
|
|
513
476
|
/** Information about the dependency */
|
|
514
477
|
dependency: ElementsDependencyInfo;
|
|
515
478
|
};
|
|
@@ -585,16 +548,18 @@ type DescriptorsSerializedCache = {
|
|
|
585
548
|
*/
|
|
586
549
|
type DependencyMatchResult = {
|
|
587
550
|
/** The selector matching result for the 'from' element. */
|
|
588
|
-
from:
|
|
551
|
+
from: BaseElementSelectorData | null;
|
|
589
552
|
/** The selector matching result for the 'to' element. */
|
|
590
|
-
to:
|
|
553
|
+
to: BaseElementSelectorData | null;
|
|
554
|
+
/** The selector matching result for the dependency metadata. */
|
|
555
|
+
dependency: DependencyDataSelectorData | null;
|
|
591
556
|
/** Whether the dependency matches all the selector properties provided */
|
|
592
557
|
isMatch: boolean;
|
|
593
558
|
};
|
|
594
559
|
/**
|
|
595
560
|
* Serialized cache of elements matcher.
|
|
596
561
|
*/
|
|
597
|
-
type ElementsMatcherSerializedCache = Record<string,
|
|
562
|
+
type ElementsMatcherSerializedCache = Record<string, BaseElementSelectorData | null>;
|
|
598
563
|
/**
|
|
599
564
|
* Serialized cache of dependencies matcher.
|
|
600
565
|
*/
|
|
@@ -615,34 +580,36 @@ type MicromatchSerializedCache = {
|
|
|
615
580
|
/**
|
|
616
581
|
* Elements that can return a match when using an element selector.
|
|
617
582
|
*/
|
|
618
|
-
type SelectableElement =
|
|
583
|
+
type SelectableElement = ElementDescription;
|
|
619
584
|
/**
|
|
620
585
|
* Selector for matching captured values in element selectors.
|
|
621
586
|
* It is a record where the keys are the names of the captured values and the values are the patterns to match on those captured values.
|
|
587
|
+
* When provided as an array, each element in the array represents an alternative (OR logic) - the selector matches if any of the array elements matches.
|
|
622
588
|
*/
|
|
623
|
-
type CapturedValuesSelector = Record<string,
|
|
589
|
+
type CapturedValuesSelector = Record<string, MicromatchPatternNullable> | Array<Record<string, MicromatchPatternNullable>>;
|
|
624
590
|
/**
|
|
625
|
-
*
|
|
591
|
+
* Selector for matching the first parent element.
|
|
626
592
|
*/
|
|
627
|
-
type
|
|
593
|
+
type ParentElementSelectorData = {
|
|
594
|
+
/** Type of the first parent element */
|
|
595
|
+
type?: MicromatchPatternNullable;
|
|
596
|
+
/** Category of the first parent element */
|
|
597
|
+
category?: MicromatchPatternNullable;
|
|
598
|
+
/** Path of the first parent element */
|
|
599
|
+
elementPath?: MicromatchPatternNullable;
|
|
600
|
+
/** Captured values from the first parent element */
|
|
601
|
+
captured?: CapturedValuesSelector;
|
|
602
|
+
};
|
|
628
603
|
/**
|
|
629
|
-
*
|
|
604
|
+
* Data to pass to selector templates when they are rendered before matching.
|
|
630
605
|
*/
|
|
631
|
-
type
|
|
632
|
-
/** The kind of the dependency */
|
|
633
|
-
kind?: MicromatchPattern;
|
|
634
|
-
};
|
|
606
|
+
type TemplateData = Record<string, unknown>;
|
|
635
607
|
/**
|
|
636
608
|
* Options for elements and dependencies matchers.
|
|
637
609
|
*/
|
|
638
610
|
type MatcherOptions = {
|
|
639
611
|
/** Extra data to pass to captured values templates. By default, data from the element and dependency being matched is passed as to/from. */
|
|
640
612
|
extraTemplateData?: TemplateData;
|
|
641
|
-
/**
|
|
642
|
-
* Properties to add to all dependency selectors used in the matcher. Added for backwards compatibility, because eslint-plugin rules defined importKind at the top level of the rule options.
|
|
643
|
-
* @deprecated Use 'kind' property directly in the dependency element selectors instead.
|
|
644
|
-
**/
|
|
645
|
-
dependencySelectorsGlobals?: MatcherOptionsDependencySelectorsGlobals;
|
|
646
613
|
};
|
|
647
614
|
/**
|
|
648
615
|
* Simple element selector by type, represented as a string matching the element type.
|
|
@@ -654,40 +621,47 @@ type SimpleElementSelectorByType = string;
|
|
|
654
621
|
*/
|
|
655
622
|
type BaseElementSelectorData = {
|
|
656
623
|
/** Micromatch pattern(s) to match the path of the element */
|
|
657
|
-
path?:
|
|
624
|
+
path?: MicromatchPatternNullable;
|
|
658
625
|
/** Micromatch pattern(s) to match the path of the element containing the file */
|
|
659
|
-
elementPath?:
|
|
626
|
+
elementPath?: MicromatchPatternNullable;
|
|
660
627
|
/** Micromatch pattern(s) to match internal paths within the file or dependency, relative to the element path */
|
|
661
|
-
internalPath?:
|
|
628
|
+
internalPath?: MicromatchPatternNullable;
|
|
662
629
|
/** Type of the element */
|
|
663
|
-
type?:
|
|
630
|
+
type?: MicromatchPatternNullable;
|
|
664
631
|
/** Category of the element */
|
|
665
|
-
category?:
|
|
632
|
+
category?: MicromatchPatternNullable;
|
|
666
633
|
/** Captured values selector for dynamic matching */
|
|
667
634
|
captured?: CapturedValuesSelector;
|
|
635
|
+
/** Selector for matching the first parent element */
|
|
636
|
+
parent?: ParentElementSelectorData | null;
|
|
668
637
|
/** Origin of the element */
|
|
669
|
-
origin?:
|
|
670
|
-
/** Micromatch pattern(s) to match the source of the dependency */
|
|
671
|
-
source?: MicromatchPattern;
|
|
672
|
-
/** Base source of the element, e.g., the import path of a dependency */
|
|
673
|
-
baseSource?: MicromatchPattern;
|
|
638
|
+
origin?: MicromatchPatternNullable;
|
|
674
639
|
/** Whether the element is ignored */
|
|
675
640
|
isIgnored?: boolean;
|
|
676
641
|
/** Whether the element is unknown */
|
|
677
642
|
isUnknown?: boolean;
|
|
678
643
|
};
|
|
679
644
|
/**
|
|
680
|
-
* Selector for dependency
|
|
645
|
+
* Selector for dependency metadata.
|
|
681
646
|
*/
|
|
682
|
-
type
|
|
683
|
-
/** Relationship
|
|
684
|
-
relationship?:
|
|
647
|
+
type DependencyDataSelectorData = {
|
|
648
|
+
/** Relationship between both elements, from both perspectives */
|
|
649
|
+
relationship?: {
|
|
650
|
+
/** Relationship from dependant element perspective */
|
|
651
|
+
from?: MicromatchPatternNullable;
|
|
652
|
+
/** Relationship from dependency element perspective */
|
|
653
|
+
to?: MicromatchPatternNullable;
|
|
654
|
+
};
|
|
685
655
|
/** Dependency kind to filter elements */
|
|
686
|
-
kind?:
|
|
656
|
+
kind?: MicromatchPatternNullable;
|
|
687
657
|
/** Micromatch pattern(s) to match only specific imports/exports */
|
|
688
|
-
specifiers?:
|
|
658
|
+
specifiers?: MicromatchPatternNullable;
|
|
689
659
|
/** Node kind to filter elements */
|
|
690
|
-
nodeKind?:
|
|
660
|
+
nodeKind?: MicromatchPatternNullable;
|
|
661
|
+
/** Dependency source used in import/export statements */
|
|
662
|
+
source?: MicromatchPatternNullable;
|
|
663
|
+
/** Base source of the dependency for external/core modules */
|
|
664
|
+
module?: MicromatchPatternNullable;
|
|
691
665
|
};
|
|
692
666
|
/**
|
|
693
667
|
* File Element selector with options, including captured values for dynamic matching.
|
|
@@ -699,32 +673,16 @@ type BaseElementSelectorWithOptions = [
|
|
|
699
673
|
SimpleElementSelectorByType,
|
|
700
674
|
CapturedValuesSelector
|
|
701
675
|
];
|
|
702
|
-
/**
|
|
703
|
-
* Dependency Element selector with options, including captured values for dynamic matching.
|
|
704
|
-
* It is represented as a tuple where the first element is the element type (string)
|
|
705
|
-
* and the second element is an object containing a selector for captured values.
|
|
706
|
-
* @deprecated Use DependencyElementSelectorData defining an object with type and/or category and the rest of properties directly instead.
|
|
707
|
-
*/
|
|
708
|
-
type DependencyElementSelectorWithOptions = [
|
|
709
|
-
SimpleElementSelectorByType,
|
|
710
|
-
CapturedValuesSelector
|
|
711
|
-
];
|
|
712
676
|
/**
|
|
713
677
|
* Base Element selector, which can be a simple string, object with type and/or category, or a base element selector with options.
|
|
714
678
|
*/
|
|
715
679
|
type BaseElementSelector = SimpleElementSelectorByType | BaseElementSelectorData | BaseElementSelectorWithOptions;
|
|
716
680
|
/**
|
|
717
|
-
*
|
|
681
|
+
* Base elements selector, which can be a single base element selector or an array of base element selectors.
|
|
718
682
|
*/
|
|
719
|
-
type DependencyElementSelector = SimpleElementSelectorByType | DependencyElementSelectorData | DependencyElementSelectorWithOptions;
|
|
720
|
-
/** Base elements selector, which can be a single base element selector or an array of base element selectors. */
|
|
721
683
|
type BaseElementsSelector = BaseElementSelector | BaseElementSelector[];
|
|
722
|
-
/** Dependency
|
|
723
|
-
type
|
|
724
|
-
/**
|
|
725
|
-
* Element selector data, which may be a base element selector or a dependency element selector.
|
|
726
|
-
*/
|
|
727
|
-
type ElementSelectorData = BaseElementSelectorData | DependencyElementSelectorData;
|
|
684
|
+
/** Dependency metadata selector, which can be a single selector or an array of selectors. */
|
|
685
|
+
type DependencyDataSelector = DependencyDataSelectorData | DependencyDataSelectorData[];
|
|
728
686
|
/**
|
|
729
687
|
* Generic Element selector with options, including captured values for dynamic matching.
|
|
730
688
|
* It is represented as a tuple where the first element is the element type (string)
|
|
@@ -738,11 +696,11 @@ type ElementSelectorWithOptions = [
|
|
|
738
696
|
/**
|
|
739
697
|
* Element selector, which can be a simple string, object with type and/or category, or an element selector with options.
|
|
740
698
|
*/
|
|
741
|
-
type ElementSelector = SimpleElementSelectorByType |
|
|
699
|
+
type ElementSelector = SimpleElementSelectorByType | BaseElementSelectorData | ElementSelectorWithOptions;
|
|
742
700
|
/**
|
|
743
701
|
* Elements selector, which can be a single element selector or an array of element selectors.
|
|
744
702
|
*/
|
|
745
|
-
type ElementsSelector = BaseElementsSelector
|
|
703
|
+
type ElementsSelector = BaseElementsSelector;
|
|
746
704
|
/**
|
|
747
705
|
* Element selectors, which can be a single element selector or an array of element selectors.
|
|
748
706
|
* @deprecated Use ElementsSelector instead.
|
|
@@ -755,7 +713,9 @@ type DependencySelector = {
|
|
|
755
713
|
/** Selector for the dependant elements. The file originating the dependency */
|
|
756
714
|
from?: BaseElementsSelector;
|
|
757
715
|
/** Selector for the dependency elements. The element being imported/exported */
|
|
758
|
-
to?:
|
|
716
|
+
to?: BaseElementsSelector;
|
|
717
|
+
/** Selector for dependency metadata */
|
|
718
|
+
dependency?: DependencyDataSelector;
|
|
759
719
|
};
|
|
760
720
|
/**
|
|
761
721
|
* Normalized dependency selector, where 'from' and 'to' are always arrays or null.
|
|
@@ -764,40 +724,14 @@ type DependencySelectorNormalized = {
|
|
|
764
724
|
/** Selector for the dependant elements. The file originating the dependency */
|
|
765
725
|
from: BaseElementSelectorData[] | null;
|
|
766
726
|
/** Selector for the dependency elements. The element being imported/exported */
|
|
767
|
-
to:
|
|
727
|
+
to: BaseElementSelectorData[] | null;
|
|
728
|
+
/** Selector for dependency metadata */
|
|
729
|
+
dependency: DependencyDataSelectorData[] | null;
|
|
768
730
|
};
|
|
769
731
|
/**
|
|
770
|
-
*
|
|
771
|
-
* If specifiers are provided, they will be used to match specific imports from the external library.
|
|
732
|
+
* @deprecated Use DependencySelectorDependencyData instead.
|
|
772
733
|
*/
|
|
773
|
-
type
|
|
774
|
-
/**
|
|
775
|
-
* Micromatch pattern(s) to match only one or more specific subpaths of the external library.
|
|
776
|
-
*/
|
|
777
|
-
path?: MicromatchPattern;
|
|
778
|
-
/** Micromatch pattern(s) to match only specific imports/exports */
|
|
779
|
-
specifiers?: string[];
|
|
780
|
-
};
|
|
781
|
-
/**
|
|
782
|
-
* External library selector with options, represented as a tuple where the first element is the import path of the external library, and the second element is an object containing options for selecting only specific paths or specifiers from that library.
|
|
783
|
-
*/
|
|
784
|
-
type ExternalLibrarySelectorWithOptions = [
|
|
785
|
-
SimpleElementSelectorByType,
|
|
786
|
-
ExternalLibrarySelectorOptions
|
|
787
|
-
];
|
|
788
|
-
/**
|
|
789
|
-
* External library selector, which can be a simple string (the import path) or an external library selector with options.
|
|
790
|
-
*/
|
|
791
|
-
type ExternalLibrarySelector = SimpleElementSelectorByType | ExternalLibrarySelectorWithOptions;
|
|
792
|
-
/**
|
|
793
|
-
* External library selectors, which can be a single external library selector or an array of external library selectors.
|
|
794
|
-
* @deprecated Use ExternalLibrariesSelector instead.
|
|
795
|
-
*/
|
|
796
|
-
type ExternalLibrarySelectors = ExternalLibrariesSelector;
|
|
797
|
-
/**
|
|
798
|
-
* External libraries selector, which can be a single external library selector or an array of external library selectors.
|
|
799
|
-
*/
|
|
800
|
-
type ExternalLibrariesSelector = ExternalLibrarySelector | ExternalLibrarySelector[];
|
|
734
|
+
type DependencyElementSelectorData = DependencyDataSelectorData;
|
|
801
735
|
|
|
802
736
|
/**
|
|
803
737
|
* Micromatch wrapper class with caching capabilities.
|
|
@@ -856,13 +790,6 @@ declare class Micromatch {
|
|
|
856
790
|
makeRe(pattern: string): RegExp;
|
|
857
791
|
}
|
|
858
792
|
|
|
859
|
-
/**
|
|
860
|
-
* Normalizes an ElementsSelector into an array of ElementSelectorData.
|
|
861
|
-
* @param elementsSelector The elements selector, in any supported format.
|
|
862
|
-
* @returns The normalized array of selector data.
|
|
863
|
-
*/
|
|
864
|
-
declare function normalizeElementsSelector(elementsSelector: BaseElementsSelector): BaseElementSelectorData[];
|
|
865
|
-
declare function normalizeElementsSelector(elementsSelector: DependencyElementsSelector): DependencyElementSelectorData[];
|
|
866
793
|
/**
|
|
867
794
|
* Base matcher class to determine if elements or dependencies match a given selector.
|
|
868
795
|
*/
|
|
@@ -907,7 +834,13 @@ declare class BaseElementsMatcher {
|
|
|
907
834
|
* @param extraTemplateData The data to use for replace in the templates.
|
|
908
835
|
* @returns The rendered templates.
|
|
909
836
|
*/
|
|
910
|
-
protected getRenderedTemplates(template:
|
|
837
|
+
protected getRenderedTemplates(template: MicromatchPatternNullable, templateData: TemplateData): MicromatchPatternNullable;
|
|
838
|
+
/**
|
|
839
|
+
* Cleans a micromatch pattern by removing falsy values from arrays.
|
|
840
|
+
* @param pattern The micromatch pattern(s) to clean.
|
|
841
|
+
* @returns The cleaned pattern. If an array is provided, falsy entries are removed and the resulting array may be empty. If null is provided, null is returned unchanged.
|
|
842
|
+
*/
|
|
843
|
+
protected cleanMicromatchPattern(pattern: MicromatchPatternNullable): string | string[] | null;
|
|
911
844
|
/**
|
|
912
845
|
* Returns whether the given value matches the micromatch pattern, converting non-string values to strings.
|
|
913
846
|
* Optimized version with caching for better performance.
|
|
@@ -915,7 +848,7 @@ declare class BaseElementsMatcher {
|
|
|
915
848
|
* @param pattern The micromatch pattern to match against.
|
|
916
849
|
* @returns Whether the value matches the pattern.
|
|
917
850
|
*/
|
|
918
|
-
protected isMicromatchMatch(value:
|
|
851
|
+
protected isMicromatchMatch(value: string | null | undefined | boolean, pattern: MicromatchPatternNullable): boolean;
|
|
919
852
|
/**
|
|
920
853
|
* Returns whether the given value matches the micromatch pattern after rendering it as a template.
|
|
921
854
|
* @param pattern The micromatch pattern to render and match against.
|
|
@@ -923,13 +856,13 @@ declare class BaseElementsMatcher {
|
|
|
923
856
|
* @param value The value to check.
|
|
924
857
|
* @returns Whether the value matches the rendered pattern.
|
|
925
858
|
*/
|
|
926
|
-
protected isTemplateMicromatchMatch(pattern:
|
|
859
|
+
protected isTemplateMicromatchMatch(pattern: MicromatchPatternNullable, templateData: TemplateData, value: MicromatchMatchableValue): boolean;
|
|
927
860
|
/**
|
|
928
861
|
* Whether the given element key matches the selector key as booleans.
|
|
929
862
|
* @param param0 The parameters object.
|
|
930
863
|
* @returns Whether the element key matches the selector key.
|
|
931
864
|
*/
|
|
932
|
-
protected isElementKeyBooleanMatch<T extends
|
|
865
|
+
protected isElementKeyBooleanMatch<T extends BaseElementDescription, S extends BaseElementSelectorData>({
|
|
933
866
|
/** The element to check. */
|
|
934
867
|
element,
|
|
935
868
|
/** The selector to check against. */
|
|
@@ -952,17 +885,17 @@ declare class BaseElementsMatcher {
|
|
|
952
885
|
* @param param0 The parameters object.
|
|
953
886
|
* @returns Whether the element key matches the selector key.
|
|
954
887
|
*/
|
|
955
|
-
protected isElementKeyMicromatchMatch<T extends SelectableElement, S extends BaseElementSelectorData
|
|
888
|
+
protected isElementKeyMicromatchMatch<T extends SelectableElement, S extends BaseElementSelectorData, K extends keyof T>({ element, selector, elementKey, selectorKey, selectorValue, templateData, }: {
|
|
956
889
|
/** The element to check. */
|
|
957
|
-
element: T
|
|
890
|
+
element: T & Record<K, MicromatchMatchableValue>;
|
|
958
891
|
/** The selector to check against. */
|
|
959
892
|
selector: S;
|
|
960
893
|
/** The key of the element to check. */
|
|
961
|
-
elementKey:
|
|
894
|
+
elementKey: K;
|
|
962
895
|
/** The key of the selector to check against. */
|
|
963
|
-
selectorKey:
|
|
896
|
+
selectorKey: keyof BaseElementSelectorData;
|
|
964
897
|
/** The value of the selector key to check against. */
|
|
965
|
-
selectorValue?:
|
|
898
|
+
selectorValue?: MicromatchPatternNullable;
|
|
966
899
|
/** Data to pass when the selector value is rendered as a template */
|
|
967
900
|
templateData: TemplateData;
|
|
968
901
|
}): boolean;
|
|
@@ -972,8 +905,6 @@ declare class BaseElementsMatcher {
|
|
|
972
905
|
* Matcher class to determine if elements match a given selector.
|
|
973
906
|
*/
|
|
974
907
|
declare class ElementsMatcher extends BaseElementsMatcher {
|
|
975
|
-
/** Whether the cache is enabled or not */
|
|
976
|
-
private readonly _cacheIsEnabled;
|
|
977
908
|
/**
|
|
978
909
|
* Creates a new ElementsSelectorMatcher.
|
|
979
910
|
* @param config Configuration options for the matcher.
|
|
@@ -1030,29 +961,38 @@ declare class ElementsMatcher extends BaseElementsMatcher {
|
|
|
1030
961
|
*/
|
|
1031
962
|
private _isOriginMatch;
|
|
1032
963
|
/**
|
|
1033
|
-
*
|
|
1034
|
-
* @param
|
|
1035
|
-
* @param
|
|
1036
|
-
* @param templateData The data to use for replace in selector
|
|
1037
|
-
* @returns
|
|
1038
|
-
*/
|
|
1039
|
-
private _isBaseSourceMatch;
|
|
1040
|
-
/**
|
|
1041
|
-
* Whether the given element source matches the selector source
|
|
1042
|
-
* @param element The element to check.
|
|
1043
|
-
* @param selector The selector to check against.
|
|
1044
|
-
* @param templateData The data to use for replace in selector value
|
|
1045
|
-
* @returns Whether the element source matches the selector source.
|
|
964
|
+
* Checks if a single captured values object matches the element.
|
|
965
|
+
* @param capturedValues The captured values to check.
|
|
966
|
+
* @param capturedSelector The captured values selector object to check against
|
|
967
|
+
* @param templateData The data to use for replace in selector values
|
|
968
|
+
* @returns True if all captured values in the selector match those in the element, false otherwise.
|
|
1046
969
|
*/
|
|
1047
|
-
private
|
|
970
|
+
private _checkCapturedValuesObject;
|
|
1048
971
|
/**
|
|
1049
972
|
* Determines if the captured values of the element match those in the selector.
|
|
973
|
+
* When the selector is an array, the element matches if it matches any of the array elements (OR logic).
|
|
1050
974
|
* @param element The element to check.
|
|
1051
975
|
* @param selector The selector to check against
|
|
1052
976
|
* @param templateData The data to use for replace in selector values
|
|
1053
977
|
* @returns True if the captured values match, false otherwise.
|
|
1054
978
|
*/
|
|
1055
979
|
private _isCapturedValuesMatch;
|
|
980
|
+
/**
|
|
981
|
+
* Determines if the parent captured values match the selector.
|
|
982
|
+
* @param parentSelector The parent selector to match.
|
|
983
|
+
* @param parentCaptured The captured values from first parent.
|
|
984
|
+
* @param templateData The data to use for replace in selector values
|
|
985
|
+
* @returns True if the captured values match, false otherwise.
|
|
986
|
+
*/
|
|
987
|
+
private _isParentCapturedValuesMatch;
|
|
988
|
+
/**
|
|
989
|
+
* Whether the given element first parent matches the selector parent.
|
|
990
|
+
* @param element The element to check.
|
|
991
|
+
* @param selector The selector to check against.
|
|
992
|
+
* @param templateData The data to use for replace in selector values
|
|
993
|
+
* @returns Whether the first parent matches the selector parent.
|
|
994
|
+
*/
|
|
995
|
+
private _isParentMatch;
|
|
1056
996
|
/**
|
|
1057
997
|
* Determines if the isIgnored property of the element matches that in the selector.
|
|
1058
998
|
* @param element The element to check.
|
|
@@ -1080,16 +1020,16 @@ declare class ElementsMatcher extends BaseElementsMatcher {
|
|
|
1080
1020
|
* It omits checks in keys applying only to dependency between elements, such as relationship.
|
|
1081
1021
|
* @param element The element to check.
|
|
1082
1022
|
* @param selector The selector to check against.
|
|
1083
|
-
* @param options Extra options for matching, such as templates data,
|
|
1023
|
+
* @param options Extra options for matching, such as templates data, etc.
|
|
1084
1024
|
* @returns The selector matching result for the given element, or null if none matches.
|
|
1085
1025
|
*/
|
|
1086
|
-
getSelectorMatching(element: ElementDescription, selector: BaseElementsSelector, { extraTemplateData }?: MatcherOptions):
|
|
1026
|
+
getSelectorMatching(element: ElementDescription, selector: BaseElementsSelector, { extraTemplateData }?: MatcherOptions): BaseElementSelectorData | null;
|
|
1087
1027
|
/**
|
|
1088
1028
|
* Returns whether the given element matches the selector.
|
|
1089
1029
|
* It omits checks in keys applying only to dependency between elements, such as relationship.
|
|
1090
1030
|
* @param element The element to check.
|
|
1091
1031
|
* @param selector The selector to check against.
|
|
1092
|
-
* @param options Extra options for matching, such as templates data,
|
|
1032
|
+
* @param options Extra options for matching, such as templates data, etc.
|
|
1093
1033
|
* @returns Whether the element matches the selector properties applying to elements.
|
|
1094
1034
|
*/
|
|
1095
1035
|
isElementMatch(element: ElementDescription, selector: BaseElementsSelector, options?: MatcherOptions): boolean;
|
|
@@ -1117,12 +1057,6 @@ declare class DependenciesMatcher extends BaseElementsMatcher {
|
|
|
1117
1057
|
* @returns The normalized dependency selector.
|
|
1118
1058
|
*/
|
|
1119
1059
|
private _normalizeDependencySelector;
|
|
1120
|
-
/**
|
|
1121
|
-
* Converts a DependencyElementSelectorData to a BaseElementSelectorData, by removing dependency-specific properties.
|
|
1122
|
-
* @param selector The dependency element selector data.
|
|
1123
|
-
* @returns The base element selector data.
|
|
1124
|
-
*/
|
|
1125
|
-
private _convertDependencyElementSelectorDataToBaseElementSelectorData;
|
|
1126
1060
|
/**
|
|
1127
1061
|
* Returns the selectors matching result for the given dependency.
|
|
1128
1062
|
* @param dependency The dependency description.
|
|
@@ -1130,14 +1064,22 @@ declare class DependenciesMatcher extends BaseElementsMatcher {
|
|
|
1130
1064
|
* @param extraTemplateData The extra template data for selector values.
|
|
1131
1065
|
* @returns The selectors matching result for the given dependency.
|
|
1132
1066
|
*/
|
|
1133
|
-
private
|
|
1067
|
+
private _getSelectorsMatching;
|
|
1134
1068
|
/**
|
|
1135
1069
|
* Determines if the dependency relationship matches the selector.
|
|
1136
1070
|
* @param dependency The dependency description.
|
|
1137
1071
|
* @param selector The data of an element selector.
|
|
1138
1072
|
* @returns Whether the dependency relationship matches the selector.
|
|
1139
1073
|
*/
|
|
1140
|
-
private
|
|
1074
|
+
private _relationshipFromMatches;
|
|
1075
|
+
/**
|
|
1076
|
+
* Determines if the dependency origin relationship matches the selector.
|
|
1077
|
+
* @param selector The dependency selector data.
|
|
1078
|
+
* @param relationship The relationship from origin element to target element.
|
|
1079
|
+
* @param templateData The template data for rendering selector values.
|
|
1080
|
+
* @returns Whether the dependency origin relationship matches.
|
|
1081
|
+
*/
|
|
1082
|
+
private _relationshipToMatches;
|
|
1141
1083
|
/**
|
|
1142
1084
|
* Determines if the selector matches an specific kind
|
|
1143
1085
|
* @param selector The dependency selector data
|
|
@@ -1163,34 +1105,42 @@ declare class DependenciesMatcher extends BaseElementsMatcher {
|
|
|
1163
1105
|
*/
|
|
1164
1106
|
private _nodeKindMatches;
|
|
1165
1107
|
/**
|
|
1166
|
-
* Determines if the dependency description matches the selector for '
|
|
1108
|
+
* Determines if the dependency description matches the selector for 'to'.
|
|
1167
1109
|
* @param dependency The dependency description.
|
|
1168
|
-
* @param
|
|
1110
|
+
* @param toSelector The selector for 'to' elements.
|
|
1169
1111
|
* @param templateData The template data for rendering selector values
|
|
1170
|
-
* @returns Whether the dependency properties match the selector for '
|
|
1112
|
+
* @returns Whether the dependency properties match the selector for 'to'.
|
|
1171
1113
|
*/
|
|
1172
|
-
private
|
|
1114
|
+
private _sourceMatches;
|
|
1173
1115
|
/**
|
|
1174
|
-
* Determines if the
|
|
1116
|
+
* Determines if the selector matches the module
|
|
1117
|
+
* @param selector The dependency selector data
|
|
1118
|
+
* @param module The module to check
|
|
1119
|
+
* @param templateData The template data for rendering selector values
|
|
1120
|
+
* @returns Whether the selector matches the module
|
|
1121
|
+
*/
|
|
1122
|
+
private _moduleMatches;
|
|
1123
|
+
/**
|
|
1124
|
+
* Determines if the dependency description matches the selector for dependency metadata.
|
|
1175
1125
|
* @param dependency The dependency description.
|
|
1176
|
-
* @param
|
|
1126
|
+
* @param selectorData The selector for dependency metadata.
|
|
1177
1127
|
* @param templateData The template data for rendering selector values
|
|
1178
|
-
* @returns Whether the dependency properties match the selector
|
|
1128
|
+
* @returns Whether the dependency properties match the selector.
|
|
1179
1129
|
*/
|
|
1180
|
-
private
|
|
1130
|
+
private _dependencyPropertiesMatch;
|
|
1181
1131
|
/**
|
|
1182
1132
|
* Returns the selectors matching result for the given dependency.
|
|
1183
1133
|
* @param dependency The dependency to check.
|
|
1184
1134
|
* @param selector The selector to check against.
|
|
1185
|
-
* @param options Extra options for matching, such as templates data,
|
|
1135
|
+
* @param options Extra options for matching, such as templates data, etc.
|
|
1186
1136
|
* @returns The matching result for the dependency against the selector.
|
|
1187
1137
|
*/
|
|
1188
|
-
getSelectorsMatching(dependency: DependencyDescription, selector: DependencySelector, { extraTemplateData
|
|
1138
|
+
getSelectorsMatching(dependency: DependencyDescription, selector: DependencySelector, { extraTemplateData }?: MatcherOptions): DependencyMatchResult;
|
|
1189
1139
|
/**
|
|
1190
1140
|
* Returns whether the given dependency matches the selector.
|
|
1191
1141
|
* @param dependency The dependency to check.
|
|
1192
1142
|
* @param selector The selector to check against.
|
|
1193
|
-
* @param options Extra options for matching, such as templates data,
|
|
1143
|
+
* @param options Extra options for matching, such as templates data, etc.
|
|
1194
1144
|
* @returns Whether the dependency matches the selector properties.
|
|
1195
1145
|
*/
|
|
1196
1146
|
isDependencyMatch(dependency: DependencyDescription, selector: DependencySelector, options?: MatcherOptions): boolean;
|
|
@@ -1213,13 +1163,13 @@ declare function isSimpleElementSelectorByType(value: unknown): value is SimpleE
|
|
|
1213
1163
|
* @param value The value to check.
|
|
1214
1164
|
* @returns True if the selector is a base element selector
|
|
1215
1165
|
*/
|
|
1216
|
-
declare function isBaseElementSelectorData(value: unknown): value is
|
|
1166
|
+
declare function isBaseElementSelectorData(value: unknown): value is BaseElementSelectorData;
|
|
1217
1167
|
/**
|
|
1218
1168
|
* Determines if the given selector is an element or dependency element selector data.
|
|
1219
1169
|
* @param value The value to check.
|
|
1220
1170
|
* @returns True if the selector is an element or dependency element selector data, false otherwise.
|
|
1221
1171
|
*/
|
|
1222
|
-
declare function isElementSelectorData(value: unknown): value is
|
|
1172
|
+
declare function isElementSelectorData(value: unknown): value is BaseElementSelectorData;
|
|
1223
1173
|
/**
|
|
1224
1174
|
* Determines if the given selector is an element selector with options.
|
|
1225
1175
|
* @param value The value to check.
|
|
@@ -1239,51 +1189,35 @@ declare function isElementSelector(value: unknown): value is ElementSelector;
|
|
|
1239
1189
|
*/
|
|
1240
1190
|
declare function isElementsSelector(value: unknown): value is ElementSelectors;
|
|
1241
1191
|
/**
|
|
1242
|
-
*
|
|
1243
|
-
* @param
|
|
1244
|
-
* @returns
|
|
1245
|
-
*/
|
|
1246
|
-
declare function isDependencySelector(value: unknown): value is DependencySelector;
|
|
1247
|
-
/**
|
|
1248
|
-
* Determines if the given value is external library selector options with a path.
|
|
1249
|
-
* @param value The value to check.
|
|
1250
|
-
* @returns True if the value is external library selector options with a path, false otherwise.
|
|
1192
|
+
* Normalizes a selector into ElementSelectorData format.
|
|
1193
|
+
* @param selector The selector to normalize.
|
|
1194
|
+
* @returns The normalized selector data.
|
|
1251
1195
|
*/
|
|
1252
|
-
declare function
|
|
1253
|
-
path: string | string[];
|
|
1254
|
-
};
|
|
1196
|
+
declare function normalizeElementSelector(selector: BaseElementSelector): BaseElementSelectorData;
|
|
1255
1197
|
/**
|
|
1256
|
-
*
|
|
1257
|
-
* @param
|
|
1258
|
-
* @returns
|
|
1259
|
-
*/
|
|
1260
|
-
declare function isExternalLibrarySelectorOptionsWithSpecifiers(value: unknown): value is ExternalLibrarySelectorOptions & {
|
|
1261
|
-
specifiers: string[];
|
|
1262
|
-
};
|
|
1263
|
-
/**
|
|
1264
|
-
* Determines if the given value is external library selector options.
|
|
1265
|
-
* @param value The value to check.
|
|
1266
|
-
* @returns True if the value is external library selector options, false otherwise.
|
|
1198
|
+
* Normalizes an ElementsSelector into an array of ElementSelectorData.
|
|
1199
|
+
* @param elementsSelector The elements selector, in any supported format.
|
|
1200
|
+
* @returns The normalized array of selector data.
|
|
1267
1201
|
*/
|
|
1268
|
-
declare function
|
|
1202
|
+
declare function normalizeElementsSelector(elementsSelector: BaseElementsSelector): BaseElementSelectorData[];
|
|
1269
1203
|
/**
|
|
1270
|
-
* Determines if the given value is
|
|
1271
|
-
* @param value The value to check
|
|
1272
|
-
* @returns True if the value is
|
|
1204
|
+
* Determines if the given value is a dependency selector.
|
|
1205
|
+
* @param value The value to check
|
|
1206
|
+
* @returns True if the value is a dependency selector, false otherwise.
|
|
1273
1207
|
*/
|
|
1274
|
-
declare function
|
|
1208
|
+
declare function isDependencySelector(value: unknown): value is DependencySelector;
|
|
1275
1209
|
/**
|
|
1276
|
-
* Determines if the given value is
|
|
1210
|
+
* Determines if the given value is dependency metadata selector data.
|
|
1277
1211
|
* @param value The value to check.
|
|
1278
|
-
* @returns True if the value is
|
|
1212
|
+
* @returns True if the value is dependency metadata selector data, false otherwise.
|
|
1279
1213
|
*/
|
|
1280
|
-
declare function
|
|
1214
|
+
declare function isDependencyDataSelectorData(value: unknown): value is DependencyDataSelectorData;
|
|
1281
1215
|
/**
|
|
1282
|
-
* Determines if the given value is
|
|
1216
|
+
* Determines if the given value is dependency metadata selector(s).
|
|
1283
1217
|
* @param value The value to check.
|
|
1284
|
-
* @returns True if the value is
|
|
1218
|
+
* @returns True if the value is dependency metadata selector(s), false otherwise.
|
|
1285
1219
|
*/
|
|
1286
|
-
declare function
|
|
1220
|
+
declare function isDependencyDataSelector(value: unknown): value is DependencyDataSelector;
|
|
1287
1221
|
|
|
1288
1222
|
/**
|
|
1289
1223
|
* Matcher class to evaluate if elements or dependencies match given selectors.
|
|
@@ -1301,6 +1235,18 @@ declare class Matcher {
|
|
|
1301
1235
|
* @param globalCache Global cache instance.
|
|
1302
1236
|
*/
|
|
1303
1237
|
constructor(descriptors: ElementDescriptors, elementsMatcher: ElementsMatcher, dependenciesMatcher: DependenciesMatcher, config: DescriptorOptionsNormalized, micromatch: Micromatch);
|
|
1238
|
+
/**
|
|
1239
|
+
* Describes an element given its file path.
|
|
1240
|
+
* @param filePath The path of the file to describe.
|
|
1241
|
+
* @returns The description of the element.
|
|
1242
|
+
*/
|
|
1243
|
+
describeElement(filePath: string): ElementDescription;
|
|
1244
|
+
/**
|
|
1245
|
+
* Describes elements in a dependency relationship, and provides additional information about the dependency itself.
|
|
1246
|
+
* @param options The options for describing the elements and the dependency details.
|
|
1247
|
+
* @returns The description of the dependency between the elements.
|
|
1248
|
+
*/
|
|
1249
|
+
describeDependency(options: DescribeDependencyOptions): DependencyDescription;
|
|
1304
1250
|
/**
|
|
1305
1251
|
* Determines if an element matches a given selector.
|
|
1306
1252
|
* @param filePath The file path of the element
|
|
@@ -1308,7 +1254,7 @@ declare class Matcher {
|
|
|
1308
1254
|
* @param options Extra matcher options
|
|
1309
1255
|
* @returns True if the element matches the selector, false otherwise
|
|
1310
1256
|
*/
|
|
1311
|
-
|
|
1257
|
+
isElementMatch(filePath: string, selector: ElementsSelector, options?: MatcherOptions): boolean;
|
|
1312
1258
|
/**
|
|
1313
1259
|
* Determines if a dependency matches a given selector.
|
|
1314
1260
|
* @param dependencyData The data describing the dependency
|
|
@@ -1316,15 +1262,7 @@ declare class Matcher {
|
|
|
1316
1262
|
* @param options Extra matcher options
|
|
1317
1263
|
* @returns True if the dependency matches the selector, false otherwise
|
|
1318
1264
|
*/
|
|
1319
|
-
|
|
1320
|
-
/**
|
|
1321
|
-
* Determines if the given element or dependency matches the provided selector.
|
|
1322
|
-
* @param descriptorOptions The file path or dependency options to describe the element or dependency
|
|
1323
|
-
* @param selector The selector to match against
|
|
1324
|
-
* @param options Extra matcher options
|
|
1325
|
-
*/
|
|
1326
|
-
isMatch(descriptorOptions: string, selector: ElementsSelector, options?: MatcherOptions): boolean;
|
|
1327
|
-
isMatch(descriptorOptions: DescribeDependencyOptions, selector: DependencySelector, options?: MatcherOptions): boolean;
|
|
1265
|
+
isDependencyMatch(dependencyData: DescribeDependencyOptions, selector: DependencySelector, options?: MatcherOptions): boolean;
|
|
1328
1266
|
/**
|
|
1329
1267
|
* Determines the selector matching for an element.
|
|
1330
1268
|
* @param filePath The file path of the element
|
|
@@ -1332,7 +1270,7 @@ declare class Matcher {
|
|
|
1332
1270
|
* @param options Extra options for matching
|
|
1333
1271
|
* @returns The matching selector data or null if no match is found
|
|
1334
1272
|
*/
|
|
1335
|
-
|
|
1273
|
+
getElementSelectorMatching(filePath: string, selector: ElementsSelector, options?: MatcherOptions): BaseElementSelectorData | null;
|
|
1336
1274
|
/**
|
|
1337
1275
|
* Determines the selector matching for a dependency.
|
|
1338
1276
|
* @param dependencyData The data describing the dependency
|
|
@@ -1340,44 +1278,23 @@ declare class Matcher {
|
|
|
1340
1278
|
* @param options Extra options for matching
|
|
1341
1279
|
* @returns The matching dependency result or null if no match is found
|
|
1342
1280
|
*/
|
|
1343
|
-
|
|
1344
|
-
/**
|
|
1345
|
-
* Determines the selector matching for a dependency or element.
|
|
1346
|
-
* @param descriptorOptions The file path or dependency options to describe the element or dependency
|
|
1347
|
-
* @param selector The selectors to match against
|
|
1348
|
-
* @param options Extra options for matching
|
|
1349
|
-
* @returns The matching dependency result or element selector data, or null if no match is found
|
|
1350
|
-
*/
|
|
1351
|
-
getSelectorMatching(descriptorOptions: string, selector: ElementsSelector, options?: MatcherOptions): ElementSelectorData | null;
|
|
1352
|
-
getSelectorMatching(descriptorOptions: DescribeDependencyOptions, selector: DependencySelector, options?: MatcherOptions): DependencyMatchResult | null;
|
|
1281
|
+
getDependencySelectorMatching(dependencyData: DescribeDependencyOptions, selector: DependencySelector, options?: MatcherOptions): DependencyMatchResult;
|
|
1353
1282
|
/**
|
|
1354
1283
|
* Returns the selectors matching result for the given element or dependency description.
|
|
1355
1284
|
* @param description The element or dependency description to check.
|
|
1356
1285
|
* @param selector The selector to check against.
|
|
1357
|
-
* @param options Extra options for matching, such as templates data,
|
|
1286
|
+
* @param options Extra options for matching, such as templates data, etc.
|
|
1358
1287
|
* @returns The selectors matching result for the given description, and whether it matches or not.
|
|
1359
1288
|
*/
|
|
1360
|
-
|
|
1361
|
-
getSelectorMatchingDescription(description: ElementDescription, selector: ElementsSelector, options?: MatcherOptions): ElementSelectorData;
|
|
1362
|
-
/**
|
|
1363
|
-
* Describes an element given its file path.
|
|
1364
|
-
* @param filePath The path of the file to describe.
|
|
1365
|
-
* @returns The description of the element.
|
|
1366
|
-
*/
|
|
1367
|
-
describeElement(filePath: string): FileElement;
|
|
1368
|
-
/**
|
|
1369
|
-
* Describes a dependency element given its dependency source and file path.
|
|
1370
|
-
* @param dependencySource The source of the dependency.
|
|
1371
|
-
* @param filePath The path of the file being the dependency, if known.
|
|
1372
|
-
* @returns The description of the dependency element.
|
|
1373
|
-
*/
|
|
1374
|
-
describeDependencyElement(dependencySource: string, filePath?: string): DependencyElementDescription;
|
|
1289
|
+
getDependencySelectorMatchingDescription(description: DependencyDescription, selector: DependencySelector, options?: MatcherOptions): DependencyMatchResult;
|
|
1375
1290
|
/**
|
|
1376
|
-
*
|
|
1377
|
-
* @param
|
|
1378
|
-
* @
|
|
1291
|
+
* Returns the first element selector matching result for the given element description.
|
|
1292
|
+
* @param description The element description to check.
|
|
1293
|
+
* @param selector The selector to check against.
|
|
1294
|
+
* @param options Extra options for matching, such as templates data, etc.
|
|
1295
|
+
* @returns The first matching selector result for the given description, or null if no match is found.
|
|
1379
1296
|
*/
|
|
1380
|
-
|
|
1297
|
+
getElementSelectorMatchingDescription(description: ElementDescription, selector: ElementsSelector, options?: MatcherOptions): BaseElementSelectorData | null;
|
|
1381
1298
|
/**
|
|
1382
1299
|
* Clears all caches.
|
|
1383
1300
|
*/
|
|
@@ -1427,14 +1344,7 @@ declare class Descriptors {
|
|
|
1427
1344
|
* @param filePath The path of the file to describe.
|
|
1428
1345
|
* @returns The description of the element.
|
|
1429
1346
|
*/
|
|
1430
|
-
describeElement(filePath?: string):
|
|
1431
|
-
/**
|
|
1432
|
-
* Describes a dependency element given its dependency source and file path.
|
|
1433
|
-
* @param dependencySource The source of the dependency.
|
|
1434
|
-
* @param filePath The path of the file being the dependency, if known.
|
|
1435
|
-
* @returns The description of the dependency element.
|
|
1436
|
-
*/
|
|
1437
|
-
describeDependencyElement(dependencySource: string, filePath?: string): DependencyElementDescription;
|
|
1347
|
+
describeElement(filePath?: string): ElementDescription;
|
|
1438
1348
|
/**
|
|
1439
1349
|
* Describes elements in a dependency relationship, and provides additional information about the dependency itself.
|
|
1440
1350
|
* @param options The options for describing the elements and the dependency details.
|
|
@@ -1574,7 +1484,7 @@ declare class ElementsDescriptor {
|
|
|
1574
1484
|
* @param dependencySource The source of the dependency to check.
|
|
1575
1485
|
* @returns The base source of the external module. (e.g., for "@scope/package/submodule", it returns "@scope/package")
|
|
1576
1486
|
*/
|
|
1577
|
-
private
|
|
1487
|
+
private _getExternalOrCoreModuleModule;
|
|
1578
1488
|
/**
|
|
1579
1489
|
* Determines if a file path is outside the configured root path.
|
|
1580
1490
|
* @param filePath The file path to check.
|
|
@@ -1670,14 +1580,14 @@ declare class ElementsDescriptor {
|
|
|
1670
1580
|
* @param filePath The path of the file to describe. Can be absolute if rootPath is configured, or relative if not.
|
|
1671
1581
|
* @returns The description of the element.
|
|
1672
1582
|
*/
|
|
1673
|
-
describeElement(filePath?: string):
|
|
1583
|
+
describeElement(filePath?: string): ElementDescription;
|
|
1674
1584
|
/**
|
|
1675
|
-
* Describes a dependency element given
|
|
1585
|
+
* Describes a dependency target element given dependency source and target file path.
|
|
1586
|
+
* @param filePath The path of the dependency target file, if known. Can be absolute if rootPath is configured, or relative if not.
|
|
1676
1587
|
* @param dependencySource The source of the dependency.
|
|
1677
|
-
* @param filePath The path of the file being the dependency, if known. Can be absolute if rootPath is configured, or relative if not.
|
|
1678
1588
|
* @returns The description of the dependency element.
|
|
1679
1589
|
*/
|
|
1680
|
-
|
|
1590
|
+
describeElement(filePath: string | undefined, dependencySource: string): ElementDescriptionWithSource;
|
|
1681
1591
|
}
|
|
1682
1592
|
|
|
1683
1593
|
/**
|
|
@@ -1846,4 +1756,4 @@ declare class CacheManager<CacheKey extends NotUndefined, CachedValue> {
|
|
|
1846
1756
|
setFromSerialized(serializedCache: Record<string, CachedValue>): void;
|
|
1847
1757
|
}
|
|
1848
1758
|
|
|
1849
|
-
export { type
|
|
1759
|
+
export { type BaseElementDescription, type BaseElementDescriptor, type BaseElementSelector, type BaseElementSelectorData, type BaseElementSelectorWithOptions, type BaseElementsSelector, CacheManager, type CapturedValues, type CapturedValuesSelector, type ConfigOptions, type ConfigOptionsNormalized, type CoreElementDescription, DEPENDENCY_KINDS_MAP, DEPENDENCY_KIND_TYPE, DEPENDENCY_KIND_TYPEOF, DEPENDENCY_KIND_VALUE, DEPENDENCY_RELATIONSHIPS_INVERTED_MAP, DEPENDENCY_RELATIONSHIPS_MAP, DependenciesDescriptor, type DependenciesDescriptorSerializedCache, DependenciesMatcher, type DependenciesMatcherSerializedCache, type DependencyDataSelector, type DependencyDataSelectorData, type DependencyDescription, type DependencyElementSelectorData, type DependencyKind, type DependencyMatchResult, type DependencyRelationship, type DependencySelector, type DependencySelectorNormalized, type DescribeDependencyOptions, type DescriptionsSerializedCache, type DescriptorOptionsNormalized, Descriptors, type DescriptorsSerializedCache, ELEMENT_DESCRIPTOR_MODES_MAP, ELEMENT_ORIGINS_MAP, type ElementDescription, type ElementDescriptionWithSource, type ElementDescriptor, type ElementDescriptorMode, type ElementDescriptorPattern, type ElementDescriptorWithCategory, type ElementDescriptorWithType, type ElementDescriptorWithTypeAndCategory, type ElementDescriptors, type ElementOrigin, type ElementParent, type ElementSelector, type ElementSelectorWithOptions, type ElementSelectors, Elements, type ElementsDependencyInfo, ElementsDescriptor, type ElementsDescriptorSerializedCache, ElementsMatcher, type ElementsMatcherSerializedCache, type ElementsSelector, type ElementsSerializedCache, type ExternalElementDescription, type FileElementsSerializedCache, type FlagAsExternalOptions, type FlagAsExternalOptionsNormalized, type IgnoredElement, type LocalElementKnown, type LocalElementUnknown, Matcher, type MatcherOptions, type MatcherSerializedCache, type MatchersOptionsNormalized, type MicromatchMatchableValue, type MicromatchPattern, type MicromatchPatternNullable, type MicromatchSerializedCache, type NotUndefined, type ObjectCacheKey, type ParentElementSelectorData, type SelectableElement, type SimpleElementSelectorByType, type TemplateData, isBaseElement, isBaseElementDescriptor, isBaseElementSelectorData, isCapturedValuesSelector, isCoreDependencyElement, isDependencyDataSelector, isDependencyDataSelectorData, isDependencyDescription, isDependencyKind, isDependencyRelationship, isDependencyRelationshipDescription, isDependencySelector, isElementDescription, isElementDescriptor, isElementDescriptorMode, isElementDescriptorPattern, isElementDescriptorWithCategory, isElementDescriptorWithType, isElementSelector, isElementSelectorData, isElementSelectorWithLegacyOptions, isElementsDependencyInfo, isElementsSelector, isExternalDependencyElement, isIgnoredElement, isInternalDependency, isKnownLocalElement, isLocalDependencyElement, isLocalElement, isSimpleElementSelectorByType, isUnknownLocalElement, normalizeElementSelector, normalizeElementsSelector };
|