{"name":"@utoo/pack","version":"1.5.34","license":"MIT","_id":"@utoo/pack@1.5.34","maintainers":[{"name":"afc163","email":"afc163@gmail.com"},{"name":"elrrrrrrr","email":"elrrrrrrr@gmail.com"},{"name":"xusd320","email":"xusd320@gmail.com"},{"name":"zoomdong07","email":"zoomdong07@gmail.com"}],"homepage":"https://github.com/utooland/utoo#readme","bugs":{"url":"https://github.com/utooland/utoo/issues"},"dist":{"shasum":"a2286026bf1dcb3b113982667e399ede69a0cad3","tarball":"http://registry-npm.ywwl.com/@utoo/pack/download/@utoo/pack-1.5.34.tgz","fileCount":151,"integrity":"sha512-bdCx95ZH7ahRzXYNa5Z0AeZosGTIsdf5fE3JAraaLZ3UGFqv1PHMnueeq5HLFrUpr1D6z/8MQtOb+iCZwaa94w==","signatures":[{"sig":"MEUCIQDT6fsKyYuAq0KQ6hH5pA7siKK4+XUg2JnFbdwLSoTuhAIgVvwIXhaE4FHaes/0BxeN9DXHxCM61wrc0ZOrMw5xtuQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDxVnrWLrhC6uVPuwnfvh/NnNxGFZ0Ki4nt5GYaGN105gIgM43SER/jhI6zST46kSJShtzoJvU0DsSyWeQnow2PtN4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@utoo%2fpack@1.5.34","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":504688,"size":76838,"noattachment":false,"key":"/@utoo/pack/-/@utoo/pack-1.5.34.tgz"},"main":"cjs/index.js","napi":{"targets":["aarch64-apple-darwin","x86_64-apple-darwin","aarch64-unknown-linux-gnu","aarch64-unknown-linux-musl","x86_64-unknown-linux-gnu","x86_64-unknown-linux-musl","x86_64-pc-windows-msvc"],"binaryName":"pack"},"types":"esm/index.d.ts","module":"esm/index.js","engines":{"node":">= 20"},"exports":{".":{"types":"./esm/index.d.ts","import":"./esm/index.js","require":"./cjs/index.js"},"./cjs/*":"./cjs/*","./esm/*":"./esm/*","./package.json":"./package.json","./config_schema.json":"./config_schema.json"},"gitHead":"0603a3f639e0cba5a76d87cffb6c8629e2a83d97","scripts":{"test":"vitest run","build":"npm run build:binding && npm run build:cjs && npm run build:esm","clean":"rm -rf cjs esm","version":"napi version","build:js":"npm run build:cjs && npm run build:esm","artifacts":"napi artifacts --output-dir ./src --npm-dir npm","build:cjs":"rm -rf cjs && tsc -p ./tsconfig.json --module commonjs --outDir cjs && cp src/*.d.ts cjs/","build:esm":"rm -rf esm && tsc -p ./tsconfig.json --module esnext --outDir esm && cp src/*.d.ts esm/ && node ../../scripts/add-esm-extensions.cjs && node scripts/inject-esm-dirname.cjs","build:local":"npm run build:binding:local && npx turbo run build --filter=@utoo/pack-shared && npm run build:cjs && npm run build:esm && cp src/*.node cjs/ && cp src/*.node esm/","build:binding":"napi build --platform --release -p pack-napi --manifest-path ../../Cargo.toml -o src --features plugin --js binding.js --dts binding.d.ts","prepublishOnly":"npm run build:js && napi pre-publish -t npm --no-gh-release","build:binding:local":"napi build --platform --profile release-local -p pack-napi --manifest-path ../../Cargo.toml -o src --features plugin --js binding.js --dts binding.d.ts","check:binding-version":"node scripts/check-binding-version.cjs","generate-features-list":"node ./scripts/generate-feature-list.js"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"eecb9ba2-ce26-4fbf-a934-8cbee8d85247"}},"repository":{"url":"git+https://github.com/utooland/utoo.git","type":"git","directory":"packages/pack"},"_npmVersion":"11.6.2","description":"> 🌖 High-performance bundler core for the Utoo toolchain, powered by [Turbopack](https://turbo.build/pack).","directories":{},"_nodeVersion":"22.14.0","dependencies":{"ws":"^8.18.1","hono":"^4.12.5","nanoid":"^3.3.11","semver":"^7.7.1","find-up":"4.1.0","get-port":"5.1.1","picocolors":"^1.1.1","@swc/helpers":"0.5.15","browserslist":"^4.28.5","domparser-rs":"^0.0.7","@hono/node-ws":"^1.3.0","@babel/code-frame":"7.22.5","@hono/node-server":"^1.19.11","@utoo/pack-shared":"1.5.34","@jridgewell/trace-mapping":"^0.3.31"},"_hasShrinkwrap":false,"devDependencies":{"@types/ws":"^8.18.1","typescript":"^5.8.3","@types/mime":"^3.0.4","@types/node":"^20.3.0","@napi-rs/cli":"3.8.6","@types/semver":"^7.7.1","@types/mime-types":"3.0.1","@types/babel__code-frame":"7.0.2"},"peerDependencies":{"less":"^4.0.0","sass":"1.54.0","postcss":"8.4.31","styled-jsx":"^5.1.6","less-loader":"^12.0.0","sass-loader":"^13.2.0","resolve-url-loader":"^5.0.0"},"optionalDependencies":{"@utoo/pack-darwin-x64":"1.5.34","@utoo/pack-darwin-arm64":"1.5.34","@utoo/pack-linux-x64-gnu":"1.5.34","@utoo/pack-linux-x64-musl":"1.5.34","@utoo/pack-win32-x64-msvc":"1.5.34","@utoo/pack-linux-arm64-gnu":"1.5.34","@utoo/pack-linux-arm64-musl":"1.5.34"},"_npmOperationalInternal":{"tmp":"tmp/pack_1.5.34_1793101490495_0.42073932706090444","host":"s3://npm-registry-packages-npm-production"},"readme":"# @utoo/pack\n\n> 🌖 High-performance bundler core for the Utoo toolchain, powered by [Turbopack](https://turbo.build/pack).\n\n`@utoo/pack` is the engine behind the Utoo build system. It leverages the incremental computation power of Turbopack and the performance of Rust to provide a lightning-fast development and build experience.\n\n## ✨ Key Features\n\n- ⚡ **Extreme Performance**: Core bundling logic implemented in Rust via NAPI-RS.\n- 🛠️ **Turbopack Powered**: Built on top of the same engine that powers Next.js Turbopack.\n- 🔌 **Webpack Compatibility**: Support for consuming `webpack.config.js` to simplify migration from Webpack.\n- 📦 **Modern Web Support**: Native support for TypeScript, JSX, CSS Modules, Less, Sass, and more.\n- 🔧 **Extensible Architecture**: Support for custom loaders, plugins, and flexible configuration.\n- 🔄 **Fast HMR**: Instant updates during development with optimized Hot Module Replacement.\n\n## ✨ Supported Features\n\n`@utoo/pack` aims for high compatibility with the Webpack ecosystem while providing superior performance.\n\n- **Entry**: Supports `name`, `import`, and `filename` templates.\n- **Module Rules**: Support for most mainstream Webpack loaders via `loader-runner`.\n- **Resolve**: Full support for `alias` and `extensions`.\n- **Styles**: Built-in support for Less, Sass, PostCSS, CSS Modules, and LightningCSS.\n- **Optimization**: Minification, Tree Shaking, Module Concatenation, and more.\n- **Frameworks**: Optimized for React (including `styled-jsx`, `styled-components`).\n- **Tools**: Integrated Bundle Analyzer and Tracing Logs.\n\n> [!TIP]\n> For a detailed status of all features, see the [Features List](./docs/features-list.md).\n\n## 📦 Installation\n\n```bash\nut install @utoo/pack --save-dev\n```\n\n## 🚀 Quick Start\n\n### Programmatic API\n\nYou can use `@utoo/pack` directly in your Node.js scripts:\n\n```javascript\nconst { build, serve } = require('@utoo/pack');\n\n// Production build\nasync function runBuild() {\n  await build({\n    config: {\n      entry: [\n        {\n          import: \"./src/index.ts\",\n          html: {\n            template: \"./index.html\"\n          }\n        }\n      ],\n      output: {\n        path: \"./dist\",\n        filename: \"[name].[contenthash:8].js\",\n        chunkFilename: \"[name].[contenthash:8].js\",\n        clean: true\n      },\n      sourceMaps: true\n    }\n  });\n}\n\n// Development mode with HMR\nasync function startDev() {\n  const server = await serve({\n    config: {\n      entry: [\n        {\n          import: \"./src/index.ts\",\n          html: {\n            template: \"./index.html\"\n          }\n        }\n      ],\n      output: {\n        path: \"./dist\",\n        filename: \"[name].[contenthash:8].js\",\n        chunkFilename: \"[name].[contenthash:8].js\",\n        clean: true\n      },\n      sourceMaps: true\n    }\n  }, undefined, undefined, { port: 3000, returnHandle: true });\n  return server;\n}\n```\n\n`serve()` resolves after the initial build and HTTP startup. By default its result\nremains `void`. Pass `{ port: 3000, returnHandle: true }` as the fourth argument\nto receive a handle containing\n`port`, `hostname`, `writeAllEntrypointsToDisk()` and `close()`. Integrations can\nawait `writeAllEntrypointsToDisk()` before publishing build results: it checks\ncompilation diagnostics and regenerates HTML with the current asset paths before\nresolving. Compilation and HTML generation errors reject the call. Await\n`close()` to release the HTTP server, HMR connections and project resources.\nCalling `close()` does not exit the process. To manage the surrounding process\nyourself, pass `{ port: 3000, returnHandle: true, handleSignals: false }` as the fourth argument.\n\nPass `onClientBuild({ clientPaths, isRebuild })` in the fourth argument to publish\nframework HTML after successful client builds. It runs after assets, enabled\nstats and built-in HTML are written, even without a connected browser. The first\ncall has `isRebuild: false` and precedes `onReady`; subsequent calls have\n`isRebuild: true`. Its returned promise is awaited before the next output write.\nDo not call `writeAllEntrypointsToDisk()` or await `close()` inside this callback.\nStartup callback failures reject `serve()`; background failures are logged and\nlater builds can retry. Failed compilations do not invoke the callback.\n\n## 🔌 Webpack Compatibility Mode\n\n`@utoo/pack` provides a partial compatibility layer for Webpack.\n\n```javascript\nconst { build } = require('@utoo/pack');\nconst webpackConfig = require('./webpack.config.js');\n\nasync function run() {\n  await build({ ...webpackConfig, webpackMode: true });\n}\n```\n\n> [!NOTE]\n> Not all Webpack features and plugins are supported. Check the [Features List](./docs/features-list.md) for details on supported configuration options.\n\n## ⚙️ Configuration\n\nThe bundler can be configured via a `utoopack.json` or through the programmatic API. Key configuration areas include:\n\n- **`entry`**: Define your application entry points.\n- **`define`**: Build-time variable replacement.\n- **`externals`**: Exclude specific dependencies from the bundle.\n- **`server.externals`**: Replace top-level externals for server entries and Server Functions. If\n  omitted, server builds continue to use top-level `externals`.\n- **`devServer.browserToTerminal`**: Forward browser console output to the development terminal.\n  Use `\"error\"`, `\"warn\"`, `true`, or `false`; standalone Utoopack defaults to `false`.\n- **`mode`**: `development` or `production`.\n\nFor a full list of options, see the [Configuration Schema](./config_schema.json).\n\nProduction client builds default to short content-hashed JS and CSS chunk names,\nusing Turbopack's 13-character base38 hash (for example, `<hash>.js` or\n`turbopack-<hash>.js` for entry runtimes). Development builds retain readable names.\nExplicit `output.filename`, `output.chunkFilename`, and `output.cssFilename`\ntemplates take precedence; use `filename: \"[name].js\"` when consumers require\nstable entry filenames. Static assets, copied files, server builds, and library\nbuilds keep their existing naming rules. A deployment's complete URL also includes\nits public path and any query parameters, so short chunk names alone do not\nguarantee a particular URL length limit.\n\nSet `optimization.sharedRuntime: true` to emit one browser runtime asset shared\nacross production application entries. This reduces duplicated runtime code in\nmulti-entry builds and lets pages reuse the cached runtime. Each entry keeps its\nown small bootstrap script. The option defaults to `false` because separating the\nruntime adds a request for a single entry; it does not apply to development,\nNode.js, or library builds.\n\n```json\n{\n  \"mode\": \"production\",\n  \"optimization\": {\n    \"sharedRuntime\": true\n  }\n}\n```\n\n### Worktree and Symlink Debugging\n\nSet `UTOO_ROOT_PATH` to a common parent containing the project and the real paths\nof linked dependencies when debugging worktrees or symlinks:\n\n```bash\nUTOO_ROOT_PATH=/path/to/common-parent utx up dev\n# Relative paths resolve from the current working directory:\nUTOO_ROOT_PATH=.. utx up build\n```\n\nPrecedence is `UTOO_ROOT_PATH` > explicit `rootPath` > automatic detection. Empty\nvalues are ignored. This applies to `build`, `serve`, and direct project creation,\nwhere `rootPath` can be omitted. Updates that omit it retain the existing root.\n`findRootDir()` and the project directory stay unchanged, preserving framework\nplugin lookup and generated file locations.\n\n## 🛠️ Development\n\n### Prerequisites\n\n- **Rust**: Nightly toolchain (see [rust-toolchain.toml](../../rust-toolchain.toml)).\n- **Node.js**: Version 20 or higher.\n\n### Building from Source\n\n```bash\n# Build Rust bindings and TypeScript modules\nnpm run build\n```\n\n## 📄 License\n\n[MIT](./LICENSE)\n","publish_time":1793101490599,"_cnpm_publish_time":1793101490599,"dist-tags":{"alpha":"1.5.38-alpha.0","latest":"1.5.39","lingguang":"1.1.7-lingguang","rc":"1.2.10-rc.2"}}