Skip to content

Commit

Permalink
LPD-28125 Fix imports to make top level await usable
Browse files Browse the repository at this point in the history
If we use require() esbuild complains due to
evanw/esbuild#253
  • Loading branch information
izaera committed Jul 8, 2024
1 parent 33b9803 commit 84eaf74
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,27 @@
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/

// @ts-ignore

const {
default: AvailabilityCPInstanceChangeHandler,
} = require('./AvailabilityCPInstanceChangeHandler');
export {default as AutoField} from './AutoField';

// @ts-ignore

const {default: CPInstanceChangeHandler} = require('./CPInstanceChangeHandler');
export {default as AvailabilityCPInstanceChangeHandler} from './AvailabilityCPInstanceChangeHandler';

// @ts-ignore

const {default: OptionSelector} = require('./OptionSelector');
export {default as CPInstanceChangeHandler} from './CPInstanceChangeHandler';
export {CategorySelector} from './CategorySelector';

// @ts-ignore

const {default: Tabs} = require('./Tabs');
export {default as OptionSelector} from './OptionSelector';
export {Rule} from './Rule';

// @ts-ignore

const {default: miniCompare} = require('./miniCompare');

export {default as Tabs} from './Tabs';
export {TagSelector} from './TagSelector';
export {Rule} from './Rule';
export {CategorySelector} from './CategorySelector';
export {default as AutoField} from './AutoField';

export {
AvailabilityCPInstanceChangeHandler,
CPInstanceChangeHandler,
OptionSelector,
Tabs,
miniCompare,
};
// @ts-ignore

export {default as miniCompare} from './miniCompare';
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
import ClayLabel from '@clayui/label';
import React from 'react';

const {default: CollapsibleSection} = require('./CollapsibleSection');
const {default: ItemVocabularies} = require('./ItemVocabularies');
// @ts-ignore

import CollapsibleSection from './CollapsibleSection';

// @ts-ignore

import ItemVocabularies from './ItemVocabularies';
import {
getCategoriesCountFromVocabularies,
groupVocabulariesBy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
import ClayLink from '@clayui/link';
import React from 'react';

const {default: Preview} = require('./Preview');
const {default: Share} = require('./Share');
// @ts-ignore

import Preview from './Preview';

// @ts-ignore

import Share from './Share';

const PreviewActionsDescriptionSection = ({
description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import ClayIcon from '@clayui/icon';
import {ClayTooltipProvider} from '@clayui/tooltip';
import React from 'react';

const {default: FileUrlCopyButton} = require('./FileUrlCopyButton');
const {default: formatDate} = require('./utils/formatDate');
// @ts-ignore

import FileUrlCopyButton from './FileUrlCopyButton';
import formatDate from './utils/formatDate';

const SpecificItem = ({
languageTag,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import {ClayButtonWithIcon} from '@clayui/button';
import {fetch, openToast} from 'frontend-js-web';
import React, {useContext} from 'react';

const {SidebarContext} = require('../Sidebar');
// @ts-ignore

import {SidebarContext} from '../Sidebar';

const Subscribe = ({disabled, icon, label, url}: IProps) => {
const {fetchData} = useContext(SidebarContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/

const {
default: SidebarPanelInfoView,
} = require('../components/SidebarPanelInfoView/SidebarPanelInfoView');
const {OPEN_PANEL_VALUE} = require('../utils/constants');
const ActionsComponentPropsTransformer = require('./ActionsComponentPropsTransformer');
// @ts-ignore

import SidebarPanelInfoView from '../components/SidebarPanelInfoView/SidebarPanelInfoView';

// @ts-ignore

import {OPEN_PANEL_VALUE} from '../utils/constants';

// @ts-ignore

import ActionsComponentPropsTransformer from './ActionsComponentPropsTransformer';

const handlePanelStateFromSession = ({
currentRowId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ export const COLORS = [
];

export const DEFAULT_COLOR = '#CDCED9';

export const OPEN_PANEL_VALUE = undefined;
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,101 @@
*/

/*
* Using 'require' here since they are .js files and we need to cast to `any`.
* Using '@ts-ignore' here since they are .js files and we need to cast to `any`.
*/
const {default: Captcha} = require('./Captcha/Captcha.es');
const {
default: CheckboxMultiple,
} = require('./CheckboxMultiple/CheckboxMultiple.es');
const {default: ColorPicker} = require('./ColorPicker/ColorPicker.es');
const {default: DatePicker} = require('./DatePicker/DatePicker.es');
const {
default: DocumentLibrary,
} = require('./DocumentLibrary/DocumentLibrary.es');
const {default: ReactFieldBase} = require('./FieldBase/ReactFieldBase.es');
const {default: FieldSet} = require('./FieldSet/FieldSet.es');
const {default: Geolocation} = require('./Geolocation/Geolocation.es');
const {default: Grid} = require('./Grid/Grid.es');
const {default: HelpText} = require('./HelpText/HelpText.es');
const {default: ImagePicker} = require('./ImagePicker/ImagePicker.es');
const {
default: LocalizableText,
} = require('./LocalizableText/LocalizableText.es');
const {default: ObjectField} = require('./ObjectField/ObjectField');
const {
default: OptionFieldKeyValue,
} = require('./OptionFieldKeyValue/OptionFieldKeyValue');
const {default: Options} = require('./Options/Options.es');
const {default: Paragraph} = require('./Paragraph/Paragraph.es');
const {default: Password} = require('./Password/Password.es');
const {default: Radio} = require('./Radio/Radio.es');
const {default: RedirectButton} = require('./RedirectButton/RedirectButton.es');
const {default: RichText} = require('./RichText/RichText.es');
const {default: SearchLocation} = require('./SearchLocation/SearchLocation.es');
const {default: Separator} = require('./Separator/Separator.es');
const {default: Text} = require('./Text/Text.es');
const {default: Validation} = require('./Validation/Validation');

// @ts-ignore

import Captcha from './Captcha/Captcha.es';

// @ts-ignore

import CheckboxMultiple from './CheckboxMultiple/CheckboxMultiple.es';

// @ts-ignore

import ColorPicker from './ColorPicker/ColorPicker.es';

// @ts-ignore

import DatePicker from './DatePicker/DatePicker.es';

// @ts-ignore

import DocumentLibrary from './DocumentLibrary/DocumentLibrary.es';
import ReactFieldBase from './FieldBase/ReactFieldBase.es';

// @ts-ignore

import FieldSet from './FieldSet/FieldSet.es';

// @ts-ignore

import Geolocation from './Geolocation/Geolocation.es';

// @ts-ignore

import Grid from './Grid/Grid.es';

// @ts-ignore

import HelpText from './HelpText/HelpText.es';

// @ts-ignore

import ImagePicker from './ImagePicker/ImagePicker.es';

// @ts-ignore

import LocalizableText from './LocalizableText/LocalizableText.es';

// @ts-ignore

import ObjectField from './ObjectField/ObjectField';

// @ts-ignore

import OptionFieldKeyValue from './OptionFieldKeyValue/OptionFieldKeyValue';

// @ts-ignore

import Options from './Options/Options.es';

// @ts-ignore

import Paragraph from './Paragraph/Paragraph.es';

// @ts-ignore

import Password from './Password/Password.es';

// @ts-ignore

import Radio from './Radio/Radio.es';

// @ts-ignore

import RedirectButton from './RedirectButton/RedirectButton.es';

// @ts-ignore

import RichText from './RichText/RichText.es';

// @ts-ignore

import SearchLocation from './SearchLocation/SearchLocation.es';

// @ts-ignore

import Separator from './Separator/Separator.es';

// @ts-ignore

import Text from './Text/Text.es';

// @ts-ignore

import Validation from './Validation/Validation';

export {default as Checkbox} from './Checkbox/Checkbox';
export {default as Numeric} from './Numeric/Numeric';
Expand Down

0 comments on commit 84eaf74

Please sign in to comment.