@stacksjs/path 0.58.72 → 0.58.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +15 -1
- package/package.json +1 -1
- package/src/index.ts +18 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/index.ts
|
|
3
3
|
import process from "process";
|
|
4
|
+
import os from "os";
|
|
4
5
|
import {basename, delimiter, dirname, extname, format, isAbsolute, join, normalize, normalizeString, parse, relative, resolve, sep, toNamespacedPath} from "pathe";
|
|
5
6
|
function actionsPath(path) {
|
|
6
7
|
return corePath(`actions/src/${path || ""}`);
|
|
@@ -249,7 +250,10 @@ function queuePath(path) {
|
|
|
249
250
|
function realtimePath(path) {
|
|
250
251
|
return corePath(`realtime/${path || ""}`);
|
|
251
252
|
}
|
|
252
|
-
function resourcesPath(path) {
|
|
253
|
+
function resourcesPath(path, options) {
|
|
254
|
+
const absolutePath = projectStoragePath(`resources/${path || ""}`);
|
|
255
|
+
if (options?.relative)
|
|
256
|
+
return relative(process.cwd(), absolutePath);
|
|
253
257
|
return projectPath(`resources/${path || ""}`);
|
|
254
258
|
}
|
|
255
259
|
function replPath(path) {
|
|
@@ -303,6 +307,9 @@ function serverlessPath(path) {
|
|
|
303
307
|
function stacksPath(path) {
|
|
304
308
|
return frameworkPath(`src/${path || ""}`);
|
|
305
309
|
}
|
|
310
|
+
function shellPath(path) {
|
|
311
|
+
return corePath(`shell/${path || ""}`);
|
|
312
|
+
}
|
|
306
313
|
function stringsPath(path) {
|
|
307
314
|
return corePath(`strings/${path || ""}`);
|
|
308
315
|
}
|
|
@@ -333,6 +340,9 @@ function vitePath(path) {
|
|
|
333
340
|
function xRayPath(path) {
|
|
334
341
|
return frameworkPath(`stacks/x-ray/${path || ""}`);
|
|
335
342
|
}
|
|
343
|
+
function homeDir(path) {
|
|
344
|
+
return os.homedir() + (path ? (path.startsWith("/") ? "" : "/") + path : "~");
|
|
345
|
+
}
|
|
336
346
|
var path = {
|
|
337
347
|
actionsPath,
|
|
338
348
|
userActionsPath,
|
|
@@ -419,6 +429,7 @@ var path = {
|
|
|
419
429
|
serverlessPath,
|
|
420
430
|
stacksPath,
|
|
421
431
|
stringsPath,
|
|
432
|
+
shellPath,
|
|
422
433
|
storesPath,
|
|
423
434
|
testingPath,
|
|
424
435
|
testsPath,
|
|
@@ -435,6 +446,7 @@ var path = {
|
|
|
435
446
|
validationPath,
|
|
436
447
|
vitePath,
|
|
437
448
|
xRayPath,
|
|
449
|
+
homeDir,
|
|
438
450
|
basename,
|
|
439
451
|
delimiter,
|
|
440
452
|
dirname,
|
|
@@ -476,6 +488,7 @@ export {
|
|
|
476
488
|
smsPath,
|
|
477
489
|
slugPath,
|
|
478
490
|
signalsPath,
|
|
491
|
+
shellPath,
|
|
479
492
|
settingsPath,
|
|
480
493
|
serverlessPath,
|
|
481
494
|
serverPath,
|
|
@@ -525,6 +538,7 @@ export {
|
|
|
525
538
|
join,
|
|
526
539
|
jobsPath,
|
|
527
540
|
isAbsolute,
|
|
541
|
+
homeDir,
|
|
528
542
|
healthPath,
|
|
529
543
|
gitPath,
|
|
530
544
|
functionsPath,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
+
import os from 'node:os'
|
|
2
3
|
import { basename, delimiter, dirname, extname, format, isAbsolute, join, normalize, normalizeString, parse, relative, resolve, sep, toNamespacedPath } from 'pathe'
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -259,6 +260,7 @@ export function langPath(path?: string) {
|
|
|
259
260
|
|
|
260
261
|
export function layoutsPath(path?: string, options?: { relative?: boolean }) {
|
|
261
262
|
const absolutePath = resourcesPath(`layouts/${path || ''}`)
|
|
263
|
+
|
|
262
264
|
if (options?.relative)
|
|
263
265
|
return relative(process.cwd(), absolutePath)
|
|
264
266
|
|
|
@@ -379,7 +381,12 @@ export function realtimePath(path?: string) {
|
|
|
379
381
|
return corePath(`realtime/${path || ''}`)
|
|
380
382
|
}
|
|
381
383
|
|
|
382
|
-
export function resourcesPath(path?: string) {
|
|
384
|
+
export function resourcesPath(path?: string, options?: { relative?: boolean }) {
|
|
385
|
+
const absolutePath = projectStoragePath(`resources/${path || ''}`)
|
|
386
|
+
|
|
387
|
+
if (options?.relative)
|
|
388
|
+
return relative(process.cwd(), absolutePath)
|
|
389
|
+
|
|
383
390
|
return projectPath(`resources/${path || ''}`)
|
|
384
391
|
}
|
|
385
392
|
|
|
@@ -452,6 +459,10 @@ export function stacksPath(path?: string) {
|
|
|
452
459
|
return frameworkPath(`src/${path || ''}`)
|
|
453
460
|
}
|
|
454
461
|
|
|
462
|
+
export function shellPath(path?: string) {
|
|
463
|
+
return corePath(`shell/${path || ''}`)
|
|
464
|
+
}
|
|
465
|
+
|
|
455
466
|
export function stringsPath(path?: string) {
|
|
456
467
|
return corePath(`strings/${path || ''}`)
|
|
457
468
|
}
|
|
@@ -492,6 +503,10 @@ export function xRayPath(path?: string) {
|
|
|
492
503
|
return frameworkPath(`stacks/x-ray/${path || ''}`)
|
|
493
504
|
}
|
|
494
505
|
|
|
506
|
+
export function homeDir(path?: string) {
|
|
507
|
+
return os.homedir() + (path ? (path.startsWith('/') ? '' : '/') + path : '~')
|
|
508
|
+
}
|
|
509
|
+
|
|
495
510
|
export const path = {
|
|
496
511
|
actionsPath,
|
|
497
512
|
userActionsPath,
|
|
@@ -578,6 +593,7 @@ export const path = {
|
|
|
578
593
|
serverlessPath,
|
|
579
594
|
stacksPath,
|
|
580
595
|
stringsPath,
|
|
596
|
+
shellPath,
|
|
581
597
|
storesPath,
|
|
582
598
|
testingPath,
|
|
583
599
|
testsPath,
|
|
@@ -594,6 +610,7 @@ export const path = {
|
|
|
594
610
|
validationPath,
|
|
595
611
|
vitePath,
|
|
596
612
|
xRayPath,
|
|
613
|
+
homeDir,
|
|
597
614
|
|
|
598
615
|
// path utils
|
|
599
616
|
basename,
|