diff --git a/js/gulp/typescript-task.js b/js/gulp/typescript-task.js index 31769e3b1b2..79b5c23d3a4 100644 --- a/js/gulp/typescript-task.js +++ b/js/gulp/typescript-task.js @@ -61,7 +61,7 @@ function compileTypescript(out, tsconfigPath, tsconfigOverrides, writeSourcemaps ); const writeSources = observableFromStreams(tsProject.src(), gulp.dest(path.join(out, 'src'))); const writeDTypes = observableFromStreams(dts, sourcemaps.write('./', { includeContent: false, sourceRoot: './src' }), gulp.dest(out)); - const mapFile = tsProject.options.module === tsc.ModuleKind.ES2015 ? esmMapFile : cjsMapFile; + const mapFile = tsProject.options.module === tsc.ModuleKind.CommonJS ? cjsMapFile : esmMapFile; const writeJSArgs = writeSourcemaps ? [ js, sourcemaps.write('./', { mapFile, includeContent: false, sourceRoot: './src' }), diff --git a/js/perf/index.ts b/js/perf/index.ts index 2869470b469..3f79bb344ab 100755 --- a/js/perf/index.ts +++ b/js/perf/index.ts @@ -32,7 +32,7 @@ import * as Arrow from '../src/Arrow.ts'; import config, { arrays, typedArrays, vectors } from './config.js'; import b from 'benny'; -import { CaseResult, Summary } from 'benny/lib/internal/common-types'; +import { CaseResult, Summary } from 'benny/lib/internal/common-types.js'; import kleur from 'kleur'; const { RecordBatchReader, RecordBatchStreamWriter } = Arrow; diff --git a/js/src/ipc/metadata/message.ts b/js/src/ipc/metadata/message.ts index 552c4d846e8..95abb60c6d2 100644 --- a/js/src/ipc/metadata/message.ts +++ b/js/src/ipc/metadata/message.ts @@ -256,7 +256,7 @@ FieldNode['decode'] = decodeFieldNode; BufferRegion['encode'] = encodeBufferRegion; BufferRegion['decode'] = decodeBufferRegion; -declare module '../../schema' { +declare module '../../schema.js' { namespace Field { export { encodeField as encode }; export { decodeField as decode }; @@ -269,7 +269,7 @@ declare module '../../schema' { } } -declare module './message' { +declare module './message.js' { namespace RecordBatch { export { encodeRecordBatch as encode }; export { decodeRecordBatch as decode }; diff --git a/js/test/inference/visitor/get.ts b/js/test/inference/visitor/get.ts index ab9727b59d3..167be4a6424 100644 --- a/js/test/inference/visitor/get.ts +++ b/js/test/inference/visitor/get.ts @@ -20,7 +20,7 @@ import { Bool, List, Dictionary } from 'apache-arrow'; -import { instance as getVisitor } from 'apache-arrow/visitor/get'; +import { instance as getVisitor } from 'apache-arrow/visitor/get.js'; const data_Bool = new Data(new Bool(), 0, 0); const data_List_Bool = new Data(new List(null as any), 0, 0); diff --git a/js/test/jest-extensions.ts b/js/test/jest-extensions.ts index cb97ae25907..65ce088da5a 100644 --- a/js/test/jest-extensions.ts +++ b/js/test/jest-extensions.ts @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -import { zip } from 'ix/iterable/zip'; +import { zip } from 'ix/iterable/zip.js'; import { Table, Vector, RecordBatch, util } from 'apache-arrow'; declare global { diff --git a/js/test/unit/builders/builder-tests.ts b/js/test/unit/builders/builder-tests.ts index 4d1be9b225b..fcf8d5f8f66 100644 --- a/js/test/unit/builders/builder-tests.ts +++ b/js/test/unit/builders/builder-tests.ts @@ -19,7 +19,7 @@ import 'web-streams-polyfill'; import '../../jest-extensions.js'; import { from, fromDOMStream, toArray } from 'ix/asynciterable'; -import { fromNodeStream } from 'ix/asynciterable/fromnodestream'; +import { fromNodeStream } from 'ix/asynciterable/fromnodestream.js'; import { validateVector } from './utils.js'; import * as generate from '../../generate-test-data.js'; @@ -239,9 +239,9 @@ function fillNADefault(values: any[], nulls: any[]): any[] { }); } -type BuilderOptions = import('apache-arrow/builder').BuilderOptions; -type BuilderDuplexOptions = import('apache-arrow/io/node/builder').BuilderDuplexOptions; -type BuilderTransformOptions = import('apache-arrow/io/whatwg/builder').BuilderTransformOptions; +type BuilderOptions = import('apache-arrow/builder.js').BuilderOptions; +type BuilderDuplexOptions = import('apache-arrow/io/node/builder.js').BuilderDuplexOptions; +type BuilderTransformOptions = import('apache-arrow/io/whatwg/builder.js').BuilderTransformOptions; function encodeSingle(values: (T['TValue'] | TNull)[], options: BuilderOptions) { const builder = makeBuilder(options); diff --git a/js/test/unit/builders/utils.ts b/js/test/unit/builders/utils.ts index fbd8eb49eee..24dcc02da97 100644 --- a/js/test/unit/builders/utils.ts +++ b/js/test/unit/builders/utils.ts @@ -18,7 +18,7 @@ import 'web-streams-polyfill'; import { from, fromDOMStream, toArray } from 'ix/asynciterable'; -import { fromNodeStream } from 'ix/asynciterable/fromnodestream'; +import { fromNodeStream } from 'ix/asynciterable/fromnodestream.js'; import 'ix/Ix.node'; import randstr from 'randomatic'; diff --git a/js/test/unit/ipc/reader/file-reader-tests.ts b/js/test/unit/ipc/reader/file-reader-tests.ts index 522eab78575..5431b39718f 100644 --- a/js/test/unit/ipc/reader/file-reader-tests.ts +++ b/js/test/unit/ipc/reader/file-reader-tests.ts @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -import { toArray } from 'ix/asynciterable/toarray'; +import { toArray } from 'ix/asynciterable/toarray.js'; import { generateRandomTables } from '../../../data/tables.js'; import { ArrowIOTestHelper } from '../helpers.js'; import { @@ -103,7 +103,7 @@ function validateRandomAccess(source: any) { async function validateRandomAccessAsync(source: any) { const reader = (await RecordBatchReader.from(source)) as AsyncRecordBatchFileReader; - const {schema} = await reader.open({ autoDestroy: false }); + const { schema } = await reader.open({ autoDestroy: false }); const batches = await toArray(reader); expect(reader.closed).toBe(false); expect(reader.schema).toBe(schema); diff --git a/js/test/unit/ipc/writer/stream-writer-tests.ts b/js/test/unit/ipc/writer/stream-writer-tests.ts index 8425395393b..1a5582dc742 100644 --- a/js/test/unit/ipc/writer/stream-writer-tests.ts +++ b/js/test/unit/ipc/writer/stream-writer-tests.ts @@ -22,7 +22,7 @@ import { import * as generate from '../../../generate-test-data.js'; import { validateRecordBatchIterator } from '../validate.js'; -import type { RecordBatchStreamWriterOptions } from 'apache-arrow/ipc/writer'; +import type { RecordBatchStreamWriterOptions } from 'apache-arrow/ipc/writer.js'; import { builderThroughIterable, Dictionary, diff --git a/js/test/unit/vector/numeric-vector-tests.ts b/js/test/unit/vector/numeric-vector-tests.ts index 032af796de1..fd533f51a50 100644 --- a/js/test/unit/vector/numeric-vector-tests.ts +++ b/js/test/unit/vector/numeric-vector-tests.ts @@ -28,7 +28,7 @@ import type { TypedArrayConstructor, BigIntArray, BigIntArrayConstructor -} from 'apache-arrow/interfaces'; +} from 'apache-arrow/interfaces.js'; const { joinUint8Arrays, float64ToUint16, uint16ToFloat64 } = util; diff --git a/js/tsconfig.json b/js/tsconfig.json index abdd1815a0d..bd99c650b8f 100644 --- a/js/tsconfig.json +++ b/js/tsconfig.json @@ -7,13 +7,13 @@ "compilerOptions": { "target": "ESNext", "module": "ESNext", + "moduleResolution": "NodeNext", "isolatedModules": true, "noEmit": true, - "esModuleInterop": true, "baseUrl": "./", "rootDir": "./", "paths": { - "apache-arrow": ["src/Arrow.node"], + "apache-arrow": ["src/Arrow.node.js"], "apache-arrow/*": ["src/*"] }, "allowImportingTsExtensions": true, diff --git a/js/tsconfig/tsconfig.base.json b/js/tsconfig/tsconfig.base.json index 0d7fefd9094..ea8d88ee709 100644 --- a/js/tsconfig/tsconfig.base.json +++ b/js/tsconfig/tsconfig.base.json @@ -10,7 +10,7 @@ }, /* Basic stuff */ - "moduleResolution": "Node", + "moduleResolution": "NodeNext", "lib": ["DOM", "ESNext", "ESNext.AsyncIterable"], "esModuleInterop": true,