Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(html): prepare for Rollup 3 #1294

Merged
merged 1 commit into from
Oct 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/html/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Please see [Supported Output Formats](#supported-output-formats) for information

## Requirements

This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v8.0.0+) and Rollup v1.20.0+.
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v1.20.0+.

## Install

Expand Down
26 changes: 17 additions & 9 deletions packages/html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
"main": "./dist/cjs/index.js",
"module": "./dist/es/index.js",
"exports": {
"require": "./dist/cjs/index.js",
"import": "./dist/es/index.js"
"import": "./dist/es/index.js",
"types": "./types/index.d.ts",
"default": "./dist/cjs/index.js"
},
"engines": {
"node": ">= 8.0.0"
"node": ">=14.0.0"
},
"scripts": {
"build": "rollup -c",
Expand All @@ -37,6 +38,7 @@
},
"files": [
"dist",
"!dist/**/*.map",
"types",
"README.md",
"LICENSE"
Expand All @@ -48,15 +50,21 @@
"template"
],
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
},
"devDependencies": {
"@rollup/plugin-typescript": "^6.1.0",
"rollup": "^2.67.3",
"rollup-plugin-postcss": "^3.1.8",
"typescript": "^4.1.2"
"@rollup/plugin-typescript": "^8.5.0",
"postcss": "^8.4.16",
"rollup": "^3.0.0-7",
"rollup-plugin-postcss": "^4.0.2",
"typescript": "^4.8.3"
},
"types": "types/index.d.ts",
"types": "./types/index.d.ts",
"ava": {
"workerThreads": false,
"files": [
Expand Down
9 changes: 2 additions & 7 deletions packages/html/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ import { extname } from 'path';

import { Plugin, NormalizedOutputOptions, OutputBundle, EmittedAsset } from 'rollup';

import { RollupHtmlOptions, RollupHtmlTemplateOptions } from '../types';
import type { RollupHtmlOptions, RollupHtmlTemplateOptions } from '../types';

const getFiles = (bundle: OutputBundle): RollupHtmlTemplateOptions['files'] => {
const files = Object.values(bundle).filter(
(file) =>
file.type === 'chunk' ||
(typeof file.type === 'string' ? file.type === 'asset' : file.isAsset)
);
const result = {} as ReturnType<typeof getFiles>;
for (const file of files) {
for (const file of Object.values(bundle)) {
const { fileName } = file;
const extension = extname(fileName).substring(1);

Expand Down
6 changes: 4 additions & 2 deletions packages/html/test/snapshots/test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,11 @@ Generated by [AVA](https://avajs.dev).

[
{
chunkName: 'batman',
code: 'EMPTY_BUNDLE',
message: 'Generated an empty chunk: "batman"',
message: 'Generated an empty chunk: "batman".',
names: [
'batman',
],
toString: Function {},
},
{
Expand Down
Binary file modified packages/html/test/snapshots/test.js.snap
Binary file not shown.
Loading