valdres 0.2.0-alpha.57 → 0.2.0-alpha.59

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.
package/dist/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ // src/index.ts
2
+ import { version } from "../package.json";
3
+
1
4
  // src/lib/equal.ts
2
5
  var hasElementType = typeof Element !== "undefined";
3
6
  var hasMap = typeof Map === "function";
@@ -774,15 +777,8 @@ var store = (id) => {
774
777
  const data = createStoreData(id);
775
778
  return storeFromStoreData(data);
776
779
  };
777
- // package.json
778
- var version = "0.2.0-alpha.56";
779
780
 
780
781
  // src/globalStore.ts
781
- if (globalThis.__valdres__) {
782
- throw new Error(`Error! An instance of valdres is already loaded`);
783
- } else {
784
- globalThis.__valdres__ = version;
785
- }
786
782
  var globalStore = Object.assign(store("valdres-global-store"), {
787
783
  atoms: new Map,
788
784
  atomFamilies: new Map
@@ -1050,6 +1046,13 @@ var selectorFamily = (get, options) => {
1050
1046
  };
1051
1047
  // src/utils/isFamilySelector.ts
1052
1048
  var isFamilySelector = (state) => isFamilyState(state) && isSelector(state);
1049
+
1050
+ // src/index.ts
1051
+ if (globalThis.__valdres__) {
1052
+ throw new Error(`Error! An instance of valdres is already loaded. Loaded: ${globalThis.__valdres__}. Attempted to load: ${version}`);
1053
+ } else {
1054
+ globalThis.__valdres__ = version;
1055
+ }
1053
1056
  export {
1054
1057
  store,
1055
1058
  selectorFamily,
@@ -1,4 +1,4 @@
1
1
  import type { AtomOptions } from "./types/AtomOptions";
2
2
  import type { FamilyKey } from "./types/FamilyKey";
3
3
  import type { AtomFamilyDefaultValue } from "./types/AtomFamilyDefaultValue";
4
- export declare function atomFamily<Key = FamilyKey, Value = unknown>(defaultValue?: AtomFamilyDefaultValue<Key, Value>, options?: AtomOptions<Value>): import("..").AtomFamily<Key, Value>;
4
+ export declare function atomFamily<Key = FamilyKey, Value = unknown>(defaultValue?: AtomFamilyDefaultValue<Key, Value>, options?: AtomOptions<Value>): import(".").AtomFamily<Key, Value>;
@@ -1,4 +1,4 @@
1
- export declare const globalStore: import("..").Store & {
1
+ export declare const globalStore: import(".").Store & {
2
2
  atoms: Map<any, any>;
3
3
  atomFamilies: Map<any, any>;
4
4
  };
@@ -0,0 +1,34 @@
1
+ declare global {
2
+ var __valdres__: string;
3
+ }
4
+ export { atom } from "./atom";
5
+ export { atomFamily } from "./atomFamily";
6
+ export { createStoreWithSelectorSet } from "./createStoreWithSelectorSet";
7
+ export { globalStore } from "./globalStore";
8
+ export { selector } from "./selector";
9
+ export { selectorFamily } from "./selectorFamily";
10
+ export { store } from "./store";
11
+ export { isAtom } from "./utils/isAtom";
12
+ export { isAtomFamily } from "./utils/isAtomFamily";
13
+ export { isFamily } from "./utils/isFamily";
14
+ export { isFamilyAtom } from "./utils/isFamilyAtom";
15
+ export { isFamilySelector } from "./utils/isFamilySelector";
16
+ export { isFamilyState } from "./utils/isFamilyState";
17
+ export { isPromiseLike } from "./utils/isPromiseLike";
18
+ export { isSelector } from "./utils/isSelector";
19
+ export { isSelectorFamily } from "./utils/isSelectorFamily";
20
+ export type { Atom } from "./types/Atom";
21
+ export type { AtomFamily } from "./types/AtomFamily";
22
+ export type { FamilyKey } from "./types/FamilyKey";
23
+ export type { GetValue } from "./types/GetValue";
24
+ export type { GlobalAtom } from "./types/GlobalAtom";
25
+ export type { ResetAtom } from "./types/ResetAtom";
26
+ export type { Selector } from "./types/Selector";
27
+ export type { SelectorFamily } from "./types/SelectorFamily";
28
+ export type { SetAtom } from "./types/SetAtom";
29
+ export type { SetAtomValue } from "./types/SetAtomValue";
30
+ export type { State } from "./types/State";
31
+ export type { Store } from "./types/Store";
32
+ export type { StoreData } from "./types/StoreData";
33
+ export type { TransactionFn } from "./types/TransactionFn";
34
+ export type { TransactionInterface } from "./types/TransactionInterface";
@@ -1 +1 @@
1
- export declare const store: (id?: string) => import("..").Store;
1
+ export declare const store: (id?: string) => import(".").Store;
@@ -1 +1 @@
1
- export declare const isFamily: (state: any) => state is import("../..").SelectorFamily<unknown, unknown> | import("../..").AtomFamily<unknown, unknown>;
1
+ export declare const isFamily: (state: any) => state is import("..").SelectorFamily<unknown, unknown> | import("..").AtomFamily<unknown, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valdres",
3
- "version": "0.2.0-alpha.57",
3
+ "version": "0.2.0-alpha.59",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Eigil Sagafos"
@@ -13,13 +13,13 @@
13
13
  "type": "module",
14
14
  "exports": {
15
15
  "default": "./dist/index.js",
16
- "types": "./dist/types/index.d.ts"
16
+ "types": "./dist/types/src/index.d.ts"
17
17
  },
18
18
  "files": [
19
19
  "dist"
20
20
  ],
21
21
  "scripts": {
22
- "build": "NODE_ENV=production bun build index.ts --outdir ./dist --packages external",
22
+ "build": "NODE_ENV=production bun run build.ts",
23
23
  "build:types": "rm -rf dist/types && bun run tsc",
24
24
  "test": "bun test"
25
25
  },
@@ -36,5 +36,5 @@
36
36
  "access": "public",
37
37
  "registry": "https://registry.npmjs.org/"
38
38
  },
39
- "gitHead": "ac804793bb3c428a50d3f2baf46d18a7dfeefee3"
39
+ "gitHead": "7e66391e22da3c056ade60b1f735238fbc25a9d3"
40
40
  }
@@ -1,31 +0,0 @@
1
- export { atom } from "./src/atom";
2
- export { atomFamily } from "./src/atomFamily";
3
- export { createStoreWithSelectorSet } from "./src/createStoreWithSelectorSet";
4
- export { globalStore } from "./src/globalStore";
5
- export { selector } from "./src/selector";
6
- export { selectorFamily } from "./src/selectorFamily";
7
- export { store } from "./src/store";
8
- export { isAtom } from "./src/utils/isAtom";
9
- export { isAtomFamily } from "./src/utils/isAtomFamily";
10
- export { isFamily } from "./src/utils/isFamily";
11
- export { isFamilyAtom } from "./src/utils/isFamilyAtom";
12
- export { isFamilySelector } from "./src/utils/isFamilySelector";
13
- export { isFamilyState } from "./src/utils/isFamilyState";
14
- export { isPromiseLike } from "./src/utils/isPromiseLike";
15
- export { isSelector } from "./src/utils/isSelector";
16
- export { isSelectorFamily } from "./src/utils/isSelectorFamily";
17
- export type { Atom } from "./src/types/Atom";
18
- export type { AtomFamily } from "./src/types/AtomFamily";
19
- export type { FamilyKey } from "./src/types/FamilyKey";
20
- export type { GetValue } from "./src/types/GetValue";
21
- export type { GlobalAtom } from "./src/types/GlobalAtom";
22
- export type { ResetAtom } from "./src/types/ResetAtom";
23
- export type { Selector } from "./src/types/Selector";
24
- export type { SelectorFamily } from "./src/types/SelectorFamily";
25
- export type { SetAtom } from "./src/types/SetAtom";
26
- export type { SetAtomValue } from "./src/types/SetAtomValue";
27
- export type { State } from "./src/types/State";
28
- export type { Store } from "./src/types/Store";
29
- export type { StoreData } from "./src/types/StoreData";
30
- export type { TransactionFn } from "./src/types/TransactionFn";
31
- export type { TransactionInterface } from "./src/types/TransactionInterface";