@wavelengthusaf/client-router 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/elements/RouteElement.d.ts +11 -0
  2. package/dist/elements/RouteElement.d.ts.map +1 -0
  3. package/dist/elements/RouteElement.js +44 -0
  4. package/dist/elements/RouteElement.js.map +1 -0
  5. package/dist/elements/RouterElement.d.ts +12 -0
  6. package/dist/elements/RouterElement.d.ts.map +1 -0
  7. package/dist/elements/RouterElement.js +70 -0
  8. package/dist/elements/RouterElement.js.map +1 -0
  9. package/dist/index.d.ts +6 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +5 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/models/CompiledRoute.d.ts +7 -0
  14. package/dist/models/CompiledRoute.d.ts.map +1 -0
  15. package/dist/models/CompiledRoute.js +2 -0
  16. package/dist/models/CompiledRoute.js.map +1 -0
  17. package/dist/models/MatchedRoute.d.ts +7 -0
  18. package/dist/models/MatchedRoute.d.ts.map +1 -0
  19. package/dist/models/MatchedRoute.js +2 -0
  20. package/dist/models/MatchedRoute.js.map +1 -0
  21. package/dist/models/RouteComponent.d.ts +6 -0
  22. package/dist/models/RouteComponent.d.ts.map +1 -0
  23. package/dist/models/RouteComponent.js +2 -0
  24. package/dist/models/RouteComponent.js.map +1 -0
  25. package/dist/models/RouteContext.d.ts +7 -0
  26. package/dist/models/RouteContext.d.ts.map +1 -0
  27. package/dist/models/RouteContext.js +2 -0
  28. package/dist/models/RouteContext.js.map +1 -0
  29. package/dist/models/RouteDefinition.d.ts +6 -0
  30. package/dist/models/RouteDefinition.d.ts.map +1 -0
  31. package/dist/models/RouteDefinition.js +2 -0
  32. package/dist/models/RouteDefinition.js.map +1 -0
  33. package/dist/models/RouteGuard.d.ts +3 -0
  34. package/dist/models/RouteGuard.d.ts.map +1 -0
  35. package/dist/models/RouteGuard.js +2 -0
  36. package/dist/models/RouteGuard.js.map +1 -0
  37. package/dist/models/RouteParams.d.ts +4 -0
  38. package/dist/models/RouteParams.d.ts.map +1 -0
  39. package/dist/models/RouteParams.js +2 -0
  40. package/dist/models/RouteParams.js.map +1 -0
  41. package/dist/models/index.d.ts +9 -0
  42. package/dist/models/index.d.ts.map +1 -0
  43. package/dist/models/index.js +2 -0
  44. package/dist/models/index.js.map +1 -0
  45. package/dist/router/Router.d.ts +20 -0
  46. package/dist/router/Router.d.ts.map +1 -0
  47. package/dist/router/Router.js +158 -0
  48. package/dist/router/Router.js.map +1 -0
  49. package/dist/utils/compileRoute.d.ts +3 -0
  50. package/dist/utils/compileRoute.d.ts.map +1 -0
  51. package/dist/utils/compileRoute.js +30 -0
  52. package/dist/utils/compileRoute.js.map +1 -0
  53. package/dist/utils/index.d.ts +4 -0
  54. package/dist/utils/index.d.ts.map +1 -0
  55. package/dist/utils/index.js +4 -0
  56. package/dist/utils/index.js.map +1 -0
  57. package/dist/utils/matchRoute.d.ts +3 -0
  58. package/dist/utils/matchRoute.d.ts.map +1 -0
  59. package/dist/utils/matchRoute.js +25 -0
  60. package/dist/utils/matchRoute.js.map +1 -0
  61. package/package.json +7 -1
  62. package/.gitlab-ci.yml +0 -84
  63. package/.husky/pre-commit +0 -38
  64. package/.storybook/main.ts +0 -16
  65. package/.storybook/manager.ts +0 -7
  66. package/.storybook/preview.ts +0 -23
  67. package/.storybook/theme.ts +0 -30
  68. package/.storybook/vitest.setup.ts +0 -7
  69. package/dist/elements/__tests__/RouteElement.test.d.ts +0 -0
  70. package/dist/elements/__tests__/RouteElement.test.d.ts.map +0 -0
  71. package/dist/elements/__tests__/RouteElement.test.js +0 -77
  72. package/dist/elements/__tests__/RouteElement.test.js.map +0 -0
  73. package/dist/elements/__tests__/RouterElement.test.d.ts +0 -0
  74. package/dist/elements/__tests__/RouterElement.test.d.ts.map +0 -0
  75. package/dist/elements/__tests__/RouterElement.test.js +0 -0
  76. package/dist/elements/__tests__/RouterElement.test.js.map +0 -0
  77. package/dist/prettier.config.d.ts +0 -0
  78. package/dist/prettier.config.d.ts.map +0 -0
  79. package/dist/router/__tests__/Router.test.d.ts +0 -0
  80. package/dist/router/__tests__/Router.test.d.ts.map +0 -0
  81. package/dist/router/__tests__/Router.test.js +0 -0
  82. package/dist/router/__tests__/Router.test.js.map +0 -0
  83. package/dist/src/elements/RouteElement.d.ts +0 -0
  84. package/dist/src/elements/RouteElement.d.ts.map +0 -0
  85. package/dist/src/elements/RouterElement.d.ts +0 -0
  86. package/dist/src/elements/RouterElement.d.ts.map +0 -0
  87. package/dist/src/elements/__tests__/RouteElement.test.d.ts +0 -0
  88. package/dist/src/elements/__tests__/RouteElement.test.d.ts.map +0 -0
  89. package/dist/src/elements/__tests__/RouterElement.test.d.ts +0 -0
  90. package/dist/src/elements/__tests__/RouterElement.test.d.ts.map +0 -0
  91. package/dist/src/index.d.ts +0 -0
  92. package/dist/src/index.d.ts.map +0 -0
  93. package/dist/src/models/CompiledRoute.d.ts +0 -0
  94. package/dist/src/models/CompiledRoute.d.ts.map +0 -0
  95. package/dist/src/models/MatchedRoute.d.ts +0 -0
  96. package/dist/src/models/MatchedRoute.d.ts.map +0 -0
  97. package/dist/src/models/RouteComponent.d.ts +0 -0
  98. package/dist/src/models/RouteComponent.d.ts.map +0 -0
  99. package/dist/src/models/RouteContext.d.ts +0 -0
  100. package/dist/src/models/RouteContext.d.ts.map +0 -0
  101. package/dist/src/models/RouteDefinition.d.ts +0 -0
  102. package/dist/src/models/RouteDefinition.d.ts.map +0 -0
  103. package/dist/src/models/RouteGuard.d.ts +0 -0
  104. package/dist/src/models/RouteGuard.d.ts.map +0 -0
  105. package/dist/src/models/RouteParams.d.ts +0 -0
  106. package/dist/src/models/RouteParams.d.ts.map +0 -0
  107. package/dist/src/models/index.d.ts +0 -0
  108. package/dist/src/models/index.d.ts.map +0 -0
  109. package/dist/src/router/Router.d.ts +0 -0
  110. package/dist/src/router/Router.d.ts.map +0 -0
  111. package/dist/src/router/__tests__/Router.test.d.ts +0 -0
  112. package/dist/src/router/__tests__/Router.test.d.ts.map +0 -0
  113. package/dist/src/stories/RouterElement.stories.d.ts +0 -0
  114. package/dist/src/stories/RouterElement.stories.d.ts.map +0 -0
  115. package/dist/src/stories/RouterElement.stories.test.d.ts +0 -0
  116. package/dist/src/stories/RouterElement.stories.test.d.ts.map +0 -0
  117. package/dist/src/utils/__tests__/compileRoute.test.d.ts +0 -0
  118. package/dist/src/utils/__tests__/compileRoute.test.d.ts.map +0 -0
  119. package/dist/src/utils/__tests__/matchRoute.test.d.ts +0 -0
  120. package/dist/src/utils/__tests__/matchRoute.test.d.ts.map +0 -0
  121. package/dist/src/utils/compileRoute.d.ts +0 -0
  122. package/dist/src/utils/compileRoute.d.ts.map +0 -0
  123. package/dist/src/utils/index.d.ts +0 -0
  124. package/dist/src/utils/index.d.ts.map +0 -0
  125. package/dist/src/utils/matchRoute.d.ts +0 -0
  126. package/dist/src/utils/matchRoute.d.ts.map +0 -0
  127. package/dist/stories/RouterElement.stories.d.ts +0 -0
  128. package/dist/stories/RouterElement.stories.d.ts.map +0 -0
  129. package/dist/stories/RouterElement.stories.js +0 -0
  130. package/dist/stories/RouterElement.stories.js.map +0 -0
  131. package/dist/utils/__tests__/compileRoute.test.d.ts +0 -0
  132. package/dist/utils/__tests__/compileRoute.test.d.ts.map +0 -0
  133. package/dist/utils/__tests__/compileRoute.test.js +0 -0
  134. package/dist/utils/__tests__/compileRoute.test.js.map +0 -0
  135. package/dist/utils/__tests__/matchRoute.test.d.ts +0 -0
  136. package/dist/utils/__tests__/matchRoute.test.d.ts.map +0 -0
  137. package/dist/utils/__tests__/matchRoute.test.js +0 -0
  138. package/dist/utils/__tests__/matchRoute.test.js.map +0 -0
  139. package/eslint.config.mjs +0 -89
  140. package/index.ts +0 -15
  141. package/prettier.config.ts +0 -30
  142. package/src/elements/RouteElement.ts +0 -67
  143. package/src/elements/RouterElement.ts +0 -97
  144. package/src/elements/__tests__/RouteElement.test.ts +0 -89
  145. package/src/elements/__tests__/RouterElement.test.ts +0 -253
  146. package/src/index.ts +0 -15
  147. package/src/models/CompiledRoute.ts +0 -7
  148. package/src/models/MatchedRoute.ts +0 -7
  149. package/src/models/RouteComponent.ts +0 -6
  150. package/src/models/RouteContext.ts +0 -7
  151. package/src/models/RouteDefinition.ts +0 -6
  152. package/src/models/RouteGuard.ts +0 -6
  153. package/src/models/RouteParams.ts +0 -3
  154. package/src/models/index.ts +0 -17
  155. package/src/router/Router.ts +0 -225
  156. package/src/router/__tests__/Router.test.ts +0 -464
  157. package/src/stories/RouterElement.stories.test.ts +0 -310
  158. package/src/stories/RouterElement.stories.ts +0 -208
  159. package/src/utils/__tests__/compileRoute.test.ts +0 -97
  160. package/src/utils/__tests__/matchRoute.test.ts +0 -180
  161. package/src/utils/compileRoute.ts +0 -37
  162. package/src/utils/index.ts +0 -4
  163. package/src/utils/matchRoute.ts +0 -37
  164. package/tsconfig.build.json +0 -20
  165. package/tsconfig.json +0 -55
  166. package/vitest.config.ts +0 -34
  167. package/vitest.setup.ts +0 -3
  168. package/vitest.shims.d.ts +0 -1
@@ -0,0 +1,25 @@
1
+ export function matchRoute(compiledRoutes, pathname) {
2
+ for (const compiledRoute of compiledRoutes) {
3
+ const match = compiledRoute.pattern.exec(pathname);
4
+ if (!match)
5
+ continue;
6
+ const routeParams = {};
7
+ compiledRoute.paramNames.forEach((name, i) => {
8
+ const value = match[i + 1];
9
+ if (value === undefined)
10
+ return;
11
+ try {
12
+ routeParams[name] = decodeURIComponent(value);
13
+ }
14
+ catch {
15
+ routeParams[name] = value;
16
+ }
17
+ });
18
+ return {
19
+ routeDefinition: compiledRoute.routeDefinition,
20
+ routeParams,
21
+ };
22
+ }
23
+ return null;
24
+ }
25
+ //# sourceMappingURL=matchRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matchRoute.js","sourceRoot":"","sources":["../../src/utils/matchRoute.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,UAAU,CACtB,cAA+B,EAC/B,QAAgB;IAElB,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;QAC3C,MAAM,KAAK,GAA4B,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE5E,IAAI,CAAC,KAAK;YAAE,SAAS;QAErB,MAAM,WAAW,GAAgB,EAAE,CAAC;QAEpC,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;YAC3C,MAAM,KAAK,GAAuB,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAE/C,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAO;YAEhC,IAAI,CAAC;gBACH,WAAW,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAChD,CAAC;YAAC,MAAM,CAAC;gBACP,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,eAAe,EAAE,aAAa,CAAC,eAAe;YAC9C,WAAW;SACZ,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavelengthusaf/client-router",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Native TypeScript Router",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,6 +22,12 @@
22
22
  "author": "Wavelength",
23
23
  "license": "ISC",
24
24
  "type": "module",
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
25
31
  "devDependencies": {
26
32
  "@happy-dom/global-registrator": "^20.9.0",
27
33
  "@storybook/addon-a11y": "^10.3.5",
package/.gitlab-ci.yml DELETED
@@ -1,84 +0,0 @@
1
- stages:
2
- - setup
3
- - build
4
- - test
5
- - security
6
- - deploy
7
-
8
- variables:
9
- GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_CONCURRENT_ID/$CI_PROJECT_PATH
10
- NODE_VERSION: '22'
11
-
12
- cache:
13
- key: ${CI_COMMIT_REF_SLUG}
14
- paths:
15
- - node_modules/
16
-
17
- include:
18
- - template: Jobs/SAST.gitlab-ci.yml
19
- - template: Jobs/Secret-Detection.gitlab-ci.yml
20
- - template: Jobs/Dependency-Scanning.gitlab-ci.yml
21
-
22
- setup:
23
- stage: setup
24
- image: node:${NODE_VERSION}-alpine
25
- before_script:
26
- - npm ci
27
- script:
28
- - echo "Dependencies installed"
29
- artifacts:
30
- paths:
31
- - node_modules/
32
- expire_in: 1 week
33
-
34
- build:
35
- stage: build
36
- needs: ['setup']
37
- image: node:${NODE_VERSION}-alpine
38
- script:
39
- - npm run build
40
- artifacts:
41
- paths:
42
- - dist/
43
-
44
- lint:
45
- stage: test
46
- needs: ['setup']
47
- image: node:${NODE_VERSION}-alpine
48
- script:
49
- - npm run lint
50
- allow_failure: false
51
-
52
- test:
53
- stage: test
54
- needs: ['setup']
55
- image: node:${NODE_VERSION}-alpine
56
- script:
57
- - npm run test
58
- allow_failure: false
59
- coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
60
-
61
- publish:npm:
62
- stage: deploy
63
- image: node:${NODE_VERSION}-alpine
64
- needs: ['setup', 'test']
65
- script:
66
- - echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > .npmrc
67
- - npm publish --access public
68
- rules:
69
- - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
70
- - if: $CI_COMMIT_BRANCH == "master"
71
-
72
- pages:
73
- stage: deploy
74
- image: node:${NODE_VERSION}-alpine
75
- needs: ['setup', 'build']
76
- script:
77
- - npm run build-storybook -- -o public
78
- - echo '<meta name="robots" content="noindex" />' >> public/index.html
79
- artifacts:
80
- paths:
81
- - public/
82
- expire_in: 30 days
83
- rules:
84
- - if: $CI_COMMIT_BRANCH == "master"
package/.husky/pre-commit DELETED
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env sh
2
- echo ------------------------------
3
- echo Running Husky Pre-Commit Hooks
4
- echo ------------------------------
5
- echo
6
- echo
7
- echo ----------------------------------
8
- echo Running Unit Tests
9
- echo ----------------------------------
10
- npm run test -- $(git diff --diff-filter=d --name-only --staged) --passWithNoTests
11
- if [ $? -ne 0 ]; then
12
- echo
13
- echo "Unit tests failed!"
14
- echo
15
- exit 1
16
- else
17
- echo
18
- echo "Unit tests passed!"
19
- echo
20
- fi
21
- echo ---------------------------
22
- echo Running Eslint and Prettier
23
- echo ---------------------------
24
- npx eslint --fix $(git diff --diff-filter=d --name-only --staged | grep -E '\.(js|ts|tsx)$')
25
- if [ $? -ne 0 ]; then
26
- echo
27
- echo "ESLint failed with errors."
28
- echo
29
- exit 1
30
- else
31
- echo
32
- echo "ESLint passed successfully."
33
- echo
34
- fi
35
- echo
36
- echo Pre-commit checks passed!
37
- exit 0
38
-
@@ -1,16 +0,0 @@
1
- const config = {
2
- stories: ['../src/stories/**/*.stories.ts'],
3
-
4
- framework: {
5
- name: '@storybook/web-components-vite',
6
- options: {},
7
- },
8
-
9
- addons: [
10
- '@storybook/addon-links',
11
- '@storybook/addon-docs',
12
- '@storybook/addon-a11y',
13
- ],
14
- };
15
-
16
- export default config;
@@ -1,7 +0,0 @@
1
- import { addons } from 'storybook/manager-api';
2
-
3
- import theme from './theme.ts';
4
-
5
- addons.setConfig({
6
- theme,
7
- });
@@ -1,23 +0,0 @@
1
- import type { Preview } from '@storybook/web-components';
2
-
3
- const preview: Preview = {
4
- parameters: {
5
- controls: {
6
- matchers: {
7
- color: /(background|color)$/i,
8
- date: /Date$/i,
9
- },
10
- },
11
- docs: {
12
- source: {
13
- language: 'ts',
14
- format: 'dedent',
15
- },
16
- },
17
- a11y: {
18
- element: 'wavelength-router',
19
- },
20
- },
21
- };
22
-
23
- export default preview;
@@ -1,30 +0,0 @@
1
- import { create } from 'storybook/theming';
2
-
3
- export default create({
4
- base: 'light',
5
-
6
- colorPrimary: '#007fff',
7
- colorSecondary: '#007fff',
8
-
9
- appBg: '#ffffff',
10
- appContentBg: '#ffffff',
11
- appBorderColor: '#e0e0e0',
12
- appBorderRadius: 4,
13
-
14
- textColor: 'rgba(0, 0, 0, 0.87)',
15
- textInverseColor: '#ffffff',
16
- textMutedColor: 'rgba(0, 0, 0, 0.6)',
17
-
18
- barTextColor: 'rgba(0, 0, 0, 0.6)',
19
- barSelectedColor: '#007fff',
20
- barBg: '#ffffff',
21
- barHoverColor: '#f0f0f0',
22
-
23
- inputBg: '#ffffff',
24
- inputBorder: '#e0e0e0',
25
- inputTextColor: 'rgba(0, 0, 0, 0.87)',
26
- inputBorderRadius: 4,
27
-
28
- booleanBg: '#f6f8fa',
29
- booleanSelectedBg: '#e6f4ff',
30
- });
@@ -1,7 +0,0 @@
1
- import { setProjectAnnotations } from '@storybook/web-components-vite';
2
-
3
- import * as projectAnnotations from './preview.ts';
4
-
5
- // This is an important step to apply the right configuration when testing your stories.
6
- // More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
7
- setProjectAnnotations([projectAnnotations]);
File without changes
@@ -1,77 +0,0 @@
1
- import { describe, expect, it, vi, beforeEach } from 'vitest';
2
- import { RouteElement } from '../RouteElement.ts';
3
- /* eslint-disable @typescript-eslint/no-explicit-any */
4
- describe('RouteElement', () => {
5
- beforeEach(() => {
6
- if (!customElements.get(RouteElement.tag)) {
7
- customElements.define(RouteElement.tag, RouteElement);
8
- }
9
- document.body.innerHTML = '';
10
- });
11
- describe('Attribute Accessors & toDefinition Logic', () => {
12
- it.each([
13
- {
14
- it: 'returns default path "*" if attribute is missing',
15
- html: `<wavelength-route component="my-view"></wavelength-route>`,
16
- expectedPath: '*',
17
- expectedTag: 'my-view'
18
- },
19
- {
20
- it: 'extracts specified path and component tag',
21
- html: `<wavelength-route path="/home" component="home-view"></wavelength-route>`,
22
- expectedPath: '/home',
23
- expectedTag: 'home-view'
24
- },
25
- {
26
- it: 'returns null and warns if component attribute is missing',
27
- html: `<wavelength-route path="/error"></wavelength-route>`,
28
- expectedPath: '/error',
29
- expectedTag: '',
30
- shouldBeNull: true
31
- }
32
- ])('$it', ({ html, expectedPath, expectedTag, shouldBeNull }) => {
33
- document.body.innerHTML = html;
34
- const el = document.querySelector('wavelength-route');
35
- const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
36
- expect(el.path).toBe(expectedPath);
37
- expect(el.componentTag).toBe(expectedTag);
38
- const def = el.toDefinition({ document });
39
- if (shouldBeNull) {
40
- expect(def).toBeNull();
41
- expect(warnSpy).toHaveBeenCalled();
42
- }
43
- else {
44
- expect(def?.path).toBe(expectedPath);
45
- expect(def?.routeComponent).toBeDefined();
46
- }
47
- warnSpy.mockRestore();
48
- });
49
- });
50
- describe('SSR / Environment Resilience', () => {
51
- it('returns a no-op component if document is missing', () => {
52
- const el = document.createElement('wavelength-route');
53
- el.setAttribute('component', 'test-view');
54
- const def = el.toDefinition({});
55
- expect(def?.path).toBe('*');
56
- expect(def?.routeComponent.mount).toBeInstanceOf(Function);
57
- expect(() => def?.routeComponent.mount({}, {})).not.toThrow();
58
- expect(() => def?.routeComponent.unmount?.()).not.toThrow();
59
- });
60
- });
61
- describe('RouteComponent Mounting Logic', () => {
62
- it('properly creates element and injects context on mount', () => {
63
- const el = document.createElement('wavelength-route');
64
- el.setAttribute('component', 'user-profile');
65
- const def = el.toDefinition({ document });
66
- const container = document.createElement('div');
67
- const mockContext = { path: '/user/1', routeParams: { id: '1' }, query: new URLSearchParams() };
68
- def?.routeComponent.mount(container, mockContext);
69
- const renderedElement = container.querySelector('user-profile');
70
- expect(renderedElement).toBeDefined();
71
- expect(renderedElement.routeContext).toEqual(mockContext);
72
- expect(def?.routeComponent.unmount).toBeDefined();
73
- def?.routeComponent.unmount?.();
74
- });
75
- });
76
- });
77
- //# sourceMappingURL=RouteElement.test.js.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/eslint.config.mjs DELETED
@@ -1,89 +0,0 @@
1
- import prettier from 'eslint-config-prettier';
2
- import sonarjs from 'eslint-plugin-sonarjs';
3
- import storybook from 'eslint-plugin-storybook';
4
- import wc from 'eslint-plugin-wc';
5
- import globals from 'globals';
6
- import tsEslint from 'typescript-eslint';
7
-
8
- export default tsEslint.config(
9
- {
10
- ignores: ['dist/**', 'node_modules/**', 'coverage/**', '.storybook/**'],
11
- },
12
-
13
- ...tsEslint.configs.recommended,
14
- sonarjs.configs.recommended,
15
-
16
- {
17
- files: ['src/**/*.ts'],
18
- plugins: {
19
- wc,
20
- },
21
- languageOptions: {
22
- parser: tsEslint.parser,
23
- parserOptions: {
24
- projectService: true,
25
- tsconfigRootDir: import.meta.dirname,
26
- },
27
- globals: {
28
- ...globals.browser,
29
- ...globals.node,
30
- },
31
- },
32
- rules: {
33
- '@typescript-eslint/explicit-member-accessibility': [
34
- 'error',
35
- {
36
- accessibility: 'explicit',
37
- overrides: {
38
- constructors: 'no-public',
39
- },
40
- },
41
- ],
42
- '@typescript-eslint/consistent-type-exports': 'error',
43
- '@typescript-eslint/no-import-type-side-effects': 'error',
44
- '@typescript-eslint/no-explicit-any': 'error',
45
-
46
- ...wc.configs.recommended.rules,
47
-
48
- 'wc/no-constructor-attributes': 'error',
49
- 'wc/no-invalid-element-name': 'error',
50
- 'wc/guard-super-call': 'error',
51
- 'wc/attach-shadow-constructor': 'off',
52
- 'wc/no-self-class': 'off',
53
-
54
- 'sonarjs/todo-tag': 'warn',
55
- 'sonarjs/no-selector-parameter': 'off',
56
- },
57
- },
58
-
59
- {
60
- files: ['**/*.test.ts', '**/*.spec.ts', 'src/**/*.stories.ts'],
61
- languageOptions: {
62
- parserOptions: {
63
- projectService: {
64
- allowDefaultProject: ['*.ts', '*.tsx'],
65
- extendedReports: true,
66
- },
67
- tsconfigRootDir: import.meta.dirname,
68
- },
69
- globals: {
70
- ...globals.node,
71
- Bun: 'readonly',
72
- describe: 'readonly',
73
- it: 'readonly',
74
- expect: 'readonly',
75
- test: 'readonly',
76
- beforeAll: 'readonly',
77
- afterAll: 'readonly',
78
- beforeEach: 'readonly',
79
- afterEach: 'readonly',
80
- },
81
- },
82
- rules: {
83
- '@typescript-eslint/no-unused-expressions': 'error',
84
- },
85
- },
86
-
87
- ...storybook.configs['flat/recommended'],
88
- prettier,
89
- );
package/index.ts DELETED
@@ -1,15 +0,0 @@
1
- export { Router } from './src/router/Router.ts';
2
- export { RouterElement } from './src/elements/RouterElement.ts';
3
- export { RouteElement } from './src/elements/RouteElement.ts';
4
-
5
- export type {
6
- RouteComponent,
7
- RouteContext,
8
- RouteDefinition,
9
- RouteGuard,
10
- RouteParams,
11
- CompiledRoute,
12
- MatchedRoute,
13
- } from './src/models/index.ts';
14
-
15
- export { compileRoute, matchRoute } from './src/utils/index.ts';
@@ -1,30 +0,0 @@
1
- import type { Config } from 'prettier';
2
-
3
- const config: Config = {
4
- endOfLine: 'lf',
5
- arrowParens: 'always',
6
- semi: true,
7
- trailingComma: 'all',
8
- singleQuote: true,
9
- printWidth: 80,
10
- tabWidth: 2,
11
- useTabs: false,
12
- plugins: ['@trivago/prettier-plugin-sort-imports'],
13
- importOrder: [
14
- '^bun.*$',
15
- '<THIRD_PARTY_MODULES>',
16
- '^@/(.*)$',
17
- '^[../]',
18
- '^[./]',
19
- '(.css|.scss)$',
20
- ],
21
- importOrderSeparation: true,
22
- importOrderSortSpecifiers: true,
23
- importOrderParserPlugins: [
24
- 'typescript',
25
- 'decorators-legacy',
26
- 'importAssertions',
27
- ],
28
- };
29
-
30
- export default config;