@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/vite.ts +15 -11
package/package.json CHANGED
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "main": "index.ts",
34
34
  "license": "Apache-2.0",
35
- "version": "0.4.0",
35
+ "version": "0.4.1",
36
36
  "types": "index.ts",
37
37
  "type": "module",
38
38
  "exports": {
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 (default {@link DEFAULT_VITE_OVERRIDES}: `vite.config.override.js`) and, when present, merges that module's default export
8
- * over the generated config with Vite's `mergeConfig` - in listed order, so later
9
- * files win and absent ones are skipped. A package thus tweaks Vite WITHOUT editing
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
- * The override modules are `.js` because Vite loads them via a plain dynamic
13
- * `import()` at config time. Being a package-ROOT file (not under `src/`), the
14
- * generated `vite.config.ts` is excluded from the package's `tsconfig` `include`, so
15
- * its `node:*` usage never trips the `ui` package's `compile` under the DOM-only
16
- * tsconfig; Vite transpiles it with esbuild and runs it in Node at config time.
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): a package's `vite.config.override.js`.
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 {