@self-review/serve 1.45.0 → 2.0.2
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/README.md +84 -17
- package/dist/cli.js +209 -196
- package/dist/cli.js.map +1 -1
- package/dist/client/assets/abnfDiagram-VCTEODGH-B0WsyrgV.js +1 -0
- package/dist/client/assets/{arc-LxCcHggQ.js → arc-BW5Ja9jH.js} +1 -1
- package/dist/client/assets/architectureDiagram-5GKGNRK7-D8Te8oTO.js +36 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-De6yO0Pc.js +129 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-CN_ImVJ2.js +38 -0
- package/dist/client/assets/channel-lQ0RbG4S.js +1 -0
- package/dist/client/assets/{chunk-QZHKN3VN-GT04-vw7.js → chunk-2Q5K7J3B-leQuY_zv.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-tB9OepVI.js → chunk-5VM5RSS4-B9t_sDHT.js} +1 -1
- package/dist/client/assets/chunk-F27PBJKO-DV4cClcN.js +1 -0
- package/dist/client/assets/chunk-IMKFNOWR-zzuAbkqC.js +231 -0
- package/dist/client/assets/{chunk-4BX2VUAB-D2GfUqwd.js → chunk-JWPE2WC7-CJ5gXLhr.js} +1 -1
- package/dist/client/assets/chunk-POPQ4Y6H-CpZuZvZt.js +1 -0
- package/dist/client/assets/chunk-SVP7TREG-yy8jj-hm.js +88 -0
- package/dist/client/assets/chunk-TICWLB2K-DFcVVynq.js +206 -0
- package/dist/client/assets/{chunk-55IACEB6-C68L7s0h.js → chunk-XXDRQBXY-9E3zT1py.js} +1 -1
- package/dist/client/assets/classDiagram-ZZMXUADV-Bl7tX_us.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-Bl7tX_us.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-Ds41oEbD.js → cose-bilkent-JH36ORCC-Dx6n-StY.js} +1 -1
- package/dist/client/assets/cynefin-OW5HDTMX-C5wFojW5.js +166 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CouYuJFy.js +62 -0
- package/dist/client/assets/cytoscape.esm-BB4DxJjf.js +321 -0
- package/dist/client/assets/dagre-GXQ25YYZ-Da5snFZc.js +4 -0
- package/dist/client/assets/diagram-S7CK7UJ4-CHq16bzb.js +30 -0
- package/dist/client/assets/diagram-UQ7AKVKN-DI60gvwN.js +41 -0
- package/dist/client/assets/diagram-VSXAHHWV-DWcmMhBw.js +3 -0
- package/dist/client/assets/diagram-VX7I27RA-B-z3M9_Y.js +24 -0
- package/dist/client/assets/diagram-Z3DM3KII-DULe9khv.js +24 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-BhnouaZ_.js +1 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-jMdika44.js +99 -0
- package/dist/client/assets/flowDiagram-HODETNUW-BjUJ5OKO.js +168 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BpCysN0h.js +292 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-1tbmipId.js +106 -0
- package/dist/client/assets/index-BI5y52AH.js +285 -0
- package/dist/client/assets/index-Db3Y_mSS.css +1 -0
- package/dist/client/assets/infoDiagram-27XIBGKW-CXWTgvpl.js +2 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-klNLrST8.js +70 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-Ct-7Pd-a.js +139 -0
- package/dist/client/assets/{kanban-definition-3W4ZIXB7-D-BINTOt.js → kanban-definition-UXKFOSKX-DD_FYr4i.js} +8 -8
- package/dist/client/assets/katex-HP8lGamR.js +257 -0
- package/dist/client/assets/layout-qu6Jh2NL.js +1 -0
- package/dist/client/assets/{linear-CNmY37sq.js → linear-CyXCKwF4.js} +1 -1
- package/dist/client/assets/mermaid.core-DM0zHMWR.js +310 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-BeNZFBr2.js +96 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-CQgppbBS.js +1 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-Cr1fqCQ4.js +39 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-C1yirqY6.js +7 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-Bn7HvN1-.js +1 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-6M9DIU2L.js +84 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-Cg1rbstF.js +40 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-C32VYEXY.js +162 -0
- package/dist/client/assets/sizeCapture-INFHLROL-Bq4mPWkN.js +1 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-DBefg7Dg.js +1 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-uLo2S7SG.js +1 -0
- package/dist/client/assets/swimlanes-42K2YHIH-MwMY5Aq0.js +1 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-CkHQpJxS.js +8 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-BTMotlMQ.js +120 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-BZnnvwyI.js +34 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-qD1yMGp2.js +78 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-D83H8ISo.js +7 -0
- package/dist/client/index.html +2 -2
- package/package.json +3 -3
- package/dist/client/assets/_basePickBy-DzL66huQ.js +0 -1
- package/dist/client/assets/_baseUniq-D_kA9hnK.js +0 -1
- package/dist/client/assets/architectureDiagram-VXUJARFQ-BmSW2FCh.js +0 -36
- package/dist/client/assets/blockDiagram-VD42YOAC-Duz6oS5b.js +0 -122
- package/dist/client/assets/c4Diagram-YG6GDRKO-Bv4P72yB.js +0 -10
- package/dist/client/assets/channel-ydExFSqY.js +0 -1
- package/dist/client/assets/chunk-B4BG7PRW-BtVwfswM.js +0 -165
- package/dist/client/assets/chunk-DI55MBZ5-BDdO91wt.js +0 -220
- package/dist/client/assets/chunk-QN33PNHL-HjKgp1PB.js +0 -1
- package/dist/client/assets/chunk-TZMSLE5B-DpxXSXMp.js +0 -1
- package/dist/client/assets/classDiagram-2ON5EDUG-Dg8dmmRD.js +0 -1
- package/dist/client/assets/classDiagram-v2-WZHVMYZB-Dg8dmmRD.js +0 -1
- package/dist/client/assets/clone-Bq6xpRgi.js +0 -1
- package/dist/client/assets/cytoscape.esm-5J0xJHOV.js +0 -321
- package/dist/client/assets/dagre-6UL2VRFP-DZiEousR.js +0 -4
- package/dist/client/assets/diagram-PSM6KHXK-0_alnUMs.js +0 -24
- package/dist/client/assets/diagram-QEK2KX5R-KFaKVdU8.js +0 -43
- package/dist/client/assets/diagram-S2PKOQOG-C2Dy10VG.js +0 -24
- package/dist/client/assets/erDiagram-Q2GNP2WA-_P7rrcgu.js +0 -60
- package/dist/client/assets/flowDiagram-NV44I4VS-BvC6gSn5.js +0 -162
- package/dist/client/assets/ganttDiagram-JELNMOA3-DjzuVPeB.js +0 -267
- package/dist/client/assets/gitGraphDiagram-V2S2FVAM-B9fPDqqA.js +0 -65
- package/dist/client/assets/graph-BqLQdgDA.js +0 -1
- package/dist/client/assets/index-CAXQd1OO.js +0 -286
- package/dist/client/assets/index-CmSvc3Wo.css +0 -1
- package/dist/client/assets/infoDiagram-HS3SLOUP-DiMCwlkY.js +0 -2
- package/dist/client/assets/journeyDiagram-XKPGCS4Q-Dn5WdzPP.js +0 -139
- package/dist/client/assets/katex-DhXJpUyf.js +0 -261
- package/dist/client/assets/layout-Bo5pDIcD.js +0 -1
- package/dist/client/assets/mermaid.core-DfADLZQ1.js +0 -250
- package/dist/client/assets/mindmap-definition-VGOIOE7T-H5HwEwuX.js +0 -68
- package/dist/client/assets/pieDiagram-ADFJNKIX-RiZa5XQN.js +0 -30
- package/dist/client/assets/quadrantDiagram-AYHSOK5B-CFFX55h2.js +0 -7
- package/dist/client/assets/requirementDiagram-UZGBJVZJ-B6JBcV1I.js +0 -64
- package/dist/client/assets/sankeyDiagram-TZEHDZUN-GZT80dnc.js +0 -10
- package/dist/client/assets/sequenceDiagram-WL72ISMW-CbUqoUma.js +0 -145
- package/dist/client/assets/stateDiagram-FKZM4ZOC-LEb-ZQVV.js +0 -1
- package/dist/client/assets/stateDiagram-v2-4FDKWEC3-BYGHA8iw.js +0 -1
- package/dist/client/assets/timeline-definition-IT6M3QCI-Cm1Kd50N.js +0 -61
- package/dist/client/assets/treemap-GDKQZRPO-CWXk-dEb.js +0 -160
- package/dist/client/assets/xychartDiagram-PRI3JC2R-BUllxp6G.js +0 -7
- package/dist/core/src/apply-suggestion.d.ts +0 -76
- package/dist/core/src/apply-suggestion.d.ts.map +0 -1
- package/dist/core/src/apply-suggestion.js +0 -109
- package/dist/core/src/apply-suggestion.js.map +0 -1
- package/dist/core/src/config.d.ts +0 -3
- package/dist/core/src/config.d.ts.map +0 -1
- package/dist/core/src/config.js +0 -196
- package/dist/core/src/config.js.map +0 -1
- package/dist/core/src/diff-parser.d.ts +0 -3
- package/dist/core/src/diff-parser.d.ts.map +0 -1
- package/dist/core/src/diff-parser.js +0 -236
- package/dist/core/src/diff-parser.js.map +0 -1
- package/dist/core/src/directory-scanner.d.ts +0 -18
- package/dist/core/src/directory-scanner.d.ts.map +0 -1
- package/dist/core/src/directory-scanner.js +0 -99
- package/dist/core/src/directory-scanner.js.map +0 -1
- package/dist/core/src/fetch-comments.d.ts +0 -69
- package/dist/core/src/fetch-comments.d.ts.map +0 -1
- package/dist/core/src/fetch-comments.js +0 -180
- package/dist/core/src/fetch-comments.js.map +0 -1
- package/dist/core/src/file-type-utils.d.ts +0 -16
- package/dist/core/src/file-type-utils.d.ts.map +0 -1
- package/dist/core/src/file-type-utils.js +0 -106
- package/dist/core/src/file-type-utils.js.map +0 -1
- package/dist/core/src/forge-provider.d.ts +0 -123
- package/dist/core/src/forge-provider.d.ts.map +0 -1
- package/dist/core/src/forge-provider.js +0 -68
- package/dist/core/src/forge-provider.js.map +0 -1
- package/dist/core/src/fs-utils.d.ts +0 -7
- package/dist/core/src/fs-utils.d.ts.map +0 -1
- package/dist/core/src/fs-utils.js +0 -20
- package/dist/core/src/fs-utils.js.map +0 -1
- package/dist/core/src/git-diff-args.d.ts +0 -38
- package/dist/core/src/git-diff-args.d.ts.map +0 -1
- package/dist/core/src/git-diff-args.js +0 -170
- package/dist/core/src/git-diff-args.js.map +0 -1
- package/dist/core/src/git-diff-loader.d.ts +0 -14
- package/dist/core/src/git-diff-loader.d.ts.map +0 -1
- package/dist/core/src/git-diff-loader.js +0 -30
- package/dist/core/src/git-diff-loader.js.map +0 -1
- package/dist/core/src/git.d.ts +0 -52
- package/dist/core/src/git.d.ts.map +0 -1
- package/dist/core/src/git.js +0 -191
- package/dist/core/src/git.js.map +0 -1
- package/dist/core/src/github-provider.d.ts +0 -7
- package/dist/core/src/github-provider.d.ts.map +0 -1
- package/dist/core/src/github-provider.js +0 -151
- package/dist/core/src/github-provider.js.map +0 -1
- package/dist/core/src/gitlab-provider.d.ts +0 -10
- package/dist/core/src/gitlab-provider.d.ts.map +0 -1
- package/dist/core/src/gitlab-provider.js +0 -207
- package/dist/core/src/gitlab-provider.js.map +0 -1
- package/dist/core/src/guide-loader.d.ts +0 -23
- package/dist/core/src/guide-loader.d.ts.map +0 -1
- package/dist/core/src/guide-loader.js +0 -95
- package/dist/core/src/guide-loader.js.map +0 -1
- package/dist/core/src/guide-parser.d.ts +0 -34
- package/dist/core/src/guide-parser.d.ts.map +0 -1
- package/dist/core/src/guide-parser.js +0 -136
- package/dist/core/src/guide-parser.js.map +0 -1
- package/dist/core/src/guide-schema.d.ts +0 -2
- package/dist/core/src/guide-schema.d.ts.map +0 -1
- package/dist/core/src/guide-schema.js +0 -202
- package/dist/core/src/guide-schema.js.map +0 -1
- package/dist/core/src/ignore-filter.d.ts +0 -8
- package/dist/core/src/ignore-filter.d.ts.map +0 -1
- package/dist/core/src/ignore-filter.js +0 -16
- package/dist/core/src/ignore-filter.js.map +0 -1
- package/dist/core/src/index.d.ts +0 -38
- package/dist/core/src/index.d.ts.map +0 -1
- package/dist/core/src/index.js +0 -54
- package/dist/core/src/index.js.map +0 -1
- package/dist/core/src/materializer.d.ts +0 -60
- package/dist/core/src/materializer.d.ts.map +0 -1
- package/dist/core/src/materializer.js +0 -255
- package/dist/core/src/materializer.js.map +0 -1
- package/dist/core/src/payload-sizing.d.ts +0 -20
- package/dist/core/src/payload-sizing.d.ts.map +0 -1
- package/dist/core/src/payload-sizing.js +0 -74
- package/dist/core/src/payload-sizing.js.map +0 -1
- package/dist/core/src/remote-mode.d.ts +0 -89
- package/dist/core/src/remote-mode.d.ts.map +0 -1
- package/dist/core/src/remote-mode.js +0 -193
- package/dist/core/src/remote-mode.js.map +0 -1
- package/dist/core/src/review-handlers.d.ts +0 -160
- package/dist/core/src/review-handlers.d.ts.map +0 -1
- package/dist/core/src/review-handlers.js +0 -463
- package/dist/core/src/review-handlers.js.map +0 -1
- package/dist/core/src/staged-untracked.d.ts +0 -12
- package/dist/core/src/staged-untracked.d.ts.map +0 -1
- package/dist/core/src/staged-untracked.js +0 -21
- package/dist/core/src/staged-untracked.js.map +0 -1
- package/dist/core/src/startup-mode.d.ts +0 -6
- package/dist/core/src/startup-mode.d.ts.map +0 -1
- package/dist/core/src/startup-mode.js +0 -73
- package/dist/core/src/startup-mode.js.map +0 -1
- package/dist/core/src/synthetic-diff.d.ts +0 -21
- package/dist/core/src/synthetic-diff.d.ts.map +0 -1
- package/dist/core/src/synthetic-diff.js +0 -104
- package/dist/core/src/synthetic-diff.js.map +0 -1
- package/dist/core/src/thread-mapper.d.ts +0 -39
- package/dist/core/src/thread-mapper.d.ts.map +0 -1
- package/dist/core/src/thread-mapper.js +0 -217
- package/dist/core/src/thread-mapper.js.map +0 -1
- package/dist/core/src/types.d.ts +0 -2
- package/dist/core/src/types.d.ts.map +0 -1
- package/dist/core/src/types.js +0 -2
- package/dist/core/src/types.js.map +0 -1
- package/dist/core/src/xml-parser.d.ts +0 -15
- package/dist/core/src/xml-parser.d.ts.map +0 -1
- package/dist/core/src/xml-parser.js +0 -237
- package/dist/core/src/xml-parser.js.map +0 -1
- package/dist/core/src/xml-serializer.d.ts +0 -4
- package/dist/core/src/xml-serializer.d.ts.map +0 -1
- package/dist/core/src/xml-serializer.js +0 -923
- package/dist/core/src/xml-serializer.js.map +0 -1
- package/dist/react/src/ReviewPanel.d.ts +0 -72
- package/dist/react/src/ReviewPanel.d.ts.map +0 -1
- package/dist/react/src/ReviewPanel.js +0 -51
- package/dist/react/src/ReviewPanel.js.map +0 -1
- package/dist/react/src/SingleFileReview.d.ts +0 -49
- package/dist/react/src/SingleFileReview.d.ts.map +0 -1
- package/dist/react/src/SingleFileReview.js +0 -41
- package/dist/react/src/SingleFileReview.js.map +0 -1
- package/dist/react/src/adapter.d.ts +0 -72
- package/dist/react/src/adapter.d.ts.map +0 -1
- package/dist/react/src/adapter.js +0 -2
- package/dist/react/src/adapter.js.map +0 -1
- package/dist/react/src/components/Comments/AttachmentDropZone.d.ts +0 -10
- package/dist/react/src/components/Comments/AttachmentDropZone.d.ts.map +0 -1
- package/dist/react/src/components/Comments/AttachmentDropZone.js +0 -52
- package/dist/react/src/components/Comments/AttachmentDropZone.js.map +0 -1
- package/dist/react/src/components/Comments/AttachmentImage.d.ts +0 -6
- package/dist/react/src/components/Comments/AttachmentImage.d.ts.map +0 -1
- package/dist/react/src/components/Comments/AttachmentImage.js +0 -50
- package/dist/react/src/components/Comments/AttachmentImage.js.map +0 -1
- package/dist/react/src/components/Comments/AttachmentThumbnail.d.ts +0 -6
- package/dist/react/src/components/Comments/AttachmentThumbnail.d.ts.map +0 -1
- package/dist/react/src/components/Comments/AttachmentThumbnail.js +0 -16
- package/dist/react/src/components/Comments/AttachmentThumbnail.js.map +0 -1
- package/dist/react/src/components/Comments/CategorySelector.d.ts +0 -6
- package/dist/react/src/components/Comments/CategorySelector.d.ts.map +0 -1
- package/dist/react/src/components/Comments/CategorySelector.js +0 -27
- package/dist/react/src/components/Comments/CategorySelector.js.map +0 -1
- package/dist/react/src/components/Comments/CommentDisplay.d.ts +0 -7
- package/dist/react/src/components/Comments/CommentDisplay.d.ts.map +0 -1
- package/dist/react/src/components/Comments/CommentDisplay.js +0 -103
- package/dist/react/src/components/Comments/CommentDisplay.js.map +0 -1
- package/dist/react/src/components/Comments/CommentInput.d.ts +0 -11
- package/dist/react/src/components/Comments/CommentInput.d.ts.map +0 -1
- package/dist/react/src/components/Comments/CommentInput.js +0 -81
- package/dist/react/src/components/Comments/CommentInput.js.map +0 -1
- package/dist/react/src/components/Comments/ComposerCore.d.ts +0 -49
- package/dist/react/src/components/Comments/ComposerCore.d.ts.map +0 -1
- package/dist/react/src/components/Comments/ComposerCore.js +0 -91
- package/dist/react/src/components/Comments/ComposerCore.js.map +0 -1
- package/dist/react/src/components/Comments/EmojiAutocomplete.d.ts +0 -14
- package/dist/react/src/components/Comments/EmojiAutocomplete.d.ts.map +0 -1
- package/dist/react/src/components/Comments/EmojiAutocomplete.js +0 -19
- package/dist/react/src/components/Comments/EmojiAutocomplete.js.map +0 -1
- package/dist/react/src/components/Comments/ReplyDisplay.d.ts +0 -22
- package/dist/react/src/components/Comments/ReplyDisplay.d.ts.map +0 -1
- package/dist/react/src/components/Comments/ReplyDisplay.js +0 -38
- package/dist/react/src/components/Comments/ReplyDisplay.js.map +0 -1
- package/dist/react/src/components/Comments/ReplyInput.d.ts +0 -9
- package/dist/react/src/components/Comments/ReplyInput.d.ts.map +0 -1
- package/dist/react/src/components/Comments/ReplyInput.js +0 -47
- package/dist/react/src/components/Comments/ReplyInput.js.map +0 -1
- package/dist/react/src/components/Comments/SuggestionApplyControl.d.ts +0 -27
- package/dist/react/src/components/Comments/SuggestionApplyControl.d.ts.map +0 -1
- package/dist/react/src/components/Comments/SuggestionApplyControl.js +0 -103
- package/dist/react/src/components/Comments/SuggestionApplyControl.js.map +0 -1
- package/dist/react/src/components/Comments/SuggestionBlock.d.ts +0 -26
- package/dist/react/src/components/Comments/SuggestionBlock.d.ts.map +0 -1
- package/dist/react/src/components/Comments/SuggestionBlock.js +0 -33
- package/dist/react/src/components/Comments/SuggestionBlock.js.map +0 -1
- package/dist/react/src/components/Comments/SuggestionPanel.d.ts +0 -8
- package/dist/react/src/components/Comments/SuggestionPanel.d.ts.map +0 -1
- package/dist/react/src/components/Comments/SuggestionPanel.js +0 -12
- package/dist/react/src/components/Comments/SuggestionPanel.js.map +0 -1
- package/dist/react/src/components/DiffViewer/DiffContentArea.d.ts +0 -35
- package/dist/react/src/components/DiffViewer/DiffContentArea.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/DiffContentArea.js +0 -40
- package/dist/react/src/components/DiffViewer/DiffContentArea.js.map +0 -1
- package/dist/react/src/components/DiffViewer/DiffViewer.d.ts +0 -4
- package/dist/react/src/components/DiffViewer/DiffViewer.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/DiffViewer.js +0 -110
- package/dist/react/src/components/DiffViewer/DiffViewer.js.map +0 -1
- package/dist/react/src/components/DiffViewer/EmptyDiffMessage.d.ts +0 -6
- package/dist/react/src/components/DiffViewer/EmptyDiffMessage.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/EmptyDiffMessage.js +0 -18
- package/dist/react/src/components/DiffViewer/EmptyDiffMessage.js.map +0 -1
- package/dist/react/src/components/DiffViewer/EmptyLinePane.d.ts +0 -2
- package/dist/react/src/components/DiffViewer/EmptyLinePane.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/EmptyLinePane.js +0 -5
- package/dist/react/src/components/DiffViewer/EmptyLinePane.js.map +0 -1
- package/dist/react/src/components/DiffViewer/ExpandContextBar.d.ts +0 -10
- package/dist/react/src/components/DiffViewer/ExpandContextBar.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/ExpandContextBar.js +0 -16
- package/dist/react/src/components/DiffViewer/ExpandContextBar.js.map +0 -1
- package/dist/react/src/components/DiffViewer/FileSection.d.ts +0 -9
- package/dist/react/src/components/DiffViewer/FileSection.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/FileSection.js +0 -137
- package/dist/react/src/components/DiffViewer/FileSection.js.map +0 -1
- package/dist/react/src/components/DiffViewer/FileSectionBody.d.ts +0 -13
- package/dist/react/src/components/DiffViewer/FileSectionBody.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/FileSectionBody.js +0 -8
- package/dist/react/src/components/DiffViewer/FileSectionBody.js.map +0 -1
- package/dist/react/src/components/DiffViewer/FileSectionHeader.d.ts +0 -16
- package/dist/react/src/components/DiffViewer/FileSectionHeader.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/FileSectionHeader.js +0 -53
- package/dist/react/src/components/DiffViewer/FileSectionHeader.js.map +0 -1
- package/dist/react/src/components/DiffViewer/FrontMatterTable.d.ts +0 -6
- package/dist/react/src/components/DiffViewer/FrontMatterTable.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/FrontMatterTable.js +0 -30
- package/dist/react/src/components/DiffViewer/FrontMatterTable.js.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideChapterDivider.d.ts +0 -20
- package/dist/react/src/components/DiffViewer/GuideChapterDivider.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideChapterDivider.js +0 -27
- package/dist/react/src/components/DiffViewer/GuideChapterDivider.js.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideOverviewContent.d.ts +0 -16
- package/dist/react/src/components/DiffViewer/GuideOverviewContent.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideOverviewContent.js +0 -56
- package/dist/react/src/components/DiffViewer/GuideOverviewContent.js.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideOverviewDialog.d.ts +0 -12
- package/dist/react/src/components/DiffViewer/GuideOverviewDialog.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideOverviewDialog.js +0 -13
- package/dist/react/src/components/DiffViewer/GuideOverviewDialog.js.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideOverviewPanel.d.ts +0 -8
- package/dist/react/src/components/DiffViewer/GuideOverviewPanel.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/GuideOverviewPanel.js +0 -16
- package/dist/react/src/components/DiffViewer/GuideOverviewPanel.js.map +0 -1
- package/dist/react/src/components/DiffViewer/HunkHeader.d.ts +0 -5
- package/dist/react/src/components/DiffViewer/HunkHeader.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/HunkHeader.js +0 -5
- package/dist/react/src/components/DiffViewer/HunkHeader.js.map +0 -1
- package/dist/react/src/components/DiffViewer/InlineCommentSlot.d.ts +0 -18
- package/dist/react/src/components/DiffViewer/InlineCommentSlot.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/InlineCommentSlot.js +0 -13
- package/dist/react/src/components/DiffViewer/InlineCommentSlot.js.map +0 -1
- package/dist/react/src/components/DiffViewer/MarkdownCode.d.ts +0 -9
- package/dist/react/src/components/DiffViewer/MarkdownCode.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/MarkdownCode.js +0 -24
- package/dist/react/src/components/DiffViewer/MarkdownCode.js.map +0 -1
- package/dist/react/src/components/DiffViewer/MermaidBlock.d.ts +0 -4
- package/dist/react/src/components/DiffViewer/MermaidBlock.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/MermaidBlock.js +0 -51
- package/dist/react/src/components/DiffViewer/MermaidBlock.js.map +0 -1
- package/dist/react/src/components/DiffViewer/RenderedImageView.d.ts +0 -8
- package/dist/react/src/components/DiffViewer/RenderedImageView.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/RenderedImageView.js +0 -46
- package/dist/react/src/components/DiffViewer/RenderedImageView.js.map +0 -1
- package/dist/react/src/components/DiffViewer/RenderedMarkdownView.d.ts +0 -16
- package/dist/react/src/components/DiffViewer/RenderedMarkdownView.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/RenderedMarkdownView.js +0 -324
- package/dist/react/src/components/DiffViewer/RenderedMarkdownView.js.map +0 -1
- package/dist/react/src/components/DiffViewer/RenderedSvgView.d.ts +0 -7
- package/dist/react/src/components/DiffViewer/RenderedSvgView.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/RenderedSvgView.js +0 -21
- package/dist/react/src/components/DiffViewer/RenderedSvgView.js.map +0 -1
- package/dist/react/src/components/DiffViewer/SplitView.d.ts +0 -23
- package/dist/react/src/components/DiffViewer/SplitView.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/SplitView.js +0 -137
- package/dist/react/src/components/DiffViewer/SplitView.js.map +0 -1
- package/dist/react/src/components/DiffViewer/SyntaxLine.d.ts +0 -49
- package/dist/react/src/components/DiffViewer/SyntaxLine.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/SyntaxLine.js +0 -73
- package/dist/react/src/components/DiffViewer/SyntaxLine.js.map +0 -1
- package/dist/react/src/components/DiffViewer/UnifiedView.d.ts +0 -23
- package/dist/react/src/components/DiffViewer/UnifiedView.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/UnifiedView.js +0 -96
- package/dist/react/src/components/DiffViewer/UnifiedView.js.map +0 -1
- package/dist/react/src/components/DiffViewer/diff-utils.d.ts +0 -31
- package/dist/react/src/components/DiffViewer/diff-utils.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/diff-utils.js +0 -134
- package/dist/react/src/components/DiffViewer/diff-utils.js.map +0 -1
- package/dist/react/src/components/DiffViewer/useDragSelection.d.ts +0 -25
- package/dist/react/src/components/DiffViewer/useDragSelection.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/useDragSelection.js +0 -210
- package/dist/react/src/components/DiffViewer/useDragSelection.js.map +0 -1
- package/dist/react/src/components/DiffViewer/useExpandContext.d.ts +0 -15
- package/dist/react/src/components/DiffViewer/useExpandContext.d.ts.map +0 -1
- package/dist/react/src/components/DiffViewer/useExpandContext.js +0 -209
- package/dist/react/src/components/DiffViewer/useExpandContext.js.map +0 -1
- package/dist/react/src/components/FileTree.d.ts +0 -2
- package/dist/react/src/components/FileTree.d.ts.map +0 -1
- package/dist/react/src/components/FileTree.js +0 -93
- package/dist/react/src/components/FileTree.js.map +0 -1
- package/dist/react/src/components/FileTreeEntry.d.ts +0 -13
- package/dist/react/src/components/FileTreeEntry.d.ts.map +0 -1
- package/dist/react/src/components/FileTreeEntry.js +0 -21
- package/dist/react/src/components/FileTreeEntry.js.map +0 -1
- package/dist/react/src/components/FileTreeToggle.d.ts +0 -15
- package/dist/react/src/components/FileTreeToggle.d.ts.map +0 -1
- package/dist/react/src/components/FileTreeToggle.js +0 -16
- package/dist/react/src/components/FileTreeToggle.js.map +0 -1
- package/dist/react/src/components/GuideRouteHud.d.ts +0 -10
- package/dist/react/src/components/GuideRouteHud.d.ts.map +0 -1
- package/dist/react/src/components/GuideRouteHud.js +0 -43
- package/dist/react/src/components/GuideRouteHud.js.map +0 -1
- package/dist/react/src/components/GuideRouteMap.d.ts +0 -20
- package/dist/react/src/components/GuideRouteMap.d.ts.map +0 -1
- package/dist/react/src/components/GuideRouteMap.js +0 -58
- package/dist/react/src/components/GuideRouteMap.js.map +0 -1
- package/dist/react/src/components/GuideStation.d.ts +0 -28
- package/dist/react/src/components/GuideStation.d.ts.map +0 -1
- package/dist/react/src/components/GuideStation.js +0 -24
- package/dist/react/src/components/GuideStation.js.map +0 -1
- package/dist/react/src/components/HintOverlay.d.ts +0 -13
- package/dist/react/src/components/HintOverlay.d.ts.map +0 -1
- package/dist/react/src/components/HintOverlay.js +0 -27
- package/dist/react/src/components/HintOverlay.js.map +0 -1
- package/dist/react/src/components/KeyboardNavigationManager.d.ts +0 -2
- package/dist/react/src/components/KeyboardNavigationManager.d.ts.map +0 -1
- package/dist/react/src/components/KeyboardNavigationManager.js +0 -8
- package/dist/react/src/components/KeyboardNavigationManager.js.map +0 -1
- package/dist/react/src/components/Layout.d.ts +0 -2
- package/dist/react/src/components/Layout.d.ts.map +0 -1
- package/dist/react/src/components/Layout.js +0 -63
- package/dist/react/src/components/Layout.js.map +0 -1
- package/dist/react/src/components/ReviewProgress.d.ts +0 -2
- package/dist/react/src/components/ReviewProgress.d.ts.map +0 -1
- package/dist/react/src/components/ReviewProgress.js +0 -25
- package/dist/react/src/components/ReviewProgress.js.map +0 -1
- package/dist/react/src/components/Toolbar.d.ts +0 -6
- package/dist/react/src/components/Toolbar.d.ts.map +0 -1
- package/dist/react/src/components/Toolbar.js +0 -61
- package/dist/react/src/components/Toolbar.js.map +0 -1
- package/dist/react/src/components/TruncatedPath.d.ts +0 -7
- package/dist/react/src/components/TruncatedPath.d.ts.map +0 -1
- package/dist/react/src/components/TruncatedPath.js +0 -15
- package/dist/react/src/components/TruncatedPath.js.map +0 -1
- package/dist/react/src/components/ui/badge.d.ts +0 -10
- package/dist/react/src/components/ui/badge.d.ts.map +0 -1
- package/dist/react/src/components/ui/badge.js +0 -21
- package/dist/react/src/components/ui/badge.js.map +0 -1
- package/dist/react/src/components/ui/button.d.ts +0 -11
- package/dist/react/src/components/ui/button.d.ts.map +0 -1
- package/dist/react/src/components/ui/button.js +0 -32
- package/dist/react/src/components/ui/button.js.map +0 -1
- package/dist/react/src/components/ui/dialog.d.ts +0 -12
- package/dist/react/src/components/ui/dialog.d.ts.map +0 -1
- package/dist/react/src/components/ui/dialog.js +0 -23
- package/dist/react/src/components/ui/dialog.js.map +0 -1
- package/dist/react/src/components/ui/input.d.ts +0 -4
- package/dist/react/src/components/ui/input.d.ts.map +0 -1
- package/dist/react/src/components/ui/input.js +0 -9
- package/dist/react/src/components/ui/input.js.map +0 -1
- package/dist/react/src/components/ui/separator.d.ts +0 -6
- package/dist/react/src/components/ui/separator.d.ts.map +0 -1
- package/dist/react/src/components/ui/separator.js +0 -8
- package/dist/react/src/components/ui/separator.js.map +0 -1
- package/dist/react/src/components/ui/table.d.ts +0 -11
- package/dist/react/src/components/ui/table.d.ts.map +0 -1
- package/dist/react/src/components/ui/table.js +0 -21
- package/dist/react/src/components/ui/table.js.map +0 -1
- package/dist/react/src/components/ui/textarea.d.ts +0 -4
- package/dist/react/src/components/ui/textarea.d.ts.map +0 -1
- package/dist/react/src/components/ui/textarea.js +0 -9
- package/dist/react/src/components/ui/textarea.js.map +0 -1
- package/dist/react/src/components/ui/toggle-group.d.ts +0 -22
- package/dist/react/src/components/ui/toggle-group.d.ts.map +0 -1
- package/dist/react/src/components/ui/toggle-group.js +0 -48
- package/dist/react/src/components/ui/toggle-group.js.map +0 -1
- package/dist/react/src/components/ui/tooltip.d.ts +0 -16
- package/dist/react/src/components/ui/tooltip.d.ts.map +0 -1
- package/dist/react/src/components/ui/tooltip.js +0 -21
- package/dist/react/src/components/ui/tooltip.js.map +0 -1
- package/dist/react/src/context/ConfigContext.d.ts +0 -26
- package/dist/react/src/context/ConfigContext.d.ts.map +0 -1
- package/dist/react/src/context/ConfigContext.js +0 -150
- package/dist/react/src/context/ConfigContext.js.map +0 -1
- package/dist/react/src/context/DiffNavigationContext.d.ts +0 -16
- package/dist/react/src/context/DiffNavigationContext.d.ts.map +0 -1
- package/dist/react/src/context/DiffNavigationContext.js +0 -79
- package/dist/react/src/context/DiffNavigationContext.js.map +0 -1
- package/dist/react/src/context/GuideContext.d.ts +0 -28
- package/dist/react/src/context/GuideContext.d.ts.map +0 -1
- package/dist/react/src/context/GuideContext.js +0 -64
- package/dist/react/src/context/GuideContext.js.map +0 -1
- package/dist/react/src/context/ReviewAdapterContext.d.ts +0 -9
- package/dist/react/src/context/ReviewAdapterContext.d.ts.map +0 -1
- package/dist/react/src/context/ReviewAdapterContext.js +0 -10
- package/dist/react/src/context/ReviewAdapterContext.js.map +0 -1
- package/dist/react/src/context/ReviewContext.d.ts +0 -60
- package/dist/react/src/context/ReviewContext.d.ts.map +0 -1
- package/dist/react/src/context/ReviewContext.js +0 -233
- package/dist/react/src/context/ReviewContext.js.map +0 -1
- package/dist/react/src/hooks/useDiffNavigation.d.ts +0 -4
- package/dist/react/src/hooks/useDiffNavigation.d.ts.map +0 -1
- package/dist/react/src/hooks/useDiffNavigation.js +0 -5
- package/dist/react/src/hooks/useDiffNavigation.js.map +0 -1
- package/dist/react/src/hooks/useEmojiAutocomplete.d.ts +0 -24
- package/dist/react/src/hooks/useEmojiAutocomplete.d.ts.map +0 -1
- package/dist/react/src/hooks/useEmojiAutocomplete.js +0 -175
- package/dist/react/src/hooks/useEmojiAutocomplete.js.map +0 -1
- package/dist/react/src/hooks/useKeyboardNavigation.d.ts +0 -15
- package/dist/react/src/hooks/useKeyboardNavigation.d.ts.map +0 -1
- package/dist/react/src/hooks/useKeyboardNavigation.js +0 -227
- package/dist/react/src/hooks/useKeyboardNavigation.js.map +0 -1
- package/dist/react/src/hooks/useReviewBridge.d.ts +0 -15
- package/dist/react/src/hooks/useReviewBridge.d.ts.map +0 -1
- package/dist/react/src/hooks/useReviewBridge.js +0 -43
- package/dist/react/src/hooks/useReviewBridge.js.map +0 -1
- package/dist/react/src/hooks/useReviewState.d.ts +0 -16
- package/dist/react/src/hooks/useReviewState.d.ts.map +0 -1
- package/dist/react/src/hooks/useReviewState.js +0 -101
- package/dist/react/src/hooks/useReviewState.js.map +0 -1
- package/dist/react/src/index.d.ts +0 -25
- package/dist/react/src/index.d.ts.map +0 -1
- package/dist/react/src/index.js +0 -22
- package/dist/react/src/index.js.map +0 -1
- package/dist/react/src/lib/utils.d.ts +0 -3
- package/dist/react/src/lib/utils.d.ts.map +0 -1
- package/dist/react/src/lib/utils.js +0 -6
- package/dist/react/src/lib/utils.js.map +0 -1
- package/dist/react/src/utils/category-utils.d.ts +0 -17
- package/dist/react/src/utils/category-utils.d.ts.map +0 -1
- package/dist/react/src/utils/category-utils.js +0 -23
- package/dist/react/src/utils/category-utils.js.map +0 -1
- package/dist/react/src/utils/comment-anchors.d.ts +0 -4
- package/dist/react/src/utils/comment-anchors.d.ts.map +0 -1
- package/dist/react/src/utils/comment-anchors.js +0 -17
- package/dist/react/src/utils/comment-anchors.js.map +0 -1
- package/dist/react/src/utils/diff-styles.d.ts +0 -12
- package/dist/react/src/utils/diff-styles.d.ts.map +0 -1
- package/dist/react/src/utils/diff-styles.js +0 -46
- package/dist/react/src/utils/diff-styles.js.map +0 -1
- package/dist/react/src/utils/emoji-data.d.ts +0 -8
- package/dist/react/src/utils/emoji-data.d.ts.map +0 -1
- package/dist/react/src/utils/emoji-data.js +0 -43
- package/dist/react/src/utils/emoji-data.js.map +0 -1
- package/dist/react/src/utils/file-type-utils.d.ts +0 -20
- package/dist/react/src/utils/file-type-utils.d.ts.map +0 -1
- package/dist/react/src/utils/file-type-utils.js +0 -110
- package/dist/react/src/utils/file-type-utils.js.map +0 -1
- package/dist/react/src/utils/front-matter.d.ts +0 -14
- package/dist/react/src/utils/front-matter.d.ts.map +0 -1
- package/dist/react/src/utils/front-matter.js +0 -40
- package/dist/react/src/utils/front-matter.js.map +0 -1
- package/dist/react/src/utils/guide-accents.d.ts +0 -46
- package/dist/react/src/utils/guide-accents.d.ts.map +0 -1
- package/dist/react/src/utils/guide-accents.js +0 -100
- package/dist/react/src/utils/guide-accents.js.map +0 -1
- package/dist/react/src/utils/guide-display.d.ts +0 -48
- package/dist/react/src/utils/guide-display.d.ts.map +0 -1
- package/dist/react/src/utils/guide-display.js +0 -75
- package/dist/react/src/utils/guide-display.js.map +0 -1
- package/dist/react/src/utils/image-utils.d.ts +0 -3
- package/dist/react/src/utils/image-utils.d.ts.map +0 -1
- package/dist/react/src/utils/image-utils.js +0 -33
- package/dist/react/src/utils/image-utils.js.map +0 -1
- package/dist/react/src/utils/passive-content.d.ts +0 -9
- package/dist/react/src/utils/passive-content.d.ts.map +0 -1
- package/dist/react/src/utils/passive-content.js +0 -135
- package/dist/react/src/utils/passive-content.js.map +0 -1
- package/dist/react/src/utils/remark-emoji.d.ts +0 -3
- package/dist/react/src/utils/remark-emoji.d.ts.map +0 -1
- package/dist/react/src/utils/remark-emoji.js +0 -38
- package/dist/react/src/utils/remark-emoji.js.map +0 -1
- package/dist/serve/src/args.d.ts +0 -15
- package/dist/serve/src/args.d.ts.map +0 -1
- package/dist/serve/src/args.js +0 -65
- package/dist/serve/src/args.js.map +0 -1
- package/dist/serve/src/cli.d.ts +0 -3
- package/dist/serve/src/cli.d.ts.map +0 -1
- package/dist/serve/src/cli.js +0 -81
- package/dist/serve/src/cli.js.map +0 -1
- package/dist/serve/src/client/adapter.d.ts +0 -25
- package/dist/serve/src/client/adapter.d.ts.map +0 -1
- package/dist/serve/src/client/adapter.js +0 -190
- package/dist/serve/src/client/adapter.js.map +0 -1
- package/dist/serve/src/client/index.d.ts +0 -2
- package/dist/serve/src/client/index.d.ts.map +0 -1
- package/dist/serve/src/client/index.js +0 -135
- package/dist/serve/src/client/index.js.map +0 -1
- package/dist/serve/src/lifecycle.d.ts +0 -27
- package/dist/serve/src/lifecycle.d.ts.map +0 -1
- package/dist/serve/src/lifecycle.js +0 -73
- package/dist/serve/src/lifecycle.js.map +0 -1
- package/dist/serve/src/server.d.ts +0 -34
- package/dist/serve/src/server.d.ts.map +0 -1
- package/dist/serve/src/server.js +0 -430
- package/dist/serve/src/server.js.map +0 -1
- package/dist/serve/src/startup.d.ts +0 -19
- package/dist/serve/src/startup.d.ts.map +0 -1
- package/dist/serve/src/startup.js +0 -117
- package/dist/serve/src/startup.js.map +0 -1
- package/dist/serve/src/validate.d.ts +0 -44
- package/dist/serve/src/validate.d.ts.map +0 -1
- package/dist/serve/src/validate.js +0 -295
- package/dist/serve/src/validate.js.map +0 -1
- package/dist/types/src/index.d.ts +0 -417
- package/dist/types/src/index.d.ts.map +0 -1
- package/dist/types/src/index.js +0 -5
- package/dist/types/src/index.js.map +0 -1
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
async function resizeImageIfNeeded(blob, maxDimension = 1920) {
|
|
2
|
-
const bitmap = await createImageBitmap(blob);
|
|
3
|
-
try {
|
|
4
|
-
if (bitmap.width <= maxDimension && bitmap.height <= maxDimension) {
|
|
5
|
-
return blob;
|
|
6
|
-
}
|
|
7
|
-
const scale = Math.min(maxDimension / bitmap.width, maxDimension / bitmap.height);
|
|
8
|
-
const canvas = document.createElement('canvas');
|
|
9
|
-
canvas.width = Math.round(bitmap.width * scale);
|
|
10
|
-
canvas.height = Math.round(bitmap.height * scale);
|
|
11
|
-
const ctx = canvas.getContext('2d');
|
|
12
|
-
ctx.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
|
|
13
|
-
return await new Promise(resolve => {
|
|
14
|
-
canvas.toBlob(resized => resolve(resized || blob), blob.type);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
finally {
|
|
18
|
-
bitmap.close();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export async function processImageFile(file) {
|
|
22
|
-
const resized = await resizeImageIfNeeded(file);
|
|
23
|
-
const arrayBuffer = await resized.arrayBuffer();
|
|
24
|
-
const mediaType = file.type || 'image/png';
|
|
25
|
-
const ext = mediaType.split('/')[1] || 'png';
|
|
26
|
-
return {
|
|
27
|
-
id: crypto.randomUUID(),
|
|
28
|
-
fileName: `image.${ext}`,
|
|
29
|
-
mediaType,
|
|
30
|
-
data: arrayBuffer,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=image-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-utils.js","sourceRoot":"","sources":["../../../../../react/src/utils/image-utils.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,mBAAmB,CAAC,IAAU,EAAE,YAAY,GAAG,IAAI;IAChE,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC7C,IAAI,CAAC;QACH,IAAI,MAAM,CAAC,KAAK,IAAI,YAAY,IAAI,MAAM,CAAC,MAAM,IAAI,YAAY,EAAE,CAAC;YAClE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAClF,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAA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type { Root } from 'hast';
|
|
3
|
-
export declare const PASSIVE_HTML_TAGS: ReadonlySet<string>;
|
|
4
|
-
export declare function isPassiveHtmlAttribute(tag: string, name: string): boolean;
|
|
5
|
-
export declare function rehypePassiveContent(): (tree: Root) => void;
|
|
6
|
-
/** Resource URLs never get the network privileges of ordinary user links. */
|
|
7
|
-
export declare function isLocalImageUrl(url: string): boolean;
|
|
8
|
-
export declare const localContentUrlTransform: UrlTransform;
|
|
9
|
-
//# sourceMappingURL=passive-content.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"passive-content.d.ts","sourceRoot":"","sources":["../../../../../react/src/utils/passive-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAC;AAI1C,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAuEhD,CAAC;AAiBH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzE;AAED,wBAAgB,oBAAoB,KAC1B,MAAM,IAAI,UAmBnB;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAWpD;AAED,eAAO,MAAM,wBAAwB,EAAE,YAItC,CAAC"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { defaultUrlTransform } from 'react-markdown';
|
|
2
|
-
// Reviewed HTML may format text, but cannot create browsing contexts, forms,
|
|
3
|
-
// custom elements, SVG, or other active content. Keep positions for the gutter.
|
|
4
|
-
export const PASSIVE_HTML_TAGS = new Set([
|
|
5
|
-
'a',
|
|
6
|
-
'abbr',
|
|
7
|
-
'address',
|
|
8
|
-
'article',
|
|
9
|
-
'aside',
|
|
10
|
-
'b',
|
|
11
|
-
'bdi',
|
|
12
|
-
'bdo',
|
|
13
|
-
'blockquote',
|
|
14
|
-
'br',
|
|
15
|
-
'caption',
|
|
16
|
-
'cite',
|
|
17
|
-
'code',
|
|
18
|
-
'col',
|
|
19
|
-
'colgroup',
|
|
20
|
-
'dd',
|
|
21
|
-
'del',
|
|
22
|
-
'details',
|
|
23
|
-
'dfn',
|
|
24
|
-
'div',
|
|
25
|
-
'dl',
|
|
26
|
-
'dt',
|
|
27
|
-
'em',
|
|
28
|
-
'figcaption',
|
|
29
|
-
'figure',
|
|
30
|
-
'footer',
|
|
31
|
-
'h1',
|
|
32
|
-
'h2',
|
|
33
|
-
'h3',
|
|
34
|
-
'h4',
|
|
35
|
-
'h5',
|
|
36
|
-
'h6',
|
|
37
|
-
'header',
|
|
38
|
-
'hr',
|
|
39
|
-
'i',
|
|
40
|
-
'img',
|
|
41
|
-
'input',
|
|
42
|
-
'ins',
|
|
43
|
-
'kbd',
|
|
44
|
-
'li',
|
|
45
|
-
'main',
|
|
46
|
-
'mark',
|
|
47
|
-
'nav',
|
|
48
|
-
'ol',
|
|
49
|
-
'p',
|
|
50
|
-
'pre',
|
|
51
|
-
'q',
|
|
52
|
-
'rp',
|
|
53
|
-
'rt',
|
|
54
|
-
'ruby',
|
|
55
|
-
's',
|
|
56
|
-
'samp',
|
|
57
|
-
'section',
|
|
58
|
-
'small',
|
|
59
|
-
'span',
|
|
60
|
-
'strong',
|
|
61
|
-
'sub',
|
|
62
|
-
'summary',
|
|
63
|
-
'sup',
|
|
64
|
-
'table',
|
|
65
|
-
'tbody',
|
|
66
|
-
'td',
|
|
67
|
-
'th',
|
|
68
|
-
'thead',
|
|
69
|
-
'time',
|
|
70
|
-
'tr',
|
|
71
|
-
'u',
|
|
72
|
-
'ul',
|
|
73
|
-
'var',
|
|
74
|
-
'wbr',
|
|
75
|
-
]);
|
|
76
|
-
const GLOBAL_ATTRIBUTES = new Set(['className', 'title', 'lang', 'dir']);
|
|
77
|
-
const TAG_ATTRIBUTES = {
|
|
78
|
-
a: new Set(['href']),
|
|
79
|
-
img: new Set(['src', 'alt', 'width', 'height']),
|
|
80
|
-
input: new Set(['type', 'checked', 'disabled']),
|
|
81
|
-
ol: new Set(['start', 'reversed']),
|
|
82
|
-
li: new Set(['value']),
|
|
83
|
-
td: new Set(['align', 'colSpan', 'rowSpan']),
|
|
84
|
-
th: new Set(['align', 'colSpan', 'rowSpan', 'scope']),
|
|
85
|
-
col: new Set(['span']),
|
|
86
|
-
colgroup: new Set(['span']),
|
|
87
|
-
details: new Set(['open']),
|
|
88
|
-
time: new Set(['dateTime']),
|
|
89
|
-
};
|
|
90
|
-
export function isPassiveHtmlAttribute(tag, name) {
|
|
91
|
-
return GLOBAL_ATTRIBUTES.has(name) || TAG_ATTRIBUTES[tag]?.has(name) === true;
|
|
92
|
-
}
|
|
93
|
-
export function rehypePassiveContent() {
|
|
94
|
-
return (tree) => {
|
|
95
|
-
function clean(parent) {
|
|
96
|
-
parent.children = parent.children.filter(node => {
|
|
97
|
-
if (node.type !== 'element')
|
|
98
|
-
return node.type === 'text';
|
|
99
|
-
if (!PASSIVE_HTML_TAGS.has(node.tagName))
|
|
100
|
-
return false;
|
|
101
|
-
for (const key of Object.keys(node.properties)) {
|
|
102
|
-
if (!isPassiveHtmlAttribute(node.tagName, key))
|
|
103
|
-
delete node.properties[key];
|
|
104
|
-
}
|
|
105
|
-
// GFM task lists stay visible without allowing interactive form controls.
|
|
106
|
-
if (node.tagName === 'input') {
|
|
107
|
-
node.properties.type = 'checkbox';
|
|
108
|
-
node.properties.disabled = true;
|
|
109
|
-
}
|
|
110
|
-
clean(node);
|
|
111
|
-
return true;
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
clean(tree);
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
/** Resource URLs never get the network privileges of ordinary user links. */
|
|
118
|
-
export function isLocalImageUrl(url) {
|
|
119
|
-
const normalized = url.trim().replace(/[\t\r\n]/g, '');
|
|
120
|
-
if (!normalized || normalized.startsWith('//') || normalized.includes('\\'))
|
|
121
|
-
return false;
|
|
122
|
-
if (/^data:image\/(?:png|jpeg|gif|webp|bmp|x-icon|vnd\.microsoft\.icon|svg\+xml)[;,]/i.test(normalized))
|
|
123
|
-
return true;
|
|
124
|
-
if (/^blob:/i.test(normalized))
|
|
125
|
-
return true;
|
|
126
|
-
return !/^[a-z][a-z\d+.-]*:/i.test(normalized);
|
|
127
|
-
}
|
|
128
|
-
export const localContentUrlTransform = (url, key, node) => {
|
|
129
|
-
if (node.tagName === 'a' && key === 'href')
|
|
130
|
-
return defaultUrlTransform(url);
|
|
131
|
-
if (node.tagName === 'img' && key === 'src' && isLocalImageUrl(url))
|
|
132
|
-
return url;
|
|
133
|
-
return undefined;
|
|
134
|
-
};
|
|
135
|
-
//# sourceMappingURL=passive-content.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"passive-content.js","sourceRoot":"","sources":["../../../../../react/src/utils/passive-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAqB,MAAM,gBAAgB,CAAC;AAGxE,6EAA6E;AAC7E,gFAAgF;AAChF,MAAM,CAAC,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC;IAC5D,GAAG;IACH,MAAM;IACN,SAAS;IACT,SAAS;IACT,OAAO;IACP,GAAG;IACH,KAAK;IACL,KAAK;IACL,YAAY;IACZ,IAAI;IACJ,SAAS;IACT,MAAM;IACN,MAAM;IACN,KAAK;IACL,UAAU;IACV,IAAI;IACJ,KAAK;IACL,SAAS;IACT,KAAK;IACL,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,GAAG;IACH,KAAK;IACL,OAAO;IACP,KAAK;IACL,KAAK;IACL,IAAI;IACJ,MAAM;IACN,MAAM;IACN,KAAK;IACL,IAAI;IAC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MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACvD,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1F,IACE,kFAAkF,CAAC,IAAI,CACrF,UAAU,CACX;QAED,OAAO,IAAI,CAAC;IACd,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5C,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IACvE,IAAI,IAAI,CAAC,OAAO,KAAK,GAAG,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAC5E,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,IAAI,GAAG,KAAK,KAAK,IAAI,eAAe,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IAChF,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remark-emoji.d.ts","sourceRoot":"","sources":["../../../../../react/src/utils/remark-emoji.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAgB,MAAM,OAAO,CAAC;AAGhD,wBAAgB,WAAW,KACjB,MAAM,IAAI,UAmCnB"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { visit } from 'unist-util-visit';
|
|
2
|
-
import { resolveShortcode } from './emoji-data';
|
|
3
|
-
export function remarkEmoji() {
|
|
4
|
-
return (tree) => {
|
|
5
|
-
visit(tree, 'text', (node, index, parent) => {
|
|
6
|
-
// Skip if parent is code or inlineCode
|
|
7
|
-
if (parent && (parent.type === 'code' || parent.type === 'inlineCode'))
|
|
8
|
-
return;
|
|
9
|
-
const regex = /:([a-z0-9_+-]+):/g;
|
|
10
|
-
let match;
|
|
11
|
-
let lastIndex = 0;
|
|
12
|
-
const newNodes = [];
|
|
13
|
-
while ((match = regex.exec(node.value)) !== null) {
|
|
14
|
-
const emoji = resolveShortcode(match[1]);
|
|
15
|
-
if (emoji) {
|
|
16
|
-
// Add text before the match
|
|
17
|
-
if (match.index > lastIndex) {
|
|
18
|
-
newNodes.push({ type: 'text', value: node.value.slice(lastIndex, match.index) });
|
|
19
|
-
}
|
|
20
|
-
// Add the emoji
|
|
21
|
-
newNodes.push({ type: 'text', value: emoji });
|
|
22
|
-
lastIndex = regex.lastIndex;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (newNodes.length > 0) {
|
|
26
|
-
// Add remaining text
|
|
27
|
-
if (lastIndex < node.value.length) {
|
|
28
|
-
newNodes.push({ type: 'text', value: node.value.slice(lastIndex) });
|
|
29
|
-
}
|
|
30
|
-
// Replace the node with the new nodes
|
|
31
|
-
if (parent && typeof index === 'number') {
|
|
32
|
-
parent.children.splice(index, 1, ...newNodes);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=remark-emoji.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remark-emoji.js","sourceRoot":"","sources":["../../../../../react/src/utils/remark-emoji.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,UAAU,WAAW;IACzB,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,IAAU,EAAE,KAAK,EAAE,MAA0B,EAAE,EAA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AAI,MAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;oBACxC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/serve/src/args.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface ServeArgs {
|
|
2
|
-
/** Arguments passed through to `git diff`, in the order given. */
|
|
3
|
-
gitDiffArgs: string[];
|
|
4
|
-
/**
|
|
5
|
-
* Output path exactly as typed, unresolved. `null` means the caller said
|
|
6
|
-
* nothing and the configured `output-file` decides.
|
|
7
|
-
*/
|
|
8
|
-
outputPath: string | null;
|
|
9
|
-
/** Path of a prior review XML to resume from, as typed. `null` when unset. */
|
|
10
|
-
resumeFrom: string | null;
|
|
11
|
-
help: boolean;
|
|
12
|
-
version: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare function parseServeArgs(argv: string[]): ServeArgs;
|
|
15
|
-
//# sourceMappingURL=args.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../../src/args.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,SAAS;IACxB,kEAAkE;IAClE,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB;;;OAGG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,8EAA8E;IAC9E,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAyBD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,CA6CxD"}
|
package/dist/serve/src/args.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// Mirrors the desktop's parser (src/main/cli.ts): anything the program does not
|
|
2
|
-
// claim is passed to `git diff` verbatim. The output path is fixed for the life
|
|
3
|
-
// of the process — a browser has no equivalent of the native save dialog.
|
|
4
|
-
const VALUE_FLAGS = {
|
|
5
|
-
'--output': 'outputPath',
|
|
6
|
-
'-o': 'outputPath',
|
|
7
|
-
'--resume-from': 'resumeFrom',
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Parse serve-mode arguments. Throws on a value-taking flag with no value:
|
|
11
|
-
* silently passing `--output` to `git diff` would fail much further away
|
|
12
|
-
* from the mistake, with a message about a revision.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* An empty value is a mistake, not a request for the default: `--output=`
|
|
16
|
-
* resolves to the working directory, which passes the writability check and
|
|
17
|
-
* then fails with EISDIR at submit, once the review has left the session.
|
|
18
|
-
*/
|
|
19
|
-
function requireValue(flag, value) {
|
|
20
|
-
if (value === '') {
|
|
21
|
-
throw new Error(`${flag} requires a file path argument`);
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
export function parseServeArgs(argv) {
|
|
26
|
-
const args = {
|
|
27
|
-
gitDiffArgs: [],
|
|
28
|
-
outputPath: null,
|
|
29
|
-
resumeFrom: null,
|
|
30
|
-
help: false,
|
|
31
|
-
version: false,
|
|
32
|
-
};
|
|
33
|
-
for (let i = 0; i < argv.length; i++) {
|
|
34
|
-
const arg = argv[i];
|
|
35
|
-
if (arg === '--help' || arg === '-h') {
|
|
36
|
-
args.help = true;
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
if (arg === '--version' || arg === '-v') {
|
|
40
|
-
args.version = true;
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
// Accepted alongside the separated form, so `=` is never a git revision.
|
|
44
|
-
const equals = arg.indexOf('=');
|
|
45
|
-
if (equals > 0) {
|
|
46
|
-
const field = VALUE_FLAGS[arg.slice(0, equals)];
|
|
47
|
-
if (field) {
|
|
48
|
-
args[field] = requireValue(arg.slice(0, equals), arg.slice(equals + 1));
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const field = VALUE_FLAGS[arg];
|
|
53
|
-
if (field) {
|
|
54
|
-
if (i + 1 >= argv.length) {
|
|
55
|
-
throw new Error(`${arg} requires a file path argument`);
|
|
56
|
-
}
|
|
57
|
-
args[field] = requireValue(arg, argv[i + 1]);
|
|
58
|
-
i++;
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
args.gitDiffArgs.push(arg);
|
|
62
|
-
}
|
|
63
|
-
return args;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=args.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../../src/args.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,gFAAgF;AAChF,0EAA0E;AAgB1E,MAAM,WAAW,GAAgD;IAC/D,UAAU,EAAE,YAAY;IACxB,IAAI,EAAE,YAAY;IAClB,eAAe,EAAE,YAAY;CAC9B,CAAC;AAEF;;;;GAIG;AACH;;;;GAIG;AACH,SAAS,YAAY,CAAC,IAAY,EAAE,KAAa;IAC/C,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,gCAAgC,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAc;IAC3C,MAAM,IAAI,GAAc;QACtB,WAAW,EAAE,EAAE;QACf,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,IAAI;QAChB,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAA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@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/serve/src/cli.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// The serve-mode entry point: resolve one review session, serve it on a
|
|
3
|
-
// port, and stop when the review is complete.
|
|
4
|
-
//
|
|
5
|
-
// Composition only — argument parsing is ./args, session resolution is
|
|
6
|
-
// ./startup, the routes are ./server and the completion is ./lifecycle. The
|
|
7
|
-
// order below is the load-bearing part: the session is fully resolved, and
|
|
8
|
-
// the completion hook attached, before the listener opens, so no request can
|
|
9
|
-
// reach a half-built session and no submission can arrive unobserved.
|
|
10
|
-
import { createRequire } from 'node:module';
|
|
11
|
-
import { parseServeArgs } from './args';
|
|
12
|
-
import { resolveSession } from './startup';
|
|
13
|
-
import { completeReviewOnSubmit } from './lifecycle';
|
|
14
|
-
import { createReviewServer, listenLoopback } from './server';
|
|
15
|
-
const HELP = `
|
|
16
|
-
self-review-serve - Serve the self-review interface over HTTP
|
|
17
|
-
|
|
18
|
-
Usage: self-review-serve [options] [<git-diff-args>...]
|
|
19
|
-
|
|
20
|
-
Options:
|
|
21
|
-
-o, --output <file> Write the review to <file> (default: ./review.xml, or
|
|
22
|
-
output-file from .self-review.yaml)
|
|
23
|
-
--resume-from <file> Load a previous review XML file
|
|
24
|
-
-h, --help Show this help message
|
|
25
|
-
-v, --version Show version number
|
|
26
|
-
|
|
27
|
-
All other arguments are passed to git diff. With none, the unstaged working
|
|
28
|
-
tree changes are reviewed. Outside a git repository, pass a directory or file.
|
|
29
|
-
|
|
30
|
-
Examples:
|
|
31
|
-
self-review-serve # unstaged changes
|
|
32
|
-
self-review-serve --staged
|
|
33
|
-
self-review-serve main..feature-branch
|
|
34
|
-
self-review-serve --resume-from review.xml # resume a previous review
|
|
35
|
-
|
|
36
|
-
The URL is printed to stderr on start. The output path is fixed by the
|
|
37
|
-
arguments above and cannot be changed from the browser. Completing the review
|
|
38
|
-
writes that file and stops this process. Nothing is saved before then, and
|
|
39
|
-
closing the tab once you have written a comment warns you first.
|
|
40
|
-
|
|
41
|
-
The listener binds to 127.0.0.1 and refuses any request that names another
|
|
42
|
-
host or origin, so a web page cannot reach it. There is no authentication:
|
|
43
|
-
anything that can reach the port can read the diff and complete the review,
|
|
44
|
-
which on a shared host means every local user. An ssh -L forward works.
|
|
45
|
-
`.trim();
|
|
46
|
-
function printVersion() {
|
|
47
|
-
try {
|
|
48
|
-
// Read at runtime rather than imported, so the version is the installed
|
|
49
|
-
// package's own. dist/cli.js sits one directory below package.json in
|
|
50
|
-
// both the workspace and an installed tarball.
|
|
51
|
-
const requireFromHere = createRequire(import.meta.url);
|
|
52
|
-
const pkg = requireFromHere('../package.json');
|
|
53
|
-
console.error(`self-review-serve v${pkg.version}`);
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
console.error('self-review-serve (version unknown)');
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async function main() {
|
|
60
|
-
const args = parseServeArgs(process.argv.slice(2));
|
|
61
|
-
if (args.help) {
|
|
62
|
-
console.error(HELP);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (args.version) {
|
|
66
|
-
printVersion();
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const { session, repositoryRoot, outputPath } = await resolveSession(args);
|
|
70
|
-
const server = createReviewServer({ session, repositoryRoot });
|
|
71
|
-
completeReviewOnSubmit({ server, session, outputPath });
|
|
72
|
-
const { url } = await listenLoopback(server);
|
|
73
|
-
console.error(`[serve] Review ready at ${url}`);
|
|
74
|
-
console.error(`[serve] Completing the review writes ${outputPath} and stops this process.`);
|
|
75
|
-
console.error('[serve] The listener is loopback-only and unauthenticated.');
|
|
76
|
-
}
|
|
77
|
-
main().catch(error => {
|
|
78
|
-
console.error(`[serve] ${error instanceof Error ? error.message : String(error)}`);
|
|
79
|
-
process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AAO;IACT,CAAC;IACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,YAAY,EAAE,CAAC;QACf,OAAO;IACT,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;IAE3E,MAAM,MAAM,GAAG,kBAAkB,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;IAC/D,sBAAsB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;IAExD,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7C,OAAO,CAAC,KAAK,CAAC,2BAA2B,GAAG,EAAE,CAAC,CAAC;IAChD,OAAO,CAAC,KAAK,CAAC,wCAAwC,UAAU,0BAA0B,CAAC,CAAC;IAC5F,OAAO,CAAC,KAAK,CAAC,4DAA4D,CAAC,CAAC;AAC9E,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,WAAW,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACnF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ReviewAdapter } from '@self-review/react';
|
|
2
|
-
import type { AppConfig, OutputPathInfo, ReviewState } from '@self-review/core';
|
|
3
|
-
/** What `GET /api/config` answers. */
|
|
4
|
-
export interface ConfigApiResponse {
|
|
5
|
-
config: AppConfig;
|
|
6
|
-
outputPathInfo: OutputPathInfo | null;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Rewrite a review state into the JSON body `POST /api/review` accepts:
|
|
10
|
-
* attachment blobs base64-encoded, and only the three top-level fields the
|
|
11
|
-
* server takes (it rejects an unknown key with 400, and remote provenance is
|
|
12
|
-
* injected server-side, exactly as the desktop injects it in main).
|
|
13
|
-
*/
|
|
14
|
-
export declare function encodeReviewStateForWire(state: ReviewState): unknown;
|
|
15
|
-
/** Read the config and its output path info. Fetched before the UI mounts. */
|
|
16
|
-
export declare function loadServeConfig(): Promise<ConfigApiResponse | null>;
|
|
17
|
-
/**
|
|
18
|
-
* Build the adapter for one page load.
|
|
19
|
-
*
|
|
20
|
-
* A factory rather than a module-level object because the shared
|
|
21
|
-
* `GET /api/diff` promise is per-session state; a test gets a fresh one per
|
|
22
|
-
* case, and the page creates exactly one.
|
|
23
|
-
*/
|
|
24
|
-
export declare function createFetchAdapter(): ReviewAdapter;
|
|
25
|
-
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/client/adapter.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAoB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EACV,SAAS,EAOT,cAAc,EAEd,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAQ3B,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,SAAS,CAAC;IAClB,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC;AA4ED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAoBpE;AAOD,8EAA8E;AAC9E,wBAAsB,eAAe,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAEzE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,aAAa,CAiFlD"}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
// A `ReviewAdapter` over `fetch`: transport only, since every component the
|
|
2
|
-
// browser renders already lives in `@self-review/react`.
|
|
3
|
-
//
|
|
4
|
-
// Four deliberate properties. `changeOutputPath` is absent, not stubbed —
|
|
5
|
-
// `FileTree` renders its control on the property's presence, so a stub would
|
|
6
|
-
// draw a dead button. `chooseApplyDestination` is absent for a stronger reason:
|
|
7
|
-
// the UI only asks for a destination when the session is a temporary remote
|
|
8
|
-
// clone, and serve mode has no remote mode, so the case cannot arise.
|
|
9
|
-
// `GET /api/diff` is issued once and shared, carrying both the diff and the
|
|
10
|
-
// guide, so there is no push transport. And `submitReview` resolving is
|
|
11
|
-
// acceptance, not a written file: lifecycle.ts writes on the response's
|
|
12
|
-
// `finish`, so nothing here may report a saved review.
|
|
13
|
-
/** Surfaces the server's `{ error }` text, since callers only log what they get. */
|
|
14
|
-
async function getJson(path) {
|
|
15
|
-
const response = await fetch(path);
|
|
16
|
-
if (!response.ok) {
|
|
17
|
-
throw new Error(await errorText(response, `GET ${path}`));
|
|
18
|
-
}
|
|
19
|
-
return (await response.json());
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Post a JSON body. `content-type: application/json` is not optional: the
|
|
23
|
-
* server answers 415 without it, on both POST routes.
|
|
24
|
-
*/
|
|
25
|
-
async function postJson(path, body) {
|
|
26
|
-
const response = await fetch(path, {
|
|
27
|
-
method: 'POST',
|
|
28
|
-
headers: { 'content-type': 'application/json' },
|
|
29
|
-
body: JSON.stringify(body),
|
|
30
|
-
});
|
|
31
|
-
if (!response.ok) {
|
|
32
|
-
throw new Error(await errorText(response, `POST ${path}`));
|
|
33
|
-
}
|
|
34
|
-
return (await response.json());
|
|
35
|
-
}
|
|
36
|
-
async function errorText(response, what) {
|
|
37
|
-
try {
|
|
38
|
-
const body = (await response.json());
|
|
39
|
-
if (typeof body?.error === 'string') {
|
|
40
|
-
return `${what} failed (${response.status}): ${body.error}`;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
// A non-JSON error body is no more informative than the status.
|
|
45
|
-
}
|
|
46
|
-
return `${what} failed (${response.status})`;
|
|
47
|
-
}
|
|
48
|
-
// ---------------------------------------------------------------------------
|
|
49
|
-
// Attachment blobs on the wire.
|
|
50
|
-
//
|
|
51
|
-
// `Attachment.data` is an `ArrayBuffer`, and `JSON.stringify` renders one as
|
|
52
|
-
// `{}`. Submitting a review with an image straight through the JSON body
|
|
53
|
-
// would therefore write a zero-byte file — with a 200, and no error anywhere.
|
|
54
|
-
// The bytes go base64-encoded in `dataBase64` instead; `parseReviewStateBody`
|
|
55
|
-
// in ../validate.ts decodes them back and rejects a raw `data` field, so a
|
|
56
|
-
// client that forgets this fails loudly rather than silently.
|
|
57
|
-
// ---------------------------------------------------------------------------
|
|
58
|
-
/** `String.fromCharCode` is applied to a slice at a time; spreading a whole
|
|
59
|
-
* multi-megabyte screenshot in one call overflows the argument stack. */
|
|
60
|
-
const BASE64_CHUNK_BYTES = 0x8000;
|
|
61
|
-
function arrayBufferToBase64(buffer) {
|
|
62
|
-
const bytes = new Uint8Array(buffer);
|
|
63
|
-
let binary = '';
|
|
64
|
-
for (let offset = 0; offset < bytes.length; offset += BASE64_CHUNK_BYTES) {
|
|
65
|
-
binary += String.fromCharCode(...bytes.subarray(offset, offset + BASE64_CHUNK_BYTES));
|
|
66
|
-
}
|
|
67
|
-
return btoa(binary);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Encode one attachment list for the wire. An attachment with no blob — a
|
|
71
|
-
* resumed one, whose bytes are read back through `GET /api/attachment` —
|
|
72
|
-
* passes through as it is.
|
|
73
|
-
*/
|
|
74
|
-
function encodeAttachments(attachments) {
|
|
75
|
-
return attachments.map(attachment => {
|
|
76
|
-
const { data, ...rest } = attachment;
|
|
77
|
-
if (!data || data.byteLength === 0)
|
|
78
|
-
return rest;
|
|
79
|
-
return { ...rest, dataBase64: arrayBufferToBase64(data) };
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Rewrite a review state into the JSON body `POST /api/review` accepts:
|
|
84
|
-
* attachment blobs base64-encoded, and only the three top-level fields the
|
|
85
|
-
* server takes (it rejects an unknown key with 400, and remote provenance is
|
|
86
|
-
* injected server-side, exactly as the desktop injects it in main).
|
|
87
|
-
*/
|
|
88
|
-
export function encodeReviewStateForWire(state) {
|
|
89
|
-
return {
|
|
90
|
-
timestamp: state.timestamp,
|
|
91
|
-
source: state.source,
|
|
92
|
-
files: state.files.map(file => ({
|
|
93
|
-
...file,
|
|
94
|
-
comments: file.comments.map(comment => ({
|
|
95
|
-
...comment,
|
|
96
|
-
...(comment.attachments ? { attachments: encodeAttachments(comment.attachments) } : {}),
|
|
97
|
-
...(comment.replies
|
|
98
|
-
? {
|
|
99
|
-
replies: comment.replies.map(reply => ({
|
|
100
|
-
...reply,
|
|
101
|
-
...(reply.attachments ? { attachments: encodeAttachments(reply.attachments) } : {}),
|
|
102
|
-
})),
|
|
103
|
-
}
|
|
104
|
-
: {}),
|
|
105
|
-
})),
|
|
106
|
-
})),
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
/** Path-bearing routes take the path as a query parameter, encoded once. */
|
|
110
|
-
function withPath(route, filePath) {
|
|
111
|
-
return `${route}?path=${encodeURIComponent(filePath)}`;
|
|
112
|
-
}
|
|
113
|
-
/** Read the config and its output path info. Fetched before the UI mounts. */
|
|
114
|
-
export async function loadServeConfig() {
|
|
115
|
-
return getJson('/api/config');
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Build the adapter for one page load.
|
|
119
|
-
*
|
|
120
|
-
* A factory rather than a module-level object because the shared
|
|
121
|
-
* `GET /api/diff` promise is per-session state; a test gets a fresh one per
|
|
122
|
-
* case, and the page creates exactly one.
|
|
123
|
-
*/
|
|
124
|
-
export function createFetchAdapter() {
|
|
125
|
-
let diffRequest = null;
|
|
126
|
-
/** The one `GET /api/diff`, shared by loadDiff and both subscriptions. */
|
|
127
|
-
function requestDiff() {
|
|
128
|
-
diffRequest ?? (diffRequest = getJson('/api/diff').then(response => {
|
|
129
|
-
if (response === null) {
|
|
130
|
-
throw new Error('The server has no diff to review');
|
|
131
|
-
}
|
|
132
|
-
return response;
|
|
133
|
-
}));
|
|
134
|
-
return diffRequest;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Deliver one half of the shared diff response to a subscriber. Returns
|
|
138
|
-
* the unsubscribe function the interface requires — the subscribing effect
|
|
139
|
-
* re-runs whenever the adapter identity changes, and a late delivery to a
|
|
140
|
-
* torn-down consumer would be a state update after unmount.
|
|
141
|
-
*/
|
|
142
|
-
function subscribe(select, callback) {
|
|
143
|
-
let active = true;
|
|
144
|
-
void requestDiff()
|
|
145
|
-
.then(response => {
|
|
146
|
-
const value = select(response);
|
|
147
|
-
if (active && value !== null)
|
|
148
|
-
callback(value);
|
|
149
|
-
})
|
|
150
|
-
.catch(() => {
|
|
151
|
-
// loadDiff surfaces the failure; a subscriber has nothing to add.
|
|
152
|
-
});
|
|
153
|
-
return () => {
|
|
154
|
-
active = false;
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
return {
|
|
158
|
-
loadDiff: async () => (await requestDiff()).diff,
|
|
159
|
-
loadResumedReview: async () =>
|
|
160
|
-
// The route answers null when there is nothing to resume; an empty
|
|
161
|
-
// payload says the same thing in the shape the interface promises.
|
|
162
|
-
(await getJson('/api/resume')) ?? {
|
|
163
|
-
comments: [],
|
|
164
|
-
viewedFiles: [],
|
|
165
|
-
},
|
|
166
|
-
applySuggestion: request => postJson('/api/apply-suggestion', request),
|
|
167
|
-
submitReview: async (state) => {
|
|
168
|
-
// Resolving means the submission was *accepted*, not that the review
|
|
169
|
-
// is on disk: the route only stores it on the session, and
|
|
170
|
-
// ../lifecycle.ts writes the file on the response's finish event.
|
|
171
|
-
await postJson('/api/review', encodeReviewStateForWire(state));
|
|
172
|
-
},
|
|
173
|
-
expandContext: (request) => postJson('/api/expand-context', request),
|
|
174
|
-
loadFileContent: (filePath) => getJson(withPath('/api/file', filePath)),
|
|
175
|
-
loadImage: (filePath) => getJson(withPath('/api/image', filePath)),
|
|
176
|
-
readAttachment: async (filePath) => {
|
|
177
|
-
// Bytes, not JSON: this route answers octet-stream, and 404 for an
|
|
178
|
-
// attachment whose file is gone — which the image component renders
|
|
179
|
-
// as "Image not found" rather than treating as an error.
|
|
180
|
-
const response = await fetch(withPath('/api/attachment', filePath));
|
|
181
|
-
if (!response.ok)
|
|
182
|
-
return null;
|
|
183
|
-
return response.arrayBuffer();
|
|
184
|
-
},
|
|
185
|
-
onGuideLoad: callback => subscribe(response => response.guide, callback),
|
|
186
|
-
onDiffLoad: callback => subscribe(response => response.diff, callback),
|
|
187
|
-
// changeOutputPath is deliberately absent — see the header comment.
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
//# sourceMappingURL=adapter.js.map
|