ocx 1.0.0 → 1.0.1
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/index.js +93 -6
- package/dist/index.js.map +5 -4
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -8709,6 +8709,98 @@ async function fetchFileContent(baseUrl, componentName, filePath) {
|
|
|
8709
8709
|
return response.text();
|
|
8710
8710
|
}
|
|
8711
8711
|
|
|
8712
|
+
// ../../node_modules/.bun/strip-json-comments@5.0.3/node_modules/strip-json-comments/index.js
|
|
8713
|
+
var singleComment = Symbol("singleComment");
|
|
8714
|
+
var multiComment = Symbol("multiComment");
|
|
8715
|
+
var stripWithoutWhitespace = () => "";
|
|
8716
|
+
var stripWithWhitespace = (string, start, end) => string.slice(start, end).replace(/[^ \t\r\n]/g, " ");
|
|
8717
|
+
var isEscaped = (jsonString, quotePosition) => {
|
|
8718
|
+
let index = quotePosition - 1;
|
|
8719
|
+
let backslashCount = 0;
|
|
8720
|
+
while (jsonString[index] === "\\") {
|
|
8721
|
+
index -= 1;
|
|
8722
|
+
backslashCount += 1;
|
|
8723
|
+
}
|
|
8724
|
+
return Boolean(backslashCount % 2);
|
|
8725
|
+
};
|
|
8726
|
+
function stripJsonComments(jsonString, { whitespace = true, trailingCommas = false } = {}) {
|
|
8727
|
+
if (typeof jsonString !== "string") {
|
|
8728
|
+
throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof jsonString}\``);
|
|
8729
|
+
}
|
|
8730
|
+
const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;
|
|
8731
|
+
let isInsideString = false;
|
|
8732
|
+
let isInsideComment = false;
|
|
8733
|
+
let offset = 0;
|
|
8734
|
+
let buffer = "";
|
|
8735
|
+
let result = "";
|
|
8736
|
+
let commaIndex = -1;
|
|
8737
|
+
for (let index = 0;index < jsonString.length; index++) {
|
|
8738
|
+
const currentCharacter = jsonString[index];
|
|
8739
|
+
const nextCharacter = jsonString[index + 1];
|
|
8740
|
+
if (!isInsideComment && currentCharacter === '"') {
|
|
8741
|
+
const escaped = isEscaped(jsonString, index);
|
|
8742
|
+
if (!escaped) {
|
|
8743
|
+
isInsideString = !isInsideString;
|
|
8744
|
+
}
|
|
8745
|
+
}
|
|
8746
|
+
if (isInsideString) {
|
|
8747
|
+
continue;
|
|
8748
|
+
}
|
|
8749
|
+
if (!isInsideComment && currentCharacter + nextCharacter === "//") {
|
|
8750
|
+
buffer += jsonString.slice(offset, index);
|
|
8751
|
+
offset = index;
|
|
8752
|
+
isInsideComment = singleComment;
|
|
8753
|
+
index++;
|
|
8754
|
+
} else if (isInsideComment === singleComment && currentCharacter + nextCharacter === `\r
|
|
8755
|
+
`) {
|
|
8756
|
+
index++;
|
|
8757
|
+
isInsideComment = false;
|
|
8758
|
+
buffer += strip(jsonString, offset, index);
|
|
8759
|
+
offset = index;
|
|
8760
|
+
continue;
|
|
8761
|
+
} else if (isInsideComment === singleComment && currentCharacter === `
|
|
8762
|
+
`) {
|
|
8763
|
+
isInsideComment = false;
|
|
8764
|
+
buffer += strip(jsonString, offset, index);
|
|
8765
|
+
offset = index;
|
|
8766
|
+
} else if (!isInsideComment && currentCharacter + nextCharacter === "/*") {
|
|
8767
|
+
buffer += jsonString.slice(offset, index);
|
|
8768
|
+
offset = index;
|
|
8769
|
+
isInsideComment = multiComment;
|
|
8770
|
+
index++;
|
|
8771
|
+
continue;
|
|
8772
|
+
} else if (isInsideComment === multiComment && currentCharacter + nextCharacter === "*/") {
|
|
8773
|
+
index++;
|
|
8774
|
+
isInsideComment = false;
|
|
8775
|
+
buffer += strip(jsonString, offset, index + 1);
|
|
8776
|
+
offset = index + 1;
|
|
8777
|
+
continue;
|
|
8778
|
+
} else if (trailingCommas && !isInsideComment) {
|
|
8779
|
+
if (commaIndex !== -1) {
|
|
8780
|
+
if (currentCharacter === "}" || currentCharacter === "]") {
|
|
8781
|
+
buffer += jsonString.slice(offset, index);
|
|
8782
|
+
result += strip(buffer, 0, 1) + buffer.slice(1);
|
|
8783
|
+
buffer = "";
|
|
8784
|
+
offset = index;
|
|
8785
|
+
commaIndex = -1;
|
|
8786
|
+
} else if (currentCharacter !== " " && currentCharacter !== "\t" && currentCharacter !== "\r" && currentCharacter !== `
|
|
8787
|
+
`) {
|
|
8788
|
+
buffer += jsonString.slice(offset, index);
|
|
8789
|
+
offset = index;
|
|
8790
|
+
commaIndex = -1;
|
|
8791
|
+
}
|
|
8792
|
+
} else if (currentCharacter === ",") {
|
|
8793
|
+
result += buffer + jsonString.slice(offset, index);
|
|
8794
|
+
buffer = "";
|
|
8795
|
+
offset = index;
|
|
8796
|
+
commaIndex = index;
|
|
8797
|
+
}
|
|
8798
|
+
}
|
|
8799
|
+
}
|
|
8800
|
+
const remaining = isInsideComment === singleComment ? strip(jsonString, offset) : jsonString.slice(offset);
|
|
8801
|
+
return result + buffer + remaining;
|
|
8802
|
+
}
|
|
8803
|
+
|
|
8712
8804
|
// src/registry/opencode-config.ts
|
|
8713
8805
|
async function readOpencodeConfig(cwd) {
|
|
8714
8806
|
const jsonPath = `${cwd}/opencode.json`;
|
|
@@ -8759,11 +8851,6 @@ function applyMcpServers(config, mcpServers) {
|
|
|
8759
8851
|
}
|
|
8760
8852
|
return { config, added, skipped };
|
|
8761
8853
|
}
|
|
8762
|
-
function stripJsonComments(content) {
|
|
8763
|
-
let result = content.replace(/\/\/.*$/gm, "");
|
|
8764
|
-
result = result.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
8765
|
-
return result;
|
|
8766
|
-
}
|
|
8767
8854
|
async function updateOpencodeConfig(cwd, options) {
|
|
8768
8855
|
const existing = await readOpencodeConfig(cwd);
|
|
8769
8856
|
let config;
|
|
@@ -11857,4 +11944,4 @@ main2().catch((err) => {
|
|
|
11857
11944
|
handleError(err);
|
|
11858
11945
|
});
|
|
11859
11946
|
|
|
11860
|
-
//# debugId=
|
|
11947
|
+
//# debugId=B972029F0864960D64756E2164756E21
|