@kong-ui-public/monaco-editor 0.27.9 → 0.27.10-pr.3655.2dd3bec0d.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.
- package/dist/types/vite-plugin/index.d.ts +1 -1
- package/dist/types/vite-plugin/index.d.ts.map +1 -1
- package/dist/types/vite-plugin/metadata.d.ts +21 -0
- package/dist/types/vite-plugin/metadata.d.ts.map +1 -0
- package/dist/vite-plugin/index.cjs +29 -11
- package/dist/vite-plugin/index.js +25 -8
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
-
import type { EditorFeature, EditorLanguage, NegatedEditorFeature, IFeatureDefinition } from '
|
|
2
|
+
import type { EditorFeature, EditorLanguage, NegatedEditorFeature, IFeatureDefinition } from './metadata';
|
|
3
3
|
import type { BundledLanguage, BundledTheme } from 'shiki';
|
|
4
4
|
type Options = {
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../vite-plugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EACnB,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../vite-plugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAM1D,KAAK,OAAO,GAAG;IACb;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,cAAc,EAAE,CAAA;IAE5B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAAe,CAAC,EAAE,kBAAkB,EAAE,CAAA;IAEtC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,oBAAoB,CAAC,CAAA;IAEtD;;;KAGC;IACD,KAAK,CAAC,EAAE;QACN;;;;;;;;;;UAUE;QACF,KAAK,CAAC,EAAE,eAAe,EAAE,CAAA;QAEzB;;;;;;;;;;WAUG;QACH,MAAM,CAAC,EAAE,YAAY,EAAE,CAAA;KACxB,CAAA;CACF,CAAA;AAyMD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CA8CxD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const usesModernEntryPoints: boolean;
|
|
2
|
+
export declare const features: IFeatureDefinition[], languages: IFeatureDefinition[];
|
|
3
|
+
export declare function monacoSpecifier(entry: string): string;
|
|
4
|
+
/*!----------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6
|
+
* Released under the MIT license
|
|
7
|
+
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
8
|
+
*----------------------------------------------------------------*/
|
|
9
|
+
export interface IWorkerDefinition {
|
|
10
|
+
id: string;
|
|
11
|
+
entry: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IFeatureDefinition {
|
|
14
|
+
label: string;
|
|
15
|
+
entry: string | string[] | undefined;
|
|
16
|
+
worker?: IWorkerDefinition;
|
|
17
|
+
}
|
|
18
|
+
export type EditorLanguage = 'abap' | 'apex' | 'azcli' | 'bat' | 'bicep' | 'cameligo' | 'clojure' | 'coffee' | 'cpp' | 'csharp' | 'csp' | 'css' | 'cypher' | 'dart' | 'dockerfile' | 'ecl' | 'elixir' | 'flow9' | 'freemarker2' | 'fsharp' | 'go' | 'graphql' | 'handlebars' | 'hcl' | 'html' | 'ini' | 'java' | 'javascript' | 'json' | 'julia' | 'kotlin' | 'less' | 'lexon' | 'liquid' | 'lua' | 'm3' | 'markdown' | 'mdx' | 'mips' | 'msdax' | 'mysql' | 'objective-c' | 'pascal' | 'pascaligo' | 'perl' | 'pgsql' | 'php' | 'pla' | 'postiats' | 'powerquery' | 'powershell' | 'protobuf' | 'pug' | 'python' | 'qsharp' | 'r' | 'razor' | 'redis' | 'redshift' | 'restructuredtext' | 'ruby' | 'rust' | 'sb' | 'scala' | 'scheme' | 'scss' | 'shell' | 'solidity' | 'sophia' | 'sparql' | 'sql' | 'st' | 'swift' | 'systemverilog' | 'tcl' | 'twig' | 'typescript' | 'typespec' | 'vb' | 'wgsl' | 'xml' | 'yaml';
|
|
19
|
+
export type EditorFeature = 'anchorSelect' | 'bracketMatching' | 'caretOperations' | 'clipboard' | 'codeAction' | 'codeEditor' | 'codelens' | 'codicon' | 'colorPicker' | 'comment' | 'contextmenu' | 'cursorUndo' | 'diffEditor' | 'diffEditorBreadcrumbs' | 'dnd' | 'documentSymbols' | 'dropOrPasteInto' | 'find' | 'floatingMenu' | 'folding' | 'fontZoom' | 'format' | 'gotoError' | 'gotoLine' | 'gotoSymbol' | 'gpu' | 'hover' | 'indentation' | 'inlayHints' | 'inlineCompletions' | 'inlineProgress' | 'inPlaceReplace' | 'insertFinalNewLine' | 'inspectTokens' | 'iPadShowKeyboard' | 'lineSelection' | 'linesOperations' | 'linkedEditing' | 'links' | 'longLinesHelper' | 'middleScroll' | 'multicursor' | 'parameterHints' | 'placeholderText' | 'quickCommand' | 'quickHelp' | 'quickOutline' | 'readOnlyMessage' | 'referenceSearch' | 'rename' | 'sectionHeaders' | 'semanticTokens' | 'smartSelect' | 'snippet' | 'stickyScroll' | 'suggest' | 'toggleHighContrast' | 'toggleTabFocusMode' | 'tokenization' | 'unicodeHighlighter' | 'unusualLineTerminators' | 'wordHighlighter' | 'wordOperations' | 'wordPartOperations';
|
|
20
|
+
export type NegatedEditorFeature = '!anchorSelect' | '!bracketMatching' | '!caretOperations' | '!clipboard' | '!codeAction' | '!codeEditor' | '!codelens' | '!codicon' | '!colorPicker' | '!comment' | '!contextmenu' | '!cursorUndo' | '!diffEditor' | '!diffEditorBreadcrumbs' | '!dnd' | '!documentSymbols' | '!dropOrPasteInto' | '!find' | '!floatingMenu' | '!folding' | '!fontZoom' | '!format' | '!gotoError' | '!gotoLine' | '!gotoSymbol' | '!gpu' | '!hover' | '!indentation' | '!inlayHints' | '!inlineCompletions' | '!inlineProgress' | '!inPlaceReplace' | '!insertFinalNewLine' | '!inspectTokens' | '!iPadShowKeyboard' | '!lineSelection' | '!linesOperations' | '!linkedEditing' | '!links' | '!longLinesHelper' | '!middleScroll' | '!multicursor' | '!parameterHints' | '!placeholderText' | '!quickCommand' | '!quickHelp' | '!quickOutline' | '!readOnlyMessage' | '!referenceSearch' | '!rename' | '!sectionHeaders' | '!semanticTokens' | '!smartSelect' | '!snippet' | '!stickyScroll' | '!suggest' | '!toggleHighContrast' | '!toggleTabFocusMode' | '!tokenization' | '!unicodeHighlighter' | '!unusualLineTerminators' | '!wordHighlighter' | '!wordOperations' | '!wordPartOperations';
|
|
21
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../vite-plugin/metadata.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,qBAAqB,SAAgD,CAAA;AAClF,eAAO,MAAQ,QAAQ,wBAAE,SAAS,sBAGjC,CAAA;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIrD;AACD;;;;oEAIoE;AAEpE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;IACpC,MA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AAQ,GAAG,kBAAkB,GAAG,eAAe,GAAG,cAAc,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,eAAe,GAAG,YAAY,GAAG,eAAe,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,SAAS,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,cAAc,GAAG,UAAU,GAAG,eAAe,GAAG,UAAU,GAAG,qBAAqB,GAAG,qBAAqB,GAAG,eAAe,GAAG,qBAAqB,GAAG,yBAAyB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,qBAAqB,CAAA"}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
2
|
+
const node_fs = require("node:fs");
|
|
3
|
+
const node_module = require("node:module");
|
|
4
|
+
const node_path = require("node:path");
|
|
3
5
|
const shikiCodegen = require("shiki-codegen");
|
|
4
6
|
const shiki = require("shiki");
|
|
7
|
+
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
8
|
+
const require$1 = node_module.createRequire(typeof __filename === "string" ? __filename : typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href);
|
|
9
|
+
let packageRoot = node_path.dirname(require$1.resolve("monaco-editor"));
|
|
10
|
+
while (!node_fs.existsSync(node_path.join(packageRoot, "package.json"))) {
|
|
11
|
+
const parent = node_path.dirname(packageRoot);
|
|
12
|
+
if (parent === packageRoot) {
|
|
13
|
+
throw new Error("Cannot locate the monaco-editor package");
|
|
14
|
+
}
|
|
15
|
+
packageRoot = parent;
|
|
16
|
+
}
|
|
17
|
+
const manifest = require$1(node_path.join(packageRoot, "package.json"));
|
|
18
|
+
const usesModernEntryPoints = manifest.exports?.["./*"] === "./esm/vs/*.js";
|
|
19
|
+
const { features, languages } = require$1(node_path.join(packageRoot, "esm/metadata.js"));
|
|
20
|
+
function monacoSpecifier(entry) {
|
|
21
|
+
return usesModernEntryPoints ? `monaco-editor/${entry.replace(/^vs\//, "")}` : `monaco-editor/esm/${entry}`;
|
|
22
|
+
}
|
|
5
23
|
const WORKER_ALIASES = {
|
|
6
24
|
javascript: "typescript",
|
|
7
25
|
less: "css",
|
|
@@ -14,11 +32,11 @@ const VIRTUAL_MODULE_SHIKI_ID = "\0virtual:shiki";
|
|
|
14
32
|
function generateImports(entries) {
|
|
15
33
|
const entryArray = Array.isArray(entries) ? entries : [entries];
|
|
16
34
|
return entryArray.map((entry) => {
|
|
17
|
-
if (entry.endsWith("monaco.contribution")) {
|
|
35
|
+
if (entry.endsWith("monaco.contribution") || entry.startsWith("vs/languages/features/") && entry.endsWith("/register")) {
|
|
18
36
|
const lang = entry.split("/").at(-2);
|
|
19
|
-
return `export * as ${lang} from '
|
|
37
|
+
return `export * as ${lang} from '${monacoSpecifier(entry)}'`;
|
|
20
38
|
}
|
|
21
|
-
return `import '
|
|
39
|
+
return `import '${monacoSpecifier(entry)}'`;
|
|
22
40
|
});
|
|
23
41
|
}
|
|
24
42
|
function resolveFeatures(requestedFeatures, allFeatureIds) {
|
|
@@ -35,7 +53,7 @@ function generateWorkerCode(languageIds, languagesDict, customLanguages) {
|
|
|
35
53
|
const importedWorkers = /* @__PURE__ */ new Set();
|
|
36
54
|
const imports = [];
|
|
37
55
|
const workerMapEntries = [];
|
|
38
|
-
imports.push(
|
|
56
|
+
imports.push(`import EditorWorker from '${monacoSpecifier("vs/editor/editor.worker")}?worker'`);
|
|
39
57
|
languageIds.forEach((langId) => {
|
|
40
58
|
const actualLang = WORKER_ALIASES[langId] || langId;
|
|
41
59
|
const lang = languagesDict[actualLang];
|
|
@@ -46,7 +64,7 @@ function generateWorkerCode(languageIds, languagesDict, customLanguages) {
|
|
|
46
64
|
const workerVar = `${actualLang}Worker`;
|
|
47
65
|
if (!importedWorkers.has(workerVar)) {
|
|
48
66
|
imports.push(
|
|
49
|
-
`import ${workerVar} from '
|
|
67
|
+
`import ${workerVar} from '${monacoSpecifier(workerEntry)}?worker'`
|
|
50
68
|
);
|
|
51
69
|
importedWorkers.add(workerVar);
|
|
52
70
|
}
|
|
@@ -76,10 +94,10 @@ function generateWorkerCode(languageIds, languagesDict, customLanguages) {
|
|
|
76
94
|
}
|
|
77
95
|
function buildMonacoModule(options) {
|
|
78
96
|
const languagesDict = Object.fromEntries(
|
|
79
|
-
|
|
97
|
+
languages.map((lang) => [lang.label, lang])
|
|
80
98
|
);
|
|
81
99
|
const featuresDict = Object.fromEntries(
|
|
82
|
-
|
|
100
|
+
features.map((feat) => [feat.label, feat])
|
|
83
101
|
);
|
|
84
102
|
const featuresIds = resolveFeatures(
|
|
85
103
|
options?.features,
|
|
@@ -109,17 +127,17 @@ function buildMonacoModule(options) {
|
|
|
109
127
|
options?.customLanguages
|
|
110
128
|
);
|
|
111
129
|
return [
|
|
112
|
-
|
|
130
|
+
`import * as monaco from '${usesModernEntryPoints ? "monaco-editor/editor" : monacoSpecifier("vs/editor/editor.api")}'`,
|
|
113
131
|
...featureImports,
|
|
114
132
|
...languageImports,
|
|
115
133
|
...customLanguageImports,
|
|
116
134
|
...workerCode,
|
|
117
|
-
|
|
135
|
+
`export * from '${usesModernEntryPoints ? "monaco-editor/editor" : monacoSpecifier("vs/editor/editor.api")}'`,
|
|
118
136
|
"export default monaco"
|
|
119
137
|
].join("\n");
|
|
120
138
|
}
|
|
121
139
|
async function buildShikiModule(options) {
|
|
122
|
-
const languageIds = options?.shiki?.langs || (options?.languages ||
|
|
140
|
+
const languageIds = options?.shiki?.langs || (options?.languages || languages.map((lang) => lang.label)).filter((lang) => lang in shiki.bundledLanguages);
|
|
123
141
|
const { code } = await shikiCodegen.codegen({
|
|
124
142
|
themes: options?.shiki?.themes || ["catppuccin-latte", "material-theme-darker"],
|
|
125
143
|
engine: "javascript",
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
2
4
|
import { codegen } from "shiki-codegen";
|
|
3
5
|
import { bundledLanguages } from "shiki";
|
|
6
|
+
const require$1 = createRequire(typeof __filename === "string" ? __filename : import.meta.url);
|
|
7
|
+
let packageRoot = dirname(require$1.resolve("monaco-editor"));
|
|
8
|
+
while (!existsSync(join(packageRoot, "package.json"))) {
|
|
9
|
+
const parent = dirname(packageRoot);
|
|
10
|
+
if (parent === packageRoot) {
|
|
11
|
+
throw new Error("Cannot locate the monaco-editor package");
|
|
12
|
+
}
|
|
13
|
+
packageRoot = parent;
|
|
14
|
+
}
|
|
15
|
+
const manifest = require$1(join(packageRoot, "package.json"));
|
|
16
|
+
const usesModernEntryPoints = manifest.exports?.["./*"] === "./esm/vs/*.js";
|
|
17
|
+
const { features, languages } = require$1(join(packageRoot, "esm/metadata.js"));
|
|
18
|
+
function monacoSpecifier(entry) {
|
|
19
|
+
return usesModernEntryPoints ? `monaco-editor/${entry.replace(/^vs\//, "")}` : `monaco-editor/esm/${entry}`;
|
|
20
|
+
}
|
|
4
21
|
const WORKER_ALIASES = {
|
|
5
22
|
javascript: "typescript",
|
|
6
23
|
less: "css",
|
|
@@ -13,11 +30,11 @@ const VIRTUAL_MODULE_SHIKI_ID = "\0virtual:shiki";
|
|
|
13
30
|
function generateImports(entries) {
|
|
14
31
|
const entryArray = Array.isArray(entries) ? entries : [entries];
|
|
15
32
|
return entryArray.map((entry) => {
|
|
16
|
-
if (entry.endsWith("monaco.contribution")) {
|
|
33
|
+
if (entry.endsWith("monaco.contribution") || entry.startsWith("vs/languages/features/") && entry.endsWith("/register")) {
|
|
17
34
|
const lang = entry.split("/").at(-2);
|
|
18
|
-
return `export * as ${lang} from '
|
|
35
|
+
return `export * as ${lang} from '${monacoSpecifier(entry)}'`;
|
|
19
36
|
}
|
|
20
|
-
return `import '
|
|
37
|
+
return `import '${monacoSpecifier(entry)}'`;
|
|
21
38
|
});
|
|
22
39
|
}
|
|
23
40
|
function resolveFeatures(requestedFeatures, allFeatureIds) {
|
|
@@ -34,7 +51,7 @@ function generateWorkerCode(languageIds, languagesDict, customLanguages) {
|
|
|
34
51
|
const importedWorkers = /* @__PURE__ */ new Set();
|
|
35
52
|
const imports = [];
|
|
36
53
|
const workerMapEntries = [];
|
|
37
|
-
imports.push(
|
|
54
|
+
imports.push(`import EditorWorker from '${monacoSpecifier("vs/editor/editor.worker")}?worker'`);
|
|
38
55
|
languageIds.forEach((langId) => {
|
|
39
56
|
const actualLang = WORKER_ALIASES[langId] || langId;
|
|
40
57
|
const lang = languagesDict[actualLang];
|
|
@@ -45,7 +62,7 @@ function generateWorkerCode(languageIds, languagesDict, customLanguages) {
|
|
|
45
62
|
const workerVar = `${actualLang}Worker`;
|
|
46
63
|
if (!importedWorkers.has(workerVar)) {
|
|
47
64
|
imports.push(
|
|
48
|
-
`import ${workerVar} from '
|
|
65
|
+
`import ${workerVar} from '${monacoSpecifier(workerEntry)}?worker'`
|
|
49
66
|
);
|
|
50
67
|
importedWorkers.add(workerVar);
|
|
51
68
|
}
|
|
@@ -108,12 +125,12 @@ function buildMonacoModule(options) {
|
|
|
108
125
|
options?.customLanguages
|
|
109
126
|
);
|
|
110
127
|
return [
|
|
111
|
-
|
|
128
|
+
`import * as monaco from '${usesModernEntryPoints ? "monaco-editor/editor" : monacoSpecifier("vs/editor/editor.api")}'`,
|
|
112
129
|
...featureImports,
|
|
113
130
|
...languageImports,
|
|
114
131
|
...customLanguageImports,
|
|
115
132
|
...workerCode,
|
|
116
|
-
|
|
133
|
+
`export * from '${usesModernEntryPoints ? "monaco-editor/editor" : monacoSpecifier("vs/editor/editor.api")}'`,
|
|
117
134
|
"export default monaco"
|
|
118
135
|
].join("\n");
|
|
119
136
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/monaco-editor",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.10-pr.3655.2dd3bec0d.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A kong UI Monaco Editor wrapper for Vue 3 with syntax highlighting powered by Shiki.",
|
|
6
6
|
"main": "./dist/runtime/monaco-editor.umd.js",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@peculiar/x509": "^2.2.0",
|
|
68
68
|
"@shikijs/monaco": "^4.5.0",
|
|
69
69
|
"jsonc-parser": "^3.3.1",
|
|
70
|
-
"monaco-editor": "^0.
|
|
70
|
+
"monaco-editor": "^0.57.0",
|
|
71
71
|
"reflect-metadata": "^0.2.2",
|
|
72
72
|
"shiki": "^4.5.0",
|
|
73
73
|
"vue": "^3.5.43",
|