@taujs/server 0.4.3 → 0.4.5
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/index.d.ts +1 -1
- package/dist/index.js +52 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -614,8 +614,15 @@ var Logger = class _Logger {
|
|
|
614
614
|
const boundSink = rawSink ? rawSink.bind(owner) : void 0;
|
|
615
615
|
const consoleFallback = level === "error" ? console.error : level === "warn" ? console.warn : console.log;
|
|
616
616
|
const hasCustom = !!boundSink;
|
|
617
|
-
|
|
618
|
-
|
|
617
|
+
let baseMeta;
|
|
618
|
+
if (meta && typeof meta === "object" && !Array.isArray(meta)) {
|
|
619
|
+
baseMeta = meta;
|
|
620
|
+
} else if (meta === void 0) {
|
|
621
|
+
baseMeta = {};
|
|
622
|
+
} else {
|
|
623
|
+
baseMeta = { value: meta };
|
|
624
|
+
}
|
|
625
|
+
const withCtx = wantCtx && Object.keys(this.context).length > 0 ? { context: this.context, ...baseMeta } : baseMeta;
|
|
619
626
|
const finalMeta = this.shouldIncludeStack(level) ? withCtx : this.stripStacks(withCtx);
|
|
620
627
|
const hasMeta = finalMeta && typeof finalMeta === "object" ? Object.keys(finalMeta).length > 0 : false;
|
|
621
628
|
const levelText = level.toLowerCase() + (category ? `:${category.toLowerCase()}` : "");
|
|
@@ -644,8 +651,8 @@ var Logger = class _Logger {
|
|
|
644
651
|
if (hasCustom) {
|
|
645
652
|
const obj = hasMeta ? finalMeta : {};
|
|
646
653
|
try {
|
|
647
|
-
|
|
648
|
-
} catch
|
|
654
|
+
boundSink(obj, formatted);
|
|
655
|
+
} catch {
|
|
649
656
|
hasMeta ? consoleFallback(formatted, finalMeta) : consoleFallback(formatted);
|
|
650
657
|
}
|
|
651
658
|
} else {
|
|
@@ -2013,7 +2020,7 @@ async function registerStaticAssets(app, baseClientRoot, reg, defaults, projectR
|
|
|
2013
2020
|
// src/SSRServer.ts
|
|
2014
2021
|
var SSRServer = (0, import_fastify_plugin3.default)(
|
|
2015
2022
|
async (app, opts) => {
|
|
2016
|
-
const { alias, configs, routes, serviceRegistry, clientRoot: baseClientRoot, security } = opts;
|
|
2023
|
+
const { alias, configs, routes, serviceRegistry = {}, clientRoot: baseClientRoot, security } = opts;
|
|
2017
2024
|
const logger = createLogger({
|
|
2018
2025
|
debug: opts.debug,
|
|
2019
2026
|
context: { component: "ssr-server" },
|
|
@@ -2332,6 +2339,37 @@ function mergeViteConfig(framework, userOverride, context) {
|
|
|
2332
2339
|
}
|
|
2333
2340
|
return merged;
|
|
2334
2341
|
}
|
|
2342
|
+
function resolveAppFilter(argv, env) {
|
|
2343
|
+
const read = (keys) => {
|
|
2344
|
+
const end = argv.indexOf("--");
|
|
2345
|
+
const limit = end === -1 ? argv.length : end;
|
|
2346
|
+
for (let i = 0; i < limit; i++) {
|
|
2347
|
+
const arg = argv[i];
|
|
2348
|
+
if (!arg) continue;
|
|
2349
|
+
for (const key of keys) {
|
|
2350
|
+
if (arg === key) {
|
|
2351
|
+
const next = argv[i + 1];
|
|
2352
|
+
if (!next || next.startsWith("-")) return "";
|
|
2353
|
+
return next.trim();
|
|
2354
|
+
}
|
|
2355
|
+
const pref = `${key}=`;
|
|
2356
|
+
if (arg.startsWith(pref)) {
|
|
2357
|
+
const v = arg.slice(pref.length).trim();
|
|
2358
|
+
return v;
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
return void 0;
|
|
2363
|
+
};
|
|
2364
|
+
const envFilter = env.TAUJS_APP || env.TAUJS_APPS;
|
|
2365
|
+
const cliFilter = read(["--app", "--apps", "-a"]);
|
|
2366
|
+
const raw = (cliFilter ?? envFilter)?.trim() || void 0;
|
|
2367
|
+
if (!raw) return { selectedIds: null, raw: void 0 };
|
|
2368
|
+
const selectedIds = new Set(
|
|
2369
|
+
raw.split(",").map((s) => s.trim()).filter(Boolean)
|
|
2370
|
+
);
|
|
2371
|
+
return { selectedIds, raw };
|
|
2372
|
+
}
|
|
2335
2373
|
async function taujsBuild({
|
|
2336
2374
|
config,
|
|
2337
2375
|
projectRoot,
|
|
@@ -2352,8 +2390,16 @@ async function taujsBuild({
|
|
|
2352
2390
|
};
|
|
2353
2391
|
const extractedConfigs = extractBuildConfigs(config);
|
|
2354
2392
|
const processedConfigs = processConfigs(extractedConfigs, clientBaseDir, TEMPLATE);
|
|
2393
|
+
const { selectedIds, raw: appFilterRaw } = resolveAppFilter(process.argv.slice(2), process.env);
|
|
2394
|
+
const configsToBuild = selectedIds ? processedConfigs.filter(({ appId, entryPoint }) => selectedIds.has(appId) || selectedIds.has(entryPoint)) : processedConfigs;
|
|
2395
|
+
if (selectedIds && configsToBuild.length === 0) {
|
|
2396
|
+
console.error(
|
|
2397
|
+
`[taujs:build] No apps match filter "${appFilterRaw}". Known apps: ${processedConfigs.map((c) => `${c.appId}${c.entryPoint ? ` (entry: ${c.entryPoint})` : ""}`).join(", ")}`
|
|
2398
|
+
);
|
|
2399
|
+
process.exit(1);
|
|
2400
|
+
}
|
|
2355
2401
|
if (!isSSRBuild) await deleteDist();
|
|
2356
|
-
for (const appConfig of
|
|
2402
|
+
for (const appConfig of configsToBuild) {
|
|
2357
2403
|
const { appId, entryPoint, clientRoot, entryClient, entryServer, htmlTemplate, plugins = [] } = appConfig;
|
|
2358
2404
|
const outDir = path8.resolve(projectRoot, isSSRBuild ? `dist/ssr/${entryPoint}` : `dist/client/${entryPoint}`);
|
|
2359
2405
|
const root = entryPoint ? path8.resolve(clientBaseDir, entryPoint) : clientBaseDir;
|
|
@@ -2392,8 +2438,6 @@ async function taujsBuild({
|
|
|
2392
2438
|
},
|
|
2393
2439
|
plugins,
|
|
2394
2440
|
publicDir: isSSRBuild ? false : "public",
|
|
2395
|
-
// single shared public
|
|
2396
|
-
// publicDir: isSSRBuild ? false : path.join(root, 'public'), // per-app. no public dir for SSR builds
|
|
2397
2441
|
resolve: { alias: resolvedAlias },
|
|
2398
2442
|
root
|
|
2399
2443
|
};
|