@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.
@@ -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
- const getSharp = findNextGetSharp(createRequire(import.meta.url));
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,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"]}
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"]}
@@ -1,14 +1,19 @@
1
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.
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 NEXT_SHARP_MODULES: readonly ["next/dist/server/image-optimizer/transform.js", "next/dist/server/image-optimizer.js"];
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. 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.
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(load: ModuleRequire): (() => unknown) | undefined;
13
- export {};
18
+ export declare function findNextGetSharp(resolveNext: () => unknown, loadTransform: () => unknown): (() => unknown) | undefined;
14
19
  //# sourceMappingURL=next-sharp.d.ts.map
@@ -1 +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"}
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"}
@@ -1,39 +1,40 @@
1
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.
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 NEXT_SHARP_MODULES = [
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. 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
+ * 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(load) {
18
+ export function findNextGetSharp(resolveNext, loadTransform) {
15
19
  try {
16
- load('next/package.json');
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
- 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;
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
- 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.`);
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
@@ -1 +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"]}
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.0",
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.0",
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",