@visulima/fs 5.0.0-alpha.31 → 5.0.0-alpha.33
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/CHANGELOG.md +49 -0
- package/LICENSE.md +29 -0
- package/README.md +65 -0
- package/dist/glob.d.ts +3 -3
- package/dist/glob.js +1 -1
- package/dist/index.d.ts +98 -25
- package/dist/index.js +1 -1
- package/dist/ini.d.ts +3 -3
- package/dist/ini.js +1 -1
- package/dist/json5.d.ts +3 -3
- package/dist/json5.js +1 -1
- package/dist/jsonc.d.ts +3 -3
- package/dist/jsonc.js +1 -1
- package/dist/match.js +1 -1
- package/dist/packem_shared/{collect-VHN_VRLN.js → collect-CIKDOMiD.js} +1 -1
- package/dist/packem_shared/{collectSync-C28T6vrY.js → collectSync-D0FRLLqg.js} +1 -1
- package/dist/packem_shared/copy-Beb64BYG.js +1 -0
- package/dist/packem_shared/copySync-CagcIEBi.js +1 -0
- package/dist/packem_shared/findUp-Cii5ATt5.js +1 -0
- package/dist/packem_shared/findUpSync-C9Lkh7-v.js +1 -0
- package/dist/packem_shared/glob-fqg4KepW.js +1 -0
- package/dist/packem_shared/{glob-sync.d-BgJM6l8W.d.ts → glob-sync.d-hXe38TnZ.d.ts} +1 -1
- package/dist/packem_shared/globSync-B8_ne93E.js +1 -0
- package/dist/packem_shared/index-BLg3XWiD.js +1 -0
- package/dist/packem_shared/{index-BspkXADC.js → index-D8MDd0tv.js} +1 -1
- package/dist/packem_shared/isAccessible-PmWJhV6I.js +1 -0
- package/dist/packem_shared/isAccessibleSync-BrbOtwdr.js +1 -0
- package/dist/packem_shared/map-read-error-CR3rQUxx.js +1 -0
- package/dist/packem_shared/{move-CvE-ntXL.js → move-DopmzT-2.js} +1 -1
- package/dist/packem_shared/parseJson-kxKotn69.js +1 -0
- package/dist/packem_shared/readFile-BswaBgM0.js +1 -0
- package/dist/packem_shared/readFileSync-_fDF6Oj1.js +1 -0
- package/dist/packem_shared/{readIni-CQK8HYxE.js → readIni-BsXudu2r.js} +1 -1
- package/dist/packem_shared/readIniSync-DKwRbbs9.js +1 -0
- package/dist/packem_shared/{readJson-T0hatQjC.js → readJson-BCdoReQ-.js} +1 -1
- package/dist/packem_shared/{readJson5-CHbnB73J.js → readJson5-CM1TIiHd.js} +1 -1
- package/dist/packem_shared/{readJson5Sync-BsyhQYi8.js → readJson5Sync-Bc26c3Fy.js} +1 -1
- package/dist/packem_shared/{readJsonSync-Drti0sPY.js → readJsonSync-CvkZyKmL.js} +1 -1
- package/dist/packem_shared/readJsonc-BabpyMMh.js +1 -0
- package/dist/packem_shared/{readJsoncSync-TILCPRUQ.js → readJsoncSync-CCvRcAP-.js} +1 -1
- package/dist/packem_shared/readToml-D4jpe9q_.js +1 -0
- package/dist/packem_shared/readTomlSync-B5PIYT9z.js +1 -0
- package/dist/packem_shared/{readYaml-DuXAtLKY.js → readYaml-DvPxndW_.js} +1 -1
- package/dist/packem_shared/{readYamlSync-KlhBWm72.js → readYamlSync-DZ-0hSbZ.js} +1 -1
- package/dist/packem_shared/remove-CSbrd0dl.js +1 -0
- package/dist/packem_shared/removeSync-BoLAzRQE.js +1 -0
- package/dist/packem_shared/renderError-Dqej8k13-Bi9WKMjv.js +6 -0
- package/dist/packem_shared/stripJsonComments-Bfcn2PKv.js +1 -0
- package/dist/packem_shared/to-uint-8-array-BImOQNXm.js +1 -0
- package/dist/packem_shared/{types.d-C1ygRkw1.d.ts → types.d-BMdL_ygj.d.ts} +139 -26
- package/dist/packem_shared/walk-OX4-6oCP.js +1 -0
- package/dist/packem_shared/walkSync-BPs6czIM.js +1 -0
- package/dist/packem_shared/writeFile-BrMtsJY7.js +1 -0
- package/dist/packem_shared/writeFileSync-W7Mf4BNy.js +1 -0
- package/dist/packem_shared/writeIni-BWX3cP1K.js +4 -0
- package/dist/packem_shared/writeIniSync-fOdgPFfL.js +4 -0
- package/dist/packem_shared/writeJson-bEVi25gX.js +4 -0
- package/dist/packem_shared/writeJson5-Ch8TpNPI.js +4 -0
- package/dist/packem_shared/writeJson5Sync-BrctV_Mk.js +4 -0
- package/dist/packem_shared/writeJsonSync-DkGnd416.js +4 -0
- package/dist/packem_shared/writeJsonc-CefrwsOc.js +4 -0
- package/dist/packem_shared/writeJsoncSync-BskDjn8o.js +4 -0
- package/dist/packem_shared/{writeToml-BFD91-Sv.js → writeToml-IuMO-yDu.js} +1 -1
- package/dist/packem_shared/{writeTomlSync-D30hzuuu.js → writeTomlSync-DhL7hHzB.js} +1 -1
- package/dist/packem_shared/{writeYaml-BD9JVGkk.js → writeYaml-ClQgvQID.js} +1 -1
- package/dist/packem_shared/{writeYamlSync-BobkRsmd.js → writeYamlSync-DrXtHQQq.js} +1 -1
- package/dist/size.js +1 -1
- package/dist/toml.d.ts +2 -2
- package/dist/toml.js +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/dist/yaml.d.ts +3 -3
- package/dist/yaml.js +1 -1
- package/package.json +3 -3
- package/dist/packem_shared/findUp-D49u53m9.js +0 -1
- package/dist/packem_shared/findUpSync-C2oAKTw1.js +0 -1
- package/dist/packem_shared/glob-D_7bct6p.js +0 -1
- package/dist/packem_shared/globSync-f-4jVwn9.js +0 -1
- package/dist/packem_shared/index-CChvzByK.js +0 -1
- package/dist/packem_shared/indexToLineColumn-BRSZFC6I-B2OZwR8G.js +0 -6
- package/dist/packem_shared/isAccessible-DV2K-m2B.js +0 -1
- package/dist/packem_shared/isAccessibleSync-BCjiSxHj.js +0 -1
- package/dist/packem_shared/isFsCaseSensitive-j6UlSSM7.js +0 -1
- package/dist/packem_shared/parseJson-vUriP0eD.js +0 -1
- package/dist/packem_shared/readFile-ZXEXbVU5.js +0 -1
- package/dist/packem_shared/readFileSync-DseCu8sg.js +0 -1
- package/dist/packem_shared/readIniSync-l9LoYPoP.js +0 -1
- package/dist/packem_shared/readJsonc-1woJjNLd.js +0 -1
- package/dist/packem_shared/readToml-Dawx4pqK.js +0 -1
- package/dist/packem_shared/readTomlSync-hnDlOU7g.js +0 -1
- package/dist/packem_shared/remove-DmEfBrzp.js +0 -1
- package/dist/packem_shared/removeSync--c4qlu32.js +0 -1
- package/dist/packem_shared/stripJsonComments-gXl-1fAs.js +0 -1
- package/dist/packem_shared/to-uint-8-array-BBchIT6g.js +0 -1
- package/dist/packem_shared/walk-CxKfBzrV.js +0 -1
- package/dist/packem_shared/walkSync-JkSkFL-F.js +0 -1
- package/dist/packem_shared/writeFile-CM-OVzxG.js +0 -1
- package/dist/packem_shared/writeFileSync-CNaAkXSP.js +0 -1
- package/dist/packem_shared/writeIni-B1NVnZkX.js +0 -4
- package/dist/packem_shared/writeIniSync-CwS1da1r.js +0 -4
- package/dist/packem_shared/writeJson-DC1V8Afe.js +0 -4
- package/dist/packem_shared/writeJson5--_qaVjxW.js +0 -4
- package/dist/packem_shared/writeJson5Sync-DPOk8wWz.js +0 -4
- package/dist/packem_shared/writeJsonSync-CUt49Wp1.js +0 -4
- package/dist/packem_shared/writeJsonc-DXuAO3_X.js +0 -4
- package/dist/packem_shared/writeJsoncSync-BEeqh1ry.js +0 -4
- /package/dist/packem_shared/{F_OK-CAwY1qU7.js → FIND_UP_STOP-CAwY1qU7.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
|
+
## @visulima/fs [5.0.0-alpha.33](https://github.com/visulima/visulima/compare/@visulima/fs@5.0.0-alpha.32...@visulima/fs@5.0.0-alpha.33) (2026-06-30)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **vis:** stop Windows test hangs; start fallow dead-code cleanup ([e87ca70](https://github.com/visulima/visulima/commit/e87ca708223560775c2bd9ec7a59e1aa5853b5de))
|
|
6
|
+
|
|
7
|
+
### Styles
|
|
8
|
+
|
|
9
|
+
* cs fixes ([2a960bb](https://github.com/visulima/visulima/commit/2a960bb1772c9dc70080e2d75d3a0d827034e294))
|
|
10
|
+
|
|
11
|
+
### Miscellaneous Chores
|
|
12
|
+
|
|
13
|
+
* add fallow code-intelligence across all packages ([a3b4821](https://github.com/visulima/visulima/commit/a3b48215002e86fed20f2973038b5d4a0aa1ce04))
|
|
14
|
+
|
|
15
|
+
### Continuous Integration
|
|
16
|
+
|
|
17
|
+
* **fallow:** make fallow:health advisory (--report-only) ([d57148e](https://github.com/visulima/visulima/commit/d57148ea0e3556b4c24d8d336b9fa14987f5dc7d))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Dependencies
|
|
21
|
+
|
|
22
|
+
* **@visulima/error:** upgraded to 6.0.0-alpha.35
|
|
23
|
+
|
|
24
|
+
## @visulima/fs [5.0.0-alpha.32](https://github.com/visulima/visulima/compare/@visulima/fs@5.0.0-alpha.31...@visulima/fs@5.0.0-alpha.32) (2026-06-13)
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* **fs:** fix walk symlinks, read/write/remove semantics, add copy ([d3d0070](https://github.com/visulima/visulima/commit/d3d0070a82e50a6fb42ed49fa0179aca2c18ee26))
|
|
29
|
+
|
|
30
|
+
### Miscellaneous Chores
|
|
31
|
+
|
|
32
|
+
* apply safe prettier and eslint formatting ([05120af](https://github.com/visulima/visulima/commit/05120af8c898d18c495575680f01134681e29b65))
|
|
33
|
+
* **fs:** apply prettier formatting across src and tests ([03409d7](https://github.com/visulima/visulima/commit/03409d783d96d0ed6358da88a72edea92a8b944b))
|
|
34
|
+
|
|
35
|
+
### Tests
|
|
36
|
+
|
|
37
|
+
* **fs:** expect ENOENT (not EPERM) for readJson on a missing file ([7ccb840](https://github.com/visulima/visulima/commit/7ccb8404b4144cba2ec1ddcede62845fcfe91eb4))
|
|
38
|
+
|
|
39
|
+
### Build System
|
|
40
|
+
|
|
41
|
+
* **deps:** update fs dependencies ([f30e540](https://github.com/visulima/visulima/commit/f30e5406813b18c48704761ea23d665a019eeab2))
|
|
42
|
+
* regenerate bundled-license manifests and types ordering ([af26588](https://github.com/visulima/visulima/commit/af26588d75aaa937fd4862800560bd4070a4878c))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Dependencies
|
|
46
|
+
|
|
47
|
+
* **@visulima/path:** upgraded to 3.0.0-alpha.13
|
|
48
|
+
* **@visulima/error:** upgraded to 6.0.0-alpha.33
|
|
49
|
+
|
|
1
50
|
## @visulima/fs [5.0.0-alpha.31](https://github.com/visulima/visulima/compare/@visulima/fs@5.0.0-alpha.30...@visulima/fs@5.0.0-alpha.31) (2026-06-04)
|
|
2
51
|
|
|
3
52
|
### Performance Improvements
|
package/LICENSE.md
CHANGED
|
@@ -344,6 +344,35 @@ Repository: privatenumber/is-fs-case-sensitive
|
|
|
344
344
|
|
|
345
345
|
---------------------------------------
|
|
346
346
|
|
|
347
|
+
## tinyglobby
|
|
348
|
+
License: MIT
|
|
349
|
+
By: Superchupu
|
|
350
|
+
Repository: git+https://github.com/SuperchupuDev/tinyglobby.git
|
|
351
|
+
|
|
352
|
+
> MIT License
|
|
353
|
+
>
|
|
354
|
+
> Copyright (c) 2024 Madeline Gurriarán
|
|
355
|
+
>
|
|
356
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
357
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
358
|
+
> in the Software without restriction, including without limitation the rights
|
|
359
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
360
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
361
|
+
> furnished to do so, subject to the following conditions:
|
|
362
|
+
>
|
|
363
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
364
|
+
> copies or substantial portions of the Software.
|
|
365
|
+
>
|
|
366
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
367
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
368
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
369
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
370
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
371
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
372
|
+
> SOFTWARE.
|
|
373
|
+
|
|
374
|
+
---------------------------------------
|
|
375
|
+
|
|
347
376
|
## yaml
|
|
348
377
|
License: ISC
|
|
349
378
|
By: Eemeli Aro
|
package/README.md
CHANGED
|
@@ -66,6 +66,71 @@ pnpm add yaml
|
|
|
66
66
|
|
|
67
67
|
## Usage
|
|
68
68
|
|
|
69
|
+
### Quickstart by subpath
|
|
70
|
+
|
|
71
|
+
`@visulima/fs` ships one entry per concern. Import from the narrowest subpath you
|
|
72
|
+
need so the optional parser peers (`yaml`, `smol-toml`, `jsonc-parser`, `json5`,
|
|
73
|
+
`ini`) stay tree-shaken.
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
// Core fs surface: walk, glob, findUp, ensure*, read/writeFile, copy, move, remove, emptyDir, isAccessible, sanitize, EOL.
|
|
77
|
+
import { copy, ensureDir, findUp, readFile, walk, writeFile } from "@visulima/fs";
|
|
78
|
+
|
|
79
|
+
// Typed error classes (NotFoundError, AlreadyExistsError, PermissionError, …).
|
|
80
|
+
import { NotFoundError } from "@visulima/fs/error";
|
|
81
|
+
|
|
82
|
+
// Parser-backed helpers — each needs its peer dependency installed.
|
|
83
|
+
import { readYaml, writeYaml } from "@visulima/fs/yaml";
|
|
84
|
+
import { readJsonc, writeJsonc } from "@visulima/fs/jsonc";
|
|
85
|
+
|
|
86
|
+
// Glob primitives and size/eol helpers.
|
|
87
|
+
import { glob } from "@visulima/fs/glob";
|
|
88
|
+
import { gzipSize } from "@visulima/fs/size";
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Copy a file or directory
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { copy } from "@visulima/fs";
|
|
95
|
+
|
|
96
|
+
// Copy a template directory, skipping node_modules and overwriting existing files.
|
|
97
|
+
await copy("templates/app", "out/app", {
|
|
98
|
+
filter: (source) => !source.includes("node_modules"),
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Refuse to overwrite an existing destination.
|
|
102
|
+
import { AlreadyExistsError } from "@visulima/fs/error";
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
await copy("a.txt", "b.txt", { overwrite: false });
|
|
106
|
+
} catch (error) {
|
|
107
|
+
if (error instanceof AlreadyExistsError) {
|
|
108
|
+
console.error("destination already exists");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Coming from `fs-extra`?
|
|
114
|
+
|
|
115
|
+
| `fs-extra` | `@visulima/fs` |
|
|
116
|
+
| ------------------------------ | ----------------------------------------------------------------------- |
|
|
117
|
+
| `copy` / `copySync` | `copy` / `copySync` |
|
|
118
|
+
| `move` / `moveSync` | `move` / `moveSync` |
|
|
119
|
+
| `remove` / `removeSync` | `remove` / `removeSync` (real `EACCES`/`EBUSY` errors propagate) |
|
|
120
|
+
| `emptyDir` / `emptyDirSync` | `emptyDir` / `emptyDirSync` |
|
|
121
|
+
| `ensureFile` / `ensureDir` / … | `ensureFile` / `ensureDir` / `ensureLink` / `ensureSymlink` (+ `*Sync`) |
|
|
122
|
+
| `readJson` / `writeJson` | `readJson` / `writeJson` (+ `*Sync`) |
|
|
123
|
+
| `pathExists` | `isAccessible` / `isAccessibleSync` |
|
|
124
|
+
|
|
125
|
+
> **`writeFile` notes:** `overwrite` defaults to `true`. With `overwrite: false`,
|
|
126
|
+
> `writeFile` throws `AlreadyExistsError` if the target exists instead of
|
|
127
|
+
> overwriting it. To keep a copy of the previous file before overwriting, pass
|
|
128
|
+
> `{ backup: true }` — the old contents are renamed to `${path}.bak`.
|
|
129
|
+
>
|
|
130
|
+
> **`readFile` errors:** a missing file throws `NotFoundError` (`ENOENT`); a file
|
|
131
|
+
> that cannot be read for permission reasons throws `PermissionError`
|
|
132
|
+
> (`EACCES`/`EPERM`).
|
|
133
|
+
|
|
69
134
|
## walk
|
|
70
135
|
|
|
71
136
|
```typescript
|
package/dist/glob.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { g as glob, a as globSync } from "./packem_shared/glob-sync.d-
|
|
2
|
-
export {
|
|
1
|
+
export { g as glob, a as globSync } from "./packem_shared/glob-sync.d-hXe38TnZ.js";
|
|
2
|
+
export type { G as GlobOptions } from "./packem_shared/types.d-BMdL_ygj.js";
|
|
3
3
|
import 'node:fs';
|
|
4
|
-
import '
|
|
4
|
+
import 'fdir';
|
package/dist/glob.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"./packem_shared/glob-
|
|
1
|
+
import{default as e}from"./packem_shared/glob-fqg4KepW.js";import{default as l}from"./packem_shared/globSync-B8_ne93E.js";export{e as glob,l as globSync};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,105 @@
|
|
|
1
|
-
import { q as WalkOptions, F as FindUpName, r as FindUpOptions, s as FindUpNameSync, t as WalkEntry, u as ReadFileOptions, v as ContentType, w as ReadJsonOptions,
|
|
2
|
-
export { type A as CodeFrameLocation, type
|
|
1
|
+
import { q as WalkOptions, F as FindUpName, r as FindUpOptions, s as FindUpNameSync, t as WalkEntry, u as ReadFileOptions, v as ContentType, w as ReadJsonOptions, l as JsonReviver, x as RetryOptions, y as WriteFileOptions, z as WriteJsonOptions } from "./packem_shared/types.d-BMdL_ygj.js";
|
|
2
|
+
export { type A as CodeFrameLocation, type k as CodeFrameOptions, B as FIND_UP_STOP, D as F_OK, type E as FindUpNameFnResult, type H as FindUpNameSyncFnResult, type G as GlobOptions, type o as JsonReplacer, K as R_OK, type L as ReadFileEncoding, M as W_OK, X as X_OK } from "./packem_shared/types.d-BMdL_ygj.js";
|
|
3
3
|
import { symlink } from 'node:fs';
|
|
4
4
|
export { CRLF, EOL, LF, detect, format } from "./eol.js";
|
|
5
|
-
export { g as glob, a as globSync } from "./packem_shared/glob-sync.d-
|
|
5
|
+
export { g as glob, a as globSync } from "./packem_shared/glob-sync.d-hXe38TnZ.js";
|
|
6
6
|
export { type GlobParentOptions, default as globParent } from "./glob-parent.js";
|
|
7
7
|
export { type IsGlobOptions, default as isGlob } from "./is-glob.js";
|
|
8
8
|
export { type MatchOptions, match, matcher } from "./match.js";
|
|
9
9
|
import { JsonValue } from 'type-fest';
|
|
10
10
|
import fs from 'fs';
|
|
11
|
-
import '
|
|
11
|
+
import 'fdir';
|
|
12
|
+
/**
|
|
13
|
+
* Options for `copy` and `copySync`.
|
|
14
|
+
*/
|
|
15
|
+
type CopyOptions = {
|
|
16
|
+
/**
|
|
17
|
+
* Dereference symlinks, copying the files they point to instead of the
|
|
18
|
+
* links themselves.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
dereference?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* When `true`, throw an error if the destination already exists and
|
|
24
|
+
* {@link CopyOptions.overwrite} is `false`. When `false`, existing files
|
|
25
|
+
* are silently skipped.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
errorOnExist?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Function to filter which files/directories are copied. Return `true` to
|
|
31
|
+
* copy the item, `false` to skip it (and, for directories, their contents).
|
|
32
|
+
* @param source The source path being considered.
|
|
33
|
+
* @param destination The destination path it would be copied to.
|
|
34
|
+
* @returns Whether to copy the item.
|
|
35
|
+
*/
|
|
36
|
+
filter?: (source: string, destination: string) => boolean | Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Overwrite existing files/directories at the destination.
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
overwrite?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Preserve timestamps (`atime`/`mtime`) from the source.
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
preserveTimestamps?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* When `true`, copy directories recursively.
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
recursive?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* When `overwrite` is `false`, this controls whether copying over an
|
|
54
|
+
* existing file throws. Mirrors `node:fs.cp`'s `verbatimSymlinks`.
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
verbatimSymlinks?: boolean;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Synchronous variant of {@link CopyOptions.filter}.
|
|
61
|
+
*/
|
|
62
|
+
type CopyFilterSync = (source: string, destination: string) => boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Asynchronously copies a file or directory (recursively) from `source` to `destination`.
|
|
65
|
+
*
|
|
66
|
+
* Built on `node:fs.cp`, this completes the fs-extra parity story alongside
|
|
67
|
+
* `move`, `remove` and `emptyDir`.
|
|
68
|
+
* @param source The file or directory to copy. Can be a file URL or a string path.
|
|
69
|
+
* @param destination The target path. Can be a file URL or a string path.
|
|
70
|
+
* @param options Optional configuration. See {@link CopyOptions}.
|
|
71
|
+
* @returns A promise that resolves when the copy completes.
|
|
72
|
+
* @throws {AlreadyExistsError} When `overwrite` is `false`, `errorOnExist` is `true`, and the destination exists.
|
|
73
|
+
* @example
|
|
74
|
+
* ```javascript
|
|
75
|
+
* import { copy } from "@visulima/fs";
|
|
76
|
+
*
|
|
77
|
+
* // Copy a template directory, skipping node_modules and overwriting existing files
|
|
78
|
+
* await copy("templates/app", "out/app", {
|
|
79
|
+
* filter: (src) => !src.includes("node_modules"),
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
declare const copy: (source: URL | string, destination: URL | string, options?: CopyOptions) => Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Synchronously copies a file or directory (recursively) from `source` to `destination`.
|
|
86
|
+
*
|
|
87
|
+
* The synchronous counterpart of `copy`. Note that `cpSync` only accepts a
|
|
88
|
+
* synchronous `filter`.
|
|
89
|
+
* @param source The file or directory to copy. Can be a file URL or a string path.
|
|
90
|
+
* @param destination The target path. Can be a file URL or a string path.
|
|
91
|
+
* @param options Optional configuration. See {@link CopyOptions} (the `filter` must be synchronous).
|
|
92
|
+
* @throws {AlreadyExistsError} When `overwrite` is `false`, `errorOnExist` is `true`, and the destination exists.
|
|
93
|
+
* @example
|
|
94
|
+
* ```javascript
|
|
95
|
+
* import { copySync } from "@visulima/fs";
|
|
96
|
+
*
|
|
97
|
+
* copySync("templates/app", "out/app", { overwrite: false, errorOnExist: false });
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
declare const copySync: (source: URL | string, destination: URL | string, options?: Omit<CopyOptions, "filter"> & {
|
|
101
|
+
filter?: CopyFilterSync;
|
|
102
|
+
}) => void;
|
|
12
103
|
/**
|
|
13
104
|
* Ensures that the directory exists.
|
|
14
105
|
* If the directory structure does not exist, it is created. Like mkdir -p.
|
|
@@ -328,16 +419,7 @@ declare const findUpSync: (name: FindUpNameSync, options?: FindUpOptions) => str
|
|
|
328
419
|
* printEntries();
|
|
329
420
|
* ```
|
|
330
421
|
*/
|
|
331
|
-
declare function walk(directory: URL | string,
|
|
332
|
-
extensions,
|
|
333
|
-
followSymlinks,
|
|
334
|
-
includeDirs: includeDirectories,
|
|
335
|
-
includeFiles,
|
|
336
|
-
includeSymlinks,
|
|
337
|
-
match,
|
|
338
|
-
maxDepth,
|
|
339
|
-
skip
|
|
340
|
-
}?: WalkOptions): AsyncIterableIterator<WalkEntry>;
|
|
422
|
+
declare function walk(directory: URL | string, options?: WalkOptions): AsyncIterableIterator<WalkEntry>;
|
|
341
423
|
/**
|
|
342
424
|
* Synchronously walks the file tree rooted at `directory`, yielding each file or directory that matches the criteria specified in `options`.
|
|
343
425
|
* This is the synchronous version of the async walk function.
|
|
@@ -370,16 +452,7 @@ declare function walk(directory: URL | string, {
|
|
|
370
452
|
* }
|
|
371
453
|
* ```
|
|
372
454
|
*/
|
|
373
|
-
declare function walkSync(directory: URL | string,
|
|
374
|
-
extensions,
|
|
375
|
-
followSymlinks,
|
|
376
|
-
includeDirs: includeDirectories,
|
|
377
|
-
includeFiles,
|
|
378
|
-
includeSymlinks,
|
|
379
|
-
match,
|
|
380
|
-
maxDepth,
|
|
381
|
-
skip
|
|
382
|
-
}?: WalkOptions): IterableIterator<WalkEntry>;
|
|
455
|
+
declare function walkSync(directory: URL | string, options?: WalkOptions): IterableIterator<WalkEntry>;
|
|
383
456
|
/**
|
|
384
457
|
* Asynchronously tests a user's permissions for the file or directory specified by path.
|
|
385
458
|
* Returns a Promise that resolves to `true` if the accessibility check is successful, `false` otherwise.
|
|
@@ -854,4 +927,4 @@ type FsSubset = {
|
|
|
854
927
|
* ```
|
|
855
928
|
*/
|
|
856
929
|
declare const isFsCaseSensitive: (directoryPath?: string, fsInstance?: FsSubset, useCache?: boolean) => boolean;
|
|
857
|
-
export { type ContentType, type FindUpName, type FindUpNameSync, type FindUpOptions, type JsonReviver, type Options as MoveOptions, type ReadFileOptions, type ReadJsonOptions, type SanitizeOptions, type WalkEntry, type WalkOptions, type WriteFileOptions, type WriteJsonOptions, collect, collectSync, emptyDir, emptyDirSync, ensureDir, ensureDirSync, ensureFile, ensureFileSync, ensureLink, ensureLinkSync, ensureSymlink, ensureSymlinkSync, findUp, findUpSync, isAccessible, isAccessibleSync, isFsCaseSensitive, move, moveSync, readFile, readFileSync, readJson, readJsonSync, remove, removeSync, rename, renameSync, sanitize, walk, walkSync, writeFile, writeFileSync, writeJson, writeJsonSync };
|
|
930
|
+
export { type ContentType, type CopyFilterSync, type CopyOptions, type FindUpName, type FindUpNameSync, type FindUpOptions, type JsonReviver, type Options as MoveOptions, type ReadFileOptions, type ReadJsonOptions, type SanitizeOptions, type WalkEntry, type WalkOptions, type WriteFileOptions, type WriteJsonOptions, collect, collectSync, copy, copySync, emptyDir, emptyDirSync, ensureDir, ensureDirSync, ensureFile, ensureFileSync, ensureLink, ensureLinkSync, ensureSymlink, ensureSymlinkSync, findUp, findUpSync, isAccessible, isAccessibleSync, isFsCaseSensitive, move, moveSync, readFile, readFileSync, readJson, readJsonSync, remove, removeSync, rename, renameSync, sanitize, walk, walkSync, writeFile, writeFileSync, writeJson, writeJsonSync };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FIND_UP_STOP as
|
|
1
|
+
import{createRequire as h}from"node:module";import{FIND_UP_STOP as L,F_OK as P,R_OK as R,W_OK as $,X_OK as J}from"./packem_shared/FIND_UP_STOP-CAwY1qU7.js";import{default as T}from"./packem_shared/copy-Beb64BYG.js";import{default as W}from"./packem_shared/copySync-CagcIEBi.js";import{default as M}from"./packem_shared/ensureDir-DGarVZw8.js";import{default as E}from"./packem_shared/ensureDirSync-CsgPrsDH.js";import{default as z}from"./packem_shared/ensureFile-CMugWljp.js";import{default as I}from"./packem_shared/ensureFileSync-CJYTEx2r.js";import{default as H}from"./packem_shared/ensureLink-ChShf3lf.js";import{default as V}from"./packem_shared/ensureLinkSync-DPpq0I2Z.js";import{default as Z}from"./packem_shared/ensureSymlink-y4FZjfxA.js";import{default as re}from"./packem_shared/ensureSymlinkSync-TcHssCH7.js";import{CRLF as oe,EOL as se,LF as ae,detect as ne,format as ie}from"./eol.js";import{default as le}from"./packem_shared/collect-CIKDOMiD.js";import{default as ue}from"./packem_shared/collectSync-D0FRLLqg.js";import{default as me}from"./packem_shared/findUp-Cii5ATt5.js";import{default as xe}from"./packem_shared/findUpSync-C9Lkh7-v.js";import{default as Se}from"./packem_shared/glob-fqg4KepW.js";import{default as _e}from"./packem_shared/globSync-B8_ne93E.js";import{default as Fe}from"./packem_shared/walk-OX4-6oCP.js";import{default as ge}from"./packem_shared/walkSync-BPs6czIM.js";import{default as ke}from"./glob-parent.js";import{default as De}from"./packem_shared/isAccessible-PmWJhV6I.js";import{default as qe}from"./packem_shared/isAccessibleSync-BrbOtwdr.js";import{default as Le}from"./is-glob.js";import{match as Re,matcher as $e}from"./match.js";import{move as Ke,moveSync as Te,rename as Ue,renameSync as We}from"./packem_shared/move-DopmzT-2.js";import{default as Me}from"./packem_shared/readFile-BswaBgM0.js";import{default as Ee}from"./packem_shared/readFileSync-_fDF6Oj1.js";import{default as ze}from"./packem_shared/readJson-BCdoReQ-.js";import{default as Ie}from"./packem_shared/readJsonSync-CvkZyKmL.js";import{default as He}from"./packem_shared/emptyDir-C7lyd1lW.js";import{default as Ve}from"./packem_shared/emptyDirSync-B8EYpmO9.js";import{default as Ze}from"./packem_shared/remove-CSbrd0dl.js";import{default as rr}from"./packem_shared/removeSync-BoLAzRQE.js";import{sanitize as or}from"./packem_shared/sanitize-DGZ3w-_w.js";import{default as ar}from"./packem_shared/writeFile-BrMtsJY7.js";import{default as ir}from"./packem_shared/writeFileSync-W7Mf4BNy.js";import{default as lr}from"./packem_shared/writeJson-bEVi25gX.js";import{default as ur}from"./packem_shared/writeJsonSync-DkGnd416.js";const F=h(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=i=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[s,f]=n.versions.node.split(".").map(Number);if(s>22||s===22&&f>=3||s===20&&f>=16)return n.getBuiltinModule(i)}return F(i)},b=u("fs"),g=u("os"),w=u("path");var c={},x;function k(){if(x)return c;x=1;var i=Object.defineProperty,s=(o,e)=>i(o,"name",{value:e,configurable:!0}),f=b,y=g,S=w;const p=s(o=>{let e="";for(let r=0;r<o.length;r+=1){const t=o[r],a=t.toUpperCase();e+=t===a?t.toLowerCase():a}return e},"invertCase"),l=new Map,m=s((o,e)=>{const r=S.join(o,`.is-fs-case-sensitive-test-${process.pid}`);try{return e.writeFileSync(r,""),!e.existsSync(p(r))}finally{try{e.unlinkSync(r)}catch{}}},"checkDirectoryCaseWithWrite"),v=s((o,e,r)=>{try{return m(o,r)}catch(t){if(e===void 0)return m(y.tmpdir(),r);throw t}},"checkDirectoryCaseWithFallback"),_=s((o,e=f,r=!0)=>{const t=o??process.cwd();if(r&&l.has(t))return l.get(t);let a;const d=p(t);return d!==t&&e.existsSync(t)?a=!e.existsSync(d):a=v(t,o,e),r&&l.set(t,a),a},"isFsCaseSensitive");return c.isFsCaseSensitive=_,c}var C=k();const j=C.isFsCaseSensitive;export{oe as CRLF,se as EOL,L as FIND_UP_STOP,P as F_OK,ae as LF,R as R_OK,$ as W_OK,J as X_OK,le as collect,ue as collectSync,T as copy,W as copySync,ne as detect,He as emptyDir,Ve as emptyDirSync,M as ensureDir,E as ensureDirSync,z as ensureFile,I as ensureFileSync,H as ensureLink,V as ensureLinkSync,Z as ensureSymlink,re as ensureSymlinkSync,me as findUp,xe as findUpSync,ie as format,Se as glob,ke as globParent,_e as globSync,De as isAccessible,qe as isAccessibleSync,j as isFsCaseSensitive,Le as isGlob,Re as match,$e as matcher,Ke as move,Te as moveSync,Me as readFile,Ee as readFileSync,ze as readJson,Ie as readJsonSync,Ze as remove,rr as removeSync,Ue as rename,We as renameSync,or as sanitize,Fe as walk,ge as walkSync,ar as writeFile,ir as writeFileSync,lr as writeJson,ur as writeJsonSync};
|
package/dist/ini.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { C as CompressionType, R as ReadIniOptions, W as WriteIniOptions } from "./packem_shared/types.d-BMdL_ygj.js";
|
|
2
|
+
export type { I as IniEncodeOptions, a as IniLineEnding } from "./packem_shared/types.d-BMdL_ygj.js";
|
|
3
3
|
import 'node:fs';
|
|
4
|
-
import '
|
|
4
|
+
import 'fdir';
|
|
5
5
|
/**
|
|
6
6
|
* Asynchronously reads an INI file and parses it into an object.
|
|
7
7
|
* @template R The expected type of the parsed object. Defaults to `Record<string, unknown>`.
|
package/dist/ini.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"./packem_shared/readIni-
|
|
1
|
+
import{default as a}from"./packem_shared/readIni-BsXudu2r.js";import{default as f}from"./packem_shared/readIniSync-DKwRbbs9.js";import{default as d}from"./packem_shared/writeIni-BWX3cP1K.js";import{default as n}from"./packem_shared/writeIniSync-fOdgPFfL.js";export{a as readIni,f as readIniSync,d as writeIni,n as writeIniSync};
|
package/dist/json5.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { C as CompressionType, b as ReadJson5Options, J as Json5Reviver, c as WriteJson5Options } from "./packem_shared/types.d-BMdL_ygj.js";
|
|
2
|
+
export type { d as Json5Replacer } from "./packem_shared/types.d-BMdL_ygj.js";
|
|
3
3
|
import 'node:fs';
|
|
4
|
-
import '
|
|
4
|
+
import 'fdir';
|
|
5
5
|
declare function readJson5<R = unknown>(path: URL | string, options?: ReadJson5Options<CompressionType>): Promise<R>;
|
|
6
6
|
declare function readJson5<R = unknown>(path: URL | string, reviver: Json5Reviver, options?: ReadJson5Options<CompressionType>): Promise<R>;
|
|
7
7
|
declare function readJson5Sync(path: URL | string, options?: ReadJson5Options<CompressionType>): unknown;
|
package/dist/json5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"./packem_shared/readJson5-
|
|
1
|
+
import{default as r}from"./packem_shared/readJson5-CM1TIiHd.js";import{default as t}from"./packem_shared/readJson5Sync-Bc26c3Fy.js";import{default as s}from"./packem_shared/writeJson5-Ch8TpNPI.js";import{default as n}from"./packem_shared/writeJson5Sync-BrctV_Mk.js";export{r as readJson5,t as readJson5Sync,s as writeJson5,n as writeJson5Sync};
|
package/dist/jsonc.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { C as CompressionType, e as ReadJsoncOptions, f as WriteJsoncOptions } from "./packem_shared/types.d-BMdL_ygj.js";
|
|
2
|
+
export type { g as JsoncFormattingOptions, h as JsoncParseOptions } from "./packem_shared/types.d-BMdL_ygj.js";
|
|
3
3
|
import 'node:fs';
|
|
4
|
-
import '
|
|
4
|
+
import 'fdir';
|
|
5
5
|
/**
|
|
6
6
|
* Asynchronously reads a JSONC (JSON with comments) file and parses it into a JavaScript value.
|
|
7
7
|
* Supports `//` and `/* *\/` comments and, optionally, trailing commas via `jsonc-parser`.
|
package/dist/jsonc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"./packem_shared/readJsonc-
|
|
1
|
+
import{default as r}from"./packem_shared/readJsonc-BabpyMMh.js";import{default as t}from"./packem_shared/readJsoncSync-CCvRcAP-.js";import{default as s}from"./packem_shared/writeJsonc-CefrwsOc.js";import{default as d}from"./packem_shared/writeJsoncSync-BskDjn8o.js";export{r as readJsonc,t as readJsoncSync,s as writeJsonc,d as writeJsoncSync};
|
package/dist/match.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./packem_shared/index-
|
|
1
|
+
import{a}from"./packem_shared/index-D8MDd0tv.js";const o=(r,e,n)=>{const t=a(e,n);return Array.isArray(r)?r.some(c=>t(c)):t(r)},s=(r,e)=>{const n=a(r,e);return t=>n(t)};export{o as match,s as matcher};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import n from"./walk-
|
|
1
|
+
import n from"./walk-OX4-6oCP.js";const e=async(r,s={})=>{Array.isArray(s.extensions)||(s.extensions=["js","mjs","cjs","ts"]);const o=[];for await(const t of n(r,s))o.push(t.path);return o};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"./walkSync-
|
|
1
|
+
import t from"./walkSync-BPs6czIM.js";const a=(r,s={})=>{Array.isArray(s.extensions)||(s.extensions=["js","mjs","cjs","ts"]);const o=[];for(const n of t(r,s))o.push(n.path);return o};export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as v}from"node:module";import{toPath as n}from"@visulima/path/utils";import h from"./AlreadyExistsError-DEb3UWja.js";import c from"./assertValidFileOrDirectoryPath-BTlt945W.js";const y=v(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=r=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,t]=s.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return s.getBuiltinModule(r)}return y(r)},{cp:g}=b("node:fs/promises"),x=async(r,e,t={})=>{c(r),c(e);const{dereference:a=!1,errorOnExist:f=!0,filter:m,overwrite:p=!0,preserveTimestamps:l=!1,recursive:u=!0,verbatimSymlinks:d=!1}=t,_=n(r),o=n(e);try{await g(_,o,{dereference:a,errorOnExist:f,filter:m,force:p,preserveTimestamps:l,recursive:u,verbatimSymlinks:d})}catch(i){throw i?.code==="ERR_FS_CP_EEXIST"?new h(`destination already exists, copy '${o}'`):i}};export{x as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as v}from"node:module";import{toPath as n}from"@visulima/path/utils";import g from"./AlreadyExistsError-DEb3UWja.js";import c from"./assertValidFileOrDirectoryPath-BTlt945W.js";const y=v(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=r=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,t]=s.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return s.getBuiltinModule(r)}return y(r)},{cpSync:b}=h("node:fs"),x=(r,e,t={})=>{c(r),c(e);const{dereference:a=!1,errorOnExist:f=!0,filter:m,overwrite:l=!0,preserveTimestamps:p=!1,recursive:u=!0,verbatimSymlinks:d=!1}=t,_=n(r),o=n(e);try{b(_,o,{dereference:a,errorOnExist:f,filter:m,force:l,preserveTimestamps:p,recursive:u,verbatimSymlinks:d})}catch(i){throw i?.code==="ERR_FS_CP_EEXIST"?new g(`destination already exists, copy '${o}'`):i}};export{x as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as g}from"node:module";import{resolve as c,parse as T,isAbsolute as j,dirname as v}from"@visulima/path";import{toPath as f}from"@visulima/path/utils";import{FIND_UP_STOP as B}from"./FIND_UP_STOP-CAwY1qU7.js";const w=g(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=t=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,i]=s.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return s.getBuiltinModule(t)}return w(t)},{stat:A,lstat:b}=h("node:fs/promises"),k=async(t,e={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const i=e.cwd?f(e.cwd):process.cwd();let r=c(i);const{root:a}=T(r),y=f(e.stopAt??a),m=c(r,y),u=e.type??"file",d=async function(n){return typeof t=="function"?[await t(n)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};e.allowSymlinks??=!0;const _=e.allowSymlinks?A:b;for(;r&&r!==m&&r!==a;){const n=await d(r);for(let o of n){if(o===B)return;if(o===void 0)continue;Buffer.isBuffer(o)?o=o.toString():o instanceof URL&&(o=f(o));const l=j(o)?o:c(r,o);try{const p=await _(l);if(u==="file"&&p.isFile()||u==="directory"&&p.isDirectory())return l}catch{}}r=v(r)}};export{k as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as _}from"node:module";import{resolve as i,parse as A,isAbsolute as S,dirname as T}from"@visulima/path";import{toPath as c}from"@visulima/path/utils";import{FIND_UP_STOP as j}from"./FIND_UP_STOP-CAwY1qU7.js";const g=_(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[o,n]=s.versions.node.split(".").map(Number);if(o>22||o===22&&n>=3||o===20&&n>=16)return s.getBuiltinModule(e)}return g(e)},{statSync:w,lstatSync:b}=h("node:fs"),F=(e,o={})=>{if(typeof e!="string"&&!Array.isArray(e)&&typeof e!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const n=o.cwd?c(o.cwd):process.cwd();let r=i(n);const{root:f}=A(r),p=c(o.stopAt??f),y=i(r,p),u=o.type??"file",m=function(t){return typeof e=="function"?[e(t)]:typeof e=="string"?[e]:Array.isArray(e)?e:[e]};o.allowSymlinks??=!0;const d=o.allowSymlinks?w:b;for(;r&&r!==y&&r!==f;){for(let t of m(r)){if(t===j)return;if(t===void 0)continue;Buffer.isBuffer(t)?t=t.toString():t instanceof URL&&(t=c(t));const a=S(t)?t:i(r,t);try{const l=d(a);if(u==="file"&&l.isFile()||u==="directory"&&l.isDirectory())return a}catch{}}r=T(r)}};export{F as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as o}from"./index-BLg3XWiD.js";const i=async(a,t)=>await o(a,t);export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as r}from"./index-BLg3XWiD.js";const s=(t,o)=>r(t,o);export{s as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as it}from"node:module";import{a as $}from"./index-D8MDd0tv.js";const ut=it(import.meta.url),P=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=t=>{if(typeof P<"u"&&P.versions&&P.versions.node){const[e,s]=P.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return P.getBuiltinModule(t)}return ut(t)},R=D("fs"),lt={...R,default:R},{statSync:ct,stat:at,realpathSync:ht,realpath:pt,readdirSync:ft,readdir:gt}=D("fs"),{sep:G,basename:dt,dirname:A,resolve:N,normalize:yt,relative:mt,posix:S,isAbsolute:bt}=D("path"),{fileURLToPath:vt}=D("url"),{createRequire:wt}=D("module");var C=wt(import.meta.url);function St(t){let e=yt(t);return e.length>1&&e[e.length-1]===G&&(e=e.substring(0,e.length-1)),e}const $t=/[\\/]/g;function U(t,e){return t.replace($t,e)}const kt=/^[a-z]:[\\/]$/i;function Pt(t){return t==="/"||kt.test(t)}function j(t,e){const{resolvePaths:s,normalizePath:r,pathSeparator:n}=e,i=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(s&&(t=N(t)),(r||i)&&(t=St(t)),t===".")return"";const o=t[t.length-1]!==n;return U(o?t+n:t,n)}function Q(t,e){return e+t}function xt(t,e){return function(s,r){return r.startsWith(t)?r.slice(t.length)+s:U(mt(t,r),e.pathSeparator)+e.pathSeparator+s}}function Dt(t){return t}function Ft(t,e,s){return e+t+s}function _t(t,e){const{relativePaths:s,includeBasePath:r}=e;return s&&t?xt(t,e):r?Q:Dt}function Et(t){return function(e,s){s.push(e.substring(t.length)||".")}}function qt(t){return function(e,s,r){const n=e.substring(t.length)||".";r.every(i=>i(n,!0))&&s.push(n)}}const jt=(t,e)=>{e.push(t||".")},Ot=(t,e,s)=>{const r=t||".";s.every(n=>n(r,!0))&&e.push(r)},At=()=>{};function Wt(t,e){const{includeDirs:s,filters:r,relativePaths:n}=e;return s?n?r&&r.length?qt(t):Et(t):r&&r.length?Ot:jt:At}const Bt=(t,e,s,r)=>{r.every(n=>n(t,!1))&&s.files++},Rt=(t,e,s,r)=>{r.every(n=>n(t,!1))&&e.push(t)},Ct=(t,e,s,r)=>{s.files++},Mt=(t,e)=>{e.push(t)},Lt=()=>{};function It(t){const{excludeFiles:e,filters:s,onlyCounts:r}=t;return e?Lt:s&&s.length?r?Bt:Rt:r?Ct:Mt}const Tt=t=>t,zt=()=>[""].slice(0,0);function Gt(t){return t.group?zt:Tt}const Nt=(t,e,s)=>{t.push({directory:e,files:s,dir:e})},Ut=()=>{};function Qt(t){return t.group?Nt:Ut}const Yt=function(t,e,s){const{queue:r,fs:n,options:{suppressErrors:i}}=e;r.enqueue(),n.realpath(t,(o,u)=>{if(o)return r.dequeue(i?null:o,e);n.stat(u,(g,f)=>{if(g)return r.dequeue(i?null:g,e);if(f.isDirectory()&&Y(t,u,e))return r.dequeue(null,e);s(f,u),r.dequeue(null,e)})})},Zt=function(t,e,s){const{queue:r,fs:n,options:{suppressErrors:i}}=e;r.enqueue();try{const o=n.realpathSync(t),u=n.statSync(o);if(u.isDirectory()&&Y(t,o,e))return;s(u,o)}catch(o){if(!i)throw o}};function Ht(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Zt:Yt}function Y(t,e,s){if(s.options.useRealPaths)return Jt(e,s);let r=A(t),n=1;for(;r!==s.root&&n<2;){const i=s.symlinks.get(r);i&&(i===e||i.startsWith(e)||e.startsWith(i))?n++:r=A(r)}return s.symlinks.set(t,e),n>1}function Jt(t,e){return e.visited.includes(t+e.options.pathSeparator)}const Kt=t=>t.counts,Vt=t=>t.groups,Xt=t=>t.paths,te=t=>t.paths.slice(0,t.options.maxFiles),ee=(t,e,s)=>(F(e,s,t.counts,t.options.suppressErrors),null),se=(t,e,s)=>(F(e,s,t.paths,t.options.suppressErrors),null),re=(t,e,s)=>(F(e,s,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),ne=(t,e,s)=>(F(e,s,t.groups,t.options.suppressErrors),null);function F(t,e,s,r){e(t&&!r?t:null,s)}function oe(t,e){const{onlyCounts:s,group:r,maxFiles:n}=t;return s?e?Kt:ee:r?e?Vt:ne:n?e?te:re:e?Xt:se}const Z={withFileTypes:!0},ie=(t,e,s,r,n)=>{if(t.queue.enqueue(),r<0)return t.queue.dequeue(null,t);const{fs:i}=t;t.visited.push(e),t.counts.directories++,i.readdir(e||".",Z,(o,u=[])=>{n(u,s,r),t.queue.dequeue(t.options.suppressErrors?null:o,t)})},ue=(t,e,s,r,n)=>{const{fs:i}=t;if(r<0)return;t.visited.push(e),t.counts.directories++;let o=[];try{o=i.readdirSync(e||".",Z)}catch(u){if(!t.options.suppressErrors)throw u}n(o,s,r)};function le(t){return t?ue:ie}var ce=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},ae=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},he=class{aborted=!1;abort(){this.aborted=!0}},H=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,s){this.isSynchronous=!s,this.callbackInvoker=oe(e,this.isSynchronous),this.root=j(t,e),this.state={root:Pt(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new ae,options:e,queue:new ce((r,n)=>this.callbackInvoker(n,r,s)),symlinks:new Map,visited:[""].slice(0,0),controller:new he,fs:e.fs||lt},this.joinPath=_t(this.root,e),this.pushDirectory=Wt(this.root,e),this.pushFile=It(e),this.getArray=Gt(e),this.groupFiles=Qt(e),this.resolveSymlink=Ht(e,this.isSynchronous),this.walkDirectory=le(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,s)=>{const{paths:r,options:{filters:n,resolveSymlinks:i,excludeSymlinks:o,exclude:u,maxFiles:g,signal:f,useRealPaths:y,pathSeparator:h},controller:m}=this.state;if(m.aborted||f&&f.aborted||g&&r.length>g)return;const l=this.getArray(this.state.paths);for(let p=0;p<t.length;++p){const a=t[p];if(a.isFile()||a.isSymbolicLink()&&!i&&!o){const c=this.joinPath(a.name,e);this.pushFile(c,l,this.state.counts,n)}else if(a.isDirectory()){let c=Ft(a.name,e,this.state.options.pathSeparator);if(u&&u(a.name,c))continue;this.pushDirectory(c,r,n),this.walkDirectory(this.state,c,c,s-1,this.walk)}else if(this.resolveSymlink&&a.isSymbolicLink()){let c=Q(a.name,e);this.resolveSymlink(c,this.state,(_,d)=>{if(_.isDirectory()){if(d=j(d,this.state.options),u&&u(a.name,y?d:c+h))return;this.walkDirectory(this.state,d,y?d:c+h,s-1,this.walk)}else{d=y?d:c;const k=dt(d),E=j(A(d),this.state.options);d=this.joinPath(k,E),this.pushFile(d,l,this.state.counts,n)}})}}this.groupFiles(this.state.groups,e,l)}};function pe(t,e){return new Promise((s,r)=>{J(t,e,(n,i)=>{if(n)return r(n);s(i)})})}function J(t,e,s){new H(t,e,s).start()}function fe(t,e){return new H(t,e).start()}var M=class{constructor(e,s){this.root=e,this.options=s}withPromise(){return pe(this.root,this.options)}withCallback(e){J(this.root,this.options,e)}sync(){return fe(this.root,this.options)}};let K=null;try{C.resolve("picomatch"),K=C("picomatch")}catch{}var ge=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:G,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new M(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new M(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){const s=this.globFunction||K;if(!s)throw new Error("Please specify a glob function to use glob matching.");var r=this.globCache[t.join("\0")];return r||(r=s(t,...e),this.globCache[t.join("\0")]=r),this.options.filters.push(n=>r(n)),this}};const de=Array.isArray,V=/\\/g,ye=/^[A-Za-z]:$/,X=process.platform==="win32",me=/^(\/?\.\.)+$/;function L(t,e={}){const s=t.length,r=Array(s),n=Array(s);let i,o;for(i=0;i<s;i++){const u=tt(t[i]);r[i]=u;const g=u.length,f=Array(g);for(o=0;o<g;o++)f[o]=$(u[o],e);n[i]=f}return u=>{const g=u.split("/");if(g[0]===".."&&me.test(u))return!0;for(i=0;i<s;i++){const f=r[i],y=n[i],h=g.length,m=Math.min(h,f.length);for(o=0;o<m;){const l=f[o];if(l.includes("/"))return!0;if(!y[o](g[o]))break;if(!e.noglobstar&&l==="**")return!0;o++}if(o===h)return!0}return!1}}const be=/^[A-Z]:\/$/i,ve=X?t=>be.test(t):t=>t==="/";function I(t,e,s){if(t===e||e.startsWith(`${t}/`)){if(s){const n=t.length+ +!ve(t);return(i,o)=>i.slice(n,o?-1:void 0)||"."}const r=e.slice(t.length+1);return r?(n,i)=>{if(n===".")return r;const o=`${r}/${n}`;return i?o.slice(0,-1):o}:(n,i)=>i&&n!=="."?n.slice(0,-1):n}return s?r=>S.relative(t,r)||".":r=>S.relative(t,`${e}/${r}`)||"."}function we(t,e){if(e.startsWith(`${t}/`)){const s=e.slice(t.length+1);return r=>`${s}/${r}`}return s=>{const r=S.relative(t,`${e}/${s}`);return s[s.length-1]==="/"&&r!==""?`${r}/`:r||"."}}function T(t){return t.replace(ye,e=>`${e}/`)}const Se={parts:!0};function tt(t){var e;const s=$.scan(t,Se);return!((e=s.parts)===null||e===void 0)&&e.length?s.parts:[t]}const $e=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,ke=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,Pe=t=>t.replace($e,"\\$&"),xe=t=>t.replace(ke,"\\$&"),De=X?xe:Pe;function Fe(t,e){const s=$.scan(t);return s.isGlob||s.negated}function x(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function et(t){return typeof t=="string"?[t]:t??[]}const _e=/^(\/?\.\.)+/,Ee=/\\(?=[()[\]{}!*+?@|])/g;function O(t,e,s,r){var n;const i=e.cwd;let o=t;t[t.length-1]==="/"&&(o=t.slice(0,-1));const u=o.lastIndexOf("/"),g=(u===-1?o:o.slice(u+1)).startsWith("!(");o[o.length-1]!=="*"&&!g&&e.expandDirectories&&(o+="/**");const f=De(i);o=bt(o.replace(Ee,""))?S.relative(f,o):S.normalize(o);const y=(n=_e.exec(o))===null||n===void 0?void 0:n[0],h=tt(o);if(y){const l=(y.length+1)/3;let p=0;const a=f.split("/");for(;p<l&&h[p+l]===a[a.length+p-l];)o=o.slice(0,(l-p-1)*3)+o.slice((l-p)*3+h[p+l].length+1)||".",p++;const c=S.join(i,y.slice(p*3));c[0]!=="."&&s.root.length>c.length&&(s.root=T(c),s.depthOffset=-l+p)}if(!r&&s.depthOffset>=0){var m;(m=s.commonPath)!==null&&m!==void 0||(s.commonPath=h);const l=[],p=Math.min(s.commonPath.length,h.length);for(let a=0;a<p;a++){const c=h[a];if(c==="**"&&!h[a+1]){l.pop();break}if(a===h.length-1||c!==s.commonPath[a]||Fe(c))break;l.push(c)}s.depthOffset=l.length,s.commonPath=l,s.root=T(l.length>0?S.join(i,...l):i)}return o}function qe(t,e,s){const r=[],n=[],i=[];for(const o of t.ignore)o&&(o[0]!=="!"||o[1]==="("?n.push(O(o,t,s,!0)):i.push(o.slice(1)));for(const o of e)o&&(o[0]!=="!"||o[1]==="("?r.push(O(o,t,s,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(O(o.slice(1),t,s,!0)));return{match:r,ignore:n,unignore:i}}function je(t,e){const s=t.cwd,r={root:s,depthOffset:0},n=qe(t,e,r);t.debug&&x("internal processing patterns:",n);const{absolute:i,caseSensitiveMatch:o,debug:u,dot:g,followSymbolicLinks:f,onlyDirectories:y}=t,h=r.root.replace(V,""),m={dot:g,nobrace:t.braceExpansion===!1,nocase:!o,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},l=n.unignore.length>0,p=l?$(n.unignore,m):void 0,a=l?L(n.unignore,m):void 0,c=$(n.match,{...m,ignore:n.ignore,onIgnore:p?v=>p(v.output)&&$.constants.UNIGNORE:void 0}),_=$(n.ignore,m),d=L(n.match,m),k=I(s,h,i),E=i?k:I(s,h,!0),nt=n.match.length>0&&n.match.every(v=>v==="**"||v==="**/*"),q=n.ignore.length>0||l||!nt?(v,w)=>{const b=E(w,!0);return b==="."||a&&a(b)?!1:!d(b)||_(b)}:void 0;let W;t.deep!==void 0&&(W=Math.round(t.deep-r.depthOffset));const ot=new ge({filters:[u?(v,w)=>{const b=k(v,w),B=c(b);return B&&x(`matched ${b}`),B}:(v,w)=>{const b=k(v,w);return c(b)}],exclude:u&&q?(v,w)=>{const b=q(v,w);return x(`${b?"skipped":"crawling"} ${w}`),b}:q,fs:t.fs,pathSeparator:"/",relativePaths:!i,resolvePaths:i,includeBasePath:i,resolveSymlinks:f,excludeSymlinks:!f,excludeFiles:y,includeDirs:y||!t.onlyFiles,maxDepth:W,signal:t.signal}).crawl(h);return t.debug&&x("internal properties:",{...r,root:h}),[ot,s!==h&&!i&&we(s,h)]}function st(t,e){if(e)for(let s=t.length-1;s>=0;s--)t[s]=e(t[s]);return t}const z={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Oe(t){const e=Object.assign({},t);for(const s in z)e[s]===void 0&&Object.assign(e,{[s]:z[s]});return e.cwd=(e.cwd instanceof URL?vt(e.cwd):N(e.cwd||process.cwd())).replace(V,"/"),e.ignore=et(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||gt,readdirSync:e.fs.readdirSync||ft,realpath:e.fs.realpath||pt,realpathSync:e.fs.realpathSync||ht,stat:e.fs.stat||at,statSync:e.fs.statSync||ct}),e.debug&&x("globbing with options:",e),e}function rt(t,e={}){var s;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");const r=de(t)||typeof t=="string",n=et((s=r?t:t.patterns)!==null&&s!==void 0?s:"**/*"),i=Oe(r?e:t);return n.length>0?je(i,n):[]}async function Re(t,e){const[s,r]=rt(t,e);return s?st(await s.withPromise(),r):[]}function Ce(t,e){const[s,r]=rt(t,e);return s?st(s.sync(),r):[]}export{Ce as E,Re as b};
|