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

nixy

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nixy - npm Package Compare versions

Comparing version 0.0.20 to 0.0.21

45

compiler.js

@@ -20,2 +20,34 @@ const path = require('path');

function hashRef(file, refName) {
let strToHash;
if (refName.startsWith('$') || refName.startsWith('global_')) {
strToHash = refName;
}
else {
strToHash = file + ':' + refName;
}
const hashStr = crypto.createHash('sha1').update(strToHash).digest('base64');
const matches = hashStr.match(/[a-zA-Z][a-zA-Z0-9]{3}/);
if (matches) {
return matches[0];
}
let res = '';
for (const char of hashStr) {
if (!res) {
if (/[a-zA-Z]/.test(char)) {
res += char;
}
}
else {
if (/[a-zA-Z0-9]/.test(char)) {
res += char;
}
}
if (res.length >= 4) break;
}
return res;
}
async function parseFile(file, options = {}, data = {}) {

@@ -407,2 +439,3 @@ if (!file.startsWith('/')) {

const baseRoot = data.baseRoot;
const relativeFilePath = options.file.replace(baseRoot, '');

@@ -551,7 +584,7 @@ let include;

if (!name) {
name = random();
name = `r0${Object.keys(refs).length}`;
cls = cls || name;
}
if (!refs[name]) {
cls = cls || random();
cls = cls || hashRef(name, relativeFilePath);
refs[name] = cls;

@@ -563,3 +596,3 @@ }

name: 'class',
value: `'${refs[name]}'`,
value: `"${refs[name]}"`,
literalValue: refs[name],

@@ -762,3 +795,3 @@ });

let literalValue = attr.literalValue;
const regex = /([@])refs\.([a-zA-Z0-9_]+)\b/g;
const regex = /([@])refs\.([a-zA-Z0-9$_]+)\b/g;
let matches;

@@ -865,3 +898,3 @@ if (typeof value === 'string') {

let matches;
const regex = /([$@])refs\.([a-zA-Z0-9_]+)\b/g;
const regex = /([$@])refs\.([a-zA-Z0-9$_]+)\b/g;
for (let i = 0; i < clientScript.length; i++) {

@@ -898,3 +931,3 @@ let str = clientScript[i];

data.style.push(clientStyle.join('\n')
.replace(/\bref:([a-zA-Z0-9_]+)\b/g, (match, g1) => {
.replace(/\bref:([a-zA-Z0-9$_]+)\b/g, (match, g1) => {
const val = refs[g1];

@@ -901,0 +934,0 @@ if (!val) {

2

package.json
{
"name": "nixy",
"version": "0.0.20",
"version": "0.0.21",
"description": "HTML templating framework focused on SSR and performance",

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

@@ -32,3 +32,3 @@ const fs = require('fs');

console.assert(out === '<div><div data-pos="mw_product_3" class="sm-da" cla="height: 31.25vw"></div><div data-pos="mw_product_3" class="sm-da" cla="height: 31.25vw"></div><div class="box"><div class="header"><div class="title"><h3>A Box</h3></div><div class="actions"><a>View All →</a></div></div><a>Hello</a></div><div data--j="(a~b"></div></div>');
console.assert(out === '<div><div data-pos="mw_product_3" class="sm-da r00" cla="height: 31.25vw"></div><div data-pos="mw_product_3" class="sm-da r00" cla="height: 31.25vw"></div><div class="box"><div class="header"><div class="title"><h3>A Box</h3></div><div class="actions"><a>View All →</a></div></div><a>Hello</a></div><div class="gOIC" data--j="(a~b"></div></div>');

@@ -35,0 +35,0 @@ console.time('render');

Sorry, the diff of this file is not supported yet

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