@zthun/janitor-build-config 19.4.0 → 19.4.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.
@@ -1,5 +1,6 @@
1
- import { LibraryOptions, PluginOption, ServerOptions, UserConfig } from 'vite';
2
- import { InlineConfig as TestConfig } from 'vitest/node.js';
1
+ import { LibraryOptions, PluginOption, ServerOptions } from 'vite';
2
+ import { ViteUserConfig } from 'vitest/config';
3
+ import { InlineConfig } from 'vitest/node';
3
4
  /**
4
5
  * A config builder for the vite build system.
5
6
  *
@@ -162,16 +163,14 @@ export declare class ZViteConfigBuilder {
162
163
  * Constructs the config to be for testing.
163
164
  *
164
165
  * @param options -
165
- * The test config to use. If this is falsy,
166
- * then a test setup using a monorepo with the default
167
- * provider and environment will be used.
166
+ * The test config to use.
168
167
  */
169
- test(options?: TestConfig): this;
168
+ test(options: InlineConfig): this;
170
169
  /**
171
170
  * Returns the currently built config.
172
171
  *
173
172
  * @returns
174
173
  * The currently built config.
175
174
  */
176
- build(): UserConfig;
175
+ build(): ViteUserConfig;
177
176
  }
package/dist/vite.cjs CHANGED
@@ -183,171 +183,6 @@ function _object_spread_props$1(target, source) {
183
183
  }
184
184
  return target;
185
185
  }
186
- /**
187
- * A builder for test configurations found in vite's defineConfig test field.
188
- */ class ZViteTestBuilder {
189
- /**
190
- * Sets the test environment.
191
- *
192
- * @param environment -
193
- * The test environment to use.
194
- *
195
- * @returns
196
- * This object.
197
- */ environment(environment) {
198
- this.test.environment = environment;
199
- return this;
200
- }
201
- /**
202
- * Sets the test coverage provider.
203
- *
204
- * @param provider -
205
- * The test coverage provider to use.
206
- *
207
- * @returns
208
- * This object.
209
- */ coverage(provider) {
210
- this.test.coverage = _object_spread_props$1(_object_spread$1({}, this.test.coverage), {
211
- provider
212
- });
213
- return this;
214
- }
215
- /**
216
- * Adds to the list of projects.
217
- *
218
- * @param project -
219
- * The list of projects.
220
- *
221
- * @returns
222
- * This object.
223
- */ project(project = []) {
224
- const projects = this.test.projects || [];
225
- this.test.projects = projects.concat(project);
226
- return this;
227
- }
228
- /**
229
- * Adds monorepo support to the test builder.
230
- *
231
- * @param packages -
232
- * The path to the package directory.
233
- *
234
- * @returns
235
- * This object.
236
- */ monorepo(packages = "packages") {
237
- return this.project(`${packages}/*/vitest.config.{js,cjs,mjs,ts,mts}`);
238
- }
239
- /**
240
- * This sets the max concurrency to one and resets
241
- * the environment after every test.
242
- *
243
- * Use this in the case that you want to have
244
- * strategic tests that can step over one another. For example,
245
- * writing to the file system and deleting from the file system
246
- * can have race conditions. If your app or library tests heavily
247
- * depend on those operations, then you should run your tests serially.
248
- *
249
- * @returns
250
- * This object.
251
- */ runSerially() {
252
- this.test.fileParallelism = false;
253
- this.test.maxConcurrency = 1;
254
- this.test.isolate = true;
255
- return this;
256
- }
257
- /**
258
- * Returns the built test configuration.
259
- *
260
- * @returns
261
- * A deep clone of the test configuration.
262
- */ build() {
263
- return lodashEs.cloneDeep(this.test);
264
- }
265
- /**
266
- * Initializes a new instance of this object.
267
- */ constructor(){
268
- _define_property$2(this, "test", void 0);
269
- /**
270
- * Sets the test environment to "node".
271
- *
272
- * @returns
273
- * This object.
274
- */ _define_property$2(this, "node", this.environment.bind(this, "node"));
275
- /**
276
- * Sets the test environment to "happy-dom".
277
- *
278
- * @returns
279
- * This object.
280
- */ _define_property$2(this, "browser", this.environment.bind(this, "happy-dom"));
281
- /**
282
- * Sets the test coverage provider to "v8".
283
- *
284
- * @returns
285
- * This object.
286
- */ _define_property$2(this, "v8", this.coverage.bind(this, "v8"));
287
- /**
288
- * Sets the test coverage provider to "istanbul".
289
- *
290
- * @returns
291
- * This object.
292
- */ _define_property$2(this, "istanbul", this.coverage.bind(this, "istanbul"));
293
- this.test = {
294
- environment: "node",
295
- testTimeout: 30000,
296
- coverage: {
297
- all: false,
298
- provider: "v8"
299
- }
300
- };
301
- }
302
- }
303
-
304
- function _define_property$1(obj, key, value) {
305
- if (key in obj) {
306
- Object.defineProperty(obj, key, {
307
- value: value,
308
- enumerable: true,
309
- configurable: true,
310
- writable: true
311
- });
312
- } else {
313
- obj[key] = value;
314
- }
315
- return obj;
316
- }
317
- function _object_spread(target) {
318
- for(var i = 1; i < arguments.length; i++){
319
- var source = arguments[i] != null ? arguments[i] : {};
320
- var ownKeys = Object.keys(source);
321
- if (typeof Object.getOwnPropertySymbols === "function") {
322
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
323
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
324
- }));
325
- }
326
- ownKeys.forEach(function(key) {
327
- _define_property$1(target, key, source[key]);
328
- });
329
- }
330
- return target;
331
- }
332
- function ownKeys(object, enumerableOnly) {
333
- var keys = Object.keys(object);
334
- if (Object.getOwnPropertySymbols) {
335
- var symbols = Object.getOwnPropertySymbols(object);
336
- keys.push.apply(keys, symbols);
337
- }
338
- return keys;
339
- }
340
- function _object_spread_props(target, source) {
341
- source = source != null ? source : {};
342
- if (Object.getOwnPropertyDescriptors) {
343
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
344
- } else {
345
- ownKeys(Object(source)).forEach(function(key) {
346
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
347
- });
348
- }
349
- return target;
350
- }
351
186
  /**
352
187
  * A config builder for the vite build system.
353
188
  *
@@ -397,7 +232,7 @@ function _object_spread_props(target, source) {
397
232
  * @returns
398
233
  * This object.
399
234
  */ minify(minify = true) {
400
- this.config.build = _object_spread_props(_object_spread({}, this.config.build), {
235
+ this.config.build = _object_spread_props$1(_object_spread$1({}, this.config.build), {
401
236
  minify
402
237
  });
403
238
  return this;
@@ -426,7 +261,7 @@ function _object_spread_props(target, source) {
426
261
  * @returns
427
262
  * This object.
428
263
  */ sourceMap(sourcemap = true) {
429
- this.config.build = _object_spread_props(_object_spread({}, this.config.build), {
264
+ this.config.build = _object_spread_props$1(_object_spread$1({}, this.config.build), {
430
265
  sourcemap
431
266
  });
432
267
  return this;
@@ -472,7 +307,7 @@ function _object_spread_props(target, source) {
472
307
  * @returns
473
308
  * This object.
474
309
  */ library(lib = new ZViteLibraryBuilder().index().build()) {
475
- this.config.build = _object_spread_props(_object_spread({}, this.config.build), {
310
+ this.config.build = _object_spread_props$1(_object_spread$1({}, this.config.build), {
476
311
  lib
477
312
  });
478
313
  const dts = dtsPlugin({
@@ -542,10 +377,8 @@ function _object_spread_props(target, source) {
542
377
  * Constructs the config to be for testing.
543
378
  *
544
379
  * @param options -
545
- * The test config to use. If this is falsy,
546
- * then a test setup using a monorepo with the default
547
- * provider and environment will be used.
548
- */ test(options = new ZViteTestBuilder().monorepo().build()) {
380
+ * The test config to use.
381
+ */ test(options) {
549
382
  this.config.test = options;
550
383
  return this;
551
384
  }
@@ -560,13 +393,13 @@ function _object_spread_props(target, source) {
560
393
  /**
561
394
  * Initializes a new instance of this object.
562
395
  */ constructor(){
563
- _define_property$1(this, "config", void 0);
396
+ _define_property$2(this, "config", void 0);
564
397
  /**
565
398
  * Adds an alias for lodash to lodash-es.
566
399
  *
567
400
  * @returns
568
401
  * This object.
569
- */ _define_property$1(this, "lodash", this.alias.bind(this, "lodash", "lodash-es"));
402
+ */ _define_property$2(this, "lodash", this.alias.bind(this, "lodash", "lodash-es"));
570
403
  this.config = {
571
404
  build: {
572
405
  minify: false,
@@ -588,7 +421,7 @@ function _object_spread_props(target, source) {
588
421
  }
589
422
  }
590
423
 
591
- function _define_property(obj, key, value) {
424
+ function _define_property$1(obj, key, value) {
592
425
  if (key in obj) {
593
426
  Object.defineProperty(obj, key, {
594
427
  value: value,
@@ -635,8 +468,172 @@ class ZViteServerBuilder {
635
468
  return lodashEs.omitBy(clone, lodashEs.isUndefined);
636
469
  }
637
470
  constructor(){
638
- _define_property(this, "options", {});
639
- _define_property(this, "localhost", this.host.bind(this, "127.0.0.1"));
471
+ _define_property$1(this, "options", {});
472
+ _define_property$1(this, "localhost", this.host.bind(this, "127.0.0.1"));
473
+ }
474
+ }
475
+
476
+ function _define_property(obj, key, value) {
477
+ if (key in obj) {
478
+ Object.defineProperty(obj, key, {
479
+ value: value,
480
+ enumerable: true,
481
+ configurable: true,
482
+ writable: true
483
+ });
484
+ } else {
485
+ obj[key] = value;
486
+ }
487
+ return obj;
488
+ }
489
+ function _object_spread(target) {
490
+ for(var i = 1; i < arguments.length; i++){
491
+ var source = arguments[i] != null ? arguments[i] : {};
492
+ var ownKeys = Object.keys(source);
493
+ if (typeof Object.getOwnPropertySymbols === "function") {
494
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
495
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
496
+ }));
497
+ }
498
+ ownKeys.forEach(function(key) {
499
+ _define_property(target, key, source[key]);
500
+ });
501
+ }
502
+ return target;
503
+ }
504
+ function ownKeys(object, enumerableOnly) {
505
+ var keys = Object.keys(object);
506
+ if (Object.getOwnPropertySymbols) {
507
+ var symbols = Object.getOwnPropertySymbols(object);
508
+ keys.push.apply(keys, symbols);
509
+ }
510
+ return keys;
511
+ }
512
+ function _object_spread_props(target, source) {
513
+ source = source != null ? source : {};
514
+ if (Object.getOwnPropertyDescriptors) {
515
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
516
+ } else {
517
+ ownKeys(Object(source)).forEach(function(key) {
518
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
519
+ });
520
+ }
521
+ return target;
522
+ }
523
+ /**
524
+ * A builder for test configurations found in vite's defineConfig test field.
525
+ */ class ZViteTestBuilder {
526
+ /**
527
+ * Sets the test environment.
528
+ *
529
+ * @param environment -
530
+ * The test environment to use.
531
+ *
532
+ * @returns
533
+ * This object.
534
+ */ environment(environment) {
535
+ this.test.environment = environment;
536
+ return this;
537
+ }
538
+ /**
539
+ * Sets the test coverage provider.
540
+ *
541
+ * @param provider -
542
+ * The test coverage provider to use.
543
+ *
544
+ * @returns
545
+ * This object.
546
+ */ coverage(provider) {
547
+ this.test.coverage = _object_spread_props(_object_spread({}, this.test.coverage), {
548
+ provider
549
+ });
550
+ return this;
551
+ }
552
+ /**
553
+ * Adds to the list of projects.
554
+ *
555
+ * @param project -
556
+ * The list of projects.
557
+ *
558
+ * @returns
559
+ * This object.
560
+ */ project(project = []) {
561
+ const projects = this.test.projects || [];
562
+ this.test.projects = projects.concat(project);
563
+ return this;
564
+ }
565
+ /**
566
+ * Adds monorepo support to the test builder.
567
+ *
568
+ * @param packages -
569
+ * The path to the package directory.
570
+ *
571
+ * @returns
572
+ * This object.
573
+ */ monorepo(packages = "packages") {
574
+ return this.project(`${packages}/*/vite.config.{js,cjs,mjs,ts,mts}`);
575
+ }
576
+ /**
577
+ * This sets the max concurrency to one and resets
578
+ * the environment after every test.
579
+ *
580
+ * Use this in the case that you want to have
581
+ * strategic tests that can step over one another. For example,
582
+ * writing to the file system and deleting from the file system
583
+ * can have race conditions. If your app or library tests heavily
584
+ * depend on those operations, then you should run your tests serially.
585
+ *
586
+ * @returns
587
+ * This object.
588
+ */ runSerially() {
589
+ this.test.fileParallelism = false;
590
+ this.test.maxConcurrency = 1;
591
+ this.test.isolate = true;
592
+ return this;
593
+ }
594
+ /**
595
+ * Returns the built test configuration.
596
+ *
597
+ * @returns
598
+ * A deep clone of the test configuration.
599
+ */ build() {
600
+ return lodashEs.cloneDeep(this.test);
601
+ }
602
+ /**
603
+ * Initializes a new instance of this object.
604
+ */ constructor(){
605
+ _define_property(this, "test", void 0);
606
+ /**
607
+ * Sets the test environment to "node".
608
+ *
609
+ * @returns
610
+ * This object.
611
+ */ _define_property(this, "node", this.environment.bind(this, "node"));
612
+ /**
613
+ * Sets the test environment to "happy-dom".
614
+ *
615
+ * @returns
616
+ * This object.
617
+ */ _define_property(this, "browser", this.environment.bind(this, "happy-dom"));
618
+ /**
619
+ * Sets the test coverage provider to "v8".
620
+ *
621
+ * @returns
622
+ * This object.
623
+ */ _define_property(this, "v8", this.coverage.bind(this, "v8"));
624
+ /**
625
+ * Sets the test coverage provider to "istanbul".
626
+ *
627
+ * @returns
628
+ * This object.
629
+ */ _define_property(this, "istanbul", this.coverage.bind(this, "istanbul"));
630
+ this.test = {
631
+ environment: "node",
632
+ testTimeout: 30000,
633
+ coverage: {
634
+ provider: "v8"
635
+ }
636
+ };
640
637
  }
641
638
  }
642
639
 
package/dist/vite.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.cjs","sources":["../src/plugin/vite-plugin-externalize-deps.ts","../src/vite/vite-library-builder.mts","../src/vite/vite-test-builder.mts","../src/vite/vite-config-builder.mts","../src/vite/vite-server-builder.mts"],"sourcesContent":["import { existsSync, readFileSync, type PathLike } from \"node:fs\";\nimport { builtinModules } from \"node:module\";\nimport { resolve } from \"node:path\";\nimport type { Plugin } from \"vite\";\n\n// Original source code from\n// https://github.com/davidmyersdev/vite-plugin-externalize-deps/blob/main/src/index.ts\n// It takes to long to get this plugin updated, so I just copied the source code into\n// here. I don't think this plugin is maintained much anymore. I've greatly reduced the\n// options from this to be just a basic check for stuff in your package.json and node\n// builtins.\n\nexport interface ExternalizeOptions {\n packageJson?: PathLike;\n}\n\nexport const externalizeDeps = (options: ExternalizeOptions = {}): Plugin => {\n const { packageJson = resolve(process.cwd(), \"package.json\") } = options;\n\n return {\n name: \"vite-plugin-externalize-deps\",\n config: () => {\n const externalDeps = new Set<RegExp>();\n\n if (!existsSync(packageJson)) {\n const context = \"janitor-build-config:externalizeDeps\";\n const msg = `[${context}] Could not find package.json at ${packageJson}.`;\n throw new Error(msg);\n }\n\n const contents = readFileSync(packageJson).toString();\n const {\n dependencies = [],\n devDependencies = [],\n optionalDependencies = [],\n peerDependencies = [],\n } = JSON.parse(contents);\n\n const push = externalDeps.add.bind(externalDeps);\n\n Object.keys(dependencies)\n .concat(Object.keys(devDependencies))\n .concat(Object.keys(optionalDependencies))\n .concat(Object.keys(peerDependencies))\n .map((dep) => new RegExp(`^${dep}(?:/.+)?$`))\n .forEach(push);\n\n builtinModules\n .map((module) => new RegExp(`^(?:node:)?${module}$`))\n .forEach(push);\n\n const depMatchers = Array.from(externalDeps);\n\n return {\n build: {\n rollupOptions: {\n external: (source) => {\n return depMatchers.some((depMatcher) => depMatcher.test(source));\n },\n },\n },\n };\n },\n };\n};\n","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.mts\");\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: \"v8\",\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 * This sets the max concurrency to one and resets\n * the environment after every test.\n *\n * Use this in the case that you want to have\n * strategic tests that can step over one another. For example,\n * writing to the file system and deleting from the file system\n * can have race conditions. If your app or library tests heavily\n * depend on those operations, then you should run your tests serially.\n *\n * @returns\n * This object.\n */\n public runSerially() {\n this.test.fileParallelism = false;\n this.test.maxConcurrency = 1;\n this.test.isolate = true;\n\n return this;\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 react from \"@vitejs/plugin-react\";\nimport { 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 tsConfigPaths from \"vite-tsconfig-paths\";\nimport type { InlineConfig as TestConfig } from \"vitest/node.js\";\nimport { externalizeDeps } from \"../plugin/vite-plugin-externalize-deps.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: false,\n sourcemap: true,\n },\n plugins: [\n swc.vite({\n jsc: {\n transform: {\n react: {\n runtime: \"automatic\",\n },\n },\n },\n }),\n tsConfigPaths(),\n ],\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 * Adds an alias to the resolution options.\n *\n * @param key -\n * The name of the package to alias\n * @param value -\n * The alias resolution\n *\n * @returns\n * This object.\n */\n public alias(key: string, value: string) {\n this.config.resolve = this.config.resolve || {};\n this.config.resolve.alias = this.config.resolve.alias || {};\n this.config.resolve.alias[key] = value;\n return this;\n }\n\n /**\n * Adds an alias for lodash to lodash-es.\n *\n * @returns\n * This object.\n */\n public lodash = this.alias.bind(this, \"lodash\", \"lodash-es\");\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 // Make sure to exclude spec and test files.\n exclude: [\"**/*.{spec,test}.{js,mjs,cjs,ts,mts,jsx,tsx}\"],\n });\n const external = externalizeDeps();\n\n return this.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 and using it as an api.\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.mts\")\n .entry(\"cli\", \"src/cli.mts\")\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 * Constructs the config to compile a react application.\n *\n * @returns\n * This object.\n */\n public react() {\n return this.web().plugin(react());\n }\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 the default\n * provider and environment will be used.\n */\n public test(options: TestConfig = new ZViteTestBuilder().monorepo().build()) {\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":["externalizeDeps","options","packageJson","resolve","process","cwd","name","config","externalDeps","Set","existsSync","context","msg","Error","contents","readFileSync","toString","dependencies","devDependencies","optionalDependencies","peerDependencies","JSON","parse","push","add","bind","Object","keys","concat","map","dep","RegExp","forEach","builtinModules","module","depMatchers","Array","from","build","rollupOptions","external","source","some","depMatcher","test","ZViteLibraryBuilder","entry","path","library","_object_spread_props","index","cloneDeep","_define_property","formats","ZViteTestBuilder","environment","coverage","provider","project","projects","monorepo","packages","runSerially","fileParallelism","maxConcurrency","isolate","node","browser","v8","istanbul","testTimeout","all","ZViteConfigBuilder","minify","plugin","option","plugins","castArray","sourceMap","sourcemap","alias","key","value","server","lib","dts","dtsPlugin","compilerOptions","paths","exclude","cli","nest","web","checker","typescript","react","lodash","swc","vite","jsc","transform","runtime","tsConfigPaths","ZViteServerBuilder","allowedHost","allowedHosts","hosts","denyAllHosts","port","strictPort","host","ip","dev","clone","omitBy","isUndefined","localhost"],"mappings":";;;;;;;;;;;;;;AAgBO,MAAMA,eAAAA,GAAkB,CAACC,OAAAA,GAA8B,EAAE,GAAA;IAC9D,MAAM,EAAEC,cAAcC,iBAAAA,CAAQC,OAAAA,CAAQC,GAAG,EAAA,EAAI,cAAA,CAAe,EAAE,GAAGJ,OAAAA;IAEjE,OAAO;QACLK,IAAAA,EAAM,8BAAA;QACNC,MAAAA,EAAQ,IAAA;AACN,YAAA,MAAMC,eAAe,IAAIC,GAAAA,EAAAA;YAEzB,IAAI,CAACC,mBAAWR,WAAAA,CAAAA,EAAc;AAC5B,gBAAA,MAAMS,OAAAA,GAAU,sCAAA;gBAChB,MAAMC,GAAAA,GAAM,CAAC,CAAC,EAAED,QAAQ,iCAAiC,EAAET,WAAAA,CAAY,CAAC,CAAC;AACzE,gBAAA,MAAM,IAAIW,KAAAA,CAAMD,GAAAA,CAAAA;AAClB,YAAA;YAEA,MAAME,QAAAA,GAAWC,oBAAAA,CAAab,WAAAA,CAAAA,CAAac,QAAQ,EAAA;AACnD,YAAA,MAAM,EACJC,YAAAA,GAAe,EAAE,EACjBC,eAAAA,GAAkB,EAAE,EACpBC,oBAAAA,GAAuB,EAAE,EACzBC,mBAAmB,EAAE,EACtB,GAAGC,IAAAA,CAAKC,KAAK,CAACR,QAAAA,CAAAA;AAEf,YAAA,MAAMS,IAAAA,GAAOf,YAAAA,CAAagB,G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lH,WAAyB,EAAC,CAAA;QAiClC,gBAAA,CAAA,IAAA,EAAOmH,WAAAA,EAAY,IAAI,CAACN,IAAI,CAACrF,IAAI,CAAC,IAAI,EAAE,WAAA,CAAA,CAAA;;AAU1C;;;;;;;"}
1
+ {"version":3,"file":"vite.cjs","sources":["../src/plugin/vite-plugin-externalize-deps.ts","../src/vite/vite-library-builder.mts","../src/vite/vite-config-builder.mts","../src/vite/vite-server-builder.mts","../src/vite/vite-test-builder.mts"],"sourcesContent":["import { existsSync, readFileSync, type PathLike } from \"node:fs\";\nimport { builtinModules } from \"node:module\";\nimport { resolve } from \"node:path\";\nimport type { Plugin } from \"vite\";\n\n// Original source code from\n// https://github.com/davidmyersdev/vite-plugin-externalize-deps/blob/main/src/index.ts\n// It takes to long to get this plugin updated, so I just copied the source code into\n// here. I don't think this plugin is maintained much anymore. I've greatly reduced the\n// options from this to be just a basic check for stuff in your package.json and node\n// builtins.\n\nexport interface ExternalizeOptions {\n packageJson?: PathLike;\n}\n\nexport const externalizeDeps = (options: ExternalizeOptions = {}): Plugin => {\n const { packageJson = resolve(process.cwd(), \"package.json\") } = options;\n\n return {\n name: \"vite-plugin-externalize-deps\",\n config: () => {\n const externalDeps = new Set<RegExp>();\n\n if (!existsSync(packageJson)) {\n const context = \"janitor-build-config:externalizeDeps\";\n const msg = `[${context}] Could not find package.json at ${packageJson}.`;\n throw new Error(msg);\n }\n\n const contents = readFileSync(packageJson).toString();\n const {\n dependencies = [],\n devDependencies = [],\n optionalDependencies = [],\n peerDependencies = [],\n } = JSON.parse(contents);\n\n const push = externalDeps.add.bind(externalDeps);\n\n Object.keys(dependencies)\n .concat(Object.keys(devDependencies))\n .concat(Object.keys(optionalDependencies))\n .concat(Object.keys(peerDependencies))\n .map((dep) => new RegExp(`^${dep}(?:/.+)?$`))\n .forEach(push);\n\n builtinModules\n .map((module) => new RegExp(`^(?:node:)?${module}$`))\n .forEach(push);\n\n const depMatchers = Array.from(externalDeps);\n\n return {\n build: {\n rollupOptions: {\n external: (source) => {\n return depMatchers.some((depMatcher) => depMatcher.test(source));\n },\n },\n },\n };\n },\n };\n};\n","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.mts\");\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 react from \"@vitejs/plugin-react\";\nimport { castArray, cloneDeep } from \"lodash-es\";\nimport swc from \"unplugin-swc\";\nimport type { LibraryOptions, PluginOption, ServerOptions } from \"vite\";\nimport { checker } from \"vite-plugin-checker\";\nimport dtsPlugin from \"vite-plugin-dts\";\nimport tsConfigPaths from \"vite-tsconfig-paths\";\nimport type { ViteUserConfig } from \"vitest/config\";\nimport type { InlineConfig } from \"vitest/node\";\nimport { externalizeDeps } from \"../plugin/vite-plugin-externalize-deps.js\";\nimport { ZViteLibraryBuilder } from \"./vite-library-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: ViteUserConfig;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this.config = {\n build: {\n minify: false,\n sourcemap: true,\n },\n plugins: [\n swc.vite({\n jsc: {\n transform: {\n react: {\n runtime: \"automatic\",\n },\n },\n },\n }),\n tsConfigPaths(),\n ],\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 * Adds an alias to the resolution options.\n *\n * @param key -\n * The name of the package to alias\n * @param value -\n * The alias resolution\n *\n * @returns\n * This object.\n */\n public alias(key: string, value: string) {\n this.config.resolve = this.config.resolve || {};\n this.config.resolve.alias = this.config.resolve.alias || {};\n this.config.resolve.alias[key] = value;\n return this;\n }\n\n /**\n * Adds an alias for lodash to lodash-es.\n *\n * @returns\n * This object.\n */\n public lodash = this.alias.bind(this, \"lodash\", \"lodash-es\");\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 // Make sure to exclude spec and test files.\n exclude: [\"**/*.{spec,test}.{js,mjs,cjs,ts,mts,jsx,tsx}\"],\n });\n const external = externalizeDeps();\n\n return this.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 and using it as an api.\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.mts\")\n .entry(\"cli\", \"src/cli.mts\")\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 * Constructs the config to compile a react application.\n *\n * @returns\n * This object.\n */\n public react() {\n return this.web().plugin(react());\n }\n\n /**\n * Constructs the config to be for testing.\n *\n * @param options -\n * The test config to use.\n */\n public test(options: InlineConfig) {\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","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 provider: \"v8\",\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}/*/vite.config.{js,cjs,mjs,ts,mts}`);\n }\n\n /**\n * This sets the max concurrency to one and resets\n * the environment after every test.\n *\n * Use this in the case that you want to have\n * strategic tests that can step over one another. For example,\n * writing to the file system and deleting from the file system\n * can have race conditions. If your app or library tests heavily\n * depend on those operations, then you should run your tests serially.\n *\n * @returns\n * This object.\n */\n public runSerially() {\n this.test.fileParallelism = false;\n this.test.maxConcurrency = 1;\n this.test.isolate = true;\n\n return this;\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"],"names":["externalizeDeps","options","packageJson","resolve","process","cwd","name","config","externalDeps","Set","existsSync","context","msg","Error","contents","readFileSync","toString","dependencies","devDependencies","optionalDependencies","peerDependencies","JSON","parse","push","add","bind","Object","keys","concat","map","dep","RegExp","forEach","builtinModules","module","depMatchers","Array","from","build","rollupOptions","external","source","some","depMatcher","test","ZViteLibraryBuilder","entry","path","library","_object_spread_props","index","cloneDeep","_define_property","formats","ZViteConfigBuilder","minify","plugin","option","plugins","castArray","sourceMap","sourcemap","alias","key","value","server","lib","dts","dtsPlugin","compilerOptions","paths","exclude","cli","nest","web","checker","typescript","react","lodash","swc","vite","jsc","transform","runtime","tsConfigPaths","ZViteServerBuilder","allowedHost","allowedHosts","hosts","denyAllHosts","port","strictPort","host","ip","dev","clone","omitBy","isUndefined","localhost","ZViteTestBuilder","environment","coverage","provider","project","projects","monorepo","packages","runSerially","fileParallelism","maxConcurrency","isolate","node","browser","v8","istanbul","testTimeout"],"mappings":";;;;;;;;;;;;;;AAgBO,MAAMA,eAAAA,GAAkB,CAACC,OAAAA,GAA8B,EAAE,GAAA;IAC9D,MAAM,EAAEC,cAAcC,iBAAAA,CAAQC,OAAAA,CAAQC,GAAG,EAAA,EAAI,cAAA,CAAe,EAAE,GAAGJ,OAAAA;IAEjE,OAAO;QACLK,IAAAA,EAAM,8BAAA;QACNC,MAAAA,EAAQ,IAAA;AACN,YAAA,MAAMC,eAAe,IAAIC,GAAAA,EAAAA;YAEzB,IAAI,CAACC,mBAAWR,WAAAA,CAAAA,EAAc;AAC5B,gBAAA,MAAMS,OAAAA,GAAU,sCAAA;gBAChB,MAAMC,GAAAA,GAAM,CAAC,CAAC,EAAED,QAAQ,iCAAiC,EAAET,WAAAA,CAAY,CAAC,CAAC;AACzE,gBAAA,MAAM,IAAIW,KAAAA,CAAMD,GAAAA,CAAAA;AAClB,YAAA;YAEA,MAAME,QAAAA,GAAWC,oBAAAA,CAAab,WAAAA,CAAAA,CAAac,QAAQ,EAAA;AACnD,YAAA,MAAM,EACJC,YAAAA,GAAe,EAAE,EACjBC,eAAAA,GAAkB,EAAE,EACpBC,oBAAAA,GAAuB,EAAE,EACzBC,mBAAmB,EAAE,EACtB,GAAGC,IAAAA,CAAKC,KAAK,CAACR,QAAAA,CAAAA;AAEf,YAAA,MAAMS,IAAAA,GAAOf,YAAAA,CAAagB,GAAG,CAACC,IAAI,CAACjB,YAAAA,CAAAA;AAEnCkB,YAAAA,MAAAA,CAAOC,IAAI,CAACV,YAAAA,CAAAA,CACTW,MAAM,CAACF,MAAAA,CAAOC,IAAI,CAACT,eAAAA,CAAAA,CAAAA,CACnBU,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181
  }
182
- /**
183
- * A builder for test configurations found in vite's defineConfig test field.
184
- */ class ZViteTestBuilder {
185
- /**
186
- * Sets the test environment.
187
- *
188
- * @param environment -
189
- * The test environment to use.
190
- *
191
- * @returns
192
- * This object.
193
- */ environment(environment) {
194
- this.test.environment = environment;
195
- return this;
196
- }
197
- /**
198
- * Sets the test coverage provider.
199
- *
200
- * @param provider -
201
- * The test coverage provider to use.
202
- *
203
- * @returns
204
- * This object.
205
- */ coverage(provider) {
206
- this.test.coverage = _object_spread_props$1(_object_spread$1({}, this.test.coverage), {
207
- provider
208
- });
209
- return this;
210
- }
211
- /**
212
- * Adds to the list of projects.
213
- *
214
- * @param project -
215
- * The list of projects.
216
- *
217
- * @returns
218
- * This object.
219
- */ project(project = []) {
220
- const projects = this.test.projects || [];
221
- this.test.projects = projects.concat(project);
222
- return this;
223
- }
224
- /**
225
- * Adds monorepo support to the test builder.
226
- *
227
- * @param packages -
228
- * The path to the package directory.
229
- *
230
- * @returns
231
- * This object.
232
- */ monorepo(packages = "packages") {
233
- return this.project(`${packages}/*/vitest.config.{js,cjs,mjs,ts,mts}`);
234
- }
235
- /**
236
- * This sets the max concurrency to one and resets
237
- * the environment after every test.
238
- *
239
- * Use this in the case that you want to have
240
- * strategic tests that can step over one another. For example,
241
- * writing to the file system and deleting from the file system
242
- * can have race conditions. If your app or library tests heavily
243
- * depend on those operations, then you should run your tests serially.
244
- *
245
- * @returns
246
- * This object.
247
- */ runSerially() {
248
- this.test.fileParallelism = false;
249
- this.test.maxConcurrency = 1;
250
- this.test.isolate = true;
251
- return this;
252
- }
253
- /**
254
- * Returns the built test configuration.
255
- *
256
- * @returns
257
- * A deep clone of the test configuration.
258
- */ build() {
259
- return cloneDeep(this.test);
260
- }
261
- /**
262
- * Initializes a new instance of this object.
263
- */ constructor(){
264
- _define_property$2(this, "test", void 0);
265
- /**
266
- * Sets the test environment to "node".
267
- *
268
- * @returns
269
- * This object.
270
- */ _define_property$2(this, "node", this.environment.bind(this, "node"));
271
- /**
272
- * Sets the test environment to "happy-dom".
273
- *
274
- * @returns
275
- * This object.
276
- */ _define_property$2(this, "browser", this.environment.bind(this, "happy-dom"));
277
- /**
278
- * Sets the test coverage provider to "v8".
279
- *
280
- * @returns
281
- * This object.
282
- */ _define_property$2(this, "v8", this.coverage.bind(this, "v8"));
283
- /**
284
- * Sets the test coverage provider to "istanbul".
285
- *
286
- * @returns
287
- * This object.
288
- */ _define_property$2(this, "istanbul", this.coverage.bind(this, "istanbul"));
289
- this.test = {
290
- environment: "node",
291
- testTimeout: 30000,
292
- coverage: {
293
- all: false,
294
- provider: "v8"
295
- }
296
- };
297
- }
298
- }
299
-
300
- function _define_property$1(obj, key, value) {
301
- if (key in obj) {
302
- Object.defineProperty(obj, key, {
303
- value: value,
304
- enumerable: true,
305
- configurable: true,
306
- writable: true
307
- });
308
- } else {
309
- obj[key] = value;
310
- }
311
- return obj;
312
- }
313
- function _object_spread(target) {
314
- for(var i = 1; i < arguments.length; i++){
315
- var source = arguments[i] != null ? arguments[i] : {};
316
- var ownKeys = Object.keys(source);
317
- if (typeof Object.getOwnPropertySymbols === "function") {
318
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
319
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
320
- }));
321
- }
322
- ownKeys.forEach(function(key) {
323
- _define_property$1(target, key, source[key]);
324
- });
325
- }
326
- return target;
327
- }
328
- function ownKeys(object, enumerableOnly) {
329
- var keys = Object.keys(object);
330
- if (Object.getOwnPropertySymbols) {
331
- var symbols = Object.getOwnPropertySymbols(object);
332
- keys.push.apply(keys, symbols);
333
- }
334
- return keys;
335
- }
336
- function _object_spread_props(target, source) {
337
- source = source != null ? source : {};
338
- if (Object.getOwnPropertyDescriptors) {
339
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
340
- } else {
341
- ownKeys(Object(source)).forEach(function(key) {
342
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
343
- });
344
- }
345
- return target;
346
- }
347
182
  /**
348
183
  * A config builder for the vite build system.
349
184
  *
@@ -393,7 +228,7 @@ function _object_spread_props(target, source) {
393
228
  * @returns
394
229
  * This object.
395
230
  */ minify(minify = true) {
396
- this.config.build = _object_spread_props(_object_spread({}, this.config.build), {
231
+ this.config.build = _object_spread_props$1(_object_spread$1({}, this.config.build), {
397
232
  minify
398
233
  });
399
234
  return this;
@@ -422,7 +257,7 @@ function _object_spread_props(target, source) {
422
257
  * @returns
423
258
  * This object.
424
259
  */ sourceMap(sourcemap = true) {
425
- this.config.build = _object_spread_props(_object_spread({}, this.config.build), {
260
+ this.config.build = _object_spread_props$1(_object_spread$1({}, this.config.build), {
426
261
  sourcemap
427
262
  });
428
263
  return this;
@@ -468,7 +303,7 @@ function _object_spread_props(target, source) {
468
303
  * @returns
469
304
  * This object.
470
305
  */ library(lib = new ZViteLibraryBuilder().index().build()) {
471
- this.config.build = _object_spread_props(_object_spread({}, this.config.build), {
306
+ this.config.build = _object_spread_props$1(_object_spread$1({}, this.config.build), {
472
307
  lib
473
308
  });
474
309
  const dts = dtsPlugin({
@@ -538,10 +373,8 @@ function _object_spread_props(target, source) {
538
373
  * Constructs the config to be for testing.
539
374
  *
540
375
  * @param options -
541
- * The test config to use. If this is falsy,
542
- * then a test setup using a monorepo with the default
543
- * provider and environment will be used.
544
- */ test(options = new ZViteTestBuilder().monorepo().build()) {
376
+ * The test config to use.
377
+ */ test(options) {
545
378
  this.config.test = options;
546
379
  return this;
547
380
  }
@@ -556,13 +389,13 @@ function _object_spread_props(target, source) {
556
389
  /**
557
390
  * Initializes a new instance of this object.
558
391
  */ constructor(){
559
- _define_property$1(this, "config", void 0);
392
+ _define_property$2(this, "config", void 0);
560
393
  /**
561
394
  * Adds an alias for lodash to lodash-es.
562
395
  *
563
396
  * @returns
564
397
  * This object.
565
- */ _define_property$1(this, "lodash", this.alias.bind(this, "lodash", "lodash-es"));
398
+ */ _define_property$2(this, "lodash", this.alias.bind(this, "lodash", "lodash-es"));
566
399
  this.config = {
567
400
  build: {
568
401
  minify: false,
@@ -584,7 +417,7 @@ function _object_spread_props(target, source) {
584
417
  }
585
418
  }
586
419
 
587
- function _define_property(obj, key, value) {
420
+ function _define_property$1(obj, key, value) {
588
421
  if (key in obj) {
589
422
  Object.defineProperty(obj, key, {
590
423
  value: value,
@@ -631,8 +464,172 @@ class ZViteServerBuilder {
631
464
  return omitBy(clone, isUndefined);
632
465
  }
633
466
  constructor(){
634
- _define_property(this, "options", {});
635
- _define_property(this, "localhost", this.host.bind(this, "127.0.0.1"));
467
+ _define_property$1(this, "options", {});
468
+ _define_property$1(this, "localhost", this.host.bind(this, "127.0.0.1"));
469
+ }
470
+ }
471
+
472
+ function _define_property(obj, key, value) {
473
+ if (key in obj) {
474
+ Object.defineProperty(obj, key, {
475
+ value: value,
476
+ enumerable: true,
477
+ configurable: true,
478
+ writable: true
479
+ });
480
+ } else {
481
+ obj[key] = value;
482
+ }
483
+ return obj;
484
+ }
485
+ function _object_spread(target) {
486
+ for(var i = 1; i < arguments.length; i++){
487
+ var source = arguments[i] != null ? arguments[i] : {};
488
+ var ownKeys = Object.keys(source);
489
+ if (typeof Object.getOwnPropertySymbols === "function") {
490
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
491
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
492
+ }));
493
+ }
494
+ ownKeys.forEach(function(key) {
495
+ _define_property(target, key, source[key]);
496
+ });
497
+ }
498
+ return target;
499
+ }
500
+ function ownKeys(object, enumerableOnly) {
501
+ var keys = Object.keys(object);
502
+ if (Object.getOwnPropertySymbols) {
503
+ var symbols = Object.getOwnPropertySymbols(object);
504
+ keys.push.apply(keys, symbols);
505
+ }
506
+ return keys;
507
+ }
508
+ function _object_spread_props(target, source) {
509
+ source = source != null ? source : {};
510
+ if (Object.getOwnPropertyDescriptors) {
511
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
512
+ } else {
513
+ ownKeys(Object(source)).forEach(function(key) {
514
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
515
+ });
516
+ }
517
+ return target;
518
+ }
519
+ /**
520
+ * A builder for test configurations found in vite's defineConfig test field.
521
+ */ class ZViteTestBuilder {
522
+ /**
523
+ * Sets the test environment.
524
+ *
525
+ * @param environment -
526
+ * The test environment to use.
527
+ *
528
+ * @returns
529
+ * This object.
530
+ */ environment(environment) {
531
+ this.test.environment = environment;
532
+ return this;
533
+ }
534
+ /**
535
+ * Sets the test coverage provider.
536
+ *
537
+ * @param provider -
538
+ * The test coverage provider to use.
539
+ *
540
+ * @returns
541
+ * This object.
542
+ */ coverage(provider) {
543
+ this.test.coverage = _object_spread_props(_object_spread({}, this.test.coverage), {
544
+ provider
545
+ });
546
+ return this;
547
+ }
548
+ /**
549
+ * Adds to the list of projects.
550
+ *
551
+ * @param project -
552
+ * The list of projects.
553
+ *
554
+ * @returns
555
+ * This object.
556
+ */ project(project = []) {
557
+ const projects = this.test.projects || [];
558
+ this.test.projects = projects.concat(project);
559
+ return this;
560
+ }
561
+ /**
562
+ * Adds monorepo support to the test builder.
563
+ *
564
+ * @param packages -
565
+ * The path to the package directory.
566
+ *
567
+ * @returns
568
+ * This object.
569
+ */ monorepo(packages = "packages") {
570
+ return this.project(`${packages}/*/vite.config.{js,cjs,mjs,ts,mts}`);
571
+ }
572
+ /**
573
+ * This sets the max concurrency to one and resets
574
+ * the environment after every test.
575
+ *
576
+ * Use this in the case that you want to have
577
+ * strategic tests that can step over one another. For example,
578
+ * writing to the file system and deleting from the file system
579
+ * can have race conditions. If your app or library tests heavily
580
+ * depend on those operations, then you should run your tests serially.
581
+ *
582
+ * @returns
583
+ * This object.
584
+ */ runSerially() {
585
+ this.test.fileParallelism = false;
586
+ this.test.maxConcurrency = 1;
587
+ this.test.isolate = true;
588
+ return this;
589
+ }
590
+ /**
591
+ * Returns the built test configuration.
592
+ *
593
+ * @returns
594
+ * A deep clone of the test configuration.
595
+ */ build() {
596
+ return cloneDeep(this.test);
597
+ }
598
+ /**
599
+ * Initializes a new instance of this object.
600
+ */ constructor(){
601
+ _define_property(this, "test", void 0);
602
+ /**
603
+ * Sets the test environment to "node".
604
+ *
605
+ * @returns
606
+ * This object.
607
+ */ _define_property(this, "node", this.environment.bind(this, "node"));
608
+ /**
609
+ * Sets the test environment to "happy-dom".
610
+ *
611
+ * @returns
612
+ * This object.
613
+ */ _define_property(this, "browser", this.environment.bind(this, "happy-dom"));
614
+ /**
615
+ * Sets the test coverage provider to "v8".
616
+ *
617
+ * @returns
618
+ * This object.
619
+ */ _define_property(this, "v8", this.coverage.bind(this, "v8"));
620
+ /**
621
+ * Sets the test coverage provider to "istanbul".
622
+ *
623
+ * @returns
624
+ * This object.
625
+ */ _define_property(this, "istanbul", this.coverage.bind(this, "istanbul"));
626
+ this.test = {
627
+ environment: "node",
628
+ testTimeout: 30000,
629
+ coverage: {
630
+ provider: "v8"
631
+ }
632
+ };
636
633
  }
637
634
  }
638
635
 
package/dist/vite.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.js","sources":["../src/plugin/vite-plugin-externalize-deps.ts","../src/vite/vite-library-builder.mts","../src/vite/vite-test-builder.mts","../src/vite/vite-config-builder.mts","../src/vite/vite-server-builder.mts"],"sourcesContent":["import { existsSync, readFileSync, type PathLike } from \"node:fs\";\nimport { builtinModules } from \"node:module\";\nimport { resolve } from \"node:path\";\nimport type { Plugin } from \"vite\";\n\n// Original source code from\n// https://github.com/davidmyersdev/vite-plugin-externalize-deps/blob/main/src/index.ts\n// It takes to long to get this plugin updated, so I just copied the source code into\n// here. I don't think this plugin is maintained much anymore. I've greatly reduced the\n// options from this to be just a basic check for stuff in your package.json and node\n// builtins.\n\nexport interface ExternalizeOptions {\n packageJson?: PathLike;\n}\n\nexport const externalizeDeps = (options: ExternalizeOptions = {}): Plugin => {\n const { packageJson = resolve(process.cwd(), \"package.json\") } = options;\n\n return {\n name: \"vite-plugin-externalize-deps\",\n config: () => {\n const externalDeps = new Set<RegExp>();\n\n if (!existsSync(packageJson)) {\n const context = \"janitor-build-config:externalizeDeps\";\n const msg = `[${context}] Could not find package.json at ${packageJson}.`;\n throw new Error(msg);\n }\n\n const contents = readFileSync(packageJson).toString();\n const {\n dependencies = [],\n devDependencies = [],\n optionalDependencies = [],\n peerDependencies = [],\n } = JSON.parse(contents);\n\n const push = externalDeps.add.bind(externalDeps);\n\n Object.keys(dependencies)\n .concat(Object.keys(devDependencies))\n .concat(Object.keys(optionalDependencies))\n .concat(Object.keys(peerDependencies))\n .map((dep) => new RegExp(`^${dep}(?:/.+)?$`))\n .forEach(push);\n\n builtinModules\n .map((module) => new RegExp(`^(?:node:)?${module}$`))\n .forEach(push);\n\n const depMatchers = Array.from(externalDeps);\n\n return {\n build: {\n rollupOptions: {\n external: (source) => {\n return depMatchers.some((depMatcher) => depMatcher.test(source));\n },\n },\n },\n };\n },\n };\n};\n","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.mts\");\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: \"v8\",\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 * This sets the max concurrency to one and resets\n * the environment after every test.\n *\n * Use this in the case that you want to have\n * strategic tests that can step over one another. For example,\n * writing to the file system and deleting from the file system\n * can have race conditions. If your app or library tests heavily\n * depend on those operations, then you should run your tests serially.\n *\n * @returns\n * This object.\n */\n public runSerially() {\n this.test.fileParallelism = false;\n this.test.maxConcurrency = 1;\n this.test.isolate = true;\n\n return this;\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 react from \"@vitejs/plugin-react\";\nimport { 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 tsConfigPaths from \"vite-tsconfig-paths\";\nimport type { InlineConfig as TestConfig } from \"vitest/node.js\";\nimport { externalizeDeps } from \"../plugin/vite-plugin-externalize-deps.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: false,\n sourcemap: true,\n },\n plugins: [\n swc.vite({\n jsc: {\n transform: {\n react: {\n runtime: \"automatic\",\n },\n },\n },\n }),\n tsConfigPaths(),\n ],\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 * Adds an alias to the resolution options.\n *\n * @param key -\n * The name of the package to alias\n * @param value -\n * The alias resolution\n *\n * @returns\n * This object.\n */\n public alias(key: string, value: string) {\n this.config.resolve = this.config.resolve || {};\n this.config.resolve.alias = this.config.resolve.alias || {};\n this.config.resolve.alias[key] = value;\n return this;\n }\n\n /**\n * Adds an alias for lodash to lodash-es.\n *\n * @returns\n * This object.\n */\n public lodash = this.alias.bind(this, \"lodash\", \"lodash-es\");\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 // Make sure to exclude spec and test files.\n exclude: [\"**/*.{spec,test}.{js,mjs,cjs,ts,mts,jsx,tsx}\"],\n });\n const external = externalizeDeps();\n\n return this.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 and using it as an api.\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.mts\")\n .entry(\"cli\", \"src/cli.mts\")\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 * Constructs the config to compile a react application.\n *\n * @returns\n * This object.\n */\n public react() {\n return this.web().plugin(react());\n }\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 the default\n * provider and environment will be used.\n */\n public test(options: TestConfig = new ZViteTestBuilder().monorepo().build()) {\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":["externalizeDeps","options","packageJson","resolve","process","cwd","name","config","externalDeps","Set","existsSync","context","msg","Error","contents","readFileSync","toString","dependencies","devDependencies","optionalDependencies","peerDependencies","JSON","parse","push","add","bind","Object","keys","concat","map","dep","RegExp","forEach","builtinModules","module","depMatchers","Array","from","build","rollupOptions","external","source","some","depMatcher","test","ZViteLibraryBuilder","entry","path","library","_object_spread_props","index","cloneDeep","_define_property","formats","ZViteTestBuilder","environment","coverage","provider","project","projects","monorepo","packages","runSerially","fileParallelism","maxConcurrency","isolate","node","browser","v8","istanbul","testTimeout","all","ZViteConfigBuilder","minify","plugin","option","plugins","castArray","sourceMap","sourcemap","alias","key","value","server","lib","dts","dtsPlugin","compilerOptions","paths","exclude","cli","nest","web","checker","typescript","react","lodash","swc","vite","jsc","transform","runtime","tsConfigPaths","ZViteServerBuilder","allowedHost","allowedHosts","hosts","denyAllHosts","port","strictPort","host","ip","dev","clone","omitBy","isUndefined","localhost"],"mappings":";;;;;;;;;;AAgBO,MAAMA,eAAAA,GAAkB,CAACC,OAAAA,GAA8B,EAAE,GAAA;IAC9D,MAAM,EAAEC,cAAcC,OAAAA,CAAQC,OAAAA,CAAQC,GAAG,EAAA,EAAI,cAAA,CAAe,EAAE,GAAGJ,OAAAA;IAEjE,OAAO;QACLK,IAAAA,EAAM,8BAAA;QACNC,MAAAA,EAAQ,IAAA;AACN,YAAA,MAAMC,eAAe,IAAIC,GAAAA,EAAAA;YAEzB,IAAI,CAACC,WAAWR,WAAAA,CAAAA,EAAc;AAC5B,gBAAA,MAAMS,OAAAA,GAAU,sCAAA;gBAChB,MAAMC,GAAAA,GAAM,CAAC,C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AC9G,OAAO,CAAC6G,IAAI,GAAGC,EAAAA;AACpB,QAAA,OAAO,IAAI;AACb,IAAA;IAIOC,GAAAA,GAAM;QACX,OAAO,IAAI,CAACH,UAAU,EAAA,CAAGC,IAAI,CAAC,SAAA,CAAA,CAAWN,WAAW,CAAC,IAAA,CAAA;AACvD,IAAA;IAEOlE,KAAAA,GAAQ;AACb,QAAA,MAAM2E,KAAAA,GAAQ9D,SAAAA,CAAU,IAAI,CAAClD,OAAO,CAAA;AACpC,QAAA,OAAOiH,OAAsBD,KAAAA,EAAOE,WAAAA,CAAAA;AACtC,IAAA;;AA1CA,QAAA,gBAAA,CAAA,IAAA,EAAQlH,WAAyB,EAAC,CAAA;QAiClC,gBAAA,CAAA,IAAA,EAAOmH,WAAAA,EAAY,IAAI,CAACN,IAAI,CAACrF,IAAI,CAAC,IAAI,EAAE,WAAA,CAAA,CAAA;;AAU1C;;;;"}
1
+ {"version":3,"file":"vite.js","sources":["../src/plugin/vite-plugin-externalize-deps.ts","../src/vite/vite-library-builder.mts","../src/vite/vite-config-builder.mts","../src/vite/vite-server-builder.mts","../src/vite/vite-test-builder.mts"],"sourcesContent":["import { existsSync, readFileSync, type PathLike } from \"node:fs\";\nimport { builtinModules } from \"node:module\";\nimport { resolve } from \"node:path\";\nimport type { Plugin } from \"vite\";\n\n// Original source code from\n// https://github.com/davidmyersdev/vite-plugin-externalize-deps/blob/main/src/index.ts\n// It takes to long to get this plugin updated, so I just copied the source code into\n// here. I don't think this plugin is maintained much anymore. I've greatly reduced the\n// options from this to be just a basic check for stuff in your package.json and node\n// builtins.\n\nexport interface ExternalizeOptions {\n packageJson?: PathLike;\n}\n\nexport const externalizeDeps = (options: ExternalizeOptions = {}): Plugin => {\n const { packageJson = resolve(process.cwd(), \"package.json\") } = options;\n\n return {\n name: \"vite-plugin-externalize-deps\",\n config: () => {\n const externalDeps = new Set<RegExp>();\n\n if (!existsSync(packageJson)) {\n const context = \"janitor-build-config:externalizeDeps\";\n const msg = `[${context}] Could not find package.json at ${packageJson}.`;\n throw new Error(msg);\n }\n\n const contents = readFileSync(packageJson).toString();\n const {\n dependencies = [],\n devDependencies = [],\n optionalDependencies = [],\n peerDependencies = [],\n } = JSON.parse(contents);\n\n const push = externalDeps.add.bind(externalDeps);\n\n Object.keys(dependencies)\n .concat(Object.keys(devDependencies))\n .concat(Object.keys(optionalDependencies))\n .concat(Object.keys(peerDependencies))\n .map((dep) => new RegExp(`^${dep}(?:/.+)?$`))\n .forEach(push);\n\n builtinModules\n .map((module) => new RegExp(`^(?:node:)?${module}$`))\n .forEach(push);\n\n const depMatchers = Array.from(externalDeps);\n\n return {\n build: {\n rollupOptions: {\n external: (source) => {\n return depMatchers.some((depMatcher) => depMatcher.test(source));\n },\n },\n },\n };\n },\n };\n};\n","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.mts\");\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 react from \"@vitejs/plugin-react\";\nimport { castArray, cloneDeep } from \"lodash-es\";\nimport swc from \"unplugin-swc\";\nimport type { LibraryOptions, PluginOption, ServerOptions } from \"vite\";\nimport { checker } from \"vite-plugin-checker\";\nimport dtsPlugin from \"vite-plugin-dts\";\nimport tsConfigPaths from \"vite-tsconfig-paths\";\nimport type { ViteUserConfig } from \"vitest/config\";\nimport type { InlineConfig } from \"vitest/node\";\nimport { externalizeDeps } from \"../plugin/vite-plugin-externalize-deps.js\";\nimport { ZViteLibraryBuilder } from \"./vite-library-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: ViteUserConfig;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this.config = {\n build: {\n minify: false,\n sourcemap: true,\n },\n plugins: [\n swc.vite({\n jsc: {\n transform: {\n react: {\n runtime: \"automatic\",\n },\n },\n },\n }),\n tsConfigPaths(),\n ],\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 * Adds an alias to the resolution options.\n *\n * @param key -\n * The name of the package to alias\n * @param value -\n * The alias resolution\n *\n * @returns\n * This object.\n */\n public alias(key: string, value: string) {\n this.config.resolve = this.config.resolve || {};\n this.config.resolve.alias = this.config.resolve.alias || {};\n this.config.resolve.alias[key] = value;\n return this;\n }\n\n /**\n * Adds an alias for lodash to lodash-es.\n *\n * @returns\n * This object.\n */\n public lodash = this.alias.bind(this, \"lodash\", \"lodash-es\");\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 // Make sure to exclude spec and test files.\n exclude: [\"**/*.{spec,test}.{js,mjs,cjs,ts,mts,jsx,tsx}\"],\n });\n const external = externalizeDeps();\n\n return this.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 and using it as an api.\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.mts\")\n .entry(\"cli\", \"src/cli.mts\")\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 * Constructs the config to compile a react application.\n *\n * @returns\n * This object.\n */\n public react() {\n return this.web().plugin(react());\n }\n\n /**\n * Constructs the config to be for testing.\n *\n * @param options -\n * The test config to use.\n */\n public test(options: InlineConfig) {\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","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 provider: \"v8\",\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}/*/vite.config.{js,cjs,mjs,ts,mts}`);\n }\n\n /**\n * This sets the max concurrency to one and resets\n * the environment after every test.\n *\n * Use this in the case that you want to have\n * strategic tests that can step over one another. For example,\n * writing to the file system and deleting from the file system\n * can have race conditions. If your app or library tests heavily\n * depend on those operations, then you should run your tests serially.\n *\n * @returns\n * This object.\n */\n public runSerially() {\n this.test.fileParallelism = false;\n this.test.maxConcurrency = 1;\n this.test.isolate = true;\n\n return this;\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"],"names":["externalizeDeps","options","packageJson","resolve","process","cwd","name","config","externalDeps","Set","existsSync","context","msg","Error","contents","readFileSync","toString","dependencies","devDependencies","optionalDependencies","peerDependencies","JSON","parse","push","add","bind","Object","keys","concat","map","dep","RegExp","forEach","builtinModules","module","depMatchers","Array","from","build","rollupOptions","external","source","some","depMatcher","test","ZViteLibraryBuilder","entry","path","library","_object_spread_props","index","cloneDeep","_define_property","formats","ZViteConfigBuilder","minify","plugin","option","plugins","castArray","sourceMap","sourcemap","alias","key","value","server","lib","dts","dtsPlugin","compilerOptions","paths","exclude","cli","nest","web","checker","typescript","react","lodash","swc","vite","jsc","transform","runtime","tsConfigPaths","ZViteServerBuilder","allowedHost","allowedHosts","hosts","denyAllHosts","port","strictPort","host","ip","dev","clone","omitBy","isUndefined","localhost","ZViteTestBuilder","environment","coverage","provider","project","projects","monorepo","packages","runSerially","fileParallelism","maxConcurrency","isolate","node","browser","v8","istanbul","testTimeout"],"mappings":";;;;;;;;;;AAgBO,MAAMA,eAAAA,GAAkB,CAACC,OAAAA,GAA8B,EAAE,GAAA;IAC9D,MAAM,EAAEC,cAAcC,OAAAA,CAAQC,OAAAA,CAAQC,GAAG,EAAA,EAAI,cAAA,CAAe,EAAE,GAAGJ,OAAAA;IAEjE,OAAO;QACLK,IAAAA,EAAM,8BAAA;QACNC,MAAAA,EAAQ,IAAA;AACN,YAAA,MAAMC,eAAe,IAAIC,GAAAA,EAAAA;YAEzB,IAAI,CAACC,WAAWR,WAAAA,CAAAA,EAAc;AAC5B,gBAAA,MAAMS,OAAAA,GAAU,sCAAA;gBAChB,MAAMC,GAAAA,GAAM,CAAC,CAAC,EAAED,QAAQ,iCAAiC,EAAET,WAAAA,CAAY,CAAC,CAAC;AACzE,gBAAA,MAAM,IAAIW,KAAAA,CAAMD,GAAAA,CAAAA;AAClB,YAAA;YAEA,MAAME,QAAAA,GAAWC,YAAAA,CAAab,WAAAA,CAAAA,CAAac,QAAQ,EAA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A,CAAA,CAAA;AAErC;;;;;MAMA,gBAAA,CAAA,IAAA,EAAOyF,YAAW,IAAI,CAACb,QAAQ,CAAC5E,IAAI,CAAC,IAAI,EAAE,UAAA,CAAA,CAAA;QAnEzC,IAAI,CAACmB,IAAI,GAAG;YACVwD,WAAAA,EAAa,MAAA;YACbe,WAAAA,EAAa,KAAA;YACbd,QAAAA,EAAU;gBACRC,QAAAA,EAAU;AACZ;AACF,SAAA;AACF,IAAA;AAwHF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zthun/janitor-build-config",
3
- "version": "19.4.0",
3
+ "version": "19.4.2",
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,16 +31,16 @@
31
31
  "dist"
32
32
  ],
33
33
  "dependencies": {
34
- "@swc/core": "=1.13.5",
35
- "@vitejs/plugin-react": "^5.0.4",
34
+ "@swc/core": "^1.14.0",
35
+ "@vitejs/plugin-react": "^5.1.0",
36
36
  "lodash-es": "^4.17.21",
37
37
  "typedoc": "^0.28.14",
38
38
  "unplugin-swc": "^1.5.8",
39
- "vite": "^7.1.11",
39
+ "vite": "^7.1.12",
40
40
  "vite-plugin-checker": "^0.11.0",
41
41
  "vite-plugin-dts": "^4.5.4",
42
42
  "vite-tsconfig-paths": "^5.1.4",
43
- "vitest": "^3.2.4"
43
+ "vitest": "^4.0.5"
44
44
  },
45
45
  "devDependencies": {
46
46
  "typescript": "~5.9.3"
@@ -48,7 +48,7 @@
48
48
  "peerDependencies": {
49
49
  "typedoc": ">=0.28.5 <1.0.0",
50
50
  "vite": ">=6.0.0 <8.0.0",
51
- "vitest": ">=3.2.0 <4.0.0"
51
+ "vitest": ">=4.0.0 <5.0.0"
52
52
  },
53
53
  "peerDependenciesMeta": {
54
54
  "typedoc": {
@@ -65,5 +65,5 @@
65
65
  "access": "public"
66
66
  },
67
67
  "author": "Anthony Bonta",
68
- "gitHead": "e8abf577d4fa50909d54bf64ca755cd744332986"
68
+ "gitHead": "71ab0b1b9e0851093246fa4337b9743e45b540af"
69
69
  }