@embedder/embedder 2.1.11 → 2.1.12
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{D as e,t}from"./cli-B71In4L2.js";import{b as n,c as r,d as s,a as i,f as o,l,s as u}from"./cli-B71In4L2.js";import"./_commonjsHelpers-BKZq-wXp.js";import"signal-exit";import"node:process";import"node:events";import"node:fs";import"module";import"node:os";import"node:tty";import"node:buffer";import"node:util";import"node:path";import"node:url";import"node:child_process";import"node:fs/promises";import"@sentry/node";import"util";import"stream";import"buffer";import"events";import"os";import"fs";import"path";import"zlib";import"tty";import"string_decoder";import"http";import"https";import"crypto";import"node:stream";import"url";import"process";import"fs/promises";import"node:string_decoder";import"net";import"child_process";const a=new class extends e{};function c(e,t,n){return a.diff(e,t,n)}function f(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function h(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function p(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function d(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function g(e,t){return p(e,t,"")}function m(e,t){return d(e,t,"")}function v(e,t){return t.slice(0,function(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);const s=Array(r);let i=0;s[0]=0;for(let o=1;o<r;o++){for(t[o]==t[i]?s[o]=s[i]:s[o]=i;i>0&&t[o]!=t[i];)i=s[i];t[o]==t[i]&&i++}i=0;for(let o=n;o<e.length;o++){for(;i>0&&e[o]!=t[i];)i=s[i];e[o]==t[i]&&i++}return i}(e,t))}function w(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function y(e){const t=e.match(/^\s*/);return t?t[0]:""}const L="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",b=new RegExp(`[${L}]+|\\s+|[^${L}]`,"ug");const k=new class extends e{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){const r=t.intlSegmenter;if("word"!=r.resolvedOptions().granularity)throw new Error('The segmenter passed must have a granularity of "word"');n=Array.from(r.segment(e),e=>e.segment)}else n=e.match(b)||[];const r=[];let s=null;return n.forEach(e=>{/\s/.test(e)?null==s?r.push(e):r.push(r.pop()+e):null!=s&&/\s/.test(s)?r[r.length-1]==s?r.push(r.pop()+e):r.push(s+e):r.push(e),s=e}),r}join(e){return e.map((e,t)=>0==t?e:e.replace(/^\s+/,"")).join("")}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,s=null;return e.forEach(e=>{e.added?r=e:e.removed?s=e:((r||s)&&S(n,s,r,e),n=e,r=null,s=null)}),(r||s)&&S(n,s,r,null),e}};function j(e,t,n){return null==(null==n?void 0:n.ignoreWhitespace)||n.ignoreWhitespace?k.diff(e,t,n):E(e,t,n)}function S(e,t,n,r){if(t&&n){const s=y(t.value),i=w(t.value),o=y(n.value),l=w(n.value);if(e){const r=f(s,o);e.value=d(e.value,o,r),t.value=g(t.value,r),n.value=g(n.value,r)}if(r){const e=h(i,l);r.value=p(r.value,l,e),t.value=m(t.value,e),n.value=m(n.value,e)}}else if(n){if(e){const e=y(n.value);n.value=n.value.substring(e.length)}if(r){const e=y(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){const n=y(r.value),s=y(t.value),i=w(t.value),o=f(n,s);t.value=g(t.value,o);const l=h(g(n,o),i);t.value=m(t.value,l),r.value=p(r.value,n,l),e.value=d(e.value,n,n.slice(0,n.length-l.length))}else if(r){const e=y(r.value),n=v(w(t.value),e);t.value=m(t.value,n)}else if(e){const n=v(w(e.value),y(t.value));t.value=g(t.value,n)}}const O=new class extends e{tokenize(e){const t=new RegExp(`(\\r?\\n)|[${L}]+|[^\\S\\n\\r]+|[^${L}]`,"ug");return e.match(t)||[]}};function E(e,t,n){return O.diff(e,t,n)}function x(e){return"."==e||"!"==e||"?"==e}const A=new class extends e{tokenize(e){var t;const n=[];let r=0;for(let s=0;s<e.length;s++){if(s==e.length-1){n.push(e.slice(r));break}if(x(e[s])&&e[s+1].match(/\s/)){for(n.push(e.slice(r,s+1)),s=r=s+1;null===(t=e[s+1])||void 0===t?void 0:t.match(/\s/);)s++;n.push(e.slice(r,s+1)),r=s+1}}return n}};function F(e,t,n){return A.diff(e,t,n)}const $=new class extends e{tokenize(e){return e.split(/([{}:;,]|\s+)/)}};function W(e,t,n){return $.diff(e,t,n)}const N=new class extends e{constructor(){super(...arguments),this.tokenize=t}get useLongestToken(){return!0}castInput(e,t){const{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>void 0===t?n:t}=t;return"string"==typeof e?e:JSON.stringify(C(e,null,null,r),null," ")}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"),n)}};function z(e,t,n){return N.diff(e,t,n)}function C(e,t,n,r,s){let i,o;for(t=t||[],n=n||[],r&&(e=r(void 0===s?"":s,e)),i=0;i<t.length;i+=1)if(t[i]===e)return n[i];if("[object Array]"===Object.prototype.toString.call(e)){for(t.push(e),o=new Array(e.length),n.push(o),i=0;i<e.length;i+=1)o[i]=C(e[i],t,n,r,String(i));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),"object"==typeof e&&null!==e){t.push(e),o={},n.push(o);const s=[];let l;for(l in e)Object.prototype.hasOwnProperty.call(e,l)&&s.push(l);for(s.sort(),i=0;i<s.length;i+=1)l=s[i],o[l]=C(e[l],t,n,r,l);t.pop(),n.pop()}else o=e;return o}const H=new class extends e{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function J(e,t,n){return H.diff(e,t,n)}function P(e){return Array.isArray(e)?e.map(e=>P(e)):Object.assign(Object.assign({},e),{hunks:e.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map((t,n)=>{var r;return t.startsWith("\\")||t.endsWith("\r")||(null===(r=e.lines[n+1])||void 0===r?void 0:r.startsWith("\\"))?t:t+"\r"})}))})}function I(e){return Array.isArray(e)?e.map(e=>I(e)):Object.assign(Object.assign({},e),{hunks:e.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map(e=>e.endsWith("\r")?e.substring(0,e.length-1):e)}))})}function _(e){const t=e.split(/\n/),n=[];let r=0;function s(){const e={};for(n.push(e);r<t.length;){const n=t[r];if(/^(---|\+\+\+|@@)\s/.test(n))break;const s=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(n);s&&(e.index=s[1]),r++}for(i(e),i(e),e.hunks=[];r<t.length;){const n=t[r];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(n))break;if(/^@@/.test(n))e.hunks.push(o());else{if(n)throw new Error("Unknown line "+(r+1)+" "+JSON.stringify(n));r++}}}function i(e){const n=/^(---|\+\+\+)\s+(.*)\r?$/.exec(t[r]);if(n){const t=n[2].split("\t",2),s=(t[1]||"").trim();let i=t[0].replace(/\\\\/g,"\\");/^".*"$/.test(i)&&(i=i.substr(1,i.length-2)),"---"===n[1]?(e.oldFileName=i,e.oldHeader=s):(e.newFileName=i,e.newHeader=s),r++}}function o(){var e;const n=r,s=t[r++].split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),i={oldStart:+s[1],oldLines:void 0===s[2]?1:+s[2],newStart:+s[3],newLines:void 0===s[4]?1:+s[4],lines:[]};0===i.oldLines&&(i.oldStart+=1),0===i.newLines&&(i.newStart+=1);let o=0,l=0;for(;r<t.length&&(l<i.oldLines||o<i.newLines||(null===(e=t[r])||void 0===e?void 0:e.startsWith("\\")));r++){const e=0==t[r].length&&r!=t.length-1?" ":t[r][0];if("+"!==e&&"-"!==e&&" "!==e&&"\\"!==e)throw new Error(`Hunk at line ${n+1} contained invalid line ${t[r]}`);i.lines.push(t[r]),"+"===e?o++:"-"===e?l++:" "===e&&(o++,l++)}if(o||1!==i.newLines||(i.newLines=0),l||1!==i.oldLines||(i.oldLines=0),o!==i.newLines)throw new Error("Added line count did not match for hunk at line "+(n+1));if(l!==i.oldLines)throw new Error("Removed line count did not match for hunk at line "+(n+1));return i}for(;r<t.length;)s();return n}function D(e,t,n){let r=!0,s=!1,i=!1,o=1;return function l(){if(r&&!i){if(s?o++:r=!1,e+o<=n)return e+o;i=!0}if(!s)return i||(r=!0),t<=e-o?e-o++:(s=!0,l())}}function R(e,t,n={}){let r;if(r="string"==typeof t?_(t):Array.isArray(t)?t:[t],r.length>1)throw new Error("applyPatch only works with a single input.");return function(e,t,n={}){(n.autoConvertLineEndings||null==n.autoConvertLineEndings)&&((r=e).includes("\r\n")&&!r.startsWith("\n")&&!r.match(/[^\r]\n/)&&function(e){return Array.isArray(e)||(e=[e]),!e.some(e=>e.hunks.some(e=>e.lines.some(e=>!e.startsWith("\\")&&e.endsWith("\r"))))}(t)?t=P(t):function(e){return!e.includes("\r\n")&&e.includes("\n")}(e)&&function(e){return Array.isArray(e)||(e=[e]),e.some(e=>e.hunks.some(e=>e.lines.some(e=>e.endsWith("\r"))))&&e.every(e=>e.hunks.every(e=>e.lines.every((t,n)=>{var r;return t.startsWith("\\")||t.endsWith("\r")||(null===(r=e.lines[n+1])||void 0===r?void 0:r.startsWith("\\"))})))}(t)&&(t=I(t)));var r;const s=e.split("\n"),i=t.hunks,o=n.compareLine||((e,t,n,r)=>t===r),l=n.fuzzFactor||0;let u=0;if(l<0||!Number.isInteger(l))throw new Error("fuzzFactor must be a non-negative integer");if(!i.length)return e;let a="",c=!1,f=!1;for(let g=0;g<i[i.length-1].lines.length;g++){const e=i[i.length-1].lines[g];"\\"==e[0]&&("+"==a[0]?c=!0:"-"==a[0]&&(f=!0)),a=e}if(c){if(f){if(!l&&""==s[s.length-1])return!1}else if(""==s[s.length-1])s.pop();else if(!l)return!1}else if(f)if(""!=s[s.length-1])s.push("");else if(!l)return!1;function h(e,t,n,r=0,i=!0,l=[],u=0){let a=0,c=!1;for(;r<e.length;r++){const f=e[r],p=f.length>0?f[0]:" ",d=f.length>0?f.substr(1):f;if("-"===p){if(!o(t+1,s[t],p,d))return n&&null!=s[t]?(l[u]=s[t],h(e,t+1,n-1,r,!1,l,u+1)):null;t++,a=0}if("+"===p){if(!i)return null;l[u]=d,u++,a=0,c=!0}if(" "===p){if(a++,l[u]=s[t],!o(t+1,s[t],p,d))return c||!n?null:s[t]&&(h(e,t+1,n-1,r+1,!1,l,u+1)||h(e,t+1,n-1,r,!1,l,u+1))||h(e,t,n-1,r+1,!1,l,u);u++,i=!0,c=!1,t++}}return u-=a,t-=a,l.length=u,{patchedLines:l,oldLineLastI:t-1}}const p=[];let d=0;for(let g=0;g<i.length;g++){const e=i[g];let t;const n=s.length-e.oldLines+l;let r;for(let s=0;s<=l;s++){r=e.oldStart+d-1;const i=D(r,u,n);for(;void 0!==r&&(t=h(e.lines,r,s),!t);r=i());if(t)break}if(!t)return!1;for(let i=u;i<r;i++)p.push(s[i]);for(let s=0;s<t.patchedLines.length;s++){const e=t.patchedLines[s];p.push(e)}u=t.oldLineLastI+1,d=r+1-e.oldStart}for(let g=u;g<s.length;g++)p.push(s[g]);return p.join("\n")}(e,r[0],n)}function T(e,t){const n="string"==typeof e?_(e):e;let r=0;!function e(){const s=n[r++];if(!s)return t.complete();t.loadFile(s,function(n,r){if(n)return t.complete(n);const i=R(r,s,t);t.patched(s,i,function(n){if(n)return t.complete(n);e()})})}()}function q(e){return Array.isArray(e)?e.map(e=>q(e)).reverse():Object.assign(Object.assign({},e),{oldFileName:e.newFileName,oldHeader:e.newHeader,newFileName:e.oldFileName,newHeader:e.oldHeader,hunks:e.hunks.map(e=>({oldLines:e.newLines,oldStart:e.newStart,newLines:e.oldLines,newStart:e.oldStart,lines:e.lines.map(e=>e.startsWith("-")?`+${e.slice(1)}`:e.startsWith("+")?`-${e.slice(1)}`:e)}))})}function U(e){const t=[];let n,r;for(let s=0;s<e.length;s++)n=e[s],r=n.added?1:n.removed?-1:0,t.push([r,n.value]);return t}function Z(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];r.added?t.push("<ins>"):r.removed&&t.push("<del>"),t.push(B(r.value)),r.added?t.push("</ins>"):r.removed&&t.push("</del>")}return t.join("")}function B(e){let t=e;return t=t.replace(/&/g,"&"),t=t.replace(/</g,"<"),t=t.replace(/>/g,">"),t=t.replace(/"/g,"""),t}export{e as Diff,R as applyPatch,T as applyPatches,H as arrayDiff,C as canonicalize,a as characterDiff,U as convertChangesToDMP,Z as convertChangesToXML,n as createPatch,r as createTwoFilesPatch,$ as cssDiff,J as diffArrays,c as diffChars,W as diffCss,z as diffJson,s as diffLines,F as diffSentences,i as diffTrimmedLines,j as diffWords,E as diffWordsWithSpace,o as formatPatch,N as jsonDiff,l as lineDiff,_ as parsePatch,q as reversePatch,A as sentenceDiff,u as structuredPatch,k as wordDiff,O as wordsWithSpaceDiff};
|
|
2
|
+
import{D as e,t}from"./cli-CYmJLh_S.js";import{b as n,c as r,d as s,a as i,f as o,l,s as u}from"./cli-CYmJLh_S.js";import"./_commonjsHelpers-BKZq-wXp.js";import"signal-exit";import"node:process";import"node:events";import"node:fs";import"module";import"node:os";import"node:tty";import"node:buffer";import"node:util";import"node:path";import"node:url";import"node:child_process";import"node:fs/promises";import"@sentry/node";import"util";import"stream";import"buffer";import"events";import"os";import"fs";import"path";import"zlib";import"tty";import"string_decoder";import"http";import"https";import"crypto";import"node:stream";import"url";import"process";import"fs/promises";import"node:string_decoder";import"net";import"child_process";const a=new class extends e{};function c(e,t,n){return a.diff(e,t,n)}function f(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function h(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function p(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function d(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function g(e,t){return p(e,t,"")}function m(e,t){return d(e,t,"")}function v(e,t){return t.slice(0,function(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);const s=Array(r);let i=0;s[0]=0;for(let o=1;o<r;o++){for(t[o]==t[i]?s[o]=s[i]:s[o]=i;i>0&&t[o]!=t[i];)i=s[i];t[o]==t[i]&&i++}i=0;for(let o=n;o<e.length;o++){for(;i>0&&e[o]!=t[i];)i=s[i];e[o]==t[i]&&i++}return i}(e,t))}function w(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function y(e){const t=e.match(/^\s*/);return t?t[0]:""}const L="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",b=new RegExp(`[${L}]+|\\s+|[^${L}]`,"ug");const k=new class extends e{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){const r=t.intlSegmenter;if("word"!=r.resolvedOptions().granularity)throw new Error('The segmenter passed must have a granularity of "word"');n=Array.from(r.segment(e),e=>e.segment)}else n=e.match(b)||[];const r=[];let s=null;return n.forEach(e=>{/\s/.test(e)?null==s?r.push(e):r.push(r.pop()+e):null!=s&&/\s/.test(s)?r[r.length-1]==s?r.push(r.pop()+e):r.push(s+e):r.push(e),s=e}),r}join(e){return e.map((e,t)=>0==t?e:e.replace(/^\s+/,"")).join("")}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,s=null;return e.forEach(e=>{e.added?r=e:e.removed?s=e:((r||s)&&S(n,s,r,e),n=e,r=null,s=null)}),(r||s)&&S(n,s,r,null),e}};function j(e,t,n){return null==(null==n?void 0:n.ignoreWhitespace)||n.ignoreWhitespace?k.diff(e,t,n):E(e,t,n)}function S(e,t,n,r){if(t&&n){const s=y(t.value),i=w(t.value),o=y(n.value),l=w(n.value);if(e){const r=f(s,o);e.value=d(e.value,o,r),t.value=g(t.value,r),n.value=g(n.value,r)}if(r){const e=h(i,l);r.value=p(r.value,l,e),t.value=m(t.value,e),n.value=m(n.value,e)}}else if(n){if(e){const e=y(n.value);n.value=n.value.substring(e.length)}if(r){const e=y(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){const n=y(r.value),s=y(t.value),i=w(t.value),o=f(n,s);t.value=g(t.value,o);const l=h(g(n,o),i);t.value=m(t.value,l),r.value=p(r.value,n,l),e.value=d(e.value,n,n.slice(0,n.length-l.length))}else if(r){const e=y(r.value),n=v(w(t.value),e);t.value=m(t.value,n)}else if(e){const n=v(w(e.value),y(t.value));t.value=g(t.value,n)}}const O=new class extends e{tokenize(e){const t=new RegExp(`(\\r?\\n)|[${L}]+|[^\\S\\n\\r]+|[^${L}]`,"ug");return e.match(t)||[]}};function E(e,t,n){return O.diff(e,t,n)}function x(e){return"."==e||"!"==e||"?"==e}const A=new class extends e{tokenize(e){var t;const n=[];let r=0;for(let s=0;s<e.length;s++){if(s==e.length-1){n.push(e.slice(r));break}if(x(e[s])&&e[s+1].match(/\s/)){for(n.push(e.slice(r,s+1)),s=r=s+1;null===(t=e[s+1])||void 0===t?void 0:t.match(/\s/);)s++;n.push(e.slice(r,s+1)),r=s+1}}return n}};function F(e,t,n){return A.diff(e,t,n)}const $=new class extends e{tokenize(e){return e.split(/([{}:;,]|\s+)/)}};function W(e,t,n){return $.diff(e,t,n)}const N=new class extends e{constructor(){super(...arguments),this.tokenize=t}get useLongestToken(){return!0}castInput(e,t){const{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>void 0===t?n:t}=t;return"string"==typeof e?e:JSON.stringify(C(e,null,null,r),null," ")}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"),n)}};function z(e,t,n){return N.diff(e,t,n)}function C(e,t,n,r,s){let i,o;for(t=t||[],n=n||[],r&&(e=r(void 0===s?"":s,e)),i=0;i<t.length;i+=1)if(t[i]===e)return n[i];if("[object Array]"===Object.prototype.toString.call(e)){for(t.push(e),o=new Array(e.length),n.push(o),i=0;i<e.length;i+=1)o[i]=C(e[i],t,n,r,String(i));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),"object"==typeof e&&null!==e){t.push(e),o={},n.push(o);const s=[];let l;for(l in e)Object.prototype.hasOwnProperty.call(e,l)&&s.push(l);for(s.sort(),i=0;i<s.length;i+=1)l=s[i],o[l]=C(e[l],t,n,r,l);t.pop(),n.pop()}else o=e;return o}const H=new class extends e{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function J(e,t,n){return H.diff(e,t,n)}function P(e){return Array.isArray(e)?e.map(e=>P(e)):Object.assign(Object.assign({},e),{hunks:e.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map((t,n)=>{var r;return t.startsWith("\\")||t.endsWith("\r")||(null===(r=e.lines[n+1])||void 0===r?void 0:r.startsWith("\\"))?t:t+"\r"})}))})}function I(e){return Array.isArray(e)?e.map(e=>I(e)):Object.assign(Object.assign({},e),{hunks:e.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map(e=>e.endsWith("\r")?e.substring(0,e.length-1):e)}))})}function _(e){const t=e.split(/\n/),n=[];let r=0;function s(){const e={};for(n.push(e);r<t.length;){const n=t[r];if(/^(---|\+\+\+|@@)\s/.test(n))break;const s=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(n);s&&(e.index=s[1]),r++}for(i(e),i(e),e.hunks=[];r<t.length;){const n=t[r];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(n))break;if(/^@@/.test(n))e.hunks.push(o());else{if(n)throw new Error("Unknown line "+(r+1)+" "+JSON.stringify(n));r++}}}function i(e){const n=/^(---|\+\+\+)\s+(.*)\r?$/.exec(t[r]);if(n){const t=n[2].split("\t",2),s=(t[1]||"").trim();let i=t[0].replace(/\\\\/g,"\\");/^".*"$/.test(i)&&(i=i.substr(1,i.length-2)),"---"===n[1]?(e.oldFileName=i,e.oldHeader=s):(e.newFileName=i,e.newHeader=s),r++}}function o(){var e;const n=r,s=t[r++].split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),i={oldStart:+s[1],oldLines:void 0===s[2]?1:+s[2],newStart:+s[3],newLines:void 0===s[4]?1:+s[4],lines:[]};0===i.oldLines&&(i.oldStart+=1),0===i.newLines&&(i.newStart+=1);let o=0,l=0;for(;r<t.length&&(l<i.oldLines||o<i.newLines||(null===(e=t[r])||void 0===e?void 0:e.startsWith("\\")));r++){const e=0==t[r].length&&r!=t.length-1?" ":t[r][0];if("+"!==e&&"-"!==e&&" "!==e&&"\\"!==e)throw new Error(`Hunk at line ${n+1} contained invalid line ${t[r]}`);i.lines.push(t[r]),"+"===e?o++:"-"===e?l++:" "===e&&(o++,l++)}if(o||1!==i.newLines||(i.newLines=0),l||1!==i.oldLines||(i.oldLines=0),o!==i.newLines)throw new Error("Added line count did not match for hunk at line "+(n+1));if(l!==i.oldLines)throw new Error("Removed line count did not match for hunk at line "+(n+1));return i}for(;r<t.length;)s();return n}function D(e,t,n){let r=!0,s=!1,i=!1,o=1;return function l(){if(r&&!i){if(s?o++:r=!1,e+o<=n)return e+o;i=!0}if(!s)return i||(r=!0),t<=e-o?e-o++:(s=!0,l())}}function R(e,t,n={}){let r;if(r="string"==typeof t?_(t):Array.isArray(t)?t:[t],r.length>1)throw new Error("applyPatch only works with a single input.");return function(e,t,n={}){(n.autoConvertLineEndings||null==n.autoConvertLineEndings)&&((r=e).includes("\r\n")&&!r.startsWith("\n")&&!r.match(/[^\r]\n/)&&function(e){return Array.isArray(e)||(e=[e]),!e.some(e=>e.hunks.some(e=>e.lines.some(e=>!e.startsWith("\\")&&e.endsWith("\r"))))}(t)?t=P(t):function(e){return!e.includes("\r\n")&&e.includes("\n")}(e)&&function(e){return Array.isArray(e)||(e=[e]),e.some(e=>e.hunks.some(e=>e.lines.some(e=>e.endsWith("\r"))))&&e.every(e=>e.hunks.every(e=>e.lines.every((t,n)=>{var r;return t.startsWith("\\")||t.endsWith("\r")||(null===(r=e.lines[n+1])||void 0===r?void 0:r.startsWith("\\"))})))}(t)&&(t=I(t)));var r;const s=e.split("\n"),i=t.hunks,o=n.compareLine||((e,t,n,r)=>t===r),l=n.fuzzFactor||0;let u=0;if(l<0||!Number.isInteger(l))throw new Error("fuzzFactor must be a non-negative integer");if(!i.length)return e;let a="",c=!1,f=!1;for(let g=0;g<i[i.length-1].lines.length;g++){const e=i[i.length-1].lines[g];"\\"==e[0]&&("+"==a[0]?c=!0:"-"==a[0]&&(f=!0)),a=e}if(c){if(f){if(!l&&""==s[s.length-1])return!1}else if(""==s[s.length-1])s.pop();else if(!l)return!1}else if(f)if(""!=s[s.length-1])s.push("");else if(!l)return!1;function h(e,t,n,r=0,i=!0,l=[],u=0){let a=0,c=!1;for(;r<e.length;r++){const f=e[r],p=f.length>0?f[0]:" ",d=f.length>0?f.substr(1):f;if("-"===p){if(!o(t+1,s[t],p,d))return n&&null!=s[t]?(l[u]=s[t],h(e,t+1,n-1,r,!1,l,u+1)):null;t++,a=0}if("+"===p){if(!i)return null;l[u]=d,u++,a=0,c=!0}if(" "===p){if(a++,l[u]=s[t],!o(t+1,s[t],p,d))return c||!n?null:s[t]&&(h(e,t+1,n-1,r+1,!1,l,u+1)||h(e,t+1,n-1,r,!1,l,u+1))||h(e,t,n-1,r+1,!1,l,u);u++,i=!0,c=!1,t++}}return u-=a,t-=a,l.length=u,{patchedLines:l,oldLineLastI:t-1}}const p=[];let d=0;for(let g=0;g<i.length;g++){const e=i[g];let t;const n=s.length-e.oldLines+l;let r;for(let s=0;s<=l;s++){r=e.oldStart+d-1;const i=D(r,u,n);for(;void 0!==r&&(t=h(e.lines,r,s),!t);r=i());if(t)break}if(!t)return!1;for(let i=u;i<r;i++)p.push(s[i]);for(let s=0;s<t.patchedLines.length;s++){const e=t.patchedLines[s];p.push(e)}u=t.oldLineLastI+1,d=r+1-e.oldStart}for(let g=u;g<s.length;g++)p.push(s[g]);return p.join("\n")}(e,r[0],n)}function T(e,t){const n="string"==typeof e?_(e):e;let r=0;!function e(){const s=n[r++];if(!s)return t.complete();t.loadFile(s,function(n,r){if(n)return t.complete(n);const i=R(r,s,t);t.patched(s,i,function(n){if(n)return t.complete(n);e()})})}()}function q(e){return Array.isArray(e)?e.map(e=>q(e)).reverse():Object.assign(Object.assign({},e),{oldFileName:e.newFileName,oldHeader:e.newHeader,newFileName:e.oldFileName,newHeader:e.oldHeader,hunks:e.hunks.map(e=>({oldLines:e.newLines,oldStart:e.newStart,newLines:e.oldLines,newStart:e.oldStart,lines:e.lines.map(e=>e.startsWith("-")?`+${e.slice(1)}`:e.startsWith("+")?`-${e.slice(1)}`:e)}))})}function U(e){const t=[];let n,r;for(let s=0;s<e.length;s++)n=e[s],r=n.added?1:n.removed?-1:0,t.push([r,n.value]);return t}function Z(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];r.added?t.push("<ins>"):r.removed&&t.push("<del>"),t.push(B(r.value)),r.added?t.push("</ins>"):r.removed&&t.push("</del>")}return t.join("")}function B(e){let t=e;return t=t.replace(/&/g,"&"),t=t.replace(/</g,"<"),t=t.replace(/>/g,">"),t=t.replace(/"/g,"""),t}export{e as Diff,R as applyPatch,T as applyPatches,H as arrayDiff,C as canonicalize,a as characterDiff,U as convertChangesToDMP,Z as convertChangesToXML,n as createPatch,r as createTwoFilesPatch,$ as cssDiff,J as diffArrays,c as diffChars,W as diffCss,z as diffJson,s as diffLines,F as diffSentences,i as diffTrimmedLines,j as diffWords,E as diffWordsWithSpace,o as formatPatch,N as jsonDiff,l as lineDiff,_ as parsePatch,q as reversePatch,A as sentenceDiff,u as structuredPatch,k as wordDiff,O as wordsWithSpaceDiff};
|
package/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{e as o,g as t}from"./assets/cli-
|
|
2
|
+
import{e as o,g as t}from"./assets/cli-CYmJLh_S.js";import"signal-exit";import"@sentry/node";import"./assets/_commonjsHelpers-BKZq-wXp.js";import"node:process";import"node:events";import"node:fs";import"module";import"node:os";import"node:tty";import"node:buffer";import"node:util";import"node:path";import"node:url";import"node:child_process";import"node:fs/promises";import"util";import"stream";import"buffer";import"events";import"os";import"fs";import"path";import"zlib";import"tty";import"string_decoder";import"http";import"https";import"crypto";import"node:stream";import"url";import"process";import"fs/promises";import"node:string_decoder";import"net";import"child_process";export{o as detectTerminal,t as getEnvironmentInfo};
|