@opentf/web 0.1.0 → 0.3.0

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 (163) hide show
  1. package/{CHANGELOG.md → dist/CHANGELOG.md} +12 -0
  2. package/dist/babel.config.cjs +6 -0
  3. package/{compiler → dist/compiler}/babel-plugin.cjs +17 -16
  4. package/{core → dist/core}/mount.js +12 -12
  5. package/{index.js → dist/index.js} +2 -1
  6. package/dist/node_modules/@babel/core/LICENSE +22 -0
  7. package/dist/node_modules/@babel/core/README.md +19 -0
  8. package/dist/node_modules/@babel/core/lib/config/cache-contexts.js +5 -0
  9. package/dist/node_modules/@babel/core/lib/config/cache-contexts.js.map +1 -0
  10. package/dist/node_modules/@babel/core/lib/config/caching.js +261 -0
  11. package/dist/node_modules/@babel/core/lib/config/caching.js.map +1 -0
  12. package/dist/node_modules/@babel/core/lib/config/config-chain.js +469 -0
  13. package/dist/node_modules/@babel/core/lib/config/config-chain.js.map +1 -0
  14. package/dist/node_modules/@babel/core/lib/config/config-descriptors.js +190 -0
  15. package/dist/node_modules/@babel/core/lib/config/config-descriptors.js.map +1 -0
  16. package/dist/node_modules/@babel/core/lib/config/files/configuration.js +290 -0
  17. package/dist/node_modules/@babel/core/lib/config/files/configuration.js.map +1 -0
  18. package/dist/node_modules/@babel/core/lib/config/files/import.cjs +6 -0
  19. package/dist/node_modules/@babel/core/lib/config/files/import.cjs.map +1 -0
  20. package/dist/node_modules/@babel/core/lib/config/files/index-browser.js +58 -0
  21. package/dist/node_modules/@babel/core/lib/config/files/index-browser.js.map +1 -0
  22. package/dist/node_modules/@babel/core/lib/config/files/index.js +78 -0
  23. package/dist/node_modules/@babel/core/lib/config/files/index.js.map +1 -0
  24. package/dist/node_modules/@babel/core/lib/config/files/module-types.js +203 -0
  25. package/dist/node_modules/@babel/core/lib/config/files/module-types.js.map +1 -0
  26. package/dist/node_modules/@babel/core/lib/config/files/package.js +61 -0
  27. package/dist/node_modules/@babel/core/lib/config/files/package.js.map +1 -0
  28. package/dist/node_modules/@babel/core/lib/config/files/plugins.js +220 -0
  29. package/dist/node_modules/@babel/core/lib/config/files/plugins.js.map +1 -0
  30. package/dist/node_modules/@babel/core/lib/config/files/types.js +5 -0
  31. package/dist/node_modules/@babel/core/lib/config/files/types.js.map +1 -0
  32. package/dist/node_modules/@babel/core/lib/config/files/utils.js +36 -0
  33. package/dist/node_modules/@babel/core/lib/config/files/utils.js.map +1 -0
  34. package/dist/node_modules/@babel/core/lib/config/full.js +312 -0
  35. package/dist/node_modules/@babel/core/lib/config/full.js.map +1 -0
  36. package/dist/node_modules/@babel/core/lib/config/helpers/config-api.js +85 -0
  37. package/dist/node_modules/@babel/core/lib/config/helpers/config-api.js.map +1 -0
  38. package/dist/node_modules/@babel/core/lib/config/helpers/deep-array.js +23 -0
  39. package/dist/node_modules/@babel/core/lib/config/helpers/deep-array.js.map +1 -0
  40. package/dist/node_modules/@babel/core/lib/config/helpers/environment.js +12 -0
  41. package/dist/node_modules/@babel/core/lib/config/helpers/environment.js.map +1 -0
  42. package/dist/node_modules/@babel/core/lib/config/index.js +87 -0
  43. package/dist/node_modules/@babel/core/lib/config/index.js.map +1 -0
  44. package/dist/node_modules/@babel/core/lib/config/item.js +67 -0
  45. package/dist/node_modules/@babel/core/lib/config/item.js.map +1 -0
  46. package/dist/node_modules/@babel/core/lib/config/partial.js +158 -0
  47. package/dist/node_modules/@babel/core/lib/config/partial.js.map +1 -0
  48. package/dist/node_modules/@babel/core/lib/config/pattern-to-regex.js +38 -0
  49. package/dist/node_modules/@babel/core/lib/config/pattern-to-regex.js.map +1 -0
  50. package/dist/node_modules/@babel/core/lib/config/plugin.js +33 -0
  51. package/dist/node_modules/@babel/core/lib/config/plugin.js.map +1 -0
  52. package/dist/node_modules/@babel/core/lib/config/printer.js +113 -0
  53. package/dist/node_modules/@babel/core/lib/config/printer.js.map +1 -0
  54. package/dist/node_modules/@babel/core/lib/config/resolve-targets-browser.js +41 -0
  55. package/dist/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map +1 -0
  56. package/dist/node_modules/@babel/core/lib/config/resolve-targets.js +61 -0
  57. package/dist/node_modules/@babel/core/lib/config/resolve-targets.js.map +1 -0
  58. package/dist/node_modules/@babel/core/lib/config/util.js +31 -0
  59. package/dist/node_modules/@babel/core/lib/config/util.js.map +1 -0
  60. package/dist/node_modules/@babel/core/lib/config/validation/option-assertions.js +277 -0
  61. package/dist/node_modules/@babel/core/lib/config/validation/option-assertions.js.map +1 -0
  62. package/dist/node_modules/@babel/core/lib/config/validation/options.js +187 -0
  63. package/dist/node_modules/@babel/core/lib/config/validation/options.js.map +1 -0
  64. package/dist/node_modules/@babel/core/lib/config/validation/plugins.js +67 -0
  65. package/dist/node_modules/@babel/core/lib/config/validation/plugins.js.map +1 -0
  66. package/dist/node_modules/@babel/core/lib/config/validation/removed.js +68 -0
  67. package/dist/node_modules/@babel/core/lib/config/validation/removed.js.map +1 -0
  68. package/dist/node_modules/@babel/core/lib/errors/config-error.js +18 -0
  69. package/dist/node_modules/@babel/core/lib/errors/config-error.js.map +1 -0
  70. package/dist/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js +98 -0
  71. package/dist/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js.map +1 -0
  72. package/dist/node_modules/@babel/core/lib/gensync-utils/async.js +90 -0
  73. package/dist/node_modules/@babel/core/lib/gensync-utils/async.js.map +1 -0
  74. package/dist/node_modules/@babel/core/lib/gensync-utils/fs.js +31 -0
  75. package/dist/node_modules/@babel/core/lib/gensync-utils/fs.js.map +1 -0
  76. package/dist/node_modules/@babel/core/lib/gensync-utils/functional.js +58 -0
  77. package/dist/node_modules/@babel/core/lib/gensync-utils/functional.js.map +1 -0
  78. package/dist/node_modules/@babel/core/lib/index.js +230 -0
  79. package/dist/node_modules/@babel/core/lib/index.js.map +1 -0
  80. package/dist/node_modules/@babel/core/lib/parse.js +45 -0
  81. package/dist/node_modules/@babel/core/lib/parse.js.map +1 -0
  82. package/dist/node_modules/@babel/core/lib/parser/index.js +85 -0
  83. package/dist/node_modules/@babel/core/lib/parser/index.js.map +1 -0
  84. package/dist/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js +337 -0
  85. package/dist/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js.map +1 -0
  86. package/dist/node_modules/@babel/core/lib/tools/build-external-helpers.js +144 -0
  87. package/dist/node_modules/@babel/core/lib/tools/build-external-helpers.js.map +1 -0
  88. package/dist/node_modules/@babel/core/lib/transform-ast.js +48 -0
  89. package/dist/node_modules/@babel/core/lib/transform-ast.js.map +1 -0
  90. package/dist/node_modules/@babel/core/lib/transform-file-browser.js +23 -0
  91. package/dist/node_modules/@babel/core/lib/transform-file-browser.js.map +1 -0
  92. package/dist/node_modules/@babel/core/lib/transform-file.js +40 -0
  93. package/dist/node_modules/@babel/core/lib/transform-file.js.map +1 -0
  94. package/dist/node_modules/@babel/core/lib/transform.js +47 -0
  95. package/dist/node_modules/@babel/core/lib/transform.js.map +1 -0
  96. package/dist/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js +84 -0
  97. package/dist/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map +1 -0
  98. package/dist/node_modules/@babel/core/lib/transformation/file/babel-7-helpers.cjs +4 -0
  99. package/dist/node_modules/@babel/core/lib/transformation/file/babel-7-helpers.cjs.map +1 -0
  100. package/dist/node_modules/@babel/core/lib/transformation/file/file.js +204 -0
  101. package/dist/node_modules/@babel/core/lib/transformation/file/file.js.map +1 -0
  102. package/dist/node_modules/@babel/core/lib/transformation/file/generate.js +84 -0
  103. package/dist/node_modules/@babel/core/lib/transformation/file/generate.js.map +1 -0
  104. package/dist/node_modules/@babel/core/lib/transformation/file/merge-map.js +37 -0
  105. package/dist/node_modules/@babel/core/lib/transformation/file/merge-map.js.map +1 -0
  106. package/dist/node_modules/@babel/core/lib/transformation/index.js +90 -0
  107. package/dist/node_modules/@babel/core/lib/transformation/index.js.map +1 -0
  108. package/dist/node_modules/@babel/core/lib/transformation/normalize-file.js +127 -0
  109. package/dist/node_modules/@babel/core/lib/transformation/normalize-file.js.map +1 -0
  110. package/dist/node_modules/@babel/core/lib/transformation/normalize-opts.js +59 -0
  111. package/dist/node_modules/@babel/core/lib/transformation/normalize-opts.js.map +1 -0
  112. package/dist/node_modules/@babel/core/lib/transformation/plugin-pass.js +48 -0
  113. package/dist/node_modules/@babel/core/lib/transformation/plugin-pass.js.map +1 -0
  114. package/dist/node_modules/@babel/core/lib/transformation/util/clone-deep.js +54 -0
  115. package/dist/node_modules/@babel/core/lib/transformation/util/clone-deep.js.map +1 -0
  116. package/dist/node_modules/@babel/core/lib/vendor/import-meta-resolve.js +1042 -0
  117. package/dist/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map +1 -0
  118. package/dist/node_modules/@babel/core/package.json +82 -0
  119. package/dist/node_modules/@babel/core/src/config/files/index-browser.ts +115 -0
  120. package/dist/node_modules/@babel/core/src/config/files/index.ts +30 -0
  121. package/dist/node_modules/@babel/core/src/config/resolve-targets-browser.ts +42 -0
  122. package/dist/node_modules/@babel/core/src/config/resolve-targets.ts +54 -0
  123. package/dist/node_modules/@babel/core/src/transform-file-browser.ts +33 -0
  124. package/dist/node_modules/@babel/core/src/transform-file.ts +56 -0
  125. package/dist/node_modules/@babel/helper-module-imports/LICENSE +22 -0
  126. package/dist/node_modules/@babel/helper-module-imports/README.md +19 -0
  127. package/dist/node_modules/@babel/helper-module-imports/lib/import-builder.js +122 -0
  128. package/dist/node_modules/@babel/helper-module-imports/lib/import-builder.js.map +1 -0
  129. package/dist/node_modules/@babel/helper-module-imports/lib/import-injector.js +304 -0
  130. package/dist/node_modules/@babel/helper-module-imports/lib/import-injector.js.map +1 -0
  131. package/dist/node_modules/@babel/helper-module-imports/lib/index.js +37 -0
  132. package/dist/node_modules/@babel/helper-module-imports/lib/index.js.map +1 -0
  133. package/dist/node_modules/@babel/helper-module-imports/lib/is-module.js +11 -0
  134. package/dist/node_modules/@babel/helper-module-imports/lib/is-module.js.map +1 -0
  135. package/dist/node_modules/@babel/helper-module-imports/package.json +28 -0
  136. package/dist/node_modules/@babel/plugin-syntax-jsx/LICENSE +22 -0
  137. package/dist/node_modules/@babel/plugin-syntax-jsx/README.md +19 -0
  138. package/dist/node_modules/@babel/plugin-syntax-jsx/lib/index.js +21 -0
  139. package/dist/node_modules/@babel/plugin-syntax-jsx/lib/index.js.map +1 -0
  140. package/dist/node_modules/@babel/plugin-syntax-jsx/package.json +33 -0
  141. package/dist/node_modules/@preact/signals-core/CHANGELOG.md +331 -0
  142. package/dist/node_modules/@preact/signals-core/LICENSE +21 -0
  143. package/dist/node_modules/@preact/signals-core/README.md +258 -0
  144. package/dist/node_modules/@preact/signals-core/dist/signals-core.d.ts +149 -0
  145. package/dist/node_modules/@preact/signals-core/dist/signals-core.js +1 -0
  146. package/dist/node_modules/@preact/signals-core/dist/signals-core.js.map +1 -0
  147. package/dist/node_modules/@preact/signals-core/dist/signals-core.min.js +1 -0
  148. package/dist/node_modules/@preact/signals-core/dist/signals-core.min.js.map +1 -0
  149. package/dist/node_modules/@preact/signals-core/dist/signals-core.mjs +1 -0
  150. package/dist/node_modules/@preact/signals-core/dist/signals-core.mjs.map +1 -0
  151. package/dist/node_modules/@preact/signals-core/dist/signals-core.module.js +1 -0
  152. package/dist/node_modules/@preact/signals-core/dist/signals-core.module.js.map +1 -0
  153. package/dist/node_modules/@preact/signals-core/package.json +48 -0
  154. package/dist/node_modules/@preact/signals-core/src/index.ts +1121 -0
  155. package/dist/package.json +30 -0
  156. package/dist/router/Link.js +73 -0
  157. package/{router → dist/router}/index.js +43 -61
  158. package/{runtime → dist/runtime}/For.js +1 -2
  159. package/{runtime → dist/runtime}/dom.js +7 -14
  160. package/{runtime → dist/runtime}/lifecycle.js +1 -4
  161. package/{runtime → dist/runtime}/props.js +4 -15
  162. package/package.json +14 -7
  163. package/router/Link.jsx +0 -27
@@ -1,5 +1,17 @@
1
1
  # @opentf/web
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 476d65a: Fix reactivity issues by re-exporting all signals from the core package and updating the compiler to use a unified reactivity instance. This prevents state-update failures in complex project structures.
8
+
9
+ ## 0.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - a56fdfe: Fix the core components to prebuilt before publishing
14
+
3
15
  ## 0.1.0
4
16
 
5
17
  ### Minor Changes
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ plugins: [
3
+ "@babel/plugin-syntax-jsx",
4
+ ["./compiler/babel-plugin.cjs", { "runtimeSource": "../index.js" }]
5
+ ]
6
+ };
@@ -9,6 +9,7 @@ module.exports = function (babel) {
9
9
  visitor: {
10
10
  Program: {
11
11
  enter(p, state) {
12
+ state.runtimeSource = state.opts.runtimeSource || "@opentf/web";
12
13
  state.importsNeeded = new Map();
13
14
  state.importSources = new Map();
14
15
  state.components = new Map(); // name -> { path, isDefault, isPage }
@@ -113,9 +114,9 @@ module.exports = function (babel) {
113
114
  state.stateVars.add(parent.node.id.name);
114
115
  }
115
116
  if (name === "$state") {
116
- path.get("callee").replaceWith(getImport("signal", "@preact/signals-core"));
117
+ path.get("callee").replaceWith(getImport("signal", state.runtimeSource));
117
118
  } else if (name === "$derived") {
118
- path.get("callee").replaceWith(getImport("computed", "@preact/signals-core"));
119
+ path.get("callee").replaceWith(getImport("computed", state.runtimeSource));
119
120
  } else if (name === "$ref") {
120
121
  // Track this variable as a ref variable
121
122
  const parent = path.findParent(p => p.isVariableDeclarator());
@@ -125,20 +126,20 @@ module.exports = function (babel) {
125
126
  if (!state.stateVars) state.stateVars = new Set();
126
127
  state.stateVars.add(parent.node.id.name);
127
128
  }
128
- path.get("callee").replaceWith(getImport("signal", "@preact/signals-core"));
129
+ path.get("callee").replaceWith(getImport("signal", state.runtimeSource));
129
130
  }
130
131
  } else if (name === "$effect") {
131
- path.get("callee").replaceWith(getImport("effect", "@preact/signals-core"));
132
+ path.get("callee").replaceWith(getImport("effect", state.runtimeSource));
132
133
  } else if (name === "$expose") {
133
134
  // $expose({ a, b }) -> Object.assign(this, { a, b })
134
135
  path.get("callee").replaceWith(t.memberExpression(t.identifier("Object"), t.identifier("assign")));
135
136
  path.node.arguments.unshift(t.thisExpression());
136
137
  } else if (name === "onMount") {
137
- path.get("callee").replaceWith(getImport("onMount", "@opentf/web"));
138
+ path.get("callee").replaceWith(getImport("onMount", state.runtimeSource));
138
139
  } else if (name === "onCleanup") {
139
- path.get("callee").replaceWith(getImport("onCleanup", "@opentf/web"));
140
+ path.get("callee").replaceWith(getImport("onCleanup", state.runtimeSource));
140
141
  } else if (name === "$renderDynamic") {
141
- path.get("callee").replaceWith(getImport("renderDynamic", "@opentf/web"));
142
+ path.get("callee").replaceWith(getImport("renderDynamic", state.runtimeSource));
142
143
  }
143
144
  }
144
145
  },
@@ -359,8 +360,8 @@ module.exports = function (babel) {
359
360
  // Transform to Web Component Class
360
361
  const tagName = "web-" + name.toLowerCase();
361
362
  const observedAttributes = Array.from(allSignals);
362
- const signalId = getImport("signal", "@preact/signals-core");
363
- const createPropsProxyId = getImport("createPropsProxy", "@opentf/web");
363
+ const signalId = getImport("signal", state.runtimeSource);
364
+ const createPropsProxyId = getImport("createPropsProxy", state.runtimeSource);
364
365
  const classId = t.identifier(name + "Element");
365
366
 
366
367
  const classDecl = t.classDeclaration(
@@ -429,7 +430,7 @@ module.exports = function (babel) {
429
430
  t.whileStatement(t.memberExpression(t.thisExpression(), t.identifier("firstChild")), t.expressionStatement(t.callExpression(t.memberExpression(t.thisExpression(), t.identifier("removeChild")), [t.memberExpression(t.thisExpression(), t.identifier("firstChild"))]))),
430
431
 
431
432
  // Wrap setup in withInstance(this, () => { ... })
432
- t.expressionStatement(t.callExpression(getImport("withInstance", "@opentf/web"), [
433
+ t.expressionStatement(t.callExpression(getImport("withInstance", state.runtimeSource), [
433
434
  t.thisExpression(),
434
435
  t.arrowFunctionExpression([], t.blockStatement([
435
436
  ...originalStatements,
@@ -526,7 +527,7 @@ module.exports = function (babel) {
526
527
 
527
528
  n.openingElement.attributes.forEach(attr => {
528
529
  if (t.isJSXSpreadAttribute(attr)) {
529
- const applySpreadId = getImport("applySpread", "@opentf/web");
530
+ const applySpreadId = getImport("applySpread", state.runtimeSource);
530
531
  statements.push(t.expressionStatement(t.callExpression(applySpreadId, [elId, attr.argument])));
531
532
  return;
532
533
  }
@@ -547,7 +548,7 @@ module.exports = function (babel) {
547
548
  return;
548
549
  }
549
550
  collectSignals(value.expression);
550
- const effectId = getImport("effect", "@preact/signals-core");
551
+ const effectId = getImport("effect", state.runtimeSource);
551
552
  statements.push(t.expressionStatement(t.callExpression(effectId, [
552
553
  t.arrowFunctionExpression([], t.assignmentExpression("=", t.memberExpression(elId, t.identifier(targetProp)), value.expression))
553
554
  ])));
@@ -578,7 +579,7 @@ module.exports = function (babel) {
578
579
 
579
580
  n.openingElement.attributes.forEach(attr => {
580
581
  if (t.isJSXSpreadAttribute(attr)) {
581
- const applySpreadId = getImport("applySpread", "@opentf/web");
582
+ const applySpreadId = getImport("applySpread", state.runtimeSource);
582
583
  statements.push(t.expressionStatement(t.callExpression(applySpreadId, [elId, attr.argument])));
583
584
  return;
584
585
  }
@@ -606,7 +607,7 @@ module.exports = function (babel) {
606
607
 
607
608
  collectSignals(value.expression);
608
609
 
609
- const effectId = getImport("effect", "@preact/signals-core");
610
+ const effectId = getImport("effect", state.runtimeSource);
610
611
  const attrProp = (name === "class" || name === "classname") ? "className" : name;
611
612
  const isStyle = attrProp === "style";
612
613
  const isProperty = ["className", "style", "value", "checked", "id", "title", "href", "src", "key"].includes(attrProp);
@@ -684,7 +685,7 @@ module.exports = function (babel) {
684
685
  t.isMemberExpression(child.callee) &&
685
686
  t.isIdentifier(child.callee.property, { name: "map" })) {
686
687
 
687
- const mappedId = getImport("mapped", "@opentf/web");
688
+ const mappedId = getImport("mapped", state.runtimeSource);
688
689
  const sourceArray = child.callee.object;
689
690
  const mapFn = child.arguments[0];
690
691
 
@@ -710,7 +711,7 @@ module.exports = function (babel) {
710
711
  transformExpression(wrapper);
711
712
  const finalExpression = wrapper.expr;
712
713
 
713
- const renderDynamicId = getImport("renderDynamic", "@opentf/web");
714
+ const renderDynamicId = getImport("renderDynamic", state.runtimeSource);
714
715
  statements.push(t.expressionStatement(t.callExpression(renderDynamicId, [
715
716
  parentElId,
716
717
  t.arrowFunctionExpression([], finalExpression)
@@ -1,4 +1,4 @@
1
- import { registerRoutes, navigate, router } from '../router/index'
1
+ import { registerRoutes, navigate, router } from '../router/index';
2
2
 
3
3
  /**
4
4
  * Bootstraps the Web App Framework Application.
@@ -8,25 +8,25 @@ import { registerRoutes, navigate, router } from '../router/index'
8
8
  * @param {Function} options.guard - Optional route guard function
9
9
  * @param {string} options.targetId - ID of the root element (default: 'app')
10
10
  */
11
- export function mountApp({ pages, guard, targetId = 'app' } = {}) {
11
+ export function mountApp({
12
+ pages,
13
+ guard,
14
+ targetId = 'app'
15
+ } = {}) {
12
16
  console.log('🚀 Web App Framework Bootstrapping...');
13
- const root = document.getElementById(targetId)
14
-
17
+ const root = document.getElementById(targetId);
15
18
  if (pages) {
16
19
  console.log('📑 Registering routes...');
17
- registerRoutes(pages)
20
+ registerRoutes(pages);
18
21
  }
19
-
20
22
  if (guard) {
21
23
  console.log('🛡️ Activating route guard...');
22
24
  router.guard = guard;
23
25
  }
24
-
25
26
  const initialPath = window.location.pathname + window.location.search + window.location.hash;
26
27
  console.log('📍 Navigating to:', initialPath);
27
- navigate(initialPath, root)
28
-
28
+ navigate(initialPath, root);
29
29
  window.onpopstate = () => {
30
- navigate(window.location.pathname + window.location.search + window.location.hash, root)
31
- }
32
- }
30
+ navigate(window.location.pathname + window.location.search + window.location.hash, root);
31
+ };
32
+ }
@@ -1,6 +1,7 @@
1
+ export * from '@preact/signals-core';
1
2
  export { mountApp } from './core/mount.js';
2
3
  export * from './runtime/dom.js';
3
4
  export * from './runtime/lifecycle.js';
4
5
  export * from './runtime/props.js';
5
6
  export * from './router/index.js';
6
- export { default as Link } from './router/Link.jsx';
7
+ export { default as Link } from './router/Link';
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2014-present Sebastian McKenzie and other contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ # @babel/core
2
+
3
+ > Babel compiler core.
4
+
5
+ See our website [@babel/core](https://babeljs.io/docs/babel-core) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package.
6
+
7
+ ## Install
8
+
9
+ Using npm:
10
+
11
+ ```sh
12
+ npm install --save-dev @babel/core
13
+ ```
14
+
15
+ or using yarn:
16
+
17
+ ```sh
18
+ yarn add @babel/core --dev
19
+ ```
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ 0 && 0;
4
+
5
+ //# sourceMappingURL=cache-contexts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/config/cache-contexts.ts"],"sourcesContent":["import type { ConfigContext } from \"./config-chain.ts\";\nimport type {\n CallerMetadata,\n TargetsListOrObject,\n} from \"./validation/options.ts\";\n\nexport type { ConfigContext as FullConfig };\n\nexport type FullPreset = {\n targets: TargetsListOrObject;\n} & ConfigContext;\nexport type FullPlugin = {\n assumptions: Record<string, boolean>;\n} & FullPreset;\n\n// Context not including filename since it is used in places that cannot\n// process 'ignore'/'only' and other filename-based logic.\nexport type SimpleConfig = {\n envName: string;\n caller: CallerMetadata | undefined;\n};\nexport type SimplePreset = {\n targets: TargetsListOrObject;\n} & SimpleConfig;\nexport type SimplePlugin = {\n assumptions: Record<string, boolean>;\n} & SimplePreset;\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.assertSimpleType = assertSimpleType;
7
+ exports.makeStrongCache = makeStrongCache;
8
+ exports.makeStrongCacheSync = makeStrongCacheSync;
9
+ exports.makeWeakCache = makeWeakCache;
10
+ exports.makeWeakCacheSync = makeWeakCacheSync;
11
+ function _gensync() {
12
+ const data = require("gensync");
13
+ _gensync = function () {
14
+ return data;
15
+ };
16
+ return data;
17
+ }
18
+ var _async = require("../gensync-utils/async.js");
19
+ var _util = require("./util.js");
20
+ const synchronize = gen => {
21
+ return _gensync()(gen).sync;
22
+ };
23
+ function* genTrue() {
24
+ return true;
25
+ }
26
+ function makeWeakCache(handler) {
27
+ return makeCachedFunction(WeakMap, handler);
28
+ }
29
+ function makeWeakCacheSync(handler) {
30
+ return synchronize(makeWeakCache(handler));
31
+ }
32
+ function makeStrongCache(handler) {
33
+ return makeCachedFunction(Map, handler);
34
+ }
35
+ function makeStrongCacheSync(handler) {
36
+ return synchronize(makeStrongCache(handler));
37
+ }
38
+ function makeCachedFunction(CallCache, handler) {
39
+ const callCacheSync = new CallCache();
40
+ const callCacheAsync = new CallCache();
41
+ const futureCache = new CallCache();
42
+ return function* cachedFunction(arg, data) {
43
+ const asyncContext = yield* (0, _async.isAsync)();
44
+ const callCache = asyncContext ? callCacheAsync : callCacheSync;
45
+ const cached = yield* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data);
46
+ if (cached.valid) return cached.value;
47
+ const cache = new CacheConfigurator(data);
48
+ const handlerResult = handler(arg, cache);
49
+ let finishLock;
50
+ let value;
51
+ if ((0, _util.isIterableIterator)(handlerResult)) {
52
+ value = yield* (0, _async.onFirstPause)(handlerResult, () => {
53
+ finishLock = setupAsyncLocks(cache, futureCache, arg);
54
+ });
55
+ } else {
56
+ value = handlerResult;
57
+ }
58
+ updateFunctionCache(callCache, cache, arg, value);
59
+ if (finishLock) {
60
+ futureCache.delete(arg);
61
+ finishLock.release(value);
62
+ }
63
+ return value;
64
+ };
65
+ }
66
+ function* getCachedValue(cache, arg, data) {
67
+ const cachedValue = cache.get(arg);
68
+ if (cachedValue) {
69
+ for (const {
70
+ value,
71
+ valid
72
+ } of cachedValue) {
73
+ if (yield* valid(data)) return {
74
+ valid: true,
75
+ value
76
+ };
77
+ }
78
+ }
79
+ return {
80
+ valid: false,
81
+ value: null
82
+ };
83
+ }
84
+ function* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data) {
85
+ const cached = yield* getCachedValue(callCache, arg, data);
86
+ if (cached.valid) {
87
+ return cached;
88
+ }
89
+ if (asyncContext) {
90
+ const cached = yield* getCachedValue(futureCache, arg, data);
91
+ if (cached.valid) {
92
+ const value = yield* (0, _async.waitFor)(cached.value.promise);
93
+ return {
94
+ valid: true,
95
+ value
96
+ };
97
+ }
98
+ }
99
+ return {
100
+ valid: false,
101
+ value: null
102
+ };
103
+ }
104
+ function setupAsyncLocks(config, futureCache, arg) {
105
+ const finishLock = new Lock();
106
+ updateFunctionCache(futureCache, config, arg, finishLock);
107
+ return finishLock;
108
+ }
109
+ function updateFunctionCache(cache, config, arg, value) {
110
+ if (!config.configured()) config.forever();
111
+ let cachedValue = cache.get(arg);
112
+ config.deactivate();
113
+ switch (config.mode()) {
114
+ case "forever":
115
+ cachedValue = [{
116
+ value,
117
+ valid: genTrue
118
+ }];
119
+ cache.set(arg, cachedValue);
120
+ break;
121
+ case "invalidate":
122
+ cachedValue = [{
123
+ value,
124
+ valid: config.validator()
125
+ }];
126
+ cache.set(arg, cachedValue);
127
+ break;
128
+ case "valid":
129
+ if (cachedValue) {
130
+ cachedValue.push({
131
+ value,
132
+ valid: config.validator()
133
+ });
134
+ } else {
135
+ cachedValue = [{
136
+ value,
137
+ valid: config.validator()
138
+ }];
139
+ cache.set(arg, cachedValue);
140
+ }
141
+ }
142
+ }
143
+ class CacheConfigurator {
144
+ constructor(data) {
145
+ this._active = true;
146
+ this._never = false;
147
+ this._forever = false;
148
+ this._invalidate = false;
149
+ this._configured = false;
150
+ this._pairs = [];
151
+ this._data = void 0;
152
+ this._data = data;
153
+ }
154
+ simple() {
155
+ return makeSimpleConfigurator(this);
156
+ }
157
+ mode() {
158
+ if (this._never) return "never";
159
+ if (this._forever) return "forever";
160
+ if (this._invalidate) return "invalidate";
161
+ return "valid";
162
+ }
163
+ forever() {
164
+ if (!this._active) {
165
+ throw new Error("Cannot change caching after evaluation has completed.");
166
+ }
167
+ if (this._never) {
168
+ throw new Error("Caching has already been configured with .never()");
169
+ }
170
+ this._forever = true;
171
+ this._configured = true;
172
+ }
173
+ never() {
174
+ if (!this._active) {
175
+ throw new Error("Cannot change caching after evaluation has completed.");
176
+ }
177
+ if (this._forever) {
178
+ throw new Error("Caching has already been configured with .forever()");
179
+ }
180
+ this._never = true;
181
+ this._configured = true;
182
+ }
183
+ using(handler) {
184
+ if (!this._active) {
185
+ throw new Error("Cannot change caching after evaluation has completed.");
186
+ }
187
+ if (this._never || this._forever) {
188
+ throw new Error("Caching has already been configured with .never or .forever()");
189
+ }
190
+ this._configured = true;
191
+ const key = handler(this._data);
192
+ const fn = (0, _async.maybeAsync)(handler, `You appear to be using an async cache handler, but Babel has been called synchronously`);
193
+ if ((0, _async.isThenable)(key)) {
194
+ return key.then(key => {
195
+ this._pairs.push([key, fn]);
196
+ return key;
197
+ });
198
+ }
199
+ this._pairs.push([key, fn]);
200
+ return key;
201
+ }
202
+ invalidate(handler) {
203
+ this._invalidate = true;
204
+ return this.using(handler);
205
+ }
206
+ validator() {
207
+ const pairs = this._pairs;
208
+ return function* (data) {
209
+ for (const [key, fn] of pairs) {
210
+ if (key !== (yield* fn(data))) return false;
211
+ }
212
+ return true;
213
+ };
214
+ }
215
+ deactivate() {
216
+ this._active = false;
217
+ }
218
+ configured() {
219
+ return this._configured;
220
+ }
221
+ }
222
+ function makeSimpleConfigurator(cache) {
223
+ function cacheFn(val) {
224
+ if (typeof val === "boolean") {
225
+ if (val) cache.forever();else cache.never();
226
+ return;
227
+ }
228
+ return cache.using(() => assertSimpleType(val()));
229
+ }
230
+ cacheFn.forever = () => cache.forever();
231
+ cacheFn.never = () => cache.never();
232
+ cacheFn.using = cb => cache.using(() => assertSimpleType(cb()));
233
+ cacheFn.invalidate = cb => cache.invalidate(() => assertSimpleType(cb()));
234
+ return cacheFn;
235
+ }
236
+ function assertSimpleType(value) {
237
+ if ((0, _async.isThenable)(value)) {
238
+ throw new Error(`You appear to be using an async cache handler, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously handle your caching logic.`);
239
+ }
240
+ if (value != null && typeof value !== "string" && typeof value !== "boolean" && typeof value !== "number") {
241
+ throw new Error("Cache keys must be either string, boolean, number, null, or undefined.");
242
+ }
243
+ return value;
244
+ }
245
+ class Lock {
246
+ constructor() {
247
+ this.released = false;
248
+ this.promise = void 0;
249
+ this._resolve = void 0;
250
+ this.promise = new Promise(resolve => {
251
+ this._resolve = resolve;
252
+ });
253
+ }
254
+ release(value) {
255
+ this.released = true;
256
+ this._resolve(value);
257
+ }
258
+ }
259
+ 0 && 0;
260
+
261
+ //# sourceMappingURL=caching.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_gensync","data","require","_async","_util","synchronize","gen","gensync","sync","genTrue","makeWeakCache","handler","makeCachedFunction","WeakMap","makeWeakCacheSync","makeStrongCache","Map","makeStrongCacheSync","CallCache","callCacheSync","callCacheAsync","futureCache","cachedFunction","arg","asyncContext","isAsync","callCache","cached","getCachedValueOrWait","valid","value","cache","CacheConfigurator","handlerResult","finishLock","isIterableIterator","onFirstPause","setupAsyncLocks","updateFunctionCache","delete","release","getCachedValue","cachedValue","get","waitFor","promise","config","Lock","configured","forever","deactivate","mode","set","validator","push","constructor","_active","_never","_forever","_invalidate","_configured","_pairs","_data","simple","makeSimpleConfigurator","Error","never","using","key","fn","maybeAsync","isThenable","then","invalidate","pairs","cacheFn","val","assertSimpleType","cb","released","_resolve","Promise","resolve"],"sources":["../../src/config/caching.ts"],"sourcesContent":["import gensync from \"gensync\";\nimport type { Handler } from \"gensync\";\nimport {\n maybeAsync,\n isAsync,\n onFirstPause,\n waitFor,\n isThenable,\n} from \"../gensync-utils/async.ts\";\nimport { isIterableIterator } from \"./util.ts\";\n\nexport type { CacheConfigurator };\n\nexport type SimpleCacheConfigurator = {\n (forever: boolean): void;\n <T extends SimpleType>(handler: () => T): T;\n\n forever: () => void;\n never: () => void;\n using: <T extends SimpleType>(handler: () => T) => T;\n invalidate: <T extends SimpleType>(handler: () => T) => T;\n};\n\nexport type CacheEntry<ResultT, SideChannel> = {\n value: ResultT;\n valid: (channel: SideChannel) => Handler<boolean>;\n}[];\n\nconst synchronize = <ArgsT extends unknown[], ResultT>(\n gen: (...args: ArgsT) => Handler<ResultT>,\n): ((...args: ArgsT) => ResultT) => {\n return gensync(gen).sync;\n};\n\n// eslint-disable-next-line require-yield\nfunction* genTrue() {\n return true;\n}\n\nexport function makeWeakCache<ArgT extends object, ResultT, SideChannel>(\n handler: (\n arg: ArgT,\n cache: CacheConfigurator<SideChannel>,\n ) => Handler<ResultT> | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler<ResultT> {\n return makeCachedFunction<ArgT, ResultT, SideChannel>(WeakMap, handler);\n}\n\nexport function makeWeakCacheSync<ArgT extends object, ResultT, SideChannel>(\n handler: (arg: ArgT, cache?: CacheConfigurator<SideChannel>) => ResultT,\n): (arg: ArgT, data?: SideChannel) => ResultT {\n return synchronize<[ArgT, SideChannel], ResultT>(\n makeWeakCache<ArgT, ResultT, SideChannel>(handler),\n );\n}\n\nexport function makeStrongCache<ArgT, ResultT, SideChannel>(\n handler: (\n arg: ArgT,\n cache: CacheConfigurator<SideChannel>,\n ) => Handler<ResultT> | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler<ResultT> {\n return makeCachedFunction<ArgT, ResultT, SideChannel>(Map, handler);\n}\n\nexport function makeStrongCacheSync<ArgT, ResultT, SideChannel>(\n handler: (arg: ArgT, cache?: CacheConfigurator<SideChannel>) => ResultT,\n): (arg: ArgT, data?: SideChannel) => ResultT {\n return synchronize<[ArgT, SideChannel], ResultT>(\n makeStrongCache<ArgT, ResultT, SideChannel>(handler),\n );\n}\n\n/* NOTE: Part of the logic explained in this comment is explained in the\n * getCachedValueOrWait and setupAsyncLocks functions.\n *\n * > There are only two hard things in Computer Science: cache invalidation and naming things.\n * > -- Phil Karlton\n *\n * I don't know if Phil was also thinking about handling a cache whose invalidation function is\n * defined asynchronously is considered, but it is REALLY hard to do correctly.\n *\n * The implemented logic (only when gensync is run asynchronously) is the following:\n * 1. If there is a valid cache associated to the current \"arg\" parameter,\n * a. RETURN the cached value\n * 3. If there is a FinishLock associated to the current \"arg\" parameter representing a valid cache,\n * a. Wait for that lock to be released\n * b. RETURN the value associated with that lock\n * 5. Start executing the function to be cached\n * a. If it pauses on a promise, then\n * i. Let FinishLock be a new lock\n * ii. Store FinishLock as associated to the current \"arg\" parameter\n * iii. Wait for the function to finish executing\n * iv. Release FinishLock\n * v. Send the function result to anyone waiting on FinishLock\n * 6. Store the result in the cache\n * 7. RETURN the result\n */\nfunction makeCachedFunction<ArgT, ResultT, SideChannel>(\n CallCache: new <Cached>() => CacheMap<ArgT, Cached, SideChannel>,\n handler: (\n arg: ArgT,\n cache: CacheConfigurator<SideChannel>,\n ) => Handler<ResultT> | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler<ResultT> {\n const callCacheSync = new CallCache<ResultT>();\n const callCacheAsync = new CallCache<ResultT>();\n const futureCache = new CallCache<Lock<ResultT>>();\n\n return function* cachedFunction(arg: ArgT, data: SideChannel) {\n const asyncContext = yield* isAsync();\n const callCache = asyncContext ? callCacheAsync : callCacheSync;\n\n const cached = yield* getCachedValueOrWait<ArgT, ResultT, SideChannel>(\n asyncContext,\n callCache,\n futureCache,\n arg,\n data,\n );\n if (cached.valid) return cached.value;\n\n const cache = new CacheConfigurator(data);\n\n const handlerResult: Handler<ResultT> | ResultT = handler(arg, cache);\n\n let finishLock: Lock<ResultT>;\n let value: ResultT;\n\n if (isIterableIterator(handlerResult)) {\n value = yield* onFirstPause(handlerResult, () => {\n finishLock = setupAsyncLocks(cache, futureCache, arg);\n });\n } else {\n value = handlerResult;\n }\n\n updateFunctionCache(callCache, cache, arg, value);\n\n if (finishLock) {\n futureCache.delete(arg);\n finishLock.release(value);\n }\n\n return value;\n };\n}\n\ntype CacheMap<ArgT, ResultT, SideChannel> =\n | Map<ArgT, CacheEntry<ResultT, SideChannel>>\n // @ts-expect-error todo(flow->ts): add `extends object` constraint to ArgT\n | WeakMap<ArgT, CacheEntry<ResultT, SideChannel>>;\n\nfunction* getCachedValue<ArgT, ResultT, SideChannel>(\n cache: CacheMap<ArgT, ResultT, SideChannel>,\n arg: ArgT,\n data: SideChannel,\n): Handler<{ valid: true; value: ResultT } | { valid: false; value: null }> {\n const cachedValue: CacheEntry<ResultT, SideChannel> | void = cache.get(arg);\n\n if (cachedValue) {\n for (const { value, valid } of cachedValue) {\n if (yield* valid(data)) return { valid: true, value };\n }\n }\n\n return { valid: false, value: null };\n}\n\nfunction* getCachedValueOrWait<ArgT, ResultT, SideChannel>(\n asyncContext: boolean,\n callCache: CacheMap<ArgT, ResultT, SideChannel>,\n futureCache: CacheMap<ArgT, Lock<ResultT>, SideChannel>,\n arg: ArgT,\n data: SideChannel,\n): Handler<{ valid: true; value: ResultT } | { valid: false; value: null }> {\n const cached = yield* getCachedValue(callCache, arg, data);\n if (cached.valid) {\n return cached;\n }\n\n if (asyncContext) {\n const cached = yield* getCachedValue(futureCache, arg, data);\n if (cached.valid) {\n const value = yield* waitFor<ResultT>(cached.value.promise);\n return { valid: true, value };\n }\n }\n\n return { valid: false, value: null };\n}\n\nfunction setupAsyncLocks<ArgT, ResultT, SideChannel>(\n config: CacheConfigurator<SideChannel>,\n futureCache: CacheMap<ArgT, Lock<ResultT>, SideChannel>,\n arg: ArgT,\n): Lock<ResultT> {\n const finishLock = new Lock<ResultT>();\n\n updateFunctionCache(futureCache, config, arg, finishLock);\n\n return finishLock;\n}\n\nfunction updateFunctionCache<\n ArgT,\n ResultT,\n SideChannel,\n Cache extends CacheMap<ArgT, ResultT, SideChannel>,\n>(\n cache: Cache,\n config: CacheConfigurator<SideChannel>,\n arg: ArgT,\n value: ResultT,\n) {\n if (!config.configured()) config.forever();\n\n let cachedValue: CacheEntry<ResultT, SideChannel> | void = cache.get(arg);\n\n config.deactivate();\n\n switch (config.mode()) {\n case \"forever\":\n cachedValue = [{ value, valid: genTrue }];\n cache.set(arg, cachedValue);\n break;\n case \"invalidate\":\n cachedValue = [{ value, valid: config.validator() }];\n cache.set(arg, cachedValue);\n break;\n case \"valid\":\n if (cachedValue) {\n cachedValue.push({ value, valid: config.validator() });\n } else {\n cachedValue = [{ value, valid: config.validator() }];\n cache.set(arg, cachedValue);\n }\n }\n}\n\nclass CacheConfigurator<SideChannel = void> {\n _active: boolean = true;\n _never: boolean = false;\n _forever: boolean = false;\n _invalidate: boolean = false;\n\n _configured: boolean = false;\n\n _pairs: [\n cachedValue: unknown,\n handler: (data: SideChannel) => Handler<unknown>,\n ][] = [];\n\n _data: SideChannel;\n\n constructor(data: SideChannel) {\n this._data = data;\n }\n\n simple() {\n return makeSimpleConfigurator(this);\n }\n\n mode() {\n if (this._never) return \"never\";\n if (this._forever) return \"forever\";\n if (this._invalidate) return \"invalidate\";\n return \"valid\";\n }\n\n forever() {\n if (!this._active) {\n throw new Error(\"Cannot change caching after evaluation has completed.\");\n }\n if (this._never) {\n throw new Error(\"Caching has already been configured with .never()\");\n }\n this._forever = true;\n this._configured = true;\n }\n\n never() {\n if (!this._active) {\n throw new Error(\"Cannot change caching after evaluation has completed.\");\n }\n if (this._forever) {\n throw new Error(\"Caching has already been configured with .forever()\");\n }\n this._never = true;\n this._configured = true;\n }\n\n using<T>(handler: (data: SideChannel) => T): T {\n if (!this._active) {\n throw new Error(\"Cannot change caching after evaluation has completed.\");\n }\n if (this._never || this._forever) {\n throw new Error(\n \"Caching has already been configured with .never or .forever()\",\n );\n }\n this._configured = true;\n\n const key = handler(this._data);\n\n const fn = maybeAsync(\n handler,\n `You appear to be using an async cache handler, but Babel has been called synchronously`,\n );\n\n if (isThenable(key)) {\n // @ts-expect-error todo(flow->ts): improve function return type annotation\n return key.then((key: unknown) => {\n this._pairs.push([key, fn]);\n return key;\n });\n }\n\n this._pairs.push([key, fn]);\n return key;\n }\n\n invalidate<T>(handler: (data: SideChannel) => T): T {\n this._invalidate = true;\n return this.using(handler);\n }\n\n validator(): (data: SideChannel) => Handler<boolean> {\n const pairs = this._pairs;\n return function* (data: SideChannel) {\n for (const [key, fn] of pairs) {\n if (key !== (yield* fn(data))) return false;\n }\n return true;\n };\n }\n\n deactivate() {\n this._active = false;\n }\n\n configured() {\n return this._configured;\n }\n}\n\nfunction makeSimpleConfigurator(\n cache: CacheConfigurator<any>,\n): SimpleCacheConfigurator {\n function cacheFn(val: any) {\n if (typeof val === \"boolean\") {\n if (val) cache.forever();\n else cache.never();\n return;\n }\n\n return cache.using(() => assertSimpleType(val()));\n }\n cacheFn.forever = () => cache.forever();\n cacheFn.never = () => cache.never();\n cacheFn.using = (cb: () => SimpleType) =>\n cache.using(() => assertSimpleType(cb()));\n cacheFn.invalidate = (cb: () => SimpleType) =>\n cache.invalidate(() => assertSimpleType(cb()));\n\n return cacheFn as any;\n}\n\n// Types are limited here so that in the future these values can be used\n// as part of Babel's caching logic.\nexport type SimpleType =\n | string\n | boolean\n | number\n | null\n | void\n | Promise<SimpleType>;\nexport function assertSimpleType(value: unknown): SimpleType {\n if (isThenable(value)) {\n throw new Error(\n `You appear to be using an async cache handler, ` +\n `which your current version of Babel does not support. ` +\n `We may add support for this in the future, ` +\n `but if you're on the most recent version of @babel/core and still ` +\n `seeing this error, then you'll need to synchronously handle your caching logic.`,\n );\n }\n\n if (\n value != null &&\n typeof value !== \"string\" &&\n typeof value !== \"boolean\" &&\n typeof value !== \"number\"\n ) {\n throw new Error(\n \"Cache keys must be either string, boolean, number, null, or undefined.\",\n );\n }\n // @ts-expect-error Type 'unknown' is not assignable to type 'SimpleType'. This can be removed\n // when strictNullCheck is enabled\n return value;\n}\n\nclass Lock<T> {\n released: boolean = false;\n promise: Promise<T>;\n _resolve: (value: T) => void;\n\n constructor() {\n this.promise = new Promise(resolve => {\n this._resolve = resolve;\n });\n }\n\n release(value: T) {\n this.released = true;\n this._resolve(value);\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAE,MAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AAmBA,MAAMG,WAAW,GACfC,GAAyC,IACP;EAClC,OAAOC,SAAMA,CAAC,CAACD,GAAG,CAAC,CAACE,IAAI;AAC1B,CAAC;AAGD,UAAUC,OAAOA,CAAA,EAAG;EAClB,OAAO,IAAI;AACb;AAEO,SAASC,aAAaA,CAC3BC,OAG+B,EACqB;EACpD,OAAOC,kBAAkB,CAA6BC,OAAO,EAAEF,OAAO,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