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

@glimmer/node

Package Overview
Dependencies
Maintainers
13
Versions
274
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glimmer/node - npm Package Compare versions

Comparing version 0.85.5 to 0.85.6

142

dist/prod/index.js

@@ -1,142 +0,2 @@

import { DOMTreeConstruction, ConcreteBounds, NewElementBuilder } from '@glimmer/runtime';
import createHTMLDocument from '@simple-dom/document';
class NodeDOMTreeConstruction extends DOMTreeConstruction {
// Hides property on base class
constructor(doc) {
super(doc || createHTMLDocument());
}
// override to prevent usage of `this.document` until after the constructor
setupUselessElement() {}
insertHTMLBefore(parent, reference, html) {
let raw = this.document.createRawHTMLSection(html);
parent.insertBefore(raw, reference);
return new ConcreteBounds(parent, raw, raw);
}
// override to avoid SVG detection/work when in node (this is not needed in SSR)
createElement(tag) {
return this.document.createElement(tag);
}
// override to avoid namespace shenanigans when in node (this is not needed in SSR)
setAttribute(element, name, value) {
element.setAttribute(name, value);
}
}
const TEXT_NODE = 3;
const NEEDS_EXTRA_CLOSE = new WeakMap();
function currentNode(cursor) {
let {
element,
nextSibling
} = cursor;
if (nextSibling === null) {
return element.lastChild;
} else {
return nextSibling.previousSibling;
}
}
class SerializeBuilder extends NewElementBuilder {
serializeBlockDepth = 0;
__openBlock() {
let {
tagName
} = this.element;
if (tagName !== 'TITLE' && tagName !== 'SCRIPT' && tagName !== 'STYLE') {
let depth = this.serializeBlockDepth++;
this.__appendComment(`%+b:${depth}%`);
}
super.__openBlock();
}
__closeBlock() {
let {
tagName
} = this.element;
super.__closeBlock();
if (tagName !== 'TITLE' && tagName !== 'SCRIPT' && tagName !== 'STYLE') {
let depth = --this.serializeBlockDepth;
this.__appendComment(`%-b:${depth}%`);
}
}
__appendHTML(html) {
let {
tagName
} = this.element;
if (tagName === 'TITLE' || tagName === 'SCRIPT' || tagName === 'STYLE') {
return super.__appendHTML(html);
}
// Do we need to run the html tokenizer here?
let first = this.__appendComment('%glmr%');
if (tagName === 'TABLE') {
let openIndex = html.indexOf('<');
if (openIndex > -1) {
let tr = html.slice(openIndex + 1, openIndex + 3);
if (tr === 'tr') {
html = `<tbody>${html}</tbody>`;
}
}
}
if (html === '') {
this.__appendComment('% %');
} else {
super.__appendHTML(html);
}
let last = this.__appendComment('%glmr%');
return new ConcreteBounds(this.element, first, last);
}
__appendText(string) {
let {
tagName
} = this.element;
let current = currentNode(this);
if (tagName === 'TITLE' || tagName === 'SCRIPT' || tagName === 'STYLE') {
return super.__appendText(string);
} else if (string === '') {
return this.__appendComment('% %');
} else if (current && current.nodeType === TEXT_NODE) {
this.__appendComment('%|%');
}
return super.__appendText(string);
}
closeElement() {
if (NEEDS_EXTRA_CLOSE.has(this.element)) {
NEEDS_EXTRA_CLOSE.delete(this.element);
super.closeElement();
}
return super.closeElement();
}
openElement(tag) {
if (tag === 'tr') {
if (this.element.tagName !== 'TBODY' && this.element.tagName !== 'THEAD' && this.element.tagName !== 'TFOOT') {
this.openElement('tbody');
// This prevents the closeBlock comment from being re-parented
// under the auto inserted tbody. Rehydration builder needs to
// account for the insertion since it is injected here and not
// really in the template.
NEEDS_EXTRA_CLOSE.set(this.constructing, true);
this.flushElement(null);
}
}
return super.openElement(tag);
}
pushRemoteElement(element, cursorId) {
let insertBefore = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
let {
dom
} = this;
let script = dom.createElement('script');
script.setAttribute('glmr', cursorId);
dom.insertBefore(element, script, insertBefore);
return super.pushRemoteElement(element, cursorId, insertBefore);
}
}
function serializeBuilder(env, cursor) {
return SerializeBuilder.forInitialRender(env, cursor);
}
export { NodeDOMTreeConstruction, serializeBuilder };
import{DOMTreeConstruction as e,ConcreteBounds as t,NewElementBuilder as n}from"@glimmer/runtime";import l from"@simple-dom/document";class s extends e{constructor(e){super(e||l())}setupUselessElement(){}insertHTMLBefore(e,n,l){let s=this.document.createRawHTMLSection(l);return e.insertBefore(s,n),new t(e,s,s)}createElement(e){return this.document.createElement(e)}setAttribute(e,t,n){e.setAttribute(t,n)}}const r=new WeakMap;class i extends n{serializeBlockDepth=0;__openBlock(){let{tagName:e}=this.element;if("TITLE"!==e&&"SCRIPT"!==e&&"STYLE"!==e){let e=this.serializeBlockDepth++;this.__appendComment(`%+b:${e}%`)}super.__openBlock()}__closeBlock(){let{tagName:e}=this.element;if(super.__closeBlock(),"TITLE"!==e&&"SCRIPT"!==e&&"STYLE"!==e){let e=--this.serializeBlockDepth;this.__appendComment(`%-b:${e}%`)}}__appendHTML(e){let{tagName:n}=this.element;if("TITLE"===n||"SCRIPT"===n||"STYLE"===n)return super.__appendHTML(e);let l=this.__appendComment("%glmr%");if("TABLE"===n){let t=e.indexOf("<");if(t>-1){"tr"===e.slice(t+1,t+3)&&(e=`<tbody>${e}</tbody>`)}}""===e?this.__appendComment("% %"):super.__appendHTML(e);let s=this.__appendComment("%glmr%");return new t(this.element,l,s)}__appendText(e){let{tagName:t}=this.element,n=function(e){let{element:t,nextSibling:n}=e;return null===n?t.lastChild:n.previousSibling}(this);return"TITLE"===t||"SCRIPT"===t||"STYLE"===t?super.__appendText(e):""===e?this.__appendComment("% %"):(n&&3===n.nodeType&&this.__appendComment("%|%"),super.__appendText(e))}closeElement(){return r.has(this.element)&&(r.delete(this.element),super.closeElement()),super.closeElement()}openElement(e){return"tr"===e&&"TBODY"!==this.element.tagName&&"THEAD"!==this.element.tagName&&"TFOOT"!==this.element.tagName&&(this.openElement("tbody"),r.set(this.constructing,!0),this.flushElement(null)),super.openElement(e)}pushRemoteElement(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,{dom:l}=this,s=l.createElement("script");return s.setAttribute("glmr",t),l.insertBefore(e,s,n),super.pushRemoteElement(e,t,n)}}function m(e,t){return i.forInitialRender(e,t)}export{s as NodeDOMTreeConstruction,m as serializeBuilder};
//# sourceMappingURL=index.js.map

10

package.json
{
"name": "@glimmer/node",
"type": "module",
"version": "0.85.5",
"version": "0.85.6",
"repository": "https://github.com/glimmerjs/glimmer-vm/tree/master/packages/@glimmer/node",
"dependencies": {
"@simple-dom/document": "^1.4.0",
"@glimmer/runtime": "^0.85.5",
"@glimmer/util": "^0.85.5",
"@glimmer/interfaces": "^0.85.5"
"@glimmer/runtime": "^0.85.6",
"@glimmer/interfaces": "^0.85.6",
"@glimmer/util": "^0.85.6"
},

@@ -20,3 +20,3 @@ "files": [

"publint": "^0.2.5",
"@glimmer/compiler": "^0.85.5",
"@glimmer/compiler": "^0.85.6",
"@glimmer-workspace/build-support": "^1.0.0"

@@ -23,0 +23,0 @@ },

Sorry, the diff of this file is not supported yet

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