Skip to content

Commit

Permalink
Change the module type in TypeScript to NodeNext
Browse files Browse the repository at this point in the history
  • Loading branch information
filipsobol committed Sep 24, 2024
1 parent 5379715 commit 0484e4a
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@vitest/coverage-istanbul": "^2.0.0",
"@vitest/ui": "^2.0.0",
"ckeditor5": "^42.0.0",
"ckeditor5-premium-features": "^42.0.0",
"coveralls": "^3.1.1",
"eslint": "^7.19.0",
"eslint-config-ckeditor5": "^7.1.0",
Expand Down
8 changes: 4 additions & 4 deletions src/ckeditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ import type {
EditorCreatorFunction
} from 'ckeditor5';

import type { EditorSemaphoreMountResult } from './lifecycle/LifeCycleEditorSemaphore';
import type { EditorSemaphoreMountResult } from './lifecycle/LifeCycleEditorSemaphore.js';

import { uid } from '@ckeditor/ckeditor5-integrations-common';
import { LifeCycleElementSemaphore } from './lifecycle/LifeCycleElementSemaphore';
import { LifeCycleElementSemaphore } from './lifecycle/LifeCycleElementSemaphore.js';

import {
withCKEditorReactContextMetadata,
type CKEditorConfigContextMetadata
} from './context/setCKEditorReactContextMetadata';
} from './context/setCKEditorReactContextMetadata.js';

import {
ContextWatchdogContext,
isContextWatchdogInitializing,
isContextWatchdogReadyToUse
} from './context/ckeditorcontext';
} from './context/ckeditorcontext.js';

const REACT_INTEGRATION_READ_ONLY_LOCK_ID = 'Lock from React integration (@ckeditor/ckeditor5-react)';

Expand Down
6 changes: 3 additions & 3 deletions src/context/ckeditorcontext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import React, {
} from 'react';

import { uid } from '@ckeditor/ckeditor5-integrations-common';
import { useIsMountedRef } from '../hooks/useIsMountedRef';
import { useIsMountedRef } from '../hooks/useIsMountedRef.js';
import {
useInitializedCKEditorsMap,
type InitializedContextEditorsConfig
} from './useInitializedCKEditorsMap';
} from './useInitializedCKEditorsMap.js';

import type {
ContextWatchdog,
Expand Down Expand Up @@ -109,7 +109,7 @@ const CKEditorContext = <TContext extends Context = Context>( props: Props<TCont
// The prevWatchdogInitializationID variable is used to keep track of the previous initialization ID.
// It is used to ensure that the state update is performed only if the current initialization ID matches the previous one.
// This helps to avoid race conditions and ensures that the correct context watchdog is associated with the component.
const watchdogInitializationID = regenerateInitializationID();
const watchdogInitializationID = regenerateInitializationID()!;
const contextWatchdog = new ContextWatchdogConstructor( context!, watchdogConfig );

// Handle error event from context watchdog.
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
* For licensing, see LICENSE.md.
*/

export { default as CKEditor } from './ckeditor';
export { default as CKEditorContext } from './context/ckeditorcontext';
export { default as useMultiRootEditor, type MultiRootHookProps, type MultiRootHookReturns } from './useMultiRootEditor';
export { default as CKEditor } from './ckeditor.js';
export { default as CKEditorContext } from './context/ckeditorcontext.js';
export { default as useMultiRootEditor, type MultiRootHookProps, type MultiRootHookReturns } from './useMultiRootEditor.js';

export { default as useCKEditorCloud } from './cloud/useCKEditorCloud';
export { default as useCKEditorCloud } from './cloud/useCKEditorCloud.js';
export {
default as withCKEditorCloud,
type WithCKEditorCloudHocProps
} from './cloud/withCKEditorCloud';
} from './cloud/withCKEditorCloud.js';

export {
loadCKEditorCloud,
Expand Down
2 changes: 1 addition & 1 deletion src/lifecycle/LifeCycleEditorSemaphore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import type { Editor, EditorWatchdog } from 'ckeditor5';

import type { EditorWatchdogAdapter } from '../ckeditor';
import type { EditorWatchdogAdapter } from '../ckeditor.js';
import type { LifeCycleElementSemaphore } from './LifeCycleElementSemaphore.js';

export type EditorSemaphoreMountResult<TEditor extends Editor> = {
Expand Down
2 changes: 1 addition & 1 deletion src/lifecycle/useLifeCycleSemaphoreSyncRef.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { useRef, useState, type RefObject } from 'react';
import type { LifeCycleElementSemaphore, LifeCycleAfterMountCallback } from './LifeCycleElementSemaphore';
import type { LifeCycleElementSemaphore, LifeCycleAfterMountCallback } from './LifeCycleElementSemaphore.js';

/**
* When using the `useState` approach, a new instance of the semaphore must be set based on the previous
Expand Down
16 changes: 8 additions & 8 deletions src/useMultiRootEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ import type {
EventInfo
} from 'ckeditor5';

import { ContextWatchdogContext, isContextWatchdogReadyToUse } from './context/ckeditorcontext';
import { EditorWatchdogAdapter } from './ckeditor';
import { ContextWatchdogContext, isContextWatchdogReadyToUse } from './context/ckeditorcontext.js';
import { EditorWatchdogAdapter } from './ckeditor.js';

import type { EditorSemaphoreMountResult } from './lifecycle/LifeCycleEditorSemaphore';
import type { EditorSemaphoreMountResult } from './lifecycle/LifeCycleEditorSemaphore.js';

import { useLifeCycleSemaphoreSyncRef, type LifeCycleSemaphoreSyncRefResult } from './lifecycle/useLifeCycleSemaphoreSyncRef';
import { mergeRefs } from './utils/mergeRefs';
import { LifeCycleElementSemaphore } from './lifecycle/LifeCycleElementSemaphore';
import { useRefSafeCallback } from './hooks/useRefSafeCallback';
import { useInstantEditorEffect } from './hooks/useInstantEditorEffect';
import { useLifeCycleSemaphoreSyncRef, type LifeCycleSemaphoreSyncRefResult } from './lifecycle/useLifeCycleSemaphoreSyncRef.js';
import { mergeRefs } from './utils/mergeRefs.js';
import { LifeCycleElementSemaphore } from './lifecycle/LifeCycleElementSemaphore.js';
import { useRefSafeCallback } from './hooks/useRefSafeCallback.js';
import { useInstantEditorEffect } from './hooks/useInstantEditorEffect.js';

const REACT_INTEGRATION_READ_ONLY_LOCK_ID = 'Lock from React integration (@ckeditor/ckeditor5-react)';

Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"target": "ES2019",
"useDefineForClassFields": true,
"module": "ESNext",
"module": "NodeNext",
"lib": [
"ES2019", // Must match the "target"
"ES2020.String",
Expand All @@ -15,8 +15,7 @@
"skipLibCheck": true,
"jsx": "react",

/* Bundler mode */
"moduleResolution": "bundler",
"moduleResolution": "NodeNext",
"isolatedModules": true,
"moduleDetection": "force",

Expand Down

0 comments on commit 0484e4a

Please sign in to comment.