lilact 0.26.1 → 0.26.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/src/run.jsx CHANGED
@@ -56,7 +56,7 @@ function joinPaths(basePath, relativePath) {
56
56
  }
57
57
 
58
58
  // Examples:
59
- //console.log(joinPaths("a/b/c", "./../d")); // a/b/dfdsfds
59
+ //console.log(joinPaths("a/b/c", "./../d")); // a/b/d
60
60
  //console.log(joinPaths("a/b/c", "../../d")); // a/d
61
61
 
62
62
  /** @ignore */
@@ -68,16 +68,15 @@ export const required_scripts = {};
68
68
  *
69
69
  * @param jsx - The code to run.
70
70
  * @param path - The optional path to be used in reporting errors.
71
- * @param is_inline - To treat the code as inline. The main difference at the moment is that inline code doesn't include sourcemap.
72
71
  *
73
72
  * @returns An array representation of the children.
74
73
  */
75
- export function run(jsx, path=`InlineJSX-${++Lilact.eval_num}`, is_inline=true)
74
+ export function run(jsx, path=`InlineJSX-${++Lilact.eval_num}`, {isInline, isModule}={isInline:true, isModule:true})
76
75
  {
77
76
  const mappings = [];
78
77
  const module = {
79
78
  mappings,
80
- is_inline,
79
+ isInline,
81
80
  path,
82
81
  code: jsx,
83
82
  exports: {}
@@ -124,7 +123,7 @@ if(DEBUG) {
124
123
 
125
124
  //const res = new Function( "module", processed )(module);
126
125
  const res = eval(processed);
127
- if(module.exports) return module.exports;
126
+ if(isModule && module.exports) return module.exports;
128
127
  return res;
129
128
  }
130
129
  catch(e) {
@@ -199,7 +198,7 @@ export function require(path)
199
198
  // but import should be sync. for an async solution use lazy and suspense.
200
199
 
201
200
  const request = new XMLHttpRequest();
202
- request.open("GET", path, false);
201
+ request.open("GET", path, {isInline:false});
203
202
  request.send(null);
204
203
  if (request.status === 200) {
205
204
  return run(request.responseText, path, false);