feat(esm): convert to esm (#2569)

for #2543

BREAKING CHANGE: semantic-release is now ESM-only. since it is used through its own executable, the impact on consuming projects should be minimal

BREAKING CHANGE: references to plugin files in configs need to include the file extension because of executing in an ESM context
This commit is contained in:
Matt Travi
2022-11-11 09:24:06 -06:00
committed by GitHub
parent 4012f75386
commit 9eab1adb9d
67 changed files with 3001 additions and 1761 deletions
+1 -1
View File
@@ -1 +1 @@
module.exports = () => {};
export default () => {}
+3 -3
View File
@@ -1,4 +1,4 @@
const SemanticReleaseError = require('@semantic-release/error');
import SemanticReleaseError from '@semantic-release/error';
class InheritedError extends SemanticReleaseError {
constructor(message, code) {
@@ -9,6 +9,6 @@ class InheritedError extends SemanticReleaseError {
}
}
module.exports = () => {
export default () => {
throw new InheritedError('Inherited error', 'EINHERITED');
};
}
+2 -2
View File
@@ -1,5 +1,5 @@
module.exports = () => {
export default () => {
const error = new Error('a');
error.errorProperty = 'errorProperty';
throw error;
};
}
+3 -3
View File
@@ -1,5 +1,5 @@
const AggregateError = require('aggregate-error');
import AggregateError from 'aggregate-error';
module.exports = () => {
export default () => {
throw new AggregateError([new Error('a'), new Error('b')]);
};
}
+1 -1
View File
@@ -1 +1 @@
module.exports = (pluginConfig, context) => context;
export default (pluginConfig, context) => context
+2 -2
View File
@@ -1,6 +1,6 @@
module.exports = (pluginConfig, {env, logger}) => {
export default (pluginConfig, {env, logger}) => {
console.log(`Console: Exposing token ${env.MY_TOKEN}`);
logger.log(`Log: Exposing token ${env.MY_TOKEN}`);
logger.error(`Error: Console token ${env.MY_TOKEN}`);
throw new Error(`Throw error: Exposing ${env.MY_TOKEN}`);
};
}
+1 -1
View File
@@ -1 +1 @@
module.exports = (pluginConfig, context) => ({pluginConfig, context});
export default (pluginConfig, context) => ({pluginConfig, context})