MCPcopy
hub / github.com/vitejs/vite / exportAll

Function exportAll

packages/vite/src/module-runner/runner.ts:426–449  ·  view source on GitHub ↗
(exports: any, sourceModule: any)

Source from the content-addressed store, hash-verified

424}
425
426function exportAll(exports: any, sourceModule: any) {
427 // when a module exports itself it causes
428 // call stack error
429 if (exports === sourceModule) return
430
431 if (
432 isPrimitive(sourceModule) ||
433 Array.isArray(sourceModule) ||
434 sourceModule instanceof Promise
435 )
436 return
437
438 for (const key in sourceModule) {
439 if (key !== 'default' && key !== '__esModule' && !(key in exports)) {
440 try {
441 Object.defineProperty(exports, key, {
442 enumerable: true,
443 configurable: true,
444 get: () => sourceModule[key],
445 })
446 } catch {}
447 }
448 }
449}

Callers 1

directRequestMethod · 0.85

Calls 1

isPrimitiveFunction · 0.90

Tested by

no test coverage detected