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 = [
45
45
"next/dist/compiled/amphtml-validator" ,
46
46
] ;
47
47
48
- function isExcluded ( srcPath : string ) : boolean {
48
+ export function isExcluded ( srcPath : string ) : boolean {
49
49
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
+ ) ,
51
57
) ;
52
58
}
53
59
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ export function installDependencies(
85
85
fs . rmSync ( tempInstallDir , { recursive : true , force : true } ) ;
86
86
logger . info ( `Dependencies installed for ${ name } ` ) ;
87
87
} catch ( e : any ) {
88
- logger . error ( e . stdout . toString ( ) ) ;
88
+ logger . error ( e . toString ( ) ) ;
89
89
logger . error ( "Could not install dependencies" ) ;
90
90
}
91
91
}
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