@openmrs/esm-state 5.0.1-pre.813 → 5.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.
@@ -1,6 +1,11 @@
1
- @openmrs/esm-state:build: cache hit, replaying output 69492ec61df4a546
2
- @openmrs/esm-state:build: asset openmrs-esm-state.js 1.59 KiB [emitted] [minimized] (name: main) 1 related asset
3
- @openmrs/esm-state:build: runtime modules 670 bytes 3 modules
4
- @openmrs/esm-state:build: orphan modules 3.73 KiB [orphan] 2 modules
5
- @openmrs/esm-state:build: ./src/index.ts + 2 modules 3.75 KiB [built] [code generated]
6
- @openmrs/esm-state:build: webpack 5.88.0 compiled successfully in 12265 ms
1
+ @openmrs/esm-state:build: cache hit, replaying output 2fb9d38a595d3253
2
+ @openmrs/esm-state:build: asset openmrs-esm-state.js 2.97 KiB [emitted] [minimized] (name: main) 1 related asset
3
+ @openmrs/esm-state:build: runtime modules 1.81 KiB 6 modules
4
+ @openmrs/esm-state:build: orphan modules 3.73 KiB [orphan] 2 modules
5
+ @openmrs/esm-state:build: cacheable modules 7.02 KiB
6
+ @openmrs/esm-state:build:  modules by path ../../../node_modules/systemjs-webpack-interop/auto-public-path/*.js 935 bytes
7
+ @openmrs/esm-state:build:  ../../../node_modules/systemjs-webpack-interop/auto-public-path/1.js 89 bytes [built] [code generated]
8
+ @openmrs/esm-state:build:  ../../../node_modules/systemjs-webpack-interop/auto-public-path/auto-...(truncated) 846 bytes [built] [code generated]
9
+ @openmrs/esm-state:build:  ./src/index.ts + 2 modules 3.75 KiB [built] [code generated]
10
+ @openmrs/esm-state:build:  ../../../node_modules/systemjs-webpack-interop/public-path.js 2.36 KiB [built] [code generated]
11
+ @openmrs/esm-state:build: webpack 5.88.0 compiled successfully in 15364 ms
@@ -1,2 +1,2 @@
1
- var _openmrs_esm_state;(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{createAppState:()=>c,createGlobalStore:()=>a,getAppState:()=>u,getGlobalStore:()=>s,subscribeTo:()=>i});const r=e=>{let t;const r=new Set,o=(e,o)=>{const n="function"==typeof e?e(t):e;if(!Object.is(n,t)){const e=t;t=(null!=o?o:"object"!=typeof n)?n:Object.assign({},t,n),r.forEach((r=>r(t,e)))}},n=()=>t,a={setState:o,getState:n,subscribe:e=>(r.add(e),()=>r.delete(e)),destroy:()=>{console.warn("[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."),r.clear()}};return t=e(o,n,a),a},o=e=>e?r(e):r,n={};function a(e,t){const r=n[e];if(r)return r.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):r.value.setState(t,!0),r.active=!0,r.value;{const r=o()((()=>t));return n[e]={value:r,active:!0},r}}function s(e,t){const r=n[e];if(!r){const r=o()((()=>null!=t?t:{}));return n[e]={value:r,active:!1},r}return r.value}function c(e){return a("app",e)}function u(){return s("app",{})}function i(e,t,r){let o=t(e.getState());return e.subscribe((e=>{const n=t(e);n!==o&&(o=n,r(n))}))}_openmrs_esm_state=t})();
1
+ System.register([],(function(e,t){return{execute:function(){e((()=>{var e={968:(e,t,r)=>{const o=r(577).R;t.s=function(e){if(e||(e=1),!r.y.meta||!r.y.meta.url)throw console.error("__system_context__",r.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");r.p=o(r.y.meta.url,e)}},577:(e,t,r)=>{t.R=function(e,t){var r=document.createElement("a");r.href=e;for(var o="/"===r.pathname[0]?r.pathname:"/"+r.pathname,n=0,a=o.length;n!==t&&a>=0;)"/"===o[--a]&&n++;if(n!==t)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+t+") is greater than the number of directories ("+n+") in the URL path "+e);var c=o.slice(0,a+1);return r.protocol+"//"+r.host+c};Number.isInteger}},r={};function o(t){var n=r[t];if(void 0!==n)return n.exports;var a=r[t]={exports:{}};return e[t](a,a.exports,o),a.exports}o.y=t,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&!e;)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})();var n={};return(0,o(968).s)(1),(()=>{"use strict";o.r(n),o.d(n,{createAppState:()=>i,createGlobalStore:()=>a,getAppState:()=>s,getGlobalStore:()=>c,subscribeTo:()=>u});const e=e=>{let t;const r=new Set,o=(e,o)=>{const n="function"==typeof e?e(t):e;if(!Object.is(n,t)){const e=t;t=(null!=o?o:"object"!=typeof n)?n:Object.assign({},t,n),r.forEach((r=>r(t,e)))}},n=()=>t,a={setState:o,getState:n,subscribe:e=>(r.add(e),()=>r.delete(e)),destroy:()=>{console.warn("[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."),r.clear()}};return t=e(o,n,a),a},t=t=>t?e(t):e,r={};function a(e,o){const n=r[e];if(n)return n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value.setState(o,!0),n.active=!0,n.value;{const n=t()((()=>o));return r[e]={value:n,active:!0},n}}function c(e,o){const n=r[e];if(!n){const n=t()((()=>null!=o?o:{}));return r[e]={value:n,active:!1},n}return n.value}function i(e){return a("app",e)}function s(){return c("app",{})}function u(e,t,r){let o=t(e.getState());return e.subscribe((e=>{const n=t(e);n!==o&&(o=n,r(n))}))}})(),n})())}}}));
2
2
  //# sourceMappingURL=openmrs-esm-state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"openmrs-esm-state.js","mappings":"0CACA,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,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,2HCL9D,MAAMC,EAAmBC,IACvB,IAAIC,EACJ,MAAMC,EAA4B,IAAIC,IAChCC,EAAW,CAACC,EAASC,KACzB,MAAMC,EAA+B,mBAAZF,EAAyBA,EAAQJ,GAASI,EACnE,IAAKlB,OAAOqB,GAAGD,EAAWN,GAAQ,CAChC,MAAMQ,EAAgBR,EACtBA,GAAoB,MAAXK,EAAkBA,EAA+B,iBAAdC,GAA0BA,EAAYpB,OAAOuB,OAAO,CAAC,EAAGT,EAAOM,GAC3GL,EAAUS,SAASC,GAAaA,EAASX,EAAOQ,IAClD,GAEII,EAAW,IAAMZ,EAajBa,EAAM,CAAEV,WAAUS,WAAUE,UAZfH,IACjBV,EAAUc,IAAIJ,GACP,IAAMV,EAAUe,OAAOL,IAUaM,QAR7B,KAEZC,QAAQC,KACN,0MAGJlB,EAAUmB,OAAO,GAInB,OADApB,EAAQD,EAAYI,EAAUS,EAAUC,GACjCA,CAAG,EAENQ,EAAetB,GAAgBA,EAAcD,EAAgBC,GAAeD,EC3B5EwB,EAAkB,CAAC,EAQd,SAASC,EAAkBC,EAAMC,GACxC,MAAMC,EAAYJ,EAAgBE,GAClC,GAAIE,EAOA,OANIA,EAAUC,OACVT,QAAQU,MAAM,mFAEdF,EAAU7B,MAAMM,SAASsB,GAAc,GAE3CC,EAAUC,QAAS,EACZD,EAAU7B,MACd,CACH,MAAMgC,EAAQR,KAAc,IAAII,IAKhC,OAJAH,EAAgBE,GAAQ,CACpB3B,MAAOgC,EACPF,QAAQ,GAELE,CACX,CACJ,CAQW,SAASC,EAAeN,EAAMO,GACrC,MAAML,EAAYJ,EAAgBE,GAClC,IAAKE,EAAW,CACZ,MAAMG,EAAQR,KAAc,IAAIU,QAAqDA,EAAgB,CAAC,IAKtG,OAJAT,EAAgBE,GAAQ,CACpB3B,MAAOgC,EACPF,QAAQ,GAELE,CACX,CACA,OAAOH,EAAU7B,KACrB,CAGW,SAASmC,EAAeP,GAC/B,OAAOF,EAAkB,MAAOE,EACpC,CAGW,SAASQ,IAChB,OAAOH,EAAe,MAAO,CAAC,EAClC,CACO,SAASI,EAAYL,EAAOM,EAAQC,GACvC,IAAIC,EAAWF,EAAON,EAAMjB,YAC5B,OAAOiB,EAAMf,WAAWd,IACpB,MAAMsC,EAAUH,EAAOnC,GACnBsC,IAAYD,IACZA,EAAWC,EACXF,EAAOE,GACX,GAER,C","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 */ import { createStore } from \"zustand/vanilla\";\nconst availableStores = {};\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 */ export function createGlobalStore(name, initialState) {\n const available = availableStores[name];\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 available.active = true;\n return available.value;\n } else {\n const store = createStore()(()=>initialState);\n availableStores[name] = {\n value: store,\n active: true\n };\n return store;\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 */ export function getGlobalStore(name, fallbackState) {\n const available = availableStores[name];\n if (!available) {\n const store = createStore()(()=>fallbackState !== null && fallbackState !== void 0 ? fallbackState : {});\n availableStores[name] = {\n value: store,\n active: false\n };\n return store;\n }\n return available.value;\n}\n/**\n * @internal\n */ export function createAppState(initialState) {\n return createGlobalStore(\"app\", initialState);\n}\n/**\n * @returns The [store](https://github.com/developit/unistore#store) named `app`.\n */ export function getAppState() {\n return getGlobalStore(\"app\", {});\n}\nexport function subscribeTo(store, select, handle) {\n let previous = select(store.getState());\n return store.subscribe((state)=>{\n const current = select(state);\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","createAppState","getAppState","subscribeTo","select","handle","previous","current"],"sourceRoot":""}
1
+ {"version":3,"file":"openmrs-esm-state.js","mappings":"yFAAA,MAAMA,EAAmB,SAEzBC,EAAQ,EAAiB,SAAwBC,GAY7C,GAXGA,IACHA,EAAe,I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,IACjBT,EAAUa,IAAIJ,GACP,IAAMT,EAAUc,OAAOL,IAUaM,QAR7B,KAEZhF,QAAQiF,KACN,0MAGJhB,EAAUiB,OAAO,GAInB,OADAlB,EAAQD,EAAYI,EAAUQ,EAAUC,GACjCA,CAAG,EAENO,EAAepB,GAAgBA,EAAcD,EAAgBC,GAAeD,EC3B5EsB,EAAkB,CAAC,EAQd,SAASC,EAAkBC,EAAMC,GACxC,MAAMC,EAAYJ,EAAgBE,GAClC,GAAIE,EAOA,OANIA,EAAUC,OACVzF,QAAQC,MAAM,mFAEduF,EAAUtC,MAAMiB,SAASoB,GAAc,GAE3CC,EAAUC,QAAS,EACZD,EAAUtC,MACd,CACH,MAAMwC,EAAQP,KAAc,IAAII,IAKhC,OAJAH,EAAgBE,GAAQ,CACpBpC,MAAOwC,EACPD,QAAQ,GAELC,CACX,CACJ,CAQW,SAASC,EAAeL,EAAMM,GACrC,MAAMJ,EAAYJ,EAAgBE,GAClC,IAAKE,EAAW,CACZ,MAAME,EAAQP,KAAc,IAAIS,QAAqDA,EAAgB,CAAC,IAKtG,OAJAR,EAAgBE,GAAQ,CACpBpC,MAAOwC,EACPD,QAAQ,GAELC,CACX,CACA,OAAOF,EAAUtC,KACrB,CAGW,SAAS2C,EAAeN,GAC/B,OAAOF,EAAkB,MAAOE,EACpC,CAGW,SAASO,IAChB,OAAOH,EAAe,MAAO,CAAC,EAClC,CACO,SAASI,EAAYL,EAAOM,EAAQC,GACvC,IAAIC,EAAWF,EAAON,EAAMf,YAC5B,OAAOe,EAAMb,WAAWb,IACpB,MAAMmC,EAAUH,EAAOhC,GACnBmC,IAAYD,IACZA,EAAWC,EACXF,EAAOE,GACX,GAER,C","sources":["webpack://@openmrs/esm-state/../../../node_modules/systemjs-webpack-interop/auto-public-path/auto-public-path.js","webpack://@openmrs/esm-state/../../../node_modules/systemjs-webpack-interop/public-path.js","webpack://@openmrs/esm-state/webpack/bootstrap","webpack://@openmrs/esm-state/webpack/runtime/__system_context__","webpack://@openmrs/esm-state/webpack/runtime/define property getters","webpack://@openmrs/esm-state/webpack/runtime/global","webpack://@openmrs/esm-state/webpack/runtime/hasOwnProperty shorthand","webpack://@openmrs/esm-state/webpack/runtime/make namespace object","webpack://@openmrs/esm-state/webpack/runtime/publicPath","webpack://@openmrs/esm-state/../../../node_modules/systemjs-webpack-interop/auto-public-path/1.js","webpack://@openmrs/esm-state/../../../node_modules/zustand/esm/vanilla.mjs","webpack://@openmrs/esm-state/./src/state.ts"],"sourcesContent":["const resolveDirectory = require(\"../public-path\").resolveDirectory;\n\nexports.autoPublicPath = function autoPublicPath(rootDirLevel) {\n if (!rootDirLevel) {\n rootDirLevel = 1;\n }\n\n if (typeof __webpack_public_path__ !== \"undefined\") {\n if (typeof __system_context__ === \"undefined\") {\n throw Error(\n \"systemjs-webpack-interop requires webpack@>=5.0.0-beta.15 and output.libraryTarget set to 'system'\"\n );\n }\n\n if (!__system_context__.meta || !__system_context__.meta.url) {\n console.error(\"__system_context__\", __system_context__);\n throw Error(\n \"systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided\"\n );\n }\n\n __webpack_public_path__ = resolveDirectory(\n __system_context__.meta.url,\n rootDirLevel\n );\n }\n};\n","exports.setPublicPath = function setPublicPath(\n systemjsModuleName,\n rootDirectoryLevel\n) {\n if (!rootDirectoryLevel) {\n rootDirectoryLevel = 1;\n }\n if (\n typeof systemjsModuleName !== \"string\" ||\n systemjsModuleName.trim().length === 0\n ) {\n throw Error(\n \"systemjs-webpack-interop: setPublicPath(systemjsModuleName) must be called with a non-empty string 'systemjsModuleName'\"\n );\n }\n\n if (\n typeof rootDirectoryLevel !== \"number\" ||\n rootDirectoryLevel <= 0 ||\n isNaN(rootDirectoryLevel) ||\n !isInteger(rootDirectoryLevel)\n ) {\n throw Error(\n \"systemjs-webpack-interop: setPublicPath(systemjsModuleName, rootDirectoryLevel) must be called with a positive integer 'rootDirectoryLevel'\"\n );\n }\n\n var moduleUrl;\n try {\n moduleUrl = window.System.resolve(systemjsModuleName);\n if (!moduleUrl) {\n throw Error();\n }\n } catch (err) {\n throw Error(\n \"systemjs-webpack-interop: There is no such module '\" +\n systemjsModuleName +\n \"' in the SystemJS registry. Did you misspell the name of your module?\"\n );\n }\n\n __webpack_public_path__ = resolveDirectory(moduleUrl, rootDirectoryLevel);\n};\n\nfunction resolveDirectory(urlString, rootDirectoryLevel) {\n // Our friend IE11 doesn't support new URL()\n // https://github.com/single-spa/single-spa/issues/612\n // https://gist.github.com/jlong/2428561\n\n var a = document.createElement(\"a\");\n a.href = urlString;\n\n var pathname = a.pathname[0] === \"/\" ? a.pathname : \"/\" + a.pathname;\n var numDirsProcessed = 0,\n index = pathname.length;\n while (numDirsProcessed !== rootDirectoryLevel && index >= 0) {\n var char = pathname[--index];\n if (char === \"/\") {\n numDirsProcessed++;\n }\n }\n\n if (numDirsProcessed !== rootDirectoryLevel) {\n throw Error(\n \"systemjs-webpack-interop: rootDirectoryLevel (\" +\n rootDirectoryLevel +\n \") is greater than the number of directories (\" +\n numDirsProcessed +\n \") in the URL path \" +\n urlString\n );\n }\n\n var finalPath = pathname.slice(0, index + 1);\n\n return a.protocol + \"//\" + a.host + finalPath;\n}\n\nexports.resolveDirectory = resolveDirectory;\n\n// borrowed from https://github.com/parshap/js-is-integer/blob/master/index.js\nvar isInteger =\n Number.isInteger ||\n function isInteger(val) {\n return typeof val === \"number\" && isFinite(val) && Math.floor(val) === val;\n };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.y = __system_context__;","// 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__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\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};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","const autoPublicPath = require(\"./auto-public-path\").autoPublicPath;\n\nautoPublicPath(1);\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 */ import { createStore } from \"zustand/vanilla\";\nconst availableStores = {};\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 */ export function createGlobalStore(name, initialState) {\n const available = availableStores[name];\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 available.active = true;\n return available.value;\n } else {\n const store = createStore()(()=>initialState);\n availableStores[name] = {\n value: store,\n active: true\n };\n return store;\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 */ export function getGlobalStore(name, fallbackState) {\n const available = availableStores[name];\n if (!available) {\n const store = createStore()(()=>fallbackState !== null && fallbackState !== void 0 ? fallbackState : {});\n availableStores[name] = {\n value: store,\n active: false\n };\n return store;\n }\n return available.value;\n}\n/**\n * @internal\n */ export function createAppState(initialState) {\n return createGlobalStore(\"app\", initialState);\n}\n/**\n * @returns The [store](https://github.com/developit/unistore#store) named `app`.\n */ export function getAppState() {\n return getGlobalStore(\"app\", {});\n}\nexport function subscribeTo(store, select, handle) {\n let previous = select(store.getState());\n return store.subscribe((state)=>{\n const current = select(state);\n if (current !== previous) {\n previous = current;\n handle(current);\n }\n });\n}\n"],"names":["resolveDirectory","exports","rootDirLevel","meta","url","console","error","Error","urlString","rootDirectoryLevel","a","document","createElement","href","pathname","numDirsProcessed","index","length","finalPath","slice","protocol","host","Number","isInteger","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","module","__webpack_modules__","y","__system_context__","d","definition","key","o","Object","defineProperty","enumerable","get","g","globalThis","this","Function","e","window","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","scriptUrl","importScripts","location","currentScript","src","scripts","getElementsByTagName","i","replace","p","autoPublicPath","createStoreImpl","createState","state","listeners","Set","setState","partial","nextState","is","previousState","assign","forEach","listener","getState","api","subscribe","add","delete","destroy","warn","clear","createStore","availableStores","createGlobalStore","name","initialState","available","active","store","getGlobalStore","fallbackState","createAppState","getAppState","subscribeTo","select","handle","previous","current"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-state",
3
- "version": "5.0.1-pre.813",
3
+ "version": "5.0.1",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Frontend stores & state management for OpenMRS",
6
6
  "browser": "dist/openmrs-esm-state.js",
@@ -39,5 +39,5 @@
39
39
  "dependencies": {
40
40
  "zustand": "^4.3.6"
41
41
  },
42
- "gitHead": "0987145a28a9cddc5dca2eb63fc0728c0bc0e2fe"
42
+ "gitHead": "c29b88275be224849a36fcad074af34e3f30f495"
43
43
  }
package/webpack.config.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
2
+ const SystemJSPublicPathWebpackPlugin = require("systemjs-webpack-interop/SystemJSPublicPathWebpackPlugin");
2
3
  const { resolve } = require("path");
3
4
  const { CleanWebpackPlugin } = require("clean-webpack-plugin");
4
5
  const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
@@ -10,22 +11,24 @@ module.exports = (env) => ({
10
11
  output: {
11
12
  filename: "openmrs-esm-state.js",
12
13
  path: resolve(__dirname, "dist"),
13
- library: { type: "var", name: "_openmrs_esm_state" },
14
+ libraryTarget: "system",
14
15
  },
15
16
  devtool: "source-map",
16
17
  module: {
17
18
  rules: [
18
19
  {
19
20
  test: /\.m?(js|ts|tsx)$/,
20
- exclude: /(node_modules|bower_components)/,
21
+ exclude: /node_modules/,
21
22
  use: "@swc-node/loader",
22
23
  },
23
24
  ],
24
25
  },
26
+ externals: Object.keys(peerDependencies || {}),
25
27
  resolve: {
26
28
  extensions: [".ts", ".js", ".tsx", ".jsx"],
27
29
  },
28
30
  plugins: [
31
+ new SystemJSPublicPathWebpackPlugin(),
29
32
  new CleanWebpackPlugin(),
30
33
  new ForkTsCheckerWebpackPlugin(),
31
34
  new BundleAnalyzerPlugin({