@prezly/theme-kit-nextjs 2.0.0-4 → 2.0.1-0

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/README.md CHANGED
@@ -51,12 +51,17 @@ If you don't have these credentials, you can use one of our [testing newsrooms c
51
51
  In a base setup, you don't have to make any changes to your config.
52
52
  Depending on your use-case, you might need to make some additions to your base config.
53
53
 
54
+ #### ⚠️ IMPORTANT: Theme Kit v2 is ESM-only package!
55
+
56
+ You should be totally fine if you don't need to import anything from `@prezly/theme-kit-nextjs` in your `next.config.js`, which is a CommonJS file by default.
57
+ In order to import from `@prezly/theme-kit-nextjs`, you will need either to set `type` property to `module` in your `package.json`, or rename `next.config.js` to `next.config.mjs`, so that it's treated as ES Module.
58
+
54
59
  #### Using next/image to display images served from Prezly
55
60
 
56
61
  We provide `@prezly/uploadcare-image` package to conveniently display images inside Prezly content, and this is the recommended way to display images in your theme.
57
62
  However, if you need to use the default `next/image` component, you will need to add our CDN url to image domains settings:
58
63
  ```js
59
- module.exports = {
64
+ export default {
60
65
  /* ...your next config... */
61
66
  images: {
62
67
  domains: ['cdn.uc.assets.prezly.com'],
@@ -69,9 +74,9 @@ module.exports = {
69
74
  If you want to support multi-language in your theme, you'll need to make additional changes to the file:
70
75
 
71
76
  ```js
72
- const { localeConfig } = require('@prezly/theme-kit-nextjs/localeConfig');
77
+ import { localeConfig } from '@prezly/theme-kit-nextjs/localeConfig';
73
78
 
74
- module.exports = {
79
+ export default {
75
80
  /* ...your next config... */
76
81
 
77
82
  i18n: localeConfig,
@@ -1,6 +1,6 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
  import { NextSeo } from 'next-seo';
3
- import { useRouter } from 'next/router';
3
+ import { useRouter } from "next/router.js";
4
4
  import { useMemo } from 'react';
5
5
  import { getUsedLanguages, LocaleObject } from "../../intl/index.js";
6
6
  import { useCompanyInformation, useCurrentLocale, useCurrentStory, useGetLinkLocaleSlug, useGetTranslationUrl, useLanguages, useNewsroom } from "../../newsroom-context/index.js";
@@ -1,4 +1,4 @@
1
- import Document, { Head, Html, Main, NextScript } from 'next/document';
1
+ import Document, { Head, Html, Main, NextScript } from "next/document.js";
2
2
  import { DEFAULT_LOCALE, getLocaleDirection, LocaleObject } from "../intl/index.js";
3
3
  export class PrezlyThemeDocument extends Document {
4
4
  getLocaleCode() {
@@ -1,5 +1,5 @@
1
1
  import { Story } from '@prezly/sdk';
2
- import { useRouter } from 'next/router';
2
+ import { useRouter } from "next/router.js";
3
3
  import { useCallback } from 'react';
4
4
  import { getCategoryHasTranslation, getCategoryUrl } from "../../utils/index.js";
5
5
  import { useCurrentCategory } from "./useCurrentCategory.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/theme-kit-nextjs",
3
- "version": "2.0.0-4",
3
+ "version": "2.0.1-0",
4
4
  "description": "Data layer and utility library for developing Prezly themes with NextJS",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -77,7 +77,7 @@
77
77
  "@types/react": "18.0.25",
78
78
  "@types/react-dom": "18.0.9",
79
79
  "babel-plugin-add-import-extension": "1.6.0",
80
- "eslint": "8.27.0",
80
+ "eslint": "8.28.0",
81
81
  "jest": "29.3.1",
82
82
  "np": "7.6.2",
83
83
  "prettier": "2.7.1",