vike 0.4.252-commit-e3a6e9d → 0.4.252-commit-4fa40ed

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,6 +15,8 @@ const PUBLIC_ENV_PREFIX = 'PUBLIC_ENV__';
15
15
  const PUBLIC_ENV_ALLOWLIST = [
16
16
  // https://github.com/vikejs/vike/issues/1724
17
17
  'STORYBOOK',
18
+ // https://github.com/vikejs/vike/pull/3069
19
+ 'DEBUG',
18
20
  ];
19
21
  // TO-DO/eventually:
20
22
  // - Make import.meta.env work inside +config.js
@@ -17,7 +17,7 @@ const globalObject = getGlobalObject('vite/shared/loggerDev.ts', {
17
17
  processStartupLog_hasViteLoggedStartup: null,
18
18
  processStartupLog_hasViteLoggedHelpShortcut: null,
19
19
  swallowViteLogForceOptimization_enabled: false,
20
- swallowViteLogConnected_originalConsoleLog: null,
20
+ swallowViteLogConnected_originalConsoleLog: undefined,
21
21
  });
22
22
  function interceptViteLogs(config) {
23
23
  if (isDebugError())
@@ -123,22 +123,29 @@ function swallowViteLogForceOptimization_enable() {
123
123
  function swallowViteLogForceOptimization_disable() {
124
124
  globalObject.swallowViteLogForceOptimization_enabled = false;
125
125
  }
126
- // Suppress "[vite] connected." message. (It doesn't go through Vite's logger thus we must monkey patch the console.log() function.)
126
+ // Swallow message `[vite] connected.`
127
127
  function swallowViteLogConnected() {
128
128
  if (isDebugError())
129
129
  return;
130
130
  if (globalObject.swallowViteLogConnected_originalConsoleLog)
131
131
  return;
132
132
  globalObject.swallowViteLogConnected_originalConsoleLog = console.log;
133
+ // The message `[vite] connected.` doesn't go through Vite's logger thus we must monkey patch console.log()
133
134
  console.log = swallowViteLogConnected_logPatch;
134
135
  setTimeout(swallowViteLogConnected_clean, 3000);
135
136
  }
136
137
  // Remove console.log() monkey patch
137
138
  function swallowViteLogConnected_clean() {
138
- // Don't remove console.log() patches from other libraries (e.g. instrumentation)
139
- if (console.log === swallowViteLogConnected_logPatch)
139
+ if (isDebugError()) {
140
+ assert(globalObject.swallowViteLogConnected_originalConsoleLog === undefined);
140
141
  return;
142
+ }
143
+ if (globalObject.swallowViteLogConnected_originalConsoleLog === null)
144
+ return; // already cleaned
141
145
  assert(globalObject.swallowViteLogConnected_originalConsoleLog);
146
+ // Don't remove console.log() patches from other libraries (e.g. instrumentation)
147
+ if (console.log !== swallowViteLogConnected_logPatch)
148
+ return;
142
149
  console.log = globalObject.swallowViteLogConnected_originalConsoleLog;
143
150
  globalObject.swallowViteLogConnected_originalConsoleLog = null;
144
151
  }
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.252-commit-e3a6e9d";
1
+ export declare const PROJECT_VERSION: "0.4.252-commit-4fa40ed";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.252-commit-e3a6e9d';
2
+ export const PROJECT_VERSION = '0.4.252-commit-4fa40ed';
@@ -175,22 +175,18 @@ function getFlagsActivated() {
175
175
  }
176
176
  function getDEBUG() {
177
177
  assert(isUsed);
178
- let DEBUG;
179
178
  // ssr.noExternal
180
- /* // Full implementation:
181
- // - https://github.com/vikejs/vike/commit/7637564a98f43e23834bcae2f7ada8d941958a34
182
- // - https://github.com/vikejs/vike/pull/2718
183
- // - We don't implement this yet because it crashes @cloudflare/vite-plugin
184
- if (import.meta.env) {
185
- return import.meta.env.DEBUG
179
+ // - @cloudflare/vite-plugin
180
+ try {
181
+ return import.meta.env.DEBUG;
186
182
  }
187
- //*/
183
+ catch { }
188
184
  // ssr.external
189
- // - `process` can be undefined in edge workers
190
- // - We want bundlers to be able to statically replace `process.env.*`
185
+ // - `process` can be `undefined` (e.g. edge workers)
186
+ // - We want bundlers (e.g. webpack) to be able to statically replace `process.env.*`
191
187
  try {
192
- DEBUG = process.env.DEBUG;
188
+ return process.env.DEBUG;
193
189
  }
194
190
  catch { }
195
- return DEBUG;
191
+ return null;
196
192
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.252-commit-e3a6e9d",
3
+ "version": "0.4.252-commit-4fa40ed",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {