├── .editorconfig ├── .github ├── release-please │ ├── config.json │ └── manifest.json └── workflows │ ├── codeql-analysis.yml │ ├── compliance.yml │ ├── dependency-review.yml │ ├── lint.yml │ ├── nodejs.yml │ ├── release-please.yml │ └── types.yml ├── .gitignore ├── .husky ├── commit-msg └── pre-push ├── .knip.jsonc ├── .npmrc ├── CHANGELOG.md ├── LICENSE ├── README.md ├── declaration.tsconfig.json ├── eslint.config.mjs ├── index.d.mts ├── index.d.ts ├── index.js ├── index.mjs ├── index.test-d.ts ├── lib ├── element-types.d.ts ├── htm.js ├── react-utils.js ├── render-utils.mjs ├── render.js ├── util-types.d.ts └── utils.js ├── package.json ├── renovate.json ├── test ├── fixtures.js ├── html.spec.js ├── render-basic.spec.js └── render-complex.spec.js └── tsconfig.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | indent_style = space 7 | indent_size = 2 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.github/release-please/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/googleapis/release-please/v16.12.0/schemas/config.json", 3 | "release-type": "node", 4 | "include-component-in-tag": false, 5 | "changelog-sections": [ 6 | { "type": "feat", "section": "🌟 Features", "hidden": false }, 7 | { "type": "fix", "section": "🩹 Fixes", "hidden": false }, 8 | { "type": "docs", "section": "📚 Documentation", "hidden": false }, 9 | 10 | { "type": "chore", "section": "🧹 Chores", "hidden": false }, 11 | { "type": "perf", "section": "🧹 Chores", "hidden": false }, 12 | { "type": "refactor", "section": "🧹 Chores", "hidden": false }, 13 | { "type": "test", "section": "🧹 Chores", "hidden": false }, 14 | 15 | { "type": "build", "section": "🤖 Automation", "hidden": false }, 16 | { "type": "ci", "section": "🤖 Automation", "hidden": true } 17 | ], 18 | "packages": { 19 | ".": {} 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.github/release-please/manifest.json: -------------------------------------------------------------------------------- 1 | {".":"3.0.2"} 2 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | schedule: 9 | - cron: '24 4 * * 2' 10 | 11 | permissions: 12 | actions: read 13 | contents: read 14 | security-events: write 15 | 16 | jobs: 17 | analyze: 18 | uses: voxpelli/ghatemplates/.github/workflows/codeql-analysis.yml@main 19 | -------------------------------------------------------------------------------- /.github/workflows/compliance.yml: -------------------------------------------------------------------------------- 1 | name: Compliance 2 | 3 | on: 4 | pull_request_target: 5 | types: [opened, edited, reopened] 6 | 7 | permissions: 8 | pull-requests: write 9 | 10 | jobs: 11 | compliance: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: mtfoley/pr-compliance-action@11b664f0fcf2c4ce954f05ccfcaab6e52b529f86 15 | with: 16 | body-auto-close: false 17 | body-regex: '.*' 18 | ignore-authors: | 19 | renovate 20 | renovate[bot] 21 | ignore-team-members: false 22 | -------------------------------------------------------------------------------- /.github/workflows/dependency-review.yml: -------------------------------------------------------------------------------- 1 | name: 'Dependency Review' 2 | 3 | on: [pull_request] 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | dependency-review: 10 | uses: voxpelli/ghatemplates/.github/workflows/dependency-review.yml@main 11 | 12 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Linting 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | tags: 8 | - '*' 9 | pull_request: 10 | branches: 11 | - main 12 | 13 | permissions: 14 | contents: read 15 | 16 | jobs: 17 | lint: 18 | uses: voxpelli/ghatemplates/.github/workflows/lint.yml@main 19 | types: 20 | needs: [lint] 21 | uses: ./.github/workflows/types.yml 22 | -------------------------------------------------------------------------------- /.github/workflows/nodejs.yml: -------------------------------------------------------------------------------- 1 | name: Node CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | tags: 8 | - '*' 9 | pull_request: 10 | branches: 11 | - main 12 | 13 | permissions: 14 | contents: read 15 | 16 | jobs: 17 | test: 18 | uses: voxpelli/ghatemplates/.github/workflows/test.yml@main 19 | with: 20 | node-versions: '18,20,22' 21 | -------------------------------------------------------------------------------- /.github/workflows/release-please.yml: -------------------------------------------------------------------------------- 1 | name: Release Please 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | permissions: 9 | contents: write 10 | id-token: write 11 | packages: write 12 | pull-requests: write 13 | 14 | jobs: 15 | release-please: 16 | uses: voxpelli/ghatemplates/.github/workflows/release-please-4.yml@main 17 | secrets: inherit 18 | -------------------------------------------------------------------------------- /.github/workflows/types.yml: -------------------------------------------------------------------------------- 1 | name: Type Checks 2 | 3 | on: 4 | workflow_call: 5 | workflow_dispatch: 6 | schedule: 7 | - cron: '14 5 * * 1,3,5' 8 | 9 | permissions: 10 | contents: read 11 | 12 | jobs: 13 | type-check: 14 | uses: voxpelli/ghatemplates/.github/workflows/type-check.yml@main 15 | with: 16 | ts-prebuild-script: 'build' 17 | ts-versions: ${{ github.event.schedule && 'next' || '5.6,next' }} 18 | ts-libs: 'es2022;esnext' 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Basic ones 2 | /coverage 3 | /docs 4 | /node_modules 5 | /.env 6 | /.nyc_output 7 | 8 | # We're a library, so please, no lock files 9 | /package-lock.json 10 | /yarn.lock 11 | 12 | # Generated types 13 | *.d.ts 14 | *.d.ts.map 15 | *.d.mts 16 | *.d.mts.map 17 | !/lib/**/*-types.d.ts 18 | !/index.d.ts 19 | !/index.d.mts 20 | 21 | # Library specific ones 22 | /lib/render.mjs 23 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | 2 | npx --no validate-conventional-commit < .git/COMMIT_EDITMSG 3 | -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | 2 | npm test 3 | -------------------------------------------------------------------------------- /.knip.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/knip@5/schema.json", 3 | "ignore": ["index.test-d.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [3.0.2](https://github.com/voxpelli/async-htm-to-string/compare/v3.0.1...v3.0.2) (2024-10-02) 4 | 5 | 6 | ### 🩹 Fixes 7 | 8 | * handle nested array values ([a469cdf](https://github.com/voxpelli/async-htm-to-string/commit/a469cdff7db27600cb4534a239ba40fbd3eab79b)) 9 | 10 | 11 | ### 🧹 Chores 12 | 13 | * **deps:** update dependency sinon to v19 ([#100](https://github.com/voxpelli/async-htm-to-string/issues/100)) ([0f5c1b6](https://github.com/voxpelli/async-htm-to-string/commit/0f5c1b6ce661af044e3ff200f5ce48da85dcc6d6)) 14 | * **deps:** update dev dependencies ([6bd5be8](https://github.com/voxpelli/async-htm-to-string/commit/6bd5be8d20d1e3496fe396eef4fb977bd5ce5b13)) 15 | * **deps:** update dev dependencies ([13de112](https://github.com/voxpelli/async-htm-to-string/commit/13de112b2383223d2e900f595cbbd56cd07a8796)) 16 | * **deps:** update dev dependencies ([668f437](https://github.com/voxpelli/async-htm-to-string/commit/668f437ab14907143619c7711300d68f299587cb)) 17 | * fix failing voxpelli/tsconfig integration ([2a3b9f3](https://github.com/voxpelli/async-htm-to-string/commit/2a3b9f3845fe67ed44d27bccce0eb7bd8e0f9415)) 18 | 19 | ## [3.0.1](https://github.com/voxpelli/async-htm-to-string/compare/v3.0.0...v3.0.1) (2024-07-19) 20 | 21 | 22 | ### 🧹 Chores 23 | 24 | * clean up leftover `linemod` stuff ([20cb561](https://github.com/voxpelli/async-htm-to-string/commit/20cb561b220a55a8159b65d1e49877cc5933857f)) 25 | * **deps:** update dependency @types/node to ^18.19.41 ([#99](https://github.com/voxpelli/async-htm-to-string/issues/99)) ([10e2748](https://github.com/voxpelli/async-htm-to-string/commit/10e2748b2ba64541f9a6e73e412d73dbf63eaa56)) 26 | * **deps:** update dependency chai-as-promised to ^7.1.2 ([#96](https://github.com/voxpelli/async-htm-to-string/issues/96)) ([2ca97cf](https://github.com/voxpelli/async-htm-to-string/commit/2ca97cf409876ed8ae65d151cf4d1ac449d69487)) 27 | * improve types ([1e60f45](https://github.com/voxpelli/async-htm-to-string/commit/1e60f45c7f14fdeb240ac9c54bd46b522b35599e)) 28 | * less `any` ([a5940dd](https://github.com/voxpelli/async-htm-to-string/commit/a5940dd15cf5f2927ae5c6201c3972f732e7cf65)) 29 | * make use of `buffered-async-iterable` ([9cdf3a7](https://github.com/voxpelli/async-htm-to-string/commit/9cdf3a71235da8d718f354264383b0c4f47a220c)) 30 | * simplify bufferedAsyncMap call ([37af84e](https://github.com/voxpelli/async-htm-to-string/commit/37af84e6e75da4f128afad6e135b41b4c78e7379)) 31 | * split into different files ([91e2d91](https://github.com/voxpelli/async-htm-to-string/commit/91e2d9125a583447a7f354fca6cd7ab2bca548f0)), closes [#103](https://github.com/voxpelli/async-htm-to-string/issues/103) 32 | 33 | ## [3.0.0](https://github.com/voxpelli/async-htm-to-string/compare/v2.1.1...v3.0.0) (2024-07-18) 34 | 35 | 36 | ### ⚠ BREAKING CHANGES 37 | 38 | * drop Node 16 (as its EOL) 39 | 40 | ### 🧹 Chores 41 | 42 | * **deps:** update dev dependencies ([417aeaa](https://github.com/voxpelli/async-htm-to-string/commit/417aeaa13414689e98319e53ac6b6b924caa4df2)) 43 | * drop Node 16 (as its EOL) ([3aaeb85](https://github.com/voxpelli/async-htm-to-string/commit/3aaeb85548fc6042c2d417b1522c07df50f6e06b)) 44 | * use neostandard based linting ([35f6a0b](https://github.com/voxpelli/async-htm-to-string/commit/35f6a0bf637a0cb807b1fc2cec7fd15d52ecc66a)) 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD Zero Clause License (0BSD) 2 | 3 | Copyright (c) 2020 Pelle Wessman 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 9 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 11 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 13 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14 | PERFORMANCE OF THIS SOFTWARE. 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # async-htm-to-string 2 | 3 | Renders a [`htm`](https://www.npmjs.com/package/htm) tagged template asyncly into a string. 4 | 5 | [](https://www.npmjs.com/package/async-htm-to-string) 6 | [](https://www.npmjs.com/package/async-htm-to-string) 7 | [](https://github.com/voxpelli/badges-cjs-esm) 8 | [](https://github.com/voxpelli/types-in-js) 9 | [](https://github.com/neostandard/neostandard) 10 | [](https://mastodon.social/@voxpelli) 11 | 12 | ## Usage 13 | 14 | ### Simple 15 | 16 | ```bash 17 | npm install async-htm-to-string 18 | ``` 19 | 20 | ```javascript 21 | const { html, renderToString } = require('async-htm-to-string'); 22 | 23 | const customTag = ({ prefix }, children) => html`