跳到主要内容

MoonBit 构建系统配置

moon.mod.json的JSON Schema

月兔的一个模块

$schemahttp://json-schema.org/draft-07/schema#

属性

名称类型
nameString
versionString
depsObject
readmeString
repositoryString
licenseString

name

描述模块名称
类型String
必填

version

描述模块版本号,遵循 Semantic Versioning 2.0.0
类型String
必填

deps

描述模块的第三方依赖
类型Object
必填

readme

描述模块“读我“文件路径
类型字符串
必填

repository

描述模块仓库链接
类型String
必填
格式uri

license

描述模块的许可证,一个SPDX标识符
类型String
必填

Schema

{
"$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",
"properties": {
"name": {
"description": "Name of the module",
"type": "string"
},
"version": {
"description": "Version of the module, following Semantic Versioning 2.0.0",
"type": "string"
},
"deps": {
"description": "Third-party dependencies of the module",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"readme": {
"description": "Path to module's README file",
"type": "string"
},
"repository": {
"description": "URL to module's repository",
"type": "string",
"format": "uri"
},
"license": {
"description": "License of the module, an SPDX identifier",
"type": "string"
}
},
"required": [
"name"
]
}

moon.pkg.json的JSON Schema

月兔的一个包

$schemahttp://json-schema.org/draft-07/schema#

属性

名称类型
name字符串
is-main布尔值
import其中之一:对象
数组
link其中之一:布尔值
对象

name

描述包的名称(已弃用)
类型字符串
必需

is-main

描述指定该包是否为主包
类型布尔值
必需

import

描述导入的包
类型其中之一:对象
数组
必需

import.0

标题对象形式
类型对象

import.1

标题数组形式
类型数组
类型其中之一:布尔值
对象
必需

link.0

标题构建此包
类型布尔值

link.1

标题构建配置
描述为每个后端配置构建
类型对象

link.1.wasm

类型对象

link.1.wasm.exports

描述包的导出函数
类型数组

link.1.wasm.export-memory-name

描述导出的内存的名称,或者不导出内存
类型字符串

link.1.wasm.flags

描述包的编译标志
类型数组

link.1.wasm-gc

类型对象

link.1.wasm-gc.exports

描述包的导出函数
类型数组

link.1.wasm-gc.export-memory-name

描述导出的内存的名称,或者不导出内存
类型字符串

link.1.wasm-gc.flags

描述包的编译标志
类型数组

link.1.js

类型对象

link.1.js.exports

描述包的导出函数
类型数组

link.1.js.format

描述输出 JavaScript 文件的格式
枚举
  • esm
  • cjs
  • iife

模式

Schema

{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "JSON schema for Moonbit moon.pkg.json files",
"description": "A package in Moonbit lang",
"type": "object",
"properties": {
"name": {
"description": "Name of the package (Deprecated)",
"type": "string"
},
"is-main": {
"description": "Specify whether this package is a main package or not",
"type": "boolean",
"default": false
},
"import": {
"description": "Imported packages of the package",
"oneOf": [
{
"title": "Object form",
"type": "object",
"additionalProperties": {
"description": "Path and alias of an imported package",
"type": [
"string",
"null"
]
}
},
{
"title": "Array form",
"type": "array",
"items": {
"oneOf": [
{
"title": "Package without alias",
"description": "Path of an imported package",
"type": "string"
},
{
"title": "Package with alias",
"description": "Path and alias of an imported package",
"type": "object",
"properties": {
"path": {
"description": "Path of an imported package",
"type": "string"
},
"alias": {
"description": "Alias of an imported package",
"type": "string"
}
},
"additionalProperties": false,
"required": [
"path",
"alias"
]
}
]
}
}
]
},
"link": {
"oneOf": [
{
"title": "Build this package",
"type": "boolean"
},
{
"title": "Build configuration",
"description": "Configure the build for each backend",
"type": "object",
"properties": {
"wasm": {
"type": "object",
"properties": {
"exports": {
"description": "Exported functions of the package",
"type": "array",
"items": {
"description": "Name of an exported function, or followed by a colon and the alias name",
"type": "string"
}
},
"export-memory-name": {
"description": "Name of the exported memory, or no memory will be exported",
"type": "string"
},
"flags": {
"description": "Flags for the compilation of the package",
"type": "array",
"items": {
"type": "string",
"enum": [
"-no-block-params"
]
}
}
},
"additionalProperties": false
},
"wasm-gc": {
"type": "object",
"properties": {
"exports": {
"description": "Exported functions of the package",
"type": "array",
"items": {
"description": "Name of an exported function, or followed by a colon and the alias name",
"type": "string"
}
},
"export-memory-name": {
"description": "Name of the exported memory, or no memory will be exported",
"type": "string"
},
"flags": {
"description": "Flags for the compilation of the package",
"type": "array",
"items": {
"type": "string",
"enum": [
"-no-block-params"
]
}
}
},
"additionalProperties": false
},
"js": {
"type": "object",
"properties": {
"exports": {
"description": "Exported functions of the package",
"type": "array",
"items": {
"description": "Name of an exported function, or followed by a colon and the alias name",
"type": "string"
}
},
"format": {
"description": "Format of the output JavaScript file",
"enum": [
"esm",
"cjs",
"iife"
]
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
]
}
},
"required": []
}