Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

publint

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

publint - npm Package Compare versions

Comparing version 0.1.15 to 0.1.16

5

index.d.ts

@@ -61,6 +61,3 @@ export type MessageType = 'suggestion' | 'warning' | 'error'

| BaseMessage<'EXPORTS_TYPES_SHOULD_BE_FIRST'>
| BaseMessage<
'EXPORTS_MODULE_SHOULD_PRECEDE_IMPORT_REQUIRE',
{ conditions: string[] }
>
| BaseMessage<'EXPORTS_MODULE_SHOULD_PRECEDE_REQUIRE'>
| BaseMessage<'EXPORTS_DEFAULT_SHOULD_BE_LAST'>

@@ -67,0 +64,0 @@ | BaseMessage<'EXPORTS_MODULE_SHOULD_BE_ESM'>

2

package.json
{
"name": "publint",
"version": "0.1.15",
"version": "0.1.16",
"description": "Lint packaging errors",

@@ -5,0 +5,0 @@ "type": "module",

@@ -496,26 +496,15 @@ import {

// a 'module' export should always precede 'import' or 'require'
if ('module' in exports) {
const conditions = []
if (
'require' in exports &&
exportsKeys.indexOf('module') > exportsKeys.indexOf('require')
) {
conditions.push('require')
}
if (
'import' in exports &&
exportsKeys.indexOf('module') > exportsKeys.indexOf('import')
) {
conditions.push('import')
}
if (conditions.length > 0) {
messages.push({
code: 'EXPORTS_MODULE_SHOULD_PRECEDE_IMPORT_REQUIRE',
args: { conditions },
path: currentPath.concat('module'),
type: 'error'
})
}
// if there is a 'require' and a 'module' condition at the same level,
// then 'module' should always precede 'require'
if (
'module' in exports &&
'require' in exports &&
exportsKeys.indexOf('module') > exportsKeys.indexOf('require')
) {
messages.push({
code: 'EXPORTS_MODULE_SHOULD_PRECEDE_REQUIRE',
args: {},
path: currentPath.concat('module'),
type: 'error'
})
}

@@ -522,0 +511,0 @@

@@ -59,11 +59,5 @@ import c from 'picocolors'

return `${c.bold(fp(m.path))} should be the first in the object as required by TypeScript.`
case 'EXPORTS_MODULE_SHOULD_PRECEDE_IMPORT_REQUIRE': {
let conditions = `the ${m.args.conditions
.map((cond) => `"${c.bold(cond)}"`)
.join(' and ')} condition`
if (m.args.conditions.length !== 1) {
conditions += 's'
}
case 'EXPORTS_MODULE_SHOULD_PRECEDE_REQUIRE': {
// prettier-ignore
return `${c.bold(fp(m.path))} should come before ${conditions} so it can take precedence when used by a bundler.`
return `${c.bold(fp(m.path))} should come before the "require" condition so it can take precedence when used by a bundler.`
}

@@ -70,0 +64,0 @@ case 'EXPORTS_DEFAULT_SHOULD_BE_LAST':

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc