Comparing version 0.0.1-beta.4 to 0.0.1-beta.5
@@ -81,3 +81,3 @@ 'use strict'; | ||
await Promise.all(pages.map(async ({ pathname }) => { | ||
var _a; | ||
var _a, _b; | ||
const pageOptions = options.pages(pathname); | ||
@@ -87,3 +87,3 @@ if (pageOptions) { | ||
await page.goto(`http://localhost:${port}/${pathname}`, { | ||
waitUntil: 'networkidle2' | ||
waitUntil: (_a = pageOptions.waitUntil) !== null && _a !== void 0 ? _a : 'networkidle2' | ||
}); | ||
@@ -96,3 +96,3 @@ if (pageOptions.light) { | ||
} | ||
await ((_a = pageOptions.callback) === null || _a === void 0 ? void 0 : _a.call(pageOptions, page)); | ||
await ((_b = pageOptions.callback) === null || _b === void 0 ? void 0 : _b.call(pageOptions, page)); | ||
await page.pdf({ | ||
@@ -99,0 +99,0 @@ ...pageOptions.pdf, |
@@ -79,3 +79,3 @@ import { launch } from 'puppeteer'; | ||
await Promise.all(pages.map(async ({ pathname }) => { | ||
var _a; | ||
var _a, _b; | ||
const pageOptions = options.pages(pathname); | ||
@@ -85,3 +85,3 @@ if (pageOptions) { | ||
await page.goto(`http://localhost:${port}/${pathname}`, { | ||
waitUntil: 'networkidle2' | ||
waitUntil: (_a = pageOptions.waitUntil) !== null && _a !== void 0 ? _a : 'networkidle2' | ||
}); | ||
@@ -94,3 +94,3 @@ if (pageOptions.light) { | ||
} | ||
await ((_a = pageOptions.callback) === null || _a === void 0 ? void 0 : _a.call(pageOptions, page)); | ||
await ((_b = pageOptions.callback) === null || _b === void 0 ? void 0 : _b.call(pageOptions, page)); | ||
await page.pdf({ | ||
@@ -97,0 +97,0 @@ ...pageOptions.pdf, |
import { type AstroIntegration } from 'astro'; | ||
import { type PuppeteerLaunchOptions, type PDFOptions, type Page } from 'puppeteer'; | ||
import { type PuppeteerLaunchOptions, type PDFOptions, type Page, PuppeteerLifeCycleEvent } from 'puppeteer'; | ||
import { type InstallOptions } from '@puppeteer/browsers'; | ||
@@ -14,2 +14,3 @@ interface Options { | ||
light?: boolean; | ||
waitUntil?: PuppeteerLifeCycleEvent; | ||
pdf: Omit<PDFOptions, 'path'>; | ||
@@ -16,0 +17,0 @@ callback?: (page: Page) => any; |
{ | ||
"name": "astro-pdf", | ||
"version": "0.0.1-beta.4", | ||
"version": "0.0.1-beta.5", | ||
"description": "A simple Astro integration to generate PDFs from built pages", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/integration.js", |
@@ -7,2 +7,9 @@ # astro-pdf | ||
## Quickstart | ||
Install and add `astro-pdf`: | ||
```sh | ||
npx astro add astro-pdf | ||
``` | ||
and follow the CLI prompts. | ||
## Example | ||
@@ -12,3 +19,3 @@ ```js | ||
import { defineConfig } from 'astro/config'; | ||
import astroPdf from 'astro-pdf' | ||
import pdf from 'astro-pdf' | ||
@@ -18,3 +25,3 @@ // https://astro.build/config | ||
integrations: [ | ||
astroPdf({ | ||
pdf({ | ||
// pages will receive the pathname of each page being built | ||
@@ -21,0 +28,0 @@ pages: path => { |
11702
238
39