vike 0.4.161 → 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 +20 -20
- 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/envVars.js +6 -2
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +10 -22
- package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +2 -2
- package/dist/cjs/node/plugin/plugins/importBuild/getVikeManifest.js +1 -21
- package/dist/cjs/node/plugin/plugins/importBuild/index.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +29 -95
- 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 +39 -33
- package/dist/cjs/node/plugin/plugins/setGlobalContext.js +0 -14
- package/dist/cjs/node/plugin/shared/rollupSourceMap.js +20 -0
- package/dist/cjs/node/plugin/utils.js +0 -1
- package/dist/cjs/node/prerender/runPrerender.js +3 -2
- package/dist/cjs/node/prerender/utils.js +1 -1
- package/dist/cjs/node/runtime/globalContext.js +8 -19
- package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +1 -0
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +2 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +2 -8
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +6 -7
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +2 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +23 -28
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -23
- package/dist/cjs/node/runtime/utils.js +1 -2
- package/dist/cjs/node/shared/assertPluginManifest.js +1 -4
- package/dist/cjs/node/shared/assertV1Design.js +26 -0
- package/dist/cjs/node/shared/{getClientEntryFilePath.js → getClientEntry.js} +3 -3
- package/dist/cjs/node/shared/prependEntriesDir.js +13 -0
- package/dist/cjs/node/shared/utils.js +2 -0
- 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 +19 -19
- 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/envVars.js +6 -2
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +11 -23
- package/dist/esm/node/plugin/plugins/extractExportNamesPlugin.js +2 -2
- package/dist/esm/node/plugin/plugins/importBuild/getVikeManifest.d.ts +1 -2
- package/dist/esm/node/plugin/plugins/importBuild/getVikeManifest.js +2 -19
- package/dist/esm/node/plugin/plugins/importBuild/index.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +31 -97
- 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 +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +39 -33
- package/dist/esm/node/plugin/plugins/setGlobalContext.js +1 -15
- package/dist/esm/node/plugin/shared/rollupSourceMap.d.ts +14 -0
- package/dist/esm/node/plugin/shared/rollupSourceMap.js +17 -0
- 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 +4 -3
- package/dist/esm/node/prerender/utils.d.ts +1 -1
- package/dist/esm/node/prerender/utils.js +1 -1
- package/dist/esm/node/runtime/globalContext.d.ts +3 -10
- package/dist/esm/node/runtime/globalContext.js +7 -18
- package/dist/esm/node/runtime/html/serializePageContextClientSide.js +1 -0
- package/dist/esm/node/runtime/renderPage/analyzePage.js +2 -2
- package/dist/esm/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +2 -8
- package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.js +6 -7
- package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +2 -2
- package/dist/esm/node/runtime/renderPage/getPageAssets.js +24 -29
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +3 -24
- package/dist/esm/node/runtime/utils.d.ts +1 -2
- package/dist/esm/node/runtime/utils.js +1 -2
- package/dist/esm/node/shared/ViteManifest.d.ts +1 -0
- package/dist/esm/node/shared/assertPluginManifest.d.ts +0 -1
- package/dist/esm/node/shared/assertPluginManifest.js +2 -5
- package/dist/esm/node/shared/assertV1Design.d.ts +4 -0
- package/dist/esm/node/shared/assertV1Design.js +23 -0
- package/dist/esm/node/shared/getClientEntry.d.ts +3 -0
- package/dist/esm/node/shared/{getClientEntryFilePath.js → getClientEntry.js} +2 -2
- package/dist/esm/node/shared/prependEntriesDir.d.ts +2 -0
- package/dist/esm/node/shared/prependEntriesDir.js +10 -0
- package/dist/esm/node/shared/utils.d.ts +2 -0
- package/dist/esm/node/shared/utils.js +2 -0
- 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 +2 -4
- 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 +4 -3
- 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/node/plugin/shared/removeSourceMap.js +0 -12
- 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/node/plugin/shared/removeSourceMap.d.ts +0 -7
- package/dist/esm/node/plugin/shared/removeSourceMap.js +0 -9
- package/dist/esm/node/shared/getClientEntryFilePath.d.ts +0 -3
- 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
|
@@ -11,10 +11,11 @@ import { extractAssetsAddQuery } from '../../shared/extractAssetsQuery.js';
|
|
|
11
11
|
import { getConfigVike } from '../../shared/getConfigVike.js';
|
|
12
12
|
import { isAsset } from '../shared/isAsset.js';
|
|
13
13
|
import { getImportStatements } from '../shared/parseEsModule.js';
|
|
14
|
-
import {
|
|
14
|
+
import { sourceMapRemove } from '../shared/rollupSourceMap.js';
|
|
15
15
|
import pc from '@brillout/picocolors';
|
|
16
16
|
import { fixServerAssets_isEnabled } from './buildConfig/fixServerAssets.js';
|
|
17
|
-
import { isV1Design } from './importUserCode/v1-design/getVikeConfig.js';
|
|
17
|
+
import { getVikeConfig, isV1Design } from './importUserCode/v1-design/getVikeConfig.js';
|
|
18
|
+
import { assertV1Design } from '../../shared/assertV1Design.js';
|
|
18
19
|
const extractAssetsRE = /(\?|&)extractAssets(?:&|$)/;
|
|
19
20
|
const rawRE = /(\?|&)raw(?:&|$)/;
|
|
20
21
|
const urlRE = /(\?|&)url(?:&|$)/;
|
|
@@ -25,6 +26,7 @@ const debugEnabled = isDebugEnabled(debugNamespace);
|
|
|
25
26
|
function extractAssetsPlugin() {
|
|
26
27
|
let config;
|
|
27
28
|
let configVike;
|
|
29
|
+
let vikeConfig;
|
|
28
30
|
let isServerAssetsFixEnabled;
|
|
29
31
|
return [
|
|
30
32
|
// This plugin removes all JavaScript from server-side only code, so that only CSS imports remains. (And also satic files imports e.g. `import logoURL from './logo.svg.js'`).
|
|
@@ -37,14 +39,18 @@ function extractAssetsPlugin() {
|
|
|
37
39
|
if (!extractAssetsRE.test(id)) {
|
|
38
40
|
return;
|
|
39
41
|
}
|
|
40
|
-
|
|
42
|
+
if (isServerAssetsFixEnabled) {
|
|
43
|
+
// I'm guessing isServerAssetsFixEnabled can only be true when mixing both designs: https://github.com/vikejs/vike/issues/1480
|
|
44
|
+
assertV1Design(true, vikeConfig.pageConfigs);
|
|
45
|
+
assert(false);
|
|
46
|
+
}
|
|
41
47
|
assert(configVike.includeAssetsImportedByServer);
|
|
42
48
|
assert(!viteIsSSR_options(options));
|
|
43
49
|
const importStatements = await getImportStatements(src);
|
|
44
50
|
const moduleNames = getImportedModules(importStatements);
|
|
45
51
|
const code = moduleNames.map((moduleName) => `import '${moduleName}';`).join('\n');
|
|
46
52
|
debugTransformResult(id, code, importStatements);
|
|
47
|
-
return
|
|
53
|
+
return sourceMapRemove(code);
|
|
48
54
|
}
|
|
49
55
|
},
|
|
50
56
|
// This plugin appends `?extractAssets` to module IDs
|
|
@@ -95,25 +101,6 @@ function extractAssetsPlugin() {
|
|
|
95
101
|
if (!isScriptFile(file)) {
|
|
96
102
|
return emptyModule(file, importer);
|
|
97
103
|
}
|
|
98
|
-
// If the dependency is a Vike extension and has `configVike.extension[number].pageConfigsSrcDir`, then include its CSS
|
|
99
|
-
if (configVike.extensions
|
|
100
|
-
.filter(({ pageConfigsSrcDir }) => pageConfigsSrcDir !== null)
|
|
101
|
-
.some(({ npmPackageName }) => {
|
|
102
|
-
const check1 = source === npmPackageName ||
|
|
103
|
-
source.startsWith(npmPackageName + '/') ||
|
|
104
|
-
// Include relative imports within modules of `npmPackageName`. (This only works for dependencies: user may use import path aliases.)
|
|
105
|
-
source.startsWith('.');
|
|
106
|
-
// This doesn't work for linked dependencies
|
|
107
|
-
const check2 = file.includes('node_modules/' + npmPackageName + '/') ||
|
|
108
|
-
file.includes('node_modules\\' + npmPackageName + '\\');
|
|
109
|
-
if (check1) {
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
assert(!check2);
|
|
113
|
-
return false;
|
|
114
|
-
})) {
|
|
115
|
-
return appendExtractAssetsQuery(file, importer);
|
|
116
|
-
}
|
|
117
104
|
// If the import path resolves to a file in `node_modules/`, we ignore that file:
|
|
118
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.)
|
|
119
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.)
|
|
@@ -135,6 +122,7 @@ function extractAssetsPlugin() {
|
|
|
135
122
|
async configResolved(config_) {
|
|
136
123
|
configVike = await getConfigVike(config_);
|
|
137
124
|
config = config_;
|
|
125
|
+
vikeConfig = await getVikeConfig(config, false);
|
|
138
126
|
isServerAssetsFixEnabled = fixServerAssets_isEnabled() && (await isV1Design(config, false));
|
|
139
127
|
},
|
|
140
128
|
load(id) {
|
|
@@ -3,7 +3,7 @@ export { isUsingClientRouter };
|
|
|
3
3
|
export { extractExportNamesRE };
|
|
4
4
|
import { assert, getFileExtension, viteIsSSR_options, createDebugger, isDebugEnabled, getGlobalObject, assertUsage } from '../utils.js';
|
|
5
5
|
import { getExportNames } from '../shared/parseEsModule.js';
|
|
6
|
-
import {
|
|
6
|
+
import { sourceMapRemove } from '../shared/rollupSourceMap.js';
|
|
7
7
|
const extractExportNamesRE = /(\?|&)extractExportNames(?:&|$)/;
|
|
8
8
|
const debugNamespace = 'vike:extractExportNames';
|
|
9
9
|
const debug = createDebugger(debugNamespace);
|
|
@@ -38,7 +38,7 @@ async function getExtractExportNamesCode(src, isClientSide, isProduction, id) {
|
|
|
38
38
|
globalObject.usesClientRouter = true;
|
|
39
39
|
}
|
|
40
40
|
const code = getCode(exportNames, wildcardReExports, isClientSide, isProduction, id);
|
|
41
|
-
return
|
|
41
|
+
return sourceMapRemove(code);
|
|
42
42
|
}
|
|
43
43
|
function getCode(exportNames, wildcardReExports, isClientSide, isProduction, id) {
|
|
44
44
|
let code = '';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { getVikeManifest };
|
|
2
|
-
import { ResolvedConfig } from 'vite';
|
|
3
2
|
import { type PluginManifest } from '../../../shared/assertPluginManifest.js';
|
|
4
3
|
import type { ConfigVikeResolved } from '../../../../shared/ConfigVike.js';
|
|
5
|
-
declare function getVikeManifest(
|
|
4
|
+
declare function getVikeManifest(configVike: ConfigVikeResolved): PluginManifest;
|
|
@@ -1,32 +1,15 @@
|
|
|
1
1
|
export { getVikeManifest };
|
|
2
|
-
import { projectInfo
|
|
2
|
+
import { projectInfo } from '../../utils.js';
|
|
3
3
|
import { assertPluginManifest } from '../../../shared/assertPluginManifest.js';
|
|
4
4
|
import { isUsingClientRouter } from '../extractExportNamesPlugin.js';
|
|
5
|
-
import path from 'path';
|
|
6
5
|
import { getRuntimeManifest } from '../../../runtime/globalContext.js';
|
|
7
|
-
function getVikeManifest(
|
|
6
|
+
function getVikeManifest(configVike) {
|
|
8
7
|
const runtimeManifest = getRuntimeManifest(configVike);
|
|
9
8
|
const manifest = {
|
|
10
9
|
version: projectInfo.projectVersion,
|
|
11
10
|
usesClientRouter: isUsingClientRouter(), // TODO/v1-release: remove
|
|
12
|
-
manifestKeyMap: getManifestKeyMap(configVike, config),
|
|
13
11
|
...runtimeManifest
|
|
14
12
|
};
|
|
15
13
|
assertPluginManifest(manifest);
|
|
16
14
|
return manifest;
|
|
17
15
|
}
|
|
18
|
-
function getManifestKeyMap(configVike, config) {
|
|
19
|
-
const manifestKeyMap = {};
|
|
20
|
-
configVike.extensions
|
|
21
|
-
.map(({ pageConfigsDistFiles }) => pageConfigsDistFiles)
|
|
22
|
-
.flat()
|
|
23
|
-
.filter(isNotNullish)
|
|
24
|
-
.forEach(({ importPath, filePath }) => {
|
|
25
|
-
// Recreating https://github.com/vitejs/vite/blob/8158ece72b66307e7b607b98496891610ca70ea2/packages/vite/src/node/plugins/manifest.ts#L38
|
|
26
|
-
const filePathRelative = path.posix.relative(config.root, toPosixPath(filePath));
|
|
27
|
-
assertPosixPath(filePathRelative);
|
|
28
|
-
assertPosixPath(importPath);
|
|
29
|
-
manifestKeyMap[importPath] = filePathRelative;
|
|
30
|
-
});
|
|
31
|
-
return manifestKeyMap;
|
|
32
|
-
}
|
|
@@ -34,7 +34,7 @@ function importBuild() {
|
|
|
34
34
|
}
|
|
35
35
|
function getEntryCode(config, configVike) {
|
|
36
36
|
const importPath = getImportPath(config);
|
|
37
|
-
const vikeManifest = getVikeManifest(
|
|
37
|
+
const vikeManifest = getVikeManifest(configVike);
|
|
38
38
|
const importerCode = [
|
|
39
39
|
` import { setImportBuildGetters } from '${importPath}';`,
|
|
40
40
|
` import * as pageFiles from '${virtualFileIdImportUserCodeServer}';`,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { getVirtualFileImportUserCode };
|
|
2
|
-
import { assert, assertPosixPath, viteIsSSR_options,
|
|
2
|
+
import { assert, assertPosixPath, viteIsSSR_options, scriptFileExtensions, debugGlob, getOutDirs, isVersionOrAbove, assertWarning } from '../../utils.js';
|
|
3
3
|
import { isVirtualFileIdImportUserCode } from '../../../shared/virtual-files/virtualFileImportUserCode.js';
|
|
4
|
-
import {
|
|
4
|
+
import { version as viteVersion } from 'vite';
|
|
5
|
+
import { fileTypes } from '../../../../shared/getPageFiles/fileTypes.js';
|
|
5
6
|
import path from 'path';
|
|
6
7
|
import { getVirtualFilePageConfigs } from './v1-design/getVirtualFilePageConfigs.js';
|
|
7
|
-
import {
|
|
8
|
+
import { isV1Design as isV1Design_ } from './v1-design/getVikeConfig.js';
|
|
8
9
|
async function getVirtualFileImportUserCode(id, options, configVike, config, isDev) {
|
|
9
10
|
const idParsed = isVirtualFileIdImportUserCode(id);
|
|
10
11
|
assert(idParsed);
|
|
@@ -21,53 +22,13 @@ async function getCode(config, configVike, isForClientSide, isClientRouting, isP
|
|
|
21
22
|
assert(isDev === !isBuild);
|
|
22
23
|
let content = '';
|
|
23
24
|
{
|
|
24
|
-
const globRoots = getGlobRoots(config
|
|
25
|
+
const globRoots = getGlobRoots(config);
|
|
25
26
|
debugGlob('Glob roots: ', globRoots);
|
|
26
27
|
content += await generateGlobImports(globRoots, isBuild, isForClientSide, isClientRouting, configVike, isPrerendering, config, isDev, id);
|
|
27
28
|
}
|
|
28
|
-
{
|
|
29
|
-
const extensionsImportPaths = configVike.extensions
|
|
30
|
-
.map(({ pageConfigsDistFiles }) => pageConfigsDistFiles)
|
|
31
|
-
.flat()
|
|
32
|
-
.filter(isNotNullish)
|
|
33
|
-
.map(({ importPath }) => importPath);
|
|
34
|
-
content += generateExtensionImports(extensionsImportPaths, isForClientSide, isBuild, isClientRouting, isPrerendering);
|
|
35
|
-
}
|
|
36
29
|
debugGlob(`Glob imports for ${isForClientSide ? 'client' : 'server'}:\n`, content);
|
|
37
30
|
return content;
|
|
38
31
|
}
|
|
39
|
-
function generateExtensionImports(extensionsImportPaths, isForClientSide, isBuild, isClientRouting, isPrerendering) {
|
|
40
|
-
let fileContent = '\n\n';
|
|
41
|
-
extensionsImportPaths
|
|
42
|
-
.filter((importPath) => {
|
|
43
|
-
assert(
|
|
44
|
-
// V1 design
|
|
45
|
-
importPath.includes('+') ||
|
|
46
|
-
// V0.4 design
|
|
47
|
-
importPath.includes('.page.'));
|
|
48
|
-
return !importPath.includes('+');
|
|
49
|
-
})
|
|
50
|
-
.forEach((importPath) => {
|
|
51
|
-
const fileType = determineFileType(importPath);
|
|
52
|
-
const { includeImport, includeExportNames } = determineInjection({
|
|
53
|
-
fileType,
|
|
54
|
-
isForClientSide,
|
|
55
|
-
isClientRouting,
|
|
56
|
-
isPrerendering,
|
|
57
|
-
isBuild
|
|
58
|
-
});
|
|
59
|
-
if (includeImport) {
|
|
60
|
-
fileContent += addImport(importPath, fileType, false, isBuild);
|
|
61
|
-
}
|
|
62
|
-
if (includeExportNames) {
|
|
63
|
-
fileContent += addImport(importPath, fileType, true, isBuild);
|
|
64
|
-
}
|
|
65
|
-
if (!includeImport && !includeExportNames && !isForClientSide) {
|
|
66
|
-
fileContent += `pageFilesList.push("${importPath}");` + '\n';
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
return fileContent;
|
|
70
|
-
}
|
|
71
32
|
function determineInjection({ fileType, isForClientSide, isClientRouting, isPrerendering, isBuild }) {
|
|
72
33
|
if (!isForClientSide) {
|
|
73
34
|
return {
|
|
@@ -93,42 +54,6 @@ function determineInjection({ fileType, isForClientSide, isClientRouting, isPrer
|
|
|
93
54
|
}
|
|
94
55
|
}
|
|
95
56
|
}
|
|
96
|
-
function addImport(importPath, fileType, exportNames, isBuild) {
|
|
97
|
-
const pageFilesVar = (() => {
|
|
98
|
-
if (exportNames) {
|
|
99
|
-
if (isBuild) {
|
|
100
|
-
return 'pageFilesExportNamesEager';
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
return 'pageFilesExportNamesLazy';
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
if (fileType === '.page.route') {
|
|
108
|
-
return 'pageFilesEager';
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
return 'pageFilesLazy';
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
})();
|
|
115
|
-
const query = !exportNames ? '' : '?extractExportNames';
|
|
116
|
-
let fileContent = '';
|
|
117
|
-
const mapVar = `${pageFilesVar}['${fileType}']`;
|
|
118
|
-
fileContent += `${mapVar} = ${mapVar} ?? {};\n`;
|
|
119
|
-
const value = (() => {
|
|
120
|
-
if (!pageFilesVar.endsWith('Eager')) {
|
|
121
|
-
return `() => import('${importPath}${query}')`;
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
const { importName, importStatement } = generateEagerImport(`${importPath}${query}`);
|
|
125
|
-
fileContent += importStatement + '\n';
|
|
126
|
-
return importName;
|
|
127
|
-
}
|
|
128
|
-
})();
|
|
129
|
-
fileContent += `${mapVar}['${importPath}'] = ${value};\n`;
|
|
130
|
-
return fileContent;
|
|
131
|
-
}
|
|
132
57
|
async function generateGlobImports(globRoots, isBuild, isForClientSide, isClientRouting, configVike, isPrerendering, config, isDev, id) {
|
|
133
58
|
let fileContent = `// Generatead by node/plugin/plugins/virtualFiles/index.ts
|
|
134
59
|
|
|
@@ -143,6 +68,8 @@ export const isGeneratedFile = true;
|
|
|
143
68
|
${await getVirtualFilePageConfigs(isForClientSide, isDev, id, isClientRouting, config)}
|
|
144
69
|
|
|
145
70
|
`;
|
|
71
|
+
// We still use import.meta.glob() when using th V1 design in order to not break the V1 design deprecation warning
|
|
72
|
+
const isV1Design = await isV1Design_(config, isDev);
|
|
146
73
|
fileTypes
|
|
147
74
|
.filter((fileType) => fileType !== '.css')
|
|
148
75
|
.forEach((fileType) => {
|
|
@@ -155,18 +82,18 @@ ${await getVirtualFilePageConfigs(isForClientSide, isDev, id, isClientRouting, c
|
|
|
155
82
|
isBuild
|
|
156
83
|
});
|
|
157
84
|
if (includeImport) {
|
|
158
|
-
fileContent += getGlobs(globRoots, isBuild, fileType);
|
|
85
|
+
fileContent += getGlobs(globRoots, isBuild, fileType, null, isV1Design);
|
|
159
86
|
}
|
|
160
87
|
if (includeExportNames) {
|
|
161
|
-
fileContent += getGlobs(globRoots, isBuild, fileType, 'extractExportNames');
|
|
88
|
+
fileContent += getGlobs(globRoots, isBuild, fileType, 'extractExportNames', isV1Design);
|
|
162
89
|
}
|
|
163
90
|
});
|
|
164
91
|
if (configVike.includeAssetsImportedByServer && isForClientSide) {
|
|
165
|
-
fileContent += getGlobs(globRoots, isBuild, '.page.server', 'extractAssets');
|
|
92
|
+
fileContent += getGlobs(globRoots, isBuild, '.page.server', 'extractAssets', isV1Design);
|
|
166
93
|
}
|
|
167
94
|
return fileContent;
|
|
168
95
|
}
|
|
169
|
-
function getGlobs(globRoots, isBuild, fileType, query) {
|
|
96
|
+
function getGlobs(globRoots, isBuild, fileType, query, isV1Design) {
|
|
170
97
|
const isEager = isBuild && (query === 'extractExportNames' || fileType === '.page.route');
|
|
171
98
|
let pageFilesVar;
|
|
172
99
|
if (query === 'extractExportNames') {
|
|
@@ -206,10 +133,26 @@ function getGlobs(globRoots, isBuild, fileType, query) {
|
|
|
206
133
|
varNameLocals.push(varNameLocal);
|
|
207
134
|
const globIncludePath = `'${getGlobPath(globRoot.includeDir, fileType)}'`;
|
|
208
135
|
const globExcludePath = globRoot.excludeDir ? `'!${getGlobPath(globRoot.excludeDir, fileType)}'` : null;
|
|
209
|
-
const globOptions =
|
|
210
|
-
|
|
136
|
+
const globOptions = { eager: isEager };
|
|
137
|
+
if (query) {
|
|
138
|
+
const isNewViteInterface = isVersionOrAbove(viteVersion, '5.1.0');
|
|
139
|
+
if (isNewViteInterface &&
|
|
140
|
+
// When used for the old design, the new syntax breaks Vike's CI (surprinsigly so). I couldn't reproduce locally (I didn't dig much).
|
|
141
|
+
isV1Design) {
|
|
142
|
+
globOptions.query = `?${query}`;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
globOptions.as = query;
|
|
146
|
+
const msg = [
|
|
147
|
+
"Update to the new V1 design to get rid of Vite's warning:",
|
|
148
|
+
'The glob option "as" has been deprecated in favour of "query".',
|
|
149
|
+
'See https://vike.dev/migration/v1-design for how to migrate.'
|
|
150
|
+
].join(' ');
|
|
151
|
+
assertWarning(!isNewViteInterface, msg, { onlyOnce: true });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
211
154
|
const globPaths = globExcludePath ? `[${globIncludePath}, ${globExcludePath}]` : `[${globIncludePath}]`;
|
|
212
|
-
const globLine = `const ${varNameLocal} = import.meta.glob(${globPaths}, ${globOptions});`;
|
|
155
|
+
const globLine = `const ${varNameLocal} = import.meta.glob(${globPaths}, ${JSON.stringify(globOptions)});`;
|
|
213
156
|
return globLine;
|
|
214
157
|
}),
|
|
215
158
|
`const ${varName} = {${varNameLocals.map((varNameLocal) => `...${varNameLocal}`).join(',')}};`,
|
|
@@ -217,22 +160,13 @@ function getGlobs(globRoots, isBuild, fileType, query) {
|
|
|
217
160
|
''
|
|
218
161
|
].join('\n');
|
|
219
162
|
}
|
|
220
|
-
function getGlobRoots(config
|
|
163
|
+
function getGlobRoots(config) {
|
|
221
164
|
const globRoots = [
|
|
222
165
|
{
|
|
223
166
|
includeDir: '/',
|
|
224
167
|
excludeDir: path.posix.relative(config.root, getOutDirs(config).outDirRoot)
|
|
225
168
|
}
|
|
226
169
|
];
|
|
227
|
-
configVike.extensions
|
|
228
|
-
.map(({ pageConfigsSrcDir }) => pageConfigsSrcDir)
|
|
229
|
-
.filter(isNotNullish)
|
|
230
|
-
.forEach((pageConfigsSrcDir) => {
|
|
231
|
-
const globRoot = {
|
|
232
|
-
includeDir: path.posix.relative(config.root, pageConfigsSrcDir)
|
|
233
|
-
};
|
|
234
|
-
globRoots.push(globRoot);
|
|
235
|
-
});
|
|
236
170
|
return globRoots;
|
|
237
171
|
}
|
|
238
172
|
function getGlobPath(globRootDir, fileType) {
|
|
@@ -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'`
|