@zthun/janitor-build-config 19.0.0 → 19.1.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,4 +1,4 @@
1
- import { LibraryOptions, UserConfig } from 'vite';
1
+ import { LibraryOptions, PluginOption, ServerOptions, UserConfig } from 'vite';
2
2
  import { InlineConfig as TestConfig } from 'vitest/node.js';
3
3
  /**
4
4
  * A config builder for the vite build system.
@@ -41,20 +41,62 @@ import { InlineConfig as TestConfig } from 'vitest/node.js';
41
41
  * ```
42
42
  */
43
43
  export declare class ZViteConfigBuilder {
44
- private _dirname;
45
44
  private config;
46
45
  /**
47
46
  * Initializes a new instance of this object.
47
+ */
48
+ constructor();
49
+ /**
50
+ * Sets whether to minify the build output.
51
+ *
52
+ * @param minify -
53
+ * The flag as to minify the output.
48
54
  *
49
- * @param _dirname -
50
- * The directory that is housing the vite.config
51
- * file. Pass __dirname to this.
55
+ * @returns
56
+ * This object.
52
57
  */
53
- constructor(_dirname: string);
58
+ minify(minify?: boolean): this;
54
59
  /**
55
- * Sets vite into library mode.
60
+ * Adds a list of plugins.
61
+ *
62
+ * @param option -
63
+ * The plugins to add.
64
+ *
65
+ * @returns
66
+ * This object.
67
+ */
68
+ plugin(option?: PluginOption | PluginOption[]): this;
69
+ /**
70
+ * Adds the swc plugin.
71
+ *
72
+ * This is mostly for nest projects as nest requires
73
+ * swc to support decorators.
74
+ */
75
+ swc(): this;
76
+ /**
77
+ * Sets whether to generate source maps.
78
+ *
79
+ * @param sourcemap -
80
+ * True to generate a sourcemap, false for faster build.
81
+ *
82
+ * @returns
83
+ * This object.
84
+ */
85
+ sourceMap(sourcemap?: boolean): this;
86
+ /**
87
+ * Assigns the server options.
56
88
  *
57
89
  * @param options -
90
+ * The server options to assign.
91
+ *
92
+ * @returns
93
+ * This object.
94
+ */
95
+ server(options: ServerOptions): this;
96
+ /**
97
+ * Sets vite into library mode.
98
+ *
99
+ * @param lib -
58
100
  * The options for the library. You can set this to
59
101
  * nothing to use the default library which looks for
60
102
  * an entry point at the source directory called index.ts
@@ -64,7 +106,7 @@ export declare class ZViteConfigBuilder {
64
106
  * @returns
65
107
  * This object.
66
108
  */
67
- library(options?: LibraryOptions): this;
109
+ library(lib?: LibraryOptions): this;
68
110
  /**
69
111
  * Constructs the config to act as if it's compiling a node application.
70
112
  *
@@ -78,8 +120,39 @@ export declare class ZViteConfigBuilder {
78
120
  * This object.
79
121
  */
80
122
  cli(): this;
123
+ /**
124
+ * Constructs the config to act as if it's compiling a nest application.
125
+ *
126
+ * This is just an alias to {@link ZViteConfigBuilder.library} with a single
127
+ * entry point.
128
+ *
129
+ * 1. The file, src/main.mts
130
+ *
131
+ * @returns
132
+ * This object.
133
+ */
134
+ nest(): this;
135
+ /**
136
+ * Constructs the config to act as if it's compiling a web application.
137
+ *
138
+ * @returns
139
+ * This object.
140
+ */
141
+ web(): this;
142
+ /**
143
+ * Constructs the config to compile a react application.
144
+ *
145
+ * @returns
146
+ * This object.
147
+ */
148
+ react(): this;
81
149
  /**
82
150
  * Constructs the config to be for testing.
151
+ *
152
+ * @param options -
153
+ * The test config to use. If this is falsy,
154
+ * then a test setup using a monorepo with an
155
+ * istanbul provider in node is used.
83
156
  */
84
157
  test(options?: TestConfig): this;
85
158
  /**
@@ -0,0 +1,12 @@
1
+ import { ServerOptions } from 'vite';
2
+ export declare class ZViteServerBuilder {
3
+ private options;
4
+ allowedHost(name: string | string[] | true): this;
5
+ denyAllHosts(): this;
6
+ port(port?: number): this;
7
+ strictPort(): this;
8
+ host(ip: string): this;
9
+ localhost: () => this;
10
+ dev(): this;
11
+ build(): ServerOptions;
12
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -56,6 +56,26 @@ export declare class ZViteTestBuilder {
56
56
  * This object.
57
57
  */
58
58
  istanbul: () => this;
59
+ /**
60
+ * Adds to the list of projects.
61
+ *
62
+ * @param project -
63
+ * The list of projects.
64
+ *
65
+ * @returns
66
+ * This object.
67
+ */
68
+ project(project?: string | string[]): this;
69
+ /**
70
+ * Adds monorepo support to the test builder.
71
+ *
72
+ * @param packages -
73
+ * The path to the package directory.
74
+ *
75
+ * @returns
76
+ * This object.
77
+ */
78
+ monorepo(packages?: string): this;
59
79
  /**
60
80
  * Returns the built test configuration.
61
81
  *