@sudajs/cli 0.12.2 → 0.12.4

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.js CHANGED
@@ -579,6 +579,58 @@ export const { createRoot, hydrateRoot, version } = ReactDOMClient;
579
579
  }
580
580
  };
581
581
  }
582
+ function createHostPuckCoreShimPlugin() {
583
+ return {
584
+ name: "suda-host-puck-core-shim",
585
+ setup(build) {
586
+ build.onResolve({ filter: /^@puckeditor\/core$/ }, () => ({
587
+ path: "puck-core-host-shim",
588
+ namespace: "suda-shim"
589
+ }));
590
+ build.onLoad({ filter: /^puck-core-host-shim$/, namespace: "suda-shim" }, () => ({
591
+ loader: "js",
592
+ contents: `
593
+ const PuckCore = globalThis.__SUDA_PUCK_CORE__;
594
+ if (!PuckCore) {
595
+ throw new Error("Missing host Puck core runtime (__SUDA_PUCK_CORE__).");
596
+ }
597
+ export default PuckCore;
598
+ export const {
599
+ Action,
600
+ ActionBar,
601
+ AutoField,
602
+ Button,
603
+ Drawer,
604
+ DropZone,
605
+ FieldLabel,
606
+ Group,
607
+ IconButton,
608
+ Label,
609
+ Puck,
610
+ Render,
611
+ RichTextMenu,
612
+ Separator,
613
+ blocksPlugin,
614
+ createUsePuck,
615
+ fieldsPlugin,
616
+ legacySideBarPlugin,
617
+ migrate,
618
+ outlinePlugin,
619
+ overrideKeys,
620
+ registerOverlayPortal,
621
+ renderContext,
622
+ resolveAllData,
623
+ setDeep,
624
+ transformProps,
625
+ useGetPuck,
626
+ usePuck,
627
+ walkTree,
628
+ } = PuckCore;
629
+ `
630
+ }));
631
+ }
632
+ };
633
+ }
582
634
  function createThemeEngineRuntimeAliasPlugin(root) {
583
635
  return {
584
636
  name: "suda-theme-engine-runtime-alias",
@@ -999,19 +1051,13 @@ async function buildClientRuntime(root, minify) {
999
1051
  const themeVersion = typeof packageJson.version === "string" ? packageJson.version : "0.0.0";
1000
1052
  await mkdir(path2.join(root, "dist"), { recursive: true });
1001
1053
  const hostReactShimPlugin = createHostReactShimPlugin();
1054
+ const hostPuckCoreShimPlugin = createHostPuckCoreShimPlugin();
1002
1055
  const themeEngineRuntimeAliasPlugin = createThemeEngineRuntimeAliasPlugin(root);
1003
1056
  const themeDependencyResolverPlugin = createThemeDependencyResolverPlugin(root);
1004
1057
  await build({
1005
1058
  bundle: true,
1006
1059
  entryPoints: [entryPoint],
1007
- external: [
1008
- "react",
1009
- "react/*",
1010
- "react-dom",
1011
- "react-dom/*",
1012
- "@puckeditor/core",
1013
- "@puckeditor/core/*"
1014
- ],
1060
+ external: ["react", "react/*", "react-dom", "react-dom/*"],
1015
1061
  format: "esm",
1016
1062
  jsx: "automatic",
1017
1063
  minify,
@@ -1020,7 +1066,12 @@ async function buildClientRuntime(root, minify) {
1020
1066
  define: {
1021
1067
  __SUDA_THEME_VERSION__: JSON.stringify(themeVersion)
1022
1068
  },
1023
- plugins: [hostReactShimPlugin, themeEngineRuntimeAliasPlugin, themeDependencyResolverPlugin],
1069
+ plugins: [
1070
+ hostReactShimPlugin,
1071
+ hostPuckCoreShimPlugin,
1072
+ themeEngineRuntimeAliasPlugin,
1073
+ themeDependencyResolverPlugin
1074
+ ],
1024
1075
  sourcemap: false,
1025
1076
  target: "es2022",
1026
1077
  treeShaking: true