diff --git a/packages/mdx/package.json b/packages/mdx/package.json index 3672f544..67374266 100644 --- a/packages/mdx/package.json +++ b/packages/mdx/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "esbuild": "^0.21.4", - "mdx-bundler": "^10.0.2", + "mdx-bundler": "^10.0.3", "unified": "^11.0.5" }, "peerDependencies": { diff --git a/packages/mdx/src/react/client.tsx b/packages/mdx/src/react/client.tsx index 0a56d40b..24371002 100644 --- a/packages/mdx/src/react/client.tsx +++ b/packages/mdx/src/react/client.tsx @@ -1,4 +1,4 @@ -import { MDXContentProps, getMDXComponent } from "mdx-bundler/client"; +import { MDXContentProps, getMDXComponent } from "mdx-bundler/client/index.js"; import { useMemo } from "react"; export function useMDXComponent( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d47540bb..d08696e8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -183,8 +183,8 @@ importers: specifier: ^0.21.4 version: 0.21.4 mdx-bundler: - specifier: ^10.0.2 - version: 10.0.2(esbuild@0.21.4) + specifier: ^10.0.3 + version: 10.0.3(esbuild@0.21.4) unified: specifier: ^11.0.5 version: 11.0.5 @@ -460,6 +460,46 @@ importers: specifier: ^5 version: 5.4.5 + samples/next-pages: + dependencies: + '@content-collections/core': + specifier: ^0.6.4 + version: link:../../packages/core + '@content-collections/mdx': + specifier: ^0.1.3 + version: link:../../packages/mdx + '@content-collections/next': + specifier: ^0.2.0 + version: link:../../packages/next + '@content-collections/sample-theme': + specifier: ^0.1.0 + version: link:../../utils/samplte-theme + next: + specifier: 14.2.7 + version: 14.2.7(@playwright/test@1.46.1)(react-dom@18.3.1)(react@18.3.1) + react: + specifier: ^18 + version: 18.3.1 + react-dom: + specifier: ^18 + version: 18.3.1(react@18.3.1) + devDependencies: + '@playwright/test': + specifier: ^1.46.1 + version: 1.46.1 + '@types/node': + specifier: ^20 + version: 20.14.9 + '@types/react': + specifier: ^18 + version: 18.3.3 + '@types/react-dom': + specifier: ^18 + version: 18.3.0 + typescript: + specifier: ^5 + version: 5.5.4 + samples/qwik: devDependencies: '@builder.io/qwik': @@ -785,6 +825,8 @@ importers: specifier: ^5.3.2 version: 5.3.3(@types/node@20.14.9) + utils/samplte-theme: {} + website: dependencies: '@fumadocs/content-collections': @@ -1237,25 +1279,20 @@ packages: engines: {node: '>=6.9.0'} dependencies: regenerator-runtime: 0.14.1 + dev: true /@babel/runtime@7.24.7: resolution: {integrity: sha512-UwgBRMjJP+xv857DCngvqXI3Iq6J4v0wXmwc6sapg+zyhbwmQX67LUEFrkK5tbyJ30jGuG3ZvWpBiB9LCy1kWw==} engines: {node: '>=6.9.0'} dependencies: regenerator-runtime: 0.14.1 - - /@babel/runtime@7.25.4: - resolution: {integrity: sha512-DSgLeL/FNcpXuzav5wfYvHCGvynXkJbn3Zvc3823AEe9nPwW9IK4UoCSS5yGymmQzN0pCPvivtgS6/8U2kkm1w==} - engines: {node: '>=6.9.0'} - dependencies: - regenerator-runtime: 0.14.1 + dev: true /@babel/runtime@7.25.6: resolution: {integrity: sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==} engines: {node: '>=6.9.0'} dependencies: regenerator-runtime: 0.14.1 - dev: true /@babel/template@7.24.0: resolution: {integrity: sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==} @@ -1835,8 +1872,8 @@ packages: peerDependencies: esbuild: '*' dependencies: - '@types/resolve': 1.20.6 - debug: 4.3.4 + '@types/resolve': 1.20.2 + debug: 4.3.6 esbuild: 0.21.4 escape-string-regexp: 4.0.0 resolve: 1.22.8 @@ -3175,7 +3212,7 @@ packages: /@manypkg/find-root@1.1.0: resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@types/node': 12.20.55 find-up: 4.1.0 fs-extra: 8.1.0 @@ -3794,7 +3831,7 @@ packages: /@radix-ui/primitive@1.0.1: resolution: {integrity: sha512-yQ8oGX2GVsEYMWGxcovu1uGWPCxV5BFfeeYxqPmuAzUyLT9qmaMXSAhXpb0WrspIeqYzdJpkh2vHModJPgRIaw==} dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 dev: false /@radix-ui/primitive@1.1.0: @@ -3908,7 +3945,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@types/react': 18.3.3 react: 18.3.1 dev: false @@ -3935,7 +3972,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@types/react': 18.3.3 react: 18.3.1 dev: false @@ -3966,7 +4003,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@radix-ui/primitive': 1.0.1 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.3.3)(react@18.3.1) '@radix-ui/react-context': 1.0.1(@types/react@18.3.3)(react@18.3.1) @@ -4046,7 +4083,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@radix-ui/primitive': 1.0.1 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.3.3)(react@18.3.1) '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1) @@ -4091,7 +4128,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@types/react': 18.3.3 react: 18.3.1 dev: false @@ -4122,7 +4159,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.3.3)(react@18.3.1) '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1) '@radix-ui/react-use-callback-ref': 1.0.1(@types/react@18.3.3)(react@18.3.1) @@ -4163,7 +4200,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@radix-ui/react-use-layout-effect': 1.0.1(@types/react@18.3.3)(react@18.3.1) '@types/react': 18.3.3 react: 18.3.1 @@ -4259,7 +4296,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1) '@types/react': 18.3.3 '@types/react-dom': 18.3.0 @@ -4301,7 +4338,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.3.3)(react@18.3.1) '@radix-ui/react-use-layout-effect': 1.0.1(@types/react@18.3.3)(react@18.3.1) '@types/react': 18.3.3 @@ -4344,7 +4381,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@radix-ui/react-slot': 1.0.2(@types/react@18.3.3)(react@18.3.1) '@types/react': 18.3.3 '@types/react-dom': 18.3.0 @@ -4506,7 +4543,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.3.3)(react@18.3.1) '@types/react': 18.3.3 react: 18.3.1 @@ -4562,7 +4599,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@types/react': 18.3.3 react: 18.3.1 dev: false @@ -4589,7 +4626,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@radix-ui/react-use-callback-ref': 1.0.1(@types/react@18.3.3)(react@18.3.1) '@types/react': 18.3.3 react: 18.3.1 @@ -4618,7 +4655,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@radix-ui/react-use-callback-ref': 1.0.1(@types/react@18.3.3)(react@18.3.1) '@types/react': 18.3.3 react: 18.3.1 @@ -4647,7 +4684,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@types/react': 18.3.3 react: 18.3.1 dev: false @@ -5741,7 +5778,7 @@ packages: resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==} dependencies: '@swc/counter': 0.1.3 - tslib: 2.6.3 + tslib: 2.7.0 /@tailwindcss/typography@0.5.14(tailwindcss@3.4.4): resolution: {integrity: sha512-ZvOCjUbsJBjL9CxQBn+VEnFpouzuKhxh2dH8xMIWHILL+HfOYtlAkWcyoon8LlzE53d2Yo6YO6pahKKNW3q1YQ==} @@ -5753,6 +5790,19 @@ packages: lodash.merge: 4.6.2 postcss-selector-parser: 6.0.10 tailwindcss: 3.4.4 + dev: true + + /@tailwindcss/typography@0.5.15(tailwindcss@3.4.4): + resolution: {integrity: sha512-AqhlCXl+8grUz8uqExv5OTtgpjuVIwFTSXTrh8y9/pw6q2ek7fJ+Y8ZEVw7EB2DCcuCOtEjf9w3+J3rzts01uA==} + peerDependencies: + tailwindcss: '>=3.0.0 || insiders || >=4.0.0-alpha.20' + dependencies: + lodash.castarray: 4.4.0 + lodash.isplainobject: 4.0.6 + lodash.merge: 4.6.2 + postcss-selector-parser: 6.0.10 + tailwindcss: 3.4.4 + dev: false /@testing-library/dom@10.4.0: resolution: {integrity: sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==} @@ -5850,7 +5900,7 @@ packages: /@types/conventional-commits-parser@5.0.0: resolution: {integrity: sha512-loB369iXNmAZglwWATL+WRe+CRMmmBPtpolYzIebFaX4YA3x+BEfLqhUAV9WanycKI3TG1IMr5bMJDajDKLlUQ==} dependencies: - '@types/node': 22.5.2 + '@types/node': 20.14.9 dev: true /@types/cookie@0.6.0: @@ -5890,7 +5940,7 @@ packages: /@types/http-proxy@1.17.14: resolution: {integrity: sha512-SSrD0c1OQzlFX7pGu1eXxSEjemej64aaNPRhhVYUGqXh0BtldAAx37MG8btcumvpgKyZp1F5Gn3JkktdxiFv6w==} dependencies: - '@types/node': 22.5.2 + '@types/node': 20.14.9 dev: false /@types/json-schema@7.0.15: @@ -5954,11 +6004,6 @@ packages: dependencies: undici-types: 5.26.5 - /@types/node@22.5.2: - resolution: {integrity: sha512-acJsPTEqYqulZS/Yp/S3GgeE6GZ0qYODUR8aVr/DkhHQ8l9nd4j5x1/ZJy9/gHrRlFMqkO6i0I3E27Alu4jjPg==} - dependencies: - undici-types: 6.19.8 - /@types/normalize-package-data@2.4.4: resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} dev: true @@ -5993,10 +6038,6 @@ packages: resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} dev: false - /@types/resolve@1.20.6: - resolution: {integrity: sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ==} - dev: false - /@types/semver@7.5.8: resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} dev: true @@ -7743,7 +7784,7 @@ packages: resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==} engines: {node: '>=0.11'} dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.6 dev: true /dax-sh@0.39.2: @@ -7967,7 +8008,7 @@ packages: resolution: {integrity: sha512-PSy0zQwMg5O+LjT5Mz7vnKC8I7DfWLPF6M7oepqW7WP5mn2CY3hz46xZOa1GJY+KVfyXhdmz6+tdgXwrHlZc5g==} engines: {node: ^16.14.0 || >=18.12.0} dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.6 fastest-levenshtein: 1.0.16 lodash.deburr: 4.1.0 dev: false @@ -8886,7 +8927,7 @@ packages: resolution: {integrity: sha512-EzV94NYKoO09GLXGjXj9JIlXijVck4ONSr5wiCWDvhsvj5jxSrzTmRU/9C1DyB6uToszLs8aifA6NQ7lEQdvFw==} engines: {node: '>= 0.8'} dependencies: - '@types/node': 22.5.2 + '@types/node': 20.14.9 require-like: 0.1.2 dev: true @@ -9367,7 +9408,7 @@ packages: '@radix-ui/react-popover': 1.1.1(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1) '@radix-ui/react-scroll-area': 1.1.0(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1) '@radix-ui/react-tabs': 1.1.0(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1) - '@tailwindcss/typography': 0.5.14(tailwindcss@3.4.4) + '@tailwindcss/typography': 0.5.15(tailwindcss@3.4.4) class-variance-authority: 0.7.0 cmdk: 1.0.0(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1) fumadocs-core: 13.3.2(@types/react@18.3.3)(next@14.2.7)(react-dom@18.3.1)(react@18.3.1) @@ -10595,10 +10636,6 @@ packages: resolution: {integrity: sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==} dev: true - /jiti@1.21.0: - resolution: {integrity: sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==} - hasBin: true - /jiti@1.21.6: resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==} hasBin: true @@ -11379,13 +11416,13 @@ packages: resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} dev: true - /mdx-bundler@10.0.2(esbuild@0.21.4): - resolution: {integrity: sha512-0wF0zoCv+Ms4G+eSlk/jaKYoJHc0oXBaOma3kYlFJiKq9H8h41Dd66ioDBGF4noy80Pf7KTBQlyHfEpTqVml7A==} + /mdx-bundler@10.0.3(esbuild@0.21.4): + resolution: {integrity: sha512-vRtVZ5t+nUP0QtoRVgjDFO10YDjRgKe/19ie0IR8FqE8SugNn5RP4sCWBPzKoEwoGbqfQOrgHy+PHCVyfaCDQQ==} engines: {node: '>=18', npm: '>=6'} peerDependencies: esbuild: 0.* dependencies: - '@babel/runtime': 7.24.5 + '@babel/runtime': 7.25.6 '@esbuild-plugins/node-resolve': 0.2.2(esbuild@0.21.4) '@fal-works/esbuild-plugin-global-externals': 2.1.2 '@mdx-js/esbuild': 3.0.1(esbuild@0.21.4) @@ -11402,7 +11439,7 @@ packages: /media-query-parser@2.0.2: resolution: {integrity: sha512-1N4qp+jE0pL5Xv4uEcwVUhIkwdUO3S/9gML90nqKA7v7FcOS5vUtatfzok9S9U1EJU8dHWlcv95WLnKmmxZI9w==} dependencies: - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 dev: true /media-typer@0.3.0: @@ -12960,6 +12997,7 @@ packages: /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} + dev: true /picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} @@ -13038,41 +13076,25 @@ packages: postcss: 8.4.41 dev: true - /postcss-import@15.1.0(postcss@8.4.39): + /postcss-import@15.1.0(postcss@8.4.41): resolution: {integrity: sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==} engines: {node: '>=14.0.0'} peerDependencies: postcss: ^8.0.0 dependencies: - postcss: 8.4.39 + postcss: 8.4.41 postcss-value-parser: 4.2.0 read-cache: 1.0.0 resolve: 1.22.8 - /postcss-js@4.0.1(postcss@8.4.39): + /postcss-js@4.0.1(postcss@8.4.41): resolution: {integrity: sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==} engines: {node: ^12 || ^14 || >= 16} peerDependencies: postcss: ^8.4.21 dependencies: camelcase-css: 2.0.1 - postcss: 8.4.39 - - /postcss-load-config@4.0.2(postcss@8.4.39): - resolution: {integrity: sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==} - engines: {node: '>= 14'} - peerDependencies: - postcss: '>=8.0.9' - ts-node: '>=9.0.0' - peerDependenciesMeta: - postcss: - optional: true - ts-node: - optional: true - dependencies: - lilconfig: 3.1.1 - postcss: 8.4.39 - yaml: 2.4.5 + postcss: 8.4.41 /postcss-load-config@4.0.2(postcss@8.4.41): resolution: {integrity: sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==} @@ -13089,7 +13111,6 @@ packages: lilconfig: 3.1.1 postcss: 8.4.41 yaml: 2.4.5 - dev: true /postcss-modules-extract-imports@3.1.0(postcss@8.4.41): resolution: {integrity: sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==} @@ -13148,13 +13169,13 @@ packages: string-hash: 1.1.3 dev: true - /postcss-nested@6.0.1(postcss@8.4.39): + /postcss-nested@6.0.1(postcss@8.4.41): resolution: {integrity: sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==} engines: {node: '>=12.0'} peerDependencies: postcss: ^8.2.14 dependencies: - postcss: 8.4.39 + postcss: 8.4.41 postcss-selector-parser: 6.0.16 /postcss-selector-parser@6.0.10: @@ -13189,6 +13210,7 @@ packages: nanoid: 3.3.7 picocolors: 1.0.1 source-map-js: 1.2.0 + dev: true /postcss@8.4.41: resolution: {integrity: sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==} @@ -14902,17 +14924,17 @@ packages: fast-glob: 3.3.2 glob-parent: 6.0.2 is-glob: 4.0.3 - jiti: 1.21.0 + jiti: 1.21.6 lilconfig: 2.1.0 micromatch: 4.0.8 normalize-path: 3.0.0 object-hash: 3.0.0 picocolors: 1.0.1 - postcss: 8.4.39 - postcss-import: 15.1.0(postcss@8.4.39) - postcss-js: 4.0.1(postcss@8.4.39) - postcss-load-config: 4.0.2(postcss@8.4.39) - postcss-nested: 6.0.1(postcss@8.4.39) + postcss: 8.4.41 + postcss-import: 15.1.0(postcss@8.4.41) + postcss-js: 4.0.1(postcss@8.4.41) + postcss-load-config: 4.0.2(postcss@8.4.41) + postcss-nested: 6.0.1(postcss@8.4.41) postcss-selector-parser: 6.0.16 resolve: 1.22.8 sucrase: 3.35.0 @@ -15211,7 +15233,7 @@ packages: execa: 5.1.1 globby: 11.1.0 joycon: 3.1.1 - postcss-load-config: 4.0.2(postcss@8.4.39) + postcss-load-config: 4.0.2(postcss@8.4.41) resolve-from: 5.0.0 rollup: 4.17.2 source-map: 0.8.0-beta.0 @@ -15462,9 +15484,6 @@ packages: resolution: {integrity: sha512-3OeMF5Lyowe8VW0skf5qaIE7Or3yS9LS7fvMUI0gg4YxpIBVg0L8BxCmROw2CcYhSkpR68Epz7CGc8MPj94Uww==} dev: false - /undici-types@6.19.8: - resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} - /undici@5.28.4: resolution: {integrity: sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==} engines: {node: '>=14.0'} @@ -15751,7 +15770,7 @@ packages: dependencies: browserslist: 4.23.0 escalade: 3.2.0 - picocolors: 1.0.0 + picocolors: 1.0.1 /uqr@0.1.2: resolution: {integrity: sha512-MJu7ypHq6QasgF5YRTjqscSzQp/W11zoUk6kvmlH+fmWEs63Y0Eib13hYFwAzagRJcVY8WVnlV+eBDUGMJ5IbA==} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 6c8fd766..87b3f65b 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,4 +1,5 @@ packages: - "packages/*" +- "utils/*" - "samples/*" - "website" diff --git a/samples/next-pages/.gitignore b/samples/next-pages/.gitignore new file mode 100644 index 00000000..2d9a0986 --- /dev/null +++ b/samples/next-pages/.gitignore @@ -0,0 +1,39 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js +.yarn/install-state.gz + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts + +# content collections +.content-collections diff --git a/samples/next-pages/README.md b/samples/next-pages/README.md new file mode 100644 index 00000000..0bfddf02 --- /dev/null +++ b/samples/next-pages/README.md @@ -0,0 +1,16 @@ +--- +title: Next.js Pages +description: Using content-collections with Next.js Pages Router +tags: + - next.js + - react + - mdx +adapter: next +--- + +Use the `@content-collections/next` package to integrate Content Collections into your Next.js project. + +For more information, refer to the following resources: + +- [Next.js Quick Start](https://www.content-collections.dev/docs/quickstart/next) +- [Next.js adapter documentation](https://www.content-collections.dev/docs/adapter/next/) diff --git a/samples/next-pages/content-collections.ts b/samples/next-pages/content-collections.ts new file mode 100644 index 00000000..543d231f --- /dev/null +++ b/samples/next-pages/content-collections.ts @@ -0,0 +1,25 @@ +import { defineCollection, defineConfig } from "@content-collections/core"; +import { compileMDX } from "@content-collections/mdx"; + +const posts = defineCollection({ + name: "posts", + directory: "src/content/posts", + include: "*.mdx", + schema: (z) => ({ + title: z.string(), + summary: z.string(), + date: z.string(), + author: z.string(), + }), + transform: async (post, ctx) => { + const code = await compileMDX(ctx, post) + return { + ...post, + code + } + } +}); + +export default defineConfig({ + collections: [posts], +}); \ No newline at end of file diff --git a/samples/next-pages/next.config.mjs b/samples/next-pages/next.config.mjs new file mode 100644 index 00000000..e94b9f06 --- /dev/null +++ b/samples/next-pages/next.config.mjs @@ -0,0 +1,7 @@ +import { withContentCollections } from "@content-collections/next"; + +/** @type {import('next').NextConfig} */ +const nextConfig = {}; + +export default withContentCollections(nextConfig); + diff --git a/samples/next-pages/package.json b/samples/next-pages/package.json new file mode 100644 index 00000000..13f36391 --- /dev/null +++ b/samples/next-pages/package.json @@ -0,0 +1,26 @@ +{ + "name": "samples-next-pages", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "next dev", + "lint": "next lint", + "test": "playwright test" + }, + "dependencies": { + "@content-collections/core": "^0.6.4", + "@content-collections/mdx": "^0.1.3", + "@content-collections/next": "^0.2.0", + "@content-collections/sample-theme": "^0.1.0", + "next": "14.2.7", + "react": "^18", + "react-dom": "^18" + }, + "devDependencies": { + "@playwright/test": "^1.46.1", + "@types/node": "^20", + "@types/react": "^18", + "@types/react-dom": "^18", + "typescript": "^5" + } +} diff --git a/samples/next-pages/playwright.config.ts b/samples/next-pages/playwright.config.ts new file mode 100644 index 00000000..7ebefde9 --- /dev/null +++ b/samples/next-pages/playwright.config.ts @@ -0,0 +1,47 @@ +import { defineConfig, devices } from '@playwright/test'; + +/** + * Read environment variables from file. + * https://github.com/motdotla/dotenv + */ +// require('dotenv').config(); + +/** + * See https://playwright.dev/docs/test-configuration. + */ +export default defineConfig({ + testDir: './tests', + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? 1 : undefined, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: 'html', + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + /* Base URL to use in actions like `await page.goto('/')`. */ + baseURL: 'http://localhost:3002', + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + }, + + /** one browser is enough to test if out collections work */ + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + ], + + /* Run your local dev server before starting the tests */ + webServer: { + command: 'pnpm run dev --port=3002', + url: 'http://localhost:3002', + reuseExistingServer: !process.env.CI, + }, +}); diff --git a/samples/next-pages/src/components/Metadata.tsx b/samples/next-pages/src/components/Metadata.tsx new file mode 100644 index 00000000..3198aba6 --- /dev/null +++ b/samples/next-pages/src/components/Metadata.tsx @@ -0,0 +1,29 @@ +import Head from "next/head"; + +type Props = { + title?: string; + description?: string; +}; + +const defaultTitle = "ContentCrafter Inc."; +const titleSuffix = " | " + defaultTitle; + +const defaultDescription = + "From Worldly Wonders to Polished Perfection - Crafting Content That Captivates and Converts"; + +export default function Metadata({ title, description }: Props) { + return ( +
++ From Worldly Wonders to Polished Perfection – Crafting Content That + Captivates and Converts. +
+ +{post.summary}
+ + ))} +