Socket
Socket
Sign inDemoInstall

@bitgenics/fab-static

Package Overview
Dependencies
335
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.1 to 0.5.2-alpha.0

28

intermediate.js

@@ -54,7 +54,6 @@ const path = require('path')

const initCode =
'var ENV_SETTINGS = {{settings}}\n \
window.EnvSettings = ENV_SETTINGS\n \
var CSP_NONCE = "{{nonce}}"\n \
window.CspNonce = CSP_NONCE\n'
const initCode = `
window.ENV_SETTINGS = JSON.parse("<%=settings%>")
window.CSP_NONCE = "<%=nonce%>"
`

@@ -65,12 +64,15 @@ const transformHtml = async (file, src, dest) => {

})
let escaped = html.replace(/({{)/g, '\\{\\{')
escaped = escaped.replace(/(}})/g, '\\}\\}')
const $ = cheerio.load(escaped)
$('head').prepend(
`<script type="application/javascript">${initCode}</script>`
)
$('script').attr('nonce', '{{nonce}}')
// let escaped = html.replace(/({{)/g, '\\{\\{')
// escaped = escaped.replace(/(}})/g, '\\}\\}')
// const $ = cheerio.load(html)
// $('head').prepend(
// `<script type="application/javascript">${initCode}</script>`
// )
// $('script').attr('nonce', '{{nonce}}')
const js = templ($.html())
// const js = templ($.html())
const js = templ(html)
const jsFile = path.resolve(dest, `${file}.js`)
await fse.ensureFile(jsFile)
await fse.writeFile(jsFile, js)

@@ -77,0 +79,0 @@ return jsFile

{
"name": "@bitgenics/fab-static",
"version": "0.5.1",
"version": "0.5.2-alpha.0",
"description": "Front-end Application Bundle generator for (mostly) static applications.",

@@ -16,5 +16,6 @@ "main": "index.js",

"dependencies": {
"chalk": "^2.4.1",
"cheerio": "^1.0.0-rc.2",
"deterministic-zip": "^1.0.5",
"fs-extra": "^7.0.0",
"fs-extra": "^7.0.1",
"globby": "^8.0.1",

@@ -21,0 +22,0 @@ "mime-types": "^2.1.19",

@@ -30,5 +30,5 @@ const StringToBuffer = (str) => {

const code = `const text = []
${text.filter((item) => item).join('\n')}
text[${text.length}] = Buffer.from('${StringToBuffer(rest)}', 'base64')
const code = `const text = [
Buffer.from('${StringToBuffer(content)}', 'base64')
]

@@ -35,0 +35,0 @@ const renderToStream = (out, data) => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc