Update to ES2025, expand npm package exports, enhance TypeDoc coverage#1492
Update to ES2025, expand npm package exports, enhance TypeDoc coverage#1492
Conversation
🏷️ Automatic Labeling SummaryThis PR has been automatically labeled based on the files changed and PR metadata. Applied Labels: size-xs Label Categories
For more information, see |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…als; expand npm package to include all src/browser and scripts modules Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/825d2258-e360-4dd9-a4d0-cc276e74d4b5 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…cture docs, add js/ and dashboard/ entry points, add highlightLanguages, expand block tags and sidebar links Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/825d2258-e360-4dd9-a4d0-cc276e74d4b5 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…w feedback) Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/825d2258-e360-4dd9-a4d0-cc276e74d4b5 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
There was a problem hiding this comment.
Pull request overview
Updates project configuration to target ES2025 across TypeScript/ESLint/TypeDoc, expands the published npm surface (browser modules + compiled scripts), and broadens TypeDoc generation to include additional JS/dashboard sources and key project documents.
Changes:
- Bumped TypeScript targets/libs across multiple
tsconfigfiles toES2025and updated ESLint globals accordingly. - Expanded npm package
exportsand build output to include additional browser subpaths plus compiledscripts/*. - Enhanced TypeDoc configuration to document
js/,dashboard/, and a larger set of project documents, plus additional block tags and syntax highlighting languages.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| typedoc.json | Adds new entry points, project documents, tags, sidebar links, and highlight languages for richer TypeDoc output. |
| tsconfig.typedoc.json | Updates TS target/lib and includes additional JS sources for TypeDoc compilation. |
| tsconfig.scripts.json | Updates TS target/lib to ES2025 for scripts compilation config. |
| tsconfig.npm-scripts.json | New tsconfig for compiling script modules to dist/scripts for npm publication. |
| tsconfig.lib.json | Widens library build root/include from src/browser/shared to all of src/browser and updates target/lib. |
| tsconfig.browser.json | Updates browser TS target/lib to ES2025. |
| scripts/article-template/registry.ts | Updates doc comment to reflect ES2025 target. |
| package.json | Expands package exports and build steps; adjusts main/types to shared entrypoint and publishes dist/scripts. |
| eslint.config.js | Updates configured ECMAScript globals set from es2021 to es2025. |
| @@ -17,16 +17,15 @@ | |||
| "forceConsistentCasingInFileNames": true, | |||
| "skipLibCheck": true, | |||
| "outDir": "./dist/lib", | |||
| "rootDir": "./src/browser/shared", | |||
| "lib": ["ES2024", "DOM", "DOM.Iterable"], | |||
| "rootDir": "./src/browser", | |||
| "lib": ["ES2025", "DOM", "DOM.Iterable"], | |||
| "types": [] | |||
| }, | |||
There was a problem hiding this comment.
package.json now exposes TypeScript typings for dist/lib/** (e.g. dist/lib/shared/index.d.ts, dist/lib/cia/*.d.ts, etc.), but tsconfig.lib.json does not enable declaration emit (compilerOptions.declaration). As a result, npm run build:lib will not generate the .d.ts files referenced by the package types/exports.types, breaking TypeScript consumers.
Enable declaration output for the library build (e.g. set declaration: true (and optionally declarationMap) in tsconfig.lib.json), or adjust the package export/type paths to match what is actually emitted.
|
@copilot apply changes based on the comments in this thread |
The reviewer's comment is a false positive — |
| "scripts/coalition-dashboard.ts", | ||
| "scripts/coalition-dashboard", | ||
| "scripts/committees-dashboard.ts", | ||
| "scripts/committees-dashboard", | ||
| "scripts/back-to-top.ts", |
There was a problem hiding this comment.
The new ./scripts/* export pattern advertises that any riksdagsmonitor/scripts/<subpath> can be imported, but tsconfig.npm-scripts.json excludes several .ts entrypoints/directories (e.g. scripts/coalition-dashboard.ts, scripts/committees-dashboard.ts, scripts/back-to-top.ts). Those excluded files won’t be emitted into dist/scripts, so consumers importing those subpaths will hit missing-module errors. Align the exports surface with what actually gets built (either stop excluding these from the npm-scripts build, or avoid exporting a wildcard that covers excluded modules).
| "scripts/coalition-dashboard.ts", | |
| "scripts/coalition-dashboard", | |
| "scripts/committees-dashboard.ts", | |
| "scripts/committees-dashboard", | |
| "scripts/back-to-top.ts", |
| "main": "dist/lib/shared/index.js", | ||
| "types": "dist/lib/shared/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "import": "./dist/lib/index.js", | ||
| "types": "./dist/lib/index.d.ts" | ||
| "import": "./dist/lib/shared/index.js", | ||
| "types": "./dist/lib/shared/index.d.ts" | ||
| }, | ||
| "./shared": { | ||
| "import": "./dist/lib/shared/index.js", | ||
| "types": "./dist/lib/shared/index.d.ts" | ||
| }, | ||
| "./cia/*": { | ||
| "import": "./dist/lib/cia/*.js", | ||
| "types": "./dist/lib/cia/*.d.ts" | ||
| }, | ||
| "./dashboards/*": { | ||
| "import": "./dist/lib/dashboards/*.js", | ||
| "types": "./dist/lib/dashboards/*.d.ts" | ||
| }, | ||
| "./ui/*": { | ||
| "import": "./dist/lib/ui/*.js", | ||
| "types": "./dist/lib/ui/*.d.ts" | ||
| }, | ||
| "./scripts/*": { | ||
| "import": "./dist/scripts/*.js", | ||
| "types": "./dist/scripts/*.d.ts" | ||
| } | ||
| }, |
There was a problem hiding this comment.
PR description says the npm package export surface is expanding to the full browser module set (31 modules after widening rootDir to src/browser), but exports only exposes shared, cia/*, dashboards/*, ui/*, and omits the root-level browser modules that will now be built into dist/lib (e.g. src/browser/main.ts, src/browser/lazy-loader.ts, src/browser/cia-entry.ts). If those are meant to be part of the public surface, add explicit subpath exports for them (or otherwise exclude them from the lib build to keep the published surface consistent with the intended API).
| }, | ||
| "./scripts/*": { | ||
| "import": "./dist/scripts/*.js", | ||
| "types": "./dist/scripts/*.d.ts" |
There was a problem hiding this comment.
The package now exports browser modules like ./cia/* / ./dashboards/* which (via shared/chart-factory and cia/visualizations) rely on globalThis.Chart being available, but the helper that sets these globals (src/browser/shared/register-globals.ts) is not exported (and isn’t re-exported by shared/index.ts). This makes it hard for external consumers to correctly initialize the exported browser modules. Consider exporting a public init/registration entry (e.g. a ./shared/register-globals subpath export, or re-exporting it from shared/index) so consumers can opt into the supported initialization flow.
| "types": "./dist/scripts/*.d.ts" | |
| "types": "./dist/scripts/*.d.ts" | |
| }, | |
| "./shared/register-globals": { | |
| "import": "./dist/lib/shared/register-globals.js", | |
| "types": "./dist/lib/shared/register-globals.d.ts" |
|
@copilot apply changes based on the comments in this thread |
…gister-globals export Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/c0040b92-af53-4f01-80ed-0ae5ed93133a Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Applied all three review comments in
|
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
Project targets ES2024 but runs on Node 25 — upgrade to ES2025 across all config. npm package only ships
src/browser/shared(8 modules) — expand to full browser + scripts surface. TypeDoc covers onlysrc/browserandscripts— addjs/,dashboard/, and project documents.ES2025 target
target+lib→ES2025eslint.config.js:globals.es2021→globals.es2025(3 instances)scripts/article-template/registry.tsnpm package expansion
tsconfig.lib.json:rootDirwidened fromsrc/browser/shared→src/browser; app entry points (main.ts,lazy-loader.ts,cia-entry.ts) excluded from lib build since they are not library modulestsconfig.npm-scripts.json: compiles script modules todist/scripts(browser IIFE entry points and Playwright tests excluded as they require DOM types)declaration: trueanddeclarationMap: trueenabled in both lib configs for full.d.tsemit./shared/register-globalsso consumers can initializeglobalThis.Chart/d3/Papabefore using cia/dashboard modules:build:libnow runs bothtsc -p tsconfig.lib.json && tsc -p tsconfig.npm-scripts.jsonTypeDoc improvements
entryPoints: addedjs/anddashboard/directoriesprojectDocuments: 17 ISMS/security/architecture markdown files rendered inlineblockTags:@isms,@iso27001,@nist,@cis,@architecture,@threatmodel,@datamodel,@mcp,@riksdag,@editorial,@i18n,@accessibilityhighlightLanguages: mermaid, graphql, sql addedtsconfig.typedoc.json: includesjs/**/*.js,dashboard/**/*.jsModule resolution (no change needed)
The issue mentions
"module": "Node16"/"moduleResolution": "Node16"— the project already uses"module": "ESNext"+"moduleResolution": "bundler", which is the correct choice for Vite-based projects on Node 25+.