@zthun/janitor-build-config 19.2.2 → 19.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vite/vite-config-builder.d.mts +2 -2
- package/dist/vite.cjs +9 -5
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.js +9 -5
- package/dist/vite.js.map +1 -1
- package/package.json +3 -3
- package/dist/typedoc/typedoc-config-builder.spec.d.ts +0 -1
- package/dist/vite/vite-config-builder.spec.d.ts +0 -1
- package/dist/vite/vite-library-builder.spec.d.ts +0 -1
- package/dist/vite/vite-server-builder.spec.d.ts +0 -1
- package/dist/vite/vite-test-builder.spec.d.ts +0 -1
|
@@ -163,8 +163,8 @@ export declare class ZViteConfigBuilder {
|
|
|
163
163
|
*
|
|
164
164
|
* @param options -
|
|
165
165
|
* The test config to use. If this is falsy,
|
|
166
|
-
* then a test setup using a monorepo with
|
|
167
|
-
*
|
|
166
|
+
* then a test setup using a monorepo with the default
|
|
167
|
+
* provider and environment will be used.
|
|
168
168
|
*/
|
|
169
169
|
test(options?: TestConfig): this;
|
|
170
170
|
/**
|
package/dist/vite.cjs
CHANGED
|
@@ -245,7 +245,7 @@ function _object_spread_props$1(target, source) {
|
|
|
245
245
|
testTimeout: 30000,
|
|
246
246
|
coverage: {
|
|
247
247
|
all: false,
|
|
248
|
-
provider:
|
|
248
|
+
provider: "v8"
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
251
|
}
|
|
@@ -431,7 +431,11 @@ function _object_spread_props(target, source) {
|
|
|
431
431
|
// sure that your build is building in the correct order and that your
|
|
432
432
|
// actual paths are correct.
|
|
433
433
|
paths: {}
|
|
434
|
-
}
|
|
434
|
+
},
|
|
435
|
+
// Make sure to exclude spec and test files.
|
|
436
|
+
exclude: [
|
|
437
|
+
"**/*.{spec,test}.{js,mjs,cjs,ts,mts,jsx,tsx}"
|
|
438
|
+
]
|
|
435
439
|
});
|
|
436
440
|
const external = vitePluginExternalizeDeps.externalizeDeps();
|
|
437
441
|
return this.minify(false).sourceMap().plugin(external).plugin(dts);
|
|
@@ -489,9 +493,9 @@ function _object_spread_props(target, source) {
|
|
|
489
493
|
*
|
|
490
494
|
* @param options -
|
|
491
495
|
* The test config to use. If this is falsy,
|
|
492
|
-
* then a test setup using a monorepo with
|
|
493
|
-
*
|
|
494
|
-
*/ test(options = new ZViteTestBuilder().
|
|
496
|
+
* then a test setup using a monorepo with the default
|
|
497
|
+
* provider and environment will be used.
|
|
498
|
+
*/ test(options = new ZViteTestBuilder().monorepo().build()) {
|
|
495
499
|
this.config.test = options;
|
|
496
500
|
return this;
|
|
497
501
|
}
|
package/dist/vite.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.cjs","sources":["../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 { 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: undefined,\n },\n };\n }\n\n /**\n * Sets the test environment.\n *\n * @param environment -\n * The test environment to use.\n *\n * @returns\n * This object.\n */\n public environment(environment: VitestEnvironment) {\n this.test.environment = environment;\n return this;\n }\n\n /**\n * Sets the test environment to \"node\".\n *\n * @returns\n * This object.\n */\n public node = this.environment.bind(this, \"node\");\n\n /**\n * Sets the test environment to \"happy-dom\".\n *\n * @returns\n * This object.\n */\n public browser = this.environment.bind(this, \"happy-dom\");\n\n /**\n * Sets the test coverage provider.\n *\n * @param provider -\n * The test coverage provider to use.\n *\n * @returns\n * This object.\n */\n public coverage(provider: \"v8\" | \"istanbul\") {\n this.test.coverage = { ...this.test.coverage, provider };\n return this;\n }\n\n /**\n * Sets the test coverage provider to \"v8\".\n *\n * @returns\n * This object.\n */\n public v8 = this.coverage.bind(this, \"v8\");\n\n /**\n * Sets the test coverage provider to \"istanbul\".\n *\n * @returns\n * This object.\n */\n public istanbul = this.coverage.bind(this, \"istanbul\");\n\n /**\n * Adds to the list of projects.\n *\n * @param project -\n * The list of projects.\n *\n * @returns\n * This object.\n */\n public project(project: string | string[] = []) {\n const projects = this.test.projects || [];\n this.test.projects = projects.concat(project);\n return this;\n }\n\n /**\n * Adds monorepo support to the test builder.\n *\n * @param packages -\n * The path to the package directory.\n *\n * @returns\n * This object.\n */\n public monorepo(packages = \"packages\") {\n return this.project(`${packages}/*/vitest.config.{js,cjs,mjs,ts,mts}`);\n }\n\n /**\n * Returns the built test configuration.\n *\n * @returns\n * A deep clone of the test configuration.\n */\n public build() {\n return cloneDeep(this.test);\n }\n}\n","import 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 { externalizeDeps } from \"vite-plugin-externalize-deps\";\nimport tsConfigPaths from \"vite-tsconfig-paths\";\nimport type { InlineConfig as TestConfig } from \"vitest/node.js\";\nimport { ZViteLibraryBuilder } from \"./vite-library-builder.mjs\";\nimport { ZViteTestBuilder } from \"./vite-test-builder.mjs\";\n\n/**\n * A config builder for the vite build system.\n *\n * This is helpful when building different types\n * of projects and keeping a standard.\n *\n * @example vite.config.ts\n *\n * ```ts\n * // Before Config Builder\n * export default defineConfig({\n * build: {\n * lib: {\n * entry: {\n * index: \"./src/index.ts\",\n * },\n * formats: [\"cjs\", \"es\"],\n * },\n * },\n * minify: false,\n * sourceMap: true,\n * plugins: [\n * swc.vite(),\n * tsConfigPaths(),\n * externalizeDeps(),\n * dtsPlugin({\n * compilerOptions: {\n * paths: {},\n * },\n * }),\n * ],\n * });\n * ```\n *\n * ```ts\n * // After config builder\n * const config = new ZViteConfigBuilder().library().build();\n * export default defineConfig(config);\n * ```\n */\nexport class ZViteConfigBuilder {\n private config: UserConfig;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this.config = {\n build: {\n minify: true,\n sourcemap: false,\n },\n plugins: [\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 });\n const external = externalizeDeps();\n\n return this.minify(false).sourceMap().plugin(external).plugin(dts);\n }\n\n /**\n * Constructs the config to act as if it's compiling a node application.\n *\n * This is just an alias to {@link ZViteConfigBuilder.library} with two\n * entry points.\n *\n * 1. The file src/cli.ts is the main entry point of the application.\n * 1. The file, src/index.ts, is the api for importing 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 an\n * istanbul provider in node is used.\n */\n public test(\n options: TestConfig = new ZViteTestBuilder()\n .node()\n .istanbul()\n .monorepo()\n .build(),\n ) {\n this.config.test = options;\n return this;\n }\n\n /**\n * Returns the currently built config.\n *\n * @returns\n * The currently built config.\n */\n public build() {\n return cloneDeep(this.config);\n }\n}\n","import { cloneDeep, isUndefined, omitBy } from \"lodash-es\";\nimport type { ServerOptions } from \"vite\";\n\nexport class ZViteServerBuilder {\n private options: ServerOptions = {};\n\n public allowedHost(name: string | string[] | true) {\n if (name === true) {\n this.options.allowedHosts = true;\n } else if (this.options.allowedHosts !== true) {\n const hosts = this.options.allowedHosts || [];\n this.options.allowedHosts = hosts.concat(name);\n }\n\n return this;\n }\n\n public denyAllHosts() {\n delete this.options.allowedHosts;\n return this;\n }\n\n public port(port?: number) {\n this.options.port = port;\n return this;\n }\n\n public strictPort() {\n this.options.strictPort = true;\n return this;\n }\n\n public host(ip: string) {\n this.options.host = ip;\n return this;\n }\n\n public localhost = this.host.bind(this, \"127.0.0.1\");\n\n public dev() {\n return this.strictPort().host(\"0.0.0.0\").allowedHost(true);\n }\n\n public build() {\n const clone = cloneDeep(this.options);\n return omitBy<ServerOptions>(clone, isUndefined) as ServerOptions;\n }\n}\n"],"names":["ZViteLibraryBuilder","entry","name","path","library","_object_spread_props","cloneDeep","_define_property","formats","ZViteTestBuilder","environment","test","coverage","provider","project","projects","concat","monorepo","packages","node","bind","browser","v8","istanbul","testTimeout","all","undefined","ZViteConfigBuilder","minify","config","build","plugin","option","plugins","castArray","sourceMap","sourcemap","alias","key","value","resolve","server","options","lib","index","dts","dtsPlugin","compilerOptions","paths","external","externalizeDeps","checker","typescript","web","react","lodash","swc","vite","jsc","transform","runtime","tsConfigPaths","ZViteServerBuilder","allowedHost","allowedHosts","hosts","denyAllHosts","port","strictPort","host","ip","dev","clone","omitBy","isUndefined","localhost"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAEC,IACM,MAAMA,mBAAAA,CAAAA;AAMX;;;;;;;;;;AAUC,MACD,KAAOC,CAAMC,IAAY,EAAEC,IAAY,EAAE;QACvC,IAAI,CAACC,OAAO,CAACH,KAAK,GAAGI,4CACf,IAAI,CAACD,OAAO,CAACH,KAAK,CAAA,EAAA;AACtB,YAAA,CAACC,OAAOC;;AAEV,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;AACb,QAAA,OAAO,IAAI,CAACF,KAAK,CAAC,OAAS,EAAA,iBAAA,CAAA;AAC7B;AAEA;;;;;AAKC,MACD,KAAe,GAAA;QACb,OAAOK,kBAAAA,CAAU,IAAI,CAACF,OAAO,CAAA;AAC/B;;AA3CA,QAAAG,kBAAA,CAAA,IAAA,EAAQH,SAA0B,EAAA;AAChCH,YAAAA,KAAAA,EAAO,EAAC;YACRO,OAAS,EAAA;AAAC,gBAAA,IAAA;AAAM,gBAAA;AAAM;AACxB,SAAA,CAAA;;AAyCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AChDA;;AAEC,IACM,MAAMC,gBAAAA,CAAAA;AAiBX;;;;;;;;MASOC,WAAYA,CAAAA,WAA8B,EAAE;AACjD,QAAA,IAAI,CAACC,IAAI,CAACD,WAAW,GAAGA,WAAA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,CAAA;AACpC,QAAA,OAAO+B,gBAAsBD,KAAOE,EAAAA,oBAAAA,CAAAA;AACtC;;AA1CA,QAAA,gBAAA,CAAA,IAAA,EAAQhC,WAAyB,EAAC,CAAA;QAiClC,gBAAOiC,CAAAA,IAAAA,EAAAA,WAAAA,EAAY,IAAI,CAACN,IAAI,CAACjD,IAAI,CAAC,IAAI,EAAE,WAAA,CAAA,CAAA;;AAU1C;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"vite.cjs","sources":["../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 { 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 { externalizeDeps } from \"vite-plugin-externalize-deps\";\nimport tsConfigPaths from \"vite-tsconfig-paths\";\nimport type { InlineConfig as TestConfig } from \"vitest/node.js\";\nimport { ZViteLibraryBuilder } from \"./vite-library-builder.mjs\";\nimport { ZViteTestBuilder } from \"./vite-test-builder.mjs\";\n\n/**\n * A config builder for the vite build system.\n *\n * This is helpful when building different types\n * of projects and keeping a standard.\n *\n * @example vite.config.ts\n *\n * ```ts\n * // Before Config Builder\n * export default defineConfig({\n * build: {\n * lib: {\n * entry: {\n * index: \"./src/index.ts\",\n * },\n * formats: [\"cjs\", \"es\"],\n * },\n * },\n * minify: false,\n * sourceMap: true,\n * plugins: [\n * swc.vite(),\n * tsConfigPaths(),\n * externalizeDeps(),\n * dtsPlugin({\n * compilerOptions: {\n * paths: {},\n * },\n * }),\n * ],\n * });\n * ```\n *\n * ```ts\n * // After config builder\n * const config = new ZViteConfigBuilder().library().build();\n * export default defineConfig(config);\n * ```\n */\nexport class ZViteConfigBuilder {\n private config: UserConfig;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this.config = {\n build: {\n minify: true,\n sourcemap: false,\n },\n plugins: [\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.minify(false).sourceMap().plugin(external).plugin(dts);\n }\n\n /**\n * Constructs the config to act as if it's compiling a node application.\n *\n * This is just an alias to {@link ZViteConfigBuilder.library} with two\n * entry points.\n *\n * 1. The file src/cli.ts is the main entry point of the application.\n * 1. The file, src/index.ts, is the api for importing 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":["ZViteLibraryBuilder","entry","name","path","library","_object_spread_props","cloneDeep","_define_property","formats","ZViteTestBuilder","environment","test","coverage","provider","project","projects","concat","monorepo","packages","node","bind","browser","v8","istanbul","testTimeout","all","ZViteConfigBuilder","minify","config","build","plugin","option","plugins","castArray","sourceMap","sourcemap","alias","key","value","resolve","server","options","lib","index","dts","dtsPlugin","compilerOptions","paths","exclude","external","externalizeDeps","checker","typescript","web","react","lodash","swc","vite","jsc","transform","runtime","tsConfigPaths","ZViteServerBuilder","allowedHost","allowedHosts","hosts","denyAllHosts","port","strictPort","host","ip","dev","clone","omitBy","isUndefined","localhost"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAEC,IACM,MAAMA,mBAAAA,CAAAA;AAMX;;;;;;;;;;AAUC,MACD,KAAOC,CAAMC,IAAY,EAAEC,IAAY,EAAE;QACvC,IAAI,CAACC,OAAO,CAACH,KAAK,GAAGI,4CACf,IAAI,CAACD,OAAO,CAACH,KAAK,CAAA,EAAA;AACtB,YAAA,CAACC,OAAOC;;AAEV,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;AACb,QAAA,OAAO,IAAI,CAACF,KAAK,CAAC,OAAS,EAAA,iBAAA,CAAA;AAC7B;AAEA;;;;;AAKC,MACD,KAAe,GAAA;QACb,OAAOK,kBAAAA,CAAU,IAAI,CAACF,OAAO,CAAA;AAC/B;;AA3CA,QAAAG,kBAAA,CAAA,IAAA,EAAQH,SAA0B,EAAA;AAChCH,YAAAA,KAAAA,EAAO,EAAC;YACRO,OAAS,EAAA;AAAC,gBAAA,IAAA;AAAM,gBAAA;AAAM;AACxB,SAAA,CAAA;;AAyCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AChDA;;AAEC,IACM,MAAMC,gBAAAA,CAAAA;AAiBX;;;;;;;;MASOC,WAAYA,CAAAA,WAA8B,EAAE;AACjD,QAAA,IAAI,CAACC,IAAI,CAACD,WAAW,GAAGA,WAAAA;AACxB,QAAA,OAAO,IAAI;AACb;AAkBA;;;;;;;;MASOE,QAASC,CAAAA,QAA2B,EAAE;QAC3C,IAAI,CAACF,IAAI,CAACC,QAAQ,GAAGP,4CA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C,gBAAOkC,CAAAA,IAAAA,EAAAA,WAAAA,EAAY,IAAI,CAACN,IAAI,CAACjD,IAAI,CAAC,IAAI,EAAE,WAAA,CAAA,CAAA;;AAU1C;;;;;;;"}
|
package/dist/vite.js
CHANGED
|
@@ -241,7 +241,7 @@ function _object_spread_props$1(target, source) {
|
|
|
241
241
|
testTimeout: 30000,
|
|
242
242
|
coverage: {
|
|
243
243
|
all: false,
|
|
244
|
-
provider:
|
|
244
|
+
provider: "v8"
|
|
245
245
|
}
|
|
246
246
|
};
|
|
247
247
|
}
|
|
@@ -427,7 +427,11 @@ function _object_spread_props(target, source) {
|
|
|
427
427
|
// sure that your build is building in the correct order and that your
|
|
428
428
|
// actual paths are correct.
|
|
429
429
|
paths: {}
|
|
430
|
-
}
|
|
430
|
+
},
|
|
431
|
+
// Make sure to exclude spec and test files.
|
|
432
|
+
exclude: [
|
|
433
|
+
"**/*.{spec,test}.{js,mjs,cjs,ts,mts,jsx,tsx}"
|
|
434
|
+
]
|
|
431
435
|
});
|
|
432
436
|
const external = externalizeDeps();
|
|
433
437
|
return this.minify(false).sourceMap().plugin(external).plugin(dts);
|
|
@@ -485,9 +489,9 @@ function _object_spread_props(target, source) {
|
|
|
485
489
|
*
|
|
486
490
|
* @param options -
|
|
487
491
|
* The test config to use. If this is falsy,
|
|
488
|
-
* then a test setup using a monorepo with
|
|
489
|
-
*
|
|
490
|
-
*/ test(options = new ZViteTestBuilder().
|
|
492
|
+
* then a test setup using a monorepo with the default
|
|
493
|
+
* provider and environment will be used.
|
|
494
|
+
*/ test(options = new ZViteTestBuilder().monorepo().build()) {
|
|
491
495
|
this.config.test = options;
|
|
492
496
|
return this;
|
|
493
497
|
}
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","sources":["../src/vite/vite-library-builder.mts","../src/vite/vite-test-builder.mts","../src/vite/vite-config-builder.mts","../src/vite/vite-server-builder.mts"],"sourcesContent":["import { cloneDeep } from \"lodash-es\";\nimport type { LibraryOptions } from \"vite\";\n\n/**\n * A builder for Vite library configurations.\n */\nexport class ZViteLibraryBuilder {\n private library: LibraryOptions = {\n entry: {},\n formats: [\"es\", \"cjs\"],\n };\n\n /**\n * Adds an entry point to the library.\n *\n * @param name -\n * The name of the entry point.\n * @param path -\n * The path to the entry point file.\n *\n * @returns\n * This object.\n */\n public entry(name: string, path: string) {\n this.library.entry = {\n ...(this.library.entry as Record<string, string>),\n [name]: path,\n };\n return this;\n }\n\n /**\n * A shorthand for adding an entry point\n * named \"index\" that points to \"src/index.ts\"\n *\n * @returns\n * This object.\n */\n public index() {\n return this.entry(\"index\", \"./src/index.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: undefined,\n },\n };\n }\n\n /**\n * Sets the test environment.\n *\n * @param environment -\n * The test environment to use.\n *\n * @returns\n * This object.\n */\n public environment(environment: VitestEnvironment) {\n this.test.environment = environment;\n return this;\n }\n\n /**\n * Sets the test environment to \"node\".\n *\n * @returns\n * This object.\n */\n public node = this.environment.bind(this, \"node\");\n\n /**\n * Sets the test environment to \"happy-dom\".\n *\n * @returns\n * This object.\n */\n public browser = this.environment.bind(this, \"happy-dom\");\n\n /**\n * Sets the test coverage provider.\n *\n * @param provider -\n * The test coverage provider to use.\n *\n * @returns\n * This object.\n */\n public coverage(provider: \"v8\" | \"istanbul\") {\n this.test.coverage = { ...this.test.coverage, provider };\n return this;\n }\n\n /**\n * Sets the test coverage provider to \"v8\".\n *\n * @returns\n * This object.\n */\n public v8 = this.coverage.bind(this, \"v8\");\n\n /**\n * Sets the test coverage provider to \"istanbul\".\n *\n * @returns\n * This object.\n */\n public istanbul = this.coverage.bind(this, \"istanbul\");\n\n /**\n * Adds to the list of projects.\n *\n * @param project -\n * The list of projects.\n *\n * @returns\n * This object.\n */\n public project(project: string | string[] = []) {\n const projects = this.test.projects || [];\n this.test.projects = projects.concat(project);\n return this;\n }\n\n /**\n * Adds monorepo support to the test builder.\n *\n * @param packages -\n * The path to the package directory.\n *\n * @returns\n * This object.\n */\n public monorepo(packages = \"packages\") {\n return this.project(`${packages}/*/vitest.config.{js,cjs,mjs,ts,mts}`);\n }\n\n /**\n * Returns the built test configuration.\n *\n * @returns\n * A deep clone of the test configuration.\n */\n public build() {\n return cloneDeep(this.test);\n }\n}\n","import 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 { externalizeDeps } from \"vite-plugin-externalize-deps\";\nimport tsConfigPaths from \"vite-tsconfig-paths\";\nimport type { InlineConfig as TestConfig } from \"vitest/node.js\";\nimport { ZViteLibraryBuilder } from \"./vite-library-builder.mjs\";\nimport { ZViteTestBuilder } from \"./vite-test-builder.mjs\";\n\n/**\n * A config builder for the vite build system.\n *\n * This is helpful when building different types\n * of projects and keeping a standard.\n *\n * @example vite.config.ts\n *\n * ```ts\n * // Before Config Builder\n * export default defineConfig({\n * build: {\n * lib: {\n * entry: {\n * index: \"./src/index.ts\",\n * },\n * formats: [\"cjs\", \"es\"],\n * },\n * },\n * minify: false,\n * sourceMap: true,\n * plugins: [\n * swc.vite(),\n * tsConfigPaths(),\n * externalizeDeps(),\n * dtsPlugin({\n * compilerOptions: {\n * paths: {},\n * },\n * }),\n * ],\n * });\n * ```\n *\n * ```ts\n * // After config builder\n * const config = new ZViteConfigBuilder().library().build();\n * export default defineConfig(config);\n * ```\n */\nexport class ZViteConfigBuilder {\n private config: UserConfig;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this.config = {\n build: {\n minify: true,\n sourcemap: false,\n },\n plugins: [\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 });\n const external = externalizeDeps();\n\n return this.minify(false).sourceMap().plugin(external).plugin(dts);\n }\n\n /**\n * Constructs the config to act as if it's compiling a node application.\n *\n * This is just an alias to {@link ZViteConfigBuilder.library} with two\n * entry points.\n *\n * 1. The file src/cli.ts is the main entry point of the application.\n * 1. The file, src/index.ts, is the api for importing 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 an\n * istanbul provider in node is used.\n */\n public test(\n options: TestConfig = new ZViteTestBuilder()\n .node()\n .istanbul()\n .monorepo()\n .build(),\n ) {\n this.config.test = options;\n return this;\n }\n\n /**\n * Returns the currently built config.\n *\n * @returns\n * The currently built config.\n */\n public build() {\n return cloneDeep(this.config);\n }\n}\n","import { cloneDeep, isUndefined, omitBy } from \"lodash-es\";\nimport type { ServerOptions } from \"vite\";\n\nexport class ZViteServerBuilder {\n private options: ServerOptions = {};\n\n public allowedHost(name: string | string[] | true) {\n if (name === true) {\n this.options.allowedHosts = true;\n } else if (this.options.allowedHosts !== true) {\n const hosts = this.options.allowedHosts || [];\n this.options.allowedHosts = hosts.concat(name);\n }\n\n return this;\n }\n\n public denyAllHosts() {\n delete this.options.allowedHosts;\n return this;\n }\n\n public port(port?: number) {\n this.options.port = port;\n return this;\n }\n\n public strictPort() {\n this.options.strictPort = true;\n return this;\n }\n\n public host(ip: string) {\n this.options.host = ip;\n return this;\n }\n\n public localhost = this.host.bind(this, \"127.0.0.1\");\n\n public dev() {\n return this.strictPort().host(\"0.0.0.0\").allowedHost(true);\n }\n\n public build() {\n const clone = cloneDeep(this.options);\n return omitBy<ServerOptions>(clone, isUndefined) as ServerOptions;\n }\n}\n"],"names":["ZViteLibraryBuilder","entry","name","path","library","_object_spread_props","cloneDeep","_define_property","formats","ZViteTestBuilder","environment","test","coverage","provider","project","projects","concat","monorepo","packages","node","bind","browser","v8","istanbul","testTimeout","all","undefined","ZViteConfigBuilder","minify","config","build","plugin","option","plugins","castArray","sourceMap","sourcemap","alias","key","value","resolve","server","options","lib","index","dts","dtsPlugin","compilerOptions","paths","external","externalizeDeps","checker","typescript","web","react","lodash","swc","vite","jsc","transform","runtime","tsConfigPaths","ZViteServerBuilder","allowedHost","allowedHosts","hosts","denyAllHosts","port","strictPort","host","ip","dev","clone","omitBy","isUndefined","localhost"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAEC,IACM,MAAMA,mBAAAA,CAAAA;AAMX;;;;;;;;;;AAUC,MACD,KAAOC,CAAMC,IAAY,EAAEC,IAAY,EAAE;QACvC,IAAI,CAACC,OAAO,CAACH,KAAK,GAAGI,4CACf,IAAI,CAACD,OAAO,CAACH,KAAK,CAAA,E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AO,CAACsB,YAAY;AAChC,QAAA,OAAO,IAAI;AACb;AAEOG,IAAAA,IAAAA,CAAKA,IAAa,EAAE;AACzB,QAAA,IAAI,CAACzB,OAAO,CAACyB,IAAI,GAAGA,IAAAA;AACpB,QAAA,OAAO,IAAI;AACb;IAEOC,UAAa,GAAA;AAClB,QAAA,IAAI,CAAC1B,OAAO,CAAC0B,UAAU,GAAG,IAAA;AAC1B,QAAA,OAAO,IAAI;AACb;AAEOC,IAAAA,IAAAA,CAAKC,EAAU,EAAE;AACtB,QAAA,IAAI,CAAC5B,OAAO,CAAC2B,IAAI,GAAGC,EAAAA;AACpB,QAAA,OAAO,IAAI;AACb;IAIOC,GAAM,GAAA;QACX,OAAO,IAAI,CAACH,UAAU,EAAA,CAAGC,IAAI,CAAC,SAAA,CAAA,CAAWN,WAAW,CAAC,IAAA,CAAA;AACvD;IAEOjC,KAAQ,GAAA;AACb,QAAA,MAAM0C,KAAQlE,GAAAA,SAAAA,CAAU,IAAI,CAACoC,OAAO,CAAA;AACpC,QAAA,OAAO+B,OAAsBD,KAAOE,EAAAA,WAAAA,CAAAA;AACtC;;AA1CA,QAAA,gBAAA,CAAA,IAAA,EAAQhC,WAAyB,EAAC,CAAA;QAiClC,gBAAOiC,CAAAA,IAAAA,EAAAA,WAAAA,EAAY,IAAI,CAACN,IAAI,CAACjD,IAAI,CAAC,IAAI,EAAE,WAAA,CAAA,CAAA;;AAU1C;;;;"}
|
|
1
|
+
{"version":3,"file":"vite.js","sources":["../src/vite/vite-library-builder.mts","../src/vite/vite-test-builder.mts","../src/vite/vite-config-builder.mts","../src/vite/vite-server-builder.mts"],"sourcesContent":["import { cloneDeep } from \"lodash-es\";\nimport type { LibraryOptions } from \"vite\";\n\n/**\n * A builder for Vite library configurations.\n */\nexport class ZViteLibraryBuilder {\n private library: LibraryOptions = {\n entry: {},\n formats: [\"es\", \"cjs\"],\n };\n\n /**\n * Adds an entry point to the library.\n *\n * @param name -\n * The name of the entry point.\n * @param path -\n * The path to the entry point file.\n *\n * @returns\n * This object.\n */\n public entry(name: string, path: string) {\n this.library.entry = {\n ...(this.library.entry as Record<string, string>),\n [name]: path,\n };\n return this;\n }\n\n /**\n * A shorthand for adding an entry point\n * named \"index\" that points to \"src/index.ts\"\n *\n * @returns\n * This object.\n */\n public index() {\n return this.entry(\"index\", \"./src/index.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 { externalizeDeps } from \"vite-plugin-externalize-deps\";\nimport tsConfigPaths from \"vite-tsconfig-paths\";\nimport type { InlineConfig as TestConfig } from \"vitest/node.js\";\nimport { ZViteLibraryBuilder } from \"./vite-library-builder.mjs\";\nimport { ZViteTestBuilder } from \"./vite-test-builder.mjs\";\n\n/**\n * A config builder for the vite build system.\n *\n * This is helpful when building different types\n * of projects and keeping a standard.\n *\n * @example vite.config.ts\n *\n * ```ts\n * // Before Config Builder\n * export default defineConfig({\n * build: {\n * lib: {\n * entry: {\n * index: \"./src/index.ts\",\n * },\n * formats: [\"cjs\", \"es\"],\n * },\n * },\n * minify: false,\n * sourceMap: true,\n * plugins: [\n * swc.vite(),\n * tsConfigPaths(),\n * externalizeDeps(),\n * dtsPlugin({\n * compilerOptions: {\n * paths: {},\n * },\n * }),\n * ],\n * });\n * ```\n *\n * ```ts\n * // After config builder\n * const config = new ZViteConfigBuilder().library().build();\n * export default defineConfig(config);\n * ```\n */\nexport class ZViteConfigBuilder {\n private config: UserConfig;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this.config = {\n build: {\n minify: true,\n sourcemap: false,\n },\n plugins: [\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.minify(false).sourceMap().plugin(external).plugin(dts);\n }\n\n /**\n * Constructs the config to act as if it's compiling a node application.\n *\n * This is just an alias to {@link ZViteConfigBuilder.library} with two\n * entry points.\n *\n * 1. The file src/cli.ts is the main entry point of the application.\n * 1. The file, src/index.ts, is the api for importing 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":["ZViteLibraryBuilder","entry","name","path","library","_object_spread_props","cloneDeep","_define_property","formats","ZViteTestBuilder","environment","test","coverage","provider","project","projects","concat","monorepo","packages","node","bind","browser","v8","istanbul","testTimeout","all","ZViteConfigBuilder","minify","config","build","plugin","option","plugins","castArray","sourceMap","sourcemap","alias","key","value","resolve","server","options","lib","index","dts","dtsPlugin","compilerOptions","paths","exclude","external","externalizeDeps","checker","typescript","web","react","lodash","swc","vite","jsc","transform","runtime","tsConfigPaths","ZViteServerBuilder","allowedHost","allowedHosts","hosts","denyAllHosts","port","strictPort","host","ip","dev","clone","omitBy","isUndefined","localhost"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAEC,IACM,MAAMA,mBAAAA,CAAAA;AAMX;;;;;;;;;;AAUC,MACD,KAAOC,CAAMC,IAAY,EAAEC,IAAY,EAAE;QACvC,IAAI,CAACC,OAAO,CAACH,KAAK,GAAGI,4CACf,IAAI,CAACD,OAAO,CAACH,KAAK,CAAA,EAAA;AACtB,YAAA,CAACC,OAAOC;;AAEV,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;AACb,QAAA,OAAO,IAAI,CAACF,KAAK,CAAC,OAAS,EAAA,iBA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,IAAI;AACb;IAEOC,UAAa,GAAA;AAClB,QAAA,IAAI,CAAC3B,OAAO,CAAC2B,UAAU,GAAG,IAAA;AAC1B,QAAA,OAAO,IAAI;AACb;AAEOC,IAAAA,IAAAA,CAAKC,EAAU,EAAE;AACtB,QAAA,IAAI,CAAC7B,OAAO,CAAC4B,IAAI,GAAGC,EAAAA;AACpB,QAAA,OAAO,IAAI;AACb;IAIOC,GAAM,GAAA;QACX,OAAO,IAAI,CAACH,UAAU,EAAA,CAAGC,IAAI,CAAC,SAAA,CAAA,CAAWN,WAAW,CAAC,IAAA,CAAA;AACvD;IAEOlC,KAAQ,GAAA;AACb,QAAA,MAAM2C,KAAQlE,GAAAA,SAAAA,CAAU,IAAI,CAACmC,OAAO,CAAA;AACpC,QAAA,OAAOgC,OAAsBD,KAAOE,EAAAA,WAAAA,CAAAA;AACtC;;AA1CA,QAAA,gBAAA,CAAA,IAAA,EAAQjC,WAAyB,EAAC,CAAA;QAiClC,gBAAOkC,CAAAA,IAAAA,EAAAA,WAAAA,EAAY,IAAI,CAACN,IAAI,CAACjD,IAAI,CAAC,IAAI,EAAE,WAAA,CAAA,CAAA;;AAU1C;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zthun/janitor-build-config",
|
|
3
|
-
"version": "19.2.
|
|
3
|
+
"version": "19.2.4",
|
|
4
4
|
"description": "A shared configuration for builds that create websites, apis, and tests",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.mts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@swc/core": "^1.12.
|
|
34
|
+
"@swc/core": "^1.12.5",
|
|
35
35
|
"@vitejs/plugin-react": "^4.5.2",
|
|
36
36
|
"lodash-es": "^4.17.21",
|
|
37
37
|
"typedoc": "^0.28.5",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
68
|
"author": "Anthony Bonta",
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "24a9f86fd4ef64c787d21e6de607718f739ad38f"
|
|
70
70
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|