vike 0.4.243-commit-6ce9ef3 → 0.4.243-commit-a70ea31

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.
@@ -1,5 +1,8 @@
1
1
  export { getGlobalContextClientInternal };
2
+ export type { GlobalContextClient };
2
3
  export type { GlobalContextClientInternal };
4
+ import type { GlobalContextBasePublic } from '../../shared/createGlobalContextShared.js';
5
+ type GlobalContextClient = GlobalContextBasePublic & Pick<GlobalContextClientInternal, 'isClientSide'> & Vike.GlobalContext & Vike.GlobalContextClient & {};
3
6
  type GlobalContextClientInternal = Awaited<ReturnType<typeof getGlobalContextClientInternal>>;
4
7
  declare function getGlobalContextClientInternal(): Promise<{
5
8
  _globalConfigPublic: {
@@ -117,7 +117,6 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
117
117
  url: string;
118
118
  pageExports: Record<string, unknown>;
119
119
  isBaseMissing?: true;
120
- ignoreWarning?: import("../../shared/getProxyForPublicUsage.js").IgnoreWarning;
121
120
  }> & Pick<PageContextConfig & {
122
121
  isPageContext: true;
123
122
  Page: import("../../types/Config.js").Config["Page"];
@@ -139,7 +138,6 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
139
138
  url: string;
140
139
  pageExports: Record<string, unknown>;
141
140
  isBaseMissing?: true;
142
- ignoreWarning?: import("../../shared/getProxyForPublicUsage.js").IgnoreWarning;
143
141
  }, "exports" | "pageId" | "pageExports" | "config" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "routeParams" | "abortReason"> & {
144
142
  isClientSide: true;
145
143
  isPrerendering: false;
@@ -147,7 +145,7 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
147
145
  isHydration: boolean;
148
146
  isBackwardNavigation: boolean | null;
149
147
  previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
150
- globalContext: import("../../types/GlobalContext.js").GlobalContextClient;
148
+ globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
151
149
  } & {
152
150
  urlOriginal: string;
153
151
  } & {
@@ -184,7 +182,6 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
184
182
  url: string;
185
183
  pageExports: Record<string, unknown>;
186
184
  isBaseMissing?: true;
187
- ignoreWarning?: import("../../shared/getProxyForPublicUsage.js").IgnoreWarning;
188
185
  }> & Pick<PageContextConfig & {
189
186
  isPageContext: true;
190
187
  Page: import("../../types/Config.js").Config["Page"];
@@ -206,7 +203,6 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
206
203
  url: string;
207
204
  pageExports: Record<string, unknown>;
208
205
  isBaseMissing?: true;
209
- ignoreWarning?: import("../../shared/getProxyForPublicUsage.js").IgnoreWarning;
210
206
  }, "exports" | "pageId" | "pageExports" | "config" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "routeParams" | "abortReason"> & {
211
207
  isClientSide: true;
212
208
  isPrerendering: false;
@@ -214,7 +210,7 @@ declare function getPageContextFromHooks_isHydration(pageContext: PageContextSer
214
210
  isHydration: boolean;
215
211
  isBackwardNavigation: boolean | null;
216
212
  previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
217
- globalContext: import("../../types/GlobalContext.js").GlobalContextClient;
213
+ globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
218
214
  } & {
219
215
  urlOriginal: string;
220
216
  } & {
@@ -342,7 +338,6 @@ declare function getPageContextFromClientHooks(pageContext: {
342
338
  url: string;
343
339
  pageExports: Record<string, unknown>;
344
340
  isBaseMissing?: true;
345
- ignoreWarning?: import("../../shared/getProxyForPublicUsage.js").IgnoreWarning;
346
341
  }> & Pick<PageContextConfig & {
347
342
  isPageContext: true;
348
343
  Page: import("../../types/Config.js").Config["Page"];
@@ -364,7 +359,6 @@ declare function getPageContextFromClientHooks(pageContext: {
364
359
  url: string;
365
360
  pageExports: Record<string, unknown>;
366
361
  isBaseMissing?: true;
367
- ignoreWarning?: import("../../shared/getProxyForPublicUsage.js").IgnoreWarning;
368
362
  }, "exports" | "pageId" | "pageExports" | "config" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "routeParams" | "abortReason"> & {
369
363
  isClientSide: true;
370
364
  isPrerendering: false;
@@ -372,7 +366,7 @@ declare function getPageContextFromClientHooks(pageContext: {
372
366
  isHydration: boolean;
373
367
  isBackwardNavigation: boolean | null;
374
368
  previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
375
- globalContext: import("../../types/GlobalContext.js").GlobalContextClient;
369
+ globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
376
370
  } & {
377
371
  urlOriginal: string;
378
372
  } & {
@@ -407,7 +401,6 @@ declare function getPageContextFromClientHooks(pageContext: {
407
401
  url: string;
408
402
  pageExports: Record<string, unknown>;
409
403
  isBaseMissing?: true;
410
- ignoreWarning?: import("../../shared/getProxyForPublicUsage.js").IgnoreWarning;
411
404
  }> & Pick<PageContextConfig & {
412
405
  isPageContext: true;
413
406
  Page: import("../../types/Config.js").Config["Page"];
@@ -429,7 +422,6 @@ declare function getPageContextFromClientHooks(pageContext: {
429
422
  url: string;
430
423
  pageExports: Record<string, unknown>;
431
424
  isBaseMissing?: true;
432
- ignoreWarning?: import("../../shared/getProxyForPublicUsage.js").IgnoreWarning;
433
425
  }, "exports" | "pageId" | "pageExports" | "config" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "routeParams" | "abortReason"> & {
434
426
  isClientSide: true;
435
427
  isPrerendering: false;
@@ -437,7 +429,7 @@ declare function getPageContextFromClientHooks(pageContext: {
437
429
  isHydration: boolean;
438
430
  isBackwardNavigation: boolean | null;
439
431
  previousPageContext: import("../../types/PageContext.js").PageContextClient<unknown> | null;
440
- globalContext: import("../../types/GlobalContext.js").GlobalContextClient;
432
+ globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
441
433
  } & {
442
434
  urlOriginal: string;
443
435
  } & {
@@ -128,7 +128,6 @@ declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isB
128
128
  url: string;
129
129
  pageExports: Record<string, unknown>;
130
130
  isBaseMissing?: true;
131
- ignoreWarning?: import("../../shared/getProxyForPublicUsage.js").IgnoreWarning;
132
131
  }> & Pick<PageContextConfig & {
133
132
  isPageContext: true;
134
133
  Page: import("../../types/Config.js").Config["Page"];
@@ -150,7 +149,6 @@ declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isB
150
149
  url: string;
151
150
  pageExports: Record<string, unknown>;
152
151
  isBaseMissing?: true;
153
- ignoreWarning?: import("../../shared/getProxyForPublicUsage.js").IgnoreWarning;
154
152
  }, "exports" | "pageId" | "pageExports" | "config" | "Page" | "data" | "source" | "sources" | "from" | "configEntries" | "exportsAll" | "routeParams" | "abortReason"> & {
155
153
  isClientSide: true;
156
154
  isPrerendering: false;
@@ -158,7 +156,7 @@ declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isB
158
156
  isHydration: boolean;
159
157
  isBackwardNavigation: boolean | null;
160
158
  previousPageContext: PageContextClient<unknown> | null;
161
- globalContext: import("../../types/GlobalContext.js").GlobalContextClient;
159
+ globalContext: import("./getGlobalContextClientInternal.js").GlobalContextClient;
162
160
  } & {
163
161
  urlOriginal: string;
164
162
  } & {
@@ -1,5 +1,8 @@
1
1
  export { getGlobalContextClientInternal };
2
+ export type { GlobalContextClientWithServerRouting };
2
3
  export type { GlobalContextClientInternalWithServerRouting };
4
+ import type { GlobalContextBasePublic } from '../../shared/createGlobalContextShared.js';
5
+ type GlobalContextClientWithServerRouting = GlobalContextBasePublic & Pick<GlobalContextClientInternalWithServerRouting, 'isClientSide'> & Vike.GlobalContext & Vike.GlobalContextClient & {};
3
6
  type GlobalContextClientInternalWithServerRouting = Awaited<ReturnType<typeof getGlobalContextClientInternal>>;
4
7
  declare function getGlobalContextClientInternal(): Promise<{
5
8
  _globalConfigPublic: {
@@ -20,15 +20,17 @@ export { updateUserFiles };
20
20
  export { isRunnable };
21
21
  export { vikeConfigErrorRecoverMsg };
22
22
  export type { BuildInfo };
23
- export type { GlobalContextServerInternal };
23
+ export type { GlobalContextServerInternal as GlobalContextServerInternal };
24
+ export type { GlobalContextServer };
24
25
  import type { ViteManifest } from '../../types/ViteManifest.js';
25
26
  import type { ResolvedConfig, ViteDevServer } from 'vite';
26
27
  import { type PageRoutes } from '../../shared/route/loadPageRoutes.js';
27
28
  import type { ViteConfigRuntime } from '../vite/shared/getViteConfigRuntime.js';
28
- import type { GlobalContext } from '../../types/GlobalContext.js';
29
+ import type { GlobalContext } from '../../types/PageContext.js';
29
30
  import type { Hook } from '../../shared/hooks/getHook.js';
30
31
  import type { PrerenderContext } from '../../types/index.js';
31
32
  declare const vikeConfigErrorRecoverMsg: "Vike config loaded";
33
+ type GlobalContextServer = Pick<GlobalContextServerInternal, 'assetsManifest' | 'config' | 'viteConfig' | 'viteConfigRuntime' | 'pages' | 'baseServer' | 'baseAssets' | 'isClientSide'> & Vike.GlobalContext & Vike.GlobalContextServer;
32
34
  type GlobalContextServerInternal = Awaited<ReturnType<typeof createGlobalContext>>;
33
35
  declare function getGlobalContextServerInternal(): Promise<{
34
36
  globalContext: (Record<string, unknown> & {
@@ -1,7 +1,4 @@
1
1
  export { getProxyForPublicUsage };
2
- export type { IgnoreWarning };
3
2
  type Target = Record<string, unknown>;
4
3
  type Fallback = (prop: string | symbol) => unknown;
5
4
  declare function getProxyForPublicUsage<Obj extends Target>(obj: Obj, objName: 'pageContext' | 'globalContext' | 'prerenderContext' | 'vikeConfig', skipOnInternalProp?: true, fallback?: Fallback): Obj;
6
- /** https://vike.dev/warning/internals */
7
- type IgnoreWarning = (prop: string) => unknown;
@@ -10,27 +10,25 @@ import { NOT_SERIALIZABLE } from './NOT_SERIALIZABLE.js';
10
10
  import { assert, assertUsage, assertWarning, getPropAccessNotation, isBrowser } from './utils.js';
11
11
  function getProxyForPublicUsage(obj, objName, skipOnInternalProp, fallback) {
12
12
  return new Proxy(obj, {
13
- get: (_, prop) => getProp(prop, obj, objName, skipOnInternalProp, fallback),
13
+ get: getTrapGet(obj, objName, skipOnInternalProp, fallback),
14
14
  });
15
15
  }
16
- function getProp(prop, obj, objName, skipOnInternalProp, fallback) {
17
- const propStr = String(prop);
18
- if (prop === '_isProxyObject')
19
- return true;
20
- if (!skipOnInternalProp) {
21
- if (prop === 'ignoreWarning')
22
- return (prop) => getProp(prop, obj, objName, true, fallback);
23
- if (!globalThis.__VIKE__IS_CLIENT)
16
+ function getTrapGet(obj, objName, skipOnInternalProp, fallback) {
17
+ return function (_, prop) {
18
+ const propStr = String(prop);
19
+ if (prop === '_isProxyObject')
20
+ return true;
21
+ if (!skipOnInternalProp && !globalThis.__VIKE__IS_CLIENT)
24
22
  onInternalProp(propStr, objName);
25
- }
26
- if (fallback && !(prop in obj)) {
27
- // Rudimentary flat pageContext implementation https://github.com/vikejs/vike/issues/1268
28
- // Failed full-fledged implementation: https://github.com/vikejs/vike/pull/2458
29
- return fallback(prop);
30
- }
31
- const val = obj[prop];
32
- onNotSerializable(propStr, val, objName);
33
- return val;
23
+ if (fallback && !(prop in obj)) {
24
+ // Rudimentary flat pageContext implementation https://github.com/vikejs/vike/issues/1268
25
+ // Failed full-fledged implementation: https://github.com/vikejs/vike/pull/2458
26
+ return fallback(prop);
27
+ }
28
+ const val = obj[prop];
29
+ onNotSerializable(propStr, val, objName);
30
+ return val;
31
+ };
34
32
  }
35
33
  function onNotSerializable(propStr, val, objName) {
36
34
  if (val !== NOT_SERIALIZABLE)
@@ -46,9 +44,6 @@ function onInternalProp(propStr, objName) {
46
44
  if (propStr === '_configFromHook')
47
45
  return;
48
46
  if (propStr.startsWith('_')) {
49
- assertWarning(false, `Using internal ${objName}.${propStr} https://vike.dev/warning/internals`, {
50
- onlyOnce: true,
51
- showStackTrace: true,
52
- });
47
+ assertWarning(false, `Using internal ${objName}.${propStr} which may break in any minor version update. Reach out on GitHub to request official support for your use case.`, { onlyOnce: true, showStackTrace: true });
53
48
  }
54
49
  }
@@ -42,8 +42,7 @@ import type { InjectFilterEntry } from './index.js';
42
42
  import type { VikeVitePluginOptions } from '../node/vite/index.js';
43
43
  import type { Vike } from './VikeNamespace.js';
44
44
  import type { HooksTimeoutProvidedByUser } from '../shared/hooks/getHook.js';
45
- import type { PageContextClient, PageContextServer } from './PageContext.js';
46
- import type { GlobalContext } from './GlobalContext.js';
45
+ import type { GlobalContext, PageContextClient, PageContextServer } from './PageContext.js';
47
46
  import type { InlineConfig } from 'vite';
48
47
  import type { PassToClientPublic } from '../node/runtime/renderPage/html/serializeContext.js';
49
48
  type HookNameOld = HookName | HookNameOldDesign;
@@ -1,8 +1,12 @@
1
1
  export type { PageContext };
2
2
  export type { PageContextServer };
3
3
  export type { PageContextClient };
4
+ export type { GlobalContext };
5
+ export type { GlobalContextServer };
6
+ export type { GlobalContextClient };
4
7
  export type { PageContextWithServerRouting };
5
8
  export type { PageContextClientWithServerRouting };
9
+ export type { GlobalContextClientWithServerRouting };
6
10
  export type { PageContextInternalServer };
7
11
  export type { PageContextInternalClient };
8
12
  export type { PageContextInternalClient_ServerRouting };
@@ -14,11 +18,13 @@ import type { PageContextUrlInternal, PageContextUrlClient, PageContextUrlServer
14
18
  import type { From, PageContextConfig, Source, Sources } from '../shared/page-configs/resolveVikeConfigPublic.js';
15
19
  import type { Config } from './Config.js';
16
20
  import type { AbortStatusCode } from '../shared/route/abort.js';
17
- import type { GlobalContextClient, GlobalContextServer, GlobalContextClientWithServerRouting } from './GlobalContext.js';
18
- import type { IgnoreWarning } from '../shared/getProxyForPublicUsage.js';
21
+ import type { GlobalContextServer } from '../node/runtime/globalContext.js';
22
+ import type { GlobalContextClient } from '../client/runtime-client-routing/getGlobalContextClientInternal.js';
23
+ import type { GlobalContextClientWithServerRouting } from '../client/runtime-server-routing/getGlobalContextClientInternal.js';
19
24
  type PageContextServer<Data = unknown> = PageContextBuiltInServer<Data> & Vike.PageContext & Vike.PageContextServer;
20
25
  type PageContext<Data = unknown> = PageContextClient<Data> | PageContextServer<Data>;
21
26
  type PageContextClient<Data = unknown> = PageContextBuiltInClientWithClientRouting<Data> & Vike.PageContext & Vike.PageContextClient;
27
+ type GlobalContext = GlobalContextServer | GlobalContextClient;
22
28
  type PageContextWithServerRouting<Data = unknown> = PageContextClientWithServerRouting<Data> | PageContextServer<Data>;
23
29
  type PageContextClientWithServerRouting<Data = unknown> = PageContextBuiltInClientWithServerRouting<Data> & Vike.PageContext & Vike.PageContextClient;
24
30
  type PageContextBuiltInCommon<Data> = PageContextConfig & {
@@ -128,8 +134,6 @@ type PageContextBuiltInCommon<Data> = PageContextConfig & {
128
134
  * https://vike.dev/pageContext#isBaseMissing
129
135
  */
130
136
  isBaseMissing?: true;
131
- /** https://vike.dev/warning/internals */
132
- ignoreWarning?: IgnoreWarning;
133
137
  };
134
138
  type PageContextBuiltInServer<Data> = PageContextBuiltInCommon<Data> & PageContextUrlServer & {
135
139
  /**
@@ -1,5 +1,4 @@
1
- export type { PageContext, PageContextServer, PageContextClient, PageContextWithServerRouting, PageContextClientWithServerRouting, } from './PageContext.js';
2
- export type { GlobalContext, GlobalContextServer, GlobalContextClient, GlobalContextClientWithServerRouting, } from './GlobalContext.js';
1
+ export type { PageContext, PageContextServer, PageContextClient, GlobalContext, GlobalContextServer, GlobalContextClient, PageContextWithServerRouting, PageContextClientWithServerRouting, GlobalContextClientWithServerRouting, } from './PageContext.js';
3
2
  export type { PrerenderContextPublic as PrerenderContext } from '../node/prerender/runPrerender.js';
4
3
  export type { PageContextBuiltInServer } from './PageContext.js';
5
4
  export type { PageContextBuiltInClientWithClientRouting } from './PageContext.js';
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.243-commit-6ce9ef3";
1
+ export declare const PROJECT_VERSION: "0.4.243-commit-a70ea31";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.243-commit-6ce9ef3';
2
+ export const PROJECT_VERSION = '0.4.243-commit-a70ea31';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.243-commit-6ce9ef3",
3
+ "version": "0.4.243-commit-a70ea31",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {
@@ -1,17 +0,0 @@
1
- export type { GlobalContext };
2
- export type { GlobalContextServer };
3
- export type { GlobalContextClient };
4
- export type { GlobalContextClientWithServerRouting };
5
- import type { GlobalContextServerInternal } from '../node/runtime/globalContext.js';
6
- import type { GlobalContextClientInternalWithServerRouting } from '../client/runtime-server-routing/getGlobalContextClientInternal.js';
7
- import type { GlobalContextBasePublic } from '../shared/createGlobalContextShared.js';
8
- import type { GlobalContextClientInternal } from '../client/runtime-client-routing/getGlobalContextClientInternal.js';
9
- import type { IgnoreWarning } from '../shared/getProxyForPublicUsage.js';
10
- type GlobalContext = GlobalContextServer | GlobalContextClient;
11
- type GlobalContextServer = GlobalContextCommon & Pick<GlobalContextServerInternal, 'assetsManifest' | 'config' | 'viteConfig' | 'viteConfigRuntime' | 'pages' | 'baseServer' | 'baseAssets' | 'isClientSide'> & Vike.GlobalContext & Vike.GlobalContextServer;
12
- type GlobalContextClient = GlobalContextCommon & GlobalContextBasePublic & Pick<GlobalContextClientInternal, 'isClientSide'> & Vike.GlobalContext & Vike.GlobalContextClient & {};
13
- type GlobalContextClientWithServerRouting = GlobalContextCommon & GlobalContextBasePublic & Pick<GlobalContextClientInternalWithServerRouting, 'isClientSide'> & Vike.GlobalContext & Vike.GlobalContextClient & {};
14
- type GlobalContextCommon = {
15
- /** https://vike.dev/warning/internals */
16
- ignoreWarning?: IgnoreWarning;
17
- };
@@ -1 +0,0 @@
1
- export {};