specra 0.2.62 → 0.2.63

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 CHANGED
@@ -11,6 +11,7 @@ export * from './parsers/index.js';
11
11
  export type * from './api.types.js';
12
12
  export type { ApiParam, ApiHeader, ApiResponse as SpecraApiResponse, ApiEndpointSpec, SpecraApiSpec } from './api-parser.types.js';
13
13
  export * from './utils.js';
14
+ export * from './links.js';
14
15
  export * from './sidebar-utils.js';
15
16
  export * from './category.js';
16
17
  export * from './redirects.js';
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ export * from './config.js';
15
15
  export * from './parsers/index.js';
16
16
  // Utilities
17
17
  export * from './utils.js';
18
+ export * from './links.js';
18
19
  export * from './sidebar-utils.js';
19
20
  export * from './category.js';
20
21
  export * from './redirects.js';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Prefix an absolute app path with the configured SvelteKit base path
3
+ * (derived from `deployment.basePath` in specra.config.json).
4
+ *
5
+ * SvelteKit does not auto-apply the base path to `redirect()` targets or to
6
+ * raw `href` string literals, so any link or redirect built from a string must
7
+ * go through this helper to resolve correctly under a subpath deployment
8
+ * (e.g. GitHub Pages at `/repo/`). It works in both client and server code,
9
+ * since `base` is a plain string.
10
+ *
11
+ * <a href={link('/docs/v1/intro')}> -> `${base}/docs/v1/intro`
12
+ * redirect(302, link(`/docs/${version}`)) -> `${base}/docs/...`
13
+ *
14
+ * Passing an empty string returns the site root under the base path.
15
+ */
16
+ export declare function link(path: string): string;
package/dist/links.js ADDED
@@ -0,0 +1,22 @@
1
+ import { base } from '$app/paths';
2
+ /**
3
+ * Prefix an absolute app path with the configured SvelteKit base path
4
+ * (derived from `deployment.basePath` in specra.config.json).
5
+ *
6
+ * SvelteKit does not auto-apply the base path to `redirect()` targets or to
7
+ * raw `href` string literals, so any link or redirect built from a string must
8
+ * go through this helper to resolve correctly under a subpath deployment
9
+ * (e.g. GitHub Pages at `/repo/`). It works in both client and server code,
10
+ * since `base` is a plain string.
11
+ *
12
+ * <a href={link('/docs/v1/intro')}> -> `${base}/docs/v1/intro`
13
+ * redirect(302, link(`/docs/${version}`)) -> `${base}/docs/...`
14
+ *
15
+ * Passing an empty string returns the site root under the base path.
16
+ */
17
+ export function link(path) {
18
+ if (!path || path === '/')
19
+ return base || '/';
20
+ const p = path.startsWith('/') ? path : `/${path}`;
21
+ return `${base}${p}`;
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specra",
3
- "version": "0.2.62",
3
+ "version": "0.2.63",
4
4
  "description": "A modern documentation library for SvelteKit with built-in versioning, API reference generation, full-text search, and MDX support",
5
5
  "svelte": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",