bun-plugin-stx 0.2.328 → 0.2.330

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.
@@ -1641,7 +1641,8 @@ else {
1641
1641
  var scoped=/(?:^|\\s)data-stx-scoped(?:\\s|=|$)/i.test(attrs);
1642
1642
  var runDecl=(attrs.match(/data-stx-run\\s*=\\s*["']?(always|once)["']?/i)||[])[1];
1643
1643
  var ownerDecl=(attrs.match(/data-stx-owner\\s*=\\s*["']([^"']+)["']/i)||[])[1]||'';
1644
- fragScripts.push({text:code,slot:slot,setupName:generatedSetupName(code),scoped:scoped,run:runDecl?runDecl.toLowerCase():'',owner:ownerDecl});
1644
+ var registry=/(?:^|\\s)data-stx-modules(?:\\s|=|$)/i.test(attrs)||REGISTRY_TEXT.test(code);
1645
+ fragScripts.push({text:code,slot:slot,setupName:generatedSetupName(code),scoped:scoped,run:runDecl?runDecl.toLowerCase():'',owner:ownerDecl,registry:registry});
1645
1646
  // Retain scoped setup code in its inert placeholder. A placeholder
1646
1647
  // inside template.content is unreachable through document, so the
1647
1648
  // repeated component runtime must execute it for each clone.
@@ -1712,7 +1713,13 @@ else {
1712
1713
  // Execute page scripts FIRST \u2014 they define setup functions and set _latestSetup
1713
1714
  log('[router] frag scripts:', fragScripts.length);
1714
1715
  document.querySelectorAll('script[data-stx-page]').forEach(function(s){s.remove()});
1715
- fragScripts.sort(function(a,b){return (a.setupName?1:0)-(b.setupName?1:0)});
1716
+ // The page's module registry first (#1957), setups last. A fragment
1717
+ // lists its scripts in document order, and the registry is emitted
1718
+ // after the content it serves: a component that imports a package ran
1719
+ // ahead of it and threw "is not registered on this page". The full
1720
+ // document path orders them the same way (registryFirst, below).
1721
+ function fragOrder(entry){return entry.registry?0:entry.setupName?2:1}
1722
+ fragScripts.sort(function(a,b){return fragOrder(a)-fragOrder(b)});
1716
1723
  function runFragScripts(){
1717
1724
  fragScripts.forEach(function(entry){
1718
1725
  var code=entry.text;
package/dist/serve.js CHANGED
@@ -9791,7 +9791,7 @@ function __stxOverlay(errs){
9791
9791
  rebuildDiscoveredPagePaths(kept);
9792
9792
  await indexPageMiddleware(kept);
9793
9793
  try {
9794
- const { Router } = await import("./chunk-qwanqbhx.js");
9794
+ const { Router } = await import("./chunk-0p4k422w.js");
9795
9795
  const pagesDirs = patterns.map((p) => p.replace(/\/$/, "")).filter(Boolean);
9796
9796
  const router = new Router(process19.cwd(), { pagesDirs, stateDir: stateDirName(), exclude: options.exclude });
9797
9797
  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.328",
4
+ "version": "0.2.330",
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",