{"id":16906108,"url":"https://github.com/tylors/typed-content-hash","last_synced_at":"2025-10-24T04:37:11.088Z","repository":{"id":39989514,"uuid":"326544950","full_name":"TylorS/typed-content-hash","owner":"TylorS","description":"Rewrite your HTML/JS/CSS (and sourceMap!) files with SHA-512 content hashes","archived":false,"fork":false,"pushed_at":"2023-03-05T18:42:18.000Z","size":773,"stargazers_count":12,"open_issues_count":8,"forks_count":3,"subscribers_count":3,"default_branch":"development","last_synced_at":"2024-12-28T19:12:54.897Z","etag":null,"topics":["assets","cli","content-hash","hashing","sha512","sourcemaps","static-files"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TylorS.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-04T02:10:35.000Z","updated_at":"2023-10-24T18:44:35.000Z","dependencies_parsed_at":"2024-06-19T02:41:35.196Z","dependency_job_id":"1b091dbc-c527-4e64-8b8a-b3ef7f4ca71c","html_url":"https://github.com/TylorS/typed-content-hash","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylorS%2Ftyped-content-hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylorS%2Ftyped-content-hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylorS%2Ftyped-content-hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylorS%2Ftyped-content-hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TylorS","download_url":"https://codeload.github.com/TylorS/typed-content-hash/tar.gz/refs/heads/development","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233707352,"owners_count":18717422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assets","cli","content-hash","hashing","sha512","sourcemaps","static-files"],"created_at":"2024-10-13T18:41:04.336Z","updated_at":"2025-09-21T03:31:37.377Z","avatar_url":"https://github.com/TylorS.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @typed/content-hash\n\nRewrite a directory of static files with SHA-512 content hashes, with first-class support for source maps, and generate an asset manifest reflecting the filename changes.\n\n## Features \n\n- SHA-512 Content Hashes, with configurable length.\n- Deterministic, content-based hashes.\n  - Supports circular dependencies!\n- [TypeScript API](#API), with a simple plugin API.\n- Generates an Asset Manifest as JSON \n- Simple CLI\n- [Generates](https://github.com/Rich-Harris/magic-string) and [remaps](https://github.com/ampproject/remapping) SourceMaps\n\n## CLI\n\n```sh\n$ typed-content-hash --dir build\n\nOptions:\n      --version           Show version number                          [boolean]\n      --directory, --dir  The directory to apply content hashes\n                                                             [string] [required]\n      --assetManifest     Filename of asset manifest JSON\n                                       [string] [default: \"asset-manifest.json\"]\n  -h, --hashLength        Number of characters to slice from SHA-512 hash\n                                                                        [number]\n      --tsConfig          Relative path to tsconfig from CWD\n                                             [string] [default: \"tsconfig.json\"]\n      --baseUrl           Base URL to use when rewriting imports/exports[string]\n      --logLevel  [string] [choices: \"debug\", \"info\", \"error\"] [default: \"info\"]\n      --registryFile      Configure where to write Document Registry to JSON.\n                          Useful for debugging                          [string]\n      --sourceMaps                                     [boolean] [default: true]\n      --mainFields        Configure package.json fields to look for dependencies\n                                                   [array] [default: [\"module\"]]\n      --help              Show help                                    [boolean]\n```\n\n## API \n\nFor the moment `contentHashDirectory` is the main API function you'd be interested in using. The CLI is a small wrapper around running just this function. \n\nThere is a plugin API available to expand support to additional file extensions besides the default supported files. If you're interested in this take a look at `src/content-hashes/infrastructure/plugins` for examples of\nthe default plugins.\n\n### contentHashDirectory :: ContentHashOptions -\u003e Promise DocumentRegistry\n\n#### Basic Example\n\n```typescript\nimport { contentHashDirectory, createDefaultPlugins } from '@typed/content-hash'\nimport { join } from 'path'\n\nasync function main() {\n  const registry: DocumentRegistry = await contentHashDirectory({ \n    directory: '/path/to/directory', \n    plugins: createDefaultPlugins({ buildDirectory: '/path/to/directory' })  \n  })\n}\n\nmain()\n```\n\n## Discussions\n\nWe've enabled [Github Discussions](https://github.com/TylorS/typed-content-hash/discussions) if you would ever like to reach out about anything related to the project!\n\n\n## Related Projects\n\n- [snowpack-plugin-hash](https://github.com/TylorS/snowpack-plugin-hash) - Uses library","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftylors%2Ftyped-content-hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftylors%2Ftyped-content-hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftylors%2Ftyped-content-hash/lists"}