Socket
Socket
Sign inDemoInstall

tshy

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tshy - npm Package Compare versions

Comparing version 1.2.2 to 1.3.0

11

dist/esm/config.js
// get the config and package and stuff
import fail from './fail.js';
import pkg from './package.js';

@@ -6,2 +7,9 @@ import sources from './sources.js';

import validExports from './valid-exports.js';
const validBoolean = (e, name) => {
const v = e[name];
if (v === undefined || typeof v === 'boolean')
return true;
fail(`tshy.${name} must be a boolean value if specified, got: ` + v);
return process.exit(1);
};
const validConfig = (e) => !!e &&

@@ -11,3 +19,4 @@ typeof e === 'object' &&

(e.dialects === undefined || validDialects(e['dialects'])) &&
(e.selfLink === undefined || typeof e.selfLink === 'boolean');
validBoolean(e, 'selfLink') &&
validBoolean(e, 'main');
const getConfig = (pkg, sources) => {

@@ -14,0 +23,0 @@ const tshy = validConfig(pkg.tshy) ? pkg.tshy : {};

6

dist/esm/exports.js

@@ -74,5 +74,5 @@ import { relative, resolve } from 'node:path/posix';

export const setMain = (c, pkg) => {
if (!!c?.main) {
c.main = true;
const mod = resolveExport(pkg.exports['.'], ['require']);
const mod = resolveExport(pkg.exports['.'], ['require']);
const main = c?.main ?? !!mod;
if (main) {
if (!mod) {

@@ -79,0 +79,0 @@ fail(`could not resolve exports['.'] for tshy.main 'require'`);

{
"name": "tshy",
"version": "1.2.2",
"version": "1.3.0",
"description": "TypeScript HYbridizer - Hybrid (CommonJS/ESM) TypeScript node package builder",

@@ -37,3 +37,3 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)",

"engines": {
"node": "16 >=16.17 || 18 >=18.16.0 || >=20.6.1"
"node": "16 >=16.17 || 18 >=18.15.0 || >=20.6.1"
},

@@ -40,0 +40,0 @@ "repository": "https://github.com/isaacs/tshy",

@@ -163,11 +163,13 @@ # tshy - TypeScript HYbridizer

2016) did not have support for `exports` as a means for defining
package entry points.
package entry points. Unfortunately, even 7 years later at the
time of this writing, some projects are still using outdated
tools that are not capable of understanding this interface.
By default, tshy deletes the `main` field, rather than maintain
this affordance for versions of node that met their end of life
long ago. However, some tools still rely on `main` and have not
been updated to read the package entry points via `exports`.
If there is a `commonjs` export of the `"."` subpath, and the
`tshy.main` field in package.json is not set to `false`, then
tshy will use that to set the `main` and `types` fields, for
compatibility with these tools.
**Warning: this will likely cause incorrect types to be loaded in
some scenarios.**
**Warning: relying on top-level main/types will likely cause
incorrect types to be loaded in some scenarios.**

@@ -180,8 +182,6 @@ Use with extreme caution. It's almost always better to _not_

You can tell tshy to export a top-level `main` and `types` field
by setting `main` to `true`.
If the `commonjs` dialect is not built, or if a `"."` export is
not created, or if the `"."` export does not support the
`commonjs` dialect, then the build will fail.
`commonjs` dialect, and `main` is explicitly set to `true`, then
the build will fail.

@@ -195,4 +195,3 @@ For example, this config:

".": "./src/index.ts"
},
"main": true
}
}

@@ -199,0 +198,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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