Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename constants/Language module to the right suffix, and other actions to make ESM bundlers happy. #6130

Merged
merged 12 commits into from
Jun 28, 2024
16 changes: 16 additions & 0 deletions docs/source/upgrade-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,22 @@ The input field's placeholder text was moved above the buttons.
Together these changes improve usability both on small screens and in small containers, such as when the widget is in grid block elements.


### Renaming of the `constants/Languages` module
sneridagh marked this conversation as resolved.
Show resolved Hide resolved

`src/constants/Languages.js` has been renamed to `src/constants/Languages.cjs` since in fact, it's a commonJS module.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
This change is needed in order to be consistent with modules suffixes in Volto core, in preparation for replacing Razzle with a modern builder.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved

The only Volto component that makes use of it is `PersonalPreferences`, if you have shadowed it you should update this component.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
For the rest, it is unlikely that your code refers to this module, since it's used internally by Volto itself.

### Renaming of `test-setup-config` module
sneridagh marked this conversation as resolved.
Show resolved Hide resolved

`test-setup-config.js` has been renamed to `test-setup-config.jsx` since in fact, it contains JSX on it.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
This change is needed in order to be consistent with modules suffixes in Volto core, in preparation for replacing Razzle with a modern builder.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved

It is unlikely that your code uses it, only in case that you have heavily customized the Jest testing pipeline.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved


(volto-upgrade-guide-17.x.x)=

## Upgrading to Volto 17.x.x
Expand Down
1 change: 1 addition & 0 deletions packages/volto-slate/news/6130.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add proper dependencies to volto-slate @sneridagh
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 7 additions & 1 deletion packages/volto-slate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@
"access": "public"
},
"dependencies": {
"classnames": "2.2.6",
"github-slugger": "1.4.0",
"image-extensions": "1.1.0",
"is-hotkey": "0.2.0",
"is-url": "1.2.4",
"jsdom": "^16.6.0",
"lodash": "4.17.21",
"react": "18.2.0",
"react-intersection-observer": "9.1.0",
"react-dom": "18.2.0",
"react-intersection-observer": "9.1.0",
"redux-mock-store": "1.5.4",
"slate": "0.100.0",
"slate-history": "0.100.0",
"slate-hyperscript": "0.100.0",
"slate-react": "0.98.4",
"uuid": "^9.0.1",
"weak-key": "^1.0.2"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/volto/news/6130.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix remaining module.export in `constants/Languages.js` @sneridagh
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion packages/volto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
},
"setupFiles": [
"./test-setup-globals.js",
"./test-setup-config.js"
"./test-setup-config.jsx"
],
"globalSetup": "./global-test-setup.js",
"setupFilesAfterEnv": [
Expand Down
2 changes: 1 addition & 1 deletion packages/volto/razzle.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const AfterBuildPlugin = require('@fiverr/afterbuild-webpack-plugin');
const fileLoaderFinder = makeLoaderFinder('file-loader');

const projectRootPath = path.resolve('.');
const languages = require('./src/constants/Languages');
const languages = require('./src/constants/Languages.cjs');

const packageJson = require(path.join(projectRootPath, 'package.json'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { toast } from 'react-toastify';

import { Toast } from '@plone/volto/components';
import { Form } from '@plone/volto/components/manage/Form';
import languages from '@plone/volto/constants/Languages';
import languages from '@plone/volto/constants/Languages.cjs';
import { changeLanguage } from '@plone/volto/actions';
import { toGettextLang } from '@plone/volto/helpers';
import config from '@plone/volto/registry';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ module.exports = {
pt_BR: 'Português (Brasil)',
zh_CN: '中文',
};

// export default languages;
2 changes: 1 addition & 1 deletion packages/volto/src/helpers/AuthToken/AuthToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function persistAuthToken(store, req) {
handleChange(true);
}

if (module.hot) {
if (module?.hot) {
module.hot.dispose((data) => {
data.reloaded = true;
});
Expand Down
2 changes: 1 addition & 1 deletion packages/volto/src/server.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import userSession from '@plone/volto/reducers/userSession/userSession';

import ErrorPage from '@plone/volto/error';

import languages from '@plone/volto/constants/Languages';
import languages from '@plone/volto/constants/Languages.cjs';

import configureStore from '@plone/volto/store';
import { ReduxAsyncConnect, loadOnServer } from './helpers/AsyncConnect';
Expand Down
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading