@aprovan/patchwork 0.1.0 → 0.1.1

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 (71) hide show
  1. package/.github/workflows/publish.yml +1 -1
  2. package/.vscode/launch.json +19 -0
  3. package/README.md +24 -0
  4. package/apps/chat/package.json +4 -4
  5. package/apps/chat/vite.config.ts +8 -8
  6. package/docs/specs/directory-sync.md +822 -0
  7. package/docs/specs/patchwork-vscode.md +625 -0
  8. package/package.json +2 -2
  9. package/packages/compiler/package.json +3 -2
  10. package/packages/compiler/src/index.ts +13 -14
  11. package/packages/compiler/src/vfs/backends/http.ts +139 -0
  12. package/packages/compiler/src/vfs/backends/indexeddb.ts +185 -24
  13. package/packages/compiler/src/vfs/backends/memory.ts +166 -0
  14. package/packages/compiler/src/vfs/core/index.ts +26 -0
  15. package/packages/compiler/src/vfs/core/types.ts +93 -0
  16. package/packages/compiler/src/vfs/core/utils.ts +42 -0
  17. package/packages/compiler/src/vfs/core/virtual-fs.ts +120 -0
  18. package/packages/compiler/src/vfs/index.ts +37 -5
  19. package/packages/compiler/src/vfs/project.ts +16 -16
  20. package/packages/compiler/src/vfs/store.ts +183 -19
  21. package/packages/compiler/src/vfs/sync/differ.ts +47 -0
  22. package/packages/compiler/src/vfs/sync/engine.ts +398 -0
  23. package/packages/compiler/src/vfs/sync/index.ts +3 -0
  24. package/packages/compiler/src/vfs/sync/resolver.ts +46 -0
  25. package/packages/compiler/src/vfs/types.ts +1 -8
  26. package/packages/compiler/tsup.config.ts +5 -5
  27. package/packages/editor/package.json +1 -1
  28. package/packages/editor/src/components/CodeBlockExtension.tsx +1 -1
  29. package/packages/editor/src/components/CodePreview.tsx +59 -1
  30. package/packages/editor/src/components/edit/CodeBlockView.tsx +72 -0
  31. package/packages/editor/src/components/edit/EditModal.tsx +169 -28
  32. package/packages/editor/src/components/edit/FileTree.tsx +67 -13
  33. package/packages/editor/src/components/edit/MediaPreview.tsx +106 -0
  34. package/packages/editor/src/components/edit/SaveConfirmDialog.tsx +60 -0
  35. package/packages/editor/src/components/edit/fileTypes.ts +125 -0
  36. package/packages/editor/src/components/edit/index.ts +4 -0
  37. package/packages/editor/src/components/edit/types.ts +3 -0
  38. package/packages/editor/src/components/edit/useEditSession.ts +22 -4
  39. package/packages/editor/src/index.ts +17 -0
  40. package/packages/editor/src/lib/diff.ts +2 -1
  41. package/packages/editor/src/lib/vfs.ts +28 -10
  42. package/packages/editor/tsup.config.ts +10 -5
  43. package/packages/stitchery/package.json +5 -3
  44. package/packages/stitchery/src/server/index.ts +57 -57
  45. package/packages/stitchery/src/server/vfs-routes.ts +246 -56
  46. package/packages/stitchery/tsup.config.ts +5 -5
  47. package/packages/utcp/package.json +3 -2
  48. package/packages/utcp/tsconfig.json +6 -2
  49. package/packages/utcp/tsup.config.ts +6 -6
  50. package/packages/vscode/README.md +31 -0
  51. package/packages/vscode/media/outline.png +0 -0
  52. package/packages/vscode/media/outline.svg +70 -0
  53. package/packages/vscode/media/patchwork.png +0 -0
  54. package/packages/vscode/media/patchwork.svg +72 -0
  55. package/packages/vscode/node_modules/.bin/jiti +17 -0
  56. package/packages/vscode/node_modules/.bin/tsc +17 -0
  57. package/packages/vscode/node_modules/.bin/tsserver +17 -0
  58. package/packages/vscode/node_modules/.bin/tsup +17 -0
  59. package/packages/vscode/node_modules/.bin/tsup-node +17 -0
  60. package/packages/vscode/node_modules/.bin/tsx +17 -0
  61. package/packages/vscode/package.json +136 -0
  62. package/packages/vscode/src/extension.ts +612 -0
  63. package/packages/vscode/src/providers/PatchworkFileSystemProvider.ts +205 -0
  64. package/packages/vscode/src/providers/PatchworkTreeProvider.ts +177 -0
  65. package/packages/vscode/src/providers/PreviewPanelProvider.ts +536 -0
  66. package/packages/vscode/src/services/EditService.ts +24 -0
  67. package/packages/vscode/src/services/EmbeddedStitchery.ts +82 -0
  68. package/packages/vscode/tsconfig.json +13 -0
  69. package/packages/vscode/tsup.config.ts +11 -0
  70. package/packages/compiler/src/vfs/backends/local-fs.ts +0 -41
  71. package/packages/compiler/src/vfs/backends/s3.ts +0 -60
@@ -1,60 +0,0 @@
1
- import type { StorageBackend } from '../types.js';
2
-
3
- export interface S3Config {
4
- bucket: string;
5
- region: string;
6
- prefix?: string;
7
- credentials?: { accessKeyId: string; secretAccessKey: string };
8
- }
9
-
10
- export class S3Backend implements StorageBackend {
11
- constructor(private config: S3Config) {}
12
-
13
- private get baseUrl(): string {
14
- return `https://${this.config.bucket}.s3.${this.config.region}.amazonaws.com`;
15
- }
16
-
17
- private key(path: string): string {
18
- return this.config.prefix ? `${this.config.prefix}/${path}` : path;
19
- }
20
-
21
- async get(path: string): Promise<string | null> {
22
- const res = await fetch(`${this.baseUrl}/${this.key(path)}`);
23
- if (!res.ok) return null;
24
- return res.text();
25
- }
26
-
27
- async put(path: string, content: string): Promise<void> {
28
- await fetch(`${this.baseUrl}/${this.key(path)}`, {
29
- method: 'PUT',
30
- body: content,
31
- headers: { 'Content-Type': 'text/plain' },
32
- });
33
- }
34
-
35
- async delete(path: string): Promise<void> {
36
- await fetch(`${this.baseUrl}/${this.key(path)}`, { method: 'DELETE' });
37
- }
38
-
39
- async list(prefix?: string): Promise<string[]> {
40
- const listPrefix = prefix ? this.key(prefix) : this.config.prefix || '';
41
- const res = await fetch(
42
- `${this.baseUrl}?list-type=2&prefix=${encodeURIComponent(listPrefix)}`,
43
- );
44
- const xml = await res.text();
45
- return this.parseListResponse(xml);
46
- }
47
-
48
- async exists(path: string): Promise<boolean> {
49
- const res = await fetch(`${this.baseUrl}/${this.key(path)}`, {
50
- method: 'HEAD',
51
- });
52
- return res.ok;
53
- }
54
-
55
- private parseListResponse(xml: string): string[] {
56
- const matches = xml.matchAll(/<Key>([^<]+)<\/Key>/g);
57
- const prefixLen = this.config.prefix ? this.config.prefix.length + 1 : 0;
58
- return Array.from(matches, (m) => (m[1] ?? '').slice(prefixLen));
59
- }
60
- }