aboutsummaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/build-libs.js4
-rw-r--r--dev/data-error.js3
-rw-r--r--dev/dictionary-validate.js13
-rw-r--r--dev/generate-css-json.js9
-rw-r--r--dev/schema-validate.js1
-rw-r--r--dev/translator-vm.js13
-rw-r--r--dev/util.js1
7 files changed, 31 insertions, 13 deletions
diff --git a/dev/build-libs.js b/dev/build-libs.js
index c3994ab3..a992f20a 100644
--- a/dev/build-libs.js
+++ b/dev/build-libs.js
@@ -45,7 +45,9 @@ async function buildLib(scriptPath) {
});
}
-/** */
+/**
+ * Bundles libraries.
+ */
export async function buildLibs() {
const devLibPath = path.join(dirname, 'lib');
const files = await fs.promises.readdir(devLibPath, {
diff --git a/dev/data-error.js b/dev/data-error.js
index 5034e3fd..0ab2d354 100644
--- a/dev/data-error.js
+++ b/dev/data-error.js
@@ -15,6 +15,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+/**
+ * Schema validation error type.
+ */
class DataError extends Error {
/**
* @param {string} message
diff --git a/dev/dictionary-validate.js b/dev/dictionary-validate.js
index a6948bfe..6778f2ea 100644
--- a/dev/dictionary-validate.js
+++ b/dev/dictionary-validate.js
@@ -71,9 +71,10 @@ async function validateDictionaryBanks(mode, zip, fileNameFormat, schema) {
}
/**
- * @param {import('dev/schema-validate').ValidateMode} mode
- * @param {import('jszip')} archive
- * @param {import('dev/dictionary-validate').Schemas} schemas
+ * Validates a dictionary.
+ * @param {import('dev/schema-validate').ValidateMode} mode Mode of validation.
+ * @param {import('jszip')} archive Zip archive of the dictionary.
+ * @param {import('dev/dictionary-validate').Schemas} schemas Schema to use for validation.
*/
export async function validateDictionary(mode, archive, schemas) {
const fileName = 'index.json';
@@ -102,6 +103,7 @@ export async function validateDictionary(mode, archive, schemas) {
}
/**
+ * Returns a Schemas object from ext/data/schemas/*.
* @returns {import('dev/dictionary-validate').Schemas}
*/
export function getSchemas() {
@@ -118,8 +120,9 @@ export function getSchemas() {
}
/**
- * @param {import('dev/schema-validate').ValidateMode} mode
- * @param {string[]} dictionaryFileNames
+ * Validates dictionary files and logs the results to the console.
+ * @param {import('dev/schema-validate').ValidateMode} mode Mode of validation.
+ * @param {string[]} dictionaryFileNames Dictionary file names.
*/
export async function testDictionaryFiles(mode, dictionaryFileNames) {
const schemas = getSchemas();
diff --git a/dev/generate-css-json.js b/dev/generate-css-json.js
index e5d4d7f0..a0035346 100644
--- a/dev/generate-css-json.js
+++ b/dev/generate-css-json.js
@@ -86,11 +86,11 @@ function removeProperty(styles, property, removedProperties) {
}
/**
- * @param {import('css-style-applier').RawStyleData} rules
+ * Manually formats JSON for improved compactness.
+ * @param {import('css-style-applier').RawStyleData} rules CSS ruleset.
* @returns {string}
*/
export function formatRulesJson(rules) {
- // Manually format JSON, for improved compactness
// return JSON.stringify(rules, null, 4);
const indent1 = ' ';
const indent2 = indent1.repeat(2);
@@ -123,8 +123,9 @@ export function formatRulesJson(rules) {
}
/**
- * @param {string} cssFile
- * @param {string} overridesCssFile
+ * Generates a CSS ruleset.
+ * @param {string} cssFile Path to CSS file.
+ * @param {string} overridesCssFile Path to override CSS file.
* @returns {import('css-style-applier').RawStyleData}
* @throws {Error}
*/
diff --git a/dev/schema-validate.js b/dev/schema-validate.js
index a1fe8455..81953f49 100644
--- a/dev/schema-validate.js
+++ b/dev/schema-validate.js
@@ -52,6 +52,7 @@ class JsonSchemaAjv {
}
/**
+ * Creates a JSON Schema.
* @param {import('dev/schema-validate').ValidateMode} mode
* @param {import('dev/schema-validate').Schema} schema
* @returns {JsonSchema|JsonSchemaAjv}
diff --git a/dev/translator-vm.js b/dev/translator-vm.js
index 60777da0..f407e57e 100644
--- a/dev/translator-vm.js
+++ b/dev/translator-vm.js
@@ -32,6 +32,9 @@ vi.mock('../ext/js/language/dictionary-importer-media-loader.js', async () => aw
const dirname = path.dirname(fileURLToPath(import.meta.url));
+/**
+ * Translator Virtual Machine.
+ */
export class TranslatorVM {
constructor() {
/** @type {import('dev/vm').PseudoChrome} */
@@ -55,15 +58,19 @@ export class TranslatorVM {
this._dictionaryName = null;
}
- /** @type {Translator} */
+ /**
+ * Returns this VM's translator.
+ * @type {Translator}
+ */
get translator() {
if (this._translator === null) { throw new Error('Not prepared'); }
return this._translator;
}
/**
- * @param {string} dictionaryDirectory
- * @param {string} dictionaryName
+ * Initialize this translator VM from a dictionary.
+ * @param {string} dictionaryDirectory Directory of the dictionary files.
+ * @param {string} dictionaryName Name of the dictionary.
*/
async prepare(dictionaryDirectory, dictionaryName) {
// Dictionary
diff --git a/dev/util.js b/dev/util.js
index c27ccb2d..f45966c4 100644
--- a/dev/util.js
+++ b/dev/util.js
@@ -97,6 +97,7 @@ export function getAllFiles(baseDirectory, predicate = null) {
}
/**
+ * Creates a zip archive from the given dictionary directory.
* @param {string} dictionaryDirectory
* @param {string} [dictionaryName]
* @returns {import('jszip')}