@zthun/janitor-vite 21.1.4 → 21.2.0
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/extensions/extension-test-serially.d.mts +14 -0
- package/dist/index.cjs +27 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.js +27 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* An extension plugin that makes vitest run serially, without parallelism.
|
|
4
|
+
*
|
|
5
|
+
* Normally, you don't want this and your test performance will
|
|
6
|
+
* be negatively impacted; however, if your tests use shared resources
|
|
7
|
+
* and only allow one access point to those resources at a time, use this extension
|
|
8
|
+
* for your library/project to run tests one at a time.
|
|
9
|
+
*
|
|
10
|
+
* @returns
|
|
11
|
+
* A plugin set that makes vitest run all tests serially instead of in
|
|
12
|
+
* parallel.
|
|
13
|
+
*/
|
|
14
|
+
export declare function extensionTestSerially(): Plugin[];
|
package/dist/index.cjs
CHANGED
|
@@ -166,6 +166,31 @@ function resolveCwd(current) {
|
|
|
166
166
|
];
|
|
167
167
|
}
|
|
168
168
|
//#endregion
|
|
169
|
+
//#region src/extensions/extension-test-serially.mts
|
|
170
|
+
/**
|
|
171
|
+
* An extension plugin that makes vitest run serially, without parallelism.
|
|
172
|
+
*
|
|
173
|
+
* Normally, you don't want this and your test performance will
|
|
174
|
+
* be negatively impacted; however, if your tests use shared resources
|
|
175
|
+
* and only allow one access point to those resources at a time, use this extension
|
|
176
|
+
* for your library/project to run tests one at a time.
|
|
177
|
+
*
|
|
178
|
+
* @returns
|
|
179
|
+
* A plugin set that makes vitest run all tests serially instead of in
|
|
180
|
+
* parallel.
|
|
181
|
+
*/ function extensionTestSerially() {
|
|
182
|
+
return [{
|
|
183
|
+
name: "janitor:extension-test-serially",
|
|
184
|
+
config: () => {
|
|
185
|
+
return { test: {
|
|
186
|
+
fileParallelism: false,
|
|
187
|
+
maxConcurrency: 1,
|
|
188
|
+
isolate: true
|
|
189
|
+
} };
|
|
190
|
+
}
|
|
191
|
+
}];
|
|
192
|
+
}
|
|
193
|
+
//#endregion
|
|
169
194
|
//#region src/projects/project.mts
|
|
170
195
|
/**
|
|
171
196
|
* The base plugin for all project types.
|
|
@@ -214,7 +239,7 @@ function resolveCwd(current) {
|
|
|
214
239
|
*/ function projectNode() {
|
|
215
240
|
return [
|
|
216
241
|
...project(),
|
|
217
|
-
...extensionExternalize(
|
|
242
|
+
...extensionExternalize(),
|
|
218
243
|
{
|
|
219
244
|
name: "janitor:project-node",
|
|
220
245
|
config: (current) => {
|
|
@@ -337,6 +362,7 @@ function resolveCwd(current) {
|
|
|
337
362
|
exports.extensionDevServer = extensionDevServer;
|
|
338
363
|
exports.extensionExternalize = extensionExternalize;
|
|
339
364
|
exports.extensionLibrary = extensionLibrary;
|
|
365
|
+
exports.extensionTestSerially = extensionTestSerially;
|
|
340
366
|
exports.project = project;
|
|
341
367
|
exports.projectCli = projectCli;
|
|
342
368
|
exports.projectDom = projectDom;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["extensionDevServer","options","port","host","name","config","server","allowedHosts","strictPort","builtinModules","modules","getAllNodeBuiltins","map","m","RegExp","readFileSync","getAllPackageDependencies","pkg","externals","Set","contents","toString","dependencies","devDependencies","optionalDependencies","peerDependencies","JSON","parse","push","add","bind","Object","keys","concat","map","dep","RegExp","forEach","Array","from","resolveCwd","current","root","process","cwd","resolve","getAllNodeBuiltins","getAllPackageDependencies","resolveCwd","extensionExternalize","options","name","config","current","cwd","fallback","packageJson","externalDeps","Set","forEach","p","add","depMatchers","Array","from","build","rolldownOptions","external","source","some","depMatcher","test","resolve","castArray","dts","resolveCwd","extensionExternalize","extensionLibrary","compilerOptions","paths","include","exclude","name","config","current","cwd","build","lib","minify","sourcemap","entry","index","formats","swc","project","vite","jsc","transform","react","runtime","name","config","oxc","resolve","tsconfigPaths","build","chunkSizeWarningLimit","minify","sourcemap","rolldownOptions","checks","pluginTimings","test","globals","testTimeout","maxConcurrency","resolve","extensionExternalize","resolveCwd","project","projectNode","packageJson","name","config","current","cwd","conditions","mainFields","build","lib","entry","main","formats","projectNode","projectCli","name","project","projectDom","name","config","test","environment","pool","environmentOptions","happyDOM","settings","handleDisabledFileLoadingAsSuccess","resolveCwd","project","projectMonorepo","name","config","current","cwd","test","projects","projectNode","projectNestJs","name","react","projectDom","projectReact","name","config","oxc"],"sources":["../src/extensions/extension-dev-server.mts","../src/helpful/get-all-node-builtins.mts","../src/helpful/get-all-package-dependencies.mts","../src/helpful/resolve-cwd.mts","../src/extensions/extension-externalize.mts","../src/extensions/extension-library.mts","../src/projects/project.mts","../src/projects/project-node.mts","../src/projects/project-cli.mts","../src/projects/project-dom.mts","../src/projects/project-monorepo.mts","../src/projects/project-nestjs.mts","../src/projects/project-react.mts"],"sourcesContent":["import type { Plugin } from \"vite\";\n\n/**\n * Options for the dev server.\n *\n * The expectation for almost every repository in this instance\n * is that it is running the backend and frontend in a docker\n * compose environment, so it assumes it will be running in a docker\n * network. \n *\n * If this isn't true, then these options will be useful.\n */\nexport interface ExtensionDevServerOptions {\n /**\n * The port to run on. \n *\n * @default 5173\n */\n port?: number;\n\n /**\n * The binding host.\n *\n * @default \"0.0.0.0\"\n */\n host?: string;\n}\n\n/**\n * Adds a dev server to your vite build.\n *\n * This is usually paired with a dom based project and\n * is only used for debugging. AllowedHosts in this plugin\n * is set to true to allow for local manipulation of the\n * OS host file to simulate true domains.\n *\n * @returns\n * A list of plugins that add the dev server option.\n */\nexport function extensionDevServer(\n options: ExtensionDevServerOptions = {},\n): Plugin[] {\n const { port = 5173, host = \"0.0.0.0\" } = options;\n\n return [\n {\n name: \"janitor:extension-dev-server\",\n config: () => {\n return {\n server: {\n allowedHosts: true,\n strictPort: true,\n host,\n port,\n },\n };\n },\n },\n ];\n}\n","import { builtinModules as modules } from \"node:module\";\n\nexport function getAllNodeBuiltins(): RegExp[] {\n return modules.map((m) => new RegExp(`^(?:node:)?${m}$`));\n}\n","import { type PathLike, readFileSync } from \"node:fs\";\n\nexport function getAllPackageDependencies(pkg: PathLike): RegExp[] {\n try {\n const externals = new Set<RegExp>();\n\n const contents = readFileSync(pkg).toString();\n const {\n dependencies = [],\n devDependencies = [],\n optionalDependencies = [],\n peerDependencies = [],\n } = JSON.parse(contents) as Record<string, Record<string, string>>;\n\n const push = externals.add.bind(externals);\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 return Array.from(externals);\n } catch {\n return [];\n }\n}\n","import type { UserConfig } from \"vite\";\n\nexport function resolveCwd(current?: UserConfig): string {\n return current?.root || process.cwd();\n}\n","import type { PathLike } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport type { Plugin, UserConfig } from \"vite\";\n\nimport { getAllNodeBuiltins } from \"../helpful/get-all-node-builtins.mjs\";\nimport { getAllPackageDependencies } from \"../helpful/get-all-package-dependencies.mjs\";\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\n\n/**\n * Options for externalizing dependencies.\n */\nexport interface ExternalizeOptions {\n /**\n * The path to the package json file that contains dependencies\n * to externalize or false to only externalize node builtins.\n *\n * If this is undefined, then the package.json in the current\n * working directory will be used.\n */\n packageJson?: PathLike | false;\n}\n\n/**\n * An externalize extension tells a project to not bundle the dependencies together. \n *\n * This is mostly used for libraries and if you use extensionLibrary(), or projectNode()\n * you do not need to include this extension as it will be included for you already.\n *\n * @param options -\n * Optional options for how to externalize dependency values.\n *\n * @returns\n * A list of plugins that will stop vite from bundling packages\n * from the node_modules directory and node builtins.\n */\nexport const extensionExternalize = (\n options: ExternalizeOptions = {},\n): Plugin[] => {\n return [\n {\n name: \"janitor:extension-externalize\",\n config: (current) => {\n const cwd = resolveCwd(current);\n const fallback = resolve(cwd, \"package.json\");\n const { packageJson = fallback } = options;\n const externalDeps = new Set<RegExp>(getAllNodeBuiltins());\n\n if (packageJson !== false) {\n getAllPackageDependencies(packageJson).forEach((p) =>\n externalDeps.add(p),\n );\n }\n\n const depMatchers = Array.from(externalDeps);\n\n return {\n build: {\n rolldownOptions: {\n external: (source) => {\n return depMatchers.some((depMatcher) =>\n depMatcher.test(source),\n );\n },\n },\n },\n } satisfies UserConfig;\n },\n },\n ];\n};\n","import { resolve } from \"node:path\";\n\nimport { castArray } from \"lodash-es\";\nimport dts from \"unplugin-dts/vite\";\nimport type { Plugin } from \"vite\";\n\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\nimport { extensionExternalize } from \"./extension-externalize.mjs\";\n\n/**\n * Turns any project into a shared library.\n *\n * A library does not actually run any code, it simply contains shared\n * code that makes up other projects.\n *\n * A library is expected to have an index.mts file under the src directory\n * that is a long list of exports that the library will provide to consumers.\n * Only one barrel export should be used for a library. It's better to have\n * multiple libraries than to complicate a library with subpaths in the\n * exports of package.json. This keeps the expectations that when you npm\n * library \"foo\", you can do import { something } from 'foo' and not need to\n * have the brain overload of hunting down available paths from within.\n *\n * When you classify something as a library, source maps are turned on,\n * and none of your code for it will be minified. This is to help with\n * debugging library code outside of the library development environment.\n * Module libraries in the janitor system are not expected to be deployed\n * to a system by themselves. They are bundled with the overarching parent\n * application.\n *\n * Note that if you combine this with something like node or nest, which\n * expects a main.mts file as the entry point, that entry point goes away\n * and the index.mts file will take over.\n *\n * @returns\n * The list of plugins that turn any project into a library.\n */\nexport function extensionLibrary(): Plugin[] {\n return [\n ...extensionExternalize(),\n ...castArray(\n dts({\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 // We only want to include output source files, not any config files outside\n // of our source code directory.\n include: [\"src/**/*.{js,mjs,cjs,ts,mts,jsx,tsx}\"],\n // Make sure to exclude spec and test files as well, these don't need to\n // be included (and shouldn't be).\n exclude: [\"**/*.{spec,test}.{js,mjs,cjs,ts,mts,jsx,tsx}\"],\n }),\n ),\n {\n name: \"janitor:extension-library\",\n config: (current) => {\n const cwd = resolveCwd(current);\n\n // The library extension fully controls the lib, so if we have additional\n // formats or entry points, those have to go away.\n delete current?.build?.lib;\n\n return {\n build: {\n minify: false,\n sourcemap: true,\n lib: {\n entry: {\n index: resolve(cwd, \"./src/index.mts\"),\n },\n formats: [\"cjs\", \"es\"],\n },\n },\n };\n },\n },\n ];\n}\n","import swc from \"unplugin-swc\";\nimport type { Plugin } from \"vite\";\n\n/**\n * The base plugin for all project types.\n *\n * This will be included with every project. The default build engine for all projects\n * is swc. While esbuild and oxc outperform swc, swc has the closest and most accurate\n * implementation of the latest ECMAScript features which gives us one unified build engine.\n *\n * A vite build should only include one project type and as many extensions as it wants.\n *\n * @returns\n * A list of plugins that all project types will provide.\n */\nexport function project(): Plugin[] {\n return [\n swc.vite({\n jsc: {\n transform: {\n react: {\n runtime: \"automatic\",\n },\n },\n },\n }),\n {\n name: \"janitor:project\",\n config: () => {\n return {\n oxc: false,\n resolve: {\n tsconfigPaths: true,\n },\n build: {\n chunkSizeWarningLimit: 8000,\n minify: true,\n sourcemap: false,\n rolldownOptions: {\n checks: {\n pluginTimings: false,\n },\n },\n },\n test: {\n globals: true,\n testTimeout: 20000,\n maxConcurrency: 10,\n },\n };\n },\n },\n ];\n}\n","import { resolve } from \"node:path\";\n\nimport type { Plugin } from \"vite\";\n\nimport { extensionExternalize } from \"../extensions/extension-externalize.mjs\";\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\nimport { project } from \"./project.mjs\";\n\n/**\n * A plugin that marks a project as a node application.\n *\n * Node applications expect an entry point of main.mts under the\n * src directory.\n *\n * @returns\n * A list of plugins that turn a project into a node base cli\n * project.\n */\nexport function projectNode(): Plugin[] {\n return [\n ...project(),\n ...extensionExternalize({ packageJson: false }),\n {\n name: \"janitor:project-node\",\n config: (current) => {\n const cwd = resolveCwd(current);\n\n return {\n resolve: {\n conditions: [\"module\", \"node\", \"development|production\"],\n mainFields: [\"module\", \"jsnext:main\", \"jsnext\"],\n },\n build: {\n lib: {\n entry: {\n main: resolve(cwd, \"./src/main.mts\"),\n },\n formats: [\"es\"],\n },\n },\n };\n },\n },\n ];\n}\n","import type { Plugin } from \"vite\";\n\nimport { projectNode } from \"./project-node.mjs\";\n\n/**\n * Currently the same as {@link projectNode}.\n *\n * @returns\n * A list of plugins that turn your project into a cli.\n */\nexport function projectCli(): Plugin[] {\n return [\n ...projectNode(),\n {\n name: \"janitor:project-cli\",\n },\n ];\n}\n","import \"vitest/config\";\n\nimport type { Plugin } from \"vite\";\n\nimport { project } from \"./project.mjs\";\n\n/**\n * A project for the DOM is a frontend application built with\n * basic web components, html, and css.\n *\n * Frontend projects with frameworks will automatically have this plugin.\n *\n * This will set the testing environment to happy-dom.\n *\n * @returns\n * A list of plugins that setup a vite build as a project for\n * a frontend.\n */\nexport function projectDom(): Plugin[] {\n return [\n ...project(),\n {\n name: \"janitor:project-dom\",\n config: () => {\n return {\n test: {\n environment: \"happy-dom\",\n pool: \"vmThreads\",\n environmentOptions: {\n happyDOM: {\n settings: {\n // This is to shut up happy-dom yelling about not being able\n // to download some injected css files.\n handleDisabledFileLoadingAsSuccess: true,\n },\n },\n },\n },\n };\n },\n },\n ];\n}\n","import \"vitest/config\";\n\nimport type { Plugin } from \"vite\";\n\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\nimport { project } from \"./project.mjs\";\n\n/**\n * A special project type for the root vite config or vitest config where\n * the repository is a monorepo of packages that use more than one config entry\n * for each package.\n *\n * This should only be set in a monorepo where the root just specifies which\n * packages the monorepo outputs. It sets up vitest to look for vite.config\n * files under each package.\n *\n * @returns\n * The list of plugins to use for the root monorepo.\n */\nexport function projectMonorepo(): Plugin[] {\n return [\n ...project(),\n {\n name: \"janitor:project-monorepo\",\n config: (current) => {\n const cwd = resolveCwd(current);\n\n return {\n test: {\n projects: [\n `${cwd}/packages/*/{vite,vitest}.config.{js,cjs,mjs,ts,mts}`,\n ],\n },\n };\n },\n },\n ];\n}\n","import type { Plugin } from \"vite\";\n\nimport { projectNode } from \"./project-node.mjs\";\n\n/**\n * Currently the same as {@link projectNode}.\n *\n * @returns\n * A list of plugins that turn your project into an app that\n * runs a NestJS backend.\n */\nexport function projectNestJs(): Plugin[] {\n return [\n ...projectNode(),\n {\n name: \"janitor:project-nestjs\",\n },\n ];\n}\n","import react from \"@vitejs/plugin-react-swc\";\nimport type { Plugin } from \"vite\";\n\nimport { projectDom } from \"./project-dom.mjs\";\n\n/**\n * A project that builds out a react website.\n *\n * A react website is just a dom project that has the\n * react swc plugin enabled.\n *\n * This should normally be coupled with the server extension\n * for full debugging support.\n *\n * @returns\n * A list of plugins that builds a react website.\n */\nexport function projectReact(): Plugin[] {\n return [\n ...projectDom(),\n ...react(),\n {\n name: \"janitor:project-react\",\n config: () => {\n return {\n oxc: false,\n };\n },\n },\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCA,SAAgBA,mBACdC,UAAqC,CAAC,GAAC;CAEvC,MAAM,EAAEC,OAAO,MAAMC,OAAO,cAAcF;CAE1C,OAAO,CACL;EACEG,MAAM;EACNC,cAAQ;GACN,OAAO,EACLC,QAAQ;IACNC,cAAc;IACdC,YAAY;IACZL;IACAD;GACF,EACF;EACF;CACF,CACD;AACH;;;ACzDA,SAAgBS,qBAAAA;CACd,OAAOD,YAAAA,eAAQE,KAAKC,MAAM,IAAIC,OAAO,cAAcD,EAAE,EAAE,CAAA;AACzD;;;ACFA,SAAgBG,0BAA0BC,KAAa;CACrD,IAAI;EACF,MAAMC,4BAAY,IAAIC,IAAAA;EAEtB,MAAMC,YAAAA,GAAWL,QAAAA,aAAAA,CAAaE,GAAAA,CAAAA,CAAKI,SAAQ;EAC3C,MAAM,EACJC,eAAe,CA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jD;KACAC,OAAO,EACLC,KAAK;MACHC,OAAO,EACLC,OAAAA,GAAMf,UAAAA,QAAAA,CAAQS,KAAK,gBAAA,EACrB;MACAO,SAAS,CAAC,IAAK;KACjB,EACF;IACF;GACF;EACF;CACD;AACH;;;;;;;;GClCA,SAAgBE,aAAAA;CACd,OAAO,CACFD,GAAAA,YAAAA,GACH,EACEE,MAAM,sBACR,CACD;AACH;;;;;;;;;;;;;;GCCA,SAAgBE,aAAAA;CACd,OAAO,CACFD,GAAAA,QAAAA,GACH;EACEE,MAAM;EACNC,cAAQ;GACN,OAAO,EACLC,MAAM;IACJC,aAAa;IACbC,MAAM;IACNC,oBAAoB,EAClBC,UAAU,EACRC,UAAU,EAGRC,oCAAoC,KACtC,EACF,EACF;GACF,EACF;EACF;CACF,CACD;AACH;;;;;;;;;;;;;;GCvBA,SAAgBG,kBAAAA;CACd,OAAO,CACFD,GAAAA,QAAAA,GACH;EACEE,MAAM;EACNC,SAASC,YAAAA;GAGP,OAAO,EACLE,MAAM,EACJC,UAAU,CACR,GALMR,WAAWK,OAKdC,EAAI,qDACR,EACH,EACF;EACF;CACF,CACD;AACH;;;;;;;;;GC1BA,SAAgBI,gBAAAA;CACd,OAAO,CACFD,GAAAA,YAAAA,GACH,EACEE,MAAM,yBACR,CACD;AACH;;;;;;;;;;;;;;GCDA,SAAgBG,eAAAA;CACd,OAAO;EACFD,GAAAA,WAAAA;EACAD,IAAAA,GAAAA,yBAAAA,QAAAA,CAAAA;EACH;GACEG,MAAM;GACNC,cAAQ;IACN,OAAO,EACLC,KAAK,MACP;GACF;EACF;CACD;AACH"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["extensionDevServer","options","port","host","name","config","server","allowedHosts","strictPort","builtinModules","modules","getAllNodeBuiltins","map","m","RegExp","readFileSync","getAllPackageDependencies","pkg","externals","Set","contents","toString","dependencies","devDependencies","optionalDependencies","peerDependencies","JSON","parse","push","add","bind","Object","keys","concat","map","dep","RegExp","forEach","Array","from","resolveCwd","current","root","process","cwd","resolve","getAllNodeBuiltins","getAllPackageDependencies","resolveCwd","extensionExternalize","options","name","config","current","cwd","fallback","packageJson","externalDeps","Set","forEach","p","add","depMatchers","Array","from","build","rolldownOptions","external","source","some","depMatcher","test","resolve","castArray","dts","resolveCwd","extensionExternalize","extensionLibrary","compilerOptions","paths","include","exclude","name","config","current","cwd","build","lib","minify","sourcemap","entry","index","formats","extensionTestSerially","name","config","test","fileParallelism","maxConcurrency","isolate","swc","project","vite","jsc","transform","react","runtime","name","config","oxc","resolve","tsconfigPaths","build","chunkSizeWarningLimit","minify","sourcemap","rolldownOptions","checks","pluginTimings","test","globals","testTimeout","maxConcurrency","resolve","extensionExternalize","resolveCwd","project","projectNode","name","config","current","cwd","conditions","mainFields","build","lib","entry","main","formats","projectNode","projectCli","name","project","projectDom","name","config","test","environment","pool","environmentOptions","happyDOM","settings","handleDisabledFileLoadingAsSuccess","resolveCwd","project","projectMonorepo","name","config","current","cwd","test","projects","projectNode","projectNestJs","name","react","projectDom","projectReact","name","config","oxc"],"sources":["../src/extensions/extension-dev-server.mts","../src/helpful/get-all-node-builtins.mts","../src/helpful/get-all-package-dependencies.mts","../src/helpful/resolve-cwd.mts","../src/extensions/extension-externalize.mts","../src/extensions/extension-library.mts","../src/extensions/extension-test-serially.mts","../src/projects/project.mts","../src/projects/project-node.mts","../src/projects/project-cli.mts","../src/projects/project-dom.mts","../src/projects/project-monorepo.mts","../src/projects/project-nestjs.mts","../src/projects/project-react.mts"],"sourcesContent":["import type { Plugin } from \"vite\";\n\n/**\n * Options for the dev server.\n *\n * The expectation for almost every repository in this instance\n * is that it is running the backend and frontend in a docker\n * compose environment, so it assumes it will be running in a docker\n * network. \n *\n * If this isn't true, then these options will be useful.\n */\nexport interface ExtensionDevServerOptions {\n /**\n * The port to run on. \n *\n * @default 5173\n */\n port?: number;\n\n /**\n * The binding host.\n *\n * @default \"0.0.0.0\"\n */\n host?: string;\n}\n\n/**\n * Adds a dev server to your vite build.\n *\n * This is usually paired with a dom based project and\n * is only used for debugging. AllowedHosts in this plugin\n * is set to true to allow for local manipulation of the\n * OS host file to simulate true domains.\n *\n * @returns\n * A list of plugins that add the dev server option.\n */\nexport function extensionDevServer(\n options: ExtensionDevServerOptions = {},\n): Plugin[] {\n const { port = 5173, host = \"0.0.0.0\" } = options;\n\n return [\n {\n name: \"janitor:extension-dev-server\",\n config: () => {\n return {\n server: {\n allowedHosts: true,\n strictPort: true,\n host,\n port,\n },\n };\n },\n },\n ];\n}\n","import { builtinModules as modules } from \"node:module\";\n\nexport function getAllNodeBuiltins(): RegExp[] {\n return modules.map((m) => new RegExp(`^(?:node:)?${m}$`));\n}\n","import { type PathLike, readFileSync } from \"node:fs\";\n\nexport function getAllPackageDependencies(pkg: PathLike): RegExp[] {\n try {\n const externals = new Set<RegExp>();\n\n const contents = readFileSync(pkg).toString();\n const {\n dependencies = [],\n devDependencies = [],\n optionalDependencies = [],\n peerDependencies = [],\n } = JSON.parse(contents) as Record<string, Record<string, string>>;\n\n const push = externals.add.bind(externals);\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 return Array.from(externals);\n } catch {\n return [];\n }\n}\n","import type { UserConfig } from \"vite\";\n\nexport function resolveCwd(current?: UserConfig): string {\n return current?.root || process.cwd();\n}\n","import type { PathLike } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport type { Plugin, UserConfig } from \"vite\";\n\nimport { getAllNodeBuiltins } from \"../helpful/get-all-node-builtins.mjs\";\nimport { getAllPackageDependencies } from \"../helpful/get-all-package-dependencies.mjs\";\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\n\n/**\n * Options for externalizing dependencies.\n */\nexport interface ExternalizeOptions {\n /**\n * The path to the package json file that contains dependencies\n * to externalize or false to only externalize node builtins.\n *\n * If this is undefined, then the package.json in the current\n * working directory will be used.\n */\n packageJson?: PathLike | false;\n}\n\n/**\n * An externalize extension tells a project to not bundle the dependencies together. \n *\n * This is mostly used for libraries and if you use extensionLibrary(), or projectNode()\n * you do not need to include this extension as it will be included for you already.\n *\n * @param options -\n * Optional options for how to externalize dependency values.\n *\n * @returns\n * A list of plugins that will stop vite from bundling packages\n * from the node_modules directory and node builtins.\n */\nexport const extensionExternalize = (\n options: ExternalizeOptions = {},\n): Plugin[] => {\n return [\n {\n name: \"janitor:extension-externalize\",\n config: (current) => {\n const cwd = resolveCwd(current);\n const fallback = resolve(cwd, \"package.json\");\n const { packageJson = fallback } = options;\n const externalDeps = new Set<RegExp>(getAllNodeBuiltins());\n\n if (packageJson !== false) {\n getAllPackageDependencies(packageJson).forEach((p) =>\n externalDeps.add(p),\n );\n }\n\n const depMatchers = Array.from(externalDeps);\n\n return {\n build: {\n rolldownOptions: {\n external: (source) => {\n return depMatchers.some((depMatcher) =>\n depMatcher.test(source),\n );\n },\n },\n },\n } satisfies UserConfig;\n },\n },\n ];\n};\n","import { resolve } from \"node:path\";\n\nimport { castArray } from \"lodash-es\";\nimport dts from \"unplugin-dts/vite\";\nimport type { Plugin } from \"vite\";\n\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\nimport { extensionExternalize } from \"./extension-externalize.mjs\";\n\n/**\n * Turns any project into a shared library.\n *\n * A library does not actually run any code, it simply contains shared\n * code that makes up other projects.\n *\n * A library is expected to have an index.mts file under the src directory\n * that is a long list of exports that the library will provide to consumers.\n * Only one barrel export should be used for a library. It's better to have\n * multiple libraries than to complicate a library with subpaths in the\n * exports of package.json. This keeps the expectations that when you npm\n * library \"foo\", you can do import { something } from 'foo' and not need to\n * have the brain overload of hunting down available paths from within.\n *\n * When you classify something as a library, source maps are turned on,\n * and none of your code for it will be minified. This is to help with\n * debugging library code outside of the library development environment.\n * Module libraries in the janitor system are not expected to be deployed\n * to a system by themselves. They are bundled with the overarching parent\n * application.\n *\n * Note that if you combine this with something like node or nest, which\n * expects a main.mts file as the entry point, that entry point goes away\n * and the index.mts file will take over.\n *\n * @returns\n * The list of plugins that turn any project into a library.\n */\nexport function extensionLibrary(): Plugin[] {\n return [\n ...extensionExternalize(),\n ...castArray(\n dts({\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 // We only want to include output source files, not any config files outside\n // of our source code directory.\n include: [\"src/**/*.{js,mjs,cjs,ts,mts,jsx,tsx}\"],\n // Make sure to exclude spec and test files as well, these don't need to\n // be included (and shouldn't be).\n exclude: [\"**/*.{spec,test}.{js,mjs,cjs,ts,mts,jsx,tsx}\"],\n }),\n ),\n {\n name: \"janitor:extension-library\",\n config: (current) => {\n const cwd = resolveCwd(current);\n\n // The library extension fully controls the lib, so if we have additional\n // formats or entry points, those have to go away.\n delete current?.build?.lib;\n\n return {\n build: {\n minify: false,\n sourcemap: true,\n lib: {\n entry: {\n index: resolve(cwd, \"./src/index.mts\"),\n },\n formats: [\"cjs\", \"es\"],\n },\n },\n };\n },\n },\n ];\n}\n","import type { Plugin } from \"vite\";\n\n/**\n * An extension plugin that makes vitest run serially, without parallelism.\n *\n * Normally, you don't want this and your test performance will\n * be negatively impacted; however, if your tests use shared resources\n * and only allow one access point to those resources at a time, use this extension\n * for your library/project to run tests one at a time.\n *\n * @returns\n * A plugin set that makes vitest run all tests serially instead of in\n * parallel.\n */\nexport function extensionTestSerially(): Plugin[] {\n return [\n {\n name: \"janitor:extension-test-serially\",\n config: () => {\n return {\n test: {\n fileParallelism: false,\n maxConcurrency: 1,\n isolate: true,\n },\n };\n },\n },\n ];\n}\n","import swc from \"unplugin-swc\";\nimport type { Plugin } from \"vite\";\n\n/**\n * The base plugin for all project types.\n *\n * This will be included with every project. The default build engine for all projects\n * is swc. While esbuild and oxc outperform swc, swc has the closest and most accurate\n * implementation of the latest ECMAScript features which gives us one unified build engine.\n *\n * A vite build should only include one project type and as many extensions as it wants.\n *\n * @returns\n * A list of plugins that all project types will provide.\n */\nexport function project(): Plugin[] {\n return [\n swc.vite({\n jsc: {\n transform: {\n react: {\n runtime: \"automatic\",\n },\n },\n },\n }),\n {\n name: \"janitor:project\",\n config: () => {\n return {\n oxc: false,\n resolve: {\n tsconfigPaths: true,\n },\n build: {\n chunkSizeWarningLimit: 8000,\n minify: true,\n sourcemap: false,\n rolldownOptions: {\n checks: {\n pluginTimings: false,\n },\n },\n },\n test: {\n globals: true,\n testTimeout: 20000,\n maxConcurrency: 10,\n },\n };\n },\n },\n ];\n}\n","import { resolve } from \"node:path\";\n\nimport type { Plugin } from \"vite\";\n\nimport { extensionExternalize } from \"../extensions/extension-externalize.mjs\";\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\nimport { project } from \"./project.mjs\";\n\n/**\n * A plugin that marks a project as a node application.\n *\n * Node applications expect an entry point of main.mts under the\n * src directory.\n *\n * @returns\n * A list of plugins that turn a project into a node base cli\n * project.\n */\nexport function projectNode(): Plugin[] {\n return [\n ...project(),\n ...extensionExternalize(),\n {\n name: \"janitor:project-node\",\n config: (current) => {\n const cwd = resolveCwd(current);\n\n return {\n resolve: {\n conditions: [\"module\", \"node\", \"development|production\"],\n mainFields: [\"module\", \"jsnext:main\", \"jsnext\"],\n },\n build: {\n lib: {\n entry: {\n main: resolve(cwd, \"./src/main.mts\"),\n },\n formats: [\"es\"],\n },\n },\n };\n },\n },\n ];\n}\n","import type { Plugin } from \"vite\";\n\nimport { projectNode } from \"./project-node.mjs\";\n\n/**\n * Currently the same as {@link projectNode}.\n *\n * @returns\n * A list of plugins that turn your project into a cli.\n */\nexport function projectCli(): Plugin[] {\n return [\n ...projectNode(),\n {\n name: \"janitor:project-cli\",\n },\n ];\n}\n","import \"vitest/config\";\n\nimport type { Plugin } from \"vite\";\n\nimport { project } from \"./project.mjs\";\n\n/**\n * A project for the DOM is a frontend application built with\n * basic web components, html, and css.\n *\n * Frontend projects with frameworks will automatically have this plugin.\n *\n * This will set the testing environment to happy-dom.\n *\n * @returns\n * A list of plugins that setup a vite build as a project for\n * a frontend.\n */\nexport function projectDom(): Plugin[] {\n return [\n ...project(),\n {\n name: \"janitor:project-dom\",\n config: () => {\n return {\n test: {\n environment: \"happy-dom\",\n pool: \"vmThreads\",\n environmentOptions: {\n happyDOM: {\n settings: {\n // This is to shut up happy-dom yelling about not being able\n // to download some injected css files.\n handleDisabledFileLoadingAsSuccess: true,\n },\n },\n },\n },\n };\n },\n },\n ];\n}\n","import \"vitest/config\";\n\nimport type { Plugin } from \"vite\";\n\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\nimport { project } from \"./project.mjs\";\n\n/**\n * A special project type for the root vite config or vitest config where\n * the repository is a monorepo of packages that use more than one config entry\n * for each package.\n *\n * This should only be set in a monorepo where the root just specifies which\n * packages the monorepo outputs. It sets up vitest to look for vite.config\n * files under each package.\n *\n * @returns\n * The list of plugins to use for the root monorepo.\n */\nexport function projectMonorepo(): Plugin[] {\n return [\n ...project(),\n {\n name: \"janitor:project-monorepo\",\n config: (current) => {\n const cwd = resolveCwd(current);\n\n return {\n test: {\n projects: [\n `${cwd}/packages/*/{vite,vitest}.config.{js,cjs,mjs,ts,mts}`,\n ],\n },\n };\n },\n },\n ];\n}\n","import type { Plugin } from \"vite\";\n\nimport { projectNode } from \"./project-node.mjs\";\n\n/**\n * Currently the same as {@link projectNode}.\n *\n * @returns\n * A list of plugins that turn your project into an app that\n * runs a NestJS backend.\n */\nexport function projectNestJs(): Plugin[] {\n return [\n ...projectNode(),\n {\n name: \"janitor:project-nestjs\",\n },\n ];\n}\n","import react from \"@vitejs/plugin-react-swc\";\nimport type { Plugin } from \"vite\";\n\nimport { projectDom } from \"./project-dom.mjs\";\n\n/**\n * A project that builds out a react website.\n *\n * A react website is just a dom project that has the\n * react swc plugin enabled.\n *\n * This should normally be coupled with the server extension\n * for full debugging support.\n *\n * @returns\n * A list of plugins that builds a react website.\n */\nexport function projectReact(): Plugin[] {\n return [\n ...projectDom(),\n ...react(),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EAGRC,oCAAoC,KACtC,EACF,EACF;GACF,EACF;EACF;CACF,CACD;AACH;;;;;;;;;;;;;;GCvBA,SAAgBG,kBAAAA;CACd,OAAO,CACFD,GAAAA,QAAAA,GACH;EACEE,MAAM;EACNC,SAASC,YAAAA;GAGP,OAAO,EACLE,MAAM,EACJC,UAAU,CACR,GALMR,WAAWK,OAKdC,EAAI,qDACR,EACH,EACF;EACF;CACF,CACD;AACH;;;;;;;;;GC1BA,SAAgBI,gBAAAA;CACd,OAAO,CACFD,GAAAA,YAAAA,GACH,EACEE,MAAM,yBACR,CACD;AACH;;;;;;;;;;;;;;GCDA,SAAgBG,eAAAA;CACd,OAAO;EACFD,GAAAA,WAAAA;EACAD,IAAAA,GAAAA,yBAAAA,QAAAA,CAAAA;EACH;GACEG,MAAM;GACNC,cAAQ;IACN,OAAO,EACLC,KAAK,MACP;GACF;EACF;CACD;AACH"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './extensions/extension-dev-server.mjs';
|
|
2
2
|
export * from './extensions/extension-externalize.mjs';
|
|
3
3
|
export * from './extensions/extension-library.mjs';
|
|
4
|
+
export * from './extensions/extension-test-serially.mjs';
|
|
4
5
|
export * from './projects/project.mjs';
|
|
5
6
|
export * from './projects/project-cli.mjs';
|
|
6
7
|
export * from './projects/project-dom.mjs';
|
package/dist/index.js
CHANGED
|
@@ -140,6 +140,31 @@ function resolveCwd(current) {
|
|
|
140
140
|
];
|
|
141
141
|
}
|
|
142
142
|
//#endregion
|
|
143
|
+
//#region src/extensions/extension-test-serially.mts
|
|
144
|
+
/**
|
|
145
|
+
* An extension plugin that makes vitest run serially, without parallelism.
|
|
146
|
+
*
|
|
147
|
+
* Normally, you don't want this and your test performance will
|
|
148
|
+
* be negatively impacted; however, if your tests use shared resources
|
|
149
|
+
* and only allow one access point to those resources at a time, use this extension
|
|
150
|
+
* for your library/project to run tests one at a time.
|
|
151
|
+
*
|
|
152
|
+
* @returns
|
|
153
|
+
* A plugin set that makes vitest run all tests serially instead of in
|
|
154
|
+
* parallel.
|
|
155
|
+
*/ function extensionTestSerially() {
|
|
156
|
+
return [{
|
|
157
|
+
name: "janitor:extension-test-serially",
|
|
158
|
+
config: () => {
|
|
159
|
+
return { test: {
|
|
160
|
+
fileParallelism: false,
|
|
161
|
+
maxConcurrency: 1,
|
|
162
|
+
isolate: true
|
|
163
|
+
} };
|
|
164
|
+
}
|
|
165
|
+
}];
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
143
168
|
//#region src/projects/project.mts
|
|
144
169
|
/**
|
|
145
170
|
* The base plugin for all project types.
|
|
@@ -188,7 +213,7 @@ function resolveCwd(current) {
|
|
|
188
213
|
*/ function projectNode() {
|
|
189
214
|
return [
|
|
190
215
|
...project(),
|
|
191
|
-
...extensionExternalize(
|
|
216
|
+
...extensionExternalize(),
|
|
192
217
|
{
|
|
193
218
|
name: "janitor:project-node",
|
|
194
219
|
config: (current) => {
|
|
@@ -308,6 +333,6 @@ function resolveCwd(current) {
|
|
|
308
333
|
];
|
|
309
334
|
}
|
|
310
335
|
//#endregion
|
|
311
|
-
export { extensionDevServer, extensionExternalize, extensionLibrary, project, projectCli, projectDom, projectMonorepo, projectNestJs, projectNode, projectReact };
|
|
336
|
+
export { extensionDevServer, extensionExternalize, extensionLibrary, extensionTestSerially, project, projectCli, projectDom, projectMonorepo, projectNestJs, projectNode, projectReact };
|
|
312
337
|
|
|
313
338
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["extensionDevServer","options","port","host","name","config","server","allowedHosts","strictPort","builtinModules","modules","getAllNodeBuiltins","map","m","RegExp","readFileSync","getAllPackageDependencies","pkg","externals","Set","contents","toString","dependencies","devDependencies","optionalDependencies","peerDependencies","JSON","parse","push","add","bind","Object","keys","concat","map","dep","RegExp","forEach","Array","from","resolveCwd","current","root","process","cwd","resolve","getAllNodeBuiltins","getAllPackageDependencies","resolveCwd","extensionExternalize","options","name","config","current","cwd","fallback","packageJson","externalDeps","Set","forEach","p","add","depMatchers","Array","from","build","rolldownOptions","external","source","some","depMatcher","test","resolve","castArray","dts","resolveCwd","extensionExternalize","extensionLibrary","compilerOptions","paths","include","exclude","name","config","current","cwd","build","lib","minify","sourcemap","entry","index","formats","swc","project","vite","jsc","transform","react","runtime","name","config","oxc","resolve","tsconfigPaths","build","chunkSizeWarningLimit","minify","sourcemap","rolldownOptions","checks","pluginTimings","test","globals","testTimeout","maxConcurrency","resolve","extensionExternalize","resolveCwd","project","projectNode","packageJson","name","config","current","cwd","conditions","mainFields","build","lib","entry","main","formats","projectNode","projectCli","name","project","projectDom","name","config","test","environment","pool","environmentOptions","happyDOM","settings","handleDisabledFileLoadingAsSuccess","resolveCwd","project","projectMonorepo","name","config","current","cwd","test","projects","projectNode","projectNestJs","name","react","projectDom","projectReact","name","config","oxc"],"sources":["../src/extensions/extension-dev-server.mts","../src/helpful/get-all-node-builtins.mts","../src/helpful/get-all-package-dependencies.mts","../src/helpful/resolve-cwd.mts","../src/extensions/extension-externalize.mts","../src/extensions/extension-library.mts","../src/projects/project.mts","../src/projects/project-node.mts","../src/projects/project-cli.mts","../src/projects/project-dom.mts","../src/projects/project-monorepo.mts","../src/projects/project-nestjs.mts","../src/projects/project-react.mts"],"sourcesContent":["import type { Plugin } from \"vite\";\n\n/**\n * Options for the dev server.\n *\n * The expectation for almost every repository in this instance\n * is that it is running the backend and frontend in a docker\n * compose environment, so it assumes it will be running in a docker\n * network. \n *\n * If this isn't true, then these options will be useful.\n */\nexport interface ExtensionDevServerOptions {\n /**\n * The port to run on. \n *\n * @default 5173\n */\n port?: number;\n\n /**\n * The binding host.\n *\n * @default \"0.0.0.0\"\n */\n host?: string;\n}\n\n/**\n * Adds a dev server to your vite build.\n *\n * This is usually paired with a dom based project and\n * is only used for debugging. AllowedHosts in this plugin\n * is set to true to allow for local manipulation of the\n * OS host file to simulate true domains.\n *\n * @returns\n * A list of plugins that add the dev server option.\n */\nexport function extensionDevServer(\n options: ExtensionDevServerOptions = {},\n): Plugin[] {\n const { port = 5173, host = \"0.0.0.0\" } = options;\n\n return [\n {\n name: \"janitor:extension-dev-server\",\n config: () => {\n return {\n server: {\n allowedHosts: true,\n strictPort: true,\n host,\n port,\n },\n };\n },\n },\n ];\n}\n","import { builtinModules as modules } from \"node:module\";\n\nexport function getAllNodeBuiltins(): RegExp[] {\n return modules.map((m) => new RegExp(`^(?:node:)?${m}$`));\n}\n","import { type PathLike, readFileSync } from \"node:fs\";\n\nexport function getAllPackageDependencies(pkg: PathLike): RegExp[] {\n try {\n const externals = new Set<RegExp>();\n\n const contents = readFileSync(pkg).toString();\n const {\n dependencies = [],\n devDependencies = [],\n optionalDependencies = [],\n peerDependencies = [],\n } = JSON.parse(contents) as Record<string, Record<string, string>>;\n\n const push = externals.add.bind(externals);\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 return Array.from(externals);\n } catch {\n return [];\n }\n}\n","import type { UserConfig } from \"vite\";\n\nexport function resolveCwd(current?: UserConfig): string {\n return current?.root || process.cwd();\n}\n","import type { PathLike } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport type { Plugin, UserConfig } from \"vite\";\n\nimport { getAllNodeBuiltins } from \"../helpful/get-all-node-builtins.mjs\";\nimport { getAllPackageDependencies } from \"../helpful/get-all-package-dependencies.mjs\";\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\n\n/**\n * Options for externalizing dependencies.\n */\nexport interface ExternalizeOptions {\n /**\n * The path to the package json file that contains dependencies\n * to externalize or false to only externalize node builtins.\n *\n * If this is undefined, then the package.json in the current\n * working directory will be used.\n */\n packageJson?: PathLike | false;\n}\n\n/**\n * An externalize extension tells a project to not bundle the dependencies together. \n *\n * This is mostly used for libraries and if you use extensionLibrary(), or projectNode()\n * you do not need to include this extension as it will be included for you already.\n *\n * @param options -\n * Optional options for how to externalize dependency values.\n *\n * @returns\n * A list of plugins that will stop vite from bundling packages\n * from the node_modules directory and node builtins.\n */\nexport const extensionExternalize = (\n options: ExternalizeOptions = {},\n): Plugin[] => {\n return [\n {\n name: \"janitor:extension-externalize\",\n config: (current) => {\n const cwd = resolveCwd(current);\n const fallback = resolve(cwd, \"package.json\");\n const { packageJson = fallback } = options;\n const externalDeps = new Set<RegExp>(getAllNodeBuiltins());\n\n if (packageJson !== false) {\n getAllPackageDependencies(packageJson).forEach((p) =>\n externalDeps.add(p),\n );\n }\n\n const depMatchers = Array.from(externalDeps);\n\n return {\n build: {\n rolldownOptions: {\n external: (source) => {\n return depMatchers.some((depMatcher) =>\n depMatcher.test(source),\n );\n },\n },\n },\n } satisfies UserConfig;\n },\n },\n ];\n};\n","import { resolve } from \"node:path\";\n\nimport { castArray } from \"lodash-es\";\nimport dts from \"unplugin-dts/vite\";\nimport type { Plugin } from \"vite\";\n\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\nimport { extensionExternalize } from \"./extension-externalize.mjs\";\n\n/**\n * Turns any project into a shared library.\n *\n * A library does not actually run any code, it simply contains shared\n * code that makes up other projects.\n *\n * A library is expected to have an index.mts file under the src directory\n * that is a long list of exports that the library will provide to consumers.\n * Only one barrel export should be used for a library. It's better to have\n * multiple libraries than to complicate a library with subpaths in the\n * exports of package.json. This keeps the expectations that when you npm\n * library \"foo\", you can do import { something } from 'foo' and not need to\n * have the brain overload of hunting down available paths from within.\n *\n * When you classify something as a library, source maps are turned on,\n * and none of your code for it will be minified. This is to help with\n * debugging library code outside of the library development environment.\n * Module libraries in the janitor system are not expected to be deployed\n * to a system by themselves. They are bundled with the overarching parent\n * application.\n *\n * Note that if you combine this with something like node or nest, which\n * expects a main.mts file as the entry point, that entry point goes away\n * and the index.mts file will take over.\n *\n * @returns\n * The list of plugins that turn any project into a library.\n */\nexport function extensionLibrary(): Plugin[] {\n return [\n ...extensionExternalize(),\n ...castArray(\n dts({\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 // We only want to include output source files, not any config files outside\n // of our source code directory.\n include: [\"src/**/*.{js,mjs,cjs,ts,mts,jsx,tsx}\"],\n // Make sure to exclude spec and test files as well, these don't need to\n // be included (and shouldn't be).\n exclude: [\"**/*.{spec,test}.{js,mjs,cjs,ts,mts,jsx,tsx}\"],\n }),\n ),\n {\n name: \"janitor:extension-library\",\n config: (current) => {\n const cwd = resolveCwd(current);\n\n // The library extension fully controls the lib, so if we have additional\n // formats or entry points, those have to go away.\n delete current?.build?.lib;\n\n return {\n build: {\n minify: false,\n sourcemap: true,\n lib: {\n entry: {\n index: resolve(cwd, \"./src/index.mts\"),\n },\n formats: [\"cjs\", \"es\"],\n },\n },\n };\n },\n },\n ];\n}\n","import swc from \"unplugin-swc\";\nimport type { Plugin } from \"vite\";\n\n/**\n * The base plugin for all project types.\n *\n * This will be included with every project. The default build engine for all projects\n * is swc. While esbuild and oxc outperform swc, swc has the closest and most accurate\n * implementation of the latest ECMAScript features which gives us one unified build engine.\n *\n * A vite build should only include one project type and as many extensions as it wants.\n *\n * @returns\n * A list of plugins that all project types will provide.\n */\nexport function project(): Plugin[] {\n return [\n swc.vite({\n jsc: {\n transform: {\n react: {\n runtime: \"automatic\",\n },\n },\n },\n }),\n {\n name: \"janitor:project\",\n config: () => {\n return {\n oxc: false,\n resolve: {\n tsconfigPaths: true,\n },\n build: {\n chunkSizeWarningLimit: 8000,\n minify: true,\n sourcemap: false,\n rolldownOptions: {\n checks: {\n pluginTimings: false,\n },\n },\n },\n test: {\n globals: true,\n testTimeout: 20000,\n maxConcurrency: 10,\n },\n };\n },\n },\n ];\n}\n","import { resolve } from \"node:path\";\n\nimport type { Plugin } from \"vite\";\n\nimport { extensionExternalize } from \"../extensions/extension-externalize.mjs\";\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\nimport { project } from \"./project.mjs\";\n\n/**\n * A plugin that marks a project as a node application.\n *\n * Node applications expect an entry point of main.mts under the\n * src directory.\n *\n * @returns\n * A list of plugins that turn a project into a node base cli\n * project.\n */\nexport function projectNode(): Plugin[] {\n return [\n ...project(),\n ...extensionExternalize({ packageJson: false }),\n {\n name: \"janitor:project-node\",\n config: (current) => {\n const cwd = resolveCwd(current);\n\n return {\n resolve: {\n conditions: [\"module\", \"node\", \"development|production\"],\n mainFields: [\"module\", \"jsnext:main\", \"jsnext\"],\n },\n build: {\n lib: {\n entry: {\n main: resolve(cwd, \"./src/main.mts\"),\n },\n formats: [\"es\"],\n },\n },\n };\n },\n },\n ];\n}\n","import type { Plugin } from \"vite\";\n\nimport { projectNode } from \"./project-node.mjs\";\n\n/**\n * Currently the same as {@link projectNode}.\n *\n * @returns\n * A list of plugins that turn your project into a cli.\n */\nexport function projectCli(): Plugin[] {\n return [\n ...projectNode(),\n {\n name: \"janitor:project-cli\",\n },\n ];\n}\n","import \"vitest/config\";\n\nimport type { Plugin } from \"vite\";\n\nimport { project } from \"./project.mjs\";\n\n/**\n * A project for the DOM is a frontend application built with\n * basic web components, html, and css.\n *\n * Frontend projects with frameworks will automatically have this plugin.\n *\n * This will set the testing environment to happy-dom.\n *\n * @returns\n * A list of plugins that setup a vite build as a project for\n * a frontend.\n */\nexport function projectDom(): Plugin[] {\n return [\n ...project(),\n {\n name: \"janitor:project-dom\",\n config: () => {\n return {\n test: {\n environment: \"happy-dom\",\n pool: \"vmThreads\",\n environmentOptions: {\n happyDOM: {\n settings: {\n // This is to shut up happy-dom yelling about not being able\n // to download some injected css files.\n handleDisabledFileLoadingAsSuccess: true,\n },\n },\n },\n },\n };\n },\n },\n ];\n}\n","import \"vitest/config\";\n\nimport type { Plugin } from \"vite\";\n\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\nimport { project } from \"./project.mjs\";\n\n/**\n * A special project type for the root vite config or vitest config where\n * the repository is a monorepo of packages that use more than one config entry\n * for each package.\n *\n * This should only be set in a monorepo where the root just specifies which\n * packages the monorepo outputs. It sets up vitest to look for vite.config\n * files under each package.\n *\n * @returns\n * The list of plugins to use for the root monorepo.\n */\nexport function projectMonorepo(): Plugin[] {\n return [\n ...project(),\n {\n name: \"janitor:project-monorepo\",\n config: (current) => {\n const cwd = resolveCwd(current);\n\n return {\n test: {\n projects: [\n `${cwd}/packages/*/{vite,vitest}.config.{js,cjs,mjs,ts,mts}`,\n ],\n },\n };\n },\n },\n ];\n}\n","import type { Plugin } from \"vite\";\n\nimport { projectNode } from \"./project-node.mjs\";\n\n/**\n * Currently the same as {@link projectNode}.\n *\n * @returns\n * A list of plugins that turn your project into an app that\n * runs a NestJS backend.\n */\nexport function projectNestJs(): Plugin[] {\n return [\n ...projectNode(),\n {\n name: \"janitor:project-nestjs\",\n },\n ];\n}\n","import react from \"@vitejs/plugin-react-swc\";\nimport type { Plugin } from \"vite\";\n\nimport { projectDom } from \"./project-dom.mjs\";\n\n/**\n * A project that builds out a react website.\n *\n * A react website is just a dom project that has the\n * react swc plugin enabled.\n *\n * This should normally be coupled with the server extension\n * for full debugging support.\n *\n * @returns\n * A list of plugins that builds a react website.\n */\nexport function projectReact(): Plugin[] {\n return [\n ...projectDom(),\n ...react(),\n {\n name: \"janitor:project-react\",\n config: () => {\n return {\n oxc: false,\n };\n },\n },\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;GAuCA,SAAgBA,mBACdC,UAAqC,CAAC,GAAC;CAEvC,MAAM,EAAEC,OAAO,MAAMC,OAAO,cAAcF;CAE1C,OAAO,CACL;EACEG,MAAM;EACNC,cAAQ;GACN,OAAO,EACLC,QAAQ;IACNC,cAAc;IACdC,YAAY;IACZL;IACAD;GACF,EACF;EACF;CACF,CACD;AACH;;;ACzDA,SAAgBS,qBAAAA;CACd,OAAOD,eAAQE,KAAKC,MAAM,IAAIC,OAAO,cAAcD,EAAE,EAAE,CAAA;AACzD;;;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AAC;OAAU;OAAQ;MAAyB;MACxDC,YAAY;OAAC;OAAU;OAAe;MAAS;KACjD;KACAC,OAAO,EACLC,KAAK;MACHC,OAAO,EACLC,MAAMf,QAAQS,KAAK,gBAAA,EACrB;MACAO,SAAS,CAAC,IAAK;KACjB,EACF;IACF;GACF;EACF;CACD;AACH;;;;;;;;GClCA,SAAgBE,aAAAA;CACd,OAAO,CACFD,GAAAA,YAAAA,GACH,EACEE,MAAM,sBACR,CACD;AACH;;;;;;;;;;;;;;GCCA,SAAgBE,aAAAA;CACd,OAAO,CACFD,GAAAA,QAAAA,GACH;EACEE,MAAM;EACNC,cAAQ;GACN,OAAO,EACLC,MAAM;IACJC,aAAa;IACbC,MAAM;IACNC,oBAAoB,EAClBC,UAAU,EACRC,UAAU,EAGRC,oCAAoC,KACtC,EACF,EACF;GACF,EACF;EACF;CACF,CACD;AACH;;;;;;;;;;;;;;GCvBA,SAAgBG,kBAAAA;CACd,OAAO,CACFD,GAAAA,QAAAA,GACH;EACEE,MAAM;EACNC,SAASC,YAAAA;GAGP,OAAO,EACLE,MAAM,EACJC,UAAU,CACR,GALMR,WAAWK,OAKdC,EAAI,qDACR,EACH,EACF;EACF;CACF,CACD;AACH;;;;;;;;;GC1BA,SAAgBI,gBAAAA;CACd,OAAO,CACFD,GAAAA,YAAAA,GACH,EACEE,MAAM,yBACR,CACD;AACH;;;;;;;;;;;;;;GCDA,SAAgBG,eAAAA;CACd,OAAO;EACFD,GAAAA,WAAAA;EACAD,GAAAA,MAAAA;EACH;GACEG,MAAM;GACNC,cAAQ;IACN,OAAO,EACLC,KAAK,MACP;GACF;EACF;CACD;AACH"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["extensionDevServer","options","port","host","name","config","server","allowedHosts","strictPort","builtinModules","modules","getAllNodeBuiltins","map","m","RegExp","readFileSync","getAllPackageDependencies","pkg","externals","Set","contents","toString","dependencies","devDependencies","optionalDependencies","peerDependencies","JSON","parse","push","add","bind","Object","keys","concat","map","dep","RegExp","forEach","Array","from","resolveCwd","current","root","process","cwd","resolve","getAllNodeBuiltins","getAllPackageDependencies","resolveCwd","extensionExternalize","options","name","config","current","cwd","fallback","packageJson","externalDeps","Set","forEach","p","add","depMatchers","Array","from","build","rolldownOptions","external","source","some","depMatcher","test","resolve","castArray","dts","resolveCwd","extensionExternalize","extensionLibrary","compilerOptions","paths","include","exclude","name","config","current","cwd","build","lib","minify","sourcemap","entry","index","formats","extensionTestSerially","name","config","test","fileParallelism","maxConcurrency","isolate","swc","project","vite","jsc","transform","react","runtime","name","config","oxc","resolve","tsconfigPaths","build","chunkSizeWarningLimit","minify","sourcemap","rolldownOptions","checks","pluginTimings","test","globals","testTimeout","maxConcurrency","resolve","extensionExternalize","resolveCwd","project","projectNode","name","config","current","cwd","conditions","mainFields","build","lib","entry","main","formats","projectNode","projectCli","name","project","projectDom","name","config","test","environment","pool","environmentOptions","happyDOM","settings","handleDisabledFileLoadingAsSuccess","resolveCwd","project","projectMonorepo","name","config","current","cwd","test","projects","projectNode","projectNestJs","name","react","projectDom","projectReact","name","config","oxc"],"sources":["../src/extensions/extension-dev-server.mts","../src/helpful/get-all-node-builtins.mts","../src/helpful/get-all-package-dependencies.mts","../src/helpful/resolve-cwd.mts","../src/extensions/extension-externalize.mts","../src/extensions/extension-library.mts","../src/extensions/extension-test-serially.mts","../src/projects/project.mts","../src/projects/project-node.mts","../src/projects/project-cli.mts","../src/projects/project-dom.mts","../src/projects/project-monorepo.mts","../src/projects/project-nestjs.mts","../src/projects/project-react.mts"],"sourcesContent":["import type { Plugin } from \"vite\";\n\n/**\n * Options for the dev server.\n *\n * The expectation for almost every repository in this instance\n * is that it is running the backend and frontend in a docker\n * compose environment, so it assumes it will be running in a docker\n * network. \n *\n * If this isn't true, then these options will be useful.\n */\nexport interface ExtensionDevServerOptions {\n /**\n * The port to run on. \n *\n * @default 5173\n */\n port?: number;\n\n /**\n * The binding host.\n *\n * @default \"0.0.0.0\"\n */\n host?: string;\n}\n\n/**\n * Adds a dev server to your vite build.\n *\n * This is usually paired with a dom based project and\n * is only used for debugging. AllowedHosts in this plugin\n * is set to true to allow for local manipulation of the\n * OS host file to simulate true domains.\n *\n * @returns\n * A list of plugins that add the dev server option.\n */\nexport function extensionDevServer(\n options: ExtensionDevServerOptions = {},\n): Plugin[] {\n const { port = 5173, host = \"0.0.0.0\" } = options;\n\n return [\n {\n name: \"janitor:extension-dev-server\",\n config: () => {\n return {\n server: {\n allowedHosts: true,\n strictPort: true,\n host,\n port,\n },\n };\n },\n },\n ];\n}\n","import { builtinModules as modules } from \"node:module\";\n\nexport function getAllNodeBuiltins(): RegExp[] {\n return modules.map((m) => new RegExp(`^(?:node:)?${m}$`));\n}\n","import { type PathLike, readFileSync } from \"node:fs\";\n\nexport function getAllPackageDependencies(pkg: PathLike): RegExp[] {\n try {\n const externals = new Set<RegExp>();\n\n const contents = readFileSync(pkg).toString();\n const {\n dependencies = [],\n devDependencies = [],\n optionalDependencies = [],\n peerDependencies = [],\n } = JSON.parse(contents) as Record<string, Record<string, string>>;\n\n const push = externals.add.bind(externals);\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 return Array.from(externals);\n } catch {\n return [];\n }\n}\n","import type { UserConfig } from \"vite\";\n\nexport function resolveCwd(current?: UserConfig): string {\n return current?.root || process.cwd();\n}\n","import type { PathLike } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport type { Plugin, UserConfig } from \"vite\";\n\nimport { getAllNodeBuiltins } from \"../helpful/get-all-node-builtins.mjs\";\nimport { getAllPackageDependencies } from \"../helpful/get-all-package-dependencies.mjs\";\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\n\n/**\n * Options for externalizing dependencies.\n */\nexport interface ExternalizeOptions {\n /**\n * The path to the package json file that contains dependencies\n * to externalize or false to only externalize node builtins.\n *\n * If this is undefined, then the package.json in the current\n * working directory will be used.\n */\n packageJson?: PathLike | false;\n}\n\n/**\n * An externalize extension tells a project to not bundle the dependencies together. \n *\n * This is mostly used for libraries and if you use extensionLibrary(), or projectNode()\n * you do not need to include this extension as it will be included for you already.\n *\n * @param options -\n * Optional options for how to externalize dependency values.\n *\n * @returns\n * A list of plugins that will stop vite from bundling packages\n * from the node_modules directory and node builtins.\n */\nexport const extensionExternalize = (\n options: ExternalizeOptions = {},\n): Plugin[] => {\n return [\n {\n name: \"janitor:extension-externalize\",\n config: (current) => {\n const cwd = resolveCwd(current);\n const fallback = resolve(cwd, \"package.json\");\n const { packageJson = fallback } = options;\n const externalDeps = new Set<RegExp>(getAllNodeBuiltins());\n\n if (packageJson !== false) {\n getAllPackageDependencies(packageJson).forEach((p) =>\n externalDeps.add(p),\n );\n }\n\n const depMatchers = Array.from(externalDeps);\n\n return {\n build: {\n rolldownOptions: {\n external: (source) => {\n return depMatchers.some((depMatcher) =>\n depMatcher.test(source),\n );\n },\n },\n },\n } satisfies UserConfig;\n },\n },\n ];\n};\n","import { resolve } from \"node:path\";\n\nimport { castArray } from \"lodash-es\";\nimport dts from \"unplugin-dts/vite\";\nimport type { Plugin } from \"vite\";\n\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\nimport { extensionExternalize } from \"./extension-externalize.mjs\";\n\n/**\n * Turns any project into a shared library.\n *\n * A library does not actually run any code, it simply contains shared\n * code that makes up other projects.\n *\n * A library is expected to have an index.mts file under the src directory\n * that is a long list of exports that the library will provide to consumers.\n * Only one barrel export should be used for a library. It's better to have\n * multiple libraries than to complicate a library with subpaths in the\n * exports of package.json. This keeps the expectations that when you npm\n * library \"foo\", you can do import { something } from 'foo' and not need to\n * have the brain overload of hunting down available paths from within.\n *\n * When you classify something as a library, source maps are turned on,\n * and none of your code for it will be minified. This is to help with\n * debugging library code outside of the library development environment.\n * Module libraries in the janitor system are not expected to be deployed\n * to a system by themselves. They are bundled with the overarching parent\n * application.\n *\n * Note that if you combine this with something like node or nest, which\n * expects a main.mts file as the entry point, that entry point goes away\n * and the index.mts file will take over.\n *\n * @returns\n * The list of plugins that turn any project into a library.\n */\nexport function extensionLibrary(): Plugin[] {\n return [\n ...extensionExternalize(),\n ...castArray(\n dts({\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 // We only want to include output source files, not any config files outside\n // of our source code directory.\n include: [\"src/**/*.{js,mjs,cjs,ts,mts,jsx,tsx}\"],\n // Make sure to exclude spec and test files as well, these don't need to\n // be included (and shouldn't be).\n exclude: [\"**/*.{spec,test}.{js,mjs,cjs,ts,mts,jsx,tsx}\"],\n }),\n ),\n {\n name: \"janitor:extension-library\",\n config: (current) => {\n const cwd = resolveCwd(current);\n\n // The library extension fully controls the lib, so if we have additional\n // formats or entry points, those have to go away.\n delete current?.build?.lib;\n\n return {\n build: {\n minify: false,\n sourcemap: true,\n lib: {\n entry: {\n index: resolve(cwd, \"./src/index.mts\"),\n },\n formats: [\"cjs\", \"es\"],\n },\n },\n };\n },\n },\n ];\n}\n","import type { Plugin } from \"vite\";\n\n/**\n * An extension plugin that makes vitest run serially, without parallelism.\n *\n * Normally, you don't want this and your test performance will\n * be negatively impacted; however, if your tests use shared resources\n * and only allow one access point to those resources at a time, use this extension\n * for your library/project to run tests one at a time.\n *\n * @returns\n * A plugin set that makes vitest run all tests serially instead of in\n * parallel.\n */\nexport function extensionTestSerially(): Plugin[] {\n return [\n {\n name: \"janitor:extension-test-serially\",\n config: () => {\n return {\n test: {\n fileParallelism: false,\n maxConcurrency: 1,\n isolate: true,\n },\n };\n },\n },\n ];\n}\n","import swc from \"unplugin-swc\";\nimport type { Plugin } from \"vite\";\n\n/**\n * The base plugin for all project types.\n *\n * This will be included with every project. The default build engine for all projects\n * is swc. While esbuild and oxc outperform swc, swc has the closest and most accurate\n * implementation of the latest ECMAScript features which gives us one unified build engine.\n *\n * A vite build should only include one project type and as many extensions as it wants.\n *\n * @returns\n * A list of plugins that all project types will provide.\n */\nexport function project(): Plugin[] {\n return [\n swc.vite({\n jsc: {\n transform: {\n react: {\n runtime: \"automatic\",\n },\n },\n },\n }),\n {\n name: \"janitor:project\",\n config: () => {\n return {\n oxc: false,\n resolve: {\n tsconfigPaths: true,\n },\n build: {\n chunkSizeWarningLimit: 8000,\n minify: true,\n sourcemap: false,\n rolldownOptions: {\n checks: {\n pluginTimings: false,\n },\n },\n },\n test: {\n globals: true,\n testTimeout: 20000,\n maxConcurrency: 10,\n },\n };\n },\n },\n ];\n}\n","import { resolve } from \"node:path\";\n\nimport type { Plugin } from \"vite\";\n\nimport { extensionExternalize } from \"../extensions/extension-externalize.mjs\";\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\nimport { project } from \"./project.mjs\";\n\n/**\n * A plugin that marks a project as a node application.\n *\n * Node applications expect an entry point of main.mts under the\n * src directory.\n *\n * @returns\n * A list of plugins that turn a project into a node base cli\n * project.\n */\nexport function projectNode(): Plugin[] {\n return [\n ...project(),\n ...extensionExternalize(),\n {\n name: \"janitor:project-node\",\n config: (current) => {\n const cwd = resolveCwd(current);\n\n return {\n resolve: {\n conditions: [\"module\", \"node\", \"development|production\"],\n mainFields: [\"module\", \"jsnext:main\", \"jsnext\"],\n },\n build: {\n lib: {\n entry: {\n main: resolve(cwd, \"./src/main.mts\"),\n },\n formats: [\"es\"],\n },\n },\n };\n },\n },\n ];\n}\n","import type { Plugin } from \"vite\";\n\nimport { projectNode } from \"./project-node.mjs\";\n\n/**\n * Currently the same as {@link projectNode}.\n *\n * @returns\n * A list of plugins that turn your project into a cli.\n */\nexport function projectCli(): Plugin[] {\n return [\n ...projectNode(),\n {\n name: \"janitor:project-cli\",\n },\n ];\n}\n","import \"vitest/config\";\n\nimport type { Plugin } from \"vite\";\n\nimport { project } from \"./project.mjs\";\n\n/**\n * A project for the DOM is a frontend application built with\n * basic web components, html, and css.\n *\n * Frontend projects with frameworks will automatically have this plugin.\n *\n * This will set the testing environment to happy-dom.\n *\n * @returns\n * A list of plugins that setup a vite build as a project for\n * a frontend.\n */\nexport function projectDom(): Plugin[] {\n return [\n ...project(),\n {\n name: \"janitor:project-dom\",\n config: () => {\n return {\n test: {\n environment: \"happy-dom\",\n pool: \"vmThreads\",\n environmentOptions: {\n happyDOM: {\n settings: {\n // This is to shut up happy-dom yelling about not being able\n // to download some injected css files.\n handleDisabledFileLoadingAsSuccess: true,\n },\n },\n },\n },\n };\n },\n },\n ];\n}\n","import \"vitest/config\";\n\nimport type { Plugin } from \"vite\";\n\nimport { resolveCwd } from \"../helpful/resolve-cwd.mjs\";\nimport { project } from \"./project.mjs\";\n\n/**\n * A special project type for the root vite config or vitest config where\n * the repository is a monorepo of packages that use more than one config entry\n * for each package.\n *\n * This should only be set in a monorepo where the root just specifies which\n * packages the monorepo outputs. It sets up vitest to look for vite.config\n * files under each package.\n *\n * @returns\n * The list of plugins to use for the root monorepo.\n */\nexport function projectMonorepo(): Plugin[] {\n return [\n ...project(),\n {\n name: \"janitor:project-monorepo\",\n config: (current) => {\n const cwd = resolveCwd(current);\n\n return {\n test: {\n projects: [\n `${cwd}/packages/*/{vite,vitest}.config.{js,cjs,mjs,ts,mts}`,\n ],\n },\n };\n },\n },\n ];\n}\n","import type { Plugin } from \"vite\";\n\nimport { projectNode } from \"./project-node.mjs\";\n\n/**\n * Currently the same as {@link projectNode}.\n *\n * @returns\n * A list of plugins that turn your project into an app that\n * runs a NestJS backend.\n */\nexport function projectNestJs(): Plugin[] {\n return [\n ...projectNode(),\n {\n name: \"janitor:project-nestjs\",\n },\n ];\n}\n","import react from \"@vitejs/plugin-react-swc\";\nimport type { Plugin } from \"vite\";\n\nimport { projectDom } from \"./project-dom.mjs\";\n\n/**\n * A project that builds out a react website.\n *\n * A react website is just a dom project that has the\n * react swc plugin enabled.\n *\n * This should normally be coupled with the server extension\n * for full debugging support.\n *\n * @returns\n * A list of plugins that builds a react website.\n */\nexport function projectReact(): Plugin[] {\n return [\n ...projectDom(),\n ...react(),\n {\n name: \"janitor:project-react\",\n config: () => {\n return {\n oxc: false,\n };\n },\n },\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;GAuCA,SAAgBA,mBACdC,UAAqC,CAAC,GAAC;CAEvC,MAAM,EAAEC,OAAO,MAAMC,OAAO,cAAcF;CAE1C,OAAO,CACL;EACEG,MAAM;EACNC,cAAQ;GACN,OAAO,EACLC,QAAQ;IACNC,cAAc;IACdC,YAAY;IACZL;IACAD;GACF,EACF;EACF;CACF,CACD;AACH;;;ACzDA,SAAgBS,qBAAAA;CACd,OAAOD,eAAQE,KAAKC,MAAM,IAAIC,OAAO,cAAcD,EAAE,EAAE,CAAA;AACzD;;;ACFA,SAAgBG,0BAA0BC,KAAa;CACrD,IAAI;EACF,MAAMC,4BAAY,IAAIC,IAAAA;EAEtB,MAAMC,WAAWL,aAAaE,GAAAA,CAAAA,CAAKI,SAAQ;EAC3C,MAAM,EACJC,eAAe,CAAA,GACfC,kBAAkB,CAAA,GAClBC,uBAAuB,CAAA,GACvBC,mBAAmB,CAAA,MACjBC,KAAKC,MAAMP,QAAAA;EAEf,MAAMQ,OAAOV,UAAUW,IAAIC,KAAKZ,SAAAA;EAEhCa,OAAOC,KAAKV,YAAAA,CAAAA,CACTW,OAAOF,OAAOC,KAAKT,eAAAA,CAAAA,CAAAA,CACnBU,OAAOF,OAAOC,KAAKR,oBAAAA,CAAAA,CAAAA,CACnBS,OAAOF,OAAOC,KAAKP,gBAAAA,CAAAA,CAAAA,CACnBS,KAAKC,QAAQ,IAAIC,OAAO,IAAID,IAAI,UAAU,CAAA,CAAA,CAC1CE,QAAQT,IAAAA;EAEX,OAAOU,MAAMC,KAAKrB,SAAAA;CACpB,QAAQ;EACN,OAAO,CAAA;CACT;AACF;;;ACzBA,SAAgBsB,WAAWC,SAAoB;CAC7C,OAAOA,SAASC,QAAQC,QAAQC,IAAG;AACrC;;;;;;;;;;;;;;;GCgCA,IAAaK,wBACXC,UAA8B,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,YAAAA;GAGP,OAAO,EACLE,MAAM,EACJC,UAAU,CACR,GALMR,WAAWK,OAKdC,EAAI,qDACR,EACH,EACF;EACF;CACF,CACD;AACH;;;;;;;;;GC1BA,SAAgBI,gBAAAA;CACd,OAAO,CACFD,GAAAA,YAAAA,GACH,EACEE,MAAM,yBACR,CACD;AACH;;;;;;;;;;;;;;GCDA,SAAgBG,eAAAA;CACd,OAAO;EACFD,GAAAA,WAAAA;EACAD,GAAAA,MAAAA;EACH;GACEG,MAAM;GACNC,cAAQ;IACN,OAAO,EACLC,KAAK,MACP;GACF;EACF;CACD;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zthun/janitor-vite",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.2.0",
|
|
4
4
|
"description": "A shared set of plugins for vite that use conventions over configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.mts",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"author": "Anthony Bonta",
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "9d7ceb3a680abb22ee6d4e53ab64861ceb0c4043"
|
|
57
57
|
}
|