vike 0.4.251 → 0.4.252-commit-1d0a050

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.
@@ -21,19 +21,18 @@ const PUBLIC_ENV_ALLOWLIST = [
21
21
  // - 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
22
22
  // - Or stop using Vite's `mode` implementation and have Vike implement its own `mode` feature? (So that the only dependencies are `$ vike build --mode staging` and `$ MODE=staging vike build`.)
23
23
  // === Rolldown filter
24
- const skipNodeModules = '/node_modules/';
25
24
  const skipIrrelevant = 'import.meta.env.';
26
25
  const filterRolldown = {
26
+ /* We don't do that, because vike-react-sentry uses import.meta.env.PUBLIC_ENV__SENTRY_DSN
27
27
  id: {
28
- exclude: `**${skipNodeModules}**`,
28
+ exclude: `**${'/node_modules/'}**`,
29
29
  },
30
+ */
30
31
  code: {
31
32
  include: skipIrrelevant,
32
33
  },
33
34
  };
34
- const filterFunction = (id, code) => {
35
- if (id.includes(skipNodeModules))
36
- return false;
35
+ const filterFunction = (code) => {
37
36
  if (!code.includes(skipIrrelevant))
38
37
  return false;
39
38
  return true;
@@ -62,10 +61,7 @@ function pluginReplaceConstantsEnvVars() {
62
61
  handler(code, id, options) {
63
62
  id = normalizeId(id);
64
63
  assertPosixPath(id);
65
- assertPosixPath(config.root);
66
- if (!id.startsWith(config.root))
67
- return; // skip linked dependencies
68
- assert(filterFunction(id, code));
64
+ assert(filterFunction(code));
69
65
  const isBuild = config.command === 'build';
70
66
  const isClientSide = !isViteServerSide_extraSafe(config, this.environment, options);
71
67
  const { magicString, getMagicStringResult } = getMagicString(code, id);
@@ -9,7 +9,7 @@ import path from 'node:path';
9
9
  import crypto from 'node:crypto';
10
10
  import pc from '@brillout/picocolors';
11
11
  import { import_ } from '@brillout/import';
12
- import { assert, assertWarning, assertUsage } from '../../../../utils/assert.js';
12
+ import { assert, assertWarning } from '../../../../utils/assert.js';
13
13
  import { assertIsNotProductionRuntime } from '../../../../utils/assertSetup.js';
14
14
  import { createDebug } from '../../../../utils/debug.js';
15
15
  import { genPromise } from '../../../../utils/genPromise.js';
@@ -39,7 +39,12 @@ async function transpileAndExecuteFile(filePath, userRootDir, isExtensionConfig,
39
39
  }
40
40
  const { promise, resolve } = genPromise();
41
41
  esbuildCache.transpileCache[filePathAbsoluteFilesystem] = promise;
42
- assertUsage(isPlainScriptFile(filePathAbsoluteFilesystem), `${filePathToShowToUserResolved} has file extension .${fileExtension} but a config file can only be a JavaScript/TypeScript file`);
42
+ /* We tolerate .tsx so that a file can be both a runtime and config file (`meta.env.config === true && meta.env.server === true`), e.g. https://github.com/brillout/docpress/issues/86
43
+ assertUsage(
44
+ isPlainScriptFile(filePathAbsoluteFilesystem),
45
+ `${filePathToShowToUserResolved} has file extension .${fileExtension} but a config file can only be a JavaScript/TypeScript file`,
46
+ )
47
+ */
43
48
  const isHeader = isHeaderFile(filePathAbsoluteFilesystem);
44
49
  if (isHeader) {
45
50
  assertWarning(false, `${pc.cyan('.h.js')} files are deprecated: simply renaming ${filePathToShowToUserResolved} to ${removeHeaderFileExtension(filePathToShowToUserResolved)} is usually enough, although you may occasionally need to use ${pc.cyan("with { type: 'pointer' }")} as explained at https://vike.dev/config#pointer-imports`, { onlyOnce: true });
@@ -1,10 +1,10 @@
1
1
  export { getPublicProxy };
2
2
  export type { DangerouslyUseInternals };
3
- type ObjProxy<Obj> = {
3
+ type ObjProxy<Obj> = Obj & {
4
4
  _isProxyObject: true;
5
5
  _originalObject: Obj;
6
6
  };
7
- declare function getPublicProxy<Obj extends Record<string | symbol, unknown>>(obj: Obj, objName: 'pageContext' | 'globalContext' | 'prerenderContext' | 'vikeConfig', skipOnInternalProp?: boolean, fallback?: (prop: string | symbol) => unknown): Obj & ObjProxy<Obj> & {
7
+ declare function getPublicProxy<Obj extends Record<string | symbol, unknown>>(obj: Obj, objName: 'pageContext' | 'globalContext' | 'prerenderContext' | 'vikeConfig', skipOnInternalProp?: boolean, fallback?: (prop: string | symbol) => unknown): ObjProxy<Obj> & {
8
8
  /** https://vike.dev/warning/internals */
9
9
  dangerouslyUseInternals: DangerouslyUseInternals<Obj>;
10
10
  };
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.251";
1
+ export declare const PROJECT_VERSION: "0.4.252-commit-1d0a050";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.251';
2
+ export const PROJECT_VERSION = '0.4.252-commit-1d0a050';
@@ -1 +1,2 @@
1
+ /** Test whether the environment is a *real* browser (not a browser simulation such as `jsdom`). */
1
2
  export declare function isBrowser(): boolean;
@@ -1,5 +1,7 @@
1
+ /** Test whether the environment is a *real* browser (not a browser simulation such as `jsdom`). */
1
2
  export function isBrowser() {
2
- // Using `typeof window !== 'undefined'` alone is not enough because some users use https://www.npmjs.com/package/ssr-window
3
- return typeof window !== 'undefined' && typeof window.scrollY === 'number';
4
- // Alternatively, test whether environment is a *real* browser: https://github.com/brillout/picocolors/blob/d59a33a0fd52a8a33e4158884069192a89ce0113/picocolors.js#L87-L89
3
+ // - Using `typeof window !== 'undefined'` alone isn't narrow enough because some users use https://www.npmjs.com/package/ssr-window
4
+ // - Using `typeof window !== "undefined" && typeof window.scrollY === "number"` still isn't narrow enough because of jsdom
5
+ // - https://github.com/jsdom/jsdom/issues/1537#issuecomment-1689368267
6
+ return Object.getOwnPropertyDescriptor(globalThis, 'window')?.get?.toString().includes('[native code]') ?? false;
5
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.251",
3
+ "version": "0.4.252-commit-1d0a050",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {
@@ -153,7 +153,7 @@
153
153
  "node": ">=20.19.0"
154
154
  },
155
155
  "license": "MIT",
156
- "description": "The Framework *You* Control - Next.js & Nuxt alternative for unprecedented flexibility and dependability.",
156
+ "description": "(Replaces Next.js/Nuxt) 🔨 Composable framework to build (advanced) applications with flexibility and stability.",
157
157
  "keywords": [
158
158
  "vite-plugin",
159
159
  "ssr",