frosty 0.0.99 → 0.0.100
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/README.md
CHANGED
|
@@ -24,18 +24,24 @@ Here's a simple example to get you started:
|
|
|
24
24
|
|
|
25
25
|
```tsx
|
|
26
26
|
import { useState } from 'frosty';
|
|
27
|
+
import { DOMRenderer } from 'frosty/dom';
|
|
27
28
|
|
|
28
29
|
function App() {
|
|
29
30
|
const [count, setCount] = useState(0);
|
|
30
31
|
return (
|
|
31
32
|
<div>
|
|
32
|
-
<
|
|
33
|
-
<
|
|
33
|
+
<h1>Hello, Frosty!</h1>
|
|
34
|
+
<p>You clicked {count} times</p>
|
|
35
|
+
<button onClick={() => setCount(count + 1)}>
|
|
36
|
+
Count: {count}
|
|
37
|
+
</button>
|
|
34
38
|
</div>
|
|
35
39
|
);
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
// Mount the application
|
|
43
|
+
const root = DOMRenderer.createRoot(document.getElementById('app'));
|
|
44
|
+
await root.mount(<App />);
|
|
39
45
|
```
|
|
40
46
|
|
|
41
47
|
See the [comprehensive documentation](./docs) for detailed guides, API reference, and advanced usage patterns.
|
package/package.json
CHANGED
|
@@ -42,7 +42,8 @@ export const renderToHTML = async (App, {
|
|
|
42
42
|
const url = `${req.protocol}://${req.get('host')}${req.originalUrl}`;
|
|
43
43
|
const cookieJar = new CookieJar();
|
|
44
44
|
for (const cookie of _.split(req.get('cookie'), ';')) {
|
|
45
|
-
|
|
45
|
+
const trimmedCookie = cookie.trim();
|
|
46
|
+
if (trimmedCookie) cookieJar.setCookieSync(trimmedCookie, url);
|
|
46
47
|
}
|
|
47
48
|
const loader = new NoOpResourceLoader({ userAgent });
|
|
48
49
|
const dom = new JSDOM(undefined, { url, referrer, userAgent, resources: loader, cookieJar });
|