vike 0.4.168 → 0.4.169
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/plugins/buildConfig.js +10 -2
- package/dist/cjs/node/plugin/plugins/commonConfig/assertResolveAlias.js +1 -1
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +19 -16
- package/dist/cjs/node/plugin/plugins/distFileNames.js +7 -1
- package/dist/cjs/node/plugin/plugins/envVars.js +1 -5
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +7 -7
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getConfigValuesSerialized.js +14 -11
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +7 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +11 -14
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.js +129 -0
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js +8 -8
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +52 -12
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +81 -106
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +2 -2
- package/dist/cjs/node/plugin/shared/getFilePath.js +50 -49
- package/dist/cjs/node/plugin/utils.js +2 -2
- package/dist/cjs/node/prerender/runPrerender.js +6 -5
- package/dist/cjs/node/prerender/utils.js +2 -1
- package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +1 -0
- package/dist/cjs/node/runtime/index-common.js +14 -3
- package/dist/cjs/node/runtime/renderPage/createHttpResponseObject/getCacheControl.js +2 -1
- package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +25 -14
- package/dist/cjs/node/runtime/renderPage/log404/index.js +2 -2
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +1 -1
- package/dist/cjs/node/runtime/utils.js +2 -1
- package/dist/cjs/node/shared/assertV1Design.js +1 -1
- package/dist/cjs/node/shared/getClientEntry.js +2 -2
- package/dist/cjs/node/shared/prependEntriesDir.js +1 -0
- package/dist/cjs/node/shared/utils.js +0 -1
- package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +3 -3
- package/dist/cjs/shared/getPageFiles/getExports.js +8 -15
- package/dist/cjs/shared/getPageFiles.js +3 -6
- package/dist/cjs/shared/hooks/getHook.js +7 -6
- package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +48 -0
- package/dist/cjs/shared/page-configs/{helpers/getConfigValue.js → getConfigValue.js} +6 -8
- package/dist/cjs/shared/page-configs/helpers.js +6 -11
- package/dist/cjs/shared/page-configs/serialize/assertPageConfigsSerialized.js +1 -1
- package/dist/cjs/shared/page-configs/serialize/parseConfigValuesImported.js +2 -1
- package/dist/cjs/shared/page-configs/serialize/parseConfigValuesSerialized.js +11 -6
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +4 -3
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValue.js +3 -3
- package/dist/cjs/shared/route/index.js +2 -2
- package/dist/cjs/shared/route/loadPageRoutes.js +12 -10
- package/dist/cjs/shared/route/resolveRouteFunction.js +8 -9
- package/dist/cjs/shared/route/resolveRouteString.js +5 -16
- package/dist/cjs/shared/route/utils.js +0 -1
- package/dist/cjs/shared/utils.js +1 -0
- package/dist/cjs/utils/assertPathFilesystemAbsolute.js +39 -0
- package/dist/cjs/utils/createErrorWithCleanStackTrace.js +1 -7
- package/dist/cjs/utils/debug.js +2 -1
- package/dist/cjs/utils/findFile.js +2 -1
- package/dist/cjs/utils/hasProp.js +9 -5
- package/dist/cjs/utils/injectRollupInputs.js +2 -1
- package/dist/cjs/utils/isArray.js +8 -0
- package/dist/cjs/utils/isArrayOfStrings.js +8 -0
- package/dist/cjs/utils/isDev.js +12 -4
- package/dist/cjs/utils/isNpmPackage.js +1 -1
- package/dist/cjs/utils/isObjectOfStrings.js +8 -0
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.d.ts +3 -1
- package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.js +2 -1
- package/dist/esm/client/server-routing-runtime/getPageContext.d.ts +1 -0
- package/dist/esm/client/shared/getPageContextSerializedInHtml.d.ts +1 -0
- package/dist/esm/client/shared/getPageContextSerializedInHtml.js +1 -0
- package/dist/esm/client/shared/loadUserFilesClientSide.js +3 -7
- package/dist/esm/node/plugin/plugins/buildConfig.js +9 -1
- package/dist/esm/node/plugin/plugins/commonConfig/assertResolveAlias.js +2 -2
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +20 -17
- package/dist/esm/node/plugin/plugins/distFileNames.js +8 -2
- package/dist/esm/node/plugin/plugins/envVars.js +2 -6
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +9 -9
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getConfigValuesSerialized.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getConfigValuesSerialized.js +14 -11
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +4 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +7 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +12 -15
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.d.ts +12 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.js +123 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.d.ts +8 -8
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js +7 -7
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +53 -13
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +81 -106
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +1 -1
- package/dist/esm/node/plugin/shared/getFilePath.d.ts +11 -5
- package/dist/esm/node/plugin/shared/getFilePath.js +49 -48
- package/dist/esm/node/plugin/utils.d.ts +2 -2
- package/dist/esm/node/plugin/utils.js +2 -2
- package/dist/esm/node/prerender/runPrerender.js +6 -5
- package/dist/esm/node/prerender/utils.d.ts +2 -1
- package/dist/esm/node/prerender/utils.js +2 -1
- package/dist/esm/node/runtime/html/serializePageContextClientSide.d.ts +1 -0
- package/dist/esm/node/runtime/html/serializePageContextClientSide.js +1 -0
- package/dist/esm/node/runtime/index-common.d.ts +0 -4
- package/dist/esm/node/runtime/index-common.js +14 -3
- package/dist/esm/node/runtime/renderPage/createHttpResponseObject/getCacheControl.js +2 -1
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.d.ts +4 -4
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.js +27 -16
- package/dist/esm/node/runtime/renderPage/log404/index.js +2 -2
- package/dist/esm/node/runtime/renderPage/logErrorHint.js +2 -2
- package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts +2 -7
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +16 -16
- package/dist/esm/node/runtime/utils.d.ts +2 -1
- package/dist/esm/node/runtime/utils.js +2 -1
- package/dist/esm/node/shared/assertV1Design.js +1 -1
- package/dist/esm/node/shared/getClientEntry.js +1 -1
- package/dist/esm/node/shared/prependEntriesDir.js +1 -0
- package/dist/esm/node/shared/utils.d.ts +0 -1
- package/dist/esm/node/shared/utils.js +0 -1
- package/dist/esm/shared/getPageFiles/analyzeClientSide.js +1 -1
- package/dist/esm/shared/getPageFiles/getExports.d.ts +4 -5
- package/dist/esm/shared/getPageFiles/getExports.js +9 -16
- package/dist/esm/shared/getPageFiles.d.ts +1 -2
- package/dist/esm/shared/getPageFiles.js +1 -3
- package/dist/esm/shared/hooks/getHook.js +6 -5
- package/dist/esm/shared/page-configs/Config.d.ts +2 -2
- package/dist/esm/shared/page-configs/FilePath.d.ts +32 -22
- package/dist/esm/shared/page-configs/PageConfig.d.ts +27 -15
- package/dist/esm/shared/page-configs/getConfigDefinedAt.d.ts +11 -0
- package/dist/esm/shared/page-configs/getConfigDefinedAt.js +42 -0
- package/dist/esm/shared/page-configs/{helpers/getConfigValue.d.ts → getConfigValue.d.ts} +2 -2
- package/dist/esm/shared/page-configs/{helpers/getConfigValue.js → getConfigValue.js} +6 -8
- package/dist/esm/shared/page-configs/helpers.d.ts +3 -9
- package/dist/esm/shared/page-configs/helpers.js +6 -8
- package/dist/esm/shared/page-configs/serialize/PageConfigSerialized.d.ts +7 -4
- package/dist/esm/shared/page-configs/serialize/assertPageConfigsSerialized.js +2 -2
- package/dist/esm/shared/page-configs/serialize/parseConfigValuesImported.js +2 -1
- package/dist/esm/shared/page-configs/serialize/parseConfigValuesSerialized.js +12 -7
- package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +5 -4
- package/dist/esm/shared/page-configs/serialize/serializeConfigValue.js +3 -3
- package/dist/esm/shared/route/index.js +2 -2
- package/dist/esm/shared/route/loadPageRoutes.d.ts +3 -3
- package/dist/esm/shared/route/loadPageRoutes.js +10 -8
- package/dist/esm/shared/route/resolveRouteFunction.d.ts +1 -1
- package/dist/esm/shared/route/resolveRouteFunction.js +9 -10
- package/dist/esm/shared/route/resolveRouteString.d.ts +0 -2
- package/dist/esm/shared/route/resolveRouteString.js +5 -16
- package/dist/esm/shared/route/utils.d.ts +0 -1
- package/dist/esm/shared/route/utils.js +0 -1
- package/dist/esm/shared/utils.d.ts +1 -0
- package/dist/esm/shared/utils.js +1 -0
- package/dist/esm/utils/assertPathFilesystemAbsolute.d.ts +6 -0
- package/dist/esm/utils/assertPathFilesystemAbsolute.js +33 -0
- package/dist/esm/utils/createErrorWithCleanStackTrace.js +1 -7
- package/dist/esm/utils/debug.js +2 -1
- package/dist/esm/utils/findFile.js +2 -1
- package/dist/esm/utils/hasProp.d.ts +1 -0
- package/dist/esm/utils/hasProp.js +9 -5
- package/dist/esm/utils/injectRollupInputs.js +2 -1
- package/dist/esm/utils/isArray.d.ts +1 -0
- package/dist/esm/utils/isArray.js +4 -0
- package/dist/esm/utils/isArrayOfStrings.d.ts +2 -0
- package/dist/esm/utils/isArrayOfStrings.js +5 -0
- package/dist/esm/utils/isDev.d.ts +3 -0
- package/dist/esm/utils/isDev.js +11 -3
- package/dist/esm/utils/isNpmPackage.js +1 -1
- package/dist/esm/utils/isObjectOfStrings.d.ts +2 -0
- package/dist/esm/utils/isObjectOfStrings.js +5 -0
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +3 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +0 -136
- package/dist/cjs/shared/page-configs/helpers/getConfigDefinedAtString.js +0 -43
- package/dist/cjs/utils/assertPathIsFilesystemAbsolute.js +0 -21
- package/dist/cjs/utils/isStringRecord.js +0 -7
- package/dist/cjs/utils/mergeCumulativeValues.js +0 -21
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.d.ts +0 -13
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +0 -130
- package/dist/esm/shared/page-configs/helpers/getConfigDefinedAtString.d.ts +0 -7
- package/dist/esm/shared/page-configs/helpers/getConfigDefinedAtString.js +0 -37
- package/dist/esm/utils/assertPathIsFilesystemAbsolute.d.ts +0 -3
- package/dist/esm/utils/assertPathIsFilesystemAbsolute.js +0 -15
- package/dist/esm/utils/isStringRecord.d.ts +0 -1
- package/dist/esm/utils/isStringRecord.js +0 -3
- package/dist/esm/utils/mergeCumulativeValues.d.ts +0 -2
- package/dist/esm/utils/mergeCumulativeValues.js +0 -18
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
export { resolveImport };
|
|
2
|
-
export { resolveImportPath };
|
|
3
|
-
export { assertImportPath };
|
|
4
|
-
export { clearFilesEnvMap };
|
|
5
|
-
import pc from '@brillout/picocolors';
|
|
6
|
-
import { assert, assertPosixPath, assertUsage, deepEqual, requireResolve } from '../../../../utils.js';
|
|
7
|
-
import { parseImportData } from './transformFileImports.js';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import { getFilePathResolved, getFilePathUnresolved } from '../../../../shared/getFilePath.js';
|
|
10
|
-
const filesEnvMap = new Map();
|
|
11
|
-
function resolveImport(configValue, importerFilePath, userRootDir, configEnv, configName) {
|
|
12
|
-
if (typeof configValue !== 'string')
|
|
13
|
-
return null;
|
|
14
|
-
const importData = parseImportData(configValue);
|
|
15
|
-
if (!importData)
|
|
16
|
-
return null;
|
|
17
|
-
const { importPath, exportName } = importData;
|
|
18
|
-
const filePathAbsoluteFilesystem = resolveImportPath(importData, importerFilePath);
|
|
19
|
-
assertFileEnv(filePathAbsoluteFilesystem ?? importPath, configEnv, configName);
|
|
20
|
-
const fileExportPathToShowToUser = exportName === 'default' || exportName === configName ? [] : [exportName];
|
|
21
|
-
let filePath;
|
|
22
|
-
if (importPath.startsWith('.')) {
|
|
23
|
-
// We need to resolve relative paths into absolute paths. Because the import paths are included in virtual files:
|
|
24
|
-
// ```
|
|
25
|
-
// [vite] Internal server error: Failed to resolve import "./onPageTransitionHooks" from "virtual:vike:pageConfigValuesAll:client:/pages/index". Does the file exist?
|
|
26
|
-
// ```
|
|
27
|
-
assertImportPath(filePathAbsoluteFilesystem, importData, importerFilePath);
|
|
28
|
-
const filePathAbsoluteUserRootDir = resolveImportPath_absoluteUserRootDir(filePathAbsoluteFilesystem, importData, importerFilePath, userRootDir);
|
|
29
|
-
filePath = getFilePathResolved({ filePathAbsoluteUserRootDir, userRootDir });
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// importPath can be:
|
|
33
|
-
// - an npm package import
|
|
34
|
-
// - a path alias
|
|
35
|
-
if (filePathAbsoluteFilesystem) {
|
|
36
|
-
filePath = getFilePathResolved({
|
|
37
|
-
userRootDir,
|
|
38
|
-
filePathAbsoluteFilesystem,
|
|
39
|
-
importPathAbsolute: importPath
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
filePath = getFilePathUnresolved({
|
|
44
|
-
importPathAbsolute: importPath
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
...filePath,
|
|
50
|
-
fileExportName: exportName,
|
|
51
|
-
fileExportPathToShowToUser
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function resolveImportPath_absoluteUserRootDir(filePathAbsoluteFilesystem, importData, configFilePath, userRootDir) {
|
|
55
|
-
assertPosixPath(userRootDir);
|
|
56
|
-
let filePathAbsoluteUserRootDir;
|
|
57
|
-
if (filePathAbsoluteFilesystem.startsWith(userRootDir)) {
|
|
58
|
-
filePathAbsoluteUserRootDir = getVitePathFromAbsolutePath(filePathAbsoluteFilesystem, userRootDir);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
assertUsage(false, `${configFilePath.filePathToShowToUser} imports from a relative path ${pc.cyan(importData.importPath)} outside of ${userRootDir} which is forbidden: import from a relative path inside ${userRootDir}, or import from a dependency's package.json#exports entry instead`);
|
|
62
|
-
// None of the following works. Seems to be a Vite bug?
|
|
63
|
-
// /*
|
|
64
|
-
// assert(filePathAbsoluteFilesystem.startsWith('/'))
|
|
65
|
-
// filePath = `/@fs${filePathAbsoluteFilesystem}`
|
|
66
|
-
// /*/
|
|
67
|
-
// filePathAbsoluteUserRootDir = path.posix.relative(userRootDir, filePathAbsoluteFilesystem)
|
|
68
|
-
// assert(filePathAbsoluteUserRootDir.startsWith('../'))
|
|
69
|
-
// filePathAbsoluteUserRootDir = '/' + filePathAbsoluteUserRootDir
|
|
70
|
-
// //*/
|
|
71
|
-
}
|
|
72
|
-
assertPosixPath(filePathAbsoluteUserRootDir);
|
|
73
|
-
assert(filePathAbsoluteUserRootDir.startsWith('/'));
|
|
74
|
-
return filePathAbsoluteUserRootDir;
|
|
75
|
-
}
|
|
76
|
-
function resolveImportPath(importData, importerFilePath) {
|
|
77
|
-
const importerFilePathAbsolute = importerFilePath.filePathAbsoluteFilesystem;
|
|
78
|
-
assertPosixPath(importerFilePathAbsolute);
|
|
79
|
-
const cwd = path.posix.dirname(importerFilePathAbsolute);
|
|
80
|
-
// We can't use import.meta.resolve() as of Junary 2023 (and probably for a lot longer)
|
|
81
|
-
// https://stackoverflow.com/questions/54977743/do-require-resolve-for-es-modules#comment137174954_62272600:~:text=But%20the%20argument%20parent%20(aka%20cwd)%20still%20requires%20a%20flag
|
|
82
|
-
// filePathAbsoluteFilesystem is expected to be null when importData.importPath is a Vite path alias
|
|
83
|
-
const filePathAbsoluteFilesystem = requireResolve(importData.importPath, cwd);
|
|
84
|
-
return filePathAbsoluteFilesystem;
|
|
85
|
-
}
|
|
86
|
-
function assertImportPath(filePathAbsoluteFilesystem, importData, importerFilePath) {
|
|
87
|
-
const { importPath: importPath, importStringWasGenerated, importString } = importData;
|
|
88
|
-
const { filePathToShowToUser } = importerFilePath;
|
|
89
|
-
if (!filePathAbsoluteFilesystem) {
|
|
90
|
-
const importPathString = pc.cyan(`'${importPath}'`);
|
|
91
|
-
const errIntro = importStringWasGenerated
|
|
92
|
-
? `The import path ${importPathString} in ${filePathToShowToUser}`
|
|
93
|
-
: `The import ${pc.cyan(importString)} defined in ${filePathToShowToUser}`;
|
|
94
|
-
const errIntro2 = `${errIntro} couldn't be resolved: does ${importPathString}`;
|
|
95
|
-
if (importPath.startsWith('.')) {
|
|
96
|
-
assertUsage(false, `${errIntro2} point to an existing file?`);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
assertUsage(false, `${errIntro2} exist?`);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function assertFileEnv(filePathForEnvCheck, configEnv, configName) {
|
|
104
|
-
assertPosixPath(filePathForEnvCheck);
|
|
105
|
-
if (!filesEnvMap.has(filePathForEnvCheck)) {
|
|
106
|
-
filesEnvMap.set(filePathForEnvCheck, []);
|
|
107
|
-
}
|
|
108
|
-
const fileEnv = filesEnvMap.get(filePathForEnvCheck);
|
|
109
|
-
fileEnv.push({ configEnv, configName });
|
|
110
|
-
const configDifferentEnv = fileEnv.filter((c) => !deepEqual(c.configEnv, configEnv))[0];
|
|
111
|
-
if (configDifferentEnv) {
|
|
112
|
-
assertUsage(false, [
|
|
113
|
-
`${filePathForEnvCheck} defines the value of configs living in different environments:`,
|
|
114
|
-
...[configDifferentEnv, { configName, configEnv }].map((c) => ` - config ${pc.cyan(c.configName)} which value lives in environment ${pc.cyan(JSON.stringify(c.configEnv))}`),
|
|
115
|
-
'Defining config values in the same file is allowed only if they live in the same environment, see https://vike.dev/config#pointer-imports'
|
|
116
|
-
].join('\n'));
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function clearFilesEnvMap() {
|
|
120
|
-
filesEnvMap.clear();
|
|
121
|
-
}
|
|
122
|
-
function getVitePathFromAbsolutePath(filePathAbsoluteFilesystem, root) {
|
|
123
|
-
assertPosixPath(filePathAbsoluteFilesystem);
|
|
124
|
-
assertPosixPath(root);
|
|
125
|
-
assert(filePathAbsoluteFilesystem.startsWith(root));
|
|
126
|
-
let vitePath = path.posix.relative(root, filePathAbsoluteFilesystem);
|
|
127
|
-
assert(!vitePath.startsWith('/') && !vitePath.startsWith('.'));
|
|
128
|
-
vitePath = '/' + vitePath;
|
|
129
|
-
return vitePath;
|
|
130
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { getConfigDefinedAtString };
|
|
2
|
-
export { getDefinedAtString };
|
|
3
|
-
import type { DefinedAt } from '../PageConfig.js';
|
|
4
|
-
declare function getConfigDefinedAtString<ConfigName extends string, SentenceBegin extends 'Config' | 'config'>(sentenceBegin: SentenceBegin, configName: ConfigName, { definedAt }: {
|
|
5
|
-
definedAt: DefinedAt;
|
|
6
|
-
}): `${SentenceBegin} ${ConfigName}${string} defined ${'internally' | `at ${string}`}`;
|
|
7
|
-
declare function getDefinedAtString(definedAt: DefinedAt, configName: string): string;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export { getConfigDefinedAtString };
|
|
2
|
-
export { getDefinedAtString };
|
|
3
|
-
import { assert } from '../../utils.js';
|
|
4
|
-
import pc from '@brillout/picocolors';
|
|
5
|
-
import { getExportPath } from '../getExportPath.js';
|
|
6
|
-
function getConfigDefinedAtString(sentenceBegin, configName, { definedAt }) {
|
|
7
|
-
const definedAtString = getDefinedAtString(definedAt, configName);
|
|
8
|
-
const definedAtStr = definedAtString === 'internally' ? definedAtString : `at ${definedAtString}`;
|
|
9
|
-
let configNameStr = `${configName}${ /*sentenceBegin === 'Hook' ? '()' :*/''}`;
|
|
10
|
-
const configDefinedAt = `${sentenceBegin} ${pc.cyan(configNameStr)} defined ${definedAtStr}`;
|
|
11
|
-
return configDefinedAt;
|
|
12
|
-
}
|
|
13
|
-
function getDefinedAtString(definedAt, configName) {
|
|
14
|
-
if ('isComputed' in definedAt) {
|
|
15
|
-
return 'internally';
|
|
16
|
-
}
|
|
17
|
-
let files;
|
|
18
|
-
if ('files' in definedAt) {
|
|
19
|
-
files = definedAt.files;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
files = [definedAt];
|
|
23
|
-
}
|
|
24
|
-
assert(files.length >= 1);
|
|
25
|
-
const definedAtString = files
|
|
26
|
-
.map((source) => {
|
|
27
|
-
const { filePathToShowToUser, fileExportPathToShowToUser } = source;
|
|
28
|
-
let s = filePathToShowToUser;
|
|
29
|
-
const exportPath = getExportPath(fileExportPathToShowToUser, configName);
|
|
30
|
-
if (exportPath) {
|
|
31
|
-
s = `${s} > ${pc.cyan(exportPath)}`;
|
|
32
|
-
}
|
|
33
|
-
return s;
|
|
34
|
-
})
|
|
35
|
-
.join(' / ');
|
|
36
|
-
return definedAtString;
|
|
37
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { assertPathIsFilesystemAbsolute };
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { assert } from './assert.js';
|
|
4
|
-
import { assertPosixPath } from './filesystemPathHandling.js';
|
|
5
|
-
/** Assert path is absolute from the filesystem root */
|
|
6
|
-
function assertPathIsFilesystemAbsolute(p) {
|
|
7
|
-
assertPosixPath(p);
|
|
8
|
-
assert(!p.startsWith('/@fs/'));
|
|
9
|
-
if (process.platform !== 'win32') {
|
|
10
|
-
assert(p.startsWith('/'));
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
assert(path.win32.isAbsolute(p));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isStringRecord(thing: unknown): thing is Record<string, string>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export { mergeCumulativeValues };
|
|
2
|
-
import { assert } from './assert.js';
|
|
3
|
-
function mergeCumulativeValues(values) {
|
|
4
|
-
if (values.length === 0)
|
|
5
|
-
return null;
|
|
6
|
-
if (values.every((v) => v instanceof Set)) {
|
|
7
|
-
return new Set(values
|
|
8
|
-
.map((v) => {
|
|
9
|
-
assert(v instanceof Set);
|
|
10
|
-
return [...v];
|
|
11
|
-
})
|
|
12
|
-
.flat());
|
|
13
|
-
}
|
|
14
|
-
if (values.every((v) => Array.isArray(v))) {
|
|
15
|
-
return values.flat();
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
}
|