Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rollup/plugin-html

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rollup/plugin-html - npm Package Compare versions

Comparing version 1.0.5 to 1.1.0

16

./dist/cjs/index.js

@@ -24,4 +24,4 @@ 'use strict';

};
const defaultTemplate = async ({ attributes, files, meta, publicPath, title }) => {
const scripts = (files.js || [])
const defaultTemplate = async ({ attributes, files, meta, publicPath, title, addScriptsToHead }) => {
let scripts = (files.js || [])
.map(({ fileName }) => {

@@ -32,3 +32,3 @@ const attrs = makeHtmlAttributes(attributes.script);

.join('\n');
const links = (files.css || [])
let links = (files.css || [])
.map(({ fileName }) => {

@@ -39,2 +39,6 @@ const attrs = makeHtmlAttributes(attributes.link);

.join('\n');
if (addScriptsToHead === true) {
links += scripts;
scripts = '';
}
const metas = meta

@@ -70,6 +74,7 @@ .map((input) => {

template: defaultTemplate,
title: 'Rollup Bundle'
title: 'Rollup Bundle',
addScriptsToHead: false
};
function html(opts = {}) {
const { attributes, fileName, meta, publicPath, template, title } = Object.assign({}, defaults, opts);
const { addScriptsToHead, attributes, fileName, meta, publicPath, template, title } = Object.assign({}, defaults, opts);
return {

@@ -89,2 +94,3 @@ name: 'html',

attributes,
addScriptsToHead,
bundle,

@@ -91,0 +97,0 @@ files,

@@ -24,4 +24,4 @@ 'use strict';

};
const defaultTemplate = async ({ attributes, files, meta, publicPath, title }) => {
const scripts = (files.js || [])
const defaultTemplate = async ({ attributes, files, meta, publicPath, title, addScriptsToHead }) => {
let scripts = (files.js || [])
.map(({ fileName }) => {

@@ -32,3 +32,3 @@ const attrs = makeHtmlAttributes(attributes.script);

.join('\n');
const links = (files.css || [])
let links = (files.css || [])
.map(({ fileName }) => {

@@ -39,2 +39,6 @@ const attrs = makeHtmlAttributes(attributes.link);

.join('\n');
if (addScriptsToHead === true) {
links += scripts;
scripts = '';
}
const metas = meta

@@ -70,6 +74,7 @@ .map((input) => {

template: defaultTemplate,
title: 'Rollup Bundle'
title: 'Rollup Bundle',
addScriptsToHead: false
};
function html(opts = {}) {
const { attributes, fileName, meta, publicPath, template, title } = Object.assign({}, defaults, opts);
const { addScriptsToHead, attributes, fileName, meta, publicPath, template, title } = Object.assign({}, defaults, opts);
return {

@@ -89,2 +94,3 @@ name: 'html',

attributes,
addScriptsToHead,
bundle,

@@ -91,0 +97,0 @@ files,

@@ -20,4 +20,4 @@ import { extname } from 'path';

};
const defaultTemplate = async ({ attributes, files, meta, publicPath, title }) => {
const scripts = (files.js || [])
const defaultTemplate = async ({ attributes, files, meta, publicPath, title, addScriptsToHead }) => {
let scripts = (files.js || [])
.map(({ fileName }) => {

@@ -28,3 +28,3 @@ const attrs = makeHtmlAttributes(attributes.script);

.join('\n');
const links = (files.css || [])
let links = (files.css || [])
.map(({ fileName }) => {

@@ -35,2 +35,6 @@ const attrs = makeHtmlAttributes(attributes.link);

.join('\n');
if (addScriptsToHead === true) {
links += scripts;
scripts = '';
}
const metas = meta

@@ -66,6 +70,7 @@ .map((input) => {

template: defaultTemplate,
title: 'Rollup Bundle'
title: 'Rollup Bundle',
addScriptsToHead: false
};
function html(opts = {}) {
const { attributes, fileName, meta, publicPath, template, title } = Object.assign({}, defaults, opts);
const { addScriptsToHead, attributes, fileName, meta, publicPath, template, title } = Object.assign({}, defaults, opts);
return {

@@ -85,2 +90,3 @@ name: 'html',

attributes,
addScriptsToHead,
bundle,

@@ -87,0 +93,0 @@ files,

{
"name": "@rollup/plugin-html",
"version": "1.0.5",
"version": "1.1.0",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

@@ -51,2 +51,9 @@ [npm]: https://img.shields.io/npm/v/@rollup/plugin-html

### `addScriptsToHead`
Type: `Boolean`<br>
Default: `false`
Place scripts in the `<head>` tag instead of `<body>`.
### `attributes`

@@ -53,0 +60,0 @@

import type { Plugin, OutputChunk, OutputAsset, OutputBundle } from 'rollup';
export interface RollupHtmlTemplateOptions {
title: string;
addScriptsToHead?: boolean;
attributes: Record<string, any>;
publicPath: string;
meta: Record<string, any>[];
bundle: OutputBundle;
files: Record<string, (OutputChunk | OutputAsset)[]>;
meta: Record<string, any>[];
publicPath: string;
title: string;
}
export interface RollupHtmlOptions {
title?: string;
addScriptsToHead?: boolean;
attributes?: Record<string, any>;

@@ -19,2 +20,3 @@ fileName?: string;

template?: (templateoptions: RollupHtmlTemplateOptions) => string | Promise<string>;
title?: string;
}

@@ -21,0 +23,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc