diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d7d7075f..64215b7c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,15 +8,6 @@ on: tags: - 'v*' -# on: -# push: -# branches: -# - main -# - master -# release: -# types: [created] -# # workflow_dispatch: - jobs: build: runs-on: ubuntu-latest diff --git a/.ncurc.json b/.ncurc.json new file mode 100644 index 00000000..061ce40f --- /dev/null +++ b/.ncurc.json @@ -0,0 +1,7 @@ +{ + "upgrade": true, + "install": "prompt", + "packageManager": "pnpm", + "reject": [ + ] +} diff --git a/package.json b/package.json index 6eb382dc..5a8dc46f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "zeed", "type": "module", - "version": "0.15.23", + "version": "0.15.24", "description": "🌱 Simple foundation library", "author": { "name": "Dirk Holtwick", @@ -69,9 +69,9 @@ "watch": "nr build:tsup -- --watch" }, "devDependencies": { - "@antfu/eslint-config": "^2.2.2", + "@antfu/eslint-config": "^2.4.2", "@antfu/ni": "^0.21.12", - "@types/node": "^20.10.3", + "@types/node": "^20.10.4", "c8": "^8.0.1", "cross-fetch": "^4.0.0", "esbuild": "^0.19.8", @@ -79,8 +79,8 @@ "madge": "^6.1.0", "tsup": "^8.0.1", "typedoc": "^0.25.4", - "typescript": "^5.3.2", - "vite": "^5.0.5", - "vitest": "^0.34.6" + "typescript": "^5.3.3", + "vite": "^5.0.6", + "vitest": "^1.0.2" } } diff --git a/src/common/csv.spec.ts b/src/common/csv.spec.ts index ea001656..9b37c001 100644 --- a/src/common/csv.spec.ts +++ b/src/common/csv.spec.ts @@ -9,9 +9,9 @@ describe('csv.spec', () => { ]) expect(txt).toMatchInlineSnapshot(` "1,one,10000000000,1e10,1.23 - 2,\\"two - lines\\",,,1 - 3,\\"tree \\"\\"drei\\"\\"\\",{},\\"{\\"\\"a\\"\\":1}\\",\\"[1,2,3]\\" + 2,"two + lines",,,1 + 3,"tree ""drei""",{},"{""a"":1}","[1,2,3]" " `) @@ -34,9 +34,9 @@ describe('csv.spec', () => { ], Array [ "3", - "tree \\"drei\\"", + "tree "drei"", "{}", - "{\\"a\\":1}", + "{"a":1}", "[1,2,3]", ], ] diff --git a/src/common/data/bin.spec.ts b/src/common/data/bin.spec.ts index 508aead5..37fba477 100644 --- a/src/common/data/bin.spec.ts +++ b/src/common/data/bin.spec.ts @@ -274,10 +274,10 @@ Uint8Array [ expect(hex).toMatchInlineSnapshot(` "0000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ................ 0010 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F ................ - 0020 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F .!\\"#$%&'()*+,-./ + 0020 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F .!"#$%&'()*+,-./ 0030 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>? 0040 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F @ABCDEFGHIJKLMNO - 0050 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\\\\]^_ + 0050 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\\]^_ 0060 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F \`abcdefghijklmno 0070 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F pqrstuvwxyz{|}~. 0080 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F ................ diff --git a/src/common/data/deep.spec.ts b/src/common/data/deep.spec.ts index 4d930b4c..e8cf24d8 100644 --- a/src/common/data/deep.spec.ts +++ b/src/common/data/deep.spec.ts @@ -202,21 +202,21 @@ describe('deep', () => { // Haha, this is simpler :) But not working in lists expect(JSON.stringify(sample, null, 2)).toMatchInlineSnapshot(` "{ - \\"hello\\": { - \\"world\\": -1, - \\"null1\\": null, - \\"sea\\": \\"none\\" + "hello": { + "world": -1, + "null1": null, + "sea": "none" }, - \\"other\\": [ + "other": [ { - \\"fish\\": 8 + "fish": 8 }, null, null, - \\"Hello\\" + "Hello" ], - \\"before\\": { - \\"magic\\": 666 + "before": { + "magic": 666 } }" `) diff --git a/src/common/data/json.spec.ts b/src/common/data/json.spec.ts index a29c43e2..5fb20a2a 100644 --- a/src/common/data/json.spec.ts +++ b/src/common/data/json.spec.ts @@ -24,7 +24,7 @@ describe('convert', () => { } } const t = new Test(new Uint8Array([1, 2, 3])) - expect(jsonStringifySafe(t)).toMatchInlineSnapshot('"{\\"id\\":{\\"0\\":1,\\"1\\":2,\\"2\\":3}}"') + expect(jsonStringifySafe(t)).toMatchInlineSnapshot(`"{"id":{"0":1,"1":2,"2":3}}"`) }) it('should jsonParse', () => { diff --git a/src/common/dispose-utils.ts b/src/common/dispose-utils.ts index c5effc31..a3fbd783 100644 --- a/src/common/dispose-utils.ts +++ b/src/common/dispose-utils.ts @@ -4,10 +4,9 @@ import type { DisposerFunction } from './dispose-types' import { promisify } from './exec' import type { LoggerInterface } from './log/log-base' -export function useTimeout( - fn: DisposerFunction, - timeout = 0, -): DisposerFunction { +export type TimerExecFunction = () => void | Promise + +export function useTimeout(fn: TimerExecFunction, timeout = 0): DisposerFunction { let timeoutHandle: any = setTimeout(fn, timeout) return () => { if (timeoutHandle) { @@ -17,7 +16,7 @@ export function useTimeout( } } -export function useInterval(fn: DisposerFunction, interval: number): DisposerFunction { +export function useInterval(fn: TimerExecFunction, interval: number): DisposerFunction { let intervalHandle: any = setInterval(fn, interval) return () => { if (intervalHandle) { @@ -28,7 +27,7 @@ export function useInterval(fn: DisposerFunction, interval: number): DisposerFun } /** The interval starts only, when the function is finished. */ -export function useIntervalPause(fn: DisposerFunction, interval: number, immediately = false): DisposerFunction { +export function useIntervalPause(fn: TimerExecFunction, interval: number, immediately = false): DisposerFunction { let intervalHandle: any let stop = false @@ -94,9 +93,9 @@ export function useEventListenerOnce( export function useDisposeWithUtils(config?: string | UseDisposeConfig | LoggerInterface) { const dispose = useDispose(config) return Object.assign(dispose, { - timeout: (fn: DisposerFunction, timeout = 0) => dispose.add(useTimeout(fn, timeout)), - interval: (fn: DisposerFunction, interval = 0) => dispose.add(useInterval(fn, interval)), - intervalPause: (fn: DisposerFunction, interval = 0) => dispose.add(useIntervalPause(fn, interval)), + timeout: (fn: TimerExecFunction, timeout = 0) => dispose.add(useTimeout(fn, timeout)), + interval: (fn: TimerExecFunction, interval = 0) => dispose.add(useInterval(fn, interval)), + intervalPause: (fn: TimerExecFunction, interval = 0) => dispose.add(useIntervalPause(fn, interval)), on: (emitter: any, eventName: string, fn: (ev?: any) => void, ...args: any[]) => dispose.add(useEventListener(emitter, eventName, fn, ...args)), once: (emitter: any, eventName: string, fn: (ev?: any) => void, ...args: any[]) => dispose.add(useEventListenerOnce(emitter, eventName, fn, ...args)), }) diff --git a/src/index.spec.ts b/src/index.spec.ts index d9e2eeae..af62227e 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -38,7 +38,7 @@ describe('treeshake', () => { // var a = [1, 2, 3, 3]; var aa = arrayUnion(a); - console.log(\\"result arrayUnion\\", aa); + console.log("result arrayUnion", aa); })(); " `) diff --git a/src/node/args.spec.ts b/src/node/args.spec.ts index 218e9d2b..56e9ff90 100644 --- a/src/node/args.spec.ts +++ b/src/node/args.spec.ts @@ -45,7 +45,7 @@ describe('args.spec', () => { "listItem", ], "someNumber": 123, - "someOne": "\\"empty string\\"", + "someOne": ""empty string"", } `) }) diff --git a/tsconfig-cjs.json b/tsconfig-cjs.json deleted file mode 100644 index 94814eed..00000000 --- a/tsconfig-cjs.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "target": "es2020", - "module": "commonjs", - "lib": ["es2020", "dom"], - "outDir": "dist/cjs", - "importHelpers": true - } -}