A pure JavaScript QRCode encode and decode library.

Overview

QRCode

A pure JavaScript QRCode encode and decode library.

NPM Version Download Status Tree Shakeable Side Effect Snyk Vulnerabilities License

QRCode guide and demo

QRCode guide

QRCode example

QRCode example use worker

Modify from kazuhikoarase/qrcode-generator and cozmo/jsQR

Usage

Encoder

import { Encoder, QRByte, QRKanji, ErrorCorrectionLevel } from '@nuintun/qrcode';

const qrcode = new Encoder();

qrcode.setEncodingHint(true);
qrcode.setErrorCorrectionLevel(ErrorCorrectionLevel.H);

qrcode.write('你好世界\n');
qrcode.write(new QRByte('hello world\n'));
qrcode.write(new QRKanji('こんにちは世界'));

qrcode.make();

console.log(qrcode.toDataURL());
Constructor
  • new Encoder(options?: Options): Encoder

    • version?: number;
    • encodingHint?: boolean;
    • errorCorrectionLevel?: ErrorCorrectionLevel;
Methods
  • getMatrix(): boolean[][]

    • Get qrcode modules matrix.
  • getMatrixSize(): number

    • Get qrcode modules matrix size.
  • setVersion(version: number): Encoder

    • Set qrcode version, if set 0 the version will be set automatically.
  • getVersion(): number

    • Get qrcode version.
  • setErrorCorrectionLevel(errorCorrectionLevel: ErrorCorrectionLevel): Encoder

    • Set qrcode error correction level.
  • getErrorCorrectionLevel(): ErrorCorrectionLevel

    • Get qrcode error correction level.
  • setEncodingHint(encodingHint: boolean): Encoder

    • Set qrcode encoding hint, it will add ECI in qrcode.
  • getEncodingHint(): boolean

    • Get qrcode encoding hint.
  • write(data: string | QRByte | QRKanji | QRNumeric | QRAlphanumeric): Encoder

    • Add qrcode data, if string will use QRByte by default.
  • isDark(row: number, col: number): boolean

    • Get byte with row and col.
  • make(): Encoder

    • Make qrcode matrix.
  • toDataURL(moduleSize?: number, margin?: number): string

    • Output qrcode base64 gif image.
  • clear(): void

    • Clear written data.
Custom ECI
import { Encoder, QRByte } from '@nuintun/qrcode';

const qrcode = new Encoder();

qrcode.setEncodingHint(true);

// Custom your own encode function return bytes and encoding
// The encoding value must a valid ECI value
// Custom ECI only support QRByte mode
// https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/common/CharacterSetECI.java
qrcode.write(
  new QRByte('hello world', data => ({
    encoding: 26,
    bytes: [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
  }))
);

qrcode.make();

console.log(qrcode.toDataURL());

Decoder

import { Decoder } from '@nuintun/qrcode';

const qrcode = new Decoder();

qrcode
  .scan('https://nuintun.github.io/qrcode/examples/qrcode.jpg')
  .then(result => {
    console.log(result.data);
  })
  .catch(error => {
    console.error(error);
  });
Constructor
  • new Decoder(options?: Options): Decoder

    • canOverwriteImage?: boolean
    • inversionAttempts?: 'dontInvert' | 'onlyInvert' | 'attemptBoth' | 'invertFirst'
    • greyScaleWeights?: { red: number, green: number, blue: number, useIntegerApproximation?: boolean }
Methods
  • setOptions(options: Options): Decoder

    • Set decode options.
      • canOverwriteImage?: boolean
      • inversionAttempts?: 'dontInvert' | 'onlyInvert' | 'attemptBoth' | 'invertFirst'
      • greyScaleWeights?: { red: number, green: number, blue: number, useIntegerApproximation?: boolean }
  • scan(src: string): Promise<DecoderResult>

    • Decode a qrcode from image src.
    • Notice: support browser environment only.
  • decode(data: Uint8ClampedArray, width: number, height: number): DecoderResult

    • Decode a qrcode from image data.
Comments
  • 在小程序里用了这个qrcode.decode(result.data, 100, 100)方法报错

    在小程序里用了这个qrcode.decode(result.data, 100, 100)方法报错

    报错如图: 希望看到这个问题能尽快解决下,谢谢 image

    用的是mpvue框架 源码如下

    <template>
      <div class="imglist">
        <div class="uploadimg">
          <img class="invoice" src="/static/images/advertisementpic.jpg" alt=""/>
          <div class="mask">
            <span class="context">校验状态</span>
          </div>
           <!-- 上传成功添加删除按钮 -->
          <img  class="icon-delete" src="../../static/images/icon/[email protected]"/>
        </div>
        <div class="uploadimg" @click="chooseImage">
          <img class="icon-upload default" src='../../static/images/icon/[email protected]'/>
        </div>
      </div>
    </template>
    <script>
    import { mapState, mapMutations } from "vuex";
    import { ajaxGet, ajaxPost } from "../http/api";
    import { randomWord } from "../common/js/utils";
    import { Decoder } from '@nuintun/qrcode';
    import config from "../config";
    const qrcode = new Decoder();
    export default {
      props: {
        iconurl: ""
      },
      data() {
        return {
          list:[]
        };
      },
      watch: {
        //     uploadurlpro:{
        //     handler(newValue, oldValue) {
        //         this.uploadurl = newValue;
        //       },
        //       deep:true
        //     }
      },
      computed: {
        ...mapState(["role", "uid", "access_token"])
      },
      mounted() {
        
          
        // qrcode.decode('https://static-www.putaocdn.com/pc/static/img/img_service_wechat_qrcode.v201905081514.png');
        //       qrcode.callback = function (imgMsg) {
        //           alert("二维码解析:" + imgMsg)
        //       }
        // Object.assign(this.$data, this.$options.data())
      },
      methods: {
        chooseImage(e) {
          let self = this;
          wx.chooseImage({
            sizeType: ["compressed"], // 可以指定是原图还是压缩图,默认二者都有
            sourceType: ["album", "camera"], // 可以指定来源是相册还是相机,默认二者都有
            success(res) {
              console.log(res);
              const FileSystemManager = wx.getFileSystemManager()
                  FileSystemManager.readFile({
                    filePath: res.tempFilePaths[0],
                    success(result){
                      console.log(result)
                      let DecoderResult = qrcode.decode(result.data, 100, 100)
                      console.log(DecoderResult);
                    }
                  })
                  
              
            },
            fail(error) {
              console.log(error);
              if (error.errMsg !== "chooseImage:fail cancel") {
              }
            }
          });
        },
        uploadimg(){
    
        },
        // 删除图片
        deleteimg(e) {
          // this.uploadurl = "";
          // this.$emit("changeurl", this.uploadurl);
        }
      }
    };
    </script>
    <style lang="scss" scoped>
    @function rpx($value) {
      @return $value * 2rpx;
    }
    .imglist {
      display: flex;
      align-content: center;
      align-items: center;
      flex-wrap: wrap;
      margin-top: rpx(10);
      .uploadimg {
        width: rpx(64);
        height: rpx(64);
        background-color: #ebebeb;
        border-radius: rpx(4);
        position: relative;
        margin-right: rpx(18);
        margin-bottom:rpx(10);
        .mask {
          position: absolute;
          width: 100%;
          height: 100%;
          top:0px;
          left: 0px;
          z-index: 3;
          border-radius: rpx(4);
          background: rgba(0,0,0,0.50);
          text-align: center;
          line-height:rpx(64);
          .context {
            font-size: rpx(12);
            color: #FFFFFF;
          }
        }
        .icon-upload {
          position: absolute;
          top: 0;
          bottom: 0;
          left: 0;
          right: 0;
          z-index: 1;
          margin: auto;
          max-width: rpx(64);
          max-height: rpx(64);
          min-width: rpx(24);
          min-height: rpx(24);
          &.default {
            width: rpx(24);
            height: rpx(24);
          }
        }
        .icon-delete {
          position: absolute;
          bottom: 0;
          right: 0;
          z-index: 4;
          width: rpx(16);
          height: rpx(16);
        }
        .invoice {
          position: absolute;
          top: 0;
          left: 0;
          z-index: 2;
          width: rpx(64);
          height: rpx(64);
        }
      }
    }
    </style>
    
    
    opened by luodanyalian 3
  • PNGImage

    PNGImage

    /**
     * @module PNGImage
     * @see https://github.com/wheany/js-png-encoder
     */
    
    const MOD_ADLER: number = 65521;
    const MAX_STORE_LENGTH: number = 65535;
    const NO_FILTER: string = String.fromCharCode(0);
    const DEFLATE_METHOD: string = String.fromCharCode(0x78, 0x01);
    const SIGNATURE: string = String.fromCharCode(137, 80, 78, 71, 13, 10, 26, 10);
    
    function makeCRCTable(): number[] {
      const table: number[] = [];
    
      for (let n = 0; n < 256; n++) {
        let c = n;
    
        for (let k = 0; k < 8; k++) {
          if (c & 1) {
            c = 0xedb88320 ^ (c >>> 1);
          } else {
            c = c >>> 1;
          }
        }
    
        table[n] = c;
      }
    
      return table;
    }
    
    function inflateStore(data: string): string {
      let storeBuffer: string = '';
      const length: number = data.length;
    
      for (let i = 0; i < length; i += MAX_STORE_LENGTH) {
        let blockType: string = '';
        let remaining: number = length - i;
    
        if (remaining <= MAX_STORE_LENGTH) {
          blockType = String.fromCharCode(0x01);
        } else {
          remaining = MAX_STORE_LENGTH;
          blockType = String.fromCharCode(0x00);
        }
    
        // Little endian
        storeBuffer += blockType + String.fromCharCode(remaining & 0xff, (remaining & 0xff00) >>> 8);
        storeBuffer += String.fromCharCode(~remaining & 0xff, (~remaining & 0xff00) >>> 8);
    
        storeBuffer += data.substring(i, i + remaining);
      }
    
      return storeBuffer;
    }
    
    function adler32(data: string): number {
      let a: number = 1;
      let b: number = 0;
    
      for (let i = 0; i < data.length; i++) {
        a = (a + data.charCodeAt(i)) % MOD_ADLER;
        b = (b + a) % MOD_ADLER;
      }
    
      return (b << 16) | a;
    }
    
    function updateCRC(crc: number, buf: string) {
      let c: number = crc;
    
      for (let n = 0; n < buf.length; n++) {
        const b: number = buf.charCodeAt(n);
    
        c = CRC_TABLE[(c ^ b) & 0xff] ^ (c >>> 8);
      }
    
      return c;
    }
    
    function getCRC(buf: string): number {
      return updateCRC(0xffffffff, buf) ^ 0xffffffff;
    }
    
    function dwordAsString(dword: number): string {
      return String.fromCharCode(
        (dword & 0xff000000) >>> 24,
        (dword & 0x00ff0000) >>> 16,
        (dword & 0x0000ff00) >>> 8,
        dword & 0x000000ff
      );
    }
    
    function createChunk(length: number, type: string, data: string): string {
      const CRC: number = getCRC(type + data);
    
      return dwordAsString(length) + type + data + dwordAsString(CRC);
    }
    
    function createIHDR(width: number, height: number) {
      let IHDRdata: string = dwordAsString(width) + dwordAsString(height);
    
      // Bit depth
      IHDRdata += String.fromCharCode(8);
      // Color type: 6=truecolor with alpha
      IHDRdata += String.fromCharCode(6);
      // Compression method: 0=deflate, only allowed value
      IHDRdata += String.fromCharCode(0);
      // Filtering: 0=adaptive, only allowed value
      IHDRdata += String.fromCharCode(0);
      // Interlacing: 0=none
      IHDRdata += String.fromCharCode(0);
    
      return createChunk(13, 'IHDR', IHDRdata);
    }
    
    const CRC_TABLE: number[] = makeCRCTable();
    const IEND: string = createChunk(0, 'IEND', '');
    
    function png(width: number, height: number, rgba: number[]): string {
      let scanLine: string;
      let scanLines: string = '';
      const length: number = rgba.length;
      const IHDR: string = createIHDR(width, height);
    
      for (let y = 0; y < length; y += width * 4) {
        scanLine = NO_FILTER;
    
        for (let x = 0; x < width * 4; x++) {
          scanLine += String.fromCharCode(rgba[y + x] & 0xff);
        }
    
        scanLines += scanLine;
      }
    
      const compressedScanlines = DEFLATE_METHOD + inflateStore(scanLines) + dwordAsString(adler32(scanLines));
      const IDAT = createChunk(compressedScanlines.length, 'IDAT', compressedScanlines);
    
      return SIGNATURE + IHDR + IDAT + IEND;
    }
    
    export class PNGImage {
      public width: number;
      public height: number;
    
      private data: number[] = [];
    
      constructor(width: number, height: number) {
        this.width = width;
        this.height = height;
      }
    
      write(red: number, green: number, blue: number, alpha: number = 255): void {
        this.data.push(red, green, blue, alpha);
      }
    
      toDataURL() {
        return `data:image/png;base64,${btoa(png(this.width, this.height, this.data))}`;
      }
    }
    
    opened by nuintun 2
  • ⬆️ Bump typescript from 4.5.4 to 4.5.5

    ⬆️ Bump typescript from 4.5.4 to 4.5.5

    Bumps typescript from 4.5.4 to 4.5.5.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • ⬆️ Bump @types/node from 16.11.11 to 17.0.10

    ⬆️ Bump @types/node from 16.11.11 to 17.0.10

    Bumps @types/node from 16.11.11 to 17.0.10.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • ⬆️ Bump @types/node from 16.11.11 to 17.0.9

    ⬆️ Bump @types/node from 16.11.11 to 17.0.9

    Bumps @types/node from 16.11.11 to 17.0.9.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • ⬆️ Bump rollup from 2.60.2 to 2.64.0

    ⬆️ Bump rollup from 2.60.2 to 2.64.0

    Bumps rollup from 2.60.2 to 2.64.0.

    Release notes

    Sourced from rollup's releases.

    v2.64.0

    2022-01-14

    Features

    • Allow inspecting cached modules and forcing them to be transformed again via shouldTransformCachedModule (#4320)
    • Do not wait for the config file to be parsed in watch mode if it is updated before that (#4344)

    Bug Fixes

    • Do not mutate objects returned as meta from the resolveId hook (#4347)

    Pull Requests

    v2.63.0

    2022-01-04

    Features

    • Report a helpful error if rollup exits due to an empty event loop when using this.load (#4320)
    • Allow directly mutating ModuleInfo.meta for modules and never replace this object (#4328)
    • Detect additional side effect free array prototype methods (#4332)

    Bug Fixes

    • Do not watch if CLI watch options are specified but --watch is missing (#4335)

    Pull Requests

    v2.62.0

    2021-12-24

    Features

    ... (truncated)

    Changelog

    Sourced from rollup's changelog.

    2.64.0

    2022-01-14

    Features

    • Allow inspecting cached modules and forcing them to be transformed again via shouldTransformCachedModule (#4320)
    • Do not wait for the config file to be parsed in watch mode if it is updated before that (#4344)

    Bug Fixes

    • Do not mutate objects returned as meta from the resolveId hook (#4347)

    Pull Requests

    2.63.0

    2022-01-04

    Features

    • Report a helpful error if rollup exits due to an empty event loop when using this.load (#4320)
    • Allow directly mutating ModuleInfo.meta for modules and never replace this object (#4328)
    • Detect additional side effect free array prototype methods (#4332)

    Bug Fixes

    • Do not watch if CLI watch options are specified but --watch is missing (#4335)

    Pull Requests

    2.62.0

    2021-12-24

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • ⬆️ Bump @rollup/plugin-node-resolve from 13.0.6 to 13.1.3

    ⬆️ Bump @rollup/plugin-node-resolve from 13.0.6 to 13.1.3

    Bumps @rollup/plugin-node-resolve from 13.0.6 to 13.1.3.

    Changelog

    Sourced from @​rollup/plugin-node-resolve's changelog.

    v13.1.3

    2022-01-05

    Bugfixes

    • fix: use correct version when published (#1063)

    v13.1.2

    2021-12-31

    Bugfixes

    • fix: forward meta-information from other plugins (#1062)

    v13.1.1

    2021-12-13

    Updates

    • test: add tests for mixing custom exportConditions with browser: true (#1043)

    v13.1.0

    2021-12-13

    Features

    • feat: expose plugin version (#1050)
    Commits
    • 13dca1d chore(release): node-resolve v13.1.3
    • d2c788c fix(node-resolve): use correct version when published (#1063)
    • f86db9b chore(release): node-resolve v13.1.2
    • 23226cd fix(node-resolve): forward meta-information from other plugins (#1062)
    • 8c6ae32 chore(release): node-resolve v13.1.1
    • 9e6db2d test(node-resolve): add tests for mixing custom exportConditions with `brow...
    • e7719b0 chore(release): node-resolve v13.1.0
    • 59add60 feat(node-resolve): expose plugin version (#1050)
    • 932f54c chore(release): node-resolve v13.0.6
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • ⬆️ Bump @types/node from 16.11.11 to 17.0.8

    ⬆️ Bump @types/node from 16.11.11 to 17.0.8

    Bumps @types/node from 16.11.11 to 17.0.8.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • ⬆️ Bump rollup from 2.60.2 to 2.63.0

    ⬆️ Bump rollup from 2.60.2 to 2.63.0

    Bumps rollup from 2.60.2 to 2.63.0.

    Release notes

    Sourced from rollup's releases.

    v2.63.0

    2022-01-04

    Features

    • Report a helpful error if rollup exits due to an empty event loop when using this.load (#4320)
    • Allow directly mutating ModuleInfo.meta for modules and never replace this object (#4328)
    • Detect additional side effect free array prototype methods (#4332)

    Bug Fixes

    • Do not watch if CLI watch options are specified but --watch is missing (#4335)

    Pull Requests

    v2.62.0

    2021-12-24

    Features

    • Mark additional string prototype methods as side-effect-free and correct typings of existing ones (#4299)
    • Mark additional array prototype methods as side-effect-free and correct typings of existing ones (#4309)
    • Expose if a module is included after tree-shaking in its ModuleInfo (#4305)

    Bug Fixes

    • Fix how fsevents is included to improve watch mode on MacOS (#4312)

    Pull Requests

    ... (truncated)

    Changelog

    Sourced from rollup's changelog.

    2.63.0

    2022-01-04

    Features

    • Report a helpful error if rollup exits due to an empty event loop when using this.load (#4320)
    • Allow directly mutating ModuleInfo.meta for modules and never replace this object (#4328)
    • Detect additional side effect free array prototype methods (#4332)

    Bug Fixes

    • Do not watch if CLI watch options are specified but --watch is missing (#4335)

    Pull Requests

    2.62.0

    2021-12-24

    Features

    • Mark additional string prototype methods as side-effect-free and correct typings of existing ones (#4299)
    • Mark additional array prototype methods as side-effect-free and correct typings of existing ones (#4309)
    • Expose if a module is included after tree-shaking in its ModuleInfo (#4305)

    Bug Fixes

    • Fix how fsevents is included to improve watch mode on MacOS (#4312)

    Pull Requests

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • ⬆️ Bump @types/node from 16.11.11 to 17.0.7

    ⬆️ Bump @types/node from 16.11.11 to 17.0.7

    Bumps @types/node from 16.11.11 to 17.0.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • ⬆️ Bump @rollup/plugin-node-resolve from 13.0.6 to 13.1.2

    ⬆️ Bump @rollup/plugin-node-resolve from 13.0.6 to 13.1.2

    Bumps @rollup/plugin-node-resolve from 13.0.6 to 13.1.2.

    Changelog

    Sourced from @​rollup/plugin-node-resolve's changelog.

    v13.1.2

    2021-12-31

    Bugfixes

    • fix: forward meta-information from other plugins (#1062)

    v13.1.1

    2021-12-13

    Updates

    • test: add tests for mixing custom exportConditions with browser: true (#1043)

    v13.1.0

    2021-12-13

    Features

    • feat: expose plugin version (#1050)
    Commits
    • 6987caf chore(release): node-resolve v13.1.2
    • 23226cd fix(node-resolve): forward meta-information from other plugins (#1062)
    • 8c6ae32 chore(release): node-resolve v13.1.1
    • 9e6db2d test(node-resolve): add tests for mixing custom exportConditions with `brow...
    • e7719b0 chore(release): node-resolve v13.1.0
    • 59add60 feat(node-resolve): expose plugin version (#1050)
    • 932f54c chore(release): node-resolve v13.0.6
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Make sure to always return null on Decoder's `readVersion()`

    Make sure to always return null on Decoder's `readVersion()`

    In some cases, the decoder would find a section that looks like a QR Code, but it's smaller than 21x21, causing the version number calculation in readVersion() to go below zero and making the function return undefined. Because down the line there is a check for null, but not undefined, this causes the decoder to crash on buildFunctionPatternMask(). I found this to be more common on particularily grainy images like the ones from a notebook webcam.

    The fix is a simple nullish coalescence to always return null and have the decoder correctly report that there is no valid QR Code in the region scanned. I also checked no other paths of this function could return anything other than a valid Version object or null.

    Stracktrace:

    qrcode.js:4459 Uncaught TypeError: Cannot read properties of undefined (reading 'versionNumber')
        at buildFunctionPatternMask (qrcode.js:4459:38)
        at readCodewords (qrcode.js:4485:31)
        at decodeMatrix (qrcode.js:4668:21)
        at decode (qrcode.js:4696:18)
        at scan (qrcode.js:4887:21)
        at Decoder.decode (qrcode.js:4945:20)
    

    Note the library was transpiled in my case so line numbers are different.

    opened by netux 0
  • Provide scalable image format

    Provide scalable image format

    Hi, I have a question about how to fit the generated qrcode into my HTML. Currently, the generated qrcode is a GIF image which is not scalable. And I don't know how to set moduleSize to fit the desired size. So, could you please provide an option to export SVG or to draw a Canvas automatically?

    opened by FantasqueX 0
  • Bug report

    Bug report

    Please correct to avoid error when qrcode not recognized. function decodeMatrix(matrix) { var version = readVersion(matrix); if (!version) { /*version===null*/ return null; }

    opened by lollita 0
  • [Feature Request] Support for Micro QR Codes

    [Feature Request] Support for Micro QR Codes

    I am requesting support for the Micro QR format. Despite adoption of the format being low, I would love to use this repository in a project involving Micro QR codes and being able to decode them on the fly without a single, separate Android app that seems to be the only supporter of the format. I have tested multiple other JS-based QR Code decoders, none support Micro QRs. I have also tested a Windows only program based on the ZXing project with experimental support for Micro QRs, but it does not work well at all, only decoding a clear, crisp PNG of a Micro QR, not one "in the field" so to speak.

    Thank you!

    opened by wagwan-piffting-blud 0
  • fix(decoder): failed to decode image

    fix(decoder): failed to decode image

    @nuintun+qrcode+3.0.1.patch

    diff --git a/node_modules/@nuintun/qrcode/esnext/qrcode/decoder/Reader.js b/node_modules/@nuintun/qrcode/esnext/qrcode/decoder/Reader.js
    index 9ed2864..2f3a198 100644
    --- a/node_modules/@nuintun/qrcode/esnext/qrcode/decoder/Reader.js
    +++ b/node_modules/@nuintun/qrcode/esnext/qrcode/decoder/Reader.js
    @@ -99,13 +99,15 @@ var Decoder = /*#__PURE__*/ (function () {
                     disposeImageEvents(image);
                     var width = image.width;
                     var height = image.height;
    +                var actualWidth = Math.min(960, width);
    +                var actualHeight = height * (actualWidth / width);
                     var canvas = document.createElement('canvas');
                     var context = canvas.getContext('2d');
    -                canvas.width = width;
    -                canvas.height = height;
    -                context.drawImage(image, 0, 0);
    -                var data = context.getImageData(0, 0, width, height).data;
    -                var result = _this.decode(data, width, height);
    +                canvas.width = actualWidth;
    +                canvas.height = actualHeight;
    +                context.drawImage(image, 0, 0, width, height, 0, 0, actualWidth, actualHeight);
    +                var imageData = context.getImageData(0, 0, actualWidth, actualHeight);
    +                var result = _this.decode(imageData.data, imageData.width, imageData.height);
                     if (result) {
                         return resolve(result);
                     }
    
    
    opened by u3u 0
Releases(3.3.0)
The culmination of Encode Academy, the 8-week long Solidity course by Encode Club in collaboration with Extropy

Encode Academy | DAO: Real Estate & Renting What is this? This is the culmination of Encode Academy, the 8-week long Solidity course by Encode Club in

Oliver H. D. 5 May 25, 2022
Encode/Decode Bot Protections Payload

decode.antibot.to Open source tools to help you decode/encode sensor data. Features Browser decoding/encoding API decoding/encoding Usage PerimeterX E

null 15 Dec 25, 2022
qrcode generation standalone (doesn't depend on external services)

jquery.qrcode.js jquery.qrcode.js is jquery plugin for a pure browser qrcode generation. It allow you to easily add qrcode to your webpages. It is sta

Jerome Etienne 4.8k Dec 29, 2022
Encode WEB-Dev is a open source project which contains different projects of Html, CSS, Javascript and MERN Stack etc.

HACKTOBERFEST 2022 Encode WEB-Dev is an open source project which contains different projects of Html, CSS, Javascript and MERN Stack etc. which makes

null 7 Oct 31, 2022
An interceptor to validate and decode Pub/Sub push messages for endpoints

NestJS GCP Pub/Sub Interceptor Provides an Interceptor for NestJS to automagically validate and unwrap HTTP push messages from Google Cloud Platform's

Hiphops 3 Dec 15, 2022
Create, sign & decode Solana transactions with minimum deps

micro-sol-signer Create, sign & decode Solana transactions with minimum deps. Tiny: 674 LOC, 3K LOC with all deps bundled No network code in main pack

Paul Miller 32 Nov 23, 2022
Create, sign & decode BTC transactions with minimum deps.

micro-btc-signer Create, sign & decode BTC transactions with minimum deps. ?? Small: ~2.2K lines Create transactions, inputs, outputs, sign them No ne

Paul Miller 19 Dec 30, 2022
Seamless and lightweight parallax scrolling library implemented in pure JavaScript utilizing Hardware acceleration for extra performance.

parallax-vanilla.js Seamless and lightweight parallax scrolling library implemented in pure JavaScript utilizing Hardware acceleration for extra perfo

Erik Engervall 91 Dec 16, 2022
Pure JavaScript library that add .is-hover class instead of css :hover for mobile and desktop.

MultiDeviceHover Pure JavaScript library that add .is-hover class instead of css :hover for mobile and desktop. Usage Install Using npm, install multi

Ryuta Sakai 1 Oct 5, 2021
Accessible, lightweight, stylish modal library in pure JavaScript

accessible-minimodal Accessible, lightweight (< 8 kB), stylish modal library in pure JavaScript Example https://codepen.io/imhvost/pen/LYNazqo (with "

Oleksandr Marchuk 3 Aug 4, 2022
🍦 ✨ Simple multi-select pure vanilla Javascript library.

multiSelect.js ✨ Simple multi-select pure vanilla Javascript library. ?? Live Demo v1.0.8 multiSelect.js is a simple, pure vanilla Javascript library

Jacob Kleiman 5 Mar 15, 2022
Pure and simple virtual DOM library

Maquette Maquette is a Javascript utility which makes it easy to synchronize the DOM tree in the browser with your data. It uses a technique called 'V

AFAS Software 736 Jan 4, 2023
A native, pure and exquisite web components library which can be used anywhere.

What Is This ? This is a project on pure web components merely using native HTML、CSS and JavaScript technologies. It has features below: based on web

PARANOIA 14 Nov 16, 2022
A pure CSS library for radial lists and menus

Radial menu and radial list A pure CSS library for inline lists and menus around a circle, flexible and customizable A radial layout organizes a list

Fabio Vitali 10 Aug 15, 2022
A pure JavaScript Web Page to retrieve real-time OTP through a web page and generate/scan QR codes.

2FA-Solver A pure JavaScript Web Page to retrieve real-time OTP through a web page and generate/scan QR codes. It can be used as an offline web page b

Yuthan K 8 Dec 7, 2022
A graphical web-based audio visualizer which reads music data using Pure JavaScript, and draws a graphical view in Canvas.

Audio Visualizer JS A graphical web-based audio visualizer which reads music data using Pure JavaScript, and draws a graphical view in Canvas. Demo: h

Max Base 9 Aug 9, 2022
Pure JavaScript (VanillaJS) dropdown menu, with multiple select and searching support

JS Select Pure JavaScript (VanillaJS) dropdown menu, with multiple select and searching support How to use To use the select plugins, two main file mu

Luigi Verolla 4 Mar 17, 2022
Kuldeep 2 Jun 21, 2022
DateTimePickerComponent is a very lightweight and dependency-free web component written in pure JavaScript

DateTimePickerComponent Description DateTimePickerComponent is a very lightweight (just over 20KB) and dependency-free web component written in pure J

null 14 Dec 24, 2022