403Webshell
Server IP : 159.203.156.69  /  Your IP : 216.73.217.172
Web Server : nginx/1.24.0
System : Linux main-ubuntu 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/tanviranik.com/node_modules/vinext/dist/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/tanviranik.com/node_modules/vinext/dist/utils/lazy-chunks.js
//#region src/utils/lazy-chunks.ts
/**
* Compute the set of chunk filenames that are ONLY reachable through dynamic
* imports (i.e. behind React.lazy(), next/dynamic, or manual import()).
*
* These chunks should NOT be modulepreloaded in the HTML — they will be
* fetched on demand when the dynamic import executes.
*
* Algorithm: Starting from all entry chunks in the build manifest, walk the
* static `imports` tree (breadth-first). Any chunk file NOT reached by this
* walk is only reachable through `dynamicImports` and is therefore "lazy".
*
* @param buildManifest - Vite's build manifest (manifest.json), which is a
*   Record<string, ManifestChunk> where each chunk has `file`, `imports`,
*   `dynamicImports`, `isEntry`, and `isDynamicEntry` fields.
* @returns Array of chunk filenames (e.g. "assets/mermaid-NOHMQCX5.js") that
*   should be excluded from modulepreload hints.
*/
function computeLazyChunks(buildManifest) {
	const eagerFiles = /* @__PURE__ */ new Set();
	const visited = /* @__PURE__ */ new Set();
	const queue = [];
	for (const key of Object.keys(buildManifest)) if (buildManifest[key].isEntry) queue.push(key);
	while (queue.length > 0) {
		const key = queue.shift();
		if (!key || visited.has(key)) continue;
		visited.add(key);
		const chunk = buildManifest[key];
		if (!chunk) continue;
		eagerFiles.add(chunk.file);
		if (chunk.css) for (const cssFile of chunk.css) eagerFiles.add(cssFile);
		if (chunk.imports) {
			for (const imp of chunk.imports) if (!visited.has(imp)) queue.push(imp);
		}
	}
	const lazyChunks = [];
	const allFiles = /* @__PURE__ */ new Set();
	for (const key of Object.keys(buildManifest)) {
		const chunk = buildManifest[key];
		if (chunk.file && !allFiles.has(chunk.file)) {
			allFiles.add(chunk.file);
			if (!eagerFiles.has(chunk.file) && chunk.file.endsWith(".js")) lazyChunks.push(chunk.file);
		}
	}
	return lazyChunks;
}
//#endregion
export { computeLazyChunks };

//# sourceMappingURL=lazy-chunks.js.map

Youez - 2016 - github.com/yon3zu
LinuXploit