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.
- package/dist/{chunk-8ysn9mf6.js → chunk-anqecs1e.js} +12 -7
- package/dist/index.js +1 -1
- package/dist/preload.js +1 -1
- package/dist/serve.js +2 -11
- package/package.json +1 -1
|
@@ -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
|
|
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 || [
|
|
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
|
-
|
|
237
|
+
process2.once("SIGINT", () => {
|
|
238
238
|
console.log(`
|
|
239
239
|
\x1B[36m[stx]\x1B[0m Stopping watch mode...`);
|
|
240
240
|
watcher.close();
|
|
241
|
-
|
|
241
|
+
process2.exit(0);
|
|
242
242
|
});
|
|
243
|
-
|
|
243
|
+
process2.once("SIGTERM", () => {
|
|
244
244
|
watcher.close();
|
|
245
|
-
|
|
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
package/dist/preload.js
CHANGED
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
|
-
|
|
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