@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/build.js
CHANGED
|
@@ -11489,26 +11489,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11489
11489
|
if (existsSync16(fromNodeModules))
|
|
11490
11490
|
return fromNodeModules;
|
|
11491
11491
|
return resolve17(import.meta.dir, "./dev/client");
|
|
11492
|
-
}, devClientDir4, hmrClientPath5,
|
|
11493
|
-
const entityClassRegex = /(?:export\s+)?class\s+(\w+(?:Component|Service|Directive|Pipe))\s/g;
|
|
11494
|
-
const entityNames = [];
|
|
11495
|
-
let match;
|
|
11496
|
-
while ((match = entityClassRegex.exec(content)) !== null) {
|
|
11497
|
-
if (match[1])
|
|
11498
|
-
entityNames.push(match[1]);
|
|
11499
|
-
}
|
|
11500
|
-
if (entityNames.length === 0)
|
|
11501
|
-
return content;
|
|
11502
|
-
const registrations = entityNames.map((name) => ` if (typeof ${name} === 'function') window.__ANGULAR_HMR__.register('${sourceId}#${name}', ${name});`).join(`
|
|
11503
|
-
`);
|
|
11504
|
-
const hmrBlock = `
|
|
11505
|
-
// Angular HMR Runtime Layer (Level 3) \u2014 Auto-registration
|
|
11506
|
-
if (typeof window !== 'undefined' && window.__ANGULAR_HMR__) {
|
|
11507
|
-
${registrations}
|
|
11508
|
-
}
|
|
11509
|
-
`;
|
|
11510
|
-
return content + hmrBlock;
|
|
11511
|
-
}, formatDiagnosticMessage = (diagnostic) => {
|
|
11492
|
+
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
11512
11493
|
try {
|
|
11513
11494
|
return ts2.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
11514
11495
|
`);
|
|
@@ -12331,14 +12312,10 @@ export default ${componentClassName};
|
|
|
12331
12312
|
export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
12332
12313
|
`;
|
|
12333
12314
|
}
|
|
12334
|
-
if (hmr) {
|
|
12335
|
-
rewritten = injectHMRRegistration(rewritten, resolvedEntry);
|
|
12336
|
-
}
|
|
12337
12315
|
await traceAngularPhase("wrapper/write-server-output", () => fs.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
|
|
12338
12316
|
const relativePath = relative10(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
12339
12317
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
12340
12318
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
12341
|
-
import "${hmrRuntimePath}";
|
|
12342
12319
|
import "${hmrClientPath5}";
|
|
12343
12320
|
` : "";
|
|
12344
12321
|
const hydration = hmr ? `${hmrPreamble}
|
|
@@ -12380,68 +12357,66 @@ var absoluteHttpTransferCacheOptions = {
|
|
|
12380
12357
|
}
|
|
12381
12358
|
};
|
|
12382
12359
|
|
|
12383
|
-
//
|
|
12384
|
-
//
|
|
12385
|
-
//
|
|
12386
|
-
|
|
12360
|
+
// SURGICAL_HMR Tier 1 \u2014 Re-bootstrap hook. The dev client invokes
|
|
12361
|
+
// \`window.__ABS_ANGULAR_REBOOTSTRAP__()\` when it receives an
|
|
12362
|
+
// \`angular:rebootstrap\` WS message; the hook looks up this page's
|
|
12363
|
+
// freshly-built bundle URL (the rebuild already broadcast its
|
|
12364
|
+
// updated manifest, so window.__HMR_MANIFEST__ is current) and
|
|
12365
|
+
// dynamic-imports it. Re-importing the chunk re-runs the
|
|
12366
|
+
// destroy+bootstrap block below \u2014 no special path needed because
|
|
12367
|
+
// chunk eval is the bootstrap.
|
|
12368
|
+
window.__ABS_ANGULAR_PAGE_BUNDLE_ID__ = '${toPascal(fileBase)}Index';
|
|
12369
|
+
window.__ABS_ANGULAR_REBOOTSTRAP__ = async function() {
|
|
12370
|
+
var id = window.__ABS_ANGULAR_PAGE_BUNDLE_ID__;
|
|
12371
|
+
var manifest = window.__HMR_MANIFEST__ || {};
|
|
12372
|
+
var newUrl = manifest[id];
|
|
12373
|
+
if (!newUrl) {
|
|
12374
|
+
console.warn('[absolutejs] no bundle URL in manifest for', id, '\u2014 full reload');
|
|
12375
|
+
window.location.reload();
|
|
12376
|
+
return;
|
|
12377
|
+
}
|
|
12378
|
+
await import(newUrl + '?t=' + Date.now());
|
|
12379
|
+
};
|
|
12387
12380
|
|
|
12388
|
-
|
|
12389
|
-
|
|
12390
|
-
|
|
12391
|
-
// to a full re-bootstrap because those values are consumed once at
|
|
12392
|
-
// bootstrap and won't propagate to the running router/injector via an
|
|
12393
|
-
// in-place component patch.
|
|
12394
|
-
if (typeof window !== 'undefined' && window.__ANGULAR_HMR__ && typeof window.__ANGULAR_HMR__.recordPageExports === 'function') {
|
|
12395
|
-
var __abs_hmr_routes = Reflect.get(pageModule, 'routes');
|
|
12396
|
-
window.__ANGULAR_HMR__.recordPageExports('${resolvedEntry}', __abs_hmr_routes, maybePageProviders);
|
|
12381
|
+
if (window.__ANGULAR_APP__) {
|
|
12382
|
+
try { window.__ANGULAR_APP__.destroy(); } catch (_err) { /* ignore */ }
|
|
12383
|
+
window.__ANGULAR_APP__ = null;
|
|
12397
12384
|
}
|
|
12398
12385
|
|
|
12399
|
-
//
|
|
12400
|
-
|
|
12401
|
-
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
if (!window.__ANGULAR_HMR_FAST_PATCH__) {
|
|
12405
|
-
if (window.__ANGULAR_APP__) {
|
|
12406
|
-
try { window.__ANGULAR_APP__.destroy(); } catch (_err) { /* ignore */ }
|
|
12407
|
-
window.__ANGULAR_APP__ = null;
|
|
12408
|
-
}
|
|
12409
|
-
|
|
12410
|
-
// Ensure root element exists after destroy (Angular removes it)
|
|
12411
|
-
var _sel = ${componentClassName}.\u0275cmp?.selectors?.[0]?.[0] || 'ng-app';
|
|
12412
|
-
if (!document.querySelector(_sel)) {
|
|
12413
|
-
(document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
|
|
12414
|
-
}
|
|
12386
|
+
// Ensure root element exists after destroy (Angular removes it)
|
|
12387
|
+
var _sel = ${componentClassName}.\u0275cmp?.selectors?.[0]?.[0] || 'ng-app';
|
|
12388
|
+
if (!document.querySelector(_sel)) {
|
|
12389
|
+
(document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
|
|
12390
|
+
}
|
|
12415
12391
|
|
|
12416
|
-
|
|
12417
|
-
|
|
12418
|
-
|
|
12419
|
-
|
|
12420
|
-
|
|
12421
|
-
|
|
12422
|
-
|
|
12423
|
-
|
|
12392
|
+
var providers = [provideZonelessChangeDetection()];
|
|
12393
|
+
if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
|
|
12394
|
+
providers.push(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
|
|
12395
|
+
}
|
|
12396
|
+
delete window.__HMR_SKIP_HYDRATION__;
|
|
12397
|
+
providers.push.apply(providers, pageProviders);
|
|
12398
|
+
providers.push.apply(providers, propProviders);
|
|
12399
|
+
window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
|
|
12424
12400
|
|
|
12425
|
-
|
|
12401
|
+
if (pageHasRawStreamingSlots) {
|
|
12402
|
+
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
12403
|
+
if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
|
|
12404
|
+
requestAnimationFrame(function() {
|
|
12405
|
+
window.__ABS_SLOT_FLUSH__();
|
|
12406
|
+
});
|
|
12407
|
+
}
|
|
12408
|
+
} else {
|
|
12409
|
+
bootstrapApplication(${componentClassName}, {
|
|
12410
|
+
providers: providers
|
|
12411
|
+
}).then(function (appRef) {
|
|
12412
|
+
window.__ANGULAR_APP__ = appRef;
|
|
12426
12413
|
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
12427
12414
|
if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
|
|
12428
12415
|
requestAnimationFrame(function() {
|
|
12429
12416
|
window.__ABS_SLOT_FLUSH__();
|
|
12430
12417
|
});
|
|
12431
12418
|
}
|
|
12432
|
-
}
|
|
12433
|
-
bootstrapApplication(${componentClassName}, {
|
|
12434
|
-
providers: providers
|
|
12435
|
-
}).then(function (appRef) {
|
|
12436
|
-
window.__ANGULAR_APP__ = appRef;
|
|
12437
|
-
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
12438
|
-
if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
|
|
12439
|
-
requestAnimationFrame(function() {
|
|
12440
|
-
window.__ABS_SLOT_FLUSH__();
|
|
12441
|
-
});
|
|
12442
|
-
}
|
|
12443
|
-
});
|
|
12444
|
-
}
|
|
12419
|
+
});
|
|
12445
12420
|
}
|
|
12446
12421
|
`.trim() : `
|
|
12447
12422
|
import '@angular/compiler';
|
|
@@ -12543,7 +12518,6 @@ var init_compileAngular = __esm(() => {
|
|
|
12543
12518
|
init_generatedDir();
|
|
12544
12519
|
devClientDir4 = resolveDevClientDir4();
|
|
12545
12520
|
hmrClientPath5 = join17(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
12546
|
-
hmrRuntimePath = join17(devClientDir4, "handlers", "angularRuntime.ts").replace(/\\/g, "/");
|
|
12547
12521
|
jitContentCache = new Map;
|
|
12548
12522
|
wrapperOutputCache = new Map;
|
|
12549
12523
|
});
|
|
@@ -16607,247 +16581,6 @@ var init_ssrCache = __esm(() => {
|
|
|
16607
16581
|
dirtyFrameworks = new Set;
|
|
16608
16582
|
});
|
|
16609
16583
|
|
|
16610
|
-
// src/dev/angular/editTypeDetection.ts
|
|
16611
|
-
import { readFileSync as readFileSync17 } from "fs";
|
|
16612
|
-
import { basename as basename10 } from "path";
|
|
16613
|
-
import * as ts3 from "typescript";
|
|
16614
|
-
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) => {
|
|
16615
|
-
const callee = node.expression;
|
|
16616
|
-
if (ts3.isIdentifier(callee))
|
|
16617
|
-
return callee.text;
|
|
16618
|
-
if (ts3.isPropertyAccessExpression(callee))
|
|
16619
|
-
return callee.name.text;
|
|
16620
|
-
return null;
|
|
16621
|
-
}, getNewExprName = (node) => {
|
|
16622
|
-
const callee = node.expression;
|
|
16623
|
-
if (ts3.isIdentifier(callee))
|
|
16624
|
-
return callee.text;
|
|
16625
|
-
if (ts3.isPropertyAccessExpression(callee))
|
|
16626
|
-
return callee.name.text;
|
|
16627
|
-
return null;
|
|
16628
|
-
}, collectMethodBodies = (cls) => {
|
|
16629
|
-
const methods = new Map;
|
|
16630
|
-
cls.members.forEach((member) => {
|
|
16631
|
-
if (!member.name || !ts3.isIdentifier(member.name))
|
|
16632
|
-
return;
|
|
16633
|
-
if (ts3.isMethodDeclaration(member) && member.body) {
|
|
16634
|
-
methods.set(member.name.text, member.body);
|
|
16635
|
-
return;
|
|
16636
|
-
}
|
|
16637
|
-
if (ts3.isPropertyDeclaration(member) && member.initializer) {
|
|
16638
|
-
const init = member.initializer;
|
|
16639
|
-
if (ts3.isArrowFunction(init) || ts3.isFunctionExpression(init)) {
|
|
16640
|
-
methods.set(member.name.text, init.body);
|
|
16641
|
-
}
|
|
16642
|
-
}
|
|
16643
|
-
});
|
|
16644
|
-
return methods;
|
|
16645
|
-
}, findSideEffectInBody = (body, methods, visited) => {
|
|
16646
|
-
let hit = { found: false };
|
|
16647
|
-
const walk = (node) => {
|
|
16648
|
-
if (hit.found)
|
|
16649
|
-
return;
|
|
16650
|
-
if (ts3.isCallExpression(node)) {
|
|
16651
|
-
const name = getCalleeName(node);
|
|
16652
|
-
if (name && SIDE_EFFECT_CALL_NAMES.has(name)) {
|
|
16653
|
-
hit = {
|
|
16654
|
-
found: true,
|
|
16655
|
-
reason: `constructor invokes ${name}(...)`
|
|
16656
|
-
};
|
|
16657
|
-
return;
|
|
16658
|
-
}
|
|
16659
|
-
if (name && methods.has(name) && !visited.has(name)) {
|
|
16660
|
-
visited.add(name);
|
|
16661
|
-
const target = methods.get(name);
|
|
16662
|
-
if (target) {
|
|
16663
|
-
const inner = findSideEffectInBody(target, methods, visited);
|
|
16664
|
-
if (inner.found) {
|
|
16665
|
-
hit = {
|
|
16666
|
-
found: true,
|
|
16667
|
-
reason: `${inner.reason} (via this.${name}())`
|
|
16668
|
-
};
|
|
16669
|
-
return;
|
|
16670
|
-
}
|
|
16671
|
-
}
|
|
16672
|
-
}
|
|
16673
|
-
}
|
|
16674
|
-
if (ts3.isNewExpression(node)) {
|
|
16675
|
-
const name = getNewExprName(node);
|
|
16676
|
-
if (name && SIDE_EFFECT_NEW_NAMES.has(name)) {
|
|
16677
|
-
hit = {
|
|
16678
|
-
found: true,
|
|
16679
|
-
reason: `constructor instantiates new ${name}(...)`
|
|
16680
|
-
};
|
|
16681
|
-
return;
|
|
16682
|
-
}
|
|
16683
|
-
}
|
|
16684
|
-
ts3.forEachChild(node, walk);
|
|
16685
|
-
};
|
|
16686
|
-
walk(body);
|
|
16687
|
-
return hit;
|
|
16688
|
-
}, analyzeServiceFile = (file4) => {
|
|
16689
|
-
let source;
|
|
16690
|
-
try {
|
|
16691
|
-
source = readFileSync17(file4, "utf8");
|
|
16692
|
-
} catch {
|
|
16693
|
-
return {
|
|
16694
|
-
hasSideEffectCtor: true,
|
|
16695
|
-
reason: "service file unreadable \u2014 defaulting to reboot"
|
|
16696
|
-
};
|
|
16697
|
-
}
|
|
16698
|
-
const sf = ts3.createSourceFile(file4, source, ts3.ScriptTarget.Latest, true);
|
|
16699
|
-
let result = {
|
|
16700
|
-
hasSideEffectCtor: false,
|
|
16701
|
-
reason: "constructor has no side-effecting calls"
|
|
16702
|
-
};
|
|
16703
|
-
const visit = (node) => {
|
|
16704
|
-
if (result.hasSideEffectCtor)
|
|
16705
|
-
return;
|
|
16706
|
-
if (!ts3.isClassDeclaration(node)) {
|
|
16707
|
-
ts3.forEachChild(node, visit);
|
|
16708
|
-
return;
|
|
16709
|
-
}
|
|
16710
|
-
const methods = collectMethodBodies(node);
|
|
16711
|
-
const ctor = node.members.find(ts3.isConstructorDeclaration);
|
|
16712
|
-
const targets = [];
|
|
16713
|
-
if (ctor?.body)
|
|
16714
|
-
targets.push(ctor.body);
|
|
16715
|
-
node.members.forEach((member) => {
|
|
16716
|
-
if (ts3.isPropertyDeclaration(member) && member.initializer) {
|
|
16717
|
-
targets.push(member.initializer);
|
|
16718
|
-
}
|
|
16719
|
-
});
|
|
16720
|
-
for (const target of targets) {
|
|
16721
|
-
const r = findSideEffectInBody(target, methods, new Set);
|
|
16722
|
-
if (r.found) {
|
|
16723
|
-
result = { hasSideEffectCtor: true, reason: r.reason };
|
|
16724
|
-
break;
|
|
16725
|
-
}
|
|
16726
|
-
}
|
|
16727
|
-
if (!result.hasSideEffectCtor)
|
|
16728
|
-
ts3.forEachChild(node, visit);
|
|
16729
|
-
};
|
|
16730
|
-
visit(sf);
|
|
16731
|
-
return result;
|
|
16732
|
-
}, classifyAngularEdit = (file4) => {
|
|
16733
|
-
const base = basename10(file4);
|
|
16734
|
-
if (TEMPLATE_RE.test(file4)) {
|
|
16735
|
-
return {
|
|
16736
|
-
type: "template",
|
|
16737
|
-
reason: `${base} \u2014 template edit`,
|
|
16738
|
-
sourceFile: file4
|
|
16739
|
-
};
|
|
16740
|
-
}
|
|
16741
|
-
if (COMPONENT_STYLE_RE.test(file4)) {
|
|
16742
|
-
return {
|
|
16743
|
-
type: "style-component",
|
|
16744
|
-
reason: `${base} \u2014 component-scoped stylesheet edit`,
|
|
16745
|
-
sourceFile: file4
|
|
16746
|
-
};
|
|
16747
|
-
}
|
|
16748
|
-
if (STYLE_EXT_RE.test(file4)) {
|
|
16749
|
-
return {
|
|
16750
|
-
type: "reboot",
|
|
16751
|
-
reason: `${base} \u2014 non-component-named stylesheet, falling back to reboot until scoping is verified`,
|
|
16752
|
-
sourceFile: file4
|
|
16753
|
-
};
|
|
16754
|
-
}
|
|
16755
|
-
if (ROUTES_RE.test(file4)) {
|
|
16756
|
-
return {
|
|
16757
|
-
type: "route",
|
|
16758
|
-
reason: `${base} \u2014 router config, requires reboot`,
|
|
16759
|
-
sourceFile: file4
|
|
16760
|
-
};
|
|
16761
|
-
}
|
|
16762
|
-
if (SERVICE_RE.test(file4)) {
|
|
16763
|
-
const a = analyzeServiceFile(file4);
|
|
16764
|
-
if (a.hasSideEffectCtor) {
|
|
16765
|
-
return {
|
|
16766
|
-
type: "service-with-side-effects",
|
|
16767
|
-
reason: `${base} \u2014 ${a.reason}`,
|
|
16768
|
-
sourceFile: file4
|
|
16769
|
-
};
|
|
16770
|
-
}
|
|
16771
|
-
return {
|
|
16772
|
-
type: "service-method-only",
|
|
16773
|
-
reason: `${base} \u2014 ${a.reason}`,
|
|
16774
|
-
sourceFile: file4
|
|
16775
|
-
};
|
|
16776
|
-
}
|
|
16777
|
-
if (COMPONENT_CLASS_RE.test(file4)) {
|
|
16778
|
-
return {
|
|
16779
|
-
type: "class-component",
|
|
16780
|
-
reason: `${base} \u2014 component class edit`,
|
|
16781
|
-
sourceFile: file4
|
|
16782
|
-
};
|
|
16783
|
-
}
|
|
16784
|
-
if (PAGE_TS_RE.test(file4)) {
|
|
16785
|
-
return {
|
|
16786
|
-
type: "class-component",
|
|
16787
|
-
reason: `${base} \u2014 page component edit`,
|
|
16788
|
-
sourceFile: file4
|
|
16789
|
-
};
|
|
16790
|
-
}
|
|
16791
|
-
return {
|
|
16792
|
-
type: "reboot",
|
|
16793
|
-
reason: `${base} \u2014 unrecognized angular file type, falling back to reboot`,
|
|
16794
|
-
sourceFile: file4
|
|
16795
|
-
};
|
|
16796
|
-
}, collapseClassifications = (classifications) => {
|
|
16797
|
-
if (classifications.length === 0) {
|
|
16798
|
-
return {
|
|
16799
|
-
type: "reboot",
|
|
16800
|
-
reason: "no classifiable files in batch",
|
|
16801
|
-
sourceFile: ""
|
|
16802
|
-
};
|
|
16803
|
-
}
|
|
16804
|
-
let winner = classifications[0];
|
|
16805
|
-
for (let i = 1;i < classifications.length; i++) {
|
|
16806
|
-
const candidate = classifications[i];
|
|
16807
|
-
if (TYPE_PRIORITY[candidate.type] > TYPE_PRIORITY[winner.type]) {
|
|
16808
|
-
winner = candidate;
|
|
16809
|
-
}
|
|
16810
|
-
}
|
|
16811
|
-
return winner;
|
|
16812
|
-
};
|
|
16813
|
-
var init_editTypeDetection = __esm(() => {
|
|
16814
|
-
TYPE_PRIORITY = {
|
|
16815
|
-
template: 0,
|
|
16816
|
-
"style-component": 1,
|
|
16817
|
-
"service-method-only": 2,
|
|
16818
|
-
"class-component": 3,
|
|
16819
|
-
"service-with-side-effects": 4,
|
|
16820
|
-
route: 5,
|
|
16821
|
-
reboot: 6
|
|
16822
|
-
};
|
|
16823
|
-
STYLE_EXT_RE = /\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
16824
|
-
COMPONENT_STYLE_RE = /\.component\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
16825
|
-
TEMPLATE_RE = /\.html$/i;
|
|
16826
|
-
COMPONENT_CLASS_RE = /\.component\.ts$/i;
|
|
16827
|
-
SERVICE_RE = /\.service\.ts$/i;
|
|
16828
|
-
ROUTES_RE = /(?:^|[\\/])(?:app\.)?routes\.ts$/i;
|
|
16829
|
-
PAGE_TS_RE = /(?:^|[\\/])pages[\\/][^\\/]+\.ts$/i;
|
|
16830
|
-
SIDE_EFFECT_CALL_NAMES = new Set([
|
|
16831
|
-
"subscribe",
|
|
16832
|
-
"setInterval",
|
|
16833
|
-
"setTimeout",
|
|
16834
|
-
"addEventListener",
|
|
16835
|
-
"effect",
|
|
16836
|
-
"afterNextRender",
|
|
16837
|
-
"afterRender",
|
|
16838
|
-
"afterEveryRender",
|
|
16839
|
-
"requestAnimationFrame",
|
|
16840
|
-
"requestIdleCallback"
|
|
16841
|
-
]);
|
|
16842
|
-
SIDE_EFFECT_NEW_NAMES = new Set([
|
|
16843
|
-
"Worker",
|
|
16844
|
-
"SharedWorker",
|
|
16845
|
-
"EventSource",
|
|
16846
|
-
"WebSocket",
|
|
16847
|
-
"BroadcastChannel"
|
|
16848
|
-
]);
|
|
16849
|
-
});
|
|
16850
|
-
|
|
16851
16584
|
// src/dev/moduleServer.ts
|
|
16852
16585
|
var exports_moduleServer = {};
|
|
16853
16586
|
__export(exports_moduleServer, {
|
|
@@ -16859,8 +16592,8 @@ __export(exports_moduleServer, {
|
|
|
16859
16592
|
createModuleServer: () => createModuleServer,
|
|
16860
16593
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
16861
16594
|
});
|
|
16862
|
-
import { existsSync as existsSync24, readFileSync as
|
|
16863
|
-
import { basename as
|
|
16595
|
+
import { existsSync as existsSync24, readFileSync as readFileSync17, statSync as statSync2 } from "fs";
|
|
16596
|
+
import { basename as basename10, dirname as dirname16, extname as extname8, join as join27, resolve as resolve29, relative as relative12 } from "path";
|
|
16864
16597
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
16865
16598
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
16866
16599
|
const allExports = [];
|
|
@@ -16932,7 +16665,7 @@ ${stubs}
|
|
|
16932
16665
|
const pkgDir = resolve29(projectRoot, "node_modules", packageName ?? "");
|
|
16933
16666
|
const pkgJsonPath = join27(pkgDir, "package.json");
|
|
16934
16667
|
if (existsSync24(pkgJsonPath)) {
|
|
16935
|
-
const pkg = JSON.parse(
|
|
16668
|
+
const pkg = JSON.parse(readFileSync17(pkgJsonPath, "utf-8"));
|
|
16936
16669
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
16937
16670
|
if (esmEntry) {
|
|
16938
16671
|
const resolved = resolve29(pkgDir, esmEntry);
|
|
@@ -17031,7 +16764,7 @@ ${code}`;
|
|
|
17031
16764
|
reactFastRefreshWarningEmitted = true;
|
|
17032
16765
|
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.");
|
|
17033
16766
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
17034
|
-
const raw =
|
|
16767
|
+
const raw = readFileSync17(filePath, "utf-8");
|
|
17035
16768
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
17036
16769
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
17037
16770
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -17047,7 +16780,7 @@ ${transpiled}`;
|
|
|
17047
16780
|
transpiled += buildIslandMetadataExports(raw);
|
|
17048
16781
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
17049
16782
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
17050
|
-
const raw =
|
|
16783
|
+
const raw = readFileSync17(filePath, "utf-8");
|
|
17051
16784
|
const ext = extname8(filePath);
|
|
17052
16785
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
17053
16786
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -17213,7 +16946,7 @@ ${code}`;
|
|
|
17213
16946
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
17214
16947
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
17215
16948
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
17216
|
-
const raw =
|
|
16949
|
+
const raw = readFileSync17(filePath, "utf-8");
|
|
17217
16950
|
if (!svelteCompiler) {
|
|
17218
16951
|
svelteCompiler = await import("svelte/compiler");
|
|
17219
16952
|
}
|
|
@@ -17273,12 +17006,12 @@ export default __script__;`;
|
|
|
17273
17006
|
return `${cssInjection}
|
|
17274
17007
|
${code}`;
|
|
17275
17008
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
17276
|
-
const rawSource =
|
|
17009
|
+
const rawSource = readFileSync17(filePath, "utf-8");
|
|
17277
17010
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
17278
17011
|
if (!vueCompiler) {
|
|
17279
17012
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
17280
17013
|
}
|
|
17281
|
-
const fileName =
|
|
17014
|
+
const fileName = basename10(filePath, ".vue");
|
|
17282
17015
|
const componentId = fileName.toLowerCase();
|
|
17283
17016
|
const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
|
|
17284
17017
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -17328,7 +17061,7 @@ ${code}`;
|
|
|
17328
17061
|
}
|
|
17329
17062
|
});
|
|
17330
17063
|
}, handleCssRequest = (filePath) => {
|
|
17331
|
-
const raw =
|
|
17064
|
+
const raw = readFileSync17(filePath, "utf-8");
|
|
17332
17065
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
17333
17066
|
return [
|
|
17334
17067
|
`const style = document.createElement('style');`,
|
|
@@ -17653,9 +17386,9 @@ var exports_resolveOwningComponents = {};
|
|
|
17653
17386
|
__export(exports_resolveOwningComponents, {
|
|
17654
17387
|
resolveOwningComponents: () => resolveOwningComponents
|
|
17655
17388
|
});
|
|
17656
|
-
import { readdirSync as readdirSync2, readFileSync as
|
|
17389
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync18, statSync as statSync3 } from "fs";
|
|
17657
17390
|
import { dirname as dirname17, extname as extname9, join as join28, resolve as resolve30 } from "path";
|
|
17658
|
-
import
|
|
17391
|
+
import ts3 from "typescript";
|
|
17659
17392
|
var isComponentTsFile = (file4) => file4.endsWith(".component.ts") || file4.endsWith(".component.tsx"), walkComponentTsFiles = (root) => {
|
|
17660
17393
|
const out = [];
|
|
17661
17394
|
const visit = (dir) => {
|
|
@@ -17681,13 +17414,13 @@ var isComponentTsFile = (file4) => file4.endsWith(".component.ts") || file4.ends
|
|
|
17681
17414
|
return out;
|
|
17682
17415
|
}, getStringPropertyValue = (obj, name) => {
|
|
17683
17416
|
for (const prop of obj.properties) {
|
|
17684
|
-
if (!
|
|
17417
|
+
if (!ts3.isPropertyAssignment(prop))
|
|
17685
17418
|
continue;
|
|
17686
|
-
const propName =
|
|
17419
|
+
const propName = ts3.isIdentifier(prop.name) ? prop.name.text : ts3.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
17687
17420
|
if (propName !== name)
|
|
17688
17421
|
continue;
|
|
17689
17422
|
const init = prop.initializer;
|
|
17690
|
-
if (
|
|
17423
|
+
if (ts3.isStringLiteral(init) || ts3.isNoSubstitutionTemplateLiteral(init)) {
|
|
17691
17424
|
return init.text;
|
|
17692
17425
|
}
|
|
17693
17426
|
}
|
|
@@ -17695,16 +17428,16 @@ var isComponentTsFile = (file4) => file4.endsWith(".component.ts") || file4.ends
|
|
|
17695
17428
|
}, getStringArrayProperty = (obj, name) => {
|
|
17696
17429
|
const out = [];
|
|
17697
17430
|
for (const prop of obj.properties) {
|
|
17698
|
-
if (!
|
|
17431
|
+
if (!ts3.isPropertyAssignment(prop))
|
|
17699
17432
|
continue;
|
|
17700
|
-
const propName =
|
|
17433
|
+
const propName = ts3.isIdentifier(prop.name) ? prop.name.text : ts3.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
17701
17434
|
if (propName !== name)
|
|
17702
17435
|
continue;
|
|
17703
17436
|
const init = prop.initializer;
|
|
17704
|
-
if (!
|
|
17437
|
+
if (!ts3.isArrayLiteralExpression(init))
|
|
17705
17438
|
continue;
|
|
17706
17439
|
for (const element of init.elements) {
|
|
17707
|
-
if (
|
|
17440
|
+
if (ts3.isStringLiteral(element) || ts3.isNoSubstitutionTemplateLiteral(element)) {
|
|
17708
17441
|
out.push(element.text);
|
|
17709
17442
|
}
|
|
17710
17443
|
}
|
|
@@ -17718,24 +17451,24 @@ var isComponentTsFile = (file4) => file4.endsWith(".component.ts") || file4.ends
|
|
|
17718
17451
|
};
|
|
17719
17452
|
let source;
|
|
17720
17453
|
try {
|
|
17721
|
-
source =
|
|
17454
|
+
source = readFileSync18(filePath, "utf8");
|
|
17722
17455
|
} catch {
|
|
17723
17456
|
return refs;
|
|
17724
17457
|
}
|
|
17725
|
-
const sourceFile =
|
|
17458
|
+
const sourceFile = ts3.createSourceFile(filePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
|
|
17726
17459
|
const visit = (node) => {
|
|
17727
|
-
if (
|
|
17728
|
-
const decorators =
|
|
17460
|
+
if (ts3.isClassDeclaration(node) && node.name) {
|
|
17461
|
+
const decorators = ts3.getDecorators(node) ?? [];
|
|
17729
17462
|
for (const decorator of decorators) {
|
|
17730
17463
|
const expr = decorator.expression;
|
|
17731
|
-
if (!
|
|
17464
|
+
if (!ts3.isCallExpression(expr))
|
|
17732
17465
|
continue;
|
|
17733
17466
|
const fn2 = expr.expression;
|
|
17734
|
-
if (!
|
|
17467
|
+
if (!ts3.isIdentifier(fn2) || fn2.text !== "Component")
|
|
17735
17468
|
continue;
|
|
17736
17469
|
refs.classNames.push(node.name.text);
|
|
17737
17470
|
const arg = expr.arguments[0];
|
|
17738
|
-
if (!arg || !
|
|
17471
|
+
if (!arg || !ts3.isObjectLiteralExpression(arg))
|
|
17739
17472
|
continue;
|
|
17740
17473
|
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
17741
17474
|
if (tplUrl)
|
|
@@ -17746,7 +17479,7 @@ var isComponentTsFile = (file4) => file4.endsWith(".component.ts") || file4.ends
|
|
|
17746
17479
|
refs.styleUrls.push(...getStringArrayProperty(arg, "styleUrls"));
|
|
17747
17480
|
}
|
|
17748
17481
|
}
|
|
17749
|
-
|
|
17482
|
+
ts3.forEachChild(node, visit);
|
|
17750
17483
|
};
|
|
17751
17484
|
visit(sourceFile);
|
|
17752
17485
|
return refs;
|
|
@@ -17795,18 +17528,18 @@ var isComponentTsFile = (file4) => file4.endsWith(".component.ts") || file4.ends
|
|
|
17795
17528
|
var init_resolveOwningComponents = () => {};
|
|
17796
17529
|
|
|
17797
17530
|
// src/dev/angular/hmrImportGenerator.ts
|
|
17798
|
-
import
|
|
17531
|
+
import ts4 from "typescript";
|
|
17799
17532
|
var createHmrImportGenerator = (namespaceMap) => ({
|
|
17800
17533
|
addImport(request) {
|
|
17801
17534
|
const ns = namespaceMap.get(request.exportModuleSpecifier);
|
|
17802
17535
|
if (!ns) {
|
|
17803
17536
|
throw new Error(`HMR import generator has no namespace mapping for ${request.exportModuleSpecifier}. ` + `Add it to namespaceDependencies before calling compileHmrUpdateCallback.`);
|
|
17804
17537
|
}
|
|
17805
|
-
const namespaceId =
|
|
17538
|
+
const namespaceId = ts4.factory.createIdentifier(ns);
|
|
17806
17539
|
if (request.exportSymbolName === null) {
|
|
17807
17540
|
return namespaceId;
|
|
17808
17541
|
}
|
|
17809
|
-
return
|
|
17542
|
+
return ts4.factory.createPropertyAccessExpression(namespaceId, ts4.factory.createIdentifier(request.exportSymbolName));
|
|
17810
17543
|
}
|
|
17811
17544
|
});
|
|
17812
17545
|
var init_hmrImportGenerator = () => {};
|
|
@@ -18148,13 +17881,13 @@ var init_translator = __esm(() => {
|
|
|
18148
17881
|
});
|
|
18149
17882
|
|
|
18150
17883
|
// src/dev/angular/vendor/translator/ts_util.ts
|
|
18151
|
-
import
|
|
17884
|
+
import ts5 from "typescript";
|
|
18152
17885
|
function tsNumericExpression(value) {
|
|
18153
17886
|
if (value < 0) {
|
|
18154
|
-
const operand =
|
|
18155
|
-
return
|
|
17887
|
+
const operand = ts5.factory.createNumericLiteral(Math.abs(value));
|
|
17888
|
+
return ts5.factory.createPrefixUnaryExpression(ts5.SyntaxKind.MinusToken, operand);
|
|
18156
17889
|
}
|
|
18157
|
-
return
|
|
17890
|
+
return ts5.factory.createNumericLiteral(value);
|
|
18158
17891
|
}
|
|
18159
17892
|
var init_ts_util = __esm(() => {
|
|
18160
17893
|
/*!
|
|
@@ -18167,147 +17900,147 @@ var init_ts_util = __esm(() => {
|
|
|
18167
17900
|
});
|
|
18168
17901
|
|
|
18169
17902
|
// src/dev/angular/vendor/translator/typescript_ast_factory.ts
|
|
18170
|
-
import
|
|
17903
|
+
import ts6 from "typescript";
|
|
18171
17904
|
|
|
18172
17905
|
class TypeScriptAstFactory {
|
|
18173
17906
|
annotateForClosureCompiler;
|
|
18174
17907
|
externalSourceFiles = new Map;
|
|
18175
17908
|
UNARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
18176
|
-
"+":
|
|
18177
|
-
"-":
|
|
18178
|
-
"!":
|
|
17909
|
+
"+": ts6.SyntaxKind.PlusToken,
|
|
17910
|
+
"-": ts6.SyntaxKind.MinusToken,
|
|
17911
|
+
"!": ts6.SyntaxKind.ExclamationToken
|
|
18179
17912
|
}))();
|
|
18180
17913
|
BINARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
18181
|
-
"&&":
|
|
18182
|
-
">":
|
|
18183
|
-
">=":
|
|
18184
|
-
"&":
|
|
18185
|
-
"|":
|
|
18186
|
-
"/":
|
|
18187
|
-
"==":
|
|
18188
|
-
"===":
|
|
18189
|
-
"<":
|
|
18190
|
-
"<=":
|
|
18191
|
-
"-":
|
|
18192
|
-
"%":
|
|
18193
|
-
"*":
|
|
18194
|
-
"**":
|
|
18195
|
-
"!=":
|
|
18196
|
-
"!==":
|
|
18197
|
-
"||":
|
|
18198
|
-
"+":
|
|
18199
|
-
"??":
|
|
18200
|
-
"=":
|
|
18201
|
-
"+=":
|
|
18202
|
-
"-=":
|
|
18203
|
-
"*=":
|
|
18204
|
-
"/=":
|
|
18205
|
-
"%=":
|
|
18206
|
-
"**=":
|
|
18207
|
-
"&&=":
|
|
18208
|
-
"||=":
|
|
18209
|
-
"??=":
|
|
18210
|
-
in:
|
|
18211
|
-
instanceof:
|
|
17914
|
+
"&&": ts6.SyntaxKind.AmpersandAmpersandToken,
|
|
17915
|
+
">": ts6.SyntaxKind.GreaterThanToken,
|
|
17916
|
+
">=": ts6.SyntaxKind.GreaterThanEqualsToken,
|
|
17917
|
+
"&": ts6.SyntaxKind.AmpersandToken,
|
|
17918
|
+
"|": ts6.SyntaxKind.BarToken,
|
|
17919
|
+
"/": ts6.SyntaxKind.SlashToken,
|
|
17920
|
+
"==": ts6.SyntaxKind.EqualsEqualsToken,
|
|
17921
|
+
"===": ts6.SyntaxKind.EqualsEqualsEqualsToken,
|
|
17922
|
+
"<": ts6.SyntaxKind.LessThanToken,
|
|
17923
|
+
"<=": ts6.SyntaxKind.LessThanEqualsToken,
|
|
17924
|
+
"-": ts6.SyntaxKind.MinusToken,
|
|
17925
|
+
"%": ts6.SyntaxKind.PercentToken,
|
|
17926
|
+
"*": ts6.SyntaxKind.AsteriskToken,
|
|
17927
|
+
"**": ts6.SyntaxKind.AsteriskAsteriskToken,
|
|
17928
|
+
"!=": ts6.SyntaxKind.ExclamationEqualsToken,
|
|
17929
|
+
"!==": ts6.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
17930
|
+
"||": ts6.SyntaxKind.BarBarToken,
|
|
17931
|
+
"+": ts6.SyntaxKind.PlusToken,
|
|
17932
|
+
"??": ts6.SyntaxKind.QuestionQuestionToken,
|
|
17933
|
+
"=": ts6.SyntaxKind.EqualsToken,
|
|
17934
|
+
"+=": ts6.SyntaxKind.PlusEqualsToken,
|
|
17935
|
+
"-=": ts6.SyntaxKind.MinusEqualsToken,
|
|
17936
|
+
"*=": ts6.SyntaxKind.AsteriskEqualsToken,
|
|
17937
|
+
"/=": ts6.SyntaxKind.SlashEqualsToken,
|
|
17938
|
+
"%=": ts6.SyntaxKind.PercentEqualsToken,
|
|
17939
|
+
"**=": ts6.SyntaxKind.AsteriskAsteriskEqualsToken,
|
|
17940
|
+
"&&=": ts6.SyntaxKind.AmpersandAmpersandEqualsToken,
|
|
17941
|
+
"||=": ts6.SyntaxKind.BarBarEqualsToken,
|
|
17942
|
+
"??=": ts6.SyntaxKind.QuestionQuestionEqualsToken,
|
|
17943
|
+
in: ts6.SyntaxKind.InKeyword,
|
|
17944
|
+
instanceof: ts6.SyntaxKind.InstanceOfKeyword
|
|
18212
17945
|
}))();
|
|
18213
17946
|
VAR_TYPES = /* @__PURE__ */ (() => ({
|
|
18214
|
-
const:
|
|
18215
|
-
let:
|
|
18216
|
-
var:
|
|
17947
|
+
const: ts6.NodeFlags.Const,
|
|
17948
|
+
let: ts6.NodeFlags.Let,
|
|
17949
|
+
var: ts6.NodeFlags.None
|
|
18217
17950
|
}))();
|
|
18218
17951
|
constructor(annotateForClosureCompiler) {
|
|
18219
17952
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
18220
17953
|
}
|
|
18221
17954
|
attachComments = attachComments;
|
|
18222
|
-
createArrayLiteral =
|
|
17955
|
+
createArrayLiteral = ts6.factory.createArrayLiteralExpression;
|
|
18223
17956
|
createAssignment(target, operator, value) {
|
|
18224
|
-
return
|
|
17957
|
+
return ts6.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
|
|
18225
17958
|
}
|
|
18226
17959
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
18227
|
-
return
|
|
17960
|
+
return ts6.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
|
|
18228
17961
|
}
|
|
18229
17962
|
createBlock(body) {
|
|
18230
|
-
return
|
|
17963
|
+
return ts6.factory.createBlock(body);
|
|
18231
17964
|
}
|
|
18232
17965
|
createCallExpression(callee, args, pure) {
|
|
18233
|
-
const call =
|
|
17966
|
+
const call = ts6.factory.createCallExpression(callee, undefined, args);
|
|
18234
17967
|
if (pure) {
|
|
18235
|
-
|
|
17968
|
+
ts6.addSyntheticLeadingComment(call, ts6.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler ? "* @pureOrBreakMyCode " /* CLOSURE */ : "@__PURE__" /* TERSER */, false);
|
|
18236
17969
|
}
|
|
18237
17970
|
return call;
|
|
18238
17971
|
}
|
|
18239
17972
|
createConditional(condition, whenTrue, whenFalse) {
|
|
18240
|
-
return
|
|
17973
|
+
return ts6.factory.createConditionalExpression(condition, undefined, whenTrue, undefined, whenFalse);
|
|
18241
17974
|
}
|
|
18242
|
-
createElementAccess =
|
|
18243
|
-
createExpressionStatement =
|
|
17975
|
+
createElementAccess = ts6.factory.createElementAccessExpression;
|
|
17976
|
+
createExpressionStatement = ts6.factory.createExpressionStatement;
|
|
18244
17977
|
createDynamicImport(url) {
|
|
18245
|
-
return
|
|
17978
|
+
return ts6.factory.createCallExpression(ts6.factory.createToken(ts6.SyntaxKind.ImportKeyword), undefined, [typeof url === "string" ? ts6.factory.createStringLiteral(url) : url]);
|
|
18246
17979
|
}
|
|
18247
17980
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
18248
|
-
if (!
|
|
18249
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
17981
|
+
if (!ts6.isBlock(body)) {
|
|
17982
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts6.SyntaxKind[body.kind]}.`);
|
|
18250
17983
|
}
|
|
18251
|
-
return
|
|
17984
|
+
return ts6.factory.createFunctionDeclaration(undefined, undefined, functionName, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
18252
17985
|
}
|
|
18253
17986
|
createFunctionExpression(functionName, parameters, body) {
|
|
18254
|
-
if (!
|
|
18255
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
17987
|
+
if (!ts6.isBlock(body)) {
|
|
17988
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts6.SyntaxKind[body.kind]}.`);
|
|
18256
17989
|
}
|
|
18257
|
-
return
|
|
17990
|
+
return ts6.factory.createFunctionExpression(undefined, undefined, functionName ?? undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
18258
17991
|
}
|
|
18259
17992
|
createArrowFunctionExpression(parameters, body) {
|
|
18260
|
-
if (
|
|
18261
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
17993
|
+
if (ts6.isStatement(body) && !ts6.isBlock(body)) {
|
|
17994
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts6.SyntaxKind[body.kind]}.`);
|
|
18262
17995
|
}
|
|
18263
|
-
return
|
|
17996
|
+
return ts6.factory.createArrowFunction(undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, undefined, body);
|
|
18264
17997
|
}
|
|
18265
17998
|
createParameter(param) {
|
|
18266
|
-
return
|
|
17999
|
+
return ts6.factory.createParameterDeclaration(undefined, undefined, param.name, undefined, param.type ?? undefined);
|
|
18267
18000
|
}
|
|
18268
|
-
createIdentifier =
|
|
18001
|
+
createIdentifier = ts6.factory.createIdentifier;
|
|
18269
18002
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
18270
|
-
return
|
|
18003
|
+
return ts6.factory.createIfStatement(condition, thenStatement, elseStatement ?? undefined);
|
|
18271
18004
|
}
|
|
18272
18005
|
createLiteral(value) {
|
|
18273
18006
|
if (value === undefined) {
|
|
18274
|
-
return
|
|
18007
|
+
return ts6.factory.createIdentifier("undefined");
|
|
18275
18008
|
} else if (value === null) {
|
|
18276
|
-
return
|
|
18009
|
+
return ts6.factory.createNull();
|
|
18277
18010
|
} else if (typeof value === "boolean") {
|
|
18278
|
-
return value ?
|
|
18011
|
+
return value ? ts6.factory.createTrue() : ts6.factory.createFalse();
|
|
18279
18012
|
} else if (typeof value === "number") {
|
|
18280
18013
|
return tsNumericExpression(value);
|
|
18281
18014
|
} else {
|
|
18282
|
-
return
|
|
18015
|
+
return ts6.factory.createStringLiteral(value);
|
|
18283
18016
|
}
|
|
18284
18017
|
}
|
|
18285
18018
|
createNewExpression(expression, args) {
|
|
18286
|
-
return
|
|
18019
|
+
return ts6.factory.createNewExpression(expression, undefined, args);
|
|
18287
18020
|
}
|
|
18288
18021
|
createObjectLiteral(properties) {
|
|
18289
|
-
return
|
|
18022
|
+
return ts6.factory.createObjectLiteralExpression(properties.map((prop) => {
|
|
18290
18023
|
if (prop.kind === "spread") {
|
|
18291
|
-
return
|
|
18024
|
+
return ts6.factory.createSpreadAssignment(prop.expression);
|
|
18292
18025
|
}
|
|
18293
|
-
return
|
|
18026
|
+
return ts6.factory.createPropertyAssignment(prop.quoted ? ts6.factory.createStringLiteral(prop.propertyName) : ts6.factory.createIdentifier(prop.propertyName), prop.value);
|
|
18294
18027
|
}));
|
|
18295
18028
|
}
|
|
18296
|
-
createParenthesizedExpression =
|
|
18297
|
-
createPropertyAccess =
|
|
18298
|
-
createSpreadElement =
|
|
18029
|
+
createParenthesizedExpression = ts6.factory.createParenthesizedExpression;
|
|
18030
|
+
createPropertyAccess = ts6.factory.createPropertyAccessExpression;
|
|
18031
|
+
createSpreadElement = ts6.factory.createSpreadElement;
|
|
18299
18032
|
createReturnStatement(expression) {
|
|
18300
|
-
return
|
|
18033
|
+
return ts6.factory.createReturnStatement(expression ?? undefined);
|
|
18301
18034
|
}
|
|
18302
18035
|
createTaggedTemplate(tag, template) {
|
|
18303
|
-
return
|
|
18036
|
+
return ts6.factory.createTaggedTemplateExpression(tag, undefined, this.createTemplateLiteral(template));
|
|
18304
18037
|
}
|
|
18305
18038
|
createTemplateLiteral(template) {
|
|
18306
18039
|
let templateLiteral;
|
|
18307
18040
|
const length = template.elements.length;
|
|
18308
18041
|
const head = template.elements[0];
|
|
18309
18042
|
if (length === 1) {
|
|
18310
|
-
templateLiteral =
|
|
18043
|
+
templateLiteral = ts6.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
18311
18044
|
} else {
|
|
18312
18045
|
const spans = [];
|
|
18313
18046
|
for (let i = 1;i < length - 1; i++) {
|
|
@@ -18316,7 +18049,7 @@ class TypeScriptAstFactory {
|
|
|
18316
18049
|
if (range !== null) {
|
|
18317
18050
|
this.setSourceMapRange(middle, range);
|
|
18318
18051
|
}
|
|
18319
|
-
spans.push(
|
|
18052
|
+
spans.push(ts6.factory.createTemplateSpan(template.expressions[i - 1], middle));
|
|
18320
18053
|
}
|
|
18321
18054
|
const resolvedExpression = template.expressions[length - 2];
|
|
18322
18055
|
const templatePart = template.elements[length - 1];
|
|
@@ -18324,27 +18057,27 @@ class TypeScriptAstFactory {
|
|
|
18324
18057
|
if (templatePart.range !== null) {
|
|
18325
18058
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
18326
18059
|
}
|
|
18327
|
-
spans.push(
|
|
18328
|
-
templateLiteral =
|
|
18060
|
+
spans.push(ts6.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
18061
|
+
templateLiteral = ts6.factory.createTemplateExpression(ts6.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
18329
18062
|
}
|
|
18330
18063
|
if (head.range !== null) {
|
|
18331
18064
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
18332
18065
|
}
|
|
18333
18066
|
return templateLiteral;
|
|
18334
18067
|
}
|
|
18335
|
-
createThrowStatement =
|
|
18336
|
-
createTypeOfExpression =
|
|
18337
|
-
createVoidExpression =
|
|
18068
|
+
createThrowStatement = ts6.factory.createThrowStatement;
|
|
18069
|
+
createTypeOfExpression = ts6.factory.createTypeOfExpression;
|
|
18070
|
+
createVoidExpression = ts6.factory.createVoidExpression;
|
|
18338
18071
|
createUnaryExpression(operator, operand) {
|
|
18339
|
-
return
|
|
18072
|
+
return ts6.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
18340
18073
|
}
|
|
18341
18074
|
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
18342
|
-
return
|
|
18343
|
-
|
|
18075
|
+
return ts6.factory.createVariableStatement(undefined, ts6.factory.createVariableDeclarationList([
|
|
18076
|
+
ts6.factory.createVariableDeclaration(variableName, undefined, type ?? undefined, initializer ?? undefined)
|
|
18344
18077
|
], this.VAR_TYPES[variableType]));
|
|
18345
18078
|
}
|
|
18346
18079
|
createRegularExpressionLiteral(body, flags) {
|
|
18347
|
-
return
|
|
18080
|
+
return ts6.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
18348
18081
|
}
|
|
18349
18082
|
setSourceMapRange(node, sourceMapRange) {
|
|
18350
18083
|
if (sourceMapRange === null) {
|
|
@@ -18352,10 +18085,10 @@ class TypeScriptAstFactory {
|
|
|
18352
18085
|
}
|
|
18353
18086
|
const url = sourceMapRange.url;
|
|
18354
18087
|
if (!this.externalSourceFiles.has(url)) {
|
|
18355
|
-
this.externalSourceFiles.set(url,
|
|
18088
|
+
this.externalSourceFiles.set(url, ts6.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
18356
18089
|
}
|
|
18357
18090
|
const source = this.externalSourceFiles.get(url);
|
|
18358
|
-
|
|
18091
|
+
ts6.setSourceMapRange(node, {
|
|
18359
18092
|
pos: sourceMapRange.start.offset,
|
|
18360
18093
|
end: sourceMapRange.end.offset,
|
|
18361
18094
|
source
|
|
@@ -18365,77 +18098,77 @@ class TypeScriptAstFactory {
|
|
|
18365
18098
|
createBuiltInType(type) {
|
|
18366
18099
|
switch (type) {
|
|
18367
18100
|
case "any":
|
|
18368
|
-
return
|
|
18101
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.AnyKeyword);
|
|
18369
18102
|
case "boolean":
|
|
18370
|
-
return
|
|
18103
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.BooleanKeyword);
|
|
18371
18104
|
case "number":
|
|
18372
|
-
return
|
|
18105
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.NumberKeyword);
|
|
18373
18106
|
case "string":
|
|
18374
|
-
return
|
|
18107
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.StringKeyword);
|
|
18375
18108
|
case "function":
|
|
18376
|
-
return
|
|
18109
|
+
return ts6.factory.createTypeReferenceNode(ts6.factory.createIdentifier("Function"));
|
|
18377
18110
|
case "never":
|
|
18378
|
-
return
|
|
18111
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.NeverKeyword);
|
|
18379
18112
|
case "unknown":
|
|
18380
|
-
return
|
|
18113
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.UnknownKeyword);
|
|
18381
18114
|
}
|
|
18382
18115
|
}
|
|
18383
18116
|
createExpressionType(expression, typeParams) {
|
|
18384
18117
|
const typeName = getEntityTypeFromExpression(expression);
|
|
18385
|
-
return
|
|
18118
|
+
return ts6.factory.createTypeReferenceNode(typeName, typeParams ?? undefined);
|
|
18386
18119
|
}
|
|
18387
18120
|
createArrayType(elementType) {
|
|
18388
|
-
return
|
|
18121
|
+
return ts6.factory.createArrayTypeNode(elementType);
|
|
18389
18122
|
}
|
|
18390
18123
|
createMapType(valueType) {
|
|
18391
|
-
return
|
|
18392
|
-
|
|
18393
|
-
|
|
18124
|
+
return ts6.factory.createTypeLiteralNode([
|
|
18125
|
+
ts6.factory.createIndexSignature(undefined, [
|
|
18126
|
+
ts6.factory.createParameterDeclaration(undefined, undefined, "key", undefined, ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.StringKeyword))
|
|
18394
18127
|
], valueType)
|
|
18395
18128
|
]);
|
|
18396
18129
|
}
|
|
18397
18130
|
transplantType(type) {
|
|
18398
|
-
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" &&
|
|
18131
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && ts6.isTypeNode(type)) {
|
|
18399
18132
|
return type;
|
|
18400
18133
|
}
|
|
18401
18134
|
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
18402
18135
|
}
|
|
18403
18136
|
}
|
|
18404
18137
|
function createTemplateMiddle(cooked, raw) {
|
|
18405
|
-
const node =
|
|
18406
|
-
node.kind =
|
|
18138
|
+
const node = ts6.factory.createTemplateHead(cooked, raw);
|
|
18139
|
+
node.kind = ts6.SyntaxKind.TemplateMiddle;
|
|
18407
18140
|
return node;
|
|
18408
18141
|
}
|
|
18409
18142
|
function createTemplateTail(cooked, raw) {
|
|
18410
|
-
const node =
|
|
18411
|
-
node.kind =
|
|
18143
|
+
const node = ts6.factory.createTemplateHead(cooked, raw);
|
|
18144
|
+
node.kind = ts6.SyntaxKind.TemplateTail;
|
|
18412
18145
|
return node;
|
|
18413
18146
|
}
|
|
18414
18147
|
function attachComments(statement, leadingComments) {
|
|
18415
18148
|
for (const comment of leadingComments) {
|
|
18416
|
-
const commentKind = comment.multiline ?
|
|
18149
|
+
const commentKind = comment.multiline ? ts6.SyntaxKind.MultiLineCommentTrivia : ts6.SyntaxKind.SingleLineCommentTrivia;
|
|
18417
18150
|
if (comment.multiline) {
|
|
18418
|
-
|
|
18151
|
+
ts6.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
18419
18152
|
} else {
|
|
18420
18153
|
for (const line of comment.toString().split(`
|
|
18421
18154
|
`)) {
|
|
18422
|
-
|
|
18155
|
+
ts6.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
18423
18156
|
}
|
|
18424
18157
|
}
|
|
18425
18158
|
}
|
|
18426
18159
|
}
|
|
18427
18160
|
function getEntityTypeFromExpression(expression) {
|
|
18428
|
-
if (
|
|
18161
|
+
if (ts6.isIdentifier(expression)) {
|
|
18429
18162
|
return expression;
|
|
18430
18163
|
}
|
|
18431
|
-
if (
|
|
18164
|
+
if (ts6.isPropertyAccessExpression(expression)) {
|
|
18432
18165
|
const left = getEntityTypeFromExpression(expression.expression);
|
|
18433
|
-
if (!
|
|
18166
|
+
if (!ts6.isIdentifier(expression.name)) {
|
|
18434
18167
|
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
18435
18168
|
}
|
|
18436
|
-
return
|
|
18169
|
+
return ts6.factory.createQualifiedName(left, expression.name);
|
|
18437
18170
|
}
|
|
18438
|
-
throw new Error(`Unsupported expression for type reference: ${
|
|
18171
|
+
throw new Error(`Unsupported expression for type reference: ${ts6.SyntaxKind[expression.kind]}`);
|
|
18439
18172
|
}
|
|
18440
18173
|
var init_typescript_ast_factory = __esm(() => {
|
|
18441
18174
|
init_ts_util();
|
|
@@ -18451,31 +18184,73 @@ var init_typescript_translator = __esm(() => {
|
|
|
18451
18184
|
});
|
|
18452
18185
|
|
|
18453
18186
|
// src/dev/angular/fastHmrCompiler.ts
|
|
18454
|
-
|
|
18187
|
+
var exports_fastHmrCompiler = {};
|
|
18188
|
+
__export(exports_fastHmrCompiler, {
|
|
18189
|
+
tryFastHmr: () => tryFastHmr,
|
|
18190
|
+
recordFingerprint: () => recordFingerprint,
|
|
18191
|
+
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
18192
|
+
});
|
|
18193
|
+
import { existsSync as existsSync25, readFileSync as readFileSync19 } from "fs";
|
|
18455
18194
|
import { dirname as dirname18, relative as relative13, resolve as resolve31 } from "path";
|
|
18456
|
-
import
|
|
18457
|
-
var fail = (reason, detail) => ({ ok: false, reason, detail }),
|
|
18195
|
+
import ts7 from "typescript";
|
|
18196
|
+
var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache, fingerprintsEqual = (a, b2) => {
|
|
18197
|
+
if (a.className !== b2.className)
|
|
18198
|
+
return false;
|
|
18199
|
+
if (a.selector !== b2.selector)
|
|
18200
|
+
return false;
|
|
18201
|
+
if (a.standalone !== b2.standalone)
|
|
18202
|
+
return false;
|
|
18203
|
+
if (a.importsArity !== b2.importsArity)
|
|
18204
|
+
return false;
|
|
18205
|
+
if (a.hasProviders !== b2.hasProviders)
|
|
18206
|
+
return false;
|
|
18207
|
+
if (a.hasViewProviders !== b2.hasViewProviders)
|
|
18208
|
+
return false;
|
|
18209
|
+
if (a.ctorParamTypes.length !== b2.ctorParamTypes.length)
|
|
18210
|
+
return false;
|
|
18211
|
+
for (let i = 0;i < a.ctorParamTypes.length; i++) {
|
|
18212
|
+
if (a.ctorParamTypes[i] !== b2.ctorParamTypes[i])
|
|
18213
|
+
return false;
|
|
18214
|
+
}
|
|
18215
|
+
if (a.inputs.length !== b2.inputs.length)
|
|
18216
|
+
return false;
|
|
18217
|
+
for (let i = 0;i < a.inputs.length; i++) {
|
|
18218
|
+
if (a.inputs[i] !== b2.inputs[i])
|
|
18219
|
+
return false;
|
|
18220
|
+
}
|
|
18221
|
+
if (a.outputs.length !== b2.outputs.length)
|
|
18222
|
+
return false;
|
|
18223
|
+
for (let i = 0;i < a.outputs.length; i++) {
|
|
18224
|
+
if (a.outputs[i] !== b2.outputs[i])
|
|
18225
|
+
return false;
|
|
18226
|
+
}
|
|
18227
|
+
return true;
|
|
18228
|
+
}, recordFingerprint = (id, fp) => {
|
|
18229
|
+
fingerprintCache.set(id, fp);
|
|
18230
|
+
}, invalidateFingerprintCache = () => {
|
|
18231
|
+
fingerprintCache.clear();
|
|
18232
|
+
}, findClassDeclaration = (sourceFile, className) => {
|
|
18458
18233
|
let found = null;
|
|
18459
18234
|
const walk = (node) => {
|
|
18460
18235
|
if (found)
|
|
18461
18236
|
return;
|
|
18462
|
-
if (
|
|
18237
|
+
if (ts7.isClassDeclaration(node) && node.name?.text === className) {
|
|
18463
18238
|
found = node;
|
|
18464
18239
|
return;
|
|
18465
18240
|
}
|
|
18466
|
-
|
|
18241
|
+
ts7.forEachChild(node, walk);
|
|
18467
18242
|
};
|
|
18468
18243
|
walk(sourceFile);
|
|
18469
18244
|
return found;
|
|
18470
18245
|
}, getClassDecorators = (cls) => {
|
|
18471
|
-
const modifiers =
|
|
18246
|
+
const modifiers = ts7.getDecorators(cls) ?? [];
|
|
18472
18247
|
return [...modifiers];
|
|
18473
18248
|
}, findComponentDecorator = (cls) => {
|
|
18474
18249
|
for (const decorator of getClassDecorators(cls)) {
|
|
18475
18250
|
const expr = decorator.expression;
|
|
18476
|
-
if (
|
|
18251
|
+
if (ts7.isCallExpression(expr)) {
|
|
18477
18252
|
const fn2 = expr.expression;
|
|
18478
|
-
if (
|
|
18253
|
+
if (ts7.isIdentifier(fn2) && fn2.text === "Component") {
|
|
18479
18254
|
return decorator;
|
|
18480
18255
|
}
|
|
18481
18256
|
}
|
|
@@ -18483,15 +18258,15 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18483
18258
|
return null;
|
|
18484
18259
|
}, getDecoratorArgsObject = (decorator) => {
|
|
18485
18260
|
const call = decorator.expression;
|
|
18486
|
-
if (!
|
|
18261
|
+
if (!ts7.isCallExpression(call))
|
|
18487
18262
|
return null;
|
|
18488
18263
|
const arg = call.arguments[0];
|
|
18489
|
-
if (!arg || !
|
|
18264
|
+
if (!arg || !ts7.isObjectLiteralExpression(arg))
|
|
18490
18265
|
return null;
|
|
18491
18266
|
return arg;
|
|
18492
18267
|
}, getProperty = (obj, name) => {
|
|
18493
18268
|
for (const prop of obj.properties) {
|
|
18494
|
-
if (
|
|
18269
|
+
if (ts7.isPropertyAssignment(prop) && (ts7.isIdentifier(prop.name) && prop.name.text === name || ts7.isStringLiteral(prop.name) && prop.name.text === name)) {
|
|
18495
18270
|
return prop.initializer;
|
|
18496
18271
|
}
|
|
18497
18272
|
}
|
|
@@ -18500,7 +18275,7 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18500
18275
|
const expr = getProperty(obj, name);
|
|
18501
18276
|
if (!expr)
|
|
18502
18277
|
return null;
|
|
18503
|
-
if (
|
|
18278
|
+
if (ts7.isStringLiteral(expr) || ts7.isNoSubstitutionTemplateLiteral(expr)) {
|
|
18504
18279
|
return expr.text;
|
|
18505
18280
|
}
|
|
18506
18281
|
return null;
|
|
@@ -18508,15 +18283,15 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18508
18283
|
const expr = getProperty(obj, name);
|
|
18509
18284
|
if (!expr)
|
|
18510
18285
|
return null;
|
|
18511
|
-
if (expr.kind ===
|
|
18286
|
+
if (expr.kind === ts7.SyntaxKind.TrueKeyword)
|
|
18512
18287
|
return true;
|
|
18513
|
-
if (expr.kind ===
|
|
18288
|
+
if (expr.kind === ts7.SyntaxKind.FalseKeyword)
|
|
18514
18289
|
return false;
|
|
18515
18290
|
return null;
|
|
18516
18291
|
}, inheritsDecoratedClass = (cls) => {
|
|
18517
18292
|
const heritage = cls.heritageClauses ?? [];
|
|
18518
18293
|
for (const clause of heritage) {
|
|
18519
|
-
if (clause.token !==
|
|
18294
|
+
if (clause.token !== ts7.SyntaxKind.ExtendsKeyword)
|
|
18520
18295
|
continue;
|
|
18521
18296
|
if (clause.types.length > 0)
|
|
18522
18297
|
return true;
|
|
@@ -18527,52 +18302,54 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18527
18302
|
const stylesExpr = getProperty(args, "styles");
|
|
18528
18303
|
const importsExpr = getProperty(args, "imports");
|
|
18529
18304
|
const styleUrls = [];
|
|
18530
|
-
if (styleUrlsExpr &&
|
|
18305
|
+
if (styleUrlsExpr && ts7.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
18531
18306
|
for (const el of styleUrlsExpr.elements) {
|
|
18532
|
-
if (
|
|
18307
|
+
if (ts7.isStringLiteral(el))
|
|
18533
18308
|
styleUrls.push(el.text);
|
|
18534
18309
|
}
|
|
18535
18310
|
}
|
|
18536
18311
|
const styles = [];
|
|
18537
18312
|
if (stylesExpr) {
|
|
18538
|
-
if (
|
|
18313
|
+
if (ts7.isArrayLiteralExpression(stylesExpr)) {
|
|
18539
18314
|
for (const el of stylesExpr.elements) {
|
|
18540
|
-
if (
|
|
18315
|
+
if (ts7.isStringLiteral(el) || ts7.isNoSubstitutionTemplateLiteral(el)) {
|
|
18541
18316
|
styles.push(el.text);
|
|
18542
18317
|
}
|
|
18543
18318
|
}
|
|
18544
|
-
} else if (
|
|
18319
|
+
} else if (ts7.isStringLiteral(stylesExpr) || ts7.isNoSubstitutionTemplateLiteral(stylesExpr)) {
|
|
18545
18320
|
styles.push(stylesExpr.text);
|
|
18546
18321
|
}
|
|
18547
18322
|
}
|
|
18548
18323
|
return {
|
|
18324
|
+
hasProviders: getProperty(args, "providers") !== null,
|
|
18325
|
+
hasViewProviders: getProperty(args, "viewProviders") !== null,
|
|
18326
|
+
importsExpr: importsExpr && ts7.isArrayLiteralExpression(importsExpr) ? importsExpr : null,
|
|
18327
|
+
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? false,
|
|
18549
18328
|
selector: getStringProperty(args, "selector"),
|
|
18550
|
-
|
|
18551
|
-
template: getStringProperty(args, "template"),
|
|
18329
|
+
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
18552
18330
|
styleUrl: getStringProperty(args, "styleUrl"),
|
|
18553
18331
|
styleUrls,
|
|
18554
18332
|
styles,
|
|
18555
|
-
|
|
18556
|
-
|
|
18557
|
-
importsExpr: importsExpr && ts8.isArrayLiteralExpression(importsExpr) ? importsExpr : null
|
|
18333
|
+
template: getStringProperty(args, "template"),
|
|
18334
|
+
templateUrl: getStringProperty(args, "templateUrl")
|
|
18558
18335
|
};
|
|
18559
18336
|
}, extractDecoratorInput = (prop) => {
|
|
18560
|
-
const decorators =
|
|
18337
|
+
const decorators = ts7.getDecorators(prop) ?? [];
|
|
18561
18338
|
for (const decorator of decorators) {
|
|
18562
18339
|
const expr = decorator.expression;
|
|
18563
|
-
if (!
|
|
18340
|
+
if (!ts7.isCallExpression(expr))
|
|
18564
18341
|
continue;
|
|
18565
18342
|
const fn2 = expr.expression;
|
|
18566
|
-
if (!
|
|
18343
|
+
if (!ts7.isIdentifier(fn2) || fn2.text !== "Input")
|
|
18567
18344
|
continue;
|
|
18568
18345
|
const classPropertyName = prop.name.getText();
|
|
18569
18346
|
let bindingPropertyName = classPropertyName;
|
|
18570
18347
|
let required = false;
|
|
18571
18348
|
const arg = expr.arguments[0];
|
|
18572
18349
|
if (arg) {
|
|
18573
|
-
if (
|
|
18350
|
+
if (ts7.isStringLiteral(arg)) {
|
|
18574
18351
|
bindingPropertyName = arg.text;
|
|
18575
|
-
} else if (
|
|
18352
|
+
} else if (ts7.isObjectLiteralExpression(arg)) {
|
|
18576
18353
|
const aliasNode = getStringProperty(arg, "alias");
|
|
18577
18354
|
if (aliasNode !== null)
|
|
18578
18355
|
bindingPropertyName = aliasNode;
|
|
@@ -18592,11 +18369,11 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18592
18369
|
}
|
|
18593
18370
|
return null;
|
|
18594
18371
|
}, isInputSignalCall = (init) => {
|
|
18595
|
-
if (
|
|
18372
|
+
if (ts7.isCallExpression(init)) {
|
|
18596
18373
|
const fn2 = init.expression;
|
|
18597
|
-
if (
|
|
18374
|
+
if (ts7.isIdentifier(fn2) && fn2.text === "input")
|
|
18598
18375
|
return true;
|
|
18599
|
-
if (
|
|
18376
|
+
if (ts7.isPropertyAccessExpression(fn2) && ts7.isIdentifier(fn2.expression) && fn2.expression.text === "input") {
|
|
18600
18377
|
return true;
|
|
18601
18378
|
}
|
|
18602
18379
|
}
|
|
@@ -18607,12 +18384,12 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18607
18384
|
const classPropertyName = prop.name.getText();
|
|
18608
18385
|
const call = prop.initializer;
|
|
18609
18386
|
let required = false;
|
|
18610
|
-
if (
|
|
18387
|
+
if (ts7.isPropertyAccessExpression(call.expression) && ts7.isIdentifier(call.expression.name) && call.expression.name.text === "required") {
|
|
18611
18388
|
required = true;
|
|
18612
18389
|
}
|
|
18613
18390
|
let bindingPropertyName = classPropertyName;
|
|
18614
18391
|
const optsArg = call.arguments[required ? 0 : 1];
|
|
18615
|
-
if (optsArg &&
|
|
18392
|
+
if (optsArg && ts7.isObjectLiteralExpression(optsArg)) {
|
|
18616
18393
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
18617
18394
|
if (aliasNode !== null)
|
|
18618
18395
|
bindingPropertyName = aliasNode;
|
|
@@ -18628,28 +18405,28 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18628
18405
|
}
|
|
18629
18406
|
};
|
|
18630
18407
|
}, extractDecoratorOutput = (prop) => {
|
|
18631
|
-
const decorators =
|
|
18408
|
+
const decorators = ts7.getDecorators(prop) ?? [];
|
|
18632
18409
|
for (const decorator of decorators) {
|
|
18633
18410
|
const expr = decorator.expression;
|
|
18634
|
-
if (!
|
|
18411
|
+
if (!ts7.isCallExpression(expr))
|
|
18635
18412
|
continue;
|
|
18636
18413
|
const fn2 = expr.expression;
|
|
18637
|
-
if (!
|
|
18414
|
+
if (!ts7.isIdentifier(fn2) || fn2.text !== "Output")
|
|
18638
18415
|
continue;
|
|
18639
18416
|
const classPropertyName = prop.name.getText();
|
|
18640
18417
|
let bindingName = classPropertyName;
|
|
18641
18418
|
const arg = expr.arguments[0];
|
|
18642
|
-
if (arg &&
|
|
18419
|
+
if (arg && ts7.isStringLiteral(arg))
|
|
18643
18420
|
bindingName = arg.text;
|
|
18644
18421
|
return { classPropertyName, bindingName };
|
|
18645
18422
|
}
|
|
18646
18423
|
return null;
|
|
18647
18424
|
}, isOutputSignalCall = (init) => {
|
|
18648
|
-
if (
|
|
18425
|
+
if (ts7.isCallExpression(init)) {
|
|
18649
18426
|
const fn2 = init.expression;
|
|
18650
|
-
if (
|
|
18427
|
+
if (ts7.isIdentifier(fn2) && fn2.text === "output")
|
|
18651
18428
|
return true;
|
|
18652
|
-
if (
|
|
18429
|
+
if (ts7.isPropertyAccessExpression(fn2) && ts7.isIdentifier(fn2.expression) && fn2.expression.text === "output") {
|
|
18653
18430
|
return true;
|
|
18654
18431
|
}
|
|
18655
18432
|
}
|
|
@@ -18661,7 +18438,7 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18661
18438
|
const call = prop.initializer;
|
|
18662
18439
|
let bindingName = classPropertyName;
|
|
18663
18440
|
const optsArg = call.arguments[0];
|
|
18664
|
-
if (optsArg &&
|
|
18441
|
+
if (optsArg && ts7.isObjectLiteralExpression(optsArg)) {
|
|
18665
18442
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
18666
18443
|
if (aliasNode !== null)
|
|
18667
18444
|
bindingName = aliasNode;
|
|
@@ -18671,7 +18448,7 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18671
18448
|
const inputs = {};
|
|
18672
18449
|
const outputs = {};
|
|
18673
18450
|
for (const member of cls.members) {
|
|
18674
|
-
if (!
|
|
18451
|
+
if (!ts7.isPropertyDeclaration(member))
|
|
18675
18452
|
continue;
|
|
18676
18453
|
const decoratorIn = extractDecoratorInput(member);
|
|
18677
18454
|
if (decoratorIn) {
|
|
@@ -18694,11 +18471,78 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18694
18471
|
}
|
|
18695
18472
|
}
|
|
18696
18473
|
return { inputs, outputs };
|
|
18474
|
+
}, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs) => {
|
|
18475
|
+
const ctorParamTypes = [];
|
|
18476
|
+
for (const member of cls.members) {
|
|
18477
|
+
if (!ts7.isConstructorDeclaration(member))
|
|
18478
|
+
continue;
|
|
18479
|
+
for (const param of member.parameters) {
|
|
18480
|
+
ctorParamTypes.push(param.type ? param.type.getText() : "");
|
|
18481
|
+
}
|
|
18482
|
+
break;
|
|
18483
|
+
}
|
|
18484
|
+
const inputNames = Object.keys(inputs).sort();
|
|
18485
|
+
const outputNames = Object.keys(outputs).sort();
|
|
18486
|
+
const importsArity = decoratorMeta.importsExpr ? decoratorMeta.importsExpr.elements.length : 0;
|
|
18487
|
+
const hasProviders = decoratorMeta.hasProviders;
|
|
18488
|
+
const hasViewProviders = decoratorMeta.hasViewProviders;
|
|
18489
|
+
return {
|
|
18490
|
+
className,
|
|
18491
|
+
ctorParamTypes,
|
|
18492
|
+
hasProviders,
|
|
18493
|
+
hasViewProviders,
|
|
18494
|
+
importsArity,
|
|
18495
|
+
inputs: inputNames,
|
|
18496
|
+
outputs: outputNames,
|
|
18497
|
+
selector: decoratorMeta.selector,
|
|
18498
|
+
standalone: decoratorMeta.standalone
|
|
18499
|
+
};
|
|
18500
|
+
}, buildFreshClassMethodsBlock = (classNode, className) => {
|
|
18501
|
+
const methodSources = [];
|
|
18502
|
+
for (const member of classNode.members) {
|
|
18503
|
+
if (ts7.isMethodDeclaration(member) || ts7.isGetAccessorDeclaration(member) || ts7.isSetAccessorDeclaration(member)) {
|
|
18504
|
+
const modifiers = ts7.getModifiers(member) ?? [];
|
|
18505
|
+
const isStatic = modifiers.some((m) => m.kind === ts7.SyntaxKind.StaticKeyword);
|
|
18506
|
+
if (isStatic)
|
|
18507
|
+
continue;
|
|
18508
|
+
methodSources.push(member.getText());
|
|
18509
|
+
}
|
|
18510
|
+
}
|
|
18511
|
+
if (methodSources.length === 0)
|
|
18512
|
+
return null;
|
|
18513
|
+
const wrappedSource = `class _Fresh {
|
|
18514
|
+
${methodSources.join(`
|
|
18515
|
+
`)}
|
|
18516
|
+
}`;
|
|
18517
|
+
let transpiled;
|
|
18518
|
+
try {
|
|
18519
|
+
transpiled = ts7.transpileModule(wrappedSource, {
|
|
18520
|
+
compilerOptions: {
|
|
18521
|
+
module: ts7.ModuleKind.ES2022,
|
|
18522
|
+
target: ts7.ScriptTarget.ES2022
|
|
18523
|
+
},
|
|
18524
|
+
reportDiagnostics: false
|
|
18525
|
+
}).outputText;
|
|
18526
|
+
} catch {
|
|
18527
|
+
return null;
|
|
18528
|
+
}
|
|
18529
|
+
return `// SURGICAL_HMR \u2014 patch prototype methods so existing instances
|
|
18530
|
+
// pick up new method bodies (\`compileComponentFromMetadata\` only
|
|
18531
|
+
// updates \`\u0275cmp\`, never the prototype).
|
|
18532
|
+
${transpiled}
|
|
18533
|
+
{
|
|
18534
|
+
const __fresh_proto = _Fresh.prototype;
|
|
18535
|
+
for (const __name of Object.getOwnPropertyNames(__fresh_proto)) {
|
|
18536
|
+
if (__name === 'constructor') continue;
|
|
18537
|
+
const __desc = Object.getOwnPropertyDescriptor(__fresh_proto, __name);
|
|
18538
|
+
if (__desc) Object.defineProperty(${className}.prototype, __name, __desc);
|
|
18539
|
+
}
|
|
18540
|
+
}`;
|
|
18697
18541
|
}, resolveAndReadResource = (componentDir, url) => {
|
|
18698
18542
|
const abs = resolve31(componentDir, url);
|
|
18699
18543
|
if (!existsSync25(abs))
|
|
18700
18544
|
return null;
|
|
18701
|
-
return
|
|
18545
|
+
return readFileSync19(abs, "utf8");
|
|
18702
18546
|
}, collectStyles = (decoratorMeta, componentDir) => {
|
|
18703
18547
|
const styles = [...decoratorMeta.styles];
|
|
18704
18548
|
const urls = [];
|
|
@@ -18724,8 +18568,8 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18724
18568
|
} catch (err) {
|
|
18725
18569
|
return fail("unexpected-error", `import @angular/compiler: ${err}`);
|
|
18726
18570
|
}
|
|
18727
|
-
const tsSource =
|
|
18728
|
-
const sourceFile =
|
|
18571
|
+
const tsSource = readFileSync19(componentFilePath, "utf8");
|
|
18572
|
+
const sourceFile = ts7.createSourceFile(componentFilePath, tsSource, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
18729
18573
|
const classNode = findClassDeclaration(sourceFile, className);
|
|
18730
18574
|
if (!classNode) {
|
|
18731
18575
|
return fail("class-not-found", `${className} in ${componentFilePath}`);
|
|
@@ -18753,7 +18597,7 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18753
18597
|
if (!existsSync25(tplAbs)) {
|
|
18754
18598
|
return fail("template-resource-not-found", tplAbs);
|
|
18755
18599
|
}
|
|
18756
|
-
templateText =
|
|
18600
|
+
templateText = readFileSync19(tplAbs, "utf8");
|
|
18757
18601
|
templatePath = tplAbs;
|
|
18758
18602
|
} else {
|
|
18759
18603
|
return fail("unsupported-decorator-args", "missing template/templateUrl");
|
|
@@ -18780,6 +18624,12 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18780
18624
|
const wrappedClass = new compiler.WrappedNodeExpr(className_);
|
|
18781
18625
|
const { inputs, outputs } = extractInputsAndOutputs(classNode);
|
|
18782
18626
|
const projectRelPath = relative13(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
18627
|
+
const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
18628
|
+
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs);
|
|
18629
|
+
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
18630
|
+
if (cachedFingerprint && !fingerprintsEqual(cachedFingerprint, currentFingerprint)) {
|
|
18631
|
+
return fail("structural-change", `fingerprint changed for ${className}; escalate to Tier 1`);
|
|
18632
|
+
}
|
|
18783
18633
|
const sourceFileObj = new compiler.ParseSourceFile(tsSource, componentFilePath);
|
|
18784
18634
|
const zeroLoc = new compiler.ParseLocation(sourceFileObj, 0, 0, 0);
|
|
18785
18635
|
const typeSourceSpan = new compiler.ParseSourceSpan(zeroLoc, zeroLoc);
|
|
@@ -18868,23 +18718,36 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18868
18718
|
}
|
|
18869
18719
|
const importGenerator = createHmrImportGenerator(namespaceMap);
|
|
18870
18720
|
const tsFunctionDecl = translateStatement(sourceFile, callback, importGenerator);
|
|
18871
|
-
const exportedDecl =
|
|
18872
|
-
|
|
18873
|
-
|
|
18721
|
+
const exportedDecl = ts7.factory.updateFunctionDeclaration(tsFunctionDecl, [
|
|
18722
|
+
ts7.factory.createToken(ts7.SyntaxKind.ExportKeyword),
|
|
18723
|
+
ts7.factory.createToken(ts7.SyntaxKind.DefaultKeyword)
|
|
18874
18724
|
], tsFunctionDecl.asteriskToken, tsFunctionDecl.name, tsFunctionDecl.typeParameters, tsFunctionDecl.parameters, tsFunctionDecl.type, tsFunctionDecl.body);
|
|
18875
|
-
const printer =
|
|
18876
|
-
newLine:
|
|
18725
|
+
const printer = ts7.createPrinter({
|
|
18726
|
+
newLine: ts7.NewLineKind.LineFeed,
|
|
18877
18727
|
removeComments: false
|
|
18878
18728
|
});
|
|
18879
|
-
const tsSourceText = printer.printNode(
|
|
18880
|
-
const
|
|
18729
|
+
const tsSourceText = printer.printNode(ts7.EmitHint.Unspecified, exportedDecl, sourceFile);
|
|
18730
|
+
const transpiled = ts7.transpileModule(tsSourceText, {
|
|
18881
18731
|
compilerOptions: {
|
|
18882
|
-
module:
|
|
18883
|
-
target:
|
|
18732
|
+
module: ts7.ModuleKind.ES2022,
|
|
18733
|
+
target: ts7.ScriptTarget.ES2022
|
|
18884
18734
|
},
|
|
18885
18735
|
fileName: componentFilePath,
|
|
18886
18736
|
reportDiagnostics: false
|
|
18887
18737
|
}).outputText;
|
|
18738
|
+
const methodsBlock = buildFreshClassMethodsBlock(classNode, className);
|
|
18739
|
+
let moduleText = transpiled;
|
|
18740
|
+
if (methodsBlock) {
|
|
18741
|
+
const fnOpening = `function ${className}_UpdateMetadata(${className}, \u0275\u0275namespaces) {`;
|
|
18742
|
+
const idx = moduleText.indexOf(fnOpening);
|
|
18743
|
+
if (idx >= 0) {
|
|
18744
|
+
const insertAt = idx + fnOpening.length;
|
|
18745
|
+
moduleText = moduleText.slice(0, insertAt) + `
|
|
18746
|
+
` + methodsBlock + `
|
|
18747
|
+
` + moduleText.slice(insertAt);
|
|
18748
|
+
}
|
|
18749
|
+
}
|
|
18750
|
+
fingerprintCache.set(fingerprintId, currentFingerprint);
|
|
18888
18751
|
return { ok: true, moduleText, componentSource: sourceFile };
|
|
18889
18752
|
} catch (err) {
|
|
18890
18753
|
return fail("unexpected-error", String(err));
|
|
@@ -18893,6 +18756,7 @@ var fail = (reason, detail) => ({ ok: false, reason, detail }), findClassDeclara
|
|
|
18893
18756
|
var init_fastHmrCompiler = __esm(() => {
|
|
18894
18757
|
init_hmrImportGenerator();
|
|
18895
18758
|
init_typescript_translator();
|
|
18759
|
+
fingerprintCache = new Map;
|
|
18896
18760
|
});
|
|
18897
18761
|
|
|
18898
18762
|
// src/dev/angular/hmrCompiler.ts
|
|
@@ -18905,9 +18769,9 @@ __export(exports_hmrCompiler, {
|
|
|
18905
18769
|
compileAngularForHmr: () => compileAngularForHmr
|
|
18906
18770
|
});
|
|
18907
18771
|
import { existsSync as existsSync26 } from "fs";
|
|
18908
|
-
import { basename as
|
|
18772
|
+
import { basename as basename11, dirname as dirname19, join as join29, relative as relative14, resolve as resolve32 } from "path";
|
|
18909
18773
|
import { performance as performance2 } from "perf_hooks";
|
|
18910
|
-
import
|
|
18774
|
+
import ts8 from "typescript";
|
|
18911
18775
|
var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_PROGRAM__ ?? null, setCachedHmrProgram = (program) => {
|
|
18912
18776
|
globalCache.__ABSOLUTE_ANGULAR_HMR_PROGRAM__ = program;
|
|
18913
18777
|
}, resolveTypescriptLibDirCached = null, resolveTypescriptLibDir = () => {
|
|
@@ -18922,14 +18786,14 @@ var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_
|
|
|
18922
18786
|
emitDecoratorMetadata: true,
|
|
18923
18787
|
esModuleInterop: true,
|
|
18924
18788
|
experimentalDecorators: true,
|
|
18925
|
-
module:
|
|
18926
|
-
moduleResolution:
|
|
18927
|
-
newLine:
|
|
18789
|
+
module: ts8.ModuleKind.ESNext,
|
|
18790
|
+
moduleResolution: ts8.ModuleResolutionKind.Bundler,
|
|
18791
|
+
newLine: ts8.NewLineKind.LineFeed,
|
|
18928
18792
|
noEmit: false,
|
|
18929
18793
|
noLib: false,
|
|
18930
18794
|
rootDir: process.cwd(),
|
|
18931
18795
|
skipLibCheck: true,
|
|
18932
|
-
target:
|
|
18796
|
+
target: ts8.ScriptTarget.ES2022,
|
|
18933
18797
|
_enableHmr: true,
|
|
18934
18798
|
enableHmr: true
|
|
18935
18799
|
}), ANGULAR_COMPILER_OPTIONS_CACHE, loadAngularCompilerOptions = async () => {
|
|
@@ -18956,20 +18820,20 @@ var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_
|
|
|
18956
18820
|
const baseOptions = await loadAngularCompilerOptions();
|
|
18957
18821
|
const options = buildHmrCompilerOptions(baseOptions);
|
|
18958
18822
|
options.outDir = outDir;
|
|
18959
|
-
options.target =
|
|
18823
|
+
options.target = ts8.ScriptTarget.ES2022;
|
|
18960
18824
|
options.experimentalDecorators = true;
|
|
18961
18825
|
options.emitDecoratorMetadata = true;
|
|
18962
|
-
options.newLine =
|
|
18826
|
+
options.newLine = ts8.NewLineKind.LineFeed;
|
|
18963
18827
|
options.incremental = false;
|
|
18964
18828
|
options.tsBuildInfoFile = undefined;
|
|
18965
18829
|
const tsLibDir = resolveTypescriptLibDir();
|
|
18966
|
-
const host =
|
|
18830
|
+
const host = ts8.createCompilerHost(options);
|
|
18967
18831
|
const originalGetDefaultLibLocation = host.getDefaultLibLocation;
|
|
18968
18832
|
host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
|
|
18969
18833
|
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
18970
18834
|
host.getDefaultLibFileName = (opts) => {
|
|
18971
18835
|
const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
|
|
18972
|
-
return
|
|
18836
|
+
return basename11(fileName);
|
|
18973
18837
|
};
|
|
18974
18838
|
const originalGetSourceFile = host.getSourceFile;
|
|
18975
18839
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
@@ -19040,11 +18904,11 @@ var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_
|
|
|
19040
18904
|
const walk = (node) => {
|
|
19041
18905
|
if (found)
|
|
19042
18906
|
return;
|
|
19043
|
-
if (
|
|
18907
|
+
if (ts8.isClassDeclaration(node) && node.name?.text === className) {
|
|
19044
18908
|
found = node;
|
|
19045
18909
|
return;
|
|
19046
18910
|
}
|
|
19047
|
-
|
|
18911
|
+
ts8.forEachChild(node, walk);
|
|
19048
18912
|
};
|
|
19049
18913
|
walk(sourceFile);
|
|
19050
18914
|
return found;
|
|
@@ -19271,7 +19135,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
19271
19135
|
|
|
19272
19136
|
// src/dev/rebuildTrigger.ts
|
|
19273
19137
|
import { existsSync as existsSync27 } from "fs";
|
|
19274
|
-
import { basename as
|
|
19138
|
+
import { basename as basename12, dirname as dirname20, relative as relative15, resolve as resolve35 } from "path";
|
|
19275
19139
|
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) => {
|
|
19276
19140
|
if (!config.tailwind)
|
|
19277
19141
|
return;
|
|
@@ -19604,7 +19468,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19604
19468
|
const { commonAncestor: commonAncestor2 } = await Promise.resolve().then(() => (init_commonAncestor(), exports_commonAncestor));
|
|
19605
19469
|
return clientRoots.length === 1 ? clientRoots[0] ?? projectRoot : commonAncestor2(clientRoots, projectRoot);
|
|
19606
19470
|
}, updateServerManifestEntry = (state, artifact) => {
|
|
19607
|
-
const fileWithHash =
|
|
19471
|
+
const fileWithHash = basename12(artifact.path);
|
|
19608
19472
|
const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
|
|
19609
19473
|
if (!baseName) {
|
|
19610
19474
|
return;
|
|
@@ -19665,59 +19529,63 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19665
19529
|
const clientManifest = generateManifest2(clientResult.outputs, buildDir);
|
|
19666
19530
|
Object.assign(state.manifest, clientManifest);
|
|
19667
19531
|
await populateAssetStore(state.assetStore, clientManifest, buildDir);
|
|
19668
|
-
},
|
|
19669
|
-
if (!userEditedFiles || userEditedFiles.size === 0)
|
|
19670
|
-
return candidates;
|
|
19671
|
-
const filtered = candidates.filter((file4) => userEditedFiles.has(resolve35(file4)));
|
|
19672
|
-
return filtered.length > 0 ? filtered : candidates;
|
|
19673
|
-
}, broadcastAngularComponentUpdates = async (state, angularDir) => {
|
|
19532
|
+
}, decideAngularTier = async (state, angularDir) => {
|
|
19674
19533
|
const userEdited = state.lastUserEditedFiles ?? new Set;
|
|
19675
19534
|
if (userEdited.size === 0)
|
|
19676
|
-
return;
|
|
19535
|
+
return { queue: [], tier: 0 };
|
|
19677
19536
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
19678
19537
|
const { encodeHmrComponentId: encodeHmrComponentId2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
|
|
19679
|
-
const
|
|
19680
|
-
const
|
|
19538
|
+
const { tryFastHmr: tryFastHmr2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
19539
|
+
const queue = [];
|
|
19540
|
+
const queueIds = new Set;
|
|
19681
19541
|
for (const editedFile of userEdited) {
|
|
19682
19542
|
const owners = resolveOwningComponents2({
|
|
19683
19543
|
changedFilePath: editedFile,
|
|
19684
19544
|
userAngularRoot: angularDir
|
|
19685
19545
|
});
|
|
19546
|
+
if (owners.length === 0 && editedFile.endsWith(".component.ts")) {
|
|
19547
|
+
return {
|
|
19548
|
+
reason: `no @Component class found in ${editedFile}`,
|
|
19549
|
+
tier: 1
|
|
19550
|
+
};
|
|
19551
|
+
}
|
|
19686
19552
|
for (const { componentFilePath, className } of owners) {
|
|
19687
19553
|
const id = encodeHmrComponentId2(componentFilePath, className);
|
|
19688
|
-
if (
|
|
19554
|
+
if (queueIds.has(id))
|
|
19689
19555
|
continue;
|
|
19690
|
-
|
|
19691
|
-
|
|
19692
|
-
|
|
19693
|
-
|
|
19694
|
-
|
|
19695
|
-
|
|
19556
|
+
const result = await tryFastHmr2({ className, componentFilePath });
|
|
19557
|
+
if (!result.ok) {
|
|
19558
|
+
return {
|
|
19559
|
+
reason: `${className}: ${result.reason}${result.detail ? ` (${result.detail})` : ""}`,
|
|
19560
|
+
tier: 1
|
|
19561
|
+
};
|
|
19562
|
+
}
|
|
19563
|
+
queueIds.add(id);
|
|
19564
|
+
queue.push({ className, id });
|
|
19696
19565
|
}
|
|
19697
19566
|
}
|
|
19698
|
-
|
|
19699
|
-
|
|
19700
|
-
|
|
19701
|
-
|
|
19702
|
-
const pascalName = toPascal(baseName);
|
|
19703
|
-
const cssKey = `${pascalName}CSS`;
|
|
19704
|
-
const cssUrl = manifest[cssKey] || null;
|
|
19705
|
-
const duration = Date.now() - startTime;
|
|
19706
|
-
logHmrUpdate(angularPagePath, "angular", duration);
|
|
19567
|
+
return { queue, tier: 0 };
|
|
19568
|
+
}, broadcastSurgical = (state, queue) => {
|
|
19569
|
+
const timestamp = Date.now();
|
|
19570
|
+
for (const { id, className } of queue) {
|
|
19707
19571
|
broadcastToClients(state, {
|
|
19708
|
-
data: {
|
|
19709
|
-
|
|
19710
|
-
cssUrl,
|
|
19711
|
-
editSourceFile: classification.sourceFile,
|
|
19712
|
-
framework: "angular",
|
|
19713
|
-
manifest,
|
|
19714
|
-
reason: classification.reason,
|
|
19715
|
-
sourceFile: angularPagePath,
|
|
19716
|
-
updateType: classification.type
|
|
19717
|
-
},
|
|
19718
|
-
type: "angular-update"
|
|
19572
|
+
data: { id, timestamp },
|
|
19573
|
+
type: "angular:component-update"
|
|
19719
19574
|
});
|
|
19575
|
+
logInfo(`[ng-hmr broadcast] ${className}`);
|
|
19576
|
+
}
|
|
19577
|
+
}, broadcastRebootstrap = async (state, reason) => {
|
|
19578
|
+
logInfo(`[ng-hmr tier-1 rebootstrap] ${reason}`);
|
|
19579
|
+
broadcastToClients(state, {
|
|
19580
|
+
data: {
|
|
19581
|
+
manifest: state.manifest,
|
|
19582
|
+
reason,
|
|
19583
|
+
timestamp: Date.now()
|
|
19584
|
+
},
|
|
19585
|
+
type: "angular:rebootstrap"
|
|
19720
19586
|
});
|
|
19587
|
+
const { invalidateFingerprintCache: invalidateFingerprintCache2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
19588
|
+
invalidateFingerprintCache2();
|
|
19721
19589
|
}, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
|
|
19722
19590
|
const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
|
|
19723
19591
|
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, getStyleTransformConfig(state.config));
|
|
@@ -19742,7 +19610,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19742
19610
|
await rewriteImports3(ssrPaths, angServerVendorPaths);
|
|
19743
19611
|
}
|
|
19744
19612
|
serverPaths.forEach((serverPath, idx) => {
|
|
19745
|
-
const fileBase =
|
|
19613
|
+
const fileBase = basename12(serverPath, ".js");
|
|
19746
19614
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
19747
19615
|
state.manifest[toPascal(fileBase)] = resolve35(ssrPath);
|
|
19748
19616
|
});
|
|
@@ -19757,18 +19625,23 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19757
19625
|
}
|
|
19758
19626
|
const angularPagesPath = resolve35(angularDir, "pages");
|
|
19759
19627
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
19760
|
-
|
|
19628
|
+
const verdict = await decideAngularTier(state, angularDir);
|
|
19629
|
+
const runBundle = async () => {
|
|
19630
|
+
if (pageEntries.length === 0)
|
|
19631
|
+
return;
|
|
19761
19632
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
19762
19633
|
markSsrCacheDirty("angular");
|
|
19634
|
+
};
|
|
19635
|
+
if (verdict.tier === 0) {
|
|
19636
|
+
broadcastSurgical(state, verdict.queue);
|
|
19637
|
+
runBundle().catch((err) => {
|
|
19638
|
+
logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
19639
|
+
});
|
|
19640
|
+
} else {
|
|
19641
|
+
await runBundle();
|
|
19642
|
+
await broadcastRebootstrap(state, verdict.reason);
|
|
19763
19643
|
}
|
|
19764
19644
|
const { manifest } = state;
|
|
19765
|
-
const angularHmrFiles = angularFiles.filter((file4) => file4.endsWith(".ts") || file4.endsWith(".html"));
|
|
19766
|
-
const angularPageFiles = angularHmrFiles.filter((file4) => file4.replace(/\\/g, "/").includes("/pages/"));
|
|
19767
|
-
const pagesToUpdate = angularPageFiles.length > 0 ? angularPageFiles : pageEntries;
|
|
19768
|
-
const filesToClassify = filterToUserEdits(angularFiles, state.lastUserEditedFiles);
|
|
19769
|
-
const classification = collapseClassifications(filesToClassify.map(classifyAngularEdit));
|
|
19770
|
-
broadcastAngularPageUpdates(state, pagesToUpdate, manifest, startTime, classification);
|
|
19771
|
-
await broadcastAngularComponentUpdates(state, angularDir);
|
|
19772
19645
|
onRebuildComplete({ hmrState: state, manifest });
|
|
19773
19646
|
return manifest;
|
|
19774
19647
|
}, getModuleUrl = async (pageFile) => {
|
|
@@ -19895,7 +19768,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19895
19768
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
19896
19769
|
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
19897
19770
|
const serverRoot = resolve35(getFrameworkGeneratedDir2("svelte"), "server");
|
|
19898
|
-
const serverOutDir = resolve35(buildDir,
|
|
19771
|
+
const serverOutDir = resolve35(buildDir, basename12(svelteDir));
|
|
19899
19772
|
const [serverResult, clientResult] = await Promise.all([
|
|
19900
19773
|
serverEntries.length > 0 ? bunBuild9({
|
|
19901
19774
|
entrypoints: serverEntries,
|
|
@@ -19937,7 +19810,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19937
19810
|
const duration = Date.now() - startTime;
|
|
19938
19811
|
const broadcastFiles = svelteFiles.length > 0 ? svelteFiles : filesToRebuild;
|
|
19939
19812
|
broadcastFiles.forEach((sveltePagePath) => {
|
|
19940
|
-
const fileName =
|
|
19813
|
+
const fileName = basename12(sveltePagePath);
|
|
19941
19814
|
const baseName = fileName.replace(/\.svelte$/, "");
|
|
19942
19815
|
const pascalName = toPascal(baseName);
|
|
19943
19816
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -20044,7 +19917,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20044
19917
|
const { compileEmber: compileEmber2 } = await Promise.resolve().then(() => (init_compileEmber(), exports_compileEmber));
|
|
20045
19918
|
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
20046
19919
|
for (const serverPath of serverPaths) {
|
|
20047
|
-
const fileBase =
|
|
19920
|
+
const fileBase = basename12(serverPath, ".js");
|
|
20048
19921
|
state.manifest[toPascal(fileBase)] = resolve35(serverPath);
|
|
20049
19922
|
}
|
|
20050
19923
|
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
@@ -20115,7 +19988,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20115
19988
|
});
|
|
20116
19989
|
}
|
|
20117
19990
|
}, handleScriptUpdate = (state, scriptFile, manifest, framework, duration) => {
|
|
20118
|
-
const scriptBaseName =
|
|
19991
|
+
const scriptBaseName = basename12(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
|
|
20119
19992
|
const pascalName = toPascal(scriptBaseName);
|
|
20120
19993
|
const scriptPath = manifest[pascalName] || null;
|
|
20121
19994
|
if (!scriptPath) {
|
|
@@ -20194,7 +20067,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20194
20067
|
if (isSingle) {
|
|
20195
20068
|
return resolve35(state.resolvedPaths.buildDir, "pages");
|
|
20196
20069
|
}
|
|
20197
|
-
const dirName = framework === "html" ?
|
|
20070
|
+
const dirName = framework === "html" ? basename12(config.htmlDirectory ?? "html") : basename12(config.htmxDirectory ?? "htmx");
|
|
20198
20071
|
return resolve35(state.resolvedPaths.buildDir, dirName, "pages");
|
|
20199
20072
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
20200
20073
|
try {
|
|
@@ -20233,7 +20106,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20233
20106
|
const shouldRefreshAllPages = htmlPageFiles.length === 0 && shouldRefreshFromIslandChange;
|
|
20234
20107
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
20235
20108
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
20236
|
-
const htmlPageName =
|
|
20109
|
+
const htmlPageName = basename12(pageFile);
|
|
20237
20110
|
const builtHtmlPagePath = resolve35(outputHtmlPages, htmlPageName);
|
|
20238
20111
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
20239
20112
|
});
|
|
@@ -20242,7 +20115,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20242
20115
|
if (!cssFile) {
|
|
20243
20116
|
return;
|
|
20244
20117
|
}
|
|
20245
|
-
const cssBaseName =
|
|
20118
|
+
const cssBaseName = basename12(getStyleBaseName(cssFile));
|
|
20246
20119
|
const cssPascalName = toPascal(cssBaseName);
|
|
20247
20120
|
const cssKey = `${cssPascalName}CSS`;
|
|
20248
20121
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -20291,7 +20164,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20291
20164
|
type: "vue-update"
|
|
20292
20165
|
});
|
|
20293
20166
|
}, broadcastVuePageChange = async (state, config, vuePagePath, manifest, duration) => {
|
|
20294
|
-
const fileName =
|
|
20167
|
+
const fileName = basename12(vuePagePath);
|
|
20295
20168
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
20296
20169
|
const pascalName = toPascal(baseName);
|
|
20297
20170
|
const vueRoot = config.vueDirectory;
|
|
@@ -20337,7 +20210,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20337
20210
|
if (!cssFile) {
|
|
20338
20211
|
return;
|
|
20339
20212
|
}
|
|
20340
|
-
const cssBaseName =
|
|
20213
|
+
const cssBaseName = basename12(getStyleBaseName(cssFile));
|
|
20341
20214
|
const cssPascalName = toPascal(cssBaseName);
|
|
20342
20215
|
const cssKey = `${cssPascalName}CSS`;
|
|
20343
20216
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -20355,7 +20228,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20355
20228
|
});
|
|
20356
20229
|
}, broadcastSveltePageUpdate = (state, sveltePagePath, manifest, duration) => {
|
|
20357
20230
|
try {
|
|
20358
|
-
const fileName =
|
|
20231
|
+
const fileName = basename12(sveltePagePath);
|
|
20359
20232
|
const baseName = fileName.replace(/\.svelte$/, "");
|
|
20360
20233
|
const pascalName = toPascal(baseName);
|
|
20361
20234
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -20398,26 +20271,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20398
20271
|
pagesToUpdate.forEach((sveltePagePath) => {
|
|
20399
20272
|
broadcastSveltePageUpdate(state, sveltePagePath, manifest, duration);
|
|
20400
20273
|
});
|
|
20401
|
-
}, collectAngularAffectedPages = (affected, resolvedPages) => {
|
|
20402
|
-
affected.forEach((file4) => {
|
|
20403
|
-
if (file4.replace(/\\/g, "/").includes("/pages/") && file4.endsWith(".ts")) {
|
|
20404
|
-
resolvedPages.add(file4);
|
|
20405
|
-
}
|
|
20406
|
-
});
|
|
20407
|
-
}, resolveAngularPagesFromDependencyGraph = (state, angularFiles) => {
|
|
20408
|
-
const resolvedPages = new Set;
|
|
20409
|
-
angularFiles.forEach((componentFile) => {
|
|
20410
|
-
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
20411
|
-
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
20412
|
-
collectAngularAffectedPages(affected, resolvedPages);
|
|
20413
|
-
});
|
|
20414
|
-
return Array.from(resolvedPages);
|
|
20415
20274
|
}, handleAngularCssOnlyUpdate = (state, angularCssFiles, manifest, duration) => {
|
|
20416
20275
|
const [cssFile] = angularCssFiles;
|
|
20417
20276
|
if (!cssFile) {
|
|
20418
20277
|
return;
|
|
20419
20278
|
}
|
|
20420
|
-
const cssBaseName =
|
|
20279
|
+
const cssBaseName = basename12(getStyleBaseName(cssFile));
|
|
20421
20280
|
const cssPascalName = toPascal(cssBaseName);
|
|
20422
20281
|
const cssKey = `${cssPascalName}CSS`;
|
|
20423
20282
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -20433,58 +20292,17 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20433
20292
|
},
|
|
20434
20293
|
type: "angular-update"
|
|
20435
20294
|
});
|
|
20436
|
-
}, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration, classification) => {
|
|
20437
|
-
try {
|
|
20438
|
-
const fileName = basename13(angularPagePath);
|
|
20439
|
-
const baseName = fileName.replace(/\.[tj]s$/, "");
|
|
20440
|
-
const pascalName = toPascal(baseName);
|
|
20441
|
-
const cssKey = `${pascalName}CSS`;
|
|
20442
|
-
const cssUrl = manifest[cssKey] || null;
|
|
20443
|
-
logHmrUpdate(angularPagePath, "angular", duration);
|
|
20444
|
-
broadcastToClients(state, {
|
|
20445
|
-
data: {
|
|
20446
|
-
cssBaseName: baseName,
|
|
20447
|
-
cssUrl,
|
|
20448
|
-
editSourceFile: classification.sourceFile,
|
|
20449
|
-
framework: "angular",
|
|
20450
|
-
manifest,
|
|
20451
|
-
reason: classification.reason,
|
|
20452
|
-
sourceFile: angularPagePath,
|
|
20453
|
-
updateType: classification.type
|
|
20454
|
-
},
|
|
20455
|
-
type: "angular-update"
|
|
20456
|
-
});
|
|
20457
|
-
} catch (err) {
|
|
20458
|
-
sendTelemetryEvent("hmr:error", {
|
|
20459
|
-
framework: "angular",
|
|
20460
|
-
message: err instanceof Error ? err.message : String(err)
|
|
20461
|
-
});
|
|
20462
|
-
}
|
|
20463
20295
|
}, handleAngularHMR = (state, config, filesToRebuild, manifest, duration) => {
|
|
20464
|
-
if (!config.angularDirectory)
|
|
20296
|
+
if (!config.angularDirectory)
|
|
20465
20297
|
return;
|
|
20466
|
-
}
|
|
20467
20298
|
const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
|
|
20468
|
-
if (angularFiles.length === 0)
|
|
20299
|
+
if (angularFiles.length === 0)
|
|
20469
20300
|
return;
|
|
20470
|
-
}
|
|
20471
|
-
broadcastAngularComponentUpdates(state, config.angularDirectory);
|
|
20472
20301
|
const angularCssFiles = angularFiles.filter(isStylePath);
|
|
20473
20302
|
const isCssOnlyChange = angularFiles.every(isStylePath) && angularCssFiles.length > 0;
|
|
20474
|
-
|
|
20475
|
-
let pagesToUpdate = angularPageFiles;
|
|
20476
|
-
if (pagesToUpdate.length === 0 && state.dependencyGraph) {
|
|
20477
|
-
pagesToUpdate = resolveAngularPagesFromDependencyGraph(state, angularFiles);
|
|
20478
|
-
}
|
|
20479
|
-
if (isCssOnlyChange && angularCssFiles.length > 0) {
|
|
20303
|
+
if (isCssOnlyChange) {
|
|
20480
20304
|
handleAngularCssOnlyUpdate(state, angularCssFiles, manifest, duration);
|
|
20481
|
-
return;
|
|
20482
20305
|
}
|
|
20483
|
-
const filesToClassifySlow = filterToUserEdits(angularFiles, state.lastUserEditedFiles);
|
|
20484
|
-
const classification = collapseClassifications(filesToClassifySlow.map(classifyAngularEdit));
|
|
20485
|
-
pagesToUpdate.forEach((angularPagePath) => {
|
|
20486
|
-
broadcastAngularPageHmrUpdate(state, angularPagePath, manifest, duration, classification);
|
|
20487
|
-
});
|
|
20488
20306
|
}, handleHTMXScriptHMR = (state, filesToRebuild, manifest, duration) => {
|
|
20489
20307
|
if (!state.resolvedPaths.htmxDir) {
|
|
20490
20308
|
return;
|
|
@@ -20538,7 +20356,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20538
20356
|
const shouldRefreshAllPages = htmxPageFiles.length === 0 && shouldRefreshFromIslandChange;
|
|
20539
20357
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
20540
20358
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
20541
|
-
const htmxPageName =
|
|
20359
|
+
const htmxPageName = basename12(htmxPageFile);
|
|
20542
20360
|
const builtHtmxPagePath = resolve35(outputHtmxPages, htmxPageName);
|
|
20543
20361
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
20544
20362
|
});
|
|
@@ -20648,7 +20466,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20648
20466
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
20649
20467
|
writeFs(destPath, html);
|
|
20650
20468
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
20651
|
-
const destPath = resolve35(outputDir,
|
|
20469
|
+
const destPath = resolve35(outputDir, basename12(sourceFile));
|
|
20652
20470
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
20653
20471
|
const source = await Bun.file(sourceFile).text();
|
|
20654
20472
|
await Bun.write(destPath, source);
|
|
@@ -20894,7 +20712,6 @@ var init_rebuildTrigger = __esm(() => {
|
|
|
20894
20712
|
init_compileTailwind();
|
|
20895
20713
|
init_tailwindCompiler();
|
|
20896
20714
|
init_ssrCache();
|
|
20897
|
-
init_editTypeDetection();
|
|
20898
20715
|
moduleServerPromise = Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
20899
20716
|
getReactModuleUrl = getModuleUrl;
|
|
20900
20717
|
EMBER_PAGE_EXTENSIONS = [".gts", ".gjs", ".ts", ".js"];
|
|
@@ -20982,7 +20799,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
20982
20799
|
framework: Array.from(framework).filter(isResolvable4)
|
|
20983
20800
|
};
|
|
20984
20801
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
20985
|
-
const { readFileSync:
|
|
20802
|
+
const { readFileSync: readFileSync20 } = await import("fs");
|
|
20986
20803
|
const transpiler5 = new Bun.Transpiler({ loader: "js" });
|
|
20987
20804
|
const newSpecs = new Set;
|
|
20988
20805
|
for (const spec of specs) {
|
|
@@ -20997,7 +20814,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
20997
20814
|
}
|
|
20998
20815
|
let content;
|
|
20999
20816
|
try {
|
|
21000
|
-
content =
|
|
20817
|
+
content = readFileSync20(resolved, "utf-8");
|
|
21001
20818
|
} catch {
|
|
21002
20819
|
continue;
|
|
21003
20820
|
}
|
|
@@ -21544,5 +21361,5 @@ export {
|
|
|
21544
21361
|
build
|
|
21545
21362
|
};
|
|
21546
21363
|
|
|
21547
|
-
//# debugId=
|
|
21364
|
+
//# debugId=3DF8C37F7F59DD5A64756E2164756E21
|
|
21548
21365
|
//# sourceMappingURL=build.js.map
|