@shopify/cli-hydrogen 7.1.0 → 7.1.2
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/commands/hydrogen/build-vite.js +131 -0
- package/dist/commands/hydrogen/build.js +6 -15
- package/dist/commands/hydrogen/check.js +1 -1
- package/dist/commands/hydrogen/codegen.js +3 -3
- package/dist/commands/hydrogen/debug/cpu.js +1 -1
- package/dist/commands/hydrogen/deploy.js +46 -31
- package/dist/commands/hydrogen/deploy.test.js +35 -49
- package/dist/commands/hydrogen/dev-vite.js +159 -0
- package/dist/commands/hydrogen/dev.js +11 -14
- package/dist/commands/hydrogen/env/list.js +1 -1
- package/dist/commands/hydrogen/env/pull.js +3 -3
- package/dist/commands/hydrogen/env/pull.test.js +2 -0
- package/dist/commands/hydrogen/env/push__unstable.js +190 -0
- package/dist/commands/hydrogen/env/push__unstable.test.js +383 -0
- package/dist/commands/hydrogen/generate/route.js +2 -2
- package/dist/commands/hydrogen/init.d.ts +69 -0
- package/dist/commands/hydrogen/init.js +5 -5
- package/dist/commands/hydrogen/init.test.js +2 -2
- package/dist/commands/hydrogen/link.js +2 -2
- package/dist/commands/hydrogen/list.js +1 -1
- package/dist/commands/hydrogen/login.js +2 -9
- package/dist/commands/hydrogen/logout.js +1 -1
- package/dist/commands/hydrogen/preview.js +15 -7
- package/dist/commands/hydrogen/setup/css.js +3 -3
- package/dist/commands/hydrogen/setup/markets.js +4 -4
- package/dist/commands/hydrogen/setup/vite.js +209 -0
- package/dist/commands/hydrogen/setup.js +8 -6
- package/dist/commands/hydrogen/unlink.js +1 -1
- package/dist/commands/hydrogen/upgrade.js +5 -3
- package/dist/generator-templates/assets/vite/package.json +15 -0
- package/dist/generator-templates/assets/vite/vite.config.js +13 -0
- package/dist/generator-templates/starter/CHANGELOG.md +49 -0
- package/dist/generator-templates/starter/app/components/Search.tsx +12 -7
- package/dist/generator-templates/starter/app/root.tsx +1 -2
- package/dist/generator-templates/starter/app/routes/api.predictive-search.tsx +8 -15
- package/dist/generator-templates/starter/package.json +9 -8
- package/dist/generator-templates/starter/public/.gitkeep +0 -0
- package/dist/lib/build.js +2 -1
- package/dist/lib/codegen.js +8 -3
- package/dist/lib/environment-variables.test.js +4 -2
- package/dist/lib/flags.js +149 -95
- package/dist/lib/graphql/admin/pull-variables.js +1 -0
- package/dist/lib/graphql/admin/pull-variables.test.js +7 -1
- package/dist/lib/graphql/admin/push-variables.js +35 -0
- package/dist/lib/log.js +1 -0
- package/dist/lib/mini-oxygen/common.js +2 -1
- package/dist/lib/mini-oxygen/node.js +2 -2
- package/dist/lib/mini-oxygen/workerd-inspector.js +1 -1
- package/dist/lib/mini-oxygen/workerd.js +29 -17
- package/dist/lib/onboarding/common.js +0 -3
- package/dist/lib/onboarding/local.js +4 -1
- package/dist/lib/onboarding/remote.js +16 -11
- package/dist/lib/remix-config.js +1 -1
- package/dist/lib/request-events.js +3 -3
- package/dist/lib/setups/css/assets.js +7 -2
- package/dist/lib/template-diff.js +26 -11
- package/dist/lib/template-downloader.js +11 -2
- package/dist/lib/vite/hydrogen-middleware.js +82 -0
- package/dist/lib/vite/mini-oxygen.js +152 -0
- package/dist/lib/vite/plugins.d.ts +27 -0
- package/dist/lib/vite/plugins.js +139 -0
- package/dist/lib/vite/shared.js +10 -0
- package/dist/lib/vite/utils.js +55 -0
- package/dist/lib/vite/worker-entry.js +1518 -0
- package/dist/lib/vite-config.js +45 -0
- package/dist/virtual-routes/lib/useDebugNetworkServer.jsx +4 -2
- package/dist/virtual-routes/routes/index.jsx +5 -5
- package/dist/virtual-routes/routes/subrequest-profiler.jsx +1 -1
- package/dist/virtual-routes/virtual-root.jsx +1 -1
- package/oclif.manifest.json +1127 -494
- package/package.json +36 -11
- /package/dist/generator-templates/starter/{public → app/assets}/favicon.svg +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { joinPath } from '@shopify/cli-kit/node/path';
|
|
2
|
+
|
|
3
|
+
async function getViteConfig(root) {
|
|
4
|
+
const vite = await import('vite');
|
|
5
|
+
const command = "build";
|
|
6
|
+
const mode = process.env.NODE_ENV || "production";
|
|
7
|
+
const maybeConfig = await vite.loadConfigFromFile(
|
|
8
|
+
{ command, mode, isSsrBuild: true },
|
|
9
|
+
void 0,
|
|
10
|
+
root
|
|
11
|
+
);
|
|
12
|
+
if (!maybeConfig || !maybeConfig.path) {
|
|
13
|
+
throw new Error("No Vite config found");
|
|
14
|
+
}
|
|
15
|
+
const resolvedViteConfig = await vite.resolveConfig(
|
|
16
|
+
{ root, build: { ssr: true } },
|
|
17
|
+
command,
|
|
18
|
+
mode,
|
|
19
|
+
mode
|
|
20
|
+
);
|
|
21
|
+
const serverOutDir = resolvedViteConfig.build.outDir;
|
|
22
|
+
const clientOutDir = serverOutDir.replace(/server$/, "client");
|
|
23
|
+
const rollupOutput = resolvedViteConfig.build.rollupOptions.output;
|
|
24
|
+
const { entryFileNames } = (Array.isArray(rollupOutput) ? rollupOutput[0] : rollupOutput) ?? {};
|
|
25
|
+
const serverOutFile = joinPath(
|
|
26
|
+
serverOutDir,
|
|
27
|
+
typeof entryFileNames === "string" ? entryFileNames : "index.js"
|
|
28
|
+
);
|
|
29
|
+
return {
|
|
30
|
+
clientOutDir,
|
|
31
|
+
serverOutDir,
|
|
32
|
+
serverOutFile,
|
|
33
|
+
resolvedViteConfig,
|
|
34
|
+
userViteConfig: maybeConfig.config,
|
|
35
|
+
remixConfig: getRemixConfigFromVite(resolvedViteConfig)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function getRemixConfigFromVite(viteConfig) {
|
|
39
|
+
const { remixConfig } = viteConfig.__remixPluginContext || {
|
|
40
|
+
remixConfig: { appDirectory: joinPath(viteConfig.root, "app") }
|
|
41
|
+
};
|
|
42
|
+
return remixConfig;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { getViteConfig };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
|
2
2
|
let nextEventId = 0;
|
|
3
|
+
const SUBREQUEST_PROFILER_ENDPOINT = "/debug-network-server";
|
|
3
4
|
const LOCAL_STORAGE_SETTINGS_KEY = "h2-debug-network-settings";
|
|
4
5
|
function getSettings() {
|
|
5
6
|
try {
|
|
@@ -39,7 +40,7 @@ function useDebugNetworkServer() {
|
|
|
39
40
|
}
|
|
40
41
|
}, []);
|
|
41
42
|
function clearServerEvents() {
|
|
42
|
-
fetch(
|
|
43
|
+
fetch(SUBREQUEST_PROFILER_ENDPOINT, { method: "DELETE" }).catch(
|
|
43
44
|
(error) => console.error("Could not clear history:", error)
|
|
44
45
|
);
|
|
45
46
|
serverEvents.current = {
|
|
@@ -62,7 +63,7 @@ function useDebugNetworkServer() {
|
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
65
|
useEffect(() => {
|
|
65
|
-
const evtSource = new EventSource(
|
|
66
|
+
const evtSource = new EventSource(SUBREQUEST_PROFILER_ENDPOINT, {
|
|
66
67
|
withCredentials: true
|
|
67
68
|
});
|
|
68
69
|
const mainRequestHandler = serverEventHandler((data) => {
|
|
@@ -171,6 +172,7 @@ function buildRequestData({
|
|
|
171
172
|
return items;
|
|
172
173
|
}
|
|
173
174
|
export {
|
|
175
|
+
SUBREQUEST_PROFILER_ENDPOINT,
|
|
174
176
|
buildRequestData,
|
|
175
177
|
useDebugNetworkServer
|
|
176
178
|
};
|
|
@@ -66,7 +66,7 @@ function Index() {
|
|
|
66
66
|
"You\u2019re seeing this because you don\u2019t have a home route in your project yet. ",
|
|
67
67
|
/* @__PURE__ */ jsx("br", {}),
|
|
68
68
|
"Run ",
|
|
69
|
-
/* @__PURE__ */ jsx("code", { children: "
|
|
69
|
+
/* @__PURE__ */ jsx("code", { children: "npx shopify hydrogen setup" }),
|
|
70
70
|
" to scaffold standard Shopify routes. Learn more about",
|
|
71
71
|
` `,
|
|
72
72
|
/* @__PURE__ */ jsx(CreateRoutesLink, {})
|
|
@@ -76,11 +76,11 @@ function Index() {
|
|
|
76
76
|
/* @__PURE__ */ jsx("br", {}),
|
|
77
77
|
" To link your store,",
|
|
78
78
|
` `,
|
|
79
|
-
"run
|
|
80
|
-
/* @__PURE__ */ jsx("code", { children: "h2 link && h2 env pull" }),
|
|
81
|
-
". Then, run",
|
|
79
|
+
"run",
|
|
82
80
|
" ",
|
|
83
|
-
/* @__PURE__ */ jsx("code", { children: "
|
|
81
|
+
/* @__PURE__ */ jsx("code", { children: "npx shopify hydrogen link && npx shopify hydrogen env pull" }),
|
|
82
|
+
". Then, run ",
|
|
83
|
+
/* @__PURE__ */ jsx("code", { children: "npx shopify hydrogen setup" }),
|
|
84
84
|
" to scaffold standard Shopify routes.",
|
|
85
85
|
/* @__PURE__ */ jsx("br", {}),
|
|
86
86
|
"Learn more about",
|
|
@@ -6,11 +6,11 @@ import { RequestTable } from "../components/RequestTable.jsx";
|
|
|
6
6
|
import { Link } from "@remix-run/react";
|
|
7
7
|
import favicon from "../assets/favicon.svg";
|
|
8
8
|
import faviconDark from "../assets/favicon-dark.svg";
|
|
9
|
-
import styles from "../assets/debug-network.css";
|
|
10
9
|
import { useDebugNetworkServer } from "../lib/useDebugNetworkServer.jsx";
|
|
11
10
|
import { RequestDetails } from "../components/RequestDetails.jsx";
|
|
12
11
|
import { IconClose } from "../components/IconClose.jsx";
|
|
13
12
|
import { IconDiscard } from "../components/IconDiscard.jsx";
|
|
13
|
+
import styles from "../assets/debug-network.css?url";
|
|
14
14
|
const links = () => {
|
|
15
15
|
return [
|
|
16
16
|
{
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
isRouteErrorResponse,
|
|
9
9
|
useRouteError
|
|
10
10
|
} from "@remix-run/react";
|
|
11
|
-
import styles from "./assets/styles.css";
|
|
12
11
|
import favicon from "./assets/favicon.svg";
|
|
13
12
|
import { Layout } from "./components/Layout.jsx";
|
|
14
13
|
import { useNonce } from "@shopify/hydrogen";
|
|
14
|
+
import styles from "./assets/styles.css?url";
|
|
15
15
|
const links = () => {
|
|
16
16
|
return [
|
|
17
17
|
{ rel: "stylesheet", href: styles },
|