vike 0.4.237-commit-e549c30 → 0.4.237-commit-92dc549

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,4 @@
1
1
  "use strict";
2
- /*
3
- * We create a file `dist/server/package.json` to support ESM users.
4
- * Otherwise, following error is thrown:
5
- * Must use import to load ES Module: dist/server/pageFiles.js
6
- * require() of ES modules is not supported.
7
- * require() of dist/server/pageFiles.js from node_modules/vike/dist/esm/node/runtime/page-files/setup.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
8
- * Reproduction: https://github.com/brillout/vite-plugin-ssr-server-import-syntax
9
- */
10
2
  Object.defineProperty(exports, "__esModule", { value: true });
11
3
  exports.pluginDistPackageJsonFile = pluginDistPackageJsonFile;
12
4
  const rollupIsEsm_js_1 = require("../../shared/rollupIsEsm.js");
@@ -1,30 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getConfigValueSourcesRelevant = getConfigValueSourcesRelevant;
4
+ exports.getConfigValueSourceRelevantAnyEnv = getConfigValueSourceRelevantAnyEnv;
4
5
  exports.isRuntimeEnvMatch = isRuntimeEnvMatch;
6
+ exports.isConfigSourceValueNull = isConfigSourceValueNull;
5
7
  const utils_js_1 = require("../../utils.js");
8
+ (0, utils_js_1.assertIsNotBrowser)();
6
9
  function getConfigValueSourcesRelevant(configName, runtimeEnv, pageConfig) {
7
10
  const configDef = pageConfig.configDefinitions[configName];
8
11
  (0, utils_js_1.assert)(configDef);
9
12
  let sourcesRelevant = pageConfig.configValueSources[configName];
10
13
  if (!sourcesRelevant)
11
14
  return [];
12
- if (!configDef.cumulative) {
15
+ // Ignore configs with value `undefined`
16
+ sourcesRelevant = sourcesRelevant.filter((source) => !isConfigSourceValueUndefined(source));
17
+ // Environment filtering
18
+ sourcesRelevant = sourcesRelevant.filter((source) => isRuntimeEnvMatch(source.configEnv, runtimeEnv));
19
+ // Overriding - non-cumulative configs
20
+ if (!configDef.cumulative && sourcesRelevant.length > 1) {
13
21
  const source = sourcesRelevant[0];
14
- if (source) {
15
- sourcesRelevant = [source];
16
- }
17
- else {
18
- (0, utils_js_1.assert)(sourcesRelevant.length === 0);
19
- }
22
+ (0, utils_js_1.assert)(source);
23
+ sourcesRelevant = [source];
20
24
  }
21
- else {
22
- // isOverridden() must be called before isRuntimeEnvMatch() is called (otherwise isOverridden() will return a wrong value)
23
- sourcesRelevant = sourcesRelevant.filter((source) => !isOverridden(source, configName, pageConfig));
25
+ // Overriding - cumulative configs
26
+ if (configDef.cumulative && sourcesRelevant.length > 0) {
27
+ sourcesRelevant = applyFilenameSuffix(sourcesRelevant);
24
28
  }
25
- sourcesRelevant = sourcesRelevant.filter((source) => isRuntimeEnvMatch(source.configEnv, runtimeEnv));
26
29
  return sourcesRelevant;
27
30
  }
31
+ function getConfigValueSourceRelevantAnyEnv(configName, pageConfig) {
32
+ const configDef = pageConfig.configDefinitions[configName];
33
+ (0, utils_js_1.assert)(configDef);
34
+ (0, utils_js_1.assert)(!configDef.cumulative); // So far, this function is only used by non-cumulative configs
35
+ let sourcesRelevant = pageConfig.configValueSources[configName];
36
+ if (!sourcesRelevant)
37
+ return null;
38
+ // Ignore configs with value `undefined`
39
+ sourcesRelevant = sourcesRelevant.filter((source) => !isConfigSourceValueUndefined(source));
40
+ const source = sourcesRelevant[0];
41
+ if (!source)
42
+ return null;
43
+ if (isConfigSourceValueNull(source))
44
+ return null;
45
+ return source;
46
+ }
28
47
  function isRuntimeEnvMatch(configEnv, runtimeEnv) {
29
48
  if ('isForConfig' in runtimeEnv)
30
49
  return !!configEnv.config;
@@ -54,14 +73,25 @@ function isRuntimeEnvMatch(configEnv, runtimeEnv) {
54
73
  }
55
74
  return true;
56
75
  }
57
- function isOverridden(source, configName, pageConfig) {
58
- const configDef = pageConfig.configDefinitions[configName];
59
- (0, utils_js_1.assert)(configDef);
60
- if (configDef.cumulative)
61
- return false;
62
- const sources = pageConfig.configValueSources[configName];
63
- (0, utils_js_1.assert)(sources);
64
- const idx = sources.indexOf(source);
65
- (0, utils_js_1.assert)(idx >= 0);
66
- return idx > 0;
76
+ // Setting a config to `undefined` should be equivalent to not setting it at all
77
+ function isConfigSourceValueUndefined(source) {
78
+ if (!source.valueIsLoaded)
79
+ return null;
80
+ return source.value === undefined;
81
+ }
82
+ // Setting a config to `null` enables the user to suppress inherited config by overriding it with `null` (this only works when setting the config value to `null` inside a +config.js file — it doesn't work when setting the config value to `null` with a +{configName}.js file).
83
+ function isConfigSourceValueNull(source) {
84
+ if (!source.valueIsLoaded)
85
+ return null;
86
+ return source.value === null;
87
+ }
88
+ function applyFilenameSuffix(sourcesRelevant) {
89
+ const getFileName = (source) => source.plusFile?.filePath.fileName ?? '';
90
+ // Apply `clear`: truncate at first clear file
91
+ const clearIndex = sourcesRelevant.findIndex((source) => getFileName(source).includes('.clear.'));
92
+ if (clearIndex !== -1)
93
+ sourcesRelevant = sourcesRelevant.slice(0, clearIndex + 1);
94
+ // Apply `default`: exclude defaults if any non-defaults exist, otherwise keep only first default
95
+ const nonDefaults = sourcesRelevant.filter((source) => !getFileName(source).includes('.default.'));
96
+ return nonDefaults.length > 0 ? nonDefaults : sourcesRelevant.slice(0, 1);
67
97
  }
@@ -110,7 +110,9 @@ const configDefinitionsBuiltIn = {
110
110
  }, pageConfig))
111
111
  .flat(1)
112
112
  // Server-only
113
- .filter((source) => !source.configEnv.client);
113
+ .filter((source) => !source.configEnv.client)
114
+ // Config value isn't `null`
115
+ .filter((source) => !(0, getConfigValueSourcesRelevant_js_1.isConfigSourceValueNull)(source));
114
116
  return sources.length > 0;
115
117
  },
116
118
  },
@@ -122,22 +124,19 @@ const configDefinitionsBuiltIn = {
122
124
  env: { server: true, client: true },
123
125
  eager: true,
124
126
  _computed: (pageConfig) => {
125
- const { configValueSources } = pageConfig;
126
127
  {
127
- const source = getConfigValueSource(configValueSources, 'clientHooks');
128
+ const source = (0, getConfigValueSourcesRelevant_js_1.getConfigValueSourceRelevantAnyEnv)('clientHooks', pageConfig);
128
129
  if (source) {
129
130
  (0, utils_js_1.assert)(source.valueIsLoaded);
130
- if (source.value !== null) {
131
- const { value } = source;
132
- const definedAt = (0, getConfigDefinedAt_js_1.getConfigDefinedAt)('Config', 'clientHooks', source.definedAt);
133
- (0, utils_js_1.assertUsage)(typeof value === 'boolean', `${definedAt} should be a boolean`);
134
- return value;
135
- }
131
+ const { value, definedAt } = source;
132
+ const configDefinedAt = (0, getConfigDefinedAt_js_1.getConfigDefinedAt)('Config', 'clientHooks', definedAt);
133
+ (0, utils_js_1.assertUsage)(typeof value === 'boolean', `${configDefinedAt} should be a boolean`);
134
+ return value;
136
135
  }
137
136
  }
138
- return (isConfigSet(configValueSources, 'onRenderClient') &&
139
- isConfigSet(configValueSources, 'Page') &&
140
- !!getConfigEnv(configValueSources, 'Page')?.client);
137
+ return (isConfigSet(pageConfig, 'onRenderClient') &&
138
+ isConfigSet(pageConfig, 'Page') &&
139
+ !!getConfigEnv(pageConfig, 'Page')?.client);
141
140
  },
142
141
  },
143
142
  // TO-DO/soon/cumulative-hooks: remove and replace with new computed prop `clientOnlyHooks: string[]` (see other TO-DO/soon/cumulative-hooks entries)
@@ -145,10 +144,7 @@ const configDefinitionsBuiltIn = {
145
144
  env: { client: true },
146
145
  eager: true,
147
146
  _computed: (pageConfig) => {
148
- const { configValueSources } = pageConfig;
149
- return !isConfigSet(configValueSources, 'onBeforeRender')
150
- ? null
151
- : getConfigEnv(configValueSources, 'onBeforeRender');
147
+ return !isConfigSet(pageConfig, 'onBeforeRender') ? null : getConfigEnv(pageConfig, 'onBeforeRender');
152
148
  },
153
149
  },
154
150
  // TO-DO/soon/cumulative-hooks: remove and replace with new computed prop `clientOnlyHooks: string[]` (see other TO-DO/soon/cumulative-hooks entries)
@@ -156,8 +152,7 @@ const configDefinitionsBuiltIn = {
156
152
  env: { client: true },
157
153
  eager: true,
158
154
  _computed: (pageConfig) => {
159
- const { configValueSources } = pageConfig;
160
- return !isConfigSet(configValueSources, 'data') ? null : getConfigEnv(configValueSources, 'data');
155
+ return !isConfigSet(pageConfig, 'data') ? null : getConfigEnv(pageConfig, 'data');
161
156
  },
162
157
  },
163
158
  hooksTimeout: {
@@ -246,11 +241,11 @@ const configDefinitionsBuiltIn = {
246
241
  },
247
242
  };
248
243
  exports.configDefinitionsBuiltIn = configDefinitionsBuiltIn;
249
- function getConfigEnv(configValueSources, configName) {
250
- const configValueSource = getConfigValueSource(configValueSources, configName);
251
- if (!configValueSource)
244
+ function getConfigEnv(pageConfig, configName) {
245
+ const source = (0, getConfigValueSourcesRelevant_js_1.getConfigValueSourceRelevantAnyEnv)(configName, pageConfig);
246
+ if (!source)
252
247
  return null;
253
- const { configEnv } = configValueSource;
248
+ const { configEnv } = source;
254
249
  const env = {};
255
250
  if (configEnv.client)
256
251
  env.client = true;
@@ -258,18 +253,7 @@ function getConfigEnv(configValueSources, configName) {
258
253
  env.server = true;
259
254
  return env;
260
255
  }
261
- function isConfigSet(configValueSources, configName) {
262
- const source = getConfigValueSource(configValueSources, configName);
263
- return (!!source &&
264
- !(source.valueIsLoaded &&
265
- // Enable users to suppress inherited config by overriding it with `null`
266
- source.value === null));
267
- }
268
- function getConfigValueSource(configValueSources, configName) {
269
- const sources = configValueSources[configName];
270
- if (!sources)
271
- return null;
272
- const configValueSource = sources[0];
273
- (0, utils_js_1.assert)(configValueSource);
274
- return configValueSource;
256
+ function isConfigSet(pageConfig, configName) {
257
+ const source = (0, getConfigValueSourcesRelevant_js_1.getConfigValueSourceRelevantAnyEnv)(configName, pageConfig);
258
+ return !!source;
275
259
  }
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = void 0;
4
4
  // Automatically updated by @brillout/release-me
5
- exports.PROJECT_VERSION = '0.4.237-commit-e549c30';
5
+ exports.PROJECT_VERSION = '0.4.237-commit-92dc549';
@@ -1,11 +1,3 @@
1
- /*
2
- * We create a file `dist/server/package.json` to support ESM users.
3
- * Otherwise, following error is thrown:
4
- * Must use import to load ES Module: dist/server/pageFiles.js
5
- * require() of ES modules is not supported.
6
- * require() of dist/server/pageFiles.js from node_modules/vike/dist/esm/node/runtime/page-files/setup.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
7
- * Reproduction: https://github.com/brillout/vite-plugin-ssr-server-import-syntax
8
- */
9
1
  export { pluginDistPackageJsonFile };
10
2
  import { rollupIsEsm } from '../../shared/rollupIsEsm.js';
11
3
  import { isViteServerSide } from '../../shared/isViteServerSide.js';
@@ -1,5 +1,7 @@
1
1
  export { getConfigValueSourcesRelevant };
2
+ export { getConfigValueSourceRelevantAnyEnv };
2
3
  export { isRuntimeEnvMatch };
4
+ export { isConfigSourceValueNull };
3
5
  export type { RuntimeEnv };
4
6
  import type { ConfigEnvInternal, ConfigValueSource, PageConfigBuildTime, PageConfigGlobalBuildTime } from '../../../../types/PageConfig.js';
5
7
  type RuntimeEnv = {
@@ -9,6 +11,8 @@ type RuntimeEnv = {
9
11
  } | {
10
12
  isForConfig: true;
11
13
  };
14
+ type PageConfigPartial = Pick<PageConfigBuildTime | PageConfigGlobalBuildTime, 'configValueSources' | 'configDefinitions'>;
12
15
  declare function getConfigValueSourcesRelevant(configName: string, runtimeEnv: RuntimeEnv, pageConfig: PageConfigPartial): ConfigValueSource[];
16
+ declare function getConfigValueSourceRelevantAnyEnv(configName: string, pageConfig: PageConfigPartial): null | ConfigValueSource;
13
17
  declare function isRuntimeEnvMatch(configEnv: ConfigEnvInternal, runtimeEnv: RuntimeEnv): boolean;
14
- type PageConfigPartial = Pick<PageConfigBuildTime | PageConfigGlobalBuildTime, 'configValueSources' | 'configDefinitions'>;
18
+ declare function isConfigSourceValueNull(source: ConfigValueSource): boolean | null;
@@ -1,28 +1,47 @@
1
1
  export { getConfigValueSourcesRelevant };
2
+ export { getConfigValueSourceRelevantAnyEnv };
2
3
  export { isRuntimeEnvMatch };
3
- import { assert } from '../../utils.js';
4
+ export { isConfigSourceValueNull };
5
+ import { assert, assertIsNotBrowser } from '../../utils.js';
6
+ assertIsNotBrowser();
4
7
  function getConfigValueSourcesRelevant(configName, runtimeEnv, pageConfig) {
5
8
  const configDef = pageConfig.configDefinitions[configName];
6
9
  assert(configDef);
7
10
  let sourcesRelevant = pageConfig.configValueSources[configName];
8
11
  if (!sourcesRelevant)
9
12
  return [];
10
- if (!configDef.cumulative) {
13
+ // Ignore configs with value `undefined`
14
+ sourcesRelevant = sourcesRelevant.filter((source) => !isConfigSourceValueUndefined(source));
15
+ // Environment filtering
16
+ sourcesRelevant = sourcesRelevant.filter((source) => isRuntimeEnvMatch(source.configEnv, runtimeEnv));
17
+ // Overriding - non-cumulative configs
18
+ if (!configDef.cumulative && sourcesRelevant.length > 1) {
11
19
  const source = sourcesRelevant[0];
12
- if (source) {
13
- sourcesRelevant = [source];
14
- }
15
- else {
16
- assert(sourcesRelevant.length === 0);
17
- }
20
+ assert(source);
21
+ sourcesRelevant = [source];
18
22
  }
19
- else {
20
- // isOverridden() must be called before isRuntimeEnvMatch() is called (otherwise isOverridden() will return a wrong value)
21
- sourcesRelevant = sourcesRelevant.filter((source) => !isOverridden(source, configName, pageConfig));
23
+ // Overriding - cumulative configs
24
+ if (configDef.cumulative && sourcesRelevant.length > 0) {
25
+ sourcesRelevant = applyFilenameSuffix(sourcesRelevant);
22
26
  }
23
- sourcesRelevant = sourcesRelevant.filter((source) => isRuntimeEnvMatch(source.configEnv, runtimeEnv));
24
27
  return sourcesRelevant;
25
28
  }
29
+ function getConfigValueSourceRelevantAnyEnv(configName, pageConfig) {
30
+ const configDef = pageConfig.configDefinitions[configName];
31
+ assert(configDef);
32
+ assert(!configDef.cumulative); // So far, this function is only used by non-cumulative configs
33
+ let sourcesRelevant = pageConfig.configValueSources[configName];
34
+ if (!sourcesRelevant)
35
+ return null;
36
+ // Ignore configs with value `undefined`
37
+ sourcesRelevant = sourcesRelevant.filter((source) => !isConfigSourceValueUndefined(source));
38
+ const source = sourcesRelevant[0];
39
+ if (!source)
40
+ return null;
41
+ if (isConfigSourceValueNull(source))
42
+ return null;
43
+ return source;
44
+ }
26
45
  function isRuntimeEnvMatch(configEnv, runtimeEnv) {
27
46
  if ('isForConfig' in runtimeEnv)
28
47
  return !!configEnv.config;
@@ -52,14 +71,25 @@ function isRuntimeEnvMatch(configEnv, runtimeEnv) {
52
71
  }
53
72
  return true;
54
73
  }
55
- function isOverridden(source, configName, pageConfig) {
56
- const configDef = pageConfig.configDefinitions[configName];
57
- assert(configDef);
58
- if (configDef.cumulative)
59
- return false;
60
- const sources = pageConfig.configValueSources[configName];
61
- assert(sources);
62
- const idx = sources.indexOf(source);
63
- assert(idx >= 0);
64
- return idx > 0;
74
+ // Setting a config to `undefined` should be equivalent to not setting it at all
75
+ function isConfigSourceValueUndefined(source) {
76
+ if (!source.valueIsLoaded)
77
+ return null;
78
+ return source.value === undefined;
79
+ }
80
+ // Setting a config to `null` enables the user to suppress inherited config by overriding it with `null` (this only works when setting the config value to `null` inside a +config.js file — it doesn't work when setting the config value to `null` with a +{configName}.js file).
81
+ function isConfigSourceValueNull(source) {
82
+ if (!source.valueIsLoaded)
83
+ return null;
84
+ return source.value === null;
85
+ }
86
+ function applyFilenameSuffix(sourcesRelevant) {
87
+ const getFileName = (source) => source.plusFile?.filePath.fileName ?? '';
88
+ // Apply `clear`: truncate at first clear file
89
+ const clearIndex = sourcesRelevant.findIndex((source) => getFileName(source).includes('.clear.'));
90
+ if (clearIndex !== -1)
91
+ sourcesRelevant = sourcesRelevant.slice(0, clearIndex + 1);
92
+ // Apply `default`: exclude defaults if any non-defaults exist, otherwise keep only first default
93
+ const nonDefaults = sourcesRelevant.filter((source) => !getFileName(source).includes('.default.'));
94
+ return nonDefaults.length > 0 ? nonDefaults : sourcesRelevant.slice(0, 1);
65
95
  }
@@ -4,9 +4,10 @@ export type { ConfigDefinitions };
4
4
  export type { ConfigDefinitionsInternal };
5
5
  export type { ConfigDefinitionInternal };
6
6
  export type { ConfigEffect };
7
- import type { ConfigEnvInternal, ConfigEnv, DefinedAtFilePath, PageConfigBuildTime } from '../../../../types/PageConfig.js';
7
+ import type { ConfigEnvInternal, ConfigEnv, DefinedAtFilePath } from '../../../../types/PageConfig.js';
8
8
  import type { Config, ConfigNameBuiltIn, ConfigNameGlobal } from '../../../../types/Config.js';
9
9
  import { type ConfigDefinedAt } from '../../../../shared/page-configs/getConfigDefinedAt.js';
10
+ import type { PageConfigBuildTimeBeforeComputed } from '../resolveVikeConfigInternal.js';
10
11
  /** The meta definition of a config.
11
12
  *
12
13
  * https://vike.dev/meta
@@ -75,7 +76,7 @@ type ConfigEffect = (config: {
75
76
  }) => Config | undefined;
76
77
  /** For Vike internal use */
77
78
  type ConfigDefinitionInternal = Omit<ConfigDefinition_, 'env'> & {
78
- _computed?: (pageConfig: Omit<PageConfigBuildTime, 'configValuesComputed'>) => unknown;
79
+ _computed?: (pageConfig: PageConfigBuildTimeBeforeComputed) => unknown;
79
80
  _valueIsFilePath?: true;
80
81
  _userEffectDefinedAtFilePath?: DefinedAtFilePath;
81
82
  env: ConfigEnvInternal;
@@ -1,7 +1,7 @@
1
1
  export { configDefinitionsBuiltIn };
2
2
  import { assert, assertUsage } from '../../utils.js';
3
3
  import { getConfigDefinedAt } from '../../../../shared/page-configs/getConfigDefinedAt.js';
4
- import { getConfigValueSourcesRelevant } from '../../plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js';
4
+ import { getConfigValueSourceRelevantAnyEnv, getConfigValueSourcesRelevant, isConfigSourceValueNull, } from '../../plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js';
5
5
  const configDefinitionsBuiltIn = {
6
6
  onRenderHtml: {
7
7
  env: { server: true },
@@ -108,7 +108,9 @@ const configDefinitionsBuiltIn = {
108
108
  }, pageConfig))
109
109
  .flat(1)
110
110
  // Server-only
111
- .filter((source) => !source.configEnv.client);
111
+ .filter((source) => !source.configEnv.client)
112
+ // Config value isn't `null`
113
+ .filter((source) => !isConfigSourceValueNull(source));
112
114
  return sources.length > 0;
113
115
  },
114
116
  },
@@ -120,22 +122,19 @@ const configDefinitionsBuiltIn = {
120
122
  env: { server: true, client: true },
121
123
  eager: true,
122
124
  _computed: (pageConfig) => {
123
- const { configValueSources } = pageConfig;
124
125
  {
125
- const source = getConfigValueSource(configValueSources, 'clientHooks');
126
+ const source = getConfigValueSourceRelevantAnyEnv('clientHooks', pageConfig);
126
127
  if (source) {
127
128
  assert(source.valueIsLoaded);
128
- if (source.value !== null) {
129
- const { value } = source;
130
- const definedAt = getConfigDefinedAt('Config', 'clientHooks', source.definedAt);
131
- assertUsage(typeof value === 'boolean', `${definedAt} should be a boolean`);
132
- return value;
133
- }
129
+ const { value, definedAt } = source;
130
+ const configDefinedAt = getConfigDefinedAt('Config', 'clientHooks', definedAt);
131
+ assertUsage(typeof value === 'boolean', `${configDefinedAt} should be a boolean`);
132
+ return value;
134
133
  }
135
134
  }
136
- return (isConfigSet(configValueSources, 'onRenderClient') &&
137
- isConfigSet(configValueSources, 'Page') &&
138
- !!getConfigEnv(configValueSources, 'Page')?.client);
135
+ return (isConfigSet(pageConfig, 'onRenderClient') &&
136
+ isConfigSet(pageConfig, 'Page') &&
137
+ !!getConfigEnv(pageConfig, 'Page')?.client);
139
138
  },
140
139
  },
141
140
  // TO-DO/soon/cumulative-hooks: remove and replace with new computed prop `clientOnlyHooks: string[]` (see other TO-DO/soon/cumulative-hooks entries)
@@ -143,10 +142,7 @@ const configDefinitionsBuiltIn = {
143
142
  env: { client: true },
144
143
  eager: true,
145
144
  _computed: (pageConfig) => {
146
- const { configValueSources } = pageConfig;
147
- return !isConfigSet(configValueSources, 'onBeforeRender')
148
- ? null
149
- : getConfigEnv(configValueSources, 'onBeforeRender');
145
+ return !isConfigSet(pageConfig, 'onBeforeRender') ? null : getConfigEnv(pageConfig, 'onBeforeRender');
150
146
  },
151
147
  },
152
148
  // TO-DO/soon/cumulative-hooks: remove and replace with new computed prop `clientOnlyHooks: string[]` (see other TO-DO/soon/cumulative-hooks entries)
@@ -154,8 +150,7 @@ const configDefinitionsBuiltIn = {
154
150
  env: { client: true },
155
151
  eager: true,
156
152
  _computed: (pageConfig) => {
157
- const { configValueSources } = pageConfig;
158
- return !isConfigSet(configValueSources, 'data') ? null : getConfigEnv(configValueSources, 'data');
153
+ return !isConfigSet(pageConfig, 'data') ? null : getConfigEnv(pageConfig, 'data');
159
154
  },
160
155
  },
161
156
  hooksTimeout: {
@@ -243,11 +238,11 @@ const configDefinitionsBuiltIn = {
243
238
  cumulative: true,
244
239
  },
245
240
  };
246
- function getConfigEnv(configValueSources, configName) {
247
- const configValueSource = getConfigValueSource(configValueSources, configName);
248
- if (!configValueSource)
241
+ function getConfigEnv(pageConfig, configName) {
242
+ const source = getConfigValueSourceRelevantAnyEnv(configName, pageConfig);
243
+ if (!source)
249
244
  return null;
250
- const { configEnv } = configValueSource;
245
+ const { configEnv } = source;
251
246
  const env = {};
252
247
  if (configEnv.client)
253
248
  env.client = true;
@@ -255,18 +250,7 @@ function getConfigEnv(configValueSources, configName) {
255
250
  env.server = true;
256
251
  return env;
257
252
  }
258
- function isConfigSet(configValueSources, configName) {
259
- const source = getConfigValueSource(configValueSources, configName);
260
- return (!!source &&
261
- !(source.valueIsLoaded &&
262
- // Enable users to suppress inherited config by overriding it with `null`
263
- source.value === null));
264
- }
265
- function getConfigValueSource(configValueSources, configName) {
266
- const sources = configValueSources[configName];
267
- if (!sources)
268
- return null;
269
- const configValueSource = sources[0];
270
- assert(configValueSource);
271
- return configValueSource;
253
+ function isConfigSet(pageConfig, configName) {
254
+ const source = getConfigValueSourceRelevantAnyEnv(configName, pageConfig);
255
+ return !!source;
272
256
  }
@@ -8,6 +8,7 @@ export { getConfVal };
8
8
  export { getConfigDefinitionOptional };
9
9
  export { getVikeConfigFromCliOrEnv };
10
10
  export type { VikeConfigInternal };
11
+ export type { PageConfigBuildTimeBeforeComputed };
11
12
  export { getVikeConfig };
12
13
  export type { VikeConfig };
13
14
  import type { PageConfigGlobalBuildTime, PageConfigBuildTime } from '../../../types/PageConfig.js';
@@ -57,6 +58,7 @@ declare function getVikeConfigFromCliOrEnv(): {
57
58
  configFromCliOptions: import("../../cli/parseCli.js").CliOptions | null;
58
59
  configFromEnvVar: Record<string, unknown> | null;
59
60
  };
61
+ type PageConfigBuildTimeBeforeComputed = Omit<PageConfigBuildTime, 'configValuesComputed'>;
60
62
  declare function getConfigDefinitionOptional(configDefinitions: ConfigDefinitionsInternal, configName: string): ConfigDefinitionInternal | null;
61
63
  declare function getConfVal(plusFile: PlusFile, configName: string): null | {
62
64
  value: unknown;
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.237-commit-e549c30";
1
+ export declare const PROJECT_VERSION: "0.4.237-commit-92dc549";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.237-commit-e549c30';
2
+ export const PROJECT_VERSION = '0.4.237-commit-92dc549';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.237-commit-e549c30",
3
+ "version": "0.4.237-commit-92dc549",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {
@@ -129,7 +129,7 @@
129
129
  },
130
130
  "dependencies": {
131
131
  "@brillout/import": "^0.2.6",
132
- "@brillout/json-serializer": "^0.5.17",
132
+ "@brillout/json-serializer": "^0.5.20",
133
133
  "@brillout/picocolors": "^1.0.26",
134
134
  "@brillout/require-shim": "^0.1.2",
135
135
  "@brillout/vite-plugin-server-entry": "^0.7.12",