@@ -18,6 +18,7 @@ const ExportsMapEntry = zod.object({
18
18
} ) ;
19
19
20
20
const ExportsMapModel = zod . record (
21
+ zod . string ( ) ,
21
22
zod . union ( [
22
23
zod . string ( ) ,
23
24
zod . object ( {
@@ -30,7 +31,7 @@ const ExportsMapModel = zod.record(
30
31
31
32
const EnginesModel = zod . record ( zod . string ( ) , zod . string ( ) ) ;
32
33
33
- const BinModel = zod . record ( zod . string ( ) ) ;
34
+ const BinModel = zod . record ( zod . string ( ) , zod . string ( ) ) ;
34
35
35
36
export const checkCommand = createCommand < { } , { } > ( api => {
36
37
return {
@@ -129,9 +130,9 @@ async function checkExportsMapIntegrity(args: {
129
130
if ( exportsMapResult . success === false ) {
130
131
throw new Error (
131
132
"Missing exports map within the 'package.json'.\n" +
132
- exportsMapResult . error . message +
133
- '\nCorrect Example:\n' +
134
- JSON . stringify ( presetFieldsDual . exports , null , 2 ) ,
133
+ exportsMapResult . error . message +
134
+ '\nCorrect Example:\n' +
135
+ JSON . stringify ( presetFieldsDual . exports , null , 2 ) ,
135
136
) ;
136
137
}
137
138
@@ -192,9 +193,9 @@ async function checkExportsMapIntegrity(args: {
192
193
if ( result . exitCode !== 0 ) {
193
194
throw new Error (
194
195
`Require of file '${ file } ' failed.\n` +
195
- `In case this file is expected to raise an error please add an export to the 'bob.check.skip' field in your 'package.json' file.\n` +
196
- `Error:\n` +
197
- result . stderr ,
196
+ `In case this file is expected to raise an error please add an export to the 'bob.check.skip' field in your 'package.json' file.\n` +
197
+ `Error:\n` +
198
+ result . stderr ,
198
199
) ;
199
200
}
200
201
} ) ,
@@ -310,18 +311,18 @@ async function checkExportsMapIntegrity(args: {
310
311
await fse . access ( path . join ( args . cwd , filePath ) , fse . constants . X_OK ) . catch ( ( ) => {
311
312
throw new Error (
312
313
"Binary file '" +
313
- absoluteFilePath +
314
- "' is not executable.\n" +
315
- `Please set the executable bit e.g. by running 'chmod +x "${ absoluteFilePath } "'.` ,
314
+ absoluteFilePath +
315
+ "' is not executable.\n" +
316
+ `Please set the executable bit e.g. by running 'chmod +x "${ absoluteFilePath } "'.` ,
316
317
) ;
317
318
} ) ;
318
319
319
320
const contents = await fse . readFile ( absoluteFilePath , 'utf-8' ) ;
320
321
if ( ! contents . startsWith ( '#!/usr/bin/env node\n' ) ) {
321
322
throw new Error (
322
323
"Binary file '" +
323
- absoluteFilePath +
324
- "' does not have a shebang.\n Please add '#!/usr/bin/env node' to the beginning of the file." ,
324
+ absoluteFilePath +
325
+ "' does not have a shebang.\n Please add '#!/usr/bin/env node' to the beginning of the file." ,
325
326
) ;
326
327
}
327
328
}
0 commit comments