@creact-labs/creact 0.1.8 → 0.2.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.
- package/README.md +85 -22
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +88 -0
- package/dist/index.d.ts +19 -44
- package/dist/index.js +20 -68
- package/dist/jsx/index.d.ts +2 -0
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/jsx-dev-runtime.d.ts +4 -0
- package/dist/jsx/jsx-dev-runtime.js +4 -0
- package/dist/jsx/jsx-runtime.d.ts +38 -0
- package/dist/jsx/jsx-runtime.js +38 -0
- package/dist/jsx/types.d.ts +12 -0
- package/dist/jsx/types.js +4 -0
- package/dist/primitives/context.d.ts +34 -0
- package/dist/primitives/context.js +63 -0
- package/dist/primitives/index.d.ts +3 -0
- package/dist/primitives/index.js +3 -0
- package/dist/primitives/instance.d.ts +72 -0
- package/dist/primitives/instance.js +235 -0
- package/dist/primitives/store.d.ts +22 -0
- package/dist/primitives/store.js +97 -0
- package/dist/provider/backend.d.ts +110 -0
- package/dist/provider/backend.js +37 -0
- package/dist/provider/interface.d.ts +48 -0
- package/dist/provider/interface.js +39 -0
- package/dist/reactive/effect.d.ts +11 -0
- package/dist/reactive/effect.js +42 -0
- package/dist/reactive/index.d.ts +3 -0
- package/dist/reactive/index.js +3 -0
- package/dist/reactive/signal.d.ts +32 -0
- package/dist/reactive/signal.js +60 -0
- package/dist/reactive/tracking.d.ts +41 -0
- package/dist/reactive/tracking.js +161 -0
- package/dist/runtime/fiber.d.ts +21 -0
- package/dist/runtime/fiber.js +16 -0
- package/dist/runtime/index.d.ts +4 -0
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/reconcile.d.ts +66 -0
- package/dist/runtime/reconcile.js +210 -0
- package/dist/runtime/render.d.ts +42 -0
- package/dist/runtime/render.js +231 -0
- package/dist/runtime/run.d.ts +119 -0
- package/dist/runtime/run.js +334 -0
- package/dist/runtime/state-machine.d.ts +95 -0
- package/dist/runtime/state-machine.js +209 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.js +4 -0
- package/package.json +29 -24
- package/dist/cli/commands/BuildCommand.d.ts +0 -40
- package/dist/cli/commands/BuildCommand.js +0 -151
- package/dist/cli/commands/DeployCommand.d.ts +0 -38
- package/dist/cli/commands/DeployCommand.js +0 -194
- package/dist/cli/commands/DevCommand.d.ts +0 -52
- package/dist/cli/commands/DevCommand.js +0 -394
- package/dist/cli/commands/PlanCommand.d.ts +0 -39
- package/dist/cli/commands/PlanCommand.js +0 -164
- package/dist/cli/commands/index.d.ts +0 -36
- package/dist/cli/commands/index.js +0 -43
- package/dist/cli/core/ArgumentParser.d.ts +0 -46
- package/dist/cli/core/ArgumentParser.js +0 -127
- package/dist/cli/core/BaseCommand.d.ts +0 -75
- package/dist/cli/core/BaseCommand.js +0 -95
- package/dist/cli/core/CLIContext.d.ts +0 -68
- package/dist/cli/core/CLIContext.js +0 -183
- package/dist/cli/core/CommandRegistry.d.ts +0 -64
- package/dist/cli/core/CommandRegistry.js +0 -89
- package/dist/cli/core/index.d.ts +0 -36
- package/dist/cli/core/index.js +0 -43
- package/dist/cli/index.d.ts +0 -35
- package/dist/cli/index.js +0 -100
- package/dist/cli/output.d.ts +0 -204
- package/dist/cli/output.js +0 -437
- package/dist/cli/utils.d.ts +0 -59
- package/dist/cli/utils.js +0 -76
- package/dist/context/createContext.d.ts +0 -90
- package/dist/context/createContext.js +0 -113
- package/dist/context/index.d.ts +0 -30
- package/dist/context/index.js +0 -35
- package/dist/core/CReact.d.ts +0 -409
- package/dist/core/CReact.js +0 -1151
- package/dist/core/CloudDOMBuilder.d.ts +0 -447
- package/dist/core/CloudDOMBuilder.js +0 -1234
- package/dist/core/ContextDependencyTracker.d.ts +0 -165
- package/dist/core/ContextDependencyTracker.js +0 -448
- package/dist/core/ErrorRecoveryManager.d.ts +0 -145
- package/dist/core/ErrorRecoveryManager.js +0 -443
- package/dist/core/EventBus.d.ts +0 -91
- package/dist/core/EventBus.js +0 -185
- package/dist/core/ProviderOutputTracker.d.ts +0 -211
- package/dist/core/ProviderOutputTracker.js +0 -476
- package/dist/core/ReactiveUpdateQueue.d.ts +0 -76
- package/dist/core/ReactiveUpdateQueue.js +0 -121
- package/dist/core/Reconciler.d.ts +0 -415
- package/dist/core/Reconciler.js +0 -1044
- package/dist/core/RenderScheduler.d.ts +0 -153
- package/dist/core/RenderScheduler.js +0 -519
- package/dist/core/Renderer.d.ts +0 -336
- package/dist/core/Renderer.js +0 -944
- package/dist/core/Runtime.d.ts +0 -246
- package/dist/core/Runtime.js +0 -640
- package/dist/core/StateBindingManager.d.ts +0 -121
- package/dist/core/StateBindingManager.js +0 -309
- package/dist/core/StateMachine.d.ts +0 -441
- package/dist/core/StateMachine.js +0 -883
- package/dist/core/StructuralChangeDetector.d.ts +0 -140
- package/dist/core/StructuralChangeDetector.js +0 -363
- package/dist/core/Validator.d.ts +0 -127
- package/dist/core/Validator.js +0 -279
- package/dist/core/errors.d.ts +0 -153
- package/dist/core/errors.js +0 -202
- package/dist/core/index.d.ts +0 -38
- package/dist/core/index.js +0 -64
- package/dist/core/types.d.ts +0 -265
- package/dist/core/types.js +0 -48
- package/dist/hooks/context.d.ts +0 -147
- package/dist/hooks/context.js +0 -334
- package/dist/hooks/useContext.d.ts +0 -113
- package/dist/hooks/useContext.js +0 -169
- package/dist/hooks/useEffect.d.ts +0 -105
- package/dist/hooks/useEffect.js +0 -540
- package/dist/hooks/useInstance.d.ts +0 -139
- package/dist/hooks/useInstance.js +0 -455
- package/dist/hooks/useState.d.ts +0 -120
- package/dist/hooks/useState.js +0 -298
- package/dist/jsx.d.ts +0 -143
- package/dist/jsx.js +0 -76
- package/dist/providers/DummyBackendProvider.d.ts +0 -193
- package/dist/providers/DummyBackendProvider.js +0 -189
- package/dist/providers/DummyCloudProvider.d.ts +0 -128
- package/dist/providers/DummyCloudProvider.js +0 -157
- package/dist/providers/IBackendProvider.d.ts +0 -177
- package/dist/providers/IBackendProvider.js +0 -31
- package/dist/providers/ICloudProvider.d.ts +0 -230
- package/dist/providers/ICloudProvider.js +0 -31
- package/dist/providers/index.d.ts +0 -31
- package/dist/providers/index.js +0 -31
- package/dist/test-event-callbacks.d.ts +0 -0
- package/dist/test-event-callbacks.js +0 -1
- package/dist/utils/Logger.d.ts +0 -144
- package/dist/utils/Logger.js +0 -220
- package/dist/utils/Output.d.ts +0 -161
- package/dist/utils/Output.js +0 -401
- package/dist/utils/deepEqual.d.ts +0 -71
- package/dist/utils/deepEqual.js +0 -276
- package/dist/utils/naming.d.ts +0 -241
- package/dist/utils/naming.js +0 -376
package/dist/core/Runtime.d.ts
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
|
|
17
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
-
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
|
|
23
|
-
* limitations under the License.
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
* Copyright 2025 Daniel Coutinho Ribeiro
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
import { ICloudProvider } from '../providers/ICloudProvider';
|
|
31
|
-
import { IBackendProvider } from '../providers/IBackendProvider';
|
|
32
|
-
import { CloudDOMNode, JSXElement, ChangeSet } from './types';
|
|
33
|
-
/**
|
|
34
|
-
* Runtime configuration
|
|
35
|
-
* REQ-1.6: Configuration with providers, deployment options, log config, hooks
|
|
36
|
-
*/
|
|
37
|
-
export interface RuntimeConfig {
|
|
38
|
-
/** Cloud provider for resource materialization */
|
|
39
|
-
cloudProvider: ICloudProvider;
|
|
40
|
-
/** Backend provider for state persistence */
|
|
41
|
-
backendProvider: IBackendProvider;
|
|
42
|
-
/** Deployment options */
|
|
43
|
-
deployment?: {
|
|
44
|
-
/** Enable parallel deployment (default: true) */
|
|
45
|
-
parallel?: boolean;
|
|
46
|
-
/** Max concurrent deployments (default: 10) */
|
|
47
|
-
maxConcurrency?: number;
|
|
48
|
-
/** Provider-specific concurrency limits */
|
|
49
|
-
providerConcurrency?: Record<string, number>;
|
|
50
|
-
};
|
|
51
|
-
/** Logging configuration */
|
|
52
|
-
log?: {
|
|
53
|
-
/** Enabled scopes (e.g., ['renderer', 'reconciler']) */
|
|
54
|
-
scopes?: string[];
|
|
55
|
-
/** Log level (default: 'info') */
|
|
56
|
-
level?: 'debug' | 'info' | 'warn' | 'error';
|
|
57
|
-
};
|
|
58
|
-
/** Lifecycle hooks */
|
|
59
|
-
hooks?: {
|
|
60
|
-
onStart?: () => void | Promise<void>;
|
|
61
|
-
onComplete?: (result: DeploymentResult) => void | Promise<void>;
|
|
62
|
-
onError?: (error: Error) => void | Promise<void>;
|
|
63
|
-
};
|
|
64
|
-
/** Async timeout in milliseconds (default: 5 minutes) */
|
|
65
|
-
asyncTimeout?: number;
|
|
66
|
-
/** Migration map for refactoring */
|
|
67
|
-
migrationMap?: Record<string, string>;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Deployment result
|
|
71
|
-
* REQ-1.4: Deploy method returns DeploymentResult
|
|
72
|
-
*/
|
|
73
|
-
export interface DeploymentResult {
|
|
74
|
-
/** CloudDOM tree after deployment */
|
|
75
|
-
cloudDOM: CloudDOMNode[];
|
|
76
|
-
/** Change set that was applied */
|
|
77
|
-
changeSet: ChangeSet;
|
|
78
|
-
/** Deployment duration in milliseconds */
|
|
79
|
-
duration: number;
|
|
80
|
-
/** Resource outputs */
|
|
81
|
-
outputs: Record<string, any>;
|
|
82
|
-
/** Deployment statistics */
|
|
83
|
-
stats: {
|
|
84
|
-
totalResources: number;
|
|
85
|
-
created: number;
|
|
86
|
-
updated: number;
|
|
87
|
-
deleted: number;
|
|
88
|
-
parallelBatches: number;
|
|
89
|
-
parallelEfficiency: number;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Runtime class for CReact execution management
|
|
94
|
-
*
|
|
95
|
-
* REQ-1.1: Dedicated Runtime class for managing execution lifecycle
|
|
96
|
-
* REQ-1.2: Initialize renderer, reconciler, state machine, and providers
|
|
97
|
-
* REQ-1.3: Execute full deployment pipeline
|
|
98
|
-
* REQ-1.4: Compute deployment diff without executing
|
|
99
|
-
* REQ-1.5: Tear down resources in reverse dependency order
|
|
100
|
-
* REQ-1.6: Accept provider instances, backend configuration, and deployment options
|
|
101
|
-
* REQ-1.7: Multiple Runtime instances are isolated from each other
|
|
102
|
-
* REQ-1.8: Provide lifecycle hooks (onStart, onComplete, onError)
|
|
103
|
-
* REQ-1.9: Clean up all resources and connections
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```typescript
|
|
107
|
-
* const runtime = new Runtime({
|
|
108
|
-
* cloudProvider: new MyCloudProvider(),
|
|
109
|
-
* backendProvider: new MyBackendProvider(),
|
|
110
|
-
* deployment: {
|
|
111
|
-
* parallel: true,
|
|
112
|
-
* maxConcurrency: 10
|
|
113
|
-
* },
|
|
114
|
-
* log: {
|
|
115
|
-
* scopes: ['runtime', 'reconciler'],
|
|
116
|
-
* level: 'info'
|
|
117
|
-
* },
|
|
118
|
-
* hooks: {
|
|
119
|
-
* onStart: () => console.log('Deployment starting...'),
|
|
120
|
-
* onComplete: (result) => console.log('Deployment complete!'),
|
|
121
|
-
* onError: (error) => console.error('Deployment failed:', error)
|
|
122
|
-
* }
|
|
123
|
-
* });
|
|
124
|
-
*
|
|
125
|
-
* // Deploy application
|
|
126
|
-
* const result = await runtime.deploy(<MyApp />);
|
|
127
|
-
*
|
|
128
|
-
* // Clean up
|
|
129
|
-
* await runtime.dispose();
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
export declare class Runtime {
|
|
133
|
-
private config;
|
|
134
|
-
private renderer;
|
|
135
|
-
private validator;
|
|
136
|
-
private cloudDOMBuilder;
|
|
137
|
-
private reconciler;
|
|
138
|
-
private stateMachine;
|
|
139
|
-
private renderScheduler;
|
|
140
|
-
private stateBindingManager;
|
|
141
|
-
private providerOutputTracker;
|
|
142
|
-
private contextDependencyTracker;
|
|
143
|
-
private errorRecoveryManager;
|
|
144
|
-
private structuralChangeDetector;
|
|
145
|
-
private lastFiberTree;
|
|
146
|
-
private isDisposed;
|
|
147
|
-
/**
|
|
148
|
-
* Constructor receives all dependencies via config (dependency injection)
|
|
149
|
-
* REQ-1.2: Initialize renderer, reconciler, state machine, and providers
|
|
150
|
-
* REQ-1.6: Accept configuration with providers and options
|
|
151
|
-
* REQ-1.7: Ensure multiple Runtime instances are isolated
|
|
152
|
-
*
|
|
153
|
-
* @param config - Runtime configuration with providers and options
|
|
154
|
-
*/
|
|
155
|
-
constructor(config: RuntimeConfig);
|
|
156
|
-
/**
|
|
157
|
-
* Deploy the application
|
|
158
|
-
* REQ-1.3: Execute full deployment pipeline and return DeploymentResult
|
|
159
|
-
* REQ-1.8: Lifecycle hooks support (onStart, onComplete, onError)
|
|
160
|
-
*
|
|
161
|
-
* Pipeline: render → validate → build → reconcile → deploy
|
|
162
|
-
*
|
|
163
|
-
* @param app - JSX element to deploy
|
|
164
|
-
* @param stackName - Stack name for state management (default: 'default')
|
|
165
|
-
* @param user - User initiating deployment (default: 'system')
|
|
166
|
-
* @returns Promise resolving to DeploymentResult
|
|
167
|
-
*/
|
|
168
|
-
deploy(app: JSXElement, stackName?: string, user?: string): Promise<DeploymentResult>;
|
|
169
|
-
/**
|
|
170
|
-
* Compute deployment plan without executing
|
|
171
|
-
* REQ-1.4: Plan method computes ChangeSet without executing
|
|
172
|
-
*
|
|
173
|
-
* @param app - JSX element to plan
|
|
174
|
-
* @param stackName - Stack name for state comparison (default: 'default')
|
|
175
|
-
* @returns Promise resolving to ChangeSet
|
|
176
|
-
*/
|
|
177
|
-
plan(app: JSXElement, stackName?: string): Promise<ChangeSet>;
|
|
178
|
-
/**
|
|
179
|
-
* Destroy all resources
|
|
180
|
-
* REQ-1.5: Tear down resources in reverse dependency order
|
|
181
|
-
*
|
|
182
|
-
* @param stackName - Stack name to destroy (default: 'default')
|
|
183
|
-
*/
|
|
184
|
-
destroy(stackName?: string): Promise<void>;
|
|
185
|
-
/**
|
|
186
|
-
* Get current CloudDOM state
|
|
187
|
-
* REQ-1.6: Get current CloudDOM state
|
|
188
|
-
*
|
|
189
|
-
* @param stackName - Stack name (default: 'default')
|
|
190
|
-
* @returns Promise resolving to CloudDOM tree
|
|
191
|
-
*/
|
|
192
|
-
getState(stackName?: string): Promise<CloudDOMNode[]>;
|
|
193
|
-
/**
|
|
194
|
-
* Dispose runtime and clean up resources
|
|
195
|
-
* REQ-1.9: Clean up all resources and connections
|
|
196
|
-
*/
|
|
197
|
-
dispose(): Promise<void>;
|
|
198
|
-
/**
|
|
199
|
-
* Ensure runtime is not disposed
|
|
200
|
-
* @private
|
|
201
|
-
*/
|
|
202
|
-
private ensureNotDisposed;
|
|
203
|
-
/**
|
|
204
|
-
* Handle output change events from provider (event-driven reactivity)
|
|
205
|
-
* Called when provider emits 'outputsChanged' event
|
|
206
|
-
*
|
|
207
|
-
* This enables real-time reactivity without polling:
|
|
208
|
-
* 1. Update ProviderOutputTracker with new outputs
|
|
209
|
-
* 2. Execute useEffect callbacks bound to these outputs (TODO)
|
|
210
|
-
* 3. Update bound state and enqueue affected fibers for re-render
|
|
211
|
-
*
|
|
212
|
-
* @param change - Output change event from provider
|
|
213
|
-
* @private
|
|
214
|
-
*/
|
|
215
|
-
private handleProviderOutputChange;
|
|
216
|
-
/**
|
|
217
|
-
* Prepare hydration data from previous CloudDOM
|
|
218
|
-
* @private
|
|
219
|
-
*/
|
|
220
|
-
private prepareHydration;
|
|
221
|
-
/**
|
|
222
|
-
* Clear hydration data
|
|
223
|
-
* @private
|
|
224
|
-
*/
|
|
225
|
-
private clearHydration;
|
|
226
|
-
/**
|
|
227
|
-
* Build outputs map from CloudDOM
|
|
228
|
-
* @private
|
|
229
|
-
*/
|
|
230
|
-
private buildOutputsMap;
|
|
231
|
-
/**
|
|
232
|
-
* Find node by ID in CloudDOM tree
|
|
233
|
-
* @private
|
|
234
|
-
*/
|
|
235
|
-
private findNodeById;
|
|
236
|
-
/**
|
|
237
|
-
* Extract outputs from CloudDOM
|
|
238
|
-
* @private
|
|
239
|
-
*/
|
|
240
|
-
private extractOutputs;
|
|
241
|
-
/**
|
|
242
|
-
* Calculate parallel efficiency from change set
|
|
243
|
-
* @private
|
|
244
|
-
*/
|
|
245
|
-
private calculateParallelEfficiency;
|
|
246
|
-
}
|