vike 0.4.253-commit-1d110cc → 0.4.253-commit-7b3d12e

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.
@@ -15,7 +15,7 @@ import { genPromise } from '../../../../utils/genPromise.js';
15
15
  import { assertFilePathAbsoluteFilesystem } from '../../../../utils/isFilePathAbsoluteFilesystem.js';
16
16
  import { isImportPathRelative } from '../../../../utils/isImportPath.js';
17
17
  import { isObject } from '../../../../utils/isObject.js';
18
- import { isPlainScriptFile } from '../../../../utils/isScriptFile.js';
18
+ import { isPlainScriptFile, isScriptFile } from '../../../../utils/isScriptFile.js';
19
19
  import { isVitest } from '../../../../utils/isVitest.js';
20
20
  import { assertIsImportPathNpmPackage, isImportPathNpmPackageOrPathAlias } from '../../../../utils/parseNpmPackage.js';
21
21
  import { assertPosixPath, toPosixPath } from '../../../../utils/path.js';
@@ -175,10 +175,19 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
175
175
  // - assertIsImportPathNpmPackage()
176
176
  // - isImportPathNpmPackage(str, { cannotBePathAlias: true })
177
177
  assertFilePathAbsoluteFilesystem(importPathResolved);
178
+ // Non-script file (e.g. .svg, .css) => resolve to constant string so that files with
179
+ // `meta.env: { config: true, client: true }` can also be loaded in Node.js
180
+ if (!isScriptFile(importPathResolved)) {
181
+ esbuildCache.vikeConfigDependencies.add(importPathResolved);
182
+ return {
183
+ path: importPathResolved,
184
+ namespace: 'vike-static-file',
185
+ };
186
+ }
178
187
  // Should be remove this? See comment below.
179
188
  const isVikeExtensionImport = (path.startsWith('vike-') && path.endsWith('/config')) || importPathResolved.endsWith('+config.js');
180
189
  const isPointerImport = transformImports === 'all' ||
181
- // .jsx, .vue, .svg, ... => obviously not config code => pointer import
190
+ // .jsx, .tsx, .vue, .svelte, ... => template/JSX files => pointer import
182
191
  !isPlainScriptFile(importPathResolved) ||
183
192
  // Import of a Vike extension config => make it a pointer import because we want to show nice error messages (that can display whether a config has been set by the user or by a Vike extension).
184
193
  // - Should we stop doing this? (And instead let Node.js directly load Vike extensions.)
@@ -254,6 +263,12 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
254
263
  pointerImports[importPathTranspiled] = isPointerImport;
255
264
  return { external: true, path: importPathTranspiled };
256
265
  });
266
+ build.onLoad({ filter: /.*/, namespace: 'vike-static-file' }, (args) => {
267
+ return {
268
+ contents: `export default 'STATIC_FILE_NOT_AVAILABLE:${args.path}'`,
269
+ loader: 'js',
270
+ };
271
+ });
257
272
  },
258
273
  },
259
274
  // Track dependencies
@@ -16,18 +16,7 @@ async function loadAndParseVirtualFilePageEntry(pageConfig, isDev) {
16
16
  // Catch @cloudflare/vite-plugin bug
17
17
  assertVirtualFileExports(moduleExports, () => 'configValuesSerialized' in moduleExports, moduleId);
18
18
  const virtualFileExportsPageEntry = moduleExports;
19
- let configValues;
20
- try {
21
- configValues = parseVirtualFileExportsPageEntry(virtualFileExportsPageEntry);
22
- }
23
- catch (e) {
24
- if (!(e instanceof ReferenceError))
25
- throw e;
26
- // Safari WebKit bug: dynamic import() may resolve before the module body executes,
27
- // https://github.com/vikejs/vike/issues/3121
28
- await new Promise((resolve) => setTimeout(resolve));
29
- configValues = parseVirtualFileExportsPageEntry(virtualFileExportsPageEntry);
30
- }
19
+ const configValues = parseVirtualFileExportsPageEntry(virtualFileExportsPageEntry);
31
20
  Object.assign(pageConfig.configValues, configValues);
32
21
  objectAssign(pageConfig, { isPageEntryLoaded: true });
33
22
  return pageConfig;
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.253-commit-1d110cc";
1
+ export declare const PROJECT_VERSION: "0.4.253-commit-7b3d12e";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.253-commit-1d110cc';
2
+ export const PROJECT_VERSION = '0.4.253-commit-7b3d12e';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.253-commit-1d110cc",
3
+ "version": "0.4.253-commit-7b3d12e",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {