@@ -177,6 +177,13 @@ async function globDtsAndMapFiles(namePattern, srcPath) {
177177 } )
178178}
179179
180+ async function globJsFiles ( namePattern , srcPath ) {
181+ return await tinyGlob ( [ `**/${ namePattern } .js` ] , {
182+ absolute : true ,
183+ cwd : srcPath
184+ } )
185+ }
186+
180187function isAncestorsExternal ( id ) {
181188 let currNmIndex = id . indexOf ( SLASH_NODE_MODULES_SLASH )
182189 while ( currNmIndex !== - 1 ) {
@@ -200,6 +207,14 @@ async function moveDtsAndMapFiles(namePattern, srcPath, destPath) {
200207 )
201208}
202209
210+ async function moveJsFiles ( namePattern , srcPath , destPath ) {
211+ await Promise . all (
212+ ( await globJsFiles ( namePattern , srcPath ) ) . map ( p =>
213+ fs . rename ( p , path . join ( destPath , path . basename ( p ) ) )
214+ )
215+ )
216+ }
217+
203218async function removeDtsAndMapFiles ( namePattern , srcPath ) {
204219 await Promise . all (
205220 ( await globDtsAndMapFiles ( namePattern , srcPath ) ) . map ( p => fs . rm ( p ) )
@@ -208,12 +223,7 @@ async function removeDtsAndMapFiles(namePattern, srcPath) {
208223
209224async function removeJsFiles ( namePattern , srcPath ) {
210225 await Promise . all (
211- (
212- await tinyGlob ( [ `**/${ namePattern } .js` ] , {
213- absolute : true ,
214- cwd : srcPath
215- } )
216- ) . map ( p => fs . rm ( p ) )
226+ ( await globJsFiles ( namePattern , srcPath ) ) . map ( p => fs . rm ( p ) )
217227 )
218228}
219229
@@ -500,14 +510,22 @@ export default () => {
500510 async writeBundle ( ) {
501511 await Promise . all ( [
502512 updateDepStats ( requireConfig . meta . depStats ) ,
513+ moveDtsAndMapFiles ( CONSTANTS , distModuleSyncPath , rootDistPath ) ,
514+ moveDtsAndMapFiles ( VENDOR , distRequirePath , distModuleSyncPath ) ,
515+ moveJsFiles ( VENDOR , distRequirePath , distModuleSyncPath )
516+ ] )
517+ await Promise . all ( [
518+ removeDtsAndMapFiles ( CONSTANTS , distModuleSyncPath ) ,
503519 removeDtsAndMapFiles (
504520 `!(${ [ ...keptRequireDtsMapFiles ] . sort ( naturalCompare ) . join ( '|' ) } )` ,
505521 distRequirePath
506522 ) ,
507- moveDtsAndMapFiles ( CONSTANTS , distModuleSyncPath , rootDistPath )
508- ] )
509- await Promise . all ( [
510- removeDtsAndMapFiles ( CONSTANTS , distModuleSyncPath ) ,
523+ // Stub out the ./dist/require/vendor.js file.
524+ fs . writeFile (
525+ path . join ( distRequirePath , VENDOR_JS ) ,
526+ createStubCode ( `../${ MODULE_SYNC } /${ VENDOR_JS } ` ) ,
527+ 'utf8'
528+ ) ,
511529 // Lazily access constants.ENV[INLINED_SOCKET_CLI_SENTRY_BUILD].
512530 ...( constants . ENV [ INLINED_SOCKET_CLI_SENTRY_BUILD ]
513531 ? [
0 commit comments