hadars 0.4.3-rc.2 → 0.4.3-rc.4

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  renderPreflight,
3
3
  renderToString
4
- } from "./chunk-FZOSW2PU.js";
4
+ } from "./chunk-QOTDCUE5.js";
5
5
  import {
6
6
  createElement
7
7
  } from "./chunk-OZUZS2PD.js";
@@ -6,12 +6,8 @@ import {
6
6
  SUSPENSE_TYPE,
7
7
  createElement
8
8
  } from "./chunk-OZUZS2PD.js";
9
- import {
10
- __require
11
- } from "./chunk-3RG5ZIWI.js";
12
9
 
13
10
  // src/slim-react/renderContext.ts
14
- import { createRequire as _nodeCreateRequire } from "module";
15
11
  var MAP_KEY = "__slimReactContextMap";
16
12
  var _g = globalThis;
17
13
  if (!("__slimReactContextMap" in _g)) _g[MAP_KEY] = null;
@@ -146,31 +142,12 @@ function getTreeId() {
146
142
  const stripped = (id & ~(1 << 31 - Math.clz32(id))).toString(32);
147
143
  return stripped + overflow;
148
144
  }
149
- var _detectReact = () => {
150
- if (typeof __HADARS_REACT_MAJOR__ !== "undefined") {
151
- const major = parseInt(String(__HADARS_REACT_MAJOR__), 10);
152
- return {
153
- major,
154
- // Exact patch version is unknown from the define alone; use a
155
- // representative fallback. Most libraries only check the major.
156
- version: major < 19 ? "18.3.1" : "19.1.1"
157
- };
158
- }
159
- const parse = (ver) => ({ major: parseInt(ver.split(".")[0], 10), version: ver });
160
- try {
161
- return parse(__require("react").version);
162
- } catch {
163
- }
164
- try {
165
- const req = _nodeCreateRequire(process.cwd() + "/__hadars__.js");
166
- return parse(req("react").version);
167
- } catch {
168
- }
169
- return { major: 19, version: "19.1.1" };
170
- };
171
- var _react = _detectReact();
172
- var REACT_MAJOR = _react.major;
173
- var REACT_VERSION = _react.version;
145
+ var REACT_MAJOR = typeof __HADARS_REACT_MAJOR__ !== "undefined" ? parseInt(String(__HADARS_REACT_MAJOR__), 10) : 19;
146
+ var REACT_VERSION = REACT_MAJOR < 19 ? "18.3.1" : "19.1.1";
147
+ function setReactVersion(major, version2) {
148
+ REACT_MAJOR = major;
149
+ REACT_VERSION = version2 ?? (major < 19 ? "18.3.1" : "19.1.1");
150
+ }
174
151
  function makeId() {
175
152
  const st = s();
176
153
  const treeId = getTreeId();
@@ -1240,6 +1217,7 @@ var React = {
1240
1217
  var slim_react_default = React;
1241
1218
 
1242
1219
  export {
1220
+ setReactVersion,
1243
1221
  useState,
1244
1222
  useReducer,
1245
1223
  useEffect,
package/dist/cli.js CHANGED
@@ -148,7 +148,6 @@ var REACT19_ELEMENT = Symbol.for("react.transitional.element");
148
148
  var FRAGMENT_TYPE = Symbol.for("react.fragment");
149
149
  var SUSPENSE_TYPE = Symbol.for("react.suspense");
150
150
  // src/slim-react/renderContext.ts
151
- import { createRequire as _nodeCreateRequire } from "node:module";
152
151
  var MAP_KEY = "__slimReactContextMap";
153
152
  var _g = globalThis;
154
153
  if (!("__slimReactContextMap" in _g))
@@ -285,27 +284,8 @@ function getTreeId() {
285
284
  const stripped = (id & ~(1 << 31 - Math.clz32(id))).toString(32);
286
285
  return stripped + overflow;
287
286
  }
288
- var _detectReact = () => {
289
- if (typeof __HADARS_REACT_MAJOR__ !== "undefined") {
290
- const major = parseInt(String(__HADARS_REACT_MAJOR__), 10);
291
- return {
292
- major,
293
- version: major < 19 ? "18.3.1" : "19.1.1"
294
- };
295
- }
296
- const parse = (ver) => ({ major: parseInt(ver.split(".")[0], 10), version: ver });
297
- try {
298
- return parse(__require("react").version);
299
- } catch {}
300
- try {
301
- const req = _nodeCreateRequire(process.cwd() + "/__hadars__.js");
302
- return parse(req("react").version);
303
- } catch {}
304
- return { major: 19, version: "19.1.1" };
305
- };
306
- var _react = _detectReact();
307
- var REACT_MAJOR = _react.major;
308
- var REACT_VERSION = _react.version;
287
+ var REACT_MAJOR = typeof __HADARS_REACT_MAJOR__ !== "undefined" ? parseInt(String(__HADARS_REACT_MAJOR__), 10) : 19;
288
+ var REACT_VERSION = REACT_MAJOR < 19 ? "18.3.1" : "19.1.1";
309
289
  function makeId() {
310
290
  const st = s();
311
291
  const treeId = getTreeId();
@@ -158,7 +158,6 @@ var FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
158
158
  var SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
159
159
 
160
160
  // src/slim-react/renderContext.ts
161
- var import_node_module = require("module");
162
161
  var MAP_KEY = "__slimReactContextMap";
163
162
  var _g = globalThis;
164
163
  if (!("__slimReactContextMap" in _g)) _g[MAP_KEY] = null;
@@ -293,31 +292,8 @@ function getTreeId() {
293
292
  const stripped = (id & ~(1 << 31 - Math.clz32(id))).toString(32);
294
293
  return stripped + overflow;
295
294
  }
296
- var _detectReact = () => {
297
- if (typeof __HADARS_REACT_MAJOR__ !== "undefined") {
298
- const major = parseInt(String(__HADARS_REACT_MAJOR__), 10);
299
- return {
300
- major,
301
- // Exact patch version is unknown from the define alone; use a
302
- // representative fallback. Most libraries only check the major.
303
- version: major < 19 ? "18.3.1" : "19.1.1"
304
- };
305
- }
306
- const parse = (ver) => ({ major: parseInt(ver.split(".")[0], 10), version: ver });
307
- try {
308
- return parse(require("react").version);
309
- } catch {
310
- }
311
- try {
312
- const req = (0, import_node_module.createRequire)(process.cwd() + "/__hadars__.js");
313
- return parse(req("react").version);
314
- } catch {
315
- }
316
- return { major: 19, version: "19.1.1" };
317
- };
318
- var _react = _detectReact();
319
- var REACT_MAJOR = _react.major;
320
- var REACT_VERSION = _react.version;
295
+ var REACT_MAJOR = typeof __HADARS_REACT_MAJOR__ !== "undefined" ? parseInt(String(__HADARS_REACT_MAJOR__), 10) : 19;
296
+ var REACT_VERSION = REACT_MAJOR < 19 ? "18.3.1" : "19.1.1";
321
297
  function makeId() {
322
298
  const st = s();
323
299
  const treeId = getTreeId();
@@ -6,10 +6,9 @@ import {
6
6
  getReactResponse,
7
7
  makePrecontentHtmlGetter,
8
8
  parseRequest
9
- } from "./chunk-W5ZSLBP3.js";
10
- import "./chunk-FZOSW2PU.js";
9
+ } from "./chunk-LDVJ26Q3.js";
10
+ import "./chunk-QOTDCUE5.js";
11
11
  import "./chunk-OZUZS2PD.js";
12
- import "./chunk-3RG5ZIWI.js";
13
12
 
14
13
  // src/cloudflare.ts
15
14
  import "react";
package/dist/index.js CHANGED
@@ -1,5 +1,3 @@
1
- import "./chunk-3RG5ZIWI.js";
2
-
3
1
  // src/utils/Head.tsx
4
2
  import React from "react";
5
3
  function deriveKey(tag, props) {
package/dist/lambda.cjs CHANGED
@@ -198,7 +198,6 @@ var FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
198
198
  var SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
199
199
 
200
200
  // src/slim-react/renderContext.ts
201
- var import_node_module = require("module");
202
201
  var MAP_KEY = "__slimReactContextMap";
203
202
  var _g = globalThis;
204
203
  if (!("__slimReactContextMap" in _g)) _g[MAP_KEY] = null;
@@ -333,31 +332,8 @@ function getTreeId() {
333
332
  const stripped = (id & ~(1 << 31 - Math.clz32(id))).toString(32);
334
333
  return stripped + overflow;
335
334
  }
336
- var _detectReact = () => {
337
- if (typeof __HADARS_REACT_MAJOR__ !== "undefined") {
338
- const major = parseInt(String(__HADARS_REACT_MAJOR__), 10);
339
- return {
340
- major,
341
- // Exact patch version is unknown from the define alone; use a
342
- // representative fallback. Most libraries only check the major.
343
- version: major < 19 ? "18.3.1" : "19.1.1"
344
- };
345
- }
346
- const parse = (ver) => ({ major: parseInt(ver.split(".")[0], 10), version: ver });
347
- try {
348
- return parse(require("react").version);
349
- } catch {
350
- }
351
- try {
352
- const req = (0, import_node_module.createRequire)(process.cwd() + "/__hadars__.js");
353
- return parse(req("react").version);
354
- } catch {
355
- }
356
- return { major: 19, version: "19.1.1" };
357
- };
358
- var _react = _detectReact();
359
- var REACT_MAJOR = _react.major;
360
- var REACT_VERSION = _react.version;
335
+ var REACT_MAJOR = typeof __HADARS_REACT_MAJOR__ !== "undefined" ? parseInt(String(__HADARS_REACT_MAJOR__), 10) : 19;
336
+ var REACT_VERSION = REACT_MAJOR < 19 ? "18.3.1" : "19.1.1";
361
337
  function makeId() {
362
338
  const st = s();
363
339
  const treeId = getTreeId();
package/dist/lambda.js CHANGED
@@ -6,10 +6,9 @@ import {
6
6
  getReactResponse,
7
7
  makePrecontentHtmlGetter,
8
8
  parseRequest
9
- } from "./chunk-W5ZSLBP3.js";
10
- import "./chunk-FZOSW2PU.js";
9
+ } from "./chunk-LDVJ26Q3.js";
10
+ import "./chunk-QOTDCUE5.js";
11
11
  import "./chunk-OZUZS2PD.js";
12
- import "./chunk-3RG5ZIWI.js";
13
12
 
14
13
  // src/lambda.ts
15
14
  import "react";
@@ -54,6 +54,7 @@ __export(slim_react_exports, {
54
54
  renderToReadableStream: () => renderToStream,
55
55
  renderToStream: () => renderToStream,
56
56
  renderToString: () => renderToString,
57
+ setReactVersion: () => setReactVersion,
57
58
  startTransition: () => startTransition,
58
59
  use: () => use,
59
60
  useActionState: () => useActionState,
@@ -85,7 +86,6 @@ var FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
85
86
  var SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
86
87
 
87
88
  // src/slim-react/renderContext.ts
88
- var import_node_module = require("module");
89
89
  var MAP_KEY = "__slimReactContextMap";
90
90
  var _g = globalThis;
91
91
  if (!("__slimReactContextMap" in _g)) _g[MAP_KEY] = null;
@@ -220,31 +220,12 @@ function getTreeId() {
220
220
  const stripped = (id & ~(1 << 31 - Math.clz32(id))).toString(32);
221
221
  return stripped + overflow;
222
222
  }
223
- var _detectReact = () => {
224
- if (typeof __HADARS_REACT_MAJOR__ !== "undefined") {
225
- const major = parseInt(String(__HADARS_REACT_MAJOR__), 10);
226
- return {
227
- major,
228
- // Exact patch version is unknown from the define alone; use a
229
- // representative fallback. Most libraries only check the major.
230
- version: major < 19 ? "18.3.1" : "19.1.1"
231
- };
232
- }
233
- const parse = (ver) => ({ major: parseInt(ver.split(".")[0], 10), version: ver });
234
- try {
235
- return parse(require("react").version);
236
- } catch {
237
- }
238
- try {
239
- const req = (0, import_node_module.createRequire)(process.cwd() + "/__hadars__.js");
240
- return parse(req("react").version);
241
- } catch {
242
- }
243
- return { major: 19, version: "19.1.1" };
244
- };
245
- var _react = _detectReact();
246
- var REACT_MAJOR = _react.major;
247
- var REACT_VERSION = _react.version;
223
+ var REACT_MAJOR = typeof __HADARS_REACT_MAJOR__ !== "undefined" ? parseInt(String(__HADARS_REACT_MAJOR__), 10) : 19;
224
+ var REACT_VERSION = REACT_MAJOR < 19 ? "18.3.1" : "19.1.1";
225
+ function setReactVersion(major, version2) {
226
+ REACT_MAJOR = major;
227
+ REACT_VERSION = version2 ?? (major < 19 ? "18.3.1" : "19.1.1");
228
+ }
248
229
  function makeId() {
249
230
  const st = s();
250
231
  const treeId = getTreeId();
@@ -1364,6 +1345,7 @@ var slim_react_default = React;
1364
1345
  renderToReadableStream,
1365
1346
  renderToStream,
1366
1347
  renderToString,
1348
+ setReactVersion,
1367
1349
  startTransition,
1368
1350
  use,
1369
1351
  useActionState,
@@ -1,6 +1,8 @@
1
1
  import { S as SlimNode, a as SlimElement, c as createElement } from '../jsx-runtime-BOYrELJb.cjs';
2
2
  export { C as ComponentFunction, F as FRAGMENT_TYPE, b as Fragment, d as SLIM_ELEMENT, e as SUSPENSE_TYPE, j as jsx, j as jsxDEV, j as jsxs } from '../jsx-runtime-BOYrELJb.cjs';
3
3
 
4
+ declare function setReactVersion(major: number, version?: string): void;
5
+
4
6
  /**
5
7
  * SSR hook implementations.
6
8
  *
@@ -225,4 +227,4 @@ declare const React: {
225
227
  };
226
228
  };
227
229
 
228
- export { Children, Component, type Context, PureComponent, type RenderOptions, SlimElement, SlimNode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, React as default, forwardRef, isValidElement, lazy, memo, renderPreflight, renderToStream as renderToReadableStream, renderToStream, renderToString, startTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, version };
230
+ export { Children, Component, type Context, PureComponent, type RenderOptions, SlimElement, SlimNode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, React as default, forwardRef, isValidElement, lazy, memo, renderPreflight, renderToStream as renderToReadableStream, renderToStream, renderToString, setReactVersion, startTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, version };
@@ -1,6 +1,8 @@
1
1
  import { S as SlimNode, a as SlimElement, c as createElement } from '../jsx-runtime-BOYrELJb.js';
2
2
  export { C as ComponentFunction, F as FRAGMENT_TYPE, b as Fragment, d as SLIM_ELEMENT, e as SUSPENSE_TYPE, j as jsx, j as jsxDEV, j as jsxs } from '../jsx-runtime-BOYrELJb.js';
3
3
 
4
+ declare function setReactVersion(major: number, version?: string): void;
5
+
4
6
  /**
5
7
  * SSR hook implementations.
6
8
  *
@@ -225,4 +227,4 @@ declare const React: {
225
227
  };
226
228
  };
227
229
 
228
- export { Children, Component, type Context, PureComponent, type RenderOptions, SlimElement, SlimNode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, React as default, forwardRef, isValidElement, lazy, memo, renderPreflight, renderToStream as renderToReadableStream, renderToStream, renderToString, startTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, version };
230
+ export { Children, Component, type Context, PureComponent, type RenderOptions, SlimElement, SlimNode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, React as default, forwardRef, isValidElement, lazy, memo, renderPreflight, renderToStream as renderToReadableStream, renderToStream, renderToString, setReactVersion, startTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, version };
@@ -13,6 +13,7 @@ import {
13
13
  renderPreflight,
14
14
  renderToStream,
15
15
  renderToString,
16
+ setReactVersion,
16
17
  slim_react_default,
17
18
  startTransition,
18
19
  use,
@@ -35,7 +36,7 @@ import {
35
36
  useSyncExternalStore,
36
37
  useTransition,
37
38
  version
38
- } from "../chunk-FZOSW2PU.js";
39
+ } from "../chunk-QOTDCUE5.js";
39
40
  import {
40
41
  FRAGMENT_TYPE,
41
42
  Fragment,
@@ -44,7 +45,6 @@ import {
44
45
  createElement,
45
46
  jsx
46
47
  } from "../chunk-OZUZS2PD.js";
47
- import "../chunk-3RG5ZIWI.js";
48
48
  export {
49
49
  Children,
50
50
  Component,
@@ -70,6 +70,7 @@ export {
70
70
  renderToStream as renderToReadableStream,
71
71
  renderToStream,
72
72
  renderToString,
73
+ setReactVersion,
73
74
  startTransition,
74
75
  use,
75
76
  useActionState,
@@ -2,7 +2,6 @@ import {
2
2
  Fragment,
3
3
  jsx
4
4
  } from "../chunk-OZUZS2PD.js";
5
- import "../chunk-3RG5ZIWI.js";
6
5
  export {
7
6
  Fragment,
8
7
  jsx,
@@ -1,6 +1,3 @@
1
- import { createRequire } from "node:module";
2
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
-
4
1
  // src/ssr-render-worker.ts
5
2
  import { workerData, parentPort } from "node:worker_threads";
6
3
  import { pathToFileURL } from "node:url";
@@ -11,7 +8,6 @@ var REACT19_ELEMENT = Symbol.for("react.transitional.element");
11
8
  var FRAGMENT_TYPE = Symbol.for("react.fragment");
12
9
  var SUSPENSE_TYPE = Symbol.for("react.suspense");
13
10
  // src/slim-react/renderContext.ts
14
- import { createRequire as _nodeCreateRequire } from "node:module";
15
11
  var MAP_KEY = "__slimReactContextMap";
16
12
  var _g = globalThis;
17
13
  if (!("__slimReactContextMap" in _g))
@@ -148,27 +144,8 @@ function getTreeId() {
148
144
  const stripped = (id & ~(1 << 31 - Math.clz32(id))).toString(32);
149
145
  return stripped + overflow;
150
146
  }
151
- var _detectReact = () => {
152
- if (typeof __HADARS_REACT_MAJOR__ !== "undefined") {
153
- const major = parseInt(String(__HADARS_REACT_MAJOR__), 10);
154
- return {
155
- major,
156
- version: major < 19 ? "18.3.1" : "19.1.1"
157
- };
158
- }
159
- const parse = (ver) => ({ major: parseInt(ver.split(".")[0], 10), version: ver });
160
- try {
161
- return parse(__require("react").version);
162
- } catch {}
163
- try {
164
- const req = _nodeCreateRequire(process.cwd() + "/__hadars__.js");
165
- return parse(req("react").version);
166
- } catch {}
167
- return { major: 19, version: "19.1.1" };
168
- };
169
- var _react = _detectReact();
170
- var REACT_MAJOR = _react.major;
171
- var REACT_VERSION = _react.version;
147
+ var REACT_MAJOR = typeof __HADARS_REACT_MAJOR__ !== "undefined" ? parseInt(String(__HADARS_REACT_MAJOR__), 10) : 19;
148
+ var REACT_VERSION = REACT_MAJOR < 19 ? "18.3.1" : "19.1.1";
172
149
  function makeId() {
173
150
  const st = s();
174
151
  const treeId = getTreeId();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hadars",
3
- "version": "0.4.3-rc.2",
3
+ "version": "0.4.3-rc.4",
4
4
  "description": "Minimal SSR framework for React — rspack, HMR, TypeScript, Bun/Node/Deno",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -1,10 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- export {
9
- __require
10
- };