@absolutejs/absolute 0.19.0-beta.853 → 0.19.0-beta.855
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/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +50 -76
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +51 -77
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +469 -652
- package/dist/build.js.map +6 -7
- package/dist/dev/client/hmrClient.ts +35 -6
- package/dist/index.js +490 -673
- package/dist/index.js.map +6 -7
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +14 -1
- package/dist/src/dev/rebuildTrigger.d.ts +1 -0
- package/package.json +1 -1
- package/dist/dev/client/handlers/angular.ts +0 -684
- package/dist/dev/client/handlers/angularRuntime.ts +0 -415
- package/dist/src/dev/angular/editTypeDetection.d.ts +0 -8
package/dist/index.js
CHANGED
|
@@ -11683,26 +11683,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11683
11683
|
if (existsSync17(fromNodeModules))
|
|
11684
11684
|
return fromNodeModules;
|
|
11685
11685
|
return resolve20(import.meta.dir, "./dev/client");
|
|
11686
|
-
}, devClientDir4, hmrClientPath5,
|
|
11687
|
-
const entityClassRegex = /(?:export\s+)?class\s+(\w+(?:Component|Service|Directive|Pipe))\s/g;
|
|
11688
|
-
const entityNames = [];
|
|
11689
|
-
let match;
|
|
11690
|
-
while ((match = entityClassRegex.exec(content)) !== null) {
|
|
11691
|
-
if (match[1])
|
|
11692
|
-
entityNames.push(match[1]);
|
|
11693
|
-
}
|
|
11694
|
-
if (entityNames.length === 0)
|
|
11695
|
-
return content;
|
|
11696
|
-
const registrations = entityNames.map((name) => ` if (typeof ${name} === 'function') window.__ANGULAR_HMR__.register('${sourceId}#${name}', ${name});`).join(`
|
|
11697
|
-
`);
|
|
11698
|
-
const hmrBlock = `
|
|
11699
|
-
// Angular HMR Runtime Layer (Level 3) \u2014 Auto-registration
|
|
11700
|
-
if (typeof window !== 'undefined' && window.__ANGULAR_HMR__) {
|
|
11701
|
-
${registrations}
|
|
11702
|
-
}
|
|
11703
|
-
`;
|
|
11704
|
-
return content + hmrBlock;
|
|
11705
|
-
}, formatDiagnosticMessage = (diagnostic) => {
|
|
11686
|
+
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
11706
11687
|
try {
|
|
11707
11688
|
return ts2.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
11708
11689
|
`);
|
|
@@ -12525,14 +12506,10 @@ export default ${componentClassName};
|
|
|
12525
12506
|
export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
12526
12507
|
`;
|
|
12527
12508
|
}
|
|
12528
|
-
if (hmr) {
|
|
12529
|
-
rewritten = injectHMRRegistration(rewritten, resolvedEntry);
|
|
12530
|
-
}
|
|
12531
12509
|
await traceAngularPhase("wrapper/write-server-output", () => fs.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
|
|
12532
12510
|
const relativePath = relative10(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
12533
12511
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
12534
12512
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
12535
|
-
import "${hmrRuntimePath}";
|
|
12536
12513
|
import "${hmrClientPath5}";
|
|
12537
12514
|
` : "";
|
|
12538
12515
|
const hydration = hmr ? `${hmrPreamble}
|
|
@@ -12574,68 +12551,66 @@ var absoluteHttpTransferCacheOptions = {
|
|
|
12574
12551
|
}
|
|
12575
12552
|
};
|
|
12576
12553
|
|
|
12577
|
-
//
|
|
12578
|
-
//
|
|
12579
|
-
//
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
//
|
|
12583
|
-
//
|
|
12584
|
-
//
|
|
12585
|
-
|
|
12586
|
-
|
|
12587
|
-
|
|
12588
|
-
|
|
12589
|
-
var
|
|
12590
|
-
|
|
12591
|
-
|
|
12592
|
-
|
|
12593
|
-
|
|
12594
|
-
|
|
12595
|
-
|
|
12596
|
-
|
|
12597
|
-
|
|
12598
|
-
if (
|
|
12599
|
-
|
|
12600
|
-
|
|
12601
|
-
|
|
12602
|
-
|
|
12603
|
-
|
|
12604
|
-
|
|
12605
|
-
|
|
12606
|
-
|
|
12607
|
-
|
|
12608
|
-
|
|
12609
|
-
|
|
12610
|
-
|
|
12611
|
-
|
|
12612
|
-
|
|
12613
|
-
|
|
12614
|
-
|
|
12615
|
-
|
|
12616
|
-
|
|
12617
|
-
|
|
12618
|
-
|
|
12619
|
-
|
|
12554
|
+
// SURGICAL_HMR Tier 1 \u2014 Re-bootstrap hook. The dev client invokes
|
|
12555
|
+
// \`window.__ABS_ANGULAR_REBOOTSTRAP__()\` when it receives an
|
|
12556
|
+
// \`angular:rebootstrap\` WS message; the hook looks up this page's
|
|
12557
|
+
// freshly-built bundle URL (the rebuild already broadcast its
|
|
12558
|
+
// updated manifest, so window.__HMR_MANIFEST__ is current) and
|
|
12559
|
+
// dynamic-imports it. Re-importing the chunk re-runs the
|
|
12560
|
+
// destroy+bootstrap block below \u2014 no special path needed because
|
|
12561
|
+
// chunk eval is the bootstrap.
|
|
12562
|
+
window.__ABS_ANGULAR_PAGE_BUNDLE_ID__ = '${toPascal(fileBase)}Index';
|
|
12563
|
+
window.__ABS_ANGULAR_REBOOTSTRAP__ = async function() {
|
|
12564
|
+
var id = window.__ABS_ANGULAR_PAGE_BUNDLE_ID__;
|
|
12565
|
+
var manifest = window.__HMR_MANIFEST__ || {};
|
|
12566
|
+
var newUrl = manifest[id];
|
|
12567
|
+
if (!newUrl) {
|
|
12568
|
+
console.warn('[absolutejs] no bundle URL in manifest for', id, '\u2014 full reload');
|
|
12569
|
+
window.location.reload();
|
|
12570
|
+
return;
|
|
12571
|
+
}
|
|
12572
|
+
await import(newUrl + '?t=' + Date.now());
|
|
12573
|
+
};
|
|
12574
|
+
|
|
12575
|
+
if (window.__ANGULAR_APP__) {
|
|
12576
|
+
try { window.__ANGULAR_APP__.destroy(); } catch (_err) { /* ignore */ }
|
|
12577
|
+
window.__ANGULAR_APP__ = null;
|
|
12578
|
+
}
|
|
12579
|
+
|
|
12580
|
+
// Ensure root element exists after destroy (Angular removes it)
|
|
12581
|
+
var _sel = ${componentClassName}.\u0275cmp?.selectors?.[0]?.[0] || 'ng-app';
|
|
12582
|
+
if (!document.querySelector(_sel)) {
|
|
12583
|
+
(document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
|
|
12584
|
+
}
|
|
12585
|
+
|
|
12586
|
+
var providers = [provideZonelessChangeDetection()];
|
|
12587
|
+
if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
|
|
12588
|
+
providers.push(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
|
|
12589
|
+
}
|
|
12590
|
+
delete window.__HMR_SKIP_HYDRATION__;
|
|
12591
|
+
providers.push.apply(providers, pageProviders);
|
|
12592
|
+
providers.push.apply(providers, propProviders);
|
|
12593
|
+
window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
|
|
12594
|
+
|
|
12595
|
+
if (pageHasRawStreamingSlots) {
|
|
12596
|
+
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
12597
|
+
if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
|
|
12598
|
+
requestAnimationFrame(function() {
|
|
12599
|
+
window.__ABS_SLOT_FLUSH__();
|
|
12600
|
+
});
|
|
12601
|
+
}
|
|
12602
|
+
} else {
|
|
12603
|
+
bootstrapApplication(${componentClassName}, {
|
|
12604
|
+
providers: providers
|
|
12605
|
+
}).then(function (appRef) {
|
|
12606
|
+
window.__ANGULAR_APP__ = appRef;
|
|
12620
12607
|
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
12621
12608
|
if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
|
|
12622
12609
|
requestAnimationFrame(function() {
|
|
12623
12610
|
window.__ABS_SLOT_FLUSH__();
|
|
12624
12611
|
});
|
|
12625
12612
|
}
|
|
12626
|
-
}
|
|
12627
|
-
bootstrapApplication(${componentClassName}, {
|
|
12628
|
-
providers: providers
|
|
12629
|
-
}).then(function (appRef) {
|
|
12630
|
-
window.__ANGULAR_APP__ = appRef;
|
|
12631
|
-
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
12632
|
-
if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
|
|
12633
|
-
requestAnimationFrame(function() {
|
|
12634
|
-
window.__ABS_SLOT_FLUSH__();
|
|
12635
|
-
});
|
|
12636
|
-
}
|
|
12637
|
-
});
|
|
12638
|
-
}
|
|
12613
|
+
});
|
|
12639
12614
|
}
|
|
12640
12615
|
`.trim() : `
|
|
12641
12616
|
import '@angular/compiler';
|
|
@@ -12737,7 +12712,6 @@ var init_compileAngular = __esm(() => {
|
|
|
12737
12712
|
init_generatedDir();
|
|
12738
12713
|
devClientDir4 = resolveDevClientDir4();
|
|
12739
12714
|
hmrClientPath5 = join18(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
12740
|
-
hmrRuntimePath = join18(devClientDir4, "handlers", "angularRuntime.ts").replace(/\\/g, "/");
|
|
12741
12715
|
jitContentCache = new Map;
|
|
12742
12716
|
wrapperOutputCache = new Map;
|
|
12743
12717
|
});
|
|
@@ -16704,247 +16678,6 @@ var init_ssrCache = __esm(() => {
|
|
|
16704
16678
|
dirtyFrameworks = new Set;
|
|
16705
16679
|
});
|
|
16706
16680
|
|
|
16707
|
-
// src/dev/angular/editTypeDetection.ts
|
|
16708
|
-
import { readFileSync as readFileSync18 } from "fs";
|
|
16709
|
-
import { basename as basename11 } from "path";
|
|
16710
|
-
import * as ts3 from "typescript";
|
|
16711
|
-
var TYPE_PRIORITY, STYLE_EXT_RE, COMPONENT_STYLE_RE, TEMPLATE_RE, COMPONENT_CLASS_RE, SERVICE_RE, ROUTES_RE, PAGE_TS_RE, SIDE_EFFECT_CALL_NAMES, SIDE_EFFECT_NEW_NAMES, getCalleeName = (node) => {
|
|
16712
|
-
const callee = node.expression;
|
|
16713
|
-
if (ts3.isIdentifier(callee))
|
|
16714
|
-
return callee.text;
|
|
16715
|
-
if (ts3.isPropertyAccessExpression(callee))
|
|
16716
|
-
return callee.name.text;
|
|
16717
|
-
return null;
|
|
16718
|
-
}, getNewExprName = (node) => {
|
|
16719
|
-
const callee = node.expression;
|
|
16720
|
-
if (ts3.isIdentifier(callee))
|
|
16721
|
-
return callee.text;
|
|
16722
|
-
if (ts3.isPropertyAccessExpression(callee))
|
|
16723
|
-
return callee.name.text;
|
|
16724
|
-
return null;
|
|
16725
|
-
}, collectMethodBodies = (cls) => {
|
|
16726
|
-
const methods = new Map;
|
|
16727
|
-
cls.members.forEach((member) => {
|
|
16728
|
-
if (!member.name || !ts3.isIdentifier(member.name))
|
|
16729
|
-
return;
|
|
16730
|
-
if (ts3.isMethodDeclaration(member) && member.body) {
|
|
16731
|
-
methods.set(member.name.text, member.body);
|
|
16732
|
-
return;
|
|
16733
|
-
}
|
|
16734
|
-
if (ts3.isPropertyDeclaration(member) && member.initializer) {
|
|
16735
|
-
const init = member.initializer;
|
|
16736
|
-
if (ts3.isArrowFunction(init) || ts3.isFunctionExpression(init)) {
|
|
16737
|
-
methods.set(member.name.text, init.body);
|
|
16738
|
-
}
|
|
16739
|
-
}
|
|
16740
|
-
});
|
|
16741
|
-
return methods;
|
|
16742
|
-
}, findSideEffectInBody = (body, methods, visited) => {
|
|
16743
|
-
let hit = { found: false };
|
|
16744
|
-
const walk = (node) => {
|
|
16745
|
-
if (hit.found)
|
|
16746
|
-
return;
|
|
16747
|
-
if (ts3.isCallExpression(node)) {
|
|
16748
|
-
const name = getCalleeName(node);
|
|
16749
|
-
if (name && SIDE_EFFECT_CALL_NAMES.has(name)) {
|
|
16750
|
-
hit = {
|
|
16751
|
-
found: true,
|
|
16752
|
-
reason: `constructor invokes ${name}(...)`
|
|
16753
|
-
};
|
|
16754
|
-
return;
|
|
16755
|
-
}
|
|
16756
|
-
if (name && methods.has(name) && !visited.has(name)) {
|
|
16757
|
-
visited.add(name);
|
|
16758
|
-
const target = methods.get(name);
|
|
16759
|
-
if (target) {
|
|
16760
|
-
const inner = findSideEffectInBody(target, methods, visited);
|
|
16761
|
-
if (inner.found) {
|
|
16762
|
-
hit = {
|
|
16763
|
-
found: true,
|
|
16764
|
-
reason: `${inner.reason} (via this.${name}())`
|
|
16765
|
-
};
|
|
16766
|
-
return;
|
|
16767
|
-
}
|
|
16768
|
-
}
|
|
16769
|
-
}
|
|
16770
|
-
}
|
|
16771
|
-
if (ts3.isNewExpression(node)) {
|
|
16772
|
-
const name = getNewExprName(node);
|
|
16773
|
-
if (name && SIDE_EFFECT_NEW_NAMES.has(name)) {
|
|
16774
|
-
hit = {
|
|
16775
|
-
found: true,
|
|
16776
|
-
reason: `constructor instantiates new ${name}(...)`
|
|
16777
|
-
};
|
|
16778
|
-
return;
|
|
16779
|
-
}
|
|
16780
|
-
}
|
|
16781
|
-
ts3.forEachChild(node, walk);
|
|
16782
|
-
};
|
|
16783
|
-
walk(body);
|
|
16784
|
-
return hit;
|
|
16785
|
-
}, analyzeServiceFile = (file5) => {
|
|
16786
|
-
let source;
|
|
16787
|
-
try {
|
|
16788
|
-
source = readFileSync18(file5, "utf8");
|
|
16789
|
-
} catch {
|
|
16790
|
-
return {
|
|
16791
|
-
hasSideEffectCtor: true,
|
|
16792
|
-
reason: "service file unreadable \u2014 defaulting to reboot"
|
|
16793
|
-
};
|
|
16794
|
-
}
|
|
16795
|
-
const sf = ts3.createSourceFile(file5, source, ts3.ScriptTarget.Latest, true);
|
|
16796
|
-
let result = {
|
|
16797
|
-
hasSideEffectCtor: false,
|
|
16798
|
-
reason: "constructor has no side-effecting calls"
|
|
16799
|
-
};
|
|
16800
|
-
const visit = (node) => {
|
|
16801
|
-
if (result.hasSideEffectCtor)
|
|
16802
|
-
return;
|
|
16803
|
-
if (!ts3.isClassDeclaration(node)) {
|
|
16804
|
-
ts3.forEachChild(node, visit);
|
|
16805
|
-
return;
|
|
16806
|
-
}
|
|
16807
|
-
const methods = collectMethodBodies(node);
|
|
16808
|
-
const ctor = node.members.find(ts3.isConstructorDeclaration);
|
|
16809
|
-
const targets = [];
|
|
16810
|
-
if (ctor?.body)
|
|
16811
|
-
targets.push(ctor.body);
|
|
16812
|
-
node.members.forEach((member) => {
|
|
16813
|
-
if (ts3.isPropertyDeclaration(member) && member.initializer) {
|
|
16814
|
-
targets.push(member.initializer);
|
|
16815
|
-
}
|
|
16816
|
-
});
|
|
16817
|
-
for (const target of targets) {
|
|
16818
|
-
const r = findSideEffectInBody(target, methods, new Set);
|
|
16819
|
-
if (r.found) {
|
|
16820
|
-
result = { hasSideEffectCtor: true, reason: r.reason };
|
|
16821
|
-
break;
|
|
16822
|
-
}
|
|
16823
|
-
}
|
|
16824
|
-
if (!result.hasSideEffectCtor)
|
|
16825
|
-
ts3.forEachChild(node, visit);
|
|
16826
|
-
};
|
|
16827
|
-
visit(sf);
|
|
16828
|
-
return result;
|
|
16829
|
-
}, classifyAngularEdit = (file5) => {
|
|
16830
|
-
const base = basename11(file5);
|
|
16831
|
-
if (TEMPLATE_RE.test(file5)) {
|
|
16832
|
-
return {
|
|
16833
|
-
type: "template",
|
|
16834
|
-
reason: `${base} \u2014 template edit`,
|
|
16835
|
-
sourceFile: file5
|
|
16836
|
-
};
|
|
16837
|
-
}
|
|
16838
|
-
if (COMPONENT_STYLE_RE.test(file5)) {
|
|
16839
|
-
return {
|
|
16840
|
-
type: "style-component",
|
|
16841
|
-
reason: `${base} \u2014 component-scoped stylesheet edit`,
|
|
16842
|
-
sourceFile: file5
|
|
16843
|
-
};
|
|
16844
|
-
}
|
|
16845
|
-
if (STYLE_EXT_RE.test(file5)) {
|
|
16846
|
-
return {
|
|
16847
|
-
type: "reboot",
|
|
16848
|
-
reason: `${base} \u2014 non-component-named stylesheet, falling back to reboot until scoping is verified`,
|
|
16849
|
-
sourceFile: file5
|
|
16850
|
-
};
|
|
16851
|
-
}
|
|
16852
|
-
if (ROUTES_RE.test(file5)) {
|
|
16853
|
-
return {
|
|
16854
|
-
type: "route",
|
|
16855
|
-
reason: `${base} \u2014 router config, requires reboot`,
|
|
16856
|
-
sourceFile: file5
|
|
16857
|
-
};
|
|
16858
|
-
}
|
|
16859
|
-
if (SERVICE_RE.test(file5)) {
|
|
16860
|
-
const a = analyzeServiceFile(file5);
|
|
16861
|
-
if (a.hasSideEffectCtor) {
|
|
16862
|
-
return {
|
|
16863
|
-
type: "service-with-side-effects",
|
|
16864
|
-
reason: `${base} \u2014 ${a.reason}`,
|
|
16865
|
-
sourceFile: file5
|
|
16866
|
-
};
|
|
16867
|
-
}
|
|
16868
|
-
return {
|
|
16869
|
-
type: "service-method-only",
|
|
16870
|
-
reason: `${base} \u2014 ${a.reason}`,
|
|
16871
|
-
sourceFile: file5
|
|
16872
|
-
};
|
|
16873
|
-
}
|
|
16874
|
-
if (COMPONENT_CLASS_RE.test(file5)) {
|
|
16875
|
-
return {
|
|
16876
|
-
type: "class-component",
|
|
16877
|
-
reason: `${base} \u2014 component class edit`,
|
|
16878
|
-
sourceFile: file5
|
|
16879
|
-
};
|
|
16880
|
-
}
|
|
16881
|
-
if (PAGE_TS_RE.test(file5)) {
|
|
16882
|
-
return {
|
|
16883
|
-
type: "class-component",
|
|
16884
|
-
reason: `${base} \u2014 page component edit`,
|
|
16885
|
-
sourceFile: file5
|
|
16886
|
-
};
|
|
16887
|
-
}
|
|
16888
|
-
return {
|
|
16889
|
-
type: "reboot",
|
|
16890
|
-
reason: `${base} \u2014 unrecognized angular file type, falling back to reboot`,
|
|
16891
|
-
sourceFile: file5
|
|
16892
|
-
};
|
|
16893
|
-
}, collapseClassifications = (classifications) => {
|
|
16894
|
-
if (classifications.length === 0) {
|
|
16895
|
-
return {
|
|
16896
|
-
type: "reboot",
|
|
16897
|
-
reason: "no classifiable files in batch",
|
|
16898
|
-
sourceFile: ""
|
|
16899
|
-
};
|
|
16900
|
-
}
|
|
16901
|
-
let winner = classifications[0];
|
|
16902
|
-
for (let i = 1;i < classifications.length; i++) {
|
|
16903
|
-
const candidate = classifications[i];
|
|
16904
|
-
if (TYPE_PRIORITY[candidate.type] > TYPE_PRIORITY[winner.type]) {
|
|
16905
|
-
winner = candidate;
|
|
16906
|
-
}
|
|
16907
|
-
}
|
|
16908
|
-
return winner;
|
|
16909
|
-
};
|
|
16910
|
-
var init_editTypeDetection = __esm(() => {
|
|
16911
|
-
TYPE_PRIORITY = {
|
|
16912
|
-
template: 0,
|
|
16913
|
-
"style-component": 1,
|
|
16914
|
-
"service-method-only": 2,
|
|
16915
|
-
"class-component": 3,
|
|
16916
|
-
"service-with-side-effects": 4,
|
|
16917
|
-
route: 5,
|
|
16918
|
-
reboot: 6
|
|
16919
|
-
};
|
|
16920
|
-
STYLE_EXT_RE = /\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
16921
|
-
COMPONENT_STYLE_RE = /\.component\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
16922
|
-
TEMPLATE_RE = /\.html$/i;
|
|
16923
|
-
COMPONENT_CLASS_RE = /\.component\.ts$/i;
|
|
16924
|
-
SERVICE_RE = /\.service\.ts$/i;
|
|
16925
|
-
ROUTES_RE = /(?:^|[\\/])(?:app\.)?routes\.ts$/i;
|
|
16926
|
-
PAGE_TS_RE = /(?:^|[\\/])pages[\\/][^\\/]+\.ts$/i;
|
|
16927
|
-
SIDE_EFFECT_CALL_NAMES = new Set([
|
|
16928
|
-
"subscribe",
|
|
16929
|
-
"setInterval",
|
|
16930
|
-
"setTimeout",
|
|
16931
|
-
"addEventListener",
|
|
16932
|
-
"effect",
|
|
16933
|
-
"afterNextRender",
|
|
16934
|
-
"afterRender",
|
|
16935
|
-
"afterEveryRender",
|
|
16936
|
-
"requestAnimationFrame",
|
|
16937
|
-
"requestIdleCallback"
|
|
16938
|
-
]);
|
|
16939
|
-
SIDE_EFFECT_NEW_NAMES = new Set([
|
|
16940
|
-
"Worker",
|
|
16941
|
-
"SharedWorker",
|
|
16942
|
-
"EventSource",
|
|
16943
|
-
"WebSocket",
|
|
16944
|
-
"BroadcastChannel"
|
|
16945
|
-
]);
|
|
16946
|
-
});
|
|
16947
|
-
|
|
16948
16681
|
// src/dev/moduleServer.ts
|
|
16949
16682
|
var exports_moduleServer = {};
|
|
16950
16683
|
__export(exports_moduleServer, {
|
|
@@ -16956,8 +16689,8 @@ __export(exports_moduleServer, {
|
|
|
16956
16689
|
createModuleServer: () => createModuleServer,
|
|
16957
16690
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
16958
16691
|
});
|
|
16959
|
-
import { existsSync as existsSync25, readFileSync as
|
|
16960
|
-
import { basename as
|
|
16692
|
+
import { existsSync as existsSync25, readFileSync as readFileSync18, statSync as statSync2 } from "fs";
|
|
16693
|
+
import { basename as basename11, dirname as dirname17, extname as extname8, join as join28, resolve as resolve31, relative as relative12 } from "path";
|
|
16961
16694
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
16962
16695
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
16963
16696
|
const allExports = [];
|
|
@@ -17029,7 +16762,7 @@ ${stubs}
|
|
|
17029
16762
|
const pkgDir = resolve31(projectRoot, "node_modules", packageName ?? "");
|
|
17030
16763
|
const pkgJsonPath = join28(pkgDir, "package.json");
|
|
17031
16764
|
if (existsSync25(pkgJsonPath)) {
|
|
17032
|
-
const pkg = JSON.parse(
|
|
16765
|
+
const pkg = JSON.parse(readFileSync18(pkgJsonPath, "utf-8"));
|
|
17033
16766
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
17034
16767
|
if (esmEntry) {
|
|
17035
16768
|
const resolved = resolve31(pkgDir, esmEntry);
|
|
@@ -17128,7 +16861,7 @@ ${code}`;
|
|
|
17128
16861
|
reactFastRefreshWarningEmitted = true;
|
|
17129
16862
|
logWarn("React HMR is blocked: this Bun build ignores " + "`reactFastRefresh` on Bun.Transpiler, so component state " + "cannot be preserved across edits. Tracking " + "https://github.com/oven-sh/bun/pull/28312 \u2014 if it still has " + "not merged, leave a \uD83D\uDC4D on the PR so the Bun team knows it " + "is blocking you. Until then, React edits trigger a full " + "reload instead of a fast refresh.");
|
|
17130
16863
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
17131
|
-
const raw =
|
|
16864
|
+
const raw = readFileSync18(filePath, "utf-8");
|
|
17132
16865
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
17133
16866
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
17134
16867
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -17144,7 +16877,7 @@ ${transpiled}`;
|
|
|
17144
16877
|
transpiled += buildIslandMetadataExports(raw);
|
|
17145
16878
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
17146
16879
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
17147
|
-
const raw =
|
|
16880
|
+
const raw = readFileSync18(filePath, "utf-8");
|
|
17148
16881
|
const ext = extname8(filePath);
|
|
17149
16882
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
17150
16883
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -17310,7 +17043,7 @@ ${code}`;
|
|
|
17310
17043
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
17311
17044
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
17312
17045
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
17313
|
-
const raw =
|
|
17046
|
+
const raw = readFileSync18(filePath, "utf-8");
|
|
17314
17047
|
if (!svelteCompiler) {
|
|
17315
17048
|
svelteCompiler = await import("svelte/compiler");
|
|
17316
17049
|
}
|
|
@@ -17370,12 +17103,12 @@ export default __script__;`;
|
|
|
17370
17103
|
return `${cssInjection}
|
|
17371
17104
|
${code}`;
|
|
17372
17105
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
17373
|
-
const rawSource =
|
|
17106
|
+
const rawSource = readFileSync18(filePath, "utf-8");
|
|
17374
17107
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
17375
17108
|
if (!vueCompiler) {
|
|
17376
17109
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
17377
17110
|
}
|
|
17378
|
-
const fileName =
|
|
17111
|
+
const fileName = basename11(filePath, ".vue");
|
|
17379
17112
|
const componentId = fileName.toLowerCase();
|
|
17380
17113
|
const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
|
|
17381
17114
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -17425,7 +17158,7 @@ ${code}`;
|
|
|
17425
17158
|
}
|
|
17426
17159
|
});
|
|
17427
17160
|
}, handleCssRequest = (filePath) => {
|
|
17428
|
-
const raw =
|
|
17161
|
+
const raw = readFileSync18(filePath, "utf-8");
|
|
17429
17162
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
17430
17163
|
return [
|
|
17431
17164
|
`const style = document.createElement('style');`,
|
|
@@ -17750,9 +17483,9 @@ var exports_resolveOwningComponents = {};
|
|
|
17750
17483
|
__export(exports_resolveOwningComponents, {
|
|
17751
17484
|
resolveOwningComponents: () => resolveOwningComponents
|
|
17752
17485
|
});
|
|
17753
|
-
import { readdirSync as readdirSync2, readFileSync as
|
|
17486
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync19, statSync as statSync3 } from "fs";
|
|
17754
17487
|
import { dirname as dirname18, extname as extname9, join as join29, resolve as resolve32 } from "path";
|
|
17755
|
-
import
|
|
17488
|
+
import ts3 from "typescript";
|
|
17756
17489
|
var isComponentTsFile = (file5) => file5.endsWith(".component.ts") || file5.endsWith(".component.tsx"), walkComponentTsFiles = (root) => {
|
|
17757
17490
|
const out = [];
|
|
17758
17491
|
const visit = (dir) => {
|
|
@@ -17778,13 +17511,13 @@ var isComponentTsFile = (file5) => file5.endsWith(".component.ts") || file5.ends
|
|
|
17778
17511
|
return out;
|
|
17779
17512
|
}, getStringPropertyValue = (obj, name) => {
|
|
17780
17513
|
for (const prop of obj.properties) {
|
|
17781
|
-
if (!
|
|
17514
|
+
if (!ts3.isPropertyAssignment(prop))
|
|
17782
17515
|
continue;
|
|
17783
|
-
const propName =
|
|
17516
|
+
const propName = ts3.isIdentifier(prop.name) ? prop.name.text : ts3.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
17784
17517
|
if (propName !== name)
|
|
17785
17518
|
continue;
|
|
17786
17519
|
const init = prop.initializer;
|
|
17787
|
-
if (
|
|
17520
|
+
if (ts3.isStringLiteral(init) || ts3.isNoSubstitutionTemplateLiteral(init)) {
|
|
17788
17521
|
return init.text;
|
|
17789
17522
|
}
|
|
17790
17523
|
}
|
|
@@ -17792,16 +17525,16 @@ var isComponentTsFile = (file5) => file5.endsWith(".component.ts") || file5.ends
|
|
|
17792
17525
|
}, getStringArrayProperty = (obj, name) => {
|
|
17793
17526
|
const out = [];
|
|
17794
17527
|
for (const prop of obj.properties) {
|
|
17795
|
-
if (!
|
|
17528
|
+
if (!ts3.isPropertyAssignment(prop))
|
|
17796
17529
|
continue;
|
|
17797
|
-
const propName =
|
|
17530
|
+
const propName = ts3.isIdentifier(prop.name) ? prop.name.text : ts3.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
17798
17531
|
if (propName !== name)
|
|
17799
17532
|
continue;
|
|
17800
17533
|
const init = prop.initializer;
|
|
17801
|
-
if (!
|
|
17534
|
+
if (!ts3.isArrayLiteralExpression(init))
|
|
17802
17535
|
continue;
|
|
17803
17536
|
for (const element of init.elements) {
|
|
17804
|
-
if (
|
|
17537
|
+
if (ts3.isStringLiteral(element) || ts3.isNoSubstitutionTemplateLiteral(element)) {
|
|
17805
17538
|
out.push(element.text);
|
|
17806
17539
|
}
|
|
17807
17540
|
}
|
|
@@ -17815,24 +17548,24 @@ var isComponentTsFile = (file5) => file5.endsWith(".component.ts") || file5.ends
|
|
|
17815
17548
|
};
|
|
17816
17549
|
let source;
|
|
17817
17550
|
try {
|
|
17818
|
-
source =
|
|
17551
|
+
source = readFileSync19(filePath, "utf8");
|
|
17819
17552
|
} catch {
|
|
17820
17553
|
return refs;
|
|
17821
17554
|
}
|
|
17822
|
-
const sourceFile =
|
|
17555
|
+
const sourceFile = ts3.createSourceFile(filePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
|
|
17823
17556
|
const visit = (node) => {
|
|
17824
|
-
if (
|
|
17825
|
-
const decorators =
|
|
17557
|
+
if (ts3.isClassDeclaration(node) && node.name) {
|
|
17558
|
+
const decorators = ts3.getDecorators(node) ?? [];
|
|
17826
17559
|
for (const decorator of decorators) {
|
|
17827
17560
|
const expr = decorator.expression;
|
|
17828
|
-
if (!
|
|
17561
|
+
if (!ts3.isCallExpression(expr))
|
|
17829
17562
|
continue;
|
|
17830
17563
|
const fn2 = expr.expression;
|
|
17831
|
-
if (!
|
|
17564
|
+
if (!ts3.isIdentifier(fn2) || fn2.text !== "Component")
|
|
17832
17565
|
continue;
|
|
17833
17566
|
refs.classNames.push(node.name.text);
|
|
17834
17567
|
const arg = expr.arguments[0];
|
|
17835
|
-
if (!arg || !
|
|
17568
|
+
if (!arg || !ts3.isObjectLiteralExpression(arg))
|
|
17836
17569
|
continue;
|
|
17837
17570
|
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
17838
17571
|
if (tplUrl)
|
|
@@ -17843,7 +17576,7 @@ var isComponentTsFile = (file5) => file5.endsWith(".component.ts") || file5.ends
|
|
|
17843
17576
|
refs.styleUrls.push(...getStringArrayProperty(arg, "styleUrls"));
|
|
17844
17577
|
}
|
|
17845
17578
|
}
|
|
17846
|
-
|
|
17579
|
+
ts3.forEachChild(node, visit);
|
|
17847
17580
|
};
|
|
17848
17581
|
visit(sourceFile);
|
|
17849
17582
|
return refs;
|
|
@@ -17892,18 +17625,18 @@ var isComponentTsFile = (file5) => file5.endsWith(".component.ts") || file5.ends
|
|
|
17892
17625
|
var init_resolveOwningComponents = () => {};
|
|
17893
17626
|
|
|
17894
17627
|
// src/dev/angular/hmrImportGenerator.ts
|
|
17895
|
-
import
|
|
17628
|
+
import ts4 from "typescript";
|
|
17896
17629
|
var createHmrImportGenerator = (namespaceMap) => ({
|
|
17897
17630
|
addImport(request) {
|
|
17898
17631
|
const ns = namespaceMap.get(request.exportModuleSpecifier);
|
|
17899
17632
|
if (!ns) {
|
|
17900
17633
|
throw new Error(`HMR import generator has no namespace mapping for ${request.exportModuleSpecifier}. ` + `Add it to namespaceDependencies before calling compileHmrUpdateCallback.`);
|
|
17901
17634
|
}
|
|
17902
|
-
const namespaceId =
|
|
17635
|
+
const namespaceId = ts4.factory.createIdentifier(ns);
|
|
17903
17636
|
if (request.exportSymbolName === null) {
|
|
17904
17637
|
return namespaceId;
|
|
17905
17638
|
}
|
|
17906
|
-
return
|
|
17639
|
+
return ts4.factory.createPropertyAccessExpression(namespaceId, ts4.factory.createIdentifier(request.exportSymbolName));
|
|
17907
17640
|
}
|
|
17908
17641
|
});
|
|
17909
17642
|
var init_hmrImportGenerator = () => {};
|
|
@@ -18245,13 +17978,13 @@ var init_translator = __esm(() => {
|
|
|
18245
17978
|
});
|
|
18246
17979
|
|
|
18247
17980
|
// src/dev/angular/vendor/translator/ts_util.ts
|
|
18248
|
-
import
|
|
17981
|
+
import ts5 from "typescript";
|
|
18249
17982
|
function tsNumericExpression(value) {
|
|
18250
17983
|
if (value < 0) {
|
|
18251
|
-
const operand =
|
|
18252
|
-
return
|
|
17984
|
+
const operand = ts5.factory.createNumericLiteral(Math.abs(value));
|
|
17985
|
+
return ts5.factory.createPrefixUnaryExpression(ts5.SyntaxKind.MinusToken, operand);
|
|
18253
17986
|
}
|
|
18254
|
-
return
|
|
17987
|
+
return ts5.factory.createNumericLiteral(value);
|
|
18255
17988
|
}
|
|
18256
17989
|
var init_ts_util = __esm(() => {
|
|
18257
17990
|
/*!
|
|
@@ -18264,147 +17997,147 @@ var init_ts_util = __esm(() => {
|
|
|
18264
17997
|
});
|
|
18265
17998
|
|
|
18266
17999
|
// src/dev/angular/vendor/translator/typescript_ast_factory.ts
|
|
18267
|
-
import
|
|
18000
|
+
import ts6 from "typescript";
|
|
18268
18001
|
|
|
18269
18002
|
class TypeScriptAstFactory {
|
|
18270
18003
|
annotateForClosureCompiler;
|
|
18271
18004
|
externalSourceFiles = new Map;
|
|
18272
18005
|
UNARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
18273
|
-
"+":
|
|
18274
|
-
"-":
|
|
18275
|
-
"!":
|
|
18006
|
+
"+": ts6.SyntaxKind.PlusToken,
|
|
18007
|
+
"-": ts6.SyntaxKind.MinusToken,
|
|
18008
|
+
"!": ts6.SyntaxKind.ExclamationToken
|
|
18276
18009
|
}))();
|
|
18277
18010
|
BINARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
18278
|
-
"&&":
|
|
18279
|
-
">":
|
|
18280
|
-
">=":
|
|
18281
|
-
"&":
|
|
18282
|
-
"|":
|
|
18283
|
-
"/":
|
|
18284
|
-
"==":
|
|
18285
|
-
"===":
|
|
18286
|
-
"<":
|
|
18287
|
-
"<=":
|
|
18288
|
-
"-":
|
|
18289
|
-
"%":
|
|
18290
|
-
"*":
|
|
18291
|
-
"**":
|
|
18292
|
-
"!=":
|
|
18293
|
-
"!==":
|
|
18294
|
-
"||":
|
|
18295
|
-
"+":
|
|
18296
|
-
"??":
|
|
18297
|
-
"=":
|
|
18298
|
-
"+=":
|
|
18299
|
-
"-=":
|
|
18300
|
-
"*=":
|
|
18301
|
-
"/=":
|
|
18302
|
-
"%=":
|
|
18303
|
-
"**=":
|
|
18304
|
-
"&&=":
|
|
18305
|
-
"||=":
|
|
18306
|
-
"??=":
|
|
18307
|
-
in:
|
|
18308
|
-
instanceof:
|
|
18011
|
+
"&&": ts6.SyntaxKind.AmpersandAmpersandToken,
|
|
18012
|
+
">": ts6.SyntaxKind.GreaterThanToken,
|
|
18013
|
+
">=": ts6.SyntaxKind.GreaterThanEqualsToken,
|
|
18014
|
+
"&": ts6.SyntaxKind.AmpersandToken,
|
|
18015
|
+
"|": ts6.SyntaxKind.BarToken,
|
|
18016
|
+
"/": ts6.SyntaxKind.SlashToken,
|
|
18017
|
+
"==": ts6.SyntaxKind.EqualsEqualsToken,
|
|
18018
|
+
"===": ts6.SyntaxKind.EqualsEqualsEqualsToken,
|
|
18019
|
+
"<": ts6.SyntaxKind.LessThanToken,
|
|
18020
|
+
"<=": ts6.SyntaxKind.LessThanEqualsToken,
|
|
18021
|
+
"-": ts6.SyntaxKind.MinusToken,
|
|
18022
|
+
"%": ts6.SyntaxKind.PercentToken,
|
|
18023
|
+
"*": ts6.SyntaxKind.AsteriskToken,
|
|
18024
|
+
"**": ts6.SyntaxKind.AsteriskAsteriskToken,
|
|
18025
|
+
"!=": ts6.SyntaxKind.ExclamationEqualsToken,
|
|
18026
|
+
"!==": ts6.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
18027
|
+
"||": ts6.SyntaxKind.BarBarToken,
|
|
18028
|
+
"+": ts6.SyntaxKind.PlusToken,
|
|
18029
|
+
"??": ts6.SyntaxKind.QuestionQuestionToken,
|
|
18030
|
+
"=": ts6.SyntaxKind.EqualsToken,
|
|
18031
|
+
"+=": ts6.SyntaxKind.PlusEqualsToken,
|
|
18032
|
+
"-=": ts6.SyntaxKind.MinusEqualsToken,
|
|
18033
|
+
"*=": ts6.SyntaxKind.AsteriskEqualsToken,
|
|
18034
|
+
"/=": ts6.SyntaxKind.SlashEqualsToken,
|
|
18035
|
+
"%=": ts6.SyntaxKind.PercentEqualsToken,
|
|
18036
|
+
"**=": ts6.SyntaxKind.AsteriskAsteriskEqualsToken,
|
|
18037
|
+
"&&=": ts6.SyntaxKind.AmpersandAmpersandEqualsToken,
|
|
18038
|
+
"||=": ts6.SyntaxKind.BarBarEqualsToken,
|
|
18039
|
+
"??=": ts6.SyntaxKind.QuestionQuestionEqualsToken,
|
|
18040
|
+
in: ts6.SyntaxKind.InKeyword,
|
|
18041
|
+
instanceof: ts6.SyntaxKind.InstanceOfKeyword
|
|
18309
18042
|
}))();
|
|
18310
18043
|
VAR_TYPES = /* @__PURE__ */ (() => ({
|
|
18311
|
-
const:
|
|
18312
|
-
let:
|
|
18313
|
-
var:
|
|
18044
|
+
const: ts6.NodeFlags.Const,
|
|
18045
|
+
let: ts6.NodeFlags.Let,
|
|
18046
|
+
var: ts6.NodeFlags.None
|
|
18314
18047
|
}))();
|
|
18315
18048
|
constructor(annotateForClosureCompiler) {
|
|
18316
18049
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
18317
18050
|
}
|
|
18318
18051
|
attachComments = attachComments;
|
|
18319
|
-
createArrayLiteral =
|
|
18052
|
+
createArrayLiteral = ts6.factory.createArrayLiteralExpression;
|
|
18320
18053
|
createAssignment(target, operator, value) {
|
|
18321
|
-
return
|
|
18054
|
+
return ts6.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
|
|
18322
18055
|
}
|
|
18323
18056
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
18324
|
-
return
|
|
18057
|
+
return ts6.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
|
|
18325
18058
|
}
|
|
18326
18059
|
createBlock(body) {
|
|
18327
|
-
return
|
|
18060
|
+
return ts6.factory.createBlock(body);
|
|
18328
18061
|
}
|
|
18329
18062
|
createCallExpression(callee, args, pure) {
|
|
18330
|
-
const call =
|
|
18063
|
+
const call = ts6.factory.createCallExpression(callee, undefined, args);
|
|
18331
18064
|
if (pure) {
|
|
18332
|
-
|
|
18065
|
+
ts6.addSyntheticLeadingComment(call, ts6.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler ? "* @pureOrBreakMyCode " /* CLOSURE */ : "@__PURE__" /* TERSER */, false);
|
|
18333
18066
|
}
|
|
18334
18067
|
return call;
|
|
18335
18068
|
}
|
|
18336
18069
|
createConditional(condition, whenTrue, whenFalse) {
|
|
18337
|
-
return
|
|
18070
|
+
return ts6.factory.createConditionalExpression(condition, undefined, whenTrue, undefined, whenFalse);
|
|
18338
18071
|
}
|
|
18339
|
-
createElementAccess =
|
|
18340
|
-
createExpressionStatement =
|
|
18072
|
+
createElementAccess = ts6.factory.createElementAccessExpression;
|
|
18073
|
+
createExpressionStatement = ts6.factory.createExpressionStatement;
|
|
18341
18074
|
createDynamicImport(url) {
|
|
18342
|
-
return
|
|
18075
|
+
return ts6.factory.createCallExpression(ts6.factory.createToken(ts6.SyntaxKind.ImportKeyword), undefined, [typeof url === "string" ? ts6.factory.createStringLiteral(url) : url]);
|
|
18343
18076
|
}
|
|
18344
18077
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
18345
|
-
if (!
|
|
18346
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
18078
|
+
if (!ts6.isBlock(body)) {
|
|
18079
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts6.SyntaxKind[body.kind]}.`);
|
|
18347
18080
|
}
|
|
18348
|
-
return
|
|
18081
|
+
return ts6.factory.createFunctionDeclaration(undefined, undefined, functionName, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
18349
18082
|
}
|
|
18350
18083
|
createFunctionExpression(functionName, parameters, body) {
|
|
18351
|
-
if (!
|
|
18352
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
18084
|
+
if (!ts6.isBlock(body)) {
|
|
18085
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts6.SyntaxKind[body.kind]}.`);
|
|
18353
18086
|
}
|
|
18354
|
-
return
|
|
18087
|
+
return ts6.factory.createFunctionExpression(undefined, undefined, functionName ?? undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
18355
18088
|
}
|
|
18356
18089
|
createArrowFunctionExpression(parameters, body) {
|
|
18357
|
-
if (
|
|
18358
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
18090
|
+
if (ts6.isStatement(body) && !ts6.isBlock(body)) {
|
|
18091
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts6.SyntaxKind[body.kind]}.`);
|
|
18359
18092
|
}
|
|
18360
|
-
return
|
|
18093
|
+
return ts6.factory.createArrowFunction(undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, undefined, body);
|
|
18361
18094
|
}
|
|
18362
18095
|
createParameter(param) {
|
|
18363
|
-
return
|
|
18096
|
+
return ts6.factory.createParameterDeclaration(undefined, undefined, param.name, undefined, param.type ?? undefined);
|
|
18364
18097
|
}
|
|
18365
|
-
createIdentifier =
|
|
18098
|
+
createIdentifier = ts6.factory.createIdentifier;
|
|
18366
18099
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
18367
|
-
return
|
|
18100
|
+
return ts6.factory.createIfStatement(condition, thenStatement, elseStatement ?? undefined);
|
|
18368
18101
|
}
|
|
18369
18102
|
createLiteral(value) {
|
|
18370
18103
|
if (value === undefined) {
|
|
18371
|
-
return
|
|
18104
|
+
return ts6.factory.createIdentifier("undefined");
|
|
18372
18105
|
} else if (value === null) {
|
|
18373
|
-
return
|
|
18106
|
+
return ts6.factory.createNull();
|
|
18374
18107
|
} else if (typeof value === "boolean") {
|
|
18375
|
-
return value ?
|
|
18108
|
+
return value ? ts6.factory.createTrue() : ts6.factory.createFalse();
|
|
18376
18109
|
} else if (typeof value === "number") {
|
|
18377
18110
|
return tsNumericExpression(value);
|
|
18378
18111
|
} else {
|
|
18379
|
-
return
|
|
18112
|
+
return ts6.factory.createStringLiteral(value);
|
|
18380
18113
|
}
|
|
18381
18114
|
}
|
|
18382
18115
|
createNewExpression(expression, args) {
|
|
18383
|
-
return
|
|
18116
|
+
return ts6.factory.createNewExpression(expression, undefined, args);
|
|
18384
18117
|
}
|
|
18385
18118
|
createObjectLiteral(properties) {
|
|
18386
|
-
return
|
|
18119
|
+
return ts6.factory.createObjectLiteralExpression(properties.map((prop) => {
|
|
18387
18120
|
if (prop.kind === "spread") {
|
|
18388
|
-
return
|
|
18121
|
+
return ts6.factory.createSpreadAssignment(prop.expression);
|
|
18389
18122
|
}
|
|
18390
|
-
return
|
|
18123
|
+
return ts6.factory.createPropertyAssignment(prop.quoted ? ts6.factory.createStringLiteral(prop.propertyName) : ts6.factory.createIdentifier(prop.propertyName), prop.value);
|
|
18391
18124
|
}));
|
|
18392
18125
|
}
|
|
18393
|
-
createParenthesizedExpression =
|
|
18394
|
-
createPropertyAccess =
|
|
18395
|
-
createSpreadElement =
|
|
18126
|
+
createParenthesizedExpression = ts6.factory.createParenthesizedExpression;
|
|
18127
|
+
createPropertyAccess = ts6.factory.createPropertyAccessExpression;
|
|
18128
|
+
createSpreadElement = ts6.factory.createSpreadElement;
|
|
18396
18129
|
createReturnStatement(expression) {
|
|
18397
|
-
return
|
|
18130
|
+
return ts6.factory.createReturnStatement(expression ?? undefined);
|
|
18398
18131
|
}
|
|
18399
18132
|
createTaggedTemplate(tag, template) {
|
|
18400
|
-
return
|
|
18133
|
+
return ts6.factory.createTaggedTemplateExpression(tag, undefined, this.createTemplateLiteral(template));
|
|
18401
18134
|
}
|
|
18402
18135
|
createTemplateLiteral(template) {
|
|
18403
18136
|
let templateLiteral;
|
|
18404
18137
|
const length = template.elements.length;
|
|
18405
18138
|
const head = template.elements[0];
|
|
18406
18139
|
if (length === 1) {
|
|
18407
|
-
templateLiteral =
|
|
18140
|
+
templateLiteral = ts6.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
18408
18141
|
} else {
|
|
18409
18142
|
const spans = [];
|
|
18410
18143
|
for (let i = 1;i < length - 1; i++) {
|
|
@@ -18413,7 +18146,7 @@ class TypeScriptAstFactory {
|
|
|
18413
18146
|
if (range !== null) {
|
|
18414
18147
|
this.setSourceMapRange(middle, range);
|
|
18415
18148
|
}
|
|
18416
|
-
spans.push(
|
|
18149
|
+
spans.push(ts6.factory.createTemplateSpan(template.expressions[i - 1], middle));
|
|
18417
18150
|
}
|
|
18418
18151
|
const resolvedExpression = template.expressions[length - 2];
|
|
18419
18152
|
const templatePart = template.elements[length - 1];
|
|
@@ -18421,27 +18154,27 @@ class TypeScriptAstFactory {
|
|
|
18421
18154
|
if (templatePart.range !== null) {
|
|
18422
18155
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
18423
18156
|
}
|
|
18424
|
-
spans.push(
|
|
18425
|
-
templateLiteral =
|
|
18157
|
+
spans.push(ts6.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
18158
|
+
templateLiteral = ts6.factory.createTemplateExpression(ts6.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
18426
18159
|
}
|
|
18427
18160
|
if (head.range !== null) {
|
|
18428
18161
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
18429
18162
|
}
|
|
18430
18163
|
return templateLiteral;
|
|
18431
18164
|
}
|
|
18432
|
-
createThrowStatement =
|
|
18433
|
-
createTypeOfExpression =
|
|
18434
|
-
createVoidExpression =
|
|
18165
|
+
createThrowStatement = ts6.factory.createThrowStatement;
|
|
18166
|
+
createTypeOfExpression = ts6.factory.createTypeOfExpression;
|
|
18167
|
+
createVoidExpression = ts6.factory.createVoidExpression;
|
|
18435
18168
|
createUnaryExpression(operator, operand) {
|
|
18436
|
-
return
|
|
18169
|
+
return ts6.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
18437
18170
|
}
|
|
18438
18171
|
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
18439
|
-
return
|
|
18440
|
-
|
|
18172
|
+
return ts6.factory.createVariableStatement(undefined, ts6.factory.createVariableDeclarationList([
|
|
18173
|
+
ts6.factory.createVariableDeclaration(variableName, undefined, type ?? undefined, initializer ?? undefined)
|
|
18441
18174
|
], this.VAR_TYPES[variableType]));
|
|
18442
18175
|
}
|
|
18443
18176
|
createRegularExpressionLiteral(body, flags) {
|
|
18444
|
-
return
|
|
18177
|
+
return ts6.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
18445
18178
|
}
|
|
18446
18179
|
setSourceMapRange(node, sourceMapRange) {
|
|
18447
18180
|
if (sourceMapRange === null) {
|
|
@@ -18449,10 +18182,10 @@ class TypeScriptAstFactory {
|
|
|
18449
18182
|
}
|
|
18450
18183
|
const url = sourceMapRange.url;
|
|
18451
18184
|
if (!this.externalSourceFiles.has(url)) {
|
|
18452
|
-
this.externalSourceFiles.set(url,
|
|
18185
|
+
this.externalSourceFiles.set(url, ts6.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
18453
18186
|
}
|
|
18454
18187
|
const source = this.externalSourceFiles.get(url);
|
|
18455
|
-
|
|
18188
|
+
ts6.setSourceMapRange(node, {
|
|
18456
18189
|
pos: sourceMapRange.start.offset,
|
|
18457
18190
|
end: sourceMapRange.end.offset,
|
|
18458
18191
|
source
|
|
@@ -18462,77 +18195,77 @@ class TypeScriptAstFactory {
|
|
|
18462
18195
|
createBuiltInType(type) {
|
|
18463
18196
|
switch (type) {
|
|
18464
18197
|
case "any":
|
|
18465
|
-
return
|
|
18198
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.AnyKeyword);
|
|
18466
18199
|
case "boolean":
|
|
18467
|
-
return
|
|
18200
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.BooleanKeyword);
|
|
18468
18201
|
case "number":
|
|
18469
|
-
return
|
|
18202
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.NumberKeyword);
|
|
18470
18203
|
case "string":
|
|
18471
|
-
return
|
|
18204
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.StringKeyword);
|
|
18472
18205
|
case "function":
|
|
18473
|
-
return
|
|
18206
|
+
return ts6.factory.createTypeReferenceNode(ts6.factory.createIdentifier("Function"));
|
|
18474
18207
|
case "never":
|
|
18475
|
-
return
|
|
18208
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.NeverKeyword);
|
|
18476
18209
|
case "unknown":
|
|
18477
|
-
return
|
|
18210
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.UnknownKeyword);
|
|
18478
18211
|
}
|
|
18479
18212
|
}
|
|
18480
18213
|
createExpressionType(expression, typeParams) {
|
|
18481
18214
|
const typeName = getEntityTypeFromExpression(expression);
|
|
18482
|
-
return
|
|
18215
|
+
return ts6.factory.createTypeReferenceNode(typeName, typeParams ?? undefined);
|
|
18483
18216
|
}
|
|
18484
18217
|
createArrayType(elementType) {
|
|
18485
|
-
return
|
|
18218
|
+
return ts6.factory.createArrayTypeNode(elementType);
|
|
18486
18219
|
}
|
|
18487
18220
|
createMapType(valueType) {
|
|
18488
|
-
return
|
|
18489
|
-
|
|
18490
|
-
|
|
18221
|
+
return ts6.factory.createTypeLiteralNode([
|
|
18222
|
+
ts6.factory.createIndexSignature(undefined, [
|
|
18223
|
+
ts6.factory.createParameterDeclaration(undefined, undefined, "key", undefined, ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.StringKeyword))
|
|
18491
18224
|
], valueType)
|
|
18492
18225
|
]);
|
|
18493
18226
|
}
|
|
18494
18227
|
transplantType(type) {
|
|
18495
|
-
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" &&
|
|
18228
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && ts6.isTypeNode(type)) {
|
|
18496
18229
|
return type;
|
|
18497
18230
|
}
|
|
18498
18231
|
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
18499
18232
|
}
|
|
18500
18233
|
}
|
|
18501
18234
|
function createTemplateMiddle(cooked, raw) {
|
|
18502
|
-
const node =
|
|
18503
|
-
node.kind =
|
|
18235
|
+
const node = ts6.factory.createTemplateHead(cooked, raw);
|
|
18236
|
+
node.kind = ts6.SyntaxKind.TemplateMiddle;
|
|
18504
18237
|
return node;
|
|
18505
18238
|
}
|
|
18506
18239
|
function createTemplateTail(cooked, raw) {
|
|
18507
|
-
const node =
|
|
18508
|
-
node.kind =
|
|
18240
|
+
const node = ts6.factory.createTemplateHead(cooked, raw);
|
|
18241
|
+
node.kind = ts6.SyntaxKind.TemplateTail;
|
|
18509
18242
|
return node;
|
|
18510
18243
|
}
|
|
18511
18244
|
function attachComments(statement, leadingComments) {
|
|
18512
18245
|
for (const comment of leadingComments) {
|
|
18513
|
-
const commentKind = comment.multiline ?
|
|
18246
|
+
const commentKind = comment.multiline ? ts6.SyntaxKind.MultiLineCommentTrivia : ts6.SyntaxKind.SingleLineCommentTrivia;
|
|
18514
18247
|
if (comment.multiline) {
|
|
18515
|
-
|
|
18248
|
+
ts6.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
18516
18249
|
} else {
|
|
18517
18250
|
for (const line of comment.toString().split(`
|
|
18518
18251
|
`)) {
|
|
18519
|
-
|
|
18252
|
+
ts6.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
18520
18253
|
}
|
|
18521
18254
|
}
|
|
18522
18255
|
}
|
|
18523
18256
|
}
|
|
18524
18257
|
function getEntityTypeFromExpression(expression) {
|
|
18525
|
-
if (
|
|
18258
|
+
if (ts6.isIdentifier(expression)) {
|
|
18526
18259
|
return expression;
|
|
18527
18260
|
}
|
|
18528
|
-
if (
|
|
18261
|
+
if (ts6.isPropertyAccessExpression(expression)) {
|
|
18529
18262
|
const left = getEntityTypeFromExpression(expression.expression);
|
|
18530
|
-
if (!
|
|
18263
|
+
if (!ts6.isIdentifier(expression.name)) {
|
|
18531
18264
|
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
18532
18265
|
}
|
|
18533
|
-
return
|
|
18266
|
+
return ts6.factory.createQualifiedName(left, expression.name);
|
|
18534
18267
|
}
|
|
18535
|
-
throw new Error(`Unsupported expression for type reference: ${
|
|
18268
|
+
throw new Error(`Unsupported expression for type reference: ${ts6.SyntaxKind[expression.kind]}`);
|
|
18536
18269
|
}
|
|
18537
18270
|
var init_typescript_ast_factory = __esm(() => {
|
|
18538
18271
|
init_ts_util();
|
|
@@ -18548,31 +18281,73 @@ var init_typescript_translator = __esm(() => {
|
|
|
18548
18281
|
});
|
|
18549
18282
|
|
|
18550
18283
|
// src/dev/angular/fastHmrCompiler.ts
|
|
18551
|
-
|
|
18284
|
+
var exports_fastHmrCompiler = {};
|
|
18285
|
+
__export(exports_fastHmrCompiler, {
|
|
18286
|
+
tryFastHmr: () => tryFastHmr,
|
|
18287
|
+
recordFingerprint: () => recordFingerprint,
|
|
18288
|
+
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
18289
|
+
});
|
|
18290
|
+
import { existsSync as existsSync26, readFileSync as readFileSync20 } from "fs";
|
|
18552
18291
|
import { dirname as dirname19, relative as relative13, resolve as resolve33 } from "path";
|
|
18553
|
-
import
|
|
18554
|
-
var fail = (reason, detail) => ({ ok: false, reason, detail }),
|
|
18292
|
+
import ts7 from "typescript";
|
|
18293
|
+
var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache, fingerprintsEqual = (a, b2) => {
|
|
18294
|
+
if (a.className !== b2.className)
|
|
18295
|
+
return false;
|
|
18296
|
+
if (a.selector !== b2.selector)
|
|
18297
|
+
return false;
|
|
18298
|
+
if (a.standalone !== b2.standalone)
|
|
18299
|
+
return false;
|
|
18300
|
+
if (a.importsArity !== b2.importsArity)
|
|
18301
|
+
return false;
|
|
18302
|
+
if (a.hasProviders !== b2.hasProviders)
|
|
18303
|
+
return false;
|
|
18304
|
+
if (a.hasViewProviders !== b2.hasViewProviders)
|
|
18305
|
+
return false;
|
|
18306
|
+
if (a.ctorParamTypes.length !== b2.ctorParamTypes.length)
|
|
18307
|
+
return false;
|
|
18308
|
+
for (let i = 0;i < a.ctorParamTypes.length; i++) {
|
|
18309
|
+
if (a.ctorParamTypes[i] !== b2.ctorParamTypes[i])
|
|
18310
|
+
return false;
|
|
18311
|
+
}
|
|
18312
|
+
if (a.inputs.length !== b2.inputs.length)
|
|
18313
|
+
return false;
|
|
18314
|
+
for (let i = 0;i < a.inputs.length; i++) {
|
|
18315
|
+
if (a.inputs[i] !== b2.inputs[i])
|
|
18316
|
+
return false;
|
|
18317
|
+
}
|
|
18318
|
+
if (a.outputs.length !== b2.outputs.length)
|
|
18319
|
+
return false;
|
|
18320
|
+
for (let i = 0;i < a.outputs.length; i++) {
|
|
18321
|
+
if (a.outputs[i] !== b2.outputs[i])
|
|
18322
|
+
return false;
|
|
18323
|
+
}
|
|
18324
|
+
return true;
|
|
18325
|
+
}, recordFingerprint = (id, fp) => {
|
|
18326
|
+
fingerprintCache.set(id, fp);
|
|
18327
|
+
}, invalidateFingerprintCache = () => {
|
|
18328
|
+
fingerprintCache.clear();
|
|
18329
|
+
}, findClassDeclaration = (sourceFile, className) => {
|
|
18555
18330
|
let found = null;
|
|
18556
18331
|
const walk = (node) => {
|
|
18557
18332
|
if (found)
|
|
18558
18333
|
return;
|
|
18559
|
-
if (
|
|
18334
|
+
if (ts7.isClassDeclaration(node) && node.name?.text === className) {
|
|
18560
18335
|
found = node;
|
|
18561
18336
|
return;
|
|
18562
18337
|
}
|
|
18563
|
-
|
|
18338
|
+
ts7.forEachChild(node, walk);
|
|
18564
18339
|
};
|
|
18565
18340
|
walk(sourceFile);
|
|
18566
18341
|
return found;
|
|
18567
18342
|
}, getClassDecorators = (cls) => {
|
|
18568
|
-
const modifiers =
|
|
18343
|
+
const modifiers = ts7.getDecorators(cls) ?? [];
|
|
18569
18344
|
return [...modifiers];
|
|
18570
18345
|
}, findComponentDecorator = (cls) => {
|
|
18571
18346
|
for (const decorator of getClassDecorators(cls)) {
|
|
18572
18347
|
const expr = decorator.expression;
|
|
18573
|
-
if (
|
|
18348
|
+
if (ts7.isCallExpression(expr)) {
|
|
18574
18349
|
const fn2 = expr.expression;
|
|
18575
|
-
if (
|
|
18350
|
+
if (ts7.isIdentifier(fn2) && fn2.text === "Component") {
|
|
18576
18351
|
return decorator;
|
|
18577
18352
|
}
|
|
18578
18353
|
}
|
|
@@ -18580,15 +18355,15 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18580
18355
|
return null;
|
|
18581
18356
|
}, getDecoratorArgsObject = (decorator) => {
|
|
18582
18357
|
const call = decorator.expression;
|
|
18583
|
-
if (!
|
|
18358
|
+
if (!ts7.isCallExpression(call))
|
|
18584
18359
|
return null;
|
|
18585
18360
|
const arg = call.arguments[0];
|
|
18586
|
-
if (!arg || !
|
|
18361
|
+
if (!arg || !ts7.isObjectLiteralExpression(arg))
|
|
18587
18362
|
return null;
|
|
18588
18363
|
return arg;
|
|
18589
18364
|
}, getProperty = (obj, name) => {
|
|
18590
18365
|
for (const prop of obj.properties) {
|
|
18591
|
-
if (
|
|
18366
|
+
if (ts7.isPropertyAssignment(prop) && (ts7.isIdentifier(prop.name) && prop.name.text === name || ts7.isStringLiteral(prop.name) && prop.name.text === name)) {
|
|
18592
18367
|
return prop.initializer;
|
|
18593
18368
|
}
|
|
18594
18369
|
}
|
|
@@ -18597,7 +18372,7 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18597
18372
|
const expr = getProperty(obj, name);
|
|
18598
18373
|
if (!expr)
|
|
18599
18374
|
return null;
|
|
18600
|
-
if (
|
|
18375
|
+
if (ts7.isStringLiteral(expr) || ts7.isNoSubstitutionTemplateLiteral(expr)) {
|
|
18601
18376
|
return expr.text;
|
|
18602
18377
|
}
|
|
18603
18378
|
return null;
|
|
@@ -18605,15 +18380,15 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18605
18380
|
const expr = getProperty(obj, name);
|
|
18606
18381
|
if (!expr)
|
|
18607
18382
|
return null;
|
|
18608
|
-
if (expr.kind ===
|
|
18383
|
+
if (expr.kind === ts7.SyntaxKind.TrueKeyword)
|
|
18609
18384
|
return true;
|
|
18610
|
-
if (expr.kind ===
|
|
18385
|
+
if (expr.kind === ts7.SyntaxKind.FalseKeyword)
|
|
18611
18386
|
return false;
|
|
18612
18387
|
return null;
|
|
18613
18388
|
}, inheritsDecoratedClass = (cls) => {
|
|
18614
18389
|
const heritage = cls.heritageClauses ?? [];
|
|
18615
18390
|
for (const clause of heritage) {
|
|
18616
|
-
if (clause.token !==
|
|
18391
|
+
if (clause.token !== ts7.SyntaxKind.ExtendsKeyword)
|
|
18617
18392
|
continue;
|
|
18618
18393
|
if (clause.types.length > 0)
|
|
18619
18394
|
return true;
|
|
@@ -18624,52 +18399,54 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18624
18399
|
const stylesExpr = getProperty(args, "styles");
|
|
18625
18400
|
const importsExpr = getProperty(args, "imports");
|
|
18626
18401
|
const styleUrls = [];
|
|
18627
|
-
if (styleUrlsExpr &&
|
|
18402
|
+
if (styleUrlsExpr && ts7.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
18628
18403
|
for (const el of styleUrlsExpr.elements) {
|
|
18629
|
-
if (
|
|
18404
|
+
if (ts7.isStringLiteral(el))
|
|
18630
18405
|
styleUrls.push(el.text);
|
|
18631
18406
|
}
|
|
18632
18407
|
}
|
|
18633
18408
|
const styles = [];
|
|
18634
18409
|
if (stylesExpr) {
|
|
18635
|
-
if (
|
|
18410
|
+
if (ts7.isArrayLiteralExpression(stylesExpr)) {
|
|
18636
18411
|
for (const el of stylesExpr.elements) {
|
|
18637
|
-
if (
|
|
18412
|
+
if (ts7.isStringLiteral(el) || ts7.isNoSubstitutionTemplateLiteral(el)) {
|
|
18638
18413
|
styles.push(el.text);
|
|
18639
18414
|
}
|
|
18640
18415
|
}
|
|
18641
|
-
} else if (
|
|
18416
|
+
} else if (ts7.isStringLiteral(stylesExpr) || ts7.isNoSubstitutionTemplateLiteral(stylesExpr)) {
|
|
18642
18417
|
styles.push(stylesExpr.text);
|
|
18643
18418
|
}
|
|
18644
18419
|
}
|
|
18645
18420
|
return {
|
|
18421
|
+
hasProviders: getProperty(args, "providers") !== null,
|
|
18422
|
+
hasViewProviders: getProperty(args, "viewProviders") !== null,
|
|
18423
|
+
importsExpr: importsExpr && ts7.isArrayLiteralExpression(importsExpr) ? importsExpr : null,
|
|
18424
|
+
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? false,
|
|
18646
18425
|
selector: getStringProperty(args, "selector"),
|
|
18647
|
-
|
|
18648
|
-
template: getStringProperty(args, "template"),
|
|
18426
|
+
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
18649
18427
|
styleUrl: getStringProperty(args, "styleUrl"),
|
|
18650
18428
|
styleUrls,
|
|
18651
18429
|
styles,
|
|
18652
|
-
|
|
18653
|
-
|
|
18654
|
-
importsExpr: importsExpr && ts8.isArrayLiteralExpression(importsExpr) ? importsExpr : null
|
|
18430
|
+
template: getStringProperty(args, "template"),
|
|
18431
|
+
templateUrl: getStringProperty(args, "templateUrl")
|
|
18655
18432
|
};
|
|
18656
18433
|
}, extractDecoratorInput = (prop) => {
|
|
18657
|
-
const decorators =
|
|
18434
|
+
const decorators = ts7.getDecorators(prop) ?? [];
|
|
18658
18435
|
for (const decorator of decorators) {
|
|
18659
18436
|
const expr = decorator.expression;
|
|
18660
|
-
if (!
|
|
18437
|
+
if (!ts7.isCallExpression(expr))
|
|
18661
18438
|
continue;
|
|
18662
18439
|
const fn2 = expr.expression;
|
|
18663
|
-
if (!
|
|
18440
|
+
if (!ts7.isIdentifier(fn2) || fn2.text !== "Input")
|
|
18664
18441
|
continue;
|
|
18665
18442
|
const classPropertyName = prop.name.getText();
|
|
18666
18443
|
let bindingPropertyName = classPropertyName;
|
|
18667
18444
|
let required = false;
|
|
18668
18445
|
const arg = expr.arguments[0];
|
|
18669
18446
|
if (arg) {
|
|
18670
|
-
if (
|
|
18447
|
+
if (ts7.isStringLiteral(arg)) {
|
|
18671
18448
|
bindingPropertyName = arg.text;
|
|
18672
|
-
} else if (
|
|
18449
|
+
} else if (ts7.isObjectLiteralExpression(arg)) {
|
|
18673
18450
|
const aliasNode = getStringProperty(arg, "alias");
|
|
18674
18451
|
if (aliasNode !== null)
|
|
18675
18452
|
bindingPropertyName = aliasNode;
|
|
@@ -18689,11 +18466,11 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18689
18466
|
}
|
|
18690
18467
|
return null;
|
|
18691
18468
|
}, isInputSignalCall = (init) => {
|
|
18692
|
-
if (
|
|
18469
|
+
if (ts7.isCallExpression(init)) {
|
|
18693
18470
|
const fn2 = init.expression;
|
|
18694
|
-
if (
|
|
18471
|
+
if (ts7.isIdentifier(fn2) && fn2.text === "input")
|
|
18695
18472
|
return true;
|
|
18696
|
-
if (
|
|
18473
|
+
if (ts7.isPropertyAccessExpression(fn2) && ts7.isIdentifier(fn2.expression) && fn2.expression.text === "input") {
|
|
18697
18474
|
return true;
|
|
18698
18475
|
}
|
|
18699
18476
|
}
|
|
@@ -18704,12 +18481,12 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18704
18481
|
const classPropertyName = prop.name.getText();
|
|
18705
18482
|
const call = prop.initializer;
|
|
18706
18483
|
let required = false;
|
|
18707
|
-
if (
|
|
18484
|
+
if (ts7.isPropertyAccessExpression(call.expression) && ts7.isIdentifier(call.expression.name) && call.expression.name.text === "required") {
|
|
18708
18485
|
required = true;
|
|
18709
18486
|
}
|
|
18710
18487
|
let bindingPropertyName = classPropertyName;
|
|
18711
18488
|
const optsArg = call.arguments[required ? 0 : 1];
|
|
18712
|
-
if (optsArg &&
|
|
18489
|
+
if (optsArg && ts7.isObjectLiteralExpression(optsArg)) {
|
|
18713
18490
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
18714
18491
|
if (aliasNode !== null)
|
|
18715
18492
|
bindingPropertyName = aliasNode;
|
|
@@ -18725,28 +18502,28 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18725
18502
|
}
|
|
18726
18503
|
};
|
|
18727
18504
|
}, extractDecoratorOutput = (prop) => {
|
|
18728
|
-
const decorators =
|
|
18505
|
+
const decorators = ts7.getDecorators(prop) ?? [];
|
|
18729
18506
|
for (const decorator of decorators) {
|
|
18730
18507
|
const expr = decorator.expression;
|
|
18731
|
-
if (!
|
|
18508
|
+
if (!ts7.isCallExpression(expr))
|
|
18732
18509
|
continue;
|
|
18733
18510
|
const fn2 = expr.expression;
|
|
18734
|
-
if (!
|
|
18511
|
+
if (!ts7.isIdentifier(fn2) || fn2.text !== "Output")
|
|
18735
18512
|
continue;
|
|
18736
18513
|
const classPropertyName = prop.name.getText();
|
|
18737
18514
|
let bindingName = classPropertyName;
|
|
18738
18515
|
const arg = expr.arguments[0];
|
|
18739
|
-
if (arg &&
|
|
18516
|
+
if (arg && ts7.isStringLiteral(arg))
|
|
18740
18517
|
bindingName = arg.text;
|
|
18741
18518
|
return { classPropertyName, bindingName };
|
|
18742
18519
|
}
|
|
18743
18520
|
return null;
|
|
18744
18521
|
}, isOutputSignalCall = (init) => {
|
|
18745
|
-
if (
|
|
18522
|
+
if (ts7.isCallExpression(init)) {
|
|
18746
18523
|
const fn2 = init.expression;
|
|
18747
|
-
if (
|
|
18524
|
+
if (ts7.isIdentifier(fn2) && fn2.text === "output")
|
|
18748
18525
|
return true;
|
|
18749
|
-
if (
|
|
18526
|
+
if (ts7.isPropertyAccessExpression(fn2) && ts7.isIdentifier(fn2.expression) && fn2.expression.text === "output") {
|
|
18750
18527
|
return true;
|
|
18751
18528
|
}
|
|
18752
18529
|
}
|
|
@@ -18758,7 +18535,7 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18758
18535
|
const call = prop.initializer;
|
|
18759
18536
|
let bindingName = classPropertyName;
|
|
18760
18537
|
const optsArg = call.arguments[0];
|
|
18761
|
-
if (optsArg &&
|
|
18538
|
+
if (optsArg && ts7.isObjectLiteralExpression(optsArg)) {
|
|
18762
18539
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
18763
18540
|
if (aliasNode !== null)
|
|
18764
18541
|
bindingName = aliasNode;
|
|
@@ -18768,7 +18545,7 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18768
18545
|
const inputs = {};
|
|
18769
18546
|
const outputs = {};
|
|
18770
18547
|
for (const member of cls.members) {
|
|
18771
|
-
if (!
|
|
18548
|
+
if (!ts7.isPropertyDeclaration(member))
|
|
18772
18549
|
continue;
|
|
18773
18550
|
const decoratorIn = extractDecoratorInput(member);
|
|
18774
18551
|
if (decoratorIn) {
|
|
@@ -18791,11 +18568,78 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18791
18568
|
}
|
|
18792
18569
|
}
|
|
18793
18570
|
return { inputs, outputs };
|
|
18571
|
+
}, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs) => {
|
|
18572
|
+
const ctorParamTypes = [];
|
|
18573
|
+
for (const member of cls.members) {
|
|
18574
|
+
if (!ts7.isConstructorDeclaration(member))
|
|
18575
|
+
continue;
|
|
18576
|
+
for (const param of member.parameters) {
|
|
18577
|
+
ctorParamTypes.push(param.type ? param.type.getText() : "");
|
|
18578
|
+
}
|
|
18579
|
+
break;
|
|
18580
|
+
}
|
|
18581
|
+
const inputNames = Object.keys(inputs).sort();
|
|
18582
|
+
const outputNames = Object.keys(outputs).sort();
|
|
18583
|
+
const importsArity = decoratorMeta.importsExpr ? decoratorMeta.importsExpr.elements.length : 0;
|
|
18584
|
+
const hasProviders = decoratorMeta.hasProviders;
|
|
18585
|
+
const hasViewProviders = decoratorMeta.hasViewProviders;
|
|
18586
|
+
return {
|
|
18587
|
+
className,
|
|
18588
|
+
ctorParamTypes,
|
|
18589
|
+
hasProviders,
|
|
18590
|
+
hasViewProviders,
|
|
18591
|
+
importsArity,
|
|
18592
|
+
inputs: inputNames,
|
|
18593
|
+
outputs: outputNames,
|
|
18594
|
+
selector: decoratorMeta.selector,
|
|
18595
|
+
standalone: decoratorMeta.standalone
|
|
18596
|
+
};
|
|
18597
|
+
}, buildFreshClassMethodsBlock = (classNode, className) => {
|
|
18598
|
+
const methodSources = [];
|
|
18599
|
+
for (const member of classNode.members) {
|
|
18600
|
+
if (ts7.isMethodDeclaration(member) || ts7.isGetAccessorDeclaration(member) || ts7.isSetAccessorDeclaration(member)) {
|
|
18601
|
+
const modifiers = ts7.getModifiers(member) ?? [];
|
|
18602
|
+
const isStatic = modifiers.some((m) => m.kind === ts7.SyntaxKind.StaticKeyword);
|
|
18603
|
+
if (isStatic)
|
|
18604
|
+
continue;
|
|
18605
|
+
methodSources.push(member.getText());
|
|
18606
|
+
}
|
|
18607
|
+
}
|
|
18608
|
+
if (methodSources.length === 0)
|
|
18609
|
+
return null;
|
|
18610
|
+
const wrappedSource = `class _Fresh {
|
|
18611
|
+
${methodSources.join(`
|
|
18612
|
+
`)}
|
|
18613
|
+
}`;
|
|
18614
|
+
let transpiled;
|
|
18615
|
+
try {
|
|
18616
|
+
transpiled = ts7.transpileModule(wrappedSource, {
|
|
18617
|
+
compilerOptions: {
|
|
18618
|
+
module: ts7.ModuleKind.ES2022,
|
|
18619
|
+
target: ts7.ScriptTarget.ES2022
|
|
18620
|
+
},
|
|
18621
|
+
reportDiagnostics: false
|
|
18622
|
+
}).outputText;
|
|
18623
|
+
} catch {
|
|
18624
|
+
return null;
|
|
18625
|
+
}
|
|
18626
|
+
return `// SURGICAL_HMR \u2014 patch prototype methods so existing instances
|
|
18627
|
+
// pick up new method bodies (\`compileComponentFromMetadata\` only
|
|
18628
|
+
// updates \`\u0275cmp\`, never the prototype).
|
|
18629
|
+
${transpiled}
|
|
18630
|
+
{
|
|
18631
|
+
const __fresh_proto = _Fresh.prototype;
|
|
18632
|
+
for (const __name of Object.getOwnPropertyNames(__fresh_proto)) {
|
|
18633
|
+
if (__name === 'constructor') continue;
|
|
18634
|
+
const __desc = Object.getOwnPropertyDescriptor(__fresh_proto, __name);
|
|
18635
|
+
if (__desc) Object.defineProperty(${className}.prototype, __name, __desc);
|
|
18636
|
+
}
|
|
18637
|
+
}`;
|
|
18794
18638
|
}, resolveAndReadResource = (componentDir, url) => {
|
|
18795
18639
|
const abs = resolve33(componentDir, url);
|
|
18796
18640
|
if (!existsSync26(abs))
|
|
18797
18641
|
return null;
|
|
18798
|
-
return
|
|
18642
|
+
return readFileSync20(abs, "utf8");
|
|
18799
18643
|
}, collectStyles = (decoratorMeta, componentDir) => {
|
|
18800
18644
|
const styles = [...decoratorMeta.styles];
|
|
18801
18645
|
const urls = [];
|
|
@@ -18821,8 +18665,8 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18821
18665
|
} catch (err) {
|
|
18822
18666
|
return fail("unexpected-error", `import @angular/compiler: ${err}`);
|
|
18823
18667
|
}
|
|
18824
|
-
const tsSource =
|
|
18825
|
-
const sourceFile =
|
|
18668
|
+
const tsSource = readFileSync20(componentFilePath, "utf8");
|
|
18669
|
+
const sourceFile = ts7.createSourceFile(componentFilePath, tsSource, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
18826
18670
|
const classNode = findClassDeclaration(sourceFile, className);
|
|
18827
18671
|
if (!classNode) {
|
|
18828
18672
|
return fail("class-not-found", `${className} in ${componentFilePath}`);
|
|
@@ -18850,7 +18694,7 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18850
18694
|
if (!existsSync26(tplAbs)) {
|
|
18851
18695
|
return fail("template-resource-not-found", tplAbs);
|
|
18852
18696
|
}
|
|
18853
|
-
templateText =
|
|
18697
|
+
templateText = readFileSync20(tplAbs, "utf8");
|
|
18854
18698
|
templatePath = tplAbs;
|
|
18855
18699
|
} else {
|
|
18856
18700
|
return fail("unsupported-decorator-args", "missing template/templateUrl");
|
|
@@ -18877,6 +18721,12 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18877
18721
|
const wrappedClass = new compiler.WrappedNodeExpr(className_);
|
|
18878
18722
|
const { inputs, outputs } = extractInputsAndOutputs(classNode);
|
|
18879
18723
|
const projectRelPath = relative13(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
18724
|
+
const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
18725
|
+
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs);
|
|
18726
|
+
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
18727
|
+
if (cachedFingerprint && !fingerprintsEqual(cachedFingerprint, currentFingerprint)) {
|
|
18728
|
+
return fail("structural-change", `fingerprint changed for ${className}; escalate to Tier 1`);
|
|
18729
|
+
}
|
|
18880
18730
|
const sourceFileObj = new compiler.ParseSourceFile(tsSource, componentFilePath);
|
|
18881
18731
|
const zeroLoc = new compiler.ParseLocation(sourceFileObj, 0, 0, 0);
|
|
18882
18732
|
const typeSourceSpan = new compiler.ParseSourceSpan(zeroLoc, zeroLoc);
|
|
@@ -18965,23 +18815,36 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18965
18815
|
}
|
|
18966
18816
|
const importGenerator = createHmrImportGenerator(namespaceMap);
|
|
18967
18817
|
const tsFunctionDecl = translateStatement(sourceFile, callback, importGenerator);
|
|
18968
|
-
const exportedDecl =
|
|
18969
|
-
|
|
18970
|
-
|
|
18818
|
+
const exportedDecl = ts7.factory.updateFunctionDeclaration(tsFunctionDecl, [
|
|
18819
|
+
ts7.factory.createToken(ts7.SyntaxKind.ExportKeyword),
|
|
18820
|
+
ts7.factory.createToken(ts7.SyntaxKind.DefaultKeyword)
|
|
18971
18821
|
], tsFunctionDecl.asteriskToken, tsFunctionDecl.name, tsFunctionDecl.typeParameters, tsFunctionDecl.parameters, tsFunctionDecl.type, tsFunctionDecl.body);
|
|
18972
|
-
const printer =
|
|
18973
|
-
newLine:
|
|
18822
|
+
const printer = ts7.createPrinter({
|
|
18823
|
+
newLine: ts7.NewLineKind.LineFeed,
|
|
18974
18824
|
removeComments: false
|
|
18975
18825
|
});
|
|
18976
|
-
const tsSourceText = printer.printNode(
|
|
18977
|
-
const
|
|
18826
|
+
const tsSourceText = printer.printNode(ts7.EmitHint.Unspecified, exportedDecl, sourceFile);
|
|
18827
|
+
const transpiled = ts7.transpileModule(tsSourceText, {
|
|
18978
18828
|
compilerOptions: {
|
|
18979
|
-
module:
|
|
18980
|
-
target:
|
|
18829
|
+
module: ts7.ModuleKind.ES2022,
|
|
18830
|
+
target: ts7.ScriptTarget.ES2022
|
|
18981
18831
|
},
|
|
18982
18832
|
fileName: componentFilePath,
|
|
18983
18833
|
reportDiagnostics: false
|
|
18984
18834
|
}).outputText;
|
|
18835
|
+
const methodsBlock = buildFreshClassMethodsBlock(classNode, className);
|
|
18836
|
+
let moduleText = transpiled;
|
|
18837
|
+
if (methodsBlock) {
|
|
18838
|
+
const fnOpening = `function ${className}_UpdateMetadata(${className}, \u0275\u0275namespaces) {`;
|
|
18839
|
+
const idx = moduleText.indexOf(fnOpening);
|
|
18840
|
+
if (idx >= 0) {
|
|
18841
|
+
const insertAt = idx + fnOpening.length;
|
|
18842
|
+
moduleText = moduleText.slice(0, insertAt) + `
|
|
18843
|
+
` + methodsBlock + `
|
|
18844
|
+
` + moduleText.slice(insertAt);
|
|
18845
|
+
}
|
|
18846
|
+
}
|
|
18847
|
+
fingerprintCache.set(fingerprintId, currentFingerprint);
|
|
18985
18848
|
return { ok: true, moduleText, componentSource: sourceFile };
|
|
18986
18849
|
} catch (err) {
|
|
18987
18850
|
return fail("unexpected-error", String(err));
|
|
@@ -18990,6 +18853,7 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18990
18853
|
var init_fastHmrCompiler = __esm(() => {
|
|
18991
18854
|
init_hmrImportGenerator();
|
|
18992
18855
|
init_typescript_translator();
|
|
18856
|
+
fingerprintCache = new Map;
|
|
18993
18857
|
});
|
|
18994
18858
|
|
|
18995
18859
|
// src/dev/angular/hmrCompiler.ts
|
|
@@ -19002,9 +18866,9 @@ __export(exports_hmrCompiler, {
|
|
|
19002
18866
|
compileAngularForHmr: () => compileAngularForHmr
|
|
19003
18867
|
});
|
|
19004
18868
|
import { existsSync as existsSync27 } from "fs";
|
|
19005
|
-
import { basename as
|
|
18869
|
+
import { basename as basename12, dirname as dirname20, join as join30, relative as relative14, resolve as resolve34 } from "path";
|
|
19006
18870
|
import { performance as performance2 } from "perf_hooks";
|
|
19007
|
-
import
|
|
18871
|
+
import ts8 from "typescript";
|
|
19008
18872
|
var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_PROGRAM__ ?? null, setCachedHmrProgram = (program) => {
|
|
19009
18873
|
globalCache.__ABSOLUTE_ANGULAR_HMR_PROGRAM__ = program;
|
|
19010
18874
|
}, resolveTypescriptLibDirCached = null, resolveTypescriptLibDir = () => {
|
|
@@ -19019,14 +18883,14 @@ var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_
|
|
|
19019
18883
|
emitDecoratorMetadata: true,
|
|
19020
18884
|
esModuleInterop: true,
|
|
19021
18885
|
experimentalDecorators: true,
|
|
19022
|
-
module:
|
|
19023
|
-
moduleResolution:
|
|
19024
|
-
newLine:
|
|
18886
|
+
module: ts8.ModuleKind.ESNext,
|
|
18887
|
+
moduleResolution: ts8.ModuleResolutionKind.Bundler,
|
|
18888
|
+
newLine: ts8.NewLineKind.LineFeed,
|
|
19025
18889
|
noEmit: false,
|
|
19026
18890
|
noLib: false,
|
|
19027
18891
|
rootDir: process.cwd(),
|
|
19028
18892
|
skipLibCheck: true,
|
|
19029
|
-
target:
|
|
18893
|
+
target: ts8.ScriptTarget.ES2022,
|
|
19030
18894
|
_enableHmr: true,
|
|
19031
18895
|
enableHmr: true
|
|
19032
18896
|
}), ANGULAR_COMPILER_OPTIONS_CACHE, loadAngularCompilerOptions = async () => {
|
|
@@ -19053,20 +18917,20 @@ var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_
|
|
|
19053
18917
|
const baseOptions = await loadAngularCompilerOptions();
|
|
19054
18918
|
const options = buildHmrCompilerOptions(baseOptions);
|
|
19055
18919
|
options.outDir = outDir;
|
|
19056
|
-
options.target =
|
|
18920
|
+
options.target = ts8.ScriptTarget.ES2022;
|
|
19057
18921
|
options.experimentalDecorators = true;
|
|
19058
18922
|
options.emitDecoratorMetadata = true;
|
|
19059
|
-
options.newLine =
|
|
18923
|
+
options.newLine = ts8.NewLineKind.LineFeed;
|
|
19060
18924
|
options.incremental = false;
|
|
19061
18925
|
options.tsBuildInfoFile = undefined;
|
|
19062
18926
|
const tsLibDir = resolveTypescriptLibDir();
|
|
19063
|
-
const host =
|
|
18927
|
+
const host = ts8.createCompilerHost(options);
|
|
19064
18928
|
const originalGetDefaultLibLocation = host.getDefaultLibLocation;
|
|
19065
18929
|
host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
|
|
19066
18930
|
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
19067
18931
|
host.getDefaultLibFileName = (opts) => {
|
|
19068
18932
|
const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
|
|
19069
|
-
return
|
|
18933
|
+
return basename12(fileName);
|
|
19070
18934
|
};
|
|
19071
18935
|
const originalGetSourceFile = host.getSourceFile;
|
|
19072
18936
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
@@ -19137,11 +19001,11 @@ var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_
|
|
|
19137
19001
|
const walk = (node) => {
|
|
19138
19002
|
if (found)
|
|
19139
19003
|
return;
|
|
19140
|
-
if (
|
|
19004
|
+
if (ts8.isClassDeclaration(node) && node.name?.text === className) {
|
|
19141
19005
|
found = node;
|
|
19142
19006
|
return;
|
|
19143
19007
|
}
|
|
19144
|
-
|
|
19008
|
+
ts8.forEachChild(node, walk);
|
|
19145
19009
|
};
|
|
19146
19010
|
walk(sourceFile);
|
|
19147
19011
|
return found;
|
|
@@ -19368,7 +19232,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
19368
19232
|
|
|
19369
19233
|
// src/dev/rebuildTrigger.ts
|
|
19370
19234
|
import { existsSync as existsSync28 } from "fs";
|
|
19371
|
-
import { basename as
|
|
19235
|
+
import { basename as basename13, dirname as dirname21, relative as relative15, resolve as resolve37 } from "path";
|
|
19372
19236
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequentially = (items, action) => items.reduce((chain, item) => chain.then(() => action(item)), Promise.resolve()), getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), recompileTailwindForFastPath = async (state, config, files) => {
|
|
19373
19237
|
if (!config.tailwind)
|
|
19374
19238
|
return;
|
|
@@ -19701,7 +19565,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19701
19565
|
const { commonAncestor: commonAncestor2 } = await Promise.resolve().then(() => (init_commonAncestor(), exports_commonAncestor));
|
|
19702
19566
|
return clientRoots.length === 1 ? clientRoots[0] ?? projectRoot : commonAncestor2(clientRoots, projectRoot);
|
|
19703
19567
|
}, updateServerManifestEntry = (state, artifact) => {
|
|
19704
|
-
const fileWithHash =
|
|
19568
|
+
const fileWithHash = basename13(artifact.path);
|
|
19705
19569
|
const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
|
|
19706
19570
|
if (!baseName) {
|
|
19707
19571
|
return;
|
|
@@ -19762,59 +19626,63 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19762
19626
|
const clientManifest = generateManifest2(clientResult.outputs, buildDir);
|
|
19763
19627
|
Object.assign(state.manifest, clientManifest);
|
|
19764
19628
|
await populateAssetStore(state.assetStore, clientManifest, buildDir);
|
|
19765
|
-
},
|
|
19766
|
-
if (!userEditedFiles || userEditedFiles.size === 0)
|
|
19767
|
-
return candidates;
|
|
19768
|
-
const filtered = candidates.filter((file5) => userEditedFiles.has(resolve37(file5)));
|
|
19769
|
-
return filtered.length > 0 ? filtered : candidates;
|
|
19770
|
-
}, broadcastAngularComponentUpdates = async (state, angularDir) => {
|
|
19629
|
+
}, decideAngularTier = async (state, angularDir) => {
|
|
19771
19630
|
const userEdited = state.lastUserEditedFiles ?? new Set;
|
|
19772
19631
|
if (userEdited.size === 0)
|
|
19773
|
-
return;
|
|
19632
|
+
return { queue: [], tier: 0 };
|
|
19774
19633
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
19775
19634
|
const { encodeHmrComponentId: encodeHmrComponentId2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
|
|
19776
|
-
const
|
|
19777
|
-
const
|
|
19635
|
+
const { tryFastHmr: tryFastHmr2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
19636
|
+
const queue = [];
|
|
19637
|
+
const queueIds = new Set;
|
|
19778
19638
|
for (const editedFile of userEdited) {
|
|
19779
19639
|
const owners = resolveOwningComponents2({
|
|
19780
19640
|
changedFilePath: editedFile,
|
|
19781
19641
|
userAngularRoot: angularDir
|
|
19782
19642
|
});
|
|
19643
|
+
if (owners.length === 0 && editedFile.endsWith(".component.ts")) {
|
|
19644
|
+
return {
|
|
19645
|
+
reason: `no @Component class found in ${editedFile}`,
|
|
19646
|
+
tier: 1
|
|
19647
|
+
};
|
|
19648
|
+
}
|
|
19783
19649
|
for (const { componentFilePath, className } of owners) {
|
|
19784
19650
|
const id = encodeHmrComponentId2(componentFilePath, className);
|
|
19785
|
-
if (
|
|
19651
|
+
if (queueIds.has(id))
|
|
19786
19652
|
continue;
|
|
19787
|
-
|
|
19788
|
-
|
|
19789
|
-
|
|
19790
|
-
|
|
19791
|
-
|
|
19792
|
-
|
|
19653
|
+
const result = await tryFastHmr2({ className, componentFilePath });
|
|
19654
|
+
if (!result.ok) {
|
|
19655
|
+
return {
|
|
19656
|
+
reason: `${className}: ${result.reason}${result.detail ? ` (${result.detail})` : ""}`,
|
|
19657
|
+
tier: 1
|
|
19658
|
+
};
|
|
19659
|
+
}
|
|
19660
|
+
queueIds.add(id);
|
|
19661
|
+
queue.push({ className, id });
|
|
19793
19662
|
}
|
|
19794
19663
|
}
|
|
19795
|
-
|
|
19796
|
-
|
|
19797
|
-
|
|
19798
|
-
|
|
19799
|
-
const pascalName = toPascal(baseName);
|
|
19800
|
-
const cssKey = `${pascalName}CSS`;
|
|
19801
|
-
const cssUrl = manifest[cssKey] || null;
|
|
19802
|
-
const duration = Date.now() - startTime;
|
|
19803
|
-
logHmrUpdate(angularPagePath, "angular", duration);
|
|
19664
|
+
return { queue, tier: 0 };
|
|
19665
|
+
}, broadcastSurgical = (state, queue) => {
|
|
19666
|
+
const timestamp = Date.now();
|
|
19667
|
+
for (const { id, className } of queue) {
|
|
19804
19668
|
broadcastToClients(state, {
|
|
19805
|
-
data: {
|
|
19806
|
-
|
|
19807
|
-
cssUrl,
|
|
19808
|
-
editSourceFile: classification.sourceFile,
|
|
19809
|
-
framework: "angular",
|
|
19810
|
-
manifest,
|
|
19811
|
-
reason: classification.reason,
|
|
19812
|
-
sourceFile: angularPagePath,
|
|
19813
|
-
updateType: classification.type
|
|
19814
|
-
},
|
|
19815
|
-
type: "angular-update"
|
|
19669
|
+
data: { id, timestamp },
|
|
19670
|
+
type: "angular:component-update"
|
|
19816
19671
|
});
|
|
19672
|
+
logInfo(`[ng-hmr broadcast] ${className}`);
|
|
19673
|
+
}
|
|
19674
|
+
}, broadcastRebootstrap = async (state, reason) => {
|
|
19675
|
+
logInfo(`[ng-hmr tier-1 rebootstrap] ${reason}`);
|
|
19676
|
+
broadcastToClients(state, {
|
|
19677
|
+
data: {
|
|
19678
|
+
manifest: state.manifest,
|
|
19679
|
+
reason,
|
|
19680
|
+
timestamp: Date.now()
|
|
19681
|
+
},
|
|
19682
|
+
type: "angular:rebootstrap"
|
|
19817
19683
|
});
|
|
19684
|
+
const { invalidateFingerprintCache: invalidateFingerprintCache2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
19685
|
+
invalidateFingerprintCache2();
|
|
19818
19686
|
}, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
|
|
19819
19687
|
const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
|
|
19820
19688
|
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, getStyleTransformConfig(state.config));
|
|
@@ -19839,7 +19707,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19839
19707
|
await rewriteImports3(ssrPaths, angServerVendorPaths);
|
|
19840
19708
|
}
|
|
19841
19709
|
serverPaths.forEach((serverPath, idx) => {
|
|
19842
|
-
const fileBase =
|
|
19710
|
+
const fileBase = basename13(serverPath, ".js");
|
|
19843
19711
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
19844
19712
|
state.manifest[toPascal(fileBase)] = resolve37(ssrPath);
|
|
19845
19713
|
});
|
|
@@ -19854,18 +19722,23 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19854
19722
|
}
|
|
19855
19723
|
const angularPagesPath = resolve37(angularDir, "pages");
|
|
19856
19724
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
19857
|
-
|
|
19725
|
+
const verdict = await decideAngularTier(state, angularDir);
|
|
19726
|
+
const runBundle = async () => {
|
|
19727
|
+
if (pageEntries.length === 0)
|
|
19728
|
+
return;
|
|
19858
19729
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
19859
19730
|
markSsrCacheDirty("angular");
|
|
19731
|
+
};
|
|
19732
|
+
if (verdict.tier === 0) {
|
|
19733
|
+
broadcastSurgical(state, verdict.queue);
|
|
19734
|
+
runBundle().catch((err) => {
|
|
19735
|
+
logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
19736
|
+
});
|
|
19737
|
+
} else {
|
|
19738
|
+
await runBundle();
|
|
19739
|
+
await broadcastRebootstrap(state, verdict.reason);
|
|
19860
19740
|
}
|
|
19861
19741
|
const { manifest } = state;
|
|
19862
|
-
const angularHmrFiles = angularFiles.filter((file5) => file5.endsWith(".ts") || file5.endsWith(".html"));
|
|
19863
|
-
const angularPageFiles = angularHmrFiles.filter((file5) => file5.replace(/\\/g, "/").includes("/pages/"));
|
|
19864
|
-
const pagesToUpdate = angularPageFiles.length > 0 ? angularPageFiles : pageEntries;
|
|
19865
|
-
const filesToClassify = filterToUserEdits(angularFiles, state.lastUserEditedFiles);
|
|
19866
|
-
const classification = collapseClassifications(filesToClassify.map(classifyAngularEdit));
|
|
19867
|
-
broadcastAngularPageUpdates(state, pagesToUpdate, manifest, startTime, classification);
|
|
19868
|
-
await broadcastAngularComponentUpdates(state, angularDir);
|
|
19869
19742
|
onRebuildComplete({ hmrState: state, manifest });
|
|
19870
19743
|
return manifest;
|
|
19871
19744
|
}, getModuleUrl = async (pageFile) => {
|
|
@@ -19992,7 +19865,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19992
19865
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
19993
19866
|
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
19994
19867
|
const serverRoot = resolve37(getFrameworkGeneratedDir2("svelte"), "server");
|
|
19995
|
-
const serverOutDir = resolve37(buildDir,
|
|
19868
|
+
const serverOutDir = resolve37(buildDir, basename13(svelteDir));
|
|
19996
19869
|
const [serverResult, clientResult] = await Promise.all([
|
|
19997
19870
|
serverEntries.length > 0 ? bunBuild9({
|
|
19998
19871
|
entrypoints: serverEntries,
|
|
@@ -20034,7 +19907,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20034
19907
|
const duration = Date.now() - startTime;
|
|
20035
19908
|
const broadcastFiles = svelteFiles.length > 0 ? svelteFiles : filesToRebuild;
|
|
20036
19909
|
broadcastFiles.forEach((sveltePagePath) => {
|
|
20037
|
-
const fileName =
|
|
19910
|
+
const fileName = basename13(sveltePagePath);
|
|
20038
19911
|
const baseName = fileName.replace(/\.svelte$/, "");
|
|
20039
19912
|
const pascalName = toPascal(baseName);
|
|
20040
19913
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -20141,7 +20014,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20141
20014
|
const { compileEmber: compileEmber2 } = await Promise.resolve().then(() => (init_compileEmber(), exports_compileEmber));
|
|
20142
20015
|
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
20143
20016
|
for (const serverPath of serverPaths) {
|
|
20144
|
-
const fileBase =
|
|
20017
|
+
const fileBase = basename13(serverPath, ".js");
|
|
20145
20018
|
state.manifest[toPascal(fileBase)] = resolve37(serverPath);
|
|
20146
20019
|
}
|
|
20147
20020
|
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
@@ -20212,7 +20085,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20212
20085
|
});
|
|
20213
20086
|
}
|
|
20214
20087
|
}, handleScriptUpdate = (state, scriptFile, manifest, framework, duration) => {
|
|
20215
|
-
const scriptBaseName =
|
|
20088
|
+
const scriptBaseName = basename13(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
|
|
20216
20089
|
const pascalName = toPascal(scriptBaseName);
|
|
20217
20090
|
const scriptPath = manifest[pascalName] || null;
|
|
20218
20091
|
if (!scriptPath) {
|
|
@@ -20291,7 +20164,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20291
20164
|
if (isSingle) {
|
|
20292
20165
|
return resolve37(state.resolvedPaths.buildDir, "pages");
|
|
20293
20166
|
}
|
|
20294
|
-
const dirName = framework === "html" ?
|
|
20167
|
+
const dirName = framework === "html" ? basename13(config.htmlDirectory ?? "html") : basename13(config.htmxDirectory ?? "htmx");
|
|
20295
20168
|
return resolve37(state.resolvedPaths.buildDir, dirName, "pages");
|
|
20296
20169
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
20297
20170
|
try {
|
|
@@ -20330,7 +20203,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20330
20203
|
const shouldRefreshAllPages = htmlPageFiles.length === 0 && shouldRefreshFromIslandChange;
|
|
20331
20204
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
20332
20205
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
20333
|
-
const htmlPageName =
|
|
20206
|
+
const htmlPageName = basename13(pageFile);
|
|
20334
20207
|
const builtHtmlPagePath = resolve37(outputHtmlPages, htmlPageName);
|
|
20335
20208
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
20336
20209
|
});
|
|
@@ -20339,7 +20212,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20339
20212
|
if (!cssFile) {
|
|
20340
20213
|
return;
|
|
20341
20214
|
}
|
|
20342
|
-
const cssBaseName =
|
|
20215
|
+
const cssBaseName = basename13(getStyleBaseName(cssFile));
|
|
20343
20216
|
const cssPascalName = toPascal(cssBaseName);
|
|
20344
20217
|
const cssKey = `${cssPascalName}CSS`;
|
|
20345
20218
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -20388,7 +20261,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20388
20261
|
type: "vue-update"
|
|
20389
20262
|
});
|
|
20390
20263
|
}, broadcastVuePageChange = async (state, config, vuePagePath, manifest, duration) => {
|
|
20391
|
-
const fileName =
|
|
20264
|
+
const fileName = basename13(vuePagePath);
|
|
20392
20265
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
20393
20266
|
const pascalName = toPascal(baseName);
|
|
20394
20267
|
const vueRoot = config.vueDirectory;
|
|
@@ -20434,7 +20307,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20434
20307
|
if (!cssFile) {
|
|
20435
20308
|
return;
|
|
20436
20309
|
}
|
|
20437
|
-
const cssBaseName =
|
|
20310
|
+
const cssBaseName = basename13(getStyleBaseName(cssFile));
|
|
20438
20311
|
const cssPascalName = toPascal(cssBaseName);
|
|
20439
20312
|
const cssKey = `${cssPascalName}CSS`;
|
|
20440
20313
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -20452,7 +20325,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20452
20325
|
});
|
|
20453
20326
|
}, broadcastSveltePageUpdate = (state, sveltePagePath, manifest, duration) => {
|
|
20454
20327
|
try {
|
|
20455
|
-
const fileName =
|
|
20328
|
+
const fileName = basename13(sveltePagePath);
|
|
20456
20329
|
const baseName = fileName.replace(/\.svelte$/, "");
|
|
20457
20330
|
const pascalName = toPascal(baseName);
|
|
20458
20331
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -20495,26 +20368,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20495
20368
|
pagesToUpdate.forEach((sveltePagePath) => {
|
|
20496
20369
|
broadcastSveltePageUpdate(state, sveltePagePath, manifest, duration);
|
|
20497
20370
|
});
|
|
20498
|
-
}, collectAngularAffectedPages = (affected, resolvedPages) => {
|
|
20499
|
-
affected.forEach((file5) => {
|
|
20500
|
-
if (file5.replace(/\\/g, "/").includes("/pages/") && file5.endsWith(".ts")) {
|
|
20501
|
-
resolvedPages.add(file5);
|
|
20502
|
-
}
|
|
20503
|
-
});
|
|
20504
|
-
}, resolveAngularPagesFromDependencyGraph = (state, angularFiles) => {
|
|
20505
|
-
const resolvedPages = new Set;
|
|
20506
|
-
angularFiles.forEach((componentFile) => {
|
|
20507
|
-
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
20508
|
-
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
20509
|
-
collectAngularAffectedPages(affected, resolvedPages);
|
|
20510
|
-
});
|
|
20511
|
-
return Array.from(resolvedPages);
|
|
20512
20371
|
}, handleAngularCssOnlyUpdate = (state, angularCssFiles, manifest, duration) => {
|
|
20513
20372
|
const [cssFile] = angularCssFiles;
|
|
20514
20373
|
if (!cssFile) {
|
|
20515
20374
|
return;
|
|
20516
20375
|
}
|
|
20517
|
-
const cssBaseName =
|
|
20376
|
+
const cssBaseName = basename13(getStyleBaseName(cssFile));
|
|
20518
20377
|
const cssPascalName = toPascal(cssBaseName);
|
|
20519
20378
|
const cssKey = `${cssPascalName}CSS`;
|
|
20520
20379
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -20530,58 +20389,17 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20530
20389
|
},
|
|
20531
20390
|
type: "angular-update"
|
|
20532
20391
|
});
|
|
20533
|
-
}, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration, classification) => {
|
|
20534
|
-
try {
|
|
20535
|
-
const fileName = basename14(angularPagePath);
|
|
20536
|
-
const baseName = fileName.replace(/\.[tj]s$/, "");
|
|
20537
|
-
const pascalName = toPascal(baseName);
|
|
20538
|
-
const cssKey = `${pascalName}CSS`;
|
|
20539
|
-
const cssUrl = manifest[cssKey] || null;
|
|
20540
|
-
logHmrUpdate(angularPagePath, "angular", duration);
|
|
20541
|
-
broadcastToClients(state, {
|
|
20542
|
-
data: {
|
|
20543
|
-
cssBaseName: baseName,
|
|
20544
|
-
cssUrl,
|
|
20545
|
-
editSourceFile: classification.sourceFile,
|
|
20546
|
-
framework: "angular",
|
|
20547
|
-
manifest,
|
|
20548
|
-
reason: classification.reason,
|
|
20549
|
-
sourceFile: angularPagePath,
|
|
20550
|
-
updateType: classification.type
|
|
20551
|
-
},
|
|
20552
|
-
type: "angular-update"
|
|
20553
|
-
});
|
|
20554
|
-
} catch (err) {
|
|
20555
|
-
sendTelemetryEvent("hmr:error", {
|
|
20556
|
-
framework: "angular",
|
|
20557
|
-
message: err instanceof Error ? err.message : String(err)
|
|
20558
|
-
});
|
|
20559
|
-
}
|
|
20560
20392
|
}, handleAngularHMR = (state, config, filesToRebuild, manifest, duration) => {
|
|
20561
|
-
if (!config.angularDirectory)
|
|
20393
|
+
if (!config.angularDirectory)
|
|
20562
20394
|
return;
|
|
20563
|
-
}
|
|
20564
20395
|
const angularFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "angular");
|
|
20565
|
-
if (angularFiles.length === 0)
|
|
20396
|
+
if (angularFiles.length === 0)
|
|
20566
20397
|
return;
|
|
20567
|
-
}
|
|
20568
|
-
broadcastAngularComponentUpdates(state, config.angularDirectory);
|
|
20569
20398
|
const angularCssFiles = angularFiles.filter(isStylePath);
|
|
20570
20399
|
const isCssOnlyChange = angularFiles.every(isStylePath) && angularCssFiles.length > 0;
|
|
20571
|
-
|
|
20572
|
-
let pagesToUpdate = angularPageFiles;
|
|
20573
|
-
if (pagesToUpdate.length === 0 && state.dependencyGraph) {
|
|
20574
|
-
pagesToUpdate = resolveAngularPagesFromDependencyGraph(state, angularFiles);
|
|
20575
|
-
}
|
|
20576
|
-
if (isCssOnlyChange && angularCssFiles.length > 0) {
|
|
20400
|
+
if (isCssOnlyChange) {
|
|
20577
20401
|
handleAngularCssOnlyUpdate(state, angularCssFiles, manifest, duration);
|
|
20578
|
-
return;
|
|
20579
20402
|
}
|
|
20580
|
-
const filesToClassifySlow = filterToUserEdits(angularFiles, state.lastUserEditedFiles);
|
|
20581
|
-
const classification = collapseClassifications(filesToClassifySlow.map(classifyAngularEdit));
|
|
20582
|
-
pagesToUpdate.forEach((angularPagePath) => {
|
|
20583
|
-
broadcastAngularPageHmrUpdate(state, angularPagePath, manifest, duration, classification);
|
|
20584
|
-
});
|
|
20585
20403
|
}, handleHTMXScriptHMR = (state, filesToRebuild, manifest, duration) => {
|
|
20586
20404
|
if (!state.resolvedPaths.htmxDir) {
|
|
20587
20405
|
return;
|
|
@@ -20635,7 +20453,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20635
20453
|
const shouldRefreshAllPages = htmxPageFiles.length === 0 && shouldRefreshFromIslandChange;
|
|
20636
20454
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
20637
20455
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
20638
|
-
const htmxPageName =
|
|
20456
|
+
const htmxPageName = basename13(htmxPageFile);
|
|
20639
20457
|
const builtHtmxPagePath = resolve37(outputHtmxPages, htmxPageName);
|
|
20640
20458
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
20641
20459
|
});
|
|
@@ -20745,7 +20563,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20745
20563
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
20746
20564
|
writeFs(destPath, html);
|
|
20747
20565
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
20748
|
-
const destPath = resolve37(outputDir,
|
|
20566
|
+
const destPath = resolve37(outputDir, basename13(sourceFile));
|
|
20749
20567
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
20750
20568
|
const source = await Bun.file(sourceFile).text();
|
|
20751
20569
|
await Bun.write(destPath, source);
|
|
@@ -20991,7 +20809,6 @@ var init_rebuildTrigger = __esm(() => {
|
|
|
20991
20809
|
init_compileTailwind();
|
|
20992
20810
|
init_tailwindCompiler();
|
|
20993
20811
|
init_ssrCache();
|
|
20994
|
-
init_editTypeDetection();
|
|
20995
20812
|
moduleServerPromise = Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
20996
20813
|
getReactModuleUrl = getModuleUrl;
|
|
20997
20814
|
EMBER_PAGE_EXTENSIONS = [".gts", ".gjs", ".ts", ".js"];
|
|
@@ -21059,7 +20876,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
21059
20876
|
framework: Array.from(framework).filter(isResolvable4)
|
|
21060
20877
|
};
|
|
21061
20878
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
21062
|
-
const { readFileSync:
|
|
20879
|
+
const { readFileSync: readFileSync21 } = await import("fs");
|
|
21063
20880
|
const transpiler5 = new Bun.Transpiler({ loader: "js" });
|
|
21064
20881
|
const newSpecs = new Set;
|
|
21065
20882
|
for (const spec of specs) {
|
|
@@ -21074,7 +20891,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
21074
20891
|
}
|
|
21075
20892
|
let content;
|
|
21076
20893
|
try {
|
|
21077
|
-
content =
|
|
20894
|
+
content = readFileSync21(resolved, "utf-8");
|
|
21078
20895
|
} catch {
|
|
21079
20896
|
continue;
|
|
21080
20897
|
}
|
|
@@ -21799,7 +21616,7 @@ __export(exports_devtoolsJson, {
|
|
|
21799
21616
|
normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
|
|
21800
21617
|
devtoolsJson: () => devtoolsJson
|
|
21801
21618
|
});
|
|
21802
|
-
import { existsSync as existsSync29, mkdirSync as mkdirSync14, readFileSync as
|
|
21619
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync14, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
|
|
21803
21620
|
import { dirname as dirname22, join as join32, resolve as resolve39 } from "path";
|
|
21804
21621
|
import { Elysia as Elysia3 } from "elysia";
|
|
21805
21622
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
@@ -21809,7 +21626,7 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
21809
21626
|
if (!existsSync29(cachePath))
|
|
21810
21627
|
return null;
|
|
21811
21628
|
try {
|
|
21812
|
-
const value =
|
|
21629
|
+
const value = readFileSync21(cachePath, "utf-8").trim();
|
|
21813
21630
|
return isUuidV4(value) ? value : null;
|
|
21814
21631
|
} catch {
|
|
21815
21632
|
return null;
|
|
@@ -22164,7 +21981,7 @@ __export(exports_prerender, {
|
|
|
22164
21981
|
prerender: () => prerender,
|
|
22165
21982
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
22166
21983
|
});
|
|
22167
|
-
import { mkdirSync as mkdirSync15, readFileSync as
|
|
21984
|
+
import { mkdirSync as mkdirSync15, readFileSync as readFileSync22 } from "fs";
|
|
22168
21985
|
import { join as join33 } from "path";
|
|
22169
21986
|
var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
22170
21987
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
@@ -22172,7 +21989,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
22172
21989
|
}, readTimestamp = (htmlPath) => {
|
|
22173
21990
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
22174
21991
|
try {
|
|
22175
|
-
const content =
|
|
21992
|
+
const content = readFileSync22(metaPath, "utf-8");
|
|
22176
21993
|
return Number(content) || 0;
|
|
22177
21994
|
} catch {
|
|
22178
21995
|
return 0;
|
|
@@ -22859,8 +22676,8 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
22859
22676
|
});
|
|
22860
22677
|
};
|
|
22861
22678
|
// src/core/prepare.ts
|
|
22862
|
-
import { existsSync as existsSync31, readdirSync as readdirSync3, readFileSync as
|
|
22863
|
-
import { basename as
|
|
22679
|
+
import { existsSync as existsSync31, readdirSync as readdirSync3, readFileSync as readFileSync23 } from "fs";
|
|
22680
|
+
import { basename as basename14, join as join34, relative as relative16, resolve as resolve41 } from "path";
|
|
22864
22681
|
import { Elysia as Elysia5 } from "elysia";
|
|
22865
22682
|
|
|
22866
22683
|
// src/utils/loadConfig.ts
|
|
@@ -23439,7 +23256,7 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
23439
23256
|
for (const entry of entries) {
|
|
23440
23257
|
if (!entry.endsWith(".html"))
|
|
23441
23258
|
continue;
|
|
23442
|
-
const name =
|
|
23259
|
+
const name = basename14(entry, ".html");
|
|
23443
23260
|
const route = name === "index" ? "/" : `/${name}`;
|
|
23444
23261
|
map.set(route, join34(prerenderDir, entry));
|
|
23445
23262
|
}
|
|
@@ -23482,7 +23299,7 @@ var prepare = async (configOrPath) => {
|
|
|
23482
23299
|
return result;
|
|
23483
23300
|
}
|
|
23484
23301
|
stepStartedAt = performance.now();
|
|
23485
|
-
const manifest = JSON.parse(
|
|
23302
|
+
const manifest = JSON.parse(readFileSync23(`${buildDir}/manifest.json`, "utf-8"));
|
|
23486
23303
|
setCurrentIslandManifest(manifest);
|
|
23487
23304
|
if (config.islands?.registry) {
|
|
23488
23305
|
setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
|
|
@@ -23492,7 +23309,7 @@ var prepare = async (configOrPath) => {
|
|
|
23492
23309
|
stepStartedAt = performance.now();
|
|
23493
23310
|
const conventionsPath = join34(buildDir, "conventions.json");
|
|
23494
23311
|
if (existsSync31(conventionsPath)) {
|
|
23495
|
-
const conventions2 = JSON.parse(
|
|
23312
|
+
const conventions2 = JSON.parse(readFileSync23(conventionsPath, "utf-8"));
|
|
23496
23313
|
setConventions(conventions2);
|
|
23497
23314
|
}
|
|
23498
23315
|
recordStep("load production conventions", stepStartedAt);
|
|
@@ -23564,7 +23381,7 @@ import { argv } from "process";
|
|
|
23564
23381
|
var {env: env4 } = globalThis.Bun;
|
|
23565
23382
|
|
|
23566
23383
|
// src/dev/devCert.ts
|
|
23567
|
-
import { existsSync as existsSync32, mkdirSync as mkdirSync16, readFileSync as
|
|
23384
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync16, readFileSync as readFileSync24, rmSync as rmSync3 } from "fs";
|
|
23568
23385
|
import { join as join35 } from "path";
|
|
23569
23386
|
var CERT_DIR = join35(process.cwd(), ".absolutejs");
|
|
23570
23387
|
var CERT_PATH = join35(CERT_DIR, "cert.pem");
|
|
@@ -23575,7 +23392,7 @@ var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1
|
|
|
23575
23392
|
var certFilesExist = () => existsSync32(CERT_PATH) && existsSync32(KEY_PATH);
|
|
23576
23393
|
var isCertExpired = () => {
|
|
23577
23394
|
try {
|
|
23578
|
-
const certPem =
|
|
23395
|
+
const certPem = readFileSync24(CERT_PATH, "utf-8");
|
|
23579
23396
|
const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
|
|
23580
23397
|
stdin: new TextEncoder().encode(certPem)
|
|
23581
23398
|
});
|
|
@@ -23671,8 +23488,8 @@ var loadDevCert = () => {
|
|
|
23671
23488
|
return null;
|
|
23672
23489
|
try {
|
|
23673
23490
|
return {
|
|
23674
|
-
cert:
|
|
23675
|
-
key:
|
|
23491
|
+
cert: readFileSync24(paths.cert, "utf-8"),
|
|
23492
|
+
key: readFileSync24(paths.key, "utf-8")
|
|
23676
23493
|
};
|
|
23677
23494
|
} catch {
|
|
23678
23495
|
return null;
|
|
@@ -23900,7 +23717,7 @@ var jsonLd2 = (schema) => {
|
|
|
23900
23717
|
};
|
|
23901
23718
|
// src/utils/defineEnv.ts
|
|
23902
23719
|
var {env: bunEnv } = globalThis.Bun;
|
|
23903
|
-
import { existsSync as existsSync33, readFileSync as
|
|
23720
|
+
import { existsSync as existsSync33, readFileSync as readFileSync25 } from "fs";
|
|
23904
23721
|
import { resolve as resolve42 } from "path";
|
|
23905
23722
|
|
|
23906
23723
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
@@ -29942,13 +29759,13 @@ var checkEnvFileSecurity = (properties) => {
|
|
|
29942
29759
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
29943
29760
|
if (sensitiveKeys.length === 0)
|
|
29944
29761
|
return;
|
|
29945
|
-
const envContent =
|
|
29762
|
+
const envContent = readFileSync25(envPath, "utf-8");
|
|
29946
29763
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
29947
29764
|
if (presentKeys.length === 0)
|
|
29948
29765
|
return;
|
|
29949
29766
|
const gitignorePath = resolve42(cwd2, ".gitignore");
|
|
29950
29767
|
if (existsSync33(gitignorePath)) {
|
|
29951
|
-
const gitignore =
|
|
29768
|
+
const gitignore = readFileSync25(gitignorePath, "utf-8");
|
|
29952
29769
|
if (gitignore.split(`
|
|
29953
29770
|
`).some((line) => line.trim() === ".env"))
|
|
29954
29771
|
return;
|
|
@@ -30186,5 +30003,5 @@ export {
|
|
|
30186
30003
|
ANGULAR_INIT_TIMEOUT_MS
|
|
30187
30004
|
};
|
|
30188
30005
|
|
|
30189
|
-
//# debugId=
|
|
30006
|
+
//# debugId=A3C5EF48AC33740564756E2164756E21
|
|
30190
30007
|
//# sourceMappingURL=index.js.map
|