@stryke/fs 0.33.8 → 0.33.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1280 -0
- package/README.md +18 -9
- package/dist/buffer-Ch164vki.cjs +1 -0
- package/dist/buffer-DDq-CW4J.mjs +2 -0
- package/dist/buffer-DDq-CW4J.mjs.map +1 -0
- package/dist/{buffer.d.ts → buffer-DgfUmhrc.d.mts} +8 -4
- package/dist/buffer-DgfUmhrc.d.mts.map +1 -0
- package/dist/buffer-DvCjrjQH.d.cts +32 -0
- package/dist/buffer-DvCjrjQH.d.cts.map +1 -0
- package/dist/buffer.cjs +1 -34
- package/dist/buffer.d.cts +2 -0
- package/dist/buffer.d.mts +2 -0
- package/dist/buffer.mjs +1 -1
- package/dist/{chmod-x.d.ts → chmod-x-BPr4tt2-.d.cts} +10 -6
- package/dist/chmod-x-BPr4tt2-.d.cts.map +1 -0
- package/dist/chmod-x-FOy3sak8.cjs +1 -0
- package/dist/chmod-x-QCk1GmQJ.d.mts +44 -0
- package/dist/chmod-x-QCk1GmQJ.d.mts.map +1 -0
- package/dist/chmod-x-q-TWdus7.mjs +2 -0
- package/dist/chmod-x-q-TWdus7.mjs.map +1 -0
- package/dist/chmod-x.cjs +1 -57
- package/dist/chmod-x.d.cts +2 -0
- package/dist/chmod-x.d.mts +2 -0
- package/dist/chmod-x.mjs +1 -1
- package/dist/chunk-Bmb41Sf3.cjs +1 -0
- package/dist/{command-exists.d.ts → command-exists-CuieR7rx.d.cts} +6 -2
- package/dist/command-exists-CuieR7rx.d.cts.map +1 -0
- package/dist/command-exists-D1bV-wSk.cjs +1 -0
- package/dist/command-exists-Dzb2kKT4.mjs +2 -0
- package/dist/command-exists-Dzb2kKT4.mjs.map +1 -0
- package/dist/command-exists-dBdtR0xj.d.mts +22 -0
- package/dist/command-exists-dBdtR0xj.d.mts.map +1 -0
- package/dist/command-exists.cjs +1 -71
- package/dist/command-exists.d.cts +2 -0
- package/dist/command-exists.d.mts +2 -0
- package/dist/command-exists.mjs +1 -1
- package/dist/compress-BiTxso15.mjs +2 -0
- package/dist/compress-BiTxso15.mjs.map +1 -0
- package/dist/compress-BjGbQqs_.cjs +1 -0
- package/dist/compress-CLAaOwH3.d.mts +16 -0
- package/dist/compress-CLAaOwH3.d.mts.map +1 -0
- package/dist/compress-CQve2a6h.d.cts +16 -0
- package/dist/compress-CQve2a6h.d.cts.map +1 -0
- package/dist/compress.cjs +1 -26
- package/dist/compress.d.cts +2 -0
- package/dist/compress.d.mts +2 -0
- package/dist/compress.mjs +1 -1
- package/dist/constants-D58o2CiO.d.cts +5 -0
- package/dist/constants-D58o2CiO.d.cts.map +1 -0
- package/dist/constants-DZz9LJgo.d.mts +5 -0
- package/dist/constants-DZz9LJgo.d.mts.map +1 -0
- package/dist/constants.cjs +0 -1
- package/dist/constants.d.cts +2 -0
- package/dist/constants.d.mts +2 -0
- package/dist/constants.mjs +1 -0
- package/dist/{copy-file.d.ts → copy-file-B5FJHiIK.d.mts} +11 -5
- package/dist/copy-file-B5FJHiIK.d.mts.map +1 -0
- package/dist/copy-file-Bot2YNtT.mjs +2 -0
- package/dist/copy-file-Bot2YNtT.mjs.map +1 -0
- package/dist/copy-file-DjH2Ho5e.d.cts +39 -0
- package/dist/copy-file-DjH2Ho5e.d.cts.map +1 -0
- package/dist/copy-file-Y1ilzocZ.cjs +1 -0
- package/dist/copy-file.cjs +1 -48
- package/dist/copy-file.d.cts +2 -0
- package/dist/copy-file.d.mts +2 -0
- package/dist/copy-file.mjs +1 -1
- package/dist/cwd-YTg9Cx6C.mjs +2 -0
- package/dist/cwd-YTg9Cx6C.mjs.map +1 -0
- package/dist/cwd-o2vq8Tk9.cjs +1 -0
- package/dist/{exists.d.ts → exists-175EN367.d.mts} +6 -2
- package/dist/exists-175EN367.d.mts.map +1 -0
- package/dist/exists-B31lSRFp.cjs +1 -0
- package/dist/exists-CVlDImzc.d.cts +18 -0
- package/dist/exists-CVlDImzc.d.cts.map +1 -0
- package/dist/exists-Ci-9lYmi.mjs +2 -0
- package/dist/exists-Ci-9lYmi.mjs.map +1 -0
- package/dist/exists.cjs +1 -15
- package/dist/exists.d.cts +2 -0
- package/dist/exists.d.mts +2 -0
- package/dist/exists.mjs +1 -1
- package/dist/file-D1uBqkpP.d.cts +32 -0
- package/dist/file-D1uBqkpP.d.cts.map +1 -0
- package/dist/file-DauFFmfh.d.mts +32 -0
- package/dist/file-DauFFmfh.d.mts.map +1 -0
- package/dist/file-path-fns-7aKacdLg.cjs +1 -0
- package/dist/file-path-fns-BDzC2SIV.mjs +2 -0
- package/dist/file-path-fns-BDzC2SIV.mjs.map +1 -0
- package/dist/get-parent-path-COkh6Pvl.d.mts +32 -0
- package/dist/get-parent-path-COkh6Pvl.d.mts.map +1 -0
- package/dist/get-parent-path-Cbqs2km7.d.cts +32 -0
- package/dist/get-parent-path-Cbqs2km7.d.cts.map +1 -0
- package/dist/get-parent-path-CfRkaB4R.cjs +1 -0
- package/dist/get-parent-path-DLFSyxSW.mjs +2 -0
- package/dist/get-parent-path-DLFSyxSW.mjs.map +1 -0
- package/dist/get-parent-path.cjs +1 -28
- package/dist/get-parent-path.d.cts +2 -0
- package/dist/get-parent-path.d.mts +2 -0
- package/dist/get-parent-path.mjs +1 -1
- package/dist/get-workspace-root-CCNjjZGY.cjs +1 -0
- package/dist/{get-workspace-root.d.ts → get-workspace-root-DQBvBd8X.d.mts} +12 -8
- package/dist/get-workspace-root-DQBvBd8X.d.mts.map +1 -0
- package/dist/get-workspace-root-eTfm1jII.d.cts +48 -0
- package/dist/get-workspace-root-eTfm1jII.d.cts.map +1 -0
- package/dist/get-workspace-root-k66w-wLW.mjs +2 -0
- package/dist/get-workspace-root-k66w-wLW.mjs.map +1 -0
- package/dist/get-workspace-root.cjs +1 -49
- package/dist/get-workspace-root.d.cts +2 -0
- package/dist/get-workspace-root.d.mts +2 -0
- package/dist/get-workspace-root.mjs +1 -1
- package/dist/helpers-BSEQb1fp.mjs +2 -0
- package/dist/helpers-BSEQb1fp.mjs.map +1 -0
- package/dist/{helpers.d.ts → helpers-CYWFZ-Uv.d.mts} +10 -6
- package/dist/helpers-CYWFZ-Uv.d.mts.map +1 -0
- package/dist/helpers-CgMOExPa.d.cts +50 -0
- package/dist/helpers-CgMOExPa.d.cts.map +1 -0
- package/dist/helpers-_MJ6PR-g.cjs +1 -0
- package/dist/helpers.cjs +1 -49
- package/dist/helpers.d.cts +2 -0
- package/dist/helpers.d.mts +2 -0
- package/dist/helpers.mjs +1 -1
- package/dist/index.cjs +1 -269
- package/dist/index.d.cts +25 -0
- package/dist/index.d.mts +25 -0
- package/dist/index.mjs +1 -1
- package/dist/install-B3bIjHoU.mjs +2 -0
- package/dist/install-B3bIjHoU.mjs.map +1 -0
- package/dist/install-CZ_S7NHm.cjs +1 -0
- package/dist/install-CxPsLO2t.d.cts +28 -0
- package/dist/install-CxPsLO2t.d.cts.map +1 -0
- package/dist/install-dYt7hlQn.d.mts +29 -0
- package/dist/install-dYt7hlQn.d.mts.map +1 -0
- package/dist/install.cjs +1 -25
- package/dist/install.d.cts +2 -0
- package/dist/install.d.mts +2 -0
- package/dist/install.mjs +1 -1
- package/dist/is-error-CjEyTRps.cjs +1 -0
- package/dist/is-error-CjVXmD_8.mjs +2 -0
- package/dist/is-error-CjVXmD_8.mjs.map +1 -0
- package/dist/is-file-BkFQev3M.cjs +1 -0
- package/dist/is-file-CNooe8Wz.mjs +2 -0
- package/dist/is-file-CNooe8Wz.mjs.map +1 -0
- package/dist/{is-file.d.ts → is-file-DjqOQrqY.d.mts} +8 -4
- package/dist/is-file-DjqOQrqY.d.mts.map +1 -0
- package/dist/is-file-DoBi2FN9.d.cts +36 -0
- package/dist/is-file-DoBi2FN9.d.cts.map +1 -0
- package/dist/is-file.cjs +1 -29
- package/dist/is-file.d.cts +2 -0
- package/dist/is-file.d.mts +2 -0
- package/dist/is-file.mjs +1 -1
- package/dist/is-object-FBXmvehR.cjs +1 -0
- package/dist/is-object-UsKYhyC5.mjs +2 -0
- package/dist/is-object-UsKYhyC5.mjs.map +1 -0
- package/dist/is-set-string-CLeu8BKX.cjs +1 -0
- package/dist/is-set-string-Cj0g4gsG.mjs +2 -0
- package/dist/is-set-string-Cj0g4gsG.mjs.map +1 -0
- package/dist/is-string-91Z3dOKQ.mjs +2 -0
- package/dist/is-string-91Z3dOKQ.mjs.map +1 -0
- package/dist/is-string-DKgNS0jA.cjs +1 -0
- package/dist/join-paths-BHepkhAj.mjs +2 -0
- package/dist/join-paths-BHepkhAj.mjs.map +1 -0
- package/dist/join-paths-DUdaieID.cjs +1 -0
- package/dist/json-CYenVxvr.d.cts +83 -0
- package/dist/json-CYenVxvr.d.cts.map +1 -0
- package/dist/json-DH7Q6Ftp.d.mts +83 -0
- package/dist/json-DH7Q6Ftp.d.mts.map +1 -0
- package/dist/json-DKhqPjHB.cjs +6 -0
- package/dist/json-Dp4PSH2i.mjs +7 -0
- package/dist/json-Dp4PSH2i.mjs.map +1 -0
- package/dist/json.cjs +1 -41
- package/dist/json.d.cts +2 -0
- package/dist/json.d.mts +2 -0
- package/dist/json.mjs +1 -3
- package/dist/list-files-Cn_UVruo.cjs +1 -0
- package/dist/list-files-D3dQOljX.d.cts +51 -0
- package/dist/list-files-D3dQOljX.d.cts.map +1 -0
- package/dist/list-files-D3iJzEQw.d.mts +51 -0
- package/dist/list-files-D3iJzEQw.d.mts.map +1 -0
- package/dist/list-files-D__uh3tQ.mjs +2 -0
- package/dist/list-files-D__uh3tQ.mjs.map +1 -0
- package/dist/list-files.cjs +1 -55
- package/dist/list-files.d.cts +2 -0
- package/dist/list-files.d.mts +2 -0
- package/dist/list-files.mjs +1 -1
- package/dist/package-fns-BNRi_Rpc.d.cts +354 -0
- package/dist/package-fns-BNRi_Rpc.d.cts.map +1 -0
- package/dist/package-fns-C7-MKgBR.mjs +2 -0
- package/dist/package-fns-C7-MKgBR.mjs.map +1 -0
- package/dist/package-fns-CxokaGDY.d.mts +354 -0
- package/dist/package-fns-CxokaGDY.d.mts.map +1 -0
- package/dist/package-fns-YTCdMAXr.cjs +1 -0
- package/dist/package-fns.cjs +1 -99
- package/dist/package-fns.d.cts +2 -0
- package/dist/package-fns.d.mts +2 -0
- package/dist/package-fns.mjs +1 -1
- package/dist/read-file-B091zB64.mjs +2 -0
- package/dist/read-file-B091zB64.mjs.map +1 -0
- package/dist/read-file-BB2WzW-N.cjs +1 -0
- package/dist/{read-file.d.ts → read-file-Bxn1VHKv.d.cts} +8 -4
- package/dist/read-file-Bxn1VHKv.d.cts.map +1 -0
- package/dist/read-file-CRVW-wcE.d.mts +30 -0
- package/dist/read-file-CRVW-wcE.d.mts.map +1 -0
- package/dist/read-file.cjs +1 -31
- package/dist/read-file.d.cts +2 -0
- package/dist/read-file.d.mts +2 -0
- package/dist/read-file.mjs +1 -1
- package/dist/registry-B1taIPKm.mjs +2 -0
- package/dist/registry-B1taIPKm.mjs.map +1 -0
- package/dist/{registry.d.ts → registry-BQ3JXRFA.d.mts} +17 -13
- package/dist/registry-BQ3JXRFA.d.mts.map +1 -0
- package/dist/registry-BYwvM92u.cjs +1 -0
- package/dist/registry-C2A0Kau7.d.cts +53 -0
- package/dist/registry-C2A0Kau7.d.cts.map +1 -0
- package/dist/registry.cjs +1 -95
- package/dist/registry.d.cts +2 -0
- package/dist/registry.d.mts +2 -0
- package/dist/registry.mjs +1 -1
- package/dist/remove-file-BM64Brdf.mjs +2 -0
- package/dist/remove-file-BM64Brdf.mjs.map +1 -0
- package/dist/remove-file-BqlkL_Df.d.mts +16 -0
- package/dist/remove-file-BqlkL_Df.d.mts.map +1 -0
- package/dist/remove-file-XHFKELQN.cjs +1 -0
- package/dist/remove-file-lQOlxDwr.d.cts +16 -0
- package/dist/remove-file-lQOlxDwr.d.cts.map +1 -0
- package/dist/remove-file.cjs +1 -16
- package/dist/remove-file.d.cts +2 -0
- package/dist/remove-file.d.mts +2 -0
- package/dist/remove-file.mjs +1 -1
- package/dist/resolve-C_YsCFne.mjs +4 -0
- package/dist/resolve-C_YsCFne.mjs.map +1 -0
- package/dist/{resolve.d.ts → resolve-D66oIwjf.d.mts} +33 -29
- package/dist/resolve-D66oIwjf.d.mts.map +1 -0
- package/dist/resolve-DTkLQekH.cjs +3 -0
- package/dist/resolve-DubH-8qd.d.cts +106 -0
- package/dist/resolve-DubH-8qd.d.cts.map +1 -0
- package/dist/resolve-parent-path-CR8av8WP.mjs +2 -0
- package/dist/resolve-parent-path-CR8av8WP.mjs.map +1 -0
- package/dist/resolve-parent-path-D0AaW2PB.cjs +1 -0
- package/dist/resolve.cjs +1 -115
- package/dist/resolve.d.cts +2 -0
- package/dist/resolve.d.mts +2 -0
- package/dist/resolve.mjs +1 -5
- package/dist/{semver-fns.d.ts → semver-fns-B0e5zB6C.d.mts} +17 -11
- package/dist/semver-fns-B0e5zB6C.d.mts.map +1 -0
- package/dist/semver-fns-Btrm1dIF.cjs +1 -0
- package/dist/semver-fns-DjhZXnUw.d.cts +92 -0
- package/dist/semver-fns-DjhZXnUw.d.cts.map +1 -0
- package/dist/semver-fns-F_rYnwDq.mjs +2 -0
- package/dist/semver-fns-F_rYnwDq.mjs.map +1 -0
- package/dist/semver-fns.cjs +1 -40
- package/dist/semver-fns.d.cts +2 -0
- package/dist/semver-fns.d.mts +2 -0
- package/dist/semver-fns.mjs +1 -1
- package/dist/toml-CIgLQmP3.mjs +4 -0
- package/dist/toml-CIgLQmP3.mjs.map +1 -0
- package/dist/toml-D3X2QoaL.d.cts +81 -0
- package/dist/toml-D3X2QoaL.d.cts.map +1 -0
- package/dist/toml-DgVyNp_y.cjs +3 -0
- package/dist/toml-Djau1M6n.d.mts +81 -0
- package/dist/toml-Djau1M6n.d.mts.map +1 -0
- package/dist/toml.cjs +1 -40
- package/dist/toml.d.cts +2 -0
- package/dist/toml.d.mts +2 -0
- package/dist/toml.mjs +1 -3
- package/dist/tsconfig-B13IMV_0.d.mts +812 -0
- package/dist/tsconfig-B13IMV_0.d.mts.map +1 -0
- package/dist/tsconfig-B6WtgD1c.cjs +1 -0
- package/dist/tsconfig-C8ecu1-0.d.cts +812 -0
- package/dist/tsconfig-C8ecu1-0.d.cts.map +1 -0
- package/dist/tsconfig-CqvvSVuX.mjs +2 -0
- package/dist/tsconfig-CqvvSVuX.mjs.map +1 -0
- package/dist/tsconfig.cjs +1 -28
- package/dist/tsconfig.d.cts +2 -0
- package/dist/tsconfig.d.mts +2 -0
- package/dist/tsconfig.mjs +1 -1
- package/dist/write-file-BmvbsmMj.d.cts +35 -0
- package/dist/write-file-BmvbsmMj.d.cts.map +1 -0
- package/dist/write-file-CFByoJkN.mjs +2 -0
- package/dist/write-file-CFByoJkN.mjs.map +1 -0
- package/dist/write-file-CWTzQpb2.d.mts +35 -0
- package/dist/write-file-CWTzQpb2.d.mts.map +1 -0
- package/dist/write-file-CqokudVp.cjs +1 -0
- package/dist/write-file.cjs +1 -26
- package/dist/write-file.d.cts +2 -0
- package/dist/write-file.d.mts +2 -0
- package/dist/write-file.mjs +1 -1
- package/dist/yaml-6uuLoSfT.d.cts +23 -0
- package/dist/yaml-6uuLoSfT.d.cts.map +1 -0
- package/dist/yaml-CLMo56UG.mjs +2 -0
- package/dist/yaml-CLMo56UG.mjs.map +1 -0
- package/dist/yaml-Ddslc5NK.d.mts +23 -0
- package/dist/yaml-Ddslc5NK.d.mts.map +1 -0
- package/dist/yaml-q2k-BjIM.cjs +1 -0
- package/dist/yaml.cjs +1 -15
- package/dist/yaml.d.cts +2 -0
- package/dist/yaml.d.mts +2 -0
- package/dist/yaml.mjs +1 -1
- package/package.json +98 -379
- package/dist/compress.d.ts +0 -11
- package/dist/constants.d.ts +0 -1
- package/dist/get-parent-path.d.ts +0 -28
- package/dist/index.d.ts +0 -32
- package/dist/install.d.ts +0 -24
- package/dist/json.d.ts +0 -49
- package/dist/list-files.d.ts +0 -46
- package/dist/package-fns.d.ts +0 -89
- package/dist/remove-file.d.ts +0 -12
- package/dist/toml.d.ts +0 -77
- package/dist/tsconfig.d.ts +0 -8
- package/dist/write-file.d.ts +0 -30
- package/dist/yaml.d.ts +0 -18
package/README.md
CHANGED
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
<!-- markdownlint-disable -->
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
<div align="center"
|
|
6
|
+
<div align="center">
|
|
7
|
+
<picture>
|
|
8
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x640-dark-optimized.gif">
|
|
9
|
+
<source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x640-light-optimized.gif">
|
|
10
|
+
<img src="https://public.storm-cdn.com/storm-software/banner-1280x640-dark-optimized.gif" width="100%" alt="Storm Software" />
|
|
11
|
+
</picture>
|
|
12
|
+
</div>
|
|
7
13
|
<br />
|
|
8
14
|
|
|
9
15
|
<div align="center">
|
|
@@ -16,13 +22,13 @@
|
|
|
16
22
|
</div>
|
|
17
23
|
|
|
18
24
|
<br />
|
|
19
|
-
This package is part of Storm Software's
|
|
25
|
+
This package is part of Storm Software's **💥 Stryke** monorepo. Stryke packages TypeScript utility packages with shared functionality common to many Storm Software applications.
|
|
20
26
|
|
|
21
27
|
<br />
|
|
22
28
|
|
|
23
29
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
24
30
|
|
|
25
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
26
32
|
|
|
27
33
|
> [!IMPORTANT] Important
|
|
28
34
|
> This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be available through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.
|
|
@@ -95,10 +101,10 @@ yarn add -D @stryke/fs
|
|
|
95
101
|
|
|
96
102
|
## Reduced Package Size
|
|
97
103
|
|
|
98
|
-
This project uses [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
This project uses [tsdown](https://tsdown.dev) to package the source code due to
|
|
105
|
+
its ability to remove unused code and ship smaller javascript files thanks to
|
|
106
|
+
code splitting. This helps to greatly reduce the size of the package and to make
|
|
107
|
+
it easier to use in other projects.
|
|
102
108
|
|
|
103
109
|
## Development
|
|
104
110
|
|
|
@@ -239,10 +245,13 @@ specification. Contributions of any kind welcome!
|
|
|
239
245
|
<br />
|
|
240
246
|
|
|
241
247
|
<hr />
|
|
242
|
-
<br />
|
|
243
248
|
|
|
244
249
|
<div align="center">
|
|
245
|
-
<
|
|
250
|
+
<picture>
|
|
251
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp">
|
|
252
|
+
<source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-light-optimized.webp">
|
|
253
|
+
<img src="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp" width="100%" alt="Storm Software" />
|
|
254
|
+
</picture>
|
|
246
255
|
</div>
|
|
247
256
|
<br />
|
|
248
257
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./file-path-fns-7aKacdLg.cjs`),n=require(`./helpers-_MJ6PR-g.cjs`);let r=require(`node:buffer`),i=require(`node:fs`),a=require(`node:fs/promises`);async function o(e){if(!e)throw Error(`No file path provided to read data`);if(!(0,i.existsSync)(e))throw Error(`File does not exist at path: ${e}`);let t=await(0,a.readFile)(e);return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function s(e){if(!e)throw Error(`No file path provided to read data`);if(!(0,i.existsSync)(e))throw Error(`File does not exist at path: ${e}`);let t=(0,i.readFileSync)(e);return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}async function c(e,o){if(!e)throw Error(`No file path provided to write data`);(0,i.existsSync)(t.r(e))||await n.t(t.r(e)),await(0,a.writeFile)(e,r.Buffer.from(o))}function l(e,a){if(!e)throw Error(`No file path provided to write data`);(0,i.existsSync)(t.r(e))||n.n(t.r(e)),(0,i.writeFileSync)(e,r.Buffer.from(a))}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./file-path-fns-BDzC2SIV.mjs";import{n as t,t as n}from"./helpers-BSEQb1fp.mjs";import{Buffer as r}from"node:buffer";import{existsSync as i,readFileSync as a,writeFileSync as o}from"node:fs";import{readFile as s,writeFile as c}from"node:fs/promises";async function l(e){if(!e)throw Error(`No file path provided to read data`);if(!i(e))throw Error(`File does not exist at path: ${e}`);let t=await s(e);return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function u(e){if(!e)throw Error(`No file path provided to read data`);if(!i(e))throw Error(`File does not exist at path: ${e}`);let t=a(e);return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}async function d(t,a){if(!t)throw Error(`No file path provided to write data`);i(e(t))||await n(e(t)),await c(t,r.from(a))}function f(n,a){if(!n)throw Error(`No file path provided to write data`);i(e(n))||t(e(n)),o(n,r.from(a))}export{f as i,u as n,d as r,l as t};
|
|
2
|
+
//# sourceMappingURL=buffer-DDq-CW4J.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-DDq-CW4J.mjs","names":[],"sources":["../src/buffer.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { findFilePath } from \"@stryke/path\";\nimport { Buffer } from \"node:buffer\";\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { createDirectory, createDirectorySync } from \"./helpers\";\n\n/**\n * Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.\n *\n * @param filePath - The path to the file to read.\n * @returns The content of the file as an ArrayBuffer.\n */\nexport async function readFileBuffer(filePath: string): Promise<ArrayBuffer> {\n if (!filePath) {\n throw new Error(\"No file path provided to read data\");\n }\n if (!existsSync(filePath)) {\n throw new Error(`File does not exist at path: ${filePath}`);\n }\n\n const b = await readFile(filePath);\n\n return b.buffer.slice(\n b.byteOffset,\n b.byteOffset + b.byteLength\n ) as ArrayBuffer;\n}\n\n/**\n * Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.\n *\n * @param filePath - The path to the file to read.\n * @returns The content of the file as an ArrayBuffer.\n */\nexport function readFileBufferSync(filePath: string): ArrayBuffer {\n if (!filePath) {\n throw new Error(\"No file path provided to read data\");\n }\n if (!existsSync(filePath)) {\n throw new Error(`File does not exist at path: ${filePath}`);\n }\n\n const b = readFileSync(filePath);\n\n return b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength);\n}\n\n/**\n * Writes an ArrayBuffer to a file at the specified path.\n *\n * @param filePath - The path to the file where the data should be written.\n * @param data - The ArrayBuffer containing the data to write.\n */\nexport async function writeFileBuffer(filePath: string, data: ArrayBuffer) {\n if (!filePath) {\n throw new Error(\"No file path provided to write data\");\n }\n if (!existsSync(findFilePath(filePath))) {\n await createDirectory(findFilePath(filePath));\n }\n\n await writeFile(filePath, Buffer.from(data));\n}\n\n/**\n * Writes an ArrayBuffer to a file at the specified path.\n *\n * @param filePath - The path to the file where the data should be written.\n * @param data - The ArrayBuffer containing the data to write.\n */\nexport function writeFileBufferSync(filePath: string, data: ArrayBuffer) {\n if (!filePath) {\n throw new Error(\"No file path provided to write data\");\n }\n if (!existsSync(findFilePath(filePath))) {\n createDirectorySync(findFilePath(filePath));\n }\n\n writeFileSync(filePath, Buffer.from(data));\n}\n"],"mappings":"6QA8BA,eAAsB,EAAe,EAAwC,CAC3E,GAAI,CAAC,EACH,MAAU,MAAM,qCAAqC,CAEvD,GAAI,CAAC,EAAW,EAAS,CACvB,MAAU,MAAM,gCAAgC,IAAW,CAG7D,IAAM,EAAI,MAAM,EAAS,EAAS,CAElC,OAAO,EAAE,OAAO,MACd,EAAE,WACF,EAAE,WAAa,EAAE,WAClB,CASH,SAAgB,EAAmB,EAA+B,CAChE,GAAI,CAAC,EACH,MAAU,MAAM,qCAAqC,CAEvD,GAAI,CAAC,EAAW,EAAS,CACvB,MAAU,MAAM,gCAAgC,IAAW,CAG7D,IAAM,EAAI,EAAa,EAAS,CAEhC,OAAO,EAAE,OAAO,MAAM,EAAE,WAAY,EAAE,WAAa,EAAE,WAAW,CASlE,eAAsB,EAAgB,EAAkB,EAAmB,CACzE,GAAI,CAAC,EACH,MAAU,MAAM,sCAAsC,CAEnD,EAAW,EAAa,EAAS,CAAC,EACrC,MAAM,EAAgB,EAAa,EAAS,CAAC,CAG/C,MAAM,EAAU,EAAU,EAAO,KAAK,EAAK,CAAC,CAS9C,SAAgB,EAAoB,EAAkB,EAAmB,CACvE,GAAI,CAAC,EACH,MAAU,MAAM,sCAAsC,CAEnD,EAAW,EAAa,EAAS,CAAC,EACrC,EAAoB,EAAa,EAAS,CAAC,CAG7C,EAAc,EAAU,EAAO,KAAK,EAAK,CAAC"}
|
|
@@ -1,28 +1,32 @@
|
|
|
1
|
+
//#region src/buffer.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.
|
|
3
4
|
*
|
|
4
5
|
* @param filePath - The path to the file to read.
|
|
5
6
|
* @returns The content of the file as an ArrayBuffer.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
declare function readFileBuffer(filePath: string): Promise<ArrayBuffer>;
|
|
8
9
|
/**
|
|
9
10
|
* Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.
|
|
10
11
|
*
|
|
11
12
|
* @param filePath - The path to the file to read.
|
|
12
13
|
* @returns The content of the file as an ArrayBuffer.
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
+
declare function readFileBufferSync(filePath: string): ArrayBuffer;
|
|
15
16
|
/**
|
|
16
17
|
* Writes an ArrayBuffer to a file at the specified path.
|
|
17
18
|
*
|
|
18
19
|
* @param filePath - The path to the file where the data should be written.
|
|
19
20
|
* @param data - The ArrayBuffer containing the data to write.
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
declare function writeFileBuffer(filePath: string, data: ArrayBuffer): Promise<void>;
|
|
22
23
|
/**
|
|
23
24
|
* Writes an ArrayBuffer to a file at the specified path.
|
|
24
25
|
*
|
|
25
26
|
* @param filePath - The path to the file where the data should be written.
|
|
26
27
|
* @param data - The ArrayBuffer containing the data to write.
|
|
27
28
|
*/
|
|
28
|
-
|
|
29
|
+
declare function writeFileBufferSync(filePath: string, data: ArrayBuffer): void;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { writeFileBufferSync as i, readFileBufferSync as n, writeFileBuffer as r, readFileBuffer as t };
|
|
32
|
+
//# sourceMappingURL=buffer-DgfUmhrc.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-DgfUmhrc.d.mts","names":[],"sources":["../src/buffer.ts"],"sourcesContent":[],"mappings":";;AA8BA;AAsBA;AAmBA;AAiBA;;iBA1DsB,cAAA,oBAAkC,QAAQ;;;;;;;iBAsBhD,kBAAA,oBAAsC;;;;;;;iBAmBhC,eAAA,yBAAwC,cAAW;;;;;;;iBAiBzD,mBAAA,yBAA4C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/buffer.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.
|
|
4
|
+
*
|
|
5
|
+
* @param filePath - The path to the file to read.
|
|
6
|
+
* @returns The content of the file as an ArrayBuffer.
|
|
7
|
+
*/
|
|
8
|
+
declare function readFileBuffer(filePath: string): Promise<ArrayBuffer>;
|
|
9
|
+
/**
|
|
10
|
+
* Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.
|
|
11
|
+
*
|
|
12
|
+
* @param filePath - The path to the file to read.
|
|
13
|
+
* @returns The content of the file as an ArrayBuffer.
|
|
14
|
+
*/
|
|
15
|
+
declare function readFileBufferSync(filePath: string): ArrayBuffer;
|
|
16
|
+
/**
|
|
17
|
+
* Writes an ArrayBuffer to a file at the specified path.
|
|
18
|
+
*
|
|
19
|
+
* @param filePath - The path to the file where the data should be written.
|
|
20
|
+
* @param data - The ArrayBuffer containing the data to write.
|
|
21
|
+
*/
|
|
22
|
+
declare function writeFileBuffer(filePath: string, data: ArrayBuffer): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Writes an ArrayBuffer to a file at the specified path.
|
|
25
|
+
*
|
|
26
|
+
* @param filePath - The path to the file where the data should be written.
|
|
27
|
+
* @param data - The ArrayBuffer containing the data to write.
|
|
28
|
+
*/
|
|
29
|
+
declare function writeFileBufferSync(filePath: string, data: ArrayBuffer): void;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { writeFileBufferSync as i, readFileBufferSync as n, writeFileBuffer as r, readFileBuffer as t };
|
|
32
|
+
//# sourceMappingURL=buffer-DvCjrjQH.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-DvCjrjQH.d.cts","names":[],"sources":["../src/buffer.ts"],"sourcesContent":[],"mappings":";;AA8BA;AAsBA;AAmBA;AAiBA;;iBA1DsB,cAAA,oBAAkC,QAAQ;;;;;;;iBAsBhD,kBAAA,oBAAsC;;;;;;;iBAmBhC,eAAA,yBAAwC,cAAW;;;;;;;iBAiBzD,mBAAA,yBAA4C"}
|
package/dist/buffer.cjs
CHANGED
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.readFileBuffer = readFileBuffer;
|
|
7
|
-
exports.readFileBufferSync = readFileBufferSync;
|
|
8
|
-
exports.writeFileBuffer = writeFileBuffer;
|
|
9
|
-
exports.writeFileBufferSync = writeFileBufferSync;
|
|
10
|
-
var _path = require("@stryke/path");
|
|
11
|
-
var _nodeBuffer = require("node:buffer");
|
|
12
|
-
var _nodeFs = require("node:fs");
|
|
13
|
-
var _promises = require("node:fs/promises");
|
|
14
|
-
var _helpers = require("./helpers.cjs");
|
|
15
|
-
async function readFileBuffer(r) {
|
|
16
|
-
if (!r) throw new Error("No file path provided to read data");
|
|
17
|
-
if (!(0, _nodeFs.existsSync)(r)) throw new Error(`File does not exist at path: ${r}`);
|
|
18
|
-
const e = await (0, _promises.readFile)(r);
|
|
19
|
-
return e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);
|
|
20
|
-
}
|
|
21
|
-
function readFileBufferSync(r) {
|
|
22
|
-
if (!r) throw new Error("No file path provided to read data");
|
|
23
|
-
if (!(0, _nodeFs.existsSync)(r)) throw new Error(`File does not exist at path: ${r}`);
|
|
24
|
-
const e = (0, _nodeFs.readFileSync)(r);
|
|
25
|
-
return e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);
|
|
26
|
-
}
|
|
27
|
-
async function writeFileBuffer(r, e) {
|
|
28
|
-
if (!r) throw new Error("No file path provided to write data");
|
|
29
|
-
(0, _nodeFs.existsSync)((0, _path.findFilePath)(r)) || (await (0, _helpers.createDirectory)((0, _path.findFilePath)(r))), await (0, _promises.writeFile)(r, _nodeBuffer.Buffer.from(e));
|
|
30
|
-
}
|
|
31
|
-
function writeFileBufferSync(r, e) {
|
|
32
|
-
if (!r) throw new Error("No file path provided to write data");
|
|
33
|
-
(0, _nodeFs.existsSync)((0, _path.findFilePath)(r)) || (0, _helpers.createDirectorySync)((0, _path.findFilePath)(r)), (0, _nodeFs.writeFileSync)(r, _nodeBuffer.Buffer.from(e));
|
|
34
|
-
}
|
|
1
|
+
require(`./helpers-_MJ6PR-g.cjs`);const e=require(`./buffer-Ch164vki.cjs`);exports.readFileBuffer=e.t,exports.readFileBufferSync=e.n,exports.writeFileBuffer=e.r,exports.writeFileBufferSync=e.i;
|
package/dist/buffer.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"./helpers-BSEQb1fp.mjs";import{i as e,n as t,r as n,t as r}from"./buffer-DDq-CW4J.mjs";export{r as readFileBuffer,t as readFileBufferSync,n as writeFileBuffer,e as writeFileBufferSync};
|
|
@@ -1,40 +1,44 @@
|
|
|
1
|
+
//#region src/chmod-x.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Adds execute permissions to a file
|
|
3
4
|
*
|
|
4
5
|
* @param file - The file to add execute permissions to
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
+
declare function chmodXSync(file: string): void;
|
|
7
8
|
/**
|
|
8
9
|
* Adds execute permissions to a file
|
|
9
10
|
*
|
|
10
11
|
* @param file - The file to add execute permissions to
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
declare function chmodX(file: string): Promise<void>;
|
|
13
14
|
/**
|
|
14
15
|
* Checks the write permission of a file
|
|
15
16
|
*
|
|
16
17
|
* @param filename - The file to check the permission of
|
|
17
18
|
* @returns A promise that resolves to true if the file is writable, false otherwise
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
+
declare function isWritable(filename: string): Promise<boolean>;
|
|
20
21
|
/**
|
|
21
22
|
* Checks the write permission of a file
|
|
22
23
|
*
|
|
23
24
|
* @param filename - The file to check the permission of
|
|
24
25
|
* @returns True if the file is writable, false otherwise
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
+
declare function isWritableSync(filename: string): boolean;
|
|
27
28
|
/**
|
|
28
29
|
* Checks the execute permission of a file
|
|
29
30
|
*
|
|
30
31
|
* @param filename - The file to check the permission of
|
|
31
32
|
* @returns A promise that resolves to true if the file is executable, false otherwise
|
|
32
33
|
*/
|
|
33
|
-
|
|
34
|
+
declare function isExecutable(filename: string): Promise<boolean>;
|
|
34
35
|
/**
|
|
35
36
|
* Checks the execute permission of a file
|
|
36
37
|
*
|
|
37
38
|
* @param filename - The file to check the permission of
|
|
38
39
|
* @returns True if the file is executable, false otherwise
|
|
39
40
|
*/
|
|
40
|
-
|
|
41
|
+
declare function isExecutableSync(filename: string): boolean;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { isWritable as a, isExecutableSync as i, chmodXSync as n, isWritableSync as o, isExecutable as r, chmodX as t };
|
|
44
|
+
//# sourceMappingURL=chmod-x-BPr4tt2-.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chmod-x-BPr4tt2-.d.cts","names":[],"sources":["../src/chmod-x.ts"],"sourcesContent":[],"mappings":";;AA0BA;AAuBA;AAwBA;AAeA;AAesB,iBA7EN,UAAA,CA6EsC,IAAO,EAAA,MAAA,CAAA,EAAA,IAAA;AAe7D;;;;;iBArEsB,MAAA,gBAAmB;;;;;;;iBAwBnB,UAAA,oBAA8B;;;;;;;iBAepC,cAAA;;;;;;;iBAeM,YAAA,oBAAgC;;;;;;;iBAetC,gBAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`node:fs`),n=require(`node:fs/promises`);function r(e){if(process.platform===`win32`)return;let n=(0,t.statSync)(e),r=n.mode|73;n.mode!==r&&(0,t.chmodSync)(e,r.toString(8).slice(-3))}async function i(e){if(process.platform===`win32`)return;let r=(0,t.statSync)(e),i=r.mode|73;if(r.mode!==i)return(0,n.chmod)(e,i.toString(8).slice(-3))}async function a(e){try{return await(0,n.access)(e,t.constants.W_OK),!0}catch{return!1}}function o(e){try{return(0,t.accessSync)(e,t.constants.W_OK),!0}catch{return!1}}async function s(e){try{return await(0,n.access)(e,t.constants.X_OK),!0}catch{return!1}}function c(e){try{return(0,t.accessSync)(e,t.constants.X_OK),!0}catch{return!1}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/chmod-x.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Adds execute permissions to a file
|
|
4
|
+
*
|
|
5
|
+
* @param file - The file to add execute permissions to
|
|
6
|
+
*/
|
|
7
|
+
declare function chmodXSync(file: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Adds execute permissions to a file
|
|
10
|
+
*
|
|
11
|
+
* @param file - The file to add execute permissions to
|
|
12
|
+
*/
|
|
13
|
+
declare function chmodX(file: string): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Checks the write permission of a file
|
|
16
|
+
*
|
|
17
|
+
* @param filename - The file to check the permission of
|
|
18
|
+
* @returns A promise that resolves to true if the file is writable, false otherwise
|
|
19
|
+
*/
|
|
20
|
+
declare function isWritable(filename: string): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Checks the write permission of a file
|
|
23
|
+
*
|
|
24
|
+
* @param filename - The file to check the permission of
|
|
25
|
+
* @returns True if the file is writable, false otherwise
|
|
26
|
+
*/
|
|
27
|
+
declare function isWritableSync(filename: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Checks the execute permission of a file
|
|
30
|
+
*
|
|
31
|
+
* @param filename - The file to check the permission of
|
|
32
|
+
* @returns A promise that resolves to true if the file is executable, false otherwise
|
|
33
|
+
*/
|
|
34
|
+
declare function isExecutable(filename: string): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Checks the execute permission of a file
|
|
37
|
+
*
|
|
38
|
+
* @param filename - The file to check the permission of
|
|
39
|
+
* @returns True if the file is executable, false otherwise
|
|
40
|
+
*/
|
|
41
|
+
declare function isExecutableSync(filename: string): boolean;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { isWritable as a, isExecutableSync as i, chmodXSync as n, isWritableSync as o, isExecutable as r, chmodX as t };
|
|
44
|
+
//# sourceMappingURL=chmod-x-QCk1GmQJ.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chmod-x-QCk1GmQJ.d.mts","names":[],"sources":["../src/chmod-x.ts"],"sourcesContent":[],"mappings":";;AA0BA;AAuBA;AAwBA;AAeA;AAesB,iBA7EN,UAAA,CA6EsC,IAAA,EAAO,MAAA,CAAA,EAAA,IAAA;AAe7D;;;;;iBArEsB,MAAA,gBAAmB;;;;;;;iBAwBnB,UAAA,oBAA8B;;;;;;;iBAepC,cAAA;;;;;;;iBAeM,YAAA,oBAAgC;;;;;;;iBAetC,gBAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{accessSync as e,chmodSync as t,constants as n,statSync as r}from"node:fs";import{access as i,chmod as a}from"node:fs/promises";function o(e){if(process.platform===`win32`)return;let n=r(e),i=n.mode|73;n.mode!==i&&t(e,i.toString(8).slice(-3))}async function s(e){if(process.platform===`win32`)return;let t=r(e),n=t.mode|73;if(t.mode!==n)return a(e,n.toString(8).slice(-3))}async function c(e){try{return await i(e,n.W_OK),!0}catch{return!1}}function l(t){try{return e(t,n.W_OK),!0}catch{return!1}}async function u(e){try{return await i(e,n.X_OK),!0}catch{return!1}}function d(t){try{return e(t,n.X_OK),!0}catch{return!1}}export{c as a,d as i,o as n,l as o,u as r,s as t};
|
|
2
|
+
//# sourceMappingURL=chmod-x-q-TWdus7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chmod-x-q-TWdus7.mjs","names":[],"sources":["../src/chmod-x.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { accessSync, chmodSync, constants, statSync } from \"node:fs\";\nimport { access, chmod } from \"node:fs/promises\";\n\n/**\n * Adds execute permissions to a file\n *\n * @param file - The file to add execute permissions to\n */\nexport function chmodXSync(file: string) {\n // Note: skip for windows as chmod does on exist there\n // and will error with `EACCES: permission denied`\n if (process.platform === \"win32\") {\n return;\n }\n\n const s = statSync(file);\n const newMode = s.mode | 64 | 8 | 1;\n\n if (s.mode === newMode) {\n return;\n }\n const base8 = newMode.toString(8).slice(-3);\n\n chmodSync(file, base8);\n}\n\n/**\n * Adds execute permissions to a file\n *\n * @param file - The file to add execute permissions to\n */\nexport async function chmodX(file: string) {\n // Note: skip for windows as chmod does on exist there\n // and will error with `EACCES: permission denied`\n if (process.platform === \"win32\") {\n return;\n }\n\n const s = statSync(file);\n const newMode = s.mode | 64 | 8 | 1;\n\n if (s.mode === newMode) {\n return;\n }\n const base8 = newMode.toString(8).slice(-3);\n\n return chmod(file, base8);\n}\n\n/**\n * Checks the write permission of a file\n *\n * @param filename - The file to check the permission of\n * @returns A promise that resolves to true if the file is writable, false otherwise\n */\nexport async function isWritable(filename: string): Promise<boolean> {\n try {\n await access(filename, constants.W_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Checks the write permission of a file\n *\n * @param filename - The file to check the permission of\n * @returns True if the file is writable, false otherwise\n */\nexport function isWritableSync(filename: string): boolean {\n try {\n accessSync(filename, constants.W_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Checks the execute permission of a file\n *\n * @param filename - The file to check the permission of\n * @returns A promise that resolves to true if the file is executable, false otherwise\n */\nexport async function isExecutable(filename: string): Promise<boolean> {\n try {\n await access(filename, constants.X_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Checks the execute permission of a file\n *\n * @param filename - The file to check the permission of\n * @returns True if the file is executable, false otherwise\n */\nexport function isExecutableSync(filename: string): boolean {\n try {\n accessSync(filename, constants.X_OK);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":"sIA0BA,SAAgB,EAAW,EAAc,CAGvC,GAAI,QAAQ,WAAa,QACvB,OAGF,IAAM,EAAI,EAAS,EAAK,CAClB,EAAU,EAAE,KAAO,GAErB,EAAE,OAAS,GAKf,EAAU,EAFI,EAAQ,SAAS,EAAE,CAAC,MAAM,GAAG,CAErB,CAQxB,eAAsB,EAAO,EAAc,CAGzC,GAAI,QAAQ,WAAa,QACvB,OAGF,IAAM,EAAI,EAAS,EAAK,CAClB,EAAU,EAAE,KAAO,GAErB,KAAE,OAAS,EAKf,OAAO,EAAM,EAFC,EAAQ,SAAS,EAAE,CAAC,MAAM,GAAG,CAElB,CAS3B,eAAsB,EAAW,EAAoC,CACnE,GAAI,CAEF,OADA,MAAM,EAAO,EAAU,EAAU,KAAK,CAC/B,QACD,CACN,MAAO,IAUX,SAAgB,EAAe,EAA2B,CACxD,GAAI,CAEF,OADA,EAAW,EAAU,EAAU,KAAK,CAC7B,QACD,CACN,MAAO,IAUX,eAAsB,EAAa,EAAoC,CACrE,GAAI,CAEF,OADA,MAAM,EAAO,EAAU,EAAU,KAAK,CAC/B,QACD,CACN,MAAO,IAUX,SAAgB,EAAiB,EAA2B,CAC1D,GAAI,CAEF,OADA,EAAW,EAAU,EAAU,KAAK,CAC7B,QACD,CACN,MAAO"}
|
package/dist/chmod-x.cjs
CHANGED
|
@@ -1,57 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.chmodX = chmodX;
|
|
7
|
-
exports.chmodXSync = chmodXSync;
|
|
8
|
-
exports.isExecutable = isExecutable;
|
|
9
|
-
exports.isExecutableSync = isExecutableSync;
|
|
10
|
-
exports.isWritable = isWritable;
|
|
11
|
-
exports.isWritableSync = isWritableSync;
|
|
12
|
-
var _nodeFs = require("node:fs");
|
|
13
|
-
var _promises = require("node:fs/promises");
|
|
14
|
-
function chmodXSync(t) {
|
|
15
|
-
if (process.platform === "win32") return;
|
|
16
|
-
const r = (0, _nodeFs.statSync)(t),
|
|
17
|
-
n = r.mode | 64 | 8 | 1;
|
|
18
|
-
if (r.mode === n) return;
|
|
19
|
-
const o = n.toString(8).slice(-3);
|
|
20
|
-
(0, _nodeFs.chmodSync)(t, o);
|
|
21
|
-
}
|
|
22
|
-
async function chmodX(t) {
|
|
23
|
-
if (process.platform === "win32") return;
|
|
24
|
-
const r = (0, _nodeFs.statSync)(t),
|
|
25
|
-
n = r.mode | 64 | 8 | 1;
|
|
26
|
-
if (r.mode === n) return;
|
|
27
|
-
const o = n.toString(8).slice(-3);
|
|
28
|
-
return (0, _promises.chmod)(t, o);
|
|
29
|
-
}
|
|
30
|
-
async function isWritable(t) {
|
|
31
|
-
try {
|
|
32
|
-
return await (0, _promises.access)(t, _nodeFs.constants.W_OK), !0;
|
|
33
|
-
} catch {
|
|
34
|
-
return !1;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function isWritableSync(t) {
|
|
38
|
-
try {
|
|
39
|
-
return (0, _nodeFs.accessSync)(t, _nodeFs.constants.W_OK), !0;
|
|
40
|
-
} catch {
|
|
41
|
-
return !1;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async function isExecutable(t) {
|
|
45
|
-
try {
|
|
46
|
-
return await (0, _promises.access)(t, _nodeFs.constants.X_OK), !0;
|
|
47
|
-
} catch {
|
|
48
|
-
return !1;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function isExecutableSync(t) {
|
|
52
|
-
try {
|
|
53
|
-
return (0, _nodeFs.accessSync)(t, _nodeFs.constants.X_OK), !0;
|
|
54
|
-
} catch {
|
|
55
|
-
return !1;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
1
|
+
const e=require(`./chmod-x-FOy3sak8.cjs`);exports.chmodX=e.t,exports.chmodXSync=e.n,exports.isExecutable=e.r,exports.isExecutableSync=e.i,exports.isWritable=e.a,exports.isWritableSync=e.o;
|
package/dist/chmod-x.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"./chmod-x-q-TWdus7.mjs";export{a as chmodX,n as chmodXSync,i as isExecutable,t as isExecutableSync,e as isWritable,r as isWritableSync};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/command-exists.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Asynchronously checks if a command exists in the system.
|
|
3
4
|
*
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
* @param commandName - The name of the command to check for existence
|
|
7
8
|
* @returns A promise that resolves to `true` if the command exists and is executable, `false` otherwise
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
+
declare function commandExists(commandName: string): Promise<void>;
|
|
10
11
|
/**
|
|
11
12
|
* Synchronously checks if a command exists in the system.
|
|
12
13
|
*
|
|
@@ -15,4 +16,7 @@ export declare function commandExists(commandName: string): Promise<void>;
|
|
|
15
16
|
* @param commandName - The name of the command to check for existence
|
|
16
17
|
* @returns `true` if the command exists and is executable, `false` otherwise
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
declare function commandExistsSync(commandName: string): boolean;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { commandExistsSync as n, commandExists as t };
|
|
22
|
+
//# sourceMappingURL=command-exists-CuieR7rx.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-exists-CuieR7rx.d.cts","names":[],"sources":["../src/command-exists.ts"],"sourcesContent":[],"mappings":";;AAuJA;AAqBA;;;;;;iBArBsB,aAAA,uBAAiC;;;;;;;;;iBAqBvC,iBAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`node:fs`),n=require(`node:fs/promises`),r=require(`node:child_process`),i=require(`node:path`);const a=process.platform==`win32`;async function o(e){try{return await(0,n.access)(e,n.constants.F_OK),!1}catch{return!0}}function s(e){try{return(0,t.accessSync)(e,n.constants.F_OK),!1}catch{return!0}}async function c(e){return(0,n.access)(e,n.constants.F_OK|n.constants.X_OK)}function l(e){try{return(0,t.accessSync)(e,n.constants.F_OK|n.constants.X_OK),!0}catch{return!1}}async function u(e,t){await o(e)||((0,r.exec)(`command -v ${t} 2>/dev/null && { echo >&1 ${t}; exit 0; }`),await c(e))}async function d(e,t){/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-z]:)?[^<>:"|?*\n]+$/im.test(e)&&(0,r.exec)(`where ${t}`)}function f(e,t){if(s(e))try{return!!(0,r.execSync)(`command -v ${t} 2>/dev/null && { echo >&1 ${t}; exit 0; }`)}catch{return!1}return l(e)}function p(e,t){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-z]:)?[^<>:"|?*\n]+$/im.test(e))return!1;try{return!!(0,r.execSync)(`where ${t}`,{stdio:[]})}catch{return!1}}function m(e){return/[^\w/:=-]/.test(e)&&(e=`'${e.replace(/'/g,`'\\''`)}'`,e=e.replace(/^(?:'')+/g,``).replace(/\\'''/g,`\\'`)),e}const h=e=>/\\/.test(e)?`"${(0,i.dirname)(e)}:${(0,i.basename)(e)}"`:`"${e}"`;async function g(e){let t=m(e);return typeof Promise<`u`?g(e):a?d(e,t):u(e,t)}function _(e){return a?p(e,h(e)):f(e,m(e))}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return g}});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{accessSync as e}from"node:fs";import{access as t,constants as n}from"node:fs/promises";import{exec as r,execSync as i}from"node:child_process";import{basename as a,dirname as o}from"node:path";const s=process.platform==`win32`;async function c(e){try{return await t(e,n.F_OK),!1}catch{return!0}}function l(t){try{return e(t,n.F_OK),!1}catch{return!0}}async function u(e){return t(e,n.F_OK|n.X_OK)}function d(t){try{return e(t,n.F_OK|n.X_OK),!0}catch{return!1}}async function f(e,t){await c(e)||(r(`command -v ${t} 2>/dev/null && { echo >&1 ${t}; exit 0; }`),await u(e))}async function p(e,t){/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-z]:)?[^<>:"|?*\n]+$/im.test(e)&&r(`where ${t}`)}function m(e,t){if(l(e))try{return!!i(`command -v ${t} 2>/dev/null && { echo >&1 ${t}; exit 0; }`)}catch{return!1}return d(e)}function h(e,t){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-z]:)?[^<>:"|?*\n]+$/im.test(e))return!1;try{return!!i(`where ${t}`,{stdio:[]})}catch{return!1}}function g(e){return/[^\w/:=-]/.test(e)&&(e=`'${e.replace(/'/g,`'\\''`)}'`,e=e.replace(/^(?:'')+/g,``).replace(/\\'''/g,`\\'`)),e}const _=e=>/\\/.test(e)?`"${o(e)}:${a(e)}"`:`"${e}"`;async function v(e){let t=g(e);return typeof Promise<`u`?v(e):s?p(e,t):f(e,t)}function y(e){return s?h(e,_(e)):m(e,g(e))}export{y as n,v as t};
|
|
2
|
+
//# sourceMappingURL=command-exists-Dzb2kKT4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-exists-Dzb2kKT4.mjs","names":["constants"],"sources":["../src/command-exists.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { exec, execSync } from \"node:child_process\";\nimport { accessSync } from \"node:fs\";\nimport { access, constants } from \"node:fs/promises\";\nimport { basename, dirname } from \"node:path\";\n\nconst isUsingWindows = process.platform == \"win32\";\n\nasync function fileNotExists(commandName: string) {\n try {\n await access(commandName, constants.F_OK);\n return false;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return true;\n }\n}\n\nfunction fileNotExistsSync(commandName: string) {\n try {\n accessSync(commandName, constants.F_OK);\n return false;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return true;\n }\n}\n\nasync function localExecutable(commandName: string) {\n return access(commandName, constants.F_OK | constants.X_OK);\n}\n\nfunction localExecutableSync(commandName: string) {\n try {\n accessSync(commandName, constants.F_OK | constants.X_OK);\n return true;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return false;\n }\n}\n\nasync function commandExistsUnix(\n commandName: string,\n cleanedCommandName: string\n) {\n const isFile = await fileNotExists(commandName);\n\n if (!isFile) {\n exec(\n `command -v ${cleanedCommandName} 2>/dev/null` +\n ` && { echo >&1 ${cleanedCommandName}; exit 0; }`\n );\n\n await localExecutable(commandName);\n }\n}\n\nasync function commandExistsWindows(\n commandName: string,\n cleanedCommandName: string\n) {\n // Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator\n if (!/^(?!(?:.*\\s|.*\\.|\\W+)$)(?:[a-z]:)?[^<>:\"|?*\\n]+$/im.test(commandName)) {\n return;\n }\n\n exec(`where ${cleanedCommandName}`);\n}\n\nfunction commandExistsUnixSync(\n commandName: string,\n cleanedCommandName: string\n): boolean {\n if (fileNotExistsSync(commandName)) {\n try {\n const stdout = execSync(\n `command -v ${cleanedCommandName} 2>/dev/null` +\n ` && { echo >&1 ${cleanedCommandName}; exit 0; }`\n );\n\n return !!stdout;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return false;\n }\n }\n return localExecutableSync(commandName);\n}\n\nfunction commandExistsWindowsSync(\n commandName: string,\n cleanedCommandName: string\n) {\n // Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator\n if (!/^(?!(?:.*\\s|.*\\.|\\W+)$)(?:[a-z]:)?[^<>:\"|?*\\n]+$/im.test(commandName)) {\n return false;\n }\n try {\n const stdout = execSync(`where ${cleanedCommandName}`, { stdio: [] });\n\n return !!stdout;\n // eslint-disable-next-line unused-imports/no-unused-vars, ts/no-unused-vars\n } catch (_) {\n return false;\n }\n}\n\nfunction cleanInput(s: string) {\n if (/[^\\w/:=-]/.test(s)) {\n s = `'${s.replace(/'/g, \"'\\\\''\")}'`;\n s = s\n .replace(/^(?:'')+/g, \"\") // un-duplicate single-quote at the beginning\n .replace(/\\\\'''/g, \"\\\\'\"); // remove non-escaped single-quote if there are enclosed between 2 escaped\n }\n return s;\n}\n\nconst cleanWindowsInput = (s: string) => {\n const isPathName = /\\\\/.test(s);\n if (isPathName) {\n return `\"${dirname(s)}:${basename(s)}\"`;\n }\n return `\"${s}\"`;\n};\n\n/**\n * Asynchronously checks if a command exists in the system.\n *\n * @remarks\n * This function will check if the command is available in the system's PATH and if it is executable.\n * @param commandName - The name of the command to check for existence\n * @returns A promise that resolves to `true` if the command exists and is executable, `false` otherwise\n */\nexport async function commandExists(commandName: string) {\n const cleanedCommandName = cleanInput(commandName);\n\n if (typeof Promise !== \"undefined\") {\n return commandExists(commandName);\n }\n if (isUsingWindows) {\n return commandExistsWindows(commandName, cleanedCommandName);\n } else {\n return commandExistsUnix(commandName, cleanedCommandName);\n }\n}\n\n/**\n * Synchronously checks if a command exists in the system.\n *\n * @remarks\n * This function will check if the command is available in the system's PATH and if it is executable.\n * @param commandName - The name of the command to check for existence\n * @returns `true` if the command exists and is executable, `false` otherwise\n */\nexport function commandExistsSync(commandName: string): boolean {\n if (isUsingWindows) {\n return commandExistsWindowsSync(\n commandName,\n cleanWindowsInput(commandName)\n );\n } else {\n return commandExistsUnixSync(commandName, cleanInput(commandName));\n }\n}\n"],"mappings":"wMAuBA,MAAM,EAAiB,QAAQ,UAAY,QAE3C,eAAe,EAAc,EAAqB,CAChD,GAAI,CAEF,OADA,MAAM,EAAO,EAAaA,EAAU,KAAK,CAClC,QAEG,CACV,MAAO,IAIX,SAAS,EAAkB,EAAqB,CAC9C,GAAI,CAEF,OADA,EAAW,EAAaA,EAAU,KAAK,CAChC,QAEG,CACV,MAAO,IAIX,eAAe,EAAgB,EAAqB,CAClD,OAAO,EAAO,EAAaA,EAAU,KAAOA,EAAU,KAAK,CAG7D,SAAS,EAAoB,EAAqB,CAChD,GAAI,CAEF,OADA,EAAW,EAAaA,EAAU,KAAOA,EAAU,KAAK,CACjD,QAEG,CACV,MAAO,IAIX,eAAe,EACb,EACA,EACA,CACe,MAAM,EAAc,EAAY,GAG7C,EACE,cAAc,EAAmB,6BACb,EAAmB,aACxC,CAED,MAAM,EAAgB,EAAY,EAItC,eAAe,EACb,EACA,EACA,CAEK,qDAAqD,KAAK,EAAY,EAI3E,EAAK,SAAS,IAAqB,CAGrC,SAAS,EACP,EACA,EACS,CACT,GAAI,EAAkB,EAAY,CAChC,GAAI,CAMF,MAAO,CAAC,CALO,EACb,cAAc,EAAmB,6BACb,EAAmB,aACxC,MAIS,CACV,MAAO,GAGX,OAAO,EAAoB,EAAY,CAGzC,SAAS,EACP,EACA,EACA,CAEA,GAAI,CAAC,qDAAqD,KAAK,EAAY,CACzE,MAAO,GAET,GAAI,CAGF,MAAO,CAAC,CAFO,EAAS,SAAS,IAAsB,CAAE,MAAO,EAAE,CAAE,CAAC,MAI3D,CACV,MAAO,IAIX,SAAS,EAAW,EAAW,CAO7B,MANI,YAAY,KAAK,EAAE,GACrB,EAAI,IAAI,EAAE,QAAQ,KAAM,QAAQ,CAAC,GACjC,EAAI,EACD,QAAQ,YAAa,GAAG,CACxB,QAAQ,SAAU,MAAM,EAEtB,EAGT,MAAM,EAAqB,GACN,KAAK,KAAK,EAAE,CAEtB,IAAI,EAAQ,EAAE,CAAC,GAAG,EAAS,EAAE,CAAC,GAEhC,IAAI,EAAE,GAWf,eAAsB,EAAc,EAAqB,CACvD,IAAM,EAAqB,EAAW,EAAY,CAQhD,OANE,OAAO,QAAY,IACd,EAAc,EAAY,CAE/B,EACK,EAAqB,EAAa,EAAmB,CAErD,EAAkB,EAAa,EAAmB,CAY7D,SAAgB,EAAkB,EAA8B,CAO5D,OANE,EACK,EACL,EACA,EAAkB,EAAY,CAC/B,CAEM,EAAsB,EAAa,EAAW,EAAY,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/command-exists.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Asynchronously checks if a command exists in the system.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This function will check if the command is available in the system's PATH and if it is executable.
|
|
7
|
+
* @param commandName - The name of the command to check for existence
|
|
8
|
+
* @returns A promise that resolves to `true` if the command exists and is executable, `false` otherwise
|
|
9
|
+
*/
|
|
10
|
+
declare function commandExists(commandName: string): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Synchronously checks if a command exists in the system.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* This function will check if the command is available in the system's PATH and if it is executable.
|
|
16
|
+
* @param commandName - The name of the command to check for existence
|
|
17
|
+
* @returns `true` if the command exists and is executable, `false` otherwise
|
|
18
|
+
*/
|
|
19
|
+
declare function commandExistsSync(commandName: string): boolean;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { commandExistsSync as n, commandExists as t };
|
|
22
|
+
//# sourceMappingURL=command-exists-dBdtR0xj.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-exists-dBdtR0xj.d.mts","names":[],"sources":["../src/command-exists.ts"],"sourcesContent":[],"mappings":";;AAuJA;AAqBA;;;;;;iBArBsB,aAAA,uBAAiC;;;;;;;;;iBAqBvC,iBAAA"}
|
package/dist/command-exists.cjs
CHANGED
|
@@ -1,71 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.commandExists = commandExists;
|
|
7
|
-
exports.commandExistsSync = commandExistsSync;
|
|
8
|
-
var _nodeChild_process = require("node:child_process");
|
|
9
|
-
var _nodeFs = require("node:fs");
|
|
10
|
-
var _promises = require("node:fs/promises");
|
|
11
|
-
var _nodePath = require("node:path");
|
|
12
|
-
const u = process.platform == "win32";
|
|
13
|
-
async function g(t) {
|
|
14
|
-
try {
|
|
15
|
-
return await (0, _promises.access)(t, _promises.constants.F_OK), !1;
|
|
16
|
-
} catch {
|
|
17
|
-
return !0;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function x(t) {
|
|
21
|
-
try {
|
|
22
|
-
return (0, _nodeFs.accessSync)(t, _promises.constants.F_OK), !1;
|
|
23
|
-
} catch {
|
|
24
|
-
return !0;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
async function y(t) {
|
|
28
|
-
return (0, _promises.access)(t, _promises.constants.F_OK | _promises.constants.X_OK);
|
|
29
|
-
}
|
|
30
|
-
function p(t) {
|
|
31
|
-
try {
|
|
32
|
-
return (0, _nodeFs.accessSync)(t, _promises.constants.F_OK | _promises.constants.X_OK), !0;
|
|
33
|
-
} catch {
|
|
34
|
-
return !1;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
async function $(t, n) {
|
|
38
|
-
(await g(t)) || ((0, _nodeChild_process.exec)(`command -v ${n} 2>/dev/null && { echo >&1 ${n}; exit 0; }`), await y(t));
|
|
39
|
-
}
|
|
40
|
-
async function d(t, n) {
|
|
41
|
-
/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-z]:)?[^<>:"|?*\n]+$/im.test(t) && (0, _nodeChild_process.exec)(`where ${n}`);
|
|
42
|
-
}
|
|
43
|
-
function h(t, n) {
|
|
44
|
-
if (x(t)) try {
|
|
45
|
-
return !!(0, _nodeChild_process.execSync)(`command -v ${n} 2>/dev/null && { echo >&1 ${n}; exit 0; }`);
|
|
46
|
-
} catch {
|
|
47
|
-
return !1;
|
|
48
|
-
}
|
|
49
|
-
return p(t);
|
|
50
|
-
}
|
|
51
|
-
function w(t, n) {
|
|
52
|
-
if (!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-z]:)?[^<>:"|?*\n]+$/im.test(t)) return !1;
|
|
53
|
-
try {
|
|
54
|
-
return !!(0, _nodeChild_process.execSync)(`where ${n}`, {
|
|
55
|
-
stdio: []
|
|
56
|
-
});
|
|
57
|
-
} catch {
|
|
58
|
-
return !1;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function a(t) {
|
|
62
|
-
return /[^\w/:=-]/.test(t) && (t = `'${t.replace(/'/g, "'\\''")}'`, t = t.replace(/^(?:'')+/g, "").replace(/\\'''/g, "\\'")), t;
|
|
63
|
-
}
|
|
64
|
-
const _ = t => /\\/.test(t) ? `"${(0, _nodePath.dirname)(t)}:${(0, _nodePath.basename)(t)}"` : `"${t}"`;
|
|
65
|
-
async function commandExists(t) {
|
|
66
|
-
const n = a(t);
|
|
67
|
-
return typeof Promise < "u" ? commandExists(t) : u ? d(t, n) : $(t, n);
|
|
68
|
-
}
|
|
69
|
-
function commandExistsSync(t) {
|
|
70
|
-
return u ? w(t, _(t)) : h(t, a(t));
|
|
71
|
-
}
|
|
1
|
+
const e=require(`./command-exists-D1bV-wSk.cjs`);exports.commandExists=e.t,exports.commandExistsSync=e.n;
|
package/dist/command-exists.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as e,t}from"./command-exists-Dzb2kKT4.mjs";export{t as commandExists,e as commandExistsSync};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./join-paths-BHepkhAj.mjs";import{i as t}from"./file-path-fns-BDzC2SIV.mjs";import{t as n}from"./resolve-parent-path-CR8av8WP.mjs";import{t as r}from"./is-file-CNooe8Wz.mjs";import{i}from"./list-files-D__uh3tQ.mjs";import{n as a}from"./read-file-B091zB64.mjs";import{t as o}from"./write-file-CFByoJkN.mjs";import{createTarGzip as s}from"nanotar";function c(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=t.byteLength;if(n<65535)return String.fromCharCode.apply(null,t);let r=``;for(let e=0;e<n;e++)r+=String.fromCharCode(t[e]);return r}function l(e){return btoa(c(e))}async function u(c,u){let d=await i(r(c)?e(c,`**/*`):c,u),f=await s(await Promise.all(d.map(async e=>({name:e,data:await a(e)}))),{attrs:{group:`storm-software`}});return o(u?.destination?r(u.destination)?e(u.destination,`${new Date().getTime()}.tar.gz`):u.destination:r(c)?`${e(n(c),t(c))}.tar.gz`:c,l(f))}export{u as t};
|
|
2
|
+
//# sourceMappingURL=compress-BiTxso15.mjs.map
|