You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2018/01/11 23:35:13 UTC

[arrow] branch master updated: ARROW-1979: [JS] Fix JS builds hanging in es2015

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 99e58da  ARROW-1979: [JS] Fix JS builds hanging in es2015
99e58da is described below

commit 99e58da5d58b8587657413b4bcca14a773d6de36
Author: Paul Taylor <pa...@me.com>
AuthorDate: Thu Jan 11 18:35:05 2018 -0500

    ARROW-1979: [JS] Fix JS builds hanging in es2015
    
    Also fixes [ARROW-1903](https://issues.apache.org/jira/browse/ARROW-1903)
    
    Author: Paul Taylor <pa...@me.com>
    
    Closes #1471 from trxcllnt/fix-js-es2015-builds and squashes the following commits:
    
    62db3381 [Paul Taylor] update dependencies and add es6+ umd targets to jest transform ignore patterns to fix ci
    6ff18e94 [Paul Taylor] ship es2015 commonJS in main package to avoid confusion
    74e828af [Paul Taylor] fix typings issues (ARROW-1903)
---
 js/README.md                          |  2 +-
 js/gulp/arrow-task.js                 |  8 ++++----
 js/gulp/package-task.js               |  6 +++---
 js/gulp/test-task.js                  |  2 +-
 js/package.json                       | 38 +++++++++++++++++------------------
 js/src/text-encoding-utf-8.d.ts       |  4 ----
 js/src/vector/numeric.ts              |  7 ++++---
 js/src/vector/virtual.ts              |  2 +-
 js/test/Arrow.ts                      |  2 +-
 js/test/integration/validate-tests.ts |  2 +-
 10 files changed, 35 insertions(+), 38 deletions(-)

diff --git a/js/README.md b/js/README.md
index e58d335..b427923 100644
--- a/js/README.md
+++ b/js/README.md
@@ -178,7 +178,7 @@ The base `apache-arrow` package includes all the compilation targets for conveni
 The targets are also published under the `@apache-arrow` namespace:
 
 ```sh
-npm install apache-arrow # <-- combined es5/CommonJS + UMD, es2015/ESModules + UMD, and TypeScript package
+npm install apache-arrow # <-- combined es5/UMD, es2015/CommonJS/ESModules/UMD, and TypeScript package
 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/gulp/arrow-task.js b/js/gulp/arrow-task.js
index cc33ee1..d1e8046 100644
--- a/js/gulp/arrow-task.js
+++ b/js/gulp/arrow-task.js
@@ -28,8 +28,8 @@ const { Observable, ReplaySubject } = require('rxjs');
 
 const arrowTask = ((cache) => memoizeTask(cache, function copyMain(target, format) {
     const out = targetDir(target);
-    const srcGlob = `src/**/*.ts`;
-    const es5Glob = `${targetDir(`es5`, `cjs`)}/**/*.js`;
+    const dtsGlob = `${targetDir(`es2015`, `cjs`)}/**/*.ts`;
+    const cjsGlob = `${targetDir(`es2015`, `cjs`)}/**/*.js`;
     const esmGlob = `${targetDir(`es2015`, `esm`)}/**/*.js`;
     const es5UmdGlob = `${targetDir(`es5`, `umd`)}/**/*.js`;
     const es5UmdMaps = `${targetDir(`es5`, `umd`)}/**/*.map`;
@@ -38,8 +38,8 @@ const arrowTask = ((cache) => memoizeTask(cache, function copyMain(target, forma
     const ch_ext = (ext) => gulpRename((p) => { p.extname = ext; });
     const append = (ap) => gulpRename((p) => { p.basename += ap; });
     return Observable.forkJoin(
-      observableFromStreams(gulp.src(srcGlob), gulp.dest(out)), // copy src ts files
-      observableFromStreams(gulp.src(es5Glob), gulp.dest(out)), // copy es5 cjs files
+      observableFromStreams(gulp.src(dtsGlob), gulp.dest(out)), // copy d.ts files
+      observableFromStreams(gulp.src(cjsGlob), gulp.dest(out)), // copy es2015 cjs files
       observableFromStreams(gulp.src(esmGlob), ch_ext(`.mjs`), gulp.dest(out)), // copy es2015 esm files and rename to `.mjs`
       observableFromStreams(gulp.src(es5UmdGlob), append(`.es5.min`), gulp.dest(out)), // copy es5 umd files and add `.min`
       observableFromStreams(gulp.src(es5UmdMaps),                     gulp.dest(out)), // copy es5 umd sourcemap files, but don't rename
diff --git a/js/gulp/package-task.js b/js/gulp/package-task.js
index fc95964..2976d0a 100644
--- a/js/gulp/package-task.js
+++ b/js/gulp/package-task.js
@@ -46,8 +46,8 @@ const createMainPackageJson = (target, format) => (orig) => ({
     name: npmPkgName,
     main: mainExport,
     module: `${mainExport}.mjs`,
-    browser: `${mainExport}.es5.min.js`,
-    [`browser:es2015`]: `${mainExport}.es2015.min.js`,
+    dist: `${mainExport}.es5.min.js`,
+    [`dist:es2015`]: `${mainExport}.es2015.min.js`,
     [`@std/esm`]: { esm: `mjs` }
 });
   
@@ -67,7 +67,7 @@ const createScopedPackageJSON = (target, format) => (({ name, ...orig }) =>
         (xs, key) => ({ ...xs, [key]: xs[key] || orig[key] }),
         { name: `${npmOrgName}/${packageName(target, format)}`,
           version: undefined, main: `${mainExport}.js`, types: `${mainExport}.d.ts`,
-          browser: undefined, [`browser:es2015`]: undefined, module: undefined, [`@std/esm`]: undefined }
+          dist: undefined, [`dist:es2015`]: undefined, module: undefined, [`@std/esm`]: undefined }
       )
     )
 );
diff --git a/js/gulp/test-task.js b/js/gulp/test-task.js
index f21aaf2..ab280b0 100644
--- a/js/gulp/test-task.js
+++ b/js/gulp/test-task.js
@@ -34,7 +34,7 @@ argv.update && jestArgv.push(`-u`);
 argv.verbose && jestArgv.push(`--verbose`);
 argv.coverage && jestArgv.push(`--coverage`);
 
-const debugArgv = [`--runInBand`, `--env`, `jest-environment-node-debug`];
+const debugArgv = [`--runInBand`, `--env`, `node-debug`];
 const jest = require.resolve(path.join(`..`, `node_modules`, `.bin`, `jest`));
 const testOptions = {
     env: { ...process.env },
diff --git a/js/package.json b/js/package.json
index 3903d1e..d68e7a6 100644
--- a/js/package.json
+++ b/js/package.json
@@ -49,10 +49,8 @@
     "gulpfile.js",
     "npm-release.sh"
   ],
-  "peerDependencies": {
-    "command-line-usage": "4.0.1"
-  },
   "dependencies": {
+    "@types/text-encoding-utf-8": "1.0.1",
     "command-line-args": "4.0.7",
     "command-line-usage": "4.0.2",
     "flatbuffers": "trxcllnt/flatbuffers-esm",
@@ -61,45 +59,44 @@
     "tslib": "1.8.1"
   },
   "devDependencies": {
-    "@std/esm": "0.18.0",
+    "@std/esm": "0.19.1",
     "@types/flatbuffers": "1.6.5",
     "@types/glob": "5.0.34",
-    "@types/jest": "21.1.8",
-    "@types/node": "8.5.0",
-    "@types/text-encoding": "0.0.32",
+    "@types/jest": "22.0.1",
+    "@types/node": "9.3.0",
     "ast-types": "0.10.1",
     "benchmark": "2.1.4",
     "coveralls": "3.0.0",
     "del": "3.0.0",
-    "esdoc": "1.0.3",
+    "esdoc": "1.0.4",
     "esdoc-standard-plugin": "1.0.0",
     "glob": "7.1.2",
-    "google-closure-compiler": "20171203.0.0",
+    "google-closure-compiler": "20180101.0.0",
     "gulp": "github:gulpjs/gulp#6d71a658c61edb3090221579d8f97dbe086ba2ed",
     "gulp-json-transform": "0.4.5",
     "gulp-rename": "1.2.2",
-    "gulp-sourcemaps": "2.6.1",
+    "gulp-sourcemaps": "2.6.3",
     "gulp-transform-js-ast": "1.0.2",
     "gulp-typescript": "3.2.3",
     "ix": "2.3.4",
-    "jest": "21.2.1",
+    "jest": "22.0.5",
     "jest-environment-node-debug": "2.0.0",
     "json": "9.0.6",
-    "lerna": "2.5.1",
+    "lerna": "2.6.0",
     "lint-staged": "6.0.0",
-    "merge2": "1.2.0",
+    "merge2": "1.2.1",
     "mkdirp": "0.5.1",
     "npm-run-all": "4.1.2",
     "pump": "1.0.2",
     "rimraf": "2.6.2",
-    "rxjs": "5.5.5",
+    "rxjs": "5.5.6",
     "shx": "0.2.2",
     "source-map-loader": "0.2.3",
     "trash": "4.2.1",
-    "ts-jest": "21.2.4",
-    "tslint": "5.8.0",
+    "ts-jest": "22.0.1",
+    "tslint": "5.9.1",
     "typescript": "2.6.2",
-    "uglifyjs-webpack-plugin": "1.1.2",
+    "uglifyjs-webpack-plugin": "1.1.6",
     "webpack": "3.10.0",
     "xml2js": "0.4.19"
   },
@@ -134,9 +131,12 @@
       "/node_modules/"
     ],
     "transform": {
-      ".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js",
-      ".(js|jsx)": "<rootDir>/node_modules/babel-jest/build/index.js"
+      ".(ts|tsx)": "./node_modules/ts-jest/preprocessor.js",
+      ".(js|jsx)": "./node_modules/babel-jest/build/index.js"
     },
+    "transformIgnorePatterns": [
+      "/node_modules/", "/(es2015|esnext)\/umd/"
+    ],
     "testRegex": "(.*(-|\\.)(test|spec)s?)\\.(ts|tsx|js)$"
   }
 }
diff --git a/js/src/text-encoding-utf-8.d.ts b/js/src/text-encoding-utf-8.d.ts
deleted file mode 100644
index 68ba4df..0000000
--- a/js/src/text-encoding-utf-8.d.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-declare module 'text-encoding-utf-8' {
-    import * as TextEncoding from 'text-encoding';
-    export = TextEncoding;
-}
diff --git a/js/src/vector/numeric.ts b/js/src/vector/numeric.ts
index fe47678..830d608 100644
--- a/js/src/vector/numeric.ts
+++ b/js/src/vector/numeric.ts
@@ -34,10 +34,10 @@ export class NumericVector<T, TArray extends TypedArray> extends Vector<T> {
     concat(...vectors: Vector<T>[]): Vector<T> {
         return new VirtualVector(this.data.constructor as TypedArrayConstructor, this, ...vectors);
     }
-    slice(start?: number, end?: number) {
+    slice<R = TArray>(start?: number, end?: number): R {
         const { data, stride } = this, from = start! | 0;
         const to = end === undefined ? data.length : Math.max(end | 0, from);
-        return data.subarray(Math.min(from, to) * stride | 0, to * stride | 0);
+        return data.subarray(Math.min(from, to) * stride | 0, to * stride | 0) as any as R;
     }
 }
 
@@ -49,7 +49,8 @@ export class FixedWidthNumericVector<T, TArray extends TypedArray> extends Numer
 
 export class BoolVector extends NumericVector<boolean, Uint8Array> {
     static pack(values: Iterable<any>) {
-        let xs = [], n, i = 0;
+        let n = 0, i = 0;
+        let xs: number[] = [];
         let bit = 0, byte = 0;
         for (const value of values) {
             value && (byte |= 1 << bit);
diff --git a/js/src/vector/virtual.ts b/js/src/vector/virtual.ts
index 6ec3a8e..42db787 100644
--- a/js/src/vector/virtual.ts
+++ b/js/src/vector/virtual.ts
@@ -93,7 +93,7 @@ export class VirtualVector<T> implements Vector<T> {
                 // this is a significant improvement as we avoid the memcpy 🎉
                 if ((source.length / vector.stride | 0) < total) {
                     let vectorsLength = vectors.length;
-                    let count = 0, length = 0, sources = [];
+                    let count = 0, length = 0, sources = [] as any[];
                     do {
                         sources.push(source);
                         length += source.length;
diff --git a/js/test/Arrow.ts b/js/test/Arrow.ts
index 87641e5..f2c4e93 100644
--- a/js/test/Arrow.ts
+++ b/js/test/Arrow.ts
@@ -16,7 +16,7 @@
 // under the License.
 
 /* tslint:disable */
-// Dynamically load an Ix target build based on command line arguments
+// Dynamically load an Arrow target build based on command line arguments
 
 const path = require('path');
 const target = process.env.TEST_TARGET!;
diff --git a/js/test/integration/validate-tests.ts b/js/test/integration/validate-tests.ts
index c8778ba..c612d62 100644
--- a/js/test/integration/validate-tests.ts
+++ b/js/test/integration/validate-tests.ts
@@ -37,7 +37,7 @@ const arrowBuffers: Uint8Array[] = [fs.readFileSync(arrowPath)];
 
 import Arrow from '../Arrow';
 import { zip } from 'ix/iterable/zip';
-import { toArray } from 'ix/iterable/toArray';
+import { toArray } from 'ix/iterable/toarray';
 
 const { Table, read } = Arrow;
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@arrow.apache.org" <co...@arrow.apache.org>'].