@zthun/janitor-build-config 19.0.0 → 19.1.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.
- package/dist/typedoc.cjs.map +1 -1
- package/dist/typedoc.js.map +1 -1
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/vite-config-builder.d.mts +74 -8
- package/dist/vite/vite-server-builder.d.mts +12 -0
- package/dist/vite/vite-server-builder.spec.d.ts +1 -0
- package/dist/vite/vite-test-builder.d.mts +20 -0
- package/dist/vite.cjs +272 -53
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.js +273 -55
- package/dist/vite.js.map +1 -1
- package/package.json +14 -10
package/dist/vite.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { cloneDeep } from 'lodash-es';
|
|
1
|
+
import { cloneDeep, castArray, omitBy, isUndefined } from 'lodash-es';
|
|
2
2
|
import swc from 'unplugin-swc';
|
|
3
|
+
import { checker } from 'vite-plugin-checker';
|
|
3
4
|
import dtsPlugin from 'vite-plugin-dts';
|
|
4
5
|
import { externalizeDeps } from 'vite-plugin-externalize-deps';
|
|
5
6
|
import tsConfigPaths from 'vite-tsconfig-paths';
|
|
6
7
|
|
|
7
|
-
function _define_property$
|
|
8
|
+
function _define_property$3(obj, key, value) {
|
|
8
9
|
if (key in obj) {
|
|
9
10
|
Object.defineProperty(obj, key, {
|
|
10
11
|
value: value,
|
|
@@ -17,7 +18,7 @@ function _define_property$2(obj, key, value) {
|
|
|
17
18
|
}
|
|
18
19
|
return obj;
|
|
19
20
|
}
|
|
20
|
-
function _object_spread(target) {
|
|
21
|
+
function _object_spread$2(target) {
|
|
21
22
|
for(var i = 1; i < arguments.length; i++){
|
|
22
23
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
23
24
|
var ownKeys = Object.keys(source);
|
|
@@ -27,12 +28,12 @@ function _object_spread(target) {
|
|
|
27
28
|
}));
|
|
28
29
|
}
|
|
29
30
|
ownKeys.forEach(function(key) {
|
|
30
|
-
_define_property$
|
|
31
|
+
_define_property$3(target, key, source[key]);
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
return target;
|
|
34
35
|
}
|
|
35
|
-
function ownKeys(object, enumerableOnly) {
|
|
36
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
36
37
|
var keys = Object.keys(object);
|
|
37
38
|
if (Object.getOwnPropertySymbols) {
|
|
38
39
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -40,12 +41,12 @@ function ownKeys(object, enumerableOnly) {
|
|
|
40
41
|
}
|
|
41
42
|
return keys;
|
|
42
43
|
}
|
|
43
|
-
function _object_spread_props(target, source) {
|
|
44
|
+
function _object_spread_props$2(target, source) {
|
|
44
45
|
source = source != null ? source : {};
|
|
45
46
|
if (Object.getOwnPropertyDescriptors) {
|
|
46
47
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
47
48
|
} else {
|
|
48
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
49
|
+
ownKeys$2(Object(source)).forEach(function(key) {
|
|
49
50
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
50
51
|
});
|
|
51
52
|
}
|
|
@@ -65,7 +66,7 @@ function _object_spread_props(target, source) {
|
|
|
65
66
|
* @returns
|
|
66
67
|
* This object.
|
|
67
68
|
*/ entry(name, path) {
|
|
68
|
-
this.library.entry = _object_spread_props(_object_spread({}, this.library.entry), {
|
|
69
|
+
this.library.entry = _object_spread_props$2(_object_spread$2({}, this.library.entry), {
|
|
69
70
|
[name]: path
|
|
70
71
|
});
|
|
71
72
|
return this;
|
|
@@ -88,7 +89,7 @@ function _object_spread_props(target, source) {
|
|
|
88
89
|
return cloneDeep(this.library);
|
|
89
90
|
}
|
|
90
91
|
constructor(){
|
|
91
|
-
_define_property$
|
|
92
|
+
_define_property$3(this, "library", {
|
|
92
93
|
entry: {},
|
|
93
94
|
formats: [
|
|
94
95
|
"es",
|
|
@@ -98,7 +99,7 @@ function _object_spread_props(target, source) {
|
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
function _define_property$
|
|
102
|
+
function _define_property$2(obj, key, value) {
|
|
102
103
|
if (key in obj) {
|
|
103
104
|
Object.defineProperty(obj, key, {
|
|
104
105
|
value: value,
|
|
@@ -111,6 +112,40 @@ function _define_property$1(obj, key, value) {
|
|
|
111
112
|
}
|
|
112
113
|
return obj;
|
|
113
114
|
}
|
|
115
|
+
function _object_spread$1(target) {
|
|
116
|
+
for(var i = 1; i < arguments.length; i++){
|
|
117
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
118
|
+
var ownKeys = Object.keys(source);
|
|
119
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
120
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
121
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
ownKeys.forEach(function(key) {
|
|
125
|
+
_define_property$2(target, key, source[key]);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return target;
|
|
129
|
+
}
|
|
130
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
131
|
+
var keys = Object.keys(object);
|
|
132
|
+
if (Object.getOwnPropertySymbols) {
|
|
133
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
134
|
+
keys.push.apply(keys, symbols);
|
|
135
|
+
}
|
|
136
|
+
return keys;
|
|
137
|
+
}
|
|
138
|
+
function _object_spread_props$1(target, source) {
|
|
139
|
+
source = source != null ? source : {};
|
|
140
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
141
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
142
|
+
} else {
|
|
143
|
+
ownKeys$1(Object(source)).forEach(function(key) {
|
|
144
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return target;
|
|
148
|
+
}
|
|
114
149
|
/**
|
|
115
150
|
* A builder for test configurations found in vite's defineConfig test field.
|
|
116
151
|
*/ class ZViteTestBuilder {
|
|
@@ -135,10 +170,36 @@ function _define_property$1(obj, key, value) {
|
|
|
135
170
|
* @returns
|
|
136
171
|
* This object.
|
|
137
172
|
*/ coverage(provider) {
|
|
138
|
-
this.test.coverage
|
|
173
|
+
this.test.coverage = _object_spread_props$1(_object_spread$1({}, this.test.coverage), {
|
|
174
|
+
provider
|
|
175
|
+
});
|
|
176
|
+
return this;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Adds to the list of projects.
|
|
180
|
+
*
|
|
181
|
+
* @param project -
|
|
182
|
+
* The list of projects.
|
|
183
|
+
*
|
|
184
|
+
* @returns
|
|
185
|
+
* This object.
|
|
186
|
+
*/ project(project = []) {
|
|
187
|
+
const projects = this.test.projects || [];
|
|
188
|
+
this.test.projects = projects.concat(project);
|
|
139
189
|
return this;
|
|
140
190
|
}
|
|
141
191
|
/**
|
|
192
|
+
* Adds monorepo support to the test builder.
|
|
193
|
+
*
|
|
194
|
+
* @param packages -
|
|
195
|
+
* The path to the package directory.
|
|
196
|
+
*
|
|
197
|
+
* @returns
|
|
198
|
+
* This object.
|
|
199
|
+
*/ monorepo(packages = "packages") {
|
|
200
|
+
return this.project(`${packages}/*/vitest.config.{js,cjs,mjs,ts,mts}`);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
142
203
|
* Returns the built test configuration.
|
|
143
204
|
*
|
|
144
205
|
* @returns
|
|
@@ -149,31 +210,31 @@ function _define_property$1(obj, key, value) {
|
|
|
149
210
|
/**
|
|
150
211
|
* Initializes a new instance of this object.
|
|
151
212
|
*/ constructor(){
|
|
152
|
-
_define_property$
|
|
213
|
+
_define_property$2(this, "test", void 0);
|
|
153
214
|
/**
|
|
154
215
|
* Sets the test environment to "node".
|
|
155
216
|
*
|
|
156
217
|
* @returns
|
|
157
218
|
* This object.
|
|
158
|
-
*/ _define_property$
|
|
219
|
+
*/ _define_property$2(this, "node", this.environment.bind(this, "node"));
|
|
159
220
|
/**
|
|
160
221
|
* Sets the test environment to "happy-dom".
|
|
161
222
|
*
|
|
162
223
|
* @returns
|
|
163
224
|
* This object.
|
|
164
|
-
*/ _define_property$
|
|
225
|
+
*/ _define_property$2(this, "browser", this.environment.bind(this, "happy-dom"));
|
|
165
226
|
/**
|
|
166
227
|
* Sets the test coverage provider to "v8".
|
|
167
228
|
*
|
|
168
229
|
* @returns
|
|
169
230
|
* This object.
|
|
170
|
-
*/ _define_property$
|
|
231
|
+
*/ _define_property$2(this, "v8", this.coverage.bind(this, "v8"));
|
|
171
232
|
/**
|
|
172
233
|
* Sets the test coverage provider to "istanbul".
|
|
173
234
|
*
|
|
174
235
|
* @returns
|
|
175
236
|
* This object.
|
|
176
|
-
*/ _define_property$
|
|
237
|
+
*/ _define_property$2(this, "istanbul", this.coverage.bind(this, "istanbul"));
|
|
177
238
|
this.test = {
|
|
178
239
|
environment: "node",
|
|
179
240
|
testTimeout: 30000,
|
|
@@ -185,7 +246,7 @@ function _define_property$1(obj, key, value) {
|
|
|
185
246
|
}
|
|
186
247
|
}
|
|
187
248
|
|
|
188
|
-
function _define_property(obj, key, value) {
|
|
249
|
+
function _define_property$1(obj, key, value) {
|
|
189
250
|
if (key in obj) {
|
|
190
251
|
Object.defineProperty(obj, key, {
|
|
191
252
|
value: value,
|
|
@@ -198,6 +259,40 @@ function _define_property(obj, key, value) {
|
|
|
198
259
|
}
|
|
199
260
|
return obj;
|
|
200
261
|
}
|
|
262
|
+
function _object_spread(target) {
|
|
263
|
+
for(var i = 1; i < arguments.length; i++){
|
|
264
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
265
|
+
var ownKeys = Object.keys(source);
|
|
266
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
267
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
268
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
269
|
+
}));
|
|
270
|
+
}
|
|
271
|
+
ownKeys.forEach(function(key) {
|
|
272
|
+
_define_property$1(target, key, source[key]);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
return target;
|
|
276
|
+
}
|
|
277
|
+
function ownKeys(object, enumerableOnly) {
|
|
278
|
+
var keys = Object.keys(object);
|
|
279
|
+
if (Object.getOwnPropertySymbols) {
|
|
280
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
281
|
+
keys.push.apply(keys, symbols);
|
|
282
|
+
}
|
|
283
|
+
return keys;
|
|
284
|
+
}
|
|
285
|
+
function _object_spread_props(target, source) {
|
|
286
|
+
source = source != null ? source : {};
|
|
287
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
288
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
289
|
+
} else {
|
|
290
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
291
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
return target;
|
|
295
|
+
}
|
|
201
296
|
/**
|
|
202
297
|
* A config builder for the vite build system.
|
|
203
298
|
*
|
|
@@ -239,9 +334,64 @@ function _define_property(obj, key, value) {
|
|
|
239
334
|
* ```
|
|
240
335
|
*/ class ZViteConfigBuilder {
|
|
241
336
|
/**
|
|
242
|
-
* Sets
|
|
337
|
+
* Sets whether to minify the build output.
|
|
338
|
+
*
|
|
339
|
+
* @param minify -
|
|
340
|
+
* The flag as to minify the output.
|
|
341
|
+
*
|
|
342
|
+
* @returns
|
|
343
|
+
* This object.
|
|
344
|
+
*/ minify(minify = true) {
|
|
345
|
+
this.config.build = _object_spread_props(_object_spread({}, this.config.build), {
|
|
346
|
+
minify
|
|
347
|
+
});
|
|
348
|
+
return this;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Adds a list of plugins.
|
|
352
|
+
*
|
|
353
|
+
* @param option -
|
|
354
|
+
* The plugins to add.
|
|
355
|
+
*
|
|
356
|
+
* @returns
|
|
357
|
+
* This object.
|
|
358
|
+
*/ plugin(option = []) {
|
|
359
|
+
// See constructor - the config plugins are guaranteed to
|
|
360
|
+
// be set. The swc and paths plugins are automatically added.
|
|
361
|
+
const plugins = this.config.plugins;
|
|
362
|
+
this.config.plugins = plugins.concat(castArray(option));
|
|
363
|
+
return this;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Sets whether to generate source maps.
|
|
367
|
+
*
|
|
368
|
+
* @param sourcemap -
|
|
369
|
+
* True to generate a sourcemap, false for faster build.
|
|
370
|
+
*
|
|
371
|
+
* @returns
|
|
372
|
+
* This object.
|
|
373
|
+
*/ sourceMap(sourcemap = true) {
|
|
374
|
+
this.config.build = _object_spread_props(_object_spread({}, this.config.build), {
|
|
375
|
+
sourcemap
|
|
376
|
+
});
|
|
377
|
+
return this;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Assigns the server options.
|
|
243
381
|
*
|
|
244
382
|
* @param options -
|
|
383
|
+
* The server options to assign.
|
|
384
|
+
*
|
|
385
|
+
* @returns
|
|
386
|
+
* This object.
|
|
387
|
+
*/ server(options) {
|
|
388
|
+
this.config.server = cloneDeep(options);
|
|
389
|
+
return this;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Sets vite into library mode.
|
|
393
|
+
*
|
|
394
|
+
* @param lib -
|
|
245
395
|
* The options for the library. You can set this to
|
|
246
396
|
* nothing to use the default library which looks for
|
|
247
397
|
* an entry point at the source directory called index.ts
|
|
@@ -250,31 +400,20 @@ function _define_property(obj, key, value) {
|
|
|
250
400
|
*
|
|
251
401
|
* @returns
|
|
252
402
|
* This object.
|
|
253
|
-
*/ library(
|
|
254
|
-
this.config.build
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
externalizeDeps(),
|
|
268
|
-
dtsPlugin({
|
|
269
|
-
compilerOptions: {
|
|
270
|
-
// Always turn off paths when building for production. You want to make
|
|
271
|
-
// sure that your build is building in the correct order and that your
|
|
272
|
-
// actual paths are correct.
|
|
273
|
-
paths: {}
|
|
274
|
-
}
|
|
275
|
-
})
|
|
276
|
-
];
|
|
277
|
-
return this;
|
|
403
|
+
*/ library(lib = new ZViteLibraryBuilder().index().build()) {
|
|
404
|
+
this.config.build = _object_spread_props(_object_spread({}, this.config.build), {
|
|
405
|
+
lib
|
|
406
|
+
});
|
|
407
|
+
const dts = dtsPlugin({
|
|
408
|
+
compilerOptions: {
|
|
409
|
+
// Always turn off paths when building for production. You want to make
|
|
410
|
+
// sure that your build is building in the correct order and that your
|
|
411
|
+
// actual paths are correct.
|
|
412
|
+
paths: {}
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
const external = externalizeDeps();
|
|
416
|
+
return this.minify(false).sourceMap().plugin(external).plugin(dts);
|
|
278
417
|
}
|
|
279
418
|
/**
|
|
280
419
|
* Constructs the config to act as if it's compiling a node application.
|
|
@@ -288,15 +427,42 @@ function _define_property(obj, key, value) {
|
|
|
288
427
|
* @returns
|
|
289
428
|
* This object.
|
|
290
429
|
*/ cli() {
|
|
291
|
-
// A cli works similar to a library.
|
|
292
|
-
// to building complex node apps, but for simple cli tools and non
|
|
293
|
-
// framework based servers, you can do it.
|
|
430
|
+
// A cli works similar to a library.
|
|
294
431
|
const library = new ZViteLibraryBuilder().entry("index", "src/index.ts").entry("cli", "src/cli.ts").build();
|
|
295
432
|
return this.library(library);
|
|
296
433
|
}
|
|
297
434
|
/**
|
|
435
|
+
* Constructs the config to act as if it's compiling a nest application.
|
|
436
|
+
*
|
|
437
|
+
* This is just an alias to {@link ZViteConfigBuilder.library} with a single
|
|
438
|
+
* entry point.
|
|
439
|
+
*
|
|
440
|
+
* 1. The file, src/main.mts
|
|
441
|
+
*
|
|
442
|
+
* @returns
|
|
443
|
+
* This object.
|
|
444
|
+
*/ nest() {
|
|
445
|
+
const library = new ZViteLibraryBuilder().entry("main", "src/main.mts").build();
|
|
446
|
+
return this.library(library);
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Constructs the config to act as if it's compiling a web application.
|
|
450
|
+
*
|
|
451
|
+
* @returns
|
|
452
|
+
* This object.
|
|
453
|
+
*/ web() {
|
|
454
|
+
return this.minify().sourceMap(false).plugin(checker({
|
|
455
|
+
typescript: true
|
|
456
|
+
}));
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
298
459
|
* Constructs the config to be for testing.
|
|
299
|
-
|
|
460
|
+
*
|
|
461
|
+
* @param options -
|
|
462
|
+
* The test config to use. If this is falsy,
|
|
463
|
+
* then a test setup using a monorepo with an
|
|
464
|
+
* istanbul provider in node is used.
|
|
465
|
+
*/ test(options = new ZViteTestBuilder().node().istanbul().monorepo().build()) {
|
|
300
466
|
this.config.test = options;
|
|
301
467
|
return this;
|
|
302
468
|
}
|
|
@@ -310,14 +476,14 @@ function _define_property(obj, key, value) {
|
|
|
310
476
|
}
|
|
311
477
|
/**
|
|
312
478
|
* Initializes a new instance of this object.
|
|
479
|
+
*/ constructor(){
|
|
480
|
+
_define_property$1(this, "config", void 0);
|
|
481
|
+
/**
|
|
482
|
+
* An alias to {@link web}
|
|
313
483
|
*
|
|
314
|
-
* @
|
|
315
|
-
*
|
|
316
|
-
|
|
317
|
-
*/ constructor(_dirname){
|
|
318
|
-
_define_property(this, "_dirname", void 0);
|
|
319
|
-
_define_property(this, "config", void 0);
|
|
320
|
-
this._dirname = _dirname;
|
|
484
|
+
* @returns
|
|
485
|
+
* This object.
|
|
486
|
+
*/ _define_property$1(this, "react", this.web);
|
|
321
487
|
this.config = {
|
|
322
488
|
build: {
|
|
323
489
|
minify: true,
|
|
@@ -331,5 +497,57 @@ function _define_property(obj, key, value) {
|
|
|
331
497
|
}
|
|
332
498
|
}
|
|
333
499
|
|
|
334
|
-
|
|
500
|
+
function _define_property(obj, key, value) {
|
|
501
|
+
if (key in obj) {
|
|
502
|
+
Object.defineProperty(obj, key, {
|
|
503
|
+
value: value,
|
|
504
|
+
enumerable: true,
|
|
505
|
+
configurable: true,
|
|
506
|
+
writable: true
|
|
507
|
+
});
|
|
508
|
+
} else {
|
|
509
|
+
obj[key] = value;
|
|
510
|
+
}
|
|
511
|
+
return obj;
|
|
512
|
+
}
|
|
513
|
+
class ZViteServerBuilder {
|
|
514
|
+
allowedHost(name) {
|
|
515
|
+
if (name === true) {
|
|
516
|
+
this.options.allowedHosts = true;
|
|
517
|
+
} else if (this.options.allowedHosts !== true) {
|
|
518
|
+
const hosts = this.options.allowedHosts || [];
|
|
519
|
+
this.options.allowedHosts = hosts.concat(name);
|
|
520
|
+
}
|
|
521
|
+
return this;
|
|
522
|
+
}
|
|
523
|
+
denyAllHosts() {
|
|
524
|
+
delete this.options.allowedHosts;
|
|
525
|
+
return this;
|
|
526
|
+
}
|
|
527
|
+
port(port) {
|
|
528
|
+
this.options.port = port;
|
|
529
|
+
return this;
|
|
530
|
+
}
|
|
531
|
+
strictPort() {
|
|
532
|
+
this.options.strictPort = true;
|
|
533
|
+
return this;
|
|
534
|
+
}
|
|
535
|
+
host(ip) {
|
|
536
|
+
this.options.host = ip;
|
|
537
|
+
return this;
|
|
538
|
+
}
|
|
539
|
+
dev() {
|
|
540
|
+
return this.strictPort().host("0.0.0.0").allowedHost(true);
|
|
541
|
+
}
|
|
542
|
+
build() {
|
|
543
|
+
const clone = cloneDeep(this.options);
|
|
544
|
+
return omitBy(clone, isUndefined);
|
|
545
|
+
}
|
|
546
|
+
constructor(){
|
|
547
|
+
_define_property(this, "options", {});
|
|
548
|
+
_define_property(this, "localhost", this.host.bind(this, "127.0.0.1"));
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export { ZViteConfigBuilder, ZViteLibraryBuilder, ZViteServerBuilder, ZViteTestBuilder };
|
|
335
553
|
//# sourceMappingURL=vite.js.map
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","sources":["../src/vite/vite-library-builder.mts","../src/vite/vite-test-builder.mts","../src/vite/vite-config-builder.mts"],"sourcesContent":["import { cloneDeep } from \"lodash-es\";\nimport { LibraryOptions } from \"vite\";\n\n/**\n * A builder for Vite library configurations.\n */\nexport class ZViteLibraryBuilder {\n private library: LibraryOptions = {\n entry: {},\n formats: [\"es\", \"cjs\"],\n };\n\n /**\n * Adds an entry point to the library.\n *\n * @param name -\n * The name of the entry point.\n * @param path -\n * The path to the entry point file.\n *\n * @returns\n * This object.\n */\n public entry(name: string, path: string) {\n this.library.entry = {\n ...(this.library.entry as Record<string, string>),\n [name]: path,\n };\n return this;\n }\n\n /**\n * A shorthand for adding an entry point\n * named \"index\" that points to \"src/index.ts\"\n *\n * @returns\n * This object.\n */\n public index() {\n return this.entry(\"index\", \"./src/index.ts\");\n }\n\n /**\n * Returns the built library configuration.\n *\n * @returns\n * A deep clone of the library configuration.\n */\n public build() {\n return cloneDeep(this.library);\n }\n}\n","import { cloneDeep } from \"lodash-es\";\nimport { InlineConfig, VitestEnvironment } from \"vitest/node\";\n\n/**\n * A builder for test configurations found in vite's defineConfig test field.\n */\nexport class ZViteTestBuilder {\n private test: InlineConfig;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this.test = {\n environment: \"node\",\n testTimeout: 30000,\n coverage: {\n all: false,\n provider: undefined,\n },\n };\n }\n\n /**\n * Sets the test environment.\n *\n * @param environment -\n * The test environment to use.\n *\n * @returns\n * This object.\n */\n public environment(environment: VitestEnvironment) {\n this.test.environment = environment;\n return this;\n }\n\n /**\n * Sets the test environment to \"node\".\n *\n * @returns\n * This object.\n */\n public node = this.environment.bind(this, \"node\");\n\n /**\n * Sets the test environment to \"happy-dom\".\n *\n * @returns\n * This object.\n */\n public browser = this.environment.bind(this, \"happy-dom\");\n\n /**\n * Sets the test coverage provider.\n *\n * @param provider -\n * The test coverage provider to use.\n *\n * @returns\n * This object.\n */\n public coverage(provider: \"v8\" | \"istanbul\") {\n this.test.coverage.provider = provider;\n return this;\n }\n\n /**\n * Sets the test coverage provider to \"v8\".\n *\n * @returns\n * This object.\n */\n public v8 = this.coverage.bind(this, \"v8\");\n\n /**\n * Sets the test coverage provider to \"istanbul\".\n *\n * @returns\n * This object.\n */\n public istanbul = this.coverage.bind(this, \"istanbul\");\n\n /**\n * Returns the built test configuration.\n *\n * @returns\n * A deep clone of the test configuration.\n */\n public build() {\n return cloneDeep(this.test);\n }\n}\n","import { cloneDeep } from \"lodash-es\";\nimport swc from \"unplugin-swc\";\nimport { LibraryOptions, UserConfig } from \"vite\";\nimport dtsPlugin from \"vite-plugin-dts\";\nimport { externalizeDeps } from \"vite-plugin-externalize-deps\";\nimport tsConfigPaths from \"vite-tsconfig-paths\";\nimport { InlineConfig as TestConfig } from \"vitest/node.js\";\nimport { ZViteLibraryBuilder } from \"./vite-library-builder.mjs\";\nimport { ZViteTestBuilder } from \"./vite-test-builder.mjs\";\n\n/**\n * A config builder for the vite build system.\n *\n * This is helpful when building different types\n * of projects and keeping a standard.\n *\n * @example vite.config.ts\n *\n * ```ts\n * // Before Config Builder\n * export default defineConfig({\n * build: {\n * lib: {\n * entry: {\n * index: \"./src/index.ts\",\n * },\n * formats: [\"cjs\", \"es\"],\n * },\n * },\n * minify: false,\n * sourceMap: true,\n * plugins: [\n * swc.vite(),\n * tsConfigPaths(),\n * externalizeDeps(),\n * dtsPlugin({\n * compilerOptions: {\n * paths: {},\n * },\n * }),\n * ],\n * });\n * ```\n *\n * ```ts\n * // After config builder\n * const config = new ZViteConfigBuilder().library().build();\n * export default defineConfig(config);\n * ```\n */\nexport class ZViteConfigBuilder {\n private config: UserConfig;\n\n /**\n * Initializes a new instance of this object.\n *\n * @param _dirname -\n * The directory that is housing the vite.config\n * file. Pass __dirname to this.\n */\n public constructor(private _dirname: string) {\n this.config = {\n build: {\n minify: true,\n sourcemap: false,\n },\n plugins: [swc.vite(), tsConfigPaths()],\n };\n }\n\n /**\n * Sets vite into library mode.\n *\n * @param options -\n * The options for the library. You can set this to\n * nothing to use the default library which looks for\n * an entry point at the source directory called index.ts\n *\n * @see {@link ZViteLibraryBuilder} for more information.\n *\n * @returns\n * This object.\n */\n public library(\n options: LibraryOptions = new ZViteLibraryBuilder().index().build(),\n ) {\n this.config.build.lib = options;\n\n // There is almost no value to minifying a library unless you\n // are bundling it for importing via html.\n // Thus, just turn off the minify and enable the source map\n // This makes it much easier for other devs to debug problems\n this.config.build.minify = false;\n this.config.build.sourcemap = true;\n\n // When using a library, we also want to make sure we externalize the\n // dependencies automatically -> it blows my mind why vite doesn't\n // do this out of the box. I guess there's some reason or some\n // use case to bundle all the dependencies; I just don't see it.\n this.config.plugins = [\n ...this.config.plugins,\n externalizeDeps(),\n dtsPlugin({\n compilerOptions: {\n // Always turn off paths when building for production. You want to make\n // sure that your build is building in the correct order and that your\n // actual paths are correct.\n paths: {},\n },\n }),\n ];\n\n return this;\n }\n\n /**\n * Constructs the config to act as if it's compiling a node application.\n *\n * This is just an alias to {@link ZViteConfigBuilder.library} with two\n * entry points.\n *\n * 1. The file src/cli.ts is the main entry point of the application.\n * 1. The file, src/index.ts, is the api for importing\n *\n * @returns\n * This object.\n */\n public cli() {\n // A cli works similar to a library. Vite isn't the best when it comes\n // to building complex node apps, but for simple cli tools and non\n // framework based servers, you can do it.\n const library = new ZViteLibraryBuilder()\n .entry(\"index\", \"src/index.ts\")\n .entry(\"cli\", \"src/cli.ts\")\n .build();\n return this.library(library);\n }\n\n /**\n * Constructs the config to be for testing.\n */\n public test(\n options: TestConfig = new ZViteTestBuilder().node().istanbul().build(),\n ) {\n this.config.test = options;\n return this;\n }\n\n /**\n * Returns the currently built config.\n *\n * @returns\n * The currently built config.\n */\n public build() {\n return cloneDeep(this.config);\n }\n}\n"],"names":["ZViteLibraryBuilder","entry","name","path","library","cloneDeep","_define_property","formats","ZViteTestBuilder","environment","test","coverage","provider","node","bind","browser","v8","istanbul","testTimeout","all","undefined","ZViteConfigBuilder","options","index","build","config","lib","minify","sourcemap","plugins","externalizeDeps","dtsPlugin","compilerOptions","paths","_dirname","swc","vite","tsConfigPaths"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAEC,IACM,MAAMA,mBAAAA,CAAAA;AAMX;;;;;;;;;;AAUC,MACD,KAAOC,CAAMC,IAAY,EAAEC,IAAY,EAAE;QACvC,IAAI,CAACC,OAAO,CAACH,KAAK,GAAG,wCACf,IAAI,CAACG,OAAO,CAACH,KAAK,CAAA,EAAA;AACtB,YAAA,CAACC,OAAOC;;AAEV,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;AACb,QAAA,OAAO,IAAI,CAACF,KAAK,CAAC,OAAS,EAAA,gBAAA,CAAA;AAC7B;AAEA;;;;;AAKC,MACD,KAAe,GAAA;QACb,OAAOI,SAAAA,CAAU,IAAI,CAACD,OAAO,CAAA;AAC/B;;AA3CA,QAAAE,kBAAA,CAAA,IAAA,EAAQF,SAA0B,EAAA;AAChCH,YAAAA,KAAAA,EAAO,EAAC;YACRM,OAAS,EAAA;AAAC,gBAAA,IAAA;AAAM,gBAAA;AAAM;AACxB,SAAA,CAAA;;AAyCF;;;;;;;;;;;;;;;AChDA;;AAEC,IACM,MAAMC,gBAAAA,CAAAA;AAiBX;;;;;;;;MASOC,WAAYA,CAAAA,WAA8B,EAAE;AACjD,QAAA,IAAI,CAACC,IAAI,CAACD,WAAW,GAAGA,WAAAA;AACxB,QAAA,OAAO,IAAI;AACb;AAkBA;;;;;;;;MASOE,QAASC,CAAAA,QAA2B,EAAE;AAC3C,QAAA,IAAI,CAACF,IAAI,CAACC,QAAQ,CAACC,QAAQ,GAAGA,QAAAA;AAC9B,QAAA,OAAO,IAAI;AACb;AAkBA;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der.mts","../src/vite/vite-test-builder.mts","../src/vite/vite-config-builder.mts","../src/vite/vite-server-builder.mts"],"sourcesContent":["import { cloneDeep } from \"lodash-es\";\nimport type { LibraryOptions } from \"vite\";\n\n/**\n * A builder for Vite library configurations.\n */\nexport class ZViteLibraryBuilder {\n private library: LibraryOptions = {\n entry: {},\n formats: [\"es\", \"cjs\"],\n };\n\n /**\n * Adds an entry point to the library.\n *\n * @param name -\n * The name of the entry point.\n * @param path -\n * The path to the entry point file.\n *\n * @returns\n * This object.\n */\n public entry(name: string, path: string) {\n this.library.entry = {\n ...(this.library.entry as Record<string, string>),\n [name]: path,\n };\n return this;\n }\n\n /**\n * A shorthand for adding an entry point\n * named \"index\" that points to \"src/index.ts\"\n *\n * @returns\n * This object.\n */\n public index() {\n return this.entry(\"index\", \"./src/index.ts\");\n }\n\n /**\n * Returns the built library configuration.\n *\n * @returns\n * A deep clone of the library configuration.\n */\n public build() {\n return cloneDeep(this.library);\n }\n}\n","import { cloneDeep } from \"lodash-es\";\nimport type { InlineConfig, VitestEnvironment } from \"vitest/node\";\n\n/**\n * A builder for test configurations found in vite's defineConfig test field.\n */\nexport class ZViteTestBuilder {\n private test: InlineConfig;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this.test = {\n environment: \"node\",\n testTimeout: 30000,\n coverage: {\n all: false,\n provider: undefined,\n },\n };\n }\n\n /**\n * Sets the test environment.\n *\n * @param environment -\n * The test environment to use.\n *\n * @returns\n * This object.\n */\n public environment(environment: VitestEnvironment) {\n this.test.environment = environment;\n return this;\n }\n\n /**\n * Sets the test environment to \"node\".\n *\n * @returns\n * This object.\n */\n public node = this.environment.bind(this, \"node\");\n\n /**\n * Sets the test environment to \"happy-dom\".\n *\n * @returns\n * This object.\n */\n public browser = this.environment.bind(this, \"happy-dom\");\n\n /**\n * Sets the test coverage provider.\n *\n * @param provider -\n * The test coverage provider to use.\n *\n * @returns\n * This object.\n */\n public coverage(provider: \"v8\" | \"istanbul\") {\n this.test.coverage = { ...this.test.coverage, provider };\n return this;\n }\n\n /**\n * Sets the test coverage provider to \"v8\".\n *\n * @returns\n * This object.\n */\n public v8 = this.coverage.bind(this, \"v8\");\n\n /**\n * Sets the test coverage provider to \"istanbul\".\n *\n * @returns\n * This object.\n */\n public istanbul = this.coverage.bind(this, \"istanbul\");\n\n /**\n * Adds to the list of projects.\n *\n * @param project -\n * The list of projects.\n *\n * @returns\n * This object.\n */\n public project(project: string | string[] = []) {\n const projects = this.test.projects || [];\n this.test.projects = projects.concat(project);\n return this;\n }\n\n /**\n * Adds monorepo support to the test builder.\n *\n * @param packages -\n * The path to the package directory.\n *\n * @returns\n * This object.\n */\n public monorepo(packages = \"packages\") {\n return this.project(`${packages}/*/vitest.config.{js,cjs,mjs,ts,mts}`);\n }\n\n /**\n * Returns the built test configuration.\n *\n * @returns\n * A deep clone of the test configuration.\n */\n public build() {\n return cloneDeep(this.test);\n }\n}\n","import { castArray, cloneDeep } from \"lodash-es\";\nimport swc from \"unplugin-swc\";\nimport type {\n LibraryOptions,\n PluginOption,\n ServerOptions,\n UserConfig,\n} from \"vite\";\nimport { checker } from \"vite-plugin-checker\";\nimport dtsPlugin from \"vite-plugin-dts\";\nimport { externalizeDeps } from \"vite-plugin-externalize-deps\";\nimport tsConfigPaths from \"vite-tsconfig-paths\";\nimport type { InlineConfig as TestConfig } from \"vitest/node.js\";\nimport { ZViteLibraryBuilder } from \"./vite-library-builder.mjs\";\nimport { ZViteTestBuilder } from \"./vite-test-builder.mjs\";\n\n/**\n * A config builder for the vite build system.\n *\n * This is helpful when building different types\n * of projects and keeping a standard.\n *\n * @example vite.config.ts\n *\n * ```ts\n * // Before Config Builder\n * export default defineConfig({\n * build: {\n * lib: {\n * entry: {\n * index: \"./src/index.ts\",\n * },\n * formats: [\"cjs\", \"es\"],\n * },\n * },\n * minify: false,\n * sourceMap: true,\n * plugins: [\n * swc.vite(),\n * tsConfigPaths(),\n * externalizeDeps(),\n * dtsPlugin({\n * compilerOptions: {\n * paths: {},\n * },\n * }),\n * ],\n * });\n * ```\n *\n * ```ts\n * // After config builder\n * const config = new ZViteConfigBuilder().library().build();\n * export default defineConfig(config);\n * ```\n */\nexport class ZViteConfigBuilder {\n private config: UserConfig;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this.config = {\n build: {\n minify: true,\n sourcemap: false,\n },\n plugins: [swc.vite(), tsConfigPaths()],\n };\n }\n\n /**\n * Sets whether to minify the build output.\n *\n * @param minify -\n * The flag as to minify the output.\n *\n * @returns\n * This object.\n */\n public minify(minify = true) {\n this.config.build = { ...this.config.build, minify };\n return this;\n }\n\n /**\n * Adds a list of plugins.\n *\n * @param option -\n * The plugins to add.\n *\n * @returns\n * This object.\n */\n public plugin(option: PluginOption | PluginOption[] = []) {\n // See constructor - the config plugins are guaranteed to\n // be set. The swc and paths plugins are automatically added.\n const plugins = this.config.plugins!;\n this.config.plugins = plugins.concat(castArray(option));\n return this;\n }\n\n /**\n * Sets whether to generate source maps.\n *\n * @param sourcemap -\n * True to generate a sourcemap, false for faster build.\n *\n * @returns\n * This object.\n */\n public sourceMap(sourcemap = true) {\n this.config.build = { ...this.config.build, sourcemap };\n return this;\n }\n\n /**\n * Assigns the server options.\n *\n * @param options -\n * The server options to assign.\n *\n * @returns\n * This object.\n */\n public server(options: ServerOptions) {\n this.config.server = cloneDeep(options);\n return this;\n }\n\n /**\n * Sets vite into library mode.\n *\n * @param lib -\n * The options for the library. You can set this to\n * nothing to use the default library which looks for\n * an entry point at the source directory called index.ts\n *\n * @see {@link ZViteLibraryBuilder} for more information.\n *\n * @returns\n * This object.\n */\n public library(\n lib: LibraryOptions = new ZViteLibraryBuilder().index().build(),\n ) {\n this.config.build = { ...this.config.build, lib };\n\n const dts = dtsPlugin({\n compilerOptions: {\n // Always turn off paths when building for production. You want to make\n // sure that your build is building in the correct order and that your\n // actual paths are correct.\n paths: {},\n },\n });\n const external = externalizeDeps();\n\n return this.minify(false).sourceMap().plugin(external).plugin(dts);\n }\n\n /**\n * Constructs the config to act as if it's compiling a node application.\n *\n * This is just an alias to {@link ZViteConfigBuilder.library} with two\n * entry points.\n *\n * 1. The file src/cli.ts is the main entry point of the application.\n * 1. The file, src/index.ts, is the api for importing\n *\n * @returns\n * This object.\n */\n public cli() {\n // A cli works similar to a library.\n const library = new ZViteLibraryBuilder()\n .entry(\"index\", \"src/index.ts\")\n .entry(\"cli\", \"src/cli.ts\")\n .build();\n return this.library(library);\n }\n\n /**\n * Constructs the config to act as if it's compiling a nest application.\n *\n * This is just an alias to {@link ZViteConfigBuilder.library} with a single\n * entry point.\n *\n * 1. The file, src/main.mts\n *\n * @returns\n * This object.\n */\n public nest() {\n const library = new ZViteLibraryBuilder()\n .entry(\"main\", \"src/main.mts\")\n .build();\n return this.library(library);\n }\n\n /**\n * Constructs the config to act as if it's compiling a web application.\n *\n * @returns\n * This object.\n */\n public web() {\n return this.minify()\n .sourceMap(false)\n .plugin(checker({ typescript: true }));\n }\n\n /**\n * An alias to {@link web}\n *\n * @returns\n * This object.\n */\n public react = this.web;\n\n /**\n * Constructs the config to be for testing.\n *\n * @param options -\n * The test config to use. If this is falsy,\n * then a test setup using a monorepo with an\n * istanbul provider in node is used.\n */\n public test(\n options: TestConfig = new ZViteTestBuilder()\n .node()\n .istanbul()\n .monorepo()\n .build(),\n ) {\n this.config.test = options;\n return this;\n }\n\n /**\n * Returns the currently built config.\n *\n * @returns\n * The currently built config.\n */\n public build() {\n return cloneDeep(this.config);\n }\n}\n","import { cloneDeep, isUndefined, omitBy } from \"lodash-es\";\nimport type { ServerOptions } from \"vite\";\n\nexport class ZViteServerBuilder {\n private options: ServerOptions = {};\n\n public allowedHost(name: string | string[] | true) {\n if (name === true) {\n this.options.allowedHosts = true;\n } else if (this.options.allowedHosts !== true) {\n const hosts = this.options.allowedHosts || [];\n this.options.allowedHosts = hosts.concat(name);\n }\n\n return this;\n }\n\n public denyAllHosts() {\n delete this.options.allowedHosts;\n return this;\n }\n\n public port(port?: number) {\n this.options.port = port;\n return this;\n }\n\n public strictPort() {\n this.options.strictPort = true;\n return this;\n }\n\n public host(ip: string) {\n this.options.host = ip;\n return this;\n }\n\n public localhost = this.host.bind(this, \"127.0.0.1\");\n\n public dev() {\n return this.strictPort().host(\"0.0.0.0\").allowedHost(true);\n }\n\n public build() {\n const clone = cloneDeep(this.options);\n return omitBy<ServerOptions>(clone, isUndefined) as ServerOptions;\n }\n}\n"],"names":["ZViteLibraryBuilder","entry","name","path","library","_object_spread_props","cloneDeep","_define_property","formats","ZViteTestBuilder","environment","test","coverage","provider","project","projects","concat","monorepo","packages","node","bind","browser","v8","istanbul","testTimeout","all","undefined","ZViteConfigBuilder","minify","config","build","plugin","option","plugins","castArray","sourceMap","sourcemap","server","options","lib","index","dts","dtsPlugin","compilerOptions","paths","external","externalizeDeps","checker","typescript","react","web","swc","vite","tsConfigPaths","ZViteServerBuilder","allowedHost","allowedHosts","hosts","denyAllHosts","port","strictPort","host","ip","dev","clone","omitBy","isUndefined","localhost"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAEC,IACM,MAAMA,mBAAAA,CAAAA;AAMX;;;;;;;;;;AAUC,MACD,KAAOC,CAAMC,IAAY,EAAEC,IAAY,EAAE;QACvC,IAAI,CAACC,OAAO,CAACH,KAAK,GAAGI,4CACf,IAAI,CAACD,OAAO,CAACH,KAAK,CAAA,EAAA;AACtB,YAAA,CAACC,OAAOC;;AAEV,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;AACb,QAAA,OAAO,IAAI,CAACF,KAAK,CAAC,OAAS,EAAA,gBAAA,CAAA;AAC7B;AAEA;;;;;AAKC,MACD,KAAe,GAAA;QACb,OAAOK,SAAAA,CAAU,IAAI,CAACF,OAAO,CAAA;AAC/B;;AA3CA,QAAAG,kBAAA,CAAA,IAAA,EAAQH,SAA0B,EAAA;AAChCH,YAAAA,KAAAA,EAAO,EAAC;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19.
|
|
3
|
+
"version": "19.1.0",
|
|
4
4
|
"description": "A shared configuration for builds that create websites, apis, and tests",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.mts",
|
|
@@ -31,24 +31,28 @@
|
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@swc/core": "^1.11.
|
|
34
|
+
"@swc/core": "^1.11.31",
|
|
35
35
|
"lodash-es": "^4.17.21",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"vite": "^6.3.5",
|
|
36
|
+
"unplugin-swc": "^1.5.4",
|
|
37
|
+
"vite-plugin-checker": "^0.9.3",
|
|
39
38
|
"vite-plugin-dts": "^4.5.4",
|
|
40
39
|
"vite-plugin-externalize-deps": "^0.9.0",
|
|
41
|
-
"vite-tsconfig-paths": "^5.1.4"
|
|
42
|
-
"vitest": "^3.1.4"
|
|
40
|
+
"vite-tsconfig-paths": "^5.1.4"
|
|
43
41
|
},
|
|
44
42
|
"devDependencies": {
|
|
45
|
-
"typescript": "~5.8.3"
|
|
43
|
+
"typescript": "~5.8.3",
|
|
44
|
+
"vite": "^6.3.5",
|
|
45
|
+
"vitest": "^3.2.2"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
+
"typedoc": ">=0.28.5",
|
|
48
49
|
"vite": ">=6.0.0 <7.0.0",
|
|
49
|
-
"vitest": ">=3.
|
|
50
|
+
"vitest": ">=3.2.0 <4.0.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependenciesMeta": {
|
|
53
|
+
"typedoc": {
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
52
56
|
"vite": {
|
|
53
57
|
"optional": true
|
|
54
58
|
},
|
|
@@ -60,5 +64,5 @@
|
|
|
60
64
|
"access": "public"
|
|
61
65
|
},
|
|
62
66
|
"author": "Anthony Bonta",
|
|
63
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "bffd8ac7224b5b19ac3e60a0f6a339a1d4e3a0e1"
|
|
64
68
|
}
|