@fragno-dev/node 0.0.7 → 0.0.8

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.
@@ -1,8 +1,11 @@
1
- $ tsdown
2
- ℹ tsdown v0.15.9 powered by rolldown v1.0.0-beta.44
1
+
2
+ > @fragno-dev/node@0.0.8 build /home/runner/work/fragno/fragno/packages/fragno-node
3
+ > tsdown
4
+
5
+ ℹ tsdown v0.15.12 powered by rolldown v1.0.0-beta.45
3
6
  ℹ Using tsdown config: /home/runner/work/fragno/fragno/packages/fragno-node/tsdown.config.ts
4
7
  ℹ entry: fragno-node.ts
5
- ℹ target: node20.0.0
8
+ ℹ target: node22.0.0
6
9
  ℹ tsconfig: tsconfig.json
7
10
  ℹ Build start
8
11
  ℹ dist/fragno-node.js 1.37 kB │ gzip: 0.50 kB
@@ -10,4 +13,4 @@ $ tsdown
10
13
  ℹ dist/fragno-node.d.ts.map 0.20 kB │ gzip: 0.14 kB
11
14
  ℹ dist/fragno-node.d.ts 1.40 kB │ gzip: 0.50 kB
12
15
  ℹ 4 files, total: 4.64 kB
13
- ✔ Build complete in 9340ms
16
+ ✔ Build complete in 5597ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @fragno-dev/node
2
2
 
3
+ ## 0.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 5ea24d2: refactor: improve Fragment builder and instatiator
8
+
3
9
  ## 0.0.7
4
10
 
5
11
  ### Patch Changes
package/LICENSE.md ADDED
@@ -0,0 +1,16 @@
1
+ Copyright 2025 - present "ReJot Nederland B.V.", and individual contributors.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
4
+ associated documentation files (the “Software”), to deal in the Software without restriction,
5
+ including without limitation the rights to use, copy, modify, merge, publish, distribute,
6
+ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
7
+ furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial
10
+ portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
13
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
15
+ OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,13 +1,8 @@
1
1
  import express, { type Application } from "express";
2
2
  import { test, expect, describe, beforeAll, afterAll } from "vitest";
3
3
  import { z } from "zod";
4
- import {
5
- defineFragment,
6
- defineRoute,
7
- createFragment,
8
- type FragnoInstantiatedFragment,
9
- type FragnoPublicClientConfig,
10
- } from "@fragno-dev/core";
4
+ import { defineFragment, defineRoute, instantiate } from "@fragno-dev/core";
5
+ import { type FragnoPublicClientConfig } from "@fragno-dev/core/client";
11
6
  import { toNodeHandler } from "./fragno-node";
12
7
 
13
8
  describe("Fragno Express integration", () => {
@@ -23,13 +18,21 @@ describe("Fragno Express integration", () => {
23
18
  const clientConfig: FragnoPublicClientConfig = {
24
19
  baseUrl: "http://localhost",
25
20
  };
26
- let testFragment: FragnoInstantiatedFragment<[typeof usersRoute]>;
21
+
22
+ function instantiateTestFragment() {
23
+ return instantiate(testFragmentDefinition)
24
+ .withRoutes([usersRoute])
25
+ .withOptions(clientConfig)
26
+ .build();
27
+ }
28
+
29
+ let testFragment: ReturnType<typeof instantiateTestFragment>;
27
30
  let app: Application;
28
31
  let server: ReturnType<typeof app.listen>;
29
32
  let port: number;
30
33
 
31
34
  function createExpressServerForTest() {
32
- testFragment = createFragment(testFragmentDefinition, {}, [usersRoute], clientConfig);
35
+ testFragment = instantiateTestFragment();
33
36
  app = express();
34
37
 
35
38
  app.all("/api/test-fragment/{*any}", toNodeHandler(testFragment.handler));
@@ -1,13 +1,8 @@
1
1
  import { createServer, type RequestListener, type Server } from "node:http";
2
2
  import { test, expect, describe } from "vitest";
3
3
  import { z } from "zod";
4
- import {
5
- defineFragment,
6
- defineRoute,
7
- createFragment,
8
- type FragnoInstantiatedFragment,
9
- type FragnoPublicClientConfig,
10
- } from "@fragno-dev/core";
4
+ import { defineFragment, defineRoute, instantiate } from "@fragno-dev/core";
5
+ import { type FragnoPublicClientConfig } from "@fragno-dev/core/client";
11
6
  import { toNodeHandler } from "./fragno-node";
12
7
 
13
8
  describe("Fragno Node.js integration", () => {
@@ -23,14 +18,22 @@ describe("Fragno Node.js integration", () => {
23
18
  const clientConfig: FragnoPublicClientConfig = {
24
19
  baseUrl: "http://localhost",
25
20
  };
26
- let testFragment: FragnoInstantiatedFragment<[typeof usersRoute]>;
21
+
22
+ function instantiateTestFragment() {
23
+ return instantiate(testFragmentDefinition)
24
+ .withRoutes([usersRoute])
25
+ .withOptions(clientConfig)
26
+ .build();
27
+ }
28
+
29
+ let testFragment: ReturnType<typeof instantiateTestFragment>;
27
30
  let server: Server;
28
31
  let port: number;
29
32
 
30
33
  function createServerForTest(
31
- listenerFactory: (fragment: FragnoInstantiatedFragment<[typeof usersRoute]>) => RequestListener,
34
+ listenerFactory: (fragment: ReturnType<typeof instantiateTestFragment>) => RequestListener,
32
35
  ) {
33
- testFragment = createFragment(testFragmentDefinition, {}, [usersRoute], clientConfig);
36
+ testFragment = instantiateTestFragment();
34
37
  server = createServer(listenerFactory(testFragment));
35
38
  server.listen(0);
36
39
 
@@ -1,13 +1,8 @@
1
1
  import express, { type Application } from "express";
2
2
  import { test, expect, describe, beforeAll, afterAll, assert } from "vitest";
3
3
  import { z } from "zod";
4
- import {
5
- defineFragment,
6
- defineRoute,
7
- createFragment,
8
- type FragnoInstantiatedFragment,
9
- type FragnoPublicClientConfig,
10
- } from "@fragno-dev/core";
4
+ import { defineFragment, defineRoute, instantiate } from "@fragno-dev/core";
5
+ import { type FragnoPublicClientConfig } from "@fragno-dev/core/client";
11
6
  import { toNodeHandler } from "./fragno-node";
12
7
 
13
8
  describe("Node.js Streaming", () => {
@@ -29,13 +24,21 @@ describe("Node.js Streaming", () => {
29
24
  const clientConfig: FragnoPublicClientConfig = {
30
25
  baseUrl: "http://localhost",
31
26
  };
32
- let testFragment: FragnoInstantiatedFragment<[typeof streamRoute]>;
27
+
28
+ function instantiateTestFragment() {
29
+ return instantiate(testFragmentDefinition)
30
+ .withRoutes([streamRoute])
31
+ .withOptions(clientConfig)
32
+ .build();
33
+ }
34
+
35
+ let testFragment: ReturnType<typeof instantiateTestFragment>;
33
36
  let app: Application;
34
37
  let server: ReturnType<typeof app.listen>;
35
38
  let port: number;
36
39
 
37
40
  function createExpressServerForTest() {
38
- testFragment = createFragment(testFragmentDefinition, {}, [streamRoute], clientConfig);
41
+ testFragment = instantiateTestFragment();
39
42
  app = express();
40
43
 
41
44
  app.all("/api/test-fragment/{*any}", toNodeHandler(testFragment.handler));
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@fragno-dev/node",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "exports": {
5
5
  ".": {
6
- "bun": "./fragno-node.ts",
7
6
  "development": "./fragno-node.ts",
8
7
  "types": "./dist/fragno-node.d.ts",
9
8
  "default": "./dist/fragno-node.js"
@@ -11,34 +10,38 @@
11
10
  "./package.json": "./package.json"
12
11
  },
13
12
  "type": "module",
14
- "scripts": {
15
- "build": "tsdown",
16
- "build:watch": "tsdown --watch",
17
- "types:check": "tsc --noEmit",
18
- "test": "vitest run",
19
- "test:watch": "vitest --watch"
20
- },
21
- "peerDependencies": {
22
- "@fragno-dev/core": "0.0.7"
23
- },
24
13
  "engines": {
25
- "node": "^20.0.0 || >=22.0.0"
14
+ "node": ">=22"
26
15
  },
27
16
  "devDependencies": {
28
- "@fragno-dev/core": "0.0.7",
29
- "@fragno-private/typescript-config": "0.0.1",
30
- "@fragno-private/vitest-config": "0.0.0",
31
17
  "@types/node": "^22",
32
18
  "@types/express": "^5.0.3",
33
19
  "@vitest/coverage-istanbul": "^3.2.4",
34
20
  "express": "^5.1.0",
35
21
  "vitest": "^3.2.4",
36
- "zod": "^4.0.5"
22
+ "zod": "^4.0.5",
23
+ "@fragno-dev/core": "0.1.9",
24
+ "@fragno-private/typescript-config": "0.0.1",
25
+ "@fragno-private/vitest-config": "0.0.0"
37
26
  },
38
27
  "dependencies": {
39
28
  "@remix-run/node-fetch-server": "^0.8.0"
40
29
  },
41
30
  "main": "./dist/fragno-node.js",
42
31
  "module": "./dist/fragno-node.js",
43
- "types": "./dist/fragno-node.d.ts"
44
- }
32
+ "types": "./dist/fragno-node.d.ts",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/rejot-dev/fragno.git",
36
+ "directory": "packages/fragno-node"
37
+ },
38
+ "homepage": "https://fragno.dev",
39
+ "license": "MIT",
40
+ "scripts": {
41
+ "build": "tsdown",
42
+ "build:watch": "tsdown --watch",
43
+ "types:check": "tsc --noEmit",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest --watch"
46
+ }
47
+ }
@@ -1,17 +0,0 @@
1
- $ vitest run
2
-
3
-  RUN  v3.2.4 /home/runner/work/fragno/fragno/packages/fragno-node
4
- Coverage enabled with istanbul
5
-
6
- ✓ node-stream.test.ts (1 test) 458ms
7
- ✓ Node.js Streaming > should fetch data from the GET /stream route  407ms
8
- ✓ fragno-node-express.test.ts (2 tests) 477ms
9
- ✓ Fragno Express integration > should fetch data from the GET /users route  401ms
10
- ✓ fragno-node-http.test.ts (2 tests) 491ms
11
- ✓ Fragno Node.js integration > should fetch data from the GET /users route  433ms
12
-
13
-  Test Files  3 passed (3)
14
-  Tests  5 passed (5)
15
-  Start at  14:42:27
16
-  Duration  3.45s (transform 1.09s, setup 0ms, collect 3.77s, tests 1.43s, environment 1ms, prepare 1.24s)
17
-
@@ -1 +0,0 @@
1
- $ tsc --noEmit