@africode/core 5.0.2 → 5.0.4
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/core/cli/commands/build.js +2 -1
- package/core/cli/commands/dev.js +23 -3
- package/core/sdk-browser.js +140 -0
- package/dist/africode.js +184 -183
- package/dist/africode.js.map +16 -9
- package/dist/build-info.json +3 -3
- package/package.json +6 -5
- package/templates/starter/package.json +1 -1
- package/templates/starter/src/pages/index.html +14 -4
- package/templates/starter/src/pages/index.js +13 -28
- package/templates/starter-3d/package.json +1 -1
- package/templates/starter-3d/src/pages/index.html +13 -3
- package/templates/starter-react/package.json +1 -1
- package/templates/starter-react/src/pages/index.html +13 -3
- package/templates/starter-tailwind/package.json +1 -1
- package/templates/starter-tailwind/src/pages/index.html +13 -3
- package/src/index.ts +0 -196
package/dist/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2026-06-
|
|
3
|
-
"version": "5.0.
|
|
2
|
+
"timestamp": "2026-06-28T08:32:20.429Z",
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"bundles": {
|
|
5
5
|
"core": {
|
|
6
6
|
"file": "africode.js",
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
]
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
-
"buildTime": "
|
|
22
|
+
"buildTime": "179.87ms"
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@africode/core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"description": "Bun-native full-stack framework with generative AI, fintech compliance, and real-time performance - built for Tanzanian digital economy",
|
|
5
|
-
"module": "
|
|
6
|
-
"main": "
|
|
7
|
-
"types": "
|
|
5
|
+
"module": "core/sdk.js",
|
|
6
|
+
"main": "core/sdk.js",
|
|
7
|
+
"types": "core/sdk.js",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"exports": {
|
|
10
|
-
".": "./
|
|
10
|
+
".": "./core/sdk.js",
|
|
11
|
+
"./browser": "./core/sdk-browser.js",
|
|
11
12
|
"./styles": "./styles/africanity.css",
|
|
12
13
|
"./core/*": "./core/*",
|
|
13
14
|
"./components": "./components/index.js",
|
|
@@ -6,11 +6,21 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<title>Welcome to AfriCode</title>
|
|
8
8
|
|
|
9
|
+
<!-- Import Map: resolves bare module specifiers for the browser -->
|
|
10
|
+
<script type="importmap">
|
|
11
|
+
{
|
|
12
|
+
"imports": {
|
|
13
|
+
"africode": "/node_modules/@africode/core/core/sdk-browser.js",
|
|
14
|
+
"africode/components": "/node_modules/@africode/core/components/index.js"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
9
19
|
<!-- Theme -->
|
|
10
|
-
<link rel="stylesheet" href="/node_modules
|
|
11
|
-
<link rel="stylesheet" href="/node_modules
|
|
20
|
+
<link rel="stylesheet" href="/node_modules/@africode/core/styles/africanity.css">
|
|
21
|
+
<link rel="stylesheet" href="/node_modules/@africode/core/styles/typography.css">
|
|
12
22
|
<link rel="stylesheet" href="/styles/main.css">
|
|
13
|
-
<script type="module" src="/node_modules
|
|
23
|
+
<script type="module" src="/node_modules/@africode/core/core/sdk-browser.js"></script>
|
|
14
24
|
|
|
15
25
|
<!-- SDK & Components -->
|
|
16
26
|
<script type="module">
|
|
@@ -31,7 +41,7 @@
|
|
|
31
41
|
<div
|
|
32
42
|
style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-top: 40px;">
|
|
33
43
|
<af-card title="Getting Started">
|
|
34
|
-
<p>Edit <code>pages/index.html</code> to change this page.</p>
|
|
44
|
+
<p>Edit <code>src/pages/index.html</code> to change this page.</p>
|
|
35
45
|
<af-button variant="primary">Read Docs</af-button>
|
|
36
46
|
</af-card>
|
|
37
47
|
|
|
@@ -1,32 +1,17 @@
|
|
|
1
1
|
import { html, Layout } from 'africode';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
export default function HomePage() {
|
|
8
|
-
return Layout({
|
|
9
|
-
title: "Welcome to AfriCode",
|
|
10
|
-
children: html`
|
|
11
|
-
<af-navbar logo="My App" theme="dark"></af-navbar>
|
|
12
|
-
|
|
13
|
-
<main style="max-width: 1000px; margin: 0 auto; padding: 40px;">
|
|
14
|
-
<af-hero
|
|
15
|
-
title="Next-Gen African Web"
|
|
16
|
-
subtitle="Built with the AfriCode JS Framework."
|
|
17
|
-
pattern="kente">
|
|
18
|
-
</af-hero>
|
|
19
|
-
|
|
20
|
-
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-top: 40px;">
|
|
21
|
-
<af-card title="JS-First Architecture">
|
|
22
|
-
<p>No more HTML files. Logic and View utilize <code>pages/index.js</code>.</p>
|
|
23
|
-
</af-card>
|
|
3
|
+
export function loader() {
|
|
4
|
+
return { title: 'Welcome to AfriCode' };
|
|
5
|
+
}
|
|
24
6
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
7
|
+
export default function HomePage({ data }) {
|
|
8
|
+
return Layout({
|
|
9
|
+
title: data?.title || 'Welcome to AfriCode',
|
|
10
|
+
children: html`
|
|
11
|
+
<main>
|
|
12
|
+
<h1>Welcome to AfriCode</h1>
|
|
13
|
+
<p>Your African-centric full-stack framework is ready.</p>
|
|
14
|
+
</main>
|
|
15
|
+
`
|
|
16
|
+
});
|
|
32
17
|
}
|
|
@@ -6,11 +6,21 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<title>Welcome to AfriCode</title>
|
|
8
8
|
|
|
9
|
+
<!-- Import Map: resolves bare module specifiers for the browser -->
|
|
10
|
+
<script type="importmap">
|
|
11
|
+
{
|
|
12
|
+
"imports": {
|
|
13
|
+
"africode": "/node_modules/@africode/core/core/sdk-browser.js",
|
|
14
|
+
"africode/components": "/node_modules/@africode/core/components/index.js"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
9
19
|
<!-- Theme -->
|
|
10
|
-
<link rel="stylesheet" href="/node_modules
|
|
11
|
-
<link rel="stylesheet" href="/node_modules
|
|
20
|
+
<link rel="stylesheet" href="/node_modules/@africode/core/styles/africanity.css">
|
|
21
|
+
<link rel="stylesheet" href="/node_modules/@africode/core/styles/typography.css">
|
|
12
22
|
<link rel="stylesheet" href="/styles/main.css">
|
|
13
|
-
<script type="module" src="/node_modules
|
|
23
|
+
<script type="module" src="/node_modules/@africode/core/core/sdk-browser.js"></script>
|
|
14
24
|
|
|
15
25
|
<!-- SDK & Components -->
|
|
16
26
|
<script type="module">
|
|
@@ -6,11 +6,21 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<title>Welcome to AfriCode</title>
|
|
8
8
|
|
|
9
|
+
<!-- Import Map: resolves bare module specifiers for the browser -->
|
|
10
|
+
<script type="importmap">
|
|
11
|
+
{
|
|
12
|
+
"imports": {
|
|
13
|
+
"africode": "/node_modules/@africode/core/core/sdk-browser.js",
|
|
14
|
+
"africode/components": "/node_modules/@africode/core/components/index.js"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
9
19
|
<!-- Theme -->
|
|
10
|
-
<link rel="stylesheet" href="/node_modules
|
|
11
|
-
<link rel="stylesheet" href="/node_modules
|
|
20
|
+
<link rel="stylesheet" href="/node_modules/@africode/core/styles/africanity.css">
|
|
21
|
+
<link rel="stylesheet" href="/node_modules/@africode/core/styles/typography.css">
|
|
12
22
|
<link rel="stylesheet" href="/styles/main.css">
|
|
13
|
-
<script type="module" src="/node_modules
|
|
23
|
+
<script type="module" src="/node_modules/@africode/core/core/sdk-browser.js"></script>
|
|
14
24
|
|
|
15
25
|
<!-- SDK & Components -->
|
|
16
26
|
<script type="module">
|
|
@@ -6,11 +6,21 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<title>Welcome to AfriCode</title>
|
|
8
8
|
|
|
9
|
+
<!-- Import Map: resolves bare module specifiers for the browser -->
|
|
10
|
+
<script type="importmap">
|
|
11
|
+
{
|
|
12
|
+
"imports": {
|
|
13
|
+
"africode": "/node_modules/@africode/core/core/sdk-browser.js",
|
|
14
|
+
"africode/components": "/node_modules/@africode/core/components/index.js"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
9
19
|
<!-- Theme -->
|
|
10
|
-
<link rel="stylesheet" href="/node_modules
|
|
11
|
-
<link rel="stylesheet" href="/node_modules
|
|
20
|
+
<link rel="stylesheet" href="/node_modules/@africode/core/styles/africanity.css">
|
|
21
|
+
<link rel="stylesheet" href="/node_modules/@africode/core/styles/typography.css">
|
|
12
22
|
<link rel="stylesheet" href="/styles/main.css">
|
|
13
|
-
<script type="module" src="/node_modules
|
|
23
|
+
<script type="module" src="/node_modules/@africode/core/core/sdk-browser.js"></script>
|
|
14
24
|
|
|
15
25
|
<!-- SDK & Components -->
|
|
16
26
|
<script type="module">
|
package/src/index.ts
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AfriCode v5.0.0 - Autonomous Framework Entry Point
|
|
3
|
-
* African-centric full-stack framework with AI safety and fintech compliance
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { createReactiveState, subscribe, createSignal, createEffect } from '../core/state.js';
|
|
7
|
-
import { store, actions } from '../core/store.js';
|
|
8
|
-
import patterns from '../core/patterns.js';
|
|
9
|
-
import * as motion from '../core/motion.js';
|
|
10
|
-
import { hydrate } from '../core/hydration.js';
|
|
11
|
-
import { html, Layout } from '../core/html.js';
|
|
12
|
-
import { schemas, Validation, rules, afri, AfriFieldBuilder, normalizeInput, buildSchema } from '../core/validation.js';
|
|
13
|
-
import { createFramework, getConfig } from '../core/config.js';
|
|
14
|
-
import {
|
|
15
|
-
AfriCodeError, ValidationError, InvalidUrlError,
|
|
16
|
-
SecurityError, CsrfError, RateLimitError,
|
|
17
|
-
DatabaseError, ComponentError
|
|
18
|
-
} from '../core/errors.js';
|
|
19
|
-
|
|
20
|
-
// v5.0.0 autonomous features
|
|
21
|
-
import { initA2UI, A2UIRenderer, A2UIProtocol } from '../core/a2ui.js';
|
|
22
|
-
import { NIDAClient, TIPSClient, AMLComplianceEngine, ComplianceMiddleware } from '../core/compliance.js';
|
|
23
|
-
import { initBunRuntime, HotReloadEngine, BunHTTPServer, BunDatabase, PerformanceMonitor } from '../core/bun-runtime.js';
|
|
24
|
-
import { EnhancedHMRMiddleware } from '../core/enhanced-hmr.js';
|
|
25
|
-
import { A2uiSchemaManager } from '../core/a2ui-schema-manager.js';
|
|
26
|
-
import { LipaNambaJourney } from '../core/lipa-namba-journey.js';
|
|
27
|
-
|
|
28
|
-
import { componentMap as coreMap } from '../components/index.js';
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* AfriCode Framework Class
|
|
32
|
-
* Autonomous application lifecycle management
|
|
33
|
-
*/
|
|
34
|
-
export class AfriCode {
|
|
35
|
-
private config: any;
|
|
36
|
-
private server?: BunHTTPServer;
|
|
37
|
-
private hmr?: EnhancedHMRMiddleware;
|
|
38
|
-
private schemaManager?: A2uiSchemaManager;
|
|
39
|
-
|
|
40
|
-
constructor(config: {
|
|
41
|
-
port?: number;
|
|
42
|
-
pagesDir?: string;
|
|
43
|
-
publicDir?: string;
|
|
44
|
-
enableHMR?: boolean;
|
|
45
|
-
enableA2UI?: boolean;
|
|
46
|
-
fintechCompliance?: boolean;
|
|
47
|
-
} = {}) {
|
|
48
|
-
this.config = {
|
|
49
|
-
port: 3000,
|
|
50
|
-
pagesDir: 'pages',
|
|
51
|
-
publicDir: 'public',
|
|
52
|
-
enableHMR: true,
|
|
53
|
-
enableA2UI: true,
|
|
54
|
-
fintechCompliance: true,
|
|
55
|
-
...config
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Initialize the autonomous framework
|
|
61
|
-
*/
|
|
62
|
-
async initialize(): Promise<void> {
|
|
63
|
-
console.log('🚀 Initializing AfriCode v5.0.0...');
|
|
64
|
-
|
|
65
|
-
// Initialize Bun runtime
|
|
66
|
-
await initBunRuntime();
|
|
67
|
-
|
|
68
|
-
// Initialize A2UI schema manager
|
|
69
|
-
if (this.config.enableA2UI) {
|
|
70
|
-
this.schemaManager = new A2uiSchemaManager();
|
|
71
|
-
await this.schemaManager.generateManifest();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Initialize HMR if enabled
|
|
75
|
-
if (this.config.enableHMR) {
|
|
76
|
-
this.hmr = new EnhancedHMRMiddleware({
|
|
77
|
-
port: this.config.port + 1,
|
|
78
|
-
watchPaths: [this.config.pagesDir, 'components', 'core']
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
console.log('✅ AfriCode initialized successfully');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Start the autonomous server
|
|
87
|
-
*/
|
|
88
|
-
async start(): Promise<void> {
|
|
89
|
-
await this.initialize();
|
|
90
|
-
|
|
91
|
-
// Create HTTP server with file-based routing
|
|
92
|
-
this.server = new BunHTTPServer({
|
|
93
|
-
port: this.config.port,
|
|
94
|
-
pagesDir: this.config.pagesDir,
|
|
95
|
-
publicDir: this.config.publicDir,
|
|
96
|
-
middleware: [
|
|
97
|
-
this.config.fintechCompliance ? new ComplianceMiddleware() : null,
|
|
98
|
-
this.hmr
|
|
99
|
-
].filter(Boolean)
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// Start HMR if enabled
|
|
103
|
-
if (this.hmr) {
|
|
104
|
-
await this.hmr.initialize(this.server);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
await this.server.start();
|
|
108
|
-
console.log(`🌐 Server running on http://localhost:${this.config.port}`);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Stop the framework
|
|
113
|
-
*/
|
|
114
|
-
async stop(): Promise<void> {
|
|
115
|
-
if (this.server) {
|
|
116
|
-
await this.server.stop();
|
|
117
|
-
}
|
|
118
|
-
if (this.hmr) {
|
|
119
|
-
await this.hmr.shutdown();
|
|
120
|
-
}
|
|
121
|
-
console.log('🛑 AfriCode stopped');
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Utility to initialize the full framework (legacy compatibility)
|
|
127
|
-
*/
|
|
128
|
-
export function init(projectComponentMap: Record<string, any> = {}): void {
|
|
129
|
-
if (typeof window !== 'undefined') {
|
|
130
|
-
console.log('🌍 AfriCode SDK Initialized (Zero-Config Mode)');
|
|
131
|
-
|
|
132
|
-
// Merge project map with core map
|
|
133
|
-
const finalMap = { ...coreMap, ...projectComponentMap };
|
|
134
|
-
|
|
135
|
-
if (Object.keys(finalMap).length > 0) {
|
|
136
|
-
hydrate(finalMap);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Core exports
|
|
142
|
-
export {
|
|
143
|
-
createReactiveState,
|
|
144
|
-
subscribe,
|
|
145
|
-
createSignal,
|
|
146
|
-
createEffect,
|
|
147
|
-
store,
|
|
148
|
-
actions,
|
|
149
|
-
patterns,
|
|
150
|
-
motion,
|
|
151
|
-
hydrate,
|
|
152
|
-
html,
|
|
153
|
-
Layout,
|
|
154
|
-
schemas,
|
|
155
|
-
Validation,
|
|
156
|
-
rules,
|
|
157
|
-
afri,
|
|
158
|
-
AfriFieldBuilder,
|
|
159
|
-
normalizeInput,
|
|
160
|
-
buildSchema,
|
|
161
|
-
createFramework,
|
|
162
|
-
getConfig,
|
|
163
|
-
AfriCodeError,
|
|
164
|
-
ValidationError,
|
|
165
|
-
InvalidUrlError,
|
|
166
|
-
SecurityError,
|
|
167
|
-
CsrfError,
|
|
168
|
-
RateLimitError,
|
|
169
|
-
DatabaseError,
|
|
170
|
-
ComponentError
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
// v5.0.0 autonomous exports
|
|
174
|
-
export {
|
|
175
|
-
initA2UI,
|
|
176
|
-
A2UIRenderer,
|
|
177
|
-
A2UIProtocol,
|
|
178
|
-
NIDAClient,
|
|
179
|
-
TIPSClient,
|
|
180
|
-
AMLComplianceEngine,
|
|
181
|
-
ComplianceMiddleware,
|
|
182
|
-
initBunRuntime,
|
|
183
|
-
HotReloadEngine,
|
|
184
|
-
BunHTTPServer,
|
|
185
|
-
BunDatabase,
|
|
186
|
-
PerformanceMonitor,
|
|
187
|
-
EnhancedHMRMiddleware,
|
|
188
|
-
A2uiSchemaManager,
|
|
189
|
-
LipaNambaJourney
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
// Component exports
|
|
193
|
-
export { componentMap as components } from '../components/index.js';
|
|
194
|
-
|
|
195
|
-
// Re-export for convenience
|
|
196
|
-
export default AfriCode;
|