webanvil 0.0.15 → 0.0.17

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/README.md CHANGED
@@ -350,7 +350,7 @@ invalid package identity, or is outside the supported range fails first.
350
350
  | Rolldown | `>=1.2.0 <2` | `1.2.0` |
351
351
  | Oxlint | `>=1.75.0 <2` | `1.75.0` |
352
352
  | Oxfmt | `>=0.60.0 <0.61` | `0.60.0` |
353
- | TypeScript (declarations) | `>=5 <7` | `6.0.3` |
353
+ | TypeScript (declarations) | `>=5 <7.1.0` | `6.0.3` |
354
354
  | TypeScript Native (`tsgo`) | `>=7.0.0-dev.20260707.2 <7.0.0` | `7.0.0-dev.20260707.2` |
355
355
 
356
356
  When a tool is first used, the CLI reports its package, version, and source, for
@@ -423,9 +423,11 @@ names and source maps.
423
423
 
424
424
  ### Node declarations
425
425
 
426
- `build.declaration: true` uses `rolldown-plugin-dts` with its TypeScript
427
- generator. Pass a native declaration options object to select the `"oxc"` or
428
- `"tsgo"` generator and other plugin settings:
426
+ `build.declaration: true` uses `rolldown-plugin-dts`. TypeScript 5 and 6 use
427
+ the full `tsc` generator. TypeScript 7 uses `tsgo` when the project has a
428
+ `tsconfig.json`; otherwise it uses Oxc's isolated declaration generator. Pass a
429
+ native declaration options object to choose a generator and other plugin
430
+ settings explicitly:
429
431
 
430
432
  ```ts
431
433
  import { defineConfig } from "webanvil"
@@ -440,11 +442,12 @@ export default defineConfig({
440
442
  })
441
443
  ```
442
444
 
443
- The TypeScript generator selects a compatible project/workspace TypeScript
445
+ The `tsc` generator selects a compatible project/workspace TypeScript
444
446
  declaration when present, otherwise WebAnvil's exact TypeScript fallback.
445
447
  Project-local `ts-patch` and TypeScript emit transforms are honored when they
446
- are directly declared and resolve to that same compiler. Emit transforms
447
- require the `tsc` generator; Oxc and `tsgo` are explicit alternatives.
448
+ are directly declared and resolve to that same compiler. They require `tsc`,
449
+ which supports TypeScript 5 and 6; use `tsgo` with a `tsconfig.json` or Oxc for
450
+ TypeScript 7 declarations.
448
451
 
449
452
  `rolldown-plugin-dts` owns declaration paths and imports. ESM-only builds attach
450
453
  one declaration graph; CommonJS-only and dual-format builds use one
@@ -13,8 +13,6 @@ import { resolvePath } from "mlly";
13
13
  import { parse } from "yaml";
14
14
  import { resolvePackageJSON } from "pkg-types";
15
15
  import { execa } from "execa";
16
- import { playwright } from "@vitest/browser-playwright";
17
- import { storybookTest } from "@storybook/addon-vitest/vitest-plugin";
18
16
  import { consola } from "consola";
19
17
  import { randomUUID } from "node:crypto";
20
18
  import { tmpdir } from "node:os";
@@ -132,7 +130,7 @@ const supportedTools = {
132
130
  },
133
131
  typescript: {
134
132
  packageName: "typescript",
135
- range: ">=5 <7"
133
+ range: ">=5 <7.1.0"
136
134
  },
137
135
  "typescript-native": {
138
136
  packageName: "@typescript/native-preview",
@@ -365,7 +363,6 @@ var Toolchain = class {
365
363
  };
366
364
  const formatResolvedTool = (tool) => `${tool.packageName} ${tool.version} (${tool.source})`;
367
365
  const declarationDefaults = {
368
- generator: "tsc",
369
366
  incremental: false,
370
367
  newContext: true,
371
368
  parallel: false
@@ -469,11 +466,21 @@ const withoutImplicitIncremental = (config) => {
469
466
  }
470
467
  };
471
468
  };
469
+ const usesTypeScriptSeven = (typescript) => typescript.version.startsWith("7.");
470
+ const selectDeclarationGenerator = async (configured, plugins, tsconfigPath, toolchain) => {
471
+ const requested = configured.generator;
472
+ if (plugins.length > 0 && requested !== void 0 && requested !== "tsc") throw new Error(`TypeScript declaration transforms from ${tsconfigPath ?? "compilerOptions"} require build.declaration.generator "tsc"; ${requested} cannot apply TypeScript emit transforms`);
473
+ if (requested === "oxc" || requested === "tsgo") return requested;
474
+ const typescript = await toolchain.resolve("typescript");
475
+ if (!usesTypeScriptSeven(typescript)) return "tsc";
476
+ if (requested === "tsc") throw new Error(`build.declaration.generator "tsc" does not support TypeScript ${typescript.version}; use "tsgo" with a tsconfig.json or "oxc" instead`);
477
+ if (plugins.length > 0) throw new Error(`TypeScript declaration transforms from ${tsconfigPath ?? "compilerOptions"} require the "tsc" generator, which does not support TypeScript ${typescript.version}; use TypeScript 6 or below, or remove the transforms`);
478
+ return tsconfigPath === void 0 ? "oxc" : "tsgo";
479
+ };
472
480
  const createDeclarationPlugins = async (declaration, cwd, toolchain, emitDtsOnly) => serializeSetup(async () => {
473
481
  const configured = withoutImplicitIncremental(declaration === true ? {} : declaration);
474
- const generator = configured.generator ?? declarationDefaults.generator;
475
482
  const { plugins, tsconfigPath } = compilerPlugins(cwd, configured);
476
- if (plugins.length > 0 && generator !== "tsc") throw new Error(`TypeScript declaration transforms from ${tsconfigPath ?? "compilerOptions"} require build.declaration.generator "tsc"; ${generator} cannot apply TypeScript emit transforms`);
483
+ const generator = await selectDeclarationGenerator(configured, plugins, tsconfigPath, toolchain);
477
484
  const options = {
478
485
  ...declarationDefaults,
479
486
  ...configured,
@@ -1208,6 +1215,7 @@ const createStorybookTestProject = async (config = {}, vitestVersion = storybook
1208
1215
  if (vitestVersion !== storybookVitestVersion) throw new Error(`Storybook tests require Vitest ${storybookVitestVersion}; Webanvil bundles @vitest/browser-playwright ${storybookVitestVersion}`);
1209
1216
  const previousVitest = process.env.VITEST;
1210
1217
  process.env.VITEST = "true";
1218
+ const [{ playwright }, { storybookTest }] = await Promise.all([import("@vitest/browser-playwright"), import("@storybook/addon-vitest/vitest-plugin")]);
1211
1219
  let plugins;
1212
1220
  try {
1213
1221
  plugins = await storybookTest({ configDir: config.configDir });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webanvil",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "A unified CLI for building, testing, linting, formatting, and type-checking JavaScript and TypeScript projects.",
5
5
  "keywords": [
6
6
  "build-tool",