@prismicio/next 0.1.4-alpha.0 → 0.1.4

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.
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import Image from 'next/image';
3
3
  import { buildURL } from 'imgix-url-builder';
4
4
  import * as prismicH from '@prismicio/helpers';
@@ -43,7 +43,7 @@ const PrismicNextImage = ({
43
43
  }
44
44
  if (prismicH.isFilled.imageThumbnail(field)) {
45
45
  const src = buildURL(field.url, imgixParams);
46
- return /* @__PURE__ */ React.createElement(Image, {
46
+ return /* @__PURE__ */ jsx(Image, {
47
47
  src,
48
48
  width: layout === "fill" ? void 0 : field.dimensions.width,
49
49
  height: layout === "fill" ? void 0 : field.dimensions.height,
@@ -1,3 +1,4 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
1
2
  import * as React from 'react';
2
3
  import { PrismicToolbar } from '@prismicio/react';
3
4
  import { useRouter } from 'next/router';
@@ -73,9 +74,14 @@ function PrismicPreview({
73
74
  router.isPreview,
74
75
  router.basePath
75
76
  ]);
76
- return /* @__PURE__ */ React.createElement(React.Fragment, null, children, /* @__PURE__ */ React.createElement(PrismicToolbar, {
77
- repositoryName
78
- }));
77
+ return /* @__PURE__ */ jsxs(Fragment, {
78
+ children: [
79
+ children,
80
+ /* @__PURE__ */ jsx(PrismicToolbar, {
81
+ repositoryName
82
+ })
83
+ ]
84
+ });
79
85
  }
80
86
 
81
87
  export { PrismicPreview };
package/dist/index.d.ts CHANGED
@@ -134,7 +134,8 @@ declare type EnableAutoPreviewsConfig<TPreviewData extends PreviewData = Preview
134
134
  /**
135
135
  * A Next.js API endpoint request object.
136
136
  *
137
- * Pass a `req` object when using `enableAutoPreviews` in a Next.js API endpoint.
137
+ * Pass a `req` object when using `enableAutoPreviews` in a Next.js API
138
+ * endpoint.
138
139
  */
139
140
  req?: HttpRequestLike;
140
141
  });
@@ -180,7 +181,8 @@ declare type RedirectToPreviewURLConfig<TLinkResolverFunction extends LinkResolv
180
181
  */
181
182
  linkResolver?: TLinkResolverFunction;
182
183
  /**
183
- * The default redirect URL if a URL cannot be determined for the previewed document.
184
+ * The default redirect URL if a URL cannot be determined for the previewed
185
+ * document.
184
186
  *
185
187
  * **Note**: If you `next.config.js` file contains a `basePath`, the
186
188
  * `defaultURL` option must _not_ include it. Instead, provide the `basePath`
@@ -241,7 +243,8 @@ declare type PrismicNextImageProps = Omit<ImageProps, "src" | "alt" | "width" |
241
243
  *
242
244
  * @param props - Props for the component.
243
245
  *
244
- * @returns A responsive image component using `next/image` for the given Image field.
246
+ * @returns A responsive image component using `next/image` for the given Image
247
+ * field.
245
248
  *
246
249
  * @see To learn more about `next/image`, see: https://nextjs.org/docs/api-reference/next/image
247
250
  */
package/dist/package.mjs CHANGED
@@ -1,3 +1,3 @@
1
- const version = "0.1.4-alpha.0";
1
+ const version = "0.1.4";
2
2
 
3
3
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/next",
3
- "version": "0.1.4-alpha.0",
3
+ "version": "0.1.4",
4
4
  "description": "Helpers to integrate Prismic into Next.js apps",
5
5
  "keywords": [
6
6
  "typescript",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "scripts": {
29
29
  "build": "unbuild",
30
- "dev": "unbuild --stub",
30
+ "dev": "chokidar src --initial --command unbuild",
31
31
  "format": "prettier --write .",
32
32
  "lint": "eslint --ext .js,.ts .",
33
33
  "prepare": "npm run build",
@@ -41,22 +41,23 @@
41
41
  "unit:watch": "vitest watch"
42
42
  },
43
43
  "dependencies": {
44
- "@prismicio/client": "^6.7.0",
44
+ "@prismicio/client": "^6.7.1",
45
45
  "@prismicio/helpers": "^2.3.3",
46
46
  "@prismicio/react": "^2.5.0",
47
47
  "@prismicio/types": "^0.2.3",
48
- "eslint-plugin-react": "^7.30.1",
48
+ "eslint-plugin-react": "^7.31.7",
49
49
  "eslint-plugin-react-hooks": "^4.6.0",
50
50
  "imgix-url-builder": "^0.0.3"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@prismicio/mock": "^0.1.1",
54
- "@size-limit/preset-small-lib": "^8.0.1",
54
+ "@size-limit/preset-small-lib": "^8.1.0",
55
55
  "@types/react-test-renderer": "^18.0.0",
56
- "@typescript-eslint/eslint-plugin": "^5.34.0",
57
- "@typescript-eslint/parser": "^5.34.0",
58
- "@vitest/coverage-c8": "^0.22.1",
59
- "eslint": "^8.22.0",
56
+ "@typescript-eslint/eslint-plugin": "^5.36.2",
57
+ "@typescript-eslint/parser": "^5.36.2",
58
+ "@vitest/coverage-c8": "^0.23.1",
59
+ "chokidar-cli": "^3.0.0",
60
+ "eslint": "^8.23.0",
60
61
  "eslint-config-prettier": "^8.5.0",
61
62
  "eslint-plugin-prettier": "^4.2.1",
62
63
  "eslint-plugin-tsdoc": "^0.2.16",
@@ -64,14 +65,14 @@
64
65
  "next": "^12.1.4",
65
66
  "nyc": "^15.1.0",
66
67
  "prettier": "^2.7.1",
67
- "prettier-plugin-jsdoc": "^0.3.38",
68
+ "prettier-plugin-jsdoc": "^0.4.2",
68
69
  "react": "^18.1.0",
69
70
  "react-test-renderer": "^18.2.0",
70
- "size-limit": "^8.0.1",
71
+ "size-limit": "^8.1.0",
71
72
  "standard-version": "^9.5.0",
72
- "typescript": "^4.7.4",
73
- "unbuild": "^0.8.9",
74
- "vitest": "^0.22.1"
73
+ "typescript": "^4.8.3",
74
+ "unbuild": "^0.8.10",
75
+ "vitest": "^0.23.1"
75
76
  },
76
77
  "peerDependencies": {
77
78
  "@prismicio/client": "^6.0.0",
@@ -75,7 +75,8 @@ export type PrismicNextImageProps = Omit<
75
75
  *
76
76
  * @param props - Props for the component.
77
77
  *
78
- * @returns A responsive image component using `next/image` for the given Image field.
78
+ * @returns A responsive image component using `next/image` for the given Image
79
+ * field.
79
80
  *
80
81
  * @see To learn more about `next/image`, see: https://nextjs.org/docs/api-reference/next/image
81
82
  */
@@ -120,10 +120,12 @@ export function PrismicPreview({
120
120
  // Prismic preview share link.
121
121
 
122
122
  /**
123
- * Determines if the current location is a descendant of the app's base path.
123
+ * Determines if the current location is a descendant of the app's base
124
+ * path.
124
125
  *
125
126
  * This is used to prevent infinite refrehes; when
126
- * `isDescendantOfBasePath` is `false`, `router.isPreview` is also `false`.
127
+ * `isDescendantOfBasePath` is `false`, `router.isPreview` is also
128
+ * `false`.
127
129
  *
128
130
  * If the app does not have a base path, this should always be `true`.
129
131
  */
@@ -10,7 +10,8 @@ interface PrismicNextPreviewData {
10
10
  *
11
11
  * @param previewData - The Next.js preview data object to check.
12
12
  *
13
- * @returns `true` if `previewData` contains Prismic preview data, `false` otherwise.
13
+ * @returns `true` if `previewData` contains Prismic preview data, `false`
14
+ * otherwise.
14
15
  */
15
16
  const isPrismicNextPreviewData = (
16
17
  previewData: PreviewData,
@@ -45,7 +46,8 @@ export type EnableAutoPreviewsConfig<
45
46
  /**
46
47
  * A Next.js API endpoint request object.
47
48
  *
48
- * Pass a `req` object when using `enableAutoPreviews` in a Next.js API endpoint.
49
+ * Pass a `req` object when using `enableAutoPreviews` in a Next.js API
50
+ * endpoint.
49
51
  */
50
52
  req?: HttpRequestLike;
51
53
  }
@@ -7,7 +7,8 @@ const readValue = (value: string): string => {
7
7
  /**
8
8
  * Returns the value of a cookie from a given cookie store.
9
9
  *
10
- * @param cookieJar - The stringified cookie store from which to read the cookie.
10
+ * @param cookieJar - The stringified cookie store from which to read the
11
+ * cookie.
11
12
  *
12
13
  * @returns The value of the cookie, if it exists.
13
14
  */
@@ -63,7 +63,8 @@ export type RedirectToPreviewURLConfig<
63
63
  linkResolver?: TLinkResolverFunction;
64
64
 
65
65
  /**
66
- * The default redirect URL if a URL cannot be determined for the previewed document.
66
+ * The default redirect URL if a URL cannot be determined for the previewed
67
+ * document.
67
68
  *
68
69
  * **Note**: If you `next.config.js` file contains a `basePath`, the
69
70
  * `defaultURL` option must _not_ include it. Instead, provide the `basePath`