@evjs/bundler-utoopack

中文文档
0.3.30发布于 2026/11/14MITTypeScriptES Module构建来源已验证近 30 天下载 2022

Utoopack bundler adapter for the evjs framework

原始使用文档
文档目录3 节
  1. Development Native Ownership
  2. Usage
  3. Plugin Helper

@evjs/bundler-utoopack

The default utoopack (@utoo/pack) bundler adapter for the evjs framework.

This package exports utoopackAdapter, which implements the BundlerAdapter interface for ev build and ev dev.

The adapter requires @utoo/pack 1.6.0 or newer. Plugin-contributed browser module references also check the loaded native binding's capability at runtime.

The adapter integrates with Utoopack's programmatic API, compiles the concrete entries in BuildPlan, and returns build facts for framework output linking. Its declared capabilities are the authoritative boundary: conventional server-rendered Page entries are supported, while plans that require RSC or PPR fail during framework preflight.

Development Native Ownership

Utoopack development uses one long-lived native-owner Worker for the complete ev dev command. Ownership is intentionally split by lifetime:

LifetimeOwnerResponsibility
ev dev processFramework hostSession protocol, function-valued proxy rewrites, and framework supervision. It does not load Utoopack's native binding.
ev dev processNative-owner WorkerUtoopack's native binding, process-global loader scheduler, loader-worker pool, and every sequential native Project.
Immutable SessionNative-owner WorkerOne Project, development server, subscriptions, and persistent-cache lock. These close completely before the next Session starts.

Session replacement runs Utoopack's own graceful cleanup inside the owner and converts its successful process exit into a Session boundary. The Worker then remains idle for the next immutable Session. Owner startup failures, loader scheduler failures, unexpected exits, and shutdown timeouts are fail-stop; the host never creates a second native owner in the same process. Startup also rejects a host that has already loaded Utoopack's native binding, because that would recreate cross-environment native ownership.

Usage

This adapter is enabled by default in evjs. You do not need to configure it manually unless you are overriding another bundler.

If you need to explicitly configure it:

import { defineConfig } from "@evjs/ev";
import { utoopackAdapter } from "@evjs/bundler-utoopack";

export default defineConfig({
  bundler: utoopackAdapter,
});

Plugin Helper

The utoopack() helper wraps your plugin hooks for type-safe configuration mutation:

import { merge, utoopack } from "@evjs/bundler-utoopack";
import { defineConfig } from "@evjs/ev";
import { definePlugin } from "@evjs/ev/plugin";

const myUtoopackPlugin = definePlugin({
  id: "my-utoopack-plugin",
  setup() {
    return {
      configureBundler: utoopack((config) => {
        // config is typed as ConfigComplete from @utoo/pack
        merge(config, {
          define: {
            __MY_VAR__: JSON.stringify("value"),
          },
        });
      }),
    };
  },
});

export default defineConfig({
  plugins: [myUtoopackPlugin()],
});

版本与发布记录

@evjs/bundler-utoopack 共发布 76 个版本,首次发布于 2026/04/21;过去 12 个月发布了 76 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.3.30latest2026/11/14今天
0.3.30-alpha.1alpha2026/11/122 天前
0.3.30-alpha.02026/11/113 天前
0.2.18legacy2026/11/0212 天前
0.3.292026/11/0113 天前
0.3.282026/10/3114 天前

关于 @evjs/bundler-utoopack 的常见问题

@evjs/bundler-utoopack 是什么?

Utoopack bundler adapter for the evjs framework

如何安装 @evjs/bundler-utoopack?

在项目目录运行 npm install @evjs/bundler-utoopack,或使用 pnpm add / yarn add / bun add。

@evjs/bundler-utoopack 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@evjs/bundler-utoopack 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@evjs/bundler-utoopack 可以商用吗?

@evjs/bundler-utoopack 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@evjs/bundler-utoopack 的下载量有多少?

根据 npm 官方下载统计,@evjs/bundler-utoopack 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,022 次,日均约 67 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@evjs/bundler-utoopack 还在维护吗?

最新版本 0.3.30 发布于 2026/11/14(今天);至今共发布 76 个版本,其中过去 12 个月发布了 76 个;首次发布于 2026/04/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。