Skip to content

Commit db271f7

Browse files
committed
feat(core): export internals needed for repl
1 parent 6964cf9 commit db271f7

File tree

5 files changed

+61
-33
lines changed

5 files changed

+61
-33
lines changed

packages/docs/src/repl/repl-output-panel.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import { ReplTabButton } from './repl-tab-button';
66
import { ReplTabButtons } from './repl-tab-buttons';
77
import type { ReplAppInput, ReplStore } from './types';
88
import { _deserialize, _getDomContainer } from '@qwik.dev/core/internal';
9-
import { dumpState, preprocessState } from '../../../qwik/src/core/shared/shared-serialization';
10-
import { vnode_toString } from '../../../qwik/src/core/client/vnode';
9+
import { _dumpState, _preprocessState, _vnode_toString } from '@qwik.dev/core/internal';
1110

1211
export const ReplOutputPanel = component$(({ input, store }: ReplOutputPanelProps) => {
1312
const diagnosticsLen = useComputed$(
@@ -33,9 +32,9 @@ export const ReplOutputPanel = component$(({ input, store }: ReplOutputPanelProp
3332
if (qwikStates.length !== 0) {
3433
const data = qwikStates[qwikStates.length - 1];
3534
const origState = JSON.parse(data?.textContent || '[]');
36-
preprocessState(origState, container as any);
35+
_preprocessState(origState, container as any);
3736
return origState
38-
? dumpState(origState, false, '', null)
37+
? _dumpState(origState, false, '', null)
3938
//remove first new line
4039
.replace(/\n/, '')
4140
: 'No state found';
@@ -50,7 +49,7 @@ export const ReplOutputPanel = component$(({ input, store }: ReplOutputPanelProp
5049
const vdomTree = useComputed$(() => {
5150
try {
5251
const container = domContainerFromResultHtml.value;
53-
return vnode_toString.call(
52+
return _vnode_toString.call(
5453
container!.rootVNode as any,
5554
Number.MAX_SAFE_INTEGER,
5655
'',

packages/qwik/src/core/client/vnode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,6 +1718,7 @@ export const vnode_getNode = (vnode: VNode | null): Element | Text | null => {
17181718
return vnode[TextVNodeProps.node]!;
17191719
};
17201720

1721+
/** @internal */
17211722
export function vnode_toString(
17221723
this: VNode | null,
17231724
depth: number = 20,

packages/qwik/src/core/internal.ts

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,56 @@
11
export { _noopQrl, _noopQrlDEV, _regSymbol } from './shared/qrl/qrl';
2-
export { _walkJSX } from './ssr/ssr-render-jsx';
3-
export { _SharedContainer } from './shared/shared-container';
4-
export { queueQRL as _run } from './client/queue-qrl';
5-
export { scheduleTask as _task } from './use/use-task';
6-
export { _wrapSignal, _wrapProp, _wrapStore } from './reactive-primitives/internal-api';
7-
export { _restProps } from './shared/utils/prop';
8-
export { _IMMUTABLE } from './shared/utils/constants';
9-
export { _CONST_PROPS, _VAR_PROPS } from './shared/utils/constants';
10-
export { _weakSerialize } from './shared/utils/serialize-utils';
11-
export { verifySerializable as _verifySerializable } from './shared/utils/serialize-utils';
2+
// ^ keep this above to avoid circular dependency issues
3+
124
export {
13-
_getContextElement,
14-
_getContextEvent,
15-
_jsxBranch,
16-
_waitUntilRendered,
17-
} from './use/use-core';
18-
export { _jsxSorted, _jsxSplit, isJSXNode as _isJSXNode } from './shared/jsx/jsx-runtime';
19-
export { _fnSignal } from './shared/qrl/inlined-fn';
5+
DomContainer as _DomContainer,
6+
getDomContainer as _getDomContainer,
7+
} from './client/dom-container';
8+
export { queueQRL as _run } from './client/queue-qrl';
209
export type {
2110
ContainerElement as _ContainerElement,
11+
ElementVNode as _ElementVNode,
12+
QDocument as _QDocument,
13+
TextVNode as _TextVNode,
14+
VirtualVNode as _VirtualVNode,
2215
VNode as _VNode,
2316
VNodeFlags as _VNodeFlags,
24-
VirtualVNode as _VirtualVNode,
25-
TextVNode as _TextVNode,
26-
QDocument as _QDocument,
27-
ElementVNode as _ElementVNode,
2817
} from './client/types';
18+
export { vnode_toString as _vnode_toString } from './client/vnode';
19+
export { _wrapProp, _wrapSignal, _wrapStore } from './reactive-primitives/internal-api';
20+
export { SubscriptionData as _SubscriptionData } from './reactive-primitives/subscription-data';
21+
export { _EFFECT_BACK_REF } from './reactive-primitives/types';
2922
export {
3023
isStringifiable as _isStringifiable,
3124
type Stringifiable as _Stringifiable,
3225
} from './shared-types';
3326
export {
34-
DomContainer as _DomContainer,
35-
getDomContainer as _getDomContainer,
36-
} from './client/dom-container';
27+
isJSXNode as _isJSXNode,
28+
_jsxC,
29+
_jsxQ,
30+
_jsxS,
31+
_jsxSorted,
32+
_jsxSplit,
33+
} from './shared/jsx/jsx-runtime';
34+
export { _fnSignal } from './shared/qrl/inlined-fn';
35+
export { _SharedContainer } from './shared/shared-container';
36+
export {
37+
_deserialize,
38+
dumpState as _dumpState,
39+
preprocessState as _preprocessState,
40+
_serialize,
41+
} from './shared/shared-serialization';
42+
export { _CONST_PROPS, _IMMUTABLE, _VAR_PROPS } from './shared/utils/constants';
3743
export { EMPTY_ARRAY as _EMPTY_ARRAY } from './shared/utils/flyweight';
38-
export { _serialize, _deserialize } from './shared/shared-serialization';
39-
export { _jsxQ, _jsxC, _jsxS } from './shared/jsx/jsx-runtime';
40-
export { _EFFECT_BACK_REF } from './reactive-primitives/types';
41-
export { SubscriptionData as _SubscriptionData } from './reactive-primitives/subscription-data';
44+
export { _restProps } from './shared/utils/prop';
45+
export {
46+
verifySerializable as _verifySerializable,
47+
_weakSerialize,
48+
} from './shared/utils/serialize-utils';
49+
export { _walkJSX } from './ssr/ssr-render-jsx';
50+
export {
51+
_getContextElement,
52+
_getContextEvent,
53+
_jsxBranch,
54+
_waitUntilRendered,
55+
} from './use/use-core';
56+
export { scheduleTask as _task } from './use/use-task';

packages/qwik/src/core/qwik.core.api.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ class DomContainer extends _SharedContainer implements ClientContainer {
246246
export { DomContainer }
247247
export { DomContainer as _DomContainer }
248248

249+
// @internal (undocumented)
250+
export const _dumpState: (state: unknown[], color?: boolean, prefix?: string, limit?: number | null) => string;
251+
249252
// @internal (undocumented)
250253
export const _EFFECT_BACK_REF: unique symbol;
251254

@@ -551,6 +554,11 @@ export const PrefetchServiceWorker: (opts: {
551554
nonce?: string;
552555
}) => JSXOutput;
553556

557+
// Warning: (ae-forgotten-export) The symbol "DeserializeContainer" needs to be exported by the entry point index.d.ts
558+
//
559+
// @internal
560+
export function _preprocessState(data: unknown[], container: DeserializeContainer): void;
561+
554562
// @public
555563
export type PropFunction<T> = QRL<T>;
556564

@@ -1774,6 +1782,9 @@ export type VisibleTaskStrategy = 'intersection-observer' | 'document-ready' | '
17741782
// @internal (undocumented)
17751783
export type _VNode = _ElementVNode | _TextVNode | _VirtualVNode;
17761784

1785+
// @internal (undocumented)
1786+
export function _vnode_toString(this: _VNode | null, depth?: number, offset?: string, materialize?: boolean, siblings?: boolean, colorize?: boolean): string;
1787+
17771788
// @internal
17781789
export const enum _VNodeFlags {
17791790
// (undocumented)

packages/qwik/src/core/shared/shared-serialization.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,7 @@ export function _createDeserializeContainer(
16141614
*
16151615
* @param data - The state data to preprocess
16161616
* @returns The preprocessed state data
1617+
* @internal
16171618
*/
16181619
export function preprocessState(data: unknown[], container: DeserializeContainer) {
16191620
const isRootDeepRef = (type: TypeIds, value: unknown) => {
@@ -1934,6 +1935,7 @@ const printRaw = (value: any, prefix: string) => {
19341935
return result.includes('\n') ? (result = `\n${prefix}${result}`) : result;
19351936
};
19361937
let hasRaw = false;
1938+
/** @internal */
19371939
export const dumpState = (
19381940
state: unknown[],
19391941
color = false,

0 commit comments

Comments
 (0)