Skip to content

Commit cf68fa6

Browse files
authored
Merge pull request #432 from zbinlin/fix-esm-module
fix(esm): fixes #421
2 parents 140e62c + 476d17a commit cf68fa6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+328
-328
lines changed

package.json

Lines changed: 186 additions & 187 deletions
Large diffs are not rendered by default.

src/factory/createHandlerSetter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { type RefObject, useRef } from 'react'
2-
import { type CallbackSetter, type SomeCallback } from '../shared/types'
2+
import { type CallbackSetter, type SomeCallback } from '../shared/types.ts'
33

44
/**
55
* Returns an array where the first item is the [ref](https://reactjs.org/docs/hooks-reference.html#useref) to a

src/factory/createStorageHook.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { useCallback, useState } from 'react'
2-
import safelyParseJson from '../shared/safelyParseJson'
3-
import isClient from '../shared/isClient'
4-
import isAPISupported from '../shared/isAPISupported'
5-
import isDevelopment from '../shared/isDevelopment'
6-
import noop from '../shared/noop'
7-
import warnOnce from '../shared/warnOnce'
2+
import safelyParseJson from '../shared/safelyParseJson.ts'
3+
import isClient from '../shared/isClient.ts'
4+
import isAPISupported from '../shared/isAPISupported.ts'
5+
import isDevelopment from '../shared/isDevelopment.ts'
6+
import noop from '../shared/noop.ts'
7+
import warnOnce from '../shared/warnOnce.ts'
88

99
/**
1010
* A utility to quickly create hooks to access both Session Storage and Local Storage

src/shared/geolocationUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type BRHGeolocationPosition } from './types'
1+
import { type BRHGeolocationPosition } from './types.ts'
22

33
export const geoStandardOptions: PositionOptions = Object.freeze({
44
enableHighAccuracy: false,

src/shared/noop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type Noop } from './types'
1+
import { type Noop } from './types.ts'
22

33
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
44
const noop: Noop = (...args: any[]) => undefined

src/useAudio.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { type MutableRefObject, useCallback, useEffect, useRef } from 'react'
2-
import noop from './shared/noop'
3-
import isClient from './shared/isClient'
4-
import useObjectState from './useObjectState'
5-
import isDevelopment from './shared/isDevelopment'
6-
import isAPISupported from './shared/isAPISupported'
7-
import createHandlerSetter from './factory/createHandlerSetter'
8-
import warnOnce from './shared/warnOnce'
2+
import noop from './shared/noop.ts'
3+
import isClient from './shared/isClient.ts'
4+
import useObjectState from './useObjectState.ts'
5+
import isDevelopment from './shared/isDevelopment.ts'
6+
import isAPISupported from './shared/isAPISupported.ts'
7+
import createHandlerSetter from './factory/createHandlerSetter.ts'
8+
import warnOnce from './shared/warnOnce.ts'
99

1010
/**
1111
* The default options for the useAudio hook

src/useConditionalTimeout.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useCallback, useEffect, useRef, useState } from 'react'
2-
import isFunction from './shared/isFunction'
3-
import { type GenericFunction } from './shared/types'
4-
import usePreviousValue from './usePreviousValue'
2+
import isFunction from './shared/isFunction.ts'
3+
import { type GenericFunction } from './shared/types.ts'
4+
import usePreviousValue from './usePreviousValue.ts'
55

66
/**
77
* An async-utility hook that accepts a callback function and a delay time (in milliseconds), then delays the

src/useCookie.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { useCallback, useEffect, useState } from 'react'
2-
import noop from './shared/noop'
3-
import isClient from './shared/isClient'
4-
import isDevelopment from './shared/isDevelopment'
5-
import isAPISupported from './shared/isAPISupported'
6-
import createHandlerSetter from './factory/createHandlerSetter'
7-
import warnOnce from './shared/warnOnce'
8-
import { type CallbackSetter } from './shared/types'
2+
import noop from './shared/noop.ts'
3+
import isClient from './shared/isClient.ts'
4+
import isDevelopment from './shared/isDevelopment.ts'
5+
import isAPISupported from './shared/isAPISupported.ts'
6+
import createHandlerSetter from './factory/createHandlerSetter.ts'
7+
import warnOnce from './shared/warnOnce.ts'
8+
import { type CallbackSetter } from './shared/types.ts'
99

1010
const useCookie = (key: string, options?: UseCookieOptions) => {
1111
const hookNotSupportedResponse = Object.freeze<UseCookieReturn>({

src/useDarkMode.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { useCallback } from 'react'
2-
import useMediaQuery from './useMediaQuery'
3-
import useUpdateEffect from './useUpdateEffect'
4-
import useLocalStorage from './useLocalStorage'
5-
import noop from './shared/noop'
6-
import isClient from './shared/isClient'
7-
import isDevelopment from './shared/isDevelopment'
8-
import warnOnce from './shared/warnOnce'
2+
import useMediaQuery from './useMediaQuery.ts'
3+
import useUpdateEffect from './useUpdateEffect.ts'
4+
import useLocalStorage from './useLocalStorage.ts'
5+
import noop from './shared/noop.ts'
6+
import isClient from './shared/isClient.ts'
7+
import isDevelopment from './shared/isDevelopment.ts'
8+
import warnOnce from './shared/warnOnce.ts'
99

1010
const COLOR_SCHEME_QUERY = '(prefers-color-scheme: dark)'
1111
export const LOCAL_STORAGE_KEY = 'beautiful-react-hooks-is-dark-mode'

src/useDebouncedCallback.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { type DependencyList, useCallback, useEffect, useRef } from 'react'
22
import debounce from 'lodash.debounce'
3-
import { type GenericFunction } from './shared/types'
4-
import useWillUnmount from './useWillUnmount'
3+
import { type GenericFunction } from './shared/types.ts'
4+
import useWillUnmount from './useWillUnmount.ts'
55

66
export interface DebounceOptions {
77
leading?: boolean | undefined

0 commit comments

Comments
 (0)