Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codehike

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codehike - npm Package Compare versions

Comparing version 1.0.0-alpha.16 to 1.0.0-alpha.17

52

dist/mdx/1.2.remark-section-to-attribute.js

@@ -63,8 +63,26 @@ import { getObjectAttribute } from "./estree.js";

function sectionContainer(section, path) {
const elements = section.children.map((child) => {
return {
type: "mdxJsxFlowElement",
name: "slot",
attributes: [
{
type: "mdxJsxAttribute",
name: "path",
value: path,
},
],
children: sectionChildren(section),
};
}
function sectionChildren(section) {
const elements = section.children
.map((child) => {
if (child.type === "content") {
return child.value;
}
return placeholder(child.name, child.index);
});
if (child.type === "section") {
return placeholder(child);
}
})
.filter((x) => !!x);
const child = elements.length == 1

@@ -79,21 +97,15 @@ ? elements[0]

};
return {
type: "mdxJsxFlowElement",
name: "slot",
attributes: [
{
type: "mdxJsxAttribute",
name: "path",
value: path,
},
],
children: child ? [child] : [],
};
return child ? [child] : [];
}
function placeholder(name, index) {
function placeholder(node) {
const { name, index } = node;
const startsWithLowercase = name && name.charAt(0) === name.charAt(0).toLowerCase();
if (startsWithLowercase) {
return null;
}
const attributes = [
{
type: "mdxJsxAttribute",
name: "name",
value: name,
name: "title",
value: node.title,
},

@@ -130,6 +142,6 @@ ];

type: "mdxJsxFlowElement",
name: "slot",
name: name,
attributes,
children: [],
children: sectionChildren(node),
};
}

@@ -123,3 +123,6 @@ import { SKIP, visit } from "estree-util-visit";

const elements = childrenByPath[path].shift();
node.value = elements[0];
node.value = elements[0] || {
type: "Identifier",
name: "undefined",
};
return SKIP;

@@ -146,6 +149,6 @@ }

children.forEach((callExpression) => {
var _a;
var _a, _b;
const props = (_a = callExpression.arguments[1]) === null || _a === void 0 ? void 0 : _a.properties;
const path = props.find((p) => p.key.name === "path").value.value;
let slotChildren = props.find((p) => p.key.name === "children").value;
let slotChildren = (_b = props.find((p) => p.key.name === "children")) === null || _b === void 0 ? void 0 : _b.value;
childrenByPath[path] = childrenByPath[path] || [];

@@ -163,3 +166,6 @@ childrenByPath[path].push(slotChildren);

const elements = childrenByPath[path].shift();
node.value = elements;
node.value = elements || {
type: "Identifier",
name: "undefined",
};
return SKIP;

@@ -166,0 +172,0 @@ }

{
"name": "codehike",
"version": "1.0.0-alpha.16",
"version": "1.0.0-alpha.17",
"type": "module",

@@ -5,0 +5,0 @@ "sideEffects": false,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc