@specverse/engines 4.1.28 → 4.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/assets/examples/manifests/frontend-only.yaml +3 -6
- package/assets/examples/manifests/fullstack-app.yaml +5 -7
- package/assets/examples/manifests/fullstack-monorepo.yaml +3 -6
- package/dist/inference/comprehensive-engine.d.ts.map +1 -1
- package/dist/inference/comprehensive-engine.js +3 -19
- package/dist/inference/comprehensive-engine.js.map +1 -1
- package/dist/inference/core/rule-engine.d.ts +31 -0
- package/dist/inference/core/rule-engine.d.ts.map +1 -1
- package/dist/inference/core/rule-engine.js +117 -33
- package/dist/inference/core/rule-engine.js.map +1 -1
- package/dist/inference/core/rule-file-types.d.ts +0 -2
- package/dist/inference/core/rule-file-types.d.ts.map +1 -1
- package/dist/inference/core/rule-file-types.js +3 -6
- package/dist/inference/core/rule-file-types.js.map +1 -1
- package/dist/inference/core/rule-loader.d.ts +5 -15
- package/dist/inference/core/rule-loader.d.ts.map +1 -1
- package/dist/inference/core/rule-loader.js +43 -132
- package/dist/inference/core/rule-loader.js.map +1 -1
- package/dist/inference/core/types.d.ts +0 -6
- package/dist/inference/core/types.d.ts.map +1 -1
- package/dist/inference/core/types.js +0 -4
- package/dist/inference/core/types.js.map +1 -1
- package/dist/inference/logical/generators/component-type-resolver.d.ts +0 -26
- package/dist/inference/logical/generators/component-type-resolver.d.ts.map +1 -1
- package/dist/inference/logical/generators/component-type-resolver.js +0 -19
- package/dist/inference/logical/generators/component-type-resolver.js.map +1 -1
- package/dist/inference/logical/generators/specialist-view-expander.d.ts +1 -17
- package/dist/inference/logical/generators/specialist-view-expander.d.ts.map +1 -1
- package/dist/inference/logical/generators/specialist-view-expander.js +0 -15
- package/dist/inference/logical/generators/specialist-view-expander.js.map +1 -1
- package/dist/inference/logical/generators/view-generator.d.ts +4 -14
- package/dist/inference/logical/generators/view-generator.d.ts.map +1 -1
- package/dist/inference/logical/generators/view-generator.js +6 -26
- package/dist/inference/logical/generators/view-generator.js.map +1 -1
- package/dist/inference/logical/index.d.ts +2 -2
- package/dist/inference/logical/index.d.ts.map +1 -1
- package/dist/inference/logical/logical-engine.d.ts.map +1 -1
- package/dist/inference/logical/logical-engine.js +17 -80
- package/dist/inference/logical/logical-engine.js.map +1 -1
- package/dist/inference/quint-transpiler.d.ts +5 -3
- package/dist/inference/quint-transpiler.d.ts.map +1 -1
- package/dist/inference/quint-transpiler.js +11 -6
- package/dist/inference/quint-transpiler.js.map +1 -1
- package/dist/libs/instance-factories/applications/templates/generic/main-generator.js +3 -3
- package/dist/libs/instance-factories/applications/templates/react/api-client-generator.js +16 -6
- package/dist/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.js +110 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.js +121 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/detail-body-composer.js +78 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/form-body-composer.js +190 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/helpers-emitter.js +45 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/html-to-jsx.js +192 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/list-body-composer.js +46 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/orchestrator.js +30 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/package-json-generator.js +38 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/regen-safety.js +89 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/view-emitter.js +56 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/views-generator.js +66 -0
- package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +14 -11
- package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +11 -3
- package/dist/libs/instance-factories/services/templates/prisma/controller-generator.js +27 -17
- package/dist/libs/instance-factories/shared/path-resolver.js +1 -1
- package/dist/realize/index.d.ts.map +1 -1
- package/dist/realize/index.js +15 -22
- package/dist/realize/index.js.map +1 -1
- package/dist/registry/utils/manifest-adapter.d.ts +8 -1
- package/dist/registry/utils/manifest-adapter.d.ts.map +1 -1
- package/dist/registry/utils/manifest-adapter.js +8 -1
- package/dist/registry/utils/manifest-adapter.js.map +1 -1
- package/libs/instance-factories/applications/react-app-starter.yaml +150 -0
- package/libs/instance-factories/applications/templates/generic/main-generator.ts +3 -3
- package/libs/instance-factories/applications/templates/react/api-client-generator.ts +16 -6
- package/libs/instance-factories/applications/templates/react-starter/README.md +211 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/dashboard-body-composer.test.ts +153 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/detail-body-composer.test.ts +145 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/form-body-composer.test.ts +175 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/helpers-emitter.test.ts +55 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/html-to-jsx.test.ts +140 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/list-body-composer.test.ts +146 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/orchestrator.test.ts +163 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p2-factory-imports.test.ts +116 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p3-rendered-output.test.ts +183 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/regen-safety.test.ts +144 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/starter-generators.test.ts +114 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/view-emitter.test.ts +107 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/views-generator.test.ts +139 -0
- package/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.ts +141 -0
- package/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.ts +174 -0
- package/libs/instance-factories/applications/templates/react-starter/detail-body-composer.ts +135 -0
- package/libs/instance-factories/applications/templates/react-starter/form-body-composer.ts +306 -0
- package/libs/instance-factories/applications/templates/react-starter/helpers-emitter.ts +60 -0
- package/libs/instance-factories/applications/templates/react-starter/html-to-jsx.ts +334 -0
- package/libs/instance-factories/applications/templates/react-starter/list-body-composer.ts +120 -0
- package/libs/instance-factories/applications/templates/react-starter/orchestrator.ts +80 -0
- package/libs/instance-factories/applications/templates/react-starter/package-json-generator.ts +57 -0
- package/libs/instance-factories/applications/templates/react-starter/regen-safety.ts +157 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +47 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +94 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +114 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +72 -0
- package/libs/instance-factories/applications/templates/react-starter/view-emitter.ts +151 -0
- package/libs/instance-factories/applications/templates/react-starter/views-generator.ts +137 -0
- package/libs/instance-factories/cli/templates/commander/command-generator.ts +14 -11
- package/libs/instance-factories/controllers/templates/fastify/server-generator.ts +11 -3
- package/libs/instance-factories/services/templates/prisma/controller-generator.ts +27 -17
- package/libs/instance-factories/shared/path-resolver.ts +8 -2
- package/package.json +3 -3
- package/dist/libs/instance-factories/applications/templates/react/_view-components-source.js +0 -530
- package/dist/libs/instance-factories/applications/templates/react/app-tsx-generator.js +0 -73
- package/dist/libs/instance-factories/applications/templates/react/field-helpers-generator.js +0 -99
- package/dist/libs/instance-factories/applications/templates/react/package-json-generator.js +0 -49
- package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js +0 -156
- package/dist/libs/instance-factories/applications/templates/react/react-pattern-adapter.js +0 -935
- package/dist/libs/instance-factories/applications/templates/react/relationship-field-generator.js +0 -143
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.js +0 -646
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.js +0 -65
- package/dist/libs/instance-factories/applications/templates/react/view-dashboard-generator.js +0 -143
- package/dist/libs/instance-factories/applications/templates/react/view-detail-generator.js +0 -143
- package/dist/libs/instance-factories/applications/templates/react/view-form-generator.js +0 -355
- package/dist/libs/instance-factories/applications/templates/react/view-list-generator.js +0 -91
- package/dist/libs/instance-factories/applications/templates/react/view-router-generator.js +0 -79
- package/dist/libs/instance-factories/tools/templates/vscode/vscode-extension-generator.js.bak +0 -244
- package/dist/libs/instance-factories/views/index.js +0 -48
- package/dist/libs/instance-factories/views/templates/react/adapters/antd-adapter.js +0 -742
- package/dist/libs/instance-factories/views/templates/react/adapters/mui-adapter.js +0 -824
- package/dist/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.js +0 -719
- package/dist/libs/instance-factories/views/templates/react/app-generator.js +0 -45
- package/dist/libs/instance-factories/views/templates/react/components-generator.js +0 -820
- package/dist/libs/instance-factories/views/templates/react/forms-generator.js +0 -275
- package/dist/libs/instance-factories/views/templates/react/frontend-package-json-generator.js +0 -46
- package/dist/libs/instance-factories/views/templates/react/hooks-generator.js +0 -81
- package/dist/libs/instance-factories/views/templates/react/index-css-generator.js +0 -9
- package/dist/libs/instance-factories/views/templates/react/index-html-generator.js +0 -23
- package/dist/libs/instance-factories/views/templates/react/main-tsx-generator.js +0 -21
- package/dist/libs/instance-factories/views/templates/react/react-component-generator.js +0 -299
- package/dist/libs/instance-factories/views/templates/react/router-generator.js +0 -136
- package/dist/libs/instance-factories/views/templates/react/router-generic-generator.js +0 -107
- package/dist/libs/instance-factories/views/templates/react/shared-utils-generator.js +0 -187
- package/dist/libs/instance-factories/views/templates/react/spec-json-generator.js +0 -7
- package/dist/libs/instance-factories/views/templates/react/types-generator.js +0 -56
- package/dist/libs/instance-factories/views/templates/react/views-metadata-generator.js +0 -27
- package/dist/libs/instance-factories/views/templates/react/vite-config-generator.js +0 -29
- package/dist/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js +0 -261
- package/dist/libs/instance-factories/views/templates/shared/adapter-types.js +0 -34
- package/dist/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -800
- package/dist/libs/instance-factories/views/templates/shared/base-generator.js +0 -305
- package/dist/libs/instance-factories/views/templates/shared/component-metadata.js +0 -517
- package/dist/libs/instance-factories/views/templates/shared/composite-pattern-types.js +0 -0
- package/dist/libs/instance-factories/views/templates/shared/composite-patterns.js +0 -445
- package/dist/libs/instance-factories/views/templates/shared/index.js +0 -80
- package/dist/libs/instance-factories/views/templates/shared/pattern-validator.js +0 -210
- package/dist/libs/instance-factories/views/templates/shared/property-mapper.js +0 -492
- package/dist/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -321
- package/dist/realize/index.js.bak +0 -758
- package/libs/instance-factories/applications/react-app.yaml +0 -186
- package/libs/instance-factories/applications/templates/react/_view-components-source.ts +0 -555
- package/libs/instance-factories/applications/templates/react/app-tsx-generator.ts +0 -94
- package/libs/instance-factories/applications/templates/react/field-helpers-generator.ts +0 -106
- package/libs/instance-factories/applications/templates/react/package-json-generator.ts +0 -57
- package/libs/instance-factories/applications/templates/react/pattern-adapter-generator.ts +0 -179
- package/libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx +0 -1347
- package/libs/instance-factories/applications/templates/react/relationship-field-generator.ts +0 -150
- package/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.ts +0 -704
- package/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.ts +0 -84
- package/libs/instance-factories/applications/templates/react/view-dashboard-generator.ts +0 -150
- package/libs/instance-factories/applications/templates/react/view-detail-generator.ts +0 -150
- package/libs/instance-factories/applications/templates/react/view-form-generator.ts +0 -362
- package/libs/instance-factories/applications/templates/react/view-list-generator.ts +0 -98
- package/libs/instance-factories/applications/templates/react/view-router-generator.ts +0 -89
- package/libs/instance-factories/views/README.md +0 -62
- package/libs/instance-factories/views/index.d.ts +0 -13
- package/libs/instance-factories/views/index.d.ts.map +0 -1
- package/libs/instance-factories/views/index.js +0 -18
- package/libs/instance-factories/views/index.js.map +0 -1
- package/libs/instance-factories/views/index.ts +0 -45
- package/libs/instance-factories/views/react-components.yaml +0 -129
- package/libs/instance-factories/views/templates/ARCHITECTURE.md +0 -198
- package/libs/instance-factories/views/templates/react/adapters/antd-adapter.ts +0 -869
- package/libs/instance-factories/views/templates/react/adapters/mui-adapter.ts +0 -953
- package/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.ts +0 -806
- package/libs/instance-factories/views/templates/react/app-generator.ts +0 -55
- package/libs/instance-factories/views/templates/react/components-generator.ts +0 -938
- package/libs/instance-factories/views/templates/react/forms-generator.ts +0 -325
- package/libs/instance-factories/views/templates/react/frontend-package-json-generator.ts +0 -57
- package/libs/instance-factories/views/templates/react/hooks-generator.ts +0 -106
- package/libs/instance-factories/views/templates/react/index-css-generator.ts +0 -14
- package/libs/instance-factories/views/templates/react/index-html-generator.ts +0 -34
- package/libs/instance-factories/views/templates/react/main-tsx-generator.ts +0 -29
- package/libs/instance-factories/views/templates/react/react-component-generator.d.ts +0 -152
- package/libs/instance-factories/views/templates/react/react-component-generator.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/react/react-component-generator.js +0 -398
- package/libs/instance-factories/views/templates/react/react-component-generator.js.map +0 -1
- package/libs/instance-factories/views/templates/react/react-component-generator.ts +0 -533
- package/libs/instance-factories/views/templates/react/router-generator.ts +0 -197
- package/libs/instance-factories/views/templates/react/router-generic-generator.ts +0 -132
- package/libs/instance-factories/views/templates/react/shared-utils-generator.ts +0 -196
- package/libs/instance-factories/views/templates/react/spec-json-generator.ts +0 -17
- package/libs/instance-factories/views/templates/react/types-generator.ts +0 -76
- package/libs/instance-factories/views/templates/react/views-metadata-generator.ts +0 -42
- package/libs/instance-factories/views/templates/react/vite-config-generator.ts +0 -38
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js.map +0 -1
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.ts +0 -474
- package/libs/instance-factories/views/templates/shared/__tests__/composite-patterns.test.ts +0 -242
- package/libs/instance-factories/views/templates/shared/adapter-types.d.ts +0 -77
- package/libs/instance-factories/views/templates/shared/adapter-types.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/adapter-types.js +0 -47
- package/libs/instance-factories/views/templates/shared/adapter-types.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/adapter-types.ts +0 -142
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts +0 -63
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -822
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.ts +0 -908
- package/libs/instance-factories/views/templates/shared/base-generator.d.ts +0 -247
- package/libs/instance-factories/views/templates/shared/base-generator.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/base-generator.js +0 -363
- package/libs/instance-factories/views/templates/shared/base-generator.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/base-generator.ts +0 -608
- package/libs/instance-factories/views/templates/shared/component-metadata.d.ts +0 -254
- package/libs/instance-factories/views/templates/shared/component-metadata.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/component-metadata.js +0 -602
- package/libs/instance-factories/views/templates/shared/component-metadata.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/component-metadata.ts +0 -803
- package/libs/instance-factories/views/templates/shared/composite-pattern-types.ts +0 -250
- package/libs/instance-factories/views/templates/shared/composite-patterns.ts +0 -535
- package/libs/instance-factories/views/templates/shared/index.ts +0 -68
- package/libs/instance-factories/views/templates/shared/pattern-validator.ts +0 -279
- package/libs/instance-factories/views/templates/shared/property-mapper.d.ts +0 -149
- package/libs/instance-factories/views/templates/shared/property-mapper.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/property-mapper.js +0 -580
- package/libs/instance-factories/views/templates/shared/property-mapper.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/property-mapper.ts +0 -700
- package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts +0 -143
- package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -420
- package/libs/instance-factories/views/templates/shared/syntax-mapper.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/syntax-mapper.ts +0 -539
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
function generatePackageJson(context) {
|
|
2
|
-
const { spec } = context;
|
|
3
|
-
const appName = spec.metadata?.component?.toLowerCase() || "frontend";
|
|
4
|
-
const version = spec.metadata?.version || "1.0.0";
|
|
5
|
-
const description = spec.metadata?.description || "Frontend application";
|
|
6
|
-
const pkg = {
|
|
7
|
-
name: `${appName}-frontend`,
|
|
8
|
-
version,
|
|
9
|
-
description,
|
|
10
|
-
private: true,
|
|
11
|
-
type: "module",
|
|
12
|
-
scripts: {
|
|
13
|
-
dev: "vite",
|
|
14
|
-
build: "tsc && vite build",
|
|
15
|
-
preview: "vite preview",
|
|
16
|
-
test: "echo 'No tests configured for frontend'",
|
|
17
|
-
lint: "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
|
|
18
|
-
},
|
|
19
|
-
dependencies: {
|
|
20
|
-
"react": "^18.2.0",
|
|
21
|
-
"react-dom": "^18.2.0",
|
|
22
|
-
"react-router-dom": "^6.18.0",
|
|
23
|
-
"@tanstack/react-query": "^5.0.0",
|
|
24
|
-
"react-hook-form": "^7.48.0",
|
|
25
|
-
"zod": "^3.22.0",
|
|
26
|
-
"@hookform/resolvers": "^3.3.0",
|
|
27
|
-
"zustand": "^4.4.0"
|
|
28
|
-
},
|
|
29
|
-
devDependencies: {
|
|
30
|
-
"@types/react": "^18.2.0",
|
|
31
|
-
"@types/react-dom": "^18.2.0",
|
|
32
|
-
"@vitejs/plugin-react": "^4.2.0",
|
|
33
|
-
"autoprefixer": "^10.4.20",
|
|
34
|
-
"postcss": "^8.4.47",
|
|
35
|
-
"tailwindcss": "^3.4.13",
|
|
36
|
-
"typescript": "^5.2.0",
|
|
37
|
-
"vite": "^6.0.0",
|
|
38
|
-
"eslint": "^9.0.0",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
40
|
-
"@typescript-eslint/parser": "^8.0.0",
|
|
41
|
-
"eslint-plugin-react-hooks": "^5.0.0",
|
|
42
|
-
"eslint-plugin-react-refresh": "^0.4.4"
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
return JSON.stringify(pkg, null, 2);
|
|
46
|
-
}
|
|
47
|
-
export {
|
|
48
|
-
generatePackageJson as default
|
|
49
|
-
};
|
package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { readFileSync, existsSync } from "fs";
|
|
2
|
-
import { join, dirname } from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
async function generate(context) {
|
|
5
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = dirname(__filename);
|
|
7
|
-
const possiblePaths = [
|
|
8
|
-
// PRIORITY 0: Same directory as this generator (source)
|
|
9
|
-
join(__dirname, "react-pattern-adapter.tsx"),
|
|
10
|
-
// PRIORITY 1: Bundled with package (in libs/ directory, from dist/)
|
|
11
|
-
join(__dirname, "../../../../../../libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx"),
|
|
12
|
-
// Up from dist to package root then into libs
|
|
13
|
-
join(__dirname, "../../../../../libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx"),
|
|
14
|
-
join(__dirname, "../../../../libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx"),
|
|
15
|
-
// Development environment (specverse-app-demo sibling)
|
|
16
|
-
join(__dirname, "../../../../../../../specverse-app-demo/frontend-react/src/lib/react-pattern-adapter.tsx")
|
|
17
|
-
];
|
|
18
|
-
let adapterSource = null;
|
|
19
|
-
let foundPath = null;
|
|
20
|
-
for (const path of possiblePaths) {
|
|
21
|
-
if (existsSync(path)) {
|
|
22
|
-
try {
|
|
23
|
-
adapterSource = readFileSync(path, "utf-8");
|
|
24
|
-
foundPath = path;
|
|
25
|
-
break;
|
|
26
|
-
} catch (error) {
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (adapterSource) {
|
|
31
|
-
return `/**
|
|
32
|
-
* ReactPatternAdapter - Pattern-Based View Rendering
|
|
33
|
-
*
|
|
34
|
-
* AUTO-GENERATED: Copied from specverse-app-demo
|
|
35
|
-
* Source: ${foundPath}
|
|
36
|
-
*
|
|
37
|
-
* This file provides pattern detection and React/Tailwind rendering for
|
|
38
|
-
* tech-independent composite patterns. It is bundled with generated code
|
|
39
|
-
* for standalone deployment.
|
|
40
|
-
*
|
|
41
|
-
* Imports COMPOSITE_VIEW_PATTERNS and types from @specverse/engine-realize
|
|
42
|
-
* which are exported from the published npm package.
|
|
43
|
-
*
|
|
44
|
-
* DO NOT EDIT: Changes will be overwritten on next generation.
|
|
45
|
-
* To customize, create a wrapper or modify the original source.
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
${adapterSource}
|
|
49
|
-
`;
|
|
50
|
-
}
|
|
51
|
-
return `/**
|
|
52
|
-
* ReactPatternAdapter - Pattern-Based View Rendering (STUB)
|
|
53
|
-
*
|
|
54
|
-
* \u26A0\uFE0F WARNING: Could not locate react-pattern-adapter.tsx source file.
|
|
55
|
-
*
|
|
56
|
-
* This is a stub implementation that imports from @specverse/engine-realize.
|
|
57
|
-
* For full functionality, ensure specverse-app-demo is available at generation time.
|
|
58
|
-
*
|
|
59
|
-
* Attempted paths:
|
|
60
|
-
${possiblePaths.map((p) => ` * - ${p}`).join("\n")}
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
import { useMemo } from 'react';
|
|
64
|
-
import {
|
|
65
|
-
COMPOSITE_VIEW_PATTERNS,
|
|
66
|
-
type CompositeViewPattern,
|
|
67
|
-
type CURVEDOperation
|
|
68
|
-
} from '@specverse/engines/realize';
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* React-specific protocol mapping for CURVED operations (STUB)
|
|
72
|
-
*/
|
|
73
|
-
export const REACT_PROTOCOL_MAPPING: Record<CURVEDOperation, {
|
|
74
|
-
method: string;
|
|
75
|
-
pathPattern: string;
|
|
76
|
-
}> = {
|
|
77
|
-
create: {
|
|
78
|
-
method: 'POST',
|
|
79
|
-
pathPattern: '/api/{resource}'
|
|
80
|
-
},
|
|
81
|
-
update: {
|
|
82
|
-
method: 'PUT',
|
|
83
|
-
pathPattern: '/api/{resource}/{id}'
|
|
84
|
-
},
|
|
85
|
-
retrieve: {
|
|
86
|
-
method: 'GET',
|
|
87
|
-
pathPattern: '/api/{resource}/{id}'
|
|
88
|
-
},
|
|
89
|
-
retrieve_many: {
|
|
90
|
-
method: 'GET',
|
|
91
|
-
pathPattern: '/api/{resource}'
|
|
92
|
-
},
|
|
93
|
-
validate: {
|
|
94
|
-
method: 'POST',
|
|
95
|
-
pathPattern: '/api/{resource}/validate'
|
|
96
|
-
},
|
|
97
|
-
evolve: {
|
|
98
|
-
method: 'POST',
|
|
99
|
-
pathPattern: '/api/{resource}/{id}/evolve'
|
|
100
|
-
},
|
|
101
|
-
delete: {
|
|
102
|
-
method: 'DELETE',
|
|
103
|
-
pathPattern: '/api/{resource}/{id}'
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Simple Tailwind adapter stub
|
|
109
|
-
*/
|
|
110
|
-
const createStubTailwindAdapter = () => ({
|
|
111
|
-
renderComponent: (type: string, _props: any) => {
|
|
112
|
-
return \`<div class="p-2 text-gray-600">[\${type}]</div>\`;
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Stub PatternAdapter that uses browser exports
|
|
118
|
-
*/
|
|
119
|
-
export function usePatternAdapter() {
|
|
120
|
-
return useMemo(() => ({
|
|
121
|
-
tailwindAdapter: createStubTailwindAdapter(),
|
|
122
|
-
|
|
123
|
-
detectPattern(view: any): CompositeViewPattern | null {
|
|
124
|
-
const viewType = view.type?.toLowerCase();
|
|
125
|
-
const typeToPattern: Record<string, string> = {
|
|
126
|
-
'form': 'form-view',
|
|
127
|
-
'list': 'list-view',
|
|
128
|
-
'detail': 'detail-view',
|
|
129
|
-
'dashboard': 'dashboard-view'
|
|
130
|
-
};
|
|
131
|
-
const patternId = typeToPattern[viewType];
|
|
132
|
-
return patternId ? COMPOSITE_VIEW_PATTERNS[patternId] : null;
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
renderPattern(_context: any): string {
|
|
136
|
-
return \`
|
|
137
|
-
<div class="p-4 bg-yellow-50 border border-yellow-200 rounded">
|
|
138
|
-
<p class="text-yellow-800 font-semibold">\u26A0\uFE0F Pattern Adapter Stub</p>
|
|
139
|
-
<p class="text-sm text-yellow-700 mt-2">
|
|
140
|
-
Full ReactPatternAdapter could not be bundled.
|
|
141
|
-
Views will not render correctly.
|
|
142
|
-
</p>
|
|
143
|
-
</div>
|
|
144
|
-
\`;
|
|
145
|
-
}
|
|
146
|
-
}), []);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export { COMPOSITE_VIEW_PATTERNS } from '@specverse/engines/realize';
|
|
150
|
-
|
|
151
|
-
console.warn('\u26A0\uFE0F Using stub ReactPatternAdapter - full source file not found during generation');
|
|
152
|
-
`;
|
|
153
|
-
}
|
|
154
|
-
export {
|
|
155
|
-
generate
|
|
156
|
-
};
|