Skip to content

Instantly share code, notes, and snippets.

@retorquere
Created Jul 19, 2021
Embed
What would you like to do?
export function set(extra) {
extra += `
${prefix}${casing[field] || field}
${value.raw ? "=" : ":"}
${value.value}`;
return extra;
}
const fs = require('fs')
const putout = require('putout')
async function trace(source, target) {
const estrace = await import('estrace/plugin');
const newLine = await import('./setup/loaders/putout-new-line-plugin.js');
const {code} = putout(await fs.promises.readFile(source, 'utf-8'), {
fixCount: 1,
rules: {
estrace: ['on', { url: 'inline', exclude: [ 'FunctionExpression', 'ArrowFunctionExpression' ] }]
},
plugins: [
[ 'estrace', estrace ],
[ 'new-line', newLine ],
],
})
await fs.promises.writeFile(target, code)
}
async function main() {
await trace('source.js', 'traced.js')
}
main()
export function set(extra) {
try {
__estrace.enter('set', 'inline:1', arguments);
extra += `
${prefix}${casing[field] || field}
${value.raw ? "=" : ":"}
${value.value}`;
return extra;
} finally {
__estrace.exit('set', 'inline:1');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment