Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
359 changes: 268 additions & 91 deletions Cargo.lock

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ xxhash-rust = "0.8.15"
zip = "7.2"

# oxc crates with the same version
oxc = { version = "0.134.0", features = [
oxc = { version = "0.135.0", features = [
"ast_visit",
"transformer",
"minifier",
Expand All @@ -328,20 +328,20 @@ oxc = { version = "0.134.0", features = [
"regular_expression",
"cfg",
] }
oxc_allocator = { version = "0.134.0", features = ["pool"] }
oxc_ast = "0.134.0"
oxc_ecmascript = "0.134.0"
oxc_parser = "0.134.0"
oxc_span = "0.134.0"
oxc_napi = "0.134.0"
oxc_str = "0.134.0"
oxc_minify_napi = "0.134.0"
oxc_parser_napi = "0.134.0"
oxc_transform_napi = "0.134.0"
oxc_traverse = "0.134.0"
oxc_allocator = { version = "0.135.0", features = ["pool"] }
oxc_ast = "0.135.0"
oxc_ecmascript = "0.135.0"
oxc_parser = "0.135.0"
oxc_span = "0.135.0"
oxc_napi = "0.135.0"
oxc_str = "0.135.0"
oxc_minify_napi = "0.135.0"
oxc_parser_napi = "0.135.0"
oxc_transform_napi = "0.135.0"
oxc_traverse = "0.135.0"

# oxc crates in their own repos
oxc_index = { version = "4", features = ["rayon", "serde"] }
oxc_index = { version = "5", features = ["rayon", "serde"] }
oxc_resolver = { version = "11.21.0", features = ["yarn_pnp"] }
oxc_resolver_napi = { version = "11.21.0", default-features = false, features = ["yarn_pnp"] }
oxc_sourcemap = "7"
Expand Down
45 changes: 30 additions & 15 deletions packages/cli/binding/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @ts-nocheck
/* auto-generated by NAPI-RS */

const { readFileSync } = require('node:fs')
const { readFileSync } = require('fs')
let nativeBinding = null;
const loadErrors = [];

Expand Down Expand Up @@ -33,7 +33,7 @@ const isMuslFromFilesystem = () => {

const isMuslFromReport = () => {
let report = null;
if (typeof process.report?.getReport === 'function') {
if (process.report && typeof process.report.getReport === 'function') {
process.report.excludeNetwork = true;
report = process.report.getReport();
}
Expand Down Expand Up @@ -122,8 +122,12 @@ function requireNative() {
} else if (process.platform === 'win32') {
if (process.arch === 'x64') {
if (
process.config?.variables?.shlib_suffix === 'dll.a' ||
process.config?.variables?.node_target_type === 'shared_library'
(process.config &&
process.config.variables &&
process.config.variables.shlib_suffix === 'dll.a') ||
(process.config &&
process.config.variables &&
process.config.variables.node_target_type === 'shared_library')
) {
try {
return require('./vite-plus.win32-x64-gnu.node');
Expand Down Expand Up @@ -714,23 +718,33 @@ function requireNative() {

nativeBinding = requireNative();

if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
// NAPI_RS_FORCE_WASI is a tri-state flag:
// unset / any other value → native binding preferred, WASI is only a fallback
// 'true' → force WASI fallback even if native loaded
// 'error' → force WASI and throw if no WASI binding is found
// Treating any non-empty string as truthy (the historical behavior) meant
// NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered
// the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file.
const forceWasi =
process.env.NAPI_RS_FORCE_WASI === 'true' || process.env.NAPI_RS_FORCE_WASI === 'error';

if (!nativeBinding || forceWasi) {
let wasiBinding = null;
let wasiBindingError = null;
try {
wasiBinding = require('./vite-plus.wasi.cjs');
nativeBinding = wasiBinding;
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
if (forceWasi) {
wasiBindingError = err;
}
}
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
if (!nativeBinding || forceWasi) {
try {
wasiBinding = require('@voidzero-dev/vite-plus-wasm32-wasi');
nativeBinding = wasiBinding;
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
if (forceWasi) {
if (!wasiBindingError) {
wasiBindingError = err;
} else {
Expand All @@ -749,17 +763,18 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {

if (!nativeBinding) {
if (loadErrors.length > 0) {
throw new Error(
const error = new Error(
`Cannot find native binding. ` +
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
{
cause: loadErrors.reduce((err, cur) => {
cur.cause = err;
return cur;
}),
},
);
// assign instead of the `new Error(message, { cause })` options form,
// which Node < 16.9 silently ignores
error.cause = loadErrors.reduce((err, cur) => {
cur.cause = err;
return cur;
});
throw error;
}
throw new Error(`Failed to load native binding`);
}
Expand Down
101 changes: 100 additions & 1 deletion packages/cli/binding/index.d.cts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface CompressOptions {
*
* @default 'esnext'
*
* @see [esbuild#target](https://esbuild.github.io/api/#target)
* @see [oxc#target](https://oxc.rs/docs/guide/usage/transformer/lowering#target)
*/
target?: string | Array<string>;
/**
Expand Down Expand Up @@ -1184,6 +1184,97 @@ export interface PluginsOptions {
taggedTemplateEscape?: boolean;
}

/** Dynamic gating for {@link ReactCompilerOptions#dynamicGating}. */
export interface ReactCompilerDynamicGating {
/** Module the gating import comes from. */
source: string;
}

/** Static gating for {@link ReactCompilerOptions#gating}. */
export interface ReactCompilerGating {
/** Module the gating import comes from. */
source: string;
/** Imported specifier used as the gate. */
importSpecifierName: string;
}

/**
* Options for the experimental [React Compiler](https://github.com/facebook/react/pull/36173).
*
* Mirrors the compiler's `PluginOptions`. The deep `environment` configuration
* (inference / validation flags) is not surfaced here.
*
* @see {@link TransformOptions#reactCompiler}
*/
export interface ReactCompilerOptions {
/**
* Which functions to compile.
*
* @default 'infer'
*/
compilationMode?: 'infer' | 'syntax' | 'annotation' | 'all';
/**
* What to do when a function cannot be compiled.
*
* @default 'none'
*/
panicThreshold?: 'none' | 'critical_errors' | 'all_errors';
/**
* React runtime version target. `17` and `18` require the
* `react-compiler-runtime` package; `19` ships the runtime in `react`.
*
* @default '19'
*/
target?: '17' | '18' | '19';
/**
* Analyze and report diagnostics only; emit no transformed code.
*
* @default false
*/
noEmit?: boolean;
/**
* Compiler output mode.
*
* @default undefined
*/
outputMode?: 'client' | 'ssr' | 'lint';
/**
* Compile even functions marked with the `"use no memo"` / `"use no forget"`
* opt-out directives.
*
* @default false
*/
ignoreUseNoForget?: boolean;
/**
* Treat Flow suppression comments as opt-outs.
*
* @default true
*/
flowSuppressions?: boolean;
/**
* Enable `react-native-reanimated` support.
*
* @default false
*/
enableReanimated?: boolean;
/**
* Development mode (extra validation / instrumentation).
*
* @default false
*/
isDev?: boolean;
/** Source file name, used for the fast-refresh hash and in diagnostics. */
filename?: string;
/** ESLint rules whose suppressions opt a function out of compilation. */
eslintSuppressionRules?: Array<string>;
/** Extra directives that opt a function out of compilation. */
customOptOutDirectives?: Array<string>;
/** Also emit a gated (feature-flagged) version of each compiled function. */
gating?: ReactCompilerGating;
/** Dynamically-gated compilation. */
dynamicGating?: ReactCompilerDynamicGating;
}

export interface ReactRefreshOptions {
/**
* Specify the identifier of the refresh registration variable.
Expand Down Expand Up @@ -1365,6 +1456,14 @@ export interface TransformOptions {
inject?: Record<string, string | [string, string]>;
/** Decorator plugin */
decorator?: DecoratorOptions;
/**
* Enable the experimental [React Compiler](https://github.com/facebook/react/pull/36173).
*
* `true` enables it with default options; an object enables it with the
* given options; `false` or omitted disables it. When enabled, the compiler
* runs as the first transform and memoizes React components and hooks.
*/
reactCompiler?: boolean | ReactCompilerOptions;
/**
* Third-party plugins to use.
* @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"@babel/types": "^7.28.5",
"@oxc-node/cli": "catalog:",
"@oxc-node/core": "catalog:",
"@vitejs/devtools": "^0.3.1",
"@vitejs/devtools": "^0.3.3",
"es-module-lexer": "^1.7.0",
"hookable": "^6.0.1",
"magic-string": "^0.30.21",
Expand Down Expand Up @@ -219,7 +219,7 @@
},
"bundledVersions": {
"vite": "8.0.16",
"rolldown": "1.1.0",
"rolldown": "1.1.1",
"tsdown": "0.22.2"
}
}
2 changes: 1 addition & 1 deletion packages/tools/.upstream-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"rolldown": {
"repo": "https://github.com/rolldown/rolldown.git",
"branch": "main",
"hash": "c462c7c5eda42e27a57c75850be22936d18e32b6"
"hash": "d7f919c18980e6b4a26d06bd071d7cf14cf810a7"
},
"vite": {
"repo": "https://github.com/vitejs/vite.git",
Expand Down
Loading
Loading