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

astro-live-code

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

astro-live-code - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

2

package.json
{
"name": "astro-live-code",
"type": "module",
"version": "0.0.4",
"version": "0.0.5",
"license": "MIT",

@@ -6,0 +6,0 @@ "repository": {

@@ -21,5 +21,16 @@ import { visitParents as unistVisit } from 'unist-util-visit-parents'

if (node.meta && node.meta.split(' ').includes('live')) {
const isDiff = node.lang === 'diff'
const lang = getLang(node)
const meta = node.meta
const src = node.value
const src = isDiff
? node.value
?.split('\n')
// filter out lines with leading -
.filter((line) => !line.match(/^[-]/))
// remove leading + from lines
.map((line) => line.replace(/^[+]/, ''))
.join('\n')
: node.value
const i = examples.length

@@ -39,3 +50,3 @@

'',
)}-${exampleComponentName}.${node.lang}`,
)}-${exampleComponentName}.${lang}`,
)

@@ -48,3 +59,3 @@

const wrapperFilename = wrapper
? filename.replace(`.${node.lang}`, `.w.${node.lang}`)
? filename.replace(`.${lang}`, `.w.${lang}`)
: null

@@ -62,3 +73,3 @@

src: createWrapperSrc({
lang: node.lang,
lang,
inner: filename,

@@ -100,3 +111,3 @@ outer: wrapper,

name: 'lang',
value: node.lang,
value: lang,
},

@@ -358,2 +369,13 @@ // filename of the markdown file

function getLang(node) {
if (node.lang === 'diff') {
const lang = node.meta.split(' ').find((part) => part.startsWith('lang='))
if (lang) {
return lang.split('=')[1].slice(1, -1)
}
}
return node.lang
}
function parsePropsFromString(string) {

@@ -360,0 +382,0 @@ const regex = /props={{(.*?)}}/g

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