New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@begin/enhance

Package Overview
Dependencies
Maintainers
4
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@begin/enhance - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

26

index.js

@@ -18,5 +18,7 @@ import path from 'path'

const moduleNames = [...new Set(customElements.map(node => node.tagName))]
const scripts = fragment(moduleNames.map(name => script(modules, name)).join(''))
addScriptTags(body, scripts)
return serialize(doc)
const scriptTags = fragment(moduleNames.map(name => script(name, modules)).join(''))
const templateTags = fragment(moduleNames.map(name => template(name, templates)).join(''))
addTemplateTags(body, templateTags)
addScriptTags(body, scriptTags)
return serialize(doc).replace(/__b_\d+/g, '')
}

@@ -33,3 +35,3 @@ }

return collect.join('')
.replace(/\.\.\.\s?(__\w+)/, (_, v) => {
.replace(/\.\.\.\s?(__b_\d+)/, (_, v) => {
const o = state[v]

@@ -200,10 +202,22 @@ return Object.entries(o)

function script(modulePath, customElement) {
function template(name, path) {
return `
<script src="/${modulePath}/${customElement}.js" type="module" crossorigin></script>
<template id="${name}-template">
${renderTemplate(name, path)}
</template>
`
}
function script(name, path) {
return `
<script src="/${path}/${name}.js" type="module" crossorigin></script>
`
}
function addTemplateTags(body, templates) {
body.childNodes.unshift(...templates.childNodes)
}
function addScriptTags(body, scripts) {
body.childNodes.push(...scripts.childNodes)
}
{
"name": "@begin/enhance",
"version": "0.0.8",
"version": "0.0.9",
"description": "Custom Element Server-side rendering CESR",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -33,2 +33,9 @@ import test from 'tape'

const expected = doc(`
<template id="my-paragraph-template">
<p>
<slot name="my-text">
My default text
</slot>
</p>
</template>
<my-paragraph>

@@ -54,2 +61,9 @@ <p><slot name="my-text">My default text</slot></p>

const expected = doc(`
<template id="my-paragraph-template">
<p>
<slot name="my-text">
My default text
</slot>
</p>
</template>
<my-paragraph>

@@ -75,2 +89,11 @@ <p><span slot="my-text">Slotted</span></p>

const expected = doc(`
<template id="my-content-template">
<h2>My Content</h2>
<slot name="title">
<h3>
Title
</h3>
</slot>
<slot></slot>
</template>
<my-content>

@@ -96,2 +119,5 @@ <h2>My Content</h2>

const expected = doc(`
<template id="my-link-template">
<a href=""></a>
</template>
<my-link href="/yolo" text="sketchy">

@@ -120,2 +146,5 @@ <a href="/yolo">sketchy</a>

const expected = doc(`
<template id="my-link-template">
<a href=""></a>
</template>
<my-link href="/yolo" text="sketchy" custom-attribute="custom-attribute">

@@ -139,3 +168,3 @@ <a href="/yolo">sketchy</a>

const expected = doc(`
<my-list items="__b_1">
<template id="my-list-template">
<slot name="title">

@@ -145,2 +174,9 @@ <h4>My list</h4>

<ul>
</ul>
</template>
<my-list items="">
<slot name="title">
<h4>My list</h4>
</slot>
<ul>
<li>one</li>

@@ -173,2 +209,11 @@ <li>two</li>

const expected = doc(`
<template id="my-content-template">
<h2>My Content</h2>
<slot name="title">
<h3>
Title
</h3>
</slot>
<slot></slot>
</template>
<my-content>

@@ -208,8 +253,26 @@ <h2>My Content</h2>

const expected = doc(`
<my-list-container items="__b_2">
<template id="my-list-container-template">
<h2>My List Container</h2>
<slot name="title">
<h3>
Title
</h3>
</slot>
<my-list items="">
<h4 slot="title">Content List</h4>
</my-list>
</template>
<template id="my-list-template">
<slot name="title">
<h4>My list</h4>
</slot>
<ul>
</ul>
</template>
<my-list-container items="">
<h2>My List Container</h2>
<span slot="title">
YOLO
</span>
<my-list items="__b_3">
<my-list items="">
<h4 slot="title">Content List</h4>

@@ -216,0 +279,0 @@ <ul>

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