stream-monaco 0.0.18 → 0.0.19
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/README.md +62 -1
- package/README.zh-CN.md +67 -1
- package/dist/{index.base-8XcpTBc-.d.cts → index.base-9QTN8hPV.d.cts} +35 -1
- package/dist/{index.base-vwv4Hlby.d.ts → index.base-D0lzInae.d.ts} +35 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/index.legacy.cjs +11 -11
- package/dist/index.legacy.d.cts +2 -2
- package/dist/index.legacy.d.ts +2 -2
- package/dist/index.legacy.js +21 -21
- package/dist/{preloadMonacoWorkers.shared-BNWvrH2U.cjs → preloadMonacoWorkers.shared-DMvZ1HUs.cjs} +1155 -23
- package/dist/{preloadMonacoWorkers.shared-CieE-OSf.js → preloadMonacoWorkers.shared-DQ17-Bwz.js} +1156 -24
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
# stream-monaco
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/stream-monaco)
|
|
4
4
|
[](README.zh-CN.md)
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
[](https://bundlephobia.com/package/stream-monaco)
|
|
7
7
|
[](./LICENSE)
|
|
8
8
|
|
|
9
|
+
Streaming Monaco Editor integration with Shiki syntax highlighting. Framework-agnostic core for Vue, React, Svelte, Solid, Preact, and Vanilla JS.
|
|
10
|
+
|
|
9
11
|
### Introduction
|
|
10
12
|
|
|
11
13
|
stream-monaco provides a framework-agnostic core for integrating Monaco Editor with Shiki syntax highlighting, optimized for streaming updates and efficient highlighting. It works great without Vue, while also offering a Vue-friendly API and examples.
|
|
@@ -362,6 +364,10 @@ const {
|
|
|
362
364
|
languages: ['javascript', 'typescript'],
|
|
363
365
|
readOnly: true,
|
|
364
366
|
MAX_HEIGHT: 500,
|
|
367
|
+
// Collapse long unchanged regions automatically.
|
|
368
|
+
diffHideUnchangedRegions: true,
|
|
369
|
+
// Hover a changed hunk to show split upper/lower Revert/Stage actions.
|
|
370
|
+
diffHunkActionsOnHover: true,
|
|
365
371
|
})
|
|
366
372
|
|
|
367
373
|
const original = `export function add(a: number, b: number) {\n return a + b\n}`
|
|
@@ -378,6 +384,61 @@ onMounted(async () => {
|
|
|
378
384
|
</template>
|
|
379
385
|
```
|
|
380
386
|
|
|
387
|
+
Diff UX options:
|
|
388
|
+
|
|
389
|
+
- `diffHideUnchangedRegions` (default `true`): fold unchanged ranges (can pass Monaco `hideUnchangedRegions` object).
|
|
390
|
+
- `diffHunkActionsOnHover` (default `false`): explicitly set `true` to enable split upper/lower `Revert` and `Stage` on hunk hover.
|
|
391
|
+
- `onDiffHunkAction(context)` (optional): return `false` to intercept and skip built-in model edits.
|
|
392
|
+
|
|
393
|
+
Example 1: enable unchanged folding + hover Revert/Stage
|
|
394
|
+
|
|
395
|
+
```ts
|
|
396
|
+
const { createDiffEditor } = useMonaco({
|
|
397
|
+
themes: ['vitesse-dark', 'vitesse-light'],
|
|
398
|
+
languages: ['typescript'],
|
|
399
|
+
readOnly: true,
|
|
400
|
+
diffHideUnchangedRegions: {
|
|
401
|
+
enabled: true,
|
|
402
|
+
contextLineCount: 2,
|
|
403
|
+
minimumLineCount: 4,
|
|
404
|
+
revealLineCount: 2,
|
|
405
|
+
},
|
|
406
|
+
diffHunkActionsOnHover: true,
|
|
407
|
+
})
|
|
408
|
+
|
|
409
|
+
await createDiffEditor(container, original, modified, 'typescript')
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Example 2: fully intercept Revert/Stage and handle your own stash/patch flow
|
|
413
|
+
|
|
414
|
+
```ts
|
|
415
|
+
useMonaco({
|
|
416
|
+
diffHideUnchangedRegions: true,
|
|
417
|
+
diffHunkActionsOnHover: true,
|
|
418
|
+
onDiffHunkAction: async (ctx) => {
|
|
419
|
+
const {
|
|
420
|
+
action, // 'revert' | 'stage'
|
|
421
|
+
side, // 'upper' | 'lower'
|
|
422
|
+
lineChange,
|
|
423
|
+
originalModel,
|
|
424
|
+
modifiedModel,
|
|
425
|
+
} = ctx
|
|
426
|
+
|
|
427
|
+
await saveHunkAction({
|
|
428
|
+
action,
|
|
429
|
+
side,
|
|
430
|
+
range: lineChange,
|
|
431
|
+
original: originalModel.getValue(),
|
|
432
|
+
modified: modifiedModel.getValue(),
|
|
433
|
+
})
|
|
434
|
+
|
|
435
|
+
// false => skip built-in edit, fully controlled by user code
|
|
436
|
+
// true/undefined => continue built-in edit
|
|
437
|
+
return false
|
|
438
|
+
},
|
|
439
|
+
})
|
|
440
|
+
```
|
|
441
|
+
|
|
381
442
|
### Shiki highlighter (advanced)
|
|
382
443
|
|
|
383
444
|
If you also render Shiki snippets outside Monaco:
|
package/README.zh-CN.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
# stream-monaco
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/stream-monaco)
|
|
4
4
|
[](README.md)
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
[](https://bundlephobia.com/package/stream-monaco)
|
|
7
7
|
[](./LICENSE)
|
|
8
8
|
|
|
9
|
+
流式更新版 Monaco Editor + Shiki 语法高亮,提供框架无关内核,适配 Vue、React、Svelte、Solid、Preact 与 Vanilla JS。
|
|
10
|
+
|
|
9
11
|
### 项目简介
|
|
10
12
|
|
|
11
13
|
`stream-monaco` 提供一个与框架无关的内核来集成 Monaco 编辑器与 Shiki 语法高亮,针对流式更新与高效高亮做了优化;可在无 Vue 的环境下使用,同时也提供对 Vue 3 的友好支持与示例。
|
|
@@ -378,6 +380,10 @@ const {
|
|
|
378
380
|
languages: ['javascript', 'typescript'],
|
|
379
381
|
readOnly: true,
|
|
380
382
|
MAX_HEIGHT: 500,
|
|
383
|
+
// 自动折叠大段未改动区域
|
|
384
|
+
diffHideUnchangedRegions: true,
|
|
385
|
+
// hover 变更块时显示上下分区的局部 Revert / Stage 操作
|
|
386
|
+
diffHunkActionsOnHover: true,
|
|
381
387
|
})
|
|
382
388
|
|
|
383
389
|
const original = `export function add(a: number, b: number) {\n return a + b\n}`
|
|
@@ -390,6 +396,62 @@ onMounted(async () => {
|
|
|
390
396
|
})
|
|
391
397
|
```
|
|
392
398
|
|
|
399
|
+
Diff 体验增强相关配置:
|
|
400
|
+
|
|
401
|
+
- `diffHideUnchangedRegions`(默认 `true`):折叠未改动区块;也支持直接传 Monaco 的 `hideUnchangedRegions` 对象。
|
|
402
|
+
- `diffHunkActionsOnHover`(默认 `false`):仅在显式传 `true` 时,hover 变更 hunk 才会显示上下分区的 `Revert` / `Stage`。
|
|
403
|
+
- `onDiffHunkAction(context)`(可选):返回 `false` 可拦截并跳过内置模型编辑逻辑。
|
|
404
|
+
|
|
405
|
+
示例 1:开启 hidden 区折叠 + hover Revert/Stage(可理解为局部回退与暂存)
|
|
406
|
+
|
|
407
|
+
```ts
|
|
408
|
+
const { createDiffEditor } = useMonaco({
|
|
409
|
+
themes: ['vitesse-dark', 'vitesse-light'],
|
|
410
|
+
languages: ['typescript'],
|
|
411
|
+
readOnly: true,
|
|
412
|
+
diffHideUnchangedRegions: {
|
|
413
|
+
enabled: true,
|
|
414
|
+
contextLineCount: 2,
|
|
415
|
+
minimumLineCount: 4,
|
|
416
|
+
revealLineCount: 2,
|
|
417
|
+
},
|
|
418
|
+
diffHunkActionsOnHover: true,
|
|
419
|
+
})
|
|
420
|
+
|
|
421
|
+
await createDiffEditor(container, original, modified, 'typescript')
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
示例 2:完全接管 Revert/Stage 事件(接你自己的 stash / patch API)
|
|
425
|
+
|
|
426
|
+
```ts
|
|
427
|
+
useMonaco({
|
|
428
|
+
diffHideUnchangedRegions: true,
|
|
429
|
+
diffHunkActionsOnHover: true,
|
|
430
|
+
onDiffHunkAction: async (ctx) => {
|
|
431
|
+
const {
|
|
432
|
+
action, // 'revert' | 'stage'
|
|
433
|
+
side, // 'upper' | 'lower'
|
|
434
|
+
lineChange,
|
|
435
|
+
originalModel,
|
|
436
|
+
modifiedModel,
|
|
437
|
+
} = ctx
|
|
438
|
+
|
|
439
|
+
// 这里接你的服务端逻辑,例如提交到 stash / patch 队列
|
|
440
|
+
await saveHunkAction({
|
|
441
|
+
action,
|
|
442
|
+
side,
|
|
443
|
+
range: lineChange,
|
|
444
|
+
original: originalModel.getValue(),
|
|
445
|
+
modified: modifiedModel.getValue(),
|
|
446
|
+
})
|
|
447
|
+
|
|
448
|
+
// 返回 false: 拦截内置编辑(由你完全接管)
|
|
449
|
+
// 返回 true/undefined: 继续执行内置编辑
|
|
450
|
+
return false
|
|
451
|
+
},
|
|
452
|
+
})
|
|
453
|
+
```
|
|
454
|
+
|
|
393
455
|
### Shiki 高亮器(高级说明)
|
|
394
456
|
|
|
395
457
|
如果你在页面上除了 Monaco 编辑器外还使用 Shiki 的 highlighter 单独渲染代码片段(例如静态 HTML 片段),推荐的做法是:
|
|
@@ -641,6 +703,10 @@ modified?.onDidChangeContent?.(() => { /* ... */ })
|
|
|
641
703
|
| `autoScrollThresholdPx` | `number` | `32` | 自动滚动的像素阈值 |
|
|
642
704
|
| `autoScrollThresholdLines` | `number` | `2` | 自动滚动的行数阈值 |
|
|
643
705
|
| `diffAutoScroll` | `boolean` | `true` | 是否启用 Diff modified 侧自动滚动 |
|
|
706
|
+
| `diffHideUnchangedRegions` | `boolean \| object` | `true` | 是否折叠 Diff 中未改动区块(支持传 Monaco 配置对象) |
|
|
707
|
+
| `diffHunkActionsOnHover` | `boolean` | `false` | 是否启用 hover hunk 的上下分区局部 Revert / Stage(需显式开启) |
|
|
708
|
+
| `diffHunkHoverHideDelayMs` | `number` | `160` | hover 操作浮层离开后的隐藏延迟(毫秒) |
|
|
709
|
+
| `onDiffHunkAction` | `function` | - | hunk 操作回调(返回 `false` 可阻止默认编辑) |
|
|
644
710
|
|
|
645
711
|
##### 返回值
|
|
646
712
|
|
|
@@ -45,6 +45,31 @@ interface MonacoOptions extends monaco$1.editor.IStandaloneEditorConstructionOpt
|
|
|
45
45
|
* 默认 true(与单编辑器体验保持一致)。
|
|
46
46
|
*/
|
|
47
47
|
diffAutoScroll?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Controls Monaco's diff unchanged-region folding behavior.
|
|
50
|
+
* - `true`: use stream-monaco defaults (enabled with compact context lines)
|
|
51
|
+
* - `false`: disable unchanged-region folding
|
|
52
|
+
* - object: forward to Monaco `hideUnchangedRegions`
|
|
53
|
+
*
|
|
54
|
+
* Default: `true`
|
|
55
|
+
*/
|
|
56
|
+
diffHideUnchangedRegions?: boolean | NonNullable<monaco$1.editor.IDiffEditorConstructionOptions['hideUnchangedRegions']>;
|
|
57
|
+
/**
|
|
58
|
+
* Enable hover actions for each diff hunk split part (upper/lower):
|
|
59
|
+
* local `revert` and `stage`.
|
|
60
|
+
* Default: `false` (must be explicitly enabled).
|
|
61
|
+
*/
|
|
62
|
+
diffHunkActionsOnHover?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Hide delay (ms) for diff hunk hover action widgets after mouse leaves.
|
|
65
|
+
* Default: `160`.
|
|
66
|
+
*/
|
|
67
|
+
diffHunkHoverHideDelayMs?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Optional interception callback for hunk hover actions.
|
|
70
|
+
* Return `false` to prevent the built-in model edit behavior.
|
|
71
|
+
*/
|
|
72
|
+
onDiffHunkAction?: (context: DiffHunkActionContext) => void | boolean;
|
|
48
73
|
/**
|
|
49
74
|
* Debounce time (ms) to coalesce multiple reveal requests into a single
|
|
50
75
|
* reveal. Useful for streaming/append scenarios. Default: 75
|
|
@@ -105,6 +130,15 @@ declare enum RevealStrategy {
|
|
|
105
130
|
CenterIfOutside = "centerIfOutside",
|
|
106
131
|
Center = "center",
|
|
107
132
|
}
|
|
133
|
+
type DiffHunkActionKind = 'revert' | 'stage';
|
|
134
|
+
type DiffHunkSide = 'upper' | 'lower';
|
|
135
|
+
interface DiffHunkActionContext {
|
|
136
|
+
action: DiffHunkActionKind;
|
|
137
|
+
side: DiffHunkSide;
|
|
138
|
+
lineChange: monaco$1.editor.ILineChange;
|
|
139
|
+
originalModel: monaco$1.editor.ITextModel;
|
|
140
|
+
modifiedModel: monaco$1.editor.ITextModel;
|
|
141
|
+
}
|
|
108
142
|
//#endregion
|
|
109
143
|
//#region src/code.detect.d.ts
|
|
110
144
|
/**
|
|
@@ -286,4 +320,4 @@ declare function useMonaco(monacoOptions?: MonacoOptions): {
|
|
|
286
320
|
} | null;
|
|
287
321
|
};
|
|
288
322
|
//#endregion
|
|
289
|
-
export { MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, registerMonacoThemes, useMonaco };
|
|
323
|
+
export { DiffHunkActionContext, DiffHunkActionKind, DiffHunkSide, MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, registerMonacoThemes, useMonaco };
|
|
@@ -44,6 +44,31 @@ interface MonacoOptions extends monaco$1.editor.IStandaloneEditorConstructionOpt
|
|
|
44
44
|
* 默认 true(与单编辑器体验保持一致)。
|
|
45
45
|
*/
|
|
46
46
|
diffAutoScroll?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Controls Monaco's diff unchanged-region folding behavior.
|
|
49
|
+
* - `true`: use stream-monaco defaults (enabled with compact context lines)
|
|
50
|
+
* - `false`: disable unchanged-region folding
|
|
51
|
+
* - object: forward to Monaco `hideUnchangedRegions`
|
|
52
|
+
*
|
|
53
|
+
* Default: `true`
|
|
54
|
+
*/
|
|
55
|
+
diffHideUnchangedRegions?: boolean | NonNullable<monaco$1.editor.IDiffEditorConstructionOptions['hideUnchangedRegions']>;
|
|
56
|
+
/**
|
|
57
|
+
* Enable hover actions for each diff hunk split part (upper/lower):
|
|
58
|
+
* local `revert` and `stage`.
|
|
59
|
+
* Default: `false` (must be explicitly enabled).
|
|
60
|
+
*/
|
|
61
|
+
diffHunkActionsOnHover?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Hide delay (ms) for diff hunk hover action widgets after mouse leaves.
|
|
64
|
+
* Default: `160`.
|
|
65
|
+
*/
|
|
66
|
+
diffHunkHoverHideDelayMs?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Optional interception callback for hunk hover actions.
|
|
69
|
+
* Return `false` to prevent the built-in model edit behavior.
|
|
70
|
+
*/
|
|
71
|
+
onDiffHunkAction?: (context: DiffHunkActionContext) => void | boolean;
|
|
47
72
|
/**
|
|
48
73
|
* Debounce time (ms) to coalesce multiple reveal requests into a single
|
|
49
74
|
* reveal. Useful for streaming/append scenarios. Default: 75
|
|
@@ -104,6 +129,15 @@ declare enum RevealStrategy {
|
|
|
104
129
|
CenterIfOutside = "centerIfOutside",
|
|
105
130
|
Center = "center",
|
|
106
131
|
}
|
|
132
|
+
type DiffHunkActionKind = 'revert' | 'stage';
|
|
133
|
+
type DiffHunkSide = 'upper' | 'lower';
|
|
134
|
+
interface DiffHunkActionContext {
|
|
135
|
+
action: DiffHunkActionKind;
|
|
136
|
+
side: DiffHunkSide;
|
|
137
|
+
lineChange: monaco$1.editor.ILineChange;
|
|
138
|
+
originalModel: monaco$1.editor.ITextModel;
|
|
139
|
+
modifiedModel: monaco$1.editor.ITextModel;
|
|
140
|
+
}
|
|
107
141
|
//#endregion
|
|
108
142
|
//#region src/code.detect.d.ts
|
|
109
143
|
/**
|
|
@@ -285,4 +319,4 @@ declare function useMonaco(monacoOptions?: MonacoOptions): {
|
|
|
285
319
|
} | null;
|
|
286
320
|
};
|
|
287
321
|
//#endregion
|
|
288
|
-
export { MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, registerMonacoThemes, useMonaco };
|
|
322
|
+
export { DiffHunkActionContext, DiffHunkActionKind, DiffHunkSide, MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, registerMonacoThemes, useMonaco };
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_preloadMonacoWorkers_shared = require('./preloadMonacoWorkers.shared-
|
|
1
|
+
const require_preloadMonacoWorkers_shared = require('./preloadMonacoWorkers.shared-DMvZ1HUs.cjs');
|
|
2
2
|
|
|
3
3
|
//#region src/ensureMonacoWorkers.ts
|
|
4
4
|
function ensureMonacoWorkers() {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, registerMonacoThemes, useMonaco } from "./index.base-
|
|
1
|
+
import { DiffHunkActionContext, DiffHunkActionKind, DiffHunkSide, MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, registerMonacoThemes, useMonaco } from "./index.base-9QTN8hPV.cjs";
|
|
2
2
|
|
|
3
|
-
//#region src/preloadMonacoWorkers.d.ts
|
|
4
|
-
declare function preloadMonacoWorkers(): Promise<void>;
|
|
5
|
-
//#endregion
|
|
6
3
|
//#region src/ensureMonacoWorkers.d.ts
|
|
7
4
|
declare function ensureMonacoWorkers(): void;
|
|
8
5
|
//#endregion
|
|
9
|
-
|
|
6
|
+
//#region src/preloadMonacoWorkers.d.ts
|
|
7
|
+
declare function preloadMonacoWorkers(): Promise<void>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { DiffHunkActionContext, DiffHunkActionKind, DiffHunkSide, MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, ensureMonacoWorkers, getOrCreateHighlighter, preloadMonacoWorkers, registerMonacoThemes, useMonaco };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, registerMonacoThemes, useMonaco } from "./index.base-
|
|
1
|
+
import { DiffHunkActionContext, DiffHunkActionKind, DiffHunkSide, MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, registerMonacoThemes, useMonaco } from "./index.base-D0lzInae.js";
|
|
2
2
|
|
|
3
|
-
//#region src/preloadMonacoWorkers.d.ts
|
|
4
|
-
declare function preloadMonacoWorkers(): Promise<void>;
|
|
5
|
-
//#endregion
|
|
6
3
|
//#region src/ensureMonacoWorkers.d.ts
|
|
7
4
|
declare function ensureMonacoWorkers(): void;
|
|
8
5
|
//#endregion
|
|
9
|
-
|
|
6
|
+
//#region src/preloadMonacoWorkers.d.ts
|
|
7
|
+
declare function preloadMonacoWorkers(): Promise<void>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { DiffHunkActionContext, DiffHunkActionKind, DiffHunkSide, MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, ensureMonacoWorkers, getOrCreateHighlighter, preloadMonacoWorkers, registerMonacoThemes, useMonaco };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RevealStrategy, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, editorWorkerPath, getOrCreateHighlighter, registerMonacoThemes, uniqueWorkerPaths, useMonaco, workerPathByLabel } from "./preloadMonacoWorkers.shared-
|
|
1
|
+
import { RevealStrategy, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, editorWorkerPath, getOrCreateHighlighter, registerMonacoThemes, uniqueWorkerPaths, useMonaco, workerPathByLabel } from "./preloadMonacoWorkers.shared-DQ17-Bwz.js";
|
|
2
2
|
|
|
3
3
|
//#region src/ensureMonacoWorkers.ts
|
|
4
4
|
function ensureMonacoWorkers() {
|
package/dist/index.legacy.cjs
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
const require_preloadMonacoWorkers_shared = require('./preloadMonacoWorkers.shared-
|
|
1
|
+
const require_preloadMonacoWorkers_shared = require('./preloadMonacoWorkers.shared-DMvZ1HUs.cjs');
|
|
2
|
+
const monaco_editor_esm_vs_basic_languages_cpp_cpp = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/cpp/cpp"));
|
|
3
|
+
const monaco_editor_esm_vs_basic_languages_javascript_javascript = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/javascript/javascript"));
|
|
4
|
+
const monaco_editor_esm_vs_basic_languages_powershell_powershell = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/powershell/powershell"));
|
|
5
|
+
const monaco_editor_esm_vs_basic_languages_python_python = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/python/python"));
|
|
6
|
+
const monaco_editor_esm_vs_basic_languages_shell_shell = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/shell/shell"));
|
|
7
|
+
const monaco_editor_esm_vs_basic_languages_typescript_typescript = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/typescript/typescript"));
|
|
8
|
+
require("monaco-editor/esm/vs/editor/contrib/documentSymbols/browser/outlineModel");
|
|
9
|
+
require("monaco-editor/esm/vs/editor/contrib/suggest/browser/suggestMemory");
|
|
2
10
|
require("monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution");
|
|
3
11
|
require("monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution");
|
|
4
12
|
require("monaco-editor/esm/vs/basic-languages/python/python.contribution");
|
|
@@ -9,14 +17,6 @@ require("monaco-editor/esm/vs/language/json/monaco.contribution");
|
|
|
9
17
|
require("monaco-editor/esm/vs/language/typescript/monaco.contribution");
|
|
10
18
|
require("monaco-editor/esm/vs/language/html/monaco.contribution");
|
|
11
19
|
require("monaco-editor/esm/vs/language/css/monaco.contribution");
|
|
12
|
-
require("monaco-editor/esm/vs/editor/contrib/suggest/browser/suggestMemory");
|
|
13
|
-
require("monaco-editor/esm/vs/editor/contrib/documentSymbols/browser/outlineModel");
|
|
14
|
-
const monaco_editor_esm_vs_basic_languages_javascript_javascript = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/javascript/javascript"));
|
|
15
|
-
const monaco_editor_esm_vs_basic_languages_typescript_typescript = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/typescript/typescript"));
|
|
16
|
-
const monaco_editor_esm_vs_basic_languages_python_python = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/python/python"));
|
|
17
|
-
const monaco_editor_esm_vs_basic_languages_cpp_cpp = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/cpp/cpp"));
|
|
18
|
-
const monaco_editor_esm_vs_basic_languages_shell_shell = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/shell/shell"));
|
|
19
|
-
const monaco_editor_esm_vs_basic_languages_powershell_powershell = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/powershell/powershell"));
|
|
20
20
|
|
|
21
21
|
//#region src/ensureMonacoWorkers.legacy.ts
|
|
22
22
|
function normalizeBaseUrl(baseUrl) {
|
|
@@ -36,7 +36,7 @@ function detectMonacoBaseUrlFromScripts() {
|
|
|
36
36
|
for (const script of scripts) {
|
|
37
37
|
const src = script.getAttribute("src") || "";
|
|
38
38
|
if (!src) continue;
|
|
39
|
-
const loaderMatch = src.match(/^(.*)\/vs\/loader\.js
|
|
39
|
+
const loaderMatch = src.match(/^(.*)\/vs\/loader\.js.*$/);
|
|
40
40
|
if (loaderMatch) return normalizeBaseUrl(loaderMatch[1]);
|
|
41
41
|
const vsIndex = src.indexOf("/vs/");
|
|
42
42
|
if (vsIndex > 0) return normalizeBaseUrl(src.slice(0, vsIndex));
|
|
@@ -103,7 +103,7 @@ function ensureMonacoWorkersLegacy(options) {
|
|
|
103
103
|
if (!baseUrl) return;
|
|
104
104
|
const workerUrl = makeWorkerUrl(baseUrl);
|
|
105
105
|
if (!workerUrl) return;
|
|
106
|
-
|
|
106
|
+
globalThis.MonacoEnvironment = { getWorkerUrl() {
|
|
107
107
|
return workerUrl;
|
|
108
108
|
} };
|
|
109
109
|
} catch {}
|
package/dist/index.legacy.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, registerMonacoThemes, useMonaco } from "./index.base-
|
|
1
|
+
import { DiffHunkActionContext, DiffHunkActionKind, DiffHunkSide, MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, registerMonacoThemes, useMonaco } from "./index.base-9QTN8hPV.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/ensureMonacoWorkers.legacy.d.ts
|
|
4
4
|
declare function ensureMonacoWorkersLegacy(options?: {
|
|
@@ -8,4 +8,4 @@ declare function ensureMonacoWorkersLegacy(options?: {
|
|
|
8
8
|
//#region src/preloadMonacoWorkers.legacy.d.ts
|
|
9
9
|
declare function preloadMonacoWorkers(): Promise<void>;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, ensureMonacoWorkersLegacy, getOrCreateHighlighter, preloadMonacoWorkers, registerMonacoThemes, useMonaco };
|
|
11
|
+
export { DiffHunkActionContext, DiffHunkActionKind, DiffHunkSide, MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, ensureMonacoWorkersLegacy, getOrCreateHighlighter, preloadMonacoWorkers, registerMonacoThemes, useMonaco };
|
package/dist/index.legacy.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, registerMonacoThemes, useMonaco } from "./index.base-
|
|
1
|
+
import { DiffHunkActionContext, DiffHunkActionKind, DiffHunkSide, MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, registerMonacoThemes, useMonaco } from "./index.base-D0lzInae.js";
|
|
2
2
|
import "monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution";
|
|
3
3
|
import "monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution";
|
|
4
4
|
import "monaco-editor/esm/vs/basic-languages/python/python.contribution";
|
|
@@ -18,4 +18,4 @@ declare function ensureMonacoWorkersLegacy(options?: {
|
|
|
18
18
|
//#region src/preloadMonacoWorkers.legacy.d.ts
|
|
19
19
|
declare function preloadMonacoWorkers(): Promise<void>;
|
|
20
20
|
//#endregion
|
|
21
|
-
export { MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, ensureMonacoWorkersLegacy, getOrCreateHighlighter, preloadMonacoWorkers, registerMonacoThemes, useMonaco };
|
|
21
|
+
export { DiffHunkActionContext, DiffHunkActionKind, DiffHunkSide, MonacoDiffEditorInstance, MonacoEditorInstance, MonacoLanguage, MonacoOptions, MonacoTheme, RevealStrategy, ShikiHighlighter, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, ensureMonacoWorkersLegacy, getOrCreateHighlighter, preloadMonacoWorkers, registerMonacoThemes, useMonaco };
|
package/dist/index.legacy.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import { RevealStrategy, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, monaco_shim_exports, processedLanguage, registerMonacoThemes, useMonaco, workerPathByLabel } from "./preloadMonacoWorkers.shared-
|
|
1
|
+
import { RevealStrategy, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, monaco_shim_exports, processedLanguage, registerMonacoThemes, useMonaco, workerPathByLabel } from "./preloadMonacoWorkers.shared-DQ17-Bwz.js";
|
|
2
|
+
import { conf, language } from "monaco-editor/esm/vs/basic-languages/cpp/cpp";
|
|
3
|
+
import { conf as conf$1, language as language$1 } from "monaco-editor/esm/vs/basic-languages/javascript/javascript";
|
|
4
|
+
import { conf as conf$2, language as language$2 } from "monaco-editor/esm/vs/basic-languages/powershell/powershell";
|
|
5
|
+
import { conf as conf$3, language as language$3 } from "monaco-editor/esm/vs/basic-languages/python/python";
|
|
6
|
+
import { conf as conf$4, language as language$4 } from "monaco-editor/esm/vs/basic-languages/shell/shell";
|
|
7
|
+
import { conf as conf$5, language as language$5 } from "monaco-editor/esm/vs/basic-languages/typescript/typescript";
|
|
8
|
+
import "monaco-editor/esm/vs/editor/contrib/documentSymbols/browser/outlineModel";
|
|
9
|
+
import "monaco-editor/esm/vs/editor/contrib/suggest/browser/suggestMemory";
|
|
2
10
|
import "monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution";
|
|
3
11
|
import "monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution";
|
|
4
12
|
import "monaco-editor/esm/vs/basic-languages/python/python.contribution";
|
|
@@ -9,14 +17,6 @@ import "monaco-editor/esm/vs/language/json/monaco.contribution";
|
|
|
9
17
|
import "monaco-editor/esm/vs/language/typescript/monaco.contribution";
|
|
10
18
|
import "monaco-editor/esm/vs/language/html/monaco.contribution";
|
|
11
19
|
import "monaco-editor/esm/vs/language/css/monaco.contribution";
|
|
12
|
-
import "monaco-editor/esm/vs/editor/contrib/suggest/browser/suggestMemory";
|
|
13
|
-
import "monaco-editor/esm/vs/editor/contrib/documentSymbols/browser/outlineModel";
|
|
14
|
-
import { conf, language } from "monaco-editor/esm/vs/basic-languages/javascript/javascript";
|
|
15
|
-
import { conf as conf$1, language as language$1 } from "monaco-editor/esm/vs/basic-languages/typescript/typescript";
|
|
16
|
-
import { conf as conf$2, language as language$2 } from "monaco-editor/esm/vs/basic-languages/python/python";
|
|
17
|
-
import { conf as conf$3, language as language$3 } from "monaco-editor/esm/vs/basic-languages/cpp/cpp";
|
|
18
|
-
import { conf as conf$4, language as language$4 } from "monaco-editor/esm/vs/basic-languages/shell/shell";
|
|
19
|
-
import { conf as conf$5, language as language$5 } from "monaco-editor/esm/vs/basic-languages/powershell/powershell";
|
|
20
20
|
|
|
21
21
|
//#region src/ensureMonacoWorkers.legacy.ts
|
|
22
22
|
function normalizeBaseUrl(baseUrl) {
|
|
@@ -36,7 +36,7 @@ function detectMonacoBaseUrlFromScripts() {
|
|
|
36
36
|
for (const script of scripts) {
|
|
37
37
|
const src = script.getAttribute("src") || "";
|
|
38
38
|
if (!src) continue;
|
|
39
|
-
const loaderMatch = src.match(/^(.*)\/vs\/loader\.js
|
|
39
|
+
const loaderMatch = src.match(/^(.*)\/vs\/loader\.js.*$/);
|
|
40
40
|
if (loaderMatch) return normalizeBaseUrl(loaderMatch[1]);
|
|
41
41
|
const vsIndex = src.indexOf("/vs/");
|
|
42
42
|
if (vsIndex > 0) return normalizeBaseUrl(src.slice(0, vsIndex));
|
|
@@ -103,7 +103,7 @@ function ensureMonacoWorkersLegacy(options) {
|
|
|
103
103
|
if (!baseUrl) return;
|
|
104
104
|
const workerUrl = makeWorkerUrl(baseUrl);
|
|
105
105
|
if (!workerUrl) return;
|
|
106
|
-
|
|
106
|
+
globalThis.MonacoEnvironment = { getWorkerUrl() {
|
|
107
107
|
return workerUrl;
|
|
108
108
|
} };
|
|
109
109
|
} catch {}
|
|
@@ -167,18 +167,18 @@ function ensureLegacyMonacoLanguageContributions() {
|
|
|
167
167
|
const langs = monaco_shim_exports.languages;
|
|
168
168
|
if (typeof (langs === null || langs === void 0 ? void 0 : langs.setMonarchTokensProvider) === "function") {
|
|
169
169
|
var _langs$setLanguageCon, _langs$setLanguageCon2, _langs$setLanguageCon3, _langs$setLanguageCon4, _langs$setLanguageCon5, _langs$setLanguageCon6;
|
|
170
|
-
langs.setMonarchTokensProvider("javascript", language);
|
|
171
|
-
(_langs$setLanguageCon = langs.setLanguageConfiguration) === null || _langs$setLanguageCon === void 0 || _langs$setLanguageCon.call(langs, "javascript", conf);
|
|
172
|
-
langs.setMonarchTokensProvider("typescript", language$
|
|
173
|
-
(_langs$setLanguageCon2 = langs.setLanguageConfiguration) === null || _langs$setLanguageCon2 === void 0 || _langs$setLanguageCon2.call(langs, "typescript", conf$
|
|
174
|
-
langs.setMonarchTokensProvider("python", language$
|
|
175
|
-
(_langs$setLanguageCon3 = langs.setLanguageConfiguration) === null || _langs$setLanguageCon3 === void 0 || _langs$setLanguageCon3.call(langs, "python", conf$
|
|
176
|
-
langs.setMonarchTokensProvider("cpp", language
|
|
177
|
-
(_langs$setLanguageCon4 = langs.setLanguageConfiguration) === null || _langs$setLanguageCon4 === void 0 || _langs$setLanguageCon4.call(langs, "cpp", conf
|
|
170
|
+
langs.setMonarchTokensProvider("javascript", language$1);
|
|
171
|
+
(_langs$setLanguageCon = langs.setLanguageConfiguration) === null || _langs$setLanguageCon === void 0 || _langs$setLanguageCon.call(langs, "javascript", conf$1);
|
|
172
|
+
langs.setMonarchTokensProvider("typescript", language$5);
|
|
173
|
+
(_langs$setLanguageCon2 = langs.setLanguageConfiguration) === null || _langs$setLanguageCon2 === void 0 || _langs$setLanguageCon2.call(langs, "typescript", conf$5);
|
|
174
|
+
langs.setMonarchTokensProvider("python", language$3);
|
|
175
|
+
(_langs$setLanguageCon3 = langs.setLanguageConfiguration) === null || _langs$setLanguageCon3 === void 0 || _langs$setLanguageCon3.call(langs, "python", conf$3);
|
|
176
|
+
langs.setMonarchTokensProvider("cpp", language);
|
|
177
|
+
(_langs$setLanguageCon4 = langs.setLanguageConfiguration) === null || _langs$setLanguageCon4 === void 0 || _langs$setLanguageCon4.call(langs, "cpp", conf);
|
|
178
178
|
langs.setMonarchTokensProvider("shell", language$4);
|
|
179
179
|
(_langs$setLanguageCon5 = langs.setLanguageConfiguration) === null || _langs$setLanguageCon5 === void 0 || _langs$setLanguageCon5.call(langs, "shell", conf$4);
|
|
180
|
-
langs.setMonarchTokensProvider("powershell", language$
|
|
181
|
-
(_langs$setLanguageCon6 = langs.setLanguageConfiguration) === null || _langs$setLanguageCon6 === void 0 || _langs$setLanguageCon6.call(langs, "powershell", conf$
|
|
180
|
+
langs.setMonarchTokensProvider("powershell", language$2);
|
|
181
|
+
(_langs$setLanguageCon6 = langs.setLanguageConfiguration) === null || _langs$setLanguageCon6 === void 0 || _langs$setLanguageCon6.call(langs, "powershell", conf$2);
|
|
182
182
|
}
|
|
183
183
|
} catch {}
|
|
184
184
|
try {
|