From 7bf47d879006ffeec51ec112f20c74c72abe87ff Mon Sep 17 00:00:00 2001 From: Christian Kaisermann Date: Thu, 23 Jan 2020 10:11:04 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20add=20runtime=20typings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Closes: Closes #43 --- .gitignore | 6 ++++- src/{client => runtime}/includes/flatObj.ts | 0 .../includes/getClientLocale.ts | 0 src/{client => runtime}/stores/formatters.ts | 0 test/runtime/includes/utils.test.ts | 4 ++-- test/runtime/index.test.ts | 2 +- .../stores/formatters.test.ts | 23 +++++++------------ test/runtime/stores/locale.test.ts | 9 ++++---- 8 files changed, 20 insertions(+), 24 deletions(-) rename src/{client => runtime}/includes/flatObj.ts (100%) rename src/{client => runtime}/includes/getClientLocale.ts (100%) rename src/{client => runtime}/stores/formatters.ts (100%) rename test/{client => runtime}/stores/formatters.test.ts (82%) diff --git a/.gitignore b/.gitignore index 0bdff84..f71570e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,8 @@ node_modules *.log dist/ coverage/ -/types/ \ No newline at end of file +<<<<<<< HEAD +/types/ +======= +types/ +>>>>>>> feat: 🎸 add runtime typings diff --git a/src/client/includes/flatObj.ts b/src/runtime/includes/flatObj.ts similarity index 100% rename from src/client/includes/flatObj.ts rename to src/runtime/includes/flatObj.ts diff --git a/src/client/includes/getClientLocale.ts b/src/runtime/includes/getClientLocale.ts similarity index 100% rename from src/client/includes/getClientLocale.ts rename to src/runtime/includes/getClientLocale.ts diff --git a/src/client/stores/formatters.ts b/src/runtime/stores/formatters.ts similarity index 100% rename from src/client/stores/formatters.ts rename to src/runtime/stores/formatters.ts diff --git a/test/runtime/includes/utils.test.ts b/test/runtime/includes/utils.test.ts index 8adfc1e..8a27a40 100644 --- a/test/runtime/includes/utils.test.ts +++ b/test/runtime/includes/utils.test.ts @@ -1,5 +1,5 @@ -import { getClientLocale } from '../../../src/client/includes/getClientLocale' -import { flatObj } from '../../../src/client/includes/flatObj' +import { getClientLocale } from '../../../src/runtime/includes/getClientLocale' +import { flatObj } from '../../../src/runtime/includes/flatObj' describe('getting client locale', () => { beforeEach(() => { diff --git a/test/runtime/index.test.ts b/test/runtime/index.test.ts index c92fc89..84e7f19 100644 --- a/test/runtime/index.test.ts +++ b/test/runtime/index.test.ts @@ -5,7 +5,7 @@ import { getLocaleDictionary, $dictionary, } from '../../src/runtime/stores/dictionary' -import { $format } from '../../src/runtime/stores/format' +import { $format } from '../../src/runtime/stores/formatters' test('defineMessages returns the identity of its first argument', () => { const obj = {} diff --git a/test/client/stores/formatters.test.ts b/test/runtime/stores/formatters.test.ts similarity index 82% rename from test/client/stores/formatters.test.ts rename to test/runtime/stores/formatters.test.ts index b6de057..4b3da0b 100644 --- a/test/client/stores/formatters.test.ts +++ b/test/runtime/stores/formatters.test.ts @@ -1,10 +1,4 @@ -<<<<<<< HEAD:test/runtime/stores/format.test.ts -import { Formatter } from '../../../src/runtime/types' -import { $format } from '../../../src/runtime/stores/format' -import { init } from '../../../src/runtime/configs' -import { addMessages } from '../../../src/runtime/stores/dictionary' -import { $locale } from '../../../src/runtime/stores/locale' -======= + import { get } from 'svelte/store' import { @@ -12,17 +6,16 @@ import { $formatTime, $formatDate, $formatNumber, -} from '../../../src/client/stores/formatters' -import { init } from '../../../src/client/configs' -import { addMessages } from '../../../src/client/stores/dictionary' -import { $locale } from '../../../src/client/stores/locale' -import { MessageFormatter } from '../../../src/client/types' -import { +} from '../../../src/runtime/stores/formatters' +import { init } from '../../../src/runtime/configs' +import { addMessages } from '../../../src/runtime/stores/dictionary' +import { $locale } from '../../../src/runtime/stores/locale' +import { MessageFormatter , TimeFormatter, DateFormatter, NumberFormatter, -} from '../../../src/client/types/index' ->>>>>>> feat: 🎸 make date,time and number formatters tree-shakeable:test/client/stores/formatters.test.ts +} from '../../../src/runtime/types' + let formatMessage: MessageFormatter let formatTime: TimeFormatter diff --git a/test/runtime/stores/locale.test.ts b/test/runtime/stores/locale.test.ts index 90c40cc..416dcc4 100644 --- a/test/runtime/stores/locale.test.ts +++ b/test/runtime/stores/locale.test.ts @@ -8,11 +8,10 @@ import { getCurrentLocale, $locale, isRelatedLocale, -} from '../../../src/client/stores/locale' -import { getOptions, init } from '../../../src/client/configs' -import { register } from '../../../src/client' -import { hasLocaleQueue } from '../../../src/client/includes/loaderQueue' -import { getClientLocale } from '../../../src/client/includes/getClientLocale' +} from '../../../src/runtime/stores/locale' +import { getOptions, init } from '../../../src/runtime/configs' +import { register } from '../../../src/runtime' +import { hasLocaleQueue } from '../../../src/runtime/includes/loaderQueue' beforeEach(() => { init({ fallbackLocale: undefined })