vike 0.4.161-commit-b829fee → 0.4.162-commit-49fe40c
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/__internal/index.js +2 -2
- package/dist/cjs/node/plugin/index.js +0 -2
- package/dist/cjs/node/plugin/plugins/buildConfig.js +1 -0
- package/dist/cjs/node/plugin/plugins/config/index.js +2 -7
- package/dist/cjs/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -8
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -18
- package/dist/cjs/node/plugin/plugins/devConfig/index.js +2 -4
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +0 -19
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +8 -8
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getConfigValuesSerialized.js +1 -9
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +3 -0
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +4 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js +35 -36
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +109 -104
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +36 -32
- package/dist/cjs/node/plugin/utils.js +0 -1
- package/dist/cjs/node/prerender/runPrerender.js +2 -2
- package/dist/cjs/node/prerender/utils.js +1 -1
- package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +1 -0
- package/dist/cjs/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +2 -3
- package/dist/cjs/node/runtime/utils.js +1 -2
- package/dist/cjs/node/shared/virtual-files/virtualFileImportUserCode.js +1 -0
- package/dist/cjs/shared/hooks/getHook.js +1 -1
- package/dist/cjs/shared/page-configs/helpers/getConfigValue.js +1 -0
- package/dist/cjs/shared/page-configs/serialize/parseConfigValuesImported.js +1 -1
- package/dist/cjs/shared/route/abort.js +1 -0
- package/dist/cjs/shared/route/resolvePrecedence.js +1 -0
- package/dist/cjs/utils/{nodeEnv.js → assertNodeEnv.js} +3 -0
- package/dist/cjs/utils/formatHintLog.js +1 -0
- package/dist/cjs/utils/hasProp.js +1 -0
- package/dist/cjs/utils/isScriptFile.js +15 -4
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/__internal/index.js +1 -1
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +20 -14
- package/dist/esm/client/shared/getPageContextProxyForUser.js +19 -2
- package/dist/esm/client/shared/loadUserFilesClientSide.js +1 -0
- package/dist/esm/node/plugin/index.js +0 -2
- package/dist/esm/node/plugin/plugins/buildConfig.js +1 -0
- package/dist/esm/node/plugin/plugins/config/index.js +2 -7
- package/dist/esm/node/plugin/plugins/devConfig/determineFsAllowList.d.ts +1 -2
- package/dist/esm/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -8
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.d.ts +1 -2
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +2 -19
- package/dist/esm/node/plugin/plugins/devConfig/index.js +2 -4
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +0 -19
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +8 -8
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getConfigValuesSerialized.js +1 -9
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +3 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +4 -4
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.d.ts +1 -13
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js +35 -36
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +111 -106
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +2 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +36 -32
- package/dist/esm/node/plugin/utils.d.ts +0 -1
- package/dist/esm/node/plugin/utils.js +0 -1
- package/dist/esm/node/prerender/runPrerender.d.ts +3 -3
- package/dist/esm/node/prerender/runPrerender.js +2 -2
- package/dist/esm/node/prerender/utils.d.ts +1 -1
- package/dist/esm/node/prerender/utils.js +1 -1
- package/dist/esm/node/runtime/html/serializePageContextClientSide.js +1 -0
- package/dist/esm/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +2 -3
- package/dist/esm/node/runtime/utils.d.ts +1 -2
- package/dist/esm/node/runtime/utils.js +1 -2
- package/dist/esm/node/shared/virtual-files/virtualFileImportUserCode.js +1 -0
- package/dist/esm/shared/ConfigVike.d.ts +0 -27
- package/dist/esm/shared/hooks/getHook.js +2 -2
- package/dist/esm/shared/page-configs/Config.d.ts +5 -0
- package/dist/esm/shared/page-configs/PageConfig.d.ts +1 -1
- package/dist/esm/shared/page-configs/helpers/getConfigValue.js +1 -0
- package/dist/esm/shared/page-configs/serialize/parseConfigValuesImported.js +1 -1
- package/dist/esm/shared/route/abort.js +1 -0
- package/dist/esm/shared/route/resolvePrecedence.js +1 -0
- package/dist/esm/utils/{nodeEnv.js → assertNodeEnv.js} +3 -0
- package/dist/esm/utils/debug.d.ts +1 -1
- package/dist/esm/utils/formatHintLog.js +1 -0
- package/dist/esm/utils/hasProp.js +1 -0
- package/dist/esm/utils/isScriptFile.d.ts +3 -1
- package/dist/esm/utils/isScriptFile.js +14 -3
- 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/config/findConfigVikeFromStemPackages.js +0 -27
- package/dist/cjs/node/plugin/plugins/config/resolveExtensions.js +0 -107
- package/dist/cjs/node/plugin/plugins/config/stemUtils.js +0 -85
- package/dist/cjs/node/plugin/plugins/extensionsAssets.js +0 -101
- package/dist/cjs/utils/getDependencyPackageJson.js +0 -91
- package/dist/cjs/utils/isStemPackageName.js +0 -14
- package/dist/esm/node/plugin/plugins/config/findConfigVikeFromStemPackages.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/config/findConfigVikeFromStemPackages.js +0 -24
- package/dist/esm/node/plugin/plugins/config/resolveExtensions.d.ts +0 -4
- package/dist/esm/node/plugin/plugins/config/resolveExtensions.js +0 -101
- package/dist/esm/node/plugin/plugins/config/stemUtils.d.ts +0 -8
- package/dist/esm/node/plugin/plugins/config/stemUtils.js +0 -79
- package/dist/esm/node/plugin/plugins/extensionsAssets.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/extensionsAssets.js +0 -95
- package/dist/esm/utils/getDependencyPackageJson.d.ts +0 -6
- package/dist/esm/utils/getDependencyPackageJson.js +0 -85
- package/dist/esm/utils/isStemPackageName.d.ts +0 -1
- package/dist/esm/utils/isStemPackageName.js +0 -10
- /package/dist/esm/utils/{nodeEnv.d.ts → assertNodeEnv.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scriptFileExtensionList = exports.scriptFileExtensions = exports.isTemplateFile = exports.isScriptFile = void 0;
|
|
3
|
+
exports.scriptFileExtensionList = exports.scriptFileExtensions = exports.isTemplateFile = exports.isJavaScriptFile = exports.isScriptFile = void 0;
|
|
4
4
|
const assert_js_1 = require("./assert.js");
|
|
5
5
|
// We can't use a RegExp:
|
|
6
6
|
// - Needs to work with Micromatch: https://github.com/micromatch/micromatch because:
|
|
@@ -12,6 +12,7 @@ const assert_js_1 = require("./assert.js");
|
|
|
12
12
|
// - We cannot implement a blacklist with a glob pattern.
|
|
13
13
|
// - A post `import.meta.glob()` blacklist filtering doesn't work because Vite would still process the files (e.g. including them in the bundle).
|
|
14
14
|
// prettier-ignore
|
|
15
|
+
// biome-ignore format:
|
|
15
16
|
const extJavaScript = [
|
|
16
17
|
'js',
|
|
17
18
|
'ts',
|
|
@@ -19,6 +20,10 @@ const extJavaScript = [
|
|
|
19
20
|
'cts',
|
|
20
21
|
'mjs',
|
|
21
22
|
'mts',
|
|
23
|
+
];
|
|
24
|
+
// prettier-ignore
|
|
25
|
+
// biome-ignore format:
|
|
26
|
+
const extJsx = [
|
|
22
27
|
'jsx',
|
|
23
28
|
'tsx',
|
|
24
29
|
'cjsx',
|
|
@@ -27,6 +32,7 @@ const extJavaScript = [
|
|
|
27
32
|
'mtsx',
|
|
28
33
|
];
|
|
29
34
|
// prettier-ignore
|
|
35
|
+
// biome-ignore format:
|
|
30
36
|
const extTemplates = [
|
|
31
37
|
'vue',
|
|
32
38
|
'svelte',
|
|
@@ -34,19 +40,24 @@ const extTemplates = [
|
|
|
34
40
|
'md',
|
|
35
41
|
'mdx'
|
|
36
42
|
];
|
|
37
|
-
const scriptFileExtensionList = [...extJavaScript, ...extTemplates];
|
|
43
|
+
const scriptFileExtensionList = [...extJavaScript, ...extJsx, ...extTemplates];
|
|
38
44
|
exports.scriptFileExtensionList = scriptFileExtensionList;
|
|
39
45
|
const scriptFileExtensions = '(' + scriptFileExtensionList.join('|') + ')';
|
|
40
46
|
exports.scriptFileExtensions = scriptFileExtensions;
|
|
41
47
|
function isScriptFile(filePath) {
|
|
42
48
|
const yes = scriptFileExtensionList.some((ext) => filePath.endsWith('.' + ext));
|
|
43
|
-
|
|
49
|
+
if (isJavaScriptFile(filePath))
|
|
50
|
+
(0, assert_js_1.assert)(yes);
|
|
44
51
|
return yes;
|
|
45
52
|
}
|
|
46
53
|
exports.isScriptFile = isScriptFile;
|
|
47
54
|
function isJavaScriptFile(filePath) {
|
|
48
|
-
|
|
55
|
+
const yes1 = /\.(c|m)?(j|t)s$/.test(filePath);
|
|
56
|
+
const yes2 = extJavaScript.some((ext) => filePath.endsWith('.' + ext));
|
|
57
|
+
(0, assert_js_1.assert)(yes1 === yes2);
|
|
58
|
+
return yes1;
|
|
49
59
|
}
|
|
60
|
+
exports.isJavaScriptFile = isJavaScriptFile;
|
|
50
61
|
function isTemplateFile(filePath) {
|
|
51
62
|
return extTemplates.some((ext) => filePath.endsWith('.' + ext));
|
|
52
63
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PROJECT_VERSION = exports.projectInfo = void 0;
|
|
4
4
|
const assertSingleInstance_js_1 = require("./assertSingleInstance.js");
|
|
5
|
-
const PROJECT_VERSION = '0.4.
|
|
5
|
+
const PROJECT_VERSION = '0.4.162-commit-49fe40c';
|
|
6
6
|
exports.PROJECT_VERSION = PROJECT_VERSION;
|
|
7
7
|
const projectInfo = {
|
|
8
8
|
projectName: 'Vike',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export { route, getPagesAndRoutes };
|
|
3
3
|
import { route as routeInternal } from '../shared/route/index.js';
|
|
4
4
|
import { getGlobalContext, initGlobalContext } from '../node/runtime/globalContext.js';
|
|
5
|
-
import { setNodeEnvToProduction } from '../utils/
|
|
5
|
+
import { setNodeEnvToProduction } from '../utils/assertNodeEnv.js';
|
|
6
6
|
import { assert } from '../utils/assert.js';
|
|
7
7
|
import { getRenderContext } from '../node/runtime/renderPage/renderPageAlreadyRouted.js';
|
|
8
8
|
/**
|
|
@@ -308,35 +308,41 @@ async function renderPageClientSide(renderArgs) {
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
|
-
// We use globalObject.
|
|
312
|
-
if (globalObject.
|
|
311
|
+
// We use globalObject.onRenderClientPromise in order to ensure that there is never two concurrent onRenderClient() calls
|
|
312
|
+
if (globalObject.onRenderClientPromise) {
|
|
313
313
|
// Make sure that the previous render has finished
|
|
314
|
-
await globalObject.
|
|
315
|
-
assert(globalObject.
|
|
314
|
+
await globalObject.onRenderClientPromise;
|
|
315
|
+
assert(globalObject.onRenderClientPromise === undefined);
|
|
316
316
|
if (isRenderOutdated())
|
|
317
317
|
return;
|
|
318
318
|
}
|
|
319
319
|
changeUrl(urlOriginal, overwriteLastHistoryEntry);
|
|
320
320
|
globalObject.previousPageContext = pageContext;
|
|
321
|
-
assert(globalObject.
|
|
322
|
-
globalObject.
|
|
321
|
+
assert(globalObject.onRenderClientPromise === undefined);
|
|
322
|
+
globalObject.onRenderClientPromise = (async () => {
|
|
323
|
+
let onRenderClientError;
|
|
323
324
|
try {
|
|
324
325
|
await executeOnRenderClientHook(pageContext, true);
|
|
325
326
|
}
|
|
326
327
|
catch (err) {
|
|
327
|
-
|
|
328
|
-
return;
|
|
328
|
+
onRenderClientError = err;
|
|
329
329
|
}
|
|
330
|
-
|
|
331
|
-
|
|
330
|
+
globalObject.onRenderClientPromise = undefined;
|
|
331
|
+
return onRenderClientError;
|
|
332
332
|
})();
|
|
333
|
-
await globalObject.
|
|
334
|
-
assert(globalObject.
|
|
333
|
+
const onRenderClientError = await globalObject.onRenderClientPromise;
|
|
334
|
+
assert(globalObject.onRenderClientPromise === undefined);
|
|
335
|
+
if (onRenderClientError) {
|
|
336
|
+
await onError(onRenderClientError);
|
|
337
|
+
if (!isErrorPage)
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
335
340
|
/* We don't abort in order to ensure that onHydrationEnd() is called: we abort only after onHydrationEnd() is called.
|
|
336
341
|
if (isRenderOutdated(true)) return
|
|
337
342
|
*/
|
|
343
|
+
addLinkPrefetchHandlers(pageContext);
|
|
338
344
|
// onHydrationEnd()
|
|
339
|
-
if (isHydrationRender) {
|
|
345
|
+
if (isHydrationRender && !onRenderClientError) {
|
|
340
346
|
assertHook(pageContext, 'onHydrationEnd');
|
|
341
347
|
const hook = getHook(pageContext, 'onHydrationEnd');
|
|
342
348
|
if (hook) {
|
|
@@ -353,7 +359,7 @@ async function renderPageClientSide(renderArgs) {
|
|
|
353
359
|
return;
|
|
354
360
|
}
|
|
355
361
|
}
|
|
356
|
-
// We abort *after* onHydrationEnd() is called
|
|
362
|
+
// We purposely abort *after* onHydrationEnd() is called (see comment above).
|
|
357
363
|
if (isRenderOutdated(true))
|
|
358
364
|
return;
|
|
359
365
|
// onPageTransitionEnd()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { getPageContextProxyForUser };
|
|
2
|
-
import { assert, assertUsage, getGlobalObject } from '../server-routing-runtime/utils.js';
|
|
2
|
+
import { assert, assertUsage, assertWarning, getGlobalObject } from '../server-routing-runtime/utils.js';
|
|
3
3
|
import { notSerializable } from '../../shared/notSerializable.js';
|
|
4
4
|
const globalObject = getGlobalObject('getPageContextProxyForUser.ts', {});
|
|
5
5
|
/**
|
|
@@ -30,6 +30,10 @@ function assertIsDefined(pageContext, prop) {
|
|
|
30
30
|
return;
|
|
31
31
|
if (isExpected(prop))
|
|
32
32
|
return;
|
|
33
|
+
// - If no pageContext was fetchd from the server, then adding props to passToClient is useless.
|
|
34
|
+
// - Showing a warning, even though no pageContext was fetched from the server, is actually erroneous as the client runtime cannot deduce the passToClient list.
|
|
35
|
+
if (!pageContext._hasPageContextFromServer)
|
|
36
|
+
return;
|
|
33
37
|
const propName = JSON.stringify(prop);
|
|
34
38
|
/* This handling would be the clearest but, unfortunately, it's fundamentally problematic:
|
|
35
39
|
* - It would force the pageContext value consumer to be synchronized with the pageContext value provider. For example, if vike-react wants to conditionally do something dependening on wehther some optional pageContext value was provided by some optional vike-react-* integration package.
|
|
@@ -37,7 +41,7 @@ function assertIsDefined(pageContext, prop) {
|
|
|
37
41
|
const errMsg = `pageContext[${propName}] is \`undefined\` on the client-side. If it's defined on the server-side then add ${propName} to passToClient (https://vike.dev/passToClient), otherwise make sure your client-side hooks always define it (e.g. set it to \`null\` instead of \`undefined\`).`
|
|
38
42
|
assertUsage(false, errMsg)
|
|
39
43
|
*/
|
|
40
|
-
if (
|
|
44
|
+
if (!pageContext._hasPageContextFromClient) {
|
|
41
45
|
// We can safely assume that the property is missing in passToClient, because the server-side defines all passToClient properties even if they have an undefined value:
|
|
42
46
|
// ```
|
|
43
47
|
// <script id="vike_pageContext" type="application/json">{"_pageId":"/pages/admin","user":"!undefined","pageProps":"!undefined","title":"!undefined","abortReason":"!undefined","_urlRewrite":null}</script>
|
|
@@ -47,6 +51,19 @@ function assertIsDefined(pageContext, prop) {
|
|
|
47
51
|
}
|
|
48
52
|
else {
|
|
49
53
|
// Do nothing, not even a warning, because we don't know whether the user expects that the pageContext value can be undefined. (E.g. a pageContext value that is defined by an optional hook.)
|
|
54
|
+
// TODO/next-major-release make it an assertUsage()
|
|
55
|
+
assertWarning(false, [
|
|
56
|
+
`pageContext[${propName}] isn't defined on the client-side:`,
|
|
57
|
+
`1. if it's defined by the server-side then add ${propName} to passToClient (https://vike.dev/passToClient), or`,
|
|
58
|
+
`2. if it's expected that it may not be defined:`,
|
|
59
|
+
' ```js',
|
|
60
|
+
' // ❌ Replace code like this:',
|
|
61
|
+
` const val = pageContext[${propName}] ?? someDefaultValue`,
|
|
62
|
+
' // ✅ With that:',
|
|
63
|
+
` const val = ${propName} in pageContext ? pageContext[${propName}] : someDefaultValue`,
|
|
64
|
+
' ```',
|
|
65
|
+
`See stack track below to find where pageContext[${propName}] is being accessed.`
|
|
66
|
+
].join('\n'), { showStackTrace: true, onlyOnce: false });
|
|
50
67
|
}
|
|
51
68
|
}
|
|
52
69
|
const IGNORE_LIST = [
|
|
@@ -12,6 +12,7 @@ async function loadUserFilesClientSide(pageId, pageFilesAll, pageConfigs) {
|
|
|
12
12
|
const isDev = import.meta.env.DEV;
|
|
13
13
|
try {
|
|
14
14
|
// prettier-ignore
|
|
15
|
+
// biome-ignore format:
|
|
15
16
|
const result = await Promise.all([
|
|
16
17
|
pageConfig && loadConfigValues(pageConfig, isDev),
|
|
17
18
|
...pageFilesClientSide.map((p) => p.loadFile?.()),
|
|
@@ -19,7 +19,6 @@ import { suppressRollupWarning } from './plugins/suppressRollupWarning.js';
|
|
|
19
19
|
import { setGlobalContext } from './plugins/setGlobalContext.js';
|
|
20
20
|
import { importBuild } from './plugins/importBuild/index.js';
|
|
21
21
|
import { commonConfig } from './plugins/commonConfig.js';
|
|
22
|
-
import { extensionsAssets } from './plugins/extensionsAssets.js';
|
|
23
22
|
import { baseUrls } from './plugins/baseUrls.js';
|
|
24
23
|
import { envVarsPlugin } from './plugins/envVars.js';
|
|
25
24
|
import pc from '@brillout/picocolors';
|
|
@@ -44,7 +43,6 @@ function plugin(vikeConfig) {
|
|
|
44
43
|
suppressRollupWarning(),
|
|
45
44
|
setGlobalContext(),
|
|
46
45
|
...importBuild(),
|
|
47
|
-
extensionsAssets(),
|
|
48
46
|
baseUrls(vikeConfig),
|
|
49
47
|
envVarsPlugin(),
|
|
50
48
|
fileEnv()
|
|
@@ -228,6 +228,7 @@ function addLogHook() {
|
|
|
228
228
|
});
|
|
229
229
|
// Exhaustive list extracted from writeLine() calls at https://github.com/vitejs/vite/blob/193d55c7b9cbfec5b79ebfca276d4a721e7de14d/packages/vite/src/node/plugins/reporter.ts
|
|
230
230
|
// prettier-ignore
|
|
231
|
+
// biome-ignore format:
|
|
231
232
|
const viteTransientLogs = [
|
|
232
233
|
'transforming (',
|
|
233
234
|
'rendering chunks (',
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export { resolveVikeConfig };
|
|
2
2
|
import { assertVikeConfig } from './assertVikeConfig.js';
|
|
3
3
|
import { isDev2 } from '../../utils.js';
|
|
4
|
-
import { findConfigVikeFromStemPackages } from './findConfigVikeFromStemPackages.js';
|
|
5
4
|
import { pickFirst } from './pickFirst.js';
|
|
6
|
-
import { resolveExtensions } from './resolveExtensions.js';
|
|
7
5
|
import { resolveBase } from './resolveBase.js';
|
|
8
6
|
import { getVikeConfig } from '../importUserCode/v1-design/getVikeConfig.js';
|
|
9
7
|
import pc from '@brillout/picocolors';
|
|
@@ -21,10 +19,8 @@ function resolveVikeConfig(vikeConfig) {
|
|
|
21
19
|
async function getConfigVikPromise(vikeConfig, config) {
|
|
22
20
|
const fromPluginOptions = (vikeConfig ?? {});
|
|
23
21
|
const fromViteConfig = (config.vike ?? {});
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const extensions = resolveExtensions(configs, config);
|
|
27
|
-
const { globalVikeConfig: fromPlusConfigFile } = await getVikeConfig(config, isDev2(config), false, extensions);
|
|
22
|
+
const configs = [fromPluginOptions, fromViteConfig];
|
|
23
|
+
const { globalVikeConfig: fromPlusConfigFile } = await getVikeConfig(config, isDev2(config), false);
|
|
28
24
|
configs.push(fromPlusConfigFile);
|
|
29
25
|
assertVikeConfig(fromPlusConfigFile, ({ prop, errMsg }) => {
|
|
30
26
|
// TODO: add config file path ?
|
|
@@ -36,7 +32,6 @@ async function getConfigVikPromise(vikeConfig, config) {
|
|
|
36
32
|
const { baseServer, baseAssets } = resolveBase(configs, config);
|
|
37
33
|
const configVike = {
|
|
38
34
|
disableAutoFullBuild: pickFirst(configs.map((c) => c.disableAutoFullBuild)) ?? null,
|
|
39
|
-
extensions,
|
|
40
35
|
prerender: resolvePrerenderOptions(configs),
|
|
41
36
|
includeAssetsImportedByServer: pickFirst(configs.map((c) => c.includeAssetsImportedByServer)) ?? true,
|
|
42
37
|
baseServer,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { determineFsAllowList };
|
|
2
2
|
import type { ResolvedConfig } from 'vite';
|
|
3
|
-
|
|
4
|
-
declare function determineFsAllowList(config: ResolvedConfig, configVike: ConfigVikeResolved): Promise<void>;
|
|
3
|
+
declare function determineFsAllowList(config: ResolvedConfig): Promise<void>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { determineFsAllowList };
|
|
2
2
|
import { searchForWorkspaceRoot } from 'vite';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import fs from 'fs';
|
|
5
4
|
import { assert } from '../../utils.js';
|
|
6
5
|
import { createRequire } from 'module';
|
|
7
6
|
import { dirname } from 'path';
|
|
@@ -10,7 +9,7 @@ import { fileURLToPath } from 'url';
|
|
|
10
9
|
const importMetaUrl = import.meta.url;
|
|
11
10
|
const require_ = createRequire(importMetaUrl);
|
|
12
11
|
const __dirname_ = dirname(fileURLToPath(importMetaUrl));
|
|
13
|
-
async function determineFsAllowList(config
|
|
12
|
+
async function determineFsAllowList(config) {
|
|
14
13
|
const fsAllow = config.server.fs.allow;
|
|
15
14
|
// fsAllow should already contain searchForWorkspaceRoot()
|
|
16
15
|
assert(fsAllow.length >= 1);
|
|
@@ -27,10 +26,4 @@ async function determineFsAllowList(config, configVike) {
|
|
|
27
26
|
require_.resolve(`${vikeRoot}/dist/esm/node/plugin/plugins/devConfig/index.js`);
|
|
28
27
|
fsAllow.push(vikeRoot);
|
|
29
28
|
}
|
|
30
|
-
// Add Vike extensions, e.g. node_modules/stem-react/
|
|
31
|
-
configVike.extensions.forEach(({ npmPackageRootDir }) => {
|
|
32
|
-
const npmPackageRootDirReal = fs.realpathSync(npmPackageRootDir);
|
|
33
|
-
fsAllow.push(npmPackageRootDir);
|
|
34
|
-
fsAllow.push(npmPackageRootDirReal);
|
|
35
|
-
});
|
|
36
29
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { determineOptimizeDeps };
|
|
2
2
|
import type { ResolvedConfig } from 'vite';
|
|
3
|
-
|
|
4
|
-
declare function determineOptimizeDeps(config: ResolvedConfig, configVike: ConfigVikeResolved, isDev: true): Promise<void>;
|
|
3
|
+
declare function determineOptimizeDeps(config: ResolvedConfig, isDev: true): Promise<void>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { determineOptimizeDeps };
|
|
2
2
|
import { findPageFiles } from '../../shared/findPageFiles.js';
|
|
3
|
-
import { assert, getFilePathAbsolute,
|
|
3
|
+
import { assert, getFilePathAbsolute, isNpmPackageImport, unique } from '../../utils.js';
|
|
4
4
|
import { getVikeConfig } from '../importUserCode/v1-design/getVikeConfig.js';
|
|
5
5
|
import { getConfigValueSourcesNotOverriden } from '../../shared/getConfigValueSourcesNotOverriden.js';
|
|
6
6
|
import { analyzeClientEntries } from '../buildConfig.js';
|
|
7
7
|
import { virtualFileIdImportUserCodeClientCR, virtualFileIdImportUserCodeClientSR } from '../../../shared/virtual-files/virtualFileImportUserCode.js';
|
|
8
|
-
async function determineOptimizeDeps(config,
|
|
8
|
+
async function determineOptimizeDeps(config, isDev) {
|
|
9
9
|
const { pageConfigs } = await getVikeConfig(config, isDev);
|
|
10
10
|
const { entries, include } = await getPageDeps(config, pageConfigs, isDev);
|
|
11
11
|
{
|
|
@@ -16,7 +16,6 @@ async function determineOptimizeDeps(config, configVike, isDev) {
|
|
|
16
16
|
const entriesVirtualFiles = getVirtualFiles(config, pageConfigs);
|
|
17
17
|
entries.push(...entriesVirtualFiles);
|
|
18
18
|
}
|
|
19
|
-
include.push(...getExtensionsDeps(configVike));
|
|
20
19
|
/* Other Vite plugins may populate optimizeDeps, e.g. Cypress: https://github.com/vikejs/vike/issues/386
|
|
21
20
|
assert(config.optimizeDeps.entries === undefined)
|
|
22
21
|
*/
|
|
@@ -88,22 +87,6 @@ function getVirtualFiles(config, pageConfigs) {
|
|
|
88
87
|
entriesVirtualFiles.push(virtualFileIdImportUserCodeClientSR);
|
|
89
88
|
return entriesVirtualFiles;
|
|
90
89
|
}
|
|
91
|
-
function getExtensionsDeps(configVike) {
|
|
92
|
-
return [
|
|
93
|
-
/* Doesn't work since `pageConfigsSrcDir` is a directory. We could make it work by using find-glob.
|
|
94
|
-
...configVike.extensions
|
|
95
|
-
.map(({ pageConfigsSrcDir }) => pageConfigsSrcDir)
|
|
96
|
-
.flat()
|
|
97
|
-
.filter(isNotNullish),
|
|
98
|
-
//*/
|
|
99
|
-
...configVike.extensions
|
|
100
|
-
.map(({ pageConfigsDistFiles }) => pageConfigsDistFiles)
|
|
101
|
-
.flat()
|
|
102
|
-
.filter(isNotNullish)
|
|
103
|
-
.filter(({ importPath }) => !importPath.endsWith('.css'))
|
|
104
|
-
.map(({ importPath }) => importPath)
|
|
105
|
-
];
|
|
106
|
-
}
|
|
107
90
|
function normalizeEntries(entries) {
|
|
108
91
|
if (Array.isArray(entries))
|
|
109
92
|
return entries;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { devConfig };
|
|
2
2
|
import { determineOptimizeDeps } from './determineOptimizeDeps.js';
|
|
3
3
|
import { determineFsAllowList } from './determineFsAllowList.js';
|
|
4
|
-
import { getConfigVike } from '../../../shared/getConfigVike.js';
|
|
5
4
|
import { addSsrMiddleware } from '../../shared/addSsrMiddleware.js';
|
|
6
5
|
import { markEnvAsViteDev } from '../../utils.js';
|
|
7
6
|
import { improveViteLogs } from '../../shared/loggerVite.js';
|
|
@@ -55,9 +54,8 @@ function devConfig() {
|
|
|
55
54
|
},
|
|
56
55
|
async configResolved(config_) {
|
|
57
56
|
config = config_;
|
|
58
|
-
|
|
59
|
-
await
|
|
60
|
-
await determineFsAllowList(config, configVike);
|
|
57
|
+
await determineOptimizeDeps(config, isDev);
|
|
58
|
+
await determineFsAllowList(config);
|
|
61
59
|
if (!isErrorDebug()) {
|
|
62
60
|
await installHttpRequestAsyncStore();
|
|
63
61
|
improveViteLogs(config);
|
|
@@ -101,25 +101,6 @@ function extractAssetsPlugin() {
|
|
|
101
101
|
if (!isScriptFile(file)) {
|
|
102
102
|
return emptyModule(file, importer);
|
|
103
103
|
}
|
|
104
|
-
// If the dependency is a Vike extension and has `configVike.extension[number].pageConfigsSrcDir`, then include its CSS
|
|
105
|
-
if (configVike.extensions
|
|
106
|
-
.filter(({ pageConfigsSrcDir }) => pageConfigsSrcDir !== null)
|
|
107
|
-
.some(({ npmPackageName }) => {
|
|
108
|
-
const check1 = source === npmPackageName ||
|
|
109
|
-
source.startsWith(npmPackageName + '/') ||
|
|
110
|
-
// Include relative imports within modules of `npmPackageName`. (This only works for dependencies: user may use import path aliases.)
|
|
111
|
-
source.startsWith('.');
|
|
112
|
-
// This doesn't work for linked dependencies
|
|
113
|
-
const check2 = file.includes('node_modules/' + npmPackageName + '/') ||
|
|
114
|
-
file.includes('node_modules\\' + npmPackageName + '\\');
|
|
115
|
-
if (check1) {
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
assert(!check2);
|
|
119
|
-
return false;
|
|
120
|
-
})) {
|
|
121
|
-
return appendExtractAssetsQuery(file, importer);
|
|
122
|
-
}
|
|
123
104
|
// If the import path resolves to a file in `node_modules/`, we ignore that file:
|
|
124
105
|
// - Direct CSS dependencies are included though, such as `import 'bootstrap/theme/dark.css'`. (Because the above if-branch for CSS files will add the file.)
|
|
125
106
|
// - Loading CSS from a library (living in `node_modules/`) in a non-direct way is non-standard; we can safely not support this case. (I'm not aware of any library that does this.)
|
|
@@ -33,7 +33,7 @@ function importUserCode() {
|
|
|
33
33
|
},
|
|
34
34
|
handleHotUpdate(ctx) {
|
|
35
35
|
try {
|
|
36
|
-
return handleHotUpdate(ctx, config
|
|
36
|
+
return handleHotUpdate(ctx, config);
|
|
37
37
|
}
|
|
38
38
|
catch (err) {
|
|
39
39
|
// Vite swallows errors thrown by handleHotUpdate()
|
|
@@ -57,11 +57,11 @@ function importUserCode() {
|
|
|
57
57
|
},
|
|
58
58
|
configureServer(server) {
|
|
59
59
|
isDev1_onConfigureServer();
|
|
60
|
-
handleFileAddRemove(server, config
|
|
60
|
+
handleFileAddRemove(server, config);
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
function handleFileAddRemove(server, config
|
|
64
|
+
function handleFileAddRemove(server, config) {
|
|
65
65
|
server.watcher.prependListener('add', (f) => listener(f, false));
|
|
66
66
|
server.watcher.prependListener('unlink', (f) => listener(f, true));
|
|
67
67
|
return;
|
|
@@ -73,11 +73,11 @@ function handleFileAddRemove(server, config, configVike) {
|
|
|
73
73
|
virtualModules.forEach((mod) => {
|
|
74
74
|
server.moduleGraph.invalidateModule(mod);
|
|
75
75
|
});
|
|
76
|
-
reloadConfig(file, config,
|
|
76
|
+
reloadConfig(file, config, isRemove ? 'removed' : 'created');
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function handleHotUpdate(ctx, config
|
|
80
|
+
function handleHotUpdate(ctx, config) {
|
|
81
81
|
const { file, server } = ctx;
|
|
82
82
|
assertPosixPath(file);
|
|
83
83
|
vikeConfigDependencies.forEach((f) => assertPosixPath(f));
|
|
@@ -108,7 +108,7 @@ function handleHotUpdate(ctx, config, configVike) {
|
|
|
108
108
|
/* Tailwind breaks this assertion, see https://github.com/vikejs/vike/discussions/1330#discussioncomment-7787238
|
|
109
109
|
assert(!isViteModule)
|
|
110
110
|
*/
|
|
111
|
-
reloadConfig(file, config,
|
|
111
|
+
reloadConfig(file, config, 'modified');
|
|
112
112
|
const virtualModules = getVirtualModules(server);
|
|
113
113
|
return virtualModules;
|
|
114
114
|
}
|
|
@@ -116,13 +116,13 @@ function handleHotUpdate(ctx, config, configVike) {
|
|
|
116
116
|
function isVikeConfigModule(filePathAbsoluteFilesystem) {
|
|
117
117
|
return vikeConfigDependencies.has(filePathAbsoluteFilesystem);
|
|
118
118
|
}
|
|
119
|
-
function reloadConfig(filePath, config,
|
|
119
|
+
function reloadConfig(filePath, config, op) {
|
|
120
120
|
{
|
|
121
121
|
const filePathToShowToUser = pc.dim(getFilePathRelativeToUserRootDir(filePath, config.root, true));
|
|
122
122
|
const msg = `${op} ${filePathToShowToUser}`;
|
|
123
123
|
logConfigInfo(msg, 'info');
|
|
124
124
|
}
|
|
125
|
-
reloadVikeConfig(config.root, getOutDirs(config).outDirRoot
|
|
125
|
+
reloadVikeConfig(config.root, getOutDirs(config).outDirRoot);
|
|
126
126
|
}
|
|
127
127
|
function getVirtualModules(server) {
|
|
128
128
|
const virtualModules = Array.from(server.moduleGraph.urlToModuleMap.keys())
|
|
@@ -60,15 +60,7 @@ function getConfigValueSerialized(value, configName, definedAt) {
|
|
|
60
60
|
*/
|
|
61
61
|
const configValueFilePathToShowToUser = getConfigValueFilePathToShowToUser({ definedAt });
|
|
62
62
|
assert(configValueFilePathToShowToUser);
|
|
63
|
-
assertUsage(false,
|
|
64
|
-
`The code of ${pc.cyan(configName)} cannot live inside ${configValueFilePathToShowToUser},`,
|
|
65
|
-
'see https://vike.dev/header-file#runtime-code'
|
|
66
|
-
/* I guess showing this is more confusing than adding value.
|
|
67
|
-
`(technically speaking: the value of ${pc.cyan(
|
|
68
|
-
configName
|
|
69
|
-
)} isn't serializable (${serializationErrMsg}) and it's therefore runtime code that needs to be imported).`
|
|
70
|
-
//*/
|
|
71
|
-
].join(' '));
|
|
63
|
+
assertUsage(false, `${pc.cyan(configName)} defined by ${configValueFilePathToShowToUser} must be defined over a so-called "pointer import", see https://vike.dev/config#pointer-imports`);
|
|
72
64
|
}
|
|
73
65
|
configValueSerialized = JSON.stringify(configValueSerialized);
|
|
74
66
|
return configValueSerialized;
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts
CHANGED
|
@@ -13,18 +13,18 @@ export { getLogicalPath };
|
|
|
13
13
|
* Each config value is assigned with a `locationId` value. That's the source-of-truth for determining inheritance between config values.
|
|
14
14
|
*
|
|
15
15
|
* For Vike extensions, `locationId` is different than the config value's `definedAt`, for example the `onRenderHtml()` hook of `vike-react`:
|
|
16
|
-
* - `locationId === '/pages'` (the directory of `/pages/+config.
|
|
16
|
+
* - `locationId === '/pages'` (the directory of `/pages/+config.js` which extends `vike-react`)
|
|
17
17
|
* - `definedAt.filePathAbsoluteFilesystem === '/home/rom/code/my-vike-app/node_modules/vike-react/dist/renderer/onRenderHtml.js'` (the file where the value is defined)
|
|
18
18
|
*
|
|
19
19
|
* This is an important distinction because the Vike extension's config should only apply to where it's being extended from, for example:
|
|
20
20
|
* ```js
|
|
21
|
-
* // /pages/admin/+config.
|
|
21
|
+
* // /pages/admin/+config.js
|
|
22
22
|
* import vikeVue from 'vike-vue/config'
|
|
23
23
|
* // Should only apply to /pages/admin/**
|
|
24
24
|
* export default { extends: [vikeVue] }
|
|
25
25
|
* ```
|
|
26
26
|
* ```js
|
|
27
|
-
* // /pages/marketing/+config.
|
|
27
|
+
* // /pages/marketing/+config.js
|
|
28
28
|
* import vikeReact from 'vike-react/config'
|
|
29
29
|
* // Should only apply to /pages/marketing/**
|
|
30
30
|
* export default { extends: [vikeReact] }
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js
CHANGED
|
@@ -15,7 +15,7 @@ import { assert, assertPosixPath, higherFirst } from '../../../../utils.js';
|
|
|
15
15
|
* The value `locationId` is always a user-land path, because Filesystem Routing/Inheritance only applies to the user-land (Vike never uses Filesystem Routing/Inheritance for `node_modules/**`).
|
|
16
16
|
*/
|
|
17
17
|
function getLocationId(
|
|
18
|
-
// We always determine `locationId` from a real user-land file: the `locationId` for Vike extensions is the `locationId` of the the user's `+config.
|
|
18
|
+
// We always determine `locationId` from a real user-land file: the `locationId` for Vike extensions is the `locationId` of the the user's `+config.js` that extends the Vike extension.
|
|
19
19
|
filePathRelativeToUserRootDir) {
|
|
20
20
|
assertPosixPath(filePathRelativeToUserRootDir);
|
|
21
21
|
assert(filePathRelativeToUserRootDir.startsWith('/'));
|
|
@@ -15,7 +15,7 @@ declare function loadImportedFile(import_: FilePathResolved & {
|
|
|
15
15
|
fileExportName: string;
|
|
16
16
|
}, userRootDir: string, importedFilesLoaded: ImportedFilesLoaded): Promise<unknown>;
|
|
17
17
|
declare function loadValueFile(interfaceValueFile: InterfaceValueFile, configName: string, userRootDir: string): Promise<void>;
|
|
18
|
-
declare function loadConfigFile(configFilePath: FilePathResolved, userRootDir: string, visited: string[],
|
|
18
|
+
declare function loadConfigFile(configFilePath: FilePathResolved, userRootDir: string, visited: string[], isExtensionConfig: boolean): Promise<{
|
|
19
19
|
configFile: ConfigFile;
|
|
20
20
|
extendsConfigs: ConfigFile[];
|
|
21
21
|
}>;
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js
CHANGED
|
@@ -14,7 +14,7 @@ assertIsNotProductionRuntime();
|
|
|
14
14
|
async function loadImportedFile(import_, userRootDir, importedFilesLoaded) {
|
|
15
15
|
const f = import_.filePathAbsoluteFilesystem;
|
|
16
16
|
if (!importedFilesLoaded[f]) {
|
|
17
|
-
importedFilesLoaded[f] = transpileAndExecuteFile(import_,
|
|
17
|
+
importedFilesLoaded[f] = transpileAndExecuteFile(import_, userRootDir, false).then((r) => r.fileExports);
|
|
18
18
|
}
|
|
19
19
|
const fileExports = await importedFilesLoaded[f];
|
|
20
20
|
const fileExport = fileExports[import_.fileExportName];
|
|
@@ -22,7 +22,7 @@ async function loadImportedFile(import_, userRootDir, importedFilesLoaded) {
|
|
|
22
22
|
}
|
|
23
23
|
// Load +{configName}.js
|
|
24
24
|
async function loadValueFile(interfaceValueFile, configName, userRootDir) {
|
|
25
|
-
const { fileExports } = await transpileAndExecuteFile(interfaceValueFile.filePath,
|
|
25
|
+
const { fileExports } = await transpileAndExecuteFile(interfaceValueFile.filePath, userRootDir, false);
|
|
26
26
|
const { filePathToShowToUser } = interfaceValueFile.filePath;
|
|
27
27
|
assertPlusFileExport(fileExports, filePathToShowToUser, configName);
|
|
28
28
|
Object.entries(fileExports).forEach(([exportName, configValue]) => {
|
|
@@ -31,10 +31,10 @@ async function loadValueFile(interfaceValueFile, configName, userRootDir) {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
// Load +config.js, including all its extends fake imports
|
|
34
|
-
async function loadConfigFile(configFilePath, userRootDir, visited,
|
|
34
|
+
async function loadConfigFile(configFilePath, userRootDir, visited, isExtensionConfig) {
|
|
35
35
|
const { filePathAbsoluteFilesystem } = configFilePath;
|
|
36
36
|
assertNoInfiniteLoop(visited, filePathAbsoluteFilesystem);
|
|
37
|
-
const { fileExports } = await transpileAndExecuteFile(configFilePath,
|
|
37
|
+
const { fileExports } = await transpileAndExecuteFile(configFilePath, userRootDir, isExtensionConfig ? 'is-extension-config' : true);
|
|
38
38
|
const { extendsConfigs, extendsFilePaths } = await loadExtendsConfigs(fileExports, configFilePath, userRootDir, [
|
|
39
39
|
...visited,
|
|
40
40
|
filePathAbsoluteFilesystem
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js
CHANGED
|
@@ -115,7 +115,7 @@ function assertFileEnv(filePathForEnvCheck, configEnv, configName) {
|
|
|
115
115
|
assertUsage(false, [
|
|
116
116
|
`${filePathForEnvCheck} defines the value of configs living in different environments:`,
|
|
117
117
|
...[configDifferentEnv, { configName, configEnv }].map((c) => ` - config ${pc.cyan(c.configName)} which value lives in environment ${pc.cyan(JSON.stringify(c.configEnv))}`),
|
|
118
|
-
'Defining config values in the same file is allowed only if they live in the same environment, see https://vike.dev/
|
|
118
|
+
'Defining config values in the same file is allowed only if they live in the same environment, see https://vike.dev/config#pointer-imports'
|
|
119
119
|
].join('\n'));
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
export { transformFileImports };
|
|
2
2
|
export { parseImportData };
|
|
3
3
|
export { isImportData };
|
|
4
|
-
export type { FileImport };
|
|
5
4
|
export type { ImportData };
|
|
6
|
-
|
|
7
|
-
importStatementCode: string;
|
|
8
|
-
importString: string;
|
|
9
|
-
importLocalName: string;
|
|
10
|
-
};
|
|
11
|
-
declare function transformFileImports(code: string, filePathToShowToUser2: string, skipWarnings?: true): {
|
|
12
|
-
noTransformation: true;
|
|
13
|
-
} | {
|
|
14
|
-
noTransformation: false;
|
|
15
|
-
code: string;
|
|
16
|
-
fileImportsTransformed: FileImport[];
|
|
17
|
-
};
|
|
5
|
+
declare function transformFileImports(code: string, filePathToShowToUser2: string, pointerImports: 'all' | Record<string, boolean>, skipWarnings?: true): string | null;
|
|
18
6
|
/**
|
|
19
7
|
* Data Structure holding info about import statement:
|
|
20
8
|
* `import { someExport as someImport } from './some-file'`
|