@fragno-dev/create 0.1.1 → 0.1.3

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/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@fragno-dev/create",
3
3
  "description": "A library for creating Fragno fragments",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "exports": {
6
6
  ".": {
7
- "bun": "./src/index.ts",
8
7
  "development": "./src/index.ts",
9
8
  "types": "./dist/index.d.ts",
10
9
  "default": "./dist/index.js"
@@ -13,26 +12,32 @@
13
12
  "main": "./dist/index.js",
14
13
  "module": "./dist/index.js",
15
14
  "types": "./dist/index.d.ts",
16
- "scripts": {
17
- "test": "vitest run",
18
- "build": "tsdown",
19
- "build:watch": "tsdown --watch",
20
- "types:check": "tsc --noEmit"
21
- },
22
15
  "type": "module",
23
16
  "dependencies": {
24
17
  "zod": "^4.1.12"
25
18
  },
26
19
  "devDependencies": {
27
- "@fragno-private/typescript-config": "0.0.1",
28
- "@fragno-private/vitest-config": "0.0.0",
29
- "@types/node": "^20",
30
- "@types/bun": "latest",
20
+ "@types/node": "^22",
31
21
  "@vitest/coverage-istanbul": "^3.2.4",
32
- "vitest": "^3.2.4"
22
+ "vitest": "^3.2.4",
23
+ "@fragno-private/typescript-config": "0.0.1",
24
+ "@fragno-private/vitest-config": "0.0.0"
33
25
  },
34
26
  "private": false,
35
27
  "peerDependencies": {
36
28
  "typescript": "^5"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/rejot-dev/fragno.git",
33
+ "directory": "packages/create"
34
+ },
35
+ "homepage": "https://fragno.dev",
36
+ "license": "MIT",
37
+ "scripts": {
38
+ "test": "vitest run",
39
+ "build": "tsdown",
40
+ "build:watch": "tsdown --watch",
41
+ "types:check": "tsc --noEmit"
37
42
  }
38
- }
43
+ }
@@ -54,8 +54,8 @@ function createFragmentTestSuite(buildTool: BuildTool, withDatabase: boolean) {
54
54
  await expect(fs.access(agentFile)).resolves.toBeUndefined();
55
55
  });
56
56
 
57
- test("installs", { timeout: 10000 }, async () => {
58
- const { stdout } = await execAsync("bun install", {
57
+ test("installs", { timeout: 30000 }, async () => {
58
+ const { stdout } = await execAsync("pnpm install", {
59
59
  cwd: tempDir,
60
60
  encoding: "utf8",
61
61
  });
@@ -63,7 +63,7 @@ function createFragmentTestSuite(buildTool: BuildTool, withDatabase: boolean) {
63
63
  });
64
64
 
65
65
  test("compiles", { timeout: 30000 }, async () => {
66
- const { stdout } = await execAsync("bun run types:check", {
66
+ const { stdout } = await execAsync("pnpm run types:check", {
67
67
  cwd: tempDir,
68
68
  encoding: "utf8",
69
69
  });
@@ -72,12 +72,12 @@ function createFragmentTestSuite(buildTool: BuildTool, withDatabase: boolean) {
72
72
  });
73
73
  /*
74
74
  FIXME: Skipping this test for rollup:
75
- When running rollup directly through bun run build or npm run build the build succeeds,
75
+ When running rollup directly through pnpm run build or npm run build the build succeeds,
76
76
  but somehow when running through vitest the module resolution mechanism changes causing
77
77
  the build to fail.
78
78
  */
79
79
  test.skipIf(buildTool === "rollup")("builds", { timeout: 50000 }, async () => {
80
- const result = await execAsync("bun run build", {
80
+ const result = await execAsync("pnpm run build", {
81
81
  cwd: tempDir,
82
82
  encoding: "utf8",
83
83
  });
@@ -95,6 +95,9 @@ function createFragmentTestSuite(buildTool: BuildTool, withDatabase: boolean) {
95
95
  // However, the peerDependencies of @fragno-dev/core must not be included
96
96
  expect(reactBundleContent).toMatch(/from\s*['"]react['"]/);
97
97
 
98
+ // db should also not be included in the frontend
99
+ expect(reactBundleContent).not.toMatch(/import\s+.*?\s+from\s+['"]@fragno-dev\/db/);
100
+
98
101
  // Vite builds only the browser bundle
99
102
  if (buildTool !== "vite") {
100
103
  await expect(fs.access(path.join(tempDir, "dist", "node"))).resolves.toBeUndefined();
@@ -1,21 +1,21 @@
1
1
  import type { BuildTools } from "./index";
2
2
 
3
- const fragnoCoreVersion = "^0.1.2";
4
- const fragnoDbVersion = "^0.1.2";
5
- const unpluginFragnoVersion = "^0.0.2";
6
- const fragnoCliVersion = "^0.1.3";
3
+ const fragnoCoreVersion = "^0.1.7";
4
+ const fragnoDbVersion = "^0.1.13";
5
+ const unpluginFragnoVersion = "^0.0.3";
6
+ const fragnoCliVersion = "^0.1.16";
7
7
 
8
8
  export const basePkg: Record<string, unknown> = {
9
9
  dependencies: {
10
10
  "@fragno-dev/core": fragnoCoreVersion,
11
- zod: "^4.0.5",
11
+ zod: "^4.1.12",
12
12
  },
13
13
  devDependencies: {
14
- "@fragno-dev/cli": fragnoCliVersion,
15
14
  "@types/node": "^22",
15
+ "@fragno-dev/cli": fragnoCliVersion,
16
16
  },
17
17
  peerDependencies: {
18
- typescript: "^5",
18
+ typescript: ">=5",
19
19
  react: ">=18.0.0",
20
20
  svelte: ">=4.0.0",
21
21
  "solid-js": ">=1.0.0",
@@ -24,7 +24,10 @@ export const basePkg: Record<string, unknown> = {
24
24
  };
25
25
 
26
26
  export const databasePkg: Record<string, unknown> = {
27
- dependencies: {
27
+ devDependencies: {
28
+ "@fragno-dev/db": fragnoDbVersion,
29
+ },
30
+ peerDependencies: {
28
31
  "@fragno-dev/db": fragnoDbVersion,
29
32
  },
30
33
  };
@@ -34,7 +37,7 @@ export const buildToolPkg: Record<BuildTools, Record<string, unknown>> = {
34
37
  tsdown: {
35
38
  devDependencies: {
36
39
  "@fragno-dev/unplugin-fragno": unpluginFragnoVersion,
37
- tsdown: "^0.11.9",
40
+ tsdown: "^0.12.0",
38
41
  },
39
42
  scripts: {
40
43
  build: "tsdown",
@@ -43,7 +46,7 @@ export const buildToolPkg: Record<BuildTools, Record<string, unknown>> = {
43
46
  esbuild: {
44
47
  devDependencies: {
45
48
  "@fragno-dev/unplugin-fragno": unpluginFragnoVersion,
46
- esbuild: "^0.25.10",
49
+ esbuild: "^0.25.12",
47
50
  },
48
51
  scripts: {
49
52
  build: "./esbuild.config.js",
@@ -52,7 +55,7 @@ export const buildToolPkg: Record<BuildTools, Record<string, unknown>> = {
52
55
  vite: {
53
56
  devDependencies: {
54
57
  "@fragno-dev/unplugin-fragno": unpluginFragnoVersion,
55
- vite: "^6.0.0",
58
+ vite: "^6.3.5",
56
59
  },
57
60
  scripts: {
58
61
  build: "vite build",
@@ -64,7 +67,7 @@ export const buildToolPkg: Record<BuildTools, Record<string, unknown>> = {
64
67
  "@rollup/plugin-node-resolve": "^16.0.2",
65
68
  "@rollup/plugin-typescript": "^12.1.4",
66
69
  tslib: "^2.8.1",
67
- rollup: "^4.52.4",
70
+ rollup: "^4.41.0",
68
71
  },
69
72
  scripts: {
70
73
  build: "rollup -c",
@@ -73,7 +76,7 @@ export const buildToolPkg: Record<BuildTools, Record<string, unknown>> = {
73
76
  webpack: {
74
77
  devDependencies: {
75
78
  "@fragno-dev/unplugin-fragno": unpluginFragnoVersion,
76
- webpack: "^5.102.0",
79
+ webpack: "^5.99.9",
77
80
  "webpack-cli": "^6.0.1",
78
81
  "ts-loader": "^9.5.1",
79
82
  },
@@ -84,8 +87,8 @@ export const buildToolPkg: Record<BuildTools, Record<string, unknown>> = {
84
87
  rspack: {
85
88
  devDependencies: {
86
89
  "@fragno-dev/unplugin-fragno": unpluginFragnoVersion,
87
- "@rspack/core": "^1.5.8",
88
- "@rspack/cli": "^1.5.8",
90
+ "@rspack/core": "^1.6.1",
91
+ "@rspack/cli": "^1.6.1",
89
92
  },
90
93
  scripts: {
91
94
  build: "rspack build",
@@ -61,7 +61,7 @@ const exampleFragmentDefinition = defineFragment<ExampleConfig>("example-fragmen
61
61
  serverSideData: { value: config.initialData ?? "Hello World! This is a server-side data." },
62
62
  };
63
63
  })
64
- .withServices(({ deps }) => {
64
+ .providesService(({ deps }) => {
65
65
  return {
66
66
  getData: () => deps.serverSideData.value,
67
67
  };
@@ -40,7 +40,7 @@ export function createMyFragment(
40
40
  ```
41
41
 
42
42
  For complete database documentation, see:
43
- https://fragno.dev/docs/for-library-authors/database-integration/overview.md
43
+ https://fragno.dev/docs/fragno/for-library-authors/database-integration/overview.md
44
44
 
45
45
  ## File Structure & Core Concepts
46
46
 
@@ -96,9 +96,9 @@ client builder.
96
96
 
97
97
  Each framework requires a separate client file that wraps the generic client builder with the
98
98
  framework-specific `useFragno` hook. Check the `src/client/` directory for existing framework
99
- implementations. Use the frameworks page on https://fragno.dev/docs/frameworks to see if all clients
100
- have their stubs defined. Make sure to include new frameworks in the exports section of
101
- package.json.
99
+ implementations. Use the frameworks page on https://fragno.dev/docs/fragno/reference/frameworks to
100
+ see if all clients have their stubs defined. Make sure to include new frameworks in the exports
101
+ section of package.json.
102
102
 
103
103
  ### `package.json` - Package Configuration
104
104
 
@@ -131,17 +131,32 @@ Use `defineFragmentWithDatabase()` when your Fragment needs to:
131
131
  Database schemas are defined in a separate `schema.ts` file using the Fragno schema builder:
132
132
 
133
133
  ```typescript
134
- import { column, idColumn, schema } from "@fragno-dev/db/schema";
134
+ import { column, idColumn, referenceColumn, schema } from "@fragno-dev/db/schema";
135
135
 
136
136
  export const noteSchema = schema((s) => {
137
- return s.addTable("note", (t) => {
138
- return t
139
- .addColumn("id", idColumn()) // Auto-generated ID
140
- .addColumn("content", column("string"))
141
- .addColumn("userId", column("string"))
142
- .addColumn("createdAt", column("timestamp").defaultTo$("now"))
143
- .createIndex("idx_note_user", ["userId"]); // Index for efficient queries
144
- });
137
+ return s
138
+ .addTable("users", (t) => {
139
+ return t.addColumn("id", idColumn()).addColumn("name", column("string"));
140
+ })
141
+ .addTable("note", (t) => {
142
+ return t
143
+ .addColumn("id", idColumn()) // Auto-generated ID
144
+ .addColumn("content", column("string"))
145
+ .addColumn("userId", referenceColumn())
146
+ .addColumn("createdAt", column("timestamp").defaultTo$("now"))
147
+ .createIndex("idx_note_user", ["userId"]);
148
+ })
149
+ .addReference("author", {
150
+ from: {
151
+ table: "note",
152
+ column: "userId",
153
+ },
154
+ to: {
155
+ table: "user",
156
+ column: "id",
157
+ },
158
+ type: "one",
159
+ });
145
160
  });
146
161
  ```
147
162
 
@@ -247,7 +262,7 @@ Fragments require code splitting between client and server bundles using
247
262
  ### Type Checking
248
263
 
249
264
  ```bash
250
- bun run types:check
265
+ pnpm run types:check
251
266
  ```
252
267
 
253
268
  ## Common Patterns
@@ -9,6 +9,7 @@ build({
9
9
  "./src/client/svelte.ts",
10
10
  "./src/client/vanilla.ts",
11
11
  "./src/client/vue.ts",
12
+ "./src/client/solid.ts",
12
13
  ],
13
14
  outdir: "./dist/browser",
14
15
  bundle: true,
@@ -18,7 +19,7 @@ build({
18
19
  splitting: true,
19
20
  sourcemap: true,
20
21
  plugins: [unpluginFragno({ platform: "browser" })],
21
- external: ["react", "svelte", "vue", "zod"],
22
+ external: ["react", "svelte", "vue", "solid-js", "@fragno-dev/db"],
22
23
  });
23
24
 
24
25
  build({
@@ -27,8 +28,7 @@ build({
27
28
  bundle: true,
28
29
  format: "esm",
29
30
  platform: "node",
30
- target: "node18",
31
+ target: "node22",
31
32
  sourcemap: true,
32
33
  plugins: [unpluginFragno({ platform: "node" })],
33
- external: ["zod"],
34
34
  });
@@ -11,6 +11,7 @@ export default [
11
11
  "client/svelte": "./src/client/svelte.ts",
12
12
  "client/vanilla": "./src/client/vanilla.ts",
13
13
  "client/vue": "./src/client/vue.ts",
14
+ "client/solid": "./src/client/solid.ts",
14
15
  },
15
16
  output: {
16
17
  dir: "./dist/browser",
@@ -18,7 +19,7 @@ export default [
18
19
  sourcemap: true,
19
20
  },
20
21
  // https://rollupjs.org/tools/#peer-dependencies
21
- external: ["zod", "react", "svelte", "vue"],
22
+ external: ["zod", "react", "svelte", "vue", "solid-js", /^@fragno-dev\/db/],
22
23
  plugins: [
23
24
  resolve({
24
25
  moduleDirectories: ["node_modules"],
@@ -41,7 +42,6 @@ export default [
41
42
  format: "es",
42
43
  sourcemap: true,
43
44
  },
44
- external: ["zod"],
45
45
  plugins: [
46
46
  resolve({
47
47
  moduleDirectories: ["node_modules"],
@@ -16,6 +16,7 @@ export default [
16
16
  "client/svelte": "./src/client/svelte.ts",
17
17
  "client/vanilla": "./src/client/vanilla.ts",
18
18
  "client/vue": "./src/client/vue.ts",
19
+ "client/solid": "./src/client/solid.ts",
19
20
  },
20
21
  output: {
21
22
  path: path.resolve(__dirname, "dist/browser"),
@@ -48,7 +49,7 @@ export default [
48
49
  },
49
50
  plugins: [unpluginFragno({ platform: "browser" })],
50
51
  devtool: "source-map",
51
- externals: ["zod", "react", "vue", "svelte"],
52
+ externals: ["zod", "react", "vue", "svelte", "solid-js", /^@fragno-dev\/db/],
52
53
  },
53
54
  // Node build
54
55
  {
@@ -88,6 +89,6 @@ export default [
88
89
  },
89
90
  plugins: [unpluginFragno({ platform: "node" })],
90
91
  devtool: "source-map",
91
- externals: ["zod"],
92
+ externals: ["zod", /^@fragno-dev\/core/, /^@fragno-dev\/db/],
92
93
  },
93
94
  ];
@@ -12,11 +12,12 @@ export default defineConfig({
12
12
  "client/svelte": "./src/client/svelte.ts",
13
13
  "client/vanilla": "./src/client/vanilla.ts",
14
14
  "client/vue": "./src/client/vue.ts",
15
+ "client/solid": "./src/client/solid.ts",
15
16
  },
16
17
  formats: ["es"],
17
18
  },
18
19
  rollupOptions: {
19
- external: ["react", "vue", "svelte", "zod"],
20
+ external: ["react", "vue", "svelte", "solid-js", "zod", /^@fragno-dev\/db/],
20
21
  },
21
22
  outDir: "./dist/browser",
22
23
  sourcemap: true,
@@ -16,6 +16,7 @@ export default [
16
16
  "client/svelte": "./src/client/svelte.ts",
17
17
  "client/vanilla": "./src/client/vanilla.ts",
18
18
  "client/vue": "./src/client/vue.ts",
19
+ "client/solid": "./src/client/solid.ts",
19
20
  },
20
21
  output: {
21
22
  path: path.resolve(__dirname, "dist/browser"),
@@ -41,7 +42,7 @@ export default [
41
42
  },
42
43
  plugins: [unpluginFragno({ platform: "browser" })],
43
44
  devtool: "source-map",
44
- externals: ["react", "vue", "svelte", "zod"],
45
+ externals: ["react", "vue", "svelte", "solid-js", "zod", /^@fragno-dev\/db/],
45
46
  },
46
47
  // Node build
47
48
  {
@@ -74,6 +75,6 @@ export default [
74
75
  },
75
76
  plugins: [unpluginFragno({ platform: "node" })],
76
77
  devtool: "source-map",
77
- externals: ["zod"],
78
+ externals: ["zod", /^@fragno-dev\/core/, /^@fragno-dev\/db/],
78
79
  },
79
80
  ];
@@ -9,7 +9,7 @@ import {
9
9
  defineFragmentWithDatabase,
10
10
  type FragnoPublicConfigWithDatabase,
11
11
  } from "@fragno-dev/db/fragment";
12
- import type { AbstractQuery, TableToInsertValues } from "@fragno-dev/db/query";
12
+ import type { TableToInsertValues } from "@fragno-dev/db/query";
13
13
  import { noteSchema } from "./schema";
14
14
 
15
15
  // NOTE: We use zod here for defining schemas, but any StandardSchema library can be used!
@@ -46,11 +46,7 @@ type ExampleServices = {
46
46
  >;
47
47
  };
48
48
 
49
- type ExampleDeps = {
50
- orm: AbstractQuery<typeof noteSchema>;
51
- };
52
-
53
- const exampleRoutesFactory = defineRoutes<ExampleConfig, ExampleDeps, ExampleServices>().create(
49
+ const exampleRoutesFactory = defineRoutes<ExampleConfig, {}, ExampleServices>().create(
54
50
  ({ services }) => {
55
51
  return [
56
52
  defineRoute({
@@ -102,10 +98,10 @@ const exampleRoutesFactory = defineRoutes<ExampleConfig, ExampleDeps, ExampleSer
102
98
 
103
99
  const exampleFragmentDefinition = defineFragmentWithDatabase<ExampleConfig>("example-fragment")
104
100
  .withDatabase(noteSchema)
105
- .withServices(({ orm }) => {
101
+ .providesService(({ db }) => {
106
102
  return {
107
103
  createNote: async (note: TableToInsertValues<typeof noteSchema.tables.note>) => {
108
- const id = await orm.create("note", note);
104
+ const id = await db.create("note", note);
109
105
  return {
110
106
  ...note,
111
107
  id: id.toJSON(),
@@ -113,10 +109,10 @@ const exampleFragmentDefinition = defineFragmentWithDatabase<ExampleConfig>("exa
113
109
  };
114
110
  },
115
111
  getNotes: () => {
116
- return orm.find("note", (b) => b);
112
+ return db.find("note", (b) => b);
117
113
  },
118
114
  getNotesByUser: (userId: string) => {
119
- return orm.find("note", (b) =>
115
+ return db.find("note", (b) =>
120
116
  b.whereIndex("idx_note_user", (eb) => eb("userId", "=", userId)),
121
117
  );
122
118
  },