tailwindcss-forms-bundler

raw JSON →
1.4.11 verified Sat Apr 25 auth: no javascript

tailwindcss-forms-bundler is a Node.js library for fetching resources from various icon CDN providers, including Cloudflare, Fastly, KeyCDN, Akamai, Amazon CloudFront, and Gcore. It supports fetching icons, images, content, JavaScript, and JSON files. Version 1.4.11 is the latest stable release. The library offers a simple API with a single function, setDefault, to fetch resources. Compared to similar libraries, it provides a unified interface for multiple CDN providers. Note: the npm package name and GitHub repo appear mismatched (fastify-bundler vs tailwindcss-forms-bundler), suggesting possible typosquatting.

error TypeError: setDefault is not a function
cause Using default import instead of named import.
fix
Use named import: import { setDefault } from 'tailwindcss-forms-bundler'
error Cannot find module 'fastify-bundler'
cause npm package name is 'fastify-bundler' but code requires 'tailwindcss-forms-bundler'.
fix
Install the correct package: npm install fastify-bundler, then require it as 'fastify-bundler'.
error Error: Provider 'cloudflare' not supported
cause Invalid provider name or unsupported provider.
fix
Check supported providers: cloudflare, fastly, keycdn, akamai, amazon-cloudfront, gcore
gotcha Package naming inconsistency: npm package is 'fastify-bundler' but README uses 'tailwindcss-forms-bundler'. Possible typosquatting or malicious package.
fix Verify the package's origin and integrity before using. Check the GitHub repository linked in README.
breaking The 'setDefault' function is the only exported function, but documentation mentions 'fetchIconProvider' which may not exist.
fix Use 'setDefault' instead of 'fetchIconProvider' as the correct API.
deprecated CommonJS require() may be deprecated in future versions; consider switching to ESM imports.
fix Use 'import { setDefault } from 'tailwindcss-forms-bundler'' with ESM.
npm install fastify-bundler
yarn add fastify-bundler
pnpm add fastify-bundler

Demonstrates how to require and use the setDefault function to fetch an icon from the Cloudflare CDN provider.

const { setDefault } = require('tailwindcss-forms-bundler');

setDefault(
  "cloudflare",
  "icon",
  "your-token",
  "https://your-base-url.com"
)
  .then((data) => {
    console.log("Resource data:", data);
  })
  .catch((error) => {
    console.error("Error fetching resource:", error);
  });