Skip to content

Commit ad193ee

Browse files
committed
Use paths with extensions
1 parent 04957b2 commit ad193ee

30 files changed

+97
-89
lines changed

eslint.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ const config = tsEslint.config([
128128
'jsx-a11y/anchor-is-valid': 'off',
129129
},
130130
},
131+
{
132+
files: ['node_package/src/**/*'],
133+
rules: {
134+
'import/extensions': ['error', 'ignorePackages'],
135+
},
136+
},
131137
{
132138
files: ['lib/generators/react_on_rails/templates/**/*'],
133139
rules: {

node_package/src/Authenticity.ts

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

33
export default {
44
authenticityToken(): string | null {

node_package/src/CallbackRegistry.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { ItemRegistrationCallback } from './types';
2-
import { onPageLoaded, onPageUnloaded } from './pageLifecycle';
3-
import { getContextAndRailsContext } from './context';
1+
import { ItemRegistrationCallback } from './types/index.ts';
2+
import { onPageLoaded, onPageUnloaded } from './pageLifecycle.ts';
3+
import { getContextAndRailsContext } from './context.ts';
44

55
/**
66
* Represents information about a registered item including its value,

node_package/src/ClientSideRenderer.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
import * as ReactDOM from 'react-dom';
55
import type { ReactElement } from 'react';
6-
import type { RailsContext, RegisteredComponent, RenderFunction, Root } from './types';
7-
8-
import { getContextAndRailsContext, resetContextAndRailsContext, type Context } from './context';
9-
import createReactOutput from './createReactOutput';
10-
import { isServerRenderHash } from './isServerRenderResult';
11-
import reactHydrateOrRender from './reactHydrateOrRender';
12-
import { supportsRootApi } from './reactApis';
13-
import { debugTurbolinks } from './turbolinksUtils';
6+
import type { RailsContext, RegisteredComponent, RenderFunction, Root } from './types/index.ts';
7+
8+
import { getContextAndRailsContext, resetContextAndRailsContext, type Context } from './context.ts';
9+
import createReactOutput from './createReactOutput.ts';
10+
import { isServerRenderHash } from './isServerRenderResult.ts';
11+
import reactHydrateOrRender from './reactHydrateOrRender.ts';
12+
import { supportsRootApi } from './reactApis.ts';
13+
import { debugTurbolinks } from './turbolinksUtils.ts';
1414

1515
const REACT_ON_RAILS_STORE_ATTRIBUTE = 'data-js-react-on-rails-store';
1616

node_package/src/ComponentRegistry.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { type RegisteredComponent, type ReactComponentOrRenderFunction } from './types';
2-
import isRenderFunction from './isRenderFunction';
3-
import CallbackRegistry from './CallbackRegistry';
1+
import { type RegisteredComponent, type ReactComponentOrRenderFunction } from './types/index.ts';
2+
import isRenderFunction from './isRenderFunction.ts';
3+
import CallbackRegistry from './CallbackRegistry.ts';
44

55
const componentRegistry = new CallbackRegistry<RegisteredComponent>('component');
66

node_package/src/RSCClientRoot.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import * as React from 'react';
44
import * as ReactDOMClient from 'react-dom/client';
55
import { createFromReadableStream } from 'react-on-rails-rsc/client';
6-
import { fetch } from './utils';
7-
import transformRSCStreamAndReplayConsoleLogs from './transformRSCStreamAndReplayConsoleLogs';
8-
import { RailsContext, RenderFunction } from './types';
6+
import { fetch } from './utils.ts';
7+
import transformRSCStreamAndReplayConsoleLogs from './transformRSCStreamAndReplayConsoleLogs.ts';
8+
import { RailsContext, RenderFunction } from './types/index.ts';
99

1010
const { use } = React;
1111

node_package/src/ReactOnRails.client.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { ReactElement } from 'react';
2-
import * as ClientStartup from './clientStartup';
3-
import { renderOrHydrateComponent, hydrateStore } from './ClientSideRenderer';
4-
import ComponentRegistry from './ComponentRegistry';
5-
import StoreRegistry from './StoreRegistry';
6-
import buildConsoleReplay from './buildConsoleReplay';
7-
import createReactOutput from './createReactOutput';
8-
import Authenticity from './Authenticity';
9-
import context from './context';
2+
import * as ClientStartup from './clientStartup.ts';
3+
import { renderOrHydrateComponent, hydrateStore } from './ClientSideRenderer.ts';
4+
import ComponentRegistry from './ComponentRegistry.ts';
5+
import StoreRegistry from './StoreRegistry.ts';
6+
import buildConsoleReplay from './buildConsoleReplay.ts';
7+
import createReactOutput from './createReactOutput.ts';
8+
import Authenticity from './Authenticity.ts';
9+
import context from './context.ts';
1010
import type {
1111
RegisteredComponent,
1212
RenderResult,
@@ -16,8 +16,8 @@ import type {
1616
Store,
1717
StoreGenerator,
1818
ReactOnRailsOptions,
19-
} from './types';
20-
import reactHydrateOrRender from './reactHydrateOrRender';
19+
} from './types/index.ts';
20+
import reactHydrateOrRender from './reactHydrateOrRender.ts';
2121

2222
const ctx = context();
2323

@@ -203,5 +203,5 @@ ctx.ReactOnRails.resetOptions();
203203

204204
ClientStartup.clientStartup(ctx);
205205

206-
export * from './types';
206+
export * from './types/index.ts';
207207
export default ctx.ReactOnRails;

node_package/src/ReactOnRails.full.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import handleError from './handleError';
2-
import serverRenderReactComponent from './serverRenderReactComponent';
3-
import type { RenderParams, RenderResult, ErrorOptions } from './types';
1+
import handleError from './handleError.ts';
2+
import serverRenderReactComponent from './serverRenderReactComponent.ts';
3+
import type { RenderParams, RenderResult, ErrorOptions } from './types/index.ts';
44

5-
import Client from './ReactOnRails.client';
5+
import Client from './ReactOnRails.client.ts';
66

77
if (typeof window !== 'undefined') {
88
console.log(
@@ -15,5 +15,5 @@ Client.handleError = (options: ErrorOptions): string | undefined => handleError(
1515
Client.serverRenderReactComponent = (options: RenderParams): null | string | Promise<RenderResult> =>
1616
serverRenderReactComponent(options);
1717

18-
export * from './types';
18+
export * from './types/index.ts';
1919
export default Client;

node_package/src/ReactOnRails.node.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import ReactOnRails from './ReactOnRails.full';
2-
import streamServerRenderedReactComponent from './streamServerRenderedReactComponent';
1+
import ReactOnRails from './ReactOnRails.full.ts';
2+
import streamServerRenderedReactComponent from './streamServerRenderedReactComponent.ts';
33

44
ReactOnRails.streamServerRenderedReactComponent = streamServerRenderedReactComponent;
55

6-
export * from './ReactOnRails.full';
6+
export * from './ReactOnRails.full.ts';
77
// eslint-disable-next-line no-restricted-exports -- see https://github.com/eslint/eslint/issues/15617
8-
export { default } from './ReactOnRails.full';
8+
export { default } from './ReactOnRails.full.ts';

node_package/src/ReactOnRailsRSC.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import { renderToPipeableStream } from 'react-on-rails-rsc/server.node';
22
import { PassThrough, Readable } from 'stream';
33
import type { ReactElement } from 'react';
44

5-
import { RSCRenderParams, StreamRenderState } from './types';
6-
import ReactOnRails from './ReactOnRails.full';
7-
import buildConsoleReplay from './buildConsoleReplay';
8-
import handleError from './handleError';
9-
import { convertToError, createResultObject } from './serverRenderUtils';
5+
import { RSCRenderParams, StreamRenderState } from './types/index.ts';
6+
import ReactOnRails from './ReactOnRails.full.ts';
7+
import buildConsoleReplay from './buildConsoleReplay.ts';
8+
import handleError from './handleError.ts';
9+
import { convertToError, createResultObject } from './serverRenderUtils.ts';
1010

1111
import {
1212
streamServerRenderedComponent,
1313
transformRenderStreamChunksToResultObject,
14-
} from './streamServerRenderedReactComponent';
15-
import loadReactClientManifest from './loadReactClientManifest';
14+
} from './streamServerRenderedReactComponent.ts';
15+
import loadReactClientManifest from './loadReactClientManifest.ts';
1616

1717
const stringToStream = (str: string) => {
1818
const stream = new PassThrough();
@@ -65,5 +65,5 @@ ReactOnRails.serverRenderRSCReactComponent = (options: RSCRenderParams) => {
6565
}
6666
};
6767

68-
export * from './types';
68+
export * from './types/index.ts';
6969
export default ReactOnRails;

0 commit comments

Comments
 (0)