@appstrate/ui 1.0.0 → 1.0.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.
Files changed (3) hide show
  1. package/README.md +13 -0
  2. package/package.json +12 -4
  3. package/src/vite.js +48 -0
package/README.md CHANGED
@@ -34,6 +34,19 @@ The widget is i18n-agnostic — pass translated strings via `labels`. See `apps/
34
34
  ## Exports
35
35
 
36
36
  - `./schema-form` — `SchemaForm` component, `FileWidgetLabels` type, RJSF widgets/templates.
37
+ - `./vite` — Vite preset that pre-bundles the schema-form dep graph (RJSF + ajv + transitive CJS). Use it via `mergeConfig`:
38
+
39
+ ```ts
40
+ import { defineConfig, mergeConfig } from "vite";
41
+ import { viteConfig as appstrateUi } from "@appstrate/ui/vite";
42
+
43
+ export default mergeConfig(
44
+ appstrateUi,
45
+ defineConfig({
46
+ /* app config */
47
+ }),
48
+ );
49
+ ```
37
50
 
38
51
  ## License
39
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appstrate/ui",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Shared React UI components for Appstrate surfaces — schema-driven forms, upload widget, RJSF templates",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -36,7 +36,8 @@
36
36
  "NOTICE"
37
37
  ],
38
38
  "exports": {
39
- "./schema-form": "./src/schema-form/index.tsx"
39
+ "./schema-form": "./src/schema-form/index.tsx",
40
+ "./vite": "./src/vite.js"
40
41
  },
41
42
  "dependencies": {
42
43
  "tailwind-merge": "^3.0.0"
@@ -50,7 +51,13 @@
50
51
  "react": "^19",
51
52
  "react-dom": "^19",
52
53
  "react-select": "^5",
53
- "typescript": "^5"
54
+ "typescript": "^5",
55
+ "vite": "^5 || ^6 || ^7"
56
+ },
57
+ "peerDependenciesMeta": {
58
+ "vite": {
59
+ "optional": true
60
+ }
54
61
  },
55
62
  "devDependencies": {
56
63
  "@appstrate/core": "workspace:*",
@@ -64,7 +71,8 @@
64
71
  "react": "^19.2.5",
65
72
  "react-dom": "^19.2.5",
66
73
  "react-select": "^5.10.2",
67
- "typescript": "^5.7.0"
74
+ "typescript": "^5.7.0",
75
+ "vite": "^6.0.0"
68
76
  },
69
77
  "scripts": {
70
78
  "typecheck": "tsc --noEmit",
package/src/vite.js ADDED
@@ -0,0 +1,48 @@
1
+ // Copyright 2025-2026 Appstrate
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /**
5
+ * Vite preset for consumers of `@appstrate/ui/schema-form`.
6
+ *
7
+ * The schema-form widget pulls a CJS-heavy graph (RJSF → ajv → fast-uri,
8
+ * jsonpointer, …). Vite's auto-discovery doesn't follow every subpath
9
+ * import (notably `ajv/dist/2020.js`), so we list the entry points
10
+ * explicitly here. Bundling this knowledge into the package keeps
11
+ * consumers from having to maintain it themselves.
12
+ *
13
+ * Shipped as `.js` (not `.ts`) so Node — which loads Vite configs —
14
+ * can require this file directly from `node_modules` without TypeScript
15
+ * stripping (unsupported under `node_modules`).
16
+ *
17
+ * Usage:
18
+ *
19
+ * import { defineConfig, mergeConfig } from "vite";
20
+ * import { viteConfig as appstrateUi } from "@appstrate/ui/vite";
21
+ *
22
+ * export default mergeConfig(
23
+ * appstrateUi,
24
+ * defineConfig({
25
+ * // your app config
26
+ * }),
27
+ * );
28
+ *
29
+ * @type {import("vite").UserConfig}
30
+ */
31
+ export const viteConfig = {
32
+ optimizeDeps: {
33
+ include: [
34
+ "@appstrate/core/form",
35
+ "@appstrate/core/ajv",
36
+ "@appstrate/ui/schema-form",
37
+ "@rjsf/core",
38
+ "@rjsf/utils",
39
+ "@rjsf/validator-ajv8",
40
+ "ajv/dist/2020.js",
41
+ "ajv-formats",
42
+ "fast-uri",
43
+ "jsonpointer",
44
+ "react-select",
45
+ "lucide-react",
46
+ ],
47
+ },
48
+ };