Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
39ceebd
fix(html-importer): re-order paste priority to ensure html paste come…
asimkhan73301 May 19, 2025
e6d5c8e
fix: reject CMS requests with negative limit/offset
jaslong May 16, 2025
f5f8102
fix(server-queries): make query name follow javascript rules in codegen
IcaroG May 13, 2025
0d39600
refactor makeSqlCondition
jaslong May 17, 2025
a8a55eb
fix: prevent 500 when $in operand is empty
jaslong May 17, 2025
4a142e3
fix(copy-paste): add variable endpoint for S3 in clip route
IcaroG May 19, 2025
018d298
feat(copy-paste): make clips bucket name depend on env variable for d…
IcaroG May 19, 2025
53639e6
feat: plasmic-cms set min: 0 for limit/offset
jaslong May 16, 2025
0e15bec
Publish
May 20, 2025
1cf3d94
upgrade-internal
May 20, 2025
157d80c
fix: minor bug in getNullUniqueFieldsData
jaslong May 15, 2025
edced9a
feat: add plasmicpkgs-dev
jaslong May 18, 2025
edd5fd1
Publish
May 20, 2025
1700d63
[PLA-12184] upgrade package version to fix svg import issues (#1071)
IcaroG May 20, 2025
9a4f687
add separate @plasmicpkgs/graphql package (#1070)
jaslong May 21, 2025
71b472f
Publish
May 21, 2025
0c99088
Add publishConfig back for fetch and graphql (#1074)
jaslong May 21, 2025
0813846
Publish
May 21, 2025
5971327
upgrade-internal
May 21, 2025
878cd41
[PLA-12118]: Add support for the box shadow in Html Parser (#1061)
asimkhan73301 May 21, 2025
2cabb42
[PLA-12188]: Add existing tokens support Html Parser and UI Copilot F…
asimkhan73301 May 21, 2025
3ee8e2f
[PLA-12100]: Use existing tokens in UI Copilot generated output (#1069)
asimkhan73301 May 21, 2025
9e139e7
chore: skip failing auto-open test
sarahsga May 21, 2025
c0df86a
feat(DataPicker): add expected values for target prop type
IcaroG May 20, 2025
f85fe52
chore: removed unused eventPropNames from triggerCondition in pseudoS…
abbas-nazar May 21, 2025
47c8d3b
upgrade react-aria packages in wab (#1080)
jaslong May 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ storybook-static/
/packages/create-plasmic-app/cpa-out/
/packages/react-web/lib/**
/packages/**/api/
/plasmicpkgs/**/api/
/platform/loader-tests/data/**/*.json
/platform/wab/deps/
/platform/wab/public/static/
Expand Down
3 changes: 2 additions & 1 deletion examples/nextjs-example/app/app/[[...catchall]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ async function fetchData(catchall: string[] | undefined) {
notFound();
}

// Prefetching query data is no longer required, because React Server Components does that for us now!
// Prefetching query data in data-fetching components in app router.
// TODO: Use server functions/queries instead.
const prefetchedQueryData = undefined;

return { prefetchedData, prefetchedQueryData };
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"plasmicpkgs/commerce-providers/*",
"plasmicpkgs/fetch",
"plasmicpkgs/framer-motion",
"plasmicpkgs/graphql",
"plasmicpkgs/keen-slider",
"plasmicpkgs/lottie-react",
"plasmicpkgs/plasmic-basic-components",
Expand Down Expand Up @@ -144,6 +145,7 @@
"plasmicpkgs/react-scroll-parallax",
"plasmicpkgs/react-slick",
"plasmicpkgs/react-twitter-widgets",
"plasmicpkgs/react-youtube"
"plasmicpkgs/react-youtube",
"plasmicpkgs-dev"
]
}
2 changes: 2 additions & 0 deletions plasmicpkgs-dev/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_PROJECT_ID=
NEXT_PUBLIC_PROJECT_TOKEN=
36 changes: 36 additions & 0 deletions plasmicpkgs-dev/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
21 changes: 21 additions & 0 deletions plasmicpkgs-dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# plasmicpkgs-dev

This is app host for testing `@plasmicpkgs/*` packages. This app host uses the `@plasmicapp/loader-nextjs` SDK with app router.

Since `plasmicpkgs-dev` is in the same monorepo as `@plasmicpkgs/*`, it can easily link to their local code under development.

## Setup

Have a test Plasmic project ready.

Create a `.env` file based on [`.env.example`](./.env.example) that stores the test project's ID and token. The app host will load this project's pages.

Check that the package you want to test is registered in [plasmic-init-client.tsx](./plasmic-init-client.tsx). If not, add the dependency in [package.json](./package.json) and add the registration calls.

To build all `@plasmicpkgs/*`, run `yarn lerna run build --scope="@plasmicpkgs/*"`.

## Workflow

1. In `plasmicpkgs-dev`, run `yarn dev`. This should start the app host at `http://localhost:3000`.
2. Set `http://localhost:3000/plasmic-host` as the app host URL in Plasmic Studio.
3. In `@plasmicpkgs/*`, after you make a change, run `yarn build`, then reload Plasmic Studio.
68 changes: 68 additions & 0 deletions plasmicpkgs-dev/app/[[...catchall]]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { PLASMIC } from "@/plasmic-init";
import { PlasmicClientRootProvider } from "@/plasmic-init-client";
import { PlasmicComponent } from "@plasmicapp/loader-nextjs";
import { notFound } from "next/navigation";

export const revalidate = 60;

interface Params {
/**
* Array of path segments (e.g. `["a", "b"]` for "/a/b", or `undefined` if path is empty (i.e. "/").
*
* Note we use `undefined` instead of an empty array `[]` because
* Next.js would convert the empty array to `undefined` (not sure why they do that).
*/
catchall: string[] | undefined;
}

export async function generateStaticParams(): Promise<Params[]> {
const pageModules = await PLASMIC.fetchPages();
return pageModules.map((mod) => {
const catchall =
mod.path === "/" ? undefined : mod.path.substring(1).split("/");
return {
catchall,
};
});
}

export default async function PlasmicLoaderPage({
params,
}: {
params: Promise<Params>;
}) {
const { prefetchedData, prefetchedQueryData } = await fetchData(
(
await params
).catchall
);
const pageMeta = prefetchedData.entryCompMetas[0];
return (
<PlasmicClientRootProvider
prefetchedData={prefetchedData}
prefetchedQueryData={prefetchedQueryData}
pageParams={pageMeta.params}
>
<PlasmicComponent component={pageMeta.displayName} />
</PlasmicClientRootProvider>
);
}

async function fetchData(catchall: string[] | undefined) {
const pagePath = catchall ? `/${catchall.join("/")}` : "/";
const prefetchedData = await PLASMIC.maybeFetchComponentData(pagePath);
if (!prefetchedData) {
notFound();
}

const prefetchedQueryData = await PLASMIC.unstable__getServerQueriesData(
prefetchedData,
{
pagePath,
params: prefetchedData.entryCompMetas[0].params,
query: {},
}
);

return { prefetchedData, prefetchedQueryData };
}
11 changes: 11 additions & 0 deletions plasmicpkgs-dev/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}

export const metadata = {
title: "plasmicpkgs dev host",
};
6 changes: 6 additions & 0 deletions plasmicpkgs-dev/app/plasmic-host/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import "@/plasmic-init-client";
import { PlasmicCanvasHost } from "@plasmicapp/loader-nextjs";

export default function PlasmicHost() {
return <PlasmicCanvasHost />;
}
6 changes: 6 additions & 0 deletions plasmicpkgs-dev/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
};

module.exports = nextConfig;
25 changes: 25 additions & 0 deletions plasmicpkgs-dev/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "plasmicpkgs-dev",
"version": "0.0.4",
"private": true,
"scripts": {
"dev": "next dev",
"dev-inspect": "NODE_OPTIONS='--inspect' next dev"
},
"dependencies": {
"@plasmicapp/loader-nextjs": "^1",
"@plasmicpkgs/commerce": "*",
"@plasmicpkgs/commerce-shopify": "*",
"@plasmicpkgs/fetch": "0.0.7",
"@plasmicpkgs/graphql": "0.0.1",
"@plasmicpkgs/plasmic-cms": "*",
"next": "^15",
"react": "^19",
"react-dom": "^19"
},
"devDependencies": {
"@types/node": "^22",
"@types/react": "^19",
"@types/react-dom": "^19"
}
}
78 changes: 78 additions & 0 deletions plasmicpkgs-dev/plasmic-init-client.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
"use client";

import { PLASMIC } from "@/plasmic-init";
import { registerWithDevMeta } from "@/plasmic-register-dev-meta";
import { PlasmicRootProvider } from "@plasmicapp/loader-nextjs";
import { registerAll as registerCommerce } from "@plasmicpkgs/commerce";
import { registerAll as registerShopify } from "@plasmicpkgs/commerce-shopify";
import { registerFetch } from "@plasmicpkgs/fetch";
import { registerGraphQL } from "@plasmicpkgs/graphql";
import { registerAll as registerCms } from "@plasmicpkgs/plasmic-cms";
import React from "react";

function register() {
registerFetch(PLASMIC);
registerGraphQL(PLASMIC);
registerCms(PLASMIC);
registerCommerce(PLASMIC);
registerShopify(PLASMIC);
}

const useDevNames = true; // set true to avoid conflicting with production hostless names
if (useDevNames) {
registerWithDevMeta(PLASMIC, register);
} else {
register();
}

/**
* PlasmicClientRootProvider is a Client Component that passes in the loader for you.
*
* Why? Props passed from Server to Client Components must be serializable.
* https://beta.nextjs.org/docs/rendering/server-and-client-components#passing-props-from-server-to-client-components-serialization
* However, PlasmicRootProvider requires a loader, but the loader is NOT serializable.
*
* In a Server Component like app/<your-path>/path.tsx, rendering the following would not work:
*
* ```tsx
* import { PLASMIC } from "@/plasmic-init";
* import { PlasmicRootProvider } from "plasmicapp/loader-nextjs";
* export default function MyPage() {
* const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
* return (
* <PlasmicRootProvider
* loader={PLASMIC} // ERROR: loader is not serializable
* prefetchedData={prefetchedData}
* >
* {yourContent()}
* </PlasmicRootProvider>;
* );
* }
* ```
*
* Therefore, we define PlasmicClientRootProvider as a Client Component (this file is marked "use client").
* PlasmicClientRootProvider wraps the PlasmicRootProvider and passes in the loader for you,
* while allowing your Server Component to pass in prefetched data and other serializable props:
*
* ```tsx
* import { PLASMIC } from "@/plasmic-init";
* import { PlasmicClientRootProvider } from "@/plasmic-init-client"; // changed
* export default function MyPage() {
* const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
* return (
* <PlasmicClientRootProvider // don't pass in loader
* prefetchedData={prefetchedData}
* >
* {yourContent()}
* </PlasmicClientRootProvider>;
* );
* }
* ```
*/
export function PlasmicClientRootProvider(
props: Omit<React.ComponentProps<typeof PlasmicRootProvider>, "loader">
) {
return (
<PlasmicRootProvider loader={PLASMIC} {...props}></PlasmicRootProvider>
);
}
25 changes: 25 additions & 0 deletions plasmicpkgs-dev/plasmic-init.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { initPlasmicLoader } from "@plasmicapp/loader-nextjs/react-server-conditional";
import * as NextNavigation from "next/navigation";

const projectId = process.env.NEXT_PUBLIC_PROJECT_ID;
const projectToken = process.env.NEXT_PUBLIC_PROJECT_TOKEN;

if (!projectId || !projectToken) {
throw new Error("Please set PROJECT_ID and PROJECT_TOKEN in .env");
}

export const PLASMIC = initPlasmicLoader({
nextNavigation: NextNavigation,
projects: [
{
id: projectId,
token: projectToken,
},
],

// By default Plasmic will use the last published version of your project.
// For development, you can set preview to true, which will use the unpublished
// project, allowing you to see your designs without publishing. Please
// only use this for development, as this is significantly slower.
preview: true,
});
Loading