Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Nested rules
config.module
.rule('alpha')
.rule('nested')
.use('babel')
.loader('babel-loader');
// Default rules
config.module
.defaultRule('default')
.rule('nested')
.use('babel')
.loader('babel-loader');
const envPluginPath = require.resolve('webpack/lib/EnvironmentPlugin');
const stringifiedEnvPluginPath = stringify(envPluginPath);
class FooPlugin {}
FooPlugin.__expression = `require('foo-plugin')`;
config
.plugin('env')
.use(envPluginPath, [{ VAR: false }])
.end()
.plugin('gamma')
.use(FooPlugin)
.end()
.plugin('delta')
.use(class BarPlugin {}, ['bar'])
.end()
.plugin('epsilon')
.use(class BazPlugin {}, [{ n: 1 }, [2, 3]]);
if (name === 'cookie' && options.cookieSecret) {
pluginOptions = { secret: options.cookieSecret };
}
if (pluginOptions) {
serverConfig.plugins.push([pluginPath, pluginOptions]);
} else {
serverConfig.plugins.push(pluginPath);
}
}
}
fs.writeFileSync(
api.resolve('server.config.js'),
`export default ${stringify(serverConfig, null, 2)}`,
);
}
// When this plugin is invoked
api.onCreateComplete(async () => {
await execCodeFixer(api);
const { blue, underline, bold } = chalk;
api.exitLog(
`UVue installed, please read this before starting:\n${bold(
underline(
blue(
'https://universal-vue.github.io/docs/guide/post-install.html#post-installation-notes',
),
),
opts[optionName] = true;
return opts;
}, {});
}
if (pluginOptions) {
uvueConfig.plugins.push([pluginPath, pluginOptions]);
} else {
uvueConfig.plugins.push(pluginPath);
}
}
}
fs.writeFileSync(
api.resolve('uvue.config.js'),
`export default ${stringify(uvueConfig, null, 2)}`,
);
// Server config
const serverConfig = {
plugins: [],
};
if (options.serverPlugins) {
for (const name of options.serverPlugins) {
const pluginPath = `@uvue/server/plugins/${name}`;
let pluginOptions = null;
if (name === 'cookie' && options.cookieSecret) {
pluginOptions = { secret: options.cookieSecret };
}
const getNeutrinorcOptions = (name, project) => {
if (!project.options) {
return '';
}
const [head, ...tail] = stringify(project.options(name), null, 2).split('\n');
return `${head}\n${tail.join('\n').replace(RE_INDENT, ' ')}`;
};
const stringifyExports = value =>
stringify(
value,
(value, indent, next) => {
const valueType = typeof value;
if (
valueType === 'string' ||
valueType === 'number' ||
valueType === 'undefined' ||
value === null ||
Array.isArray(value) ||
isPlainObject(value)
) {
return next(value);
}
throw new Error(dedent`
Invalid treat file exports.
const params = route.operation.parameters
.filter(param => !param.deprecated)
.filter(param => param.name != "owner")
.filter(param => param.in !== "header")
.filter(param => param.required)
.reduce(
(params, param) =>
Object.assign(params, {
[param.name]: getExampleParamValue(param.name, param.schema)
}),
{}
);
Object.assign(params, getExampleBodyParams(route));
const method = `${snakeCase(idName).replace(/get_|list_/, "")}`;
const parameters = `${stringify(Object.values(params), null, 2)}`;
return `octokit.${method}(${
Object.keys(params).length
? parameters.substring(1, parameters.length - 1)
: ""
})`;
}
const params = route.operation.parameters
.filter(param => !param.deprecated)
.filter(param => param.in !== "header")
.filter(param => param.required)
.reduce(
(params, param) =>
Object.assign(params, {
[param.name]: getExampleParamValue(param.name, param.schema)
}),
{}
);
Object.assign(params, getExampleBodyParams(route));
const method = `${camelCase(scope)}.${camelCase(idName)}`;
return `octokit.${method}(${
Object.keys(params).length ? stringify(params, null, 2) : ""
})`;
}
function toJsExample ({ scope, endpoint, baseUrl }) {
const params = endpoint.params
.filter(param => !param.deprecated)
.filter(param => param.required)
.reduce((params, param) => Object.assign(params, {
[param.name]: PARAMETER_EXAMPLES[param.name] || param.name
}), {})
return `octokit.${scope}.get(${Object.keys(params).length ? stringify(params, null, 2) : ''})`
}