Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
wuls committed Oct 31, 2024
2 parents b491a0d + f66c5e1 commit 399c2ab
Show file tree
Hide file tree
Showing 110 changed files with 810 additions and 619 deletions.
9 changes: 3 additions & 6 deletions .changeset/changelog-github-custom.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,9 @@ var changelogFunctions = {
.concat(links.pull || links.commit, ')');
}
emojiFirstline = firstLine
.replace('FEAT:', '✨ ')
.replace('feat:', '✨ ')
.replace('fix:', '🐞🩹')
.replace('FIX:', '🐞🩹')
.replace('DOCS:', '📃')
.replace('docs:', '📃');
.replace(/feat:/i, '✨ ')
.replace(/fix:/i, '🐞🩹')
.replace(/docs:/i, '📃');
return [
2 /*return*/,
'\n\n- '
Expand Down
9 changes: 3 additions & 6 deletions .changeset/changelog-github-custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,9 @@ const changelogFunctions: ChangelogFunctions = {
}

const emojiFirstline = firstLine
.replace('FEAT:', '✨ ')
.replace('feat:', '✨ ')
.replace('fix:', '🐞🩹')
.replace('FIX:', '🐞🩹')
.replace('DOCS:', '📃')
.replace('docs:', '📃');
.replace(/feat:/i, '✨ ')
.replace(/fix:/i, '🐞🩹')
.replace(/docs:/i, '📃');

return `\n\n- ${emojiFirstline} ${suffix}\n${futureLines.map((l) => ` ${l}`).join('\n')}`;
},
Expand Down
36 changes: 36 additions & 0 deletions .changeset/eleven-rabbits-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
'@builder.io/qwik': minor
---

Async functions in `useComputed` are deprecated.

**Why?**

- Qwik can't track used signals after the first await, which leads to subtle bugs.
- When calculating the first time, it will see it's a promise and it will restart the render function.
- Both `useTask` and `useResource` are available, without these problems.

In v2, async functions won't work.

Again, to get the same functionality use `useTask` or `useResource` instead, or this function:

```tsx
export const useAsyncComputed$ = (qrlFn: QRL<() => Promise<any>>) => {
const sig = useSignal();
useTask(({ track }) => {
const result = track(qrlFn);
if (result && 'then' in result) {
result.then(
(val) => (sig.value = val),
(err) => {
console.error('async computed function threw!', err);
throw error;
}
);
} else {
sig.value = result;
}
});
return sig;
};
```
5 changes: 5 additions & 0 deletions .changeset/funny-wasps-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@builder.io/qwik': patch
---

FIX: QRL segment filenames are no longer lowercased. This was giving trouble with parent lookups in dev mode and there was no good reason for it.
5 changes: 5 additions & 0 deletions .changeset/gentle-adults-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@builder.io/qwik': patch
---

FIX: the type for `<textarea>` now accepts text children, as per spec.
2 changes: 1 addition & 1 deletion .changeset/lazy-worms-attack.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@builder.io/qwik-city': patch
---

MDX content no longer ignores Layout components. See [the MDX docs](https://mdxjs.com/docs/using-mdx/#layout) for more information.
FIX: MDX content no longer ignores Layout components. See [the MDX docs](https://mdxjs.com/docs/using-mdx/#layout) for more information.
5 changes: 5 additions & 0 deletions .changeset/lemon-gorillas-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@builder.io/qwik-city': patch
---

FIX: SSG errors now show the path that failed
2 changes: 1 addition & 1 deletion .changeset/many-turtles-cough.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@builder.io/qwik-city': patch
---

Fix action redirect regression where searchParams were appended
FIX: Fixed action redirect regression where searchParams were appended
2 changes: 1 addition & 1 deletion .changeset/ninety-planets-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
'@builder.io/qwik': patch
---

FIX: `vite` is now a peer dependency of `qwik` and `qwik-city`, so that there can be no duplicate imports. This should not have consequences, since all apps also directly depend on `vite`.
FIX: `vite` is now a peer dependency of `qwik`, `qwik-city`, `qwik-react` and `qwik-labs`, so that there can be no duplicate imports. This should not have consequences, since all apps also directly depend on `vite`.
2 changes: 1 addition & 1 deletion .changeset/real-garlics-argue.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@builder.io/qwik-city': patch
---

Fixed MDX layout default export being ignored by transformer.
FIX: Fixed MDX layout default export being ignored by transformer.
2 changes: 1 addition & 1 deletion .changeset/shaggy-apes-kneel.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@builder.io/qwik': patch
---

sync$ QRLs will now be serialized into the HTML in a shorter form
FEAT: sync$ QRLs will now be serialized into the HTML in a shorter form
7 changes: 7 additions & 0 deletions .changeset/short-cycles-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@builder.io/qwik': minor
---

FEAT: Expose `unwrapStore` as a low level AP

This enables developers to clone the content of a `useStore()` using `structureClone` or IndexedDB
2 changes: 1 addition & 1 deletion .changeset/silver-countries-kiss.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@builder.io/qwik-city': patch
---

Prevent unexpected caching for q-data.json
FIX: Prevent unexpected caching for q-data.json
2 changes: 1 addition & 1 deletion .changeset/unlucky-experts-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@builder.io/qwik': patch
---

Allow setting `linkFetchPriority` for modulepreload links in the prefetch strategy. Also fix the links in dev mode
FEAT: Allow setting `linkFetchPriority` for modulepreload links in the prefetch strategy. Also fix the links in dev mode
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -880,11 +880,14 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Fixup package.json files
run: pnpm run release.fixup-package-json

- name: Commit Build Artifacts
if: github.event_name == 'push'
env:
QWIK_API_TOKEN_GITHUB: ${{ secrets.QWIK_API_TOKEN_GITHUB }}
run: pnpm run qwik-save-artifacts
run: pnpm run qwik-push-build-repos

- name: Publish packages for testing
if: github.event_name != 'workflow_dispatch'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ bun create qwik@latest

- Ping us at [@QwikDev](https://twitter.com/QwikDev)
- Join our [Discord](https://qwik.dev/chat) community
- Join all the [other community groups](https://qwikcommunity.com)
- Join all the [other community groups](https://qwik.dev/ecosystem/#community)

## Development

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
{
"label": "Be lenient in vite versions for prod. v4 is broken, v5 is good",
"dependencyTypes": [
"prod"
"prod",
"peer"
],
"dependencies": [
"vite"
Expand Down Expand Up @@ -230,8 +231,9 @@
"preinstall": "npx only-allow pnpm",
"prepare": "simple-git-hooks",
"prettier.fix": "prettier --cache --write .",
"qwik-save-artifacts": "tsx --require ./scripts/runBefore.ts ./scripts/qwik-save-artifacts.ts",
"qwik-push-build-repos": "tsx --require ./scripts/runBefore.ts ./scripts/qwik-push-build-repos.ts",
"release": "changeset publish",
"release.fixup-package-json": "syncpack fix-mismatches --config syncpack-release-conf.json",
"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",
"serve": "tsx --require ./scripts/runBefore.ts --inspect --conditions=development starters/dev-server.ts 3300",
Expand Down
14 changes: 14 additions & 0 deletions packages/docs/src/routes/api/qwik/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -3010,6 +3010,20 @@
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-core.ts",
"mdFile": "qwik.untrack.md"
},
{
"name": "unwrapStore",
"id": "unwrapstore",
"hierarchy": [
{
"name": "unwrapStore",
"id": "unwrapstore"
}
],
"kind": "Function",
"content": "Get the target value of the Proxy. Useful if you want to clone a store (structureClone, IndexedDB,...)\n\n\n```typescript\nunwrapProxy: <T>(proxy: T) => T\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nproxy\n\n\n</td><td>\n\nT\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nT",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/state/common.ts",
"mdFile": "qwik.unwrapstore.md"
},
{
"name": "useComputed$",
"id": "usecomputed_",
Expand Down
39 changes: 39 additions & 0 deletions packages/docs/src/routes/api/qwik/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10119,6 +10119,45 @@ T
[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-core.ts)
## unwrapStore
Get the target value of the Proxy. Useful if you want to clone a store (structureClone, IndexedDB,...)
```typescript
unwrapProxy: <T>(proxy: T) => T;
```
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
proxy
</td><td>
T
</td><td>
</td></tr>
</tbody></table>
**Returns:**
T
[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/state/common.ts)
## useComputed$
Hook that returns a read-only signal that updates when signals used in the `ComputedFn` change.
Expand Down
14 changes: 14 additions & 0 deletions packages/docs/src/routes/docs/(qwikcity)/routing/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,20 @@ For the route `https://example.com/admin`, the `onRequest` methods will be execu

An `onRequest` handler in `src/routes/index.tsx` doesn't get executed.

### Full Execution order

```bash
1 --> [entry.express.ts or entry.preview.ts]
2 --> [plugin@some-name.ts] #Alphabetical order
3 --> [server$]
4 --> [entry.ssr.ts]
5 --> [root.tsx]
6 --> [layout.tsx onRequest -> onGet/onHttpVerb]
7 --> [globalLoaders]
8 --> [routeLoaders]
9 --> [jsx/components on a route]
```

### Nested Layouts

Layouts also **provide a way to add common UI to the rendered page**. For example, if you want to add a common header to all of the routes, add a Header component to the root layout.
Expand Down
26 changes: 18 additions & 8 deletions packages/docs/src/routes/docs/cookbook/debouncer/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ The Qwik framework provides unique capabilities for managing state and effects i

<CodeFile src="/src/routes/demo/cookbook/mediaController/index.tsx">
```tsx
export const useDebouncer = (fn: QRL<(args: any) => void>, delay: number) => {
export const useDebouncer = <A extends readonly unknown[], R>(
fn: QRL<(...args: A) => R>,
delay: number,
): QRL<(...args: A) => void> => {
const timeoutId = useSignal<number>();

return $((args: any) => {
clearTimeout(timeoutId.value);
timeoutId.value = Number(setTimeout(() => fn(args), delay));
return $((...args: A): void => {
window.clearTimeout(timeoutId.value);
timeoutId.value = window.setTimeout((): void => {
void fn(...args);
}, delay);
});
};
```
Expand Down Expand Up @@ -93,12 +98,17 @@ We can leverage Qwik's `implicit$FirstArg` function to create a `useDebouncer$`
This is how Qwik actually implements all of its built-in $ hooks.

```tsx
export const useDebouncerQrl = (fn: QRL<(args: any) => void>, delay: number) => {
export const useDebouncerQrl = <A extends readonly unknown[], R>(
fn: QRL<(...args: A) => R>,
delay: number,
): QRL<(...args: A) => void> => {
const timeoutId = useSignal<number>();

return $((args: any) => {
clearTimeout(timeoutId.value);
timeoutId.value = Number(setTimeout(() => fn(args), delay));
return $((...args: A): void => {
window.clearTimeout(timeoutId.value);
timeoutId.value = window.setTimeout((): void => {
void fn(...args);
}, delay);
});
};

Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/src/static/main-thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export async function mainThread(sys: System) {
if (result.error) {
const err = new Error(result.error.message);
err.stack = result.error.stack;
log.error(`\n${bold(red('Error during SSG'))}`);
log.error(`\n${bold(red(`!!! ${result.pathname}: Error during SSG`))}`);
log.error(red(err.message));
log.error(` Pathname: ${magenta(staticRoute.pathname)}`);
Object.assign(formatError(err), {
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/src/static/node/node-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export async function createNodeMainProcess(sys: System, opts: StaticGenerateOpt
});

nodeWorker.on('error', (e) => {
console.error(`worker error: ${e}`);
console.error(`worker error`, e);
});

nodeWorker.on('exit', (code) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/src/static/node/node-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const access = async (path: string) => {
try {
await fs.promises.access(path);
return true;
} catch (e) {
} catch {
return false;
}
};
3 changes: 2 additions & 1 deletion packages/qwik-labs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
],
"main": "./lib/index.qwik.mjs",
"peerDependencies": {
"zod": "3.22.4"
"zod": "3.22.4",
"vite": "^5"
},
"private": true,
"qwik": "./lib/index.qwik.mjs",
Expand Down
3 changes: 2 additions & 1 deletion packages/qwik-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"@types/react": "^18",
"@types/react-dom": "^18",
"react": "^18",
"react-dom": "^18"
"react-dom": "^18",
"vite": "^5"
},
"qwik": "./lib/index.qwik.mjs",
"repository": {
Expand Down
10 changes: 3 additions & 7 deletions packages/qwik/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.9.1",
"annotation": "This package.json is for internal use in the monorepo, the build actually makes a new package.json for the published package via scripts/package-json.ts",
"bin": {
"qwik": "./dist/qwik-cli.cjs"
"qwik": "./qwik-cli.cjs"
},
"bugs": "https://github.com/QwikDev/qwik/issues",
"contributors": [
Expand Down Expand Up @@ -137,7 +137,8 @@
"loader.d.ts",
"optimizer.d.ts",
"server.d.ts",
"testing.d.ts"
"testing.d.ts",
"qwik-cli.cjs"
],
"homepage": "https://qwik.dev/",
"keywords": [
Expand All @@ -158,11 +159,6 @@
"peerDependencies": {
"vite": "^5"
},
"peerDependenciesMeta": {
"vite": {
"optional": true
}
},
"repository": {
"type": "git",
"url": "https://github.com/QwikDev/qwik.git",
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik/src/build/index.dev.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { isBrowser, isServer } from './index';
export { isBrowser, isServer } from '.';

/**
* True when build is in dev mode.
Expand Down
Loading

0 comments on commit 399c2ab

Please sign in to comment.