🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more
Socket
Book a DemoInstallSign in
Socket

@afwenming123/funcr-test

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@afwenming123/funcr-test

函数式前端的运行系统,用于产生执行*.ast文件的wasm程序,开发语言:Rust。

latest
npmnpm
Version
0.1.20
Version published
Maintainers
1
Created
Source

函数式前端的运行系统,用于产生执行*.ast文件的wasm程序,开发语言:Rust。

编译及打包

  • 修改Cargo.toml中的版本号。

  • 复制js下的run.js内容到runtime.js下。

  • 运行wasm-pack build --scope afwenming123产生pkg文件夹。

  • 修改产生的pkg包下的文件,包括:

    • 找到funcr_bg.js里,引入runtime.js部分,把相关路径去掉,改成:
    import xxx from './runtime.js'
    
    • 把对应文件夹下的runtime.js复制到pkg包根目录下。
    • 修改package.json的files部分内容,添加如下内容:
    "runtime.js"
    
  • 进入pkg,运行npm的发布过程,如下:

cd pkg
npm publish --access=public

运行单元测试

  • 复制js下的run.js的内容到runtime.js下
  • 运行./test.bat

单元测试文件

  • tests目录下,包括rust的单元测试文件,以及func语言文件。
    • wasm.rs:rust的单元测试文件,单元测试用例在这里添加。
    • 其余:func语言的文件,后缀为*.f
  • test.bat:先把所有func语言的文件编译成*.ast,然后执行rust的单元测试。

单元测试添加

  • 先在tests目录下按func语言规范书写文件,文件的入口为main函数。
  • 在test.bat中添加编译过程。
  • 在wasm.rs中添加单元测试用例。

js文件

js目录下存放引用的外部函数,其中:

  • foo.js:测试要用到的,加载.ast文件的函数。
  • rutime.js:运行时用到的js函数,这里模拟了h1函数。真实的函数在vue工程中提供。

FAQs

Package last updated on 29 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts