vike 0.4.223-commit-586dbfb → 0.4.223-commit-62ca594
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/node/api/build.js +3 -36
- package/dist/cjs/node/plugin/index.js +3 -17
- package/dist/cjs/node/plugin/plugins/{buildConfig → build/pluginAssetsManifest}/fixServerAssets.js +29 -22
- package/dist/cjs/node/plugin/plugins/build/pluginAssetsManifest.js +115 -0
- package/dist/cjs/node/plugin/plugins/{autoFullBuild.js → build/pluginAutoFullBuild.js} +15 -16
- package/dist/cjs/node/plugin/plugins/{buildApp.js → build/pluginBuildApp.js} +12 -12
- package/dist/cjs/node/plugin/plugins/{buildConfig.js → build/pluginBuildConfig.js} +18 -82
- package/dist/cjs/node/plugin/plugins/{buildEntry/index.js → build/pluginBuildEntry.js} +8 -8
- package/dist/cjs/node/plugin/plugins/{distFileNames.js → build/pluginDistFileNames.js} +6 -6
- package/dist/cjs/node/plugin/plugins/{packageJsonFile.js → build/pluginDistPackageJsonFile.js} +5 -5
- package/dist/cjs/node/plugin/plugins/{suppressRollupWarning.js → build/pluginSuppressRollupWarning.js} +3 -3
- package/dist/cjs/node/plugin/plugins/build.js +23 -0
- package/dist/cjs/node/plugin/plugins/commonConfig.js +2 -2
- package/dist/cjs/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -1
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +2 -2
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/virtual-files/getVirtualFilePageConfigValuesAll.js +1 -1
- package/dist/cjs/node/plugin/shared/resolveClientEntriesDev.js +1 -1
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/findPackageJson.js +1 -1
- package/dist/cjs/utils/requireResolve.js +1 -1
- package/dist/esm/node/api/build.js +3 -3
- package/dist/esm/node/plugin/index.js +3 -17
- package/dist/esm/node/plugin/plugins/{buildConfig → build/pluginAssetsManifest}/fixServerAssets.d.ts +7 -5
- package/dist/esm/node/plugin/plugins/{buildConfig → build/pluginAssetsManifest}/fixServerAssets.js +29 -22
- package/dist/esm/node/plugin/plugins/build/pluginAssetsManifest.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/build/pluginAssetsManifest.js +110 -0
- package/dist/esm/node/plugin/plugins/build/pluginAutoFullBuild.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/{autoFullBuild.js → build/pluginAutoFullBuild.js} +14 -15
- package/dist/esm/node/plugin/plugins/build/pluginBuildApp.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/{buildApp.js → build/pluginBuildApp.js} +12 -12
- package/dist/esm/node/plugin/plugins/{buildConfig.d.ts → build/pluginBuildConfig.d.ts} +3 -3
- package/dist/esm/node/plugin/plugins/{buildConfig.js → build/pluginBuildConfig.js} +18 -79
- package/dist/esm/node/plugin/plugins/build/pluginBuildEntry.d.ts +8 -0
- package/dist/esm/node/plugin/plugins/{buildEntry/index.js → build/pluginBuildEntry.js} +8 -8
- package/dist/esm/node/plugin/plugins/build/pluginDistFileNames.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/{distFileNames.js → build/pluginDistFileNames.js} +6 -6
- package/dist/esm/node/plugin/plugins/build/pluginDistPackageJsonFile.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/{packageJsonFile.js → build/pluginDistPackageJsonFile.js} +6 -5
- package/dist/esm/node/plugin/plugins/build/pluginSuppressRollupWarning.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/{suppressRollupWarning.js → build/pluginSuppressRollupWarning.js} +3 -3
- package/dist/esm/node/plugin/plugins/build.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/build.js +21 -0
- package/dist/esm/node/plugin/plugins/commonConfig.js +1 -1
- package/dist/esm/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -1
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -1
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/virtual-files/getVirtualFilePageConfigValuesAll.js +1 -1
- package/dist/esm/node/plugin/shared/getHttpRequestAsyncStore.js +1 -3
- package/dist/esm/node/plugin/shared/resolveClientEntriesDev.js +1 -1
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/findPackageJson.js +1 -1
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/dist/esm/utils/requireResolve.js +1 -1
- package/package.json +4 -13
- package/dist/cjs/node/plugin/plugins/removeRequireHookPlugin.js +0 -17
- package/dist/esm/node/plugin/plugins/autoFullBuild.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/buildApp.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/buildEntry/index.d.ts +0 -8
- package/dist/esm/node/plugin/plugins/distFileNames.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/packageJsonFile.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/removeRequireHookPlugin.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/removeRequireHookPlugin.js +0 -15
- package/dist/esm/node/plugin/plugins/suppressRollupWarning.d.ts +0 -3
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { isPrerenderAutoRunEnabled } from '
|
|
4
|
-
import { resolveOutDir } from '
|
|
5
|
-
import { assert } from '
|
|
6
|
-
import { getVikeConfig } from '
|
|
7
|
-
import { getFullBuildInlineConfig } from '
|
|
8
|
-
import { getVikeConfigPublic } from '
|
|
9
|
-
function
|
|
1
|
+
export { pluginBuildApp };
|
|
2
|
+
import { runPrerender_forceExit, runPrerenderFromAutoRun } from '../../../prerender/runPrerender.js';
|
|
3
|
+
import { isPrerenderAutoRunEnabled } from '../../../prerender/context.js';
|
|
4
|
+
import { resolveOutDir } from '../../shared/getOutDirs.js';
|
|
5
|
+
import { assert } from '../../utils.js';
|
|
6
|
+
import { getVikeConfig } from '../importUserCode/v1-design/getVikeConfig.js';
|
|
7
|
+
import { getFullBuildInlineConfig } from '../../shared/getFullBuildInlineConfig.js';
|
|
8
|
+
import { getVikeConfigPublic } from '../commonConfig.js';
|
|
9
|
+
function pluginBuildApp() {
|
|
10
10
|
let config;
|
|
11
|
-
// `builder.buildApp` can be overriden by another plugin e.g vike-vercel https://github.com/vikejs/vike/pull/2184#issuecomment-2659425195
|
|
11
|
+
// `builder.buildApp()` can be overriden by another plugin e.g vike-vercel https://github.com/vikejs/vike/pull/2184#issuecomment-2659425195
|
|
12
12
|
// In that case, we should'nt `forceExit`.
|
|
13
13
|
let forceExit = false;
|
|
14
14
|
return [
|
|
15
15
|
{
|
|
16
|
-
name: 'vike:
|
|
16
|
+
name: 'vike:build:pluginBuildApp',
|
|
17
17
|
apply: 'build',
|
|
18
18
|
config(config) {
|
|
19
19
|
const vike = getVikeConfigPublic(config);
|
|
@@ -52,7 +52,7 @@ function buildApp() {
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
name: 'vike:
|
|
55
|
+
name: 'vike:build:pluginBuildApp:prerender',
|
|
56
56
|
apply: 'build',
|
|
57
57
|
enforce: 'pre',
|
|
58
58
|
applyToEnvironment(env) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { pluginBuildConfig };
|
|
2
2
|
export { assertRollupInput };
|
|
3
3
|
export { analyzeClientEntries };
|
|
4
4
|
export { manifestTempFile };
|
|
5
5
|
import type { ResolvedConfig, Plugin } from 'vite';
|
|
6
|
-
import type { PageConfigBuildTime } from '
|
|
6
|
+
import type { PageConfigBuildTime } from '../../../../shared/page-configs/PageConfig.js';
|
|
7
7
|
declare const manifestTempFile = "_temp_manifest.json";
|
|
8
|
-
declare function
|
|
8
|
+
declare function pluginBuildConfig(): Plugin[];
|
|
9
9
|
declare function analyzeClientEntries(pageConfigs: PageConfigBuildTime[], config: ResolvedConfig): {
|
|
10
10
|
hasClientRouting: boolean;
|
|
11
11
|
hasServerRouting: boolean;
|
|
@@ -1,72 +1,48 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { pluginBuildConfig };
|
|
2
2
|
export { assertRollupInput };
|
|
3
3
|
export { analyzeClientEntries };
|
|
4
4
|
export { manifestTempFile };
|
|
5
|
-
import { assert, addOnBeforeLogHook, removeFileExtention, unique, assertUsage, injectRollupInputs, normalizeRollupInput, onSetupBuild, assertIsNpmPackageImport } from '
|
|
6
|
-
import { getVikeConfig
|
|
7
|
-
import { findPageFiles } from '
|
|
8
|
-
import { getVirtualFileIdPageConfigValuesAll } from '
|
|
9
|
-
import { extractAssetsAddQuery } from '
|
|
5
|
+
import { assert, addOnBeforeLogHook, removeFileExtention, unique, assertUsage, injectRollupInputs, normalizeRollupInput, onSetupBuild, assertIsNpmPackageImport } from '../../utils.js';
|
|
6
|
+
import { getVikeConfig } from '../importUserCode/v1-design/getVikeConfig.js';
|
|
7
|
+
import { findPageFiles } from '../../shared/findPageFiles.js';
|
|
8
|
+
import { getVirtualFileIdPageConfigValuesAll } from '../../../shared/virtual-files/virtualFilePageConfigValuesAll.js';
|
|
9
|
+
import { extractAssetsAddQuery } from '../../../shared/extractAssetsQuery.js';
|
|
10
10
|
import { createRequire } from 'module';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import { getConfigValueBuildTime } from '../../../shared/page-configs/getConfigValueBuildTime.js';
|
|
18
|
-
import { getOutDirs, resolveOutDir } from '../shared/getOutDirs.js';
|
|
19
|
-
import { viteIsSSR } from '../shared/viteIsSSR.js';
|
|
20
|
-
import { getVikeConfigPublic } from './commonConfig.js';
|
|
21
|
-
// @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
|
|
11
|
+
import { prependEntriesDir } from '../../../shared/prependEntriesDir.js';
|
|
12
|
+
import { getFilePathResolved } from '../../shared/getFilePath.js';
|
|
13
|
+
import { getConfigValueBuildTime } from '../../../../shared/page-configs/getConfigValueBuildTime.js';
|
|
14
|
+
import { viteIsSSR } from '../../shared/viteIsSSR.js';
|
|
15
|
+
import { resolveOutDir } from '../../shared/getOutDirs.js';
|
|
16
|
+
// @ts-ignore import.meta.url is shimmed at dist/cjs by dist-cjs-fixup.js.
|
|
22
17
|
const importMetaUrl = import.meta.url;
|
|
23
18
|
const require_ = createRequire(importMetaUrl);
|
|
24
19
|
const manifestTempFile = '_temp_manifest.json';
|
|
25
|
-
function
|
|
26
|
-
let isServerAssetsFixEnabled;
|
|
27
|
-
let outDirs;
|
|
20
|
+
function pluginBuildConfig() {
|
|
28
21
|
let config;
|
|
29
22
|
return [
|
|
30
23
|
{
|
|
31
|
-
name: 'vike:
|
|
24
|
+
name: 'vike:build:pluginBuildConfig',
|
|
32
25
|
apply: 'build',
|
|
33
26
|
enforce: 'post',
|
|
34
27
|
configResolved: {
|
|
35
28
|
order: 'post',
|
|
36
29
|
async handler(config_) {
|
|
37
|
-
config = config_;
|
|
38
30
|
onSetupBuild();
|
|
31
|
+
config = config_;
|
|
39
32
|
assertRollupInput(config);
|
|
40
33
|
const entries = await getEntries(config);
|
|
41
34
|
assert(Object.keys(entries).length > 0);
|
|
42
35
|
config.build.rollupOptions.input = injectRollupInputs(entries, config);
|
|
43
36
|
addLogHook();
|
|
44
|
-
outDirs = getOutDirs(config);
|
|
45
|
-
{
|
|
46
|
-
isServerAssetsFixEnabled = fixServerAssets_isEnabled() && (await isV1Design(config));
|
|
47
|
-
if (isServerAssetsFixEnabled) {
|
|
48
|
-
// https://github.com/vikejs/vike/issues/1339
|
|
49
|
-
config.build.ssrEmitAssets = true;
|
|
50
|
-
// Required if `ssrEmitAssets: true`, see https://github.com/vitejs/vite/pull/11430#issuecomment-1454800934
|
|
51
|
-
config.build.cssMinify = 'esbuild';
|
|
52
|
-
fixServerAssets_assertCssCodeSplit(config);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
37
|
}
|
|
56
38
|
},
|
|
57
39
|
config: {
|
|
58
40
|
order: 'post',
|
|
59
41
|
handler(config) {
|
|
60
42
|
onSetupBuild();
|
|
61
|
-
const vike = getVikeConfigPublic(config);
|
|
62
43
|
return {
|
|
63
44
|
build: {
|
|
64
|
-
outDir: resolveOutDir(config)
|
|
65
|
-
manifest: manifestTempFile,
|
|
66
|
-
copyPublicDir: vike.config.viteEnvironmentAPI
|
|
67
|
-
? // Already set by buildApp() plugin
|
|
68
|
-
undefined
|
|
69
|
-
: !viteIsSSR(config)
|
|
45
|
+
outDir: resolveOutDir(config)
|
|
70
46
|
}
|
|
71
47
|
};
|
|
72
48
|
}
|
|
@@ -76,42 +52,6 @@ function buildConfig() {
|
|
|
76
52
|
},
|
|
77
53
|
async closeBundle() {
|
|
78
54
|
onSetupBuild();
|
|
79
|
-
await fixServerAssets_assertCssTarget(config);
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: 'vike:buildConfig:pre',
|
|
84
|
-
apply: 'build',
|
|
85
|
-
applyToEnvironment(env) {
|
|
86
|
-
return env.name === 'ssr';
|
|
87
|
-
},
|
|
88
|
-
// Make sure other writeBundle() hooks are called after this writeBundle() hook.
|
|
89
|
-
// - set_ASSETS_MANIFEST() needs to be called before dist/server/ code is executed.
|
|
90
|
-
// - For example, the writeBundle() hook of vite-plugin-vercel needs to be called after this writeBundle() hook, otherwise: https://github.com/vikejs/vike/issues/1527
|
|
91
|
-
enforce: 'pre',
|
|
92
|
-
writeBundle: {
|
|
93
|
-
order: 'pre',
|
|
94
|
-
sequential: true,
|
|
95
|
-
async handler(options, bundle) {
|
|
96
|
-
if (viteIsSSR(config)) {
|
|
97
|
-
// Ideally we'd move dist/_temp_manifest.json to dist/server/client-assets.json instead of dist/assets.json
|
|
98
|
-
// - But we can't because there is no guarentee whether dist/server/ is generated before or after dist/client/ (generating dist/server/ after dist/client/ erases dist/server/client-assets.json)
|
|
99
|
-
// - We'll able to do so once we replace `$ vite build` with `$ vike build`
|
|
100
|
-
const assetsJsonFilePath = path.posix.join(outDirs.outDirRoot, 'assets.json');
|
|
101
|
-
const clientManifestFilePath = path.posix.join(outDirs.outDirClient, manifestTempFile);
|
|
102
|
-
const serverManifestFilePath = path.posix.join(outDirs.outDirServer, manifestTempFile);
|
|
103
|
-
if (!isServerAssetsFixEnabled) {
|
|
104
|
-
await fs.copyFile(clientManifestFilePath, assetsJsonFilePath);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
const { clientManifestMod } = await fixServerAssets(config);
|
|
108
|
-
await fs.writeFile(assetsJsonFilePath, JSON.stringify(clientManifestMod, null, 2), 'utf-8');
|
|
109
|
-
}
|
|
110
|
-
await fs.rm(clientManifestFilePath);
|
|
111
|
-
await fs.rm(serverManifestFilePath);
|
|
112
|
-
await set_ASSETS_MANIFEST(options, bundle);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
55
|
}
|
|
116
56
|
}
|
|
117
57
|
];
|
|
@@ -127,7 +67,6 @@ async function getEntries(config) {
|
|
|
127
67
|
if (viteIsSSR(config)) {
|
|
128
68
|
const pageEntries = getPageEntries(pageConfigs);
|
|
129
69
|
const entries = {
|
|
130
|
-
// buildEntry: resolve('dist/esm/node/buildEntry.js'), // TODO/next-major-release: remove
|
|
131
70
|
...pageFileEntries,
|
|
132
71
|
// Ensure Rollup generates a bundle per page: https://github.com/vikejs/vike/issues/349#issuecomment-1166247275
|
|
133
72
|
...pageEntries
|
|
@@ -257,8 +196,8 @@ function getEntryFromPageConfig(pageConfig, isForClientSide) {
|
|
|
257
196
|
}
|
|
258
197
|
function resolve(filePath) {
|
|
259
198
|
assert(filePath.startsWith('dist/'));
|
|
260
|
-
// [RELATIVE_PATH_FROM_DIST] Current directory: node_modules/vike/dist/esm/node/plugin/plugins/
|
|
261
|
-
return require_.resolve(
|
|
199
|
+
// [RELATIVE_PATH_FROM_DIST] Current directory: node_modules/vike/dist/esm/node/plugin/plugins/build/
|
|
200
|
+
return require_.resolve(`../../../../../../${filePath}`);
|
|
262
201
|
}
|
|
263
202
|
function addLogHook() {
|
|
264
203
|
const tty = process.stdout.isTTY && !process.env.CI; // Equals https://github.com/vitejs/vite/blob/193d55c7b9cbfec5b79ebfca276d4a721e7de14d/packages/vite/src/node/plugins/reporter.ts#L27
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { pluginBuildEntry };
|
|
2
|
+
export { set_macro_ASSETS_MANIFEST };
|
|
3
|
+
import type { Plugin, Rollup } from 'vite';
|
|
4
|
+
type Bundle = Rollup.OutputBundle;
|
|
5
|
+
type Options = Rollup.NormalizedOutputOptions;
|
|
6
|
+
declare function pluginBuildEntry(): Plugin[];
|
|
7
|
+
/** Set the value of the ASSETS_MANIFEST constant inside dist/server/entry.js (or dist/server/index.js) */
|
|
8
|
+
declare function set_macro_ASSETS_MANIFEST(options: Options, bundle: Bundle, assetsJsonFilePath: string): Promise<void>;
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { pluginBuildEntry };
|
|
2
|
+
export { set_macro_ASSETS_MANIFEST };
|
|
3
3
|
import { serverProductionEntryPlugin } from '@brillout/vite-plugin-server-entry/plugin';
|
|
4
4
|
import { virtualFileIdImportUserCodeServer } from '../../../shared/virtual-files/virtualFileImportUserCode.js';
|
|
5
5
|
import { assert, projectInfo, toPosixPath } from '../../utils.js';
|
|
6
6
|
import fs from 'fs/promises';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import { createRequire } from 'module';
|
|
9
|
-
// @ts-ignore
|
|
9
|
+
// @ts-ignore import.meta.url is shimmed at dist/cjs by dist-cjs-fixup.js.
|
|
10
10
|
const importMetaUrl = import.meta.url;
|
|
11
11
|
const require_ = createRequire(importMetaUrl);
|
|
12
12
|
import { isUsingClientRouter } from '../extractExportNamesPlugin.js';
|
|
13
13
|
import { assertBuildInfo, getViteConfigRuntime } from '../../../runtime/globalContext.js';
|
|
14
14
|
import { getOutDirs } from '../../shared/getOutDirs.js';
|
|
15
15
|
const ASSETS_MANIFEST = '__VITE_ASSETS_MANIFEST__';
|
|
16
|
-
function
|
|
16
|
+
function pluginBuildEntry() {
|
|
17
17
|
let config;
|
|
18
18
|
return [
|
|
19
19
|
{
|
|
20
|
-
name: 'vike:
|
|
20
|
+
name: 'vike:build:pluginBuildEntry',
|
|
21
|
+
apply: 'build',
|
|
21
22
|
enforce: 'post',
|
|
22
23
|
async configResolved(config_) {
|
|
23
24
|
config = config_;
|
|
@@ -59,12 +60,11 @@ function getServerProductionEntryCode(config) {
|
|
|
59
60
|
return importerCode;
|
|
60
61
|
}
|
|
61
62
|
/** Set the value of the ASSETS_MANIFEST constant inside dist/server/entry.js (or dist/server/index.js) */
|
|
62
|
-
async function
|
|
63
|
+
async function set_macro_ASSETS_MANIFEST(options, bundle, assetsJsonFilePath) {
|
|
63
64
|
const { dir } = options;
|
|
64
65
|
assert(dir);
|
|
65
66
|
const chunkPath = find_ASSETS_MANIFEST(bundle);
|
|
66
67
|
const chunkFilePath = path.join(dir, chunkPath);
|
|
67
|
-
const assetsJsonFilePath = path.join(dir, '..', 'assets.json');
|
|
68
68
|
const [assetsJsonString, chunkFileContent] = await Promise.all([
|
|
69
69
|
await fs.readFile(assetsJsonFilePath, 'utf8'),
|
|
70
70
|
await fs.readFile(chunkFilePath, 'utf8')
|
|
@@ -88,7 +88,7 @@ function find_ASSETS_MANIFEST(bundle) {
|
|
|
88
88
|
function getImportPath(config) {
|
|
89
89
|
// We resolve filePathAbsolute even if we don't use it: we use require.resolve() as an assertion that the relative path is correct
|
|
90
90
|
const filePathAbsolute = toPosixPath(
|
|
91
|
-
// [RELATIVE_PATH_FROM_DIST] Current file: node_modules/vike/dist/esm/node/plugin/plugins/
|
|
91
|
+
// [RELATIVE_PATH_FROM_DIST] Current file: node_modules/vike/dist/esm/node/plugin/plugins/pluginBuildEntry/index.js
|
|
92
92
|
require_.resolve(`../../../../../../dist/esm/__internal/index.js`));
|
|
93
93
|
if (
|
|
94
94
|
// Let's implement a new config if a user needs the import to be a relative path instead of 'vike/__internal' (AFAIK a relative path is needed only if a framework has npm package 'vike' as direct dependency instead of a peer dependency and if the user of that framework uses pnpm)
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { pluginDistFileNames };
|
|
2
2
|
// Attempt to preserve file structure of `.page.js` files:
|
|
3
3
|
// - https://github.com/vikejs/vike/commit/11a4c49e5403aa7c37c8020c462b499425b41854
|
|
4
4
|
// - Blocker: https://github.com/rollup/rollup/issues/4724
|
|
5
|
-
import { assertPosixPath, assert, assertUsage, isArray, isCallable } from '
|
|
5
|
+
import { assertPosixPath, assert, assertUsage, isArray, isCallable } from '../../utils.js';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import crypto from 'crypto';
|
|
8
|
-
import { getAssetsDir } from '
|
|
9
|
-
import { assertModuleId, getModuleFilePathAbsolute } from '
|
|
10
|
-
function
|
|
8
|
+
import { getAssetsDir } from '../../shared/getAssetsDir.js';
|
|
9
|
+
import { assertModuleId, getModuleFilePathAbsolute } from '../../shared/getFilePath.js';
|
|
10
|
+
function pluginDistFileNames() {
|
|
11
11
|
return {
|
|
12
|
-
name: 'vike:
|
|
12
|
+
name: 'vike:build:pluginDistFileNames',
|
|
13
13
|
apply: 'build',
|
|
14
14
|
enforce: 'post',
|
|
15
15
|
configResolved(config) {
|
package/dist/esm/node/plugin/plugins/{packageJsonFile.js → build/pluginDistPackageJsonFile.js}
RENAMED
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
* require() of dist/server/pageFiles.js from node_modules/vike/dist/esm/node/runtime/page-files/setup.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
|
|
7
7
|
* Reproduction: https://github.com/brillout/vite-plugin-ssr-server-import-syntax
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
|
|
9
|
+
// TODO/refactor: prefix all other plugins with `plugin` as well?
|
|
10
|
+
export { pluginDistPackageJsonFile };
|
|
11
|
+
import { rollupIsEsm } from '../../shared/rollupIsEsm.js';
|
|
12
|
+
import { viteIsSSR } from '../../shared/viteIsSSR.js';
|
|
13
|
+
function pluginDistPackageJsonFile() {
|
|
13
14
|
let config;
|
|
14
15
|
return {
|
|
15
|
-
name: 'vike:
|
|
16
|
+
name: 'vike:build:pluginDistPackageJsonFile',
|
|
16
17
|
apply: 'build',
|
|
17
18
|
configResolved(config_) {
|
|
18
19
|
config = config_;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Suppress Rollup warnings `Generated an empty chunk: "index.page.server"`
|
|
2
|
-
export {
|
|
3
|
-
function
|
|
2
|
+
export { pluginSuppressRollupWarning };
|
|
3
|
+
function pluginSuppressRollupWarning() {
|
|
4
4
|
return {
|
|
5
|
-
name: 'vike:
|
|
5
|
+
name: 'vike:build:pluginSuppressRollupWarning',
|
|
6
6
|
apply: 'build',
|
|
7
7
|
enforce: 'post',
|
|
8
8
|
async configResolved(config) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { build };
|
|
2
|
+
import { pluginAssetsManifest } from './build/pluginAssetsManifest.js';
|
|
3
|
+
import { pluginBuildApp } from './build/pluginBuildApp.js';
|
|
4
|
+
import { pluginDistPackageJsonFile } from './build/pluginDistPackageJsonFile.js';
|
|
5
|
+
import { pluginSuppressRollupWarning } from './build/pluginSuppressRollupWarning.js';
|
|
6
|
+
import { pluginDistFileNames } from './build/pluginDistFileNames.js';
|
|
7
|
+
import { pluginAutoFullBuild } from './build/pluginAutoFullBuild.js';
|
|
8
|
+
import { pluginBuildEntry } from './build/pluginBuildEntry.js';
|
|
9
|
+
import { pluginBuildConfig } from './build/pluginBuildConfig.js';
|
|
10
|
+
function build() {
|
|
11
|
+
return [
|
|
12
|
+
...pluginAssetsManifest(),
|
|
13
|
+
...pluginBuildConfig(),
|
|
14
|
+
...pluginBuildApp(),
|
|
15
|
+
...pluginAutoFullBuild(),
|
|
16
|
+
...pluginBuildEntry(),
|
|
17
|
+
pluginDistPackageJsonFile(),
|
|
18
|
+
pluginSuppressRollupWarning(),
|
|
19
|
+
pluginDistFileNames()
|
|
20
|
+
];
|
|
21
|
+
}
|
|
@@ -2,7 +2,7 @@ export { commonConfig };
|
|
|
2
2
|
export { getVikeConfigPublic };
|
|
3
3
|
import { mergeConfig } from 'vite';
|
|
4
4
|
import { assert, assertUsage, assertWarning, findPackageJson, hasProp, isDevCheck, isDocker, isObject } from '../utils.js';
|
|
5
|
-
import { assertRollupInput } from './
|
|
5
|
+
import { assertRollupInput } from './build/pluginBuildConfig.js';
|
|
6
6
|
import { installRequireShim_setUserRootDir } from '@brillout/require-shim';
|
|
7
7
|
import pc from '@brillout/picocolors';
|
|
8
8
|
import path from 'path';
|
|
@@ -5,7 +5,7 @@ import { assert } from '../../utils.js';
|
|
|
5
5
|
import { createRequire } from 'module';
|
|
6
6
|
import { dirname } from 'path';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
|
-
// @ts-ignore
|
|
8
|
+
// @ts-ignore import.meta.url is shimmed at dist/cjs by dist-cjs-fixup.js.
|
|
9
9
|
const importMetaUrl = import.meta.url;
|
|
10
10
|
const require_ = createRequire(importMetaUrl);
|
|
11
11
|
const __dirname_ = dirname(fileURLToPath(importMetaUrl));
|
|
@@ -2,7 +2,7 @@ export { determineOptimizeDeps };
|
|
|
2
2
|
import { findPageFiles } from '../../shared/findPageFiles.js';
|
|
3
3
|
import { assert, assertIsNpmPackageImport, createDebugger, isArray, unique } from '../../utils.js';
|
|
4
4
|
import { getVikeConfig } from '../importUserCode/v1-design/getVikeConfig.js';
|
|
5
|
-
import { analyzeClientEntries } from '../
|
|
5
|
+
import { analyzeClientEntries } from '../build/pluginBuildConfig.js';
|
|
6
6
|
import { virtualFileIdImportUserCodeClientCR, virtualFileIdImportUserCodeClientSR } from '../../../shared/virtual-files/virtualFileImportUserCode.js';
|
|
7
7
|
import { getFilePathResolved } from '../../shared/getFilePath.js';
|
|
8
8
|
const debug = createDebugger('vike:optimizeDeps');
|
|
@@ -13,7 +13,7 @@ import { isAsset } from '../shared/isAsset.js';
|
|
|
13
13
|
import { getImportStatements } from '../shared/parseEsModule.js';
|
|
14
14
|
import { sourceMapRemove } from '../shared/rollupSourceMap.js';
|
|
15
15
|
import pc from '@brillout/picocolors';
|
|
16
|
-
import { fixServerAssets_isEnabled } from './
|
|
16
|
+
import { fixServerAssets_isEnabled } from './build/pluginAssetsManifest/fixServerAssets.js';
|
|
17
17
|
import { getVikeConfig, isV1Design } from './importUserCode/v1-design/getVikeConfig.js';
|
|
18
18
|
import { assertV1Design } from '../../shared/assertV1Design.js';
|
|
19
19
|
import { normalizeId } from '../shared/normalizeId.js';
|
|
@@ -13,7 +13,7 @@ import { vikeConfigDependencies } from '../getVikeConfig.js';
|
|
|
13
13
|
import 'source-map-support/register.js';
|
|
14
14
|
import { getFilePathAbsoluteUserRootDir } from '../../../../shared/getFilePath.js';
|
|
15
15
|
import { createRequire } from 'module';
|
|
16
|
-
// @ts-ignore
|
|
16
|
+
// @ts-ignore import.meta.url is shimmed at dist/cjs by dist-cjs-fixup.js.
|
|
17
17
|
const importMetaUrl = import.meta.url;
|
|
18
18
|
const require_ = createRequire(importMetaUrl);
|
|
19
19
|
assertIsNotProductionRuntime();
|
|
@@ -6,7 +6,7 @@ import { extractAssetsAddQuery } from '../../../../../shared/extractAssetsQuery.
|
|
|
6
6
|
import { debug } from './debug.js';
|
|
7
7
|
import { isRuntimeEnvMatch } from './isRuntimeEnvMatch.js';
|
|
8
8
|
import { serializeConfigValues } from '../../../../../../shared/page-configs/serialize/serializeConfigValues.js';
|
|
9
|
-
import { fixServerAssets_isEnabled } from '../../../
|
|
9
|
+
import { fixServerAssets_isEnabled } from '../../../build/pluginAssetsManifest/fixServerAssets.js';
|
|
10
10
|
import { getConfigValueBuildTime } from '../../../../../../shared/page-configs/getConfigValueBuildTime.js';
|
|
11
11
|
async function getVirtualFilePageConfigValuesAll(id, isDev, config) {
|
|
12
12
|
const result = isVirtualFileIdPageConfigValuesAll(id);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// Purpose of this file:
|
|
2
2
|
// - Swallow redundant error messages (Vite is buggy and emits the same error multiple times)
|
|
3
3
|
// - Prepend "[request(n)]" tag to Vite logs
|
|
4
|
-
// The mechanism is skipped if the
|
|
5
|
-
// - Bun doesn't support Async Hooks: https://github.com/oven-sh/bun/issues/1832
|
|
6
|
-
// - Node.js and Deno support Async Hooks
|
|
4
|
+
// The mechanism is skipped if the development environment doesn't support Async Hooks.
|
|
7
5
|
// We purposely don't use config.logger.hasErrorLogged(err) because:
|
|
8
6
|
// - We don't trust Vite with such details
|
|
9
7
|
// - Example of Vite bug leading to swallowing of errors: https://github.com/vitejs/vite/issues/12631
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { resolveClientEntriesDev };
|
|
2
2
|
import { assert, assertPosixPath, toPosixPath, pathJoin, assertIsNpmPackageImport, assertIsNotProductionRuntime } from '../utils.js';
|
|
3
3
|
import { createRequire } from 'module';
|
|
4
|
-
// @ts-ignore
|
|
4
|
+
// @ts-ignore import.meta.url is shimmed at dist/cjs by dist-cjs-fixup.js.
|
|
5
5
|
const importMetaUrl = import.meta.url;
|
|
6
6
|
const require_ = createRequire(importMetaUrl);
|
|
7
7
|
assertIsNotProductionRuntime();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.223-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.223-commit-62ca594";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.223-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.223-commit-62ca594';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { findPackageJson };
|
|
2
2
|
import { findFile } from './findFile.js';
|
|
3
3
|
import { createRequire } from 'module';
|
|
4
|
-
// @ts-ignore
|
|
4
|
+
// @ts-ignore import.meta.url is shimmed at dist/cjs by dist-cjs-fixup.js.
|
|
5
5
|
const importMetaUrl = import.meta.url;
|
|
6
6
|
const require_ = createRequire(importMetaUrl);
|
|
7
7
|
function findPackageJson(cwd) {
|
|
@@ -5,7 +5,7 @@ import { assertIsNotProductionRuntime } from './assertSetup.js';
|
|
|
5
5
|
import { assertPosixPath, toPosixPath } from './path.js';
|
|
6
6
|
import { scriptFileExtensionList } from './isScriptFile.js';
|
|
7
7
|
import { createRequire } from 'module';
|
|
8
|
-
// @ts-ignore
|
|
8
|
+
// @ts-ignore import.meta.url is shimmed at dist/cjs by dist-cjs-fixup.js.
|
|
9
9
|
const importMetaUrl = import.meta.url;
|
|
10
10
|
const require_ = createRequire(importMetaUrl);
|
|
11
11
|
assertIsNotBrowser();
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.223-commit-
|
|
3
|
+
"version": "0.4.223-commit-62ca594",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
7
7
|
"worker": "./dist/esm/node/runtime/index.js",
|
|
8
|
-
"edge-light": "./dist/esm/node/runtime/index.js",
|
|
9
8
|
"require": "./dist/cjs/node/runtime/index.js",
|
|
10
9
|
"node": "./dist/esm/node/runtime/index.js",
|
|
11
10
|
"browser": "./dist/esm/client/node.js",
|
|
@@ -20,7 +19,6 @@
|
|
|
20
19
|
},
|
|
21
20
|
"./client/router": {
|
|
22
21
|
"worker": "./dist/esm/node/client/router.js",
|
|
23
|
-
"edge-light": "./dist/esm/node/client/router.js",
|
|
24
22
|
"require": "./dist/cjs/node/client/router.js",
|
|
25
23
|
"node": "./dist/esm/node/client/router.js",
|
|
26
24
|
"browser": "./dist/esm/client/client-routing-runtime/index.js",
|
|
@@ -29,7 +27,6 @@
|
|
|
29
27
|
},
|
|
30
28
|
"./routing": {
|
|
31
29
|
"worker": "./dist/esm/shared/route/routing.js",
|
|
32
|
-
"edge-light": "./dist/esm/shared/route/routing.js",
|
|
33
30
|
"require": "./dist/cjs/shared/route/routing.js",
|
|
34
31
|
"node": "./dist/esm/shared/route/routing.js",
|
|
35
32
|
"browser": "./dist/esm/shared/route/routing.js",
|
|
@@ -62,7 +59,6 @@
|
|
|
62
59
|
},
|
|
63
60
|
"./RenderErrorPage": {
|
|
64
61
|
"worker": "./dist/esm/shared/RenderErrorPage.js",
|
|
65
|
-
"edge-light": "./dist/esm/shared/RenderErrorPage.js",
|
|
66
62
|
"require": "./dist/cjs/shared/RenderErrorPage.js",
|
|
67
63
|
"node": "./dist/esm/shared/RenderErrorPage.js",
|
|
68
64
|
"browser": "./dist/esm/shared/RenderErrorPage.js",
|
|
@@ -71,7 +67,6 @@
|
|
|
71
67
|
},
|
|
72
68
|
"./abort": {
|
|
73
69
|
"worker": "./dist/esm/shared/abort.js",
|
|
74
|
-
"edge-light": "./dist/esm/shared/abort.js",
|
|
75
70
|
"require": "./dist/cjs/shared/abort.js",
|
|
76
71
|
"node": "./dist/esm/shared/abort.js",
|
|
77
72
|
"browser": "./dist/esm/shared/abort.js",
|
|
@@ -80,7 +75,6 @@
|
|
|
80
75
|
},
|
|
81
76
|
"./getPageContext": {
|
|
82
77
|
"worker": "./dist/esm/shared/getPageContext.js",
|
|
83
|
-
"edge-light": "./dist/esm/shared/getPageContext.js",
|
|
84
78
|
"require": "./dist/cjs/shared/getPageContext.js",
|
|
85
79
|
"node": "./dist/esm/shared/getPageContext.js",
|
|
86
80
|
"browser": "./dist/esm/shared/getPageContext.js",
|
|
@@ -89,7 +83,6 @@
|
|
|
89
83
|
},
|
|
90
84
|
"./modifyUrl": {
|
|
91
85
|
"worker": "./dist/esm/shared/modifyUrl.js",
|
|
92
|
-
"edge-light": "./dist/esm/shared/modifyUrl.js",
|
|
93
86
|
"require": "./dist/cjs/shared/modifyUrl.js",
|
|
94
87
|
"node": "./dist/esm/shared/modifyUrl.js",
|
|
95
88
|
"browser": "./dist/esm/shared/modifyUrl.js",
|
|
@@ -98,7 +91,6 @@
|
|
|
98
91
|
},
|
|
99
92
|
"./universal-middleware": {
|
|
100
93
|
"worker": "./dist/esm/node/runtime/universal-middleware.js",
|
|
101
|
-
"edge-light": "./dist/esm/node/runtime/universal-middleware.js",
|
|
102
94
|
"require": "./dist/cjs/node/runtime/universal-middleware.js",
|
|
103
95
|
"node": "./dist/esm/node/runtime/universal-middleware.js",
|
|
104
96
|
"browser": "./dist/esm/client/node.js",
|
|
@@ -119,7 +111,6 @@
|
|
|
119
111
|
},
|
|
120
112
|
".": {
|
|
121
113
|
"worker": "./dist/esm/node/runtime/index-deprecated.js",
|
|
122
|
-
"edge-light": "./dist/esm/node/runtime/index-deprecated.js",
|
|
123
114
|
"require": "./dist/cjs/node/runtime/index-deprecated.js",
|
|
124
115
|
"node": "./dist/esm/node/runtime/index-deprecated.js",
|
|
125
116
|
"browser": "./dist/esm/client/node.js",
|
|
@@ -128,11 +119,11 @@
|
|
|
128
119
|
}
|
|
129
120
|
},
|
|
130
121
|
"dependencies": {
|
|
131
|
-
"@brillout/import": "^0.2.
|
|
122
|
+
"@brillout/import": "^0.2.6",
|
|
132
123
|
"@brillout/json-serializer": "^0.5.15",
|
|
133
|
-
"@brillout/picocolors": "^1.0.
|
|
124
|
+
"@brillout/picocolors": "^1.0.26",
|
|
134
125
|
"@brillout/require-shim": "^0.1.2",
|
|
135
|
-
"@brillout/vite-plugin-server-entry": "^0.6.
|
|
126
|
+
"@brillout/vite-plugin-server-entry": "^0.6.3",
|
|
136
127
|
"acorn": "^8.0.0",
|
|
137
128
|
"cac": "^6.0.0",
|
|
138
129
|
"es-module-lexer": "^1.0.0",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// We remove: https://github.com/vitejs/vite/blob/dd79858ab70d2591e1239ddb19e1ce38d9913b4c/packages/vite/src/node/plugins/ssrRequireHook.ts
|
|
3
|
-
// Because it injects `require('module')` into the build which chokes bundlers, such as Cloudflare Workers's webpack-based bundler.
|
|
4
|
-
// The minimal added value of deduping React is not worth the trouble; we simply remove Vite's deduping functionality for production.
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.removeRequireHookPlugin = removeRequireHookPlugin;
|
|
7
|
-
function removeRequireHookPlugin() {
|
|
8
|
-
return {
|
|
9
|
-
name: 'vike:removeRequireHookPlugin',
|
|
10
|
-
apply: 'build',
|
|
11
|
-
configResolved(config) {
|
|
12
|
-
const pluginsMod = config.plugins.filter((plugin) => plugin.name !== 'vite:ssr-require-hook');
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
config.plugins = pluginsMod;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
}
|