proto-plugin 0.1.5 → 0.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proto-plugin",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"
@@ -327,15 +327,11 @@ export function CommentCaptureToolbar<TState = unknown>({
327
327
  const openCommentsPanel = useCallback(() => {
328
328
  if (integratedReview) {
329
329
  review.setCaptureChannel("comment");
330
- }
331
- setActiveRestoreId(null);
332
- setIsGiveAMomentMode(true);
333
- setIsActive(true);
334
- if (integratedReview) {
335
330
  review.openSidebar("comments");
336
- } else {
337
- setShowCommentsSidebar(true);
331
+ return;
338
332
  }
333
+ setIsActive(true);
334
+ setShowCommentsSidebar(true);
339
335
  }, [integratedReview, review]);
340
336
 
341
337
  const enterChangelogMode = useCallback(() => {
@@ -1,4 +1,4 @@
1
- import { readFileSync, lstatSync } from "fs";
1
+ import { readFileSync } from "fs";
2
2
  import { join } from "path";
3
3
 
4
4
  import { NextResponse } from "next/server";
@@ -42,33 +42,27 @@ export function isNewerVersion(latest: string, installed: string): boolean {
42
42
  return false;
43
43
  }
44
44
 
45
+ function readIsWorkspaceDependency(cwd: string): boolean {
46
+ try {
47
+ const hostPkg = JSON.parse(readFileSync(join(cwd, "package.json"), "utf8")) as {
48
+ dependencies?: Record<string, string>;
49
+ devDependencies?: Record<string, string>;
50
+ };
51
+ const depSpec =
52
+ hostPkg.dependencies?.[PACKAGE_NAME] ??
53
+ hostPkg.devDependencies?.[PACKAGE_NAME];
54
+ return depSpec?.startsWith("workspace:") ?? false;
55
+ } catch {
56
+ return false;
57
+ }
58
+ }
59
+
45
60
  function readInstalledVersion(cwd: string): {
46
61
  installed: string | null;
47
62
  isWorkspaceLink: boolean;
48
63
  } {
49
64
  const packagePath = join(cwd, "node_modules", PACKAGE_NAME, "package.json");
50
- const linkPath = join(cwd, "node_modules", PACKAGE_NAME);
51
-
52
- let isWorkspaceLink = false;
53
-
54
- try {
55
- isWorkspaceLink = lstatSync(linkPath).isSymbolicLink();
56
- } catch {
57
- try {
58
- const hostPkg = JSON.parse(
59
- readFileSync(join(cwd, "package.json"), "utf8"),
60
- ) as {
61
- dependencies?: Record<string, string>;
62
- devDependencies?: Record<string, string>;
63
- };
64
- const depSpec =
65
- hostPkg.dependencies?.[PACKAGE_NAME] ??
66
- hostPkg.devDependencies?.[PACKAGE_NAME];
67
- isWorkspaceLink = depSpec?.startsWith("workspace:") ?? false;
68
- } catch {
69
- // Ignore — treat as non-workspace.
70
- }
71
- }
65
+ const isWorkspaceLink = readIsWorkspaceDependency(cwd);
72
66
 
73
67
  try {
74
68
  const pkg = JSON.parse(readFileSync(packagePath, "utf8")) as { version?: string };