Skip to content

Commit 646b32b

Browse files
fix(base): mark base package as type: module (#4140)
1 parent 3bc9fe1 commit 646b32b

File tree

14 files changed

+43
-31
lines changed

14 files changed

+43
-31
lines changed

docs/Welcome.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ UI5 Web Components and UI5 Web Components for React are both coming with the `sa
124124
children={
125125
<>
126126
UI5 Web Components for React uses the theme configuration of UI5 Web Components. Please also have a look at their{' '}
127-
<Link href="https://sap.github.io/ui5-webcomponents/playground/advanced/configuration/#theme">documentation</Link>
128-
.
127+
<Link href="https://sap.github.io/ui5-webcomponents/playground/advanced/configuration/#theme">documentation</Link>.
129128
</>
130129
}
131130
/>

packages/base/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,20 @@
22
"name": "@ui5/webcomponents-react-base",
33
"version": "1.13.1",
44
"description": "Base for ui5-webcomponents-react",
5+
"type": "module",
56
"main": "dist/index.js",
67
"module": "dist/index.js",
78
"types": "dist/index.d.ts",
9+
"exports": {
10+
".": {
11+
"types": "./dist/index.d.ts",
12+
"default": "./dist/index.js"
13+
},
14+
"./package.json": "./package.json",
15+
"./dist": "./dist/index.js",
16+
"./dist/*": "./dist/*",
17+
"./dist/*.js": "./dist/*.js"
18+
},
819
"homepage": "https://sap.github.io/ui5-webcomponents-react",
920
"repository": {
1021
"type": "git",

packages/base/src/Device/Media.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import UI5MediaRange from '@ui5/webcomponents-base/dist/MediaRange.js';
2-
import { MediaEventProvider, RANGE_LEGACY_4_STEPS, RangeInfo } from './EventProvider';
2+
import { MediaEventProvider, RANGE_LEGACY_4_STEPS, RangeInfo } from './EventProvider.js';
33

44
type RANGE_4_STEPS = 'S' | 'M' | 'L' | 'XL';
55

packages/base/src/Device/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { supportsTouch } from '@ui5/webcomponents-base/dist/Device.js';
2-
import { IOrientation, IWindowSize, OrientationEventProvider, ResizeEventProvider } from './EventProvider';
2+
import { IOrientation, IWindowSize, OrientationEventProvider, ResizeEventProvider } from './EventProvider.js';
33

44
const isSSR = () => typeof window === 'undefined';
55

@@ -165,7 +165,7 @@ const handleResizeEvent = () => {
165165
// re-export everything from the web components device
166166
export * from '@ui5/webcomponents-base/dist/Device.js';
167167
// export all media methods
168-
export { attachMediaHandler, detachMediaHandler, getCurrentRange } from './Media';
168+
export { attachMediaHandler, detachMediaHandler, getCurrentRange } from './Media.js';
169169

170170
// resize events
171171
export const attachResizeHandler = (fnFunction: (windowSize: IWindowSize) => void): void => {

packages/base/src/context/I18nContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22

3-
import I18nBundle from '@ui5/webcomponents-base/dist/i18nBundle.js';
3+
import type I18nBundle from '@ui5/webcomponents-base/dist/i18nBundle.js';
44
import { createContext, useContext } from 'react';
55

66
export const I18nContext = createContext<{

packages/base/src/hooks/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { useCurrentTheme } from './useCurrentTheme';
2-
import { useI18nBundle } from './useI18nBundle';
3-
import { useIsomorphicId } from './useIsomorphicId';
4-
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
5-
import { useIsRTL } from './useIsRTL';
6-
import { useResponsiveContentPadding } from './useResponsiveContentPadding';
7-
import { useSyncRef } from './useSyncRef';
8-
import { useViewportRange } from './useViewportRange';
1+
import { useCurrentTheme } from './useCurrentTheme.js';
2+
import { useI18nBundle } from './useI18nBundle.js';
3+
import { useIsomorphicId } from './useIsomorphicId.js';
4+
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.js';
5+
import { useIsRTL } from './useIsRTL.js';
6+
import { useResponsiveContentPadding } from './useResponsiveContentPadding.js';
7+
import { useSyncRef } from './useSyncRef.js';
8+
import { useViewportRange } from './useViewportRange.js';
99

1010
export {
1111
useI18nBundle,

packages/base/src/hooks/useI18nBundle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import I18nBundle, { getI18nBundle } from '@ui5/webcomponents-base/dist/i18nBundle.js';
44
import { useRef } from 'react';
5-
import { useI18nContext } from '../context/I18nContext';
6-
import { useIsomorphicLayoutEffect } from '../hooks';
5+
import { useI18nContext } from '../context/I18nContext.js';
6+
import { useIsomorphicLayoutEffect } from '../hooks/index.js';
77

88
const defaultBundle = new I18nBundle('defaultBundle');
99

packages/base/src/hooks/useIsRTL.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { getRTL } from '@ui5/webcomponents-base/dist/config/RTL.js';
44
import { RefObject, useRef, useState } from 'react';
5-
import { useIsomorphicLayoutEffect } from '../hooks';
5+
import { useIsomorphicLayoutEffect } from '../hooks/index.js';
66

77
const GLOBAL_DIR_CSS_VAR = '--_ui5_dir';
88

packages/base/src/hooks/useIsomorphicId.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useRef } from 'react';
1+
import * as React from 'react';
22

33
function getRandomId() {
44
if ('randomUUID' in crypto) {
@@ -17,6 +17,6 @@ export function useIsomorphicId(): string {
1717
}
1818

1919
// eslint-disable-next-line react-hooks/rules-of-hooks
20-
const localId = useRef(getRandomId()); // React version never changes at runtime
20+
const localId = React.useRef(getRandomId()); // React version never changes at runtime
2121
return localId.current;
2222
}

packages/base/src/hooks/useResponsiveContentPadding.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useEffect, useRef, useState } from 'react';
44
import { createUseStyles } from 'react-jss';
5-
import { getCurrentRange } from '../Device';
5+
import { getCurrentRange } from '../Device/index.js';
66

77
type Range = 'Phone' | 'Tablet' | 'Desktop' | 'LargeDesktop';
88

packages/base/src/hooks/useViewportRange.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client';
22

33
import { useEffect, useState } from 'react';
4-
import { getCurrentRange, attachMediaHandler, detachMediaHandler } from '../Device';
4+
import { getCurrentRange, attachMediaHandler, detachMediaHandler } from '../Device/index.js';
55

66
export const useViewportRange = () => {
77
const [currentRange, setCurrentRange] = useState(getCurrentRange()?.name);

packages/base/src/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { getI18nContext, I18nContext } from './context/I18nContext';
2-
import * as Device from './Device';
3-
import * as hooks from './hooks';
4-
import * as spacing from './styling/spacing';
5-
import { ThemingParameters } from './styling/ThemingParameters';
1+
import { getI18nContext, I18nContext } from './context/I18nContext.js';
2+
import * as Device from './Device/index.js';
3+
import * as hooks from './hooks/index.js';
4+
import * as spacing from './styling/spacing.js';
5+
import { ThemingParameters } from './styling/ThemingParameters.js';
66

7-
export * from './styling/CssSizeVariables';
8-
export * from './utils/index';
9-
export * from './hooks';
7+
export * from './styling/CssSizeVariables.js';
8+
export * from './utils/index.js';
9+
export * from './hooks/index.js';
1010

1111
export { getI18nContext, I18nContext, ThemingParameters, Device, hooks, spacing };

packages/base/src/utils/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ export const enrichEventWithDetails = <T extends Record<string, unknown>, Return
3131
return event as unknown as ReturnType;
3232
};
3333

34-
export { debounce } from './debounce';
35-
export { throttle } from './throttle';
34+
export { debounce } from './debounce.js';
35+
export { throttle } from './throttle.js';

packages/base/tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
4+
"module": "Node16",
5+
"moduleResolution": "Node16",
46
"baseUrl": ".",
57
"outDir": "./dist",
68
"declarationDir": "./dist",

0 commit comments

Comments
 (0)