bun-plugin-stx 0.2.403 → 0.2.404

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 +15 -1
  2. package/package.json +3 -3
package/dist/serve.js CHANGED
@@ -8806,6 +8806,20 @@ async function runPageMiddleware(options) {
8806
8806
 
8807
8807
  // src/serve.ts
8808
8808
  var INSTANCE_SCRIPT_OPEN_TAG = /^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;
8809
+ function isChromeInstanceScript(html, script, containerStart, containerEnd) {
8810
+ if (!INSTANCE_SCRIPT_OPEN_TAG.test(script))
8811
+ return false;
8812
+ const openTag = script.slice(0, script.indexOf(">") + 1);
8813
+ const owner = /\sdata-stx-owner="([^"]+)"/i.exec(openTag)?.[1];
8814
+ if (!owner)
8815
+ return true;
8816
+ const root = `data-stx-scope="${owner}"`;
8817
+ for (let at = html.indexOf(root);at !== -1; at = html.indexOf(root, at + root.length)) {
8818
+ if (at >= containerStart && at < containerEnd)
8819
+ return false;
8820
+ }
8821
+ return true;
8822
+ }
8809
8823
  var ENGINE_PACKAGE_ENTRIES = [
8810
8824
  ["@stacksjs", "ts-css", "dist", "engine", "index.js"],
8811
8825
  ["@stacksjs", "ts-css", "src", "engine", "index.ts"]
@@ -10919,7 +10933,7 @@ ${block}`;
10919
10933
  const insideMain = mainContentStart !== -1 && offset >= mainContentStart && offset < mainContentEnd;
10920
10934
  if (insideMain || pageSetupScriptOffsets.has(offset))
10921
10935
  return;
10922
- if (mainContentStart !== -1 && INSTANCE_SCRIPT_OPEN_TAG.test(match[0]))
10936
+ if (mainContentStart !== -1 && isChromeInstanceScript(content, match[0], mainContentStart, mainContentEnd))
10923
10937
  return;
10924
10938
  pageSetupScriptOffsets.add(offset);
10925
10939
  pageSetupScripts.push(match[0]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.403",
4
+ "version": "0.2.404",
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.403",
78
- "stx-router": "0.2.403"
77
+ "@stacksjs/stx": "0.2.404",
78
+ "stx-router": "0.2.404"
79
79
  }
80
80
  }