"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.recordCjsEntryPlugin = void 0;
function recordCjsEntryPlugin(data) {
    return {
        name: 'vite:cjs-entry-named-export',
        async generateBundle(options, bundle) {
            Object.values(bundle).forEach((chunk) => {
                var _a, _b;
                if (chunk.type === 'chunk' && chunk.isEntry) {
                    data.map[chunk.name] = chunk.fileName;
                    if (chunk.facadeModuleId) {
                        const facadeInfo = this.getModuleInfo(chunk.facadeModuleId);
                        // this info is exposed by rollup commonjs plugin
                        if ((_b = (_a = facadeInfo === null || facadeInfo === void 0 ? void 0 : facadeInfo.meta) === null || _a === void 0 ? void 0 : _a.commonjs) === null || _b === void 0 ? void 0 : _b.isCommonJS) {
                            data.cjsEntries[chunk.fileName] = true;
                        }
                    }
                }
            });
        }
    };
}
exports.recordCjsEntryPlugin = recordCjsEntryPlugin;
//# sourceMappingURL=depMetadataPlugin.js.map