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
|
@@ -25,12 +25,7 @@ function resolveRouteString(routeString, urlPathname) {
|
|
|
25
25
|
return '[^/]+';
|
|
26
26
|
}
|
|
27
27
|
if (segment.glob) {
|
|
28
|
-
|
|
29
|
-
return '|/.*';
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
return '.*';
|
|
33
|
-
}
|
|
28
|
+
return '.*';
|
|
34
29
|
}
|
|
35
30
|
// segment.static
|
|
36
31
|
return escapeRegex(segment.static);
|
|
@@ -60,8 +55,6 @@ function resolveRouteString(routeString, urlPathname) {
|
|
|
60
55
|
}
|
|
61
56
|
if (segment.glob) {
|
|
62
57
|
const param = `*${hasMultipleGlobs ? ++globIdx : ''}`;
|
|
63
|
-
if (segment.isLastDir)
|
|
64
|
-
val = val.slice(1);
|
|
65
58
|
routeParams[param] = val;
|
|
66
59
|
}
|
|
67
60
|
});
|
|
@@ -80,21 +73,17 @@ function parseRouteString(routeString) {
|
|
|
80
73
|
};
|
|
81
74
|
const parts = routeString.split('/');
|
|
82
75
|
parts.forEach((s, i) => {
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
if (i !== 0)
|
|
77
|
+
pushStatic('/');
|
|
85
78
|
if (isParam(s)) {
|
|
86
79
|
assertWarning(!s.startsWith(PARAM_TOKEN_OLD), `Outdated Route String ${highlight(routeString)}, use ${highlight(routeString.split(PARAM_TOKEN_OLD).join(PARAM_TOKEN_NEW))} instead`, { onlyOnce: true });
|
|
87
|
-
if (!isFirst)
|
|
88
|
-
pushStatic('/');
|
|
89
80
|
segments.push({ param: s.slice(1) });
|
|
90
81
|
}
|
|
91
82
|
else {
|
|
92
|
-
if (s === '*' &&
|
|
93
|
-
segments.push({ glob: true
|
|
83
|
+
if (s === '*' && i === parts.length - 1 && routeString !== '*' && routeString !== '/*') {
|
|
84
|
+
segments.push({ glob: true });
|
|
94
85
|
}
|
|
95
86
|
else {
|
|
96
|
-
if (!isFirst)
|
|
97
|
-
pushStatic('/');
|
|
98
87
|
s.split('*').forEach((s, i) => {
|
|
99
88
|
if (i !== 0)
|
|
100
89
|
segments.push({ glob: true });
|
|
@@ -6,7 +6,6 @@ export * from '../../utils/isPromise.js';
|
|
|
6
6
|
export * from '../../utils/isPlainObject.js';
|
|
7
7
|
export * from '../../utils/objectAssign.js';
|
|
8
8
|
export * from '../../utils/slice.js';
|
|
9
|
-
export * from '../../utils/isStringRecord.js';
|
|
10
9
|
export * from '../../utils/unique.js';
|
|
11
10
|
export * from '../../utils/isBrowser.js';
|
|
12
11
|
export * from '../../utils/parseUrl.js';
|
|
@@ -15,7 +15,6 @@ export * from '../../utils/isPromise.js';
|
|
|
15
15
|
export * from '../../utils/isPlainObject.js';
|
|
16
16
|
export * from '../../utils/objectAssign.js';
|
|
17
17
|
export * from '../../utils/slice.js';
|
|
18
|
-
export * from '../../utils/isStringRecord.js';
|
|
19
18
|
export * from '../../utils/unique.js';
|
|
20
19
|
export * from '../../utils/isBrowser.js';
|
|
21
20
|
export * from '../../utils/parseUrl.js';
|
package/dist/esm/shared/utils.js
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { assertPathFilesystemAbsolute };
|
|
2
|
+
export { isPathFilesystemAbsolute };
|
|
3
|
+
/** Assert path is absolute starting from the filesystem root. */
|
|
4
|
+
declare function assertPathFilesystemAbsolute(p: string): void;
|
|
5
|
+
/** Whether path is absolute starting from the filesystem root. Isn't reliable for Linux users: isPathFilesystemAbsolute() returns `true` for paths absolute from the user root dir. */
|
|
6
|
+
declare function isPathFilesystemAbsolute(p: string): boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { assertPathFilesystemAbsolute };
|
|
2
|
+
export { isPathFilesystemAbsolute };
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { assert } from './assert.js';
|
|
5
|
+
import { assertPosixPath } from './filesystemPathHandling.js';
|
|
6
|
+
/** Assert path is absolute starting from the filesystem root. */
|
|
7
|
+
function assertPathFilesystemAbsolute(p) {
|
|
8
|
+
// The assert is "eventually reliable":
|
|
9
|
+
// - For Windows users, the assert is correct.
|
|
10
|
+
// - For Linux users assertPathFilesystemAbsolute() will erroneously succeed if `p` is a path absolute from the user root dir.
|
|
11
|
+
// - But that's okay because the assertion will eventually fail for Windows users.
|
|
12
|
+
assert(isPathFilesystemAbsolute(p));
|
|
13
|
+
}
|
|
14
|
+
/** Whether path is absolute starting from the filesystem root. Isn't reliable for Linux users: isPathFilesystemAbsolute() returns `true` for paths absolute from the user root dir. */
|
|
15
|
+
function isPathFilesystemAbsolute(p) {
|
|
16
|
+
assertPosixPath(p);
|
|
17
|
+
assert(!p.startsWith('/@fs/'));
|
|
18
|
+
if (process.platform !== 'win32') {
|
|
19
|
+
// - For linux users, there doesn't seem to be a reliable way to distinguish between:
|
|
20
|
+
// - File path absolute starting from filesystem root, e.g. /home/rom/code/my-app/pages/about/+Page.js
|
|
21
|
+
// - File path absolute starting from user root dir (Vite's `config.root`), e.g. /pages/about/+Page.js
|
|
22
|
+
// - Checking whether `p` starts with the first directory of process.cwd() (or `userRootDir`) can be erroneous, most notably when using docker: https://github.com/vikejs/vike/issues/703
|
|
23
|
+
// - Using require.resolve() would be a solution but probably too slow?
|
|
24
|
+
return p.startsWith('/');
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const yes = path.win32.isAbsolute(p);
|
|
28
|
+
// Ensure isPathFilesystemAbsolute() returns `false` if path is absolute starting from the user root dir (see comments above).
|
|
29
|
+
if (yes)
|
|
30
|
+
assert(!p.startsWith('/'));
|
|
31
|
+
return yes;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
export { createErrorWithCleanStackTrace };
|
|
2
2
|
import { isNodeJS } from './isNodeJS.js';
|
|
3
3
|
function createErrorWithCleanStackTrace(errorMessage, numberOfStackTraceLinesToRemove) {
|
|
4
|
-
|
|
5
|
-
{
|
|
6
|
-
var stackTraceLimit__original = Error.stackTraceLimit;
|
|
7
|
-
Error.stackTraceLimit = Infinity;
|
|
8
|
-
err = new Error(errorMessage);
|
|
9
|
-
Error.stackTraceLimit = stackTraceLimit__original;
|
|
10
|
-
}
|
|
4
|
+
const err = new Error(errorMessage);
|
|
11
5
|
if (isNodeJS()) {
|
|
12
6
|
err.stack = clean(err.stack, numberOfStackTraceLinesToRemove);
|
|
13
7
|
}
|
package/dist/esm/utils/debug.js
CHANGED
|
@@ -7,6 +7,7 @@ import { assert, assertUsage } from './assert.js';
|
|
|
7
7
|
import { checkType } from './checkType.js';
|
|
8
8
|
import { getTerminalWidth } from './getTerminWidth.js';
|
|
9
9
|
import pc from '@brillout/picocolors';
|
|
10
|
+
import { isArray } from './isArray.js';
|
|
10
11
|
// Avoid this to be loaded in the browser. For isomorphic code: instead of `import { createDebugger } from './utils.js'`, use `globalThis.createDebugger()`.
|
|
11
12
|
assert(!isBrowser());
|
|
12
13
|
globalThis.__brillout_debug_createDebugger = createDebugger;
|
|
@@ -81,7 +82,7 @@ function formatMsg(info, options, padding, position) {
|
|
|
81
82
|
if (typeof info === 'string') {
|
|
82
83
|
str += info;
|
|
83
84
|
}
|
|
84
|
-
else if (
|
|
85
|
+
else if (isArray(info)) {
|
|
85
86
|
if (info.length === 0) {
|
|
86
87
|
str += options.serialization?.emptyArray ?? '[]';
|
|
87
88
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { findFile };
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import fs from 'fs';
|
|
4
|
+
import { isArray } from './isArray.js';
|
|
4
5
|
function findFile(arg, cwd) {
|
|
5
|
-
const filenames =
|
|
6
|
+
const filenames = isArray(arg) ? arg : [arg];
|
|
6
7
|
let dir = cwd;
|
|
7
8
|
while (true) {
|
|
8
9
|
for (const filename of filenames) {
|
|
@@ -5,6 +5,7 @@ declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectTy
|
|
|
5
5
|
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'object'): obj is ObjectType & Record<PropName, Record<string, unknown>>;
|
|
6
6
|
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'array'): obj is ObjectType & Record<PropName, unknown[]>;
|
|
7
7
|
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'string[]'): obj is ObjectType & Record<PropName, string[]>;
|
|
8
|
+
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'string{}'): obj is ObjectType & Record<PropName, Record<string, string>>;
|
|
8
9
|
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'function'): obj is ObjectType & Record<PropName, (...args: any[]) => unknown>;
|
|
9
10
|
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'undefined'): obj is ObjectType & Record<PropName, undefined>;
|
|
10
11
|
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'null'): obj is ObjectType & Record<PropName, null>;
|
|
@@ -3,8 +3,9 @@ export { hasProp };
|
|
|
3
3
|
// - https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABDAzgFQJ4AcCmdgAUAbgIYA2IOAXIiWBgDSJTbWIDkARnHGTnewCUNUhRzIUibr35gA3AFgAUKEiwEEzLnzFylGnUbNWNdmBABbTjgBOQkXvGpE5q7cUrw0eElRa8hKL6tPRMLLimKFA2MGAA5vaIQU6SUTHxHqreGn6sOskGocYRHOAA1mBwAO5gickSiOWVNZle6r7oeYGOhUbhbGmxcYgAvKVgFdW1wlI8fHSIAN7KiMiExeIjW+OTNeyIgksrq4g2OFAgNkjRlMcAvsdnF1cb+EmOo9v9Hg9KyhAIKK0GhNKajRAAFgATMplCQUChbFACLltIQSEwzJZrHZBIJ-oCZAA6MhwOIEEj4v6eNQ+WgIpEEAFgAAmMHaIImzTAM3hiJsUEkzLZ7SOShOa0QTIQIp8hyelzAx1WUAAFjZqi4cFVEABRGwamwEdgAQQZArpADESDAyEJlHcgA
|
|
4
4
|
import { isCallable } from './isCallable.js';
|
|
5
5
|
import { isObject } from './isObject.js';
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { isArrayOfStrings } from './isArrayOfStrings.js';
|
|
7
|
+
import { isObjectOfStrings } from './isObjectOfStrings.js';
|
|
8
|
+
import { isArray } from './isArray.js';
|
|
8
9
|
function hasProp(obj, prop, type = 'unknown') {
|
|
9
10
|
if (!isObject(obj))
|
|
10
11
|
return false;
|
|
@@ -16,18 +17,21 @@ function hasProp(obj, prop, type = 'unknown') {
|
|
|
16
17
|
}
|
|
17
18
|
const propValue = obj[prop];
|
|
18
19
|
if (type === 'array') {
|
|
19
|
-
return
|
|
20
|
+
return isArray(propValue);
|
|
20
21
|
}
|
|
21
22
|
if (type === 'object') {
|
|
22
23
|
return isObject(propValue);
|
|
23
24
|
}
|
|
24
25
|
if (type === 'string[]') {
|
|
25
|
-
return
|
|
26
|
+
return isArrayOfStrings(propValue);
|
|
27
|
+
}
|
|
28
|
+
if (type === 'string{}') {
|
|
29
|
+
return isObjectOfStrings(propValue);
|
|
26
30
|
}
|
|
27
31
|
if (type === 'function') {
|
|
28
32
|
return isCallable(propValue);
|
|
29
33
|
}
|
|
30
|
-
if (
|
|
34
|
+
if (isArray(type)) {
|
|
31
35
|
return typeof propValue === 'string' && type.includes(propValue);
|
|
32
36
|
}
|
|
33
37
|
if (type === 'null') {
|
|
@@ -2,6 +2,7 @@ export { injectRollupInputs };
|
|
|
2
2
|
export { normalizeRollupInput };
|
|
3
3
|
import { assert } from './assert.js';
|
|
4
4
|
import { isObject } from './isObject.js';
|
|
5
|
+
import { isArray } from './isArray.js';
|
|
5
6
|
function injectRollupInputs(inputsNew, config) {
|
|
6
7
|
const inputsCurrent = normalizeRollupInput(config.build.rollupOptions.input);
|
|
7
8
|
const input = {
|
|
@@ -18,7 +19,7 @@ function normalizeRollupInput(input) {
|
|
|
18
19
|
if (typeof input === 'string') {
|
|
19
20
|
input = [input];
|
|
20
21
|
}
|
|
21
|
-
if (
|
|
22
|
+
if (isArray(input)) {
|
|
22
23
|
return Object.fromEntries(input.map((input) => [input, input]));
|
|
23
24
|
}
|
|
24
25
|
assert(isObject(input));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isArray(value: unknown): value is unknown[];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { isDev1 };
|
|
2
2
|
export { isDev1_onConfigureServer };
|
|
3
3
|
export { isDev2 };
|
|
4
|
+
export { isDev3 };
|
|
5
|
+
import type { ConfigEnv } from 'vite';
|
|
6
|
+
declare function isDev3(configEnv: ConfigEnv): null | boolean;
|
|
4
7
|
declare function isDev1(): boolean;
|
|
5
8
|
declare function isDev1_onConfigureServer(): void | undefined;
|
|
6
9
|
import type { ResolvedConfig } from 'vite';
|
package/dist/esm/utils/isDev.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
export { isDev1 };
|
|
2
2
|
export { isDev1_onConfigureServer };
|
|
3
3
|
export { isDev2 };
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export { isDev3 };
|
|
5
|
+
function isDev3(configEnv) {
|
|
6
|
+
const { isPreview, command } = configEnv;
|
|
7
|
+
if (command !== 'serve')
|
|
8
|
+
return false;
|
|
9
|
+
if (typeof isPreview === 'boolean')
|
|
10
|
+
return !isPreview;
|
|
11
|
+
// isPreview is undefined in older Vite versions, see https://github.com/vitejs/vite/commit/93fce55
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
6
14
|
// ********
|
|
7
|
-
// Method 1 -
|
|
15
|
+
// Method 1 - reliable
|
|
8
16
|
// ********
|
|
9
17
|
import { assert } from './assert.js';
|
|
10
18
|
import { getGlobalObject } from './getGlobalObject.js';
|
|
@@ -22,7 +22,7 @@ function assertIsNpmPackageImport(str) {
|
|
|
22
22
|
assert(isNpmPackageImport(str, {
|
|
23
23
|
// If `str` is a path alias that looks like an npm package => assertIsNpmPackageImport() is erroneous but that's okay because the assertion will eventually fail for some other user using a disambiguated path alias.
|
|
24
24
|
cannotBePathAlias: true
|
|
25
|
-
}));
|
|
25
|
+
}), str);
|
|
26
26
|
}
|
|
27
27
|
function isNpmPackageName(str) {
|
|
28
28
|
const res = parse(str);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.169",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "tsc --watch",
|
|
6
6
|
"build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"build:cjs:ts": "tsc --project ./tsconfig.cjs.json",
|
|
10
10
|
"build:cjs:fixup": "node ./dist-cjs-fixup.mjs",
|
|
11
11
|
"release": "release-me patch",
|
|
12
|
+
"release:minor": "release-me minor",
|
|
12
13
|
"release:commit": "release-me commit"
|
|
13
14
|
},
|
|
14
15
|
"dependencies": {
|
|
@@ -194,7 +195,7 @@
|
|
|
194
195
|
"fast-glob": "^3.3.2",
|
|
195
196
|
"sirv": "^2.0.4",
|
|
196
197
|
"source-map-support": "^0.5.21",
|
|
197
|
-
"@brillout/release-me": "^0.
|
|
198
|
+
"@brillout/release-me": "^0.2.2",
|
|
198
199
|
"@types/estree": "^1.0.5",
|
|
199
200
|
"@types/jest": "^29.5.11",
|
|
200
201
|
"@types/node": "^20.10.5",
|
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.clearFilesEnvMap = exports.assertImportPath = exports.resolveImportPath = exports.resolveImport = void 0;
|
|
7
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
8
|
-
const utils_js_1 = require("../../../../utils.js");
|
|
9
|
-
const transformFileImports_js_1 = require("./transformFileImports.js");
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const getFilePath_js_1 = require("../../../../shared/getFilePath.js");
|
|
12
|
-
const filesEnvMap = new Map();
|
|
13
|
-
function resolveImport(configValue, importerFilePath, userRootDir, configEnv, configName) {
|
|
14
|
-
if (typeof configValue !== 'string')
|
|
15
|
-
return null;
|
|
16
|
-
const importData = (0, transformFileImports_js_1.parseImportData)(configValue);
|
|
17
|
-
if (!importData)
|
|
18
|
-
return null;
|
|
19
|
-
const { importPath, exportName } = importData;
|
|
20
|
-
const filePathAbsoluteFilesystem = resolveImportPath(importData, importerFilePath);
|
|
21
|
-
assertFileEnv(filePathAbsoluteFilesystem ?? importPath, configEnv, configName);
|
|
22
|
-
const fileExportPathToShowToUser = exportName === 'default' || exportName === configName ? [] : [exportName];
|
|
23
|
-
let filePath;
|
|
24
|
-
if (importPath.startsWith('.')) {
|
|
25
|
-
// We need to resolve relative paths into absolute paths. Because the import paths are included in virtual files:
|
|
26
|
-
// ```
|
|
27
|
-
// [vite] Internal server error: Failed to resolve import "./onPageTransitionHooks" from "virtual:vike:pageConfigValuesAll:client:/pages/index". Does the file exist?
|
|
28
|
-
// ```
|
|
29
|
-
assertImportPath(filePathAbsoluteFilesystem, importData, importerFilePath);
|
|
30
|
-
const filePathAbsoluteUserRootDir = resolveImportPath_absoluteUserRootDir(filePathAbsoluteFilesystem, importData, importerFilePath, userRootDir);
|
|
31
|
-
filePath = (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir });
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
// importPath can be:
|
|
35
|
-
// - an npm package import
|
|
36
|
-
// - a path alias
|
|
37
|
-
if (filePathAbsoluteFilesystem) {
|
|
38
|
-
filePath = (0, getFilePath_js_1.getFilePathResolved)({
|
|
39
|
-
userRootDir,
|
|
40
|
-
filePathAbsoluteFilesystem,
|
|
41
|
-
importPathAbsolute: importPath
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
filePath = (0, getFilePath_js_1.getFilePathUnresolved)({
|
|
46
|
-
importPathAbsolute: importPath
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
...filePath,
|
|
52
|
-
fileExportName: exportName,
|
|
53
|
-
fileExportPathToShowToUser
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
exports.resolveImport = resolveImport;
|
|
57
|
-
function resolveImportPath_absoluteUserRootDir(filePathAbsoluteFilesystem, importData, configFilePath, userRootDir) {
|
|
58
|
-
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
59
|
-
let filePathAbsoluteUserRootDir;
|
|
60
|
-
if (filePathAbsoluteFilesystem.startsWith(userRootDir)) {
|
|
61
|
-
filePathAbsoluteUserRootDir = getVitePathFromAbsolutePath(filePathAbsoluteFilesystem, userRootDir);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
(0, utils_js_1.assertUsage)(false, `${configFilePath.filePathToShowToUser} imports from a relative path ${picocolors_1.default.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`);
|
|
65
|
-
// None of the following works. Seems to be a Vite bug?
|
|
66
|
-
// /*
|
|
67
|
-
// assert(filePathAbsoluteFilesystem.startsWith('/'))
|
|
68
|
-
// filePath = `/@fs${filePathAbsoluteFilesystem}`
|
|
69
|
-
// /*/
|
|
70
|
-
// filePathAbsoluteUserRootDir = path.posix.relative(userRootDir, filePathAbsoluteFilesystem)
|
|
71
|
-
// assert(filePathAbsoluteUserRootDir.startsWith('../'))
|
|
72
|
-
// filePathAbsoluteUserRootDir = '/' + filePathAbsoluteUserRootDir
|
|
73
|
-
// //*/
|
|
74
|
-
}
|
|
75
|
-
(0, utils_js_1.assertPosixPath)(filePathAbsoluteUserRootDir);
|
|
76
|
-
(0, utils_js_1.assert)(filePathAbsoluteUserRootDir.startsWith('/'));
|
|
77
|
-
return filePathAbsoluteUserRootDir;
|
|
78
|
-
}
|
|
79
|
-
function resolveImportPath(importData, importerFilePath) {
|
|
80
|
-
const importerFilePathAbsolute = importerFilePath.filePathAbsoluteFilesystem;
|
|
81
|
-
(0, utils_js_1.assertPosixPath)(importerFilePathAbsolute);
|
|
82
|
-
const cwd = path_1.default.posix.dirname(importerFilePathAbsolute);
|
|
83
|
-
// We can't use import.meta.resolve() as of Junary 2023 (and probably for a lot longer)
|
|
84
|
-
// 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
|
|
85
|
-
// filePathAbsoluteFilesystem is expected to be null when importData.importPath is a Vite path alias
|
|
86
|
-
const filePathAbsoluteFilesystem = (0, utils_js_1.requireResolve)(importData.importPath, cwd);
|
|
87
|
-
return filePathAbsoluteFilesystem;
|
|
88
|
-
}
|
|
89
|
-
exports.resolveImportPath = resolveImportPath;
|
|
90
|
-
function assertImportPath(filePathAbsoluteFilesystem, importData, importerFilePath) {
|
|
91
|
-
const { importPath: importPath, importStringWasGenerated, importString } = importData;
|
|
92
|
-
const { filePathToShowToUser } = importerFilePath;
|
|
93
|
-
if (!filePathAbsoluteFilesystem) {
|
|
94
|
-
const importPathString = picocolors_1.default.cyan(`'${importPath}'`);
|
|
95
|
-
const errIntro = importStringWasGenerated
|
|
96
|
-
? `The import path ${importPathString} in ${filePathToShowToUser}`
|
|
97
|
-
: `The import ${picocolors_1.default.cyan(importString)} defined in ${filePathToShowToUser}`;
|
|
98
|
-
const errIntro2 = `${errIntro} couldn't be resolved: does ${importPathString}`;
|
|
99
|
-
if (importPath.startsWith('.')) {
|
|
100
|
-
(0, utils_js_1.assertUsage)(false, `${errIntro2} point to an existing file?`);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
(0, utils_js_1.assertUsage)(false, `${errIntro2} exist?`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.assertImportPath = assertImportPath;
|
|
108
|
-
function assertFileEnv(filePathForEnvCheck, configEnv, configName) {
|
|
109
|
-
(0, utils_js_1.assertPosixPath)(filePathForEnvCheck);
|
|
110
|
-
if (!filesEnvMap.has(filePathForEnvCheck)) {
|
|
111
|
-
filesEnvMap.set(filePathForEnvCheck, []);
|
|
112
|
-
}
|
|
113
|
-
const fileEnv = filesEnvMap.get(filePathForEnvCheck);
|
|
114
|
-
fileEnv.push({ configEnv, configName });
|
|
115
|
-
const configDifferentEnv = fileEnv.filter((c) => !(0, utils_js_1.deepEqual)(c.configEnv, configEnv))[0];
|
|
116
|
-
if (configDifferentEnv) {
|
|
117
|
-
(0, utils_js_1.assertUsage)(false, [
|
|
118
|
-
`${filePathForEnvCheck} defines the value of configs living in different environments:`,
|
|
119
|
-
...[configDifferentEnv, { configName, configEnv }].map((c) => ` - config ${picocolors_1.default.cyan(c.configName)} which value lives in environment ${picocolors_1.default.cyan(JSON.stringify(c.configEnv))}`),
|
|
120
|
-
'Defining config values in the same file is allowed only if they live in the same environment, see https://vike.dev/config#pointer-imports'
|
|
121
|
-
].join('\n'));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function clearFilesEnvMap() {
|
|
125
|
-
filesEnvMap.clear();
|
|
126
|
-
}
|
|
127
|
-
exports.clearFilesEnvMap = clearFilesEnvMap;
|
|
128
|
-
function getVitePathFromAbsolutePath(filePathAbsoluteFilesystem, root) {
|
|
129
|
-
(0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
|
|
130
|
-
(0, utils_js_1.assertPosixPath)(root);
|
|
131
|
-
(0, utils_js_1.assert)(filePathAbsoluteFilesystem.startsWith(root));
|
|
132
|
-
let vitePath = path_1.default.posix.relative(root, filePathAbsoluteFilesystem);
|
|
133
|
-
(0, utils_js_1.assert)(!vitePath.startsWith('/') && !vitePath.startsWith('.'));
|
|
134
|
-
vitePath = '/' + vitePath;
|
|
135
|
-
return vitePath;
|
|
136
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getDefinedAtString = exports.getConfigDefinedAtString = void 0;
|
|
7
|
-
const utils_js_1 = require("../../utils.js");
|
|
8
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
9
|
-
const getExportPath_js_1 = require("../getExportPath.js");
|
|
10
|
-
function getConfigDefinedAtString(sentenceBegin, configName, { definedAt }) {
|
|
11
|
-
const definedAtString = getDefinedAtString(definedAt, configName);
|
|
12
|
-
const definedAtStr = definedAtString === 'internally' ? definedAtString : `at ${definedAtString}`;
|
|
13
|
-
let configNameStr = `${configName}${ /*sentenceBegin === 'Hook' ? '()' :*/''}`;
|
|
14
|
-
const configDefinedAt = `${sentenceBegin} ${picocolors_1.default.cyan(configNameStr)} defined ${definedAtStr}`;
|
|
15
|
-
return configDefinedAt;
|
|
16
|
-
}
|
|
17
|
-
exports.getConfigDefinedAtString = getConfigDefinedAtString;
|
|
18
|
-
function getDefinedAtString(definedAt, configName) {
|
|
19
|
-
if ('isComputed' in definedAt) {
|
|
20
|
-
return 'internally';
|
|
21
|
-
}
|
|
22
|
-
let files;
|
|
23
|
-
if ('files' in definedAt) {
|
|
24
|
-
files = definedAt.files;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
files = [definedAt];
|
|
28
|
-
}
|
|
29
|
-
(0, utils_js_1.assert)(files.length >= 1);
|
|
30
|
-
const definedAtString = files
|
|
31
|
-
.map((source) => {
|
|
32
|
-
const { filePathToShowToUser, fileExportPathToShowToUser } = source;
|
|
33
|
-
let s = filePathToShowToUser;
|
|
34
|
-
const exportPath = (0, getExportPath_js_1.getExportPath)(fileExportPathToShowToUser, configName);
|
|
35
|
-
if (exportPath) {
|
|
36
|
-
s = `${s} > ${picocolors_1.default.cyan(exportPath)}`;
|
|
37
|
-
}
|
|
38
|
-
return s;
|
|
39
|
-
})
|
|
40
|
-
.join(' / ');
|
|
41
|
-
return definedAtString;
|
|
42
|
-
}
|
|
43
|
-
exports.getDefinedAtString = getDefinedAtString;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.assertPathIsFilesystemAbsolute = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const assert_js_1 = require("./assert.js");
|
|
9
|
-
const filesystemPathHandling_js_1 = require("./filesystemPathHandling.js");
|
|
10
|
-
/** Assert path is absolute from the filesystem root */
|
|
11
|
-
function assertPathIsFilesystemAbsolute(p) {
|
|
12
|
-
(0, filesystemPathHandling_js_1.assertPosixPath)(p);
|
|
13
|
-
(0, assert_js_1.assert)(!p.startsWith('/@fs/'));
|
|
14
|
-
if (process.platform !== 'win32') {
|
|
15
|
-
(0, assert_js_1.assert)(p.startsWith('/'));
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
(0, assert_js_1.assert)(path_1.default.win32.isAbsolute(p));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.assertPathIsFilesystemAbsolute = assertPathIsFilesystemAbsolute;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isStringRecord = void 0;
|
|
4
|
-
function isStringRecord(thing) {
|
|
5
|
-
return typeof thing === 'object' && thing !== null && Object.values(thing).every((val) => typeof val === 'string');
|
|
6
|
-
}
|
|
7
|
-
exports.isStringRecord = isStringRecord;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeCumulativeValues = void 0;
|
|
4
|
-
const assert_js_1 = require("./assert.js");
|
|
5
|
-
function mergeCumulativeValues(values) {
|
|
6
|
-
if (values.length === 0)
|
|
7
|
-
return null;
|
|
8
|
-
if (values.every((v) => v instanceof Set)) {
|
|
9
|
-
return new Set(values
|
|
10
|
-
.map((v) => {
|
|
11
|
-
(0, assert_js_1.assert)(v instanceof Set);
|
|
12
|
-
return [...v];
|
|
13
|
-
})
|
|
14
|
-
.flat());
|
|
15
|
-
}
|
|
16
|
-
if (values.every((v) => Array.isArray(v))) {
|
|
17
|
-
return values.flat();
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
exports.mergeCumulativeValues = mergeCumulativeValues;
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { resolveImport };
|
|
2
|
-
export { resolveImportPath };
|
|
3
|
-
export { assertImportPath };
|
|
4
|
-
export { clearFilesEnvMap };
|
|
5
|
-
import type { ConfigEnvInternal, DefinedAtFileFullInfo } from '../../../../../../shared/page-configs/PageConfig.js';
|
|
6
|
-
import { type ImportData } from './transformFileImports.js';
|
|
7
|
-
import type { FilePathResolved } from '../../../../../../shared/page-configs/FilePath.js';
|
|
8
|
-
declare function resolveImport(configValue: unknown, importerFilePath: FilePathResolved, userRootDir: string, configEnv: ConfigEnvInternal, configName: string): null | (DefinedAtFileFullInfo & {
|
|
9
|
-
fileExportName: string;
|
|
10
|
-
});
|
|
11
|
-
declare function resolveImportPath(importData: ImportData, importerFilePath: FilePathResolved): string | null;
|
|
12
|
-
declare function assertImportPath(filePathAbsoluteFilesystem: string | null, importData: ImportData, importerFilePath: FilePathResolved): asserts filePathAbsoluteFilesystem is string;
|
|
13
|
-
declare function clearFilesEnvMap(): void;
|