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

@cicctencent/ark-component

v0.1.37

Published

方舟组件

Readme

@jv/ark-component

方舟组件

名词解释

主应用: 当前使用微前端的页面

子应用: 通过微前端访问的页面

install

  npm i @jv/ark-component -S

主应用

AcPreviewMain 导出/预览主应用组件

与 PreviewSub 配套使用

<template>
    <AcPreviewMain
        url="http://127.0.0.1:8080/export.html"
        :componentData="componentData"
        @xxx-event="onXxxEvent"
    ></AcPreviewMain>
</template>
<script lang="ts">

import { AcPreviewMain } from "@jv/ark-component/dist/main";

export default {
  components:{AcPreviewMain},
  data:{
    return {
      componentData:{
        name:'ComponentName', /* 组件名 */
        props:{/* 组件参数 */}
      }
    }
  },
  methods:{
    onXxxEvent(){
      // 导出组件emit的事件
      console.log('xxxEvent');
    }
  }
}
</script>

属性

| 属性名 | 描述 | 类型 | 默认值 | | ------------- | --------------- | -------- | ------------------------------------------------------------------------ | | url | 子应用 url | string | | | name | 子应用唯一 name | string | | | sync | 是否同步 url | boolean | false | | alive | 是否保活 | boolean | false | | fetch | 处理跨域 | Function | (url,options)=>window.fetch(url,{...options,credentials: "same-origin"}) | | componentData | 组件信息 | Object | {} |

useSyncMain 同步数据主应用函数

与 syncSub 配套使用

import { useSyncMain } from "@jv/ark-component/dist/main";


/**
 *  syncUrl : 同步页url
 *
 *  callback: 处理同步数据回调函数
 *
 **/

useSyncMain(syncUrl: string, callback: SyncCallBack);

子应用

PreviewSub 预览/导出子应用组件

必须要全局注册业务组件,不然会导致无法渲染组件

与 AcPreviewMain 配套使用

<PreviewSub></PreviewSub>
<script lang="ts">

import { PreviewSub } from "@jv/ark-component/dist/sub";

export default {
  components:{PreviewSub},
}
</script>

syncSub 数据同步子应用函数

在微前端子应用中使用 , 与 useSyncMain 配套使用

import { syncSub } from "@jv/ark-component/dist/sub";
/*
*
*  components: 组件列表
*
*  meta: 应用信息
*/

syncSub(components: ComponentConfig[], meta: Meta)

数据结构

export enum ProjectType {
    H5 = 'h5',
    PC = 'pc',
    WECHAT = 'wechat',
}

export interface Meta {
    name: string; // 业务名/应用名
    icon: string; // 应用图标
    desc: string; // 业务介绍
    exportUrl: string; // 输出组件微前端子应用的url
    previewUrl: string; // 模拟器的url
    appUrl: string; // 目标页面地址生成规则
    appTestUrl: string; // 目标页面测试环境地址生成规则
    type: ProjectType; // 业务类型
}

export interface ComponentConfig {
    name: string; // 组件名
    title: string; // 组件中文名
    creator?: string; // 组件作者(用账号系统上的英文名)
    // 描述
    desc?: string; // 描述、简介、备注
    group: string; // 分组名
    icon: string; // 组件图标
    config: {
        props?: JSONSchema4; // 表单数据
        style?: JSONSchema4; // 样式数据
        event?: JSONSchema4; // 事件数据
    };
    report?: {
        firstClassName: string; // 一级名,'运营'
        secondClassName: string; // 二级名, '可视化创造'
        rows: buryReportPointItem[]; // 用于同步海雀平台的数据
    };
    readme?: string; // 组件说明,markdown文件的string
    valid?: boolean; // 是否可用,不可用时,编辑器不展示
}

规划

[] 主应用指定子应用事件处理