From 07e028044141a9f87228f2ee2702e9103c1b5809 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Thu, 31 Oct 2024 17:57:31 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/minimal/tsconfig.json | 9 +++--- packages/notion-client/package.json | 1 + packages/notion-compat/package.json | 1 + packages/notion-types/package.json | 1 + packages/notion-utils/package.json | 1 + packages/react-notion-x/package.json | 29 +++++++++++++++++++ .../react-notion-x/src/components/text.tsx | 1 + packages/react-notion-x/src/context.tsx | 2 -- packages/react-notion-x/src/renderer.tsx | 1 - packages/react-notion-x/tsup.config.ts | 29 +++++-------------- tsconfig.json | 4 +-- 11 files changed, 48 insertions(+), 31 deletions(-) diff --git a/examples/minimal/tsconfig.json b/examples/minimal/tsconfig.json index fb3ad9446..4ffc84cff 100644 --- a/examples/minimal/tsconfig.json +++ b/examples/minimal/tsconfig.json @@ -1,16 +1,15 @@ { "compilerOptions": { - "target": "es2016", - "lib": ["dom", "esnext"], - "allowJs": false, + "target": "ES2017", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, "skipLibCheck": true, "strict": false, "forceConsistentCasingInFileNames": true, - "experimentalDecorators": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", - "moduleResolution": "node", + "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", diff --git a/packages/notion-client/package.json b/packages/notion-client/package.json index 7d0b9b426..b35290670 100644 --- a/packages/notion-client/package.json +++ b/packages/notion-client/package.json @@ -19,6 +19,7 @@ "scripts": { "build": "tsup", "watch": "tsup --watch --silent --onSuccess 'echo build successful'", + "clean": "del build", "test": "run-s test:*", "test:lint": "eslint .", "test:typecheck": "tsc --noEmit", diff --git a/packages/notion-compat/package.json b/packages/notion-compat/package.json index 5e5e54dbf..cb77f5f2a 100644 --- a/packages/notion-compat/package.json +++ b/packages/notion-compat/package.json @@ -19,6 +19,7 @@ "scripts": { "build": "tsup", "watch": "tsup --watch --silent --onSuccess 'echo build successful'", + "clean": "del build", "test": "run-s test:*", "test:lint": "eslint .", "test:typecheck": "tsc --noEmit", diff --git a/packages/notion-types/package.json b/packages/notion-types/package.json index 796108d34..9d08862c9 100644 --- a/packages/notion-types/package.json +++ b/packages/notion-types/package.json @@ -19,6 +19,7 @@ "scripts": { "build": "tsup", "watch": "tsup --watch --silent --onSuccess 'echo build successful'", + "clean": "del build", "test": "run-s test:*", "test:lint": "eslint .", "test:typecheck": "tsc --noEmit" diff --git a/packages/notion-utils/package.json b/packages/notion-utils/package.json index a94fc5d9a..389cad91d 100644 --- a/packages/notion-utils/package.json +++ b/packages/notion-utils/package.json @@ -25,6 +25,7 @@ "scripts": { "build": "tsup", "watch": "tsup --watch --silent --onSuccess 'echo build successful'", + "clean": "del build", "test": "run-s test:*", "test:lint": "eslint .", "test:typecheck": "tsc --noEmit", diff --git a/packages/react-notion-x/package.json b/packages/react-notion-x/package.json index 68a8689ef..44b39629d 100644 --- a/packages/react-notion-x/package.json +++ b/packages/react-notion-x/package.json @@ -10,6 +10,34 @@ "module": "./build/index.js", "types": "./build/index.d.ts", "sideEffects": false, + "exports": { + ".": { + "types": "./build/index.d.ts", + "import": "./build/index.js" + }, + "./build/third-party/code": { + "types": "./build//third-party/code.d.ts", + "import": "./build//third-party/code.js" + }, + "./build/third-party/collection": { + "types": "./build//third-party/collection.d.ts", + "import": "./build//third-party/collection.js" + }, + "./build/third-party/equation": { + "types": "./build//third-party/equation.d.ts", + "import": "./build//third-party/equation.js" + }, + "./build/third-party/modal": { + "types": "./build//third-party/modal.d.ts", + "import": "./build//third-party/modal.js" + }, + "./build/third-party/pdf": { + "types": "./build//third-party/pdf.d.ts", + "import": "./build//third-party/pdf.js" + }, + "./styles.css": "./src/styles.css", + "./src/styles.css": "./src/styles.css" + }, "files": [ "build", "src/styles.css" @@ -20,6 +48,7 @@ "scripts": { "build": "tsup", "watch": "tsup --watch --silent --onSuccess 'echo build successful'", + "clean": "del build", "test": "run-s test:*", "test:lint": "eslint .", "test:typecheck": "tsc --noEmit" diff --git a/packages/react-notion-x/src/components/text.tsx b/packages/react-notion-x/src/components/text.tsx index b039cea56..f097c43ea 100644 --- a/packages/react-notion-x/src/components/text.tsx +++ b/packages/react-notion-x/src/components/text.tsx @@ -249,6 +249,7 @@ export function Text({ const externalObjectInstance = recordMap.block[blockId] ?.value as ExternalObjectInstance + console.log('eoi', blockId, externalObjectInstance) return } diff --git a/packages/react-notion-x/src/context.tsx b/packages/react-notion-x/src/context.tsx index a96404269..82edcdfb8 100644 --- a/packages/react-notion-x/src/context.tsx +++ b/packages/react-notion-x/src/context.tsx @@ -143,8 +143,6 @@ const defaultComponents: NotionComponents = { Embed: DefaultEmbed } -console.log('DefaultHeader', { DefaultHeader, Header, defaultComponents }) - const defaultNotionContext: NotionContext = { recordMap: { block: {}, diff --git a/packages/react-notion-x/src/renderer.tsx b/packages/react-notion-x/src/renderer.tsx index 6af39bc5f..474370814 100644 --- a/packages/react-notion-x/src/renderer.tsx +++ b/packages/react-notion-x/src/renderer.tsx @@ -149,7 +149,6 @@ export function NotionBlockRenderer({ return null } - console.log('NotionBlockRenderer', { id, block }) return ( diff --git a/packages/react-notion-x/tsup.config.ts b/packages/react-notion-x/tsup.config.ts index 3dee925bd..0298a442c 100644 --- a/packages/react-notion-x/tsup.config.ts +++ b/packages/react-notion-x/tsup.config.ts @@ -1,6 +1,6 @@ -import { defineConfig, type Options } from 'tsup' +import { defineConfig } from 'tsup' -const baseConfig: Options = { +export default defineConfig({ entry: [ 'src/index.tsx', 'src/third-party/code.tsx', @@ -14,22 +14,9 @@ const baseConfig: Options = { platform: 'browser', format: ['esm'], splitting: false, - shims: false -} - -export default defineConfig([ - { - ...baseConfig, - outDir: 'build/dev', - minify: false, - sourcemap: true, - dts: true - }, - { - ...baseConfig, - outDir: 'build', - minify: false, - sourcemap: false, - dts: true - } -]) + shims: false, + dts: true, + minify: false, + sourcemap: true, + external: ['react', 'react-dom'] +}) diff --git a/tsconfig.json b/tsconfig.json index 06924b7c6..15da9c956 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "moduleDetection": "force", "noEmit": true, "target": "es2020", - "outDir": "dist", + "outDir": "build", "allowImportingTsExtensions": false, "allowJs": true, @@ -14,7 +14,7 @@ "forceConsistentCasingInFileNames": true, "incremental": false, "isolatedModules": true, - "jsx": "preserve", + "jsx": "react-jsx", "noUncheckedIndexedAccess": true, "resolveJsonModule": true, "skipLibCheck": true,