Skip to content

Commit

Permalink
start complete refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
5rahim committed Jan 4, 2024
1 parent 43c068a commit cebd9e1
Show file tree
Hide file tree
Showing 781 changed files with 30,978 additions and 78,357 deletions.
20 changes: 0 additions & 20 deletions .changeset/config.json

This file was deleted.

170 changes: 170 additions & 0 deletions .contentlayer/.cache/v0.3.4/compiled-contentlayer-config-MBLAKN5Z.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
// contentlayer.config.js
import path from "path";
import {
defineDocumentType,
defineNestedType,
makeSource
} from "contentlayer/source-files";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypePrettyCode from "rehype-pretty-code";
import rehypeSlug from "rehype-slug";
import {codeImport} from "remark-code-import";
import remarkGfm from "remark-gfm";
import {getHighlighter, loadTheme} from "shiki";
import {visit} from "unist-util-visit";

var computedFields = {
slug: {
type: "string",
resolve: (doc) => `/${doc._raw.flattenedPath}`
},
slugAsParams: {
type: "string",
resolve: (doc) => doc._raw.flattenedPath.split("/").slice(1).join("/")
}
};
var LinksProperties = defineNestedType(() => ({
name: "LinksProperties",
fields: {
doc: {
type: "string"
},
api: {
type: "string"
}
}
}));
var Doc = defineDocumentType(() => ({
name: "Doc",
filePathPattern: `docs/**/*.mdx`,
contentType: "mdx",
fields: {
title: {
type: "string",
required: true
},
description: {
type: "string",
required: true
},
published: {
type: "boolean",
default: true
},
links: {
type: "nested",
of: LinksProperties
},
featured: {
type: "boolean",
default: false,
required: false
},
component: {
type: "boolean",
default: false,
required: false
},
toc: {
type: "boolean",
default: true,
required: false
}
},
computedFields
}));
var contentlayer_config_default = makeSource({
contentDirPath: "./mdx",
documentTypes: [Doc],
mdx: {
remarkPlugins: [remarkGfm, codeImport],
rehypePlugins: [
rehypeSlug,
// rehypeComponent,
() => (tree) => {
visit(tree, (node) => {
if (node?.type === "element" && node?.tagName === "pre") {
const [codeEl] = node.children;
if (codeEl.tagName !== "code") {
return;
}
if (codeEl.data?.meta) {
const regex = /event="([^"]*)"/;
const match = codeEl.data?.meta.match(regex);
if (match) {
node.__event__ = match ? match[1] : null;
codeEl.data.meta = codeEl.data.meta.replace(regex, "");
}
}
node.__rawString__ = codeEl.children?.[0].value;
node.__src__ = node.properties?.__src__;
node.__style__ = node.properties?.__style__;
}
});
},
[
rehypePrettyCode,
{
// getHighlighter: async () => {
// const theme = await loadTheme(
// path.join(process.cwd(), "/lib/themes/light.json")
// )
// return await getHighlighter({ theme })
// },
// onVisitLine(node) {
// // Prevent lines from collapsing in `display: grid` mode, and allow empty
// // lines to be copy/pasted
// if (node.children.length === 0) {
// node.children = [{ type: "text", value: " " }]
// }
// },
// onVisitHighlightedLine(node) {
// node.properties.className.push("line--highlighted")
// },
// onVisitHighlightedWord(node) {
// node.properties.className = ["word--highlighted"]
// },
}
],
() => (tree) => {
visit(tree, (node) => {
if (node?.type === "element" && node?.tagName === "div") {
if (!("data-rehype-pretty-code-fragment" in node.properties)) {
return;
}
const preElement = node.children.at(-1);
if (preElement.tagName !== "pre") {
return;
}
preElement.properties["__withMeta__"] = node.children.at(0).tagName === "div";
preElement.properties["__rawString__"] = node.__rawString__;
if (node.__src__) {
preElement.properties["__src__"] = node.__src__;
}
if (node.__event__) {
preElement.properties["__event__"] = node.__event__;
}
if (node.__style__) {
preElement.properties["__style__"] = node.__style__;
}
}
});
},
// rehypeNpmCommand,
[
rehypeAutolinkHeadings,
{
properties: {
className: ["subheading-anchor"],
ariaLabel: "Link to section"
}
}
]
]
}
});
export {
Doc,
contentlayer_config_default as default
};
//# sourceMappingURL=compiled-contentlayer-config-MBLAKN5Z.mjs.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../../contentlayer.config.js"],
"sourcesContent": ["import path from \"path\"\nimport {\n defineDocumentType,\n defineNestedType,\n makeSource,\n} from \"contentlayer/source-files\"\nimport rehypeAutolinkHeadings from \"rehype-autolink-headings\"\nimport rehypePrettyCode from \"rehype-pretty-code\"\nimport rehypeSlug from \"rehype-slug\"\nimport { codeImport } from \"remark-code-import\"\nimport remarkGfm from \"remark-gfm\"\nimport { getHighlighter, loadTheme } from \"shiki\"\nimport { visit } from \"unist-util-visit\"\n\n/** @type {import('contentlayer/source-files').ComputedFields} */\nconst computedFields = {\n slug: {\n type: \"string\",\n resolve: (doc) => `/${doc._raw.flattenedPath}`,\n },\n slugAsParams: {\n type: \"string\",\n resolve: (doc) => doc._raw.flattenedPath.split(\"/\").slice(1).join(\"/\"),\n },\n}\n\nconst LinksProperties = defineNestedType(() => ({\n name: \"LinksProperties\",\n fields: {\n doc: {\n type: \"string\",\n },\n api: {\n type: \"string\",\n },\n },\n}))\n\nexport const Doc = defineDocumentType(() => ({\n name: \"Doc\",\n filePathPattern: `docs/**/*.mdx`,\n contentType: \"mdx\",\n fields: {\n title: {\n type: \"string\",\n required: true,\n },\n description: {\n type: \"string\",\n required: true,\n },\n published: {\n type: \"boolean\",\n default: true,\n },\n links: {\n type: \"nested\",\n of: LinksProperties,\n },\n featured: {\n type: \"boolean\",\n default: false,\n required: false,\n },\n component: {\n type: \"boolean\",\n default: false,\n required: false,\n },\n toc: {\n type: \"boolean\",\n default: true,\n required: false,\n },\n },\n computedFields,\n}))\n\nexport default makeSource({\n contentDirPath: \"./mdx\",\n documentTypes: [Doc],\n mdx: {\n remarkPlugins: [remarkGfm, codeImport],\n rehypePlugins: [\n rehypeSlug,\n // rehypeComponent,\n () => (tree) => {\n visit(tree, (node) => {\n if (node?.type === \"element\" && node?.tagName === \"pre\") {\n const [codeEl] = node.children\n if (codeEl.tagName !== \"code\") {\n return\n }\n\n if (codeEl.data?.meta) {\n // Extract event from meta and pass it down the tree.\n const regex = /event=\"([^\"]*)\"/\n const match = codeEl.data?.meta.match(regex)\n if (match) {\n node.__event__ = match ? match[1] : null\n codeEl.data.meta = codeEl.data.meta.replace(regex, \"\")\n }\n }\n\n node.__rawString__ = codeEl.children?.[0].value\n node.__src__ = node.properties?.__src__\n node.__style__ = node.properties?.__style__\n }\n })\n },\n [\n rehypePrettyCode,\n {\n // getHighlighter: async () => {\n // const theme = await loadTheme(\n // path.join(process.cwd(), \"/lib/themes/light.json\")\n // )\n // return await getHighlighter({ theme })\n // },\n // onVisitLine(node) {\n // // Prevent lines from collapsing in `display: grid` mode, and allow empty\n // // lines to be copy/pasted\n // if (node.children.length === 0) {\n // node.children = [{ type: \"text\", value: \" \" }]\n // }\n // },\n // onVisitHighlightedLine(node) {\n // node.properties.className.push(\"line--highlighted\")\n // },\n // onVisitHighlightedWord(node) {\n // node.properties.className = [\"word--highlighted\"]\n // },\n },\n ],\n () => (tree) => {\n visit(tree, (node) => {\n if (node?.type === \"element\" && node?.tagName === \"div\") {\n if (!(\"data-rehype-pretty-code-fragment\" in node.properties)) {\n return\n }\n\n const preElement = node.children.at(-1)\n if (preElement.tagName !== \"pre\") {\n return\n }\n\n preElement.properties[\"__withMeta__\"] =\n node.children.at(0).tagName === \"div\"\n preElement.properties[\"__rawString__\"] = node.__rawString__\n\n if (node.__src__) {\n preElement.properties[\"__src__\"] = node.__src__\n }\n\n if (node.__event__) {\n preElement.properties[\"__event__\"] = node.__event__\n }\n\n if (node.__style__) {\n preElement.properties[\"__style__\"] = node.__style__\n }\n }\n })\n },\n // rehypeNpmCommand,\n [\n rehypeAutolinkHeadings,\n {\n properties: {\n className: [\"subheading-anchor\"],\n ariaLabel: \"Link to section\",\n },\n },\n ],\n ],\n },\n})\n"],
"mappings": ";AAAA,OAAO,UAAU;AACjB;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,OAAO,4BAA4B;AACnC,OAAO,sBAAsB;AAC7B,OAAO,gBAAgB;AACvB,SAAS,kBAAkB;AAC3B,OAAO,eAAe;AACtB,SAAS,gBAAgB,iBAAiB;AAC1C,SAAS,aAAa;AAGtB,IAAM,iBAAiB;AAAA,EACnB,MAAM;AAAA,IACF,MAAM;AAAA,IACN,SAAS,CAAC,QAAQ,IAAI,IAAI,KAAK;AAAA,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W,IAAI,KAAK;AAAA,YAC9C;AAAA,UACJ;AAAA,QACJ,CAAC;AAAA,MACL;AAAA;AAAA,MAEA;AAAA,QACI;AAAA,QACA;AAAA,UACI,YAAY;AAAA,YACR,WAAW,CAAC,mBAAmB;AAAA,YAC/B,WAAW;AAAA,UACf;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ,CAAC;",
"names": []
}
32 changes: 32 additions & 0 deletions .contentlayer/.cache/v0.3.4/data-7UL6VRG7.json

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions .contentlayer/.cache/v0.3.4/data-E6K27SY5.json

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions .contentlayer/.cache/v0.3.4/data-JRXYXBZH.json

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions .contentlayer/.cache/v0.3.4/data-M7BYDJE4.json

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions .contentlayer/.cache/v0.3.4/data-MBLAKN5Z.json

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions .contentlayer/generated/Doc/_index.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .contentlayer/generated/Doc/_index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// NOTE This file is auto-generated by Contentlayer

import docs__aboutMdx from './docs__about.mdx.json' assert {type: 'json'}

export const allDocs = [docs__aboutMdx]
23 changes: 23 additions & 0 deletions .contentlayer/generated/Doc/docs__about.mdx.json

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions .contentlayer/generated/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// NOTE This file is auto-generated by Contentlayer

import { Doc, DocumentTypes, DataExports } from "./types"
import { SourceProvideSchemaErrorJSON, SourceFetchDataErrorJSON } from "contentlayer/core"

export * from "./types"

export declare const allDocs: Doc[]

export declare const allDocuments: DocumentTypes[]


13 changes: 13 additions & 0 deletions .contentlayer/generated/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// NOTE This file is auto-generated by Contentlayer

export {isType} from 'contentlayer/client'

// NOTE During development Contentlayer imports from `.mjs` files to improve HMR speeds.
// During (production) builds Contentlayer it imports from `.json` files to improve build performance.
import {allDocs} from './Doc/_index.mjs'

export {allDocs}

export const allDocuments = [...allDocs]


80 changes: 80 additions & 0 deletions .contentlayer/generated/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// NOTE This file is auto-generated by Contentlayer

import type { Markdown, MDX, ImageFieldData, IsoDateTimeString } from "contentlayer/core"
import * as Local from "contentlayer/source-files"

export { isType } from "contentlayer/client"

export type { Markdown, MDX, ImageFieldData, IsoDateTimeString }

/** Document types */
export type Doc = {
/** File path relative to `contentDirPath` */
_id: string
_raw: Local.RawDocumentData
type: "Doc"
title: string
description: string
published: boolean
links?: LinksProperties | undefined
featured: boolean
component: boolean
toc: boolean
/** MDX file body */
body: MDX
slug: string
slugAsParams: string
}

/** Nested types */
export type LinksProperties = {
/** File path relative to `contentDirPath` */
_id: string
_raw: Local.RawDocumentData
type: "LinksProperties"
doc?: string | undefined
api?: string | undefined

}

/** Helper types */

export type AllTypes = DocumentTypes | NestedTypes
export type AllTypeNames = DocumentTypeNames | NestedTypeNames

export type DocumentTypes = Doc
export type DocumentTypeNames = "Doc"

export type NestedTypes = LinksProperties
export type NestedTypeNames = "LinksProperties"

export type DataExports = {
allDocuments: DocumentTypes[]
allDocs: Doc[]
}


export interface ContentlayerGenTypes {
documentTypes: DocumentTypes
documentTypeMap: DocumentTypeMap
documentTypeNames: DocumentTypeNames
nestedTypes: NestedTypes
nestedTypeMap: NestedTypeMap
nestedTypeNames: NestedTypeNames
allTypeNames: AllTypeNames
dataExports: DataExports
}

declare global {
interface ContentlayerGen extends ContentlayerGenTypes {
}
}

export type DocumentTypeMap = {
Doc: Doc
}

export type NestedTypeMap = {
LinksProperties: LinksProperties
}

17 changes: 17 additions & 0 deletions .contentlayer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "dot-contentlayer",
"description": "This package is auto-generated by Contentlayer",
"version": "0.0.0-MBLAKN5Z",
"exports": {
"./generated": {
"import": "./generated/index.mjs"
}
},
"typesVersions": {
"*": {
"generated": [
"./generated"
]
}
}
}
34 changes: 0 additions & 34 deletions .github/workflows/release.yml

This file was deleted.

Loading

0 comments on commit cebd9e1

Please sign in to comment.