@shopify/shop-minis-react
Version:
React component library for Shopify Shop Minis with Tailwind CSS v4 support (source-only, requires TypeScript)
31 lines (26 loc) • 842 B
JavaScript
/**
* Shared patterns for asset path detection rules
* @fileoverview Regex patterns for detecting asset file extensions and path types
*/
// Asset file extensions to detect
const ASSET_EXTENSIONS = /\.(png|jpe?g|gif|svg|webp|ico|bmp|avif)$/i
// Patterns that indicate a local path (not a remote URL)
const LOCAL_PATH_PATTERNS = [
/^\.?\//, // Starts with / or ./
/^\.\.\//, // Starts with ../
/\/src\//i, // Contains /src/
/\/assets\//i, // Contains /assets/
/\/images?\//i, // Contains /image/ or /images/
/\/public\//i, // Contains /public/
]
// Patterns that indicate a remote URL or data URL (should be allowed)
const REMOTE_PATTERNS = [
/^https?:\/\//i, // http:// or https://
/^data:/i, // data: URLs
/^blob:/i, // blob: URLs
]
module.exports = {
ASSET_EXTENSIONS,
LOCAL_PATH_PATTERNS,
REMOTE_PATTERNS,
}