hadars 0.1.21 → 0.1.22

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 CHANGED
@@ -926,7 +926,7 @@ var getConfigBase = (mode) => {
926
926
  react: {
927
927
  runtime: "automatic",
928
928
  development: isDev,
929
- refresh: isDev
929
+ refresh: isDev && !isServerBuild
930
930
  }
931
931
  }
932
932
  }
@@ -957,7 +957,7 @@ var getConfigBase = (mode) => {
957
957
  react: {
958
958
  runtime: "automatic",
959
959
  development: isDev,
960
- refresh: isDev
960
+ refresh: isDev && !isServerBuild
961
961
  }
962
962
  }
963
963
  }
@@ -1022,12 +1022,12 @@ var buildCompilerConfig = (entry, opts, includeHotPlugin) => {
1022
1022
  if (opts.moduleRules && opts.moduleRules.length > 0) {
1023
1023
  localConfig.module.rules.push(...opts.moduleRules);
1024
1024
  }
1025
- const isServerBuild = Boolean(
1025
+ const isServerBuild2 = Boolean(
1026
1026
  opts.output && typeof opts.output === "object" && (opts.output.library || String(opts.output.filename || "").includes("ssr"))
1027
1027
  );
1028
1028
  const slimReactIndex = pathMod.resolve(packageDir, "slim-react", "index.js");
1029
1029
  const slimReactJsx = pathMod.resolve(packageDir, "slim-react", "jsx-runtime.js");
1030
- const resolveAliases = isServerBuild ? {
1030
+ const resolveAliases = isServerBuild2 ? {
1031
1031
  // Route all React imports to slim-react for SSR.
1032
1032
  react: slimReactIndex,
1033
1033
  "react/jsx-runtime": slimReactJsx,
@@ -1038,7 +1038,7 @@ var buildCompilerConfig = (entry, opts, includeHotPlugin) => {
1038
1038
  "@emotion/cache": path.resolve(process.cwd(), "node_modules", "@emotion", "cache"),
1039
1039
  "@emotion/styled": path.resolve(process.cwd(), "node_modules", "@emotion", "styled")
1040
1040
  } : void 0;
1041
- const externals = isServerBuild ? [
1041
+ const externals = isServerBuild2 ? [
1042
1042
  // react / react-dom are replaced by slim-react via alias above — not external.
1043
1043
  // emotion should be external on server builds to avoid client/browser code
1044
1044
  "@emotion/react",
@@ -1059,9 +1059,9 @@ var buildCompilerConfig = (entry, opts, includeHotPlugin) => {
1059
1059
  extensions: [".tsx", ".ts", ".js", ".jsx"],
1060
1060
  alias: resolveAliases,
1061
1061
  // for server builds prefer the package "main"/"module" fields and avoid "browser" so we don't pick browser-specific entrypoints
1062
- mainFields: isServerBuild ? ["main", "module"] : ["browser", "module", "main"]
1062
+ mainFields: isServerBuild2 ? ["main", "module"] : ["browser", "module", "main"]
1063
1063
  };
1064
- const optimization = !isServerBuild && !isDev ? {
1064
+ const optimization = !isServerBuild2 && !isDev ? {
1065
1065
  moduleIds: "deterministic",
1066
1066
  splitChunks: {
1067
1067
  chunks: "all",
@@ -1121,7 +1121,7 @@ var buildCompilerConfig = (entry, opts, includeHotPlugin) => {
1121
1121
  });
1122
1122
  }
1123
1123
  },
1124
- isDev && new ReactRefreshPlugin(),
1124
+ isDev && !isServerBuild2 && new ReactRefreshPlugin(),
1125
1125
  includeHotPlugin && isDev && new rspack.HotModuleReplacementPlugin(),
1126
1126
  ...extraPlugins
1127
1127
  ],
@@ -1137,7 +1137,7 @@ var buildCompilerConfig = (entry, opts, includeHotPlugin) => {
1137
1137
  // for client builds. SSR builds still need it for dynamic import() of exports.
1138
1138
  experiments: {
1139
1139
  ...localConfig.experiments || {},
1140
- outputModule: isServerBuild
1140
+ outputModule: isServerBuild2
1141
1141
  },
1142
1142
  // Prevent rspack from watching its own build output — without this the
1143
1143
  // SSR watcher writing .hadars/index.ssr.js triggers the client compiler
package/dist/ssr-watch.js CHANGED
@@ -66,7 +66,7 @@ var getConfigBase = (mode) => {
66
66
  react: {
67
67
  runtime: "automatic",
68
68
  development: isDev,
69
- refresh: isDev
69
+ refresh: isDev && !isServerBuild
70
70
  }
71
71
  }
72
72
  }
@@ -97,7 +97,7 @@ var getConfigBase = (mode) => {
97
97
  react: {
98
98
  runtime: "automatic",
99
99
  development: isDev,
100
- refresh: isDev
100
+ refresh: isDev && !isServerBuild
101
101
  }
102
102
  }
103
103
  }
@@ -162,12 +162,12 @@ var buildCompilerConfig = (entry2, opts, includeHotPlugin) => {
162
162
  if (opts.moduleRules && opts.moduleRules.length > 0) {
163
163
  localConfig.module.rules.push(...opts.moduleRules);
164
164
  }
165
- const isServerBuild = Boolean(
165
+ const isServerBuild2 = Boolean(
166
166
  opts.output && typeof opts.output === "object" && (opts.output.library || String(opts.output.filename || "").includes("ssr"))
167
167
  );
168
168
  const slimReactIndex = pathMod.resolve(packageDir, "slim-react", "index.js");
169
169
  const slimReactJsx = pathMod.resolve(packageDir, "slim-react", "jsx-runtime.js");
170
- const resolveAliases = isServerBuild ? {
170
+ const resolveAliases = isServerBuild2 ? {
171
171
  // Route all React imports to slim-react for SSR.
172
172
  react: slimReactIndex,
173
173
  "react/jsx-runtime": slimReactJsx,
@@ -178,7 +178,7 @@ var buildCompilerConfig = (entry2, opts, includeHotPlugin) => {
178
178
  "@emotion/cache": path.resolve(process.cwd(), "node_modules", "@emotion", "cache"),
179
179
  "@emotion/styled": path.resolve(process.cwd(), "node_modules", "@emotion", "styled")
180
180
  } : void 0;
181
- const externals = isServerBuild ? [
181
+ const externals = isServerBuild2 ? [
182
182
  // react / react-dom are replaced by slim-react via alias above — not external.
183
183
  // emotion should be external on server builds to avoid client/browser code
184
184
  "@emotion/react",
@@ -199,9 +199,9 @@ var buildCompilerConfig = (entry2, opts, includeHotPlugin) => {
199
199
  extensions: [".tsx", ".ts", ".js", ".jsx"],
200
200
  alias: resolveAliases,
201
201
  // for server builds prefer the package "main"/"module" fields and avoid "browser" so we don't pick browser-specific entrypoints
202
- mainFields: isServerBuild ? ["main", "module"] : ["browser", "module", "main"]
202
+ mainFields: isServerBuild2 ? ["main", "module"] : ["browser", "module", "main"]
203
203
  };
204
- const optimization = !isServerBuild && !isDev ? {
204
+ const optimization = !isServerBuild2 && !isDev ? {
205
205
  moduleIds: "deterministic",
206
206
  splitChunks: {
207
207
  chunks: "all",
@@ -261,7 +261,7 @@ var buildCompilerConfig = (entry2, opts, includeHotPlugin) => {
261
261
  });
262
262
  }
263
263
  },
264
- isDev && new ReactRefreshPlugin(),
264
+ isDev && !isServerBuild2 && new ReactRefreshPlugin(),
265
265
  includeHotPlugin && isDev && new rspack.HotModuleReplacementPlugin(),
266
266
  ...extraPlugins
267
267
  ],
@@ -277,7 +277,7 @@ var buildCompilerConfig = (entry2, opts, includeHotPlugin) => {
277
277
  // for client builds. SSR builds still need it for dynamic import() of exports.
278
278
  experiments: {
279
279
  ...localConfig.experiments || {},
280
- outputModule: isServerBuild
280
+ outputModule: isServerBuild2
281
281
  },
282
282
  // Prevent rspack from watching its own build output — without this the
283
283
  // SSR watcher writing .hadars/index.ssr.js triggers the client compiler
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hadars",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "Minimal SSR framework for React — rspack, HMR, TypeScript, Bun/Node/Deno",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -72,7 +72,7 @@ const getConfigBase = (mode: "development" | "production"): Omit<Configuration,
72
72
  react: {
73
73
  runtime: "automatic",
74
74
  development: isDev,
75
- refresh: isDev,
75
+ refresh: isDev && !isServerBuild,
76
76
  },
77
77
  },
78
78
  },
@@ -103,7 +103,7 @@ const getConfigBase = (mode: "development" | "production"): Omit<Configuration,
103
103
  react: {
104
104
  runtime: "automatic",
105
105
  development: isDev,
106
- refresh: isDev,
106
+ refresh: isDev && !isServerBuild,
107
107
  },
108
108
  },
109
109
  },
@@ -326,7 +326,7 @@ const buildCompilerConfig = (
326
326
  });
327
327
  },
328
328
  },
329
- isDev && new ReactRefreshPlugin(),
329
+ isDev && !isServerBuild && new ReactRefreshPlugin(),
330
330
  includeHotPlugin && isDev && new rspack.HotModuleReplacementPlugin(),
331
331
  ...extraPlugins,
332
332
  ],