@absolutejs/absolute 0.15.2 → 0.15.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.
package/dist/index.js CHANGED
@@ -1,21 +1,5 @@
1
1
  // @bun
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
2
  var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __toESM = (mod, isNodeMode, target) => {
8
- target = mod != null ? __create(__getProtoOf(mod)) : {};
9
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
- for (let key of __getOwnPropNames(mod))
11
- if (!__hasOwnProp.call(to, key))
12
- __defProp(to, key, {
13
- get: () => mod[key],
14
- enumerable: true
15
- });
16
- return to;
17
- };
18
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
3
  var __export = (target, all) => {
20
4
  for (var name in all)
21
5
  __defProp(target, name, {
@@ -379,253 +363,6 @@ var init_compileVue = __esm(() => {
379
363
  vueHmrMetadata = new Map;
380
364
  });
381
365
 
382
- // node_modules/react-refresh/cjs/react-refresh-runtime.development.js
383
- var require_react_refresh_runtime_development = __commonJS((exports) => {
384
- (function() {
385
- function computeFullKey(signature) {
386
- if (signature.fullKey !== null)
387
- return signature.fullKey;
388
- var fullKey = signature.ownKey;
389
- try {
390
- var hooks = signature.getCustomHooks();
391
- } catch (err) {
392
- return signature.forceReset = true, signature.fullKey = fullKey;
393
- }
394
- for (var i = 0;i < hooks.length; i++) {
395
- var hook = hooks[i];
396
- if (typeof hook !== "function")
397
- return signature.forceReset = true, signature.fullKey = fullKey;
398
- hook = allSignaturesByType.get(hook);
399
- if (hook !== undefined) {
400
- var nestedHookKey = computeFullKey(hook);
401
- hook.forceReset && (signature.forceReset = true);
402
- fullKey += `
403
- ---
404
- ` + nestedHookKey;
405
- }
406
- }
407
- return signature.fullKey = fullKey;
408
- }
409
- function resolveFamily(type) {
410
- return updatedFamiliesByType.get(type);
411
- }
412
- function cloneMap(map) {
413
- var clone = new Map;
414
- map.forEach(function(value, key) {
415
- clone.set(key, value);
416
- });
417
- return clone;
418
- }
419
- function cloneSet(set) {
420
- var clone = new Set;
421
- set.forEach(function(value) {
422
- clone.add(value);
423
- });
424
- return clone;
425
- }
426
- function getProperty(object, property) {
427
- try {
428
- return object[property];
429
- } catch (err) {}
430
- }
431
- function register(type, id) {
432
- if (!(type === null || typeof type !== "function" && typeof type !== "object" || allFamiliesByType.has(type))) {
433
- var family = allFamiliesByID.get(id);
434
- family === undefined ? (family = { current: type }, allFamiliesByID.set(id, family)) : pendingUpdates.push([family, type]);
435
- allFamiliesByType.set(type, family);
436
- if (typeof type === "object" && type !== null)
437
- switch (getProperty(type, "$$typeof")) {
438
- case REACT_FORWARD_REF_TYPE:
439
- register(type.render, id + "$render");
440
- break;
441
- case REACT_MEMO_TYPE:
442
- register(type.type, id + "$type");
443
- }
444
- }
445
- }
446
- function setSignature(type, key) {
447
- var forceReset = 2 < arguments.length && arguments[2] !== undefined ? arguments[2] : false, getCustomHooks = 3 < arguments.length ? arguments[3] : undefined;
448
- allSignaturesByType.has(type) || allSignaturesByType.set(type, {
449
- forceReset,
450
- ownKey: key,
451
- fullKey: null,
452
- getCustomHooks: getCustomHooks || function() {
453
- return [];
454
- }
455
- });
456
- if (typeof type === "object" && type !== null)
457
- switch (getProperty(type, "$$typeof")) {
458
- case REACT_FORWARD_REF_TYPE:
459
- setSignature(type.render, key, forceReset, getCustomHooks);
460
- break;
461
- case REACT_MEMO_TYPE:
462
- setSignature(type.type, key, forceReset, getCustomHooks);
463
- }
464
- }
465
- function collectCustomHooksForSignature(type) {
466
- type = allSignaturesByType.get(type);
467
- type !== undefined && computeFullKey(type);
468
- }
469
- var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_MEMO_TYPE = Symbol.for("react.memo"), PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map, allFamiliesByID = new Map, allFamiliesByType = new PossiblyWeakMap, allSignaturesByType = new PossiblyWeakMap, updatedFamiliesByType = new PossiblyWeakMap, pendingUpdates = [], helpersByRendererID = new Map, helpersByRoot = new Map, mountedRoots = new Set, failedRoots = new Set, rootElements = typeof WeakMap === "function" ? new WeakMap : null, isPerformingRefresh = false;
470
- exports._getMountedRootCount = function() {
471
- return mountedRoots.size;
472
- };
473
- exports.collectCustomHooksForSignature = collectCustomHooksForSignature;
474
- exports.createSignatureFunctionForTransform = function() {
475
- var savedType, hasCustomHooks, didCollectHooks = false;
476
- return function(type, key, forceReset, getCustomHooks) {
477
- if (typeof key === "string")
478
- return savedType || (savedType = type, hasCustomHooks = typeof getCustomHooks === "function"), type == null || typeof type !== "function" && typeof type !== "object" || setSignature(type, key, forceReset, getCustomHooks), type;
479
- !didCollectHooks && hasCustomHooks && (didCollectHooks = true, collectCustomHooksForSignature(savedType));
480
- };
481
- };
482
- exports.getFamilyByID = function(id) {
483
- return allFamiliesByID.get(id);
484
- };
485
- exports.getFamilyByType = function(type) {
486
- return allFamiliesByType.get(type);
487
- };
488
- exports.hasUnrecoverableErrors = function() {
489
- return false;
490
- };
491
- exports.injectIntoGlobalHook = function(globalObject) {
492
- var hook = globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__;
493
- if (hook === undefined) {
494
- var nextID = 0;
495
- globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook = {
496
- renderers: new Map,
497
- supportsFiber: true,
498
- inject: function() {
499
- return nextID++;
500
- },
501
- onScheduleFiberRoot: function() {},
502
- onCommitFiberRoot: function() {},
503
- onCommitFiberUnmount: function() {}
504
- };
505
- }
506
- if (hook.isDisabled)
507
- console.warn("Something has shimmed the React DevTools global hook (__REACT_DEVTOOLS_GLOBAL_HOOK__). Fast Refresh is not compatible with this shim and will be disabled.");
508
- else {
509
- var oldInject = hook.inject;
510
- hook.inject = function(injected) {
511
- var id = oldInject.apply(this, arguments);
512
- typeof injected.scheduleRefresh === "function" && typeof injected.setRefreshHandler === "function" && helpersByRendererID.set(id, injected);
513
- return id;
514
- };
515
- hook.renderers.forEach(function(injected, id) {
516
- typeof injected.scheduleRefresh === "function" && typeof injected.setRefreshHandler === "function" && helpersByRendererID.set(id, injected);
517
- });
518
- var oldOnCommitFiberRoot = hook.onCommitFiberRoot, oldOnScheduleFiberRoot = hook.onScheduleFiberRoot || function() {};
519
- hook.onScheduleFiberRoot = function(id, root, children) {
520
- isPerformingRefresh || (failedRoots.delete(root), rootElements !== null && rootElements.set(root, children));
521
- return oldOnScheduleFiberRoot.apply(this, arguments);
522
- };
523
- hook.onCommitFiberRoot = function(id, root, maybePriorityLevel, didError) {
524
- var helpers = helpersByRendererID.get(id);
525
- if (helpers !== undefined) {
526
- helpersByRoot.set(root, helpers);
527
- helpers = root.current;
528
- var alternate = helpers.alternate;
529
- alternate !== null ? (alternate = alternate.memoizedState != null && alternate.memoizedState.element != null && mountedRoots.has(root), helpers = helpers.memoizedState != null && helpers.memoizedState.element != null, !alternate && helpers ? (mountedRoots.add(root), failedRoots.delete(root)) : alternate && helpers || (alternate && !helpers ? (mountedRoots.delete(root), didError ? failedRoots.add(root) : helpersByRoot.delete(root)) : alternate || helpers || didError && failedRoots.add(root))) : mountedRoots.add(root);
530
- }
531
- return oldOnCommitFiberRoot.apply(this, arguments);
532
- };
533
- }
534
- };
535
- exports.isLikelyComponentType = function(type) {
536
- switch (typeof type) {
537
- case "function":
538
- if (type.prototype != null) {
539
- if (type.prototype.isReactComponent)
540
- return true;
541
- var ownNames = Object.getOwnPropertyNames(type.prototype);
542
- if (1 < ownNames.length || ownNames[0] !== "constructor" || type.prototype.__proto__ !== Object.prototype)
543
- return false;
544
- }
545
- type = type.name || type.displayName;
546
- return typeof type === "string" && /^[A-Z]/.test(type);
547
- case "object":
548
- if (type != null)
549
- switch (getProperty(type, "$$typeof")) {
550
- case REACT_FORWARD_REF_TYPE:
551
- case REACT_MEMO_TYPE:
552
- return true;
553
- }
554
- return false;
555
- default:
556
- return false;
557
- }
558
- };
559
- exports.performReactRefresh = function() {
560
- if (pendingUpdates.length === 0 || isPerformingRefresh)
561
- return null;
562
- isPerformingRefresh = true;
563
- try {
564
- var staleFamilies = new Set, updatedFamilies = new Set, updates = pendingUpdates;
565
- pendingUpdates = [];
566
- updates.forEach(function(_ref) {
567
- var family = _ref[0];
568
- _ref = _ref[1];
569
- var prevType = family.current;
570
- updatedFamiliesByType.set(prevType, family);
571
- updatedFamiliesByType.set(_ref, family);
572
- family.current = _ref;
573
- prevType.prototype && prevType.prototype.isReactComponent || _ref.prototype && _ref.prototype.isReactComponent ? _ref = false : (prevType = allSignaturesByType.get(prevType), _ref = allSignaturesByType.get(_ref), _ref = prevType === undefined && _ref === undefined || prevType !== undefined && _ref !== undefined && computeFullKey(prevType) === computeFullKey(_ref) && !_ref.forceReset ? true : false);
574
- _ref ? updatedFamilies.add(family) : staleFamilies.add(family);
575
- });
576
- var update = {
577
- updatedFamilies,
578
- staleFamilies
579
- };
580
- helpersByRendererID.forEach(function(helpers) {
581
- helpers.setRefreshHandler(resolveFamily);
582
- });
583
- var didError = false, firstError = null, failedRootsSnapshot = cloneSet(failedRoots), mountedRootsSnapshot = cloneSet(mountedRoots), helpersByRootSnapshot = cloneMap(helpersByRoot);
584
- failedRootsSnapshot.forEach(function(root) {
585
- var helpers = helpersByRootSnapshot.get(root);
586
- if (helpers === undefined)
587
- throw Error("Could not find helpers for a root. This is a bug in React Refresh.");
588
- failedRoots.has(root);
589
- if (rootElements !== null && rootElements.has(root)) {
590
- var element = rootElements.get(root);
591
- try {
592
- helpers.scheduleRoot(root, element);
593
- } catch (err) {
594
- didError || (didError = true, firstError = err);
595
- }
596
- }
597
- });
598
- mountedRootsSnapshot.forEach(function(root) {
599
- var helpers = helpersByRootSnapshot.get(root);
600
- if (helpers === undefined)
601
- throw Error("Could not find helpers for a root. This is a bug in React Refresh.");
602
- mountedRoots.has(root);
603
- try {
604
- helpers.scheduleRefresh(root, update);
605
- } catch (err) {
606
- didError || (didError = true, firstError = err);
607
- }
608
- });
609
- if (didError)
610
- throw firstError;
611
- return update;
612
- } finally {
613
- isPerformingRefresh = false;
614
- }
615
- };
616
- exports.register = register;
617
- exports.setSignature = setSignature;
618
- })();
619
- });
620
-
621
- // node_modules/react-refresh/runtime.js
622
- var require_runtime = __commonJS((exports, module) => {
623
- var react_refresh_runtime_development = __toESM(require_react_refresh_runtime_development());
624
- if (false) {} else {
625
- module.exports = react_refresh_runtime_development;
626
- }
627
- });
628
-
629
366
  // src/dev/simpleHTMLHMR.ts
630
367
  var exports_simpleHTMLHMR = {};
631
368
  __export(exports_simpleHTMLHMR, {
@@ -1224,7 +961,7 @@ var devClientDir3 = (() => {
1224
961
  })();
1225
962
  var hmrClientPath3 = join3(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
1226
963
  var refreshSetupPath = join3(devClientDir3, "reactRefreshSetup.ts").replace(/\\/g, "/");
1227
- var generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev = false, enableRefresh = false) => {
964
+ var generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev = false) => {
1228
965
  await rm(reactIndexesDirectory, { force: true, recursive: true });
1229
966
  await mkdir3(reactIndexesDirectory);
1230
967
  const pagesGlob = new Glob("*.*");
@@ -1238,7 +975,7 @@ var generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory,
1238
975
  const hmrPreamble = isDev ? [
1239
976
  `window.__HMR_FRAMEWORK__ = "react";`,
1240
977
  `window.__REACT_COMPONENT_KEY__ = "${componentName}Index";`,
1241
- ...enableRefresh ? [`import '${refreshSetupPath}';`] : [],
978
+ `import '${refreshSetupPath}';`,
1242
979
  `import '${hmrClientPath3}';
1243
980
  `
1244
981
  ] : [];
@@ -1453,7 +1190,7 @@ var generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory,
1453
1190
  return writeFile(join3(reactIndexesDirectory, `${componentName}.tsx`), content);
1454
1191
  });
1455
1192
  await Promise.all(promises);
1456
- if (enableRefresh) {
1193
+ if (isDev) {
1457
1194
  await writeFile(join3(reactIndexesDirectory, "_refresh.tsx"), `import 'react';
1458
1195
  import 'react-dom/client';
1459
1196
  `);
@@ -1734,14 +1471,6 @@ var validateSafePath = (targetPath, baseDirectory) => {
1734
1471
 
1735
1472
  // src/core/build.ts
1736
1473
  var isDev = env2.NODE_ENV !== "production";
1737
- var hasReactRefresh = (() => {
1738
- try {
1739
- __require.resolve("/home/alexkahn/abs/absolutejs/node_modules/react-refresh/runtime.js");
1740
- return true;
1741
- } catch {
1742
- return false;
1743
- }
1744
- })();
1745
1474
  var vueFeatureFlags = {
1746
1475
  __VUE_OPTIONS_API__: "true",
1747
1476
  __VUE_PROD_DEVTOOLS__: isDev ? "true" : "false",
@@ -1769,6 +1498,7 @@ var build2 = async ({
1769
1498
  console.log(`\u26A1 Incremental build: ${incrementalFiles.length} file(s) to rebuild`);
1770
1499
  }
1771
1500
  const throwOnError = options?.throwOnError === true;
1501
+ const hmr = options?.injectHMR === true;
1772
1502
  const buildPath = validateSafePath(buildDirectory, projectRoot);
1773
1503
  const assetsPath = assetsDirectory && validateSafePath(assetsDirectory, projectRoot);
1774
1504
  const reactDir = reactDirectory && validateSafePath(reactDirectory, projectRoot);
@@ -1833,7 +1563,7 @@ var build2 = async ({
1833
1563
  return matchingEntries;
1834
1564
  };
1835
1565
  if (reactIndexesPath && reactPagesPath) {
1836
- await generateReactIndexFiles(reactPagesPath, reactIndexesPath, isDev, isDev && hasReactRefresh);
1566
+ await generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr);
1837
1567
  }
1838
1568
  if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/assets/")))) {
1839
1569
  cpSync(assetsPath, join5(buildPath, "assets"), {
@@ -1870,12 +1600,12 @@ var build2 = async ({
1870
1600
  const htmxCssEntries = isIncremental && !shouldIncludeHtmxAssets ? filterToIncrementalEntries(allHtmxCssEntries, (entry) => entry) : allHtmxCssEntries;
1871
1601
  const reactCssEntries = isIncremental ? filterToIncrementalEntries(allReactCssEntries, (entry) => entry) : allReactCssEntries;
1872
1602
  const svelteCssEntries = isIncremental ? filterToIncrementalEntries(allSvelteCssEntries, (entry) => entry) : allSvelteCssEntries;
1873
- const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = svelteDir ? await compileSvelte(svelteEntries, svelteDir, new Map, isDev) : {
1603
+ const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = svelteDir ? await compileSvelte(svelteEntries, svelteDir, new Map, hmr) : {
1874
1604
  svelteClientPaths: [],
1875
1605
  svelteIndexPaths: [],
1876
1606
  svelteServerPaths: []
1877
1607
  };
1878
- const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = vueDir ? await compileVue(vueEntries, vueDir, isDev) : {
1608
+ const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = vueDir ? await compileVue(vueEntries, vueDir, hmr) : {
1879
1609
  vueClientPaths: [],
1880
1610
  vueCssPaths: [],
1881
1611
  vueIndexPaths: [],
@@ -1927,7 +1657,7 @@ var build2 = async ({
1927
1657
  }
1928
1658
  let reactClientLogs = [];
1929
1659
  let reactClientOutputs = [];
1930
- if (isDev && hasReactRefresh && reactIndexesPath && reactClientEntryPoints.length > 0) {
1660
+ if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
1931
1661
  const refreshEntry = join5(reactIndexesPath, "_refresh.tsx");
1932
1662
  if (!reactClientEntryPoints.includes(refreshEntry)) {
1933
1663
  reactClientEntryPoints.push(refreshEntry);
@@ -1945,7 +1675,7 @@ var build2 = async ({
1945
1675
  target: "browser",
1946
1676
  throw: false
1947
1677
  };
1948
- if (isDev && hasReactRefresh) {
1678
+ if (hmr) {
1949
1679
  reactBuildConfig.reactFastRefresh = true;
1950
1680
  }
1951
1681
  const reactClientResult = await bunBuild2(reactBuildConfig);
@@ -1964,7 +1694,7 @@ var build2 = async ({
1964
1694
  let nonReactClientLogs = [];
1965
1695
  let nonReactClientOutputs = [];
1966
1696
  if (nonReactClientEntryPoints.length > 0) {
1967
- const htmlScriptPlugin = isDev ? createHTMLScriptHMRPlugin(htmlDir, htmxDir) : undefined;
1697
+ const htmlScriptPlugin = hmr ? createHTMLScriptHMRPlugin(htmlDir, htmxDir) : undefined;
1968
1698
  const nonReactClientResult = await bunBuild2({
1969
1699
  define: vueDirectory ? vueFeatureFlags : undefined,
1970
1700
  entrypoints: nonReactClientEntryPoints,
@@ -2038,7 +1768,7 @@ var build2 = async ({
2038
1768
  const shouldCopyHtmx = htmxOrHtmxCssChanged;
2039
1769
  const shouldUpdateHtmlAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || f.endsWith(".css")));
2040
1770
  const shouldUpdateHtmxAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/htmx/") && (f.endsWith(".html") || f.endsWith(".css")));
2041
- const hmrClientBundle = isDev && (htmlDir || htmxDir) ? await buildHMRClient() : null;
1771
+ const hmrClientBundle = hmr && (htmlDir || htmxDir) ? await buildHMRClient() : null;
2042
1772
  const injectHMRIntoHTMLFile = (filePath, framework) => {
2043
1773
  if (!hmrClientBundle)
2044
1774
  return;
@@ -2064,7 +1794,7 @@ var build2 = async ({
2064
1794
  }
2065
1795
  const htmlPageFiles = await scanEntryPoints(outputHtmlPages, "*.html");
2066
1796
  for (const htmlFile of htmlPageFiles) {
2067
- if (isDev)
1797
+ if (hmr)
2068
1798
  injectHMRIntoHTMLFile(htmlFile, "html");
2069
1799
  const fileName = basename4(htmlFile, ".html");
2070
1800
  manifest[fileName] = htmlFile;
@@ -2095,7 +1825,7 @@ var build2 = async ({
2095
1825
  }
2096
1826
  const htmxPageFiles = await scanEntryPoints(outputHtmxPages, "*.html");
2097
1827
  for (const htmxFile of htmxPageFiles) {
2098
- if (isDev)
1828
+ if (hmr)
2099
1829
  injectHMRIntoHTMLFile(htmxFile, "htmx");
2100
1830
  const fileName = basename4(htmxFile, ".html");
2101
1831
  manifest[fileName] = htmxFile;
@@ -3046,6 +2776,7 @@ var triggerRebuild = async (state, config, onRebuildComplete, filesToRebuild) =>
3046
2776
  incrementalFiles: filesToRebuild && filesToRebuild.length > 0 ? filesToRebuild : undefined,
3047
2777
  options: {
3048
2778
  ...config.options,
2779
+ injectHMR: true,
3049
2780
  preserveIntermediateFiles: true,
3050
2781
  throwOnError: true
3051
2782
  }
@@ -3479,6 +3210,7 @@ var devBuild = async (config) => {
3479
3210
  ...config,
3480
3211
  options: {
3481
3212
  ...config.options,
3213
+ injectHMR: true,
3482
3214
  preserveIntermediateFiles: true
3483
3215
  }
3484
3216
  });
@@ -3738,5 +3470,5 @@ export {
3738
3470
  BUN_BUILD_WARNING_SUPPRESSION
3739
3471
  };
3740
3472
 
3741
- //# debugId=0146B3AA5058A58F64756E2164756E21
3473
+ //# debugId=AB4F6D45E142D05F64756E2164756E21
3742
3474
  //# sourceMappingURL=index.js.map