diff --git a/core/busy.ts b/core/busy.ts index 03746fa1..0ee3b863 100644 --- a/core/busy.ts +++ b/core/busy.ts @@ -1,7 +1,7 @@ import { atom, computed } from 'nanostores' -import { onEnvironment } from './environment.js' -import { hasFeeds } from './feed.js' +import { onEnvironment } from './environment.ts' +import { hasFeeds } from './feed.ts' const $tasks = atom(0) diff --git a/core/category.ts b/core/category.ts index 20831d5c..b40fb7a4 100644 --- a/core/category.ts +++ b/core/category.ts @@ -9,9 +9,9 @@ import { } from '@logux/client' import { nanoid } from 'nanoid' -import { getClient } from './client.js' -import type { FeedValue } from './feed.js' -import { commonMessages as common } from './messages/index.js' +import { getClient } from './client.ts' +import type { FeedValue } from './feed.ts' +import { commonMessages as common } from './messages/index.ts' export type CategoryValue = { id: string diff --git a/core/client.ts b/core/client.ts index 1ab50e02..ead3e09b 100644 --- a/core/client.ts +++ b/core/client.ts @@ -4,10 +4,10 @@ import { TestPair, TestTime } from '@logux/core' import { SUBPROTOCOL } from '@slowreader/api' import { atom } from 'nanostores' -import { onEnvironment } from './environment.js' -import { SlowReaderError } from './error.js' -import { computeFrom, readonlyExport } from './lib/stores.js' -import { userId } from './settings.js' +import { onEnvironment } from './environment.ts' +import { SlowReaderError } from './error.ts' +import { computeFrom, readonlyExport } from './lib/stores.ts' +import { userId } from './settings.ts' let testTime: TestTime | undefined diff --git a/core/devtools.ts b/core/devtools.ts index 6f82e6cd..7200f2f7 100644 --- a/core/devtools.ts +++ b/core/devtools.ts @@ -1,8 +1,8 @@ -import { busyDuring } from './busy.js' -import { createDownloadTask } from './download.js' -import { getFeedLatestPosts, loadFeeds } from './feed.js' -import { loadFilters, prepareFilters } from './filter.js' -import { addPost, deletePost, loadPosts, processOriginPost } from './post.js' +import { busyDuring } from './busy.ts' +import { createDownloadTask } from './download.ts' +import { getFeedLatestPosts, loadFeeds } from './feed.ts' +import { loadFilters, prepareFilters } from './filter.ts' +import { addPost, deletePost, loadPosts, processOriginPost } from './post.ts' export async function fillFeedsWithPosts(): Promise { await busyDuring(async () => { diff --git a/core/download.ts b/core/download.ts index 0dc2246c..39e0b02a 100644 --- a/core/download.ts +++ b/core/download.ts @@ -1,5 +1,5 @@ -import { warning } from './devtools.js' -import { request } from './request.js' +import { warning } from './devtools.ts' +import { request } from './request.ts' export interface TextResponse { readonly contentType: string diff --git a/core/environment.ts b/core/environment.ts index 0a07923d..9d4c7a09 100644 --- a/core/environment.ts +++ b/core/environment.ts @@ -8,8 +8,8 @@ import { } from '@nanostores/persistent' import { atom, type ReadableAtom, type StoreValue } from 'nanostores' -import { SlowReaderError } from './error.js' -import type { BaseRoute, BaseRouter, Route, Routes } from './router.js' +import { SlowReaderError } from './error.ts' +import type { BaseRoute, BaseRouter, Route, Routes } from './router.ts' interface LogStoreCreator { (): ClientOptions['store'] diff --git a/core/export.ts b/core/export.ts index 8a01525b..2d96c5f2 100644 --- a/core/export.ts +++ b/core/export.ts @@ -6,10 +6,10 @@ import { feedsByCategory, getCategories, getCategoryTitle -} from './category.js' -import { type FeedValue, getFeeds } from './feed.js' -import { readonlyExport } from './lib/stores.js' -import { getPosts, type PostValue } from './post.js' +} from './category.ts' +import { type FeedValue, getFeeds } from './feed.ts' +import { readonlyExport } from './lib/stores.ts' +import { getPosts, type PostValue } from './post.ts' type FeedWithPosts = { posts?: PostValue[] diff --git a/core/fast.ts b/core/fast.ts index 3c9e12c2..320e91dc 100644 --- a/core/fast.ts +++ b/core/fast.ts @@ -6,15 +6,15 @@ import { type CategoryValue, GENERAL_CATEGORY, loadCategories -} from './category.js' -import { client } from './client.js' -import { onEnvironment } from './environment.js' -import { BROKEN_FEED, type FeedValue, loadFeed, loadFeeds } from './feed.js' -import { loadFilters } from './filter.js' -import { listenMany, readonlyExport } from './lib/stores.js' -import { deletePost, getPost, loadPosts } from './post.js' -import type { PostValue } from './post.js' -import { type Route, router } from './router.js' +} from './category.ts' +import { client } from './client.ts' +import { onEnvironment } from './environment.ts' +import { BROKEN_FEED, type FeedValue, loadFeed, loadFeeds } from './feed.ts' +import { loadFilters } from './filter.ts' +import { listenMany, readonlyExport } from './lib/stores.ts' +import { deletePost, getPost, loadPosts } from './post.ts' +import type { PostValue } from './post.ts' +import { type Route, router } from './router.ts' function notEmpty(array: Value[]): array is [Value, ...Value[]] { return array.length > 0 diff --git a/core/feed.ts b/core/feed.ts index 8be5e742..934a4285 100644 --- a/core/feed.ts +++ b/core/feed.ts @@ -12,12 +12,12 @@ import { import { nanoid } from 'nanoid' import { atom, onMount } from 'nanostores' -import { client, getClient } from './client.js' -import { createDownloadTask } from './download.js' -import { type OptionalId, readonlyExport } from './lib/stores.js' -import { type LoaderName, loaders } from './loader/index.js' -import { deletePost, loadPosts, recalcPostsReading } from './post.js' -import type { PostsPage } from './posts-page.js' +import { client, getClient } from './client.ts' +import { createDownloadTask } from './download.ts' +import { type OptionalId, readonlyExport } from './lib/stores.ts' +import { type LoaderName, loaders } from './loader/index.ts' +import { deletePost, loadPosts, recalcPostsReading } from './post.ts' +import type { PostsPage } from './posts-page.ts' export type FeedValue = { categoryId: string diff --git a/core/filter.ts b/core/filter.ts index 71fd0bb4..17aa9dff 100644 --- a/core/filter.ts +++ b/core/filter.ts @@ -10,9 +10,9 @@ import { } from '@logux/client' import { nanoid } from 'nanoid' -import { getClient } from './client.js' -import type { FeedValue } from './feed.js' -import { type OriginPost, recalcPostsReading } from './post.js' +import { getClient } from './client.ts' +import type { FeedValue } from './feed.ts' +import { type OriginPost, recalcPostsReading } from './post.ts' const QUERY_REGEXP = /^(not\s+)?([\w]+)(?:\(([^]+)\))?$/ diff --git a/core/i18n.ts b/core/i18n.ts index a5fb3866..77e6b6c9 100644 --- a/core/i18n.ts +++ b/core/i18n.ts @@ -1,7 +1,7 @@ import { createI18n, type TranslationLoader } from '@nanostores/i18n' import { atom } from 'nanostores' -import { onEnvironment } from './environment.js' +import { onEnvironment } from './environment.ts' let $locale = atom('en') diff --git a/core/import.ts b/core/import.ts index 06e8cf68..e1cdf83e 100644 --- a/core/import.ts +++ b/core/import.ts @@ -5,11 +5,11 @@ import { addCategory, type CategoryValue, type FeedsByCategory -} from './category.js' -import { addFeed, type FeedValue } from './feed.js' -import { readonlyExport } from './lib/stores.js' -import { importMessages } from './messages/index.js' -import { createFeedFromUrl } from './preview.js' +} from './category.ts' +import { addFeed, type FeedValue } from './feed.ts' +import { readonlyExport } from './lib/stores.ts' +import { importMessages } from './messages/index.ts' +import { createFeedFromUrl } from './preview.ts' let $importedFeedsByCategory = atom([]) let $importedCategories = atom([]) diff --git a/core/index.ts b/core/index.ts index c30f961d..8bc10672 100644 --- a/core/index.ts +++ b/core/index.ts @@ -1,27 +1,27 @@ -export * from './busy.js' -export * from './category.js' -export * from './client.js' -export * from './devtools.js' -export * from './download.js' -export * from './environment.js' -export * from './error.js' -export * from './export.js' -export * from './fast.js' -export * from './feed.js' -export * from './filter.js' -export * from './filter.js' -export * from './html.js' -export * from './i18n.js' -export * from './import.js' -export * from './loader/index.js' -export * from './messages/index.js' -export * from './not-found.js' -export * from './post.js' -export * from './posts-page.js' -export * from './preview.js' -export * from './refresh.js' -export * from './request.js' -export * from './router.js' -export * from './settings.js' -export * from './slow.js' -export * from './two-steps.js' +export * from './busy.ts' +export * from './category.ts' +export * from './client.ts' +export * from './devtools.ts' +export * from './download.ts' +export * from './environment.ts' +export * from './error.ts' +export * from './export.ts' +export * from './fast.ts' +export * from './feed.ts' +export * from './filter.ts' +export * from './filter.ts' +export * from './html.ts' +export * from './i18n.ts' +export * from './import.ts' +export * from './loader/index.ts' +export * from './messages/index.ts' +export * from './not-found.ts' +export * from './post.ts' +export * from './posts-page.ts' +export * from './preview.ts' +export * from './refresh.ts' +export * from './request.ts' +export * from './router.ts' +export * from './settings.ts' +export * from './slow.ts' +export * from './two-steps.ts' diff --git a/core/loader/atom.ts b/core/loader/atom.ts index 163062ab..aa7b08c5 100644 --- a/core/loader/atom.ts +++ b/core/loader/atom.ts @@ -1,14 +1,14 @@ -import type { TextResponse } from '../download.js' -import type { OriginPost } from '../post.js' -import { createPostsPage } from '../posts-page.js' -import type { Loader } from './index.js' +import type { TextResponse } from '../download.ts' +import type { OriginPost } from '../post.ts' +import { createPostsPage } from '../posts-page.ts' +import type { Loader } from './index.ts' import { findAnchorHrefs, findImageByAttr, findLinksByType, isHTML, toTime -} from './utils.js' +} from './utils.ts' function parsePosts(text: TextResponse): OriginPost[] { let document = text.parseXml() diff --git a/core/loader/index.ts b/core/loader/index.ts index b80cb0a0..c5679e3a 100644 --- a/core/loader/index.ts +++ b/core/loader/index.ts @@ -1,8 +1,8 @@ -import type { DownloadTask, TextResponse } from '../download.js' -import type { PostsPage } from '../posts-page.js' -import { atom } from './atom.js' -import { jsonFeed } from './json-feed.js' -import { rss } from './rss.js' +import type { DownloadTask, TextResponse } from '../download.ts' +import type { PostsPage } from '../posts-page.ts' +import { atom } from './atom.ts' +import { jsonFeed } from './json-feed.ts' +import { rss } from './rss.ts' export type Loader = { getMineLinksFromText(response: TextResponse): string[] diff --git a/core/loader/json-feed.ts b/core/loader/json-feed.ts index e956bf56..de4aa36d 100644 --- a/core/loader/json-feed.ts +++ b/core/loader/json-feed.ts @@ -1,15 +1,15 @@ -import { warning } from '../devtools.js' -import type { TextResponse } from '../download.js' -import type { OriginPost } from '../post.js' -import { createPostsPage } from '../posts-page.js' -import type { Loader } from './index.js' +import { warning } from '../devtools.ts' +import type { TextResponse } from '../download.ts' +import type { OriginPost } from '../post.ts' +import { createPostsPage } from '../posts-page.ts' +import type { Loader } from './index.ts' import { findAnchorHrefs, findLinksByType, isHTML, toTime, unique -} from './utils.js' +} from './utils.ts' // https://www.jsonfeed.org/version/1.1/ interface JsonFeed { diff --git a/core/loader/rss.ts b/core/loader/rss.ts index 629d71c6..1f2895b6 100644 --- a/core/loader/rss.ts +++ b/core/loader/rss.ts @@ -1,7 +1,7 @@ -import type { TextResponse } from '../download.js' -import type { OriginPost } from '../post.js' -import { createPostsPage } from '../posts-page.js' -import type { Loader } from './index.js' +import type { TextResponse } from '../download.ts' +import type { OriginPost } from '../post.ts' +import { createPostsPage } from '../posts-page.ts' +import type { Loader } from './index.ts' import { findAnchorHrefs, findImageByAttr, @@ -9,7 +9,7 @@ import { isHTML, toTime, unique -} from './utils.js' +} from './utils.ts' const MEDIA_NS_URI = 'http://search.yahoo.com/mrss/' diff --git a/core/loader/utils.ts b/core/loader/utils.ts index ce38ce61..7e281597 100644 --- a/core/loader/utils.ts +++ b/core/loader/utils.ts @@ -1,4 +1,4 @@ -import type { TextResponse } from '../download.js' +import type { TextResponse } from '../download.ts' export function isString(attr: null | string): attr is string { return typeof attr === 'string' && attr.length > 0 diff --git a/core/messages/common/en.ts b/core/messages/common/en.ts index ac7b2ff3..cbc67b4f 100644 --- a/core/messages/common/en.ts +++ b/core/messages/common/en.ts @@ -1,4 +1,4 @@ -import { i18n } from '../../i18n.js' +import { i18n } from '../../i18n.ts' export const commonMessages = i18n('common', { brokenCategory: 'Broken category', diff --git a/core/messages/export/en.ts b/core/messages/export/en.ts index f2d57233..6c91acc7 100644 --- a/core/messages/export/en.ts +++ b/core/messages/export/en.ts @@ -1,4 +1,4 @@ -import { i18n } from '../../i18n.js' +import { i18n } from '../../i18n.ts' export const exportMessages = i18n('export', { allFeeds: 'All feeds', diff --git a/core/messages/fast/en.ts b/core/messages/fast/en.ts index 843b6e62..41c073f0 100644 --- a/core/messages/fast/en.ts +++ b/core/messages/fast/en.ts @@ -1,4 +1,4 @@ -import { i18n } from '../../i18n.js' +import { i18n } from '../../i18n.ts' export const fastMessages = i18n('fast', { noPosts: 'No posts', diff --git a/core/messages/import/en.ts b/core/messages/import/en.ts index e1cdbacb..1264bf5c 100644 --- a/core/messages/import/en.ts +++ b/core/messages/import/en.ts @@ -1,4 +1,4 @@ -import { i18n } from '../../i18n.js' +import { i18n } from '../../i18n.ts' export const importMessages = i18n('import', { allFeeds: 'All feeds', diff --git a/core/messages/index.ts b/core/messages/index.ts index 0a92eadf..a666722b 100644 --- a/core/messages/index.ts +++ b/core/messages/index.ts @@ -1,11 +1,11 @@ -export * from './common/en.js' -export * from './export/en.js' -export * from './fast/en.js' -export * from './import/en.js' -export * from './navbar/en.js' -export * from './organize/en.js' -export * from './preview/en.js' -export * from './refresh/en.js' -export * from './settings/en.js' -export * from './slow/en.js' -export * from './start/en.js' +export * from './common/en.ts' +export * from './export/en.ts' +export * from './fast/en.ts' +export * from './import/en.ts' +export * from './navbar/en.ts' +export * from './organize/en.ts' +export * from './preview/en.ts' +export * from './refresh/en.ts' +export * from './settings/en.ts' +export * from './slow/en.ts' +export * from './start/en.ts' diff --git a/core/messages/navbar/en.ts b/core/messages/navbar/en.ts index 66fa98b6..6748ee0a 100644 --- a/core/messages/navbar/en.ts +++ b/core/messages/navbar/en.ts @@ -1,4 +1,4 @@ -import { i18n } from '../../i18n.js' +import { i18n } from '../../i18n.ts' export const navbarMessages = i18n('navbar', { about: 'About the App', diff --git a/core/messages/organize/en.ts b/core/messages/organize/en.ts index 37f08061..85115111 100644 --- a/core/messages/organize/en.ts +++ b/core/messages/organize/en.ts @@ -1,4 +1,4 @@ -import { i18n } from '../../i18n.js' +import { i18n } from '../../i18n.ts' export const organizeMessages = i18n('organize', { addCategory: 'Add category…', diff --git a/core/messages/preview/en.ts b/core/messages/preview/en.ts index 508e53ba..f3c3c5f1 100644 --- a/core/messages/preview/en.ts +++ b/core/messages/preview/en.ts @@ -1,4 +1,4 @@ -import { i18n } from '../../i18n.js' +import { i18n } from '../../i18n.ts' export const previewMessages = i18n('preview', { add: 'Subscribe to feed', diff --git a/core/messages/refresh/en.ts b/core/messages/refresh/en.ts index 39bdb59b..dba7b1ba 100644 --- a/core/messages/refresh/en.ts +++ b/core/messages/refresh/en.ts @@ -1,4 +1,4 @@ -import { i18n } from '../../i18n.js' +import { i18n } from '../../i18n.ts' export const refreshMessages = i18n('refresh', { stop: 'Stop' diff --git a/core/messages/settings/en.ts b/core/messages/settings/en.ts index bb793a37..71dd24bf 100644 --- a/core/messages/settings/en.ts +++ b/core/messages/settings/en.ts @@ -1,4 +1,4 @@ -import { i18n } from '../../i18n.js' +import { i18n } from '../../i18n.ts' export const settingsMessages = i18n('settings', { about: 'About the App', diff --git a/core/messages/slow/en.ts b/core/messages/slow/en.ts index b1f3e81f..2c3ae606 100644 --- a/core/messages/slow/en.ts +++ b/core/messages/slow/en.ts @@ -1,4 +1,4 @@ -import { i18n } from '../../i18n.js' +import { i18n } from '../../i18n.ts' export const slowMessages = i18n('slow', { noPosts: 'No posts', diff --git a/core/messages/start/en.ts b/core/messages/start/en.ts index 1eed2522..2ad97a64 100644 --- a/core/messages/start/en.ts +++ b/core/messages/start/en.ts @@ -1,4 +1,4 @@ -import { i18n } from '../../i18n.js' +import { i18n } from '../../i18n.ts' export const startMessages = i18n('start', { localButton: 'Start local demo', diff --git a/core/not-found.ts b/core/not-found.ts index b46680ef..9a6ccb36 100644 --- a/core/not-found.ts +++ b/core/not-found.ts @@ -1,8 +1,8 @@ import { LoguxUndoError } from '@logux/client' import { atom } from 'nanostores' -import { onEnvironment } from './environment.js' -import { router } from './router.js' +import { onEnvironment } from './environment.ts' +import { router } from './router.ts' export const notFound = atom(false) diff --git a/core/package.json b/core/package.json index e3afe771..0c0d1397 100644 --- a/core/package.json +++ b/core/package.json @@ -12,7 +12,7 @@ "clean:coverage": "rm -rf coverage" }, "exports": { - ".": "./index.js", + ".": "./index.ts", "./package.json": "./package.json" }, "dependencies": { @@ -30,7 +30,7 @@ "@logux/actions": "0.4.0", "@types/dompurify": "3.0.5", "@types/jsdom": "21.1.7", - "better-node-test": "0.5.1", + "better-node-test": "0.6.0", "c8": "10.1.2", "jsdom": "24.1.1", "nanospy": "1.0.0" diff --git a/core/post.ts b/core/post.ts index 1ea57a2e..6d94966f 100644 --- a/core/post.ts +++ b/core/post.ts @@ -11,10 +11,10 @@ import { } from '@logux/client' import { nanoid } from 'nanoid' -import { getClient } from './client.js' -import { getFeed } from './feed.js' -import { loadFilters, prepareFilters } from './filter.js' -import type { OptionalId } from './lib/stores.js' +import { getClient } from './client.ts' +import { getFeed } from './feed.ts' +import { loadFilters, prepareFilters } from './filter.ts' +import type { OptionalId } from './lib/stores.ts' export type OriginPost = { full?: string diff --git a/core/posts-page.ts b/core/posts-page.ts index 8f628c38..957ec1af 100644 --- a/core/posts-page.ts +++ b/core/posts-page.ts @@ -1,6 +1,6 @@ import { map, type ReadableAtom, type StoreValue } from 'nanostores' -import type { OriginPost } from './post.js' +import type { OriginPost } from './post.ts' export interface PostsPageValue { hasNext: boolean diff --git a/core/preview.ts b/core/preview.ts index 528611bd..e54f97d3 100644 --- a/core/preview.ts +++ b/core/preview.ts @@ -7,14 +7,14 @@ import { createDownloadTask, ignoreAbortError, type TextResponse -} from './download.js' -import { isMobile, onEnvironment } from './environment.js' -import { addFeed, type FeedValue, getFeeds } from './feed.js' -import { readonlyExport } from './lib/stores.js' -import { type LoaderName, loaders } from './loader/index.js' -import { addPost, processOriginPost } from './post.js' -import type { PostsPage } from './posts-page.js' -import { router } from './router.js' +} from './download.ts' +import { isMobile, onEnvironment } from './environment.ts' +import { addFeed, type FeedValue, getFeeds } from './feed.ts' +import { readonlyExport } from './lib/stores.ts' +import { type LoaderName, loaders } from './loader/index.ts' +import { addPost, processOriginPost } from './post.ts' +import type { PostsPage } from './posts-page.ts' +import { router } from './router.ts' const ALWAYS_HTTPS = [/^twitter\.com\//] diff --git a/core/refresh.ts b/core/refresh.ts index 3f1279b2..1fdaa2e4 100644 --- a/core/refresh.ts +++ b/core/refresh.ts @@ -1,17 +1,17 @@ import { atom, computed, map } from 'nanostores' -import { createDownloadTask, type DownloadTask } from './download.js' +import { createDownloadTask, type DownloadTask } from './download.ts' import { changeFeed, type FeedValue, getFeed, getFeedLatestPosts, loadFeeds -} from './feed.js' -import { type FilterChecker, loadFilters, prepareFilters } from './filter.js' -import { createQueue, type Queue, retryOnError } from './lib/queue.js' -import { increaseKey, readonlyExport } from './lib/stores.js' -import { addPost, type OriginPost, processOriginPost } from './post.js' +} from './feed.ts' +import { type FilterChecker, loadFilters, prepareFilters } from './filter.ts' +import { createQueue, type Queue, retryOnError } from './lib/queue.ts' +import { increaseKey, readonlyExport } from './lib/stores.ts' +import { addPost, type OriginPost, processOriginPost } from './post.ts' let $isRefreshing = atom(false) export const isRefreshing = readonlyExport($isRefreshing) diff --git a/core/router.ts b/core/router.ts index 50e469d8..a2488bb8 100644 --- a/core/router.ts +++ b/core/router.ts @@ -1,11 +1,11 @@ import { atom, computed, type ReadableAtom } from 'nanostores' -import { getEnvironment, onEnvironment } from './environment.js' -import { fastCategories } from './fast.js' -import { hasFeeds } from './feed.js' -import { computeFrom, readonlyExport } from './lib/stores.js' -import { userId } from './settings.js' -import { slowCategories } from './slow.js' +import { getEnvironment, onEnvironment } from './environment.ts' +import { fastCategories } from './fast.ts' +import { hasFeeds } from './feed.ts' +import { computeFrom, readonlyExport } from './lib/stores.ts' +import { userId } from './settings.ts' +import { slowCategories } from './slow.ts' export interface Routes { about: {} diff --git a/core/settings.ts b/core/settings.ts index b8909e06..de6e1144 100644 --- a/core/settings.ts +++ b/core/settings.ts @@ -1,8 +1,8 @@ import { persistentAtom } from '@nanostores/persistent' import { nanoid } from 'nanoid' -import { getClient } from './client.js' -import { getEnvironment } from './environment.js' +import { getClient } from './client.ts' +import { getEnvironment } from './environment.ts' export const userId = persistentAtom('slowreader:userId') diff --git a/core/slow.ts b/core/slow.ts index 7ea45102..3e6abc48 100644 --- a/core/slow.ts +++ b/core/slow.ts @@ -6,13 +6,13 @@ import { type CategoryValue, GENERAL_CATEGORY, loadCategories -} from './category.js' -import { client } from './client.js' -import { onEnvironment } from './environment.js' -import { BROKEN_FEED, type FeedValue, loadFeed } from './feed.js' -import { listenMany, readonlyExport } from './lib/stores.js' -import { getPost, loadPosts, type PostValue } from './post.js' -import { type Route, router } from './router.js' +} from './category.ts' +import { client } from './client.ts' +import { onEnvironment } from './environment.ts' +import { BROKEN_FEED, type FeedValue, loadFeed } from './feed.ts' +import { listenMany, readonlyExport } from './lib/stores.ts' +import { getPost, loadPosts, type PostValue } from './post.ts' +import { type Route, router } from './router.ts' export type SlowCategoriesTree = [CategoryValue, [FeedValue, number][]][] diff --git a/core/test/busy.test.ts b/core/test/busy.test.ts index 092fbb6c..e2bc1774 100644 --- a/core/test/busy.test.ts +++ b/core/test/busy.test.ts @@ -2,8 +2,8 @@ import { equal } from 'node:assert' import { afterEach, test } from 'node:test' import { setTimeout } from 'node:timers/promises' -import { busy, busyDuring } from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +import { busy, busyDuring } from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' afterEach(async () => { await cleanClientTest() diff --git a/core/test/category.test.ts b/core/test/category.test.ts index d6640e88..07599c7e 100644 --- a/core/test/category.test.ts +++ b/core/test/category.test.ts @@ -14,8 +14,8 @@ import { loadFeed, loadFeeds, testFeed -} from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +} from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' beforeEach(() => { enableClientTest() diff --git a/core/test/client.test.ts b/core/test/client.test.ts index 906896e1..75619e4e 100644 --- a/core/test/client.test.ts +++ b/core/test/client.test.ts @@ -3,8 +3,8 @@ import { cleanStores, keepMount } from 'nanostores' import { equal, match, throws } from 'node:assert' import { afterEach, test } from 'node:test' -import { client, getClient, userId } from '../index.js' -import { enableClientTest } from './utils.js' +import { client, getClient, userId } from '../index.ts' +import { enableClientTest } from './utils.ts' enableClientTest() diff --git a/core/test/download.test.ts b/core/test/download.test.ts index 01c64aba..8d6ee469 100644 --- a/core/test/download.test.ts +++ b/core/test/download.test.ts @@ -1,4 +1,4 @@ -import './dom-parser.js' +import './dom-parser.ts' import { equal, rejects, throws } from 'node:assert' import { afterEach, beforeEach, test } from 'node:test' @@ -12,7 +12,7 @@ import { ignoreAbortError, mockRequest, setRequestMethod -} from '../index.js' +} from '../index.ts' beforeEach(() => { mockRequest() diff --git a/core/test/environment.test.ts b/core/test/environment.test.ts index 45ed9216..247b7f55 100644 --- a/core/test/environment.test.ts +++ b/core/test/environment.test.ts @@ -7,7 +7,7 @@ import { getTestEnvironment, onEnvironment, setupEnvironment -} from '../index.js' +} from '../index.ts' test('throws on current environment if it is not set', () => { throws(() => { diff --git a/core/test/environment.ts b/core/test/environment.ts index f5ba65e1..a3d5594c 100644 --- a/core/test/environment.ts +++ b/core/test/environment.ts @@ -1,3 +1,3 @@ -import { getTestEnvironment, setupEnvironment } from '../index.js' +import { getTestEnvironment, setupEnvironment } from '../index.ts' setupEnvironment(getTestEnvironment()) diff --git a/core/test/error.test.ts b/core/test/error.test.ts index ed6752e4..b7c994ff 100644 --- a/core/test/error.test.ts +++ b/core/test/error.test.ts @@ -1,7 +1,7 @@ import { equal, match } from 'node:assert' import { test } from 'node:test' -import { SlowReaderError } from '../index.js' +import { SlowReaderError } from '../index.ts' test('formats error', () => { let error = new SlowReaderError('Test') diff --git a/core/test/export.test.ts b/core/test/export.test.ts index ce9f83fa..86398218 100644 --- a/core/test/export.test.ts +++ b/core/test/export.test.ts @@ -1,4 +1,4 @@ -import './dom-parser.js' +import './dom-parser.ts' import { cleanStores } from 'nanostores' import { deepStrictEqual, equal, ok } from 'node:assert' @@ -24,8 +24,8 @@ import { submiting, toggleExportingCategory, toggleExportingFeed -} from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +} from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' async function loadFile(name: string): Promise { let path = join(import.meta.dirname, 'fixtures', name) diff --git a/core/test/fast.test.ts b/core/test/fast.test.ts index 018fb5df..738c50c2 100644 --- a/core/test/fast.test.ts +++ b/core/test/fast.test.ts @@ -26,8 +26,8 @@ import { setFastPostsPerPage, testFeed, testPost -} from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +} from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' beforeEach(() => { enableClientTest() diff --git a/core/test/feed.test.ts b/core/test/feed.test.ts index 8bc4007b..60a9a636 100644 --- a/core/test/feed.test.ts +++ b/core/test/feed.test.ts @@ -24,8 +24,8 @@ import { loadFeeds, testFeed, testPost -} from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +} from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' beforeEach(() => { enableClientTest() diff --git a/core/test/filter.test.ts b/core/test/filter.test.ts index 6b3f938f..76642ff2 100644 --- a/core/test/filter.test.ts +++ b/core/test/filter.test.ts @@ -19,8 +19,8 @@ import { prepareFilters, sortFilters, testFeed -} from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +} from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' beforeEach(() => { enableClientTest() diff --git a/core/test/html.test.ts b/core/test/html.test.ts index 8c4f3014..08250564 100644 --- a/core/test/html.test.ts +++ b/core/test/html.test.ts @@ -1,9 +1,9 @@ -import './dom-parser.js' +import './dom-parser.ts' import { equal } from 'node:assert' import { test } from 'node:test' -import { parseLink, parseRichTranslation, sanitizeDOM } from '../index.js' +import { parseLink, parseRichTranslation, sanitizeDOM } from '../index.ts' test('sanitizes HTML', () => { equal( diff --git a/core/test/i18n.test.ts b/core/test/i18n.test.ts index 1ad6bdad..f5e8242f 100644 --- a/core/test/i18n.test.ts +++ b/core/test/i18n.test.ts @@ -1,11 +1,11 @@ -import './environment.js' +import './environment.ts' import { atom } from 'nanostores' import { deepStrictEqual, equal } from 'node:assert' import { test } from 'node:test' -import { i18n, settingsMessages } from '../index.js' -import { enableClientTest } from './utils.js' +import { i18n, settingsMessages } from '../index.ts' +import { enableClientTest } from './utils.ts' test('has i18n', async () => { equal(typeof i18n, 'function') diff --git a/core/test/import.test.ts b/core/test/import.test.ts index f3b141fd..31a2136d 100644 --- a/core/test/import.test.ts +++ b/core/test/import.test.ts @@ -1,4 +1,4 @@ -import './dom-parser.js' +import './dom-parser.ts' import { cleanStores } from 'nanostores' import { deepStrictEqual, equal, ok } from 'node:assert' @@ -26,8 +26,8 @@ import { submiting, toggleImportedCategory, toggleImportedFeed -} from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +} from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' async function importFile(name: string): Promise { let path = join(import.meta.dirname, 'fixtures', name) diff --git a/core/test/lib/queue.test.ts b/core/test/lib/queue.test.ts index 83ce3495..4771a42d 100644 --- a/core/test/lib/queue.test.ts +++ b/core/test/lib/queue.test.ts @@ -2,7 +2,7 @@ import { equal, fail, rejects } from 'node:assert' import { test } from 'node:test' import { setTimeout } from 'node:timers/promises' -import { createQueue, retryOnError } from '../../lib/queue.js' +import { createQueue, retryOnError } from '../../lib/queue.ts' test('increase keys', async () => { let events = '' diff --git a/core/test/lib/store.test.ts b/core/test/lib/store.test.ts index 85c4f15c..7c1a9870 100644 --- a/core/test/lib/store.test.ts +++ b/core/test/lib/store.test.ts @@ -7,7 +7,7 @@ import { forceSet, increaseKey, listenMany -} from '../../lib/stores.js' +} from '../../lib/stores.ts' test('force set', () => { let $a: ReadableAtom = atom(1) diff --git a/core/test/loader/atom.test.ts b/core/test/loader/atom.test.ts index 8d802822..9537b66e 100644 --- a/core/test/loader/atom.test.ts +++ b/core/test/loader/atom.test.ts @@ -1,4 +1,4 @@ -import '../dom-parser.js' +import '../dom-parser.ts' import { spyOn } from 'nanospy' import { deepStrictEqual, equal } from 'node:assert' @@ -10,7 +10,7 @@ import { createTextResponse, loaders, type TextResponse -} from '../../index.js' +} from '../../index.ts' function exampleAtom(responseBody: string): TextResponse { return createTextResponse(responseBody, { diff --git a/core/test/loader/json-feed.test.ts b/core/test/loader/json-feed.test.ts index 52fb7ea6..e066484a 100644 --- a/core/test/loader/json-feed.test.ts +++ b/core/test/loader/json-feed.test.ts @@ -1,4 +1,4 @@ -import '../dom-parser.js' +import '../dom-parser.ts' import { spyOn } from 'nanospy' import { deepStrictEqual, equal } from 'node:assert' @@ -10,7 +10,7 @@ import { createTextResponse, loaders, type TextResponse -} from '../../index.js' +} from '../../index.ts' function exampleJson(json: object | string): TextResponse { let string = typeof json === 'string' ? json : JSON.stringify(json) diff --git a/core/test/loader/rss.test.ts b/core/test/loader/rss.test.ts index 023429af..794b5f41 100644 --- a/core/test/loader/rss.test.ts +++ b/core/test/loader/rss.test.ts @@ -1,4 +1,4 @@ -import '../dom-parser.js' +import '../dom-parser.ts' import { spyOn } from 'nanospy' import { deepStrictEqual, equal } from 'node:assert' @@ -10,7 +10,7 @@ import { createTextResponse, loaders, type TextResponse -} from '../../index.js' +} from '../../index.ts' function exampleRss(responseBody: string): TextResponse { return createTextResponse(responseBody, { diff --git a/core/test/not-found.test.ts b/core/test/not-found.test.ts index 3f46a854..6a67029c 100644 --- a/core/test/not-found.test.ts +++ b/core/test/not-found.test.ts @@ -2,8 +2,8 @@ import { LoguxUndoError } from '@logux/client' import { equal } from 'node:assert' import { afterEach, beforeEach, test } from 'node:test' -import { notFound, setBaseTestRoute } from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +import { notFound, setBaseTestRoute } from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' let listener: (e: { reason: Error }) => void diff --git a/core/test/post.test.ts b/core/test/post.test.ts index 8205234e..dc180f9e 100644 --- a/core/test/post.test.ts +++ b/core/test/post.test.ts @@ -13,8 +13,8 @@ import { loadPosts, type OriginPost, processOriginPost -} from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +} from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' beforeEach(() => { enableClientTest() diff --git a/core/test/posts-page.test.ts b/core/test/posts-page.test.ts index 2b3ab825..84198da7 100644 --- a/core/test/posts-page.test.ts +++ b/core/test/posts-page.test.ts @@ -1,7 +1,7 @@ import { deepStrictEqual } from 'node:assert' import { test } from 'node:test' -import { createPostsPage, type OriginPost } from '../index.js' +import { createPostsPage, type OriginPost } from '../index.ts' const POST1: OriginPost = { full: '1', diff --git a/core/test/preview.test.ts b/core/test/preview.test.ts index 2ba91d3b..30ba5a9c 100644 --- a/core/test/preview.test.ts +++ b/core/test/preview.test.ts @@ -1,4 +1,4 @@ -import './dom-parser.js' +import './dom-parser.ts' import { ensureLoaded } from '@logux/client' import { restoreAll, spyOn } from 'nanospy' @@ -35,8 +35,8 @@ import { setPreviewCandidate, setPreviewUrl, testFeed -} from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +} from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' beforeEach(() => { enableClientTest() diff --git a/core/test/production.test.ts b/core/test/production.test.ts index a49a180f..37c4c2ce 100644 --- a/core/test/production.test.ts +++ b/core/test/production.test.ts @@ -1,10 +1,10 @@ -import './environment.js' +import './environment.ts' import { cleanStores } from 'nanostores' import { match } from 'node:assert' import { afterEach, test } from 'node:test' -import { client, userId } from '../index.js' +import { client, userId } from '../index.ts' global.WebSocket = function () {} as any diff --git a/core/test/refresh.test.ts b/core/test/refresh.test.ts index 38593883..09d11f29 100644 --- a/core/test/refresh.test.ts +++ b/core/test/refresh.test.ts @@ -22,8 +22,8 @@ import { refreshStatistics, stopRefreshing, testFeed -} from '../index.js' -import { cleanClientTest, createPromise, enableClientTest } from './utils.js' +} from '../index.ts' +import { cleanClientTest, createPromise, enableClientTest } from './utils.ts' beforeEach(() => { mockRequest() diff --git a/core/test/request.test.ts b/core/test/request.test.ts index d581541e..25fb8b6e 100644 --- a/core/test/request.test.ts +++ b/core/test/request.test.ts @@ -8,7 +8,7 @@ import { mockRequest, request, setRequestMethod -} from '../index.js' +} from '../index.ts' afterEach(() => { setRequestMethod(fetch) diff --git a/core/test/router.test.ts b/core/test/router.test.ts index eea688f7..fc2924b8 100644 --- a/core/test/router.test.ts +++ b/core/test/router.test.ts @@ -18,8 +18,8 @@ import { testFeed, testPost, userId -} from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +} from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' beforeEach(() => { enableClientTest() diff --git a/core/test/settings.test.ts b/core/test/settings.test.ts index 17c18ce2..4fd07f1e 100644 --- a/core/test/settings.test.ts +++ b/core/test/settings.test.ts @@ -8,8 +8,8 @@ import { signOut, theme, userId -} from '../index.js' -import { cleanClientTest, enableClientTest } from '../test/utils.js' +} from '../index.ts' +import { cleanClientTest, enableClientTest } from '../test/utils.ts' let restarts = 0 diff --git a/core/test/slow.test.ts b/core/test/slow.test.ts index cd7cebb4..21c81d04 100644 --- a/core/test/slow.test.ts +++ b/core/test/slow.test.ts @@ -21,8 +21,8 @@ import { slowPosts, testFeed, testPost -} from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +} from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' beforeEach(() => { enableClientTest() diff --git a/core/test/two-steps.test.ts b/core/test/two-steps.test.ts index 5ef52b67..3e2cd4b7 100644 --- a/core/test/two-steps.test.ts +++ b/core/test/two-steps.test.ts @@ -1,4 +1,4 @@ -import './dom-parser.js' +import './dom-parser.ts' import { deepStrictEqual, strictEqual } from 'node:assert' import { afterEach, beforeEach, test } from 'node:test' @@ -20,8 +20,8 @@ import { setPreviewUrl, testFeed, testPost -} from '../index.js' -import { cleanClientTest, enableClientTest } from './utils.js' +} from '../index.ts' +import { cleanClientTest, enableClientTest } from './utils.ts' beforeEach(() => { enableClientTest() diff --git a/core/test/utils.ts b/core/test/utils.ts index 85791ea6..f945ef27 100644 --- a/core/test/utils.ts +++ b/core/test/utils.ts @@ -14,7 +14,7 @@ import { setBaseTestRoute, setupEnvironment, userId -} from '../index.js' +} from '../index.ts' export function enableClientTest(env: Partial = {}): void { setupEnvironment({ ...getTestEnvironment(), ...env }) diff --git a/core/two-steps.ts b/core/two-steps.ts index 7d18fe22..9773d3ca 100644 --- a/core/two-steps.ts +++ b/core/two-steps.ts @@ -1,6 +1,6 @@ import { atom } from 'nanostores' -import { backRoute } from './router.js' +import { backRoute } from './router.ts' export let secondStep = atom(false) diff --git a/loader-tests/check-opml.ts b/loader-tests/check-opml.ts index 6999c530..b422fe57 100644 --- a/loader-tests/check-opml.ts +++ b/loader-tests/check-opml.ts @@ -12,7 +12,7 @@ import { isString, type LoaderTestFeed as OpmlFeed, readText -} from './utils.js' +} from './utils.ts' async function parseFeedsFromFile(path: string): Promise { if (!path.endsWith('.opml') && !path.endsWith('.xml')) { diff --git a/loader-tests/home.ts b/loader-tests/home.ts index 4c56f6f0..00f90893 100644 --- a/loader-tests/home.ts +++ b/loader-tests/home.ts @@ -1,4 +1,4 @@ -import { createCLI, enableTestClient, findRSSfromHome } from './utils.js' +import { createCLI, enableTestClient, findRSSfromHome } from './utils.ts' let cli = createCLI( 'Debug feed search with specific feed', diff --git a/loader-tests/package.json b/loader-tests/package.json index d9bf9162..02599908 100644 --- a/loader-tests/package.json +++ b/loader-tests/package.json @@ -7,17 +7,16 @@ "pnpm": "^9.0.0" }, "scripts": { - "check-opml": "tsx check-opml.ts", + "check-opml": "../scripts/tsnode check-opml.ts", "test": "node --run test:loaders", - "url": "tsx url.ts", - "home": "tsx home.ts", - "test:loaders": "tsx test-loaders.ts" + "url": "../scripts/tsnode url.ts", + "home": "../scripts/tsnode home.ts", + "test:loaders": "../scripts/tsnode test-loaders.ts" }, "devDependencies": { "@slowreader/core": "link:../core", "jsdom": "24.1.1", "nanostores": "0.11.2", - "tsx": "4.16.5", "yaml": "2.5.0" } } diff --git a/loader-tests/test-loaders.ts b/loader-tests/test-loaders.ts index 7a2f95a7..a6b50322 100644 --- a/loader-tests/test-loaders.ts +++ b/loader-tests/test-loaders.ts @@ -11,7 +11,7 @@ import { initializeProgressBar, type LoaderTestFeed, readText -} from './utils.js' +} from './utils.ts' const FEEDS = join(import.meta.dirname, 'feeds.yml') diff --git a/loader-tests/url.ts b/loader-tests/url.ts index cdeb65bc..48d31ece 100644 --- a/loader-tests/url.ts +++ b/loader-tests/url.ts @@ -1,4 +1,4 @@ -import { createCLI, enableTestClient, fetchAndParsePosts } from './utils.js' +import { createCLI, enableTestClient, fetchAndParsePosts } from './utils.ts' let cli = createCLI( 'Debug post loading with specific feed', diff --git a/loader-tests/utils.ts b/loader-tests/utils.ts index 27a2addf..2bfcbe44 100644 --- a/loader-tests/utils.ts +++ b/loader-tests/utils.ts @@ -1,4 +1,4 @@ -import './dom-parser.js' +import './dom-parser.ts' import { createDownloadTask, diff --git a/nano-staged.json b/nano-staged.json index f570b75f..0d5e8761 100644 --- a/nano-staged.json +++ b/nano-staged.json @@ -3,11 +3,11 @@ "*.css": "stylelint --fix", "*.svelte": ["prettier --write", "stylelint --fix"], "*.svg": "svgo", - ".devcontainer/Dockerfile": "tsx ./scripts/check-versions.ts", - ".node-version": "tsx ./scripts/check-versions.ts", - "package.json": "tsx ./scripts/check-versions.ts", - "*/package.json": "tsx ./scripts/check-versions.ts", - "*/Dockerfile": "tsx ./scripts/check-versions.ts", - "*.test.ts": "tsx ./scripts/check-focused-tests.ts", - "core/messages/*/en.ts": "tsx ./scripts/check-messages.ts" + ".devcontainer/Dockerfile": "./scripts/tsnode ./scripts/check-versions.ts", + ".node-version": "./scripts/tsnode ./scripts/check-versions.ts", + "package.json": "./scripts/tsnode ./scripts/check-versions.ts", + "*/package.json": "./scripts/tsnode ./scripts/check-versions.ts", + "*/Dockerfile": "./scripts/tsnode ./scripts/check-versions.ts", + "*.test.ts": "./scripts/tsnode ./scripts/check-focused-tests.ts", + "core/messages/*/en.ts": "./scripts/tsnode ./scripts/check-messages.ts" } diff --git a/package.json b/package.json index 65c574e9..6171870e 100644 --- a/package.json +++ b/package.json @@ -14,18 +14,18 @@ "format": "pnpm run -r --include-workspace-root /^format:/", "clean": "pnpm run -r --include-workspace-root /^clean:/", "build": "pnpm run -r build", - "update-env": "tsx ./scripts/update-env.ts", + "update-env": "./scripts/tsnode ./scripts/update-env.ts", "format:prettier": "prettier -w **/*.{js,ts,html,md,cjs,json} *.{js,json,md}", "test:js": "eslint .", "test:types": "svelte-check", "test:audit": "pnpm audit --prod", - "test:focused": "tsx ./scripts/check-focused-tests.ts", - "test:messages": "tsx ./scripts/check-messages.ts", - "test:versions": "tsx ./scripts/check-versions.ts", + "test:focused": "./scripts/tsnode ./scripts/check-focused-tests.ts", + "test:messages": "./scripts/tsnode ./scripts/check-messages.ts", + "test:versions": "./scripts/tsnode ./scripts/check-versions.ts", "test:markdown": "remark . --frail", "test:format": "prettier --check **/*.{js,ts,html,md,cjs,json} *.{js,json,md}", - "check-opml": "tsx loader-tests/check-opml.ts", - "test-loaders": "tsx loader-tests/test-loaders.ts loader-tests/feeds.yml", + "check-opml": "./scripts/tsnode loader-tests/check-opml.ts", + "test-loaders": "./scripts/tsnode loader-tests/test-loaders.ts loader-tests/feeds.yml", "prepare": "husky" }, "workspaces": [ @@ -40,7 +40,7 @@ "@logux/eslint-config": "53.3.0", "@types/node": "22.1.0", "@types/ws": "8.5.12", - "better-node-test": "0.5.1", + "better-node-test": "0.6.0", "eslint": "9.8.0", "eslint-plugin-svelte": "^2.43.0", "husky": "^9.1.4", @@ -64,7 +64,6 @@ "svelte": "4.2.18", "svelte-check": "3.8.5", "svgo": "3.3.2", - "tsx": "4.16.5", "typescript": "5.5.4" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4da7d69a..f5578fc5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,8 +18,8 @@ importers: specifier: 8.5.12 version: 8.5.12 better-node-test: - specifier: 0.5.1 - version: 0.5.1 + specifier: 0.6.0 + version: 0.6.0 eslint: specifier: 9.8.0 version: 9.8.0 @@ -85,13 +85,10 @@ importers: version: 4.2.18 svelte-check: specifier: 3.8.5 - version: 3.8.5(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(tsx@4.16.5)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18) + version: 3.8.5(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18) svgo: specifier: 3.3.2 version: 3.3.2 - tsx: - specifier: 4.16.5 - version: 4.16.5 typescript: specifier: 5.5.4 version: 5.5.4 @@ -138,8 +135,8 @@ importers: specifier: 21.1.7 version: 21.1.7 better-node-test: - specifier: 0.5.1 - version: 0.5.1 + specifier: 0.6.0 + version: 0.6.0 c8: specifier: 10.1.2 version: 10.1.2 @@ -161,9 +158,6 @@ importers: nanostores: specifier: 0.11.2 version: 0.11.2 - tsx: - specifier: 4.16.5 - version: 4.16.5 yaml: specifier: 2.5.0 version: 2.5.0 @@ -175,14 +169,11 @@ importers: version: 0.23.0 devDependencies: better-node-test: - specifier: 0.5.1 - version: 0.5.1 + specifier: 0.6.0 + version: 0.6.0 c8: specifier: 10.1.2 version: 10.1.2 - tsx: - specifier: 4.16.5 - version: 4.16.5 server: dependencies: @@ -192,10 +183,6 @@ importers: '@slowreader/api': specifier: link:../api version: link:../api - devDependencies: - tsx: - specifier: 4.16.5 - version: 4.16.5 web: dependencies: @@ -252,10 +239,7 @@ importers: version: 4.2.18 svelte-preprocess: specifier: 6.0.2 - version: 6.0.2(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(tsx@4.16.5)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18)(typescript@5.5.4) - tsx: - specifier: 4.16.5 - version: 4.16.5 + version: 6.0.2(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18)(typescript@5.5.4) vite: specifier: 5.4.0 version: 5.4.0(@types/node@22.1.0) @@ -280,7 +264,7 @@ importers: version: 8.2.8(storybook@8.2.8(@babel/preset-env@7.25.3(@babel/core@7.25.2)))(svelte@4.2.18) '@storybook/svelte-vite': specifier: 8.2.8 - version: 8.2.8(@babel/core@7.25.2)(@sveltejs/vite-plugin-svelte@3.1.1(svelte@4.2.18)(vite@5.4.0(@types/node@22.1.0)))(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(tsx@4.16.5)(yaml@2.5.0))(postcss@8.4.41)(storybook@8.2.8(@babel/preset-env@7.25.3(@babel/core@7.25.2)))(svelte@4.2.18)(typescript@5.5.4)(vite@5.4.0(@types/node@22.1.0)) + version: 8.2.8(@babel/core@7.25.2)(@sveltejs/vite-plugin-svelte@3.1.1(svelte@4.2.18)(vite@5.4.0(@types/node@22.1.0)))(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(yaml@2.5.0))(postcss@8.4.41)(storybook@8.2.8(@babel/preset-env@7.25.3(@babel/core@7.25.2)))(svelte@4.2.18)(typescript@5.5.4)(vite@5.4.0(@types/node@22.1.0)) '@storybook/types': specifier: ^8.2.8 version: 8.2.8(storybook@8.2.8(@babel/preset-env@7.25.3(@babel/core@7.25.2))) @@ -288,8 +272,8 @@ importers: specifier: 2.0.0 version: 2.0.0(stylelint@16.8.1(typescript@5.5.4)) better-node-test: - specifier: 0.5.1 - version: 0.5.1 + specifier: 0.6.0 + version: 0.6.0 browserslist: specifier: 4.23.3 version: 4.23.3 @@ -2076,8 +2060,8 @@ packages: base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - better-node-test@0.5.1: - resolution: {integrity: sha512-L5iVFSXrX+hCJ4OItXGzDQ+HMAPUcoXu6Zwnlha7mtkoBu3sRZb4PtkOFJg/mJnIerKfbgRl4f4qDqcDLfM5rA==} + better-node-test@0.6.0: + resolution: {integrity: sha512-ML+qpsuaL4KgQe9vmD/dDLeCTLHGuqy/N6p4jFRIscoLdznucd3l75gBQznoiq0LrgRa6Gs70RU00Bl4LR+giQ==} engines: {node: ^18.19.0 || >=20.0.0} hasBin: true @@ -5089,11 +5073,6 @@ packages: tslib@2.6.3: resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} - tsx@4.16.5: - resolution: {integrity: sha512-ArsiAQHEW2iGaqZ8fTA1nX0a+lN5mNTyuGRRO6OW3H/Yno1y9/t1f9YOI1Cfoqz63VAthn++ZYcbDP7jPflc+A==} - engines: {node: '>=18.0.0'} - hasBin: true - type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -6958,7 +6937,7 @@ snapshots: dependencies: storybook: 8.2.8(@babel/preset-env@7.25.3(@babel/core@7.25.2)) - '@storybook/svelte-vite@8.2.8(@babel/core@7.25.2)(@sveltejs/vite-plugin-svelte@3.1.1(svelte@4.2.18)(vite@5.4.0(@types/node@22.1.0)))(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(tsx@4.16.5)(yaml@2.5.0))(postcss@8.4.41)(storybook@8.2.8(@babel/preset-env@7.25.3(@babel/core@7.25.2)))(svelte@4.2.18)(typescript@5.5.4)(vite@5.4.0(@types/node@22.1.0))': + '@storybook/svelte-vite@8.2.8(@babel/core@7.25.2)(@sveltejs/vite-plugin-svelte@3.1.1(svelte@4.2.18)(vite@5.4.0(@types/node@22.1.0)))(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(yaml@2.5.0))(postcss@8.4.41)(storybook@8.2.8(@babel/preset-env@7.25.3(@babel/core@7.25.2)))(svelte@4.2.18)(typescript@5.5.4)(vite@5.4.0(@types/node@22.1.0))': dependencies: '@storybook/builder-vite': 8.2.8(storybook@8.2.8(@babel/preset-env@7.25.3(@babel/core@7.25.2)))(typescript@5.5.4)(vite@5.4.0(@types/node@22.1.0)) '@storybook/svelte': 8.2.8(storybook@8.2.8(@babel/preset-env@7.25.3(@babel/core@7.25.2)))(svelte@4.2.18) @@ -6966,7 +6945,7 @@ snapshots: magic-string: 0.30.11 storybook: 8.2.8(@babel/preset-env@7.25.3(@babel/core@7.25.2)) svelte: 4.2.18 - svelte-preprocess: 5.1.4(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(tsx@4.16.5)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18)(typescript@5.5.4) + svelte-preprocess: 5.1.4(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18)(typescript@5.5.4) sveltedoc-parser: 4.2.1 ts-dedent: 2.2.0 vite: 5.4.0(@types/node@22.1.0) @@ -7474,7 +7453,7 @@ snapshots: base64-js@1.5.1: {} - better-node-test@0.5.1: {} + better-node-test@0.6.0: {} binary-extensions@2.3.0: {} @@ -9956,13 +9935,12 @@ snapshots: optionalDependencies: postcss: 8.4.41 - postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(tsx@4.16.5)(yaml@2.5.0): + postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(yaml@2.5.0): dependencies: lilconfig: 3.1.2 optionalDependencies: jiti: 1.21.6 postcss: 8.4.41 - tsx: 4.16.5 yaml: 2.5.0 optional: true @@ -10753,14 +10731,14 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - svelte-check@3.8.5(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(tsx@4.16.5)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18): + svelte-check@3.8.5(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18): dependencies: '@jridgewell/trace-mapping': 0.3.25 chokidar: 3.6.0 picocolors: 1.0.1 sade: 1.8.1 svelte: 4.2.18 - svelte-preprocess: 5.1.4(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(tsx@4.16.5)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18)(typescript@5.5.4) + svelte-preprocess: 5.1.4(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18)(typescript@5.5.4) typescript: 5.5.4 transitivePeerDependencies: - '@babel/core' @@ -10787,7 +10765,7 @@ snapshots: dependencies: svelte: 4.2.18 - svelte-preprocess@5.1.4(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(tsx@4.16.5)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18)(typescript@5.5.4): + svelte-preprocess@5.1.4(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18)(typescript@5.5.4): dependencies: '@types/pug': 2.0.10 detect-indent: 6.1.0 @@ -10798,16 +10776,16 @@ snapshots: optionalDependencies: '@babel/core': 7.25.2 postcss: 8.4.41 - postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.41)(tsx@4.16.5)(yaml@2.5.0) + postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.41)(yaml@2.5.0) typescript: 5.5.4 - svelte-preprocess@6.0.2(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(tsx@4.16.5)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18)(typescript@5.5.4): + svelte-preprocess@6.0.2(@babel/core@7.25.2)(postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.41)(yaml@2.5.0))(postcss@8.4.41)(svelte@4.2.18)(typescript@5.5.4): dependencies: svelte: 4.2.18 optionalDependencies: '@babel/core': 7.25.2 postcss: 8.4.41 - postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.41)(tsx@4.16.5)(yaml@2.5.0) + postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.41)(yaml@2.5.0) typescript: 5.5.4 svelte@4.2.18: @@ -10939,13 +10917,6 @@ snapshots: tslib@2.6.3: {} - tsx@4.16.5: - dependencies: - esbuild: 0.21.5 - get-tsconfig: 4.7.6 - optionalDependencies: - fsevents: 2.3.3 - type-check@0.4.0: dependencies: prelude-ls: 1.2.1 diff --git a/proxy/index.ts b/proxy/index.ts index f8c67150..c70722c9 100755 --- a/proxy/index.ts +++ b/proxy/index.ts @@ -1,6 +1,6 @@ import { styleText } from 'node:util' -import { createProxyServer } from './proxy.js' +import { createProxyServer } from './proxy.ts' const PORT = process.env.PORT ?? 5284 diff --git a/proxy/package.json b/proxy/package.json index cb52e0fb..a402ffd0 100644 --- a/proxy/package.json +++ b/proxy/package.json @@ -7,7 +7,7 @@ "pnpm": "^9.0.0" }, "scripts": { - "start": "tsx watch index.ts", + "start": "../scripts/tsnode --watch index.ts", "test": "FORCE_COLOR=1 pnpm run /^test:/", "build": "esbuild index.ts --bundle --platform=node --sourcemap --format=esm --outfile=dist/index.mjs", "production": "node --run build && ./scripts/run-image.sh", @@ -19,8 +19,7 @@ "esbuild": "0.23.0" }, "devDependencies": { - "better-node-test": "0.5.1", - "c8": "10.1.2", - "tsx": "4.16.5" + "better-node-test": "0.6.0", + "c8": "10.1.2" } } diff --git a/proxy/test/proxy.test.ts b/proxy/test/proxy.test.ts index 0d6cd83b..54166a9f 100644 --- a/proxy/test/proxy.test.ts +++ b/proxy/test/proxy.test.ts @@ -5,7 +5,7 @@ import { after, test } from 'node:test' import { setTimeout } from 'node:timers/promises' import { URL } from 'node:url' -import { createProxyServer } from '../proxy.js' +import { createProxyServer } from '../proxy.ts' function getURL(server: Server): string { let port = (server.address() as AddressInfo).port diff --git a/scripts/tsnode b/scripts/tsnode new file mode 100755 index 00000000..4247ca7f --- /dev/null +++ b/scripts/tsnode @@ -0,0 +1,4 @@ +#!/bin/bash +# Shortcut to run Node.js with TS support and without experimental warnings + +node --experimental-strip-types --disable-warning=ExperimentalWarning $@ diff --git a/server/package.json b/server/package.json index 08a4382a..39d9f938 100644 --- a/server/package.json +++ b/server/package.json @@ -7,13 +7,10 @@ "pnpm": "^9.0.0" }, "scripts": { - "start": "tsx watch index.ts" + "start": "../scripts/tsnode --watch index.ts" }, "dependencies": { "@logux/server": "0.13.0", "@slowreader/api": "link:../api" - }, - "devDependencies": { - "tsx": "4.16.5" } } diff --git a/tsconfig.json b/tsconfig.json index f2dea244..95817665 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,13 +1,14 @@ { "compilerOptions": { + "allowImportingTsExtensions": true, "noUncheckedIndexedAccess": true, "verbatimModuleSyntax": true, - "moduleResolution": "node16", + "moduleResolution": "NodeNext", "esModuleInterop": true, "skipLibCheck": true, "allowJs": true, "target": "es2021", - "module": "node16", + "module": "NodeNext", "strict": true, "noEmit": true, "paths": { diff --git a/web/.storybook/preview.ts b/web/.storybook/preview.ts index 6f34db5c..e5636d18 100644 --- a/web/.storybook/preview.ts +++ b/web/.storybook/preview.ts @@ -1,5 +1,5 @@ -import '../main/browser.js' -import '../stories/environment.js' +import '../main/browser.ts' +import '../stories/environment.ts' import '../main/index.css' diff --git a/web/main/browser.ts b/web/main/browser.ts index 781338ac..84c40570 100644 --- a/web/main/browser.ts +++ b/web/main/browser.ts @@ -9,7 +9,7 @@ import { startKeyUX } from 'keyux' -import { locale } from '../stores/locale.js' +import { locale } from '../stores/locale.ts' let root = document.documentElement let themeTag = document.querySelector('meta[name="theme-color"]') @@ -56,5 +56,5 @@ startKeyUX(window, [ ]) window.addEventListener('load', async () => { - await import('./devtools.js') + await import('./devtools.ts') }) diff --git a/web/main/environment.ts b/web/main/environment.ts index eb797300..c7f54ed7 100644 --- a/web/main/environment.ts +++ b/web/main/environment.ts @@ -10,8 +10,8 @@ import { setupEnvironment } from '@slowreader/core' -import { locale } from '../stores/locale.js' -import { openRoute, urlRouter } from '../stores/router.js' +import { locale } from '../stores/locale.ts' +import { openRoute, urlRouter } from '../stores/router.ts' enableWarnings() diff --git a/web/main/index.ts b/web/main/index.ts index c6812abd..11331105 100644 --- a/web/main/index.ts +++ b/web/main/index.ts @@ -1,5 +1,5 @@ -import './environment.js' -import './browser.js' +import './environment.ts' +import './browser.ts' import './index.css' diff --git a/web/package.json b/web/package.json index 6b67f4df..660a8e4f 100644 --- a/web/package.json +++ b/web/package.json @@ -14,12 +14,12 @@ "production": "node --run build && ./scripts/run-image.sh", "size": "node --run build:web && size-limit", "test:unit": "pnpm bnt", - "test:names": "tsx ./scripts/check-names.ts", + "test:names": "../scripts/tsnode ./scripts/check-names.ts", "test:css": "stylelint **/*.css **/*.svelte", "test:build": "node --run build && size-limit", - "build:routes": "tsx ./scripts/export-routes.ts", + "build:routes": "../scripts/tsnode ./scripts/export-routes.ts", "build:visual": "NODE_ENV=test storybook build", - "build:web": "vite build && tsx ./scripts/clean-css.ts && tsx scripts/generate-csp.ts", + "build:web": "vite build && ../scripts/tsnode ./scripts/clean-css.ts && ../scripts/tsnode scripts/generate-csp.ts", "format:stylelint": "stylelint --fix **/*.{css,svelte}", "clean:build": "rm -rf dist" }, @@ -42,7 +42,6 @@ "rollup": "4.20.0", "svelte": "4.2.18", "svelte-preprocess": "6.0.2", - "tsx": "4.16.5", "vite": "5.4.0" }, "devDependencies": { @@ -55,7 +54,7 @@ "@storybook/svelte-vite": "8.2.8", "@storybook/types": "^8.2.8", "@stylistic/stylelint-config": "2.0.0", - "better-node-test": "0.5.1", + "better-node-test": "0.6.0", "browserslist": "4.23.3", "postcss-html": "1.7.0", "postcss-nesting": "13.0.0", diff --git a/web/pages/fast.svelte b/web/pages/fast.svelte index 4a487781..334ce1aa 100644 --- a/web/pages/fast.svelte +++ b/web/pages/fast.svelte @@ -10,7 +10,7 @@ } from '@slowreader/core' import { onMount, tick } from 'svelte' - import { getURL } from '../stores/router.js' + import { getURL } from '../stores/router.ts' import Button from '../ui/button.svelte' import Loader from '../ui/loader.svelte' import PostCard from '../ui/post-card.svelte' diff --git a/web/pages/feeds/add.svelte b/web/pages/feeds/add.svelte index 9f1c7344..1557ddfd 100644 --- a/web/pages/feeds/add.svelte +++ b/web/pages/feeds/add.svelte @@ -14,7 +14,7 @@ previewMessages as t } from '@slowreader/core' - import { getURL } from '../../stores/router.js' + import { getURL } from '../../stores/router.ts' import Button from '../../ui/button.svelte' import CardLink from '../../ui/card-link.svelte' import CardLinks from '../../ui/card-links.svelte' diff --git a/web/pages/feeds/categories.svelte b/web/pages/feeds/categories.svelte index a20ba3de..56871760 100644 --- a/web/pages/feeds/categories.svelte +++ b/web/pages/feeds/categories.svelte @@ -11,7 +11,7 @@ organizeMessages as t } from '@slowreader/core' - import { getURL } from '../../stores/router.js' + import { getURL } from '../../stores/router.ts' import Button from '../../ui/button.svelte' import CardLink from '../../ui/card-link.svelte' import CardLinks from '../../ui/card-links.svelte' diff --git a/web/pages/feeds/export.svelte b/web/pages/feeds/export.svelte index 8ff02e63..6ada9835 100644 --- a/web/pages/feeds/export.svelte +++ b/web/pages/feeds/export.svelte @@ -1,7 +1,7 @@ diff --git a/web/ui/navbar/slow.svelte b/web/ui/navbar/slow.svelte index 2b200b32..ede4f5f6 100644 --- a/web/ui/navbar/slow.svelte +++ b/web/ui/navbar/slow.svelte @@ -7,7 +7,7 @@ commonMessages as t } from '@slowreader/core' - import { getURL } from '../../stores/router.js' + import { getURL } from '../../stores/router.ts' import Loader from '../loader.svelte' import NavbarCategory from './category.svelte' import NavbarItem from './item.svelte' diff --git a/web/ui/two-steps-page.svelte b/web/ui/two-steps-page.svelte index 3df6b65c..7aad2613 100644 --- a/web/ui/two-steps-page.svelte +++ b/web/ui/two-steps-page.svelte @@ -3,7 +3,7 @@ import { backRoute, backToFirstStep } from '@slowreader/core' import { onMount } from 'svelte' - import { getURL } from '../stores/router.js' + import { getURL } from '../stores/router.ts' import Button from './button.svelte' export let title: string