@brandlab-digital/site-next 3.15.0 → 3.15.1
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/image-runtime.js +6 -1
- package/dist/image-runtime.js.map +1 -1
- package/dist/next-sharp.d.ts +14 -9
- package/dist/next-sharp.d.ts.map +1 -1
- package/dist/next-sharp.js +26 -25
- package/dist/next-sharp.js.map +1 -1
- package/package.json +2 -2
package/dist/image-runtime.js
CHANGED
|
@@ -5,7 +5,12 @@ import { findNextGetSharp } from './next-sharp.js';
|
|
|
5
5
|
// that cache before applying our exclusion, without patching either library.
|
|
6
6
|
// This private Next entrypoint is covered by the exact runtime pin and packed
|
|
7
7
|
// startup-order tests. Remove this bridge when maintained native fixes ship.
|
|
8
|
-
|
|
8
|
+
//
|
|
9
|
+
// Keep the require below a literal path on this module's createRequire: Next's
|
|
10
|
+
// output tracing only deploys the file with the route when it can see the path
|
|
11
|
+
// (3.15.1). The golden fixtures check the contact route's trace lists it.
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const getSharp = findNextGetSharp(() => require.resolve('next/package.json'), () => require('next/dist/server/image-optimizer/transform.js'));
|
|
9
14
|
getSharp?.();
|
|
10
15
|
sharp.block({ operation: ['VipsForeignLoadHeif'] });
|
|
11
16
|
//# sourceMappingURL=image-runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-runtime.js","sourceRoot":"","sources":["../src/image-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,gFAAgF;AAChF,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAC7E,MAAM,QAAQ,GAAG,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"image-runtime.js","sourceRoot":"","sources":["../src/image-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,gFAAgF;AAChF,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAC7E,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9C,MAAM,QAAQ,GAAG,gBAAgB,CAC/B,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAC1C,GAAG,EAAE,CAAC,OAAO,CAAC,+CAA+C,CAAC,CAC/D,CAAA;AACD,QAAQ,EAAE,EAAE,CAAA;AACZ,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAA","sourcesContent":["import { createRequire } from 'node:module'\nimport sharp from 'sharp'\nimport { findNextGetSharp } from './next-sharp.js'\n\n// Next lazily unblocks HEIF when its optimizer first acquires Sharp. Initialise\n// that cache before applying our exclusion, without patching either library.\n// This private Next entrypoint is covered by the exact runtime pin and packed\n// startup-order tests. Remove this bridge when maintained native fixes ship.\n//\n// Keep the require below a literal path on this module's createRequire: Next's\n// output tracing only deploys the file with the route when it can see the path\n// (3.15.1). The golden fixtures check the contact route's trace lists it.\nconst require = createRequire(import.meta.url)\nconst getSharp = findNextGetSharp(\n () => require.resolve('next/package.json'),\n () => require('next/dist/server/image-optimizer/transform.js'),\n)\ngetSharp?.()\nsharp.block({ operation: ['VipsForeignLoadHeif'] })\n"]}
|
package/dist/next-sharp.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Next
|
|
3
|
-
* `next/dist/server/image-optimizer.js` to `next/dist/server/image-optimizer/transform.js
|
|
4
|
-
* before blocking the HEIF decoder, because Next unblocks HEIF the first time its optimiser acquires Sharp.
|
|
2
|
+
* The Next module that holds its private Sharp initialiser on the pinned Next release (16.4 moved `getSharp` from
|
|
3
|
+
* `next/dist/server/image-optimizer.js` to `next/dist/server/image-optimizer/transform.js`). The image runtime calls
|
|
4
|
+
* it before blocking the HEIF decoder, because Next unblocks HEIF the first time its optimiser acquires Sharp.
|
|
5
|
+
*
|
|
6
|
+
* The image runtime must load this module with a literal `require('next/dist/server/image-optimizer/transform.js')`
|
|
7
|
+
* on its own `createRequire(import.meta.url)`. Next's output tracing only copies a module into a deployed route
|
|
8
|
+
* when it sees a literal path there; a path held in a variable or passed through a helper is never traced, so the
|
|
9
|
+
* route fails on Vercel while it passes against a full local `node_modules` (3.12.1–3.15.0).
|
|
5
10
|
*/
|
|
6
|
-
export declare const
|
|
7
|
-
type ModuleRequire = (id: string) => unknown;
|
|
11
|
+
export declare const NEXT_SHARP_MODULE = "next/dist/server/image-optimizer/transform.js";
|
|
8
12
|
/**
|
|
9
|
-
* The installed Next's `getSharp`, or undefined when Next is not installed.
|
|
10
|
-
*
|
|
13
|
+
* The installed Next's `getSharp`, or undefined when Next is not installed. `resolveNext` resolves
|
|
14
|
+
* `next/package.json`; `loadTransform` is the image runtime's literal require of {@link NEXT_SHARP_MODULE}. Throws
|
|
15
|
+
* when Next is installed but the module cannot be loaded (keeping the original error as the cause) or exposes no
|
|
16
|
+
* `getSharp`, so the route fails at startup instead of leaving HEIF decoding open.
|
|
11
17
|
*/
|
|
12
|
-
export declare function findNextGetSharp(
|
|
13
|
-
export {};
|
|
18
|
+
export declare function findNextGetSharp(resolveNext: () => unknown, loadTransform: () => unknown): (() => unknown) | undefined;
|
|
14
19
|
//# sourceMappingURL=next-sharp.d.ts.map
|
package/dist/next-sharp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-sharp.d.ts","sourceRoot":"","sources":["../src/next-sharp.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"next-sharp.d.ts","sourceRoot":"","sources":["../src/next-sharp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,kDAAkD,CAAA;AAEhF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,OAAO,EAC1B,aAAa,EAAE,MAAM,OAAO,GAC3B,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,CAsB7B"}
|
package/dist/next-sharp.js
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Next
|
|
3
|
-
* `next/dist/server/image-optimizer.js` to `next/dist/server/image-optimizer/transform.js
|
|
4
|
-
* before blocking the HEIF decoder, because Next unblocks HEIF the first time its optimiser acquires Sharp.
|
|
2
|
+
* The Next module that holds its private Sharp initialiser on the pinned Next release (16.4 moved `getSharp` from
|
|
3
|
+
* `next/dist/server/image-optimizer.js` to `next/dist/server/image-optimizer/transform.js`). The image runtime calls
|
|
4
|
+
* it before blocking the HEIF decoder, because Next unblocks HEIF the first time its optimiser acquires Sharp.
|
|
5
|
+
*
|
|
6
|
+
* The image runtime must load this module with a literal `require('next/dist/server/image-optimizer/transform.js')`
|
|
7
|
+
* on its own `createRequire(import.meta.url)`. Next's output tracing only copies a module into a deployed route
|
|
8
|
+
* when it sees a literal path there; a path held in a variable or passed through a helper is never traced, so the
|
|
9
|
+
* route fails on Vercel while it passes against a full local `node_modules` (3.12.1–3.15.0).
|
|
5
10
|
*/
|
|
6
|
-
export const
|
|
7
|
-
'next/dist/server/image-optimizer/transform.js',
|
|
8
|
-
'next/dist/server/image-optimizer.js',
|
|
9
|
-
];
|
|
11
|
+
export const NEXT_SHARP_MODULE = 'next/dist/server/image-optimizer/transform.js';
|
|
10
12
|
/**
|
|
11
|
-
* The installed Next's `getSharp`, or undefined when Next is not installed.
|
|
12
|
-
*
|
|
13
|
+
* The installed Next's `getSharp`, or undefined when Next is not installed. `resolveNext` resolves
|
|
14
|
+
* `next/package.json`; `loadTransform` is the image runtime's literal require of {@link NEXT_SHARP_MODULE}. Throws
|
|
15
|
+
* when Next is installed but the module cannot be loaded (keeping the original error as the cause) or exposes no
|
|
16
|
+
* `getSharp`, so the route fails at startup instead of leaving HEIF decoding open.
|
|
13
17
|
*/
|
|
14
|
-
export function findNextGetSharp(
|
|
18
|
+
export function findNextGetSharp(resolveNext, loadTransform) {
|
|
15
19
|
try {
|
|
16
|
-
|
|
20
|
+
resolveNext();
|
|
17
21
|
}
|
|
18
22
|
catch (error) {
|
|
19
23
|
if (error.code === 'MODULE_NOT_FOUND')
|
|
20
24
|
return undefined;
|
|
21
25
|
throw error;
|
|
22
26
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
continue;
|
|
31
|
-
throw error;
|
|
32
|
-
}
|
|
33
|
-
const getSharp = loaded?.getSharp;
|
|
34
|
-
if (typeof getSharp === 'function')
|
|
35
|
-
return getSharp;
|
|
27
|
+
let loaded;
|
|
28
|
+
try {
|
|
29
|
+
loaded = loadTransform();
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
33
|
+
throw new Error(`@brandlab-digital/site-next/image-runtime could not load ${NEXT_SHARP_MODULE} from the installed Next.js (${detail}), so it cannot keep HEIF decoding blocked. Use the Next.js version the Brandlab release pins, and check that the deployed route includes that file.`, { cause: error });
|
|
36
34
|
}
|
|
37
|
-
|
|
35
|
+
const getSharp = loaded?.getSharp;
|
|
36
|
+
if (typeof getSharp === 'function')
|
|
37
|
+
return getSharp;
|
|
38
|
+
throw new Error(`The installed Next.js exposes no getSharp in ${NEXT_SHARP_MODULE}; @brandlab-digital/site-next/image-runtime cannot keep HEIF decoding blocked. Use the Next.js version the Brandlab release pins.`);
|
|
38
39
|
}
|
|
39
40
|
//# sourceMappingURL=next-sharp.js.map
|
package/dist/next-sharp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-sharp.js","sourceRoot":"","sources":["../src/next-sharp.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"next-sharp.js","sourceRoot":"","sources":["../src/next-sharp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,+CAA+C,CAAA;AAEhF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,WAA0B,EAC1B,aAA4B;IAE5B,IAAI,CAAC;QACH,WAAW,EAAE,CAAA;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,kBAAkB;YAAE,OAAO,SAAS,CAAA;QAClF,MAAM,KAAK,CAAA;IACb,CAAC;IACD,IAAI,MAAe,CAAA;IACnB,IAAI,CAAC;QACH,MAAM,GAAG,aAAa,EAAE,CAAA;IAC1B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACrE,MAAM,IAAI,KAAK,CACb,4DAA4D,iBAAiB,gCAAgC,MAAM,sJAAsJ,EACzQ,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAA;IACH,CAAC;IACD,MAAM,QAAQ,GAAI,MAAwC,EAAE,QAAQ,CAAA;IACpE,IAAI,OAAO,QAAQ,KAAK,UAAU;QAAE,OAAO,QAAyB,CAAA;IACpE,MAAM,IAAI,KAAK,CACb,gDAAgD,iBAAiB,mIAAmI,CACrM,CAAA;AACH,CAAC","sourcesContent":["/**\n * The Next module that holds its private Sharp initialiser on the pinned Next release (16.4 moved `getSharp` from\n * `next/dist/server/image-optimizer.js` to `next/dist/server/image-optimizer/transform.js`). The image runtime calls\n * it before blocking the HEIF decoder, because Next unblocks HEIF the first time its optimiser acquires Sharp.\n *\n * The image runtime must load this module with a literal `require('next/dist/server/image-optimizer/transform.js')`\n * on its own `createRequire(import.meta.url)`. Next's output tracing only copies a module into a deployed route\n * when it sees a literal path there; a path held in a variable or passed through a helper is never traced, so the\n * route fails on Vercel while it passes against a full local `node_modules` (3.12.1–3.15.0).\n */\nexport const NEXT_SHARP_MODULE = 'next/dist/server/image-optimizer/transform.js'\n\n/**\n * The installed Next's `getSharp`, or undefined when Next is not installed. `resolveNext` resolves\n * `next/package.json`; `loadTransform` is the image runtime's literal require of {@link NEXT_SHARP_MODULE}. Throws\n * when Next is installed but the module cannot be loaded (keeping the original error as the cause) or exposes no\n * `getSharp`, so the route fails at startup instead of leaving HEIF decoding open.\n */\nexport function findNextGetSharp(\n resolveNext: () => unknown,\n loadTransform: () => unknown,\n): (() => unknown) | undefined {\n try {\n resolveNext()\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'MODULE_NOT_FOUND') return undefined\n throw error\n }\n let loaded: unknown\n try {\n loaded = loadTransform()\n } catch (error) {\n const detail = error instanceof Error ? error.message : String(error)\n throw new Error(\n `@brandlab-digital/site-next/image-runtime could not load ${NEXT_SHARP_MODULE} from the installed Next.js (${detail}), so it cannot keep HEIF decoding blocked. Use the Next.js version the Brandlab release pins, and check that the deployed route includes that file.`,\n { cause: error },\n )\n }\n const getSharp = (loaded as { getSharp?: unknown } | null)?.getSharp\n if (typeof getSharp === 'function') return getSharp as () => unknown\n throw new Error(\n `The installed Next.js exposes no getSharp in ${NEXT_SHARP_MODULE}; @brandlab-digital/site-next/image-runtime cannot keep HEIF decoding blocked. Use the Next.js version the Brandlab release pins.`,\n )\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brandlab-digital/site-next",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.1",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@brandlab-digital/site-core": "3.15.
|
|
28
|
+
"@brandlab-digital/site-core": "3.15.1",
|
|
29
29
|
"browser-image-compression": "2.0.2",
|
|
30
30
|
"pdf-lib": "1.17.1",
|
|
31
31
|
"server-only": "0.0.1",
|