@danielx/civet 0.6.41 → 0.6.43

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.
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,31 +15,14 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var ts_diagnostic_exports = {};
30
20
  __export(ts_diagnostic_exports, {
31
- convertDiagnostic: () => convertDiagnostic,
32
21
  flattenDiagnosticMessageText: () => flattenDiagnosticMessageText,
33
- rangeFromTextSpan: () => rangeFromTextSpan,
34
22
  remapPosition: () => remapPosition,
35
23
  remapRange: () => remapRange
36
24
  });
37
25
  module.exports = __toCommonJS(ts_diagnostic_exports);
38
- var import_vscode_languageserver = __toESM(require("vscode-languageserver"));
39
- var import_vscode_languageserver_textdocument = require("vscode-languageserver-textdocument");
40
- let DiagnosticCategory = {};
41
- DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
42
- DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
43
- DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion";
44
- DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message";
45
26
  function remapPosition(position, sourcemapLines) {
46
27
  if (!sourcemapLines)
47
28
  return position;
@@ -102,51 +83,9 @@ function flattenDiagnosticMessageText(diag, indent = 0) {
102
83
  }
103
84
  return result;
104
85
  }
105
- function rangeFromTextSpan(span, document) {
106
- return {
107
- start: document.positionAt(span.start),
108
- end: document.positionAt(span.start + span.length)
109
- };
110
- }
111
- function convertDiagnostic(diagnostic, document, sourcemapLines) {
112
- return {
113
- message: flattenDiagnosticMessageText(diagnostic.messageText),
114
- range: remapRange(
115
- rangeFromTextSpan(
116
- {
117
- start: diagnostic.start || 0,
118
- length: diagnostic.length ?? 1
119
- },
120
- document
121
- ),
122
- sourcemapLines
123
- ),
124
- severity: diagnosticCategoryToSeverity(diagnostic.category),
125
- code: diagnostic.code,
126
- source: diagnostic.source || "typescript"
127
- };
128
- }
129
- function diagnosticCategoryToSeverity(category) {
130
- switch (category) {
131
- case DiagnosticCategory.Warning: {
132
- return import_vscode_languageserver.DiagnosticSeverity.Warning;
133
- }
134
- case DiagnosticCategory.Error: {
135
- return import_vscode_languageserver.DiagnosticSeverity.Error;
136
- }
137
- case DiagnosticCategory.Suggestion: {
138
- return import_vscode_languageserver.DiagnosticSeverity.Hint;
139
- }
140
- case DiagnosticCategory.Message: {
141
- return import_vscode_languageserver.DiagnosticSeverity.Information;
142
- }
143
- }
144
- }
145
86
  // Annotate the CommonJS export names for ESM import in node:
146
87
  0 && (module.exports = {
147
- convertDiagnostic,
148
88
  flattenDiagnosticMessageText,
149
- rangeFromTextSpan,
150
89
  remapPosition,
151
90
  remapRange
152
91
  });
@@ -1,10 +1,3 @@
1
- let DiagnosticCategory = {};
2
- DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
3
- DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
4
- DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion";
5
- DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message";
6
- import vs, { DiagnosticSeverity, Position, Range } from "vscode-languageserver";
7
- import { TextDocument } from "vscode-languageserver-textdocument";
8
1
  function remapPosition(position, sourcemapLines) {
9
2
  if (!sourcemapLines)
10
3
  return position;
@@ -65,50 +58,8 @@ function flattenDiagnosticMessageText(diag, indent = 0) {
65
58
  }
66
59
  return result;
67
60
  }
68
- function rangeFromTextSpan(span, document) {
69
- return {
70
- start: document.positionAt(span.start),
71
- end: document.positionAt(span.start + span.length)
72
- };
73
- }
74
- function convertDiagnostic(diagnostic, document, sourcemapLines) {
75
- return {
76
- message: flattenDiagnosticMessageText(diagnostic.messageText),
77
- range: remapRange(
78
- rangeFromTextSpan(
79
- {
80
- start: diagnostic.start || 0,
81
- length: diagnostic.length ?? 1
82
- },
83
- document
84
- ),
85
- sourcemapLines
86
- ),
87
- severity: diagnosticCategoryToSeverity(diagnostic.category),
88
- code: diagnostic.code,
89
- source: diagnostic.source || "typescript"
90
- };
91
- }
92
- function diagnosticCategoryToSeverity(category) {
93
- switch (category) {
94
- case DiagnosticCategory.Warning: {
95
- return DiagnosticSeverity.Warning;
96
- }
97
- case DiagnosticCategory.Error: {
98
- return DiagnosticSeverity.Error;
99
- }
100
- case DiagnosticCategory.Suggestion: {
101
- return DiagnosticSeverity.Hint;
102
- }
103
- case DiagnosticCategory.Message: {
104
- return DiagnosticSeverity.Information;
105
- }
106
- }
107
- }
108
61
  export {
109
- convertDiagnostic,
110
62
  flattenDiagnosticMessageText,
111
- rangeFromTextSpan,
112
63
  remapPosition,
113
64
  remapRange
114
65
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
3
  "type": "commonjs",
4
- "version": "0.6.41",
4
+ "version": "0.6.43",
5
5
  "description": "CoffeeScript style syntax for TypeScript",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.mjs",
@@ -70,7 +70,7 @@
70
70
  "unplugin": "^1.4.0"
71
71
  },
72
72
  "devDependencies": {
73
- "@danielx/civet": "0.6.40",
73
+ "@danielx/civet": "0.6.42",
74
74
  "@danielx/hera": "^0.8.10",
75
75
  "@types/assert": "^1.5.6",
76
76
  "@types/mocha": "^9.1.1",