@inkeep/open-knowledge 0.20.1 → 0.21.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/THIRD_PARTY_NOTICES.md +80 -40
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +2 -2
- package/dist/assets/skills/project/references/anti-patterns.md +1 -1
- package/dist/assets/skills/project/references/preview.md +21 -3
- package/dist/assets/skills/write-skill/SKILL.md +1 -1
- package/dist/{build-DCHzh6iE.mjs → build-CN003PPg.mjs} +2 -2
- package/dist/build-Ca40rJCO.mjs +1 -0
- package/dist/{chokidar-Bu9Rdqzq.mjs → chokidar-oNPiNLWX.mjs} +3 -3
- package/dist/{chunk-BRGMQKJV-CHbk2NqS.mjs → chunk-BRGMQKJV-CZUkYGAZ.mjs} +2 -2
- package/dist/{chunk-HWBSOZZR-5PJ_z6D6.mjs → chunk-HWBSOZZR-DQTTl_pa.mjs} +3 -3
- package/dist/{chunk-XHM67O4N-C_wCK9HT.mjs → chunk-XHM67O4N-D3pxE_Og.mjs} +2 -2
- package/dist/cli.mjs +49 -57
- package/dist/constants-x0acspSh.mjs +2 -0
- package/dist/{dist-Cr0_LDkC.mjs → dist-B3Nl3Djt.mjs} +10 -10
- package/dist/dist-BOoSXzXj.mjs +1 -0
- package/dist/{flag-coverage-QT4N2Z44-DJYVWsW6.mjs → flag-coverage-QT4N2Z44-hqAAghSo.mjs} +2 -2
- package/dist/{gh-detect-BDIdc7oG.mjs → gh-detect-BDCCLwpS.mjs} +3 -3
- package/dist/index.d.mts +27 -5
- package/dist/index.mjs +1 -1
- package/dist/init-DOCf2MYY.mjs +1 -0
- package/dist/init-eaHzzLcd.mjs +317 -0
- package/dist/loader-Bx2WWZdB.mjs +1 -0
- package/dist/{loader-BtXYBnjM.mjs → loader-DcKU2Suk.mjs} +2 -2
- package/dist/{lzma-D4yjI8KW.mjs → lzma-DBkyKSY9.mjs} +2 -2
- package/dist/native/index.d.ts +52 -0
- package/dist/native/index.js +593 -0
- package/dist/native/native-config.linux-x64-gnu.node +0 -0
- package/dist/native/package.json +35 -0
- package/dist/preview-Bob5z4VP.mjs +1 -0
- package/dist/preview-Df40RFQg.mjs +3 -0
- package/dist/public/assets/{ActivityModeContent-BeKprPnC.js → ActivityModeContent-BOmORHei.js} +1 -1
- package/dist/public/assets/{DocumentContext-Dsy-V9Ut.js → DocumentContext-CfRvyFlb.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-BjUj1ege.js → ManagedArtifactProperties-Dgbp1Fs2.js} +1 -1
- package/dist/public/assets/{PropertyPanel-WP7faSjK.js → PropertyPanel-B0hwZHMh.js} +1 -1
- package/dist/public/assets/SettingsDialogBody-Dv1-9_7P.js +7 -0
- package/dist/public/assets/{SourceEditor-BCTvGEN3.js → SourceEditor-BMN-4stf.js} +1 -1
- package/dist/public/assets/{config-validation-events-DeNSFunr.js → config-validation-events-mxFyV1Om.js} +1 -1
- package/dist/public/assets/{index-D9ORkIyY.js → index-CHWT2CB5.js} +5 -5
- package/dist/public/assets/{selection-context-DrXM_FlV.js → selection-context-DzBK_3te.js} +1 -1
- package/dist/public/assets/{telemetry-impl-DXv9s3r6.js → telemetry-impl-DZfG0f1d.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-C9kWtkXV.js → typing-burst-detector-Cc2KgY3K.js} +1 -1
- package/dist/public/index.html +6 -6
- package/dist/{repair-launch-json-NnaC7E-w.mjs → repair-launch-json-C6ZO5Cqt.mjs} +2 -2
- package/dist/{repair-mcp-configs-BMfAMqQS.mjs → repair-mcp-configs-D6D3yZP6.mjs} +2 -2
- package/dist/repair-skills-ClESzPry.mjs +1 -0
- package/dist/{repair-skills-Bv465NK-.mjs → repair-skills-DrDTStak.mjs} +3 -3
- package/dist/server-lock-8Lv6A-Xa-C35kJqNB.mjs +1 -0
- package/dist/{server-lock-CN2YHwpP-COM23IWb.mjs → server-lock-CN2YHwpP-aP9IA5H6.mjs} +4 -4
- package/dist/{sqlite3-56UMWEY3-B4_LAdBq.mjs → sqlite3-56UMWEY3-DA8bw7DG.mjs} +1 -1
- package/dist/src-DYiP4t4O.mjs +3 -0
- package/dist/start-B4FrQZ1j.mjs +1 -0
- package/dist/{start-BWbQNwyA.mjs → start-n0uv2kHZ.mjs} +2 -2
- package/dist/{tar-ANUBEFJY-GYQ0YvKO.mjs → tar-ANUBEFJY-DCUS8bvA.mjs} +1 -1
- package/dist/{write-project-skill-TvNCLXKO.mjs → write-project-skill-DzjgQ8XK.mjs} +3 -3
- package/package.json +5 -2
- package/dist/build-CCDQyip-.mjs +0 -1
- package/dist/constants-Dq9LTiaY.mjs +0 -2
- package/dist/dist-Ca3Ag5Ao.mjs +0 -1
- package/dist/init-9Ig7fBo7.mjs +0 -1
- package/dist/init-DVOjTbN9.mjs +0 -305
- package/dist/loader-Das6LZnS.mjs +0 -1
- package/dist/preview-3v1Isz0o.mjs +0 -3
- package/dist/preview-BXCFehx6.mjs +0 -1
- package/dist/public/assets/SettingsDialogBody-v_uU85KY.js +0 -7
- package/dist/repair-skills-D1vWIYJn.mjs +0 -1
- package/dist/server-lock-8Lv6A-Xa-iDqi_bbE.mjs +0 -1
- package/dist/src-B_8kBsEY.mjs +0 -3
- package/dist/start-DJNM84PI.mjs +0 -1
|
@@ -388,7 +388,7 @@ Library.
|
|
|
388
388
|
|
|
389
389
|
## Apache License, Version 2.0
|
|
390
390
|
|
|
391
|
-
|
|
391
|
+
The packages and vendored source in this section are licensed under the Apache License, Version 2.0. The full text of the license is reproduced once below and applies to every entry; per-package `NOTICE` file content is reproduced inline with each entry.
|
|
392
392
|
|
|
393
393
|
```
|
|
394
394
|
Apache License
|
|
@@ -902,6 +902,66 @@ Homepage: https://github.com/mikeal/tunnel-agent
|
|
|
902
902
|
|
|
903
903
|
_(LICENSE template present but no copyright line filled in; refer to the package source for canonical attribution.)_
|
|
904
904
|
|
|
905
|
+
### OpenAI Codex (vendored into `packages/native-config`)
|
|
906
|
+
Homepage: https://github.com/openai/codex
|
|
907
|
+
|
|
908
|
+
Copyright 2025 OpenAI
|
|
909
|
+
|
|
910
|
+
The native harness-config addon contains Rust code derived from OpenAI Codex's `toml_edit`-based config-edit implementation, adapted to an insert-only single-entry upsert. The Apache License, Version 2.0 reproduced above applies. Derived files and their upstream origins:
|
|
911
|
+
|
|
912
|
+
- `src/document_helpers.rs` — from `codex-rs/core/src/config/edit/document_helpers.rs`
|
|
913
|
+
- `src/mcp_edit.rs` — adapted from `codex-rs/core/src/config/edit.rs` (insert-only, not `replace_mcp_servers`)
|
|
914
|
+
- `src/path_resolve.rs` — from `codex-rs/utils/path-utils/src/lib.rs`
|
|
915
|
+
- `src/mcp_edit_conformance_tests.rs` — ported from `codex-rs/core/src/config/edit_tests.rs`
|
|
916
|
+
|
|
917
|
+
NOTICE:
|
|
918
|
+
|
|
919
|
+
```
|
|
920
|
+
OpenAI Codex
|
|
921
|
+
Copyright 2025 OpenAI
|
|
922
|
+
```
|
|
923
|
+
|
|
924
|
+
---
|
|
925
|
+
|
|
926
|
+
## Bundled Rust crates (native-config addon)
|
|
927
|
+
|
|
928
|
+
The native harness-config addon's `.node` binaries statically link the Rust crates below. Each is redistributed under the license shown; every license here is MIT, Apache-2.0, or ISC, whose full texts are reproduced elsewhere in this document (for dual- or multi-licensed crates OpenKnowledge elects a reproduced license). Compile-time-only crates (proc-macros, build scripts) and test-only dev-dependencies are not listed — their code is not present in the distributed binary. Versions track `packages/native-config/Cargo.lock`.
|
|
929
|
+
|
|
930
|
+
- `bitflags@2.13.0` — MIT OR Apache-2.0 — https://github.com/bitflags/bitflags
|
|
931
|
+
- `cfg-if@1.0.4` — MIT OR Apache-2.0 — https://github.com/rust-lang/cfg-if
|
|
932
|
+
- `ctor@1.0.7` — Apache-2.0 OR MIT — https://github.com/mmastrac/linktime
|
|
933
|
+
- `equivalent@1.0.2` — Apache-2.0 OR MIT — https://github.com/indexmap-rs/equivalent
|
|
934
|
+
- `futures@0.3.32` — MIT OR Apache-2.0 — https://github.com/rust-lang/futures-rs
|
|
935
|
+
- `futures-channel@0.3.32` — MIT OR Apache-2.0 — https://github.com/rust-lang/futures-rs
|
|
936
|
+
- `futures-core@0.3.32` — MIT OR Apache-2.0 — https://github.com/rust-lang/futures-rs
|
|
937
|
+
- `futures-executor@0.3.32` — MIT OR Apache-2.0 — https://github.com/rust-lang/futures-rs
|
|
938
|
+
- `futures-io@0.3.32` — MIT OR Apache-2.0 — https://github.com/rust-lang/futures-rs
|
|
939
|
+
- `futures-sink@0.3.32` — MIT OR Apache-2.0 — https://github.com/rust-lang/futures-rs
|
|
940
|
+
- `futures-task@0.3.32` — MIT OR Apache-2.0 — https://github.com/rust-lang/futures-rs
|
|
941
|
+
- `futures-util@0.3.32` — MIT OR Apache-2.0 — https://github.com/rust-lang/futures-rs
|
|
942
|
+
- `hashbrown@0.17.1` — MIT OR Apache-2.0 — https://github.com/rust-lang/hashbrown
|
|
943
|
+
- `indexmap@2.14.0` — Apache-2.0 OR MIT — https://github.com/indexmap-rs/indexmap
|
|
944
|
+
- `itoa@1.0.18` — MIT OR Apache-2.0 — https://github.com/dtolnay/itoa
|
|
945
|
+
- `libloading@0.9.0` — ISC — https://github.com/nagisa/rust_libloading
|
|
946
|
+
- `memchr@2.8.2` — Unlicense OR MIT — https://github.com/BurntSushi/memchr
|
|
947
|
+
- `napi@3.9.4` — MIT — https://github.com/napi-rs/napi-rs
|
|
948
|
+
- `napi-sys@3.2.2` — MIT — https://github.com/napi-rs/napi-rs
|
|
949
|
+
- `nohash-hasher@0.2.0` — Apache-2.0 OR MIT — https://github.com/paritytech/nohash-hasher
|
|
950
|
+
- `pin-project-lite@0.2.17` — Apache-2.0 OR MIT — https://github.com/taiki-e/pin-project-lite
|
|
951
|
+
- `rustc-hash@2.1.2` — Apache-2.0 OR MIT — https://github.com/rust-lang/rustc-hash
|
|
952
|
+
- `serde@1.0.228` — MIT OR Apache-2.0 — https://github.com/serde-rs/serde
|
|
953
|
+
- `serde_core@1.0.228` — MIT OR Apache-2.0 — https://github.com/serde-rs/serde
|
|
954
|
+
- `serde_json@1.0.150` — MIT OR Apache-2.0 — https://github.com/serde-rs/json
|
|
955
|
+
- `slab@0.4.12` — MIT — https://github.com/tokio-rs/slab
|
|
956
|
+
- `toml_datetime@0.7.5+spec-1.1.0` — MIT OR Apache-2.0 — https://github.com/toml-rs/toml
|
|
957
|
+
- `toml_edit@0.24.1+spec-1.1.0` — MIT OR Apache-2.0 — https://github.com/toml-rs/toml
|
|
958
|
+
- `toml_parser@1.1.2+spec-1.1.0` — MIT OR Apache-2.0 — https://github.com/toml-rs/toml
|
|
959
|
+
- `toml_writer@1.1.1+spec-1.1.0` — MIT OR Apache-2.0 — https://github.com/toml-rs/toml
|
|
960
|
+
- `windows-link@0.2.1` — MIT OR Apache-2.0 — https://github.com/microsoft/windows-rs
|
|
961
|
+
- `winnow@0.7.15` — MIT — https://github.com/winnow-rs/winnow
|
|
962
|
+
- `winnow@1.0.3` — MIT — https://github.com/winnow-rs/winnow
|
|
963
|
+
- `zmij@1.0.21` — MIT — https://github.com/dtolnay/zmij
|
|
964
|
+
|
|
905
965
|
---
|
|
906
966
|
|
|
907
967
|
## MIT License
|
|
@@ -1245,7 +1305,7 @@ Homepage: https://github.com/honojs/node-server
|
|
|
1245
1305
|
|
|
1246
1306
|
Copyright (c) 2022 - present, Yusuke Wada and Hono contributors
|
|
1247
1307
|
|
|
1248
|
-
### `@hookform/resolvers@5.
|
|
1308
|
+
### `@hookform/resolvers@5.4.0`
|
|
1249
1309
|
Homepage: https://react-hook-form.com
|
|
1250
1310
|
|
|
1251
1311
|
Copyright (c) 2019-present Beier(Bill) Luo
|
|
@@ -1260,12 +1320,7 @@ Homepage: https://iconify.design/docs/libraries/utils/
|
|
|
1260
1320
|
|
|
1261
1321
|
Copyright (c) 2021-PRESENT Vjacheslav Trushkin
|
|
1262
1322
|
|
|
1263
|
-
### `@inquirer/ansi@2.0.
|
|
1264
|
-
Homepage: https://github.com/SBoudrias/Inquirer.js/blob/main/packages/ansi/README.md
|
|
1265
|
-
|
|
1266
|
-
Copyright (c) 2025 Simon Boudrias
|
|
1267
|
-
|
|
1268
|
-
### `@inquirer/ansi@2.0.6`
|
|
1323
|
+
### `@inquirer/ansi@2.0.7`
|
|
1269
1324
|
Homepage: https://github.com/SBoudrias/Inquirer.js/blob/main/packages/ansi/README.md
|
|
1270
1325
|
|
|
1271
1326
|
Copyright (c) 2025 Simon Boudrias
|
|
@@ -1275,7 +1330,7 @@ Homepage: https://github.com/SBoudrias/Inquirer.js/blob/main/packages/ansi/READM
|
|
|
1275
1330
|
|
|
1276
1331
|
Copyright (c) 2025 Simon Boudrias
|
|
1277
1332
|
|
|
1278
|
-
### `@inquirer/checkbox@5.1
|
|
1333
|
+
### `@inquirer/checkbox@5.2.1`
|
|
1279
1334
|
Homepage: https://github.com/SBoudrias/Inquirer.js/blob/main/packages/checkbox/README.md
|
|
1280
1335
|
|
|
1281
1336
|
Copyright (c) 2025 Simon Boudrias
|
|
@@ -1285,17 +1340,7 @@ Homepage: https://github.com/SBoudrias/Inquirer.js/blob/main/packages/confirm/RE
|
|
|
1285
1340
|
|
|
1286
1341
|
Copyright (c) 2025 Simon Boudrias
|
|
1287
1342
|
|
|
1288
|
-
### `@inquirer/core@11.1
|
|
1289
|
-
Homepage: https://github.com/SBoudrias/Inquirer.js/blob/main/packages/core/README.md
|
|
1290
|
-
|
|
1291
|
-
Copyright (c) 2025 Simon Boudrias
|
|
1292
|
-
|
|
1293
|
-
### `@inquirer/core@11.1.8`
|
|
1294
|
-
Homepage: https://github.com/SBoudrias/Inquirer.js/blob/main/packages/core/README.md
|
|
1295
|
-
|
|
1296
|
-
Copyright (c) 2025 Simon Boudrias
|
|
1297
|
-
|
|
1298
|
-
### `@inquirer/core@11.2.0`
|
|
1343
|
+
### `@inquirer/core@11.2.1`
|
|
1299
1344
|
Homepage: https://github.com/SBoudrias/Inquirer.js/blob/main/packages/core/README.md
|
|
1300
1345
|
|
|
1301
1346
|
Copyright (c) 2025 Simon Boudrias
|
|
@@ -1305,12 +1350,7 @@ Homepage: https://github.com/SBoudrias/Inquirer.js/blob/main/packages/core/READM
|
|
|
1305
1350
|
|
|
1306
1351
|
Copyright (c) 2025 Simon Boudrias
|
|
1307
1352
|
|
|
1308
|
-
### `@inquirer/figures@2.0.
|
|
1309
|
-
Homepage: https://github.com/SBoudrias/Inquirer.js
|
|
1310
|
-
|
|
1311
|
-
Copyright (c) 2025 Simon Boudrias
|
|
1312
|
-
|
|
1313
|
-
### `@inquirer/figures@2.0.6`
|
|
1353
|
+
### `@inquirer/figures@2.0.7`
|
|
1314
1354
|
Homepage: https://github.com/SBoudrias/Inquirer.js
|
|
1315
1355
|
|
|
1316
1356
|
Copyright (c) 2025 Simon Boudrias
|
|
@@ -1320,22 +1360,17 @@ Homepage: https://github.com/SBoudrias/Inquirer.js
|
|
|
1320
1360
|
|
|
1321
1361
|
Copyright (c) 2025 Simon Boudrias
|
|
1322
1362
|
|
|
1323
|
-
### `@inquirer/password@5.
|
|
1363
|
+
### `@inquirer/password@5.1.1`
|
|
1324
1364
|
Homepage: https://github.com/SBoudrias/Inquirer.js/blob/main/packages/password/README.md
|
|
1325
1365
|
|
|
1326
1366
|
Copyright (c) 2025 Simon Boudrias
|
|
1327
1367
|
|
|
1328
|
-
### `@inquirer/select@5.2.
|
|
1368
|
+
### `@inquirer/select@5.2.1`
|
|
1329
1369
|
Homepage: https://github.com/SBoudrias/Inquirer.js/blob/main/packages/select/README.md
|
|
1330
1370
|
|
|
1331
1371
|
Copyright (c) 2025 Simon Boudrias
|
|
1332
1372
|
|
|
1333
|
-
### `@inquirer/type@4.0.
|
|
1334
|
-
Homepage: https://github.com/SBoudrias/Inquirer.js
|
|
1335
|
-
|
|
1336
|
-
Copyright (c) 2025 Simon Boudrias
|
|
1337
|
-
|
|
1338
|
-
### `@inquirer/type@4.0.6`
|
|
1373
|
+
### `@inquirer/type@4.0.7`
|
|
1339
1374
|
Homepage: https://github.com/SBoudrias/Inquirer.js
|
|
1340
1375
|
|
|
1341
1376
|
Copyright (c) 2025 Simon Boudrias
|
|
@@ -3844,6 +3879,11 @@ Homepage: http://json5.org/
|
|
|
3844
3879
|
|
|
3845
3880
|
Copyright (c) 2012-2018 Aseem Kishore, and [others].
|
|
3846
3881
|
|
|
3882
|
+
### `jsonc-parser@3.3.1`
|
|
3883
|
+
Homepage: https://github.com/microsoft/node-jsonc-parser
|
|
3884
|
+
|
|
3885
|
+
Copyright (c) Microsoft
|
|
3886
|
+
|
|
3847
3887
|
### `jsonfile@6.2.0`
|
|
3848
3888
|
Homepage: https://github.com/jprichardson/node-jsonfile
|
|
3849
3889
|
|
|
@@ -4880,7 +4920,7 @@ Homepage: https://github.com/vasturiano/react-force-graph
|
|
|
4880
4920
|
|
|
4881
4921
|
_(No LICENSE file in package; SPDX identifier in `package.json` is the sole declared grant.)_
|
|
4882
4922
|
|
|
4883
|
-
### `react-hook-form@7.
|
|
4923
|
+
### `react-hook-form@7.80.0`
|
|
4884
4924
|
Homepage: https://react-hook-form.com
|
|
4885
4925
|
|
|
4886
4926
|
Copyright (c) 2019-present Beier(Bill) Luo
|
|
@@ -5988,11 +6028,6 @@ Homepage: https://github.com/npm/mute-stream
|
|
|
5988
6028
|
|
|
5989
6029
|
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
5990
6030
|
|
|
5991
|
-
### `mute-stream@4.0.0`
|
|
5992
|
-
Homepage: https://github.com/npm/mute-stream
|
|
5993
|
-
|
|
5994
|
-
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
5995
|
-
|
|
5996
6031
|
### `mute-stream@2.0.0`
|
|
5997
6032
|
Homepage: https://github.com/npm/mute-stream
|
|
5998
6033
|
|
|
@@ -6008,6 +6043,11 @@ Homepage: https://github.com/alexeyraspopov/picocolors
|
|
|
6008
6043
|
|
|
6009
6044
|
Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov
|
|
6010
6045
|
|
|
6046
|
+
### `semver@7.8.5`
|
|
6047
|
+
Homepage: https://github.com/npm/node-semver
|
|
6048
|
+
|
|
6049
|
+
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
6050
|
+
|
|
6011
6051
|
### `semver@7.7.4`
|
|
6012
6052
|
Homepage: https://github.com/npm/node-semver
|
|
6013
6053
|
|
|
@@ -3,7 +3,7 @@ name: open-knowledge-discovery
|
|
|
3
3
|
description: "Read when the user asks what OpenKnowledge is, wants to install it on a repository, wants to share an OpenKnowledge project with collaborators, or asks how `ok init` / `ok cowork` / OK Desktop set up a project. Do NOT load to perform OpenKnowledge reads/writes — the runtime guidance for editing markdown inside an initialized OK project ships as a separate project-local skill at `.claude/skills/open-knowledge/` whenever `ok init` runs. If the user appears to be editing markdown inside a `.ok/` project and this is the only OK skill loaded, advise them to re-run `ok init` to install the project-local skill."
|
|
4
4
|
compatibility: "Any agent host — no MCP server required. Pure discovery + install guidance."
|
|
5
5
|
metadata:
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.21.0-beta.0"
|
|
7
7
|
author: "Inkeep"
|
|
8
8
|
repository: "https://github.com/inkeep/open-knowledge"
|
|
9
9
|
---
|
|
@@ -3,7 +3,7 @@ name: open-knowledge
|
|
|
3
3
|
description: "Authoritative agent-runtime contract for working inside an OpenKnowledge project — a markdown-CRDT knowledge base exposed over MCP. Use whenever reading, listing, searching, or editing any `.md` or `.mdx` file in the project, and before any `mcp__open-knowledge__*` tool call (`exec`, `search`, `write`, `edit`, and the rest). Installed by `ok init`, so its presence means this is an OpenKnowledge project and it governs every markdown file here. Covers the read/write tool surface, grounding and linking rules, folder/template conventions, the live browser preview, and the rule that OK's MCP tools — never native file tools — handle in-scope markdown."
|
|
4
4
|
compatibility: "Claude Code, Claude Desktop, Claude Cowork, Claude.ai web. Requires OpenKnowledge MCP server + code execution."
|
|
5
5
|
metadata:
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.21.0-beta.0"
|
|
7
7
|
author: "Inkeep"
|
|
8
8
|
repository: "https://github.com/inkeep/open-knowledge"
|
|
9
9
|
---
|
|
@@ -19,7 +19,7 @@ OpenKnowledge (OK) is a markdown-CRDT collaboration platform exposed via MCP. Th
|
|
|
19
19
|
|
|
20
20
|
1. **Reads:** `exec("cat …")` for one doc, `exec("ls -A …")` for a directory (folder defaults + template menu), `exec("grep …")` for literal, `search` for ranked retrieval. Native `Read` / `Grep` only on source code (`.ts` / `.py` / …), never on in-scope `.md` / `.mdx`.
|
|
21
21
|
2. **Writes:** `write({ document: { path, content } })` for a new or full-replace doc; `edit({ document: { path, find, replace } })` for a body find/replace; `edit({ document: { path, frontmatter } })` for a frontmatter merge-patch (`null` deletes a key). `delete({ document })` removes, `move({ from, to })` moves/renames. Body find/replace is body-only. Pass a one-line `summary` (≤80 chars, user-facing outcome) on every content write.
|
|
22
|
-
3. **Preview
|
|
22
|
+
3. **Preview / open a doc — determine your ONE surface FIRST (once per session).** Before opening anything, pick where to focus, stop at first match: **`OK_DESKTOP_TERMINAL` set** (check your env — `echo "$OK_DESKTOP_TERMINAL"`) → OK Desktop's own terminal → `ok open <name>` (switches this window) · have `preview_*` → Claude Code Desktop pane · have a URL-navigation/browser tool → Cursor/Codex → `preview_url` then navigate it · else plain CLI → `ok open <name>`. `ok open <name>` opens a **doc or folder** (auto-detected — no `--folder`); add `--skill <name>` for a skill. The `previewUrl` field is a route id, **not** your open mechanism — don't hand it to a browser just because you saw it. Don't `preview_screenshot` to confirm edits. Full Step-0 procedure + per-surface how-to: `references/preview.md`.
|
|
23
23
|
4. **Workflow guides:** `workflow({ kind: 'ingest' | 'research' | 'consolidate' | 'discover' })` returns a procedural guide, not data. Use it when the work fits the layer.
|
|
24
24
|
5. **Direct questions:** a plain business question ("which customers…", "what did we decide about…") routes to `search` / `exec` + a cited chat answer — no "research" keyword needed. Persist only when durable + multi-doc + not already covered, and *offer* first. See `references/corpus-qa.md`.
|
|
25
25
|
6. **Authoring or improving a skill** ("write/make a skill", "improve this skill", "turn this into a skill"): STOP and invoke the **`open-knowledge-write-skill`** skill — it owns scope choice (project vs global), the SKILL.md contract, evaluation, and install; don't improvise from this skill. Author through the `skill` target (`write({ skill })`), never a raw `.ok/skills/…` document. **Never read, diff, or edit the installed projections under `.claude/skills/` · `.cursor/skills/` · `.codex/skills/` · `.opencode/skills/` · `.agents/skills/`** — `install` generates them and overwrites them on the next sync; they are NOT source of truth.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
| Wait for the server to tell you to open preview | Skip the session-start preview open and wait for the `attach-preview-once` hint | Open the preview browser at session start; the hint is a fallback when you didn't |
|
|
15
15
|
| Ignore the attach hint | Skip the `warning: { action: "attach-preview-once" }` hint in write-tool responses | Open the preview when the hint fires (`preview_start`, or `preview_url`); otherwise do nothing |
|
|
16
16
|
| Make the Claude Code Desktop preview work | Read / diagnose / edit `.claude/launch.json` (host-managed config) | Call `preview_start("open-knowledge-ui")` and nothing else; the OK lock-collision proxy bridges any port mismatch transparently |
|
|
17
|
-
| Open a doc in the app from
|
|
17
|
+
| Open a doc/folder/skill in the app from a CLI | Print the `previewUrl` / `openknowledge://` string for the user to click | Run `ok open <name>` (doc or folder, auto-detected; `--skill <name>` for a skill) — deep-links into OK Desktop, browser fallback |
|
|
18
18
|
| Reference another doc | `` `[text](./page.md)` `` (backticked) or HTML `<a>` | `[text](./page.md)` (raw markdown) |
|
|
19
19
|
| Embed an image | `<img src="...">` (HTML), a `localhost:<port>` / `preview_url` server URL, or hot-linked external URL | Fetch + save locally + doc-relative `` |
|
|
20
20
|
| Write a factual claim in a KB doc | plausible prose without citation, OR inline `[source](https://URL)` | `ingest` the source first, then cite the local path per Grounding |
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# Preview — full multi-host contract
|
|
2
2
|
|
|
3
3
|
## Contents
|
|
4
|
+
- **Step 0 — determine your ONE focus surface before opening anything (the load-bearing check)**
|
|
4
5
|
- Re-navigation and end-of-turn discipline
|
|
5
6
|
- `previewUrl` is a route, not a URL
|
|
6
7
|
- The three first-class apps (Claude Code Desktop, Cursor, Codex desktop)
|
|
7
|
-
- Claude Code CLI
|
|
8
|
+
- Any-CLI track — Claude Code / Codex / Cursor CLI / OpenCode, no browser → `ok open`
|
|
8
9
|
- Four attach signals
|
|
9
10
|
- `previewUrl: null` semantics, server lifecycle, read-only mirror, no-screenshots
|
|
10
11
|
|
|
@@ -16,7 +17,18 @@ The user watches your edits land in a live browser preview. Open it once at sess
|
|
|
16
17
|
|
|
17
18
|
**`previewUrl` is a route, not a URL to open.** Every read response (per-doc, on `exec` / `search` / `links` rows) and every write response carries a `previewUrl` — a route fragment like `/#/specs/foo/SPEC`, with **no scheme, host, or port**. It identifies *which doc* to preview, not a URL to hand a browser by itself. Never construct or guess preview URLs.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
### Step 0 — figure out your ONE focus surface BEFORE you open anything
|
|
21
|
+
|
|
22
|
+
Your host doesn't change mid-session, so determine this **once**, the first time you're asked to open/show/preview a doc, and use that one surface for the rest of the session. Run the checks **top-to-bottom and stop at the first match** — earlier rungs win:
|
|
23
|
+
|
|
24
|
+
1. **Is `OK_DESKTOP_TERMINAL` set in your environment?** You're a shell agent — actually check it (`echo "$OK_DESKTOP_TERMINAL"`, or read your env), don't assume. **Set → you're inside the OK Desktop app's own terminal.** Open a doc or folder with `ok open <name>` (auto-detected; `--skill <name>` for a skill) — it switches THIS window to the target. **Never resolve a preview URL here.** (This rung is the one agents miss most — check the env first, before anything else.)
|
|
25
|
+
2. **Do you have `preview_*` tools** (`preview_start` / `preview_eval`)? → **Claude Code Desktop** → drive its pane (rung details below).
|
|
26
|
+
3. **Do you have any URL-navigation / in-app browser tool** (Cursor `Navigate`, Codex `@Browser`, or `browser` / `open_url` / `view_url` / …)? → **Cursor / Codex desktop** → `preview_url` once, then navigate that browser to the `url`.
|
|
27
|
+
4. **None of the above** → you're a **plain CLI** (Claude Code CLI, Codex CLI, Cursor CLI, OpenCode, any shell agent) → `ok open <name>` for a doc or folder (auto-detected; `--skill <name>` for a skill); deep-links a separate OK Desktop window, system browser only if no desktop.
|
|
28
|
+
|
|
29
|
+
Decide once; then every "open / show / preview this doc" this session uses that surface's mechanism. **The `previewUrl` field in tool responses is a route id, not your open mechanism** — seeing it is not a reason to hand it to a browser. The rest of this section is the per-surface "how" for whichever rung you landed on.
|
|
30
|
+
|
|
31
|
+
**OK ships first-class preview support for three apps — Claude Code Desktop, Cursor, and the Codex desktop app — plus any CLI (Claude Code CLI, Codex CLI, Cursor CLI, OpenCode, …) on a separate `ok open` track (below). Make the preview seamless in each.** Match on the tool you actually have (capability, not host name): if a tool can navigate to a URL, it counts as an in-app browser; if nothing can, you're a CLI → `ok open`. The three apps map to:
|
|
20
32
|
|
|
21
33
|
- **Claude Code Desktop — you have `preview_*` tools** (e.g. `preview_start` + `preview_eval`) → **First open of the session:** to land directly on a doc, arm it first with `preview_url({ armPaneTarget: true, document })` (or `folder`), then `preview_start("open-knowledge-ui")` — `ok ui` redirects the base-open straight to the armed route, so the pane opens on the doc, not root. Plain `preview_start` (no arm) opens at root. **Moving between docs once the pane is open: do it in one `preview_eval` step — set `window.location.hash` to the target's route fragment from the response `previewUrl`, the part from `#` on (e.g. `window.location.hash = '#/specs/foo/SPEC'`).** That drives the SPA router directly. Arm + `preview_start` only redirects a *fresh* open; it can't move an already-open pane (`preview_start` reuses the live process without reloading), so use `preview_eval` there. Don't read or edit `.claude/launch.json` — host-managed; the OK lock-collision proxy handles the UI-already-running case. If `preview_start` fails, report it; don't "fix" `launch.json`.
|
|
22
34
|
- **Cursor / Codex desktop — no `preview_*` tool, but you have an in-app / built-in browser tool** → call `preview_url` once for the **exact** target (`document` for a doc, `folder` for a folder) and navigate your **in-app browser** straight to the returned `url`. Open that deep URL directly — never the root then navigate; omit both args only for the root. Drive the tool your host gives you:
|
|
@@ -25,7 +37,13 @@ The user watches your edits land in a live browser preview. Open it once at sess
|
|
|
25
37
|
- **Any other host** with a URL-navigation tool (`browser`, `view_url`, `open_url`, `web.browse`, …) → navigate it to the `url`. **This is also the fallback when a named tool above isn't present under that exact name** (hosts rename tools): match on the capability, not the name. If no URL-navigation tool exists at all, drop to the Claude Code CLI track below.
|
|
26
38
|
- **Honor `autoOpen`** (on `preview_url`, or on `warning` for write tools). If `false`, do not open or refresh any preview UI; surface the URL only if asked.
|
|
27
39
|
|
|
28
|
-
**
|
|
40
|
+
**Any CLI — a separate track (no browser).** **Claude Code CLI, Codex CLI, Cursor CLI, OpenCode — any pure-stdio / shell agent with no in-app browser tool — uses `ok open`, never a preview URL.** The rule is capability, not vendor: no tool that navigates a URL → you're on this track.
|
|
41
|
+
|
|
42
|
+
- **`ok open <name>`** — opens a **doc or folder** in the OK Desktop app. The type is auto-detected (a directory on disk → folder, otherwise a doc), so **`--folder` is not needed** (it stays only as an explicit override for a folder that doesn't exist on disk yet). An action you run, not a URL to print.
|
|
43
|
+
- **`ok open <skill-name> --skill [--scope project|global]`** — opens a **skill** in the skill editor (skills are addressed by name + scope, not a content path, so they need the flag).
|
|
44
|
+
- All three deep-link into OK Desktop when a bundle is installed, and fall back to the browser UI (`ok ui`) otherwise. No `ok` on PATH or no shell → `preview_url`, then `open <url>` in the system browser as a last resort, and say so plainly. The system browser is the fallback, never the default.
|
|
45
|
+
|
|
46
|
+
(The same vendors' *desktop apps* with a built-in browser — Cursor, Codex desktop — are NOT here; they navigate their own browser per the in-app branch above. Codex **IDE extension** / **Cloud** are web-search-only → they're on this CLI track too.) **Running inside the OK Desktop built-in terminal (the `OK_DESKTOP_TERMINAL` env var is set)? Same track — `ok open <name>` re-targets the window you're already in** (switches that window to the doc/folder; no second window, no need to raise it since it's already frontmost). Don't resolve preview URLs in that case; `ok open` is the whole answer.
|
|
29
47
|
|
|
30
48
|
**Opening or reading a file IS a preview navigation.** On any "open `<file>`" / "read `<file>`" request, navigate the browser to that doc's `previewUrl` route from the tool response — not a separate fetch, not a fresh system-browser launch.
|
|
31
49
|
|
|
@@ -3,7 +3,7 @@ name: open-knowledge-write-skill
|
|
|
3
3
|
description: "Use when the user wants to create, author, write, or design a new Agent Skill (a SKILL.md) — for OpenKnowledge or for their editors — including requests like 'help me write a skill', 'make a skill that…', 'turn this workflow into a skill', or improving an existing skill's triggering and discipline. Also use when capturing reusable agent guidance that should live as an installable skill rather than a one-off prompt. Covers choosing scope (project vs global), the SKILL.md frontmatter contract, progressive-disclosure structure, evaluating the skill, and installing it into the user's editors."
|
|
4
4
|
compatibility: "OpenKnowledge project recommended (uses the `write` / `edit` / `install` MCP verbs). Authoring + validation are pure file ops; live preview + eval want a running server (`ok start`)."
|
|
5
5
|
metadata:
|
|
6
|
-
version: "0.20.
|
|
6
|
+
version: "0.20.1"
|
|
7
7
|
author: "Inkeep"
|
|
8
8
|
repository: "https://github.com/inkeep/open-knowledge"
|
|
9
9
|
---
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as e from"node:fs";import{join as t,normalize as n,resolve as r,sep as i}from"node:path";import{readdirSync as a,statSync as o}from"fs";import{join as s,resolve as c}from"path";import*as l from"node:querystring";const u={"3g2":`video/3gpp2`,"3gp":`video/3gpp`,"3gpp":`video/3gpp`,"3mf":`model/3mf`,aac:`audio/aac`,ac:`application/pkix-attr-cert`,adp:`audio/adpcm`,adts:`audio/aac`,ai:`application/postscript`,aml:`application/automationml-aml+xml`,amlx:`application/automationml-amlx+zip`,amr:`audio/amr`,apng:`image/apng`,appcache:`text/cache-manifest`,appinstaller:`application/appinstaller`,appx:`application/appx`,appxbundle:`application/appxbundle`,asc:`application/pgp-keys`,atom:`application/atom+xml`,atomcat:`application/atomcat+xml`,atomdeleted:`application/atomdeleted+xml`,atomsvc:`application/atomsvc+xml`,au:`audio/basic`,avci:`image/avci`,avcs:`image/avcs`,avif:`image/avif`,aw:`application/applixware`,bdoc:`application/bdoc`,bin:`application/octet-stream`,bmp:`image/bmp`,bpk:`application/octet-stream`,btf:`image/prs.btif`,btif:`image/prs.btif`,buffer:`application/octet-stream`,ccxml:`application/ccxml+xml`,cdfx:`application/cdfx+xml`,cdmia:`application/cdmi-capability`,cdmic:`application/cdmi-container`,cdmid:`application/cdmi-domain`,cdmio:`application/cdmi-object`,cdmiq:`application/cdmi-queue`,cer:`application/pkix-cert`,cgm:`image/cgm`,cjs:`application/node`,class:`application/java-vm`,coffee:`text/coffeescript`,conf:`text/plain`,cpl:`application/cpl+xml`,cpt:`application/mac-compactpro`,crl:`application/pkix-crl`,css:`text/css`,csv:`text/csv`,cu:`application/cu-seeme`,cwl:`application/cwl`,cww:`application/prs.cww`,davmount:`application/davmount+xml`,dbk:`application/docbook+xml`,deb:`application/octet-stream`,def:`text/plain`,deploy:`application/octet-stream`,dib:`image/bmp`,"disposition-notification":`message/disposition-notification`,dist:`application/octet-stream`,distz:`application/octet-stream`,dll:`application/octet-stream`,dmg:`application/octet-stream`,dms:`application/octet-stream`,doc:`application/msword`,dot:`application/msword`,dpx:`image/dpx`,drle:`image/dicom-rle`,dsc:`text/prs.lines.tag`,dssc:`application/dssc+der`,dtd:`application/xml-dtd`,dump:`application/octet-stream`,dwd:`application/atsc-dwd+xml`,ear:`application/java-archive`,ecma:`application/ecmascript`,elc:`application/octet-stream`,emf:`image/emf`,eml:`message/rfc822`,emma:`application/emma+xml`,emotionml:`application/emotionml+xml`,eps:`application/postscript`,epub:`application/epub+zip`,exe:`application/octet-stream`,exi:`application/exi`,exp:`application/express`,exr:`image/aces`,ez:`application/andrew-inset`,fdf:`application/fdf`,fdt:`application/fdt+xml`,fits:`image/fits`,g3:`image/g3fax`,gbr:`application/rpki-ghostbusters`,geojson:`application/geo+json`,gif:`image/gif`,glb:`model/gltf-binary`,gltf:`model/gltf+json`,gml:`application/gml+xml`,gpx:`application/gpx+xml`,gram:`application/srgs`,grxml:`application/srgs+xml`,gxf:`application/gxf`,gz:`application/gzip`,h261:`video/h261`,h263:`video/h263`,h264:`video/h264`,heic:`image/heic`,heics:`image/heic-sequence`,heif:`image/heif`,heifs:`image/heif-sequence`,hej2:`image/hej2k`,held:`application/atsc-held+xml`,hjson:`application/hjson`,hlp:`application/winhlp`,hqx:`application/mac-binhex40`,hsj2:`image/hsj2`,htm:`text/html`,html:`text/html`,ics:`text/calendar`,ief:`image/ief`,ifb:`text/calendar`,iges:`model/iges`,igs:`model/iges`,img:`application/octet-stream`,in:`text/plain`,ini:`text/plain`,ink:`application/inkml+xml`,inkml:`application/inkml+xml`,ipfix:`application/ipfix`,iso:`application/octet-stream`,its:`application/its+xml`,jade:`text/jade`,jar:`application/java-archive`,jhc:`image/jphc`,jls:`image/jls`,jp2:`image/jp2`,jpe:`image/jpeg`,jpeg:`image/jpeg`,jpf:`image/jpx`,jpg:`image/jpeg`,jpg2:`image/jp2`,jpgm:`image/jpm`,jpgv:`video/jpeg`,jph:`image/jph`,jpm:`image/jpm`,jpx:`image/jpx`,js:`text/javascript`,json:`application/json`,json5:`application/json5`,jsonld:`application/ld+json`,jsonml:`application/jsonml+json`,jsx:`text/jsx`,jt:`model/jt`,jxl:`image/jxl`,jxr:`image/jxr`,jxra:`image/jxra`,jxrs:`image/jxrs`,jxs:`image/jxs`,jxsc:`image/jxsc`,jxsi:`image/jxsi`,jxss:`image/jxss`,kar:`audio/midi`,ktx:`image/ktx`,ktx2:`image/ktx2`,less:`text/less`,lgr:`application/lgr+xml`,list:`text/plain`,litcoffee:`text/coffeescript`,log:`text/plain`,lostxml:`application/lost+xml`,lrf:`application/octet-stream`,m1v:`video/mpeg`,m21:`application/mp21`,m2a:`audio/mpeg`,m2t:`video/mp2t`,m2ts:`video/mp2t`,m2v:`video/mpeg`,m3a:`audio/mpeg`,m4a:`audio/mp4`,m4p:`application/mp4`,m4s:`video/iso.segment`,ma:`application/mathematica`,mads:`application/mads+xml`,maei:`application/mmt-aei+xml`,man:`text/troff`,manifest:`text/cache-manifest`,map:`application/json`,mar:`application/octet-stream`,markdown:`text/markdown`,mathml:`application/mathml+xml`,mb:`application/mathematica`,mbox:`application/mbox`,md:`text/markdown`,mdx:`text/mdx`,me:`text/troff`,mesh:`model/mesh`,meta4:`application/metalink4+xml`,metalink:`application/metalink+xml`,mets:`application/mets+xml`,mft:`application/rpki-manifest`,mid:`audio/midi`,midi:`audio/midi`,mime:`message/rfc822`,mj2:`video/mj2`,mjp2:`video/mj2`,mjs:`text/javascript`,mml:`text/mathml`,mods:`application/mods+xml`,mov:`video/quicktime`,mp2:`audio/mpeg`,mp21:`application/mp21`,mp2a:`audio/mpeg`,mp3:`audio/mpeg`,mp4:`video/mp4`,mp4a:`audio/mp4`,mp4s:`application/mp4`,mp4v:`video/mp4`,mpd:`application/dash+xml`,mpe:`video/mpeg`,mpeg:`video/mpeg`,mpf:`application/media-policy-dataset+xml`,mpg:`video/mpeg`,mpg4:`video/mp4`,mpga:`audio/mpeg`,mpp:`application/dash-patch+xml`,mrc:`application/marc`,mrcx:`application/marcxml+xml`,ms:`text/troff`,mscml:`application/mediaservercontrol+xml`,msh:`model/mesh`,msi:`application/octet-stream`,msix:`application/msix`,msixbundle:`application/msixbundle`,msm:`application/octet-stream`,msp:`application/octet-stream`,mtl:`model/mtl`,mts:`video/mp2t`,musd:`application/mmt-usd+xml`,mxf:`application/mxf`,mxmf:`audio/mobile-xmf`,mxml:`application/xv+xml`,n3:`text/n3`,nb:`application/mathematica`,nq:`application/n-quads`,nt:`application/n-triples`,obj:`model/obj`,oda:`application/oda`,oga:`audio/ogg`,ogg:`audio/ogg`,ogv:`video/ogg`,ogx:`application/ogg`,omdoc:`application/omdoc+xml`,onepkg:`application/onenote`,onetmp:`application/onenote`,onetoc:`application/onenote`,onetoc2:`application/onenote`,opf:`application/oebps-package+xml`,opus:`audio/ogg`,otf:`font/otf`,owl:`application/rdf+xml`,oxps:`application/oxps`,p10:`application/pkcs10`,p7c:`application/pkcs7-mime`,p7m:`application/pkcs7-mime`,p7s:`application/pkcs7-signature`,p8:`application/pkcs8`,pdf:`application/pdf`,pfr:`application/font-tdpfr`,pgp:`application/pgp-encrypted`,pkg:`application/octet-stream`,pki:`application/pkixcmp`,pkipath:`application/pkix-pkipath`,pls:`application/pls+xml`,png:`image/png`,prc:`model/prc`,prf:`application/pics-rules`,provx:`application/provenance+xml`,ps:`application/postscript`,pskcxml:`application/pskc+xml`,pti:`image/prs.pti`,qt:`video/quicktime`,raml:`application/raml+yaml`,rapd:`application/route-apd+xml`,rdf:`application/rdf+xml`,relo:`application/p2p-overlay+xml`,rif:`application/reginfo+xml`,rl:`application/resource-lists+xml`,rld:`application/resource-lists-diff+xml`,rmi:`audio/midi`,rnc:`application/relax-ng-compact-syntax`,rng:`application/xml`,roa:`application/rpki-roa`,roff:`text/troff`,rq:`application/sparql-query`,rs:`application/rls-services+xml`,rsat:`application/atsc-rsat+xml`,rsd:`application/rsd+xml`,rsheet:`application/urc-ressheet+xml`,rss:`application/rss+xml`,rtf:`text/rtf`,rtx:`text/richtext`,rusd:`application/route-usd+xml`,s3m:`audio/s3m`,sbml:`application/sbml+xml`,scq:`application/scvp-cv-request`,scs:`application/scvp-cv-response`,sdp:`application/sdp`,senmlx:`application/senml+xml`,sensmlx:`application/sensml+xml`,ser:`application/java-serialized-object`,setpay:`application/set-payment-initiation`,setreg:`application/set-registration-initiation`,sgi:`image/sgi`,sgm:`text/sgml`,sgml:`text/sgml`,shex:`text/shex`,shf:`application/shf+xml`,shtml:`text/html`,sieve:`application/sieve`,sig:`application/pgp-signature`,sil:`audio/silk`,silo:`model/mesh`,siv:`application/sieve`,slim:`text/slim`,slm:`text/slim`,sls:`application/route-s-tsid+xml`,smi:`application/smil+xml`,smil:`application/smil+xml`,snd:`audio/basic`,so:`application/octet-stream`,spdx:`text/spdx`,spp:`application/scvp-vp-response`,spq:`application/scvp-vp-request`,spx:`audio/ogg`,sql:`application/sql`,sru:`application/sru+xml`,srx:`application/sparql-results+xml`,ssdl:`application/ssdl+xml`,ssml:`application/ssml+xml`,stk:`application/hyperstudio`,stl:`model/stl`,stpx:`model/step+xml`,stpxz:`model/step-xml+zip`,stpz:`model/step+zip`,styl:`text/stylus`,stylus:`text/stylus`,svg:`image/svg+xml`,svgz:`image/svg+xml`,swidtag:`application/swid+xml`,t:`text/troff`,t38:`image/t38`,td:`application/urc-targetdesc+xml`,tei:`application/tei+xml`,teicorpus:`application/tei+xml`,text:`text/plain`,tfi:`application/thraud+xml`,tfx:`image/tiff-fx`,tif:`image/tiff`,tiff:`image/tiff`,toml:`application/toml`,tr:`text/troff`,trig:`application/trig`,ts:`video/mp2t`,tsd:`application/timestamped-data`,tsv:`text/tab-separated-values`,ttc:`font/collection`,ttf:`font/ttf`,ttl:`text/turtle`,ttml:`application/ttml+xml`,txt:`text/plain`,u3d:`model/u3d`,u8dsn:`message/global-delivery-status`,u8hdr:`message/global-headers`,u8mdn:`message/global-disposition-notification`,u8msg:`message/global`,ubj:`application/ubjson`,uri:`text/uri-list`,uris:`text/uri-list`,urls:`text/uri-list`,vcard:`text/vcard`,vrml:`model/vrml`,vtt:`text/vtt`,vxml:`application/voicexml+xml`,war:`application/java-archive`,wasm:`application/wasm`,wav:`audio/wav`,weba:`audio/webm`,webm:`video/webm`,webmanifest:`application/manifest+json`,webp:`image/webp`,wgsl:`text/wgsl`,wgt:`application/widget`,wif:`application/watcherinfo+xml`,wmf:`image/wmf`,woff:`font/woff`,woff2:`font/woff2`,wrl:`model/vrml`,wsdl:`application/wsdl+xml`,wspolicy:`application/wspolicy+xml`,x3d:`model/x3d+xml`,x3db:`model/x3d+fastinfoset`,x3dbz:`model/x3d+binary`,x3dv:`model/x3d-vrml`,x3dvz:`model/x3d+vrml`,x3dz:`model/x3d+xml`,xaml:`application/xaml+xml`,xav:`application/xcap-att+xml`,xca:`application/xcap-caps+xml`,xcs:`application/calendar+xml`,xdf:`application/xcap-diff+xml`,xdssc:`application/dssc+xml`,xel:`application/xcap-el+xml`,xenc:`application/xenc+xml`,xer:`application/patch-ops-error+xml`,xfdf:`application/xfdf`,xht:`application/xhtml+xml`,xhtml:`application/xhtml+xml`,xhvml:`application/xv+xml`,xlf:`application/xliff+xml`,xm:`audio/xm`,xml:`text/xml`,xns:`application/xcap-ns+xml`,xop:`application/xop+xml`,xpl:`application/xproc+xml`,xsd:`application/xml`,xsf:`application/prs.xsf+xml`,xsl:`application/xml`,xslt:`application/xml`,xspf:`application/xspf+xml`,xvm:`application/xv+xml`,xvml:`application/xv+xml`,yaml:`text/yaml`,yang:`application/yang`,yin:`application/yin+xml`,yml:`text/yaml`,zip:`application/zip`};function d(e){let t=(``+e).trim().toLowerCase(),n=t.lastIndexOf(`.`);return u[~n?t.substring(++n):t]}function f(e,t,n=``){e=c(`.`,e);let r=a(e),i=0,l,u;for(;i<r.length;i++)l=s(e,r[i]),u=o(l),u.isDirectory()?f(l,t,s(n,r[i])):t(s(n,r[i]),l,u)}function p(e){let t=e.url;if(t==null)return;let n=e._parsedUrl;if(n&&n.raw===t)return n;let r=t,i=``,a,o;if(t.length>1){let e=t.indexOf(`#`,1);e!==-1&&(o=t.substring(e),r=t.substring(0,e)),e=r.indexOf(`?`,1),e!==-1&&(i=r.substring(e),r=r.substring(0,e),i.length>1&&(a=l.parse(i.substring(1))))}return e._parsedUrl={pathname:r,search:i,query:a,hash:o,raw:t}}const m=()=>{};function h(e,t){for(let n=0;n<t.length;n++)if(t[n].test(e))return!0}function g(e,t){let n=0,r,i=e.length-1;e.charCodeAt(i)===47&&(e=e.substring(0,i));let a=[],o=`${e}/index`;for(;n<t.length;n++)r=t[n]?`.${t[n]}`:``,e&&a.push(e+r),a.push(o+r);return a}function _(e,t,n){let r=0,i,a=g(t,n);for(;r<a.length;r++)if(i=e[a[r]])return i}function v(r,i,a,o){let s=0,c=g(a,o),l,u,d,f;for(;s<c.length;s++)if(l=n(t(r,d=c[s])),l.startsWith(r)&&e.existsSync(l)){if(u=e.statSync(l),u.isDirectory())continue;return f=S(d,u,i),f[`Cache-Control`]=i?`no-cache`:`no-store`,{abs:l,stats:u,headers:f}}}function y(e,t){return t.statusCode=404,t.end()}function b(t,n,r,i,a){let o=200,s,c={};a={...a};for(let e in a)s=n.getHeader(e),s&&(a[e]=s);if((s=n.getHeader(`content-type`))&&(a[`Content-Type`]=s),t.headers.range){o=206;let[e,r]=t.headers.range.replace(`bytes=`,``).split(`-`),s=c.end=parseInt(r,10)||i.size-1,l=c.start=parseInt(e,10)||0;if(s>=i.size&&(s=i.size-1),l>=i.size)return n.setHeader(`Content-Range`,`bytes */${i.size}`),n.statusCode=416,n.end();a[`Content-Range`]=`bytes ${l}-${s}/${i.size}`,a[`Content-Length`]=s-l+1,a[`Accept-Ranges`]=`bytes`}n.writeHead(o,a),e.createReadStream(r,c).pipe(n)}const x={".br":`br`,".gz":`gzip`};function S(e,t,n){let r=x[e.slice(-3)],i=d(e.slice(0,r&&-3))||``;i===`text/html`&&(i+=`;charset=utf-8`);let a={"Content-Length":t.size,"Content-Type":i,"Last-Modified":t.mtime.toUTCString()};return r&&(a[`Content-Encoding`]=r),n&&(a.ETag=`W/"${t.size}-${t.mtime.getTime()}"`),a}function C(e,t={}){e=r(e||`.`);let n=t.onNoMatch||y,a=t.setHeaders||m,o=t.extensions||[`html`,`htm`],s=t.gzip&&o.map(e=>`${e}.gz`).concat(`gz`),c=t.brotli&&o.map(e=>`${e}.br`).concat(`br`),l={},u=`/`,d=!!t.etag,g=!!t.single;if(typeof t.single==`string`){let e=t.single.lastIndexOf(`.`);u+=~e?t.single.substring(0,e):t.single}let x=[];t.ignores!==!1&&(x.push(/[/]([A-Za-z\s\d~$._-]+\.\w+){1,}$/),t.dotfiles?x.push(/\/\.\w/):x.push(/\/\.well-known/),[].concat(t.ignores||[]).forEach(e=>{x.push(new RegExp(e,`i`))}));let C=t.maxAge!=null&&`public,max-age=${t.maxAge}`;C&&t.immutable?C+=`,immutable`:C&&t.maxAge===0&&(C+=`,must-revalidate`),t.dev||f(e,(e,n,r)=>{if(!/\.well-known[\\+\/]/.test(e)&&!t.dotfiles&&/(^\.|[\\+|\/+]\.)/.test(e))return;let i=S(e,r,d);C&&(i[`Cache-Control`]=C),l[`/`+e.normalize().replace(/\\+/g,`/`)]={abs:n,stats:r,headers:i}});let w=t.dev?v.bind(0,e+i,d):_.bind(0,l);return function(e,t,r){let i=[``],l=p(e).pathname,f=e.headers[`accept-encoding`]||``;if(s&&f.includes(`gzip`)&&i.unshift(...s),c&&/(br|brotli)/i.test(f)&&i.unshift(...c),i.push(...o),l.indexOf(`%`)!==-1)try{l=decodeURI(l)}catch{}let m=w(l,i)||g&&!h(l,x)&&w(u,i);if(!m)return r?r():n(e,t);if(d&&e.headers[`if-none-match`]===m.headers.ETag)return t.writeHead(304),t.end();(s||c)&&t.setHeader(`Vary`,`Accept-Encoding`),a(t,l,m.stats),b(e,t,m.abs,m.stats,m.headers)}}export{u as n,C as t};
|
|
2
|
-
//# sourceMappingURL=build-
|
|
1
|
+
import{join as e,normalize as t,resolve as n,sep as r}from"node:path";import*as i from"node:fs";import{readdirSync as a,statSync as o}from"fs";import{join as s,resolve as c}from"path";import*as l from"node:querystring";const u={"3g2":`video/3gpp2`,"3gp":`video/3gpp`,"3gpp":`video/3gpp`,"3mf":`model/3mf`,aac:`audio/aac`,ac:`application/pkix-attr-cert`,adp:`audio/adpcm`,adts:`audio/aac`,ai:`application/postscript`,aml:`application/automationml-aml+xml`,amlx:`application/automationml-amlx+zip`,amr:`audio/amr`,apng:`image/apng`,appcache:`text/cache-manifest`,appinstaller:`application/appinstaller`,appx:`application/appx`,appxbundle:`application/appxbundle`,asc:`application/pgp-keys`,atom:`application/atom+xml`,atomcat:`application/atomcat+xml`,atomdeleted:`application/atomdeleted+xml`,atomsvc:`application/atomsvc+xml`,au:`audio/basic`,avci:`image/avci`,avcs:`image/avcs`,avif:`image/avif`,aw:`application/applixware`,bdoc:`application/bdoc`,bin:`application/octet-stream`,bmp:`image/bmp`,bpk:`application/octet-stream`,btf:`image/prs.btif`,btif:`image/prs.btif`,buffer:`application/octet-stream`,ccxml:`application/ccxml+xml`,cdfx:`application/cdfx+xml`,cdmia:`application/cdmi-capability`,cdmic:`application/cdmi-container`,cdmid:`application/cdmi-domain`,cdmio:`application/cdmi-object`,cdmiq:`application/cdmi-queue`,cer:`application/pkix-cert`,cgm:`image/cgm`,cjs:`application/node`,class:`application/java-vm`,coffee:`text/coffeescript`,conf:`text/plain`,cpl:`application/cpl+xml`,cpt:`application/mac-compactpro`,crl:`application/pkix-crl`,css:`text/css`,csv:`text/csv`,cu:`application/cu-seeme`,cwl:`application/cwl`,cww:`application/prs.cww`,davmount:`application/davmount+xml`,dbk:`application/docbook+xml`,deb:`application/octet-stream`,def:`text/plain`,deploy:`application/octet-stream`,dib:`image/bmp`,"disposition-notification":`message/disposition-notification`,dist:`application/octet-stream`,distz:`application/octet-stream`,dll:`application/octet-stream`,dmg:`application/octet-stream`,dms:`application/octet-stream`,doc:`application/msword`,dot:`application/msword`,dpx:`image/dpx`,drle:`image/dicom-rle`,dsc:`text/prs.lines.tag`,dssc:`application/dssc+der`,dtd:`application/xml-dtd`,dump:`application/octet-stream`,dwd:`application/atsc-dwd+xml`,ear:`application/java-archive`,ecma:`application/ecmascript`,elc:`application/octet-stream`,emf:`image/emf`,eml:`message/rfc822`,emma:`application/emma+xml`,emotionml:`application/emotionml+xml`,eps:`application/postscript`,epub:`application/epub+zip`,exe:`application/octet-stream`,exi:`application/exi`,exp:`application/express`,exr:`image/aces`,ez:`application/andrew-inset`,fdf:`application/fdf`,fdt:`application/fdt+xml`,fits:`image/fits`,g3:`image/g3fax`,gbr:`application/rpki-ghostbusters`,geojson:`application/geo+json`,gif:`image/gif`,glb:`model/gltf-binary`,gltf:`model/gltf+json`,gml:`application/gml+xml`,gpx:`application/gpx+xml`,gram:`application/srgs`,grxml:`application/srgs+xml`,gxf:`application/gxf`,gz:`application/gzip`,h261:`video/h261`,h263:`video/h263`,h264:`video/h264`,heic:`image/heic`,heics:`image/heic-sequence`,heif:`image/heif`,heifs:`image/heif-sequence`,hej2:`image/hej2k`,held:`application/atsc-held+xml`,hjson:`application/hjson`,hlp:`application/winhlp`,hqx:`application/mac-binhex40`,hsj2:`image/hsj2`,htm:`text/html`,html:`text/html`,ics:`text/calendar`,ief:`image/ief`,ifb:`text/calendar`,iges:`model/iges`,igs:`model/iges`,img:`application/octet-stream`,in:`text/plain`,ini:`text/plain`,ink:`application/inkml+xml`,inkml:`application/inkml+xml`,ipfix:`application/ipfix`,iso:`application/octet-stream`,its:`application/its+xml`,jade:`text/jade`,jar:`application/java-archive`,jhc:`image/jphc`,jls:`image/jls`,jp2:`image/jp2`,jpe:`image/jpeg`,jpeg:`image/jpeg`,jpf:`image/jpx`,jpg:`image/jpeg`,jpg2:`image/jp2`,jpgm:`image/jpm`,jpgv:`video/jpeg`,jph:`image/jph`,jpm:`image/jpm`,jpx:`image/jpx`,js:`text/javascript`,json:`application/json`,json5:`application/json5`,jsonld:`application/ld+json`,jsonml:`application/jsonml+json`,jsx:`text/jsx`,jt:`model/jt`,jxl:`image/jxl`,jxr:`image/jxr`,jxra:`image/jxra`,jxrs:`image/jxrs`,jxs:`image/jxs`,jxsc:`image/jxsc`,jxsi:`image/jxsi`,jxss:`image/jxss`,kar:`audio/midi`,ktx:`image/ktx`,ktx2:`image/ktx2`,less:`text/less`,lgr:`application/lgr+xml`,list:`text/plain`,litcoffee:`text/coffeescript`,log:`text/plain`,lostxml:`application/lost+xml`,lrf:`application/octet-stream`,m1v:`video/mpeg`,m21:`application/mp21`,m2a:`audio/mpeg`,m2t:`video/mp2t`,m2ts:`video/mp2t`,m2v:`video/mpeg`,m3a:`audio/mpeg`,m4a:`audio/mp4`,m4p:`application/mp4`,m4s:`video/iso.segment`,ma:`application/mathematica`,mads:`application/mads+xml`,maei:`application/mmt-aei+xml`,man:`text/troff`,manifest:`text/cache-manifest`,map:`application/json`,mar:`application/octet-stream`,markdown:`text/markdown`,mathml:`application/mathml+xml`,mb:`application/mathematica`,mbox:`application/mbox`,md:`text/markdown`,mdx:`text/mdx`,me:`text/troff`,mesh:`model/mesh`,meta4:`application/metalink4+xml`,metalink:`application/metalink+xml`,mets:`application/mets+xml`,mft:`application/rpki-manifest`,mid:`audio/midi`,midi:`audio/midi`,mime:`message/rfc822`,mj2:`video/mj2`,mjp2:`video/mj2`,mjs:`text/javascript`,mml:`text/mathml`,mods:`application/mods+xml`,mov:`video/quicktime`,mp2:`audio/mpeg`,mp21:`application/mp21`,mp2a:`audio/mpeg`,mp3:`audio/mpeg`,mp4:`video/mp4`,mp4a:`audio/mp4`,mp4s:`application/mp4`,mp4v:`video/mp4`,mpd:`application/dash+xml`,mpe:`video/mpeg`,mpeg:`video/mpeg`,mpf:`application/media-policy-dataset+xml`,mpg:`video/mpeg`,mpg4:`video/mp4`,mpga:`audio/mpeg`,mpp:`application/dash-patch+xml`,mrc:`application/marc`,mrcx:`application/marcxml+xml`,ms:`text/troff`,mscml:`application/mediaservercontrol+xml`,msh:`model/mesh`,msi:`application/octet-stream`,msix:`application/msix`,msixbundle:`application/msixbundle`,msm:`application/octet-stream`,msp:`application/octet-stream`,mtl:`model/mtl`,mts:`video/mp2t`,musd:`application/mmt-usd+xml`,mxf:`application/mxf`,mxmf:`audio/mobile-xmf`,mxml:`application/xv+xml`,n3:`text/n3`,nb:`application/mathematica`,nq:`application/n-quads`,nt:`application/n-triples`,obj:`model/obj`,oda:`application/oda`,oga:`audio/ogg`,ogg:`audio/ogg`,ogv:`video/ogg`,ogx:`application/ogg`,omdoc:`application/omdoc+xml`,onepkg:`application/onenote`,onetmp:`application/onenote`,onetoc:`application/onenote`,onetoc2:`application/onenote`,opf:`application/oebps-package+xml`,opus:`audio/ogg`,otf:`font/otf`,owl:`application/rdf+xml`,oxps:`application/oxps`,p10:`application/pkcs10`,p7c:`application/pkcs7-mime`,p7m:`application/pkcs7-mime`,p7s:`application/pkcs7-signature`,p8:`application/pkcs8`,pdf:`application/pdf`,pfr:`application/font-tdpfr`,pgp:`application/pgp-encrypted`,pkg:`application/octet-stream`,pki:`application/pkixcmp`,pkipath:`application/pkix-pkipath`,pls:`application/pls+xml`,png:`image/png`,prc:`model/prc`,prf:`application/pics-rules`,provx:`application/provenance+xml`,ps:`application/postscript`,pskcxml:`application/pskc+xml`,pti:`image/prs.pti`,qt:`video/quicktime`,raml:`application/raml+yaml`,rapd:`application/route-apd+xml`,rdf:`application/rdf+xml`,relo:`application/p2p-overlay+xml`,rif:`application/reginfo+xml`,rl:`application/resource-lists+xml`,rld:`application/resource-lists-diff+xml`,rmi:`audio/midi`,rnc:`application/relax-ng-compact-syntax`,rng:`application/xml`,roa:`application/rpki-roa`,roff:`text/troff`,rq:`application/sparql-query`,rs:`application/rls-services+xml`,rsat:`application/atsc-rsat+xml`,rsd:`application/rsd+xml`,rsheet:`application/urc-ressheet+xml`,rss:`application/rss+xml`,rtf:`text/rtf`,rtx:`text/richtext`,rusd:`application/route-usd+xml`,s3m:`audio/s3m`,sbml:`application/sbml+xml`,scq:`application/scvp-cv-request`,scs:`application/scvp-cv-response`,sdp:`application/sdp`,senmlx:`application/senml+xml`,sensmlx:`application/sensml+xml`,ser:`application/java-serialized-object`,setpay:`application/set-payment-initiation`,setreg:`application/set-registration-initiation`,sgi:`image/sgi`,sgm:`text/sgml`,sgml:`text/sgml`,shex:`text/shex`,shf:`application/shf+xml`,shtml:`text/html`,sieve:`application/sieve`,sig:`application/pgp-signature`,sil:`audio/silk`,silo:`model/mesh`,siv:`application/sieve`,slim:`text/slim`,slm:`text/slim`,sls:`application/route-s-tsid+xml`,smi:`application/smil+xml`,smil:`application/smil+xml`,snd:`audio/basic`,so:`application/octet-stream`,spdx:`text/spdx`,spp:`application/scvp-vp-response`,spq:`application/scvp-vp-request`,spx:`audio/ogg`,sql:`application/sql`,sru:`application/sru+xml`,srx:`application/sparql-results+xml`,ssdl:`application/ssdl+xml`,ssml:`application/ssml+xml`,stk:`application/hyperstudio`,stl:`model/stl`,stpx:`model/step+xml`,stpxz:`model/step-xml+zip`,stpz:`model/step+zip`,styl:`text/stylus`,stylus:`text/stylus`,svg:`image/svg+xml`,svgz:`image/svg+xml`,swidtag:`application/swid+xml`,t:`text/troff`,t38:`image/t38`,td:`application/urc-targetdesc+xml`,tei:`application/tei+xml`,teicorpus:`application/tei+xml`,text:`text/plain`,tfi:`application/thraud+xml`,tfx:`image/tiff-fx`,tif:`image/tiff`,tiff:`image/tiff`,toml:`application/toml`,tr:`text/troff`,trig:`application/trig`,ts:`video/mp2t`,tsd:`application/timestamped-data`,tsv:`text/tab-separated-values`,ttc:`font/collection`,ttf:`font/ttf`,ttl:`text/turtle`,ttml:`application/ttml+xml`,txt:`text/plain`,u3d:`model/u3d`,u8dsn:`message/global-delivery-status`,u8hdr:`message/global-headers`,u8mdn:`message/global-disposition-notification`,u8msg:`message/global`,ubj:`application/ubjson`,uri:`text/uri-list`,uris:`text/uri-list`,urls:`text/uri-list`,vcard:`text/vcard`,vrml:`model/vrml`,vtt:`text/vtt`,vxml:`application/voicexml+xml`,war:`application/java-archive`,wasm:`application/wasm`,wav:`audio/wav`,weba:`audio/webm`,webm:`video/webm`,webmanifest:`application/manifest+json`,webp:`image/webp`,wgsl:`text/wgsl`,wgt:`application/widget`,wif:`application/watcherinfo+xml`,wmf:`image/wmf`,woff:`font/woff`,woff2:`font/woff2`,wrl:`model/vrml`,wsdl:`application/wsdl+xml`,wspolicy:`application/wspolicy+xml`,x3d:`model/x3d+xml`,x3db:`model/x3d+fastinfoset`,x3dbz:`model/x3d+binary`,x3dv:`model/x3d-vrml`,x3dvz:`model/x3d+vrml`,x3dz:`model/x3d+xml`,xaml:`application/xaml+xml`,xav:`application/xcap-att+xml`,xca:`application/xcap-caps+xml`,xcs:`application/calendar+xml`,xdf:`application/xcap-diff+xml`,xdssc:`application/dssc+xml`,xel:`application/xcap-el+xml`,xenc:`application/xenc+xml`,xer:`application/patch-ops-error+xml`,xfdf:`application/xfdf`,xht:`application/xhtml+xml`,xhtml:`application/xhtml+xml`,xhvml:`application/xv+xml`,xlf:`application/xliff+xml`,xm:`audio/xm`,xml:`text/xml`,xns:`application/xcap-ns+xml`,xop:`application/xop+xml`,xpl:`application/xproc+xml`,xsd:`application/xml`,xsf:`application/prs.xsf+xml`,xsl:`application/xml`,xslt:`application/xml`,xspf:`application/xspf+xml`,xvm:`application/xv+xml`,xvml:`application/xv+xml`,yaml:`text/yaml`,yang:`application/yang`,yin:`application/yin+xml`,yml:`text/yaml`,zip:`application/zip`};function d(e){let t=(``+e).trim().toLowerCase(),n=t.lastIndexOf(`.`);return u[~n?t.substring(++n):t]}function f(e,t,n=``){e=c(`.`,e);let r=a(e),i=0,l,u;for(;i<r.length;i++)l=s(e,r[i]),u=o(l),u.isDirectory()?f(l,t,s(n,r[i])):t(s(n,r[i]),l,u)}function p(e){let t=e.url;if(t==null)return;let n=e._parsedUrl;if(n&&n.raw===t)return n;let r=t,i=``,a,o;if(t.length>1){let e=t.indexOf(`#`,1);e!==-1&&(o=t.substring(e),r=t.substring(0,e)),e=r.indexOf(`?`,1),e!==-1&&(i=r.substring(e),r=r.substring(0,e),i.length>1&&(a=l.parse(i.substring(1))))}return e._parsedUrl={pathname:r,search:i,query:a,hash:o,raw:t}}const m=()=>{};function h(e,t){for(let n=0;n<t.length;n++)if(t[n].test(e))return!0}function g(e,t){let n=0,r,i=e.length-1;e.charCodeAt(i)===47&&(e=e.substring(0,i));let a=[],o=`${e}/index`;for(;n<t.length;n++)r=t[n]?`.${t[n]}`:``,e&&a.push(e+r),a.push(o+r);return a}function _(e,t,n){let r=0,i,a=g(t,n);for(;r<a.length;r++)if(i=e[a[r]])return i}function v(n,r,a,o){let s=0,c=g(a,o),l,u,d,f;for(;s<c.length;s++)if(l=t(e(n,d=c[s])),l.startsWith(n)&&i.existsSync(l)){if(u=i.statSync(l),u.isDirectory())continue;return f=S(d,u,r),f[`Cache-Control`]=r?`no-cache`:`no-store`,{abs:l,stats:u,headers:f}}}function y(e,t){return t.statusCode=404,t.end()}function b(e,t,n,r,a){let o=200,s,c={};a={...a};for(let e in a)s=t.getHeader(e),s&&(a[e]=s);if((s=t.getHeader(`content-type`))&&(a[`Content-Type`]=s),e.headers.range){o=206;let[n,i]=e.headers.range.replace(`bytes=`,``).split(`-`),s=c.end=parseInt(i,10)||r.size-1,l=c.start=parseInt(n,10)||0;if(s>=r.size&&(s=r.size-1),l>=r.size)return t.setHeader(`Content-Range`,`bytes */${r.size}`),t.statusCode=416,t.end();a[`Content-Range`]=`bytes ${l}-${s}/${r.size}`,a[`Content-Length`]=s-l+1,a[`Accept-Ranges`]=`bytes`}t.writeHead(o,a),i.createReadStream(n,c).pipe(t)}const x={".br":`br`,".gz":`gzip`};function S(e,t,n){let r=x[e.slice(-3)],i=d(e.slice(0,r&&-3))||``;i===`text/html`&&(i+=`;charset=utf-8`);let a={"Content-Length":t.size,"Content-Type":i,"Last-Modified":t.mtime.toUTCString()};return r&&(a[`Content-Encoding`]=r),n&&(a.ETag=`W/"${t.size}-${t.mtime.getTime()}"`),a}function C(e,t={}){e=n(e||`.`);let i=t.onNoMatch||y,a=t.setHeaders||m,o=t.extensions||[`html`,`htm`],s=t.gzip&&o.map(e=>`${e}.gz`).concat(`gz`),c=t.brotli&&o.map(e=>`${e}.br`).concat(`br`),l={},u=`/`,d=!!t.etag,g=!!t.single;if(typeof t.single==`string`){let e=t.single.lastIndexOf(`.`);u+=~e?t.single.substring(0,e):t.single}let x=[];t.ignores!==!1&&(x.push(/[/]([A-Za-z\s\d~$._-]+\.\w+){1,}$/),t.dotfiles?x.push(/\/\.\w/):x.push(/\/\.well-known/),[].concat(t.ignores||[]).forEach(e=>{x.push(new RegExp(e,`i`))}));let C=t.maxAge!=null&&`public,max-age=${t.maxAge}`;C&&t.immutable?C+=`,immutable`:C&&t.maxAge===0&&(C+=`,must-revalidate`),t.dev||f(e,(e,n,r)=>{if(!/\.well-known[\\+\/]/.test(e)&&!t.dotfiles&&/(^\.|[\\+|\/+]\.)/.test(e))return;let i=S(e,r,d);C&&(i[`Cache-Control`]=C),l[`/`+e.normalize().replace(/\\+/g,`/`)]={abs:n,stats:r,headers:i}});let w=t.dev?v.bind(0,e+r,d):_.bind(0,l);return function(e,t,n){let r=[``],l=p(e).pathname,f=e.headers[`accept-encoding`]||``;if(s&&f.includes(`gzip`)&&r.unshift(...s),c&&/(br|brotli)/i.test(f)&&r.unshift(...c),r.push(...o),l.indexOf(`%`)!==-1)try{l=decodeURI(l)}catch{}let m=w(l,r)||g&&!h(l,x)&&w(u,r);if(!m)return n?n():i(e,t);if(d&&e.headers[`if-none-match`]===m.headers.ETag)return t.writeHead(304),t.end();(s||c)&&t.setHeader(`Vary`,`Accept-Encoding`),a(t,l,m.stats),b(e,t,m.abs,m.stats,m.headers)}}export{u as n,C as t};
|
|
2
|
+
//# sourceMappingURL=build-CN003PPg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./build-CN003PPg.mjs";export{e as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{stat as e,unwatchFile as t,watch as n,watchFile as r}from"node:fs";import*as i from"node:path";import{join as a,relative as o,resolve as s,sep as c}from"node:path";import{EventEmitter as l}from"node:events";import{type as u}from"node:os";import{Readable as d}from"node:stream";import{lstat as f,open as ee,readdir as p,realpath as m,stat as h}from"node:fs/promises";const g={FILE_TYPE:`files`,DIR_TYPE:`directories`,FILE_DIR_TYPE:`files_directories`,EVERYTHING_TYPE:`all`},_={root:`.`,fileFilter:e=>!0,directoryFilter:e=>!0,type:g.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(_);const v=`READDIRP_RECURSIVE_ERROR`,y=new Set([`ENOENT`,`EPERM`,`EACCES`,`ELOOP`,v]),b=[g.DIR_TYPE,g.EVERYTHING_TYPE,g.FILE_DIR_TYPE,g.FILE_TYPE],te=new Set([g.DIR_TYPE,g.EVERYTHING_TYPE,g.FILE_DIR_TYPE]),ne=new Set([g.EVERYTHING_TYPE,g.FILE_DIR_TYPE,g.FILE_TYPE]),re=e=>y.has(e.code),ie=process.platform===`win32`,x=e=>!0,S=e=>{if(e===void 0)return x;if(typeof e==`function`)return e;if(typeof e==`string`){let t=e.trim();return e=>e.basename===t}if(Array.isArray(e)){let t=e.map(e=>e.trim());return e=>t.some(t=>e.basename===t)}return x};var C=class extends d{parents;reading;parent;_stat;_maxDepth;_wantsDir;_wantsFile;_wantsEverything;_root;_isDirent;_statsProp;_rdOptions;_fileFilter;_directoryFilter;constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={..._,...e},{root:n,type:r}=t;this._fileFilter=S(t.fileFilter),this._directoryFilter=S(t.directoryFilter);let i=t.lstat?f:h;ie?this._stat=e=>i(e,{bigint:!0}):this._stat=i,this._maxDepth=t.depth!=null&&Number.isSafeInteger(t.depth)?t.depth:_.depth,this._wantsDir=r?te.has(r):!1,this._wantsFile=r?ne.has(r):!1,this._wantsEverything=r===g.EVERYTHING_TYPE,this._root=s(n),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?`dirent`:`stats`,this._rdOptions={encoding:`utf8`,withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let t=this.parent,n=t&&t.files;if(n&&n.length>0){let{path:r,depth:i}=t,a=n.splice(0,e).map(e=>this._formatEntry(e,r)),o=await Promise.all(a);for(let t of o){if(!t)continue;if(this.destroyed)return;let n=await this._getEntryType(t);n===`directory`&&this._directoryFilter(t)?(i<=this._maxDepth&&this.parents.push(this._exploreDir(t.fullPath,i+1)),this._wantsDir&&(this.push(t),e--)):(n===`file`||this._includeAsFile(t))&&this._fileFilter(t)&&this._wantsFile&&(this.push(t),e--)}}else{let e=this.parents.pop();if(!e){this.push(null);break}if(this.parent=await e,this.destroyed)return}}}catch(e){this.destroy(e)}finally{this.reading=!1}}}async _exploreDir(e,t){let n;try{n=await p(e,this._rdOptions)}catch(e){this._onError(e)}return{files:n,depth:t,path:e}}async _formatEntry(e,t){let n,r=this._isDirent?e.name:e;try{let i=s(a(t,r));n={path:o(this._root,i),fullPath:i,basename:r},n[this._statsProp]=this._isDirent?e:await this._stat(i)}catch(e){this._onError(e);return}return n}_onError(e){re(e)&&!this.destroyed?this.emit(`warn`,e):this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return``;let t=e[this._statsProp];if(t.isFile())return`file`;if(t.isDirectory())return`directory`;if(t&&t.isSymbolicLink()){let t=e.fullPath;try{let e=await m(t),n=await f(e);if(n.isFile())return`file`;if(n.isDirectory()){let n=e.length;if(t.startsWith(e)&&t.substr(n,1)===c){let n=Error(`Circular symlink detected: "${t}" points to "${e}"`);return n.code=v,this._onError(n)}return`directory`}}catch(e){return this._onError(e),``}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}};function ae(e,t={}){let n=t.entryType||t.type;if(n===`both`&&(n=g.FILE_DIR_TYPE),n&&(t.type=n),!e)throw Error(`readdirp: root argument is required. Usage: readdirp(root, options)`);if(typeof e!=`string`)throw TypeError(`readdirp: root argument must be a string. Usage: readdirp(root, options)`);if(n&&!b.includes(n))throw Error(`readdirp: Invalid type passed. Use one of ${b.join(`, `)}`);return t.root=e,new C(t)}const w=()=>{},T=process.platform,E=T===`win32`,D=T===`darwin`,O=T===`linux`,k=T===`freebsd`,A=u()===`OS400`,j={ALL:`all`,READY:`ready`,ADD:`add`,CHANGE:`change`,ADD_DIR:`addDir`,UNLINK:`unlink`,UNLINK_DIR:`unlinkDir`,RAW:`raw`,ERROR:`error`},M=j,N={lstat:f,stat:h},P=`listeners`,F=`errHandlers`,I=`rawEmitters`,oe=[P,F,I],se=new Set(`3dm.3ds.3g2.3gp.7z.a.aac.adp.afdesign.afphoto.afpub.ai.aif.aiff.alz.ape.apk.appimage.ar.arj.asf.au.avi.bak.baml.bh.bin.bk.bmp.btif.bz2.bzip2.cab.caf.cgm.class.cmx.cpio.cr2.cur.dat.dcm.deb.dex.djvu.dll.dmg.dng.doc.docm.docx.dot.dotm.dra.DS_Store.dsk.dts.dtshd.dvb.dwg.dxf.ecelp4800.ecelp7470.ecelp9600.egg.eol.eot.epub.exe.f4v.fbs.fh.fla.flac.flatpak.fli.flv.fpx.fst.fvt.g3.gh.gif.graffle.gz.gzip.h261.h263.h264.icns.ico.ief.img.ipa.iso.jar.jpeg.jpg.jpgv.jpm.jxr.key.ktx.lha.lib.lvp.lz.lzh.lzma.lzo.m3u.m4a.m4v.mar.mdi.mht.mid.midi.mj2.mka.mkv.mmr.mng.mobi.mov.movie.mp3.mp4.mp4a.mpeg.mpg.mpga.mxu.nef.npx.numbers.nupkg.o.odp.ods.odt.oga.ogg.ogv.otf.ott.pages.pbm.pcx.pdb.pdf.pea.pgm.pic.png.pnm.pot.potm.potx.ppa.ppam.ppm.pps.ppsm.ppsx.ppt.pptm.pptx.psd.pya.pyc.pyo.pyv.qt.rar.ras.raw.resources.rgb.rip.rlc.rmf.rmvb.rpm.rtf.rz.s3m.s7z.scpt.sgi.shar.snap.sil.sketch.slk.smv.snk.so.stl.suo.sub.swf.tar.tbz.tbz2.tga.tgz.thmx.tif.tiff.tlz.ttc.ttf.txz.udf.uvh.uvi.uvm.uvp.uvs.uvu.viv.vob.war.wav.wax.wbmp.wdp.weba.webm.webp.whl.wim.wm.wma.wmv.wmx.woff.woff2.wrm.wvx.xbm.xif.xla.xlam.xls.xlsb.xlsm.xlsx.xlt.xltm.xltx.xm.xmind.xpi.xpm.xwd.xz.z.zip.zipx`.split(`.`)),ce=e=>se.has(i.extname(e).slice(1).toLowerCase()),L=(e,t)=>{e instanceof Set?e.forEach(t):t(e)},R=(e,t,n)=>{let r=e[t];r instanceof Set||(e[t]=r=new Set([r])),r.add(n)},z=e=>t=>{let n=e[t];n instanceof Set?n.clear():delete e[t]},B=(e,t,n)=>{let r=e[t];r instanceof Set?r.delete(n):r===n&&delete e[t]},V=e=>e instanceof Set?e.size===0:!e,H=new Map;function U(e,t,r,a,o){let s=(t,n)=>{r(e),o(t,n,{watchedPath:e}),n&&e!==n&&W(i.resolve(e,n),P,i.join(e,n))};try{return n(e,{persistent:t.persistent},s)}catch(e){a(e);return}}const W=(e,t,n,r,i)=>{let a=H.get(e);a&&L(a[t],e=>{e(n,r,i)})},le=(e,t,n,r)=>{let{listener:i,errHandler:a,rawEmitter:o}=r,s=H.get(t),c;if(!n.persistent)return c=U(e,n,i,a,o),c?c.close.bind(c):void 0;if(s)R(s,P,i),R(s,F,a),R(s,I,o);else{if(c=U(e,n,W.bind(null,t,P),a,W.bind(null,t,I)),!c)return;c.on(M.ERROR,async n=>{let r=W.bind(null,t,F);if(s&&(s.watcherUnusable=!0),E&&n.code===`EPERM`)try{await(await ee(e,`r`)).close(),r(n)}catch{}else r(n)}),s={listeners:i,errHandlers:a,rawEmitters:o,watcher:c},H.set(t,s)}return()=>{B(s,P,i),B(s,F,a),B(s,I,o),V(s.listeners)&&(s.watcher.close(),H.delete(t),oe.forEach(z(s)),s.watcher=void 0,Object.freeze(s))}},G=new Map,ue=(e,n,i,a)=>{let{listener:o,rawEmitter:s}=a,c=G.get(n),l=c&&c.options;return l&&(l.persistent<i.persistent||l.interval>i.interval)&&(t(n),c=void 0),c?(R(c,P,o),R(c,I,s)):(c={listeners:o,rawEmitters:s,options:i,watcher:r(n,i,(t,r)=>{L(c.rawEmitters,e=>{e(M.CHANGE,n,{curr:t,prev:r})});let i=t.mtimeMs;(t.size!==r.size||i>r.mtimeMs||i===0)&&L(c.listeners,n=>n(e,t))})},G.set(n,c)),()=>{B(c,P,o),B(c,I,s),V(c.listeners)&&(G.delete(n),t(n),c.options=c.watcher=void 0,Object.freeze(c))}};var de=class{fsw;_boundHandleError;constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(e,t){let n=this.fsw.options,r=i.dirname(e),a=i.basename(e);this.fsw._getWatchedDir(r).add(a);let o=i.resolve(e),s={persistent:n.persistent};t||=w;let c;return n.usePolling?(s.interval=n.interval!==n.binaryInterval&&ce(a)?n.binaryInterval:n.interval,c=ue(e,o,s,{listener:t,rawEmitter:this.fsw._emitRaw})):c=le(e,o,s,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw}),c}_handleFile(e,t,n){if(this.fsw.closed)return;let r=i.dirname(e),a=i.basename(e),o=this.fsw._getWatchedDir(r),s=t;if(o.has(a))return;let c=async(t,n)=>{if(this.fsw._throttle(`watch`,e,5)){if(!n||n.mtimeMs===0)try{let n=await h(e);if(this.fsw.closed)return;let r=n.atimeMs,i=n.mtimeMs;if((!r||r<=i||i!==s.mtimeMs)&&this.fsw._emit(M.CHANGE,e,n),(D||O||k)&&s.ino!==n.ino){this.fsw._closeFile(t),s=n;let r=this._watchWithNodeFs(e,c);r&&this.fsw._addPathCloser(t,r)}else s=n}catch{this.fsw._remove(r,a)}else if(o.has(a)){let t=n.atimeMs,r=n.mtimeMs;(!t||t<=r||r!==s.mtimeMs)&&this.fsw._emit(M.CHANGE,e,n),s=n}}},l=this._watchWithNodeFs(e,c);if(!(n&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(M.ADD,e,0))return;this.fsw._emit(M.ADD,e,t)}return l}async _handleSymlink(e,t,n,r){if(this.fsw.closed)return;let i=e.fullPath,a=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let t;try{t=await m(n)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(a.has(r)?this.fsw._symlinkPaths.get(i)!==t&&(this.fsw._symlinkPaths.set(i,t),this.fsw._emit(M.CHANGE,n,e.stats)):(a.add(r),this.fsw._symlinkPaths.set(i,t),this.fsw._emit(M.ADD,n,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(i))return!0;this.fsw._symlinkPaths.set(i,!0)}_handleRead(e,t,n,r,a,o,s){e=i.join(e,``);let c=r?`${e}:${r}`:e;if(s=this.fsw._throttle(`readdir`,c,1e3),!s)return;let l=this.fsw._getWatchedDir(n.path),u=new Set,d=this.fsw._readdirp(e,{fileFilter:e=>n.filterPath(e),directoryFilter:e=>n.filterDir(e)});if(d)return d.on(`data`,async s=>{if(this.fsw.closed){d=void 0;return}let c=s.path,f=i.join(e,c);if(u.add(c),!(s.stats.isSymbolicLink()&&await this._handleSymlink(s,e,f,c))){if(this.fsw.closed){d=void 0;return}(c===r||!r&&!l.has(c))&&(this.fsw._incrReadyCount(),f=i.join(a,i.relative(a,f)),this._addToNodeFs(f,t,n,o+1))}}).on(M.ERROR,this._boundHandleError),new Promise((t,i)=>{if(!d)return i();d.once(`end`,()=>{if(this.fsw.closed){d=void 0;return}let i=s?s.clear():!1;t(void 0),l.getChildren().filter(t=>t!==e&&!u.has(t)).forEach(t=>{this.fsw._remove(e,t)}),d=void 0,i&&this._handleRead(e,!1,n,r,a,o,s)})})}async _handleDir(e,t,n,r,a,o,s){let c=this.fsw._getWatchedDir(i.dirname(e)),l=c.has(i.basename(e));!(n&&this.fsw.options.ignoreInitial)&&!a&&!l&&this.fsw._emit(M.ADD_DIR,e,t),c.add(i.basename(e)),this.fsw._getWatchedDir(e);let u,d=this.fsw.options.depth;if((d==null||r<=d)&&!this.fsw._symlinkPaths.has(s)){if(!a&&(await this._handleRead(e,n,o,a,e,r,void 0),this.fsw.closed))return;u=this._watchWithNodeFs(e,(t,n)=>{n&&n.mtimeMs===0||this._handleRead(t,!1,o,a,e,r,void 0)})}return u}async _addToNodeFs(e,t,n,r,a){let o=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return o(),!1;let s=this.fsw._getWatchHelpers(e);n&&(s.filterPath=e=>n.filterPath(e),s.filterDir=e=>n.filterDir(e));try{let n=await N[s.statMethod](s.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(s.watchPath,n))return o(),!1;let c=this.fsw.options.followSymlinks,l;if(n.isDirectory()){let o=i.resolve(e),u=c?await m(e):e;if(this.fsw.closed||(l=await this._handleDir(s.watchPath,n,t,r,a,s,u),this.fsw.closed))return;o!==u&&u!==void 0&&this.fsw._symlinkPaths.set(o,u)}else if(n.isSymbolicLink()){let a=c?await m(e):e;if(this.fsw.closed)return;let o=i.dirname(s.watchPath);if(this.fsw._getWatchedDir(o).add(s.watchPath),this.fsw._emit(M.ADD,s.watchPath,n),l=await this._handleDir(o,n,t,r,e,s,a),this.fsw.closed)return;a!==void 0&&this.fsw._symlinkPaths.set(i.resolve(e),a)}else l=this._handleFile(s.watchPath,n,t);return o(),l&&this.fsw._addPathCloser(e,l),!1}catch(t){if(this.fsw._handleError(t))return o(),e}}};
|
|
1
|
+
import*as e from"node:path";import{join as t,relative as n,resolve as r,sep as i}from"node:path";import{EventEmitter as a}from"node:events";import{stat as o,unwatchFile as s,watch as c,watchFile as l}from"node:fs";import{type as u}from"node:os";import{Readable as d}from"node:stream";import{lstat as f,open as ee,readdir as p,realpath as m,stat as h}from"node:fs/promises";const g={FILE_TYPE:`files`,DIR_TYPE:`directories`,FILE_DIR_TYPE:`files_directories`,EVERYTHING_TYPE:`all`},_={root:`.`,fileFilter:e=>!0,directoryFilter:e=>!0,type:g.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(_);const v=`READDIRP_RECURSIVE_ERROR`,y=new Set([`ENOENT`,`EPERM`,`EACCES`,`ELOOP`,v]),b=[g.DIR_TYPE,g.EVERYTHING_TYPE,g.FILE_DIR_TYPE,g.FILE_TYPE],te=new Set([g.DIR_TYPE,g.EVERYTHING_TYPE,g.FILE_DIR_TYPE]),ne=new Set([g.EVERYTHING_TYPE,g.FILE_DIR_TYPE,g.FILE_TYPE]),re=e=>y.has(e.code),ie=process.platform===`win32`,x=e=>!0,S=e=>{if(e===void 0)return x;if(typeof e==`function`)return e;if(typeof e==`string`){let t=e.trim();return e=>e.basename===t}if(Array.isArray(e)){let t=e.map(e=>e.trim());return e=>t.some(t=>e.basename===t)}return x};var C=class extends d{parents;reading;parent;_stat;_maxDepth;_wantsDir;_wantsFile;_wantsEverything;_root;_isDirent;_statsProp;_rdOptions;_fileFilter;_directoryFilter;constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={..._,...e},{root:n,type:i}=t;this._fileFilter=S(t.fileFilter),this._directoryFilter=S(t.directoryFilter);let a=t.lstat?f:h;ie?this._stat=e=>a(e,{bigint:!0}):this._stat=a,this._maxDepth=t.depth!=null&&Number.isSafeInteger(t.depth)?t.depth:_.depth,this._wantsDir=i?te.has(i):!1,this._wantsFile=i?ne.has(i):!1,this._wantsEverything=i===g.EVERYTHING_TYPE,this._root=r(n),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?`dirent`:`stats`,this._rdOptions={encoding:`utf8`,withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let t=this.parent,n=t&&t.files;if(n&&n.length>0){let{path:r,depth:i}=t,a=n.splice(0,e).map(e=>this._formatEntry(e,r)),o=await Promise.all(a);for(let t of o){if(!t)continue;if(this.destroyed)return;let n=await this._getEntryType(t);n===`directory`&&this._directoryFilter(t)?(i<=this._maxDepth&&this.parents.push(this._exploreDir(t.fullPath,i+1)),this._wantsDir&&(this.push(t),e--)):(n===`file`||this._includeAsFile(t))&&this._fileFilter(t)&&this._wantsFile&&(this.push(t),e--)}}else{let e=this.parents.pop();if(!e){this.push(null);break}if(this.parent=await e,this.destroyed)return}}}catch(e){this.destroy(e)}finally{this.reading=!1}}}async _exploreDir(e,t){let n;try{n=await p(e,this._rdOptions)}catch(e){this._onError(e)}return{files:n,depth:t,path:e}}async _formatEntry(e,i){let a,o=this._isDirent?e.name:e;try{let s=r(t(i,o));a={path:n(this._root,s),fullPath:s,basename:o},a[this._statsProp]=this._isDirent?e:await this._stat(s)}catch(e){this._onError(e);return}return a}_onError(e){re(e)&&!this.destroyed?this.emit(`warn`,e):this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return``;let t=e[this._statsProp];if(t.isFile())return`file`;if(t.isDirectory())return`directory`;if(t&&t.isSymbolicLink()){let t=e.fullPath;try{let e=await m(t),n=await f(e);if(n.isFile())return`file`;if(n.isDirectory()){let n=e.length;if(t.startsWith(e)&&t.substr(n,1)===i){let n=Error(`Circular symlink detected: "${t}" points to "${e}"`);return n.code=v,this._onError(n)}return`directory`}}catch(e){return this._onError(e),``}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}};function ae(e,t={}){let n=t.entryType||t.type;if(n===`both`&&(n=g.FILE_DIR_TYPE),n&&(t.type=n),!e)throw Error(`readdirp: root argument is required. Usage: readdirp(root, options)`);if(typeof e!=`string`)throw TypeError(`readdirp: root argument must be a string. Usage: readdirp(root, options)`);if(n&&!b.includes(n))throw Error(`readdirp: Invalid type passed. Use one of ${b.join(`, `)}`);return t.root=e,new C(t)}const w=()=>{},T=process.platform,E=T===`win32`,D=T===`darwin`,O=T===`linux`,k=T===`freebsd`,A=u()===`OS400`,j={ALL:`all`,READY:`ready`,ADD:`add`,CHANGE:`change`,ADD_DIR:`addDir`,UNLINK:`unlink`,UNLINK_DIR:`unlinkDir`,RAW:`raw`,ERROR:`error`},M=j,N={lstat:f,stat:h},P=`listeners`,F=`errHandlers`,I=`rawEmitters`,oe=[P,F,I],se=new Set(`3dm.3ds.3g2.3gp.7z.a.aac.adp.afdesign.afphoto.afpub.ai.aif.aiff.alz.ape.apk.appimage.ar.arj.asf.au.avi.bak.baml.bh.bin.bk.bmp.btif.bz2.bzip2.cab.caf.cgm.class.cmx.cpio.cr2.cur.dat.dcm.deb.dex.djvu.dll.dmg.dng.doc.docm.docx.dot.dotm.dra.DS_Store.dsk.dts.dtshd.dvb.dwg.dxf.ecelp4800.ecelp7470.ecelp9600.egg.eol.eot.epub.exe.f4v.fbs.fh.fla.flac.flatpak.fli.flv.fpx.fst.fvt.g3.gh.gif.graffle.gz.gzip.h261.h263.h264.icns.ico.ief.img.ipa.iso.jar.jpeg.jpg.jpgv.jpm.jxr.key.ktx.lha.lib.lvp.lz.lzh.lzma.lzo.m3u.m4a.m4v.mar.mdi.mht.mid.midi.mj2.mka.mkv.mmr.mng.mobi.mov.movie.mp3.mp4.mp4a.mpeg.mpg.mpga.mxu.nef.npx.numbers.nupkg.o.odp.ods.odt.oga.ogg.ogv.otf.ott.pages.pbm.pcx.pdb.pdf.pea.pgm.pic.png.pnm.pot.potm.potx.ppa.ppam.ppm.pps.ppsm.ppsx.ppt.pptm.pptx.psd.pya.pyc.pyo.pyv.qt.rar.ras.raw.resources.rgb.rip.rlc.rmf.rmvb.rpm.rtf.rz.s3m.s7z.scpt.sgi.shar.snap.sil.sketch.slk.smv.snk.so.stl.suo.sub.swf.tar.tbz.tbz2.tga.tgz.thmx.tif.tiff.tlz.ttc.ttf.txz.udf.uvh.uvi.uvm.uvp.uvs.uvu.viv.vob.war.wav.wax.wbmp.wdp.weba.webm.webp.whl.wim.wm.wma.wmv.wmx.woff.woff2.wrm.wvx.xbm.xif.xla.xlam.xls.xlsb.xlsm.xlsx.xlt.xltm.xltx.xm.xmind.xpi.xpm.xwd.xz.z.zip.zipx`.split(`.`)),ce=t=>se.has(e.extname(t).slice(1).toLowerCase()),L=(e,t)=>{e instanceof Set?e.forEach(t):t(e)},R=(e,t,n)=>{let r=e[t];r instanceof Set||(e[t]=r=new Set([r])),r.add(n)},z=e=>t=>{let n=e[t];n instanceof Set?n.clear():delete e[t]},B=(e,t,n)=>{let r=e[t];r instanceof Set?r.delete(n):r===n&&delete e[t]},V=e=>e instanceof Set?e.size===0:!e,H=new Map;function U(t,n,r,i,a){let o=(n,i)=>{r(t),a(n,i,{watchedPath:t}),i&&t!==i&&W(e.resolve(t,i),P,e.join(t,i))};try{return c(t,{persistent:n.persistent},o)}catch(e){i(e);return}}const W=(e,t,n,r,i)=>{let a=H.get(e);a&&L(a[t],e=>{e(n,r,i)})},le=(e,t,n,r)=>{let{listener:i,errHandler:a,rawEmitter:o}=r,s=H.get(t),c;if(!n.persistent)return c=U(e,n,i,a,o),c?c.close.bind(c):void 0;if(s)R(s,P,i),R(s,F,a),R(s,I,o);else{if(c=U(e,n,W.bind(null,t,P),a,W.bind(null,t,I)),!c)return;c.on(M.ERROR,async n=>{let r=W.bind(null,t,F);if(s&&(s.watcherUnusable=!0),E&&n.code===`EPERM`)try{await(await ee(e,`r`)).close(),r(n)}catch{}else r(n)}),s={listeners:i,errHandlers:a,rawEmitters:o,watcher:c},H.set(t,s)}return()=>{B(s,P,i),B(s,F,a),B(s,I,o),V(s.listeners)&&(s.watcher.close(),H.delete(t),oe.forEach(z(s)),s.watcher=void 0,Object.freeze(s))}},G=new Map,ue=(e,t,n,r)=>{let{listener:i,rawEmitter:a}=r,o=G.get(t),c=o&&o.options;return c&&(c.persistent<n.persistent||c.interval>n.interval)&&(s(t),o=void 0),o?(R(o,P,i),R(o,I,a)):(o={listeners:i,rawEmitters:a,options:n,watcher:l(t,n,(n,r)=>{L(o.rawEmitters,e=>{e(M.CHANGE,t,{curr:n,prev:r})});let i=n.mtimeMs;(n.size!==r.size||i>r.mtimeMs||i===0)&&L(o.listeners,t=>t(e,n))})},G.set(t,o)),()=>{B(o,P,i),B(o,I,a),V(o.listeners)&&(G.delete(t),s(t),o.options=o.watcher=void 0,Object.freeze(o))}};var de=class{fsw;_boundHandleError;constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(t,n){let r=this.fsw.options,i=e.dirname(t),a=e.basename(t);this.fsw._getWatchedDir(i).add(a);let o=e.resolve(t),s={persistent:r.persistent};n||=w;let c;return r.usePolling?(s.interval=r.interval!==r.binaryInterval&&ce(a)?r.binaryInterval:r.interval,c=ue(t,o,s,{listener:n,rawEmitter:this.fsw._emitRaw})):c=le(t,o,s,{listener:n,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw}),c}_handleFile(t,n,r){if(this.fsw.closed)return;let i=e.dirname(t),a=e.basename(t),o=this.fsw._getWatchedDir(i),s=n;if(o.has(a))return;let c=async(e,n)=>{if(this.fsw._throttle(`watch`,t,5)){if(!n||n.mtimeMs===0)try{let n=await h(t);if(this.fsw.closed)return;let r=n.atimeMs,i=n.mtimeMs;if((!r||r<=i||i!==s.mtimeMs)&&this.fsw._emit(M.CHANGE,t,n),(D||O||k)&&s.ino!==n.ino){this.fsw._closeFile(e),s=n;let r=this._watchWithNodeFs(t,c);r&&this.fsw._addPathCloser(e,r)}else s=n}catch{this.fsw._remove(i,a)}else if(o.has(a)){let e=n.atimeMs,r=n.mtimeMs;(!e||e<=r||r!==s.mtimeMs)&&this.fsw._emit(M.CHANGE,t,n),s=n}}},l=this._watchWithNodeFs(t,c);if(!(r&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(M.ADD,t,0))return;this.fsw._emit(M.ADD,t,n)}return l}async _handleSymlink(e,t,n,r){if(this.fsw.closed)return;let i=e.fullPath,a=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let t;try{t=await m(n)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(a.has(r)?this.fsw._symlinkPaths.get(i)!==t&&(this.fsw._symlinkPaths.set(i,t),this.fsw._emit(M.CHANGE,n,e.stats)):(a.add(r),this.fsw._symlinkPaths.set(i,t),this.fsw._emit(M.ADD,n,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(i))return!0;this.fsw._symlinkPaths.set(i,!0)}_handleRead(t,n,r,i,a,o,s){t=e.join(t,``);let c=i?`${t}:${i}`:t;if(s=this.fsw._throttle(`readdir`,c,1e3),!s)return;let l=this.fsw._getWatchedDir(r.path),u=new Set,d=this.fsw._readdirp(t,{fileFilter:e=>r.filterPath(e),directoryFilter:e=>r.filterDir(e)});if(d)return d.on(`data`,async s=>{if(this.fsw.closed){d=void 0;return}let c=s.path,f=e.join(t,c);if(u.add(c),!(s.stats.isSymbolicLink()&&await this._handleSymlink(s,t,f,c))){if(this.fsw.closed){d=void 0;return}(c===i||!i&&!l.has(c))&&(this.fsw._incrReadyCount(),f=e.join(a,e.relative(a,f)),this._addToNodeFs(f,n,r,o+1))}}).on(M.ERROR,this._boundHandleError),new Promise((e,n)=>{if(!d)return n();d.once(`end`,()=>{if(this.fsw.closed){d=void 0;return}let n=s?s.clear():!1;e(void 0),l.getChildren().filter(e=>e!==t&&!u.has(e)).forEach(e=>{this.fsw._remove(t,e)}),d=void 0,n&&this._handleRead(t,!1,r,i,a,o,s)})})}async _handleDir(t,n,r,i,a,o,s){let c=this.fsw._getWatchedDir(e.dirname(t)),l=c.has(e.basename(t));!(r&&this.fsw.options.ignoreInitial)&&!a&&!l&&this.fsw._emit(M.ADD_DIR,t,n),c.add(e.basename(t)),this.fsw._getWatchedDir(t);let u,d=this.fsw.options.depth;if((d==null||i<=d)&&!this.fsw._symlinkPaths.has(s)){if(!a&&(await this._handleRead(t,r,o,a,t,i,void 0),this.fsw.closed))return;u=this._watchWithNodeFs(t,(e,n)=>{n&&n.mtimeMs===0||this._handleRead(e,!1,o,a,t,i,void 0)})}return u}async _addToNodeFs(t,n,r,i,a){let o=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return o(),!1;let s=this.fsw._getWatchHelpers(t);r&&(s.filterPath=e=>r.filterPath(e),s.filterDir=e=>r.filterDir(e));try{let r=await N[s.statMethod](s.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(s.watchPath,r))return o(),!1;let c=this.fsw.options.followSymlinks,l;if(r.isDirectory()){let o=e.resolve(t),u=c?await m(t):t;if(this.fsw.closed||(l=await this._handleDir(s.watchPath,r,n,i,a,s,u),this.fsw.closed))return;o!==u&&u!==void 0&&this.fsw._symlinkPaths.set(o,u)}else if(r.isSymbolicLink()){let a=c?await m(t):t;if(this.fsw.closed)return;let o=e.dirname(s.watchPath);if(this.fsw._getWatchedDir(o).add(s.watchPath),this.fsw._emit(M.ADD,s.watchPath,r),l=await this._handleDir(o,r,n,i,t,s,a),this.fsw.closed)return;a!==void 0&&this.fsw._symlinkPaths.set(e.resolve(t),a)}else l=this._handleFile(s.watchPath,r,n);return o(),l&&this.fsw._addPathCloser(t,l),!1}catch(e){if(this.fsw._handleError(e))return o(),t}}};
|
|
2
2
|
/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
|
|
3
|
-
const fe=/\\/g,K=/\/\//g,pe=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,me=/^\.[/\\]/;function q(e){return Array.isArray(e)?e:[e]}const J=e=>typeof e==`object`&&!!e&&!(e instanceof RegExp);function he(
|
|
4
|
-
//# sourceMappingURL=chokidar-
|
|
3
|
+
const fe=/\\/g,K=/\/\//g,pe=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,me=/^\.[/\\]/;function q(e){return Array.isArray(e)?e:[e]}const J=e=>typeof e==`object`&&!!e&&!(e instanceof RegExp);function he(t){return typeof t==`function`?t:typeof t==`string`?e=>t===e:t instanceof RegExp?e=>t.test(e):typeof t==`object`&&t?n=>{if(t.path===n)return!0;if(t.recursive){let r=e.relative(t.path,n);return r?!r.startsWith(`..`)&&!e.isAbsolute(r):!1}return!1}:()=>!1}function ge(t){if(typeof t!=`string`)throw Error(`string expected`);t=e.normalize(t),t=t.replace(/\\/g,`/`);let n=!1;return t.startsWith(`//`)&&(n=!0),t=t.replace(K,`/`),n&&(t=`/`+t),t}function Y(e,t,n){let r=ge(t);for(let t=0;t<e.length;t++){let i=e[t];if(i(r,n))return!0}return!1}function _e(e,t){if(e==null)throw TypeError(`anymatch: specify first argument`);let n=q(e).map(e=>he(e));return t==null?(e,t)=>Y(n,e,t):Y(n,t)}const X=e=>{let t=q(e).flat();if(!t.every(e=>typeof e==`string`))throw TypeError(`Non-string provided as watch path: ${t}`);return t.map(Q)},Z=e=>{let t=e.replace(fe,`/`),n=!1;return t.startsWith(`//`)&&(n=!0),t=t.replace(K,`/`),n&&(t=`/`+t),t},Q=t=>Z(e.normalize(Z(t))),$=(t=``)=>n=>typeof n==`string`?Q(e.isAbsolute(n)?n:e.join(t,n)):n,ve=(t,n)=>e.isAbsolute(t)?t:e.join(n,t),ye=Object.freeze(new Set);var be=class{path;_removeWatcher;items;constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;t&&e!==`.`&&e!==`..`&&t.add(e)}async remove(t){let{items:n}=this;if(!n||(n.delete(t),n.size>0))return;let r=this.path;try{await p(r)}catch{this._removeWatcher&&this._removeWatcher(e.dirname(r),e.basename(r))}}has(e){let{items:t}=this;if(t)return t.has(e)}getChildren(){let{items:e}=this;return e?[...e.values()]:[]}dispose(){this.items.clear(),this.path=``,this._removeWatcher=w,this.items=ye,Object.freeze(this)}},xe=class{fsw;path;watchPath;fullWatchPath;dirParts;followSymlinks;statMethod;constructor(t,n,r){this.fsw=r;let i=t;this.path=t=t.replace(me,``),this.watchPath=i,this.fullWatchPath=e.resolve(i),this.dirParts=[],this.dirParts.forEach(e=>{e.length>1&&e.pop()}),this.followSymlinks=n,this.statMethod=n?`stat`:`lstat`}entryPath(t){return e.join(this.watchPath,e.relative(this.watchPath,t.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let n=this.entryPath(e);return this.fsw._isntIgnored(n,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}},Se=class extends a{closed;options;_closers;_ignoredPaths;_throttled;_streams;_symlinkPaths;_watched;_pendingWrites;_pendingUnlinks;_readyCount;_emitReady;_closePromise;_userIgnored;_readyEmitted;_emitRaw;_boundRemove;_nodeFsHandler;constructor(e={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,n={stabilityThreshold:2e3,pollInterval:100},r={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?q(e.ignored):q([]),awaitWriteFinish:t===!0?n:typeof t==`object`?{...n,...t}:!1};A&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let i=process.env.CHOKIDAR_USEPOLLING;if(i!==void 0){let e=i.toLowerCase();e===`false`||e===`0`?r.usePolling=!1:e===`true`||e===`1`?r.usePolling=!0:r.usePolling=!!e}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let o=0;this._emitReady=()=>{o++,o>=this._readyCount&&(this._emitReady=w,this._readyEmitted=!0,process.nextTick(()=>this.emit(j.READY)))},this._emitRaw=(...e)=>this.emit(j.RAW,...e),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new de(this),Object.freeze(r)}_addIgnoredPath(e){if(J(e)){for(let t of this._ignoredPaths)if(J(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),typeof e==`string`)for(let t of this._ignoredPaths)J(t)&&t.path===e&&this._ignoredPaths.delete(t)}add(t,n,r){let{cwd:i}=this.options;this.closed=!1,this._closePromise=void 0;let a=X(t);return i&&(a=a.map(e=>ve(e,i))),a.forEach(e=>{this._removeIgnoredPath(e)}),this._userIgnored=void 0,this._readyCount||=0,this._readyCount+=a.length,Promise.all(a.map(async e=>{let t=await this._nodeFsHandler._addToNodeFs(e,!r,void 0,0,n);return t&&this._emitReady(),t})).then(t=>{this.closed||t.forEach(t=>{t&&this.add(e.dirname(t),e.basename(n||t))})}),this}unwatch(t){if(this.closed)return this;let n=X(t),{cwd:r}=this.options;return n.forEach(t=>{!e.isAbsolute(t)&&!this._closers.has(t)&&(r&&(t=e.join(r,t)),t=e.resolve(t)),this._closePath(t),this._addIgnoredPath(t),this._watched.has(t)&&this._addIgnoredPath({path:t,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(t=>t.forEach(t=>{let n=t();n instanceof Promise&&e.push(n)})),this._streams.forEach(e=>e.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(e=>e.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>void 0):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((n,r)=>{let i=(this.options.cwd?e.relative(this.options.cwd,r):r)||`.`;t[i]=n.getChildren().sort()}),t}emitWithAll(e,t){this.emit(e,...t),e!==j.ERROR&&this.emit(j.ALL,e,...t)}async _emit(t,n,r){if(this.closed)return;let i=this.options;E&&(n=e.normalize(n)),i.cwd&&(n=e.relative(i.cwd,n));let a=[n];r!=null&&a.push(r);let o=i.awaitWriteFinish,s;if(o&&(s=this._pendingWrites.get(n)))return s.lastChange=new Date,this;if(i.atomic){if(t===j.UNLINK)return this._pendingUnlinks.set(n,[t,...a]),setTimeout(()=>{this._pendingUnlinks.forEach((e,t)=>{this.emit(...e),this.emit(j.ALL,...e),this._pendingUnlinks.delete(t)})},typeof i.atomic==`number`?i.atomic:100),this;t===j.ADD&&this._pendingUnlinks.has(n)&&(t=j.CHANGE,this._pendingUnlinks.delete(n))}if(o&&(t===j.ADD||t===j.CHANGE)&&this._readyEmitted)return this._awaitWriteFinish(n,o.stabilityThreshold,t,(e,n)=>{e?(t=j.ERROR,a[0]=e,this.emitWithAll(t,a)):n&&(a.length>1?a[1]=n:a.push(n),this.emitWithAll(t,a))}),this;if(t===j.CHANGE&&!this._throttle(j.CHANGE,n,50))return this;if(i.alwaysStat&&r===void 0&&(t===j.ADD||t===j.ADD_DIR||t===j.CHANGE)){let t=i.cwd?e.join(i.cwd,n):n,r;try{r=await h(t)}catch{}if(!r||this.closed)return;a.push(r)}return this.emitWithAll(t,a),this}_handleError(e){let t=e&&e.code;return e&&t!==`ENOENT`&&t!==`ENOTDIR`&&(!this.options.ignorePermissionErrors||t!==`EPERM`&&t!==`EACCES`)&&this.emit(j.ERROR,e),e||this.closed}_throttle(e,t,n){this._throttled.has(e)||this._throttled.set(e,new Map);let r=this._throttled.get(e);if(!r)throw Error(`invalid throttle`);let i=r.get(t);if(i)return i.count++,!1;let a,o=()=>{let e=r.get(t),n=e?e.count:0;return r.delete(t),clearTimeout(a),e&&clearTimeout(e.timeoutObject),n};a=setTimeout(o,n);let s={timeoutObject:a,clear:o,count:0};return r.set(t,s),s}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,n,r,i){let a=this.options.awaitWriteFinish;if(typeof a!=`object`)return;let s=a.pollInterval,c,l=t;this.options.cwd&&!e.isAbsolute(t)&&(l=e.join(this.options.cwd,t));let u=new Date,d=this._pendingWrites;function f(e){o(l,(r,a)=>{if(r||!d.has(t)){r&&r.code!==`ENOENT`&&i(r);return}let o=Number(new Date);e&&a.size!==e.size&&(d.get(t).lastChange=o),o-d.get(t).lastChange>=n?(d.delete(t),i(void 0,a)):c=setTimeout(f,s,a)})}d.has(t)||(d.set(t,{lastChange:u,cancelWait:()=>(d.delete(t),clearTimeout(c),r)}),c=setTimeout(f,s))}_isIgnored(e,t){if(this.options.atomic&&pe.test(e))return!0;if(!this._userIgnored){let{cwd:e}=this.options,t=(this.options.ignored||[]).map($(e));this._userIgnored=_e([...[...this._ignoredPaths].map($(e)),...t],void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new xe(e,this.options.followSymlinks,this)}_getWatchedDir(t){let n=e.resolve(t);return this._watched.has(n)||this._watched.set(n,new be(n,this._boundRemove)),this._watched.get(n)}_hasReadPermissions(e){return this.options.ignorePermissionErrors?!0:!!(Number(e.mode)&256)}_remove(t,n,r){let i=e.join(t,n),a=e.resolve(i);if(r??=this._watched.has(i)||this._watched.has(a),!this._throttle(`remove`,i,100))return;!r&&this._watched.size===1&&this.add(t,n,!0),this._getWatchedDir(i).getChildren().forEach(e=>this._remove(i,e));let o=this._getWatchedDir(t),s=o.has(n);o.remove(n),this._symlinkPaths.has(a)&&this._symlinkPaths.delete(a);let c=i;if(this.options.cwd&&(c=e.relative(this.options.cwd,i)),this.options.awaitWriteFinish&&this._pendingWrites.has(c)&&this._pendingWrites.get(c).cancelWait()===j.ADD)return;this._watched.delete(i),this._watched.delete(a);let l=r?j.UNLINK_DIR:j.UNLINK;s&&!this._isIgnored(i)&&this._emit(l,i),this._closePath(i)}_closePath(t){this._closeFile(t);let n=e.dirname(t);this._getWatchedDir(n).remove(e.basename(t))}_closeFile(e){let t=this._closers.get(e);t&&(t.forEach(e=>e()),this._closers.delete(e))}_addPathCloser(e,t){if(!t)return;let n=this._closers.get(e);n||(n=[],this._closers.set(e,n)),n.push(t)}_readdirp(e,t){if(this.closed)return;let n=ae(e,{type:j.ALL,alwaysStat:!0,lstat:!0,...t,depth:0});return this._streams.add(n),n.once(`close`,()=>{n=void 0}),n.once(`end`,()=>{n&&=(this._streams.delete(n),void 0)}),n}};function Ce(e,t={}){let n=new Se(t);return n.add(e),n}export{Ce as watch};
|
|
4
|
+
//# sourceMappingURL=chokidar-oNPiNLWX.mjs.map
|