sptc 0.0.10 → 0.0.11

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.
@@ -239,7 +239,18 @@ function buildContext(ctx0, option) {
239
239
  isEntry: false,
240
240
  })
241
241
  const ret=executeVm(_vm, _ctx, priv)
242
- return Object.assign({}, _ctx._exports, {__getter__: (...x)=>ret.constructor('return '+(x.length>1? '['+x.join(',')+']': x))()})
242
+ return new Proxy(_ctx._exports, {
243
+ get: (target, prop, receiver)=>{
244
+ if(false===prop in target) {
245
+ try{
246
+ return ret.constructor('return '+prop)()
247
+ }catch(e) {
248
+ return undefined
249
+ }
250
+ }
251
+ return target[prop]
252
+ },
253
+ })
243
254
  }
244
255
 
245
256
  ctx.__autoload=fn=>{
@@ -259,8 +270,7 @@ function buildContext(ctx0, option) {
259
270
  if(priv.__autoload_func) {
260
271
  let inc_fn=priv.__autoload_func(prop)
261
272
  if(inc_fn) {
262
- const e=ctx.include(inc_fn)
263
- return priv.__autoload_vars[prop]=e.default || e.__getter__(prop)
273
+ return priv.__autoload_vars[prop]=ctx.include(inc_fn)[prop]
264
274
  }
265
275
  }
266
276
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sptc",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Simple Pretreat Toolkit CLI",
5
5
  "main": "index.js",
6
6
  "engines": {
package/tests/www/dd.s ADDED
@@ -0,0 +1,2 @@
1
+ <?js
2
+ const aaa='LLL'
package/tests/www/index.s CHANGED
@@ -9,6 +9,10 @@ echo($_REQUEST_FILE)
9
9
  define('DDD', 2)
10
10
  include(__dirname+'/cc.s')
11
11
 
12
+
13
+ const p=include(__dirname+'/dd.s')
14
+ console.log('p.aaa=', p.aaa)
15
+
12
16
  echo('oaawecR=>'+RRR, Math.random())
13
17
 
14
18
  /*