lilact 0.26.16 → 0.27.0

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.
Files changed (62) hide show
  1. package/dist/lilact.development.js +236 -337
  2. package/dist/lilact.development.js.map +3 -3
  3. package/dist/lilact.development.min.js +34 -34
  4. package/dist/lilact.development.min.js.map +3 -3
  5. package/dist/lilact.production.min.js +34 -34
  6. package/docs/assets/navigation.js +1 -1
  7. package/docs/assets/search.js +1 -1
  8. package/docs/classes/accessories.ErrorBoundary.html +8 -8
  9. package/docs/classes/accessories.Suspense.html +7 -7
  10. package/docs/classes/components.Component.html +11 -11
  11. package/docs/classes/components.HTMLComponent.html +11 -11
  12. package/docs/classes/components.RootComponent.html +11 -11
  13. package/docs/functions/components.cloneComponent.html +1 -1
  14. package/docs/functions/components.createComponent.html +1 -1
  15. package/docs/functions/components.createPortal.html +1 -1
  16. package/docs/functions/components.createRoot.html +1 -1
  17. package/docs/functions/components.memo.html +1 -1
  18. package/docs/functions/components.render.html +1 -1
  19. package/docs/functions/errors.globalErrorHandler.html +1 -2
  20. package/docs/functions/errors.scanBlockLabels.html +1 -2
  21. package/docs/functions/errors.traceError.html +1 -3
  22. package/docs/functions/hooks.startTransition.html +1 -1
  23. package/docs/functions/hooks.useActionState.html +1 -1
  24. package/docs/functions/hooks.useDebugValue.html +1 -1
  25. package/docs/functions/hooks.useDeferredValue.html +1 -1
  26. package/docs/functions/hooks.useEffect.html +1 -1
  27. package/docs/functions/hooks.useImperativeHandle.html +1 -1
  28. package/docs/functions/hooks.useInsertionEffect.html +1 -1
  29. package/docs/functions/hooks.useMemo.html +1 -1
  30. package/docs/functions/hooks.useReducer.html +1 -1
  31. package/docs/functions/run.lazy.html +1 -2
  32. package/docs/functions/run.require.html +1 -2
  33. package/docs/functions/run.run.html +1 -2
  34. package/docs/functions/run.runScripts.html +1 -1
  35. package/docs/functions/timers.timeoutPromise.html +3 -3
  36. package/docs/modules/errors.html +1 -1
  37. package/docs/modules/run.html +1 -1
  38. package/docs/static/index.html +1 -1
  39. package/docs/static/lilact.development.js +236 -337
  40. package/docs/static/lilact.development.js.map +3 -3
  41. package/docs/static/lilact.development.min.js +34 -34
  42. package/docs/static/lilact.development.min.js.map +3 -3
  43. package/docs/static/lilact.production.min.js +34 -34
  44. package/docs/variables/components.cloneElement.html +1 -1
  45. package/docs/variables/errors.blocks_info.html +1 -1
  46. package/docs/variables/errors.error.html +1 -1
  47. package/docs/variables/run.required_scripts.html +1 -0
  48. package/examples/index.html +1 -1
  49. package/examples/lilact.development.js +236 -337
  50. package/examples/lilact.development.js.map +3 -3
  51. package/examples/lilact.development.min.js +34 -34
  52. package/examples/lilact.development.min.js.map +3 -3
  53. package/examples/lilact.production.min.js +34 -34
  54. package/package.json +1 -1
  55. package/src/components.jsx +10 -4
  56. package/src/errors.jsx +179 -364
  57. package/src/expscan.js +1 -1
  58. package/src/hooks.jsx +8 -5
  59. package/src/jsx.js +14 -14
  60. package/src/lilact.jsx +1 -1
  61. package/src/run.jsx +119 -157
  62. package/docs/functions/errors.mapLocation.html +0 -1
package/src/hooks.jsx CHANGED
@@ -275,7 +275,7 @@ export function useRef(initialValue = null)
275
275
  */
276
276
  export async function useLayoutEffect(effect, deps=undefined)
277
277
  {
278
- if( deps!==undefined && (typeof(deps)!=='object' || deps.constructor.name!=='Array') ) {
278
+ if( deps!==undefined && (typeof(deps)!=='object' && deps.constructor.name!=='Array') ) {
279
279
  throw new Error("Layout effect dependencies must be an array, object or omitted.");
280
280
  }
281
281
 
@@ -287,7 +287,8 @@ export async function useLayoutEffect(effect, deps=undefined)
287
287
 
288
288
  if(hk?.cleanup) {
289
289
  await hk.cleanup();
290
- }
290
+ hk.cleanup = undefined;
291
+ }
291
292
 
292
293
  hk.deps = deps;
293
294
  Lilact.layout_effects.add( async ()=>{ hk.cleanup = await effect(); });
@@ -306,7 +307,7 @@ export async function useLayoutEffect(effect, deps=undefined)
306
307
  */
307
308
  export async function useEffect(effect, deps=undefined)
308
309
  {
309
- if( deps!==undefined && (typeof(deps)!=='object' || deps.constructor.name!=='Array') ) {
310
+ if( deps!==undefined && (typeof(deps)!=='object' && deps.constructor.name!=='Array') ) {
310
311
  throw new Error("Effect dependencies must be an array, object or omitted.");
311
312
  }
312
313
 
@@ -318,6 +319,7 @@ export async function useEffect(effect, deps=undefined)
318
319
 
319
320
  if(hk?.cleanup) {
320
321
  await hk.cleanup();
322
+ hk.cleanup = undefined;
321
323
  }
322
324
 
323
325
  hk.deps = deps;
@@ -338,7 +340,7 @@ export async function useEffect(effect, deps=undefined)
338
340
  */
339
341
  export async function useInsertionEffect(effect, deps=undefined)
340
342
  {
341
- if( deps!==undefined && (typeof(deps)!=='object' || deps.constructor.name!=='Array') ) {
343
+ if( deps!==undefined && (typeof(deps)!=='object' && deps.constructor.name!=='Array') ) {
342
344
  throw new Error("Insertion effect dependencies must be an array, object, or omitted.");
343
345
  }
344
346
 
@@ -350,6 +352,7 @@ export async function useInsertionEffect(effect, deps=undefined)
350
352
 
351
353
  if(hk?.cleanup) {
352
354
  await hk.cleanup();
355
+ hk.cleanup = undefined;
353
356
  }
354
357
 
355
358
  hk.deps = deps;
@@ -370,7 +373,7 @@ export async function useInsertionEffect(effect, deps=undefined)
370
373
  */
371
374
  export function useMemo(factory,deps=undefined)
372
375
  {
373
- if( deps!==undefined && (typeof(deps)!=='object' || deps.constructor.name!=='Array') ) {
376
+ if( deps!==undefined && (typeof(deps)!=='object' && deps.constructor.name!=='Array') ) {
374
377
  throw new Error("Memo dependencies must be an array or omitted.");
375
378
  }
376
379
 
package/src/jsx.js CHANGED
@@ -44,7 +44,7 @@
44
44
  // to report any bugs, and please include a testable example. Thanks! :)
45
45
 
46
46
  // note: JSX or preprocessors are not processed inside template strings
47
- // todo: injected string try catchs should be generated by a function
47
+ // todo: injected string try/catches should be generated by a function
48
48
 
49
49
  /** @ignore */
50
50
  export const transpilerConfig = {
@@ -88,7 +88,7 @@ function parseRegex(code, index, container)
88
88
 
89
89
  let i = index;
90
90
  let dels = `;=,([{}!^~&|:?*%-+/<>${transpilerConfig.preprocessorDelimiter}`;
91
- while(--i>0) {
91
+ while(--i>=0) {
92
92
  if( ' \t\r'.indexOf(code[i])!==-1 ) continue;
93
93
  if(code[i]==='\n' ) {
94
94
  dels+=")]";
@@ -615,10 +615,10 @@ function parseXML(code, index, container, look_behind=false)
615
615
  }
616
616
 
617
617
 
618
- function parseParanthesis(code, index, container)
618
+ function parseParenthesis(code, index, container)
619
619
  {
620
620
  const b = { // block
621
- type: "paranthesis",
621
+ type: "parenthesis",
622
622
  begin: index,
623
623
  cbegin: ++index,
624
624
  children: [],
@@ -647,7 +647,7 @@ function parseParanthesis(code, index, container)
647
647
  break;
648
648
 
649
649
  case '(':
650
- [index] = lookAhead( parseParanthesis, code, index, b );
650
+ [index] = lookAhead( parseParenthesis, code, index, b );
651
651
  break;
652
652
 
653
653
  case '}':
@@ -674,7 +674,7 @@ function parseParanthesis(code, index, container)
674
674
  }
675
675
  }
676
676
 
677
- raiseError(`Unterminated paranthesis block`, b.begin);
677
+ raiseError(`Unterminated parenthesis block`, b.begin);
678
678
  }
679
679
 
680
680
 
@@ -713,11 +713,11 @@ function parseJS(code, index=0, is_block=false, container)
713
713
  }
714
714
 
715
715
  case '(': // this is only for function detection
716
- [index] = lookAhead( parseParanthesis, code, index, b );
716
+ [index] = lookAhead( parseParenthesis, code, index, b );
717
717
  break;
718
718
 
719
719
  case ')': // this is only for function detection
720
- raiseError(`Unmatched paranthesis`, b.begin);
720
+ raiseError(`Unmatched parenthesis`, b.begin);
721
721
  break;
722
722
 
723
723
  case '}':
@@ -790,7 +790,7 @@ function labelFunctions(node, eols, blocks_info)
790
790
  let i, nxt, prev;
791
791
  for(let chi=0; chi<node.children.length; chi++) {
792
792
 
793
- if(typeof(node.children[chi])==='object' && node.children[chi].type==='paranthesis') {
793
+ if(typeof(node.children[chi])==='object' && node.children[chi].type==='parenthesis') {
794
794
 
795
795
  [i, prev] = getNext(chi, -1);
796
796
  if(prev===null) continue;
@@ -808,7 +808,7 @@ function labelFunctions(node, eols, blocks_info)
808
808
  if(nxt===null) continue;
809
809
 
810
810
  if(transpilerConfig.injectTraceLabels && typeof(nxt)==='object' && nxt.type==='js') {
811
- const begin = getRowCol(eols, chi); // begin is always the location of function args paranthesis
811
+ const begin = getRowCol(eols, chi); // begin is always the location of function args parenthesis
812
812
  nxt.children.splice(1,0, `/*LILACTBLOCK${++blocks_info.counter}:${begin}:${label}*/try{`);
813
813
  if(transpilerConfig.enableLabelStack) {
814
814
  nxt.children.splice(nxt.children.length-1, 0, `} catch(e){ if(typeof(e)!=='object') e=new Error(e);e.lilact_trace=[${blocks_info.counter},e.lilact_trace];throw e}`);
@@ -823,9 +823,9 @@ function labelFunctions(node, eols, blocks_info)
823
823
  else if(node.children[chi]==='=>') {
824
824
  [i, prev] = getNext(chi, -1);
825
825
 
826
- if(typeof(prev)==='object' && prev.type==='paranthesis') {
826
+ if(typeof(prev)==='object' && prev.type==='parenthesis') {
827
827
 
828
- const begin = getRowCol(eols, prev.begin); // begin is always the location of function args paranthesis
828
+ const begin = getRowCol(eols, prev.begin); // begin is always the location of function args parenthesis
829
829
 
830
830
  [i, nxt] = getNext(chi);
831
831
 
@@ -958,7 +958,7 @@ function generateSourceMap(json, path, jsx_eols, out_eols, mappings=[])
958
958
  /**
959
959
  * This is the function that transpiles jsx code to js. It is not recommended to use directly.
960
960
  *
961
- * Use `Lilact.require` instead, or `Lilact.run` available in `run`, or add a `<scirpt type="text/jsx" .../>` to your html.
961
+ * Use `Lilact.require` instead, or `Lilact.run` available in `run`, or add a `<script type="text/jsx" .../>` to your html.
962
962
  *
963
963
  * Lilact jsx parser doesn't rely on the Lilact itself, and can be used by other engines. The easiest way
964
964
  * is using the `bin/transpile.js` script. It has its own help.
@@ -1090,7 +1090,7 @@ export function transpileJSX( jsx, {
1090
1090
  if(node.type==='directive') return node.value;
1091
1091
 
1092
1092
 
1093
- if(node.type==='paranthesis') {
1093
+ if(node.type==='parenthesis') {
1094
1094
  let out = "(";
1095
1095
 
1096
1096
  if(node.out) {
package/src/lilact.jsx CHANGED
@@ -94,7 +94,7 @@ export {transpileJSX, transpilerConfig} from "./jsx";
94
94
  export const Lilact =
95
95
  {
96
96
 
97
- VERSION: "RC.3",
97
+ VERSION: "RC.4",
98
98
 
99
99
  // Configuration
100
100
 
package/src/run.jsx CHANGED
@@ -29,7 +29,7 @@
29
29
  */
30
30
  /*
31
31
  Lilact
32
- Copyright (C) 2024-2026 Arash Kazemi
32
+ Copyright (C) 2024-2026 Arash Kazemi <contact.arash.kazemi@gmail.com>
33
33
  BSD-2-Clause
34
34
  */
35
35
 
@@ -39,94 +39,71 @@ import { LAZY } from "./symbols.jsx";
39
39
  import { injectGlobal } from "@emotion/css";
40
40
 
41
41
  function joinPaths(basePath, relativePath) {
42
- const isAbsolute = relativePath.startsWith("/");
43
- const stack = [];
44
-
45
- const parts = (isAbsolute ? "" : basePath)
42
+ const absolute = relativePath.startsWith("/");
43
+ const parts = (absolute ? "" : basePath)
46
44
  .split("/")
47
45
  .filter(Boolean);
48
46
 
49
- for (const part of parts) {
50
- stack.push(part);
51
- }
52
-
53
- if (!basePath.endsWith("/")) {
54
- stack.pop();
55
- }
47
+ if (!absolute && !basePath.endsWith("/")) parts.pop();
56
48
 
57
49
  for (const part of relativePath.split("/")) {
58
- if (part === "" || part === ".") continue;
59
-
60
- if (part === "..") {
61
- if (stack.length > 0) stack.pop();
62
- } else {
63
- stack.push(part);
64
- }
50
+ if (!part || part === ".") continue;
51
+ if (part === "..") parts.pop();
52
+ else parts.push(part);
65
53
  }
66
54
 
67
- return `${isAbsolute ? "/" : ""}${stack.join("/")}`;
55
+ return `${absolute ? "/" : ""}${parts.join("/")}`;
68
56
  }
69
57
 
70
- function asError(value, fallbackMessage = "Unknown error") {
58
+ function asError(value, fallback = "Unknown error") {
71
59
  if (value instanceof Error) return value;
60
+ if (value?.error instanceof Error) return value.error;
72
61
 
73
- if (value && typeof value === "object") {
74
- if (value.error instanceof Error) return value.error;
75
-
76
- const error = new Error(
77
- value.message == null ? fallbackMessage : String(value.message)
78
- );
62
+ const error = new Error(
63
+ value?.message == null ? fallback : String(value.message)
64
+ );
79
65
 
66
+ if (value && typeof value === "object") {
80
67
  if (value.name) error.name = value.name;
81
-
82
- if (value.stack) {
83
- Object.defineProperty(error, "stack", {
84
- value: value.stack,
85
- configurable: true,
86
- });
87
- }
68
+ if (value.stack) error.stack = value.stack;
88
69
 
89
70
  for (const key of Object.keys(value)) {
90
71
  if (!(key in error)) error[key] = value[key];
91
72
  }
92
-
93
- return error;
94
73
  }
95
74
 
96
- return new Error(
97
- value == null ? fallbackMessage : String(value)
98
- );
75
+ return error;
99
76
  }
100
77
 
101
- function attachPath(error, path) {
102
- const result = asError(error);
78
+ /*
79
+ * The first module that catches an error owns its source location.
80
+ * Parent modules must never replace it.
81
+ */
82
+ function markSource(value, path) {
83
+ const error = asError(value);
103
84
 
104
- if (result.fileName == null) result.fileName = path;
85
+ if (!error.lilact_source) {
86
+ error.lilact_source = { path };
87
+ }
105
88
 
106
- return result;
89
+ return error;
107
90
  }
108
91
 
109
- function reportRuntimeError(error, path) {
110
- const withPath = attachPath(error, path);
92
+ function report(value, path) {
93
+ const error = markSource(value, path);
94
+
95
+ if (error.isTraced) return error;
111
96
 
112
- /*
113
- * lilact.jsx may expose traceError on the public namespace. Avoid a
114
- * static import here because errors.jsx already imports run.jsx.
115
- */
116
97
  if (typeof Lilact.traceError === "function") {
117
- return Lilact.traceError(withPath, path);
98
+ return Lilact.traceError(error, path);
118
99
  }
119
100
 
120
- Lilact.error = withPath;
121
- return withPath;
101
+ Lilact.error = error;
102
+ return error;
122
103
  }
123
104
 
124
- /** @ignore */
125
105
  export const required_scripts = {};
126
106
 
127
- /**
128
- * Transpiles and evaluates one JSX module.
129
- */
130
107
  export function run(
131
108
  jsx,
132
109
  path = `InlineJSX-${++Lilact.eval_num}`,
@@ -135,21 +112,17 @@ export function run(
135
112
  isModule = true,
136
113
  } = {}
137
114
  ) {
138
- const mappings = [];
115
+
139
116
 
140
117
  const module = {
141
- mappings,
142
- isInline,
143
- isModule,
144
118
  path,
145
119
  code: String(jsx),
120
+ mappings: [],
146
121
  exports: {},
122
+ isInline,
123
+ isModule,
147
124
  };
148
125
 
149
- /*
150
- * Register the module before transpiling. This makes the original source
151
- * available if transpilation or evaluation fails.
152
- */
153
126
  required_scripts[path] = module;
154
127
 
155
128
  let processed;
@@ -157,136 +130,130 @@ export function run(
157
130
  try {
158
131
  processed = Lilact.transpileJSX(String(jsx), {
159
132
  path,
160
- mappings,
133
+ mappings: module.mappings,
161
134
  factory: "createComponent",
162
135
  appendSourcemap: false,
163
136
  injectTraceLabels: true,
164
137
  produceCJS: true,
165
138
  blocks_info: Lilact.blocks_info,
166
139
  });
167
- } catch (error) {
168
- const parserError = attachPath(error, path);
169
- parserError.sourcePhase = "transpile";
170
- module.error = parserError;
171
- Lilact.error = parserError;
172
- throw parserError;
140
+ } catch (value) {
141
+ const error = asError(value);
142
+ error.fileName ??= path;
143
+ error.sourcePhase = "transpile";
144
+ module.error = error;
145
+ Lilact.error = error;
146
+ throw error;
173
147
  }
174
148
 
175
- if (typeof DEBUG !== "undefined" && DEBUG) {
176
- module.processed = processed;
149
+ if (typeof Lilact.scanBlockLabels === "function") {
150
+ Lilact.scanBlockLabels(processed, path);
177
151
  }
178
152
 
179
153
  /*
180
- * The sourceURL must be the final source directive in the evaluated
181
- * program. Browsers use it differently, but this format works for the
182
- * common eval stack formats.
183
- */
184
- processed = `${processed}\n//# sourceURL=eval:/${path}`;
185
-
186
- /*
187
- * Register block labels using the exact processed source that will be
188
- * evaluated.
154
+ * sourceURL helps when the browser includes eval locations in its stack.
155
+ * It is not used as the authoritative source; the catch block below is.
189
156
  */
190
- if (typeof Lilact.scanBlockLabels === "function") {
191
- Lilact.scanBlockLabels(processed, path);
192
- }
157
+ processed += `\n//# sourceURL=eval:/${path}`;
193
158
 
194
159
  try {
195
160
  globalThis.Lilact = Lilact;
196
161
  globalThis.createComponent = Lilact.createComponent;
197
162
  globalThis.Fragment = Lilact.Fragment;
198
163
 
164
+ const result = eval(processed);
165
+
166
+ return isEmpty(module.exports)
167
+ ? result
168
+ : module.exports;
169
+ } catch (value) {
199
170
  /*
200
- * This must remain a direct eval. Indirect eval changes the scope and
201
- * breaks the module runtime.
171
+ * This catch executes in the module whose eval failed, including
172
+ * generated-JavaScript syntax errors. Therefore path is authoritative.
202
173
  */
203
- const result = eval(processed);
174
+ const error = report(value, path);
204
175
 
205
- if (!isEmpty(module.exports)) {
206
- return module.exports;
207
- }
176
+ error.sourcePhase ??= "runtime";
177
+ module.error = error;
208
178
 
209
- return result;
210
- } catch (error) {
211
- const runtimeError = reportRuntimeError(error, path);
212
- runtimeError.sourcePhase = "runtime";
213
- module.error = runtimeError;
214
- throw runtimeError;
179
+ throw error;
215
180
  }
216
181
  }
217
182
 
218
- /**
219
- * Synchronously or asynchronously loads a JSX, JavaScript, or CSS resource.
220
- */
221
183
  export function require(path) {
222
- let forceUpdate;
223
- let checkExport;
224
- let requirer;
225
- let isLazy;
184
+ let options = {};
226
185
 
227
186
  if (
228
187
  arguments.length === 2 &&
229
188
  arguments[1] &&
230
189
  typeof arguments[1] === "object"
231
190
  ) {
232
- forceUpdate = arguments[1].forceUpdate;
233
- checkExport = arguments[1].checkExport;
234
- requirer = arguments[1].requirer;
235
- isLazy = arguments[1].isLazy;
191
+ options = arguments[1];
236
192
  }
237
193
 
194
+
238
195
  if (Lilact.importObjectPaths?.[path]) {
239
196
  return Lilact.importObjectPaths[path];
240
197
  }
241
198
 
242
- if (required_scripts[path] && !forceUpdate) {
199
+
200
+ const loadAsync =
201
+ Boolean(Lilact[LAZY]) ||
202
+ Boolean(options.isLazy);
203
+
204
+
205
+ if (options.requirer?.path) {
206
+ path = joinPaths(options.requirer.path, path);
207
+ }
208
+
209
+ if (required_scripts[path] && !options.forceUpdate && !loadAsync) {
243
210
  return required_scripts[path].exports;
244
211
  }
245
212
 
246
- if (path[0] === "#") {
213
+ if (path.startsWith("#")) {
247
214
  const element = document.getElementById(path.slice(1));
248
215
 
249
216
  if (!element) {
250
- const error = new Error(
251
- `Required element not found (${path})`
217
+ throw report(
218
+ new Error(`Required element not found (${path})`),
219
+ path
252
220
  );
253
- error.fileName = path;
254
- throw error;
255
221
  }
256
222
 
257
223
  return run(element.textContent || "", path);
258
224
  }
259
225
 
260
- if (requirer?.path) {
261
- path = joinPaths(requirer.path, path);
262
- }
263
-
264
- const loadAsync =
265
- Boolean(Lilact?.[LAZY]) || Boolean(isLazy);
266
-
267
226
  if (loadAsync) {
268
227
  Lilact[LAZY] = false;
269
228
 
270
229
  let request = Lilact.resolver?.(path);
271
230
 
272
- if (request === undefined || request === null) {
273
- request = fetch(path).then((response) => {
274
- if (!response.ok) {
275
- const error = new Error(
276
- `Unable to load ${path}: HTTP ${response.status}`
277
- );
278
- error.fileName = path;
279
- throw error;
280
- }
281
-
282
- return response.text();
283
- });
284
- } else {
231
+ if (request == null) {
232
+
233
+ if (required_scripts[path] && !options.forceUpdate) {
234
+ request = Promise.resolve(required_scripts[path].code);
235
+ }
236
+ else {
237
+ request = fetch(path).then(response => {
238
+ if (!response.ok) {
239
+ throw report(
240
+ new Error(
241
+ `Unable to load ${path}: HTTP ${response.status}`
242
+ ),
243
+ path
244
+ );
245
+ }
246
+
247
+ return response.text();
248
+ });
249
+ }
250
+ }
251
+ else {
285
252
  request = Promise.resolve(request);
286
253
  }
287
254
 
288
255
  return request
289
- .then((source) => {
256
+ .then(source => {
290
257
  if (path.endsWith(".css")) {
291
258
  injectGlobal(String(source));
292
259
  return;
@@ -297,18 +264,17 @@ export function require(path) {
297
264
  isModule: true,
298
265
  });
299
266
  })
300
- .then((result) => {
301
- if (path.endsWith(".css")) return result;
302
- return result?.default ?? result;
303
- })
304
- .catch((error) => {
305
- throw reportRuntimeError(error, path);
267
+ .then(result =>
268
+ result?.default ?? result
269
+ )
270
+ .catch(error => {
271
+ throw report(error, path);
306
272
  });
307
273
  }
308
274
 
309
275
  const resolved = Lilact.resolver?.(path);
310
276
 
311
- if (resolved !== undefined && resolved !== null) {
277
+ if (resolved != null) {
312
278
  if (path.endsWith(".css")) {
313
279
  injectGlobal(String(resolved));
314
280
  return;
@@ -325,8 +291,8 @@ export function require(path) {
325
291
  try {
326
292
  request.open("GET", path, false);
327
293
  request.send(null);
328
- } catch (error) {
329
- throw reportRuntimeError(error, path);
294
+ } catch (value) {
295
+ throw report(value, path);
330
296
  }
331
297
 
332
298
  if (request.status >= 200 && request.status < 300) {
@@ -341,16 +307,12 @@ export function require(path) {
341
307
  });
342
308
  }
343
309
 
344
- const error = new Error(
345
- `Unable to load ${path}: HTTP ${request.status || 0}`
310
+ throw report(
311
+ new Error(`Unable to load ${path}: HTTP ${request.status || 0}`),
312
+ path
346
313
  );
347
- error.fileName = path;
348
- throw error;
349
314
  }
350
315
 
351
- /**
352
- * Enables async, code-split component loading.
353
- */
354
316
  export function lazy(factory) {
355
317
  let status = "pending";
356
318
  let result;
@@ -366,11 +328,11 @@ export function lazy(factory) {
366
328
 
367
329
  if (Lilact.isThenable(result)) {
368
330
  result.then(
369
- (module) => {
331
+ value => {
370
332
  status = "success";
371
- result = module;
333
+ result = value;
372
334
  },
373
- (error) => {
335
+ error => {
374
336
  status = "error";
375
337
  result = error;
376
338
  }
@@ -390,17 +352,17 @@ export function lazy(factory) {
390
352
  return LazyComponent;
391
353
  }
392
354
 
393
- function scanScriptTagsWithType() {
355
+ function scriptTags() {
394
356
  return Array.from(
395
357
  document.querySelectorAll('script[type="text/jsx"]')
396
- ).map((element) => ({
358
+ ).map(element => ({
397
359
  src: element.getAttribute("src"),
398
360
  content: element.textContent || "",
399
361
  }));
400
362
  }
401
363
 
402
364
  export function runScripts() {
403
- for (const script of scanScriptTagsWithType()) {
365
+ for (const script of scriptTags()) {
404
366
  if (script.src) require(script.src);
405
367
  if (script.content) run(script.content);
406
368
  }
@@ -1 +0,0 @@
1
- <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>mapLocation | Lilact</title><meta name="description" content="Documentation for Lilact"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">Lilact</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/errors.html">errors</a></li><li><a href="" aria-current="page">mapLocation</a></li></ul><h1>Function mapLocation</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="maplocation"><span class="tsd-kind-call-signature">mapLocation</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">mappings</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">generatedLine</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">generatedColumn</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">col</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">line</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span> <span class="tsd-signature-symbol">}</span><a href="#maplocation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">mappings</span>: <span class="tsd-signature-type">any</span></span></li><li><span><span class="tsd-kind-parameter">generatedLine</span>: <span class="tsd-signature-type">any</span></span></li><li><span><span class="tsd-kind-parameter">generatedColumn</span>: <span class="tsd-signature-type">any</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">col</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">line</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span> <span class="tsd-signature-symbol">}</span></h4><aside class="tsd-sources"><ul><li>Defined in errors.jsx:180</li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">Lilact</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>