Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(html): refactor to typescript (#634)
* feat(html): add type declaration to html package * chore(html): add rollup config to transform ts source * refactor(html): refactor html plugin to typescript * fix(html): lint src directory * fix(html): use shared rollup config to enable default cjs export * fix(html): fix ci lint * fix(html): implement change requests Co-authored-by: Andrew Powell <shellscape@users.noreply.github.com>
- Loading branch information
1 parent
08da3a1
commit a1b2fc3
Showing
6 changed files
with
115 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import typescript from '@rollup/plugin-typescript'; | ||
|
||
import { createConfig } from '../../shared/rollup.config'; | ||
|
||
import pkg from './package.json'; | ||
|
||
export default { | ||
...createConfig(pkg), | ||
plugins: [typescript({ sourceMap: false })] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"include": ["src/**/*", "types/**/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Plugin, OutputChunk, OutputAsset, OutputBundle } from 'rollup'; | ||
|
||
export interface RollupHtmlOptions { | ||
title?: string; | ||
attributes?: Record<string, any>; | ||
fileName?: string; | ||
meta?: Record<string, any>[]; | ||
publicPath?: string; | ||
template?: (templateOptions: RollupHtmlTemplateOptions) => string; | ||
} | ||
|
||
export interface RollupHtmlTemplateOptions { | ||
title: string; | ||
attributes: Record<string, any>; | ||
publicPath: string; | ||
meta: Record<string, any>[]; | ||
bundle: OutputBundle; | ||
files: Record<string, (OutputChunk | OutputAsset)[]>; | ||
} | ||
|
||
export function makeHtmlAttributes(attributes: Record<string, string>): string; | ||
|
||
/** | ||
* A Rollup plugin which creates HTML files to serve Rollup bundles. | ||
* @param options - Plugin options. | ||
* @returns Plugin instance. | ||
*/ | ||
export default function html(options: RollupHtmlOptions): Plugin; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.