Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
if: ${{ github.event_name == 'pull_request' || steps.release.outputs.release_created }}
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24
registry-url: "https://registry.npmjs.org"
scope: "@hpcc-js"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
node-version: 24
registry-url: "https://registry.npmjs.org"
scope: "@hpcc-js"
- run: npm ci
Expand Down
571 changes: 275 additions & 296 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"test-node": "vitest run --project node",
"test-node-esm": "cd tests/node-esm && npm i && npm test",
"test-node-cjs": "cd tests/node-cjs && npm i && npm test",
"test-type-leaks": "cd tests/type-leaks && npm i && npm test",
"test": "lerna run test",
"test-all": "vitest run",
"publish": "lerna publish from-package --yes",
Expand Down
2 changes: 1 addition & 1 deletion packages/dgrid-shim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"webpack": "5.98.0",
"webpack-cli": "5.1.4",
"webpack-hasjs-plugin": "1.0.4",
"dojo-webpack-plugin": "3.0.6",
"dojo-webpack-plugin": "3.0.9",
"terser-webpack-plugin": "5.3.14"
},
"repository": {
Expand Down
6 changes: 3 additions & 3 deletions packages/esbuild-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"dependencies": {
"@hpcc-js/wasm-base91": "1.3.1",
"@hpcc-js/wasm-zstd": "1.2.1",
"esbuild": "0.25.2",
"esbuild": "0.25.5",
"esbuild-plugin-umd-wrapper": "3.0.0",
"esbuild-copy-static-files": "0.1.0",
"esbuild-plugin-inline-css": "0.0.1",
"fzstd": "0.1.1",
"vite": "6.3.5",
"vite": "7.0.0",
"vite-plugin-css-injected-by-js": "3.5.2",
"vite-plugin-static-copy": "3.0.2"
"vite-plugin-static-copy": "3.1.0"
},
"keywords": [
"esbuild",
Expand Down
8 changes: 5 additions & 3 deletions packages/markdown-it-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,18 @@
"dependencies": {
"@hpcc-js/observablehq-compiler": "^3.3.2",
"@observablehq/framework": "1.13.2",
"@observablehq/runtime": "5.9.9"
"@observablehq/runtime": "5.9.9",
"@types/markdown-it": "14.1.2"
},
"peerDependencies": {
"markdown-it": "14.1.0"
},
"devDependencies": {
"@hpcc-js/esbuild-plugins": "^1.4.2",
"@types/markdown-it": "14.1.2",
"apache-arrow": "19.0.1",
"d3-dsv": "3.0.1",
"d3-fetch": "3.0.1",
"dotenv": "16.4.7",
"markdown-it": "14.1.0",
"shiki": "2.5.0",
"tsx": "4.19.3"
},
Expand Down
68 changes: 68 additions & 0 deletions tests/type-leaks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Type Dependencies Test

This test suite validates that packages in the HPCC Visualization Framework monorepo do not reference types from third-party libraries unless those libraries are explicitly declared as dependencies or peerDependencies in their `package.json`.

## Purpose

- **Prevents runtime errors**: Ensures that all external type dependencies are properly declared
- **Improves maintainability**: Makes it clear which external libraries each package depends on
- **Enforces consistency**: Ensures all packages follow the same dependency declaration patterns

## What it checks

1. **TypeScript type files**: Scan `index.d.ts`, `index.node.d.ts`, `index.browser.d.ts` files in each package's `types/` directory
2. **Import statements**: Analyzes `import` and `from` statements to find external dependencies
3. **Type imports**: Specifically looks for type-only imports and type references
4. **Dependency validation**: Checks that referenced packages are in the `dependencies` section of `package.json`

## Exclusions

The test ignores:
- **Built-in Node.js modules**: `fs`, `path`, `util`, etc.
- **TypeScript built-ins**: `typescript`, `@types/node`
- **Internal packages**: All `@hpcc-js/*` packages
- **Relative imports**: Local file imports starting with `./` or `../`
- **Dev dependencies**: Types only used in tests or build scripts

## Running the tests

```bash
# From the root directory
npm run test --workspace tests/type-leaks

# Or directly in the types directory
cd tests/type-leaks
npm test
```

## Example violations

If a package imports from `lodash` but doesn't have it in dependencies:

```typescript
// ❌ Violation - lodash not in dependencies
import { debounce } from 'lodash';

// ✅ Correct - lodash in dependencies section of package.json
{
"dependencies": {
"lodash": "^4.17.21"
}
}
```

## Type-only imports

For type-only dependencies, you can use:

```typescript
// Type-only import (still requires dependency declaration)
import type { SomeType } from 'external-library';

// Or in dependencies as a peer dependency for types
{
"peerDependencies": {
"external-library": "^1.0.0"
}
}
```
15 changes: 15 additions & 0 deletions tests/type-leaks/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "test-types",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"test": "vitest run"
},
"devDependencies": {
"@typescript-eslint/typescript-estree": "^8.29.0",
"glob": "^11.0.0",
"typescript": "^5.8.3",
"vitest": "^3.2.4"
}
}
Loading