Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (node.lang === 'jsx live') {
throw new Error(
`The following code block has the language jsx live which is no longer allowed:\n${
node.value
}`
)
}
if (
node.lang === 'jsx' &&
// yes, i know this won't work if you don't use line comments and stuff
// but adding a whole js parser and stuff to do this would be more effort than it's worth
livePattern.test(node.value)
) {
let cleanValue = node.value.replace('// @live', '').trim()
node.type = `html`
node.value = escapeGoat.escapeTag``
}
})
}
/* global window document */
const tag = require("escape-goat").escapeTag;
const pageState = {};
function dom(selector) {
return document.querySelector(`.view-gallery ${selector}`);
}
function thumbnail(photo) {
return tag`<a href="${photo.pageURI}" class="thumbnail">
<img title="${photo.caption}" alt="${photo.caption}" src="${photo.thumbnailURI}" data-photo-name="${photo.name}" class="thumbnail">
</a>`;
}
}, (err, data) => {
if (err) return callback(err);
const meta = [];
meta.push(escapeGoat.escapeTag`<title>${story.title}</title>`);
meta.push(escapeGoat.escapeTag``);
meta.push(escapeGoat.escapeTag``);
meta.push(escapeGoat.escapeTag``);
meta.push(escapeGoat.escapeTag``);
const index = data.Body.toString("utf-8")
.replace("/sample-story/sample-story.js", "./story.js")
.replace("", `\n${meta.join("\n")}`);
s3.putObject({
Body: `window.InterviewJS.story = ${JSON.stringify(story)};`,
ACL: "public-read",
ContentType: "application/javascript",
Bucket: storyBucket,
Key: `${publishId}/story.js`
}, (err, response) => {
if (err) return callback(err);
s3.putObject({
Body: index,