@openmrs/esm-state 5.3.3-pre.1240 → 5.3.3-pre.1247

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.
@@ -1,9 +1,9 @@
1
- @openmrs/esm-state:build: cache hit, replaying output b33e3e271224fa52
2
- @openmrs/esm-state:build: Browserslist: caniuse-lite is outdated. Please run:
3
- @openmrs/esm-state:build:  npx update-browserslist-db@latest
4
- @openmrs/esm-state:build:  Why you should do it regularly: https://github.com/browserslist/update-db#readme
5
- @openmrs/esm-state:build: asset openmrs-esm-state.js 1.63 KiB [emitted] [minimized] (name: main) 1 related asset
6
- @openmrs/esm-state:build: runtime modules 670 bytes 3 modules
7
- @openmrs/esm-state:build: orphan modules 3.76 KiB [orphan] 2 modules
8
- @openmrs/esm-state:build: ./src/index.ts + 2 modules 3.78 KiB [built] [code generated]
9
- @openmrs/esm-state:build: webpack 5.88.0 compiled successfully in 5699 ms
1
+ @openmrs/esm-state:build: cache hit, replaying output 503996686cc2ec84
2
+ @openmrs/esm-state:build: Browserslist: caniuse-lite is outdated. Please run:
3
+ @openmrs/esm-state:build:  npx update-browserslist-db@latest
4
+ @openmrs/esm-state:build:  Why you should do it regularly: https://github.com/browserslist/update-db#readme
5
+ @openmrs/esm-state:build: asset openmrs-esm-state.js 1.63 KiB [emitted] [minimized] (name: main) 1 related asset
6
+ @openmrs/esm-state:build: runtime modules 670 bytes 3 modules
7
+ @openmrs/esm-state:build: orphan modules 3.76 KiB [orphan] 2 modules
8
+ @openmrs/esm-state:build: ./src/index.ts + 2 modules 3.78 KiB [built] [code generated]
9
+ @openmrs/esm-state:build: webpack 5.88.0 compiled successfully in 5755 ms
@@ -1 +1 @@
1
- {"version":3,"file":"openmrs-esm-state.js","mappings":"iFACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IA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QAAQ,GAGHE,CAEX,CAUO,SAASC,EACdN,EACAO,GAEA,IAAML,EAAYJ,EAAgBE,GAElC,IAAKE,EAAW,CACd,IAAMG,EAAQR,KAAiB,W,OAAMU,QAAAA,EAAkB,CAAC,C,IAKxD,OAJAT,EAAgBE,GAAQ,CACtB3B,MAAOgC,EACPF,QAAQ,GAEHE,CACT,CAEA,OAAOH,EAAU7B,KACnB,CAIO,SAASmC,EACdH,EACAI,EACAC,GAEA,IAAIC,EAAWF,EAAOJ,EAAMjB,YAE5B,OAAOiB,EAAMf,WAAU,SAACd,GACtB,IAAMoC,EAAUH,EAAOjC,GAEnBoC,IAAYD,IACdA,EAAWC,EACXF,EAAOE,GAEX,GACF,C,OAtFAC,YAAW,WACa,gBAAlBC,OAAOC,SACTD,OAAe,OAAIhB,EAEvB,GAAG,K","sources":["webpack://@openmrs/esm-state/webpack/bootstrap","webpack://@openmrs/esm-state/webpack/runtime/define property getters","webpack://@openmrs/esm-state/webpack/runtime/hasOwnProperty shorthand","webpack://@openmrs/esm-state/webpack/runtime/make namespace object","webpack://@openmrs/esm-state/../../../node_modules/zustand/esm/vanilla.mjs","webpack://@openmrs/esm-state/./src/state.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\") ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const destroy = () => {\n if ((import.meta.env && import.meta.env.MODE) !== \"production\") {\n console.warn(\n \"[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.\"\n );\n }\n listeners.clear();\n };\n const api = { setState, getState, subscribe, destroy };\n state = createState(setState, getState, api);\n return api;\n};\nconst createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;\nvar vanilla = (createState) => {\n if ((import.meta.env && import.meta.env.MODE) !== \"production\") {\n console.warn(\n \"[DEPRECATED] Default export is deprecated. Instead use import { createStore } from 'zustand/vanilla'.\"\n );\n }\n return createStore(createState);\n};\n\nexport { createStore, vanilla as default };\n","/** @module @category Store */\nimport { createStore, StoreApi } from \"zustand/vanilla\";\nimport type {} from \"@openmrs/esm-globals\";\n\ninterface StoreEntity {\n value: StoreApi<unknown>;\n active: boolean;\n}\n\nconst availableStores: Record<string, StoreEntity> = {};\n\n// spaEnv isn't available immediately. Wait a bit before making stores available\n// on window in development mode.\nsetTimeout(() => {\n if (window.spaEnv === \"development\") {\n window[\"stores\"] = availableStores;\n }\n}, 1000);\n\n/**\n * Creates a Zustand store.\n *\n * @param name A name by which the store can be looked up later.\n * Must be unique across the entire application.\n * @param initialState An object which will be the initial state of the store.\n * @returns The newly created store.\n */\nexport function createGlobalStore<T>(\n name: string,\n initialState: T\n): StoreApi<T> {\n const available = availableStores[name];\n\n if (available) {\n if (available.active) {\n console.error(\n \"Cannot override an existing store. Make sure that stores are only created once.\"\n );\n } else {\n available.value.setState(initialState, true);\n }\n\n available.active = true;\n return available.value as StoreApi<T>;\n } else {\n const store = createStore<T>()(() => initialState);\n\n availableStores[name] = {\n value: store,\n active: true,\n };\n\n return store;\n }\n}\n\n/**\n * Returns the existing store named `name`,\n * or creates a new store named `name` if none exists.\n *\n * @param name The name of the store to look up.\n * @param fallbackState The initial value of the new store if no store named `name` exists.\n * @returns The found or newly created store.\n */\nexport function getGlobalStore<T>(\n name: string,\n fallbackState?: T\n): StoreApi<T> {\n const available = availableStores[name];\n\n if (!available) {\n const store = createStore<T>()(() => fallbackState ?? ({} as unknown as T));\n availableStores[name] = {\n value: store,\n active: false,\n };\n return store;\n }\n\n return available.value as StoreApi<T>;\n}\n\nexport interface AppState {}\n\nexport function subscribeTo<T, U>(\n store: StoreApi<T>,\n select: (state: T) => U,\n handle: (subState: U) => void\n) {\n let previous = select(store.getState());\n\n return store.subscribe((state) => {\n const current = select(state);\n\n if (current !== previous) {\n previous = current;\n handle(current);\n }\n });\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","createStoreImpl","createState","state","listeners","Set","setState","partial","replace","nextState","is","previousState","assign","forEach","listener","getState","api","subscribe","add","delete","destroy","console","warn","clear","createStore","availableStores","createGlobalStore","name","initialState","available","active","error","store","getGlobalStore","fallbackState","subscribeTo","select","handle","previous","current","setTimeout","window","spaEnv"],"sourceRoot":""}
1
+ {"version":3,"file":"openmrs-esm-state.js","mappings":"iFACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EA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AAQ,GAEHE,CACT,CAEA,OAAOH,EAAU7B,KACnB,CAIO,SAASmC,EAAkBH,EAAoBI,EAAyBC,GAC7E,IAAIC,EAAWF,EAAOJ,EAAMjB,YAE5B,OAAOiB,EAAMf,WAAU,SAACd,GACtB,IAAMoC,EAAUH,EAAOjC,GAEnBoC,IAAYD,IACdA,EAAWC,EACXF,EAAOE,GAEX,GACF,C,OA1EAC,YAAW,WACa,gBAAlBC,OAAOC,SACTD,OAAO,OAAYhB,EAEvB,GAAG,K","sources":["webpack://@openmrs/esm-state/webpack/bootstrap","webpack://@openmrs/esm-state/webpack/runtime/define property getters","webpack://@openmrs/esm-state/webpack/runtime/hasOwnProperty shorthand","webpack://@openmrs/esm-state/webpack/runtime/make namespace object","webpack://@openmrs/esm-state/../../../node_modules/zustand/esm/vanilla.mjs","webpack://@openmrs/esm-state/./src/state.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\") ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const destroy = () => {\n if ((import.meta.env && import.meta.env.MODE) !== \"production\") {\n console.warn(\n \"[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.\"\n );\n }\n listeners.clear();\n };\n const api = { setState, getState, subscribe, destroy };\n state = createState(setState, getState, api);\n return api;\n};\nconst createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;\nvar vanilla = (createState) => {\n if ((import.meta.env && import.meta.env.MODE) !== \"production\") {\n console.warn(\n \"[DEPRECATED] Default export is deprecated. Instead use import { createStore } from 'zustand/vanilla'.\"\n );\n }\n return createStore(createState);\n};\n\nexport { createStore, vanilla as default };\n","/** @module @category Store */\nimport { createStore, StoreApi } from 'zustand/vanilla';\nimport type {} from '@openmrs/esm-globals';\n\ninterface StoreEntity {\n value: StoreApi<unknown>;\n active: boolean;\n}\n\nconst availableStores: Record<string, StoreEntity> = {};\n\n// spaEnv isn't available immediately. Wait a bit before making stores available\n// on window in development mode.\nsetTimeout(() => {\n if (window.spaEnv === 'development') {\n window['stores'] = availableStores;\n }\n}, 1000);\n\n/**\n * Creates a Zustand store.\n *\n * @param name A name by which the store can be looked up later.\n * Must be unique across the entire application.\n * @param initialState An object which will be the initial state of the store.\n * @returns The newly created store.\n */\nexport function createGlobalStore<T>(name: string, initialState: T): StoreApi<T> {\n const available = availableStores[name];\n\n if (available) {\n if (available.active) {\n console.error('Cannot override an existing store. Make sure that stores are only created once.');\n } else {\n available.value.setState(initialState, true);\n }\n\n available.active = true;\n return available.value as StoreApi<T>;\n } else {\n const store = createStore<T>()(() => initialState);\n\n availableStores[name] = {\n value: store,\n active: true,\n };\n\n return store;\n }\n}\n\n/**\n * Returns the existing store named `name`,\n * or creates a new store named `name` if none exists.\n *\n * @param name The name of the store to look up.\n * @param fallbackState The initial value of the new store if no store named `name` exists.\n * @returns The found or newly created store.\n */\nexport function getGlobalStore<T>(name: string, fallbackState?: T): StoreApi<T> {\n const available = availableStores[name];\n\n if (!available) {\n const store = createStore<T>()(() => fallbackState ?? ({} as unknown as T));\n availableStores[name] = {\n value: store,\n active: false,\n };\n return store;\n }\n\n return available.value as StoreApi<T>;\n}\n\nexport interface AppState {}\n\nexport function subscribeTo<T, U>(store: StoreApi<T>, select: (state: T) => U, handle: (subState: U) => void) {\n let previous = select(store.getState());\n\n return store.subscribe((state) => {\n const current = select(state);\n\n if (current !== previous) {\n previous = current;\n handle(current);\n }\n });\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","createStoreImpl","createState","state","listeners","Set","setState","partial","replace","nextState","is","previousState","assign","forEach","listener","getState","api","subscribe","add","delete","destroy","console","warn","clear","createStore","availableStores","createGlobalStore","name","initialState","available","active","error","store","getGlobalStore","fallbackState","subscribeTo","select","handle","previous","current","setTimeout","window","spaEnv"],"sourceRoot":""}
package/jest.config.js CHANGED
@@ -1,9 +1,9 @@
1
1
  module.exports = {
2
2
  transform: {
3
- "^.+\\.tsx?$": ["@swc/jest"],
3
+ '^.+\\.tsx?$': ['@swc/jest'],
4
4
  },
5
- testEnvironment: "jsdom",
5
+ testEnvironment: 'jsdom',
6
6
  testEnvironmentOptions: {
7
- url: "http://localhost/",
7
+ url: 'http://localhost/',
8
8
  },
9
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-state",
3
- "version": "5.3.3-pre.1240",
3
+ "version": "5.3.3-pre.1247",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Frontend stores & state management for OpenMRS",
6
6
  "browser": "dist/openmrs-esm-state.js",
@@ -44,7 +44,7 @@
44
44
  "@openmrs/esm-globals": "5.x"
45
45
  },
46
46
  "devDependencies": {
47
- "@openmrs/esm-globals": "5.3.3-pre.1240"
47
+ "@openmrs/esm-globals": "5.3.3-pre.1247"
48
48
  },
49
49
  "stableVersion": "5.3.2"
50
50
  }
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export * from "./state";
1
+ export * from './state';
package/src/public.ts CHANGED
@@ -1,6 +1 @@
1
- export {
2
- type AppState,
3
- createGlobalStore,
4
- getGlobalStore,
5
- subscribeTo,
6
- } from "./state";
1
+ export { type AppState, createGlobalStore, getGlobalStore, subscribeTo } from './state';
package/src/state.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /** @module @category Store */
2
- import { createStore, StoreApi } from "zustand/vanilla";
3
- import type {} from "@openmrs/esm-globals";
2
+ import { createStore, StoreApi } from 'zustand/vanilla';
3
+ import type {} from '@openmrs/esm-globals';
4
4
 
5
5
  interface StoreEntity {
6
6
  value: StoreApi<unknown>;
@@ -12,8 +12,8 @@ const availableStores: Record<string, StoreEntity> = {};
12
12
  // spaEnv isn't available immediately. Wait a bit before making stores available
13
13
  // on window in development mode.
14
14
  setTimeout(() => {
15
- if (window.spaEnv === "development") {
16
- window["stores"] = availableStores;
15
+ if (window.spaEnv === 'development') {
16
+ window['stores'] = availableStores;
17
17
  }
18
18
  }, 1000);
19
19
 
@@ -25,17 +25,12 @@ setTimeout(() => {
25
25
  * @param initialState An object which will be the initial state of the store.
26
26
  * @returns The newly created store.
27
27
  */
28
- export function createGlobalStore<T>(
29
- name: string,
30
- initialState: T
31
- ): StoreApi<T> {
28
+ export function createGlobalStore<T>(name: string, initialState: T): StoreApi<T> {
32
29
  const available = availableStores[name];
33
30
 
34
31
  if (available) {
35
32
  if (available.active) {
36
- console.error(
37
- "Cannot override an existing store. Make sure that stores are only created once."
38
- );
33
+ console.error('Cannot override an existing store. Make sure that stores are only created once.');
39
34
  } else {
40
35
  available.value.setState(initialState, true);
41
36
  }
@@ -62,10 +57,7 @@ export function createGlobalStore<T>(
62
57
  * @param fallbackState The initial value of the new store if no store named `name` exists.
63
58
  * @returns The found or newly created store.
64
59
  */
65
- export function getGlobalStore<T>(
66
- name: string,
67
- fallbackState?: T
68
- ): StoreApi<T> {
60
+ export function getGlobalStore<T>(name: string, fallbackState?: T): StoreApi<T> {
69
61
  const available = availableStores[name];
70
62
 
71
63
  if (!available) {
@@ -82,11 +74,7 @@ export function getGlobalStore<T>(
82
74
 
83
75
  export interface AppState {}
84
76
 
85
- export function subscribeTo<T, U>(
86
- store: StoreApi<T>,
87
- select: (state: T) => U,
88
- handle: (subState: U) => void
89
- ) {
77
+ export function subscribeTo<T, U>(store: StoreApi<T>, select: (state: T) => U, handle: (subState: U) => void) {
90
78
  let previous = select(store.getState());
91
79
 
92
80
  return store.subscribe((state) => {
package/webpack.config.js CHANGED
@@ -1,42 +1,42 @@
1
- const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
2
- const { resolve } = require("path");
3
- const { CleanWebpackPlugin } = require("clean-webpack-plugin");
4
- const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
1
+ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
2
+ const { resolve } = require('path');
3
+ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
4
+ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
5
5
 
6
- const { peerDependencies } = require("./package.json");
6
+ const { peerDependencies } = require('./package.json');
7
7
 
8
8
  module.exports = (env) => ({
9
- entry: [resolve(__dirname, "src/index.ts")],
9
+ entry: [resolve(__dirname, 'src/index.ts')],
10
10
  output: {
11
- filename: "openmrs-esm-state.js",
12
- path: resolve(__dirname, "dist"),
13
- library: { type: "system" },
11
+ filename: 'openmrs-esm-state.js',
12
+ path: resolve(__dirname, 'dist'),
13
+ library: { type: 'system' },
14
14
  },
15
- devtool: "source-map",
15
+ devtool: 'source-map',
16
16
  module: {
17
17
  rules: [
18
18
  {
19
19
  test: /\.m?(js|ts|tsx)$/,
20
20
  exclude: /node_modules/,
21
- use: "swc-loader",
21
+ use: 'swc-loader',
22
22
  },
23
23
  ],
24
24
  },
25
25
  externals: Object.keys(peerDependencies || {}),
26
26
  resolve: {
27
- extensions: [".ts", ".js", ".tsx", ".jsx"],
27
+ extensions: ['.ts', '.js', '.tsx', '.jsx'],
28
28
  },
29
29
  plugins: [
30
30
  new CleanWebpackPlugin(),
31
31
  new ForkTsCheckerWebpackPlugin(),
32
32
  new BundleAnalyzerPlugin({
33
- analyzerMode: env && env.analyze ? "static" : "disabled",
33
+ analyzerMode: env && env.analyze ? 'static' : 'disabled',
34
34
  }),
35
35
  ],
36
36
  devServer: {
37
37
  disableHostCheck: true,
38
38
  headers: {
39
- "Access-Control-Allow-Origin": "*",
39
+ 'Access-Control-Allow-Origin': '*',
40
40
  },
41
41
  },
42
42
  });