@zthun/janitor-build-config 19.3.6 → 19.4.1

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
  }
@@ -76,6 +76,20 @@ export declare class ZViteTestBuilder {
76
76
  * This object.
77
77
  */
78
78
  monorepo(packages?: string): this;
79
+ /**
80
+ * This sets the max concurrency to one and resets
81
+ * the environment after every test.
82
+ *
83
+ * Use this in the case that you want to have
84
+ * strategic tests that can step over one another. For example,
85
+ * writing to the file system and deleting from the file system
86
+ * can have race conditions. If your app or library tests heavily
87
+ * depend on those operations, then you should run your tests serially.
88
+ *
89
+ * @returns
90
+ * This object.
91
+ */
92
+ runSerially(): this;
79
93
  /**
80
94
  * Returns the built test configuration.
81
95
  *
package/dist/vite.cjs CHANGED
@@ -183,153 +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
- * Returns the built test configuration.
241
- *
242
- * @returns
243
- * A deep clone of the test configuration.
244
- */ build() {
245
- return lodashEs.cloneDeep(this.test);
246
- }
247
- /**
248
- * Initializes a new instance of this object.
249
- */ constructor(){
250
- _define_property$2(this, "test", void 0);
251
- /**
252
- * Sets the test environment to "node".
253
- *
254
- * @returns
255
- * This object.
256
- */ _define_property$2(this, "node", this.environment.bind(this, "node"));
257
- /**
258
- * Sets the test environment to "happy-dom".
259
- *
260
- * @returns
261
- * This object.
262
- */ _define_property$2(this, "browser", this.environment.bind(this, "happy-dom"));
263
- /**
264
- * Sets the test coverage provider to "v8".
265
- *
266
- * @returns
267
- * This object.
268
- */ _define_property$2(this, "v8", this.coverage.bind(this, "v8"));
269
- /**
270
- * Sets the test coverage provider to "istanbul".
271
- *
272
- * @returns
273
- * This object.
274
- */ _define_property$2(this, "istanbul", this.coverage.bind(this, "istanbul"));
275
- this.test = {
276
- environment: "node",
277
- testTimeout: 30000,
278
- coverage: {
279
- all: false,
280
- provider: "v8"
281
- }
282
- };
283
- }
284
- }
285
-
286
- function _define_property$1(obj, key, value) {
287
- if (key in obj) {
288
- Object.defineProperty(obj, key, {
289
- value: value,
290
- enumerable: true,
291
- configurable: true,
292
- writable: true
293
- });
294
- } else {
295
- obj[key] = value;
296
- }
297
- return obj;
298
- }
299
- function _object_spread(target) {
300
- for(var i = 1; i < arguments.length; i++){
301
- var source = arguments[i] != null ? arguments[i] : {};
302
- var ownKeys = Object.keys(source);
303
- if (typeof Object.getOwnPropertySymbols === "function") {
304
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
305
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
306
- }));
307
- }
308
- ownKeys.forEach(function(key) {
309
- _define_property$1(target, key, source[key]);
310
- });
311
- }
312
- return target;
313
- }
314
- function ownKeys(object, enumerableOnly) {
315
- var keys = Object.keys(object);
316
- if (Object.getOwnPropertySymbols) {
317
- var symbols = Object.getOwnPropertySymbols(object);
318
- keys.push.apply(keys, symbols);
319
- }
320
- return keys;
321
- }
322
- function _object_spread_props(target, source) {
323
- source = source != null ? source : {};
324
- if (Object.getOwnPropertyDescriptors) {
325
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
326
- } else {
327
- ownKeys(Object(source)).forEach(function(key) {
328
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
329
- });
330
- }
331
- return target;
332
- }
333
186
  /**
334
187
  * A config builder for the vite build system.
335
188
  *
@@ -379,7 +232,7 @@ function _object_spread_props(target, source) {
379
232
  * @returns
380
233
  * This object.
381
234
  */ minify(minify = true) {
382
- 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), {
383
236
  minify
384
237
  });
385
238
  return this;
@@ -408,7 +261,7 @@ function _object_spread_props(target, source) {
408
261
  * @returns
409
262
  * This object.
410
263
  */ sourceMap(sourcemap = true) {
411
- 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), {
412
265
  sourcemap
413
266
  });
414
267
  return this;
@@ -454,7 +307,7 @@ function _object_spread_props(target, source) {
454
307
  * @returns
455
308
  * This object.
456
309
  */ library(lib = new ZViteLibraryBuilder().index().build()) {
457
- 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), {
458
311
  lib
459
312
  });
460
313
  const dts = dtsPlugin({
@@ -524,10 +377,8 @@ function _object_spread_props(target, source) {
524
377
  * Constructs the config to be for testing.
525
378
  *
526
379
  * @param options -
527
- * The test config to use. If this is falsy,
528
- * then a test setup using a monorepo with the default
529
- * provider and environment will be used.
530
- */ test(options = new ZViteTestBuilder().monorepo().build()) {
380
+ * The test config to use.
381
+ */ test(options) {
531
382
  this.config.test = options;
532
383
  return this;
533
384
  }
@@ -542,13 +393,13 @@ function _object_spread_props(target, source) {
542
393
  /**
543
394
  * Initializes a new instance of this object.
544
395
  */ constructor(){
545
- _define_property$1(this, "config", void 0);
396
+ _define_property$2(this, "config", void 0);
546
397
  /**
547
398
  * Adds an alias for lodash to lodash-es.
548
399
  *
549
400
  * @returns
550
401
  * This object.
551
- */ _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"));
552
403
  this.config = {
553
404
  build: {
554
405
  minify: false,
@@ -570,7 +421,7 @@ function _object_spread_props(target, source) {
570
421
  }
571
422
  }
572
423
 
573
- function _define_property(obj, key, value) {
424
+ function _define_property$1(obj, key, value) {
574
425
  if (key in obj) {
575
426
  Object.defineProperty(obj, key, {
576
427
  value: value,
@@ -617,8 +468,172 @@ class ZViteServerBuilder {
617
468
  return lodashEs.omitBy(clone, lodashEs.isUndefined);
618
469
  }
619
470
  constructor(){
620
- _define_property(this, "options", {});
621
- _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
+ };
622
637
  }
623
638
  }
624
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 * 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","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,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,MAAM,CAACF,MAAAA,CAAOC,IAAI,CAACR,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AChC,QAAA,OAAO,IAAI;AACb,IAAA;AAEOG,IAAAA,IAAAA,CAAKA,IAAa,EAAE;AACzB,QAAA,IAAI,CAACvG,OAAO,CAACuG,IAAI,GAAGA,IAAAA;AACpB,QAAA,OAAO,IAAI;AACb,IAAA;IAEOC,UAAAA,GAAa;AAClB,QAAA,IAAI,CAACxG,OAAO,CAACwG,UAAU,GAAG,IAAA;AAC1B,QAAA,OAAO,IAAI;AACb,IAAA;AAEOC,IAAAA,IAAAA,CAAKC,EAAU,EAAE;AACtB,QAAA,IAAI,CAAC1G,OAAO,CAACyG,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;IAEO9D,KAAAA,GAAQ;AACb,QAAA,MAAMuE,KAAAA,GAAQ1D,kBAAAA,CAAU,IAAI,CAAClD,OAAO,CAAA;AACpC,QAAA,OAAO6G,gBAAsBD,KAAAA,EAAOE,oBAAAA,CAAAA;AACtC,IAAA;;AA1CA,QAAA,gBAAA,CAAA,IAAA,EAAQ9G,WAAyB,EAAC,CAAA;QAiClC,gBAAA,CAAA,IAAA,EAAO+G,WAAAA,EAAY,IAAI,CAACN,IAAI,CAACjF,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,YA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QA,QAAR,MAAA,CAAA;AA6BA;;;;;MAMA,gBAAA,CAAA,IAAA,EAAOmE,QAAO,IAAI,CAACX,WAAW,CAAC3E,IAAI,CAAC,IAAI,EAAE,MAAA,CAAA,CAAA;AAE1C;;;;;MAMA,gBAAA,CAAA,IAAA,EAAOuF,WAAU,IAAI,CAACZ,WAAW,CAAC3E,IAAI,CAAC,IAAI,EAAE,WAAA,CAAA,CAAA;AAgB7C;;;;;MAMA,gBAAA,CAAA,IAAA,EAAOwF,MAAK,IAAI,CAACZ,QAAQ,CAAC5E,IAAI,CAAC,IAAI,EAAE,IAAA,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/dist/vite.js CHANGED
@@ -179,153 +179,6 @@ function _object_spread_props$1(target, source) {
179
179
  }
180
180
  return target;
181
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
- * Returns the built test configuration.
237
- *
238
- * @returns
239
- * A deep clone of the test configuration.
240
- */ build() {
241
- return cloneDeep(this.test);
242
- }
243
- /**
244
- * Initializes a new instance of this object.
245
- */ constructor(){
246
- _define_property$2(this, "test", void 0);
247
- /**
248
- * Sets the test environment to "node".
249
- *
250
- * @returns
251
- * This object.
252
- */ _define_property$2(this, "node", this.environment.bind(this, "node"));
253
- /**
254
- * Sets the test environment to "happy-dom".
255
- *
256
- * @returns
257
- * This object.
258
- */ _define_property$2(this, "browser", this.environment.bind(this, "happy-dom"));
259
- /**
260
- * Sets the test coverage provider to "v8".
261
- *
262
- * @returns
263
- * This object.
264
- */ _define_property$2(this, "v8", this.coverage.bind(this, "v8"));
265
- /**
266
- * Sets the test coverage provider to "istanbul".
267
- *
268
- * @returns
269
- * This object.
270
- */ _define_property$2(this, "istanbul", this.coverage.bind(this, "istanbul"));
271
- this.test = {
272
- environment: "node",
273
- testTimeout: 30000,
274
- coverage: {
275
- all: false,
276
- provider: "v8"
277
- }
278
- };
279
- }
280
- }
281
-
282
- function _define_property$1(obj, key, value) {
283
- if (key in obj) {
284
- Object.defineProperty(obj, key, {
285
- value: value,
286
- enumerable: true,
287
- configurable: true,
288
- writable: true
289
- });
290
- } else {
291
- obj[key] = value;
292
- }
293
- return obj;
294
- }
295
- function _object_spread(target) {
296
- for(var i = 1; i < arguments.length; i++){
297
- var source = arguments[i] != null ? arguments[i] : {};
298
- var ownKeys = Object.keys(source);
299
- if (typeof Object.getOwnPropertySymbols === "function") {
300
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
301
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
302
- }));
303
- }
304
- ownKeys.forEach(function(key) {
305
- _define_property$1(target, key, source[key]);
306
- });
307
- }
308
- return target;
309
- }
310
- function ownKeys(object, enumerableOnly) {
311
- var keys = Object.keys(object);
312
- if (Object.getOwnPropertySymbols) {
313
- var symbols = Object.getOwnPropertySymbols(object);
314
- keys.push.apply(keys, symbols);
315
- }
316
- return keys;
317
- }
318
- function _object_spread_props(target, source) {
319
- source = source != null ? source : {};
320
- if (Object.getOwnPropertyDescriptors) {
321
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
322
- } else {
323
- ownKeys(Object(source)).forEach(function(key) {
324
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
325
- });
326
- }
327
- return target;
328
- }
329
182
  /**
330
183
  * A config builder for the vite build system.
331
184
  *
@@ -375,7 +228,7 @@ function _object_spread_props(target, source) {
375
228
  * @returns
376
229
  * This object.
377
230
  */ minify(minify = true) {
378
- 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), {
379
232
  minify
380
233
  });
381
234
  return this;
@@ -404,7 +257,7 @@ function _object_spread_props(target, source) {
404
257
  * @returns
405
258
  * This object.
406
259
  */ sourceMap(sourcemap = true) {
407
- 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), {
408
261
  sourcemap
409
262
  });
410
263
  return this;
@@ -450,7 +303,7 @@ function _object_spread_props(target, source) {
450
303
  * @returns
451
304
  * This object.
452
305
  */ library(lib = new ZViteLibraryBuilder().index().build()) {
453
- 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), {
454
307
  lib
455
308
  });
456
309
  const dts = dtsPlugin({
@@ -520,10 +373,8 @@ function _object_spread_props(target, source) {
520
373
  * Constructs the config to be for testing.
521
374
  *
522
375
  * @param options -
523
- * The test config to use. If this is falsy,
524
- * then a test setup using a monorepo with the default
525
- * provider and environment will be used.
526
- */ test(options = new ZViteTestBuilder().monorepo().build()) {
376
+ * The test config to use.
377
+ */ test(options) {
527
378
  this.config.test = options;
528
379
  return this;
529
380
  }
@@ -538,13 +389,13 @@ function _object_spread_props(target, source) {
538
389
  /**
539
390
  * Initializes a new instance of this object.
540
391
  */ constructor(){
541
- _define_property$1(this, "config", void 0);
392
+ _define_property$2(this, "config", void 0);
542
393
  /**
543
394
  * Adds an alias for lodash to lodash-es.
544
395
  *
545
396
  * @returns
546
397
  * This object.
547
- */ _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"));
548
399
  this.config = {
549
400
  build: {
550
401
  minify: false,
@@ -566,7 +417,7 @@ function _object_spread_props(target, source) {
566
417
  }
567
418
  }
568
419
 
569
- function _define_property(obj, key, value) {
420
+ function _define_property$1(obj, key, value) {
570
421
  if (key in obj) {
571
422
  Object.defineProperty(obj, key, {
572
423
  value: value,
@@ -613,8 +464,172 @@ class ZViteServerBuilder {
613
464
  return omitBy(clone, isUndefined);
614
465
  }
615
466
  constructor(){
616
- _define_property(this, "options", {});
617
- _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
+ };
618
633
  }
619
634
  }
620
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 * 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","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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IAAA;IAIOC,GAAAA,GAAM;QACX,OAAO,IAAI,CAACH,UAAU,EAAA,CAAGC,IAAI,CAAC,SAAA,CAAA,CAAWN,WAAW,CAAC,IAAA,CAAA;AACvD,IAAA;IAEO9D,KAAAA,GAAQ;AACb,QAAA,MAAMuE,KAAAA,GAAQ1D,SAAAA,CAAU,IAAI,CAAClD,OAAO,CAAA;AACpC,QAAA,OAAO6G,OAAsBD,KAAAA,EAAOE,WAAAA,CAAAA;AACtC,IAAA;;AA1CA,QAAA,gBAAA,CAAA,IAAA,EAAQ9G,WAAyB,EAAC,CAAA;QAiClC,gBAAA,CAAA,IAAA,EAAO+G,WAAAA,EAAY,IAAI,CAACN,IAAI,CAACjF,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,EAAA;AACnD,YAAA,MAAM,EACJC,YAAAA,GAAe,EAAE,EACjBC,eAAAA,GAAkB,E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I,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.3.6",
3
+ "version": "19.4.1",
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",
@@ -34,13 +34,13 @@
34
34
  "@swc/core": "=1.13.5",
35
35
  "@vitejs/plugin-react": "^5.0.4",
36
36
  "lodash-es": "^4.17.21",
37
- "typedoc": "^0.28.13",
38
- "unplugin-swc": "^1.5.7",
39
- "vite": "^7.1.9",
37
+ "typedoc": "^0.28.14",
38
+ "unplugin-swc": "^1.5.8",
39
+ "vite": "^7.1.11",
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.1"
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": "a892bdcf638af6da0400f2068e719163c3613b30"
68
+ "gitHead": "bdc39062cce164e86d949fa680406808d643ce1d"
69
69
  }