bun-plugin-stx 0.2.146 → 0.2.148
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-b4s904jx.js → chunk-8ysn9mf6.js} +4 -20
- package/dist/index.js +1 -1
- package/dist/preload.js +1 -1
- package/dist/serve.js +20 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/index.ts
|
|
3
3
|
import path2 from "path";
|
|
4
|
-
import { buildWebComponents, cacheTemplate, checkCache,
|
|
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
|
|
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
package/dist/preload.js
CHANGED
package/dist/serve.js
CHANGED
|
@@ -8299,6 +8299,8 @@ class ConfigLoader2 {
|
|
|
8299
8299
|
try {
|
|
8300
8300
|
result = await this.loadConfigurationStrategies(baseOptions, true, cache);
|
|
8301
8301
|
} catch (error) {
|
|
8302
|
+
if (baseOptions.configFile)
|
|
8303
|
+
throw error;
|
|
8302
8304
|
const isStrictMode = baseOptions.__strictErrorHandling;
|
|
8303
8305
|
if (error instanceof Error && error.name === "ConfigNotFoundError") {
|
|
8304
8306
|
if (isStrictMode) {
|
|
@@ -8373,6 +8375,7 @@ class ConfigLoader2 {
|
|
|
8373
8375
|
const {
|
|
8374
8376
|
name = "",
|
|
8375
8377
|
alias,
|
|
8378
|
+
configFile,
|
|
8376
8379
|
cwd,
|
|
8377
8380
|
configDir,
|
|
8378
8381
|
defaultConfig: defaultConfig4,
|
|
@@ -8382,6 +8385,17 @@ class ConfigLoader2 {
|
|
|
8382
8385
|
} = options;
|
|
8383
8386
|
const baseDir = cwd || process20.cwd();
|
|
8384
8387
|
const searchPaths = [];
|
|
8388
|
+
if (configFile) {
|
|
8389
|
+
const explicitPath = resolve12(baseDir, configFile);
|
|
8390
|
+
searchPaths.push(explicitPath);
|
|
8391
|
+
const envDefaults = checkEnv ? applyEnvVarsToConfig3(name, defaultConfig4, verbose) : defaultConfig4;
|
|
8392
|
+
const explicitResult = await this.fileLoader.tryLoadFromPaths([explicitPath], envDefaults, { arrayStrategy, verbose, cacheTtl: cacheOptions?.ttl, useCache: !cacheOptions?.ttl || cacheOptions.ttl > 100 });
|
|
8393
|
+
if (!explicitResult)
|
|
8394
|
+
throw ErrorFactory2.configNotFound(name || configFile, searchPaths, alias);
|
|
8395
|
+
if (verbose)
|
|
8396
|
+
log3.success(`Configuration loaded from explicit path: ${explicitPath}`);
|
|
8397
|
+
return this.finalizeResult(explicitResult, searchPaths, checkEnv, name, verbose);
|
|
8398
|
+
}
|
|
8385
8399
|
const localResult = await this.loadLocalConfiguration(name, alias, baseDir, configDir, defaultConfig4, arrayStrategy, verbose, checkEnv, cacheOptions);
|
|
8386
8400
|
if (localResult) {
|
|
8387
8401
|
searchPaths.push(...this.getLocalSearchPaths(name, alias, baseDir, configDir));
|
|
@@ -8569,6 +8583,8 @@ class ConfigLoader2 {
|
|
|
8569
8583
|
}
|
|
8570
8584
|
if (options.cwd)
|
|
8571
8585
|
keyParts.push(`cwd:${options.cwd}`);
|
|
8586
|
+
if (options.configFile)
|
|
8587
|
+
keyParts.push(`configFile:${options.configFile}`);
|
|
8572
8588
|
if (options.configDir)
|
|
8573
8589
|
keyParts.push(`configDir:${options.configDir}`);
|
|
8574
8590
|
if ("checkEnv" in options)
|
|
@@ -8629,6 +8645,8 @@ async function loadConfig6(options) {
|
|
|
8629
8645
|
}
|
|
8630
8646
|
return result?.config ?? defaultConfig4;
|
|
8631
8647
|
} catch (error) {
|
|
8648
|
+
if (options.configFile)
|
|
8649
|
+
throw error;
|
|
8632
8650
|
const errorName = error instanceof Error ? error.name : "UnknownError";
|
|
8633
8651
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
8634
8652
|
const isConfigError = errorName === "ConfigNotFoundError" || errorName === "ConfigLoadError" || errorName === "ConfigValidationError" || errorMessage.includes("config");
|
|
@@ -8696,8 +8714,8 @@ function applyEnvVarsToConfig3(name, config6, verbose = false) {
|
|
|
8696
8714
|
}
|
|
8697
8715
|
return processConfigLevel(config6);
|
|
8698
8716
|
}
|
|
8699
|
-
var defaultConfigDir4 = resolve12(process20.cwd(), "config");
|
|
8700
|
-
var defaultGeneratedDir4 = resolve12(process20.cwd(), "src/generated");
|
|
8717
|
+
var defaultConfigDir4 = /* @__PURE__ */ resolve12(process20.cwd(), "config");
|
|
8718
|
+
var defaultGeneratedDir4 = /* @__PURE__ */ resolve12(process20.cwd(), "src/generated");
|
|
8701
8719
|
|
|
8702
8720
|
// src/serve.ts
|
|
8703
8721
|
import { extractPageResponseStatus, stateDir, stateDirName } from "@stacksjs/stx";
|
package/package.json
CHANGED