add fallback module code injection, api.beta and api.new endpoint for apps
This commit is contained in:
parent
16a91b94c3
commit
418b5ba6a3
2 changed files with 16 additions and 2 deletions
11
app.js
11
app.js
|
|
@ -240,7 +240,16 @@ function initModule(mod, file, dir) {
|
||||||
any: arg => { mod.add(arg) },
|
any: arg => { mod.add(arg) },
|
||||||
code() {
|
code() {
|
||||||
const [ path, file ] = [ ...arguments ];
|
const [ path, file ] = [ ...arguments ];
|
||||||
code[path] = fs.readFileSync(file);
|
if (lastmod(file)) {
|
||||||
|
code[path] = fs.readFileSync(file);
|
||||||
|
// console.log({ CODE: path, file });
|
||||||
|
} else if (lastmod(mod.dir + '/' + file)) {
|
||||||
|
const alt = mod.dir + '/' + file;
|
||||||
|
code[path] = fs.readFileSync(alt);
|
||||||
|
// console.log({ CODE: path, alt });
|
||||||
|
} else {
|
||||||
|
console.log({ MISSING_CODE: path, file });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
full: arg => { mod.add(fullpath(arg)) },
|
full: arg => { mod.add(fullpath(arg)) },
|
||||||
map: arg => { mod.add(fixedmap(arg)) },
|
map: arg => { mod.add(fixedmap(arg)) },
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,10 @@ import { functions } from './function.js';
|
||||||
import { platform } from './platform.js';
|
import { platform } from './platform.js';
|
||||||
import { selection } from './selection.js';
|
import { selection } from './selection.js';
|
||||||
import { stats } from '../kiri/stats.js';
|
import { stats } from '../kiri/stats.js';
|
||||||
|
import { newWidget } from './widget.js';
|
||||||
import { widgets } from './widgets.js';
|
import { widgets } from './widgets.js';
|
||||||
import { updateTool } from '../kiri-mode/cam/tools.js';
|
import { updateTool } from '../kiri-mode/cam/tools.js';
|
||||||
import { version } from '../moto/license.js';
|
import { beta, version } from '../moto/license.js';
|
||||||
import { space as SPACE } from '../moto/space.js';
|
import { space as SPACE } from '../moto/space.js';
|
||||||
|
|
||||||
import { LANG } from './lang.js';
|
import { LANG } from './lang.js';
|
||||||
|
|
@ -120,6 +121,7 @@ function localSet(key, val) {
|
||||||
|
|
||||||
export const api = {
|
export const api = {
|
||||||
ajax,
|
ajax,
|
||||||
|
beta,
|
||||||
alerts,
|
alerts,
|
||||||
busy,
|
busy,
|
||||||
catalog,
|
catalog,
|
||||||
|
|
@ -147,6 +149,9 @@ export const api = {
|
||||||
local,
|
local,
|
||||||
modal,
|
modal,
|
||||||
mode,
|
mode,
|
||||||
|
new: {
|
||||||
|
widget: newWidget
|
||||||
|
},
|
||||||
noop,
|
noop,
|
||||||
o2js,
|
o2js,
|
||||||
onkey,
|
onkey,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue