### Basic Package Size Check with pkgsz Source: https://context7.com/kshutkin/package-size/llms.txt Perform a basic size check on an npm package to get minified, gzipped sizes, node_modules statistics, and bundle composition. No special setup is required beyond having Node.js and npm installed. ```bash npx pkgsz lodash ``` -------------------------------- ### Enable npm Scripts for Package Analysis Source: https://context7.com/kshutkin/package-size/llms.txt Use the -s flag to enable npm scripts during package installation. This is useful for packages that rely on postinstall scripts. ```bash npx pkgsz @tstpkgs/with-scripts -s ``` ```bash npx pkgsz sharp -s ``` -------------------------------- ### Show pkgsz Help Information Source: https://context7.com/kshutkin/package-size/llms.txt Display the help message for the pkgsz command to see all available options and their usage. ```bash npx pkgsz --help ``` -------------------------------- ### Run pkgsz CLI Source: https://github.com/kshutkin/package-size/blob/main/README.md Execute the pkgsz command-line tool with optional flags and a package name, optionally specifying a version. ```bash npx pkgsz [flags] [version] ``` -------------------------------- ### pkgsz Command Line Options Reference Source: https://context7.com/kshutkin/package-size/llms.txt This section lists all available CLI flags for pkgsz, including options for specifying the registry, exporting subpaths, controlling gzip and brotli compression, cleaning temporary directories, enabling scripts, interactive mode, and JSON output. ```bash # Show help npx pkgsz --help # Output: # Usage: pkgsz [flags] [version] # # Get the size of an npm package # # Options: # -r, --registry The npm registry to use when installing the package # -e, --export Reexport given subpath from the package (default: [". ``` ```bash # Common flag combinations npx pkgsz lodash -j # JSON output with gzip npx pkgsz lodash -jg # JSON output without gzip npx pkgsz lodash -bg # Text output with brotli only npx pkgsz lodash -bjg # JSON with brotli, no gzip ``` -------------------------------- ### Analyze Package with Version Alias Source: https://context7.com/kshutkin/package-size/llms.txt Analyze a package by specifying its name and version using an alias format. ```bash npx pkgsz lodash@4.17.21 ``` -------------------------------- ### Interactive Mode with pkgsz Source: https://context7.com/kshutkin/package-size/llms.txt Enable interactive mode using the `-i` flag to interactively select subpath exports and dependencies to include in the bundle analysis. This is useful for fine-grained control over the analysis. ```bash npx pkgsz lodash-es -i ``` -------------------------------- ### Brotli Compression Measurement with pkgsz Source: https://context7.com/kshutkin/package-size/llms.txt Enable brotli compression measurement for more accurate modern compression statistics. Use the `-b` flag for brotli alongside gzip, or `-bg` to use brotli instead of gzip. ```bash npx pkgsz @tstpkgs/basic-esm -b ``` ```bash npx pkgsz @tstpkgs/basic-esm -bg ``` ```bash npx pkgsz @tstpkgs/basic-esm -bjg ``` -------------------------------- ### Use Custom Registry with pkgsz Source: https://context7.com/kshutkin/package-size/llms.txt Specify a custom npm registry for private packages or enterprise environments using the `-r` flag followed by the registry URL. ```bash npx pkgsz my-private-package -r https://npm.company.com ``` ```bash npx pkgsz my-package -r http://localhost:4873 ``` -------------------------------- ### JSON Output for Programmatic Use with pkgsz Source: https://context7.com/kshutkin/package-size/llms.txt Obtain structured JSON output for use in CI/CD pipelines or build tools. Use the `-jg` flags to enable JSON output with gzip compression. ```bash npx pkgsz @tstpkgs/basic-esm -jg ``` -------------------------------- ### Analyze Specific Package Version Source: https://context7.com/kshutkin/package-size/llms.txt Specify a version number to analyze a particular release of a package. ```bash npx pkgsz lodash 4.17.21 ``` -------------------------------- ### Analyze Subpath Exports with pkgsz Source: https://context7.com/kshutkin/package-size/llms.txt Analyze specific subpath exports when a package exposes multiple entry points. Use the `-e` flag to specify which exports to measure. The tool will first list available exports. ```bash npx pkgsz @tstpkgs/subpath-exports-esm -bg ``` ```bash npx pkgsz @tstpkgs/subpath-exports-esm -bg -e ./second -e . ``` -------------------------------- ### Disable Cleanup with pkgsz Source: https://context7.com/kshutkin/package-size/llms.txt Keep the temporary directory after analysis using the `-c` flag. This is useful for debugging or manual inspection of the built bundle. ```bash npx pkgsz lodash -c ``` -------------------------------- ### Specify Package Version with pkgsz Source: https://context7.com/kshutkin/package-size/llms.txt Check the size of a specific version of an npm package. This can be done using the `@version` syntax or by providing the version as a separate argument. Supports scoped packages. ```bash npx pkgsz lodash@4.17.20 ``` ```bash npx pkgsz lodash 4.17.20 ``` ```bash npx pkgsz @tstpkgs/basic-esm@0.0.1 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.