1
1
import { existsSync } from 'node:fs'
2
- import { cp , mkdir , rename , rm } from 'node:fs/promises'
2
+ import { cp , mkdir , readFile , rename , rm , writeFile } from 'node:fs/promises'
3
3
import { basename , join } from 'node:path'
4
4
5
5
import { trace } from '@opentelemetry/api'
@@ -8,6 +8,7 @@ import glob from 'fast-glob'
8
8
9
9
import { encodeBlobKey } from '../../shared/blobkey.js'
10
10
import { PluginContext } from '../plugin-context.js'
11
+ import { verifyNoNetlifyForms } from '../verification.js'
11
12
12
13
const tracer = wrapTracer ( trace . getTracer ( 'Next runtime' ) )
13
14
@@ -25,14 +26,14 @@ export const copyStaticContent = async (ctx: PluginContext): Promise<void> => {
25
26
} )
26
27
27
28
try {
29
+ await mkdir ( destDir , { recursive : true } )
28
30
await Promise . all (
29
31
paths
30
32
. filter ( ( path ) => ! paths . includes ( `${ path . slice ( 0 , - 5 ) } .json` ) )
31
33
. map ( async ( path ) : Promise < void > => {
32
- await cp ( join ( srcDir , path ) , join ( destDir , await encodeBlobKey ( path ) ) , {
33
- recursive : true ,
34
- force : true ,
35
- } )
34
+ const html = await readFile ( join ( srcDir , path ) , 'utf-8' )
35
+ verifyNoNetlifyForms ( ctx , html )
36
+ await writeFile ( join ( destDir , await encodeBlobKey ( path ) ) , html , 'utf-8' )
36
37
} ) ,
37
38
)
38
39
} catch ( error ) {
0 commit comments