@plasmicapp/loader-react 1.0.205 → 1.0.207
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-react-server.d.ts +5 -0
- package/dist/index-shared.d.ts +6 -0
- package/dist/index.d.ts +5 -4
- package/dist/loader-react-server.d.ts +72 -0
- package/dist/loader-react.cjs.development.js +484 -426
- package/dist/loader-react.cjs.development.js.map +1 -1
- package/dist/loader-react.cjs.production.min.js +1 -1
- package/dist/loader-react.cjs.production.min.js.map +1 -1
- package/dist/loader-react.esm.js +484 -426
- package/dist/loader-react.esm.js.map +1 -1
- package/dist/loader.d.ts +9 -52
- package/dist/utils.d.ts +1 -0
- package/dist-react-server/PlasmicComponent.d.ts +19 -0
- package/dist-react-server/PlasmicRootProvider.d.ts +92 -0
- package/dist-react-server/bundles.d.ts +7 -0
- package/dist-react-server/component-lookup.d.ts +21 -0
- package/dist-react-server/global-variants.d.ts +13 -0
- package/dist-react-server/index-react-server.d.ts +5 -0
- package/dist-react-server/index-shared.d.ts +6 -0
- package/dist-react-server/index.d.ts +12 -0
- package/dist-react-server/index.js +8 -0
- package/dist-react-server/loader-react-server.d.ts +72 -0
- package/dist-react-server/loader-react.cjs.development.js +1315 -0
- package/dist-react-server/loader-react.cjs.development.js.map +1 -0
- package/dist-react-server/loader-react.cjs.production.min.js +2 -0
- package/dist-react-server/loader-react.cjs.production.min.js.map +1 -0
- package/dist-react-server/loader-react.esm.js +1306 -0
- package/dist-react-server/loader-react.esm.js.map +1 -0
- package/dist-react-server/loader.d.ts +168 -0
- package/dist-react-server/prepass.d.ts +43 -0
- package/dist-react-server/render.d.ts +27 -0
- package/dist-react-server/usePlasmicComponent.d.ts +15 -0
- package/dist-react-server/utils.d.ts +30 -0
- package/dist-react-server/variation.d.ts +9 -0
- package/index.d.ts +1 -0
- package/package.json +46 -9
- package/react-server-conditional.d.ts +4 -0
- package/react-server.d.ts +1 -0
package/dist/loader.d.ts
CHANGED
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
import { ComponentMeta as InternalCodeComponentMeta, GlobalContextMeta as InternalGlobalContextMeta, TraitMeta } from '@plasmicapp/host';
|
|
2
|
-
import { ComponentMeta,
|
|
2
|
+
import { ComponentMeta, LoaderBundleOutput, TrackRenderOptions } from '@plasmicapp/loader-core';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ComponentLookup } from './component-lookup';
|
|
5
|
-
import {
|
|
5
|
+
import { FetchComponentDataOpts, InitOptions } from './loader-react-server';
|
|
6
|
+
import type { GlobalVariantSpec } from './PlasmicRootProvider';
|
|
6
7
|
import { ComponentLookupSpec } from './utils';
|
|
7
|
-
export interface InitOptions {
|
|
8
|
-
projects: ProjectOption[];
|
|
9
|
-
cache?: LoaderBundleCache;
|
|
10
|
-
platform?: 'react' | 'nextjs' | 'gatsby';
|
|
11
|
-
preview?: boolean;
|
|
12
|
-
host?: string;
|
|
13
|
-
onClientSideFetch?: 'warn' | 'error';
|
|
14
|
-
i18nKeyScheme?: 'content' | 'hash';
|
|
15
|
-
/**
|
|
16
|
-
* By default, fetchComponentData() and fetchPages() calls cached in memory
|
|
17
|
-
* with the PlasmicComponentLoader instance. If alwaysFresh is true, then
|
|
18
|
-
* data is always freshly fetched over the network.
|
|
19
|
-
*/
|
|
20
|
-
alwaysFresh?: boolean;
|
|
21
|
-
}
|
|
22
|
-
interface ProjectOption {
|
|
23
|
-
id: string;
|
|
24
|
-
token: string;
|
|
25
|
-
version?: string;
|
|
26
|
-
}
|
|
27
8
|
export interface ComponentRenderData {
|
|
28
9
|
entryCompMetas: (ComponentMeta & {
|
|
29
10
|
params?: Record<string, string>;
|
|
@@ -31,7 +12,6 @@ export interface ComponentRenderData {
|
|
|
31
12
|
bundle: LoaderBundleOutput;
|
|
32
13
|
remoteFontUrls: string[];
|
|
33
14
|
}
|
|
34
|
-
export declare function initPlasmicLoader(opts: InitOptions): PlasmicComponentLoader;
|
|
35
15
|
interface PlasmicRootWatcher {
|
|
36
16
|
onDataFetched?: () => void;
|
|
37
17
|
}
|
|
@@ -63,16 +43,16 @@ export declare type FetchPagesOpts = {
|
|
|
63
43
|
};
|
|
64
44
|
export declare class InternalPlasmicComponentLoader {
|
|
65
45
|
private opts;
|
|
66
|
-
private
|
|
67
|
-
private registry;
|
|
46
|
+
private readonly reactServerLoader;
|
|
47
|
+
private readonly registry;
|
|
68
48
|
private subs;
|
|
69
49
|
private roots;
|
|
70
50
|
private globalVariants;
|
|
71
|
-
private bundle;
|
|
72
51
|
private tracker;
|
|
73
52
|
private substitutedComponents;
|
|
74
53
|
private substitutedGlobalVariantHooks;
|
|
75
54
|
constructor(opts: InitOptions);
|
|
55
|
+
getBundle(): LoaderBundleOutput;
|
|
76
56
|
setGlobalVariants(globalVariants: GlobalVariantSpec[]): void;
|
|
77
57
|
getGlobalVariants(): GlobalVariantSpec[];
|
|
78
58
|
registerModules(modules: Record<string, any>): void;
|
|
@@ -84,18 +64,15 @@ export declare class InternalPlasmicComponentLoader {
|
|
|
84
64
|
subscribePlasmicRoot(watcher: PlasmicRootWatcher): void;
|
|
85
65
|
unsubscribePlasmicRoot(watcher: PlasmicRootWatcher): void;
|
|
86
66
|
clearCache(): void;
|
|
87
|
-
|
|
67
|
+
getLookup(): ComponentLookup;
|
|
88
68
|
maybeFetchComponentData(specs: ComponentLookupSpec[], opts?: FetchComponentDataOpts): Promise<ComponentRenderData | null>;
|
|
89
69
|
maybeFetchComponentData(...specs: ComponentLookupSpec[]): Promise<ComponentRenderData | null>;
|
|
90
70
|
fetchComponentData(specs: ComponentLookupSpec[], opts?: FetchComponentDataOpts): Promise<ComponentRenderData>;
|
|
91
71
|
fetchComponentData(...specs: ComponentLookupSpec[]): Promise<ComponentRenderData>;
|
|
92
|
-
fetchPages(opts?: FetchPagesOpts): Promise<PageMeta[]>;
|
|
72
|
+
fetchPages(opts?: FetchPagesOpts): Promise<import("@plasmicapp/loader-core").PageMeta[]>;
|
|
93
73
|
fetchComponents(): Promise<ComponentMeta[]>;
|
|
94
|
-
getLookup(): ComponentLookup;
|
|
95
74
|
getActiveSplits(): import("@plasmicapp/loader-core").Split[];
|
|
96
75
|
trackConversion(value?: number): void;
|
|
97
|
-
private fetchMissingData;
|
|
98
|
-
private maybeReportClientSideFetch;
|
|
99
76
|
getActiveVariation(opts: {
|
|
100
77
|
traits: Record<string, string | number | boolean>;
|
|
101
78
|
getKnownValue: (key: string) => string | undefined;
|
|
@@ -104,10 +81,7 @@ export declare class InternalPlasmicComponentLoader {
|
|
|
104
81
|
getTeamIds(): string[];
|
|
105
82
|
getProjectIds(): string[];
|
|
106
83
|
trackRender(opts?: TrackRenderOptions): void;
|
|
107
|
-
private fetchAllData;
|
|
108
|
-
private mergeBundle;
|
|
109
84
|
private refreshRegistry;
|
|
110
|
-
private ensureFetcher;
|
|
111
85
|
}
|
|
112
86
|
/**
|
|
113
87
|
* Library for fetching component data, and registering
|
|
@@ -172,7 +146,7 @@ export declare class PlasmicComponentLoader {
|
|
|
172
146
|
/**
|
|
173
147
|
* Returns all the page component metadata for these projects.
|
|
174
148
|
*/
|
|
175
|
-
fetchPages(opts?: FetchPagesOpts): Promise<PageMeta[]>;
|
|
149
|
+
fetchPages(opts?: FetchPagesOpts): Promise<import("@plasmicapp/loader-core").PageMeta[]>;
|
|
176
150
|
/**
|
|
177
151
|
* Returns all components metadata for these projects.
|
|
178
152
|
*/
|
|
@@ -191,21 +165,4 @@ export declare class PlasmicComponentLoader {
|
|
|
191
165
|
trackConversion(value?: number): void;
|
|
192
166
|
clearCache(): void;
|
|
193
167
|
}
|
|
194
|
-
interface FetchComponentDataOpts {
|
|
195
|
-
/**
|
|
196
|
-
* Will fetch either code targeting SSR or browser hydration in the
|
|
197
|
-
* returned bundle.
|
|
198
|
-
*
|
|
199
|
-
* By default, the target is browser. That's okay, because even when
|
|
200
|
-
* doing SSR, as long as you are using the same instance of PlasmicLoader
|
|
201
|
-
* that was used to fetch component data, it will still know how to get at
|
|
202
|
-
* the server code.
|
|
203
|
-
*
|
|
204
|
-
* But, if you are building your own SSR solution, where fetching and rendering
|
|
205
|
-
* are using different instances of PlasmicLoader, then you'll want to make
|
|
206
|
-
* sure that when you fetch, you are fetching the right one to be used in the
|
|
207
|
-
* right environment for either SSR or browser hydration.
|
|
208
|
-
*/
|
|
209
|
-
target?: 'server' | 'browser';
|
|
210
|
-
}
|
|
211
168
|
export {};
|
package/dist/utils.d.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare function PlasmicComponent(props: {
|
|
3
|
+
/**
|
|
4
|
+
* Name of the component to render, or the path of the page component
|
|
5
|
+
*/
|
|
6
|
+
component: string;
|
|
7
|
+
/**
|
|
8
|
+
* Optionally specify a projectId if there are multiple components
|
|
9
|
+
* of the same name from different projects
|
|
10
|
+
*/
|
|
11
|
+
projectId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* If you used registerComponent(), then if the name matches a registered
|
|
14
|
+
* component, that component is used. If you want the Plasmic-generated
|
|
15
|
+
* component instead, specify forceOriginal.
|
|
16
|
+
*/
|
|
17
|
+
forceOriginal?: boolean;
|
|
18
|
+
componentProps?: any;
|
|
19
|
+
}): React.ReactElement | null;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { PlasmicDataSourceContextValue } from '@plasmicapp/data-sources-context';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ComponentRenderData, InternalPlasmicComponentLoader, PlasmicComponentLoader } from './loader';
|
|
4
|
+
interface PlasmicRootContextValue extends PlasmicDataSourceContextValue {
|
|
5
|
+
globalVariants?: GlobalVariantSpec[];
|
|
6
|
+
globalContextsProps?: Record<string, any>;
|
|
7
|
+
loader: InternalPlasmicComponentLoader;
|
|
8
|
+
variation?: Record<string, string>;
|
|
9
|
+
translator?: PlasmicTranslator;
|
|
10
|
+
Head?: React.ComponentType<any>;
|
|
11
|
+
}
|
|
12
|
+
export interface GlobalVariantSpec {
|
|
13
|
+
name: string;
|
|
14
|
+
projectId?: string;
|
|
15
|
+
value: any;
|
|
16
|
+
}
|
|
17
|
+
export declare type PlasmicTranslator = (str: string, opts?: {
|
|
18
|
+
components?: {
|
|
19
|
+
[key: string]: React.ReactElement | React.ReactFragment;
|
|
20
|
+
};
|
|
21
|
+
}) => React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* PlasmicRootProvider should be used at the root of your page
|
|
24
|
+
* or application.
|
|
25
|
+
*/
|
|
26
|
+
export declare function PlasmicRootProvider(props: {
|
|
27
|
+
/**
|
|
28
|
+
* The global PlasmicComponentLoader instance you created via
|
|
29
|
+
* initPlasmicLoader().
|
|
30
|
+
*/
|
|
31
|
+
loader: PlasmicComponentLoader;
|
|
32
|
+
/**
|
|
33
|
+
* Global variants to activate for Plasmic components
|
|
34
|
+
*/
|
|
35
|
+
globalVariants?: GlobalVariantSpec[];
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* If true, will skip rendering css
|
|
39
|
+
*/
|
|
40
|
+
skipCss?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* If true, will skip installing fonts
|
|
43
|
+
*/
|
|
44
|
+
skipFonts?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* If you have pre-fetched component data via PlasmicComponentLoader,
|
|
47
|
+
* you can pass them in here; PlasmicComponent will avoid fetching
|
|
48
|
+
* component data that have already been pre-fetched.
|
|
49
|
+
*/
|
|
50
|
+
prefetchedData?: ComponentRenderData;
|
|
51
|
+
/**
|
|
52
|
+
* If you have pre-fetched data that are needed by usePlasmicQueryData(),
|
|
53
|
+
* then pass in the pre-fetched cache here, mapping query key to fetched data.
|
|
54
|
+
*/
|
|
55
|
+
prefetchedQueryData?: Record<string, any>;
|
|
56
|
+
/**
|
|
57
|
+
* Specifies whether usePlasmicQueryData() should be operating in suspense mode
|
|
58
|
+
* (throwing promises).
|
|
59
|
+
*/
|
|
60
|
+
suspenseForQueryData?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Override your Global Contexts Provider props. This is a map from
|
|
63
|
+
* globalContextComponentNameProps to object of props to use for that
|
|
64
|
+
* component.
|
|
65
|
+
*/
|
|
66
|
+
globalContextsProps?: Record<string, any>;
|
|
67
|
+
/**
|
|
68
|
+
* Specifies a mapping of split id to slice id that should be activated
|
|
69
|
+
*/
|
|
70
|
+
variation?: Record<string, string>;
|
|
71
|
+
/**
|
|
72
|
+
* Translator function to be used for text blocks
|
|
73
|
+
*/
|
|
74
|
+
translator?: PlasmicTranslator;
|
|
75
|
+
/**
|
|
76
|
+
* Head component to use in PlasmicHead component (e.g. Head from next/head
|
|
77
|
+
* or Helmet from react-helmet).
|
|
78
|
+
*/
|
|
79
|
+
Head?: React.ComponentType<any>;
|
|
80
|
+
/**
|
|
81
|
+
* Page path parameters (e.g. {slug: "foo"} if page path is
|
|
82
|
+
* /products/[slug] and URI is /products/foo).
|
|
83
|
+
*/
|
|
84
|
+
pageParams?: Record<string, string | string[] | undefined>;
|
|
85
|
+
/**
|
|
86
|
+
* Page query parameters (e.g. {q: "foo"} if page path is
|
|
87
|
+
* /some/path?q=foo).
|
|
88
|
+
*/
|
|
89
|
+
pageQuery?: Record<string, string | string[] | undefined>;
|
|
90
|
+
}): JSX.Element;
|
|
91
|
+
export declare function usePlasmicRootContext(): PlasmicRootContextValue | undefined;
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentMeta, LoaderBundleOutput } from '@plasmicapp/loader-core';
|
|
2
|
+
import type { ComponentRenderData } from './loader';
|
|
3
|
+
export declare function prepComponentData(bundle: LoaderBundleOutput, compMetas: ComponentMeta[], opts?: {
|
|
4
|
+
target?: 'browser' | 'server';
|
|
5
|
+
}): ComponentRenderData;
|
|
6
|
+
export declare function mergeBundles(target: LoaderBundleOutput, from: LoaderBundleOutput): LoaderBundleOutput;
|
|
7
|
+
export declare const convertBundlesToComponentRenderData: (bundles: LoaderBundleOutput[], compMetas: ComponentMeta[]) => ComponentRenderData | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AssetModule, ComponentMeta, FontMeta, GlobalGroupMeta, LoaderBundleOutput, Registry } from '@plasmicapp/loader-core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ComponentLookupSpec } from './utils';
|
|
4
|
+
export declare class ComponentLookup {
|
|
5
|
+
private bundle;
|
|
6
|
+
private registry;
|
|
7
|
+
constructor(bundle: LoaderBundleOutput, registry: Registry);
|
|
8
|
+
getComponentMeta(spec: ComponentLookupSpec): ComponentMeta | undefined;
|
|
9
|
+
getComponent<P extends React.ComponentType = any>(spec: ComponentLookupSpec, opts?: {
|
|
10
|
+
forceOriginal?: boolean;
|
|
11
|
+
}): any;
|
|
12
|
+
hasComponent(spec: ComponentLookupSpec): boolean;
|
|
13
|
+
getGlobalContexts(): {
|
|
14
|
+
meta: GlobalGroupMeta;
|
|
15
|
+
context: any;
|
|
16
|
+
}[];
|
|
17
|
+
getGlobalContextsProvider(spec: ComponentLookupSpec): any;
|
|
18
|
+
getRootProvider(): any;
|
|
19
|
+
getCss(): AssetModule[];
|
|
20
|
+
getRemoteFonts(): FontMeta[];
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* We don't actually make use of the global variant React contexts generated
|
|
3
|
+
* in the bundle. That's because we would have to wait until the data is
|
|
4
|
+
* loaded before we can set up the context providers, but setting up context
|
|
5
|
+
* providers will mutate the React tree and invalidate all the children. That means
|
|
6
|
+
* once data comes in, we'll re-render the React tree from the providers down
|
|
7
|
+
* in a way that will lose all existing React state. Therefore, instead,
|
|
8
|
+
* we always have a single context provided -- the PlasmicRootContext -- and we
|
|
9
|
+
* create these fake useGlobalVariant() hooks that just read from that
|
|
10
|
+
* PlasmicRootContext. This allows us to have a stable React tree before and
|
|
11
|
+
* after the data load.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createUseGlobalVariant(name: string, projectId: string): () => any;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import 'server-only';
|
|
2
|
+
import { InitOptions, ReactServerPlasmicComponentLoader } from './loader-react-server';
|
|
3
|
+
export * from './index-shared';
|
|
4
|
+
export { ReactServerPlasmicComponentLoader };
|
|
5
|
+
export declare function initPlasmicLoader(opts: InitOptions): ReactServerPlasmicComponentLoader;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Shared exports for both "default" and "react-server" exports live here. */
|
|
2
|
+
export type { ComponentMeta, PageMeta, PageMetadata, } from '@plasmicapp/loader-core';
|
|
3
|
+
export { convertBundlesToComponentRenderData } from './bundles';
|
|
4
|
+
export type { ComponentRenderData } from './loader';
|
|
5
|
+
export type { InitOptions } from './loader-react-server';
|
|
6
|
+
export { matchesPagePath } from './utils';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InternalPlasmicComponentLoader, PlasmicComponentLoader } from './loader';
|
|
2
|
+
import type { InitOptions } from './loader-react-server';
|
|
3
|
+
export { DataCtxReader, DataProvider, PageParamsProvider, PlasmicCanvasContext, PlasmicCanvasHost, PrimitiveType, PropType, repeatedElement, useDataEnv, usePlasmicCanvasContext, useSelector, useSelectors, } from '@plasmicapp/host';
|
|
4
|
+
export { usePlasmicQueryData } from '@plasmicapp/query';
|
|
5
|
+
export * from './index-shared';
|
|
6
|
+
export { PlasmicComponent } from './PlasmicComponent';
|
|
7
|
+
export { GlobalVariantSpec, PlasmicRootProvider, PlasmicTranslator, } from './PlasmicRootProvider';
|
|
8
|
+
export { extractPlasmicQueryData, plasmicPrepass } from './prepass';
|
|
9
|
+
export { extractPlasmicQueryDataFromElement, hydrateFromElement, renderToElement, renderToString, } from './render';
|
|
10
|
+
export { usePlasmicComponent } from './usePlasmicComponent';
|
|
11
|
+
export { InternalPlasmicComponentLoader, PlasmicComponentLoader };
|
|
12
|
+
export declare function initPlasmicLoader(opts: InitOptions): PlasmicComponentLoader;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { LoaderBundleCache, PageMeta, PlasmicModulesFetcher, PlasmicTracker } from '@plasmicapp/loader-core';
|
|
2
|
+
import { ComponentMeta, LoaderBundleOutput } from '@plasmicapp/loader-fetcher';
|
|
3
|
+
import { ComponentRenderData, FetchPagesOpts } from './loader';
|
|
4
|
+
import { ComponentLookupSpec } from './utils';
|
|
5
|
+
export interface InitOptions {
|
|
6
|
+
projects: {
|
|
7
|
+
id: string;
|
|
8
|
+
token: string;
|
|
9
|
+
version?: string;
|
|
10
|
+
}[];
|
|
11
|
+
cache?: LoaderBundleCache;
|
|
12
|
+
platform?: 'react' | 'nextjs' | 'gatsby';
|
|
13
|
+
preview?: boolean;
|
|
14
|
+
host?: string;
|
|
15
|
+
onClientSideFetch?: 'warn' | 'error';
|
|
16
|
+
i18nKeyScheme?: 'content' | 'hash';
|
|
17
|
+
/**
|
|
18
|
+
* By default, fetchComponentData() and fetchPages() calls cached in memory
|
|
19
|
+
* with the PlasmicComponentLoader instance. If alwaysFresh is true, then
|
|
20
|
+
* data is always freshly fetched over the network.
|
|
21
|
+
*/
|
|
22
|
+
alwaysFresh?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Subset of loader functionality that works on React Server Components. */
|
|
25
|
+
export declare class ReactServerPlasmicComponentLoader {
|
|
26
|
+
private readonly opts;
|
|
27
|
+
private readonly fetcher;
|
|
28
|
+
private readonly tracker;
|
|
29
|
+
private readonly onBundleMerged?;
|
|
30
|
+
private readonly onBundleFetched?;
|
|
31
|
+
private bundle;
|
|
32
|
+
constructor(args: {
|
|
33
|
+
opts: InitOptions;
|
|
34
|
+
fetcher: PlasmicModulesFetcher;
|
|
35
|
+
tracker: PlasmicTracker;
|
|
36
|
+
/** Called after `mergeBundle` (including `fetch` calls). */
|
|
37
|
+
onBundleMerged?: () => void;
|
|
38
|
+
/** Called after any `fetch` calls. */
|
|
39
|
+
onBundleFetched?: () => void;
|
|
40
|
+
});
|
|
41
|
+
private maybeGetCompMetas;
|
|
42
|
+
maybeFetchComponentData(specs: ComponentLookupSpec[], opts?: FetchComponentDataOpts): Promise<ComponentRenderData | null>;
|
|
43
|
+
maybeFetchComponentData(...specs: ComponentLookupSpec[]): Promise<ComponentRenderData | null>;
|
|
44
|
+
fetchComponentData(specs: ComponentLookupSpec[], opts?: FetchComponentDataOpts): Promise<ComponentRenderData>;
|
|
45
|
+
fetchComponentData(...specs: ComponentLookupSpec[]): Promise<ComponentRenderData>;
|
|
46
|
+
fetchPages(opts?: FetchPagesOpts): Promise<PageMeta[]>;
|
|
47
|
+
fetchComponents(): Promise<ComponentMeta[]>;
|
|
48
|
+
getActiveSplits(): import("@plasmicapp/loader-core").Split[];
|
|
49
|
+
private fetchMissingData;
|
|
50
|
+
private maybeReportClientSideFetch;
|
|
51
|
+
private fetchAllData;
|
|
52
|
+
mergeBundle(bundle: LoaderBundleOutput): void;
|
|
53
|
+
getBundle(): LoaderBundleOutput;
|
|
54
|
+
clearCache(): void;
|
|
55
|
+
}
|
|
56
|
+
export interface FetchComponentDataOpts {
|
|
57
|
+
/**
|
|
58
|
+
* Will fetch either code targeting SSR or browser hydration in the
|
|
59
|
+
* returned bundle.
|
|
60
|
+
*
|
|
61
|
+
* By default, the target is browser. That's okay, because even when
|
|
62
|
+
* doing SSR, as long as you are using the same instance of PlasmicLoader
|
|
63
|
+
* that was used to fetch component data, it will still know how to get at
|
|
64
|
+
* the server code.
|
|
65
|
+
*
|
|
66
|
+
* But, if you are building your own SSR solution, where fetching and rendering
|
|
67
|
+
* are using different instances of PlasmicLoader, then you'll want to make
|
|
68
|
+
* sure that when you fetch, you are fetching the right one to be used in the
|
|
69
|
+
* right environment for either SSR or browser hydration.
|
|
70
|
+
*/
|
|
71
|
+
target?: 'server' | 'browser';
|
|
72
|
+
}
|