mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 22:01:47 +00:00
Compare commits
1 Commits
jarred/try
...
riskymh/co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0392229fb8 |
@@ -82,17 +82,17 @@ _bun_completions() {
|
||||
declare -A PACKAGE_OPTIONS;
|
||||
declare -A PM_OPTIONS;
|
||||
|
||||
local SUBCOMMANDS="dev bun create run install add remove upgrade completions discord help init pm x test repl update outdated link unlink build";
|
||||
local SUBCOMMANDS="dev bun create run install add remove upgrade completions discord help init pm x test repl update outdated link unlink build audit info exec publish patch patch-commit";
|
||||
|
||||
GLOBAL_OPTIONS[LONG_OPTIONS]="--use --cwd --bunfile --server-bunfile --config --disable-react-fast-refresh --disable-hmr --env-file --extension-order --jsx-factory --jsx-fragment --extension-order --jsx-factory --jsx-fragment --jsx-import-source --jsx-production --jsx-runtime --main-fields --no-summary --version --platform --public-dir --tsconfig-override --define --external --help --inject --loader --origin --port --dump-environment-variables --dump-limits --disable-bun-js";
|
||||
GLOBAL_OPTIONS[SHORT_OPTIONS]="-c -v -d -e -h -i -l -u -p";
|
||||
GLOBAL_OPTIONS[LONG_OPTIONS]="--use --cwd --bunfile --server-bunfile --config --disable-react-fast-refresh --disable-hmr --env-file --extension-order --jsx-factory --jsx-fragment --jsx-import-source --jsx-production --jsx-runtime --main-fields --no-summary --version --platform --public-dir --tsconfig-override --define --external --help --inject --loader --origin --port --dump-environment-variables --dump-limits --disable-bun-js --minify --minify-syntax --minify-whitespace --minify-identifiers --sourcemap --target --splitting --compile --format --inspect --inspect-wait --inspect-brk --hot --watch --no-install --install --prefer-offline --prefer-latest --if-present --no-clear-screen --smol --require --import --fetch-preconnect --max-http-header-size --dns-result-order --expose-gc --no-deprecation --throw-deprecation --title --zero-fill-buffers --redis-preconnect --no-addons --unhandled-rejections --silent --elide-lines --revision --filter --bun --shell";
|
||||
GLOBAL_OPTIONS[SHORT_OPTIONS]="-c -v -d -e -h -i -l -u -p -r -F -b";
|
||||
|
||||
PACKAGE_OPTIONS[ADD_OPTIONS_LONG]="--development --optional --peer";
|
||||
PACKAGE_OPTIONS[ADD_OPTIONS_LONG]="--development --optional --peer --dev --analyze --only-missing --exact";
|
||||
PACKAGE_OPTIONS[ADD_OPTIONS_SHORT]="-d";
|
||||
PACKAGE_OPTIONS[REMOVE_OPTIONS_LONG]="";
|
||||
PACKAGE_OPTIONS[REMOVE_OPTIONS_SHORT]="";
|
||||
|
||||
PACKAGE_OPTIONS[SHARED_OPTIONS_LONG]="--config --yarn --production --frozen-lockfile --no-save --dry-run --force --cache-dir --no-cache --silent --verbose --global --cwd --backend --link-native-bins --help";
|
||||
PACKAGE_OPTIONS[SHARED_OPTIONS_LONG]="--config --yarn --production --frozen-lockfile --no-save --save --dry-run --force --cache-dir --no-cache --silent --verbose --no-progress --no-summary --no-verify --ignore-scripts --global --cwd --backend --link-native-bins --ca --cafile --network-concurrency --save-text-lockfile --omit --lockfile-only --trust --concurrent-scripts --help";
|
||||
PACKAGE_OPTIONS[SHARED_OPTIONS_SHORT]="-c -y -p -f -g";
|
||||
|
||||
PM_OPTIONS[LONG_OPTIONS]="--config --yarn --production --frozen-lockfile --no-save --dry-run --force --cache-dir --no-cache --silent --verbose --no-progress --no-summary --no-verify --ignore-scripts --global --cwd --backend --link-native-bins --help"
|
||||
@@ -146,7 +146,7 @@ _bun_completions() {
|
||||
COMPREPLY=( $(compgen -W "--force --no-install --help --no-git --verbose --no-package-json --open next react" -- "${cur_word}") );
|
||||
return;;
|
||||
upgrade)
|
||||
COMPREPLY=( $(compgen -W "--version --cwd --help -v -h") );
|
||||
COMPREPLY=( $(compgen -W "--version --cwd --help --canary -v -h") );
|
||||
return;;
|
||||
run)
|
||||
_file_arguments "!(*.@(js|ts|jsx|tsx|mjs|cjs)?($|))";
|
||||
@@ -156,7 +156,28 @@ _bun_completions() {
|
||||
pm)
|
||||
_long_short_completion \
|
||||
"${PM_OPTIONS[LONG_OPTIONS]} ${PM_OPTIONS[SHORT_OPTIONS]}";
|
||||
COMPREPLY+=( $(compgen -W "bin ls cache hash hash-print hash-string" -- "${cur_word}") );
|
||||
COMPREPLY+=( $(compgen -W "bin ls cache hash hash-print hash-string audit pack migrate untrusted trust default-trusted whoami version view" -- "${cur_word}") );
|
||||
return;;
|
||||
test)
|
||||
_long_short_completion \
|
||||
"--timeout --update-snapshots --rerun-each --only --todo --coverage --coverage-reporter --coverage-dir --bail --test-name-pattern --reporter --reporter-outfile" "-u -t"
|
||||
return;;
|
||||
build)
|
||||
COMPREPLY=( $(compgen -W "--production --compile --bytecode --watch --no-clear-screen --target --outdir --outfile --sourcemap --minify --minify-syntax --minify-whitespace --minify-identifiers --format --banner --footer --root --splitting --public-path --entry-naming --chunk-naming --asset-naming --react-fast-refresh --no-bundle --emit-dce-annotations --css-chunking --conditions --app --server-components --env --windows-hide-console --windows-icon --debug-dump-server-files --debug-no-minify --external --packages" -- "${cur_word}") );
|
||||
return;;
|
||||
audit)
|
||||
COMPREPLY=( $(compgen -W "--json" -- "${cur_word}") );
|
||||
return;;
|
||||
info)
|
||||
_long_short_completion \
|
||||
"--config --yarn --production --no-save --save --ca --cafile --dry-run --frozen-lockfile --force --cache-dir --no-cache --silent --verbose --no-progress --no-summary --no-verify --ignore-scripts --trust --global --cwd --backend --registry --network-concurrency --save-text-lockfile --omit --lockfile-only --concurrent-scripts --json --help" \
|
||||
"-c -y -p -f -g -h";
|
||||
return;;
|
||||
patch-commit)
|
||||
COMPREPLY=( $(compgen -W "--patches-dir" -- "${cur_word}") );
|
||||
return;;
|
||||
init)
|
||||
COMPREPLY=( $(compgen -W "--help --yes --minimal --react --react=tailwind --react=shadcn -y -m -r" -- "${cur_word}") );
|
||||
return;;
|
||||
*)
|
||||
local replaced_script;
|
||||
|
||||
@@ -32,8 +32,8 @@ function __fish__get_bun_bun_js_files
|
||||
string split ' ' (bun getcompletes j)
|
||||
end
|
||||
|
||||
set -l bun_install_boolean_flags yarn production optional development no-save dry-run force no-cache silent verbose global
|
||||
set -l bun_install_boolean_flags_descriptions "Write a yarn.lock file (yarn v1)" "Don't install devDependencies" "Add dependency to optionalDependencies" "Add dependency to devDependencies" "Don't update package.json or save a lockfile" "Don't install anything" "Always request the latest versions from the registry & reinstall all dependencies" "Ignore manifest cache entirely" "Don't output anything" "Excessively verbose logging" "Use global folder"
|
||||
set -l bun_install_boolean_flags yarn production optional development no-save dry-run force no-cache silent verbose global ca cafile network-concurrency save-text-lockfile omit lockfile-only trust concurrent-scripts
|
||||
set -l bun_install_boolean_flags_descriptions "Write a yarn.lock file (yarn v1)" "Don't install devDependencies" "Add dependency to optionalDependencies" "Add dependency to devDependencies" "Don't update package.json or save a lockfile" "Don't install anything" "Always request the latest versions from the registry & reinstall all dependencies" "Ignore manifest cache entirely" "Don't output anything" "Excessively verbose logging" "Use global folder" "Provide a Certificate Authority signing certificate" "The same as --ca, but is a file path to the certificate" "Maximum number of concurrent network requests" "Save a text-based lockfile" "Exclude dev, optional, or peer dependencies from install" "Generate a lockfile without installing dependencies" "Add to trustedDependencies in the project's package.json and install the package(s)" "Maximum number of concurrent jobs for lifecycle scripts (default 5)"
|
||||
|
||||
set -l bun_builtin_cmds_without_run dev create help bun upgrade discord install remove add init pm x
|
||||
set -l bun_builtin_cmds_accepting_flags create help bun upgrade discord run init link unlink pm x
|
||||
@@ -164,7 +164,7 @@ complete -c bun \
|
||||
-n "__fish_seen_subcommand_from add" -d 'History' -a '(__history_completions)'
|
||||
|
||||
complete -c bun \
|
||||
-n "__fish_seen_subcommand_from pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) cache;" -a 'bin ls cache hash hash-print hash-string' -f
|
||||
-n "__fish_seen_subcommand_from pm; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts) cache;" -a 'bin ls cache hash hash-print hash-string audit pack migrate untrusted trust default-trusted whoami version view' -f
|
||||
|
||||
complete -c bun \
|
||||
-n "__fish_seen_subcommand_from pm; and __fish_seen_subcommand_from cache; and not __fish_seen_subcommand_from (__fish__get_bun_bins) (__fish__get_bun_scripts);" -a 'rm' -f
|
||||
@@ -172,7 +172,7 @@ complete -c bun \
|
||||
# Add built-in subcommands with descriptions.
|
||||
complete -c bun -n "__fish_use_subcommand" -a "create" -f -d "Create a new project from a template"
|
||||
complete -c bun -n "__fish_use_subcommand" -a "build bun" --require-parameter -F -d "Transpile and bundle one or more files"
|
||||
complete -c bun -n "__fish_use_subcommand" -a "upgrade" -d "Upgrade Bun"
|
||||
complete -c bun -n "__fish_use_subcommand" -a "upgrade" -d "Upgrade Bun" -x
|
||||
complete -c bun -n "__fish_use_subcommand" -a "run" -d "Run a script or package binary"
|
||||
complete -c bun -n "__fish_use_subcommand" -a "install" -d "Install dependencies from package.json" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "remove" -d "Remove a dependency from package.json" -f
|
||||
@@ -184,3 +184,80 @@ complete -c bun -n "__fish_use_subcommand" -a "pm" -d "Additional package manage
|
||||
complete -c bun -n "__fish_use_subcommand" -a "x" -d "Execute a package binary, installing if needed" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "outdated" -d "Display the latest versions of outdated dependencies" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "publish" -d "Publish your package from local to npm" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "audit" -d "Check installed packages for vulnerabilities" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "info" -d "Display package metadata from the registry" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "exec" -d "Run a shell script directly with Bun" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "patch" -d "Prepare a package for patching" -f
|
||||
complete -c bun -n "__fish_use_subcommand" -a "patch-commit" -d "Generate a patch out of a directory and save it" -f
|
||||
|
||||
# Add explicit completions for missing test flags
|
||||
complete -c bun -n "__fish_seen_subcommand_from test" -l 'timeout' -d 'Set the per-test timeout in milliseconds, default is 5000.'
|
||||
complete -c bun -n "__fish_seen_subcommand_from test" -l 'update-snapshots' -s 'u' -d 'Update snapshot files'
|
||||
complete -c bun -n "__fish_seen_subcommand_from test" -l 'rerun-each' -d 'Re-run each test file <NUMBER> times, helps catch certain bugs'
|
||||
complete -c bun -n "__fish_seen_subcommand_from test" -l 'only' -d 'Only run tests that are marked with test.only()'
|
||||
complete -c bun -n "__fish_seen_subcommand_from test" -l 'todo' -d 'Include tests that are marked with test.todo()'
|
||||
complete -c bun -n "__fish_seen_subcommand_from test" -l 'coverage' -d 'Generate a coverage profile'
|
||||
complete -c bun -n "__fish_seen_subcommand_from test" -l 'coverage-reporter' -d 'Report coverage in text and/or lcov. Defaults to text.'
|
||||
complete -c bun -n "__fish_seen_subcommand_from test" -l 'coverage-dir' -d 'Directory for coverage files. Defaults to coverage.'
|
||||
complete -c bun -n "__fish_seen_subcommand_from test" -l 'bail' -d 'Exit the test suite after <NUMBER> failures. If you do not specify a number, it defaults to 1.'
|
||||
complete -c bun -n "__fish_seen_subcommand_from test" -l 'test-name-pattern' -s 't' -d 'Run only tests with a name that matches the given regex.'
|
||||
complete -c bun -n "__fish_seen_subcommand_from test" -l 'reporter' -d 'Specify the test reporter. Currently --reporter=junit is the only supported format.'
|
||||
complete -c bun -n "__fish_seen_subcommand_from test" -l 'reporter-outfile' -d 'The output file used for the format from --reporter.'
|
||||
|
||||
# Add completions for audit command
|
||||
complete -c bun -n "__fish_seen_subcommand_from audit" -l 'json' -d 'Output in JSON format'
|
||||
|
||||
# Add completions for info command
|
||||
complete -c bun -n "__fish_seen_subcommand_from info" -l 'json' -d 'Output in JSON format'
|
||||
complete -c bun -n "__fish_seen_subcommand_from info" -l 'registry' -d 'Use a specific registry by default, overriding .npmrc, bunfig.toml and environment variables'
|
||||
|
||||
# Add completions for bun build flags
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'production' -d 'Set NODE_ENV=production and enable minification'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'compile' -d 'Generate a standalone Bun executable containing your bundled code. Implies --production'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'bytecode' -d 'Use a bytecode cache'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'watch' -d 'Automatically restart the process on file change'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'no-clear-screen' -d 'Disable clearing the terminal screen on reload when --watch is enabled'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'target' -d 'The intended execution environment for the bundle. "browser", "bun" or "node"'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'outdir' -d 'Default to "dist" if multiple files'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'outfile' -d 'Write to a file'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'sourcemap' -d 'Build with sourcemaps - linked, inline, external, or none'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'minify' -d 'Enable all minification flags'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'minify-syntax' -d 'Minify syntax and inline data'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'minify-whitespace' -d 'Minify whitespace'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'minify-identifiers' -d 'Minify identifiers'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'format' -d 'Specifies the module format to build to. "esm", "cjs" and "iife" are supported. Defaults to "esm".'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'banner' -d 'Add a banner to the bundled output'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'footer' -d 'Add a footer to the bundled output'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'root' -d 'Root directory used for multiple entry points'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'splitting' -d 'Enable code splitting'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'public-path' -d 'A prefix to be appended to any import paths in bundled code'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'entry-naming' -d 'Customize entry point filenames'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'chunk-naming' -d 'Customize chunk filenames'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'asset-naming' -d 'Customize asset filenames'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'react-fast-refresh' -d 'Enable React Fast Refresh transform'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'no-bundle' -d 'Transpile file only, do not bundle'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'emit-dce-annotations' -d 'Re-emit DCE annotations in bundles'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'css-chunking' -d 'Chunk CSS files together to reduce duplicated CSS loaded in a browser'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'conditions' -d 'Pass custom conditions to resolve'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'app' -d 'EXPERIMENTAL: Build a web app for production using Bun Bake'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'server-components' -d 'EXPERIMENTAL: Enable server components'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'env' -d 'Inline environment variables into the bundle as process.env.${name}'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'windows-hide-console' -d 'When using --compile targeting Windows, prevent a Command prompt from opening alongside the executable'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'windows-icon' -d 'When using --compile targeting Windows, assign an executable icon'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'debug-dump-server-files' -d 'When --app is set, dump all server files to disk even when building statically'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'debug-no-minify' -d 'When --app is set, do not minify anything'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'external' -s 'e' -d 'Exclude module from transpilation (can use * wildcards)'
|
||||
complete -c bun -n "__fish_seen_subcommand_from build" -l 'packages' -d 'Add dependencies to bundle or keep them external. "external", "bundle" is supported'
|
||||
|
||||
# Add canary option to upgrade command
|
||||
complete -c bun -n "__fish_seen_subcommand_from upgrade" -l "canary" -d "Upgrade to canary build"
|
||||
|
||||
# Add init command options
|
||||
complete -c bun -n "__fish_seen_subcommand_from init" -s "y" -l "yes" -d "Accept all default options"
|
||||
complete -c bun -n "__fish_seen_subcommand_from init" -s "m" -l "minimal" -d "Only initialize type definitions"
|
||||
complete -c bun -n "__fish_seen_subcommand_from init" -s "r" -l "react" -d "Initialize a React project"
|
||||
complete -c bun -n "__fish_seen_subcommand_from init" -l "react=tailwind" -d "Initialize a React project with TailwindCSS"
|
||||
complete -c bun -n "__fish_seen_subcommand_from init" -l "react=shadcn" -d "Initialize a React project with @shadcn/ui and TailwindCSS"
|
||||
|
||||
# Add patch-commit command options
|
||||
complete -c bun -n "__fish_seen_subcommand_from patch-commit" -l "patches-dir" -d "Directory to save patches in (default: \"patches\")"
|
||||
|
||||
@@ -36,7 +36,17 @@ _bun_add_completion() {
|
||||
'--development[]' \
|
||||
'--optional[Add dependency to "optionalDependencies]' \
|
||||
'--peer[Add dependency to "peerDependencies]' \
|
||||
'--exact[Add the exact version instead of the ^range]' &&
|
||||
'--exact[Add the exact version instead of the ^range]' \
|
||||
'--ca[Provide a Certificate Authority signing certificate]:ca' \
|
||||
'--cafile[The same as --ca, but is a file path to the certificate]:cafile' \
|
||||
'--network-concurrency[Maximum number of concurrent network requests]:network-concurrency' \
|
||||
'--save-text-lockfile[Save a text-based lockfile]' \
|
||||
'--omit[Exclude dev, optional, or peer dependencies from install]:omit:(dev optional peer)' \
|
||||
'--lockfile-only[Generate a lockfile without installing dependencies]' \
|
||||
'--trust[Add to trustedDependencies in the project'"'"'s package.json and install the package(s)]' \
|
||||
'--concurrent-scripts[Maximum number of concurrent jobs for lifecycle scripts (default 5)]:concurrent-scripts' \
|
||||
'--analyze[Analyze & install all dependencies of files passed as arguments recursively (using Bun'"'"'s bundler)]' \
|
||||
'--only-missing[Only add dependencies to package.json if they are not already present]' &&
|
||||
ret=0
|
||||
|
||||
case $state in
|
||||
@@ -260,7 +270,14 @@ _bun_pm_completion() {
|
||||
'hash\:"generate & print the hash of the current lockfile" '
|
||||
'hash-string\:"print the string used to hash the lockfile" '
|
||||
'hash-print\:"print the hash stored in the current lockfile" '
|
||||
'audit\:"run a security audit of dependencies in Bun'"'"'s lockfile"'
|
||||
'cache\:"print the path to the cache folder" '
|
||||
'pack\:"create a tarball of the current workspace" '
|
||||
'migrate\:"migrate another package manager'"'"'s lockfile without installing anything" '
|
||||
'untrusted\:"print current untrusted dependencies with scripts" '
|
||||
'trust\:"run scripts for untrusted dependencies and add to trustedDependencies" '
|
||||
'default-trusted\:"print the default trusted dependencies list" '
|
||||
'whoami\:"print your npm username" '
|
||||
'version\:"bump the version in package.json and create a git tag" '
|
||||
)
|
||||
|
||||
@@ -311,6 +328,7 @@ _bun_pm_completion() {
|
||||
"premajor[increment major version and add pre-release]"
|
||||
"prerelease[increment pre-release version]"
|
||||
"from-git[use version from latest git tag]"
|
||||
"1.2.3[set specific version]"
|
||||
)
|
||||
|
||||
pmargs=(
|
||||
@@ -319,6 +337,7 @@ _bun_pm_completion() {
|
||||
"-m[use the given message for the commit]:message"
|
||||
"--message[use the given message for the commit]:message"
|
||||
"--preid[identifier to prefix pre-release versions]:preid"
|
||||
"--force[bypass dirty git history check]"
|
||||
)
|
||||
|
||||
_arguments -s -C \
|
||||
@@ -376,7 +395,17 @@ _bun_install_completion() {
|
||||
'-D[]' \
|
||||
'--optional[Add dependency to "optionalDependencies]' \
|
||||
'--peer[Add dependency to "peerDependencies]' \
|
||||
'--exact[Add the exact version instead of the ^range]' &&
|
||||
'--exact[Add the exact version instead of the ^range]' \
|
||||
'--ca[Provide a Certificate Authority signing certificate]:ca' \
|
||||
'--cafile[The same as --ca, but is a file path to the certificate]:cafile' \
|
||||
'--network-concurrency[Maximum number of concurrent network requests]:network-concurrency' \
|
||||
'--save-text-lockfile[Save a text-based lockfile]' \
|
||||
'--omit[Exclude dev, optional, or peer dependencies from install]:omit:(dev optional peer)' \
|
||||
'--lockfile-only[Generate a lockfile without installing dependencies]' \
|
||||
'--trust[Add to trustedDependencies in the project'"'"'s package.json and install the package(s)]' \
|
||||
'--concurrent-scripts[Maximum number of concurrent jobs for lifecycle scripts (default 5)]:concurrent-scripts' \
|
||||
'--analyze[Analyze & install all dependencies of files passed as arguments recursively (using Bun'"'"'s bundler)]' \
|
||||
'--only-missing[Only add dependencies to package.json if they are not already present]' &&
|
||||
ret=0
|
||||
|
||||
case $state in
|
||||
@@ -487,7 +516,7 @@ _bun_run_completion() {
|
||||
'--prefer-latest[Use the latest matching versions of packages in bun'"'"'s JavaScript runtime, always checking npm]' \
|
||||
'--silent[Don'"'"'t repeat the command for bun run]' \
|
||||
'--dump-environment-variables[Dump environment variables from .env and process as JSON and quit. Useful for debugging]' \
|
||||
'--dump-limits[Dump system limits. Userful for debugging]' &&
|
||||
'--dump-limits[Dump system limits. Useful for debugging]' &&
|
||||
ret=0
|
||||
|
||||
case $state in
|
||||
@@ -528,34 +557,56 @@ _bun_build_completion() {
|
||||
_arguments -s -C \
|
||||
'1: :->cmd' \
|
||||
'*: :->file' \
|
||||
'--outfile[Write the output to a specific file (default: stdout)]:outfile' \
|
||||
'--outdir[Write the output to a directory (required for splitting)]:outdir' \
|
||||
'--minify[Enable all minification flags]' \
|
||||
'--minify-whitespace[Remove unneeded whitespace]' \
|
||||
'--minify-syntax[Transform code to use less syntax]' \
|
||||
'--minify-identifiers[Shorten variable names]' \
|
||||
'--sourcemap[Generate sourcemaps]: :->sourcemap' \
|
||||
'--production[Set NODE_ENV=production and enable minification]' \
|
||||
'--compile[Generate a standalone Bun executable containing your bundled code. Implies --production]' \
|
||||
'--bytecode[Use a bytecode cache]' \
|
||||
'--watch[Automatically restart the process on file change]' \
|
||||
'--no-clear-screen[Disable clearing the terminal screen on reload when --watch is enabled]' \
|
||||
'--target[The intended execution environment for the bundle. "browser", "bun" or "node"]: :->target' \
|
||||
'--splitting[Whether to enable code splitting (requires --outdir)]' \
|
||||
'--compile[generating a standalone binary from a TypeScript or JavaScript file]' \
|
||||
'--format[Specifies the module format to be used in the generated bundles]: :->format' &&
|
||||
'--outdir[Default to "dist" if multiple files]:outdir' \
|
||||
'--outfile[Write to a file]:outfile' \
|
||||
'--sourcemap[Build with sourcemaps - linked, inline, external, or none]: :->sourcemap' \
|
||||
'--minify[Enable all minification flags]' \
|
||||
'--minify-syntax[Minify syntax and inline data]' \
|
||||
'--minify-whitespace[Minify whitespace]' \
|
||||
'--minify-identifiers[Minify identifiers]' \
|
||||
'--format[Specifies the module format to build to. "esm", "cjs" and "iife" are supported. Defaults to "esm".]: :->format' \
|
||||
'--banner[Add a banner to the bundled output]:banner' \
|
||||
'--footer[Add a footer to the bundled output]:footer' \
|
||||
'--root[Root directory used for multiple entry points]:root' \
|
||||
'--splitting[Enable code splitting]' \
|
||||
'--public-path[A prefix to be appended to any import paths in bundled code]:public-path' \
|
||||
'--entry-naming[Customize entry point filenames]:entry-naming' \
|
||||
'--chunk-naming[Customize chunk filenames]:chunk-naming' \
|
||||
'--asset-naming[Customize asset filenames]:asset-naming' \
|
||||
'--react-fast-refresh[Enable React Fast Refresh transform]' \
|
||||
'--no-bundle[Transpile file only, do not bundle]' \
|
||||
'--emit-dce-annotations[Re-emit DCE annotations in bundles]' \
|
||||
'--css-chunking[Chunk CSS files together to reduce duplicated CSS loaded in a browser]' \
|
||||
'--conditions[Pass custom conditions to resolve]:conditions' \
|
||||
'--app[EXPERIMENTAL: Build a web app for production using Bun Bake]' \
|
||||
'--server-components[EXPERIMENTAL: Enable server components]' \
|
||||
'--env[Inline environment variables into the bundle as process.env.${name}]:env' \
|
||||
'--windows-hide-console[When using --compile targeting Windows, prevent a Command prompt from opening alongside the executable]' \
|
||||
'--windows-icon[When using --compile targeting Windows, assign an executable icon]:windows-icon' \
|
||||
'--debug-dump-server-files[When --app is set, dump all server files to disk even when building statically]' \
|
||||
'--debug-no-minify[When --app is set, do not minify anything]' \
|
||||
'--external[Exclude module from transpilation (can use * wildcards). ex: -e react]:external' \
|
||||
'-e[Exclude module from transpilation (can use * wildcards). ex: -e react]:external' \
|
||||
'--packages[Add dependencies to bundle or keep them external. "external", "bundle" is supported]:packages:(external bundle)' &&
|
||||
ret=0
|
||||
|
||||
case $state in
|
||||
file)
|
||||
_files
|
||||
|
||||
;;
|
||||
target)
|
||||
_alternative 'args:cmd3:((browser bun node))'
|
||||
|
||||
;;
|
||||
sourcemap)
|
||||
_alternative 'args:cmd3:((none external inline))'
|
||||
|
||||
_alternative 'args:cmd3:((none external inline linked))'
|
||||
;;
|
||||
format)
|
||||
|
||||
_alternative 'args:cmd3:((esm cjs iife))'
|
||||
;;
|
||||
esac
|
||||
@@ -664,13 +715,18 @@ _bun_test_completion() {
|
||||
'--watch[Automatically restart bun'"'"'s JavaScript runtime on file change]' \
|
||||
'--timeout[Set the per-test timeout in milliseconds, default is 5000.]:timeout' \
|
||||
'--update-snapshots[Update snapshot files]' \
|
||||
'--rerun-each[Re-run each test file <NUMBER> times, helps catch certain bugs]:rerun' \
|
||||
'-u[Update snapshot files]' \
|
||||
'--rerun-each[Re-run each test file <NUMBER> times, helps catch certain bugs]:rerun-each' \
|
||||
'--only[Only run tests that are marked with "test.only()"]' \
|
||||
'--todo[Include tests that are marked with "test.todo()"]' \
|
||||
'--coverage[Generate a coverage profile]' \
|
||||
'--coverage-reporter[Report coverage in "text" and/or "lcov". Defaults to "text".]:coverage-reporter' \
|
||||
'--coverage-dir[Directory for coverage files. Defaults to "coverage".]:coverage-dir' \
|
||||
'--bail[Exit the test suite after <NUMBER> failures. If you do not specify a number, it defaults to 1.]:bail' \
|
||||
'--test-name-pattern[Run only tests with a name that matches the given regex]:pattern' \
|
||||
'-t[Run only tests with a name that matches the given regex]:pattern' &&
|
||||
'-t[Run only tests with a name that matches the given regex]:pattern' \
|
||||
'--reporter[Specify the test reporter. Currently --reporter=junit is the only supported format]:reporter:(junit)' \
|
||||
'--reporter-outfile[The output file used for the format from --reporter]:reporter-outfile' &&
|
||||
ret=0
|
||||
|
||||
case $state in
|
||||
@@ -724,12 +780,18 @@ _bun() {
|
||||
'remove\:"Remove a dependency from package.json (bun rm)" '
|
||||
'update\:"Update outdated dependencies & save to package.json" '
|
||||
'outdated\:"Display the latest versions of outdated dependencies" '
|
||||
'link\:"Link an npm package globally" '
|
||||
'link\:"Register or link a local npm package" '
|
||||
'unlink\:"Globally unlink an npm package" '
|
||||
'pm\:"More commands for managing packages" '
|
||||
'build\:"Bundle TypeScript & JavaScript into a single file" '
|
||||
'upgrade\:"Get the latest version of bun" '
|
||||
'help\:"Show all supported flags and commands" '
|
||||
'audit\:"Check installed packages for vulnerabilities" '
|
||||
'info\:"Display package metadata from the registry" '
|
||||
'exec\:"Run a shell script directly with Bun" '
|
||||
'publish\:"Publish a package to the npm registry" '
|
||||
'patch\:"Prepare a package for patching" '
|
||||
'patch-commit\:"Generate a patch out of a directory and save it" '
|
||||
)
|
||||
main_commands=($main_commands)
|
||||
_alternative "$scripts" "args:command:(($main_commands))" "files:files:(($files_list))"
|
||||
@@ -804,6 +866,19 @@ _bun() {
|
||||
_bun_test_completion
|
||||
|
||||
;;
|
||||
audit)
|
||||
_arguments -s -C \
|
||||
'1: :->cmd' \
|
||||
'--json[Output in JSON format]' &&
|
||||
ret=0
|
||||
;;
|
||||
patch-commit)
|
||||
_arguments -s -C \
|
||||
'1: :->cmd' \
|
||||
'*: :->directory' \
|
||||
'--patches-dir[Directory to save patches in (default: "patches")]:patches-dir' &&
|
||||
ret=0
|
||||
;;
|
||||
help)
|
||||
# ---- Command: help
|
||||
_arguments -s -C \
|
||||
@@ -887,6 +962,19 @@ _bun() {
|
||||
_bun_test_completion
|
||||
|
||||
;;
|
||||
audit)
|
||||
_arguments -s -C \
|
||||
'1: :->cmd' \
|
||||
'--json[Output in JSON format]' &&
|
||||
ret=0
|
||||
;;
|
||||
patch-commit)
|
||||
_arguments -s -C \
|
||||
'1: :->cmd' \
|
||||
'*: :->directory' \
|
||||
'--patches-dir[Directory to save patches in (default: "patches")]:patches-dir' &&
|
||||
ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
;;
|
||||
|
||||
@@ -1,226 +0,0 @@
|
||||
---
|
||||
name: bun
|
||||
appspec: { version: "0.001" }
|
||||
plugins: [-Meta]
|
||||
title: A tool for installing and managing JavaScript packages
|
||||
|
||||
options:
|
||||
- version|V --Show version and exit
|
||||
- name: cwd
|
||||
type: string
|
||||
summary: "Change directory"
|
||||
|
||||
# subcommands:
|
||||
# bun:
|
||||
|
||||
subcommands:
|
||||
run:
|
||||
summary: Run a script or package bin
|
||||
parameters:
|
||||
- name: script
|
||||
multiple: false
|
||||
completion:
|
||||
command_string: >
|
||||
SHELL=zsh bun getcompletes r
|
||||
|
||||
options:
|
||||
- silent --Don't echo the command
|
||||
|
||||
create:
|
||||
summary: Create a new project
|
||||
subcommands:
|
||||
next:
|
||||
summary: "Next.js app"
|
||||
parameters:
|
||||
- name: file
|
||||
multiple: false
|
||||
type: file
|
||||
required: true
|
||||
|
||||
react:
|
||||
summary: "React app"
|
||||
parameters:
|
||||
- name: file
|
||||
multiple: false
|
||||
type: file
|
||||
required: true
|
||||
|
||||
bun:
|
||||
summary: Generate a bundle
|
||||
parameters:
|
||||
- name: file
|
||||
multiple: true
|
||||
type: file
|
||||
required: false
|
||||
options:
|
||||
- name: use
|
||||
type: string
|
||||
summary: Use a framework, e.g. "next"
|
||||
|
||||
upgrade:
|
||||
summary: Upgrade to the latest version of bun
|
||||
|
||||
dev:
|
||||
summary: Start a dev server
|
||||
options:
|
||||
- name: bunfile
|
||||
type: string
|
||||
summary: "Use a specific .bun file (default: node_modules.bun)"
|
||||
|
||||
- name: origin
|
||||
type: string
|
||||
summary: "Rewrite import paths to start from a different url. Default: http://localhost:3000"
|
||||
|
||||
- name: u
|
||||
type: string
|
||||
summary: "Rewrite import paths to start from a different url. Default: http://localhost:3000"
|
||||
|
||||
- name: server-bunfile
|
||||
type: string
|
||||
summary: "Use a specific .bun file for SSR in bun dev (default: node_modules.server.bun)"
|
||||
- name: env-file
|
||||
type: string
|
||||
summary: "Load environment variables from the specified file(s)"
|
||||
- name: extension-order
|
||||
type: string
|
||||
summary: "defaults to: .tsx,.ts,.jsx,.js,.json"
|
||||
- name: "jsx-runtime"
|
||||
type: string
|
||||
enum: ["automatic", "classic"]
|
||||
summary: 'JSX runtime to use. Defaults to "automatic"'
|
||||
- name: main-fields
|
||||
type: string
|
||||
summary: Main fields to lookup in package.json. Defaults to --platform dependent
|
||||
- disable-react-fast-refresh --Disable React Fast Refresh
|
||||
- disable-hmr --Disable Hot Module Reloading
|
||||
- &jsx_factory name: jsx-factory
|
||||
type: string
|
||||
summary: "Changes the function called when compiling JSX elements using the classic JSX runtime"
|
||||
- &jsx_fragment name: jsx-fragment
|
||||
type: string
|
||||
summary: "Changes the function called when compiling JSX fragments"
|
||||
- &jsx_import_source name: jsx-import-source
|
||||
type: string
|
||||
summary: 'Declares the module specifier to be used for importing the jsx and jsxs factory functions. Default: "react"'
|
||||
- &port name: port
|
||||
type: int
|
||||
summary: Port number
|
||||
install:
|
||||
summary: Install packages from package.json
|
||||
options:
|
||||
- name: registry
|
||||
type: string
|
||||
summary: "Change default registry (default: $BUN_CONFIG_REGISTRY || $npm_config_registry)"
|
||||
- name: token
|
||||
type: string
|
||||
summary: "Authentication token used for npm registry requests (default: $npm_config_token)"
|
||||
- y -- "Write a yarn.lock file (yarn v1)"
|
||||
- yarn -- "Write a yarn.lock file (yarn v1)"
|
||||
- production -- "Don't install devDependencies"
|
||||
- p -- "Don't install devDependencies"
|
||||
- frozen-lockfile -- "Disallow changes to lockfile"
|
||||
- no-save --
|
||||
- dry-run -- "Don't install anything"
|
||||
- force -- "Always request the latest versions from the registry & reinstall all dependencies"
|
||||
- name: cache-dir
|
||||
type: string
|
||||
summary: "Store & load cached data from a specific directory path"
|
||||
- no-cache -- "Ignore manifest cache entirely"
|
||||
- silent -- "Don't output anything"
|
||||
- verbose -- "Excessively verbose logging"
|
||||
- name: cwd
|
||||
type: string
|
||||
summary: "Set a specific cwd"
|
||||
- name: backend
|
||||
summary: "Platform-specific optimizations for installing dependencies"
|
||||
type: string
|
||||
enum: ["clonefile", "copyfile", "hardlink", "clonefile_each_dir"]
|
||||
- name: link-native-bins
|
||||
summary: 'Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo'
|
||||
add:
|
||||
summary: Add a dependency to package.json
|
||||
options:
|
||||
- name: registry
|
||||
type: string
|
||||
summary: "Change default registry (default: $BUN_CONFIG_REGISTRY || $npm_config_registry)"
|
||||
- name: token
|
||||
type: string
|
||||
summary: "Authentication token used for npm registry requests (default: $npm_config_token)"
|
||||
- y -- "Write a yarn.lock file (yarn v1)"
|
||||
- yarn -- "Write a yarn.lock file (yarn v1)"
|
||||
- production -- "Don't install devDependencies"
|
||||
- optional -- "Add dependency to optionalDependencies"
|
||||
- development -- "Add dependency to devDependencies"
|
||||
- d -- "Add dependency to devDependencies"
|
||||
- p -- "Don't install devDependencies"
|
||||
- frozen-lockfile -- "Disallow changes to lockfile"
|
||||
- no-save --
|
||||
- dry-run -- "Don't install anything"
|
||||
- force -- "Always request the latest versions from the registry & reinstall all dependencies"
|
||||
- no-cache -- "Ignore manifest cache entirely"
|
||||
- silent -- "Don't output anything"
|
||||
- verbose -- "Excessively verbose logging"
|
||||
- name: cache-dir
|
||||
type: string
|
||||
summary: "Store & load cached data from a specific directory path"
|
||||
|
||||
- name: cwd
|
||||
type: string
|
||||
summary: "Set a specific cwd"
|
||||
- name: backend
|
||||
summary: "Platform-specific optimizations for installing dependencies"
|
||||
type: string
|
||||
enum: ["clonefile", "copyfile", "hardlink", "clonefile_each_dir"]
|
||||
- name: link-native-bins
|
||||
summary: 'Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo'
|
||||
parameters:
|
||||
- name: package
|
||||
multiple: true
|
||||
type: string
|
||||
required: true
|
||||
remove:
|
||||
summary: Remove a dependency from package.json
|
||||
options:
|
||||
- name: registry
|
||||
type: string
|
||||
summary: "Change default registry (default: $BUN_CONFIG_REGISTRY || $npm_config_registry)"
|
||||
- name: token
|
||||
type: string
|
||||
summary: "Authentication token used for npm registry requests (default: $npm_config_token)"
|
||||
- y -- "Write a yarn.lock file (yarn v1)"
|
||||
- yarn -- "Write a yarn.lock file (yarn v1)"
|
||||
- production -- "Don't install devDependencies"
|
||||
- p -- "Don't install devDependencies"
|
||||
- frozen-lockfile -- "Disallow changes to lockfile"
|
||||
- no-save --
|
||||
- dry-run -- "Don't install anything"
|
||||
- force -- "Always request the latest versions from the registry & reinstall all dependencies"
|
||||
- name: cache-dir
|
||||
type: string
|
||||
summary: "Store & load cached data from a specific directory path"
|
||||
- no-cache -- "Ignore manifest cache entirely"
|
||||
- silent -- "Don't output anything"
|
||||
- verbose -- "Excessively verbose logging"
|
||||
- name: cwd
|
||||
type: string
|
||||
summary: "Set a specific cwd"
|
||||
- name: backend
|
||||
summary: "Platform-specific optimizations for installing dependencies"
|
||||
type: string
|
||||
enum: ["clonefile", "copyfile", "hardlink", "clonefile_each_dir"]
|
||||
- name: link-native-bins
|
||||
summary: 'Link "bin" from a matching platform-specific dependency instead. Default: esbuild, turbo'
|
||||
parameters:
|
||||
- name: package
|
||||
multiple: true
|
||||
type: string
|
||||
required: true
|
||||
|
||||
parameters:
|
||||
- name: sasdasdds
|
||||
completion:
|
||||
command_string: >
|
||||
SHELL=zsh bun getcompletes r
|
||||
|
||||
# vim:et:sts=2:sws=2:sw=2:foldmethod=indent
|
||||
|
||||
Reference in New Issue
Block a user