vike 0.4.161-commit-b829fee → 0.4.162
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/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';
|
|
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
|
/**
|
|
@@ -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'`
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js
CHANGED
|
@@ -2,52 +2,55 @@ export { transformFileImports };
|
|
|
2
2
|
export { parseImportData };
|
|
3
3
|
export { isImportData };
|
|
4
4
|
// Playground: https://github.com/brillout/acorn-playground
|
|
5
|
-
//
|
|
6
|
-
//
|
|
5
|
+
// Notes about `with { type: 'pointer' }`
|
|
6
|
+
// - It works well with TypeScript: it doesn't complain upon `with { type: 'unknown-to-typescript' }` and go-to-definition & types are preserved: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-3.html#import-attributes
|
|
7
|
+
// - Acorn support for import attributes: https://github.com/acornjs/acorn/issues/983
|
|
8
|
+
// - Acorn plugin: https://github.com/acornjs/acorn/issues/983
|
|
9
|
+
// - Isn't stage 4 yet: https://github.com/tc39/proposal-import-attributes
|
|
10
|
+
// - Using a import path suffix such as `import { Layout } from './Layout?real` breaks TypeScript, and TypeScript isn't working on supporting query params: https://github.com/microsoft/TypeScript/issues/10988#issuecomment-867135453
|
|
11
|
+
// - Node.js >=21 supports import attribtues: https://nodejs.org/api/esm.html#import-attributes
|
|
12
|
+
// - Esbuid supports
|
|
13
|
+
// - Blocker: https://github.com/evanw/esbuild/issues/3646
|
|
14
|
+
// - Ugly hack to make it work: https://github.com/brillout/esbuild-playground/tree/experiment/import-attribute
|
|
15
|
+
// - Discussion with esbuild maintainer: https://github.com/evanw/esbuild/issues/3384
|
|
16
|
+
// - Using a magic comment `// @vike-real-import` is probably a bad idea:
|
|
17
|
+
// - Esbuild removes comments: https://github.com/evanw/esbuild/issues/1439#issuecomment-877656182
|
|
18
|
+
// - Using source maps to track these magic comments is brittle (source maps can easily break)
|
|
7
19
|
import { parse } from 'acorn';
|
|
8
20
|
import { assert, assertUsage, assertWarning, styleFileRE } from '../../../../utils.js';
|
|
9
21
|
import pc from '@brillout/picocolors';
|
|
10
|
-
|
|
22
|
+
// TODO: rename transformFileImports() => transformPointerImports()
|
|
23
|
+
function transformFileImports(code, filePathToShowToUser2, pointerImports,
|
|
11
24
|
// For ./transformFileImports.spec.ts
|
|
12
25
|
skipWarnings) {
|
|
13
26
|
const spliceOperations = [];
|
|
14
|
-
const fileImportsTransformed = [];
|
|
15
27
|
// Performance trick
|
|
16
28
|
if (!code.includes('import'))
|
|
17
|
-
return
|
|
29
|
+
return null;
|
|
18
30
|
const imports = getImports(code);
|
|
19
31
|
if (imports.length === 0)
|
|
20
|
-
return
|
|
32
|
+
return null;
|
|
21
33
|
imports.forEach((node) => {
|
|
22
34
|
if (node.type !== 'ImportDeclaration')
|
|
23
35
|
return;
|
|
24
36
|
const importPath = node.source.value;
|
|
25
37
|
assert(typeof importPath === 'string');
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// - It works well with TypeScript: it doesn't complain upon `with { type: 'unknown-to-typescript' }` and go-to-definition & types are preserved: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-3.html#import-attributes
|
|
33
|
-
// - Esbuid seems to support it: https://esbuild.github.io/plugins/#on-load-arguments:~:text=This%20contains%20a%20map%20of%20the%20import%20attributes%20that
|
|
34
|
-
// - acorn supports it over an acorn plugin: https://github.com/acornjs/acorn/issues/983
|
|
35
|
-
// - Maybe we can use an esbuild plugin instead of acorn to apply transformFileImports()?
|
|
36
|
-
// - Using a magic comment `// @vike-real-import` is tricky:
|
|
37
|
-
// - Esbuild removes comments: https://github.com/evanw/esbuild/issues/1439#issuecomment-877656182
|
|
38
|
-
// - Using source maps to track these magic comments is brittle (source maps can easily break)
|
|
39
|
-
if (importPath.endsWith('?real')) {
|
|
40
|
-
const { start, end } = node.source;
|
|
41
|
-
spliceOperations.push({
|
|
42
|
-
start,
|
|
43
|
-
end,
|
|
44
|
-
replacement: importPath.slice(0, -1 * '?real'.length)
|
|
45
|
-
});
|
|
46
|
-
return;
|
|
38
|
+
if (pointerImports !== 'all') {
|
|
39
|
+
assert(importPath in pointerImports);
|
|
40
|
+
const isPointerImport = pointerImports[importPath];
|
|
41
|
+
assert(isPointerImport === true || isPointerImport === false);
|
|
42
|
+
if (!isPointerImport)
|
|
43
|
+
return;
|
|
47
44
|
}
|
|
48
45
|
const { start, end } = node;
|
|
49
46
|
const importStatementCode = code.slice(start, end);
|
|
50
|
-
|
|
47
|
+
/* Pointer import without importing any value => doesn't make sense and doesn't have any effect.
|
|
48
|
+
```js
|
|
49
|
+
// Useless
|
|
50
|
+
import './some.css'
|
|
51
|
+
// Useless
|
|
52
|
+
import './Layout.jsx'
|
|
53
|
+
``` */
|
|
51
54
|
if (node.specifiers.length === 0) {
|
|
52
55
|
const isWarning = !styleFileRE.test(importPath);
|
|
53
56
|
let quote = indent(importStatementCode);
|
|
@@ -58,8 +61,9 @@ skipWarnings) {
|
|
|
58
61
|
quote = pc.bold(pc.red(quote));
|
|
59
62
|
}
|
|
60
63
|
const errMsg = [
|
|
61
|
-
`
|
|
62
|
-
quote
|
|
64
|
+
`The following import in ${filePathToShowToUser2} has no effect:`,
|
|
65
|
+
quote,
|
|
66
|
+
'See https://vike.dev/config#pointer-imports'
|
|
63
67
|
].join('\n');
|
|
64
68
|
if (!skipWarnings) {
|
|
65
69
|
if (!isWarning) {
|
|
@@ -88,11 +92,6 @@ skipWarnings) {
|
|
|
88
92
|
})();
|
|
89
93
|
const importString = serializeImportData({ importPath, exportName, importStringWasGenerated: true });
|
|
90
94
|
replacement += `const ${importLocalName} = '${importString}';`;
|
|
91
|
-
fileImportsTransformed.push({
|
|
92
|
-
importStatementCode,
|
|
93
|
-
importString,
|
|
94
|
-
importLocalName
|
|
95
|
-
});
|
|
96
95
|
});
|
|
97
96
|
spliceOperations.push({
|
|
98
97
|
start,
|
|
@@ -101,7 +100,7 @@ skipWarnings) {
|
|
|
101
100
|
});
|
|
102
101
|
});
|
|
103
102
|
const codeMod = spliceMany(code, spliceOperations);
|
|
104
|
-
return
|
|
103
|
+
return codeMod;
|
|
105
104
|
}
|
|
106
105
|
function getImports(code) {
|
|
107
106
|
const { body } = parse(code, {
|
|
@@ -4,7 +4,7 @@ export { getConfigExecutionErrorIntroMsg };
|
|
|
4
4
|
export { isTmpFile };
|
|
5
5
|
import 'source-map-support/register.js';
|
|
6
6
|
import type { FilePathResolved } from '../../../../../../shared/page-configs/PageConfig.js';
|
|
7
|
-
declare function transpileAndExecuteFile(filePath: FilePathResolved,
|
|
7
|
+
declare function transpileAndExecuteFile(filePath: FilePathResolved, userRootDir: string, isConfigFile: boolean | 'is-extension-config'): Promise<{
|
|
8
8
|
fileExports: Record<string, unknown>;
|
|
9
9
|
}>;
|
|
10
10
|
declare function getConfigBuildErrorFormatted(err: unknown): null | string;
|