@volar/monaco 1.10.10 → 1.11.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/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './lib/editor';
2
+ export * from './lib/languages';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./editor"), exports);
18
- __exportStar(require("./languages"), exports);
17
+ __exportStar(require("./lib/editor"), exports);
18
+ __exportStar(require("./lib/languages"), exports);
19
19
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "@volar/monaco",
3
- "version": "1.10.10",
4
- "main": "out/index.js",
3
+ "version": "1.11.0",
5
4
  "license": "MIT",
6
5
  "files": [
7
- "*.js",
8
- "*.d.ts",
9
- "out/**/*.js",
10
- "out/**/*.d.ts"
6
+ "**/*.js",
7
+ "**/*.d.ts"
11
8
  ],
12
9
  "repository": {
13
10
  "type": "git",
@@ -15,12 +12,12 @@
15
12
  "directory": "packages/monaco"
16
13
  },
17
14
  "dependencies": {
18
- "@volar/language-service": "1.10.10",
15
+ "@volar/language-service": "1.11.0",
19
16
  "vscode-uri": "^3.0.8"
20
17
  },
21
18
  "devDependencies": {
22
19
  "monaco-editor-core": "latest",
23
20
  "vscode-languageserver-protocol": "^3.17.5"
24
21
  },
25
- "gitHead": "c3f1b9e52b738e5e5340ad1aeb827f7ca51bc573"
22
+ "gitHead": "e3f563cbbf4cc03c058f5df38df0498034e5feb5"
26
23
  }
package/worker.d.ts CHANGED
@@ -1 +1,7 @@
1
- export * from './out/worker';
1
+ import { type TypeScriptLanguageHost, type Config, type ServiceEnvironment, type SharedModules, type LanguageService } from '@volar/language-service';
2
+ import type * as monaco from 'monaco-editor-core';
3
+ import type * as ts from 'typescript/lib/tsserverlibrary';
4
+ export declare function createServiceEnvironment(): ServiceEnvironment;
5
+ export declare function createLanguageHost(getMirrorModels: monaco.worker.IWorkerContext<any>['getMirrorModels'], env: ServiceEnvironment, rootPath: string, compilerOptions?: ts.CompilerOptions): TypeScriptLanguageHost;
6
+ export declare function createLanguageService<T = {}>(modules: SharedModules, env: ServiceEnvironment, config: Config, host: TypeScriptLanguageHost, extraApis?: T): LanguageService & T;
7
+ //# sourceMappingURL=worker.d.ts.map
package/worker.js CHANGED
@@ -1 +1,85 @@
1
- module.exports = require('./out/worker');
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createLanguageService = exports.createLanguageHost = exports.createServiceEnvironment = void 0;
4
+ const language_service_1 = require("@volar/language-service");
5
+ const vscode_uri_1 = require("vscode-uri");
6
+ function createServiceEnvironment() {
7
+ return {
8
+ uriToFileName: uri => vscode_uri_1.URI.parse(uri).fsPath.replace(/\\/g, '/'),
9
+ fileNameToUri: fileName => vscode_uri_1.URI.file(fileName).toString(),
10
+ workspaceUri: vscode_uri_1.URI.file('/'),
11
+ rootUri: vscode_uri_1.URI.file('/'),
12
+ console,
13
+ };
14
+ }
15
+ exports.createServiceEnvironment = createServiceEnvironment;
16
+ function createLanguageHost(getMirrorModels, env, rootPath, compilerOptions = {}) {
17
+ let projectVersion = 0;
18
+ const modelSnapshot = new WeakMap();
19
+ const modelVersions = new Map();
20
+ const host = {
21
+ workspacePath: rootPath,
22
+ rootPath: rootPath,
23
+ getProjectVersion() {
24
+ const models = getMirrorModels();
25
+ if (modelVersions.size === getMirrorModels().length) {
26
+ if (models.every(model => modelVersions.get(model) === model.version)) {
27
+ return projectVersion.toString();
28
+ }
29
+ }
30
+ modelVersions.clear();
31
+ for (const model of getMirrorModels()) {
32
+ modelVersions.set(model, model.version);
33
+ }
34
+ projectVersion++;
35
+ return projectVersion.toString();
36
+ },
37
+ getScriptFileNames() {
38
+ const models = getMirrorModels();
39
+ return models.map(model => env.uriToFileName(model.uri.toString(true)));
40
+ },
41
+ getScriptSnapshot(fileName) {
42
+ const uri = env.fileNameToUri(fileName);
43
+ const model = getMirrorModels().find(model => model.uri.toString(true) === uri);
44
+ if (model) {
45
+ const cache = modelSnapshot.get(model);
46
+ if (cache && cache[0] === model.version) {
47
+ return cache[1];
48
+ }
49
+ const text = model.getValue();
50
+ modelSnapshot.set(model, [model.version, {
51
+ getText: (start, end) => text.substring(start, end),
52
+ getLength: () => text.length,
53
+ getChangeRange: () => undefined,
54
+ }]);
55
+ return modelSnapshot.get(model)?.[1];
56
+ }
57
+ },
58
+ getCompilationSettings() {
59
+ return compilerOptions;
60
+ },
61
+ };
62
+ return host;
63
+ }
64
+ exports.createLanguageHost = createLanguageHost;
65
+ function createLanguageService(modules, env, config, host, extraApis = {}) {
66
+ const languageService = (0, language_service_1.createLanguageService)(modules, env, config, host);
67
+ class InnocentRabbit {
68
+ }
69
+ ;
70
+ for (const api in languageService) {
71
+ const isFunction = typeof languageService[api] === 'function';
72
+ if (isFunction) {
73
+ InnocentRabbit.prototype[api] = languageService[api];
74
+ }
75
+ }
76
+ for (const api in extraApis) {
77
+ const isFunction = typeof extraApis[api] === 'function';
78
+ if (isFunction) {
79
+ InnocentRabbit.prototype[api] = extraApis[api];
80
+ }
81
+ }
82
+ return new InnocentRabbit();
83
+ }
84
+ exports.createLanguageService = createLanguageService;
85
+ //# sourceMappingURL=worker.js.map
package/out/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './editor';
2
- export * from './languages';
3
- //# sourceMappingURL=index.d.ts.map
package/out/worker.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { type TypeScriptLanguageHost, type Config, type ServiceEnvironment, type SharedModules, type LanguageService } from '@volar/language-service';
2
- import type * as monaco from 'monaco-editor-core';
3
- import type * as ts from 'typescript/lib/tsserverlibrary';
4
- export declare function createServiceEnvironment(): ServiceEnvironment;
5
- export declare function createLanguageHost(getMirrorModels: monaco.worker.IWorkerContext<any>['getMirrorModels'], env: ServiceEnvironment, rootPath: string, compilerOptions?: ts.CompilerOptions): TypeScriptLanguageHost;
6
- export declare function createLanguageService<T = {}>(modules: SharedModules, env: ServiceEnvironment, config: Config, host: TypeScriptLanguageHost, extraApis?: T): LanguageService & T;
7
- //# sourceMappingURL=worker.d.ts.map
package/out/worker.js DELETED
@@ -1,85 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLanguageService = exports.createLanguageHost = exports.createServiceEnvironment = void 0;
4
- const language_service_1 = require("@volar/language-service");
5
- const vscode_uri_1 = require("vscode-uri");
6
- function createServiceEnvironment() {
7
- return {
8
- uriToFileName: uri => vscode_uri_1.URI.parse(uri).fsPath.replace(/\\/g, '/'),
9
- fileNameToUri: fileName => vscode_uri_1.URI.file(fileName).toString(),
10
- workspaceUri: vscode_uri_1.URI.file('/'),
11
- rootUri: vscode_uri_1.URI.file('/'),
12
- console,
13
- };
14
- }
15
- exports.createServiceEnvironment = createServiceEnvironment;
16
- function createLanguageHost(getMirrorModels, env, rootPath, compilerOptions = {}) {
17
- let projectVersion = 0;
18
- const modelSnapshot = new WeakMap();
19
- const modelVersions = new Map();
20
- const host = {
21
- workspacePath: rootPath,
22
- rootPath: rootPath,
23
- getProjectVersion() {
24
- const models = getMirrorModels();
25
- if (modelVersions.size === getMirrorModels().length) {
26
- if (models.every(model => modelVersions.get(model) === model.version)) {
27
- return projectVersion.toString();
28
- }
29
- }
30
- modelVersions.clear();
31
- for (const model of getMirrorModels()) {
32
- modelVersions.set(model, model.version);
33
- }
34
- projectVersion++;
35
- return projectVersion.toString();
36
- },
37
- getScriptFileNames() {
38
- const models = getMirrorModels();
39
- return models.map(model => env.uriToFileName(model.uri.toString(true)));
40
- },
41
- getScriptSnapshot(fileName) {
42
- const uri = env.fileNameToUri(fileName);
43
- const model = getMirrorModels().find(model => model.uri.toString(true) === uri);
44
- if (model) {
45
- const cache = modelSnapshot.get(model);
46
- if (cache && cache[0] === model.version) {
47
- return cache[1];
48
- }
49
- const text = model.getValue();
50
- modelSnapshot.set(model, [model.version, {
51
- getText: (start, end) => text.substring(start, end),
52
- getLength: () => text.length,
53
- getChangeRange: () => undefined,
54
- }]);
55
- return modelSnapshot.get(model)?.[1];
56
- }
57
- },
58
- getCompilationSettings() {
59
- return compilerOptions;
60
- },
61
- };
62
- return host;
63
- }
64
- exports.createLanguageHost = createLanguageHost;
65
- function createLanguageService(modules, env, config, host, extraApis = {}) {
66
- const languageService = (0, language_service_1.createLanguageService)(modules, env, config, host);
67
- class InnocentRabbit {
68
- }
69
- ;
70
- for (const api in languageService) {
71
- const isFunction = typeof languageService[api] === 'function';
72
- if (isFunction) {
73
- InnocentRabbit.prototype[api] = languageService[api];
74
- }
75
- }
76
- for (const api in extraApis) {
77
- const isFunction = typeof extraApis[api] === 'function';
78
- if (isFunction) {
79
- InnocentRabbit.prototype[api] = extraApis[api];
80
- }
81
- }
82
- return new InnocentRabbit();
83
- }
84
- exports.createLanguageService = createLanguageService;
85
- //# sourceMappingURL=worker.js.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes