@swc-jotai/react-refresh
Advanced tools
Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "@swc-jotai/react-refresh", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "SWC plugin for supporting React Refresh with Jotai", | ||
@@ -20,5 +20,3 @@ "author": "Mathis Møller", | ||
"main": "swc_jotai_react_refresh.wasm", | ||
"scripts": { | ||
"prepack": "cargo prepublish --release && cp ../../target/wasm32-wasi/release/swc_jotai_react_refresh.wasm ." | ||
} | ||
} | ||
"scripts": {} | ||
} |
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || { | ||
cache: new Map(), | ||
get: function get(name, inst) { | ||
if (this.cache.has(name)) { | ||
return this.cache.get(name); | ||
} | ||
this.cache.set(name, inst); | ||
return inst; | ||
cache: new Map(), | ||
get(name, inst) { | ||
if (this.cache.has(name)) { | ||
return this.cache.get(name); | ||
} | ||
this.cache.set(name, inst); | ||
return inst; | ||
}, | ||
}; | ||
var myCustomAtom = globalThis.jotaiAtomCache.get("atoms.ts/myCustomAtom", customAtom(0)); | ||
const myCustomAtom = globalThis.jotaiAtomCache.get( | ||
"atoms.ts/myCustomAtom", | ||
customAtom(0) | ||
); |
import { Provider } from "jotai"; | ||
function MyApp(param) { | ||
var Component = param.Component, pageProps = param.pageProps; | ||
return /*#__PURE__*/ React.createElement(Provider, { | ||
function MyApp({ Component, pageProps }) { | ||
return /*#__PURE__*/ React.createElement( | ||
Provider, | ||
{ | ||
__source: { | ||
fileName: "input.js", | ||
lineNumber: 5, | ||
columnNumber: 5, | ||
}, | ||
__self: this, | ||
}, | ||
/*#__PURE__*/ React.createElement( | ||
Component, | ||
_extends({}, pageProps, { | ||
__source: { | ||
fileName: "input.js", | ||
lineNumber: 5, | ||
columnNumber: 5 | ||
fileName: "input.js", | ||
lineNumber: 6, | ||
columnNumber: 7, | ||
}, | ||
__self: this | ||
}, /*#__PURE__*/ React.createElement(Component, _extends({}, pageProps, { | ||
__source: { | ||
fileName: "input.js", | ||
lineNumber: 6, | ||
columnNumber: 7 | ||
}, | ||
__self: this | ||
}))); | ||
__self: this, | ||
}) | ||
) | ||
); | ||
} | ||
@@ -20,0 +26,0 @@ _c = MyApp; |
var _s = $___refreshSig$(); | ||
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || { | ||
cache: new Map(), | ||
get: function get(name, inst) { | ||
if (this.cache.has(name)) { | ||
return this.cache.get(name); | ||
} | ||
this.cache.set(name, inst); | ||
return inst; | ||
cache: new Map(), | ||
get(name, inst) { | ||
if (this.cache.has(name)) { | ||
return this.cache.get(name); | ||
} | ||
this.cache.set(name, inst); | ||
return inst; | ||
}, | ||
}; | ||
import { atom, useAtom } from "jotai"; | ||
var countAtom = globalThis.jotaiAtomCache.get("atoms.ts/countAtom", atom(0)); | ||
const countAtom = globalThis.jotaiAtomCache.get("atoms.ts/countAtom", atom(0)); | ||
export default function AboutPage() { | ||
_s(); | ||
var ref = _slicedToArray(useAtom(countAtom), 2), count = ref[0], setCount = ref[1]; | ||
return /*#__PURE__*/ React.createElement("div", { | ||
_s(); | ||
const [count, setCount] = useAtom(countAtom); | ||
return /*#__PURE__*/ React.createElement( | ||
"div", | ||
{ | ||
__source: { | ||
fileName: "input.js", | ||
lineNumber: 8, | ||
columnNumber: 5, | ||
}, | ||
__self: this, | ||
}, | ||
/*#__PURE__*/ React.createElement( | ||
"div", | ||
{ | ||
__source: { | ||
fileName: "input.js", | ||
lineNumber: 8, | ||
columnNumber: 5 | ||
fileName: "input.js", | ||
lineNumber: 9, | ||
columnNumber: 7, | ||
}, | ||
__self: this | ||
}, /*#__PURE__*/ React.createElement("div", { | ||
__self: this, | ||
}, | ||
"About us" | ||
), | ||
count, | ||
" ", | ||
/*#__PURE__*/ React.createElement( | ||
"button", | ||
{ | ||
onClick: () => setCount((c) => c + 1), | ||
__source: { | ||
fileName: "input.js", | ||
lineNumber: 9, | ||
columnNumber: 7 | ||
fileName: "input.js", | ||
lineNumber: 10, | ||
columnNumber: 15, | ||
}, | ||
__self: this | ||
}, "About us"), count, " ", /*#__PURE__*/ React.createElement("button", { | ||
onClick: function() { | ||
return setCount(function(c) { | ||
return c + 1; | ||
}); | ||
}, | ||
__source: { | ||
fileName: "input.js", | ||
lineNumber: 10, | ||
columnNumber: 15 | ||
}, | ||
__self: this | ||
}, "+1")); | ||
__self: this, | ||
}, | ||
"+1" | ||
) | ||
); | ||
} | ||
_s(AboutPage, "sySahu1cSQLJWE74sAFuY2ik8VA=", false, function() { | ||
return [ | ||
useAtom | ||
]; | ||
_s(AboutPage, "sySahu1cSQLJWE74sAFuY2ik8VA=", false, function () { | ||
return [useAtom]; | ||
}); | ||
@@ -50,0 +59,0 @@ _c = AboutPage; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1544905
130