vike 0.4.185 → 0.4.187

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.
@@ -9,7 +9,9 @@ exports.distFileNames = void 0;
9
9
  // - Blocker: https://github.com/rollup/rollup/issues/4724
10
10
  const utils_js_1 = require("../utils.js");
11
11
  const path_1 = __importDefault(require("path"));
12
+ const crypto_1 = __importDefault(require("crypto"));
12
13
  const getAssetsDir_js_1 = require("../shared/getAssetsDir.js");
14
+ const getFilePath_js_1 = require("../shared/getFilePath.js");
13
15
  function distFileNames() {
14
16
  return {
15
17
  name: 'vike:distFileNames',
@@ -39,16 +41,26 @@ function distFileNames() {
39
41
  {
40
42
  const manualChunksOriginal = rollupOutput.manualChunks;
41
43
  rollupOutput.manualChunks = function (id, ...args) {
42
- if (id.endsWith('.css') && id.includes('node_modules'))
43
- return 'vendor';
44
44
  if (manualChunksOriginal) {
45
45
  if ((0, utils_js_1.isCallable)(manualChunksOriginal)) {
46
- manualChunksOriginal.call(this, id, ...args);
46
+ const result = manualChunksOriginal.call(this, id, ...args);
47
+ if (result !== undefined)
48
+ return result;
47
49
  }
48
50
  else {
49
51
  (0, utils_js_1.assertUsage)(false, "The Vite's configuration build.rollupOptions.output.manualChunks must be a function. Reach out if you need to set it to another value.");
50
52
  }
51
53
  }
54
+ // Disable CSS bundling to workaround https://github.com/vikejs/vike/issues/1815
55
+ if (id.endsWith('.css')) {
56
+ const filePath = (0, getFilePath_js_1.getModuleFilePathAbsolute)(id, config);
57
+ const fileName = filePath.split('/').pop().split('.').slice(0, -1).join('.');
58
+ (0, getFilePath_js_1.assertModuleId)(id);
59
+ // Don't remove `?` queries, because in principle each `id` should belong to a unique bundle.
60
+ const idStable = path_1.default.posix.relative(config.root, id);
61
+ const fileHash = crypto_1.default.createHash('md5').update(idStable).digest('hex').slice(0, 8);
62
+ return `${fileName}-${fileHash}`;
63
+ }
52
64
  };
53
65
  }
54
66
  });
@@ -51,7 +51,7 @@ function envVarsPlugin() {
51
51
  if (isPrivate && isClientSide) {
52
52
  if (!envStatementRegEx.test(code))
53
53
  return;
54
- const modulePath = (0, getFilePath_js_1.getModuleFilePath)(id, config);
54
+ const modulePath = (0, getFilePath_js_1.getModuleFilePathAbsolute)(id, config);
55
55
  const errMsgAddendum = isBuild ? '' : ' (Vike will prevent your app from building for production)';
56
56
  const keyPublic = `${PUBLIC_ENV_PREFIX}${envName}`;
57
57
  const errMsg = `${envStatement} is used in client-side file ${modulePath} which means that the environment variable ${envName} will be included in client-side bundles and, therefore, ${envName} will be publicly exposed which can be a security leak${errMsgAddendum}. Use ${envStatement} only in server-side files, or rename ${envName} to ${keyPublic}, see https://vike.dev/env`;
@@ -67,7 +67,7 @@ function fileEnv() {
67
67
  return;
68
68
  // Show error message
69
69
  let errMsg;
70
- let modulePathPretty = (0, getFilePath_js_1.getModuleFilePath)(moduleId, config);
70
+ let modulePathPretty = (0, getFilePath_js_1.getModuleFilePathAbsolute)(moduleId, config);
71
71
  modulePathPretty = modulePathPretty.replaceAll(suffix, picocolors_1.default.bold(suffix));
72
72
  errMsg = `${(0, utils_js_1.capitalizeFirstLetter)(envExpect)}-only file ${modulePathPretty} (https://vike.dev/file-env) imported on the ${envActual}-side`;
73
73
  if (importer &&
@@ -75,7 +75,7 @@ function fileEnv() {
75
75
  !importer.includes('virtual:vike:') &&
76
76
  // I don't know why and who sets importer to '<stdin>' (I guess Vite?)
77
77
  importer !== '<stdin>') {
78
- const importerPath = (0, getFilePath_js_1.getModuleFilePath)(importer, config);
78
+ const importerPath = (0, getFilePath_js_1.getModuleFilePathAbsolute)(importer, config);
79
79
  errMsg += ` by ${importerPath}`;
80
80
  }
81
81
  if (isDev) {
@@ -126,7 +126,7 @@ function isVikeConfigModule(filePathAbsoluteFilesystem) {
126
126
  }
127
127
  function reloadConfig(filePath, config, op) {
128
128
  {
129
- const filePathToShowToUserResolved = (0, getFilePath_js_1.getModuleFilePath)(filePath, config);
129
+ const filePathToShowToUserResolved = (0, getFilePath_js_1.getModuleFilePathAbsolute)(filePath, config);
130
130
  const msg = `${op} ${picocolors_1.default.dim(filePathToShowToUserResolved)}`;
131
131
  (0, loggerNotProd_js_1.logConfigInfo)(msg, 'info');
132
132
  }
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getFilePathAbsoluteUserRootDir = exports.cleanFilePathUnkown = exports.getFilePathToShowToUserFromUnkown = exports.getModuleFilePath = exports.getFilePathUnresolved = exports.getFilePathResolved = void 0;
6
+ exports.assertModuleId = exports.cleanFilePathUnkown = exports.getModuleFilePathRelative = exports.getModuleFilePathAbsolute = exports.getFilePathToShowToUserFromUnkown = exports.getFilePathAbsoluteUserRootDir = exports.getFilePathUnresolved = exports.getFilePathResolved = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const utils_js_1 = require("../utils.js");
9
9
  function getFilePathResolved(args) {
@@ -76,36 +76,66 @@ function getFilePathAbsoluteUserFilesystem({ filePathAbsoluteUserRootDir, userRo
76
76
  return filePathAbsoluteFilesystem;
77
77
  }
78
78
  function getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, userRootDir }) {
79
+ const { filePathAbsoluteUserRootDir } = getFilePathRelative({
80
+ filePathAbsoluteFilesystem,
81
+ userRootDir
82
+ });
83
+ return filePathAbsoluteUserRootDir;
84
+ }
85
+ exports.getFilePathAbsoluteUserRootDir = getFilePathAbsoluteUserRootDir;
86
+ function getFilePathRelative({ filePathAbsoluteFilesystem, userRootDir }) {
79
87
  (0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
80
88
  (0, utils_js_1.assertPosixPath)(userRootDir);
81
89
  (0, utils_js_1.assertPathFilesystemAbsolute)(filePathAbsoluteFilesystem);
82
90
  (0, utils_js_1.assertPathFilesystemAbsolute)(userRootDir);
83
- const filePathRelative = path_1.default.posix.relative(userRootDir, filePathAbsoluteFilesystem);
91
+ const filePathRelativeUserRootDir = path_1.default.posix.relative(userRootDir, filePathAbsoluteFilesystem);
84
92
  if (!filePathAbsoluteFilesystem.startsWith(userRootDir)) {
85
- (0, utils_js_1.assert)(filePathRelative.startsWith('../'));
86
- return null;
93
+ (0, utils_js_1.assert)(filePathRelativeUserRootDir.startsWith('../'));
94
+ return {
95
+ filePathAbsoluteUserRootDir: null,
96
+ filePathRelativeUserRootDir
97
+ };
98
+ }
99
+ else {
100
+ (0, utils_js_1.assert)(!filePathRelativeUserRootDir.startsWith('/') &&
101
+ /* Not true if filePathRelative starts with a hidden directory (i.e. a directory with a name that starts with `.`)
102
+ !filePathRelative.startsWith('.') &&
103
+ */
104
+ !filePathRelativeUserRootDir.startsWith('./') &&
105
+ !filePathRelativeUserRootDir.startsWith('../'));
106
+ const filePathAbsoluteUserRootDir = `/${filePathRelativeUserRootDir}`;
107
+ (0, utils_js_1.assert)(filePathAbsoluteUserRootDir === getFilePathAbsoluteUserRootDir2(filePathAbsoluteFilesystem, userRootDir));
108
+ return { filePathAbsoluteUserRootDir, filePathRelativeUserRootDir };
87
109
  }
88
- (0, utils_js_1.assert)(!filePathRelative.startsWith('/') &&
89
- /* Not true if filePathRelative starts with a hidden directory (i.e. a directory with a name that starts with `.`)
90
- !filePathRelative.startsWith('.') &&
91
- */
92
- !filePathRelative.startsWith('./') &&
93
- !filePathRelative.startsWith('../'));
94
- const filePathAbsoluteUserRootDir = `/${filePathRelative}`;
95
- (0, utils_js_1.assert)(filePathAbsoluteUserRootDir === getFilePathAbsoluteUserRootDir2(filePathAbsoluteFilesystem, userRootDir));
96
- return filePathAbsoluteUserRootDir;
97
110
  }
98
- exports.getFilePathAbsoluteUserRootDir = getFilePathAbsoluteUserRootDir;
111
+ function getModuleFilePathAbsolute(moduleId, config) {
112
+ const { filePathAbsoluteUserRootDir, filePathAbsoluteFilesystem } = getModuleFilePath(moduleId, config);
113
+ return filePathAbsoluteUserRootDir || filePathAbsoluteFilesystem;
114
+ }
115
+ exports.getModuleFilePathAbsolute = getModuleFilePathAbsolute;
116
+ function getModuleFilePathRelative(moduleId, config) {
117
+ const { filePathRelativeUserRootDir } = getModuleFilePath(moduleId, config);
118
+ return filePathRelativeUserRootDir;
119
+ }
120
+ exports.getModuleFilePathRelative = getModuleFilePathRelative;
99
121
  function getModuleFilePath(moduleId, config) {
100
122
  const userRootDir = config.root;
101
- (0, utils_js_1.assertPosixPath)(moduleId);
123
+ assertModuleId(moduleId);
102
124
  (0, utils_js_1.assertPosixPath)(userRootDir);
125
+ (0, utils_js_1.assertPathFilesystemAbsolute)(userRootDir);
103
126
  const filePathAbsoluteFilesystem = cleanModuleId(moduleId);
104
127
  (0, utils_js_1.assertPathFilesystemAbsolute)(filePathAbsoluteFilesystem);
105
- const filePathAbsoluteUserRootDir = getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, userRootDir });
106
- return filePathAbsoluteUserRootDir || filePathAbsoluteFilesystem;
128
+ const { filePathAbsoluteUserRootDir, filePathRelativeUserRootDir } = getFilePathRelative({
129
+ filePathAbsoluteFilesystem,
130
+ userRootDir
131
+ });
132
+ return { filePathAbsoluteFilesystem, filePathAbsoluteUserRootDir, filePathRelativeUserRootDir };
133
+ }
134
+ function assertModuleId(moduleId) {
135
+ (0, utils_js_1.assertPosixPath)(moduleId);
136
+ (0, utils_js_1.assertPathFilesystemAbsolute)(moduleId); // Can moduleId be something else than the filesystem absolute path?
107
137
  }
108
- exports.getModuleFilePath = getModuleFilePath;
138
+ exports.assertModuleId = assertModuleId;
109
139
  function getFilePathToShowToUserFromUnkown(
110
140
  // We don't have any guarentee about filePath, e.g. about whether is filePathAbsoluteFilesystem or filePathAbsoluteUserRootDir
111
141
  filePathUnkown, userRootDir) {
@@ -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.185';
5
+ exports.PROJECT_VERSION = '0.4.187';
@@ -4,7 +4,9 @@ export { distFileNames };
4
4
  // - Blocker: https://github.com/rollup/rollup/issues/4724
5
5
  import { assertPosixPath, assert, assertUsage, isArray, isCallable } from '../utils.js';
6
6
  import path from 'path';
7
+ import crypto from 'crypto';
7
8
  import { getAssetsDir } from '../shared/getAssetsDir.js';
9
+ import { assertModuleId, getModuleFilePathAbsolute } from '../shared/getFilePath.js';
8
10
  function distFileNames() {
9
11
  return {
10
12
  name: 'vike:distFileNames',
@@ -34,16 +36,26 @@ function distFileNames() {
34
36
  {
35
37
  const manualChunksOriginal = rollupOutput.manualChunks;
36
38
  rollupOutput.manualChunks = function (id, ...args) {
37
- if (id.endsWith('.css') && id.includes('node_modules'))
38
- return 'vendor';
39
39
  if (manualChunksOriginal) {
40
40
  if (isCallable(manualChunksOriginal)) {
41
- manualChunksOriginal.call(this, id, ...args);
41
+ const result = manualChunksOriginal.call(this, id, ...args);
42
+ if (result !== undefined)
43
+ return result;
42
44
  }
43
45
  else {
44
46
  assertUsage(false, "The Vite's configuration build.rollupOptions.output.manualChunks must be a function. Reach out if you need to set it to another value.");
45
47
  }
46
48
  }
49
+ // Disable CSS bundling to workaround https://github.com/vikejs/vike/issues/1815
50
+ if (id.endsWith('.css')) {
51
+ const filePath = getModuleFilePathAbsolute(id, config);
52
+ const fileName = filePath.split('/').pop().split('.').slice(0, -1).join('.');
53
+ assertModuleId(id);
54
+ // Don't remove `?` queries, because in principle each `id` should belong to a unique bundle.
55
+ const idStable = path.posix.relative(config.root, id);
56
+ const fileHash = crypto.createHash('md5').update(idStable).digest('hex').slice(0, 8);
57
+ return `${fileName}-${fileHash}`;
58
+ }
47
59
  };
48
60
  }
49
61
  });
@@ -2,7 +2,7 @@ export { envVarsPlugin };
2
2
  import { loadEnv } from 'vite';
3
3
  import { assert, assertPosixPath, assertUsage, assertWarning, escapeRegex, isArray, lowerFirst } from '../utils.js';
4
4
  import { sourceMapPassthrough } from '../shared/rollupSourceMap.js';
5
- import { getModuleFilePath } from '../shared/getFilePath.js';
5
+ import { getModuleFilePathAbsolute } from '../shared/getFilePath.js';
6
6
  // TODO/enventually: (after we implemented vike.config.js)
7
7
  // - Make import.meta.env work inside +config.js
8
8
  // - For it to work, we'll probably need the user to define the settings (e.g. `envDir`) for loadEnv() inside vike.config.js instead of vite.config.js
@@ -49,7 +49,7 @@ function envVarsPlugin() {
49
49
  if (isPrivate && isClientSide) {
50
50
  if (!envStatementRegEx.test(code))
51
51
  return;
52
- const modulePath = getModuleFilePath(id, config);
52
+ const modulePath = getModuleFilePathAbsolute(id, config);
53
53
  const errMsgAddendum = isBuild ? '' : ' (Vike will prevent your app from building for production)';
54
54
  const keyPublic = `${PUBLIC_ENV_PREFIX}${envName}`;
55
55
  const errMsg = `${envStatement} is used in client-side file ${modulePath} which means that the environment variable ${envName} will be included in client-side bundles and, therefore, ${envName} will be publicly exposed which can be a security leak${errMsgAddendum}. Use ${envStatement} only in server-side files, or rename ${envName} to ${keyPublic}, see https://vike.dev/env`;
@@ -3,7 +3,7 @@ import { assert, assertUsage, assertWarning, capitalizeFirstLetter } from '../ut
3
3
  import { extractAssetsRE } from './extractAssetsPlugin.js';
4
4
  import { extractExportNamesRE } from './extractExportNamesPlugin.js';
5
5
  import pc from '@brillout/picocolors';
6
- import { getModuleFilePath } from '../shared/getFilePath.js';
6
+ import { getModuleFilePathAbsolute } from '../shared/getFilePath.js';
7
7
  function fileEnv() {
8
8
  let config;
9
9
  let isDev = false;
@@ -62,7 +62,7 @@ function fileEnv() {
62
62
  return;
63
63
  // Show error message
64
64
  let errMsg;
65
- let modulePathPretty = getModuleFilePath(moduleId, config);
65
+ let modulePathPretty = getModuleFilePathAbsolute(moduleId, config);
66
66
  modulePathPretty = modulePathPretty.replaceAll(suffix, pc.bold(suffix));
67
67
  errMsg = `${capitalizeFirstLetter(envExpect)}-only file ${modulePathPretty} (https://vike.dev/file-env) imported on the ${envActual}-side`;
68
68
  if (importer &&
@@ -70,7 +70,7 @@ function fileEnv() {
70
70
  !importer.includes('virtual:vike:') &&
71
71
  // I don't know why and who sets importer to '<stdin>' (I guess Vite?)
72
72
  importer !== '<stdin>') {
73
- const importerPath = getModuleFilePath(importer, config);
73
+ const importerPath = getModuleFilePathAbsolute(importer, config);
74
74
  errMsg += ` by ${importerPath}`;
75
75
  }
76
76
  if (isDev) {
@@ -9,7 +9,7 @@ import { isVirtualFileIdImportUserCode } from '../../../shared/virtual-files/vir
9
9
  import { vikeConfigDependencies, reloadVikeConfig, isVikeConfigFile } from './v1-design/getVikeConfig.js';
10
10
  import pc from '@brillout/picocolors';
11
11
  import { logConfigInfo, clearLogs } from '../../shared/loggerNotProd.js';
12
- import { getModuleFilePath } from '../../shared/getFilePath.js';
12
+ import { getModuleFilePathAbsolute } from '../../shared/getFilePath.js';
13
13
  function importUserCode() {
14
14
  let config;
15
15
  let configVike;
@@ -120,7 +120,7 @@ function isVikeConfigModule(filePathAbsoluteFilesystem) {
120
120
  }
121
121
  function reloadConfig(filePath, config, op) {
122
122
  {
123
- const filePathToShowToUserResolved = getModuleFilePath(filePath, config);
123
+ const filePathToShowToUserResolved = getModuleFilePathAbsolute(filePath, config);
124
124
  const msg = `${op} ${pc.dim(filePathToShowToUserResolved)}`;
125
125
  logConfigInfo(msg, 'info');
126
126
  }
@@ -1,9 +1,11 @@
1
1
  export { getFilePathResolved };
2
2
  export { getFilePathUnresolved };
3
- export { getModuleFilePath };
3
+ export { getFilePathAbsoluteUserRootDir };
4
4
  export { getFilePathToShowToUserFromUnkown };
5
+ export { getModuleFilePathAbsolute };
6
+ export { getModuleFilePathRelative };
5
7
  export { cleanFilePathUnkown };
6
- export { getFilePathAbsoluteUserRootDir };
8
+ export { assertModuleId };
7
9
  import type { FilePathResolved, FilePathUnresolved } from '../../../shared/page-configs/FilePath.js';
8
10
  import type { ResolvedConfig } from 'vite';
9
11
  declare function getFilePathResolved(args: {
@@ -22,6 +24,8 @@ declare function getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, us
22
24
  filePathAbsoluteFilesystem: string;
23
25
  userRootDir: string;
24
26
  }): string | null;
25
- declare function getModuleFilePath(moduleId: string, config: ResolvedConfig): string;
27
+ declare function getModuleFilePathAbsolute(moduleId: string, config: ResolvedConfig): string;
28
+ declare function getModuleFilePathRelative(moduleId: string, config: ResolvedConfig): string;
29
+ declare function assertModuleId(moduleId: string): void;
26
30
  declare function getFilePathToShowToUserFromUnkown(filePathUnkown: string, userRootDir: string): string;
27
31
  declare function cleanFilePathUnkown(filePathUnknown: string): string;
@@ -1,9 +1,11 @@
1
1
  export { getFilePathResolved };
2
2
  export { getFilePathUnresolved };
3
- export { getModuleFilePath };
3
+ export { getFilePathAbsoluteUserRootDir };
4
4
  export { getFilePathToShowToUserFromUnkown };
5
+ export { getModuleFilePathAbsolute };
6
+ export { getModuleFilePathRelative };
5
7
  export { cleanFilePathUnkown };
6
- export { getFilePathAbsoluteUserRootDir };
8
+ export { assertModuleId };
7
9
  import path from 'path';
8
10
  import { assert, assertIsNpmPackageImport, assertPathFilesystemAbsolute, assertPosixPath, toPosixPath } from '../utils.js';
9
11
  function getFilePathResolved(args) {
@@ -74,33 +76,61 @@ function getFilePathAbsoluteUserFilesystem({ filePathAbsoluteUserRootDir, userRo
74
76
  return filePathAbsoluteFilesystem;
75
77
  }
76
78
  function getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, userRootDir }) {
79
+ const { filePathAbsoluteUserRootDir } = getFilePathRelative({
80
+ filePathAbsoluteFilesystem,
81
+ userRootDir
82
+ });
83
+ return filePathAbsoluteUserRootDir;
84
+ }
85
+ function getFilePathRelative({ filePathAbsoluteFilesystem, userRootDir }) {
77
86
  assertPosixPath(filePathAbsoluteFilesystem);
78
87
  assertPosixPath(userRootDir);
79
88
  assertPathFilesystemAbsolute(filePathAbsoluteFilesystem);
80
89
  assertPathFilesystemAbsolute(userRootDir);
81
- const filePathRelative = path.posix.relative(userRootDir, filePathAbsoluteFilesystem);
90
+ const filePathRelativeUserRootDir = path.posix.relative(userRootDir, filePathAbsoluteFilesystem);
82
91
  if (!filePathAbsoluteFilesystem.startsWith(userRootDir)) {
83
- assert(filePathRelative.startsWith('../'));
84
- return null;
92
+ assert(filePathRelativeUserRootDir.startsWith('../'));
93
+ return {
94
+ filePathAbsoluteUserRootDir: null,
95
+ filePathRelativeUserRootDir
96
+ };
97
+ }
98
+ else {
99
+ assert(!filePathRelativeUserRootDir.startsWith('/') &&
100
+ /* Not true if filePathRelative starts with a hidden directory (i.e. a directory with a name that starts with `.`)
101
+ !filePathRelative.startsWith('.') &&
102
+ */
103
+ !filePathRelativeUserRootDir.startsWith('./') &&
104
+ !filePathRelativeUserRootDir.startsWith('../'));
105
+ const filePathAbsoluteUserRootDir = `/${filePathRelativeUserRootDir}`;
106
+ assert(filePathAbsoluteUserRootDir === getFilePathAbsoluteUserRootDir2(filePathAbsoluteFilesystem, userRootDir));
107
+ return { filePathAbsoluteUserRootDir, filePathRelativeUserRootDir };
85
108
  }
86
- assert(!filePathRelative.startsWith('/') &&
87
- /* Not true if filePathRelative starts with a hidden directory (i.e. a directory with a name that starts with `.`)
88
- !filePathRelative.startsWith('.') &&
89
- */
90
- !filePathRelative.startsWith('./') &&
91
- !filePathRelative.startsWith('../'));
92
- const filePathAbsoluteUserRootDir = `/${filePathRelative}`;
93
- assert(filePathAbsoluteUserRootDir === getFilePathAbsoluteUserRootDir2(filePathAbsoluteFilesystem, userRootDir));
94
- return filePathAbsoluteUserRootDir;
109
+ }
110
+ function getModuleFilePathAbsolute(moduleId, config) {
111
+ const { filePathAbsoluteUserRootDir, filePathAbsoluteFilesystem } = getModuleFilePath(moduleId, config);
112
+ return filePathAbsoluteUserRootDir || filePathAbsoluteFilesystem;
113
+ }
114
+ function getModuleFilePathRelative(moduleId, config) {
115
+ const { filePathRelativeUserRootDir } = getModuleFilePath(moduleId, config);
116
+ return filePathRelativeUserRootDir;
95
117
  }
96
118
  function getModuleFilePath(moduleId, config) {
97
119
  const userRootDir = config.root;
98
- assertPosixPath(moduleId);
120
+ assertModuleId(moduleId);
99
121
  assertPosixPath(userRootDir);
122
+ assertPathFilesystemAbsolute(userRootDir);
100
123
  const filePathAbsoluteFilesystem = cleanModuleId(moduleId);
101
124
  assertPathFilesystemAbsolute(filePathAbsoluteFilesystem);
102
- const filePathAbsoluteUserRootDir = getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, userRootDir });
103
- return filePathAbsoluteUserRootDir || filePathAbsoluteFilesystem;
125
+ const { filePathAbsoluteUserRootDir, filePathRelativeUserRootDir } = getFilePathRelative({
126
+ filePathAbsoluteFilesystem,
127
+ userRootDir
128
+ });
129
+ return { filePathAbsoluteFilesystem, filePathAbsoluteUserRootDir, filePathRelativeUserRootDir };
130
+ }
131
+ function assertModuleId(moduleId) {
132
+ assertPosixPath(moduleId);
133
+ assertPathFilesystemAbsolute(moduleId); // Can moduleId be something else than the filesystem absolute path?
104
134
  }
105
135
  function getFilePathToShowToUserFromUnkown(
106
136
  // We don't have any guarentee about filePath, e.g. about whether is filePathAbsoluteFilesystem or filePathAbsoluteUserRootDir
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.185";
1
+ export declare const PROJECT_VERSION: "0.4.187";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.185';
2
+ export const PROJECT_VERSION = '0.4.187';
@@ -1,4 +1,4 @@
1
1
  export declare const projectInfo: {
2
2
  projectName: "Vike";
3
- projectVersion: "0.4.185";
3
+ projectVersion: "0.4.187";
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.185",
3
+ "version": "0.4.187",
4
4
  "scripts": {
5
5
  "dev": "tsc --watch",
6
6
  "build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",