@vscode/component-explorer-cli 0.1.1-0

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 (85) hide show
  1. package/dist/browserPage.d.ts +15 -0
  2. package/dist/browserPage.d.ts.map +1 -0
  3. package/dist/browserPage.js +39 -0
  4. package/dist/browserPage.js.map +1 -0
  5. package/dist/commands/acceptCommand.d.ts +9 -0
  6. package/dist/commands/acceptCommand.d.ts.map +1 -0
  7. package/dist/commands/acceptCommand.js +34 -0
  8. package/dist/commands/acceptCommand.js.map +1 -0
  9. package/dist/commands/compareCommand.d.ts +8 -0
  10. package/dist/commands/compareCommand.d.ts.map +1 -0
  11. package/dist/commands/compareCommand.js +84 -0
  12. package/dist/commands/compareCommand.js.map +1 -0
  13. package/dist/commands/screenshotCommand.d.ts +10 -0
  14. package/dist/commands/screenshotCommand.d.ts.map +1 -0
  15. package/dist/commands/screenshotCommand.js +56 -0
  16. package/dist/commands/screenshotCommand.js.map +1 -0
  17. package/dist/commands/watchCommand.d.ts +12 -0
  18. package/dist/commands/watchCommand.d.ts.map +1 -0
  19. package/dist/commands/watchCommand.js +307 -0
  20. package/dist/commands/watchCommand.js.map +1 -0
  21. package/dist/componentExplorer.d.ts +46 -0
  22. package/dist/componentExplorer.d.ts.map +1 -0
  23. package/dist/componentExplorer.js +99 -0
  24. package/dist/componentExplorer.js.map +1 -0
  25. package/dist/dependencyInstaller.d.ts +4 -0
  26. package/dist/dependencyInstaller.d.ts.map +1 -0
  27. package/dist/dependencyInstaller.js +45 -0
  28. package/dist/dependencyInstaller.js.map +1 -0
  29. package/dist/explorerSession.d.ts +15 -0
  30. package/dist/explorerSession.d.ts.map +1 -0
  31. package/dist/explorerSession.js +24 -0
  32. package/dist/explorerSession.js.map +1 -0
  33. package/dist/git/gitCommitId.d.ts +8 -0
  34. package/dist/git/gitCommitId.d.ts.map +1 -0
  35. package/dist/git/gitCommitId.js +16 -0
  36. package/dist/git/gitCommitId.js.map +1 -0
  37. package/dist/git/gitCommitResolver.d.ts +23 -0
  38. package/dist/git/gitCommitResolver.d.ts.map +1 -0
  39. package/dist/git/gitCommitResolver.js +85 -0
  40. package/dist/git/gitCommitResolver.js.map +1 -0
  41. package/dist/git/gitService.d.ts +18 -0
  42. package/dist/git/gitService.d.ts.map +1 -0
  43. package/dist/git/gitService.js +38 -0
  44. package/dist/git/gitService.js.map +1 -0
  45. package/dist/git/gitUtils.d.ts +6 -0
  46. package/dist/git/gitUtils.d.ts.map +1 -0
  47. package/dist/git/gitUtils.js +30 -0
  48. package/dist/git/gitUtils.js.map +1 -0
  49. package/dist/git/gitWorktreeManager.d.ts +23 -0
  50. package/dist/git/gitWorktreeManager.d.ts.map +1 -0
  51. package/dist/git/gitWorktreeManager.js +91 -0
  52. package/dist/git/gitWorktreeManager.js.map +1 -0
  53. package/dist/httpServer.d.ts +23 -0
  54. package/dist/httpServer.d.ts.map +1 -0
  55. package/dist/httpServer.js +63 -0
  56. package/dist/httpServer.js.map +1 -0
  57. package/dist/index.d.ts +3 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.js +18 -0
  60. package/dist/index.js.map +1 -0
  61. package/dist/logger.d.ts +11 -0
  62. package/dist/logger.d.ts.map +1 -0
  63. package/dist/logger.js +13 -0
  64. package/dist/logger.js.map +1 -0
  65. package/dist/screenshotCache.d.ts +16 -0
  66. package/dist/screenshotCache.d.ts.map +1 -0
  67. package/dist/screenshotCache.js +59 -0
  68. package/dist/screenshotCache.js.map +1 -0
  69. package/dist/sourceTreeId.d.ts +5 -0
  70. package/dist/sourceTreeId.d.ts.map +1 -0
  71. package/dist/sourceTreeId.js +7 -0
  72. package/dist/sourceTreeId.js.map +1 -0
  73. package/dist/storage.d.ts +18 -0
  74. package/dist/storage.d.ts.map +1 -0
  75. package/dist/storage.js +55 -0
  76. package/dist/storage.js.map +1 -0
  77. package/dist/viteProjectRef.d.ts +22 -0
  78. package/dist/viteProjectRef.d.ts.map +1 -0
  79. package/dist/viteProjectRef.js +33 -0
  80. package/dist/viteProjectRef.js.map +1 -0
  81. package/dist/watchConfig.d.ts +49 -0
  82. package/dist/watchConfig.d.ts.map +1 -0
  83. package/dist/watchConfig.js +148 -0
  84. package/dist/watchConfig.js.map +1 -0
  85. package/package.json +45 -0
@@ -0,0 +1,91 @@
1
+ import { GitCommitId } from './gitCommitId.js';
2
+ import { execGit } from './gitUtils.js';
3
+ export class DefaultGitWorktreeManager {
4
+ _gitRoot;
5
+ constructor(_gitRoot) {
6
+ this._gitRoot = _gitRoot;
7
+ }
8
+ async create(worktreePath, commit) {
9
+ await execGit(this._gitRoot, ['worktree', 'add', worktreePath, commit.hash, '--detach']);
10
+ const result = await this.info(worktreePath);
11
+ if (!result) {
12
+ throw new Error(`Worktree was not created at: ${worktreePath}`);
13
+ }
14
+ return result;
15
+ }
16
+ async remove(worktreePath) {
17
+ const current = await this.info(worktreePath);
18
+ if (!current) {
19
+ throw new Error(`Worktree does not exist: ${worktreePath}`);
20
+ }
21
+ if (current.isDirty) {
22
+ throw new Error(`Worktree is dirty, refusing remove: ${worktreePath}`);
23
+ }
24
+ await execGit(this._gitRoot, ['worktree', 'remove', worktreePath]);
25
+ }
26
+ async checkout(worktreePath, commit) {
27
+ const current = await this.info(worktreePath);
28
+ if (!current) {
29
+ throw new Error(`Worktree does not exist: ${worktreePath}`);
30
+ }
31
+ if (current.isDirty) {
32
+ throw new Error(`Worktree is dirty, refusing checkout: ${worktreePath}`);
33
+ }
34
+ if (current.checkedOutCommit.equals(commit)) {
35
+ return current;
36
+ }
37
+ await execGit(worktreePath, ['checkout', commit.hash, '--detach']);
38
+ return (await this.info(worktreePath));
39
+ }
40
+ async info(worktreePath) {
41
+ try {
42
+ const head = (await execGit(worktreePath, ['rev-parse', 'HEAD'])).trim();
43
+ const status = (await execGit(worktreePath, ['status', '--porcelain'])).trim();
44
+ return {
45
+ path: worktreePath,
46
+ checkedOutCommit: new GitCommitId(head),
47
+ isDirty: status.length > 0,
48
+ };
49
+ }
50
+ catch {
51
+ return undefined;
52
+ }
53
+ }
54
+ async list(worktreeRoot) {
55
+ const output = await execGit(this._gitRoot, ['worktree', 'list', '--porcelain']);
56
+ const entries = [];
57
+ const blocks = output.split('\n\n').filter(b => b.trim());
58
+ for (const block of blocks) {
59
+ const lines = block.split('\n');
60
+ let entryPath;
61
+ let head;
62
+ let isDirty = false;
63
+ for (const line of lines) {
64
+ if (line.startsWith('worktree ')) {
65
+ entryPath = line.slice('worktree '.length);
66
+ }
67
+ else if (line.startsWith('HEAD ')) {
68
+ head = line.slice('HEAD '.length);
69
+ }
70
+ }
71
+ if (entryPath && head && entryPath.startsWith(worktreeRoot)) {
72
+ // Check dirty status via git status
73
+ try {
74
+ const status = (await execGit(entryPath, ['status', '--porcelain'])).trim();
75
+ isDirty = status.length > 0;
76
+ }
77
+ catch {
78
+ // If we can't check, skip this entry
79
+ continue;
80
+ }
81
+ entries.push({
82
+ path: entryPath,
83
+ checkedOutCommit: new GitCommitId(head),
84
+ isDirty,
85
+ });
86
+ }
87
+ }
88
+ return entries;
89
+ }
90
+ }
91
+ //# sourceMappingURL=gitWorktreeManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitWorktreeManager.js","sourceRoot":"","sources":["../../src/git/gitWorktreeManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAgBxC,MAAM,OAAO,yBAAyB;IACR;IAA7B,YAA6B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IAEjD,KAAK,CAAC,MAAM,CAAC,YAAoB,EAAE,MAAmB;QACrD,MAAM,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;QACzF,MAAM,MAAM,GAA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AC,EAAE,CAAC;oBAClC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAC5C,CAAC;qBAAM,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;oBACrC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACnC,CAAC;YACF,CAAC;YAED,IAAI,SAAS,IAAI,IAAI,IAAI,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC7D,oCAAoC;gBACpC,IAAI,CAAC;oBACJ,MAAM,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;oBAC5E,OAAO,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;gBAC7B,CAAC;gBAAC,MAAM,CAAC;oBACR,qCAAqC;oBACrC,SAAS;gBACV,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI,WAAW,CAAC,IAAI,CAAC;oBACvC,OAAO;iBACP,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACD"}
@@ -0,0 +1,23 @@
1
+ import type { IObservable } from '@vscode/observables';
2
+ import { SourceTreeId } from './sourceTreeId.js';
3
+ import { ViteProjectRef } from './viteProjectRef.js';
4
+ export interface ComponentExplorerHttpServerFactory {
5
+ /**
6
+ * @param resolveViteFrom Directory to resolve the `vite` package from.
7
+ * Defaults to `project.cwd`. Pass the main worktree's project dir
8
+ * when starting a server for a git worktree.
9
+ */
10
+ createViteServer(project: ViteProjectRef, resolveViteFrom?: string): Promise<ComponentExplorerHttpServer>;
11
+ createStaticServer(distDir: string): Promise<ComponentExplorerHttpServer>;
12
+ }
13
+ export interface ComponentExplorerHttpServer {
14
+ readonly url: string;
15
+ readonly isStatic: boolean;
16
+ readonly sourceTreeId: IObservable<SourceTreeId>;
17
+ dispose(): Promise<void>;
18
+ }
19
+ export declare class DefaultComponentExplorerHttpServerFactory implements ComponentExplorerHttpServerFactory {
20
+ createViteServer(project: ViteProjectRef, resolveViteFrom?: string): Promise<ComponentExplorerHttpServer>;
21
+ createStaticServer(_distDir: string): Promise<ComponentExplorerHttpServer>;
22
+ }
23
+ //# sourceMappingURL=httpServer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpServer.d.ts","sourceRoot":"","sources":["../src/httpServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,kCAAkC;IAClD;;;;OAIG;IACH,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC1G,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;CAC1E;AAED,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IACjD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,qBAAa,yCAA0C,YAAW,kCAAkC;IAC7F,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAIzG,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAGhF"}
@@ -0,0 +1,63 @@
1
+ import { observableValue } from '@vscode/observables';
2
+ import { SourceTreeId } from './sourceTreeId.js';
3
+ export class DefaultComponentExplorerHttpServerFactory {
4
+ async createViteServer(project, resolveViteFrom) {
5
+ return ViteComponentExplorerHttpServer.create(project, resolveViteFrom);
6
+ }
7
+ async createStaticServer(_distDir) {
8
+ throw new Error('Static server not yet implemented');
9
+ }
10
+ }
11
+ class ViteComponentExplorerHttpServer {
12
+ _server;
13
+ url;
14
+ sourceTreeId;
15
+ isStatic = false;
16
+ constructor(_server, url, sourceTreeId) {
17
+ this._server = _server;
18
+ this.url = url;
19
+ this.sourceTreeId = sourceTreeId;
20
+ }
21
+ static async create(project, resolveViteFrom) {
22
+ // Import Vite from the target project's node_modules, not ours.
23
+ // This ensures the config is loaded with the same Vite version and
24
+ // module resolution context as the target project.
25
+ // For worktree sessions, resolveViteFrom points to the main worktree's
26
+ // project dir so both sessions share the same Vite.
27
+ const { createRequire } = await import('node:module');
28
+ const { pathToFileURL } = await import('node:url');
29
+ const resolveFrom = resolveViteFrom ?? project.cwd;
30
+ const require = createRequire(resolveFrom + '/');
31
+ const vitePath = require.resolve('vite');
32
+ const viteUrl = pathToFileURL(vitePath).href;
33
+ const { createServer } = await import(/* @vite-ignore */ viteUrl);
34
+ // Change CWD so Vite resolves any relative `root` in the config correctly.
35
+ // We must NOT pass `root` as inline config because inline config
36
+ // takes precedence over the config file, which would break configs
37
+ // that set their own `root` (e.g. `root: '../..'`).
38
+ const prevCwd = process.cwd();
39
+ process.chdir(project.cwd);
40
+ let server;
41
+ try {
42
+ server = await createServer({
43
+ configFile: project.configFile,
44
+ server: { port: 0, strictPort: false },
45
+ });
46
+ await server.listen();
47
+ }
48
+ finally {
49
+ process.chdir(prevCwd);
50
+ }
51
+ const resolvedUrls = server.resolvedUrls;
52
+ const url = resolvedUrls?.local[0] ?? `http://localhost:${server.httpServer?.address()?.port}`;
53
+ const treeId = observableValue('sourceTreeId', new SourceTreeId(Date.now().toString()));
54
+ server.watcher.on('change', () => {
55
+ treeId.set(new SourceTreeId(Date.now().toString()), undefined);
56
+ });
57
+ return new ViteComponentExplorerHttpServer(server, url.replace(/\/$/, ''), treeId);
58
+ }
59
+ async dispose() {
60
+ await this._server.close();
61
+ }
62
+ }
63
+ //# sourceMappingURL=httpServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpServer.js","sourceRoot":"","sources":["../src/httpServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAoBjD,MAAM,OAAO,yCAAyC;IACrD,KAAK,CAAC,gBAAgB,CAAC,OAAuB,EAAE,eAAwB;QACvE,OAAO,+BAA+B,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,QAAgB;QACxC,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACtD,CAAC;CACD;AAED,MAAM,+BAA+B;IAIlB;IACR;IACA;IALD,QAAQ,GAAG,KAAK,CAAC;IAE1B,YACkB,OAAqC,EAC7C,GAAW,EACX,YAAuC;QAF/B,YAAO,GAAP,OAAO,CAA8B;QAC7C,QAAG,GAAH,GAAG,CAAQ;QACX,iBAAY,GAAZ,YAAY,CAA2B;IAC9C,CAAC;IAEJ,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAuB,EAAE,eAAwB;QACpE,gEAAgE;QAChE,mEAAmE;QACnE,mDAAmD;QACnD,uEAAuE;QACvE,oDAAoD;QACpD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;QACtD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;QACnD,MAAM,WAAW,GAAG,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC;QACn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CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,+BAA+B,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IACpF,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACD"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import { Cli } from 'clipanion';
3
+ import { ScreenshotCommand } from './commands/screenshotCommand.js';
4
+ import { CompareCommand } from './commands/compareCommand.js';
5
+ import { AcceptCommand } from './commands/acceptCommand.js';
6
+ import { WatchCommand } from './commands/watchCommand.js';
7
+ const cli = new Cli({
8
+ binaryLabel: 'component-explorer',
9
+ binaryVersion: '0.1.0',
10
+ binaryName: 'component-explorer',
11
+ });
12
+ cli.register(ScreenshotCommand);
13
+ cli.register(CompareCommand);
14
+ cli.register(AcceptCommand);
15
+ cli.register(WatchCommand);
16
+ const [, , ...args] = process.argv;
17
+ await cli.runExit(args);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;IACnB,WAAW,EAAE,oBAAoB;IACjC,aAAa,EAAE,OAAO;IACtB,UAAU,EAAE,oBAAoB;CAChC,CAAC,CAAC;AAEH,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AAChC,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;AAC7B,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AAC5B,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAE3B,MAAM,CAAC,EAAC,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;AAClC,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface ILogger {
2
+ log(message: string): void;
3
+ }
4
+ export declare class ConsoleLogger implements ILogger {
5
+ private readonly _prefix;
6
+ private readonly _stream;
7
+ constructor(_prefix: string, _stream: NodeJS.WritableStream);
8
+ log(message: string): void;
9
+ }
10
+ export declare const nullLogger: ILogger;
11
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACvB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,qBAAa,aAAc,YAAW,OAAO;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAAU,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAzC,OAAO,EAAE,MAAM,EAAmB,OAAO,EAAE,MAAM,CAAC,cAAc;IAE7F,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG1B;AAED,eAAO,MAAM,UAAU,EAAE,OAA2B,CAAC"}
package/dist/logger.js ADDED
@@ -0,0 +1,13 @@
1
+ export class ConsoleLogger {
2
+ _prefix;
3
+ _stream;
4
+ constructor(_prefix, _stream) {
5
+ this._prefix = _prefix;
6
+ this._stream = _stream;
7
+ }
8
+ log(message) {
9
+ this._stream.write(`[${this._prefix}] ${message}\n`);
10
+ }
11
+ }
12
+ export const nullLogger = { log: () => { } };
13
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,aAAa;IACI;IAAkC;IAA/D,YAA6B,OAAe,EAAmB,OAA8B;QAAhE,YAAO,GAAP,OAAO,CAAQ;QAAmB,YAAO,GAAP,OAAO,CAAuB;IAAG,CAAC;IAEjG,GAAG,CAAC,OAAe;QAClB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC;IACtD,CAAC;CACD;AAED,MAAM,CAAC,MAAM,UAAU,GAAY,EAAE,GAAG,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare class ScreenshotCache {
2
+ private _screenshots;
3
+ private _fixtureIds;
4
+ replaceAll(screenshots: ReadonlyMap<string, Uint8Array>): void;
5
+ get(fixtureId: string): Uint8Array | undefined;
6
+ get fixtureIds(): readonly string[];
7
+ }
8
+ export interface CompareResult {
9
+ readonly added: readonly string[];
10
+ readonly removed: readonly string[];
11
+ readonly changed: readonly string[];
12
+ readonly unchanged: readonly string[];
13
+ }
14
+ export declare function compareScreenshots(baseline: ScreenshotCache, current: ScreenshotCache): CompareResult;
15
+ export declare function contentHash(data: Uint8Array): string;
16
+ //# sourceMappingURL=screenshotCache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screenshotCache.d.ts","sourceRoot":"","sources":["../src/screenshotCache.ts"],"names":[],"mappings":"AAEA,qBAAa,eAAe;IAC3B,OAAO,CAAC,YAAY,CAAiC;IACrD,OAAO,CAAC,WAAW,CAAyB;IAE5C,UAAU,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAK9D,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAI9C,IAAI,UAAU,IAAI,SAAS,MAAM,EAAE,CAElC;CACD;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,eAAe,GACtB,aAAa,CA8Bf;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEpD"}
@@ -0,0 +1,59 @@
1
+ import { createHash } from 'node:crypto';
2
+ export class ScreenshotCache {
3
+ _screenshots = new Map();
4
+ _fixtureIds = [];
5
+ replaceAll(screenshots) {
6
+ this._screenshots = new Map(screenshots);
7
+ this._fixtureIds = [...screenshots.keys()];
8
+ }
9
+ get(fixtureId) {
10
+ return this._screenshots.get(fixtureId);
11
+ }
12
+ get fixtureIds() {
13
+ return this._fixtureIds;
14
+ }
15
+ }
16
+ export function compareScreenshots(baseline, current) {
17
+ const added = [];
18
+ const removed = [];
19
+ const changed = [];
20
+ const unchanged = [];
21
+ const baselineIds = new Set(baseline.fixtureIds);
22
+ const currentIds = new Set(current.fixtureIds);
23
+ for (const id of currentIds) {
24
+ if (!baselineIds.has(id)) {
25
+ added.push(id);
26
+ }
27
+ else {
28
+ const baselinePng = baseline.get(id);
29
+ const currentPng = current.get(id);
30
+ if (buffersEqual(baselinePng, currentPng)) {
31
+ unchanged.push(id);
32
+ }
33
+ else {
34
+ changed.push(id);
35
+ }
36
+ }
37
+ }
38
+ for (const id of baselineIds) {
39
+ if (!currentIds.has(id)) {
40
+ removed.push(id);
41
+ }
42
+ }
43
+ return { added, removed, changed, unchanged };
44
+ }
45
+ export function contentHash(data) {
46
+ return createHash('sha256').update(data).digest('hex').slice(0, 12);
47
+ }
48
+ function buffersEqual(a, b) {
49
+ if (a.length !== b.length) {
50
+ return false;
51
+ }
52
+ for (let i = 0; i < a.length; i++) {
53
+ if (a[i] !== b[i]) {
54
+ return false;
55
+ }
56
+ }
57
+ return true;
58
+ }
59
+ //# sourceMappingURL=screenshotCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screenshotCache.js","sourceRoot":"","sources":["../src/screenshotCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,OAAO,eAAe;IACnB,YAAY,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC7C,WAAW,GAAsB,EAAE,CAAC;IAE5C,UAAU,CAAC,WAA4C;QACtD,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,GAAG,CAAC,SAAiB;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,UAAU;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;CACD;AASD,MAAM,UAAU,kBAAkB,CACjC,QAAyB,EACzB,OAAwB;IAExB,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAa,EAAE,CAAC;IAE/B,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,QAAQ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;IAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAAC,OAAO,KAAK,CAAC;QAAC,CAAC;IACrC,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare class SourceTreeId {
2
+ readonly value: string;
3
+ constructor(value: string);
4
+ }
5
+ //# sourceMappingURL=sourceTreeId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceTreeId.d.ts","sourceRoot":"","sources":["../src/sourceTreeId.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAY;IACZ,QAAQ,CAAC,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM;CAClC"}
@@ -0,0 +1,7 @@
1
+ export class SourceTreeId {
2
+ value;
3
+ constructor(value) {
4
+ this.value = value;
5
+ }
6
+ }
7
+ //# sourceMappingURL=sourceTreeId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceTreeId.js","sourceRoot":"","sources":["../src/sourceTreeId.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAY;IACH;IAArB,YAAqB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;CACtC"}
@@ -0,0 +1,18 @@
1
+ export interface Storage {
2
+ write(filePath: string, data: Uint8Array): Promise<void>;
3
+ read(filePath: string): Promise<Uint8Array>;
4
+ exists(filePath: string): Promise<boolean>;
5
+ list(prefix: string): Promise<string[]>;
6
+ delete(filePath: string): Promise<void>;
7
+ }
8
+ export declare class FileSystemStorage implements Storage {
9
+ private readonly _rootDir;
10
+ constructor(_rootDir: string);
11
+ private _resolve;
12
+ write(filePath: string, data: Uint8Array): Promise<void>;
13
+ read(filePath: string): Promise<Uint8Array>;
14
+ exists(filePath: string): Promise<boolean>;
15
+ list(prefix: string): Promise<string[]>;
16
+ delete(filePath: string): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,OAAO;IACvB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACxC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAED,qBAAa,iBAAkB,YAAW,OAAO;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,MAAM;IAE7C,OAAO,CAAC,QAAQ;IAIV,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxD,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAI3C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS1C,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAkBvC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAO7C"}
@@ -0,0 +1,55 @@
1
+ import * as fs from 'node:fs/promises';
2
+ import * as path from 'node:path';
3
+ export class FileSystemStorage {
4
+ _rootDir;
5
+ constructor(_rootDir) {
6
+ this._rootDir = _rootDir;
7
+ }
8
+ _resolve(filePath) {
9
+ return path.join(this._rootDir, ...filePath.split('/'));
10
+ }
11
+ async write(filePath, data) {
12
+ const fullPath = this._resolve(filePath);
13
+ await fs.mkdir(path.dirname(fullPath), { recursive: true });
14
+ await fs.writeFile(fullPath, data);
15
+ }
16
+ async read(filePath) {
17
+ return new Uint8Array(await fs.readFile(this._resolve(filePath)));
18
+ }
19
+ async exists(filePath) {
20
+ try {
21
+ await fs.access(this._resolve(filePath));
22
+ return true;
23
+ }
24
+ catch {
25
+ return false;
26
+ }
27
+ }
28
+ async list(prefix) {
29
+ const dir = this._resolve(prefix);
30
+ try {
31
+ const entries = await fs.readdir(dir, { recursive: true });
32
+ const results = [];
33
+ for (const entry of entries) {
34
+ const entryPath = path.join(dir, entry);
35
+ const stat = await fs.stat(entryPath);
36
+ if (stat.isFile()) {
37
+ results.push(prefix + '/' + entry.split(path.sep).join('/'));
38
+ }
39
+ }
40
+ return results;
41
+ }
42
+ catch {
43
+ return [];
44
+ }
45
+ }
46
+ async delete(filePath) {
47
+ try {
48
+ await fs.unlink(this._resolve(filePath));
49
+ }
50
+ catch {
51
+ // ignore if not found
52
+ }
53
+ }
54
+ }
55
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAUlC,MAAM,OAAO,iBAAiB;IACA;IAA7B,YAA6B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IAEzC,QAAQ,CAAC,QAAgB;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,KA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nB,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC9D,CAAC;YACF,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAAgB;QAC5B,IAAI,CAAC;YACJ,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1C,CAAC;QAAC,MAAM,CAAC;YACR,sBAAsB;QACvB,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Immutable reference to a Vite-based component explorer project.
3
+ * Encapsulates how to locate the project for Vite's `createServer`.
4
+ */
5
+ export declare class ViteProjectRef {
6
+ /** Absolute directory to use as CWD when starting Vite. */
7
+ readonly cwd: string;
8
+ /**
9
+ * Absolute path to the Vite config file, or `undefined` to let
10
+ * Vite auto-discover it from `cwd`.
11
+ */
12
+ readonly configFile: string | undefined;
13
+ private constructor();
14
+ /** Create from a project root directory. Vite auto-discovers the config file. */
15
+ static fromSourceRootDir(sourceRootDir: string): ViteProjectRef;
16
+ /**
17
+ * Create from an explicit Vite config file path.
18
+ * CWD is derived as the config file's parent directory.
19
+ */
20
+ static fromViteConfigPath(viteConfigPath: string): ViteProjectRef;
21
+ }
22
+ //# sourceMappingURL=viteProjectRef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viteProjectRef.d.ts","sourceRoot":"","sources":["../src/viteProjectRef.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,cAAc;IAEzB,2DAA2D;IAC3D,QAAQ,CAAC,GAAG,EAAE,MAAM;IACpB;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS;IAPxC,OAAO;IAUP,iFAAiF;IACjF,MAAM,CAAC,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,cAAc;IAI/D;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CAAC,cAAc,EAAE,MAAM,GAAG,cAAc;CAIjE"}
@@ -0,0 +1,33 @@
1
+ import * as path from 'node:path';
2
+ /**
3
+ * Immutable reference to a Vite-based component explorer project.
4
+ * Encapsulates how to locate the project for Vite's `createServer`.
5
+ */
6
+ export class ViteProjectRef {
7
+ cwd;
8
+ configFile;
9
+ constructor(
10
+ /** Absolute directory to use as CWD when starting Vite. */
11
+ cwd,
12
+ /**
13
+ * Absolute path to the Vite config file, or `undefined` to let
14
+ * Vite auto-discover it from `cwd`.
15
+ */
16
+ configFile) {
17
+ this.cwd = cwd;
18
+ this.configFile = configFile;
19
+ }
20
+ /** Create from a project root directory. Vite auto-discovers the config file. */
21
+ static fromSourceRootDir(sourceRootDir) {
22
+ return new ViteProjectRef(path.resolve(sourceRootDir), undefined);
23
+ }
24
+ /**
25
+ * Create from an explicit Vite config file path.
26
+ * CWD is derived as the config file's parent directory.
27
+ */
28
+ static fromViteConfigPath(viteConfigPath) {
29
+ const absConfigPath = path.resolve(viteConfigPath);
30
+ return new ViteProjectRef(path.dirname(absConfigPath), absConfigPath);
31
+ }
32
+ }
33
+ //# sourceMappingURL=viteProjectRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viteProjectRef.js","sourceRoot":"","sources":["../src/viteProjectRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC;;;GAGG;AACH,MAAM,OAAO,cAAc;IAGhB;IAKA;IAPV;IACC,2DAA2D;IAClD,GAAW;IACpB;;;OAGG;IACM,UAA8B;QAL9B,QAAG,GAAH,GAAG,CAAQ;QAKX,eAAU,GAAV,UAAU,CAAoB;IACrC,CAAC;IAEJ,iFAAiF;IACjF,MAAM,CAAC,iBAAiB,CAAC,aAAqB;QAC7C,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CAAC,cAAsB;QAC/C,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACnD,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC,CAAC;IACvE,CAAC;CACD"}
@@ -0,0 +1,49 @@
1
+ import type { IGitRepo } from './git/gitService.js';
2
+ import { ViteProjectRef } from './viteProjectRef.js';
3
+ export type WorktreeInstallConfig = {
4
+ readonly kind: 'auto';
5
+ } | {
6
+ readonly kind: 'npm';
7
+ } | {
8
+ readonly kind: 'pnpm';
9
+ } | {
10
+ readonly kind: 'yarn';
11
+ } | {
12
+ readonly kind: 'custom';
13
+ readonly command: string;
14
+ } | {
15
+ readonly kind: 'skip';
16
+ };
17
+ export declare class ResolvedWorktreeConfig {
18
+ readonly ref: string;
19
+ readonly worktreePath: string;
20
+ readonly install: WorktreeInstallConfig;
21
+ constructor(ref: string, worktreePath: string, install: WorktreeInstallConfig);
22
+ }
23
+ export type ResolvedSourceConfig = {
24
+ readonly kind: 'current';
25
+ } | {
26
+ readonly kind: 'worktree';
27
+ readonly worktree: ResolvedWorktreeConfig;
28
+ };
29
+ export declare class ResolvedSessionConfig {
30
+ readonly name: string;
31
+ readonly source: ResolvedSourceConfig;
32
+ readonly viteProject: ViteProjectRef;
33
+ constructor(name: string, source: ResolvedSourceConfig, viteProject: ViteProjectRef);
34
+ }
35
+ export declare class ResolvedCompareConfig {
36
+ readonly baseline: string;
37
+ readonly current: string;
38
+ constructor(baseline: string, current: string);
39
+ }
40
+ export declare class ResolvedWatchConfig {
41
+ readonly screenshotDir: string;
42
+ readonly sessions: readonly ResolvedSessionConfig[];
43
+ readonly compare: ResolvedCompareConfig | undefined;
44
+ readonly repo: IGitRepo;
45
+ private constructor();
46
+ static fromFile(configPath: string): Promise<ResolvedWatchConfig>;
47
+ static fromData(data: unknown, configDir: string, repo: IGitRepo): ResolvedWatchConfig;
48
+ }
49
+ //# sourceMappingURL=watchConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchConfig.d.ts","sourceRoot":"","sources":["../src/watchConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA4CrD,MAAM,MAAM,qBAAqB,GAC9B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7B,qBAAa,sBAAsB;IAEjC,QAAQ,CAAC,GAAG,EAAE,MAAM;IACpB,QAAQ,CAAC,YAAY,EAAE,MAAM;IAC7B,QAAQ,CAAC,OAAO,EAAE,qBAAqB;gBAF9B,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,qBAAqB;CAExC;AAED,MAAM,MAAM,oBAAoB,GAC7B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAA;CAAE,CAAC;AAE5E,qBAAa,qBAAqB;IAEhC,QAAQ,CAAC,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