Files
directus/packages/utils/node/process-id.ts
Nitwel 3c2efc1fb6 Improve build times using tsdown’s oxc-transform (#26604)
* start supporting isolatedDeclarations

* add errors and storage package

* add utils, and storage-driver-local

* fix rest of packages

* fix types/collab import

* hardcode "isolatedDeclarations": true in all configs for now

* Revert "hardcode "isolatedDeclarations": true in all configs for now"

This reverts commit ac71582159.

* fix formatting

* undo readme change

* remove link

* fix lockfile

* dont do a js string cast here I guess

* use tsc over tsdown because of failing tests

* last fixes

* use tsdown --clean instead of rimraf

* fmt and fixes

* re add weird space

* add run as entry

* undo api using tsdown

* switch back to tsdown again now with unbundle 🥳

* more ts fixes

* build with tsdown in @directus/themes

* fix bb tests

* undo spaces

* another space

* fix collab import

* add changeset

* Apply suggestion from @ComfortablyCoding

* Apply suggestion from @ComfortablyCoding

* Update .changeset/hungry-yaks-enter.md

Co-authored-by: judda <44623501+ComfortablyCoding@users.noreply.github.com>

---------

Co-authored-by: judda <44623501+ComfortablyCoding@users.noreply.github.com>
2026-03-11 14:56:12 -04:00

20 lines
519 B
TypeScript

import { createHash } from 'node:crypto';
import { hostname } from 'node:os';
export const _cache: { id: string | undefined } = { id: undefined };
/**
* Return a unique hash for the current process on the current machine. Will be different after a
* restart
*/
export const processId = (): string => {
if (_cache.id) return _cache.id;
const parts = [hostname(), process.pid, new Date().getTime()];
const hash = createHash('md5').update(parts.join(''));
_cache.id = hash.digest('hex');
return _cache.id;
};