Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
let domTypeName = typeof dom
if (domTypeName === 'object') {
domTypeName = dom.constructor.name
} else {
// To don't fall with `in` operator
dom = {}
}
if (!('outerHTML' in dom)) {
throw new TypeError(
`Expected an element or document but got ${domTypeName}`,
)
}
const debugContent = prettyFormat(dom, {
plugins: [DOMElement, DOMCollection],
printFunctionName: false,
highlight: inNode(),
...options,
})
return maxLength !== undefined && dom.outerHTML.length > maxLength
? `${debugContent.slice(0, maxLength)}...`
: debugContent
}
this._template,
)
// Add companion chunks to the end of the body.
for (let chunk of CHUNKS) {
appendChild(BODY, createTagNode({
tagName: 'script',
attrs: [{
name: 'src',
value: `${chunk.id}.js?${chunk.hash}`,
}],
}))
}
if (this._hot) {
log(`Injecting hot listener: ${prettyFormat(TEMPLATE_PATH)}`)
appendChild(BODY, createTagNode({
tagName: 'script',
attrs: [{
name: 'src',
value: '//localhost:8196/socket.io/socket.io.js',
}],
}))
appendChild(BODY, createTagNode({
tagName: 'script',
childNodes: [createTextNode(generateHotListener(this._template))],
}))
}
log(`Emitting final HTML: ${prettyFormat(TEMPLATE_PATH)}`)
export function * getCompanionChunks(chunks, template:Template) {
let {fullPath} = template
const MAIN_CHUNK = findMainCompanionChunk(chunks, template)
if (!MAIN_CHUNK) {
log(`Companion chunk NOT found for: ${prettyFormat(fullPath)}`)
return
}
log(`Companion chunk found for: ${prettyFormat({
chunk: MAIN_CHUNK.id,
template: fullPath,
})}`)
if (MAIN_CHUNK.getNumberOfGroups() > 1) {
log(`Companion chunk is inside multiple groups: ${prettyFormat(fullPath)}`)
return
}
// The companion chunk must be on its own group, with that in mind, we are
// getting the first group from the groups set.
const GROUP = MAIN_CHUNK.groupsIterable.values()
const serialize = function(param) {
return prettyFormat(param, PRETTY_FORMAT_OPTS)
}
debug() {
return prettyFormat(this, {
escapeRegex: true,
plugins: [{ test, print }, prettyFormat.plugins.DOMElement],
printFunctionName: false,
});
}
function internalRunCommand(spawn:Function, cmd:string, options?:RunOptions) {
log('Spawning...')
let {
args = [],
env = {},
stdio = 'inherit',
} = options || {}
log('cmd: ', prettyFormat(cmd))
log('options: ', prettyFormat(options))
const COMPUTED_OPTIONS = {
cwd: getProjectDir() || process.cwd(),
env: calculateEnv(env),
shell: true,
stdio,
}
const RESULT = spawn(cmd, args, COMPUTED_OPTIONS)
log('COMPUTED_OPTIONS: ', prettyFormat(COMPUTED_OPTIONS))
log('Result: ', prettyFormat(RESULT))
return RESULT
}
type="password"
placeholder="•••••••"
{...confirmPassword.props}
/>
<label>I accept the terms and conditions</label>
<button type="reset">
Reset
</button>
<button type="submit">Sign Up</button>
<pre> {"form = "}
{format(form, {
printFunctionName: false,
})}
</pre>
)
}
async function _serializeErrorAsync(error: Error, message?: string): Promise {
if (message == null) {
message = error.message;
}
if (!error.stack || !error.stack.length) {
return prettyFormat(error);
}
let stack = await _symbolicateErrorAsync(error);
let formattedStack = _formatStack(stack);
return { message, stack: formattedStack };
}
export function serializeQueryPlan(queryPlan: QueryPlan) {
return prettyFormat(queryPlan, {
plugins: [queryPlanSerializer, astSerializer],
});
}