@artisan-commerce/state 0.3.0-canary.0 → 0.3.0-canary.10

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.
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ let state = null;
22
+ const initState = (initialState) => {
23
+ Object.freeze(initialState);
24
+ state = __spreadValues({}, initialState);
25
+ Object.seal(state);
26
+ };
27
+ const setState = (overrides) => {
28
+ const tempState = state ? __spreadValues({}, state) : {};
29
+ state = null;
30
+ state = __spreadValues(__spreadValues({}, tempState), overrides);
31
+ Object.seal(state);
32
+ };
33
+ const getState = () => {
34
+ if (state === null) {
35
+ throw new Error("The state has not been initialized, make sure to call initState beforehand");
36
+ }
37
+ return __spreadValues({}, state);
38
+ };
39
+ const checkInit = () => {
40
+ return !!state;
41
+ };
42
+
43
+ exports.checkInit = checkInit;
44
+ exports.getState = getState;
45
+ exports.initState = initState;
46
+ exports.setState = setState;
47
+ //# sourceMappingURL=bundle.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.cjs.js","sources":["../src/lib/state.ts"],"sourcesContent":["// Common functions and data\n\n/**\n * @since 0.1.0\n * @typedef State\n */\ntype State = Record<string, any>;\n\n/**\n * Global state.\n * @since 0.1.0\n */\nlet state: State | null = null;\n\n/**\n * Initializes the global state.\n *\n * @since 0.1.0\n * @param {T} initialState Initial global state\n */\nexport const initState = <T extends State>(initialState: T) => {\n Object.freeze(initialState);\n state = { ...initialState } as T;\n Object.seal(state);\n};\n\n/**\n * Updates the global state.\n *\n * @since 0.1.0\n * @param {T} overrides Global state overrides\n */\nexport const setState = <T extends State>(overrides: Partial<T>) => {\n const tempState = state ? { ...state } : {};\n state = null;\n state = { ...tempState, ...overrides } as T;\n Object.seal(state);\n};\n\n/**\n * Returns the global state.\n *\n * @since 0.1.0\n * @returns {T} The global state\n */\nexport const getState = <T extends State>() => {\n if (state === null) {\n throw new Error(\n \"The state has not been initialized, make sure to call initState beforehand\"\n );\n }\n return { ...state } as T;\n};\n\n/**\n * Returns whether the state has been initialized.\n *\n * @since 0.1.0\n * @returns {boolean} Whether the state has been initialized\n */\nexport const checkInit = () => {\n return !!state;\n};\n"],"names":[],"mappings":";;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,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AAClG,GAAG;AACH,EAAE,OAAO,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACnC,EAAE;AACU,MAAC,SAAS,GAAG,MAAM;AAC/B,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC;AACjB;;;;;;;"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @since 0.1.0
3
+ * @typedef State
4
+ */
5
+ declare type State = Record<string, any>;
6
+ /**
7
+ * Initializes the global state.
8
+ *
9
+ * @since 0.1.0
10
+ * @param {T} initialState Initial global state
11
+ */
12
+ declare const initState: <T extends State>(initialState: T) => void;
13
+ /**
14
+ * Updates the global state.
15
+ *
16
+ * @since 0.1.0
17
+ * @param {T} overrides Global state overrides
18
+ */
19
+ declare const setState: <T extends State>(overrides: Partial<T>) => void;
20
+ /**
21
+ * Returns the global state.
22
+ *
23
+ * @since 0.1.0
24
+ * @returns {T} The global state
25
+ */
26
+ declare const getState: <T extends State>() => T;
27
+ /**
28
+ * Returns whether the state has been initialized.
29
+ *
30
+ * @since 0.1.0
31
+ * @returns {boolean} Whether the state has been initialized
32
+ */
33
+ declare const checkInit: () => boolean;
34
+
35
+ export { checkInit, getState, initState, setState };
@@ -0,0 +1,40 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ let state = null;
18
+ const initState = (initialState) => {
19
+ Object.freeze(initialState);
20
+ state = __spreadValues({}, initialState);
21
+ Object.seal(state);
22
+ };
23
+ const setState = (overrides) => {
24
+ const tempState = state ? __spreadValues({}, state) : {};
25
+ state = null;
26
+ state = __spreadValues(__spreadValues({}, tempState), overrides);
27
+ Object.seal(state);
28
+ };
29
+ const getState = () => {
30
+ if (state === null) {
31
+ throw new Error("The state has not been initialized, make sure to call initState beforehand");
32
+ }
33
+ return __spreadValues({}, state);
34
+ };
35
+ const checkInit = () => {
36
+ return !!state;
37
+ };
38
+
39
+ export { checkInit, getState, initState, setState };
40
+ //# sourceMappingURL=bundle.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.esm.js","sources":["../src/lib/state.ts"],"sourcesContent":["// Common functions and data\n\n/**\n * @since 0.1.0\n * @typedef State\n */\ntype State = Record<string, any>;\n\n/**\n * Global state.\n * @since 0.1.0\n */\nlet state: State | null = null;\n\n/**\n * Initializes the global state.\n *\n * @since 0.1.0\n * @param {T} initialState Initial global state\n */\nexport const initState = <T extends State>(initialState: T) => {\n Object.freeze(initialState);\n state = { ...initialState } as T;\n Object.seal(state);\n};\n\n/**\n * Updates the global state.\n *\n * @since 0.1.0\n * @param {T} overrides Global state overrides\n */\nexport const setState = <T extends State>(overrides: Partial<T>) => {\n const tempState = state ? { ...state } : {};\n state = null;\n state = { ...tempState, ...overrides } as T;\n Object.seal(state);\n};\n\n/**\n * Returns the global state.\n *\n * @since 0.1.0\n * @returns {T} The global state\n */\nexport const getState = <T extends State>() => {\n if (state === null) {\n throw new Error(\n \"The state has not been initialized, make sure to call initState beforehand\"\n );\n }\n return { ...state } as T;\n};\n\n/**\n * Returns whether the state has been initialized.\n *\n * @since 0.1.0\n * @returns {boolean} Whether the state has been initialized\n */\nexport const checkInit = () => {\n return !!state;\n};\n"],"names":[],"mappings":"AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAA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KAAK,CAAC,CAAC;AACrB,EAAE;AACU,MAAC,QAAQ,GAAG,CAAC,SAAS,KAAK;AACvC,EAAE,MAAM,SAAS,GAAG,KAAK,GAAG,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;AAC3D,EAAE,KAAK,GAAG,IAAI,CAAC;AACf,EAAE,KAAK,GAAG,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;AACnE,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,EAAE;AACU,MAAC,QAAQ,GAAG,MAAM;AAC9B,EAAE,IAAI,KAAK,KAAK,IAAI,EAAE;AACtB,IAAI,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;AAClG,GAAG;AACH,EAAE,OAAO,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACnC,EAAE;AACU,MAAC,SAAS,GAAG,MAAM;AAC/B,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC;AACjB;;;;"}
@@ -0,0 +1,53 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ArtisnState = {}));
5
+ })(this, (function (exports) { 'use strict';
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ let state = null;
24
+ const initState = (initialState) => {
25
+ Object.freeze(initialState);
26
+ state = __spreadValues({}, initialState);
27
+ Object.seal(state);
28
+ };
29
+ const setState = (overrides) => {
30
+ const tempState = state ? __spreadValues({}, state) : {};
31
+ state = null;
32
+ state = __spreadValues(__spreadValues({}, tempState), overrides);
33
+ Object.seal(state);
34
+ };
35
+ const getState = () => {
36
+ if (state === null) {
37
+ throw new Error("The state has not been initialized, make sure to call initState beforehand");
38
+ }
39
+ return __spreadValues({}, state);
40
+ };
41
+ const checkInit = () => {
42
+ return !!state;
43
+ };
44
+
45
+ exports.checkInit = checkInit;
46
+ exports.getState = getState;
47
+ exports.initState = initState;
48
+ exports.setState = setState;
49
+
50
+ Object.defineProperty(exports, '__esModule', { value: true });
51
+
52
+ }));
53
+ //# sourceMappingURL=bundle.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.umd.js","sources":["../src/lib/state.ts"],"sourcesContent":["// Common functions and data\n\n/**\n * @since 0.1.0\n * @typedef State\n */\ntype State = Record<string, any>;\n\n/**\n * Global state.\n * @since 0.1.0\n */\nlet state: State | null = null;\n\n/**\n * Initializes the global state.\n *\n * @since 0.1.0\n * @param {T} initialState Initial global state\n */\nexport const initState = <T extends State>(initialState: T) => {\n Object.freeze(initialState);\n state = { ...initialState } as T;\n Object.seal(state);\n};\n\n/**\n * Updates the global state.\n *\n * @since 0.1.0\n * @param {T} overrides Global state overrides\n */\nexport const setState = <T extends State>(overrides: Partial<T>) => {\n const tempState = state ? { ...state } : {};\n state = null;\n state = { ...tempState, ...overrides } as T;\n Object.seal(state);\n};\n\n/**\n * Returns the global state.\n *\n * @since 0.1.0\n * @returns {T} The global state\n */\nexport const getState = <T extends State>() => {\n if (state === null) {\n throw new Error(\n \"The state has not been initialized, make sure to call initState beforehand\"\n );\n }\n return { ...state } as T;\n};\n\n/**\n * Returns whether the state has been initialized.\n *\n * @since 0.1.0\n * @returns {boolean} Whether the state has been initialized\n */\nexport const checkInit = () => {\n return !!state;\n};\n"],"names":[],"mappings":";;;;;;EAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;EACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;EACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;EACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;EACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;EAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;EAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;EAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;EAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;EACxC,EAAE,IAAI,mBAAmB;EACzB,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;EAC7C,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;EACpC,QAAQ,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;EAC1C,KAAK;EACL,EAAE,OAAO,CAAC,CAAC;EACX,CAAC,CAAC;EACF,IAAI,KAAK,GAAG,IAAI,CAAC;AACL,QAAC,SAAS,GAAG,CAAC,YAAY,KAAK;EAC3C,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;EAC9B,EAAE,KAAK,GAAG,cAAc,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;EAC3C,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EACrB,EAAE;AACU,QAAC,QAAQ,GAAG,CAAC,SAAS,KAAK;EACvC,EAAE,MAAM,SAAS,GAAG,KAAK,GAAG,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;EAC3D,EAAE,KAAK,GAAG,IAAI,CAAC;EACf,EAAE,KAAK,GAAG,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;EACnE,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EACrB,EAAE;AACU,QAAC,QAAQ,GAAG,MAAM;EAC9B,EAAE,IAAI,KAAK,KAAK,IAAI,EAAE;EACtB,IAAI,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;EAClG,GAAG;EACH,EAAE,OAAO,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;EACnC,EAAE;AACU,QAAC,SAAS,GAAG,MAAM;EAC/B,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC;EACjB;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@artisan-commerce/state",
3
3
  "description": "Library used to share state functionality",
4
- "version": "0.3.0-canary.0",
5
- "main": "./build/main.bundle.js",
6
- "types": "./build/index.d.ts",
4
+ "version": "0.3.0-canary.10",
5
+ "main": "./dist/bundle.cjs.js",
6
+ "module": "./dist/bundle.esm.js",
7
+ "types": "./dist/bundle.d.ts",
7
8
  "files": [
8
- "build/",
9
- "LICENSE",
10
- "README.md"
9
+ "dist"
11
10
  ],
11
+ "sideEffects": false,
12
12
  "scripts": {
13
- "compile": "webpack --config webpack.dev.js",
14
- "dev": "yarn compile",
15
- "build": "webpack --config webpack.prod.js",
16
- "compile:build": "nodemon ./build/main.bundle.js",
13
+ "compile": "rollup -c",
14
+ "dev": "yarn compile -w",
15
+ "clean": "rimraf dist",
16
+ "prebuild": "yarn clean",
17
+ "build": "yarn compile",
17
18
  "test": "jest --watchAll --runInBand",
18
19
  "test:all": "yarn test --watchAll=false --coverage",
19
20
  "test:ci": "cross-env CI=true jest --runInBand",
@@ -29,46 +30,27 @@
29
30
  },
30
31
  "author": "Santiago Benítez",
31
32
  "license": "MIT",
33
+ "nx": {
34
+ "targets": {
35
+ "build": {
36
+ "outputs": [
37
+ "./dist"
38
+ ]
39
+ },
40
+ "compile": {
41
+ "outputs": [
42
+ "./dist"
43
+ ]
44
+ },
45
+ "test:all": {
46
+ "outputs": [
47
+ "./coverage"
48
+ ]
49
+ }
50
+ }
51
+ },
32
52
  "devDependencies": {
33
- "@babel/core": "^7.10.5",
34
- "@babel/preset-env": "^7.10.4",
35
- "@babel/preset-react": "^7.10.4",
36
- "@types/faker": "^4.1.12",
37
- "@types/jest": "^26.0.5",
38
- "@types/jest-in-case": "^1.0.2",
39
- "@types/node": "^14.0.24",
40
- "@typescript-eslint/eslint-plugin": "^3.7.0",
41
- "@typescript-eslint/parser": "^3.7.0",
42
- "avn": "^0.2.4",
43
- "avn-nvm": "^0.2.2",
44
- "clean-webpack-plugin": "^3.0.0",
45
- "dotenv-webpack": "^2.0.0",
46
- "env-cmd": "^10.1.0",
47
- "eslint": "^7.5.0",
48
- "eslint-config-prettier": "^6.11.0",
49
- "eslint-config-react-app": "^5.2.1",
50
- "eslint-config-universe": "^4.0.0",
51
- "eslint-plugin-cypress": "^2.11.1",
52
- "eslint-plugin-flowtype": "^5.2.0",
53
- "eslint-plugin-import": "^2.22.0",
54
- "eslint-plugin-jsx-a11y": "^6.3.1",
55
- "eslint-plugin-react": "^7.20.3",
56
- "eslint-plugin-react-hooks": "^4.0.8",
57
- "is-ci-cli": "^2.1.2",
58
- "jest-axe": "^3.5.0",
59
- "jest-in-case": "^1.0.2",
60
- "jest-styled-components": "^7.0.2",
61
- "nodemon": "^2.0.4",
62
- "npm-run-all": "^4.1.5",
63
- "prettier": "^2.2.1",
64
- "start-server-and-test": "^1.11.2",
65
- "test-data-bot": "^0.8.0",
66
- "ts-jest": "^26.1.4",
67
- "ts-loader": "^8.0.2",
68
- "webpack": "^4.43.0",
69
- "webpack-cli": "^3.3.12",
70
- "webpack-dev-server": "^3.11.0",
71
- "webpack-merge": "^5.0.9"
53
+ "@artisan-commerce/types": "0.14.0-canary.39"
72
54
  },
73
- "gitHead": "61cd421cf586b967fe48a7502e1f3841c0877f0e"
55
+ "gitHead": "0181e85a77db03d68cd7be1c1c85cc1488f14da7"
74
56
  }
package/CHANGELOG.md DELETED
@@ -1,166 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [0.3.0-canary.0](https://bitbucket.org/tradesystem/artisn_sdk/compare/@artisan-commerce/state@0.2.2...@artisan-commerce/state@0.3.0-canary.0) (2021-08-11)
7
-
8
-
9
- ### Features
10
-
11
- * **global:** rebrand artisan-commerce to artisn ([b2688b1](https://bitbucket.org/tradesystem/artisn_sdk/commit/b2688b107757ed82791c0be49439e9fb28f78b6d))
12
-
13
-
14
-
15
- ### [0.2.2](https://bitbucket.org/tradesystem/artisan_sdk/compare/@artisan-commerce/state@0.2.2-canary.4...@artisan-commerce/state@0.2.2) (2021-07-30)
16
-
17
- **Note:** Version bump only for package @artisan-commerce/state
18
-
19
-
20
-
21
-
22
-
23
- ### [0.2.2-canary.4](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.2-canary.3...@artisan-commerce/state@0.2.2-canary.4) (2021-04-27)
24
-
25
-
26
- ### Bug Fixes
27
-
28
- * **global:** fix updateActiveVendor utility function and state lib ([e5d9c52](https://bitbucket.org/tradesystem/artisan_monorepo/commit/e5d9c52455929782ada1762b03abb3363efe88cf))
29
-
30
-
31
-
32
- ### [0.2.2-canary.3](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.2-canary.2...@artisan-commerce/state@0.2.2-canary.3) (2021-04-16)
33
-
34
- **Note:** Version bump only for package @artisan-commerce/state
35
-
36
-
37
-
38
-
39
-
40
- ### [0.2.2-canary.2](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.2-canary.1...@artisan-commerce/state@0.2.2-canary.2) (2021-04-06)
41
-
42
-
43
- ### Performance Improvements
44
-
45
- * **global:** move typescript to be a global dependency ([32370e1](https://bitbucket.org/tradesystem/artisan_monorepo/commit/32370e134f1bcc4f79c55e2bae0ee22fee193e77))
46
-
47
-
48
-
49
- ### [0.2.2-canary.1](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.2-canary.0...@artisan-commerce/state@0.2.2-canary.1) (2021-03-30)
50
-
51
-
52
- ### Performance Improvements
53
-
54
- * **global:** add esbuild opt-in for dev ([f760449](https://bitbucket.org/tradesystem/artisan_monorepo/commit/f7604492fc17967bad75583a49d91a51cd6241aa))
55
- * **global:** improve jest performance ([8c36173](https://bitbucket.org/tradesystem/artisan_monorepo/commit/8c36173df7e7cbfad40888499c81fcf7d11a7105))
56
-
57
-
58
-
59
- ### [0.2.2-canary.0](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.1...@artisan-commerce/state@0.2.2-canary.0) (2021-03-12)
60
-
61
- **Note:** Version bump only for package @artisan-commerce/state
62
-
63
-
64
-
65
-
66
-
67
- ### [0.2.1](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.1-canary.1...@artisan-commerce/state@0.2.1) (2021-03-02)
68
-
69
- **Note:** Version bump only for package @artisan-commerce/state
70
-
71
-
72
-
73
-
74
-
75
- ### [0.2.1-canary.1](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.1-canary.0...@artisan-commerce/state@0.2.1-canary.1) (2021-02-25)
76
-
77
- **Note:** Version bump only for package @artisan-commerce/state
78
-
79
-
80
-
81
-
82
-
83
- ### [0.2.1-canary.0](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.0...@artisan-commerce/state@0.2.1-canary.0) (2021-02-25)
84
-
85
- **Note:** Version bump only for package @artisan-commerce/state
86
-
87
-
88
-
89
-
90
-
91
- ## [0.2.0](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.0-canary.1...@artisan-commerce/state@0.2.0) (2021-02-25)
92
-
93
- **Note:** Version bump only for package @artisan-commerce/state
94
-
95
-
96
-
97
-
98
-
99
- ## [0.2.0-canary.1](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.2.0-canary.0...@artisan-commerce/state@0.2.0-canary.1) (2021-02-25)
100
-
101
- **Note:** Version bump only for package @artisan-commerce/state
102
-
103
-
104
-
105
-
106
-
107
- ## [0.2.0-canary.0](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.6...@artisan-commerce/state@0.2.0-canary.0) (2021-02-25)
108
-
109
-
110
- ### Features
111
-
112
- * added commentaries ([400127f](https://bitbucket.org/tradesystem/artisan_monorepo/commit/400127f878abdafc2236cee866300a765956e0ce))
113
-
114
-
115
-
116
- ### [0.1.1-canary.6](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.5...@artisan-commerce/state@0.1.1-canary.6) (2021-02-23)
117
-
118
- **Note:** Version bump only for package @artisan-commerce/state
119
-
120
-
121
-
122
-
123
-
124
- ### [0.1.1-canary.5](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.4...@artisan-commerce/state@0.1.1-canary.5) (2021-02-04)
125
-
126
- **Note:** Version bump only for package @artisan-commerce/state
127
-
128
-
129
-
130
-
131
-
132
- ### [0.1.1-canary.4](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.3...@artisan-commerce/state@0.1.1-canary.4) (2021-02-04)
133
-
134
- **Note:** Version bump only for package @artisan-commerce/state
135
-
136
-
137
-
138
-
139
-
140
- ### [0.1.1-canary.3](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.2...@artisan-commerce/state@0.1.1-canary.3) (2021-02-04)
141
-
142
- **Note:** Version bump only for package @artisan-commerce/state
143
-
144
-
145
-
146
-
147
-
148
- ### [0.1.1-canary.2](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.1...@artisan-commerce/state@0.1.1-canary.2) (2021-02-04)
149
-
150
- **Note:** Version bump only for package @artisan-commerce/state
151
-
152
-
153
-
154
-
155
-
156
- ### [0.1.1-canary.1](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/state@0.1.1-canary.0...@artisan-commerce/state@0.1.1-canary.1) (2021-02-04)
157
-
158
- **Note:** Version bump only for package @artisan-commerce/state
159
-
160
-
161
-
162
-
163
-
164
- ## 0.1.1-canary.0 (2021-02-03)
165
-
166
- **Note:** Version bump only for package @artisan-commerce/state
@@ -1,2 +0,0 @@
1
- declare const CONSTANTS: {};
2
- export default CONSTANTS;
package/build/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { initState, getState, setState } from "./lib/state";
@@ -1,27 +0,0 @@
1
- /**
2
- * @since 0.1.0
3
- * @typedef State
4
- */
5
- declare type State = Record<string, any>;
6
- /**
7
- * Initializes the global state.
8
- *
9
- * @since 0.1.0
10
- * @param {T} initialState Initial global state
11
- */
12
- export declare const initState: <T extends State>(initialState: T) => void;
13
- /**
14
- * Updates the global state.
15
- *
16
- * @since 0.1.0
17
- * @param {T} overrides Global state overrides
18
- */
19
- export declare const setState: <T extends State>(overrides: Partial<T>) => void;
20
- /**
21
- * Returns the global state.
22
- *
23
- * @since 0.1.0
24
- * @returns {T} The global state
25
- */
26
- export declare const getState: <T extends State>() => T;
27
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("state",[],t):"object"==typeof exports?exports.state=t():e.state=t()}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){"use strict";n.r(t),n.d(t,"initState",(function(){return u})),n.d(t,"getState",(function(){return f})),n.d(t,"setState",(function(){return i}));var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=null,u=function(e){Object.freeze(e),o=r({},e),Object.seal(o)},i=function(e){var t=o?r({},o):{};o=null,o=r(r({},t),e),Object.seal(o)},f=function(){if(null===o)throw new Error("The state has not been initialized, make sure to call initState beforehand");return r({},o)}}])}));
@@ -1 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("state",[],t):"object"==typeof exports?exports.state=t():e.state=t()}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t)}])}));
@@ -1 +0,0 @@
1
- export {};