@stacksjs/path 0.64.6 → 0.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  join,
9
9
  normalize,
10
10
  parse,
11
+ type ParsedPath,
11
12
  relative,
12
13
  resolve,
13
14
  sep,
@@ -25,7 +26,7 @@ import { log } from '@stacksjs/logging'
25
26
  * @returns The absolute path to the file or directory.
26
27
  * @example
27
28
  * ```ts
28
- * import { actionsPath } from '@stacksjs/paths'
29
+ * import { actionsPath } from '@stacksjs/path'
29
30
  *
30
31
  * console.log(actionsPath('path/to/action.ts')) // Outputs the absolute path to 'path/to/action.ts' within the `actions` directory
31
32
  * ```
@@ -34,31 +35,37 @@ export function actionsPath(path?: string): string {
34
35
  return corePath(`actions/${path || ''}`)
35
36
  }
36
37
 
37
- export function relativeActionsPath(path?: string) {
38
+ export function relativeActionsPath(path?: string): string {
38
39
  return relative(projectPath(), actionsPath(path))
39
40
  }
40
41
 
41
- export function userActionsPath(path?: string, options?: { relative: true }) {
42
- return appPath(`Actions/${path || ''}`)
42
+ export function userActionsPath(path?: string, options?: { relative: true }): string {
43
+ const absolutePath = appPath(`Actions/${path || ''}`)
44
+
45
+ if (options?.relative)
46
+ return relative(process.cwd(), absolutePath)
47
+
48
+ return absolutePath
43
49
  }
44
50
 
45
- export function builtUserActionsPath(path?: string, options?: { relative: boolean }) {
51
+ export function builtUserActionsPath(path?: string, options?: { relative: boolean }): string {
46
52
  const absolutePath = frameworkPath(`actions/${path || ''}`)
47
53
 
48
- if (options?.relative) return relative(process.cwd(), absolutePath)
54
+ if (options?.relative)
55
+ return relative(process.cwd(), absolutePath)
49
56
 
50
57
  return absolutePath
51
58
  }
52
59
 
53
- export function userComponentsPath(path?: string) {
60
+ export function userComponentsPath(path?: string): string {
54
61
  return libsPath(`components/${path || ''}`)
55
62
  }
56
63
 
57
- export function userViewsPath(path?: string) {
64
+ export function userViewsPath(path?: string): string {
58
65
  return resourcesPath(`views/${path || ''}`)
59
66
  }
60
67
 
61
- export function userFunctionsPath(path?: string) {
68
+ export function userFunctionsPath(path?: string): string {
62
69
  return resourcesPath(`functions/${path || ''}`)
63
70
  }
64
71
 
@@ -69,7 +76,7 @@ export function userFunctionsPath(path?: string) {
69
76
  * @returns The absolute path to the specified file or directory within the user-defined `Jobs` directory.
70
77
  * @example
71
78
  * ```ts
72
- * import { userJobsPath } from '@stacksjs/paths'
79
+ * import { userJobsPath } from '@stacksjs/path'
73
80
  *
74
81
  * console.log(userJobsPath('MyJob.ts')) // Outputs the absolute path to 'MyJob.ts' within the user-defined `Jobs` directory.
75
82
  * ```
@@ -85,7 +92,7 @@ export function userJobsPath(path?: string): string {
85
92
  * @returns The absolute path to the specified file or directory within the user-defined `Listeners` directory.
86
93
  * @example
87
94
  * ```ts
88
- * import { userListenersPath } from '@stacksjs/paths'
95
+ * import { userListenersPath } from '@stacksjs/path'
89
96
  *
90
97
  * console.log(userListenersPath('MyListener.ts')) // Outputs the absolute path to 'MyListener.ts' within the user-defined `Listeners` directory.
91
98
  * ```
@@ -101,12 +108,12 @@ export function userListenersPath(path?: string): string {
101
108
  * @returns The absolute path to the specified file or directory within the user-defined Middleware directory.
102
109
  * @example
103
110
  * ```ts
104
- * import { userMiddlewarePath } from '@stacksjs/paths'
111
+ * import { userMiddlewarePath } from '@stacksjs/path'
105
112
  *
106
113
  * console.log(userMiddlewarePath('MyMiddleware.ts')) // Outputs the absolute path to 'MyMiddleware.ts' within the user-defined Middleware directory.
107
114
  * ```
108
115
  */
109
- export function userMiddlewarePath(path?: string) {
116
+ export function userMiddlewarePath(path?: string): string {
110
117
  return appPath(`Middleware/${path || ''}`)
111
118
  }
112
119
 
@@ -117,7 +124,7 @@ export function userMiddlewarePath(path?: string) {
117
124
  * @returns The absolute path to the specified file or directory within the user-defined `Models` directory.
118
125
  * @example
119
126
  * ```ts
120
- * import { userModelsPath } from '@stacksjs/paths'
127
+ * import { userModelsPath } from '@stacksjs/path'
121
128
  *
122
129
  * console.log(userModelsPath('MyModel.ts')) // Outputs the absolute path to 'MyModel.ts' within the user-defined `Models` directory.
123
130
  * ```
@@ -133,20 +140,20 @@ export function userModelsPath(path?: string): string {
133
140
  * @returns The absolute path to the specified file or directory within the user-defined `Notifications` directory.
134
141
  * @example
135
142
  * ```ts
136
- * import { userNotificationsPath } from '@stacksjs/paths'
143
+ * import { userNotificationsPath } from '@stacksjs/path'
137
144
  *
138
145
  * console.log(userNotificationsPath('MyNotification.ts')) // Outputs the absolute path to 'MyNotification.ts' within the user-defined `Notifications` directory.
139
146
  * ```
140
147
  */
141
- export function userNotificationsPath(path?: string) {
148
+ export function userNotificationsPath(path?: string): string {
142
149
  return appPath(`Notifications/${path || ''}`)
143
150
  }
144
151
 
145
- export function userDatabasePath(path?: string) {
152
+ export function userDatabasePath(path?: string): string {
146
153
  return projectPath(`database/${path || ''}`)
147
154
  }
148
155
 
149
- export function userMigrationsPath(path?: string) {
156
+ export function userMigrationsPath(path?: string): string {
150
157
  return userDatabasePath(`migrations/${path || ''}`)
151
158
  }
152
159
 
@@ -156,7 +163,7 @@ export function userMigrationsPath(path?: string) {
156
163
  * @returns The absolute path to the `Events.ts` file within the user-defined directory.
157
164
  * @example
158
165
  * ```ts
159
- * import { userEventsPath } from '@stacksjs/paths'
166
+ * import { userEventsPath } from '@stacksjs/path'
160
167
  *
161
168
  * console.log(userEventsPath()) // Outputs the absolute path to 'Events.ts' within the user-defined directory.
162
169
  * ```
@@ -175,12 +182,12 @@ export function userEventsPath(): string {
175
182
  *
176
183
  * @example
177
184
  * ```ts
178
- * import { aiPath } from '@stacksjs/paths'
185
+ * import { aiPath } from '@stacksjs/path'
179
186
  *
180
187
  * console.log(aiPath('src/drivers/example.ts')) // Outputs the absolute path to 'openai.ts' within the AI directory
181
188
  * ```
182
189
  */
183
- export function aiPath(path?: string) {
190
+ export function aiPath(path?: string): string {
184
191
  return corePath(`ai/${path || ''}`)
185
192
  }
186
193
 
@@ -191,12 +198,12 @@ export function aiPath(path?: string) {
191
198
  * @returns The absolute path to the specified file or directory within the `assets` directory.
192
199
  * @example
193
200
  * ```ts
194
- * import { assetsPath } from '@stacksjs/paths'
201
+ * import { assetsPath } from '@stacksjs/path'
195
202
  *
196
203
  * console.log(assetsPath('images/logo.png')) // Outputs the absolute path to 'images/logo.png' within the `assets` directory.
197
204
  * ```
198
205
  */
199
- export function assetsPath(path?: string) {
206
+ export function assetsPath(path?: string): string {
200
207
  return resourcesPath(`assets/${path || ''}`)
201
208
  }
202
209
 
@@ -206,12 +213,12 @@ export function assetsPath(path?: string) {
206
213
  * @returns The absolute path to the `alias` directory.
207
214
  * @example
208
215
  * ```ts
209
- * import { aliasPath } from '@stacksjs/paths'
216
+ * import { aliasPath } from '@stacksjs/path'
210
217
  *
211
218
  * console.log(aliasPath()) // Outputs the absolute path to the `alias` directory.
212
219
  * ```
213
220
  */
214
- export function aliasPath() {
221
+ export function aliasPath(): string {
215
222
  return corePath('alias/src/index.ts')
216
223
  }
217
224
 
@@ -224,16 +231,17 @@ export function aliasPath() {
224
231
  * @returns The absolute or relative path to the specified file or directory within the buddy * @returns The absolute or relative path to the specified file or directory within the buddy directory.
225
232
  * @example
226
233
  * ```ts
227
- * import { buddyPath } from '@stacksjs/paths'
234
+ * import { buddyPath } from '@stacksjs/path'
228
235
  *
229
236
  * console.log(buddyPath('config/buddy.json')) // Outputs the absolute path to 'config/buddy.json' within the buddy directory.
230
237
  * console.log(buddyPath('config/buddy.json', { relative: true })) // Outputs the relative path to 'config/buddy.json' within the buddy directory.
231
238
  * ```
232
239
  */
233
- export function buddyPath(path?: string, options?: { relative?: boolean }) {
240
+ export function buddyPath(path?: string, options?: { relative?: boolean }): string {
234
241
  const absolutePath = corePath(`buddy/${path || ''}`)
235
242
 
236
- if (options?.relative) return relative(process.cwd(), absolutePath)
243
+ if (options?.relative)
244
+ return relative(process.cwd(), absolutePath)
237
245
 
238
246
  return absolutePath
239
247
  }
@@ -245,7 +253,7 @@ export function buddyPath(path?: string, options?: { relative?: boolean }) {
245
253
  * @returns The absolute path to the specified file or directory within the runtime directory.
246
254
  * @example
247
255
  * ```ts
248
- * import { runtimePath } from '@stacksjs/paths'
256
+ * import { runtimePath } from '@stacksjs/path'
249
257
  *
250
258
  * console.log(runtimePath('runtime-config.json')) // Outputs the absolute path to 'runtime-config.json' within the runtime directory.
251
259
  * ```
@@ -261,7 +269,7 @@ export function runtimePath(path?: string): string {
261
269
  * @returns The absolute path to the specified file or directory within the `analytics` directory.
262
270
  * @example
263
271
  * ```ts
264
- * import { analyticsPath } from '@stacksjs/paths'
272
+ * import { analyticsPath } from '@stacksjs/path'
265
273
  *
266
274
  * console.log(analyticsPath('data/report.csv')) // Outputs the absolute path to 'data/report.csv' within the `analytics` directory.
267
275
  * ```
@@ -277,7 +285,7 @@ export function analyticsPath(path?: string): string {
277
285
  * @returns The absolute path to the specified file or directory within the `arrays` directory.
278
286
  * @example
279
287
  * ```ts
280
- * import { arraysPath } from '@stacksjs/paths'
288
+ * import { arraysPath } from '@stacksjs/path'
281
289
  *
282
290
  * console.log(arraysPath('list.txt')) // Outputs the absolute path to 'list.txt' within the `arrays` directory.
283
291
  * ```
@@ -293,7 +301,7 @@ export function arraysPath(path?: string): string {
293
301
  * @returns The absolute path to the specified file or directory within the app directory.
294
302
  * @example
295
303
  * ```ts
296
- * import { appPath } from '@stacksjs/paths'
304
+ * import { appPath } from '@stacksjs/path'
297
305
  *
298
306
  * console.log(appPath('Actions/DummyAction.ts')) // Outputs the absolute path to 'Actions/DummyAction.ts' within the app directory.
299
307
  * ```
@@ -309,7 +317,7 @@ export function appPath(path?: string): string {
309
317
  * @returns The absolute path to the specified file or directory within the auth directory.
310
318
  * @example
311
319
  * ```ts
312
- * import { authPath } from '@stacksjs/paths'
320
+ * import { authPath } from '@stacksjs/path'
313
321
  *
314
322
  * console.log(authPath('login.ts')) // Outputs the absolute path to 'login.ts' within the auth directory.
315
323
  * ```
@@ -318,6 +326,22 @@ export function authPath(path?: string): string {
318
326
  return corePath(`auth/${path || ''}`)
319
327
  }
320
328
 
329
+ /**
330
+ * Returns the path to the `auth` directory within the core directory.
331
+ *
332
+ * @param path - The relative path to the file or directory within the auth directory.
333
+ * @returns The absolute path to the specified file or directory within the auth directory.
334
+ * @example
335
+ * ```ts
336
+ * import { coreApiPath } from '@stacksjs/path'
337
+ *
338
+ * console.log(coreApiPath('login.ts')) // Outputs the absolute path to 'login.ts' within the auth directory.
339
+ * ```
340
+ */
341
+ export function coreApiPath(path?: string): string {
342
+ return corePath(`api/${path || ''}`)
343
+ }
344
+
321
345
  /**
322
346
  * Returns the path to the build directory. The build directory
323
347
  * contains Stacks' build engine & its tooling integrations.
@@ -330,7 +354,7 @@ export function authPath(path?: string): string {
330
354
  * buildPath('components.ts')
331
355
  * ```
332
356
  */
333
- export function buildPath(path?: string) {
357
+ export function buildPath(path?: string): string {
334
358
  return corePath(`build/${path || ''}`)
335
359
  }
336
360
 
@@ -563,6 +587,16 @@ export function enumsPath(path?: string): string {
563
587
  return corePath(`enums/${path || ''}`)
564
588
  }
565
589
 
590
+ /**
591
+ * Returns the path to the `eslint-plugin` directory within the core directory.
592
+ *
593
+ * @param path - The relative path to the file or directory within the eslint-plugin directory.
594
+ * @returns The absolute path to the specified file or directory within the eslint-plugin directory.
595
+ */
596
+ export function eslintPluginPath(path?: string): string {
597
+ return corePath(`eslint-plugin/${path || ''}`)
598
+ }
599
+
566
600
  /**
567
601
  * Returns the path to the `error-handling` directory within the core directory.
568
602
  *
@@ -599,7 +633,7 @@ export function coreEnvPath(path?: string): string {
599
633
  * @param type - The type of examples to filter by ('vue-components' or 'web-components').
600
634
  * @returns The absolute path to the specified type of examples within the `examples` directory.
601
635
  */
602
- export function examplesPath(type: 'vue-components' | 'web-components'): string {
636
+ export function examplesPath(type?: 'vue-components' | 'web-components'): string {
603
637
  return frameworkPath(`examples/${type || ''}`)
604
638
  }
605
639
 
@@ -622,14 +656,25 @@ export function fakerPath(path?: string): string {
622
656
  * @param options.cwd - Specifies a custom working directory.
623
657
  * @returns The absolute or relative path to the specified file or directory within the framework directory.
624
658
  */
625
- export function frameworkPath(path?: string, options?: { relative?: boolean; cwd?: string }): string {
659
+ export function frameworkPath(path?: string, options?: { relative?: boolean, cwd?: string }): string {
626
660
  const absolutePath = storagePath(`framework/${path || ''}`)
627
661
 
628
- if (options?.relative) return relative(options.cwd || process.cwd(), absolutePath)
662
+ if (options?.relative)
663
+ return relative(options.cwd || process.cwd(), absolutePath)
629
664
 
630
665
  return absolutePath
631
666
  }
632
667
 
668
+ /**
669
+ * Returns the path to the `frontend` directory within the core directory.
670
+ *
671
+ * @param path - The relative path to the file or directory within the health directory.
672
+ * @returns The absolute path to the specified file or directory within the health directory.
673
+ */
674
+ export function browserPath(path?: string): string {
675
+ return corePath(`browser/${path || ''}`)
676
+ }
677
+
633
678
  /**
634
679
  * Returns the path to the `health` directory within the core directory.
635
680
  *
@@ -681,7 +726,8 @@ export function langPath(path?: string): string {
681
726
  export function layoutsPath(path?: string, options?: { relative?: boolean }): string {
682
727
  const absolutePath = resourcesPath(`layouts/${path || ''}`)
683
728
 
684
- if (options?.relative) return relative(process.cwd(), absolutePath)
729
+ if (options?.relative)
730
+ return relative(process.cwd(), absolutePath)
685
731
 
686
732
  return absolutePath
687
733
  }
@@ -813,10 +859,11 @@ export function onboardingPath(path?: string): string {
813
859
  * @param type - The type of the library ('vue-components', 'web-components', or 'functions') for which to return the package.json path.
814
860
  * @returns The absolute path to the specified package.json file within the framework directory.
815
861
  */
816
- export function packageJsonPath(type: 'vue-components' | 'web-components' | 'functions'): string {
817
- if (type === 'vue-components') return frameworkPath('libs/components/vue/package.json')
818
-
819
- if (type === 'web-components') return frameworkPath('libs/components/web/package.json')
862
+ export function packageJsonPath(type: LibraryType): string {
863
+ if (type === 'vue-components')
864
+ return frameworkPath('libs/components/vue/package.json')
865
+ if (type === 'web-components')
866
+ return frameworkPath('libs/components/web/package.json')
820
867
 
821
868
  return frameworkPath(`libs/${type}/package.json`)
822
869
  }
@@ -865,7 +912,8 @@ export function projectPath(filePath = '', options?: { relative: boolean }): str
865
912
  const finalPath = resolve(path, filePath)
866
913
 
867
914
  // If the `relative` option is true, return the path relative to the current working directory
868
- if (options?.relative) return relative(process.cwd(), finalPath)
915
+ if (options?.relative)
916
+ return relative(process.cwd(), finalPath)
869
917
 
870
918
  return finalPath
871
919
  }
@@ -892,7 +940,8 @@ export async function findProjectPath(project: string): Promise<string> {
892
940
  // since we are targeting a specific project, find its path
893
941
  const projectPath = projects.find((proj: string) => proj.includes(project))
894
942
 
895
- if (!projectPath) throw new Error(`Could not find project with name: ${project}`)
943
+ if (!projectPath)
944
+ throw new Error(`Could not find project with name: ${project}`)
896
945
 
897
946
  return projectPath.startsWith('/') ? projectPath : `/${projectPath}`
898
947
  }
@@ -933,7 +982,7 @@ export function publicPath(path?: string): string {
933
982
  * @param path - The relative path to the file or directory within the push directory.
934
983
  * @returns The absolute path to the specified file or directory within the push directory.
935
984
  */
936
- export function pushPath(path?: string) {
985
+ export function pushPath(path?: string): string {
937
986
  return notificationsPath(`push/${path || ''}`)
938
987
  }
939
988
 
@@ -943,7 +992,7 @@ export function pushPath(path?: string) {
943
992
  * @param path - The relative path to the file or directory within the query-builder directory.
944
993
  * @returns The absolute path to the specified file or directory within the query-builder directory.
945
994
  */
946
- export function queryBuilderPath(path?: string) {
995
+ export function queryBuilderPath(path?: string): string {
947
996
  return corePath(`query-builder/${path || ''}`)
948
997
  }
949
998
 
@@ -953,7 +1002,7 @@ export function queryBuilderPath(path?: string) {
953
1002
  * @param path - The relative path to the file or directory within the queue directory.
954
1003
  * @returns The absolute path to the specified file or directory within the queue directory.
955
1004
  */
956
- export function queuePath(path?: string) {
1005
+ export function queuePath(path?: string): string {
957
1006
  return corePath(`queue/${path || ''}`)
958
1007
  }
959
1008
 
@@ -963,7 +1012,7 @@ export function queuePath(path?: string) {
963
1012
  * @param path - The relative path to the file or directory within the realtime directory.
964
1013
  * @returns The absolute path to the specified file or directory within the realtime directory.
965
1014
  */
966
- export function realtimePath(path?: string) {
1015
+ export function realtimePath(path?: string): string {
967
1016
  return corePath(`realtime/${path || ''}`)
968
1017
  }
969
1018
 
@@ -975,7 +1024,7 @@ export function realtimePath(path?: string) {
975
1024
  * @param options.relative - If true, returns the path relative to the current working directory.
976
1025
  * @returns The absolute or relative path to the specified file or directory within the `resources` directory.
977
1026
  */
978
- export function resourcesPath(path?: string, options?: { relative?: boolean }) {
1027
+ export function resourcesPath(path?: string, options?: { relative?: boolean }): string {
979
1028
  if (options?.relative) {
980
1029
  const absolutePath = projectPath(`resources/${path || ''}`)
981
1030
  return relative(process.cwd(), absolutePath)
@@ -990,7 +1039,7 @@ export function resourcesPath(path?: string, options?: { relative?: boolean }) {
990
1039
  * @param path - The relative path to the file or directory within the repl directory.
991
1040
  * @returns The absolute path to the specified file or directory within the repl directory.
992
1041
  */
993
- export function replPath(path?: string) {
1042
+ export function replPath(path?: string): string {
994
1043
  return corePath(`repl/${path || ''}`)
995
1044
  }
996
1045
 
@@ -1000,7 +1049,7 @@ export function replPath(path?: string) {
1000
1049
  * @param path - The relative path to the file or directory within the router directory.
1001
1050
  * @returns The absolute path to the specified file or directory within the router directory.
1002
1051
  */
1003
- export function routerPath(path?: string) {
1052
+ export function routerPath(path?: string): string {
1004
1053
  return corePath(`router/${path || ''}`)
1005
1054
  }
1006
1055
 
@@ -1012,10 +1061,11 @@ export function routerPath(path?: string) {
1012
1061
  * @param options.relative - If true, returns the path relative to the current working directory.
1013
1062
  * @returns The absolute or relative path to the specified file or directory within the `routes` directory.
1014
1063
  */
1015
- export function routesPath(path?: string, options?: { relative?: boolean }) {
1064
+ export function routesPath(path?: string, options?: { relative?: boolean }): string {
1016
1065
  const absolutePath = resourcesPath(`routes/${path || ''}`)
1017
1066
 
1018
- if (options?.relative) return relative(process.cwd(), absolutePath)
1067
+ if (options?.relative)
1068
+ return relative(process.cwd(), absolutePath)
1019
1069
 
1020
1070
  return projectPath(`routes/${path || ''}`)
1021
1071
  }
@@ -1026,7 +1076,7 @@ export function routesPath(path?: string, options?: { relative?: boolean }) {
1026
1076
  * @param path - The relative path to the file or directory within the search-engine directory.
1027
1077
  * @returns The absolute path to the specified file or directory within the search-engine directory.
1028
1078
  */
1029
- export function searchEnginePath(path?: string) {
1079
+ export function searchEnginePath(path?: string): string {
1030
1080
  return corePath(`search-engine/${path || ''}`)
1031
1081
  }
1032
1082
 
@@ -1036,7 +1086,7 @@ export function searchEnginePath(path?: string) {
1036
1086
  * @param path - The relative path to the file or directory within the `settings` directory.
1037
1087
  * @returns The absolute path to the specified file or directory within the `settings` directory.
1038
1088
  */
1039
- export function settingsPath(path?: string) {
1089
+ export function settingsPath(path?: string): string {
1040
1090
  return projectPath(`${path || 'views/dashboard/settings'}`)
1041
1091
  }
1042
1092
 
@@ -1046,7 +1096,7 @@ export function settingsPath(path?: string) {
1046
1096
  * @param path - The relative path to the file or directory within the `scripts` directory.
1047
1097
  * @returns The absolute path to the specified file or directory within the `scripts` directory.
1048
1098
  */
1049
- export function scriptsPath(path?: string) {
1099
+ export function scriptsPath(path?: string): string {
1050
1100
  return frameworkPath(`scripts/${path || ''}`)
1051
1101
  }
1052
1102
 
@@ -1056,7 +1106,7 @@ export function scriptsPath(path?: string) {
1056
1106
  * @param path - The relative path to the file or directory within the scheduler directory.
1057
1107
  * @returns The absolute path to the specified file or directory within the scheduler directory.
1058
1108
  */
1059
- export function schedulerPath(path?: string) {
1109
+ export function schedulerPath(path?: string): string {
1060
1110
  return corePath(`scheduler/${path || ''}`)
1061
1111
  }
1062
1112
 
@@ -1066,7 +1116,7 @@ export function schedulerPath(path?: string) {
1066
1116
  * @param path - The relative path to the file or directory within the slug directory.
1067
1117
  * @returns The absolute path to the specified file or directory within the slug directory.
1068
1118
  */
1069
- export function slugPath(path?: string) {
1119
+ export function slugPath(path?: string): string {
1070
1120
  return corePath(`slug/${path || ''}`)
1071
1121
  }
1072
1122
 
@@ -1076,7 +1126,7 @@ export function slugPath(path?: string) {
1076
1126
  * @param path - The relative path to the file or directory within the `sms` directory.
1077
1127
  * @returns The absolute path to the specified file or directory within the `sms` directory.
1078
1128
  */
1079
- export function smsPath(path?: string) {
1129
+ export function smsPath(path?: string): string {
1080
1130
  return notificationsPath(`sms/${path || ''}`)
1081
1131
  }
1082
1132
 
@@ -1086,7 +1136,7 @@ export function smsPath(path?: string) {
1086
1136
  * @param path - The relative path to the file or directory within the storage directory.
1087
1137
  * @returns The absolute path to the specified file or directory within the storage directory.
1088
1138
  */
1089
- export function coreStoragePath(path?: string) {
1139
+ export function coreStoragePath(path?: string): string {
1090
1140
  return corePath(`storage/${path || ''}`)
1091
1141
  }
1092
1142
 
@@ -1096,7 +1146,7 @@ export function coreStoragePath(path?: string) {
1096
1146
  * @param path - The relative path to the file or directory within the `stores` directory.
1097
1147
  * @returns The absolute path to the specified file or directory within the `stores` directory.
1098
1148
  */
1099
- export function storesPath(path?: string) {
1149
+ export function storesPath(path?: string): string {
1100
1150
  return resourcesPath(`stores/${path || ''}`)
1101
1151
  }
1102
1152
 
@@ -1106,7 +1156,7 @@ export function storesPath(path?: string) {
1106
1156
  * @param path - The relative path to the file or directory within the security directory.
1107
1157
  * @returns The absolute path to the specified file or directory within the security directory.
1108
1158
  */
1109
- export function securityPath(path?: string) {
1159
+ export function securityPath(path?: string): string {
1110
1160
  return corePath(`security/${path || ''}`)
1111
1161
  }
1112
1162
 
@@ -1116,11 +1166,11 @@ export function securityPath(path?: string) {
1116
1166
  * @param path - The relative path to the file or directory within the server directory.
1117
1167
  * @returns The absolute path to the specified file or directory within the server directory.
1118
1168
  */
1119
- export function serverPath(path?: string) {
1169
+ export function serverPath(path?: string): string {
1120
1170
  return corePath(`server/${path || ''}`)
1121
1171
  }
1122
1172
 
1123
- export function userServerPath(path?: string) {
1173
+ export function userServerPath(path?: string): string {
1124
1174
  return frameworkPath(`server/${path || ''}`)
1125
1175
  }
1126
1176
 
@@ -1130,7 +1180,7 @@ export function userServerPath(path?: string) {
1130
1180
  * @param path - The relative path to the file or directory within the `serverless` directory.
1131
1181
  * @returns The absolute path to the specified file or directory within the `serverless` directory.
1132
1182
  */
1133
- export function serverlessPath(path?: string) {
1183
+ export function serverlessPath(path?: string): string {
1134
1184
  return corePath(`serverless/${path || ''}`)
1135
1185
  }
1136
1186
 
@@ -1140,7 +1190,7 @@ export function serverlessPath(path?: string) {
1140
1190
  * @param path - The relative path to the file or directory within the framework's `src` directory.
1141
1191
  * @returns The absolute path to the specified file or directory within the framework's `src` directory.
1142
1192
  */
1143
- export function stacksPath(path?: string) {
1193
+ export function stacksPath(path?: string): string {
1144
1194
  return frameworkPath(`src/${path || ''}`)
1145
1195
  }
1146
1196
 
@@ -1150,7 +1200,7 @@ export function stacksPath(path?: string) {
1150
1200
  * @param path - The relative path to the file or directory within the shell directory.
1151
1201
  * @returns The absolute path to the specified file or directory within the shell directory.
1152
1202
  */
1153
- export function shellPath(path?: string) {
1203
+ export function shellPath(path?: string): string {
1154
1204
  return corePath(`shell/${path || ''}`)
1155
1205
  }
1156
1206
 
@@ -1160,7 +1210,7 @@ export function shellPath(path?: string) {
1160
1210
  * @param path - The relative path to the file or directory within the `strings` directory.
1161
1211
  * @returns The absolute path to the specified file or directory within the `strings` directory.
1162
1212
  */
1163
- export function stringsPath(path?: string) {
1213
+ export function stringsPath(path?: string): string {
1164
1214
  return corePath(`strings/${path || ''}`)
1165
1215
  }
1166
1216
 
@@ -1170,7 +1220,7 @@ export function stringsPath(path?: string) {
1170
1220
  * @param path - The relative path to the file or directory within the testing directory.
1171
1221
  * @returns The absolute path to the specified file or directory within the testing directory.
1172
1222
  */
1173
- export function testingPath(path?: string) {
1223
+ export function testingPath(path?: string): string {
1174
1224
  return corePath(`testing/${path || ''}`)
1175
1225
  }
1176
1226
 
@@ -1180,7 +1230,7 @@ export function testingPath(path?: string) {
1180
1230
  * @param path - The relative path to the file or directory within the tinker directory.
1181
1231
  * @returns The absolute path to the specified file or directory within the tinker directory.
1182
1232
  */
1183
- export function tinkerPath(path?: string) {
1233
+ export function tinkerPath(path?: string): string {
1184
1234
  return corePath(`tinker/${path || ''}`)
1185
1235
  }
1186
1236
 
@@ -1190,7 +1240,7 @@ export function tinkerPath(path?: string) {
1190
1240
  * @param path - The relative path to the file or directory within the `tests` directory.
1191
1241
  * @returns The absolute path to the specified file or directory within the `tests` directory.
1192
1242
  */
1193
- export function testsPath(path?: string) {
1243
+ export function testsPath(path?: string): string {
1194
1244
  return frameworkPath(`tests/${path || ''}`)
1195
1245
  }
1196
1246
 
@@ -1200,7 +1250,7 @@ export function testsPath(path?: string) {
1200
1250
  * @param path - The relative path to the file or directory within the `types` directory.
1201
1251
  * @returns The absolute path to the specified file or directory within the `types` directory.
1202
1252
  */
1203
- export function typesPath(path?: string) {
1253
+ export function typesPath(path?: string): string {
1204
1254
  return corePath(`types/${path || ''}`)
1205
1255
  }
1206
1256
 
@@ -1210,10 +1260,11 @@ export function typesPath(path?: string) {
1210
1260
  * @param path - The relative path to the file or directory within the ui directory.
1211
1261
  * @returns The absolute path to the specified file or directory within the ui directory.
1212
1262
  */
1213
- export function uiPath(path?: string, options?: { relative?: boolean }) {
1263
+ export function uiPath(path?: string, options?: { relative?: boolean }): string {
1214
1264
  const absolutePath = corePath(`ui/${path || ''}`)
1215
1265
 
1216
- if (options?.relative) return relative(process.cwd(), absolutePath)
1266
+ if (options?.relative)
1267
+ return relative(process.cwd(), absolutePath)
1217
1268
 
1218
1269
  return absolutePath
1219
1270
  }
@@ -1224,7 +1275,7 @@ export function uiPath(path?: string, options?: { relative?: boolean }) {
1224
1275
  * @param path - The relative path to the file or directory within the `utils` directory.
1225
1276
  * @returns The absolute path to the specified file or directory within the `utils` directory.
1226
1277
  */
1227
- export function utilsPath(path?: string) {
1278
+ export function utilsPath(path?: string): string {
1228
1279
  return corePath(`utils/${path || ''}`)
1229
1280
  }
1230
1281
 
@@ -1234,7 +1285,7 @@ export function utilsPath(path?: string) {
1234
1285
  * @param path - The relative path to the file or directory within the validation directory.
1235
1286
  * @returns The absolute path to the specified file or directory within the validation directory.
1236
1287
  */
1237
- export function validationPath(path?: string) {
1288
+ export function validationPath(path?: string): string {
1238
1289
  return corePath(`validation/${path || ''}`)
1239
1290
  }
1240
1291
 
@@ -1244,7 +1295,7 @@ export function validationPath(path?: string) {
1244
1295
  * @param path - The relative path to the file or directory within the vite-config directory.
1245
1296
  * @returns The absolute path to the specified file or directory within the vite-config directory.
1246
1297
  */
1247
- export function viteConfigPath(path?: string) {
1298
+ export function viteConfigPath(path?: string): string {
1248
1299
  return corePath(`vite-config/${path || ''}`)
1249
1300
  }
1250
1301
 
@@ -1254,7 +1305,7 @@ export function viteConfigPath(path?: string) {
1254
1305
  * @param path - The relative path to the file or directory within the vite directory.
1255
1306
  * @returns The absolute path to the specified file or directory within the vite directory.
1256
1307
  */
1257
- export function vitePluginPath(path?: string) {
1308
+ export function vitePluginPath(path?: string): string {
1258
1309
  return corePath(`vite-plugin/${path || ''}`)
1259
1310
  }
1260
1311
 
@@ -1264,7 +1315,7 @@ export function vitePluginPath(path?: string) {
1264
1315
  * @param path - The relative path to the file or directory within the x-ray directory.
1265
1316
  * @returns The absolute path to the specified file or directory within the x-ray directory.
1266
1317
  */
1267
- export function xRayPath(path?: string) {
1318
+ export function xRayPath(path?: string): string {
1268
1319
  return frameworkPath(`stacks/x-ray/${path || ''}`)
1269
1320
  }
1270
1321
 
@@ -1274,11 +1325,142 @@ export function xRayPath(path?: string) {
1274
1325
  * @param path - The relative path to append to the home directory path.
1275
1326
  * @returns The absolute path to the specified file or directory within the home directory.
1276
1327
  */
1277
- export function homeDir(path?: string) {
1328
+ export function homeDir(path?: string): string {
1278
1329
  return os.homedir() + (path ? (path.startsWith('/') ? '' : '/') + path : '~')
1279
1330
  }
1280
1331
 
1281
- export const path = {
1332
+ export interface Path {
1333
+ actionsPath: (path?: string) => string
1334
+ userActionsPath: (path?: string) => string
1335
+ builtUserActionsPath: (path?: string, option?: { relative: boolean }) => string
1336
+ userComponentsPath: (path?: string) => string
1337
+ userViewsPath: (path?: string) => string
1338
+ userFunctionsPath: (path?: string) => string
1339
+ aiPath: (path?: string) => string
1340
+ assetsPath: (path?: string) => string
1341
+ relativeActionsPath: (path?: string) => string
1342
+ aliasPath: (path?: string) => string
1343
+ analyticsPath: (path?: string) => string
1344
+ arraysPath: (path?: string) => string
1345
+ appPath: (path?: string) => string
1346
+ authPath: (path?: string) => string
1347
+ coreApiPath: (path?: string) => string
1348
+ buddyPath: (path?: string) => string
1349
+ buildEnginePath: (path?: string) => string
1350
+ libsEntriesPath: (path?: string) => string
1351
+ buildPath: (path?: string) => string
1352
+ cachePath: (path?: string) => string
1353
+ chatPath: (path?: string) => string
1354
+ cliPath: (path?: string) => string
1355
+ cloudPath: (path?: string) => string
1356
+ frameworkCloudPath: (path?: string) => string
1357
+ collectionsPath: (path?: string) => string
1358
+ commandsPath: (path?: string) => string
1359
+ componentsPath: (path?: string) => string
1360
+ configPath: (path?: string) => string
1361
+ projectConfigPath: (path?: string) => string
1362
+ corePath: (path?: string) => string
1363
+ customElementsDataPath: (path?: string) => string
1364
+ databasePath: (path?: string) => string
1365
+ datetimePath: (path?: string) => string
1366
+ developmentPath: (path?: string) => string
1367
+ desktopPath: (path?: string) => string
1368
+ docsPath: (path?: string) => string
1369
+ dnsPath: (path?: string) => string
1370
+ emailPath: (path?: string) => string
1371
+ enumsPath: (path?: string) => string
1372
+ eslintPluginPath: (path?: string) => string
1373
+ errorHandlingPath: (path?: string) => string
1374
+ eventsPath: (path?: string) => string
1375
+ coreEnvPath: (path?: string) => string
1376
+ healthPath: (path?: string) => string
1377
+ examplesPath: (type?: 'vue-components' | 'web-components') => string
1378
+ fakerPath: (path?: string) => string
1379
+ frameworkPath: (path?: string) => string
1380
+ browserPath: (path?: string) => string
1381
+ storagePath: (path?: string) => string
1382
+ functionsPath: (path?: string) => string
1383
+ gitPath: (path?: string) => string
1384
+ langPath: (path?: string) => string
1385
+ layoutsPath: (path?: string, options?: { relative?: boolean }) => string
1386
+ libsPath: (path?: string) => string
1387
+ userLibsPath: (path?: string) => string
1388
+ libraryEntryPath: (type: LibraryType) => string
1389
+ lintPath: (path?: string) => string
1390
+ listenersPath: (path?: string) => string
1391
+ loggingPath: (path?: string) => string
1392
+ logsPath: (path?: string) => string
1393
+ jobsPath: (path?: string) => string
1394
+ modulesPath: (path?: string) => string
1395
+ ormPath: (path?: string) => string
1396
+ objectsPath: (path?: string) => string
1397
+ onboardingPath: (path?: string) => string
1398
+ notificationsPath: (path?: string) => string
1399
+ packageJsonPath: (type: LibraryType) => string
1400
+ viewsPath: (path?: string) => string
1401
+ pathPath: (path?: string) => string
1402
+ paymentsPath: (path?: string) => string
1403
+ projectPath: (path?: string) => string
1404
+ findProjectPath: (project: string) => Promise<string>
1405
+ coreStoragePath: (path?: string) => string
1406
+ publicPath: (path?: string) => string
1407
+ pushPath: (path?: string) => string
1408
+ queryBuilderPath: (path?: string) => string
1409
+ queuePath: (path?: string) => string
1410
+ realtimePath: (path?: string) => string
1411
+ resourcesPath: (path?: string) => string
1412
+ replPath: (path?: string) => string
1413
+ routerPath: (path?: string) => string
1414
+ routesPath: (path?: string) => string
1415
+ runtimePath: (path?: string) => string
1416
+ searchEnginePath: (path?: string) => string
1417
+ schedulerPath: (path?: string) => string
1418
+ settingsPath: (path?: string) => string
1419
+ smsPath: (path?: string) => string
1420
+ slugPath: (path?: string) => string
1421
+ scriptsPath: (path?: string) => string
1422
+ securityPath: (path?: string) => string
1423
+ serverPath: (path?: string) => string
1424
+ userServerPath: (path?: string) => string
1425
+ serverlessPath: (path?: string) => string
1426
+ stacksPath: (path?: string) => string
1427
+ stringsPath: (path?: string) => string
1428
+ shellPath: (path?: string) => string
1429
+ storesPath: (path?: string) => string
1430
+ testingPath: (path?: string) => string
1431
+ testsPath: (path?: string) => string
1432
+ tinkerPath: (path?: string) => string
1433
+ typesPath: (path?: string) => string
1434
+ uiPath: (path?: string, options?: { relative?: boolean }) => string
1435
+ userDatabasePath: (path?: string) => string
1436
+ userMigrationsPath: (path?: string) => string
1437
+ userEventsPath: (path?: string) => string
1438
+ userJobsPath: (path?: string) => string
1439
+ userListenersPath: (path?: string) => string
1440
+ userMiddlewarePath: (path?: string) => string
1441
+ userModelsPath: (path?: string) => string
1442
+ userNotificationsPath: (path?: string) => string
1443
+ utilsPath: (path?: string) => string
1444
+ validationPath: (path?: string) => string
1445
+ viteConfigPath: (path?: string) => string
1446
+ vitePluginPath: (path?: string) => string
1447
+ xRayPath: (path?: string) => string
1448
+ homeDir: (path?: string) => string
1449
+ basename: (path: string) => string
1450
+ delimiter: () => ';' | ':'
1451
+ dirname: (path: string) => string
1452
+ extname: (path: string) => string
1453
+ isAbsolute: (path: string) => boolean
1454
+ join: (...paths: string[]) => string
1455
+ normalize: (path: string) => string
1456
+ relative: (from: string, to: string) => string
1457
+ resolve: (...paths: string[]) => string
1458
+ parse: (path: string) => ParsedPath
1459
+ sep: () => '/' | '\\'
1460
+ toNamespacedPath: (path: string) => string
1461
+ }
1462
+
1463
+ export const path: Path = {
1282
1464
  actionsPath,
1283
1465
  userActionsPath,
1284
1466
  builtUserActionsPath,
@@ -1293,6 +1475,7 @@ export const path = {
1293
1475
  arraysPath,
1294
1476
  appPath,
1295
1477
  authPath,
1478
+ coreApiPath,
1296
1479
  buddyPath,
1297
1480
  buildEnginePath,
1298
1481
  libsEntriesPath,
@@ -1317,6 +1500,7 @@ export const path = {
1317
1500
  dnsPath,
1318
1501
  emailPath,
1319
1502
  enumsPath,
1503
+ eslintPluginPath,
1320
1504
  errorHandlingPath,
1321
1505
  eventsPath,
1322
1506
  coreEnvPath,
@@ -1324,6 +1508,7 @@ export const path = {
1324
1508
  examplesPath,
1325
1509
  fakerPath,
1326
1510
  frameworkPath,
1511
+ browserPath,
1327
1512
  storagePath,
1328
1513
  functionsPath,
1329
1514
  gitPath,
@@ -1395,7 +1580,7 @@ export const path = {
1395
1580
 
1396
1581
  // path utils
1397
1582
  basename,
1398
- delimiter,
1583
+ delimiter: () => delimiter,
1399
1584
  dirname,
1400
1585
  extname,
1401
1586
  isAbsolute,
@@ -1404,7 +1589,7 @@ export const path = {
1404
1589
  relative,
1405
1590
  resolve,
1406
1591
  parse,
1407
- sep,
1592
+ sep: () => sep,
1408
1593
  toNamespacedPath,
1409
1594
  }
1410
1595