@stacksjs/path 0.38.3

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2022 Open Web Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # Stacks Path
2
+
3
+ Easily work with file paths.
4
+
5
+ ## โ˜˜๏ธ Features
6
+
7
+ - Ensures paths are normalized across all Operating Systems
8
+ - Easily access the path's basename, dirname, extension, filename, and more
9
+ - Drop-in Node.js module replacement
10
+ - Written in modern ESM/TypeScript
11
+
12
+ ## ๐Ÿค– Usage
13
+
14
+ ```bash
15
+ pnpm i -D @stacksjs/path
16
+ ```
17
+
18
+ Now, you can easily access it in your project:
19
+
20
+ ```js
21
+ import { filename, normalizeAliases, resolve, resolveAlias } from '@stacksjs/path'
22
+
23
+ // and more...
24
+ ```
25
+
26
+ To view the full documentation, please visit [https://stacksjs.dev/path](https://stacksjs.dev/path).
27
+
28
+ ## ๐Ÿงช Testing
29
+
30
+ ```bash
31
+ pnpm test
32
+ ```
33
+
34
+ ## ๐Ÿ“ˆ Changelog
35
+
36
+ Please see our [releases](https://github.com/stacksjs/stacks/releases) page for more information on what has changed recently.
37
+
38
+ ## ๐Ÿ’ช๐Ÿผ Contributing
39
+
40
+ Please see [CONTRIBUTING](../../.github/CONTRIBUTING.md) for details.
41
+
42
+ ## ๐Ÿ Community
43
+
44
+ For help, discussion about best practices, or any other conversation that would benefit from being searchable:
45
+
46
+ [Discussions on GitHub](https://github.com/stacksjs/stacks/discussions)
47
+
48
+ For casual chit-chat with others using this package:
49
+
50
+ [Join the Open Web Discord Server](https://discord.ow3.org)
51
+
52
+ ## ๐Ÿ™๐Ÿผ Credits
53
+
54
+ Many thanks to the following core technologies & people who have contributed to this package:
55
+
56
+ - [pathe](https://github.com/unjs/pathe)
57
+ - [Chris Breuer](https://github.com/chrisbbreuer)
58
+ - [All Contributors](../../contributors)
59
+
60
+ ## ๐Ÿ“„ License
61
+
62
+ The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
63
+
64
+ Made with โค๏ธ
@@ -0,0 +1,132 @@
1
+ import { basename, delimiter, dirname, extname, format, isAbsolute, join, normalize, normalizeString, parse, relative, resolve, sep, toNamespacedPath } from 'pathe';
2
+ /**
3
+ * Returns the path to the `actions` directory. The actions directory
4
+ * contains the core Stacks' actions. An action
5
+ *
6
+ * @param path string - relative path to the file or directory
7
+ * @returns string - absolute path to the file or directory
8
+ * @example
9
+ * ```ts
10
+ * import { buildPath } from '@stacks/paths'
11
+ *
12
+ * buildPath('functions.vue')
13
+ * buildPath('any-path.ts')
14
+ * ```
15
+ */
16
+ export declare function actionsPath(path?: string): any;
17
+ export declare function aliasPath(): any;
18
+ export declare function runtimePath(path?: string): any;
19
+ export declare function arraysPath(path?: string): any;
20
+ export declare function authPath(path?: string): any;
21
+ /**
22
+ * Returns the path to the build directory. The build directory
23
+ * contains Stacks' build engine & its tooling integrations.
24
+ *
25
+ * @param path string - relative path to the file or directory
26
+ * @returns string - absolute path to the file or directory
27
+ * @example
28
+ * ```ts
29
+ * buildPath('functions.vue')
30
+ * buildPath('vue-components.ts')
31
+ * ```
32
+ */
33
+ export declare function buildPath(path?: string): any;
34
+ export declare function buildEnginePath(path?: string): any;
35
+ export declare function buildEntriesPath(path?: string): any;
36
+ export declare function cachePath(path?: string): any;
37
+ export declare function cliPath(path?: string): any;
38
+ export declare function collectionsPath(path?: string): any;
39
+ export declare function componentsPath(path?: string): any;
40
+ export declare function configPath(): any;
41
+ export declare function corePath(path?: string): any;
42
+ export declare function docsPath(path?: string): any;
43
+ export declare function customElementsDataPath(): any;
44
+ export declare function errorsPath(path?: string): any;
45
+ export declare function examplesPath(type: 'vue-components' | 'web-components'): any;
46
+ export declare function frameworkPath(path?: string): any;
47
+ export declare function fsPath(path?: string): any;
48
+ export declare function functionsPath(path?: string): any;
49
+ export declare function gitPath(path?: string): any;
50
+ export declare function langPath(path?: string): any;
51
+ export declare function libraryEntryPath(type: 'vue-components' | 'web-components' | 'functions'): any;
52
+ export declare function lintPath(path?: string): any;
53
+ export declare function loggingPath(path?: string): any;
54
+ export declare function modulesPath(path?: string): any;
55
+ export declare function objectsPath(path?: string): any;
56
+ export declare function packageJsonPath(type: 'vue-components' | 'web-components' | 'functions'): any;
57
+ export declare function pagesPath(path?: string): any;
58
+ export declare function pathPath(path?: string): any;
59
+ export declare function projectPath(filePath?: string): any;
60
+ export declare function routerPath(path?: string): any;
61
+ export declare function routesPath(path?: string): any;
62
+ export declare function securityPath(path?: string): any;
63
+ export declare function serverPath(path?: string): any;
64
+ export declare function serverlessPath(path?: string): any;
65
+ export declare function stacksPath(path?: string): any;
66
+ export declare function testsPath(path?: string): any;
67
+ export declare function typesPath(path?: string): any;
68
+ export declare function stringsPath(path?: string): any;
69
+ export declare function scriptsPath(path?: string): any;
70
+ export declare function uiPath(path?: string): any;
71
+ export declare function utilsPath(path?: string): any;
72
+ export declare const path: {
73
+ actionsPath: typeof actionsPath;
74
+ aliasPath: typeof aliasPath;
75
+ arraysPath: typeof arraysPath;
76
+ authPath: typeof authPath;
77
+ buildEnginePath: typeof buildEnginePath;
78
+ buildEntriesPath: typeof buildEntriesPath;
79
+ buildPath: typeof buildPath;
80
+ cachePath: typeof cachePath;
81
+ cliPath: typeof cliPath;
82
+ collectionsPath: typeof collectionsPath;
83
+ componentsPath: typeof componentsPath;
84
+ configPath: typeof configPath;
85
+ corePath: typeof corePath;
86
+ customElementsDataPath: typeof customElementsDataPath;
87
+ docsPath: typeof docsPath;
88
+ errorsPath: typeof errorsPath;
89
+ examplesPath: typeof examplesPath;
90
+ frameworkPath: typeof frameworkPath;
91
+ fsPath: typeof fsPath;
92
+ functionsPath: typeof functionsPath;
93
+ gitPath: typeof gitPath;
94
+ langPath: typeof langPath;
95
+ libraryEntryPath: typeof libraryEntryPath;
96
+ lintPath: typeof lintPath;
97
+ loggingPath: typeof loggingPath;
98
+ modulesPath: typeof modulesPath;
99
+ objectsPath: typeof objectsPath;
100
+ packageJsonPath: typeof packageJsonPath;
101
+ pagesPath: typeof pagesPath;
102
+ pathPath: typeof pathPath;
103
+ projectPath: typeof projectPath;
104
+ routerPath: typeof routerPath;
105
+ routesPath: typeof routesPath;
106
+ scriptsPath: typeof scriptsPath;
107
+ securityPath: typeof securityPath;
108
+ serverPath: typeof serverPath;
109
+ serverlessPath: typeof serverlessPath;
110
+ stacksPath: typeof stacksPath;
111
+ stringsPath: typeof stringsPath;
112
+ testsPath: typeof testsPath;
113
+ typesPath: typeof typesPath;
114
+ uiPath: typeof uiPath;
115
+ utilsPath: typeof utilsPath;
116
+ basename: any;
117
+ delimiter: string;
118
+ dirname: any;
119
+ extname: any;
120
+ format: any;
121
+ isAbsolute: any;
122
+ join: any;
123
+ normalize: any;
124
+ normalizeString: typeof normalizeString;
125
+ parse: any;
126
+ relative: any;
127
+ resolve: any;
128
+ sep: string;
129
+ toNamespacedPath: any;
130
+ };
131
+ export { basename, delimiter, dirname, extname, format, isAbsolute, join, normalize, normalizeString, parse, relative, resolve, sep, toNamespacedPath };
132
+ export default path;
package/dist/index.mjs ADDED
@@ -0,0 +1,209 @@
1
+ import { basename, delimiter, dirname, extname, format, isAbsolute, join, normalize, normalizeString, parse, relative, resolve, sep, toNamespacedPath } from "pathe";
2
+ export function actionsPath(path2) {
3
+ return corePath(`actions/${path2 || ""}`);
4
+ }
5
+ export function aliasPath() {
6
+ return runtimePath("alias.ts");
7
+ }
8
+ export function runtimePath(path2) {
9
+ return corePath(`runtime/${path2 || ""}`);
10
+ }
11
+ export function arraysPath(path2) {
12
+ return corePath(`arrays/${path2 || ""}`);
13
+ }
14
+ export function authPath(path2) {
15
+ return corePath(`auth/${path2 || ""}`);
16
+ }
17
+ export function buildPath(path2) {
18
+ return corePath(`build/${path2 || ""}`);
19
+ }
20
+ export function buildEnginePath(path2) {
21
+ return buildPath(`${path2 || ""}`);
22
+ }
23
+ export function buildEntriesPath(path2) {
24
+ return buildPath(`entries/${path2 || ""}`);
25
+ }
26
+ export function cachePath(path2) {
27
+ return corePath(`cache/${path2 || ""}`);
28
+ }
29
+ export function cliPath(path2) {
30
+ return corePath(`cli/${path2 || ""}`);
31
+ }
32
+ export function collectionsPath(path2) {
33
+ return corePath(`collections/${path2 || ""}`);
34
+ }
35
+ export function componentsPath(path2) {
36
+ return projectPath(`components/${path2 || ""}`);
37
+ }
38
+ export function configPath() {
39
+ return frameworkPath("config.ts");
40
+ }
41
+ export function corePath(path2) {
42
+ return frameworkPath(`core/${path2 || ""}`);
43
+ }
44
+ export function docsPath(path2) {
45
+ return corePath(`docs/${path2 || ""}`);
46
+ }
47
+ export function customElementsDataPath() {
48
+ return frameworkPath("custom-elements.json");
49
+ }
50
+ export function errorsPath(path2) {
51
+ return corePath(`errors/${path2 || ""}`);
52
+ }
53
+ export function examplesPath(type) {
54
+ return frameworkPath(`examples/${type || ""}`);
55
+ }
56
+ export function frameworkPath(path2) {
57
+ return projectPath(`.stacks/${path2 || ""}`);
58
+ }
59
+ export function fsPath(path2) {
60
+ return corePath(`fs/${path2 || ""}`);
61
+ }
62
+ export function functionsPath(path2) {
63
+ return projectPath(`functions/${path2 || ""}`);
64
+ }
65
+ export function gitPath(path2) {
66
+ return corePath(`git/${path2 || ""}`);
67
+ }
68
+ export function langPath(path2) {
69
+ return projectPath(`lang/${path2 || ""}`);
70
+ }
71
+ export function libraryEntryPath(type) {
72
+ return buildEntriesPath(`${type}.ts`);
73
+ }
74
+ export function lintPath(path2) {
75
+ return corePath(`lint/${path2 || ""}`);
76
+ }
77
+ export function loggingPath(path2) {
78
+ return corePath(`logging/${path2 || ""}`);
79
+ }
80
+ export function modulesPath(path2) {
81
+ return corePath(`modules/${path2 || ""}`);
82
+ }
83
+ export function objectsPath(path2) {
84
+ return corePath(`objects/${path2 || ""}`);
85
+ }
86
+ export function packageJsonPath(type) {
87
+ if (type === "vue-components")
88
+ return frameworkPath("components/vue/package.json");
89
+ if (type === "web-components")
90
+ return frameworkPath("components/web/package.json");
91
+ if (type === "functions")
92
+ return frameworkPath("functions/package.json");
93
+ return frameworkPath(`${type}/package.json`);
94
+ }
95
+ export function pagesPath(path2) {
96
+ return projectPath(`pages/${path2 || ""}`);
97
+ }
98
+ export function pathPath(path2) {
99
+ return corePath(`path/${path2 || ""}`);
100
+ }
101
+ export function projectPath(filePath = "") {
102
+ let path2 = process.cwd();
103
+ if (path2.includes(".stacks"))
104
+ path2 = resolve(path2, "..");
105
+ if (path2.includes(".stacks"))
106
+ path2 = resolve(path2, "..");
107
+ if (path2.includes(".stacks"))
108
+ path2 = resolve(path2, "..");
109
+ if (!path2.includes(".stacks"))
110
+ path2 = resolve(path2, ".");
111
+ return resolve(path2, filePath);
112
+ }
113
+ export function routerPath(path2) {
114
+ return corePath(`router/${path2 || ""}`);
115
+ }
116
+ export function routesPath(path2) {
117
+ return projectPath(`routes/${path2 || ""}`);
118
+ }
119
+ export function securityPath(path2) {
120
+ return corePath(`security/${path2 || ""}`);
121
+ }
122
+ export function serverPath(path2) {
123
+ return corePath(`server/${path2 || ""}`);
124
+ }
125
+ export function serverlessPath(path2) {
126
+ return corePath(`serverless/${path2 || ""}`);
127
+ }
128
+ export function stacksPath(path2) {
129
+ return frameworkPath(`src/${path2 || ""}`);
130
+ }
131
+ export function testsPath(path2) {
132
+ return corePath(`tests/${path2 || ""}`);
133
+ }
134
+ export function typesPath(path2) {
135
+ return corePath(`types/${path2 || ""}`);
136
+ }
137
+ export function stringsPath(path2) {
138
+ return corePath(`strings/${path2 || ""}`);
139
+ }
140
+ export function scriptsPath(path2) {
141
+ return frameworkPath(`scripts/${path2 || ""}`);
142
+ }
143
+ export function uiPath(path2) {
144
+ return corePath(`ui/${path2 || ""}`);
145
+ }
146
+ export function utilsPath(path2) {
147
+ return corePath(`utils/${path2 || ""}`);
148
+ }
149
+ export const path = {
150
+ actionsPath,
151
+ aliasPath,
152
+ arraysPath,
153
+ authPath,
154
+ buildEnginePath,
155
+ buildEntriesPath,
156
+ buildPath,
157
+ cachePath,
158
+ cliPath,
159
+ collectionsPath,
160
+ componentsPath,
161
+ configPath,
162
+ corePath,
163
+ customElementsDataPath,
164
+ docsPath,
165
+ errorsPath,
166
+ examplesPath,
167
+ frameworkPath,
168
+ fsPath,
169
+ functionsPath,
170
+ gitPath,
171
+ langPath,
172
+ libraryEntryPath,
173
+ lintPath,
174
+ loggingPath,
175
+ modulesPath,
176
+ objectsPath,
177
+ packageJsonPath,
178
+ pagesPath,
179
+ pathPath,
180
+ projectPath,
181
+ routerPath,
182
+ routesPath,
183
+ scriptsPath,
184
+ securityPath,
185
+ serverPath,
186
+ serverlessPath,
187
+ stacksPath,
188
+ stringsPath,
189
+ testsPath,
190
+ typesPath,
191
+ uiPath,
192
+ utilsPath,
193
+ basename,
194
+ delimiter,
195
+ dirname,
196
+ extname,
197
+ format,
198
+ isAbsolute,
199
+ join,
200
+ normalize,
201
+ normalizeString,
202
+ parse,
203
+ relative,
204
+ resolve,
205
+ sep,
206
+ toNamespacedPath
207
+ };
208
+ export { basename, delimiter, dirname, extname, format, isAbsolute, join, normalize, normalizeString, parse, relative, resolve, sep, toNamespacedPath };
209
+ export default path;
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@stacksjs/path",
3
+ "type": "module",
4
+ "version": "0.38.3",
5
+ "packageManager": "pnpm@7.15.0",
6
+ "description": "The Stacks path.",
7
+ "author": "Chris Breuer",
8
+ "license": "MIT",
9
+ "funding": "https://github.com/sponsors/chrisbbreuer",
10
+ "homepage": "https://github.com/stacksjs/stacks/tree/main/.stacks/core/path#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/stacksjs/stacks.git",
14
+ "directory": "./.stacks/core/path"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/stacksjs/stacks/issues"
18
+ },
19
+ "keywords": [
20
+ "path",
21
+ "pathe",
22
+ "paths",
23
+ "utilities",
24
+ "functions",
25
+ "stacks"
26
+ ],
27
+ "main": "dist/index.mjs",
28
+ "module": "dist/index.mjs",
29
+ "types": "dist/index.d.ts",
30
+ "contributors": [
31
+ "Chris Breuer <chris@ow3.org>"
32
+ ],
33
+ "files": [
34
+ "dist",
35
+ "README.md"
36
+ ],
37
+ "engines": {
38
+ "node": ">=v18.12.1",
39
+ "pnpm": ">=7.15.0"
40
+ },
41
+ "dependencies": {
42
+ "pathe": "^0.3.9"
43
+ },
44
+ "devDependencies": {
45
+ "mkdist": "^0.4.0",
46
+ "typescript": "^4.8.4"
47
+ },
48
+ "scripts": {
49
+ "build": "mkdist -d",
50
+ "dev": "mkdist -d",
51
+ "typecheck": "tsc --noEmit"
52
+ }
53
+ }