@dbx-tools/projen 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/vite.ts +15 -11
package/package.json
CHANGED
package/src/vite.ts
CHANGED
|
@@ -4,24 +4,28 @@
|
|
|
4
4
|
* {@link ViteConfigFile} extends projen's `TextFile` and emits a generated,
|
|
5
5
|
* read-only Vite config: the React plugin plus a runtime OVERRIDE chain. At Vite
|
|
6
6
|
* startup the generated config looks for each unmanaged override module sitting
|
|
7
|
-
* beside it (
|
|
8
|
-
* over the generated config with Vite's `mergeConfig` - in
|
|
9
|
-
* files win and absent ones are skipped. A package thus
|
|
10
|
-
* the projen-owned file.
|
|
7
|
+
* beside it (see {@link DEFAULT_VITE_OVERRIDES}) and, when present, merges that
|
|
8
|
+
* module's default export over the generated config with Vite's `mergeConfig` - in
|
|
9
|
+
* listed order, so later files win and absent ones are skipped. A package thus
|
|
10
|
+
* tweaks Vite WITHOUT editing the projen-owned file.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* `import()`
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* An override may be written in TypeScript or JavaScript. The generated config
|
|
13
|
+
* reaches it through a dynamic `import()` of a runtime-computed URL, which Vite's
|
|
14
|
+
* config bundling cannot inline and so leaves for Node to execute - and Node
|
|
15
|
+
* strips types from a `.ts` file outside `node_modules` on its own. Being a
|
|
16
|
+
* package-ROOT file (not under `src/`), neither the generated `vite.config.ts`
|
|
17
|
+
* nor the override is in the package's `tsconfig` `include`, so their `node:*`
|
|
18
|
+
* usage never trips the `ui` package's `compile` under the DOM-only tsconfig.
|
|
17
19
|
*/
|
|
18
20
|
import { type Project, TextFile } from "projen";
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* Default unmanaged override modules, merged over the generated config in order
|
|
22
|
-
* (later wins, absent files skipped)
|
|
24
|
+
* (later wins, absent files skipped). Both extensions are accepted so an existing
|
|
25
|
+
* JavaScript override keeps working; the TypeScript one is listed last so it wins
|
|
26
|
+
* where a package is mid-migration and still has both.
|
|
23
27
|
*/
|
|
24
|
-
const DEFAULT_VITE_OVERRIDES = ["vite.config.override.js"];
|
|
28
|
+
const DEFAULT_VITE_OVERRIDES = ["vite.config.override.js", "vite.config.override.ts"];
|
|
25
29
|
|
|
26
30
|
/** Render the generated `vite.config.ts` source with the override chain inlined. */
|
|
27
31
|
function renderViteConfig(overridePaths: string[]): string {
|