@erikey/react 0.2.6 → 0.2.8

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.
@@ -0,0 +1,57 @@
1
+ if (typeof globalThis.require === "undefined") {
2
+ globalThis.require = function(m) {
3
+ if (m === "react") return globalThis.__ERIKEY_REACT__;
4
+ if (m === "react-dom") return globalThis.__ERIKEY_REACT_DOM__;
5
+ throw new Error("[erikey/react] Dynamic require of " + m + " is not supported");
6
+ };
7
+ }
8
+ var __create = Object.create;
9
+ var __defProp = Object.defineProperty;
10
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
+ var __getOwnPropNames = Object.getOwnPropertyNames;
12
+ var __getProtoOf = Object.getPrototypeOf;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
15
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
16
+ }) : x)(function(x) {
17
+ if (typeof require !== "undefined") return require.apply(this, arguments);
18
+ throw Error('Dynamic require of "' + x + '" is not supported');
19
+ });
20
+ var __commonJS = (cb, mod) => function __require2() {
21
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
22
+ };
23
+ var __export = (target, all) => {
24
+ for (var name in all)
25
+ __defProp(target, name, { get: all[name], enumerable: true });
26
+ };
27
+ var __copyProps = (to, from, except, desc) => {
28
+ if (from && typeof from === "object" || typeof from === "function") {
29
+ for (let key of __getOwnPropNames(from))
30
+ if (!__hasOwnProp.call(to, key) && key !== except)
31
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
+ }
33
+ return to;
34
+ };
35
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
36
+ // If the importer is in node compatibility mode or this is not an ESM
37
+ // file that has been converted to a CommonJS file using a Babel-
38
+ // compatible transform (i.e. "__esModule" has not been set), then set
39
+ // "default" to the CommonJS "module.exports" for node compatibility.
40
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
41
+ mod
42
+ ));
43
+
44
+ // src/require-shim.ts
45
+ import * as React from "react";
46
+ import * as ReactDOM from "react-dom";
47
+ var g = globalThis;
48
+ g.__ERIKEY_REACT__ = React;
49
+ g.__ERIKEY_REACT_DOM__ = ReactDOM;
50
+
51
+ export {
52
+ __require,
53
+ __commonJS,
54
+ __export,
55
+ __toESM
56
+ };
57
+ //# sourceMappingURL=chunk-K57QXNQP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/require-shim.ts"],"sourcesContent":["/**\n * CJS Require Shim - Part 2: Global Registration\n *\n * This module works together with the banner in tsup.config.ts:\n *\n * ## Execution Order\n *\n * 1. Banner runs FIRST (before esbuild helpers)\n * - Sets globalThis.require that reads from __ERIKEY_REACT__\n *\n * 2. esbuild's __require helper initializes\n * - Sees `typeof require !== \"undefined\"` (our banner set it)\n * - Uses our require function instead of throwing\n *\n * 3. This module runs (after React imports are resolved)\n * - Sets globalThis.__ERIKEY_REACT__ = React\n * - Sets globalThis.__ERIKEY_REACT_DOM__ = ReactDOM\n *\n * 4. When CJS code calls require(\"react\")\n * - __require calls our require function\n * - Our function returns globalThis.__ERIKEY_REACT__ (now available)\n *\n * ## Sandpack Compatibility\n *\n * Sandpack provides its own require function, so:\n * - Banner check skips (require already exists)\n * - Sandpack's require is used instead\n * - We still set the globals (harmless, unused)\n */\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst g = globalThis as any;\n\n// Register React modules for the banner's require shim to return\n// This runs AFTER React imports are resolved, making them available\ng.__ERIKEY_REACT__ = React;\ng.__ERIKEY_REACT_DOM__ = ReactDOM;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,YAAY,WAAW;AACvB,YAAY,cAAc;AAG1B,IAAM,IAAI;AAIV,EAAE,mBAAmB;AACrB,EAAE,uBAAuB;","names":[]}