github Anber/wyw-in-js @wyw-in-js/vite@2.0.0

Major Changes

  • 2524aa4: Release WyW-in-JS v2.

    The v2 release moves the published packages to an ESM-only, Oxc-backed transform and evaluation pipeline and requires Node.js >= 22.0.0.

    Breaking changes and migration notes from v1:

    • CommonJS package entrypoints were removed. Migrate configs and tooling to ESM (import() / .mjs).
    • The transform path now uses Oxc for parsing, analysis, pre-evaluation rewrites, shaking, collection, and code generation. @wyw-in-js/babel-preset remains available as a deprecated compatibility wrapper around the Oxc pipeline.
    • Build-time evaluation now runs through the async ESM evaluator (vm.SourceTextModule + runner RPC).
    • The default value resolver is eval.strategy: "hybrid": WyW tries static-first resolution for provable values and falls back to evaluator execution for values that still need runtime module evaluation. Use eval.strategy: "execute" for evaluator-only compatibility, or eval.strategy: "static" to reject evaluator fallback.
    • The previous top-level evaluate option is replaced by eval.strategy.
    • Eval IPC and config handling are stricter: unsupported __wywPreval, eval.globals, and inline non-serializable preset/plugin options now fail with explicit migration errors instead of being silently coerced.
    • require() inside eval follows the configured eval.require fallback behavior (warn-and-run, error, or off).
    • CSS rule emission order can differ from v1 for equivalent extracted rule sets because the static-first/Oxc pipeline can process preserved imports and rules in a different order. Projects that rely on cascade ties between generated rules should make precedence explicit in selector specificity, composition, or source structure.

    Migration guide: https://wyw-in-js.dev/migration/v2

Minor Changes

  • 2524aa4: Add a supported processor diagnostics API that lets library-owned processors emit structured non-fatal warnings through WyW.

    This adds:

    • BaseProcessor.addDiagnostic() and typed diagnostics helpers in @wyw-in-js/processor-utils
    • normalized diagnostics output from @wyw-in-js/transform
    • diagnostics reporting in @wyw-in-js/vite and @wyw-in-js/cli

    Existing hard failures and metadata sidecar behavior stay intact.

  • 2524aa4: Add opt-in metadata manifest output across @wyw-in-js/shared, @wyw-in-js/transform, @wyw-in-js/vite, and @wyw-in-js/cli.

    When outputMetadata is enabled:

    • @wyw-in-js/transform now returns normalized, public metadata alongside the existing transform result.
    • @wyw-in-js/vite emits .wyw-in-js.json sidecar assets during build.
    • @wyw-in-js/cli writes matching .wyw-in-js.json sidecar files and supports an --output-metadata flag.

    This keeps default JS/CSS output unchanged while exposing stable metadata artifacts for CLI, Vite, and transform consumers.

Patch Changes

  • 2524aa4: Add native Oxc-backed import resolution for build-time evaluation.

    Hybrid eval resolution now tries a custom resolver first, then native resolution, then the bundler resolver. Native resolution is powered by oxc-resolver, discovers tsconfig.json by default, and receives static string aliases from Vite, esbuild, webpack, and Next Turbopack integrations while preserving explicitly configured oxcOptions.resolver.alias entries.

  • Updated dependencies

    • @wyw-in-js/shared@2.0.0
    • @wyw-in-js/transform@2.0.0

Don't miss a new wyw-in-js release

NewReleases is sending notifications on new releases.