Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// kill(3) Ctrl-\
process.once('SIGQUIT', () => onSignal('SIGQUIT'));
// kill(15) default
process.once('SIGTERM', () => onSignal('SIGTERM'));
function onSignal() {
if (closed) return;
closed = true;
process.exit(0);
}
process.env.NODE_ENV = 'development';
const args = yParser(process.argv.slice(2));
const Service = require('umi-build-dev/lib/Service').default;
new Service(buildDevOpts(args)).run('dev', args);
'--help': 'help',
};
spinner.succeed();
switch (script) {
case 'build':
case 'dev':
case 'test':
case 'inspect':
// eslint-disable-next-line import/no-dynamic-require
require(`./scripts/${script}`);
break;
default: {
const Service = require('umi-build-dev/lib/Service').default;
new Service(buildDevOpts(args)).run(aliasMap[script] || script, args);
break;
}
}
'-h': 'help',
'--help': 'help',
};
switch (script) {
case 'build':
case 'dev':
case 'test':
case 'inspect':
case 'ui':
// eslint-disable-next-line import/no-dynamic-require
require(`./scripts/${script}`);
break;
default: {
const Service = require('umi-build-dev/lib/Service').default;
new Service(buildDevOpts(args)).run(aliasMap[script] || script, args);
break;
}
}
jsx(raw: string): TransformResult {
return {
// discard frontmatter for source code display
content: raw.replace(FRONT_COMMENT_EXP, ''),
config: getYamlConfig(raw),
};
},
tsx(raw: string): TransformResult {
import fork from 'umi-build-dev/lib/fork';
const child = fork(require.resolve('./realDev.js'));
child.on('message', data => {
if (process.send) {
process.send(data);
}
});
child.on('exit', code => {
if (code === 1) {
process.exit(1);
}
});
process.on('SIGINT', () => {
child.kill('SIGINT');
});
import yParser from 'yargs-parser';
import buildDevOpts from '../buildDevOpts';
process.env.NODE_ENV = 'production';
process.env.UMI_UI = 'none';
const args = yParser(process.argv.slice(2));
const Service = require('umi-build-dev/lib/Service').default;
new Service(buildDevOpts(args)).run('build', args);
export default function(opts = {}) {
return require('umi-build-dev/lib/build').default(
buildDevOpts({
...opts,
}),
);
}
export default function(opts = {}) {
return require('umi-build-dev/lib/dev').default(buildDevOpts(opts));
}
export default api => {
const PageGenerator = makePageGenerator(api);
const { paths, config } = api;
return class Generator extends api.Generator {
constructor(args, options) {
super(args, options);
const pageGeneratorOptions = {
...options,
resolved: require.resolve('umi-build-dev/lib/plugins/commands/generate/generators/page'),
};
this.pageGenerator = new PageGenerator(args, pageGeneratorOptions);
}
writing() {
this.pageGenerator.writing();
const pagePath = this.args[0].toString();