@herb-tools/language-server 0.3.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/CHANGELOG.md +3 -0
- package/LICENSE.txt +21 -0
- package/README.md +33 -0
- package/dist/config.js +80 -0
- package/dist/config.js.map +1 -0
- package/dist/diagnostics.js +72 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/document_service.js +30 -0
- package/dist/document_service.js.map +1 -0
- package/dist/herb-language-server +20526 -0
- package/dist/herb-language-server.js +20525 -0
- package/dist/herb-language-server.js.map +1 -0
- package/dist/project.js +18 -0
- package/dist/project.js.map +1 -0
- package/dist/server.js +70 -0
- package/dist/server.js.map +1 -0
- package/dist/service.js +39 -0
- package/dist/service.js.map +1 -0
- package/dist/settings.js +46 -0
- package/dist/settings.js.map +1 -0
- package/dist/types/config.d.ts +26 -0
- package/dist/types/diagnostics.d.ts +15 -0
- package/dist/types/document_service.d.ts +12 -0
- package/dist/types/project.d.ts +8 -0
- package/dist/types/server.d.ts +1 -0
- package/dist/types/service.d.ts +18 -0
- package/dist/types/settings.d.ts +17 -0
- package/dist/types/utils.d.ts +3 -0
- package/dist/utils.js +15 -0
- package/dist/utils.js.map +1 -0
- package/package.json +46 -0
package/dist/project.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Project = void 0;
|
|
4
|
+
const node_wasm_1 = require("@herb-tools/node-wasm");
|
|
5
|
+
class Project {
|
|
6
|
+
constructor(connection, projectPath) {
|
|
7
|
+
this.projectPath = projectPath;
|
|
8
|
+
this.connection = connection;
|
|
9
|
+
}
|
|
10
|
+
async initialize() {
|
|
11
|
+
await node_wasm_1.Herb.load();
|
|
12
|
+
}
|
|
13
|
+
async refresh() {
|
|
14
|
+
// TODO
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.Project = Project;
|
|
18
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":";;;AAAA,qDAA4C;AAG5C,MAAa,OAAO;IAIlB,YAAY,UAAsB,EAAE,WAAmB;QACrD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,gBAAI,CAAC,IAAI,EAAE,CAAA;IACnB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,OAAO;IACT,CAAC;CACF;AAhBD,0BAgBC"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const node_1 = require("vscode-languageserver/node");
|
|
4
|
+
const service_1 = require("./service");
|
|
5
|
+
let service;
|
|
6
|
+
const connection = (0, node_1.createConnection)(node_1.ProposedFeatures.all);
|
|
7
|
+
connection.onInitialize(async (params) => {
|
|
8
|
+
service = new service_1.Service(connection, params);
|
|
9
|
+
await service.init();
|
|
10
|
+
const result = {
|
|
11
|
+
capabilities: {
|
|
12
|
+
textDocumentSync: node_1.TextDocumentSyncKind.Incremental,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
if (service.settings.hasWorkspaceFolderCapability) {
|
|
16
|
+
result.capabilities.workspace = {
|
|
17
|
+
workspaceFolders: {
|
|
18
|
+
supported: true,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
});
|
|
24
|
+
connection.onInitialized(() => {
|
|
25
|
+
if (service.settings.hasConfigurationCapability) {
|
|
26
|
+
// Register for all configuration changes.
|
|
27
|
+
connection.client.register(node_1.DidChangeConfigurationNotification.type, undefined);
|
|
28
|
+
}
|
|
29
|
+
if (service.settings.hasWorkspaceFolderCapability) {
|
|
30
|
+
connection.workspace.onDidChangeWorkspaceFolders((_event) => {
|
|
31
|
+
connection.console.log("Workspace folder change event received.");
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
connection.client.register(node_1.DidChangeWatchedFilesNotification.type, {
|
|
35
|
+
watchers: [
|
|
36
|
+
{ globPattern: `**/**/*.html.erb` },
|
|
37
|
+
{ globPattern: `**/**/.herb-lsp/config.json` },
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
connection.onDidChangeConfiguration((change) => {
|
|
42
|
+
if (service.settings.hasConfigurationCapability) {
|
|
43
|
+
// Reset all cached document settings
|
|
44
|
+
service.settings.documentSettings.clear();
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
service.settings.globalSettings = ((change.settings.languageServerHerb || service.settings.defaultSettings));
|
|
48
|
+
}
|
|
49
|
+
service.refresh();
|
|
50
|
+
});
|
|
51
|
+
connection.onDidOpenTextDocument((params) => {
|
|
52
|
+
console.error(params);
|
|
53
|
+
const document = service.documentService.get(params.textDocument.uri);
|
|
54
|
+
if (document) {
|
|
55
|
+
service.diagnostics.refreshDocument(document);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
connection.onDidChangeWatchedFiles((params) => {
|
|
59
|
+
params.changes.forEach(async (event) => {
|
|
60
|
+
if (event.uri.endsWith("/.herb-lsp/config.json")) {
|
|
61
|
+
await service.refreshConfig();
|
|
62
|
+
service.documentService.getAll().forEach((document) => {
|
|
63
|
+
service.diagnostics.refreshDocument(document);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
// Listen on the connection
|
|
69
|
+
connection.listen();
|
|
70
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;AAAA,qDAQmC;AAEnC,uCAAmC;AAGnC,IAAI,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;AACJ,CAAC,CAAC,CAAA;AAEF,2BAA2B;AAC3B,UAAU,CAAC,MAAM,EAAE,CAAA"}
|
package/dist/service.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Service = void 0;
|
|
4
|
+
const settings_1 = require("./settings");
|
|
5
|
+
const document_service_1 = require("./document_service");
|
|
6
|
+
const diagnostics_1 = require("./diagnostics");
|
|
7
|
+
const config_1 = require("./config");
|
|
8
|
+
const project_1 = require("./project");
|
|
9
|
+
class Service {
|
|
10
|
+
constructor(connection, params) {
|
|
11
|
+
this.connection = connection;
|
|
12
|
+
this.settings = new settings_1.Settings(params, this.connection);
|
|
13
|
+
this.documentService = new document_service_1.DocumentService(this.connection);
|
|
14
|
+
this.project = new project_1.Project(connection, this.settings.projectPath.replace("file://", ""));
|
|
15
|
+
this.diagnostics = new diagnostics_1.Diagnostics(this.connection, this.documentService);
|
|
16
|
+
}
|
|
17
|
+
async init() {
|
|
18
|
+
await this.project.initialize();
|
|
19
|
+
this.config = await config_1.Config.fromPathOrNew(this.project.projectPath);
|
|
20
|
+
// Only keep settings for open documents
|
|
21
|
+
this.documentService.onDidClose((change) => {
|
|
22
|
+
this.settings.documentSettings.delete(change.document.uri);
|
|
23
|
+
});
|
|
24
|
+
// The content of a text document has changed. This event is emitted
|
|
25
|
+
// when the text document first opened or when its content has changed.
|
|
26
|
+
this.documentService.onDidChangeContent((change) => {
|
|
27
|
+
this.diagnostics.refreshDocument(change.document);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async refresh() {
|
|
31
|
+
await this.project.refresh();
|
|
32
|
+
this.diagnostics.refreshAllDocuments();
|
|
33
|
+
}
|
|
34
|
+
async refreshConfig() {
|
|
35
|
+
this.config = await config_1.Config.fromPathOrNew(this.project.projectPath);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.Service = Service;
|
|
39
|
+
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CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAA;QAE5B,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE,CAAA;IACxC,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,eAAM,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IACpE,CAAC;CACF;AA1CD,0BA0CC"}
|
package/dist/settings.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Settings = void 0;
|
|
4
|
+
class Settings {
|
|
5
|
+
constructor(params, connection) {
|
|
6
|
+
// The global settings, used when the `workspace/configuration` request is not supported by the client.
|
|
7
|
+
// Please note that this is not the case when using this server with the client provided in this example
|
|
8
|
+
// but could happen with other clients.
|
|
9
|
+
this.defaultSettings = {};
|
|
10
|
+
this.globalSettings = this.defaultSettings;
|
|
11
|
+
this.documentSettings = new Map();
|
|
12
|
+
this.hasConfigurationCapability = false;
|
|
13
|
+
this.hasWorkspaceFolderCapability = false;
|
|
14
|
+
this.hasDiagnosticRelatedInformationCapability = false;
|
|
15
|
+
this.params = params;
|
|
16
|
+
this.capabilities = params.capabilities;
|
|
17
|
+
this.connection = connection;
|
|
18
|
+
// Does the client support the `workspace/configuration` request?
|
|
19
|
+
// If not, we fall back using global settings.
|
|
20
|
+
this.hasConfigurationCapability = !!(this.capabilities.workspace && !!this.capabilities.workspace.configuration);
|
|
21
|
+
this.hasWorkspaceFolderCapability = !!(this.capabilities.workspace && !!this.capabilities.workspace.workspaceFolders);
|
|
22
|
+
this.hasDiagnosticRelatedInformationCapability = !!(this.capabilities.textDocument &&
|
|
23
|
+
this.capabilities.textDocument.publishDiagnostics &&
|
|
24
|
+
this.capabilities.textDocument.publishDiagnostics.relatedInformation);
|
|
25
|
+
}
|
|
26
|
+
get projectPath() {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
return ((_b = (_a = this.params.workspaceFolders) === null || _a === void 0 ? void 0 : _a.at(0)) === null || _b === void 0 ? void 0 : _b.uri) || "";
|
|
29
|
+
}
|
|
30
|
+
getDocumentSettings(resource) {
|
|
31
|
+
if (!this.hasConfigurationCapability) {
|
|
32
|
+
return Promise.resolve(this.globalSettings);
|
|
33
|
+
}
|
|
34
|
+
let result = this.documentSettings.get(resource);
|
|
35
|
+
if (!result) {
|
|
36
|
+
result = this.connection.workspace.getConfiguration({
|
|
37
|
+
scopeUri: resource,
|
|
38
|
+
section: "languageServerHerb",
|
|
39
|
+
});
|
|
40
|
+
this.documentSettings.set(resource, result);
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.Settings = Settings;
|
|
46
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AAIA,MAAa,QAAQ;IAgBnB,YAAY,MAAwB,EAAE,UAAsB;QAf5D,uGAAuG;QACvG,wGAAwG;QACxG,uCAAuC;QACvC,oBAAe,GAAiB,EAAE,CAAA;QAClC,mBAAc,GAAiB,IAAI,CAAC,eAAe,CAAA;QACnD,qBAAgB,GAAwC,IAAI,GAAG,EAAE,CAAA;QAEjE,+BAA0B,GAAG,KAAK,CAAA;QAClC,iCAA4B,GAAG,KAAK,CAAA;QACpC,8CAAyC,GAAG,KAAK,CAAA;QAO/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAA;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAE5B,iEAAiE;QACjE,8CAA8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AA1DD,4BA0DC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type HerbConfigOptions = {};
|
|
2
|
+
export type HerbLSPConfig = {
|
|
3
|
+
version: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
updatedAt: string;
|
|
6
|
+
options: HerbConfigOptions;
|
|
7
|
+
};
|
|
8
|
+
export declare class Config {
|
|
9
|
+
static configPath: string;
|
|
10
|
+
readonly path: string;
|
|
11
|
+
config: HerbLSPConfig;
|
|
12
|
+
constructor(projectPath: string, config: HerbLSPConfig);
|
|
13
|
+
get version(): string;
|
|
14
|
+
get createdAt(): Date;
|
|
15
|
+
get updatedAt(): Date;
|
|
16
|
+
get options(): HerbConfigOptions;
|
|
17
|
+
toJSON(): string;
|
|
18
|
+
private updateTimestamp;
|
|
19
|
+
private updateVersion;
|
|
20
|
+
write(): Promise<void>;
|
|
21
|
+
read(): Promise<string>;
|
|
22
|
+
static configPathFromProjectPath(projectPath: string): string;
|
|
23
|
+
static fromPathOrNew(projectPath: string): Promise<Config>;
|
|
24
|
+
static fromPath(projectPath: string): Promise<Config>;
|
|
25
|
+
static newConfig(projectPath: string): Config;
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Connection, Diagnostic, DiagnosticSeverity, Range } from "vscode-languageserver/node";
|
|
2
|
+
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
3
|
+
import { DocumentService } from "./document_service";
|
|
4
|
+
export declare class Diagnostics {
|
|
5
|
+
private readonly connection;
|
|
6
|
+
private readonly documentService;
|
|
7
|
+
private readonly diagnosticsSource;
|
|
8
|
+
private diagnostics;
|
|
9
|
+
constructor(connection: Connection, documentService: DocumentService);
|
|
10
|
+
validate(textDocument: TextDocument): void;
|
|
11
|
+
refreshDocument(document: TextDocument): void;
|
|
12
|
+
refreshAllDocuments(): void;
|
|
13
|
+
pushDiagnostic(message: string, code: string, range: Range, textDocument: TextDocument, data?: {}, severity?: DiagnosticSeverity): Diagnostic;
|
|
14
|
+
private sendDiagnosticsFor;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Connection, TextDocuments } from "vscode-languageserver/node";
|
|
2
|
+
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
3
|
+
export declare class DocumentService {
|
|
4
|
+
documents: TextDocuments<TextDocument>;
|
|
5
|
+
document?: TextDocument;
|
|
6
|
+
constructor(connection: Connection);
|
|
7
|
+
get(uri: string): TextDocument | undefined;
|
|
8
|
+
getAll(): TextDocument[];
|
|
9
|
+
get onDidChangeContent(): import("vscode-languageserver/node").Event<import("vscode-languageserver/node").TextDocumentChangeEvent<TextDocument>>;
|
|
10
|
+
get onDidOpen(): import("vscode-languageserver/node").Event<import("vscode-languageserver/node").TextDocumentChangeEvent<TextDocument>>;
|
|
11
|
+
get onDidClose(): import("vscode-languageserver/node").Event<import("vscode-languageserver/node").TextDocumentChangeEvent<TextDocument>>;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Connection, InitializeParams } from "vscode-languageserver/node";
|
|
2
|
+
import { Settings } from "./settings";
|
|
3
|
+
import { DocumentService } from "./document_service";
|
|
4
|
+
import { Diagnostics } from "./diagnostics";
|
|
5
|
+
import { Config } from "./config";
|
|
6
|
+
import { Project } from "./project";
|
|
7
|
+
export declare class Service {
|
|
8
|
+
connection: Connection;
|
|
9
|
+
settings: Settings;
|
|
10
|
+
diagnostics: Diagnostics;
|
|
11
|
+
documentService: DocumentService;
|
|
12
|
+
project: Project;
|
|
13
|
+
config?: Config;
|
|
14
|
+
constructor(connection: Connection, params: InitializeParams);
|
|
15
|
+
init(): Promise<void>;
|
|
16
|
+
refresh(): Promise<void>;
|
|
17
|
+
refreshConfig(): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ClientCapabilities, Connection, InitializeParams } from "vscode-languageserver/node";
|
|
2
|
+
export interface HerbSettings {
|
|
3
|
+
}
|
|
4
|
+
export declare class Settings {
|
|
5
|
+
defaultSettings: HerbSettings;
|
|
6
|
+
globalSettings: HerbSettings;
|
|
7
|
+
documentSettings: Map<string, Thenable<HerbSettings>>;
|
|
8
|
+
hasConfigurationCapability: boolean;
|
|
9
|
+
hasWorkspaceFolderCapability: boolean;
|
|
10
|
+
hasDiagnosticRelatedInformationCapability: boolean;
|
|
11
|
+
params: InitializeParams;
|
|
12
|
+
capabilities: ClientCapabilities;
|
|
13
|
+
connection: Connection;
|
|
14
|
+
constructor(params: InitializeParams, connection: Connection);
|
|
15
|
+
get projectPath(): string;
|
|
16
|
+
getDocumentSettings(resource: string): Thenable<HerbSettings>;
|
|
17
|
+
}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.camelize = camelize;
|
|
4
|
+
exports.dasherize = dasherize;
|
|
5
|
+
exports.capitalize = capitalize;
|
|
6
|
+
function camelize(value) {
|
|
7
|
+
return value.replace(/(?:[_-])([a-z0-9])/g, (_, char) => char.toUpperCase());
|
|
8
|
+
}
|
|
9
|
+
function dasherize(value) {
|
|
10
|
+
return value.replace(/([A-Z])/g, (_, char) => `-${char.toLowerCase()}`);
|
|
11
|
+
}
|
|
12
|
+
function capitalize(value) {
|
|
13
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAAA,4BAEC;AAED,8BAEC;AAED,gCAEC;AAVD,SAAgB,QAAQ,CAAC,KAAa;IACpC,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;AAC9E,CAAC;AAED,SAAgB,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AACzE,CAAC;AAED,SAAgB,UAAU,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACvD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@herb-tools/language-server",
|
|
3
|
+
"description": "Powerful and seamless HTML-aware ERB parsing and tooling.",
|
|
4
|
+
"version": "0.3.0",
|
|
5
|
+
"author": "Marco Roth",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": "*"
|
|
9
|
+
},
|
|
10
|
+
"bugs": "https://github.com/marcoroth/herb/issues/new?title=Package%20%60@herb-tools/language-server%60:%20",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/marcoroth/herb.git",
|
|
14
|
+
"directory": "javascript/packages/language-server"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://herb-tools.dev",
|
|
17
|
+
"bin": {
|
|
18
|
+
"herb-language-server": "./dist/herb-language-server"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"clean": "rimraf dist",
|
|
22
|
+
"prebuild": "yarn run clean",
|
|
23
|
+
"build": "tsc -b && rollup -c rollup.config.mjs",
|
|
24
|
+
"postbuild": "node scripts/executable.mjs",
|
|
25
|
+
"watch": "tsc -b -w",
|
|
26
|
+
"test": "echo 'TODO'",
|
|
27
|
+
"prepublishOnly": "yarn clean && yarn build && yarn test"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@herb-tools/node-wasm": "0.3.0",
|
|
34
|
+
"dedent": "^1.6.0",
|
|
35
|
+
"typescript": "^5.8.3",
|
|
36
|
+
"vscode-languageserver": "^9.0.1",
|
|
37
|
+
"vscode-languageserver-textdocument": "^1.0.12"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
41
|
+
"@rollup/plugin-typescript": "^12.1.3",
|
|
42
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
43
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
44
|
+
"rimraf": "^6.0.1"
|
|
45
|
+
}
|
|
46
|
+
}
|