From 34182e69f71235c92249db7b695f4dc750221c0f Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:02 +0200 Subject: [PATCH 001/290] Revert "fix vite ecosystem - second try" This reverts commit 22f54c501fdd72aac43ac29e02f176cc1e6ae7f2. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 82735df5d53..0422ae62edd 100644 --- a/package.json +++ b/package.json @@ -202,7 +202,7 @@ "build.platform.copy": "tsm scripts/index.ts --platform-binding-wasm-copy", "build.qwik-city": "tsm scripts/index.ts --tsc --qwikcity", "build.validate": "tsm scripts/index.ts --tsc --build --api --eslint --qwikcity --platform-binding --wasm --validate", - "build.vite": "tsm scripts/index.ts --tsc --build --api --qwikcity --eslint --platform-binding-wasm-copy", + "build.vite": "pnpm i && tsm scripts/index.ts --tsc --build --api --qwikcity --eslint --qwiklabs --platform-binding-wasm-copy", "build.wasm": "tsm scripts/index.ts --wasm", "build.watch": "tsm scripts/index.ts --build --qwikcity --watch --dev --platform-binding", "change": "changeset", From 3cb61347f8e3abec847ba0aed439b5aa18b0e348 Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:04 +0200 Subject: [PATCH 002/290] Revert "added governance doc" This reverts commit 89fbe7853ef8a010bbf7167923ad4e8a9beef53d. --- GOVERNANCE.md | 143 -------------------------------------------------- 1 file changed, 143 deletions(-) delete mode 100644 GOVERNANCE.md diff --git a/GOVERNANCE.md b/GOVERNANCE.md deleted file mode 100644 index 8b9357d3589..00000000000 --- a/GOVERNANCE.md +++ /dev/null @@ -1,143 +0,0 @@ -# Qwik Project Governance - -This governance document reflects our dedication to maintaining Qwik as an open, fair, and collaborative project and is a continuation of our [community values](https://docs.google.com/document/d/1MrSp2caaREETHUL56C2fIIJeFJsBA_sWJ9raL6hWoo8/edit#heading=h.bpbzghkvfgrn). - -Qwik is rooted in a commitment to innovation and community-driven development where the needs of the community drive the framework's evolution. - -Our decisions are guided by what serves Qwik and the broader web ecosystem best, with a strong emphasis on seeking consensus. - -The following outlines the structure of the project, including the roles and responsibilities of its members. - -## Community Contributors - -A Community contributor is any community member who contributes to the success of the framework. - -Contributors usually are part of one or more of the following categories: - -1. **Code Contributors** - Developers who contribute by identifying issues, submitting pull requests, or maintaining community-driven Qwik projects. -2. **Docs Contributors** - Members who enhance or correct the Qwik documentation, ensuring it remains accurate and accessible. -3. **Support Contributors** - Members who assist other developers by answering questions and offering support. -4. **Content Creators** - Those who produce educational content, tutorials, and other resources to help the community better understand and use Qwik. -5. **Local Community Leaders** - Members who organize and lead local Qwik communities, fostering in-person engagement and knowledge sharing. - -## Qwik Heroes - -Qwik Heroes are recognized as top contributors who have exceptional dedication and enthusiasm for Qwik. - -Heroes have easier access to the core team and participate in monthly meetings to provide feedback, ask questions, and discuss internal topics together with the team. - -#### Nomination - -Any community contributor can be nominated as a Qwik Hero by an existing member or by any of the leadership teams. Selections are made by the Community Management Team (and in conjunction with the core team for cases of “code heroes”). - -#### Status Change - -Removal of Qwik Heroes is done by either a voluntary resignation or by a Community Management Team decision, or (in extreme cases) by a Stewardship Team motion. - -Qwik Heroes who become inactive for 6 months are automatically reverted to regular community contributor status. - -## Core Team - -Core team members are contributors who have merging rights to the project and are actively involved in the ongoing development of Qwik. They are essential to the framework's evolution, participating in weekly sprint meetings and Core Leadership meetings (although only Core Leadership members can vote in these meetings). - -The Core Team will have a Core Team Lead who will be in charge of the ongoing project management and development progress. - -#### Nomination - -A Qwik Hero member can be nominated as a Core Team member by any member of the Core Team. Nominations are decided upon by a standard Core Leadership motion. - -#### Status Change - -Removal of Core Team members is done by either a voluntary resignation or by a standard Core Leadership motion, or (in extreme cases) by a Stewardship Team motion. - -A Core Team member will be automatically converted back to a "Qwik Hero" if they are not active in the project for over 3 months. - -## Core Leadership Team - -The Core Leadership Team includes Core Team members who are granted voting rights on strategic technical decisions. - -These individuals are selected because of their experience, judgment, good faith, and alignment with Qwik's core values. - -Members of this team are expected to participate in Core Leadership Team activities and meetings and can cast votes when consensus is not reached on a specific decision. - -#### Nomination - -Regular Core Team members can be nominated to the Core Leadership Team by any current Core Leadership member, with the final decision made through a standard Core Leadership motion. - -#### Status Change - -Removal of voting Core Leadership members is done by either a voluntary resignation or by a standard Core Leadership motion, or (in extreme cases) by a Stewardship Team motion. - -A Core Leadership member will be automatically converted to a regular Core Team member if they do not participate in 3 consecutive votes or have been inactive for over 4 months. - -## Docs Team - -The Docs Team is responsible for maintaining and improving Qwik's documentation. - -This team ensures that the documentation is up-to-date, accurate, and user-friendly, and also handles the triage of docs-related issues and the merging of related PRs. - -#### Nomination - -A Qwik Hero member can be nominated as a Docs Team member by any member of the Docs Team. Nominations need to be approved by the Growth Manager. - -#### Status Change - -Removal of Docs Team members is done by either a voluntary resignation or by a Growth Manager decision, or (in extreme cases) by a Stewardship Team motion. - -A Docs Team member will be automatically converted back to a "Qwik Hero" if they are not active in the project for over 3 months. - -## Community Management Team - -The Community Management Team oversees the onboarding, safety, and overall vibe of the Qwik community. - -They ensure that the community remains a friendly and inclusive space where members follow the Qwik community guidelines. - -The team is responsible for managing "Local Community Leaders" and "Support Heroes" and helping them succeed in their roles and contributions. - -#### Nomination - -Qwik Heroes may be nominated to the Community Management Team by any current team member. Nominations need to be approved by the Growth Manager. - -#### Status Change - -Removal of Community Management Team members is done by either a voluntary resignation or by a Growth Manager decision, or (in extreme cases) by a Stewardship Team motion. - -A Community Management Team member will be automatically converted back to a "Qwik Hero" if they are not active in the project for over 3 months. - -## Outreach Team - -The Outreach Team is responsible of spreading Qwik's message, ensuring that more developers are introduced to the framework and give it a try. Their responsibilities include managing social media, collaborating with content creators, representing Qwik at conferences, and more. - -#### Nomination - -Qwik Heroes may be nominated to the Outreach Team by any current team member. Nominations need to be approved by the Growth Manager. - -#### Status Change - -Removal of Outreach Team members is done by either a voluntary resignation or by a Growth Manager decision, or (in extreme cases) by a Stewardship Team motion. - -An Outreach Team member will be automatically converted back to a "Qwik Hero" if they are not active in the project for over 3 months. - -## Growth Manager - -The Growth Manager is responsible for overseeing the Community Management, Outreach, and Docs Teams, ensuring that their efforts are aligned and that messaging across these teams remains consistent. - -This role is crucial in driving the strategic direction of Qwik's growth and ensuring that all community-facing activities are cohesive and effective. - -The Growth Manager is appointed or replaced by a standard Stewardship Team motion. - -## Stewardship Team - -The project's stewards are in charge of all aspects regarding the framework. - -This includes the development, community, and growth of the framework, but also creating proper management processes, managing sponsorships and budgets, collaborations, and more. - -The project stewards are: Misko Hevery and Shai Reznik. - -The project stewards will be used as "tiebreakers" in votes and hold veto rights on decisions (to protect the framework from rare and extreme cases). - -Because the framework can be forked by the community at any point, the project stewards must manage the project in a fair, honest, and thoughtful way, taking into account what's good for the community and resolving conflicting needs as much as possible. - ---- - -inspired by [Node](https://github.com/nodejs/node/blob/main/GOVERNANCE.md), [Vue](https://github.com/vuejs/vue/wiki/Governance-Document), [Astro](https://github.com/withastro/.github/blob/main/GOVERNANCE.md) and [Nuxt](https://github.com/nuxt/governance) From 9af67d8026633fd3ab9a530ce3dd744ebf3f3053 Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:05 +0200 Subject: [PATCH 003/290] Revert "fixed build for vite ecosystem ci" This reverts commit 044dbe0d5862cc389fbd2280b78c0fec70447706. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0422ae62edd..65272fe481f 100644 --- a/package.json +++ b/package.json @@ -202,7 +202,7 @@ "build.platform.copy": "tsm scripts/index.ts --platform-binding-wasm-copy", "build.qwik-city": "tsm scripts/index.ts --tsc --qwikcity", "build.validate": "tsm scripts/index.ts --tsc --build --api --eslint --qwikcity --platform-binding --wasm --validate", - "build.vite": "pnpm i && tsm scripts/index.ts --tsc --build --api --qwikcity --eslint --qwiklabs --platform-binding-wasm-copy", + "build.vite": "tsm scripts/index.ts --tsc --build --api --qwikcity --eslint --qwiklabs --platform-binding-wasm-copy", "build.wasm": "tsm scripts/index.ts --wasm", "build.watch": "tsm scripts/index.ts --build --qwikcity --watch --dev --platform-binding", "change": "changeset", From b0ba413708f488956a98d514ff3c07ef637d15eb Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:06 +0200 Subject: [PATCH 004/290] Revert "docs: update index.mdx (#6813)" This reverts commit 477b5e003e95c58c2c6f06e529dbce34e32e4003. --- packages/docs/src/routes/docs/(qwik)/components/tasks/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/src/routes/docs/(qwik)/components/tasks/index.mdx b/packages/docs/src/routes/docs/(qwik)/components/tasks/index.mdx index ac16eb1f1bd..7850ac41854 100644 --- a/packages/docs/src/routes/docs/(qwik)/components/tasks/index.mdx +++ b/packages/docs/src/routes/docs/(qwik)/components/tasks/index.mdx @@ -159,7 +159,7 @@ Use `useTask$()` when you need to: ### On mount In Qwik, there isn't a specific "mount" step like in some other frameworks. Instead, components just start up directly where they're needed, either on a web server or in your browser. -This is without the inner track function, which is used to monitor specific pieces of data. +This is without the the inner track function, which is used to monitor specific pieces of data. `useTask$` runs always at least once when the component is first mounted. From 98ccaacb48732cf4f2a83bf1a2b204a796b873ea Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:06 +0200 Subject: [PATCH 005/290] Revert "docs: add info about Link prefetch option (#6814)" This reverts commit cd1e68c8ef2489759886edbb39b9038601ef2df1. --- .../src/routes/docs/(qwikcity)/api/index.mdx | 35 ------------------- 1 file changed, 35 deletions(-) diff --git a/packages/docs/src/routes/docs/(qwikcity)/api/index.mdx b/packages/docs/src/routes/docs/(qwikcity)/api/index.mdx index d5b00e5c86e..5dd5af43c62 100644 --- a/packages/docs/src/routes/docs/(qwikcity)/api/index.mdx +++ b/packages/docs/src/routes/docs/(qwikcity)/api/index.mdx @@ -453,38 +453,3 @@ export default component$(() => { ); }); ``` - -### Prefetch - -Whether Qwik should prefetch and cache the target page of this `Link`, this includes invoking any `routeLoader$`, `onGet`, etc. - -This **improves UX performance** for client-side (**SPA**) navigations. - -Prefetching occurs when a the Link enters the viewport in production (`on:qvisibile`), or with `mouseover`/`focus` during dev. - -Prefetching will not occur if the user has the **data saver** setting enabled. - -Setting this value to `"js"` will prefetch only javascript bundles required to render this page on the client, `false` will disable prefetching altogether. - -> Warning: if you have a menu with many links, all of them will be loaded immediately when you enter the production page, which may result with too many requests - -```tsx -import { component$ } from '@builder.io/qwik'; -import { Link } from '@builder.io/qwik-city'; - -export default component$(() => { - return ( -
- - page will not be prefetched - - - page js will be prefetched - - - page content & js will be prefetched - -
- ); -}); -``` From 4626e7a3b158def338d7895780490ce8a981c347 Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:06 +0200 Subject: [PATCH 006/290] Revert "fixed insights link" This reverts commit 072c38f43e2ac434bb4a6a4f5aca8104dfd61e85. --- packages/docs/src/routes/docs/labs/insights/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/src/routes/docs/labs/insights/index.mdx b/packages/docs/src/routes/docs/labs/insights/index.mdx index be5956c6a9a..89e26fa322c 100644 --- a/packages/docs/src/routes/docs/labs/insights/index.mdx +++ b/packages/docs/src/routes/docs/labs/insights/index.mdx @@ -56,7 +56,7 @@ export default component$(() => { }); ``` -You can get `PUBLIC_QWIK_INSIGHTS_KEY` by visiting [Qwik Insight](https://insights.qwik.dev/app/add/). +You can get `PUBLIC_QWIK_INSIGHTS_KEY` by visiting [Qwik Insight](https://qwik-insights.builder.io/app/add/). The `` component collects this data: - Timing information of symbols. From 98165a1c19aa05b7e9bb31079fa94ce4ad9f54a8 Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:06 +0200 Subject: [PATCH 007/290] Revert "docs: add new showcase site (#6776)" This reverts commit cb69e99f346b893ef2a1ed6613cb9f24cf6897c3. --- packages/docs/scripts/pages.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/docs/scripts/pages.json b/packages/docs/scripts/pages.json index 40a2d4b5bb6..c3d08f502d7 100644 --- a/packages/docs/scripts/pages.json +++ b/packages/docs/scripts/pages.json @@ -1,9 +1,4 @@ [ - { - "href": "https://www.learn-qwik.com/", - "size": "large", - "tags": "site,tutorial,learn" - }, { "href": "https://sasthyaseba.com", "size": "large", From 4a091aa9fe0858c815786ff2129a064758b4d58a Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:06 +0200 Subject: [PATCH 008/290] Revert "fix(qwik-city): Avoided unexpected caching for dynamic q-data (#6797)" This reverts commit 7adb75a159e6698617af61a6200c2a77aea300d5. --- .../docs/src/repl/worker/app-bundle-client.ts | 2 +- .../qwik-city/src/runtime/src/use-endpoint.ts | 16 ++-------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/packages/docs/src/repl/worker/app-bundle-client.ts b/packages/docs/src/repl/worker/app-bundle-client.ts index 7c8cbf4befd..74ff58fb243 100644 --- a/packages/docs/src/repl/worker/app-bundle-client.ts +++ b/packages/docs/src/repl/worker/app-bundle-client.ts @@ -19,7 +19,7 @@ export const appBundleClient = async ( srcInputs: getInputs(options), // Older versions don't support `segment` entryStrategy: - options.entryStrategy?.type === 'segment' ? { type: 'hook' } : options.entryStrategy, + options.entryStrategy.type === 'segment' ? { type: 'hook' } : options.entryStrategy, manifestOutput: (m) => { result.manifest = m; }, diff --git a/packages/qwik-city/src/runtime/src/use-endpoint.ts b/packages/qwik-city/src/runtime/src/use-endpoint.ts index 20622cd01b3..ecca5964d14 100644 --- a/packages/qwik-city/src/runtime/src/use-endpoint.ts +++ b/packages/qwik-city/src/runtime/src/use-endpoint.ts @@ -28,7 +28,7 @@ export const loadClientData = async ( let resolveFn: () => void | undefined; if (!qData) { - const fetchOptions = getFetchOptions(opts?.action, opts?.clearCache); + const fetchOptions = getFetchOptions(opts?.action); if (opts?.action) { opts.action.data = undefined; } @@ -88,21 +88,9 @@ export const loadClientData = async ( }); }; -const getFetchOptions = ( - action: RouteActionValue | undefined, - noCache: boolean | undefined -): RequestInit | undefined => { +const getFetchOptions = (action: RouteActionValue | undefined): RequestInit | undefined => { const actionData = action?.data; if (!actionData) { - if (noCache) { - return { - cache: 'no-cache', - headers: { - 'Cache-Control': 'no-cache', - Pragma: 'no-cache', - }, - }; - } return undefined; } if (actionData instanceof FormData) { From f61ad054872434c9a4e2da9df221b8df332eb6b6 Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:06 +0200 Subject: [PATCH 009/290] Revert "docs: add Core api reference in the the menu (#6792)" This reverts commit 60839895c725a12e72d9a9fcfa34f97b7bb76b46. --- packages/docs/src/routes/docs/menu.md | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/docs/src/routes/docs/menu.md b/packages/docs/src/routes/docs/menu.md index fb07fe804b1..6bcb34502cb 100644 --- a/packages/docs/src/routes/docs/menu.md +++ b/packages/docs/src/routes/docs/menu.md @@ -17,7 +17,6 @@ - [Slots]() - [Rendering]() - [Styling]() -- [API Reference]() ## Qwik City From fbb3f344fed4e7fbfbf0e73113b853213ad68b1c Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:07 +0200 Subject: [PATCH 010/290] Revert "docs: update the location of the re-loader to be under /(qwik-cty) instead of /cookbook (#6794)" This reverts commit f7aef1040d8f193ea143d5000817ab5011187237. --- .../docs/src/routes/docs/(qwikcity)/action/index.mdx | 10 +++++----- .../src/routes/docs/(qwikcity)/route-loader/index.mdx | 4 +++- .../re-exporting-loaders/index.mdx | 0 packages/docs/src/routes/docs/menu.md | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) rename packages/docs/src/routes/docs/{(qwikcity) => cookbook}/re-exporting-loaders/index.mdx (100%) diff --git a/packages/docs/src/routes/docs/(qwikcity)/action/index.mdx b/packages/docs/src/routes/docs/(qwikcity)/action/index.mdx index 4cd6d2d806e..75ab808f635 100644 --- a/packages/docs/src/routes/docs/(qwikcity)/action/index.mdx +++ b/packages/docs/src/routes/docs/(qwikcity)/action/index.mdx @@ -31,7 +31,7 @@ created_at: '2023-03-20T23:45:13Z' # `routeAction$()` -`routeAction$()` is used to define functions called actions that execute exclusively on the server, and only when explicitly called. Actions can have side effects such as writing to a database or sending an email, that cannot happen during client-side rendering. This makes them ideal for handling form submissions, performing operations with side effects, and then returning data back to the client/browser where it can be used to update the UI. +`routeAction$()` is used to define functions called actions that execute exclusively on the server, and only when explicitly called. Actions can have side effects such as writing to a database or sending an email, that cannot happen during client-side rendering. This makes them ideal for handling form submissions, performing operations with side effects, and then returning data back to the client/browser where it can be used to update the UI. Actions can be declared using `routeAction$()` or `globalAction$()` exported from `@builder.io/qwik-city`. @@ -256,7 +256,7 @@ Please refer to the [Zod documentation](https://zod.dev/) for more information o ### Advanced event based validation -The constructor of ```zod$``` can also take a function, as the first argument is zod itself, so you can use this directly to build the schema. +The constructor of ```zod$``` can also take a function, as the first argument is zod itself, so you can use this directly to build the schema. The second parameter is the RequestEvent to construct an event-based zod schema. Especially in combination with ```refine``` and ```superRefine``` in zod, the only limit is your imagination. @@ -264,7 +264,7 @@ Especially in combination with ```refine``` and ```superRefine``` in zod, the on ```tsx {5-5} /ev/#a title="Advanced event based validation" export const useAddUser = routeAction$( async (user) => { - // The "user" is still strongly typed, but firstname + // The "user" is still strongly typed, but firstname // is now optional: { firstName?: string | undefined, lastName: string } const userID = await db.users.add({ firstName: user.firstName, @@ -341,7 +341,7 @@ export const useAddUser = routeAction$( Failures are stored in the `action.value` property, just like the success value. However, the `action.value.failed` property is set to `true` when the action fails. Futhermore, failure messages can be found in the `fieldErrors` object according to properties defined in your Zod schema. -The `fieldErrors` become a dot notation object. See [Complex forms](/docs/advanced/complex-forms) for more information. +The `fieldErrors` become a dot notation object. See [Complex forms](/docs/advanced/complex-forms) for more information. ```tsx import { component$ } from '@builder.io/qwik'; @@ -397,7 +397,7 @@ It's recommended to start with `routeAction$()`. Use `globalAction$()` only when `routeAction$()` can only be declared inside the `src/routes` folder, in a `layout.tsx` or `index.tsx` file, and they MUST be exported, just like a `routeLoader$()`. Since `routeAction$()`s are only accessible within the route it's declared, they are recommended when the action needs to access some user data, or it's a protected route. Think about it like a "private" action. -> If you want to manage common reusable routeAction$() it is essential that this function is re-exported from within 'layout.tsx' or 'index.tsx file of the existing route otherwise it will not run or throw exception. For more information [check this section](/docs/(qwikcity)/re-exporting-loaders/index.mdx). +> If you want to manage common reusable routeAction$() it is essential that this function is re-exported from within 'layout.tsx' or 'index.tsx file of the existing route otherwise it will not run or throw exception. For more information [check the cookbook](/docs/cookbook/re-exporting-loaders/index.mdx). ```tsx title="src/routes/form/index.tsx" import { routeAction$ } from '@builder.io/qwik-city'; diff --git a/packages/docs/src/routes/docs/(qwikcity)/route-loader/index.mdx b/packages/docs/src/routes/docs/(qwikcity)/route-loader/index.mdx index e53b5db14c4..3e41c10f83a 100644 --- a/packages/docs/src/routes/docs/(qwikcity)/route-loader/index.mdx +++ b/packages/docs/src/routes/docs/(qwikcity)/route-loader/index.mdx @@ -24,7 +24,7 @@ Route Loaders load data in the server so it becomes available to use inside Qwik Route Loaders can only be declared inside the `src/routes` folder, in a `layout.tsx` or `index.tsx` file, and they MUST be exported. -> If you want to manage common reusable routeLoaders$ it is essential that this function is re-exported from within 'layout.tsx' or 'index.tsx file of the existing route otherwise it will not run or throw exception. For more information [check this section](/docs/(qwikcity)/re-exporting-loaders/index.mdx). +> If you want to manage common reusable routeLoaders$ it is essential that this function is re-exported from within 'layout.tsx' or 'index.tsx file of the existing route otherwise it will not run or throw exception. For more information [check the cookbook](/docs/cookbook/re-exporting-loaders/index.mdx). ```tsx /routeLoader$/ /useProductData/#a title="src/routes/product/[productId]/index.tsx" import { component$ } from '@builder.io/qwik'; @@ -238,3 +238,5 @@ export default component$(() => { Route Loaders are executed on the server, after every navigation. This means that they are executed every time a user navigates to a page in an SPA or MPA, and they are executed even if the user is navigating to the same page. Loaders execute after the Qwik Middleware handlers (`onRequest`, `onGet`, `onPost`, etc), and before the Qwik Components are rendered. This allows the loaders to start fetching data as soon as possible, reducing latency. + + diff --git a/packages/docs/src/routes/docs/(qwikcity)/re-exporting-loaders/index.mdx b/packages/docs/src/routes/docs/cookbook/re-exporting-loaders/index.mdx similarity index 100% rename from packages/docs/src/routes/docs/(qwikcity)/re-exporting-loaders/index.mdx rename to packages/docs/src/routes/docs/cookbook/re-exporting-loaders/index.mdx diff --git a/packages/docs/src/routes/docs/menu.md b/packages/docs/src/routes/docs/menu.md index 6bcb34502cb..5775860aa50 100644 --- a/packages/docs/src/routes/docs/menu.md +++ b/packages/docs/src/routes/docs/menu.md @@ -30,7 +30,6 @@ - [Endpoints]() - [Middleware]() - [server$]() -- [Re-exporting loaders](/docs/(qwikcity)/re-exporting-loaders/index.mdx) - [Caching]() - [HTML attributes]() - [API reference]() @@ -47,6 +46,7 @@ - [NavLink](/docs/cookbook/nav-link/index.mdx) - [Node Docker deploy](/docs/cookbook/node-docker-deploy/index.mdx) - [Portals](/docs/cookbook/portals/index.mdx) +- [Re-exporting loaders](/docs/cookbook/re-exporting-loaders/index.mdx) - [Streaming loaders](/docs/cookbook/streaming-deferred-loaders/index.mdx) - [Sync events w state](/docs/cookbook/sync-events/index.mdx) - [Theme Managment](/docs/cookbook/theme-management/index.mdx) From 91ce7c15fa8ec5c0e20153ff71446250b5ff560c Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:07 +0200 Subject: [PATCH 011/290] Revert "docs: move the env variable to guide/env-variable (#6793)" This reverts commit ddcc48958ccab7d69abcc08ea513ed43e6f918f8. --- .../routes/docs/(qwikcity)/{guides => }/env-variables/index.mdx | 0 packages/docs/src/routes/docs/menu.md | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename packages/docs/src/routes/docs/(qwikcity)/{guides => }/env-variables/index.mdx (100%) diff --git a/packages/docs/src/routes/docs/(qwikcity)/guides/env-variables/index.mdx b/packages/docs/src/routes/docs/(qwikcity)/env-variables/index.mdx similarity index 100% rename from packages/docs/src/routes/docs/(qwikcity)/guides/env-variables/index.mdx rename to packages/docs/src/routes/docs/(qwikcity)/env-variables/index.mdx diff --git a/packages/docs/src/routes/docs/menu.md b/packages/docs/src/routes/docs/menu.md index 5775860aa50..9db092fcb38 100644 --- a/packages/docs/src/routes/docs/menu.md +++ b/packages/docs/src/routes/docs/menu.md @@ -32,6 +32,7 @@ - [server$]() - [Caching]() - [HTML attributes]() +- [Env variables]() - [API reference]() ## Cookbook @@ -105,7 +106,6 @@ - [React Cheat Sheet]() - [Best Practices]() - [Bundle Optimization]() -- [Env variables]() ## Concepts From 7e2d26cad59b01c840467f396c7d1443b623a03f Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:07 +0200 Subject: [PATCH 012/290] Revert "fix(repl): version detection (#6791)" This reverts commit 1583bb561f36c3bb8d92c472caa46454dc2c15ad. --- packages/docs/src/repl/monaco.tsx | 5 +++-- packages/docs/src/repl/repl.tsx | 5 +++-- packages/docs/src/repl/worker/app-bundle-client.ts | 3 +-- packages/docs/src/repl/worker/repl-dependencies.ts | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/docs/src/repl/monaco.tsx b/packages/docs/src/repl/monaco.tsx index 762ab5d0490..e6698852a62 100644 --- a/packages/docs/src/repl/monaco.tsx +++ b/packages/docs/src/repl/monaco.tsx @@ -218,9 +218,10 @@ export const addQwikLibs = async (version: string) => { }; const loadDeps = async (qwikVersion: string) => { - const [M, m, p] = qwikVersion.split('-')[0].split('.').map(Number); + const isDev = qwikVersion.includes('dev'); + const v = qwikVersion.split('-')[0].split('.').map(Number); const prefix = - qwikVersion === 'bundled' || M > 1 || (M == 1 && (m > 7 || (m == 7 && p >= 2))) + qwikVersion === 'bundled' || (v[0] >= 1 && v[1] >= 7 && v[2] >= (isDev ? 1 : 2)) ? '/dist/' : '/'; const deps: NodeModuleDep[] = [ diff --git a/packages/docs/src/repl/repl.tsx b/packages/docs/src/repl/repl.tsx index b68ad72f894..ba14118b38c 100644 --- a/packages/docs/src/repl/repl.tsx +++ b/packages/docs/src/repl/repl.tsx @@ -168,8 +168,9 @@ export const receiveMessageFromReplServer = ( const getDependencies = (input: ReplAppInput) => { const out = { ...bundled }; if (input.version !== 'bundled') { - const [M, m, p] = input.version.split('-')[0].split('.').map(Number); - const prefix = M > 1 || (M == 1 && (m > 7 || (m == 7 && p >= 2))) ? '/dist/' : '/'; + const v = input.version.split('-')[0].split('.').map(Number); + const prefix = + v[0] > 1 || (v[0] == 1 && (v[1] > 7 || (v[1] == 7 && v[2] >= 2))) ? '/dist/' : '/'; out[QWIK_PKG_NAME] = { version: input.version, }; diff --git a/packages/docs/src/repl/worker/app-bundle-client.ts b/packages/docs/src/repl/worker/app-bundle-client.ts index 74ff58fb243..439c298d28b 100644 --- a/packages/docs/src/repl/worker/app-bundle-client.ts +++ b/packages/docs/src/repl/worker/app-bundle-client.ts @@ -18,8 +18,7 @@ export const appBundleClient = async ( debug: options.debug, srcInputs: getInputs(options), // Older versions don't support `segment` - entryStrategy: - options.entryStrategy.type === 'segment' ? { type: 'hook' } : options.entryStrategy, + entryStrategy: options.entryStrategy === 'segment' ? 'hook' : options.entryStrategy, manifestOutput: (m) => { result.manifest = m; }, diff --git a/packages/docs/src/repl/worker/repl-dependencies.ts b/packages/docs/src/repl/worker/repl-dependencies.ts index 63a00210de0..3c1ad1f2043 100644 --- a/packages/docs/src/repl/worker/repl-dependencies.ts +++ b/packages/docs/src/repl/worker/repl-dependencies.ts @@ -9,8 +9,8 @@ let cache: Cache; export const depResponse = async (pkgName: string, pkgPath: string) => { if (pkgName === QWIK_PKG_NAME && !pkgPath.startsWith('/bindings')) { const version = options.deps[pkgName].version; - const [M, m, p] = version.split('-')[0].split('.').map(Number); - if (M > 1 || (M == 1 && (m > 7 || (m == 7 && p >= 2)))) { + const v = version.split('-')[0].split('.').map(Number); + if (v[0] > 1 || (v[0] == 1 && (v[1] > 7 || (v[1] == 7 && v[2] >= 2)))) { pkgPath = `/dist${pkgPath}`; } } From 093ad5cfd3625a8d0893f92f4b60127f47be4c7e Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:07 +0200 Subject: [PATCH 013/290] Revert "fix(repl): version detection (#6790)" This reverts commit 22920f23e20311ae7de4f0e824762ceb9cd4bc23. --- package.json | 10 +++++----- packages/docs/src/repl/repl.tsx | 4 ++-- packages/docs/src/repl/worker/app-bundle-client.ts | 3 +-- packages/docs/src/repl/worker/repl-dependencies.ts | 3 ++- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 65272fe481f..bdbd8bf5691 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,9 @@ ] } }, + "simple-git-hooks": { + "pre-commit": "pnpm pretty-quick --staged" + }, "contributors": [ { "name": "Miško Hevery", @@ -225,13 +228,13 @@ "lint.prettier": "prettier --cache --check .", "lint.rust": "make lint", "lint.syncpack": "syncpack list-mismatches", - "preinstall": "npx only-allow pnpm", "prepare": "simple-git-hooks", + "preinstall": "npx only-allow pnpm", "prettier.fix": "prettier --cache --write .", "qwik-save-artifacts": "tsm ./scripts/qwik-save-artifacts.ts", "release": "changeset publish", - "release.pkg-pr-new": "pnpm dlx pkg-pr-new@^0.0.9 publish --compact --pnpm ./packages/qwik ./packages/qwik-city ./packages/eslint-plugin-qwik ./packages/create-qwik", "release.prepare": "pnpm build --prepare-release", + "release.pkg-pr-new": "pnpm dlx pkg-pr-new@^0.0.9 publish --compact --pnpm ./packages/qwik ./packages/qwik-city ./packages/eslint-plugin-qwik ./packages/create-qwik", "serve": "tsm --inspect --conditions=development starters/dev-server.ts 3300", "serve.debug": "tsm --inspect-brk --conditions=development starters/dev-server.ts 3300", "start": "concurrently \"npm:build.watch\" \"npm:tsc.watch\" -n build,tsc -c green,cyan", @@ -253,8 +256,5 @@ "update.qwik.builds": "tsm scripts/update-qwik-builds.ts packages/docs && tsm scripts/update-qwik-builds.ts packages/insights; pnpm install", "vitest": "vitest" }, - "simple-git-hooks": { - "pre-commit": "pnpm pretty-quick --staged" - }, "type": "module" } diff --git a/packages/docs/src/repl/repl.tsx b/packages/docs/src/repl/repl.tsx index ba14118b38c..d54792b1a80 100644 --- a/packages/docs/src/repl/repl.tsx +++ b/packages/docs/src/repl/repl.tsx @@ -168,9 +168,9 @@ export const receiveMessageFromReplServer = ( const getDependencies = (input: ReplAppInput) => { const out = { ...bundled }; if (input.version !== 'bundled') { + const isDev = input.version.includes('dev'); const v = input.version.split('-')[0].split('.').map(Number); - const prefix = - v[0] > 1 || (v[0] == 1 && (v[1] > 7 || (v[1] == 7 && v[2] >= 2))) ? '/dist/' : '/'; + const prefix = v[0] >= 1 && v[1] >= 7 && v[2] >= (isDev ? 1 : 2) ? '/dist/' : '/'; out[QWIK_PKG_NAME] = { version: input.version, }; diff --git a/packages/docs/src/repl/worker/app-bundle-client.ts b/packages/docs/src/repl/worker/app-bundle-client.ts index 439c298d28b..dd3c79ff65a 100644 --- a/packages/docs/src/repl/worker/app-bundle-client.ts +++ b/packages/docs/src/repl/worker/app-bundle-client.ts @@ -17,8 +17,7 @@ export const appBundleClient = async ( buildMode: options.buildMode, debug: options.debug, srcInputs: getInputs(options), - // Older versions don't support `segment` - entryStrategy: options.entryStrategy === 'segment' ? 'hook' : options.entryStrategy, + entryStrategy: options.entryStrategy, manifestOutput: (m) => { result.manifest = m; }, diff --git a/packages/docs/src/repl/worker/repl-dependencies.ts b/packages/docs/src/repl/worker/repl-dependencies.ts index 3c1ad1f2043..b394c427ae4 100644 --- a/packages/docs/src/repl/worker/repl-dependencies.ts +++ b/packages/docs/src/repl/worker/repl-dependencies.ts @@ -9,8 +9,9 @@ let cache: Cache; export const depResponse = async (pkgName: string, pkgPath: string) => { if (pkgName === QWIK_PKG_NAME && !pkgPath.startsWith('/bindings')) { const version = options.deps[pkgName].version; + const isDev = version.includes('dev'); const v = version.split('-')[0].split('.').map(Number); - if (v[0] > 1 || (v[0] == 1 && (v[1] > 7 || (v[1] == 7 && v[2] >= 2)))) { + if (v[0] >= 1 && v[1] >= 7 && v[2] >= (isDev ? 1 : 2)) { pkgPath = `/dist${pkgPath}`; } } From 5aa3fbe7d34ceb8654059e083c1b7b2bbd26c6eb Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:07 +0200 Subject: [PATCH 014/290] Revert "more descriptive" This reverts commit 6f498cb62b817cf36286f37a6f8b32b885fe88a9. --- .changeset/wicked-foxes-behave.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/wicked-foxes-behave.md b/.changeset/wicked-foxes-behave.md index 8ba9b3dd87c..a7b323801d5 100644 --- a/.changeset/wicked-foxes-behave.md +++ b/.changeset/wicked-foxes-behave.md @@ -2,4 +2,4 @@ 'create-qwik': patch --- -feat: added `preserveModules` to library starters to improve library bundling / tree-shaking +feat: improves library bundling / tree-shaking From 7881d3d054f5533b700a97c22410d9954e0593f2 Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:07 +0200 Subject: [PATCH 015/290] Revert "changeset" This reverts commit 81854e4c9609e49e9bc121aeee8d48ed21a7b729. --- .changeset/wicked-foxes-behave.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .changeset/wicked-foxes-behave.md diff --git a/.changeset/wicked-foxes-behave.md b/.changeset/wicked-foxes-behave.md deleted file mode 100644 index a7b323801d5..00000000000 --- a/.changeset/wicked-foxes-behave.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'create-qwik': patch ---- - -feat: improves library bundling / tree-shaking From 8a1e534b4114c2345137b198d30b67e4ece11553 Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:07 +0200 Subject: [PATCH 016/290] Revert "add preserve modules to lib starter" This reverts commit 4f4b094b559a45f31668a2c83d00acb319899800. --- starters/apps/library/vite.config.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/starters/apps/library/vite.config.ts b/starters/apps/library/vite.config.ts index 0debbc29183..dab77fb253d 100644 --- a/starters/apps/library/vite.config.ts +++ b/starters/apps/library/vite.config.ts @@ -14,14 +14,9 @@ export default defineConfig(() => { lib: { entry: "./src/index.ts", formats: ["es", "cjs"], - fileName: (format, entryName) => - `${entryName}.qwik.${format === "es" ? "mjs" : "cjs"}`, + fileName: (format) => `index.qwik.${format === "es" ? "mjs" : "cjs"}`, }, rollupOptions: { - output: { - preserveModules: true, - preserveModulesRoot: "src", - }, // externalize deps that shouldn't be bundled into the library external: [ /^node:.*/, From 7f1d54e618b9602b51a8441411881a0fda9a1413 Mon Sep 17 00:00:00 2001 From: maiieul Date: Mon, 26 Aug 2024 21:53:07 +0200 Subject: [PATCH 017/290] Revert "Revert "chore(docs): use prefetch service worker" (#6786)" This reverts commit b6171cc1170c74f7bb56d19945ce3db194f396a4. --- packages/docs/src/root.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/docs/src/root.tsx b/packages/docs/src/root.tsx index 4e1863e46e6..fcd67e8065b 100644 --- a/packages/docs/src/root.tsx +++ b/packages/docs/src/root.tsx @@ -1,5 +1,11 @@ -import { component$, useContextProvider, useStore } from '@builder.io/qwik'; -import { QwikCityProvider, RouterOutlet, ServiceWorkerRegister } from '@builder.io/qwik-city'; +import { + PrefetchGraph, + PrefetchServiceWorker, + component$, + useContextProvider, + useStore, +} from '@builder.io/qwik'; +import { QwikCityProvider, RouterOutlet } from '@builder.io/qwik-city'; import RealMetricsOptimization from './components/real-metrics-optimization/real-metrics-optimization'; import { RouterHead } from './components/router-head/router-head'; import { GlobalStore, type SiteStore } from './context'; @@ -54,7 +60,8 @@ export default component$(() => { \n```\nBy default, the `prefetchEvent` implementation will be set to `always`.\n\n\n\n\n\n[workerFetchInsert?](#)\n\n\n\n\n\n\n\n'always' \\| 'no-link-support' \\| null\n\n\n\n\n_(Optional)_ `always`: Always include the worker fetch JS runtime.\n\n`no-link-support`: Only include the worker fetch JS runtime when the browser doesn't support `` prefetch/preload/modulepreload.\n\n\n\n", + "content": "```typescript\nexport interface PrefetchImplementation \n```\n\n\n\n\n\n\n\n\n
\n\nProperty\n\n\n\n\nModifiers\n\n\n\n\nType\n\n\n\n\nDescription\n\n\n
\n\n[linkFetchPriority?](#)\n\n\n\n\n\n\n\n'auto' \\| 'low' \\| 'high' \\| null\n\n\n\n\n_(Optional)_ Value of the `` attribute when link is used. Defaults to `null` if links are inserted.\n\n\n
\n\n[linkInsert?](#)\n\n\n\n\n\n\n\n'js-append' \\| 'html-append' \\| null\n\n\n\n\n_(Optional)_ `js-append`: Use JS runtime to create each `` and append to the body.\n\n`html-append`: Render each `` within html, appended at the end of the body.\n\n\n
\n\n[linkRel?](#)\n\n\n\n\n\n\n\n'prefetch' \\| 'preload' \\| 'modulepreload' \\| null\n\n\n\n\n_(Optional)_ Value of the `` attribute when link is used. Defaults to `prefetch` if links are inserted.\n\n\n
\n\n[prefetchEvent?](#)\n\n\n\n\n\n\n\n'always' \\| null\n\n\n\n\n_(Optional)_ Dispatch a `qprefetch` event with detail data containing the bundles that should be prefetched. The event dispatch script will be inlined into the document's HTML so any listeners of this event should already be ready to handle the event.\n\nThis implementation will inject a script similar to:\n\n```\n\n```\nBy default, the `prefetchEvent` implementation will be set to `always`.\n\n\n
\n\n[workerFetchInsert?](#)\n\n\n\n\n\n\n\n'always' \\| 'no-link-support' \\| null\n\n\n\n\n_(Optional)_ `always`: Always include the worker fetch JS runtime.\n\n`no-link-support`: Only include the worker fetch JS runtime when the browser doesn't support `` prefetch/preload/modulepreload.\n\n\n
", "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/server/types.ts", "mdFile": "qwik.prefetchimplementation.md" }, diff --git a/packages/docs/src/routes/api/qwik-server/index.md b/packages/docs/src/routes/api/qwik-server/index.md index a20bdbca343..819658c38ec 100644 --- a/packages/docs/src/routes/api/qwik-server/index.md +++ b/packages/docs/src/routes/api/qwik-server/index.md @@ -233,6 +233,21 @@ Description +[linkFetchPriority?](#) + + + + + +'auto' \| 'low' \| 'high' \| null + + + +_(Optional)_ Value of the `` attribute when link is used. Defaults to `null` if links are inserted. + + + + [linkInsert?](#) diff --git a/packages/docs/src/routes/api/qwik/api.json b/packages/docs/src/routes/api/qwik/api.json index 1c5bd0edf86..dcd73ac2522 100644 --- a/packages/docs/src/routes/api/qwik/api.json +++ b/packages/docs/src/routes/api/qwik/api.json @@ -1760,7 +1760,7 @@ } ], "kind": "Function", - "content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nLoad the prefetch graph for the container.\n\nEach Qwik container needs to include its own prefetch graph.\n\n\n```typescript\nPrefetchGraph: (opts?: {\n base?: string;\n manifestHash?: string;\n manifestURL?: string;\n nonce?: string;\n}) => JSXNode<\"script\">\n```\n\n\n\n\n
\n\nParameter\n\n\n\n\nType\n\n\n\n\nDescription\n\n\n
\n\nopts\n\n\n\n\n{ base?: string; manifestHash?: string; manifestURL?: string; nonce?: string; }\n\n\n\n\n_(Optional)_ Options for the loading prefetch graph.\n\n- `base` - Base of the graph. For a default installation this will default to the q:base value `/build/`. But if more than one MFE is installed on the page, then each MFE needs to have its own base. - `manifestHash` - Hash of the manifest file to load. If not provided the hash will be extracted from the container attribute `q:manifest-hash` and assume the default build file `${base}/q-bundle-graph-${manifestHash}.json`. - `manifestURL` - URL of the manifest file to load if non-standard bundle graph location name.\n\n\n
\n**Returns:**\n\n[JSXNode](#jsxnode)<\"script\">", + "content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nLoad the prefetch graph for the container.\n\nEach Qwik container needs to include its own prefetch graph.\n\n\n```typescript\nPrefetchGraph: (opts?: {\n base?: string;\n manifestHash?: string;\n manifestURL?: string;\n nonce?: string;\n}) => JSXNode<\"script\">\n```\n\n\n\n\n
\n\nParameter\n\n\n\n\nType\n\n\n\n\nDescription\n\n\n
\n\nopts\n\n\n\n\n{ base?: string; manifestHash?: string; manifestURL?: string; nonce?: string; }\n\n\n\n\n_(Optional)_ Options for the loading prefetch graph.\n\n- `base` - Base of the graph. For a default installation this will default to the q:base value `/build/`. But if more than one MFE is installed on the page, then each MFE needs to have its own base. - `manifestHash` - Hash of the manifest file to load. If not provided the hash will be extracted from the container attribute `q:manifest-hash` and assume the default build file `${base}/q-bundle-graph-${manifestHash}.json`. - `manifestURL` - URL of the manifest file to load if non-standard bundle graph location name.\n\n\n
\n**Returns:**\n\nJSXNode<\"script\">", "editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/components/prefetch.ts", "mdFile": "qwik.prefetchgraph.md" }, diff --git a/packages/docs/src/routes/docs/(qwik)/advanced/modules-prefetching/index.mdx b/packages/docs/src/routes/docs/(qwik)/advanced/modules-prefetching/index.mdx index 41fa22c0153..18b263987dd 100644 --- a/packages/docs/src/routes/docs/(qwik)/advanced/modules-prefetching/index.mdx +++ b/packages/docs/src/routes/docs/(qwik)/advanced/modules-prefetching/index.mdx @@ -78,6 +78,7 @@ export default function (opts: RenderToStreamOptions) { | `prefetchEvent` | Dispatch a `qprefetch` event with `detail` data containing the urls that should be prefetched. The event dispatch script will be inlined into the document's HTML. By default, the `prefetchEvent` implementation will be set to `always`. | | `linkInsert` | Insert the `` element into the document. When using `html-append`, it will render each `` directly within the html, appended at the end of the body. Using the `js-append` option, it will instead insert some JavaScript, which creates the elements at runtime and appends them at the end of the body. | | `linkRel` | This option is used to define the [`rel` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types) of the `` element. When the `linkInsert` option is used, the default is `prefetch`. Other options include `preload` and `modulepreload`. | +| `linkFetchPriority` | This option is used to define the [`fetchpriority` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#fetchpriority) of the `` element. When the `linkInsert` option is used, the default is `null`. Other options include `low`, `high` and `auto`. | | `workerFetchInsert` | Prefetch urls by calling a `fetch()` for each module, with the goal of populating the network cache. | #### Dispatched Prefetch Event diff --git a/packages/qwik/src/optimizer/src/qwik-binding-map.ts b/packages/qwik/src/optimizer/src/qwik-binding-map.ts index cceeb273668..b1233616d76 100644 --- a/packages/qwik/src/optimizer/src/qwik-binding-map.ts +++ b/packages/qwik/src/optimizer/src/qwik-binding-map.ts @@ -30,15 +30,5 @@ export const QWIK_BINDING_MAP = { "platformArchABI": "qwik.win32-x64-msvc.node" } ] - }, - "linux": { - "x64": [ - { - "platform": "linux", - "arch": "x64", - "abi": "gnu", - "platformArchABI": "qwik.linux-x64-gnu.node" - } - ] } }; diff --git a/packages/qwik/src/server/api.md b/packages/qwik/src/server/api.md index 3de7e517668..4e0a9fbb0a3 100644 --- a/packages/qwik/src/server/api.md +++ b/packages/qwik/src/server/api.md @@ -43,6 +43,7 @@ export type InOrderStreaming = InOrderAuto | InOrderDisabled | InOrderDirect; // @public (undocumented) export interface PrefetchImplementation { + linkFetchPriority?: 'auto' | 'low' | 'high' | null; linkInsert?: 'js-append' | 'html-append' | null; linkRel?: 'prefetch' | 'preload' | 'modulepreload' | null; prefetchEvent?: 'always' | null; diff --git a/packages/qwik/src/server/prefetch-implementation.ts b/packages/qwik/src/server/prefetch-implementation.ts index 1a159f1cdab..ac401c10405 100644 --- a/packages/qwik/src/server/prefetch-implementation.ts +++ b/packages/qwik/src/server/prefetch-implementation.ts @@ -75,11 +75,15 @@ function linkHtmlImplementation( ) { const urls = flattenPrefetchResources(prefetchResources); const rel = prefetchImpl.linkRel || 'prefetch'; + const priority = prefetchImpl.linkFetchPriority; for (const url of urls) { const attributes: Record = {}; attributes['href'] = url; attributes['rel'] = rel; + if (priority) { + attributes['fetchpriority'] = priority; + } if (rel === 'prefetch' || rel === 'preload') { if (url.endsWith('.js')) { attributes['as'] = 'script'; @@ -101,6 +105,7 @@ function linkJsImplementation( nonce?: string ) { const rel = prefetchImpl.linkRel || 'prefetch'; + const priority = prefetchImpl.linkFetchPriority; let s = ``; if (prefetchImpl.workerFetchInsert === 'no-link-support') { @@ -113,6 +118,9 @@ function linkJsImplementation( s += `const l=document.createElement('link');`; s += `l.setAttribute("href",u);`; s += `l.setAttribute("rel","${rel}");`; + if (priority) { + s += `l.setAttribute("fetchpriority","${priority}");`; + } if (prefetchImpl.workerFetchInsert === 'no-link-support') { s += `if(i===0){`; @@ -173,6 +181,7 @@ function normalizePrefetchImplementation( const PrefetchImplementationDefault: Required = { linkInsert: null, linkRel: null, + linkFetchPriority: null, workerFetchInsert: null, prefetchEvent: 'always', }; diff --git a/packages/qwik/src/server/types.ts b/packages/qwik/src/server/types.ts index cd8acfd5561..c9158054cb6 100644 --- a/packages/qwik/src/server/types.ts +++ b/packages/qwik/src/server/types.ts @@ -32,6 +32,11 @@ export interface PrefetchImplementation { * are inserted. */ linkRel?: 'prefetch' | 'preload' | 'modulepreload' | null; + /** + * Value of the `` attribute when link is used. Defaults to `null` if + * links are inserted. + */ + linkFetchPriority?: 'auto' | 'low' | 'high' | null; /** * `always`: Always include the worker fetch JS runtime. *