@brandlab-digital/site-next 3.12.0 → 3.12.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 +3 -14
- package/dist/image-runtime.js.map +1 -1
- package/dist/next-sharp.d.ts +14 -0
- package/dist/next-sharp.d.ts.map +1 -0
- package/dist/next-sharp.js +39 -0
- package/dist/next-sharp.js.map +1 -0
- package/package.json +2 -2
package/dist/image-runtime.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import sharp from 'sharp';
|
|
3
|
+
import { findNextGetSharp } from './next-sharp.js';
|
|
3
4
|
// Next lazily unblocks HEIF when its optimizer first acquires Sharp. Initialise
|
|
4
5
|
// that cache before applying our exclusion, without patching either library.
|
|
5
6
|
// This private Next entrypoint is covered by the exact runtime pin and packed
|
|
6
7
|
// startup-order tests. Remove this bridge when maintained native fixes ship.
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
try {
|
|
10
|
-
require.resolve('next/package.json');
|
|
11
|
-
nextInstalled = true;
|
|
12
|
-
}
|
|
13
|
-
catch (error) {
|
|
14
|
-
if (error.code !== 'MODULE_NOT_FOUND')
|
|
15
|
-
throw error;
|
|
16
|
-
}
|
|
17
|
-
if (nextInstalled) {
|
|
18
|
-
const optimizer = require('next/dist/server/image-optimizer.js');
|
|
19
|
-
optimizer.getSharp();
|
|
20
|
-
}
|
|
8
|
+
const getSharp = findNextGetSharp(createRequire(import.meta.url));
|
|
9
|
+
getSharp?.();
|
|
21
10
|
sharp.block({ operation: ['VipsForeignLoadHeif'] });
|
|
22
11
|
//# 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;
|
|
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,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AACjE,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.\nconst getSharp = findNextGetSharp(createRequire(import.meta.url))\ngetSharp?.()\nsharp.block({ operation: ['VipsForeignLoadHeif'] })\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next's private Sharp initialiser, wherever the installed Next keeps it: Next 16.4 moved `getSharp` from
|
|
3
|
+
* `next/dist/server/image-optimizer.js` to `next/dist/server/image-optimizer/transform.js`. The image runtime calls it
|
|
4
|
+
* before blocking the HEIF decoder, because Next unblocks HEIF the first time its optimiser acquires Sharp.
|
|
5
|
+
*/
|
|
6
|
+
export declare const NEXT_SHARP_MODULES: readonly ["next/dist/server/image-optimizer/transform.js", "next/dist/server/image-optimizer.js"];
|
|
7
|
+
type ModuleRequire = (id: string) => unknown;
|
|
8
|
+
/**
|
|
9
|
+
* The installed Next's `getSharp`, or undefined when Next is not installed. Throws when Next is installed but neither
|
|
10
|
+
* module exports it, so an untested Next release fails at startup instead of leaving HEIF decoding open.
|
|
11
|
+
*/
|
|
12
|
+
export declare function findNextGetSharp(load: ModuleRequire): (() => unknown) | undefined;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=next-sharp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-sharp.d.ts","sourceRoot":"","sources":["../src/next-sharp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,mGAGrB,CAAA;AAEV,KAAK,aAAa,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAA;AAE5C;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,CAqBjF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next's private Sharp initialiser, wherever the installed Next keeps it: Next 16.4 moved `getSharp` from
|
|
3
|
+
* `next/dist/server/image-optimizer.js` to `next/dist/server/image-optimizer/transform.js`. The image runtime calls it
|
|
4
|
+
* before blocking the HEIF decoder, because Next unblocks HEIF the first time its optimiser acquires Sharp.
|
|
5
|
+
*/
|
|
6
|
+
export const NEXT_SHARP_MODULES = [
|
|
7
|
+
'next/dist/server/image-optimizer/transform.js',
|
|
8
|
+
'next/dist/server/image-optimizer.js',
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* The installed Next's `getSharp`, or undefined when Next is not installed. Throws when Next is installed but neither
|
|
12
|
+
* module exports it, so an untested Next release fails at startup instead of leaving HEIF decoding open.
|
|
13
|
+
*/
|
|
14
|
+
export function findNextGetSharp(load) {
|
|
15
|
+
try {
|
|
16
|
+
load('next/package.json');
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
if (error.code === 'MODULE_NOT_FOUND')
|
|
20
|
+
return undefined;
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
for (const id of NEXT_SHARP_MODULES) {
|
|
24
|
+
let loaded;
|
|
25
|
+
try {
|
|
26
|
+
loaded = load(id);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (error.code === 'MODULE_NOT_FOUND')
|
|
30
|
+
continue;
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
const getSharp = loaded?.getSharp;
|
|
34
|
+
if (typeof getSharp === 'function')
|
|
35
|
+
return getSharp;
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`The installed Next.js exposes no getSharp in ${NEXT_SHARP_MODULES.join(' or ')}; @brandlab-digital/site-next/image-runtime cannot keep HEIF decoding blocked. Use the Next.js version the Brandlab release pins.`);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=next-sharp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-sharp.js","sourceRoot":"","sources":["../src/next-sharp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,+CAA+C;IAC/C,qCAAqC;CAC7B,CAAA;AAIV;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAmB;IAClD,IAAI,CAAC;QACH,IAAI,CAAC,mBAAmB,CAAC,CAAA;IAC3B,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,KAAK,MAAM,EAAE,IAAI,kBAAkB,EAAE,CAAC;QACpC,IAAI,MAAe,CAAA;QACnB,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,CAAA;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAK,KAA+B,CAAC,IAAI,KAAK,kBAAkB;gBAAE,SAAQ;YAC1E,MAAM,KAAK,CAAA;QACb,CAAC;QACD,MAAM,QAAQ,GAAI,MAAwC,EAAE,QAAQ,CAAA;QACpE,IAAI,OAAO,QAAQ,KAAK,UAAU;YAAE,OAAO,QAAyB,CAAA;IACtE,CAAC;IACD,MAAM,IAAI,KAAK,CACb,gDAAgD,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,mIAAmI,CACnN,CAAA;AACH,CAAC","sourcesContent":["/**\n * Next's private Sharp initialiser, wherever the installed Next keeps it: Next 16.4 moved `getSharp` from\n * `next/dist/server/image-optimizer.js` to `next/dist/server/image-optimizer/transform.js`. The image runtime calls it\n * before blocking the HEIF decoder, because Next unblocks HEIF the first time its optimiser acquires Sharp.\n */\nexport const NEXT_SHARP_MODULES = [\n 'next/dist/server/image-optimizer/transform.js',\n 'next/dist/server/image-optimizer.js',\n] as const\n\ntype ModuleRequire = (id: string) => unknown\n\n/**\n * The installed Next's `getSharp`, or undefined when Next is not installed. Throws when Next is installed but neither\n * module exports it, so an untested Next release fails at startup instead of leaving HEIF decoding open.\n */\nexport function findNextGetSharp(load: ModuleRequire): (() => unknown) | undefined {\n try {\n load('next/package.json')\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'MODULE_NOT_FOUND') return undefined\n throw error\n }\n for (const id of NEXT_SHARP_MODULES) {\n let loaded: unknown\n try {\n loaded = load(id)\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'MODULE_NOT_FOUND') continue\n throw error\n }\n const getSharp = (loaded as { getSharp?: unknown } | null)?.getSharp\n if (typeof getSharp === 'function') return getSharp as () => unknown\n }\n throw new Error(\n `The installed Next.js exposes no getSharp in ${NEXT_SHARP_MODULES.join(' or ')}; @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.12.
|
|
3
|
+
"version": "3.12.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.12.
|
|
28
|
+
"@brandlab-digital/site-core": "3.12.1",
|
|
29
29
|
"browser-image-compression": "2.0.2",
|
|
30
30
|
"pdf-lib": "1.17.1",
|
|
31
31
|
"server-only": "0.0.1",
|