@chris-c-brine/vite-version-update-helper 1.0.2 → 1.0.4

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,7 @@
1
+ import { JSX } from 'react';
2
+ interface CountdownTimerProps {
3
+ duration: number;
4
+ }
5
+ export declare function CountdownTimer({ duration }: CountdownTimerProps): JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=CountdownTimer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CountdownTimer.d.ts","sourceRoot":"","sources":["../../src/lib/components/CountdownTimer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,GAAG,EAAC,MAAM,OAAO,CAAC;AAGpD,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,cAAc,CAAC,EAAC,QAAQ,EAAC,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAuB3E"}
@@ -0,0 +1,18 @@
1
+ import { Component, ErrorInfo, ReactNode } from 'react';
2
+ interface Props {
3
+ children: ReactNode;
4
+ /** Custom fallback UI shown momentarily while the page reloads */
5
+ fallback?: ReactNode;
6
+ bounceRate?: number;
7
+ }
8
+ interface State {
9
+ hasError: boolean;
10
+ }
11
+ export declare class ViteVersionErrorHandler extends Component<Props, State> {
12
+ state: State;
13
+ static getDerivedStateFromError(): State;
14
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
15
+ render(): ReactNode;
16
+ }
17
+ export {};
18
+ //# sourceMappingURL=ViteVersionErrorHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ViteVersionErrorHandler.d.ts","sourceRoot":"","sources":["../../src/lib/components/ViteVersionErrorHandler.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAIhE,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;IACpB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,KAAK;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB;AAKD,qBAAa,uBAAwB,SAAQ,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IAC3D,KAAK,EAAE,KAAK,CAEjB;WAEY,wBAAwB,IAAI,KAAK;IAIxC,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAmC3D,MAAM,IAAI,SAAS;CAiB3B"}
package/dist/index.cjs.js CHANGED
@@ -1 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react/jsx-runtime");var n=(e,t=`log`)=>n=>{if([`library`].includes(`development`)){let r=`Dev Only - ${e}`;t===`table`?(console.log(r),console[t](n)):console[t](r,n)}};function r(){let e=sessionStorage.getItem(`chunk_error_reload`),t=Date.now();return{now:t,errorOccurredAgo:e?t-parseInt(e,10):0}}function i({duration:n}){let[r,i]=(0,e.useState)(n);return(0,e.useEffect)(()=>{if(r<=0)return;let e=setInterval(()=>{i(e=>e-1)},1e3);return()=>clearInterval(e)},[r]),(0,t.jsx)(t.Fragment,{children:(e=>{let t=Math.floor(e/60),n=e%60;return`${String(t).padStart(2,`0`)}:${String(n).padStart(2,`0`)}`})(r)})}var a=n(`ViteChunkErrorHandler caught an error`,`table`),o=n(`ViteChunkErrorHandler: Chunk error detected, but reloading is blocked.`),s=class extends e.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){a([{error:e,errorInfo:t}]);let n=this.props.bounceRate??1e4,i=e.message||``;if(i.includes(`Failed to fetch dynamically imported module`)||i.includes(`Loading chunk`)||e.name===`ChunkLoadError`){let{errorOccurredAgo:e,now:t}=r();e>n?(sessionStorage.setItem(`chunk_error_reload`,t.toString()),window.location.reload()):(setTimeout(()=>{sessionStorage.setItem(`chunk_error_reload`,t.toString()),window.location.reload()},n-e),o(`Waiting ${e} milliseconds before retrying.`))}}render(){let{errorOccurredAgo:e}=r(),n=this.props.bounceRate??1e4;return this.state.hasError?this.props.fallback??(0,t.jsxs)(`div`,{style:{padding:`2rem`,textAlign:`center`,fontFamily:`sans-serif`},children:[(0,t.jsx)(`h3`,{children:`Updating application...`}),(0,t.jsx)(`p`,{children:`We are loading the latest version of the app.`}),(0,t.jsxs)(`p`,{children:[`Retrying in `,(0,t.jsx)(i,{duration:Math.floor((n-e)/1e3)}),` seconds...`]})]}):this.props.children}};exports.ViteVersionErrorHandler=s,exports.devLog=n,exports.getErrorOccurredAgo=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react/jsx-runtime");var n=(e,t=`log`)=>n=>{if([`library`].includes(`development`)){let r=`Dev Only - ${e}`;t===`table`?(console.log(r),console[t](n)):console[t](r,n)}};function r(){let e=sessionStorage.getItem(`chunk_error_reload`),t=Date.now();return{now:t,errorOccurredAgo:e?t-parseInt(e,10):0}}function i({duration:n}){let[r,i]=(0,e.useState)(n);return(0,e.useEffect)(()=>{if(r<=0)return;let e=setInterval(()=>{i(e=>e-1)},1e3);return()=>clearInterval(e)},[r]),(0,t.jsx)(t.Fragment,{children:(e=>{let t=Math.floor(e/60),n=e%60;return`${String(t).padStart(2,`0`)}:${String(n).padStart(2,`0`)}`})(r)})}var a=n(`ViteChunkErrorHandler caught an error`,`table`),o=n(`ViteChunkErrorHandler: Chunk error detected, but reloading is blocked.`),s=class extends e.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){a([{error:e,errorInfo:t}]);let n=this.props.bounceRate??1e4,i=e.message||``;if(i.includes(`Failed to fetch dynamically imported module`)||i.includes(`Loading chunk`)||e.name===`ChunkLoadError`){let{errorOccurredAgo:e,now:t}=r();e>n?(sessionStorage.setItem(`chunk_error_reload`,t.toString()),window.location.reload()):(setTimeout(()=>{sessionStorage.setItem(`chunk_error_reload`,t.toString()),window.location.reload()},n-e),o(`Waiting ${e} milliseconds before retrying.`))}}render(){let{errorOccurredAgo:e}=r(),n=this.props.bounceRate??1e4;return this.state.hasError?this.props.fallback??(0,t.jsxs)(`div`,{style:{padding:`2rem`,textAlign:`center`,fontFamily:`sans-serif`},children:[(0,t.jsx)(`h3`,{children:`Updating application...`}),(0,t.jsx)(`p`,{children:`We are loading the latest version of the app.`}),(0,t.jsxs)(`p`,{children:[`Retrying in `,(0,t.jsx)(i,{duration:Math.floor((n-e)/1e3)}),` seconds...`]})]}):this.props.children}};exports.ViteVersionErrorHandler=s,exports.devLog=n,exports.getErrorOccurredAgo=r;
2
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","names":[],"sources":["../src/lib/utils.ts","../src/lib/components/CountdownTimer.tsx","../src/lib/components/ViteVersionErrorHandler.tsx"],"sourcesContent":["/**\r\n * Log level for development-only logging.\r\n */\r\nexport type LogLevel = \"log\" | \"error\" | \"warn\" | \"table\" | \"info\";\r\n\r\n/**\r\n * A development-only logging function that conditionally logs messages based on the environment.\r\n *\r\n * @param {string} message The message to be logged.\r\n * @param {LogLevel} [level='log'] The log level to use (default: 'log').\r\n * @returns void\r\n */\r\nexport const devLog = (message: string, level: LogLevel = \"log\") => {\r\n return (errors?: unknown) => {\r\n if (\r\n [\r\n import.meta.env.MODE, // Prioritize Vite primary support\r\n // process.env.NODE_ENV, // Uncomment for Node environment\r\n ].includes(\"development\")\r\n ) {\r\n const loggedMessage = `Dev Only - ${message}`\r\n if (level === \"table\") {\r\n console.log(loggedMessage);\r\n console[level](errors);\r\n } else {\r\n console[level](loggedMessage, errors);\r\n }\r\n }\r\n };\r\n};\r\n\r\nexport function getErrorOccurredAgo() {\r\n const lastReload = sessionStorage.getItem('chunk_error_reload');\r\n const now = Date.now();\r\n\r\n return {\r\n now,\r\n errorOccurredAgo: !lastReload ? 0 : now - parseInt(lastReload, 10),\r\n };\r\n}","import {useState, useEffect, type JSX} from 'react';\r\n\r\n// Define the type for the component props\r\ninterface CountdownTimerProps {\r\n duration: number;\r\n}\r\n\r\nexport function CountdownTimer({duration}: CountdownTimerProps): JSX.Element {\r\n const [secondsLeft, setSecondsLeft] = useState<number>(duration);\r\n\r\n useEffect(() => {\r\n if (secondsLeft <= 0) return;\r\n\r\n const timerId = setInterval(() => {\r\n setSecondsLeft((prev) => prev - 1);\r\n }, 1000);\r\n\r\n return () => clearInterval(timerId);\r\n }, [secondsLeft]);\r\n\r\n // Helper function to format seconds into MM:SS format\r\n const formatTime = (totalSeconds: number): string => {\r\n const minutes = Math.floor(totalSeconds / 60);\r\n const seconds = totalSeconds % 60;\r\n return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;\r\n };\r\n\r\n return (\r\n <>{formatTime(secondsLeft)}</>\r\n );\r\n}","import {Component, type ErrorInfo, type ReactNode} from 'react';\nimport {devLog, getErrorOccurredAgo} from \"../utils.ts\";\nimport {CountdownTimer} from \"./CountdownTimer.tsx\";\n\ninterface Props {\n children: ReactNode;\n /** Custom fallback UI shown momentarily while the page reloads */\n fallback?: ReactNode;\n bounceRate?: number;\n}\n\ninterface State {\n hasError: boolean;\n}\n\nconst caughtError = devLog('ViteChunkErrorHandler caught an error', \"table\");\nconst blockedReload = devLog('ViteChunkErrorHandler: Chunk error detected, but reloading is blocked.');\n\nexport class ViteVersionErrorHandler extends Component<Props, State> {\n public state: State = {\n hasError: false,\n };\n\n public static getDerivedStateFromError(): State {\n return {hasError: true};\n }\n\n public componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n // Log the error to your analytics or tracking service here\n caughtError([{error, errorInfo}]);\n\n const bounceRate = this.props.bounceRate ?? 10000;\n\n const errorMessage = error.message || '';\n\n // Vite specifically triggers these messages when a hashed chunk file is missing\n const isChunkError =\n errorMessage.includes('Failed to fetch dynamically imported module') ||\n errorMessage.includes('Loading chunk') ||\n error.name === 'ChunkLoadError';\n\n if (isChunkError) {\n // Use sessionStorage to prevent infinite reload loops if the site is completely down\n const {errorOccurredAgo, now} = getErrorOccurredAgo();\n\n // Only auto-reload if we haven't reloaded due to a chunk error in the last 10 seconds\n if (errorOccurredAgo > bounceRate) {\n sessionStorage.setItem('chunk_error_reload', now.toString());\n window.location.reload();\n } else {\n setTimeout(() => {\n sessionStorage.setItem('chunk_error_reload', now.toString());\n window.location.reload();\n }, bounceRate - errorOccurredAgo);\n\n blockedReload(`Waiting ${errorOccurredAgo} milliseconds before retrying.`)\n\n }\n }\n }\n\n\n public render(): ReactNode {\n const {errorOccurredAgo} = getErrorOccurredAgo();\n const bounceRate = this.props.bounceRate ?? 10000;\n\n if (this.state.hasError) {\n return this.props.fallback ?? (\n <div style={{padding: '2rem', textAlign: 'center', fontFamily: 'sans-serif'}}>\n <h3>Updating application...</h3>\n <p>We are loading the latest version of the app.</p>\n <p>Retrying in <CountdownTimer\n duration={Math.floor((bounceRate - errorOccurredAgo) / 1000)}/> seconds...</p>\n </div>\n );\n }\n\n return this.props.children;\n }\n}"],"mappings":"yHAYA,IAAa,GAAU,EAAiB,EAAkB,QAChD,GAAqB,CAC3B,GACE,CAAA,SAGA,CAAC,CAAC,SAAS,aAAa,EACxB,CACA,IAAM,EAAgB,cAAc,IAChC,IAAU,SACZ,QAAQ,IAAI,CAAa,EACzB,QAAQ,EAAM,CAAC,CAAM,GAErB,QAAQ,EAAM,CAAC,EAAe,CAAM,CAExC,CACF,EAGF,SAAgB,GAAsB,CACpC,IAAM,EAAa,eAAe,QAAQ,oBAAoB,EACxD,EAAM,KAAK,IAAI,EAErB,MAAO,CACL,MACA,iBAAmB,EAAiB,EAAM,SAAS,EAAY,EAAE,EAAjC,CAClC,CACF,CChCA,SAAgB,EAAe,CAAC,YAA6C,CAC3E,GAAM,CAAC,EAAa,IAAA,EAAA,EAAA,SAAA,CAAmC,CAAQ,EAmB/D,OAjBA,EAAA,EAAA,UAAA,KAAgB,CACd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,KAAK,MAAM,WAChB,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,MAAO,CAAC,QAAS,OAAQ,UAAW,SAAU,WAAY,YAAY,WAA3E,EACE,EAAA,EAAA,IAAA,CAAC,KAAD,CAAA,SAAI,yBAA2B,CAAA,GAC/B,EAAA,EAAA,IAAA,CAAC,IAAD,CAAA,SAAG,+CAAgD,CAAA,GACnD,EAAA,EAAA,KAAA,CAAC,IAAD,CAAA,SAAA,CAAG,gBAAY,EAAA,EAAA,IAAA,CAAC,EAAD,CACb,SAAU,KAAK,OAAO,EAAa,GAAoB,GAAI,CAAG,CAAA,EAAC,aAAc,CAAA,CAAA,CAC5E,IAIF,KAAK,MAAM,QACpB,CACF"}
package/dist/index.d.ts CHANGED
@@ -1 +1,3 @@
1
- export {}
1
+ export * from './components/ViteVersionErrorHandler';
2
+ export * from './utils';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,SAAS,CAAC"}
package/dist/index.es.js CHANGED
@@ -71,3 +71,5 @@ var l = o("ViteChunkErrorHandler caught an error", "table"), u = o("ViteChunkErr
71
71
  };
72
72
  //#endregion
73
73
  export { d as ViteVersionErrorHandler, o as devLog, s as getErrorOccurredAgo };
74
+
75
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","names":[],"sources":["../src/lib/utils.ts","../src/lib/components/CountdownTimer.tsx","../src/lib/components/ViteVersionErrorHandler.tsx"],"sourcesContent":["/**\r\n * Log level for development-only logging.\r\n */\r\nexport type LogLevel = \"log\" | \"error\" | \"warn\" | \"table\" | \"info\";\r\n\r\n/**\r\n * A development-only logging function that conditionally logs messages based on the environment.\r\n *\r\n * @param {string} message The message to be logged.\r\n * @param {LogLevel} [level='log'] The log level to use (default: 'log').\r\n * @returns void\r\n */\r\nexport const devLog = (message: string, level: LogLevel = \"log\") => {\r\n return (errors?: unknown) => {\r\n if (\r\n [\r\n import.meta.env.MODE, // Prioritize Vite primary support\r\n // process.env.NODE_ENV, // Uncomment for Node environment\r\n ].includes(\"development\")\r\n ) {\r\n const loggedMessage = `Dev Only - ${message}`\r\n if (level === \"table\") {\r\n console.log(loggedMessage);\r\n console[level](errors);\r\n } else {\r\n console[level](loggedMessage, errors);\r\n }\r\n }\r\n };\r\n};\r\n\r\nexport function getErrorOccurredAgo() {\r\n const lastReload = sessionStorage.getItem('chunk_error_reload');\r\n const now = Date.now();\r\n\r\n return {\r\n now,\r\n errorOccurredAgo: !lastReload ? 0 : now - parseInt(lastReload, 10),\r\n };\r\n}","import {useState, useEffect, type JSX} from 'react';\r\n\r\n// Define the type for the component props\r\ninterface CountdownTimerProps {\r\n duration: number;\r\n}\r\n\r\nexport function CountdownTimer({duration}: CountdownTimerProps): JSX.Element {\r\n const [secondsLeft, setSecondsLeft] = useState<number>(duration);\r\n\r\n useEffect(() => {\r\n if (secondsLeft <= 0) return;\r\n\r\n const timerId = setInterval(() => {\r\n setSecondsLeft((prev) => prev - 1);\r\n }, 1000);\r\n\r\n return () => clearInterval(timerId);\r\n }, [secondsLeft]);\r\n\r\n // Helper function to format seconds into MM:SS format\r\n const formatTime = (totalSeconds: number): string => {\r\n const minutes = Math.floor(totalSeconds / 60);\r\n const seconds = totalSeconds % 60;\r\n return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;\r\n };\r\n\r\n return (\r\n <>{formatTime(secondsLeft)}</>\r\n );\r\n}","import {Component, type ErrorInfo, type ReactNode} from 'react';\nimport {devLog, getErrorOccurredAgo} from \"../utils.ts\";\nimport {CountdownTimer} from \"./CountdownTimer.tsx\";\n\ninterface Props {\n children: ReactNode;\n /** Custom fallback UI shown momentarily while the page reloads */\n fallback?: ReactNode;\n bounceRate?: number;\n}\n\ninterface State {\n hasError: boolean;\n}\n\nconst caughtError = devLog('ViteChunkErrorHandler caught an error', \"table\");\nconst blockedReload = devLog('ViteChunkErrorHandler: Chunk error detected, but reloading is blocked.');\n\nexport class ViteVersionErrorHandler extends Component<Props, State> {\n public state: State = {\n hasError: false,\n };\n\n public static getDerivedStateFromError(): State {\n return {hasError: true};\n }\n\n public componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n // Log the error to your analytics or tracking service here\n caughtError([{error, errorInfo}]);\n\n const bounceRate = this.props.bounceRate ?? 10000;\n\n const errorMessage = error.message || '';\n\n // Vite specifically triggers these messages when a hashed chunk file is missing\n const isChunkError =\n errorMessage.includes('Failed to fetch dynamically imported module') ||\n errorMessage.includes('Loading chunk') ||\n error.name === 'ChunkLoadError';\n\n if (isChunkError) {\n // Use sessionStorage to prevent infinite reload loops if the site is completely down\n const {errorOccurredAgo, now} = getErrorOccurredAgo();\n\n // Only auto-reload if we haven't reloaded due to a chunk error in the last 10 seconds\n if (errorOccurredAgo > bounceRate) {\n sessionStorage.setItem('chunk_error_reload', now.toString());\n window.location.reload();\n } else {\n setTimeout(() => {\n sessionStorage.setItem('chunk_error_reload', now.toString());\n window.location.reload();\n }, bounceRate - errorOccurredAgo);\n\n blockedReload(`Waiting ${errorOccurredAgo} milliseconds before retrying.`)\n\n }\n }\n }\n\n\n public render(): ReactNode {\n const {errorOccurredAgo} = getErrorOccurredAgo();\n const bounceRate = this.props.bounceRate ?? 10000;\n\n if (this.state.hasError) {\n return this.props.fallback ?? (\n <div style={{padding: '2rem', textAlign: 'center', fontFamily: 'sans-serif'}}>\n <h3>Updating application...</h3>\n <p>We are loading the latest version of the app.</p>\n <p>Retrying in <CountdownTimer\n duration={Math.floor((bounceRate - errorOccurredAgo) / 1000)}/> seconds...</p>\n </div>\n );\n }\n\n return this.props.children;\n }\n}"],"mappings":";;;AAYA,IAAa,KAAU,GAAiB,IAAkB,WAChD,MAAqB;CAC3B,IACE,CAAA,SAGA,CAAC,CAAC,SAAS,aAAa,GACxB;EACA,IAAM,IAAgB,cAAc;E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AAkB,WAAO,EAAoB;GAGpD,AAAI,IAAmB,KACrB,eAAe,QAAQ,sBAAsB,EAAI,SAAS,CAAC,GAC3D,OAAO,SAAS,OAAO,MAEvB,iBAAiB;IAEf,AADA,eAAe,QAAQ,sBAAsB,EAAI,SAAS,CAAC,GAC3D,OAAO,SAAS,OAAO;GACzB,GAAG,IAAa,CAAgB,GAEhC,EAAc,WAAW,EAAiB,+BAA+B;EAG7E;CACF;CAGA,SAA2B;EACzB,IAAM,EAAC,wBAAoB,EAAoB,GACzC,IAAa,KAAK,MAAM,cAAc;EAa5C,OAXI,KAAK,MAAM,WACN,KAAK,MAAM,YAChB,kBAAC,OAAD;GAAK,OAAO;IAAC,SAAS;IAAQ,WAAW;IAAU,YAAY;GAAY;aAA3E;IACE,kBAAC,MAAD,EAAA,UAAI,0BAA2B,CAAA;IAC/B,kBAAC,KAAD,EAAA,UAAG,gDAAgD,CAAA;IACnD,kBAAC,KAAD,EAAA,UAAA;KAAG;KAAY,kBAAC,GAAD,EACb,UAAU,KAAK,OAAO,IAAa,KAAoB,GAAI,EAAG,CAAA;KAAC;IAAc,EAAA,CAAA;GAC5E;OAIF,KAAK,MAAM;CACpB;AACF"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Log level for development-only logging.
3
+ */
4
+ export type LogLevel = "log" | "error" | "warn" | "table" | "info";
5
+ /**
6
+ * A development-only logging function that conditionally logs messages based on the environment.
7
+ *
8
+ * @param {string} message The message to be logged.
9
+ * @param {LogLevel} [level='log'] The log level to use (default: 'log').
10
+ * @returns void
11
+ */
12
+ export declare const devLog: (message: string, level?: LogLevel) => (errors?: unknown) => void;
13
+ export declare function getErrorOccurredAgo(): {
14
+ now: number;
15
+ errorOccurredAgo: number;
16
+ };
17
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,GAAI,SAAS,MAAM,EAAE,QAAO,QAAgB,MACrD,SAAS,OAAO,SAgBzB,CAAC;AAEF,wBAAgB,mBAAmB;;;EAQlC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chris-c-brine/vite-version-update-helper",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"