@askrjs/askr 0.0.4 → 0.0.5

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.
Files changed (83) hide show
  1. package/dist/fx.js +636 -0
  2. package/dist/fx.js.map +1 -0
  3. package/dist/index.js +3709 -42
  4. package/dist/index.js.map +1 -1
  5. package/dist/{jsx/jsx-dev-runtime.d.ts → jsx-dev-runtime.d.ts} +3 -3
  6. package/dist/jsx-dev-runtime.js +17 -0
  7. package/dist/jsx-dev-runtime.js.map +1 -0
  8. package/dist/jsx-runtime.d.ts +14 -0
  9. package/dist/{chunk-SALJX5PZ.js → jsx-runtime.js} +6 -9
  10. package/dist/jsx-runtime.js.map +1 -0
  11. package/dist/{fx/index.cjs → resources.js} +45 -453
  12. package/dist/resources.js.map +1 -0
  13. package/dist/{router/index.d.ts → router.d.ts} +2 -2
  14. package/dist/{router/index.cjs → router.js} +14 -116
  15. package/dist/router.js.map +1 -0
  16. package/dist/{ssr/index.d.ts → ssr.d.ts} +2 -2
  17. package/dist/{ssr/index.cjs → ssr.js} +17 -150
  18. package/dist/ssr.js.map +1 -0
  19. package/dist/{types-CZHOAiC1.d.ts → types-uOPfcrdz.d.ts} +3 -1
  20. package/dist/vite/index.d.ts +17 -0
  21. package/dist/vite/index.js +2306 -0
  22. package/dist/vite/index.js.map +1 -0
  23. package/package.json +19 -23
  24. package/dist/chunk-64C7W2AE.js +0 -43
  25. package/dist/chunk-64C7W2AE.js.map +0 -1
  26. package/dist/chunk-6FLMH4EL.js +0 -124
  27. package/dist/chunk-6FLMH4EL.js.map +0 -1
  28. package/dist/chunk-FJUXFA72.js +0 -16
  29. package/dist/chunk-FJUXFA72.js.map +0 -1
  30. package/dist/chunk-SALJX5PZ.js.map +0 -1
  31. package/dist/chunk-VRAEBIJ3.js +0 -82
  32. package/dist/chunk-VRAEBIJ3.js.map +0 -1
  33. package/dist/chunk-WTFWRSHB.js +0 -98
  34. package/dist/chunk-WTFWRSHB.js.map +0 -1
  35. package/dist/chunk-XHKZGJE3.js +0 -2907
  36. package/dist/chunk-XHKZGJE3.js.map +0 -1
  37. package/dist/chunk-Z5ZSTLYF.js +0 -420
  38. package/dist/chunk-Z5ZSTLYF.js.map +0 -1
  39. package/dist/fx/index.cjs.map +0 -1
  40. package/dist/fx/index.d.ts +0 -186
  41. package/dist/fx/index.js +0 -418
  42. package/dist/fx/index.js.map +0 -1
  43. package/dist/index.cjs +0 -4035
  44. package/dist/index.cjs.map +0 -1
  45. package/dist/index.d.cts +0 -168
  46. package/dist/jsx/jsx-dev-runtime.cjs +0 -46
  47. package/dist/jsx/jsx-dev-runtime.cjs.map +0 -1
  48. package/dist/jsx/jsx-dev-runtime.d.cts +0 -12
  49. package/dist/jsx/jsx-dev-runtime.js +0 -19
  50. package/dist/jsx/jsx-dev-runtime.js.map +0 -1
  51. package/dist/jsx/jsx-runtime.cjs +0 -54
  52. package/dist/jsx/jsx-runtime.cjs.map +0 -1
  53. package/dist/jsx/jsx-runtime.d.cts +0 -21
  54. package/dist/jsx/jsx-runtime.d.ts +0 -21
  55. package/dist/jsx/jsx-runtime.js +0 -16
  56. package/dist/jsx/jsx-runtime.js.map +0 -1
  57. package/dist/jsx-AzPM8gMS.d.cts +0 -35
  58. package/dist/navigate-LUVYHYZZ.js +0 -17
  59. package/dist/navigate-LUVYHYZZ.js.map +0 -1
  60. package/dist/resources/index.cjs +0 -1200
  61. package/dist/resources/index.cjs.map +0 -1
  62. package/dist/resources/index.d.ts +0 -21
  63. package/dist/resources/index.js +0 -278
  64. package/dist/resources/index.js.map +0 -1
  65. package/dist/route-BCND6MPK.js +0 -32
  66. package/dist/route-BCND6MPK.js.map +0 -1
  67. package/dist/router/index.cjs.map +0 -1
  68. package/dist/router/index.d.cts +0 -64
  69. package/dist/router/index.js +0 -49
  70. package/dist/router/index.js.map +0 -1
  71. package/dist/router-DaGtH1Sq.d.cts +0 -36
  72. package/dist/ssr/index.cjs.map +0 -1
  73. package/dist/ssr/index.d.cts +0 -123
  74. package/dist/ssr/index.js +0 -666
  75. package/dist/ssr/index.js.map +0 -1
  76. package/dist/types-CZ5sWur5.d.cts +0 -23
  77. package/src/jsx/index.ts +0 -4
  78. package/src/jsx/jsx-dev-runtime.ts +0 -23
  79. package/src/jsx/jsx-runtime.ts +0 -48
  80. package/src/jsx/types.ts +0 -33
  81. package/src/jsx/utils.ts +0 -19
  82. /package/dist/{fx/index.d.cts → fx.d.ts} +0 -0
  83. /package/dist/{resources/index.d.cts → resources.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
- import { P as Props, J as JSXElement } from '../jsx-AzPM8gMS.js';
2
- import { b as RouteHandler } from '../router-DaGtH1Sq.js';
1
+ import { P as Props, J as JSXElement } from './jsx-AzPM8gMS.js';
2
+ import { b as RouteHandler } from './router-DaGtH1Sq.js';
3
3
 
4
4
  /**
5
5
  * Common call contracts: SSR error types
@@ -1,37 +1,8 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
2
  var __export = (target, all) => {
7
3
  for (var name in all)
8
4
  __defProp(target, name, { get: all[name], enumerable: true });
9
5
  };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/ssr/index.ts
21
- var ssr_exports = {};
22
- __export(ssr_exports, {
23
- SSRDataMissingError: () => SSRDataMissingError,
24
- collectResources: () => collectResources,
25
- popSSRStrictPurityGuard: () => popSSRStrictPurityGuard,
26
- pushSSRStrictPurityGuard: () => pushSSRStrictPurityGuard,
27
- renderToStream: () => renderToStream,
28
- renderToString: () => renderToString,
29
- renderToStringSync: () => renderToStringSync,
30
- renderToStringSyncForUrl: () => renderToStringSyncForUrl,
31
- resolvePlan: () => resolvePlan,
32
- resolveResources: () => resolveResources
33
- });
34
- module.exports = __toCommonJS(ssr_exports);
35
6
 
36
7
  // src/router/route.ts
37
8
  var route_exports = {};
@@ -86,7 +57,7 @@ function match(path, pattern) {
86
57
  // src/dev/invariant.ts
87
58
  function invariant(condition, message, context) {
88
59
  if (!condition) {
89
- const contextStr = context ? "\n" + JSON.stringify(context, null, 2) : "";
60
+ const contextStr = "";
90
61
  throw new Error(`[Askr Invariant] ${message}${contextStr}`);
91
62
  }
92
63
  }
@@ -131,7 +102,6 @@ function isBulkCommitActive() {
131
102
  const fb = globalThis.__ASKR_FASTLANE;
132
103
  return typeof fb?.isBulkCommitActive === "function" ? !!fb.isBulkCommitActive() : false;
133
104
  } catch (e) {
134
- void e;
135
105
  return false;
136
106
  }
137
107
  }
@@ -284,7 +254,6 @@ var Scheduler = class {
284
254
  this.resolveWaiters();
285
255
  }
286
256
  } catch (e) {
287
- void e;
288
257
  }
289
258
  this.allowSyncProgress = prev;
290
259
  }
@@ -346,7 +315,6 @@ var Scheduler = class {
346
315
  this.flushVersion++;
347
316
  this.resolveWaiters();
348
317
  } catch (e) {
349
- void e;
350
318
  }
351
319
  });
352
320
  return remaining;
@@ -402,7 +370,6 @@ function getDiagMap() {
402
370
  if (!root.__ASKR_DIAG) root.__ASKR_DIAG = {};
403
371
  return root.__ASKR_DIAG;
404
372
  } catch (e) {
405
- void e;
406
373
  return {};
407
374
  }
408
375
  }
@@ -426,7 +393,6 @@ function __ASKR_set(key, value) {
426
393
  void e;
427
394
  }
428
395
  } catch (e) {
429
- void e;
430
396
  }
431
397
  }
432
398
  function __ASKR_incCounter(key) {
@@ -448,7 +414,6 @@ function __ASKR_incCounter(key) {
448
414
  void e;
449
415
  }
450
416
  } catch (e) {
451
- void e;
452
417
  }
453
418
  }
454
419
 
@@ -756,7 +721,6 @@ function markFastPathApplied(parent) {
756
721
  try {
757
722
  _appliedParents.add(parent);
758
723
  } catch (e) {
759
- void e;
760
724
  }
761
725
  }
762
726
  function isFastPathApplied(parent) {
@@ -989,13 +953,11 @@ function cleanupSingleInstance(node, errors, strict) {
989
953
  try {
990
954
  cleanupComponent(inst);
991
955
  } catch (err) {
992
- if (strict) errors.push(err);
993
- else logger.warn("[Askr] cleanupComponent failed:", err);
956
+ logger.warn("[Askr] cleanupComponent failed:", err);
994
957
  }
995
958
  try {
996
959
  delete node.__ASKR_INSTANCE;
997
960
  } catch (e) {
998
- if (strict) errors.push(e);
999
961
  }
1000
962
  }
1001
963
  function forEachDescendantElement(root, visit) {
@@ -1020,20 +982,19 @@ function forEachDescendantElement(root, visit) {
1020
982
  }
1021
983
  function cleanupInstanceIfPresent(node, opts) {
1022
984
  if (!node || !(node instanceof Element)) return;
1023
- const strict = opts?.strict ?? false;
1024
- const errors = strict ? [] : null;
985
+ const strict = false;
986
+ const errors = null;
1025
987
  try {
1026
988
  cleanupSingleInstance(node, errors, strict);
1027
989
  } catch (err) {
1028
- if (strict) errors.push(err);
1029
- else logger.warn("[Askr] cleanupInstanceIfPresent failed:", err);
990
+ logger.warn("[Askr] cleanupInstanceIfPresent failed:", err);
1030
991
  }
1031
992
  try {
1032
993
  forEachDescendantElement(node, (d) => {
1033
994
  try {
1034
995
  cleanupSingleInstance(d, errors, strict);
1035
996
  } catch (err) {
1036
- if (strict) errors.push(err);
997
+ if (strict) ;
1037
998
  else
1038
999
  logger.warn(
1039
1000
  "[Askr] cleanupInstanceIfPresent descendant cleanup failed:",
@@ -1042,19 +1003,14 @@ function cleanupInstanceIfPresent(node, opts) {
1042
1003
  }
1043
1004
  });
1044
1005
  } catch (err) {
1045
- if (strict) errors.push(err);
1046
- else
1047
- logger.warn(
1006
+ logger.warn(
1048
1007
  "[Askr] cleanupInstanceIfPresent descendant query failed:",
1049
1008
  err
1050
1009
  );
1051
1010
  }
1052
- if (errors && errors.length > 0) {
1053
- throw new AggregateError(errors, "cleanupInstanceIfPresent failed");
1054
- }
1055
1011
  }
1056
1012
  function cleanupInstancesUnder(node, opts) {
1057
- cleanupInstanceIfPresent(node, opts);
1013
+ cleanupInstanceIfPresent(node);
1058
1014
  }
1059
1015
  var elementListeners = /* @__PURE__ */ new WeakMap();
1060
1016
  function removeElementListeners(element) {
@@ -1074,9 +1030,6 @@ function removeAllListeners(root) {
1074
1030
  forEachDescendantElement(root, removeElementListeners);
1075
1031
  }
1076
1032
 
1077
- // src/jsx/jsx-runtime.ts
1078
- var Fragment2 = /* @__PURE__ */ Symbol.for("askr.fragment");
1079
-
1080
1033
  // src/renderer/dom.ts
1081
1034
  var IS_DOM_AVAILABLE = typeof document !== "undefined";
1082
1035
  function addTrackedListener(el, eventName, handler) {
@@ -1202,7 +1155,7 @@ function createDOMNode(node) {
1202
1155
  if (typeof type === "function") {
1203
1156
  return createComponentElement(node, type, props);
1204
1157
  }
1205
- if (typeof type === "symbol" && (type === Fragment2 || String(type) === "Symbol(Fragment)")) {
1158
+ if (typeof type === "symbol" && (type === Fragment || String(type) === "Symbol(Fragment)")) {
1206
1159
  return createFragmentElement(node, props);
1207
1160
  }
1208
1161
  }
@@ -1824,7 +1777,6 @@ function applyRendererFastPath(parent, keyedVnodes, oldKeyMap, unkeyedVnodes) {
1824
1777
  parentChildrenArr[i] = pc[i];
1825
1778
  } catch (e) {
1826
1779
  parentChildrenArr = void 0;
1827
- void e;
1828
1780
  }
1829
1781
  } else {
1830
1782
  localOldKeyMap = /* @__PURE__ */ new Map();
@@ -1839,7 +1791,6 @@ function applyRendererFastPath(parent, keyedVnodes, oldKeyMap, unkeyedVnodes) {
1839
1791
  }
1840
1792
  } catch (e) {
1841
1793
  localOldKeyMap = void 0;
1842
- void e;
1843
1794
  }
1844
1795
  }
1845
1796
  const finalNodes = [];
@@ -1960,7 +1911,6 @@ function applyRendererFastPath(parent, keyedVnodes, oldKeyMap, unkeyedVnodes) {
1960
1911
  }
1961
1912
  return newKeyMap;
1962
1913
  } catch (e) {
1963
- void e;
1964
1914
  return null;
1965
1915
  }
1966
1916
  }
@@ -2447,8 +2397,7 @@ function updateElementChildren2(element, vnodeChildren) {
2447
2397
  function smartUpdateElement(element, vnode) {
2448
2398
  const vnodeChildren = vnode.children || vnode.props?.children;
2449
2399
  const textCheck = checkSimpleText(vnodeChildren);
2450
- if (textCheck.isSimple && tryUpdateTextInPlace(element, textCheck.text)) {
2451
- } else {
2400
+ if (textCheck.isSimple && tryUpdateTextInPlace(element, textCheck.text)) ; else {
2452
2401
  updateElementChildren2(element, vnodeChildren);
2453
2402
  }
2454
2403
  updateElementFromVnode(element, vnode, false);
@@ -2539,7 +2488,6 @@ function evaluate(node, target, context) {
2539
2488
  try {
2540
2489
  console.warn("[Askr] evaluate() called in non-DOM environment; no-op.");
2541
2490
  } catch (e) {
2542
- void e;
2543
2491
  }
2544
2492
  }
2545
2493
  return;
@@ -2654,7 +2602,6 @@ function createComponentInstance(id, fn, props, target) {
2654
2602
  return instance;
2655
2603
  }
2656
2604
  var currentInstance = null;
2657
- var stateIndex = 0;
2658
2605
  function getCurrentComponentInstance() {
2659
2606
  return currentInstance;
2660
2607
  }
@@ -2683,7 +2630,6 @@ function mountInstanceInline(instance, target) {
2683
2630
  if (target instanceof Element)
2684
2631
  target.__ASKR_INSTANCE = instance;
2685
2632
  } catch (err) {
2686
- void err;
2687
2633
  }
2688
2634
  instance.notifyUpdate = instance._enqueueRun;
2689
2635
  const wasFirstMount = !instance.mounted;
@@ -2798,7 +2744,6 @@ function runComponent(instance) {
2798
2744
  }
2799
2745
  }
2800
2746
  } catch (_err) {
2801
- void _err;
2802
2747
  }
2803
2748
  try {
2804
2749
  try {
@@ -2848,7 +2793,6 @@ function executeComponentSync(instance) {
2848
2793
  }
2849
2794
  instance._pendingReadStates = /* @__PURE__ */ new Set();
2850
2795
  currentInstance = instance;
2851
- stateIndex = 0;
2852
2796
  try {
2853
2797
  const renderStartTime = process.env.NODE_ENV !== "production" ? Date.now() : 0;
2854
2798
  const context = {
@@ -3311,7 +3255,6 @@ function definePortal() {
3311
3255
  }
3312
3256
  return inst && owner && inst === owner ? pending : void 0;
3313
3257
  };
3314
- var HostFallback = HostFallback2;
3315
3258
  let owner = null;
3316
3259
  let pending;
3317
3260
  HostFallback2.render = function RenderFallback(props) {
@@ -3386,81 +3329,25 @@ var SSRDataMissingError = class _SSRDataMissingError extends Error {
3386
3329
  Object.setPrototypeOf(this, _SSRDataMissingError.prototype);
3387
3330
  }
3388
3331
  };
3389
-
3390
- // src/ssr/context.ts
3391
- var current = null;
3392
3332
  function withSSRContext(ctx, fn) {
3393
- const prev = current;
3394
- current = ctx;
3395
3333
  try {
3396
3334
  return fn();
3397
3335
  } finally {
3398
- current = prev;
3399
3336
  }
3400
3337
  }
3401
3338
  function createRenderContext(seed = 12345) {
3402
3339
  return { seed };
3403
3340
  }
3404
- var currentSSRContext = null;
3405
- function getCurrentSSRContext() {
3406
- return currentSSRContext;
3407
- }
3408
3341
  function runWithSSRContext(ctx, fn) {
3409
- const prev = currentSSRContext;
3410
- currentSSRContext = ctx;
3411
3342
  try {
3412
3343
  return fn();
3413
3344
  } finally {
3414
- currentSSRContext = prev;
3415
3345
  }
3416
3346
  }
3417
3347
  function throwSSRDataMissing() {
3418
3348
  throw new SSRDataMissingError();
3419
3349
  }
3420
-
3421
- // src/runtime/ssr-bridge.ts
3422
- var defaultBridge = {
3423
- getCurrentSSRContext() {
3424
- return null;
3425
- },
3426
- throwSSRDataMissing() {
3427
- throw new Error(
3428
- "[Askr] SSR data missing (SSR bridge not installed). If you are rendering on the server, ensure you are using the askr SSR entrypoints."
3429
- );
3430
- },
3431
- getCurrentRenderData() {
3432
- return null;
3433
- },
3434
- getNextKey() {
3435
- throw new Error(
3436
- "[Askr] getNextKey() called outside SSR render phase (SSR bridge not installed)."
3437
- );
3438
- }
3439
- };
3440
- var bridge = defaultBridge;
3441
- function installSSRBridge(next) {
3442
- bridge = next;
3443
- }
3444
-
3445
- // src/ssr/render-keys.ts
3446
- var keyCounter = 0;
3447
- var currentRenderData = null;
3448
- function getCurrentRenderData() {
3449
- return currentRenderData;
3450
- }
3451
- function resetKeyCounter() {
3452
- keyCounter = 0;
3453
- }
3454
- function getNextKey() {
3455
- return `r:${keyCounter++}`;
3456
- }
3457
3350
  function startRenderPhase(data) {
3458
- currentRenderData = data ?? null;
3459
- resetKeyCounter();
3460
- }
3461
- function stopRenderPhase() {
3462
- currentRenderData = null;
3463
- resetKeyCounter();
3464
3351
  }
3465
3352
  var PREPASS_REMOVED_MSG = "SSR collection/prepass is removed: SSR is strictly synchronous";
3466
3353
  async function resolvePlan(_plan) {
@@ -3761,13 +3648,7 @@ function renderNodeToSink(node, sink, ctx) {
3761
3648
  }
3762
3649
 
3763
3650
  // src/ssr/index.ts
3764
- var __SSR_DEBUG = process.env.NODE_ENV !== "production" && (process.env.ASKR_SSR_DEBUG === "1" || process.env.ASKR_SSR_DEBUG === "true");
3765
- installSSRBridge({
3766
- getCurrentSSRContext,
3767
- throwSSRDataMissing,
3768
- getCurrentRenderData,
3769
- getNextKey
3770
- });
3651
+ process.env.NODE_ENV !== "production" && (process.env.ASKR_SSR_DEBUG === "1" || process.env.ASKR_SSR_DEBUG === "true");
3771
3652
  var __ssrGuardStack = [];
3772
3653
  function pushSSRStrictPurityGuard() {
3773
3654
  if (process.env.NODE_ENV === "production") return;
@@ -3941,7 +3822,6 @@ function renderToStringSync(component, props, options) {
3941
3822
  sink.end();
3942
3823
  return sink.toString();
3943
3824
  } finally {
3944
- stopRenderPhase();
3945
3825
  }
3946
3826
  }
3947
3827
  function renderToStringSyncForUrl(opts) {
@@ -3993,7 +3873,6 @@ function renderToStringSyncForUrl(opts) {
3993
3873
  sink.end();
3994
3874
  return sink.toString();
3995
3875
  } finally {
3996
- stopRenderPhase();
3997
3876
  }
3998
3877
  }
3999
3878
  function renderToString(arg) {
@@ -4036,24 +3915,12 @@ function renderToSinkInternal(opts) {
4036
3915
  signal: void 0
4037
3916
  };
4038
3917
  const node = resolved.handler(resolved.params);
4039
- startRenderPhase(data || null);
4040
3918
  try {
4041
3919
  renderNodeToSink(node, sink, ctx);
4042
3920
  } finally {
4043
- stopRenderPhase();
4044
- }
4045
- }
4046
- // Annotate the CommonJS export names for ESM import in node:
4047
- 0 && (module.exports = {
4048
- SSRDataMissingError,
4049
- collectResources,
4050
- popSSRStrictPurityGuard,
4051
- pushSSRStrictPurityGuard,
4052
- renderToStream,
4053
- renderToString,
4054
- renderToStringSync,
4055
- renderToStringSyncForUrl,
4056
- resolvePlan,
4057
- resolveResources
4058
- });
4059
- //# sourceMappingURL=index.cjs.map
3921
+ }
3922
+ }
3923
+
3924
+ export { SSRDataMissingError, collectResources, popSSRStrictPurityGuard, pushSSRStrictPurityGuard, renderToStream, renderToString, renderToStringSync, renderToStringSyncForUrl, resolvePlan, resolveResources };
3925
+ //# sourceMappingURL=ssr.js.map
3926
+ //# sourceMappingURL=ssr.js.map