File tree Expand file tree Collapse file tree 4 files changed +56
-3
lines changed Expand file tree Collapse file tree 4 files changed +56
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @opennextjs/aws " : patch
3+ ---
4+
5+ fix(build): Improve regex in copy traced files to skip symbolic links
Original file line number Diff line number Diff line change @@ -45,9 +45,15 @@ const EXCLUDED_PACKAGES = [
4545 "next/dist/compiled/amphtml-validator" ,
4646] ;
4747
48- function isExcluded ( srcPath : string ) : boolean {
48+ export function isExcluded ( srcPath : string ) : boolean {
4949 return EXCLUDED_PACKAGES . some ( ( excluded ) =>
50- srcPath . match ( getCrossPlatformPathRegex ( `/node_modules/${ excluded } /` ) ) ,
50+ // `pnpm` can create a symbolic link that points to the pnpm store folder
51+ // This will live under `/node_modules/sharp`. We need to handle this in our regex
52+ srcPath . match (
53+ getCrossPlatformPathRegex ( `/node_modules/${ excluded } (?:/|$)` , {
54+ escape : false ,
55+ } ) ,
56+ ) ,
5157 ) ;
5258}
5359
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ export function installDependencies(
8585 fs . rmSync ( tempInstallDir , { recursive : true , force : true } ) ;
8686 logger . info ( `Dependencies installed for ${ name } ` ) ;
8787 } catch ( e : any ) {
88- logger . error ( e . stdout . toString ( ) ) ;
88+ logger . error ( e . toString ( ) ) ;
8989 logger . error ( "Could not install dependencies" ) ;
9090 }
9191}
Original file line number Diff line number Diff line change 1+ import { isExcluded } from "@opennextjs/aws/build/copyTracedFiles.js" ;
2+
3+ describe ( "isExcluded" , ( ) => {
4+ test ( "should exclude sharp" , ( ) => {
5+ expect (
6+ isExcluded (
7+ "/home/user/git/my-opennext-project/node_modules/sharp/lib/index.js" ,
8+ ) ,
9+ ) . toBe ( true ) ;
10+ expect (
11+ isExcluded (
12+ "/home/user/git/my-opennext-project/node_modules/.pnpm/sharp/4.1.3/node_modules/sharp/lib/index.js" ,
13+ ) ,
14+ ) . toBe ( true ) ;
15+ expect (
16+ isExcluded ( "/home/user/git/my-opennext-project/node_modules/sharp" ) ,
17+ ) . toBe ( true ) ;
18+ } ) ;
19+
20+ test ( "should not exclude other packages" , ( ) => {
21+ expect (
22+ isExcluded (
23+ "/home/user/git/my-opennext-project/node_modules/other-package/lib/index.js" ,
24+ ) ,
25+ ) . toBe ( false ) ;
26+ expect (
27+ isExcluded (
28+ "/home/user/git/my-opennext-project/node_modules/.pnpm/other-package/4.1.3/node_modules/other-package/lib/index.js" ,
29+ ) ,
30+ ) . toBe ( false ) ;
31+ expect (
32+ isExcluded (
33+ "/home/user/git/my-opennext-project/node_modules/.pnpm/other-package/4.1.3/node_modules/sharp-other-package/lib/index.js" ,
34+ ) ,
35+ ) . toBe ( false ) ;
36+ expect (
37+ isExcluded (
38+ "/home/user/git/my-opennext-project/node_modules/.pnpm/other-package/4.1.3/node_modules/sharp-other" ,
39+ ) ,
40+ ) . toBe ( false ) ;
41+ } ) ;
42+ } ) ;
You can’t perform that action at this time.
0 commit comments