Skip to content

Commit 804c700

Browse files
committed
feat!: drop CJS distribution
This package is now ESM only, and may be imported by Node >= 20.12.0. BREAKING CHANGE: Require Node >= 20 for consuming this module from CJS.
1 parent 0c390f6 commit 804c700

File tree

9 files changed

+48
-15
lines changed

9 files changed

+48
-15
lines changed

eslint.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,13 @@ export default [
8383
'@typescript-eslint/no-unused-expressions': 'off'
8484
},
8585
files: files.test
86+
},
87+
{
88+
rules: {
89+
'@typescript-eslint/no-require-imports': 'off'
90+
},
91+
files: [
92+
'**/*.cjs'
93+
]
8694
}
8795
];

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
"author": "Nico Rehwaldt <git_nikku@nixis.de>",
66
"license": "MIT",
77
"type": "module",
8-
"main": "dist/index.cjs",
9-
"module": "dist/index.esm.js",
108
"source": "src/index.ts",
119
"types": "dist/index.d.ts",
10+
"exports": {
11+
".": "./dist/index.js",
12+
"./package.json": "./package.json"
13+
},
1214
"devDependencies": {
1315
"@rollup/plugin-terser": "^0.4.4",
1416
"@rollup/plugin-typescript": "^12.3.0",
@@ -39,7 +41,7 @@
3941
"url": "https://github.com/nikku/feelin"
4042
},
4143
"engines": {
42-
"node": "*"
44+
"node": ">= 20.12.0"
4345
},
4446
"sideEffects": false,
4547
"scripts": {
@@ -51,7 +53,7 @@
5153
"dev": "run-p *:dev",
5254
"generate-typings": "tsc --emitDeclarationOnly --declaration --outDir dist",
5355
"prepare": "run-s build generate-typings",
54-
"test": "mocha -r source-map-support/register test/*-spec.js",
56+
"test": "mocha -r source-map-support/register test/*-spec.js test/*-spec.cjs",
5557
"test:dev": "chokidar '{dist,test}/**/*.js' -c 'npm test'",
5658
"tck": "run-s tck:extract tck:test",
5759
"tck:extract": "node tasks/extract-tck-tests.js",

rollup.config.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@ export default [
1414
input: srcEntry,
1515
output: [
1616
{
17-
file: pkg.main,
18-
format: 'cjs',
19-
sourcemap: true
20-
},
21-
{
22-
file: pkg.module,
17+
file: pkg.exports['.'],
2318
format: 'es',
2419
sourcemap: true
2520
}

test/builtins-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66

77
import {
88
evaluate
9-
} from '../dist/index.esm.js';
9+
} from 'feelin';
1010

1111
import {
1212
evaluate as evaluateMinified

test/interpreter-perf-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44

55
import {
66
evaluate
7-
} from '../dist/index.esm.js';
7+
} from 'feelin';
88

99

1010
describe('interpreter', function() {

test/interpreter-spec.cjs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const { expect } = require('./helpers.js');
2+
3+
const {
4+
unaryTest,
5+
evaluate
6+
} = require('feelin');
7+
8+
9+
describe('interpreter', function() {
10+
11+
describe('cjs', function() {
12+
13+
it('should evaluate', function() {
14+
15+
// then
16+
expect(evaluate('1 < 2')).to.be.true;
17+
});
18+
19+
20+
it('should unaryTest', function() {
21+
22+
// then
23+
expect(unaryTest('< 2', { '?': 1 })).to.be.true;
24+
});
25+
26+
});
27+
28+
});

test/interpreter-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
evaluate,
88
date,
99
duration
10-
} from '../dist/index.esm.js';
10+
} from 'feelin';
1111

1212

1313
describe('interpreter', function() {

test/tck/tck-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99

1010
import {
1111
evaluate
12-
} from '../../dist/index.esm.js';
12+
} from 'feelin';
1313

1414

1515
const NOT_IMPLEMENTED = {};

0 commit comments

Comments
 (0)