diff --git a/.changeset/nice-flowers-peel.md b/.changeset/nice-flowers-peel.md new file mode 100644 index 0000000000..aacfc0b6c5 --- /dev/null +++ b/.changeset/nice-flowers-peel.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/slang": patch +--- + +Make ESM named imports work in Node.js. diff --git a/crates/solidity/outputs/npm/package/index.js b/crates/solidity/outputs/npm/package/index.js index 5e8a890c4f..6dc44630ef 100644 --- a/crates/solidity/outputs/npm/package/index.js +++ b/crates/solidity/outputs/npm/package/index.js @@ -7,7 +7,5 @@ const language = require("./language"); const syntax = require("./syntax"); -module.exports = Object.freeze({ - language, - syntax, -}); +module.exports.language = language; +module.exports.syntax = syntax; diff --git a/crates/solidity/outputs/npm/package/language/index.js b/crates/solidity/outputs/npm/package/language/index.js index fc141eadba..0afe5d98fb 100644 --- a/crates/solidity/outputs/npm/package/language/index.js +++ b/crates/solidity/outputs/npm/package/language/index.js @@ -6,6 +6,4 @@ const generated = require("../generated"); -module.exports = Object.freeze({ - Language: generated.Language, -}); +module.exports.Language = generated.Language; diff --git a/crates/solidity/outputs/npm/package/syntax/index.js b/crates/solidity/outputs/npm/package/syntax/index.js index 73210766fa..9083630847 100644 --- a/crates/solidity/outputs/npm/package/syntax/index.js +++ b/crates/solidity/outputs/npm/package/syntax/index.js @@ -7,7 +7,5 @@ const nodes = require("./nodes"); const parser = require("./parser"); -module.exports = Object.freeze({ - nodes, - parser, -}); +module.exports.nodes = nodes; +module.exports.parser = parser; diff --git a/crates/solidity/outputs/npm/package/syntax/nodes/index.js b/crates/solidity/outputs/npm/package/syntax/nodes/index.js index 859b682074..043e1b0ba1 100644 --- a/crates/solidity/outputs/npm/package/syntax/nodes/index.js +++ b/crates/solidity/outputs/npm/package/syntax/nodes/index.js @@ -6,10 +6,8 @@ const generated = require("../../generated"); -module.exports = Object.freeze({ - NodeType: generated.NodeType, - RuleKind: generated.RuleKind, - RuleNode: generated.RuleNode, - TokenKind: generated.TokenKind, - TokenNode: generated.TokenNode, -}); +module.exports.NodeType = generated.NodeType; +module.exports.RuleKind = generated.RuleKind; +module.exports.RuleNode = generated.RuleNode; +module.exports.TokenKind = generated.TokenKind; +module.exports.TokenNode = generated.TokenNode; diff --git a/crates/solidity/outputs/npm/package/syntax/parser/index.js b/crates/solidity/outputs/npm/package/syntax/parser/index.js index 121319dccb..7dfbcc3177 100644 --- a/crates/solidity/outputs/npm/package/syntax/parser/index.js +++ b/crates/solidity/outputs/npm/package/syntax/parser/index.js @@ -6,8 +6,6 @@ const generated = require("../../generated"); -module.exports = Object.freeze({ - ParseError: generated.ParseError, - ParseOutput: generated.ParseOutput, - ProductionKind: generated.ProductionKind, -}); +module.exports.ParseError = generated.ParseError; +module.exports.ParseOutput = generated.ParseOutput; +module.exports.ProductionKind = generated.ProductionKind;