Skip to content

Commit

Permalink
Merge pull request #7045 from QwikDev/v2-jsxnode
Browse files Browse the repository at this point in the history
chore: make v2 types v1 compatible
  • Loading branch information
wmertens authored Nov 14, 2024
2 parents fec2039 + 84cdc36 commit ddd293b
Show file tree
Hide file tree
Showing 45 changed files with 3,026 additions and 10,880 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-baboons-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@qwik.dev/core': major
---

BREAKING: remove HTML-related types. Use PropsOf instead.
5 changes: 5 additions & 0 deletions .changeset/rich-wasps-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@qwik.dev/core': major
---

BREAKING: the Typescript exports were trimmed down to the bare minimum. If there are types you are missing, open an issue.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@
"build.cli.prod": "tsx --require ./scripts/runBefore.ts scripts/index.ts --cli",
"build.core": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --qwikrouter --api --platform-binding",
"build.eslint": "tsx --require ./scripts/runBefore.ts scripts/index.ts --eslint",
"build.full": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --build --supabaseauthhelpers --api --eslint --qwikrouter --qwikworker --qwikreact --cli --platform-binding --wasm",
"build.local": "tsx --require ./scripts/runBefore.tsscripts/index.ts --tsc --tsc-docs --build --supabaseauthhelpers --api --eslint --qwikrouter --qwikworker --qwikreact --cli --platform-binding-wasm-copy",
"build.full": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --qwik --supabaseauthhelpers --api --eslint --qwikrouter --qwikworker --qwikreact --cli --platform-binding --wasm",
"build.local": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --qwik --supabaseauthhelpers --api --eslint --qwikrouter --qwikworker --qwikreact --cli --platform-binding-wasm-copy",
"build.only_javascript": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --api",
"build.packages.docs": "pnpm -C ./packages/docs/ run build",
"build.packages.insights": "pnpm -C ./packages/insights/ run build",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/check-qwik-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const qwikPkgDir = path.join(__dirname, '..', 'qwik', 'dist');

if (!fs.existsSync(path.join(qwikPkgDir, 'core.d.ts'))) {
if (!fs.existsSync(path.join(qwikPkgDir, 'core-internal.d.ts'))) {
console.warn(
`\n\n=== Running 'pnpm run build.local' to generate missing imports for the docs ===\n`
);
Expand Down
6 changes: 4 additions & 2 deletions packages/docs/src/repl/bundled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import qWasmCjs from '../../node_modules/@qwik.dev/core/bindings/qwik.wasm.cjs?r
import qWasmBinUrl from '../../node_modules/@qwik.dev/core/bindings/qwik_wasm_bg.wasm?raw-source';
import qBuild from '../../node_modules/@qwik.dev/core/dist/build/index.d.ts?raw-source';
import qCoreCjs from '../../node_modules/@qwik.dev/core/dist/core.cjs?raw-source';
import qCoreDts from '../../node_modules/@qwik.dev/core/dist/core.d.ts?raw-source';
import qPublicDts from '../../node_modules/@qwik.dev/core/public.d.ts?raw-source';
import qCoreInternalDts from '../../node_modules/@qwik.dev/core/dist/core-internal.d.ts?raw-source';
import qCoreMinMjs from '../../node_modules/@qwik.dev/core/dist/core.min.mjs?raw-source';
import qCoreMjs from '../../node_modules/@qwik.dev/core/dist/core.mjs?raw-source';
import qOptimizerCjs from '../../node_modules/@qwik.dev/core/dist/optimizer.cjs?raw-source';
Expand Down Expand Up @@ -55,7 +56,8 @@ export const bundled: PkgUrls = {
version: qwikVersion,
'/dist/build/index.d.ts': qBuild,
'/dist/core.cjs': qCoreCjs,
'/dist/core.d.ts': qCoreDts,
'/public.d.ts': qPublicDts,
'/dist/core-internal.d.ts': qCoreInternalDts,
'/dist/core.min.mjs': qCoreMinMjs,
'/dist/core.mjs': qCoreMjs,
'/dist/optimizer.cjs': qOptimizerCjs,
Expand Down
12 changes: 9 additions & 3 deletions packages/docs/src/repl/monaco.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,17 @@ const loadDeps = async (qwikVersion: string) => {
: '/';
const deps: NodeModuleDep[] = [
// qwik
!isV1 && {
pkgName: QWIK_PKG_NAME,
pkgVersion: qwikVersion,
pkgPath: `/public.d.ts`,
import: '',
},
{
pkgName: isV1 ? QWIK_PKG_NAME_V1 : QWIK_PKG_NAME,
pkgVersion: qwikVersion,
pkgPath: `${prefix}core.d.ts`,
import: '',
pkgPath: `${prefix}core-internal.d.ts`,
import: isV1 ? '' : '/internal',
},
// server API
{
Expand All @@ -250,7 +256,7 @@ const loadDeps = async (qwikVersion: string) => {
pkgPath: `${prefix}build/index.d.ts`,
import: '/build',
},
];
].filter(Boolean) as NodeModuleDep[];

const cache = await caches.open(QWIK_REPL_DEPS_CACHE);

Expand Down
10 changes: 7 additions & 3 deletions packages/docs/src/repl/worker/repl-messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import { appUpdate } from './app-update';

export const receiveMessageFromMain = (ev: MessageEvent) => {
if (ev.data) {
const msg: ReplMessage = JSON.parse(ev.data);
if (msg.type === 'update') {
appUpdate(ev.source as any as WindowClient, msg.clientId, msg.options);
try {
const msg: ReplMessage = JSON.parse(ev.data);
if (msg.type === 'update') {
appUpdate(ev.source as any as WindowClient, msg.clientId, msg.options);
}
} catch {
// ignore, probably some extension sending non-JSON data
}
}
};
Expand Down
10 changes: 7 additions & 3 deletions packages/docs/src/repl/worker/repl-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ export const initReplServer = (win: Window, doc: Document, nav: Navigator) => {
return;
}
if (ev.data) {
const msg: ReplMessage = JSON.parse(ev.data);
if (msg?.type === 'event') {
sendMessageToMain(msg);
try {
const msg: ReplMessage = JSON.parse(ev.data);
if (msg?.type === 'event') {
sendMessageToMain(msg);
}
} catch {
// ignore, probably some extension sending non-JSON data
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/routes/api/qwik-testing/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
}
],
"kind": "Function",
"content": "```typescript\nexport declare function domRender(jsx: JSXOutput, opts?: {\n debug?: boolean;\n}): Promise<{\n document: Document;\n container: import(\"@qwik.dev/core\").ClientContainer;\n vNode: _VNode | null;\n getStyles: () => Record<string, string | string[]>;\n}>;\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\njsx\n\n\n</td><td>\n\nJSXOutput\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\nopts\n\n\n</td><td>\n\n{ debug?: boolean; }\n\n\n</td><td>\n\n_(Optional)_\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nPromise&lt;{ document: Document; container: import(\"@qwik.dev/core\").ClientContainer; vNode: \\_VNode \\| null; getStyles: () =&gt; Record&lt;string, string \\| string\\[\\]&gt;; }&gt;",
"content": "```typescript\nexport declare function domRender(jsx: JSXOutput, opts?: {\n debug?: boolean;\n}): Promise<{\n document: Document;\n container: import(\"@qwik.dev/core/internal\").ClientContainer;\n vNode: _VNode | null;\n getStyles: () => Record<string, string | string[]>;\n}>;\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\njsx\n\n\n</td><td>\n\nJSXOutput\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\nopts\n\n\n</td><td>\n\n{ debug?: boolean; }\n\n\n</td><td>\n\n_(Optional)_\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nPromise&lt;{ document: Document; container: import(\"@qwik.dev/core/internal\").ClientContainer; vNode: \\_VNode \\| null; getStyles: () =&gt; Record&lt;string, string \\| string\\[\\]&gt;; }&gt;",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/rendering.unit-util.tsx",
"mdFile": "core.domrender.md"
},
Expand Down Expand Up @@ -237,7 +237,7 @@
}
],
"kind": "Function",
"content": "```typescript\nexport declare function walkJSX(jsx: JSXOutput, apply: {\n enter: (jsx: JSXNode) => void;\n leave: (jsx: JSXNode) => void;\n text: (text: _Stringifiable) => void;\n}): void;\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\njsx\n\n\n</td><td>\n\nJSXOutput\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\napply\n\n\n</td><td>\n\n{ enter: (jsx: JSXNode) =&gt; void; leave: (jsx: JSXNode) =&gt; void; text: (text: \\_Stringifiable) =&gt; void; }\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nvoid",
"content": "```typescript\nexport declare function walkJSX(jsx: JSXOutput, apply: {\n enter: (jsx: JSXNodeInternal) => void;\n leave: (jsx: JSXNodeInternal) => void;\n text: (text: _Stringifiable) => void;\n}): void;\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\njsx\n\n\n</td><td>\n\nJSXOutput\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\napply\n\n\n</td><td>\n\n{ enter: (jsx: JSXNodeInternal) =&gt; void; leave: (jsx: JSXNodeInternal) =&gt; void; text: (text: \\_Stringifiable) =&gt; void; }\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nvoid",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/vdom-diff.unit-util.ts",
"mdFile": "core.walkjsx.md"
},
Expand Down
10 changes: 5 additions & 5 deletions packages/docs/src/routes/api/qwik-testing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export declare function domRender(
},
): Promise<{
document: Document;
container: import("@qwik.dev/core").ClientContainer;
container: import("@qwik.dev/core/internal").ClientContainer;
vNode: _VNode | null;
getStyles: () => Record<string, string | string[]>;
}>;
Expand Down Expand Up @@ -165,7 +165,7 @@ _(Optional)_
</tbody></table>
**Returns:**

Promise&lt;{ document: Document; container: import("@qwik.dev/core").ClientContainer; vNode: \_VNode \| null; getStyles: () =&gt; Record&lt;string, string \| string[]&gt;; }&gt;
Promise&lt;{ document: Document; container: import("@qwik.dev/core/internal").ClientContainer; vNode: \_VNode \| null; getStyles: () =&gt; Record&lt;string, string \| string[]&gt;; }&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/testing/rendering.unit-util.tsx)

Expand Down Expand Up @@ -617,8 +617,8 @@ JSXOutput
export declare function walkJSX(
jsx: JSXOutput,
apply: {
enter: (jsx: JSXNode) => void;
leave: (jsx: JSXNode) => void;
enter: (jsx: JSXNodeInternal) => void;
leave: (jsx: JSXNodeInternal) => void;
text: (text: _Stringifiable) => void;
},
): void;
Expand Down Expand Up @@ -654,7 +654,7 @@ apply

</td><td>

{ enter: (jsx: JSXNode) =&gt; void; leave: (jsx: JSXNode) =&gt; void; text: (text: \_Stringifiable) =&gt; void; }
{ enter: (jsx: JSXNodeInternal) =&gt; void; leave: (jsx: JSXNodeInternal) =&gt; void; text: (text: \_Stringifiable) =&gt; void; }

</td><td>

Expand Down
Loading

0 comments on commit ddd293b

Please sign in to comment.