npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@roottale/cms-media

v0.79.1

Published

RootTale 미디어 — R2 원본 보관 + CF Images variants + 한글 파일명 정규화 + CfImage 렌더 컴포넌트(@roottale/cms-media/react). ADR-0034 §3 / docs/image-standard.md.

Readme

@roottale/cms-media

RootTale 미디어 패키지 — R2 원본 보관 + CF Images variants + 한글 파일명 정규화 + CfImage 렌더 컴포넌트. (ADR-0034 §3, docs/image-standard.md)

엔트리:

  • @roottale/cms-media — 서버(R2/S3 클라이언트, variant URL 생성, 파일명 정규화). Node.
  • @roottale/cms-media/react — RootTaleImage·기존 CfImage 렌더 컴포넌트("use client"). react는 optional peer.
  • @roottale/cms-media/delivery — React·R2/S3 클라이언트 없는 서버/브라우저 공용 표시 주소 처리.

RootTaleImage (@roottale/cms-media/react)

사이트 공용 기본 이미지 컴포넌트다. 추가 래퍼·CSS·로더를 만들지 않고 네이티브 img를 출력한다. 기존 CfImage와 default export는 호환성을 위해 유지한다.

import { RootTaleImage } from "@roottale/cms-media/react";

<RootTaleImage src={coverUrl} alt="시설 사진" width={800} height={556}
  sizes="(max-width: 880px) calc(100vw - 36px), 840px" priority />
  • CF 공개 주소는 폭 후보·품질 75·fit=scale-down으로 브라우저가 직접 받는다. 해당 계정의 Flexible variants를 활성화해야 한다. 알려진 원본 폭과 최대 후보 폭까지 요청하고 자르기·확대는 하지 않는다.
  • src는 문자열 또는 { src, width, height } 정적 import 메타데이터다. ref는 실제 img를 가리킨다. fill·sizes·style·네이티브 이벤트·접근성 속성을 유지한다.
  • 기본 lazy/async, priority는 eager/high, preload는 React 19의 반응형 미리 읽기를 사용한다. React 18.3에서는 eager/high로 처리한다.
  • accountHash로 사이트 계정만 변환할 수 있다. SVG/GIF·서명 URL·미등록 R2/외부 주소는 그대로 표시한다. 콘텐츠의 신규 등록·CMS 쓰기는 이 컴포넌트의 책임이 아니다.
  • fallbackSrc는 CF 오류 때 한 번 표시할 R2/로컬 원본이다. 없으면 src를 사용한다. 대체도 실패하면 기존 onError로 이어지며 새 src는 다시 시도한다. picture의 data-image-fallback-src/data-original-image-src도 복원한다.
  • 커스텀 srcSet은 그대로 유지한다. 사이트가 미리 계산한 imageAttributes는 이를 우선하며 화면에 넘길 최적화 결과만 받는다.

등록된 R2·정적 파일은 사이트가 매핑을 소유한다. 원본 CMS 데이터·주소·바이트는 유지하고, 공용 헬퍼로 표시 속성만 계산한다. 전체 본문 매핑을 브라우저에 넣지 않도록 서버에서도 같은 헬퍼를 사용할 수 있다.

import { createImageDelivery } from "@roottale/cms-media/delivery";
import { RootTaleImage } from "@roottale/cms-media/react";

const images = createImageDelivery({
  accountHash: "사이트 CF account hash",
  registry: registeredAssets, // 정확한 원본 주소 → { delivery, original, width, height }
  assetOrigins: ["https://site.example"],
});

<RootTaleImage src={originalUrl} alt="시설 사진"
  imageAttributes={images.imageAttributes(originalUrl, "800px")}
  fallbackSrc={images.imageFallback(originalUrl)} />

매핑은 다른 CF 계정으로 넘어가지 않으며, 등록되지 않은 원본 주소를 추측하지 않는다. createImageDelivery는 업로드·네트워크·환경 변수 접근이 없는 순수 URL 처리다. 공용 패키지에 고객 이미지 목록을 넣지 않는다. next/image와 /_next/image를 사용하지 않는다.

CfImage (@roottale/cms-media/react)

next/image 대체. CF Images는 이미 variant(sm/md/lg, 자동 webp/avif)를 제공하므로 브라우저가 직접 받게 한다 → Vercel 이미지 최적화 함수(/_next/image, Fluid Compute) 비용 0.

import { CfImage } from "@roottale/cms-media/react";

<div style={{ position: "relative", height: 160 }}>
  <CfImage src={coverUrl} alt="단지 조감도" fill sizes="(max-width:600px) 100vw, 400px" />
</div>
  • CF imagedelivery URL이면 sm/md/lg srcset 자동, 기본 src /md. 비-CF(로컬 SVG·외부)면 변형 없이 그대로.
  • placeholder(로더): 'blur'(기본) | 'skeleton'(shimmer) | 'image' | 'none'. 로딩 중 표시 후 onLoad 페이드인.
    • 'blur'(CF): skeleton shimmer를 즉시 깔아 마운트 순간부터 로딩을 인지시키고, CF thumbnail이 받아지는 순간 그 위로 흐림을 페이드인 → 원본 도착 시 둘 다 페이드아웃. (blur 썸네일도 네트워크라 받기 전 빈 화면 갭을 skeleton이 메움. CF가 아니면 skeleton 단독.)
    • 'image' + loaderImage="<url>": 로딩 중 가운데 커스텀 이미지(브랜드 스피너/로고 등).
    • loader={<MySpinner/>}: 임의 ReactNode를 로더로 직접 주입(최우선). loaderBackground로 배경색 지정.
  • priority로 LCP 즉시 로드. fill/sizes/width/height/loading/onError/style 등 next/image·<img> 호환.
  • "use client" — 서버 컴포넌트에서도 직접 렌더 가능(자체 클라이언트 경계).

import Image from "@roottale/cms-media/react"(default)로 받아 기존 next/image 호출부를 그대로 두는 drop-in 교체도 가능.

서버 헬퍼 (@roottale/cms-media)

  • variantUrl(config, imageId, variant) / allVariantUrls — image id 기반 variant URL.
  • cfImageVariant(url, variant) / cfImageSrcSet(url) / isCfImageUrl(url) — full delivery URL 변형 교체(렌더용, server/client 공용).
  • r2KeyForTenant, normalizeFilename, R2/S3 클라이언트 인터페이스 — 업로드(R2 원본 → CF Images upload-via-URL) 구현용.

변형명/픽셀: thumbnail 96 · sm 320 · md 768 · lg 1600 (ADR-0034 §7.1.1).

원본 보존과 백업 관측

createMediaArchiveClient의 v1 preserve·findSource·verify·tombstone은 실제 원격 암호문 readback을 확인하는 업로드·삭제 경계다. 기존 ArchiveReceipt version 1은 유지한다.

선택 메서드 evidence와 reconcileSource는 운영 백업의 v2 관측 전용이다. evidence는 최대 10,000개 source의 캐시 증거를 배치 조회하고, reconcileSource는 별도 scrub에서 source/receipt와 불변 객체 identity를 확인한다. ArchiveIdentityProof의 byteVerifiedAt과 identityCheckedAt은 서로 다른 검사 시각이다. 누락·만료 관측은 미검증으로 취급하며 이 증거를 미디어 참조 확정이나 삭제 승인에 사용하지 않는다. 선택 필드 lastAttemptAt은 gateway가 source 재대조 시도를 끝낸 시각을 canonical ISO 문자열로 전달하는 스케줄링 힌트다. 성공·누락·만료 응답 모두에 사용할 수 있으며 검증 성공이나 proof의 최신성을 뜻하지 않는다. 이 필드가 없는 기존 v2 응답도 허용한다. reconcileSource는 최대 3회 읽기 시도를 재시도 대기까지 포함한 총 60초 안에서 수행한다. 각 시도는 남은 시간만 사용하며, 최초 60초 제한은 gateway의 55초 작업 제한보다 길다. 이 제한은 v1 조회·보존 요청의 기존 시간 제한과 재시도 계약을 바꾸지 않는다. 운영 주기·배포 순서는 백업 실행기 문서를 따른다.