@absolutejs/absolute 0.15.0 → 0.15.2
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/dev/client/cssUtils.ts +288 -0
- package/dist/dev/client/domDiff.ts +261 -0
- package/dist/dev/client/domState.ts +271 -0
- package/dist/dev/client/errorOverlay.ts +145 -0
- package/dist/dev/client/frameworkDetect.ts +63 -0
- package/dist/dev/client/handlers/html.ts +415 -0
- package/dist/dev/client/handlers/htmx.ts +248 -0
- package/dist/dev/client/handlers/react.ts +80 -0
- package/dist/dev/client/handlers/rebuild.ts +147 -0
- package/dist/dev/client/handlers/svelte.ts +129 -0
- package/dist/dev/client/handlers/vue.ts +254 -0
- package/dist/dev/client/headPatch.ts +213 -0
- package/dist/dev/client/hmrClient.ts +204 -0
- package/dist/dev/client/moduleVersions.ts +57 -0
- package/dist/dev/client/reactRefreshSetup.ts +21 -0
- package/dist/index.js +321 -29
- package/dist/index.js.map +9 -7
- package/dist/src/build/generateReactIndexes.d.ts +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
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);
|
|
3
19
|
var __export = (target, all) => {
|
|
4
20
|
for (var name in all)
|
|
5
21
|
__defProp(target, name, {
|
|
@@ -42,6 +58,7 @@ __export(exports_compileVue, {
|
|
|
42
58
|
compileVue: () => compileVue,
|
|
43
59
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
44
60
|
});
|
|
61
|
+
import { existsSync as existsSync2 } from "fs";
|
|
45
62
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
46
63
|
import { basename as basename2, dirname as dirname2, join as join2, relative as relative2, resolve as resolve2 } from "path";
|
|
47
64
|
import {
|
|
@@ -51,7 +68,7 @@ import {
|
|
|
51
68
|
compileStyle
|
|
52
69
|
} from "@vue/compiler-sfc";
|
|
53
70
|
var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
54
|
-
var hmrClientPath2, transpiler2, scriptCache, scriptSetupCache, templateCache, styleCache, vueHmrMetadata, detectVueChangeType = (filePath, descriptor) => {
|
|
71
|
+
var devClientDir2, hmrClientPath2, transpiler2, scriptCache, scriptSetupCache, templateCache, styleCache, vueHmrMetadata, detectVueChangeType = (filePath, descriptor) => {
|
|
55
72
|
const prevScript = scriptCache.get(filePath);
|
|
56
73
|
const prevScriptSetup = scriptSetupCache.get(filePath);
|
|
57
74
|
const prevTemplate = templateCache.get(filePath);
|
|
@@ -347,7 +364,13 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
347
364
|
};
|
|
348
365
|
};
|
|
349
366
|
var init_compileVue = __esm(() => {
|
|
350
|
-
|
|
367
|
+
devClientDir2 = (() => {
|
|
368
|
+
const fromSource = resolve2(import.meta.dir, "../dev/client");
|
|
369
|
+
if (existsSync2(fromSource))
|
|
370
|
+
return fromSource;
|
|
371
|
+
return resolve2(import.meta.dir, "./dev/client");
|
|
372
|
+
})();
|
|
373
|
+
hmrClientPath2 = join2(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
351
374
|
transpiler2 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
352
375
|
scriptCache = new Map;
|
|
353
376
|
scriptSetupCache = new Map;
|
|
@@ -356,17 +379,264 @@ var init_compileVue = __esm(() => {
|
|
|
356
379
|
vueHmrMetadata = new Map;
|
|
357
380
|
});
|
|
358
381
|
|
|
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
|
+
|
|
359
629
|
// src/dev/simpleHTMLHMR.ts
|
|
360
630
|
var exports_simpleHTMLHMR = {};
|
|
361
631
|
__export(exports_simpleHTMLHMR, {
|
|
362
632
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
363
633
|
});
|
|
364
|
-
import { readFileSync as readFileSync4, existsSync as
|
|
634
|
+
import { readFileSync as readFileSync4, existsSync as existsSync6 } from "fs";
|
|
365
635
|
import { resolve as resolve13 } from "path";
|
|
366
636
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
367
637
|
try {
|
|
368
638
|
const resolvedPath = resolve13(htmlFilePath);
|
|
369
|
-
if (!
|
|
639
|
+
if (!existsSync6(resolvedPath)) {
|
|
370
640
|
return null;
|
|
371
641
|
}
|
|
372
642
|
const htmlContent = readFileSync4(resolvedPath, "utf-8");
|
|
@@ -648,12 +918,12 @@ var exports_simpleHTMXHMR = {};
|
|
|
648
918
|
__export(exports_simpleHTMXHMR, {
|
|
649
919
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
650
920
|
});
|
|
651
|
-
import { readFileSync as readFileSync5, existsSync as
|
|
921
|
+
import { readFileSync as readFileSync5, existsSync as existsSync7 } from "fs";
|
|
652
922
|
import { resolve as resolve16 } from "path";
|
|
653
923
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
654
924
|
try {
|
|
655
925
|
const resolvedPath = resolve16(htmxFilePath);
|
|
656
|
-
if (!
|
|
926
|
+
if (!existsSync7(resolvedPath)) {
|
|
657
927
|
return null;
|
|
658
928
|
}
|
|
659
929
|
const htmlContent = readFileSync5(resolvedPath, "utf-8");
|
|
@@ -722,6 +992,7 @@ import { cwd, env as env2, exit } from "process";
|
|
|
722
992
|
var {$, build: bunBuild2, Glob: Glob3 } = globalThis.Bun;
|
|
723
993
|
|
|
724
994
|
// src/build/compileSvelte.ts
|
|
995
|
+
import { existsSync } from "fs";
|
|
725
996
|
import { mkdir, stat } from "fs/promises";
|
|
726
997
|
import {
|
|
727
998
|
dirname,
|
|
@@ -735,7 +1006,13 @@ import {
|
|
|
735
1006
|
import { env } from "process";
|
|
736
1007
|
var {write, file, Transpiler } = globalThis.Bun;
|
|
737
1008
|
import { compile, compileModule, preprocess } from "svelte/compiler";
|
|
738
|
-
var
|
|
1009
|
+
var devClientDir = (() => {
|
|
1010
|
+
const fromSource = resolve(import.meta.dir, "../dev/client");
|
|
1011
|
+
if (existsSync(fromSource))
|
|
1012
|
+
return fromSource;
|
|
1013
|
+
return resolve(import.meta.dir, "./dev/client");
|
|
1014
|
+
})();
|
|
1015
|
+
var hmrClientPath = join(devClientDir, "hmrClient.ts").replace(/\\/g, "/");
|
|
739
1016
|
var transpiler = new Transpiler({ loader: "ts", target: "browser" });
|
|
740
1017
|
var exists = async (path) => {
|
|
741
1018
|
try {
|
|
@@ -935,12 +1212,19 @@ var generateManifest = (outputs, buildPath) => outputs.reduce((manifest, artifac
|
|
|
935
1212
|
}, {});
|
|
936
1213
|
|
|
937
1214
|
// src/build/generateReactIndexes.ts
|
|
1215
|
+
import { existsSync as existsSync3 } from "fs";
|
|
938
1216
|
import { mkdir as mkdir3, rm, writeFile } from "fs/promises";
|
|
939
1217
|
import { basename as basename3, join as join3, resolve as resolve3 } from "path";
|
|
940
1218
|
var {Glob } = globalThis.Bun;
|
|
941
|
-
var
|
|
942
|
-
|
|
943
|
-
|
|
1219
|
+
var devClientDir3 = (() => {
|
|
1220
|
+
const fromSource = resolve3(import.meta.dir, "../dev/client");
|
|
1221
|
+
if (existsSync3(fromSource))
|
|
1222
|
+
return fromSource;
|
|
1223
|
+
return resolve3(import.meta.dir, "./dev/client");
|
|
1224
|
+
})();
|
|
1225
|
+
var hmrClientPath3 = join3(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
1226
|
+
var refreshSetupPath = join3(devClientDir3, "reactRefreshSetup.ts").replace(/\\/g, "/");
|
|
1227
|
+
var generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev = false, enableRefresh = false) => {
|
|
944
1228
|
await rm(reactIndexesDirectory, { force: true, recursive: true });
|
|
945
1229
|
await mkdir3(reactIndexesDirectory);
|
|
946
1230
|
const pagesGlob = new Glob("*.*");
|
|
@@ -954,7 +1238,7 @@ var generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory,
|
|
|
954
1238
|
const hmrPreamble = isDev ? [
|
|
955
1239
|
`window.__HMR_FRAMEWORK__ = "react";`,
|
|
956
1240
|
`window.__REACT_COMPONENT_KEY__ = "${componentName}Index";`,
|
|
957
|
-
`import '${refreshSetupPath}'
|
|
1241
|
+
...enableRefresh ? [`import '${refreshSetupPath}';`] : [],
|
|
958
1242
|
`import '${hmrClientPath3}';
|
|
959
1243
|
`
|
|
960
1244
|
] : [];
|
|
@@ -1169,7 +1453,7 @@ var generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory,
|
|
|
1169
1453
|
return writeFile(join3(reactIndexesDirectory, `${componentName}.tsx`), content);
|
|
1170
1454
|
});
|
|
1171
1455
|
await Promise.all(promises);
|
|
1172
|
-
if (
|
|
1456
|
+
if (enableRefresh) {
|
|
1173
1457
|
await writeFile(join3(reactIndexesDirectory, "_refresh.tsx"), `import 'react';
|
|
1174
1458
|
import 'react-dom/client';
|
|
1175
1459
|
`);
|
|
@@ -1450,6 +1734,14 @@ var validateSafePath = (targetPath, baseDirectory) => {
|
|
|
1450
1734
|
|
|
1451
1735
|
// src/core/build.ts
|
|
1452
1736
|
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
|
+
})();
|
|
1453
1745
|
var vueFeatureFlags = {
|
|
1454
1746
|
__VUE_OPTIONS_API__: "true",
|
|
1455
1747
|
__VUE_PROD_DEVTOOLS__: isDev ? "true" : "false",
|
|
@@ -1541,7 +1833,7 @@ var build2 = async ({
|
|
|
1541
1833
|
return matchingEntries;
|
|
1542
1834
|
};
|
|
1543
1835
|
if (reactIndexesPath && reactPagesPath) {
|
|
1544
|
-
await generateReactIndexFiles(reactPagesPath, reactIndexesPath, isDev);
|
|
1836
|
+
await generateReactIndexFiles(reactPagesPath, reactIndexesPath, isDev, isDev && hasReactRefresh);
|
|
1545
1837
|
}
|
|
1546
1838
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/assets/")))) {
|
|
1547
1839
|
cpSync(assetsPath, join5(buildPath, "assets"), {
|
|
@@ -1635,7 +1927,7 @@ var build2 = async ({
|
|
|
1635
1927
|
}
|
|
1636
1928
|
let reactClientLogs = [];
|
|
1637
1929
|
let reactClientOutputs = [];
|
|
1638
|
-
if (isDev && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
1930
|
+
if (isDev && hasReactRefresh && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
1639
1931
|
const refreshEntry = join5(reactIndexesPath, "_refresh.tsx");
|
|
1640
1932
|
if (!reactClientEntryPoints.includes(refreshEntry)) {
|
|
1641
1933
|
reactClientEntryPoints.push(refreshEntry);
|
|
@@ -1653,7 +1945,7 @@ var build2 = async ({
|
|
|
1653
1945
|
target: "browser",
|
|
1654
1946
|
throw: false
|
|
1655
1947
|
};
|
|
1656
|
-
if (isDev) {
|
|
1948
|
+
if (isDev && hasReactRefresh) {
|
|
1657
1949
|
reactBuildConfig.reactFastRefresh = true;
|
|
1658
1950
|
}
|
|
1659
1951
|
const reactClientResult = await bunBuild2(reactBuildConfig);
|
|
@@ -1823,7 +2115,7 @@ import { statSync } from "fs";
|
|
|
1823
2115
|
import { resolve as resolve18 } from "path";
|
|
1824
2116
|
|
|
1825
2117
|
// src/dev/dependencyGraph.ts
|
|
1826
|
-
import { readFileSync as readFileSync2, readdirSync, existsSync } from "fs";
|
|
2118
|
+
import { readFileSync as readFileSync2, readdirSync, existsSync as existsSync4 } from "fs";
|
|
1827
2119
|
import { resolve as resolve7 } from "path";
|
|
1828
2120
|
var createDependencyGraph = () => ({
|
|
1829
2121
|
dependencies: new Map,
|
|
@@ -1831,7 +2123,7 @@ var createDependencyGraph = () => ({
|
|
|
1831
2123
|
});
|
|
1832
2124
|
var extractDependencies = (filePath) => {
|
|
1833
2125
|
try {
|
|
1834
|
-
if (!
|
|
2126
|
+
if (!existsSync4(filePath)) {
|
|
1835
2127
|
return [];
|
|
1836
2128
|
}
|
|
1837
2129
|
const content = readFileSync2(filePath, "utf-8");
|
|
@@ -1923,7 +2215,7 @@ var resolveImportPath = (importPath, fromFile) => {
|
|
|
1923
2215
|
};
|
|
1924
2216
|
var addFileToGraph = (graph, filePath) => {
|
|
1925
2217
|
const normalizedPath = resolve7(filePath);
|
|
1926
|
-
if (!
|
|
2218
|
+
if (!existsSync4(normalizedPath)) {
|
|
1927
2219
|
return;
|
|
1928
2220
|
}
|
|
1929
2221
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -2023,7 +2315,7 @@ var buildInitialDependencyGraph = (graph, directories) => {
|
|
|
2023
2315
|
};
|
|
2024
2316
|
for (const dir of directories) {
|
|
2025
2317
|
const resolvedDir = resolve7(dir);
|
|
2026
|
-
if (
|
|
2318
|
+
if (existsSync4(resolvedDir)) {
|
|
2027
2319
|
scanDirectory(resolvedDir);
|
|
2028
2320
|
}
|
|
2029
2321
|
}
|
|
@@ -2105,7 +2397,7 @@ var incrementSourceFileVersions = (state, filePaths) => {
|
|
|
2105
2397
|
|
|
2106
2398
|
// src/dev/fileWatcher.ts
|
|
2107
2399
|
import { watch } from "fs";
|
|
2108
|
-
import { existsSync as
|
|
2400
|
+
import { existsSync as existsSync5 } from "fs";
|
|
2109
2401
|
import { join as join6, resolve as resolve9 } from "path";
|
|
2110
2402
|
|
|
2111
2403
|
// src/dev/pathUtils.ts
|
|
@@ -2222,7 +2514,7 @@ var startFileWatching = (state, config, onFileChange) => {
|
|
|
2222
2514
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
2223
2515
|
for (const path of watchPaths) {
|
|
2224
2516
|
const absolutePath = resolve9(path).replace(/\\/g, "/");
|
|
2225
|
-
if (!
|
|
2517
|
+
if (!existsSync5(absolutePath)) {
|
|
2226
2518
|
continue;
|
|
2227
2519
|
}
|
|
2228
2520
|
const watcher = watch(absolutePath, { recursive: true }, (event, filename) => {
|
|
@@ -2235,14 +2527,14 @@ var startFileWatching = (state, config, onFileChange) => {
|
|
|
2235
2527
|
if (shouldIgnorePath(fullPath)) {
|
|
2236
2528
|
return;
|
|
2237
2529
|
}
|
|
2238
|
-
if (event === "rename" && !
|
|
2530
|
+
if (event === "rename" && !existsSync5(fullPath)) {
|
|
2239
2531
|
try {
|
|
2240
2532
|
removeFileFromGraph(state.dependencyGraph, fullPath);
|
|
2241
2533
|
} catch {}
|
|
2242
2534
|
onFileChange(fullPath);
|
|
2243
2535
|
return;
|
|
2244
2536
|
}
|
|
2245
|
-
if (
|
|
2537
|
+
if (existsSync5(fullPath)) {
|
|
2246
2538
|
onFileChange(fullPath);
|
|
2247
2539
|
try {
|
|
2248
2540
|
addFileToGraph(state.dependencyGraph, fullPath);
|
|
@@ -2352,7 +2644,7 @@ var cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
|
2352
2644
|
var lookupAsset = (store, path) => store.get(path);
|
|
2353
2645
|
|
|
2354
2646
|
// src/dev/rebuildTrigger.ts
|
|
2355
|
-
import { existsSync as
|
|
2647
|
+
import { existsSync as existsSync8 } from "fs";
|
|
2356
2648
|
import { basename as basename8, resolve as resolve17 } from "path";
|
|
2357
2649
|
|
|
2358
2650
|
// src/dev/fileHashTracker.ts
|
|
@@ -2663,13 +2955,13 @@ var queueFileChange = (state, filePath, config, onRebuildComplete) => {
|
|
|
2663
2955
|
const validFiles = [];
|
|
2664
2956
|
const processedFiles = new Set;
|
|
2665
2957
|
for (const filePathInSet of filePathSet) {
|
|
2666
|
-
if (!
|
|
2958
|
+
if (!existsSync8(filePathInSet)) {
|
|
2667
2959
|
state.fileHashes.delete(filePathInSet);
|
|
2668
2960
|
try {
|
|
2669
2961
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
2670
2962
|
const deletedPathResolved = resolve17(filePathInSet);
|
|
2671
2963
|
for (const affectedFile of affectedFiles) {
|
|
2672
|
-
if (affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
2964
|
+
if (affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync8(affectedFile)) {
|
|
2673
2965
|
validFiles.push(affectedFile);
|
|
2674
2966
|
processedFiles.add(affectedFile);
|
|
2675
2967
|
}
|
|
@@ -2690,7 +2982,7 @@ var queueFileChange = (state, filePath, config, onRebuildComplete) => {
|
|
|
2690
2982
|
try {
|
|
2691
2983
|
const dependents = state.dependencyGraph.dependents.get(normalizedFilePath);
|
|
2692
2984
|
if (dependents && dependents.size > 0) {
|
|
2693
|
-
const dependentFiles = Array.from(dependents).filter((f) =>
|
|
2985
|
+
const dependentFiles = Array.from(dependents).filter((f) => existsSync8(f));
|
|
2694
2986
|
if (dependentFiles.length > 0) {
|
|
2695
2987
|
incrementSourceFileVersions(state, dependentFiles);
|
|
2696
2988
|
}
|
|
@@ -2699,7 +2991,7 @@ var queueFileChange = (state, filePath, config, onRebuildComplete) => {
|
|
|
2699
2991
|
try {
|
|
2700
2992
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
2701
2993
|
for (const affectedFile of affectedFiles) {
|
|
2702
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
2994
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync8(affectedFile)) {
|
|
2703
2995
|
validFiles.push(affectedFile);
|
|
2704
2996
|
processedFiles.add(affectedFile);
|
|
2705
2997
|
}
|
|
@@ -3446,5 +3738,5 @@ export {
|
|
|
3446
3738
|
BUN_BUILD_WARNING_SUPPRESSION
|
|
3447
3739
|
};
|
|
3448
3740
|
|
|
3449
|
-
//# debugId=
|
|
3741
|
+
//# debugId=0146B3AA5058A58F64756E2164756E21
|
|
3450
3742
|
//# sourceMappingURL=index.js.map
|