bun-plugin-stx 0.2.136 → 0.2.138

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/serve.js +7 -3
  2. package/package.json +1 -1
package/dist/serve.js CHANGED
@@ -9761,8 +9761,8 @@ ${output}`;
9761
9761
  await discoverFiles();
9762
9762
  const corsHeaders = {
9763
9763
  "Access-Control-Allow-Origin": "*",
9764
- "Access-Control-Allow-Methods": "GET, POST, OPTIONS",
9765
- "Access-Control-Allow-Headers": "Content-Type"
9764
+ "Access-Control-Allow-Methods": "GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS",
9765
+ "Access-Control-Allow-Headers": "Content-Type, Authorization, X-CSRF-Token, X-Requested-With"
9766
9766
  };
9767
9767
  const siteConfig = options.site;
9768
9768
  const siteStxPromise = siteConfig || options.i18n ? options.stxModule ? Promise.resolve(options.stxModule) : defaultStxModule : null;
@@ -10260,11 +10260,15 @@ ${html}`;
10260
10260
  }
10261
10261
  fragment = fragment.replace(/<script data-stx-scoped>\s*;?\(function\(\)\s*\{[\s\S]*?<\/script>/g, "");
10262
10262
  const clearStale = "<script data-stx-page>if(window.stx)window.stx._latestSetup=null;</script>";
10263
+ const componentFactoryScripts = pageSetupScripts.filter((script) => script.includes("data-stx-component-factories"));
10264
+ const trailingPageScripts = pageSetupScripts.filter((script) => !script.includes("data-stx-component-factories"));
10263
10265
  fragment = `${headStyles.join(`
10264
10266
  `)}
10267
+ ${componentFactoryScripts.join(`
10268
+ `)}
10265
10269
  ${fragment}
10266
10270
  ${clearStale}
10267
- ${pageSetupScripts.join(`
10271
+ ${trailingPageScripts.join(`
10268
10272
  `)}`;
10269
10273
  const titleMatch = content.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
10270
10274
  const pageTitle = titleMatch ? titleMatch[1].trim() : "";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.136",
4
+ "version": "0.2.138",
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",