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

aly_captcha

v0.1.7

Published

Aliyun slider captcha with a framework-agnostic core and Vue 3 wrapper.

Readme

aly_captcha

Aliyun slider captcha with a framework-agnostic core and an optional Vue 3 wrapper.

Install

pnpm add aly_captcha

Generic Usage

Use the core subpath in React or plain DOM code.

import { createAliyunCaptcha } from "aly_captcha/core";

const controller = createAliyunCaptcha({
  mount: "#captcha-root",
  sceneId: "your-scene-id",
  prefix: "your-prefix",
  verify: async captchaVerifyParam => {
    const response = await fetch("/api/captcha/verify", {
      method: "POST",
      headers: {
        "Content-Type": "application/json"
      },
      body: JSON.stringify(captchaVerifyParam)
    });

    return response.json();
  },
  onSuccess(payload) {
    console.log("captcha success", payload);
  }
});

await controller.init();
await controller.show();
const visible = controller.isVisible();

React Example

import { useEffect, useRef } from "react";
import {
  createAliyunCaptcha,
  type AliyunCaptchaController
} from "aly_captcha/core";

export function LoginCaptcha() {
  const rootRef = useRef<HTMLDivElement | null>(null);
  const controllerRef = useRef<AliyunCaptchaController | null>(null);

  useEffect(() => {
    if (!rootRef.current) {
      return;
    }

    const controller = createAliyunCaptcha({
      mount: rootRef.current,
      manual: true,
      sceneId: "your-scene-id",
      prefix: "your-prefix",
      verify: async captchaVerifyParam => {
        const response = await fetch("/api/captcha/verify", {
          method: "POST",
          headers: {
            "Content-Type": "application/json"
          },
          body: JSON.stringify(captchaVerifyParam)
        });

        return response.json();
      }
    });

    controllerRef.current = controller;
    void controller.init();

    return () => {
      controller.destroy();
      controllerRef.current = null;
    };
  }, []);

  return (
    <>
      <div ref={rootRef} />
      <button type="button" onClick={() => void controllerRef.current?.show()}>
        打开验证码
      </button>
    </>
  );
}

Vue Usage

import { createApp } from "vue";
import App from "./App.vue";
import AliyunCaptchaPlugin from "aly_captcha";

const app = createApp(App);

app.use(AliyunCaptchaPlugin, {
  sceneId: "your-scene-id",
  prefix: "your-prefix",
  verify: async captchaVerifyParam => {
    const response = await fetch("/api/captcha/verify", {
      method: "POST",
      headers: {
        "Content-Type": "application/json"
      },
      body: JSON.stringify(captchaVerifyParam)
    });

    return response.json();
  }
});

app.mount("#app");

app.use(AliyunCaptchaPlugin, options) and app.use(createAliyunCaptchaPlugin(options)) are both supported.

<script setup lang="ts">
import { ref } from "vue";
import type { AliyunCaptchaExpose } from "aly_captcha";

const captchaRef = ref<AliyunCaptchaExpose | null>(null);

function openCaptcha() {
  void captchaRef.value?.show();
  console.log(captchaRef.value?.isVisible());
}
</script>

<template>
  <AliyunCaptcha ref="captchaRef" manual @success="console.log">
    点击校验
  </AliyunCaptcha>

  <button type="button" @click="openCaptcha">手动唤起验证码</button>
</template>

Exports

  • aly_captcha: Vue plugin and component entry.
  • aly_captcha/core: framework-agnostic controller entry.
  • AliyunCaptcha: component
  • AliyunCaptchaComponent: named component export
  • createAliyunCaptcha: generic controller factory
  • createAliyunCaptchaPlugin: plugin factory with options
  • loadAliyunCaptchaScript: script loader
  • DEFAULT_SCRIPT_SRC: default SDK script URL

Notes

  • sceneId, prefix, and verify are required for both the generic controller and the Vue wrapper.
  • manual hides the internal trigger button so you can call show() yourself.
  • Vue emits ready, verified, close, success, fail, and error.