Giter Site home page Giter Site logo

qxvm's Introduction

qxVm补环境框架简介

  • 个人微信 y2783693683

  • 微信公众号: y小白的笔记(https://mp.weixin.qq.com/s/GGqecHvqN54IzL3ap5c28A)

  • git: https://github.com/ylw00/qxVm

  • 基于 node16

  • 基于vm2模块纯js设计一个补环境框架

  • 目前的设计思路以及实现的方式,检测点相对来说是比较少的

  • 因为是前期版本, 所以并没有加入dom解析,属性的方法实现

  • 内部使用弱引用, 不会影响内存回收问题

  • 优化实例产生的方式

声明

  • 不会在已有的基础之上添加新的api功能
  • 框架内部的dom操作不可信(开源版本没有加入dom解析), 需要重写(详情见/z_working/rs4.js)

2023-07-26更新

  • 添加完善的日志功能, 替代之前的debugger功能, 使得调试更加舒服
  • 新增QXVM_GENERATE.help 方法, 打印帮助信息
  • 添加默认导出函数 printLog (runConfig.logOpen=true), 一键导出
  • 删除一些不必要的配置参数
  • 为了避免一些问题, 框架内部qxVm字眼更改lwVm
  • 隐藏环境代码, 更加简洁
  • 封装事件调用函数 lw.callListener // lw.callListener("load")
  • 字符串处理 (./qxVm_sanbox/tools/updateDbugger.py)

调用方式(z_working目录)

const QXVM_GENERATE = require('../qxVm_sanbox/qxVm.sanbox');

const js_code = "function get_form (){ return '' }";  // 导出函数是一定要写的
const user_config = {  // 用户配置
    isTest: true,  // 是不是测试状态, 如果是, 则会固定时间戳, 随机数
    compress: false,  // 是否压缩js, 准对检测格式化的网站
    runConfig: { proxy: false, proxy_proto: false, logOpen: true },  // 是否挂代理
    window_attribute: {},
    env: {  // 浏览器环境
        canvas: "",
        plugin: [
            { description: "Portable Document Format", filename: "internal-pdf-viewer", name: "Chrome PDF Plugin", MimeTypes: [{ description: "Portable Document Format", suffixes: "pdf", type: "application/x-google-chrome-pdf" }] }
        ],
        navigator: {
            userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.55"
        },
        location: { },
        document: { referrer: ""}
    }
}

let result = QXVM_GENERATE.QXVm_sanbox(js_code, "get_form", user_config);
console.log(result.get_form())
  • 三个参数 (需要运行的目标js, 需要导出的目标函数, 个人配置)
  • 框架内部均有默认值, user_config为空不影响运行

自动化生成原型文件

qxVm最新

qxvm's People

Contributors

ylw00 avatar iceland-monsoon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.