From ec6e94a7b77b09834ec90b217cf74ed4131b9978 Mon Sep 17 00:00:00 2001 From: Jesper Orb Date: Fri, 5 Apr 2024 16:41:23 +0200 Subject: [PATCH] chore: add aliases --- .vscode/settings.json | 4 +++ src/hooks.server.ts | 2 +- src/hooks.ts | 2 +- src/lib/components/pages/Collator.svelte | 24 +++++++------- .../components/pages/DateTimeFormat.svelte | 30 ++++++++--------- src/lib/components/pages/DisplayNames.svelte | 12 +++---- .../components/pages/DurationFormat.svelte | 22 ++++++------- src/lib/components/pages/ListFormat.svelte | 30 ++++++++--------- src/lib/components/pages/Locale.svelte | 16 +++++----- .../pages/NumberFormat.Currency.svelte | 32 +++++++++---------- .../components/pages/NumberFormat.Unit.svelte | 32 +++++++++---------- src/lib/components/pages/NumberFormat.svelte | 30 ++++++++--------- src/lib/components/pages/PageLayout.svelte | 10 +++--- .../pages/Playground/Playground.svelte | 30 ++++++++--------- .../pages/Playground/PlaygroundInput.svelte | 14 ++++---- .../pages/Playground/PlaygroundOptions.svelte | 20 ++++++------ .../PlaygroundSecondaryFormatters.svelte | 12 +++---- src/lib/components/pages/PluralRules.svelte | 24 +++++++------- .../pages/RelativeTimeFormat.svelte | 28 ++++++++-------- src/lib/components/pages/Segmenter.svelte | 24 +++++++------- .../ui/BrowserSupport/BrowserSupport.svelte | 10 +++--- .../BrowserSupport/BrowserSupportGrid.svelte | 6 ++-- .../BrowserSupport/SpecificationUrls.svelte | 6 ++-- .../ui/BrowserSupport/SupportLabel.svelte | 4 +-- src/lib/components/ui/Chip.svelte | 4 +-- src/lib/components/ui/CodeBlock.svelte | 2 +- .../components/ui/ComboBox/ComboBox.svelte | 4 +-- src/lib/components/ui/DateTime.svelte | 4 +-- src/lib/components/ui/Dialog.svelte | 6 ++-- .../ui/DisplayNamesHighlight.svelte | 10 +++--- src/lib/components/ui/Header.svelte | 4 +-- src/lib/components/ui/Highlight.svelte | 16 +++++----- src/lib/components/ui/HighlightValue.svelte | 2 +- src/lib/components/ui/Input.svelte | 2 +- src/lib/components/ui/LocalePicker.svelte | 16 +++++----- src/lib/components/ui/MDNLink.svelte | 2 +- src/lib/components/ui/Navigation.svelte | 18 +++++------ src/lib/components/ui/OptionCard.svelte | 10 +++--- src/lib/components/ui/OptionSection.svelte | 6 ++-- src/lib/components/ui/Select.svelte | 2 +- src/lib/components/ui/SettingsDialog.svelte | 28 ++++++++-------- src/lib/components/ui/SkipLink.svelte | 2 +- src/lib/components/ui/details/Details.svelte | 2 +- .../components/ui/icons/BrowserType.svelte | 6 ++-- src/lib/components/ui/icons/Icon.svelte | 18 +++++------ .../format-options/duration-format.options.ts | 2 +- .../format-options/number-format.options.ts | 2 +- .../format-options/plural-rules.options.ts | 2 +- src/lib/i18n/MessagesContext.svelte | 2 +- src/lib/i18n/Provider.svelte | 4 +-- src/lib/i18n/util.ts | 2 +- src/lib/playground/format.utils.ts | 2 +- src/lib/store/locales.ts | 2 +- src/lib/utils/browser-support.ts | 2 +- src/lib/utils/copy-to-clipboard.ts | 2 +- src/lib/utils/write-compat-data.ts | 2 +- src/routes/+layout.svelte | 16 +++++----- src/routes/+page.svelte | 6 ++-- src/routes/Collator/+page.server.ts | 4 +-- src/routes/Collator/+page.svelte | 8 ++--- src/routes/DateTimeFormat/+page.server.ts | 4 +-- src/routes/DateTimeFormat/+page.svelte | 8 ++--- src/routes/DisplayNames/+page.server.ts | 4 +-- src/routes/DisplayNames/+page.svelte | 8 ++--- src/routes/DurationFormat/+page.server.ts | 4 +-- src/routes/DurationFormat/+page.svelte | 8 ++--- src/routes/ListFormat/+page.server.ts | 4 +-- src/routes/ListFormat/+page.svelte | 8 ++--- src/routes/Locale/+page.server.ts | 4 +-- src/routes/Locale/+page.svelte | 8 ++--- src/routes/NumberFormat/+page.server.ts | 4 +-- src/routes/NumberFormat/+page.svelte | 10 +++--- .../NumberFormat/Currency/+page.server.ts | 4 +-- src/routes/NumberFormat/Currency/+page.svelte | 8 ++--- src/routes/NumberFormat/Unit/+page.server.ts | 4 +-- src/routes/NumberFormat/Unit/+page.svelte | 8 ++--- src/routes/Playground/+page.server.ts | 4 +-- src/routes/Playground/+page.svelte | 6 ++-- src/routes/PluralRules/+page.server.ts | 4 +-- src/routes/PluralRules/+page.svelte | 8 ++--- src/routes/RelativeTimeFormat/+page.server.ts | 4 +-- src/routes/RelativeTimeFormat/+page.svelte | 8 ++--- src/routes/Segmenter/+page.server.ts | 4 +-- src/routes/Segmenter/+page.svelte | 8 ++--- src/routes/utils/+server.ts | 2 +- svelte.config.js | 2 +- 86 files changed, 399 insertions(+), 395 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c6b3d8c..bc01cca 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,9 @@ }, "editor.codeActionsOnSave": { "source.fixAll": "always" + }, + "javascript.preferences.importModuleSpecifier": "non-relative", + "workbench.editor.customLabels.patterns": { + "**/+*": "${dirname}/${filename}.${extname}" } } diff --git a/src/hooks.server.ts b/src/hooks.server.ts index b0d8956..48d18a9 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -1,2 +1,2 @@ -import { i18n } from "$lib/i18n/i18n"; +import { i18n } from "$i18n/i18n"; export const handle = i18n.handle(); diff --git a/src/hooks.ts b/src/hooks.ts index c163db1..36ec98d 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -1,2 +1,2 @@ -import { i18n } from "$lib/i18n/i18n"; +import { i18n } from "$i18n/i18n"; export const reroute = i18n.reroute(); diff --git a/src/lib/components/pages/Collator.svelte b/src/lib/components/pages/Collator.svelte index 2b63dc4..ef7cf39 100644 --- a/src/lib/components/pages/Collator.svelte +++ b/src/lib/components/pages/Collator.svelte @@ -1,18 +1,18 @@ diff --git a/src/lib/components/pages/Playground/Playground.svelte b/src/lib/components/pages/Playground/Playground.svelte index 5b7b0c2..90f61bd 100644 --- a/src/lib/components/pages/Playground/Playground.svelte +++ b/src/lib/components/pages/Playground/Playground.svelte @@ -2,19 +2,19 @@ import { browser } from "$app/environment"; import type { PlaygroundSchema } from "$lib/playground/playground.schema"; - import type { BrowserSupportDataForMethod } from "$lib/types/BrowserSupport.types"; + import type { BrowserSupportDataForMethod } from "$types/BrowserSupport.types"; import Highlight from "svelte-highlight"; import typescript from "svelte-highlight/languages/typescript"; - import Spacing from "$lib/components/ui/Spacing.svelte"; - import Header from "$lib/components/ui/Header.svelte"; - import CopyToClipboard from "$lib/components/ui/icons/CopyToClipboard.svelte"; - import Button from "$lib/components/ui/Button.svelte"; + import Spacing from "$ui/Spacing.svelte"; + import Header from "$ui/Header.svelte"; + import CopyToClipboard from "$ui/icons/CopyToClipboard.svelte"; + import Button from "$ui/Button.svelte"; - import PlaygroundOptions from "$lib/components/pages/Playground/PlaygroundOptions.svelte"; - import PlaygroundInput from "$lib/components/pages/Playground/PlaygroundInput.svelte"; - import PlaygroundSecondaryFormatters from "$lib/components/pages/Playground/PlaygroundSecondaryFormatters.svelte"; + import PlaygroundOptions from "$pages/Playground/PlaygroundOptions.svelte"; + import PlaygroundInput from "$pages/Playground/PlaygroundInput.svelte"; + import PlaygroundSecondaryFormatters from "$pages/Playground/PlaygroundSecondaryFormatters.svelte"; import { schemaToCode, @@ -25,16 +25,16 @@ } from "$lib/playground/format.utils"; import { createSchemaUrl, getSchemaParam, parseSchemaFromURL } from "$lib/playground/url.utils"; import { validateAndUpdateSchema } from "$lib/playground/validate"; - import { copyCode, copyToClipboard } from "$lib/utils/copy-to-clipboard"; + import { copyCode, copyToClipboard } from "$utils/copy-to-clipboard"; import { schemas, type SchemaKeys } from "$lib/playground/schemas"; import { onDestroy, onMount } from "svelte"; import { numberFormatSchema } from "$lib/playground/schemas/numberFormat.schema"; - import { trackEvent } from "$lib/utils/analytics"; - import BrowserSupport from "$lib/components/ui/BrowserSupport/BrowserSupport.svelte"; - import Grid from "$lib/components/ui/Grid.svelte"; - import { getMessages } from "$lib/i18n/util"; - import { settings } from "$lib/store/settings"; - import { locales } from "$lib/store/locales"; + import { trackEvent } from "$utils/analytics"; + import BrowserSupport from "$ui/BrowserSupport/BrowserSupport.svelte"; + import Grid from "$ui/Grid.svelte"; + import { getMessages } from "$i18n/util"; + import { settings } from "$store/settings"; + import { locales } from "$store/locales"; export let data: { [key: string]: BrowserSupportDataForMethod }; diff --git a/src/lib/components/pages/Playground/PlaygroundInput.svelte b/src/lib/components/pages/Playground/PlaygroundInput.svelte index d029376..c0b6bf7 100644 --- a/src/lib/components/pages/Playground/PlaygroundInput.svelte +++ b/src/lib/components/pages/Playground/PlaygroundInput.svelte @@ -1,15 +1,15 @@ diff --git a/src/lib/components/ui/BrowserSupport/SupportLabel.svelte b/src/lib/components/ui/BrowserSupport/SupportLabel.svelte index 8e253ff..27e730a 100644 --- a/src/lib/components/ui/BrowserSupport/SupportLabel.svelte +++ b/src/lib/components/ui/BrowserSupport/SupportLabel.svelte @@ -1,6 +1,6 @@
diff --git a/src/lib/components/ui/ComboBox/ComboBox.svelte b/src/lib/components/ui/ComboBox/ComboBox.svelte index 4f87110..36e824e 100644 --- a/src/lib/components/ui/ComboBox/ComboBox.svelte +++ b/src/lib/components/ui/ComboBox/ComboBox.svelte @@ -9,8 +9,8 @@ diff --git a/src/lib/components/ui/Navigation.svelte b/src/lib/components/ui/Navigation.svelte index 1c7ca7c..110954f 100644 --- a/src/lib/components/ui/Navigation.svelte +++ b/src/lib/components/ui/Navigation.svelte @@ -1,19 +1,19 @@ diff --git a/src/lib/components/ui/details/Details.svelte b/src/lib/components/ui/details/Details.svelte index 61dade7..5846719 100644 --- a/src/lib/components/ui/details/Details.svelte +++ b/src/lib/components/ui/details/Details.svelte @@ -1,5 +1,5 @@ diff --git a/src/lib/components/ui/icons/Icon.svelte b/src/lib/components/ui/icons/Icon.svelte index 54f36d3..005ce44 100644 --- a/src/lib/components/ui/icons/Icon.svelte +++ b/src/lib/components/ui/icons/Icon.svelte @@ -1,13 +1,13 @@ diff --git a/src/lib/format-options/duration-format.options.ts b/src/lib/format-options/duration-format.options.ts index eb133c9..deae8ce 100644 --- a/src/lib/format-options/duration-format.options.ts +++ b/src/lib/format-options/duration-format.options.ts @@ -1,4 +1,4 @@ -import { defaultNumberRange } from "$lib/utils/format-utils"; +import { defaultNumberRange } from "$utils/format-utils"; import { style, localeMatcher } from "$lib/format-options/common.options"; export const durationFormatOptions = { diff --git a/src/lib/format-options/number-format.options.ts b/src/lib/format-options/number-format.options.ts index 6d11ee9..68e924d 100644 --- a/src/lib/format-options/number-format.options.ts +++ b/src/lib/format-options/number-format.options.ts @@ -1,6 +1,6 @@ import { currencies } from "$lib/locale-data/currencies"; import { units } from "$lib/locale-data/units"; -import { defaultNumberRange } from "$lib/utils/format-utils"; +import { defaultNumberRange } from "$utils/format-utils"; import { localeMatcher, roundingIncrement, diff --git a/src/lib/format-options/plural-rules.options.ts b/src/lib/format-options/plural-rules.options.ts index 4eb5cb7..fc21732 100644 --- a/src/lib/format-options/plural-rules.options.ts +++ b/src/lib/format-options/plural-rules.options.ts @@ -1,4 +1,4 @@ -import { defaultNumberRange } from "$lib/utils/format-utils"; +import { defaultNumberRange } from "$utils/format-utils"; import { localeMatcher, roundingIncrement, diff --git a/src/lib/i18n/MessagesContext.svelte b/src/lib/i18n/MessagesContext.svelte index 4e33333..07b50f2 100644 --- a/src/lib/i18n/MessagesContext.svelte +++ b/src/lib/i18n/MessagesContext.svelte @@ -1,7 +1,7 @@ diff --git a/src/lib/i18n/Provider.svelte b/src/lib/i18n/Provider.svelte index 4f17d27..e24de7a 100644 --- a/src/lib/i18n/Provider.svelte +++ b/src/lib/i18n/Provider.svelte @@ -1,7 +1,7 @@ diff --git a/src/lib/i18n/util.ts b/src/lib/i18n/util.ts index e80f99a..c200cfc 100644 --- a/src/lib/i18n/util.ts +++ b/src/lib/i18n/util.ts @@ -1,5 +1,5 @@ import { getContext } from "svelte"; -import { i18nContextKey } from "$lib/i18n/types"; +import { i18nContextKey } from "$i18n/types"; import * as m from "$paraglide/messages"; export const getMessages = () => getContext(i18nContextKey) as typeof m; diff --git a/src/lib/playground/format.utils.ts b/src/lib/playground/format.utils.ts index 6c46093..d23971d 100644 --- a/src/lib/playground/format.utils.ts +++ b/src/lib/playground/format.utils.ts @@ -6,7 +6,7 @@ import type { PlaygroundOption, PlaygroundSchema } from "$lib/playground/playgro import { formatOptions } from "$lib/format-options"; import { durationValues } from "$lib/format-options/duration-format.options"; import { optionIsActive } from "$lib/playground/validate"; -import { clampValue, fallbackDisplayNames, tryFormat, print, formatLocalesForPrint } from "$lib/utils/format-utils"; +import { clampValue, fallbackDisplayNames, tryFormat, print, formatLocalesForPrint } from "$utils/format-utils"; export const updateOptionOnSchema = ( schema: PlaygroundSchema, diff --git a/src/lib/store/locales.ts b/src/lib/store/locales.ts index cd3990a..b934712 100644 --- a/src/lib/store/locales.ts +++ b/src/lib/store/locales.ts @@ -1,5 +1,5 @@ import { browser } from "$app/environment"; -import { getLocaleFromParams, localeKey } from "$lib/utils/get-locale"; +import { getLocaleFromParams, localeKey } from "$utils/get-locale"; import { writable } from "svelte/store"; export const locales = writable(getLocaleFromParams()); diff --git a/src/lib/utils/browser-support.ts b/src/lib/utils/browser-support.ts index d85f88e..58f8b79 100644 --- a/src/lib/utils/browser-support.ts +++ b/src/lib/utils/browser-support.ts @@ -1,4 +1,4 @@ -import type { BrowserSupportDataForMethod } from "$lib/types/BrowserSupport.types"; +import type { BrowserSupportDataForMethod } from "$types/BrowserSupport.types"; export const getSpecUrls = (data: BrowserSupportDataForMethod | null) => data && Array.isArray(data.specUrl) diff --git a/src/lib/utils/copy-to-clipboard.ts b/src/lib/utils/copy-to-clipboard.ts index c8dbfc2..80262db 100644 --- a/src/lib/utils/copy-to-clipboard.ts +++ b/src/lib/utils/copy-to-clipboard.ts @@ -1,4 +1,4 @@ -import { trackEvent } from "$lib/utils/analytics"; +import { trackEvent } from "$utils/analytics"; export function copyToClipboard(textToCopy: string): Promise { if (navigator.clipboard && window.isSecureContext) { diff --git a/src/lib/utils/write-compat-data.ts b/src/lib/utils/write-compat-data.ts index 5bedb76..ee93983 100644 --- a/src/lib/utils/write-compat-data.ts +++ b/src/lib/utils/write-compat-data.ts @@ -15,7 +15,7 @@ import type { BrowserSupportDataForMethod, BrowserCoverage, BrowserReleaseData -} from "$lib/types/BrowserSupport.types"; +} from "$types/BrowserSupport.types"; const browserTypePosition: Record = { desktop: 0, diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index c65937f..927d331 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -3,15 +3,15 @@ import { dev, browser } from "$app/environment"; import type { FormatMethodsKeys } from "$lib/format-methods"; import { page, navigating } from "$app/stores"; - import Provider from "$lib/i18n/Provider.svelte"; + import Provider from "$i18n/Provider.svelte"; - import Navigation from "$lib/components/ui/Navigation.svelte"; - import Main from "$lib/components/ui/Main.svelte"; - import SkipLink from "$lib/components/ui/SkipLink.svelte"; - import ProgressBar from "$lib/components/ui/ProgressBar.svelte"; - import Header from "$lib/components/ui/Header.svelte"; - import { getLocaleFromParams } from "$lib/utils/get-locale"; - import { locales } from "$lib/store/locales"; + import Navigation from "$ui/Navigation.svelte"; + import Main from "$ui/Main.svelte"; + import SkipLink from "$ui/SkipLink.svelte"; + import ProgressBar from "$ui/ProgressBar.svelte"; + import Header from "$ui/Header.svelte"; + import { getLocaleFromParams } from "$utils/get-locale"; + import { locales } from "$store/locales"; let routeId: FormatMethodsKeys | "Playground" | "/"; $: isHomePage = false; diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 1246baf..60e3dd4 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,8 +1,8 @@ diff --git a/src/routes/Collator/+page.server.ts b/src/routes/Collator/+page.server.ts index 6790c07..1324804 100644 --- a/src/routes/Collator/+page.server.ts +++ b/src/routes/Collator/+page.server.ts @@ -1,5 +1,5 @@ -import type { BrowserSupportDataForMethod } from "$lib/types/BrowserSupport.types"; -import { loadJson } from "$lib/utils/load-json"; +import type { BrowserSupportDataForMethod } from "$types/BrowserSupport.types"; +import { loadJson } from "$utils/load-json"; import type { ServerLoadEvent } from "@sveltejs/kit"; export async function load(loadEvent: ServerLoadEvent): Promise { diff --git a/src/routes/Collator/+page.svelte b/src/routes/Collator/+page.svelte index c1cdf52..dd44705 100644 --- a/src/routes/Collator/+page.svelte +++ b/src/routes/Collator/+page.svelte @@ -1,9 +1,9 @@ diff --git a/src/routes/PluralRules/+page.server.ts b/src/routes/PluralRules/+page.server.ts index 717d0af..a2dcac2 100644 --- a/src/routes/PluralRules/+page.server.ts +++ b/src/routes/PluralRules/+page.server.ts @@ -1,6 +1,6 @@ -import type { BrowserSupportDataForMethod } from "$lib/types/BrowserSupport.types"; +import type { BrowserSupportDataForMethod } from "$types/BrowserSupport.types"; import type { ServerLoadEvent } from "@sveltejs/kit"; -import { loadJson } from "$lib/utils/load-json"; +import { loadJson } from "$utils/load-json"; export async function load(loadEvent: ServerLoadEvent): Promise { return loadJson(loadEvent); diff --git a/src/routes/PluralRules/+page.svelte b/src/routes/PluralRules/+page.svelte index 56517c8..4fdd6fe 100644 --- a/src/routes/PluralRules/+page.svelte +++ b/src/routes/PluralRules/+page.svelte @@ -1,9 +1,9 @@