2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-09 23:00:56 +00:00

Split type and value imports in core

This commit is contained in:
Vjacheslav Trushkin 2020-12-25 21:03:15 +02:00
parent d9303423d1
commit 8903221391
31 changed files with 92 additions and 94 deletions

View File

@ -1,10 +1,10 @@
import {
import type {
IconifyIconLoaderCallback,
IconifyIconLoaderAbort,
} from '../interfaces/loader';
import { getStorage } from '../storage/storage';
import { SortedIcons } from '../icon/sort';
import { IconifyIconSource } from '../icon/name';
import type { SortedIcons } from '../icon/sort';
import type { IconifyIconSource } from '../icon/name';
/**
* Storage for callbacks

View File

@ -1,4 +1,4 @@
import { RedundancyConfig } from '@cyberalien/redundancy';
import type { RedundancyConfig } from '@cyberalien/redundancy';
/**
* API config

View File

@ -1,16 +1,14 @@
import { API, getRedundancyCache, IconifyAPIInternalStorage } from '.';
import { IconifyIconName } from '../icon/name';
import {
import type { IconifyAPIInternalStorage } from '.';
import { API, getRedundancyCache } from '.';
import type { IconifyIconName } from '../icon/name';
import type {
IconifyIconLoaderAbort,
IconifyIconLoaderCallback,
} from '../interfaces/loader';
import {
getAPIConfig,
GetAPIConfig,
IconifyAPIConfig,
setAPIConfig,
} from './config';
import { IconifyAPIModule, setAPIModule } from './modules';
import type { GetAPIConfig, IconifyAPIConfig } from './config';
import { getAPIConfig, setAPIConfig } from './config';
import type { IconifyAPIModule } from './modules';
import { setAPIModule } from './modules';
/**
* Iconify API functions

View File

@ -1,23 +1,22 @@
import {
Redundancy,
initRedundancy,
QueryModuleCallback,
} from '@cyberalien/redundancy';
import { SortedIcons, sortIcons } from '../icon/sort';
import {
import type { Redundancy, QueryModuleCallback } from '@cyberalien/redundancy';
import type { IconifyJSON } from '@iconify/types';
import { initRedundancy } from '@cyberalien/redundancy';
import type { SortedIcons } from '../icon/sort';
import { sortIcons } from '../icon/sort';
import type {
IconifyIconLoaderAbort,
IconifyIconLoaderCallback,
IconifyLoadIcons,
} from '../interfaces/loader';
import { IsPending, IconifyAPI } from '../interfaces/api';
import type { IsPending, IconifyAPI } from '../interfaces/api';
import { storeCallback, updateCallbacks } from './callbacks';
import { getAPIModule } from './modules';
import { getAPIConfig, IconifyAPIConfig } from './config';
import type { IconifyAPIConfig } from './config';
import { getAPIConfig } from './config';
import { getStorage, addIconSet } from '../storage/storage';
import { coreModules } from '../modules';
import { IconifyIconName, IconifyIconSource } from '../icon/name';
import type { IconifyIconName, IconifyIconSource } from '../icon/name';
import { listToIcons } from '../icon/list';
import { IconifyJSON } from '@iconify/types';
// Empty abort callback for loadIcons()
function emptyCallback(): void {

View File

@ -1,5 +1,5 @@
import { PendingQueryItem } from '@cyberalien/redundancy';
import { GetAPIConfig } from '../api/config';
import type { PendingQueryItem } from '@cyberalien/redundancy';
import type { GetAPIConfig } from '../api/config';
/**
* Params for sendQuery()

View File

@ -1,12 +1,12 @@
import { PendingQueryItem } from '@cyberalien/redundancy';
import {
import type { PendingQueryItem } from '@cyberalien/redundancy';
import type {
APIQueryParams,
IconifyAPIPrepareQuery,
IconifyAPISendQuery,
IconifyAPIModule,
GetIconifyAPIModule,
} from '../modules';
import { GetAPIConfig } from '../config';
import type { GetAPIConfig } from '../config';
/**
* Endpoint

View File

@ -1,12 +1,12 @@
import { PendingQueryItem } from '@cyberalien/redundancy';
import {
import type { PendingQueryItem } from '@cyberalien/redundancy';
import type {
APIQueryParams,
IconifyAPIPrepareQuery,
IconifyAPISendQuery,
IconifyAPIModule,
GetIconifyAPIModule,
} from '../modules';
import { GetAPIConfig } from '../config';
import type { GetAPIConfig } from '../config';
/**
* Global

View File

@ -1,5 +1,5 @@
import { IconifyJSON } from '@iconify/types';
import { CacheIcons, LoadIconsCache } from '../interfaces/cache';
import type { IconifyJSON } from '@iconify/types';
import type { CacheIcons, LoadIconsCache } from '../interfaces/cache';
import { getStorage, addIconSet } from '../storage/storage';
interface StorageType<T> {

View File

@ -1,5 +1,5 @@
import { FullIconifyIcon } from '../icon';
import { FullIconCustomisations } from '../customisations';
import type { FullIconifyIcon } from '../icon';
import type { FullIconCustomisations } from '../customisations';
import { calculateSize } from './calc-size';
/**

View File

@ -1,4 +1,5 @@
import { FullIconCustomisations, defaults } from '../customisations';
import type { FullIconCustomisations } from '../customisations';
import { defaults } from '../customisations';
// Get all keys
const allKeys: (keyof FullIconCustomisations)[] = Object.keys(
@ -6,7 +7,9 @@ const allKeys: (keyof FullIconCustomisations)[] = Object.keys(
) as (keyof FullIconCustomisations)[];
// All keys without width/height
const filteredKeys = allKeys.filter(key => key !== 'width' && key !== 'height');
const filteredKeys = allKeys.filter(
(key) => key !== 'width' && key !== 'height'
);
/**
* Compare sets of cusotmisations, return false if they are different, true if the same

View File

@ -1,4 +1,4 @@
import { IconifyIconCustomisations } from '../customisations';
import type { IconifyIconCustomisations } from '../customisations';
const separator = /[\s,]+/;

View File

@ -1,4 +1,4 @@
import {
import type {
IconifyJSON,
IconifyIcon,
IconifyOptional,
@ -6,7 +6,8 @@ import {
IconifyIcons,
IconifyAliases,
} from '@iconify/types';
import { iconDefaults, FullIconifyIcon } from '.';
import type { FullIconifyIcon } from '.';
import { iconDefaults } from '.';
import { merge } from '../misc/merge';
import { mergeIcons } from './merge';

View File

@ -1,4 +1,4 @@
import { IconifyIcon } from '@iconify/types';
import type { IconifyIcon } from '@iconify/types';
import { merge } from '../misc/merge';
export { IconifyIcon };

View File

@ -1,4 +1,5 @@
import { IconifyIconName, stringToIcon, validateIcon } from './name';
import type { IconifyIconName } from './name';
import { stringToIcon, validateIcon } from './name';
/**
* Convert icons list from string/icon mix to icons and validate them

View File

@ -1,4 +1,5 @@
import { IconifyIcon, iconDefaults } from './';
import type { IconifyIcon } from '.';
import { iconDefaults } from '.';
/**
* Icon keys
@ -15,7 +16,7 @@ export function mergeIcons(
icon2: IconifyIcon
): IconifyIcon {
const icon = Object.create(null);
iconKeys.forEach(key => {
iconKeys.forEach((key) => {
if (icon1[key] === void 0) {
if (icon2[key] !== void 0) {
icon[key] = icon2[key];

View File

@ -1,5 +1,6 @@
import { getStorage, IconStorage } from '../storage/storage';
import { IconifyIconName } from './name';
import type { IconStorage } from '../storage/storage';
import { getStorage } from '../storage/storage';
import type { IconifyIconName } from './name';
/**
* Sorted icons list

View File

@ -1,5 +1,5 @@
import { IconifyLoadIcons } from './loader';
import { IconifyIconName } from '../icon/name';
import type { IconifyLoadIcons } from './loader';
import type { IconifyIconName } from '../icon/name';
/**
* Function to check if icon is pending

View File

@ -1,4 +1,4 @@
import { IconifyJSON } from '@iconify/types';
import type { IconifyJSON } from '@iconify/types';
/**
* Function to cache loaded icons set

View File

@ -1,4 +1,4 @@
import { IconifyIconName } from '../icon/name';
import type { IconifyIconName } from '../icon/name';
/**
* Function to abort loading (usually just removes callback because loading is already in progress)

View File

@ -1,5 +1,5 @@
import { CacheIcons } from './interfaces/cache';
import { IconifyAPI } from './interfaces/api';
import type { CacheIcons } from './interfaces/cache';
import type { IconifyAPI } from './interfaces/api';
/**
* Dynamic modules.

View File

@ -1,6 +1,7 @@
import { IconifyJSON } from '@iconify/types';
import { FullIconifyIcon, IconifyIcon } from '../icon';
import { IconifyIconName, stringToIcon, validateIcon } from '../icon/name';
import type { IconifyJSON } from '@iconify/types';
import type { FullIconifyIcon, IconifyIcon } from '../icon';
import type { IconifyIconName } from '../icon/name';
import { stringToIcon, validateIcon } from '../icon/name';
import { merge } from '../misc/merge';
import { getStorage, getIcon, listIcons, addIcon, addIconSet } from './storage';

View File

@ -1,6 +1,8 @@
import { IconifyJSON, IconifyIcon } from '@iconify/types';
import { FullIconifyIcon, fullIcon } from '../icon';
import { AddIconSetTracking, parseIconSet } from '../icon/icon-set';
import type { IconifyJSON, IconifyIcon } from '@iconify/types';
import type { FullIconifyIcon } from '../icon';
import { fullIcon } from '../icon';
import type { AddIconSetTracking } from '../icon/icon-set';
import { parseIconSet } from '../icon/icon-set';
/**
* List of icons

View File

@ -1,10 +1,7 @@
import 'mocha';
import { expect } from 'chai';
import {
stringToIcon,
validateIcon,
IconifyIconName,
} from '../../lib/icon/name';
import type { IconifyIconName } from '../../lib/icon/name';
import { stringToIcon, validateIcon } from '../../lib/icon/name';
describe('Testing icon name', () => {
it('Simple icon names', () => {

View File

@ -1,8 +1,8 @@
import 'mocha';
import { expect } from 'chai';
import type { IconifyJSON } from '@iconify/types';
import { parseIconSet } from '../../lib/icon/icon-set';
import { FullIconifyIcon } from '../../lib/icon';
import { IconifyJSON } from '@iconify/types';
import type { FullIconifyIcon } from '../../lib/icon';
describe('Testing parsing icon set', () => {
it('Simple icon set', () => {

View File

@ -10,7 +10,7 @@ import {
getStorage,
listIcons,
} from '../../lib/storage/storage';
import { FullIconifyIcon, IconifyIcon } from '../../lib/icon';
import type { FullIconifyIcon, IconifyIcon } from '../../lib/icon';
describe('Testing storage', () => {
it('Adding icon', () => {

View File

@ -1,12 +1,11 @@
import 'mocha';
import { expect } from 'chai';
import { iconToSVG, IconifyIconBuildResult } from '../../lib/builder';
import { FullIconifyIcon, iconDefaults, fullIcon } from '../../lib/icon';
import {
FullIconCustomisations,
defaults,
fullCustomisations,
} from '../../lib/customisations';
import type { IconifyIconBuildResult } from '../../lib/builder';
import { iconToSVG } from '../../lib/builder';
import type { FullIconifyIcon } from '../../lib/icon';
import { iconDefaults, fullIcon } from '../../lib/icon';
import type { FullIconCustomisations } from '../../lib/customisations';
import { defaults, fullCustomisations } from '../../lib/customisations';
describe('Testing iconToSVG', () => {
it('Empty icon', () => {

View File

@ -2,18 +2,11 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import 'mocha';
import { expect } from 'chai';
import { PendingQueryItem } from '@cyberalien/redundancy';
import {
setAPIConfig,
getAPIConfig,
IconifyAPIConfig,
} from '../../lib/api/config';
import {
setAPIModule,
APIQueryParams,
getAPIModule,
IconifyAPIModule,
} from '../../lib/api/modules';
import type { PendingQueryItem } from '@cyberalien/redundancy';
import type { IconifyAPIConfig } from '../../lib/api/config';
import { setAPIConfig, getAPIConfig } from '../../lib/api/config';
import type { APIQueryParams, IconifyAPIModule } from '../../lib/api/modules';
import { setAPIModule, getAPIModule } from '../../lib/api/modules';
describe('Testing API modules', () => {
let prefixCounter = 0;

View File

@ -2,9 +2,10 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import 'mocha';
import { expect } from 'chai';
import { PendingQueryItem } from '@cyberalien/redundancy';
import type { PendingQueryItem } from '@cyberalien/redundancy';
import { setAPIConfig } from '../../lib/api/config';
import { setAPIModule, APIQueryParams } from '../../lib/api/modules';
import type { APIQueryParams } from '../../lib/api/modules';
import { setAPIModule } from '../../lib/api/modules';
import { API } from '../../lib/api/';
describe('Testing API loadIcons', () => {

View File

@ -1,11 +1,12 @@
import 'mocha';
import { expect } from 'chai';
import type { IconifyJSON } from '@iconify/types';
import type { StoredItem } from '../../lib/browser-storage/';
import {
loadCache,
count,
config,
emptyList,
StoredItem,
} from '../../lib/browser-storage/';
import { getStorage, iconExists } from '../../lib/storage/storage';
import {
@ -19,7 +20,6 @@ import {
hour,
cacheExpiration,
} from './fake_cache';
import { IconifyJSON } from '@iconify/types';
describe('Testing loading from localStorage', () => {
const provider = '';

View File

@ -1,12 +1,13 @@
import 'mocha';
import { expect } from 'chai';
import type { IconifyJSON } from '@iconify/types';
import type { StoredItem } from '../../lib/browser-storage/';
import {
loadCache,
storeCache,
count,
config,
emptyList,
StoredItem,
} from '../../lib/browser-storage/';
import { getStorage, iconExists } from '../../lib/storage/storage';
import {
@ -20,7 +21,6 @@ import {
hour,
cacheExpiration,
} from './fake_cache';
import { IconifyJSON } from '@iconify/types';
describe('Testing saving to localStorage', () => {
const provider = '';

View File

@ -9,6 +9,7 @@
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error"
}
}