aiplang 2.1.1 → 2.1.2
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/bin/aiplang.js
CHANGED
|
@@ -5,7 +5,7 @@ const fs = require('fs')
|
|
|
5
5
|
const path = require('path')
|
|
6
6
|
const http = require('http')
|
|
7
7
|
|
|
8
|
-
const VERSION = '2.1.
|
|
8
|
+
const VERSION = '2.1.2'
|
|
9
9
|
const RUNTIME_DIR = path.join(__dirname, '..', 'runtime')
|
|
10
10
|
const cmd = process.argv[2]
|
|
11
11
|
const args = process.argv.slice(3)
|
|
@@ -111,10 +111,9 @@ if (cmd==='init') {
|
|
|
111
111
|
const src=path.join(RUNTIME_DIR,f); if(fs.existsSync(src)) fs.copyFileSync(src,path.join(dir,'public',f))
|
|
112
112
|
}
|
|
113
113
|
fs.writeFileSync(path.join(dir,'public','index.html'),`<!DOCTYPE html>
|
|
114
|
-
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${name}</title
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
</script></body></html>`)
|
|
114
|
+
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${name}</title>
|
|
115
|
+
<meta http-equiv="refresh" content="0; url=/">
|
|
116
|
+
</head><body><p>Run <code>npx aiplang serve</code> to start the dev server.</p></body></html>`)
|
|
118
117
|
fs.writeFileSync(path.join(dir,'pages','home.flux'), (TEMPLATES[tplName]||TEMPLATES.default)(name, year))
|
|
119
118
|
fs.writeFileSync(path.join(dir,'package.json'), JSON.stringify({name,version:'0.1.0',scripts:{dev:'npx aiplang serve',build:'npx aiplang build pages/ --out dist/'},devDependencies:{'aiplang':`^${VERSION}`}},null,2))
|
|
120
119
|
fs.writeFileSync(path.join(dir,'.gitignore'),'dist/\nnode_modules/\n')
|
|
@@ -209,7 +208,7 @@ if (cmd==='serve'||cmd==='dev') {
|
|
|
209
208
|
// ── Dev server (full-stack) ──────────────────────────────────────
|
|
210
209
|
if (cmd === 'start' || cmd === 'run') {
|
|
211
210
|
const aipFile = args[0]
|
|
212
|
-
if (!aipFile || !fs.existsSync(
|
|
211
|
+
if (!aipFile || !fs.existsSync(aipFile)) {
|
|
213
212
|
console.error(`\n ✗ Usage: aiplang start <app.flux>\n`)
|
|
214
213
|
process.exit(1)
|
|
215
214
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* aiplang-hydrate.js — aiplang Hydration Runtime v2.1
|
|
3
3
|
* Handles: state, queries, table, list, form, if, edit, delete, btn, select
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -64,7 +64,7 @@ async function runQuery(q) {
|
|
|
64
64
|
applyAction(data, q.target, q.action)
|
|
65
65
|
return data
|
|
66
66
|
} catch (e) {
|
|
67
|
-
console.warn('[
|
|
67
|
+
console.warn('[aiplang]', q.method, path, e.message)
|
|
68
68
|
return null
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* aiplang-runtime.js — aiplang Runtime v2.1
|
|
3
3
|
* Reactive state + SPA routing + DOM engine + query engine
|
|
4
4
|
* Zero dependencies. ~28KB unminified.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const AIPLANG = (() => {
|
|
8
8
|
|
|
9
9
|
// ─────────────────────────────────────────────────────────────
|
|
10
10
|
// ICONS
|
|
@@ -165,7 +165,7 @@ class QueryEngine {
|
|
|
165
165
|
this._applyResult(data, q.target, q.action)
|
|
166
166
|
return data
|
|
167
167
|
} catch (e) {
|
|
168
|
-
console.warn('[
|
|
168
|
+
console.warn('[aiplang] query failed:', q.method, path, e.message)
|
|
169
169
|
return null
|
|
170
170
|
}
|
|
171
171
|
}
|
|
@@ -1078,7 +1078,7 @@ function boot(src, container) {
|
|
|
1078
1078
|
|
|
1079
1079
|
const pages = parseFlux(src)
|
|
1080
1080
|
if (!pages.length) {
|
|
1081
|
-
container.textContent = '[
|
|
1081
|
+
container.textContent = '[aiplang] no pages found'
|
|
1082
1082
|
return
|
|
1083
1083
|
}
|
|
1084
1084
|
|
|
@@ -1095,6 +1095,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
1095
1095
|
if (script) {
|
|
1096
1096
|
const targetSel = script.getAttribute('target') || '#app'
|
|
1097
1097
|
const container = document.querySelector(targetSel)
|
|
1098
|
-
if (container)
|
|
1098
|
+
if (container) AIPLANG.boot(script.textContent, container)
|
|
1099
1099
|
}
|
|
1100
1100
|
})
|