@shopify/cli-hydrogen 11.0.1 → 11.1.0
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/assets/hydrogen/starter/CHANGELOG.md +6 -0
- package/dist/assets/hydrogen/starter/package.json +1 -1
- package/dist/assets/hydrogen/starter/vite.config.ts +1 -1
- package/dist/lib/route-validator.js +1 -1
- package/dist/lib/vite-config.js +21 -4
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { renderWarning, renderSuccess } from '@shopify/cli-kit/node/ui';
|
|
2
2
|
|
|
3
|
-
const RESERVED_ROUTES = ["^
|
|
3
|
+
const RESERVED_ROUTES = ["^cdn/", "^_t/"];
|
|
4
4
|
function findReservedRoutes(config) {
|
|
5
5
|
const routes = /* @__PURE__ */ new Set();
|
|
6
6
|
Object.values(config.routes).filter(
|
package/dist/lib/vite-config.js
CHANGED
|
@@ -37,7 +37,7 @@ async function getViteConfig(root, ssrEntryFlag) {
|
|
|
37
37
|
mode,
|
|
38
38
|
mode
|
|
39
39
|
);
|
|
40
|
-
const { appDirectory, serverBuildFile, routes } =
|
|
40
|
+
const { appDirectory, serverBuildFile, routes } = getReactRouterOrRemixConfigFromVite(resolvedViteConfig);
|
|
41
41
|
const serverOutDir = resolvedViteConfig.build.outDir;
|
|
42
42
|
const clientOutDir = serverOutDir.replace(/server$/, "client");
|
|
43
43
|
const rollupOutput = resolvedViteConfig.build.rollupOptions.output;
|
|
@@ -58,8 +58,8 @@ async function getViteConfig(root, ssrEntryFlag) {
|
|
|
58
58
|
resolvedViteConfig,
|
|
59
59
|
userViteConfig: maybeConfig.config,
|
|
60
60
|
remixConfig: {
|
|
61
|
-
routes,
|
|
62
|
-
appDirectory,
|
|
61
|
+
routes: routes ?? {},
|
|
62
|
+
appDirectory: appDirectory ?? joinPath(resolvedViteConfig.root, "app"),
|
|
63
63
|
rootDirectory: resolvedViteConfig.root,
|
|
64
64
|
serverEntryPoint: (await findFileWithExtension(
|
|
65
65
|
dirname(resolvedSsrEntry),
|
|
@@ -68,7 +68,16 @@ async function getViteConfig(root, ssrEntryFlag) {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function getReactRouterOrRemixConfigFromVite(viteConfig) {
|
|
72
|
+
try {
|
|
73
|
+
const reactRouterConfig = getReactRouterConfigFromVite(viteConfig);
|
|
74
|
+
return reactRouterConfig;
|
|
75
|
+
} catch (error) {
|
|
76
|
+
const remixConfig = getRemixConfigFromVite(viteConfig);
|
|
77
|
+
return remixConfig;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function getReactRouterConfigFromVite(viteConfig) {
|
|
72
81
|
if (!viteConfig.__reactRouterPluginContext) {
|
|
73
82
|
throw new Error("Could not resolve React Router config");
|
|
74
83
|
}
|
|
@@ -79,6 +88,14 @@ function getRemixConfigFromVite(viteConfig) {
|
|
|
79
88
|
routes
|
|
80
89
|
};
|
|
81
90
|
}
|
|
91
|
+
function getRemixConfigFromVite(viteConfig) {
|
|
92
|
+
const { remixConfig } = findHydrogenPlugin(viteConfig)?.api?.getPluginOptions() ?? {};
|
|
93
|
+
return remixConfig ? {
|
|
94
|
+
appDirectory: remixConfig.appDirectory,
|
|
95
|
+
serverBuildFile: remixConfig.serverBuildFile,
|
|
96
|
+
routes: remixConfig.routes
|
|
97
|
+
} : {};
|
|
98
|
+
}
|
|
82
99
|
function findPlugin(config, name) {
|
|
83
100
|
return config.plugins.find((plugin) => plugin.name === name);
|
|
84
101
|
}
|
package/oclif.manifest.json
CHANGED