@spacefast/common 0.0.18 → 0.0.20
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,4 +1,5 @@
|
|
|
1
1
|
import { type Grant } from "../contracts/grants.js";
|
|
2
|
+
import type { RuntimeKind } from "../contracts/execution.js";
|
|
2
3
|
import { type SpaceConfig, type SpaceConfigFile } from "../contracts/space-config.js";
|
|
3
4
|
export type SpaceConfigBlockingIssueCode = "config_file_too_large" | "config_templates_over_limit" | "config_meta_too_long" | "config_name_too_long" | "config_functions_key_removed" | "config_invalid" | "config_runtime_invalid_kind" | "config_runtime_entry_missing" | "inject_snippet_too_large" | "inject_invalid";
|
|
4
5
|
export type SpaceConfigIssue = {
|
|
@@ -79,6 +80,7 @@ export declare function resolveEffectiveSpaceConfig(input: {
|
|
|
79
80
|
manifestPaths: ReadonlySet<string>;
|
|
80
81
|
fileConfig: SpaceConfig | null;
|
|
81
82
|
overlay: SpaceConfig | null;
|
|
83
|
+
runtimeKind?: RuntimeKind;
|
|
82
84
|
}): EffectiveSpaceConfig;
|
|
83
85
|
export type SpaceSettingsPatch = {
|
|
84
86
|
mode?: "website" | "files" | undefined;
|
|
@@ -491,12 +491,15 @@ export function resolveEffectiveSpaceConfig(input) {
|
|
|
491
491
|
input.overlay?.index !== undefined ||
|
|
492
492
|
input.overlay?.listing !== undefined;
|
|
493
493
|
// Content-inferred defaults (spec: the old website/files modes are exactly
|
|
494
|
-
// these two default bundles; never API fields). A
|
|
495
|
-
//
|
|
496
|
-
//
|
|
494
|
+
// these two default bundles; never API fields). A Functions version is an
|
|
495
|
+
// application even when it has no root HTML: unresolved requests, including
|
|
496
|
+
// `/`, belong to its worker. Static versions retain the content inference —
|
|
497
|
+
// a root index.html means website mode, any other root HTML becomes the
|
|
498
|
+
// homepage rewrite, and no root HTML means files mode.
|
|
499
|
+
const functionsApplication = input.runtimeKind === "functions";
|
|
497
500
|
const defaults = inferredRootHtmlIndex
|
|
498
501
|
? { index: inferredRootHtmlIndex, listing: false }
|
|
499
|
-
: { index: false, listing:
|
|
502
|
+
: { index: false, listing: !functionsApplication };
|
|
500
503
|
const merged = { ...defaults };
|
|
501
504
|
for (const layer of [input.fileConfig, input.overlay]) {
|
|
502
505
|
if (!layer) {
|
|
@@ -522,7 +525,7 @@ export function resolveEffectiveSpaceConfig(input) {
|
|
|
522
525
|
details: { path: fallback.path },
|
|
523
526
|
});
|
|
524
527
|
}
|
|
525
|
-
const listing = merged.listing ?? !inferredRootHtmlIndex;
|
|
528
|
+
const listing = merged.listing ?? (!functionsApplication && !inferredRootHtmlIndex);
|
|
526
529
|
const serving = {
|
|
527
530
|
index: merged.index ?? inferredRootHtmlIndex ?? false,
|
|
528
531
|
fallback,
|