Skip to content

Commit ef18a41

Browse files
committed
feat: update assemblyscript
1 parent a1b48de commit ef18a41

File tree

4 files changed

+32
-52
lines changed

4 files changed

+32
-52
lines changed

package.json

+4-7
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"md:deploy:gh-pages": "gh-pages -d dist/examples/markdown-parser"
4040
},
4141
"devDependencies": {
42-
"@assemblyscript/loader": "~0.19.23",
42+
"@assemblyscript/loader": "~0.27.22",
4343
"@babel/core": "^7.23.6",
4444
"@babel/plugin-proposal-class-properties": "^7.13.0",
4545
"@babel/plugin-proposal-export-default-from": "^7.23.3",
@@ -51,7 +51,7 @@
5151
"@rollup/plugin-json": "^6.1.0",
5252
"@rollup/plugin-node-resolve": "^15.2.3",
5353
"@rollup/plugin-typescript": "^11.1.5",
54-
"assemblyscript": "~0.19.23",
54+
"assemblyscript": "~0.27.22",
5555
"chokidar-cli": "^3.0.0",
5656
"cpy-cli": "^5.0.0",
5757
"desm": "^1.3.0",
@@ -115,10 +115,7 @@
115115
],
116116
"homepage": "https://github.com/torch2424/as-bind#readme",
117117
"peerDependencies": {
118-
"@assemblyscript/loader": "0.19.x",
119-
"assemblyscript": "0.19.x"
120-
},
121-
"dependencies": {
122-
"visitor-as": "~0.8.0"
118+
"@assemblyscript/loader": "0.27.x",
119+
"assemblyscript": "0.27.x"
123120
}
124121
}

pnpm-lock.yaml

+18-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/test-runner.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Express from "express";
66
import Mocha from "mocha";
77
import { glob } from "glob";
88
import pptr from "puppeteer";
9-
import asc from "assemblyscript/cli/asc";
9+
import asc from "assemblyscript/dist/asc.js";
1010
import AsBind from "../dist/as-bind.cjs.js";
1111

1212
const require = createRequire(import.meta.url);

transform.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import {
22
CommonFlags,
33
NodeKind,
44
ElementKind,
5-
Transform,
65
IdentifierExpression,
76
FunctionPrototype,
87
StringLiteralExpression,
98
Module,
109
Function,
1110
DeclaredElement,
1211
Type
13-
} from "visitor-as/as";
12+
} from "assemblyscript/dist/assemblyscript.js";
13+
import { Transform } from "assemblyscript/dist/transform.js";
1414
import { TypeDef } from "./lib/types";
1515

1616
function isInternalElement(element: DeclaredElement) {
@@ -77,18 +77,18 @@ export default class AsBindTransform extends Transform {
7777
const flatExportedFunctions = [
7878
...this.program.elementsByDeclaration.values()
7979
]
80-
.filter(el => elementHasFlag(el, CommonFlags.MODULE_EXPORT))
80+
.filter(el => elementHasFlag(el, CommonFlags.ModuleExport))
8181
.filter(el => !isInternalElement(el))
8282
.filter(
83-
el => el.declaration.kind === NodeKind.FUNCTIONDECLARATION
83+
el => el.declaration.kind === NodeKind.FunctionDeclaration
8484
) as FunctionPrototype[];
8585
const flatImportedFunctions = [
8686
...this.program.elementsByDeclaration.values()
8787
]
88-
.filter(el => elementHasFlag(el, CommonFlags.DECLARE))
88+
.filter(el => elementHasFlag(el, CommonFlags.Declare))
8989
.filter(el => !isInternalElement(el))
9090
.filter(
91-
v => v.declaration.kind === NodeKind.FUNCTIONDECLARATION
91+
v => v.declaration.kind === NodeKind.FunctionDeclaration
9292
) as FunctionPrototype[];
9393

9494
const typeIds: TypeDef["typeIds"] = {};
@@ -108,8 +108,8 @@ export default class AsBindTransform extends Transform {
108108

109109
const iFunction = importedFunction.instances.get("")!;
110110

111-
let external_module;
112-
let external_name;
111+
let external_module: string | undefined;
112+
let external_name: string | undefined;
113113

114114
let decorators = iFunction.declaration.decorators;
115115

@@ -147,7 +147,7 @@ export default class AsBindTransform extends Transform {
147147
importedFunctionName = external_name;
148148
} else if (
149149
iFunction.parent &&
150-
iFunction.parent.kind === ElementKind.NAMESPACE
150+
iFunction.parent.kind === ElementKind.Namespace
151151
) {
152152
importedFunctionName = iFunction.parent.name + "." + iFunction.name;
153153
}

0 commit comments

Comments
 (0)