1 |
|
2 | import type {SchemaEntity} from '@parcel/utils';
|
3 |
|
4 | export const ENGINES_SCHEMA: SchemaEntity = {
|
5 | type: 'object',
|
6 | properties: {
|
7 | browsers: {
|
8 | oneOf: [
|
9 | {
|
10 | type: 'array',
|
11 | items: {
|
12 | type: 'string',
|
13 | },
|
14 | },
|
15 | {
|
16 | type: 'string',
|
17 | },
|
18 | ],
|
19 | },
|
20 | },
|
21 | __forbiddenProperties: ['browser'],
|
22 | additionalProperties: {
|
23 | type: 'string',
|
24 | },
|
25 | };
|
26 |
|
27 | export const DESCRIPTOR_SCHEMA: SchemaEntity = {
|
28 | type: 'object',
|
29 | properties: {
|
30 | context: {
|
31 | type: 'string',
|
32 | enum: [
|
33 | 'node',
|
34 | 'browser',
|
35 | 'web-worker',
|
36 | 'electron-main',
|
37 | 'electron-renderer',
|
38 | ],
|
39 | },
|
40 | includeNodeModules: {
|
41 | oneOf: [
|
42 | {
|
43 | type: 'boolean',
|
44 | },
|
45 | {
|
46 | type: 'array',
|
47 | items: {
|
48 | type: 'string',
|
49 | __type: 'a wildcard or filepath',
|
50 | },
|
51 | },
|
52 | {
|
53 | type: 'object',
|
54 | properties: {},
|
55 | additionalProperties: {
|
56 | type: 'boolean',
|
57 | },
|
58 | },
|
59 | ],
|
60 | },
|
61 | outputFormat: {
|
62 | type: 'string',
|
63 | enum: ['global', 'esmodule', 'commonjs'],
|
64 | },
|
65 | distDir: {
|
66 | type: 'string',
|
67 | },
|
68 | publicUrl: {
|
69 | type: 'string',
|
70 | },
|
71 | isLibrary: {
|
72 | type: 'boolean',
|
73 | },
|
74 | sourceMap: {
|
75 | oneOf: [
|
76 | {
|
77 | type: 'boolean',
|
78 | },
|
79 | {
|
80 | type: 'object',
|
81 | properties: {
|
82 | inlineSources: {
|
83 | type: 'boolean',
|
84 | },
|
85 | sourceRoot: {
|
86 | type: 'string',
|
87 | },
|
88 | inline: {
|
89 | type: 'boolean',
|
90 | },
|
91 | },
|
92 | additionalProperties: false,
|
93 | },
|
94 | ],
|
95 | },
|
96 | engines: ENGINES_SCHEMA,
|
97 | },
|
98 | additionalProperties: false,
|
99 | };
|
100 |
|
101 | export const COMMON_TARGET_DESCRIPTOR_SCHEMA: SchemaEntity = {
|
102 | oneOf: [
|
103 | DESCRIPTOR_SCHEMA,
|
104 | {
|
105 | enum: [false],
|
106 | },
|
107 | ],
|
108 | };
|