Skip to content

Commit

Permalink
ARROW-2584: [JS] Fixes for node v10
Browse files Browse the repository at this point in the history
Fixes for node v10 found by @trxcllnt

Author: ptaylor <paul.e.taylor@me.com>
Author: Brian Hulette <brian.hulette@ccri.com>

Closes #2049 from TheNeuralBit/fix-node-v10 and squashes the following commits:

1eec12a <Brian Hulette> Bump CI node version to 10.1
60f4c64 <ptaylor> fix instanceof ArrayBuffer in jest/node 10
ba0416f <ptaylor> fix @std/esm options for node10
  • Loading branch information
trxcllnt authored and Your Name Here committed May 15, 2018
1 parent 48eee79 commit 71d487a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -136,7 +136,7 @@ matrix:
- if [ $ARROW_CI_INTEGRATION_AFFECTED != "1" ]; then exit; fi
- $TRAVIS_BUILD_DIR/ci/travis_install_linux.sh
- $TRAVIS_BUILD_DIR/ci/travis_install_clang_tools.sh
- nvm install 9.8
- nvm install 10.1
- $TRAVIS_BUILD_DIR/ci/travis_before_script_js.sh
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
script:
Expand All @@ -145,7 +145,7 @@ matrix:
- language: node_js
os: linux
node_js:
- '9.8'
- '10.1'
before_script:
- if [ $ARROW_CI_JS_AFFECTED != "1" ]; then exit; fi
- $TRAVIS_BUILD_DIR/ci/travis_install_linux.sh
Expand Down
19 changes: 18 additions & 1 deletion js/gulp/uglify-task.js
Expand Up @@ -30,7 +30,24 @@ const { memoizeTask } = require('./memoize-task');
const { compileBinFiles } = require('./typescript-task');
const { Observable, ReplaySubject } = require('rxjs');
const UglifyJSPlugin = require(`uglifyjs-webpack-plugin`);
const esmRequire = require(`@std/esm`)(module, { cjs: true, esm: `js`, warnings: false });
const esmRequire = require(`@std/esm`)(module, {
mode: `js`,
warnings: false,
cjs: {
/* A boolean for storing ES modules in require.cache. */
cache: true,
/* A boolean for respecting require.extensions in ESM. */
extensions: true,
/* A boolean for __esModule interoperability. */
interop: true,
/* A boolean for importing named exports of CJS modules. */
namedExports: true,
/* A boolean for following CJS path rules in ESM. */
paths: true,
/* A boolean for __dirname, __filename, and require in ESM. */
vars: true,
}
});

const uglifyTask = ((cache, commonConfig) => memoizeTask(cache, function uglifyJS(target, format) {

Expand Down
4 changes: 2 additions & 2 deletions js/package.json
Expand Up @@ -59,11 +59,11 @@
"command-line-usage": "4.1.0",
"flatbuffers": "trxcllnt/flatbuffers-esm",
"json-bignum": "0.0.3",
"text-encoding-utf-8": "^1.0.2",
"text-encoding-utf-8": "1.0.2",
"tslib": "1.9.0"
},
"devDependencies": {
"@std/esm": "0.19.7",
"@std/esm": "0.26.0",
"@types/glob": "5.0.35",
"@types/jest": "22.1.0",
"ast-types": "0.10.1",
Expand Down
9 changes: 9 additions & 0 deletions js/test/Arrow.ts
Expand Up @@ -18,6 +18,15 @@
/* tslint:disable */
// Dynamically load an Arrow target build based on command line arguments

// Fix for Jest in node v10.x
Object.defineProperty(ArrayBuffer, Symbol.hasInstance, {
writable: true,
configurable: true,
value(inst: any) {
return inst && inst.constructor && inst.constructor.name === 'ArrayBuffer';
}
});

const path = require('path');
const target = process.env.TEST_TARGET!;
const format = process.env.TEST_MODULE!;
Expand Down

0 comments on commit 71d487a

Please sign in to comment.