@greatstore/cli 0.0.4 → 0.0.6
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/cli.js +23 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -743,18 +743,21 @@ function viteConfig() {
|
|
|
743
743
|
return `import { defineConfig } from "vite";
|
|
744
744
|
import react from "@vitejs/plugin-react";
|
|
745
745
|
|
|
746
|
-
// Builds a single
|
|
747
|
-
//
|
|
748
|
-
//
|
|
749
|
-
//
|
|
750
|
-
//
|
|
751
|
-
//
|
|
752
|
-
//
|
|
746
|
+
// Builds a single ESM bundle suitable for \`gs push\`.
|
|
747
|
+
//
|
|
748
|
+
// React / react-dom / react/jsx-runtime are EXTERNALIZED and rewritten
|
|
749
|
+
// at build time to point at GreatStore's runtime shim at
|
|
750
|
+
// \`/assets/remote-components/_runtime.js\`. The shim re-exports the host
|
|
751
|
+
// chat tree's React instance off \`window.__GS_REMOTE_RUNTIME__\`, so
|
|
752
|
+
// the component and the host share one React. Bundling React in
|
|
753
|
+
// instead would crash on the first hook call because the bundled-in
|
|
754
|
+
// React's dispatcher is null when the chat tree drives the render.
|
|
755
|
+
//
|
|
756
|
+
// Do NOT remove the \`paths\` mapping \u2014 without it the browser tries to
|
|
757
|
+
// resolve a bare \`react\` specifier and fails before the component
|
|
758
|
+
// renders.
|
|
753
759
|
export default defineConfig({
|
|
754
760
|
plugins: [react()],
|
|
755
|
-
define: {
|
|
756
|
-
"process.env.NODE_ENV": JSON.stringify("production"),
|
|
757
|
-
},
|
|
758
761
|
build: {
|
|
759
762
|
lib: {
|
|
760
763
|
entry: "component.tsx",
|
|
@@ -764,7 +767,15 @@ export default defineConfig({
|
|
|
764
767
|
outDir: ".",
|
|
765
768
|
emptyOutDir: false,
|
|
766
769
|
rollupOptions: {
|
|
767
|
-
|
|
770
|
+
external: ["react", "react-dom", "react/jsx-runtime"],
|
|
771
|
+
output: {
|
|
772
|
+
entryFileNames: "bundle.js",
|
|
773
|
+
paths: {
|
|
774
|
+
react: "/assets/remote-components/_runtime.js",
|
|
775
|
+
"react-dom": "/assets/remote-components/_runtime.js",
|
|
776
|
+
"react/jsx-runtime": "/assets/remote-components/_runtime.js",
|
|
777
|
+
},
|
|
778
|
+
},
|
|
768
779
|
},
|
|
769
780
|
minify: true,
|
|
770
781
|
sourcemap: false,
|
|
@@ -847,7 +858,7 @@ function pascal(name) {
|
|
|
847
858
|
}
|
|
848
859
|
|
|
849
860
|
// src/index.ts
|
|
850
|
-
var VERSION = "0.0.
|
|
861
|
+
var VERSION = true ? "0.0.6" : "0.0.0-dev";
|
|
851
862
|
var HELP = `gs \u2014 GreatStore CLI (v${VERSION})
|
|
852
863
|
|
|
853
864
|
Usage:
|