@stacksjs/path 0.75.254 → 0.75.256
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.d.ts +3 -2
- package/dist/index.js +8 -0
- package/dist/project.d.ts +14 -0
- package/dist/project.js +7 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { appPath, frameworkDefaultsRoot, frameworkPath, projectPath, storagePath, usesVendoredDefaults } from './project';
|
|
1
|
+
import { appPath, defaultsPath, frameworkDefaultsRoot, frameworkPath, projectPath, storagePath, usesVendoredDefaults } from './project';
|
|
2
2
|
import { basename, delimiter, dirname, extname, isAbsolute, join, normalize, parse, relative, resolve, sep, toNamespacedPath } from 'node:path';
|
|
3
3
|
import type { ParsedPath } from 'node:path';
|
|
4
4
|
/**
|
|
@@ -1221,6 +1221,7 @@ export declare interface Path {
|
|
|
1221
1221
|
browserPath: (path?: string) => string
|
|
1222
1222
|
storagePath: (path?: string) => string
|
|
1223
1223
|
frameworkDefaultsRoot: (projectRoot?: string) => string
|
|
1224
|
+
defaultsPath: (path?: string, options?: { relative?: boolean, cwd?: string }) => string
|
|
1224
1225
|
usesVendoredDefaults: (projectRoot?: string) => boolean
|
|
1225
1226
|
functionsPath: (path?: string) => string
|
|
1226
1227
|
gitPath: (path?: string) => string
|
|
@@ -1321,6 +1322,6 @@ export declare interface Path {
|
|
|
1321
1322
|
* comparison can say whether it is current.
|
|
1322
1323
|
*/
|
|
1323
1324
|
export type DefaultsProvenance = 'not-applicable' | 'current' | 'stale' | 'unstamped';
|
|
1324
|
-
export { appPath, frameworkDefaultsRoot, frameworkPath, isCompiledBinary, isInstalledDefaultsRoot, linkPackagedDefaults, packagedDefaultsRoot, projectPath, storagePath, usesVendoredDefaults } from './project';
|
|
1325
|
+
export { appPath, defaultsPath, frameworkDefaultsRoot, frameworkPath, isCompiledBinary, isInstalledDefaultsRoot, linkPackagedDefaults, packagedDefaultsRoot, projectPath, storagePath, usesVendoredDefaults } from './project';
|
|
1325
1326
|
export { resolveModulePath } from './module-resolution';
|
|
1326
1327
|
export { basename, delimiter, dirname, extname, isAbsolute, join, normalize, relative, resolve, sep, toNamespacedPath };
|
package/dist/index.js
CHANGED
|
@@ -143,6 +143,12 @@ function storagePath(path) {
|
|
|
143
143
|
return resolve(frameworkDefaultsRoot(), `.${sub.slice(VENDORED_DEFAULTS.length)}`);
|
|
144
144
|
return projectPath(`storage/${sub}`);
|
|
145
145
|
}
|
|
146
|
+
function defaultsPath(path = "", options) {
|
|
147
|
+
const absolutePath = resolve(frameworkDefaultsRoot(), path);
|
|
148
|
+
if (options?.relative)
|
|
149
|
+
return relative(options.cwd || process.cwd(), absolutePath);
|
|
150
|
+
return absolutePath;
|
|
151
|
+
}
|
|
146
152
|
function frameworkPath(path, options) {
|
|
147
153
|
const absolutePath = storagePath(`framework/${path || ""}`);
|
|
148
154
|
if (options?.relative)
|
|
@@ -784,6 +790,7 @@ var path = {
|
|
|
784
790
|
browserPath,
|
|
785
791
|
storagePath,
|
|
786
792
|
frameworkDefaultsRoot,
|
|
793
|
+
defaultsPath,
|
|
787
794
|
usesVendoredDefaults,
|
|
788
795
|
functionsPath,
|
|
789
796
|
gitPath,
|
|
@@ -913,6 +920,7 @@ export {
|
|
|
913
920
|
datetimePath,
|
|
914
921
|
defaultsAppPath,
|
|
915
922
|
defaultsPackagePath,
|
|
923
|
+
defaultsPath,
|
|
916
924
|
defaultsResourcesPath,
|
|
917
925
|
delimiter,
|
|
918
926
|
desktopPath,
|
package/dist/project.d.ts
CHANGED
|
@@ -67,4 +67,18 @@ export declare function frameworkDefaultsRoot(projectRoot?: string): string;
|
|
|
67
67
|
* works the same whether the app vendors the tree or not.
|
|
68
68
|
*/
|
|
69
69
|
export declare function storagePath(path?: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* A path inside the scaffold defaults tree, wherever that tree is.
|
|
72
|
+
*
|
|
73
|
+
* `frameworkDefaultsRoot()` already answers that question, and `storagePath`
|
|
74
|
+
* and `frameworkPath` already route `framework/defaults/...` through it, so
|
|
75
|
+
* this adds no resolution of its own. It exists because a caller that means
|
|
76
|
+
* "a file in the defaults" reads better saying so, and because
|
|
77
|
+
* stacksjs/stacks#2941 converted a number of call sites to it.
|
|
78
|
+
*
|
|
79
|
+
* Deliberately a wrapper rather than a second resolver. Two answers to "where
|
|
80
|
+
* are the defaults" is the failure in #2927, where two sources for one
|
|
81
|
+
* component name picked the wrong one by readdir order.
|
|
82
|
+
*/
|
|
83
|
+
export declare function defaultsPath(path?: string, options?: { relative?: boolean, cwd?: string }): string;
|
|
70
84
|
export declare function frameworkPath(path?: string, options?: { relative?: boolean, cwd?: string }): string;
|
package/dist/project.js
CHANGED
|
@@ -113,6 +113,12 @@ function storagePath(path) {
|
|
|
113
113
|
return resolve(frameworkDefaultsRoot(), `.${sub.slice(VENDORED_DEFAULTS.length)}`);
|
|
114
114
|
return projectPath(`storage/${sub}`);
|
|
115
115
|
}
|
|
116
|
+
function defaultsPath(path = "", options) {
|
|
117
|
+
const absolutePath = resolve(frameworkDefaultsRoot(), path);
|
|
118
|
+
if (options?.relative)
|
|
119
|
+
return relative(options.cwd || process.cwd(), absolutePath);
|
|
120
|
+
return absolutePath;
|
|
121
|
+
}
|
|
116
122
|
function frameworkPath(path, options) {
|
|
117
123
|
const absolutePath = storagePath(`framework/${path || ""}`);
|
|
118
124
|
if (options?.relative)
|
|
@@ -121,6 +127,7 @@ function frameworkPath(path, options) {
|
|
|
121
127
|
}
|
|
122
128
|
export {
|
|
123
129
|
appPath,
|
|
130
|
+
defaultsPath,
|
|
124
131
|
frameworkDefaultsRoot,
|
|
125
132
|
frameworkPath,
|
|
126
133
|
isCompiledBinary,
|