@chocolatey-software/ccr 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ (() => {
2
+ // src/scripts/packages/disqus.js
3
+ (() => {
4
+ const disqusShortname = "chocolatey";
5
+ const dsq = document.createElement("script");
6
+ dsq.type = "text/javascript";
7
+ dsq.async = true;
8
+ dsq.src = `//${disqusShortname}.disqus.com/embed.js`;
9
+ (document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
10
+ document.addEventListener("themeChanged", () => {
11
+ if (document.readyState == "complete") {
12
+ DISQUS.reset({ reload: true, config: disqus_config });
13
+ }
14
+ });
15
+ })();
16
+ })();
@@ -0,0 +1 @@
1
+ (()=>{(()=>{let t="chocolatey",e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src=`//${t}.disqus.com/embed.js`,(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(e),document.addEventListener("themeChanged",()=>{document.readyState=="complete"&&DISQUS.reset({reload:!0,config:disqus_config})})})();})();
@@ -0,0 +1,202 @@
1
+ (() => {
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __commonJS = (cb, mod) => function __require() {
4
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
5
+ };
6
+ var __async = (__this, __arguments, generator) => {
7
+ return new Promise((resolve, reject) => {
8
+ var fulfilled = (value) => {
9
+ try {
10
+ step(generator.next(value));
11
+ } catch (e) {
12
+ reject(e);
13
+ }
14
+ };
15
+ var rejected = (value) => {
16
+ try {
17
+ step(generator.throw(value));
18
+ } catch (e) {
19
+ reject(e);
20
+ }
21
+ };
22
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
23
+ step((generator = generator.apply(__this, __arguments)).next());
24
+ });
25
+ };
26
+
27
+ // src/scripts/packages/ccr/package-differ.js
28
+ var require_package_differ = __commonJS({
29
+ "src/scripts/packages/ccr/package-differ.js"(exports) {
30
+ (() => {
31
+ const diffContainer = document.querySelector("#diffs");
32
+ if (diffContainer) {
33
+ const diffContent = document.querySelector("#diffContent");
34
+ const diffSelector = document.querySelector("#diffSelector");
35
+ const anyPackageRole = document.querySelector("#anyPackageRole").value.toLowerCase() === "true";
36
+ const callEndpoint = (url) => __async(null, null, function* () {
37
+ try {
38
+ const response = yield fetch(url);
39
+ const data = yield response.json();
40
+ return data;
41
+ } catch (error) {
42
+ console.error(error);
43
+ }
44
+ });
45
+ const getDiffFiles = (diffFolder) => {
46
+ diffContent.innerHTML = "";
47
+ return callEndpoint(`${window.location.protocol}//${window.location.host}/json/JsonApi?invoke&action=GetDiffFileUrls&folderName=${diffFolder}`).then((filePaths) => {
48
+ filePaths.forEach((filePath) => {
49
+ let diffFilePath = filePath.replaceAll("\\", "/").replace(".patch", "").trim();
50
+ diffFilePath = diffFilePath.split("/").slice(3);
51
+ diffFilePath = diffFilePath.join("\\");
52
+ const diffFileName = /[^\\]*$/.exec(diffFilePath)[0];
53
+ const diffTarget = `diff-path-${diffFileName.replaceAll(".", "-")}`;
54
+ let diffLanguage = "language-diff";
55
+ if (diffFileName.includes(".ps1") || diffFileName.includes(".psm1")) {
56
+ diffLanguage = "language-diff-powershell";
57
+ } else if (diffFileName.includes(".xml") || diffFileName.includes(".config") || diffFileName.includes(".nuspec")) {
58
+ diffLanguage = "language-diff-xml";
59
+ } else if (diffFileName.includes(".json")) {
60
+ diffLanguage = "language-diff-json";
61
+ } else if (diffFileName.includes(".js")) {
62
+ diffLanguage = "language-diff-js";
63
+ }
64
+ let fileContainer = "";
65
+ let diffCollapseShow = "";
66
+ let diffCollapseExpanded = "false";
67
+ let diffBtnText = "Show";
68
+ if (anyPackageRole) {
69
+ diffCollapseShow = "show";
70
+ diffCollapseExpanded = "true";
71
+ diffBtnText = "Hide";
72
+ }
73
+ fileContainer = `<div class="mb-1" data-file-path="${filePath}">
74
+ <div class="p-2 border border-start border-end text-bg-body-secondary d-flex align-items-center">
75
+ <button class="btn btn-sm btn-secondary btn-show-hide me-2" type="button" data-bs-toggle="collapse" data-bs-target=".${diffTarget}" aria-expanded="${diffCollapseExpanded}" aria-controls="${diffTarget}">${diffBtnText}</button>
76
+ <span>${diffFilePath}</span>
77
+ </div>
78
+ <div class="collapse ${diffCollapseShow} ${diffTarget}">
79
+ <pre class="mt-0 border-top-0 ps-0 pe-0"><code class="${diffLanguage} diff-highlight"></code></pre>
80
+ </div>
81
+ </div>`;
82
+ diffContent.insertAdjacentHTML("beforeend", fileContainer);
83
+ const getDiffContent = (filePath2) => {
84
+ callEndpoint(`${window.location.protocol}//${window.location.host}/json/JsonApi?invoke&action=GetDiffContent&key=${filePath2}`).then((fileContent) => {
85
+ const diffItems = document.querySelectorAll("[data-file-path]");
86
+ let isDuplicate = false;
87
+ if (!isDuplicate) {
88
+ diffItems.forEach((el) => {
89
+ if (el.getAttribute("data-file-path") == filePath2) {
90
+ const elPre = el.querySelector("pre");
91
+ const elCode = el.querySelector("code");
92
+ const htmlEntities = {
93
+ nbsp: " ",
94
+ cent: "\xA2",
95
+ pound: "\xA3",
96
+ yen: "\xA5",
97
+ euro: "\u20AC",
98
+ copy: "\xA9",
99
+ reg: "\xAE",
100
+ lt: "<",
101
+ gt: ">",
102
+ quot: '"',
103
+ amp: "&",
104
+ apos: "'"
105
+ };
106
+ const unescapeHTML = (str) => {
107
+ return str.replace(/\&([^;]+);/g, (entity, entityCode) => {
108
+ let match;
109
+ if (entityCode in htmlEntities) {
110
+ return htmlEntities[entityCode];
111
+ } else if (match = entityCode.match(/^#x([\da-fA-F]+)$/)) {
112
+ return String.fromCharCode(parseInt(match[1], 16));
113
+ } else if (match = entityCode.match(/^#(\d+)$/)) {
114
+ return String.fromCharCode(~~match[1]);
115
+ } else {
116
+ return entity;
117
+ }
118
+ });
119
+ };
120
+ elCode.insertAdjacentText("afterbegin", unescapeHTML(fileContent));
121
+ const extendDiffHighlight = () => {
122
+ const isOverflowing = (element) => {
123
+ return element.scrollWidth > element.offsetWidth;
124
+ };
125
+ if (isOverflowing(elPre)) {
126
+ const elPreStyle = window.getComputedStyle(elPre);
127
+ const elPrePadding = parseInt(elPreStyle.getPropertyValue("padding-left"));
128
+ const elPreScrollWidth = elPre.scrollWidth - elPrePadding;
129
+ const insertedToken = elPre.querySelectorAll(".token.inserted-sign.inserted");
130
+ const deletedToken = elPre.querySelectorAll(".token.deleted-sign.deleted");
131
+ const coordToken = elPre.querySelectorAll(".token.coord");
132
+ for (const i of insertedToken) {
133
+ i.style.width = `${elPreScrollWidth}px`;
134
+ }
135
+ for (const i of deletedToken) {
136
+ i.style.width = `${elPreScrollWidth}px`;
137
+ }
138
+ for (const i of coordToken) {
139
+ i.style.width = `${elPreScrollWidth}px`;
140
+ }
141
+ }
142
+ };
143
+ Prism.highlightElement(elCode, false, extendDiffHighlight);
144
+ isDuplicate = true;
145
+ }
146
+ });
147
+ }
148
+ });
149
+ };
150
+ const btnShowHide = diffContent.querySelector("[data-file-path]:last-child .btn-show-hide");
151
+ let isInitilized = false;
152
+ btnShowHide.addEventListener("click", () => {
153
+ if (btnShowHide.textContent.includes("Show")) {
154
+ btnShowHide.textContent = btnShowHide.textContent.replace("Show", "Hide");
155
+ } else {
156
+ btnShowHide.textContent = btnShowHide.textContent.replace("Hide", "Show");
157
+ }
158
+ if (!anyPackageRole && !isInitilized) {
159
+ getDiffContent(filePath);
160
+ isInitilized = true;
161
+ }
162
+ });
163
+ if (anyPackageRole) {
164
+ getDiffContent(filePath);
165
+ }
166
+ });
167
+ }).catch((error) => {
168
+ console.error(error.message);
169
+ });
170
+ };
171
+ const initDiffSelector = () => {
172
+ diffSelector.addEventListener("change", (e) => {
173
+ const diffFolder = e.target.value;
174
+ if (diffFolder !== "default") {
175
+ getDiffFiles(diffFolder);
176
+ }
177
+ });
178
+ };
179
+ const isDiffContainerExpanded = diffContainer.classList.contains("show") || window.location.hash == `#${diffContainer.id}`;
180
+ let isDiffContainerExpandedClick = false;
181
+ if (isDiffContainerExpanded && diffSelector.nodeName == "INPUT") {
182
+ getDiffFiles(diffSelector.value);
183
+ } else if (isDiffContainerExpanded && diffSelector.nodeName == "SELECT") {
184
+ initDiffSelector();
185
+ } else {
186
+ diffContainer.addEventListener("show.bs.collapse", () => {
187
+ if (!isDiffContainerExpandedClick) {
188
+ if (diffSelector.nodeName === "INPUT") {
189
+ getDiffFiles(diffSelector.value);
190
+ } else {
191
+ initDiffSelector();
192
+ }
193
+ }
194
+ isDiffContainerExpandedClick = true;
195
+ });
196
+ }
197
+ }
198
+ })();
199
+ }
200
+ });
201
+ require_package_differ();
202
+ })();
@@ -0,0 +1,9 @@
1
+ (()=>{(()=>{var N=Object.getOwnPropertyNames,H=(g,e)=>function(){return e||(0,g[N(g)[0]])((e={exports:{}}).exports,e),e.exports},F=(g,e,n)=>new Promise((i,r)=>{var S=t=>{try{a(n.next(t))}catch(c){r(c)}},w=t=>{try{a(n.throw(t))}catch(c){r(c)}},a=t=>t.done?i(t.value):Promise.resolve(t.value).then(S,w);a((n=n.apply(g,e)).next())}),I=H({"src/scripts/packages/ccr/package-differ.js"(g){(()=>{let e=document.querySelector("#diffs");if(e){let n=document.querySelector("#diffContent"),i=document.querySelector("#diffSelector"),r=document.querySelector("#anyPackageRole").value.toLowerCase()==="true",S=m=>F(null,null,function*(){try{return yield(yield fetch(m)).json()}catch(o){console.error(o)}}),w=m=>(n.innerHTML="",S(`${window.location.protocol}//${window.location.host}/json/JsonApi?invoke&action=GetDiffFileUrls&folderName=${m}`).then(o=>{o.forEach(y=>{let d=y.replaceAll("\\","/").replace(".patch","").trim();d=d.split("/").slice(3),d=d.join("\\");let s=/[^\\]*$/.exec(d)[0],b=`diff-path-${s.replaceAll(".","-")}`,x="language-diff";s.includes(".ps1")||s.includes(".psm1")?x="language-diff-powershell":s.includes(".xml")||s.includes(".config")||s.includes(".nuspec")?x="language-diff-xml":s.includes(".json")?x="language-diff-json":s.includes(".js")&&(x="language-diff-js");let C="",A="",k="false",q="Show";r&&(A="show",k="true",q="Hide"),C=`<div class="mb-1" data-file-path="${y}">
2
+ <div class="p-2 border border-start border-end text-bg-body-secondary d-flex align-items-center">
3
+ <button class="btn btn-sm btn-secondary btn-show-hide me-2" type="button" data-bs-toggle="collapse" data-bs-target=".${b}" aria-expanded="${k}" aria-controls="${b}">${q}</button>
4
+ <span>${d}</span>
5
+ </div>
6
+ <div class="collapse ${A} ${b}">
7
+ <pre class="mt-0 border-top-0 ps-0 pe-0"><code class="${x} diff-highlight"></code></pre>
8
+ </div>
9
+ </div>`,n.insertAdjacentHTML("beforeend",C);let E=P=>{S(`${window.location.protocol}//${window.location.host}/json/JsonApi?invoke&action=GetDiffContent&key=${P}`).then(O=>{let W=document.querySelectorAll("[data-file-path]"),T=!1;T||W.forEach($=>{if($.getAttribute("data-file-path")==P){let u=$.querySelector("pre"),L=$.querySelector("code"),_={nbsp:" ",cent:"\xA2",pound:"\xA3",yen:"\xA5",euro:"\u20AC",copy:"\xA9",reg:"\xAE",lt:"<",gt:">",quot:'"',amp:"&",apos:"'"},J=D=>D.replace(/\&([^;]+);/g,(p,h)=>{let l;return h in _?_[h]:(l=h.match(/^#x([\da-fA-F]+)$/))?String.fromCharCode(parseInt(l[1],16)):(l=h.match(/^#(\d+)$/))?String.fromCharCode(~~l[1]):p});L.insertAdjacentText("afterbegin",J(O));let M=()=>{if((p=>p.scrollWidth>p.offsetWidth)(u)){let p=window.getComputedStyle(u),h=parseInt(p.getPropertyValue("padding-left")),l=u.scrollWidth-h,U=u.querySelectorAll(".token.inserted-sign.inserted"),G=u.querySelectorAll(".token.deleted-sign.deleted"),R=u.querySelectorAll(".token.coord");for(let v of U)v.style.width=`${l}px`;for(let v of G)v.style.width=`${l}px`;for(let v of R)v.style.width=`${l}px`}};Prism.highlightElement(L,!1,M),T=!0}})})},f=n.querySelector("[data-file-path]:last-child .btn-show-hide"),j=!1;f.addEventListener("click",()=>{f.textContent.includes("Show")?f.textContent=f.textContent.replace("Show","Hide"):f.textContent=f.textContent.replace("Hide","Show"),!r&&!j&&(E(y),j=!0)}),r&&E(y)})}).catch(o=>{console.error(o.message)})),a=()=>{i.addEventListener("change",m=>{let o=m.target.value;o!=="default"&&w(o)})},t=e.classList.contains("show")||window.location.hash==`#${e.id}`,c=!1;t&&i.nodeName=="INPUT"?w(i.value):t&&i.nodeName=="SELECT"?a():e.addEventListener("show.bs.collapse",()=>{c||(i.nodeName==="INPUT"?w(i.value):a()),c=!0})}})()}});I()})();})();