Skip to content

Commit

Permalink
fix: Compatibility with ESM on Node 20
Browse files Browse the repository at this point in the history
Add file extension to relative imports as recommended in
https://www.typescriptlang.org/docs/handbook/esm-node.html
  • Loading branch information
ddeboer committed Oct 29, 2023
1 parent dce3862 commit 812fe03
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions src/crawler.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {RegistrationStore} from './registration';
import {DatasetStore, extractIris} from './dataset';
import {dereference, fetch, HttpError, NoDatasetFoundAtUrl} from './fetch';
import {RegistrationStore} from './registration.js';
import {DatasetStore, extractIris} from './dataset.js';
import {dereference, fetch, HttpError, NoDatasetFoundAtUrl} from './fetch.js';
import DatasetExt from 'rdf-ext/lib/Dataset';
import Pino from 'pino';
import {Validator} from './validator';
import {crawlCounter} from './instrumentation';
import {Validator} from './validator.js';
import {crawlCounter} from './instrumentation.js';

export class Crawler {
constructor(
Expand Down
4 changes: 2 additions & 2 deletions src/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import DatasetExt from 'rdf-ext/lib/Dataset';
import factory from 'rdf-ext';
import rdf from 'rdf-ext';
import {URL} from 'url';
import {datasetType} from './query';
import {datasetType} from './query.js';
import {Readable, Transform} from 'stream';
import {StreamParser} from 'n3';
import {JsonLdParser} from 'jsonld-streaming-parser';
import {StandardizeSchemaOrgPrefixToHttps} from './transform';
import {StandardizeSchemaOrgPrefixToHttps} from './transform.js';

export interface DatasetStore {
/**
Expand Down
6 changes: 3 additions & 3 deletions src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import factory from 'rdf-ext';
import DatasetExt from 'rdf-ext/lib/Dataset';
import {URL} from 'url';
import {Store} from 'n3';
import {bindingsToQuads, selectQuery, sparqlLimit} from './query';
import {bindingsToQuads, selectQuery, sparqlLimit} from './query.js';
import {pipeline} from 'stream';
import {StandardizeSchemaOrgPrefixToHttps} from './transform';
import {StandardizeSchemaOrgPrefixToHttps} from './transform.js';
import Pino from 'pino';
import {rdfDereferencer} from './rdf';
import {rdfDereferencer} from './rdf.js';
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
import _ from './comunica-config.json';

Expand Down
4 changes: 2 additions & 2 deletions src/graphdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
AllowedRegistrationDomainStore,
Registration,
RegistrationStore,
} from './registration';
import {DatasetStore, extractIris} from './dataset';
} from './registration.js';
import {DatasetStore, extractIris} from './dataset.js';

export type SparqlResult = {
results: {
Expand Down
2 changes: 1 addition & 1 deletion src/instrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
PeriodicExportingMetricReader,
} from '@opentelemetry/sdk-metrics';
import {OTLPMetricExporter} from '@opentelemetry/exporter-metrics-otlp-proto';
import {DatasetStore} from './dataset';
import {DatasetStore} from './dataset.js';

export function startInstrumentation(datasetStore: DatasetStore) {
datasetsCounter.addCallback(async result =>
Expand Down
10 changes: 5 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {
GraphDbClient,
GraphDbDatasetStore,
GraphDbRegistrationStore,
} from './graphdb';
import {readUrl, ShaclValidator} from './validator';
import {Crawler} from './crawler';
} from './graphdb.js';
import {readUrl, ShaclValidator} from './validator.js';
import {Crawler} from './crawler.js';
import {scheduleJob} from 'node-schedule';
import {server} from './server';
import {server} from './server.js';
import Pino from 'pino';
import {startInstrumentation} from './instrumentation';
import {startInstrumentation} from './instrumentation.js';

const client = new GraphDbClient(
process.env.GRAPHDB_URL || 'http://127.0.0.1:7200',
Expand Down
12 changes: 6 additions & 6 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ import fastify, {
FastifyRequest,
FastifyServerOptions,
} from 'fastify';
import {Validator} from './validator';
import {Validator} from './validator.js';
import datasetExt from 'rdf-dataset-ext';
import {dereference, fetch, HttpError, NoDatasetFoundAtUrl} from './fetch';
import {dereference, fetch, HttpError, NoDatasetFoundAtUrl} from './fetch.js';
import DatasetExt from 'rdf-ext/lib/Dataset';
import {URL} from 'url';
import {
AllowedRegistrationDomainStore,
Registration,
RegistrationStore,
} from './registration';
import {DatasetStore, extractIris, load} from './dataset';
} from './registration.js';
import {DatasetStore, extractIris, load} from './dataset.js';
import {IncomingMessage, Server} from 'http';
import * as psl from 'psl';
import {rdfSerializer} from './rdf';
import {rdfSerializer} from './rdf.js';
import fastifySwagger from '@fastify/swagger';
import fastifyCors from '@fastify/cors';
import {DatasetCore} from 'rdf-js';
import acceptsSerializer from '@fastify/accepts-serializer';
import fastifySwaggerUi from '@fastify/swagger-ui';
import {registrationsCounter, validationsCounter} from './instrumentation';
import {registrationsCounter, validationsCounter} from './instrumentation.js';

const serializer =
(contentType: string) =>
Expand Down
2 changes: 1 addition & 1 deletion src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import factory from 'rdf-ext';
import SHACLValidator from 'rdf-validate-shacl';
import DatasetExt from 'rdf-ext/lib/Dataset';
import ValidationReport from 'rdf-validate-shacl/src/validation-report';
import {rdfDereferencer} from './rdf';
import {rdfDereferencer} from './rdf.js';

export interface Validator {
/**
Expand Down

0 comments on commit 812fe03

Please sign in to comment.