oxc-parser 0.86.0 → 0.88.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/{bindings.js → bindings.mjs} +15 -12
- package/generated/constants.mjs +9 -0
- package/generated/deserialize/{js.js → js.mjs} +1 -5
- package/generated/deserialize/{ts.js → ts.mjs} +1 -5
- package/generated/lazy/{constructors.js → constructors.mjs} +206 -415
- package/generated/lazy/{types.js → types.mjs} +3 -11
- package/generated/lazy/{walk.js → walk.mjs} +148 -150
- package/{index.js → index.mjs} +18 -22
- package/package.json +35 -36
- package/raw-transfer/{common.js → common.mjs} +8 -16
- package/raw-transfer/{eager.js → eager.mjs} +7 -8
- package/raw-transfer/{lazy-common.js → lazy-common.mjs} +2 -6
- package/raw-transfer/{lazy.js → lazy.mjs} +9 -12
- package/raw-transfer/{node-array.js → node-array.mjs} +2 -6
- package/raw-transfer/{supported.js → supported.mjs} +2 -6
- package/raw-transfer/{visitor.js → visitor.mjs} +5 -11
- package/generated/constants.js +0 -18
- package/wrap.cjs +0 -58
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// Auto-generated code, DO NOT EDIT DIRECTLY!
|
|
2
2
|
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer_lazy.rs`.
|
|
3
3
|
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
4
|
// Mapping from node type name to node type ID
|
|
7
|
-
const NODE_TYPE_IDS_MAP = new Map([
|
|
5
|
+
export const NODE_TYPE_IDS_MAP = new Map([
|
|
8
6
|
// Leaf nodes
|
|
9
7
|
['IdentifierName', 0],
|
|
10
8
|
['IdentifierReference', 1],
|
|
@@ -188,11 +186,5 @@ const NODE_TYPE_IDS_MAP = new Map([
|
|
|
188
186
|
['JSDocNonNullableType', 178],
|
|
189
187
|
]);
|
|
190
188
|
|
|
191
|
-
const NODE_TYPES_COUNT = 179
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
module.exports = {
|
|
195
|
-
NODE_TYPE_IDS_MAP,
|
|
196
|
-
NODE_TYPES_COUNT,
|
|
197
|
-
LEAF_NODE_TYPES_COUNT,
|
|
198
|
-
};
|
|
189
|
+
export const NODE_TYPES_COUNT = 179;
|
|
190
|
+
export const LEAF_NODE_TYPES_COUNT = 38;
|
|
@@ -1,191 +1,189 @@
|
|
|
1
1
|
// Auto-generated code, DO NOT EDIT DIRECTLY!
|
|
2
2
|
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer_lazy.rs`.
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Program,
|
|
8
|
-
IdentifierName,
|
|
9
|
-
IdentifierReference,
|
|
10
|
-
BindingIdentifier,
|
|
11
|
-
LabelIdentifier,
|
|
12
|
-
ThisExpression,
|
|
4
|
+
import {
|
|
5
|
+
AccessorProperty,
|
|
6
|
+
ArrayAssignmentTarget,
|
|
13
7
|
ArrayExpression,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
ObjectProperty,
|
|
17
|
-
TemplateLiteral,
|
|
18
|
-
TaggedTemplateExpression,
|
|
19
|
-
TemplateElement,
|
|
20
|
-
ComputedMemberExpression,
|
|
21
|
-
StaticMemberExpression,
|
|
22
|
-
PrivateFieldExpression,
|
|
23
|
-
CallExpression,
|
|
24
|
-
NewExpression,
|
|
25
|
-
MetaProperty,
|
|
26
|
-
SpreadElement,
|
|
27
|
-
UpdateExpression,
|
|
28
|
-
UnaryExpression,
|
|
29
|
-
BinaryExpression,
|
|
30
|
-
PrivateInExpression,
|
|
31
|
-
LogicalExpression,
|
|
32
|
-
ConditionalExpression,
|
|
8
|
+
ArrayPattern,
|
|
9
|
+
ArrowFunctionExpression,
|
|
33
10
|
AssignmentExpression,
|
|
34
|
-
|
|
35
|
-
ObjectAssignmentTarget,
|
|
36
|
-
AssignmentTargetWithDefault,
|
|
11
|
+
AssignmentPattern,
|
|
37
12
|
AssignmentTargetPropertyIdentifier,
|
|
38
13
|
AssignmentTargetPropertyProperty,
|
|
39
|
-
|
|
40
|
-
Super,
|
|
14
|
+
AssignmentTargetWithDefault,
|
|
41
15
|
AwaitExpression,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
16
|
+
BigIntLiteral,
|
|
17
|
+
BinaryExpression,
|
|
18
|
+
BindingIdentifier,
|
|
19
|
+
BindingProperty,
|
|
45
20
|
BlockStatement,
|
|
46
|
-
|
|
47
|
-
|
|
21
|
+
BooleanLiteral,
|
|
22
|
+
BreakStatement,
|
|
23
|
+
CallExpression,
|
|
24
|
+
CatchClause,
|
|
25
|
+
ChainExpression,
|
|
26
|
+
Class,
|
|
27
|
+
ClassBody,
|
|
28
|
+
ComputedMemberExpression,
|
|
29
|
+
ConditionalExpression,
|
|
30
|
+
ContinueStatement,
|
|
31
|
+
DebuggerStatement,
|
|
32
|
+
Decorator,
|
|
33
|
+
DoWhileStatement,
|
|
34
|
+
Elision,
|
|
48
35
|
EmptyStatement,
|
|
36
|
+
ExportAllDeclaration,
|
|
37
|
+
ExportDefaultDeclaration,
|
|
38
|
+
ExportNamedDeclaration,
|
|
39
|
+
ExportSpecifier,
|
|
49
40
|
ExpressionStatement,
|
|
50
|
-
IfStatement,
|
|
51
|
-
DoWhileStatement,
|
|
52
|
-
WhileStatement,
|
|
53
|
-
ForStatement,
|
|
54
41
|
ForInStatement,
|
|
42
|
+
FormalParameters,
|
|
55
43
|
ForOfStatement,
|
|
56
|
-
|
|
57
|
-
BreakStatement,
|
|
58
|
-
ReturnStatement,
|
|
59
|
-
WithStatement,
|
|
60
|
-
SwitchStatement,
|
|
61
|
-
SwitchCase,
|
|
62
|
-
LabeledStatement,
|
|
63
|
-
ThrowStatement,
|
|
64
|
-
TryStatement,
|
|
65
|
-
CatchClause,
|
|
66
|
-
DebuggerStatement,
|
|
67
|
-
AssignmentPattern,
|
|
68
|
-
ObjectPattern,
|
|
69
|
-
BindingProperty,
|
|
70
|
-
ArrayPattern,
|
|
44
|
+
ForStatement,
|
|
71
45
|
Function,
|
|
72
|
-
FormalParameters,
|
|
73
46
|
FunctionBody,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
PropertyDefinition,
|
|
80
|
-
PrivateIdentifier,
|
|
81
|
-
StaticBlock,
|
|
82
|
-
AccessorProperty,
|
|
83
|
-
ImportExpression,
|
|
47
|
+
Hashbang,
|
|
48
|
+
IdentifierName,
|
|
49
|
+
IdentifierReference,
|
|
50
|
+
IfStatement,
|
|
51
|
+
ImportAttribute,
|
|
84
52
|
ImportDeclaration,
|
|
85
|
-
ImportSpecifier,
|
|
86
53
|
ImportDefaultSpecifier,
|
|
54
|
+
ImportExpression,
|
|
87
55
|
ImportNamespaceSpecifier,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
V8IntrinsicExpression,
|
|
94
|
-
BooleanLiteral,
|
|
95
|
-
NullLiteral,
|
|
96
|
-
NumericLiteral,
|
|
97
|
-
StringLiteral,
|
|
98
|
-
BigIntLiteral,
|
|
99
|
-
RegExpLiteral,
|
|
100
|
-
JSXElement,
|
|
101
|
-
JSXOpeningElement,
|
|
56
|
+
ImportSpecifier,
|
|
57
|
+
JSDocNonNullableType,
|
|
58
|
+
JSDocNullableType,
|
|
59
|
+
JSDocUnknownType,
|
|
60
|
+
JSXAttribute,
|
|
102
61
|
JSXClosingElement,
|
|
103
|
-
JSXFragment,
|
|
104
|
-
JSXOpeningFragment,
|
|
105
62
|
JSXClosingFragment,
|
|
106
|
-
|
|
107
|
-
JSXMemberExpression,
|
|
108
|
-
JSXExpressionContainer,
|
|
63
|
+
JSXElement,
|
|
109
64
|
JSXEmptyExpression,
|
|
110
|
-
|
|
111
|
-
|
|
65
|
+
JSXExpressionContainer,
|
|
66
|
+
JSXFragment,
|
|
112
67
|
JSXIdentifier,
|
|
68
|
+
JSXMemberExpression,
|
|
69
|
+
JSXNamespacedName,
|
|
70
|
+
JSXOpeningElement,
|
|
71
|
+
JSXOpeningFragment,
|
|
72
|
+
JSXSpreadAttribute,
|
|
113
73
|
JSXSpreadChild,
|
|
114
74
|
JSXText,
|
|
115
|
-
|
|
75
|
+
LabeledStatement,
|
|
76
|
+
LabelIdentifier,
|
|
77
|
+
LogicalExpression,
|
|
78
|
+
MetaProperty,
|
|
79
|
+
MethodDefinition,
|
|
80
|
+
NewExpression,
|
|
81
|
+
NullLiteral,
|
|
82
|
+
NumericLiteral,
|
|
83
|
+
ObjectAssignmentTarget,
|
|
84
|
+
ObjectExpression,
|
|
85
|
+
ObjectPattern,
|
|
86
|
+
ObjectProperty,
|
|
87
|
+
ParenthesizedExpression,
|
|
88
|
+
PrivateFieldExpression,
|
|
89
|
+
PrivateIdentifier,
|
|
90
|
+
PrivateInExpression,
|
|
91
|
+
Program,
|
|
92
|
+
PropertyDefinition,
|
|
93
|
+
RegExpLiteral,
|
|
94
|
+
ReturnStatement,
|
|
95
|
+
SequenceExpression,
|
|
96
|
+
SpreadElement,
|
|
97
|
+
StaticBlock,
|
|
98
|
+
StaticMemberExpression,
|
|
99
|
+
StringLiteral,
|
|
100
|
+
Super,
|
|
101
|
+
SwitchCase,
|
|
102
|
+
SwitchStatement,
|
|
103
|
+
TaggedTemplateExpression,
|
|
104
|
+
TemplateElement,
|
|
105
|
+
TemplateLiteral,
|
|
106
|
+
ThisExpression,
|
|
107
|
+
ThrowStatement,
|
|
108
|
+
TryStatement,
|
|
109
|
+
TSAnyKeyword,
|
|
110
|
+
TSArrayType,
|
|
111
|
+
TSAsExpression,
|
|
112
|
+
TSBigIntKeyword,
|
|
113
|
+
TSBooleanKeyword,
|
|
114
|
+
TSCallSignatureDeclaration,
|
|
115
|
+
TSClassImplements,
|
|
116
|
+
TSConditionalType,
|
|
117
|
+
TSConstructorType,
|
|
118
|
+
TSConstructSignatureDeclaration,
|
|
116
119
|
TSEnumBody,
|
|
120
|
+
TSEnumDeclaration,
|
|
117
121
|
TSEnumMember,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
TSTypeOperator,
|
|
125
|
-
TSArrayType,
|
|
122
|
+
TSExportAssignment,
|
|
123
|
+
TSExternalModuleReference,
|
|
124
|
+
TSFunctionType,
|
|
125
|
+
TSImportEqualsDeclaration,
|
|
126
|
+
TSImportType,
|
|
127
|
+
TSImportTypeQualifiedName,
|
|
126
128
|
TSIndexedAccessType,
|
|
127
|
-
|
|
129
|
+
TSIndexSignature,
|
|
130
|
+
TSIndexSignatureName,
|
|
131
|
+
TSInferType,
|
|
132
|
+
TSInstantiationExpression,
|
|
133
|
+
TSInterfaceBody,
|
|
134
|
+
TSInterfaceDeclaration,
|
|
135
|
+
TSInterfaceHeritage,
|
|
136
|
+
TSIntersectionType,
|
|
137
|
+
TSIntrinsicKeyword,
|
|
138
|
+
TSLiteralType,
|
|
139
|
+
TSMappedType,
|
|
140
|
+
TSMethodSignature,
|
|
141
|
+
TSModuleBlock,
|
|
142
|
+
TSModuleDeclaration,
|
|
128
143
|
TSNamedTupleMember,
|
|
144
|
+
TSNamespaceExportDeclaration,
|
|
145
|
+
TSNeverKeyword,
|
|
146
|
+
TSNonNullExpression,
|
|
147
|
+
TSNullKeyword,
|
|
148
|
+
TSNumberKeyword,
|
|
149
|
+
TSObjectKeyword,
|
|
129
150
|
TSOptionalType,
|
|
151
|
+
TSParenthesizedType,
|
|
152
|
+
TSPropertySignature,
|
|
153
|
+
TSQualifiedName,
|
|
130
154
|
TSRestType,
|
|
131
|
-
|
|
155
|
+
TSSatisfiesExpression,
|
|
132
156
|
TSStringKeyword,
|
|
133
|
-
TSBooleanKeyword,
|
|
134
|
-
TSNumberKeyword,
|
|
135
|
-
TSNeverKeyword,
|
|
136
|
-
TSIntrinsicKeyword,
|
|
137
|
-
TSUnknownKeyword,
|
|
138
|
-
TSNullKeyword,
|
|
139
|
-
TSUndefinedKeyword,
|
|
140
|
-
TSVoidKeyword,
|
|
141
157
|
TSSymbolKeyword,
|
|
158
|
+
TSTemplateLiteralType,
|
|
142
159
|
TSThisType,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
160
|
+
TSTupleType,
|
|
161
|
+
TSTypeAliasDeclaration,
|
|
162
|
+
TSTypeAnnotation,
|
|
163
|
+
TSTypeAssertion,
|
|
164
|
+
TSTypeLiteral,
|
|
165
|
+
TSTypeOperator,
|
|
148
166
|
TSTypeParameter,
|
|
149
167
|
TSTypeParameterDeclaration,
|
|
150
|
-
|
|
151
|
-
TSClassImplements,
|
|
152
|
-
TSInterfaceDeclaration,
|
|
153
|
-
TSInterfaceBody,
|
|
154
|
-
TSPropertySignature,
|
|
155
|
-
TSIndexSignature,
|
|
156
|
-
TSCallSignatureDeclaration,
|
|
157
|
-
TSMethodSignature,
|
|
158
|
-
TSConstructSignatureDeclaration,
|
|
159
|
-
TSIndexSignatureName,
|
|
160
|
-
TSInterfaceHeritage,
|
|
168
|
+
TSTypeParameterInstantiation,
|
|
161
169
|
TSTypePredicate,
|
|
162
|
-
TSModuleDeclaration,
|
|
163
|
-
TSModuleBlock,
|
|
164
|
-
TSTypeLiteral,
|
|
165
|
-
TSInferType,
|
|
166
170
|
TSTypeQuery,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
TSNamespaceExportDeclaration,
|
|
182
|
-
TSInstantiationExpression,
|
|
183
|
-
JSDocNullableType,
|
|
184
|
-
JSDocNonNullableType,
|
|
185
|
-
JSDocUnknownType,
|
|
186
|
-
} = require('./constructors.js');
|
|
171
|
+
TSTypeReference,
|
|
172
|
+
TSUndefinedKeyword,
|
|
173
|
+
TSUnionType,
|
|
174
|
+
TSUnknownKeyword,
|
|
175
|
+
TSVoidKeyword,
|
|
176
|
+
UnaryExpression,
|
|
177
|
+
UpdateExpression,
|
|
178
|
+
V8IntrinsicExpression,
|
|
179
|
+
VariableDeclaration,
|
|
180
|
+
VariableDeclarator,
|
|
181
|
+
WhileStatement,
|
|
182
|
+
WithStatement,
|
|
183
|
+
YieldExpression,
|
|
184
|
+
} from './constructors.mjs';
|
|
187
185
|
|
|
188
|
-
|
|
186
|
+
export { walkProgram };
|
|
189
187
|
|
|
190
188
|
function walkProgram(pos, ast, visitors) {
|
|
191
189
|
const enterExit = visitors[38];
|
package/{index.js → index.mjs}
RENAMED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { parseAsync as parseAsyncBinding, parseSync as parseSyncBinding } from './bindings.mjs';
|
|
3
|
+
import { wrap } from './wrap.mjs';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
export {
|
|
6
|
+
ExportExportNameKind,
|
|
7
|
+
ExportImportNameKind,
|
|
8
|
+
ExportLocalNameKind,
|
|
9
|
+
ImportNameKind,
|
|
10
|
+
ParseResult,
|
|
11
|
+
Severity,
|
|
12
|
+
} from './bindings.mjs';
|
|
13
|
+
export { rawTransferSupported } from './raw-transfer/supported.mjs';
|
|
6
14
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
module.exports.ParseResult = bindings.ParseResult;
|
|
10
|
-
module.exports.ExportExportNameKind = bindings.ExportExportNameKind;
|
|
11
|
-
module.exports.ExportImportNameKind = bindings.ExportImportNameKind;
|
|
12
|
-
module.exports.ExportLocalNameKind = bindings.ExportLocalNameKind;
|
|
13
|
-
module.exports.ImportNameKind = bindings.ImportNameKind;
|
|
14
|
-
module.exports.Severity = bindings.Severity;
|
|
15
|
-
|
|
16
|
-
module.exports.parseSync = parseSync;
|
|
17
|
-
module.exports.parseAsync = parseAsync;
|
|
18
|
-
module.exports.experimentalGetLazyVisitor = experimentalGetLazyVisitor;
|
|
19
|
-
module.exports.rawTransferSupported = rawTransferSupported;
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
20
16
|
|
|
21
17
|
// Lazily loaded as needed
|
|
22
18
|
let parseSyncRaw = null,
|
|
@@ -31,7 +27,7 @@ let parseSyncRaw = null,
|
|
|
31
27
|
*/
|
|
32
28
|
function loadRawTransfer() {
|
|
33
29
|
if (parseSyncRaw === null) {
|
|
34
|
-
({ parseSyncRaw, parseAsyncRaw } = require('./raw-transfer/eager.
|
|
30
|
+
({ parseSyncRaw, parseAsyncRaw } = require('./raw-transfer/eager.mjs'));
|
|
35
31
|
}
|
|
36
32
|
}
|
|
37
33
|
|
|
@@ -41,7 +37,7 @@ function loadRawTransfer() {
|
|
|
41
37
|
*/
|
|
42
38
|
function loadRawTransferLazy() {
|
|
43
39
|
if (parseSyncLazy === null) {
|
|
44
|
-
({ parseSyncLazy, parseAsyncLazy, Visitor } = require('./raw-transfer/lazy.
|
|
40
|
+
({ parseSyncLazy, parseAsyncLazy, Visitor } = require('./raw-transfer/lazy.mjs'));
|
|
45
41
|
}
|
|
46
42
|
}
|
|
47
43
|
|
|
@@ -55,7 +51,7 @@ function loadRawTransferLazy() {
|
|
|
55
51
|
* @throws {Error} - If `experimentalRawTransfer` or `experimentalLazy` option is enabled,
|
|
56
52
|
* and raw transfer is not supported on this platform
|
|
57
53
|
*/
|
|
58
|
-
function parseSync(filename, sourceText, options) {
|
|
54
|
+
export function parseSync(filename, sourceText, options) {
|
|
59
55
|
if (options?.experimentalRawTransfer) {
|
|
60
56
|
loadRawTransfer();
|
|
61
57
|
return parseSyncRaw(filename, sourceText, options);
|
|
@@ -87,7 +83,7 @@ function parseSync(filename, sourceText, options) {
|
|
|
87
83
|
* @throws {Error} - If `experimentalRawTransfer` or `experimentalLazy` option is enabled,
|
|
88
84
|
* and raw transfer is not supported on this platform
|
|
89
85
|
*/
|
|
90
|
-
async function parseAsync(filename, sourceText, options) {
|
|
86
|
+
export async function parseAsync(filename, sourceText, options) {
|
|
91
87
|
if (options?.experimentalRawTransfer) {
|
|
92
88
|
loadRawTransfer();
|
|
93
89
|
return await parseAsyncRaw(filename, sourceText, options);
|
|
@@ -103,7 +99,7 @@ async function parseAsync(filename, sourceText, options) {
|
|
|
103
99
|
* Get `Visitor` class to construct visitors with.
|
|
104
100
|
* @returns {function} - `Visitor` class
|
|
105
101
|
*/
|
|
106
|
-
function experimentalGetLazyVisitor() {
|
|
102
|
+
export function experimentalGetLazyVisitor() {
|
|
107
103
|
loadRawTransferLazy();
|
|
108
104
|
return Visitor;
|
|
109
105
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"browser": "wasm.mjs",
|
|
@@ -26,40 +26,39 @@
|
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"index.d.ts",
|
|
29
|
-
"index.
|
|
30
|
-
"wrap.cjs",
|
|
29
|
+
"index.mjs",
|
|
31
30
|
"wrap.mjs",
|
|
32
31
|
"wasm.mjs",
|
|
33
|
-
"bindings.
|
|
32
|
+
"bindings.mjs",
|
|
34
33
|
"webcontainer-fallback.js",
|
|
35
|
-
"generated/constants.
|
|
36
|
-
"generated/deserialize/js.
|
|
37
|
-
"generated/deserialize/ts.
|
|
38
|
-
"generated/lazy/constructors.
|
|
39
|
-
"generated/lazy/types.
|
|
40
|
-
"generated/lazy/walk.
|
|
41
|
-
"raw-transfer/common.
|
|
42
|
-
"raw-transfer/eager.
|
|
43
|
-
"raw-transfer/lazy.
|
|
44
|
-
"raw-transfer/lazy-common.
|
|
45
|
-
"raw-transfer/node-array.
|
|
46
|
-
"raw-transfer/supported.
|
|
47
|
-
"raw-transfer/visitor.
|
|
34
|
+
"generated/constants.mjs",
|
|
35
|
+
"generated/deserialize/js.mjs",
|
|
36
|
+
"generated/deserialize/ts.mjs",
|
|
37
|
+
"generated/lazy/constructors.mjs",
|
|
38
|
+
"generated/lazy/types.mjs",
|
|
39
|
+
"generated/lazy/walk.mjs",
|
|
40
|
+
"raw-transfer/common.mjs",
|
|
41
|
+
"raw-transfer/eager.mjs",
|
|
42
|
+
"raw-transfer/lazy.mjs",
|
|
43
|
+
"raw-transfer/lazy-common.mjs",
|
|
44
|
+
"raw-transfer/node-array.mjs",
|
|
45
|
+
"raw-transfer/supported.mjs",
|
|
46
|
+
"raw-transfer/visitor.mjs"
|
|
48
47
|
],
|
|
49
48
|
"publishConfig": {
|
|
50
49
|
"registry": "https://registry.npmjs.org/",
|
|
51
50
|
"access": "public"
|
|
52
51
|
},
|
|
53
52
|
"dependencies": {
|
|
54
|
-
"@oxc-project/types": "^0.
|
|
53
|
+
"@oxc-project/types": "^0.88.0"
|
|
55
54
|
},
|
|
56
55
|
"devDependencies": {
|
|
57
56
|
"@codspeed/vitest-plugin": "^4.0.0",
|
|
58
|
-
"@napi-rs/wasm-runtime": "1.0.
|
|
57
|
+
"@napi-rs/wasm-runtime": "1.0.3",
|
|
59
58
|
"@vitest/browser": "3.2.4",
|
|
60
59
|
"esbuild": "^0.25.0",
|
|
61
60
|
"playwright": "^1.51.0",
|
|
62
|
-
"tinypool": "^
|
|
61
|
+
"tinypool": "^2.0.0",
|
|
63
62
|
"typescript": "5.9.2",
|
|
64
63
|
"vitest": "3.2.4"
|
|
65
64
|
},
|
|
@@ -91,24 +90,24 @@
|
|
|
91
90
|
"dtsHeaderFile": "header.js"
|
|
92
91
|
},
|
|
93
92
|
"optionalDependencies": {
|
|
94
|
-
"@oxc-parser/binding-win32-x64-msvc": "0.
|
|
95
|
-
"@oxc-parser/binding-win32-arm64-msvc": "0.
|
|
96
|
-
"@oxc-parser/binding-linux-x64-gnu": "0.
|
|
97
|
-
"@oxc-parser/binding-linux-x64-musl": "0.
|
|
98
|
-
"@oxc-parser/binding-freebsd-x64": "0.
|
|
99
|
-
"@oxc-parser/binding-linux-arm64-gnu": "0.
|
|
100
|
-
"@oxc-parser/binding-linux-arm64-musl": "0.
|
|
101
|
-
"@oxc-parser/binding-linux-arm-gnueabihf": "0.
|
|
102
|
-
"@oxc-parser/binding-linux-arm-musleabihf": "0.
|
|
103
|
-
"@oxc-parser/binding-linux-s390x-gnu": "0.
|
|
104
|
-
"@oxc-parser/binding-linux-riscv64-gnu": "0.
|
|
105
|
-
"@oxc-parser/binding-darwin-x64": "0.
|
|
106
|
-
"@oxc-parser/binding-darwin-arm64": "0.
|
|
107
|
-
"@oxc-parser/binding-android-arm64": "0.
|
|
108
|
-
"@oxc-parser/binding-wasm32-wasi": "0.
|
|
93
|
+
"@oxc-parser/binding-win32-x64-msvc": "0.88.0",
|
|
94
|
+
"@oxc-parser/binding-win32-arm64-msvc": "0.88.0",
|
|
95
|
+
"@oxc-parser/binding-linux-x64-gnu": "0.88.0",
|
|
96
|
+
"@oxc-parser/binding-linux-x64-musl": "0.88.0",
|
|
97
|
+
"@oxc-parser/binding-freebsd-x64": "0.88.0",
|
|
98
|
+
"@oxc-parser/binding-linux-arm64-gnu": "0.88.0",
|
|
99
|
+
"@oxc-parser/binding-linux-arm64-musl": "0.88.0",
|
|
100
|
+
"@oxc-parser/binding-linux-arm-gnueabihf": "0.88.0",
|
|
101
|
+
"@oxc-parser/binding-linux-arm-musleabihf": "0.88.0",
|
|
102
|
+
"@oxc-parser/binding-linux-s390x-gnu": "0.88.0",
|
|
103
|
+
"@oxc-parser/binding-linux-riscv64-gnu": "0.88.0",
|
|
104
|
+
"@oxc-parser/binding-darwin-x64": "0.88.0",
|
|
105
|
+
"@oxc-parser/binding-darwin-arm64": "0.88.0",
|
|
106
|
+
"@oxc-parser/binding-android-arm64": "0.88.0",
|
|
107
|
+
"@oxc-parser/binding-wasm32-wasi": "0.88.0"
|
|
109
108
|
},
|
|
110
109
|
"scripts": {
|
|
111
|
-
"build-dev": "napi build --platform --js bindings.
|
|
110
|
+
"build-dev": "napi build --esm --platform --js bindings.mjs",
|
|
112
111
|
"build-test": "pnpm run build-dev --profile coverage",
|
|
113
112
|
"build": "pnpm run build-dev --features allocator --release",
|
|
114
113
|
"postbuild-dev": "node patch.mjs",
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const os = require('node:os');
|
|
4
|
-
const rawTransferSupported = require('./supported.js');
|
|
5
|
-
const {
|
|
6
|
-
parseSyncRaw: parseSyncRawBinding,
|
|
7
|
-
parseAsyncRaw: parseAsyncRawBinding,
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import {
|
|
8
3
|
getBufferOffset,
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
parseAsyncRaw as parseAsyncRawBinding,
|
|
5
|
+
parseSyncRaw as parseSyncRawBinding,
|
|
6
|
+
} from '../bindings.mjs';
|
|
7
|
+
import { BUFFER_ALIGN, BUFFER_SIZE, IS_TS_FLAG_POS } from '../generated/constants.mjs';
|
|
8
|
+
import { rawTransferSupported } from './supported.mjs';
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
parseSyncRawImpl,
|
|
14
|
-
parseAsyncRawImpl,
|
|
15
|
-
prepareRaw,
|
|
16
|
-
isJsAst,
|
|
17
|
-
returnBufferToCache,
|
|
18
|
-
};
|
|
10
|
+
export { isJsAst, parseAsyncRawImpl, parseSyncRawImpl, prepareRaw, returnBufferToCache };
|
|
19
11
|
|
|
20
12
|
// Throw an error if running on a platform which raw transfer doesn't support.
|
|
21
13
|
//
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { isJsAst, parseAsyncRawImpl, parseSyncRawImpl, returnBufferToCache } from './common.mjs';
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
module.exports = { parseSyncRaw, parseAsyncRaw };
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Parse JS/TS source synchronously on current thread, using raw transfer to speed up deserialization.
|
|
@@ -12,7 +11,7 @@ module.exports = { parseSyncRaw, parseAsyncRaw };
|
|
|
12
11
|
* @param {Object} options - Parsing options
|
|
13
12
|
* @returns {Object} - Object with property getters for `program`, `module`, `comments`, and `errors`
|
|
14
13
|
*/
|
|
15
|
-
function parseSyncRaw(filename, sourceText, options) {
|
|
14
|
+
export function parseSyncRaw(filename, sourceText, options) {
|
|
16
15
|
let _;
|
|
17
16
|
({ experimentalRawTransfer: _, ...options } = options);
|
|
18
17
|
return parseSyncRawImpl(filename, sourceText, options, deserialize);
|
|
@@ -36,7 +35,7 @@ function parseSyncRaw(filename, sourceText, options) {
|
|
|
36
35
|
* @param {Object} options - Parsing options
|
|
37
36
|
* @returns {Object} - Object with property getters for `program`, `module`, `comments`, and `errors`
|
|
38
37
|
*/
|
|
39
|
-
function parseAsyncRaw(filename, sourceText, options) {
|
|
38
|
+
export function parseAsyncRaw(filename, sourceText, options) {
|
|
40
39
|
let _;
|
|
41
40
|
({ experimentalRawTransfer: _, ...options } = options);
|
|
42
41
|
return parseAsyncRawImpl(filename, sourceText, options, deserialize);
|
|
@@ -56,7 +55,7 @@ function deserialize(buffer, sourceText, sourceByteLen) {
|
|
|
56
55
|
// Lazy load deserializer, and deserialize buffer to JS objects
|
|
57
56
|
let data;
|
|
58
57
|
if (isJsAst(buffer)) {
|
|
59
|
-
if (deserializeJS === null) deserializeJS = require('../generated/deserialize/js.
|
|
58
|
+
if (deserializeJS === null) deserializeJS = require('../generated/deserialize/js.mjs').deserialize;
|
|
60
59
|
data = deserializeJS(buffer, sourceText, sourceByteLen);
|
|
61
60
|
|
|
62
61
|
// Add a line comment for hashbang
|
|
@@ -65,7 +64,7 @@ function deserialize(buffer, sourceText, sourceByteLen) {
|
|
|
65
64
|
data.comments.unshift({ type: 'Line', value: hashbang.value, start: hashbang.start, end: hashbang.end });
|
|
66
65
|
}
|
|
67
66
|
} else {
|
|
68
|
-
if (deserializeTS === null) deserializeTS = require('../generated/deserialize/ts.
|
|
67
|
+
if (deserializeTS === null) deserializeTS = require('../generated/deserialize/ts.mjs').deserialize;
|
|
69
68
|
data = deserializeTS(buffer, sourceText, sourceByteLen);
|
|
70
69
|
// Note: Do not add line comment for hashbang, to match `@typescript-eslint/parser`.
|
|
71
70
|
// See https://github.com/oxc-project/oxc/blob/ea784f5f082e4c53c98afde9bf983afd0b95e44e/napi/parser/src/lib.rs#L106-L130
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
// Unique token which is not exposed publicly.
|
|
4
2
|
// Used to prevent user calling class constructors.
|
|
5
|
-
const TOKEN = {};
|
|
3
|
+
export const TOKEN = {};
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* Throw error when restricted class constructor is called by user code.
|
|
9
7
|
* @throws {Error}
|
|
10
8
|
*/
|
|
11
|
-
function constructorError() {
|
|
9
|
+
export function constructorError() {
|
|
12
10
|
throw new Error('Constructor is for internal use only');
|
|
13
11
|
}
|
|
14
|
-
|
|
15
|
-
module.exports = { TOKEN, constructorError };
|