From 6dca16c8d2adaa0fc5ec0b69749e832c0101748c Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Fri, 3 Oct 2025 00:57:40 +0000 Subject: [PATCH] Add README.md --- README.en.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 README.en.md create mode 100644 README.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..638c380 --- /dev/null +++ b/README.en.md @@ -0,0 +1,72 @@ +# QuickJS JavaScript Engine + +QuickJS is a small and fast JavaScript engine that supports the ECMAScript 2021 specification, including features such as modules, asynchronous generators, and proxies. It is designed to provide efficient memory usage and a comprehensive API, making it suitable for embedded systems and general-purpose applications. + +## Features + +- Supports the latest JavaScript features, including modules, asynchronous functions, and proxies. +- Fast startup and execution, suitable for both small devices and large-scale applications. +- Provides a C API for easy integration into other applications. +- Supports built-in objects such as JSON, regular expressions, dates, and numerical values. +- Includes garbage collection and memory management capabilities. +- Supports cross-platform operation, including Linux, Windows, and macOS. + +## Documentation + +The project documentation is written in Texinfo format and can be found in `doc/quickjs.texi`. The documentation details the API, runtime and context management, object model, module system, garbage collection mechanism, and other aspects of QuickJS. + +## Examples + +QuickJS provides several example codes, including: +- `examples/hello.js`: A basic "Hello World" example. +- `examples/pi_bigint.js`: An example of calculating π using big integers. +- `examples/point.c`: A C language extension defining a Point class. +- `examples/fib.c`: A C language extension implementing a Fibonacci function. + +## Testing + +QuickJS includes a test framework that supports running built-in tests and the [ECMAScript Test262](https://github.com/tc39/test262) test suite. Test code is located in the `tests/` directory and includes tests for features such as BigInt, Promise, regular expressions, JSON, and TypedArray. + +## Fuzz Testing + +QuickJS provides support for libFuzzer to test the engine's security and stability. QuickJS with libFuzzer support can be built using the following command: + +```bash +CONFIG_CLANG=y make libfuzzer +``` + +Sanitizer support can also be included to enhance testing effectiveness: + +```bash +CONFIG_CLANG=y CONFIG_ASAN=y make libfuzzer +``` + +Currently, three fuzzing targets are defined: `fuzz_eval`, `fuzz_compile`, and `fuzz_regexp`. After building, you can run tests using the following command: + +```bash +./fuzz_eval +``` + +Or use an initial corpus: + +```bash +./fuzz_compile corpus_dir/ +``` + +You can also use a predefined dictionary to improve testing effectiveness: + +```bash +./fuzz_eval -dict fuzz/fuzz.dict +``` + +## Building and Running + +QuickJS uses a `Makefile` for building. Before building, ensure that the necessary compilation toolchain is installed. After building, you can use the `qjs` command to run JavaScript scripts. + +## License + +QuickJS is released under the MIT License. All source code is owned by Fabrice Bellard and Charlie Gordon, unless otherwise stated. + +## Contact and Support + +For questions or suggestions regarding QuickJS, please visit the [Gitee project page](https://gitee.com/sureman_admin/quickjs) to submit issues or participate in discussions. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a6091d3 --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +# QuickJS JavaScript 引擎 + +QuickJS 是一个小型且快速的 JavaScript 引擎,支持 ECMAScript 2021 规范,包括模块、异步生成器和代理(Proxy)等特性。它旨在提供高效的内存使用和全面的 API,适用于嵌入式系统和通用用途。 + +## 特性 + +- 支持最新的 JavaScript 特性,包括模块、异步函数、代理等。 +- 快速启动和执行,适用于小型设备和大型应用。 +- 提供 C API,便于集成到其他应用程序中。 +- 支持 JSON、正则表达式、日期、数值等内置对象。 +- 包括垃圾回收机制和内存管理功能。 +- 支持跨平台运行,包括 Linux、Windows、macOS ::: 。 + +## 文档 + +本项目文档使用 Texinfo 格式编写,可在 `doc/quickjs.texi` 中找到。文档详细介绍了 QuickJS 的 API、运行时和上下文管理、对象模型、模块系统、垃圾回收机制等内容。 + +## 示例 + +QuickJS 提供了多个示例代码,包括: +- `examples/hello.js`: 基础的 "Hello World" 示例。 +- `examples/pi_bigint.js`: 使用大整数计算 π 的示例。 +- `examples/point.c`: C 语言扩展,定义了一个 Point 类。 +- `examples/fib.c`: C 语言扩展,实现斐波那契函数。 + +## 测试 + +QuickJS 包含一个测试框架,支持运行内置测试和 [ECMAScript Test262](https://github.com/tc39/test262) 测试套件。测试代码位于 `tests/` 目录下,包括对 BigInt、Promise、正则表达式、JSON、TypedArray 等功能的测试。 + +## fuzz 测试 + +QuickJS 提供了 libFuzzer 支持,用于测试引擎的安全性和稳定性。可以通过以下命令构建支持 libFuzzer 的 QuickJS: + +```bash +CONFIG_CLANG=y make libfuzzer +``` + +也可以结合 sanitizer 支持以提高测试效果: + +```bash +CONFIG_CLANG=y CONFIG_ASAN=y make libfuzzer +``` + +目前定义了三个 fuzzing 目标:`fuzz_eval`, `fuzz_compile`, 和 `fuzz_regexp`。构建完成后,可以运行如下命令执行测试: + +```bash +./fuzz_eval +``` + +或者使用初始语料库: + +```bash +./fuzz_compile corpus_dir/ +``` + +也可以使用预定义的字典来提高测试效果: + +```bash +./fuzz_eval -dict fuzz/fuzz.dict +``` + +## 构建和运行 + +QuickJS 使用 `Makefile` 进行构建。构建前请确保已安装必要的编译工具链。构建完成后,可以使用 `qjs` 命令运行 JavaScript 脚本。 + +## 授权许可 + +QuickJS 使用 MIT 许可证发布,除非另有说明,所有源代码均归 Fabrice Bellard 和 Charlie Gordon 所有。 + +## 联系和支持 + +有关 QuickJS 的问题或建议,请访问 [Gitee 项目页面](https://gitee.com/sureman_admin/quickjs) 提交 issue 或参与讨论。 \ No newline at end of file -- Gitee