mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-25 00:23:12 +09:00
Document and expose data members under lib/data
Make members of lib/data exposed under lib/data instead of lib/data/<member>.
This commit is contained in:
1 parent
7072b94355
commit
2384c48749
6 files changed
+16
-14
No files matched your search
@@ -15,7 +15,7 @@ const { integerModVersion, integerFactorioVersion, modVersionRegExp } = require(
|
|||||||
*
|
*
|
||||||
* See https://wiki.factorio.com/Tutorial:Mod_structure#info.json for
|
* See https://wiki.factorio.com/Tutorial:Mod_structure#info.json for
|
||||||
* details of the invidiual fields sourced from info.json.
|
* details of the invidiual fields sourced from info.json.
|
||||||
* @alias module:lib/data/ModInfo
|
* @alias module:lib/data.ModInfo
|
||||||
*/
|
*/
|
||||||
class ModInfo {
|
class ModInfo {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const { integerFactorioVersion } = require("./version");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A setting for a mod.
|
* A setting for a mod.
|
||||||
* @typedef {object} module:lib/data/ModPack~ModSetting
|
* @typedef {object} module:lib/data.ModPack~ModSetting
|
||||||
* @property {boolean|number|string} value - Value of the given mod setting.
|
* @property {boolean|number|string} value - Value of the given mod setting.
|
||||||
*/
|
*/
|
||||||
const ModSettingJsonSchema = {
|
const ModSettingJsonSchema = {
|
||||||
@@ -27,10 +27,10 @@ const ModSettingsJsonSchema = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A mod in a mod pack
|
* A mod in a mod pack
|
||||||
* @typedef {object} module:lib/data/ModPack~ModRecord
|
* @typedef {object} module:lib/data.ModPack~ModRecord
|
||||||
* @property {string} name - name of the mod.
|
* @property {string} name - name of the mod.
|
||||||
* @property {string} version - version of the mod.
|
* @property {string} version - version of the mod.
|
||||||
* @property {string} sha1 - SHA1 hash of the zip file.
|
* @property {string=} sha1 - SHA1 hash of the zip file.
|
||||||
*/
|
*/
|
||||||
const ModRecordJsonSchema = {
|
const ModRecordJsonSchema = {
|
||||||
type: "object",
|
type: "object",
|
||||||
@@ -47,7 +47,7 @@ const ModRecordJsonSchema = {
|
|||||||
* Factorio Mod Pack
|
* Factorio Mod Pack
|
||||||
*
|
*
|
||||||
* Tracks mods and settings for a collection of Factorio mods.
|
* Tracks mods and settings for a collection of Factorio mods.
|
||||||
* @alias module:lib/data/ModPack
|
* @alias module:lib/data.ModPack
|
||||||
*/
|
*/
|
||||||
class ModPack {
|
class ModPack {
|
||||||
/**
|
/**
|
||||||
@@ -84,13 +84,13 @@ class ModPack {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Mods included in this mod pack
|
* Mods included in this mod pack
|
||||||
* @type {Map<string, module:lib/data/ModPack~ModRecord>}
|
* @type {Map<string, module:lib/data.ModPack~ModRecord>}
|
||||||
*/
|
*/
|
||||||
mods = new Map();
|
mods = new Map();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mod settings for this mod pack
|
* Mod settings for this mod pack
|
||||||
* @type {Object<string, Map<string, module:lib/data/ModPack~ModSetting>>=}
|
* @type {Object<string, Map<string, module:lib/data.ModPack~ModSetting>>=}
|
||||||
*/
|
*/
|
||||||
settings = {
|
settings = {
|
||||||
"startup": new Map(),
|
"startup": new Map(),
|
||||||
|
|||||||
@@ -6,8 +6,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
const ModInfo = require("./ModInfo");
|
const ModInfo = require("./ModInfo");
|
||||||
const ModPack = require("./ModPack");
|
const ModPack = require("./ModPack");
|
||||||
|
const version = require("./version");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
ModInfo,
|
ModInfo,
|
||||||
ModPack,
|
ModPack,
|
||||||
|
...version,
|
||||||
};
|
};
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
* number of leading zeros in them.
|
* number of leading zeros in them.
|
||||||
* @param {string} version - string representation of version.
|
* @param {string} version - string representation of version.
|
||||||
* @returns {number} numeric representation.
|
* @returns {number} numeric representation.
|
||||||
* @private
|
* @alias module:lib/data.integerModVersion
|
||||||
*/
|
*/
|
||||||
function integerModVersion(version) {
|
function integerModVersion(version) {
|
||||||
const [major, minor, sub] = version.split(".").map(n => Number.parseInt(n, 10));
|
const [major, minor, sub] = version.split(".").map(n => Number.parseInt(n, 10));
|
||||||
@@ -23,7 +23,7 @@ function integerModVersion(version) {
|
|||||||
* number of leading zeros in them.
|
* number of leading zeros in them.
|
||||||
* @param {string} version - string representation of version.
|
* @param {string} version - string representation of version.
|
||||||
* @returns {number} numeric representation.
|
* @returns {number} numeric representation.
|
||||||
* @private
|
* @alias module:lib/data.integerFactorioVersion
|
||||||
*/
|
*/
|
||||||
function integerFactorioVersion(version) {
|
function integerFactorioVersion(version) {
|
||||||
const [major, minor, sub] = version.split(".").map(n => Number.parseInt(n, 10));
|
const [major, minor, sub] = version.split(".").map(n => Number.parseInt(n, 10));
|
||||||
@@ -33,7 +33,7 @@ function integerFactorioVersion(version) {
|
|||||||
/**
|
/**
|
||||||
* Matches valid mod versions.
|
* Matches valid mod versions.
|
||||||
* @type {RegExp}
|
* @type {RegExp}
|
||||||
* @private
|
* @alias module:lib/data.modVersionRegExp
|
||||||
*/
|
*/
|
||||||
const modVersionRegExp = /^\d+\.\d+\.\d+$/;
|
const modVersionRegExp = /^\d+\.\d+\.\d+$/;
|
||||||
|
|
||||||
|
|||||||
@@ -502,7 +502,7 @@ class BaseMasterPlugin {
|
|||||||
* If the mod pack has been deleted its `.isDeleted` property will be
|
* If the mod pack has been deleted its `.isDeleted` property will be
|
||||||
* true.
|
* true.
|
||||||
*
|
*
|
||||||
* @param {module:lib/data/ModPack} modPack - Mod pack that updated.
|
* @param {module:lib/data.ModPack} modPack - Mod pack that updated.
|
||||||
*/
|
*/
|
||||||
async onModPackUpdated(modPack) { }
|
async onModPackUpdated(modPack) { }
|
||||||
|
|
||||||
@@ -514,7 +514,7 @@ class BaseMasterPlugin {
|
|||||||
*
|
*
|
||||||
* If a mod has been deleted its `.isDeleted` property will be true.
|
* If a mod has been deleted its `.isDeleted` property will be true.
|
||||||
*
|
*
|
||||||
* @param {module:lib/data/ModInfo} mod - Mod that updated.
|
* @param {module:lib/data.ModInfo} mod - Mod that updated.
|
||||||
*/
|
*/
|
||||||
async onModUpdated(mod) { }
|
async onModUpdated(mod) { }
|
||||||
|
|
||||||
|
|||||||
@@ -68,13 +68,13 @@ class Master {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Mapping of mod pack id to mod pack
|
* Mapping of mod pack id to mod pack
|
||||||
* @type {Map<number, module:lib/data/ModPack>}
|
* @type {Map<number, module:lib/data.ModPack>}
|
||||||
*/
|
*/
|
||||||
this.modPacks = null;
|
this.modPacks = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mapping of mod names to mod infos
|
* Mapping of mod names to mod infos
|
||||||
* @type {Map<string, module:lib/data/ModInfo>}
|
* @type {Map<string, module:lib/data.ModInfo>}
|
||||||
*/
|
*/
|
||||||
this.mods = null;
|
this.mods = null;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user