@xwadex/fesd-next 0.1.48 → 0.1.50

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,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare function Greeting(): Promise<react_jsx_runtime.JSX.Element>;
4
+
5
+ declare function Button(): react_jsx_runtime.JSX.Element;
6
+
7
+ export { Button, Greeting };
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare function Greeting(): Promise<react_jsx_runtime.JSX.Element>;
4
+
5
+ declare function Button(): react_jsx_runtime.JSX.Element;
6
+
7
+ export { Button, Greeting };
package/dist/index.js CHANGED
@@ -1,3 +1,63 @@
1
- import { usePrevious as usePrevState } from './hooks/usePrevState';
2
- import { Demo } from './components/Demo';
3
- export { usePrevState, Demo };
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Button: () => Button,
24
+ Greeting: () => Greeting
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+
28
+ // src/server/Greeting.tsx
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ async function Greeting() {
31
+ const data = await fetch("https://dummyjson.com/products/1").then(
32
+ (res) => res.json()
33
+ );
34
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h1", { children: [
35
+ "Hello, ",
36
+ data.title,
37
+ "!"
38
+ ] });
39
+ }
40
+
41
+ // src/client/Button.tsx
42
+ var import_react = require("react");
43
+ var import_jsx_runtime2 = require("react/jsx-runtime");
44
+ function Button() {
45
+ const [count, setCount] = (0, import_react.useState)(0);
46
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
47
+ "button",
48
+ {
49
+ className: "p-2 bg-blue-500 text-white rounded",
50
+ onClick: () => setCount(count + 1),
51
+ children: [
52
+ "Count: ",
53
+ count
54
+ ]
55
+ }
56
+ );
57
+ }
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {
60
+ Button,
61
+ Greeting
62
+ });
63
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/server/Greeting.tsx","../src/client/Button.tsx"],"sourcesContent":["export { default as Greeting } from \"./server/Greeting\";\nexport { default as Button } from \"./client/Button\";\n","export default async function Greeting() {\n const data = await fetch(\"https://dummyjson.com/products/1\").then((res) =>\n res.json()\n );\n\n return <h1>Hello, {data.title}!</h1>;\n}\n","\"use client\";\n\nimport { useState } from \"react\";\n\nexport default function Button() {\n const [count, setCount] = useState(0);\n\n return (\n <button\n className=\"p-2 bg-blue-500 text-white rounded\"\n onClick={() => setCount(count + 1)}\n >\n Count: {count}\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKW;AALX,eAAO,WAAkC;AACrC,QAAM,OAAO,MAAM,MAAM,kCAAkC,EAAE;AAAA,IAAK,CAAC,QAC/D,IAAI,KAAK;AAAA,EACb;AAEA,SAAO,6CAAC,QAAG;AAAA;AAAA,IAAQ,KAAK;AAAA,IAAM;AAAA,KAAC;AACnC;;;ACJA,mBAAyB;AAMjB,IAAAA,sBAAA;AAJO,SAAR,SAA0B;AAC7B,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAS,CAAC;AAEpC,SACI;AAAA,IAAC;AAAA;AAAA,MACG,WAAU;AAAA,MACV,SAAS,MAAM,SAAS,QAAQ,CAAC;AAAA,MACpC;AAAA;AAAA,QACW;AAAA;AAAA;AAAA,EACZ;AAER;","names":["import_jsx_runtime"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,35 @@
1
+ // src/server/Greeting.tsx
2
+ import { jsxs } from "react/jsx-runtime";
3
+ async function Greeting() {
4
+ const data = await fetch("https://dummyjson.com/products/1").then(
5
+ (res) => res.json()
6
+ );
7
+ return /* @__PURE__ */ jsxs("h1", { children: [
8
+ "Hello, ",
9
+ data.title,
10
+ "!"
11
+ ] });
12
+ }
13
+
14
+ // src/client/Button.tsx
15
+ import { useState } from "react";
16
+ import { jsxs as jsxs2 } from "react/jsx-runtime";
17
+ function Button() {
18
+ const [count, setCount] = useState(0);
19
+ return /* @__PURE__ */ jsxs2(
20
+ "button",
21
+ {
22
+ className: "p-2 bg-blue-500 text-white rounded",
23
+ onClick: () => setCount(count + 1),
24
+ children: [
25
+ "Count: ",
26
+ count
27
+ ]
28
+ }
29
+ );
30
+ }
31
+ export {
32
+ Button,
33
+ Greeting
34
+ };
35
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server/Greeting.tsx","../src/client/Button.tsx"],"sourcesContent":["export default async function Greeting() {\n const data = await fetch(\"https://dummyjson.com/products/1\").then((res) =>\n res.json()\n );\n\n return <h1>Hello, {data.title}!</h1>;\n}\n","\"use client\";\n\nimport { useState } from \"react\";\n\nexport default function Button() {\n const [count, setCount] = useState(0);\n\n return (\n <button\n className=\"p-2 bg-blue-500 text-white rounded\"\n onClick={() => setCount(count + 1)}\n >\n Count: {count}\n </button>\n );\n}\n"],"mappings":";AAKW;AALX,eAAO,WAAkC;AACrC,QAAM,OAAO,MAAM,MAAM,kCAAkC,EAAE;AAAA,IAAK,CAAC,QAC/D,IAAI,KAAK;AAAA,EACb;AAEA,SAAO,qBAAC,QAAG;AAAA;AAAA,IAAQ,KAAK;AAAA,IAAM;AAAA,KAAC;AACnC;;;ACJA,SAAS,gBAAgB;AAMjB,iBAAAA,aAAA;AAJO,SAAR,SAA0B;AAC7B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,CAAC;AAEpC,SACI,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACG,WAAU;AAAA,MACV,SAAS,MAAM,SAAS,QAAQ,CAAC;AAAA,MACpC;AAAA;AAAA,QACW;AAAA;AAAA;AAAA,EACZ;AAER;","names":["jsxs"]}
package/package.json CHANGED
@@ -1,45 +1,44 @@
1
1
  {
2
2
  "name": "@xwadex/fesd-next",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "private": false,
5
- "main": "dist/index.js",
5
+ "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
7
- "types": "dist/types/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
7
+ "types": "dist/index.d.ts",
11
8
  "exports": {
12
9
  ".": {
10
+ "types": "./dist/index.d.ts",
13
11
  "import": "./dist/index.js",
14
- "require": "./dist/index.js",
15
- "types": "./dist/types/index.d.ts"
12
+ "require": "./dist/index.cjs"
16
13
  },
17
- "./components": {
18
- "import": "./dist/components/index.js",
19
- "require": "./dist/components/index.js",
20
- "types": "./dist/types/components/index.d.ts"
14
+ "./server/*": {
15
+ "types": "./dist/server/*.d.ts",
16
+ "import": "./dist/server/*.js",
17
+ "require": "./dist/server/*.cjs"
21
18
  },
22
- "./hooks": {
23
- "import": "./dist/hooks/index.js",
24
- "require": "./dist/hooks/index.js",
25
- "types": "./dist/types/hooks/index.d.ts"
26
- },
27
- "./styles/*": "./dist/styles/*"
19
+ "./client/*": {
20
+ "types": "./dist/client/*.d.ts",
21
+ "import": "./dist/client/*.js",
22
+ "require": "./dist/client/*.cjs"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "build": "tsup",
27
+ "dev": "tsup --watch"
28
28
  },
29
29
  "peerDependencies": {
30
- "next": ">=15",
31
- "react": ">=18",
32
- "react-dom": ">=18",
33
- "framer-motion": ">=12.0.0",
34
- "react-icons": ">=5.2.1",
35
- "tua-body-scroll-lock": ">=1.5.1"
30
+ "next": "^15.2.2",
31
+ "react": "^19.0.0",
32
+ "react-dom": "^19.0.0"
36
33
  },
37
34
  "devDependencies": {
38
- "@types/body-scroll-lock": ">=3.1.2"
39
- },
40
- "scripts": {
41
- "publish:patch": "pnpm version patch",
42
- "publish:push": "git add . && git commit -m 'Patch Package Version' && git push",
43
- "publish:npm": "pnpm publish:patch && pnpm publish:push && pnpm publish --access=public"
35
+ "@types/node": "^22.13.10",
36
+ "@types/react": "^19.0.10",
37
+ "@types/react-dom": "^19.0.4",
38
+ "next": "^15.2.2",
39
+ "react": "^19.0.0",
40
+ "react-dom": "^19.0.0",
41
+ "tsup": "^8.4.0",
42
+ "typescript": "^5.8.2"
44
43
  }
45
- }
44
+ }
@@ -0,0 +1,16 @@
1
+ "use client";
2
+
3
+ import { useState } from "react";
4
+
5
+ export default function Button() {
6
+ const [count, setCount] = useState(0);
7
+
8
+ return (
9
+ <button
10
+ className="p-2 bg-blue-500 text-white rounded"
11
+ onClick={() => setCount(count + 1)}
12
+ >
13
+ Count: {count}
14
+ </button>
15
+ );
16
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { default as Greeting } from "./server/Greeting";
2
+ export { default as Button } from "./client/Button";
@@ -0,0 +1,7 @@
1
+ export default async function Greeting() {
2
+ const data = await fetch("https://dummyjson.com/products/1").then((res) =>
3
+ res.json()
4
+ );
5
+
6
+ return <h1>Hello, {data.title}!</h1>;
7
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "dist", // 編譯後的輸出目錄
4
+ "declaration": true, // 生成 `.d.ts` 文件
5
+ "declarationMap": false, // 不生成 `.d.ts.map` 文件(如果不需要調試型別)
6
+ "sourceMap": true, // 生成 `.map` 文件
7
+ "module": "ESNext", // 使用最新的 ES 模組
8
+ "target": "ESNext", // 使用最新的 ES 語法特性
9
+ "jsx": "react-jsx", // 支援 React 17+ JSX 轉換
10
+ "moduleResolution": "Node", // 使用 Node.js 模組解析策略
11
+ "resolveJsonModule": true, // 支援導入 JSON 檔案
12
+ "strict": true, // 啟用所有嚴格型別檢查選項
13
+ "esModuleInterop": true, // 支援 CommonJS 模組與 ES 模組互操作
14
+ "skipLibCheck": true, // 跳過庫文件型別檢查
15
+ "forceConsistentCasingInFileNames": true // 確保檔案名大小寫一致性
16
+ },
17
+ "include": ["src"] // 指定 TypeScript 編譯的檔案範圍
18
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ export default defineConfig({
4
+ entry: ["src/index.ts"],
5
+ format: ["cjs", "esm"],
6
+ dts: {
7
+ entry: "src/index.ts", // 確保型別文件生成
8
+ resolve: true, // 確保外部引用的型別可以正確解析
9
+ },
10
+ sourcemap: true,
11
+ clean: true,
12
+ external: ["next", "react", "react-dom"], // 確保這些模組不被打包
13
+ shims: false, // 避免 `export {}` 影響型別解析
14
+ target: "esnext", // 讓 ESM 使用最新 ES 語法
15
+ });
@@ -1,24 +0,0 @@
1
- "use client";
2
-
3
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
9
- import { usePathname } from 'next/navigation';
10
- import React, { useEffect, useState } from 'react';
11
- export function Demo(_ref) {
12
- var title = _ref.title;
13
- var pathname = usePathname();
14
- var _useState = useState(title),
15
- _useState2 = _slicedToArray(_useState, 1),
16
- state = _useState2[0];
17
- useEffect(function () {
18
- console.log("pathname", pathname);
19
- }, [pathname]);
20
- return /*#__PURE__*/React.createElement("div", {
21
- className: "test"
22
- }, "Demo:", state, ", ", pathname);
23
- }
24
- ;
@@ -1 +0,0 @@
1
- export { Demo } from "./Demo";
@@ -1 +0,0 @@
1
- export { usePrevious } from "./usePrevState";
@@ -1,10 +0,0 @@
1
- 'use client';
2
-
3
- import { useEffect, useRef } from 'react';
4
- export var usePrevious = function usePrevious(value) {
5
- var ref = useRef(null);
6
- useEffect(function () {
7
- ref.current = value;
8
- }, [value]);
9
- return ref.current;
10
- };
@@ -1,3 +0,0 @@
1
- .test {
2
- background-color: #ff0000;
3
- }
@@ -1 +0,0 @@
1
- @forward "Demo";
@@ -1 +0,0 @@
1
- @forward "components";
@@ -1,3 +0,0 @@
1
- .test {
2
- background-color: #ff0000;
3
- }
@@ -1 +0,0 @@
1
- @forward "Demo";
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export declare function Demo({ title }: {
3
- title: string;
4
- }): React.JSX.Element;
@@ -1 +0,0 @@
1
- export { Demo } from "./Demo";
@@ -1 +0,0 @@
1
- export { usePrevious } from "./usePrevState";
@@ -1,3 +0,0 @@
1
- type UsePrevious<T> = T | null;
2
- export declare const usePrevious: <T>(value: T) => UsePrevious<T>;
3
- export {};
@@ -1,3 +0,0 @@
1
- import { usePrevious as usePrevState } from './hooks/usePrevState';
2
- import { Demo as Demo } from './components/Demo';
3
- export { usePrevState, Demo };