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

@sano1023/rs-qrcode

v0.1.2

Published

QRコード/バーコード生成(依存ゼロ・SVG/PNG・300dpi・ロゴ・ラベル・連番・CSV一括)

Readme

配布版(ビルド済み) — 本パッケージはビルド済みファイルのみを含みます。 利用は無償(商用可)ですが、改変・再配布はできません(LICENSE.txt 参照)。 機能追加・改修のご依頼は有償で承ります → https://parelabo.com ([email protected])

インストール

npm install @sano1023/rs-qrcode

npmjs.com の公開パッケージです。ログインやトークンは不要です。 更新・旧レジストリからの移行の詳細は 共通インストール手順 を参照してください。登録済みバージョンは npm で確認できます。以下のパッケージ名による import は Vite などのバンドラ向けです。

npm install https://github.com/sano1023/rs-package/raw/main/tarballs/rs-qrcode-0.1.2.tgz

使い方

バニラ JS(ESM・バンドラあり)

import { createRSQR } from '@sano1023/rs-qrcode';

createRSQR('https://example.com', { /* オプション */ });

<script> タグ(CDN・ビルド環境不要)

<script src="https://cdn.jsdelivr.net/npm/@sano1023/[email protected]/dist/rs-qrcode.min.js"></script>
<script>
  // 公開APIはグローバル RSQrcode に載る
  RSQrcode.createRSQR('https://example.com', { /* オプション */ });
</script>

Vue 3

import { RsQrCode, RsBarcode } from '@sano1023/rs-qrcode/vue';
<template>
  <RsQrCode />
</template>

React 18 / 19

import { RsQrCode, RsBarcode } from '@sano1023/rs-qrcode/react';

export default function App() {
  return <RsQrCode />;
}

vue / react は peerDependency です(バンドルには含みません)。アプリ側のものが使われます。


rs-qrcode

QRコード/バーコード生成ライブラリ。エンコーダは仕様(ISO 18004 / GS1)どおりのフルスクラッチで、依存ゼロ・ビルド不要・ESモジュール。ラベル印刷までこれ1つで完結します。

  • QR生成: バイトモード(UTF-8・日本語OK)・バージョン1〜10自動選択・誤り訂正 L/M/Q/H・8マスクのペナルティ評価。GF(256) Reed-Solomon・BCH形式/バージョン情報まで自前実装
  • バーコード生成: CODE128(数字はサブセットCへ自動切替・チェックサム自動)/ EAN-13(チェックデジット自動計算・13桁入力なら検証)
  • SVG出力 / PNG出力: PNGは dpi指定で pHYs チャンクを埋め込み({dpi: 300} で印刷ソフトが300dpiとして扱える)
  • ロゴ埋め込み(中央・角丸白フチ付き。指定すると誤り訂正を自動でHに昇格するので実機カメラでも読める。任意の画像URL/File/canvasを渡せる)/ ラベル(コード下のテキスト)/ 余白・色(背景 transparent 可)
  • 連番生成・CSV一括生成(ラベルシート印刷のデモつき)
  • 検証: 生成したQRを jsQR(テスト専用)で実デコードして入力と一致することを確認済み

デモ

# このリポジトリで
php -S localhost:8099
# → http://localhost:8099/rs-qrcode/demo/ を開く

クイックスタート

import { createRSQR, createRSBarcode } from '@sano1023/rs-qrcode';

// QR
const qr = createRSQR('https://example.com/products/12345', {
    ecLevel: 'M',          // L / M / Q / H(ロゴ入りは H 推奨)
    margin: 4,             // 余白(モジュール単位)
    dark: '#000000',
    light: '#ffffff',      // 'transparent' 可
    label: '商品12345',     // コード下のテキスト
});
document.body.innerHTML += qr.toSVG({ size: 240 });
const canvas = await qr.toCanvas({ scale: 8 });
const blob = await qr.toPNG({ dpi: 300, scale: 12 });   // 印刷用300dpi PNG

// ロゴ入り(ECは自動でHに昇格・画像はURL/File/canvas何でも)
createRSQR('https://example.com', { logo: '/logo.png', logoScale: 0.2 });

// バーコード
const bc = createRSBarcode('RS-2026-0001', { type: 'code128', barHeight: 60 });
const ean = createRSBarcode('490123456789', { type: 'ean13' });  // チェックデジット自動

一括生成

import { makeSequence, batchFromCSV } from '@sano1023/rs-qrcode';

// 連番: ['RS-0001', 'RS-0002', ...]
const codes = makeSequence({ prefix: 'RS-', start: 1, count: 50, digits: 4 });

// CSV(1列目=データ・2列目=ラベル。引用符・カンマ対応)
const items = batchFromCSV('A-1001,りんご\nA-1002,みかん', { ecLevel: 'M' });
for (const { data, label, item } of items) {
    sheet.innerHTML += item.toSVG({ size: 120 });   // ラベルシートに並べて window.print()
}
// バーコードで一括: batchFromCSV(csv, { type: 'code128' })

API

createRSQR(data, options) → { toSVG, toCanvas, toPNG, toDataURL, matrix, version, size, ecLevel, mask }

| オプション | 既定値 | 説明 | | --- | --- | --- | | ecLevel | 'M' | 誤り訂正 'L'(7%) / 'M'(15%) / 'Q'(25%) / 'H'(30%)。logo指定時はHに自動昇格(forceEcLevel で上書き可・非推奨) | | margin | 4 | 余白(モジュール単位。仕様推奨は4) | | dark / light | 黒 / 白 | 色。light: 'transparent' で背景透過 | | size / scale | — | 出力サイズ(px目安)/ モジュールあたりのpx | | logo / logoScale | — / 0.2 | 中央ロゴ(URL・HTMLImage・canvas)と比率(QR本体基準・上限0.3にクランプ) | | label | — | コード下のテキスト | | version | 自動 | バージョン強制(1〜10) |

toPNG({ dpi }): dpi 指定で pHYs チャンク(物理解像度)を埋め込んだ PNG Blob を返す。

createRSBarcode(data, options)

type: 'code128'(既定・ASCII 32〜126、数字のみ偶数桁はサブセットC)/ 'ean13'(12桁数字→チェックデジット付与)。barHeight / quiet(クワイエットゾーン・既定10)/ showText: false / label / 色 / scale。

バッチ

makeSequence({prefix, suffix, start, count, digits}) / batchFromCSV(csvText, options) / parseCSV(text)

制限(v0.1)

  • QRはバイトモードのみ(数字/英数字モードの容量最適化は未対応)・バージョン10まで(約270バイト・URL/シリアル用途は十分)
  • バーコードは CODE128 / EAN-13(ITF・CODE39 は将来)
  • ロゴの logoScale は 0.25 以下推奨(0.3で強制クランプ・ECは自動でH)

検証

Playwright(Chromium)21項目。生成したQRは jsQR で実デコードし、ASCII・URL・日本語UTF-8・長文(v5+)・全ECレベル・ロゴ入り・CSV一括分まで入力と一致することを確認。CODE128 はパターン表の全行幅合計・チェックサム・既知値列、EAN-13 は95モジュール・ガード・チェックデジット、PNG は pHYs チャンクのバイト検査で確認済み。

ライセンス

MIT