Socket
Socket
Sign inDemoInstall

@ms-cloudpack/package-utilities

Package Overview
Dependencies
Maintainers
2
Versions
203
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 2.0.0 to 2.1.0

17

CHANGELOG.json

@@ -5,3 +5,18 @@ {

{
"date": "Wed, 16 Nov 2022 08:11:17 GMT",
"date": "Sat, 19 Nov 2022 08:10:58 GMT",
"tag": "@ms-cloudpack/package-utilities_v2.1.0",
"version": "2.1.0",
"comments": {
"minor": [
{
"author": "dzearing@microsoft.com",
"package": "@ms-cloudpack/package-utilities",
"commit": "d344ed834a43d2e07922cc413940f89d97956580",
"comment": "When creating exports maps using createExportsMap, packages with no metadata but have src/index.*, src/main.*, or /index.* will still generate an entry point."
}
]
}
},
{
"date": "Wed, 16 Nov 2022 08:11:39 GMT",
"tag": "@ms-cloudpack/package-utilities_v2.0.0",

@@ -8,0 +23,0 @@ "version": "2.0.0",

# Change Log - @ms-cloudpack/package-utilities
This log was last generated on Wed, 16 Nov 2022 08:11:17 GMT and should not be manually modified.
This log was last generated on Sat, 19 Nov 2022 08:10:58 GMT and should not be manually modified.
<!-- Start content -->
## 2.1.0
Sat, 19 Nov 2022 08:10:58 GMT
### Minor changes
- When creating exports maps using createExportsMap, packages with no metadata but have src/index.*, src/main.*, or /index.* will still generate an entry point. (dzearing@microsoft.com)
## 2.0.0
Wed, 16 Nov 2022 08:11:17 GMT
Wed, 16 Nov 2022 08:11:39 GMT

@@ -11,0 +19,0 @@ ### Major changes

2

lib/addExportsMapEntry.d.ts

@@ -43,2 +43,2 @@ import type { PackageDefinitions } from './PackageDefinitions.js';

*/
export declare function addExportsMapEntry(options: AddExportsMapEntryOptions): Promise<void>;
export declare function addExportsMapEntry(options: AddExportsMapEntryOptions): Promise<boolean>;

@@ -31,2 +31,3 @@ import { findFileInPackage } from './findFileInPackage.js';

}
return !!filePath;
}

@@ -33,0 +34,0 @@ function makeSafeImportKey(key) {

@@ -54,4 +54,12 @@ import { PackageDefinitions } from './PackageDefinitions.js';

}
// If we couldn't infer the exports map shape from existing metadata,
// formulate based off inferred file structure.
// Note: CRA defaults to src/index.js, Vite defaults to src/main.js
if (Object.keys(exports).length === 0) {
(await addExportsMapEntry({ exports, packagePath, filePath: './lib/index.js' })) ||
(await addExportsMapEntry({ exports, packagePath, filePath: './lib/main.js' })) ||
(await addExportsMapEntry({ exports, packagePath, filePath: './index.js' }));
}
return exports;
}
//# sourceMappingURL=createExportsMap.js.map

@@ -256,3 +256,50 @@ import { describe, it, expect } from '@jest/globals';

});
it(`can build an exports map for a CRA TS scenario`, async () => {
const packagePath = await createTestFileStructure({
'package.json': {},
'src/index.tsx': '',
});
const exportsMap = await createExportsMap(packagePath);
expect(Object.keys(exportsMap).length).toBeGreaterThan(0);
expect(exportsMap).toMatchInlineSnapshot(`
{
".": {
"default": "./lib/index.js",
"source": "./src/index.tsx",
"types": "./lib/index.d.ts",
},
}
`);
});
it(`can build an exports map for a CRA JS scenario`, async () => {
const packagePath = await createTestFileStructure({
'package.json': {},
'src/index.js': '',
});
const exportsMap = await createExportsMap(packagePath);
expect(exportsMap).toMatchInlineSnapshot(`
{
".": {
"default": "./lib/index.js",
"source": "./src/index.js",
"types": "./lib/index.d.ts",
},
}
`);
});
it(`can find a root index file.`, async () => {
const packagePath = await createTestFileStructure({
'package.json': {},
'index.js': '',
});
const exportsMap = await createExportsMap(packagePath);
expect(exportsMap).toMatchInlineSnapshot(`
{
".": {
"default": "./index.js",
},
}
`);
});
});
//# sourceMappingURL=createExportsMap.test.js.map
{
"name": "@ms-cloudpack/package-utilities",
"version": "2.0.0",
"version": "2.1.0",
"description": "Utilities for resolving/parsing packages and their imports.",

@@ -5,0 +5,0 @@ "license": "MIT",

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