@kerebron/tree-sitter 0.4.8 → 0.4.10
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/esm/deno-tree-sitter/main/extended/node_extended.js +37 -130
- package/esm/deno-tree-sitter/main/extended/soft_node.js +1 -6
- package/esm/deno-tree-sitter/main/tree_sitter/language.js +15 -47
- package/esm/deno-tree-sitter/main/tree_sitter/lookahead_iterator.js +4 -14
- package/esm/deno-tree-sitter/main/tree_sitter/node.js +25 -60
- package/esm/deno-tree-sitter/main/tree_sitter/parser.js +8 -28
- package/esm/deno-tree-sitter/main/tree_sitter/query.js +29 -79
- package/esm/deno-tree-sitter/main/tree_sitter/tree.js +6 -21
- package/esm/deno-tree-sitter/main/tree_sitter/tree_cursor.js +10 -35
- package/esm/deno-tree-sitter/main/wasm_loader.js +4 -11
- package/esm/mod.d.ts +0 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +0 -1
- package/package.json +1 -1
- package/esm/_dnt.polyfills.d.ts +0 -101
- package/esm/_dnt.polyfills.d.ts.map +0 -1
- package/esm/_dnt.polyfills.js +0 -127
|
@@ -58,35 +58,15 @@ Object.defineProperty(Tree.prototype, "rootNode", {
|
|
|
58
58
|
});
|
|
59
59
|
// this only exists to help with type hints
|
|
60
60
|
export class ExtendedTree extends Tree {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/** @type {HardNode} */
|
|
64
|
-
Object.defineProperty(this, "rootNode", {
|
|
65
|
-
enumerable: true,
|
|
66
|
-
configurable: true,
|
|
67
|
-
writable: true,
|
|
68
|
-
value: void 0
|
|
69
|
-
});
|
|
70
|
-
}
|
|
61
|
+
/** @type {HardNode} */
|
|
62
|
+
rootNode;
|
|
71
63
|
}
|
|
72
64
|
// this only exists to help with type hints
|
|
73
65
|
class Position {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
configurable: true,
|
|
79
|
-
writable: true,
|
|
80
|
-
value: void 0
|
|
81
|
-
});
|
|
82
|
-
/** @type {number} */
|
|
83
|
-
Object.defineProperty(this, "column", {
|
|
84
|
-
enumerable: true,
|
|
85
|
-
configurable: true,
|
|
86
|
-
writable: true,
|
|
87
|
-
value: void 0
|
|
88
|
-
});
|
|
89
|
-
}
|
|
66
|
+
/** @type {number} */
|
|
67
|
+
row;
|
|
68
|
+
/** @type {number} */
|
|
69
|
+
column;
|
|
90
70
|
}
|
|
91
71
|
const originalDescriptors = Object.getOwnPropertyDescriptors(Node.prototype);
|
|
92
72
|
const originalChildrenGetter = originalDescriptors.children.get;
|
|
@@ -97,110 +77,37 @@ const originalTextGetter = originalDescriptors.text.get;
|
|
|
97
77
|
const originalEquals = originalDescriptors.equals.value;
|
|
98
78
|
const originalToString = originalDescriptors.toString.value;
|
|
99
79
|
export class HardNode extends BaseNode {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
Object.defineProperty(this, "startIndex", {
|
|
132
|
-
enumerable: true,
|
|
133
|
-
configurable: true,
|
|
134
|
-
writable: true,
|
|
135
|
-
value: void 0
|
|
136
|
-
});
|
|
137
|
-
/** @type {Position} */
|
|
138
|
-
Object.defineProperty(this, "startPosition", {
|
|
139
|
-
enumerable: true,
|
|
140
|
-
configurable: true,
|
|
141
|
-
writable: true,
|
|
142
|
-
value: void 0
|
|
143
|
-
});
|
|
144
|
-
/** @type {ExtendedTree} */
|
|
145
|
-
Object.defineProperty(this, "tree", {
|
|
146
|
-
enumerable: true,
|
|
147
|
-
configurable: true,
|
|
148
|
-
writable: true,
|
|
149
|
-
value: void 0
|
|
150
|
-
});
|
|
151
|
-
/** @type {string} */
|
|
152
|
-
Object.defineProperty(this, "type", {
|
|
153
|
-
enumerable: true,
|
|
154
|
-
configurable: true,
|
|
155
|
-
writable: true,
|
|
156
|
-
value: void 0
|
|
157
|
-
});
|
|
158
|
-
/** @type {Boolean} */
|
|
159
|
-
Object.defineProperty(this, "isExtra", {
|
|
160
|
-
enumerable: true,
|
|
161
|
-
configurable: true,
|
|
162
|
-
writable: true,
|
|
163
|
-
value: void 0
|
|
164
|
-
});
|
|
165
|
-
/** @type {Boolean} */
|
|
166
|
-
Object.defineProperty(this, "isError", {
|
|
167
|
-
enumerable: true,
|
|
168
|
-
configurable: true,
|
|
169
|
-
writable: true,
|
|
170
|
-
value: void 0
|
|
171
|
-
});
|
|
172
|
-
/** @type {Boolean} */
|
|
173
|
-
Object.defineProperty(this, "isMissing", {
|
|
174
|
-
enumerable: true,
|
|
175
|
-
configurable: true,
|
|
176
|
-
writable: true,
|
|
177
|
-
value: void 0
|
|
178
|
-
});
|
|
179
|
-
/** @type {Boolean} */
|
|
180
|
-
Object.defineProperty(this, "hasChanges", {
|
|
181
|
-
enumerable: true,
|
|
182
|
-
configurable: true,
|
|
183
|
-
writable: true,
|
|
184
|
-
value: void 0
|
|
185
|
-
});
|
|
186
|
-
/** @type {Boolean} */
|
|
187
|
-
Object.defineProperty(this, "hasError", {
|
|
188
|
-
enumerable: true,
|
|
189
|
-
configurable: true,
|
|
190
|
-
writable: true,
|
|
191
|
-
value: void 0
|
|
192
|
-
});
|
|
193
|
-
/**
|
|
194
|
-
* @param {HardNode} other -
|
|
195
|
-
* @returns {Boolean} output -
|
|
196
|
-
*/
|
|
197
|
-
Object.defineProperty(this, "equals", {
|
|
198
|
-
enumerable: true,
|
|
199
|
-
configurable: true,
|
|
200
|
-
writable: true,
|
|
201
|
-
value: originalEquals
|
|
202
|
-
});
|
|
203
|
-
}
|
|
80
|
+
/** @internal */
|
|
81
|
+
_children;
|
|
82
|
+
/** @internal */
|
|
83
|
+
_fields;
|
|
84
|
+
/** @internal */
|
|
85
|
+
_depth;
|
|
86
|
+
/** @type {number} */
|
|
87
|
+
id;
|
|
88
|
+
/** @type {number} */
|
|
89
|
+
startIndex;
|
|
90
|
+
/** @type {Position} */
|
|
91
|
+
startPosition;
|
|
92
|
+
/** @type {ExtendedTree} */
|
|
93
|
+
tree;
|
|
94
|
+
/** @type {string} */
|
|
95
|
+
type;
|
|
96
|
+
/** @type {Boolean} */
|
|
97
|
+
isExtra;
|
|
98
|
+
/** @type {Boolean} */
|
|
99
|
+
isError;
|
|
100
|
+
/** @type {Boolean} */
|
|
101
|
+
isMissing;
|
|
102
|
+
/** @type {Boolean} */
|
|
103
|
+
hasChanges;
|
|
104
|
+
/** @type {Boolean} */
|
|
105
|
+
hasError;
|
|
106
|
+
/**
|
|
107
|
+
* @param {HardNode} other -
|
|
108
|
+
* @returns {Boolean} output -
|
|
109
|
+
*/
|
|
110
|
+
equals = originalEquals;
|
|
204
111
|
/** @type {HardNode} */
|
|
205
112
|
get parent() {
|
|
206
113
|
const rawParent = originalParent.call(this);
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { BaseNode } from "./base_node.js";
|
|
2
2
|
// HardNode extends BaseNode as well (indirectly)
|
|
3
3
|
export class SoftNode extends BaseNode {
|
|
4
|
+
children = [];
|
|
4
5
|
constructor(data) {
|
|
5
6
|
super(data);
|
|
6
|
-
Object.defineProperty(this, "children", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
configurable: true,
|
|
9
|
-
writable: true,
|
|
10
|
-
value: []
|
|
11
|
-
});
|
|
12
7
|
}
|
|
13
8
|
// these are getters because when calling .replaceInnards() on a node the indices of hardNodes shift, these getters piggyback on that shift (otherwise they'd be wrong)
|
|
14
9
|
get startIndex() {
|
|
@@ -5,61 +5,29 @@ import { TRANSFER_BUFFER } from "./parser.js";
|
|
|
5
5
|
import { Query } from "./query.js";
|
|
6
6
|
const LANGUAGE_FUNCTION_REGEX = /^tree_sitter_\w+$/;
|
|
7
7
|
export class LanguageMetadata {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true,
|
|
13
|
-
value: void 0
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(this, "minor_version", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: void 0
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(this, "patch_version", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
configurable: true,
|
|
24
|
-
writable: true,
|
|
25
|
-
value: void 0
|
|
26
|
-
});
|
|
27
|
-
}
|
|
8
|
+
major_version;
|
|
9
|
+
minor_version;
|
|
10
|
+
patch_version;
|
|
28
11
|
}
|
|
29
12
|
/**
|
|
30
13
|
* An opaque object that defines how to parse a particular language.
|
|
31
14
|
* The code for each `Language` is generated by the Tree-sitter CLI.
|
|
32
15
|
*/
|
|
33
16
|
export class Language {
|
|
17
|
+
/** @internal */
|
|
18
|
+
[0] = 0; // Internal handle for Wasm
|
|
19
|
+
/**
|
|
20
|
+
* A list of all node types in the language. The index of each type in this
|
|
21
|
+
* array is its node type id.
|
|
22
|
+
*/
|
|
23
|
+
types;
|
|
24
|
+
/**
|
|
25
|
+
* A list of all field names in the language. The index of each field name in
|
|
26
|
+
* this array is its field id.
|
|
27
|
+
*/
|
|
28
|
+
fields;
|
|
34
29
|
/** @internal */
|
|
35
30
|
constructor(internal, address) {
|
|
36
|
-
/** @internal */
|
|
37
|
-
Object.defineProperty(this, 0, {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
configurable: true,
|
|
40
|
-
writable: true,
|
|
41
|
-
value: 0
|
|
42
|
-
}); // Internal handle for Wasm
|
|
43
|
-
/**
|
|
44
|
-
* A list of all node types in the language. The index of each type in this
|
|
45
|
-
* array is its node type id.
|
|
46
|
-
*/
|
|
47
|
-
Object.defineProperty(this, "types", {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
configurable: true,
|
|
50
|
-
writable: true,
|
|
51
|
-
value: void 0
|
|
52
|
-
});
|
|
53
|
-
/**
|
|
54
|
-
* A list of all field names in the language. The index of each field name in
|
|
55
|
-
* this array is its field id.
|
|
56
|
-
*/
|
|
57
|
-
Object.defineProperty(this, "fields", {
|
|
58
|
-
enumerable: true,
|
|
59
|
-
configurable: true,
|
|
60
|
-
writable: true,
|
|
61
|
-
value: void 0
|
|
62
|
-
});
|
|
63
31
|
assertInternal(internal);
|
|
64
32
|
this[0] = address;
|
|
65
33
|
this.types = new Array(C._ts_language_symbol_count(this[0]));
|
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import { C, assertInternal } from "./constants.js";
|
|
2
2
|
import { Language } from "./language.js";
|
|
3
3
|
export class LookaheadIterator {
|
|
4
|
+
/** @internal */
|
|
5
|
+
[0] = 0; // Internal handle for Wasm
|
|
6
|
+
/** @internal */
|
|
7
|
+
language;
|
|
4
8
|
/** @internal */
|
|
5
9
|
constructor(internal, address, language) {
|
|
6
|
-
/** @internal */
|
|
7
|
-
Object.defineProperty(this, 0, {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
configurable: true,
|
|
10
|
-
writable: true,
|
|
11
|
-
value: 0
|
|
12
|
-
}); // Internal handle for Wasm
|
|
13
|
-
/** @internal */
|
|
14
|
-
Object.defineProperty(this, "language", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
configurable: true,
|
|
17
|
-
writable: true,
|
|
18
|
-
value: void 0
|
|
19
|
-
});
|
|
20
10
|
assertInternal(internal);
|
|
21
11
|
this[0] = address;
|
|
22
12
|
this.language = language;
|
|
@@ -7,68 +7,14 @@ import { marshalNode, marshalPoint, unmarshalNode, unmarshalPoint } from "./mars
|
|
|
7
7
|
import { TRANSFER_BUFFER } from "./parser.js";
|
|
8
8
|
/** A single node within a syntax {@link Tree}. */
|
|
9
9
|
export class Node {
|
|
10
|
+
/** @internal */
|
|
11
|
+
[0] = 0; // Internal handle for Wasm
|
|
12
|
+
/** @internal */
|
|
13
|
+
_children;
|
|
14
|
+
/** @internal */
|
|
15
|
+
_namedChildren;
|
|
10
16
|
/** @internal */
|
|
11
17
|
constructor(internal, { id, tree, startIndex, startPosition, other }) {
|
|
12
|
-
/** @internal */
|
|
13
|
-
Object.defineProperty(this, 0, {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true,
|
|
17
|
-
value: 0
|
|
18
|
-
}); // Internal handle for Wasm
|
|
19
|
-
/** @internal */
|
|
20
|
-
Object.defineProperty(this, "_children", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value: void 0
|
|
25
|
-
});
|
|
26
|
-
/** @internal */
|
|
27
|
-
Object.defineProperty(this, "_namedChildren", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
configurable: true,
|
|
30
|
-
writable: true,
|
|
31
|
-
value: void 0
|
|
32
|
-
});
|
|
33
|
-
/**
|
|
34
|
-
* The numeric id for this node that is unique.
|
|
35
|
-
*
|
|
36
|
-
* Within a given syntax tree, no two nodes have the same id. However:
|
|
37
|
-
*
|
|
38
|
-
* * If a new tree is created based on an older tree, and a node from the old tree is reused in
|
|
39
|
-
* the process, then that node will have the same id in both trees.
|
|
40
|
-
*
|
|
41
|
-
* * A node not marked as having changes does not guarantee it was reused.
|
|
42
|
-
*
|
|
43
|
-
* * If a node is marked as having changed in the old tree, it will not be reused.
|
|
44
|
-
*/
|
|
45
|
-
Object.defineProperty(this, "id", {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
configurable: true,
|
|
48
|
-
writable: true,
|
|
49
|
-
value: void 0
|
|
50
|
-
});
|
|
51
|
-
/** The byte index where this node starts. */
|
|
52
|
-
Object.defineProperty(this, "startIndex", {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
configurable: true,
|
|
55
|
-
writable: true,
|
|
56
|
-
value: void 0
|
|
57
|
-
});
|
|
58
|
-
/** The position where this node starts. */
|
|
59
|
-
Object.defineProperty(this, "startPosition", {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
configurable: true,
|
|
62
|
-
writable: true,
|
|
63
|
-
value: void 0
|
|
64
|
-
});
|
|
65
|
-
/** The tree that this node belongs to. */
|
|
66
|
-
Object.defineProperty(this, "tree", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
configurable: true,
|
|
69
|
-
writable: true,
|
|
70
|
-
value: void 0
|
|
71
|
-
});
|
|
72
18
|
assertInternal(internal);
|
|
73
19
|
this[0] = other;
|
|
74
20
|
this.id = id;
|
|
@@ -76,6 +22,25 @@ export class Node {
|
|
|
76
22
|
this.startIndex = startIndex;
|
|
77
23
|
this.startPosition = startPosition;
|
|
78
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* The numeric id for this node that is unique.
|
|
27
|
+
*
|
|
28
|
+
* Within a given syntax tree, no two nodes have the same id. However:
|
|
29
|
+
*
|
|
30
|
+
* * If a new tree is created based on an older tree, and a node from the old tree is reused in
|
|
31
|
+
* the process, then that node will have the same id in both trees.
|
|
32
|
+
*
|
|
33
|
+
* * A node not marked as having changes does not guarantee it was reused.
|
|
34
|
+
*
|
|
35
|
+
* * If a node is marked as having changed in the old tree, it will not be reused.
|
|
36
|
+
*/
|
|
37
|
+
id;
|
|
38
|
+
/** The byte index where this node starts. */
|
|
39
|
+
startIndex;
|
|
40
|
+
/** The position where this node starts. */
|
|
41
|
+
startPosition;
|
|
42
|
+
/** The tree that this node belongs to. */
|
|
43
|
+
tree;
|
|
79
44
|
/** Get this node's type as a numerical id. */
|
|
80
45
|
get typeId() {
|
|
81
46
|
marshalNode(this);
|
|
@@ -44,6 +44,14 @@ export let MIN_COMPATIBLE_VERSION;
|
|
|
44
44
|
* source code.
|
|
45
45
|
*/
|
|
46
46
|
export class Parser {
|
|
47
|
+
/** @internal */
|
|
48
|
+
[0] = 0; // Internal handle for Wasm
|
|
49
|
+
/** @internal */
|
|
50
|
+
[1] = 0; // Internal handle for Wasm
|
|
51
|
+
/** @internal */
|
|
52
|
+
logCallback = null;
|
|
53
|
+
/** The parser's current language. */
|
|
54
|
+
language = null;
|
|
47
55
|
/**
|
|
48
56
|
* This must always be called before creating a Parser.
|
|
49
57
|
*
|
|
@@ -60,34 +68,6 @@ export class Parser {
|
|
|
60
68
|
* Create a new parser.
|
|
61
69
|
*/
|
|
62
70
|
constructor() {
|
|
63
|
-
/** @internal */
|
|
64
|
-
Object.defineProperty(this, 0, {
|
|
65
|
-
enumerable: true,
|
|
66
|
-
configurable: true,
|
|
67
|
-
writable: true,
|
|
68
|
-
value: 0
|
|
69
|
-
}); // Internal handle for Wasm
|
|
70
|
-
/** @internal */
|
|
71
|
-
Object.defineProperty(this, 1, {
|
|
72
|
-
enumerable: true,
|
|
73
|
-
configurable: true,
|
|
74
|
-
writable: true,
|
|
75
|
-
value: 0
|
|
76
|
-
}); // Internal handle for Wasm
|
|
77
|
-
/** @internal */
|
|
78
|
-
Object.defineProperty(this, "logCallback", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
configurable: true,
|
|
81
|
-
writable: true,
|
|
82
|
-
value: null
|
|
83
|
-
});
|
|
84
|
-
/** The parser's current language. */
|
|
85
|
-
Object.defineProperty(this, "language", {
|
|
86
|
-
enumerable: true,
|
|
87
|
-
configurable: true,
|
|
88
|
-
writable: true,
|
|
89
|
-
value: null
|
|
90
|
-
});
|
|
91
71
|
this.initialize();
|
|
92
72
|
}
|
|
93
73
|
/** @internal */
|
|
@@ -276,6 +276,35 @@ function parsePattern(index, stepType, stepValueId, captureNames, stringValues,
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
export class Query {
|
|
279
|
+
/** @internal */
|
|
280
|
+
[0] = 0; // Internal handle for Wasm
|
|
281
|
+
/** @internal */
|
|
282
|
+
exceededMatchLimit;
|
|
283
|
+
/** @internal */
|
|
284
|
+
textPredicates;
|
|
285
|
+
/** The names of the captures used in the query. */
|
|
286
|
+
captureNames;
|
|
287
|
+
/** The quantifiers of the captures used in the query. */
|
|
288
|
+
captureQuantifiers;
|
|
289
|
+
/**
|
|
290
|
+
* The other user-defined predicates associated with the given index.
|
|
291
|
+
*
|
|
292
|
+
* This includes predicates with operators other than:
|
|
293
|
+
* - `match?`
|
|
294
|
+
* - `eq?` and `not-eq?`
|
|
295
|
+
* - `any-of?` and `not-any-of?`
|
|
296
|
+
* - `is?` and `is-not?`
|
|
297
|
+
* - `set!`
|
|
298
|
+
*/
|
|
299
|
+
predicates;
|
|
300
|
+
/** The properties for predicates with the operator `set!`. */
|
|
301
|
+
setProperties;
|
|
302
|
+
/** The properties for predicates with the operator `is?`. */
|
|
303
|
+
assertedProperties;
|
|
304
|
+
/** The properties for predicates with the operator `is-not?`. */
|
|
305
|
+
refutedProperties;
|
|
306
|
+
/** The maximum number of in-progress matches for this cursor. */
|
|
307
|
+
matchLimit;
|
|
279
308
|
/**
|
|
280
309
|
* Create a new query from a string containing one or more S-expression
|
|
281
310
|
* patterns.
|
|
@@ -287,85 +316,6 @@ export class Query {
|
|
|
287
316
|
* @link {@see https://tree-sitter.github.io/tree-sitter/using-parsers/queries}
|
|
288
317
|
*/
|
|
289
318
|
constructor(language, source) {
|
|
290
|
-
/** @internal */
|
|
291
|
-
Object.defineProperty(this, 0, {
|
|
292
|
-
enumerable: true,
|
|
293
|
-
configurable: true,
|
|
294
|
-
writable: true,
|
|
295
|
-
value: 0
|
|
296
|
-
}); // Internal handle for Wasm
|
|
297
|
-
/** @internal */
|
|
298
|
-
Object.defineProperty(this, "exceededMatchLimit", {
|
|
299
|
-
enumerable: true,
|
|
300
|
-
configurable: true,
|
|
301
|
-
writable: true,
|
|
302
|
-
value: void 0
|
|
303
|
-
});
|
|
304
|
-
/** @internal */
|
|
305
|
-
Object.defineProperty(this, "textPredicates", {
|
|
306
|
-
enumerable: true,
|
|
307
|
-
configurable: true,
|
|
308
|
-
writable: true,
|
|
309
|
-
value: void 0
|
|
310
|
-
});
|
|
311
|
-
/** The names of the captures used in the query. */
|
|
312
|
-
Object.defineProperty(this, "captureNames", {
|
|
313
|
-
enumerable: true,
|
|
314
|
-
configurable: true,
|
|
315
|
-
writable: true,
|
|
316
|
-
value: void 0
|
|
317
|
-
});
|
|
318
|
-
/** The quantifiers of the captures used in the query. */
|
|
319
|
-
Object.defineProperty(this, "captureQuantifiers", {
|
|
320
|
-
enumerable: true,
|
|
321
|
-
configurable: true,
|
|
322
|
-
writable: true,
|
|
323
|
-
value: void 0
|
|
324
|
-
});
|
|
325
|
-
/**
|
|
326
|
-
* The other user-defined predicates associated with the given index.
|
|
327
|
-
*
|
|
328
|
-
* This includes predicates with operators other than:
|
|
329
|
-
* - `match?`
|
|
330
|
-
* - `eq?` and `not-eq?`
|
|
331
|
-
* - `any-of?` and `not-any-of?`
|
|
332
|
-
* - `is?` and `is-not?`
|
|
333
|
-
* - `set!`
|
|
334
|
-
*/
|
|
335
|
-
Object.defineProperty(this, "predicates", {
|
|
336
|
-
enumerable: true,
|
|
337
|
-
configurable: true,
|
|
338
|
-
writable: true,
|
|
339
|
-
value: void 0
|
|
340
|
-
});
|
|
341
|
-
/** The properties for predicates with the operator `set!`. */
|
|
342
|
-
Object.defineProperty(this, "setProperties", {
|
|
343
|
-
enumerable: true,
|
|
344
|
-
configurable: true,
|
|
345
|
-
writable: true,
|
|
346
|
-
value: void 0
|
|
347
|
-
});
|
|
348
|
-
/** The properties for predicates with the operator `is?`. */
|
|
349
|
-
Object.defineProperty(this, "assertedProperties", {
|
|
350
|
-
enumerable: true,
|
|
351
|
-
configurable: true,
|
|
352
|
-
writable: true,
|
|
353
|
-
value: void 0
|
|
354
|
-
});
|
|
355
|
-
/** The properties for predicates with the operator `is-not?`. */
|
|
356
|
-
Object.defineProperty(this, "refutedProperties", {
|
|
357
|
-
enumerable: true,
|
|
358
|
-
configurable: true,
|
|
359
|
-
writable: true,
|
|
360
|
-
value: void 0
|
|
361
|
-
});
|
|
362
|
-
/** The maximum number of in-progress matches for this cursor. */
|
|
363
|
-
Object.defineProperty(this, "matchLimit", {
|
|
364
|
-
enumerable: true,
|
|
365
|
-
configurable: true,
|
|
366
|
-
writable: true,
|
|
367
|
-
value: void 0
|
|
368
|
-
});
|
|
369
319
|
const sourceLength = C.lengthBytesUTF8(source);
|
|
370
320
|
const sourceAddress = C._malloc(sourceLength + 1);
|
|
371
321
|
C.stringToUTF8(source, sourceAddress, sourceLength + 1);
|
|
@@ -28,29 +28,14 @@ export function getText(tree, startIndex, endIndex, startPosition) {
|
|
|
28
28
|
}
|
|
29
29
|
/** A tree that represents the syntactic structure of a source code file. */
|
|
30
30
|
export class Tree {
|
|
31
|
+
/** @internal */
|
|
32
|
+
[0] = 0; // Internal handle for Wasm
|
|
33
|
+
/** @internal */
|
|
34
|
+
textCallback;
|
|
35
|
+
/** The language that was used to parse the syntax tree. */
|
|
36
|
+
language;
|
|
31
37
|
/** @internal */
|
|
32
38
|
constructor(internal, address, language, textCallback) {
|
|
33
|
-
/** @internal */
|
|
34
|
-
Object.defineProperty(this, 0, {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
configurable: true,
|
|
37
|
-
writable: true,
|
|
38
|
-
value: 0
|
|
39
|
-
}); // Internal handle for Wasm
|
|
40
|
-
/** @internal */
|
|
41
|
-
Object.defineProperty(this, "textCallback", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
configurable: true,
|
|
44
|
-
writable: true,
|
|
45
|
-
value: void 0
|
|
46
|
-
});
|
|
47
|
-
/** The language that was used to parse the syntax tree. */
|
|
48
|
-
Object.defineProperty(this, "language", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
configurable: true,
|
|
51
|
-
writable: true,
|
|
52
|
-
value: void 0
|
|
53
|
-
});
|
|
54
39
|
assertInternal(internal);
|
|
55
40
|
this[0] = address;
|
|
56
41
|
this.language = language;
|
|
@@ -5,43 +5,18 @@ import { TRANSFER_BUFFER } from "./parser.js";
|
|
|
5
5
|
import { getText, Tree } from "./tree.js";
|
|
6
6
|
/** A stateful object for walking a syntax {@link Tree} efficiently. */
|
|
7
7
|
export class TreeCursor {
|
|
8
|
+
/** @internal */
|
|
9
|
+
[0] = 0; // Internal handle for Wasm
|
|
10
|
+
/** @internal */
|
|
11
|
+
[1] = 0; // Internal handle for Wasm
|
|
12
|
+
/** @internal */
|
|
13
|
+
[2] = 0; // Internal handle for Wasm
|
|
14
|
+
/** @internal */
|
|
15
|
+
[3] = 0; // Internal handle for Wasm
|
|
16
|
+
/** @internal */
|
|
17
|
+
tree;
|
|
8
18
|
/** @internal */
|
|
9
19
|
constructor(internal, tree) {
|
|
10
|
-
/** @internal */
|
|
11
|
-
Object.defineProperty(this, 0, {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: 0
|
|
16
|
-
}); // Internal handle for Wasm
|
|
17
|
-
/** @internal */
|
|
18
|
-
Object.defineProperty(this, 1, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: 0
|
|
23
|
-
}); // Internal handle for Wasm
|
|
24
|
-
/** @internal */
|
|
25
|
-
Object.defineProperty(this, 2, {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: 0
|
|
30
|
-
}); // Internal handle for Wasm
|
|
31
|
-
/** @internal */
|
|
32
|
-
Object.defineProperty(this, 3, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: 0
|
|
37
|
-
}); // Internal handle for Wasm
|
|
38
|
-
/** @internal */
|
|
39
|
-
Object.defineProperty(this, "tree", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: true,
|
|
42
|
-
writable: true,
|
|
43
|
-
value: void 0
|
|
44
|
-
});
|
|
45
20
|
assertInternal(internal);
|
|
46
21
|
this.tree = tree;
|
|
47
22
|
unmarshalTreeCursor(this);
|
|
@@ -43,7 +43,6 @@ export const defaults = {
|
|
|
43
43
|
// receiveInstance(instantiationResult["instance"], instantiationResult["module"])
|
|
44
44
|
};
|
|
45
45
|
export default async function (Module) {
|
|
46
|
-
var _a;
|
|
47
46
|
Module = Object.assign({}, defaults, Module);
|
|
48
47
|
var readyPromiseResolve, readyPromiseReject;
|
|
49
48
|
var readyPromise = new Promise((resolve, reject) => {
|
|
@@ -203,21 +202,15 @@ export default async function (Module) {
|
|
|
203
202
|
__name(abort, "abort");
|
|
204
203
|
var ASM_CONSTS = {};
|
|
205
204
|
class ExitStatus {
|
|
205
|
+
static {
|
|
206
|
+
__name(this, "ExitStatus");
|
|
207
|
+
}
|
|
208
|
+
name = "ExitStatus";
|
|
206
209
|
constructor(status) {
|
|
207
|
-
Object.defineProperty(this, "name", {
|
|
208
|
-
enumerable: true,
|
|
209
|
-
configurable: true,
|
|
210
|
-
writable: true,
|
|
211
|
-
value: "ExitStatus"
|
|
212
|
-
});
|
|
213
210
|
this.message = `Program terminated with exit(${status})`;
|
|
214
211
|
this.status = status;
|
|
215
212
|
}
|
|
216
213
|
}
|
|
217
|
-
_a = ExitStatus;
|
|
218
|
-
(() => {
|
|
219
|
-
__name(_a, "ExitStatus");
|
|
220
|
-
})();
|
|
221
214
|
var GOT = {};
|
|
222
215
|
var currentModuleWeakSymbols = /* @__PURE__ */ new Set([]);
|
|
223
216
|
var GOTHandler = {
|
package/esm/mod.d.ts
CHANGED
package/esm/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,+CAA+C,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,8CAA8C,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,6CAA6C,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,6CAA6C,CAAC"}
|
package/esm/mod.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// JS files exported because of sloppy-imports
|
|
2
|
-
import "./_dnt.polyfills.js";
|
|
3
2
|
export { createParser } from './deno-tree-sitter/main/extended/parser.js';
|
|
4
3
|
export { Parser } from './deno-tree-sitter/main/tree_sitter/parser.js';
|
|
5
4
|
export { Language } from './deno-tree-sitter/main/tree_sitter/language.js';
|
package/package.json
CHANGED
package/esm/_dnt.polyfills.d.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
-
* but instead of using npm to install additional dependencies,
|
|
4
|
-
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
-
*
|
|
6
|
-
* Note that this code might be imported multiple times
|
|
7
|
-
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
-
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
-
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
-
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
-
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
-
*/
|
|
13
|
-
import { createRequire } from "node:module";
|
|
14
|
-
import { type URL } from "node:url";
|
|
15
|
-
declare global {
|
|
16
|
-
interface ImportMeta {
|
|
17
|
-
/** A string representation of the fully qualified module URL. When the
|
|
18
|
-
* module is loaded locally, the value will be a file URL (e.g.
|
|
19
|
-
* `file:///path/module.ts`).
|
|
20
|
-
*
|
|
21
|
-
* You can also parse the string as a URL to determine more information about
|
|
22
|
-
* how the current module was loaded. For example to determine if a module was
|
|
23
|
-
* local or not:
|
|
24
|
-
*
|
|
25
|
-
* ```ts
|
|
26
|
-
* const url = new URL(import.meta.url);
|
|
27
|
-
* if (url.protocol === "file:") {
|
|
28
|
-
* console.log("this module was loaded locally");
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
url: string;
|
|
33
|
-
/**
|
|
34
|
-
* A function that returns resolved specifier as if it would be imported
|
|
35
|
-
* using `import(specifier)`.
|
|
36
|
-
*
|
|
37
|
-
* ```ts
|
|
38
|
-
* console.log(import.meta.resolve("./foo.js"));
|
|
39
|
-
* // file:///dev/foo.js
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* @param specifier The module specifier to resolve relative to `parent`.
|
|
43
|
-
* @param parent The absolute parent module URL to resolve from.
|
|
44
|
-
* @returns The absolute (`file:`) URL string for the resolved module.
|
|
45
|
-
*/
|
|
46
|
-
resolve(specifier: string, parent?: string | URL | undefined): string;
|
|
47
|
-
/** A flag that indicates if the current module is the main module that was
|
|
48
|
-
* called when starting the program under Deno.
|
|
49
|
-
*
|
|
50
|
-
* ```ts
|
|
51
|
-
* if (import.meta.main) {
|
|
52
|
-
* // this was loaded as the main module, maybe do some bootstrapping
|
|
53
|
-
* }
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
main: boolean;
|
|
57
|
-
/** The absolute path of the current module.
|
|
58
|
-
*
|
|
59
|
-
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
60
|
-
*
|
|
61
|
-
* Example:
|
|
62
|
-
* ```
|
|
63
|
-
* // Unix
|
|
64
|
-
* console.log(import.meta.filename); // /home/alice/my_module.ts
|
|
65
|
-
*
|
|
66
|
-
* // Windows
|
|
67
|
-
* console.log(import.meta.filename); // C:\alice\my_module.ts
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
filename: string;
|
|
71
|
-
/** The absolute path of the directory containing the current module.
|
|
72
|
-
*
|
|
73
|
-
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
74
|
-
*
|
|
75
|
-
* * Example:
|
|
76
|
-
* ```
|
|
77
|
-
* // Unix
|
|
78
|
-
* console.log(import.meta.dirname); // /home/alice
|
|
79
|
-
*
|
|
80
|
-
* // Windows
|
|
81
|
-
* console.log(import.meta.dirname); // C:\alice
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
dirname: string;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
type NodeRequest = ReturnType<typeof createRequire>;
|
|
88
|
-
type NodeModule = NonNullable<NodeRequest["main"]>;
|
|
89
|
-
interface ImportMetaPonyfillCommonjs {
|
|
90
|
-
(require: NodeRequest, module: NodeModule): ImportMeta;
|
|
91
|
-
}
|
|
92
|
-
interface ImportMetaPonyfillEsmodule {
|
|
93
|
-
(importMeta: ImportMeta): ImportMeta;
|
|
94
|
-
}
|
|
95
|
-
interface ImportMetaPonyfill extends ImportMetaPonyfillCommonjs, ImportMetaPonyfillEsmodule {
|
|
96
|
-
}
|
|
97
|
-
export declare let import_meta_ponyfill_commonjs: ImportMetaPonyfillCommonjs;
|
|
98
|
-
export declare let import_meta_ponyfill_esmodule: ImportMetaPonyfillEsmodule;
|
|
99
|
-
export declare let import_meta_ponyfill: ImportMetaPonyfill;
|
|
100
|
-
export {};
|
|
101
|
-
//# sourceMappingURL=_dnt.polyfills.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAgC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAGlE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB;;;;;;;;;;;;;;WAcG;QACH,GAAG,EAAE,MAAM,CAAC;QACZ;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;QACtE;;;;;;;;WAQG;QACH,IAAI,EAAE,OAAO,CAAC;QAEd;;;;;;;;;;;;WAYG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;;;;;;;;;;;WAYG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB;CACF;AAED,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,KAAK,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,UAAU,0BAA0B;IAClC,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACxD;AACD,UAAU,0BAA0B;IAClC,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AACD,UAAU,kBACR,SAAQ,0BAA0B,EAAE,0BAA0B;CAC/D;AAiBD,eAAO,IAAI,6BAA6B,EA2BnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,6BAA6B,EA4DnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,oBAAoB,EAoB1B,kBAAkB,CAAC"}
|
package/esm/_dnt.polyfills.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
-
* but instead of using npm to install additional dependencies,
|
|
4
|
-
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
-
*
|
|
6
|
-
* Note that this code might be imported multiple times
|
|
7
|
-
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
-
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
-
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
-
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
-
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
-
*/
|
|
13
|
-
//@ts-ignore
|
|
14
|
-
import { createRequire } from "node:module";
|
|
15
|
-
//@ts-ignore
|
|
16
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
17
|
-
//@ts-ignore
|
|
18
|
-
import { dirname } from "node:path";
|
|
19
|
-
const defineGlobalPonyfill = (symbolFor, fn) => {
|
|
20
|
-
if (!Reflect.has(globalThis, Symbol.for(symbolFor))) {
|
|
21
|
-
Object.defineProperty(globalThis, Symbol.for(symbolFor), {
|
|
22
|
-
configurable: true,
|
|
23
|
-
get() {
|
|
24
|
-
return fn;
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export let import_meta_ponyfill_commonjs = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-commonjs")) ??
|
|
30
|
-
(() => {
|
|
31
|
-
const moduleImportMetaWM = new WeakMap();
|
|
32
|
-
return (require, module) => {
|
|
33
|
-
let importMetaCache = moduleImportMetaWM.get(module);
|
|
34
|
-
if (importMetaCache == null) {
|
|
35
|
-
const importMeta = Object.assign(Object.create(null), {
|
|
36
|
-
url: pathToFileURL(module.filename).href,
|
|
37
|
-
main: require.main == module,
|
|
38
|
-
resolve: (specifier, parentURL = importMeta.url) => {
|
|
39
|
-
return pathToFileURL((importMeta.url === parentURL
|
|
40
|
-
? require
|
|
41
|
-
: createRequire(parentURL))
|
|
42
|
-
.resolve(specifier)).href;
|
|
43
|
-
},
|
|
44
|
-
filename: module.filename,
|
|
45
|
-
dirname: module.path,
|
|
46
|
-
});
|
|
47
|
-
moduleImportMetaWM.set(module, importMeta);
|
|
48
|
-
importMetaCache = importMeta;
|
|
49
|
-
}
|
|
50
|
-
return importMetaCache;
|
|
51
|
-
};
|
|
52
|
-
})());
|
|
53
|
-
defineGlobalPonyfill("import-meta-ponyfill-commonjs", import_meta_ponyfill_commonjs);
|
|
54
|
-
export let import_meta_ponyfill_esmodule = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-esmodule")) ??
|
|
55
|
-
((importMeta) => {
|
|
56
|
-
const resolveFunStr = String(importMeta.resolve);
|
|
57
|
-
const shimWs = new WeakSet();
|
|
58
|
-
//@ts-ignore
|
|
59
|
-
const mainUrl = ("file:///" + process.argv[1].replace(/\\/g, "/"))
|
|
60
|
-
.replace(/\/{3,}/, "///");
|
|
61
|
-
const commonShim = (importMeta) => {
|
|
62
|
-
if (typeof importMeta.main !== "boolean") {
|
|
63
|
-
importMeta.main = importMeta.url === mainUrl;
|
|
64
|
-
}
|
|
65
|
-
if (typeof importMeta.filename !== "string") {
|
|
66
|
-
importMeta.filename = fileURLToPath(importMeta.url);
|
|
67
|
-
importMeta.dirname = dirname(importMeta.filename);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
if (
|
|
71
|
-
// v16.2.0+, v14.18.0+: Add support for WHATWG URL object to parentURL parameter.
|
|
72
|
-
resolveFunStr === "undefined" ||
|
|
73
|
-
// v20.0.0+, v18.19.0+"" This API now returns a string synchronously instead of a Promise.
|
|
74
|
-
resolveFunStr.startsWith("async")
|
|
75
|
-
// enable by --experimental-import-meta-resolve flag
|
|
76
|
-
) {
|
|
77
|
-
import_meta_ponyfill_esmodule = (importMeta) => {
|
|
78
|
-
if (!shimWs.has(importMeta)) {
|
|
79
|
-
shimWs.add(importMeta);
|
|
80
|
-
const importMetaUrlRequire = {
|
|
81
|
-
url: importMeta.url,
|
|
82
|
-
require: createRequire(importMeta.url),
|
|
83
|
-
};
|
|
84
|
-
importMeta.resolve = function resolve(specifier, parentURL = importMeta.url) {
|
|
85
|
-
return pathToFileURL((importMetaUrlRequire.url === parentURL
|
|
86
|
-
? importMetaUrlRequire.require
|
|
87
|
-
: createRequire(parentURL)).resolve(specifier)).href;
|
|
88
|
-
};
|
|
89
|
-
commonShim(importMeta);
|
|
90
|
-
}
|
|
91
|
-
return importMeta;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
/// native support
|
|
96
|
-
import_meta_ponyfill_esmodule = (importMeta) => {
|
|
97
|
-
if (!shimWs.has(importMeta)) {
|
|
98
|
-
shimWs.add(importMeta);
|
|
99
|
-
commonShim(importMeta);
|
|
100
|
-
}
|
|
101
|
-
return importMeta;
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
return import_meta_ponyfill_esmodule(importMeta);
|
|
105
|
-
}));
|
|
106
|
-
defineGlobalPonyfill("import-meta-ponyfill-esmodule", import_meta_ponyfill_esmodule);
|
|
107
|
-
export let import_meta_ponyfill = ((...args) => {
|
|
108
|
-
const _MODULE = (() => {
|
|
109
|
-
if (typeof require === "function" && typeof module === "object") {
|
|
110
|
-
return "commonjs";
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
// eval("typeof import.meta");
|
|
114
|
-
return "esmodule";
|
|
115
|
-
}
|
|
116
|
-
})();
|
|
117
|
-
if (_MODULE === "commonjs") {
|
|
118
|
-
//@ts-ignore
|
|
119
|
-
import_meta_ponyfill = (r, m) => import_meta_ponyfill_commonjs(r, m);
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
//@ts-ignore
|
|
123
|
-
import_meta_ponyfill = (im) => import_meta_ponyfill_esmodule(im);
|
|
124
|
-
}
|
|
125
|
-
//@ts-ignore
|
|
126
|
-
return import_meta_ponyfill(...args);
|
|
127
|
-
});
|