ARROW-12309: [JS] Make es2015 bundles the default
Closes #9961 from domoritz/es2015
Authored-by: Dominik Moritz <domoritz@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
diff --git a/js/README.md b/js/README.md
index 4eebd00..e799362 100644
--- a/js/README.md
+++ b/js/README.md
@@ -224,7 +224,7 @@
The targets are also published under the `@apache-arrow` namespace:
```sh
-npm install apache-arrow # <-- combined es5/UMD, esnext/CommonJS/ESModules/UMD, and TypeScript package
+npm install apache-arrow # <-- combined es2015/UMD + esnext/CommonJS/ESModules/UMD
npm install @apache-arrow/ts # standalone TypeScript package
npm install @apache-arrow/es5-cjs # standalone es5/CommonJS package
npm install @apache-arrow/es5-esm # standalone es5/ESModules package
diff --git a/js/bin/integration.js b/js/bin/integration.js
index c6f6cd7..2e5f16b 100755
--- a/js/bin/integration.js
+++ b/js/bin/integration.js
@@ -30,7 +30,7 @@
Table,
RecordBatchReader,
util: { createElementComparator }
-} = require('../targets/apache-arrow/Arrow.es5.min');
+} = require('../targets/apache-arrow/');
const exists = async (p) => {
try {
diff --git a/js/examples/read_file.html b/js/examples/read_file.html
index ec96d0e..1013fbe 100644
--- a/js/examples/read_file.html
+++ b/js/examples/read_file.html
@@ -86,6 +86,6 @@
<tbody id="tbody">
</tbody>
</table>
- <script type="text/javascript" src="../targets/es5/umd/Arrow.js"></script>
+ <script type="text/javascript" src="../targets/es2015/umd/Arrow.js"></script>
</body>
</html>
diff --git a/js/gulp/argv.js b/js/gulp/argv.js
index 3a028f8..0acdad7 100644
--- a/js/gulp/argv.js
+++ b/js/gulp/argv.js
@@ -15,10 +15,6 @@
// specific language governing permissions and limitations
// under the License.
-const fs = require('fs');
-const glob = require('glob');
-const path = require('path');
-
const argv = require(`command-line-args`)([
{ name: `all`, type: Boolean },
{ name: 'verbose', alias: `v`, type: Boolean },
diff --git a/js/gulp/arrow-task.js b/js/gulp/arrow-task.js
index 35880e0..93e9475 100644
--- a/js/gulp/arrow-task.js
+++ b/js/gulp/arrow-task.js
@@ -32,21 +32,21 @@
const dtsGlob = `${targetDir(`esnext`, `cjs`)}/**/*.ts`;
const cjsGlob = `${targetDir(`esnext`, `cjs`)}/**/*.js`;
const esmGlob = `${targetDir(`esnext`, `esm`)}/**/*.js`;
- const es5UmdGlob = `${targetDir(`es5`, `umd`)}/*.js`;
+ const es2015UmdGlob = `${targetDir(`es2015`, `umd`)}/*.js`;
const esnextUmdGlob = `${targetDir(`esnext`, `umd`)}/*.js`;
const cjsSourceMapsGlob = `${targetDir(`esnext`, `cjs`)}/**/*.map`;
const esmSourceMapsGlob = `${targetDir(`esnext`, `esm`)}/**/*.map`;
- const es5UmdSourceMapsGlob = `${targetDir(`es5`, `umd`)}/*.map`;
+ const es2015UmdSourceMapsGlob = `${targetDir(`es2015`, `umd`)}/*.map`;
const esnextUmdSourceMapsGlob = `${targetDir(`esnext`, `umd`)}/*.map`;
return Observable.forkJoin(
observableFromStreams(gulp.src(dtsGlob), gulp.dest(out)), // copy d.ts files
observableFromStreams(gulp.src(cjsGlob), gulp.dest(out)), // copy esnext cjs files
observableFromStreams(gulp.src(cjsSourceMapsGlob), gulp.dest(out)), // copy esnext cjs sourcemaps
observableFromStreams(gulp.src(esmSourceMapsGlob), gulp.dest(out)), // copy esnext esm sourcemaps
- observableFromStreams(gulp.src(es5UmdSourceMapsGlob), gulp.dest(out)), // copy es5 umd sourcemap files, but don't rename
+ observableFromStreams(gulp.src(es2015UmdSourceMapsGlob), gulp.dest(out)), // copy es2015 umd sourcemap files, but don't rename
observableFromStreams(gulp.src(esnextUmdSourceMapsGlob), gulp.dest(out)), // copy esnext umd sourcemap files, but don't rename
observableFromStreams(gulp.src(esmGlob), gulpRename((p) => { p.extname = '.mjs'; }), gulp.dest(out)), // copy esnext esm files and rename to `.mjs`
- observableFromStreams(gulp.src(es5UmdGlob), gulpRename((p) => { p.basename += `.es5.min`; }), gulp.dest(out)), // copy es5 umd files and add `.min`
+ observableFromStreams(gulp.src(es2015UmdGlob), gulpRename((p) => { p.basename += `.es2015.min`; }), gulp.dest(out)), // copy es2015 umd files and add `.min`
observableFromStreams(gulp.src(esnextUmdGlob), gulpRename((p) => { p.basename += `.esnext.min`; }), gulp.dest(out)), // copy esnext umd files and add `.esnext.min`
).publish(new ReplaySubject()).refCount();
}))({});
diff --git a/js/gulp/package-task.js b/js/gulp/package-task.js
index 440a90e..cb1d97c 100644
--- a/js/gulp/package-task.js
+++ b/js/gulp/package-task.js
@@ -50,12 +50,12 @@
browser: `${mainExport}.dom`,
module: `${mainExport}.dom.mjs`,
types: `${mainExport}.node.d.ts`,
- unpkg: `${mainExport}.es5.min.js`,
- jsdelivr: `${mainExport}.es5.min.js`,
+ unpkg: `${mainExport}.es2015.min.js`,
+ jsdelivr: `${mainExport}.es2015.min.js`,
sideEffects: false,
esm: { mode: `all`, sourceMap: true },
});
-
+
const createTypeScriptPackageJson = (target, format) => (orig) => ({
...createScopedPackageJSON(target, format)(orig),
bin: undefined,
@@ -69,7 +69,7 @@
...orig.dependencies
}
});
-
+
const createScopedPackageJSON = (target, format) => (({ name, ...orig }) =>
packageJSONFields.reduce(
(xs, key) => ({ ...xs, [key]: xs[key] || orig[key] }),
diff --git a/js/gulp/test-task.js b/js/gulp/test-task.js
index 149a589..8c1eab1 100644
--- a/js/gulp/test-task.js
+++ b/js/gulp/test-task.js
@@ -146,7 +146,7 @@
{ maxBuffer: Math.pow(2, 53) - 1 }
);
}
-
+
async function generateCPPStream(filePath, streamPath) {
await del(streamPath);
return await exec(
@@ -154,7 +154,7 @@
{ maxBuffer: Math.pow(2, 53) - 1 }
);
}
-
+
async function generateJavaFile(jsonPath, filePath) {
await del(filePath);
return await exec(
@@ -164,7 +164,7 @@
{ maxBuffer: Math.pow(2, 53) - 1 }
);
}
-
+
async function generateJavaStream(filePath, streamPath) {
await del(streamPath);
return await exec(
diff --git a/js/gulp/util.js b/js/gulp/util.js
index fd7a377..c07f5f3 100644
--- a/js/gulp/util.js
+++ b/js/gulp/util.js
@@ -67,8 +67,8 @@
const UMDSourceTargets = {
es5: `es5`,
es2015: `es2015`,
- es2016: `es2015`,
- es2017: `es2015`,
+ es2016: `es2016`,
+ es2017: `es2017`,
esnext: `esnext`
};
diff --git a/js/gulpfile.js b/js/gulpfile.js
index cf840ad..271bd34 100644
--- a/js/gulpfile.js
+++ b/js/gulpfile.js
@@ -56,13 +56,13 @@
));
});
-// The main "apache-arrow" module builds the es5/umd, esnext/cjs,
+// The main "apache-arrow" module builds the es2015/umd, esnext/cjs,
// esnext/esm, and esnext/umd targets, then copies and renames the
// compiled output into the apache-arrow folder
gulp.task(`build:${npmPkgName}`,
gulp.series(
gulp.parallel(
- `build:${taskName(`es5`, `umd`)}`,
+ `build:${taskName(`es2015`, `umd`)}`,
`build:${taskName(`esnext`, `cjs`)}`,
`build:${taskName(`esnext`, `esm`)}`,
`build:${taskName(`esnext`, `umd`)}`