Skip to content

Commit 7df1496

Browse files
committed
fix: missing field ctxt (#52)
1 parent 800ce00 commit 7df1496

File tree

3 files changed

+971
-732
lines changed

3 files changed

+971
-732
lines changed

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@
2929
"format": "prettier --write '**/*.{mjs,cjs,js,ts}'"
3030
},
3131
"devDependencies": {
32-
"@types/jest": "^29.5.11",
33-
"@types/uuid": "^9.0.7",
32+
"@types/jest": "^29.5.12",
33+
"@types/uuid": "^10.0.0",
3434
"cz-conventional-changelog": "^3.3.0",
35-
"esbuild": "^0.19.9",
35+
"esbuild": "^0.23.0",
3636
"jest": "^29.7.0",
3737
"jest-extended": "^4.0.2",
38-
"prettier": "^3.1.1",
39-
"ts-jest": "^29.1.1",
40-
"typescript": "^5.3.3",
41-
"vite": "^5.0.7"
38+
"prettier": "^3.3.3",
39+
"ts-jest": "^29.2.3",
40+
"typescript": "^5.5.3",
41+
"vite": "^5.3.4"
4242
},
4343
"dependencies": {
4444
"@rollup/plugin-virtual": "^3.0.2",
45-
"@swc/core": "^1.3.100",
46-
"uuid": "^9.0.1"
45+
"@swc/core": "^1.7.0",
46+
"uuid": "^10.0.0"
4747
},
4848
"peerDependencies": {
4949
"vite": ">=2.8"

src/utils/make-node.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export function makeIdentifier(name: string): SWC.Identifier {
88
return {
99
type: "Identifier",
1010
span: span(),
11+
// @ts-ignore SWC is missing the "ctxt" property's
12+
ctxt: 0,
1113
value: name,
1214
optional: false
1315
};
@@ -19,6 +21,8 @@ export function makeVariablesDeclaration(names: string[]): SWC.VariableDeclarati
1921
return {
2022
type: "VariableDeclaration",
2123
span: span(),
24+
// @ts-ignore SWC is missing the "ctxt" property's
25+
ctxt: 0,
2226
kind: "let",
2327
declare: false,
2428
declarations: names.map<SWC.VariableDeclarator>(name => ({
@@ -35,6 +39,8 @@ export function makeVariableInitDeclaration(name: string, value: SWC.Expression)
3539
return {
3640
type: "VariableDeclaration",
3741
span: span(),
42+
// @ts-ignore SWC is missing the "ctxt" property's
43+
ctxt: 0,
3844
kind: "let",
3945
declare: false,
4046
declarations: [
@@ -105,6 +111,8 @@ export function makeTryCatchStatement(
105111
block: {
106112
type: "BlockStatement",
107113
span: span(),
114+
// @ts-ignore SWC is missing the "ctxt" property's
115+
ctxt: 0,
108116
stmts: tryStatements
109117
},
110118
handler: {
@@ -114,6 +122,8 @@ export function makeTryCatchStatement(
114122
body: {
115123
type: "BlockStatement",
116124
span: span(),
125+
// @ts-ignore SWC is missing the "ctxt" property's
126+
ctxt: 0,
117127
stmts: catchStatements
118128
}
119129
},
@@ -129,15 +139,19 @@ export function makeArrowFunction(
129139
return {
130140
type: "ArrowFunctionExpression",
131141
span: span(),
142+
ctxt: 0,
132143
params: args.map<SWC.Identifier>(arg => ({
133144
type: "Identifier",
134145
span: span(),
146+
ctxt: 0,
135147
value: arg,
136148
optional: false
137149
})),
138150
body: {
139151
type: "BlockStatement",
140152
span: span(),
153+
// @ts-ignore SWC is missing the "ctxt" property's
154+
ctxt: 0,
141155
stmts: statements
142156
},
143157
async: !!async,
@@ -159,6 +173,8 @@ export function makeCallExpression(functionExpression: SWC.Expression, args?: SW
159173
return {
160174
type: "CallExpression",
161175
span: span(),
176+
// @ts-ignore SWC is missing the "ctxt" property's
177+
ctxt: 0,
162178
// Put IIFE's function expression in (parenthesis)
163179
callee:
164180
functionExpression.type === "FunctionExpression" || functionExpression.type === "ArrowFunctionExpression"

0 commit comments

Comments
 (0)