Skip to content

Commit d3594c8

Browse files
committed
lint and optimized types build step
1 parent d8d4e6c commit d3594c8

File tree

13 files changed

+143
-676
lines changed

13 files changed

+143
-676
lines changed

package-lock.json

Lines changed: 3 additions & 543 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@
271271
"typescript": "^5.9.3"
272272
},
273273
"scripts": {
274-
"clean": "rm -rf dist",
275-
"types": "tsc",
274+
"clean": "rm -rf types",
275+
"types": "rm -rf types && tsc -p tsconfig.build.json",
276276
"dist": "npm run clean && npm run types",
277277
"debug": "npm run gentesthtml && node ./src/bin/0serve.js -o test.html",
278278
"test": "c8 --check-coverage --lines 100 --branches 100 --functions 100 --statements 100 node --unhandled-rejections=strict ./src/test.js --repetition-time 50",
@@ -283,7 +283,7 @@
283283
"trace-opt": "clear && node --trace-opt src/test.js",
284284
"lint": "standard && tsc",
285285
"gendocs": "node ./bin/gendocs.js",
286-
"preversion": "npm run clean && npm run lint && npm run types && npm run dist && git add README.md",
286+
"preversion": "npm run clean && npm run lint && npm run dist && git add README.md",
287287
"postpublish": "npm run clean",
288288
"gentesthtml": "node ./src/bin/gentesthtml.js --script src/test.js > test.html"
289289
},

src/array.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const appendTo = (dest, src) => {
4949
* @param {ArrayLike<T>|Iterable<T>} arraylike
5050
* @return {T}
5151
*/
52-
export const from = /*@__PURE__*/(() => Array.from)()
52+
export const from = /* @__PURE__ */(() => Array.from)()
5353

5454
/**
5555
* True iff condition holds on every element in the Array.
@@ -131,7 +131,7 @@ export const fold = (arr, seed, folder) => arr.reduce(folder, seed)
131131
/**
132132
* @param {any} o
133133
*/
134-
/*@__NO_SIDE_EFFECTS__*/
134+
/* @__NO_SIDE_EFFECTS__ */
135135
export const isArray = o => Array.isArray(o)
136136

137137
/**

src/binary.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as t from './testing.js'
77
export const testBitx = tc => {
88
for (let i = 1; i <= 32; i++) {
99
// @ts-ignore
10-
t.assert(binary[`BIT${i}`] === (1 << (i - 1))>>>0, `BIT${i}=${(1 << (i - 1))>>>0}`)
10+
t.assert(binary[`BIT${i}`] === (1 << (i - 1)) >>> 0, `BIT${i}=${(1 << (i - 1)) >>> 0}`)
1111
}
1212
}
1313

src/bundle.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
import {map} from './index.js'
1+
import { map } from './index.js'
32

43
console.log(map.all(new Map(), x => x === 1))
5-

src/delta/delta.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import * as prng from '../prng.js'
3737
/**
3838
* @type {s.Schema<Attribution>}
3939
*/
40-
export const $attribution = /*@__PURE__*/(()=>s.$object({
40+
export const $attribution = /* @__PURE__ */(() => s.$object({
4141
insert: s.$array(s.$string).optional,
4242
insertAt: s.$number.optional,
4343
delete: s.$array(s.$string).optional,
@@ -82,7 +82,7 @@ export const $attribution = /*@__PURE__*/(()=>s.$object({
8282
/**
8383
* @type {s.Schema<DeltaAttrOpJSON>}
8484
*/
85-
export const $deltaMapChangeJson = /*@__PURE__*/(()=>s.$union(
85+
export const $deltaMapChangeJson = /* @__PURE__ */(() => s.$union(
8686
s.$object({ type: s.$literal('insert'), value: s.$any, prevValue: s.$any.optional, attribution: $attribution.optional }),
8787
s.$object({ type: s.$literal('modify'), value: s.$any }),
8888
s.$object({ type: s.$literal('delete'), prevValue: s.$any.optional, attribution: $attribution.optional })
@@ -1962,7 +1962,7 @@ export const $delta = ({ name, attrs, children, text, formats, recursiveChildren
19621962
formats == null ? s.$any : s.$(formats)
19631963
))
19641964

1965-
export const $$delta = /*@__PURE__*/s.$constructedBy($Delta)
1965+
export const $$delta = /* @__PURE__ */s.$constructedBy($Delta)
19661966

19671967
/**
19681968
* @todo remove this
@@ -2013,8 +2013,8 @@ export const _$delta = ({ name, attrs, children, text, recursive }) => {
20132013
return /** @type {any} */ ($d)
20142014
}
20152015

2016-
export const $deltaAny = /** @type {s.Schema<DeltaAny>} */ (/*@__PURE__*/s.$type('delta'))
2017-
export const $deltaBuilderAny = /** @type {s.Schema<DeltaBuilderAny>} */ (/*@__PURE__*/s.$custom(o => $deltaAny.check(o) && !o.isDone))
2016+
export const $deltaAny = /** @type {s.Schema<DeltaAny>} */ (/* @__PURE__ */s.$type('delta'))
2017+
export const $deltaBuilderAny = /** @type {s.Schema<DeltaBuilderAny>} */ (/* @__PURE__ */s.$custom(o => $deltaAny.check(o) && !o.isDone))
20182018

20192019
/**
20202020
* Helper function to merge attribution and attributes. The latter input "wins".

src/environment.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import * as storage from './storage.js'
1111
import * as f from './function.js'
1212

1313
/* c8 ignore next */
14-
export const isNode = /*@__PURE__*/(() => typeof process !== 'undefined' && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]')()
14+
export const isNode = /* @__PURE__ */(() => typeof process !== 'undefined' && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]')()
1515

1616
/* c8 ignore next */
17-
export const isBrowser = /*@__PURE__*/(()=>typeof window !== 'undefined' && typeof document !== 'undefined' && !isNode)()
17+
export const isBrowser = /* @__PURE__ */(() => typeof window !== 'undefined' && typeof document !== 'undefined' && !isNode)()
1818
/* c8 ignore next */
19-
export const isMac = /*@__PURE__*/(()=>typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false)()
19+
export const isMac = /* @__PURE__ */(() => typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false)()
2020

2121
/**
2222
* @type {Map<string,string>}
@@ -25,7 +25,7 @@ let params
2525
const args = []
2626

2727
/* c8 ignore start */
28-
/*@__NO_SIDE_EFFECTS__*/
28+
/* @__NO_SIDE_EFFECTS__ */
2929
const computeParams = () => {
3030
if (params === undefined) {
3131
if (isNode) {
@@ -74,7 +74,7 @@ const computeParams = () => {
7474
* @return {boolean}
7575
*/
7676
/* c8 ignore next */
77-
/*@__NO_SIDE_EFFECTS__*/
77+
/* @__NO_SIDE_EFFECTS__ */
7878
export const hasParam = (name) => computeParams().has(name)
7979

8080
/**
@@ -83,7 +83,7 @@ export const hasParam = (name) => computeParams().has(name)
8383
* @return {string}
8484
*/
8585
/* c8 ignore next 2 */
86-
/*@__NO_SIDE_EFFECTS__*/
86+
/* @__NO_SIDE_EFFECTS__ */
8787
export const getParam = (name, defaultVal) =>
8888
computeParams().get(name) || defaultVal
8989

@@ -92,7 +92,7 @@ export const getParam = (name, defaultVal) =>
9292
* @return {string|null}
9393
*/
9494
/* c8 ignore next 4 */
95-
/*@__NO_SIDE_EFFECTS__*/
95+
/* @__NO_SIDE_EFFECTS__ */
9696
export const getVariable = (name) =>
9797
isNode
9898
? conditions.undefinedToNull(process.env[name.toUpperCase().replaceAll('-', '_')])
@@ -103,15 +103,15 @@ export const getVariable = (name) =>
103103
* @return {string|null}
104104
*/
105105
/* c8 ignore next 2 */
106-
/*@__NO_SIDE_EFFECTS__*/
106+
/* @__NO_SIDE_EFFECTS__ */
107107
export const getConf = (name) => computeParams().get('--' + name) || getVariable(name)
108108

109109
/**
110110
* @param {string} name
111111
* @return {string}
112112
*/
113113
/* c8 ignore start */
114-
/*@__NO_SIDE_EFFECTS__*/
114+
/* @__NO_SIDE_EFFECTS__ */
115115
export const ensureConf = (name) => {
116116
const c = getConf(name)
117117
if (c == null) throw new Error(`Expected configuration "${name.toUpperCase().replaceAll('-', '_')}"`)
@@ -124,15 +124,15 @@ export const ensureConf = (name) => {
124124
* @return {boolean}
125125
*/
126126
/* c8 ignore next 2 */
127-
/*@__NO_SIDE_EFFECTS__*/
127+
/* @__NO_SIDE_EFFECTS__ */
128128
export const hasConf = (name) =>
129129
hasParam('--' + name) || getVariable(name) !== null
130130

131131
/* c8 ignore next */
132-
export const production = /*@__PURE__*/(()=>hasConf('production'))()
132+
export const production = /* @__PURE__ */(() => hasConf('production'))()
133133

134134
/* c8 ignore next 2 */
135-
const forceColor = /*@__PURE__*/(()=>isNode && f.isOneOf(process.env.FORCE_COLOR, ['true', '1', '2']))()
135+
const forceColor = /* @__PURE__ */(() => isNode && f.isOneOf(process.env.FORCE_COLOR, ['true', '1', '2']))()
136136

137137
/* c8 ignore start */
138138
/**
@@ -142,7 +142,7 @@ const forceColor = /*@__PURE__*/(()=>isNode && f.isOneOf(process.env.FORCE_COLOR
142142
* Disable color using `--no-color` parameter or using `NO_COLOR=1` environment variable.
143143
* `FORCE_COLOR=1` enables color and takes precedence over all.
144144
*/
145-
export const supportsColor = /*@__PURE__*/(()=>forceColor || (
145+
export const supportsColor = /* @__PURE__ */(() => forceColor || (
146146
!hasParam('--no-colors') && // @todo deprecate --no-colors
147147
!hasConf('no-color') &&
148148
(!isNode || process.stdout.isTTY) && (
@@ -155,7 +155,7 @@ export const supportsColor = /*@__PURE__*/(()=>forceColor || (
155155
/* c8 ignore stop */
156156

157157
/* c8 ignore start */
158-
const globalScope = /*@__PURE__*/(()=>/** @type {any} */ (typeof globalThis !== 'undefined'
158+
const globalScope = /* @__PURE__ */(() =>/** @type {any} */ (typeof globalThis !== 'undefined'
159159
? globalThis
160160
: typeof window !== 'undefined'
161161
? window

src/hash/rabin.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88
import * as buffer from '../buffer.js'
99
import * as map from '../map.js'
1010

11-
export const StandardIrreducible8 = /*@__PURE__*/new Uint8Array([1, 221])
12-
export const StandardIrreducible16 = /*@__PURE__*/new Uint8Array([1, 244, 157])
13-
export const StandardIrreducible32 = /*@__PURE__*/new Uint8Array([1, 149, 183, 205, 191])
14-
export const StandardIrreducible64 = /*@__PURE__*/new Uint8Array([1, 133, 250, 114, 193, 250, 28, 193, 231])
15-
export const StandardIrreducible128 = /*@__PURE__*/new Uint8Array([1, 94, 109, 166, 228, 6, 222, 102, 239, 27, 128, 184, 13, 50, 112, 169, 199])
11+
export const StandardIrreducible8 = /* @__PURE__ */new Uint8Array([1, 221])
12+
export const StandardIrreducible16 = /* @__PURE__ */new Uint8Array([1, 244, 157])
13+
export const StandardIrreducible32 = /* @__PURE__ */new Uint8Array([1, 149, 183, 205, 191])
14+
export const StandardIrreducible64 = /* @__PURE__ */new Uint8Array([1, 133, 250, 114, 193, 250, 28, 193, 231])
15+
export const StandardIrreducible128 = /* @__PURE__ */new Uint8Array([1, 94, 109, 166, 228, 6, 222, 102, 239, 27, 128, 184, 13, 50, 112, 169, 199])
1616

1717
/**
1818
* Maps from a modulo to the precomputed values.
1919
*
2020
* @type {Map<string,Uint8Array>}
2121
*/
22-
const _precomputedFingerprintCache = /*@__PURE__*/new Map()
22+
const _precomputedFingerprintCache = /* @__PURE__ */new Map()
2323

2424
/**
2525
* @param {Uint8Array} m

0 commit comments

Comments
 (0)