1 | 'use strict';
|
2 |
|
3 | const Joi = require('joi');
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | const file = Joi.string()
|
11 | .label('entrypoint filename')
|
12 | .regex(/^[a-zA-Z0-9/._-]+\.(js|jsx|css|ts|tsx)$/)
|
13 | .lowercase()
|
14 | .trim()
|
15 | .required();
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | const files = Joi.array()
|
22 | .label('entrypoint filenames')
|
23 | .items(file);
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | const tag = Joi.string()
|
29 | .label('tag')
|
30 | .regex(/^[a-zA-Z0-9_-]+$/)
|
31 | .required();
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | const type = Joi.any()
|
37 | .label('file type')
|
38 | .required()
|
39 | .valid('js', 'css');
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | const bundleInstruction = Joi.array()
|
45 | .label('bundle instruction')
|
46 | .items(Joi.string())
|
47 | .required();
|
48 |
|
49 | const options = Joi.object()
|
50 | .label('options object')
|
51 | .optional();
|
52 |
|
53 | const hash = Joi.string()
|
54 | .label('hash')
|
55 | .regex(/^[0-9A-Fa-f]+$/)
|
56 | .required();
|
57 |
|
58 | const hashArray = Joi.array()
|
59 | .label('hash array')
|
60 | .items(hash)
|
61 | .required();
|
62 |
|
63 | module.exports = {
|
64 | file,
|
65 | files,
|
66 | tag,
|
67 | type,
|
68 | bundleInstruction,
|
69 | options,
|
70 | hash,
|
71 | hashArray
|
72 | };
|