From 8c118b17eed74403b43de53faf951b6254e82a47 Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Thu, 29 Aug 2024 14:52:25 +0200 Subject: [PATCH 01/12] Transform recma when using jsx dev runtime --- .../src/mdx/3.transform-hike-props.ts | 16 +- packages/codehike/tests/md-suite/basic.0.mdx | 4 + .../md-suite/basic.5.before-recma-js-dev.json | 540 +++++++ .../md-suite/basic.6.after-recma-js-dev.json | 422 +++++ .../tests/md-suite/basic.7.compiled-js-dev.js | 65 + .../tests/md-suite/basic.9.rendered-dev.html | 1 + .../tests/md-suite/static-children.0.mdx | 32 + ...tic-children.5.before-recma-compiled-js.js | 75 + ...static-children.5.before-recma-js-dev.json | 1381 +++++++++++++++++ .../static-children.5.before-recma-js.json | 812 ++++++++++ .../static-children.6.after-recma-js-dev.json | 1166 ++++++++++++++ .../static-children.6.after-recma-js.json | 662 ++++++++ .../static-children.7.compiled-js-dev.js | 185 +++ .../md-suite/static-children.7.compiled-js.js | 63 + .../static-children.9.rendered-dev.html | 8 + packages/codehike/tests/md.test.tsx | 41 +- packages/codehike/tests/utils.ast.tsx | 11 +- 17 files changed, 5477 insertions(+), 7 deletions(-) create mode 100644 packages/codehike/tests/md-suite/basic.5.before-recma-js-dev.json create mode 100644 packages/codehike/tests/md-suite/basic.6.after-recma-js-dev.json create mode 100644 packages/codehike/tests/md-suite/basic.7.compiled-js-dev.js create mode 100644 packages/codehike/tests/md-suite/basic.9.rendered-dev.html create mode 100644 packages/codehike/tests/md-suite/static-children.0.mdx create mode 100644 packages/codehike/tests/md-suite/static-children.5.before-recma-compiled-js.js create mode 100644 packages/codehike/tests/md-suite/static-children.5.before-recma-js-dev.json create mode 100644 packages/codehike/tests/md-suite/static-children.5.before-recma-js.json create mode 100644 packages/codehike/tests/md-suite/static-children.6.after-recma-js-dev.json create mode 100644 packages/codehike/tests/md-suite/static-children.6.after-recma-js.json create mode 100644 packages/codehike/tests/md-suite/static-children.7.compiled-js-dev.js create mode 100644 packages/codehike/tests/md-suite/static-children.7.compiled-js.js create mode 100644 packages/codehike/tests/md-suite/static-children.9.rendered-dev.html diff --git a/packages/codehike/src/mdx/3.transform-hike-props.ts b/packages/codehike/src/mdx/3.transform-hike-props.ts index 4f3df438..5b53f2e9 100644 --- a/packages/codehike/src/mdx/3.transform-hike-props.ts +++ b/packages/codehike/src/mdx/3.transform-hike-props.ts @@ -137,7 +137,7 @@ function forEachHikeElementMoveChildrenToHikeProp(root: any, jsxOn: boolean) { visit(root, (node: any) => { if (isElementWithHikeAttribute(node, jsxOn)) { if (jsxOn) { - moveChildrenToHikePropJSX(node, jsxOn) + moveChildrenToHikePropJSX(node) } else { moveChildrenToHikeProp(node) } @@ -157,7 +157,7 @@ function isElementWithHikeAttribute(node: any, jsxOn: boolean) { ) } -function moveChildrenToHikePropJSX(node: any, jsxOn: boolean) { +function moveChildrenToHikePropJSX(node: any) { // dictionary of children by path const childrenByPath: any = {} node.children.forEach((slot: any) => { @@ -252,8 +252,8 @@ function moveChildrenToHikeProp(node: any) { (p: any) => p.key.name !== "children", ) - // jsxs calls can only have arrays as children, so we turn any jsxs without array into jsx call visit(node, function (node: any) { + // jsxs calls can only have arrays as children, so we turn any jsxs without array into jsx call if (node.type === "CallExpression" && node.callee.name === "_jsxs") { const childrenProp = node.arguments[1].properties.find( (p: any) => p.key.value === "children", @@ -262,6 +262,16 @@ function moveChildrenToHikeProp(node: any) { node.callee.name = "_jsx" } } + + // same, but in dev mode the name is _jsxDEV, and we should change the `isStaticChildren` argument + if (node.type === "CallExpression" && node.callee.name === "_jsxDEV") { + const childrenProp = node.arguments[1].properties.find( + (p: any) => p.key.value === "children", + ) + if (childrenProp && childrenProp.value.type !== "ArrayExpression") { + node.arguments[3] = { type: "Literal", value: false } + } + } }) } diff --git a/packages/codehike/tests/md-suite/basic.0.mdx b/packages/codehike/tests/md-suite/basic.0.mdx index b67c9c81..898f8d35 100644 --- a/packages/codehike/tests/md-suite/basic.0.mdx +++ b/packages/codehike/tests/md-suite/basic.0.mdx @@ -7,14 +7,18 @@ snapshots: - before-recma-compiled-jsx - before-recma-compiled-function - before-recma-js + - before-recma-js-dev - before-recma-jsx - after-recma-js + - after-recma-js-dev - after-recma-jsx - compiled-js + - compiled-js-dev - compiled-jsx - compiled-function - parsed-jsx - rendered + - rendered-dev --- # Lorem diff --git a/packages/codehike/tests/md-suite/basic.5.before-recma-js-dev.json b/packages/codehike/tests/md-suite/basic.5.before-recma-js-dev.json new file mode 100644 index 00000000..140048cd --- /dev/null +++ b/packages/codehike/tests/md-suite/basic.5.before-recma-js-dev.json @@ -0,0 +1,540 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "imported": { "type": "Identifier", "name": "jsxDEV" }, + "local": { "type": "Identifier", "name": "_jsxDEV" } + } + ], + "source": { "type": "Literal", "value": "react/jsx-dev-runtime" } + }, + { + "type": "FunctionDeclaration", + "async": false, + "id": { "type": "Identifier", "name": "_createMdxContent" }, + "params": [{ "type": "Identifier", "name": "props" }], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { "type": "Identifier", "name": "_components" }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "h1" }, + "value": { "type": "Literal", "value": "h1" }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "slot" }, + "value": { "type": "Literal", "value": "slot" }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "SpreadElement", + "argument": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { + "type": "Identifier", + "name": "components" + }, + "computed": false, + "optional": false + } + } + ] + } + } + ] + }, + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxDEV" }, + "arguments": [ + { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "_components" }, + "property": { "type": "Identifier", "name": "slot" }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { "type": "Identifier", "name": "__hike" }, + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { "type": "Literal", "value": "children" }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { "type": "Literal", "value": "title" }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { "type": "Literal", "value": "_data" }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "header" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + } + ] + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { "type": "Literal", "value": "hello" }, + "kind": "init", + "value": { + "type": "Literal", + "value": "world", + "raw": "\"world\"" + } + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { "type": "Identifier", "name": "children" }, + "value": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxDEV" }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "slot" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { "type": "Identifier", "name": "path" }, + "value": { "type": "Literal", "value": "" }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "h1" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "Lorem" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\basic.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { + "type": "Literal", + "value": 1 + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { + "type": "Literal", + "value": 1 + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\basic.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { "type": "Identifier", "name": "fileName" }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\basic.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + } + } + ] + } + }, + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { "type": "Identifier", "name": "MDXContent" }, + "params": [ + { + "type": "AssignmentPattern", + "left": { "type": "Identifier", "name": "props" }, + "right": { "type": "ObjectExpression", "properties": [] } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "wrapper" }, + "value": { "type": "Identifier", "name": "MDXLayout" }, + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + "init": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { + "type": "Identifier", + "name": "components" + }, + "computed": false, + "optional": false + }, + "right": { "type": "ObjectExpression", "properties": [] } + } + } + ] + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ConditionalExpression", + "test": { "type": "Identifier", "name": "MDXLayout" }, + "consequent": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxDEV" }, + "arguments": [ + { "type": "Identifier", "name": "MDXLayout" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "SpreadElement", + "argument": { "type": "Identifier", "name": "props" } + }, + { + "type": "Property", + "key": { "type": "Identifier", "name": "children" }, + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "Identifier", + "name": "_createMdxContent" + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "props" + } + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\basic.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { "type": "Identifier", "name": "fileName" }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\basic.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + "alternate": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_createMdxContent" + }, + "arguments": [{ "type": "Identifier", "name": "props" }], + "optional": false + } + } + } + ] + } + } + } + ], + "sourceType": "module", + "comments": [] +} diff --git a/packages/codehike/tests/md-suite/basic.6.after-recma-js-dev.json b/packages/codehike/tests/md-suite/basic.6.after-recma-js-dev.json new file mode 100644 index 00000000..a789d402 --- /dev/null +++ b/packages/codehike/tests/md-suite/basic.6.after-recma-js-dev.json @@ -0,0 +1,422 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "imported": { "type": "Identifier", "name": "jsxDEV" }, + "local": { "type": "Identifier", "name": "_jsxDEV" } + } + ], + "source": { "type": "Literal", "value": "react/jsx-dev-runtime" } + }, + { + "type": "FunctionDeclaration", + "async": false, + "id": { "type": "Identifier", "name": "_createMdxContent" }, + "params": [{ "type": "Identifier", "name": "props" }], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { "type": "Identifier", "name": "_components" }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "h1" }, + "value": { "type": "Literal", "value": "h1" }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "slot" }, + "value": { "type": "Literal", "value": "slot" }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "SpreadElement", + "argument": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { + "type": "Identifier", + "name": "components" + }, + "computed": false, + "optional": false + } + } + ] + } + } + ] + }, + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { "type": "Identifier", "name": "_blocks" }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { "type": "Literal", "value": "children" }, + "kind": "init", + "value": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxDEV" }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { "type": "Identifier", "name": "h1" }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "Lorem" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\basic.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { "type": "Literal", "value": 1 } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { "type": "Literal", "value": 1 } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { "type": "Literal", "value": "title" }, + "kind": "init", + "value": { "type": "Literal", "value": "", "raw": "\"\"" } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { "type": "Literal", "value": "_data" }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { "type": "Literal", "value": "header" }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + } + ] + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { "type": "Literal", "value": "hello" }, + "kind": "init", + "value": { + "type": "Literal", + "value": "world", + "raw": "\"world\"" + } + } + ] + } + } + ] + }, + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { "type": "Identifier", "name": "_returnBlocks" } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { "type": "Identifier", "name": "_blocks" } + } + ] + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "_blocks" }, + "property": { "type": "Identifier", "name": "children" } + } + } + ] + } + }, + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { "type": "Identifier", "name": "MDXContent" }, + "params": [ + { + "type": "AssignmentPattern", + "left": { "type": "Identifier", "name": "props" }, + "right": { "type": "ObjectExpression", "properties": [] } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "wrapper" }, + "value": { "type": "Identifier", "name": "MDXLayout" }, + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + "init": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { + "type": "Identifier", + "name": "components" + }, + "computed": false, + "optional": false + }, + "right": { "type": "ObjectExpression", "properties": [] } + } + } + ] + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ConditionalExpression", + "test": { "type": "Identifier", "name": "MDXLayout" }, + "consequent": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxDEV" }, + "arguments": [ + { "type": "Identifier", "name": "MDXLayout" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "SpreadElement", + "argument": { "type": "Identifier", "name": "props" } + }, + { + "type": "Property", + "key": { "type": "Identifier", "name": "children" }, + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "Identifier", + "name": "_createMdxContent" + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "props" + } + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\basic.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { "type": "Identifier", "name": "fileName" }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\basic.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + "alternate": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_createMdxContent" + }, + "arguments": [{ "type": "Identifier", "name": "props" }], + "optional": false + } + } + } + ] + } + } + } + ], + "sourceType": "module", + "comments": [] +} diff --git a/packages/codehike/tests/md-suite/basic.7.compiled-js-dev.js b/packages/codehike/tests/md-suite/basic.7.compiled-js-dev.js new file mode 100644 index 00000000..42f39317 --- /dev/null +++ b/packages/codehike/tests/md-suite/basic.7.compiled-js-dev.js @@ -0,0 +1,65 @@ +import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime" +function _createMdxContent(props) { + const _components = { + h1: "h1", + slot: "slot", + ...props.components, + } + const _blocks = { + children: _jsxDEV( + _components.h1, + { + children: "Lorem", + }, + undefined, + false, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\basic.0.mdx", + lineNumber: 1, + columnNumber: 1, + }, + this, + ), + title: "", + _data: { + header: "", + }, + hello: "world", + } + if (props._returnBlocks) { + return _blocks + } + return _blocks.children +} +export default function MDXContent(props = {}) { + const { wrapper: MDXLayout } = props.components || {} + return MDXLayout + ? _jsxDEV( + MDXLayout, + { + ...props, + children: _jsxDEV( + _createMdxContent, + { + ...props, + }, + undefined, + false, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\basic.0.mdx", + }, + this, + ), + }, + undefined, + false, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\basic.0.mdx", + }, + this, + ) + : _createMdxContent(props) +} diff --git a/packages/codehike/tests/md-suite/basic.9.rendered-dev.html b/packages/codehike/tests/md-suite/basic.9.rendered-dev.html new file mode 100644 index 00000000..214f117e --- /dev/null +++ b/packages/codehike/tests/md-suite/basic.9.rendered-dev.html @@ -0,0 +1 @@ +

Lorem

diff --git a/packages/codehike/tests/md-suite/static-children.0.mdx b/packages/codehike/tests/md-suite/static-children.0.mdx new file mode 100644 index 00000000..4044d6cc --- /dev/null +++ b/packages/codehike/tests/md-suite/static-children.0.mdx @@ -0,0 +1,32 @@ +--- +snapshots: + - before-recma-compiled-js + - before-recma-js-dev + - before-recma-js + - after-recma-js + - after-recma-js-dev + - compiled-js + - compiled-js-dev + - rendered-dev +issue: https://github.com/code-hike/codehike/issues/433 +--- + +
+ +hey + +ho + +## !foo + +bar + +
+ +
+ +asdf + +aa + +
diff --git a/packages/codehike/tests/md-suite/static-children.5.before-recma-compiled-js.js b/packages/codehike/tests/md-suite/static-children.5.before-recma-compiled-js.js new file mode 100644 index 00000000..85400db3 --- /dev/null +++ b/packages/codehike/tests/md-suite/static-children.5.before-recma-compiled-js.js @@ -0,0 +1,75 @@ +import { + Fragment as _Fragment, + jsx as _jsx, + jsxs as _jsxs, +} from "react/jsx-runtime" +function _createMdxContent(props) { + const _components = { + p: "p", + slot: "slot", + ...props.components, + } + return _jsxs(_Fragment, { + children: [ + _jsxs("div", { + __hike: { + children: "", + title: "", + _data: { + header: "", + }, + foo: { + children: "foo", + title: "", + _data: { + header: "## !foo", + }, + }, + }, + children: [ + _jsx(_components.slot, { + path: "", + children: _jsxs(_Fragment, { + children: [ + _jsx(_components.p, { + children: "hey", + }), + _jsx(_components.p, { + children: "ho", + }), + ], + }), + }), + _jsx(_components.slot, { + path: "foo", + children: _jsx(_components.p, { + children: "bar", + }), + }), + ], + }), + "\n", + _jsxs("section", { + children: [ + _jsx(_components.p, { + children: "asdf", + }), + _jsx(_components.p, { + children: "aa", + }), + ], + }), + ], + }) +} +export default function MDXContent(props = {}) { + const { wrapper: MDXLayout } = props.components || {} + return MDXLayout + ? _jsx(MDXLayout, { + ...props, + children: _jsx(_createMdxContent, { + ...props, + }), + }) + : _createMdxContent(props) +} diff --git a/packages/codehike/tests/md-suite/static-children.5.before-recma-js-dev.json b/packages/codehike/tests/md-suite/static-children.5.before-recma-js-dev.json new file mode 100644 index 00000000..0c85f37a --- /dev/null +++ b/packages/codehike/tests/md-suite/static-children.5.before-recma-js-dev.json @@ -0,0 +1,1381 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "imported": { "type": "Identifier", "name": "Fragment" }, + "local": { "type": "Identifier", "name": "_Fragment" } + }, + { + "type": "ImportSpecifier", + "imported": { "type": "Identifier", "name": "jsxDEV" }, + "local": { "type": "Identifier", "name": "_jsxDEV" } + } + ], + "source": { "type": "Literal", "value": "react/jsx-dev-runtime" } + }, + { + "type": "FunctionDeclaration", + "async": false, + "id": { "type": "Identifier", "name": "_createMdxContent" }, + "params": [{ "type": "Identifier", "name": "props" }], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { "type": "Identifier", "name": "_components" }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "p" }, + "value": { "type": "Literal", "value": "p" }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "slot" }, + "value": { "type": "Literal", "value": "slot" }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "SpreadElement", + "argument": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { + "type": "Identifier", + "name": "components" + }, + "computed": false, + "optional": false + } + } + ] + } + } + ] + }, + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxDEV" }, + "arguments": [ + { "type": "Identifier", "name": "_Fragment" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { "type": "Identifier", "name": "children" }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { "type": "Literal", "value": "div" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "__hike" + }, + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "children" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "title" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "_data" + }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "header" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + } + ] + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "foo" + }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "children" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "title" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "_data" + }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "header" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "## !foo", + "raw": "\"## !foo\"" + } + } + ] + } + } + ] + } + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "slot" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "path" + }, + "value": { + "type": "Literal", + "value": "" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "Identifier", + "name": "_Fragment" + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "hey" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { + "type": "Literal", + "value": 3 + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { + "type": "Literal", + "value": 1 + } + } + ] + }, + { + "type": "ThisExpression" + } + ], + "optional": false + }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "ho" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { + "type": "Literal", + "value": 5 + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { + "type": "Literal", + "value": 1 + } + } + ] + }, + { + "type": "ThisExpression" + } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": true + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + } + ] + }, + { + "type": "ThisExpression" + } + ], + "optional": false + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "slot" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "path" + }, + "value": { + "type": "Literal", + "value": "foo" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "bar" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { + "type": "Literal", + "value": 9 + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { + "type": "Literal", + "value": 1 + } + } + ] + }, + { + "type": "ThisExpression" + } + ], + "optional": false + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": true }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { "type": "Literal", "value": 1 } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { "type": "Literal", "value": 1 } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + { "type": "Literal", "value": "\n" }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { "type": "Literal", "value": "section" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "asdf" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { + "type": "Literal", + "value": 15 + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { + "type": "Literal", + "value": 1 + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "aa" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { + "type": "Literal", + "value": 17 + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { + "type": "Literal", + "value": 1 + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": true }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { "type": "Literal", "value": 13 } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { "type": "Literal", "value": 1 } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": true }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { "type": "Identifier", "name": "fileName" }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { "type": "Identifier", "name": "lineNumber" }, + "value": { "type": "Literal", "value": 1 } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { "type": "Identifier", "name": "columnNumber" }, + "value": { "type": "Literal", "value": 1 } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + } + } + ] + } + }, + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { "type": "Identifier", "name": "MDXContent" }, + "params": [ + { + "type": "AssignmentPattern", + "left": { "type": "Identifier", "name": "props" }, + "right": { "type": "ObjectExpression", "properties": [] } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "wrapper" }, + "value": { "type": "Identifier", "name": "MDXLayout" }, + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + "init": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { + "type": "Identifier", + "name": "components" + }, + "computed": false, + "optional": false + }, + "right": { "type": "ObjectExpression", "properties": [] } + } + } + ] + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ConditionalExpression", + "test": { "type": "Identifier", "name": "MDXLayout" }, + "consequent": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxDEV" }, + "arguments": [ + { "type": "Identifier", "name": "MDXLayout" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "SpreadElement", + "argument": { "type": "Identifier", "name": "props" } + }, + { + "type": "Property", + "key": { "type": "Identifier", "name": "children" }, + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "Identifier", + "name": "_createMdxContent" + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "props" + } + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { "type": "Identifier", "name": "fileName" }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + "alternate": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_createMdxContent" + }, + "arguments": [{ "type": "Identifier", "name": "props" }], + "optional": false + } + } + } + ] + } + } + } + ], + "sourceType": "module", + "comments": [] +} diff --git a/packages/codehike/tests/md-suite/static-children.5.before-recma-js.json b/packages/codehike/tests/md-suite/static-children.5.before-recma-js.json new file mode 100644 index 00000000..15040402 --- /dev/null +++ b/packages/codehike/tests/md-suite/static-children.5.before-recma-js.json @@ -0,0 +1,812 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "imported": { "type": "Identifier", "name": "Fragment" }, + "local": { "type": "Identifier", "name": "_Fragment" } + }, + { + "type": "ImportSpecifier", + "imported": { "type": "Identifier", "name": "jsx" }, + "local": { "type": "Identifier", "name": "_jsx" } + }, + { + "type": "ImportSpecifier", + "imported": { "type": "Identifier", "name": "jsxs" }, + "local": { "type": "Identifier", "name": "_jsxs" } + } + ], + "source": { "type": "Literal", "value": "react/jsx-runtime" } + }, + { + "type": "FunctionDeclaration", + "async": false, + "id": { "type": "Identifier", "name": "_createMdxContent" }, + "params": [{ "type": "Identifier", "name": "props" }], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { "type": "Identifier", "name": "_components" }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "p" }, + "value": { "type": "Literal", "value": "p" }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "slot" }, + "value": { "type": "Literal", "value": "slot" }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "SpreadElement", + "argument": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { + "type": "Identifier", + "name": "components" + }, + "computed": false, + "optional": false + } + } + ] + } + } + ] + }, + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxs" }, + "arguments": [ + { "type": "Identifier", "name": "_Fragment" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { "type": "Identifier", "name": "children" }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxs" }, + "arguments": [ + { "type": "Literal", "value": "div" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "__hike" + }, + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "children" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "title" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "_data" + }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "header" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + } + ] + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "foo" + }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "children" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "foo", + "raw": "\"foo\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "title" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "_data" + }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "header" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "## !foo", + "raw": "\"## !foo\"" + } + } + ] + } + } + ] + } + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsx" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "slot" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "path" + }, + "value": { + "type": "Literal", + "value": "" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxs" + }, + "arguments": [ + { + "type": "Identifier", + "name": "_Fragment" + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsx" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "hey" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsx" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "ho" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsx" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "slot" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "path" + }, + "value": { + "type": "Literal", + "value": "foo" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsx" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "bar" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + }, + { "type": "Literal", "value": "\n" }, + { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxs" }, + "arguments": [ + { "type": "Literal", "value": "section" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsx" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "asdf" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsx" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "aa" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + } + } + ] + } + }, + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { "type": "Identifier", "name": "MDXContent" }, + "params": [ + { + "type": "AssignmentPattern", + "left": { "type": "Identifier", "name": "props" }, + "right": { "type": "ObjectExpression", "properties": [] } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "wrapper" }, + "value": { "type": "Identifier", "name": "MDXLayout" }, + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + "init": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { + "type": "Identifier", + "name": "components" + }, + "computed": false, + "optional": false + }, + "right": { "type": "ObjectExpression", "properties": [] } + } + } + ] + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ConditionalExpression", + "test": { "type": "Identifier", "name": "MDXLayout" }, + "consequent": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsx" }, + "arguments": [ + { "type": "Identifier", "name": "MDXLayout" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "SpreadElement", + "argument": { "type": "Identifier", "name": "props" } + }, + { + "type": "Property", + "key": { "type": "Identifier", "name": "children" }, + "value": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsx" }, + "arguments": [ + { + "type": "Identifier", + "name": "_createMdxContent" + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "props" + } + } + ] + } + ], + "optional": false + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + }, + "alternate": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_createMdxContent" + }, + "arguments": [{ "type": "Identifier", "name": "props" }], + "optional": false + } + } + } + ] + } + } + } + ], + "sourceType": "module", + "comments": [] +} diff --git a/packages/codehike/tests/md-suite/static-children.6.after-recma-js-dev.json b/packages/codehike/tests/md-suite/static-children.6.after-recma-js-dev.json new file mode 100644 index 00000000..2762afba --- /dev/null +++ b/packages/codehike/tests/md-suite/static-children.6.after-recma-js-dev.json @@ -0,0 +1,1166 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "imported": { "type": "Identifier", "name": "Fragment" }, + "local": { "type": "Identifier", "name": "_Fragment" } + }, + { + "type": "ImportSpecifier", + "imported": { "type": "Identifier", "name": "jsxDEV" }, + "local": { "type": "Identifier", "name": "_jsxDEV" } + } + ], + "source": { "type": "Literal", "value": "react/jsx-dev-runtime" } + }, + { + "type": "FunctionDeclaration", + "async": false, + "id": { "type": "Identifier", "name": "_createMdxContent" }, + "params": [{ "type": "Identifier", "name": "props" }], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { "type": "Identifier", "name": "_components" }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "p" }, + "value": { "type": "Literal", "value": "p" }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "slot" }, + "value": { "type": "Literal", "value": "slot" }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "SpreadElement", + "argument": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { + "type": "Identifier", + "name": "components" + }, + "computed": false, + "optional": false + } + } + ] + } + } + ] + }, + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxDEV" }, + "arguments": [ + { "type": "Identifier", "name": "_Fragment" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { "type": "Identifier", "name": "children" }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { "type": "Literal", "value": "div" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "children" + }, + "kind": "init", + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "Identifier", + "name": "_Fragment" + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "hey" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { + "type": "Literal", + "value": 3 + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { + "type": "Literal", + "value": 1 + } + } + ] + }, + { + "type": "ThisExpression" + } + ], + "optional": false + }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "ho" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { + "type": "Literal", + "value": 5 + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { + "type": "Literal", + "value": 1 + } + } + ] + }, + { + "type": "ThisExpression" + } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { "type": "Literal", "value": true }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "title" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "_data" + }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "header" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + } + ] + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "foo" + }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "children" + }, + "kind": "init", + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "bar" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { + "type": "Literal", + "value": 9 + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { + "type": "Literal", + "value": 1 + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "title" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "_data" + }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "header" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "## !foo", + "raw": "\"## !foo\"" + } + } + ] + } + } + ] + } + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { "type": "Literal", "value": 1 } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { "type": "Literal", "value": 1 } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + { "type": "Literal", "value": "\n" }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { "type": "Literal", "value": "section" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "asdf" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { + "type": "Literal", + "value": 15 + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { + "type": "Literal", + "value": 1 + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "aa" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { + "type": "Identifier", + "name": "undefined" + }, + { + "type": "Literal", + "value": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { + "type": "Literal", + "value": 17 + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { + "type": "Literal", + "value": 1 + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": true }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "lineNumber" + }, + "value": { "type": "Literal", "value": 13 } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "columnNumber" + }, + "value": { "type": "Literal", "value": 1 } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": true }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { "type": "Identifier", "name": "fileName" }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { "type": "Identifier", "name": "lineNumber" }, + "value": { "type": "Literal", "value": 1 } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { "type": "Identifier", "name": "columnNumber" }, + "value": { "type": "Literal", "value": 1 } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + } + } + ] + } + }, + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { "type": "Identifier", "name": "MDXContent" }, + "params": [ + { + "type": "AssignmentPattern", + "left": { "type": "Identifier", "name": "props" }, + "right": { "type": "ObjectExpression", "properties": [] } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "wrapper" }, + "value": { "type": "Identifier", "name": "MDXLayout" }, + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + "init": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { + "type": "Identifier", + "name": "components" + }, + "computed": false, + "optional": false + }, + "right": { "type": "ObjectExpression", "properties": [] } + } + } + ] + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ConditionalExpression", + "test": { "type": "Identifier", "name": "MDXLayout" }, + "consequent": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxDEV" }, + "arguments": [ + { "type": "Identifier", "name": "MDXLayout" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "SpreadElement", + "argument": { "type": "Identifier", "name": "props" } + }, + { + "type": "Property", + "key": { "type": "Identifier", "name": "children" }, + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxDEV" + }, + "arguments": [ + { + "type": "Identifier", + "name": "_createMdxContent" + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "props" + } + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { + "type": "Identifier", + "name": "fileName" + }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + { "type": "Identifier", "name": "undefined" }, + { "type": "Literal", "value": false }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "kind": "init", + "key": { "type": "Identifier", "name": "fileName" }, + "value": { + "type": "Literal", + "value": "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx" + } + } + ] + }, + { "type": "ThisExpression" } + ], + "optional": false + }, + "alternate": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_createMdxContent" + }, + "arguments": [{ "type": "Identifier", "name": "props" }], + "optional": false + } + } + } + ] + } + } + } + ], + "sourceType": "module", + "comments": [] +} diff --git a/packages/codehike/tests/md-suite/static-children.6.after-recma-js.json b/packages/codehike/tests/md-suite/static-children.6.after-recma-js.json new file mode 100644 index 00000000..c6ea0a3f --- /dev/null +++ b/packages/codehike/tests/md-suite/static-children.6.after-recma-js.json @@ -0,0 +1,662 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "imported": { "type": "Identifier", "name": "Fragment" }, + "local": { "type": "Identifier", "name": "_Fragment" } + }, + { + "type": "ImportSpecifier", + "imported": { "type": "Identifier", "name": "jsx" }, + "local": { "type": "Identifier", "name": "_jsx" } + }, + { + "type": "ImportSpecifier", + "imported": { "type": "Identifier", "name": "jsxs" }, + "local": { "type": "Identifier", "name": "_jsxs" } + } + ], + "source": { "type": "Literal", "value": "react/jsx-runtime" } + }, + { + "type": "FunctionDeclaration", + "async": false, + "id": { "type": "Identifier", "name": "_createMdxContent" }, + "params": [{ "type": "Identifier", "name": "props" }], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { "type": "Identifier", "name": "_components" }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "p" }, + "value": { "type": "Literal", "value": "p" }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "slot" }, + "value": { "type": "Literal", "value": "slot" }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "SpreadElement", + "argument": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { + "type": "Identifier", + "name": "components" + }, + "computed": false, + "optional": false + } + } + ] + } + } + ] + }, + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxs" }, + "arguments": [ + { "type": "Identifier", "name": "_Fragment" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { "type": "Identifier", "name": "children" }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsx" }, + "arguments": [ + { "type": "Literal", "value": "div" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "children" + }, + "kind": "init", + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsxs" + }, + "arguments": [ + { + "type": "Identifier", + "name": "_Fragment" + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsx" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "hey" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsx" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "ho" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "title" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "_data" + }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "header" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + } + ] + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "foo" + }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "children" + }, + "kind": "init", + "value": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsx" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "bar" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "title" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "", + "raw": "\"\"" + } + }, + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "_data" + }, + "kind": "init", + "value": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "value": "header" + }, + "kind": "init", + "value": { + "type": "Literal", + "value": "## !foo", + "raw": "\"## !foo\"" + } + } + ] + } + } + ] + } + } + ] + } + ], + "optional": false + }, + { "type": "Literal", "value": "\n" }, + { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsxs" }, + "arguments": [ + { "type": "Literal", "value": "section" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "ArrayExpression", + "elements": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsx" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "asdf" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_jsx" + }, + "arguments": [ + { + "type": "MemberExpression", + "object": { + "type": "Identifier", + "name": "_components" + }, + "property": { + "type": "Identifier", + "name": "p" + }, + "computed": false, + "optional": false + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "children" + }, + "value": { + "type": "Literal", + "value": "aa" + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + } + ] + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + } + } + ] + } + }, + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { "type": "Identifier", "name": "MDXContent" }, + "params": [ + { + "type": "AssignmentPattern", + "left": { "type": "Identifier", "name": "props" }, + "right": { "type": "ObjectExpression", "properties": [] } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "kind": "init", + "key": { "type": "Identifier", "name": "wrapper" }, + "value": { "type": "Identifier", "name": "MDXLayout" }, + "method": false, + "shorthand": false, + "computed": false + } + ] + }, + "init": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "MemberExpression", + "object": { "type": "Identifier", "name": "props" }, + "property": { + "type": "Identifier", + "name": "components" + }, + "computed": false, + "optional": false + }, + "right": { "type": "ObjectExpression", "properties": [] } + } + } + ] + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ConditionalExpression", + "test": { "type": "Identifier", "name": "MDXLayout" }, + "consequent": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsx" }, + "arguments": [ + { "type": "Identifier", "name": "MDXLayout" }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "SpreadElement", + "argument": { "type": "Identifier", "name": "props" } + }, + { + "type": "Property", + "key": { "type": "Identifier", "name": "children" }, + "value": { + "type": "CallExpression", + "callee": { "type": "Identifier", "name": "_jsx" }, + "arguments": [ + { + "type": "Identifier", + "name": "_createMdxContent" + }, + { + "type": "ObjectExpression", + "properties": [ + { + "type": "SpreadElement", + "argument": { + "type": "Identifier", + "name": "props" + } + } + ] + } + ], + "optional": false + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false + } + ] + } + ], + "optional": false + }, + "alternate": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "_createMdxContent" + }, + "arguments": [{ "type": "Identifier", "name": "props" }], + "optional": false + } + } + } + ] + } + } + } + ], + "sourceType": "module", + "comments": [] +} diff --git a/packages/codehike/tests/md-suite/static-children.7.compiled-js-dev.js b/packages/codehike/tests/md-suite/static-children.7.compiled-js-dev.js new file mode 100644 index 00000000..4d68649c --- /dev/null +++ b/packages/codehike/tests/md-suite/static-children.7.compiled-js-dev.js @@ -0,0 +1,185 @@ +import { Fragment as _Fragment, jsxDEV as _jsxDEV } from "react/jsx-dev-runtime" +function _createMdxContent(props) { + const _components = { + p: "p", + slot: "slot", + ...props.components, + } + return _jsxDEV( + _Fragment, + { + children: [ + _jsxDEV( + "div", + { + children: _jsxDEV( + _Fragment, + { + children: [ + _jsxDEV( + _components.p, + { + children: "hey", + }, + undefined, + false, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx", + lineNumber: 3, + columnNumber: 1, + }, + this, + ), + _jsxDEV( + _components.p, + { + children: "ho", + }, + undefined, + false, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx", + lineNumber: 5, + columnNumber: 1, + }, + this, + ), + ], + }, + undefined, + true, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx", + }, + this, + ), + title: "", + _data: { + header: "", + }, + foo: { + children: _jsxDEV( + _components.p, + { + children: "bar", + }, + undefined, + false, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx", + lineNumber: 9, + columnNumber: 1, + }, + this, + ), + title: "", + _data: { + header: "## !foo", + }, + }, + }, + undefined, + false, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx", + lineNumber: 1, + columnNumber: 1, + }, + this, + ), + "\n", + _jsxDEV( + "section", + { + children: [ + _jsxDEV( + _components.p, + { + children: "asdf", + }, + undefined, + false, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx", + lineNumber: 15, + columnNumber: 1, + }, + this, + ), + _jsxDEV( + _components.p, + { + children: "aa", + }, + undefined, + false, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx", + lineNumber: 17, + columnNumber: 1, + }, + this, + ), + ], + }, + undefined, + true, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx", + lineNumber: 13, + columnNumber: 1, + }, + this, + ), + ], + }, + undefined, + true, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx", + lineNumber: 1, + columnNumber: 1, + }, + this, + ) +} +export default function MDXContent(props = {}) { + const { wrapper: MDXLayout } = props.components || {} + return MDXLayout + ? _jsxDEV( + MDXLayout, + { + ...props, + children: _jsxDEV( + _createMdxContent, + { + ...props, + }, + undefined, + false, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx", + }, + this, + ), + }, + undefined, + false, + { + fileName: + "C:\\p\\dev\\codehike\\packages\\codehike\\tests\\md-suite\\static-children.0.mdx", + }, + this, + ) + : _createMdxContent(props) +} diff --git a/packages/codehike/tests/md-suite/static-children.7.compiled-js.js b/packages/codehike/tests/md-suite/static-children.7.compiled-js.js new file mode 100644 index 00000000..1b88de1b --- /dev/null +++ b/packages/codehike/tests/md-suite/static-children.7.compiled-js.js @@ -0,0 +1,63 @@ +import { + Fragment as _Fragment, + jsx as _jsx, + jsxs as _jsxs, +} from "react/jsx-runtime" +function _createMdxContent(props) { + const _components = { + p: "p", + slot: "slot", + ...props.components, + } + return _jsxs(_Fragment, { + children: [ + _jsx("div", { + children: _jsxs(_Fragment, { + children: [ + _jsx(_components.p, { + children: "hey", + }), + _jsx(_components.p, { + children: "ho", + }), + ], + }), + title: "", + _data: { + header: "", + }, + foo: { + children: _jsx(_components.p, { + children: "bar", + }), + title: "", + _data: { + header: "## !foo", + }, + }, + }), + "\n", + _jsxs("section", { + children: [ + _jsx(_components.p, { + children: "asdf", + }), + _jsx(_components.p, { + children: "aa", + }), + ], + }), + ], + }) +} +export default function MDXContent(props = {}) { + const { wrapper: MDXLayout } = props.components || {} + return MDXLayout + ? _jsx(MDXLayout, { + ...props, + children: _jsx(_createMdxContent, { + ...props, + }), + }) + : _createMdxContent(props) +} diff --git a/packages/codehike/tests/md-suite/static-children.9.rendered-dev.html b/packages/codehike/tests/md-suite/static-children.9.rendered-dev.html new file mode 100644 index 00000000..a5d4ed6e --- /dev/null +++ b/packages/codehike/tests/md-suite/static-children.9.rendered-dev.html @@ -0,0 +1,8 @@ +
+

hey

+

ho

+
+
+

asdf

+

aa

+
diff --git a/packages/codehike/tests/md.test.tsx b/packages/codehike/tests/md.test.tsx index d7283ef6..8e39fccb 100644 --- a/packages/codehike/tests/md.test.tsx +++ b/packages/codehike/tests/md.test.tsx @@ -69,7 +69,7 @@ testNames.forEach(async (filename) => { }) }) -const js = ["before-recma-compiled-js", "compiled-js"] +const js = ["before-recma-compiled-js", "compiled-js", "compiled-js-dev"] const jsx = [ "before-recma-compiled-jsx", "compiled-jsx", @@ -82,7 +82,7 @@ function sn(filename: string, step: string) { const extention = step === "error" ? "md" - : step === "rendered" + : step === "rendered" || step === "rendered-dev" ? "html" : js.includes(step) ? "js" @@ -101,14 +101,18 @@ const indexes = { "before-recma-compiled-jsx": 5, "before-recma-compiled-function": 5, "before-recma-js": 5, + "before-recma-js-dev": 5, "before-recma-jsx": 5, "after-recma-js": 6, + "after-recma-js-dev": 6, "after-recma-jsx": 6, "compiled-js": 7, + "compiled-js-dev": 7, "compiled-jsx": 7, "compiled-function": 7, "parsed-jsx": 8, rendered: 9, + "rendered-dev": 9, } async function getStepOutput( @@ -153,12 +157,26 @@ async function getStepOutput( remarkPlugins: [[remarkCodeHike, chConfig]], recmaPlugins: [X], })) + case "before-recma-js-dev": + return await compileAST(file, (X) => ({ + jsx: false, + development: true, + remarkPlugins: [[remarkCodeHike, chConfig]], + recmaPlugins: [X], + })) case "after-recma-js": return await compileAST(file, (X) => ({ jsx: false, remarkPlugins: [[remarkCodeHike, chConfig]], recmaPlugins: [[recmaCodeHike, chConfig], X], })) + case "after-recma-js-dev": + return await compileAST(file, (X) => ({ + jsx: false, + development: true, + remarkPlugins: [[remarkCodeHike, chConfig]], + recmaPlugins: [[recmaCodeHike, chConfig], X], + })) case "before-recma-jsx": return await compileAST(file, (X) => ({ jsx: true, @@ -171,6 +189,13 @@ async function getStepOutput( remarkPlugins: [[remarkCodeHike, chConfig]], recmaPlugins: [[recmaCodeHike, chConfig], X], })) + case "compiled-js-dev": + return await compileJS(file, { + jsx: false, + development: true, + remarkPlugins: [[remarkCodeHike, chConfig]], + recmaPlugins: [[recmaCodeHike, chConfig]], + }) case "compiled-js": return await compileJS(file, { jsx: false, @@ -201,6 +226,18 @@ async function getStepOutput( { remarkPlugins: [[remarkCodeHike, chConfig]], recmaPlugins: [[recmaCodeHike, chConfig]], + jsx: false, + }, + render, + ) + case "rendered-dev": + return await renderHTML( + file, + { + remarkPlugins: [[remarkCodeHike, chConfig]], + recmaPlugins: [[recmaCodeHike, chConfig]], + jsx: false, + development: true, }, render, ) diff --git a/packages/codehike/tests/utils.ast.tsx b/packages/codehike/tests/utils.ast.tsx index 25a9b3ff..05c15afc 100644 --- a/packages/codehike/tests/utils.ast.tsx +++ b/packages/codehike/tests/utils.ast.tsx @@ -2,6 +2,7 @@ import * as prettier from "prettier" import { compile, CompileOptions, run } from "@mdx-js/mdx" import { Pluggable } from "unified" import * as runtime from "react/jsx-runtime" +import * as devRuntime from "react/jsx-dev-runtime" import { parse } from "../src/" import { renderToReadableStream } from "react-dom/server.edge" import React from "react" @@ -53,7 +54,10 @@ export async function parsedJS(file: MDFile, options: CompileOptions) { outputFormat: "function-body", jsx: false, }) - const { default: Content } = await run(result, runtime as any) + const { default: Content } = await run( + result, + (options.development ? devRuntime : runtime) as any, + ) const block = parse(Content) return { block } } @@ -67,7 +71,10 @@ export async function renderHTML( ...options, outputFormat: "function-body", }) - const { default: Content } = await run(result, runtime as any) + const { default: Content } = await run( + result, + (options.development ? devRuntime : runtime) as any, + ) const html = await rscToHTML(render(Content)) return html From 3f4b7f165c31e5c5f17ffa637528f7eda6fbce1b Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Thu, 29 Aug 2024 15:04:39 +0200 Subject: [PATCH 02/12] Add recma debugger --- apps/web/content/blog/from-remark-to-rsc.mdx | 2 ++ apps/web/next.config.mjs | 13 ++++++++++++- apps/web/package.json | 1 + pnpm-lock.yaml | 3 +++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/web/content/blog/from-remark-to-rsc.mdx b/apps/web/content/blog/from-remark-to-rsc.mdx index bf2e7ec5..e79b9f42 100644 --- a/apps/web/content/blog/from-remark-to-rsc.mdx +++ b/apps/web/content/blog/from-remark-to-rsc.mdx @@ -6,4 +6,6 @@ authors: [pomber] draft: true --- +Content usually needs some kind of transformation before being rendered. + A remark plugin is a function that transforms pieces of a markdown file. diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index ca8fd3e7..cc3ac2bc 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -1,5 +1,16 @@ import createNextDocsMDX from "next-docs-mdx/config" import { remarkCodeHike, recmaCodeHike } from "codehike/mdx" +// import fs from "node:fs" +// import { jsx, toJs } from "estree-util-to-js" +// function recmaPlugin() { +// return (tree) => { +// const result = toJs(tree, { handlers: jsx }) +// // console.log("```js") +// // console.log(result.value) +// // console.log("```") +// fs.writeFileSync("recma.js", result.value) +// } +// } /** @type {import('codehike/mdx').CodeHikeConfig} */ const chConfig = { @@ -17,7 +28,7 @@ const withMDX = createNextDocsMDX({ mdxOptions: { remarkPlugins: [[remarkCodeHike, chConfig]], recmaPlugins: [[recmaCodeHike, chConfig]], - jsx: true, + // jsx: true, }, }) diff --git a/apps/web/package.json b/apps/web/package.json index 7f40fd92..a45766c4 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -24,6 +24,7 @@ "codehike": "workspace:*", "diff": "^5.1.0", "dotenv": "^16.4.1", + "estree-util-to-js": "^2.0.0", "lucide-react": "^0.303.0", "next": "14.1.0", "next-docs-mdx": "7.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 84bad510..63769b04 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -65,6 +65,9 @@ importers: dotenv: specifier: ^16.4.1 version: 16.4.1 + estree-util-to-js: + specifier: ^2.0.0 + version: 2.0.0 lucide-react: specifier: ^0.303.0 version: 0.303.0(react@18.2.0) From 6e5a7ea19a02b4c353d41d232f9044e5dbfbea27 Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Thu, 29 Aug 2024 16:01:00 +0200 Subject: [PATCH 03/12] Add CI --- .github/workflows/ci.yml | 28 +++ package.json | 6 +- pnpm-lock.yaml | 384 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 416 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..db2ea211 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI + +on: + pull_request: + branches: + - next + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - run: corepack enable + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + + - name: Install dependencies + run: pnpm install + + - name: Build + run: pnpm build + + - run: pnpm prerelease diff --git a/package.json b/package.json index 59965196..bc19852b 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,14 @@ "format": "prettier --write \"**/*.{ts,tsx,md,mdx}\"", "changeset": "changeset", "version-packages": "changeset version", - "release": "changeset publish" + "release": "changeset publish", + "prerelease": "pkg-pr-new publish --compact './packages/codehike'" }, "devDependencies": { "@changesets/cli": "2.27.1", "prettier": "^3.1.1", - "turbo": "^1.11.2" + "turbo": "^1.11.2", + "pkg-pr-new": "0.0.20" }, "packageManager": "pnpm@9.7.1", "repository": "code-hike/codehike", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 84bad510..bb03f941 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@changesets/cli': specifier: 2.27.1 version: 2.27.1 + pkg-pr-new: + specifier: 0.0.20 + version: 0.0.20 prettier: specifier: ^3.1.1 version: 3.1.1 @@ -610,6 +613,10 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + '@jsdevtools/ez-spawn@3.0.4': + resolution: {integrity: sha512-f5DRIOZf7wxogefH03RjMPMdBF7ADTWUMoOs9kaJo06EfwF+aFhMZMDZxHg/Xe12hptN9xoZjGso2fdjapBRIA==} + engines: {node: '>=10'} + '@manypkg/find-root@1.1.0': resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} @@ -688,6 +695,62 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@octokit/action@6.1.0': + resolution: {integrity: sha512-lo+nHx8kAV86bxvOVOI3vFjX3gXPd/L7guAUbvs3pUvnR2KC+R7yjBkA1uACt4gYhs4LcWP3AXSGQzsbeN2XXw==} + engines: {node: '>= 18'} + + '@octokit/auth-action@4.1.0': + resolution: {integrity: sha512-m+3t7K46IYyMk7Bl6/lF4Rv09GqDZjYmNg8IWycJ2Fa3YE3DE7vQcV6G2hUPmR9NDqenefNJwVtlisMjzymPiQ==} + engines: {node: '>= 18'} + + '@octokit/auth-token@4.0.0': + resolution: {integrity: sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==} + engines: {node: '>= 18'} + + '@octokit/core@5.2.0': + resolution: {integrity: sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==} + engines: {node: '>= 18'} + + '@octokit/endpoint@9.0.5': + resolution: {integrity: sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==} + engines: {node: '>= 18'} + + '@octokit/graphql@7.1.0': + resolution: {integrity: sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==} + engines: {node: '>= 18'} + + '@octokit/openapi-types@20.0.0': + resolution: {integrity: sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==} + + '@octokit/openapi-types@22.2.0': + resolution: {integrity: sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==} + + '@octokit/plugin-paginate-rest@9.2.1': + resolution: {integrity: sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==} + engines: {node: '>= 18'} + peerDependencies: + '@octokit/core': '5' + + '@octokit/plugin-rest-endpoint-methods@10.4.1': + resolution: {integrity: sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==} + engines: {node: '>= 18'} + peerDependencies: + '@octokit/core': '5' + + '@octokit/request-error@5.1.0': + resolution: {integrity: sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==} + engines: {node: '>= 18'} + + '@octokit/request@8.4.0': + resolution: {integrity: sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==} + engines: {node: '>= 18'} + + '@octokit/types@12.6.0': + resolution: {integrity: sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==} + + '@octokit/types@13.5.0': + resolution: {integrity: sha512-HdqWTf5Z3qwDVlzCrP8UJquMwunpDiMPt5er+QjGzL4hqr/vBVY/MauQgS1xWxCDT1oMx1EULyqxncdCY/NVSQ==} + '@pkgjs/parseargs@0.11.0': resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} @@ -1742,6 +1805,9 @@ packages: balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + before-after-hook@2.2.3: + resolution: {integrity: sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==} + better-path-resolve@1.0.0: resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==} engines: {node: '>=4'} @@ -1783,6 +1849,9 @@ packages: resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} engines: {node: '>= 0.4'} + call-me-maybe@1.0.2: + resolution: {integrity: sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==} + camelcase-css@2.0.1: resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==} engines: {node: '>= 6'} @@ -1941,6 +2010,9 @@ packages: compute-scroll-into-view@3.1.0: resolution: {integrity: sha512-rj8l8pD4bJ1nx+dAkMhV1xB5RuZEyVysfxJqB1pRchh1KVvwOv9b7CGB8ZfjTImVv2oF+sYMUkMZq6Na5Ftmbg==} + confbox@0.1.7: + resolution: {integrity: sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==} + cross-spawn@5.1.0: resolution: {integrity: sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==} @@ -2032,6 +2104,10 @@ packages: decode-named-character-reference@1.0.2: resolution: {integrity: sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==} + decode-uri-component@0.4.1: + resolution: {integrity: sha512-+8VxcR21HhTy8nOt6jf20w0c9CADrw1O8d+VZ/YzzCt4bJ3uBjw+D1q2osAB8RnpwwaeYBxy0HyKQxD5JBMuuQ==} + engines: {node: '>=14.16'} + deep-eql@5.0.2: resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} engines: {node: '>=6'} @@ -2051,6 +2127,9 @@ packages: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} engines: {node: '>= 0.4'} + deprecation@2.3.1: + resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==} + dequal@2.0.3: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} @@ -2066,6 +2145,10 @@ packages: detect-node-es@1.1.0: resolution: {integrity: sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==} + detect-package-manager@3.0.2: + resolution: {integrity: sha512-8JFjJHutStYrfWwzfretQoyNGoZVW1Fsrp4JO9spa7h/fBfwgTMEIy4/LBzRDGsxwVPHU0q+T9YvwLDJoOApLQ==} + engines: {node: '>=12'} + devlop@1.1.0: resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} @@ -2214,6 +2297,10 @@ packages: estree-walker@3.0.3: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + execa@5.1.1: + resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} + engines: {node: '>=10'} + execa@8.0.1: resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} engines: {node: '>=16.17'} @@ -2246,6 +2333,10 @@ packages: resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} engines: {node: '>=8'} + filter-obj@5.1.0: + resolution: {integrity: sha512-qWeTREPoT7I0bifpPUXtxkZJ1XJzxWtfoWWkdVGqa+eCr3SHW/Ocp89o8vLvbUuQnadybJpjOKu4V+RwO6sGng==} + engines: {node: '>=14.16'} + find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} @@ -2314,6 +2405,10 @@ packages: resolution: {integrity: sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==} engines: {node: '>=6'} + get-stream@6.0.1: + resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} + engines: {node: '>=10'} + get-stream@8.0.1: resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} engines: {node: '>=16'} @@ -2445,6 +2540,10 @@ packages: human-id@1.0.2: resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==} + human-signals@2.1.0: + resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} + engines: {node: '>=10.17.0'} + human-signals@5.0.0: resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} engines: {node: '>=16.17.0'} @@ -2457,6 +2556,10 @@ packages: resolution: {integrity: sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==} engines: {node: '>= 4'} + ignore@5.3.2: + resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} + engines: {node: '>= 4'} + image-size@1.1.1: resolution: {integrity: sha512-541xKlUw6jr/6gGuk92F+mYM5zaFAc5ahphvkqvNe2bQ6gVBkd6bfrmVJ2t4KDAfikAYZyIqTnktX3i6/aQDrQ==} engines: {node: '>=16.x'} @@ -2591,6 +2694,10 @@ packages: resolution: {integrity: sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==} engines: {node: '>= 0.4'} + is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + is-stream@3.0.0: resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -2625,6 +2732,10 @@ packages: isarray@2.0.5: resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} + isbinaryfile@5.0.2: + resolution: {integrity: sha512-GvcjojwonMjWbTkfMpnVHVqXW/wKMYDfEpY94/8zy8HFMOqb/VL6oeONq9v87q4ttVlaTLnGXnJD4B5B1OTGIg==} + engines: {node: '>= 18.0.0'} + isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} @@ -2934,6 +3045,10 @@ packages: resolution: {integrity: sha512-ryBDp1Z/6X90UvjUK3RksH0IBPM137T7cmg4OgD5wQBojlAiUwuok0QeELkim/72EtcYuNlmbkrcGuxj3Kl0YQ==} engines: {node: '>= 0.6'} + mimic-fn@2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + mimic-fn@4.0.0: resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} engines: {node: '>=12'} @@ -2965,6 +3080,9 @@ packages: resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} hasBin: true + mlly@1.7.1: + resolution: {integrity: sha512-rrVRZRELyQzrIUAVMHxP97kv+G786pHmOKzuFII8zDYahFBS7qnHh2AlYSl1GAHhaMPCz6/oHjVMcfFYgFYHgA==} + mrmime@2.0.0: resolution: {integrity: sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==} engines: {node: '>=10'} @@ -3043,6 +3161,10 @@ packages: resolution: {integrity: sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==} engines: {node: '>=0.10.0'} + npm-run-path@4.0.1: + resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} + engines: {node: '>=8'} + npm-run-path@5.2.0: resolution: {integrity: sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -3077,6 +3199,13 @@ packages: resolution: {integrity: sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==} engines: {node: '>= 0.4'} + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + onetime@5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} + onetime@6.0.0: resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} engines: {node: '>=12'} @@ -3194,6 +3323,13 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} + pkg-pr-new@0.0.20: + resolution: {integrity: sha512-nzTm/c1R5pXKwHW0mkN2FnkHrqW3D29LGAcAYkK28G9n/c8aJEIrb7TAieNV1HPrO9XEj0Z7IHAsKpcsSxO+Pw==} + hasBin: true + + pkg-types@1.2.0: + resolution: {integrity: sha512-+ifYuSSqOQ8CqP4MbZA5hDpb97n3E8SVWdJe+Wms9kj745lmd3b7EZJiqvmLwAlmRfjrI7Hi5z3kdBJ93lFNPA==} + possible-typed-array-names@1.0.0: resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} engines: {node: '>= 0.4'} @@ -3275,6 +3411,14 @@ packages: (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) + query-registry@3.0.1: + resolution: {integrity: sha512-M9RxRITi2mHMVPU5zysNjctUT8bAPx6ltEXo/ir9+qmiM47Y7f0Ir3+OxUO5OjYAWdicBQRew7RtHtqUXydqlg==} + engines: {node: '>=20'} + + query-string@9.1.0: + resolution: {integrity: sha512-t6dqMECpCkqfyv2FfwVS1xcB6lgXW/0XZSaKdsCNGYkqMO76AFiJEg4vINzoDKcZa6MS7JX+OHIjwh06K5vczw==} + engines: {node: '>=18'} + queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -3285,6 +3429,10 @@ packages: resolution: {integrity: sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==} engines: {node: '>=8'} + quick-lru@7.0.0: + resolution: {integrity: sha512-MX8gB7cVYTrYcFfAnfLlhRd0+Toyl8yX8uBx1MrX7K0jegiz9TumwOK27ldXrgDlHRdVi+MqU9Ssw6dr4BNreg==} + engines: {node: '>=18'} + react-dom@18.2.0: resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==} peerDependencies: @@ -3614,6 +3762,10 @@ packages: spdx-license-ids@3.0.16: resolution: {integrity: sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw==} + split-on-first@3.0.0: + resolution: {integrity: sha512-qxQJTx2ryR0Dw0ITYyekNQWpz6f8dGd7vffGNflQQ3Iqj9NJ6qiZ7ELpZsJ/QBhIVAiDfXdag3+Gp8RvWa62AA==} + engines: {node: '>=12'} + sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} @@ -3634,6 +3786,10 @@ packages: resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} engines: {node: '>=10.0.0'} + string-argv@0.3.2: + resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==} + engines: {node: '>=0.6.19'} + string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -3682,6 +3838,10 @@ packages: resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} engines: {node: '>=4'} + strip-final-newline@2.0.0: + resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} + engines: {node: '>=6'} + strip-final-newline@3.0.0: resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} engines: {node: '>=12'} @@ -3863,6 +4023,10 @@ packages: peerDependencies: typescript: '*' + type-detect@4.1.0: + resolution: {integrity: sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==} + engines: {node: '>=4'} + type-fest@0.13.1: resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==} engines: {node: '>=10'} @@ -3911,12 +4075,19 @@ packages: engines: {node: '>=14.17'} hasBin: true + ufo@1.5.4: + resolution: {integrity: sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==} + unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + undici@6.19.8: + resolution: {integrity: sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==} + engines: {node: '>=18.17'} + unicode-emoji-modifier-base@1.0.0: resolution: {integrity: sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==} engines: {node: '>=4'} @@ -3954,6 +4125,9 @@ packages: unist-util-visit@5.0.0: resolution: {integrity: sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==} + universal-user-agent@6.0.1: + resolution: {integrity: sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==} + universalify@0.1.2: resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} engines: {node: '>= 4.0.0'} @@ -3967,6 +4141,10 @@ packages: peerDependencies: browserslist: '>= 4.21.0' + url-join@5.0.0: + resolution: {integrity: sha512-n2huDr9h9yzd6exQVnH/jU5mr+Pfx08LRXXZhkLLetAMESRj+anQsTAh940iMrIetKAmry9coFuZQ2jY8/p3WA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + use-callback-ref@1.3.1: resolution: {integrity: sha512-Lg4Vx1XZQauB42Hw3kK7JM6yjVjgFmFC5/Ab797s79aARomD2nEErc4mCgM8EZrARLmmbWpi5DGCadmK50DcAQ==} engines: {node: '>=10'} @@ -4128,6 +4306,9 @@ packages: resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} engines: {node: '>=12'} + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + xml@1.0.1: resolution: {integrity: sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==} @@ -4176,9 +4357,16 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + zod-package-json@1.0.3: + resolution: {integrity: sha512-Mb6GzuRyUEl8X+6V6xzHbd4XV0au/4gOYrYP+CAfHL32uPmGswES+v2YqonZiW1NZWVA3jkssCKSU2knonm/aQ==} + engines: {node: '>=20'} + zod@3.22.4: resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==} + zod@3.23.8: + resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} + zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} @@ -4596,6 +4784,13 @@ snapshots: '@jridgewell/resolve-uri': 3.1.1 '@jridgewell/sourcemap-codec': 1.4.15 + '@jsdevtools/ez-spawn@3.0.4': + dependencies: + call-me-maybe: 1.0.2 + cross-spawn: 7.0.3 + string-argv: 0.3.2 + type-detect: 4.1.0 + '@manypkg/find-root@1.1.0': dependencies: '@babel/runtime': 7.23.7 @@ -4681,6 +4876,78 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.16.0 + '@octokit/action@6.1.0': + dependencies: + '@octokit/auth-action': 4.1.0 + '@octokit/core': 5.2.0 + '@octokit/plugin-paginate-rest': 9.2.1(@octokit/core@5.2.0) + '@octokit/plugin-rest-endpoint-methods': 10.4.1(@octokit/core@5.2.0) + '@octokit/types': 12.6.0 + undici: 6.19.8 + + '@octokit/auth-action@4.1.0': + dependencies: + '@octokit/auth-token': 4.0.0 + '@octokit/types': 13.5.0 + + '@octokit/auth-token@4.0.0': {} + + '@octokit/core@5.2.0': + dependencies: + '@octokit/auth-token': 4.0.0 + '@octokit/graphql': 7.1.0 + '@octokit/request': 8.4.0 + '@octokit/request-error': 5.1.0 + '@octokit/types': 13.5.0 + before-after-hook: 2.2.3 + universal-user-agent: 6.0.1 + + '@octokit/endpoint@9.0.5': + dependencies: + '@octokit/types': 13.5.0 + universal-user-agent: 6.0.1 + + '@octokit/graphql@7.1.0': + dependencies: + '@octokit/request': 8.4.0 + '@octokit/types': 13.5.0 + universal-user-agent: 6.0.1 + + '@octokit/openapi-types@20.0.0': {} + + '@octokit/openapi-types@22.2.0': {} + + '@octokit/plugin-paginate-rest@9.2.1(@octokit/core@5.2.0)': + dependencies: + '@octokit/core': 5.2.0 + '@octokit/types': 12.6.0 + + '@octokit/plugin-rest-endpoint-methods@10.4.1(@octokit/core@5.2.0)': + dependencies: + '@octokit/core': 5.2.0 + '@octokit/types': 12.6.0 + + '@octokit/request-error@5.1.0': + dependencies: + '@octokit/types': 13.5.0 + deprecation: 2.3.1 + once: 1.4.0 + + '@octokit/request@8.4.0': + dependencies: + '@octokit/endpoint': 9.0.5 + '@octokit/request-error': 5.1.0 + '@octokit/types': 13.5.0 + universal-user-agent: 6.0.1 + + '@octokit/types@12.6.0': + dependencies: + '@octokit/openapi-types': 20.0.0 + + '@octokit/types@13.5.0': + dependencies: + '@octokit/openapi-types': 22.2.0 + '@pkgjs/parseargs@0.11.0': optional: true @@ -5773,6 +6040,8 @@ snapshots: balanced-match@1.0.2: {} + before-after-hook@2.2.3: {} + better-path-resolve@1.0.0: dependencies: is-windows: 1.0.2 @@ -5817,6 +6086,8 @@ snapshots: get-intrinsic: 1.2.4 set-function-length: 1.2.2 + call-me-maybe@1.0.2: {} + camelcase-css@2.0.1: {} camelcase-keys@6.2.2: @@ -5979,6 +6250,8 @@ snapshots: compute-scroll-into-view@3.1.0: {} + confbox@0.1.7: {} + cross-spawn@5.1.0: dependencies: lru-cache: 4.1.5 @@ -6070,6 +6343,8 @@ snapshots: dependencies: character-entities: 2.0.2 + decode-uri-component@0.4.1: {} + deep-eql@5.0.2: {} defaults@1.0.4: @@ -6094,6 +6369,8 @@ snapshots: has-property-descriptors: 1.0.1 object-keys: 1.1.1 + deprecation@2.3.1: {} + dequal@2.0.3: {} detect-indent@6.1.0: {} @@ -6102,6 +6379,10 @@ snapshots: detect-node-es@1.1.0: {} + detect-package-manager@3.0.2: + dependencies: + execa: 5.1.1 + devlop@1.1.0: dependencies: dequal: 2.0.3 @@ -6349,6 +6630,18 @@ snapshots: dependencies: '@types/estree': 1.0.5 + execa@5.1.1: + dependencies: + cross-spawn: 7.0.3 + get-stream: 6.0.1 + human-signals: 2.1.0 + is-stream: 2.0.1 + merge-stream: 2.0.0 + npm-run-path: 4.0.1 + onetime: 5.1.2 + signal-exit: 3.0.7 + strip-final-newline: 2.0.0 + execa@8.0.1: dependencies: cross-spawn: 7.0.3 @@ -6393,6 +6686,8 @@ snapshots: dependencies: to-regex-range: 5.0.1 + filter-obj@5.1.0: {} + find-up@4.1.0: dependencies: locate-path: 5.0.0 @@ -6467,6 +6762,8 @@ snapshots: get-nonce@1.0.1: {} + get-stream@6.0.1: {} + get-stream@8.0.1: {} get-symbol-description@1.0.0: @@ -6651,6 +6948,8 @@ snapshots: human-id@1.0.2: {} + human-signals@2.1.0: {} + human-signals@5.0.0: {} iconv-lite@0.4.24: @@ -6659,6 +6958,8 @@ snapshots: ignore@5.3.0: {} + ignore@5.3.2: {} + image-size@1.1.1: dependencies: queue: 6.0.2 @@ -6781,6 +7082,8 @@ snapshots: dependencies: call-bind: 1.0.7 + is-stream@2.0.1: {} + is-stream@3.0.0: {} is-string@1.0.7: @@ -6811,6 +7114,8 @@ snapshots: isarray@2.0.5: {} + isbinaryfile@5.0.2: {} + isexe@2.0.0: {} jackspeak@2.3.6: @@ -7379,6 +7684,8 @@ snapshots: dependencies: mime-db: 1.25.0 + mimic-fn@2.1.0: {} + mimic-fn@4.0.0: {} min-indent@1.0.1: {} @@ -7403,6 +7710,13 @@ snapshots: dependencies: minimist: 1.2.8 + mlly@1.7.1: + dependencies: + acorn: 8.11.3 + pathe: 1.1.2 + pkg-types: 1.2.0 + ufo: 1.5.4 + mrmime@2.0.0: {} ms@2.1.2: {} @@ -7536,6 +7850,10 @@ snapshots: normalize-range@0.1.2: {} + npm-run-path@4.0.1: + dependencies: + path-key: 3.1.1 + npm-run-path@5.2.0: dependencies: path-key: 4.0.0 @@ -7575,6 +7893,14 @@ snapshots: define-properties: 1.2.1 es-object-atoms: 1.0.0 + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + onetime@5.1.2: + dependencies: + mimic-fn: 2.1.0 + onetime@6.0.0: dependencies: mimic-fn: 4.0.0 @@ -7678,6 +8004,23 @@ snapshots: dependencies: find-up: 4.1.0 + pkg-pr-new@0.0.20: + dependencies: + '@jsdevtools/ez-spawn': 3.0.4 + '@octokit/action': 6.1.0 + detect-package-manager: 3.0.2 + fast-glob: 3.3.2 + ignore: 5.3.2 + isbinaryfile: 5.0.2 + pkg-types: 1.2.0 + query-registry: 3.0.1 + + pkg-types@1.2.0: + dependencies: + confbox: 0.1.7 + mlly: 1.7.1 + pathe: 1.1.2 + possible-typed-array-names@1.0.0: {} postcss-import@15.1.0(postcss@8.4.32): @@ -7745,6 +8088,21 @@ snapshots: q@1.5.1: {} + query-registry@3.0.1: + dependencies: + query-string: 9.1.0 + quick-lru: 7.0.0 + url-join: 5.0.0 + validate-npm-package-name: 5.0.1 + zod: 3.23.8 + zod-package-json: 1.0.3 + + query-string@9.1.0: + dependencies: + decode-uri-component: 0.4.1 + filter-obj: 5.1.0 + split-on-first: 3.0.0 + queue-microtask@1.2.3: {} queue@6.0.2: @@ -7753,6 +8111,8 @@ snapshots: quick-lru@4.0.1: {} + quick-lru@7.0.0: {} + react-dom@18.2.0(react@18.2.0): dependencies: loose-envify: 1.4.0 @@ -8183,6 +8543,8 @@ snapshots: spdx-license-ids@3.0.16: {} + split-on-first@3.0.0: {} + sprintf-js@1.0.3: {} stable@0.1.8: {} @@ -8197,6 +8559,8 @@ snapshots: streamsearch@1.1.0: {} + string-argv@0.3.2: {} + string-width@4.2.3: dependencies: emoji-regex: 8.0.0 @@ -8263,6 +8627,8 @@ snapshots: strip-bom@3.0.0: {} + strip-final-newline@2.0.0: {} + strip-final-newline@3.0.0: {} strip-indent@3.0.0: @@ -8459,6 +8825,8 @@ snapshots: transitivePeerDependencies: - supports-color + type-detect@4.1.0: {} + type-fest@0.13.1: {} type-fest@0.6.0: {} @@ -8526,6 +8894,8 @@ snapshots: typescript@5.3.3: {} + ufo@1.5.4: {} + unbox-primitive@1.0.2: dependencies: call-bind: 1.0.7 @@ -8535,6 +8905,8 @@ snapshots: undici-types@5.26.5: {} + undici@6.19.8: {} + unicode-emoji-modifier-base@1.0.0: {} unified@11.0.4: @@ -8594,6 +8966,8 @@ snapshots: unist-util-is: 6.0.0 unist-util-visit-parents: 6.0.1 + universal-user-agent@6.0.1: {} + universalify@0.1.2: {} unquote@1.1.1: {} @@ -8604,6 +8978,8 @@ snapshots: escalade: 3.1.1 picocolors: 1.0.0 + url-join@5.0.0: {} + use-callback-ref@1.3.1(@types/react@18.2.48)(react@18.2.0): dependencies: react: 18.2.0 @@ -8792,6 +9168,8 @@ snapshots: string-width: 5.1.2 strip-ansi: 7.1.0 + wrappy@1.0.2: {} + xml@1.0.1: {} y18n@4.0.3: {} @@ -8849,6 +9227,12 @@ snapshots: yocto-queue@0.1.0: {} + zod-package-json@1.0.3: + dependencies: + zod: 3.23.8 + zod@3.22.4: {} + zod@3.23.8: {} + zwitch@2.0.4: {} From af896e897c23e0a13622062f80217121b4f22bb0 Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Thu, 29 Aug 2024 16:31:33 +0200 Subject: [PATCH 04/12] Remove stackblitz link --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc19852b..2f947e8f 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "changeset": "changeset", "version-packages": "changeset version", "release": "changeset publish", - "prerelease": "pkg-pr-new publish --compact './packages/codehike'" + "prerelease": "pkg-pr-new publish --no-template --compact './packages/codehike'" }, "devDependencies": { "@changesets/cli": "2.27.1", From ead378ea46fedc16ca6b9e1cec6fe0c0cf99090f Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Thu, 29 Aug 2024 16:38:29 +0200 Subject: [PATCH 05/12] Add changeset --- .changeset/lovely-houses-rule.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lovely-houses-rule.md diff --git a/.changeset/lovely-houses-rule.md b/.changeset/lovely-houses-rule.md new file mode 100644 index 00000000..9faa6bb9 --- /dev/null +++ b/.changeset/lovely-houses-rule.md @@ -0,0 +1,5 @@ +--- +"codehike": patch +--- + +Fix `jsxDEV` warning From 2ecb69218566ec4dbcf555ed741e4a6d3adbe221 Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Fri, 30 Aug 2024 12:38:25 +0200 Subject: [PATCH 06/12] Use type wildcards for moduleResolution node compatibility --- packages/codehike/package.json | 16 ++++++++++++---- .../codehike/src/{code/index.tsx => code.tsx} | 8 ++++---- 2 files changed, 16 insertions(+), 8 deletions(-) rename packages/codehike/src/{code/index.tsx => code.tsx} (79%) diff --git a/packages/codehike/package.json b/packages/codehike/package.json index 68163083..80bb7699 100644 --- a/packages/codehike/package.json +++ b/packages/codehike/package.json @@ -23,19 +23,27 @@ "type": "github", "url": "https://github.com/sponsors/code-hike" }, + "files": [ + "dist/**" + ], "exports": { "./package.json": "./package.json", ".": "./dist/index.js", "./mdx": "./dist/mdx.js", "./blocks": "./dist/blocks.js", - "./code": "./dist/code/index.js", + "./code": "./dist/code.js", "./utils/token-transitions": "./dist/utils/token-transitions.js", "./utils/static-fallback": "./dist/utils/static-fallback.js", "./utils/selection": "./dist/utils/selection.js" }, - "files": [ - "dist/**" - ], + "types": "index.d.ts", + "typesVersions": { + "*": { + "*": [ + "dist/*" + ] + } + }, "scripts": { "build": "tsc -p . ", "dev": "tsc -p . --watch", diff --git a/packages/codehike/src/code/index.tsx b/packages/codehike/src/code.tsx similarity index 79% rename from packages/codehike/src/code/index.tsx rename to packages/codehike/src/code.tsx index 57c462ed..13ae9aa5 100644 --- a/packages/codehike/src/code/index.tsx +++ b/packages/codehike/src/code.tsx @@ -16,11 +16,11 @@ import type { CustomToken, CustomTokenWithAnnotation, InlineProps, -} from "./types.js" +} from "./code/types.js" -import { highlight } from "./highlight.js" -import { Pre, Inline } from "./pre.js" -import { InnerPre, getPreRef, InnerLine, InnerToken } from "./inner.js" +import { highlight } from "./code/highlight.js" +import { Pre, Inline } from "./code/pre.js" +import { InnerPre, getPreRef, InnerLine, InnerToken } from "./code/inner.js" export type { RawCode, From bed14e3d330f8ed661d2fedce911b3d669eebeb2 Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Fri, 30 Aug 2024 13:26:48 +0200 Subject: [PATCH 07/12] Add changeset --- .changeset/violet-insects-melt.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/violet-insects-melt.md diff --git a/.changeset/violet-insects-melt.md b/.changeset/violet-insects-melt.md new file mode 100644 index 00000000..26a14048 --- /dev/null +++ b/.changeset/violet-insects-melt.md @@ -0,0 +1,5 @@ +--- +"codehike": patch +--- + +Compatibility with ts `moduleResolution: node`, fix #437 From a3c0ff7bcfa51a3e36b52a5b8a4a0e9660cc1bf3 Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Fri, 30 Aug 2024 13:35:07 +0200 Subject: [PATCH 08/12] Add `onlyIfAnnotated` to focus example --- .changeset/lovely-houses-rule.md | 2 +- .changeset/violet-insects-melt.md | 2 +- apps/web/content/docs/code/focus.mdx | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.changeset/lovely-houses-rule.md b/.changeset/lovely-houses-rule.md index 9faa6bb9..97e0a018 100644 --- a/.changeset/lovely-houses-rule.md +++ b/.changeset/lovely-houses-rule.md @@ -2,4 +2,4 @@ "codehike": patch --- -Fix `jsxDEV` warning +Better use of `jsxDEV` when children aren't static, fix #433 in #435 diff --git a/.changeset/violet-insects-melt.md b/.changeset/violet-insects-melt.md index 26a14048..c641fcdd 100644 --- a/.changeset/violet-insects-melt.md +++ b/.changeset/violet-insects-melt.md @@ -2,4 +2,4 @@ "codehike": patch --- -Compatibility with ts `moduleResolution: node`, fix #437 +Compatibility with ts `moduleResolution: node`, fix #437 in #441 diff --git a/apps/web/content/docs/code/focus.mdx b/apps/web/content/docs/code/focus.mdx index babfec1b..93f74254 100644 --- a/apps/web/content/docs/code/focus.mdx +++ b/apps/web/content/docs/code/focus.mdx @@ -33,6 +33,7 @@ import React, { useLayoutEffect, useRef } from "react" export const focus: AnnotationHandler = { name: "focus", + onlyIfAnnotated: true, PreWithRef: (props) => { const ref = getPreRef(props) useScrollToFocus(ref) From 0833bbfa1b9e90efc65f97315f80600078dcba14 Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Fri, 30 Aug 2024 13:58:58 +0200 Subject: [PATCH 09/12] v1.0.1 --- .changeset/config.json | 5 +- .changeset/lovely-houses-rule.md | 5 - .changeset/violet-insects-melt.md | 5 - package.json | 1 + packages/codehike/changelog.md | 200 ++---------------------------- packages/codehike/package.json | 2 +- pnpm-lock.yaml | 66 ++++++++++ 7 files changed, 80 insertions(+), 204 deletions(-) delete mode 100644 .changeset/lovely-houses-rule.md delete mode 100644 .changeset/violet-insects-melt.md diff --git a/.changeset/config.json b/.changeset/config.json index 57d9fc76..7e4a7d0a 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,6 +1,9 @@ { "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json", - "changelog": "@changesets/cli/changelog", + "changelog": [ + "@changesets/changelog-github", + { "repo": "code-hike/codehike" } + ], "commit": false, "fixed": [], "linked": [], diff --git a/.changeset/lovely-houses-rule.md b/.changeset/lovely-houses-rule.md deleted file mode 100644 index 97e0a018..00000000 --- a/.changeset/lovely-houses-rule.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"codehike": patch ---- - -Better use of `jsxDEV` when children aren't static, fix #433 in #435 diff --git a/.changeset/violet-insects-melt.md b/.changeset/violet-insects-melt.md deleted file mode 100644 index c641fcdd..00000000 --- a/.changeset/violet-insects-melt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"codehike": patch ---- - -Compatibility with ts `moduleResolution: node`, fix #437 in #441 diff --git a/package.json b/package.json index 2f947e8f..2044a8a2 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ }, "devDependencies": { "@changesets/cli": "2.27.1", + "@changesets/changelog-github": "0.5.0", "prettier": "^3.1.1", "turbo": "^1.11.2", "pkg-pr-new": "0.0.20" diff --git a/packages/codehike/changelog.md b/packages/codehike/changelog.md index b98289c4..5220363c 100644 --- a/packages/codehike/changelog.md +++ b/packages/codehike/changelog.md @@ -1,202 +1,18 @@ # codehike -## 1.0.0 - -### Major Changes - -- Fine-grained Markdown -- Headless codeblocks - -See [the announcement blog post](https://codehike.org/blog/v1) for more details. - -## 1.0.0-beta.9 - -### Patch Changes - -- 594a5a6: Tabs indentation - -## 1.0.0-beta.8 - -### Minor Changes - -- 614b36c: Add inline code component and plugin - -### Patch Changes - -- 132d6ef: Support consecutive lines of imgs and values - -## 1.0.0-beta.7 - -### Patch Changes - -- ea9312f: Fix empty lines at the start of codeblock -- bf4c22f: Make parse independent of zod - -## 1.0.0-beta.6 - -### Patch Changes - -- eed5e28: Replace code element with div - -## 1.0.0-beta.5 - -### Minor Changes - -- Update lighter - -## 1.0.0-beta.4 - -### Minor Changes - -- 31bfd50: Add code element to Pre component - -## 1.0.0-beta.3 - -### Minor Changes - -- a522ada: Improve annotation stacking - -## 1.0.0-beta.2 - -### Patch Changes - -- 5d9a9f7: Fix annotation detection for some languages - -## 1.0.0-beta.1 - -### Minor Changes - -- f26b8c4: Add totalLines - -## 1.0.0-alpha.21 - -### Minor Changes - -- 218c6e2: Change annotation components layout - -## 1.0.0-alpha.20 - -### Patch Changes - -- 3032936: Move selection utils - -## 1.0.0-alpha.19 - -### Patch Changes - -- d4d5c01: Add token transitions helper - -## 1.0.0-alpha.18 - -### Patch Changes - -- 09f9094: Add static fallback - -## 1.0.0-alpha.17 - -### Patch Changes - -- Add component blocks - -## 1.0.0-alpha.16 - -### Patch Changes - -- Fix highlighted schema - -## 1.0.0-alpha.15 - -### Patch Changes - -- 33f0b11: Add ignoreCode to config -- 169ec88: Add remark syntax highlighting for non-rsc - -## 1.0.0-alpha.14 - -### Patch Changes - -- b9e3021: Add non-RSC config - -## 1.0.0-alpha.13 - -### Minor Changes - -- 3f36591: Blocks API - -## 1.0.0-alpha.12 - -### Minor Changes - -- Rename query and steps - -## 1.0.0-alpha.11 - -### Patch Changes - -- Fix Image schema - -## 1.0.0-alpha.10 - -### Patch Changes - -- Fix parse type - -## 1.0.0-alpha.9 - -### Patch Changes - -- Add parseContent - -## 1.0.0-alpha.8 +## 1.0.1 ### Patch Changes -- Add schemas +- [#435](https://github.com/code-hike/codehike/pull/435) [`ead378e`](https://github.com/code-hike/codehike/commit/ead378ea46fedc16ca6b9e1cec6fe0c0cf99090f) Thanks [@pomber](https://github.com/pomber)! - Better use of `jsxDEV` when children aren't static -## 1.0.0-alpha.7 +- [#441](https://github.com/code-hike/codehike/pull/441) [`bed14e3`](https://github.com/code-hike/codehike/commit/bed14e3d330f8ed661d2fedce911b3d669eebeb2) Thanks [@pomber](https://github.com/pomber)! - Compatibility with ts `moduleResolution: node` -### Patch Changes - -- From annotation in remark - -## 1.0.0-alpha.6 - -### Patch Changes - -- Rename getHike to getBlocks - -## 1.0.0-alpha.5 - -### Minor Changes - -- New hike syntax - -## 1.0.0-alpha.4 - -### Patch Changes - -- Export getHike - -## 1.0.0-alpha.3 - -### Patch Changes - -- Make className optional - -## 1.0.0-alpha.2 - -### Minor Changes - -- Steps with multiple elements - -## 1.0.0-alpha.1 - -### Patch Changes - -- Add click handler to ScrollyStep - -## 1.0.0-alpha.0 +## 1.0.0 ### Major Changes -- Init codehike +- Fine-grained Markdown +- Headless codeblocks + +See [the announcement blog post](https://codehike.org/blog/v1) for more details. diff --git a/packages/codehike/package.json b/packages/codehike/package.json index 80bb7699..e691cc29 100644 --- a/packages/codehike/package.json +++ b/packages/codehike/package.json @@ -1,6 +1,6 @@ { "name": "codehike", - "version": "1.0.0", + "version": "1.0.1", "description": "Build rich content websites with Markdown and React", "keywords": [ "react", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 215c6d8b..10a45101 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: devDependencies: + '@changesets/changelog-github': + specifier: 0.5.0 + version: 0.5.0 '@changesets/cli': specifier: 2.27.1 version: 2.27.1 @@ -262,6 +265,9 @@ packages: '@changesets/changelog-git@0.2.0': resolution: {integrity: sha512-bHOx97iFI4OClIT35Lok3sJAwM31VbUM++gnMBV16fdbtBhgYu4dxsphBF/0AZZsyAHMrnM0yFcj5gZM1py6uQ==} + '@changesets/changelog-github@0.5.0': + resolution: {integrity: sha512-zoeq2LJJVcPJcIotHRJEEA2qCqX0AQIeFE+L21L8sRLPVqDhSXY8ZWAt2sohtBpFZkBwu+LUwMSKRr2lMy3LJA==} + '@changesets/cli@2.27.1': resolution: {integrity: sha512-iJ91xlvRnnrJnELTp4eJJEOPjgpF3NOh4qeQehM6Ugiz9gJPRZ2t+TsXun6E3AMN4hScZKjqVXl0TX+C7AB3ZQ==} hasBin: true @@ -275,6 +281,9 @@ packages: '@changesets/get-dependents-graph@2.0.0': resolution: {integrity: sha512-cafUXponivK4vBgZ3yLu944mTvam06XEn2IZGjjKc0antpenkYANXiiE6GExV/yKdsCnE8dXVZ25yGqLYZmScA==} + '@changesets/get-github-info@0.6.0': + resolution: {integrity: sha512-v/TSnFVXI8vzX9/w3DU2Ol+UlTZcu3m0kXTjTT4KlAdwSvwutcByYwyYn9hwerPWfPkT2JfpoX0KgvCEi8Q/SA==} + '@changesets/get-release-plan@4.0.0': resolution: {integrity: sha512-9L9xCUeD/Tb6L/oKmpm8nyzsOzhdNBBbt/ZNcjynbHC07WW4E1eX8NMGC5g5SbM5z/V+MOrYsJ4lRW41GCbg3w==} @@ -2078,6 +2087,9 @@ packages: resolution: {integrity: sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==} engines: {node: '>= 0.4'} + dataloader@1.4.0: + resolution: {integrity: sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw==} + debug@4.3.4: resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -2185,6 +2197,10 @@ packages: resolution: {integrity: sha512-CjA3y+Dr3FyFDOAMnxZEGtnW9KBR2M0JvvUtXNW+dYJL5ROWxP9DUHCwgFqpMk0OXCc0ljhaNTr2w/kutYIcHQ==} engines: {node: '>=12'} + dotenv@8.6.0: + resolution: {integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==} + engines: {node: '>=10'} + eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} @@ -3150,6 +3166,15 @@ packages: resolution: {integrity: sha512-E2WEOVsgs7O16zsURJ/eH8BqhF029wGpEOnv7Urwdo2wmQanOACwJQh0devF9D9RhoZru0+9JXIS0dBXIAz+lA==} engines: {node: '>=18'} + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + node-releases@2.0.14: resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} @@ -3960,6 +3985,9 @@ packages: resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} engines: {node: '>=6'} + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} @@ -4265,6 +4293,12 @@ packages: web-namespaces@2.0.1: resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==} + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + which-boxed-primitive@1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} @@ -4449,6 +4483,14 @@ snapshots: dependencies: '@changesets/types': 6.0.0 + '@changesets/changelog-github@0.5.0': + dependencies: + '@changesets/get-github-info': 0.6.0 + '@changesets/types': 6.0.0 + dotenv: 8.6.0 + transitivePeerDependencies: + - encoding + '@changesets/cli@2.27.1': dependencies: '@babel/runtime': 7.23.7 @@ -4506,6 +4548,13 @@ snapshots: fs-extra: 7.0.1 semver: 7.5.4 + '@changesets/get-github-info@0.6.0': + dependencies: + dataloader: 1.4.0 + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + '@changesets/get-release-plan@4.0.0': dependencies: '@babel/runtime': 7.23.7 @@ -6327,6 +6376,8 @@ snapshots: es-errors: 1.3.0 is-data-view: 1.0.1 + dataloader@1.4.0: {} + debug@4.3.4: dependencies: ms: 2.1.2 @@ -6416,6 +6467,8 @@ snapshots: dotenv@16.4.1: {} + dotenv@8.6.0: {} + eastasianwidth@0.2.0: {} electron-to-chromium@1.4.616: {} @@ -7840,6 +7893,10 @@ snapshots: emojilib: 2.4.0 skin-tone: 2.0.0 + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + node-releases@2.0.14: {} normalize-package-data@2.5.0: @@ -8769,6 +8826,8 @@ snapshots: totalist@3.0.1: {} + tr46@0.0.3: {} + trim-lines@3.0.1: {} trim-newlines@3.0.1: {} @@ -9109,6 +9168,13 @@ snapshots: web-namespaces@2.0.1: {} + webidl-conversions@3.0.1: {} + + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + which-boxed-primitive@1.0.2: dependencies: is-bigint: 1.0.4 From 0c78b890be6d1aee36d4984a1bbb4667d90c9721 Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Fri, 30 Aug 2024 14:01:54 +0200 Subject: [PATCH 10/12] Add link to v0 website --- apps/web/content/blog/v1-migration.mdx | 51 ++++++++++++++------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/apps/web/content/blog/v1-migration.mdx b/apps/web/content/blog/v1-migration.mdx index eb4877a1..e94d1ab6 100644 --- a/apps/web/content/blog/v1-migration.mdx +++ b/apps/web/content/blog/v1-migration.mdx @@ -110,30 +110,33 @@ Instead of "use-v1", you can use any string. Just make sure it's easy to find an Here's the equivalent features between v0 and v1, they aren't exactly the same, but they are similar: -| | v0 | v1 | -| -------------------- | ---------------- | ------------------- | -| Package name | `@code-hike/mdx` | `codehike` | -| Line numbers | [Config][1] | [Example][21] | -| Copy button | [Config][2] | [Example][22] | -| Themes | [Config][3] | [Config][23] | -| Skip languages | [Config][4] | [Config][24] | -| Static components | [Config][5] | [Media queries][25] | -| Auto import | [Config][6] | Not needed | -| Auto link | [Config][7] | [Example][26] | -| Codeblock filename | [Directive][8] | [Example][27] | -| `focus` | [Annotation][9] | [Example][28] | -| `mark` | [Annotation][10] | [Example][29] | -| `withClass` | [Annotation][11] | [Example][30] | -| `link` | [Annotation][12] | [Example][31] | -| `from` | [Annotation][13] | [Syntax][32] | -| `` Tabs | [Component][14] | [Example][33] | -| `` Panels | [Component][15] | - | -| Inline code | [Syntax][16] | [Syntax][35] | -| Code mentions | [Syntax][17] | [Example][36] | -| `` | [Component][18] | [Example][37] | -| `` | [Component][19] | [Example][38] | -| `` | [Component][20] | [Example][39] | - +| | v0 | v1 | +| -------------------- | -------------------------- | ----------------------- | +| Docs | [v0.codehike.org/docs][50] | [codehike.org/docs][51] | +| Package name | `@code-hike/mdx` | `codehike` | +| Line numbers | [Config][1] | [Example][21] | +| Copy button | [Config][2] | [Example][22] | +| Themes | [Config][3] | [Config][23] | +| Skip languages | [Config][4] | [Config][24] | +| Static components | [Config][5] | [Media queries][25] | +| Auto import | [Config][6] | Not needed | +| Auto link | [Config][7] | [Example][26] | +| Codeblock filename | [Directive][8] | [Example][27] | +| `focus` | [Annotation][9] | [Example][28] | +| `mark` | [Annotation][10] | [Example][29] | +| `withClass` | [Annotation][11] | [Example][30] | +| `link` | [Annotation][12] | [Example][31] | +| `from` | [Annotation][13] | [Syntax][32] | +| `` Tabs | [Component][14] | [Example][33] | +| `` Panels | [Component][15] | - | +| Inline code | [Syntax][16] | [Syntax][35] | +| Code mentions | [Syntax][17] | [Example][36] | +| `` | [Component][18] | [Example][37] | +| `` | [Component][19] | [Example][38] | +| `` | [Component][20] | [Example][39] | + +[50]: https://v0.codehike.org/docs +[51]: https://codehike.org/docs [1]: https://v0.codehike.org/docs/configuration#line-numbers [2]: https://v0.codehike.org/docs/configuration#copy-button [3]: https://v0.codehike.org/docs/themes From ad748cb85505e90c9c78e5995b709c33d734230d Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Fri, 30 Aug 2024 14:27:16 +0200 Subject: [PATCH 11/12] Rename prerelease command --- .github/workflows/ci.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db2ea211..204f31df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,4 +25,4 @@ jobs: - name: Build run: pnpm build - - run: pnpm prerelease + - run: pnpm canary diff --git a/package.json b/package.json index 2044a8a2..b7a48f68 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "changeset": "changeset", "version-packages": "changeset version", "release": "changeset publish", - "prerelease": "pkg-pr-new publish --no-template --compact './packages/codehike'" + "canary": "pkg-pr-new publish --no-template --compact './packages/codehike'" }, "devDependencies": { "@changesets/cli": "2.27.1", From 6eda3edaddca1225a8b4d1ab1698eb8761687007 Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Fri, 30 Aug 2024 15:15:33 +0200 Subject: [PATCH 12/12] Use tabular-nums for versions --- apps/web/ui/nav.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/web/ui/nav.tsx b/apps/web/ui/nav.tsx index 267e0fd8..786fd8a0 100644 --- a/apps/web/ui/nav.tsx +++ b/apps/web/ui/nav.tsx @@ -60,15 +60,18 @@ export function NavBar({ version }: { version: string }) { function VersionNav({ version }: { version: string }) { return ( - + {version} - - - {version} + + + {version} - - + + 0.9.0