@africode/core 5.0.2 → 5.0.3
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/dev.js +23 -3
- package/dist/build-info.json +3 -3
- package/package.json +1 -1
- 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/core/cli/commands/dev.js
CHANGED
|
@@ -36,7 +36,8 @@ export async function dev() {
|
|
|
36
36
|
// 3. JS-First Page Rendering
|
|
37
37
|
const pageName = pathname.replace(/^\//, '').replace(/\.html$/, '');
|
|
38
38
|
const cwd = process.cwd();
|
|
39
|
-
const
|
|
39
|
+
const { existsSync } = await import('node:fs');
|
|
40
|
+
const hasSrc = existsSync(nodePath.join(cwd, 'src/pages'));
|
|
40
41
|
const pagesDir = hasSrc ? 'src/pages' : 'pages';
|
|
41
42
|
const jsPagePath = `./${pagesDir}/${pageName}.js`;
|
|
42
43
|
|
|
@@ -74,7 +75,7 @@ export async function dev() {
|
|
|
74
75
|
return new Response(htmlContent, { headers: { 'Content-Type': 'text/html' } });
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
// 5. Static Assets
|
|
78
|
+
// 5. Static Assets (project root)
|
|
78
79
|
const file = Bun.file('.' + url.pathname);
|
|
79
80
|
if (await file.exists()) {
|
|
80
81
|
if (pathname.endsWith('.html')) {
|
|
@@ -93,7 +94,26 @@ export async function dev() {
|
|
|
93
94
|
return new Response(file, { headers: { 'Content-Type': types[ext] || 'application/octet-stream' } });
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
// 6.
|
|
97
|
+
// 6. node_modules serving (for bare import resolution via importmap)
|
|
98
|
+
if (pathname.startsWith('/node_modules/')) {
|
|
99
|
+
const nmFile = Bun.file('.' + pathname);
|
|
100
|
+
if (await nmFile.exists()) {
|
|
101
|
+
const ext = pathname.split('.').pop();
|
|
102
|
+
const types = {
|
|
103
|
+
css: 'text/css', js: 'application/javascript', mjs: 'application/javascript',
|
|
104
|
+
json: 'application/json', svg: 'image/svg+xml', woff: 'font/woff',
|
|
105
|
+
woff2: 'font/woff2', ttf: 'font/ttf'
|
|
106
|
+
};
|
|
107
|
+
return new Response(nmFile, {
|
|
108
|
+
headers: {
|
|
109
|
+
'Content-Type': types[ext] || 'application/octet-stream',
|
|
110
|
+
'Access-Control-Allow-Origin': '*'
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 7. Framework Fallback (for linked projects)
|
|
97
117
|
const frameworkFile = Bun.file(nodePath.join(frameworkRoot, url.pathname));
|
|
98
118
|
if (await frameworkFile.exists()) {
|
|
99
119
|
const ext = pathname.split('.').pop();
|
package/dist/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2026-06-
|
|
3
|
-
"version": "5.0.
|
|
2
|
+
"timestamp": "2026-06-28T07:49:55.934Z",
|
|
3
|
+
"version": "5.0.3",
|
|
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": "155.00ms"
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@africode/core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Bun-native full-stack framework with generative AI, fintech compliance, and real-time performance - built for Tanzanian digital economy",
|
|
5
5
|
"module": "src/index.ts",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -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/src/index.ts",
|
|
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/src/index.ts"></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/src/index.ts",
|
|
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/src/index.ts"></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/src/index.ts",
|
|
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/src/index.ts"></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/src/index.ts",
|
|
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/src/index.ts"></script>
|
|
14
24
|
|
|
15
25
|
<!-- SDK & Components -->
|
|
16
26
|
<script type="module">
|