@zthun/janitor-build-config 19.2.0 → 19.2.2

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/vite.js CHANGED
@@ -1,18 +1,62 @@
1
- import react from "@vitejs/plugin-react";
2
- import { cloneDeep, castArray, omitBy, isUndefined } from "lodash-es";
3
- import swc from "unplugin-swc";
4
- import { checker } from "vite-plugin-checker";
5
- import dtsPlugin from "vite-plugin-dts";
6
- import { externalizeDeps } from "vite-plugin-externalize-deps";
7
- import tsConfigPaths from "vite-tsconfig-paths";
8
- class ZViteLibraryBuilder {
9
- constructor() {
10
- this.library = {
11
- entry: {},
12
- formats: ["es", "cjs"]
13
- };
14
- }
15
- /**
1
+ import react from '@vitejs/plugin-react';
2
+ import { cloneDeep, castArray, omitBy, isUndefined } from 'lodash-es';
3
+ import swc from 'unplugin-swc';
4
+ import { checker } from 'vite-plugin-checker';
5
+ import dtsPlugin from 'vite-plugin-dts';
6
+ import { externalizeDeps } from 'vite-plugin-externalize-deps';
7
+ import tsConfigPaths from 'vite-tsconfig-paths';
8
+
9
+ function _define_property$3(obj, key, value) {
10
+ if (key in obj) {
11
+ Object.defineProperty(obj, key, {
12
+ value: value,
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true
16
+ });
17
+ } else {
18
+ obj[key] = value;
19
+ }
20
+ return obj;
21
+ }
22
+ function _object_spread$2(target) {
23
+ for(var i = 1; i < arguments.length; i++){
24
+ var source = arguments[i] != null ? arguments[i] : {};
25
+ var ownKeys = Object.keys(source);
26
+ if (typeof Object.getOwnPropertySymbols === "function") {
27
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
28
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
29
+ }));
30
+ }
31
+ ownKeys.forEach(function(key) {
32
+ _define_property$3(target, key, source[key]);
33
+ });
34
+ }
35
+ return target;
36
+ }
37
+ function ownKeys$2(object, enumerableOnly) {
38
+ var keys = Object.keys(object);
39
+ if (Object.getOwnPropertySymbols) {
40
+ var symbols = Object.getOwnPropertySymbols(object);
41
+ keys.push.apply(keys, symbols);
42
+ }
43
+ return keys;
44
+ }
45
+ function _object_spread_props$2(target, source) {
46
+ source = source != null ? source : {};
47
+ if (Object.getOwnPropertyDescriptors) {
48
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
49
+ } else {
50
+ ownKeys$2(Object(source)).forEach(function(key) {
51
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
52
+ });
53
+ }
54
+ return target;
55
+ }
56
+ /**
57
+ * A builder for Vite library configurations.
58
+ */ class ZViteLibraryBuilder {
59
+ /**
16
60
  * Adds an entry point to the library.
17
61
  *
18
62
  * @param name -
@@ -22,53 +66,91 @@ class ZViteLibraryBuilder {
22
66
  *
23
67
  * @returns
24
68
  * This object.
25
- */
26
- entry(name, path) {
27
- this.library.entry = {
28
- ...this.library.entry,
29
- [name]: path
30
- };
31
- return this;
32
- }
33
- /**
69
+ */ entry(name, path) {
70
+ this.library.entry = _object_spread_props$2(_object_spread$2({}, this.library.entry), {
71
+ [name]: path
72
+ });
73
+ return this;
74
+ }
75
+ /**
34
76
  * A shorthand for adding an entry point
35
77
  * named "index" that points to "src/index.ts"
36
78
  *
37
79
  * @returns
38
80
  * This object.
39
- */
40
- index() {
41
- return this.entry("index", "./src/index.mts");
42
- }
43
- /**
81
+ */ index() {
82
+ return this.entry("index", "./src/index.mts");
83
+ }
84
+ /**
44
85
  * Returns the built library configuration.
45
86
  *
46
87
  * @returns
47
88
  * A deep clone of the library configuration.
48
- */
49
- build() {
50
- return cloneDeep(this.library);
51
- }
89
+ */ build() {
90
+ return cloneDeep(this.library);
91
+ }
92
+ constructor(){
93
+ _define_property$3(this, "library", {
94
+ entry: {},
95
+ formats: [
96
+ "es",
97
+ "cjs"
98
+ ]
99
+ });
100
+ }
52
101
  }
53
- class ZViteTestBuilder {
54
- /**
55
- * Initializes a new instance of this object.
56
- */
57
- constructor() {
58
- this.node = this.environment.bind(this, "node");
59
- this.browser = this.environment.bind(this, "happy-dom");
60
- this.v8 = this.coverage.bind(this, "v8");
61
- this.istanbul = this.coverage.bind(this, "istanbul");
62
- this.test = {
63
- environment: "node",
64
- testTimeout: 3e4,
65
- coverage: {
66
- all: false,
67
- provider: void 0
68
- }
69
- };
70
- }
71
- /**
102
+
103
+ function _define_property$2(obj, key, value) {
104
+ if (key in obj) {
105
+ Object.defineProperty(obj, key, {
106
+ value: value,
107
+ enumerable: true,
108
+ configurable: true,
109
+ writable: true
110
+ });
111
+ } else {
112
+ obj[key] = value;
113
+ }
114
+ return obj;
115
+ }
116
+ function _object_spread$1(target) {
117
+ for(var i = 1; i < arguments.length; i++){
118
+ var source = arguments[i] != null ? arguments[i] : {};
119
+ var ownKeys = Object.keys(source);
120
+ if (typeof Object.getOwnPropertySymbols === "function") {
121
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
122
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
123
+ }));
124
+ }
125
+ ownKeys.forEach(function(key) {
126
+ _define_property$2(target, key, source[key]);
127
+ });
128
+ }
129
+ return target;
130
+ }
131
+ function ownKeys$1(object, enumerableOnly) {
132
+ var keys = Object.keys(object);
133
+ if (Object.getOwnPropertySymbols) {
134
+ var symbols = Object.getOwnPropertySymbols(object);
135
+ keys.push.apply(keys, symbols);
136
+ }
137
+ return keys;
138
+ }
139
+ function _object_spread_props$1(target, source) {
140
+ source = source != null ? source : {};
141
+ if (Object.getOwnPropertyDescriptors) {
142
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
143
+ } else {
144
+ ownKeys$1(Object(source)).forEach(function(key) {
145
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
146
+ });
147
+ }
148
+ return target;
149
+ }
150
+ /**
151
+ * A builder for test configurations found in vite's defineConfig test field.
152
+ */ class ZViteTestBuilder {
153
+ /**
72
154
  * Sets the test environment.
73
155
  *
74
156
  * @param environment -
@@ -76,12 +158,11 @@ class ZViteTestBuilder {
76
158
  *
77
159
  * @returns
78
160
  * This object.
79
- */
80
- environment(environment) {
81
- this.test.environment = environment;
82
- return this;
83
- }
84
- /**
161
+ */ environment(environment) {
162
+ this.test.environment = environment;
163
+ return this;
164
+ }
165
+ /**
85
166
  * Sets the test coverage provider.
86
167
  *
87
168
  * @param provider -
@@ -89,12 +170,13 @@ class ZViteTestBuilder {
89
170
  *
90
171
  * @returns
91
172
  * This object.
92
- */
93
- coverage(provider) {
94
- this.test.coverage = { ...this.test.coverage, provider };
95
- return this;
96
- }
97
- /**
173
+ */ coverage(provider) {
174
+ this.test.coverage = _object_spread_props$1(_object_spread$1({}, this.test.coverage), {
175
+ provider
176
+ });
177
+ return this;
178
+ }
179
+ /**
98
180
  * Adds to the list of projects.
99
181
  *
100
182
  * @param project -
@@ -102,13 +184,12 @@ class ZViteTestBuilder {
102
184
  *
103
185
  * @returns
104
186
  * This object.
105
- */
106
- project(project = []) {
107
- const projects = this.test.projects || [];
108
- this.test.projects = projects.concat(project);
109
- return this;
110
- }
111
- /**
187
+ */ project(project = []) {
188
+ const projects = this.test.projects || [];
189
+ this.test.projects = projects.concat(project);
190
+ return this;
191
+ }
192
+ /**
112
193
  * Adds monorepo support to the test builder.
113
194
  *
114
195
  * @param packages -
@@ -116,35 +197,144 @@ class ZViteTestBuilder {
116
197
  *
117
198
  * @returns
118
199
  * This object.
119
- */
120
- monorepo(packages = "packages") {
121
- return this.project(`${packages}/*/vitest.config.{js,cjs,mjs,ts,mts}`);
122
- }
123
- /**
200
+ */ monorepo(packages = "packages") {
201
+ return this.project(`${packages}/*/vitest.config.{js,cjs,mjs,ts,mts}`);
202
+ }
203
+ /**
124
204
  * Returns the built test configuration.
125
205
  *
126
206
  * @returns
127
207
  * A deep clone of the test configuration.
128
- */
129
- build() {
130
- return cloneDeep(this.test);
131
- }
132
- }
133
- class ZViteConfigBuilder {
134
- /**
208
+ */ build() {
209
+ return cloneDeep(this.test);
210
+ }
211
+ /**
135
212
  * Initializes a new instance of this object.
136
- */
137
- constructor() {
138
- this.lodash = this.alias.bind(this, "lodash", "lodash-es");
139
- this.config = {
140
- build: {
141
- minify: true,
142
- sourcemap: false
143
- },
144
- plugins: [tsConfigPaths()]
145
- };
146
- }
147
- /**
213
+ */ constructor(){
214
+ _define_property$2(this, "test", void 0);
215
+ /**
216
+ * Sets the test environment to "node".
217
+ *
218
+ * @returns
219
+ * This object.
220
+ */ _define_property$2(this, "node", this.environment.bind(this, "node"));
221
+ /**
222
+ * Sets the test environment to "happy-dom".
223
+ *
224
+ * @returns
225
+ * This object.
226
+ */ _define_property$2(this, "browser", this.environment.bind(this, "happy-dom"));
227
+ /**
228
+ * Sets the test coverage provider to "v8".
229
+ *
230
+ * @returns
231
+ * This object.
232
+ */ _define_property$2(this, "v8", this.coverage.bind(this, "v8"));
233
+ /**
234
+ * Sets the test coverage provider to "istanbul".
235
+ *
236
+ * @returns
237
+ * This object.
238
+ */ _define_property$2(this, "istanbul", this.coverage.bind(this, "istanbul"));
239
+ this.test = {
240
+ environment: "node",
241
+ testTimeout: 30000,
242
+ coverage: {
243
+ all: false,
244
+ provider: undefined
245
+ }
246
+ };
247
+ }
248
+ }
249
+
250
+ function _define_property$1(obj, key, value) {
251
+ if (key in obj) {
252
+ Object.defineProperty(obj, key, {
253
+ value: value,
254
+ enumerable: true,
255
+ configurable: true,
256
+ writable: true
257
+ });
258
+ } else {
259
+ obj[key] = value;
260
+ }
261
+ return obj;
262
+ }
263
+ function _object_spread(target) {
264
+ for(var i = 1; i < arguments.length; i++){
265
+ var source = arguments[i] != null ? arguments[i] : {};
266
+ var ownKeys = Object.keys(source);
267
+ if (typeof Object.getOwnPropertySymbols === "function") {
268
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
269
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
270
+ }));
271
+ }
272
+ ownKeys.forEach(function(key) {
273
+ _define_property$1(target, key, source[key]);
274
+ });
275
+ }
276
+ return target;
277
+ }
278
+ function ownKeys(object, enumerableOnly) {
279
+ var keys = Object.keys(object);
280
+ if (Object.getOwnPropertySymbols) {
281
+ var symbols = Object.getOwnPropertySymbols(object);
282
+ keys.push.apply(keys, symbols);
283
+ }
284
+ return keys;
285
+ }
286
+ function _object_spread_props(target, source) {
287
+ source = source != null ? source : {};
288
+ if (Object.getOwnPropertyDescriptors) {
289
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
290
+ } else {
291
+ ownKeys(Object(source)).forEach(function(key) {
292
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
293
+ });
294
+ }
295
+ return target;
296
+ }
297
+ /**
298
+ * A config builder for the vite build system.
299
+ *
300
+ * This is helpful when building different types
301
+ * of projects and keeping a standard.
302
+ *
303
+ * @example vite.config.ts
304
+ *
305
+ * ```ts
306
+ * // Before Config Builder
307
+ * export default defineConfig({
308
+ * build: {
309
+ * lib: {
310
+ * entry: {
311
+ * index: "./src/index.ts",
312
+ * },
313
+ * formats: ["cjs", "es"],
314
+ * },
315
+ * },
316
+ * minify: false,
317
+ * sourceMap: true,
318
+ * plugins: [
319
+ * swc.vite(),
320
+ * tsConfigPaths(),
321
+ * externalizeDeps(),
322
+ * dtsPlugin({
323
+ * compilerOptions: {
324
+ * paths: {},
325
+ * },
326
+ * }),
327
+ * ],
328
+ * });
329
+ * ```
330
+ *
331
+ * ```ts
332
+ * // After config builder
333
+ * const config = new ZViteConfigBuilder().library().build();
334
+ * export default defineConfig(config);
335
+ * ```
336
+ */ class ZViteConfigBuilder {
337
+ /**
148
338
  * Sets whether to minify the build output.
149
339
  *
150
340
  * @param minify -
@@ -152,12 +342,13 @@ class ZViteConfigBuilder {
152
342
  *
153
343
  * @returns
154
344
  * This object.
155
- */
156
- minify(minify = true) {
157
- this.config.build = { ...this.config.build, minify };
158
- return this;
159
- }
160
- /**
345
+ */ minify(minify = true) {
346
+ this.config.build = _object_spread_props(_object_spread({}, this.config.build), {
347
+ minify
348
+ });
349
+ return this;
350
+ }
351
+ /**
161
352
  * Adds a list of plugins.
162
353
  *
163
354
  * @param option -
@@ -165,22 +356,14 @@ class ZViteConfigBuilder {
165
356
  *
166
357
  * @returns
167
358
  * This object.
168
- */
169
- plugin(option = []) {
170
- const plugins = this.config.plugins;
171
- this.config.plugins = plugins.concat(castArray(option));
172
- return this;
173
- }
174
- /**
175
- * Adds the swc plugin.
176
- *
177
- * This is mostly for nest projects as nest requires
178
- * swc to support decorators.
179
- */
180
- swc() {
181
- return this.plugin(swc.vite());
182
- }
183
- /**
359
+ */ plugin(option = []) {
360
+ // See constructor - the config plugins are guaranteed to
361
+ // be set. The swc and paths plugins are automatically added.
362
+ const plugins = this.config.plugins;
363
+ this.config.plugins = plugins.concat(castArray(option));
364
+ return this;
365
+ }
366
+ /**
184
367
  * Sets whether to generate source maps.
185
368
  *
186
369
  * @param sourcemap -
@@ -188,12 +371,13 @@ class ZViteConfigBuilder {
188
371
  *
189
372
  * @returns
190
373
  * This object.
191
- */
192
- sourceMap(sourcemap = true) {
193
- this.config.build = { ...this.config.build, sourcemap };
194
- return this;
195
- }
196
- /**
374
+ */ sourceMap(sourcemap = true) {
375
+ this.config.build = _object_spread_props(_object_spread({}, this.config.build), {
376
+ sourcemap
377
+ });
378
+ return this;
379
+ }
380
+ /**
197
381
  * Adds an alias to the resolution options.
198
382
  *
199
383
  * @param key -
@@ -203,14 +387,13 @@ class ZViteConfigBuilder {
203
387
  *
204
388
  * @returns
205
389
  * This object.
206
- */
207
- alias(key, value) {
208
- this.config.resolve = this.config.resolve || {};
209
- this.config.resolve.alias = this.config.resolve.alias || {};
210
- this.config.resolve.alias[key] = value;
211
- return this;
212
- }
213
- /**
390
+ */ alias(key, value) {
391
+ this.config.resolve = this.config.resolve || {};
392
+ this.config.resolve.alias = this.config.resolve.alias || {};
393
+ this.config.resolve.alias[key] = value;
394
+ return this;
395
+ }
396
+ /**
214
397
  * Assigns the server options.
215
398
  *
216
399
  * @param options -
@@ -218,12 +401,11 @@ class ZViteConfigBuilder {
218
401
  *
219
402
  * @returns
220
403
  * This object.
221
- */
222
- server(options) {
223
- this.config.server = cloneDeep(options);
224
- return this;
225
- }
226
- /**
404
+ */ server(options) {
405
+ this.config.server = cloneDeep(options);
406
+ return this;
407
+ }
408
+ /**
227
409
  * Sets vite into library mode.
228
410
  *
229
411
  * @param lib -
@@ -235,37 +417,38 @@ class ZViteConfigBuilder {
235
417
  *
236
418
  * @returns
237
419
  * This object.
238
- */
239
- library(lib = new ZViteLibraryBuilder().index().build()) {
240
- this.config.build = { ...this.config.build, lib };
241
- const dts = dtsPlugin({
242
- compilerOptions: {
243
- // Always turn off paths when building for production. You want to make
244
- // sure that your build is building in the correct order and that your
245
- // actual paths are correct.
246
- paths: {}
247
- }
248
- });
249
- const external = externalizeDeps();
250
- return this.minify(false).sourceMap().plugin(external).plugin(dts);
251
- }
252
- /**
420
+ */ library(lib = new ZViteLibraryBuilder().index().build()) {
421
+ this.config.build = _object_spread_props(_object_spread({}, this.config.build), {
422
+ lib
423
+ });
424
+ const dts = dtsPlugin({
425
+ compilerOptions: {
426
+ // Always turn off paths when building for production. You want to make
427
+ // sure that your build is building in the correct order and that your
428
+ // actual paths are correct.
429
+ paths: {}
430
+ }
431
+ });
432
+ const external = externalizeDeps();
433
+ return this.minify(false).sourceMap().plugin(external).plugin(dts);
434
+ }
435
+ /**
253
436
  * Constructs the config to act as if it's compiling a node application.
254
437
  *
255
438
  * This is just an alias to {@link ZViteConfigBuilder.library} with two
256
439
  * entry points.
257
440
  *
258
441
  * 1. The file src/cli.ts is the main entry point of the application.
259
- * 1. The file, src/index.ts, is the api for importing
442
+ * 1. The file, src/index.ts, is the api for importing and using it as an api.
260
443
  *
261
444
  * @returns
262
445
  * This object.
263
- */
264
- cli() {
265
- const library = new ZViteLibraryBuilder().entry("index", "src/index.mts").entry("cli", "src/cli.mts").build();
266
- return this.library(library);
267
- }
268
- /**
446
+ */ cli() {
447
+ // A cli works similar to a library.
448
+ const library = new ZViteLibraryBuilder().entry("index", "src/index.mts").entry("cli", "src/cli.mts").build();
449
+ return this.library(library);
450
+ }
451
+ /**
269
452
  * Constructs the config to act as if it's compiling a nest application.
270
453
  *
271
454
  * This is just an alias to {@link ZViteConfigBuilder.library} with a single
@@ -275,93 +458,129 @@ class ZViteConfigBuilder {
275
458
  *
276
459
  * @returns
277
460
  * This object.
278
- */
279
- nest() {
280
- const library = new ZViteLibraryBuilder().entry("main", "src/main.mts").build();
281
- return this.library(library).swc();
282
- }
283
- /**
461
+ */ nest() {
462
+ const library = new ZViteLibraryBuilder().entry("main", "src/main.mts").build();
463
+ return this.library(library);
464
+ }
465
+ /**
284
466
  * Constructs the config to act as if it's compiling a web application.
285
467
  *
286
468
  * @returns
287
469
  * This object.
288
- */
289
- web() {
290
- return this.minify().sourceMap(false).plugin(checker({ typescript: true }));
291
- }
292
- /**
470
+ */ web() {
471
+ return this.minify().sourceMap(false).plugin(checker({
472
+ typescript: true
473
+ }));
474
+ }
475
+ /**
293
476
  * Constructs the config to compile a react application.
294
477
  *
295
478
  * @returns
296
479
  * This object.
297
- */
298
- react() {
299
- return this.web().plugin(react());
300
- }
301
- /**
480
+ */ react() {
481
+ return this.web().plugin(react());
482
+ }
483
+ /**
302
484
  * Constructs the config to be for testing.
303
485
  *
304
486
  * @param options -
305
487
  * The test config to use. If this is falsy,
306
488
  * then a test setup using a monorepo with an
307
489
  * istanbul provider in node is used.
308
- */
309
- test(options = new ZViteTestBuilder().node().istanbul().monorepo().build()) {
310
- this.config.test = options;
311
- return this;
312
- }
313
- /**
490
+ */ test(options = new ZViteTestBuilder().node().istanbul().monorepo().build()) {
491
+ this.config.test = options;
492
+ return this;
493
+ }
494
+ /**
314
495
  * Returns the currently built config.
315
496
  *
316
497
  * @returns
317
498
  * The currently built config.
318
- */
319
- build() {
320
- return cloneDeep(this.config);
321
- }
499
+ */ build() {
500
+ return cloneDeep(this.config);
501
+ }
502
+ /**
503
+ * Initializes a new instance of this object.
504
+ */ constructor(){
505
+ _define_property$1(this, "config", void 0);
506
+ /**
507
+ * Adds an alias for lodash to lodash-es.
508
+ *
509
+ * @returns
510
+ * This object.
511
+ */ _define_property$1(this, "lodash", this.alias.bind(this, "lodash", "lodash-es"));
512
+ this.config = {
513
+ build: {
514
+ minify: true,
515
+ sourcemap: false
516
+ },
517
+ plugins: [
518
+ swc.vite({
519
+ jsc: {
520
+ transform: {
521
+ react: {
522
+ runtime: "automatic"
523
+ }
524
+ }
525
+ }
526
+ }),
527
+ tsConfigPaths()
528
+ ]
529
+ };
530
+ }
531
+ }
532
+
533
+ function _define_property(obj, key, value) {
534
+ if (key in obj) {
535
+ Object.defineProperty(obj, key, {
536
+ value: value,
537
+ enumerable: true,
538
+ configurable: true,
539
+ writable: true
540
+ });
541
+ } else {
542
+ obj[key] = value;
543
+ }
544
+ return obj;
322
545
  }
323
546
  class ZViteServerBuilder {
324
- constructor() {
325
- this.options = {};
326
- this.localhost = this.host.bind(this, "127.0.0.1");
327
- }
328
- allowedHost(name) {
329
- if (name === true) {
330
- this.options.allowedHosts = true;
331
- } else if (this.options.allowedHosts !== true) {
332
- const hosts = this.options.allowedHosts || [];
333
- this.options.allowedHosts = hosts.concat(name);
334
- }
335
- return this;
336
- }
337
- denyAllHosts() {
338
- delete this.options.allowedHosts;
339
- return this;
340
- }
341
- port(port) {
342
- this.options.port = port;
343
- return this;
344
- }
345
- strictPort() {
346
- this.options.strictPort = true;
347
- return this;
348
- }
349
- host(ip) {
350
- this.options.host = ip;
351
- return this;
352
- }
353
- dev() {
354
- return this.strictPort().host("0.0.0.0").allowedHost(true);
355
- }
356
- build() {
357
- const clone = cloneDeep(this.options);
358
- return omitBy(clone, isUndefined);
359
- }
547
+ allowedHost(name) {
548
+ if (name === true) {
549
+ this.options.allowedHosts = true;
550
+ } else if (this.options.allowedHosts !== true) {
551
+ const hosts = this.options.allowedHosts || [];
552
+ this.options.allowedHosts = hosts.concat(name);
553
+ }
554
+ return this;
555
+ }
556
+ denyAllHosts() {
557
+ delete this.options.allowedHosts;
558
+ return this;
559
+ }
560
+ port(port) {
561
+ this.options.port = port;
562
+ return this;
563
+ }
564
+ strictPort() {
565
+ this.options.strictPort = true;
566
+ return this;
567
+ }
568
+ host(ip) {
569
+ this.options.host = ip;
570
+ return this;
571
+ }
572
+ dev() {
573
+ return this.strictPort().host("0.0.0.0").allowedHost(true);
574
+ }
575
+ build() {
576
+ const clone = cloneDeep(this.options);
577
+ return omitBy(clone, isUndefined);
578
+ }
579
+ constructor(){
580
+ _define_property(this, "options", {});
581
+ _define_property(this, "localhost", this.host.bind(this, "127.0.0.1"));
582
+ }
360
583
  }
361
- export {
362
- ZViteConfigBuilder,
363
- ZViteLibraryBuilder,
364
- ZViteServerBuilder,
365
- ZViteTestBuilder
366
- };
584
+
585
+ export { ZViteConfigBuilder, ZViteLibraryBuilder, ZViteServerBuilder, ZViteTestBuilder };
367
586
  //# sourceMappingURL=vite.js.map