[ https://issues.apache.org/jira/browse/ARROW-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16323220#comment-16323220 ]
ASF GitHub Bot commented on ARROW-1979: --------------------------------------- wesm closed pull request #1471: ARROW-1979: [JS] Fix JS builds hanging in es2015 URL: https://github.com/apache/arrow/pull/1471 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/js/README.md b/js/README.md index e58d335cd..b427923e3 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 cc33ee144..d1e8046e6 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 fc9596435..2976d0ad4 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 f21aaf236..ab280b092 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 3903d1eed..d68e7a627 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 68ba4dfd9..000000000 --- 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 fe4767809..830d6082b 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 6ec3a8eef..42db78706 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 87641e52b..f2c4e930f 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 c8778ba2b..c612d62ad 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; ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > [JS] JS builds handing in es2015:umd tests > ------------------------------------------ > > Key: ARROW-1979 > URL: https://issues.apache.org/jira/browse/ARROW-1979 > Project: Apache Arrow > Issue Type: Bug > Components: JavaScript > Reporter: Wes McKinney > Labels: pull-request-available > Fix For: 0.9.0 > > > see https://travis-ci.org/apache/arrow/jobs/326537559#L1288 -- This message was sent by Atlassian JIRA (v6.4.14#64029)