Skip to content

Commit

Permalink
deps(typescript): Update to v5.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Jun 3, 2024
1 parent 601da67 commit 8756294
Show file tree
Hide file tree
Showing 92 changed files with 153 additions and 118 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"prettier": "^3.0.3",
"prettier-config-moon": "^1.1.2",
"tsconfig-moon": "^1.3.0",
"typescript": "^5.2.2"
"typescript": "^5.4.5"
},
"workspaces": [
"packages/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/appendSkinToneIndex.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SkinTone } from './types';
import type { SkinTone } from './types';

/**
* Append a skin tone index (number) to the end of a shortcode.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
Gender,
GroupKey,
Locale,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/fetchEmojis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { fetchFromCDN } from './fetchFromCDN';
import { fetchShortcodes } from './fetchShortcodes';
import { flattenEmojiData } from './flattenEmojiData';
import { joinShortcodes } from './joinShortcodes';
import {
import type {
CompactEmoji,
Emoji,
FetchEmojisExpandedOptions,
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/fetchFromCDN.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { CDNUrlFn, FetchFromCDNOptions } from './types';
import type { CDNUrlFn, FetchFromCDNOptions } from './types';

function getFetchUrl(path: string, version: string, cdnUrl?: CDNUrlFn | string): string {
let fetchUrl = `https://cdn.jsdelivr.net/npm/emojibase-data@${version}/${path}`;

if (typeof cdnUrl === 'function') {
fetchUrl = cdnUrl(path, version);
} else if (typeof cdnUrl === 'string') {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/fetchMessages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fetchFromCDN } from './fetchFromCDN';
import { FetchFromCDNOptions, Locale, MessagesDataset } from './types';
import type { FetchFromCDNOptions, Locale, MessagesDataset } from './types';

/**
* Fetches and returns localized messages for emoji related information like groups and sub-groups.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/fetchShortcodes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fetchFromCDN } from './fetchFromCDN';
import { FetchFromCDNOptions, Locale, ShortcodePreset, ShortcodesDataset } from './types';
import type { FetchFromCDNOptions, Locale, ShortcodePreset, ShortcodesDataset } from './types';

const ALIASES: Partial<Record<ShortcodePreset, string>> = {
discord: 'joypixels',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/flattenEmojiData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { joinShortcodesToEmoji } from './joinShortcodesToEmoji';
import { CompactEmoji, Emoji, EmojiLike, ShortcodesDataset } from './types';
import type { CompactEmoji, Emoji, EmojiLike, ShortcodesDataset } from './types';

/**
* By default, emoji skin modifications are nested under the base neutral skin tone emoji.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/fromCodepointToUnicode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodePoint, Unicode } from './types';
import type { CodePoint, Unicode } from './types';

/**
* This function will convert an array of numerical codepoints to a literal emoji Unicode character.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/fromHexcodeToCodepoint.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodePoint, Hexcode } from './types';
import type { CodePoint, Hexcode } from './types';

/**
* This function will convert a hexadecimal codepoint to an array of numerical codepoints.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/fromUnicodeToHexcode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SEQUENCE_REMOVAL_PATTERN } from './constants';
import { Hexcode, Unicode } from './types';
import type { Hexcode, Unicode } from './types';

/**
* This function will convert a literal emoji Unicode character into a dash separated
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/generateEmoticonPermutations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Emoticon, PermutationOptions } from './types';
import type { Emoticon, PermutationOptions } from './types';

/**
* This function will generate multiple permutations of a base emoticon character.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ export * from './generateEmoticonPermutations';
export * from './joinShortcodes';
export * from './joinShortcodesToEmoji';
export * from './stripHexcode';
export * from './types';
export type * from './types';
2 changes: 1 addition & 1 deletion packages/core/src/joinShortcodes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { joinShortcodesToEmoji } from './joinShortcodesToEmoji';
import { CompactEmoji, Emoji, EmojiLike, ShortcodesDataset } from './types';
import type { CompactEmoji, Emoji, EmojiLike, ShortcodesDataset } from './types';

/**
* Like `joinShortcodesToEmoji` but joins shortcodes to a list of emoji objects.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/joinShortcodesToEmoji.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CompactEmoji, Emoji, EmojiLike, ShortcodesDataset } from './types';
import type { CompactEmoji, Emoji, EmojiLike, ShortcodesDataset } from './types';

/**
* Will join shortcodes from multiple shortcode datasets into a single emoji object
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/stripHexcode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SEQUENCE_REMOVAL_PATTERN } from './constants';
import { Hexcode } from './types';
import type { Hexcode } from './types';

const STRIP_PATTERN = new RegExp(`(-| )?(${SEQUENCE_REMOVAL_PATTERN.source})`, 'g');

Expand Down
2 changes: 1 addition & 1 deletion packages/core/tests/flattenEmojiData.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { flattenEmojiData } from '../src/flattenEmojiData';
import { Emoji } from '../src/types';
import type { Emoji } from '../src/types';

describe('flattenEmojiData()', () => {
const data: Emoji[] = [
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tests/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CompactEmoji, Emoji } from '../src/types';
import type { CompactEmoji, Emoji } from '../src/types';

declare global {
namespace NodeJS {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tests/joinShortcodes.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { joinShortcodes } from '../src/joinShortcodes';
import { Emoji } from '../src/types';
import type { Emoji } from '../src/types';

function createList(): Emoji[] {
return [
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tests/joinShortcodesToEmoji.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { joinShortcodesToEmoji } from '../src/joinShortcodesToEmoji';
import { Emoji } from '../src/types';
import type { Emoji } from '../src/types';
import { getEmojiWithSkins } from './helpers';

describe('joinShortcodesToEmoji()', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/data/tests/data.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'node:path';
import { EMOJI, Emoji, FEMALE, flattenEmojiData, MALE, TEXT } from 'emojibase';
import { EMOJI, type Emoji, FEMALE, flattenEmojiData, MALE, TEXT } from 'emojibase';

const localeCache: Record<string, Emoji[]> = {};

Expand Down
2 changes: 1 addition & 1 deletion packages/data/tests/shortcodes.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'node:path';
import { ShortcodePreset, ShortcodesDataset } from 'emojibase';
import type { ShortcodePreset, ShortcodesDataset } from 'emojibase';
import SHORTCODE_PATTERN from 'emojibase-regex/shortcode';
import SHORTCODE_NATIVE_PATTERN from 'emojibase-regex/shortcode-native';

Expand Down
2 changes: 1 addition & 1 deletion packages/generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dependencies": {
"@types/cheerio": "^0.22.35",
"@types/fs-extra": "^11.0.4",
"@types/node": "^16.18.97",
"@types/node": "^20.14.0",
"@types/node-fetch": "^2.6.11",
"chalk": "^5.3.0",
"cheerio": "^1.0.0-rc.12",
Expand Down
4 changes: 2 additions & 2 deletions packages/generator/src/builders/buildAnnotationData.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable complexity */

import util from 'node:util';
import { Locale, stripHexcode } from 'emojibase';
import { type Locale, stripHexcode } from 'emojibase';
import {
FACING_LEFT_PATTERN,
FACING_RIGHT_PATTERN,
Expand All @@ -20,7 +20,7 @@ import { loadLocalization } from '../loaders/loadLocalization';
import { loadPoMessages } from '../loaders/loadPoMessages';
import { loadSequences } from '../loaders/loadSequences';
import { loadZwjSequences } from '../loaders/loadZwjSequences';
import { CLDRAnnotation, CLDRAnnotationMap } from '../types';
import type { CLDRAnnotation, CLDRAnnotationMap } from '../types';

// function doesSequenceMatch(a: string[], b: string[]): boolean {
// // eslint-disable-next-line unicorn/no-for-loop
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/builders/buildEmojiData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { loadNames } from '../loaders/loadNames';
import { loadSequences } from '../loaders/loadSequences';
import { loadVariations } from '../loaders/loadVariations';
import { loadZwjSequences } from '../loaders/loadZwjSequences';
import { EmojiMap } from '../types';
import type { EmojiMap } from '../types';
import { joinData } from './joinData';
import { joinMetadataToData } from './joinMetadataToData';
import { joinModifiersToData } from './joinModifiersToData';
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/builders/buildVersionedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { writeCache } from '../helpers/writeCache';
import { loadData } from '../loaders/loadData';
import { loadSequences } from '../loaders/loadSequences';
import { loadZwjSequences } from '../loaders/loadZwjSequences';
import { EmojiDataMap } from '../types';
import type { EmojiDataMap } from '../types';

export type VersionDataMap = Record<string, EmojiDataMap>;

Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/builders/joinData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EmojiDataMap } from '../types';
import type { EmojiDataMap } from '../types';

export function joinData(emojis: EmojiDataMap, data: EmojiDataMap) {
Object.keys(data).forEach((hexcode) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/builders/joinMetadataToData.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EMOJI, FULLY_QUALIFIED, TEXT } from 'emojibase';
import { SEQUENCE_REMOVAL_PATTERN, SKIN_MODIFIER_PATTERN } from '../constants';
import { hasProperty } from '../helpers/hasProperty';
import {
import type {
EmojiMap,
EmojiMetadataMap,
EmojiVariationMap,
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/builders/joinModifiersToData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { hasProperty } from '../helpers/hasProperty';
import { log } from '../helpers/log';
import { extractSkinTone } from '../parsers/extractSkinTone';
import { Emoji, EmojiMap, EmojiModification, SkinTone } from '../types';
import type { Emoji, EmojiMap, EmojiModification, SkinTone } from '../types';

const SKIN_HEXCODE_PATTERN = new RegExp(`-(${SKIN_MODIFIER_PATTERN.source})`, 'g');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EMOJI_VARIATION_SELECTOR, TEXT_VARIATION_SELECTOR } from '../constants';
import { EmojiMap } from '../types';
import type { EmojiMap } from '../types';

export function mergeDuplicateVariations(emojis: EmojiMap) {
Object.keys(emojis).forEach((hexcode) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { flattenData } from '../helpers/flattenData';
import { log } from '../helpers/log';
import { loadEmojiList } from '../loaders/loadEmojiList';
import { loadEmojiStyles } from '../loaders/loadEmojiStyles';
import { Emoji, EmojiMap, EmojiSource } from '../types';
import type { Emoji, EmojiMap, EmojiSource } from '../types';

// This commonly logs errors as the official emoji list is not historical and
// represents latest and future state.
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/builders/verifyDataIntegrity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { isHidden } from '../helpers/isHidden';
import { isObject } from '../helpers/isObject';
import { log } from '../helpers/log';
import { toArray } from '../helpers/toArray';
import { EmojiMap, EmojiVariation } from '../types';
import type { EmojiMap, EmojiVariation } from '../types';

export function verifyDataIntegrity(emojis: EmojiMap): EmojiMap {
const usedEmoticons: EmojiMap = {};
Expand Down
4 changes: 2 additions & 2 deletions packages/generator/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable sort-keys, unicorn/better-regex */

import { Locale } from 'emojibase';
import { Property } from './types';
import type { Locale } from 'emojibase';
import type { Property } from './types';

export const INHERIT_PARENT_SYMBOL = '↑↑↑';

Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/generators/Database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { stripHexcode } from 'emojibase';
import { transliterate } from 'transliteration';
import { log } from '../helpers/log';
import { toArray } from '../helpers/toArray';
import { Emoji, EmojiMap, Hexcode, HexcodeMap, ShortcodeDataMap } from '../types';
import type { Emoji, EmojiMap, Hexcode, HexcodeMap, ShortcodeDataMap } from '../types';
import { toUnicode } from './toUnicode';

export class Database {
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/generators/extractCompact.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CompactEmoji, Emoji } from 'emojibase';
import type { CompactEmoji, Emoji } from 'emojibase';

export function extractCompact(data: Emoji[]): CompactEmoji[] {
return data.map((full) => {
Expand Down
12 changes: 6 additions & 6 deletions packages/generator/src/generators/generateData.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint-disable complexity */

import {
Emoji as FinalEmoji,
GroupMessage,
Locale,
SkinToneMessage,
type Emoji as FinalEmoji,
type GroupMessage,
type Locale,
type SkinToneMessage,
stripHexcode,
SubgroupMessage,
type SubgroupMessage,
SUPPORTED_LOCALES,
} from 'emojibase';
import { buildAnnotationData } from '../builders/buildAnnotationData';
Expand All @@ -16,7 +16,7 @@ import { log } from '../helpers/log';
import { readCache } from '../helpers/readCache';
import { writeDataset } from '../helpers/writeDataset';
import { loadPoMessages } from '../loaders/loadPoMessages';
import {
import type {
CLDRAnnotationMap,
Emoji,
EmojiModification,
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/generators/generatePoFiles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Emoji, Hexcode, ShortcodesDataset, SUPPORTED_LOCALES } from 'emojibase';
import { type Emoji, type Hexcode, type ShortcodesDataset, SUPPORTED_LOCALES } from 'emojibase';
import { log } from '../helpers/log';
import { toArray } from '../helpers/toArray';
import { loadDataset } from '../loaders/loadDatasetPackage';
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/generators/generateRegex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { flattenData } from '../helpers/flattenData';
import { log } from '../helpers/log';
import { toArray } from '../helpers/toArray';
import { writeRegex } from '../helpers/writeRegex';
import { EmojiMap, Hexcode } from '../types';
import type { EmojiMap, Hexcode } from '../types';
import { toUnicode } from './toUnicode';

type TrieMap = Record<string, Trie>;
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/generators/generateVersions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { buildVersionedData } from '../builders/buildVersionedData';
import { log } from '../helpers/log';
import { writeDataset } from '../helpers/writeDataset';
import { VersionMap } from '../types';
import type { VersionMap } from '../types';

export async function generateVersions(): Promise<void> {
log.title('data', 'Generating versioned datasets');
Expand Down
4 changes: 2 additions & 2 deletions packages/generator/src/generators/shortcodes/generateCldr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */

import { appendSkinToneIndex, Locale, stripHexcode, SUPPORTED_LOCALES } from 'emojibase';
import { appendSkinToneIndex, type Locale, stripHexcode, SUPPORTED_LOCALES } from 'emojibase';
import KuroshiroImport from 'kuroshiro';
import KuromojiAnalyzer from 'kuroshiro-analyzer-kuromoji';
import { transliterate } from 'transliteration';
import { buildAnnotationData } from '../../builders/buildAnnotationData';
import { writeDataset } from '../../helpers/writeDataset';
import { loadPoMessages } from '../../loaders/loadPoMessages';
import { POManager } from '../../parsers/POManager';
import { ShortcodeDataMap } from '../../types';
import type { ShortcodeDataMap } from '../../types';
import { Database } from '../Database';

const CUSTOM_SHORTCODES: Record<string, string> = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import path from 'node:path';
import { appendSkinToneIndex, Emoji, Hexcode, SUPPORTED_LOCALES, TEXT } from 'emojibase';
import { appendSkinToneIndex, type Emoji, type Hexcode, SUPPORTED_LOCALES, TEXT } from 'emojibase';
import { SHORTCODE_GUIDELINES } from '../../constants';
import { writeDataset } from '../../helpers/writeDataset';
import { writeFile } from '../../helpers/writeFile';
import { loadDataset } from '../../loaders/loadDatasetPackage';
import { loadPoMessages } from '../../loaders/loadPoMessages';
import { loadPoShortcodes } from '../../loaders/loadPoShortcodes';
import { ShortcodeDataMap } from '../../types';
import type { ShortcodeDataMap } from '../../types';
import { Database } from '../Database';

export async function generateEmojibase(db: Database) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { appendSkinToneIndex } from 'emojibase';
import { writeDataset } from '../../helpers/writeDataset';
import { shortcodes as shortcodesResource } from '../../resources/shortcodesLegacy';
import { ShortcodeDataMap } from '../../types';
import type { ShortcodeDataMap } from '../../types';
import { Database } from '../Database';

export async function generateEmojibaseLegacy(db: Database) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { writeDataset } from '../../helpers/writeDataset';
import { fetchAndCache } from '../../loaders/fetchAndCache';
import { ShortcodeDataMap } from '../../types';
import type { ShortcodeDataMap } from '../../types';
import { Database } from '../Database';

export async function generateGitHub(db: Database) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { writeDataset } from '../../helpers/writeDataset';
import { fetchAndCache } from '../../loaders/fetchAndCache';
import { ShortcodeDataMap } from '../../types';
import type { ShortcodeDataMap } from '../../types';
import { Database } from '../Database';

export async function generateIamCal(db: Database) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { writeDataset } from '../../helpers/writeDataset';
import { fetchAndCache } from '../../loaders/fetchAndCache';
import { HexcodeMap, ShortcodeDataMap } from '../../types';
import type { HexcodeMap, ShortcodeDataMap } from '../../types';
import { Database } from '../Database';

// These should not be in the dataset according to the spec
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/generators/toUnicode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fromCodepointToUnicode, fromHexcodeToCodepoint } from 'emojibase';
import { Hexcode, Unicode } from '../types';
import type { Hexcode, Unicode } from '../types';

export function toUnicode(hexcode: Hexcode): Unicode {
return fromCodepointToUnicode(fromHexcodeToCodepoint(hexcode));
Expand Down
Loading

0 comments on commit 8756294

Please sign in to comment.