vike 0.4.253-commit-56475f3 → 0.4.253-commit-6255ff2

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.
@@ -199,7 +199,7 @@ declare function getPageContextFromHooksClient_firstRender(pageContext: PageCont
199
199
  sources: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Sources;
200
200
  pageExports: Record<string, unknown>;
201
201
  isBaseMissing?: true;
202
- }, "pageId" | "exports" | "config" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "pageExports" | "routeParams" | "abortReason"> & {
202
+ }, "config" | "pageId" | "exports" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "pageExports" | "routeParams" | "abortReason"> & {
203
203
  isClientSide: true;
204
204
  isPrerendering: false;
205
205
  cspNonce?: undefined;
@@ -262,7 +262,7 @@ declare function getPageContextFromHooksClient_firstRender(pageContext: PageCont
262
262
  sources: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Sources;
263
263
  pageExports: Record<string, unknown>;
264
264
  isBaseMissing?: true;
265
- }, "pageId" | "exports" | "config" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "pageExports" | "routeParams" | "abortReason"> & {
265
+ }, "config" | "pageId" | "exports" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "pageExports" | "routeParams" | "abortReason"> & {
266
266
  isClientSide: true;
267
267
  isPrerendering: false;
268
268
  cspNonce?: undefined;
@@ -485,7 +485,7 @@ declare function getPageContextFromHooksClient(pageContext: {
485
485
  sources: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Sources;
486
486
  pageExports: Record<string, unknown>;
487
487
  isBaseMissing?: true;
488
- }, "pageId" | "exports" | "config" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "pageExports" | "routeParams" | "abortReason"> & {
488
+ }, "config" | "pageId" | "exports" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "pageExports" | "routeParams" | "abortReason"> & {
489
489
  isClientSide: true;
490
490
  isPrerendering: false;
491
491
  cspNonce?: undefined;
@@ -546,7 +546,7 @@ declare function getPageContextFromHooksClient(pageContext: {
546
546
  sources: import("../../shared-server-client/page-configs/resolveVikeConfigPublic.js").Sources;
547
547
  pageExports: Record<string, unknown>;
548
548
  isBaseMissing?: true;
549
- }, "pageId" | "exports" | "config" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "pageExports" | "routeParams" | "abortReason"> & {
549
+ }, "config" | "pageId" | "exports" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "pageExports" | "routeParams" | "abortReason"> & {
550
550
  isClientSide: true;
551
551
  isPrerendering: false;
552
552
  cspNonce?: undefined;
@@ -1,2 +1,2 @@
1
1
  import '../../../assertEnvVite.js';
2
- export declare const ignorePatternsBuiltIn: readonly ["**/node_modules/**", "**/ejected/**", "**/*.telefunc.*", "**/.history/**", "**/*.generated.*", "**/*.spec.*", "**/*.test.*"];
2
+ export declare const ignorePatternsBuiltIn: readonly ["**/node_modules/**", "**/ejected/**", "**/*.telefunc.*", "**/.history/**", "**/*.generated.*"];
@@ -13,7 +13,4 @@ export const ignorePatternsBuiltIn = [
13
13
  '**/.history/**',
14
14
  // https://github.com/vikejs/vike/discussions/2222
15
15
  '**/*.generated.*',
16
- // https://github.com/vikejs/vike/issues/2347
17
- '**/*.spec.*',
18
- '**/*.test.*',
19
16
  ];
@@ -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';
@@ -28,6 +28,7 @@ assertIsNotProductionRuntime();
28
28
  installSourceMapSupport();
29
29
  const debug = createDebug('vike:pointer-imports');
30
30
  const debugEsbuildResolve = createDebug('vike:esbuild-resolve');
31
+ const debugConfig = createDebug('vike:config');
31
32
  if (debugEsbuildResolve.isActivated)
32
33
  debugEsbuildResolve('esbuild version', version);
33
34
  async function transpileAndExecuteFile(filePath, userRootDir, isExtensionConfig, esbuildCache) {
@@ -52,11 +53,17 @@ async function transpileAndExecuteFile(filePath, userRootDir, isExtensionConfig,
52
53
  let fileExports;
53
54
  if (isExtensionConfig && !isHeader && fileExtension.endsWith('js')) {
54
55
  // This doesn't track dependencies => we should never use this for user land configs
56
+ if (debugConfig.isActivated) {
57
+ debugConfig(filePathToShowToUserResolved, 'executed directly (no esbuild transpilation)');
58
+ }
55
59
  fileExports = await executeFile(filePathAbsoluteFilesystem, filePath);
56
60
  }
57
61
  else {
58
62
  const transformImports = isHeader ? 'all' : true;
59
63
  const code = await transpileFile(filePath, transformImports, userRootDir, esbuildCache);
64
+ if (debugConfig.isActivated) {
65
+ debugConfig(filePathToShowToUserResolved, code);
66
+ }
60
67
  fileExports = await executeTranspiledFile(filePath, code);
61
68
  }
62
69
  resolve({ fileExports });
@@ -175,10 +182,19 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
175
182
  // - assertIsImportPathNpmPackage()
176
183
  // - isImportPathNpmPackage(str, { cannotBePathAlias: true })
177
184
  assertFilePathAbsoluteFilesystem(importPathResolved);
185
+ // Non-script file (e.g. .svg, .css) => resolve to constant string so that files with
186
+ // `meta.env: { config: true, client: true }` can also be loaded in Node.js
187
+ if (!isScriptFile(importPathResolved)) {
188
+ esbuildCache.vikeConfigDependencies.add(importPathResolved);
189
+ return {
190
+ path: importPathResolved,
191
+ namespace: 'vike-static-file',
192
+ };
193
+ }
178
194
  // Should be remove this? See comment below.
179
195
  const isVikeExtensionImport = (path.startsWith('vike-') && path.endsWith('/config')) || importPathResolved.endsWith('+config.js');
180
196
  const isPointerImport = transformImports === 'all' ||
181
- // .jsx, .vue, .svg, ... => obviously not config code => pointer import
197
+ // .jsx, .tsx, .vue, .svelte, ... => template/JSX files => pointer import
182
198
  !isPlainScriptFile(importPathResolved) ||
183
199
  // 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
200
  // - Should we stop doing this? (And instead let Node.js directly load Vike extensions.)
@@ -254,6 +270,12 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports, esb
254
270
  pointerImports[importPathTranspiled] = isPointerImport;
255
271
  return { external: true, path: importPathTranspiled };
256
272
  });
273
+ build.onLoad({ filter: /.*/, namespace: 'vike-static-file' }, (args) => {
274
+ return {
275
+ contents: `export default 'STATIC_FILE_NOT_AVAILABLE:${args.path}'`,
276
+ loader: 'js',
277
+ };
278
+ });
257
279
  },
258
280
  },
259
281
  // 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-56475f3";
1
+ export declare const PROJECT_VERSION: "0.4.253-commit-6255ff2";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.253-commit-56475f3';
2
+ export const PROJECT_VERSION = '0.4.253-commit-6255ff2';
@@ -2,7 +2,7 @@ export { createDebug };
2
2
  export { isDebug };
3
3
  export { isDebugError };
4
4
  export { debug };
5
- declare const flags: ["vike", "vike:crawl", "vike:file-change", "vike:error", "vike:esbuild-resolve", "vike:pluginExtractAssets", "vike:pluginExtractExportNames", "vike:glob", "vike:globalContext", "vike:log", "vike:optimizeDeps", "vike:outDir", "vike:pageFiles", "vike:pointer-imports", "vike:requireResolve", "vike:routing", "vike:setup", "vike:staticReplace", "vike:stream", "vike:virtualFiles", "vike:vite-rpc"];
5
+ declare const flags: ["vike", "vike:config", "vike:crawl", "vike:file-change", "vike:error", "vike:esbuild-resolve", "vike:pluginExtractAssets", "vike:pluginExtractExportNames", "vike:glob", "vike:globalContext", "vike:log", "vike:optimizeDeps", "vike:outDir", "vike:pageFiles", "vike:pointer-imports", "vike:requireResolve", "vike:routing", "vike:setup", "vike:staticReplace", "vike:stream", "vike:virtualFiles", "vike:vite-rpc"];
6
6
  type Flag = (typeof flags)[number];
7
7
  type Options = {
8
8
  serialization?: {
@@ -11,6 +11,7 @@ import { isArray } from './isArray.js';
11
11
  import { isObject } from './isObject.js';
12
12
  const flags = [
13
13
  'vike',
14
+ 'vike:config',
14
15
  'vike:crawl',
15
16
  'vike:file-change',
16
17
  'vike:error',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.253-commit-56475f3",
3
+ "version": "0.4.253-commit-6255ff2",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {