stream-monaco 0.0.4 → 0.0.6
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 +7 -26
- package/dist/index.js +7 -26
- 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"));
|
|
@@ -232,37 +231,19 @@ const monaco = monaco_editor;
|
|
|
232
231
|
//#region src/utils/logger.ts
|
|
233
232
|
let seq = 0;
|
|
234
233
|
const DEBUG = (() => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
try {
|
|
238
|
-
const proc = node_process.default;
|
|
239
|
-
if (proc && proc.env && proc.env.NODE_ENV === "production") return false;
|
|
240
|
-
} catch {}
|
|
241
|
-
} catch {}
|
|
242
|
-
return true;
|
|
234
|
+
if (typeof window !== "undefined" && window.__STREAM_MONACO_DEBUG__ !== void 0) return Boolean(window.__STREAM_MONACO_DEBUG__);
|
|
235
|
+
return false;
|
|
243
236
|
})();
|
|
244
237
|
function log(tag, ...args) {
|
|
245
238
|
if (!DEBUG) return;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
console.warn(`${id} [${tag}] @${ts}ms`, ...args);
|
|
251
|
-
} catch (err) {
|
|
252
|
-
try {
|
|
253
|
-
console.warn("[logger] fallback", tag, ...args, err);
|
|
254
|
-
} catch {}
|
|
255
|
-
}
|
|
239
|
+
seq += 1;
|
|
240
|
+
const id = `#${seq}`;
|
|
241
|
+
const ts = typeof performance !== "undefined" && performance.now ? performance.now().toFixed(1) : Date.now();
|
|
242
|
+
console.warn(`${id} [${tag}] @${ts}ms`, ...args);
|
|
256
243
|
}
|
|
257
244
|
function error(tag, ...args) {
|
|
258
245
|
if (!DEBUG) return;
|
|
259
|
-
|
|
260
|
-
console.error(`[${tag}]`, ...args);
|
|
261
|
-
} catch (err) {
|
|
262
|
-
try {
|
|
263
|
-
console.error("[logger] fallback error", tag, ...args, err);
|
|
264
|
-
} catch {}
|
|
265
|
-
}
|
|
246
|
+
console.error(`[${tag}]`, ...args);
|
|
266
247
|
}
|
|
267
248
|
|
|
268
249
|
//#endregion
|
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";
|
|
@@ -204,37 +203,19 @@ const monaco = _monaco;
|
|
|
204
203
|
//#region src/utils/logger.ts
|
|
205
204
|
let seq = 0;
|
|
206
205
|
const DEBUG = (() => {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
try {
|
|
210
|
-
const proc = nodeProcess;
|
|
211
|
-
if (proc && proc.env && proc.env.NODE_ENV === "production") return false;
|
|
212
|
-
} catch {}
|
|
213
|
-
} catch {}
|
|
214
|
-
return true;
|
|
206
|
+
if (typeof window !== "undefined" && window.__STREAM_MONACO_DEBUG__ !== void 0) return Boolean(window.__STREAM_MONACO_DEBUG__);
|
|
207
|
+
return false;
|
|
215
208
|
})();
|
|
216
209
|
function log(tag, ...args) {
|
|
217
210
|
if (!DEBUG) return;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
console.warn(`${id} [${tag}] @${ts}ms`, ...args);
|
|
223
|
-
} catch (err) {
|
|
224
|
-
try {
|
|
225
|
-
console.warn("[logger] fallback", tag, ...args, err);
|
|
226
|
-
} catch {}
|
|
227
|
-
}
|
|
211
|
+
seq += 1;
|
|
212
|
+
const id = `#${seq}`;
|
|
213
|
+
const ts = typeof performance !== "undefined" && performance.now ? performance.now().toFixed(1) : Date.now();
|
|
214
|
+
console.warn(`${id} [${tag}] @${ts}ms`, ...args);
|
|
228
215
|
}
|
|
229
216
|
function error(tag, ...args) {
|
|
230
217
|
if (!DEBUG) return;
|
|
231
|
-
|
|
232
|
-
console.error(`[${tag}]`, ...args);
|
|
233
|
-
} catch (err) {
|
|
234
|
-
try {
|
|
235
|
-
console.error("[logger] fallback error", tag, ...args, err);
|
|
236
|
-
} catch {}
|
|
237
|
-
}
|
|
218
|
+
console.error(`[${tag}]`, ...args);
|
|
238
219
|
}
|
|
239
220
|
|
|
240
221
|
//#endregion
|
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.6",
|
|
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",
|