{"id":13520492,"url":"https://github.com/bytedance/magic-portal","last_synced_at":"2025-05-08T23:32:36.757Z","repository":{"id":48370044,"uuid":"375936534","full_name":"bytedance/magic-portal","owner":"bytedance","description":"⚡ A blazing fast micro-component and micro-frontend solution uses web-components under the hood.","archived":false,"fork":false,"pushed_at":"2021-07-29T14:19:34.000Z","size":289,"stargazers_count":90,"open_issues_count":1,"forks_count":5,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-11-02T03:33:17.650Z","etag":null,"topics":["component","micro-component","micro-frontend","microservices"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytedance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-11T07:10:01.000Z","updated_at":"2024-10-06T20:55:09.000Z","dependencies_parsed_at":"2022-08-12T19:41:40.576Z","dependency_job_id":null,"html_url":"https://github.com/bytedance/magic-portal","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytedance%2Fmagic-portal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytedance%2Fmagic-portal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytedance%2Fmagic-portal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytedance%2Fmagic-portal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytedance","download_url":"https://codeload.github.com/bytedance/magic-portal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224784837,"owners_count":17369461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["component","micro-component","micro-frontend","microservices"],"created_at":"2024-08-01T05:02:22.420Z","updated_at":"2024-11-15T13:15:06.439Z","avatar_url":"https://github.com/bytedance.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg width=\"300\" src=\"https://sf16-sg.tiktokcdn.com/obj/eden-sg/lpqulynulog/Magic/logo.qW4rU0mH6aL8.svg\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eMagic Portal\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n\nMake micro-components and micro-frontends never that easy again.\n\n[![GitHub](https://img.shields.io/github/license/bytedance/magic-microservices?color=blue)](https://github.com/bytedance/magic-microservices/blob/main/LICENSE)\n\n\n\u003c/div\u003e\n\n\n## Overview\n\nA lightweight micro-frontend  / micro-component solution inspired by [Portals](https://github.com/WICG/portals) proposal\n\n\n## Feature\n\n- ⚡ Blazing fast, based on [magic](https://github.com/bytedance/magic-microservices)\n- 🚀 Portability: write your code and use it with any frameworks.\n- 🔨 Adaptable: an adapter for any JS module, friendly to existing code.\n- 💪 Web Components driven design\n\n## Quick Start\n\n### Installation\n\n```bash\n$ npm install @magic-microservices/portal\n# or\n$ yarn add @magic-microservices/portal\n```\n\n\n### Register portal component\n\n```typescript\nimport portal, { PortalHtmlEntryPlugin } from '@magic-microservices/portal'\n\nawait portal({\n  plugins: [new PortalHtmlEntryPlugin()], // fetch and parse html\n})\n```\n\n### Use built-in portal component 🎉\n\nRegistration should be placed before instantiation. Portal html entry plugin uses fetch under the hood, \nmake sure the corresponding website's CORS has configured.\n\n```html\n\u003cmagic-portal src='//some-where-you-want-to-go' /\u003e\n```\n\n\n## Advanced usage\n\n### Manifest and extremely fast rendering experience\n\nYou may found the example above used `PortalHtmlEntryPlugin` to achieve HTML fetching and parsing at runtime, however in the best practice, this step should be avoided and moved to AOT(Ahead of Time) compilation. \nManifest is a file that describes how HTML looks like (ie.`scripts` and `styles`), \nand we could use `PortalManifestWebpackPlugin` to generate that in compilation stage.\n\n```typescript\nimport PortalManifestWebpackPlugin from '@magic-microservices/portal-manifest-webpack-plugin'\n\n// webpack.config.js\nplugins: [\n  ...,\n  new PortalManifestWebpackPlugin()\n]\n```\n\n`PortalManifestWebpackPlugin` takes advantage of `html-webpack-plugin` under the hood. To use this plugin, make sure Webpack is using that.\n\nAfter that, each Webpack build would generate a `manifest.json` which corresponding to your HTML and you could use this file directly in `magic-portal` just like this:\n\n```html\n\u003cmagic-portal manifest='//some-where/manifest.json' /\u003e\n```\n\n\n## Inspired by\n\nMagic-portal is inspired by [Portals](https://github.com/WICG/portals) proposal, thanks!\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytedance%2Fmagic-portal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytedance%2Fmagic-portal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytedance%2Fmagic-portal/lists"}