@plasmicapp/nextjs-app-router 1.0.6 → 1.0.8
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/README.md +11 -0
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -100,6 +100,15 @@ async function withExtractPlasmicQueryData(
|
|
|
100
100
|
// to extract query data.
|
|
101
101
|
newSearchParams.set("plasmicSsr", "true");
|
|
102
102
|
|
|
103
|
+
if (process.env.VERCEL_AUTOMATION_BYPASS_SECRET) {
|
|
104
|
+
// If protection bypass is enabled, use it to ensure fetching from
|
|
105
|
+
// the SSR endpoint will not return the authentication page HTML
|
|
106
|
+
newSearchParams.set(
|
|
107
|
+
"x-vercel-protection-bypass",
|
|
108
|
+
process.env.VERCEL_AUTOMATION_BYPASS_SECRET
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
103
112
|
// Fetch the data from the endpoint using the new search params
|
|
104
113
|
const prefetchedQueryData = await fetchExtractedQueryData(
|
|
105
114
|
`${prepassHost}${pathname}?${newSearchParams.toString()}`
|
|
@@ -138,6 +147,8 @@ module.exports = {
|
|
|
138
147
|
|
|
139
148
|
The `PLASMIC_PREPASS_SERVER` environment variable will be set by with-plasmic-prepass.
|
|
140
149
|
|
|
150
|
+
3. If you are deploying to Vercel, make sure to either disable [Vercel Authentication](https://vercel.com/docs/security/deployment-protection/methods-to-protect-deployments/vercel-authentication) or provide the [Protection Bypass](https://vercel.com/docs/security/deployment-protection/methods-to-bypass-deployment-protection/protection-bypass-automation) (Note: this is a paid feature). This is to ensure the SSR endpoint will not return Vercel's page authentication HTML.
|
|
151
|
+
|
|
141
152
|
So...
|
|
142
153
|
|
|
143
154
|
- At dev time, uses itself for extracting query data (hits `localhost:${PORT}`)
|
package/dist/index.esm.js
CHANGED
|
@@ -5,14 +5,14 @@ import { extractPlasmicQueryData } from "@plasmicapp/prepass";
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
function ExtractPlasmicQueryData(props) {
|
|
7
7
|
const { children } = props;
|
|
8
|
-
if (!
|
|
8
|
+
if (!("useId" in React) || !("use" in React)) {
|
|
9
9
|
throw new Error(
|
|
10
10
|
`You can only use <ExtractPlasmicQueryData /> from server components.`
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
-
const scriptId = `plasmic-prefetch-${React
|
|
13
|
+
const scriptId = `plasmic-prefetch-${React["useId"]()}`;
|
|
14
14
|
if (typeof window === "undefined") {
|
|
15
|
-
const data = React
|
|
15
|
+
const data = React["use"](
|
|
16
16
|
extractPlasmicQueryData(/* @__PURE__ */ React.createElement(React.Fragment, null, children))
|
|
17
17
|
);
|
|
18
18
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/ExtractPlasmicQueryData.tsx"],
|
|
4
|
-
"sourcesContent": ["import { extractPlasmicQueryData } from \"@plasmicapp/prepass\";\nimport * as React from \"react\";\n\n/**\n * EXPERIMENTAL\n *\n * A component that serves the same purpose as extractPlasmicQueryData(), but from\n * React server components. This only works from frameworks that support\n * React.useId() and React.use() (like Next.js 13).\n *\n * The children of this component will be run through `extractPlasmicQueryData()`.\n */\nexport function ExtractPlasmicQueryData(props: { children?: React.ReactNode }) {\n const { children } = props;\n if (!
|
|
5
|
-
"mappings": ";;;AAAA,SAAS,+BAA+B;AACxC,YAAY,WAAW;AAWhB,SAAS,wBAAwB,OAAuC;AAC7E,QAAM,EAAE,SAAS,IAAI;AACrB,MAAI,
|
|
4
|
+
"sourcesContent": ["import { extractPlasmicQueryData } from \"@plasmicapp/prepass\";\nimport * as React from \"react\";\n\n/**\n * EXPERIMENTAL\n *\n * A component that serves the same purpose as extractPlasmicQueryData(), but from\n * React server components. This only works from frameworks that support\n * React.useId() and React.use() (like Next.js 13).\n *\n * The children of this component will be run through `extractPlasmicQueryData()`.\n */\nexport function ExtractPlasmicQueryData(props: { children?: React.ReactNode }) {\n const { children } = props;\n if (!(\"useId\" in React) || !(\"use\" in React)) {\n throw new Error(\n `You can only use <ExtractPlasmicQueryData /> from server components.`\n );\n }\n const scriptId = `plasmic-prefetch-${(React as any)[\"\" + \"useId\"]()}`;\n if (typeof window === \"undefined\") {\n const data: Record<string, any> = (React as any)[\"\" + \"use\"](\n extractPlasmicQueryData(<>{children}</>)\n );\n return (\n <>\n <script\n type=\"application/json\"\n dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }}\n data-plasmic-prefetch-id={scriptId}\n suppressHydrationWarning={true}\n />\n </>\n );\n } else {\n return null;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;AAAA,SAAS,+BAA+B;AACxC,YAAY,WAAW;AAWhB,SAAS,wBAAwB,OAAuC;AAC7E,QAAM,EAAE,SAAS,IAAI;AACrB,MAAI,EAAE,WAAW,UAAU,EAAE,SAAS,QAAQ;AAC5C,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,QAAM,WAAW,oBAAmC,eAAc;AAClE,MAAI,OAAO,WAAW,aAAa;AACjC,UAAM,OAA2C;AAAA,MAC/C,wBAAwB,0DAAG,QAAS,CAAG;AAAA,IACzC;AACA,WACE,0DACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,yBAAyB,EAAE,QAAQ,KAAK,UAAU,IAAI,EAAE;AAAA,QACxD,4BAA0B;AAAA,QAC1B,0BAA0B;AAAA;AAAA,IAC5B,CACF;AAAA,EAEJ,OAAO;AACL,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -40,14 +40,14 @@ var import_prepass = require("@plasmicapp/prepass");
|
|
|
40
40
|
var React = __toESM(require("react"));
|
|
41
41
|
function ExtractPlasmicQueryData(props) {
|
|
42
42
|
const { children } = props;
|
|
43
|
-
if (!
|
|
43
|
+
if (!("useId" in React) || !("use" in React)) {
|
|
44
44
|
throw new Error(
|
|
45
45
|
`You can only use <ExtractPlasmicQueryData /> from server components.`
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
|
-
const scriptId = `plasmic-prefetch-${React
|
|
48
|
+
const scriptId = `plasmic-prefetch-${React["useId"]()}`;
|
|
49
49
|
if (typeof window === "undefined") {
|
|
50
|
-
const data = React
|
|
50
|
+
const data = React["use"](
|
|
51
51
|
(0, import_prepass.extractPlasmicQueryData)(/* @__PURE__ */ React.createElement(React.Fragment, null, children))
|
|
52
52
|
);
|
|
53
53
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/ExtractPlasmicQueryData.tsx"],
|
|
4
|
-
"sourcesContent": ["export * from \"./ExtractPlasmicQueryData\";\n", "import { extractPlasmicQueryData } from \"@plasmicapp/prepass\";\nimport * as React from \"react\";\n\n/**\n * EXPERIMENTAL\n *\n * A component that serves the same purpose as extractPlasmicQueryData(), but from\n * React server components. This only works from frameworks that support\n * React.useId() and React.use() (like Next.js 13).\n *\n * The children of this component will be run through `extractPlasmicQueryData()`.\n */\nexport function ExtractPlasmicQueryData(props: { children?: React.ReactNode }) {\n const { children } = props;\n if (!
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qBAAwC;AACxC,YAAuB;AAWhB,SAAS,wBAAwB,OAAuC;AAC7E,QAAM,EAAE,SAAS,IAAI;AACrB,MAAI,
|
|
4
|
+
"sourcesContent": ["export * from \"./ExtractPlasmicQueryData\";\n", "import { extractPlasmicQueryData } from \"@plasmicapp/prepass\";\nimport * as React from \"react\";\n\n/**\n * EXPERIMENTAL\n *\n * A component that serves the same purpose as extractPlasmicQueryData(), but from\n * React server components. This only works from frameworks that support\n * React.useId() and React.use() (like Next.js 13).\n *\n * The children of this component will be run through `extractPlasmicQueryData()`.\n */\nexport function ExtractPlasmicQueryData(props: { children?: React.ReactNode }) {\n const { children } = props;\n if (!(\"useId\" in React) || !(\"use\" in React)) {\n throw new Error(\n `You can only use <ExtractPlasmicQueryData /> from server components.`\n );\n }\n const scriptId = `plasmic-prefetch-${(React as any)[\"\" + \"useId\"]()}`;\n if (typeof window === \"undefined\") {\n const data: Record<string, any> = (React as any)[\"\" + \"use\"](\n extractPlasmicQueryData(<>{children}</>)\n );\n return (\n <>\n <script\n type=\"application/json\"\n dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }}\n data-plasmic-prefetch-id={scriptId}\n suppressHydrationWarning={true}\n />\n </>\n );\n } else {\n return null;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qBAAwC;AACxC,YAAuB;AAWhB,SAAS,wBAAwB,OAAuC;AAC7E,QAAM,EAAE,SAAS,IAAI;AACrB,MAAI,EAAE,WAAW,UAAU,EAAE,SAAS,QAAQ;AAC5C,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,QAAM,WAAW,oBAAmC,eAAc;AAClE,MAAI,OAAO,WAAW,aAAa;AACjC,UAAM,OAA2C;AAAA,UAC/C,wCAAwB,0DAAG,QAAS,CAAG;AAAA,IACzC;AACA,WACE,0DACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,yBAAyB,EAAE,QAAQ,KAAK,UAAU,IAAI,EAAE;AAAA,QACxD,4BAA0B;AAAA,QAC1B,0BAA0B;AAAA;AAAA,IAC5B,CACF;AAAA,EAEJ,OAAO;AACL,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicapp/nextjs-app-router",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^18.2.0",
|
|
71
71
|
"typescript": "^5.2.2"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "0597c84c0fa0df12523bfdbc1ba21ce81d34d63c"
|
|
74
74
|
}
|