vike 0.4.188 → 0.4.189

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.
@@ -30,6 +30,7 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
30
30
  const fileEnv_js_1 = require("./plugins/fileEnv.js");
31
31
  const getPageAssets_js_1 = require("../runtime/renderPage/getPageAssets.js");
32
32
  const resolveClientEntriesDev_js_1 = require("./resolveClientEntriesDev.js");
33
+ const workaroundCssModuleHmr_js_1 = require("./plugins/workaroundCssModuleHmr.js");
33
34
  (0, utils_js_2.assertNodeEnv_onVikePluginLoad)();
34
35
  (0, utils_js_2.markEnvAsVikePluginLoaded)();
35
36
  assertViteVersion();
@@ -54,7 +55,8 @@ function plugin(vikeConfig) {
54
55
  ...(0, index_js_4.importBuild)(),
55
56
  (0, baseUrls_js_1.baseUrls)(vikeConfig),
56
57
  (0, envVars_js_1.envVarsPlugin)(),
57
- (0, fileEnv_js_1.fileEnv)()
58
+ (0, fileEnv_js_1.fileEnv)(),
59
+ (0, workaroundCssModuleHmr_js_1.workaroundCssModuleHmr)()
58
60
  ];
59
61
  return plugins;
60
62
  }
@@ -244,7 +244,7 @@ async function loadVikeConfig(userRootDir, outDirRoot, isDev, crawlWithGit) {
244
244
  .filter(([_pageId, interfaceFiles]) => isDefiningPage(interfaceFiles))
245
245
  .map(async ([locationId]) => {
246
246
  const interfaceFilesRelevant = getInterfaceFilesRelevant(interfaceFilesByLocationId, locationId);
247
- const interfaceFilesRelevantList = Object.values(interfaceFilesByLocationId).flat(1);
247
+ const interfaceFilesRelevantList = Object.values(interfaceFilesRelevant).flat(1);
248
248
  (0, assertExtensions_js_1.assertExtensionsPeerDependencies)(interfaceFilesRelevantList);
249
249
  const configDefinitions = getConfigDefinitions(interfaceFilesRelevant);
250
250
  // Load value files of custom config-only configs
@@ -296,7 +296,7 @@ async function loadVikeConfig(userRootDir, outDirRoot, isDev, crawlWithGit) {
296
296
  // - This assertUsage() message is slightly better: use this one for getGlobalConfigs()
297
297
  // Global configs should be defined at global locations
298
298
  function assertUsageGlobalConfigs(interfaceFilesRelevantList, configDefinitions, interfaceFilesByLocationId) {
299
- interfaceFilesRelevantList.forEach(async (interfaceFile) => {
299
+ interfaceFilesRelevantList.forEach((interfaceFile) => {
300
300
  const configNames = [];
301
301
  if (interfaceFile.isValueFile) {
302
302
  configNames.push(interfaceFile.configName);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.workaroundCssModuleHmr = void 0;
4
+ function workaroundCssModuleHmr() {
5
+ return {
6
+ name: 'vike:workaroundCssModuleHmr',
7
+ handleHotUpdate(ctx) {
8
+ // prevent full reload due to non self-accepting css module.
9
+ // here only "?direct" module should be filtered out as it doesn't have a parent module.
10
+ if (ctx.file.includes('module.css')) {
11
+ return ctx.modules.filter((m) => !m.id?.includes('?direct'));
12
+ }
13
+ }
14
+ };
15
+ }
16
+ exports.workaroundCssModuleHmr = workaroundCssModuleHmr;
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = void 0;
4
4
  // Automatically updated by @brillout/release-me
5
- exports.PROJECT_VERSION = '0.4.188';
5
+ exports.PROJECT_VERSION = '0.4.189';
@@ -26,6 +26,7 @@ import pc from '@brillout/picocolors';
26
26
  import { fileEnv } from './plugins/fileEnv.js';
27
27
  import { setResolveClientEntriesDev } from '../runtime/renderPage/getPageAssets.js';
28
28
  import { resolveClientEntriesDev } from './resolveClientEntriesDev.js';
29
+ import { workaroundCssModuleHmr } from './plugins/workaroundCssModuleHmr.js';
29
30
  assertNodeEnv_onVikePluginLoad();
30
31
  markEnvAsVikePluginLoaded();
31
32
  assertViteVersion();
@@ -50,7 +51,8 @@ function plugin(vikeConfig) {
50
51
  ...importBuild(),
51
52
  baseUrls(vikeConfig),
52
53
  envVarsPlugin(),
53
- fileEnv()
54
+ fileEnv(),
55
+ workaroundCssModuleHmr()
54
56
  ];
55
57
  return plugins;
56
58
  }
@@ -240,7 +240,7 @@ async function loadVikeConfig(userRootDir, outDirRoot, isDev, crawlWithGit) {
240
240
  .filter(([_pageId, interfaceFiles]) => isDefiningPage(interfaceFiles))
241
241
  .map(async ([locationId]) => {
242
242
  const interfaceFilesRelevant = getInterfaceFilesRelevant(interfaceFilesByLocationId, locationId);
243
- const interfaceFilesRelevantList = Object.values(interfaceFilesByLocationId).flat(1);
243
+ const interfaceFilesRelevantList = Object.values(interfaceFilesRelevant).flat(1);
244
244
  assertExtensionsPeerDependencies(interfaceFilesRelevantList);
245
245
  const configDefinitions = getConfigDefinitions(interfaceFilesRelevant);
246
246
  // Load value files of custom config-only configs
@@ -292,7 +292,7 @@ async function loadVikeConfig(userRootDir, outDirRoot, isDev, crawlWithGit) {
292
292
  // - This assertUsage() message is slightly better: use this one for getGlobalConfigs()
293
293
  // Global configs should be defined at global locations
294
294
  function assertUsageGlobalConfigs(interfaceFilesRelevantList, configDefinitions, interfaceFilesByLocationId) {
295
- interfaceFilesRelevantList.forEach(async (interfaceFile) => {
295
+ interfaceFilesRelevantList.forEach((interfaceFile) => {
296
296
  const configNames = [];
297
297
  if (interfaceFile.isValueFile) {
298
298
  configNames.push(interfaceFile.configName);
@@ -0,0 +1,3 @@
1
+ export { workaroundCssModuleHmr };
2
+ import type { Plugin } from 'vite';
3
+ declare function workaroundCssModuleHmr(): Plugin;
@@ -0,0 +1,13 @@
1
+ export { workaroundCssModuleHmr };
2
+ function workaroundCssModuleHmr() {
3
+ return {
4
+ name: 'vike:workaroundCssModuleHmr',
5
+ handleHotUpdate(ctx) {
6
+ // prevent full reload due to non self-accepting css module.
7
+ // here only "?direct" module should be filtered out as it doesn't have a parent module.
8
+ if (ctx.file.includes('module.css')) {
9
+ return ctx.modules.filter((m) => !m.id?.includes('?direct'));
10
+ }
11
+ }
12
+ };
13
+ }
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.188";
1
+ export declare const PROJECT_VERSION: "0.4.189";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.188';
2
+ export const PROJECT_VERSION = '0.4.189';
@@ -1,4 +1,4 @@
1
1
  export declare const projectInfo: {
2
2
  projectName: "Vike";
3
- projectVersion: "0.4.188";
3
+ projectVersion: "0.4.189";
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.188",
3
+ "version": "0.4.189",
4
4
  "scripts": {
5
5
  "dev": "tsc --watch",
6
6
  "build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",