Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile using babel for compatibility with older versions #96

Merged
merged 22 commits into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
296103f
compile using babel for compatibility with older versions
brettz9 Mar 27, 2020
af6a94a
- Update travis for some conditional installs
brettz9 Mar 27, 2020
23bad05
Try with older Rollup plugin versions
brettz9 Mar 27, 2020
148149f
attempt to avoid build on older versions
brettz9 Mar 28, 2020
440dd1a
Babel: Transform `Object.entries`
brettz9 Mar 28, 2020
12c769c
- Attempt using babel/register over esm to utilize babel plugin
brettz9 Mar 28, 2020
bf2688c
Babel: Transform dot-all regex
brettz9 Mar 28, 2020
8cbc7d5
- Travis logic for using older Mocha versions
brettz9 Mar 28, 2020
08420b1
Pass in core-js regexp constructor to tests (so tests can pass)
brettz9 Mar 28, 2020
b78e027
- use babel-register for older Node versions
brettz9 Mar 28, 2020
6334c8c
Revert "Pass in core-js regexp constructor to tests (so tests can pass)"
brettz9 Mar 28, 2020
83cee96
- Switch `engines` to 0.10 minimum
brettz9 Mar 28, 2020
900c8d1
- Undo dotall transformation (only works on literals)
brettz9 Mar 31, 2020
1f093f3
Drop testing for pre-6 Node
brettz9 Apr 4, 2020
3700c83
- Travis: Remove dead code
brettz9 Apr 8, 2020
132ce56
share script in .travis.yml
michaelficarra Apr 8, 2020
0b8640b
remove trailing whitespace
michaelficarra Apr 8, 2020
8c1ec34
Use simpler Node version detection
brettz9 Apr 8, 2020
d8b0377
- Remove unneeded code
brettz9 Apr 8, 2020
60c33c8
- Simplify `npm install` for default Node 10+
brettz9 Apr 8, 2020
a038165
Try dropping `npm install` to rely on default
brettz9 Apr 8, 2020
e6bb4e6
Update .travis.yml
michaelficarra Apr 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": [
["@babel/preset-env"]
],
"plugins": [
["transform-es2017-object-entries"]
]
}
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ indent_size = 2

[*.pegjs]
indent_size = 2

[*.yml]
indent_size = 2
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ script:
- npm run build
- npm run test:ci
node_js:
- 8
- 10
- 12

Expand All @@ -13,3 +12,10 @@ matrix:
- name: Lint
node_js: 12
script: npm run lint
- name: node 8 (old deps)
node_js: 8
before_script: npm install --no-save "eslint@5"
- name: node 6 (old deps; skip build)
node_js: 6
before_script: npm install --no-save "eslint@5" mocha@6.2.2 nyc@14.1.1
script: npm run test:ci
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"build:parser": "rm parser.js && pegjs --cache --format umd -o \"parser.js\" \"grammar.pegjs\"",
"build:browser": "rollup -c",
"build": "npm run build:parser && npm run build:browser",
"mocha": "mocha --require chai/register-assert --require esm tests",
"mocha": "mocha --require chai/register-assert --require @babel/register tests",
"test": "nyc npm run mocha && npm run lint",
"test:ci": "npm run mocha",
"lint": "eslint ."
Expand All @@ -51,22 +51,26 @@
"query"
],
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"@babel/register": "^7.9.0",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-json": "^4.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"babel-plugin-transform-es2017-object-entries": "0.0.5",
"chai": "^4.2.0",
"eslint": "^6.8.0",
"esm": "^3.2.25",
"esprima": "~4.0.1",
"mocha": "^7.1.1",
"nyc": "^15.0.0",
"pegjs": "~0.10.0",
"rollup": "^1.32.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-terser": "^5.2.0"
},
"license": "BSD-3-Clause",
"engines": {
"node": ">=8.0"
"node": ">=0.10"
},
"dependencies": {
"estraverse": "^5.0.0"
Expand Down
5 changes: 4 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import nodeResolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';

import babel from 'rollup-plugin-babel';

/**
* @external RollupConfig
* @type {PlainObject}
Expand All @@ -30,7 +32,8 @@ function getRollupObject ({ minifying, format = 'umd' } = {}) {
plugins: [
json(),
nodeResolve(),
commonjs()
commonjs(),
babel()
]
};
if (minifying) {
Expand Down
14 changes: 8 additions & 6 deletions tests/queryAttribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,14 @@ describe('Attribute query', function () {
]);
});

it('regexp flag (s)', function () {
const matches = esquery(literal, '[value=/\f.\r/s]');
assert.includeMembers(matches, [
literal.body[0].declarations[0].init
]);
});
if (parseInt(process.version) >= 8) {
it('regexp flag (s)', function () {
const matches = esquery(literal, '[value=/\f.\r/s]');
assert.includeMembers(matches, [
literal.body[0].declarations[0].init
]);
});
}

it('regexp flag (m)', function () {
const matches = esquery(literal, '[value=/^\r/m]');
Expand Down