jamdesk 1.1.39 → 1.1.41

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.
Files changed (55) hide show
  1. package/dist/__tests__/unit/clean.test.d.ts +2 -0
  2. package/dist/__tests__/unit/clean.test.d.ts.map +1 -0
  3. package/dist/__tests__/unit/clean.test.js +59 -0
  4. package/dist/__tests__/unit/clean.test.js.map +1 -0
  5. package/dist/__tests__/unit/dev-cache-cleanup.test.d.ts +2 -0
  6. package/dist/__tests__/unit/dev-cache-cleanup.test.d.ts.map +1 -0
  7. package/dist/__tests__/unit/dev-cache-cleanup.test.js +74 -0
  8. package/dist/__tests__/unit/dev-cache-cleanup.test.js.map +1 -0
  9. package/dist/__tests__/unit/dev-lock.test.d.ts +2 -0
  10. package/dist/__tests__/unit/dev-lock.test.d.ts.map +1 -0
  11. package/dist/__tests__/unit/dev-lock.test.js +70 -0
  12. package/dist/__tests__/unit/dev-lock.test.js.map +1 -0
  13. package/dist/__tests__/unit/dev-sync-vendored.test.d.ts +2 -0
  14. package/dist/__tests__/unit/dev-sync-vendored.test.d.ts.map +1 -0
  15. package/dist/__tests__/unit/dev-sync-vendored.test.js +58 -0
  16. package/dist/__tests__/unit/dev-sync-vendored.test.js.map +1 -0
  17. package/dist/__tests__/unit/run-build-script.test.d.ts +2 -0
  18. package/dist/__tests__/unit/run-build-script.test.d.ts.map +1 -0
  19. package/dist/__tests__/unit/run-build-script.test.js +58 -0
  20. package/dist/__tests__/unit/run-build-script.test.js.map +1 -0
  21. package/dist/__tests__/unit/workspace-paths.test.d.ts +2 -0
  22. package/dist/__tests__/unit/workspace-paths.test.d.ts.map +1 -0
  23. package/dist/__tests__/unit/workspace-paths.test.js +104 -0
  24. package/dist/__tests__/unit/workspace-paths.test.js.map +1 -0
  25. package/dist/commands/clean.d.ts +17 -2
  26. package/dist/commands/clean.d.ts.map +1 -1
  27. package/dist/commands/clean.js +47 -27
  28. package/dist/commands/clean.js.map +1 -1
  29. package/dist/commands/dev.d.ts +17 -0
  30. package/dist/commands/dev.d.ts.map +1 -1
  31. package/dist/commands/dev.js +116 -95
  32. package/dist/commands/dev.js.map +1 -1
  33. package/dist/index.js +9 -10
  34. package/dist/index.js.map +1 -1
  35. package/dist/lib/deps.d.ts +0 -4
  36. package/dist/lib/deps.d.ts.map +1 -1
  37. package/dist/lib/deps.js +0 -6
  38. package/dist/lib/deps.js.map +1 -1
  39. package/dist/lib/dev-lock.d.ts +15 -0
  40. package/dist/lib/dev-lock.d.ts.map +1 -0
  41. package/dist/lib/dev-lock.js +95 -0
  42. package/dist/lib/dev-lock.js.map +1 -0
  43. package/dist/lib/run-build-script.d.ts +13 -0
  44. package/dist/lib/run-build-script.d.ts.map +1 -0
  45. package/dist/lib/run-build-script.js +36 -0
  46. package/dist/lib/run-build-script.js.map +1 -0
  47. package/dist/lib/safe-fs.d.ts +18 -0
  48. package/dist/lib/safe-fs.d.ts.map +1 -0
  49. package/dist/lib/safe-fs.js +55 -0
  50. package/dist/lib/safe-fs.js.map +1 -0
  51. package/dist/lib/workspace-paths.d.ts +37 -0
  52. package/dist/lib/workspace-paths.d.ts.map +1 -0
  53. package/dist/lib/workspace-paths.js +64 -0
  54. package/dist/lib/workspace-paths.js.map +1 -0
  55. package/package.json +1 -1
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Per-project workspace path helpers.
3
+ *
4
+ * Each customer project gets its own isolated `~/.jamdesk/workspaces/<slug>/`
5
+ * so two `jamdesk dev` processes can coexist without clobbering each other's
6
+ * turbopack persistence layer (which previously caused mid-run rust panics
7
+ * like `range end index out of range for slice of length`).
8
+ */
9
+ import { createHash } from 'crypto';
10
+ import path from 'path';
11
+ import fs from 'fs-extra';
12
+ import { safeRemoveCache } from './safe-fs.js';
13
+ const MAX_BASENAME_LEN = 80; // leaves room for "-<6hash>" under NAME_MAX (255)
14
+ const HASH_LEN = 6;
15
+ /**
16
+ * Build a stable slug for a project workspace from its absolute path.
17
+ *
18
+ * Format: `<sanitised-basename>-<6-char-sha256-prefix>`. The basename keeps
19
+ * the directory human-readable; the hash makes two clones of the same repo
20
+ * (same basename, different paths) collision-free.
21
+ */
22
+ export function computeWorkspaceSlug(absoluteCwd) {
23
+ const hash = createHash('sha256').update(absoluteCwd).digest('hex').slice(0, HASH_LEN);
24
+ const raw = path.basename(absoluteCwd.replace(/[/\\]+$/, '')) || 'project';
25
+ const sanitised = raw.toLowerCase().replace(/[^a-z0-9-]+/g, '-').replace(/^-+|-+$/g, '');
26
+ const safe = sanitised.slice(0, MAX_BASENAME_LEN) || 'project';
27
+ return `${safe}-${hash}`;
28
+ }
29
+ /**
30
+ * Resolve the per-project workspace directory under `<jamdeskDir>/workspaces/`.
31
+ *
32
+ * Symlinks are followed via `realpathSync` so that running from a symlink
33
+ * and from the real path produce the same workspace. If the project dir
34
+ * does not yet exist we fall back to `path.resolve` — the caller (e.g.
35
+ * `clean`) may want a path even when no workspace has ever been created.
36
+ */
37
+ export function getProjectWorkspaceDir(jamdeskDir, projectDir) {
38
+ let real;
39
+ try {
40
+ real = fs.realpathSync(projectDir);
41
+ }
42
+ catch {
43
+ real = path.resolve(projectDir);
44
+ }
45
+ return path.join(jamdeskDir, 'workspaces', computeWorkspaceSlug(real));
46
+ }
47
+ /**
48
+ * One-time migration: delete the legacy `<jamdeskDir>/workspace` directory
49
+ * (the single shared workspace from CLI ≤1.1.40). Uses `safeRemoveCache` so
50
+ * a still-running 1.1.40 dev session holding files in the legacy workspace
51
+ * surfaces the friendly "another dev session" message instead of crashing
52
+ * with the ENOTEMPTY race we just patched.
53
+ *
54
+ * Returns true if a legacy workspace was removed, false if nothing to do.
55
+ * Safe to call on every dev startup — no-op once the legacy dir is gone.
56
+ */
57
+ export async function migrateLegacyWorkspace(jamdeskDir) {
58
+ const legacy = path.join(jamdeskDir, 'workspace');
59
+ if (!fs.existsSync(legacy))
60
+ return false;
61
+ await safeRemoveCache(legacy);
62
+ return true;
63
+ }
64
+ //# sourceMappingURL=workspace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,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,UAAkB;IAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAClD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IACzC,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jamdesk",
3
- "version": "1.1.39",
3
+ "version": "1.1.41",
4
4
  "description": "CLI for Jamdesk — build, preview, and deploy documentation sites from MDX. Dev server with hot reload, 50+ components, OpenAPI support, AI search, and Mintlify migration",
5
5
  "keywords": [
6
6
  "jamdesk",