Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import App from './App';
import * as css from './app.m.css';
import './Bar';
import LazyApp from './LazyApp';
import routes from './routes';
import test from './test.block';
'!has("bar")';
if (has('foo')) {
console.log('foo');
}
const root = document.getElementById('app');
const btr = has('build-time-render');
App().then((result) => {
console.log(result());
console.log(require('foo/bar'));
});
let div = document.getElementById('div');
if (!div) {
div = document.createElement('div');
div.id = 'div';
}
if (btr) {
test('./src/foo.txt').then((result: string) => {
const nodeBtr = document.createElement('div');
nodeBtr.id = 'nodeBtr';
nodeBtr.innerHTML = result;
root!.appendChild(nodeBtr);
}
if (has('dojo-debug')) {
div.setAttribute('dojo-debug', 'true');
}
if (has('env') === 'prod') {
div.setAttribute('has-prod', 'prod');
}
if (has('env') === 'ci') {
div.setAttribute('has-ci', 'ci');
}
div.textContent = `Built with Build Time Render: ${!!div.getAttribute('hasBtr')}
Currently Rendered by BTR: ${has('build-time-render')}`;
div.classList.add(...css.root.split(' '));
if (div.parentNode === null) {
root!.appendChild(div);
}
const appRoot = document.getElementById('app-root')!;
console.log(appRoot);
const registry = new Registry();
const router = registerRouterInjector(routes, registry);
if (!btr) {
router.setPath('/foo/bar');
}
import has from '@dojo/framework/core/has';
import renderer, { w } from '@dojo/framework/core/vdom';
import Registry from '@dojo/framework/core/Registry';
import { registerRouterInjector } from '@dojo/framework/routing/RouterInjector';
import App from './App';
import * as css from './app.m.css';
import './Bar';
import LazyApp from './LazyApp';
import routes from './routes';
import test from './test.block';
'!has("bar")';
if (has('foo')) {
console.log('foo');
}
const root = document.getElementById('app');
const btr = has('build-time-render');
App().then((result) => {
console.log(result());
console.log(require('foo/bar'));
});
let div = document.getElementById('div');
if (!div) {
div = document.createElement('div');
div.id = 'div';
}
});
div.setAttribute('hasBtr', 'true');
} else {
const nodeBtrCache = document.createElement('div');
nodeBtrCache.id = 'nodeBtrCache';
test('./src/foo.txt').then((result: string) => {
nodeBtrCache.innerHTML = result;
});
root!.appendChild(nodeBtrCache);
}
if (process.env.NODE_ENV === 'production') {
div.setAttribute('nodeenv', 'production');
}
if (has('dojo-debug')) {
div.setAttribute('dojo-debug', 'true');
}
if (has('env') === 'prod') {
div.setAttribute('has-prod', 'prod');
}
if (has('env') === 'ci') {
div.setAttribute('has-ci', 'ci');
}
div.textContent = `Built with Build Time Render: ${!!div.getAttribute('hasBtr')}
Currently Rendered by BTR: ${has('build-time-render')}`;
div.classList.add(...css.root.split(' '));
if (div.parentNode === null) {
const store = createStoreMiddleware((store: Store) => {
let session: any;
if (!has('build-time-render') && global.sessionStorage) {
session = global.sessionStorage.getItem('conduit-session');
}
if (session) {
setSessionProcess(store)({ session: JSON.parse(session) });
}
getTagsProcess(store)({});
router.on('nav', ({ outlet, context }: any) => {
changeRouteProcess(store)({ outlet, context });
});
function onRouteChange() {
const outlet = store.get(store.path('routing', 'outlet'));
const params = store.get(store.path('routing', 'params'));
if (outlet) {
const link = router.link(outlet, params);
if (link !== undefined) {
const store = createStoreMiddleware((store: Store) => {
let session: any;
if (!has("build-time-render") && !has("test")) {
session = global.sessionStorage.getItem("conduit-session");
}
if (session) {
setSessionProcess(store)({ session: JSON.parse(session) });
}
getTagsProcess(store)({});
router.on("nav", ({ outlet, context }: any) => {
changeRouteProcess(store)({ outlet, context });
});
function onRouteChange() {
const outlet = store.get(store.path("routing", "outlet"));
const params = store.get(store.path("routing", "params"));
if (outlet) {
const link = router.link(outlet, params);
if (link !== undefined) {
export default factory(function Comments({ properties, middleware: { icache } }) {
const { id } = properties();
let item: ArticleItem | undefined;
if (!has('build-time-render')) {
item = icache.getOrSet('comment', async () => {
const response = await fetch(`https://node-hnapi.herokuapp.com/item/${id}`);
const item = await response.json();
return item;
});
}
if (!item) {
return ;
}
return (
<article>
<h1>
<a href="{item.url}"></a></h1></article>
export default factory(function Content({ properties, middleware: { icache } }) {
const { page, category } = properties();
let articles = [];
if (!has('build-time-render')) {
articles =
icache.getOrSet('articles', async () => {
const catKey = category === 'top' ? 'news' : category === 'new' ? 'newest' : category;
const response = await fetch(`https://node-hnapi.herokuapp.com/${catKey}?page=${page}`);
const articles = await response.json();
return articles;
}) || [];
}
const articlesNodes = [];
const length = articles.length || 30;
for (let index = 0; index < length; index++) {
articlesNodes.push(<article>);
}
return (
<div>
<div></div></div></article>
<div>{children()}</div>
];
if (content) {
tabs.push(
<div>
<pre> <code>
</code></pre><code>
</code></div><code>
</code><code>
);
}
if (!has('docs')) {
tabs.push(
<div>
{activeTab === tabNames.indexOf('tests') && (
</div></code>