@modern-js/module-tools 2.39.1 → 2.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,288 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var legacySchema_exports = {};
20
- __export(legacySchema_exports, {
21
- buildSchema: () => buildSchema,
22
- legacySchema: () => legacySchema,
23
- outputSchema: () => outputSchema,
24
- presets: () => presets,
25
- sourceSchema: () => sourceSchema,
26
- targets: () => targets,
27
- toolsSchema: () => toolsSchema
28
- });
29
- module.exports = __toCommonJS(legacySchema_exports);
30
- const targets = [
31
- "es5",
32
- "es6",
33
- "es2015",
34
- "es2016",
35
- "es2017",
36
- "es2018",
37
- "es2019",
38
- "es2020",
39
- // The default target is esnext which means that by default, assume all of the latest JavaScript and CSS features are supported.
40
- "esnext"
41
- ];
42
- const presets = [
43
- "npm-library",
44
- "npm-library-with-umd",
45
- "npm-component",
46
- "npm-component-with-umd",
47
- ...[
48
- "npm-library",
49
- "npm-library-with-umd",
50
- "npm-component",
51
- "npm-component-with-umd"
52
- ].reduce((ret, crt) => {
53
- return [
54
- ...ret,
55
- ...targets.map((t) => `${crt}-${t}`)
56
- ];
57
- }, [])
58
- ];
59
- const properties = {
60
- target: {
61
- enum: targets
62
- },
63
- format: {
64
- enum: [
65
- "cjs",
66
- "esm",
67
- "umd"
68
- ]
69
- },
70
- sourceMap: {
71
- enum: [
72
- true,
73
- false,
74
- "inline",
75
- "external"
76
- ]
77
- },
78
- buildType: {
79
- enum: [
80
- "bundle",
81
- "bundleless"
82
- ]
83
- },
84
- bundleOptions: {
85
- type: "object",
86
- properties: {
87
- getModuleId: {
88
- instanceof: "Function"
89
- },
90
- entry: {
91
- type: "object"
92
- },
93
- splitting: {
94
- type: "boolean"
95
- },
96
- externals: {
97
- type: "array",
98
- items: {
99
- anyOf: [
100
- {
101
- instanceof: "RegExp"
102
- },
103
- {
104
- typeof: "string"
105
- }
106
- ]
107
- }
108
- },
109
- platform: {
110
- enum: [
111
- "node",
112
- "browser"
113
- ]
114
- },
115
- minify: {
116
- enum: [
117
- "esbuild",
118
- "terser",
119
- false
120
- ]
121
- },
122
- skipDeps: {
123
- type: "boolean"
124
- }
125
- }
126
- },
127
- bundlelessOptions: {
128
- type: "object",
129
- properties: {
130
- sourceDir: {
131
- type: "string"
132
- },
133
- style: {
134
- type: "object",
135
- properties: {
136
- compileMode: {
137
- enum: [
138
- "all",
139
- "only-compiled-code",
140
- "only-source-code",
141
- false
142
- ]
143
- },
144
- path: {
145
- type: "string"
146
- }
147
- }
148
- },
149
- static: {
150
- type: "object",
151
- properties: {
152
- path: {
153
- type: "string"
154
- }
155
- }
156
- }
157
- }
158
- },
159
- tsconfig: {
160
- type: "string"
161
- },
162
- enableDts: {
163
- type: "boolean"
164
- },
165
- dtsOnly: {
166
- type: "boolean"
167
- },
168
- outputPath: {
169
- type: "string"
170
- }
171
- };
172
- const buildSchema = [
173
- {
174
- target: "output.buildConfig",
175
- schema: {
176
- if: {
177
- type: "array"
178
- },
179
- then: {
180
- items: [
181
- {
182
- type: "object",
183
- properties,
184
- additionalProperties: false
185
- }
186
- ]
187
- },
188
- else: {
189
- type: "object",
190
- properties,
191
- additionalProperties: false
192
- }
193
- }
194
- },
195
- {
196
- target: "output.buildPreset",
197
- schema: {
198
- enum: presets
199
- }
200
- }
201
- ];
202
- const PACKAGE_MODE_LIST = [
203
- "universal-js",
204
- "universal-js-lite",
205
- "browser-js",
206
- "browser-js-lite",
207
- "node-js"
208
- ];
209
- const outputSchema = [
210
- /** packageMode will deprecated */
211
- {
212
- target: "output.packageMode",
213
- schema: {
214
- enum: PACKAGE_MODE_LIST
215
- }
216
- },
217
- /** packageFields will deprecated */
218
- {
219
- target: "output.packageFields",
220
- schema: {
221
- typeof: "object"
222
- }
223
- },
224
- /** enableSourceMap will deprecated */
225
- {
226
- target: "output.enableSourceMap",
227
- schema: {
228
- typeof: "boolean"
229
- }
230
- },
231
- /** importStyle will deprecated */
232
- {
233
- target: "output.importStyle",
234
- schema: {
235
- enum: [
236
- "compiled-code",
237
- "source-code"
238
- ]
239
- }
240
- },
241
- /** assetsPath will deprecated */
242
- {
243
- target: "output.assetsPath",
244
- schema: {
245
- typeof: "string",
246
- default: "styles"
247
- }
248
- },
249
- ...buildSchema
250
- ];
251
- const sourceSchema = [
252
- {
253
- target: "source.jsxTransformRuntime",
254
- schema: {
255
- // https://babeljs.io/docs/en/babel-preset-react#runtime
256
- enum: [
257
- "classic",
258
- "automatic"
259
- ]
260
- }
261
- }
262
- ];
263
- const toolsSchema = [
264
- {
265
- target: "tools.speedy",
266
- schema: {
267
- typeof: [
268
- "object",
269
- "function"
270
- ]
271
- }
272
- }
273
- ];
274
- const legacySchema = [
275
- ...sourceSchema,
276
- ...outputSchema,
277
- ...toolsSchema
278
- ];
279
- // Annotate the CommonJS export names for ESM import in node:
280
- 0 && (module.exports = {
281
- buildSchema,
282
- legacySchema,
283
- outputSchema,
284
- presets,
285
- sourceSchema,
286
- targets,
287
- toolsSchema
288
- });