vike 0.4.253-commit-468c8a0 → 0.4.253-commit-3e3975d

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.
@@ -182,11 +182,9 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
182
182
  // - assertIsImportPathNpmPackage()
183
183
  // - isImportPathNpmPackage(str, { cannotBePathAlias: true })
184
184
  assertFilePathAbsoluteFilesystem(importPathResolved);
185
- // Non-script file (e.g. .svg, .css) or explicitly tagged as runtime-only
186
- // (`import url from './logo.svg' with { type: 'runtime' }`) => resolve to
187
- // constant string so that files with `env: { config: true, client: true }`
188
- // can also be loaded in Node.js
189
- if (!isScriptFile(importPathResolved) || args.with?.['type'] === 'runtime') {
185
+ // Non-script file (e.g. .svg, .css) => resolve to constant string so that files with
186
+ // `env: { config: true, client: true }` can also be loaded in Node.js
187
+ if (!isScriptFile(importPathResolved)) {
190
188
  esbuildCache.vikeConfigDependencies.add(importPathResolved);
191
189
  return {
192
190
  path: importPathResolved,
@@ -203,7 +201,10 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
203
201
  // - In principle, we can use the setting 'name' value of Vike extensions.
204
202
  // - vike@0.4.162 started soft-requiring Vike extensions to set the name config.
205
203
  // - In practice, it seems like it requires some (non-trivial?) refactoring.
206
- isVikeExtensionImport;
204
+ isVikeExtensionImport ||
205
+ // `with { type: 'runtime' }` => regular pointer import so that the pointer import
206
+ // mechanism correctly encodes path + export name (import:path:exportName).
207
+ args.with?.['type'] === 'runtime';
207
208
  assertPosixPath(importPathResolved);
208
209
  // `isNpmPkgImport` => `importPathOriginal` is most likely an npm package import, but it can also be a path alias that a) looks like an npm package import and b) resolves outside of `userRootDir`.
209
210
  const isNpmPkgImport = (() => {
@@ -273,8 +274,10 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
273
274
  return { external: true, path: importPathTranspiled };
274
275
  });
275
276
  build.onLoad({ filter: /.*/, namespace: 'vike-static-file' }, (args) => {
277
+ // args.path is an absolute filesystem path; convert to a Vite-compatible path.
278
+ const vitePath = getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem: args.path, userRootDir }) ?? `/@fs${args.path}`;
276
279
  return {
277
- contents: `export default 'STATIC_FILE_NOT_AVAILABLE:${args.path}'`,
280
+ contents: `export default 'STATIC_FILE_NOT_AVAILABLE:${vitePath}'`,
278
281
  loader: 'js',
279
282
  };
280
283
  });
@@ -16,6 +16,7 @@ import { getConfigValueSourcesRelevant, isRuntimeEnvMatch, } from '../../../node
16
16
  const stringifyOptions = { forbidReactElements: true };
17
17
  const REPLACE_ME_BEFORE = '__VIKE__REPLACE_ME_BEFORE__';
18
18
  const REPLACE_ME_AFTER = '__VIKE__REPLACE_ME_AFTER__';
19
+ const STATIC_FILE_NOT_AVAILABLE_PREFIX = 'STATIC_FILE_NOT_AVAILABLE:';
19
20
  // This file is never loaded on the client-side but we save it under the vike/shared/ directory in order to collocate it with parsePageConfigsSerialized()
20
21
  // - vike/shared/page-configs/serialize/parsePageConfigsSerialized.ts
21
22
  // - parsePageConfigsSerialized() is loaded on both the client- and server-side.
@@ -141,6 +142,15 @@ function valueToJson(value, configName, definedAtData, importStatements, filesEn
141
142
  const replacement = [REPLACE_ME_BEFORE, importName, REPLACE_ME_AFTER].join('');
142
143
  return { replacement };
143
144
  }
145
+ // Handle STATIC_FILE_NOT_AVAILABLE strings: these are generated during config
146
+ // execution when a non-script file (e.g. .svg) or a `with { type: 'runtime' }`
147
+ // import is encountered. They must become runtime imports, not raw strings.
148
+ if (value.startsWith(STATIC_FILE_NOT_AVAILABLE_PREFIX)) {
149
+ const importPath = value.slice(STATIC_FILE_NOT_AVAILABLE_PREFIX.length);
150
+ const { importName } = addImportStatement(importStatements, importPath, 'default', filesEnv, configEnv, configName);
151
+ const replacement = [REPLACE_ME_BEFORE, importName, REPLACE_ME_AFTER].join('');
152
+ return { replacement };
153
+ }
144
154
  }
145
155
  },
146
156
  });
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.253-commit-468c8a0";
1
+ export declare const PROJECT_VERSION: "0.4.253-commit-3e3975d";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.253-commit-468c8a0';
2
+ export const PROJECT_VERSION = '0.4.253-commit-3e3975d';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.253-commit-468c8a0",
3
+ "version": "0.4.253-commit-3e3975d",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {