specra 0.2.61 → 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/dist/mdx-cache.js CHANGED
@@ -7,8 +7,14 @@
7
7
  */
8
8
  import { getVersions, getAllDocs, getDocBySlug } from './mdx';
9
9
  import { clearProductCaches } from './config.server';
10
- import { watch } from 'fs';
11
- import { join } from 'path';
10
+ // Default imports (member access) rather than named imports: under a
11
+ // browser/static build these node builtins are externalized, and named imports
12
+ // (`{ join }`) fail the client bundle with "not exported by
13
+ // __vite-browser-external". Member access (`path.join`) defers to runtime and
14
+ // is dead code client-side, since these caches only run server-side. Matches
15
+ // the import style in mdx.ts / config.server.ts / category.ts.
16
+ import fs from 'fs';
17
+ import path from 'path';
12
18
  import { PerfTimer, logCacheOperation } from './dev-utils';
13
19
  const isDevelopment = typeof process !== 'undefined' && process.env?.NODE_ENV === 'development';
14
20
  // Cache stores
@@ -30,9 +36,9 @@ function initializeWatchers() {
30
36
  if (!isDevelopment || watchersInitialized)
31
37
  return;
32
38
  watchersInitialized = true;
33
- const docsPath = join(process.cwd(), 'docs');
39
+ const docsPath = path.join(process.cwd(), 'docs');
34
40
  try {
35
- watch(docsPath, { recursive: true }, (eventType, filename) => {
41
+ fs.watch(docsPath, { recursive: true }, (eventType, filename) => {
36
42
  if (!filename)
37
43
  return;
38
44
  // Invalidate relevant caches when MDX or JSON files change
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "specra",
3
- "version": "0.2.61",
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",
7
7
  "type": "module",
8
+ "sideEffects": [
9
+ "**/*.css",
10
+ "**/*.svelte"
11
+ ],
8
12
  "exports": {
9
13
  ".": {
10
14
  "types": "./dist/index.d.ts",