From 437a7125bed3850335f7f52d160048ac9caa88d2 Mon Sep 17 00:00:00 2001 From: Ruslan Lopatin Date: Sun, 17 Sep 2023 14:59:16 +0700 Subject: [PATCH] ES2022 --- package.json | 6 +++--- src/classify-route-capture.spec.ts | 12 ++++++------ src/classify-route-capture.ts | 4 ++-- src/index.ts | 13 ------------- src/matchers/index.ts | 10 ---------- src/matchers/mod.ts | 10 ++++++++++ src/matchers/rcapture-any.spec.ts | 14 ++++++------- src/matchers/rcapture-any.ts | 2 +- src/matchers/rcapture-dirs.spec.ts | 12 ++++++------ src/matchers/rcapture-dirs.ts | 4 ++-- src/matchers/rcapture-entry.spec.ts | 8 ++++---- src/matchers/rcapture-entry.ts | 2 +- src/matchers/rcapture-regexp.spec.ts | 10 +++++----- src/matchers/rcapture-regexp.ts | 8 ++++---- src/matchers/rmatch-any.spec.ts | 10 +++++----- src/matchers/rmatch-any.ts | 4 ++-- src/matchers/rmatch-dir-sep.spec.ts | 12 ++++++------ src/matchers/rmatch-dir-sep.ts | 4 ++-- src/matchers/rmatch-dirs.spec.ts | 12 ++++++------ src/matchers/rmatch-dirs.ts | 4 ++-- src/matchers/rmatch-entry.spec.ts | 8 ++++---- src/matchers/rmatch-entry.ts | 4 ++-- src/matchers/rmatch-name.spec.ts | 6 +++--- src/matchers/rmatch-name.ts | 2 +- src/matchers/rmatch-string.spec.ts | 8 ++++---- src/matchers/rmatch-string.ts | 6 +++--- src/matrix/index.ts | 4 ---- src/matrix/match-matrix-route.spec.ts | 8 ++++---- src/matrix/match-matrix-route.ts | 12 ++++++------ src/matrix/matrix-route-pattern.spec.ts | 8 ++++---- src/matrix/matrix-route-pattern.ts | 16 +++++++-------- src/matrix/matrix-route.spec.ts | 2 +- src/matrix/matrix-route.ts | 10 +++++----- src/matrix/mod.ts | 4 ++++ src/matrix/rmatch-matrix-attr.spec.ts | 12 +++++++----- src/matrix/rmatch-matrix-attr.ts | 4 ++-- src/mod.ts | 12 ++++++++++++ src/path/index.ts | 2 -- src/path/mod.ts | 2 ++ src/path/path-route-pattern.impl.ts | 26 ++++++++++++++----------- src/path/simple-route-pattern.impl.ts | 19 ++++++++++-------- src/path/simple-route-pattern.spec.ts | 8 ++++---- src/path/simple-route-pattern.ts | 13 +++++++------ src/route-captor.ts | 4 ++-- src/route-capture.spec.ts | 22 ++++++++++----------- src/route-capture.ts | 4 ++-- src/route-match.ts | 6 +++--- src/route-matcher.ts | 4 ++-- src/url/index.ts | 5 ----- src/url/match-simple-route.spec.ts | 6 +++--- src/url/match-simple-route.ts | 13 ++++++------- src/url/match-url-route.spec.ts | 8 ++++---- src/url/match-url-route.ts | 12 ++++++------ src/url/mod.ts | 5 +++++ src/url/rmatch-search-param.spec.ts | 8 ++++---- src/url/rmatch-search-param.ts | 4 ++-- src/url/url-route-pattern.impl.ts | 10 +++++----- src/url/url-route-pattern.spec.ts | 8 ++++---- src/url/url-route-pattern.ts | 8 ++++---- src/url/url-route.impl.ts | 2 +- src/url/url-route.spec.ts | 2 +- src/url/url-route.ts | 8 ++++---- tsconfig.json | 7 ++----- typedoc.json | 5 +++-- 64 files changed, 256 insertions(+), 252 deletions(-) delete mode 100644 src/index.ts delete mode 100644 src/matchers/index.ts create mode 100644 src/matchers/mod.ts delete mode 100644 src/matrix/index.ts create mode 100644 src/matrix/mod.ts create mode 100644 src/mod.ts delete mode 100644 src/path/index.ts create mode 100644 src/path/mod.ts delete mode 100644 src/url/index.ts create mode 100644 src/url/mod.ts diff --git a/package.json b/package.json index 515b4ba..7ce41f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hatsy/route-match", - "version": "1.4.2", + "version": "2.0.0-pre.0", "description": "Route matching library", "keywords": [ "path-matcher", @@ -25,8 +25,8 @@ }, "sideEffects": false, "dependencies": { - "@frontmeans/httongue": "^2.4.0", - "@proc7ts/primitives": "^3.0.2" + "httongue": "^3.1.0", + "@proc7ts/primitives": "^4.0.1" }, "devDependencies": { "@jest/globals": "^29.7.0", diff --git a/src/classify-route-capture.spec.ts b/src/classify-route-capture.spec.ts index 6e96298..4990489 100644 --- a/src/classify-route-capture.spec.ts +++ b/src/classify-route-capture.spec.ts @@ -1,12 +1,12 @@ import { beforeEach, describe, expect, it, jest } from '@jest/globals'; import type { Mock } from 'jest-mock'; -import { classifyRouteCapture } from './classify-route-capture'; -import { rcaptureEntry } from './matchers'; -import type { PathRoute } from './path'; -import type { RouteCaptor, RouteCaptorSignatureMap } from './route-captor'; -import { routeMatch } from './route-match'; +import { classifyRouteCapture } from './classify-route-capture.js'; +import type { RouteCaptor, RouteCaptorSignatureMap } from './route-captor.js'; +import { routeMatch } from './route-match.js'; import { RouteMatcher } from './route-matcher.js'; -import { urlRoute } from './url'; +import { rcaptureEntry } from './matchers/rcapture-entry.js'; +import { PathRoute } from './path/path-route.js'; +import { urlRoute } from './url/url-route.js'; describe('classifyRouteCapture', () => { const pattern = [rcaptureEntry('out')]; diff --git a/src/classify-route-capture.ts b/src/classify-route-capture.ts index c07d333..aa9cf2f 100644 --- a/src/classify-route-capture.ts +++ b/src/classify-route-capture.ts @@ -1,6 +1,6 @@ import { noop } from '@proc7ts/primitives'; -import type { PathRoute } from './path'; -import type { RouteCaptor, RouteCaptorSignatureMap } from './route-captor'; +import type { RouteCaptor, RouteCaptorSignatureMap } from './route-captor.js'; +import { PathRoute } from './path/path-route.js'; /** * Route capture classifier. diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index 82d9d1c..0000000 --- a/src/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @packageDocumentation - * @module @hatsy/route-match - */ -export * from './classify-route-capture'; -export * from './matchers'; -export * from './matrix'; -export * from './path'; -export * from './route-captor'; -export * from './route-capture'; -export * from './route-match'; -export * from './route-matcher'; -export * from './url'; diff --git a/src/matchers/index.ts b/src/matchers/index.ts deleted file mode 100644 index 54dbaf0..0000000 --- a/src/matchers/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -export * from './rcapture-any'; -export * from './rcapture-dirs'; -export * from './rcapture-entry'; -export * from './rcapture-regexp'; -export * from './rmatch-any'; -export * from './rmatch-dirs'; -export * from './rmatch-entry'; -export * from './rmatch-dir-sep'; -export * from './rmatch-name'; -export * from './rmatch-string'; diff --git a/src/matchers/mod.ts b/src/matchers/mod.ts new file mode 100644 index 0000000..280f582 --- /dev/null +++ b/src/matchers/mod.ts @@ -0,0 +1,10 @@ +export * from './rcapture-any.js'; +export * from './rcapture-dirs.js'; +export * from './rcapture-entry.js'; +export * from './rcapture-regexp.js'; +export * from './rmatch-any.js'; +export * from './rmatch-dirs.js'; +export * from './rmatch-entry.js'; +export * from './rmatch-dir-sep.js'; +export * from './rmatch-name.js'; +export * from './rmatch-string.js'; diff --git a/src/matchers/rcapture-any.spec.ts b/src/matchers/rcapture-any.spec.ts index 5fdedd7..a548672 100644 --- a/src/matchers/rcapture-any.spec.ts +++ b/src/matchers/rcapture-any.spec.ts @@ -1,12 +1,12 @@ import { beforeEach, describe, expect, it, jest } from '@jest/globals'; -import { RouteCaptor } from '../route-captor'; -import { routeMatch, RoutePattern } from '../route-match'; +import { RouteCaptor } from '../route-captor.js'; +import { routeMatch, RoutePattern } from '../route-match.js'; import { RouteMatcher } from '../route-matcher.js'; -import { URLRoute, urlRoute } from '../url'; -import { rcaptureAny } from './rcapture-any'; -import { rmatchAny } from './rmatch-any'; -import { rmatchDirSep } from './rmatch-dir-sep'; -import { rmatchString } from './rmatch-string'; +import { rcaptureAny } from './rcapture-any.js'; +import { rmatchAny } from './rmatch-any.js'; +import { rmatchDirSep } from './rmatch-dir-sep.js'; +import { rmatchString } from './rmatch-string.js'; +import { URLRoute, urlRoute } from '../url/url-route.js'; describe('rcaptureAny', () => { let captor: RouteCaptor; diff --git a/src/matchers/rcapture-any.ts b/src/matchers/rcapture-any.ts index 5283758..a7a1957 100644 --- a/src/matchers/rcapture-any.ts +++ b/src/matchers/rcapture-any.ts @@ -1,4 +1,4 @@ -import type { RouteMatcher } from '../route-matcher'; +import type { RouteMatcher } from '../route-matcher.js'; /** * Builds a route matcher that matches any part of entry name and optionally captures its name. diff --git a/src/matchers/rcapture-dirs.spec.ts b/src/matchers/rcapture-dirs.spec.ts index 602abf7..cbb11cd 100644 --- a/src/matchers/rcapture-dirs.spec.ts +++ b/src/matchers/rcapture-dirs.spec.ts @@ -1,11 +1,11 @@ import { beforeEach, describe, expect, it, jest } from '@jest/globals'; -import { RouteCaptor } from '../route-captor'; -import { routeMatch } from '../route-match'; +import { RouteCaptor } from '../route-captor.js'; +import { routeMatch } from '../route-match.js'; import { RouteMatcher } from '../route-matcher.js'; -import { URLRoute, urlRoute } from '../url'; -import { rcaptureDirs } from './rcapture-dirs'; -import { rmatchDirSep } from './rmatch-dir-sep'; -import { rmatchName } from './rmatch-name'; +import { rcaptureDirs } from './rcapture-dirs.js'; +import { rmatchDirSep } from './rmatch-dir-sep.js'; +import { rmatchName } from './rmatch-name.js'; +import { URLRoute, urlRoute } from '../url/url-route.js'; describe('rcaptureDirs', () => { let captor: RouteCaptor; diff --git a/src/matchers/rcapture-dirs.ts b/src/matchers/rcapture-dirs.ts index 6408e94..2a511f7 100644 --- a/src/matchers/rcapture-dirs.ts +++ b/src/matchers/rcapture-dirs.ts @@ -1,6 +1,6 @@ import { valueProvider } from '@proc7ts/primitives'; -import { routeMatch } from '../route-match'; -import type { RouteMatcher } from '../route-matcher'; +import { routeMatch } from '../route-match.js'; +import type { RouteMatcher } from '../route-matcher.js'; /** * Builds a route matcher that matches any number of directories, and captures them. diff --git a/src/matchers/rcapture-entry.spec.ts b/src/matchers/rcapture-entry.spec.ts index 8c5ff52..5dabfa2 100644 --- a/src/matchers/rcapture-entry.spec.ts +++ b/src/matchers/rcapture-entry.spec.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it, jest } from '@jest/globals'; -import { RouteCaptor } from '../route-captor'; -import { routeMatch } from '../route-match'; +import { RouteCaptor } from '../route-captor.js'; +import { routeMatch } from '../route-match.js'; import { RouteMatcher } from '../route-matcher.js'; -import { URLRoute, urlRoute } from '../url'; -import { rcaptureEntry } from './rcapture-entry'; +import { rcaptureEntry } from './rcapture-entry.js'; +import { URLRoute, urlRoute } from '../url/url-route.js'; describe('rcaptureEntry', () => { let captor: RouteCaptor; diff --git a/src/matchers/rcapture-entry.ts b/src/matchers/rcapture-entry.ts index 161c6b2..cad216d 100644 --- a/src/matchers/rcapture-entry.ts +++ b/src/matchers/rcapture-entry.ts @@ -1,4 +1,4 @@ -import type { RouteMatcher } from '../route-matcher'; +import type { RouteMatcher } from '../route-matcher.js'; /** * Builds a route matcher that matches any entry and captures its name. diff --git a/src/matchers/rcapture-regexp.spec.ts b/src/matchers/rcapture-regexp.spec.ts index 5c70552..1e8b7f0 100644 --- a/src/matchers/rcapture-regexp.spec.ts +++ b/src/matchers/rcapture-regexp.spec.ts @@ -1,10 +1,10 @@ import { beforeEach, describe, expect, it, jest } from '@jest/globals'; import type { Mock } from 'jest-mock'; -import { routeMatch } from '../route-match'; -import { urlRoute } from '../url'; -import { rcaptureAny } from './rcapture-any'; -import { rcaptureRegExp } from './rcapture-regexp'; -import { rmatchAny } from './rmatch-any'; +import { routeMatch } from '../route-match.js'; +import { urlRoute } from '../url/url-route.js'; +import { rcaptureAny } from './rcapture-any.js'; +import { rcaptureRegExp } from './rcapture-regexp.js'; +import { rmatchAny } from './rmatch-any.js'; describe('rcaptureRegExp', () => { let captor: Mock<(kind: unknown, key: string | number, ...capture: any[]) => void>; diff --git a/src/matchers/rcapture-regexp.ts b/src/matchers/rcapture-regexp.ts index 6baeaf3..455e8ca 100644 --- a/src/matchers/rcapture-regexp.ts +++ b/src/matchers/rcapture-regexp.ts @@ -1,7 +1,7 @@ -import type { RouteCaptor } from '../route-captor'; -import type { RouteMatch } from '../route-match'; -import { routeMatch } from '../route-match'; -import type { RouteMatcher } from '../route-matcher'; +import type { RouteCaptor } from '../route-captor.js'; +import type { RouteMatch } from '../route-match.js'; +import { routeMatch } from '../route-match.js'; +import type { RouteMatcher } from '../route-matcher.js'; const removeGlobalAndStickyFlagsPattern = /[gy]/; diff --git a/src/matchers/rmatch-any.spec.ts b/src/matchers/rmatch-any.spec.ts index a393056..e41706f 100644 --- a/src/matchers/rmatch-any.spec.ts +++ b/src/matchers/rmatch-any.spec.ts @@ -1,10 +1,10 @@ import { beforeEach, describe, expect, it, jest } from '@jest/globals'; -import { RouteCaptor } from '../route-captor'; -import { routeMatch, RoutePattern } from '../route-match'; +import { RouteCaptor } from '../route-captor.js'; +import { routeMatch, RoutePattern } from '../route-match.js'; import { RouteMatcher } from '../route-matcher.js'; -import { URLRoute, urlRoute } from '../url'; -import { rmatchAny } from './rmatch-any'; -import { rmatchDirSep } from './rmatch-dir-sep'; +import { URLRoute, urlRoute } from '../url/url-route.js'; +import { rmatchAny } from './rmatch-any.js'; +import { rmatchDirSep } from './rmatch-dir-sep.js'; describe('rmatchAny', () => { let captor: RouteCaptor; diff --git a/src/matchers/rmatch-any.ts b/src/matchers/rmatch-any.ts index 99ad1c1..b9f1ad0 100644 --- a/src/matchers/rmatch-any.ts +++ b/src/matchers/rmatch-any.ts @@ -1,5 +1,5 @@ -import type { RouteMatcher } from '../route-matcher'; -import { rcaptureAny } from './rcapture-any'; +import type { RouteMatcher } from '../route-matcher.js'; +import { rcaptureAny } from './rcapture-any.js'; /** * Route matcher that matches any part of the entry name. diff --git a/src/matchers/rmatch-dir-sep.spec.ts b/src/matchers/rmatch-dir-sep.spec.ts index 1c9faaa..6361994 100644 --- a/src/matchers/rmatch-dir-sep.spec.ts +++ b/src/matchers/rmatch-dir-sep.spec.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from '@jest/globals'; -import { routeMatch } from '../route-match'; -import { urlRoute } from '../url'; -import { rmatchAny } from './rmatch-any'; -import { rmatchDirSep } from './rmatch-dir-sep'; -import { rmatchName } from './rmatch-name'; -import { rmatchString } from './rmatch-string'; +import { routeMatch } from '../route-match.js'; +import { urlRoute } from '../url/url-route.js'; +import { rmatchAny } from './rmatch-any.js'; +import { rmatchDirSep } from './rmatch-dir-sep.js'; +import { rmatchName } from './rmatch-name.js'; +import { rmatchString } from './rmatch-string.js'; describe('rmatchDirSep', () => { describe('/', () => { diff --git a/src/matchers/rmatch-dir-sep.ts b/src/matchers/rmatch-dir-sep.ts index 03f7594..d9bb272 100644 --- a/src/matchers/rmatch-dir-sep.ts +++ b/src/matchers/rmatch-dir-sep.ts @@ -1,6 +1,6 @@ import { valueProvider } from '@proc7ts/primitives'; -import { routeMatch } from '../route-match'; -import type { RouteMatcher } from '../route-matcher'; +import { routeMatch } from '../route-match.js'; +import type { RouteMatcher } from '../route-matcher.js'; /** * Route matcher that matches directory separator. diff --git a/src/matchers/rmatch-dirs.spec.ts b/src/matchers/rmatch-dirs.spec.ts index b526444..fc9cce1 100644 --- a/src/matchers/rmatch-dirs.spec.ts +++ b/src/matchers/rmatch-dirs.spec.ts @@ -1,11 +1,11 @@ import { beforeEach, describe, expect, it, jest } from '@jest/globals'; -import { RouteCaptor } from '../route-captor'; -import { routeMatch } from '../route-match'; +import { RouteCaptor } from '../route-captor.js'; +import { routeMatch } from '../route-match.js'; import { RouteMatcher } from '../route-matcher.js'; -import { URLRoute, urlRoute } from '../url'; -import { rmatchDirSep } from './rmatch-dir-sep'; -import { rmatchDirs } from './rmatch-dirs'; -import { rmatchName } from './rmatch-name'; +import { URLRoute, urlRoute } from '../url/url-route.js'; +import { rmatchDirSep } from './rmatch-dir-sep.js'; +import { rmatchDirs } from './rmatch-dirs.js'; +import { rmatchName } from './rmatch-name.js'; describe('rmatchDirs', () => { let captor: RouteCaptor; diff --git a/src/matchers/rmatch-dirs.ts b/src/matchers/rmatch-dirs.ts index 058c5b4..320170f 100644 --- a/src/matchers/rmatch-dirs.ts +++ b/src/matchers/rmatch-dirs.ts @@ -1,5 +1,5 @@ -import type { RouteMatcher } from '../route-matcher'; -import { rcaptureDirs } from './rcapture-dirs'; +import type { RouteMatcher } from '../route-matcher.js'; +import { rcaptureDirs } from './rcapture-dirs.js'; /** * Route matcher that matches any number of directories, including none. diff --git a/src/matchers/rmatch-entry.spec.ts b/src/matchers/rmatch-entry.spec.ts index cee7c65..2f3998b 100644 --- a/src/matchers/rmatch-entry.spec.ts +++ b/src/matchers/rmatch-entry.spec.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it, jest } from '@jest/globals'; -import { RouteCaptor } from '../route-captor'; -import { routeMatch } from '../route-match'; +import { RouteCaptor } from '../route-captor.js'; +import { routeMatch } from '../route-match.js'; import { RouteMatcher } from '../route-matcher.js'; -import { URLRoute, urlRoute } from '../url'; -import { rmatchEntry } from './rmatch-entry'; +import { URLRoute, urlRoute } from '../url/url-route.js'; +import { rmatchEntry } from './rmatch-entry.js'; describe('rmatchEntry', () => { let captor: RouteCaptor; diff --git a/src/matchers/rmatch-entry.ts b/src/matchers/rmatch-entry.ts index f2036ec..1c43906 100644 --- a/src/matchers/rmatch-entry.ts +++ b/src/matchers/rmatch-entry.ts @@ -1,5 +1,5 @@ -import type { RouteMatcher } from '../route-matcher'; -import { rcaptureEntry } from './rcapture-entry'; +import type { RouteMatcher } from '../route-matcher.js'; +import { rcaptureEntry } from './rcapture-entry.js'; /** * Route matcher that matches any route entry. diff --git a/src/matchers/rmatch-name.spec.ts b/src/matchers/rmatch-name.spec.ts index c94d7d7..796c9c2 100644 --- a/src/matchers/rmatch-name.spec.ts +++ b/src/matchers/rmatch-name.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from '@jest/globals'; -import { routeMatch } from '../route-match'; -import { urlRoute } from '../url'; -import { rmatchName } from './rmatch-name'; +import { routeMatch } from '../route-match.js'; +import { urlRoute } from '../url/url-route.js'; +import { rmatchName } from './rmatch-name.js'; describe('rmatchName', () => { describe('', () => { diff --git a/src/matchers/rmatch-name.ts b/src/matchers/rmatch-name.ts index 638a5c7..c71ceac 100644 --- a/src/matchers/rmatch-name.ts +++ b/src/matchers/rmatch-name.ts @@ -1,4 +1,4 @@ -import type { RouteMatcher } from '../route-matcher'; +import type { RouteMatcher } from '../route-matcher.js'; /** * Builds a route matcher that matches the entry with the given name. diff --git a/src/matchers/rmatch-string.spec.ts b/src/matchers/rmatch-string.spec.ts index 0ecd7a5..7881352 100644 --- a/src/matchers/rmatch-string.spec.ts +++ b/src/matchers/rmatch-string.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from '@jest/globals'; -import { routeMatch, RoutePattern } from '../route-match'; -import { urlRoute } from '../url'; -import { rmatchAny } from './rmatch-any'; -import { rmatchString } from './rmatch-string'; +import { routeMatch, RoutePattern } from '../route-match.js'; +import { urlRoute } from '../url/url-route.js'; +import { rmatchAny } from './rmatch-any.js'; +import { rmatchString } from './rmatch-string.js'; describe('rmatchString', () => { describe('', () => { diff --git a/src/matchers/rmatch-string.ts b/src/matchers/rmatch-string.ts index a0d98c3..e49d3a5 100644 --- a/src/matchers/rmatch-string.ts +++ b/src/matchers/rmatch-string.ts @@ -1,6 +1,6 @@ -import type { RouteMatch } from '../route-match'; -import { routeMatch } from '../route-match'; -import type { RouteMatcher } from '../route-matcher'; +import type { RouteMatch } from '../route-match.js'; +import { routeMatch } from '../route-match.js'; +import type { RouteMatcher } from '../route-matcher.js'; /** * Builds a route matcher that matches if part of the entry name equals to the expected string. diff --git a/src/matrix/index.ts b/src/matrix/index.ts deleted file mode 100644 index b053930..0000000 --- a/src/matrix/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './match-matrix-route'; -export * from './matrix-route'; -export * from './matrix-route-pattern'; -export * from './rmatch-matrix-attr'; diff --git a/src/matrix/match-matrix-route.spec.ts b/src/matrix/match-matrix-route.spec.ts index bcbbf13..02d32a7 100644 --- a/src/matrix/match-matrix-route.spec.ts +++ b/src/matrix/match-matrix-route.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from '@jest/globals'; -import { rcaptureEntry } from '../matchers'; -import { matchMatrixRoute } from './match-matrix-route'; -import { matrixRoute } from './matrix-route'; -import { rmatchMatrixAttr } from './rmatch-matrix-attr'; +import { matchMatrixRoute } from './match-matrix-route.js'; +import { matrixRoute } from './matrix-route.js'; +import { rmatchMatrixAttr } from './rmatch-matrix-attr.js'; +import { rcaptureEntry } from '../matchers/rcapture-entry.js'; describe('matchMatrixRoute', () => { it('returns `null` when route doe not match', () => { diff --git a/src/matrix/match-matrix-route.ts b/src/matrix/match-matrix-route.ts index d2d113a..dfcc89b 100644 --- a/src/matrix/match-matrix-route.ts +++ b/src/matrix/match-matrix-route.ts @@ -1,9 +1,9 @@ -import { routeCapture } from '../route-capture'; -import type { RoutePattern } from '../route-match'; -import { routeMatch } from '../route-match'; -import { isURL } from '../url/url.impl'; -import { MatrixRoute, matrixRoute } from './matrix-route'; -import { matrixRoutePattern } from './matrix-route-pattern'; +import { routeCapture } from '../route-capture.js'; +import type { RoutePattern } from '../route-match.js'; +import { routeMatch } from '../route-match.js'; +import { isURL } from '../url/url.impl.js'; +import { matrixRoutePattern } from './matrix-route-pattern.js'; +import { MatrixRoute, matrixRoute } from './matrix-route.js'; /** * Checks whether the given {@link MatrixRoute matrix route} matches {@link matrixRoutePattern matrix route pattern}. diff --git a/src/matrix/matrix-route-pattern.spec.ts b/src/matrix/matrix-route-pattern.spec.ts index e83a576..867efac 100644 --- a/src/matrix/matrix-route-pattern.spec.ts +++ b/src/matrix/matrix-route-pattern.spec.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it, jest } from '@jest/globals'; -import { RouteCaptor } from '../route-captor'; -import { routeMatch } from '../route-match'; +import { RouteCaptor } from '../route-captor.js'; +import { routeMatch } from '../route-match.js'; import { RouteMatcher } from '../route-matcher.js'; -import { MatrixRoute, matrixRoute } from './matrix-route'; -import { matrixRoutePattern } from './matrix-route-pattern'; +import { MatrixRoute, matrixRoute } from './matrix-route.js'; +import { matrixRoutePattern } from './matrix-route-pattern.js'; describe('matrixRoutePattern', () => { let captor: RouteCaptor; diff --git a/src/matrix/matrix-route-pattern.ts b/src/matrix/matrix-route-pattern.ts index 14f5844..0cc9136 100644 --- a/src/matrix/matrix-route-pattern.ts +++ b/src/matrix/matrix-route-pattern.ts @@ -1,10 +1,10 @@ -import { decodeURLComponent } from '@frontmeans/httongue'; -import { addPathEntryMatchers } from '../path/path-route-pattern.impl'; -import type { RoutePattern } from '../route-match'; -import type { RouteMatcher } from '../route-matcher'; -import { parseURLRoutePattern } from '../url/url-route-pattern.impl'; -import type { MatrixRoute } from './matrix-route'; -import { rmatchMatrixAttr } from './rmatch-matrix-attr'; +import { decodeURISearchPart } from 'httongue'; +import { addPathEntryMatchers } from '../path/path-route-pattern.impl.js'; +import type { RoutePattern } from '../route-match.js'; +import type { RouteMatcher } from '../route-matcher.js'; +import { parseURLRoutePattern } from '../url/url-route-pattern.impl.js'; +import type { MatrixRoute } from './matrix-route.js'; +import { rmatchMatrixAttr } from './rmatch-matrix-attr.js'; /** * @internal @@ -17,7 +17,7 @@ function addMatrixEntryMatchers(pattern: string, matchers: RouteMatcher { it('has attributes', () => { diff --git a/src/matrix/matrix-route.ts b/src/matrix/matrix-route.ts index 5336f7a..830d8d7 100644 --- a/src/matrix/matrix-route.ts +++ b/src/matrix/matrix-route.ts @@ -1,7 +1,7 @@ -import { decodeURLComponent } from '@frontmeans/httongue'; +import { decodeURISearchPart } from 'httongue'; import { lazyValue } from '@proc7ts/primitives'; -import type { URLEntry, URLRoute } from '../url'; -import { parseURLRoute } from '../url/url-route.impl'; +import type { URLEntry, URLRoute } from '../url/url-route.js'; +import { parseURLRoute } from '../url/url-route.impl.js'; /** * A route representing [matrix URL](https://www.w3.org/DesignIssues/MatrixURIs.html). @@ -38,14 +38,14 @@ function parseMatrixEntry(raw: string): MatrixEntry { for (let i = 1; i < parts.length; ++i) { const [name, value = ''] = parts[i].split('='); - attrs.append(decodeURLComponent(name), decodeURLComponent(value)); + attrs.append(decodeURISearchPart(name), decodeURISearchPart(value)); } return attrs; }); return { - name: decodeURLComponent(parts[0]), + name: decodeURISearchPart(parts[0]), raw: raw, rawName: parts[0], get attrs() { diff --git a/src/matrix/mod.ts b/src/matrix/mod.ts new file mode 100644 index 0000000..6bb00ba --- /dev/null +++ b/src/matrix/mod.ts @@ -0,0 +1,4 @@ +export * from './match-matrix-route.js'; +export * from './matrix-route.js'; +export * from './matrix-route-pattern.js'; +export * from './rmatch-matrix-attr.js'; diff --git a/src/matrix/rmatch-matrix-attr.spec.ts b/src/matrix/rmatch-matrix-attr.spec.ts index a53d0e6..132fdcc 100644 --- a/src/matrix/rmatch-matrix-attr.spec.ts +++ b/src/matrix/rmatch-matrix-attr.spec.ts @@ -1,8 +1,10 @@ import { describe, expect, it } from '@jest/globals'; -import { rmatchDirSep, rmatchEntry, rmatchName } from '../matchers'; -import { routeMatch } from '../route-match'; -import { matrixRoute } from './matrix-route'; -import { rmatchMatrixAttr } from './rmatch-matrix-attr'; +import { routeMatch } from '../route-match.js'; +import { matrixRoute } from './matrix-route.js'; +import { rmatchMatrixAttr } from './rmatch-matrix-attr.js'; +import { rmatchEntry } from '../matchers/rmatch-entry.js'; +import { rmatchDirSep } from '../matchers/rmatch-dir-sep.js'; +import { rmatchName } from '../matchers/rmatch-name.js'; describe('rmatchMatrixAttr', () => { describe('*;param', () => { @@ -62,7 +64,7 @@ describe('rmatchMatrixAttr', () => { routeMatch(matrixRoute(new URL('http://localhost/dir;param=value/')), pattern), ).toBeNull(); }); - it('matches when the rignt entry has attribute', () => { + it('matches when the right entry has attribute', () => { expect( routeMatch(matrixRoute(new URL('http://localhost/dir/;param=value')), pattern), ).toBeTruthy(); diff --git a/src/matrix/rmatch-matrix-attr.ts b/src/matrix/rmatch-matrix-attr.ts index d4662b3..92e912f 100644 --- a/src/matrix/rmatch-matrix-attr.ts +++ b/src/matrix/rmatch-matrix-attr.ts @@ -1,5 +1,5 @@ -import type { RouteMatcher } from '../route-matcher'; -import type { MatrixRoute } from './matrix-route'; +import type { RouteMatcher } from '../route-matcher.js'; +import type { MatrixRoute } from './matrix-route.js'; /** * Builds matrix route matcher that matches a matrix attribute. diff --git a/src/mod.ts b/src/mod.ts new file mode 100644 index 0000000..7558c37 --- /dev/null +++ b/src/mod.ts @@ -0,0 +1,12 @@ +/** + * @module @hatsy/route-match + */ +export * from './classify-route-capture.js'; +export * from './matchers/mod.js'; +export * from './matrix/mod.js'; +export * from './path/mod.js'; +export * from './route-captor.js'; +export * from './route-capture.js'; +export * from './route-match.js'; +export * from './route-matcher.js'; +export * from './url/mod.js'; diff --git a/src/path/index.ts b/src/path/index.ts deleted file mode 100644 index 1de9cfc..0000000 --- a/src/path/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './path-route'; -export * from './simple-route-pattern'; diff --git a/src/path/mod.ts b/src/path/mod.ts new file mode 100644 index 0000000..1f51220 --- /dev/null +++ b/src/path/mod.ts @@ -0,0 +1,2 @@ +export * from './path-route.js'; +export * from './simple-route-pattern.js'; diff --git a/src/path/path-route-pattern.impl.ts b/src/path/path-route-pattern.impl.ts index 97945df..3eb20b0 100644 --- a/src/path/path-route-pattern.impl.ts +++ b/src/path/path-route-pattern.impl.ts @@ -1,7 +1,11 @@ -import { decodeURLComponent } from '@frontmeans/httongue'; -import { rcaptureAny, rcaptureRegExp, rmatchAny, rmatchName, rmatchString } from '../matchers'; -import type { RouteMatcher } from '../route-matcher'; -import { simpleRouteMatcher, simpleRouteWildcard } from './simple-route-pattern.impl'; +import { decodeURISearchPart } from 'httongue'; +import { rcaptureAny } from '../matchers/rcapture-any.js'; +import { rcaptureRegExp } from '../matchers/rcapture-regexp.js'; +import { rmatchAny } from '../matchers/rmatch-any.js'; +import { rmatchName } from '../matchers/rmatch-name.js'; +import { rmatchString } from '../matchers/rmatch-string.js'; +import type { RouteMatcher } from '../route-matcher.js'; +import { simpleRouteMatcher, simpleRouteWildcard } from './simple-route-pattern.impl.js'; /** * @internal @@ -57,7 +61,7 @@ export function addPathEntryMatchers(pattern: string, matchers: RouteMatcher[]): if (patternOffset < i) { // String prefix before matcher. - matchers.push(rmatchString(decodeURLComponent(pattern.substring(patternOffset, i)))); + matchers.push(rmatchString(decodeURISearchPart(pattern.substring(patternOffset, i)))); } matchers.push(matcher); @@ -67,8 +71,8 @@ export function addPathEntryMatchers(pattern: string, matchers: RouteMatcher[]): if (patternOffset < pattern.length) { matchers.push( patternOffset - ? rmatchString(decodeURLComponent(pattern.substr(patternOffset))) // Suffix after last matcher - : rmatchName(decodeURLComponent(pattern)), + ? rmatchString(decodeURISearchPart(pattern.slice(patternOffset))) // Suffix after last matcher + : rmatchName(decodeURISearchPart(pattern)), ); // No matcher recognized } } @@ -90,11 +94,11 @@ export function pathRouteRegExp(spec: string): RouteMatcher | undefined { } const pattern = decodeURI(spec.substring(openParent + 1, closeParent)); - const flags = spec.substring(closeParent + 1).trim(); + const flags = spec.slice(closeParent + 1).trim(); const re = new RegExp(pattern, flags); - const capture = spec.substr(0, openParent).trim(); + const capture = spec.slice(0, openParent).trim(); - return rcaptureRegExp(re, capture ? decodeURLComponent(capture) : undefined); + return rcaptureRegExp(re, capture ? decodeURISearchPart(capture) : undefined); } /** @@ -103,5 +107,5 @@ export function pathRouteRegExp(spec: string): RouteMatcher | undefined { function pathRouteCapture(spec: string): RouteMatcher { spec = spec.trim(); - return spec ? rcaptureAny(decodeURLComponent(spec)) : rmatchAny; + return spec ? rcaptureAny(decodeURISearchPart(spec)) : rmatchAny; } diff --git a/src/path/simple-route-pattern.impl.ts b/src/path/simple-route-pattern.impl.ts index 1e382f9..f822ce5 100644 --- a/src/path/simple-route-pattern.impl.ts +++ b/src/path/simple-route-pattern.impl.ts @@ -1,6 +1,9 @@ -import { decodeURLComponent } from '@frontmeans/httongue'; -import { rcaptureDirs, rcaptureEntry, rmatchDirs, rmatchEntry } from '../matchers'; -import type { RouteMatcher } from '../route-matcher'; +import { decodeURISearchPart } from 'httongue'; +import type { RouteMatcher } from '../route-matcher.js'; +import { rmatchEntry } from '../matchers/rmatch-entry.js'; +import { rmatchDirs } from '../matchers/rmatch-dirs.js'; +import { rcaptureDirs } from '../matchers/rcapture-dirs.js'; +import { rcaptureEntry } from '../matchers/rcapture-entry.js'; /** * @internal @@ -16,7 +19,7 @@ export function simpleRouteMatcher( return rmatchDirs; default: if (pattern.startsWith('{') && pattern.indexOf('}') >= pattern.length - 1) { - const spec = pattern.substr(1, pattern.length - 2); + const spec = pattern.slice(1, pattern.length - 1); return matcherBySpec(spec) || simpleRouteCapture(spec); } @@ -32,11 +35,11 @@ export function simpleRouteWildcard(spec: string): RouteMatcher | undefined { const colonIdx = spec.indexOf(':'); if (colonIdx >= 0) { - const capture = decodeURLComponent(spec.substr(0, colonIdx).trim()); - const arg = spec.substr(colonIdx + 1).trim(); + const capture = decodeURISearchPart(spec.slice(0, colonIdx).trim()); + const arg = spec.slice(colonIdx + 1).trim(); if (arg === '**') { - return capture ? rcaptureDirs(decodeURLComponent(capture)) : rmatchDirs; + return capture ? rcaptureDirs(decodeURISearchPart(capture)) : rmatchDirs; } return capture ? rcaptureEntry(capture) : rmatchEntry; @@ -51,5 +54,5 @@ export function simpleRouteWildcard(spec: string): RouteMatcher | undefined { function simpleRouteCapture(spec: string): RouteMatcher { spec = spec.trim(); - return spec ? rcaptureEntry(decodeURLComponent(spec)) : rmatchEntry; + return spec ? rcaptureEntry(decodeURISearchPart(spec)) : rmatchEntry; } diff --git a/src/path/simple-route-pattern.spec.ts b/src/path/simple-route-pattern.spec.ts index 86e1f49..149f663 100644 --- a/src/path/simple-route-pattern.spec.ts +++ b/src/path/simple-route-pattern.spec.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it, jest } from '@jest/globals'; -import { RouteCaptor } from '../route-captor'; -import { routeMatch } from '../route-match'; +import { RouteCaptor } from '../route-captor.js'; +import { routeMatch } from '../route-match.js'; import { RouteMatcher } from '../route-matcher.js'; -import { URLRoute, urlRoute } from '../url'; -import { simpleRoutePattern } from './simple-route-pattern'; +import { URLRoute, urlRoute } from '../url/url-route.js'; +import { simpleRoutePattern } from './simple-route-pattern.js'; describe('simpleRoutePattern', () => { let captor: RouteCaptor; diff --git a/src/path/simple-route-pattern.ts b/src/path/simple-route-pattern.ts index 41c38d2..cf1727f 100644 --- a/src/path/simple-route-pattern.ts +++ b/src/path/simple-route-pattern.ts @@ -1,8 +1,9 @@ -import { decodeURLComponent } from '@frontmeans/httongue'; -import { rmatchDirSep, rmatchName } from '../matchers'; -import type { RoutePattern } from '../route-match'; -import type { RouteMatcher } from '../route-matcher'; -import { simpleRouteMatcher } from './simple-route-pattern.impl'; +import { decodeURISearchPart } from 'httongue'; +import { rmatchDirSep } from '../matchers/rmatch-dir-sep.js'; +import { rmatchName } from '../matchers/rmatch-name.js'; +import type { RoutePattern } from '../route-match.js'; +import type { RouteMatcher } from '../route-matcher.js'; +import { simpleRouteMatcher } from './simple-route-pattern.impl.js'; /** * Parses simple route pattern. @@ -57,7 +58,7 @@ export function simpleRoutePattern(pattern: string): RoutePattern { if (partMatcher) { result.push(partMatcher); } else { - result.push(rmatchName(decodeURLComponent(part))); + result.push(rmatchName(decodeURISearchPart(part))); } } diff --git a/src/route-captor.ts b/src/route-captor.ts index 2d3d857..014e300 100644 --- a/src/route-captor.ts +++ b/src/route-captor.ts @@ -1,5 +1,5 @@ -import type { PathRoute } from './path'; -import type { RouteMatcher } from './route-matcher'; +import { PathRoute } from './path/path-route.js'; +import type { RouteMatcher } from './route-matcher.js'; /** * Route capture receiver signature. diff --git a/src/route-capture.spec.ts b/src/route-capture.spec.ts index d09931b..d6bff15 100644 --- a/src/route-capture.spec.ts +++ b/src/route-capture.spec.ts @@ -1,16 +1,14 @@ import { describe, expect, it } from '@jest/globals'; -import { - rcaptureDirs, - rcaptureEntry, - rcaptureRegExp, - rmatchDirs, - rmatchDirSep, - rmatchEntry, - rmatchName, -} from './matchers'; -import { routeCapture } from './route-capture'; -import { routeMatch } from './route-match'; -import { urlRoute } from './url'; +import { rcaptureDirs } from './matchers/rcapture-dirs.js'; +import { rcaptureEntry } from './matchers/rcapture-entry.js'; +import { rcaptureRegExp } from './matchers/rcapture-regexp.js'; +import { rmatchDirSep } from './matchers/rmatch-dir-sep.js'; +import { rmatchDirs } from './matchers/rmatch-dirs.js'; +import { rmatchEntry } from './matchers/rmatch-entry.js'; +import { rmatchName } from './matchers/rmatch-name.js'; +import { routeCapture } from './route-capture.js'; +import { routeMatch } from './route-match.js'; +import { urlRoute } from './url/url-route.js'; describe('routeCapture', () => { it('extracts capture under its name', () => { diff --git a/src/route-capture.ts b/src/route-capture.ts index 847272a..cd3ffca 100644 --- a/src/route-capture.ts +++ b/src/route-capture.ts @@ -1,5 +1,5 @@ -import { classifyRouteCapture } from './classify-route-capture'; -import type { RouteMatch } from './route-match'; +import { classifyRouteCapture } from './classify-route-capture.js'; +import type { RouteMatch } from './route-match.js'; /** * Extracts captured fragments from the route match. diff --git a/src/route-match.ts b/src/route-match.ts index 419775f..0ae5bbf 100644 --- a/src/route-match.ts +++ b/src/route-match.ts @@ -1,6 +1,6 @@ -import type { PathRoute } from './path'; -import type { RouteCaptor } from './route-captor'; -import type { RouteMatcher } from './route-matcher'; +import { PathRoute } from './path/path-route.js'; +import type { RouteCaptor } from './route-captor.js'; +import type { RouteMatcher } from './route-matcher.js'; /** * A successful {@link routeMatch match of the route} against {@link RoutePattern pattern}. diff --git a/src/route-matcher.ts b/src/route-matcher.ts index 3d313dd..6fcaff8 100644 --- a/src/route-matcher.ts +++ b/src/route-matcher.ts @@ -1,5 +1,5 @@ -import type { PathRoute } from './path'; -import type { RouteMatch, RoutePattern } from './route-match'; +import { PathRoute } from './path/path-route.js'; +import type { RouteMatch, RoutePattern } from './route-match.js'; /** * Route fragment matcher. diff --git a/src/url/index.ts b/src/url/index.ts deleted file mode 100644 index f8a59e2..0000000 --- a/src/url/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './match-simple-route'; -export * from './match-url-route'; -export * from './rmatch-search-param'; -export * from './url-route'; -export * from './url-route-pattern'; diff --git a/src/url/match-simple-route.spec.ts b/src/url/match-simple-route.spec.ts index cf6801e..22d2b74 100644 --- a/src/url/match-simple-route.spec.ts +++ b/src/url/match-simple-route.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from '@jest/globals'; -import { rcaptureEntry } from '../matchers'; -import { matchSimpleRoute } from './match-simple-route'; -import { urlRoute } from './url-route'; +import { matchSimpleRoute } from './match-simple-route.js'; +import { urlRoute } from './url-route.js'; +import { rcaptureEntry } from '../matchers/rcapture-entry.js'; describe('matchSimpleRoute', () => { it('returns `null` when route doe not match', () => { diff --git a/src/url/match-simple-route.ts b/src/url/match-simple-route.ts index b84ee86..b5874d5 100644 --- a/src/url/match-simple-route.ts +++ b/src/url/match-simple-route.ts @@ -1,10 +1,9 @@ -import type { PathRoute } from '../path'; -import { simpleRoutePattern } from '../path'; -import { routeCapture } from '../route-capture'; -import type { RoutePattern } from '../route-match'; -import { routeMatch } from '../route-match'; -import { urlRoute } from './url-route'; -import { isURL } from './url.impl'; +import { PathRoute } from '../path/path-route.js'; +import { simpleRoutePattern } from '../path/simple-route-pattern.js'; +import { routeCapture } from '../route-capture.js'; +import { RoutePattern, routeMatch } from '../route-match.js'; +import { urlRoute } from './url-route.js'; +import { isURL } from './url.impl.js'; /** * Checks whether the given route matches {@link simpleRoutePattern simple pattern}. diff --git a/src/url/match-url-route.spec.ts b/src/url/match-url-route.spec.ts index 945396a..79a6dc5 100644 --- a/src/url/match-url-route.spec.ts +++ b/src/url/match-url-route.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from '@jest/globals'; -import { rcaptureEntry } from '../matchers'; -import { matchURLRoute } from './match-url-route'; -import { rmatchSearchParam } from './rmatch-search-param'; -import { urlRoute } from './url-route'; +import { matchURLRoute } from './match-url-route.js'; +import { rmatchSearchParam } from './rmatch-search-param.js'; +import { urlRoute } from './url-route.js'; +import { rcaptureEntry } from '../matchers/rcapture-entry.js'; describe('matchURLRoute', () => { it('returns `null` when route doe not match', () => { diff --git a/src/url/match-url-route.ts b/src/url/match-url-route.ts index 0802099..6927604 100644 --- a/src/url/match-url-route.ts +++ b/src/url/match-url-route.ts @@ -1,9 +1,9 @@ -import { routeCapture } from '../route-capture'; -import type { RoutePattern } from '../route-match'; -import { routeMatch } from '../route-match'; -import { URLRoute, urlRoute } from './url-route'; -import { urlRoutePattern } from './url-route-pattern'; -import { isURL } from './url.impl'; +import { routeCapture } from '../route-capture.js'; +import type { RoutePattern } from '../route-match.js'; +import { routeMatch } from '../route-match.js'; +import { URLRoute, urlRoute } from './url-route.js'; +import { urlRoutePattern } from './url-route-pattern.js'; +import { isURL } from './url.impl.js'; /** * Checks whether the given route matches {@link urlRoutePattern URL pattern}. diff --git a/src/url/mod.ts b/src/url/mod.ts new file mode 100644 index 0000000..d572ee5 --- /dev/null +++ b/src/url/mod.ts @@ -0,0 +1,5 @@ +export * from './match-simple-route.js'; +export * from './match-url-route.js'; +export * from './rmatch-search-param.js'; +export * from './url-route.js'; +export * from './url-route-pattern.js'; diff --git a/src/url/rmatch-search-param.spec.ts b/src/url/rmatch-search-param.spec.ts index 5afc874..aa3f6a4 100644 --- a/src/url/rmatch-search-param.spec.ts +++ b/src/url/rmatch-search-param.spec.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from '@jest/globals'; -import { rmatchName } from '../matchers'; -import { routeMatch } from '../route-match'; -import { rmatchSearchParam } from './rmatch-search-param'; -import { urlRoute } from './url-route'; +import { routeMatch } from '../route-match.js'; +import { rmatchSearchParam } from './rmatch-search-param.js'; +import { urlRoute } from './url-route.js'; +import { rmatchName } from '../matchers/rmatch-name.js'; describe('rmatchSearchParam', () => { describe('?param', () => { diff --git a/src/url/rmatch-search-param.ts b/src/url/rmatch-search-param.ts index f8f5e0b..763c3cf 100644 --- a/src/url/rmatch-search-param.ts +++ b/src/url/rmatch-search-param.ts @@ -1,5 +1,5 @@ -import type { RouteMatcher } from '../route-matcher'; -import type { URLRoute } from './url-route'; +import type { RouteMatcher } from '../route-matcher.js'; +import type { URLRoute } from './url-route.js'; /** * Builds URL route matcher that matches URL search parameter. diff --git a/src/url/url-route-pattern.impl.ts b/src/url/url-route-pattern.impl.ts index ff8fb74..f147a0b 100644 --- a/src/url/url-route-pattern.impl.ts +++ b/src/url/url-route-pattern.impl.ts @@ -1,8 +1,8 @@ -import { rmatchDirSep } from '../matchers'; -import type { RoutePattern } from '../route-match'; -import type { RouteMatcher } from '../route-matcher'; -import { rmatchSearchParam } from './rmatch-search-param'; -import type { URLRoute } from './url-route'; +import { rmatchDirSep } from '../matchers/rmatch-dir-sep.js'; +import type { RoutePattern } from '../route-match.js'; +import type { RouteMatcher } from '../route-matcher.js'; +import { rmatchSearchParam } from './rmatch-search-param.js'; +import type { URLRoute } from './url-route.js'; /** * @internal diff --git a/src/url/url-route-pattern.spec.ts b/src/url/url-route-pattern.spec.ts index 95a7398..e074e71 100644 --- a/src/url/url-route-pattern.spec.ts +++ b/src/url/url-route-pattern.spec.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it, jest } from '@jest/globals'; import { Mock } from 'jest-mock'; -import { RouteCaptor } from '../route-captor'; -import { routeMatch } from '../route-match'; -import { URLRoute, urlRoute } from './url-route'; -import { urlRoutePattern } from './url-route-pattern'; +import { RouteCaptor } from '../route-captor.js'; +import { routeMatch } from '../route-match.js'; +import { URLRoute, urlRoute } from './url-route.js'; +import { urlRoutePattern } from './url-route-pattern.js'; describe('urlRoutePattern', () => { let captor: RouteCaptor & Mock<(...args: any[]) => void>; diff --git a/src/url/url-route-pattern.ts b/src/url/url-route-pattern.ts index 5c4888a..674bffe 100644 --- a/src/url/url-route-pattern.ts +++ b/src/url/url-route-pattern.ts @@ -1,7 +1,7 @@ -import { addPathEntryMatchers } from '../path/path-route-pattern.impl'; -import type { RoutePattern } from '../route-match'; -import type { URLRoute } from './url-route'; -import { parseURLRoutePattern } from './url-route-pattern.impl'; +import { addPathEntryMatchers } from '../path/path-route-pattern.impl.js'; +import type { RoutePattern } from '../route-match.js'; +import type { URLRoute } from './url-route.js'; +import { parseURLRoutePattern } from './url-route-pattern.impl.js'; /** * Parses URL route pattern. diff --git a/src/url/url-route.impl.ts b/src/url/url-route.impl.ts index 99f7ae0..beda06c 100644 --- a/src/url/url-route.impl.ts +++ b/src/url/url-route.impl.ts @@ -1,4 +1,4 @@ -import type { URLEntry, URLRoute } from './url-route'; +import type { URLEntry, URLRoute } from './url-route.js'; /** * @internal diff --git a/src/url/url-route.spec.ts b/src/url/url-route.spec.ts index 99f5436..c0cda28 100644 --- a/src/url/url-route.spec.ts +++ b/src/url/url-route.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import { urlRoute } from './url-route'; +import { urlRoute } from './url-route.js'; describe('urlRoute', () => { it('constructs URL relative to `route:` base', () => { diff --git a/src/url/url-route.ts b/src/url/url-route.ts index 3d47cf4..2d2ac9e 100644 --- a/src/url/url-route.ts +++ b/src/url/url-route.ts @@ -1,6 +1,6 @@ -import { decodeURLComponent } from '@frontmeans/httongue'; -import type { PathEntry, PathRoute } from '../path'; -import { parseURLRoute } from './url-route.impl'; +import { decodeURISearchPart } from 'httongue'; +import { PathEntry, PathRoute } from '../path/path-route.js'; +import { parseURLRoute } from './url-route.impl.js'; /** * A route representing an URL. @@ -71,7 +71,7 @@ export interface URLEntry extends PathEntry { * @internal */ function parseURLEntry(raw: string): URLEntry { - return { name: decodeURLComponent(raw), raw, rawName: raw }; + return { name: decodeURISearchPart(raw), raw, rawName: raw }; } /** diff --git a/tsconfig.json b/tsconfig.json index 2386314..730a28d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,8 @@ { "extends": "@run-z/project-config/tsconfig.lib.json", "compilerOptions": { - "lib": ["DOM", "ES2019"], - "module": "ES2015", - "moduleResolution": "Node", - "outDir": "target/js", - "target": "ES2019" + "lib": ["DOM", "ES2022"], + "outDir": "target/js" }, "include": ["src/**/*"] } diff --git a/typedoc.json b/typedoc.json index 875fae3..c89a63b 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,5 +1,6 @@ { - "entryPoints": ["src/index.ts"], + "entryPoints": ["src/mod.ts"], "name": "Route Match", - "out": "./target/typedoc" + "out": "./target/typedoc", + "sort": ["static-first", "visibility", "enum-value-ascending", "alphabetical", "kind"] }