Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 41 additions & 39 deletions js/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function runTaskCombos(name) {
}

function cleanTask(target, format, taskName, outDir) {
return () => {
return function cleanTask() {
const globs = [`${outDir}/**`];
if (target === `es5` && format === `cjs`) {
globs.push(`typings`);
Expand All @@ -102,25 +102,27 @@ function buildTask(target, format, taskName, outDir) {
function bundleTask(target, format, taskName, outDir) {
return [
[`build:${taskName}`],
(cb) => streamMerge([
pump(gulp.src([`LICENSE`, `README.md`, `CHANGELOG.md`]), gulp.dest(outDir)),
pump(
gulp.src(`package.json`),
gulpJsonTransform((orig) => [
`version`, `description`,
`author`, `homepage`, `bugs`, `license`,
`keywords`, `repository`, `peerDependencies`
].reduce((copy, key) => (
(copy[key] = orig[key]) && copy || copy
), {
main: `Arrow.js`,
typings: `Arrow.d.ts`,
name: `@apache-arrow/${target}-${format}`
}), 2),
gulp.dest(outDir),
onError
)
])
function bundleTask() {
return streamMerge([
pump(gulp.src([`LICENSE`, `README.md`]), gulp.dest(outDir), onError),
pump(
gulp.src(`package.json`),
gulpJsonTransform((orig) => [
`version`, `description`,
`author`, `homepage`, `bugs`, `license`,
`keywords`, `repository`, `peerDependencies`
].reduce((copy, key) => (
(copy[key] = orig[key]) && copy || copy
), {
main: `Arrow.js`,
typings: `Arrow.d.ts`,
name: `@apache-arrow/${target}-${format}`
}), 2),
gulp.dest(outDir),
onError
)
])
}
];
}

Expand All @@ -138,9 +140,11 @@ function testTask(target, format, taskName, outDir, debug) {
TEST_TARGET: target, TEST_MODULE: format
})
};
return () => !debug ?
child_process.spawn(jestPath, jestOptions, spawnOptions) :
child_process.exec(`node --inspect-brk ${jestPath} ${debugOpts}`, spawnOptions);
return function testTask() {
return !debug ?
child_process.spawn(jestPath, jestOptions, spawnOptions) :
child_process.exec(`node --inspect-brk ${jestPath} ${debugOpts}`, spawnOptions);
}
}

function closureTask(target, format, taskName, outDir) {
Expand All @@ -149,38 +153,36 @@ function closureTask(target, format, taskName, outDir) {
const languageIn = clsTarget === `es5` ? `es2015` : clsTarget;
return [
[`clean:${taskName}`, `build:${clsTarget}:cls`],
() => {
return streamMerge([
closureStream(closureSrcs(false), `Arrow`, onError, true),
closureStream(closureSrcs(true), `Arrow.internal`, onError)
])
.on('end', () => del([`targets/${target}/cls/**`]));
function closureTask() {
return closureStream(
closureSrcs(),
closureCompiler(closureArgs())
).on('end', () => del([`targets/${target}/cls/**`]));
}
];
function closureSrcs(isInternal) {
function closureSrcs() {
return gulp.src([
`closure-compiler-scripts/*.js`,
`${googleRoot}/**/*.js`,
`!${googleRoot}/format/*.js`,
`!${googleRoot}/Arrow.externs.js`,
`!${googleRoot}/Arrow${isInternal ? `` : `.internal`}.js`
], { base: `./` });
}
function closureStream(sources, entry, onError, copyToDist) {
function closureStream(sources, compiler) {
const streams = [
sources,
sourcemaps.init(),
closureCompiler(closureArgs(entry)),
compiler,
sourcemaps.write('.'),
gulp.dest(outDir)
];
// copy the UMD bundle to dist
if (target === `es5` && copyToDist) {
// copy the ES5 UMD bundle to dist
if (target === `es5`) {
streams.push(gulp.dest(`dist`));
}
return pump(...streams, onError);
}
function closureArgs(entry) {
function closureArgs() {
return {
third_party: true,
externs: `${googleRoot}/Arrow.externs.js`,
Expand All @@ -190,10 +192,10 @@ function closureTask(target, format, taskName, outDir) {
// formatting: `PRETTY_PRINT`,
compilation_level: `ADVANCED`,
assume_function_wrapper: true,
js_output_file: `${entry}.js`,
js_output_file: `Arrow.js`,
language_in: gCCTargets[languageIn],
language_out: gCCTargets[clsTarget],
entry_point: `${googleRoot}/${entry}.js`,
entry_point: `${googleRoot}/Arrow.js`,
output_wrapper:
`// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -223,7 +225,7 @@ function closureTask(target, format, taskName, outDir) {
function typescriptTask(target, format, taskName, outDir) {
return [
[`clean:${taskName}`],
() => {
function typescriptTask() {
const tsconfigPath = `tsconfig/tsconfig.${target}.${format}.json`;
let { js, dts } = tsProjects.find((p) => p.target === target && p.format === format) || {};
if (!js || !dts) {
Expand Down
21 changes: 11 additions & 10 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,28 @@
"del": "~3.0.0",
"esdoc": "~1.0.1",
"esdoc-standard-plugin": "~1.0.0",
"google-closure-compiler": "~20170806.0.0",
"google-closure-compiler": "~20170910.0.0",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-json-transform": "~0.4.2",
"gulp-sourcemaps": "~2.6.1",
"gulp-typescript": "~3.2.2",
"jest": "~20.0.4",
"jest": "~21.1.0",
"jest-environment-node-debug": "~2.0.0",
"json": "~9.0.6",
"lerna": "2.0.0",
"lint-staged": "~4.0.1",
"merge2": "~1.1.0",
"lerna": "~2.1.2",
"lint-staged": "~4.2.1",
"merge2": "~1.2.0",
"mkdirp": "~0.5.1",
"npm-run-all": "~4.0.2",
"npm-run-all": "~4.1.1",
"pump": "~1.0.2",
"rimraf": "~2.6.1",
"shx": "~0.2.2",
"text-encoding-utf-8": "~1.0.1",
"trash": "~4.0.1",
"ts-jest": "~20.0.10",
"ts-jest": "~21.0.1",
"tslib": "~1.7.1",
"tslint": "~5.6.0",
"typescript": "~2.4.2",
"tslint": "~5.7.0",
"typescript": "~2.5.2",
"validate-commit-msg": "~2.14.0"
},
"config": {
Expand Down Expand Up @@ -129,7 +129,8 @@
],
"coveragePathIgnorePatterns": [
"format\\/(File|Message|Schema|Tensor)_generated\\.(js|ts)$",
"test\\/.*\\.(ts|tsx|js)$"
"test\\/.*\\.(ts|tsx|js)$",
"/node_modules/"
],
"transform": {
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js",
Expand Down
8 changes: 8 additions & 0 deletions js/src/Arrow.externs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Symbol.iterator;
Symbol.asyncIterator;
let Table = function() {};
/** @type {?} */
Table.prototype.length;
/** @type {?} */
Table.prototype.rows;
/** @type {?} */
Table.prototype.cols;
Expand Down Expand Up @@ -65,3 +67,9 @@ TypedVector.prototype.arrayType;
let ValidityVector = function() {};
/** @type {?} */
(<any> ValidityVector).pack;

let DictionaryVector = function() {};
/** @type {?} */
DictionaryVector.prototype.index;
/** @type {?} */
DictionaryVector.prototype.value;
105 changes: 0 additions & 105 deletions js/src/Arrow.internal.ts

This file was deleted.

60 changes: 58 additions & 2 deletions js/src/Arrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,43 @@

import { Table } from './table';
import { readBuffers } from './reader/arrow';
export { Table, readBuffers };
import { Vector } from './vector/vector';
import { StructVector } from './vector/struct';
import { DictionaryVector } from './vector/dictionary';
import { ListVector, Utf8Vector, FixedSizeListVector } from './vector/list';
import {
TypedVector, BitVector,
DateVector, IndexVector,
Int8Vector, Int16Vector,
Int32Vector, Int64Vector,
Uint8Vector, Uint16Vector,
Uint32Vector, Uint64Vector,
Float32Vector, Float64Vector,
} from './vector/typed';

export {
Table, readBuffers,
Vector,
BitVector,
ListVector,
Utf8Vector,
DateVector,
IndexVector,
TypedVector,
Int8Vector,
Int16Vector,
Int32Vector,
Int64Vector,
Uint8Vector,
Uint16Vector,
Uint32Vector,
Uint64Vector,
Float32Vector,
Float64Vector,
StructVector,
DictionaryVector,
FixedSizeListVector,
};

/* These exports are needed for the closure umd targets */
try {
Expand All @@ -26,6 +62,26 @@ try {
// string indexers tell closure compiler not to rename these properties
Arrow['Table'] = Table;
Arrow['readBuffers'] = readBuffers;
Arrow['Vector'] = Vector;
Arrow['BitVector'] = BitVector;
Arrow['ListVector'] = ListVector;
Arrow['Utf8Vector'] = Utf8Vector;
Arrow['DateVector'] = DateVector;
Arrow['IndexVector'] = IndexVector;
Arrow['TypedVector'] = TypedVector;
Arrow['Int8Vector'] = Int8Vector;
Arrow['Int16Vector'] = Int16Vector;
Arrow['Int32Vector'] = Int32Vector;
Arrow['Int64Vector'] = Int64Vector;
Arrow['Uint8Vector'] = Uint8Vector;
Arrow['Uint16Vector'] = Uint16Vector;
Arrow['Uint32Vector'] = Uint32Vector;
Arrow['Uint64Vector'] = Uint64Vector;
Arrow['Float32Vector'] = Float32Vector;
Arrow['Float64Vector'] = Float64Vector;
Arrow['StructVector'] = StructVector;
Arrow['DictionaryVector'] = DictionaryVector;
Arrow['FixedSizeListVector'] = FixedSizeListVector;
}
} catch (e) { /* not the UMD bundle */ }
/** end closure exports */
/* end closure exports */
Loading