This package provides a Command Line Interface (CLI) utility designed to compile and bundle Google's official `libphonenumber` JavaScript port into a single, standalone JavaScript file. Unlike modern alternatives like `libphonenumber-js` which are independent rewrites, this tool directly uses the original Closure-compiled JavaScript output from Google's project, aiming for a faithful reproduction of its full functionality, including its potentially larger footprint and reliance on Closure's API patterns. The current stable version, 0.4.0, has not seen updates in over two years, indicating a maintenance status for the bundler tool itself, although it can fetch recent versions of the upstream `libphonenumber` source code. Its key differentiator is simplifying the process of obtaining a self-contained, official `libphonenumber` bundle without requiring a complex build setup, making it suitable for projects that prefer a direct script inclusion or a CommonJS module of the original Google library rather than a streamlined rewrite.
npm install libphonenumber-bundlerVerified import paths — ran on the pinned version, not inferred.
Demonstrates global installation, listing available `libphonenumber` versions, bundling a specific version, and basic browser usage of the generated file.
Consider alternatives like `libphonenumber-js` (a modern rewrite) or `google-libphonenumber` (another pre-compiled bundle) if active maintenance and a smaller footprint are critical. If using this bundler, ensure you regularly re-bundle with the latest `libphonenumber` upstream version.
Be aware of the file size implications, especially in browser environments. For smaller bundles or more idiomatic JavaScript APIs, evaluate `libphonenumber-js` as an alternative. Understand that the API exposed by the bundled file will follow Google's Closure patterns (e.g., `libphonenumber.PhoneNumberUtil.getInstance()`) rather than direct class instantiations.
Integrate the `lpn-bundler bundle` command into a regular build or deployment pipeline to ensure the bundled `libphonenumber.js` file uses the most current metadata available from the upstream project.
For projects using bundlers like Webpack or Rollup, you might need to manually wrap the generated file or configure your bundler to handle global-exposed libraries correctly. If strict ESM imports are required, consider a library like `libphonenumber-js` which provides native ESM support.
Install the package globally using `npm install -g libphonenumber-bundler` or ensure your shell's PATH includes `$(npm bin)`.
Run `lpn-bundler list` to see all available versions and use one from the displayed list. Ensure you have network connectivity to GitHub.
In a browser, ensure the generated `libphonenumber.js` script is loaded *before* your code attempts to use `libphonenumber.PhoneNumberUtil`. In Node.js, ensure you are correctly requiring the file and accessing the `PhoneNumberUtil` export (e.g., `const { PhoneNumberUtil } = require('./libphonenumber.js');`).No dependency data recorded yet.