@mirai/core 0.1.138 → 0.1.142
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/build/Core.Notifications.js +3 -4
- package/build/Core.Notifications.js.map +1 -1
- package/build/components/__internal__/Skeleton.module.css +1 -1
- package/build/components/finder/Deals.skeleton.js +2 -3
- package/build/components/finder/Deals.skeleton.js.map +1 -1
- package/build/index.js +5 -1
- package/build/index.js.map +1 -1
- package/package.json +8 -8
|
@@ -8,8 +8,7 @@ var _dataSources = require("@mirai/data-sources");
|
|
|
8
8
|
var _locale = require("@mirai/locale");
|
|
9
9
|
var _ui = require("@mirai/ui");
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
var style = _interopRequireWildcard(require("./Core.Notifications.module.css"));
|
|
13
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -74,7 +73,7 @@ const Notifications = () => {
|
|
|
74
73
|
};
|
|
75
74
|
const keys = Object.keys(queue);
|
|
76
75
|
return /*#__PURE__*/_react.default.createElement(_ui.View, {
|
|
77
|
-
className:
|
|
76
|
+
className: style.notifications
|
|
78
77
|
}, keys.sort().map((key, index) => {
|
|
79
78
|
const {
|
|
80
79
|
defaultMessage,
|
|
@@ -86,7 +85,7 @@ const Notifications = () => {
|
|
|
86
85
|
key: key,
|
|
87
86
|
wide: true,
|
|
88
87
|
onClose: () => handleClose(key),
|
|
89
|
-
className: (0, _ui.styles)(
|
|
88
|
+
className: (0, _ui.styles)(style.item, visible && style.visible),
|
|
90
89
|
style: {
|
|
91
90
|
zIndex: keys.length - index
|
|
92
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Core.Notifications.js","names":["EVENT_NAME","queue","Notifications","translate","useLocale","setTimestamp","useState","value","session","authorization","useStore","useEffect","Event","subscribe","handleAdd","unsubscribe","notification","success","warning","id","Date","getTime","Math","random","toFixed","visible","forceRender","setTimeout","parseMotion","handleClose","motionExpand","Theme","get","parseFloat","replace","keys","Object","style","notifications","sort","map","key","index","defaultMessage","props","styles","item","zIndex","length","displayName","propTypes"],"sources":["../src/Core.Notifications.jsx"],"sourcesContent":["import { Event, useStore } from '@mirai/data-sources';\nimport { useLocale } from '@mirai/locale';\nimport { Notification, styles, Theme, View } from '@mirai/ui';\nimport React, { useEffect, useState } from 'react';\n\nimport style from './Core.Notifications.module.css';\n\nconst EVENT_NAME = 'notification';\nlet queue = {};\n\nconst Notifications = () => {\n const { translate } = useLocale();\n const [, setTimestamp] = useState();\n const {\n value: { session: { authorization } = {} },\n } = useStore();\n\n useEffect(() => {\n Event.subscribe(EVENT_NAME, handleAdd);\n return () => Event.unsubscribe(EVENT_NAME, handleAdd);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n queue = {};\n }, [authorization]);\n\n const handleAdd = (notification) => {\n if (!notification) return;\n\n const { success, warning } = notification;\n const id = `${new Date().getTime()}:${Math.random().toFixed(8)}`;\n\n queue[id] = { ...notification, visible: false };\n forceRender();\n\n setTimeout(() => {\n queue[id].visible = true;\n forceRender();\n }, parseMotion());\n\n if (success || warning) setTimeout(() => handleClose(id), success ? 5000 : 10000);\n\n return;\n };\n\n const handleClose = (id) => {\n if (!queue[id]) return;\n\n setTimestamp(() => {\n queue[id].visible = false;\n\n setTimeout(() => {\n delete queue[id];\n forceRender();\n }, parseMotion());\n\n return new Date().getTime();\n });\n };\n\n const forceRender = () => setTimestamp(new Date().getTime());\n\n const parseMotion = () => {\n const { motionExpand = '0.3s' } = Theme.get();\n\n return parseFloat(motionExpand.replace('s')) * 1000;\n };\n\n const keys = Object.keys(queue);\n\n return (\n <View className={style.notifications}>\n {keys.sort().map((key, index) => {\n const { defaultMessage, id, visible = false, ...props } = queue[key];\n\n return (\n <Notification\n {...props}\n key={key}\n wide\n onClose={() => handleClose(key)}\n className={styles(style.item, visible && style.visible)}\n style={{ zIndex: keys.length - index }}\n >\n {translate({ id, defaultMessage })}\n </Notification>\n );\n })}\n </View>\n );\n};\n\nNotifications.displayName = 'core:components:Notifications';\n\nNotifications.propTypes = {};\n\nexport { Notifications };\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAEA;
|
|
1
|
+
{"version":3,"file":"Core.Notifications.js","names":["EVENT_NAME","queue","Notifications","translate","useLocale","setTimestamp","useState","value","session","authorization","useStore","useEffect","Event","subscribe","handleAdd","unsubscribe","notification","success","warning","id","Date","getTime","Math","random","toFixed","visible","forceRender","setTimeout","parseMotion","handleClose","motionExpand","Theme","get","parseFloat","replace","keys","Object","style","notifications","sort","map","key","index","defaultMessage","props","styles","item","zIndex","length","displayName","propTypes"],"sources":["../src/Core.Notifications.jsx"],"sourcesContent":["import { Event, useStore } from '@mirai/data-sources';\nimport { useLocale } from '@mirai/locale';\nimport { Notification, styles, Theme, View } from '@mirai/ui';\nimport React, { useEffect, useState } from 'react';\n\nimport * as style from './Core.Notifications.module.css';\n\nconst EVENT_NAME = 'notification';\nlet queue = {};\n\nconst Notifications = () => {\n const { translate } = useLocale();\n const [, setTimestamp] = useState();\n const {\n value: { session: { authorization } = {} },\n } = useStore();\n\n useEffect(() => {\n Event.subscribe(EVENT_NAME, handleAdd);\n return () => Event.unsubscribe(EVENT_NAME, handleAdd);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n queue = {};\n }, [authorization]);\n\n const handleAdd = (notification) => {\n if (!notification) return;\n\n const { success, warning } = notification;\n const id = `${new Date().getTime()}:${Math.random().toFixed(8)}`;\n\n queue[id] = { ...notification, visible: false };\n forceRender();\n\n setTimeout(() => {\n queue[id].visible = true;\n forceRender();\n }, parseMotion());\n\n if (success || warning) setTimeout(() => handleClose(id), success ? 5000 : 10000);\n\n return;\n };\n\n const handleClose = (id) => {\n if (!queue[id]) return;\n\n setTimestamp(() => {\n queue[id].visible = false;\n\n setTimeout(() => {\n delete queue[id];\n forceRender();\n }, parseMotion());\n\n return new Date().getTime();\n });\n };\n\n const forceRender = () => setTimestamp(new Date().getTime());\n\n const parseMotion = () => {\n const { motionExpand = '0.3s' } = Theme.get();\n\n return parseFloat(motionExpand.replace('s')) * 1000;\n };\n\n const keys = Object.keys(queue);\n\n return (\n <View className={style.notifications}>\n {keys.sort().map((key, index) => {\n const { defaultMessage, id, visible = false, ...props } = queue[key];\n\n return (\n <Notification\n {...props}\n key={key}\n wide\n onClose={() => handleClose(key)}\n className={styles(style.item, visible && style.visible)}\n style={{ zIndex: keys.length - index }}\n >\n {translate({ id, defaultMessage })}\n </Notification>\n );\n })}\n </View>\n );\n};\n\nNotifications.displayName = 'core:components:Notifications';\n\nNotifications.propTypes =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,EAAE,MAAMZ,WAAW,CAACY,GAAG,CAAE;MAChC,SAAS,EAAE,IAAAI,UAAM,EAACR,KAAK,CAACS,IAAI,EAAErB,OAAO,IAAIY,KAAK,CAACZ,OAAO,CAAE;MACxD,KAAK,EAAE;QAAEsB,MAAM,EAAEZ,IAAI,CAACa,MAAM,GAAGN;MAAM;IAAE,IAEtCvC,SAAS,CAAC;MAAEgB,EAAE;MAAEwB;IAAe,CAAC,CAAC,CACrB;EAEnB,CAAC,CAAC,CACG;AAEX,CAAC;AAAC;AAEFzC,aAAa,CAAC+C,WAAW,GAAG,+BAA+B;AAE3D/C,aAAa,CAACgD,SAAS,GAAG,CAAC,CAAC"}
|
|
@@ -25,9 +25,8 @@ var _default = () => {
|
|
|
25
25
|
}, /*#__PURE__*/_react.default.createElement(_Skeleton.Skeleton, {
|
|
26
26
|
bold: true,
|
|
27
27
|
headline: true,
|
|
28
|
-
level: 2
|
|
29
|
-
|
|
30
|
-
}, "Discover Deals"), /*#__PURE__*/_react.default.createElement(_Skeleton.Skeleton, {
|
|
28
|
+
level: 2
|
|
29
|
+
}, "Select dates and persons"), /*#__PURE__*/_react.default.createElement(_Skeleton.Skeleton, {
|
|
31
30
|
action: true
|
|
32
31
|
}, "Clear")), isMobile ? /*#__PURE__*/_react.default.createElement(_ui.View, {
|
|
33
32
|
wide: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deals.skeleton.js","names":["isMobile","useDevice","padding","maxWidth","justifyContent","paddingTop","gap","height","marginTop","width","flex"],"sources":["../../../src/components/finder/Deals.skeleton.jsx"],"sourcesContent":["import { View } from '@mirai/ui';\nimport { useDevice } from '@mirai/ui';\nimport React from 'react';\n\nimport { Skeleton } from '../__internal__/Skeleton';\n\nexport default () => {\n const { isMobile } = useDevice();\n\n return (\n <View style={{ padding: '1rem 0', maxWidth: '720px' }}>\n <View row style={{ justifyContent: 'space-between' }}>\n <Skeleton bold headline level={2}
|
|
1
|
+
{"version":3,"file":"Deals.skeleton.js","names":["isMobile","useDevice","padding","maxWidth","justifyContent","paddingTop","gap","height","marginTop","width","flex"],"sources":["../../../src/components/finder/Deals.skeleton.jsx"],"sourcesContent":["import { View } from '@mirai/ui';\nimport { useDevice } from '@mirai/ui';\nimport React from 'react';\n\nimport { Skeleton } from '../__internal__/Skeleton';\n\nexport default () => {\n const { isMobile } = useDevice();\n\n return (\n <View style={{ padding: '1rem 0', maxWidth: '720px' }}>\n <View row style={{ justifyContent: 'space-between' }}>\n <Skeleton bold headline level={2}>\n Select dates and persons\n </Skeleton>\n <Skeleton action>Clear</Skeleton>\n </View>\n\n {isMobile ? (\n <View wide style={{ paddingTop: '2rem', gap: '0.5rem' }}>\n <Skeleton wide style={{ height: '3.5rem' }} />\n <Skeleton wide style={{ height: '3.5rem' }} />\n <Skeleton wide style={{ height: '3.5rem' }} />\n <Skeleton wide style={{ height: '2.5rem', marginTop: '1rem' }} />\n </View>\n ) : (\n <>\n <View row wide style={{ paddingTop: '1.5rem', gap: '2rem' }}>\n <Skeleton wide style={{ height: '20rem' }} />\n <Skeleton wide style={{ height: '20rem' }} />\n </View>\n <View wide style={{ paddingTop: '1.5rem', gap: '0.25rem' }}>\n <Skeleton>Check-in ─ Check-out</Skeleton>\n <Skeleton small>\n Approximate prices in undefined per 1 room, for undefined nights & undefined adults (Some taxes may not be\n included)\n </Skeleton>\n </View>\n <View row wide style={{ paddingTop: '1.5rem', gap: '1rem' }}>\n <Skeleton style={{ height: '3.5rem', width: '30%' }} />\n <Skeleton style={{ height: '3.5rem', width: '30%' }} />\n <Skeleton transparent style={{ flex: 1 }} />\n <Skeleton style={{ height: '3.5rem', width: '15%' }}>Find</Skeleton>\n </View>\n </>\n )}\n </View>\n );\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAEA;AAAoD;AAAA,eAErC,MAAM;EACnB,MAAM;IAAEA;EAAS,CAAC,GAAG,IAAAC,aAAS,GAAE;EAEhC,oBACE,6BAAC,QAAI;IAAC,KAAK,EAAE;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AQ,oCAAgC,eACzC,6BAAC,kBAAQ;IAAC,KAAK;EAAA,0HAGJ,CACN,eACP,6BAAC,QAAI;IAAC,GAAG;IAAC,IAAI;IAAC,KAAK,EAAE;MAAED,UAAU,EAAE,QAAQ;MAAEC,GAAG,EAAE;IAAO;EAAE,gBAC1D,6BAAC,kBAAQ;IAAC,KAAK,EAAE;MAAEC,MAAM,EAAE,QAAQ;MAAEE,KAAK,EAAE;IAAM;EAAE,EAAG,eACvD,6BAAC,kBAAQ;IAAC,KAAK,EAAE;MAAEF,MAAM,EAAE,QAAQ;MAAEE,KAAK,EAAE;IAAM;EAAE,EAAG,eACvD,6BAAC,kBAAQ;IAAC,WAAW;IAAC,KAAK,EAAE;MAAEC,IAAI,EAAE;IAAE;EAAE,EAAG,eAC5C,6BAAC,kBAAQ;IAAC,KAAK,EAAE;MAAEH,MAAM,EAAE,QAAQ;MAAEE,KAAK,EAAE;IAAM;EAAE,UAAgB,CAC/D,CAEV,CACI;AAEX,CAAC;AAAA"}
|
package/build/index.js
CHANGED
|
@@ -27,7 +27,11 @@ window.Mirai = {
|
|
|
27
27
|
window.Mirai.core = async () => {
|
|
28
28
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
29
29
|
const isDevelopment = process.env.NODE_ENV === 'development';
|
|
30
|
-
|
|
30
|
+
const isPreproduction = process.env.NODE_ENV === 'preproduction';
|
|
31
|
+
console.log({
|
|
32
|
+
a: process.env.NODE_ENV
|
|
33
|
+
});
|
|
34
|
+
console.log(`${isProduction ? '🟢' : isPreproduction ? '🟡' : isDevelopment ? '🔴' : '⚫️'} ${_package.name} v${_package.version} [${process.env.NODE_ENV}]`);
|
|
31
35
|
|
|
32
36
|
// 1. Fetch client-side dataSources
|
|
33
37
|
const urlParams = (0, _helpers.fetchUrlParams)(location.search);
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["window","Mirai","environment","process","env","NODE_ENV","Event","services","booking","SERVICE_BOOKING","club","SERVICE_CLUB","dictionary","SERVICE_DICTIONARY","engine","SERVICE_ENGINE","static","SERVICE_STATIC","user","SERVICE_USER","version","core","isProduction","isDevelopment","console","log","name","urlParams","fetchUrlParams","location","search","cookies","fetchCookies","COOKIE_CART","COOKIE_PESTANA","COOKIE_VALUES","session","fetchSession","loadEnvironment","undefined","instance","findInstance","components","findComponents","length","ReactDOM","render","el","config","fetchConfig","Sentry","loadSentry","SENTRY","theme","checkSession","id","setUser","store","consolidateStore","METRICS"],"sources":["../src/index.js"],"sourcesContent":["/* eslint-disable no-console */\nimport { Event, MetricsProvider, StoreProvider } from '@mirai/data-sources';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { name, version } from '../package.json';\nimport { Core } from './Core';\nimport { COOKIE_CART, COOKIE_PESTANA, COOKIE_VALUES } from './Core.definition';\nimport {\n checkSession,\n consolidateStore,\n fetchConfig,\n fetchCookies,\n fetchSession,\n fetchUrlParams,\n findComponents,\n findInstance,\n loadEnvironment,\n loadSentry,\n theme,\n} from './helpers';\n\nwindow.Mirai = {\n ...window.Mirai,\n environment: process.env.NODE_ENV,\n Event,\n services: {\n booking: process.env.SERVICE_BOOKING,\n club: process.env.SERVICE_CLUB,\n dictionary: process.env.SERVICE_DICTIONARY,\n engine: process.env.SERVICE_ENGINE,\n static: process.env.SERVICE_STATIC,\n user: process.env.SERVICE_USER,\n },\n version,\n};\n\nwindow.Mirai.core = async () => {\n const isProduction = process.env.NODE_ENV === 'production';\n const isDevelopment = process.env.NODE_ENV === 'development';\n\n console.log(`${isProduction ? '🟢' :
|
|
1
|
+
{"version":3,"file":"index.js","names":["window","Mirai","environment","process","env","NODE_ENV","Event","services","booking","SERVICE_BOOKING","club","SERVICE_CLUB","dictionary","SERVICE_DICTIONARY","engine","SERVICE_ENGINE","static","SERVICE_STATIC","user","SERVICE_USER","version","core","isProduction","isDevelopment","isPreproduction","console","log","a","name","urlParams","fetchUrlParams","location","search","cookies","fetchCookies","COOKIE_CART","COOKIE_PESTANA","COOKIE_VALUES","session","fetchSession","loadEnvironment","undefined","instance","findInstance","components","findComponents","length","ReactDOM","render","el","config","fetchConfig","Sentry","loadSentry","SENTRY","theme","checkSession","id","setUser","store","consolidateStore","METRICS"],"sources":["../src/index.js"],"sourcesContent":["/* eslint-disable no-console */\nimport { Event, MetricsProvider, StoreProvider } from '@mirai/data-sources';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { name, version } from '../package.json';\nimport { Core } from './Core';\nimport { COOKIE_CART, COOKIE_PESTANA, COOKIE_VALUES } from './Core.definition';\nimport {\n checkSession,\n consolidateStore,\n fetchConfig,\n fetchCookies,\n fetchSession,\n fetchUrlParams,\n findComponents,\n findInstance,\n loadEnvironment,\n loadSentry,\n theme,\n} from './helpers';\n\nwindow.Mirai = {\n ...window.Mirai,\n environment: process.env.NODE_ENV,\n Event,\n services: {\n booking: process.env.SERVICE_BOOKING,\n club: process.env.SERVICE_CLUB,\n dictionary: process.env.SERVICE_DICTIONARY,\n engine: process.env.SERVICE_ENGINE,\n static: process.env.SERVICE_STATIC,\n user: process.env.SERVICE_USER,\n },\n version,\n};\n\nwindow.Mirai.core = async () => {\n const isProduction = process.env.NODE_ENV === 'production';\n const isDevelopment = process.env.NODE_ENV === 'development';\n const isPreproduction = process.env.NODE_ENV === 'preproduction';\n\n console.log({ a: process.env.NODE_ENV });\n\n console.log(\n `${isProduction ? '🟢' : isPreproduction ? '🟡' : isDevelopment ? '🔴' : '⚫️'} ${name} v${version} [${\n process.env.NODE_ENV\n }]`,\n );\n\n // 1. Fetch client-side dataSources\n const urlParams = fetchUrlParams(location.search);\n const cookies = fetchCookies([COOKIE_CART, COOKIE_PESTANA, COOKIE_VALUES]);\n let session = fetchSession(urlParams);\n\n // 2. Analize environment\n const environment = urlParams.env && isProduction ? loadEnvironment(urlParams.env) : undefined;\n if (environment) return;\n\n // 3. Find instance\n const instance = findInstance({ urlParams });\n if (!instance) return;\n\n // 4. Find components\n const components = findComponents();\n if (!components.length) return;\n\n // 5. Render skeletons\n ReactDOM.render(\n <React.StrictMode>\n <Core {...{ components }} skeleton />\n </React.StrictMode>,\n instance.el,\n );\n\n // 6. Analize id to fetch its config\n const config = await fetchConfig(instance);\n if (!config) return;\n window.Mirai.config = config;\n\n // 7. Sentry\n const Sentry = loadSentry(process.env.SENTRY, version);\n window.Mirai.Sentry = Sentry;\n\n // 8. Theming\n theme();\n\n // 9. Check session\n if (session && !(await checkSession(instance.id, config))) session = undefined;\n if (session && Sentry) Sentry.setUser(session);\n\n // 10. Consolidate store\n const store = consolidateStore({ config, cookies, instance, session, urlParams });\n\n // 11. Render components\n ReactDOM.render(\n <React.StrictMode>\n <MetricsProvider token={process.env.METRICS}>\n <StoreProvider value={store}>\n <Core {...{ components }} />\n </StoreProvider>\n </MetricsProvider>\n </React.StrictMode>,\n instance.el,\n );\n};\n\nwindow.Mirai.core();\n"],"mappings":";;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAYmB;AApBnB;;AAsBAA,MAAM,CAACC,KAAK,GAAG;EACb,GAAGD,MAAM,CAACC,KAAK;EACfC,WAAW,EAAEC,OAAO,CAACC,GAAG,CAACC,QAAQ;EACjCC,KAAK,EAALA,kBAAK;EACLC,QAAQ,EAAE;IACRC,OAAO,EAAEL,OAAO,CAACC,GAAG,CAACK,eAAe;IACpCC,IAAI,EAAEP,OAAO,CAACC,GAAG,CAACO,YAAY;IAC9BC,UAAU,EAAET,OAAO,CAACC,GAAG,CAACS,kBAAkB;IAC1CC,MAAM,EAAEX,OAAO,CAACC,GAAG,CAACW,cAAc;IAClCC,MAAM,EAAEb,OAAO,CAACC,GAAG,CAACa,cAAc;IAClCC,IAAI,EAAEf,OAAO,CAACC,GAAG,CAACe;EACpB,CAAC;EACDC,OAAO,EAAPA;AACF,CAAC;AAEDpB,MAAM,CAACC,KAAK,CAACoB,IAAI,GAAG,YAAY;EAC9B,MAAMC,YAAY,GAAGnB,OAAO,CAACC,GAAG,CAACC,QAAQ,K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AMC,MAAM,GAAG,MAAM,IAAAC,oBAAW,EAACT,QAAQ,CAAC;EAC1C,IAAI,CAACQ,MAAM,EAAE;EACblD,MAAM,CAACC,KAAK,CAACiD,MAAM,GAAGA,MAAM;;EAE5B;EACA,MAAME,MAAM,GAAG,IAAAC,mBAAU,EAAClD,OAAO,CAACC,GAAG,CAACkD,MAAM,EAAElC,gBAAO,CAAC;EACtDpB,MAAM,CAACC,KAAK,CAACmD,MAAM,GAAGA,MAAM;;EAE5B;EACA,IAAAG,cAAK,GAAE;;EAEP;EACA,IAAIjB,OAAO,IAAI,EAAE,MAAM,IAAAkB,qBAAY,EAACd,QAAQ,CAACe,EAAE,EAAEP,MAAM,CAAC,CAAC,EAAEZ,OAAO,GAAGG,SAAS;EAC9E,IAAIH,OAAO,IAAIc,MAAM,EAAEA,MAAM,CAACM,OAAO,CAACpB,OAAO,CAAC;;EAE9C;EACA,MAAMqB,KAAK,GAAG,IAAAC,yBAAgB,EAAC;IAAEV,MAAM;IAAEjB,OAAO;IAAES,QAAQ;IAAEJ,OAAO;IAAET;EAAU,CAAC,CAAC;;EAEjF;EACAkB,iBAAQ,CAACC,MAAM,eACb,6BAAC,cAAK,CAAC,UAAU,qBACf,6BAAC,4BAAe;IAAC,KAAK,EAAE7C,OAAO,CAACC,GAAG,CAACyD;EAAQ,gBAC1C,6BAAC,0BAAa;IAAC,KAAK,EAAEF;EAAM,gBAC1B,6BAAC,UAAI;IAAOf;EAAU,EAAM,CACd,CACA,CACD,EACnBF,QAAQ,CAACO,EAAE,CACZ;AACH,CAAC;AAEDjD,MAAM,CAACC,KAAK,CAACoB,IAAI,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirai/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.142",
|
|
4
4
|
"source": "src/index.js",
|
|
5
5
|
"repository": "https://gitlab.com/miraicorp/dev/frontend/core",
|
|
6
6
|
"author": "JΛVI <hello@soyjavi.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"setup": "rm -rf node_modules && rm -rf yarn.lock && yarn install --force",
|
|
10
|
-
"start": "
|
|
11
|
-
"build": "node scripts/build.js",
|
|
12
|
-
"build:
|
|
13
|
-
"build:
|
|
14
|
-
"build:pro": "node scripts/bundle.js",
|
|
10
|
+
"start": "node scripts/start.js preproduction",
|
|
11
|
+
"build:npm": "node scripts/build.js",
|
|
12
|
+
"build:bundle": "node scripts/bundle.js",
|
|
13
|
+
"build:stats": "source-map-explorer 'dist/**/*.js'",
|
|
15
14
|
"serve": "serve dist -p 8080 -u -n",
|
|
16
15
|
"lint": "eslint --cache --fix --format codeframe --ext .jsx,.js src",
|
|
17
16
|
"test": "node scripts/test.js --watchAll=false --silent",
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
"test:e2e": "yarn playwright test",
|
|
21
20
|
"test:e2e:recorder": "yarn playwright codegen",
|
|
22
21
|
"test:e2e:report": "yarn playwright show-report",
|
|
23
|
-
"pipeline": "yarn lint && yarn test && yarn build",
|
|
22
|
+
"pipeline": "yarn lint && yarn test && yarn build:npm",
|
|
24
23
|
"release": "yarn version --patch && yarn publish --access public"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
@@ -49,7 +48,8 @@
|
|
|
49
48
|
"parcel": "2.8.3",
|
|
50
49
|
"process": "0.11.10",
|
|
51
50
|
"react-scripts": "5.0.1",
|
|
52
|
-
"serve": "14.2.0"
|
|
51
|
+
"serve": "14.2.0",
|
|
52
|
+
"source-map-explorer": "2.5.3"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=18.15.0"
|