difit 3.1.11 → 3.1.13
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/dist/cli/utils.js +10 -4
- package/dist/client/assets/index-CuR6SiR6.js +92 -0
- package/dist/client/assets/{prism-csharp-Bz_zphOC.js → prism-csharp-ZKjhnziZ.js} +1 -1
- package/dist/client/assets/{prism-hcl-HO7lwwhc.js → prism-hcl-DwkyF5D5.js} +1 -1
- package/dist/client/assets/{prism-java-Dh0Q2eOX.js → prism-java-Ctw2-mZM.js} +1 -1
- package/dist/client/assets/{prism-perl-D_qbRz8N.js → prism-perl-CIkv_4ov.js} +1 -1
- package/dist/client/assets/{prism-php-Dgr7EUBn.js → prism-php-DXHYixUM.js} +1 -1
- package/dist/client/assets/{prism-ruby-CaFchRnn.js → prism-ruby-CZTveVAu.js} +1 -1
- package/dist/client/assets/{prism-solidity-CDfI790k.js → prism-solidity-BfD1oY3r.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/git-diff.d.ts +9 -1
- package/dist/server/git-diff.js +56 -88
- package/dist/server/git-diff.test.js +19 -28
- package/dist/server/server.js +58 -14
- package/dist/server/server.test.js +39 -0
- package/dist/types/diff.d.ts +6 -0
- package/package.json +2 -1
- package/dist/client/assets/index-0eidGb4G.js +0 -92
package/dist/cli/utils.js
CHANGED
|
@@ -25,7 +25,10 @@ export function shouldReadStdin(options) {
|
|
|
25
25
|
}
|
|
26
26
|
export function getGitRoot() {
|
|
27
27
|
try {
|
|
28
|
-
const result = execSync('git rev-parse --show-toplevel', {
|
|
28
|
+
const result = execSync('git rev-parse --show-toplevel', {
|
|
29
|
+
encoding: 'utf8',
|
|
30
|
+
stdio: 'pipe',
|
|
31
|
+
});
|
|
29
32
|
return result.trim();
|
|
30
33
|
}
|
|
31
34
|
catch {
|
|
@@ -123,12 +126,12 @@ export function parseGitHubPrUrl(url) {
|
|
|
123
126
|
}
|
|
124
127
|
export function getPrPatch(prArg) {
|
|
125
128
|
try {
|
|
126
|
-
const patch = execFileSync('gh', ['pr', 'diff', prArg
|
|
129
|
+
const patch = execFileSync('gh', ['pr', 'diff', prArg], {
|
|
127
130
|
encoding: 'utf8',
|
|
128
131
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
129
132
|
});
|
|
130
133
|
if (!patch.trim()) {
|
|
131
|
-
throw new Error('No
|
|
134
|
+
throw new Error('No diff content returned from gh pr diff');
|
|
132
135
|
}
|
|
133
136
|
return patch;
|
|
134
137
|
}
|
|
@@ -168,7 +171,10 @@ export function validateDiffArguments(targetCommitish, baseCommitish) {
|
|
|
168
171
|
}
|
|
169
172
|
// Cannot compare same values
|
|
170
173
|
if (targetCommitish === baseCommitish) {
|
|
171
|
-
return {
|
|
174
|
+
return {
|
|
175
|
+
valid: false,
|
|
176
|
+
error: `Cannot compare ${targetCommitish} with itself`,
|
|
177
|
+
};
|
|
172
178
|
}
|
|
173
179
|
// "working" shows unstaged changes and can only be compared with staging area
|
|
174
180
|
if (targetCommitish === 'working' && baseCommitish && baseCommitish !== 'staged') {
|