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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@finoer/finoer-invoke

v0.0.24

Published

> 顾名思义, `fino-invoke`即fino框架的调度模块, 负责在合适的时机挂载和下载对应的微前端项目应用

Downloads

34

Readme

fino-invoke使用文档

顾名思义, fino-invoke即fino框架的调度模块, 负责在合适的时机挂载和下载对应的微前端项目应用

如何使用

第一步: 首先加载全局应用列表文件, 如下:

const projectList = [
  {
    name: 'yueqi1',
    activeWhen: function (location: Location) {
      const route= window.location.href.split(window.location.origin)[1]
      return route.startsWith('/yueqi')
    },
    domain: "http://localhost:8080",
    entry: '/rcms/stats.js',
  },
  {
    name: 'jinzhao',
    activeWhen: function (location: Location) {
      const route= window.location.href.split(window.location.origin)[1]
      return route.startsWith('/jinzhao')
    },
    domain: "http://localhost:8081",
    entry: '/rcms/stats.js',
  },
  {
    name: 'blue',
    activeWhen: function (location: Location) {
      const route= window.location.href.split(window.location.origin)[1]
      return route.startsWith('/blue')
    },
    domain: "http://localhost:8007",
    entry: '/rcms/stats.js',
  },
]

export default projectList

第二步: 引入fino-invoke调度模块,

那么基座应用就完了

import { invoke, registerApps } from 'Packs/finoer-invoke'
// 主应用的loading动画
import Loading from './utils/loading'
// 注册应用
registerApps(projectList)

const loading = new Loading()
// 应用进入钩子
invoke.$event.subscribe('appEnter', () => {
  loading.hide()
})
// 应用离开的钩子
invoke.$event.subscribe('appLeave', () => {
  loading.show()
})

第三步: 子模块

如何将项目作为子模块接入fino项目

webpack打包配置:

const { StatsWriterPlugin } = require("webpack-stats-plugin")
plugins: [
  ...,
  new StatsWriterPlugin({

        filename: "rcms/stats.js", // Default,
        transform(data, opts) {
          const content =
`
  (function(){
      const methods = ${JSON.stringify({
        ...data.assetsByChunkName,
        context: 'vue',
        version: '2.6.10'
      })};
      $event.notify('baseInfoLoaded', methods)
  })()
`
          return content;
        }
	})
]

main.js:

// 是否在fino的基座用运行
const isInFinoRuntime = invoke.isInFinoRuntime()

// 如果不在fino基座中运行,即项目独立运行的时候, 使用自己的加载机制
if(!isInFinoRuntime) {
  Vue.use(Router)

  const router = new Router({
    mode: 'history',
    routes: routerArray
  })
  new (Vue as any)({
    el: "#app",
    router,
    render: (h: any) => h(App)
  })
}else {
  // 使用fino的加载机制
  const finoApp = {
    name: "yueqi1",
    init: (instance: VueRuntimeContext) => {
      instance.injectionRouter(routerArray)
    }
  };

  invoke.$event.notify('childAppLoaded', finoApp)
}

我所认为的现存的问题:

  1. 创建context运行环境: 新增一种运行环境需要按照规定的类去继承实现它的方法, rcmsContext?

       
    import { GlobalContext, globalContext } from '../global/index'
    /**
     * @class 管理子模块的运行环境
     * @mehtods {*} createContext
     * @mehtods {*} loadContext
     * @mehtods {*} unmountContext
     */
       
    import { tagLoadJs } from "../loader";
       
    abstract class BaseModuleContext {
      // 资源的base url
      public baseUrl: string = `https://cdn.bootcdn.net/ajax/libs`;
       
      public context: string = ""
       
      constructor(type: string) {
        this.context = type
      }
       
      // 获取运行环境沙箱
      public getSandBoxJs(type: string, version: string) {
        const url = `${this.baseUrl}/${type}/${version}/${type}.min.js`;
        return tagLoadJs(url)
      }
       
      abstract createContext(version: string): vueContext | reactContext | phaserContext
       
      abstract destroy(): void
       
    }
       
    export default BaseModuleContext
       
  2. 暂时没有考虑css, js全局污染的问题

  3. 加载的超时时间问题。 降级处理, 提示

  4. 运行环境插件化

  5. css, js隔离

  6. 加载机制。