Netlify's zip-it-and-ship-it tool handles the process of finding all files used by a deployed function, including those referenced with dynamic expressions, by recursively marking each required file and discarding any unused ones. To make this work, Netlify has integrated esbuild's plugin API to intercept and transform references with dynamic expressions, allowing for zero-configuration deployment of functions that reference external files based on runtime conditions. This can be achieved through manual configuration using the included_files property in netlify.toml or by opting-in to esbuild's bundler for automatic inclusion.