vike 0.4.239-commit-95ab407 → 0.4.240
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/esm/node/runtime/globalContext.js +10 -8
- package/dist/esm/node/vite/index.js +15 -10
- package/dist/esm/node/vite/plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.d.ts +7 -0
- package/dist/esm/node/vite/plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.js +47 -0
- package/dist/esm/node/vite/plugins/{pluginNonRunnableDev.d.ts → non-runnable-dev/pluginViteRPC.d.ts} +3 -7
- package/dist/esm/node/vite/plugins/non-runnable-dev/pluginViteRPC.js +30 -0
- package/dist/esm/node/vite/plugins/pluginCommon.js +1 -7
- package/dist/esm/node/vite/plugins/pluginDev/determineOptimizeDeps.js +1 -1
- package/dist/esm/node/vite/plugins/pluginEnvVars.js +0 -2
- package/dist/esm/node/vite/plugins/pluginExtractAssets.js +1 -1
- package/dist/esm/node/vite/plugins/pluginReplaceIsClientSide.js +0 -2
- package/dist/esm/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +1 -1
- package/dist/esm/node/vite/shared/getMagicString.d.ts +1 -1
- package/dist/esm/node/vite/shared/getMagicString.js +2 -3
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/debug.js +10 -0
- package/dist/esm/utils/isDev.js +3 -1
- package/dist/esm/utils/isNonRunnableDev.js +2 -2
- package/package.json +1 -1
- package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +0 -86
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/handleAssetsManifest.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/handleAssetsManifest.js +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildApp.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildApp.js +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildConfig.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildConfig.js +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginDistFileNames.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginDistFileNames.js +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginDistPackageJsonFile.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginDistPackageJsonFile.js +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginModuleBanner.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginModuleBanner.js +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginProdBuildEntry.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginProdBuildEntry.js +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginSuppressRollupWarning.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginSuppressRollupWarning.js +0 -0
|
@@ -261,6 +261,7 @@ async function loadProdBuildEntry(outDir) {
|
|
|
261
261
|
// https://github.com/vikejs/vike/blob/8c350e8105a626469e87594d983090919e82099b/packages/vike/node/vite/plugins/pluginBuild/pluginProdBuildEntry.ts#L47
|
|
262
262
|
async function setGlobalContext_prodBuildEntry(prodBuildEntry) {
|
|
263
263
|
debug('setGlobalContext_prodBuildEntry()');
|
|
264
|
+
assert(!isNonRunnableDev());
|
|
264
265
|
assertProdBuildEntry(prodBuildEntry);
|
|
265
266
|
globalObject.prodBuildEntry = prodBuildEntry;
|
|
266
267
|
globalObject.prodBuildEntryPrevious = prodBuildEntry;
|
|
@@ -359,13 +360,14 @@ async function updateUserFiles() {
|
|
|
359
360
|
}
|
|
360
361
|
else {
|
|
361
362
|
try {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
363
|
+
// We don't directly use import() because:
|
|
364
|
+
// - Avoid Cloudflare Workers (without @cloudflare/vite-plugin) to try to bundle `import('virtual:id')`.
|
|
365
|
+
// - Using import() seems to lead to a Vite HMR bug:
|
|
366
|
+
// ```js
|
|
367
|
+
// assert(false)
|
|
368
|
+
// // This line breaks the HMR of regular (runnable) apps, even though (as per the assert() above) it's never run. It seems to be a Vite bug: handleHotUpdate() receives an empty `modules` list.
|
|
369
|
+
// import('virtual:vike:global-entry:server')
|
|
370
|
+
// ```
|
|
369
371
|
virtualFileExportsGlobalEntry = await __VIKE__DYNAMIC_IMPORT('virtual:vike:global-entry:server');
|
|
370
372
|
}
|
|
371
373
|
catch (err_) {
|
|
@@ -563,7 +565,7 @@ function isProdOptional() {
|
|
|
563
565
|
// getGlobalContextAsync(isProduction)
|
|
564
566
|
const no4 = globalObject.isProductionAccordingToUser === false;
|
|
565
567
|
// @cloudflare/vite-plugin
|
|
566
|
-
const no5 = isNonRunnableDev()
|
|
568
|
+
const no5 = isNonRunnableDev();
|
|
567
569
|
const no = no1 || no2 || no3 || no4 || no5;
|
|
568
570
|
const debug = { yes1, yes2, yes3, yes4, yes5, yes6, no1, no2, no3, no4, no5 };
|
|
569
571
|
assert(typeof yes === 'boolean', debug);
|
|
@@ -6,7 +6,7 @@ export { getVikeConfig } from './shared/resolveVikeConfigInternal.js';
|
|
|
6
6
|
export { PROJECT_VERSION as version } from './utils.js';
|
|
7
7
|
import { getClientEntrySrcDev } from './shared/getClientEntrySrcDev.js';
|
|
8
8
|
import { setGetClientEntrySrcDev } from '../runtime/renderPage/getPageAssets/retrievePageAssetsDev.js';
|
|
9
|
-
import { assertUsage } from './utils.js';
|
|
9
|
+
import { assertIsNotProductionRuntime, assertUsage } from './utils.js';
|
|
10
10
|
import pc from '@brillout/picocolors';
|
|
11
11
|
import { pluginPreview } from './plugins/pluginPreview.js';
|
|
12
12
|
import { pluginDev } from './plugins/pluginDev.js';
|
|
@@ -22,16 +22,18 @@ import { pluginWorkaroundCssModuleHmr } from './plugins/pluginWorkaroundCssModul
|
|
|
22
22
|
import { pluginWorkaroundVite6HmrRegression } from './plugins/pluginWorkaroundVite6HmrRegression.js';
|
|
23
23
|
import { pluginReplaceIsClientSide } from './plugins/pluginReplaceIsClientSide.js';
|
|
24
24
|
import { pluginReplaceGlobalThisConstants } from './plugins/pluginReplaceGlobalThisConstants.js';
|
|
25
|
-
import {
|
|
26
|
-
import { pluginBuildApp } from './plugins/
|
|
27
|
-
import { pluginDistPackageJsonFile } from './plugins/
|
|
28
|
-
import { pluginSuppressRollupWarning } from './plugins/
|
|
29
|
-
import { pluginDistFileNames } from './plugins/
|
|
30
|
-
import { pluginProdBuildEntry } from './plugins/
|
|
31
|
-
import { pluginBuildConfig } from './plugins/
|
|
32
|
-
import { pluginModuleBanner } from './plugins/
|
|
25
|
+
import { pluginViteRPC } from './plugins/non-runnable-dev/pluginViteRPC.js';
|
|
26
|
+
import { pluginBuildApp } from './plugins/build/pluginBuildApp.js';
|
|
27
|
+
import { pluginDistPackageJsonFile } from './plugins/build/pluginDistPackageJsonFile.js';
|
|
28
|
+
import { pluginSuppressRollupWarning } from './plugins/build/pluginSuppressRollupWarning.js';
|
|
29
|
+
import { pluginDistFileNames } from './plugins/build/pluginDistFileNames.js';
|
|
30
|
+
import { pluginProdBuildEntry } from './plugins/build/pluginProdBuildEntry.js';
|
|
31
|
+
import { pluginBuildConfig } from './plugins/build/pluginBuildConfig.js';
|
|
32
|
+
import { pluginModuleBanner } from './plugins/build/pluginModuleBanner.js';
|
|
33
|
+
import { pluginReplaceConstantsNonRunnableDev } from './plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.js';
|
|
33
34
|
// We don't call this in ./onLoad.ts to avoid a cyclic dependency with utils.ts
|
|
34
35
|
setGetClientEntrySrcDev(getClientEntrySrcDev);
|
|
36
|
+
assertIsNotProductionRuntime();
|
|
35
37
|
// Return `PluginInterop` instead of `Plugin` to avoid type mismatch upon different Vite versions
|
|
36
38
|
function plugin(vikeVitePluginOptions = {}) {
|
|
37
39
|
const plugins = [
|
|
@@ -50,7 +52,7 @@ function plugin(vikeVitePluginOptions = {}) {
|
|
|
50
52
|
...pluginWorkaroundVite6HmrRegression(),
|
|
51
53
|
...pluginReplaceIsClientSide(),
|
|
52
54
|
...pluginReplaceGlobalThisConstants(),
|
|
53
|
-
...
|
|
55
|
+
...pluginNonRunnabeDev(),
|
|
54
56
|
];
|
|
55
57
|
Object.assign(plugins, { _vikeVitePluginOptions: vikeVitePluginOptions });
|
|
56
58
|
return plugins;
|
|
@@ -66,6 +68,9 @@ function pluginBuild() {
|
|
|
66
68
|
...pluginModuleBanner(),
|
|
67
69
|
];
|
|
68
70
|
}
|
|
71
|
+
function pluginNonRunnabeDev() {
|
|
72
|
+
return [...pluginViteRPC(), ...pluginReplaceConstantsNonRunnableDev()];
|
|
73
|
+
}
|
|
69
74
|
// Error upon wrong usage
|
|
70
75
|
Object.defineProperty(plugin, 'apply', {
|
|
71
76
|
enumerable: true,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { pluginReplaceConstantsNonRunnableDev };
|
|
2
|
+
import type { Plugin } from 'vite';
|
|
3
|
+
declare global {
|
|
4
|
+
var __VIKE__IS_NON_RUNNABLE_DEV: undefined | true;
|
|
5
|
+
var __VIKE__DYNAMIC_IMPORT: (module: `virtual:${string}`) => Promise<Record<string, unknown>>;
|
|
6
|
+
}
|
|
7
|
+
declare function pluginReplaceConstantsNonRunnableDev(): Plugin[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export { pluginReplaceConstantsNonRunnableDev };
|
|
2
|
+
import { isRunnableDevEnvironment, isDevCheck } from '../../utils.js';
|
|
3
|
+
import { getMagicString } from '../../shared/getMagicString.js';
|
|
4
|
+
// - We cannot use [`define`](https://vite.dev/config/shared-options.html#define) because we don't have access to `this.environment` and therefore we cannot call `isRunnableDevEnvironment(this.environment)` inside a configEnvironment() hook.
|
|
5
|
+
// - We cannot use [`filter.id`](https://rolldown.rs/plugins/hook-filters) because Vite's optimizeDeps bundles packages (e.g. `vike` or `telefunc`) into node_modules/.vite/deps_ssr/chunk-WBC5FHD7.js
|
|
6
|
+
const IS_NON_RUNNABLE_DEV = 'globalThis.__VIKE__IS_NON_RUNNABLE_DEV';
|
|
7
|
+
const DYNAMIC_IMPORT = '__VIKE__DYNAMIC_IMPORT';
|
|
8
|
+
function pluginReplaceConstantsNonRunnableDev() {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
name: 'vike:pluginReplaceConstantsNonRunnableDev:IS_NON_RUNNABLE_DEV',
|
|
12
|
+
apply: (_, configEnv) => isDevCheck(configEnv),
|
|
13
|
+
transform: {
|
|
14
|
+
filter: {
|
|
15
|
+
code: {
|
|
16
|
+
include: IS_NON_RUNNABLE_DEV,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
handler(code, id) {
|
|
20
|
+
if (isRunnableDevEnvironment(this.environment))
|
|
21
|
+
return;
|
|
22
|
+
const { magicString, getMagicStringResult } = getMagicString(code, id);
|
|
23
|
+
magicString.replaceAll(IS_NON_RUNNABLE_DEV, JSON.stringify(true));
|
|
24
|
+
return getMagicStringResult();
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'vike:pluginReplaceConstantsNonRunnableDev:DYNAMIC_IMPORT',
|
|
30
|
+
apply: (_, configEnv) => isDevCheck(configEnv),
|
|
31
|
+
transform: {
|
|
32
|
+
filter: {
|
|
33
|
+
code: {
|
|
34
|
+
include: DYNAMIC_IMPORT,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
handler(code, id) {
|
|
38
|
+
if (isRunnableDevEnvironment(this.environment))
|
|
39
|
+
return;
|
|
40
|
+
const { magicString, getMagicStringResult } = getMagicString(code, id);
|
|
41
|
+
magicString.replaceAll(DYNAMIC_IMPORT, 'import');
|
|
42
|
+
return getMagicStringResult();
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
}
|
package/dist/esm/node/vite/plugins/{pluginNonRunnableDev.d.ts → non-runnable-dev/pluginViteRPC.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { pluginViteRPC };
|
|
2
2
|
import type { Plugin, ViteDevServer } from 'vite';
|
|
3
|
-
import type { ClientDependency } from '
|
|
3
|
+
import type { ClientDependency } from '../../../../shared/getPageFiles/analyzePageClientSide/ClientDependency.js';
|
|
4
4
|
export type ViteRPC = ReturnType<typeof getViteRpcFunctions>;
|
|
5
5
|
declare function getViteRpcFunctions(viteDevServer: ViteDevServer): {
|
|
6
6
|
transformIndexHtmlRPC(html: string): Promise<string>;
|
|
@@ -19,8 +19,4 @@ declare function getViteRpcFunctions(viteDevServer: ViteDevServer): {
|
|
|
19
19
|
};
|
|
20
20
|
}>;
|
|
21
21
|
};
|
|
22
|
-
declare
|
|
23
|
-
var __VIKE__DYNAMIC_IMPORT: (module: string) => Promise<Record<string, unknown>>;
|
|
24
|
-
var __VIKE__IS_NON_RUNNABLE_DEV: undefined | boolean;
|
|
25
|
-
}
|
|
26
|
-
declare function pluginNonRunnableDev(): Plugin[];
|
|
22
|
+
declare function pluginViteRPC(): Plugin[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { pluginViteRPC };
|
|
2
|
+
import { createViteRPC, isDevCheck } from '../../utils.js';
|
|
3
|
+
import { retrievePageAssetsDev } from '../../../runtime/renderPage/getPageAssets/retrievePageAssetsDev.js';
|
|
4
|
+
import { getViteConfigRuntime } from '../../shared/getViteConfigRuntime.js';
|
|
5
|
+
function getViteRpcFunctions(viteDevServer) {
|
|
6
|
+
return {
|
|
7
|
+
async transformIndexHtmlRPC(html) {
|
|
8
|
+
return await viteDevServer.transformIndexHtml('/', html);
|
|
9
|
+
},
|
|
10
|
+
async retrievePageAssetsDevRPC(clientDependencies, clientEntries) {
|
|
11
|
+
return await retrievePageAssetsDev(viteDevServer, clientDependencies, clientEntries);
|
|
12
|
+
},
|
|
13
|
+
async getViteConfigRuntimeRPC() {
|
|
14
|
+
return getViteConfigRuntime(viteDevServer.config);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function pluginViteRPC() {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
name: 'vike:pluginViteRPC:1',
|
|
22
|
+
apply: (_, configEnv) => isDevCheck(configEnv),
|
|
23
|
+
configureServer: {
|
|
24
|
+
handler(viteDevServer) {
|
|
25
|
+
createViteRPC(viteDevServer, getViteRpcFunctions);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { pluginCommon };
|
|
2
2
|
import { assert, assertUsage, assertWarning, hasProp, isDevCheck, isDocker, isObject, isVitest } from '../utils.js';
|
|
3
|
-
import { assertRollupInput } from './
|
|
3
|
+
import { assertRollupInput } from './build/pluginBuildConfig.js';
|
|
4
4
|
import { installRequireShim_setUserRootDir } from '@brillout/require-shim';
|
|
5
5
|
import pc from '@brillout/picocolors';
|
|
6
6
|
import { assertResolveAlias } from './pluginCommon/assertResolveAlias.js';
|
|
@@ -129,9 +129,6 @@ function assertVikeCliOrApi(config) {
|
|
|
129
129
|
return;
|
|
130
130
|
if (isViteCliCall()) {
|
|
131
131
|
assert(!isVitest());
|
|
132
|
-
assertWarning(false, `Vite's CLI is deprecated ${pc.underline('https://vike.dev/migration/cli')}`, {
|
|
133
|
-
onlyOnce: true,
|
|
134
|
-
});
|
|
135
132
|
return;
|
|
136
133
|
}
|
|
137
134
|
if (isVitest()) {
|
|
@@ -144,9 +141,6 @@ function assertVikeCliOrApi(config) {
|
|
|
144
141
|
});
|
|
145
142
|
return;
|
|
146
143
|
}
|
|
147
|
-
assertWarning(false, `Vite's JavaScript API is deprecated ${pc.underline('https://vike.dev/migration/cli#api')}`, {
|
|
148
|
-
onlyOnce: true,
|
|
149
|
-
});
|
|
150
144
|
}
|
|
151
145
|
// TO-DO/next-major-release: remove https://github.com/vikejs/vike/issues/2122
|
|
152
146
|
function temp_supportOldInterface(config) {
|
|
@@ -2,7 +2,7 @@ export { determineOptimizeDeps };
|
|
|
2
2
|
import { findPageFiles } from '../../shared/findPageFiles.js';
|
|
3
3
|
import { assert, assertIsImportPathNpmPackage, createDebugger, getNpmPackageName, isArray, isFilePathAbsoluteFilesystem, isVirtualFileId, } from '../../utils.js';
|
|
4
4
|
import { getVikeConfigInternal } from '../../shared/resolveVikeConfigInternal.js';
|
|
5
|
-
import { analyzeClientEntries } from '../
|
|
5
|
+
import { analyzeClientEntries } from '../build/pluginBuildConfig.js';
|
|
6
6
|
import { virtualFileIdGlobalEntryClientCR, virtualFileIdGlobalEntryClientSR } from '../../../shared/virtualFileId.js';
|
|
7
7
|
import { getFilePathResolved } from '../../shared/getFilePath.js';
|
|
8
8
|
import { getConfigValueSourcesRelevant } from '../pluginVirtualFiles/getConfigValueSourcesRelevant.js';
|
|
@@ -102,8 +102,6 @@ function pluginEnvVars() {
|
|
|
102
102
|
replacements.forEach(({ regExpStr, replacement }) => {
|
|
103
103
|
magicString.replaceAll(new RegExp(regExpStr, 'g'), JSON.stringify(replacement));
|
|
104
104
|
});
|
|
105
|
-
if (!magicString.hasChanged())
|
|
106
|
-
return null;
|
|
107
105
|
return getMagicStringResult();
|
|
108
106
|
},
|
|
109
107
|
},
|
|
@@ -12,7 +12,7 @@ import { extractAssetsAddQuery } from '../../shared/extractAssetsQuery.js';
|
|
|
12
12
|
import { isAsset } from '../shared/isAsset.js';
|
|
13
13
|
import { getImportStatements } from '../shared/parseEsModule.js';
|
|
14
14
|
import pc from '@brillout/picocolors';
|
|
15
|
-
import { handleAssetsManifest_isFixEnabled } from './
|
|
15
|
+
import { handleAssetsManifest_isFixEnabled } from './build/handleAssetsManifest.js';
|
|
16
16
|
import { getVikeConfigInternal } from '../shared/resolveVikeConfigInternal.js';
|
|
17
17
|
import { assertV1Design } from '../../shared/assertV1Design.js';
|
|
18
18
|
import { normalizeId } from '../shared/normalizeId.js';
|
|
@@ -61,8 +61,6 @@ function pluginReplaceIsClientSide() {
|
|
|
61
61
|
const regExp = getConstantRegExp(constantsIsClientSide);
|
|
62
62
|
magicString.replaceAll(regExp, JSON.stringify(replacement));
|
|
63
63
|
}
|
|
64
|
-
if (!magicString.hasChanged())
|
|
65
|
-
return null;
|
|
66
64
|
return getMagicStringResult();
|
|
67
65
|
},
|
|
68
66
|
},
|
|
@@ -5,7 +5,7 @@ import { getVikeConfigInternal } from '../../shared/resolveVikeConfigInternal.js
|
|
|
5
5
|
import { extractAssetsAddQuery } from '../../../shared/extractAssetsQuery.js';
|
|
6
6
|
import { debug } from './debug.js';
|
|
7
7
|
import { serializeConfigValues } from '../../../../shared/page-configs/serialize/serializeConfigValues.js';
|
|
8
|
-
import { handleAssetsManifest_isFixEnabled } from '../
|
|
8
|
+
import { handleAssetsManifest_isFixEnabled } from '../build/handleAssetsManifest.js';
|
|
9
9
|
import { getConfigValueBuildTime } from '../../../../shared/page-configs/getConfigValueBuildTime.js';
|
|
10
10
|
import { resolveIncludeAssetsImportedByServer } from '../../../runtime/renderPage/getPageAssets/retrievePageAssetsProd.js';
|
|
11
11
|
async function generateVirtualFilePageEntry(id, isDev) {
|
|
@@ -4,9 +4,8 @@ import MagicString from 'magic-string';
|
|
|
4
4
|
function getMagicString(code, id) {
|
|
5
5
|
const magicString = new MagicString(code);
|
|
6
6
|
const getMagicStringResult = () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
7
|
+
if (!magicString.hasChanged())
|
|
8
|
+
return undefined;
|
|
10
9
|
return {
|
|
11
10
|
code: magicString.toString(),
|
|
12
11
|
map: magicString.generateMap({ hires: true, source: id }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.240";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.
|
|
2
|
+
export const PROJECT_VERSION = '0.4.240';
|
package/dist/esm/utils/debug.js
CHANGED
|
@@ -163,6 +163,16 @@ function isDebug() {
|
|
|
163
163
|
}
|
|
164
164
|
function getDEBUG() {
|
|
165
165
|
let DEBUG;
|
|
166
|
+
// ssr.noExternal
|
|
167
|
+
/* // Full implementation:
|
|
168
|
+
// - https://github.com/vikejs/vike/commit/7637564a98f43e23834bcae2f7ada8d941958a34
|
|
169
|
+
// - https://github.com/vikejs/vike/pull/2718
|
|
170
|
+
// - We don't implement this yet because it crashes @cloudflare/vite-plugin
|
|
171
|
+
if (import.meta.env) {
|
|
172
|
+
return import.meta.env.DEBUG
|
|
173
|
+
}
|
|
174
|
+
//*/
|
|
175
|
+
// ssr.external
|
|
166
176
|
// - `process` can be undefined in edge workers
|
|
167
177
|
// - We want bundlers to be able to statically replace `process.env.*`
|
|
168
178
|
try {
|
package/dist/esm/utils/isDev.js
CHANGED
|
@@ -5,8 +5,10 @@ import { assertUsage } from './assert.js';
|
|
|
5
5
|
function isDevCheck(configEnv) {
|
|
6
6
|
const { isPreview, command } = configEnv;
|
|
7
7
|
// Note that:
|
|
8
|
-
// - `assertVersion('Vite', version, '5.1.0')`
|
|
8
|
+
// - `assertVersion('Vite', version, '5.1.0')` isn't enough: https://github.com/vitejs/vite/pull/19355
|
|
9
9
|
// - We'll eventually be able to make this an assert() instead of assertUsage() once Vike requires a Vite version that supports this.meta.viteVersion
|
|
10
|
+
// - https://github.com/vitejs/vite/pull/20088
|
|
11
|
+
// - Released at 7.0.0: https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#700-2025-06-24
|
|
10
12
|
assertUsage(typeof isPreview === 'boolean', 'You are using an old Vite version; make sure to use Vite 5.1.0 or above.');
|
|
11
13
|
return command === 'serve' && !isPreview;
|
|
12
14
|
}
|
|
@@ -3,8 +3,8 @@ import { assert } from './assert.js';
|
|
|
3
3
|
import { assertIsNotBrowser } from './assertIsNotBrowser.js';
|
|
4
4
|
assertIsNotBrowser();
|
|
5
5
|
function isNonRunnableDev() {
|
|
6
|
-
if (
|
|
6
|
+
if (globalThis.__VIKE__IS_NON_RUNNABLE_DEV === undefined)
|
|
7
7
|
return false;
|
|
8
|
-
assert(__VIKE__IS_NON_RUNNABLE_DEV === true);
|
|
8
|
+
assert(globalThis.__VIKE__IS_NON_RUNNABLE_DEV === true);
|
|
9
9
|
return true;
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
export { pluginNonRunnableDev };
|
|
2
|
-
import { createViteRPC, assertIsNotProductionRuntime, isRunnableDevEnvironment, assert, isDevCheck } from '../utils.js';
|
|
3
|
-
import { retrievePageAssetsDev } from '../../runtime/renderPage/getPageAssets/retrievePageAssetsDev.js';
|
|
4
|
-
import { getViteConfigRuntime } from '../shared/getViteConfigRuntime.js';
|
|
5
|
-
import { getMagicString } from '../shared/getMagicString.js';
|
|
6
|
-
// TODO/now: move to vite/index.ts
|
|
7
|
-
assertIsNotProductionRuntime();
|
|
8
|
-
/* We cannot use [`filter.id`](https://rolldown.rs/plugins/hook-filters) because Vite's optimizeDeps bundles the package `vike` into node_modules/.vite/deps_ssr/chunk-WBC5FHD7.js
|
|
9
|
-
const distFileIsNonRunnableDev = requireResolveDistFile('dist/esm/utils/isNonRunnableDev.js')
|
|
10
|
-
const distFileGlobalContext = requireResolveDistFile('dist/esm/node/runtime/globalContext.js')
|
|
11
|
-
const filterRolldown = {
|
|
12
|
-
id: {
|
|
13
|
-
include: [distFileIsNonRunnableDev, distFileGlobalContext].map(
|
|
14
|
-
(filePath) => new RegExp(`^${escapeRegex(filePath)}($|${escapeRegex('?')}.*)`),
|
|
15
|
-
),
|
|
16
|
-
},
|
|
17
|
-
}
|
|
18
|
-
*/
|
|
19
|
-
const __VIKE__DYNAMIC_IMPORT = '__VIKE__DYNAMIC_IMPORT';
|
|
20
|
-
const __VIKE__IS_NON_RUNNABLE_DEV = '__VIKE__IS_NON_RUNNABLE_DEV';
|
|
21
|
-
function getViteRpcFunctions(viteDevServer) {
|
|
22
|
-
return {
|
|
23
|
-
async transformIndexHtmlRPC(html) {
|
|
24
|
-
return await viteDevServer.transformIndexHtml('/', html);
|
|
25
|
-
},
|
|
26
|
-
async retrievePageAssetsDevRPC(clientDependencies, clientEntries) {
|
|
27
|
-
return await retrievePageAssetsDev(viteDevServer, clientDependencies, clientEntries);
|
|
28
|
-
},
|
|
29
|
-
async getViteConfigRuntimeRPC() {
|
|
30
|
-
return getViteConfigRuntime(viteDevServer.config);
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function pluginNonRunnableDev() {
|
|
35
|
-
let config;
|
|
36
|
-
return [
|
|
37
|
-
{
|
|
38
|
-
name: 'vike:pluginNonRunnableDev:1',
|
|
39
|
-
apply: (_, configEnv) => isDevCheck(configEnv),
|
|
40
|
-
configureServer: {
|
|
41
|
-
handler(viteDevServer) {
|
|
42
|
-
createViteRPC(viteDevServer, getViteRpcFunctions);
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
configResolved: {
|
|
46
|
-
handler(config_) {
|
|
47
|
-
config = config_;
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
transform: {
|
|
51
|
-
filter: {
|
|
52
|
-
code: {
|
|
53
|
-
include: __VIKE__IS_NON_RUNNABLE_DEV,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
handler(code, id) {
|
|
57
|
-
assert(config._isDev);
|
|
58
|
-
if (isRunnableDevEnvironment(this.environment))
|
|
59
|
-
return;
|
|
60
|
-
const { magicString, getMagicStringResult } = getMagicString(code, id);
|
|
61
|
-
magicString.replaceAll(__VIKE__IS_NON_RUNNABLE_DEV, JSON.stringify(true));
|
|
62
|
-
return getMagicStringResult();
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: 'vike:pluginNonRunnableDev:2',
|
|
68
|
-
apply: (_, configEnv) => isDevCheck(configEnv),
|
|
69
|
-
transform: {
|
|
70
|
-
filter: {
|
|
71
|
-
code: {
|
|
72
|
-
include: __VIKE__DYNAMIC_IMPORT,
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
handler(code, id) {
|
|
76
|
-
assert(config._isDev);
|
|
77
|
-
if (isRunnableDevEnvironment(this.environment))
|
|
78
|
-
return;
|
|
79
|
-
const { magicString, getMagicStringResult } = getMagicString(code, id);
|
|
80
|
-
magicString.replaceAll(__VIKE__DYNAMIC_IMPORT, 'import');
|
|
81
|
-
return getMagicStringResult();
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
];
|
|
86
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|