vike 0.4.162-commit-49fe40c → 0.4.162-commit-6812418

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.
@@ -66,24 +66,28 @@ function buildConfig() {
66
66
  buildStart() {
67
67
  assertNodeEnv();
68
68
  },
69
- async writeBundle(options, bundle) {
70
- if (isSsrBuild) {
71
- // Ideally we'd move dist/_temp_manifest.json to dist/server/client-assets.json instead of dist/assets.json
72
- // - 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)
73
- // - We'll able to do so once we replace `$ vite build` with `$ vike build`
74
- const assetsJsonFilePath = path_1.default.posix.join(outDirs.outDirRoot, 'assets.json');
75
- const clientManifestFilePath = path_1.default.posix.join(outDirs.outDirClient, manifestTempFile);
76
- const serverManifestFilePath = path_1.default.posix.join(outDirs.outDirServer, manifestTempFile);
77
- if (!isServerAssetsFixEnabled) {
78
- await promises_1.default.copyFile(clientManifestFilePath, assetsJsonFilePath);
79
- }
80
- else {
81
- const clientManifestMod = await (0, fixServerAssets_js_1.fixServerAssets)(outDirs);
82
- await promises_1.default.writeFile(assetsJsonFilePath, JSON.stringify(clientManifestMod, null, 2), 'utf-8');
69
+ writeBundle: {
70
+ order: 'post',
71
+ sequential: true,
72
+ async handler(options, bundle) {
73
+ if (isSsrBuild) {
74
+ // Ideally we'd move dist/_temp_manifest.json to dist/server/client-assets.json instead of dist/assets.json
75
+ // - 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)
76
+ // - We'll able to do so once we replace `$ vite build` with `$ vike build`
77
+ const assetsJsonFilePath = path_1.default.posix.join(outDirs.outDirRoot, 'assets.json');
78
+ const clientManifestFilePath = path_1.default.posix.join(outDirs.outDirClient, manifestTempFile);
79
+ const serverManifestFilePath = path_1.default.posix.join(outDirs.outDirServer, manifestTempFile);
80
+ if (!isServerAssetsFixEnabled) {
81
+ await promises_1.default.copyFile(clientManifestFilePath, assetsJsonFilePath);
82
+ }
83
+ else {
84
+ const clientManifestMod = await (0, fixServerAssets_js_1.fixServerAssets)(outDirs);
85
+ await promises_1.default.writeFile(assetsJsonFilePath, JSON.stringify(clientManifestMod, null, 2), 'utf-8');
86
+ }
87
+ await promises_1.default.rm(clientManifestFilePath);
88
+ await promises_1.default.rm(serverManifestFilePath);
89
+ await (0, index_js_1.set_constant_ASSETS_MAP)(options, bundle);
83
90
  }
84
- await promises_1.default.rm(clientManifestFilePath);
85
- await promises_1.default.rm(serverManifestFilePath);
86
- await (0, index_js_1.set_constant_ASSETS_MAP)(options, bundle);
87
91
  }
88
92
  }
89
93
  };
@@ -14,16 +14,18 @@ const assertResolveAlias_js_1 = require("./commonConfig/assertResolveAlias.js");
14
14
  // @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
15
15
  const importMetaUrl = `file://${__filename}`;
16
16
  const require_ = (0, module_1.createRequire)(importMetaUrl);
17
+ const pluginName = 'vike:commonConfig-1';
17
18
  function commonConfig() {
18
19
  return [
19
20
  {
20
- name: 'vike-commonConfig-1',
21
+ name: pluginName,
21
22
  configResolved(config) {
23
+ assertSingleInstance(config);
22
24
  (0, require_shim_1.installRequireShim_setUserRootDir)(config.root);
23
25
  }
24
26
  },
25
27
  {
26
- name: 'vike-.commonConfig-2',
28
+ name: 'vike:commonConfig-2',
27
29
  enforce: 'post',
28
30
  configResolved: {
29
31
  order: 'post',
@@ -81,3 +83,7 @@ function assertEsm(userViteRoot) {
81
83
  dir = picocolors_1.default.dim(dir);
82
84
  (0, utils_js_1.assertWarning)(packageJson.type === 'module', `We recommend setting ${dir}package.json#type to "module", see https://vike.dev/CJS`, { onlyOnce: true });
83
85
  }
86
+ function assertSingleInstance(config) {
87
+ const numberOfInstances = config.plugins.filter((o) => o.name === pluginName).length;
88
+ (0, utils_js_1.assertUsage)(numberOfInstances === 1, `Vike's Vite plugin (${picocolors_1.default.cyan("'import vike from 'vike/plugin'")}) is being added ${numberOfInstances} times to the list of Vite plugins. Make sure to add it only once instead.`);
89
+ }
@@ -327,6 +327,9 @@ function normalizeUrl(pageContextInit, httpRequestId) {
327
327
  if (disableUrlNormalization)
328
328
  return null;
329
329
  const { urlOriginal } = pageContextInit;
330
+ const { isPageContextRequest } = (0, handlePageContextRequestUrl_js_1.handlePageContextRequestUrl)(urlOriginal);
331
+ if (isPageContextRequest)
332
+ return null;
330
333
  const urlNormalized = (0, utils_js_1.normalizeUrlPathname)(urlOriginal, trailingSlash, baseServer);
331
334
  if (!urlNormalized)
332
335
  return null;
@@ -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.162-commit-49fe40c';
5
+ const PROJECT_VERSION = '0.4.162-commit-6812418';
6
6
  exports.PROJECT_VERSION = PROJECT_VERSION;
7
7
  const projectInfo = {
8
8
  projectName: 'Vike',
@@ -63,24 +63,28 @@ function buildConfig() {
63
63
  buildStart() {
64
64
  assertNodeEnv();
65
65
  },
66
- async writeBundle(options, bundle) {
67
- if (isSsrBuild) {
68
- // Ideally we'd move dist/_temp_manifest.json to dist/server/client-assets.json instead of dist/assets.json
69
- // - 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)
70
- // - We'll able to do so once we replace `$ vite build` with `$ vike build`
71
- const assetsJsonFilePath = path.posix.join(outDirs.outDirRoot, 'assets.json');
72
- const clientManifestFilePath = path.posix.join(outDirs.outDirClient, manifestTempFile);
73
- const serverManifestFilePath = path.posix.join(outDirs.outDirServer, manifestTempFile);
74
- if (!isServerAssetsFixEnabled) {
75
- await fs.copyFile(clientManifestFilePath, assetsJsonFilePath);
76
- }
77
- else {
78
- const clientManifestMod = await fixServerAssets(outDirs);
79
- await fs.writeFile(assetsJsonFilePath, JSON.stringify(clientManifestMod, null, 2), 'utf-8');
66
+ writeBundle: {
67
+ order: 'post',
68
+ sequential: true,
69
+ async handler(options, bundle) {
70
+ if (isSsrBuild) {
71
+ // Ideally we'd move dist/_temp_manifest.json to dist/server/client-assets.json instead of dist/assets.json
72
+ // - 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)
73
+ // - We'll able to do so once we replace `$ vite build` with `$ vike build`
74
+ const assetsJsonFilePath = path.posix.join(outDirs.outDirRoot, 'assets.json');
75
+ const clientManifestFilePath = path.posix.join(outDirs.outDirClient, manifestTempFile);
76
+ const serverManifestFilePath = path.posix.join(outDirs.outDirServer, manifestTempFile);
77
+ if (!isServerAssetsFixEnabled) {
78
+ await fs.copyFile(clientManifestFilePath, assetsJsonFilePath);
79
+ }
80
+ else {
81
+ const clientManifestMod = await fixServerAssets(outDirs);
82
+ await fs.writeFile(assetsJsonFilePath, JSON.stringify(clientManifestMod, null, 2), 'utf-8');
83
+ }
84
+ await fs.rm(clientManifestFilePath);
85
+ await fs.rm(serverManifestFilePath);
86
+ await set_constant_ASSETS_MAP(options, bundle);
80
87
  }
81
- await fs.rm(clientManifestFilePath);
82
- await fs.rm(serverManifestFilePath);
83
- await set_constant_ASSETS_MAP(options, bundle);
84
88
  }
85
89
  }
86
90
  };
@@ -1,5 +1,5 @@
1
1
  export { commonConfig };
2
- import { assert, assertWarning, findFile } from '../utils.js';
2
+ import { assert, assertUsage, assertWarning, findFile } from '../utils.js';
3
3
  import { assertRollupInput } from './buildConfig.js';
4
4
  import { installRequireShim_setUserRootDir } from '@brillout/require-shim';
5
5
  import pc from '@brillout/picocolors';
@@ -9,16 +9,18 @@ import { assertResolveAlias } from './commonConfig/assertResolveAlias.js';
9
9
  // @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
10
10
  const importMetaUrl = import.meta.url;
11
11
  const require_ = createRequire(importMetaUrl);
12
+ const pluginName = 'vike:commonConfig-1';
12
13
  function commonConfig() {
13
14
  return [
14
15
  {
15
- name: 'vike-commonConfig-1',
16
+ name: pluginName,
16
17
  configResolved(config) {
18
+ assertSingleInstance(config);
17
19
  installRequireShim_setUserRootDir(config.root);
18
20
  }
19
21
  },
20
22
  {
21
- name: 'vike-.commonConfig-2',
23
+ name: 'vike:commonConfig-2',
22
24
  enforce: 'post',
23
25
  configResolved: {
24
26
  order: 'post',
@@ -75,3 +77,7 @@ function assertEsm(userViteRoot) {
75
77
  dir = pc.dim(dir);
76
78
  assertWarning(packageJson.type === 'module', `We recommend setting ${dir}package.json#type to "module", see https://vike.dev/CJS`, { onlyOnce: true });
77
79
  }
80
+ function assertSingleInstance(config) {
81
+ const numberOfInstances = config.plugins.filter((o) => o.name === pluginName).length;
82
+ assertUsage(numberOfInstances === 1, `Vike's Vite plugin (${pc.cyan("'import vike from 'vike/plugin'")}) is being added ${numberOfInstances} times to the list of Vite plugins. Make sure to add it only once instead.`);
83
+ }
@@ -321,6 +321,9 @@ function normalizeUrl(pageContextInit, httpRequestId) {
321
321
  if (disableUrlNormalization)
322
322
  return null;
323
323
  const { urlOriginal } = pageContextInit;
324
+ const { isPageContextRequest } = handlePageContextRequestUrl(urlOriginal);
325
+ if (isPageContextRequest)
326
+ return null;
324
327
  const urlNormalized = normalizeUrlPathname(urlOriginal, trailingSlash, baseServer);
325
328
  if (!urlNormalized)
326
329
  return null;
@@ -1,7 +1,7 @@
1
1
  export { projectInfo };
2
2
  export { PROJECT_VERSION };
3
- declare const PROJECT_VERSION: "0.4.162-commit-49fe40c";
3
+ declare const PROJECT_VERSION: "0.4.162-commit-6812418";
4
4
  declare const projectInfo: {
5
5
  projectName: "Vike";
6
- projectVersion: "0.4.162-commit-49fe40c";
6
+ projectVersion: "0.4.162-commit-6812418";
7
7
  };
@@ -1,7 +1,7 @@
1
1
  export { projectInfo };
2
2
  export { PROJECT_VERSION };
3
3
  import { onProjectInfo } from './assertSingleInstance.js';
4
- const PROJECT_VERSION = '0.4.162-commit-49fe40c';
4
+ const PROJECT_VERSION = '0.4.162-commit-6812418';
5
5
  const projectInfo = {
6
6
  projectName: 'Vike',
7
7
  projectVersion: PROJECT_VERSION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.162-commit-49fe40c",
3
+ "version": "0.4.162-commit-6812418",
4
4
  "scripts": {
5
5
  "dev": "tsc --watch",
6
6
  "build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",