@cedarjs/structure 2.8.1-next.116 → 2.8.1

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.
Files changed (110) hide show
  1. package/README.md +1 -1
  2. package/dist/errors.js +15 -9
  3. package/dist/index.d.ts +7 -7
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +67 -40
  6. package/dist/model/RWCell.d.ts +4 -4
  7. package/dist/model/RWCell.d.ts.map +1 -1
  8. package/dist/model/RWCell.js +103 -111
  9. package/dist/model/RWComponent.d.ts +2 -2
  10. package/dist/model/RWComponent.d.ts.map +1 -1
  11. package/dist/model/RWComponent.js +41 -46
  12. package/dist/model/RWEnvHelper.d.ts +4 -4
  13. package/dist/model/RWEnvHelper.d.ts.map +1 -1
  14. package/dist/model/RWEnvHelper.js +205 -212
  15. package/dist/model/RWFunction.d.ts +2 -2
  16. package/dist/model/RWFunction.d.ts.map +1 -1
  17. package/dist/model/RWFunction.js +15 -10
  18. package/dist/model/RWLayout.d.ts +2 -2
  19. package/dist/model/RWLayout.d.ts.map +1 -1
  20. package/dist/model/RWLayout.js +15 -10
  21. package/dist/model/RWPage.d.ts +3 -3
  22. package/dist/model/RWPage.d.ts.map +1 -1
  23. package/dist/model/RWPage.js +57 -61
  24. package/dist/model/RWProject.d.ts +17 -11
  25. package/dist/model/RWProject.d.ts.map +1 -1
  26. package/dist/model/RWProject.js +164 -218
  27. package/dist/model/RWRoute.d.ts +5 -5
  28. package/dist/model/RWRoute.d.ts.map +1 -1
  29. package/dist/model/RWRoute.js +262 -312
  30. package/dist/model/RWRouter.d.ts +4 -4
  31. package/dist/model/RWRouter.d.ts.map +1 -1
  32. package/dist/model/RWRouter.js +126 -130
  33. package/dist/model/RWSDL.d.ts +5 -5
  34. package/dist/model/RWSDL.d.ts.map +1 -1
  35. package/dist/model/RWSDL.js +84 -96
  36. package/dist/model/RWSDLField.d.ts +6 -6
  37. package/dist/model/RWSDLField.d.ts.map +1 -1
  38. package/dist/model/RWSDLField.js +81 -79
  39. package/dist/model/RWService.d.ts +4 -4
  40. package/dist/model/RWService.d.ts.map +1 -1
  41. package/dist/model/RWService.js +76 -76
  42. package/dist/model/RWServiceFunction.d.ts +4 -4
  43. package/dist/model/RWServiceFunction.d.ts.map +1 -1
  44. package/dist/model/RWServiceFunction.js +97 -95
  45. package/dist/model/RWTOML.d.ts +3 -3
  46. package/dist/model/RWTOML.d.ts.map +1 -1
  47. package/dist/model/RWTOML.js +55 -53
  48. package/dist/model/index.d.ts +2 -2
  49. package/dist/model/index.d.ts.map +1 -1
  50. package/dist/model/index.js +20 -3
  51. package/dist/model/util/process_env.js +62 -44
  52. package/dist/nodes.d.ts +2 -2
  53. package/dist/nodes.d.ts.map +1 -1
  54. package/dist/nodes.js +164 -171
  55. package/dist/util.js +33 -23
  56. package/dist/x/Array.js +25 -15
  57. package/dist/x/Location.d.ts +1 -1
  58. package/dist/x/Location.d.ts.map +1 -1
  59. package/dist/x/Location.js +17 -11
  60. package/dist/x/Position.js +29 -18
  61. package/dist/x/Range.d.ts +1 -1
  62. package/dist/x/Range.d.ts.map +1 -1
  63. package/dist/x/Range.js +22 -17
  64. package/dist/x/URL.js +75 -59
  65. package/dist/x/child_process.d.ts +1 -1
  66. package/dist/x/child_process.d.ts.map +1 -1
  67. package/dist/x/child_process.js +49 -35
  68. package/dist/x/decorators.d.ts +2 -2
  69. package/dist/x/decorators.d.ts.map +1 -1
  70. package/dist/x/decorators.js +26 -46
  71. package/dist/x/diagnostics.d.ts +3 -3
  72. package/dist/x/diagnostics.d.ts.map +1 -1
  73. package/dist/x/diagnostics.js +259 -163
  74. package/dist/x/path.js +55 -36
  75. package/dist/x/prisma.d.ts +2 -2
  76. package/dist/x/prisma.d.ts.map +1 -1
  77. package/dist/x/prisma.js +55 -32
  78. package/dist/x/ts-morph.js +45 -34
  79. package/package.json +17 -38
  80. package/dist/errors.js.map +0 -1
  81. package/dist/index.js.map +0 -1
  82. package/dist/model/RWCell.js.map +0 -1
  83. package/dist/model/RWComponent.js.map +0 -1
  84. package/dist/model/RWEnvHelper.js.map +0 -1
  85. package/dist/model/RWFunction.js.map +0 -1
  86. package/dist/model/RWLayout.js.map +0 -1
  87. package/dist/model/RWPage.js.map +0 -1
  88. package/dist/model/RWProject.js.map +0 -1
  89. package/dist/model/RWRoute.js.map +0 -1
  90. package/dist/model/RWRouter.js.map +0 -1
  91. package/dist/model/RWSDL.js.map +0 -1
  92. package/dist/model/RWSDLField.js.map +0 -1
  93. package/dist/model/RWService.js.map +0 -1
  94. package/dist/model/RWServiceFunction.js.map +0 -1
  95. package/dist/model/RWTOML.js.map +0 -1
  96. package/dist/model/index.js.map +0 -1
  97. package/dist/model/util/process_env.js.map +0 -1
  98. package/dist/nodes.js.map +0 -1
  99. package/dist/util.js.map +0 -1
  100. package/dist/x/Array.js.map +0 -1
  101. package/dist/x/Location.js.map +0 -1
  102. package/dist/x/Position.js.map +0 -1
  103. package/dist/x/Range.js.map +0 -1
  104. package/dist/x/URL.js.map +0 -1
  105. package/dist/x/child_process.js.map +0 -1
  106. package/dist/x/decorators.js.map +0 -1
  107. package/dist/x/diagnostics.js.map +0 -1
  108. package/dist/x/path.js.map +0 -1
  109. package/dist/x/prisma.js.map +0 -1
  110. package/dist/x/ts-morph.js.map +0 -1
@@ -1,51 +1,87 @@
1
- import lc from 'line-column';
2
- import groupBy from 'lodash/groupBy.js';
3
- import mapValues from 'lodash/mapValues.js';
4
- import uniqBy from 'lodash/uniqBy.js';
5
- import * as tsm from 'ts-morph';
6
- import { Location_is } from './Location.js';
7
- import { Position_compare } from './Position.js';
8
- import { Range_create } from './Range.js';
9
- import { URL_file } from './URL.js';
10
- export var DiagnosticSeverity;
11
- (function (DiagnosticSeverity) {
12
- DiagnosticSeverity[DiagnosticSeverity["Error"] = 1] = "Error";
13
- DiagnosticSeverity[DiagnosticSeverity["Warning"] = 2] = "Warning";
14
- DiagnosticSeverity[DiagnosticSeverity["Information"] = 3] = "Information";
15
- DiagnosticSeverity[DiagnosticSeverity["Hint"] = 4] = "Hint";
16
- })(DiagnosticSeverity || (DiagnosticSeverity = {}));
17
- export function Diagnostic_is(value) {
18
- const candidate = value;
19
- return (candidate &&
20
- typeof candidate.message === 'string' &&
21
- typeof candidate.range === 'object' &&
22
- candidate.range.start !== undefined &&
23
- candidate.range.end !== undefined);
24
- }
25
- export function Range_contains(range, pos) {
26
- if (Position_compare(range.start, pos) === 'greater') {
27
- return false;
28
- }
29
- if (Position_compare(range.end, pos) === 'smaller') {
30
- return false;
31
- }
32
- return true;
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+ var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
5
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
6
+ _Object$defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.DiagnosticSeverity = void 0;
10
+ exports.Diagnostic_is = Diagnostic_is;
11
+ exports.ExtendedDiagnostic_format = ExtendedDiagnostic_format;
12
+ exports.ExtendedDiagnostic_groupByUri = ExtendedDiagnostic_groupByUri;
13
+ exports.ExtendedDiagnostic_is = ExtendedDiagnostic_is;
14
+ exports.LocationLike_toHashLink = LocationLike_toHashLink;
15
+ exports.LocationLike_toLocation = LocationLike_toLocation;
16
+ exports.LocationLike_toTerminalLink = LocationLike_toTerminalLink;
17
+ exports.Location_fromFilePath = Location_fromFilePath;
18
+ exports.Location_fromNode = Location_fromNode;
19
+ exports.Location_overlaps = Location_overlaps;
20
+ exports.Position_fromOffset = Position_fromOffset;
21
+ exports.Position_fromOffsetOrFail = Position_fromOffsetOrFail;
22
+ exports.Position_fromTSMorphOffset = Position_fromTSMorphOffset;
23
+ exports.Position_translate = Position_translate;
24
+ exports.Range_contains = Range_contains;
25
+ exports.Range_fromNode = Range_fromNode;
26
+ exports.Range_overlaps = Range_overlaps;
27
+ exports.err = err;
28
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/map"));
29
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/json/stringify"));
30
+ var _endsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/ends-with"));
31
+ var _lineColumn = _interopRequireDefault(require("line-column"));
32
+ var _groupBy = _interopRequireDefault(require("lodash/groupBy.js"));
33
+ var _mapValues = _interopRequireDefault(require("lodash/mapValues.js"));
34
+ var _uniqBy = _interopRequireDefault(require("lodash/uniqBy.js"));
35
+ var tsm = _interopRequireWildcard(require("ts-morph"));
36
+ var _Location = require("./Location");
37
+ var _Position = require("./Position");
38
+ var _Range = require("./Range");
39
+ var _URL = require("./URL");
40
+ let DiagnosticSeverity = exports.DiagnosticSeverity = /*#__PURE__*/function (DiagnosticSeverity) {
41
+ DiagnosticSeverity[DiagnosticSeverity["Error"] = 1] = "Error";
42
+ DiagnosticSeverity[DiagnosticSeverity["Warning"] = 2] = "Warning";
43
+ DiagnosticSeverity[DiagnosticSeverity["Information"] = 3] = "Information";
44
+ DiagnosticSeverity[DiagnosticSeverity["Hint"] = 4] = "Hint";
45
+ return DiagnosticSeverity;
46
+ }({});
47
+ function Diagnostic_is(value) {
48
+ const candidate = value;
49
+ return candidate && typeof candidate.message === 'string' && typeof candidate.range === 'object' && candidate.range.start !== undefined && candidate.range.end !== undefined;
33
50
  }
34
- export function Range_overlaps(range1, range2, consider0000) {
35
- if (consider0000) {
36
- if (Range_is0000(range1) || Range_is0000(range2)) {
37
- return true;
38
- }
39
- }
40
- const { start, end } = range2;
41
- if (Range_contains(range1, start)) {
42
- return true;
43
- }
44
- if (Range_contains(range2, end)) {
45
- return true;
51
+
52
+ /**
53
+ * The Diagnostic interface does not include the document URI.
54
+ * This interface adds that, and a few other things.
55
+ */
56
+
57
+ function Range_contains(range, pos) {
58
+ if ((0, _Position.Position_compare)(range.start, pos) === 'greater') {
59
+ return false;
60
+ }
61
+ if ((0, _Position.Position_compare)(range.end, pos) === 'smaller') {
62
+ return false;
63
+ }
64
+ return true;
65
+ }
66
+ function Range_overlaps(range1, range2, consider0000) {
67
+ if (consider0000) {
68
+ if (Range_is0000(range1) || Range_is0000(range2)) {
69
+ return true;
46
70
  }
71
+ }
72
+ const {
73
+ start,
74
+ end
75
+ } = range2;
76
+ if (Range_contains(range1, start)) {
77
+ return true;
78
+ }
79
+ if (Range_contains(range2, end)) {
47
80
  return true;
81
+ }
82
+ return true;
48
83
  }
84
+
49
85
  /**
50
86
  * Create a new position relative to this position.
51
87
  *
@@ -54,146 +90,201 @@ export function Range_overlaps(range1, range2, consider0000) {
54
90
  * @return A position which line and character is the sum of the current line and
55
91
  * character and the corresponding deltas.
56
92
  */
57
- export function Position_translate(pos, lineDelta = 0, characterDelta = 0) {
58
- return {
59
- line: pos.line + lineDelta,
60
- character: pos.character + characterDelta,
61
- };
93
+ function Position_translate(pos, lineDelta = 0, characterDelta = 0) {
94
+ return {
95
+ line: pos.line + lineDelta,
96
+ character: pos.character + characterDelta
97
+ };
62
98
  }
63
- export function Range_fromNode(node) {
64
- const start = Position_fromTSMorphOffset(node.getStart(false), node.getSourceFile());
65
- const end = Position_fromTSMorphOffset(node.getEnd(), node.getSourceFile());
66
- return { start, end };
99
+ function Range_fromNode(node) {
100
+ const start = Position_fromTSMorphOffset(node.getStart(false), node.getSourceFile());
101
+ const end = Position_fromTSMorphOffset(node.getEnd(), node.getSourceFile());
102
+ return {
103
+ start,
104
+ end
105
+ };
67
106
  }
68
- export function Location_fromNode(node) {
69
- return {
70
- uri: URL_file(node.getSourceFile().getFilePath()),
71
- range: Range_fromNode(node),
72
- };
107
+ function Location_fromNode(node) {
108
+ return {
109
+ uri: (0, _URL.URL_file)(node.getSourceFile().getFilePath()),
110
+ range: Range_fromNode(node)
111
+ };
73
112
  }
74
- export function Location_fromFilePath(filePath) {
75
- return { uri: URL_file(filePath), range: Range_create(0, 0, 0, 0) };
113
+ function Location_fromFilePath(filePath) {
114
+ return {
115
+ uri: (0, _URL.URL_file)(filePath),
116
+ range: (0, _Range.Range_create)(0, 0, 0, 0)
117
+ };
76
118
  }
119
+
77
120
  /**
78
121
  * returns vscode-terminal-friendly (clickable) link with line/column information
79
122
  * ex: "file:///foo.ts:2:3"
80
123
  * @param loc
81
124
  */
82
- export function LocationLike_toTerminalLink(loc) {
83
- const { uri, range: { start: { line, character }, }, } = LocationLike_toLocation(loc);
84
- return `${uri}:${line + 1}:${character + 1}`;
125
+ function LocationLike_toTerminalLink(loc) {
126
+ const {
127
+ uri,
128
+ range: {
129
+ start: {
130
+ line,
131
+ character
132
+ }
133
+ }
134
+ } = LocationLike_toLocation(loc);
135
+ return `${uri}:${line + 1}:${character + 1}`;
85
136
  }
137
+
86
138
  /**
87
139
  * returns vscode-terminal-friendly (clickable) link with line/column information
88
140
  * ex: "file:///foo.ts:2:3"
89
141
  * @param loc
90
142
  */
91
- export function LocationLike_toHashLink(loc) {
92
- const { uri, range: { start: { line, character }, }, } = LocationLike_toLocation(loc);
93
- return `${uri}#${line + 1}:${character + 1}`;
143
+ function LocationLike_toHashLink(loc) {
144
+ const {
145
+ uri,
146
+ range: {
147
+ start: {
148
+ line,
149
+ character
150
+ }
151
+ }
152
+ } = LocationLike_toLocation(loc);
153
+ return `${uri}#${line + 1}:${character + 1}`;
94
154
  }
95
- export function LocationLike_toLocation(x) {
96
- if (typeof x === 'string') {
97
- return { uri: URL_file(x), range: Range_create(0, 0, 0, 0) };
155
+ function LocationLike_toLocation(x) {
156
+ if (typeof x === 'string') {
157
+ return {
158
+ uri: (0, _URL.URL_file)(x),
159
+ range: (0, _Range.Range_create)(0, 0, 0, 0)
160
+ };
161
+ }
162
+ if (typeof x === 'object') {
163
+ if (x instanceof tsm.Node) {
164
+ return Location_fromNode(x);
98
165
  }
99
- if (typeof x === 'object') {
100
- if (x instanceof tsm.Node) {
101
- return Location_fromNode(x);
102
- }
103
- if (Location_is(x)) {
104
- return x;
105
- }
106
- if (ExtendedDiagnostic_is(x)) {
107
- return { uri: x.uri, range: x.diagnostic.range };
108
- }
166
+ if ((0, _Location.Location_is)(x)) {
167
+ return x;
109
168
  }
110
- throw new Error();
111
- }
112
- export function Location_overlaps(loc1, loc2, consider0000 = false) {
113
- if (loc1.uri !== loc2.uri) {
114
- return false;
169
+ if (ExtendedDiagnostic_is(x)) {
170
+ return {
171
+ uri: x.uri,
172
+ range: x.diagnostic.range
173
+ };
115
174
  }
116
- return Range_overlaps(loc1.range, loc2.range, consider0000);
175
+ }
176
+ throw new Error();
177
+ }
178
+ function Location_overlaps(loc1, loc2, consider0000 = false) {
179
+ if (loc1.uri !== loc2.uri) {
180
+ return false;
181
+ }
182
+ return Range_overlaps(loc1.range, loc2.range, consider0000);
117
183
  }
184
+
118
185
  /**
119
186
  * by convention, the range [0,0,0,0] means the complete document
120
187
  * @param range
121
188
  */
122
189
  function Range_is0000(range) {
123
- const { start, end } = range;
124
- return Position_is00(start) && Position_is00(end);
190
+ const {
191
+ start,
192
+ end
193
+ } = range;
194
+ return Position_is00(start) && Position_is00(end);
125
195
  }
126
196
  function Position_is00(pos) {
127
- return pos.character === 0 && pos.line === 0;
197
+ return pos.character === 0 && pos.line === 0;
128
198
  }
129
- export function ExtendedDiagnostic_is(x) {
130
- if (typeof x !== 'object') {
131
- return false;
132
- }
133
- if (typeof x === 'undefined') {
134
- return false;
135
- }
136
- if (typeof x.uri !== 'string') {
137
- return false;
138
- }
139
- if (!Diagnostic_is(x.diagnostic)) {
140
- return false;
141
- }
142
- return true;
199
+ function ExtendedDiagnostic_is(x) {
200
+ if (typeof x !== 'object') {
201
+ return false;
202
+ }
203
+ if (typeof x === 'undefined') {
204
+ return false;
205
+ }
206
+ if (typeof x.uri !== 'string') {
207
+ return false;
208
+ }
209
+ if (!Diagnostic_is(x.diagnostic)) {
210
+ return false;
211
+ }
212
+ return true;
143
213
  }
144
- export function ExtendedDiagnostic_groupByUri(ds) {
145
- const grouped = groupBy(ds, (d) => d.uri);
146
- const dss = mapValues(grouped, (xds) => {
147
- const dd = xds.map((xd) => xd.diagnostic);
148
- return uniqBy(dd, JSON.stringify); // dedupe
149
- });
150
- return dss;
151
- }
152
- export function Position_fromTSMorphOffset(offset, sf) {
153
- const { line, column } = sf.getLineAndColumnAtPos(offset);
154
- return { character: column - 1, line: line - 1 };
155
- }
156
- export function Position_fromOffset(offset, text) {
157
- const res = lc(text).fromIndex(offset);
158
- if (!res) {
159
- return undefined;
160
- }
161
- const { line, col } = res;
162
- return { character: col - 1, line: line - 1 };
214
+ function ExtendedDiagnostic_groupByUri(ds) {
215
+ const grouped = (0, _groupBy.default)(ds, d => d.uri);
216
+ const dss = (0, _mapValues.default)(grouped, xds => {
217
+ const dd = (0, _map.default)(xds).call(xds, xd => xd.diagnostic);
218
+ return (0, _uniqBy.default)(dd, _stringify.default); // dedupe
219
+ });
220
+ return dss;
163
221
  }
164
- export function Position_fromOffsetOrFail(offset, text) {
165
- const p = Position_fromOffset(offset, text);
166
- if (!p) {
167
- throw new Error('Position_fromOffsetOrFail');
168
- }
169
- return p;
222
+ function Position_fromTSMorphOffset(offset, sf) {
223
+ const {
224
+ line,
225
+ column
226
+ } = sf.getLineAndColumnAtPos(offset);
227
+ return {
228
+ character: column - 1,
229
+ line: line - 1
230
+ };
170
231
  }
232
+ function Position_fromOffset(offset, text) {
233
+ const res = (0, _lineColumn.default)(text).fromIndex(offset);
234
+ if (!res) {
235
+ return undefined;
236
+ }
237
+ const {
238
+ line,
239
+ col
240
+ } = res;
241
+ return {
242
+ character: col - 1,
243
+ line: line - 1
244
+ };
245
+ }
246
+ function Position_fromOffsetOrFail(offset, text) {
247
+ const p = Position_fromOffset(offset, text);
248
+ if (!p) {
249
+ throw new Error('Position_fromOffsetOrFail');
250
+ }
251
+ return p;
252
+ }
253
+
171
254
  /**
172
255
  * Helper method to create diagnostics
173
256
  * @param node
174
257
  * @param message
175
258
  */
176
- export function err(loc, message, code) {
177
- const { uri, range } = LocationLike_toLocation(loc);
178
- return {
179
- uri,
180
- diagnostic: {
181
- range,
182
- message,
183
- severity: DiagnosticSeverity.Error,
184
- code,
185
- },
186
- };
259
+ function err(loc, message, code) {
260
+ const {
261
+ uri,
262
+ range
263
+ } = LocationLike_toLocation(loc);
264
+ return {
265
+ uri,
266
+ diagnostic: {
267
+ range,
268
+ message,
269
+ severity: DiagnosticSeverity.Error,
270
+ code
271
+ }
272
+ };
187
273
  }
188
274
  function DiagnosticSeverity_getLabel(severity) {
189
- const { Information, Error, Hint, Warning } = DiagnosticSeverity;
190
- const labels = {
191
- [Information]: 'info',
192
- [Error]: 'error',
193
- [Hint]: 'hint',
194
- [Warning]: 'warning',
195
- };
196
- return labels[severity ?? Information];
275
+ const {
276
+ Information,
277
+ Error,
278
+ Hint,
279
+ Warning
280
+ } = DiagnosticSeverity;
281
+ const labels = {
282
+ [Information]: 'info',
283
+ [Error]: 'error',
284
+ [Hint]: 'hint',
285
+ [Warning]: 'warning'
286
+ };
287
+ return labels[severity ?? Information];
197
288
  }
198
289
  /**
199
290
  * Returns a string representation of a diagnostic.
@@ -201,21 +292,26 @@ function DiagnosticSeverity_getLabel(severity) {
201
292
  * ex: "b.ts:1:2: error: this is a message"
202
293
  * ex: "/path/to/app/b.ts:1:2: info: this is a message"
203
294
  */
204
- export function ExtendedDiagnostic_format(d, opts) {
205
- const { diagnostic: { severity, message, code }, } = d;
206
- const cwd = opts?.cwd;
207
- const getSeverityLabel = opts?.getSeverityLabel ?? DiagnosticSeverity_getLabel;
208
- let base = 'file://';
209
- if (cwd) {
210
- base = URL_file(cwd);
295
+ function ExtendedDiagnostic_format(d, opts) {
296
+ const {
297
+ diagnostic: {
298
+ severity,
299
+ message,
300
+ code
211
301
  }
212
- if (!base.endsWith('/')) {
213
- base += '/';
214
- }
215
- const file = LocationLike_toTerminalLink(d).substr(base.length);
216
- const severityLabel = getSeverityLabel(severity);
217
- const errorCode = code ? ` (${code})` : '';
218
- const str = `${file}: ${severityLabel}${errorCode}: ${message}`;
219
- return str;
220
- }
221
- //# sourceMappingURL=diagnostics.js.map
302
+ } = d;
303
+ const cwd = opts?.cwd;
304
+ const getSeverityLabel = opts?.getSeverityLabel ?? DiagnosticSeverity_getLabel;
305
+ let base = 'file://';
306
+ if (cwd) {
307
+ base = (0, _URL.URL_file)(cwd);
308
+ }
309
+ if (!(0, _endsWith.default)(base).call(base, '/')) {
310
+ base += '/';
311
+ }
312
+ const file = LocationLike_toTerminalLink(d).substr(base.length);
313
+ const severityLabel = getSeverityLabel(severity);
314
+ const errorCode = code ? ` (${code})` : '';
315
+ const str = `${file}: ${severityLabel}${errorCode}: ${message}`;
316
+ return str;
317
+ }
package/dist/x/path.js CHANGED
@@ -1,42 +1,61 @@
1
- import fs from 'node:fs';
2
- import { basename, normalize, sep } from 'node:path';
3
- export function globSync(pattern) {
4
- // fs.globSync requires forward slashes as path separators in patterns, even on Windows.
5
- return fs.globSync(pattern.replaceAll('\\', '/')).map((p) => p.toString());
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.basenameNoExt = basenameNoExt;
9
+ exports.directoryNameResolver = directoryNameResolver;
10
+ exports.followsDirNameConvention = followsDirNameConvention;
11
+ exports.globSync = globSync;
12
+ exports.isCellFileName = isCellFileName;
13
+ exports.isLayoutFileName = isLayoutFileName;
14
+ require("core-js/modules/es.array.push.js");
15
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/map"));
16
+ var _replaceAll = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/replace-all"));
17
+ var _endsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/ends-with"));
18
+ var _nodeFs = _interopRequireDefault(require("node:fs"));
19
+ var _nodePath = require("node:path");
20
+ function globSync(pattern) {
21
+ var _context;
22
+ // fs.globSync requires forward slashes as path separators in patterns, even on Windows.
23
+ return (0, _map.default)(_context = _nodeFs.default.globSync((0, _replaceAll.default)(pattern).call(pattern, '\\', '/'))).call(_context, p => p.toString());
6
24
  }
7
- export function directoryNameResolver(dirName) {
8
- dirName = normalize(dirName);
9
- const parts = dirName.split(sep);
10
- const pp = parts[parts.length - 1];
11
- parts.push(pp);
12
- const extensions = ['.js', '.jsx', '.ts', '.tsx'];
13
- const pathNoExt = parts.join(sep);
14
- for (const ext of extensions) {
15
- const path = pathNoExt + ext;
16
- if (fs.existsSync(path)) {
17
- return path;
18
- }
25
+ function directoryNameResolver(dirName) {
26
+ dirName = (0, _nodePath.normalize)(dirName);
27
+ const parts = dirName.split(_nodePath.sep);
28
+ const pp = parts[parts.length - 1];
29
+ parts.push(pp);
30
+ const extensions = ['.js', '.jsx', '.ts', '.tsx'];
31
+ const pathNoExt = parts.join(_nodePath.sep);
32
+ for (const ext of extensions) {
33
+ const path = pathNoExt + ext;
34
+ if (_nodeFs.default.existsSync(path)) {
35
+ return path;
19
36
  }
37
+ }
20
38
  }
21
- export function followsDirNameConvention(filePath) {
22
- filePath = normalize(filePath);
23
- const ending = basenameNoExt(filePath) + sep + basename(filePath);
24
- return filePath.endsWith(ending);
39
+ function followsDirNameConvention(filePath) {
40
+ filePath = (0, _nodePath.normalize)(filePath);
41
+ const ending = basenameNoExt(filePath) + _nodePath.sep + (0, _nodePath.basename)(filePath);
42
+ return (0, _endsWith.default)(filePath).call(filePath, ending);
25
43
  }
26
- export function basenameNoExt(path) {
27
- path = normalize(path);
28
- const parts = basename(path).split('.');
29
- if (parts.length > 1) {
30
- parts.pop();
31
- }
32
- return parts.join('.');
33
- }
34
- export function isLayoutFileName(f) {
35
- f = normalize(f);
36
- return basenameNoExt(f).endsWith('Layout');
44
+ function basenameNoExt(path) {
45
+ path = (0, _nodePath.normalize)(path);
46
+ const parts = (0, _nodePath.basename)(path).split('.');
47
+ if (parts.length > 1) {
48
+ parts.pop();
49
+ }
50
+ return parts.join('.');
37
51
  }
38
- export function isCellFileName(f) {
39
- f = normalize(f);
40
- return basenameNoExt(f).endsWith('Cell');
52
+ function isLayoutFileName(f) {
53
+ var _context2;
54
+ f = (0, _nodePath.normalize)(f);
55
+ return (0, _endsWith.default)(_context2 = basenameNoExt(f)).call(_context2, 'Layout');
41
56
  }
42
- //# sourceMappingURL=path.js.map
57
+ function isCellFileName(f) {
58
+ var _context3;
59
+ f = (0, _nodePath.normalize)(f);
60
+ return (0, _endsWith.default)(_context3 = basenameNoExt(f)).call(_context3, 'Cell');
61
+ }
@@ -1,4 +1,4 @@
1
- import type { Location } from './Location.js';
1
+ import type { Location } from './Location';
2
2
  /**
3
3
  * find "env()" expressions in a prisma file using regex
4
4
  * @param prismaSchemaFilePath
@@ -12,7 +12,7 @@ export declare function prisma_parseEnvExpressionsInFile(prismaSchemaFilePath: s
12
12
  * @param src
13
13
  */
14
14
  export declare function prisma_parseEnvExpressions(src: string): Generator<{
15
- range: import("./Range.js").Range;
15
+ range: import("./Range").Range;
16
16
  key: any;
17
17
  }, void, unknown>;
18
18
  //# sourceMappingURL=prisma.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../src/x/prisma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAI7C;;;GAGG;AACH,wBAAiB,gCAAgC,CAC/C,oBAAoB,EAAE,MAAM;;;iCAa7B;AAED;;;GAGG;AACH,wBAAiB,0BAA0B,CAAC,GAAG,EAAE,MAAM;;;kBActD"}
1
+ {"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../src/x/prisma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAI1C;;;GAGG;AACH,wBAAiB,gCAAgC,CAC/C,oBAAoB,EAAE,MAAM;;;iCAa7B;AAED;;;GAGG;AACH,wBAAiB,0BAA0B,CAAC,GAAG,EAAE,MAAM;;;kBActD"}