fastevent 1.1.3 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/devTools.js +2 -2
  2. package/dist/devTools.js.map +1 -1
  3. package/dist/devTools.mjs +2 -2
  4. package/dist/devTools.mjs.map +1 -1
  5. package/dist/index.d.mts +304 -53
  6. package/dist/index.d.ts +304 -53
  7. package/dist/index.js +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +1 -1
  10. package/dist/index.mjs.map +1 -1
  11. package/package.json +64 -50
  12. package/readme.md +517 -50
  13. package/.changeset/README.md +0 -8
  14. package/.changeset/config.json +0 -11
  15. package/.github/workflows/publish.yaml +0 -50
  16. package/.prettierrc.js +0 -20
  17. package/.vscode/launch.json +0 -20
  18. package/.vscode/settings.json +0 -18
  19. package/CHANGELOG.md +0 -60
  20. package/LICENSE +0 -21
  21. package/bench.png +0 -0
  22. package/dist/devTools.d.mts +0 -543
  23. package/dist/devTools.d.ts +0 -543
  24. package/example/README.md +0 -54
  25. package/example/eslint.config.js +0 -28
  26. package/example/index.html +0 -13
  27. package/example/package.json +0 -29
  28. package/example/pnpm-lock.yaml +0 -2047
  29. package/example/public/vite.svg +0 -1
  30. package/example/src/App.css +0 -42
  31. package/example/src/App.tsx +0 -60
  32. package/example/src/assets/react.svg +0 -1
  33. package/example/src/index.css +0 -68
  34. package/example/src/main.tsx +0 -10
  35. package/example/src/myEvent.ts +0 -32
  36. package/example/src/vite-env.d.ts +0 -1
  37. package/example/tsconfig.app.json +0 -26
  38. package/example/tsconfig.json +0 -7
  39. package/example/tsconfig.node.json +0 -24
  40. package/example/vite.config.ts +0 -7
  41. package/packages/native/index.ts +0 -1
  42. package/packages/turbo/.zig-cache/h/271c82d991949fd7788fd5451f0ca834.txt +0 -0
  43. package/packages/turbo/.zig-cache/h/timestamp +0 -0
  44. package/packages/turbo/.zig-cache/o/ebd7ddab8ffe003267120d598aecce68/dependencies.zig +0 -2
  45. package/packages/turbo/.zig-cache/z/c8114b040daa461a9e2eabd0357554a4 +0 -0
  46. package/packages/turbo/build.zig +0 -60
  47. package/packages/turbo/examples/basic.zig +0 -107
  48. package/packages/turbo/src/event.zig +0 -251
  49. package/packages/turbo/src/index.zig +0 -70
  50. package/packages/turbo/src/scope.zig +0 -104
  51. package/packages/turbo/src/types.zig +0 -88
  52. package/packages/turbo/src/utils.zig +0 -171
  53. package/readme_cn.md +0 -491
  54. package/src/__benchmarks__/index.ts +0 -3
  55. package/src/__benchmarks__/multi-level.ts +0 -40
  56. package/src/__benchmarks__/sample.ts +0 -40
  57. package/src/__benchmarks__/wildcard.ts +0 -41
  58. package/src/__tests__/emit.test.ts +0 -106
  59. package/src/__tests__/emitAsync.test.ts +0 -64
  60. package/src/__tests__/isPathMatched.test.ts +0 -205
  61. package/src/__tests__/many.test.ts +0 -22
  62. package/src/__tests__/meta.test.ts +0 -28
  63. package/src/__tests__/off.test.ts +0 -214
  64. package/src/__tests__/onany.test.ts +0 -212
  65. package/src/__tests__/once.test.ts +0 -70
  66. package/src/__tests__/retain.test.ts +0 -66
  67. package/src/__tests__/scope.test.ts +0 -110
  68. package/src/__tests__/types.test.ts +0 -145
  69. package/src/__tests__/waitFor.test.ts +0 -116
  70. package/src/__tests__/wildcard.test.ts +0 -185
  71. package/src/devTools.ts +0 -166
  72. package/src/event.ts +0 -741
  73. package/src/index.ts +0 -3
  74. package/src/scope.ts +0 -130
  75. package/src/types.ts +0 -66
  76. package/src/utils/WeakObjectMap.ts +0 -64
  77. package/src/utils/isPathMatched.ts +0 -40
  78. package/src/utils/removeItem.ts +0 -16
  79. package/tsconfig.json +0 -104
  80. package/tsup.config.ts +0 -30
package/src/index.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from "./event"
2
- export * from "./scope"
3
- export * from "./types"
package/src/scope.ts DELETED
@@ -1,130 +0,0 @@
1
- import { FastEvent } from "./event";
2
- import { FastEventListener, FastEventListenOptions, FastEventMessage, FastEvents, FastEventSubscriber } from "./types";
3
-
4
- export class FastEventScope<
5
- Events extends FastEvents = FastEvents,
6
- Meta extends Record<string, any> = Record<string, any>,
7
- Context = any,
8
- Types extends keyof Events = keyof Events
9
- > {
10
- constructor(public emitter: FastEvent<Events, Meta, Types>, public prefix: string) {
11
- if (prefix.length > 0 && !prefix.endsWith(emitter.options.delimiter!)) {
12
- this.prefix = prefix + emitter.options.delimiter
13
- }
14
- }
15
- private _getScopeListener(listener: FastEventListener): FastEventListener {
16
- const scopePrefix = this.prefix
17
- if (scopePrefix.length === 0) return listener
18
- const scopeListener = function (message: FastEventMessage) {
19
- if (message.type.startsWith(scopePrefix)) {
20
- return listener(Object.assign({}, message, {
21
- type: message.type.substring(scopePrefix.length)
22
- }))
23
- }
24
- }
25
- // 当启用scope时对监听器进行包装
26
- //@ts-ignore
27
- listener.__wrappedListener = scopeListener
28
- return listener
29
- }
30
- private _getScopeType(type: string) {
31
- return type === undefined ? undefined : this.prefix + type
32
- }
33
- private _fixScopeType(type: string) {
34
- return type.startsWith(this.prefix) ? type.substring(this.prefix.length) : type
35
- }
36
-
37
- public on<T extends Types = Types>(type: T, listener: FastEventListener<T, Events[T], Meta, Context>, options?: FastEventListenOptions): FastEventSubscriber
38
- public on<T extends string>(type: T, listener: FastEventListener<T, Events[T], Meta, Context>, options?: FastEventListenOptions): FastEventSubscriber
39
- public on(type: '**', listener: FastEventListener<any, any, Meta, Context>): FastEventSubscriber
40
- public on(): FastEventSubscriber {
41
- const args = [...arguments] as [any, any, any]
42
- args[0] = this._getScopeType(args[0])
43
- args[1] = this._getScopeListener(args[1])
44
- return this.emitter.on(...args)
45
- }
46
-
47
- public once<T extends string>(type: T, listener: FastEventListener<T, Events[T], Meta, Context>, options?: FastEventListenOptions): FastEventSubscriber
48
- public once<T extends Types = Types>(type: T, listener: FastEventListener<Types, Events[T], Meta, Context>, options?: FastEventListenOptions): FastEventSubscriber
49
- public once(): FastEventSubscriber {
50
- return this.on(arguments[0], arguments[1], Object.assign({}, arguments[2], { count: 1 }))
51
- }
52
-
53
- onAny<P = any>(listener: FastEventListener<Types, P, Meta, Context>, options?: FastEventListenOptions): FastEventSubscriber {
54
- const type = this.prefix + '**'
55
- return this.on(type as any, listener, options)
56
- }
57
- offAll() {
58
- this.emitter.offAll(this.prefix)
59
- }
60
- off(listener: FastEventListener<any, any, any>): void
61
- off(type: string, listener: FastEventListener<any, any, any>): void
62
- off(type: Types, listener: FastEventListener<any, any, any>): void
63
- off(type: string): void
64
- off(type: Types): void
65
- off() {
66
- const args = arguments as unknown as [any, any]
67
- if (typeof (args[0]) === 'string') {
68
- args[0] = this._getScopeType(args[0])
69
- }
70
- this.emitter.off(...args)
71
- }
72
- clear() {
73
- this.offAll()
74
- }
75
-
76
- public emit<R = any>(type: Types, payload?: Events[Types], retain?: boolean): R[]
77
- public emit<R = any>(type: string, payload?: any, retain?: boolean): R[]
78
- public emit<R = any>(): R[] {
79
- const type = arguments[0] as string
80
- const payload = arguments[1]
81
- const retain = arguments[2] as boolean
82
- return this.emitter.emit(this._getScopeType(type)!, payload, retain)
83
- }
84
- public async waitFor<T extends Types, P = Events[T], M = Meta>(type: T, timeout?: number): Promise<FastEventMessage<T, P, M>>
85
- public async waitFor<T extends string, P = Events[T], M = Meta>(type: string, timeout?: number): Promise<FastEventMessage<T, P, M>>
86
- public async waitFor<T extends string, P = Events[T], M = Meta>(): Promise<FastEventMessage<T, P, M>> {
87
- const type = arguments[0] as string
88
- const timeout = arguments[1] as number
89
- const message = await this.emitter.waitFor(this._getScopeType(type)!, timeout)
90
- const scopeMessage = Object.assign({}, message, {
91
- type: this._fixScopeType(message.type)
92
- })
93
- return scopeMessage as unknown as FastEventMessage<T, P, M>
94
- }
95
- /**
96
- * 创建一个新的作用域实例
97
- * @param prefix - 作用域前缀
98
- * @returns 新的FastEventScope实例
99
- *
100
- * @description
101
- * 基于当前作用域创建一个新的子作用域。新作用域会继承当前作用域的所有特性,
102
- * 并在事件类型前添加额外的前缀。这允许创建层级化的事件命名空间。
103
- *
104
- * 作用域的特性:
105
- * - 自动为所有事件类型添加前缀
106
- * - 在触发事件时自动添加前缀
107
- * - 在接收事件时自动移除前缀
108
- * - 支持多层级的作用域嵌套
109
- *
110
- * @example
111
- * ```ts
112
- * const emitter = new FastEvent();
113
- * const userScope = emitter.scope('user');
114
- * const profileScope = userScope.scope('profile');
115
- *
116
- * // 在profileScope中监听'update'事件
117
- * // 实际监听的是'user/profile/update'
118
- * profileScope.on('update', (data) => {
119
- * console.log('Profile updated:', data);
120
- * });
121
- *
122
- * // 在profileScope中触发'update'事件
123
- * // 实际触发的是'user/profile/update'
124
- * profileScope.emit('update', { name: 'John' });
125
- * ```
126
- */
127
- public scope(prefix: string) {
128
- return this.emitter.scope(this._getScopeType(prefix)!)
129
- }
130
- }
package/src/types.ts DELETED
@@ -1,66 +0,0 @@
1
-
2
-
3
-
4
- export interface FastEventMessage<T = string, P = any, M = unknown> {
5
- type: T
6
- payload: P
7
- meta: M
8
- }
9
-
10
-
11
- export type FastEventListener<
12
- T = string,
13
- P = any,
14
- M = unknown,
15
- C = any
16
- > = (this: C, message: FastEventMessage<T, P, M>) => any | Promise<any>
17
-
18
- export type FastListenerNode = {
19
- __listeners: (FastEventListener<any, any, any> | [FastEventListener<any, any>, number])[];
20
- } & {
21
- [key: string]: FastListenerNode
22
- }
23
-
24
- export type FastEventSubscriber = {
25
- off: () => void
26
- }
27
-
28
-
29
- export type FastListeners = FastListenerNode
30
-
31
- export type FastEventOptions<M = Record<string, any>> = {
32
- id?: string
33
- debug?: boolean
34
- // 事件分隔符
35
- delimiter?: string
36
- // 侦听器函数执行上下文
37
- context?: any
38
- // 当执行侦听器函数出错时是否忽略,默认true
39
- ignoreErrors?: boolean
40
- // 当侦听器函数执行出错时的回调,用于诊断时使用,可以打印错误信息
41
- onListenerError?: ((type: string, error: Error) => void)
42
- // 额外的全局元数据,当触发事件时传递给侦听器
43
- meta?: M
44
- // 当创建新侦听器时回调
45
- onAddListener?: (type: string[], listener: FastEventListener) => void
46
- // 当移除侦听器时回调
47
- onRemoveListener?: (type: string[], listener: FastEventListener) => void
48
- // 当清空侦听器时回调
49
- onClearListeners?: () => void
50
- // 当执行侦听器后时回调
51
- onExecuteListener?: (message: FastEventMessage, returns: any[], listeners: (FastEventListener<any, any, any> | [FastEventListener<any, any>, number])[]) => void
52
- }
53
-
54
-
55
- export type FastEvents = Record<string, any>
56
-
57
- export type ScopeEvents<T extends Record<string, any>, Prefix extends string> = {
58
- [K in keyof T as K extends `${Prefix}/${infer Rest}` ? Rest : never]: T[K];
59
- };
60
-
61
- export type FastEventListenOptions = {
62
- // 侦听执行次数,当为1时为单次侦听,为0时为永久侦听,其他值为执行次数,每执行一次减一,减到0时移除侦听器
63
- count?: number
64
- // 将侦听器添加到侦听器列表的头部
65
- prepend?: boolean
66
- }
@@ -1,64 +0,0 @@
1
- /**
2
- * 一个基于弱引用(WeakRef)的键值映射集合
3
- *
4
- * @template T - 值的类型,必须是对象类型(继承自 `object`)
5
- *
6
- * @example
7
- * const map = new WeakObjectMap<MyObject>();
8
- * map.set('key1', obj1);
9
- * const retrieved = map.get('key1'); // 返回 obj1 或 undefined(如果已被垃圾回收)
10
- */
11
- export class WeakObjectMap<T extends object> {
12
- private map: Map<string, WeakRef<T>>;
13
- private finalizationRegistry: FinalizationRegistry<string>;
14
-
15
- /**
16
- * 构造一个新的 WeakObjectMap 实例
17
- */
18
- constructor() {
19
- this.map = new Map();
20
- this.finalizationRegistry = new FinalizationRegistry((key) => {
21
- this.map.delete(key);
22
- });
23
- }
24
-
25
- /**
26
- * 设置键值对
27
- * @param key - 字符串键名
28
- * @param value - 要存储的对象值(会被自动包装为弱引用)
29
- */
30
- set(key: string, value: T): void {
31
- const weakRef = new WeakRef(value);
32
- this.map.set(key, weakRef);
33
- this.finalizationRegistry.register(value, key);
34
- }
35
-
36
- /**
37
- * 获取指定键对应的值
38
- * @param key - 要查找的键名
39
- * @returns 如果值存在且未被垃圾回收则返回值,否则返回 undefined
40
- */
41
- get(key: string): T | undefined {
42
- const weakRef = this.map.get(key);
43
- return weakRef ? weakRef.deref() : undefined;
44
- }
45
-
46
- /**
47
- * 删除指定键的映射
48
- * @param key - 要删除的键名
49
- * @returns 如果键存在并已删除则返回 true,否则返回 false
50
- */
51
- delete(key: string): boolean {
52
- return this.map.delete(key);
53
- }
54
-
55
- /**
56
- * 检查是否存在指定键的映射(且值未被垃圾回收)
57
- * @param key - 要检查的键名
58
- * @returns 如果键存在且值未被回收则返回 true,否则返回 false
59
- */
60
- has(key: string): boolean {
61
- const weakRef = this.map.get(key);
62
- return weakRef ? weakRef.deref() !== undefined : false;
63
- }
64
- }
@@ -1,40 +0,0 @@
1
-
2
- /**
3
- *
4
- * 判断path是否与pattern匹配
5
- *
6
- * isPathMatched("a.b.c","a.b.c") == true
7
- * isPathMatched("a.b.c","a.b.*") == true
8
- * isPathMatched("a.b.c","a.*.*") == true
9
- * isPathMatched("a.b.c","*.*.*") == true
10
- * isPathMatched("a.b.c",".b.*") == true
11
- * isPathMatched("a.b.c.d","a.**") == true
12
- *
13
- * - '**' 匹配后续的
14
- * - '*' 匹配任意数量的字符,包括零个字符
15
- *
16
- * @param path
17
- * @param pattern
18
- */
19
- export function isPathMatched(path:string[],pattern:string[]):boolean{
20
- if(path.length !== pattern.length && (path.length>0 && pattern[pattern.length-1]!=='**') ){
21
- return false;
22
- }
23
- let fPattern = [...pattern]
24
- if(pattern.length >0 && pattern[pattern.length-1] === '**'){
25
- fPattern.splice(pattern.length-1,1,...Array.from<string>({
26
- length: path.length-pattern.length+1
27
- }).fill('*'))
28
- }
29
- for(let i=0;i<path.length;i++){
30
- if(fPattern[i]==='*'){
31
- continue
32
- }
33
- if(fPattern[i]!==path[i]){
34
- return false
35
- }
36
- }
37
- return true
38
- }
39
-
40
-
@@ -1,16 +0,0 @@
1
-
2
-
3
- export function removeItem(arr:any[],condition:(item:any)=>boolean){
4
- let index:number[] = []
5
- while (true) {
6
- const i = arr.findIndex((item)=>{
7
- return condition(item)
8
- })
9
- if(i === -1) {
10
- index.push(i)
11
- break
12
- }
13
- arr.splice(i,1)
14
- }
15
- return index
16
- }
package/tsconfig.json DELETED
@@ -1,104 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
4
- /* Projects */
5
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
6
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
7
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
8
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
9
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
10
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
11
- /* Language and Environment */
12
- "target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
13
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
14
- // "jsx": "preserve", /* Specify what JSX code is generated. */
15
- "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
16
- "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
17
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
18
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
19
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
20
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
21
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
22
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
23
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
24
- /* Modules */
25
- "module": "ES2022", /* Specify what module code is generated. */
26
- // "rootDir": "./", /* Specify the root folder within your source files. */
27
- "moduleResolution": "Bundler", /* Specify how TypeScript looks up a file from a given module specifier. */
28
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
29
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
30
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
31
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
32
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
33
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
34
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
35
- // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
36
- // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
37
- // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
38
- // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
39
- // "resolveJsonModule": true, /* Enable importing .json files. */
40
- // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
41
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
42
- /* JavaScript Support */
43
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
44
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
45
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
46
- /* Emit */
47
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
48
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
49
- "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
50
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
51
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
52
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
53
- // "outDir": "./", /* Specify an output folder for all emitted files. */
54
- // "removeComments": true, /* Disable emitting comments. */
55
- // "noEmit": true, /* Disable emitting files from a compilation. */
56
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
57
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
58
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
59
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
60
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
61
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
62
- // "newLine": "crlf", /* Set the newline character for emitting files. */
63
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
64
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
65
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
66
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
67
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
68
- /* Interop Constraints */
69
- "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
70
- // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
71
- // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
72
- "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
73
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
74
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
75
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
76
- /* Type Checking */
77
- "strict": true, /* Enable all strict type-checking options. */
78
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
79
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
80
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
81
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
82
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
83
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
84
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
85
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
86
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
87
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
88
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
89
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
90
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
91
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
92
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
93
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
94
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
95
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
96
- /* Completeness */
97
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
98
- "skipLibCheck": true, /* Skip type checking all .d.ts files. */
99
- },
100
- "ts-node": {
101
- // Tell ts-node CLI to install the --loader automatically, explained below
102
- "esm": true
103
- }
104
- }
package/tsup.config.ts DELETED
@@ -1,30 +0,0 @@
1
- import { defineConfig } from 'tsup'
2
- // import copy from "esbuild-copy-files-plugin";
3
-
4
-
5
- export default defineConfig([
6
- {
7
- entry: [
8
- 'src/index.ts'
9
- ],
10
- format: ['esm', 'cjs'],
11
- dts: true,
12
- splitting: true,
13
- sourcemap: true,
14
- clean: true,
15
- treeshake: true,
16
- minify: true
17
- }, {
18
- entry: [
19
- 'src/devTools.ts'
20
- ],
21
- format: ['esm', 'cjs'],
22
- dts: true,
23
- splitting: false,
24
- sourcemap: true,
25
- noExternal: ['redux'],
26
- clean: true,
27
- treeshake: true,
28
- minify: true
29
- }]
30
- )