@cepheus/cli
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -1,3 +0,3 @@ | ||
import { N, clamp, toPrecision } from './chunk-MR3ZO35F.js'; | ||
import { memoize, once, map, groupBy, uniq, compact, isNumber, isArray, isPlainObject, range, sortBy, difference } from 'lodash-es'; | ||
import { N, toPrecision, clamp } from './chunk-MR3ZO35F.js'; | ||
import { memoize, once, sortBy, range, compact, map, groupBy, uniq, isNumber, isArray, isPlainObject, difference } from 'lodash-es'; | ||
import { createHash } from 'node:crypto'; | ||
@@ -272,7 +272,7 @@ import { toPosition, szudzik2, unszudzik2, convexHull, cartesianProduct, toSquare } from '@cepheus/utilities'; | ||
const key = keys.find((key2) => bestTasks.has(key2)); | ||
if (key !== void 0) { | ||
if (key !== undefined) { | ||
const task = bestTasks.get(key); | ||
return [square, task]; | ||
} | ||
return void 0; | ||
return undefined; | ||
}) | ||
@@ -279,0 +279,0 @@ ) |
@@ -8,3 +8,3 @@ #!/usr/bin/env node | ||
import fs, { readFile, writeFile } from 'node:fs/promises'; | ||
import { isInteger, isString, map, throttle, repeat, flattenDeep, isError } from 'lodash-es'; | ||
import { isInteger, isString, map, throttle, repeat, isError, flattenDeep } from 'lodash-es'; | ||
import ora from 'ora'; | ||
@@ -135,3 +135,3 @@ import path, { resolve } from 'node:path'; | ||
const precision = arguments_["--precision"]; | ||
if (randomSeed === void 0) { | ||
if (randomSeed === undefined) { | ||
console.log(HELP); | ||
@@ -141,3 +141,3 @@ console.error(`Option '--seed' must be defined.`); | ||
} | ||
if (output === void 0) { | ||
if (output === undefined) { | ||
console.log(HELP); | ||
@@ -147,3 +147,3 @@ console.error(`Option '--output' must be defined.`); | ||
} | ||
if (colors === void 0 || colors.length <= 1) { | ||
if (colors === undefined || colors.length <= 1) { | ||
console.log(HELP); | ||
@@ -153,3 +153,3 @@ console.error(`At lest two '--color' options must be provided.`); | ||
} | ||
if (colorSpace !== void 0 && !["p3", "srgb"].includes(colorSpace)) { | ||
if (colorSpace !== undefined && !["p3", "srgb"].includes(colorSpace)) { | ||
console.log(HELP); | ||
@@ -159,3 +159,3 @@ console.error(`Option '--color-space' must be either 'p3' or 'srgb'.`); | ||
} | ||
if (randomSource !== void 0 && !["sfc32", "xorshift128", "xorwow", "xoshiro128++"].includes(randomSource)) { | ||
if (randomSource !== undefined && !["sfc32", "xorshift128", "xorwow", "xoshiro128++"].includes(randomSource)) { | ||
console.log(HELP); | ||
@@ -167,3 +167,3 @@ console.error( | ||
} | ||
if (levels !== void 0 && !N_DIVISORS.includes(levels)) { | ||
if (levels !== undefined && !N_DIVISORS.includes(levels)) { | ||
console.log(HELP); | ||
@@ -173,3 +173,3 @@ console.error(`Option '--levels' must be one of ${N_DIVISORS.join(", ")}.`); | ||
} | ||
if (iterations !== void 0 && !(isInteger(iterations) && iterations >= 1)) { | ||
if (iterations !== undefined && !(isInteger(iterations) && iterations >= 1)) { | ||
console.log(HELP); | ||
@@ -179,3 +179,3 @@ console.error(`Option '--iterations' must be an integer greater or equal to 1.`); | ||
} | ||
if (hueAngle !== void 0 && !(isInteger(hueAngle) && hueAngle >= 1)) { | ||
if (hueAngle !== undefined && !(isInteger(hueAngle) && hueAngle >= 1)) { | ||
console.log(HELP); | ||
@@ -185,3 +185,3 @@ console.error(`Option '--hue-angle' must be an integer greater or equal to 1.`); | ||
} | ||
if (precision !== void 0 && !(isInteger(precision) && precision >= 2 && precision <= 10)) { | ||
if (precision !== undefined && !(isInteger(precision) && precision >= 2 && precision <= 10)) { | ||
console.log(HELP); | ||
@@ -198,4 +198,4 @@ console.error( | ||
const { cepheus } = await import('./index.js'); | ||
const session = isString(arguments_["--session"]) ? path.resolve(process.cwd(), arguments_["--session"]) : void 0; | ||
const initialState = session !== void 0 && await isFile(session) ? JSON.parse(await readFile(session, "utf8")) : void 0; | ||
const session = isString(arguments_["--session"]) ? path.resolve(process.cwd(), arguments_["--session"]) : undefined; | ||
const initialState = session !== undefined && await isFile(session) ? JSON.parse(await readFile(session, "utf8")) : undefined; | ||
const spinner = ora({ text: "Preparing" }).start(); | ||
@@ -239,3 +239,3 @@ const instance = cepheus({ | ||
instance.store.on("optimizeTask", async () => { | ||
if (session !== void 0) { | ||
if (session !== undefined) { | ||
await writeFile( | ||
@@ -242,0 +242,0 @@ session, |
@@ -1,9 +0,9 @@ | ||
import { calculateBackground, hash, objectHash, selectorOptimizeTasksPending, selectorSquares, selectorRemainingSquares, selectorState } from './chunk-AYVGN3NF.js'; | ||
import { N, DEFAULT_N_DIVISOR, DEFAULT_ITERATIONS, N_DIVISORS, DEFAULT_HUE_ANGLE, DEFAULT_PRECISION, DEFAULT_WEIGHTS, normalizeWeights } from './chunk-MR3ZO35F.js'; | ||
import { selectorSquares, selectorRemainingSquares, selectorState, hash, objectHash, selectorOptimizeTasksPending, calculateBackground } from './chunk-AYVGN3NF.js'; | ||
import { normalizeWeights, N, DEFAULT_N_DIVISOR, DEFAULT_ITERATIONS, N_DIVISORS, DEFAULT_HUE_ANGLE, DEFAULT_PRECISION, DEFAULT_WEIGHTS } from './chunk-MR3ZO35F.js'; | ||
export { TypeCepheusState } from './chunk-MR3ZO35F.js'; | ||
import { isString, isInteger, omit, range, map, isError, assign } from 'lodash-es'; | ||
import { range, isError, assign, map, omit, isString, isInteger } from 'lodash-es'; | ||
import { setMaxListeners } from 'node:events'; | ||
import Tinypool from 'tinypool'; | ||
import { tile, toPosition } from '@cepheus/utilities'; | ||
import { ColorSpace as ColorSpace$1, normalizeAngle } from 'cepheus'; | ||
import { normalizeAngle, ColorSpace as ColorSpace$1 } from 'cepheus'; | ||
import Emittery from 'emittery'; | ||
@@ -31,3 +31,3 @@ import { ColorSpace, HSL, HSV, P3, OKLab, OKLCH, sRGB, LCH, to, parse } from 'colorjs.io/fn'; | ||
function actionCreateOptimizeTasks(store, iteration, options = {}) { | ||
const squares = options.squares === void 0 ? tile(store.options.interval) : Array.from(options.squares.keys()); | ||
const squares = options.squares === undefined ? tile(store.options.interval) : Array.from(options.squares.keys()); | ||
squares.forEach((square) => { | ||
@@ -37,3 +37,3 @@ store.indexSquare.set(square, /* @__PURE__ */ new Map()); | ||
squares.forEach((square) => { | ||
const squareOptions = options.squares === void 0 ? createSquareOptions(square, store.options.interval) : ( | ||
const squareOptions = options.squares === undefined ? createSquareOptions(square, store.options.interval) : ( | ||
// eslint-disable-next-line typescript/no-non-null-assertion | ||
@@ -51,3 +51,3 @@ options.squares.get(square) | ||
tolerance: options.tolerance ?? 1, | ||
weights: options?.weights === void 0 ? store.options.weights : normalizeWeights(options.weights), | ||
weights: options?.weights === undefined ? store.options.weights : normalizeWeights(options.weights), | ||
...squareOptions | ||
@@ -75,3 +75,3 @@ }; | ||
const value = store.indexState.get(key); | ||
if (value === void 0) { | ||
if (value === undefined) { | ||
throw new Error("Task key unknown."); | ||
@@ -127,3 +127,3 @@ } | ||
const colorSpace = (options.colorSpace ?? "p3") === "p3" ? ColorSpace$1.p3 : ColorSpace$1.srgb; | ||
const hueAngle = options.hueAngle === void 0 ? DEFAULT_HUE_ANGLE : normalizeAngle(options.hueAngle); | ||
const hueAngle = options.hueAngle === undefined ? DEFAULT_HUE_ANGLE : normalizeAngle(options.hueAngle); | ||
const precision = options.precision ?? DEFAULT_PRECISION; | ||
@@ -130,0 +130,0 @@ return { |
@@ -7,3 +7,3 @@ import { N, clamp } from './chunk-MR3ZO35F.js'; | ||
import { map, flatMap } from 'lodash-es'; | ||
import { mean, sample, standardDeviation, sum, errorFunction } from 'simple-statistics'; | ||
import { mean, sample, sum, errorFunction, standardDeviation } from 'simple-statistics'; | ||
import fnv1a from '@sindresorhus/fnv1a'; | ||
@@ -26,3 +26,3 @@ import { Xoshiro128, XorWow, XorShift128, SFC32 } from '@thi.ng/random'; | ||
for (let index = 0; index < 4; index += 1) { | ||
if (hashes[index] === void 0) { | ||
if (hashes[index] === undefined) { | ||
hashes[index] = EMPTY_FNV1A; | ||
@@ -140,3 +140,3 @@ } | ||
let iterations = 1e4; | ||
const isInitial = temperature === void 0 || referenceColor === void 0; | ||
const isInitial = temperature === undefined || referenceColor === undefined; | ||
const space = options.colorSpace === ColorSpace$1.p3 ? sRGB : P3; | ||
@@ -170,3 +170,3 @@ while (iterations !== 0) { | ||
const convertedColors = map(colors, (color) => { | ||
if (deficiency === void 0) { | ||
if (deficiency === undefined) { | ||
return { alpha: 1, coords: color, space: OKLCH }; | ||
@@ -173,0 +173,0 @@ } |
{ | ||
"name": "@cepheus/cli", | ||
"description": "", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"author": { | ||
@@ -15,18 +15,18 @@ "name": "escapace", | ||
"@bjornlu/colorblind": "^1.0.3", | ||
"@escapace/minimum-perimeter-triangle": "^0.2.5", | ||
"@escapace/minimum-perimeter-triangle": "^0.2.6", | ||
"@sindresorhus/fnv1a": "^3.1.0", | ||
"@texel/color": "^1.1.4", | ||
"@thi.ng/random": "^4.1.4", | ||
"@texel/color": "^1.1.9", | ||
"@thi.ng/random": "^4.1.10", | ||
"arg": "^5.0.2", | ||
"bignumber.js": "^9.1.2", | ||
"chalk": "^5.3.0", | ||
"chalk": "^5.4.1", | ||
"colorjs.io": "^0.5.2", | ||
"emittery": "^1.0.3", | ||
"emittery": "^1.1.0", | ||
"lodash-es": "^4.17.21", | ||
"ora": "^8.1.1", | ||
"ora": "^8.2.0", | ||
"simple-statistics": "^7.8.7", | ||
"tinypool": "^1.0.2", | ||
"utility-types": "^3.11.0", | ||
"@cepheus/utilities": "1.2.1", | ||
"cepheus": "1.2.1" | ||
"@cepheus/utilities": "1.2.2", | ||
"cepheus": "1.2.2" | ||
}, | ||
@@ -36,17 +36,17 @@ "devDependencies": { | ||
"@types/lodash-es": "4.17.12", | ||
"@types/node": "22.10.1", | ||
"@vitest/coverage-v8": "2.1.6", | ||
"eslint": "9.15.0", | ||
"eslint-config-escapace": "5.3.1", | ||
"esroll": "0.3.0", | ||
"prettier": "3.4.1", | ||
"@types/node": "22.13.1", | ||
"@vitest/coverage-v8": "3.0.5", | ||
"eslint": "9.19.0", | ||
"eslint-config-escapace": "5.4.2", | ||
"esroll": "0.4.0", | ||
"prettier": "3.4.2", | ||
"prettier-config-escapace": "1.2.1", | ||
"syncpack": "13.0.0", | ||
"syncpack": "13.0.2", | ||
"tsx": "4.19.2", | ||
"typescript": "5.6.2", | ||
"vitest": "2.1.6" | ||
"typescript": "5.7.3", | ||
"vitest": "3.0.5" | ||
}, | ||
"engines": { | ||
"node": ">=20.15.0", | ||
"pnpm": ">=9.11.0" | ||
"node": ">=22.13.1", | ||
"pnpm": ">=9.15.4" | ||
}, | ||
@@ -53,0 +53,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
142950
+ Added@cepheus/utilities@1.2.2(transitive)
+ Addedcepheus@1.2.2(transitive)
- Removed@cepheus/utilities@1.2.1(transitive)
- Removedcepheus@1.2.1(transitive)
Updated@cepheus/utilities@1.2.2
Updated@texel/color@^1.1.9
Updated@thi.ng/random@^4.1.10
Updatedcepheus@1.2.2
Updatedchalk@^5.4.1
Updatedemittery@^1.1.0
Updatedora@^8.2.0