vike 0.4.169 → 0.4.171

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.
@@ -139,9 +139,10 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
139
139
  // - When tsconfig.js#compilerOptions.paths is set, then esbuild is able to resolve the path alias.
140
140
  resolved.errors.length > 0;
141
141
  (0, utils_js_1.assertPosixPath)(importPathResolved);
142
+ const isNodeModules = importPathResolved.includes('/node_modules/');
142
143
  const isExternal = isPointerImport ||
143
144
  // Performance: npm package imports that aren't pointer imports can be externalized. For example, if Vike eventually adds support for setting Vite configs in the vike.config.js file, then the user may import a Vite plugin in his vike.config.js file. (We could as well let esbuild always transpile /node_modules/ code but it would be useless and would unnecessarily slow down transpilation.)
144
- importPathResolved.includes('/node_modules/');
145
+ isNodeModules;
145
146
  const filePathAbsoluteUserRootDir = (0, getFilePath_js_1.getFilePathAbsoluteUserRootDir)({
146
147
  filePathAbsoluteFilesystem: importPathResolved,
147
148
  userRootDir
@@ -166,8 +167,8 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
166
167
  // importPathOriginal is either:
167
168
  // - Npm package import
168
169
  // - Path alias
169
- if (filePathAbsoluteUserRootDir) {
170
- // importPathOriginal is most likely a path alias. (Is it even possible for an npm package import to resolved inside `userRootDir`?)
170
+ if (filePathAbsoluteUserRootDir && !isNodeModules) {
171
+ // importPathOriginal is most likely (always?) a path alias.
171
172
  importPathTranspiled = importPathResolved;
172
173
  }
173
174
  else {
@@ -132,6 +132,7 @@ async function loadInterfaceFiles(userRootDir, outDirRoot, isDev) {
132
132
  'vike-pinia',
133
133
  'vike-solid'
134
134
  ];
135
+ (0, utils_js_1.assert)(extendsConfig.filePath.importPathAbsolute);
135
136
  const extensionName = extendsConfig.filePath.importPathAbsolute.split('/')[0];
136
137
  const warnMsg = alreadyMigrated.includes(extensionName)
137
138
  ? `You're using a deprecated version of the Vike extension ${extensionName}, update ${extensionName} to its latest version.`
@@ -270,7 +271,6 @@ async function loadVikeConfig(userRootDir, outDirRoot, isDev) {
270
271
  if (isGlobalConfig(configName))
271
272
  return;
272
273
  const configDef = getConfigDefinition(configDefinitions, configName, interfaceFile.filePath.filePathToShowToUser);
273
- configDef.env = deriveConfigEnvFromFileName(configDef.env, interfaceFile.filePath.fileName);
274
274
  if (!isConfigEnv(configDef, configName))
275
275
  return;
276
276
  const isAlreadyLoaded = interfacefileIsAlreaydLoaded(interfaceFile);
@@ -501,7 +501,7 @@ function isInterfaceFileUserLand(interfaceFile) {
501
501
  async function getConfigValueSource(configName, interfaceFile, configDef, userRootDir, importedFilesLoaded) {
502
502
  const conf = interfaceFile.fileExportsByConfigName[configName];
503
503
  (0, utils_js_1.assert)(conf);
504
- const configEnv = configDef.env;
504
+ const configEnv = deriveConfigEnvFromFileName(configDef.env, interfaceFile.filePath.fileName);
505
505
  const { locationId } = interfaceFile;
506
506
  const definedAtFilePath_ = {
507
507
  ...interfaceFile.filePath,
@@ -938,6 +938,7 @@ function mergeCumulative(configName, configValueSources) {
938
938
  function getConfigEnvValue(val, errMsgIntro) {
939
939
  const errInvalidValue = `${errMsgIntro} an invalid value ${picocolors_1.default.cyan(JSON.stringify(val))}`;
940
940
  // Legacy outdated values
941
+ // TODO/v1-release: remove
941
942
  if (typeof val === 'string') {
942
943
  const valConverted = (() => {
943
944
  if (val === 'client-only')
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = exports.projectInfo = void 0;
4
- const PROJECT_VERSION = '0.4.169';
4
+ const PROJECT_VERSION = '0.4.171';
5
5
  exports.PROJECT_VERSION = PROJECT_VERSION;
6
6
  const projectInfo = {
7
7
  projectName: 'Vike',
@@ -136,9 +136,10 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
136
136
  // - When tsconfig.js#compilerOptions.paths is set, then esbuild is able to resolve the path alias.
137
137
  resolved.errors.length > 0;
138
138
  assertPosixPath(importPathResolved);
139
+ const isNodeModules = importPathResolved.includes('/node_modules/');
139
140
  const isExternal = isPointerImport ||
140
141
  // Performance: npm package imports that aren't pointer imports can be externalized. For example, if Vike eventually adds support for setting Vite configs in the vike.config.js file, then the user may import a Vite plugin in his vike.config.js file. (We could as well let esbuild always transpile /node_modules/ code but it would be useless and would unnecessarily slow down transpilation.)
141
- importPathResolved.includes('/node_modules/');
142
+ isNodeModules;
142
143
  const filePathAbsoluteUserRootDir = getFilePathAbsoluteUserRootDir({
143
144
  filePathAbsoluteFilesystem: importPathResolved,
144
145
  userRootDir
@@ -163,8 +164,8 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
163
164
  // importPathOriginal is either:
164
165
  // - Npm package import
165
166
  // - Path alias
166
- if (filePathAbsoluteUserRootDir) {
167
- // importPathOriginal is most likely a path alias. (Is it even possible for an npm package import to resolved inside `userRootDir`?)
167
+ if (filePathAbsoluteUserRootDir && !isNodeModules) {
168
+ // importPathOriginal is most likely (always?) a path alias.
168
169
  importPathTranspiled = importPathResolved;
169
170
  }
170
171
  else {
@@ -127,6 +127,7 @@ async function loadInterfaceFiles(userRootDir, outDirRoot, isDev) {
127
127
  'vike-pinia',
128
128
  'vike-solid'
129
129
  ];
130
+ assert(extendsConfig.filePath.importPathAbsolute);
130
131
  const extensionName = extendsConfig.filePath.importPathAbsolute.split('/')[0];
131
132
  const warnMsg = alreadyMigrated.includes(extensionName)
132
133
  ? `You're using a deprecated version of the Vike extension ${extensionName}, update ${extensionName} to its latest version.`
@@ -265,7 +266,6 @@ async function loadVikeConfig(userRootDir, outDirRoot, isDev) {
265
266
  if (isGlobalConfig(configName))
266
267
  return;
267
268
  const configDef = getConfigDefinition(configDefinitions, configName, interfaceFile.filePath.filePathToShowToUser);
268
- configDef.env = deriveConfigEnvFromFileName(configDef.env, interfaceFile.filePath.fileName);
269
269
  if (!isConfigEnv(configDef, configName))
270
270
  return;
271
271
  const isAlreadyLoaded = interfacefileIsAlreaydLoaded(interfaceFile);
@@ -496,7 +496,7 @@ function isInterfaceFileUserLand(interfaceFile) {
496
496
  async function getConfigValueSource(configName, interfaceFile, configDef, userRootDir, importedFilesLoaded) {
497
497
  const conf = interfaceFile.fileExportsByConfigName[configName];
498
498
  assert(conf);
499
- const configEnv = configDef.env;
499
+ const configEnv = deriveConfigEnvFromFileName(configDef.env, interfaceFile.filePath.fileName);
500
500
  const { locationId } = interfaceFile;
501
501
  const definedAtFilePath_ = {
502
502
  ...interfaceFile.filePath,
@@ -932,6 +932,7 @@ function mergeCumulative(configName, configValueSources) {
932
932
  function getConfigEnvValue(val, errMsgIntro) {
933
933
  const errInvalidValue = `${errMsgIntro} an invalid value ${pc.cyan(JSON.stringify(val))}`;
934
934
  // Legacy outdated values
935
+ // TODO/v1-release: remove
935
936
  if (typeof val === 'string') {
936
937
  const valConverted = (() => {
937
938
  if (val === 'client-only')
@@ -1,7 +1,7 @@
1
1
  export { projectInfo };
2
2
  export { PROJECT_VERSION };
3
- declare const PROJECT_VERSION: "0.4.169";
3
+ declare const PROJECT_VERSION: "0.4.171";
4
4
  declare const projectInfo: {
5
5
  projectName: "Vike";
6
- projectVersion: "0.4.169";
6
+ projectVersion: "0.4.171";
7
7
  };
@@ -1,6 +1,6 @@
1
1
  export { projectInfo };
2
2
  export { PROJECT_VERSION };
3
- const PROJECT_VERSION = '0.4.169';
3
+ const PROJECT_VERSION = '0.4.171';
4
4
  const projectInfo = {
5
5
  projectName: 'Vike',
6
6
  projectVersion: PROJECT_VERSION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.169",
3
+ "version": "0.4.171",
4
4
  "scripts": {
5
5
  "dev": "tsc --watch",
6
6
  "build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",