@plasmicapp/loader-react 1.0.41 → 1.0.45

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.
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ /**
3
+ * Performs a prepass over Plasmic content, kicking off the necessary
4
+ * data fetches, and populating the fetched data into a cache. This
5
+ * cache can be passed as prefetchedQueryData into PlasmicRootProvider.
6
+ *
7
+ * To limit rendering errors that can occur when you do this, we recommend
8
+ * that you pass in _only_ the PlasmicComponents that you are planning to use
9
+ * as the argument. For example:
10
+ *
11
+ * const cache = await extractPlasmicQueryData(
12
+ * <PlasmicRootProvider loader={PLASMIC} prefetchedData={plasmicData}>
13
+ * <PlasmicComponent component="Home" componentProps={{
14
+ * // Specify the component prop overrides you are planning to use
15
+ * // to render the page, as they may change what data is fetched.
16
+ * ...
17
+ * }} />
18
+ * <PlasmicComponent component="NavBar" componentProps={{
19
+ * ...
20
+ * }} />
21
+ * ...
22
+ * </PlasmicRootProvider>
23
+ * );
24
+ *
25
+ * If your PlasmicComponent will be wrapping components that require special
26
+ * context set up, you should also wrap the element above with those context
27
+ * providers.
28
+ *
29
+ * You should avoid passing in elements that are not related to Plasmic, as any
30
+ * rendering errors from those elements during the prepass may result in data
31
+ * not being populated in the cache.
32
+ *
33
+ * @param element a React element containing instances of PlasmicComponent.
34
+ * Will attempt to satisfy all data needs from usePlasmicDataQuery()
35
+ * in this element tree.
36
+ * @returns an object mapping query key to fetched data
37
+ */
38
+ export declare function extractPlasmicQueryData(element: React.ReactElement): Promise<Record<string, any>>;
39
+ /**
40
+ * Runs react-ssr-prepass on `element`, while isolating rendering errors
41
+ * as much as possible for each PlasmicComponent instance.
42
+ */
43
+ export declare function plasmicPrepass(element: React.ReactElement): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/loader-react",
3
- "version": "1.0.41",
3
+ "version": "1.0.45",
4
4
  "module": "dist/loader-react.esm.js",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "dist"
9
9
  ],
10
10
  "engines": {
11
- "node": ">=10"
11
+ "node": ">=12"
12
12
  },
13
13
  "scripts": {
14
14
  "start": "tsdx watch",
@@ -21,9 +21,12 @@
21
21
  "analyze": "size-limit --why"
22
22
  },
23
23
  "dependencies": {
24
- "@plasmicapp/host": "0.0.41",
25
- "@plasmicapp/loader-core": "1.0.31",
26
- "pascalcase": "^1.0.0"
24
+ "@plasmicapp/host": "0.0.45",
25
+ "@plasmicapp/loader-core": "1.0.35",
26
+ "@plasmicapp/query": "0.1.3",
27
+ "pascalcase": "^1.0.0",
28
+ "react-is": "^17.0.2",
29
+ "react-ssr-prepass": "^1.4.0"
27
30
  },
28
31
  "peerDependencies": {
29
32
  "react": ">=16.8.0",
@@ -58,6 +61,7 @@
58
61
  "@types/pascalcase": "^1.0.0",
59
62
  "@types/react": "^17.0.9",
60
63
  "@types/react-dom": "^17.0.6",
64
+ "@types/react-is": "^17.0.3",
61
65
  "husky": "^6.0.0",
62
66
  "rollup": "^2.47.0",
63
67
  "rollup-plugin-dts": "^3.0.1",