blob: e2973db911a3b87999f1126a2cb678baf53a7c9a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// @ts-nocheck
var __BuildError;
var __ResolveError;
var __ImportKind;
{
enum ImportKind {
entry_point = 0,
stmt = 1,
require = 2,
dynamic = 3,
require_resolve = 4,
at = 5,
at_conditional = 6,
url = 7,
}
type ErrorPosition = {
file: string;
namespace: string;
line: number; // 1-based
column: number; // 0-based, byte offset relative to lineText
length: number; // in bytes
/** line of text, possibly empty */
lineText: string;
/** byte offset relative to the start of the file */
offset: number;
};
interface BuildErrorImplementation {
position: ErrorPosition;
name: string;
message: string;
}
interface ResolveErrorImplementation extends BuildErrorImplementation {
specifier: string;
importKind: ImportKind;
}
class BuildError extends Error {
constructor(data: BuildErrorImplementation) {
super(data.message);
this.name = data.name;
this.data = data;
}
data: BuildErrorImplementation;
get position() {
return this.data.position;
}
get [Symbol.toStringTag]() {
return `${this.name}: ${this.message}`;
}
}
class ResolveError extends BuildError {
constructor(data: ResolveErrorImplementation) {
super(data);
this.name = data.name;
this.data = data;
}
data: ResolveErrorImplementation;
get importKind() {
return this.data.importKind;
}
get specifier() {
return this.data.specifier || "";
}
}
__ResolveError = ResolveError;
__BuildError = BuildError;
__ImportKind = ImportKind;
}
export { __ResolveError as ResolveError, __BuildError as BuildError, __ImportKind as ImportKind };
|