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

micro-memoize

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micro-memoize - npm Package Compare versions

Comparing version 4.1.0-beta.2 to 4.1.0-beta.3

mjs/index.d.ts

4

CHANGELOG.md
# micro-memoize CHANGELOG
## 4.0.15
- [#99](https://github.com/planttheidea/micro-memoize/issues/99) - `mjs` import does not have typings surfaced
## 4.0.14

@@ -4,0 +8,0 @@

44

es-to-mjs.js

@@ -6,31 +6,45 @@ const fs = require('fs');

const SOURCE = path.join(__dirname, pkg.module);
const SOURCE_MAP = `${SOURCE}.map`;
const DESTINATION = path.join(__dirname, 'mjs', 'index.mjs');
const DESTINATION_MAP = `${DESTINATION}.map`;
const BASE_PATH = __dirname;
const SOURCE_ENTRY = path.join(BASE_PATH, pkg.module);
const SOURCE_MAP = `${SOURCE_ENTRY}.map`;
const SOURCE_TYPES = path.join(BASE_PATH, 'index.d.ts');
const DESTINATION = 'mjs';
const DESTINATION_ENTRY = path.join(BASE_PATH, DESTINATION, 'index.mjs');
const DESTINATION_MAP = `${DESTINATION_ENTRY}.map`;
const DESTINATION_TYPES = path.join(BASE_PATH, DESTINATION, 'index.d.ts');
function getFilename(filename) {
const split = filename.split('/');
return split[split.length - 1];
return filename.replace(`${BASE_PATH}/`, '');
}
try {
if (!fs.existsSync(path.join(__dirname, 'mjs'))) {
fs.mkdirSync(path.join(__dirname, 'mjs'));
if (!fs.existsSync(path.join(BASE_PATH, 'mjs'))) {
fs.mkdirSync(path.join(BASE_PATH, 'mjs'));
}
fs.copyFileSync(SOURCE, DESTINATION);
fs.copyFileSync(SOURCE_ENTRY, DESTINATION_ENTRY);
const contents = fs
.readFileSync(DESTINATION, { encoding: 'utf8' })
.replace(/\/\/# sourceMappingURL=(.*)/, (match, value) => match.replace(value, 'index.mjs.map'));
.readFileSync(DESTINATION_ENTRY, { encoding: 'utf8' })
.replace(/\/\/# sourceMappingURL=(.*)/, (match, value) =>
match.replace(value, 'index.mjs.map'),
);
fs.writeFileSync(DESTINATION, contents, { encoding: 'utf8' });
fs.writeFileSync(DESTINATION_ENTRY, contents, { encoding: 'utf8' });
console.log(`Copied ${getFilename(SOURCE)} to ${getFilename(DESTINATION)}`);
console.log(
`Copied ${getFilename(SOURCE_ENTRY)} to ${getFilename(DESTINATION_ENTRY)}`,
);
fs.copyFileSync(SOURCE_MAP, DESTINATION_MAP);
console.log(`Copied ${getFilename(SOURCE_MAP)} to ${getFilename(DESTINATION_MAP)}`);
console.log(
`Copied ${getFilename(SOURCE_MAP)} to ${getFilename(DESTINATION_MAP)}`,
);
fs.copyFileSync(SOURCE_TYPES, DESTINATION_TYPES);
console.log(
`Copied ${getFilename(SOURCE_TYPES)} to ${getFilename(DESTINATION_TYPES)}`,
);
} catch (error) {

@@ -37,0 +51,0 @@ console.error(error);

@@ -105,3 +105,3 @@ {

"types": "./index.d.ts",
"version": "4.1.0-beta.2"
"version": "4.1.0-beta.3"
}
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