Skip to content

Commit

Permalink
fix: missing field (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
Menci committed Jul 19, 2024
1 parent 800ce00 commit 81bf700
Show file tree
Hide file tree
Showing 3 changed files with 971 additions and 732 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@
"format": "prettier --write '**/*.{mjs,cjs,js,ts}'"
},
"devDependencies": {
"@types/jest": "^29.5.11",
"@types/uuid": "^9.0.7",
"@types/jest": "^29.5.12",
"@types/uuid": "^10.0.0",
"cz-conventional-changelog": "^3.3.0",
"esbuild": "^0.19.9",
"esbuild": "^0.23.0",
"jest": "^29.7.0",
"jest-extended": "^4.0.2",
"prettier": "^3.1.1",
"ts-jest": "^29.1.1",
"typescript": "^5.3.3",
"vite": "^5.0.7"
"prettier": "^3.3.3",
"ts-jest": "^29.2.3",
"typescript": "^5.5.3",
"vite": "^5.3.4"
},
"dependencies": {
"@rollup/plugin-virtual": "^3.0.2",
"@swc/core": "^1.3.100",
"uuid": "^9.0.1"
"@swc/core": "^1.7.0",
"uuid": "^10.0.0"
},
"peerDependencies": {
"vite": ">=2.8"
Expand Down
16 changes: 16 additions & 0 deletions src/utils/make-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export function makeIdentifier(name: string): SWC.Identifier {
return {
type: "Identifier",
span: span(),
// @ts-ignore SWC is missing the "ctxt" property's
ctxt: 0,
value: name,
optional: false
};
Expand All @@ -19,6 +21,8 @@ export function makeVariablesDeclaration(names: string[]): SWC.VariableDeclarati
return {
type: "VariableDeclaration",
span: span(),
// @ts-ignore SWC is missing the "ctxt" property's
ctxt: 0,
kind: "let",
declare: false,
declarations: names.map<SWC.VariableDeclarator>(name => ({
Expand All @@ -35,6 +39,8 @@ export function makeVariableInitDeclaration(name: string, value: SWC.Expression)
return {
type: "VariableDeclaration",
span: span(),
// @ts-ignore SWC is missing the "ctxt" property's
ctxt: 0,
kind: "let",
declare: false,
declarations: [
Expand Down Expand Up @@ -105,6 +111,8 @@ export function makeTryCatchStatement(
block: {
type: "BlockStatement",
span: span(),
// @ts-ignore SWC is missing the "ctxt" property's
ctxt: 0,
stmts: tryStatements
},
handler: {
Expand All @@ -114,6 +122,8 @@ export function makeTryCatchStatement(
body: {
type: "BlockStatement",
span: span(),
// @ts-ignore SWC is missing the "ctxt" property's
ctxt: 0,
stmts: catchStatements
}
},
Expand All @@ -129,15 +139,19 @@ export function makeArrowFunction(
return {
type: "ArrowFunctionExpression",
span: span(),
ctxt: 0,
params: args.map<SWC.Identifier>(arg => ({
type: "Identifier",
span: span(),
ctxt: 0,
value: arg,
optional: false
})),
body: {
type: "BlockStatement",
span: span(),
// @ts-ignore SWC is missing the "ctxt" property's
ctxt: 0,
stmts: statements
},
async: !!async,
Expand All @@ -159,6 +173,8 @@ export function makeCallExpression(functionExpression: SWC.Expression, args?: SW
return {
type: "CallExpression",
span: span(),
// @ts-ignore SWC is missing the "ctxt" property's
ctxt: 0,
// Put IIFE's function expression in (parenthesis)
callee:
functionExpression.type === "FunctionExpression" || functionExpression.type === "ArrowFunctionExpression"
Expand Down
Loading

0 comments on commit 81bf700

Please sign in to comment.