@ovineko/spa-guard 0.0.1-alpha-18 → 0.0.1-alpha-19

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/dist/_internal.js CHANGED
@@ -7,19 +7,19 @@ import {
7
7
  serializeError,
8
8
  shouldForceRetry,
9
9
  shouldIgnoreMessages
10
- } from "./chunk-DCOE7VRF.js";
10
+ } from "./chunk-4FKSMB5F.js";
11
11
  import {
12
12
  SPINNER_ID,
13
13
  defaultSpinnerSvg,
14
14
  extractVersionFromHtml
15
- } from "./chunk-EHIXY2ZY.js";
15
+ } from "./chunk-3ISQYZVD.js";
16
16
  import {
17
17
  applyI18n,
18
18
  defaultErrorFallbackHtml,
19
19
  defaultLoadingFallbackHtml,
20
20
  getI18n,
21
21
  getOptions
22
- } from "./chunk-SHRE3V6T.js";
22
+ } from "./chunk-DOTM7FSY.js";
23
23
  import {
24
24
  dispatchAsyncRuntimeError,
25
25
  dispatchChunkLoadError,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  defaultSpinnerHtml,
3
3
  getOptions
4
- } from "./chunk-SHRE3V6T.js";
4
+ } from "./chunk-DOTM7FSY.js";
5
5
 
6
6
  // src/common/parseVersion.ts
7
7
  function extractVersionFromHtml(html) {
@@ -45,6 +45,10 @@ function getSpinnerHtml(backgroundOverride) {
45
45
  return `<div id="${SPINNER_ID}" style="position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;background:var(--spa-guard-spinner-bg,${bg})">${spinnerContent}</div>`;
46
46
  }
47
47
  function showSpinner(options) {
48
+ if (typeof document === "undefined") {
49
+ return () => {
50
+ };
51
+ }
48
52
  const opts = getOptions();
49
53
  if (opts.spinner?.disabled) {
50
54
  return () => {
@@ -2,7 +2,7 @@ import {
2
2
  applyI18n,
3
3
  getI18n,
4
4
  getOptions
5
- } from "./chunk-SHRE3V6T.js";
5
+ } from "./chunk-DOTM7FSY.js";
6
6
  import {
7
7
  FORCE_RETRY_MAGIC,
8
8
  RETRY_ATTEMPT_PARAM,
@@ -64,7 +64,7 @@ function setTranslations(translations) {
64
64
  // src/common/html.generated.ts
65
65
  var defaultErrorFallbackHtml = `<style>.spa-guard-error-id:has(.spa-guard-retry-id:empty){display:none}.spa-guard-error-id{font-family:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace}</style><div style="display:flex;align-items:center;justify-content:center;min-height:100vh;padding:2rem;font-family:system-ui,sans-serif"><div style="text-align:center;max-width:480px"><div style="margin-bottom:1.5rem"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="none" viewBox="0 0 24 24" stroke="#b0b0b0" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg></div><h1 data-spa-guard-content="heading" style="font-size:1.375rem;font-weight:600;margin:0 0 .5rem;color:#1a1a1a;line-height:1.3">Something went wrong</h1><p data-spa-guard-content="message" style="max-width:600px;margin:0 auto 1.5rem;color:#666;font-size:.9375rem;line-height:1.5">Please refresh the page to continue.</p><div style="display:flex;gap:.5rem;justify-content:center;flex-wrap:wrap"><button data-spa-guard-action="try-again" type="button" style="display:none;padding:.5rem 1.25rem;font-size:.875rem;font-family:inherit;border-radius:6px;border:1px solid #d0d0d0;background:#fff;color:#333;cursor:pointer;line-height:1.5">Try again</button> <button data-spa-guard-action="reload" type="button" style="padding:.5rem 1.25rem;font-size:.875rem;font-family:inherit;border-radius:6px;border:1px solid transparent;background:#111;color:#fff;cursor:pointer;line-height:1.5">Reload page</button></div><p class="spa-guard-error-id" style="margin-top:1.5rem;font-size:.6875rem;color:#999">Error ID: <span class="spa-guard-retry-id"></span></p></div></div>`;
66
66
  var defaultLoadingFallbackHtml = `<div style="display:flex;align-items:center;justify-content:center;min-height:100vh;padding:2rem;font-family:system-ui,sans-serif"><div style="text-align:center"><div data-spa-guard-spinner style="margin-bottom:1.25rem"></div><h2 data-spa-guard-content="loading" style="font-size:1.125rem;font-weight:600;margin:0 0 .25rem;color:#1a1a1a">Loading...</h2><p data-spa-guard-section="retrying" style="display:none;font-size:.8125rem;color:#999;margin:.5rem 0 0"><span data-spa-guard-content="retrying">Retry attempt</span> <span data-spa-guard-content="attempt"></span></p></div></div>`;
67
- var defaultSpinnerHtml = `<svg width="40" height="40" viewBox="0 0 40 40" style="animation:spa-guard-spin .8s linear infinite;width:100%;height:100%;aspect-ratio:1/1"><circle cx="20" cy="20" r="16" fill="none" stroke="#e8e8e8" stroke-width="3"/><circle cx="20" cy="20" r="16" fill="none" stroke="#666" stroke-width="3" stroke-dasharray="80" stroke-dashoffset="60" stroke-linecap="round"/></svg><style>@keyframes spa-guard-spin{to{transform:rotate(360deg)}}</style>`;
67
+ var defaultSpinnerHtml = `<svg width="40" height="40" viewBox="0 0 40 40" style="animation:spa-guard-spin .8s linear infinite"><circle cx="20" cy="20" r="16" fill="none" stroke="#e8e8e8" stroke-width="3"/><circle cx="20" cy="20" r="16" fill="none" stroke="#666" stroke-width="3" stroke-dasharray="80" stroke-dashoffset="60" stroke-linecap="round"/></svg><style>@keyframes spa-guard-spin{to{transform:rotate(360deg)}}</style>`;
68
68
 
69
69
  // src/common/options.ts
70
70
  var options_exports = {};
@@ -1,3 +1,3 @@
1
1
  export declare const defaultErrorFallbackHtml = "<style>.spa-guard-error-id:has(.spa-guard-retry-id:empty){display:none}.spa-guard-error-id{font-family:ui-monospace,SFMono-Regular,Consolas,\"Liberation Mono\",Menlo,monospace}</style><div style=\"display:flex;align-items:center;justify-content:center;min-height:100vh;padding:2rem;font-family:system-ui,sans-serif\"><div style=\"text-align:center;max-width:480px\"><div style=\"margin-bottom:1.5rem\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"#b0b0b0\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"/><line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"/></svg></div><h1 data-spa-guard-content=\"heading\" style=\"font-size:1.375rem;font-weight:600;margin:0 0 .5rem;color:#1a1a1a;line-height:1.3\">Something went wrong</h1><p data-spa-guard-content=\"message\" style=\"max-width:600px;margin:0 auto 1.5rem;color:#666;font-size:.9375rem;line-height:1.5\">Please refresh the page to continue.</p><div style=\"display:flex;gap:.5rem;justify-content:center;flex-wrap:wrap\"><button data-spa-guard-action=\"try-again\" type=\"button\" style=\"display:none;padding:.5rem 1.25rem;font-size:.875rem;font-family:inherit;border-radius:6px;border:1px solid #d0d0d0;background:#fff;color:#333;cursor:pointer;line-height:1.5\">Try again</button> <button data-spa-guard-action=\"reload\" type=\"button\" style=\"padding:.5rem 1.25rem;font-size:.875rem;font-family:inherit;border-radius:6px;border:1px solid transparent;background:#111;color:#fff;cursor:pointer;line-height:1.5\">Reload page</button></div><p class=\"spa-guard-error-id\" style=\"margin-top:1.5rem;font-size:.6875rem;color:#999\">Error ID: <span class=\"spa-guard-retry-id\"></span></p></div></div>";
2
2
  export declare const defaultLoadingFallbackHtml = "<div style=\"display:flex;align-items:center;justify-content:center;min-height:100vh;padding:2rem;font-family:system-ui,sans-serif\"><div style=\"text-align:center\"><div data-spa-guard-spinner style=\"margin-bottom:1.25rem\"></div><h2 data-spa-guard-content=\"loading\" style=\"font-size:1.125rem;font-weight:600;margin:0 0 .25rem;color:#1a1a1a\">Loading...</h2><p data-spa-guard-section=\"retrying\" style=\"display:none;font-size:.8125rem;color:#999;margin:.5rem 0 0\"><span data-spa-guard-content=\"retrying\">Retry attempt</span> <span data-spa-guard-content=\"attempt\"></span></p></div></div>";
3
- export declare const defaultSpinnerHtml = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" style=\"animation:spa-guard-spin .8s linear infinite;width:100%;height:100%;aspect-ratio:1/1\"><circle cx=\"20\" cy=\"20\" r=\"16\" fill=\"none\" stroke=\"#e8e8e8\" stroke-width=\"3\"/><circle cx=\"20\" cy=\"20\" r=\"16\" fill=\"none\" stroke=\"#666\" stroke-width=\"3\" stroke-dasharray=\"80\" stroke-dashoffset=\"60\" stroke-linecap=\"round\"/></svg><style>@keyframes spa-guard-spin{to{transform:rotate(360deg)}}</style>";
3
+ export declare const defaultSpinnerHtml = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" style=\"animation:spa-guard-spin .8s linear infinite\"><circle cx=\"20\" cy=\"20\" r=\"16\" fill=\"none\" stroke=\"#e8e8e8\" stroke-width=\"3\"/><circle cx=\"20\" cy=\"20\" r=\"16\" fill=\"none\" stroke=\"#666\" stroke-width=\"3\" stroke-dasharray=\"80\" stroke-dashoffset=\"60\" stroke-linecap=\"round\"/></svg><style>@keyframes spa-guard-spin{to{transform:rotate(360deg)}}</style>";
@@ -2,10 +2,10 @@ import {
2
2
  createLogger,
3
3
  listenInternal,
4
4
  serializeError
5
- } from "../chunk-DCOE7VRF.js";
5
+ } from "../chunk-4FKSMB5F.js";
6
6
  import {
7
7
  options_exports
8
- } from "../chunk-SHRE3V6T.js";
8
+ } from "../chunk-DOTM7FSY.js";
9
9
  import {
10
10
  ForceRetryError,
11
11
  disableDefaultRetry,
@@ -4,7 +4,7 @@
4
4
  export interface RetryImportOptions {
5
5
  /**
6
6
  * If true and all retries fail with a chunk error, calls attemptReload before rethrowing.
7
- * @default false
7
+ * @default true (when used via lazyWithRetry)
8
8
  */
9
9
  callReloadOnFailure?: boolean;
10
10
  /**
@@ -1,5 +1,5 @@
1
1
  export declare const SPINNER_ID = "__spa-guard-spinner";
2
- export declare const defaultSpinnerSvg = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" style=\"animation:spa-guard-spin .8s linear infinite;width:100%;height:100%;aspect-ratio:1/1\"><circle cx=\"20\" cy=\"20\" r=\"16\" fill=\"none\" stroke=\"#e8e8e8\" stroke-width=\"3\"/><circle cx=\"20\" cy=\"20\" r=\"16\" fill=\"none\" stroke=\"#666\" stroke-width=\"3\" stroke-dasharray=\"80\" stroke-dashoffset=\"60\" stroke-linecap=\"round\"/></svg><style>@keyframes spa-guard-spin{to{transform:rotate(360deg)}}</style>";
2
+ export declare const defaultSpinnerSvg = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" style=\"animation:spa-guard-spin .8s linear infinite\"><circle cx=\"20\" cy=\"20\" r=\"16\" fill=\"none\" stroke=\"#e8e8e8\" stroke-width=\"3\"/><circle cx=\"20\" cy=\"20\" r=\"16\" fill=\"none\" stroke=\"#666\" stroke-width=\"3\" stroke-dasharray=\"80\" stroke-dashoffset=\"60\" stroke-linecap=\"round\"/></svg><style>@keyframes spa-guard-spin{to{transform:rotate(360deg)}}</style>";
3
3
  export declare function dismissSpinner(): void;
4
4
  export declare function getSpinnerHtml(backgroundOverride?: string): string;
5
5
  export declare function showSpinner(options?: {
@@ -3,11 +3,11 @@ import {
3
3
  extractVersionFromHtml,
4
4
  getSpinnerHtml,
5
5
  showSpinner
6
- } from "../chunk-EHIXY2ZY.js";
6
+ } from "../chunk-3ISQYZVD.js";
7
7
  import {
8
8
  getOptions,
9
9
  setTranslations
10
- } from "../chunk-SHRE3V6T.js";
10
+ } from "../chunk-DOTM7FSY.js";
11
11
  import {
12
12
  getState,
13
13
  subscribeToState
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovineko/spa-guard",
3
- "version": "0.0.1-alpha-18",
3
+ "version": "0.0.1-alpha-19",
4
4
  "description": "Chunk load error handling for SPAs — core runtime, error handling, schema, i18n",
5
5
  "keywords": [
6
6
  "spa",
@@ -23,7 +23,9 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "author": "Alexander Svinarev <shibanet0@gmail.com> (shibanet0.com)",
26
- "sideEffects": false,
26
+ "sideEffects": [
27
+ "./dist/chunk-*.js"
28
+ ],
27
29
  "type": "module",
28
30
  "exports": {
29
31
  ".": {
@@ -57,10 +59,7 @@
57
59
  "./package.json": "./package.json"
58
60
  },
59
61
  "files": [
60
- "dist",
61
- "dist-inline",
62
- "dist-inline-trace",
63
- "README.md"
62
+ "dist"
64
63
  ],
65
64
  "engines": {
66
65
  "node": ">=22.15.0"