stream-monaco 0.0.5 → 0.0.7
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.cjs +8 -6
- package/dist/index.js +8 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -29,7 +29,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
|
|
30
30
|
//#endregion
|
|
31
31
|
const monaco_editor = __toESM(require("monaco-editor"));
|
|
32
|
-
const node_process = __toESM(require("node:process"));
|
|
33
32
|
const alien_signals = __toESM(require("alien-signals"));
|
|
34
33
|
const __shikijs_monaco = __toESM(require("@shikijs/monaco"));
|
|
35
34
|
const shiki = __toESM(require("shiki"));
|
|
@@ -233,8 +232,6 @@ const monaco = monaco_editor;
|
|
|
233
232
|
let seq = 0;
|
|
234
233
|
const DEBUG = (() => {
|
|
235
234
|
if (typeof window !== "undefined" && window.__STREAM_MONACO_DEBUG__ !== void 0) return Boolean(window.__STREAM_MONACO_DEBUG__);
|
|
236
|
-
const proc = node_process.default;
|
|
237
|
-
if (proc && proc.env && proc.env.NODE_ENV === "production") return false;
|
|
238
235
|
return false;
|
|
239
236
|
})();
|
|
240
237
|
function log(tag, ...args) {
|
|
@@ -1128,11 +1125,12 @@ var DiffEditorManager = class {
|
|
|
1128
1125
|
this.lastKnownOriginalCode = original;
|
|
1129
1126
|
}
|
|
1130
1127
|
let prevM = this.lastKnownModifiedCode;
|
|
1128
|
+
const buffered = this.appendBufferDiff.length > 0 ? this.appendBufferDiff.join("") : "";
|
|
1131
1129
|
if (this.appendBufferDiff.length > 0) try {
|
|
1132
|
-
prevM = m.getValue();
|
|
1130
|
+
prevM = m.getValue() + buffered;
|
|
1133
1131
|
this.lastKnownModifiedCode = prevM;
|
|
1134
1132
|
} catch {
|
|
1135
|
-
prevM = this.lastKnownModifiedCode ?? "";
|
|
1133
|
+
prevM = (this.lastKnownModifiedCode ?? "") + buffered;
|
|
1136
1134
|
}
|
|
1137
1135
|
const prevMLineCount = m.getLineCount();
|
|
1138
1136
|
if (prevM !== modified) {
|
|
@@ -1732,7 +1730,8 @@ var EditorManager = class {
|
|
|
1732
1730
|
}
|
|
1733
1731
|
return;
|
|
1734
1732
|
}
|
|
1735
|
-
const
|
|
1733
|
+
const buffered = this.appendBuffer.length > 0 ? this.appendBuffer.join("") : "";
|
|
1734
|
+
const prevCode = this.appendBuffer.length > 0 ? this.editorView.getValue() + buffered : this.lastKnownCode ?? this.editorView.getValue();
|
|
1736
1735
|
if (prevCode === newCode) return;
|
|
1737
1736
|
if (newCode.startsWith(prevCode) && prevCode.length < newCode.length) {
|
|
1738
1737
|
const suffix = newCode.slice(prevCode.length);
|
|
@@ -1823,6 +1822,9 @@ var EditorManager = class {
|
|
|
1823
1822
|
text,
|
|
1824
1823
|
forceMoveMarkers: true
|
|
1825
1824
|
}]);
|
|
1825
|
+
try {
|
|
1826
|
+
this.lastKnownCode = model.getValue();
|
|
1827
|
+
} catch {}
|
|
1826
1828
|
const newLineCount = model.getLineCount();
|
|
1827
1829
|
if (lastLine !== newLineCount) {
|
|
1828
1830
|
this.cachedLineCount = newLineCount;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __export, __reExport } from "./chunk-CHLpw0oG.js";
|
|
2
2
|
import * as _monaco from "monaco-editor";
|
|
3
|
-
import nodeProcess from "node:process";
|
|
4
3
|
import { computed, effect, signal } from "alien-signals";
|
|
5
4
|
import { shikiToMonaco } from "@shikijs/monaco";
|
|
6
5
|
import { createHighlighter } from "shiki";
|
|
@@ -205,8 +204,6 @@ const monaco = _monaco;
|
|
|
205
204
|
let seq = 0;
|
|
206
205
|
const DEBUG = (() => {
|
|
207
206
|
if (typeof window !== "undefined" && window.__STREAM_MONACO_DEBUG__ !== void 0) return Boolean(window.__STREAM_MONACO_DEBUG__);
|
|
208
|
-
const proc = nodeProcess;
|
|
209
|
-
if (proc && proc.env && proc.env.NODE_ENV === "production") return false;
|
|
210
207
|
return false;
|
|
211
208
|
})();
|
|
212
209
|
function log(tag, ...args) {
|
|
@@ -1100,11 +1097,12 @@ var DiffEditorManager = class {
|
|
|
1100
1097
|
this.lastKnownOriginalCode = original;
|
|
1101
1098
|
}
|
|
1102
1099
|
let prevM = this.lastKnownModifiedCode;
|
|
1100
|
+
const buffered = this.appendBufferDiff.length > 0 ? this.appendBufferDiff.join("") : "";
|
|
1103
1101
|
if (this.appendBufferDiff.length > 0) try {
|
|
1104
|
-
prevM = m.getValue();
|
|
1102
|
+
prevM = m.getValue() + buffered;
|
|
1105
1103
|
this.lastKnownModifiedCode = prevM;
|
|
1106
1104
|
} catch {
|
|
1107
|
-
prevM = this.lastKnownModifiedCode ?? "";
|
|
1105
|
+
prevM = (this.lastKnownModifiedCode ?? "") + buffered;
|
|
1108
1106
|
}
|
|
1109
1107
|
const prevMLineCount = m.getLineCount();
|
|
1110
1108
|
if (prevM !== modified) {
|
|
@@ -1704,7 +1702,8 @@ var EditorManager = class {
|
|
|
1704
1702
|
}
|
|
1705
1703
|
return;
|
|
1706
1704
|
}
|
|
1707
|
-
const
|
|
1705
|
+
const buffered = this.appendBuffer.length > 0 ? this.appendBuffer.join("") : "";
|
|
1706
|
+
const prevCode = this.appendBuffer.length > 0 ? this.editorView.getValue() + buffered : this.lastKnownCode ?? this.editorView.getValue();
|
|
1708
1707
|
if (prevCode === newCode) return;
|
|
1709
1708
|
if (newCode.startsWith(prevCode) && prevCode.length < newCode.length) {
|
|
1710
1709
|
const suffix = newCode.slice(prevCode.length);
|
|
@@ -1795,6 +1794,9 @@ var EditorManager = class {
|
|
|
1795
1794
|
text,
|
|
1796
1795
|
forceMoveMarkers: true
|
|
1797
1796
|
}]);
|
|
1797
|
+
try {
|
|
1798
|
+
this.lastKnownCode = model.getValue();
|
|
1799
|
+
} catch {}
|
|
1798
1800
|
const newLineCount = model.getLineCount();
|
|
1799
1801
|
if (lastLine !== newLineCount) {
|
|
1800
1802
|
this.cachedLineCount = newLineCount;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-monaco",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7",
|
|
5
5
|
"packageManager": "pnpm@10.23.0",
|
|
6
6
|
"description": "A framework-agnostic library for integrating Monaco Editor with Shiki highlighting, optimized for streaming updates.",
|
|
7
7
|
"author": "Simon He",
|