Skip to content

Commit

Permalink
refactor: minor pkg restructure (various)
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Sep 29, 2021
1 parent ce4d3e8 commit 47f88d2
Show file tree
Hide file tree
Showing 25 changed files with 38 additions and 60 deletions.
3 changes: 0 additions & 3 deletions packages/adjacency/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@
},
"./sparse": {
"import": "./sparse.js"
},
"./utils": {
"import": "./utils.js"
}
},
"thi.ng": {
Expand Down
1 change: 1 addition & 0 deletions packages/adjacency/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// thing:no-export
import type { Pair } from "@thi.ng/api";
import type { Edge, IGraph } from "./api";

Expand Down
1 change: 0 additions & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"files": [
"*.js",
"*.d.ts",
"api",
"decorators",
"mixins"
],
Expand Down
3 changes: 0 additions & 3 deletions packages/atom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@
"./history": {
"import": "./history.js"
},
"./idgen": {
"import": "./idgen.js"
},
"./transacted": {
"import": "./transacted.js"
},
Expand Down
1 change: 1 addition & 0 deletions packages/atom/src/idgen.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// thing:no-export
let NEXT_ID = 0;

export const nextID = () => NEXT_ID++;
3 changes: 0 additions & 3 deletions packages/bitfield/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@
},
"./bitmatrix": {
"import": "./bitmatrix.js"
},
"./util": {
"import": "./util.js"
}
},
"thi.ng": {
Expand Down
1 change: 1 addition & 0 deletions packages/bitfield/src/util.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// thing:no-export
import type { Fn2 } from "@thi.ng/api";
import { popCount as $popCount } from "@thi.ng/binary/count";
import { B32 } from "@thi.ng/strings/radix";
Expand Down
3 changes: 0 additions & 3 deletions packages/colored-noise/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@
"./red": {
"import": "./red.js"
},
"./utils": {
"import": "./utils.js"
},
"./violet": {
"import": "./violet.js"
},
Expand Down
1 change: 1 addition & 0 deletions packages/colored-noise/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// thing:no-export
import type { INorm } from "@thi.ng/random";

export const preseed = (n: number, scale: number, rnd: INorm) => {
Expand Down
3 changes: 0 additions & 3 deletions packages/geom-accel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@
},
"./spatial-grid3": {
"import": "./spatial-grid3.js"
},
"./utils": {
"import": "./utils.js"
}
},
"thi.ng": {
Expand Down
1 change: 1 addition & 0 deletions packages/geom-accel/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// thing:no-export
import type { Fn, Fn3, Nullable, Pair } from "@thi.ng/api";

/** @internal */
Expand Down
3 changes: 0 additions & 3 deletions packages/gp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@
},
"./mep": {
"import": "./mep.js"
},
"./utils": {
"import": "./utils.js"
}
},
"thi.ng": {
Expand Down
1 change: 1 addition & 0 deletions packages/gp/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// thing:no-export
import { assert } from "@thi.ng/errors/assert";
import { add } from "@thi.ng/transducers/add";
import { choices } from "@thi.ng/transducers/choices";
Expand Down
3 changes: 0 additions & 3 deletions packages/grid-iterators/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@
"./spiral": {
"import": "./spiral.js"
},
"./utils": {
"import": "./utils.js"
},
"./zcurve": {
"import": "./zcurve.js"
},
Expand Down
1 change: 1 addition & 0 deletions packages/grid-iterators/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// thing:no-export
/**
* Swaps XY in-place.
*
Expand Down
3 changes: 0 additions & 3 deletions packages/mime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@
"exports": {
".": {
"import": "./index.js"
},
"./generated": {
"import": "./generated.js"
}
},
"thi.ng": {
Expand Down
1 change: 1 addition & 0 deletions packages/mime/src/generated.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// thing:no-export
/**
* generated @ 2021-04-10T11:16:38.116Z - DO NOT EDIT!
*
Expand Down
3 changes: 2 additions & 1 deletion packages/mime/tools/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ for (let gid of Object.keys(dest).sort()) {
.reduce((acc, id) => ((acc[id] = group[id]), acc), <any>{});
}

const body = `/**
const body = `// thing:no-export
/**
* generated @ ${new Date().toISOString()} - DO NOT EDIT!
*
* @internal
Expand Down
3 changes: 0 additions & 3 deletions packages/porter-duff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@
},
"./premultiply": {
"import": "./premultiply.js"
},
"./utils": {
"import": "./utils.js"
}
},
"thi.ng": {
Expand Down
1 change: 1 addition & 0 deletions packages/porter-duff/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// thing:no-export
import type { Color, ReadonlyColor } from "./api";

/** @internal */
Expand Down
42 changes: 22 additions & 20 deletions packages/sax/test/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defmulti } from "@thi.ng/defmulti";
import { DEFAULT, defmulti, MultiFn1 } from "@thi.ng/defmulti";
import { group } from "@thi.ng/testament";
import {
comp,
Expand Down Expand Up @@ -87,29 +87,31 @@ group("sax", {
);

// define multiple dispatch function, based on element tag name
const parseElement = defmulti<ParseElement, any>((e) => e.tag);
const parseElement: MultiFn1<ParseElement, any> = defmulti<
ParseElement,
any
>(
(e) => e.tag,
{},
{
circle: (e) => [e.tag, numericAttribs(e, "cx", "cy", "r")],

// implementations
parseElement.add("circle", (e) => [
e.tag,
numericAttribs(e, "cx", "cy", "r"),
]);

parseElement.add("rect", (e) => [
e.tag,
numericAttribs(e, "x", "y", "width", "height"),
]);
rect: (e) => [
e.tag,
numericAttribs(e, "x", "y", "width", "height"),
],

parseElement.add("g", (e) => [e.tag, e.attribs, ...parsedChildren(e)]);
g: (e) => [e.tag, e.attribs, ...parsedChildren(e)],

parseElement.add("svg", (e) => [
e.tag,
numericAttribs(e, "width", "height"),
...parsedChildren(e),
]);
svg: (e) => [
e.tag,
numericAttribs(e, "width", "height"),
...parsedChildren(e),
],

// implementation for unhandled elements (just return undefined)
parseElement.setDefault(() => undefined);
[DEFAULT]: () => undefined,
}
);

assert.deepStrictEqual(
parseElement(<ParseElement>transduce(parse(), last(), svg)),
Expand Down
3 changes: 0 additions & 3 deletions packages/soa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@
},
"./soa": {
"import": "./soa.js"
},
"./utils": {
"import": "./utils.js"
}
},
"thi.ng": {
Expand Down
1 change: 1 addition & 0 deletions packages/soa/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// thing:no-export
import type { SOAAttribSpec } from "./api";

export const prepareSpec = (spec: Partial<SOAAttribSpec>) => {
Expand Down
3 changes: 1 addition & 2 deletions packages/testament/src/exec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { TestResult } from ".";
import type { Test } from "./api";
import type { Test, TestResult } from "./api";
import { now, timeDiff } from "./utils";

const TESTS: Test[] = [];
Expand Down
9 changes: 3 additions & 6 deletions packages/transducers-hdom/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import {
DEFAULT_IMPL,
HDOMImplementation,
HDOMOpts,
resolveRoot,
} from "@thi.ng/hdom";
import type { HDOMImplementation, HDOMOpts } from "@thi.ng/hdom";
import { DEFAULT_IMPL } from "@thi.ng/hdom/default";
import { resolveRoot } from "@thi.ng/hdom/resolve";
import { derefContext } from "@thi.ng/hiccup/deref";
import type { Transducer } from "@thi.ng/transducers";
import { scan } from "@thi.ng/transducers/scan";
Expand Down

0 comments on commit 47f88d2

Please sign in to comment.