hadars 0.1.25 → 0.1.26

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
@@ -1121,12 +1121,11 @@ var buildCompilerConfig = (entry, opts, includeHotPlugin) => {
1121
1121
  // Route all React imports to slim-react for SSR.
1122
1122
  react: slimReactIndex,
1123
1123
  "react/jsx-runtime": slimReactJsx,
1124
- "react/jsx-dev-runtime": slimReactJsx,
1125
- // Keep emotion on the project's node_modules (server-safe entry).
1126
- "@emotion/react": path.resolve(process.cwd(), "node_modules", "@emotion", "react"),
1127
- "@emotion/server": path.resolve(process.cwd(), "node_modules", "@emotion", "server"),
1128
- "@emotion/cache": path.resolve(process.cwd(), "node_modules", "@emotion", "cache"),
1129
- "@emotion/styled": path.resolve(process.cwd(), "node_modules", "@emotion", "styled")
1124
+ "react/jsx-dev-runtime": slimReactJsx
1125
+ // @emotion/* is bundled (not external) so that its `react` imports are
1126
+ // resolved through the alias above to slim-react. If left external,
1127
+ // emotion loads real React from node_modules and calls
1128
+ // ReactSharedInternals.H.useContext which requires React's dispatcher.
1130
1129
  } : void 0;
1131
1130
  const externals = isServerBuild ? [
1132
1131
  // Node.js built-ins — must not be bundled; resolved by the runtime.
@@ -1135,12 +1134,9 @@ var buildCompilerConfig = (entry, opts, includeHotPlugin) => {
1135
1134
  "node:os",
1136
1135
  "node:stream",
1137
1136
  "node:util",
1138
- // react / react-dom are replaced by slim-react via alias above — not external.
1139
- // emotion should be external on server builds to avoid client/browser code
1140
- "@emotion/react",
1141
- "@emotion/server",
1142
- "@emotion/cache",
1143
- "@emotion/styled"
1137
+ // @emotion/server is only used outside component rendering (CSS extraction)
1138
+ // and does not call React hooks, so it is safe to leave as external.
1139
+ "@emotion/server"
1144
1140
  ] : void 0;
1145
1141
  const extraPlugins = [];
1146
1142
  if (opts.define && typeof opts.define === "object") {
@@ -1155,7 +1151,10 @@ var buildCompilerConfig = (entry, opts, includeHotPlugin) => {
1155
1151
  extensions: [".tsx", ".ts", ".js", ".jsx"],
1156
1152
  alias: resolveAliases,
1157
1153
  // for server builds prefer the package "main"/"module" fields and avoid "browser" so we don't pick browser-specific entrypoints
1158
- mainFields: isServerBuild ? ["main", "module"] : ["browser", "module", "main"]
1154
+ mainFields: isServerBuild ? ["main", "module"] : ["browser", "module", "main"],
1155
+ // for server builds exclude the "browser" condition so packages with package.json
1156
+ // "exports" conditions (e.g. @emotion/*) resolve their Node/CJS entry, not the browser build
1157
+ ...isServerBuild ? { conditionNames: ["node", "require", "default"] } : {}
1159
1158
  };
1160
1159
  const optimization = !isServerBuild && !isDev ? {
1161
1160
  moduleIds: "deterministic",
package/dist/ssr-watch.js CHANGED
@@ -171,12 +171,11 @@ var buildCompilerConfig = (entry2, opts, includeHotPlugin) => {
171
171
  // Route all React imports to slim-react for SSR.
172
172
  react: slimReactIndex,
173
173
  "react/jsx-runtime": slimReactJsx,
174
- "react/jsx-dev-runtime": slimReactJsx,
175
- // Keep emotion on the project's node_modules (server-safe entry).
176
- "@emotion/react": path.resolve(process.cwd(), "node_modules", "@emotion", "react"),
177
- "@emotion/server": path.resolve(process.cwd(), "node_modules", "@emotion", "server"),
178
- "@emotion/cache": path.resolve(process.cwd(), "node_modules", "@emotion", "cache"),
179
- "@emotion/styled": path.resolve(process.cwd(), "node_modules", "@emotion", "styled")
174
+ "react/jsx-dev-runtime": slimReactJsx
175
+ // @emotion/* is bundled (not external) so that its `react` imports are
176
+ // resolved through the alias above to slim-react. If left external,
177
+ // emotion loads real React from node_modules and calls
178
+ // ReactSharedInternals.H.useContext which requires React's dispatcher.
180
179
  } : void 0;
181
180
  const externals = isServerBuild ? [
182
181
  // Node.js built-ins — must not be bundled; resolved by the runtime.
@@ -185,12 +184,9 @@ var buildCompilerConfig = (entry2, opts, includeHotPlugin) => {
185
184
  "node:os",
186
185
  "node:stream",
187
186
  "node:util",
188
- // react / react-dom are replaced by slim-react via alias above — not external.
189
- // emotion should be external on server builds to avoid client/browser code
190
- "@emotion/react",
191
- "@emotion/server",
192
- "@emotion/cache",
193
- "@emotion/styled"
187
+ // @emotion/server is only used outside component rendering (CSS extraction)
188
+ // and does not call React hooks, so it is safe to leave as external.
189
+ "@emotion/server"
194
190
  ] : void 0;
195
191
  const extraPlugins = [];
196
192
  if (opts.define && typeof opts.define === "object") {
@@ -205,7 +201,10 @@ var buildCompilerConfig = (entry2, opts, includeHotPlugin) => {
205
201
  extensions: [".tsx", ".ts", ".js", ".jsx"],
206
202
  alias: resolveAliases,
207
203
  // for server builds prefer the package "main"/"module" fields and avoid "browser" so we don't pick browser-specific entrypoints
208
- mainFields: isServerBuild ? ["main", "module"] : ["browser", "module", "main"]
204
+ mainFields: isServerBuild ? ["main", "module"] : ["browser", "module", "main"],
205
+ // for server builds exclude the "browser" condition so packages with package.json
206
+ // "exports" conditions (e.g. @emotion/*) resolve their Node/CJS entry, not the browser build
207
+ ...isServerBuild ? { conditionNames: ["node", "require", "default"] } : {}
209
208
  };
210
209
  const optimization = !isServerBuild && !isDev ? {
211
210
  moduleIds: "deterministic",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hadars",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Minimal SSR framework for React — rspack, HMR, TypeScript, Bun/Node/Deno",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -218,22 +218,18 @@ const buildCompilerConfig = (
218
218
  react: slimReactIndex,
219
219
  'react/jsx-runtime': slimReactJsx,
220
220
  'react/jsx-dev-runtime': slimReactJsx,
221
- // Keep emotion on the project's node_modules (server-safe entry).
222
- '@emotion/react': path.resolve(process.cwd(), 'node_modules', '@emotion', 'react'),
223
- '@emotion/server': path.resolve(process.cwd(), 'node_modules', '@emotion', 'server'),
224
- '@emotion/cache': path.resolve(process.cwd(), 'node_modules', '@emotion', 'cache'),
225
- '@emotion/styled': path.resolve(process.cwd(), 'node_modules', '@emotion', 'styled'),
221
+ // @emotion/* is bundled (not external) so that its `react` imports are
222
+ // resolved through the alias above to slim-react. If left external,
223
+ // emotion loads real React from node_modules and calls
224
+ // ReactSharedInternals.H.useContext which requires React's dispatcher.
226
225
  } : undefined;
227
226
 
228
227
  const externals = isServerBuild ? [
229
228
  // Node.js built-ins — must not be bundled; resolved by the runtime.
230
229
  'node:fs', 'node:path', 'node:os', 'node:stream', 'node:util',
231
- // react / react-dom are replaced by slim-react via alias above — not external.
232
- // emotion should be external on server builds to avoid client/browser code
233
- '@emotion/react',
230
+ // @emotion/server is only used outside component rendering (CSS extraction)
231
+ // and does not call React hooks, so it is safe to leave as external.
234
232
  '@emotion/server',
235
- '@emotion/cache',
236
- '@emotion/styled',
237
233
  ] : undefined;
238
234
 
239
235
  const extraPlugins: any[] = [];
@@ -253,6 +249,9 @@ const buildCompilerConfig = (
253
249
  alias: resolveAliases,
254
250
  // for server builds prefer the package "main"/"module" fields and avoid "browser" so we don't pick browser-specific entrypoints
255
251
  mainFields: isServerBuild ? ['main', 'module'] : ['browser', 'module', 'main'],
252
+ // for server builds exclude the "browser" condition so packages with package.json
253
+ // "exports" conditions (e.g. @emotion/*) resolve their Node/CJS entry, not the browser build
254
+ ...(isServerBuild ? { conditionNames: ['node', 'require', 'default'] } : {}),
256
255
  };
257
256
 
258
257
  // Production client builds get vendor splitting and deterministic module IDs.