@prismicio/react 2.6.0-alpha.0 → 2.6.0-alpha.2

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.
Files changed (81) hide show
  1. package/dist/PrismicImage.cjs +6 -5
  2. package/dist/PrismicImage.cjs.map +1 -1
  3. package/dist/PrismicImage.js +6 -4
  4. package/dist/PrismicImage.js.map +1 -1
  5. package/dist/PrismicText.cjs +4 -4
  6. package/dist/PrismicText.cjs.map +1 -1
  7. package/dist/PrismicText.js +4 -3
  8. package/dist/PrismicText.js.map +1 -1
  9. package/dist/PrismicToolbar.cjs +3 -2
  10. package/dist/PrismicToolbar.cjs.map +1 -1
  11. package/dist/PrismicToolbar.js +2 -1
  12. package/dist/PrismicToolbar.js.map +1 -1
  13. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.cjs +19 -0
  14. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.cjs.map +1 -0
  15. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.js +19 -0
  16. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.js.map +1 -0
  17. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.cjs +13 -0
  18. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.cjs.map +1 -0
  19. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.js +13 -0
  20. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.js.map +1 -0
  21. package/dist/_node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.cjs +21 -0
  22. package/dist/_node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -0
  23. package/dist/_node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.js +21 -0
  24. package/dist/_node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -0
  25. package/dist/_node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.cjs +45 -0
  26. package/dist/_node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.cjs.map +1 -0
  27. package/dist/_node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.js +45 -0
  28. package/dist/_node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.js.map +1 -0
  29. package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.cjs +38 -0
  30. package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.cjs.map +1 -0
  31. package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.js +38 -0
  32. package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.js.map +1 -0
  33. package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.cjs +28 -0
  34. package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.cjs.map +1 -0
  35. package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.js +28 -0
  36. package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.js.map +1 -0
  37. package/dist/_node_modules/@prismicio/client/dist/helpers/asText.cjs +12 -0
  38. package/dist/_node_modules/@prismicio/client/dist/helpers/asText.cjs.map +1 -0
  39. package/dist/_node_modules/@prismicio/client/dist/helpers/asText.js +12 -0
  40. package/dist/_node_modules/@prismicio/client/dist/helpers/asText.js.map +1 -0
  41. package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.cjs +26 -0
  42. package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.cjs.map +1 -0
  43. package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.js +26 -0
  44. package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.js.map +1 -0
  45. package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.cjs +24 -0
  46. package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.cjs.map +1 -0
  47. package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.js +24 -0
  48. package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.js.map +1 -0
  49. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.cjs +7 -0
  50. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.cjs.map +1 -0
  51. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.js +7 -0
  52. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.js.map +1 -0
  53. package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.cjs +9 -0
  54. package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.cjs.map +1 -0
  55. package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.js +9 -0
  56. package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.js.map +1 -0
  57. package/dist/_node_modules/@prismicio/client/dist/types/value/link.cjs +10 -0
  58. package/dist/_node_modules/@prismicio/client/dist/types/value/link.cjs.map +1 -0
  59. package/dist/_node_modules/@prismicio/client/dist/types/value/link.js +10 -0
  60. package/dist/_node_modules/@prismicio/client/dist/types/value/link.js.map +1 -0
  61. package/dist/_node_modules/imgix-url-builder/dist/index.cjs +41 -0
  62. package/dist/_node_modules/imgix-url-builder/dist/index.cjs.map +1 -0
  63. package/dist/_node_modules/imgix-url-builder/dist/index.js +41 -0
  64. package/dist/_node_modules/imgix-url-builder/dist/index.js.map +1 -0
  65. package/dist/clientHooks.d.ts +90 -0
  66. package/dist/package.json.cjs +1 -1
  67. package/dist/package.json.js +1 -1
  68. package/dist/react-server/PrismicLink.cjs +3 -2
  69. package/dist/react-server/PrismicLink.cjs.map +1 -1
  70. package/dist/react-server/PrismicLink.js +2 -1
  71. package/dist/react-server/PrismicLink.js.map +1 -1
  72. package/dist/react-server/PrismicRichText.cjs +2 -3
  73. package/dist/react-server/PrismicRichText.cjs.map +1 -1
  74. package/dist/react-server/PrismicRichText.js +2 -2
  75. package/dist/react-server/PrismicRichText.js.map +1 -1
  76. package/dist/react-server/unsupported.cjs +26 -26
  77. package/dist/react-server/unsupported.cjs.map +1 -1
  78. package/dist/react-server/unsupported.js +26 -26
  79. package/dist/react-server/unsupported.js.map +1 -1
  80. package/package.json +3 -3
  81. package/src/react-server/unsupported.ts +112 -26
@@ -1 +1 @@
1
- {"version":3,"file":"unsupported.cjs","sources":["../../../src/react-server/unsupported.ts"],"sourcesContent":["// Exports in this file are unsupported in the react-server environment.\n// All environments should export the same functions to maintian API compatability.\n\nfunction buildErrorMessage(fnName: string) {\n\treturn `${fnName} is not supported in Server Components. Remove all uses of ${fnName} in Server Components.`;\n}\n\nfunction buildHookErrorMessage(fnName: string) {\n\treturn `${fnName} is not supported in Server Components. Replace all uses of ${fnName} in Server Components with direct use of \\`@prismicio/client\\`.`;\n}\n\nexport function PrismicProvider(): JSX.Element {\n\tthrow new Error(buildErrorMessage(\"<PrismicProvider>\"));\n}\n\nexport function usePrismicContext() {\n\tthrow new Error(buildErrorMessage(\"usePrismicContext()\"));\n}\n\nexport function usePrismicClient() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicClient()\"));\n}\n\nexport function usePrismicPreviewResolver() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicPreviewResolver()\"));\n}\n\nexport function useAllPrismicDocumentsDangerously() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsDangerously()\"));\n}\n\nexport function useAllPrismicDocumentsByEveryTag() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByEveryTag()\"));\n}\n\nexport function useAllPrismicDocumentsByIDs() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByIDs()\"));\n}\n\nexport function useAllPrismicDocumentsBySomeTags() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsBySomeTags()\"));\n}\n\nexport function useAllPrismicDocumentsByTag() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByTag()\"));\n}\n\nexport function useAllPrismicDocumentsByType() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByType()\"));\n}\n\nexport function useAllPrismicDocumentsByUIDs() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByUIDs()\"));\n}\n\nexport function useFirstPrismicDocument() {\n\tthrow new Error(buildHookErrorMessage(\"useFirstPrismicDocument()\"));\n}\n\nexport function usePrismicDocumentByID() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentByID()\"));\n}\n\nexport function usePrismicDocumentByUID() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentByUID()\"));\n}\n\nexport function usePrismicDocuments() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocuments()\"));\n}\n\nexport function usePrismicDocumentsByEveryTag() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByEveryTag()\"));\n}\n\nexport function usePrismicDocumentsByIDs() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByIDs()\"));\n}\n\nexport function usePrismicDocumentsBySomeTags() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsBySomeTags()\"));\n}\n\nexport function usePrismicDocumentsByTag() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByTag()\"));\n}\n\nexport function usePrismicDocumentsByType() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByType()\"));\n}\n\nexport function usePrismicDocumentsByUIDs() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByUIDs()\"));\n}\n\nexport function useSinglePrismicDocument() {\n\tthrow new Error(buildHookErrorMessage(\"useSinglePrismicDocument()\"));\n}\n"],"names":[],"mappings":";;AAGA,SAAS,kBAAkB,QAAc;AACxC,SAAO,GAAG,oEAAoE;AAC/E;AAEA,SAAS,sBAAsB,QAAc;AAC5C,SAAO,GAAG,qEAAqE;AAChF;SAEgB,kBAAe;AAC9B,QAAM,IAAI,MAAM,kBAAkB,mBAAmB,CAAC;AACvD;SAEgB,oBAAiB;AAChC,QAAM,IAAI,MAAM,kBAAkB,qBAAqB,CAAC;AACzD;SAEgB,mBAAgB;AAC/B,QAAM,IAAI,MAAM,sBAAsB,oBA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MAAM,sBAAsB,6BAA6B,CAAC;AACrE;SAEgB,2BAAwB;AACvC,QAAM,IAAI,MAAM,sBAAsB,4BAA4B,CAAC;AACpE;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"unsupported.cjs","sources":["../../../src/react-server/unsupported.ts"],"sourcesContent":["// Exports in this file are unsupported in the react-server environment.\n// All environments should export the same functions to maintian API compatability.\n\nfunction buildIncompatibleInServerComponentsErrorMessage(fnName: string) {\n\treturn `${fnName} is not supported in Server Components. Remove ${fnName} in Server Components or add the \"use client\" directive to the component using ${fnName}.`;\n}\n\nfunction buildIncompatibleQueryHookInServerComponentsErrorMessage(\n\tfnName: string,\n) {\n\treturn `${fnName} is not supported in Server Components. Replace ${fnName} in Server Components with direct use of \\`@prismicio/client\\` (recommended) or add the \"use client\" directive to the component using the hook.`;\n}\n\nexport function PrismicProvider(): JSX.Element {\n\tthrow new Error(\n\t\tbuildIncompatibleInServerComponentsErrorMessage(\"<PrismicProvider>\"),\n\t);\n}\n\nexport function usePrismicContext() {\n\tthrow new Error(\n\t\tbuildIncompatibleInServerComponentsErrorMessage(\"usePrismicContext()\"),\n\t);\n}\n\nexport function usePrismicClient() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicClient()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicPreviewResolver() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicPreviewResolver()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsDangerously() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsDangerously()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsByEveryTag() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsByEveryTag()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsByIDs() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsByIDs()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsBySomeTags() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsBySomeTags()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsByTag() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsByTag()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsByType() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsByType()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsByUIDs() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsByUIDs()\",\n\t\t),\n\t);\n}\n\nexport function useFirstPrismicDocument() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useFirstPrismicDocument()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentByID() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentByID()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentByUID() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentByUID()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocuments() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocuments()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentsByEveryTag() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentsByEveryTag()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentsByIDs() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentsByIDs()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentsBySomeTags() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentsBySomeTags()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentsByTag() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentsByTag()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentsByType() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentsByType()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentsByUIDs() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentsByUIDs()\",\n\t\t),\n\t);\n}\n\nexport function useSinglePrismicDocument() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useSinglePrismicDocument()\",\n\t\t),\n\t);\n}\n"],"names":[],"mappings":";;AAGA,SAAS,gDAAgD,QAAc;AAC/D,SAAA,GAAG,wDAAwD,wFAAwF;AAC3J;AAEA,SAAS,yDACR,QAAc;AAEd,SAAO,GAAG,yDAAyD;AACpE;SAEgB,kBAAe;AAC9B,QAAM,IAAI,MACT,gDAAgD,mBAAmB,CAAC;AAEtE;SAEgB,oBAAiB;AAChC,QAAM,IAAI,MACT,gDAAgD,qBAAqB,CAAC;AAExE;SAEgB,mBAAgB;AAC/B,QAAM,IAAI,MACT,yDACC,oBAAoB,CACpB;AAEH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DACC,4BAA4B,CAC5B;AAEH;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,74 +1,74 @@
1
- function buildErrorMessage(fnName) {
2
- return `${fnName} is not supported in Server Components. Remove all uses of ${fnName} in Server Components.`;
1
+ function buildIncompatibleInServerComponentsErrorMessage(fnName) {
2
+ return `${fnName} is not supported in Server Components. Remove ${fnName} in Server Components or add the "use client" directive to the component using ${fnName}.`;
3
3
  }
4
- function buildHookErrorMessage(fnName) {
5
- return `${fnName} is not supported in Server Components. Replace all uses of ${fnName} in Server Components with direct use of \`@prismicio/client\`.`;
4
+ function buildIncompatibleQueryHookInServerComponentsErrorMessage(fnName) {
5
+ return `${fnName} is not supported in Server Components. Replace ${fnName} in Server Components with direct use of \`@prismicio/client\` (recommended) or add the "use client" directive to the component using the hook.`;
6
6
  }
7
7
  function PrismicProvider() {
8
- throw new Error(buildErrorMessage("<PrismicProvider>"));
8
+ throw new Error(buildIncompatibleInServerComponentsErrorMessage("<PrismicProvider>"));
9
9
  }
10
10
  function usePrismicContext() {
11
- throw new Error(buildErrorMessage("usePrismicContext()"));
11
+ throw new Error(buildIncompatibleInServerComponentsErrorMessage("usePrismicContext()"));
12
12
  }
13
13
  function usePrismicClient() {
14
- throw new Error(buildHookErrorMessage("usePrismicClient()"));
14
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("usePrismicClient()"));
15
15
  }
16
16
  function usePrismicPreviewResolver() {
17
- throw new Error(buildHookErrorMessage("usePrismicPreviewResolver()"));
17
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("usePrismicPreviewResolver()"));
18
18
  }
19
19
  function useAllPrismicDocumentsDangerously() {
20
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsDangerously()"));
20
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("useAllPrismicDocumentsDangerously()"));
21
21
  }
22
22
  function useAllPrismicDocumentsByEveryTag() {
23
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByEveryTag()"));
23
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("useAllPrismicDocumentsByEveryTag()"));
24
24
  }
25
25
  function useAllPrismicDocumentsByIDs() {
26
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByIDs()"));
26
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("useAllPrismicDocumentsByIDs()"));
27
27
  }
28
28
  function useAllPrismicDocumentsBySomeTags() {
29
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsBySomeTags()"));
29
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("useAllPrismicDocumentsBySomeTags()"));
30
30
  }
31
31
  function useAllPrismicDocumentsByTag() {
32
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByTag()"));
32
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("useAllPrismicDocumentsByTag()"));
33
33
  }
34
34
  function useAllPrismicDocumentsByType() {
35
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByType()"));
35
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("useAllPrismicDocumentsByType()"));
36
36
  }
37
37
  function useAllPrismicDocumentsByUIDs() {
38
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByUIDs()"));
38
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("useAllPrismicDocumentsByUIDs()"));
39
39
  }
40
40
  function useFirstPrismicDocument() {
41
- throw new Error(buildHookErrorMessage("useFirstPrismicDocument()"));
41
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("useFirstPrismicDocument()"));
42
42
  }
43
43
  function usePrismicDocumentByID() {
44
- throw new Error(buildHookErrorMessage("usePrismicDocumentByID()"));
44
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("usePrismicDocumentByID()"));
45
45
  }
46
46
  function usePrismicDocumentByUID() {
47
- throw new Error(buildHookErrorMessage("usePrismicDocumentByUID()"));
47
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("usePrismicDocumentByUID()"));
48
48
  }
49
49
  function usePrismicDocuments() {
50
- throw new Error(buildHookErrorMessage("usePrismicDocuments()"));
50
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("usePrismicDocuments()"));
51
51
  }
52
52
  function usePrismicDocumentsByEveryTag() {
53
- throw new Error(buildHookErrorMessage("usePrismicDocumentsByEveryTag()"));
53
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("usePrismicDocumentsByEveryTag()"));
54
54
  }
55
55
  function usePrismicDocumentsByIDs() {
56
- throw new Error(buildHookErrorMessage("usePrismicDocumentsByIDs()"));
56
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("usePrismicDocumentsByIDs()"));
57
57
  }
58
58
  function usePrismicDocumentsBySomeTags() {
59
- throw new Error(buildHookErrorMessage("usePrismicDocumentsBySomeTags()"));
59
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("usePrismicDocumentsBySomeTags()"));
60
60
  }
61
61
  function usePrismicDocumentsByTag() {
62
- throw new Error(buildHookErrorMessage("usePrismicDocumentsByTag()"));
62
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("usePrismicDocumentsByTag()"));
63
63
  }
64
64
  function usePrismicDocumentsByType() {
65
- throw new Error(buildHookErrorMessage("usePrismicDocumentsByType()"));
65
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("usePrismicDocumentsByType()"));
66
66
  }
67
67
  function usePrismicDocumentsByUIDs() {
68
- throw new Error(buildHookErrorMessage("usePrismicDocumentsByUIDs()"));
68
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("usePrismicDocumentsByUIDs()"));
69
69
  }
70
70
  function useSinglePrismicDocument() {
71
- throw new Error(buildHookErrorMessage("useSinglePrismicDocument()"));
71
+ throw new Error(buildIncompatibleQueryHookInServerComponentsErrorMessage("useSinglePrismicDocument()"));
72
72
  }
73
73
  export {
74
74
  PrismicProvider,
@@ -1 +1 @@
1
- {"version":3,"file":"unsupported.js","sources":["../../../src/react-server/unsupported.ts"],"sourcesContent":["// Exports in this file are unsupported in the react-server environment.\n// All environments should export the same functions to maintian API compatability.\n\nfunction buildErrorMessage(fnName: string) {\n\treturn `${fnName} is not supported in Server Components. Remove all uses of ${fnName} in Server Components.`;\n}\n\nfunction buildHookErrorMessage(fnName: string) {\n\treturn `${fnName} is not supported in Server Components. Replace all uses of ${fnName} in Server Components with direct use of \\`@prismicio/client\\`.`;\n}\n\nexport function PrismicProvider(): JSX.Element {\n\tthrow new Error(buildErrorMessage(\"<PrismicProvider>\"));\n}\n\nexport function usePrismicContext() {\n\tthrow new Error(buildErrorMessage(\"usePrismicContext()\"));\n}\n\nexport function usePrismicClient() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicClient()\"));\n}\n\nexport function usePrismicPreviewResolver() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicPreviewResolver()\"));\n}\n\nexport function useAllPrismicDocumentsDangerously() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsDangerously()\"));\n}\n\nexport function useAllPrismicDocumentsByEveryTag() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByEveryTag()\"));\n}\n\nexport function useAllPrismicDocumentsByIDs() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByIDs()\"));\n}\n\nexport function useAllPrismicDocumentsBySomeTags() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsBySomeTags()\"));\n}\n\nexport function useAllPrismicDocumentsByTag() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByTag()\"));\n}\n\nexport function useAllPrismicDocumentsByType() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByType()\"));\n}\n\nexport function useAllPrismicDocumentsByUIDs() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByUIDs()\"));\n}\n\nexport function useFirstPrismicDocument() {\n\tthrow new Error(buildHookErrorMessage(\"useFirstPrismicDocument()\"));\n}\n\nexport function usePrismicDocumentByID() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentByID()\"));\n}\n\nexport function usePrismicDocumentByUID() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentByUID()\"));\n}\n\nexport function usePrismicDocuments() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocuments()\"));\n}\n\nexport function usePrismicDocumentsByEveryTag() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByEveryTag()\"));\n}\n\nexport function usePrismicDocumentsByIDs() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByIDs()\"));\n}\n\nexport function usePrismicDocumentsBySomeTags() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsBySomeTags()\"));\n}\n\nexport function usePrismicDocumentsByTag() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByTag()\"));\n}\n\nexport function usePrismicDocumentsByType() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByType()\"));\n}\n\nexport function usePrismicDocumentsByUIDs() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByUIDs()\"));\n}\n\nexport function useSinglePrismicDocument() {\n\tthrow new Error(buildHookErrorMessage(\"useSinglePrismicDocument()\"));\n}\n"],"names":[],"mappings":"AAGA,SAAS,kBAAkB,QAAc;AACxC,SAAO,GAAG,oEAAoE;AAC/E;AAEA,SAAS,sBAAsB,QAAc;AAC5C,SAAO,GAAG,qEAAqE;AAChF;SAEgB,kBAAe;AAC9B,QAAM,IAAI,MAAM,kBAAkB,mBAAmB,CAAC;AACvD;SAEgB,oBAAiB;AAChC,QAAM,IAAI,MAAM,kBAAkB,qBAAqB,CAAC;AACzD;SAEgB,mBAAgB;AAC/B,QAAM,IAAI,MAAM,sBAAsB,oBAAoB,CAAC;AAC5D;SAEgB,4BAAyB;AACxC,QAAM,IAAI,MAAM,sBAA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IAAI,MAAM,sBAAsB,4BAA4B,CAAC;AACpE;"}
1
+ {"version":3,"file":"unsupported.js","sources":["../../../src/react-server/unsupported.ts"],"sourcesContent":["// Exports in this file are unsupported in the react-server environment.\n// All environments should export the same functions to maintian API compatability.\n\nfunction buildIncompatibleInServerComponentsErrorMessage(fnName: string) {\n\treturn `${fnName} is not supported in Server Components. Remove ${fnName} in Server Components or add the \"use client\" directive to the component using ${fnName}.`;\n}\n\nfunction buildIncompatibleQueryHookInServerComponentsErrorMessage(\n\tfnName: string,\n) {\n\treturn `${fnName} is not supported in Server Components. Replace ${fnName} in Server Components with direct use of \\`@prismicio/client\\` (recommended) or add the \"use client\" directive to the component using the hook.`;\n}\n\nexport function PrismicProvider(): JSX.Element {\n\tthrow new Error(\n\t\tbuildIncompatibleInServerComponentsErrorMessage(\"<PrismicProvider>\"),\n\t);\n}\n\nexport function usePrismicContext() {\n\tthrow new Error(\n\t\tbuildIncompatibleInServerComponentsErrorMessage(\"usePrismicContext()\"),\n\t);\n}\n\nexport function usePrismicClient() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicClient()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicPreviewResolver() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicPreviewResolver()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsDangerously() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsDangerously()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsByEveryTag() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsByEveryTag()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsByIDs() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsByIDs()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsBySomeTags() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsBySomeTags()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsByTag() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsByTag()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsByType() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsByType()\",\n\t\t),\n\t);\n}\n\nexport function useAllPrismicDocumentsByUIDs() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useAllPrismicDocumentsByUIDs()\",\n\t\t),\n\t);\n}\n\nexport function useFirstPrismicDocument() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useFirstPrismicDocument()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentByID() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentByID()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentByUID() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentByUID()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocuments() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocuments()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentsByEveryTag() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentsByEveryTag()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentsByIDs() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentsByIDs()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentsBySomeTags() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentsBySomeTags()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentsByTag() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentsByTag()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentsByType() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentsByType()\",\n\t\t),\n\t);\n}\n\nexport function usePrismicDocumentsByUIDs() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"usePrismicDocumentsByUIDs()\",\n\t\t),\n\t);\n}\n\nexport function useSinglePrismicDocument() {\n\tthrow new Error(\n\t\tbuildIncompatibleQueryHookInServerComponentsErrorMessage(\n\t\t\t\"useSinglePrismicDocument()\",\n\t\t),\n\t);\n}\n"],"names":[],"mappings":"AAGA,SAAS,gDAAgD,QAAc;AAC/D,SAAA,GAAG,wDAAwD,wFAAwF;AAC3J;AAEA,SAAS,yDACR,QAAc;AAEd,SAAO,GAAG,yDAAyD;AACpE;SAEgB,kBAAe;AAC9B,QAAM,IAAI,MACT,gDAAgD,mBAAmB,CAAC;AAEtE;SAEgB,oBAAiB;AAChC,QAAM,IAAI,MACT,gDAAgD,qBAAqB,CAAC;AAExE;SAEgB,mBAAgB;AAC/B,QAAM,IAAI,MACT,yDACC,oBAAoB,CACpB;AAEH;SAEgB,4BAAyB;AACxC,QAAM,IAAI,MACT,yDACC,6BAA6B,CAC7B;AAEH;SAEgB,oCAAiC;AAChD,QAA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3
- "version": "2.6.0-alpha.0",
3
+ "version": "2.6.0-alpha.2",
4
4
  "description": "React components and hooks to fetch and present Prismic content",
5
5
  "keywords": [
6
6
  "typescript",
@@ -57,7 +57,7 @@
57
57
  "@prismicio/richtext": "^2.1.4"
58
58
  },
59
59
  "devDependencies": {
60
- "@prismicio/client": "^7.0.0-alpha.2",
60
+ "@prismicio/client": "^7.0.0-alpha.3",
61
61
  "@prismicio/mock": "^0.2.0",
62
62
  "@size-limit/preset-small-lib": "^8.2.4",
63
63
  "@testing-library/react": "^14.0.0",
@@ -91,7 +91,7 @@
91
91
  "vitest": "^0.30.1"
92
92
  },
93
93
  "peerDependencies": {
94
- "@prismicio/client": "^7",
94
+ "@prismicio/client": "^6 || ^7",
95
95
  "react": "^18"
96
96
  },
97
97
  "engines": {
@@ -1,98 +1,184 @@
1
1
  // Exports in this file are unsupported in the react-server environment.
2
2
  // All environments should export the same functions to maintian API compatability.
3
3
 
4
- function buildErrorMessage(fnName: string) {
5
- return `${fnName} is not supported in Server Components. Remove all uses of ${fnName} in Server Components.`;
4
+ function buildIncompatibleInServerComponentsErrorMessage(fnName: string) {
5
+ return `${fnName} is not supported in Server Components. Remove ${fnName} in Server Components or add the "use client" directive to the component using ${fnName}.`;
6
6
  }
7
7
 
8
- function buildHookErrorMessage(fnName: string) {
9
- return `${fnName} is not supported in Server Components. Replace all uses of ${fnName} in Server Components with direct use of \`@prismicio/client\`.`;
8
+ function buildIncompatibleQueryHookInServerComponentsErrorMessage(
9
+ fnName: string,
10
+ ) {
11
+ return `${fnName} is not supported in Server Components. Replace ${fnName} in Server Components with direct use of \`@prismicio/client\` (recommended) or add the "use client" directive to the component using the hook.`;
10
12
  }
11
13
 
12
14
  export function PrismicProvider(): JSX.Element {
13
- throw new Error(buildErrorMessage("<PrismicProvider>"));
15
+ throw new Error(
16
+ buildIncompatibleInServerComponentsErrorMessage("<PrismicProvider>"),
17
+ );
14
18
  }
15
19
 
16
20
  export function usePrismicContext() {
17
- throw new Error(buildErrorMessage("usePrismicContext()"));
21
+ throw new Error(
22
+ buildIncompatibleInServerComponentsErrorMessage("usePrismicContext()"),
23
+ );
18
24
  }
19
25
 
20
26
  export function usePrismicClient() {
21
- throw new Error(buildHookErrorMessage("usePrismicClient()"));
27
+ throw new Error(
28
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
29
+ "usePrismicClient()",
30
+ ),
31
+ );
22
32
  }
23
33
 
24
34
  export function usePrismicPreviewResolver() {
25
- throw new Error(buildHookErrorMessage("usePrismicPreviewResolver()"));
35
+ throw new Error(
36
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
37
+ "usePrismicPreviewResolver()",
38
+ ),
39
+ );
26
40
  }
27
41
 
28
42
  export function useAllPrismicDocumentsDangerously() {
29
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsDangerously()"));
43
+ throw new Error(
44
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
45
+ "useAllPrismicDocumentsDangerously()",
46
+ ),
47
+ );
30
48
  }
31
49
 
32
50
  export function useAllPrismicDocumentsByEveryTag() {
33
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByEveryTag()"));
51
+ throw new Error(
52
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
53
+ "useAllPrismicDocumentsByEveryTag()",
54
+ ),
55
+ );
34
56
  }
35
57
 
36
58
  export function useAllPrismicDocumentsByIDs() {
37
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByIDs()"));
59
+ throw new Error(
60
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
61
+ "useAllPrismicDocumentsByIDs()",
62
+ ),
63
+ );
38
64
  }
39
65
 
40
66
  export function useAllPrismicDocumentsBySomeTags() {
41
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsBySomeTags()"));
67
+ throw new Error(
68
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
69
+ "useAllPrismicDocumentsBySomeTags()",
70
+ ),
71
+ );
42
72
  }
43
73
 
44
74
  export function useAllPrismicDocumentsByTag() {
45
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByTag()"));
75
+ throw new Error(
76
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
77
+ "useAllPrismicDocumentsByTag()",
78
+ ),
79
+ );
46
80
  }
47
81
 
48
82
  export function useAllPrismicDocumentsByType() {
49
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByType()"));
83
+ throw new Error(
84
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
85
+ "useAllPrismicDocumentsByType()",
86
+ ),
87
+ );
50
88
  }
51
89
 
52
90
  export function useAllPrismicDocumentsByUIDs() {
53
- throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByUIDs()"));
91
+ throw new Error(
92
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
93
+ "useAllPrismicDocumentsByUIDs()",
94
+ ),
95
+ );
54
96
  }
55
97
 
56
98
  export function useFirstPrismicDocument() {
57
- throw new Error(buildHookErrorMessage("useFirstPrismicDocument()"));
99
+ throw new Error(
100
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
101
+ "useFirstPrismicDocument()",
102
+ ),
103
+ );
58
104
  }
59
105
 
60
106
  export function usePrismicDocumentByID() {
61
- throw new Error(buildHookErrorMessage("usePrismicDocumentByID()"));
107
+ throw new Error(
108
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
109
+ "usePrismicDocumentByID()",
110
+ ),
111
+ );
62
112
  }
63
113
 
64
114
  export function usePrismicDocumentByUID() {
65
- throw new Error(buildHookErrorMessage("usePrismicDocumentByUID()"));
115
+ throw new Error(
116
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
117
+ "usePrismicDocumentByUID()",
118
+ ),
119
+ );
66
120
  }
67
121
 
68
122
  export function usePrismicDocuments() {
69
- throw new Error(buildHookErrorMessage("usePrismicDocuments()"));
123
+ throw new Error(
124
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
125
+ "usePrismicDocuments()",
126
+ ),
127
+ );
70
128
  }
71
129
 
72
130
  export function usePrismicDocumentsByEveryTag() {
73
- throw new Error(buildHookErrorMessage("usePrismicDocumentsByEveryTag()"));
131
+ throw new Error(
132
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
133
+ "usePrismicDocumentsByEveryTag()",
134
+ ),
135
+ );
74
136
  }
75
137
 
76
138
  export function usePrismicDocumentsByIDs() {
77
- throw new Error(buildHookErrorMessage("usePrismicDocumentsByIDs()"));
139
+ throw new Error(
140
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
141
+ "usePrismicDocumentsByIDs()",
142
+ ),
143
+ );
78
144
  }
79
145
 
80
146
  export function usePrismicDocumentsBySomeTags() {
81
- throw new Error(buildHookErrorMessage("usePrismicDocumentsBySomeTags()"));
147
+ throw new Error(
148
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
149
+ "usePrismicDocumentsBySomeTags()",
150
+ ),
151
+ );
82
152
  }
83
153
 
84
154
  export function usePrismicDocumentsByTag() {
85
- throw new Error(buildHookErrorMessage("usePrismicDocumentsByTag()"));
155
+ throw new Error(
156
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
157
+ "usePrismicDocumentsByTag()",
158
+ ),
159
+ );
86
160
  }
87
161
 
88
162
  export function usePrismicDocumentsByType() {
89
- throw new Error(buildHookErrorMessage("usePrismicDocumentsByType()"));
163
+ throw new Error(
164
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
165
+ "usePrismicDocumentsByType()",
166
+ ),
167
+ );
90
168
  }
91
169
 
92
170
  export function usePrismicDocumentsByUIDs() {
93
- throw new Error(buildHookErrorMessage("usePrismicDocumentsByUIDs()"));
171
+ throw new Error(
172
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
173
+ "usePrismicDocumentsByUIDs()",
174
+ ),
175
+ );
94
176
  }
95
177
 
96
178
  export function useSinglePrismicDocument() {
97
- throw new Error(buildHookErrorMessage("useSinglePrismicDocument()"));
179
+ throw new Error(
180
+ buildIncompatibleQueryHookInServerComponentsErrorMessage(
181
+ "useSinglePrismicDocument()",
182
+ ),
183
+ );
98
184
  }