vike 0.4.250-commit-0d50da9 → 0.4.250-commit-7552006
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.
- package/dist/client/assertEnvClient.d.ts +1 -0
- package/dist/client/assertEnvClient.js +5 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +1 -0
- package/dist/client/node.d.ts +1 -1
- package/dist/client/node.js +1 -0
- package/dist/client/runtime-client-routing/createPageContextClient.d.ts +1 -0
- package/dist/client/runtime-client-routing/createPageContextClient.js +1 -0
- package/dist/client/runtime-client-routing/entry.d.ts +1 -1
- package/dist/client/runtime-client-routing/entry.js +1 -0
- package/dist/client/runtime-client-routing/getBaseServer.d.ts +1 -0
- package/dist/client/runtime-client-routing/getBaseServer.js +1 -0
- package/dist/client/runtime-client-routing/getGlobalContextClientInternal.d.ts +1 -0
- package/dist/client/runtime-client-routing/getGlobalContextClientInternal.js +1 -0
- package/dist/client/runtime-client-routing/getPageContext/removeBuiltInOverrides.d.ts +1 -0
- package/dist/client/runtime-client-routing/getPageContext/removeBuiltInOverrides.js +1 -0
- package/dist/client/runtime-client-routing/getPageContext.d.ts +1 -0
- package/dist/client/runtime-client-routing/getPageContext.js +1 -0
- package/dist/client/runtime-client-routing/getPageContextCurrent.d.ts +1 -0
- package/dist/client/runtime-client-routing/getPageContextCurrent.js +1 -0
- package/dist/client/runtime-client-routing/getPageContextFromHooks.d.ts +1 -0
- package/dist/client/runtime-client-routing/getPageContextFromHooks.js +1 -0
- package/dist/client/runtime-client-routing/getPageContextPublicClient.d.ts +1 -0
- package/dist/client/runtime-client-routing/getPageContextPublicClient.js +1 -0
- package/dist/client/runtime-client-routing/history.d.ts +1 -0
- package/dist/client/runtime-client-routing/history.js +1 -0
- package/dist/client/runtime-client-routing/index.d.ts +1 -0
- package/dist/client/runtime-client-routing/index.js +1 -0
- package/dist/client/runtime-client-routing/initClientRouter.d.ts +1 -0
- package/dist/client/runtime-client-routing/initClientRouter.js +1 -0
- package/dist/client/runtime-client-routing/initOnLinkClick.d.ts +1 -0
- package/dist/client/runtime-client-routing/initOnLinkClick.js +1 -0
- package/dist/client/runtime-client-routing/initOnPopState.d.ts +1 -0
- package/dist/client/runtime-client-routing/initOnPopState.js +1 -0
- package/dist/client/runtime-client-routing/isClientSideRoutable.d.ts +1 -0
- package/dist/client/runtime-client-routing/isClientSideRoutable.js +1 -0
- package/dist/client/runtime-client-routing/isLinkSkipped.d.ts +1 -0
- package/dist/client/runtime-client-routing/isLinkSkipped.js +1 -0
- package/dist/client/runtime-client-routing/logErrorClient.d.ts +1 -0
- package/dist/client/runtime-client-routing/logErrorClient.js +1 -0
- package/dist/client/runtime-client-routing/navigate.d.ts +1 -0
- package/dist/client/runtime-client-routing/navigate.js +1 -0
- package/dist/client/runtime-client-routing/normalizeUrlArgument.d.ts +1 -0
- package/dist/client/runtime-client-routing/normalizeUrlArgument.js +1 -0
- package/dist/client/runtime-client-routing/prefetch/getPrefetchSettings.d.ts +1 -0
- package/dist/client/runtime-client-routing/prefetch/getPrefetchSettings.js +1 -0
- package/dist/client/runtime-client-routing/prefetch.d.ts +1 -0
- package/dist/client/runtime-client-routing/prefetch.js +1 -0
- package/dist/client/runtime-client-routing/renderPageClient.d.ts +1 -0
- package/dist/client/runtime-client-routing/renderPageClient.js +1 -0
- package/dist/client/runtime-client-routing/scrollRestoration.d.ts +1 -0
- package/dist/client/runtime-client-routing/scrollRestoration.js +1 -0
- package/dist/client/runtime-client-routing/setScrollPosition.d.ts +1 -0
- package/dist/client/runtime-client-routing/setScrollPosition.js +1 -0
- package/dist/client/runtime-server-routing/createPageContextClient.d.ts +1 -0
- package/dist/client/runtime-server-routing/createPageContextClient.js +1 -0
- package/dist/client/runtime-server-routing/entry.d.ts +1 -1
- package/dist/client/runtime-server-routing/entry.js +1 -0
- package/dist/client/runtime-server-routing/getGlobalContextClientInternal.d.ts +1 -0
- package/dist/client/runtime-server-routing/getGlobalContextClientInternal.js +1 -0
- package/dist/client/runtime-server-routing/getPageContextPublicClient.d.ts +1 -0
- package/dist/client/runtime-server-routing/getPageContextPublicClient.js +1 -0
- package/dist/client/runtime-server-routing/index.d.ts +1 -0
- package/dist/client/runtime-server-routing/index.js +1 -2
- package/dist/client/shared/execHookOnRenderClient.d.ts +1 -0
- package/dist/client/shared/execHookOnRenderClient.js +1 -0
- package/dist/client/shared/getCurrentUrl.d.ts +1 -0
- package/dist/client/shared/getCurrentUrl.js +1 -0
- package/dist/client/shared/getGlobalContextClientInternalShared.d.ts +1 -0
- package/dist/client/shared/getGlobalContextClientInternalShared.js +1 -0
- package/dist/client/shared/getJsonSerializedInHtml.d.ts +1 -0
- package/dist/client/shared/getJsonSerializedInHtml.js +1 -0
- package/dist/client/shared/getPageContextPublicClientShared.d.ts +1 -0
- package/dist/client/shared/getPageContextPublicClientShared.js +1 -0
- package/dist/client/shared/loadPageConfigsLazyClientSide.d.ts +1 -0
- package/dist/client/shared/loadPageConfigsLazyClientSide.js +1 -0
- package/dist/client/shared/normalizeClientSideUrl.d.ts +1 -0
- package/dist/client/shared/normalizeClientSideUrl.js +1 -0
- package/dist/client/shared/removeFoucBuster.d.ts +1 -0
- package/dist/client/shared/removeFoucBuster.js +1 -0
- package/dist/node/vite/plugins/pluginCommon.js +5 -0
- package/dist/node/vite/shared/loggerDev.js +2 -1
- package/dist/node/vite/shared/resolveVikeConfigInternal/transpileAndExecuteFile.js +9 -5
- package/dist/node/vite/shared/resolveVikeConfigInternal.js +6 -19
- package/dist/server/runtime/renderPageServer.d.ts +4 -0
- package/dist/server/runtime/renderPageServer.js +5 -1
- package/dist/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/utils/PROJECT_VERSION.js +1 -1
- package/dist/utils/catchInfiniteLoop.d.ts +1 -1
- package/dist/utils/catchInfiniteLoop.js +16 -17
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/client/index.d.ts
CHANGED
package/dist/client/index.js
CHANGED
package/dist/client/node.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import './assertEnvClient.js';
|
package/dist/client/node.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '../assertEnvClient.js';
|
|
1
2
|
export { createPageContextClient };
|
|
2
3
|
import { createPageContextObject, createPageContextShared } from '../../shared-server-client/createPageContextShared.js';
|
|
3
4
|
import { getPageContextUrlComputed } from '../../shared-server-client/getPageContextUrlComputed.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '../assertEnvClient.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '../assertEnvClient.js';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export {};
|
|
1
|
+
import '../assertEnvClient.js';
|
|
@@ -85,6 +85,7 @@ function pluginCommon(vikeVitePluginOptions) {
|
|
|
85
85
|
config: {
|
|
86
86
|
order: 'post',
|
|
87
87
|
async handler(configFromUser) {
|
|
88
|
+
assertViteBuildSsr(configFromUser);
|
|
88
89
|
let configFromVike = { server: {}, preview: {} };
|
|
89
90
|
const vikeConfig = await getVikeConfigInternal();
|
|
90
91
|
if (vikeConfig.config.port !== undefined) {
|
|
@@ -193,3 +194,7 @@ async function emitServerEntryOnlyIfNeeded(config) {
|
|
|
193
194
|
config.vitePluginServerEntry.disableServerEntryEmit = true;
|
|
194
195
|
}
|
|
195
196
|
}
|
|
197
|
+
function assertViteBuildSsr(configFromUser) {
|
|
198
|
+
// https://github.com/vikejs/vike/issues/3010
|
|
199
|
+
assertUsage(configFromUser.build?.ssr === undefined, "Don't set vite.build.ssr");
|
|
200
|
+
}
|
|
@@ -28,6 +28,7 @@ import { getViteDevServer } from '../../../server/runtime/globalContext.js';
|
|
|
28
28
|
import { logErrorServer } from '../../../server/runtime/logErrorServer.js';
|
|
29
29
|
import { getBetterError } from '../../../utils/getBetterError.js';
|
|
30
30
|
import { getRequestId_withAsyncHook } from '../../../server/runtime/asyncHook.js';
|
|
31
|
+
import { getRequestTag } from '../../../server/runtime/renderPageServer.js';
|
|
31
32
|
assertIsNotProductionRuntime();
|
|
32
33
|
setLogRuntimeDev(logErrorServerDev, logRuntimeInfoDev);
|
|
33
34
|
setAssertOnBeforeErr((err) => {
|
|
@@ -148,7 +149,7 @@ function getTagSource(requestId = null) {
|
|
|
148
149
|
if (requestId === null)
|
|
149
150
|
return null;
|
|
150
151
|
// const tagSource = requestId % 2 === 1 ? (`request-${requestId}` as const) : (`request(${requestId})` as const)
|
|
151
|
-
const tagSource =
|
|
152
|
+
const tagSource = getRequestTag(requestId);
|
|
152
153
|
return tagSource;
|
|
153
154
|
}
|
|
154
155
|
function applyViteSourceMap(thing) {
|
|
@@ -6,13 +6,13 @@ export { isTemporaryBuildFile };
|
|
|
6
6
|
import { build, formatMessages, version, } from 'esbuild';
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import path from 'node:path';
|
|
9
|
+
import crypto from 'node:crypto';
|
|
9
10
|
import pc from '@brillout/picocolors';
|
|
10
11
|
import { import_ } from '@brillout/import';
|
|
11
12
|
import { assert, assertWarning, assertUsage } from '../../../../utils/assert.js';
|
|
12
13
|
import { assertIsNotProductionRuntime } from '../../../../utils/assertSetup.js';
|
|
13
14
|
import { createDebug } from '../../../../utils/debug.js';
|
|
14
15
|
import { genPromise } from '../../../../utils/genPromise.js';
|
|
15
|
-
import { getRandomId } from '../../../../utils/getRandomId.js';
|
|
16
16
|
import { assertFilePathAbsoluteFilesystem } from '../../../../utils/isFilePathAbsoluteFilesystem.js';
|
|
17
17
|
import { isImportPathRelative } from '../../../../utils/isImportPath.js';
|
|
18
18
|
import { isObject } from '../../../../utils/isObject.js';
|
|
@@ -298,7 +298,7 @@ async function executeTranspiledFile(filePath, code) {
|
|
|
298
298
|
const { filePathAbsoluteFilesystem } = filePath;
|
|
299
299
|
// Alternative to using a temporary file: https://github.com/vitejs/vite/pull/13269
|
|
300
300
|
// - But seems to break source maps, so I don't think it's worth it
|
|
301
|
-
const filePathTmp = getTemporaryBuildFilePath(filePathAbsoluteFilesystem);
|
|
301
|
+
const filePathTmp = getTemporaryBuildFilePath(filePathAbsoluteFilesystem, code);
|
|
302
302
|
fs.writeFileSync(filePathTmp, code);
|
|
303
303
|
const clean = () => fs.unlinkSync(filePathTmp);
|
|
304
304
|
let fileExports = {};
|
|
@@ -313,6 +313,8 @@ async function executeTranspiledFile(filePath, code) {
|
|
|
313
313
|
async function executeFile(filePathToExecuteAbsoluteFilesystem, filePathSourceFile) {
|
|
314
314
|
let fileExports = {};
|
|
315
315
|
try {
|
|
316
|
+
// `import(filePath)` is cached: if `filePath` doesn't change => the file isn't re-executed. The import() cache is required for the +meta.vite implementation to work correctly, see hasViteConfigChanged()
|
|
317
|
+
// https://github.com/vikejs/vike/blob/0a4f54ff3eea128cbd886c0ac88972e44a74cf99/packages/vike/src/node/vite/shared/resolveVikeConfigInternal.ts#L305
|
|
316
318
|
fileExports = await import_(filePathToExecuteAbsoluteFilesystem);
|
|
317
319
|
}
|
|
318
320
|
catch (err) {
|
|
@@ -357,12 +359,14 @@ function getConfigExecutionErrorIntroMsg(err) {
|
|
|
357
359
|
const errIntroMsg = execErrIntroMsg.get(err);
|
|
358
360
|
return errIntroMsg ?? null;
|
|
359
361
|
}
|
|
360
|
-
function getTemporaryBuildFilePath(filePathAbsoluteFilesystem) {
|
|
362
|
+
function getTemporaryBuildFilePath(filePathAbsoluteFilesystem, code) {
|
|
361
363
|
assertPosixPath(filePathAbsoluteFilesystem);
|
|
362
|
-
const
|
|
364
|
+
const fileDir = path.posix.dirname(filePathAbsoluteFilesystem);
|
|
363
365
|
const filename = path.posix.basename(filePathAbsoluteFilesystem);
|
|
366
|
+
// Using content hash in file path, so that the cache of dynamic `import()` behaves as we want.
|
|
367
|
+
const fileHash = crypto.createHash('md5').update(code).digest('hex').slice(0, 12);
|
|
364
368
|
// Syntax with semicolon `build:${/*...*/}` doesn't work on Windows: https://github.com/vikejs/vike/issues/800#issuecomment-1517329455
|
|
365
|
-
const filePathTmp = path.posix.join(
|
|
369
|
+
const filePathTmp = path.posix.join(fileDir, `${filename}.build-${fileHash}.mjs`);
|
|
366
370
|
assert(isTemporaryBuildFile(filePathTmp));
|
|
367
371
|
return filePathTmp;
|
|
368
372
|
}
|
|
@@ -11,6 +11,7 @@ export { isV1Design };
|
|
|
11
11
|
export { getConfVal };
|
|
12
12
|
export { getConfigDefinitionOptional };
|
|
13
13
|
export { getVikeConfigFromCliOrEnv };
|
|
14
|
+
import { deepEqual } from '../../../utils/deepEqual.js';
|
|
14
15
|
import { assertKeys } from '../../../utils/assertKeys.js';
|
|
15
16
|
import { assertIsNotProductionRuntime } from '../../../utils/assertSetup.js';
|
|
16
17
|
import { getMostSimilar } from '../../../utils/getMostSimilar.js';
|
|
@@ -194,6 +195,7 @@ async function resolveVikeConfigInternal_withErrorHandling(userRootDir, isDev, v
|
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
}
|
|
198
|
+
// `+meta.vite: true` => restart Vite if config changes
|
|
197
199
|
function hasViteConfigChanged(vikeConfigOld, vikeConfigNew) {
|
|
198
200
|
if (!vikeConfigOld)
|
|
199
201
|
return false;
|
|
@@ -204,28 +206,13 @@ function hasViteConfigChanged(vikeConfigOld, vikeConfigNew) {
|
|
|
204
206
|
for (const configName of viteConfigNames) {
|
|
205
207
|
const valOld = configValuesOld[configName]?.value;
|
|
206
208
|
const valNew = configValuesNew[configName]?.value;
|
|
207
|
-
//
|
|
208
|
-
//
|
|
209
|
-
|
|
210
|
-
// - Implementation: https://github.com/vikejs/vike/pull/3017/changes/1e55cbc1ed8bac4a72bf8c658cfbd67eecb7802a
|
|
211
|
-
if (!deepEqualPrimitive(valOld, valNew)) {
|
|
209
|
+
// Works thanks to the import() cache, see executeFile()
|
|
210
|
+
// https://github.com/vikejs/vike/blob/0a4f54ff3eea128cbd886c0ac88972e44a74cf99/packages/vike/src/node/vite/shared/resolveVikeConfigInternal/transpileAndExecuteFile.ts#L386
|
|
211
|
+
if (!deepEqual(valOld, valNew))
|
|
212
212
|
return true;
|
|
213
|
-
}
|
|
214
213
|
}
|
|
215
214
|
return false;
|
|
216
215
|
}
|
|
217
|
-
function deepEqualPrimitive(x, y) {
|
|
218
|
-
const tx = typeof x;
|
|
219
|
-
const ty = typeof y;
|
|
220
|
-
// Skip functions - treat them as always equal
|
|
221
|
-
if (tx === 'function' && ty === 'function')
|
|
222
|
-
return true;
|
|
223
|
-
// Copy of utils/deepEqual.ts for everything else
|
|
224
|
-
return x && y && tx === 'object' && tx === ty
|
|
225
|
-
? Object.keys(x).length === Object.keys(y).length &&
|
|
226
|
-
Object.keys(x).every((key) => deepEqualPrimitive(x[key], y[key]))
|
|
227
|
-
: x === y;
|
|
228
|
-
}
|
|
229
216
|
async function resolveVikeConfigInternal(userRootDir, vikeVitePluginOptions, esbuildCache) {
|
|
230
217
|
const plusFilesByLocationId = await getPlusFilesByLocationId(userRootDir, esbuildCache);
|
|
231
218
|
const configDefinitionsResolved = await resolveConfigDefinitions(plusFilesByLocationId, userRootDir, esbuildCache);
|
|
@@ -1177,7 +1164,7 @@ function restartViteDevServer() {
|
|
|
1177
1164
|
swallowViteLogForceOptimization_enable();
|
|
1178
1165
|
(async () => {
|
|
1179
1166
|
try {
|
|
1180
|
-
await viteDevServer.restart(
|
|
1167
|
+
await viteDevServer.restart();
|
|
1181
1168
|
}
|
|
1182
1169
|
catch (err) {
|
|
1183
1170
|
console.error('Vite restart error:');
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import '../assertEnvServer.js';
|
|
2
2
|
export { renderPageServer };
|
|
3
|
+
export { getRequestTag };
|
|
3
4
|
export type { PageContextInit };
|
|
4
5
|
export type { PageContextBegin };
|
|
6
|
+
export type { RequestTag };
|
|
5
7
|
import { type PageContextAborted } from '../../shared-server-client/route/abort.js';
|
|
6
8
|
import { type GlobalContextServerInternal } from './globalContext.js';
|
|
7
9
|
import { type HttpResponse } from './renderPageServer/createHttpResponse.js';
|
|
@@ -148,3 +150,5 @@ declare function getPageContextBegin(pageContextInit: PageContextInit, globalCon
|
|
|
148
150
|
_isPageContextJsonRequest: boolean;
|
|
149
151
|
pageContextsAborted: PageContextAborted[];
|
|
150
152
|
};
|
|
153
|
+
type RequestTag = ReturnType<typeof getRequestTag>;
|
|
154
|
+
declare function getRequestTag(requestId: number): `request-${number}`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '../assertEnvServer.js';
|
|
2
2
|
export { renderPageServer };
|
|
3
|
+
export { getRequestTag };
|
|
3
4
|
import { renderPageServerAfterRoute } from './renderPageServer/renderPageServerAfterRoute.js';
|
|
4
5
|
import { createPageContextServer, createPageContextServerWithoutGlobalContext, } from './renderPageServer/createPageContextServer.js';
|
|
5
6
|
import { route } from '../../shared-server-client/route/index.js';
|
|
@@ -112,7 +113,7 @@ async function renderPageServerEntryOnce(pageContextInit, requestId, asyncStore)
|
|
|
112
113
|
return await renderPageServerEntryRecursive(pageContextBegin, globalContext, requestId);
|
|
113
114
|
}
|
|
114
115
|
async function renderPageServerEntryRecursive(pageContextBegin, globalContext, requestId) {
|
|
115
|
-
catchInfiniteLoop(
|
|
116
|
+
catchInfiniteLoop(`[${getRequestTag(requestId)}] renderPageServerEntryRecursive()`);
|
|
116
117
|
const pageContextNominalPageBegin = fork(pageContextBegin);
|
|
117
118
|
const pageContextAddendumAbort = getPageContextAddendumAbort(pageContextBegin.pageContextsAborted);
|
|
118
119
|
objectAssign(pageContextNominalPageBegin, pageContextAddendumAbort);
|
|
@@ -517,3 +518,6 @@ function assertPageContextFinish(pageContextFinish) {
|
|
|
517
518
|
assert(contentType?.toLowerCase() === 'application/json');
|
|
518
519
|
}
|
|
519
520
|
}
|
|
521
|
+
function getRequestTag(requestId) {
|
|
522
|
+
return `request-${requestId}`;
|
|
523
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.250-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.250-commit-7552006";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.250-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.250-commit-7552006';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { catchInfiniteLoop };
|
|
2
|
-
declare function catchInfiniteLoop(functionName: `${string}()
|
|
2
|
+
declare function catchInfiniteLoop(functionName: `${string}()`): void;
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
export { catchInfiniteLoop };
|
|
2
2
|
import { assertUsage, assertWarning } from './assert.js';
|
|
3
|
+
import { humanizeTime } from './humanizeTime.js';
|
|
3
4
|
const trackers = {};
|
|
4
|
-
|
|
5
|
+
const maxCalls = 99;
|
|
6
|
+
const time = 5 * 1000;
|
|
7
|
+
function catchInfiniteLoop(functionName) {
|
|
5
8
|
// Init
|
|
6
|
-
const now = new Date();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const now = new Date().getTime();
|
|
10
|
+
// Clean all outdated trackers
|
|
11
|
+
Object.keys(trackers).forEach((key) => {
|
|
12
|
+
const tracker = trackers[key];
|
|
13
|
+
const elapsedTime = now - tracker.startTime;
|
|
14
|
+
if (elapsedTime > time)
|
|
15
|
+
delete trackers[key];
|
|
16
|
+
});
|
|
17
|
+
const tracker = (trackers[functionName] ?? (trackers[functionName] = { count: 0, startTime: now }));
|
|
12
18
|
// Count
|
|
13
19
|
tracker.count++;
|
|
14
20
|
// Error
|
|
15
|
-
const msg =
|
|
16
|
-
if (tracker.count >
|
|
21
|
+
const msg = `${functionName} called ${tracker.count} times within ${humanizeTime(time)} — infinite loop?`;
|
|
22
|
+
if (tracker.count > maxCalls) {
|
|
17
23
|
assertUsage(false, msg);
|
|
18
24
|
}
|
|
19
25
|
// Warning, at 50% threshold
|
|
20
|
-
if (!tracker.warned && tracker.count >
|
|
26
|
+
if (!tracker.warned && tracker.count > maxCalls * 0.5) {
|
|
21
27
|
// Warning is shown upon 10 calls a second, on average during 5 seconds, given the default parameters
|
|
22
28
|
assertWarning(false, msg, { onlyOnce: false, showStackTrace: true });
|
|
23
29
|
tracker.warned = true;
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
|
-
function createTracker(now) {
|
|
27
|
-
const tracker = {
|
|
28
|
-
count: 0,
|
|
29
|
-
start: now,
|
|
30
|
-
};
|
|
31
|
-
return tracker;
|
|
32
|
-
}
|