stx-router 0.2.384 → 0.2.385

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 (2) hide show
  1. package/dist/client.js +6 -12
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -514,19 +514,13 @@ function routerSource() {
514
514
  * Column-anchored: a declaration nested inside a function is indented, and
515
515
  * is not in scope at the end of the block anyway.
516
516
  */
517
- var TOP_LEVEL_DECL=/^(?:export\\s+)?(?:async\\s+)?(?:function\\s*\\*?|class|const|let|var)\\s+([A-Za-z_$][\\w$]*)/gm;
517
+ var TLD=/^(?:export\\s+)?(?:async\\s+)?(?:function\\s*\\*?|class|const|let|var)\\s+([$\\w]+)/gm;
518
518
  function republishTopLevel(src){
519
- var names=[],m;
520
- TOP_LEVEL_DECL.lastIndex=0;
521
- while((m=TOP_LEVEL_DECL.exec(src))!==null){
522
- if(names.indexOf(m[1])===-1)names.push(m[1]);
523
- }
524
- if(!names.length)return '';
525
- var out='\\n;';
526
- for(var i=0;i<names.length;i++){
527
- out+='try{if(typeof '+names[i]+'==="function")window.'+names[i]+'='+names[i]+'}catch(e){}';
528
- }
529
- return out;
519
+ var n=[],m,o='',i;
520
+ TLD.lastIndex=0;
521
+ while((m=TLD.exec(src))!==null)if(n.indexOf(m[1])<0)n.push(m[1]);
522
+ for(i=0;i<n.length;i++)o+='try{typeof '+n[i]+'=="function"&&(window.'+n[i]+'='+n[i]+')}catch(e){}';
523
+ return o?'\\n;'+o:'';
530
524
  }
531
525
  function runsAlways(declared, code){
532
526
  if(declared==='always')return true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stx-router",
3
3
  "type": "module",
4
- "version": "0.2.384",
4
+ "version": "0.2.385",
5
5
  "description": "File-based router for STX — .stx template discovery, nested layouts, typed route params, middleware, and client-side SPA navigation.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",