xplorajs-react 0.1.2 → 0.2.0

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/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { renderToStream } from "./render";
1
+ export { renderToStream, generateStaticPage, getStaticProps } from "./render";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
package/dist/render.d.ts CHANGED
@@ -1,7 +1,22 @@
1
1
  import type React from "react";
2
2
  /**
3
- * Render React element ke stream HTML.
3
+ * Render React element ke stream HTML untuk development mode (SSR).
4
4
  * Otomatis fallback ke string jika Streaming tidak didukung.
5
5
  */
6
6
  export declare function renderToStream(element: React.ReactElement): Promise<string | import("react-dom/server").ReactDOMServerReadableStream>;
7
+ /**
8
+ * Generate static HTML file untuk production mode (SSG).
9
+ */
10
+ export declare function generateStaticPage(options: {
11
+ component: React.ReactElement;
12
+ outputPath: string;
13
+ props?: Record<string, unknown>;
14
+ }): Promise<void>;
15
+ /**
16
+ * Get static props untuk data fetching di build time.
17
+ */
18
+ export declare function getStaticProps(fn: () => Promise<Record<string, unknown>>): Promise<{
19
+ props: Record<string, unknown>;
20
+ revalidate: number;
21
+ }>;
7
22
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;GAGG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,6EAK/D"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;;GAGG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,6EAK/D;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE;IAChD,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,iBAQA;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,EAAE,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;;;GAe3C"}
package/dist/render.js CHANGED
@@ -144,11 +144,11 @@ import { renderToReadableStream, renderToString } from "react-dom/server";
144
144
  * Generate static HTML file untuk production mode (SSG).
145
145
  */ export function generateStaticPage(options) {
146
146
  return _async_to_generator(function() {
147
- var component, outputPath, props, html;
147
+ var component, outputPath, html;
148
148
  return _ts_generator(this, function(_state) {
149
149
  switch(_state.label){
150
150
  case 0:
151
- component = options.component, outputPath = options.outputPath, props = options.props;
151
+ component = options.component, outputPath = options.outputPath;
152
152
  return [
153
153
  4,
154
154
  renderToString(component)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xplorajs-react",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -10,7 +10,7 @@
10
10
  "README.md"
11
11
  ],
12
12
  "scripts": {
13
- "build": "swc src -d dist",
13
+ "build": "swc src -d dist && tsc --emitDeclarationOnly",
14
14
  "dev": "swc src -d dist --watch",
15
15
  "prepublishOnly": "bun run build"
16
16
  },
package/dist/App.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type React from "react";
2
- declare const App: React.FC;
3
- export default App;
4
- //# sourceMappingURL=App.d.ts.map
package/dist/App.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,QAAA,MAAM,GAAG,EAAE,KAAK,CAAC,EAEhB,CAAC;AAEF,eAAe,GAAG,CAAC"}
package/dist/App.js DELETED
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- const App = () => {
3
- return _jsx("h1", { children: "Hello XploraJS!" });
4
- };
5
- export default App;
package/dist/server.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function render(): string;
2
- //# sourceMappingURL=server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAKA,wBAAgB,MAAM,IAAI,MAAM,CAE/B"}
package/dist/server.js DELETED
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- import { renderToString } from "react-dom/server";
3
- import App from "./App";
4
- export function render() {
5
- return renderToString(React.createElement(App));
6
- }