nuxt-og-image 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/module.mjs +7 -1
- package/dist/runtime/browserService.mjs +6 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -20,6 +20,8 @@ async function createBrowser() {
|
|
|
20
20
|
headless: awsChrome.headless
|
|
21
21
|
});
|
|
22
22
|
} catch (e) {
|
|
23
|
+
if (!process.dev)
|
|
24
|
+
console.log("[nuxt-og-image] Skipping chrome-aws-lambda", e);
|
|
23
25
|
}
|
|
24
26
|
try {
|
|
25
27
|
const playwrightCore = await import('playwright-core');
|
|
@@ -30,6 +32,8 @@ async function createBrowser() {
|
|
|
30
32
|
executablePath: chromePath
|
|
31
33
|
});
|
|
32
34
|
} catch (e) {
|
|
35
|
+
if (!process.dev)
|
|
36
|
+
console.log("[nuxt-og-image] Skipping chrome-launcher", e);
|
|
33
37
|
}
|
|
34
38
|
try {
|
|
35
39
|
const playwright = await import(String("playwright"));
|
|
@@ -37,6 +41,8 @@ async function createBrowser() {
|
|
|
37
41
|
headless: true
|
|
38
42
|
});
|
|
39
43
|
} catch (e) {
|
|
44
|
+
if (!process.dev)
|
|
45
|
+
console.log("[nuxt-og-image] Playwright failed", e);
|
|
40
46
|
throw new Error(`
|
|
41
47
|
Missing chromium binary. You need either 'playwright' or 'chrome-aws-lambda'.
|
|
42
48
|
Please run 'yarn add --dev playwright' or 'npm install --save-dev playwright'
|
|
@@ -178,7 +184,7 @@ declare module 'nitropack' {
|
|
|
178
184
|
if (routeRules.ogImage === false)
|
|
179
185
|
return;
|
|
180
186
|
const screenshotPath = ctx._contents.match(new RegExp(`<link id="${LinkPrerenderId}" rel="prerender" href="(.*?)">`))?.[1];
|
|
181
|
-
const fileName = `${hash({ route: ctx.route
|
|
187
|
+
const fileName = `${hash({ route: ctx.route })}.png`;
|
|
182
188
|
const absoluteUrl = withBase(`${config.outputDir}/${fileName}`, config.host);
|
|
183
189
|
const entry = {
|
|
184
190
|
fileName,
|
|
@@ -9,6 +9,8 @@ export async function createBrowser() {
|
|
|
9
9
|
headless: awsChrome.headless
|
|
10
10
|
});
|
|
11
11
|
} catch (e) {
|
|
12
|
+
if (!process.dev)
|
|
13
|
+
console.log("[nuxt-og-image] Skipping chrome-aws-lambda", e);
|
|
12
14
|
}
|
|
13
15
|
try {
|
|
14
16
|
const playwrightCore = await import("playwright-core");
|
|
@@ -19,6 +21,8 @@ export async function createBrowser() {
|
|
|
19
21
|
executablePath: chromePath
|
|
20
22
|
});
|
|
21
23
|
} catch (e) {
|
|
24
|
+
if (!process.dev)
|
|
25
|
+
console.log("[nuxt-og-image] Skipping chrome-launcher", e);
|
|
22
26
|
}
|
|
23
27
|
try {
|
|
24
28
|
const playwright = await import(String("playwright"));
|
|
@@ -26,6 +30,8 @@ export async function createBrowser() {
|
|
|
26
30
|
headless: true
|
|
27
31
|
});
|
|
28
32
|
} catch (e) {
|
|
33
|
+
if (!process.dev)
|
|
34
|
+
console.log("[nuxt-og-image] Playwright failed", e);
|
|
29
35
|
throw new Error(`
|
|
30
36
|
Missing chromium binary. You need either 'playwright' or 'chrome-aws-lambda'.
|
|
31
37
|
Please run 'yarn add --dev playwright' or 'npm install --save-dev playwright'
|