@stryke/path 0.22.0 → 0.22.8
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 +743 -0
- package/README.md +28 -22
- package/dist/append-BWRdnlxE.cjs +1 -0
- package/dist/{append.d.ts → append-DfRQvWY6.d.cts} +7 -3
- package/dist/append-DfRQvWY6.d.cts.map +1 -0
- package/dist/append-tFFvRN-V.d.mts +38 -0
- package/dist/append-tFFvRN-V.d.mts.map +1 -0
- package/dist/append-xQ5toDGS.mjs +2 -0
- package/dist/append-xQ5toDGS.mjs.map +1 -0
- package/dist/append.cjs +1 -19
- package/dist/append.d.cts +2 -0
- package/dist/append.d.mts +2 -0
- package/dist/append.mjs +1 -1
- package/dist/asset-extensions-BFW_s97B.mjs +2 -0
- package/dist/asset-extensions-BFW_s97B.mjs.map +1 -0
- package/dist/{asset-extensions.d.ts → asset-extensions-D-_39huh.d.cts} +5 -1
- package/dist/asset-extensions-D-_39huh.d.cts.map +1 -0
- package/dist/asset-extensions-DNMkK37t.cjs +1 -0
- package/dist/asset-extensions-DlN384ac.d.mts +11 -0
- package/dist/asset-extensions-DlN384ac.d.mts.map +1 -0
- package/dist/asset-extensions.cjs +1 -7
- package/dist/asset-extensions.d.cts +2 -0
- package/dist/asset-extensions.d.mts +2 -0
- package/dist/asset-extensions.mjs +1 -1
- package/dist/correct-path-B0Y_kOkW.cjs +1 -0
- package/dist/{correct-path.d.ts → correct-path-CwHhpk6I.d.cts} +11 -7
- package/dist/correct-path-CwHhpk6I.d.cts.map +1 -0
- package/dist/correct-path-DmaZHNUF.mjs +2 -0
- package/dist/correct-path-DmaZHNUF.mjs.map +1 -0
- package/dist/correct-path-LC5QqYV-.d.mts +59 -0
- package/dist/correct-path-LC5QqYV-.d.mts.map +1 -0
- package/dist/correct-path.cjs +1 -75
- package/dist/correct-path.d.cts +2 -0
- package/dist/correct-path.d.mts +2 -0
- package/dist/correct-path.mjs +1 -1
- package/dist/{cwd.d.ts → cwd-Bt4NcS-v.d.cts} +5 -1
- package/dist/cwd-Bt4NcS-v.d.cts.map +1 -0
- package/dist/cwd-D66SsPHE.cjs +1 -0
- package/dist/cwd-Dx53cgUn.d.mts +13 -0
- package/dist/cwd-Dx53cgUn.d.mts.map +1 -0
- package/dist/cwd-DxrPG9WB.mjs +2 -0
- package/dist/cwd-DxrPG9WB.mjs.map +1 -0
- package/dist/cwd.cjs +1 -9
- package/dist/cwd.d.cts +2 -0
- package/dist/cwd.d.mts +2 -0
- package/dist/cwd.mjs +1 -1
- package/dist/delimiter-B3nWo9Xn.mjs +2 -0
- package/dist/delimiter-B3nWo9Xn.mjs.map +1 -0
- package/dist/delimiter-BwyCEwu9.d.cts +22 -0
- package/dist/delimiter-BwyCEwu9.d.cts.map +1 -0
- package/dist/delimiter-DuDX7fvN.d.mts +22 -0
- package/dist/delimiter-DuDX7fvN.d.mts.map +1 -0
- package/dist/delimiter-IA9U4fxC.cjs +1 -0
- package/dist/delimiter.cjs +1 -18
- package/dist/delimiter.d.cts +2 -0
- package/dist/delimiter.d.mts +2 -0
- package/dist/delimiter.mjs +1 -1
- package/dist/file-path-fns-B9hKjfA-.cjs +1 -0
- package/dist/{file-path-fns.d.ts → file-path-fns-BKbfZRTB.d.mts} +44 -40
- package/dist/file-path-fns-BKbfZRTB.d.mts.map +1 -0
- package/dist/file-path-fns-CTLJP4j9.d.cts +218 -0
- package/dist/file-path-fns-CTLJP4j9.d.cts.map +1 -0
- package/dist/file-path-fns-MRI3PV8K.mjs +2 -0
- package/dist/file-path-fns-MRI3PV8K.mjs.map +1 -0
- package/dist/file-path-fns.cjs +1 -151
- package/dist/file-path-fns.d.cts +2 -0
- package/dist/file-path-fns.d.mts +2 -0
- package/dist/file-path-fns.mjs +1 -1
- package/dist/find.cjs +1 -16
- package/dist/find.d.cts +2 -0
- package/dist/find.d.mts +2 -0
- package/dist/find.mjs +1 -1
- package/dist/index.cjs +1 -148
- package/dist/index.d.cts +14 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.mjs +1 -1
- package/dist/{is-parent-path.d.ts → is-parent-path-B1EPPZ08.d.cts} +5 -1
- package/dist/is-parent-path-B1EPPZ08.d.cts.map +1 -0
- package/dist/is-parent-path-BW6CsB2o.d.mts +26 -0
- package/dist/is-parent-path-BW6CsB2o.d.mts.map +1 -0
- package/dist/is-parent-path-C0Azmjnd.mjs +2 -0
- package/dist/is-parent-path-C0Azmjnd.mjs.map +1 -0
- package/dist/is-parent-path-ChIi6oAO.cjs +1 -0
- package/dist/is-parent-path.cjs +1 -12
- package/dist/is-parent-path.d.cts +2 -0
- package/dist/is-parent-path.d.mts +2 -0
- package/dist/is-parent-path.mjs +1 -1
- package/dist/is-root-dir-BzQKuwi2.cjs +1 -0
- package/dist/{is-root-dir.d.ts → is-root-dir-CQA1qNI-.d.mts} +5 -1
- package/dist/is-root-dir-CQA1qNI-.d.mts.map +1 -0
- package/dist/is-root-dir-DI5qcnLw.mjs +2 -0
- package/dist/is-root-dir-DI5qcnLw.mjs.map +1 -0
- package/dist/is-root-dir-DnWZlIgB.d.cts +11 -0
- package/dist/is-root-dir-DnWZlIgB.d.cts.map +1 -0
- package/dist/is-root-dir.cjs +1 -9
- package/dist/is-root-dir.d.cts +2 -0
- package/dist/is-root-dir.d.mts +2 -0
- package/dist/is-root-dir.mjs +1 -1
- package/dist/is-type.cjs +1 -31
- package/dist/{is-type.d.ts → is-type.d.cts} +10 -6
- package/dist/is-type.d.cts.map +1 -0
- package/dist/is-type.d.mts +72 -0
- package/dist/is-type.d.mts.map +1 -0
- package/dist/is-type.mjs +1 -1
- package/dist/join-paths-BLjJ0GmK.mjs +2 -0
- package/dist/join-paths-BLjJ0GmK.mjs.map +1 -0
- package/dist/{join-paths.d.ts → join-paths-Bklwf_Bh.d.mts} +6 -2
- package/dist/join-paths-Bklwf_Bh.d.mts.map +1 -0
- package/dist/join-paths-DBTcCEw0.d.cts +13 -0
- package/dist/join-paths-DBTcCEw0.d.cts.map +1 -0
- package/dist/join-paths-hCBPtGlC.cjs +1 -0
- package/dist/join-paths.cjs +1 -60
- package/dist/join-paths.d.cts +2 -0
- package/dist/join-paths.d.mts +2 -0
- package/dist/join-paths.mjs +1 -1
- package/dist/join.cjs +1 -16
- package/dist/join.d.cts +2 -0
- package/dist/join.d.mts +2 -0
- package/dist/join.mjs +1 -1
- package/dist/normalize.cjs +1 -16
- package/dist/normalize.d.cts +2 -0
- package/dist/normalize.d.mts +2 -0
- package/dist/normalize.mjs +1 -1
- package/dist/regex-BEjSq2wo.cjs +1 -0
- package/dist/regex-DHvK8l1E.d.cts +12 -0
- package/dist/regex-DHvK8l1E.d.cts.map +1 -0
- package/dist/regex-fq9t8ABF.d.mts +12 -0
- package/dist/regex-fq9t8ABF.d.mts.map +1 -0
- package/dist/regex-hMUNHeGK.mjs +2 -0
- package/dist/regex-hMUNHeGK.mjs.map +1 -0
- package/dist/regex.cjs +1 -14
- package/dist/regex.d.cts +2 -0
- package/dist/regex.d.mts +2 -0
- package/dist/regex.mjs +1 -1
- package/dist/{replace.d.ts → replace-0nP9MPWp.d.cts} +6 -2
- package/dist/replace-0nP9MPWp.d.cts.map +1 -0
- package/dist/replace-C570sho0.cjs +1 -0
- package/dist/replace-C9dh7bEG.mjs +2 -0
- package/dist/replace-C9dh7bEG.mjs.map +1 -0
- package/dist/replace-fEEM12P3.d.mts +34 -0
- package/dist/replace-fEEM12P3.d.mts.map +1 -0
- package/dist/replace.cjs +1 -17
- package/dist/replace.d.cts +2 -0
- package/dist/replace.d.mts +2 -0
- package/dist/replace.mjs +1 -1
- package/dist/resolve-parent-path-5B4YvR_k.mjs +2 -0
- package/dist/resolve-parent-path-5B4YvR_k.mjs.map +1 -0
- package/dist/resolve-parent-path-D5uwbjqj.d.mts +12 -0
- package/dist/resolve-parent-path-D5uwbjqj.d.mts.map +1 -0
- package/dist/resolve-parent-path-DIrSH2oN.cjs +1 -0
- package/dist/resolve-parent-path-oZQZf2nw.d.cts +12 -0
- package/dist/resolve-parent-path-oZQZf2nw.d.cts.map +1 -0
- package/dist/resolve-parent-path.cjs +1 -13
- package/dist/resolve-parent-path.d.cts +2 -0
- package/dist/resolve-parent-path.d.mts +2 -0
- package/dist/resolve-parent-path.mjs +1 -1
- package/dist/slash-C7xRDucF.mjs +2 -0
- package/dist/slash-C7xRDucF.mjs.map +1 -0
- package/dist/{slash.d.ts → slash-CuA7ERRf.d.mts} +6 -2
- package/dist/slash-CuA7ERRf.d.mts.map +1 -0
- package/dist/slash-DPd6cWOz.d.cts +18 -0
- package/dist/slash-DPd6cWOz.d.cts.map +1 -0
- package/dist/slash-DhzW1Om-.cjs +1 -0
- package/dist/slash.cjs +1 -15
- package/dist/slash.d.cts +2 -0
- package/dist/slash.d.mts +2 -0
- package/dist/slash.mjs +1 -1
- package/package.json +55 -258
- package/dist/delimiter.d.ts +0 -18
- package/dist/find.d.ts +0 -1
- package/dist/index.d.ts +0 -21
- package/dist/join.d.ts +0 -1
- package/dist/normalize.d.ts +0 -1
- package/dist/regex.d.ts +0 -8
- package/dist/resolve-parent-path.d.ts +0 -8
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.
|
|
@@ -47,24 +53,21 @@ NodeJs and browser environments.
|
|
|
47
53
|
|
|
48
54
|
<!-- START doctoc -->
|
|
49
55
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
50
|
-
|
|
51
56
|
## Table of Contents
|
|
52
57
|
|
|
53
|
-
- [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
- [
|
|
57
|
-
- [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
- [Contributing](#contributing)
|
|
67
|
-
- [Contributors](#contributors)
|
|
58
|
+
- [Installing](#installing)
|
|
59
|
+
- [Reduced Package Size](#reduced-package-size)
|
|
60
|
+
- [Development](#development)
|
|
61
|
+
- [Building](#building)
|
|
62
|
+
- [Running unit tests](#running-unit-tests)
|
|
63
|
+
- [Linting](#linting)
|
|
64
|
+
- [Storm Workspaces](#storm-workspaces)
|
|
65
|
+
- [Roadmap](#roadmap)
|
|
66
|
+
- [Support](#support)
|
|
67
|
+
- [License](#license)
|
|
68
|
+
- [Changelog](#changelog)
|
|
69
|
+
- [Contributing](#contributing)
|
|
70
|
+
- [Contributors](#contributors)
|
|
68
71
|
|
|
69
72
|
<!-- END doctoc -->
|
|
70
73
|
|
|
@@ -96,7 +99,7 @@ yarn add -D @stryke/path
|
|
|
96
99
|
|
|
97
100
|
## Reduced Package Size
|
|
98
101
|
|
|
99
|
-
This project uses [
|
|
102
|
+
This project uses [tsdown](https://tsdown.dev) to package the source code
|
|
100
103
|
due to its ability to remove unused code and ship smaller javascript files
|
|
101
104
|
thanks to code splitting. This helps to greatly reduce the size of the package
|
|
102
105
|
and to make it easier to use in other projects.
|
|
@@ -240,10 +243,13 @@ specification. Contributions of any kind welcome!
|
|
|
240
243
|
<br />
|
|
241
244
|
|
|
242
245
|
<hr />
|
|
243
|
-
<br />
|
|
244
246
|
|
|
245
247
|
<div align="center">
|
|
246
|
-
<
|
|
248
|
+
<picture>
|
|
249
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp">
|
|
250
|
+
<source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-light-optimized.webp">
|
|
251
|
+
<img src="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp" width="100%" alt="Storm Software" />
|
|
252
|
+
</picture>
|
|
247
253
|
</div>
|
|
248
254
|
<br />
|
|
249
255
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./cwd-D66SsPHE.cjs`),t=require(`./slash-DhzW1Om-.cjs`),n=require(`./is-parent-path-ChIi6oAO.cjs`),r=require(`./join-paths-hCBPtGlC.cjs`);function i(i,a=e.t()){return t.n(n.t(i,a)?i:r.n(a,i))}const a=i;function o(e,t){return`${e}.${t.replace(/^\./,``)}`}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/append.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* If not already a parent path, append the base path from the beginning of the given child path.
|
|
3
4
|
*
|
|
@@ -14,8 +15,8 @@
|
|
|
14
15
|
* @param parentPath - The parent path to add the {@link childPath} to
|
|
15
16
|
* @returns The {@link parentPath} with the {@link childPath} appended
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
declare function appendPath(childPath: string, parentPath?: string): string;
|
|
19
|
+
declare const append: typeof appendPath;
|
|
19
20
|
/**
|
|
20
21
|
* Append the extension to the given path.
|
|
21
22
|
*
|
|
@@ -31,4 +32,7 @@ export declare const append: typeof appendPath;
|
|
|
31
32
|
* @param extension - The extension to append.
|
|
32
33
|
* @returns The path with the appended extension.
|
|
33
34
|
*/
|
|
34
|
-
|
|
35
|
+
declare function appendExtension(path: string, extension: string): string;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { appendExtension as n, appendPath as r, append as t };
|
|
38
|
+
//# sourceMappingURL=append-DfRQvWY6.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"append-DfRQvWY6.d.cts","names":[],"sources":["../src/append.ts"],"sourcesContent":[],"mappings":";;AAuCA;AAWA;AAiBA;;;;;;;;;;;;;iBA5BgB,UAAA;cAWH,eAAM;;;;;;;;;;;;;;;;iBAiBH,eAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/append.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* If not already a parent path, append the base path from the beginning of the given child path.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* appendPath("src/index.ts", "/home/user/project");
|
|
8
|
+
* // returns "/home/user/project/src/index.ts"
|
|
9
|
+
*
|
|
10
|
+
* appendPath("/user/dev/app.ts", "/user/dev");
|
|
11
|
+
* // returns "/user/dev/app.ts"
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param childPath - The child path to append to the {@link parentPath}
|
|
15
|
+
* @param parentPath - The parent path to add the {@link childPath} to
|
|
16
|
+
* @returns The {@link parentPath} with the {@link childPath} appended
|
|
17
|
+
*/
|
|
18
|
+
declare function appendPath(childPath: string, parentPath?: string): string;
|
|
19
|
+
declare const append: typeof appendPath;
|
|
20
|
+
/**
|
|
21
|
+
* Append the extension to the given path.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* appendExtension("/home/user/project/src/index", ".ts");
|
|
26
|
+
* // returns "/home/user/project/src/index.ts"
|
|
27
|
+
* appendExtension("/home/user/project/src/index.ts", ".js");
|
|
28
|
+
* // returns "/home/user/project/src/index.ts.js"
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param path - The path to append the extension to.
|
|
32
|
+
* @param extension - The extension to append.
|
|
33
|
+
* @returns The path with the appended extension.
|
|
34
|
+
*/
|
|
35
|
+
declare function appendExtension(path: string, extension: string): string;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { appendExtension as n, appendPath as r, append as t };
|
|
38
|
+
//# sourceMappingURL=append-tFFvRN-V.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"append-tFFvRN-V.d.mts","names":[],"sources":["../src/append.ts"],"sourcesContent":[],"mappings":";;AAuCA;AAWA;AAiBA;;;;;;;;;;;;;iBA5BgB,UAAA;cAWH,eAAM;;;;;;;;;;;;;;;;iBAiBH,eAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./cwd-DxrPG9WB.mjs";import{n as t}from"./slash-C7xRDucF.mjs";import{t as n}from"./is-parent-path-C0Azmjnd.mjs";import{n as r}from"./join-paths-BLjJ0GmK.mjs";function i(i,a=e()){return t(n(i,a)?i:r(a,i))}const a=i;function o(e,t){return`${e}.${t.replace(/^\./,``)}`}export{o as n,i as r,a as t};
|
|
2
|
+
//# sourceMappingURL=append-xQ5toDGS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"append-xQ5toDGS.mjs","names":[],"sources":["../src/append.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 { cwd } from \"./cwd\";\nimport { isParentPath } from \"./is-parent-path\";\nimport { joinPaths } from \"./join-paths\";\nimport { slash } from \"./slash\";\n\n/**\n * If not already a parent path, append the base path from the beginning of the given child path.\n *\n * @example\n * ```ts\n * appendPath(\"src/index.ts\", \"/home/user/project\");\n * // returns \"/home/user/project/src/index.ts\"\n *\n * appendPath(\"/user/dev/app.ts\", \"/user/dev\");\n * // returns \"/user/dev/app.ts\"\n * ```\n *\n * @param childPath - The child path to append to the {@link parentPath}\n * @param parentPath - The parent path to add the {@link childPath} to\n * @returns The {@link parentPath} with the {@link childPath} appended\n */\nexport function appendPath(\n childPath: string,\n parentPath: string = cwd()\n): string {\n return slash(\n !isParentPath(childPath, parentPath)\n ? joinPaths(parentPath, childPath)\n : childPath\n );\n}\n\nexport const append = appendPath;\n\n/**\n * Append the extension to the given path.\n *\n * @example\n * ```ts\n * appendExtension(\"/home/user/project/src/index\", \".ts\");\n * // returns \"/home/user/project/src/index.ts\"\n * appendExtension(\"/home/user/project/src/index.ts\", \".js\");\n * // returns \"/home/user/project/src/index.ts.js\"\n * ```\n *\n * @param path - The path to append the extension to.\n * @param extension - The extension to append.\n * @returns The path with the appended extension.\n */\nexport function appendExtension(path: string, extension: string): string {\n return `${path}.${extension.replace(/^\\./, \"\")}`;\n}\n"],"mappings":"gLAuCA,SAAgB,EACd,EACA,EAAqB,GAAK,CAClB,CACR,OAAO,EACJ,EAAa,EAAW,EAAW,CAEhC,EADA,EAAU,EAAY,EAAU,CAErC,CAGH,MAAa,EAAS,EAiBtB,SAAgB,EAAgB,EAAc,EAA2B,CACvE,MAAO,GAAG,EAAK,GAAG,EAAU,QAAQ,MAAO,GAAG"}
|
package/dist/append.cjs
CHANGED
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.append = void 0;
|
|
7
|
-
exports.appendExtension = appendExtension;
|
|
8
|
-
exports.appendPath = appendPath;
|
|
9
|
-
var _cwd = require("./cwd.cjs");
|
|
10
|
-
var _isParentPath = require("./is-parent-path.cjs");
|
|
11
|
-
var _joinPaths = require("./join-paths.cjs");
|
|
12
|
-
var _slash = require("./slash.cjs");
|
|
13
|
-
function appendPath(r, n = (0, _cwd.cwd)()) {
|
|
14
|
-
return (0, _slash.slash)((0, _isParentPath.isParentPath)(r, n) ? r : (0, _joinPaths.joinPaths)(n, r));
|
|
15
|
-
}
|
|
16
|
-
const append = exports.append = appendPath;
|
|
17
|
-
function appendExtension(r, n) {
|
|
18
|
-
return `${r}.${n.replace(/^\./, "")}`;
|
|
19
|
-
}
|
|
1
|
+
const e=require(`./append-BWRdnlxE.cjs`);exports.append=e.t,exports.appendExtension=e.n,exports.appendPath=e.r;
|
package/dist/append.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as e,r as t,t as n}from"./append-xQ5toDGS.mjs";export{n as append,e as appendExtension,t as appendPath};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-extensions-BFW_s97B.mjs","names":[],"sources":["../src/asset-extensions.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\n/**\n * Default asset extensions\n *\n * @remarks\n * For more info please see the {@link https://github.com/facebook/metro/blob/v0.80.10/packages/metro-config/src/defaults/defaults.js#L18-L52 | Metro defaults}\n */\nexport const DEFAULT_ASSET_EXTS = [\n // Image formats\n \"bmp\",\n \"gif\",\n \"jpg\",\n \"jpeg\",\n \"png\",\n \"psd\",\n \"svg\",\n \"webp\",\n // Video formats\n \"m4v\",\n \"mov\",\n \"mp4\",\n \"mpeg\",\n \"mpg\",\n \"webm\",\n // Audio formats\n \"aac\",\n \"aiff\",\n \"caf\",\n \"m4a\",\n \"mp3\",\n \"wav\",\n // Document formats\n \"html\",\n \"pdf\",\n \"yaml\",\n \"yml\",\n // Font formats\n \"otf\",\n \"ttf\",\n // Archives (virtual files)\n \"zip\"\n];\n"],"mappings":"AAwBA,MAAa,EAAqB,+HAkCjC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
//#region src/asset-extensions.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Default asset extensions
|
|
3
4
|
*
|
|
4
5
|
* @remarks
|
|
5
6
|
* For more info please see the {@link https://github.com/facebook/metro/blob/v0.80.10/packages/metro-config/src/defaults/defaults.js#L18-L52 | Metro defaults}
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
declare const DEFAULT_ASSET_EXTS: string[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { DEFAULT_ASSET_EXTS as t };
|
|
11
|
+
//# sourceMappingURL=asset-extensions-D-_39huh.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-extensions-D-_39huh.d.cts","names":[],"sources":["../src/asset-extensions.ts"],"sourcesContent":[],"mappings":";;AAwBA;;;;;cAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`bmp.gif.jpg.jpeg.png.psd.svg.webp.m4v.mov.mp4.mpeg.mpg.webm.aac.aiff.caf.m4a.mp3.wav.html.pdf.yaml.yml.otf.ttf.zip`.split(`.`);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/asset-extensions.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Default asset extensions
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* For more info please see the {@link https://github.com/facebook/metro/blob/v0.80.10/packages/metro-config/src/defaults/defaults.js#L18-L52 | Metro defaults}
|
|
7
|
+
*/
|
|
8
|
+
declare const DEFAULT_ASSET_EXTS: string[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { DEFAULT_ASSET_EXTS as t };
|
|
11
|
+
//# sourceMappingURL=asset-extensions-DlN384ac.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-extensions-DlN384ac.d.mts","names":[],"sources":["../src/asset-extensions.ts"],"sourcesContent":[],"mappings":";;AAwBA;;;;;cAAa"}
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DEFAULT_ASSET_EXTS = void 0;
|
|
7
|
-
const DEFAULT_ASSET_EXTS = exports.DEFAULT_ASSET_EXTS = ["bmp", "gif", "jpg", "jpeg", "png", "psd", "svg", "webp", "m4v", "mov", "mp4", "mpeg", "mpg", "webm", "aac", "aiff", "caf", "m4a", "mp3", "wav", "html", "pdf", "yaml", "yml", "otf", "ttf", "zip"];
|
|
1
|
+
const e=require(`./asset-extensions-DNMkK37t.cjs`);exports.DEFAULT_ASSET_EXTS=e.t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{t as e}from"./asset-extensions-BFW_s97B.mjs";export{e as DEFAULT_ASSET_EXTS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./cwd-D66SsPHE.cjs`),t=require(`./regex-BEjSq2wo.cjs`),n=require(`./slash-DhzW1Om-.cjs`),r=require(`./join-paths-hCBPtGlC.cjs`),i=require(`./append-BWRdnlxE.cjs`);function a(e=``){return e&&n.n(e).replace(t.r,e=>e.toUpperCase())}function o(e){if(!e||e.length===0)return`.`;e=a(e);let r=e.match(t.c),i=n.i(e),o=e.endsWith(`/`);return e=c(e,!i),e.length===0?i?`/`:o?`./`:`.`:(o&&(e+=`/`),t.n.test(e)&&(e+=`/`),r?i?`//${e}`:`//./${e}`:!e.startsWith(`/`)&&i&&!t.n.test(e)?`/${e}`:e)}function s(e){if(!e||e.length===0)return`.`;e=o(e);let t=!1;return e.split(`/`).reduce((e,n)=>n?.trim()?t||n.includes(`*`)?(t=!0,e):e+(e?`/${n}`:n):e,``)}function c(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function l(t,r=e.t()){return n.i(t)?t:n.n(c(i.r(t,r),!0))}function u(t,i=e.t()){return!t||t.length===0?`.`:(t=n.i(t)?n.n(c(t,!0)):n.n(c(r.n(i,t),!0)),t.startsWith(`./`)?t.slice(2):t)}function d(e){let t=o(e);return t.endsWith(`/`)?t:`${t}/`}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/correct-path.d.ts
|
|
2
|
+
declare function normalizeWindowsPath(input?: string): string;
|
|
2
3
|
/**
|
|
3
4
|
* Corrects/normalized a file path.
|
|
4
5
|
*
|
|
5
6
|
* @param path - The path to correct.
|
|
6
7
|
* @returns The corrected path.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
declare function correctPath(path?: string): string;
|
|
9
10
|
/**
|
|
10
11
|
* Remove any star tokens (*) from the end of the file path
|
|
11
12
|
*
|
|
@@ -21,7 +22,7 @@ export declare function correctPath(path?: string): string;
|
|
|
21
22
|
* @param path - The path to correct.
|
|
22
23
|
* @returns The corrected path.
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
|
+
declare function stripStars(path?: string): string;
|
|
25
26
|
/**
|
|
26
27
|
* Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
|
|
27
28
|
*
|
|
@@ -29,7 +30,7 @@ export declare function stripStars(path?: string): string;
|
|
|
29
30
|
* @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
|
|
30
31
|
* @returns the normalize path string.
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
+
declare function normalizeString(path: string, allowAboveRoot: boolean): string;
|
|
33
34
|
/**
|
|
34
35
|
* Converts a given path to an absolute path based on the current working directory.
|
|
35
36
|
*
|
|
@@ -37,7 +38,7 @@ export declare function normalizeString(path: string, allowAboveRoot: boolean):
|
|
|
37
38
|
* @param cwd - The current working directory to use as the base path if the path is not absolute.
|
|
38
39
|
* @returns The absolute path.
|
|
39
40
|
*/
|
|
40
|
-
|
|
41
|
+
declare function toAbsolutePath(path: string, cwd?: string): string;
|
|
41
42
|
/**
|
|
42
43
|
* Converts a given path to a relative path based on the current working directory.
|
|
43
44
|
*
|
|
@@ -45,11 +46,14 @@ export declare function toAbsolutePath(path: string, cwd?: string): string;
|
|
|
45
46
|
* @param cwd - The current working directory to use as the base path if the path is not absolute.
|
|
46
47
|
* @returns The relative path.
|
|
47
48
|
*/
|
|
48
|
-
|
|
49
|
+
declare function toRelativePath(path: string, cwd?: string): string;
|
|
49
50
|
/**
|
|
50
51
|
* Adds a trailing slash to a path if it doesn't already have one.
|
|
51
52
|
*
|
|
52
53
|
* @param path - The path to modify.
|
|
53
54
|
* @returns The modified path with a trailing slash.
|
|
54
55
|
*/
|
|
55
|
-
|
|
56
|
+
declare function withTrailingSlash(path: string): string;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { toAbsolutePath as a, stripStars as i, normalizeString as n, toRelativePath as o, normalizeWindowsPath as r, withTrailingSlash as s, correctPath as t };
|
|
59
|
+
//# sourceMappingURL=correct-path-CwHhpk6I.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correct-path-CwHhpk6I.d.cts","names":[],"sources":["../src/correct-path.ts"],"sourcesContent":[],"mappings":";iBA8BgB,oBAAA;AAAhB;AAcA;AA0DA;AA8BA;AA2EA;AAeA;AAwBgB,iBA1MA,WAAA,CA0MiB,IAAA,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;;;;;;;;;;;;;iBAhJjB,UAAA;;;;;;;;iBA8BA,eAAA;;;;;;;;iBA2EA,cAAA;;;;;;;;iBAeA,cAAA;;;;;;;iBAwBA,iBAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./cwd-DxrPG9WB.mjs";import{c as t,n,r}from"./regex-hMUNHeGK.mjs";import{i,n as a}from"./slash-C7xRDucF.mjs";import{n as o}from"./join-paths-BLjJ0GmK.mjs";import{r as s}from"./append-xQ5toDGS.mjs";function c(e=``){return e&&a(e).replace(r,e=>e.toUpperCase())}function l(e){if(!e||e.length===0)return`.`;e=c(e);let r=e.match(t),a=i(e),o=e.endsWith(`/`);return e=d(e,!a),e.length===0?a?`/`:o?`./`:`.`:(o&&(e+=`/`),n.test(e)&&(e+=`/`),r?a?`//${e}`:`//./${e}`:!e.startsWith(`/`)&&a&&!n.test(e)?`/${e}`:e)}function u(e){if(!e||e.length===0)return`.`;e=l(e);let t=!1;return e.split(`/`).reduce((e,n)=>n?.trim()?t||n.includes(`*`)?(t=!0,e):e+(e?`/${n}`:n):e,``)}function d(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function f(t,n=e()){return i(t)?t:a(d(s(t,n),!0))}function p(t,n=e()){return!t||t.length===0?`.`:(t=i(t)?a(d(t,!0)):a(d(o(n,t),!0)),t.startsWith(`./`)?t.slice(2):t)}function m(e){let t=l(e);return t.endsWith(`/`)?t:`${t}/`}export{f as a,u as i,d as n,p as o,c as r,m as s,l as t};
|
|
2
|
+
//# sourceMappingURL=correct-path-DmaZHNUF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correct-path-DmaZHNUF.mjs","names":["char: string | null","currentDir","cwd"],"sources":["../src/correct-path.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 { appendPath } from \"./append\";\nimport { cwd as currentDir } from \"./cwd\";\nimport { isAbsolutePath } from \"./is-type\";\nimport { joinPaths } from \"./join-paths\";\nimport {\n DRIVE_LETTER_REGEX,\n DRIVE_LETTER_START_REGEX,\n UNC_REGEX\n} from \"./regex\";\nimport { slash } from \"./slash\";\n\n// Util to normalize windows paths to posix\nexport function normalizeWindowsPath(input = \"\") {\n if (!input) {\n return input;\n }\n\n return slash(input).replace(DRIVE_LETTER_START_REGEX, r => r.toUpperCase());\n}\n\n/**\n * Corrects/normalized a file path.\n *\n * @param path - The path to correct.\n * @returns The corrected path.\n */\nexport function correctPath(path?: string) {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n // Normalize windows argument\n path = normalizeWindowsPath(path);\n\n const isUNCPath = path.match(UNC_REGEX);\n const isPathAbsolute = isAbsolutePath(path);\n const trailingSeparator = path.endsWith(\"/\");\n\n // Normalize the path\n path = normalizeString(path, !isPathAbsolute);\n\n if (path.length === 0) {\n if (isPathAbsolute) {\n return \"/\";\n }\n return trailingSeparator ? \"./\" : \".\";\n }\n\n if (trailingSeparator) {\n path += \"/\";\n }\n if (DRIVE_LETTER_REGEX.test(path)) {\n path += \"/\";\n }\n\n if (isUNCPath) {\n if (!isPathAbsolute) {\n return `//./${path}`;\n }\n return `//${path}`;\n }\n\n return !path.startsWith(\"/\") &&\n isPathAbsolute &&\n !DRIVE_LETTER_REGEX.test(path)\n ? `/${path}`\n : path;\n}\n\n/**\n * Remove any star tokens (*) from the end of the file path\n *\n * @example\n * stripStars(\"src/**\") // returns \"src\"\n * stripStars(\"src/*\") // returns \"src\"\n * stripStars(\"src/**\\/*\") // returns \"src\"\n * stripStars(\"src/**\\/*.txt\") // returns \"src\"\n * stripStars(\"src/**\\/file.txt\") // returns \"src\"\n * stripStars(\"src/file.txt\") // returns \"src/file.txt\"\n * stripStars(\"\") // returns \".\"\n *\n * @param path - The path to correct.\n * @returns The corrected path.\n */\nexport function stripStars(path?: string) {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n path = correctPath(path);\n\n let found = false;\n\n return path.split(\"/\").reduce((ret, segment) => {\n if (!segment?.trim()) {\n return ret;\n }\n\n if (found || segment.includes(\"*\")) {\n found = true;\n return ret;\n }\n\n return ret + (ret ? `/${segment}` : segment);\n }, \"\");\n}\n\n/**\n * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.\n *\n * @param path - The path to normalize.\n * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.\n * @returns the normalize path string.\n */\nexport function normalizeString(path: string, allowAboveRoot: boolean) {\n let res = \"\";\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let char: string | null = null;\n for (let index = 0; index <= path.length; ++index) {\n if (index < path.length) {\n // casted because we know it exists thanks to the length check\n char = path[index] as string;\n } else if (char === \"/\") {\n break;\n } else {\n char = \"/\";\n }\n if (char === \"/\") {\n if (lastSlash === index - 1 || dots === 1) {\n // NOOP\n } else if (dots === 2) {\n if (\n res.length < 2 ||\n lastSegmentLength !== 2 ||\n res[res.length - 1] !== \".\" ||\n res[res.length - 2] !== \".\"\n ) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(\"/\");\n if (lastSlashIndex === -1) {\n res = \"\";\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n }\n lastSlash = index;\n dots = 0;\n continue;\n } else if (res.length > 0) {\n res = \"\";\n lastSegmentLength = 0;\n lastSlash = index;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? \"/..\" : \"..\";\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0) {\n res += `/${path.slice(lastSlash + 1, index)}`;\n } else {\n res = path.slice(lastSlash + 1, index);\n }\n lastSegmentLength = index - lastSlash - 1;\n }\n lastSlash = index;\n dots = 0;\n } else if (char === \".\" && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\n/**\n * Converts a given path to an absolute path based on the current working directory.\n *\n * @param path - The path to convert to an absolute path.\n * @param cwd - The current working directory to use as the base path if the path is not absolute.\n * @returns The absolute path.\n */\nexport function toAbsolutePath(path: string, cwd = currentDir()): string {\n if (isAbsolutePath(path)) {\n return path;\n }\n\n return slash(normalizeString(appendPath(path, cwd), true));\n}\n\n/**\n * Converts a given path to a relative path based on the current working directory.\n *\n * @param path - The path to convert to a relative path.\n * @param cwd - The current working directory to use as the base path if the path is not absolute.\n * @returns The relative path.\n */\nexport function toRelativePath(path: string, cwd = currentDir()): string {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n if (isAbsolutePath(path)) {\n path = slash(normalizeString(path, true));\n } else {\n path = slash(normalizeString(joinPaths(cwd, path), true));\n }\n\n if (path.startsWith(\"./\")) {\n return path.slice(2);\n }\n\n return path;\n}\n\n/**\n * Adds a trailing slash to a path if it doesn't already have one.\n *\n * @param path - The path to modify.\n * @returns The modified path with a trailing slash.\n */\nexport function withTrailingSlash(path: string): string {\n const result = correctPath(path);\n\n return result.endsWith(\"/\") ? result : `${result}/`;\n}\n"],"mappings":"uNA8BA,SAAgB,EAAqB,EAAQ,GAAI,CAK/C,OAJK,GAIE,EAAM,EAAM,CAAC,QAAQ,EAA0B,GAAK,EAAE,aAAa,CAAC,CAS7E,SAAgB,EAAY,EAAe,CACzC,GAAI,CAAC,GAAQ,EAAK,SAAW,EAC3B,MAAO,IAIT,EAAO,EAAqB,EAAK,CAEjC,IAAM,EAAY,EAAK,MAAM,EAAU,CACjC,EAAiB,EAAe,EAAK,CACrC,EAAoB,EAAK,SAAS,IAAI,CA0B5C,MAvBA,GAAO,EAAgB,EAAM,CAAC,EAAe,CAEzC,EAAK,SAAW,EACd,EACK,IAEF,EAAoB,KAAO,KAGhC,IACF,GAAQ,KAEN,EAAmB,KAAK,EAAK,GAC/B,GAAQ,KAGN,EACG,EAGE,KAAK,IAFH,OAAO,IAKX,CAAC,EAAK,WAAW,IAAI,EAC1B,GACA,CAAC,EAAmB,KAAK,EAAK,CAC5B,IAAI,IACJ,GAkBN,SAAgB,EAAW,EAAe,CACxC,GAAI,CAAC,GAAQ,EAAK,SAAW,EAC3B,MAAO,IAGT,EAAO,EAAY,EAAK,CAExB,IAAI,EAAQ,GAEZ,OAAO,EAAK,MAAM,IAAI,CAAC,QAAQ,EAAK,IAC7B,GAAS,MAAM,CAIhB,GAAS,EAAQ,SAAS,IAAI,EAChC,EAAQ,GACD,GAGF,GAAO,EAAM,IAAI,IAAY,GAR3B,EASR,GAAG,CAUR,SAAgB,EAAgB,EAAc,EAAyB,CACrE,IAAI,EAAM,GACN,EAAoB,EACpB,EAAY,GACZ,EAAO,EACPA,EAAsB,KAC1B,IAAK,IAAI,EAAQ,EAAG,GAAS,EAAK,OAAQ,EAAE,EAAO,CACjD,GAAI,EAAQ,EAAK,OAEf,EAAO,EAAK,WACH,IAAS,IAClB,WAEA,EAAO,IAET,GAAI,IAAS,IAAK,CAChB,GAAI,MAAc,EAAQ,GAAK,IAAS,GAAG,GAEhC,IAAS,EAAG,CACrB,GACE,EAAI,OAAS,GACb,IAAsB,GACtB,EAAI,EAAI,OAAS,KAAO,KACxB,EAAI,EAAI,OAAS,KAAO,QAEpB,EAAI,OAAS,EAAG,CAClB,IAAM,EAAiB,EAAI,YAAY,IAAI,CACvC,IAAmB,IACrB,EAAM,GACN,EAAoB,IAEpB,EAAM,EAAI,MAAM,EAAG,EAAe,CAClC,EAAoB,EAAI,OAAS,EAAI,EAAI,YAAY,IAAI,EAE3D,EAAY,EACZ,EAAO,EACP,iBACS,EAAI,OAAS,EAAG,CACzB,EAAM,GACN,EAAoB,EACpB,EAAY,EACZ,EAAO,EACP,UAGA,IACF,GAAO,EAAI,OAAS,EAAI,MAAQ,KAChC,EAAoB,QAGlB,EAAI,OAAS,EACf,GAAO,IAAI,EAAK,MAAM,EAAY,EAAG,EAAM,GAE3C,EAAM,EAAK,MAAM,EAAY,EAAG,EAAM,CAExC,EAAoB,EAAQ,EAAY,EAE1C,EAAY,EACZ,EAAO,OACE,IAAS,KAAO,IAAS,GAClC,EAAE,EAEF,EAAO,GAGX,OAAO,EAUT,SAAgB,EAAe,EAAc,EAAMC,GAAY,CAAU,CAKvE,OAJI,EAAe,EAAK,CACf,EAGF,EAAM,EAAgB,EAAW,EAAMC,EAAI,CAAE,GAAK,CAAC,CAU5D,SAAgB,EAAe,EAAc,EAAMD,GAAY,CAAU,CAevE,MAdI,CAAC,GAAQ,EAAK,SAAW,EACpB,KAGT,AAGE,EAHE,EAAe,EAAK,CACf,EAAM,EAAgB,EAAM,GAAK,CAAC,CAElC,EAAM,EAAgB,EAAUC,EAAK,EAAK,CAAE,GAAK,CAAC,CAGvD,EAAK,WAAW,KAAK,CAChB,EAAK,MAAM,EAAE,CAGf,GAST,SAAgB,EAAkB,EAAsB,CACtD,IAAM,EAAS,EAAY,EAAK,CAEhC,OAAO,EAAO,SAAS,IAAI,CAAG,EAAS,GAAG,EAAO"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//#region src/correct-path.d.ts
|
|
2
|
+
declare function normalizeWindowsPath(input?: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Corrects/normalized a file path.
|
|
5
|
+
*
|
|
6
|
+
* @param path - The path to correct.
|
|
7
|
+
* @returns The corrected path.
|
|
8
|
+
*/
|
|
9
|
+
declare function correctPath(path?: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Remove any star tokens (*) from the end of the file path
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* stripStars("src/**") // returns "src"
|
|
15
|
+
* stripStars("src/*") // returns "src"
|
|
16
|
+
* stripStars("src/**\/*") // returns "src"
|
|
17
|
+
* stripStars("src/**\/*.txt") // returns "src"
|
|
18
|
+
* stripStars("src/**\/file.txt") // returns "src"
|
|
19
|
+
* stripStars("src/file.txt") // returns "src/file.txt"
|
|
20
|
+
* stripStars("") // returns "."
|
|
21
|
+
*
|
|
22
|
+
* @param path - The path to correct.
|
|
23
|
+
* @returns The corrected path.
|
|
24
|
+
*/
|
|
25
|
+
declare function stripStars(path?: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
|
|
28
|
+
*
|
|
29
|
+
* @param path - The path to normalize.
|
|
30
|
+
* @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
|
|
31
|
+
* @returns the normalize path string.
|
|
32
|
+
*/
|
|
33
|
+
declare function normalizeString(path: string, allowAboveRoot: boolean): string;
|
|
34
|
+
/**
|
|
35
|
+
* Converts a given path to an absolute path based on the current working directory.
|
|
36
|
+
*
|
|
37
|
+
* @param path - The path to convert to an absolute path.
|
|
38
|
+
* @param cwd - The current working directory to use as the base path if the path is not absolute.
|
|
39
|
+
* @returns The absolute path.
|
|
40
|
+
*/
|
|
41
|
+
declare function toAbsolutePath(path: string, cwd?: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Converts a given path to a relative path based on the current working directory.
|
|
44
|
+
*
|
|
45
|
+
* @param path - The path to convert to a relative path.
|
|
46
|
+
* @param cwd - The current working directory to use as the base path if the path is not absolute.
|
|
47
|
+
* @returns The relative path.
|
|
48
|
+
*/
|
|
49
|
+
declare function toRelativePath(path: string, cwd?: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Adds a trailing slash to a path if it doesn't already have one.
|
|
52
|
+
*
|
|
53
|
+
* @param path - The path to modify.
|
|
54
|
+
* @returns The modified path with a trailing slash.
|
|
55
|
+
*/
|
|
56
|
+
declare function withTrailingSlash(path: string): string;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { toAbsolutePath as a, stripStars as i, normalizeString as n, toRelativePath as o, normalizeWindowsPath as r, withTrailingSlash as s, correctPath as t };
|
|
59
|
+
//# sourceMappingURL=correct-path-LC5QqYV-.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correct-path-LC5QqYV-.d.mts","names":[],"sources":["../src/correct-path.ts"],"sourcesContent":[],"mappings":";iBA8BgB,oBAAA;AAAhB;AAcA;AA0DA;AA8BA;AA2EA;AAeA;AAwBgB,iBA1MA,WAAA,CA0MiB,IAAA,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;;;;;;;;;;;;;iBAhJjB,UAAA;;;;;;;;iBA8BA,eAAA;;;;;;;;iBA2EA,cAAA;;;;;;;;iBAeA,cAAA;;;;;;;iBAwBA,iBAAA"}
|
package/dist/correct-path.cjs
CHANGED
|
@@ -1,75 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.correctPath = correctPath;
|
|
7
|
-
exports.normalizeString = normalizeString;
|
|
8
|
-
exports.normalizeWindowsPath = normalizeWindowsPath;
|
|
9
|
-
exports.stripStars = stripStars;
|
|
10
|
-
exports.toAbsolutePath = toAbsolutePath;
|
|
11
|
-
exports.toRelativePath = toRelativePath;
|
|
12
|
-
exports.withTrailingSlash = withTrailingSlash;
|
|
13
|
-
var _append = require("./append.cjs");
|
|
14
|
-
var _cwd = require("./cwd.cjs");
|
|
15
|
-
var _isType = require("./is-type.cjs");
|
|
16
|
-
var _joinPaths = require("./join-paths.cjs");
|
|
17
|
-
var _regex = require("./regex.cjs");
|
|
18
|
-
var _slash = require("./slash.cjs");
|
|
19
|
-
function normalizeWindowsPath(e = "") {
|
|
20
|
-
return e && (0, _slash.slash)(e).replace(_regex.DRIVE_LETTER_START_REGEX, t => t.toUpperCase());
|
|
21
|
-
}
|
|
22
|
-
function correctPath(e) {
|
|
23
|
-
if (!e || e.length === 0) return ".";
|
|
24
|
-
e = normalizeWindowsPath(e);
|
|
25
|
-
const t = e.match(_regex.UNC_REGEX),
|
|
26
|
-
r = (0, _isType.isAbsolutePath)(e),
|
|
27
|
-
n = e.endsWith("/");
|
|
28
|
-
return e = normalizeString(e, !r), e.length === 0 ? r ? "/" : n ? "./" : "." : (n && (e += "/"), _regex.DRIVE_LETTER_REGEX.test(e) && (e += "/"), t ? r ? `//${e}` : `//./${e}` : !e.startsWith("/") && r && !_regex.DRIVE_LETTER_REGEX.test(e) ? `/${e}` : e);
|
|
29
|
-
}
|
|
30
|
-
function stripStars(e) {
|
|
31
|
-
if (!e || e.length === 0) return ".";
|
|
32
|
-
e = correctPath(e);
|
|
33
|
-
let t = !1;
|
|
34
|
-
return e.split("/").reduce((r, n) => n?.trim() ? t || n.includes("*") ? (t = !0, r) : r + (r ? `/${n}` : n) : r, "");
|
|
35
|
-
}
|
|
36
|
-
function normalizeString(e, t) {
|
|
37
|
-
let r = "",
|
|
38
|
-
n = 0,
|
|
39
|
-
l = -1,
|
|
40
|
-
s = 0,
|
|
41
|
-
o = null;
|
|
42
|
-
for (let i = 0; i <= e.length; ++i) {
|
|
43
|
-
if (i < e.length) o = e[i];else {
|
|
44
|
-
if (o === "/") break;
|
|
45
|
-
o = "/";
|
|
46
|
-
}
|
|
47
|
-
if (o === "/") {
|
|
48
|
-
if (!(l === i - 1 || s === 1)) if (s === 2) {
|
|
49
|
-
if (r.length < 2 || n !== 2 || r[r.length - 1] !== "." || r[r.length - 2] !== ".") {
|
|
50
|
-
if (r.length > 2) {
|
|
51
|
-
const c = r.lastIndexOf("/");
|
|
52
|
-
c === -1 ? (r = "", n = 0) : (r = r.slice(0, c), n = r.length - 1 - r.lastIndexOf("/")), l = i, s = 0;
|
|
53
|
-
continue;
|
|
54
|
-
} else if (r.length > 0) {
|
|
55
|
-
r = "", n = 0, l = i, s = 0;
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
t && (r += r.length > 0 ? "/.." : "..", n = 2);
|
|
60
|
-
} else r.length > 0 ? r += `/${e.slice(l + 1, i)}` : r = e.slice(l + 1, i), n = i - l - 1;
|
|
61
|
-
l = i, s = 0;
|
|
62
|
-
} else o === "." && s !== -1 ? ++s : s = -1;
|
|
63
|
-
}
|
|
64
|
-
return r;
|
|
65
|
-
}
|
|
66
|
-
function toAbsolutePath(e, t = (0, _cwd.cwd)()) {
|
|
67
|
-
return (0, _isType.isAbsolutePath)(e) ? e : (0, _slash.slash)(normalizeString((0, _append.appendPath)(e, t), !0));
|
|
68
|
-
}
|
|
69
|
-
function toRelativePath(e, t = (0, _cwd.cwd)()) {
|
|
70
|
-
return !e || e.length === 0 ? "." : ((0, _isType.isAbsolutePath)(e) ? e = (0, _slash.slash)(normalizeString(e, !0)) : e = (0, _slash.slash)(normalizeString((0, _joinPaths.joinPaths)(t, e), !0)), e.startsWith("./") ? e.slice(2) : e);
|
|
71
|
-
}
|
|
72
|
-
function withTrailingSlash(e) {
|
|
73
|
-
const t = correctPath(e);
|
|
74
|
-
return t.endsWith("/") ? t : `${t}/`;
|
|
75
|
-
}
|
|
1
|
+
const e=require(`./correct-path-B0Y_kOkW.cjs`);exports.correctPath=e.t,exports.normalizeString=e.n,exports.normalizeWindowsPath=e.r,exports.stripStars=e.i,exports.toAbsolutePath=e.a,exports.toRelativePath=e.o,exports.withTrailingSlash=e.s;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as toAbsolutePath, i as stripStars, n as normalizeString, o as toRelativePath, r as normalizeWindowsPath, s as withTrailingSlash, t as correctPath } from "./correct-path-CwHhpk6I.cjs";
|
|
2
|
+
export { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as toAbsolutePath, i as stripStars, n as normalizeString, o as toRelativePath, r as normalizeWindowsPath, s as withTrailingSlash, t as correctPath } from "./correct-path-LC5QqYV-.mjs";
|
|
2
|
+
export { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash };
|
package/dist/correct-path.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./correct-path-DmaZHNUF.mjs";export{o as correctPath,n as normalizeString,i as normalizeWindowsPath,t as stripStars,e as toAbsolutePath,r as toRelativePath,a as withTrailingSlash};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/cwd.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Get the current working directory.
|
|
3
4
|
*
|
|
@@ -6,4 +7,7 @@
|
|
|
6
7
|
*
|
|
7
8
|
* @returns The current working directory or '/' if it cannot be determined
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
+
declare function cwd(): string;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { cwd as t };
|
|
13
|
+
//# sourceMappingURL=cwd-Bt4NcS-v.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cwd-Bt4NcS-v.d.cts","names":[],"sources":["../src/cwd.ts"],"sourcesContent":[],"mappings":";;AA0BA;;;;;;;iBAAgB,GAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/cwd.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Get the current working directory.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This function attempts to retrieve the current working directory using `process.cwd()`.
|
|
7
|
+
*
|
|
8
|
+
* @returns The current working directory or '/' if it cannot be determined
|
|
9
|
+
*/
|
|
10
|
+
declare function cwd(): string;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { cwd as t };
|
|
13
|
+
//# sourceMappingURL=cwd-Dx53cgUn.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cwd-Dx53cgUn.d.mts","names":[],"sources":["../src/cwd.ts"],"sourcesContent":[],"mappings":";;AA0BA;;;;;;;iBAAgB,GAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cwd-DxrPG9WB.mjs","names":[],"sources":["../src/cwd.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\n/**\n * Get the current working directory.\n *\n * @remarks\n * This function attempts to retrieve the current working directory using `process.cwd()`.\n *\n * @returns The current working directory or '/' if it cannot be determined\n */\nexport function cwd() {\n if (typeof process !== \"undefined\" && typeof process.cwd === \"function\") {\n return process.cwd().replace(/\\\\/g, \"/\");\n }\n return \"/\";\n}\n"],"mappings":"AA0BA,SAAgB,GAAM,CAIpB,OAHI,OAAO,QAAY,KAAe,OAAO,QAAQ,KAAQ,WACpD,QAAQ,KAAK,CAAC,QAAQ,MAAO,IAAI,CAEnC"}
|
package/dist/cwd.cjs
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.cwd = cwd;
|
|
7
|
-
function cwd() {
|
|
8
|
-
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
9
|
-
}
|
|
1
|
+
const e=require(`./cwd-D66SsPHE.cjs`);exports.cwd=e.t;
|