reflection architecture
[assignglobalthis, defineprototype]で構成。define reflection.
reflection of assign(data uri)
code
<!doctype html><head><style>
body{background-color:#ffffffff;color:#000000ff}
@media(prefers-color-scheme:dark){body{background-color:#000000ff;color:#ffffffff}}
</style>
<script>{
const assign=function(b,v){
return(b?async c=>{
for(let i=0;i<v.length;i++){
if(`string`===typeof v[i][1])v[i][1]=(await import(v[i][1])).default
c(v[i])
}
}:c=>{
for(let i=0;i<v.length;i++){
c(v[i])
}
})(v=>globalThis[v[0]]||(globalThis[v[0]]=v[1]))
}
}</script></head></html>
reflection of define(data uri)
code
<!doctype html><head><style>
body{background-color:#ffffffff;color:#000000ff}
@media(prefers-color-scheme:dark){body{background-color:#000000ff;color:#ffffffff}}
</style>
<script>{
const define=function(b,v,c){
const getOwnPropertyDescriptor=([o,p])=>Reflect.getOwnPropertyDescriptor(o.prototype,p)
,defineProperty=(descriptor=>([o,p,value])=>Reflect.defineProperty(o.prototype,p,Object.assign({value},descriptor)))(0b01&b?{configurable:true}:{})
,deleteProperty=([o,p])=>Reflect.deleteProperty(o.prototype,p)
return(b>>>1?async l=>{
for(let i=0;i<v.length;i++){
if(`string`===typeof v[i])v[i]=(await import(v[i])).default
if(!getOwnPropertyDescriptor(v[i]))v[l++]=v[i]
}
v.length=l
try{
for(let i=0;i<v.length;i++)defineProperty(v[i])
return await c()
}finally{
if(0b01&b)for(let i=0;i<v.length;i++)deleteProperty(v[i])
}
}:l=>{
for(let i=0;i<v.length;i++){
if(!getOwnPropertyDescriptor(v[i]))v[l++]=v[i]
}
v.length=l
try{
for(let i=0;i<v.length;i++)defineProperty(v[i])
return c()
}finally{
if(0b01&b)for(let i=0;i<v.length;i++)deleteProperty(v[i])
}
})(0)
}
}</script></head></html>