Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbf44193

Browse files
committed
feat: switch to ESM source and distributions
BREAKING CHANGE:Adds `exports`Also:1. updates benchmark2. fixes escodegen with missing options3. Bumps travis versions4. bumps devDep.
1 parent5f23e07 commitbf44193

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2360
-4347
lines changed

‎.editorconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ indent_style = space
1212
indent_size =4
1313

1414
[*.json]
15-
indent_size =2
15+
indent_size =4
1616

1717
[*.yml]
1818
indent_size =2

‎.eslintignore‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ coverage
66

77
test/*/*.js
88

9-
escodegen.browser.min.js
10-
escodegen.browser.js
9+
dist

‎.eslintrc.js‎renamed to ‎.eslintrc.cjs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ module.exports = {
77
SharedArrayBuffer:'readonly'
88
},
99
env:{
10-
node:true,
1110
es6:true
1211
},
1312
parserOptions:{
1413
sourceType:'module',
15-
ecmaVersion:2018
14+
ecmaVersion:2020
1615
},
1716
overrides:[{
17+
files:['*-node.js','.eslintrc.cjs','benchmark/**','bin/**','tools/**'],
18+
env:{
19+
node:true
20+
}
21+
},{
1822
files:'.eslintrc.js',
1923
parserOptions:{
2024
sourceType:'script'

‎.gitignore‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ node_modules/
88
# Cover
99
.coverage_data/
1010
cover_html/
11+
coverage
12+
13+
.idea
1114

1215
npm-debug.log
1316

14-
escodegen.browser.min.js
15-
escodegen.browser.js
17+
dist

‎.travis.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ script:
44
-npm run build
55
-npm test
66
node_js:
7-
-10
87
-12
98
-14
9+
-16
10+
-17

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ for a demo.
1616
Escodegen can be used in a web browser:
1717

1818
```html
19-
<scriptsrc="escodegen.browser.js"></script>
19+
<scriptsrc="dist/escodegen.umd.js"></script>
2020
```
2121

22-
escodegen.browser.js can be found in tagged revisions on GitHub.
22+
`dist/escodegen.umd.js` can be found in tagged revisions on GitHub.
2323

2424
Or in a Node.js application via npm:
2525

@@ -54,7 +54,7 @@ After that,
5454
npm run-script build
5555
```
5656

57-
will generate`escodegen.browser.js`, which can be used in browser environments.
57+
will generate`dist/escodegen.umd.js`, which can be used in browser environments.
5858

5959
And,
6060

‎benchmark/asts.js‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
varfs=require('fs'),
2-
path=require('path'),
3-
esprima=require('esprima');
1+
importfsfrom'fs';
2+
importpathfrom'path';
3+
import{dirname}from'path';
4+
import{fileURLToPath}from'url';
45

5-
varFILES_PATH=path.join(__dirname,'./asts');
6+
// import esprima from 'esprima';
7+
8+
const__dirname=dirname(fileURLToPath(import.meta.url));
9+
constFILES_PATH=path.join(__dirname,'./asts');
610

711
varFILES=[
812
'jQuery 1.7.1',
@@ -22,8 +26,8 @@ function slug(name) {
2226
returnname.toLowerCase().replace(/\s/g,'-');
2327
}
2428

25-
module.exports=FILES.map(function(file){
26-
varastJson=fs.readFileSync(FILES_PATH+'/'+slug(file)+'-ast.json');
29+
exportdefaultFILES.map(function(file){
30+
constastJson=fs.readFileSync(`${FILES_PATH}/${slug(file)}-ast.json`);
2731

2832
returnJSON.parse(astJson);
2933
});

‎benchmark/index.js‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
varBenchmark=require('benchmark'),
2-
escodegen=require('../'),
3-
old=require('./old.js'),
4-
esotope=require('esotope'),
5-
asts=require('./asts');
6-
1+
importBenchmarkfrom'benchmark';
2+
importesotopefrom'esotope';
3+
import*asescodegenfrom'../src/escodegen-node.js';
4+
importoldfrom'./old.cjs';
5+
importastsfrom'./asts.js';
76

87
functioncycle(codegen){
98
for(vari=0;i<asts.length;i++)
@@ -32,7 +31,7 @@ new Benchmark.Suite()
3231
})
3332

3433
.on('complete',function(){
35-
console.log('Fastest is'+this.filter('fastest').pluck('name'));
34+
console.log(`Fastest is${this.filter('fastest').map('name')}`);
3635

3736
console.log('esotope is x'+(this[0].hz/this[1].hz).toFixed(2)+' times faster vs escodegen.');
3837
})
File renamed without changes.

‎benchmark/package-lock.json‎

Lines changed: 126 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp