switched back to commonjs rather than esm
This commit is contained in:
parent
756fd240f5
commit
58c5f5dc4e
|
@ -1,6 +1,6 @@
|
||||||
import {Delta, DeltaFilter} from '../src/delta.js';
|
import {Delta, DeltaFilter} from '../src/delta';
|
||||||
import {Lossless} from '../src/lossless.js';
|
import {Lossless} from '../src/lossless';
|
||||||
import {RhizomeNode} from '../src/node.js';
|
import {RhizomeNode} from '../src/node';
|
||||||
|
|
||||||
describe('Lossless', () => {
|
describe('Lossless', () => {
|
||||||
const node = new RhizomeNode();
|
const node = new RhizomeNode();
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import {Delta, PointerTarget} from "../src/delta.js";
|
import {Delta, PointerTarget} from "../src/delta";
|
||||||
import {lastValueFromDeltas} from "../src/last-write-wins.js";
|
import {lastValueFromDeltas} from "../src/last-write-wins";
|
||||||
import {Lossless, LosslessViewOne} from "../src/lossless.js";
|
import {Lossless, LosslessViewOne} from "../src/lossless";
|
||||||
import {Lossy, valueFromCollapsedDelta} from "../src/lossy.js";
|
import {Lossy, valueFromCollapsedDelta} from "../src/lossy";
|
||||||
import {RhizomeNode} from "../src/node.js";
|
import {RhizomeNode} from "../src/node";
|
||||||
const debug = Debug('test:lossy');
|
const debug = Debug('test:lossy');
|
||||||
|
|
||||||
type Role = {
|
type Role = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {parseAddressList, PeerAddress} from '../src/peers.js';
|
import {parseAddressList, PeerAddress} from '../src/peers';
|
||||||
|
|
||||||
describe('PeerAddress', () => {
|
describe('PeerAddress', () => {
|
||||||
it('toString()', () => {
|
it('toString()', () => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {App} from "../../util/app.js";
|
import {App} from "../../util/app";
|
||||||
|
|
||||||
describe('Run', () => {
|
describe('Run', () => {
|
||||||
let app: App;
|
let app: App;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import {App} from '../../util/app.js';
|
import {App} from '../../util/app';
|
||||||
const debug = Debug('test:two');
|
const debug = Debug('test:two');
|
||||||
|
|
||||||
describe('Run', () => {
|
describe('Run', () => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import {Collection} from "../src/collection.js";
|
import {Collection} from "../src/collection";
|
||||||
import {Entity} from "../src/entity.js";
|
import {Entity} from "../src/entity";
|
||||||
import {RhizomeNode} from "../src/node.js";
|
import {RhizomeNode} from "../src/node";
|
||||||
const debug = Debug('example-app');
|
const debug = Debug('example-app');
|
||||||
|
|
||||||
// As an app we want to be able to write and read data.
|
// As an app we want to be able to write and read data.
|
||||||
|
|
14
package.json
14
package.json
|
@ -19,22 +19,8 @@
|
||||||
],
|
],
|
||||||
"testMatch": [
|
"testMatch": [
|
||||||
"**/__tests__/**/*"
|
"**/__tests__/**/*"
|
||||||
],
|
|
||||||
"transform": {
|
|
||||||
"^.+\\.ts$": [
|
|
||||||
"ts-jest",
|
|
||||||
{
|
|
||||||
"useESM": true
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"extensionsToTreatAsEsm": [
|
|
||||||
".ts"
|
|
||||||
],
|
|
||||||
"moduleNameMapper": {
|
|
||||||
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"author": "Taliesin (Ladd) <ladd@dgov.io>",
|
"author": "Taliesin (Ladd) <ladd@dgov.io>",
|
||||||
"license": "Unlicense",
|
"license": "Unlicense",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import {randomUUID} from "node:crypto";
|
import {randomUUID} from "node:crypto";
|
||||||
import EventEmitter from "node:events";
|
import EventEmitter from "node:events";
|
||||||
import {Delta} from "./delta.js";
|
import {Delta} from "./delta";
|
||||||
import {Entity, EntityProperties} from "./entity.js";
|
import {Entity, EntityProperties} from "./entity";
|
||||||
import {LastWriteWins, ResolvedViewOne} from './last-write-wins.js';
|
import {LastWriteWins, ResolvedViewOne} from './last-write-wins';
|
||||||
import {RhizomeNode} from "./node.js";
|
import {RhizomeNode} from "./node";
|
||||||
import {DomainEntityID} from "./types.js";
|
import {DomainEntityID} from "./types";
|
||||||
const debug = Debug('rz:collection');
|
const debug = Debug('rz:collection');
|
||||||
|
|
||||||
export class Collection {
|
export class Collection {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {randomUUID} from "crypto";
|
import {randomUUID} from "crypto";
|
||||||
import microtime from 'microtime';
|
import microtime from 'microtime';
|
||||||
import {CreatorID, HostID, Timestamp, TransactionID} from "./types.js";
|
import {CreatorID, HostID, Timestamp, TransactionID} from "./types";
|
||||||
import {PeerAddress} from "./peers.js";
|
import {PeerAddress} from "./peers";
|
||||||
|
|
||||||
export type DeltaID = string;
|
export type DeltaID = string;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import EventEmitter from 'node:events';
|
import EventEmitter from 'node:events';
|
||||||
import objectHash from 'object-hash';
|
import objectHash from 'object-hash';
|
||||||
import {Delta, DeltaNetworkImage} from './delta.js';
|
import {Delta, DeltaNetworkImage} from './delta';
|
||||||
import {RhizomeNode} from './node.js';
|
import {RhizomeNode} from './node';
|
||||||
const debug = Debug('rz:deltas');
|
const debug = Debug('rz:deltas');
|
||||||
|
|
||||||
enum Decision {
|
enum Decision {
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
// - As typescript interfaces?
|
// - As typescript interfaces?
|
||||||
// - As typescript classes?
|
// - As typescript classes?
|
||||||
|
|
||||||
import {Collection} from "./collection.js";
|
import {Collection} from "./collection";
|
||||||
import {PropertyTypes} from "./types.js";
|
import {PropertyTypes} from "./types";
|
||||||
|
|
||||||
export type EntityProperties = {
|
export type EntityProperties = {
|
||||||
[key: string]: PropertyTypes;
|
[key: string]: PropertyTypes;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { add_operation, apply } from 'json-logic-js';
|
import { add_operation, apply } from 'json-logic-js';
|
||||||
import { Delta } from '../delta.js';
|
import { Delta } from '../delta';
|
||||||
|
|
||||||
type DeltaContext = Delta & {
|
type DeltaContext = Delta & {
|
||||||
creatorAddress: string;
|
creatorAddress: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { FilterExpr } from "../types.js";
|
import { FilterExpr } from "../types";
|
||||||
// import { map } from 'radash';
|
// import { map } from 'radash';
|
||||||
|
|
||||||
// A creator as seen by a host
|
// A creator as seen by a host
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import express, {Router} from "express";
|
import express, {Router} from "express";
|
||||||
import {Collection} from "../collection.js";
|
import {Collection} from "../collection";
|
||||||
import {Delta} from "../delta.js";
|
import {Delta} from "../delta";
|
||||||
import {RhizomeNode} from "../node.js";
|
import {RhizomeNode} from "../node";
|
||||||
|
|
||||||
export class HttpApi {
|
export class HttpApi {
|
||||||
router = Router();
|
router = Router();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import express, {Router} from "express";
|
import express, {Router} from "express";
|
||||||
import {RhizomeNode} from "../node.js";
|
import {RhizomeNode} from "../node";
|
||||||
import {htmlDocFromMarkdown, MDFiles} from "../util/md-files.js";
|
import {htmlDocFromMarkdown, MDFiles} from "../util/md-files";
|
||||||
|
|
||||||
export class HttpHtml {
|
export class HttpHtml {
|
||||||
router = Router();
|
router = Router();
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import Debug from "debug";
|
import Debug from "debug";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import {Server} from "http";
|
import {Server} from "http";
|
||||||
import {RhizomeNode} from "../node.js";
|
import {RhizomeNode} from "../node";
|
||||||
import {HttpApi} from "./api.js";
|
import {HttpApi} from "./api";
|
||||||
import {HttpHtml} from "./html.js";
|
import {HttpHtml} from "./html";
|
||||||
const debug = Debug('rz:http-api');
|
const debug = Debug('rz:http-api');
|
||||||
|
|
||||||
export class HttpServer {
|
export class HttpServer {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// import Debug from 'debug';
|
// import Debug from 'debug';
|
||||||
import {EntityProperties} from "./entity.js";
|
import {EntityProperties} from "./entity";
|
||||||
import {CollapsedDelta, Lossless, LosslessViewOne} from "./lossless.js";
|
import {CollapsedDelta, Lossless, LosslessViewOne} from "./lossless";
|
||||||
import {Lossy, valueFromCollapsedDelta} from './lossy.js';
|
import {Lossy, valueFromCollapsedDelta} from './lossy';
|
||||||
import {DomainEntityID, PropertyID, PropertyTypes, Timestamp, ViewMany} from "./types.js";
|
import {DomainEntityID, PropertyID, PropertyTypes, Timestamp, ViewMany} from "./types";
|
||||||
// const debug = Debug('rz:lossy:last-write-wins');
|
// const debug = Debug('rz:lossy:last-write-wins');
|
||||||
|
|
||||||
type TimestampedProperty = {
|
type TimestampedProperty = {
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
|
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import EventEmitter from 'events';
|
import EventEmitter from 'events';
|
||||||
import {Delta, DeltaFilter, DeltaID, DeltaNetworkImage} from './delta.js';
|
import {Delta, DeltaFilter, DeltaID, DeltaNetworkImage} from './delta';
|
||||||
import {RhizomeNode} from './node.js';
|
import {RhizomeNode} from './node';
|
||||||
import {Transactions} from './transactions.js';
|
import {Transactions} from './transactions';
|
||||||
import {DomainEntityID, PropertyID, PropertyTypes, TransactionID, ViewMany} from "./types.js";
|
import {DomainEntityID, PropertyID, PropertyTypes, TransactionID, ViewMany} from "./types";
|
||||||
const debug = Debug('rz:lossless');
|
const debug = Debug('rz:lossless');
|
||||||
|
|
||||||
export type CollapsedPointer = {[key: PropertyID]: PropertyTypes};
|
export type CollapsedPointer = {[key: PropertyID]: PropertyTypes};
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
// into various possible "lossy" views that combine or exclude some information.
|
// into various possible "lossy" views that combine or exclude some information.
|
||||||
|
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import {DeltaFilter, DeltaID} from "./delta.js";
|
import {DeltaFilter, DeltaID} from "./delta";
|
||||||
import {CollapsedDelta, Lossless, LosslessViewOne} from "./lossless.js";
|
import {CollapsedDelta, Lossless, LosslessViewOne} from "./lossless";
|
||||||
import {DomainEntityID} from "./types.js";
|
import {DomainEntityID} from "./types";
|
||||||
const debug = Debug('rz:lossy');
|
const debug = Debug('rz:lossy');
|
||||||
|
|
||||||
export type Initializer<Accumulator> = (v: LosslessViewOne) => Accumulator;
|
export type Initializer<Accumulator> = (v: LosslessViewOne) => Accumulator;
|
||||||
|
|
14
src/node.ts
14
src/node.ts
|
@ -1,11 +1,11 @@
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import {CREATOR, HTTP_API_ADDR, HTTP_API_ENABLE, HTTP_API_PORT, PEER_ID, PUBLISH_BIND_ADDR, PUBLISH_BIND_HOST, PUBLISH_BIND_PORT, REQUEST_BIND_ADDR, REQUEST_BIND_HOST, REQUEST_BIND_PORT, SEED_PEERS} from './config.js';
|
import {CREATOR, HTTP_API_ADDR, HTTP_API_ENABLE, HTTP_API_PORT, PEER_ID, PUBLISH_BIND_ADDR, PUBLISH_BIND_HOST, PUBLISH_BIND_PORT, REQUEST_BIND_ADDR, REQUEST_BIND_HOST, REQUEST_BIND_PORT, SEED_PEERS} from './config';
|
||||||
import {DeltaStream} from './deltas.js';
|
import {DeltaStream} from './deltas';
|
||||||
import {HttpServer} from './http/index.js';
|
import {HttpServer} from './http/index';
|
||||||
import {Lossless} from './lossless.js';
|
import {Lossless} from './lossless';
|
||||||
import {parseAddressList, PeerAddress, Peers} from './peers.js';
|
import {parseAddressList, PeerAddress, Peers} from './peers';
|
||||||
import {PubSub} from './pub-sub.js';
|
import {PubSub} from './pub-sub';
|
||||||
import {RequestReply} from './request-reply.js';
|
import {RequestReply} from './request-reply';
|
||||||
const debug = Debug('rz:rhizome-node');
|
const debug = Debug('rz:rhizome-node');
|
||||||
|
|
||||||
export type RhizomeNodeConfig = {
|
export type RhizomeNodeConfig = {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import {Message} from 'zeromq';
|
import {Message} from 'zeromq';
|
||||||
import {Delta} from "./delta.js";
|
import {Delta} from "./delta";
|
||||||
import {RhizomeNode} from "./node.js";
|
import {RhizomeNode} from "./node";
|
||||||
import {Subscription} from './pub-sub.js';
|
import {Subscription} from './pub-sub';
|
||||||
import {PeerRequest, RequestSocket, ResponseSocket} from "./request-reply.js";
|
import {PeerRequest, RequestSocket, ResponseSocket} from "./request-reply";
|
||||||
const debug = Debug('rz:peers');
|
const debug = Debug('rz:peers');
|
||||||
|
|
||||||
export class PeerAddress {
|
export class PeerAddress {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import {Publisher, Subscriber} from 'zeromq';
|
import {Publisher, Subscriber} from 'zeromq';
|
||||||
import {RhizomeNode} from './node.js';
|
import {RhizomeNode} from './node';
|
||||||
import {PeerAddress} from './peers.js';
|
import {PeerAddress} from './peers';
|
||||||
const debug = Debug('rz:pub-sub');
|
const debug = Debug('rz:pub-sub');
|
||||||
|
|
||||||
export type SubscribedMessageHandler = (sender: PeerAddress, msg: string) => void;
|
export type SubscribedMessageHandler = (sender: PeerAddress, msg: string) => void;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import {EventEmitter} from 'node:events';
|
import {EventEmitter} from 'node:events';
|
||||||
import {Message, Reply, Request} from 'zeromq';
|
import {Message, Reply, Request} from 'zeromq';
|
||||||
import {RhizomeNode} from './node.js';
|
import {RhizomeNode} from './node';
|
||||||
import {PeerAddress, RequestMethods} from './peers.js';
|
import {PeerAddress, RequestMethods} from './peers';
|
||||||
const debug = Debug('rz:request-reply');
|
const debug = Debug('rz:request-reply');
|
||||||
|
|
||||||
export type PeerRequest = {
|
export type PeerRequest = {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Level } from 'level';
|
import { Level } from 'level';
|
||||||
import { LEVEL_DB_DIR } from './config.js';
|
import { LEVEL_DB_DIR } from './config';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
function newStore(name: string): Level {
|
function newStore(name: string): Level {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import Debug from "debug";
|
import Debug from "debug";
|
||||||
import EventEmitter from "events";
|
import EventEmitter from "events";
|
||||||
import {Delta, DeltaID} from "./delta.js";
|
import {Delta, DeltaID} from "./delta";
|
||||||
import {Lossless} from "./lossless.js";
|
import {Lossless} from "./lossless";
|
||||||
import {DomainEntityID, TransactionID} from "./types.js";
|
import {DomainEntityID, TransactionID} from "./types";
|
||||||
const debug = Debug('rz:transactions');
|
const debug = Debug('rz:transactions');
|
||||||
|
|
||||||
function getDeltaTransactionId(delta: Delta): TransactionID | undefined {
|
function getDeltaTransactionId(delta: Delta): TransactionID | undefined {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Debug from "debug";
|
||||||
import {FSWatcher, readdirSync, readFileSync, watch} from "fs";
|
import {FSWatcher, readdirSync, readFileSync, watch} from "fs";
|
||||||
import path, {join} from "path";
|
import path, {join} from "path";
|
||||||
import showdown from "showdown";
|
import showdown from "showdown";
|
||||||
import {RhizomeNode} from "../node.js";
|
import {RhizomeNode} from "../node";
|
||||||
const {Converter} = showdown;
|
const {Converter} = showdown;
|
||||||
const debug = Debug('rz:md-files');
|
const debug = Debug('rz:md-files');
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ESNext",
|
"target": "ES6",
|
||||||
"module": "ESNext",
|
"module": "CommonJS",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "Node",
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"isolatedModules": true,
|
|
||||||
/* "allowImportingTsExtensions": true, */
|
|
||||||
/* "noEmit": true, */
|
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"lib": ["ESNext"],
|
|
||||||
"types": ["node", "jest"],
|
|
||||||
"importsNotUsedAsValues": "remove",
|
"importsNotUsedAsValues": "remove",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
@ -24,10 +19,5 @@
|
||||||
"scratch/**/*",
|
"scratch/**/*",
|
||||||
"__tests__/**/*"
|
"__tests__/**/*"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": ["node_modules"]
|
||||||
"node_modules"
|
|
||||||
],
|
|
||||||
"tsc-alias": {
|
|
||||||
"resolveFullPaths": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Collection} from "../src/collection.js";
|
import {Collection} from "../src/collection";
|
||||||
import {RhizomeNode, RhizomeNodeConfig} from "../src/node.js";
|
import {RhizomeNode, RhizomeNodeConfig} from "../src/node";
|
||||||
|
|
||||||
const start = 5000;
|
const start = 5000;
|
||||||
const range = 5000;
|
const range = 5000;
|
||||||
|
|
Loading…
Reference in New Issue