bun-plugin-stx 0.2.126 → 0.2.127

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.
@@ -579,8 +579,19 @@ async function runMiddleware(middlewareNames, context) {
579
579
  };
580
580
  }
581
581
  // ../router/src/client.ts
582
+ var cachedRouterScript;
583
+ function minifyRouterScript(source) {
584
+ try {
585
+ const transpiler = new Bun.Transpiler({ loader: "js", minifyWhitespace: true });
586
+ return transpiler.transformSync(source).replace(/\}(var |let |const |function )/g, "};$1").trim();
587
+ } catch {
588
+ return source;
589
+ }
590
+ }
582
591
  function getRouterScript() {
583
- return `
592
+ if (cachedRouterScript)
593
+ return cachedRouterScript;
594
+ const source = `
584
595
  ;(function(){
585
596
  'use strict';
586
597
  var ROUTER_REV=3;
@@ -1622,6 +1633,8 @@ else {
1622
1633
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
1623
1634
  })();
1624
1635
  `;
1636
+ cachedRouterScript = minifyRouterScript(source);
1637
+ return cachedRouterScript;
1625
1638
  }
1626
1639
  export {
1627
1640
  setAppUrl,
package/dist/serve.js CHANGED
@@ -9325,7 +9325,7 @@ After installing: bun add bun-plugin-stx`);
9325
9325
  pageMiddlewarePatterns.length = 0;
9326
9326
  await Promise.all(files.map((f) => detectPageMiddleware(f)));
9327
9327
  try {
9328
- const { Router } = await import("./chunk-5hbpzwtx.js");
9328
+ const { Router } = await import("./chunk-sqrxjkre.js");
9329
9329
  const pagesDirs = patterns.map((p) => p.replace(/\/$/, "")).filter(Boolean);
9330
9330
  const router = new Router(process19.cwd(), { pagesDirs, stateDir: stateDirName() });
9331
9331
  if (!options.quiet)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.126",
4
+ "version": "0.2.127",
5
5
  "description": "A Bun plugin that allows for using Laravel Blade-like syntax.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",