|
29 | 29 | "type": "object", |
30 | 30 | "properties": { |
31 | 31 | "preload": { |
32 | | - "description": "List of component dependencies to preload. Preloading components can improve performance by fetching dependencies before they are needed.", |
| 32 | + "description": "Path to a JavaScript file to preload on the HTML server when running oc dev. This file will be executed to set up any necessary initialization code.", |
| 33 | + "type": "string", |
| 34 | + "example": "./preload.js" |
| 35 | + }, |
| 36 | + "routes": { |
| 37 | + "description": "Custom routing configuration for the development server. Allows defining custom routes with HTTP methods and handlers.", |
33 | 38 | "type": "array", |
34 | 39 | "items": { |
35 | | - "type": "string", |
36 | | - "description": "Component name or path to preload" |
| 40 | + "type": "object", |
| 41 | + "properties": { |
| 42 | + "route": { |
| 43 | + "type": "string", |
| 44 | + "description": "The URL route pattern (e.g., '/', '/api/users')" |
| 45 | + }, |
| 46 | + "method": { |
| 47 | + "type": "string", |
| 48 | + "description": "HTTP method for the route", |
| 49 | + "enum": [ |
| 50 | + "GET", |
| 51 | + "POST", |
| 52 | + "PUT", |
| 53 | + "DELETE", |
| 54 | + "PATCH", |
| 55 | + "HEAD", |
| 56 | + "OPTIONS" |
| 57 | + ], |
| 58 | + "example": "GET" |
| 59 | + }, |
| 60 | + "handler": { |
| 61 | + "type": "string", |
| 62 | + "description": "Path to the JavaScript file that handles this route" |
| 63 | + } |
| 64 | + }, |
| 65 | + "required": [ |
| 66 | + "route", |
| 67 | + "method", |
| 68 | + "handler" |
| 69 | + ], |
| 70 | + "additionalProperties": false |
37 | 71 | }, |
38 | 72 | "example": [ |
39 | | - "header", |
40 | | - "footer", |
41 | | - "common-ui" |
| 73 | + { |
| 74 | + "route": "/", |
| 75 | + "method": "GET", |
| 76 | + "handler": "./authRoute.js" |
| 77 | + } |
42 | 78 | ] |
43 | 79 | }, |
44 | | - "routes": { |
45 | | - "description": "Custom routing configuration for components. Allows defining custom URL patterns and mappings for component rendering.", |
46 | | - "type": "object", |
47 | | - "additionalProperties": { |
48 | | - "type": "string", |
49 | | - "description": "Route pattern mapped to component name or path" |
50 | | - }, |
51 | | - "example": { |
52 | | - "/custom-header": "header-component", |
53 | | - "/api/*": "api-wrapper" |
54 | | - } |
55 | | - }, |
56 | 80 | "fallback": { |
57 | 81 | "description": "Fallback configuration for when components cannot be found in the local registry. Allows specifying a fallback registry URL and optionally using its client library.", |
58 | 82 | "type": "object", |
|
162 | 186 | "https://my-registry.com" |
163 | 187 | ], |
164 | 188 | "development": { |
| 189 | + "preload": "./preload.js", |
| 190 | + "routes": [ |
| 191 | + { |
| 192 | + "route": "/", |
| 193 | + "method": "GET", |
| 194 | + "handler": "./authRoute.js" |
| 195 | + } |
| 196 | + ], |
165 | 197 | "fallback": { |
166 | 198 | "url": "https://fallback-registry.com", |
167 | 199 | "client": true |
|
0 commit comments