bun-plugin-stx 0.2.146 → 0.2.147

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.
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // src/index.ts
3
3
  import path2 from "path";
4
- import { buildWebComponents, cacheTemplate, checkCache, classifyScript, defaultConfig, extractVariables, processClientScript, processDirectives, readMarkdownFile } from "@stacksjs/stx";
4
+ import { buildWebComponents, cacheTemplate, checkCache, classifyAllScripts, defaultConfig, extractVariables, processClientScript, processDirectives, readMarkdownFile } from "@stacksjs/stx";
5
5
 
6
6
  // src/watch.ts
7
7
  import fs from "fs";
@@ -388,25 +388,9 @@ export { content as default };
388
388
  if (templateTagMatch) {
389
389
  workingContent = templateTagMatch[1].trim();
390
390
  }
391
- const scriptRegex = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
392
- const clientScripts = [];
393
- const serverScripts = [];
394
- const signalsScripts = [];
395
- let scriptMatch;
396
- while ((scriptMatch = scriptRegex.exec(content)) !== null) {
397
- const classified = classifyScript(scriptMatch[1], scriptMatch[2], scriptMatch[0]);
398
- switch (classified.type) {
399
- case "signals":
400
- signalsScripts.push(classified.fullTag);
401
- break;
402
- case "client":
403
- clientScripts.push(classified.fullTag);
404
- break;
405
- case "server":
406
- serverScripts.push(classified.content);
407
- break;
408
- }
409
- }
391
+ const classified = classifyAllScripts(content);
392
+ const clientScripts = classified.client.map((s) => s.fullTag);
393
+ const serverScripts = classified.server.map((s) => s.content);
410
394
  let templateContent = workingContent;
411
395
  for (const script of serverScripts) {
412
396
  const escapedScript = script.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  startWatchMode,
9
9
  stxPlugin,
10
10
  watchAndBuild
11
- } from "./chunk-b4s904jx.js";
11
+ } from "./chunk-8ysn9mf6.js";
12
12
  import"./chunk-2mx7fq49.js";
13
13
  export {
14
14
  watchAndBuild,
package/dist/preload.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  src_default
4
- } from "./chunk-b4s904jx.js";
4
+ } from "./chunk-8ysn9mf6.js";
5
5
  import"./chunk-2mx7fq49.js";
6
6
 
7
7
  // src/preload.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.146",
4
+ "version": "0.2.147",
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",