@wrdagency/react-islands 0.1.0 → 0.1.1
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 +13 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -3
- package/src/index.tsx +1 -1
- package/tsconfig.json +0 -14
- package/tsup.config.ts +0 -10
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@ Create your island. Here we use an existing component and use our Islands direct
|
|
|
10
10
|
|
|
11
11
|
```
|
|
12
12
|
// ./islands/my-component.tsx
|
|
13
|
-
import MyComponent from "
|
|
14
|
-
import createIsland from "
|
|
13
|
+
import MyComponent from "./components";
|
|
14
|
+
import { createIsland } from "@wrdagency/react-islands";
|
|
15
15
|
|
|
16
16
|
export const myComponentIsland = createIsland(MyComponent, {
|
|
17
17
|
name: "my-component",
|
|
@@ -44,7 +44,7 @@ Create a pre-render script. You can configure your build tool to use this as a s
|
|
|
44
44
|
import path from "node:path";
|
|
45
45
|
import { fileURLToPath } from "node:url";
|
|
46
46
|
import * as islands from "./islands";
|
|
47
|
-
import { prerenderIslands } from "
|
|
47
|
+
import { prerenderIslands } from "@wrdagency/react-islands/server";
|
|
48
48
|
|
|
49
49
|
const __filename = fileURLToPath(import.meta.url);
|
|
50
50
|
const __dirname = path.dirname(__filename);
|
|
@@ -56,13 +56,21 @@ prerenderIslands({ islands, outDir });
|
|
|
56
56
|
For our example we're using Vite. We'll build our prerendering script.
|
|
57
57
|
|
|
58
58
|
```
|
|
59
|
-
npx vite build --ssr src/prerender.tsx --outDir
|
|
59
|
+
npx vite build --ssr ./src/prerender.tsx --outDir ./dist
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
And then we can run that compiled script. It'll create all of our statically rendered islands and put them into the `outDir` we specified.
|
|
63
63
|
|
|
64
64
|
```
|
|
65
|
-
node
|
|
65
|
+
node ./dist/prerender.js
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
For convenience we'd recommend setting up a script in your `package.json` for this like so:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
"scripts": {
|
|
72
|
+
"prerender": "npx vite build --ssr ./src/prerender.tsx --outDir ./dist && node ./dist/prerender.js",
|
|
73
|
+
},
|
|
66
74
|
```
|
|
67
75
|
|
|
68
76
|
## API
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3148,7 +3148,7 @@ var require_jsx_runtime = __commonJS({
|
|
|
3148
3148
|
var src_exports = {};
|
|
3149
3149
|
__export(src_exports, {
|
|
3150
3150
|
RawHTML: () => RawHTML,
|
|
3151
|
-
|
|
3151
|
+
createIsland: () => createIsland,
|
|
3152
3152
|
isServer: () => isServer,
|
|
3153
3153
|
withProps: () => withProps
|
|
3154
3154
|
});
|
|
@@ -3242,6 +3242,7 @@ function renderIsland(island, renderOpts = {}) {
|
|
|
3242
3242
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3243
3243
|
0 && (module.exports = {
|
|
3244
3244
|
RawHTML,
|
|
3245
|
+
createIsland,
|
|
3245
3246
|
isServer,
|
|
3246
3247
|
withProps
|
|
3247
3248
|
});
|