From 3165a2538a7e8c1b7963786e996776647032e2b1 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Sun, 15 Dec 2024 15:42:42 +0000 Subject: [PATCH 1/2] fix(html): types for plugin (#1264) * fix(html): Correct types for the template function - Make templateoptions non-optional - Allow template to return a Promise Also adds type annotations to the implementation to ensure the types are more consistent. * chore: correct types after bad conflict resolve --------- Co-authored-by: Andrew Powell Co-authored-by: shellscape --- packages/html/src/index.ts | 9 +++------ packages/html/types/index.d.ts | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/html/src/index.ts b/packages/html/src/index.ts index c22650057..59d74bfcd 100644 --- a/packages/html/src/index.ts +++ b/packages/html/src/index.ts @@ -70,7 +70,7 @@ const defaultTemplate = async ({ const supportedFormats = ['es', 'esm', 'iife', 'umd']; -const defaults = { +const defaults: Required = { attributes: { link: null, html: { lang: 'en' }, @@ -84,11 +84,8 @@ const defaults = { }; export default function html(opts: RollupHtmlOptions = {}): Plugin { - const { attributes, fileName, meta, publicPath, template, title } = Object.assign( - {}, - defaults, - opts - ); + const { attributes, fileName, meta, publicPath, template, title }: Required = + Object.assign({}, defaults, opts); return { name: 'html', diff --git a/packages/html/types/index.d.ts b/packages/html/types/index.d.ts index 715e9a03c..0b73a54f6 100644 --- a/packages/html/types/index.d.ts +++ b/packages/html/types/index.d.ts @@ -15,7 +15,7 @@ export interface RollupHtmlOptions { fileName?: string; meta?: Record[]; publicPath?: string; - template?: (templateoptions: RollupHtmlTemplateOptions) => string; + template?: (templateoptions: RollupHtmlTemplateOptions) => string | Promise; } export function makeHtmlAttributes(attributes: Record): string; From 8670bdb6a6801c6be1bf7d168d8ada8b8766ec6f Mon Sep 17 00:00:00 2001 From: Release Workflow Date: Sun, 15 Dec 2024 15:44:11 +0000 Subject: [PATCH 2/2] chore(release): html v1.0.5 --- packages/html/CHANGELOG.md | 8 ++++++++ packages/html/package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/html/CHANGELOG.md b/packages/html/CHANGELOG.md index 6b1514d94..c5d4ff480 100644 --- a/packages/html/CHANGELOG.md +++ b/packages/html/CHANGELOG.md @@ -1,5 +1,13 @@ # @rollup/plugin-html ChangeLog +## v1.0.5 + +_2024-12-15_ + +### Bugfixes + +- fix: types for plugin (#1264) + ## v1.0.4 _2024-09-22_ diff --git a/packages/html/package.json b/packages/html/package.json index 2f53e9062..2a44b9c54 100644 --- a/packages/html/package.json +++ b/packages/html/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/plugin-html", - "version": "1.0.4", + "version": "1.0.5", "publishConfig": { "access": "public" },