Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ioFiles.input.forEach((inputFile: string) => {
// Drop files that are also listed as OUTPUT or should be ignored
if (ioFiles.output.includes(inputFile) ||
micromatch.some(inputFile, globsToIgnore, { format } as any) ||
!fs.existsSync(inputFile)) {
return
}
// Drop the current rootFile often listed as INPUT and drop any file that is already in the texFileTree
if (baseFile === inputFile || inputFile in this.cachedContent) {
return
}
if (path.extname(inputFile) === '.tex') {
// Parse tex files as imported subfiles.
this.cachedContent[baseFile].children.push({
index: Number.MAX_VALUE,
file: inputFile
})
this.parseFileAndSubs(inputFile)
} else if (this.fileWatcher && !this.filesWatched.includes(inputFile)) {
// Watch non-tex files.
module.exports = async (serverContext, ssrContext) => {
const { ctx, spaPaths, renderer } = serverContext;
ctx.set('content-type', 'text/html; charset=utf-8');
// SPA route
if (spaPaths && spaPaths.length && mm.some(ssrContext.url, spaPaths)) {
ctx.body = spaRoute(serverContext);
return ctx;
}
// SSR route
try {
const html = await renderer.renderToString(ssrContext);
if (ssrContext.redirected) {
ctx.status = ssrContext.redirected;
return ctx;
}
const { errorHandler } = ssrContext.data.state;
if (errorHandler.error) {
ctx.status = errorHandler.statusCode || 500;
function embed(uri, node, whitelist = '', debug = () => {}) {
if ((uri.scheme === 'http' || uri.scheme === 'https') && mm.some(uri.host, whitelist.split(','))) {
const children = [{ ...node }];
node.type = 'embed';
node.children = children;
node.url = URI.serialize(uri);
if (node.value) {
delete node.value;
}
} else {
debug(`Whitelist forbids embedding of URL: ${URI.serialize(uri)}`);
}
}
const matches = (file, patterns) => {
let ignore;
({patterns, ignore} = processMatchingPatterns(patterns));
return micromatch.some(file, patterns, {ignore});
};
exports.isFileIncluded = function (globs, dot, doIgnore, relativePath) {
if (doIgnore(relativePath)) {
return false;
}
return globs.length
? micromatch.some(relativePath, globs, {dot: dot})
: dot || micromatch.some(relativePath, '**/*');
};
type: "change",
payload: { file: p, contentType: Types.ContentType.Pattern }
});
}
if (
Path.basename(rel) === "pattern.json" ||
Path.basename(rel) === "package.json"
) {
next({
type: "change",
payload: { file: p, contentType: Types.ContentType.Pattern }
});
}
if (micromatch.some(rel, docs, { matchBase: true })) {
next({ type: "change", payload: { file: p, contentType: Types.ContentType.Doc } });
}
});
})();
exports.isFileIncluded = function(globs, dot, doIgnore, relativePath) {
if (doIgnore(relativePath)) {
return false;
}
return globs.length
? micromatch.some(relativePath, globs, { dot: dot })
: dot || micromatch.some(relativePath, '**/*');
};