vike 0.4.222-commit-fab3841 → 0.4.223-commit-6f064ad
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/cjs/node/plugin/index.js +5 -3
- package/dist/cjs/node/plugin/plugins/baseUrls.js +3 -1
- package/dist/cjs/node/plugin/plugins/buildApp.js +5 -2
- package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +49 -19
- package/dist/cjs/node/plugin/plugins/buildConfig.js +3 -1
- package/dist/cjs/node/plugin/plugins/commonConfig.js +17 -1
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/assertExtensions.js +4 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +6 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +10 -9
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +8 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +24 -52
- package/dist/cjs/node/plugin/shared/findPageFiles.js +3 -3
- package/dist/cjs/node/prerender/runPrerender.js +3 -1
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +7 -1
- package/dist/cjs/shared/getPageContextUrlComputed.js +1 -1
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +16 -6
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/findFile.js +1 -1
- package/dist/esm/client/client-routing-runtime/index.d.ts +1 -0
- package/dist/esm/client/client-routing-runtime/index.js +1 -0
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.d.ts +8 -0
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +10 -1
- package/dist/esm/node/plugin/index.d.ts +2 -1
- package/dist/esm/node/plugin/index.js +1 -0
- package/dist/esm/node/plugin/plugins/baseUrls.js +3 -1
- package/dist/esm/node/plugin/plugins/buildApp.js +5 -2
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +49 -19
- package/dist/esm/node/plugin/plugins/buildConfig.js +3 -1
- package/dist/esm/node/plugin/plugins/commonConfig.d.ts +14 -6
- package/dist/esm/node/plugin/plugins/commonConfig.js +17 -1
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/assertExtensions.js +4 -4
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +6 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +9 -8
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +8 -5
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +25 -53
- package/dist/esm/node/plugin/shared/findPageFiles.js +3 -3
- package/dist/esm/node/prerender/runPrerender.js +3 -1
- package/dist/esm/node/runtime/renderPage/logErrorHint.js +7 -1
- package/dist/esm/shared/getPageContextUrlComputed.js +1 -1
- package/dist/esm/shared/page-configs/PageConfig.d.ts +3 -2
- package/dist/esm/shared/page-configs/serialize/serializeConfigValues.d.ts +2 -0
- package/dist/esm/shared/page-configs/serialize/serializeConfigValues.js +16 -6
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/findFile.js +1 -1
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +2 -2
|
@@ -20,7 +20,7 @@ import { getFilePathResolved } from '../../../shared/getFilePath.js';
|
|
|
20
20
|
import { getConfigValueBuildTime } from '../../../../../shared/page-configs/getConfigValueBuildTime.js';
|
|
21
21
|
import { assertExtensionsRequire } from './getVikeConfig/assertExtensions.js';
|
|
22
22
|
import { getPageConfigGlobalUserFriendly, getPageConfigUserFriendly } from '../../../../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
23
|
-
import { getConfigValuesBase } from '../../../../../shared/page-configs/serialize/serializeConfigValues.js';
|
|
23
|
+
import { getConfigValuesBase, isJsonValue } from '../../../../../shared/page-configs/serialize/serializeConfigValues.js';
|
|
24
24
|
import { getPlusFilesAll } from './getVikeConfig/getPlusFilesAll.js';
|
|
25
25
|
assertIsNotProductionRuntime();
|
|
26
26
|
let restartVite = false;
|
|
@@ -352,8 +352,8 @@ function temp_interopVikeVitePlugin(pageConfigGlobal, vikeVitePluginOptions, use
|
|
|
352
352
|
locationId: '/',
|
|
353
353
|
plusFile: null,
|
|
354
354
|
isOverriden: configDef.cumulative ? false : sources.length > 0,
|
|
355
|
-
|
|
356
|
-
|
|
355
|
+
valueIsLoadedWithImport: false,
|
|
356
|
+
valueIsDefinedByPlusValueFile: false
|
|
357
357
|
});
|
|
358
358
|
});
|
|
359
359
|
}
|
|
@@ -417,20 +417,10 @@ function getPlusFilesOrdered(configName, plusFilesRelevant) {
|
|
|
417
417
|
const plusFilesConfig = plusFilesForConfigName.filter((plusFile) => plusFile.isConfigFile &&
|
|
418
418
|
// We consider extensions (e.g. vike-react) later (i.e. with less priority)
|
|
419
419
|
!plusFile.isExtensionConfig);
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
const plusFileWinner = plusFilesValue[0] ?? plusFilesConfig[0];
|
|
425
|
-
if (plusFileWinner) {
|
|
426
|
-
const plusFilesOverriden = [...plusFilesValue, ...plusFilesConfig].filter((f) => f !== plusFileWinner);
|
|
427
|
-
// A user-land conflict of plusFiles with the same `locationId` (we are iterating over `plusFilesRelevant: PlusFilesByLocationId`) means that the user has superfluously defined the config twice; the user should remove such redundancy as it makes things unnecessarily ambiguous.
|
|
428
|
-
assertOverwrittenConfigFile(plusFileWinner, plusFilesOverriden, configName);
|
|
429
|
-
[plusFileWinner, ...plusFilesOverriden].forEach((plusFile) => {
|
|
430
|
-
assert(plusFile.filePath.filePathAbsoluteUserRootDir); // ensure it's a user-land plus file
|
|
431
|
-
populate(plusFile);
|
|
432
|
-
});
|
|
433
|
-
}
|
|
420
|
+
[...plusFilesValue, ...plusFilesConfig].forEach((plusFile) => {
|
|
421
|
+
assert(plusFile.filePath.filePathAbsoluteUserRootDir); // ensure it's a user-land plus file
|
|
422
|
+
populate(plusFile);
|
|
423
|
+
});
|
|
434
424
|
}
|
|
435
425
|
// ==========================
|
|
436
426
|
// Side-effect configs (next)
|
|
@@ -482,8 +472,8 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
|
|
|
482
472
|
let valueFilePath;
|
|
483
473
|
if (plusFile.isConfigFile) {
|
|
484
474
|
// Defined over pointer import
|
|
485
|
-
assert(confVal.
|
|
486
|
-
const pointerImport = resolvePointerImport(confVal.
|
|
475
|
+
assert(confVal.valueIsLoaded);
|
|
476
|
+
const pointerImport = resolvePointerImport(confVal.value, plusFile.filePath, userRootDir, configName);
|
|
487
477
|
const configDefinedAt = getConfigDefinedAt('Config', configName, definedAtFilePath_);
|
|
488
478
|
assertUsage(pointerImport, `${configDefinedAt} should be an import`);
|
|
489
479
|
valueFilePath = pointerImport.fileExportPath.filePathAbsoluteVite;
|
|
@@ -504,8 +494,8 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
|
|
|
504
494
|
value: valueFilePath,
|
|
505
495
|
valueIsFilePath: true,
|
|
506
496
|
configEnv: configDef.env,
|
|
507
|
-
|
|
508
|
-
|
|
497
|
+
valueIsLoadedWithImport: false,
|
|
498
|
+
valueIsDefinedByPlusValueFile: false,
|
|
509
499
|
isOverriden,
|
|
510
500
|
definedAtFilePath
|
|
511
501
|
};
|
|
@@ -513,8 +503,7 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
|
|
|
513
503
|
}
|
|
514
504
|
// +config.js
|
|
515
505
|
if (plusFile.isConfigFile) {
|
|
516
|
-
assert(confVal.
|
|
517
|
-
const { configValue } = confVal;
|
|
506
|
+
assert(confVal.valueIsLoaded);
|
|
518
507
|
// Defined over pointer import
|
|
519
508
|
const pointerImport = plusFile.pointerImportsByConfigName[configName];
|
|
520
509
|
if (pointerImport) {
|
|
@@ -530,8 +519,8 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
|
|
|
530
519
|
...configValueSourceCommon,
|
|
531
520
|
...value,
|
|
532
521
|
configEnv: resolveConfigEnv(configDef.env, pointerImport.fileExportPath),
|
|
533
|
-
|
|
534
|
-
|
|
522
|
+
valueIsLoadedWithImport: true,
|
|
523
|
+
valueIsDefinedByPlusValueFile: false,
|
|
535
524
|
isOverriden,
|
|
536
525
|
definedAtFilePath: pointerImport.fileExportPath
|
|
537
526
|
};
|
|
@@ -541,10 +530,10 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
|
|
|
541
530
|
const configValueSource = {
|
|
542
531
|
...configValueSourceCommon,
|
|
543
532
|
valueIsLoaded: true,
|
|
544
|
-
value:
|
|
533
|
+
value: confVal.value,
|
|
545
534
|
configEnv: configDef.env,
|
|
546
|
-
|
|
547
|
-
|
|
535
|
+
valueIsLoadedWithImport: false,
|
|
536
|
+
valueIsDefinedByPlusValueFile: false,
|
|
548
537
|
isOverriden,
|
|
549
538
|
definedAtFilePath: definedAtFilePath_
|
|
550
539
|
};
|
|
@@ -553,22 +542,13 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
|
|
|
553
542
|
// Defined by value file, i.e. +{configName}.js
|
|
554
543
|
if (!plusFile.isConfigFile) {
|
|
555
544
|
const configEnvResolved = resolveConfigEnv(configDef.env, plusFile.filePath);
|
|
556
|
-
|
|
557
|
-
assert(valueAlreadyLoaded === !!configEnvResolved.config);
|
|
558
|
-
const value = valueAlreadyLoaded
|
|
559
|
-
? {
|
|
560
|
-
valueIsLoaded: true,
|
|
561
|
-
value: confVal.configValue
|
|
562
|
-
}
|
|
563
|
-
: {
|
|
564
|
-
valueIsLoaded: false
|
|
565
|
-
};
|
|
545
|
+
assert(confVal.valueIsLoaded === !!configEnvResolved.config);
|
|
566
546
|
const configValueSource = {
|
|
567
547
|
...configValueSourceCommon,
|
|
568
|
-
...
|
|
548
|
+
...confVal,
|
|
569
549
|
configEnv: configEnvResolved,
|
|
570
|
-
|
|
571
|
-
|
|
550
|
+
valueIsLoadedWithImport: !confVal.valueIsLoaded || !isJsonValue(confVal.value),
|
|
551
|
+
valueIsDefinedByPlusValueFile: true,
|
|
572
552
|
isOverriden,
|
|
573
553
|
definedAtFilePath: {
|
|
574
554
|
...plusFile.filePath,
|
|
@@ -582,14 +562,6 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
|
|
|
582
562
|
}
|
|
583
563
|
assert(false);
|
|
584
564
|
}
|
|
585
|
-
function assertOverwrittenConfigFile(plusFileWinner, plusFilesOverriden, configName) {
|
|
586
|
-
plusFilesOverriden.forEach((plusFileLoser) => {
|
|
587
|
-
const loserFilePath = plusFileLoser.filePath.filePathToShowToUser;
|
|
588
|
-
const winnerFilePath = plusFileWinner.filePath.filePathToShowToUser;
|
|
589
|
-
const confName = pc.cyan(configName);
|
|
590
|
-
assertWarning(false, `The value of the config ${confName} defined at ${loserFilePath} is always overwritten by the value defined at ${winnerFilePath}, remove the superfluous value defined at ${loserFilePath}`, { onlyOnce: true });
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
565
|
function isDefiningPage(plusFiles) {
|
|
594
566
|
for (const plusFile of plusFiles) {
|
|
595
567
|
const configNames = getDefiningConfigNames(plusFile);
|
|
@@ -623,8 +595,8 @@ function getConfigDefinitions(plusFilesRelevant, filter) {
|
|
|
623
595
|
const confVal = getConfVal(plusFile, 'meta');
|
|
624
596
|
if (!confVal)
|
|
625
597
|
return;
|
|
626
|
-
assert(confVal.
|
|
627
|
-
const meta = confVal.
|
|
598
|
+
assert(confVal.valueIsLoaded);
|
|
599
|
+
const meta = confVal.value;
|
|
628
600
|
assertMetaUsage(meta, `Config ${pc.cyan('meta')} defined at ${plusFile.filePath.filePathToShowToUser}`);
|
|
629
601
|
// Set configDef._userEffectDefinedAtFilePath
|
|
630
602
|
Object.entries(meta).forEach(([configName, configDef]) => {
|
|
@@ -920,8 +892,8 @@ function getConfVal(plusFile, configName) {
|
|
|
920
892
|
if (!configNames.includes(configName))
|
|
921
893
|
return null;
|
|
922
894
|
if (plusFile.isNotLoaded)
|
|
923
|
-
return {
|
|
924
|
-
const confVal = {
|
|
895
|
+
return { valueIsLoaded: false };
|
|
896
|
+
const confVal = { value: plusFile.fileExportsByConfigName[configName], valueIsLoaded: true };
|
|
925
897
|
return confVal;
|
|
926
898
|
}
|
|
927
899
|
function resolveConfigEnv(configEnv, filePath) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { findPageFiles };
|
|
2
|
-
import glob from '
|
|
2
|
+
import { glob } from 'tinyglobby';
|
|
3
3
|
import { assertWarning, toPosixPath, scriptFileExtensions } from '../utils.js';
|
|
4
4
|
import pc from '@brillout/picocolors';
|
|
5
5
|
import { getOutDirs } from './getOutDirs.js';
|
|
@@ -7,11 +7,11 @@ async function findPageFiles(config, fileTypes, isDev) {
|
|
|
7
7
|
const cwd = config.root;
|
|
8
8
|
const { outDirRoot } = getOutDirs(config);
|
|
9
9
|
const timeBase = new Date().getTime();
|
|
10
|
-
let pageFiles = await glob(fileTypes.map((fileType) => `**/*${fileType}.${scriptFileExtensions}`), { ignore: ['**/node_modules/**', `${outDirRoot}/**`], cwd, dot: false });
|
|
10
|
+
let pageFiles = await glob(fileTypes.map((fileType) => `**/*${fileType}.${scriptFileExtensions}`), { ignore: ['**/node_modules/**', `${outDirRoot}/**`], cwd, dot: false, expandDirectories: false });
|
|
11
11
|
pageFiles = pageFiles.map((p) => '/' + toPosixPath(p));
|
|
12
12
|
const time = new Date().getTime() - timeBase;
|
|
13
13
|
if (isDev) {
|
|
14
|
-
// We only warn in dev, because while building it's expected to take a long time as
|
|
14
|
+
// We only warn in dev, because while building it's expected to take a long time as tinyglobby is competing for resources with other tasks
|
|
15
15
|
assertWarning(time < 1.5 * 1000, `Finding your page files ${pc.cyan('**/*.page.*')} took an unexpected long time (${time}ms). Reach out to the vike maintainer.`, {
|
|
16
16
|
onlyOnce: 'slow-page-files-search'
|
|
17
17
|
});
|
|
@@ -30,6 +30,7 @@ import { resolvePrerenderConfig, resolvePrerenderConfigLocal } from './resolvePr
|
|
|
30
30
|
import { getOutDirs } from '../plugin/shared/getOutDirs.js';
|
|
31
31
|
import { isVikeCli } from '../cli/context.js';
|
|
32
32
|
import { isViteCliCall } from '../plugin/shared/isViteCliCall.js';
|
|
33
|
+
import { getVikeConfigPublic } from '../plugin/plugins/commonConfig.js';
|
|
33
34
|
async function runPrerenderFromAPI(options = {}) {
|
|
34
35
|
return await runPrerender(options, 'prerender()');
|
|
35
36
|
// - We purposely propagate the error to the user land, so that the error interrupts the user land. It's also, I guess, a nice-to-have that the user has control over the error.
|
|
@@ -60,7 +61,8 @@ async function runPrerenderFromAutoRun(viteConfig, config) {
|
|
|
60
61
|
logErrorHint(err);
|
|
61
62
|
process.exit(1);
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
+
const vike = getVikeConfigPublic(config);
|
|
65
|
+
vike.prerenderContext = prerenderContextPublic;
|
|
64
66
|
const forceExit = isVikeCli() || isViteCliCall();
|
|
65
67
|
return { forceExit };
|
|
66
68
|
}
|
|
@@ -25,13 +25,19 @@ const errorsMisc = [
|
|
|
25
25
|
mustMentionNodeModules: false
|
|
26
26
|
}
|
|
27
27
|
];
|
|
28
|
+
const reactInvalidEelement = 'https://vike.dev/broken-npm-package#react-invalid-component';
|
|
28
29
|
const errorsReact = [
|
|
29
30
|
{
|
|
30
31
|
errMsg: 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)',
|
|
31
|
-
link:
|
|
32
|
+
link: reactInvalidEelement,
|
|
32
33
|
// The stack trace can be user-land while the import is coming from node_modules
|
|
33
34
|
mustMentionNodeModules: false
|
|
34
35
|
},
|
|
36
|
+
{
|
|
37
|
+
errMsg: 'Objects are not valid as a React child',
|
|
38
|
+
link: reactInvalidEelement,
|
|
39
|
+
mustMentionNodeModules: false
|
|
40
|
+
},
|
|
35
41
|
{
|
|
36
42
|
// React's "Invalid hook call.", see https://github.com/vikejs/vike/discussions/1637#discussioncomment-9424712
|
|
37
43
|
errMsg: "Cannot read properties of null (reading 'useContext')"
|
|
@@ -37,7 +37,7 @@ function getUrlParsed(pageContext) {
|
|
|
37
37
|
// 6. The value of pageContext.urlPathname is now '/login': the pathname of `pageContext.urlLogical`. (While pageContext.urlOriginal is still '/fr-FR/admin'.)
|
|
38
38
|
// Reproduction: https://github.com/vikejs/vike/discussions/1436#discussioncomment-8142023
|
|
39
39
|
// Determine logical URL
|
|
40
|
-
const assertUrlResolved = (src) => assert(
|
|
40
|
+
const assertUrlResolved = (src) => assert(typeof urlResolved === 'string',
|
|
41
41
|
// TODO/eventually: remove debug logs, see:
|
|
42
42
|
// - https://github.com/vikejs/vike/issues/2138#issuecomment-2631713411
|
|
43
43
|
// - https://github.com/vikejs/vike/commit/5c7810f3080ab62536950f26e019bb2a3a517082
|
|
@@ -94,10 +94,11 @@ type ConfigValueSource = {
|
|
|
94
94
|
locationId: LocationId;
|
|
95
95
|
isOverriden: boolean;
|
|
96
96
|
/** Wether the config value is loaded at runtime, for example config.Page or config.onBeforeRender */
|
|
97
|
-
|
|
97
|
+
valueIsLoadedWithImport: boolean;
|
|
98
98
|
/** Whether the config value is a file path, for example config.client */
|
|
99
99
|
valueIsFilePath?: true;
|
|
100
|
-
|
|
100
|
+
/** Whether the config value is defined by a +{configName}.js file */
|
|
101
|
+
valueIsDefinedByPlusValueFile: boolean;
|
|
101
102
|
} & ({
|
|
102
103
|
valueIsLoaded: false;
|
|
103
104
|
} | {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { serializeConfigValues };
|
|
2
2
|
export { getConfigValuesBase };
|
|
3
|
+
export { isJsonValue };
|
|
3
4
|
export type { FilesEnv };
|
|
4
5
|
import type { ConfigEnvInternal, ConfigValueSource, DefinedAtFile, PageConfigBuildTime, PageConfigGlobalBuildTime } from '../PageConfig.js';
|
|
5
6
|
declare function serializeConfigValues(pageConfig: PageConfigBuildTime | PageConfigGlobalBuildTime, importStatements: string[], filesEnv: FilesEnv, isEnvMatch: (configEnv: ConfigEnvInternal) => boolean, tabspace: string, isEager: boolean | null): string[];
|
|
7
|
+
declare function isJsonValue(value: unknown): boolean;
|
|
6
8
|
declare function getConfigValuesBase(pageConfig: PageConfigBuildTime | PageConfigGlobalBuildTime, isEnvMatch: (configEnv: ConfigEnvInternal) => boolean, isEager: boolean | null): ConfigValuesBase;
|
|
7
9
|
type ConfigValuesBase = ({
|
|
8
10
|
configValueBase: {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export { serializeConfigValues };
|
|
2
2
|
export { getConfigValuesBase };
|
|
3
|
+
export { isJsonValue };
|
|
3
4
|
import { assertIsNotProductionRuntime } from '../../../utils/assertSetup.js';
|
|
4
5
|
import { assert, assertPosixPath, assertUsage, deepEqual, getPropAccessNotation } from '../../../node/plugin/utils.js';
|
|
5
6
|
import { parsePointerImportData } from '../../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformPointerImports.js';
|
|
6
7
|
import { getConfigValueFilePathToShowToUser } from '../helpers.js';
|
|
7
8
|
import { stringify } from '@brillout/json-serializer/stringify';
|
|
8
9
|
import pc from '@brillout/picocolors';
|
|
10
|
+
const stringifyOptions = { forbidReactElements: true };
|
|
9
11
|
const REPLACE_ME_BEFORE = '__VIKE__REPLACE_ME_BEFORE__';
|
|
10
12
|
const REPLACE_ME_AFTER = '__VIKE__REPLACE_ME_AFTER__';
|
|
11
13
|
// This file is never loaded on the client-side but we save it under the vike/shared/ directory in order to collocate it with parsePageConfigs()
|
|
@@ -44,7 +46,7 @@ function serializeConfigValues(pageConfig, importStatements, filesEnv, isEnvMatc
|
|
|
44
46
|
function getValueSerializedFromSource(configValueSource, configName, importStatements, filesEnv) {
|
|
45
47
|
assert(configValueSource.isOverriden === false);
|
|
46
48
|
let valueData;
|
|
47
|
-
if ('value' in configValueSource) {
|
|
49
|
+
if ('value' in configValueSource && !configValueSource.valueIsLoadedWithImport) {
|
|
48
50
|
valueData = getValueSerializedWithJson(configValueSource.value, configName, configValueSource.definedAtFilePath, importStatements, filesEnv, configValueSource.configEnv);
|
|
49
51
|
}
|
|
50
52
|
else {
|
|
@@ -96,14 +98,13 @@ function serializeConfigValue(configValueBase, valueData, configName, lines, tab
|
|
|
96
98
|
}
|
|
97
99
|
function getValueSerializedWithImport(configValueSource, importStatements, filesEnv, configName) {
|
|
98
100
|
assert(!configValueSource.valueIsFilePath);
|
|
99
|
-
const {
|
|
100
|
-
assert(valueIsImportedAtRuntime);
|
|
101
|
+
const { valueIsDefinedByPlusValueFile, definedAtFilePath, configEnv } = configValueSource;
|
|
101
102
|
const { filePathAbsoluteVite, fileExportName } = definedAtFilePath;
|
|
102
|
-
if (
|
|
103
|
+
if (valueIsDefinedByPlusValueFile)
|
|
103
104
|
assert(fileExportName === undefined);
|
|
104
105
|
const { importName } = addImportStatement(importStatements, filePathAbsoluteVite, fileExportName || '*', filesEnv, configEnv, configName);
|
|
105
106
|
return {
|
|
106
|
-
type:
|
|
107
|
+
type: valueIsDefinedByPlusValueFile ? 'plus-file' : 'pointer-import',
|
|
107
108
|
valueAsJsCode: importName
|
|
108
109
|
};
|
|
109
110
|
}
|
|
@@ -120,7 +121,7 @@ function valueToJson(value, configName, definedAtData, importStatements, filesEn
|
|
|
120
121
|
try {
|
|
121
122
|
configValueSerialized = stringify(value, {
|
|
122
123
|
valueName,
|
|
123
|
-
|
|
124
|
+
...stringifyOptions,
|
|
124
125
|
// Replace import strings with import variables.
|
|
125
126
|
// - We don't need this anymore and could remove it.
|
|
126
127
|
// - We temporarily needed it for nested document configs (`config.document.{title,description,favicon}`), but we finally decided to go for flat document configs instead (`config.{title,description,favicon}`).
|
|
@@ -147,6 +148,15 @@ function valueToJson(value, configName, definedAtData, importStatements, filesEn
|
|
|
147
148
|
assert(!configValueSerialized.includes(REPLACE_ME_AFTER));
|
|
148
149
|
return configValueSerialized;
|
|
149
150
|
}
|
|
151
|
+
function isJsonValue(value) {
|
|
152
|
+
try {
|
|
153
|
+
stringify(value, stringifyOptions);
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
150
160
|
function logJsonSerializeError(err, configName, definedAtData) {
|
|
151
161
|
/*
|
|
152
162
|
// import { isJsonSerializerError } from '@brillout/json-serializer/stringify'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.223-commit-6f064ad";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.
|
|
2
|
+
export const PROJECT_VERSION = '0.4.223-commit-6f064ad';
|
|
@@ -3,7 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import { isArray } from './isArray.js';
|
|
5
5
|
import { assertPosixPath } from './path.js';
|
|
6
|
-
// We need to be able to crawl the filesystem, regardless of Vike's `$ git ls-files` command call, because we need to fallback if the user didn't setup Git (e.g. we cannot remove the
|
|
6
|
+
// We need to be able to crawl the filesystem, regardless of Vike's `$ git ls-files` command call, because we need to fallback if the user didn't setup Git (e.g. we cannot remove the tinyglobby fallback).
|
|
7
7
|
function findFile(arg, cwd) {
|
|
8
8
|
assertPosixPath(cwd);
|
|
9
9
|
const filenames = isArray(arg) ? arg : [arg];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.223-commit-6f064ad",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -137,10 +137,10 @@
|
|
|
137
137
|
"cac": "^6.0.0",
|
|
138
138
|
"es-module-lexer": "^1.0.0",
|
|
139
139
|
"esbuild": "^0.19.0 || ^0.20.0 || ^0.21.0 || ^0.22.0 || ^0.23.0 || ^0.24.0",
|
|
140
|
-
"fast-glob": "^3.0.0",
|
|
141
140
|
"json5": "^2.0.0",
|
|
142
141
|
"semver": "^7.0.0",
|
|
143
142
|
"source-map-support": "^0.5.0",
|
|
143
|
+
"tinyglobby": "^0.2.10",
|
|
144
144
|
"vite": ">=5.1.0"
|
|
145
145
|
},
|
|
146
146
|
"peerDependencies": {
|