Socket
Socket
Sign inDemoInstall

@ms-cloudpack/package-utilities

Package Overview
Dependencies
Maintainers
0
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ms-cloudpack/package-utilities - npm Package Compare versions

Comparing version 8.2.0 to 9.0.0

9

lib/addExportsMapEntry.d.ts

@@ -31,5 +31,10 @@ import type { CloudpackConfig, PackageDefinitionsCache, PackageJsonExports } from '@ms-cloudpack/common-types';

/**
* The condition to add the entry for. (Example: "import", "require", "browser", "types") Defaults to "default"
* The condition to add the entry for. (Example: "import", "require") Defaults to "default".
*/
condition?: string;
requestCondition?: 'import' | 'require' | 'browser';
/**
* The condition that describes the environment the entry is for. (Example: "browser", "node".)
* Unspecified implies environmentally agnostic.
*/
environmentCondition?: 'browser' | 'node';
}

@@ -36,0 +41,0 @@ /**

@@ -7,3 +7,3 @@ import { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';

export async function addExportsMapEntry(options, context) {
const { exports, packagePath, condition = 'default' } = options;
const { exports, packagePath, environmentCondition, requestCondition } = options;
const importPath = normalizeRelativePath(options.importPath);

@@ -20,26 +20,21 @@ const { filePath, sourcePath, typesPath = options.typesPath ? normalizeRelativePath(options.typesPath) : undefined, } = await findFileInPackage({

const localExports = exports;
let exportValue;
// If this is the only entry we're adding, set it to a string to minimize the exports map.
if (!typesPath &&
!sourcePath &&
condition === 'default' &&
(!localExports[importPath] || typeof localExports[importPath] === 'string')) {
localExports[importPath] = filePath;
if (!typesPath && !sourcePath && !requestCondition) {
exportValue = filePath;
}
else {
let exportsEntry = (localExports[importPath] ??= {});
// Promote string-based exports into objects with default conditions.
if (typeof exportsEntry === 'string') {
exportsEntry = exports[importPath] = { default: exportsEntry };
}
exportValue = {};
if (typesPath) {
exportsEntry['types'] = typesPath;
exportValue['types'] = typesPath;
}
if (sourcePath) {
exportsEntry['source'] = sourcePath;
exportValue['source'] = sourcePath;
}
// Add the entry for the condition.
exportsEntry[condition] = filePath;
exportValue[requestCondition || 'default'] = filePath;
}
localExports[importPath] = environmentCondition ? { [environmentCondition]: exportValue } : exportValue;
return true;
}
//# sourceMappingURL=addExportsMapEntry.js.map

@@ -27,3 +27,3 @@ import { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';

typesPath,
condition: type === 'module' ? 'import' : 'default',
requestCondition: type === 'module' ? 'import' : undefined,
}, context);

@@ -37,3 +37,3 @@ }

typesPath,
condition: type === 'module' ? 'import' : 'default',
requestCondition: type === 'module' ? 'import' : undefined,
}, context);

@@ -47,3 +47,3 @@ }

typesPath,
condition: 'import',
requestCondition: 'import',
}, context);

@@ -53,3 +53,3 @@ }

if (typeof definition.browser === 'string') {
await addExportsMapEntry({ exports, packagePath, filePath: definition.browser, condition: 'browser' }, context);
await addExportsMapEntry({ exports, packagePath, filePath: definition.browser, requestCondition: 'browser' }, context);
}

@@ -72,3 +72,3 @@ else if (typeof definition.browser === 'object') {

filePath: value,
condition: 'browser',
requestCondition: 'browser',
}, context);

@@ -75,0 +75,0 @@ }

{
"name": "@ms-cloudpack/package-utilities",
"version": "8.2.0",
"version": "9.0.0",
"description": "Utilities for resolving/parsing packages and their imports.",

@@ -17,7 +17,7 @@ "license": "MIT",

"dependencies": {
"@ms-cloudpack/common-types": "^0.14.0",
"@ms-cloudpack/common-types": "^0.15.0",
"@ms-cloudpack/json-utilities": "^0.1.6",
"@ms-cloudpack/package-overrides": "^0.9.16",
"@ms-cloudpack/package-overrides": "^0.9.17",
"@ms-cloudpack/path-string-parsing": "^1.2.4",
"@ms-cloudpack/path-utilities": "^2.7.31",
"@ms-cloudpack/path-utilities": "^2.7.32",
"@ms-cloudpack/task-reporter": "^0.14.4",

@@ -24,0 +24,0 @@ "acorn": "^8.11.2",

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

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