Skip to content

Commit e81ed3c

Browse files
committed
Move all packages into one
1 parent 4d4298e commit e81ed3c

File tree

169 files changed

+3235
-20348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+3235
-20348
lines changed

.gitpod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
tasks:
66
- init: yarn install && yarn run build
7-
command: yarn run playground
7+
command: yarn dev
88

99

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
"private": true,
33
"workspaces": {
44
"packages": [
5-
"packages/*",
6-
"external/*"
5+
"packages/mdx",
6+
"examples/*",
7+
"site"
78
]
89
},
910
"scripts": {

packages/classer/package.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

packages/classer/readme.md

Lines changed: 0 additions & 106 deletions
This file was deleted.

packages/classer/tsconfig.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/highlighter/package.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/highlighter/readme.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/highlighter/tsconfig.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/mdx/next-env.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.

packages/mdx/package.json

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,56 @@
11
{
22
"name": "@code-hike/mdx",
33
"version": "0.3.0-next.0",
4-
"main": "dist/index.cjs.js",
5-
"typings": "dist/index.d.ts",
6-
"module": "dist/index.esm.js",
7-
"sideEffects": false,
8-
"style": "dist/index.css",
94
"files": [
105
"dist"
116
],
12-
"inputs": [
13-
"index",
14-
"components"
15-
],
16-
"scripts": {
17-
"x": "x"
7+
"main": "./dist/ch-core.umd.js",
8+
"module": "./dist/ch-core.es.js",
9+
"exports": {
10+
".": {
11+
"import": "./dist/plugin.es.js",
12+
"require": "./dist/plugin.umd.js"
13+
},
14+
"./components": "./dist/components.es.js"
1815
},
19-
"devDependencies": {
20-
"@code-hike/script": "0.0.1",
21-
"@types/react": "^17.0.2",
22-
"react": "^17.0.2"
16+
"types": "./dist/types/index.d.ts",
17+
"scripts": {
18+
"dev": "next",
19+
"build": "vite build",
20+
"test": "vitest",
21+
"coverage": "vitest run --coverage"
2322
},
2423
"dependencies": {
25-
"@code-hike/highlighter": "^0.3.0-next.0",
26-
"@code-hike/mini-browser": "^0.3.0-next.0",
27-
"@code-hike/mini-editor": "^0.3.0-next.0",
28-
"@code-hike/scroller": "^0.3.0-next.0",
29-
"@code-hike/smooth-code": "^0.3.0-next.0",
30-
"@code-hike/utils": "^0.3.0-next.0",
3124
"@codesandbox/sandpack-client": "^0.1.20",
25+
"diff": "^4.0.2",
3226
"hast-util-to-estree": "^1.4.0",
3327
"is-plain-obj": "^3.0.0",
28+
"mdx-bundler": "^8.0.1",
3429
"node-fetch": "^2.0.0",
3530
"remark-rehype": "^8.1.0",
31+
"shiki": "^0.10.1",
3632
"unified": "^9.2.2",
3733
"unist-util-visit": "^2.0.0",
38-
"unist-util-visit-parents": "^3.0.0"
34+
"unist-util-visit-parents": "^3.0.0",
35+
"use-spring": "^0.2.3"
36+
},
37+
"devDependencies": {
38+
"@mdx-js/mdx": "^2.0.0",
39+
"@types/node": "^17.0.21",
40+
"@types/node-fetch": "^2.6.1",
41+
"@types/react": "^17.0.39",
42+
"next": "^12.1.0",
43+
"react": "^17.0.2",
44+
"react-dom": "^17.0.2",
45+
"sass": "^1.49.9",
46+
"typescript": "^4.6.2",
47+
"vite": "^2.8.6",
48+
"vitest": "^0.5.9",
49+
"esbuild": "^0.13.2",
50+
"mdx-bundler": "^6.0.1",
51+
"react-json-view": "^1.21.3"
3952
},
4053
"peerDependencies": {
4154
"react": "^16.8.3 || ^17 || ^18"
42-
},
43-
"keywords": [
44-
"react"
45-
],
46-
"homepage": "https://codehike.org",
47-
"repository": "code-hike/codehike",
48-
"publishConfig": {
49-
"access": "public"
50-
},
51-
"author": "Rodrigo Pombo",
52-
"license": "MIT",
53-
"funding": {
54-
"type": "opencollective",
55-
"url": "https://opencollective.com/codehike"
5655
}
5756
}

packages/playground/pages/[demo]/[theme].js renamed to packages/mdx/pages/[demo]/[theme].js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import dynamic from "next/dynamic"
44
import { useRouter } from "next/router"
55
import Head from "next/head"
66
import Link from "next/link"
7-
import { toProps } from "../../src/page-data"
7+
import { toProps } from "../../tests/page-data"
8+
import { CH } from "../../src/components"
89

910
export async function getServerSideProps({ params }) {
1011
try {
@@ -240,7 +241,7 @@ function MDXComponent({ code }) {
240241
() => getMDXComponent(code, { react: React }),
241242
[code]
242243
)
243-
return <Component components={{ JSONView }} />
244+
return <Component components={{ JSONView, CH }} />
244245
}
245246

246247
const BrowserReactJsonView = dynamic(

packages/mdx/pages/_app.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import "../src/index.scss"
2+
import "./styles.css"
3+
4+
function MyApp({ Component, pageProps }) {
5+
return <Component {...pageProps} />
6+
}
7+
8+
export default MyApp

packages/mdx/pages/compile.tsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { compile } from "@mdx-js/mdx"
2+
import { runSync } from "@mdx-js/mdx"
3+
import * as runtime from "react/jsx-runtime.js"
4+
import { remarkCodeHike } from "../src/index"
5+
import { CH } from "../src/components"
6+
import fs from "node:fs"
7+
8+
export async function getServerSideProps() {
9+
const source = fs.readFileSync(
10+
"./tests/scrollycoding.mdx",
11+
"utf8"
12+
)
13+
const code = String(
14+
await compile(source, {
15+
outputFormat: "function-body",
16+
remarkPlugins: [
17+
[remarkCodeHike, { autoImport: false }],
18+
],
19+
})
20+
)
21+
return {
22+
props: {
23+
title: "Home",
24+
code,
25+
},
26+
}
27+
}
28+
29+
export default function Page({ title, code }) {
30+
const { default: Content } = runSync(code, runtime)
31+
return (
32+
<div style={{ maxWidth: 800, margin: "0 auto" }}>
33+
<h1>{title}</h1>
34+
<Content components={{ CH }} />
35+
</div>
36+
)
37+
}

0 commit comments

Comments
 (0)