@kitchenshelf/serverless-rspack
Version:
[Serverless Framework](https://www.serverless.com) plugin for zero-config JavaScript and TypeScript code bundling using the high performance Rust-based JavaScript bundler [`rspack`](https://rspack.dev/guide/start/introduction)
71 lines • 2.44 kB
JavaScript
import { z } from 'zod';
const SourceMapOptions = [
'eval',
'cheap-source-map',
'cheap-module-source-map',
'source-map',
'inline-cheap-source-map',
'inline-cheap-module-source-map',
'inline-source-map',
'inline-nosources-cheap-source-map',
'inline-nosources-cheap-module-source-map',
'inline-nosources-source-map',
'nosources-cheap-source-map',
'nosources-cheap-module-source-map',
'nosources-source-map',
'hidden-nosources-cheap-source-map',
'hidden-nosources-cheap-module-source-map',
'hidden-nosources-source-map',
'hidden-cheap-source-map',
'hidden-cheap-module-source-map',
'hidden-source-map',
'eval-cheap-source-map',
'eval-cheap-module-source-map',
'eval-source-map',
'eval-nosources-cheap-source-map',
'eval-nosources-cheap-module-source-map',
'eval-nosources-source-map',
];
export const PluginOptionsSchema = z.object({
keepOutputDirectory: z.boolean().optional().default(false),
zipConcurrency: z.number().optional().default(Infinity),
stats: z.boolean().optional().default(false),
doctor: z
.union([
z.boolean(),
z
.object({
enable: z.boolean().optional().default(true),
outputDirectory: z.string().optional().nullable(),
})
.optional()
.nullable(),
])
.optional()
.nullable(),
config: z
.object({
path: z.string(),
strategy: z.enum(['override', 'combine']).optional().default('override'),
})
.optional()
.nullable(),
scripts: z.array(z.string()).optional().nullable(),
// [START] Rspack influenced - Ignored if config file is provided with `override` strategy
esm: z.boolean().optional().default(false),
mode: z
.enum(['production', 'development', 'none'])
.optional()
.default('production'),
sourcemap: z.union([z.literal(false), z.enum(SourceMapOptions)]).optional(),
tsConfig: z.string().optional().nullable(),
externals: z.array(z.string()).optional().nullable(),
// [END] Rspack influenced - Ignored if config file is provided with `override` strategy
});
export function isInvokeOptions(options) {
return typeof options.function === 'string';
}
export function isDeployFunctionOptions(options) {
return typeof options.function === 'string';
}
//# sourceMappingURL=types.js.map