Skip to content

Commit

Permalink
chore: manually select TS exports
Browse files Browse the repository at this point in the history
  • Loading branch information
wmertens committed Nov 13, 2024
1 parent 715a57a commit 129d0be
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 25 deletions.
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.
3 changes: 2 additions & 1 deletion packages/qwik-react/src/react/server-render.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type QRL, type Signal, Slot, SSRComment, SSRRaw, SSRStream } from '@qwik.dev/core';
import { type QRL, type Signal, Slot } from '@qwik.dev/core';
import { SSRComment, SSRRaw, SSRStream } from '@qwik.dev/core/internal';
import { isServer } from '@qwik.dev/core/build';
import { renderToString } from 'react-dom/server';
import { getHostProps, getReactProps, mainExactProps } from './slot';
Expand Down
5 changes: 3 additions & 2 deletions packages/qwik/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"exports": {
".": {
"types": "./dist/core.d.ts",
"types": "./public.d.ts",
"import": {
"development": "./dist/core.mjs",
"production": "./dist/core.prod.mjs",
Expand Down Expand Up @@ -120,7 +120,7 @@
"./server.cjs": "./dist/server.cjs",
"./server.mjs": "./dist/server.mjs",
"./server": {
"types": "./dist/server.d.ts",
"types": "./server.d.ts",
"import": "./dist/server.mjs",
"require": "./dist/server.cjs"
},
Expand All @@ -147,6 +147,7 @@
"jsx-runtime.d.ts",
"loader.d.ts",
"optimizer.d.ts",
"public.d.ts",
"server.d.ts",
"testing.d.ts",
"qwik-cli.cjs"
Expand Down
68 changes: 68 additions & 0 deletions packages/qwik/public.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
export {
$,
ClassList,
Component,
component$,
ComputedSignal,
ContextId,
createComputed$,
createContextId,
createSignal,
// TODO remove this
event$,
EventHandler,
Fragment,
FunctionComponent,
getLocale,
getPlatform,
implicit$FirstArg,
isSignal,
jsx,
JSXChildren,
jsxDEV,
JSXNode,
JSXOutput,
noSerialize,
NoSerialize,
PrefetchGraph,
PrefetchServiceWorker,
PropsOf,
QRL,
// TODO should this be used instead of EventHandler?
QRLEventHandlerMulti,
QwikIntrinsicElements,
QwikJSX as JSX,
QwikJSX,
ReadonlySignal,
render,
RenderOnce,
RenderOptions,
Resource,
ResourceReturn,
Signal,
SkipRender,
Slot,
sync$,
// TODO do we really want to export this?
untrack,
useComputed$,
useConstant,
useContext,
useContextProvider,
useErrorBoundary,
useId,
useOn,
useOnDocument,
useOnWindow,
useResource$,
useServerData,
useSignal,
useStore,
useStyles$,
useStylesScoped$,
useTask$,
useVisibleTask$,
ValueOrPromise,
version,
withLocale,
} from './dist/core-internal';
17 changes: 15 additions & 2 deletions packages/qwik/server.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
// re-export for typescript in old resolution mode
export * from './dist/server';
export {
getQwikLoaderScript,
getQwikPrefetchWorkerScript,
setServerPlatform,
Render,
RenderOptions,
RenderResult,
renderToStream,
renderToString,
RenderToStreamOptions,
RenderToStreamResult,
RenderToStringOptions,
RenderToStringResult,
versions,
} from './dist/server';
1 change: 0 additions & 1 deletion packages/qwik/src/core/api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
},
"dtsRollup": {
"enabled": true,
"betaTrimmedFilePath": "<projectFolder>/dist/core.d.ts",
"untrimmedFilePath": "<projectFolder>/dist/core-internal.d.ts"
},
"docModel": {
Expand Down
3 changes: 1 addition & 2 deletions packages/qwik/src/jsx-runtime.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { jsx, jsxs, jsxDEV, Fragment } from './core';
export type { JSX } from './core';
export { jsx, jsx as jsxs, jsxDEV, Fragment, type QwikJSX as JSX } from '@qwik.dev/core';
5 changes: 1 addition & 4 deletions packages/qwik/src/testing/vdom-diff.unit-util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import type {
JSXNode,
JSXOutput,
} from '@qwik.dev/core';
import type { JSXNode, JSXOutput } from '@qwik.dev/core';
import type {
_ElementVNode,
_QDocument,
Expand Down
4 changes: 1 addition & 3 deletions starters/apps/e2e/src/components/render/render.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import {
component$,
event$,
h,
jsx,
SkipRender,
Slot,
SSRComment,
SSRRaw,
useSignal,
useStore,
useStylesScoped$,
Expand All @@ -15,6 +12,7 @@ import {
type PropsOf,
type QRL,
} from "@qwik.dev/core";
import { h, SSRComment, SSRRaw } from "@qwik.dev/core/internal";
import { isServer } from "@qwik.dev/core/build";
import { delay } from "../streaming/demo";

Expand Down
9 changes: 2 additions & 7 deletions starters/apps/e2e/src/components/streaming/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import {
component$,
Resource,
SSRStream,
useResource$,
useStyles$,
} from "@qwik.dev/core";
import { component$, Resource, useResource$, useStyles$ } from "@qwik.dev/core";
import { SSRStream } from "@qwik.dev/core/internal";

export function delay(time: number) {
return new Promise<void>((resolve) => {
Expand Down
4 changes: 1 addition & 3 deletions starters/apps/e2e/src/components/streaming/streaming.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import {
component$,
Resource,
SSRStream,
SSRStreamBlock,
useResource$,
useStore,
useStyles$,
} from "@qwik.dev/core";

import { SSRStream, SSRStreamBlock } from "@qwik.dev/core/internal";
export function delay(time: number) {
return new Promise<void>((resolve) => {
setTimeout(() => resolve(), time);
Expand Down

0 comments on commit 129d0be

Please sign in to comment.