@aegisjsproject/atlas 1.0.2 → 1.1.0
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.
- package/.pre-commit-config.yaml +22 -0
- package/CHANGELOG.md +11 -0
- package/README.md +47 -47
- package/package.json +11 -8
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/gitleaks/gitleaks
|
|
3
|
+
rev: v8.16.3
|
|
4
|
+
hooks:
|
|
5
|
+
- id: gitleaks
|
|
6
|
+
- repo: local
|
|
7
|
+
hooks:
|
|
8
|
+
- id: local-stylelint
|
|
9
|
+
name: Run Stylelint
|
|
10
|
+
entry: npm run lint:css --if-exists
|
|
11
|
+
language: node
|
|
12
|
+
types: [css]
|
|
13
|
+
- id: local-htmlhint
|
|
14
|
+
name: Run HTMLHint
|
|
15
|
+
entry: npm run lint:html --if-exists
|
|
16
|
+
language: node
|
|
17
|
+
types: [html]
|
|
18
|
+
- id: local-eslint
|
|
19
|
+
name: Run ESLint
|
|
20
|
+
entry: npm run lint:js --if-exists
|
|
21
|
+
language: node
|
|
22
|
+
types_or: [javascript, jsx, ts, tsx]
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [v1.1.0] - 2026-06-24
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Add `.npmrc` to harden `npm i` & `npm ci` operations
|
|
14
|
+
- Added `SECURITY.md` for reporting security issues
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- Update to node 26.3.0 / npm 11.16.0
|
|
18
|
+
- Update from `publish` to `publish stage`
|
|
19
|
+
- Implement security changes provided by SecurityStep
|
|
20
|
+
|
|
10
21
|
## [v1.0.2] - 2026-04-30
|
|
11
22
|
|
|
12
23
|
### Added
|
package/README.md
CHANGED
|
@@ -26,12 +26,17 @@ A client-side router library using `Navigation` & `URLPattern`
|
|
|
26
26
|
|
|
27
27
|
- [Code of Conduct](./.github/CODE_OF_CONDUCT.md)
|
|
28
28
|
- [Contributing](./.github/CONTRIBUTING.md)
|
|
29
|
-
|
|
29
|
+
- [Security Policy](./.github/SECURITY.md)
|
|
30
30
|
|
|
31
31
|
## Overview
|
|
32
32
|
|
|
33
33
|
This router intercepts same-origin navigations and resolves them to registered route modules. Each module can return content in multiple native formats (e.g. `Response`, `Document`, `Element`), allowing flexibility without imposing rendering constraints.
|
|
34
34
|
|
|
35
|
+
> [!IMPORTANT]
|
|
36
|
+
> This requires the [Navigation API](https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API), which is Baseline 2026.
|
|
37
|
+
> It also creates a [Trusted Types Policy](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API), where supported,
|
|
38
|
+
> labeled `"aegis-atlas#html"` for handling HTML responses without sanitizer restrictions.
|
|
39
|
+
|
|
35
40
|
Key characteristics:
|
|
36
41
|
|
|
37
42
|
- Native Navigation API (`navigation`)
|
|
@@ -42,11 +47,6 @@ Key characteristics:
|
|
|
42
47
|
- Optional preload observation
|
|
43
48
|
- Abort-safe lifecycle with `AbortController` and `DisposableStack`
|
|
44
49
|
|
|
45
|
-
> [!IMPORTANT]
|
|
46
|
-
> This requires the [Navigation API](https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API), which is Baseline 2026.
|
|
47
|
-
> It also creates a [Trusted Types Policy](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API), where supported,
|
|
48
|
-
> labeled `"aegis-atlas#html"` for handling HTML responses without sanitizer restrictions.
|
|
49
|
-
|
|
50
50
|
> [!TIP]
|
|
51
51
|
> Route module specifiers can use bare specifiers like `@acme/blog`. These can be resolved via an import map, for example:
|
|
52
52
|
>
|
|
@@ -61,7 +61,7 @@ Key characteristics:
|
|
|
61
61
|
> ```
|
|
62
62
|
>
|
|
63
63
|
> This allows modules to be loaded from a CDN without changing route definitions.
|
|
64
|
-
|
|
64
|
+
- - -
|
|
65
65
|
|
|
66
66
|
## Installation
|
|
67
67
|
|
|
@@ -73,7 +73,7 @@ import { init } from '@aegisjsproject/atlas';
|
|
|
73
73
|
|
|
74
74
|
No dependencies required.
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
- - -
|
|
77
77
|
|
|
78
78
|
## Core Concepts
|
|
79
79
|
|
|
@@ -84,9 +84,9 @@ Each route resolves to a module with the following shape:
|
|
|
84
84
|
```js
|
|
85
85
|
|
|
86
86
|
export default async function handler(request, context) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
return new Response('<h1>Hello</h1>', {
|
|
88
|
+
headers: { 'Content-Type': 'text/html' }
|
|
89
|
+
});
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
export const title = 'Page Title';
|
|
@@ -105,7 +105,7 @@ export const styles = new CSSStyleSheet();
|
|
|
105
105
|
- `description` (optional)
|
|
106
106
|
- `styles` (optional: `CSSStyleSheet` or array)
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
- - -
|
|
109
109
|
|
|
110
110
|
### Handler Return Types
|
|
111
111
|
|
|
@@ -115,7 +115,7 @@ Handlers may return:
|
|
|
115
115
|
- `Element`
|
|
116
116
|
- `DocumentFragment`
|
|
117
117
|
- `URL` (triggers navigation)
|
|
118
|
-
|
|
118
|
+
- - -
|
|
119
119
|
|
|
120
120
|
### Route Context
|
|
121
121
|
|
|
@@ -124,21 +124,21 @@ Each handler receives a `context` object:
|
|
|
124
124
|
```js
|
|
125
125
|
{
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
127
|
+
result, // URLPatternResult
|
|
128
|
+
params, // extracted route params
|
|
129
|
+
stack, // DisposableStack
|
|
130
|
+
controller, // AbortController
|
|
131
|
+
signal, // AbortSignal
|
|
132
|
+
type, // navigation type
|
|
133
|
+
url, // URL instance
|
|
134
|
+
state, // navigation state
|
|
135
|
+
info, // navigation info
|
|
136
|
+
timestamp // performance timestamp
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
- - -
|
|
142
142
|
|
|
143
143
|
## Usage
|
|
144
144
|
|
|
@@ -147,13 +147,13 @@ Each handler receives a `context` object:
|
|
|
147
147
|
```js
|
|
148
148
|
|
|
149
149
|
init({
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
'/': '/routes/home.js',
|
|
151
|
+
'/users/:id': '/routes/user.js'
|
|
152
|
+
'/posts/:year(\\d{4})/:month(\\d{2})/:day(\\d{2})/:slug': '@acme/blog',
|
|
153
|
+
'/product/:sku': '@acme/store/product',
|
|
154
154
|
}, {
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
root: 'app',
|
|
156
|
+
preload: true
|
|
157
157
|
});
|
|
158
158
|
|
|
159
159
|
```
|
|
@@ -164,7 +164,7 @@ init({
|
|
|
164
164
|
- `preload`: Enable preload observation
|
|
165
165
|
- `signal`: Optional `AbortSignal` for teardown
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
- - -
|
|
168
168
|
|
|
169
169
|
### Navigation Helpers
|
|
170
170
|
|
|
@@ -178,7 +178,7 @@ forward();
|
|
|
178
178
|
reload();
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
- - -
|
|
182
182
|
|
|
183
183
|
### Navigation Lifecycle
|
|
184
184
|
|
|
@@ -190,7 +190,7 @@ import { whenLoaded } from './router.js';
|
|
|
190
190
|
await whenLoaded();
|
|
191
191
|
```
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
- - -
|
|
194
194
|
|
|
195
195
|
## Behavior Details
|
|
196
196
|
|
|
@@ -202,7 +202,7 @@ Navigation is intercepted only if:
|
|
|
202
202
|
- URL is same-origin
|
|
203
203
|
- Triggering element does **not** have `.no-router`
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
- - -
|
|
206
206
|
|
|
207
207
|
### Content Handling
|
|
208
208
|
|
|
@@ -227,7 +227,7 @@ Navigation is intercepted only if:
|
|
|
227
227
|
|
|
228
228
|
- Triggers navigation
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
- - -
|
|
231
231
|
|
|
232
232
|
### Root Management
|
|
233
233
|
|
|
@@ -245,7 +245,7 @@ If root is `<body>`, full body is replaced.
|
|
|
245
245
|
|
|
246
246
|
If root is an element with `id`, only matching subtree is replaced.
|
|
247
247
|
|
|
248
|
-
|
|
248
|
+
- - -
|
|
249
249
|
|
|
250
250
|
### Metadata Updates
|
|
251
251
|
|
|
@@ -258,7 +258,7 @@ Route modules can define:
|
|
|
258
258
|
- `twitter:description`
|
|
259
259
|
- `styles` → appended to `document.adoptedStyleSheets`
|
|
260
260
|
|
|
261
|
-
|
|
261
|
+
- - -
|
|
262
262
|
|
|
263
263
|
### Form Handling
|
|
264
264
|
|
|
@@ -266,7 +266,7 @@ Route modules can define:
|
|
|
266
266
|
- Submits `FormData` when applicable
|
|
267
267
|
- Uses `Request` API for consistency
|
|
268
268
|
|
|
269
|
-
|
|
269
|
+
- - -
|
|
270
270
|
|
|
271
271
|
### Abort + Cleanup
|
|
272
272
|
|
|
@@ -278,7 +278,7 @@ Each navigation:
|
|
|
278
278
|
|
|
279
279
|
Handlers should respect `context.signal` where applicable.
|
|
280
280
|
|
|
281
|
-
|
|
281
|
+
- - -
|
|
282
282
|
|
|
283
283
|
### Trusted Types
|
|
284
284
|
|
|
@@ -296,18 +296,18 @@ This ensures CSP compatibility without stripping critical markup like:
|
|
|
296
296
|
- inline event handlers
|
|
297
297
|
- form attributes
|
|
298
298
|
|
|
299
|
-
|
|
299
|
+
- - -
|
|
300
300
|
|
|
301
301
|
## Example Route
|
|
302
302
|
|
|
303
303
|
```js
|
|
304
304
|
|
|
305
305
|
export default async function(request, { params }) {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
306
|
+
return new Response(`
|
|
307
|
+
<h1>User ${params.id}</h1>
|
|
308
|
+
`, {
|
|
309
|
+
headers: { 'Content-Type': 'text/html' }
|
|
310
|
+
});
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
export const title = 'User Profile';
|
|
@@ -315,7 +315,7 @@ export const description = 'User details page';
|
|
|
315
315
|
|
|
316
316
|
```
|
|
317
317
|
|
|
318
|
-
|
|
318
|
+
- - -
|
|
319
319
|
|
|
320
320
|
## Notes
|
|
321
321
|
|
|
@@ -324,7 +324,7 @@ export const description = 'User details page';
|
|
|
324
324
|
- Errors during routing are surfaced via `reportError`
|
|
325
325
|
- Designed for modern browsers with Navigation API support
|
|
326
326
|
|
|
327
|
-
|
|
327
|
+
- - -
|
|
328
328
|
|
|
329
329
|
## Summary
|
|
330
330
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aegisjsproject/atlas",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A client-side router library using `Navigation` & `URLPattern`",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"router",
|
|
@@ -85,13 +85,16 @@
|
|
|
85
85
|
},
|
|
86
86
|
"homepage": "https://github.com/AegisJSProject/atlas#readme",
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@aegisjsproject/dev-server": "^1.0
|
|
89
|
-
"@aegisjsproject/http-utils": "^1.0
|
|
88
|
+
"@aegisjsproject/dev-server": "^1.1.0",
|
|
89
|
+
"@aegisjsproject/http-utils": "^1.1.0",
|
|
90
90
|
"@rollup/plugin-terser": "^1.0.0",
|
|
91
|
-
"@shgysk8zer0/eslint-config": "^1.0
|
|
92
|
-
"@shgysk8zer0/http-server": "^1.
|
|
93
|
-
"@shgysk8zer0/importmap": "^1.
|
|
94
|
-
"eslint": "^10.
|
|
95
|
-
"rollup": "^4.
|
|
91
|
+
"@shgysk8zer0/eslint-config": "^1.1.0",
|
|
92
|
+
"@shgysk8zer0/http-server": "^1.2.0",
|
|
93
|
+
"@shgysk8zer0/importmap": "^1.10.2",
|
|
94
|
+
"eslint": "^10.5.0",
|
|
95
|
+
"rollup": "^4.62.2"
|
|
96
|
+
},
|
|
97
|
+
"allowScripts": {
|
|
98
|
+
"fsevents@2.3.3": true
|
|
96
99
|
}
|
|
97
100
|
}
|