diff --git a/.github/workflows/sync-json-schema.yml b/.github/workflows/sync-json-schema.yml
deleted file mode 100644
index d9dd183f..00000000
--- a/.github/workflows/sync-json-schema.yml
+++ /dev/null
@@ -1,40 +0,0 @@
-name: Sync Json Schema
-on:
- schedule:
- - cron: "0 0 * * 2"
- workflow_dispatch:
-jobs:
- sync:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-python@v5
- with:
- python-version: "3.10"
-
- - name: Update JSON Schema
- run: |
- echo "[INFO] Getting JSON schema from moonbitlang/moon"
- curl 'https://raw.githubusercontent.com/moonbitlang/moon/main/crates/moonbuild/template/pkg.schema.json' > pkg.schema.json
- curl 'https://raw.githubusercontent.com/moonbitlang/moon/main/crates/moonbuild/template/mod.schema.json' > mod.schema.json
-
- - name: Generate MD Doc based on JSON Schema
- run: |
- pip install jsonschema2md
- jsonschema2md mod.schema.json mod.md
- jsonschema2md pkg.schema.json pkg.md
- cat mod.md pkg.md > ./moonbit-docs/docs/build-system-configuration.md
- cp ./moonbit-docs/docs/build-system-configuration.md ./moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/build-system-configuration.md
- rm mod.md pkg.md
-
- - name: Create PR based on changes
- uses: peter-evans/create-pull-request@v6
- with:
- commit-message: Sync json schema & build docs from moon
- title: "[Bot] sync json schema from moon"
- body: Automated changes by `sync-json-schema` action to sync json schema and build markdown documentations from moon
- labels: |
- bot
- add-paths: |
- *.schema.json
- build-system-configuration.md
diff --git a/mod.schema.json b/mod.schema.json
deleted file mode 100644
index 4ed6e147..00000000
--- a/mod.schema.json
+++ /dev/null
@@ -1,91 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "JSON schema for MoonBit moon.mod.json files",
- "description": "A module of MoonBit lang",
- "type": "object",
- "required": [
- "name"
- ],
- "properties": {
- "alert-list": {
- "description": "Alert list setting of the module",
- "type": [
- "string",
- "null"
- ]
- },
- "deps": {
- "description": "third-party dependencies of the module",
- "type": [
- "object",
- "null"
- ],
- "additionalProperties": {
- "type": "string"
- }
- },
- "description": {
- "description": "description of this module",
- "type": [
- "string",
- "null"
- ]
- },
- "keywords": {
- "description": "keywords of this module",
- "type": [
- "array",
- "null"
- ],
- "items": {
- "type": "string"
- }
- },
- "license": {
- "description": "license of this module",
- "type": [
- "string",
- "null"
- ]
- },
- "name": {
- "description": "name of the module",
- "type": "string"
- },
- "readme": {
- "description": "path to module's README file",
- "type": [
- "string",
- "null"
- ]
- },
- "repository": {
- "description": "url to module's repository",
- "type": [
- "string",
- "null"
- ]
- },
- "source": {
- "description": "source code directory of this module",
- "type": [
- "string",
- "null"
- ]
- },
- "version": {
- "description": "version of the module",
- "type": [
- "string",
- "null"
- ]
- },
- "warn-list": {
- "description": "Warn list setting of the module",
- "type": [
- "string",
- "null"
- ]
- }
- }
-}
\ No newline at end of file
diff --git a/moonbit-docs/docs/README.md b/moonbit-docs/docs/README.md
index 0d536ef7..e3194916 100644
--- a/moonbit-docs/docs/README.md
+++ b/moonbit-docs/docs/README.md
@@ -38,7 +38,7 @@ For WebAssembly backend, it means that it will be executed **before** the instan
for JavaScript backend, it means that it will be executed during the importation stage.
There is another specialized function called `main` function. The `main` function is the main entrance of the program, and it will be executed after the initialization stage.
-Only packages that are `main` packages can define such `main` function. Check out [build system tutorial](./build-system-tutorial.md) for detail.
+Only packages that are `main` packages can define such `main` function. Check out [build system tutorial](https://moonbitlang.github.io/moon/) for detail.
The two functions above need to drop the parameter list and the return type.
@@ -592,14 +592,14 @@ let e = not(a)
MoonBit have integer type and floating point type:
-| type | description | example |
-| -------- | ----------------------------------------- | ------- |
-| `Int` | 32-bit signed integer | `42` |
-| `Int64` | 64-bit signed integer | `1000L` |
-| `UInt` | 32-bit unsigned integer | `14U` |
-| `UInt64` | 64-bit unsigned integer | `14UL` |
-| `Double` | 64-bit floating point, defined by IEEE754 | `3.14` |
-| `Float` | 32-bit floating point | `(3.14 : Float)` |
+| type | description | example |
+| -------- | ------------------------------------------------------------------------------- | ------- |
+| `Int` | 32-bit signed integer | `42` |
+| `Int64` | 64-bit signed integer | `1000L` |
+| `UInt` | 32-bit unsigned integer | `14U` |
+| `UInt64` | 64-bit unsigned integer | `14UL` |
+| `Double` | 64-bit floating point, defined by IEEE754 | `3.14` |
+| `Float` | 32-bit floating point | `(3.14 : Float)` |
| `BigInt` | represents numeric values larger than other types | `10000000000000000000000N` |
MoonBit also supports numeric literals, including decimal, binary, octal, and hexadecimal numbers.
@@ -2083,4 +2083,4 @@ Pragmas are annotations inside doc comments. They all take the form `/// @word .
## MoonBit's build system
-The introduction to the build system is available at [MoonBit's Build System Tutorial](./build-system-tutorial.md).
+The introduction to the build system is available at [MoonBit's Build System Tutorial](https://moonbitlang.github.io/moon/).
diff --git a/moonbit-docs/docs/build-system-configuration.md b/moonbit-docs/docs/build-system-configuration.md
deleted file mode 100644
index 83653375..00000000
--- a/moonbit-docs/docs/build-system-configuration.md
+++ /dev/null
@@ -1,108 +0,0 @@
-# JSON schema for MoonBit moon.mod.json files
-
-*A module of MoonBit lang*
-
-## Properties
-
-- **`alert-list`** *(['string', 'null'])*: Alert list setting of the module.
-- **`deps`** *(['object', 'null'])*: third-party dependencies of the module. Can contain additional properties.
- - **Additional properties** *(string)*
-- **`description`** *(['string', 'null'])*: description of this module.
-- **`keywords`** *(['array', 'null'])*: keywords of this module.
- - **Items** *(string)*
-- **`license`** *(['string', 'null'])*: license of this module.
-- **`name`** *(string, required)*: name of the module.
-- **`readme`** *(['string', 'null'])*: path to module's README file.
-- **`repository`** *(['string', 'null'])*: url to module's repository.
-- **`source`** *(['string', 'null'])*: source code directory of this module.
-- **`version`** *(['string', 'null'])*: version of the module.
-- **`warn-list`** *(['string', 'null'])*: Warn list setting of the module.
-# JSON schema for MoonBit moon.pkg.json files
-
-*A package of MoonBit language*
-
-## Properties
-
-- **`alert-list`** *(['string', 'null'])*: Alert list setting of the package.
-- **`import`**: Imported packages of the package.
- - **Any of**
- - : Refer to *[#/definitions/PkgJSONImport](#definitions/PkgJSONImport)*.
- - *null*
-- **`is-main`** *(['boolean', 'null'])*: Specify whether this package is a main package or not.
-- **`link`**
- - **Any of**
- - : Refer to *[#/definitions/BoolOrLink](#definitions/BoolOrLink)*.
- - *null*
-- **`name`** *(['string', 'null'])*
-- **`test-import`**: Black box test imported packages of the package.
- - **Any of**
- - : Refer to *[#/definitions/PkgJSONImport](#definitions/PkgJSONImport)*.
- - *null*
-- **`warn-list`** *(['string', 'null'])*: Warn list setting of the package.
-- **`wbtest-import`**: White box test imported packages of the package.
- - **Any of**
- - : Refer to *[#/definitions/PkgJSONImport](#definitions/PkgJSONImport)*.
- - *null*
-## Definitions
-
-- **`BoolOrLink`**
- - **Any of**
- - *boolean*
- - : Refer to *[#/definitions/Link](#definitions/Link)*.
-- **`JsFormat`** *(string)*: Must be one of: `["esm", "cjs", "iife"]`.
-- **`JsLinkConfig`** *(object)*
- - **`exports`** *(['array', 'null'])*
- - **Items** *(string)*
- - **`format`**
- - **Any of**
- - : Refer to *[#/definitions/JsFormat](#definitions/JsFormat)*.
- - *null*
-- **`Link`** *(object)*
- - **`js`**
- - **Any of**
- - : Refer to *[#/definitions/JsLinkConfig](#definitions/JsLinkConfig)*.
- - *null*
- - **`wasm`**
- - **Any of**
- - : Refer to *[#/definitions/WasmLinkConfig](#definitions/WasmLinkConfig)*.
- - *null*
- - **`wasm-gc`**
- - **Any of**
- - : Refer to *[#/definitions/WasmGcLinkConfig](#definitions/WasmGcLinkConfig)*.
- - *null*
-- **`PkgJSONImport`**
- - **Any of**
- - *object*: Path and alias of an imported package. Can contain additional properties.
- - **Additional properties** *(['string', 'null'])*
- - *array*
- - **Items**: Refer to *[#/definitions/PkgJSONImportItem](#definitions/PkgJSONImportItem)*.
-- **`PkgJSONImportItem`**
- - **Any of**
- - *string*
- - *object*
- - **`alias`** *(string, required)*
- - **`path`** *(string, required)*
-- **`WasmGcLinkConfig`** *(object)*
- - **`export-memory-name`** *(['string', 'null'])*
- - **`exports`** *(['array', 'null'])*
- - **Items** *(string)*
- - **`flags`** *(['array', 'null'])*
- - **Items** *(string)*
- - **`import-memory`**
- - **Any of**
- - : Refer to *[#/definitions/import-memory](#definitions/import-memory)*.
- - *null*
-- **`WasmLinkConfig`** *(object)*
- - **`export-memory-name`** *(['string', 'null'])*
- - **`exports`** *(['array', 'null'])*
- - **Items** *(string)*
- - **`flags`** *(['array', 'null'])*
- - **Items** *(string)*
- - **`heap-start-address`** *(['integer', 'null'], format: uint32)*: Minimum: `0.0`.
- - **`import-memory`**
- - **Any of**
- - : Refer to *[#/definitions/import-memory](#definitions/import-memory)*.
- - *null*
-- **`import-memory`** *(object)*
- - **`module`** *(string, required)*
- - **`name`** *(string, required)*
diff --git a/moonbit-docs/docs/build-system-tutorial.md b/moonbit-docs/docs/build-system-tutorial.md
deleted file mode 100644
index c55efa6b..00000000
--- a/moonbit-docs/docs/build-system-tutorial.md
+++ /dev/null
@@ -1,392 +0,0 @@
-# MoonBit's Build System Tutorial
-
-Moon is the build system for the MoonBit language, currently based on the
-[n2](https://github.com/evmar/n2) project. Moon supports parallel and
-incremental builds. Additionally, moon also supports managing and building
-third-party packages on [mooncakes.io](https://mooncakes.io/)
-
-## Prerequisites
-
-Before you begin with this tutorial, make sure you have installed the following:
-
-1. **MoonBit CLI Tools**: Download it from the
-[https://www.moonbitlang.com/download/](https://www.moonbitlang.com/download/).
-This command line tool is needed for creating and managing MoonBit projects.
-
- Use `moon help` to view the usage instructions.
-
- ```plaintext
- $ moon help
- The build system and package manager for MoonBit.
-
- Usage: moon [OPTIONS]
-
- Commands:
- new Create a new moonbit package
- build Build the current package
- check Check the current package, but don't build object files
- run Run WebAssembly module
- test Test the current package
- clean Clean the target directory
- fmt Format moonbit source code
- doc Generate documentation
- info Generate public interface (`.mbti`) files for all packages in the module
- add Add a dependency
- remove Remove a dependency
- install Install dependencies
- tree Display the dependency tree
- login Log in to your account
- register Register an account at mooncakes.io
- publish Publish the current package
- update Update the package registry index
- coverage Code coverage utilities
- generate-build-matrix Generate build matrix for benchmarking (legacy feature)
- upgrade Upgrade toolchains
- shell-completion Generate shell completion for bash/elvish/fish/pwsh/zsh to stdout
- version Print version info and exit
- help Print this message or the help of the given subcommand(s)
-
- Options:
- -C, --directory The source code directory. Defaults to the current directory
- --target-dir The target directory. Defaults to `source_dir/target`
- -q, --quiet Suppress output
- -v, --verbose Increase verbosity
- --trace Trace the execution of the program
- --dry-run Do not actually run the command
- -h, --help Print help
- ```
-
-2. **Moonbit Language** plugin in Visual Studio Code: You can install it from
-the VS Code marketplace. This plugin provides a rich development environment for
-MoonBit, including must-have functionalities like syntax highlighting,
-intellisense, interactive debugging, testing, and more.
-
-Once you have these prerequisites fulfilled, let's start by creating a new
-MoonBit module.
-
-## Creating a New Module
-
-`moon` comes with a handy module creation wizard `moon new`. The default
-settings are shown below:
-
-```plaintext
-$ moon new
-Enter the path to create the project (. for current directory): my-project
-Select the create mode: exec
-Enter your username: username
-Enter your project name: hello
-Enter your license: Apache-2.0
-Created my-project
-```
-
-This creates a new module named `hello` in `my-project`. The word _project_ is
-used interchangeably with _module_.
-
-## Understanding MoonBit's Module Structure
-
-A typical module/project structure resembles the following:
-
-```plaintext
-my-project
-├── README.md
-├── lib
-│ ├── hello.mbt
-│ ├── hello_test.mbt
-│ └── moon.pkg.json
-├── main
-│ ├── main.mbt
-│ └── moon.pkg.json
-└── moon.mod.json
-```
-
-Here's a brief explanation of the structure:
-
-- `lib` and `main` directories: These are the packages within the module. Each
-package may contain multiple moonbit source files (.mbt). A common
-`moon.pkg.json` is shared around every source files within that package.
-
-- `lib/*_test.mbt` are tests for the `lib` package. However members of `lib`
-aren't directly visible to the tests, you'll need to explicitly use the
-`@my-project.*` to access it. Tests are only included in
-test compilation, allowing inline tests and utility functions for
-testing purposes to be written within these separate test files.
-
-- `moon.pkg.json` is the package descriptor. It defines the properties of the
-package, such as whether it is the main package and the packages it imports.
-
- - `main/moon.pkg.json`:
-
- ```json
- {
- "is-main": true,
- "import": [
- "username/hello/lib"
- ]
- }
- ```
-
- Here, `"is-main": true` declares that the package needs to be linked by the
- build system into a wasm file.
-
- - `lib/moon.pkg.json`:
-
- ```json
- {}
- ```
-
- This file is empty. Its purpose is simply to inform the build system that this
- folder is a package.
-
-- `moon.mod.json` is used to declare a directory as a MoonBit module. It
-contains the module's name:
-
- ```json
- {
- "name": "username/hello",
- "version": "0.1.0",
- "readme": "README.md",
- "repository": "",
- "license": "Apache-2.0",
- "keywords": [],
- "description": ""
- }
- ```
-
-Refer to the [json schema](./build-system-configuration.md) of module/package
-descriptor for a complete specification.
-
-## Working with Packages
-
-Our `username/hello` module contains two packages: `lib` and `main`.
-
-The `lib` package contains `hello.mbt` and `hello_test.mbt` files:
-
- `hello.mbt`
-
- ```moonbit -f=hello.mbt
- pub fn hello() -> String {
- "Hello, world!"
- }
- ```
-
- `hello_test.mbt`
-
- ```moonbit -f=hello.mbt
- test "hello" {
- if hello() != "Hello, world!" {
- fail!("hello() != \"Hello, world!\"")
- }
- }
- ```
-
-The `main` package contains a `main.mbt` file:
-
- ```moonbit no-check
- fn main {
- println(@lib.hello())
- }
- ```
-
-To execute the program, specify the path to the `main` package in the `moon run` command:
-
-```bash
-$ moon run main
-Hello, world!
-```
-
-You can test using the `moon test` command:
-
-```bash
-$ moon test
-Total tests: 1, passed: 1, failed: 0.
-```
-
-## Package Importing
-
-MoonBit's build system uses the name of a module to reference its internal
-packages. To use `lib` within `main/main.mbt`, you need to specify it in
-`main/moon.pkg.json`:
-
-```json
-{
- "is_main": true,
- "import": [
- "username/hello/lib"
- ]
-}
-```
-
-(Although the intellisense will do that for you: just type `@lib` then enter.)
-
-Here, `username/hello/lib` specifies importing the `username/hello/lib` package
-from the `username/hello` module, so you can use `@lib.hello()` in
-`main/main.mbt`.
-
-Note that the package name imported in `main/moon.pkg.json` is
-`username/hello/lib`, and `@lib` is used to refer to this package in
-`main/main.mbt`. The import here actually generates a default alias for the
-package name `username/hello/lib`.
-
-## Creating and Using a New Package
-
-Suppose we have a new package named `fib` under `lib` and two moonbit source
-`lib/fib/{a,b}.mbt`.
-
-In `a.mbt`:
-
-```moonbit
-pub fn fib(n : Int) -> Int {
- match n {
- 0 => 0
- 1 => 1
- _ => fib(n - 1) + fib(n - 2)
- }
-}
-```
-
-in `b.mbt`:
-
-```moonbit
-pub fn fib2(num : Int) -> Int {
- fn aux(n, acc1, acc2) {
- match n {
- 0 => acc1
- 1 => acc2
- _ => aux(n - 1, acc2, acc1 + acc2)
- }
- }
-
- aux(num, 0, 1)
-}
-```
-
-and `moon.pkg.json`:
-
-```json
-{}
-```
-
-Our project structure should look like this now:
-
-```bash
-my-project
-├── README.md
-├── lib
-│ ├── fib
-│ │ ├── a.mbt
-│ │ ├── b.mbt
-│ │ └── moon.pkg.json
-│ ├── hello.mbt
-│ ├── hello_test.mbt
-│ └── moon.pkg.json
-├── main
-│ ├── main.mbt
-│ └── moon.pkg.json
-└── moon.mod.json
-```
-
-In the `main/moon.pkg.json` file, import the `username/hello/lib/fib` package
-and define an alias `my_awesome_fibonacci` for it:
-
-```json
-{
- "is_main": true,
- "import": [
- "username/hello/lib",
- {
- "path": "username/hello/lib/fib",
- "alias": "my_awesome_fibonacci"
- }
- ]
-}
-```
-
-In `main/main.mbt`:
-
-```moonbit no-check
-fn main {
- let a = @my_awesome_fibonacci.fib(10)
- let b = @my_awesome_fibonacci.fib2(11)
- println("fib(10) = \{a}, fib(11) = \{b}")
-
- println(@lib.hello())
-}
-```
-
-Running `moon run main` again gives us the expected:
-
-```bash
-$ moon run main
-fib(10) = 55, fib(11) = 89
-Hello, world!
-```
-
-## Adding Tests
-
-MoonBit differentiate between white-box and black-box tests. A white-box test
-usually refers to an inline test block or a stand-alone `*_wbtest.mbt` source, intended for package developers to test their code,
-whereas a black-box test refers to a `*_test.mbt` source, emulating package
-users using current package. They may have different imports: a white-box test
-automatically imports everything from `import` and `test-import` in
-`moon.pkg.json`; a black-box test imports just the same as white-box but
-with the addition of current package.
-
-Let's add some inline tests to verify our fib implementation. In `lib/fib/a.mbt`:
-
-```moonbit
-fn assert_eq[T: Show + Eq](lhs: T, rhs: T) -> Unit {
- if lhs != rhs {
- abort("assert_eq failed.\n\tlhs: \{lhs}\n\trhs: \{rhs}")
- }
-}
-
-test {
- assert_eq(fib(1), 1)
- assert_eq(fib(2), 1)
- assert_eq(fib(3), 2)
- assert_eq(fib(4), 3)
- assert_eq(fib(5), 5)
-}
-```
-
-This code tests the first five terms of the Fibonacci sequence. `test { ... }`
-defines an inline test block. The code inside an inline test block is executed
-in test mode.
-
-Inline test blocks are discarded in non-test compilation modes (`moon build` and
-`moon run`), so they won't cause the generated code size to bloat.
-
-## Stand-alone test files
-
-Stand-alone tests are included in test mode only as well. You can write inline
-tests and test utilities in these stand-alone test files. For example, inside
-the `lib/fib` directory, create a file named `fib_test.mbt` and paste the
-following code:
-
-`lib/fib/fib_test.mbt`
-
-```moonbit
-test {
- assert_eq(fib(1), 1)
- assert_eq(fib2(2), 1)
- assert_eq(fib(3), 2)
- assert_eq(fib2(4), 3)
- assert_eq(fib(5), 5)
-}
-```
-
-Now we use the `moon test` command, which scans the entire project,
-identifies, and runs all inline tests as well as files ending with `_test.mbt`
-or `_wbtest.mbt`. If everything is normal, you will see:
-
-```bash
-$ moon test
-Total tests: 3, passed: 3, failed: 0.
-$ moon test -v
-test username/hello/lib/hello_test.mbt::hello ok
-test username/hello/lib/fib/a.mbt::0 ok
-test username/hello/lib/fib/fib_test.mbt::0 ok
-Total tests: 3, passed: 3, failed: 0.
-```
-
-Note that `main/main.mbt:init` is also executed here, and we will improve the issue of testing with package initialization functions in the future.
diff --git a/moonbit-docs/docs/mod.schema.json b/moonbit-docs/docs/mod.schema.json
deleted file mode 100644
index 4ed6e147..00000000
--- a/moonbit-docs/docs/mod.schema.json
+++ /dev/null
@@ -1,91 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "JSON schema for MoonBit moon.mod.json files",
- "description": "A module of MoonBit lang",
- "type": "object",
- "required": [
- "name"
- ],
- "properties": {
- "alert-list": {
- "description": "Alert list setting of the module",
- "type": [
- "string",
- "null"
- ]
- },
- "deps": {
- "description": "third-party dependencies of the module",
- "type": [
- "object",
- "null"
- ],
- "additionalProperties": {
- "type": "string"
- }
- },
- "description": {
- "description": "description of this module",
- "type": [
- "string",
- "null"
- ]
- },
- "keywords": {
- "description": "keywords of this module",
- "type": [
- "array",
- "null"
- ],
- "items": {
- "type": "string"
- }
- },
- "license": {
- "description": "license of this module",
- "type": [
- "string",
- "null"
- ]
- },
- "name": {
- "description": "name of the module",
- "type": "string"
- },
- "readme": {
- "description": "path to module's README file",
- "type": [
- "string",
- "null"
- ]
- },
- "repository": {
- "description": "url to module's repository",
- "type": [
- "string",
- "null"
- ]
- },
- "source": {
- "description": "source code directory of this module",
- "type": [
- "string",
- "null"
- ]
- },
- "version": {
- "description": "version of the module",
- "type": [
- "string",
- "null"
- ]
- },
- "warn-list": {
- "description": "Warn list setting of the module",
- "type": [
- "string",
- "null"
- ]
- }
- }
-}
\ No newline at end of file
diff --git a/moonbit-docs/docs/pkg.schema.json b/moonbit-docs/docs/pkg.schema.json
deleted file mode 100644
index 9357746a..00000000
--- a/moonbit-docs/docs/pkg.schema.json
+++ /dev/null
@@ -1,300 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "JSON schema for MoonBit moon.pkg.json files",
- "description": "A package of MoonBit language",
- "type": "object",
- "properties": {
- "alert_list": {
- "description": "Alert list setting of the package",
- "type": [
- "string",
- "null"
- ]
- },
- "import": {
- "description": "Imported packages of the package",
- "anyOf": [
- {
- "$ref": "#/definitions/PkgJSONImport"
- },
- {
- "type": "null"
- }
- ]
- },
- "is_main": {
- "description": "Specify whether this package is a main package or not",
- "type": [
- "boolean",
- "null"
- ]
- },
- "link": {
- "anyOf": [
- {
- "$ref": "#/definitions/BoolOrLink"
- },
- {
- "type": "null"
- }
- ]
- },
- "name": {
- "type": [
- "string",
- "null"
- ]
- },
- "test_import": {
- "description": "Black box test imported packages of the package",
- "anyOf": [
- {
- "$ref": "#/definitions/PkgJSONImport"
- },
- {
- "type": "null"
- }
- ]
- },
- "warn_list": {
- "description": "Warn list setting of the package",
- "type": [
- "string",
- "null"
- ]
- },
- "wbtest_import": {
- "description": "White box test imported packages of the package",
- "anyOf": [
- {
- "$ref": "#/definitions/PkgJSONImport"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- "definitions": {
- "BoolOrLink": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "$ref": "#/definitions/Link"
- }
- ]
- },
- "ImportMemory": {
- "type": "object",
- "required": [
- "module",
- "name"
- ],
- "properties": {
- "module": {
- "type": "string"
- },
- "name": {
- "type": "string"
- }
- }
- },
- "JsFormat": {
- "type": "string",
- "enum": [
- "esm",
- "cjs",
- "iife"
- ]
- },
- "JsLinkConfig": {
- "type": "object",
- "properties": {
- "exports": {
- "type": [
- "array",
- "null"
- ],
- "items": {
- "type": "string"
- }
- },
- "format": {
- "anyOf": [
- {
- "$ref": "#/definitions/JsFormat"
- },
- {
- "type": "null"
- }
- ]
- }
- }
- },
- "Link": {
- "type": "object",
- "properties": {
- "js": {
- "anyOf": [
- {
- "$ref": "#/definitions/JsLinkConfig"
- },
- {
- "type": "null"
- }
- ]
- },
- "wasm": {
- "anyOf": [
- {
- "$ref": "#/definitions/WasmLinkConfig"
- },
- {
- "type": "null"
- }
- ]
- },
- "wasm-gc": {
- "anyOf": [
- {
- "$ref": "#/definitions/WasmGcLinkConfig"
- },
- {
- "type": "null"
- }
- ]
- }
- }
- },
- "PkgJSONImport": {
- "anyOf": [
- {
- "description": "Path and alias of an imported package",
- "type": "object",
- "additionalProperties": {
- "type": [
- "string",
- "null"
- ]
- }
- },
- {
- "type": "array",
- "items": {
- "$ref": "#/definitions/PkgJSONImportItem"
- }
- }
- ]
- },
- "PkgJSONImportItem": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "object",
- "required": [
- "alias",
- "path"
- ],
- "properties": {
- "alias": {
- "type": "string"
- },
- "path": {
- "type": "string"
- }
- }
- }
- ]
- },
- "WasmGcLinkConfig": {
- "type": "object",
- "properties": {
- "export-memory-name": {
- "type": [
- "string",
- "null"
- ]
- },
- "exports": {
- "type": [
- "array",
- "null"
- ],
- "items": {
- "type": "string"
- }
- },
- "flags": {
- "type": [
- "array",
- "null"
- ],
- "items": {
- "type": "string"
- }
- },
- "import-memory": {
- "anyOf": [
- {
- "$ref": "#/definitions/ImportMemory"
- },
- {
- "type": "null"
- }
- ]
- }
- }
- },
- "WasmLinkConfig": {
- "type": "object",
- "properties": {
- "export-memory-name": {
- "type": [
- "string",
- "null"
- ]
- },
- "exports": {
- "type": [
- "array",
- "null"
- ],
- "items": {
- "type": "string"
- }
- },
- "flags": {
- "type": [
- "array",
- "null"
- ],
- "items": {
- "type": "string"
- }
- },
- "heap-start-address": {
- "type": [
- "integer",
- "null"
- ],
- "format": "uint32",
- "minimum": 0.0
- },
- "import-memory": {
- "anyOf": [
- {
- "$ref": "#/definitions/ImportMemory"
- },
- {
- "type": "null"
- }
- ]
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/README.md b/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/README.md
index 9f155052..aeadb092 100644
--- a/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/README.md
+++ b/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/README.md
@@ -35,7 +35,7 @@ fn init {
对于 WebAssembly 后端而言,这意味着它将会在实例准备好**之前**被执行,也就是说,如果有 FFI 依赖实例的导出,那么将不能正常运行;对于 JavaScript 后端而言,这意味着它将会在被导入的时候执行。
-另一个特殊的函数是`main`函数。`main`函数是程序的入口,它将会在初始化阶段之后被执行。只有是`main`的包中才能定义`main`函数。查看[构建系统教程](./build-system-tutorial.md)了解更多。
+另一个特殊的函数是`main`函数。`main`函数是程序的入口,它将会在初始化阶段之后被执行。只有是`main`的包中才能定义`main`函数。查看[构建系统教程](https://moonbitlang.github.io/moon/zh/)了解更多。
上述两个函数均需省略参数列表与返回值定义。
@@ -583,15 +583,15 @@ let e = not(a)
MoonBit 支持整型和浮点类型:
-| 类型 | 描述 | 例子 |
-| -------- | ---------------------------- | ------- |
-| `Int` | 32 位有符号整数 | `42` |
-| `Int64` | 64 位有符号整数 | `1000L` |
-| `UInt` | 32 位无符号整数 | `14U` |
-| `UInt64` | 64 位无符号整数 | `14UL` |
-| `Double` | 64 位浮点数,由 IEEE754 定义 | `3.14` |
-| `Float` | 32 位单精度浮点数 | `(3.14 : Float)` |
-| `BigInt` | 表示任意大的整数 | `10000000000000000000000N` |
+| 类型 | 描述 | 例子 |
+| -------- | ---------------------------------------------- | ------- |
+| `Int` | 32 位有符号整数 | `42` |
+| `Int64` | 64 位有符号整数 | `1000L` |
+| `UInt` | 32 位无符号整数 | `14U` |
+| `UInt64` | 64 位无符号整数 | `14UL` |
+| `Double` | 64 位浮点数,由 IEEE754 定义 | `3.14` |
+| `Float` | 32 位单精度浮点数 | `(3.14 : Float)` |
+| `BigInt` | 表示任意大的整数 | `10000000000000000000000N` |
MoonBit 支持的数字字面量,包括十进制、二进制、八进制和十六进制。
@@ -2063,4 +2063,4 @@ fn reverse[T](xs : Array[T]) -> Array[T] {
## MoonBit 的构建系统
-构建系统的介绍参见 [MoonBit 的构建系统教程](./build-system-tutorial.md)。
+构建系统的介绍参见 [MoonBit 的构建系统教程](https://moonbitlang.github.io/moon/zh/)。
diff --git a/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/build-system-configuration.md b/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/build-system-configuration.md
deleted file mode 100644
index 83653375..00000000
--- a/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/build-system-configuration.md
+++ /dev/null
@@ -1,108 +0,0 @@
-# JSON schema for MoonBit moon.mod.json files
-
-*A module of MoonBit lang*
-
-## Properties
-
-- **`alert-list`** *(['string', 'null'])*: Alert list setting of the module.
-- **`deps`** *(['object', 'null'])*: third-party dependencies of the module. Can contain additional properties.
- - **Additional properties** *(string)*
-- **`description`** *(['string', 'null'])*: description of this module.
-- **`keywords`** *(['array', 'null'])*: keywords of this module.
- - **Items** *(string)*
-- **`license`** *(['string', 'null'])*: license of this module.
-- **`name`** *(string, required)*: name of the module.
-- **`readme`** *(['string', 'null'])*: path to module's README file.
-- **`repository`** *(['string', 'null'])*: url to module's repository.
-- **`source`** *(['string', 'null'])*: source code directory of this module.
-- **`version`** *(['string', 'null'])*: version of the module.
-- **`warn-list`** *(['string', 'null'])*: Warn list setting of the module.
-# JSON schema for MoonBit moon.pkg.json files
-
-*A package of MoonBit language*
-
-## Properties
-
-- **`alert-list`** *(['string', 'null'])*: Alert list setting of the package.
-- **`import`**: Imported packages of the package.
- - **Any of**
- - : Refer to *[#/definitions/PkgJSONImport](#definitions/PkgJSONImport)*.
- - *null*
-- **`is-main`** *(['boolean', 'null'])*: Specify whether this package is a main package or not.
-- **`link`**
- - **Any of**
- - : Refer to *[#/definitions/BoolOrLink](#definitions/BoolOrLink)*.
- - *null*
-- **`name`** *(['string', 'null'])*
-- **`test-import`**: Black box test imported packages of the package.
- - **Any of**
- - : Refer to *[#/definitions/PkgJSONImport](#definitions/PkgJSONImport)*.
- - *null*
-- **`warn-list`** *(['string', 'null'])*: Warn list setting of the package.
-- **`wbtest-import`**: White box test imported packages of the package.
- - **Any of**
- - : Refer to *[#/definitions/PkgJSONImport](#definitions/PkgJSONImport)*.
- - *null*
-## Definitions
-
-- **`BoolOrLink`**
- - **Any of**
- - *boolean*
- - : Refer to *[#/definitions/Link](#definitions/Link)*.
-- **`JsFormat`** *(string)*: Must be one of: `["esm", "cjs", "iife"]`.
-- **`JsLinkConfig`** *(object)*
- - **`exports`** *(['array', 'null'])*
- - **Items** *(string)*
- - **`format`**
- - **Any of**
- - : Refer to *[#/definitions/JsFormat](#definitions/JsFormat)*.
- - *null*
-- **`Link`** *(object)*
- - **`js`**
- - **Any of**
- - : Refer to *[#/definitions/JsLinkConfig](#definitions/JsLinkConfig)*.
- - *null*
- - **`wasm`**
- - **Any of**
- - : Refer to *[#/definitions/WasmLinkConfig](#definitions/WasmLinkConfig)*.
- - *null*
- - **`wasm-gc`**
- - **Any of**
- - : Refer to *[#/definitions/WasmGcLinkConfig](#definitions/WasmGcLinkConfig)*.
- - *null*
-- **`PkgJSONImport`**
- - **Any of**
- - *object*: Path and alias of an imported package. Can contain additional properties.
- - **Additional properties** *(['string', 'null'])*
- - *array*
- - **Items**: Refer to *[#/definitions/PkgJSONImportItem](#definitions/PkgJSONImportItem)*.
-- **`PkgJSONImportItem`**
- - **Any of**
- - *string*
- - *object*
- - **`alias`** *(string, required)*
- - **`path`** *(string, required)*
-- **`WasmGcLinkConfig`** *(object)*
- - **`export-memory-name`** *(['string', 'null'])*
- - **`exports`** *(['array', 'null'])*
- - **Items** *(string)*
- - **`flags`** *(['array', 'null'])*
- - **Items** *(string)*
- - **`import-memory`**
- - **Any of**
- - : Refer to *[#/definitions/import-memory](#definitions/import-memory)*.
- - *null*
-- **`WasmLinkConfig`** *(object)*
- - **`export-memory-name`** *(['string', 'null'])*
- - **`exports`** *(['array', 'null'])*
- - **Items** *(string)*
- - **`flags`** *(['array', 'null'])*
- - **Items** *(string)*
- - **`heap-start-address`** *(['integer', 'null'], format: uint32)*: Minimum: `0.0`.
- - **`import-memory`**
- - **Any of**
- - : Refer to *[#/definitions/import-memory](#definitions/import-memory)*.
- - *null*
-- **`import-memory`** *(object)*
- - **`module`** *(string, required)*
- - **`name`** *(string, required)*
diff --git a/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/build-system-tutorial.md b/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/build-system-tutorial.md
deleted file mode 100644
index 01da1d6a..00000000
--- a/moonbit-docs/i18n/zh/docusaurus-plugin-content-docs/current/build-system-tutorial.md
+++ /dev/null
@@ -1,345 +0,0 @@
-# MoonBit 构建系统教程
-
-`moon` 是 MoonBit 语言的构建系统,目前基于 [n2](https://github.com/evmar/n2) 项目。`moon` 支持并行构建和增量构建,此外它还支持管理和构建 [mooncakes.io](https://mooncakes.io/) 上的第三方包。
-
-## 准备工作
-
-在开始之前,请确保安装好以下内容:
-
-1. **MoonBit CLI 工具**: 从[这里](https://www.moonbitlang.cn/download/)下载。该命令行工具用于创建和管理 MoonBit 项目。
-
- 使用 `moon help` 命令可查看使用说明。
-
- ```plaintext
- $ moon help
- The build system and package manager for MoonBit.
-
- Usage: moon [OPTIONS]
-
- Commands:
- new Create a new moonbit package
- build Build the current package
- check Check the current package, but don't build object files
- run Run WebAssembly module
- test Test the current package
- clean Clean the target directory
- fmt Format moonbit source code
- doc Generate documentation
- info Generate public interface (`.mbti`) files for all packages in the module
- add Add a dependency
- remove Remove a dependency
- install Install dependencies
- tree Display the dependency tree
- login Log in to your account
- register Register an account at mooncakes.io
- publish Publish the current package
- update Update the package registry index
- coverage Code coverage utilities
- generate-build-matrix Generate build matrix for benchmarking (legacy feature)
- upgrade Upgrade toolchains
- shell-completion Generate shell completion for bash/elvish/fish/pwsh/zsh to stdout
- version Print version info and exit
- help Print this message or the help of the given subcommand(s)
-
- Options:
- -C, --directory The source code directory. Defaults to the current directory
- --target-dir The target directory. Defaults to `source_dir/target`
- -q, --quiet Suppress output
- -v, --verbose Increase verbosity
- --trace Trace the execution of the program
- --dry-run Do not actually run the command
- -h, --help Print help
- ```
-
-2. **Moonbit Language** Visual Studio Code 插件: 可以从 VS Code 市场安装。该插件为 MoonBit 提供了丰富的开发环境,包括语法高亮、代码补全、交互式除错和测试等功能。
-
-安装完成后,让我们开始创建一个新的 MoonBit 模块。
-
-## 创建一个新模块
-
-`moon` 附带一个 `moon new` 模块创建向导。默认的配置是:
-
-```plaintext
-$ moon new
-Enter the path to create the project (. for current directory): my-project
-Select the create mode: exec
-Enter your username: username
-Enter your project name: hello
-Enter your license: Apache-2.0
-Created my-project
-```
-
-向导会在 `my-project` 下创建一个新模块 `hello`。项目一词在这里与模块是互通的。
-
-## 了解模块目录结构
-
-典型的模块/项目结构如下所示:
-
-```plaintext
-my-project
-├── README.md
-├── lib
-│ ├── hello.mbt
-│ ├── hello_test.mbt
-│ └── moon.pkg.json
-├── main
-│ ├── main.mbt
-│ └── moon.pkg.json
-└── moon.mod.json
-```
-
-这里简单解释一下目录结构:
-
-- `lib` 和 `main` 目录:这些是模块中的包。每个包可以包含多个 MoonBit 源文件(.mbt)。一个包中的所有源码都共享一个 `moon.pkg.json`。
-
-- `lib/*_test.mbt` 是 `lib` 包中独立的测试文件。但 `lib` 的成员对测试是不可见的,需要显式地用 `@my-project.*` 来访问成员。这些文件只有在测试模式下才会编译,可以在这些独立测试文件中写内联测试和供测试使用的工具函数。
-
-- `moon.pkg.json`:包描述文件,定义了包的属性,例如该包是否为 `main` 包,以及它所导入的包。
-
- - `main/moon.pkg.json`:
-
- ```json
- {
- "is-main": true,
- "import": ["username/hello/lib"]
- }
- ```
-
- 其中的 `"is-main": true` 声明此包需要被构建系统链接为 `wasm` 文件。
-
- - `lib/moon.pkg.json`
-
- ```json
- {}
- ```
-
- 内容为空,其作用只是告诉构建系统该文件夹是一个包。
-
-- `moon.mod.json` 用于将目录标记为 MoonBit 模块。它包含模块的名称:
-
- ```json
- {
- "name": "username/hello",
- "version": "0.1.0",
- "readme": "README.md",
- "repository": "",
- "license": "Apache-2.0",
- "keywords": [],
- "description": ""
- }
- ```
-
-模块/包描述文件的 [json schema](./build-system-configuration.md) 给出了全面的定义规范。
-
-## 如何使用包
-
-我们的 `username/hello` 模块包含两个包:`lib` 和 `main`。
-
-- `lib` 包含 `hello.mbt` 文件与 `hello_test.mbt` 文件:
-
- `hello.mbt`
-
- ```moonbit -f=hello.mbt
- pub fn hello() -> String {
- "Hello, world!"
- }
- ```
-
- `hello_test.mbt`
-
- ```moonbit -f=hello.mbt
- test "hello" {
- if hello() != "Hello, world!" {
- fail!("hello() != \"Hello, world!\"")
- }
- }
- ```
-
-`main` 包含一个 `main.mbt` 文件:
-
-```moonbit no-check
-fn main {
- println(@lib.hello())
-}
-```
-
-要执行代码,为 `moon run` 命令指定 `main` 包所在的路径:
-
-```bash
-$ moon run main
-Hello, world!
-```
-
-可以使用 `moon test` 命令进行测试:
-
-```bash
-$ moon test
-Total tests: 1, passed: 1, failed: 0.
-```
-
-## 如何导入包
-
-MoonBit 构建系统使用模块的名称用来引用其内部包。
-要在 `main/main.mbt` 中导入 `lib` 包,需要在 `main/moon.pkg.json` 中指定:
-
-```json
-{
- "is_main": true,
- "import": ["username/hello/lib"]
-}
-```
-
-这里的 `username/hello/lib"` 指定导入 `username/hello` 模块中的 `username/hello/lib` 包,因此得以在 `main/main.mbt` 中使用 `@lib.hello()` 。
-
-注意,我们在 `main/moon.pkg.json` 中导入的包名是 `username/hello/lib`,在 `main/main.mbt` 中使用 `@lib` 来引用该包,这里的 `import` 其实是给包名 `username/hello/lib` 生成了一个默认的别名。
-
-## 创建和使用包
-
-考虑在 `lib` 下创建一个新包 `fib`,并新建两个源码文件 `lib/fib/{a,b}.mbt`。
-
-`a.mbt`:
-
-```moonbit
-pub fn fib(n : Int) -> Int {
- match n {
- 0 => 0
- 1 => 1
- _ => fib(n - 1) + fib(n - 2)
- }
-}
-```
-
-`b.mbt`:
-
-```moonbit
-pub fn fib2(num : Int) -> Int {
- fn aux(n, acc1, acc2) {
- match n {
- 0 => acc1
- 1 => acc2
- _ => aux(n - 1, acc2, acc1 + acc2)
- }
- }
-
- aux(num, 0, 1)
-}
-```
-
-`moon.pkg.json`:
-
-```json
-{}
-```
-
-现在项目结构应该如下所示:
-
-```plaintext
-my-project
-├── README.md
-├── lib
-│ ├── fib
-│ │ ├── a.mbt
-│ │ ├── b.mbt
-│ │ └── moon.pkg.json
-│ ├── hello.mbt
-│ ├── hello_test.mbt
-│ └── moon.pkg.json
-├── main
-│ ├── main.mbt
-│ └── moon.pkg.json
-└── moon.mod.json
-```
-
-修改 `main/moon.pkg.json`,导入 `username/hello/lib/fib` 包,并定义其别名为 `my_awesome_fibonacci`:
-
-```json
-{
- "is_main": true,
- "import": [
- "username/hello/lib",
- {
- "path": "username/hello/lib/fib",
- "alias": "my_awesome_fibonacci"
- }
- ]
-}
-```
-
-`main/main.mbt`:
-
-```moonbit no-check
-fn main {
- let a = @my_awesome_fibonacci.fib(10)
- let b = @my_awesome_fibonacci.fib2(11)
- println("fib(10) = \{a}, fib(11) = \{b}")
-
- println(@lib.hello())
-}
-```
-
-运行 `moon run main` 能给出预期结果:
-
-```bash
-$ moon run main
-fib(10) = 55, fib(11) = 89
-Hello, world!
-```
-
-## 添加测试
-
-MoonBit 区分白盒、黑盒测试。白盒测试指的是内联测试或一个独立的 `*_wbtest.mbt` 文件,模拟包开发者的测试场景;黑盒测试指的是 `*_test.mbt` 文件,模拟用户使用当前包的场景。
-可以为这两种测试导入不同的包:白盒测试会导入 `moon.pkg.json` 中的 `import` `test-import` 字段;黑盒测试则比白盒测试多导入一个当前包。
-
-不妨为 `fib` 添加一些内联测试来验证其正确性。`lib/fib/a.mbt`:
-
-```moonbit
-fn assert_eq[T: Show + Eq](lhs: T, rhs: T) -> Unit {
- if lhs != rhs {
- abort("assert_eq failed.\n\tlhs: \{lhs}\n\trhs: \{rhs}")
- }
-}
-
-test {
- assert_eq(fib(1), 1)
- assert_eq(fib(2), 1)
- assert_eq(fib(3), 2)
- assert_eq(fib(4), 3)
- assert_eq(fib(5), 5)
-}
-```
-
-这段代码测试了斐波那契序列的前五个项。`test { ... }` 定义了一个内联测试块。内联测试块中的代码会在测试模式下执行。
-
-内联测试块会在非测试的编译模式下被丢弃(`moon build` 和 `moon run`),所以它们不会导致生成的代码大小膨胀。
-
-## 独立的测试文件
-
-MoonBit 还支持独立的测试文件,这些文件只有在测试模式下才会加入到编译中。
-可以在这些独立测试文件中写内联测试,以及供测试使用的工具函数。例如可以在
-`lib/fib` 目录下创建一个名为 `fib_test.mbt` 的文件:
-
-`lib/fib/fib_test.mbt`:
-
-```moonbit
-test {
- assert_eq(fib(1), 1)
- assert_eq(fib2(2), 1)
- assert_eq(fib(3), 2)
- assert_eq(fib2(4), 3)
- assert_eq(fib(5), 5)
-}
-```
-
-现在可以用 `moon test`,扫描整个项目,识别并运行所有的内联测试以及所有以 `_test.mbt`/ `_wbtest.mbt` 结尾的文件。如果没有问题则输出:
-
-```bash
-$ moon test
-Total tests: 3, passed: 3, failed: 0.
-$ moon test -v
-test username/hello/lib/hello_test.mbt::hello ok
-test username/hello/lib/fib/a.mbt::0 ok
-test username/hello/lib/fib/fib_test.mbt::0 ok
-Total tests: 3, passed: 3, failed: 0.
-```
-
-注意这里也执行了 `main/main.mbt:init`,后续我们将会改善测试与包初始化函数的问题。
diff --git a/moonbit-docs/sidebars.ts b/moonbit-docs/sidebars.ts
index f6ce3c6d..df1cb128 100644
--- a/moonbit-docs/sidebars.ts
+++ b/moonbit-docs/sidebars.ts
@@ -1,5 +1,7 @@
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs'
+const isZh = process.env.DOCUSAURUS_CURRENT_LOCALE === 'zh'
+
const sidebars: SidebarsConfig = {
// By default, Docusaurus generates a sidebar from the docs folder structure
docs: [
@@ -8,10 +10,15 @@ const sidebars: SidebarsConfig = {
id: 'README',
label: 'MoonBit'
},
- 'build-system-tutorial',
+ {
+ type: 'link',
+ label: isZh ? 'MoonBit 构建系统教程' : `MoonBit's Build System Tutorial`,
+ href: isZh
+ ? 'https://moonbitlang.github.io/moon/zh/'
+ : 'https://moonbitlang.github.io/moon/'
+ },
'ffi-and-wasm-host',
'package-manage-tour',
- 'build-system-configuration',
'tour',
'error-handling',
{
diff --git a/pkg.schema.json b/pkg.schema.json
deleted file mode 100644
index fd4306d3..00000000
--- a/pkg.schema.json
+++ /dev/null
@@ -1,300 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "JSON schema for MoonBit moon.pkg.json files",
- "description": "A package of MoonBit language",
- "type": "object",
- "properties": {
- "alert-list": {
- "description": "Alert list setting of the package",
- "type": [
- "string",
- "null"
- ]
- },
- "import": {
- "description": "Imported packages of the package",
- "anyOf": [
- {
- "$ref": "#/definitions/PkgJSONImport"
- },
- {
- "type": "null"
- }
- ]
- },
- "is-main": {
- "description": "Specify whether this package is a main package or not",
- "type": [
- "boolean",
- "null"
- ]
- },
- "link": {
- "anyOf": [
- {
- "$ref": "#/definitions/BoolOrLink"
- },
- {
- "type": "null"
- }
- ]
- },
- "name": {
- "type": [
- "string",
- "null"
- ]
- },
- "test-import": {
- "description": "Black box test imported packages of the package",
- "anyOf": [
- {
- "$ref": "#/definitions/PkgJSONImport"
- },
- {
- "type": "null"
- }
- ]
- },
- "warn-list": {
- "description": "Warn list setting of the package",
- "type": [
- "string",
- "null"
- ]
- },
- "wbtest-import": {
- "description": "White box test imported packages of the package",
- "anyOf": [
- {
- "$ref": "#/definitions/PkgJSONImport"
- },
- {
- "type": "null"
- }
- ]
- }
- },
- "definitions": {
- "BoolOrLink": {
- "anyOf": [
- {
- "type": "boolean"
- },
- {
- "$ref": "#/definitions/Link"
- }
- ]
- },
- "JsFormat": {
- "type": "string",
- "enum": [
- "esm",
- "cjs",
- "iife"
- ]
- },
- "JsLinkConfig": {
- "type": "object",
- "properties": {
- "exports": {
- "type": [
- "array",
- "null"
- ],
- "items": {
- "type": "string"
- }
- },
- "format": {
- "anyOf": [
- {
- "$ref": "#/definitions/JsFormat"
- },
- {
- "type": "null"
- }
- ]
- }
- }
- },
- "Link": {
- "type": "object",
- "properties": {
- "js": {
- "anyOf": [
- {
- "$ref": "#/definitions/JsLinkConfig"
- },
- {
- "type": "null"
- }
- ]
- },
- "wasm": {
- "anyOf": [
- {
- "$ref": "#/definitions/WasmLinkConfig"
- },
- {
- "type": "null"
- }
- ]
- },
- "wasm-gc": {
- "anyOf": [
- {
- "$ref": "#/definitions/WasmGcLinkConfig"
- },
- {
- "type": "null"
- }
- ]
- }
- }
- },
- "PkgJSONImport": {
- "anyOf": [
- {
- "description": "Path and alias of an imported package",
- "type": "object",
- "additionalProperties": {
- "type": [
- "string",
- "null"
- ]
- }
- },
- {
- "type": "array",
- "items": {
- "$ref": "#/definitions/PkgJSONImportItem"
- }
- }
- ]
- },
- "PkgJSONImportItem": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "object",
- "required": [
- "alias",
- "path"
- ],
- "properties": {
- "alias": {
- "type": "string"
- },
- "path": {
- "type": "string"
- }
- }
- }
- ]
- },
- "WasmGcLinkConfig": {
- "type": "object",
- "properties": {
- "export-memory-name": {
- "type": [
- "string",
- "null"
- ]
- },
- "exports": {
- "type": [
- "array",
- "null"
- ],
- "items": {
- "type": "string"
- }
- },
- "flags": {
- "type": [
- "array",
- "null"
- ],
- "items": {
- "type": "string"
- }
- },
- "import-memory": {
- "anyOf": [
- {
- "$ref": "#/definitions/import-memory"
- },
- {
- "type": "null"
- }
- ]
- }
- }
- },
- "WasmLinkConfig": {
- "type": "object",
- "properties": {
- "export-memory-name": {
- "type": [
- "string",
- "null"
- ]
- },
- "exports": {
- "type": [
- "array",
- "null"
- ],
- "items": {
- "type": "string"
- }
- },
- "flags": {
- "type": [
- "array",
- "null"
- ],
- "items": {
- "type": "string"
- }
- },
- "heap-start-address": {
- "type": [
- "integer",
- "null"
- ],
- "format": "uint32",
- "minimum": 0.0
- },
- "import-memory": {
- "anyOf": [
- {
- "$ref": "#/definitions/import-memory"
- },
- {
- "type": "null"
- }
- ]
- }
- }
- },
- "import-memory": {
- "type": "object",
- "required": [
- "module",
- "name"
- ],
- "properties": {
- "module": {
- "type": "string"
- },
- "name": {
- "type": "string"
- }
- }
- }
- }
-}
\ No newline at end of file