bun-plugin-stx 0.2.231 → 0.2.232

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,12 +1,12 @@
1
1
  // @bun
2
2
  // src/index.ts
3
3
  import path2 from "path";
4
- import { buildWebComponents, cacheTemplate, checkCache, classifyAllScripts, defaultConfig, extractVariables, processClientScript, processDirectives, readMarkdownFile } from "@stacksjs/stx";
4
+ import { buildWebComponents, cacheTemplate, checkCache, classifyAllScripts, defaultConfig, extractVariables, loadStxConfig, processClientScript, processDirectives, readMarkdownFile } from "@stacksjs/stx";
5
5
 
6
6
  // src/watch.ts
7
7
  import fs from "fs";
8
8
  import path from "path";
9
- import process from "process";
9
+ import process2 from "process";
10
10
  function debounce(fn, delay) {
11
11
  let timeoutId = null;
12
12
  return (...args) => {
@@ -37,7 +37,7 @@ function createWatcher(options = {}) {
37
37
  const watchedPaths = new Set;
38
38
  const watchers = new Map;
39
39
  let isActive = true;
40
- const paths = options.paths || [process.cwd()];
40
+ const paths = options.paths || [process2.cwd()];
41
41
  const debounceDelay = options.debounce ?? 100;
42
42
  const pendingChanges = [];
43
43
  const handleChanges = debounce(() => {
@@ -234,15 +234,15 @@ async function startWatchMode(args) {
234
234
  }
235
235
  }
236
236
  });
237
- process.once("SIGINT", () => {
237
+ process2.once("SIGINT", () => {
238
238
  console.log(`
239
239
  \x1B[36m[stx]\x1B[0m Stopping watch mode...`);
240
240
  watcher.close();
241
- process.exit(0);
241
+ process2.exit(0);
242
242
  });
243
- process.once("SIGTERM", () => {
243
+ process2.once("SIGTERM", () => {
244
244
  watcher.close();
245
- process.exit(0);
245
+ process2.exit(0);
246
246
  });
247
247
  return watcher;
248
248
  }
@@ -277,8 +277,13 @@ function stxPlugin(userOptions) {
277
277
  return {
278
278
  name: "bun-plugin-stx",
279
279
  async setup(build) {
280
+ let projectConfig = {};
281
+ try {
282
+ projectConfig = await loadStxConfig(process.cwd());
283
+ } catch {}
280
284
  const options = {
281
285
  ...defaultConfig,
286
+ ...projectConfig,
282
287
  ...userOptions
283
288
  };
284
289
  const allDependencies = new Set;
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  startWatchMode,
9
9
  stxPlugin,
10
10
  watchAndBuild
11
- } from "./chunk-8ysn9mf6.js";
11
+ } from "./chunk-anqecs1e.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-8ysn9mf6.js";
4
+ } from "./chunk-anqecs1e.js";
5
5
  import"./chunk-2mx7fq49.js";
6
6
 
7
7
  // src/preload.ts
package/dist/serve.js CHANGED
@@ -10134,17 +10134,8 @@ ${block}`;
10134
10134
  html = /<\/body>/i.test(html) ? html.replace(/<\/body>/i, `${pickerScript}
10135
10135
  </body>`) : html + pickerScript;
10136
10136
  }
10137
- if (i18nConfig) {
10138
- const groupMeta = `<meta name="stx-layout-group" content="i18n:${locale}">`;
10139
- if (/<meta name="stx-layout-group"[^>]*>/i.test(html))
10140
- html = html.replace(/<meta name="stx-layout-group"[^>]*>/i, groupMeta);
10141
- else if (/<\/head>/i.test(html))
10142
- html = html.replace(/<\/head>/i, `${groupMeta}
10143
- </head>`);
10144
- else
10145
- html = `${groupMeta}
10146
- ${html}`;
10147
- }
10137
+ if (i18nConfig && stx.stampLocaleLayoutGroup)
10138
+ html = stx.stampLocaleLayoutGroup(html, locale);
10148
10139
  const knownPaths = discoveredPagePaths ?? new Set;
10149
10140
  if (i18nConfig && locale !== i18nConfig.defaultLocale && knownPaths.size > 0) {
10150
10141
  html = html.replace(/<a\b([^>]*?)\bhref="(\/[^"]*)"([^>]*)>/gi, (full, before, href, after) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.231",
4
+ "version": "0.2.232",
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",