bun-plugin-stx 0.2.859 → 0.2.861

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.
@@ -2,7 +2,7 @@
2
2
  // src/index.ts
3
3
  import fs2 from "fs";
4
4
  import path2 from "path";
5
- import { buildWebComponents, cacheTemplate, checkCache, classifyAllScripts, defaultConfig, extractVariables, loadStxConfig, processClientScript, processDirectives, readMarkdownFile, withinBundlerCallback } from "@stacksjs/stx";
5
+ import { buildWebComponents, cacheTemplate, checkCache, classifyAllScripts, defaultConfig, extractVariables, insertBeforeBodyClose, loadStxConfig, processClientScript, processDirectives, readMarkdownFile, withinBundlerCallback } from "@stacksjs/stx";
6
6
 
7
7
  // src/watch.ts
8
8
  import fs from "fs";
@@ -431,14 +431,7 @@ export { content as default };
431
431
  }));
432
432
  const scriptsHtml = transformedScripts.join(`
433
433
  `);
434
- const bodyEndMatch = output.match(/(<\/body>)/i);
435
- if (bodyEndMatch) {
436
- output = output.replace(/(<\/body>)/i, `${scriptsHtml}
437
- $1`);
438
- } else {
439
- output += `
440
- ${scriptsHtml}`;
441
- }
434
+ output = insertBeforeBodyClose(output, scriptsHtml);
442
435
  context.__stx_event_bindings = [];
443
436
  }
444
437
  dependencies.forEach((dep) => allDependencies.add(dep));
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  createRoute2,
9
9
  readMarkdownFile2,
10
10
  src_default
11
- } from "./chunk-xmy0ax0w.js";
11
+ } from "./chunk-xyc2ydbw.js";
12
12
  export {
13
13
  createMiddleware2 as createMiddleware,
14
14
  createRoute2 as createRoute,
package/dist/preload.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  src_default
4
- } from "./chunk-xmy0ax0w.js";
4
+ } from "./chunk-xyc2ydbw.js";
5
5
 
6
6
  // src/preload.ts
7
7
  var {plugin } = globalThis.Bun;
package/dist/serve.js CHANGED
@@ -8758,7 +8758,7 @@ var defaultGeneratedDir4 = /* @__PURE__ */ resolve12(process19.cwd(), "src/gener
8758
8758
  import { BUILD_ID_HEADER, decodeTitleEntities, externalScriptsOutsideContainer, extractPageResponseStatus, findContainerRegion, FRAGMENT_CACHE_CONTROL, getBuildId, mergeCssConfig, pageCssFragment, pageHeadFragment, readResponseHeaders, readResponseStatus, renderFontCSS, SPA_NAV_HEADER, spaNavVaryHeaders, stateDir, stateDirName } from "@stacksjs/stx";
8759
8759
  import { buildCodeFrame, locateFailureLine } from "@stacksjs/stx/build-message";
8760
8760
  import { clearBundleFailures, getBundleFailures } from "@stacksjs/stx/client-script-bundler";
8761
- import { actionRedirectResponse, compressResponse, runPageAction as sharedRunPageAction } from "@stacksjs/stx";
8761
+ import { insertBeforeBodyClose, actionRedirectResponse, compressResponse, runPageAction as sharedRunPageAction } from "@stacksjs/stx";
8762
8762
 
8763
8763
  // src/domain-routes.ts
8764
8764
  var LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
@@ -11078,10 +11078,7 @@ ${output}`;
11078
11078
  const configTagRe = /<script>window\.__stxRouterConfig=\{[^<]*\}<\/script>\s*/i;
11079
11079
  if (configTagRe.test(html))
11080
11080
  return html.replace(configTagRe, block);
11081
- if (/<\/body>/i.test(html))
11082
- return html.replace(/<\/body>/i, `${block}</body>`);
11083
- return `${html}
11084
- ${block}`;
11081
+ return insertBeforeBodyClose(html, block);
11085
11082
  }
11086
11083
  async function applyI18nToResponse(res, locale, normalizedPath) {
11087
11084
  if (!siteStxPromise)
@@ -11107,8 +11104,7 @@ ${block}`;
11107
11104
  }
11108
11105
  if (i18nConfig && stx.buildLangPickerScript) {
11109
11106
  const pickerScript = stx.buildLangPickerScript(i18nConfig, locale);
11110
- html = /<\/body>/i.test(html) ? html.replace(/<\/body>/i, `${pickerScript}
11111
- </body>`) : html + pickerScript;
11107
+ html = insertBeforeBodyClose(html, pickerScript);
11112
11108
  }
11113
11109
  if (i18nConfig && stx.stampLocaleLayoutGroup)
11114
11110
  html = stx.stampLocaleLayoutGroup(html, locale);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.859",
4
+ "version": "0.2.861",
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",
@@ -74,7 +74,7 @@
74
74
  "typecheck": "bun tsc --noEmit"
75
75
  },
76
76
  "dependencies": {
77
- "@stacksjs/stx": "0.2.859",
78
- "stx-router": "0.2.859"
77
+ "@stacksjs/stx": "0.2.861",
78
+ "stx-router": "0.2.861"
79
79
  }
80
80
  }