8000 Upgrade doc website to next 15 by jdeniau · Pull Request #2092 · immutable-js/immutable-js · GitHub
[go: up one dir, main page]

Skip to content

Upgrade doc website to next 15 #2092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,119 changes: 911 additions & 208 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"build:prepare": "./resources/prepare-dist.sh",
"build:stats": "node ./resources/dist-stats.mjs",
"website:build": "cd website && next build && next-sitemap",
"website:dev": "cd website && next dev",
"website:dev": "cd website && next dev --turbopack",
"check-build-output": "node ./resources/check-build-output.mjs",
"check-git-clean": "./resources/check-git-clean.sh",
"benchmark": "node ./resources/benchmark.js",
Expand All @@ -99,7 +99,7 @@
"@size-limit/preset-small-lib": "^11.2.0",
"@types/prismjs": "^1.26.3",
"@types/random-seed": "0.3.5",
"@types/react": "17.0.11",
"@types/react": "19.1.0",
"benchmark": "2.1.4",
"codemirror": "^6.0.1",
"colors": "1.4.0",
Expand All @@ -119,14 +119,14 @@
"marked": "^11.2.0",
"marked-highlight": "^2.1.0",
"microtime": "3.1.1",
"next": "^14.1.0",
"next": "15.2.4",
"next-sitemap": "4.2.3",
"npm-run-all": "4.1.5",
"prettier": "^3.5.0",
"prismjs": "^1.29.0",
"random-seed": "0.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "19.1.0",
"react-dom": "19.1.0",
"rimraf": "2.7.1",
"rollup": "4.34.8",
"size-limit": "^11.2.0",
Expand Down
2 changes: 1 addition & 1 deletion website/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
2 changes: 2 additions & 0 deletions website/src/ArrowDown.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { JSX } from 'react';

export function ArrowDown({ isActive }: { isActive: boolean }): JSX.Element {
return (
<svg
Expand Down
11 changes: 6 additions & 5 deletions website/src/Defs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReactFragment, ReactNode } from 'react';
import type { FocusEvent, JSX, MouseEvent, ReactNode } from 'react';
import { Fragment, useCallback, useState } from 'react';
import Link from 'next/link';
import {
Expand Down Expand Up @@ -250,7 +250,7 @@ function Hover({
}) {
const [isOver, setIsOver] = useState(false);
const mouseOver = useCallback(
(event) => {
(event: MouseEvent | FocusEvent) => {
event.stopPropagation();
setIsOver(true);
},
Expand Down Expand Up @@ -413,15 +413,16 @@ function typeLength(type: Type): number {
throw new Error('Type with unknown kind ' + JSON.stringify(type));
}

function interpose<T>(
function interpose<T extends JSX.Element>(
between: ReactNode,
array: Array<T>
): Array<T | ReactFragment> {
const result = [];
): Array<JSX.Element> {
const result: Array<JSX.Element> = [];
let i = 0;
for (const value of array) {
result.push(value, <Fragment key={`b:${i++}`}>{between}</Fragment>);
}
result.pop();

return result;
}
14 changes: 5 additions & 9 deletions website/src/app/docs/[version]/[type]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ type Params = {
};

type Props = {
params: Params;
params: Promise<Params>;
};

export async function generateMetadata({ params }: Props) {
export async function generateMetadata(props: Props) {
const params = await props.params;
const version = getVersionFromParams(params);
const defs = getTypeDefs(version);
const def = Object.values(defs.types).find((d) => d.label === params.type);
Expand All @@ -38,13 +39,8 @@ export async function generateMetadata({ params }: Props) {
};
}

export default function TypeDocPage({
// versions,
// version,
// def,
// sidebarLinks,
params,
}: Props) {
export default async function TypeDocPage(props: Props) {
const params = await props.params;
const version = getVersionFromParams(params);
const defs = getTypeDefs(version);

Expand Down
11 changes: 6 additions & 5 deletions website/src/app/docs/[version]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { ImmutableConsole } from '../../../ImmutableConsole';
import { getVersions } from '../../../static/getVersions';
import { getVersionFromParams } from '../../getVersionFromParams';

export default function VersionLayout({
children,
params,
}: {
export default async function VersionLayout(props: {
children: React.ReactNode;
params: { version: string };
params: Promise<{ version: string }>;
}) {
const params = await props.params;

const { children } = props;

const versions = getVersions();

const version = getVersionFromParams(params);
Expand Down
8 changes: 5 additions & 3 deletions website/src/app/docs/[version]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ type Params = {
};

type Props = {
params: Params;
params: Promise<Params>;
};

export async function generateMetadata({ params }: Props): Promise<Metadata> {
export async function generateMetadata(props: Props): Promise<Metadata> {
const params = await props.params;
const version = getVersionFromParams(params);

return {
title: `Documentation ${version} — Immutable.js`,
};
}

export default function OverviewDocPage({ params }: Props) {
export default async function OverviewDocPage(props: Props) {
const params = await props.params;
const version = getVersionFromParams(params);
const defs = getTypeDefs(version);
const overviewData = getOverviewData(defs);
Expand Down
13 changes: 13 additions & 0 deletions website/src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Link from 'next/link';

export default function NotFound() {
return (
<>
<div className="pageBody">
<h2>Not Found</h2>
<p>Could not find requested resource</p>
<Link href="/">Return Home</Link>
</div>
</>
);
}
6 changes: 2 additions & 4 deletions website/src/app/play/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getTypeDefs } from '../../static/getTypeDefs';
import { DocSearch } from '../../DocSearch';
import { SideBar } from '../../Sidebar';
import { getSidebarLinks } from '../../getSidebarLinks';
import dynamic from 'next/dynamic';
import Repl from '../../repl/Repl';

export async function generateStaticParams() {
return [...getVersions().map((version) => ({ version }))];
Expand All @@ -16,8 +16,6 @@ export async function generateMetadata(): Promise<Metadata> {
};
}

const ReplNoSSR = dynamic(() => import('../../repl/Repl'), { ssr: false });

export default function OverviewDocPage() {
const versions = getVersions();
const version = versions[0];
Expand Down Expand Up @@ -49,7 +47,7 @@ List([

*/}

<ReplNoSSR
<Repl
defaultValue={`const upperFirst = (str) => typeof str === 'string'
? str.charAt(0).toUpperCase() + str.slice(1)
: str;
Expand Down
2 changes: 1 addition & 1 deletion website/src/repl/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef } from 'react';
import { useEffect, useRef, type JSX } from 'react';
import { basicSetup } from 'codemirror';
import { EditorView, keymap } from '@codemirror/view';
import { defaultKeymap, indentWithTab } from '@codemirror/commands';
Expand Down
2 changes: 1 addition & 1 deletion website/src/repl/FormatterOutput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { toHTML } from 'jsonml-html';
import { useEffect, useRef } from 'react';
import { useEffect, useRef, type JSX } from 'react';

/**
* immutable-devtools is a console custom formatter.
Expand Down
7 changes: 5 additions & 2 deletions website/src/repl/Repl.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';
import React, { useEffect, useRef, useState } from 'react';
import dynamic from 'next/dynamic';
import React, { useEffect, useRef, useState, type JSX } from 'react';
import { Editor } from './Editor';
import FormatterOutput from './FormatterOutput';
import './repl.css';
Expand Down Expand Up @@ -154,4 +155,6 @@ function Repl({ defaultValue }: Props): JSX.Element {
);
}

export default Repl;
export default dynamic(() => Promise.resolve(Repl), {
ssr: false,
});
2 changes: 1 addition & 1 deletion website/styles/globals.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import url('//code.cdn.mozilla.net/fonts/fira.css');
@import url('https://code.cdn.mozilla.net/fonts/fira.css');

:root {
color-scheme: light dark;
Expand Down
0