From 8a5d64da6b270b2c04b005e2c69b08a651077d2d Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Fri, 1 Nov 2024 10:58:26 +0200 Subject: [PATCH 1/6] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 5498a759..59d0d1db 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,7 @@ # Vaadin Router -[Demo](https://vaadin.github.io/router/vaadin-router/demo) -ยท -[API documentation](https://vaadin.github.io/router/vaadin-router/) +[API documentation](https://vaadin.github.io/router/) Vaadin Router is a small and powerful client-side router JS library. It uses the widely adopted express.js syntax for routes (`/users/:id`) to map URLs to Web Component views. All features one might expect from a modern router are supported: async route resolution, animated transitions, navigation guards, redirects, and more. It is framework-agnostic and works equally well with all Web Components regardless of how they are created (Polymer / SkateJS / Stencil / Angular / Vue / etc). From e2e579cd681410713fe11e3502c120da7ca67169 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:13:51 +0200 Subject: [PATCH 2/6] chore(deps-dev): bump stylelint from 16.9.0 to 16.10.0 (#894) Bumps [stylelint](https://github.com/stylelint/stylelint) from 16.9.0 to 16.10.0. - [Release notes](https://github.com/stylelint/stylelint/releases) - [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md) - [Commits](https://github.com/stylelint/stylelint/compare/16.9.0...16.10.0) --- updated-dependencies: - dependency-name: stylelint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 87 +++++++++++++++++------------------------------ package.json | 2 +- 2 files changed, 32 insertions(+), 57 deletions(-) diff --git a/package-lock.json b/package-lock.json index ee90111b..dac3a36c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "prettier": "^3.1.0", "sinon": "^19.0.2", "sinon-chai": "^4.0.0", - "stylelint": "^16.9.0", + "stylelint": "^16.10.0", "tsx": "^4.19.1", "typedoc": "^0.26.8", "typedoc-plugin-missing-exports": "^3.0.0", @@ -3469,23 +3469,21 @@ } }, "node_modules/css-functions-list": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.2.2.tgz", - "integrity": "sha512-c+N0v6wbKVxTu5gOBBFkr9BEdBWaqqjQeiJ8QvSRIJOf+UxlJh930m8e6/WNeODIK0mYLFkoONrnj16i2EcvfQ==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.2.3.tgz", + "integrity": "sha512-IQOkD3hbR5KrN93MtcYuad6YPuTSUhntLHDuLEbFWE+ff2/XSZNdZG+LcbbIW5AXKg/WFIfYItIzVoHngHXZzA==", "dev": true, - "license": "MIT", "engines": { "node": ">=12 || >=16" } }, "node_modules/css-tree": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", - "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.0.0.tgz", + "integrity": "sha512-o88DVQ6GzsABn1+6+zo2ct801dBO5OASVyxbbvA2W20ue2puSh/VOuqUj90eUeMSX/xqGqBmOKiRQN7tJOuBXw==", "dev": true, - "license": "MIT", "dependencies": { - "mdn-data": "2.0.30", + "mdn-data": "2.10.0", "source-map-js": "^1.0.1" }, "engines": { @@ -7147,11 +7145,10 @@ } }, "node_modules/mdn-data": { - "version": "2.0.30", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", - "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", - "dev": true, - "license": "CC0-1.0" + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.10.0.tgz", + "integrity": "sha512-qq7C3EtK3yJXMwz1zAab65pjl+UhohqMOctTgcqjLOWABqmwj+me02LSsCuEUxnst9X1lCBpoE0WArGKgdGDzw==", + "dev": true }, "node_modules/mdurl": { "version": "2.0.0", @@ -9638,9 +9635,9 @@ } }, "node_modules/stylelint": { - "version": "16.9.0", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.9.0.tgz", - "integrity": "sha512-31Nm3WjxGOBGpQqF43o3wO9L5AC36TPIe6030Lnm13H3vDMTcS21DrLh69bMX+DBilKqMMVLian4iG6ybBoNRQ==", + "version": "16.10.0", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.10.0.tgz", + "integrity": "sha512-z/8X2rZ52dt2c0stVwI9QL2AFJhLhbPkyfpDFcizs200V/g7v+UYY6SNcB9hKOLcDDX/yGLDsY/pX08sLkz9xQ==", "dev": true, "funding": [ { @@ -9652,7 +9649,6 @@ "url": "https://github.com/sponsors/stylelint" } ], - "license": "MIT", "dependencies": { "@csstools/css-parser-algorithms": "^3.0.1", "@csstools/css-tokenizer": "^3.0.1", @@ -9662,17 +9658,17 @@ "balanced-match": "^2.0.0", "colord": "^2.9.3", "cosmiconfig": "^9.0.0", - "css-functions-list": "^3.2.2", - "css-tree": "^2.3.1", - "debug": "^4.3.6", + "css-functions-list": "^3.2.3", + "css-tree": "^3.0.0", + "debug": "^4.3.7", "fast-glob": "^3.3.2", "fastest-levenshtein": "^1.0.16", - "file-entry-cache": "^9.0.0", + "file-entry-cache": "^9.1.0", "global-modules": "^2.0.0", "globby": "^11.1.0", "globjoin": "^0.1.4", "html-tags": "^3.3.1", - "ignore": "^5.3.2", + "ignore": "^6.0.2", "imurmurhash": "^0.1.4", "is-plain-object": "^5.0.0", "known-css-properties": "^0.34.0", @@ -9681,14 +9677,13 @@ "micromatch": "^4.0.8", "normalize-path": "^3.0.0", "picocolors": "^1.0.1", - "postcss": "^8.4.41", + "postcss": "^8.4.47", "postcss-resolve-nested-selector": "^0.1.6", - "postcss-safe-parser": "^7.0.0", + "postcss-safe-parser": "^7.0.1", "postcss-selector-parser": "^6.1.2", "postcss-value-parser": "^4.2.0", "resolve-from": "^5.0.0", "string-width": "^4.2.3", - "strip-ansi": "^7.1.0", "supports-hyperlinks": "^3.1.0", "svg-tags": "^1.0.0", "table": "^6.8.2", @@ -9788,6 +9783,15 @@ "node": ">=6" } }, + "node_modules/stylelint/node_modules/ignore": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-6.0.2.tgz", + "integrity": "sha512-InwqeHHN2XpumIkMvpl/DCJVrAHgCsG5+cn1XlnLWGwtZBm8QJfSusItfrwx81CTp5agNZqpKU2J/ccC5nGT4A==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/stylelint/node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -9843,35 +9847,6 @@ "node": ">=8" } }, - "node_modules/stylelint/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/stylelint/node_modules/strip-ansi/node_modules/ansi-regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", - "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, "node_modules/stylelint/node_modules/which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", diff --git a/package.json b/package.json index 429aec39..36f58393 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "prettier": "^3.1.0", "sinon": "^19.0.2", "sinon-chai": "^4.0.0", - "stylelint": "^16.9.0", + "stylelint": "^16.10.0", "tsx": "^4.19.1", "typedoc": "^0.26.8", "typedoc-plugin-missing-exports": "^3.0.0", From 7a889a9a6c6075ba9588b4211a8cffee0242ea8d Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Mon, 4 Nov 2024 10:36:18 +0200 Subject: [PATCH 3/6] fix: add route v1 compatibility type definitions (#895) --- src/index.ts | 1 + src/v1-compat.d.ts | 84 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 src/v1-compat.d.ts diff --git a/src/index.ts b/src/index.ts index d57c8822..395c77ec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ export * from './router.js'; export type * from './types.js'; +export type * from './v1-compat.js'; export { processNewChildren, amend, diff --git a/src/v1-compat.d.ts b/src/v1-compat.d.ts new file mode 100644 index 00000000..496d95c3 --- /dev/null +++ b/src/v1-compat.d.ts @@ -0,0 +1,84 @@ +/* eslint-disable max-classes-per-file */ + +import type { MaybePromise } from './resolver/types'; +import type { RouteContext, Route, ActionResult, ChildrenCallback, WebComponentInterface } from './types'; + +/** + * Action result describing an HTML element to render. + * + * @deprecated Use `HTMLElement`. + */ +export type ComponentResult = HTMLElement; + +/** + * Route resolution context object, see {@link RouteContext}. + * + * @deprecated Use {@link RouteContext}. + */ +export type Context = RouteContext; + +/** + * Route action callback function, see {@link Route.action}. + * + * @deprecated Use `NonNullable`. + */ +export type ActionFn = ( + this: Route, + context: RouteContext, + commands: Commands, +) => MaybePromise; + +/** + * Route children callback function, see {@link ChildrenCallback}. + * + * @deprecated Use {@link ChildrenCallback}. + */ +export type ChildrenFn = ChildrenCallback; + +/** + * Web component route interface with {@link onBeforeEnter} callback. + * + * @deprecated Use {@link WebComponentInterface}. + */ +export interface BeforeEnterObserver { + /** + * See {@link WebComponentInterface.onBeforeEnter} + */ + onBeforeEnter: NonNullable; +} + +/** + * Web component route interface with {@link onBeforeLeave} callback. + * + * @deprecated Use {@link WebComponentInterface}. + */ +export interface BeforeLeaveObserver { + /** + * See {@link WebComponentInterface.onBeforeLeave} + */ + onBeforeLeave: NonNullable; +} + +/** + * Web component route interface with {@link onAfterEnter} callback. + * + * @deprecated Use {@link WebComponentInterface}. + */ +export interface AfterEnterObserver { + /** + * See {@link WebComponentInterface.onAfterEnter} + */ + onAfterEnter: NonNullable; +} + +/** + * Web component route interface with {@link onAfterLeave} callback. + * + * @deprecated Use {@link WebComponentInterface}. + */ +export interface AfterLeaveObserver { + /** + * See {@link WebComponentInterface.onAfterLeave} + */ + onAfterLeave: NonNullable; +} From 23e485ad753ef8a954cfa7f8c85dfc6bd05ec131 Mon Sep 17 00:00:00 2001 From: Vlad Rindevich Date: Mon, 4 Nov 2024 10:57:16 +0200 Subject: [PATCH 4/6] chore: rename `d.ts` files to `t.ts` to resolve `skipLibCheck` issue (#892) * chore: move to t.ts files to address skipLibCheck issue * chore: rename global file as well * refactor: update latest code --- scripts/build.ts | 2 +- src/index.ts | 4 ++-- src/{mod.d.ts => mod.t.ts} | 0 src/resolver/generateUrls.ts | 2 +- src/resolver/matchPath.ts | 2 +- src/resolver/matchRoute.ts | 2 +- src/resolver/resolveRoute.ts | 2 +- src/resolver/resolver.ts | 2 +- src/resolver/{types.d.ts => types.t.ts} | 0 src/resolver/utils.ts | 2 +- src/router.ts | 2 +- src/triggers/click.ts | 2 +- src/triggers/navigation.ts | 2 +- src/triggers/popstate.ts | 2 +- src/{types.d.ts => types.t.ts} | 2 +- src/utils.ts | 2 +- src/{v1-compat.d.ts => v1-compat.t.ts} | 11 +++++++++-- test/resolver/generateUrls.spec.ts | 2 +- test/resolver/matchRoute.spec.ts | 2 +- test/resolver/resolver.spec.ts | 2 +- test/router/lifecycle-events.spec.ts | 4 ++-- test/router/parent-layout.spec.ts | 2 +- test/router/router.spec.ts | 2 +- 23 files changed, 31 insertions(+), 24 deletions(-) rename src/{mod.d.ts => mod.t.ts} (100%) rename src/resolver/{types.d.ts => types.t.ts} (100%) rename src/{types.d.ts => types.t.ts} (99%) rename src/{v1-compat.d.ts => v1-compat.t.ts} (91%) diff --git a/scripts/build.ts b/scripts/build.ts index eb2cbd9c..d8a54c98 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -9,7 +9,7 @@ const root = new URL('../', import.meta.url); const [packageJson, entryPoints] = await Promise.all([ readFile(new URL('package.json', root), 'utf8').then(JSON.parse) as Promise, - glob('src/**/*.{ts,tsx}', { ignore: ['**/*.d.ts'] }), + glob('src/**/*.{ts,tsx}', { ignore: ['**/*.t.ts'] }), ]); await build({ diff --git a/src/index.ts b/src/index.ts index 395c77ec..e228bdd3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ export * from './router.js'; -export type * from './types.js'; -export type * from './v1-compat.js'; +export type * from './types.t.js'; +export type * from './v1-compat.t.js'; export { processNewChildren, amend, diff --git a/src/mod.d.ts b/src/mod.t.ts similarity index 100% rename from src/mod.d.ts rename to src/mod.t.ts diff --git a/src/resolver/generateUrls.ts b/src/resolver/generateUrls.ts index 31fe7578..e492cd50 100644 --- a/src/resolver/generateUrls.ts +++ b/src/resolver/generateUrls.ts @@ -10,7 +10,7 @@ import { parse, type ParseOptions, type Token, tokensToFunction, type TokensToFunctionOptions } from 'path-to-regexp'; import type { EmptyObject, Writable } from 'type-fest'; import Resolver from './resolver.js'; -import type { ChildrenCallback, IndexedParams, Params, Route } from './types.js'; +import type { ChildrenCallback, IndexedParams, Params, Route } from './types.t.js'; import { getRoutePath, isString } from './utils.js'; export type UrlParams = Readonly | number | string>>; diff --git a/src/resolver/matchPath.ts b/src/resolver/matchPath.ts index 049a5eab..1783fabb 100644 --- a/src/resolver/matchPath.ts +++ b/src/resolver/matchPath.ts @@ -9,7 +9,7 @@ import { type Key, pathToRegexp } from 'path-to-regexp'; import type { Writable } from 'type-fest'; -import type { IndexedParams } from '../types.js'; +import type { IndexedParams } from '../types.t.js'; import { resolvePath } from './utils.js'; export interface RegExpExecOptArray extends ReadonlyArray { diff --git a/src/resolver/matchRoute.ts b/src/resolver/matchRoute.ts index 5c0092d8..2d62e155 100644 --- a/src/resolver/matchRoute.ts +++ b/src/resolver/matchRoute.ts @@ -9,7 +9,7 @@ import type { Key } from 'path-to-regexp'; import matchPath, { type Match } from './matchPath.js'; -import type { IndexedParams, Route } from './types.js'; +import type { IndexedParams, Route } from './types.t.js'; import { getRoutePath, unwrapChildren } from './utils.js'; export type MatchWithRoute = Match & diff --git a/src/resolver/resolveRoute.ts b/src/resolver/resolveRoute.ts index 9e8b43a2..4aa4e457 100644 --- a/src/resolver/resolveRoute.ts +++ b/src/resolver/resolveRoute.ts @@ -6,7 +6,7 @@ * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ -import type { ActionResult, MaybePromise, RouteContext } from './types.js'; +import type { ActionResult, MaybePromise, RouteContext } from './types.t.js'; import { isFunction } from './utils.js'; /** @internal */ diff --git a/src/resolver/resolver.ts b/src/resolver/resolver.ts index a9b73a15..2ca4fdb3 100644 --- a/src/resolver/resolver.ts +++ b/src/resolver/resolver.ts @@ -9,7 +9,7 @@ import type { EmptyObject } from 'type-fest'; import matchRoute, { type MatchWithRoute } from './matchRoute.js'; import defaultResolveRoute from './resolveRoute.js'; -import type { ActionResult, Route, Match, MaybePromise, ResolveContext, RouteContext } from './types.js'; +import type { ActionResult, Route, Match, MaybePromise, ResolveContext, RouteContext } from './types.t.js'; import { getNotFoundError, getRoutePath, isString, NotFoundError, notFoundResult, toArray } from './utils.js'; function isDescendantRoute( diff --git a/src/resolver/types.d.ts b/src/resolver/types.t.ts similarity index 100% rename from src/resolver/types.d.ts rename to src/resolver/types.t.ts diff --git a/src/resolver/utils.ts b/src/resolver/utils.ts index d8ba33aa..88ef7dd5 100644 --- a/src/resolver/utils.ts +++ b/src/resolver/utils.ts @@ -1,4 +1,4 @@ -import type { ChildrenCallback, Route, RouteContext } from './types.js'; +import type { ChildrenCallback, Route, RouteContext } from './types.t.js'; /** * {@inheritDoc "".NotFoundError} diff --git a/src/router.ts b/src/router.ts index 600f24bb..b6f1399f 100644 --- a/src/router.ts +++ b/src/router.ts @@ -29,7 +29,7 @@ import type { RouterOptions, ActionValue, NextResult, -} from './types.js'; +} from './types.t.js'; import { amend, copyContextWithoutNext, diff --git a/src/triggers/click.ts b/src/triggers/click.ts index 4ecff46d..2d099ab4 100644 --- a/src/triggers/click.ts +++ b/src/triggers/click.ts @@ -1,4 +1,4 @@ -import type { NavigationTrigger } from '../types.js'; +import type { NavigationTrigger } from '../types.t.js'; import { fireRouterEvent } from '../utils.js'; /* istanbul ignore next: coverage is calculated in Chrome, this code is for IE */ diff --git a/src/triggers/navigation.ts b/src/triggers/navigation.ts index a5cec24d..0e98522c 100644 --- a/src/triggers/navigation.ts +++ b/src/triggers/navigation.ts @@ -1,4 +1,4 @@ -import type { NavigationTrigger } from '../types.js'; +import type { NavigationTrigger } from '../types.t.js'; import CLICK from './click.js'; import POPSTATE from './popstate.js'; diff --git a/src/triggers/popstate.ts b/src/triggers/popstate.ts index 08caf15c..32643266 100644 --- a/src/triggers/popstate.ts +++ b/src/triggers/popstate.ts @@ -1,4 +1,4 @@ -import type { NavigationTrigger } from '../types.js'; +import type { NavigationTrigger } from '../types.t.js'; import { fireRouterEvent } from '../utils.js'; function vaadinRouterGlobalPopstateHandler(event: PopStateEvent) { diff --git a/src/types.d.ts b/src/types.t.ts similarity index 99% rename from src/types.d.ts rename to src/types.t.ts index 2ce30a08..b8a6c25c 100644 --- a/src/types.d.ts +++ b/src/types.t.ts @@ -12,7 +12,7 @@ import type { PrimitiveParamValue, Route as _Route, RouteContext as _RouteContext, -} from './resolver/types.js'; +} from './resolver/types.t.js'; import type { Router } from './router.js'; export type { ResolutionError, IndexedParams, Params, ParamValue, PrimitiveParamValue }; diff --git a/src/utils.ts b/src/utils.ts index cf52ca27..3b7b6af5 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -11,7 +11,7 @@ import type { RouteContext, RouterLocation, WebComponentInterface, -} from './types.js'; +} from './types.t.js'; /** @internal */ export function ensureRoute(route?: Route): void { diff --git a/src/v1-compat.d.ts b/src/v1-compat.t.ts similarity index 91% rename from src/v1-compat.d.ts rename to src/v1-compat.t.ts index 496d95c3..aa04528e 100644 --- a/src/v1-compat.d.ts +++ b/src/v1-compat.t.ts @@ -1,7 +1,14 @@ /* eslint-disable max-classes-per-file */ -import type { MaybePromise } from './resolver/types'; -import type { RouteContext, Route, ActionResult, ChildrenCallback, WebComponentInterface } from './types'; +import type { MaybePromise } from './resolver/types.t.js'; +import type { + Commands, + RouteContext, + Route, + ActionResult, + ChildrenCallback, + WebComponentInterface, +} from './types.t.js'; /** * Action result describing an HTML element to render. diff --git a/test/resolver/generateUrls.spec.ts b/test/resolver/generateUrls.spec.ts index b7cb3b94..f093bd4a 100644 --- a/test/resolver/generateUrls.spec.ts +++ b/test/resolver/generateUrls.spec.ts @@ -14,7 +14,7 @@ import sinonChai from 'sinon-chai'; import generateUrls, { type StringifyQueryParams } from '../../src/resolver/generateUrls.js'; import Resolver from '../../src/resolver/resolver.js'; import '../setup.js'; -import type { Route } from '../../src/resolver/types.js'; +import type { Route } from '../../src/resolver/types.t.js'; use(chaiDom); use(sinonChai); diff --git a/test/resolver/matchRoute.spec.ts b/test/resolver/matchRoute.spec.ts index 1f24bd4b..cb712687 100644 --- a/test/resolver/matchRoute.spec.ts +++ b/test/resolver/matchRoute.spec.ts @@ -11,7 +11,7 @@ import chaiDom from 'chai-dom'; import sinonChai from 'sinon-chai'; import matchRoute from '../../src/resolver/matchRoute.js'; import '../setup.js'; -import type { Route } from '../../src/resolver/types.js'; +import type { Route } from '../../src/resolver/types.t.js'; use(chaiDom); use(sinonChai); diff --git a/test/resolver/resolver.spec.ts b/test/resolver/resolver.spec.ts index ee2e7455..a62f9250 100644 --- a/test/resolver/resolver.spec.ts +++ b/test/resolver/resolver.spec.ts @@ -15,7 +15,7 @@ import sinonChai from 'sinon-chai'; import type { EmptyObject } from 'type-fest'; import Resolver, { ResolutionError } from '../../src/resolver/resolver.js'; import '../setup.js'; -import type { Route, RouteContext } from '../../src/resolver/types.js'; +import type { Route, RouteContext } from '../../src/resolver/types.t.js'; use(chaiDom); use(sinonChai); diff --git a/test/router/lifecycle-events.spec.ts b/test/router/lifecycle-events.spec.ts index 5ca222e9..407e9cc7 100644 --- a/test/router/lifecycle-events.spec.ts +++ b/test/router/lifecycle-events.spec.ts @@ -3,7 +3,7 @@ import sinon from 'sinon'; import { Router, type RouterLocation } from '../../src/index.js'; import Resolver from '../../src/resolver/resolver.js'; import '../setup.js'; -import type { MaybePromise } from '../../src/resolver/types.js'; +import type { MaybePromise } from '../../src/resolver/types.t.js'; import type { Commands, Route, @@ -11,7 +11,7 @@ import type { VaadinRouterErrorEvent, VaadinRouterLocationChangedEvent, WebComponentInterface, -} from '../../src/types.js'; +} from '../../src/types.t.js'; import { checkOutletContents, cleanup, diff --git a/test/router/parent-layout.spec.ts b/test/router/parent-layout.spec.ts index 09f13c36..148b2306 100644 --- a/test/router/parent-layout.spec.ts +++ b/test/router/parent-layout.spec.ts @@ -1,7 +1,7 @@ import { expect } from '@esm-bundle/chai'; import sinon from 'sinon'; import { Router } from '../../src/router.js'; -import type { ResolutionError, RouterLocation, WebComponentInterface } from '../../src/types.js'; +import type { ResolutionError, RouterLocation, WebComponentInterface } from '../../src/types.t.js'; import '../setup.js'; import { checkOutletContents, diff --git a/test/router/router.spec.ts b/test/router/router.spec.ts index f7ebfae3..ad46440f 100644 --- a/test/router/router.spec.ts +++ b/test/router/router.spec.ts @@ -11,7 +11,7 @@ import type { RouteChildrenContext, RouteContext, WebComponentInterface, -} from '../../src/types.js'; +} from '../../src/types.t.js'; import '../setup.js'; import { checkOutletContents, cleanup, onBeforeEnterAction } from './test-utils.js'; From 842b6f72e0a8603b2bdc9f4cc5789e60aa5542cc Mon Sep 17 00:00:00 2001 From: Vlad Rindevich Date: Mon, 4 Nov 2024 10:58:08 +0200 Subject: [PATCH 5/6] chore: use concurrently instead of abandoned npm-run-all (#899) --- package-lock.json | 441 +++++++--------------------------------------- package.json | 6 +- 2 files changed, 66 insertions(+), 381 deletions(-) diff --git a/package-lock.json b/package-lock.json index dac3a36c..c809bffa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,7 @@ "browserslist": "^4.24.0", "chai-as-promised": "^8.0.0", "chai-dom": "^1.11.0", + "concurrently": "^9.0.1", "esbuild": "^0.24.0", "eslint": "^8.57.1", "eslint-config-vaadin": "^1.0.0-alpha.28", @@ -50,7 +51,6 @@ "karma-vite": "^1.0.5", "magic-string": "^0.30.11", "mocha": "^10.2.0", - "npm-run-all": "^4.1.5", "oxlint": "^0.9.9", "prettier": "^3.1.0", "sinon": "^19.0.2", @@ -3366,6 +3366,48 @@ "dev": true, "license": "MIT" }, + "node_modules/concurrently": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.0.1.tgz", + "integrity": "sha512-wYKvCd/f54sTXJMSfV6Ln/B8UrfLBKOYa+lzc6CHay3Qek+LorVSBdMVfyewFhRbH0Rbabsk4D+3PL/VjQ5gzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.2", + "lodash": "^4.17.21", + "rxjs": "^7.8.1", + "shell-quote": "^1.8.1", + "supports-color": "^8.1.1", + "tree-kill": "^1.2.2", + "yargs": "^17.7.2" + }, + "bin": { + "conc": "dist/bin/concurrently.js", + "concurrently": "dist/bin/concurrently.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/content-type": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", @@ -5543,13 +5585,6 @@ "he": "bin/he" } }, - "node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true, - "license": "ISC" - }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -6392,13 +6427,6 @@ "dev": true, "license": "MIT" }, - "node_modules/json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true, - "license": "MIT" - }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -6887,22 +6915,6 @@ "uc.micro": "^2.0.0" } }, - "node_modules/load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/local-pkg": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", @@ -7167,15 +7179,6 @@ "node": ">= 0.6" } }, - "node_modules/memorystream": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", - "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", - "dev": true, - "engines": { - "node": ">= 0.10.0" - } - }, "node_modules/meow": { "version": "13.2.0", "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", @@ -7658,13 +7661,6 @@ "dev": true, "license": "MIT" }, - "node_modules/nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true, - "license": "MIT" - }, "node_modules/nise": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/nise/-/nise-6.1.1.tgz", @@ -7709,29 +7705,6 @@ "nopt": "bin/nopt.js" } }, - "node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -7742,183 +7715,6 @@ "node": ">=0.10.0" } }, - "node_modules/npm-run-all": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", - "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "chalk": "^2.4.1", - "cross-spawn": "^6.0.5", - "memorystream": "^0.3.1", - "minimatch": "^3.0.4", - "pidtree": "^0.3.0", - "read-pkg": "^3.0.0", - "shell-quote": "^1.6.1", - "string.prototype.padend": "^3.0.0" - }, - "bin": { - "npm-run-all": "bin/npm-run-all/index.js", - "run-p": "bin/run-p/index.js", - "run-s": "bin/run-s/index.js" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/npm-run-all/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/npm-run-all/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/npm-run-all/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/npm-run-all/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true, - "license": "MIT" - }, - "node_modules/npm-run-all/node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/npm-run-all/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/npm-run-all/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/npm-run-all/node_modules/path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/npm-run-all/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/npm-run-all/node_modules/shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-run-all/node_modules/shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-run-all/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/npm-run-all/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -8166,20 +7962,6 @@ "node": ">=6" } }, - "node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", - "dev": true, - "license": "MIT", - "dependencies": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/parse5": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", @@ -8318,29 +8100,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/pidtree": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz", - "integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==", - "dev": true, - "license": "MIT", - "bin": { - "pidtree": "bin/pidtree.js" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/possible-typed-array-names": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", @@ -8620,34 +8379,6 @@ "dev": true, "license": "MIT" }, - "node_modules/read-pkg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", - "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg/node_modules/path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "dev": true, - "license": "MIT", - "dependencies": { - "pify": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -8886,6 +8617,16 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/safe-array-concat": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", @@ -9310,42 +9051,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/spdx-correct": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", - "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", - "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", - "dev": true, - "license": "CC-BY-3.0" - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.20", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.20.tgz", - "integrity": "sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==", - "dev": true, - "license": "CC0-1.0" - }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -9498,25 +9203,6 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/string.prototype.padend": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.6.tgz", - "integrity": "sha512-XZpspuSB7vJWhvJc9DLSlrXl1mcA2BdoY5jjnS135ydXqLoqhs96JjDtCkjJEQHvfqZIp9hBuBMgI589peyx9Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/string.prototype.trim": { "version": "1.2.9", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", @@ -10086,6 +9772,16 @@ "node": ">=0.6" } }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, "node_modules/trim-lines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", @@ -11039,17 +10735,6 @@ "node": ">= 0.4.0" } }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/package.json b/package.json index 36f58393..4b791104 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,10 @@ "scripts": { "clean:build": "git clean -fx . -e .vite -e node_modules -e .idea -e .vscode", "install:dependencies": "bower install", - "lint": "npm-run-all --parallel lint:*", + "lint": "concurrently npm:lint:*", "lint:js": "eslint --ext .html,.js src test demo *.js *.html", "lint:css": "stylelint demo/**/*.html", - "build": "npm-run-all --parallel build:*", + "build": "concurrently npm:build:*", "build:esbuild": "tsx scripts/build.ts", "build:copy-dts": "tsx scripts/copy-dts.ts", "build:tsc": "tsc --emitDeclarationOnly -p tsconfig.build.json", @@ -74,6 +74,7 @@ "browserslist": "^4.24.0", "chai-as-promised": "^8.0.0", "chai-dom": "^1.11.0", + "concurrently": "^9.0.1", "esbuild": "^0.24.0", "eslint": "^8.57.1", "eslint-config-vaadin": "^1.0.0-alpha.28", @@ -93,7 +94,6 @@ "karma-vite": "^1.0.5", "magic-string": "^0.30.11", "mocha": "^10.2.0", - "npm-run-all": "^4.1.5", "oxlint": "^0.9.9", "prettier": "^3.1.0", "sinon": "^19.0.2", From 7e87b3b0921a608d44441fbdec66613542c87d2a Mon Sep 17 00:00:00 2001 From: Vlad Rindevich Date: Thu, 7 Nov 2024 13:31:20 +0200 Subject: [PATCH 6/6] fix: use es2021 as a target for TypeScript (#900) * fix: use es2021 as a target for TypeScript * fix: get rid of es2022 code * fix: restore error.cause --------- Co-authored-by: Anton Platonov --- src/resolver/matchPath.ts | 2 +- src/resolver/resolver.ts | 11 +++++++++-- test/resolver/resolver.spec.ts | 2 +- test/router/lifecycle-events.spec.ts | 2 +- tsconfig.json | 4 ++-- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/resolver/matchPath.ts b/src/resolver/matchPath.ts index 1783fabb..6361619d 100644 --- a/src/resolver/matchPath.ts +++ b/src/resolver/matchPath.ts @@ -79,7 +79,7 @@ function matchPath( const key = regexp.keys[i - 1]; const prop = key.name; const value = m[i]; - if (value !== undefined || !Object.hasOwn(params, prop)) { + if (value !== undefined || !Object.prototype.hasOwnProperty.call(params, prop)) { if (key.modifier === '+' || key.modifier === '*') { // by default, as of path-to-regexp 6.0.0, the default delimiters // are `/`, `#` and `?`. diff --git a/src/resolver/resolver.ts b/src/resolver/resolver.ts index 2ca4fdb3..53a6c6f2 100644 --- a/src/resolver/resolver.ts +++ b/src/resolver/resolver.ts @@ -37,14 +37,20 @@ function isRouteContext(value: unknown): ); } -export interface ResolutionErrorOptions extends ErrorOptions { +export interface ResolutionErrorOptions { code?: number; + cause?: unknown; } /** * An error that is thrown when a route resolution fails. */ export class ResolutionError extends Error { + /** + * The resolution error cause, possibly an error thrown from the action callback. + */ + readonly cause?: unknown; + /** * A HTTP status code associated with the error. */ @@ -61,7 +67,8 @@ export class ResolutionError { expect(context).to.have.property('result').that.equals(errorResult); expect(errorHandler).to.be.calledOnce; - const error: ResolutionError = errorHandler.firstCall.firstArg; + const error: ResolutionError = errorHandler.firstCall.firstArg; expect(error).to.be.instanceof(ResolutionError); expect(error.cause).to.be.an('error'); expect(error.cause).to.have.property('message').that.equals('custom'); diff --git a/test/router/lifecycle-events.spec.ts b/test/router/lifecycle-events.spec.ts index 407e9cc7..213c4b70 100644 --- a/test/router/lifecycle-events.spec.ts +++ b/test/router/lifecycle-events.spec.ts @@ -2390,7 +2390,7 @@ describe('Vaadin Router lifecycle events', () => { resolve(); }) .catch((e: unknown) => { - reject(new Error('Error happened', { cause: e })); + reject(e); }); } }, diff --git a/tsconfig.json b/tsconfig.json index 7a89a309..f84a327a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,10 +4,10 @@ "allowSyntheticDefaultImports": true, "declaration": true, "declarationMap": true, - "target": "es2022", + "target": "es2021", "module": "esnext", "moduleResolution": "bundler", - "lib": ["es2022", "dom", "DOM.Iterable"], + "lib": ["es2021", "dom", "DOM.Iterable"], "allowArbitraryExtensions": true, "skipLibCheck": true, "strict": true,