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:
Hornwitser committed 2022-09-26 16:54:19 +02:00
1 parent 7072b94355
commit 2384c48749
6 files changed
+16 -14

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ const { integerModVersion, integerFactorioVersion, modVersionRegExp } = require(
*
* See https://wiki.factorio.com/Tutorial:Mod_structure#info.json for
* details of the invidiual fields sourced from info.json.
* @alias module:lib/data/ModInfo
* @alias module:lib/data.ModInfo
*/
class ModInfo {
/**
+6 -6
View File
@@ -8,7 +8,7 @@ const { integerFactorioVersion } = require("./version");
/**
* 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.
*/
const ModSettingJsonSchema = {
@@ -27,10 +27,10 @@ const ModSettingsJsonSchema = {
/**
* 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} 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 = {
type: "object",
@@ -47,7 +47,7 @@ const ModRecordJsonSchema = {
* Factorio Mod Pack
*
* Tracks mods and settings for a collection of Factorio mods.
* @alias module:lib/data/ModPack
* @alias module:lib/data.ModPack
*/
class ModPack {
/**
@@ -84,13 +84,13 @@ class ModPack {
/**
* 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();
/**
* 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 = {
"startup": new Map(),
+2
View File
@@ -6,8 +6,10 @@
"use strict";
const ModInfo = require("./ModInfo");
const ModPack = require("./ModPack");
const version = require("./version");
module.exports = {
ModInfo,
ModPack,
...version,
};
+3 -3
View File
@@ -9,7 +9,7 @@
* number of leading zeros in them.
* @param {string} version - string representation of version.
* @returns {number} numeric representation.
* @private
* @alias module:lib/data.integerModVersion
*/
function integerModVersion(version) {
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.
* @param {string} version - string representation of version.
* @returns {number} numeric representation.
* @private
* @alias module:lib/data.integerFactorioVersion
*/
function integerFactorioVersion(version) {
const [major, minor, sub] = version.split(".").map(n => Number.parseInt(n, 10));
@@ -33,7 +33,7 @@ function integerFactorioVersion(version) {
/**
* Matches valid mod versions.
* @type {RegExp}
* @private
* @alias module:lib/data.modVersionRegExp
*/
const modVersionRegExp = /^\d+\.\d+\.\d+$/;
+2 -2
View File
@@ -502,7 +502,7 @@ class BaseMasterPlugin {
* If the mod pack has been deleted its `.isDeleted` property will be
* true.
*
* @param {module:lib/data/ModPack} modPack - Mod pack that updated.
* @param {module:lib/data.ModPack} modPack - Mod pack that updated.
*/
async onModPackUpdated(modPack) { }
@@ -514,7 +514,7 @@ class BaseMasterPlugin {
*
* 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) { }
+2 -2
View File
@@ -68,13 +68,13 @@ class Master {
/**
* 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;
/**
* Mapping of mod names to mod infos
* @type {Map<string, module:lib/data/ModInfo>}
* @type {Map<string, module:lib/data.ModInfo>}
*/
this.mods = null;