Skip to content

Commit

Permalink
fix record-and-tuple babel config
Browse files Browse the repository at this point in the history
  • Loading branch information
caub committed Dec 29, 2020
1 parent 651c8e4 commit 0afb100
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/plugins/js-eval/__tests__/jsEvalPlugin-test.js
Expand Up @@ -89,11 +89,17 @@ describe('jsEvalPlugin', () => {
);
expect(output).toEqual(`(okay) [ 0, 2, 4 ]`);
});

it(`babel has Object.fromEntries`, async () => {
const output = await testEval(`b> typeof Object.fromEntries`);
expect(output).toEqual(`(okay) 'function'`);
});

it(`babel has records`, async () => {
const output = await testEval(`b> #{x:1} === #{x: 1}`);
expect(output).toEqual(`(okay) true`);
});

it(`handles empty input`, async () => {
const output = await testEval(`n> `);
expect(output).toEqual(`(okay) undefined`);
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/js-eval/babelPlugins.js
Expand Up @@ -28,9 +28,10 @@ exports.transformPlugins = [
'@babel/plugin-syntax-bigint',
'@babel/plugin-syntax-import-meta',
'@babel/plugin-proposal-unicode-property-regex',
['@babel/plugin-syntax-record-and-tuple', { syntaxType: 'hash' }],
];

// @babel/parser plugins https://babeljs.io/docs/en/next/babel-parser.html#ecmascript-proposals-https-githubcom-babel-proposals
// @babel/parser plugins https://babeljs.io/docs/en/babel-parser#ecmascript-proposalshttpsgithubcombabelproposals
exports.parserPlugins = [
['decorators', { decoratorsBeforeExport: true }],
'classProperties',
Expand All @@ -44,6 +45,6 @@ exports.parserPlugins = [
'partialApplication',
['pipelineOperator', { proposal: 'minimal' }],
'privateIn',
['recordAndtuple', { hash: true }],
['recordAndTuple', { syntaxType: 'hash' }],
'throwExpressions',
];

0 comments on commit 0afb100

Please sign in to comment.