Skip to content

Commit e9629b6

Browse files
📯
1 parent 34956d3 commit e9629b6

17 files changed

+96
-176
lines changed

examples/full/next.config.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
// eslint-disable-next-line @typescript-eslint/no-var-requires
2-
const withBundleAnalyzer = require('@next/bundle-analyzer')({
3-
enabled: process.env.ANALYZE === 'true'
4-
})
5-
6-
module.exports = withBundleAnalyzer({
1+
export default {
72
staticPageGenerationTimeout: 300,
83
images: {
94
domains: [
@@ -15,4 +10,4 @@ module.exports = withBundleAnalyzer({
1510
],
1611
formats: ['image/avif', 'image/webp']
1712
}
18-
})
13+
}

examples/full/package.json

-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
"dev": "next dev",
88
"build": "next build",
99
"start": "next start",
10-
"analyze": "cross-env ANALYZE=true next build",
11-
"analyze:server": "cross-env BUNDLE_ANALYZE=server next build",
12-
"analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build",
1310
"deploy": "vercel deploy",
1411
"test": "run-s test:*",
1512
"test:lint": "eslint ."
@@ -32,7 +29,6 @@
3229
"react-tweet-embed": "^2.0.0"
3330
},
3431
"devDependencies": {
35-
"@next/bundle-analyzer": "^15.0.2",
3632
"cross-env": "^7.0.3"
3733
}
3834
}

examples/full/turbo.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": ["//"],
3+
"tasks": {
4+
"build": {
5+
"outputs": [".next/**", "!.next/cache/**"]
6+
}
7+
}
8+
}

examples/minimal/next.config.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
// eslint-disable-next-line @typescript-eslint/no-var-requires
2-
const withBundleAnalyzer = require('@next/bundle-analyzer')({
3-
enabled: process.env.ANALYZE === 'true'
4-
})
5-
6-
module.exports = withBundleAnalyzer({
1+
export default {
72
staticPageGenerationTimeout: 300,
83
images: {
94
domains: [
@@ -14,4 +9,4 @@ module.exports = withBundleAnalyzer({
149
],
1510
formats: ['image/avif', 'image/webp']
1611
}
17-
})
12+
}

examples/minimal/turbo.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": ["//"],
3+
"tasks": {
4+
"build": {
5+
"outputs": [".next/**", "!.next/cache/**"]
6+
}
7+
}
8+
}

packages/notion-types/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"repository": "NotionX/react-notion-x",
77
"author": "Travis Fischer <[email protected]>",
88
"license": "MIT",
9+
"main": "./build/index.js",
10+
"module": "./build/index.js",
911
"types": "./build/index.d.ts",
1012
"sideEffects": false,
1113
"files": [

packages/react-notion-x/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
"dependencies": {
2828
"@fisch0920/medium-zoom": "^1.0.7",
2929
"@matejmazur/react-katex": "^3.1.3",
30-
"katex": "^0.15.6",
30+
"katex": "^0.16.11",
3131
"notion-types": "workspace:*",
3232
"notion-utils": "workspace:*",
3333
"prismjs": "^1.27.0",
3434
"react-fast-compare": "^3.2.0",
35-
"react-hotkeys-hook": "^3.4.7",
35+
"react-hotkeys-hook": "^4.5.1",
3636
"react-image": "^4.0.3",
3737
"react-lazy-images": "^1.1.0",
3838
"react-modal": "^3.14.3",
@@ -45,7 +45,7 @@
4545
"@types/react": "^18.3.12",
4646
"@types/react-modal": "^3.16.3",
4747
"clipboard-copy": "^4.0.1",
48-
"date-fns": "^2.28.0",
48+
"date-fns": "^2.30.0",
4949
"format-number": "^3.0.0",
5050
"lodash.throttle": "^4.1.1"
5151
},

packages/react-notion-x/src/components/asset-wrapper.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const AssetWrapper: React.FC<{
6262
target={
6363
captionHostname &&
6464
captionHostname !== rootDomain &&
65-
!caption.startsWith('/')
65+
!caption?.startsWith('/')
6666
? 'blank_'
6767
: null
6868
}

packages/react-notion-x/src/components/asset.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const Asset: React.FC<{
135135
const src = source
136136
if (!src) return null
137137

138-
const id = src.split('?')[0]?.split('/').pop()
138+
const id = src.split('?')?.[0]?.split('/').pop()
139139
if (!id) return null
140140

141141
content = (

packages/react-notion-x/src/components/eoi.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export const EOI: React.FC<{
1818
return null
1919
}
2020

21-
const title = attributes.find((attr) => attr.id === 'title')?.values[0]
22-
let owner = attributes.find((attr) => attr.id === 'owner')?.values[0]
23-
const lastUpdatedAt = attributes.find((attr) => attr.id === 'updated_at')
21+
const title = attributes.find((attr: any) => attr.id === 'title')?.values[0]
22+
let owner = attributes.find((attr: any) => attr.id === 'owner')?.values[0]
23+
const lastUpdatedAt = attributes.find((attr: any) => attr.id === 'updated_at')
2424
?.values[0]
2525
const lastUpdated = lastUpdatedAt ? formatNotionDateTime(lastUpdatedAt) : null
2626
let externalImage: React.ReactNode

packages/react-notion-x/src/components/google-drive.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const GoogleDrive: React.FC<{
3131
>
3232
<div className='notion-google-drive-preview'>
3333
<GracefulImage
34-
src={mapImageUrl(properties.thumbnail, block)}
34+
src={mapImageUrl(properties.thumbnail, block)!}
3535
alt={properties.title || 'Google Drive Document'}
3636
loading='lazy'
3737
/>

packages/react-notion-x/src/components/lazy-image.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export const LazyImage: React.FC<{
8282
}
8383

8484
return (
85+
// @ts-expect-error LazyImage types are out-of-date.
8586
<LazyImageFull src={src!} {...rest} experimentalDecode={true}>
8687
{({ imageState, ref }) => {
8788
const isLoaded = imageState === ImageState.LoadSuccess

packages/react-notion-x/src/components/mention-preview-card.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import type React from 'react'
22

3-
function capitalizeFirstLetter(str) {
3+
function capitalizeFirstLetter(str?: string) {
4+
if (!str) return ''
5+
46
return str.charAt(0).toUpperCase() + str.slice(1)
57
}
68

79
export const MentionPreviewCard: React.FC<{
810
owner?: string
9-
lastUpdated?: string
11+
lastUpdated?: string | null
1012
title: string
1113
domain: string
1214
externalImage?: React.ReactNode

packages/react-notion-x/src/map-image-url.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { type Block } from 'notion-types'
22

33
export const defaultMapImageUrl = (
4-
url: string,
4+
url: string | undefined,
55
block: Block
66
): string | undefined => {
77
if (!url) {

packages/react-notion-x/src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export type MapPageUrlFn = (
66
recordMap?: types.ExtendedRecordMap | undefined
77
) => string
88
export type MapImageUrlFn = (
9-
url: string,
9+
url: string | undefined,
1010
block: types.Block
1111
) => string | undefined
1212
export type SearchNotionFn = (

0 commit comments

Comments
 (0)