Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

visitor-as

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

visitor-as - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

as/index.d.ts

2

as-pect.config.js

@@ -18,3 +18,3 @@ module.exports = {

"--runtime": ["none"], // Acceptable values are: full, half, stub (arena), and none
// "--transform": ["./src/examples/list.ts"],
"--transform": ["./src/examples/capitalize.ts"],
},

@@ -21,0 +21,0 @@ /**

@@ -1,3 +0,3 @@

export var Transform: any;
declare const _exports: any;
export = _exports;
export * from "assemblyscript";
export * from "assemblyscript/cli/transform";
export * from "assemblyscript/cli/asc";
"use strict";
//@ts-ignore
const path = require("path");
let ascPath = Object.getOwnPropertyNames(require.cache).filter(s => s.endsWith("asc.js"))[0];
let ascPath = Object.getOwnPropertyNames(require.cache).filter((s) =>
s.endsWith("asc.js")
)[0];
//@ts-ignore
let assemblyscriptPath = Object.getOwnPropertyNames(require.cache).filter(s => s.endsWith("assemblyscript.js"))[0];
let assemblyscriptPath = Object.getOwnPropertyNames(require.cache).filter((s) =>
s.endsWith("assemblyscript.js")
)[0];
let transformerPath;
if (assemblyscriptPath) {
let splitPath = assemblyscriptPath.split(path.sep).slice(0, -2);
transformerPath = splitPath.concat(["cli", "transform"]).join(path.sep);
let splitPath = assemblyscriptPath.split(path.sep).slice(0, -2);
transformerPath = splitPath.concat(["cli", "transform"]).join(path.sep);
} else {
assemblyscriptPath = require.resolve("assemblyscript");
ascPath = require.resolve("assemblyscript/cli/asc");
transformerPath = require.resolve("assemblyscript/cli/transform");
}
else {
assemblyscriptPath = require.resolve("assemblyscript");
ascPath = require.resolve("assemblyscript/cli/asc");
transformerPath = require.resolve("assemblyscript/cli/transform");
}
const assemblyscript = require(assemblyscriptPath);
//@ts-ignore
module.exports.Transform = require(transformerPath).Transform;
module.exports = Object.assign(Object.assign(Object.assign(Object.assign({}, require(ascPath)), module.exports), assemblyscript), assemblyscript.util // Need to add because newer version adds namespace
module.exports = Object.assign(
Object.assign(
Object.assign(Object.assign({}, require(ascPath)), module.exports),
assemblyscript
),
assemblyscript.util // Need to add because newer version adds namespace
);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXMvaW5kZXguanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFlBQVk7QUFDWixNQUFNLElBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7QUFFN0IsSUFBSSxPQUFPLEdBQUcsTUFBTSxDQUFDLG1CQUFtQixDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsUUFBUSxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFFN0YsWUFBWTtBQUNaLElBQUksa0JBQWtCLEdBQUcsTUFBTSxDQUFDLG1CQUFtQixDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsUUFBUSxDQUFDLG1CQUFtQixDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUVuSCxJQUFJLGVBQWUsQ0FBQztBQUNwQixJQUFJLGtCQUFrQixFQUFFO0lBQ3RCLElBQUksU0FBUyxHQUFHLGtCQUFrQixDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ2hFLGVBQWUsR0FBSSxTQUFTLENBQUMsTUFBTSxDQ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dGguc2VwKS5zbGljZSgwLCAtMik7XG4gIHRyYW5zZm9ybWVyUGF0aCA9ICBzcGxpdFBhdGguY29uY2F0KFsgXCJjbGlcIiwgXCJ0cmFuc2Zvcm1cIl0pLmpvaW4ocGF0aC5zZXApO1xufSBlbHNlIHtcbiAgYXNzZW1ibHlzY3JpcHRQYXRoID0gcmVxdWlyZS5yZXNvbHZlKFwiYXNzZW1ibHlzY3JpcHRcIik7XG4gIGFzY1BhdGggPSByZXF1aXJlLnJlc29sdmUoXCJhc3NlbWJseXNjcmlwdC9jbGkvYXNjXCIpO1xuICB0cmFuc2Zvcm1lclBhdGggPSByZXF1aXJlLnJlc29sdmUoXCJhc3NlbWJseXNjcmlwdC9jbGkvdHJhbnNmb3JtXCIpO1xufVxuY29uc3QgYXNzZW1ibHlzY3JpcHQgPSByZXF1aXJlKGFzc2VtYmx5c2NyaXB0UGF0aCk7XG5cbi8vQHRzLWlnbm9yZVxubW9kdWxlLmV4cG9ydHMuVHJhbnNmb3JtID0gcmVxdWlyZSh0cmFuc2Zvcm1lclBhdGgpLlRyYW5zZm9ybTtcbm1vZHVsZS5leHBvcnRzID0ge1xuICAgICAgICAgICAgICAgICAgLi4ucmVxdWlyZShhc2NQYXRoKSxcbiAgICAgICAgICAgICAgICAgIC4uLm1vZHVsZS5leHBvcnRzLFxuICAgICAgICAgICAgICAgICAgLi4uYXNzZW1ibHlzY3JpcHQsXG4gICAgICAgICAgICAgICAgICAuLi5hc3NlbWJseXNjcmlwdC51dGlsIC8vIE5lZWQgdG8gYWRkIGJlY2F1c2UgbmV3ZXIgdmVyc2lvbiBhZGRzIG5hbWVzcGFjZVxuICAgICAgICAgICAgICAgIH07Il19

@@ -1,2 +0,2 @@

import { Node, Source, NamedTypeNode, FunctionTypeNode, TypeName, TypeParameterNode, IdentifierExpression, AssertionExpression, BinaryExpression, CallExpression, ClassExpression, CommaExpression, ElementAccessExpression, FunctionExpression, InstanceOfExpression, LiteralExpression, NewExpression, ParenthesizedExpression, PropertyAccessExpression, TernaryExpression, UnaryPostfixExpression, UnaryPrefixExpression, BlockStatement, BreakStatement, ContinueStatement, DoStatement, EmptyStatement, ExportStatement, ExportDefaultStatement, ExportImportStatement, ExpressionStatement, ForStatement, IfStatement, ImportStatement, ReturnStatement, SwitchStatement, ThrowStatement, TryStatement, VariableStatement, WhileStatement, ClassDeclaration, EnumDeclaration, EnumValueDeclaration, FieldDeclaration, FunctionDeclaration, ImportDeclaration, IndexSignatureDeclaration, InterfaceDeclaration, MethodDeclaration, NamespaceDeclaration, TypeDeclaration, VariableDeclaration, DecoratorNode, ExportMember, ParameterNode, SwitchCase, TypeNode, ArrayLiteralExpression, ObjectLiteralExpression, FloatLiteralExpression, IntegerLiteralExpression, StringLiteralExpression, RegexpLiteralExpression, UnaryExpression, SuperExpression, FalseExpression, TrueExpression, ThisExpression, NullExpression, ConstructorExpression, Statement, VoidStatement, CommentNode } from "./as";
import { Node, Source, NamedTypeNode, FunctionTypeNode, TypeName, TypeParameterNode, IdentifierExpression, AssertionExpression, BinaryExpression, CallExpression, ClassExpression, CommaExpression, ElementAccessExpression, FunctionExpression, InstanceOfExpression, LiteralExpression, NewExpression, ParenthesizedExpression, PropertyAccessExpression, TernaryExpression, UnaryPostfixExpression, UnaryPrefixExpression, BlockStatement, BreakStatement, ContinueStatement, DoStatement, EmptyStatement, ExportStatement, ExportDefaultStatement, ExportImportStatement, ExpressionStatement, ForStatement, IfStatement, ImportStatement, ReturnStatement, SwitchStatement, ThrowStatement, TryStatement, VariableStatement, WhileStatement, ClassDeclaration, EnumDeclaration, EnumValueDeclaration, FieldDeclaration, FunctionDeclaration, ImportDeclaration, IndexSignatureDeclaration, InterfaceDeclaration, MethodDeclaration, NamespaceDeclaration, TypeDeclaration, VariableDeclaration, DecoratorNode, ExportMember, ParameterNode, SwitchCase, TypeNode, ArrayLiteralExpression, ObjectLiteralExpression, FloatLiteralExpression, IntegerLiteralExpression, StringLiteralExpression, RegexpLiteralExpression, UnaryExpression, SuperExpression, FalseExpression, TrueExpression, ThisExpression, NullExpression, ConstructorExpression, Statement, VoidStatement, CommentNode } from "../as";
import { AbstractVisitor } from "./visitor";

@@ -3,0 +3,0 @@ export declare class BaseVisitor extends AbstractVisitor<Node> {

@@ -1,7 +0,2 @@

import { ASTTransformVisitor } from '../transformer';
import { Program, StringLiteralExpression } from '../as';
declare class CapitalizeVisitor extends ASTTransformVisitor {
visitStringLiteralExpression(node: StringLiteralExpression): void;
afterInitialize(program: Program): void;
}
export = CapitalizeVisitor;
declare const _default: typeof import("../decorator").TopLevelDecorator;
export = _default;
"use strict";
const transformer_1 = require("../transformer");
const utils_1 = require("../utils");
class CapitalizeVisitor extends transformer_1.ASTTransformVisitor {
const decorator_1 = require("../decorator");
class CapitalizeVisitor extends decorator_1.VariableDecorator {
visitVariableDeclaration(node) {
this.visit(node.initializer);
}
get name() {
return "capitalize";
}
visitStringLiteralExpression(node) {
node.value = node.value.toUpperCase();
this.stdout.write(node.value + "\n");
const newNode = utils_1.cloneNode(node);
newNode.value = node.value.toUpperCase();
this.replaceCurrentNode(newNode);
this.stdout.write(node.value + " -> " + newNode.value + "\n");
}
afterInitialize(program) {
const sources = program.sources.filter(utils_1.not(utils_1.isLibrary));
this.visit(sources);
}
}
module.exports = CapitalizeVisitor;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FwaXRhbGl6ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leGFtcGxlcy9jYXBpdGFsaXplLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxnREFBcUQ7QUFDckQsb0NBQTBDO0FBYzFDLE1BQU0saUJBQWtCLFNBQVEsaUNBQW1CO0lBRy9DLDRCQUE0QixDQUFDLElBQTZCO1FBQ3hELElBQUksQ0FBQyxLQUFLLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxXQUFXLEVBQUUsQ0FBQ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XCIpO1xuICAgIH1cblxuICAgIGFmdGVySW5pdGlhbGl6ZShwcm9ncmFtOiBQcm9ncmFtKTogdm9pZCB7XG4gICAgICBjb25zdCBzb3VyY2VzID0gcHJvZ3JhbS5zb3VyY2VzLmZpbHRlcihub3QoaXNMaWJyYXJ5KSk7XG4gICAgICB0aGlzLnZpc2l0KHNvdXJjZXMpO1xuICAgIH1cbn1cblxuZXhwb3J0ID0gQ2FwaXRhbGl6ZVZpc2l0b3I7Il19
module.exports = decorator_1.registerDecorator(new CapitalizeVisitor());
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FwaXRhbGl6ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leGFtcGxlcy9jYXBpdGFsaXplLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxvQ0FBcUM7QUFDckMsNENBQW9FO0FBR3BFLE1BQU0saUJBQWtCLFNBQVEsNkJBQWlCO0lBQy9DLHdCQUF3QixDQUFDLElBQXlCO1FBQ2hELElBQUksQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLFdBQVcsQ0FBQyxDQUFDO0lBQy9CLENBQUM7SUFFRCxJQUFJLElBQUk7UUFDTixPQUFPLFlBQVksQ0FBQztJQUN0QixDQUFDO0lBRUQsNEJBQTRCLENBQUMsSUFBNkI7UUFDeEQsTUFBTSxPQUFPLEdBQUcsaUJBQVMsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUNoQyxPQUFPLENBQUMsS0FBSyxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsV0FBVyxFQUFFLENBQUM7UUFDekMsSUFBSSxDQUFDLGtCQUFrQixDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQ2pDLElBQUksQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxLQUFLLEdBQUcsTUFBTSxHQUFHLE9BQU8sQ0F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lZ2lzdGVyRGVjb3JhdG9yKG5ldyBDYXBpdGFsaXplVmlzaXRvcigpKTtcbiJdfQ==

@@ -1,9 +0,2 @@

import { ASTTransformVisitor } from '../transformer';
import { ClassDeclaration, Program, FieldDeclaration, MethodDeclaration } from '../as';
declare class ListVisitor extends ASTTransformVisitor {
visitFieldDeclaration(node: FieldDeclaration): void;
visitMethodDeclaration(node: MethodDeclaration): void;
visitClassDeclaration(node: ClassDeclaration): void;
afterInitialize(program: Program): void;
}
export = ListVisitor;
declare const _default: typeof import("../decorator").TopLevelDecorator;
export = _default;
"use strict";
const transformer_1 = require("../transformer");
const decorator_1 = require("../decorator");
const utils_1 = require("../utils");
class ListVisitor extends transformer_1.ASTTransformVisitor {
class ListMembers extends decorator_1.ClassDecorator {
visitFieldDeclaration(node) {
const mem = this.program.getElementByDeclaration(node);
const name = mem.name;
const _type = this.program.resolver.resolveType(mem.typeNode, mem);
this.stdout.write(name + ": " + _type.toString() + "\n");
if (!node.name)
console.log(utils_1.toString(node) + "\n");
const name = utils_1.toString(node.name);
const _type = utils_1.toString(node.type);
this.stdout.write(name + ": " + _type + "\n");
}
visitMethodDeclaration(node) { }
visitClassDeclaration(node) {
if (utils_1.hasDecorator(node, "list")) {
super.visit(node.members);
visitMethodDeclaration(node) {
const name = utils_1.toString(node.name);
if (name == "constructor") {
return;
}
const sig = utils_1.toString(node.signature);
this.stdout.write(name + ": " + sig + "\n");
}
afterInitialize(program) {
this.visit(program.sources);
visitClassDeclaration(node) {
this.visit(node.members);
}
get name() {
return "list";
}
}
module.exports = ListVisitor;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leGFtcGxlcy9saXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxnREFBcUQ7QUFRckQsb0NBQXdDO0FBSXhDLE1BQU0sV0F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lID0gdG9TdHJpbmcobm9kZS5uYW1lKTtcbiAgICBpZiAobmFtZSA9PSBcImNvbnN0cnVjdG9yXCIpIHtcbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgY29uc3Qgc2lnID0gdG9TdHJpbmcobm9kZS5zaWduYXR1cmUpO1xuICAgIHRoaXMuc3Rkb3V0LndyaXRlKG5hbWUgKyBcIjogXCIgKyBzaWcgKyBcIlxcblwiKTtcbiAgfVxuXG4gIHZpc2l0Q2xhc3NEZWNsYXJhdGlvbihub2RlOiBDbGFzc0RlY2xhcmF0aW9uKTogdm9pZCB7XG4gICAgdGhpcy52aXNpdChub2RlLm1lbWJlcnMpO1xuICB9XG5cbiAgZ2V0IG5hbWUoKTogc3RyaW5nIHtcbiAgICByZXR1cm4gXCJsaXN0XCI7XG4gIH1cbn1cblxuZXhwb3J0ID0gcmVnaXN0ZXJEZWNvcmF0b3IobmV3IExpc3RNZW1iZXJzKCkpO1xuIl19
"use strict";
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbIiJdfQ==
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./base"));
__export(require("./transformer"));
__export(require("./visitor"));
__export(require("./astBuilder"));
__export(require("./decorator"));
__export(require("./path"));
const utils = require("./utils");
exports.utils = utils;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSw0QkFBdUI7QUFDdkIsbUNBQThCO0FBQzlCLCtCQUEwQjtBQUMxQixrQ0FBNkI7QUFDN0IsaUNBQTRCO0FBQzVCLDRCQUF1QjtBQUV2QixpQ0FBaUM7QUFFeEIsc0JBQUsiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tIFwiLi9iYXNlXCI7XG5leHBvcnQgKiBmcm9tIFwiLi90cmFuc2Zvcm1lclwiO1xuZXhwb3J0ICogZnJvbSBcIi4vdmlzaXRvclwiO1xuZXhwb3J0ICogZnJvbSBcIi4vYXN0QnVpbGRlclwiO1xuZXhwb3J0ICogZnJvbSBcIi4vZGVjb3JhdG9yXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9wYXRoXCI7XG5cbmltcG9ydCAqIGFzIHV0aWxzIGZyb20gXCIuL3V0aWxzXCI7XG5cbmV4cG9ydCB7IHV0aWxzIH07XG4iXX0=

@@ -1,12 +0,30 @@

import { BaseVisitor } from './base';
import { Transform, Program, OutputStream } from './as';
export declare abstract class ASTTransformVisitor extends BaseVisitor implements Transform {
program: Program;
baseDir: string;
stdout: OutputStream;
stderr: OutputStream;
log: (message?: any, ...optionalParams: any[]) => void;
writeFile: (filename: string, contents: string | Uint8Array, baseDir: string) => boolean;
readFile: (filename: string, baseDir: string) => string | null;
listFiles: (dirname: string, baseDir: string) => string[] | null;
import { BaseVisitor } from "./base";
import { Transform as _Transform } from "../as";
import { ASTBuilder } from "./astBuilder";
import { PathVisitor } from "./path";
declare class Transform extends _Transform {
}
declare const ASTTransformVisitor_base: import("ts-mixer/dist/types").Class<[], BaseVisitor & Transform, {
prototype: BaseVisitor;
} & {
prototype: Transform;
}>;
export declare class ASTTransformVisitor extends ASTTransformVisitor_base {
}
declare const ASTBuilderVisitor_base: import("ts-mixer/dist/types").Class<[], ASTBuilder & Transform, {
prototype: ASTBuilder;
build: typeof ASTBuilder.build;
} & {
prototype: Transform;
}>;
export declare class ASTBuilderVisitor extends ASTBuilderVisitor_base {
}
declare const PathTransformVisitor_base: import("ts-mixer/dist/types").Class<[], PathVisitor & Transform, {
prototype: PathVisitor;
} & {
prototype: Transform;
}>;
export declare class PathTransformVisitor extends PathTransformVisitor_base {
}
export declare function mergeTransformer(from: Transform, to: Transform): void;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const base_1 = require("./base");
class ASTTransformVisitor extends base_1.BaseVisitor {
const as_1 = require("../as");
const astBuilder_1 = require("./astBuilder");
const path_1 = require("./path");
const ts_mixer_1 = require("ts-mixer");
class Transform extends as_1.Transform {
}
class ASTTransformVisitor extends ts_mixer_1.Mixin(base_1.BaseVisitor, Transform) {
}
exports.ASTTransformVisitor = ASTTransformVisitor;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHJhbnNmb3JtZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpQ0FBcUM7QUFJckMsTUFBc0IsbUJBQW9CLFNBQVEsa0JBQVc7Q0FTNUQ7QUFURCxrREFTQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEJhc2VWaXNpdG9yIH0gZnJvbSAnLi9iYXNlJztcbmltcG9ydCB7IFRyYW5zZm9ybSwgUHJvZ3JhbSwgT3V0cHV0U3RyZWFtIH0gZnJvbSAnLi9hcyc7XG5cblxuZXhwb3J0IGFic3RyYWN0IGNsYXNzIEFTVFRyYW5zZm9ybVZpc2l0b3IgZXh0ZW5kcyBCYXNlVmlzaXRvciBpbXBsZW1lbnRzIFRyYW5zZm9ybSAge1xuICBwcm9ncmFtOiBQcm9ncmFtO1xuICBiYXNlRGlyOiBzdHJpbmc7XG4gIHN0ZG91dDogT3V0cHV0U3RyZWFtO1xuICBzdGRlcnI6IE91dHB1dFN0cmVhbTtcbiAgbG9nOiAobWVzc2FnZT86IGFueSwgLi4ub3B0aW9uYWxQYXJhbXM6IGFueVtdKSA9PiB2b2lkO1xuICB3cml0ZUZpbGU6IChmaWxlbmFtZTogc3RyaW5nLCBjb250ZW50czogc3RyaW5nIHwgVWludDhBcnJheSwgYmFzZURpcjogc3RyaW5nKSA9PiBib29sZWFuO1xuICByZWFkRmlsZTogKGZpbGVuYW1lOiBzdHJpbmcsIGJhc2VEaXI6IHN0cmluZykgPT4gc3RyaW5nIHwgbnVsbDtcbiAgbGlzdEZpbGVzOiAoZGlybmFtZTogc3RyaW5nLCBiYXNlRGlyOiBzdHJpbmcpID0+IHN0cmluZ1tdIHwgbnVsbDtcbn1cblxuIl19
class ASTBuilderVisitor extends ts_mixer_1.Mixin(astBuilder_1.ASTBuilder, Transform) {
}
exports.ASTBuilderVisitor = ASTBuilderVisitor;
class PathTransformVisitor extends ts_mixer_1.Mixin(path_1.PathVisitor, Transform) {
}
exports.PathTransformVisitor = PathTransformVisitor;
function mergeTransformer(from, to) {
//@ts-ignore
to.program = from.program;
//@ts-ignore
to.baseDir = from.baseDir;
//@ts-ignore
to.stdout = from.stdout;
//@ts-ignore
to.stderr = from.stderr;
//@ts-ignore
to.log = from.log;
to.writeFile = from.writeFile;
to.readFile = from.readFile;
to.listFiles = from.listFiles;
}
exports.mergeTransformer = mergeTransformer;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHJhbnNmb3JtZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpQ0FBcUM7QUFDckMsOEJBQWdEO0FBQ2hELDZDQUEwQztBQUMxQyxpQ0FBcUM7QUFDckMsdUNBQWlDO0FBRWpDLE1BQU0sU0FBVSxTQUFRLGNBQVU7Q0FBRztBQUVyQyxNQUFhLG1CQUFvQixTQUFRLGdCQUFLLENBQUMsa0JBQVcsRUFBRSxTQUFTLENBQUM7Q0FBRztBQUF6RSxrREFBeUU7Q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ationStatement, Source, Node } from "../as";
export declare function decorates(node: DecoratorNode, name: string): boolean;
export declare function isDecorator(name: string): (node: DecoratorNode) => boolean;

@@ -6,1 +7,3 @@ export declare function hasDecorator(node: DeclarationStatement, name: string): boolean;

export declare function not<T>(fn: (t: T) => boolean): (t: T) => boolean;
export declare function toString(node: Node): string;
export declare function cloneNode<T extends Node>(node: T): T;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const astBuilder_1 = require("./astBuilder");
const cloneDeep = require("lodash.clonedeep");
function decorates(node, name) {
return node.name.text === name;
}
exports.decorates = decorates;
function isDecorator(name) {
return (node) => node.name.text === name;
return (node) => decorates(node, name);
}

@@ -21,2 +27,10 @@ exports.isDecorator = isDecorator;

exports.not = not;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFFQSxTQUFnQixXQUFXLENBQUMsSUFBWTtJQUN0QyxPQUFPLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBdUIsSUFBSSxDQUFDLElBQUssQ0FBQyxJQUFJLEtBQUssSUFBSSxDQUFDO0FBQ2xFLENBQUM7QUFGRCxrQ0FFQztBQUVELFNBQWdCLFlBQVksQ0FBQyxJQUEwQixFQUFFLElBQVk7O0lBQ25FLGdDQUFnQztJQUNoQyxPQUFPLE9BQUEsSUFBSSxDQUFDLFVBQVUsMENBQUUsSUFBSSxDQUFDLFdBQVcsQ0FBQyxJQUFJLENBQUMsTUFBSyxJQUFJLENBQUM7QUFDMUQsQ0FBQztBQUhELG9DQUdDO0FBR0QsU0FBZ0IsU0FBUyxDQUFDLElBQVk7SUFDcEMsT0FBTyxJQUFJLENBQUMsU0FBUyxJQUFJLElBQUksQ0FBQyxZQUFZLENBQUMsVUFBVSxDQUFDLFVBQVUsQ0FBQyxDQUFD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AhZm4odCk7XG59Il19
function toString(node) {
return astBuilder_1.ASTBuilder.build(node);
}
exports.toString = toString;
function cloneNode(node) {
return cloneDeep(node);
}
exports.cloneNode = cloneNode;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFPQSw2Q0FBMEM7QUFFMUMsTUFBTSxTQUFTLEdBQW1CLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBRTlELFNBQWdCLFNBQVMsQ0FBQyxJQUFtQixFQUFFLElBQVk7SUFDekQsT0FBOEIsSUFBSSxDQUFDLElBQUssQ0FBQyxJQUFJLEtBQUssSUFBSSxDQUFDO0FBQ3pELENBQUM7QUFGRCw4QkFFQztBQUVELFNBQWdCLFdBQVcsQ0FBQyxJQUFZO0lBQ3RDLE9BQU8sQ0FBQyxJQUFJLEVBQUUsRUFBRSxDQUFDLFNBQVMsQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUM7QUFDekMsQ0FBQztBQUZELGtDQUVDO0FBRUQsU0FBZ0IsWUFBWSxDQUMxQixJQUEwQixFQUMxQixJQUFZOztJQUVaLGdDQUFnQztJQUNoQyxPQUFPLE9BQUEsSUFBSSxDQUFDLFVBQVUsMENBQUUsSUFBSSxDQUFDLFdBQVcsQ0FBQyxJQUFJLENBQUMsTUFBSyxJQUFJLENBQUM7QUFDMUQsQ0FBQztBQU5ELG9DQU1DO0FBRUQsU0FBZ0IsU0FBUyxDQUFDLElBQVk7SUFDcEMsT0FBTyxJQUFJLENBQUMsU0FBUyxJQUFJLElBQUksQ0FBQyxZQUFZLENBQUMsVUFBVSxDQUFDLFVBQVUsQ0FBQyxDQUFDO0FBQ3BFLENBQUM7QUFGRCw4QkFFQztBQUVELFNBQWdCLEdBQUcsQ0FBSSx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mdW5jdGlvbiBoYXNEZWNvcmF0b3IoXG4gIG5vZGU6IERlY2xhcmF0aW9uU3RhdGVtZW50LFxuICBuYW1lOiBzdHJpbmdcbik6IGJvb2xlYW4ge1xuICAvLyBiZWNhdXNlIGl0IGNvdWxkIGJlIHVuZGVmaW5lZFxuICByZXR1cm4gbm9kZS5kZWNvcmF0b3JzPy5zb21lKGlzRGVjb3JhdG9yKG5hbWUpKSA9PSB0cnVlO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gaXNMaWJyYXJ5KG5vZGU6IFNvdXJjZSk6IGJvb2xlYW4ge1xuICByZXR1cm4gbm9kZS5pc0xpYnJhcnkgfHwgbm9kZS5pbnRlcm5hbFBhdGguc3RhcnRzV2l0aChcIn5saWIvcnQvXCIpO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gbm90PFQ+KGZuOiAodDogVCkgPT4gYm9vbGVhbik6ICh0OiBUKSA9PiBib29sZWFuIHtcbiAgcmV0dXJuICh0OiBUKSA9PiAhZm4odCk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiB0b1N0cmluZyhub2RlOiBOb2RlKTogc3RyaW5nIHtcbiAgcmV0dXJuIEFTVEJ1aWxkZXIuYnVpbGQobm9kZSk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBjbG9uZU5vZGU8VCBleHRlbmRzIE5vZGU+KG5vZGU6IFQpOiBUIHtcbiAgcmV0dXJuIGNsb25lRGVlcChub2RlKTtcbn1cbiJdfQ==

@@ -17,3 +17,3 @@ "use strict";

if (node instanceof Array) {
node.map(node => this.visit(node));
node.map((node) => this.visit(node));
}

@@ -39,2 +39,2 @@ else if (node instanceof Map) {

exports.AbstractVisitor = AbstractVisitor;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmlzaXRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy92aXNpdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcG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0IGVhY2ggbWVtYmVyIG9mIHRoZSBjb2xsZWN0aW9uLlxuICovXG5leHBvcnQgYWJzdHJhY3QgY2xhc3MgQWJzdHJhY3RWaXNpdG9yPFQgZXh0ZW5kcyBvYmplY3Q+IHtcbiAgdmlzaXQobm9kZTogQ29sbGVjdGlvbjxUPiB8IG51bGwpOiB2b2lkIHtcbiAgICBpZiAobm9kZSA9PSBudWxsKSByZXR1cm47XG4gICAgaWYgKG5vZGUgaW5zdGFuY2VvZiBBcnJheSkge1xuICAgICAgbm9kZS5tYXAoKG5vZGUpID0+IHRoaXMudmlzaXQobm9kZSkpO1xuICAgIH0gZWxzZSBpZiAobm9kZSBpbnN0YW5jZW9mIE1hcCkge1xuICAgICAgZm9yIChsZXQgX25vZGUgb2Ygbm9kZS52YWx1ZXMoKSkge1xuICAgICAgICB0aGlzLnZpc2l0KF9ub2RlKTtcbiAgICAgIH1cbiAgICB9IGVsc2UgaWYgKGlzSXRlcmFibGUobm9kZSkpIHtcbiAgICAgIC8vVE9ETzogRmluZCBiZXR0ZXIgd2F5IHRvIHRlc3QgaWYgaXRlcmFibGVcbiAgICAgIC8vIEB0cy1pZ25vcmUgaXMgaXRlcmFibGVcbiAgICAgIGZvciAobGV0IF9ub2RlIG9mIG5vZGUpIHtcbiAgICAgICAgdGhpcy52aXNpdChfbm9kZSk7XG4gICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgIC8vL0B0cy1pZ25vcmUgTm9kZSBpcyBub3QgaXRlcmFibGUuXG4gICAgICB0aGlzLl92aXNpdChub2RlKTtcbiAgICB9XG4gIH1cblxuICBwcm90ZWN0ZWQgYWJzdHJhY3QgX3Zpc2l0KG5vZGU6IFQpOiB2b2lkO1xufVxuIl19
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
preset: "ts-jest",
testEnvironment: "node",
testMatch: ["**/*.spec.ts"],
testPathIgnorePatterns: ["/assembly/", "/node_modules/"],
};
{
"name": "visitor-as",
"version": "0.0.1",
"version": "0.1.0",
"description": "A generic visitor framework for AssemblyScript",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "dist",
"types": "dist",
"repository": "https://github.com/willemneal/visitor-as",

@@ -12,7 +12,7 @@ "author": "Willem Wyndham",

"scripts": {
"test": "jest",
"build": "tsc && cp ./src/assemblyscript/index.d.ts ./dist/assemblyscript/"
"test": "jest && asp",
"build": "tsc"
},
"devDependencies": {
"@as-pect/cli": "^3.1.0-beta.3",
"@as-pect/cli": "^3.1.4",
"@types/jest": "^25.1.4",

@@ -22,6 +22,11 @@ "@types/node": "^13.9.1",

"jest": "^25.1.0",
"prettier": "^2.0.4",
"ts-jest": "^25.2.1",
"ts-node": "^8.6.2",
"typescript": "^3.8.3"
},
"dependencies": {
"lodash.clonedeep": "^4.5.0",
"ts-mixer": "^5.1.0"
}
}

@@ -10,50 +10,39 @@ # Visitor utilities for AssemblyScript Compiler transformers

```ts
import { ASTTransformVisitor } from '../transformer';
import {
ClassDeclaration,
Program,
FieldDeclaration,
FieldPrototype,
MethodDeclaration
} from '../as';
import { hasDecorator } from '../utils';
ClassDeclaration,
FieldDeclaration,
MethodDeclaration,
} from "../../as";
import { ClassDecorator, registerDecorator } from "../decorator";
import { toString } from "../utils";
class ListMembers extends ClassDecorator {
visitFieldDeclaration(node: FieldDeclaration): void {
if (!node.name) console.log(toString(node) + "\n");
const name = toString(node.name);
const _type = toString(node.type!);
this.stdout.write(name + ": " + _type + "\n");
}
class ListVisitor extends ASTTransformVisitor {
visitFieldDeclaration(node: FieldDeclaration): void {
const mem = <FieldPrototype>this.program.getElementByDeclaration(node);
const name = mem.name;
const _type = this.program.resolver.resolveType(mem.typeNode!, mem)!;
this.stdout.write(name + ": " + _type.toString() + "\n");
visitMethodDeclaration(node: MethodDeclaration): void {
const name = toString(node.name);
if (name == "constructor") {
return;
}
const sig = toString(node.signature);
this.stdout.write(name + ": " + sig + "\n");
}
visitMethodDeclaration(node: MethodDeclaration): void { }
visitClassDeclaration(node: ClassDeclaration): void {
this.visit(node.members);
}
visitClassDeclaration(node: ClassDeclaration): void {
if (hasDecorator(node, "list")) {
super.visit(node.members);
}
}
afterInitialize(program: Program): void {
this.visit(program.sources);
}
get name(): string {
return "list";
}
}
export = ListVisitor;
export = registerDecorator(new ListMembers());
```
Example usage:
```ts
@list
class Foo {
a: u8;
b: bool;
i: i32;
}
```
And then compile with `--transform` flag:

@@ -71,2 +60,2 @@

i: i32
```
```

@@ -78,3 +78,3 @@ import {

CommentNode,
} from "./as";
} from "../as";

@@ -328,3 +328,4 @@ import { AbstractVisitor } from "./visitor";

}
default: assert(false);
default:
assert(false);
}

@@ -445,3 +446,3 @@ }

}
default:
default:
throw new Error("Invalid LiteralKind: " + node.literalKind);

@@ -758,3 +759,2 @@ }

}
}

@@ -1,30 +0,22 @@

import { ASTTransformVisitor } from '../transformer';
import { isLibrary, not } from '../utils';
import {
ClassDeclaration,
Program,
FieldDeclaration,
FieldPrototype,
MethodDeclaration,
StringLiteralExpression,
Parser,
Source
} from '../as';
import { cloneNode } from "../utils";
import { VariableDecorator, registerDecorator } from "../decorator";
import { StringLiteralExpression, VariableDeclaration } from "../../as";
class CapitalizeVisitor extends VariableDecorator {
visitVariableDeclaration(node: VariableDeclaration): void {
this.visit(node.initializer);
}
get name(): string {
return "capitalize";
}
class CapitalizeVisitor extends ASTTransformVisitor {
visitStringLiteralExpression(node: StringLiteralExpression): void {
node.value = node.value.toUpperCase();
this.stdout.write(node.value + "\n");
}
afterInitialize(program: Program): void {
const sources = program.sources.filter(not(isLibrary));
this.visit(sources);
}
visitStringLiteralExpression(node: StringLiteralExpression): void {
const newNode = cloneNode(node);
newNode.value = node.value.toUpperCase();
this.replaceCurrentNode(newNode);
this.stdout.write(node.value + " -> " + newNode.value + "\n");
}
}
export = CapitalizeVisitor;
export = registerDecorator(new CapitalizeVisitor());

@@ -1,35 +0,35 @@

import { ASTTransformVisitor } from '../transformer';
import {
ClassDeclaration,
Program,
FieldDeclaration,
FieldPrototype,
MethodDeclaration
} from '../as';
import { hasDecorator } from '../utils';
ClassDeclaration,
FieldDeclaration,
MethodDeclaration,
} from "../../as";
import { ClassDecorator, registerDecorator } from "../decorator";
import { toString } from "../utils";
class ListMembers extends ClassDecorator {
visitFieldDeclaration(node: FieldDeclaration): void {
if (!node.name) console.log(toString(node) + "\n");
const name = toString(node.name);
const _type = toString(node.type!);
this.stdout.write(name + ": " + _type + "\n");
}
class ListVisitor extends ASTTransformVisitor {
visitFieldDeclaration(node: FieldDeclaration): void {
const mem = <FieldPrototype>this.program.getElementByDeclaration(node);
const name = mem.name;
const _type = this.program.resolver.resolveType(mem.typeNode!, mem)!;
this.stdout.write(name + ": " + _type.toString() + "\n");
visitMethodDeclaration(node: MethodDeclaration): void {
const name = toString(node.name);
if (name == "constructor") {
return;
}
const sig = toString(node.signature);
this.stdout.write(name + ": " + sig + "\n");
}
visitMethodDeclaration(node: MethodDeclaration): void { }
visitClassDeclaration(node: ClassDeclaration): void {
this.visit(node.members);
}
visitClassDeclaration(node: ClassDeclaration): void {
if (hasDecorator(node, "list")) {
super.visit(node.members);
}
}
afterInitialize(program: Program): void {
this.visit(program.sources);
}
get name(): string {
return "list";
}
}
export = ListVisitor;
export = registerDecorator(new ListMembers());

@@ -1,1 +0,1 @@

/// <reference types="assemblyscript/std/portable" />
/// <reference types="assemblyscript/std/portable" />

@@ -1,15 +0,29 @@

import { BaseVisitor } from './base';
import { Transform, Program, OutputStream } from './as';
import { BaseVisitor } from "./base";
import { Transform as _Transform } from "../as";
import { ASTBuilder } from "./astBuilder";
import { PathVisitor } from "./path";
import { Mixin } from "ts-mixer";
class Transform extends _Transform {}
export abstract class ASTTransformVisitor extends BaseVisitor implements Transform {
program: Program;
baseDir: string;
stdout: OutputStream;
stderr: OutputStream;
log: (message?: any, ...optionalParams: any[]) => void;
writeFile: (filename: string, contents: string | Uint8Array, baseDir: string) => boolean;
readFile: (filename: string, baseDir: string) => string | null;
listFiles: (dirname: string, baseDir: string) => string[] | null;
export class ASTTransformVisitor extends Mixin(BaseVisitor, Transform) {}
export class ASTBuilderVisitor extends Mixin(ASTBuilder, Transform) {}
export class PathTransformVisitor extends Mixin(PathVisitor, Transform) {}
export function mergeTransformer(from: Transform, to: Transform): void {
//@ts-ignore
to.program = from.program;
//@ts-ignore
to.baseDir = from.baseDir;
//@ts-ignore
to.stdout = from.stdout;
//@ts-ignore
to.stderr = from.stderr;
//@ts-ignore
to.log = from.log;
to.writeFile = from.writeFile;
to.readFile = from.readFile;
to.listFiles = from.listFiles;
}

@@ -1,8 +0,24 @@

import { DecoratorNode, IdentifierExpression, DeclarationStatement, Source } from "./as";
import {
DecoratorNode,
IdentifierExpression,
DeclarationStatement,
Source,
Node,
} from "../as";
import { ASTBuilder } from "./astBuilder";
export function isDecorator(name: string): (node: DecoratorNode)=>boolean {
return (node) =>(<IdentifierExpression>node.name).text === name;
const cloneDeep: <T>(t: T) => T = require("lodash.clonedeep");
export function decorates(node: DecoratorNode, name: string): boolean {
return (<IdentifierExpression>node.name).text === name;
}
export function hasDecorator(node: DeclarationStatement, name: string): boolean {
export function isDecorator(name: string): (node: DecoratorNode) => boolean {
return (node) => decorates(node, name);
}
export function hasDecorator(
node: DeclarationStatement,
name: string
): boolean {
// because it could be undefined

@@ -12,3 +28,2 @@ return node.decorators?.some(isDecorator(name)) == true;

export function isLibrary(node: Source): boolean {

@@ -18,4 +33,12 @@ return node.isLibrary || node.internalPath.startsWith("~lib/rt/");

export function not<T>(fn: (t:T) => boolean): (t:T) => boolean {
export function not<T>(fn: (t: T) => boolean): (t: T) => boolean {
return (t: T) => !fn(t);
}
}
export function toString(node: Node): string {
return ASTBuilder.build(node);
}
export function cloneNode<T extends Node>(node: T): T {
return cloneDeep(node);
}

@@ -0,4 +1,7 @@

export type Collection<T extends object> =
| T
| T[]
| Map<string, T | T[] | Iterable<T>>
| Iterable<T>;
export type Collection<T extends object> = T | T[] | Map<string, T | T[] | Iterable<T>> | Iterable<T>;
function isIterable<T>(object: T): boolean {

@@ -8,14 +11,13 @@ //@ts-ignore

}
/**
* Top level visitor that will expect an implemented _visit function to visit
* a single node and then provides a generic function for collections of nodes
* and will visit each member of the collection.
*/
/**
* Top level visitor that will expect an implemented _visit function to visit
* a single node and then provides a generic function for collections of nodes
* and will visit each member of the collection.
*/
export abstract class AbstractVisitor<T extends object> {
visit(node: Collection<T> | null): void {
if (node == null) return;
if (node instanceof Array) {
node.map(node => this.visit(node));
}
else if (node instanceof Map) {
if (node instanceof Array) {
node.map((node) => this.visit(node));
} else if (node instanceof Map) {
for (let _node of node.values()) {

@@ -25,6 +27,6 @@ this.visit(_node);

} else if (isIterable(node)) {
//TODO: Find better way to test if iterable
//TODO: Find better way to test if iterable
// @ts-ignore is iterable
for (let _node of node) {
this.visit(_node);
this.visit(_node);
}

@@ -31,0 +33,0 @@ } else {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc