@boundaries/elements 1.0.0 → 1.1.1
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 +9 -5
- package/dist/index.browser.d.mts +230 -137
- package/dist/index.browser.d.ts +230 -137
- package/dist/index.browser.js +605 -468
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +605 -468
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +230 -137
- package/dist/index.d.ts +230 -137
- package/dist/index.js +606 -468
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +605 -468
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
# @boundaries/elements
|
|
10
10
|
|
|
11
|
-
> Element descriptors and matchers for
|
|
11
|
+
> Element descriptors and matchers for `@boundaries` tools, such as `@boundaries/eslint-plugin`.
|
|
12
12
|
|
|
13
13
|
## Table of Contents
|
|
14
14
|
|
|
@@ -128,6 +128,7 @@ const elements = new Elements({
|
|
|
128
128
|
- **`ignorePaths`**: Micromatch pattern(s) to exclude certain paths from element matching (default: none)
|
|
129
129
|
- **`includePaths`**: Micromatch pattern(s) to include only specific paths (default: all paths)
|
|
130
130
|
- **`legacyTemplates`**: Whether to enable legacy template syntax support (default: `true`, but it will be `false` in future releases). This allows using `${variable}` syntax in templates for backward compatibility.
|
|
131
|
+
- **`cache`**: Whether to enable internal caching to improve performance (default: `true`)
|
|
131
132
|
|
|
132
133
|
### Creating a Matcher
|
|
133
134
|
|
|
@@ -316,7 +317,7 @@ To match a dependency, use the `isMatch` method of the matcher, providing the pr
|
|
|
316
317
|
- **`from`** (`string`): Source file path
|
|
317
318
|
- **`to`** (`string`): Target file path
|
|
318
319
|
- **`source`** (`string`): Import/export source as written in code
|
|
319
|
-
- **`kind`** (`string`): Import kind (`"type"`, `"value"`,
|
|
320
|
+
- **`kind`** (`string`): Import kind (`"type"`, `"value"`, `"typeof"`)
|
|
320
321
|
- **`nodeKind`** (`string`): AST node kind
|
|
321
322
|
- **`specifiers`** (`string[]`): Imported/exported names
|
|
322
323
|
|
|
@@ -384,7 +385,7 @@ const matcher = elements.getMatcher([
|
|
|
384
385
|
|
|
385
386
|
##### `clearCache`
|
|
386
387
|
|
|
387
|
-
Clears all cached matcher instances.
|
|
388
|
+
Clears all cached matcher instances and shared caches.
|
|
388
389
|
|
|
389
390
|
```ts
|
|
390
391
|
elements.clearCache();
|
|
@@ -392,14 +393,14 @@ elements.clearCache();
|
|
|
392
393
|
|
|
393
394
|
##### `serializeCache`
|
|
394
395
|
|
|
395
|
-
Serializes all cached matcher instances to a plain object.
|
|
396
|
+
Serializes all cached matcher instances and shared caches to a plain object.
|
|
396
397
|
|
|
397
398
|
```ts
|
|
398
399
|
const cache = elements.serializeCache();
|
|
399
400
|
```
|
|
400
401
|
|
|
401
402
|
##### `setCacheFromSerialized`
|
|
402
|
-
Sets the cached matcher instances from a serialized object.
|
|
403
|
+
Sets the cached matcher instances and shared caches from a serialized object.
|
|
403
404
|
|
|
404
405
|
```ts
|
|
405
406
|
const cache = elements.serializeCache();
|
|
@@ -495,6 +496,9 @@ Clears the matcher's internal cache.
|
|
|
495
496
|
matcher.clearCache();
|
|
496
497
|
```
|
|
497
498
|
|
|
499
|
+
> [!WARNING]
|
|
500
|
+
> This only clears the internal cache for this matcher instance. Shared cache for micromatch results, regex and captures is not affected. You can clear all caches using `Elements.clearCache()`.
|
|
501
|
+
|
|
498
502
|
#### `serializeCache`
|
|
499
503
|
|
|
500
504
|
Serializes the matcher's cache.
|