micro-memoize
Advanced tools
Comparing version 4.0.14 to 4.0.15
# 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 @@ |
@@ -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); |
@@ -104,3 +104,3 @@ { | ||
"types": "./index.d.ts", | ||
"version": "4.0.14" | ||
"version": "4.0.15" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
202431
32
4009