From 7a3038b982c4d318e146698527070f096591aa4f Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 16 Feb 2024 09:39:14 -0400 Subject: sugar: move many functions into new #aggregate import --- src/data/checks.js | 5 ++--- src/data/composite.js | 17 +++++------------ src/data/language.js | 4 ++-- src/data/things/index.js | 2 +- src/data/things/language.js | 3 ++- src/data/validators.js | 11 ++--------- src/data/yaml.js | 9 +++------ 7 files changed, 17 insertions(+), 34 deletions(-) (limited to 'src/data') diff --git a/src/data/checks.js b/src/data/checks.js index 25e94aa9..ad86087b 100644 --- a/src/data/checks.js +++ b/src/data/checks.js @@ -4,19 +4,18 @@ import {inspect as nodeInspect} from 'node:util'; import {colors, ENABLE_COLOR} from '#cli'; import CacheableObject from '#cacheable-object'; +import {compareArrays, empty} from '#sugar'; import Thing from '#thing'; import thingConstructors from '#things'; import {commentaryRegexCaseSensitive} from '#wiki-data'; import { - compareArrays, conditionallySuppressError, decorateErrorWithIndex, - empty, filterAggregate, openAggregate, withAggregate, -} from '#sugar'; +} from '#aggregate'; function inspect(value, opts = {}) { return nodeInspect(value, {colors: ENABLE_COLOR, ...opts}); diff --git a/src/data/composite.js b/src/data/composite.js index 4f89d887..7a98c424 100644 --- a/src/data/composite.js +++ b/src/data/composite.js @@ -1,19 +1,12 @@ import {inspect} from 'node:util'; +import {decorateErrorWithIndex, openAggregate, withAggregate} + from '#aggregate'; import {colors} from '#cli'; -import {TupleMap} from '#wiki-data'; +import {empty, filterProperties, stitchArrays, typeAppearance, unique} + from '#sugar'; import {a} from '#validators'; - -import { - decorateErrorWithIndex, - empty, - filterProperties, - openAggregate, - stitchArrays, - typeAppearance, - unique, - withAggregate, -} from '#sugar'; +import {TupleMap} from '#wiki-data'; const globalCompositeCache = {}; diff --git a/src/data/language.js b/src/data/language.js index 6f774f27..96d39d81 100644 --- a/src/data/language.js +++ b/src/data/language.js @@ -7,10 +7,10 @@ import chokidar from 'chokidar'; import he from 'he'; // It stands for "HTML Entities", apparently. Cursed. import yaml from 'js-yaml'; +import {annotateError, annotateErrorWithFile, showAggregate, withAggregate} + from '#aggregate'; import {externalLinkSpec} from '#external-links'; import {colors, logWarn} from '#cli'; -import {annotateError, annotateErrorWithFile, showAggregate, withAggregate} - from '#sugar'; import T from '#things'; const {Language} = T; diff --git a/src/data/things/index.js b/src/data/things/index.js index 9a36eaae..3bf84091 100644 --- a/src/data/things/index.js +++ b/src/data/things/index.js @@ -1,10 +1,10 @@ import * as path from 'node:path'; import {fileURLToPath} from 'node:url'; +import {openAggregate, showAggregate} from '#aggregate'; import {logError} from '#cli'; import {compositeFrom} from '#composite'; import * as serialize from '#serialize'; -import {openAggregate, showAggregate} from '#sugar'; import Thing from '#thing'; diff --git a/src/data/things/language.js b/src/data/things/language.js index 6bd5a78a..93ed40b6 100644 --- a/src/data/things/language.js +++ b/src/data/things/language.js @@ -1,8 +1,9 @@ import { Temporal, toTemporalInstant } from '@js-temporal/polyfill'; +import {withAggregate} from '#aggregate'; import CacheableObject from '#cacheable-object'; import * as html from '#html'; -import {empty, withAggregate} from '#sugar'; +import {empty} from '#sugar'; import {isLanguageCode} from '#validators'; import Thing from '#thing'; diff --git a/src/data/validators.js b/src/data/validators.js index 7eabe720..4fc2ac65 100644 --- a/src/data/validators.js +++ b/src/data/validators.js @@ -1,18 +1,11 @@ import {inspect as nodeInspect} from 'node:util'; +import {openAggregate, withAggregate} from '#aggregate'; import {colors, ENABLE_COLOR} from '#cli'; +import {cut, empty, matchMultiline, typeAppearance} from '#sugar'; import {commentaryRegexCaseInsensitive, commentaryRegexCaseSensitiveOneShot} from '#wiki-data'; -import { - cut, - empty, - matchMultiline, - openAggregate, - typeAppearance, - withAggregate, -} from '#sugar'; - function inspect(value) { return nodeInspect(value, {colors: ENABLE_COLOR}); } diff --git a/src/data/yaml.js b/src/data/yaml.js index 7a0643e8..100e07b9 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -10,23 +10,20 @@ import yaml from 'js-yaml'; import {colors, ENABLE_COLOR, logInfo, logWarn} from '#cli'; import {reportDuplicateDirectories, filterReferenceErrors} from '#data-checks'; +import {atOffset, empty, filterProperties, typeAppearance, withEntries} + from '#sugar'; import Thing from '#thing'; import thingConstructors from '#things'; import {sortByName} from '#wiki-data'; import { annotateErrorWithFile, - atOffset, decorateErrorWithIndex, decorateErrorWithAnnotation, - empty, - filterProperties, openAggregate, showAggregate, - typeAppearance, withAggregate, - withEntries, -} from '#sugar'; +} from '#aggregate'; function inspect(value, opts = {}) { return nodeInspect(value, {colors: ENABLE_COLOR, ...opts}); -- cgit 1.3.0-6-gf8a5