Garfish is a powerful micro front-end framework 🚚

Related tags

Frameworks garfish
Overview

garfish

English | 简体中文

Garfish NPM version build status

Garfish is a micro front-end framework, mainly used to solve the problems of cross-team collaboration, diversification of technology system, and increasing complexity of applications brought by modern web applications in the context of front-end ecological boom and increasing complexity of web applications, and Garfish has been polished and tested by a large number of online applications, with strong functional stability and reliability.

Garfish Goals

To compose multiple independently delivered front-end applications into a whole, and to decompose front-end applications into some smaller and simpler applications that can be "independently developed", "independently tested" and "independently deployed", while still appearing to users as cohesive individual products.

Installation

$ yarn add garfish # or npm i garfish

Documentation

https://garfish.top/

Functionality

  • 🌈 Rich and efficient product features
    • Garfish micro front-end sub-application supports any kind of framework and technology system access
    • Garfish micro front-end sub-application supports "independent development", "independent testing" and "independent deployment
    • Powerful pre-loading capability, automatically record user application loading habits to increase loading weight, and greatly reduce application switching time
    • Support for dependency sharing, which greatly reduces the overall package size and the repeated loading of dependencies.
    • Support data collection, effectively perceive the state of the application during operation
    • Support for multiple instance capability to run multiple sub-applications in the page at the same time enhances the business splitting efforts
    • Provides efficient and usable debugging tools to assist users in the micro front-end model brings different development experience problems from the traditional R&D model
  • 📦 Highly scalable core modules
    • Supports HTML entry and JS entry through the Loader core module, making it easy to access micro front-end applications
    • Router module provides route-driven, master-child route isolation, users only need to configure the routing table application can complete the independent rendering and destruction, the user does not need to care about the internal logic
    • Sandbox module provides runtime isolation for the application's Runtime, which can effectively isolate the side effects of JS and Style on the application
    • Store provides a simple mechanism for exchanging communication data
  • 🎯 Highly scalable plug-in mechanism (coming soon...)
    • Provide business plug-ins to meet various customization needs of business parties

community

https://garfish.top/community/discuss

LICENSE

Garfish is released under the Apache License, Version 2.0.

Comments
  • 请问是否可以基于Garfish框架提供一份部署文档?

    请问是否可以基于Garfish框架提供一份部署文档?

    Clear and concise description of the problem

    目前garfish文档内容较少,而且部署部分几乎空白,所以大佬们可以出一份部署相关的文档供学习嘛?蟹蟹

    Suggested solution

    Alternative

    No response

    Additional context

    No response

    Validations

    • [x] Read the Contributing Guidelines.
    • [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
    opened by Kingshaohui 5
  • 有集成 pinia 的示例吗

    有集成 pinia 的示例吗

    Describe the bug

    // main.ts
    import { vueBridge } from '@garfish/bridge'
    import { createPinia } from 'pinia'
    import { createApp, h } from 'vue'
    
    import App from './App'
    import { newRouter } from './router'
    
    const pinia = createPinia()
    
    export const provider = vueBridge({
      createApp,
      rootComponent: App,
      appOptions: () => {
        return {
          el: '#app',
          render: () => h(App)
        }
      },
      handleInstance: (vueInstance, { basename }) => {
        vueInstance.use(newRouter(basename))
        vueInstance.use(pinia)
      }
    })
    
    if (!window.__GARFISH__) {
      const app = createApp(App)
      const router = newRouter('/')
    
      app.use(router)
      app.use(pinia)
      app.mount('#app')
    }
    

    image

    Reproduction

    https://gitee.com/jh_shot/micro-template

    Used Package Manager

    pnpm

    System Info

    System:
        OS: Windows 10 10.0.22000
        CPU: (12) x64 Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
        Memory: 5.39 GB / 15.84 GB
      Binaries:
        Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
        Yarn: 1.22.18 - ~\AppData\Roaming\npm\yarn.CMD
        npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
      Browsers:
        Edge: Spartan (44.22000.120.0), Chromium (101.0.1210.53)
        Internet Explorer: 11.0.22000.120
    

    Validations

    opened by Ttou 5
  • docs: update router hooks

    docs: update router hooks

    Description

    • API 增加 routerChange 的使用说明
    • 针对 hook 全局唯一补充相应的使用提醒

    Related Issue

    None

    Motivation and Context

    None

    How Has This Been Tested

    None

    Types of changes

    • [x] Docs change / refactoring / dependency upgrade
    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist

    • [ ] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [x] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [ ] I have added tests to cover my changes.
    • [ ] All new and existing tests passed.
    opened by niexia 4
  • chore: fix dependencies when run build

    chore: fix dependencies when run build

    Description

    fix dependencies problem when run build

    Related Issue

    https://github.com/modern-js-dev/garfish/issues/515

    Motivation and Context

    I just wanna learn it.

    How Has This Been Tested

    Yep, when i modify it, every thing is correct

    image

    Types of changes

    • [x] Docs change / refactoring / dependency upgrade
    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist

    • [x] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document. Yes and btw, CONTRIBUTING.md write node version is >= 16.10 but package.json wanna >=16.14.0
    • [ ] I have added tests to cover my changes.
    • [ ] All new and existing tests passed.
    opened by moonrailgun 4
  • fix(loader): support @charset removing and @import without url()

    fix(loader): support @charset removing and @import without url()

    PR Details

    • [x] 支持无url()的@import语句
    • [x] 移除@charset语句
    • [x] 更新了匹配url()的正则

    Description

    1. 将无url()的@import语句转换为有url(),以供后续统一处理;
    2. @charset在<style>无意义,直接移除;
    3. url()可匹配带文件名带括号的资源

    Related Issue

    https://github.com/modern-js-dev/garfish/issues/446

    Motivation and Context

    1. 支持了无url()的@import语句,兼容性更好
    2. 顺带移除了可能出现的@charset语句,减少控制台warning
    3. 优化了url()匹配模式,能兼容更多合理的资源名

    How Has This Been Tested

    repo中无相关test case,可手动在 https://github.com/yanni4night/garfish-issue-reproduction/tree/issue-446 验证。

    Types of changes

    • [ ] Docs change / refactoring / dependency upgrade
    • [x] Bug fix (non-breaking change which fixes an issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist

    • [x] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [ ] I have added tests to cover my changes.
    • [x] All new and existing tests passed.
    opened by yanni4night 4
  • Feat/new examples

    Feat/new examples

    PR Details

    garfish new examples

    Description

    Related Issue

    Motivation and Context

    How Has This Been Tested

    Types of changes

    • [ ] Docs change / refactoring / dependency upgrade
    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist

    • [ ] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    • [ ] I have read the CONTRIBUTING document.
    • [ ] I have added tests to cover my changes.
    • [ ] All new and existing tests passed.
    opened by danpeen 4
  • externals 建议支持异步加载

    externals 建议支持异步加载

    问题

    目前 garfish 和 remote-module 的 externals 配置,均需要先引入依赖再设置,使得主应用难以做懒加载

    目前的写法:

    setExtenals({
        react: require('react'),
    });
    

    期望的使用方式

    支持懒加载

    setExtenals({
        react: () => import('react'),
        // 或者
        react: () => require('react'),
    });
    

    可能的解决方式

    子应用使用 amd 格式,使用自定义的 define 函数执行

    以下为示例,可能没有正确实现 amd loader 格式

    const exec = (code: string) =>
        new Promise((resolve) => {
            async function define(depNames: string[], factor: () => any) {
                const deps = await Promise.all(depNames.map((depName) => externals[depName]()));
                resolve(factor(...deps));
            }
            const func = new Function('define', code);
            func(define);
        });
    

    问题

    目前 garfish 使用的是 commonjs 格式,需要想办法兼容

    opened by claneo 4
  • fix(browser-vm): fakeFetch method input type judgment

    fix(browser-vm): fakeFetch method input type judgment

    Description

    fakeFetch函数中并没有对 input 的类型做判断 导致fetch请求失败。addSourceList方法中url参数需要是string类型

    Related Issue

    Motivation and Context

    How Has This Been Tested

    Types of changes

    • [ ] Docs change / refactoring / dependency upgrade
    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist

    • [x] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    • [ ] I have read the CONTRIBUTING document.
    • [ ] I have added tests to cover my changes.
    • [ ] All new and existing tests passed.
    opened by Orenbek 3
  • fix: link style render by order

    fix: link style render by order

    Description

    fix: link style render by order

    Types of changes

    • [ ] Docs change / refactoring / dependency upgrade
    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist

    • [x] My code follows the code style of this project.
    • [x] My change requires a change to the documentation.
    • [x] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [x] I have added tests to cover my changes.
    • [x] All new and existing tests passed.
    opened by zhoushaw 3
  • fix: quick start link in cn readme

    fix: quick start link in cn readme

    Description

    • Found the url of quick start is wrong in readme of Chinese version.

    Related Issue

    #533

    Motivation and Context

    • Fix url

    How Has This Been Tested

    Add tests to ensure that user can be redirected to correct address

    Types of changes

    • [x] Docs change / refactoring / dependency upgrade
    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist

    • [x] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [x] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [ ] I have added tests to cover my changes.
    • [x] All new and existing tests passed.
    opened by GrayFrost 3
  • Feat: Redefine AppInfo by PropsInfo

    Feat: Redefine AppInfo by PropsInfo

    Motivation and Context

    There has type error where had import @garfish/bridge-*, such as where dev/app-react-18/src/root.tsx:L6

    What had I do

    Bridge had define Props Info for an app info, but it will be meaningful which renamed be AppInfo than it, so I did to redefine to AppInfo

    How Has This Been Tested

    Reinstall and reopen dev/app-react-18/src/root.tsx:L6

    Types of changes

    • [ ] Docs change / refactoring / dependency upgrade
    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist

    • [x] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [ ] I have added tests to cover my changes.
    • [x] All new and existing tests passed.
    opened by Rain120 3
  • fix(loader): fix the loader return the same loader when multi apps mount at the same time

    fix(loader): fix the loader return the same loader when multi apps mount at the same time

    fix(loader): fix the loader return the same loader when multi apps mount at the same time

    Description

    When multiple applications with the same entry are mounted at the same time, garfish will collect the dom created by the previous application as a side effect into the side effect category of the last sub-application. When the last sub application is unmount, it will cause all applications to be uninstalled.

    This is because the loader of garfish will cache the loader instance for the same entry url, and return the previous loader instance when the entry is the same. In this way, when multiple sub applications are mounted at the same time, if these applications have the same entry, they will point to the same loader instance. In the vm sandbox, the document object of the loader will be rewritten to the document object of the sandbox. All loaders will also point to the sandbox document object of the last mounted application. Then the dom created by these applications will be collected as a side effect of the last application, causing some errors to occur.

    Related Issue

    Motivation and Context

    How Has This Been Tested

    Types of changes

    • [ ] Docs change / refactoring / dependency upgrade
    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist

    • [x] My code follows the code style of this project.
    • [x] My change requires a change to the documentation.
    • [x] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [x] I have added tests to cover my changes.
    • [x] All new and existing tests passed.
    opened by danpeen 2
  • web woker error

    web woker error

    Describe the bug

    子应用使用了monaco editor,打包部署后可以正常工作,但从主应用启动时,web worker无法正常启动,报错如下: image

    Reproduction

    none

    Used Package Manager

    npm

    System Info

    none
    

    Validations

    opened by nxnminieye 0
  • fix(core): fix addSourceList can not support URL object type fetch request

    fix(core): fix addSourceList can not support URL object type fetch request

    Description

    fix addSourceList can not support URL object type fetch request. for more detail info please check the issue #588

    Related Issue

    https://github.com/modern-js-dev/garfish/issues/588

    Motivation and Context

    How Has This Been Tested

    Types of changes

    • [ ] Docs change / refactoring / dependency upgrade
    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist

    • [x] My code follows the code style of this project.
    • [x] My change requires a change to the documentation.
    • [x] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [x] I have added tests to cover my changes.
    • [x] All new and existing tests passed.
    opened by danpeen 2
  • `fetch` donnot support URL object

    `fetch` donnot support URL object

    Describe the bug

    问题

    在子平台编写这样的代码时会遇到错误:

    fetch(new URL(window.location.href));
    

    29e3307d-acbe-4d27-9e5a-6c33723fcc71

    定位

    我看了 addSourceList 实现的代码,其中并没有处理 URL 类型 https://github.com/modern-js-dev/garfish/blob/v1.13.1/packages/core/src/module/app.ts#L170

    fetch标准

    查看一些文档,看到 fetch 是可以是可以这样使用 URL 类型的,是被记录的标准用法 https://developer.mozilla.org/en-US/docs/Web/API/fetch https://developer.mozilla.org/en-US/docs/Web/API/URL

    The toString() method of URL just returns the value of the href property, so the constructor can be used to normalize and encode a URL directly.

    const response = await fetch(new URL('http://www.example.com/démonstration.html'));

    同时,在大部分浏览器中测试也是可以通过的。比如在浏览器控制台中直接输入fetch(new URL(window.location.href))

    Reproduction

    none

    Used Package Manager

    npm

    System Info

    none
    

    Validations

    opened by ExcitedSpider 0
  • fix: issue SVG camel tag is not support #585, SVG setAttribute xmlns:xlink failed #584

    fix: issue SVG camel tag is not support #585, SVG setAttribute xmlns:xlink failed #584

    Description

    fix bugs:

    • SVG camel tag is not support: add SVG judge for template parse
    • SVG setAttribute xmlns:xlink failed: make sure the prefix is xlink, only xlink:XXX attribute need xlink namespace.

    Related Issue

    • SVG camel tag is not support https://github.com/modern-js-dev/garfish/issues/585
    • SVG setAttribute xmlns:xlink failed https://github.com/modern-js-dev/garfish/issues/584

    Motivation and Context

    garfish render SVG in template error.

    How Has This Been Tested

    • SVG camel tag is not support: test SVG feFlood tag and DIV, make sure toLowercase is enable for normal tag.
    • SVG setAttribute xmlns:xlink: test xmlns:xlink and xlink:href, make sure only xlink:href is set with xlink namespace.

    Types of changes

    • [ ] Docs change / refactoring / dependency upgrade
    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist

    • [x] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [x] I have added tests to cover my changes.
    • [x] All new and existing tests passed.
    opened by yoonthe 2
Releases(v1.13.3)
Owner
Modern JS
Let's go gentle into that good era of modern web development
Modern JS
Lightweight and powerful data binding.

Rivets.js Rivets.js is a lightweight data binding and templating system that facilitates building data-driven views. It is agnostic about every aspect

Michael Richards 3.2k Dec 28, 2022
The worlds smallest fully-responsive css framework

FLUIDITY A fully responsive css framework that is impossibly small HTML is almost 100% responsive out of the box. This stylesheet patches the remainin

murmurs 1.1k Sep 24, 2022
An HTML5/CSS3 framework used at SAPO for fast and efficient website design and prototyping

Welcome to Ink Ink is an interface kit for quick development of web interfaces, simple to use and expand on. It uses a combination of HTML, CSS and Ja

SAPO 1.9k Dec 15, 2022
🌟 DataFormsJS 🌟 A minimal JavaScript Framework and standalone React and Web Components for rapid development of high quality websites and single page applications.

?? Welcome to DataFormsJS! Thanks for visiting! ?? ?? ?? ?? ?? ?? 中文 (简体) 欢迎来到 DataFormsJS Español Bienvenido a DataFormsJS Português (do Brasil) Bem

DataFormsJS 156 Dec 8, 2022
HTML Framework that allows you not to write JavaScript code.

EHTML (or Extended HTML) can be described as a set of custom elements that you can put on HTML page for different purposes and use cases. The main ide

Guseyn Ismayylov 171 Dec 29, 2022
One framework. Mobile & desktop.

Angular - One framework. Mobile & desktop. Angular is a development platform for building mobile and desktop web applications using Typescript/JavaScr

Angular 85.7k Jan 4, 2023
Ember.js - A JavaScript framework for creating ambitious web applications

Ember.js is a JavaScript framework that greatly reduces the time, effort and resources needed to build any web application. It is focused on making yo

Ember.js 22.4k Jan 8, 2023
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Supporting Vue.js Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome ba

vuejs 201.7k Jan 8, 2023
The tiny framework for building hypertext applications.

Hyperapp The tiny framework for building hypertext applications. Do more with less—We have minimized the concepts you need to learn to get stuff done.

Jorge Bucaran 18.9k Jan 4, 2023
A framework for building native apps with React.

React Native Learn once, write anywhere: Build mobile apps with React. Getting Started · Learn the Basics · Showcase · Contribute · Community · Suppor

Facebook 106.8k Jan 3, 2023
The Backbone Framework

Marionette.js The Backbone Framework Marionette v5 Marionette is dropping its dependency on Backbone. That library is available here: https://github.c

Marionette.js 7.1k Jan 5, 2023
MVC framework making it easy to write realtime, collaborative applications that run in both Node.js and browsers

Derby The Derby MVC framework makes it easy to write realtime, collaborative applications that run in both Node.js and browsers. Derby includes a powe

DerbyJS 4.7k Dec 31, 2022
A JavaScript Framework for Building Brilliant Applications

mithril.js What is Mithril? Installation Documentation Getting Help Contributing What is Mithril? A modern client-side JavaScript framework for buildi

null 13.5k Dec 26, 2022
Better MV-ish Framework

❗ I started working on this project in 2012. React didn't exist, Angular didn't have a stable 1.0 release, Internet Explorer 7, 8, 9 was used by 35% o

Antonio Stoilkov 2.8k Jan 1, 2023
A framework for real-time applications and REST APIs with JavaScript and TypeScript

A framework for real-time applications and REST APIs with JavaScript and TypeScript Feathers is a lightweight web-framework for creating real-time app

Feathers 14.2k Dec 28, 2022
A rugged, minimal framework for composing JavaScript behavior in your markup.

Alpine.js Alpine.js offers you the reactive and declarative nature of big frameworks like Vue or React at a much lower cost. You get to keep your DOM,

Alpine.js 22.5k Dec 30, 2022
The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

Bootstrap Sleek, intuitive, and powerful front-end framework for faster and easier web development. Explore Bootstrap docs » Report bug · Request feat

Bootstrap 161.1k Jan 4, 2023
Semantic is a UI component framework based around useful principles from natural language.

Semantic UI Semantic is a UI framework designed for theming. Key Features 50+ UI elements 3000 + CSS variables 3 Levels of variable inheritance (simil

Semantic Org 50.3k Jan 3, 2023
Materialize, a CSS Framework based on Material Design

MaterializeCSS Materialize, a CSS Framework based on material design. -- Browse the docs -- Table of Contents Quickstart Documentation Supported Brows

Alvin Wang 38.8k Dec 28, 2022