├── .gitignore
├── .prettierrc.json
├── README.md
├── apps
├── README.md
└── components
│ ├── .gitignore
│ ├── README.md
│ ├── mitosis.config.js
│ ├── output
│ ├── marko
│ │ ├── dist
│ │ └── marko.json
│ └── vue
│ │ └── nuxt.js
│ ├── package-lock.json
│ ├── package.json
│ ├── src
│ ├── components
│ │ ├── app-header.lite.tsx
│ │ ├── dashboard.lite.tsx
│ │ ├── dashboard
│ │ │ ├── benchmarks.ts
│ │ │ ├── framework-picker.lite.tsx
│ │ │ ├── frameworks.ts
│ │ │ ├── lighthouse-data.ts
│ │ │ └── search.ts
│ │ ├── general
│ │ │ ├── accordion.lite.tsx
│ │ │ ├── carousel.lite.tsx
│ │ │ ├── chart.lite.tsx
│ │ │ ├── code-viewer.lite.tsx
│ │ │ ├── highlight.ts
│ │ │ ├── lh-report-chart.lite.tsx
│ │ │ ├── lh-report-table.lite.tsx
│ │ │ ├── lite-picker.lite.tsx
│ │ │ ├── lite-table.lite.tsx
│ │ │ ├── lite-tooltip.lite.tsx
│ │ │ ├── report-table.lits.tsx
│ │ │ └── tabs.lite.tsx
│ │ ├── hello-world.lite.tsx
│ │ ├── todo-app.lite.tsx
│ │ ├── todo-item.lite.tsx
│ │ └── utils
│ │ │ ├── generate-csv.ts
│ │ │ └── sort.ts
│ ├── index.ts
│ ├── links.ts
│ ├── reports
│ │ ├── angular_simple.ts
│ │ ├── astro_simple.ts
│ │ ├── dashboard
│ │ │ ├── angular_simple.ts
│ │ │ ├── astro_simple.ts
│ │ │ ├── fresh_simple.ts
│ │ │ ├── gatsby_simple.ts
│ │ │ ├── hydrogen_simple.ts
│ │ │ ├── lit_simple.ts
│ │ │ ├── marko_simple.ts
│ │ │ ├── next-bun_simple.ts
│ │ │ ├── next_simple.ts
│ │ │ ├── nuxt2_simple.ts
│ │ │ ├── nuxt3_simple.ts
│ │ │ ├── qwik_simple.ts
│ │ │ ├── react_simple.ts
│ │ │ ├── remix_simple.ts
│ │ │ ├── solid_simple.ts
│ │ │ ├── svelte_simple.ts
│ │ │ └── vue3_simple.ts
│ │ ├── fresh_simple.ts
│ │ ├── gatsby_simple.ts
│ │ ├── hydrogen_simple.ts
│ │ ├── lit_simple.ts
│ │ ├── marko_simple.ts
│ │ ├── next_simple.ts
│ │ ├── nuxt2_simple.ts
│ │ ├── nuxt3_simple.ts
│ │ ├── qwik_simple.ts
│ │ ├── react_simple.ts
│ │ ├── remix_simple.ts
│ │ ├── solid_simple.ts
│ │ ├── svelte_simple.ts
│ │ ├── todo
│ │ │ ├── angular_simple.ts
│ │ │ ├── astro_simple.ts
│ │ │ ├── fresh_simple.ts
│ │ │ ├── gatsby_simple.ts
│ │ │ ├── hydrogen_simple.ts
│ │ │ ├── lit_simple.ts
│ │ │ ├── marko_simple.ts
│ │ │ ├── next_simple.ts
│ │ │ ├── nuxt2_simple.ts
│ │ │ ├── nuxt3_simple.ts
│ │ │ ├── qwik_simple.ts
│ │ │ ├── react_simple.ts
│ │ │ ├── solid_simple.ts
│ │ │ ├── svelte_simple.ts
│ │ │ └── vue3_simple.ts
│ │ └── vue3_simple.ts
│ ├── root-styles.ts
│ └── utils
│ │ └── map-keys.ts
│ ├── tsconfig.json
│ └── tsconfig.node.json
├── defaultConfig.json
├── frameworks
├── angular
│ ├── .browserslistrc
│ ├── .editorconfig
│ ├── .gitignore
│ ├── .vscode
│ │ ├── extensions.json
│ │ ├── launch.json
│ │ └── tasks.json
│ ├── README.md
│ ├── angular.json
│ ├── karma.conf.js
│ ├── package-lock.json
│ ├── package.json
│ ├── server.js
│ ├── server.ts
│ ├── src
│ │ ├── app
│ │ │ ├── app-routing.module.ts
│ │ │ ├── app.component.css
│ │ │ ├── app.component.html
│ │ │ ├── app.component.ts
│ │ │ ├── app.module.ts
│ │ │ ├── app.server.module.ts
│ │ │ └── typings.d.ts
│ │ ├── assets
│ │ │ └── .gitkeep
│ │ ├── environments
│ │ │ ├── environment.prod.ts
│ │ │ └── environment.ts
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── main.server.ts
│ │ ├── main.ts
│ │ ├── polyfills.ts
│ │ ├── styles.css
│ │ └── test.ts
│ ├── tsconfig.app.json
│ ├── tsconfig.json
│ ├── tsconfig.server.json
│ └── tsconfig.spec.json
├── astro
│ ├── .gitignore
│ ├── .npmrc
│ ├── .vscode
│ │ ├── extensions.json
│ │ └── launch.json
│ ├── README.md
│ ├── astro.config.mjs
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ └── favicon.ico
│ ├── server.mjs
│ ├── src
│ │ ├── layouts
│ │ │ └── Layout.astro
│ │ └── pages
│ │ │ ├── dashboard.astro
│ │ │ ├── index.astro
│ │ │ └── todo.astro
│ └── tsconfig.json
├── fresh
│ ├── .vscode
│ │ ├── extensions.json
│ │ └── settings.json
│ ├── README.md
│ ├── components
│ │ └── Button.tsx
│ ├── deno.json
│ ├── dev.ts
│ ├── fresh.gen.ts
│ ├── import_map.json
│ ├── islands
│ │ ├── Dashboard.tsx
│ │ └── Todo.tsx
│ ├── main.ts
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ │ ├── [name].tsx
│ │ ├── api
│ │ │ └── joke.ts
│ │ ├── dashboard.tsx
│ │ ├── index.tsx
│ │ └── todo.tsx
│ ├── static
│ │ ├── favicon.ico
│ │ └── logo.svg
│ └── utils
│ │ └── twind.ts
├── gatsby
│ ├── .gitignore
│ ├── README.md
│ ├── gatsby-config.js
│ ├── package-lock.json
│ ├── package.json
│ └── src
│ │ └── pages
│ │ ├── 404.js
│ │ ├── dashboard-ssr.js
│ │ ├── dashboard.js
│ │ ├── index.js
│ │ └── todo.js
├── hydrogen
│ ├── .gitignore
│ ├── README.md
│ ├── hydrogen.config.js
│ ├── index.html
│ ├── jsconfig.json
│ ├── mini-oxygen.config.json
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ └── .gitkeep
│ ├── src
│ │ ├── App.server.jsx
│ │ ├── assets
│ │ │ └── favicon.svg
│ │ ├── components
│ │ │ ├── dashboard.client.jsx
│ │ │ └── todo-app.client.jsx
│ │ ├── index.css
│ │ └── routes
│ │ │ ├── dashboard.server.jsx
│ │ │ ├── index.server.jsx
│ │ │ └── todo.server.jsx
│ └── vite.config.js
├── lit
│ ├── .eleventy.cjs
│ ├── .eslintignore
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── .prettierrc.json
│ ├── .vscode
│ │ └── extensions.json
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── dev
│ │ ├── README.md
│ │ └── index.html
│ ├── docs-src
│ │ ├── .eleventyignore
│ │ ├── .nojekyll
│ │ ├── _README.md
│ │ ├── _data
│ │ │ └── api.11tydata.js
│ │ ├── _includes
│ │ │ ├── page.11ty.cjs
│ │ │ └── relative-path.cjs
│ │ ├── api.11ty.cjs
│ │ ├── dashboard.md
│ │ ├── docs.css
│ │ ├── index.md
│ │ ├── install.md
│ │ ├── package.json
│ │ └── todo.md
│ ├── index.html
│ ├── package-lock.json
│ ├── package.json
│ ├── rollup.config.js
│ ├── server.js
│ ├── sever.js
│ ├── src
│ │ └── typings.d.ts
│ ├── tsconfig.json
│ ├── web-dev-server.config.js
│ └── web-test-runner.config.js
├── marko
│ ├── .gitignore
│ ├── README.md
│ ├── dist
│ ├── package-lock.json
│ ├── package.json
│ └── src
│ │ ├── components
│ │ └── app-layout
│ │ │ ├── favicon.png
│ │ │ └── index.marko
│ │ └── pages
│ │ ├── dashboard.marko
│ │ ├── index.marko
│ │ └── todo.marko
├── next
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── README.md
│ ├── next-env.d.ts
│ ├── next.config.js
│ ├── package-lock.json
│ ├── package.json
│ ├── pages
│ │ ├── _app.js
│ │ ├── api
│ │ │ └── hello.js
│ │ ├── dashboard-ssr.js
│ │ ├── dashboard.js
│ │ ├── index.js
│ │ └── todo.js
│ ├── public
│ │ ├── favicon.ico
│ │ └── vercel.svg
│ └── styles
│ │ ├── Home.module.css
│ │ └── globals.css
├── nuxt2
│ ├── .editorconfig
│ ├── .gitignore
│ ├── .prettierignore
│ ├── .prettierrc
│ ├── README.md
│ ├── components
│ │ ├── NuxtLogo.vue
│ │ └── Tutorial.vue
│ ├── layouts
│ │ └── default.vue
│ ├── nuxt.config.js
│ ├── package-lock.json
│ ├── package.json
│ ├── pages
│ │ ├── dashboard.vue
│ │ ├── index.vue
│ │ └── todo.vue
│ ├── static
│ │ └── favicon.ico
│ ├── store
│ │ └── README.md
│ └── tsconfig.json
├── nuxt3
│ ├── .gitignore
│ ├── README.md
│ ├── layouts
│ │ └── default.vue
│ ├── nuxt.config.ts
│ ├── package-lock.json
│ ├── package.json
│ ├── pages
│ │ ├── dashboard-ssr.vue
│ │ ├── dashboard.vue
│ │ ├── index.vue
│ │ └── todo.vue
│ └── tsconfig.json
├── preact-ssr-node
│ ├── .gitignore
│ ├── http.jsx
│ ├── package-lock.json
│ ├── package.json
│ └── tsconfig.json
├── qwik
│ ├── .eslintignore
│ ├── .eslintrc.cjs
│ ├── .gitignore
│ ├── .prettierignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── _headers
│ │ ├── favicon.ico
│ │ ├── favicons
│ │ │ ├── android-chrome-192x192.png
│ │ │ ├── android-chrome-256x256.png
│ │ │ ├── apple-touch-icon.png
│ │ │ └── favicon.svg
│ │ └── logos
│ │ │ ├── qwik-logo.svg
│ │ │ └── qwik.svg
│ ├── src
│ │ ├── components
│ │ │ └── head
│ │ │ │ └── head.tsx
│ │ ├── entry.dev.tsx
│ │ ├── entry.express.tsx
│ │ ├── entry.http.tsx
│ │ ├── entry.ssr.tsx
│ │ ├── global.css
│ │ ├── root.tsx
│ │ ├── routes
│ │ │ ├── dashboard
│ │ │ │ └── index.tsx
│ │ │ ├── index.tsx
│ │ │ ├── layout.tsx
│ │ │ └── todo
│ │ │ │ └── index.tsx
│ │ └── typings.d.ts
│ ├── tsconfig.json
│ └── vite.config.ts
├── react-ssr-bun
│ ├── bun.lockb
│ ├── http.js
│ ├── package.json
│ └── react-dom.bun.js
├── react-ssr-deno
│ ├── deno.json
│ ├── http.jsx
│ ├── import_map.json
│ └── package.json
├── react-ssr-node
│ ├── .gitignore
│ ├── http.jsx
│ ├── package-lock.json
│ ├── package.json
│ └── tsconfig.json
├── react
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── server.js
│ └── src
│ │ ├── App.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── logo.svg
│ │ ├── reportWebVitals.js
│ │ └── setupTests.js
├── remix
│ ├── .eslintrc
│ ├── .gitignore
│ ├── README.md
│ ├── app
│ │ ├── entry.client.jsx
│ │ ├── entry.server.jsx
│ │ ├── root.jsx
│ │ └── routes
│ │ │ ├── dashboard.jsx
│ │ │ ├── index.jsx
│ │ │ └── todo.jsx
│ ├── jsconfig.json
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ └── favicon.ico
│ └── remix.config.js
├── solid-ssr-node
│ ├── .gitignore
│ ├── http.jsx
│ ├── package-lock.json
│ ├── package.json
│ └── rollup.config.js
├── solid-start
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ └── favicon.ico
│ ├── src
│ │ ├── entry-client.tsx
│ │ ├── entry-server.tsx
│ │ ├── root.css
│ │ ├── root.tsx
│ │ └── routes
│ │ │ ├── [...404].tsx
│ │ │ ├── dashboard.tsx
│ │ │ ├── index.tsx
│ │ │ └── todo.tsx
│ ├── tsconfig.json
│ ├── vite.config.ts
│ └── vite.config.ts.timestamp-1660787794719.mjs
├── svelte
│ ├── .gitignore
│ ├── .npmrc
│ ├── .prettierignore
│ ├── .prettierrc
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── src
│ │ ├── app.html
│ │ └── routes
│ │ │ ├── dashboard.svelte
│ │ │ ├── index.svelte
│ │ │ └── todo.svelte
│ ├── static
│ │ └── favicon.png
│ ├── svelte.config.js
│ └── vite.config.js
└── vue3
│ ├── .gitignore
│ ├── .vscode
│ └── extensions.json
│ ├── README.md
│ ├── env.d.ts
│ ├── index.html
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ └── favicon.ico
│ ├── src
│ ├── App.vue
│ ├── main.ts
│ ├── router
│ │ └── index.ts
│ └── views
│ │ ├── AboutView.vue
│ │ └── HomeView.vue
│ └── vite.config.ts
├── lh-config.json
├── package-lock.json
├── package.json
├── src
├── helpers
│ ├── build.ts
│ ├── get-frameworks.ts
│ ├── get-js-size.ts
│ ├── get-lighthouse-report.ts
│ ├── get-port.ts
│ ├── get-simple-report.ts
│ ├── get-table.ts
│ ├── install.ts
│ ├── kill-process.ts
│ ├── lh-config.ts
│ ├── lighthouse.d.ts
│ ├── preview.ts
│ ├── range.ts
│ └── sort-by.ts
├── scripts
│ ├── build.ts
│ ├── clean.ts
│ ├── copy.ts
│ ├── dev.ts
│ ├── gen-simple-reports.ts
│ ├── install.ts
│ ├── kill.ts
│ ├── measure-flow.ts
│ ├── measure-navigation.ts
│ ├── measure-ssr.ts
│ ├── measure-throughput.ts
│ ├── measure.ts
│ └── serve.ts
└── typings.d.ts
└── tsconfig.json
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | debug.json
4 | report.json
5 | report.js
6 | **/generated-components/**
7 |
8 | flow.report.json
9 | flow.report.html
--------------------------------------------------------------------------------
/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true
3 | }
4 |
--------------------------------------------------------------------------------
/apps/README.md:
--------------------------------------------------------------------------------
1 | # Apps
2 |
3 | Small apps written in [Mitosis](https://github.com/builderio/mitosis) that get compiled and copied to the various output frameworks
4 |
--------------------------------------------------------------------------------
/apps/components/.gitignore:
--------------------------------------------------------------------------------
1 | output/**/src
2 | **/reports/*.json
3 | **/reports/*.js
4 | **/reports/*.ts
5 | !**/reports/*_simple.ts
6 | **/reports/*/*.json
7 | **/reports/*/*.js
8 | **/reports/*/*.ts
9 | !**/reports/*/*_simple.ts
10 |
--------------------------------------------------------------------------------
/apps/components/README.md:
--------------------------------------------------------------------------------
1 | # Components
2 |
3 | Example components written in [Mitosis](https://github.com/builderio/mitosis) to compile across frameworks to measure performance.
4 |
--------------------------------------------------------------------------------
/apps/components/output/marko/dist:
--------------------------------------------------------------------------------
1 | src
--------------------------------------------------------------------------------
/apps/components/output/marko/marko.json:
--------------------------------------------------------------------------------
1 | {
2 | "tags-dir": "./src/components"
3 | }
4 |
--------------------------------------------------------------------------------
/apps/components/output/vue/nuxt.js:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | export default function () {
4 | // Make sure components is enabled
5 | if (!this.nuxt.options.components) {
6 | throw new Error(
7 | 'Please set `components: true` inside `nuxt.config` and ensure using `nuxt >= 2.13.0`'
8 | );
9 | }
10 |
11 | this.nuxt.hook('components:dirs', (dirs) => {
12 | // Add ./components dir to the list
13 | dirs.push({
14 | path: join(__dirname, 'vue2/src/components'),
15 | prefix: 'builder',
16 | });
17 | // Add ./blocks dir to the list
18 | dirs.push({
19 | path: join(__dirname, 'vue2/src/blocks'),
20 | prefix: 'builder',
21 | pattern: '**/index.*',
22 | });
23 | });
24 | }
25 |
--------------------------------------------------------------------------------
/apps/components/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@builder.io/components",
3 | "private": true,
4 | "version": "0.0.1",
5 | "scripts": {
6 | "build": "mitosis build",
7 | "copy": "cd ../../ && npm run copy",
8 | "postbuild": "npm run copy",
9 | "start": "watch 'npm run build' ./src"
10 | },
11 | "dependencies": {
12 | "@builder.io/mitosis": "^0.0.56-105",
13 | "@builder.io/mitosis-cli": "^0.0.17-96",
14 | "@popperjs/core": "^2.11.6",
15 | "fuse.js": "^6.6.2",
16 | "highlight.js": "^11.6.0",
17 | "lighthouse": "^9.6.5",
18 | "lodash": "^4.17.21",
19 | "shiki": "^0.11.0",
20 | "traverse": "^0.6.6",
21 | "watch": "^1.0.2"
22 | },
23 | "devDependencies": {
24 | "@builder.io/qwik": "0.0.38",
25 | "concurrently": "^7.3.0",
26 | "react": "^18.2.0",
27 | "react-dom": "^18.2.0",
28 | "solid-js": "^1.4.5",
29 | "solid-styled-components": "^0.28.4",
30 | "sync-directory": "^5.1.7",
31 | "ts-node": "^10.9.1",
32 | "typescript": "^4.7.4",
33 | "vue": "~2.6"
34 | },
35 | "peerDependencies": {
36 | "@builder.io/qwik": "0.0.38",
37 | "react": "^18.2.0",
38 | "react-dom": "^18.2.0",
39 | "solid-js": "^1.4.5",
40 | "solid-styled-components": "^0.28.4",
41 | "vue": "^2.6.12"
42 | },
43 | "exports": {
44 | "./vue/nuxt": "./output/vue/nuxt.js",
45 | "./vue2": "./output/vue/vue2/src/index.js",
46 | "./vue3": "./output/vue/vue3/src/index.js",
47 | "./react": "./output/react/src/index.js",
48 | "./qwik": "./output/qwik/src/index.js",
49 | "./solid": "./output/solid/src/index.js",
50 | "./svelte": "./output/svelte/src/index.js",
51 | "./angular": "./output/angular/src/index.js",
52 | "./*": "./output/*/src/index.js"
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/apps/components/src/components/dashboard.lite.tsx:
--------------------------------------------------------------------------------
1 | import { useStore } from '@builder.io/mitosis';
2 | import {
3 | dashboardDataList,
4 | todoDataList,
5 | helloWorldDataList,
6 | } from './dashboard/lighthouse-data.js';
7 | import LhReportTable from './general/lh-report-table.lite';
8 |
9 | export default function Dashboard() {
10 | const state = useStore({});
11 |
12 | return (
13 |
18 |
23 |
28 |
33 |
34 | );
35 | }
36 |
--------------------------------------------------------------------------------
/apps/components/src/components/dashboard/benchmarks.ts:
--------------------------------------------------------------------------------
1 | export type Benchmark = 'todo' | 'hello world' | 'dashboard';
2 |
3 | export const benchmarks: Benchmark[] = ['todo', 'hello world', 'dashboard'];
4 |
--------------------------------------------------------------------------------
/apps/components/src/components/dashboard/framework-picker.lite.tsx:
--------------------------------------------------------------------------------
1 | import { useStore } from '@builder.io/mitosis';
2 | import { Framework } from './frameworks';
3 | import { fuse } from './search';
4 |
5 | export interface FrameworkPickerProps {
6 | value: Framework;
7 | onChange: (framework: Framework) => void;
8 | }
9 |
10 | export default function FrameworkPicker(props: FrameworkPickerProps) {
11 | const state = useStore({
12 | searchString: '',
13 | openDropdown: false,
14 | getFilteredResults() {
15 | return fuse.search(state.searchString);
16 | },
17 | });
18 | return (
19 |
20 |
(state.openDropdown = !state.openDropdown)}>
21 | {props.value}
22 |
23 | {state.openDropdown && (
24 |
25 | (state.searchString = event.target.value)}
28 | />
29 | {state.getFilteredResults().map((result) => (
30 | {
32 | props.onChange(result.item);
33 | }}
34 | css={{
35 | all: 'unset',
36 | }}
37 | >
38 | {result.item}
39 |
40 | ))}
41 |
42 | )}
43 |
44 | );
45 | }
46 |
--------------------------------------------------------------------------------
/apps/components/src/components/dashboard/frameworks.ts:
--------------------------------------------------------------------------------
1 | export type Framework =
2 | | 'angular'
3 | | 'astro'
4 | | 'fresh'
5 | | 'gatsby'
6 | | 'hydrogen'
7 | | 'lit'
8 | | 'marko'
9 | | 'next'
10 | | 'nuxt2'
11 | | 'nuxt3'
12 | | 'qwik'
13 | | 'solid-start'
14 | | 'svelte';
15 |
16 | export const frameworks: Framework[] = [
17 | 'angular',
18 | 'astro',
19 | 'fresh',
20 | 'gatsby',
21 | 'hydrogen',
22 | 'lit',
23 | 'marko',
24 | 'next',
25 | 'nuxt2',
26 | 'nuxt3',
27 | 'qwik',
28 | 'solid-start',
29 | 'svelte',
30 | ];
31 |
--------------------------------------------------------------------------------
/apps/components/src/components/dashboard/search.ts:
--------------------------------------------------------------------------------
1 | import Fuse from 'fuse.js';
2 | import { frameworks } from './frameworks';
3 |
4 | export const fuse = new Fuse(frameworks);
5 |
--------------------------------------------------------------------------------
/apps/components/src/components/general/accordion.lite.tsx:
--------------------------------------------------------------------------------
1 | import { useStore } from '@builder.io/mitosis';
2 |
3 | export type AccordionProps = {};
4 |
5 | export default function Accordion(props: AccordionProps) {
6 | const state = useStore({
7 | activeTab: 0,
8 | });
9 |
10 | return {/* TODO */}
;
11 | }
12 |
--------------------------------------------------------------------------------
/apps/components/src/components/general/carousel.lite.tsx:
--------------------------------------------------------------------------------
1 | import { useStore } from '@builder.io/mitosis';
2 |
3 | export type CarouselProps = {};
4 |
5 | export default function Carousel(props: CarouselProps) {
6 | const state = useStore({
7 | activeSlide: 0,
8 | nextSlide() {
9 | state.activeSlide = state.activeSlide + 1;
10 | },
11 | prevSlide() {
12 | state.activeSlide = state.activeSlide - 1;
13 | },
14 | onScroll(event: UIEvent) {},
15 | });
16 |
17 | return (
18 | state.onScroll(event)}
20 | css={{
21 | overflow: 'auto',
22 | scrollSnapType: 'x mandatory',
23 | scrollSnapAlign: 'center',
24 | }}
25 | >
26 | {
28 | state.prevSlide();
29 | }}
30 | >
31 | Prev Slide
32 |
33 | {/* TODO: stuff inside */}
34 | {
36 | state.nextSlide();
37 | }}
38 | >
39 | Next Slide
40 |
41 |
42 | );
43 | }
44 |
--------------------------------------------------------------------------------
/apps/components/src/components/general/chart.lite.tsx:
--------------------------------------------------------------------------------
1 | import { useStore } from '@builder.io/mitosis';
2 |
3 | export interface ChartProps {
4 | data: any[];
5 | }
6 |
7 | export default function Chart(props: ChartProps) {
8 | const state = useStore({});
9 | return
;
10 | }
11 |
--------------------------------------------------------------------------------
/apps/components/src/components/general/code-viewer.lite.tsx:
--------------------------------------------------------------------------------
1 | import { hljs } from './highlight.js';
2 |
3 | export type CodeViewerProps = {
4 | code: string;
5 | language: 'json' | 'javascript' | 'typescript';
6 | style?: any;
7 | };
8 |
9 | export default function CodeViewer(props: CodeViewerProps) {
10 | return (
11 |
34 | );
35 | }
36 |
--------------------------------------------------------------------------------
/apps/components/src/components/general/highlight.ts:
--------------------------------------------------------------------------------
1 | import hljs from 'highlight.js/lib/core';
2 | import json from 'highlight.js/lib/languages/json';
3 | import javascript from 'highlight.js/lib/languages/javascript';
4 | import typescript from 'highlight.js/lib/languages/typescript';
5 |
6 | hljs.registerLanguage('json', json);
7 | hljs.registerLanguage('javascript', javascript);
8 | hljs.registerLanguage('javascript', typescript);
9 |
10 | export { hljs };
11 |
--------------------------------------------------------------------------------
/apps/components/src/components/general/lh-report-chart.lite.tsx:
--------------------------------------------------------------------------------
1 | import { useStore } from '@builder.io/mitosis';
2 | import { LighthouseDataWithName } from '../dashboard/lighthouse-data.js';
3 |
4 | export interface LhReportChartProps {
5 | data: LighthouseDataWithName[];
6 | }
7 |
8 | export default function LhReportChart(props: LhReportChartProps) {
9 | const state = useStore({
10 | displayCols: ['ttiNumber', 'tbtNumber', 'fcpNumber'],
11 | maxHeight: 500,
12 | getMaxValue() {
13 | return props.data.reduce((memo, row) => {
14 | const ttiNumber = row.ttiNumber!;
15 | const tbtNumber = row.tbtNumber!;
16 | const fcpNumber = row.fcpNumber!;
17 | return Math.max(memo, ttiNumber, tbtNumber, fcpNumber);
18 | }, 0);
19 | },
20 | });
21 |
22 | return (
23 | <>
24 |
25 |
26 | {props.data.map((row) => (
27 |
{/* Bars */}
28 | ))}
29 |
30 |
{/* Labels */}
31 |
32 | >
33 | );
34 | }
35 |
--------------------------------------------------------------------------------
/apps/components/src/components/general/lite-tooltip.lite.tsx:
--------------------------------------------------------------------------------
1 | import { onUpdate, useRef, useStore } from '@builder.io/mitosis';
2 | import { createPopper, Placement, Options } from '@popperjs/core';
3 |
4 | export type TooltipProps = {
5 | text: string;
6 | tooltipText: string;
7 | placement?: Placement;
8 | options?: Options;
9 | };
10 |
11 | export default function LiteTooltip(props: TooltipProps) {
12 | const state = useStore({
13 | open: false,
14 | });
15 |
16 | const containerRef = useRef();
17 | const popperRef = useRef();
18 |
19 | onUpdate(() => {
20 | if (state.open) {
21 | createPopper(containerRef, popperRef, {
22 | placement: props.placement || 'auto',
23 | ...props.options,
24 | });
25 | }
26 | }, [state.open]);
27 |
28 | return (
29 | (state.open = true)}
32 | onMouseLeave={() => (state.open = false)}
33 | css={{
34 | position: 'relative',
35 | }}
36 | >
37 | {props.text}
38 | {state.open && (
39 |
51 | {props.tooltipText}
52 |
53 | )}
54 |
55 | );
56 | }
57 |
--------------------------------------------------------------------------------
/apps/components/src/components/general/report-table.lits.tsx:
--------------------------------------------------------------------------------
1 | export default function ReportTable() {
2 | return
;
3 | }
4 |
--------------------------------------------------------------------------------
/apps/components/src/components/general/tabs.lite.tsx:
--------------------------------------------------------------------------------
1 | import { useStore } from '@builder.io/mitosis';
2 |
3 | export type TabsProps = {};
4 |
5 | export default function Tabs(props: TabsProps) {
6 | const state = useStore({
7 | activeTab: 0,
8 | });
9 |
10 | return {/* TODO */}
;
11 | }
12 |
--------------------------------------------------------------------------------
/apps/components/src/components/hello-world.lite.tsx:
--------------------------------------------------------------------------------
1 | export default function HelloWorld(props: { name?: string }) {
2 | return (
3 |
9 | Hello {props.name || 'world'}
10 |
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/apps/components/src/components/todo-item.lite.tsx:
--------------------------------------------------------------------------------
1 | import type { Todo } from './todo-app.lite';
2 |
3 | export type TodoItemProps = {
4 | item: Todo;
5 | index: number;
6 | };
7 |
8 | export default function TodoItem(props: TodoItemProps) {
9 | return (
10 |
20 | {
27 | props.item.completed = event.target.checked;
28 | }}
29 | />
30 | {
36 | props.item.text = event.target.value;
37 | }}
38 | />
39 |
40 | );
41 | }
42 |
--------------------------------------------------------------------------------
/apps/components/src/components/utils/generate-csv.ts:
--------------------------------------------------------------------------------
1 | export function downloadFile(name: string, contents: string) {
2 | const link = document.createElement('a');
3 | link.setAttribute('download', name);
4 | link.href = URL.createObjectURL(
5 | new Blob([contents], {
6 | type: 'text/csv',
7 | })
8 | );
9 | document.body.appendChild(link);
10 | link.click();
11 | link.remove();
12 | }
13 |
14 | function escapeQuote(str: string) {
15 | return String(str).replace(/"/g, '""');
16 | }
17 |
18 | export function downloadCsv(data: any[], name = 'results.csv') {
19 | const rows = data;
20 | const keys = Object.keys(rows[0] || {});
21 | const csv = [
22 | keys.map((key) => `"${escapeQuote(key)}"`).join(','),
23 | ...rows.map((obj: any) => {
24 | return keys.map((key) => `"${escapeQuote(obj[key])}"`).join(',');
25 | }),
26 | ];
27 | downloadFile(name, csv.join('\n'));
28 | }
29 |
--------------------------------------------------------------------------------
/apps/components/src/components/utils/sort.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Usage: array.sort(sortBy('key'))
3 | */
4 | export const sortBy = (key: any) => {
5 | return (a: any, b: any) => (a[key] > b[key] ? 1 : b[key] > a[key] ? -1 : 0);
6 | };
7 |
8 | export const sortByNumeric = (key: any) => {
9 | return (a: any, b: any) => {
10 | let aVal = parseFloat(a[key]);
11 | let bVal = parseFloat(b[key]);
12 |
13 | if (isNaN(aVal)) {
14 | aVal = a[key];
15 | }
16 | if (isNaN(bVal)) {
17 | bVal = b[key];
18 | }
19 |
20 | return aVal > bVal ? 1 : bVal > aVal ? -1 : 0;
21 | };
22 | };
23 |
--------------------------------------------------------------------------------
/apps/components/src/index.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | export { default as ToDoApp } from './components/todo-app.lite';
4 | export { default as HelloWorld } from './components/hello-world.lite';
5 | export { default as AppHeader } from './components/app-header.lite';
6 |
--------------------------------------------------------------------------------
/apps/components/src/reports/angular_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 72,
3 | "totalKb": 74,
4 | "fcpDisplay": "1.5 s",
5 | "fcpNumber": 1523.7797,
6 | "tbtDisplay": "150 ms",
7 | "tbtNumber": 148.80869999999993,
8 | "ttiDisplay": "1.7 s",
9 | "ttiNumber": 1732.7797,
10 | "lcpDisplay": "1.5 s",
11 | "lcpNumber": 1523.7797,
12 | "score": 98
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/astro_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 0,
3 | "totalKb": 9,
4 | "fcpDisplay": "0.7 s",
5 | "fcpNumber": 659.3279,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.7 s",
9 | "ttiNumber": 659.3279,
10 | "lcpDisplay": "0.7 s",
11 | "lcpNumber": 659.3279,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/angular_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 272,
3 | "totalKb": 299,
4 | "fcpDisplay": "2.6 s",
5 | "fcpNumber": 2573.346925,
6 | "tbtDisplay": "210 ms",
7 | "tbtNumber": 210,
8 | "ttiDisplay": "2.8 s",
9 | "ttiNumber": 2843.35275,
10 | "lcpDisplay": "2.6 s",
11 | "lcpNumber": 2573.346925,
12 | "score": 89
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/astro_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 3,
3 | "totalKb": 37,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 795.9838,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.9 s",
9 | "ttiNumber": 925.9676,
10 | "lcpDisplay": "1.1 s",
11 | "lcpNumber": 1130.9514,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/fresh_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 17,
3 | "totalKb": 46,
4 | "fcpDisplay": "1.1 s",
5 | "fcpNumber": 1054.1068500000001,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "1.1 s",
9 | "ttiNumber": 1054.1068500000001,
10 | "lcpDisplay": "1.1 s",
11 | "lcpNumber": 1054.1068500000001,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/gatsby_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 83,
3 | "totalKb": 88,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 759.2629999999999,
6 | "tbtDisplay": "10 ms",
7 | "tbtNumber": 5.5,
8 | "ttiDisplay": "1.2 s",
9 | "ttiNumber": 1191.7102499999999,
10 | "lcpDisplay": "1.1 s",
11 | "lcpNumber": 1134.2102499999999,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/hydrogen_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 44,
3 | "totalKb": 68,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 768.11625,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.8 s",
9 | "ttiNumber": 792.61625,
10 | "lcpDisplay": "1.3 s",
11 | "lcpNumber": 1297.2325,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/lit_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 23,
3 | "totalKb": 25,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 752.5255999999999,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.8 s",
9 | "ttiNumber": 763.0255999999999,
10 | "lcpDisplay": "1.1 s",
11 | "lcpNumber": 1129.4198,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/marko_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 24,
3 | "totalKb": 38,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 755.6697999999999,
6 | "tbtDisplay": "10 ms",
7 | "tbtNumber": 12.5,
8 | "ttiDisplay": "1.0 s",
9 | "ttiNumber": 1022.42215,
10 | "lcpDisplay": "1.1 s",
11 | "lcpNumber": 1133.5047,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/next-bun_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 91,
3 | "totalKb": 104,
4 | "fcpDisplay": "0.7 s",
5 | "fcpNumber": 655.32395,
6 | "tbtDisplay": "30 ms",
7 | "tbtNumber": 31,
8 | "ttiDisplay": "2.2 s",
9 | "ttiNumber": 2215.605675,
10 | "lcpDisplay": "2.1 s",
11 | "lcpNumber": 2137.9437,
12 | "score": 99
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/next_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 92,
3 | "totalKb": 104,
4 | "fcpDisplay": "0.7 s",
5 | "fcpNumber": 667.1722,
6 | "tbtDisplay": "10 ms",
7 | "tbtNumber": 10.5,
8 | "ttiDisplay": "1.7 s",
9 | "ttiNumber": 1678.0331999999999,
10 | "lcpDisplay": "1.2 s",
11 | "lcpNumber": 1215.4305,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/nuxt2_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 107,
3 | "totalKb": 118,
4 | "fcpDisplay": "1.4 s",
5 | "fcpNumber": 1377.138225,
6 | "tbtDisplay": "190 ms",
7 | "tbtNumber": 189,
8 | "ttiDisplay": "1.9 s",
9 | "ttiNumber": 1879.274175,
10 | "lcpDisplay": "1.4 s",
11 | "lcpNumber": 1377.138225,
12 | "score": 97
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/nuxt3_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 3784,
3 | "totalKb": 3801,
4 | "fcpDisplay": "20.8 s",
5 | "fcpNumber": 20793.972499999996,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 1,
8 | "ttiDisplay": "20.8 s",
9 | "ttiNumber": 20793.972499999996,
10 | "lcpDisplay": "21.0 s",
11 | "lcpNumber": 21011.367,
12 | "score": 45
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/qwik_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 2,
3 | "totalKb": 38,
4 | "fcpDisplay": "0.6 s",
5 | "fcpNumber": 635.10875,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.6 s",
9 | "ttiNumber": 646.10875,
10 | "lcpDisplay": "1.5 s",
11 | "lcpNumber": 1483.9893749999997,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/react_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 187,
3 | "totalKb": 199,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 752.2442000000001,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0.5,
8 | "ttiDisplay": "2.0 s",
9 | "ttiNumber": 2025.9884000000002,
10 | "lcpDisplay": "2.4 s",
11 | "lcpNumber": 2423.17155,
12 | "score": 98
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/remix_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 71,
3 | "totalKb": 77,
4 | "fcpDisplay": "1.8 s",
5 | "fcpNumber": 1769.4123249999998,
6 | "tbtDisplay": "30 ms",
7 | "tbtNumber": 34,
8 | "ttiDisplay": "1.9 s",
9 | "ttiNumber": 1933.3054749999997,
10 | "lcpDisplay": "1.8 s",
11 | "lcpNumber": 1769.4123249999998,
12 | "score": 99
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/solid_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 24,
3 | "totalKb": 29,
4 | "fcpDisplay": "0.6 s",
5 | "fcpNumber": 634.52195,
6 | "tbtDisplay": "10 ms",
7 | "tbtNumber": 9.5,
8 | "ttiDisplay": "0.9 s",
9 | "ttiNumber": 872.304875,
10 | "lcpDisplay": "1.3 s",
11 | "lcpNumber": 1262.60975,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/svelte_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 29,
3 | "totalKb": 35,
4 | "fcpDisplay": "1.5 s",
5 | "fcpNumber": 1542.0183499999998,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 4.5,
8 | "ttiDisplay": "1.5 s",
9 | "ttiNumber": 1542.0183499999998,
10 | "lcpDisplay": "1.5 s",
11 | "lcpNumber": 1542.0183499999998,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/dashboard/vue3_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 41,
3 | "totalKb": 50,
4 | "fcpDisplay": "1.2 s",
5 | "fcpNumber": 1206.6862,
6 | "tbtDisplay": "10 ms",
7 | "tbtNumber": 7.5,
8 | "ttiDisplay": "1.8 s",
9 | "ttiNumber": 1768.3650750000002,
10 | "lcpDisplay": "2.1 s",
11 | "lcpNumber": 2146.708175,
12 | "score": 94
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/fresh_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 0,
3 | "totalKb": 27,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 753.7646,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.8 s",
9 | "ttiNumber": 753.7646,
10 | "lcpDisplay": "0.8 s",
11 | "lcpNumber": 753.7646,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/gatsby_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 69,
3 | "totalKb": 73,
4 | "fcpDisplay": "0.6 s",
5 | "fcpNumber": 635.98915,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 3,
8 | "ttiDisplay": "1.4 s",
9 | "ttiNumber": 1414.96745,
10 | "lcpDisplay": "1.0 s",
11 | "lcpNumber": 982.472875,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/hydrogen_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 160,
3 | "totalKb": 172,
4 | "fcpDisplay": "0.6 s",
5 | "fcpNumber": 641.10705,
6 | "tbtDisplay": "30 ms",
7 | "tbtNumber": 34.5,
8 | "ttiDisplay": "1.8 s",
9 | "ttiNumber": 1790.2141,
10 | "lcpDisplay": "1.6 s",
11 | "lcpNumber": 1581.2141000000001,
12 | "score": 91
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/lit_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 15,
3 | "totalKb": 16,
4 | "fcpDisplay": "0.6 s",
5 | "fcpNumber": 639.52875,
6 | "tbtDisplay": "10 ms",
7 | "tbtNumber": 8.5,
8 | "ttiDisplay": "0.8 s",
9 | "ttiNumber": 820.5574999999999,
10 | "lcpDisplay": "0.9 s",
11 | "lcpNumber": 928.8218749999999,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/marko_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 15,
3 | "totalKb": 21,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 770.1965,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.8 s",
9 | "ttiNumber": 770.1965,
10 | "lcpDisplay": "1.1 s",
11 | "lcpNumber": 1090.393,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/next_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 82,
3 | "totalKb": 93,
4 | "fcpDisplay": "0.7 s",
5 | "fcpNumber": 652.89135,
6 | "tbtDisplay": "40 ms",
7 | "tbtNumber": 43,
8 | "ttiDisplay": "2.1 s",
9 | "ttiNumber": 2067.9024249999998,
10 | "lcpDisplay": "0.8 s",
11 | "lcpNumber": 824.7827,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/nuxt2_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 93,
3 | "totalKb": 103,
4 | "fcpDisplay": "0.9 s",
5 | "fcpNumber": 916.9411249999999,
6 | "tbtDisplay": "120 ms",
7 | "tbtNumber": 119,
8 | "ttiDisplay": "1.5 s",
9 | "ttiNumber": 1546.1058,
10 | "lcpDisplay": "0.9 s",
11 | "lcpNumber": 916.9411249999999,
12 | "score": 99
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/nuxt3_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 122,
3 | "totalKb": 130,
4 | "fcpDisplay": "2.0 s",
5 | "fcpNumber": 2006.986875,
6 | "tbtDisplay": "10 ms",
7 | "tbtNumber": 12.5,
8 | "ttiDisplay": "2.0 s",
9 | "ttiNumber": 2006.986875,
10 | "lcpDisplay": "2.2 s",
11 | "lcpNumber": 2169.650625,
12 | "score": 97
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/qwik_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 0,
3 | "totalKb": 4,
4 | "fcpDisplay": "0.7 s",
5 | "fcpNumber": 654.4676,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.7 s",
9 | "ttiNumber": 654.4676,
10 | "lcpDisplay": "0.7 s",
11 | "lcpNumber": 654.4676,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/react_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 154,
3 | "totalKb": 166,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 753.4726,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.8 s",
9 | "ttiNumber": 753.4726,
10 | "lcpDisplay": "2.2 s",
11 | "lcpNumber": 2229.6815,
12 | "score": 99
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/remix_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 358,
3 | "totalKb": 363,
4 | "fcpDisplay": "1.3 s",
5 | "fcpNumber": 1300.179675,
6 | "tbtDisplay": "240 ms",
7 | "tbtNumber": 242,
8 | "ttiDisplay": "3.6 s",
9 | "ttiNumber": 3628.353775,
10 | "lcpDisplay": "1.3 s",
11 | "lcpNumber": 1300.179675,
12 | "score": 94
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/solid_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 16,
3 | "totalKb": 18,
4 | "fcpDisplay": "0.9 s",
5 | "fcpNumber": 866.5088750000001,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.9 s",
9 | "ttiNumber": 866.5088750000001,
10 | "lcpDisplay": "1.1 s",
11 | "lcpNumber": 1101.1124250000003,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/svelte_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 18,
3 | "totalKb": 22,
4 | "fcpDisplay": "1.5 s",
5 | "fcpNumber": 1453.37625,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "1.5 s",
9 | "ttiNumber": 1453.37625,
10 | "lcpDisplay": "1.5 s",
11 | "lcpNumber": 1453.37625,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/angular_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 72,
3 | "totalKb": 74,
4 | "fcpDisplay": "1.5 s",
5 | "fcpNumber": 1535.190575,
6 | "tbtDisplay": "30 ms",
7 | "tbtNumber": 33.91832499999998,
8 | "ttiDisplay": "1.6 s",
9 | "ttiNumber": 1634.190575,
10 | "lcpDisplay": "1.6 s",
11 | "lcpNumber": 1584.690575,
12 | "score": 99
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/astro_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 20,
3 | "totalKb": 32,
4 | "fcpDisplay": "0.6 s",
5 | "fcpNumber": 642.60405,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.6 s",
9 | "ttiNumber": 642.60405,
10 | "lcpDisplay": "0.6 s",
11 | "lcpNumber": 642.60405,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/fresh_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 9,
3 | "totalKb": 37,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 754.8344999999999,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.8 s",
9 | "ttiNumber": 754.8344999999999,
10 | "lcpDisplay": "0.9 s",
11 | "lcpNumber": 906.0431249999999,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/gatsby_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 70,
3 | "totalKb": 75,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 801.5748000000001,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 4,
8 | "ttiDisplay": "1.6 s",
9 | "ttiNumber": 1583.1496,
10 | "lcpDisplay": "1.1 s",
11 | "lcpNumber": 1147.0059,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/hydrogen_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 163,
3 | "totalKb": 178,
4 | "fcpDisplay": "0.6 s",
5 | "fcpNumber": 638.73715,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.6 s",
9 | "ttiNumber": 638.73715,
10 | "lcpDisplay": "1.6 s",
11 | "lcpNumber": 1582.4742999999999,
12 | "score": 91
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/lit_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 16,
3 | "totalKb": 18,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 759.2055,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.8 s",
9 | "ttiNumber": 759.2055,
10 | "lcpDisplay": "1.1 s",
11 | "lcpNumber": 1066.109625,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/marko_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 17,
3 | "totalKb": 23,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 778.1565,
6 | "tbtDisplay": "10 ms",
7 | "tbtNumber": 8,
8 | "ttiDisplay": "1.1 s",
9 | "ttiNumber": 1057.273875,
10 | "lcpDisplay": "0.9 s",
11 | "lcpNumber": 942.2347500000001,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/next_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 83,
3 | "totalKb": 94,
4 | "fcpDisplay": "0.7 s",
5 | "fcpNumber": 676.1899,
6 | "tbtDisplay": "110 ms",
7 | "tbtNumber": 110,
8 | "ttiDisplay": "2.2 s",
9 | "ttiNumber": 2169.0444499999994,
10 | "lcpDisplay": "0.8 s",
11 | "lcpNumber": 845.3797999999999,
12 | "score": 99
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/nuxt2_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 95,
3 | "totalKb": 106,
4 | "fcpDisplay": "1.0 s",
5 | "fcpNumber": 997.0992,
6 | "tbtDisplay": "40 ms",
7 | "tbtNumber": 41,
8 | "ttiDisplay": "1.6 s",
9 | "ttiNumber": 1613.0992,
10 | "lcpDisplay": "1.0 s",
11 | "lcpNumber": 997.0992,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/nuxt3_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 122,
3 | "totalKb": 131,
4 | "fcpDisplay": "2.2 s",
5 | "fcpNumber": 2166.76525,
6 | "tbtDisplay": "10 ms",
7 | "tbtNumber": 8.5,
8 | "ttiDisplay": "2.2 s",
9 | "ttiNumber": 2166.76525,
10 | "lcpDisplay": "2.3 s",
11 | "lcpNumber": 2260.9917750000004,
12 | "score": 96
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/qwik_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 2,
3 | "totalKb": 25,
4 | "fcpDisplay": "0.7 s",
5 | "fcpNumber": 650.44375,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.7 s",
9 | "ttiNumber": 650.44375,
10 | "lcpDisplay": "1.2 s",
11 | "lcpNumber": 1219.053125,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/react_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 159,
3 | "totalKb": 171,
4 | "fcpDisplay": "0.8 s",
5 | "fcpNumber": 753.8594,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "0.8 s",
9 | "ttiNumber": 753.8594,
10 | "lcpDisplay": "2.2 s",
11 | "lcpNumber": 2225.6485000000002,
12 | "score": 99
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/solid_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 17,
3 | "totalKb": 19,
4 | "fcpDisplay": "0.7 s",
5 | "fcpNumber": 673.5325,
6 | "tbtDisplay": "40 ms",
7 | "tbtNumber": 39,
8 | "ttiDisplay": "1.0 s",
9 | "ttiNumber": 1047.3312500000002,
10 | "lcpDisplay": "1.3 s",
11 | "lcpNumber": 1316.6625000000001,
12 | "score": 86
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/svelte_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 19,
3 | "totalKb": 24,
4 | "fcpDisplay": "1.5 s",
5 | "fcpNumber": 1467.396,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 0,
8 | "ttiDisplay": "1.5 s",
9 | "ttiNumber": 1467.396,
10 | "lcpDisplay": "1.5 s",
11 | "lcpNumber": 1467.396,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/todo/vue3_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 33,
3 | "totalKb": 41,
4 | "fcpDisplay": "1.2 s",
5 | "fcpNumber": 1207.7398,
6 | "tbtDisplay": "10 ms",
7 | "tbtNumber": 8.5,
8 | "ttiDisplay": "1.2 s",
9 | "ttiNumber": 1241.2398,
10 | "lcpDisplay": "1.8 s",
11 | "lcpNumber": 1815.4796000000003,
12 | "score": 99
13 | }
--------------------------------------------------------------------------------
/apps/components/src/reports/vue3_simple.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | "jsKb": 31,
3 | "totalKb": 38,
4 | "fcpDisplay": "1.2 s",
5 | "fcpNumber": 1206.7486,
6 | "tbtDisplay": "0 ms",
7 | "tbtNumber": 4,
8 | "ttiDisplay": "1.2 s",
9 | "ttiNumber": 1235.7486,
10 | "lcpDisplay": "1.5 s",
11 | "lcpNumber": 1510.1228999999998,
12 | "score": 100
13 | }
--------------------------------------------------------------------------------
/apps/components/src/root-styles.ts:
--------------------------------------------------------------------------------
1 | export const rootStyles = `
2 | :root {
3 | /* Space */
4 | --s1: 5px;
5 | --s2: calc(var(--s1) * 2);
6 | --s3: calc(var(--s1) * 4);
7 | --gray-1: #eee;
8 | --gray-2: #bbb;
9 | --gray-3: #999;
10 | --gray-4: #666;
11 | --gray-5: #333;
12 | --border-gray: 1px solid var(--gray-2);
13 | --shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
14 | --shadow-2: 0 1px 10px rgba(0, 0, 0, 0.1);
15 | --round: 4px;
16 | --primary: rgb(26, 115, 232);
17 | --mobile: 640px;
18 | --font-medium: 400;
19 | }
20 |
21 | ul, ol {
22 | list-style-type: none;
23 | margin: 0;
24 | padding: 0;
25 | }
26 |
27 | body {
28 | margin: 0;
29 | font-family: Avenir, Helvetica, sans-serif;
30 | }
31 |
32 | a {
33 | text-decoration: none;
34 | }
35 | `;
36 |
37 | export const rootStylesTag = ``;
38 |
--------------------------------------------------------------------------------
/apps/components/src/utils/map-keys.ts:
--------------------------------------------------------------------------------
1 | export function mapValues(
2 | obj: { [key: string]: T },
3 | fn: (value: T, key: string) => U
4 | ): { [key: string]: U } {
5 | return Object.keys(obj).reduce((result, key) => {
6 | result[key] = fn(obj[key], key);
7 | return result;
8 | }, {} as { [key: string]: U });
9 | }
10 |
--------------------------------------------------------------------------------
/apps/components/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "strict": true,
5 | "jsx": "preserve",
6 | "module": "ES2022",
7 | "moduleResolution": "node",
8 | "resolveJsonModule": true,
9 | "jsxImportSource": "@builder.io/mitosis"
10 | },
11 | "include": ["src", "cases", "reports"],
12 | "references": [{ "path": "./tsconfig.node.json" }]
13 | }
14 |
--------------------------------------------------------------------------------
/apps/components/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "module": "CommonJS",
5 | "moduleResolution": "node",
6 | "esModuleInterop": true
7 | },
8 | "include": ["e2e.ts"]
9 | }
10 |
--------------------------------------------------------------------------------
/frameworks/angular/.browserslistrc:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # For the full list of supported browsers by the Angular framework, please see:
6 | # https://angular.io/guide/browser-support
7 |
8 | # You can see what browsers were selected by your queries by running:
9 | # npx browserslist
10 |
11 | last 1 Chrome version
12 | last 1 Firefox version
13 | last 2 Edge major versions
14 | last 2 Safari major versions
15 | last 2 iOS major versions
16 | Firefox ESR
17 |
--------------------------------------------------------------------------------
/frameworks/angular/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.ts]
12 | quote_type = single
13 |
14 | [*.md]
15 | max_line_length = off
16 | trim_trailing_whitespace = false
17 |
--------------------------------------------------------------------------------
/frameworks/angular/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # Compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 | /bazel-out
8 |
9 | # Node
10 | /node_modules
11 | npm-debug.log
12 | yarn-error.log
13 |
14 | # IDEs and editors
15 | .idea/
16 | .project
17 | .classpath
18 | .c9/
19 | *.launch
20 | .settings/
21 | *.sublime-workspace
22 |
23 | # Visual Studio Code
24 | .vscode/*
25 | !.vscode/settings.json
26 | !.vscode/tasks.json
27 | !.vscode/launch.json
28 | !.vscode/extensions.json
29 | .history/*
30 |
31 | # Miscellaneous
32 | /.angular/cache
33 | .sass-cache/
34 | /connect.lock
35 | /coverage
36 | /libpeerconnection.log
37 | testem.log
38 | /typings
39 |
40 | # System files
41 | .DS_Store
42 | Thumbs.db
43 |
--------------------------------------------------------------------------------
/frameworks/angular/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
3 | "recommendations": ["angular.ng-template"]
4 | }
5 |
--------------------------------------------------------------------------------
/frameworks/angular/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3 | "version": "0.2.0",
4 | "configurations": [
5 | {
6 | "name": "ng serve",
7 | "type": "pwa-chrome",
8 | "request": "launch",
9 | "preLaunchTask": "npm: start",
10 | "url": "http://localhost:4200/"
11 | },
12 | {
13 | "name": "ng test",
14 | "type": "chrome",
15 | "request": "launch",
16 | "preLaunchTask": "npm: test",
17 | "url": "http://localhost:9876/debug.html"
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/frameworks/angular/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3 | "version": "2.0.0",
4 | "tasks": [
5 | {
6 | "type": "npm",
7 | "script": "start",
8 | "isBackground": true,
9 | "problemMatcher": {
10 | "owner": "typescript",
11 | "pattern": "$tsc",
12 | "background": {
13 | "activeOnStart": true,
14 | "beginsPattern": {
15 | "regexp": "(.*?)"
16 | },
17 | "endsPattern": {
18 | "regexp": "bundle generation complete"
19 | }
20 | }
21 | }
22 | },
23 | {
24 | "type": "npm",
25 | "script": "test",
26 | "isBackground": true,
27 | "problemMatcher": {
28 | "owner": "typescript",
29 | "pattern": "$tsc",
30 | "background": {
31 | "activeOnStart": true,
32 | "beginsPattern": {
33 | "regexp": "(.*?)"
34 | },
35 | "endsPattern": {
36 | "regexp": "bundle generation complete"
37 | }
38 | }
39 | }
40 | }
41 | ]
42 | }
43 |
--------------------------------------------------------------------------------
/frameworks/angular/README.md:
--------------------------------------------------------------------------------
1 | # Angular
2 |
3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.1.1.
4 |
5 | ## Development server
6 |
7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
8 |
9 | ## Code scaffolding
10 |
11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12 |
13 | ## Build
14 |
15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
16 |
17 | ## Running unit tests
18 |
19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20 |
21 | ## Running end-to-end tests
22 |
23 | Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
24 |
25 | ## Further help
26 |
27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
28 |
--------------------------------------------------------------------------------
/frameworks/angular/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | jasmine: {
17 | // you can add configuration options for Jasmine here
18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19 | // for example, you can disable the random execution with `random: false`
20 | // or set a specific seed with `seed: 4321`
21 | },
22 | clearContext: false // leave Jasmine Spec Runner output visible in browser
23 | },
24 | jasmineHtmlReporter: {
25 | suppressAll: true // removes the duplicated traces
26 | },
27 | coverageReporter: {
28 | dir: require('path').join(__dirname, './coverage/angular'),
29 | subdir: '.',
30 | reporters: [
31 | { type: 'html' },
32 | { type: 'text-summary' }
33 | ]
34 | },
35 | reporters: ['progress', 'kjhtml'],
36 | port: 9876,
37 | colors: true,
38 | logLevel: config.LOG_INFO,
39 | autoWatch: true,
40 | browsers: ['Chrome'],
41 | singleRun: false,
42 | restartOnFileChange: true
43 | });
44 | };
45 |
--------------------------------------------------------------------------------
/frameworks/angular/server.js:
--------------------------------------------------------------------------------
1 | const http = require('http');
2 | const express = require('express');
3 | const compression = require('compression');
4 | const path = require('path');
5 |
6 | const app = express();
7 |
8 | app.use(compression());
9 | app.use(express.json());
10 | app.use(express.static('dist/angular'));
11 |
12 | app.use('/', function (req, res) {
13 | res.sendFile(path.join(__dirname + '/dist/angular/index.html'));
14 | });
15 |
16 | const server = http.createServer(app);
17 | const port = Number(process.env.PORT || 4200);
18 | server.listen(port);
19 | console.debug('Server is running... http://localhost:' + port);
20 |
--------------------------------------------------------------------------------
/frameworks/angular/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { RouterModule, Routes } from '@angular/router';
3 |
4 | const routes: Routes = [
5 | {
6 | path: '',
7 | loadComponent: async () =>
8 | (await import('./generated-components/components/hello-world')).default,
9 | },
10 | {
11 | path: 'todo',
12 | loadComponent: async () =>
13 | (await import('./generated-components/components/todo-app')).default,
14 | },
15 | {
16 | path: 'dashboard',
17 | loadComponent: async () =>
18 | (await import('./generated-components/components/dashboard')).default,
19 | },
20 | ];
21 |
22 | @NgModule({
23 | imports: [
24 | RouterModule.forRoot(routes, {
25 | initialNavigation: 'enabledBlocking',
26 | }),
27 | ],
28 | exports: [RouterModule],
29 | })
30 | export class AppRoutingModule {}
31 |
--------------------------------------------------------------------------------
/frameworks/angular/src/app/app.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/angular/src/app/app.component.css
--------------------------------------------------------------------------------
/frameworks/angular/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/frameworks/angular/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, Inject } from '@angular/core';
2 | import { Router } from '@angular/router';
3 |
4 | @Component({
5 | selector: 'app-root',
6 | templateUrl: './app.component.html',
7 | styleUrls: ['./app.component.css'],
8 | })
9 | export class AppComponent {
10 | constructor(public router: Router) {}
11 | }
12 |
--------------------------------------------------------------------------------
/frameworks/angular/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { BrowserModule } from '@angular/platform-browser';
3 |
4 | import { AppComponent } from './app.component';
5 | import { AppRoutingModule } from './app-routing.module';
6 | import AppHeader from './generated-components/components/app-header';
7 |
8 | @NgModule({
9 | declarations: [AppComponent],
10 | imports: [BrowserModule.withServerTransition({ appId: 'serverApp' }), AppRoutingModule, AppHeader],
11 | providers: [],
12 | bootstrap: [AppComponent],
13 | })
14 | export class AppModule {}
15 |
--------------------------------------------------------------------------------
/frameworks/angular/src/app/app.server.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { ServerModule } from '@angular/platform-server';
3 |
4 | import { AppModule } from './app.module';
5 | import { AppComponent } from './app.component';
6 |
7 | @NgModule({
8 | imports: [
9 | AppModule,
10 | ServerModule,
11 | ],
12 | bootstrap: [AppComponent],
13 | })
14 | export class AppServerModule {}
15 |
--------------------------------------------------------------------------------
/frameworks/angular/src/app/typings.d.ts:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/angular/src/app/typings.d.ts
--------------------------------------------------------------------------------
/frameworks/angular/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/angular/src/assets/.gitkeep
--------------------------------------------------------------------------------
/frameworks/angular/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/frameworks/angular/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/frameworks/angular/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/angular/src/favicon.ico
--------------------------------------------------------------------------------
/frameworks/angular/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Angular
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/frameworks/angular/src/main.server.ts:
--------------------------------------------------------------------------------
1 | /***************************************************************************************************
2 | * Initialize the server environment - for example, adding DOM built-in types to the global scope.
3 | *
4 | * NOTE:
5 | * This import must come before any imports (direct or transitive) that rely on DOM built-ins being
6 | * available, such as `@angular/elements`.
7 | */
8 | import '@angular/platform-server/init';
9 |
10 | import { enableProdMode } from '@angular/core';
11 |
12 | import { environment } from './environments/environment';
13 |
14 | if (environment.production) {
15 | enableProdMode();
16 | }
17 |
18 | export { AppServerModule } from './app/app.server.module';
19 | export { renderModule } from '@angular/platform-server';
20 |
--------------------------------------------------------------------------------
/frameworks/angular/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | function bootstrap() {
12 | platformBrowserDynamic().bootstrapModule(AppModule)
13 | .catch(err => console.error(err));
14 | };
15 |
16 |
17 | if (document.readyState === 'complete') {
18 | bootstrap();
19 | } else {
20 | document.addEventListener('DOMContentLoaded', bootstrap);
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/frameworks/angular/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/frameworks/angular/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | (id: string): T;
13 | keys(): string[];
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting(),
21 | );
22 |
23 | // Then we find all the tests.
24 | const context = require.context('./', true, /\.spec\.ts$/);
25 | // And load the modules.
26 | context.keys().forEach(context);
27 |
--------------------------------------------------------------------------------
/frameworks/angular/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/app"
6 | },
7 | "files": ["src/main.ts", "src/polyfills.ts"],
8 | "include": ["src/**/*.d.ts"]
9 | }
10 |
--------------------------------------------------------------------------------
/frameworks/angular/tsconfig.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "compileOnSave": false,
4 | "compilerOptions": {
5 | "baseUrl": "./",
6 | "outDir": "./dist/out-tsc",
7 | "forceConsistentCasingInFileNames": true,
8 | "strict": false,
9 | "noFallthroughCasesInSwitch": true,
10 | "sourceMap": true,
11 | "declaration": false,
12 | "downlevelIteration": true,
13 | "experimentalDecorators": true,
14 | "moduleResolution": "node",
15 | "importHelpers": true,
16 | "target": "es2020",
17 | "module": "es2020",
18 | "types": ["node"],
19 | "lib": ["es2020", "dom"],
20 | "paths": {
21 | "@angular/*": ["./node_modules/@angular/*"]
22 | }
23 | },
24 | "angularCompilerOptions": {
25 | "enableI18nLegacyMessageIdFormat": false,
26 | "strictInjectionParameters": false,
27 | "strictInputAccessModifiers": false,
28 | "strictTemplates": false
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/frameworks/angular/tsconfig.server.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.app.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/server",
6 | "target": "es2019",
7 | "types": [
8 | "node"
9 | ]
10 | },
11 | "files": [
12 | "src/main.server.ts",
13 | "server.ts"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/frameworks/angular/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/spec",
6 | "types": [
7 | "jasmine"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/frameworks/astro/.gitignore:
--------------------------------------------------------------------------------
1 | # build output
2 | dist/
3 | .output/
4 |
5 | # dependencies
6 | node_modules/
7 |
8 | # logs
9 | npm-debug.log*
10 | yarn-debug.log*
11 | yarn-error.log*
12 | pnpm-debug.log*
13 |
14 |
15 | # environment variables
16 | .env
17 | .env.production
18 |
19 | # macOS-specific files
20 | .DS_Store
21 |
--------------------------------------------------------------------------------
/frameworks/astro/.npmrc:
--------------------------------------------------------------------------------
1 | # Expose Astro dependencies for `pnpm` users
2 | shamefully-hoist=true
3 |
--------------------------------------------------------------------------------
/frameworks/astro/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["astro-build.astro-vscode"],
3 | "unwantedRecommendations": []
4 | }
5 |
--------------------------------------------------------------------------------
/frameworks/astro/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "command": "./node_modules/.bin/astro dev",
6 | "name": "Development server",
7 | "request": "launch",
8 | "type": "node-terminal"
9 | }
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/frameworks/astro/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to [Astro](https://astro.build)
2 |
3 | [](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics)
4 |
5 | > 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!
6 |
7 | ## 🚀 Project Structure
8 |
9 | Inside of your Astro project, you'll see the following folders and files:
10 |
11 | ```
12 | /
13 | ├── public/
14 | │ └── favicon.ico
15 | ├── src/
16 | │ ├── components/
17 | │ │ └── Layout.astro
18 | │ └── pages/
19 | │ └── index.astro
20 | └── package.json
21 | ```
22 |
23 | Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
24 |
25 | There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components or layouts.
26 |
27 | Any static assets, like images, can be placed in the `public/` directory.
28 |
29 | ## 🧞 Commands
30 |
31 | All commands are run from the root of the project, from a terminal:
32 |
33 | | Command | Action |
34 | | :---------------- | :------------------------------------------- |
35 | | `npm install` | Installs dependencies |
36 | | `npm run dev` | Starts local dev server at `localhost:3000` |
37 | | `npm run build` | Build your production site to `./dist/` |
38 | | `npm run preview` | Preview your build locally, before deploying |
39 |
40 | ## 👀 Want to learn more?
41 |
42 | Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
43 |
--------------------------------------------------------------------------------
/frameworks/astro/astro.config.mjs:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'astro/config';
2 | import solid from '@astrojs/solid-js';
3 | import viteCompress from 'vite-plugin-compress';
4 | import node from '@astrojs/node';
5 | // This throws an error:
6 | // Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import 'node_modules/astro-compress/dist/options'
7 | // import compress from 'astro-compress';
8 |
9 | // https://astro.build/config
10 | export default defineConfig({
11 | server: {
12 | port: 6001,
13 | },
14 | vite: {
15 | plugins: [viteCompress.default()],
16 | },
17 | integrations: [solid()],
18 | adapter: node(),
19 | output: 'server',
20 | });
21 |
--------------------------------------------------------------------------------
/frameworks/astro/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@example/basics",
3 | "version": "0.0.1",
4 | "private": true,
5 | "port": 6001,
6 | "type": "module",
7 | "scripts": {
8 | "dev": "astro dev",
9 | "start": "astro dev",
10 | "build": "astro build",
11 | "ssg:preview": "astro preview",
12 | "preview": "node server.mjs",
13 | "bun:preview": "bun server.mjs"
14 | },
15 | "dependencies": {
16 | "@astrojs/node": "^1.0.0",
17 | "@popperjs/core": "^2.11.6",
18 | "express": "^4.18.1",
19 | "fuse.js": "^6.6.2",
20 | "highlight.js": "^11.6.0",
21 | "vite-plugin-compress": "^2.1.1"
22 | },
23 | "devDependencies": {
24 | "@astrojs/solid-js": "^1.0.0",
25 | "astro": "^1.0.6",
26 | "astro-compress": "^1.0.1",
27 | "solid-js": "^1.4.8"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/frameworks/astro/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/astro/public/favicon.ico
--------------------------------------------------------------------------------
/frameworks/astro/server.mjs:
--------------------------------------------------------------------------------
1 | import express from 'express';
2 | import { handler as ssrHandler } from './dist/server/entry.mjs';
3 |
4 | const app = express();
5 | app.use(ssrHandler);
6 |
7 | const port = Number(process.env.PORT || 6001);
8 | app.listen(port);
9 |
10 | console.log(`Listening on http://localhost:${port}`);
11 |
--------------------------------------------------------------------------------
/frameworks/astro/src/layouts/Layout.astro:
--------------------------------------------------------------------------------
1 | ---
2 | import { AppHeader } from '../generated-components';
3 |
4 | export interface Props {
5 | title?: string;
6 | }
7 |
8 | const { title } = Astro.props as Props;
9 | ---
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | {title || 'Hello Astro'}
19 |
20 |
21 |
22 | {title}
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/frameworks/astro/src/pages/dashboard.astro:
--------------------------------------------------------------------------------
1 | ---
2 | import Layout from '../layouts/Layout.astro';
3 | import Dashboard from '../generated-components/components/dashboard.jsx';
4 | ---
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/frameworks/astro/src/pages/index.astro:
--------------------------------------------------------------------------------
1 | ---
2 | import Layout from '../layouts/Layout.astro';
3 | import HelloWorld from '../generated-components/components/hello-world.jsx';
4 | ---
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/frameworks/astro/src/pages/todo.astro:
--------------------------------------------------------------------------------
1 | ---
2 | import Layout from '../layouts/Layout.astro';
3 | import ToDoApp from '../generated-components/components/todo-app.jsx';
4 | ---
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/frameworks/astro/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | // Enable top-level await, and other modern ESM features.
4 | "target": "ESNext",
5 | "module": "ESNext",
6 | // Enable node-style module resolution, for things like npm package imports.
7 | "moduleResolution": "node",
8 | // Enable JSON imports.
9 | "resolveJsonModule": true,
10 | // Enable stricter transpilation for better output.
11 | "isolatedModules": true,
12 | // Add type definitions for our Astro runtime.
13 | "types": ["astro/client"]
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/frameworks/fresh/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "denoland.vscode-deno"
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/frameworks/fresh/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "deno.enable": true,
3 | "deno.lint": true,
4 | "editor.defaultFormatter": "denoland.vscode-deno"
5 | }
6 |
--------------------------------------------------------------------------------
/frameworks/fresh/README.md:
--------------------------------------------------------------------------------
1 | # fresh project
2 |
3 | ### Usage
4 |
5 | Start the project:
6 |
7 | ```
8 | deno task start
9 | ```
10 |
11 | This will watch the project directory and restart as necessary.
12 |
--------------------------------------------------------------------------------
/frameworks/fresh/components/Button.tsx:
--------------------------------------------------------------------------------
1 | /** @jsx h */
2 | import { h } from "preact";
3 | import { IS_BROWSER } from "$fresh/runtime.ts";
4 | import { tw } from "@twind";
5 |
6 | export function Button(props: h.JSX.HTMLAttributes) {
7 | return (
8 |
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/frameworks/fresh/deno.json:
--------------------------------------------------------------------------------
1 | {
2 | "tasks": {
3 | "start": "deno run -A --watch=static/,routes/ dev.ts",
4 | "preview": "DENO_DEPLOYMENT_ID=abc deno run -A main.ts"
5 | },
6 | "importMap": "./import_map.json"
7 | }
8 |
--------------------------------------------------------------------------------
/frameworks/fresh/dev.ts:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env -S deno run -A --watch=static/,routes/
2 |
3 | import dev from "$fresh/dev.ts";
4 |
5 | await dev(import.meta.url, "./main.ts");
6 |
--------------------------------------------------------------------------------
/frameworks/fresh/fresh.gen.ts:
--------------------------------------------------------------------------------
1 | // DO NOT EDIT. This file is generated by fresh.
2 | // This file SHOULD be checked into source version control.
3 | // This file is automatically updated during development when running `dev.ts`.
4 |
5 | import * as $0 from "./routes/[name].tsx";
6 | import * as $1 from "./routes/api/joke.ts";
7 | import * as $2 from "./routes/dashboard.tsx";
8 | import * as $3 from "./routes/index.tsx";
9 | import * as $4 from "./routes/todo.tsx";
10 | import * as $$0 from "./islands/Dashboard.tsx";
11 | import * as $$1 from "./islands/Todo.tsx";
12 |
13 | const manifest = {
14 | routes: {
15 | "./routes/[name].tsx": $0,
16 | "./routes/api/joke.ts": $1,
17 | "./routes/dashboard.tsx": $2,
18 | "./routes/index.tsx": $3,
19 | "./routes/todo.tsx": $4,
20 | },
21 | islands: {
22 | "./islands/Dashboard.tsx": $$0,
23 | "./islands/Todo.tsx": $$1,
24 | },
25 | baseUrl: import.meta.url,
26 | };
27 |
28 | export default manifest;
29 |
--------------------------------------------------------------------------------
/frameworks/fresh/import_map.json:
--------------------------------------------------------------------------------
1 | {
2 | "imports": {
3 | "$fresh/": "https://deno.land/x/fresh@1.0.2/",
4 | "preact": "https://esm.sh/preact@10.10.0",
5 | "preact/": "https://esm.sh/preact@10.10.0/",
6 | "preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.1?external=preact",
7 | "@twind": "./utils/twind.ts",
8 | "twind": "https://esm.sh/twind@0.16.17",
9 | "highlight.js": "https://esm.sh/highlight.js@11.6.0",
10 | "highlight.js/": "https://esm.sh/highlight.js@11.6.0/",
11 | "fuse.js": "https://esm.sh/fuse.js",
12 | "fuse.js/": "https://esm.sh/fuse.js/",
13 | "@popperjs/core": "https://esm.sh/@popperjs/core",
14 | "@popperjs/core/": "https://esm.sh/@popperjs/core/",
15 | "twind/": "https://esm.sh/twind@0.16.17/"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/frameworks/fresh/islands/Dashboard.tsx:
--------------------------------------------------------------------------------
1 | import Dashboard from '../components/generated-components/components/dashboard.js';
2 | export default Dashboard;
3 |
--------------------------------------------------------------------------------
/frameworks/fresh/islands/Todo.tsx:
--------------------------------------------------------------------------------
1 | import Todo from '../components/generated-components/components/todo-app.js';
2 | export default Todo;
3 |
--------------------------------------------------------------------------------
/frameworks/fresh/main.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | ///
4 | ///
5 | ///
6 |
7 | import { InnerRenderFunction, RenderContext, start } from "$fresh/server.ts";
8 | import manifest from "./fresh.gen.ts";
9 |
10 | import { config, setup } from "@twind";
11 | import { virtualSheet } from "twind/sheets";
12 |
13 | const sheet = virtualSheet();
14 | sheet.reset();
15 | setup({ ...config, sheet });
16 |
17 | function render(ctx: RenderContext, render: InnerRenderFunction) {
18 | const snapshot = ctx.state.get("twind") as unknown[] | null;
19 | sheet.reset(snapshot || undefined);
20 | render();
21 | ctx.styles.splice(0, ctx.styles.length, ...(sheet).target);
22 | const newSnapshot = sheet.reset();
23 | ctx.state.set("twind", newSnapshot);
24 | }
25 |
26 | await start(manifest, { render });
27 |
--------------------------------------------------------------------------------
/frameworks/fresh/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fresh",
3 | "lockfileVersion": 2,
4 | "requires": true,
5 | "packages": {}
6 | }
7 |
--------------------------------------------------------------------------------
/frameworks/fresh/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "port": 8000,
3 | "scripts": {
4 | "build": "echo \"Fresh doesn't build :)\"",
5 | "dev": "deno task start",
6 | "start": "npm run dev",
7 | "preview": "deno task preview"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/frameworks/fresh/routes/[name].tsx:
--------------------------------------------------------------------------------
1 | /** @jsx h */
2 | import { h } from "preact";
3 | import { PageProps } from "$fresh/server.ts";
4 |
5 | export default function Greet(props: PageProps) {
6 | return Hello {props.params.name}
;
7 | }
8 |
--------------------------------------------------------------------------------
/frameworks/fresh/routes/api/joke.ts:
--------------------------------------------------------------------------------
1 | import { HandlerContext } from "$fresh/server.ts";
2 |
3 | // Jokes courtesy of https://punsandoneliners.com/randomness/programmer-jokes/
4 | const JOKES = [
5 | "Why do Java developers often wear glasses? They can't C#.",
6 | "A SQL query walks into a bar, goes up to two tables and says “can I join you?”",
7 | "Wasn't hard to crack Forrest Gump's password. 1forrest1.",
8 | "I love pressing the F5 key. It's refreshing.",
9 | "Called IT support and a chap from Australia came to fix my network connection. I asked “Do you come from a LAN down under?”",
10 | "There are 10 types of people in the world. Those who understand binary and those who don't.",
11 | "Why are assembly programmers often wet? They work below C level.",
12 | "My favourite computer based band is the Black IPs.",
13 | "What programme do you use to predict the music tastes of former US presidential candidates? An Al Gore Rhythm.",
14 | "An SEO expert walked into a bar, pub, inn, tavern, hostelry, public house.",
15 | ];
16 |
17 | export const handler = (_req: Request, _ctx: HandlerContext): Response => {
18 | const randomIndex = Math.floor(Math.random() * JOKES.length);
19 | const body = JOKES[randomIndex];
20 | return new Response(body);
21 | };
22 |
--------------------------------------------------------------------------------
/frameworks/fresh/routes/dashboard.tsx:
--------------------------------------------------------------------------------
1 | /** @jsx h */
2 | import { h } from 'preact';
3 | import AppHeader from '../components/generated-components/components/app-header.js';
4 | import Dashboard from '../islands/Dashboard.tsx';
5 |
6 | export default function Home() {
7 | return (
8 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/frameworks/fresh/routes/index.tsx:
--------------------------------------------------------------------------------
1 | /** @jsx h */
2 | import { h } from 'preact';
3 | import {
4 | AppHeader,
5 | HelloWorld,
6 | } from '../components/generated-components/index.js';
7 |
8 | export default function Home() {
9 | return (
10 |
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/frameworks/fresh/routes/todo.tsx:
--------------------------------------------------------------------------------
1 | /** @jsx h */
2 | import { h } from 'preact';
3 | import AppHeader from '../components/generated-components/components/app-header.js';
4 | import Todo from '../islands/Todo.tsx';
5 |
6 | export default function Home() {
7 | return (
8 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/frameworks/fresh/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/fresh/static/favicon.ico
--------------------------------------------------------------------------------
/frameworks/fresh/static/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/frameworks/fresh/utils/twind.ts:
--------------------------------------------------------------------------------
1 | import { IS_BROWSER } from "$fresh/runtime.ts";
2 | import { Configuration, setup } from "twind";
3 | export * from "twind";
4 | export const config: Configuration = {
5 | darkMode: "class",
6 | mode: "silent",
7 | };
8 | if (IS_BROWSER) setup(config);
9 |
--------------------------------------------------------------------------------
/frameworks/gatsby/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | .cache/
3 | public
4 |
--------------------------------------------------------------------------------
/frameworks/gatsby/gatsby-config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | siteMetadata: {
3 | title: `gatsby`,
4 | siteUrl: `https://www.yourdomain.tld`,
5 | },
6 | plugins: [],
7 | }
8 |
--------------------------------------------------------------------------------
/frameworks/gatsby/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "gatsby",
3 | "version": "1.0.0",
4 | "private": true,
5 | "description": "gatsby",
6 | "author": "Chris LaRocque",
7 | "keywords": [
8 | "gatsby"
9 | ],
10 | "port": 8001,
11 | "scripts": {
12 | "develop": "gatsby develop -p 8001",
13 | "dev": "npm run develop",
14 | "start": "gatsby develop -p 8001",
15 | "build": "gatsby build",
16 | "serve": "gatsby serve -p 8001",
17 | "clean": "gatsby clean",
18 | "preview": "npm run serve"
19 | },
20 | "dependencies": {
21 | "@popperjs/core": "^2.11.6",
22 | "fuse.js": "^6.6.2",
23 | "gatsby": "^4.20.0",
24 | "highlight.js": "^11.6.0",
25 | "react": "^18.1.0",
26 | "react-dom": "^18.1.0"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/frameworks/gatsby/src/pages/404.js:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import { Link } from "gatsby"
3 |
4 | const pageStyles = {
5 | color: "#232129",
6 | padding: "96px",
7 | fontFamily: "-apple-system, Roboto, sans-serif, serif",
8 | }
9 | const headingStyles = {
10 | marginTop: 0,
11 | marginBottom: 64,
12 | maxWidth: 320,
13 | }
14 |
15 | const paragraphStyles = {
16 | marginBottom: 48,
17 | }
18 | const codeStyles = {
19 | color: "#8A6534",
20 | padding: 4,
21 | backgroundColor: "#FFF4DB",
22 | fontSize: "1.25rem",
23 | borderRadius: 4,
24 | }
25 |
26 | const NotFoundPage = () => {
27 | return (
28 |
29 | Page not found
30 |
31 | Sorry 😔, we couldn’t find what you were looking for.
32 |
33 | {process.env.NODE_ENV === "development" ? (
34 | <>
35 |
36 | Try creating a page in src/pages/
.
37 |
38 | >
39 | ) : null}
40 |
41 | Go home.
42 |
43 |
44 | )
45 | }
46 |
47 | export default NotFoundPage
48 |
49 | export const Head = () => Not found
50 |
--------------------------------------------------------------------------------
/frameworks/gatsby/src/pages/dashboard-ssr.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import AppHeader from '../generated-components/components/app-header';
3 | import Dashboard from '../generated-components/components/dashboard';
4 |
5 | export default function DashboardPage() {
6 | return (
7 | <>
8 |
9 |
10 | >
11 | );
12 | }
13 |
14 | export async function getServerData() {
15 | return { props: { random: Math.random() } };
16 | }
17 |
--------------------------------------------------------------------------------
/frameworks/gatsby/src/pages/dashboard.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import AppHeader from '../generated-components/components/app-header';
3 | import Dashboard from '../generated-components/components/dashboard';
4 |
5 | export default function DashboardPage() {
6 | return (
7 | <>
8 |
9 |
10 | >
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/frameworks/gatsby/src/pages/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import AppHeader from '../generated-components/components/app-header';
3 | import HelloWorld from '../generated-components/components/hello-world';
4 |
5 | export default function Home() {
6 | return (
7 | <>
8 |
9 |
10 | >
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/frameworks/gatsby/src/pages/todo.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import AppHeader from '../generated-components/components/app-header';
3 | import ToDoApp from '../generated-components/components/todo-app';
4 |
5 | export default function Todo() {
6 | return (
7 | <>
8 |
9 |
10 | >
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | node_modules
3 | .DS_Store
4 | dist
5 | *.local
6 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/README.md:
--------------------------------------------------------------------------------
1 | # JavaScript Example
2 |
3 | Hydrogen is a React framework and SDK that you can use to build fast and dynamic Shopify custom storefronts.
4 |
5 | [Check out the docs](https://shopify.dev/custom-storefronts/hydrogen)
6 |
7 | [Run this template on StackBlitz](https://stackblitz.com/github/Shopify/hydrogen/tree/stackblitz/templates/hello-world-js)
8 |
9 | ## Getting started
10 |
11 | **Requirements:**
12 |
13 | - Node.js version 16.5.0 or higher
14 | - Yarn
15 |
16 | ```bash
17 | npm init @shopify/hydrogen@latest --template hello-world-ts
18 | ```
19 |
20 | Remember to update `hydrogen.config.js` with your shop's domain and Storefront API token!
21 |
22 | ## Building for production
23 |
24 | ```bash
25 | yarn build
26 | ```
27 |
28 | ## Previewing a production build
29 |
30 | To run a local preview of your Hydrogen app in an environment similar to Oxygen, build your Hydrogen app and then run `yarn preview`:
31 |
32 | ```bash
33 | yarn build
34 | yarn preview
35 | ```
36 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/hydrogen.config.js:
--------------------------------------------------------------------------------
1 | import {defineConfig} from '@shopify/hydrogen/config';
2 |
3 | export default defineConfig({
4 | shopify: {
5 | storeDomain: 'hydrogen-preview.myshopify.com',
6 | storefrontToken: '3b580e70970c4528da70c98e097c2fa0',
7 | storefrontApiVersion: '2022-07',
8 | },
9 | });
10 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Hydrogen App
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2020",
4 | "module": "esnext",
5 | "moduleResolution": "node16",
6 | "lib": ["dom", "dom.iterable", "scripthost", "es2020"],
7 | "jsx": "react",
8 | "types": ["vite/client"]
9 | },
10 | "exclude": ["node_modules", "dist"],
11 | "include": ["**/*.js", "**/*.jsx"]
12 | }
13 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/mini-oxygen.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "port": 6011,
3 | "workerFile": "dist/worker/index.js",
4 | "assetsDir": "dist/client",
5 | "buildCommand": "yarn build",
6 | "modules": true,
7 | "watch": true,
8 | "buildWatchPaths": [
9 | "./src"
10 | ],
11 | "autoReload": true
12 | }
--------------------------------------------------------------------------------
/frameworks/hydrogen/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hydrogen",
3 | "description": "An example using JavaScript in Hydrogen",
4 | "version": "0.0.0",
5 | "license": "MIT",
6 | "port": 6011,
7 | "private": true,
8 | "scripts": {
9 | "dev": "PORT=6011 shopify hydrogen dev",
10 | "build": "shopify hydrogen build",
11 | "preview": "PORT=6011 shopify hydrogen preview --port 6011"
12 | },
13 | "devDependencies": {
14 | "@shopify/cli": "3.7.1",
15 | "@shopify/cli-hydrogen": "3.7.1",
16 | "vite": "^2.9.0"
17 | },
18 | "dependencies": {
19 | "@popperjs/core": "^2.11.6",
20 | "@shopify/hydrogen": "^1.2.0",
21 | "fuse.js": "^6.6.2",
22 | "highlight.js": "^11.6.0",
23 | "react": "^18.2.0",
24 | "react-dom": "^18.2.0",
25 | "vite-plugin-compress": "^2.1.1"
26 | },
27 | "author": "stephensewell"
28 | }
29 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/public/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/hydrogen/public/.gitkeep
--------------------------------------------------------------------------------
/frameworks/hydrogen/src/App.server.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import renderHydrogen from '@shopify/hydrogen/entry-server';
3 | import { Router, FileRoutes, ShopifyProvider } from '@shopify/hydrogen';
4 | import { Suspense } from 'react';
5 | import { useUrl } from '@shopify/hydrogen';
6 | import AppHeader from './generated-components/components/app-header';
7 |
8 | function App() {
9 | const url = useUrl();
10 |
11 | return (
12 | <>
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | >
22 | );
23 | }
24 |
25 | export default renderHydrogen(App);
26 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/src/assets/favicon.svg:
--------------------------------------------------------------------------------
1 |
2 |
18 |
23 |
28 |
29 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/src/components/dashboard.client.jsx:
--------------------------------------------------------------------------------
1 | import Dashboard from '../generated-components/components/dashboard';
2 |
3 | export default Dashboard;
4 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/src/components/todo-app.client.jsx:
--------------------------------------------------------------------------------
1 | import TodoApp from '../generated-components/components/todo-app';
2 |
3 | export default TodoApp;
4 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/src/index.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/hydrogen/src/index.css
--------------------------------------------------------------------------------
/frameworks/hydrogen/src/routes/dashboard.server.jsx:
--------------------------------------------------------------------------------
1 | import Dashboard from '../components/dashboard.client';
2 |
3 | export default function DashboardPage() {
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/src/routes/index.server.jsx:
--------------------------------------------------------------------------------
1 | import HelloWorld from '../generated-components/components/hello-world';
2 |
3 | export default function Home() {
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/src/routes/todo.server.jsx:
--------------------------------------------------------------------------------
1 | import TodoApp from '../components/todo-app.client';
2 |
3 | export default function Todo() {
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/frameworks/hydrogen/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 | import hydrogen from '@shopify/hydrogen/plugin';
3 | import compress from 'vite-plugin-compress';
4 |
5 | export default defineConfig({
6 | server: {
7 | port: 6011,
8 | },
9 | plugins: [hydrogen(), compress()],
10 | });
11 |
--------------------------------------------------------------------------------
/frameworks/lit/.eleventy.cjs:
--------------------------------------------------------------------------------
1 | const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
2 |
3 | module.exports = function (eleventyConfig) {
4 | eleventyConfig.addPlugin(syntaxHighlight);
5 | eleventyConfig.addPassthroughCopy('docs-src/docs.css');
6 | eleventyConfig.addPassthroughCopy('docs-src/.nojekyll');
7 | eleventyConfig.addPassthroughCopy(
8 | 'node_modules/@webcomponents/webcomponentsjs'
9 | );
10 | eleventyConfig.addPassthroughCopy('node_modules/lit/polyfill-support.js');
11 | return {
12 | dir: {
13 | input: 'docs-src',
14 | output: 'docs',
15 | },
16 | templateExtensionAliases: {
17 | '11ty.cjs': '11ty.js',
18 | '11tydata.cjs': '11tydata.js',
19 | },
20 | };
21 | };
22 |
--------------------------------------------------------------------------------
/frameworks/lit/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules/*
2 | docs/*
3 | docs-src/*
4 | rollup-config.js
5 | custom-elements.json
6 | web-dev-server.config.js
7 |
--------------------------------------------------------------------------------
/frameworks/lit/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "root": true,
3 | "extends": [
4 | "eslint:recommended",
5 | "plugin:@typescript-eslint/eslint-recommended",
6 | "plugin:@typescript-eslint/recommended"
7 | ],
8 | "parser": "@typescript-eslint/parser",
9 | "parserOptions": {
10 | "ecmaVersion": 2020,
11 | "sourceType": "module"
12 | },
13 | "plugins": ["@typescript-eslint"],
14 | "env": {
15 | "browser": true
16 | },
17 | "rules": {
18 | "no-prototype-builtins": "off",
19 | "@typescript-eslint/ban-types": "off",
20 | "@typescript-eslint/explicit-function-return-type": "off",
21 | "@typescript-eslint/explicit-module-boundary-types": "off",
22 | "@typescript-eslint/no-explicit-any": "error",
23 | "@typescript-eslint/no-empty-function": "off",
24 | "@typescript-eslint/no-non-null-assertion": "off",
25 | "@typescript-eslint/no-unused-vars": [
26 | "warn",
27 | {
28 | "argsIgnorePattern": "^_"
29 | }
30 | ]
31 | },
32 | "overrides": [
33 | {
34 | "files": ["rollup.config.js", "web-test-runner.config.js"],
35 | "env": {
36 | "node": true
37 | }
38 | },
39 | {
40 | "files": [
41 | "*_test.ts",
42 | "**/custom_typings/*.ts",
43 | "packages/labs/ssr/src/test/integration/tests/**",
44 | "packages/labs/ssr/src/lib/util/parse5-utils.ts"
45 | ],
46 | "rules": {
47 | "@typescript-eslint/no-explicit-any": "off"
48 | }
49 | }
50 | ]
51 | }
52 |
--------------------------------------------------------------------------------
/frameworks/lit/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules/
2 | /lib/
3 | /test/
4 | custom-elements.json
5 | # top level source
6 | my-element.js
7 | my-element.js.map
8 | my-element.d.ts
9 | my-element.d.ts.map
10 | # only generated for size check
11 | my-element.bundled.js
12 |
13 | docs
14 | dist
--------------------------------------------------------------------------------
/frameworks/lit/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "es5",
3 | "tabWidth": 2,
4 | "singleQuote": true,
5 | "bracketSpacing": false,
6 | "arrowParens": "always"
7 | }
8 |
--------------------------------------------------------------------------------
/frameworks/lit/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3 | // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4 |
5 | // List of extensions which should be recommended for users of this workspace.
6 | "recommendations": ["runem.lit-plugin"],
7 | // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
8 | "unwantedRecommendations": []
9 | }
10 |
--------------------------------------------------------------------------------
/frameworks/lit/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2019 Google LLC. All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | 1. Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | 2. Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation
13 | and/or other materials provided with the distribution.
14 |
15 | 3. Neither the name of the copyright holder nor the names of its
16 | contributors may be used to endorse or promote products derived from
17 | this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/frameworks/lit/dev/README.md:
--------------------------------------------------------------------------------
1 | This directory contains HTML files containing your element for development. By running `npm run build:watch` and `npm run serve` you can edit and see changes without bundling.
2 |
--------------------------------------------------------------------------------
/frameworks/lit/dev/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | <my-element> Demo
7 |
8 |
9 |
10 |
16 |
17 |
18 |
19 | This is child content
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/frameworks/lit/docs-src/.eleventyignore:
--------------------------------------------------------------------------------
1 | # Ignore files with a leading underscore; useful for e.g. readmes in source documentation
2 | _*.md
--------------------------------------------------------------------------------
/frameworks/lit/docs-src/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/lit/docs-src/.nojekyll
--------------------------------------------------------------------------------
/frameworks/lit/docs-src/_README.md:
--------------------------------------------------------------------------------
1 | This directory contains the sources for the static site contained in the /docs/ directory. The site is based on the [eleventy](11ty.dev) static site generator.
2 |
3 | The site is intended to be used with GitHub pages. To enable the site go to the GitHub settings and change the GitHub Pages "Source" setting to "master branch /docs folder".
4 |
5 | To view the site locally, run `npm run docs:serve`.
6 |
7 | To edit the site, add to or edit the files in this directory then run `npm run docs` to build the site. The built files must be checked in and pushed to GitHub to appear on GitHub pages.
8 |
--------------------------------------------------------------------------------
/frameworks/lit/docs-src/_data/api.11tydata.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2021 Google LLC
4 | * SPDX-License-Identifier: BSD-3-Clause
5 | */
6 |
7 | const fs = require('fs');
8 |
9 | module.exports = () => {
10 | const customElements = JSON.parse(
11 | fs.readFileSync('custom-elements.json', 'utf-8')
12 | );
13 | return {
14 | customElements,
15 | };
16 | };
17 |
--------------------------------------------------------------------------------
/frameworks/lit/docs-src/_includes/page.11ty.cjs:
--------------------------------------------------------------------------------
1 | const relative = require('./relative-path.cjs');
2 |
3 | module.exports = function (data) {
4 | const {title, page, content} = data;
5 | return `
6 |
7 |
8 |
9 |
10 |
11 |
12 | ${title}
13 | ${page.url === '/' ? `
14 |
18 | ` : ''}
19 | ${page.url === '/todo/' ? `
20 |
24 | ` : ''}
25 | ${page.url === '/dashboard/' ? `
26 |
30 | ` : ''}
31 |
35 |
36 |
37 |
38 | ${content}
39 |
40 | `;
41 | };
42 |
--------------------------------------------------------------------------------
/frameworks/lit/docs-src/_includes/relative-path.cjs:
--------------------------------------------------------------------------------
1 | const path = require('path').posix;
2 |
3 | module.exports = (base, p) => {
4 | const relativePath = path.relative(base, p);
5 | if (p.endsWith('/') && !relativePath.endsWith('/') && relativePath !== '') {
6 | return relativePath + '/';
7 | }
8 | return relativePath;
9 | };
10 |
--------------------------------------------------------------------------------
/frameworks/lit/docs-src/dashboard.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: page.11ty.cjs
3 | title: Dashboard Example
4 | ---
5 |
6 |
7 |
--------------------------------------------------------------------------------
/frameworks/lit/docs-src/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: page.11ty.cjs
3 | title: Hello World
4 | ---
5 |
6 |
--------------------------------------------------------------------------------
/frameworks/lit/docs-src/install.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: page.11ty.cjs
3 | title: ⌲ Install
4 | ---
5 |
6 | # Install
7 |
8 | `` is distributed on npm, so you can install it locally or use it via npm CDNs like unpkg.com.
9 |
10 | ## Local Installation
11 |
12 | ```bash
13 | npm i my-element
14 | ```
15 |
16 | ## CDN
17 |
18 | npm CDNs like [unpkg.com]() can directly serve files that have been published to npm. This works great for standard JavaScript modules that the browser can load natively.
19 |
20 | For this element to work from unpkg.com specifically, you need to include the `?module` query parameter, which tells unpkg.com to rewrite "bare" module specifiers to full URLs.
21 |
22 | ### HTML
23 |
24 | ```html
25 |
26 | ```
27 |
28 | ### JavaScript
29 |
30 | ```html
31 | import {MyElement} from 'https://unpkg.com/my-element?module';
32 | ```
33 |
--------------------------------------------------------------------------------
/frameworks/lit/docs-src/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "commonjs"
3 | }
4 |
--------------------------------------------------------------------------------
/frameworks/lit/docs-src/todo.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: page.11ty.cjs
3 | title: Todo Example
4 | ---
5 |
6 |
7 |
--------------------------------------------------------------------------------
/frameworks/lit/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Lit Starter Kit
7 |
8 |
9 | Component Demo
10 |
11 |
12 |
--------------------------------------------------------------------------------
/frameworks/lit/rollup.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2018 Google LLC
4 | * SPDX-License-Identifier: BSD-3-Clause
5 | */
6 |
7 | import summary from 'rollup-plugin-summary';
8 | import {terser} from 'rollup-plugin-terser';
9 | import resolve from '@rollup/plugin-node-resolve';
10 | import replace from '@rollup/plugin-replace';
11 | import typescript from '@rollup/plugin-typescript';
12 |
13 | const getConfig = (name) => ({
14 | input: 'src/generated-components/components/' + name + '.ts',
15 | output: {
16 | file: 'docs/' + name + '.bundled.js',
17 | format: 'esm',
18 | },
19 | onwarn(warning) {
20 | if (warning.code !== 'THIS_IS_UNDEFINED') {
21 | console.error(`(!) ${warning.message}`);
22 | }
23 | },
24 | plugins: [
25 | replace({'Reflect.decorate': 'undefined'}),
26 | typescript(),
27 | resolve(),
28 | terser({
29 | ecma: 2017,
30 | module: true,
31 | warnings: true,
32 | mangle: {
33 | properties: {
34 | regex: /^__/,
35 | },
36 | },
37 | }),
38 | summary(),
39 | ],
40 | });
41 |
42 | export default [
43 | getConfig('hello-world'),
44 | getConfig('todo-app'),
45 | getConfig('app-header'),
46 | getConfig('dashboard'),
47 | ];
48 |
--------------------------------------------------------------------------------
/frameworks/lit/server.js:
--------------------------------------------------------------------------------
1 | const http = require('http');
2 | const express = require('express');
3 | const compression = require('compression');
4 | const path = require('path');
5 |
6 | const app = express();
7 |
8 | app.use(express.json());
9 | app.use(compression());
10 | app.use(express.static('docs'));
11 |
12 | app.use('/', function (req, res) {
13 | res.sendFile(path.join(__dirname + '/docs/index.html'));
14 | });
15 |
16 | const server = http.createServer(app);
17 | const port = Number(process.env.PORT || 6010);
18 | server.listen(port);
19 | console.debug('Server listening http://localhost:' + port + ' ...');
20 |
--------------------------------------------------------------------------------
/frameworks/lit/sever.js:
--------------------------------------------------------------------------------
1 | const http = require('http');
2 | const express = require('express');
3 | const path = require('path');
4 | const compression = require('compression');
5 | const app = express();
6 |
7 | app.use(compression());
8 | app.use(express.json());
9 | app.use(express.static('docs'));
10 |
11 | app.use('/', function (req, res) {
12 | res.sendFile(path.join(__dirname + '/docs/index.html'));
13 | });
14 |
15 | const server = http.createServer(app);
16 | const port = Number(process.env.PORT);
17 | server.listen(port);
18 | console.debug('Server is running... http://localhost:' + port);
19 |
--------------------------------------------------------------------------------
/frameworks/lit/src/typings.d.ts:
--------------------------------------------------------------------------------
1 | ///
--------------------------------------------------------------------------------
/frameworks/lit/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2019",
4 | "module": "es2020",
5 | "lib": ["es2020", "DOM", "DOM.Iterable"],
6 | "declaration": true,
7 | "declarationMap": true,
8 | "sourceMap": true,
9 | "inlineSources": true,
10 | "outDir": "./dist",
11 | "rootDir": "./src",
12 | "strict": false,
13 | "moduleResolution": "node",
14 | "allowSyntheticDefaultImports": true,
15 | "experimentalDecorators": true,
16 | "forceConsistentCasingInFileNames": true,
17 | "allowJs": true,
18 | "checkJs": false,
19 | "plugins": [
20 | {
21 | "name": "ts-lit-plugin",
22 | "strict": false
23 | }
24 | ]
25 | },
26 | "include": ["src/**/*.tsx", "src/**/*.ts", "src/**/*.js"],
27 | "exclude": []
28 | }
29 |
--------------------------------------------------------------------------------
/frameworks/lit/web-dev-server.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license
3 | * Copyright 2021 Google LLC
4 | * SPDX-License-Identifier: BSD-3-Clause
5 | */
6 |
7 | import {legacyPlugin} from '@web/dev-server-legacy';
8 |
9 | const mode = process.env.MODE || 'dev';
10 | if (!['dev', 'prod'].includes(mode)) {
11 | throw new Error(`MODE must be "dev" or "prod", was "${mode}"`);
12 | }
13 |
14 | export default {
15 | nodeResolve: {exportConditions: mode === 'dev' ? ['development'] : []},
16 | preserveSymlinks: true,
17 | plugins: [
18 | legacyPlugin({
19 | polyfills: {
20 | // Manually imported in index.html file
21 | webcomponents: false,
22 | },
23 | }),
24 | ],
25 | };
26 |
--------------------------------------------------------------------------------
/frameworks/marko/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | build
3 | *.log
4 |
--------------------------------------------------------------------------------
/frameworks/marko/README.md:
--------------------------------------------------------------------------------
1 | # Thanks for checking out Marko
2 |
3 | # Installation
4 |
5 | ```
6 | npx @marko/create marko-app --template basic
7 | cd marko-app
8 | npm install
9 | npm run dev
10 | ```
11 |
12 | ## Overview
13 |
14 | This project is powered by `@marko/serve` and `@marko/build`.
15 |
16 | - Run `npm run dev` to start the development server
17 | - Run `npm run build` to build a production-ready node.js server
18 | - Run `npm start` to run the production server
19 |
20 | ## Adding Pages
21 |
22 | Pages map to the directory structure. You can add additional pages by creating files/directories under `src/pages` with `.marko` files. Learn more in the [`@marko/serve` docs](https://github.com/marko-js/cli/blob/master/packages/serve/README.md).
23 |
24 |
--------------------------------------------------------------------------------
/frameworks/marko/dist:
--------------------------------------------------------------------------------
1 | src
--------------------------------------------------------------------------------
/frameworks/marko/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "marko",
3 | "description": "The default Marko starter app",
4 | "version": "1.0.0",
5 | "port": 6002,
6 | "dependencies": {
7 | "@popperjs/core": "^2.11.6",
8 | "fuse.js": "^6.6.2",
9 | "highlight.js": "^11.6.0",
10 | "marko": "^5"
11 | },
12 | "devDependencies": {
13 | "@marko/build": "^4",
14 | "@marko/serve": "^4"
15 | },
16 | "private": true,
17 | "scripts": {
18 | "build": "marko-build ./src/pages",
19 | "dev": "marko-serve ./src/pages --port 6002",
20 | "start": "PORT=6002 NODE_ENV=production node ./build/index.js --port 6002",
21 | "preview": "npm run start"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/frameworks/marko/src/components/app-layout/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/marko/src/components/app-layout/favicon.png
--------------------------------------------------------------------------------
/frameworks/marko/src/components/app-layout/index.marko:
--------------------------------------------------------------------------------
1 | import favicon from './favicon.png';
2 | import AppHeader from '../../../../../apps/components/output/marko/src/components/app-header.marko'
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | ${input.title}
12 |
13 |
14 |
15 | <${input.renderBody}/>
16 |
17 |
--------------------------------------------------------------------------------
/frameworks/marko/src/pages/dashboard.marko:
--------------------------------------------------------------------------------
1 | import Dashboard from '../../../../apps/components/output/marko/src/components/dashboard.marko'
2 |
3 |
4 |
--------------------------------------------------------------------------------
/frameworks/marko/src/pages/index.marko:
--------------------------------------------------------------------------------
1 | import HelloWorld from '../../../../apps/components/output/marko/src/components/hello-world.marko'
2 |
3 |
4 |
--------------------------------------------------------------------------------
/frameworks/marko/src/pages/todo.marko:
--------------------------------------------------------------------------------
1 | import TodoApp from '../../../../apps/components/output/marko/src/components/todo-app.marko'
2 |
3 |
4 |
--------------------------------------------------------------------------------
/frameworks/next/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/frameworks/next/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 | .pnpm-debug.log*
27 |
28 | # local env files
29 | .env*.local
30 |
31 | # vercel
32 | .vercel
33 |
--------------------------------------------------------------------------------
/frameworks/next/README.md:
--------------------------------------------------------------------------------
1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2 |
3 | ## Getting Started
4 |
5 | First, run the development server:
6 |
7 | ```bash
8 | npm run dev
9 | # or
10 | yarn dev
11 | ```
12 |
13 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
14 |
15 | You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
16 |
17 | [API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
18 |
19 | The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20 |
21 | ## Learn More
22 |
23 | To learn more about Next.js, take a look at the following resources:
24 |
25 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27 |
28 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29 |
30 | ## Deploy on Vercel
31 |
32 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33 |
34 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
35 |
--------------------------------------------------------------------------------
/frameworks/next/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | // NOTE: This file should not be edited
5 | // see https://nextjs.org/docs/basic-features/typescript for more information.
6 |
--------------------------------------------------------------------------------
/frameworks/next/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {
3 | reactStrictMode: true,
4 | swcMinify: true,
5 | }
6 |
7 | module.exports = nextConfig
8 |
--------------------------------------------------------------------------------
/frameworks/next/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "next",
3 | "version": "0.1.0",
4 | "private": true,
5 | "port": 6003,
6 | "scripts": {
7 | "dev": "next dev -p 6003",
8 | "build": "next build",
9 | "start": "next start -p 6003",
10 | "lint": "next lint",
11 | "preview": "npm start"
12 | },
13 | "dependencies": {
14 | "@popperjs/core": "^2.11.6",
15 | "@types/react": "^18.0.17",
16 | "fuse.js": "^6.6.2",
17 | "highlight.js": "^11.6.0",
18 | "next": "12.2.3",
19 | "react": "18.2.0",
20 | "react-dom": "18.2.0"
21 | },
22 | "devDependencies": {
23 | "eslint": "8.21.0",
24 | "eslint-config-next": "12.2.3"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/frameworks/next/pages/_app.js:
--------------------------------------------------------------------------------
1 | import { useRouter } from 'next/router';
2 | import AppHeader from '../generated-components/components/app-header';
3 |
4 | Error.stackTraceLimit = Infinity;
5 |
6 | function MyApp({ Component, pageProps }) {
7 | const router = useRouter();
8 |
9 | return (
10 | <>
11 |
12 |
13 | >
14 | );
15 | }
16 |
17 | export default MyApp;
18 |
--------------------------------------------------------------------------------
/frameworks/next/pages/api/hello.js:
--------------------------------------------------------------------------------
1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2 |
3 | export default function handler(req, res) {
4 | res.status(200).json({ name: 'John Doe' })
5 | }
6 |
--------------------------------------------------------------------------------
/frameworks/next/pages/dashboard-ssr.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Dashboard from '../generated-components/components/dashboard';
3 |
4 | // Special route for SSR
5 | export default function Todo() {
6 | return ;
7 | }
8 |
9 | // Include this to make sure this page is in SSR mode
10 | export async function getServerSideProps() {
11 | return { props: {} };
12 | }
13 |
--------------------------------------------------------------------------------
/frameworks/next/pages/dashboard.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Dashboard from '../generated-components/components/dashboard';
3 |
4 | export default function DashboardPage() {
5 | return ;
6 | }
7 |
--------------------------------------------------------------------------------
/frameworks/next/pages/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import HelloWorld from '../generated-components/components/hello-world';
3 |
4 | export default function Home() {
5 | return ;
6 | }
7 |
--------------------------------------------------------------------------------
/frameworks/next/pages/todo.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ToDoApp from '../generated-components/components/todo-app';
3 |
4 | export default function Todo() {
5 | return ;
6 | }
7 |
--------------------------------------------------------------------------------
/frameworks/next/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/next/public/favicon.ico
--------------------------------------------------------------------------------
/frameworks/next/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/frameworks/next/styles/Home.module.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/next/styles/Home.module.css
--------------------------------------------------------------------------------
/frameworks/next/styles/globals.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | padding: 0;
4 | margin: 0;
5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
7 | }
8 |
9 | a {
10 | color: inherit;
11 | text-decoration: none;
12 | }
13 |
14 | * {
15 | box-sizing: border-box;
16 | }
17 |
--------------------------------------------------------------------------------
/frameworks/nuxt2/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 |
12 | [*.md]
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/frameworks/nuxt2/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Node template
3 | # Logs
4 | /logs
5 | *.log
6 | npm-debug.log*
7 | yarn-debug.log*
8 | yarn-error.log*
9 |
10 | # Runtime data
11 | pids
12 | *.pid
13 | *.seed
14 | *.pid.lock
15 |
16 | # Directory for instrumented libs generated by jscoverage/JSCover
17 | lib-cov
18 |
19 | # Coverage directory used by tools like istanbul
20 | coverage
21 |
22 | # nyc test coverage
23 | .nyc_output
24 |
25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
26 | .grunt
27 |
28 | # Bower dependency directory (https://bower.io/)
29 | bower_components
30 |
31 | # node-waf configuration
32 | .lock-wscript
33 |
34 | # Compiled binary addons (https://nodejs.org/api/addons.html)
35 | build/Release
36 |
37 | # Dependency directories
38 | node_modules/
39 | jspm_packages/
40 |
41 | # TypeScript v1 declaration files
42 | typings/
43 |
44 | # Optional npm cache directory
45 | .npm
46 |
47 | # Optional eslint cache
48 | .eslintcache
49 |
50 | # Optional REPL history
51 | .node_repl_history
52 |
53 | # Output of 'npm pack'
54 | *.tgz
55 |
56 | # Yarn Integrity file
57 | .yarn-integrity
58 |
59 | # dotenv environment variables file
60 | .env
61 |
62 | # parcel-bundler cache (https://parceljs.org/)
63 | .cache
64 |
65 | # next.js build output
66 | .next
67 |
68 | # nuxt.js build output
69 | .nuxt
70 |
71 | # Nuxt generate
72 | dist
73 |
74 | # vuepress build output
75 | .vuepress/dist
76 |
77 | # Serverless directories
78 | .serverless
79 |
80 | # IDE / Editor
81 | .idea
82 |
83 | # Service worker
84 | sw.*
85 |
86 | # macOS
87 | .DS_Store
88 |
89 | # Vim swap files
90 | *.swp
91 |
--------------------------------------------------------------------------------
/frameworks/nuxt2/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "semi": false,
3 | "singleQuote": true
4 | }
5 |
--------------------------------------------------------------------------------
/frameworks/nuxt2/components/NuxtLogo.vue:
--------------------------------------------------------------------------------
1 |
2 |
8 |
12 |
13 |
14 |
15 |
20 |
--------------------------------------------------------------------------------
/frameworks/nuxt2/layouts/default.vue:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
12 |
--------------------------------------------------------------------------------
/frameworks/nuxt2/nuxt.config.js:
--------------------------------------------------------------------------------
1 | export default {
2 | // Global page headers: https://go.nuxtjs.dev/config-head
3 | head: {
4 | title: 'nuxt2',
5 | htmlAttrs: {
6 | lang: 'en',
7 | },
8 | meta: [
9 | { charset: 'utf-8' },
10 | { name: 'viewport', content: 'width=device-width, initial-scale=1' },
11 | { hid: 'description', name: 'description', content: '' },
12 | { name: 'format-detection', content: 'telephone=no' },
13 | ],
14 | link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
15 | },
16 |
17 | // Global CSS: https://go.nuxtjs.dev/config-css
18 | css: [],
19 |
20 | // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
21 | plugins: [],
22 |
23 | // Auto import components: https://go.nuxtjs.dev/config-components
24 | components: true,
25 |
26 | // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
27 | buildModules: ['@nuxt/typescript-build'],
28 |
29 | // Modules: https://go.nuxtjs.dev/config-modules
30 | modules: [],
31 |
32 | // Build Configuration: https://go.nuxtjs.dev/config-build
33 | build: {
34 | transpile: ['@builder.io/todo-app'],
35 | },
36 | }
37 |
--------------------------------------------------------------------------------
/frameworks/nuxt2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nuxt2",
3 | "version": "1.0.0",
4 | "private": true,
5 | "port": 6004,
6 | "scripts": {
7 | "dev": "nuxt -p 6004",
8 | "build": "nuxt build",
9 | "start": "nuxt start -p 6004",
10 | "generate": "nuxt generate",
11 | "preview": "npm start",
12 | "lint:prettier": "prettier --check .",
13 | "lint": "npm run lint:prettier",
14 | "lintfix": "prettier --write --list-different ."
15 | },
16 | "dependencies": {
17 | "@nuxt/typescript-build": "^2.1.0",
18 | "@popperjs/core": "^2.11.6",
19 | "core-js": "^3.19.3",
20 | "fuse.js": "^6.6.2",
21 | "highlight.js": "^11.6.0",
22 | "nuxt": "^2.15.8",
23 | "vue": "^2.6.14",
24 | "vue-server-renderer": "^2.6.14",
25 | "vue-template-compiler": "^2.6.14",
26 | "webpack": "^4.46.0"
27 | },
28 | "devDependencies": {
29 | "eslint-config-prettier": "^8.3.0",
30 | "prettier": "^2.5.1"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/frameworks/nuxt2/pages/dashboard.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/frameworks/nuxt2/pages/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
--------------------------------------------------------------------------------
/frameworks/nuxt2/pages/todo.vue:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/frameworks/nuxt2/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/nuxt2/static/favicon.ico
--------------------------------------------------------------------------------
/frameworks/nuxt2/store/README.md:
--------------------------------------------------------------------------------
1 | # STORE
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your Vuex Store files.
6 | Vuex Store option is implemented in the Nuxt.js framework.
7 |
8 | Creating a file in this directory automatically activates the option in the framework.
9 |
10 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store).
11 |
--------------------------------------------------------------------------------
/frameworks/nuxt2/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2018",
4 | "module": "esnext",
5 | "moduleResolution": "node",
6 | "lib": ["esnext", "esnext.asynciterable", "dom"],
7 | "esModuleInterop": true,
8 | "allowJs": true,
9 | "sourceMap": true,
10 | "strict": false,
11 | "noEmit": true,
12 | "baseUrl": ".",
13 | "paths": {
14 | "~/*": ["./*"],
15 | "@/*": ["./*"]
16 | },
17 | "types": ["@types/node", "@nuxt/types"]
18 | },
19 | "exclude": ["node_modules"]
20 | }
21 |
--------------------------------------------------------------------------------
/frameworks/nuxt3/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.log*
3 | .nuxt
4 | .nitro
5 | .cache
6 | .output
7 | .env
8 | dist
9 |
--------------------------------------------------------------------------------
/frameworks/nuxt3/README.md:
--------------------------------------------------------------------------------
1 | # Nuxt 3 Minimal Starter
2 |
3 | Look at the [nuxt 3 documentation](https://v3.nuxtjs.org) to learn more.
4 |
5 | ## Setup
6 |
7 | Make sure to install the dependencies:
8 |
9 | ```bash
10 | # yarn
11 | yarn install
12 |
13 | # npm
14 | npm install
15 |
16 | # pnpm
17 | pnpm install --shamefully-hoist
18 | ```
19 |
20 | ## Development Server
21 |
22 | Start the development server on http://localhost:3000
23 |
24 | ```bash
25 | npm run dev
26 | ```
27 |
28 | ## Production
29 |
30 | Build the application for production:
31 |
32 | ```bash
33 | npm run build
34 | ```
35 |
36 | Locally preview production build:
37 |
38 | ```bash
39 | npm run preview
40 | ```
41 |
42 | Checkout the [deployment documentation](https://v3.nuxtjs.org/guide/deploy/presets) for more information.
43 |
--------------------------------------------------------------------------------
/frameworks/nuxt3/layouts/default.vue:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
--------------------------------------------------------------------------------
/frameworks/nuxt3/nuxt.config.ts:
--------------------------------------------------------------------------------
1 | import { defineNuxtConfig } from 'nuxt';
2 |
3 | // https://v3.nuxtjs.org/api/configuration/nuxt.config
4 | export default defineNuxtConfig({
5 | nitro: {
6 | compressPublicAssets: true,
7 | prerender: {
8 | routes: [
9 | '/',
10 | '/dashboard',
11 | '/todo'
12 | ]
13 | }
14 | }
15 | });
16 |
--------------------------------------------------------------------------------
/frameworks/nuxt3/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "scripts": {
4 | "build": "nuxt build",
5 | "dev": "nuxt dev -p 6005",
6 | "generate": "nuxt generate",
7 | "preview": "PORT=6005 nuxt preview"
8 | },
9 | "devDependencies": {
10 | "@popperjs/core": "^2.11.6",
11 | "fuse.js": "^6.6.2",
12 | "highlight.js": "^11.6.0",
13 | "nuxt": "npm:nuxt3@3.0.0-rc.8-27697847.a520185"
14 | },
15 | "port": 6005,
16 | "dependencies": {
17 | "color-hash": "^2.0.1"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/frameworks/nuxt3/pages/dashboard-ssr.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
--------------------------------------------------------------------------------
/frameworks/nuxt3/pages/dashboard.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
--------------------------------------------------------------------------------
/frameworks/nuxt3/pages/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
--------------------------------------------------------------------------------
/frameworks/nuxt3/pages/todo.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
--------------------------------------------------------------------------------
/frameworks/nuxt3/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | // https://v3.nuxtjs.org/concepts/typescript
3 | "extends": "./.nuxt/tsconfig.json",
4 | "compilerOptions": {
5 | "esModuleInterop": true
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/frameworks/preact-ssr-node/.gitignore:
--------------------------------------------------------------------------------
1 | dist
--------------------------------------------------------------------------------
/frameworks/preact-ssr-node/http.jsx:
--------------------------------------------------------------------------------
1 | /** @jsx h */
2 | import { h } from 'preact';
3 | import { render } from 'preact-render-to-string';
4 | import Dashboard from './generated-components/components/dashboard.js';
5 | import AppHeader from './generated-components/components/app-header.js';
6 | import http from 'http';
7 |
8 | const App = () => (
9 |
10 |
11 |
12 |
13 |
14 |
15 | );
16 | const port = Number(process.env.port || 6017);
17 |
18 | http
19 | .createServer(function (req, res) {
20 | const str = render( );
21 | res.writeHead(200, {
22 | 'Content-Type': 'text/html',
23 | 'Cache-Control': 'no-transform',
24 | });
25 | res.end(str);
26 | })
27 | .listen(port);
28 |
29 | console.log(`Listening at http://localhost:${port}`);
30 |
--------------------------------------------------------------------------------
/frameworks/preact-ssr-node/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "port": 6017,
3 | "dependencies": {
4 | "@popperjs/core": "^2.11.6",
5 | "fuse.js": "^6.6.2",
6 | "preact": "^10.10.6",
7 | "preact-render-to-string": "^5.2.3"
8 | },
9 | "devDependencies": {
10 | "typescript": "^4.7.4"
11 | },
12 | "type": "module",
13 | "scripts": {
14 | "build": "tsc",
15 | "preview": "node dist/http.js"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/frameworks/qwik/.eslintignore:
--------------------------------------------------------------------------------
1 | **/*.log
2 | **/.DS_Store
3 | *.
4 | .vscode/settings.json
5 | .history
6 | .yarn
7 | bazel-*
8 | bazel-bin
9 | bazel-out
10 | bazel-qwik
11 | bazel-testlogs
12 | dist
13 | dist-dev
14 | lib
15 | etc
16 | external
17 | node_modules
18 | temp
19 | tsc-out
20 | tsdoc-metadata.json
21 | target
22 | output
23 | rollup.config.js
24 | build
25 | .cache
26 | .vscode
27 | .rollup.cache
28 | dist
29 | tsconfig.tsbuildinfo
30 | vite.config.ts
31 |
--------------------------------------------------------------------------------
/frameworks/qwik/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | browser: true,
5 | es2021: true,
6 | node: true,
7 | },
8 | extends: [
9 | 'eslint:recommended',
10 | 'plugin:@typescript-eslint/recommended',
11 | 'plugin:qwik/recommended',
12 | ],
13 | parser: '@typescript-eslint/parser',
14 | parserOptions: {
15 | tsconfigRootDir: __dirname,
16 | project: ['./tsconfig.json'],
17 | ecmaVersion: 2021,
18 | sourceType: 'module',
19 | ecmaFeatures: {
20 | jsx: true,
21 | },
22 | },
23 | plugins: ['@typescript-eslint'],
24 | rules: {
25 | '@typescript-eslint/no-explicit-any': 'off',
26 | '@typescript-eslint/explicit-module-boundary-types': 'off',
27 | '@typescript-eslint/no-inferrable-types': 'off',
28 | '@typescript-eslint/no-non-null-assertion': 'off',
29 | '@typescript-eslint/no-empty-interface': 'off',
30 | '@typescript-eslint/no-namespace': 'off',
31 | '@typescript-eslint/no-empty-function': 'off',
32 | '@typescript-eslint/no-this-alias': 'off',
33 | '@typescript-eslint/ban-types': 'off',
34 | '@typescript-eslint/ban-ts-comment': 'off',
35 | 'prefer-spread': 'off',
36 | 'no-case-declarations': 'off',
37 | 'no-console': 'off',
38 | '@typescript-eslint/no-unused-vars': ['error'],
39 | },
40 | };
41 |
--------------------------------------------------------------------------------
/frameworks/qwik/.gitignore:
--------------------------------------------------------------------------------
1 | # Build
2 | build
3 | dist
4 | lib
5 | server
6 | functions/**/*.js
7 |
8 | # Development
9 | node_modules
10 |
11 | # Cache
12 | .cache
13 | .mf
14 | .vscode
15 | .rollup.cache
16 | tsconfig.tsbuildinfo
17 |
18 | # Logs
19 | logs
20 | *.log
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 | pnpm-debug.log*
25 | lerna-debug.log*
26 |
27 | # Editor
28 | !.vscode/extensions.json
29 | .idea
30 | .DS_Store
31 | *.suo
32 | *.ntvs*
33 | *.njsproj
34 | *.sln
35 | *.sw?
36 |
37 | # Yarn
38 | .yarn/*
39 | !.yarn/releases
--------------------------------------------------------------------------------
/frameworks/qwik/.prettierignore:
--------------------------------------------------------------------------------
1 | **/*.log
2 | **/.DS_Store
3 | *.
4 | .vscode/settings.json
5 | .history
6 | .yarn
7 | dist
8 | dist-dev
9 | etc
10 | external
11 | node_modules
12 | temp
13 | tsc-out
14 | tsdoc-metadata.json
15 | target
16 | output
17 | rollup.config.js
18 | build
19 | .cache
20 | .vscode
21 | .rollup.cache
22 | dist
23 | tsconfig.tsbuildinfo
24 |
--------------------------------------------------------------------------------
/frameworks/qwik/public/_headers:
--------------------------------------------------------------------------------
1 | /build/*
2 | Cache-Control: public, max-age=31536000, s-maxage=31536000, immutable
3 |
--------------------------------------------------------------------------------
/frameworks/qwik/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/qwik/public/favicon.ico
--------------------------------------------------------------------------------
/frameworks/qwik/public/favicons/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/qwik/public/favicons/android-chrome-192x192.png
--------------------------------------------------------------------------------
/frameworks/qwik/public/favicons/android-chrome-256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/qwik/public/favicons/android-chrome-256x256.png
--------------------------------------------------------------------------------
/frameworks/qwik/public/favicons/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BuilderIO/framework-benchmarks/1f4f42e745684e97790d3bed2f449df8da2a638e/frameworks/qwik/public/favicons/apple-touch-icon.png
--------------------------------------------------------------------------------
/frameworks/qwik/src/components/head/head.tsx:
--------------------------------------------------------------------------------
1 | import { component$ } from '@builder.io/qwik';
2 | import { useDocumentHead, useLocation } from '@builder.io/qwik-city';
3 | import global from '../../global.css?inline';
4 |
5 | export const Head = component$(() => {
6 | const head = useDocumentHead();
7 | const loc = useLocation();
8 |
9 | return (
10 |
11 |
12 |
13 | {head.title ? `${head.title} - Qwik` : `Qwik`}
14 |
18 |
19 |
16 |
--------------------------------------------------------------------------------
/frameworks/vue3/src/views/HomeView.vue:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/frameworks/vue3/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { fileURLToPath, URL } from 'node:url';
2 |
3 | import { defineConfig } from 'vite';
4 | import vue from '@vitejs/plugin-vue';
5 | import compress from 'vite-plugin-compress';
6 |
7 | // https://vitejs.dev/config/
8 | export default defineConfig({
9 | plugins: [vue()],
10 | resolve: {
11 | alias: {
12 | '@': fileURLToPath(new URL('./src', import.meta.url)),
13 | },
14 | },
15 | });
16 |
--------------------------------------------------------------------------------
/src/helpers/build.ts:
--------------------------------------------------------------------------------
1 | import { $ } from 'zx';
2 |
3 | /**
4 | * Build a list of frameworks
5 | */
6 | export async function build(frameworks: string[], parallel = true) {
7 | const buildResults: Record = {};
8 |
9 | if (parallel) {
10 | await Promise.all(
11 | frameworks.map(async (framework) => {
12 | buildResults[framework] = await buildFramework(framework);
13 | })
14 | );
15 | } else {
16 | for (const framework of frameworks) {
17 | buildResults[framework] = await buildFramework(framework);
18 | }
19 | }
20 |
21 | return buildResults;
22 | }
23 |
24 | /**
25 | * Build a single framework
26 | */
27 | export async function buildFramework(framework: string) {
28 | const start = Date.now();
29 | const useBun = framework.endsWith('-bun');
30 | await $`cd frameworks/${framework} && ${useBun ? 'bun' : 'npm'} run build`;
31 | return Date.now() - start;
32 | }
33 |
--------------------------------------------------------------------------------
/src/helpers/get-frameworks.ts:
--------------------------------------------------------------------------------
1 | import { fs } from 'zx';
2 |
3 | const FRAMEWORKS = process.env.FRAMEWORKS?.split(',');
4 |
5 | const IGNORE_FRAMEWORKS = ([] as string[]).concat(
6 | process.env.IGNORE_FRAMEWORKS ? process.env.IGNORE_FRAMEWORKS.split(',') : []
7 | );
8 |
9 | /**
10 | * Get the list of frameworks to test
11 | */
12 | export async function getFrameworks() {
13 | if (FRAMEWORKS) {
14 | return FRAMEWORKS;
15 | }
16 | const frameworks = await fs.readdir('./frameworks');
17 | return frameworks
18 | .filter((item) => !IGNORE_FRAMEWORKS.includes(item))
19 | .reverse();
20 | }
21 |
--------------------------------------------------------------------------------
/src/helpers/get-js-size.ts:
--------------------------------------------------------------------------------
1 | export type NetworkRequestItem = {
2 | url: string;
3 | transferSize: number;
4 | resourceType: string;
5 | };
6 |
7 | export type TreemapNode = {
8 | name: string;
9 | resourceBytes: number;
10 | };
11 |
12 | /**
13 | * From a lighthouse report, get the size of all JS requested
14 | *
15 | * @param {LighthouseReport} report - lighthouse report
16 | * @returns {number} - size of all JS requested in kb
17 | */
18 | export function getJsSize(report: LH.Result) {
19 | try {
20 | const scriptTagBytes =
21 | (
22 | (report.audits['network-requests'] as any)?.details
23 | .items as NetworkRequestItem[]
24 | )
25 | ?.filter((item) => item.resourceType === 'Script')
26 | ?.reduce((acc, item) => acc + item.transferSize, 0) || 0;
27 |
28 | const inlineJsBytes =
29 | (
30 | (report.audits['script-treemap-data'] as any)?.details?.nodes?.[0]
31 | ?.children as TreemapNode[]
32 | )?.reduce((memo, node) => {
33 | if (node.name.startsWith('(inline)')) {
34 | return memo + node.resourceBytes || 0;
35 | }
36 | return memo;
37 | }, 0) || 0;
38 |
39 | return scriptTagBytes + inlineJsBytes;
40 | } catch (err) {
41 | console.warn('Could not get JS size', err);
42 | return 0;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/helpers/get-port.ts:
--------------------------------------------------------------------------------
1 | import { fs } from 'zx';
2 |
3 | /**
4 | * Get the port a given framework runs on
5 | */
6 | export async function getPort(framework: string) {
7 | const { port } = JSON.parse(
8 | await fs.readFile(`./frameworks/${framework}/package.json`, 'utf8')
9 | );
10 | return port;
11 | }
12 |
--------------------------------------------------------------------------------
/src/helpers/get-simple-report.ts:
--------------------------------------------------------------------------------
1 | import { getJsSize } from './get-js-size.js';
2 |
3 | export type SimpleReport = {
4 | jsKb?: number;
5 | totalKb?: number;
6 | fcpDisplay?: string;
7 | fcpNumber?: number;
8 | tbtDisplay?: string;
9 | tbtNumber?: number;
10 | ttiDisplay?: string;
11 | ttiNumber?: number;
12 | lcpDisplay?: string;
13 | lcpNumber?: number;
14 | score?: number;
15 | };
16 |
17 | export function getSimpleReport(report: LH.Result) {
18 | const jsSize = Math.round(getJsSize(report) / 1024);
19 | const fcp = report.audits['first-contentful-paint'];
20 | const lcp = report.audits['largest-contentful-paint'];
21 | const tbt = report.audits['total-blocking-time'];
22 | const tti = report.audits['interactive'];
23 | const score = (report.categories.performance.score || 0) * 100;
24 |
25 | const simpleReport = {
26 | jsKb: jsSize,
27 | totalKb: Math.round(
28 | (report.audits['total-byte-weight']?.numericValue || 0) / 1024
29 | ),
30 | fcpDisplay: fcp?.displayValue,
31 | fcpNumber: fcp?.numericValue,
32 | tbtDisplay: tbt?.displayValue,
33 | tbtNumber: tbt?.numericValue,
34 | ttiDisplay: tti?.displayValue,
35 | ttiNumber: tti?.numericValue,
36 | lcpDisplay: lcp?.displayValue,
37 | lcpNumber: lcp?.numericValue,
38 | score,
39 | };
40 | return simpleReport;
41 | }
42 |
--------------------------------------------------------------------------------
/src/helpers/get-table.ts:
--------------------------------------------------------------------------------
1 | import { SimpleReport } from './get-simple-report.js';
2 | import { sortBy } from './sort-by.js';
3 |
4 | export function getTable(results: Record) {
5 | const table = Object.keys(results)
6 | // Add the framework name to the object
7 | .map((framework) => ({
8 | name: framework,
9 | ...results[framework],
10 | }))
11 | // Only include successful results (failed results have undefined values)
12 | .filter((item) => typeof item.jsKb === 'number')
13 | // Rank by tti
14 | .sort(sortBy('ttiNumber'))
15 | // Pick the display values
16 | .map((item) => ({
17 | name: item.name,
18 | TTI: item.ttiDisplay,
19 | FCP: item.fcpDisplay,
20 | LCP: item.lcpDisplay,
21 | TBT: item.tbtDisplay,
22 | Score: item.score,
23 | 'Eager JS KiB': item.jsKb,
24 | 'Total KiB': item.totalKb,
25 | // Getting really weird results for LCP, commenting out for now
26 | // LCP: item.lcpDisplay,
27 | }));
28 |
29 | return table;
30 | }
31 |
--------------------------------------------------------------------------------
/src/helpers/install.ts:
--------------------------------------------------------------------------------
1 | import { $ } from 'zx';
2 | import { getFrameworks } from './get-frameworks.js';
3 |
4 | export async function install(framework: string, packageName?: string) {
5 | return $`cd frameworks/${framework} && npm install ${packageName || ''}`;
6 | }
7 |
8 | // Fresh uses deno, so we do not npm install dependencies
9 | const noInstallFrameworks = new Set(['fresh']);
10 |
11 | export async function installAll(frameworks?: string[], packageName?: string) {
12 | if (!frameworks) {
13 | frameworks = await getFrameworks();
14 | }
15 | return Promise.all(
16 | frameworks
17 | .filter((framework) => !noInstallFrameworks.has(framework))
18 | .map((framework) => install(framework, packageName))
19 | );
20 | }
21 |
--------------------------------------------------------------------------------
/src/helpers/kill-process.ts:
--------------------------------------------------------------------------------
1 | import { $ } from 'zx';
2 | import { getPort } from './get-port.js';
3 |
4 | /**
5 | * Kill process by port
6 | */
7 | export async function killProcess(port: number) {
8 | return $`lsof -t -i tcp:${port} | xargs kill`.catch(() => null);
9 | }
10 |
11 | /**
12 | * Loop over all frameworks, find their port, and kill their
13 | * servers if running
14 | */
15 | export async function killAll(frameworks: string[]) {
16 | const ports = new Set(await Promise.all(frameworks.map(getPort)));
17 | return Promise.all(Array.from(ports).map(killProcess));
18 | }
19 |
--------------------------------------------------------------------------------
/src/helpers/lighthouse.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | declare module 'lighthouse' {
4 | function lighthouse(
5 | url: string,
6 | options: Partial,
7 | config?: any
8 | ): Promise;
9 | export default lighthouse;
10 | }
11 |
12 | declare module 'lighthouse/report/generator/report-generator.js' {
13 | export class ReportGenerator {
14 | static generateReport(lhr: LH.LHResult, type: string): string;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/helpers/preview.ts:
--------------------------------------------------------------------------------
1 | import { $ } from 'zx';
2 | import { getPort } from './get-port.js';
3 |
4 | export async function preview(framework: string) {
5 | const port = await getPort(framework);
6 | if (!port) {
7 | throw new Error(
8 | `Could not find port for ${framework}, be sure to add it to package.json like: "port": 8080`
9 | );
10 | }
11 |
12 | const useBun = framework.endsWith('-bun');
13 |
14 | const process = $`cd frameworks/${framework} && ${
15 | useBun ? 'bun' : 'npm'
16 | } run preview`;
17 |
18 | return {
19 | process,
20 | port,
21 | };
22 | }
23 |
--------------------------------------------------------------------------------
/src/helpers/range.ts:
--------------------------------------------------------------------------------
1 | export const range = (n: number) => Array.from({ length: n }, (_, k) => k);
2 |
--------------------------------------------------------------------------------
/src/helpers/sort-by.ts:
--------------------------------------------------------------------------------
1 | export type AnyObject = Record;
2 |
3 | export function sortBy(key: keyof T) {
4 | return (a: T, b: T) => (a[key] > b[key] ? 1 : b[key] > a[key] ? -1 : 0);
5 | }
6 |
--------------------------------------------------------------------------------
/src/scripts/build.ts:
--------------------------------------------------------------------------------
1 | import chalk from 'chalk';
2 | import { build } from '../helpers/build.js';
3 | import { getFrameworks } from '../helpers/get-frameworks.js';
4 | import { sortBy } from '../helpers/sort-by.js';
5 |
6 | const frameworks = await getFrameworks();
7 |
8 | console.info(chalk.green(`Building frameworks...`));
9 | const times = await build(frameworks, process.env.PARALLEL !== 'false');
10 |
11 | console.table(getTable(times));
12 |
13 | function getTable(results: Record) {
14 | const table = Object.keys(results)
15 | // Add the framework name to the object
16 | .map((framework) => ({
17 | name: framework,
18 | time: results[framework],
19 | }))
20 | // Rank by tti
21 | .sort(sortBy('time'))
22 | // Pick the display values
23 | .map((item) => ({
24 | Name: item.name,
25 | 'Build Time (Seconds)': Math.round(item.time / 100) / 10,
26 | }));
27 |
28 | return table;
29 | }
30 |
--------------------------------------------------------------------------------
/src/scripts/clean.ts:
--------------------------------------------------------------------------------
1 | import { glob, fs } from 'zx';
2 |
3 | const files = await glob([
4 | 'frameworks/**/generated-components/**',
5 | '!**/node_modules/**',
6 | ]);
7 | await Promise.all(
8 | files.map(async (file) => {
9 | await fs.remove(file);
10 | })
11 | );
12 |
--------------------------------------------------------------------------------
/src/scripts/dev.ts:
--------------------------------------------------------------------------------
1 | import { $ } from 'zx/core';
2 | import { getFrameworks } from '../helpers/get-frameworks.js';
3 |
4 | const frameworks = await getFrameworks();
5 | frameworks.forEach((fw) =>
6 | $`cd frameworks/${fw} && npm run dev`.catch((err) => {
7 | console.error('Error in framework', fw, err);
8 | throw err;
9 | })
10 | );
11 |
--------------------------------------------------------------------------------
/src/scripts/gen-simple-reports.ts:
--------------------------------------------------------------------------------
1 | import { glob, fs, chalk } from 'zx';
2 | import { getSimpleReport, SimpleReport } from '../helpers/get-simple-report.js';
3 | import { getTable } from '../helpers/get-table.js';
4 |
5 | const reports = await glob('apps/components/src/reports/**/*.json');
6 |
7 | type ResultsMap = Record;
8 | type PathResultsMap = Record;
9 | const pathResultsMap: PathResultsMap = {};
10 |
11 | const IGNORE_FRAMEWORKS = process.env.IGNORE_FRAMEWORKS?.split(',') || [];
12 |
13 | await Promise.all(
14 | reports.map(async (path) => {
15 | const pathSplit = path.split('/');
16 | let routePathPart = pathSplit.at(-2)!;
17 | if (routePathPart === 'reports') {
18 | routePathPart = 'hello-world';
19 | }
20 | const framework = pathSplit.at(-1)!.split('.json')[0];
21 | if (IGNORE_FRAMEWORKS.includes(framework)) {
22 | return;
23 | }
24 | const json = JSON.parse(await fs.readFile(path, 'utf8')) as LH.Result;
25 | const newFilePath = path.replace('.json', '_simple.ts');
26 | const simpleReport = getSimpleReport(json);
27 |
28 | if (!pathResultsMap[routePathPart]) {
29 | pathResultsMap[routePathPart] = {};
30 | }
31 | pathResultsMap[routePathPart][framework] = simpleReport;
32 |
33 | const newFile = `
34 | // Generated from benchmark data
35 | export default ${JSON.stringify(simpleReport, null, 2)}`;
36 | await fs.writeFile(newFilePath, newFile);
37 | })
38 | );
39 |
40 | for (const key of Object.keys(pathResultsMap)) {
41 | const resultsMap = pathResultsMap[key];
42 | const table = getTable(resultsMap);
43 | console.info(chalk.green(`Results for ${key}:`));
44 | console.table(table);
45 | }
46 |
--------------------------------------------------------------------------------
/src/scripts/install.ts:
--------------------------------------------------------------------------------
1 | import { installAll } from '../helpers/install.js';
2 |
3 | await installAll(undefined, process.env.PACKAGE);
4 |
--------------------------------------------------------------------------------
/src/scripts/kill.ts:
--------------------------------------------------------------------------------
1 | import { getFrameworks } from '../helpers/get-frameworks.js';
2 | import { killAll } from '../helpers/kill-process.js';
3 |
4 | // Kill all processes running on our framework ports
5 | killAll(await getFrameworks());
6 |
--------------------------------------------------------------------------------
/src/scripts/serve.ts:
--------------------------------------------------------------------------------
1 | import { getFrameworks } from '../helpers/get-frameworks.js';
2 | import { preview } from '../helpers/preview.js';
3 |
4 | const frameworks = await getFrameworks();
5 | frameworks.forEach((fw) => preview(fw));
6 |
--------------------------------------------------------------------------------
/src/typings.d.ts:
--------------------------------------------------------------------------------
1 | import { Page } from 'puppeteer';
2 |
3 | declare module 'lighthouse/core/lib/median-run.js' {
4 | export function computeMedianRun(runs: LH.Result[]): LH.Result;
5 | }
6 |
7 | declare module 'lighthouse/core/fraggle-rock/api.js' {
8 | export async function startFlow(page: Page, options: any): any;
9 | export async function auditFlowArtifacts(artifact: any): Promise;
10 | }
11 |
--------------------------------------------------------------------------------