@absolutejs/absolute 0.19.0-beta.942 → 0.19.0-beta.944
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 +22 -4
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +22 -4
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +595 -404
- package/dist/build.js.map +8 -8
- package/dist/index.js +616 -425
- package/dist/index.js.map +8 -8
- package/dist/islands/index.js +22 -4
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +22 -4
- package/dist/react/index.js.map +3 -3
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +3 -0
- package/dist/svelte/index.js +22 -4
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +22 -4
- package/dist/svelte/server.js.map +3 -3
- package/dist/vue/index.js +22 -4
- package/dist/vue/index.js.map +3 -3
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -3000,6 +3000,15 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3000
3000
|
url: new URL(`file://${filePath}`)
|
|
3001
3001
|
});
|
|
3002
3002
|
const css = await runPostcss(result.css, filePath, config);
|
|
3003
|
+
const loadedUrls = result.loadedUrls ?? [];
|
|
3004
|
+
for (const url of loadedUrls) {
|
|
3005
|
+
if (url.protocol !== "file:")
|
|
3006
|
+
continue;
|
|
3007
|
+
const dep = fileURLToPath(url);
|
|
3008
|
+
if (resolve6(dep) === resolve6(filePath))
|
|
3009
|
+
continue;
|
|
3010
|
+
deps.add(dep);
|
|
3011
|
+
}
|
|
3003
3012
|
recordStyleDeps(filePath, deps);
|
|
3004
3013
|
return css;
|
|
3005
3014
|
} catch (error) {
|
|
@@ -3168,7 +3177,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3168
3177
|
}
|
|
3169
3178
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
3170
3179
|
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
3171
|
-
const
|
|
3180
|
+
const result = sass.compileString(contents, {
|
|
3172
3181
|
importers: [
|
|
3173
3182
|
createSassImporter(filePath, loadPaths, language, config)
|
|
3174
3183
|
],
|
|
@@ -3176,8 +3185,17 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3176
3185
|
style: "expanded",
|
|
3177
3186
|
syntax: language === "sass" ? "indented" : "scss",
|
|
3178
3187
|
url: new URL(`file://${filePath}`)
|
|
3179
|
-
})
|
|
3180
|
-
|
|
3188
|
+
});
|
|
3189
|
+
const loadedUrls = result.loadedUrls ?? [];
|
|
3190
|
+
for (const url of loadedUrls) {
|
|
3191
|
+
if (url.protocol !== "file:")
|
|
3192
|
+
continue;
|
|
3193
|
+
const dep = fileURLToPath(url);
|
|
3194
|
+
if (resolve6(dep) === resolve6(filePath))
|
|
3195
|
+
continue;
|
|
3196
|
+
addStyleImporter(filePath, dep);
|
|
3197
|
+
}
|
|
3198
|
+
return resolveCssImportsSync(result.css, dirname2(filePath), new Set([filePath]));
|
|
3181
3199
|
}
|
|
3182
3200
|
if (language === "less") {
|
|
3183
3201
|
throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
@@ -13649,6 +13667,12 @@ var fail = (reason, detail, location) => ({
|
|
|
13649
13667
|
return false;
|
|
13650
13668
|
if (a.decoratorOutputsArraySig !== b2.decoratorOutputsArraySig)
|
|
13651
13669
|
return false;
|
|
13670
|
+
if (a.hostBindingsSig !== b2.hostBindingsSig)
|
|
13671
|
+
return false;
|
|
13672
|
+
if (a.pageExportsSig !== b2.pageExportsSig)
|
|
13673
|
+
return false;
|
|
13674
|
+
if (a.schemasSig !== b2.schemasSig)
|
|
13675
|
+
return false;
|
|
13652
13676
|
return true;
|
|
13653
13677
|
}, recordFingerprint = (id, fp) => {
|
|
13654
13678
|
fingerprintCache.set(id, fp);
|
|
@@ -13672,25 +13696,47 @@ var fail = (reason, detail, location) => ({
|
|
|
13672
13696
|
if (!className)
|
|
13673
13697
|
continue;
|
|
13674
13698
|
const decorators = ts6.getDecorators(stmt) ?? [];
|
|
13675
|
-
const
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
|
|
13684
|
-
|
|
13685
|
-
|
|
13699
|
+
const decoratorName = (() => {
|
|
13700
|
+
for (const d2 of decorators) {
|
|
13701
|
+
if (!ts6.isCallExpression(d2.expression))
|
|
13702
|
+
continue;
|
|
13703
|
+
const expr = d2.expression.expression;
|
|
13704
|
+
if (!ts6.isIdentifier(expr))
|
|
13705
|
+
continue;
|
|
13706
|
+
if (expr.text === "Component" || expr.text === "Directive" || expr.text === "Pipe" || expr.text === "Injectable") {
|
|
13707
|
+
return expr.text;
|
|
13708
|
+
}
|
|
13709
|
+
}
|
|
13710
|
+
return null;
|
|
13711
|
+
})();
|
|
13712
|
+
if (!decoratorName)
|
|
13686
13713
|
continue;
|
|
13687
|
-
const decoratorMeta = readDecoratorMeta(args);
|
|
13688
|
-
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
13689
|
-
const componentDir = dirname13(componentFilePath);
|
|
13690
|
-
const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
13691
13714
|
const projectRel = relative12(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
13692
13715
|
const id = encodeURIComponent(`${projectRel}@${className}`);
|
|
13693
|
-
|
|
13716
|
+
if (decoratorName === "Component") {
|
|
13717
|
+
const componentDecorator = decorators.find((d2) => {
|
|
13718
|
+
if (!ts6.isCallExpression(d2.expression))
|
|
13719
|
+
return false;
|
|
13720
|
+
const expr = d2.expression.expression;
|
|
13721
|
+
return ts6.isIdentifier(expr) && expr.text === "Component";
|
|
13722
|
+
});
|
|
13723
|
+
if (!componentDecorator)
|
|
13724
|
+
continue;
|
|
13725
|
+
const decoratorCall = componentDecorator.expression;
|
|
13726
|
+
const args = decoratorCall.arguments[0];
|
|
13727
|
+
if (!args || !ts6.isObjectLiteralExpression(args))
|
|
13728
|
+
continue;
|
|
13729
|
+
const decoratorMeta = readDecoratorMeta(args);
|
|
13730
|
+
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
13731
|
+
const componentDir = dirname13(componentFilePath);
|
|
13732
|
+
const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
13733
|
+
fingerprintCache.set(id, fingerprint);
|
|
13734
|
+
} else {
|
|
13735
|
+
try {
|
|
13736
|
+
const entityFingerprint = extractEntityFingerprint(stmt, className, sourceFile);
|
|
13737
|
+
entityFingerprintCache.set(id, entityFingerprint);
|
|
13738
|
+
} catch {}
|
|
13739
|
+
}
|
|
13694
13740
|
}
|
|
13695
13741
|
}, invalidateFingerprintCache = () => {
|
|
13696
13742
|
fingerprintCache.clear();
|
|
@@ -13945,6 +13991,8 @@ var fail = (reason, detail, location) => ({
|
|
|
13945
13991
|
const viewProvidersExpr = getProperty(args, "viewProviders");
|
|
13946
13992
|
const inputsArrayExpr = getProperty(args, "inputs");
|
|
13947
13993
|
const outputsArrayExpr = getProperty(args, "outputs");
|
|
13994
|
+
const hostExpr = getProperty(args, "host");
|
|
13995
|
+
const schemasExpr = getProperty(args, "schemas");
|
|
13948
13996
|
const styleUrls = [];
|
|
13949
13997
|
if (styleUrlsExpr && ts6.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
13950
13998
|
for (const el of styleUrlsExpr.elements) {
|
|
@@ -13980,6 +14028,8 @@ var fail = (reason, detail, location) => ({
|
|
|
13980
14028
|
viewProvidersExpr: viewProvidersExpr && ts6.isArrayLiteralExpression(viewProvidersExpr) ? viewProvidersExpr : null,
|
|
13981
14029
|
inputsArrayExpr: inputsArrayExpr && ts6.isArrayLiteralExpression(inputsArrayExpr) ? inputsArrayExpr : null,
|
|
13982
14030
|
outputsArrayExpr: outputsArrayExpr && ts6.isArrayLiteralExpression(outputsArrayExpr) ? outputsArrayExpr : null,
|
|
14031
|
+
hostExpr: hostExpr && ts6.isObjectLiteralExpression(hostExpr) ? hostExpr : null,
|
|
14032
|
+
schemasExpr: schemasExpr && ts6.isArrayLiteralExpression(schemasExpr) ? schemasExpr : null,
|
|
13983
14033
|
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? projectDefaults.preserveWhitespaces ?? false,
|
|
13984
14034
|
selector: getStringProperty(args, "selector"),
|
|
13985
14035
|
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
@@ -14995,6 +15045,28 @@ var fail = (reason, detail, location) => ({
|
|
|
14995
15045
|
const viewProvidersArraySig = decoratorMeta.viewProvidersExpr ? djb2Hash(decoratorMeta.viewProvidersExpr.getText()) : "";
|
|
14996
15046
|
const decoratorInputsArraySig = decoratorMeta.inputsArrayExpr ? djb2Hash(decoratorMeta.inputsArrayExpr.getText()) : "";
|
|
14997
15047
|
const decoratorOutputsArraySig = decoratorMeta.outputsArrayExpr ? djb2Hash(decoratorMeta.outputsArrayExpr.getText()) : "";
|
|
15048
|
+
const hostBindingsSig = decoratorMeta.hostExpr ? djb2Hash(decoratorMeta.hostExpr.getText()) : "";
|
|
15049
|
+
const schemasSig = decoratorMeta.schemasExpr ? djb2Hash(decoratorMeta.schemasExpr.getText()) : "";
|
|
15050
|
+
const PAGE_EXPORT_NAMES = new Set(["providers", "routes"]);
|
|
15051
|
+
const pageExportEntries = [];
|
|
15052
|
+
for (const stmt of sourceFile.statements) {
|
|
15053
|
+
if (!ts6.isVariableStatement(stmt))
|
|
15054
|
+
continue;
|
|
15055
|
+
const isExported = stmt.modifiers?.some((m) => m.kind === ts6.SyntaxKind.ExportKeyword);
|
|
15056
|
+
if (!isExported)
|
|
15057
|
+
continue;
|
|
15058
|
+
for (const decl of stmt.declarationList.declarations) {
|
|
15059
|
+
if (!ts6.isIdentifier(decl.name))
|
|
15060
|
+
continue;
|
|
15061
|
+
if (!PAGE_EXPORT_NAMES.has(decl.name.text))
|
|
15062
|
+
continue;
|
|
15063
|
+
if (!decl.initializer)
|
|
15064
|
+
continue;
|
|
15065
|
+
pageExportEntries.push(`${decl.name.text}=${djb2Hash(decl.initializer.getText())}`);
|
|
15066
|
+
}
|
|
15067
|
+
}
|
|
15068
|
+
pageExportEntries.sort();
|
|
15069
|
+
const pageExportsSig = pageExportEntries.length > 0 ? pageExportEntries.join("|") : "";
|
|
14998
15070
|
return {
|
|
14999
15071
|
animationsArraySig,
|
|
15000
15072
|
arrowFieldSig,
|
|
@@ -15006,14 +15078,17 @@ var fail = (reason, detail, location) => ({
|
|
|
15006
15078
|
encapsulation: decoratorMeta.encapsulation,
|
|
15007
15079
|
hasProviders: decoratorMeta.hasProviders,
|
|
15008
15080
|
hasViewProviders: decoratorMeta.hasViewProviders,
|
|
15081
|
+
hostBindingsSig,
|
|
15009
15082
|
hostDirectivesSig,
|
|
15010
15083
|
importsArraySig,
|
|
15011
15084
|
inputs: inputNames,
|
|
15012
15085
|
memberDecoratorSig,
|
|
15013
15086
|
outputs: outputNames,
|
|
15087
|
+
pageExportsSig,
|
|
15014
15088
|
propertyFieldNames,
|
|
15015
15089
|
providerImportSig,
|
|
15016
15090
|
providersArraySig,
|
|
15091
|
+
schemasSig,
|
|
15017
15092
|
selector: decoratorMeta.selector,
|
|
15018
15093
|
standalone: decoratorMeta.standalone,
|
|
15019
15094
|
topLevelImports,
|
|
@@ -15269,7 +15344,7 @@ ${block}
|
|
|
15269
15344
|
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
15270
15345
|
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
15271
15346
|
const fingerprintChanged = cachedFingerprint !== undefined && !fingerprintsEqual(cachedFingerprint, currentFingerprint);
|
|
15272
|
-
const rebootstrapRequired = !currentFingerprint.standalone || cachedFingerprint !== undefined && (cachedFingerprint.importsArraySig !== currentFingerprint.importsArraySig || cachedFingerprint.hostDirectivesSig !== currentFingerprint.hostDirectivesSig || cachedFingerprint.providersArraySig !== currentFingerprint.providersArraySig || cachedFingerprint.viewProvidersArraySig !== currentFingerprint.viewProvidersArraySig || cachedFingerprint.selector !== currentFingerprint.selector || cachedFingerprint.standalone !== currentFingerprint.standalone);
|
|
15347
|
+
const rebootstrapRequired = !currentFingerprint.standalone || cachedFingerprint !== undefined && (cachedFingerprint.importsArraySig !== currentFingerprint.importsArraySig || cachedFingerprint.hostDirectivesSig !== currentFingerprint.hostDirectivesSig || cachedFingerprint.providersArraySig !== currentFingerprint.providersArraySig || cachedFingerprint.viewProvidersArraySig !== currentFingerprint.viewProvidersArraySig || cachedFingerprint.selector !== currentFingerprint.selector || cachedFingerprint.pageExportsSig !== currentFingerprint.pageExportsSig || cachedFingerprint.standalone !== currentFingerprint.standalone);
|
|
15273
15348
|
const sourceFileObj = new compiler.ParseSourceFile(tsSource, componentFilePath);
|
|
15274
15349
|
const zeroLoc = new compiler.ParseLocation(sourceFileObj, 0, 0, 0);
|
|
15275
15350
|
const typeSourceSpan = new compiler.ParseSourceSpan(zeroLoc, zeroLoc);
|
|
@@ -18592,6 +18667,15 @@ var init_buildEmberVendor = __esm(() => {
|
|
|
18592
18667
|
});
|
|
18593
18668
|
|
|
18594
18669
|
// src/dev/dependencyGraph.ts
|
|
18670
|
+
var exports_dependencyGraph = {};
|
|
18671
|
+
__export(exports_dependencyGraph, {
|
|
18672
|
+
removeFileFromGraph: () => removeFileFromGraph,
|
|
18673
|
+
getAffectedFiles: () => getAffectedFiles,
|
|
18674
|
+
extractDependencies: () => extractDependencies,
|
|
18675
|
+
emptyDependencyGraph: () => emptyDependencyGraph,
|
|
18676
|
+
buildInitialDependencyGraph: () => buildInitialDependencyGraph,
|
|
18677
|
+
addFileToGraph: () => addFileToGraph
|
|
18678
|
+
});
|
|
18595
18679
|
import { existsSync as existsSync22, readFileSync as readFileSync14 } from "fs";
|
|
18596
18680
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
18597
18681
|
import { resolve as resolve24 } from "path";
|
|
@@ -19089,6 +19173,22 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
19089
19173
|
if (existsSync23(abs) && !roots.includes(abs))
|
|
19090
19174
|
roots.push(abs);
|
|
19091
19175
|
}
|
|
19176
|
+
try {
|
|
19177
|
+
const { readdirSync: readdirSync2 } = __require("fs");
|
|
19178
|
+
const entries = readdirSync2(cwd2, { withFileTypes: true });
|
|
19179
|
+
for (const entry of entries) {
|
|
19180
|
+
if (!entry.isDirectory())
|
|
19181
|
+
continue;
|
|
19182
|
+
if (entry.name.startsWith("."))
|
|
19183
|
+
continue;
|
|
19184
|
+
const abs = normalizePath(resolve26(cwd2, entry.name));
|
|
19185
|
+
if (roots.includes(abs))
|
|
19186
|
+
continue;
|
|
19187
|
+
if (shouldIgnorePath(abs, resolved))
|
|
19188
|
+
continue;
|
|
19189
|
+
roots.push(abs);
|
|
19190
|
+
}
|
|
19191
|
+
} catch {}
|
|
19092
19192
|
const extraDirs = config.dev?.watchDirs ?? [];
|
|
19093
19193
|
for (const dir of extraDirs)
|
|
19094
19194
|
push(dir);
|
|
@@ -19615,90 +19715,366 @@ var init_moduleMapper = __esm(() => {
|
|
|
19615
19715
|
init_reactComponentClassifier();
|
|
19616
19716
|
});
|
|
19617
19717
|
|
|
19618
|
-
//
|
|
19619
|
-
var
|
|
19620
|
-
|
|
19621
|
-
|
|
19622
|
-
|
|
19623
|
-
|
|
19624
|
-
|
|
19718
|
+
// src/dev/angular/resolveOwningComponents.ts
|
|
19719
|
+
var exports_resolveOwningComponents = {};
|
|
19720
|
+
__export(exports_resolveOwningComponents, {
|
|
19721
|
+
resolveOwningComponents: () => resolveOwningComponents,
|
|
19722
|
+
resolveDescendantsOfParent: () => resolveDescendantsOfParent,
|
|
19723
|
+
invalidateResourceIndex: () => invalidateResourceIndex
|
|
19724
|
+
});
|
|
19725
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync18, statSync as statSync3 } from "fs";
|
|
19726
|
+
import { dirname as dirname18, extname as extname9, join as join28, resolve as resolve32 } from "path";
|
|
19727
|
+
import ts7 from "typescript";
|
|
19728
|
+
var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") || file4.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
19729
|
+
const out = [];
|
|
19730
|
+
const visit = (dir) => {
|
|
19731
|
+
let entries;
|
|
19732
|
+
try {
|
|
19733
|
+
entries = readdirSync2(dir, { withFileTypes: true });
|
|
19734
|
+
} catch {
|
|
19735
|
+
return;
|
|
19736
|
+
}
|
|
19737
|
+
for (const entry of entries) {
|
|
19738
|
+
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
19739
|
+
continue;
|
|
19740
|
+
}
|
|
19741
|
+
const full = join28(dir, entry.name);
|
|
19742
|
+
if (entry.isDirectory()) {
|
|
19743
|
+
visit(full);
|
|
19744
|
+
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
19745
|
+
out.push(full);
|
|
19746
|
+
}
|
|
19747
|
+
}
|
|
19748
|
+
};
|
|
19749
|
+
visit(root);
|
|
19750
|
+
return out;
|
|
19751
|
+
}, getStringPropertyValue = (obj, name) => {
|
|
19752
|
+
for (const prop of obj.properties) {
|
|
19753
|
+
if (!ts7.isPropertyAssignment(prop))
|
|
19754
|
+
continue;
|
|
19755
|
+
const propName = ts7.isIdentifier(prop.name) ? prop.name.text : ts7.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
19756
|
+
if (propName !== name)
|
|
19757
|
+
continue;
|
|
19758
|
+
const init = prop.initializer;
|
|
19759
|
+
if (ts7.isStringLiteral(init) || ts7.isNoSubstitutionTemplateLiteral(init)) {
|
|
19760
|
+
return init.text;
|
|
19761
|
+
}
|
|
19625
19762
|
}
|
|
19626
|
-
|
|
19627
|
-
|
|
19628
|
-
|
|
19629
|
-
|
|
19630
|
-
|
|
19631
|
-
|
|
19632
|
-
|
|
19633
|
-
|
|
19634
|
-
|
|
19635
|
-
|
|
19763
|
+
return null;
|
|
19764
|
+
}, getStringArrayProperty = (obj, name) => {
|
|
19765
|
+
const out = [];
|
|
19766
|
+
for (const prop of obj.properties) {
|
|
19767
|
+
if (!ts7.isPropertyAssignment(prop))
|
|
19768
|
+
continue;
|
|
19769
|
+
const propName = ts7.isIdentifier(prop.name) ? prop.name.text : ts7.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
19770
|
+
if (propName !== name)
|
|
19771
|
+
continue;
|
|
19772
|
+
const init = prop.initializer;
|
|
19773
|
+
if (!ts7.isArrayLiteralExpression(init))
|
|
19774
|
+
continue;
|
|
19775
|
+
for (const element of init.elements) {
|
|
19776
|
+
if (ts7.isStringLiteral(element) || ts7.isNoSubstitutionTemplateLiteral(element)) {
|
|
19777
|
+
out.push(element.text);
|
|
19778
|
+
}
|
|
19779
|
+
}
|
|
19636
19780
|
}
|
|
19637
|
-
|
|
19638
|
-
|
|
19639
|
-
|
|
19640
|
-
var trySendMessage = (client, messageStr) => {
|
|
19781
|
+
return out;
|
|
19782
|
+
}, parseDecoratedClasses = (filePath) => {
|
|
19783
|
+
let source;
|
|
19641
19784
|
try {
|
|
19642
|
-
|
|
19643
|
-
return true;
|
|
19785
|
+
source = readFileSync18(filePath, "utf8");
|
|
19644
19786
|
} catch {
|
|
19645
|
-
return
|
|
19787
|
+
return [];
|
|
19646
19788
|
}
|
|
19647
|
-
|
|
19648
|
-
const
|
|
19649
|
-
|
|
19650
|
-
|
|
19651
|
-
|
|
19652
|
-
|
|
19653
|
-
|
|
19789
|
+
const sourceFile = ts7.createSourceFile(filePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
19790
|
+
const out = [];
|
|
19791
|
+
const visit = (node) => {
|
|
19792
|
+
if (ts7.isClassDeclaration(node) && node.name) {
|
|
19793
|
+
for (const decorator of ts7.getDecorators(node) ?? []) {
|
|
19794
|
+
const expr = decorator.expression;
|
|
19795
|
+
if (!ts7.isCallExpression(expr))
|
|
19796
|
+
continue;
|
|
19797
|
+
const fn2 = expr.expression;
|
|
19798
|
+
if (!ts7.isIdentifier(fn2))
|
|
19799
|
+
continue;
|
|
19800
|
+
const kind = ENTITY_DECORATORS[fn2.text];
|
|
19801
|
+
if (!kind)
|
|
19802
|
+
continue;
|
|
19803
|
+
let extendsName = null;
|
|
19804
|
+
for (const heritage of node.heritageClauses ?? []) {
|
|
19805
|
+
if (heritage.token !== ts7.SyntaxKind.ExtendsKeyword) {
|
|
19806
|
+
continue;
|
|
19807
|
+
}
|
|
19808
|
+
const first = heritage.types[0];
|
|
19809
|
+
if (first && ts7.isIdentifier(first.expression)) {
|
|
19810
|
+
extendsName = first.expression.text;
|
|
19811
|
+
}
|
|
19812
|
+
break;
|
|
19813
|
+
}
|
|
19814
|
+
const entry = {
|
|
19815
|
+
className: node.name.text,
|
|
19816
|
+
kind,
|
|
19817
|
+
styleUrls: [],
|
|
19818
|
+
templateUrls: [],
|
|
19819
|
+
extendsName
|
|
19820
|
+
};
|
|
19821
|
+
const arg = expr.arguments[0];
|
|
19822
|
+
if (arg && ts7.isObjectLiteralExpression(arg) && kind === "component") {
|
|
19823
|
+
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
19824
|
+
if (tplUrl)
|
|
19825
|
+
entry.templateUrls.push(tplUrl);
|
|
19826
|
+
const styleUrl = getStringPropertyValue(arg, "styleUrl");
|
|
19827
|
+
if (styleUrl)
|
|
19828
|
+
entry.styleUrls.push(styleUrl);
|
|
19829
|
+
entry.styleUrls.push(...getStringArrayProperty(arg, "styleUrls"));
|
|
19830
|
+
}
|
|
19831
|
+
out.push(entry);
|
|
19832
|
+
break;
|
|
19833
|
+
}
|
|
19834
|
+
}
|
|
19835
|
+
ts7.forEachChild(node, visit);
|
|
19654
19836
|
};
|
|
19655
|
-
|
|
19656
|
-
|
|
19657
|
-
|
|
19658
|
-
|
|
19659
|
-
|
|
19660
|
-
|
|
19661
|
-
|
|
19662
|
-
|
|
19663
|
-
|
|
19664
|
-
|
|
19665
|
-
|
|
19666
|
-
|
|
19667
|
-
|
|
19668
|
-
|
|
19669
|
-
|
|
19670
|
-
}
|
|
19671
|
-
|
|
19672
|
-
type: "manifest"
|
|
19673
|
-
}));
|
|
19674
|
-
client.send(JSON.stringify({
|
|
19675
|
-
message: "HMR client connected successfully",
|
|
19676
|
-
timestamp: Date.now(),
|
|
19677
|
-
type: "connected"
|
|
19678
|
-
}));
|
|
19679
|
-
}, handleClientDisconnect = (state, client) => {
|
|
19680
|
-
state.connectedClients.delete(client);
|
|
19681
|
-
}, parseJsonSafe = (raw) => JSON.parse(raw), parseMessage = (message) => {
|
|
19682
|
-
if (typeof message === "string") {
|
|
19683
|
-
return parseJsonSafe(message);
|
|
19684
|
-
}
|
|
19685
|
-
if (message instanceof Buffer) {
|
|
19686
|
-
return parseJsonSafe(message.toString());
|
|
19837
|
+
visit(sourceFile);
|
|
19838
|
+
return out;
|
|
19839
|
+
}, safeNormalize = (path) => resolve32(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
19840
|
+
const { changedFilePath, userAngularRoot } = params;
|
|
19841
|
+
const changedAbs = safeNormalize(changedFilePath);
|
|
19842
|
+
const out = [];
|
|
19843
|
+
const ext = extname9(changedAbs).toLowerCase();
|
|
19844
|
+
if (ext === ".ts" || ext === ".tsx") {
|
|
19845
|
+
const classes = parseDecoratedClasses(changedAbs);
|
|
19846
|
+
for (const cls of classes) {
|
|
19847
|
+
out.push({
|
|
19848
|
+
className: cls.className,
|
|
19849
|
+
componentFilePath: changedAbs,
|
|
19850
|
+
kind: cls.kind
|
|
19851
|
+
});
|
|
19852
|
+
}
|
|
19853
|
+
return out;
|
|
19687
19854
|
}
|
|
19688
|
-
if (
|
|
19689
|
-
return
|
|
19855
|
+
if (ext !== ".html" && ext !== ".css" && ext !== ".scss" && ext !== ".sass") {
|
|
19856
|
+
return out;
|
|
19690
19857
|
}
|
|
19691
|
-
|
|
19692
|
-
|
|
19693
|
-
|
|
19858
|
+
let rootStat;
|
|
19859
|
+
try {
|
|
19860
|
+
rootStat = statSync3(userAngularRoot);
|
|
19861
|
+
} catch {
|
|
19862
|
+
return out;
|
|
19694
19863
|
}
|
|
19695
|
-
if (
|
|
19696
|
-
return
|
|
19864
|
+
if (!rootStat.isDirectory())
|
|
19865
|
+
return out;
|
|
19866
|
+
const index = getOrBuildResourceIndex(userAngularRoot);
|
|
19867
|
+
const owners = index.get(changedAbs);
|
|
19868
|
+
if (owners) {
|
|
19869
|
+
out.push(...owners);
|
|
19697
19870
|
}
|
|
19698
|
-
return
|
|
19699
|
-
},
|
|
19700
|
-
|
|
19701
|
-
|
|
19871
|
+
return out;
|
|
19872
|
+
}, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
|
|
19873
|
+
let source;
|
|
19874
|
+
try {
|
|
19875
|
+
source = readFileSync18(childFilePath, "utf8");
|
|
19876
|
+
} catch {
|
|
19877
|
+
return null;
|
|
19878
|
+
}
|
|
19879
|
+
const sf = ts7.createSourceFile(childFilePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
19880
|
+
const childDir = dirname18(childFilePath);
|
|
19881
|
+
for (const stmt of sf.statements) {
|
|
19882
|
+
if (!ts7.isImportDeclaration(stmt))
|
|
19883
|
+
continue;
|
|
19884
|
+
if (!ts7.isStringLiteral(stmt.moduleSpecifier))
|
|
19885
|
+
continue;
|
|
19886
|
+
const clause = stmt.importClause;
|
|
19887
|
+
if (!clause || clause.isTypeOnly)
|
|
19888
|
+
continue;
|
|
19889
|
+
let matchesName = false;
|
|
19890
|
+
if (clause.name && clause.name.text === parentName)
|
|
19891
|
+
matchesName = true;
|
|
19892
|
+
if (!matchesName && clause.namedBindings && ts7.isNamedImports(clause.namedBindings)) {
|
|
19893
|
+
for (const el of clause.namedBindings.elements) {
|
|
19894
|
+
if (el.isTypeOnly)
|
|
19895
|
+
continue;
|
|
19896
|
+
if (el.name.text === parentName) {
|
|
19897
|
+
matchesName = true;
|
|
19898
|
+
break;
|
|
19899
|
+
}
|
|
19900
|
+
}
|
|
19901
|
+
}
|
|
19902
|
+
if (!matchesName)
|
|
19903
|
+
continue;
|
|
19904
|
+
const spec = stmt.moduleSpecifier.text;
|
|
19905
|
+
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
19906
|
+
return null;
|
|
19907
|
+
}
|
|
19908
|
+
const base = resolve32(childDir, spec);
|
|
19909
|
+
const candidates = [
|
|
19910
|
+
`${base}.ts`,
|
|
19911
|
+
`${base}.tsx`,
|
|
19912
|
+
`${base}/index.ts`,
|
|
19913
|
+
`${base}/index.tsx`
|
|
19914
|
+
];
|
|
19915
|
+
const angularRootNorm = safeNormalize(angularRoot);
|
|
19916
|
+
for (const candidate of candidates) {
|
|
19917
|
+
try {
|
|
19918
|
+
if (statSync3(candidate).isFile()) {
|
|
19919
|
+
const norm = safeNormalize(candidate);
|
|
19920
|
+
if (!norm.startsWith(angularRootNorm))
|
|
19921
|
+
return null;
|
|
19922
|
+
return norm;
|
|
19923
|
+
}
|
|
19924
|
+
} catch {}
|
|
19925
|
+
}
|
|
19926
|
+
return null;
|
|
19927
|
+
}
|
|
19928
|
+
return null;
|
|
19929
|
+
}, getOrBuildIndexes = (userAngularRoot) => {
|
|
19930
|
+
const cached = indexByRoot.get(userAngularRoot);
|
|
19931
|
+
if (cached)
|
|
19932
|
+
return cached;
|
|
19933
|
+
const resource = new Map;
|
|
19934
|
+
const parentFile = new Map;
|
|
19935
|
+
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
19936
|
+
const classes = parseDecoratedClasses(tsPath);
|
|
19937
|
+
const componentDir = dirname18(tsPath);
|
|
19938
|
+
for (const cls of classes) {
|
|
19939
|
+
const entity = {
|
|
19940
|
+
className: cls.className,
|
|
19941
|
+
componentFilePath: tsPath,
|
|
19942
|
+
kind: cls.kind
|
|
19943
|
+
};
|
|
19944
|
+
if (cls.kind === "component") {
|
|
19945
|
+
for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
|
|
19946
|
+
const abs = safeNormalize(resolve32(componentDir, url));
|
|
19947
|
+
const existing = resource.get(abs);
|
|
19948
|
+
if (existing)
|
|
19949
|
+
existing.push(entity);
|
|
19950
|
+
else
|
|
19951
|
+
resource.set(abs, [entity]);
|
|
19952
|
+
}
|
|
19953
|
+
}
|
|
19954
|
+
if (cls.extendsName !== null) {
|
|
19955
|
+
const parentPath = resolveParentClassFile(cls.extendsName, tsPath, userAngularRoot);
|
|
19956
|
+
if (parentPath !== null && parentPath !== safeNormalize(tsPath)) {
|
|
19957
|
+
const existing = parentFile.get(parentPath);
|
|
19958
|
+
if (existing)
|
|
19959
|
+
existing.push(entity);
|
|
19960
|
+
else
|
|
19961
|
+
parentFile.set(parentPath, [entity]);
|
|
19962
|
+
}
|
|
19963
|
+
}
|
|
19964
|
+
}
|
|
19965
|
+
}
|
|
19966
|
+
const bundle = { parentFile, resource };
|
|
19967
|
+
indexByRoot.set(userAngularRoot, bundle);
|
|
19968
|
+
return bundle;
|
|
19969
|
+
}, getOrBuildResourceIndex = (userAngularRoot) => getOrBuildIndexes(userAngularRoot).resource, resolveDescendantsOfParent = (params) => {
|
|
19970
|
+
const norm = safeNormalize(params.changedFilePath);
|
|
19971
|
+
let rootStat;
|
|
19972
|
+
try {
|
|
19973
|
+
rootStat = statSync3(params.userAngularRoot);
|
|
19974
|
+
} catch {
|
|
19975
|
+
return [];
|
|
19976
|
+
}
|
|
19977
|
+
if (!rootStat.isDirectory())
|
|
19978
|
+
return [];
|
|
19979
|
+
const bundle = getOrBuildIndexes(params.userAngularRoot);
|
|
19980
|
+
return bundle.parentFile.get(norm) ?? [];
|
|
19981
|
+
}, invalidateResourceIndex = () => {
|
|
19982
|
+
indexByRoot.clear();
|
|
19983
|
+
};
|
|
19984
|
+
var init_resolveOwningComponents = __esm(() => {
|
|
19985
|
+
ENTITY_DECORATORS = {
|
|
19986
|
+
Component: "component",
|
|
19987
|
+
Directive: "directive",
|
|
19988
|
+
Pipe: "pipe",
|
|
19989
|
+
Injectable: "service"
|
|
19990
|
+
};
|
|
19991
|
+
indexByRoot = new Map;
|
|
19992
|
+
});
|
|
19993
|
+
|
|
19994
|
+
// types/typeGuards.ts
|
|
19995
|
+
var isValidHMRClientMessage = (data) => {
|
|
19996
|
+
if (!data || typeof data !== "object") {
|
|
19997
|
+
return false;
|
|
19998
|
+
}
|
|
19999
|
+
if (!("type" in data) || typeof data.type !== "string") {
|
|
20000
|
+
return false;
|
|
20001
|
+
}
|
|
20002
|
+
switch (data.type) {
|
|
20003
|
+
case "ping":
|
|
20004
|
+
case "ready":
|
|
20005
|
+
case "request-rebuild":
|
|
20006
|
+
case "hydration-error":
|
|
20007
|
+
case "hmr-timing":
|
|
20008
|
+
case "angular:hmr-ack":
|
|
20009
|
+
return true;
|
|
20010
|
+
default:
|
|
20011
|
+
return false;
|
|
20012
|
+
}
|
|
20013
|
+
};
|
|
20014
|
+
|
|
20015
|
+
// src/dev/webSocket.ts
|
|
20016
|
+
var trySendMessage = (client, messageStr) => {
|
|
20017
|
+
try {
|
|
20018
|
+
client.send(messageStr);
|
|
20019
|
+
return true;
|
|
20020
|
+
} catch {
|
|
20021
|
+
return false;
|
|
20022
|
+
}
|
|
20023
|
+
}, broadcastToClients = (state, message) => {
|
|
20024
|
+
const messageStr = JSON.stringify({
|
|
20025
|
+
...message,
|
|
20026
|
+
timestamp: Date.now()
|
|
20027
|
+
});
|
|
20028
|
+
const shouldRemove = (client) => {
|
|
20029
|
+
return !trySendMessage(client, messageStr);
|
|
20030
|
+
};
|
|
20031
|
+
const clientsToRemove = [];
|
|
20032
|
+
state.connectedClients.forEach((client) => {
|
|
20033
|
+
if (shouldRemove(client))
|
|
20034
|
+
clientsToRemove.push(client);
|
|
20035
|
+
});
|
|
20036
|
+
clientsToRemove.forEach((client) => {
|
|
20037
|
+
state.connectedClients.delete(client);
|
|
20038
|
+
});
|
|
20039
|
+
}, handleClientConnect = (state, client, manifest) => {
|
|
20040
|
+
state.connectedClients.add(client);
|
|
20041
|
+
const serverVersions = serializeModuleVersions(state.moduleVersions);
|
|
20042
|
+
client.send(JSON.stringify({
|
|
20043
|
+
data: {
|
|
20044
|
+
manifest,
|
|
20045
|
+
serverVersions
|
|
20046
|
+
},
|
|
20047
|
+
timestamp: Date.now(),
|
|
20048
|
+
type: "manifest"
|
|
20049
|
+
}));
|
|
20050
|
+
client.send(JSON.stringify({
|
|
20051
|
+
message: "HMR client connected successfully",
|
|
20052
|
+
timestamp: Date.now(),
|
|
20053
|
+
type: "connected"
|
|
20054
|
+
}));
|
|
20055
|
+
}, handleClientDisconnect = (state, client) => {
|
|
20056
|
+
state.connectedClients.delete(client);
|
|
20057
|
+
}, parseJsonSafe = (raw) => JSON.parse(raw), parseMessage = (message) => {
|
|
20058
|
+
if (typeof message === "string") {
|
|
20059
|
+
return parseJsonSafe(message);
|
|
20060
|
+
}
|
|
20061
|
+
if (message instanceof Buffer) {
|
|
20062
|
+
return parseJsonSafe(message.toString());
|
|
20063
|
+
}
|
|
20064
|
+
if (message instanceof ArrayBuffer) {
|
|
20065
|
+
return parseJsonSafe(new TextDecoder().decode(new Uint8Array(message)));
|
|
20066
|
+
}
|
|
20067
|
+
if (ArrayBuffer.isView(message)) {
|
|
20068
|
+
const view = new Uint8Array(message.buffer, message.byteOffset, message.byteLength);
|
|
20069
|
+
return parseJsonSafe(new TextDecoder().decode(view));
|
|
20070
|
+
}
|
|
20071
|
+
if (typeof message === "object" && message !== null) {
|
|
20072
|
+
return message;
|
|
20073
|
+
}
|
|
20074
|
+
return null;
|
|
20075
|
+
}, handleParsedMessage = (state, client, data) => {
|
|
20076
|
+
switch (data.type) {
|
|
20077
|
+
case "ping":
|
|
19702
20078
|
client.send(JSON.stringify({
|
|
19703
20079
|
timestamp: Date.now(),
|
|
19704
20080
|
type: "pong"
|
|
@@ -19756,8 +20132,8 @@ __export(exports_moduleServer, {
|
|
|
19756
20132
|
createModuleServer: () => createModuleServer,
|
|
19757
20133
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
19758
20134
|
});
|
|
19759
|
-
import { existsSync as existsSync25, readFileSync as
|
|
19760
|
-
import { basename as basename10, dirname as
|
|
20135
|
+
import { existsSync as existsSync25, readFileSync as readFileSync19, statSync as statSync4 } from "fs";
|
|
20136
|
+
import { basename as basename10, dirname as dirname19, extname as extname10, join as join29, resolve as resolve33, relative as relative14 } from "path";
|
|
19761
20137
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
19762
20138
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
19763
20139
|
const allExports = [];
|
|
@@ -19777,7 +20153,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
19777
20153
|
${stubs}
|
|
19778
20154
|
`;
|
|
19779
20155
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
19780
|
-
const found = extensions.find((ext) => existsSync25(
|
|
20156
|
+
const found = extensions.find((ext) => existsSync25(resolve33(projectRoot, srcPath + ext)));
|
|
19781
20157
|
return found ? srcPath + found : srcPath;
|
|
19782
20158
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
19783
20159
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -19792,24 +20168,24 @@ ${stubs}
|
|
|
19792
20168
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
19793
20169
|
}, srcUrl = (relPath, projectRoot) => {
|
|
19794
20170
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
19795
|
-
const absPath =
|
|
20171
|
+
const absPath = resolve33(projectRoot, relPath);
|
|
19796
20172
|
const cached = mtimeCache.get(absPath);
|
|
19797
20173
|
if (cached !== undefined)
|
|
19798
20174
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
19799
20175
|
try {
|
|
19800
|
-
const mtime = Math.round(
|
|
20176
|
+
const mtime = Math.round(statSync4(absPath).mtimeMs);
|
|
19801
20177
|
mtimeCache.set(absPath, mtime);
|
|
19802
20178
|
return `${base}?v=${buildVersion(mtime, absPath)}`;
|
|
19803
20179
|
} catch {
|
|
19804
20180
|
return base;
|
|
19805
20181
|
}
|
|
19806
20182
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
19807
|
-
const absPath =
|
|
20183
|
+
const absPath = resolve33(fileDir, relPath);
|
|
19808
20184
|
const rel = relative14(projectRoot, absPath);
|
|
19809
|
-
const extension =
|
|
20185
|
+
const extension = extname10(rel);
|
|
19810
20186
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
19811
|
-
if (
|
|
19812
|
-
srcPath = relative14(projectRoot, resolveSvelteModulePath(
|
|
20187
|
+
if (extname10(srcPath) === ".svelte") {
|
|
20188
|
+
srcPath = relative14(projectRoot, resolveSvelteModulePath(resolve33(projectRoot, srcPath)));
|
|
19813
20189
|
}
|
|
19814
20190
|
return srcUrl(srcPath, projectRoot);
|
|
19815
20191
|
}, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -19828,13 +20204,13 @@ ${stubs}
|
|
|
19828
20204
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
19829
20205
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
19830
20206
|
if (!subpath) {
|
|
19831
|
-
const pkgDir =
|
|
19832
|
-
const pkgJsonPath =
|
|
20207
|
+
const pkgDir = resolve33(projectRoot, "node_modules", packageName ?? "");
|
|
20208
|
+
const pkgJsonPath = join29(pkgDir, "package.json");
|
|
19833
20209
|
if (existsSync25(pkgJsonPath)) {
|
|
19834
|
-
const pkg = JSON.parse(
|
|
20210
|
+
const pkg = JSON.parse(readFileSync19(pkgJsonPath, "utf-8"));
|
|
19835
20211
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
19836
20212
|
if (esmEntry) {
|
|
19837
|
-
const resolved =
|
|
20213
|
+
const resolved = resolve33(pkgDir, esmEntry);
|
|
19838
20214
|
if (existsSync25(resolved))
|
|
19839
20215
|
return relative14(projectRoot, resolved);
|
|
19840
20216
|
}
|
|
@@ -19866,7 +20242,7 @@ ${stubs}
|
|
|
19866
20242
|
};
|
|
19867
20243
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
19868
20244
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
19869
|
-
const fileDir =
|
|
20245
|
+
const fileDir = dirname19(filePath);
|
|
19870
20246
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
19871
20247
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
19872
20248
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
@@ -19881,12 +20257,12 @@ ${stubs}
|
|
|
19881
20257
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
|
|
19882
20258
|
result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
|
|
19883
20259
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
19884
|
-
const absPath =
|
|
20260
|
+
const absPath = resolve33(fileDir, relPath);
|
|
19885
20261
|
const rel = relative14(projectRoot, absPath);
|
|
19886
20262
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
19887
20263
|
});
|
|
19888
20264
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
19889
|
-
const absPath =
|
|
20265
|
+
const absPath = resolve33(fileDir, relPath);
|
|
19890
20266
|
const rel = relative14(projectRoot, absPath);
|
|
19891
20267
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
19892
20268
|
});
|
|
@@ -19932,7 +20308,7 @@ ${code}`;
|
|
|
19932
20308
|
reactFastRefreshWarningEmitted = true;
|
|
19933
20309
|
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.");
|
|
19934
20310
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
19935
|
-
const raw =
|
|
20311
|
+
const raw = readFileSync19(filePath, "utf-8");
|
|
19936
20312
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
19937
20313
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
19938
20314
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -19948,8 +20324,8 @@ ${transpiled}`;
|
|
|
19948
20324
|
transpiled += buildIslandMetadataExports(raw);
|
|
19949
20325
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
19950
20326
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
19951
|
-
const raw =
|
|
19952
|
-
const ext =
|
|
20327
|
+
const raw = readFileSync19(filePath, "utf-8");
|
|
20328
|
+
const ext = extname10(filePath);
|
|
19953
20329
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
19954
20330
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
19955
20331
|
let transpiler6 = jsTranspiler2;
|
|
@@ -20114,7 +20490,7 @@ ${code}`;
|
|
|
20114
20490
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
20115
20491
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
20116
20492
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
20117
|
-
const raw =
|
|
20493
|
+
const raw = readFileSync19(filePath, "utf-8");
|
|
20118
20494
|
if (!svelteCompiler) {
|
|
20119
20495
|
svelteCompiler = await import("svelte/compiler");
|
|
20120
20496
|
}
|
|
@@ -20176,7 +20552,7 @@ export default __script__;`;
|
|
|
20176
20552
|
return `${cssInjection}
|
|
20177
20553
|
${code}`;
|
|
20178
20554
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
20179
|
-
const rawSource =
|
|
20555
|
+
const rawSource = readFileSync19(filePath, "utf-8");
|
|
20180
20556
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
20181
20557
|
if (!vueCompiler) {
|
|
20182
20558
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
@@ -20199,7 +20575,7 @@ ${code}`;
|
|
|
20199
20575
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
20200
20576
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
20201
20577
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
20202
|
-
const hmrBase = vueDir ?
|
|
20578
|
+
const hmrBase = vueDir ? resolve33(vueDir) : projectRoot;
|
|
20203
20579
|
const hmrId = relative14(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
20204
20580
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
20205
20581
|
result += [
|
|
@@ -20231,7 +20607,7 @@ ${code}`;
|
|
|
20231
20607
|
}
|
|
20232
20608
|
});
|
|
20233
20609
|
}, handleCssRequest = (filePath) => {
|
|
20234
|
-
const raw =
|
|
20610
|
+
const raw = readFileSync19(filePath, "utf-8");
|
|
20235
20611
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
20236
20612
|
return [
|
|
20237
20613
|
`const style = document.createElement('style');`,
|
|
@@ -20363,8 +20739,8 @@ export default {};
|
|
|
20363
20739
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
20364
20740
|
return jsResponse(`var s=document.createElement('style');s.textContent=\`${escaped}\`;s.dataset.svelteHmr=${JSON.stringify(cssCheckPath)};var p=document.querySelector('style[data-svelte-hmr="${cssCheckPath}"]');if(p)p.remove();document.head.appendChild(s);`);
|
|
20365
20741
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
20366
|
-
const filePath =
|
|
20367
|
-
const ext =
|
|
20742
|
+
const filePath = resolve33(projectRoot, relPath);
|
|
20743
|
+
const ext = extname10(filePath);
|
|
20368
20744
|
if (ext === ".svelte")
|
|
20369
20745
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
20370
20746
|
if (ext)
|
|
@@ -20389,8 +20765,8 @@ export default {};
|
|
|
20389
20765
|
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
20390
20766
|
if (!TRANSPILABLE.has(ext))
|
|
20391
20767
|
return;
|
|
20392
|
-
const stat3 =
|
|
20393
|
-
const resolvedVueDir = vueDir ?
|
|
20768
|
+
const stat3 = statSync4(filePath);
|
|
20769
|
+
const resolvedVueDir = vueDir ? resolve33(vueDir) : undefined;
|
|
20394
20770
|
let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
20395
20771
|
const isAngularGeneratedJs = ext === ".js" && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
|
|
20396
20772
|
if (isAngularGeneratedJs) {
|
|
@@ -20417,12 +20793,12 @@ export default {};
|
|
|
20417
20793
|
cachedAngularUserRoot = configuredAngularUserRoot ?? null;
|
|
20418
20794
|
return cachedAngularUserRoot;
|
|
20419
20795
|
}, configuredAngularUserRoot, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
20420
|
-
const stat3 =
|
|
20796
|
+
const stat3 = statSync4(filePath);
|
|
20421
20797
|
const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
20422
20798
|
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
20423
20799
|
return jsResponse(content);
|
|
20424
20800
|
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
20425
|
-
const stat3 =
|
|
20801
|
+
const stat3 = statSync4(filePath);
|
|
20426
20802
|
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
20427
20803
|
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
20428
20804
|
return jsResponse(content);
|
|
@@ -20449,7 +20825,7 @@ export default {};
|
|
|
20449
20825
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
20450
20826
|
if (relPath === "bun:wrap" || relPath.startsWith("bun:wrap?"))
|
|
20451
20827
|
return handleBunWrapRequest();
|
|
20452
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
20828
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve33(projectRoot, relPath));
|
|
20453
20829
|
if (virtualCssResponse)
|
|
20454
20830
|
return virtualCssResponse;
|
|
20455
20831
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -20465,11 +20841,11 @@ export default {};
|
|
|
20465
20841
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
20466
20842
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
20467
20843
|
if (match[1])
|
|
20468
|
-
files.push(
|
|
20844
|
+
files.push(resolve33(projectRoot, match[1]));
|
|
20469
20845
|
}
|
|
20470
20846
|
return files;
|
|
20471
20847
|
}, invalidateModule = (filePath) => {
|
|
20472
|
-
const resolved =
|
|
20848
|
+
const resolved = resolve33(filePath);
|
|
20473
20849
|
invalidate(filePath);
|
|
20474
20850
|
if (resolved !== filePath)
|
|
20475
20851
|
invalidate(resolved);
|
|
@@ -20608,282 +20984,6 @@ var init_rewriteImports = __esm(() => {
|
|
|
20608
20984
|
rewriteVendorDirectories2 = rewriteVendorDirectories;
|
|
20609
20985
|
});
|
|
20610
20986
|
|
|
20611
|
-
// src/dev/angular/resolveOwningComponents.ts
|
|
20612
|
-
var exports_resolveOwningComponents = {};
|
|
20613
|
-
__export(exports_resolveOwningComponents, {
|
|
20614
|
-
resolveOwningComponents: () => resolveOwningComponents,
|
|
20615
|
-
resolveDescendantsOfParent: () => resolveDescendantsOfParent,
|
|
20616
|
-
invalidateResourceIndex: () => invalidateResourceIndex
|
|
20617
|
-
});
|
|
20618
|
-
import { readdirSync as readdirSync2, readFileSync as readFileSync19, statSync as statSync4 } from "fs";
|
|
20619
|
-
import { dirname as dirname19, extname as extname10, join as join29, resolve as resolve33 } from "path";
|
|
20620
|
-
import ts7 from "typescript";
|
|
20621
|
-
var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") || file4.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
20622
|
-
const out = [];
|
|
20623
|
-
const visit = (dir) => {
|
|
20624
|
-
let entries;
|
|
20625
|
-
try {
|
|
20626
|
-
entries = readdirSync2(dir, { withFileTypes: true });
|
|
20627
|
-
} catch {
|
|
20628
|
-
return;
|
|
20629
|
-
}
|
|
20630
|
-
for (const entry of entries) {
|
|
20631
|
-
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
20632
|
-
continue;
|
|
20633
|
-
}
|
|
20634
|
-
const full = join29(dir, entry.name);
|
|
20635
|
-
if (entry.isDirectory()) {
|
|
20636
|
-
visit(full);
|
|
20637
|
-
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
20638
|
-
out.push(full);
|
|
20639
|
-
}
|
|
20640
|
-
}
|
|
20641
|
-
};
|
|
20642
|
-
visit(root);
|
|
20643
|
-
return out;
|
|
20644
|
-
}, getStringPropertyValue = (obj, name) => {
|
|
20645
|
-
for (const prop of obj.properties) {
|
|
20646
|
-
if (!ts7.isPropertyAssignment(prop))
|
|
20647
|
-
continue;
|
|
20648
|
-
const propName = ts7.isIdentifier(prop.name) ? prop.name.text : ts7.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
20649
|
-
if (propName !== name)
|
|
20650
|
-
continue;
|
|
20651
|
-
const init = prop.initializer;
|
|
20652
|
-
if (ts7.isStringLiteral(init) || ts7.isNoSubstitutionTemplateLiteral(init)) {
|
|
20653
|
-
return init.text;
|
|
20654
|
-
}
|
|
20655
|
-
}
|
|
20656
|
-
return null;
|
|
20657
|
-
}, getStringArrayProperty = (obj, name) => {
|
|
20658
|
-
const out = [];
|
|
20659
|
-
for (const prop of obj.properties) {
|
|
20660
|
-
if (!ts7.isPropertyAssignment(prop))
|
|
20661
|
-
continue;
|
|
20662
|
-
const propName = ts7.isIdentifier(prop.name) ? prop.name.text : ts7.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
20663
|
-
if (propName !== name)
|
|
20664
|
-
continue;
|
|
20665
|
-
const init = prop.initializer;
|
|
20666
|
-
if (!ts7.isArrayLiteralExpression(init))
|
|
20667
|
-
continue;
|
|
20668
|
-
for (const element of init.elements) {
|
|
20669
|
-
if (ts7.isStringLiteral(element) || ts7.isNoSubstitutionTemplateLiteral(element)) {
|
|
20670
|
-
out.push(element.text);
|
|
20671
|
-
}
|
|
20672
|
-
}
|
|
20673
|
-
}
|
|
20674
|
-
return out;
|
|
20675
|
-
}, parseDecoratedClasses = (filePath) => {
|
|
20676
|
-
let source;
|
|
20677
|
-
try {
|
|
20678
|
-
source = readFileSync19(filePath, "utf8");
|
|
20679
|
-
} catch {
|
|
20680
|
-
return [];
|
|
20681
|
-
}
|
|
20682
|
-
const sourceFile = ts7.createSourceFile(filePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
20683
|
-
const out = [];
|
|
20684
|
-
const visit = (node) => {
|
|
20685
|
-
if (ts7.isClassDeclaration(node) && node.name) {
|
|
20686
|
-
for (const decorator of ts7.getDecorators(node) ?? []) {
|
|
20687
|
-
const expr = decorator.expression;
|
|
20688
|
-
if (!ts7.isCallExpression(expr))
|
|
20689
|
-
continue;
|
|
20690
|
-
const fn2 = expr.expression;
|
|
20691
|
-
if (!ts7.isIdentifier(fn2))
|
|
20692
|
-
continue;
|
|
20693
|
-
const kind = ENTITY_DECORATORS[fn2.text];
|
|
20694
|
-
if (!kind)
|
|
20695
|
-
continue;
|
|
20696
|
-
let extendsName = null;
|
|
20697
|
-
for (const heritage of node.heritageClauses ?? []) {
|
|
20698
|
-
if (heritage.token !== ts7.SyntaxKind.ExtendsKeyword) {
|
|
20699
|
-
continue;
|
|
20700
|
-
}
|
|
20701
|
-
const first = heritage.types[0];
|
|
20702
|
-
if (first && ts7.isIdentifier(first.expression)) {
|
|
20703
|
-
extendsName = first.expression.text;
|
|
20704
|
-
}
|
|
20705
|
-
break;
|
|
20706
|
-
}
|
|
20707
|
-
const entry = {
|
|
20708
|
-
className: node.name.text,
|
|
20709
|
-
kind,
|
|
20710
|
-
styleUrls: [],
|
|
20711
|
-
templateUrls: [],
|
|
20712
|
-
extendsName
|
|
20713
|
-
};
|
|
20714
|
-
const arg = expr.arguments[0];
|
|
20715
|
-
if (arg && ts7.isObjectLiteralExpression(arg) && kind === "component") {
|
|
20716
|
-
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
20717
|
-
if (tplUrl)
|
|
20718
|
-
entry.templateUrls.push(tplUrl);
|
|
20719
|
-
const styleUrl = getStringPropertyValue(arg, "styleUrl");
|
|
20720
|
-
if (styleUrl)
|
|
20721
|
-
entry.styleUrls.push(styleUrl);
|
|
20722
|
-
entry.styleUrls.push(...getStringArrayProperty(arg, "styleUrls"));
|
|
20723
|
-
}
|
|
20724
|
-
out.push(entry);
|
|
20725
|
-
break;
|
|
20726
|
-
}
|
|
20727
|
-
}
|
|
20728
|
-
ts7.forEachChild(node, visit);
|
|
20729
|
-
};
|
|
20730
|
-
visit(sourceFile);
|
|
20731
|
-
return out;
|
|
20732
|
-
}, safeNormalize = (path) => resolve33(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
20733
|
-
const { changedFilePath, userAngularRoot } = params;
|
|
20734
|
-
const changedAbs = safeNormalize(changedFilePath);
|
|
20735
|
-
const out = [];
|
|
20736
|
-
const ext = extname10(changedAbs).toLowerCase();
|
|
20737
|
-
if (ext === ".ts" || ext === ".tsx") {
|
|
20738
|
-
const classes = parseDecoratedClasses(changedAbs);
|
|
20739
|
-
for (const cls of classes) {
|
|
20740
|
-
out.push({
|
|
20741
|
-
className: cls.className,
|
|
20742
|
-
componentFilePath: changedAbs,
|
|
20743
|
-
kind: cls.kind
|
|
20744
|
-
});
|
|
20745
|
-
}
|
|
20746
|
-
return out;
|
|
20747
|
-
}
|
|
20748
|
-
if (ext !== ".html" && ext !== ".css" && ext !== ".scss" && ext !== ".sass") {
|
|
20749
|
-
return out;
|
|
20750
|
-
}
|
|
20751
|
-
let rootStat;
|
|
20752
|
-
try {
|
|
20753
|
-
rootStat = statSync4(userAngularRoot);
|
|
20754
|
-
} catch {
|
|
20755
|
-
return out;
|
|
20756
|
-
}
|
|
20757
|
-
if (!rootStat.isDirectory())
|
|
20758
|
-
return out;
|
|
20759
|
-
const index = getOrBuildResourceIndex(userAngularRoot);
|
|
20760
|
-
const owners = index.get(changedAbs);
|
|
20761
|
-
if (owners) {
|
|
20762
|
-
out.push(...owners);
|
|
20763
|
-
}
|
|
20764
|
-
return out;
|
|
20765
|
-
}, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
|
|
20766
|
-
let source;
|
|
20767
|
-
try {
|
|
20768
|
-
source = readFileSync19(childFilePath, "utf8");
|
|
20769
|
-
} catch {
|
|
20770
|
-
return null;
|
|
20771
|
-
}
|
|
20772
|
-
const sf = ts7.createSourceFile(childFilePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
20773
|
-
const childDir = dirname19(childFilePath);
|
|
20774
|
-
for (const stmt of sf.statements) {
|
|
20775
|
-
if (!ts7.isImportDeclaration(stmt))
|
|
20776
|
-
continue;
|
|
20777
|
-
if (!ts7.isStringLiteral(stmt.moduleSpecifier))
|
|
20778
|
-
continue;
|
|
20779
|
-
const clause = stmt.importClause;
|
|
20780
|
-
if (!clause || clause.isTypeOnly)
|
|
20781
|
-
continue;
|
|
20782
|
-
let matchesName = false;
|
|
20783
|
-
if (clause.name && clause.name.text === parentName)
|
|
20784
|
-
matchesName = true;
|
|
20785
|
-
if (!matchesName && clause.namedBindings && ts7.isNamedImports(clause.namedBindings)) {
|
|
20786
|
-
for (const el of clause.namedBindings.elements) {
|
|
20787
|
-
if (el.isTypeOnly)
|
|
20788
|
-
continue;
|
|
20789
|
-
if (el.name.text === parentName) {
|
|
20790
|
-
matchesName = true;
|
|
20791
|
-
break;
|
|
20792
|
-
}
|
|
20793
|
-
}
|
|
20794
|
-
}
|
|
20795
|
-
if (!matchesName)
|
|
20796
|
-
continue;
|
|
20797
|
-
const spec = stmt.moduleSpecifier.text;
|
|
20798
|
-
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
20799
|
-
return null;
|
|
20800
|
-
}
|
|
20801
|
-
const base = resolve33(childDir, spec);
|
|
20802
|
-
const candidates = [
|
|
20803
|
-
`${base}.ts`,
|
|
20804
|
-
`${base}.tsx`,
|
|
20805
|
-
`${base}/index.ts`,
|
|
20806
|
-
`${base}/index.tsx`
|
|
20807
|
-
];
|
|
20808
|
-
const angularRootNorm = safeNormalize(angularRoot);
|
|
20809
|
-
for (const candidate of candidates) {
|
|
20810
|
-
try {
|
|
20811
|
-
if (statSync4(candidate).isFile()) {
|
|
20812
|
-
const norm = safeNormalize(candidate);
|
|
20813
|
-
if (!norm.startsWith(angularRootNorm))
|
|
20814
|
-
return null;
|
|
20815
|
-
return norm;
|
|
20816
|
-
}
|
|
20817
|
-
} catch {}
|
|
20818
|
-
}
|
|
20819
|
-
return null;
|
|
20820
|
-
}
|
|
20821
|
-
return null;
|
|
20822
|
-
}, getOrBuildIndexes = (userAngularRoot) => {
|
|
20823
|
-
const cached = indexByRoot.get(userAngularRoot);
|
|
20824
|
-
if (cached)
|
|
20825
|
-
return cached;
|
|
20826
|
-
const resource = new Map;
|
|
20827
|
-
const parentFile = new Map;
|
|
20828
|
-
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
20829
|
-
const classes = parseDecoratedClasses(tsPath);
|
|
20830
|
-
const componentDir = dirname19(tsPath);
|
|
20831
|
-
for (const cls of classes) {
|
|
20832
|
-
const entity = {
|
|
20833
|
-
className: cls.className,
|
|
20834
|
-
componentFilePath: tsPath,
|
|
20835
|
-
kind: cls.kind
|
|
20836
|
-
};
|
|
20837
|
-
if (cls.kind === "component") {
|
|
20838
|
-
for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
|
|
20839
|
-
const abs = safeNormalize(resolve33(componentDir, url));
|
|
20840
|
-
const existing = resource.get(abs);
|
|
20841
|
-
if (existing)
|
|
20842
|
-
existing.push(entity);
|
|
20843
|
-
else
|
|
20844
|
-
resource.set(abs, [entity]);
|
|
20845
|
-
}
|
|
20846
|
-
}
|
|
20847
|
-
if (cls.extendsName !== null) {
|
|
20848
|
-
const parentPath = resolveParentClassFile(cls.extendsName, tsPath, userAngularRoot);
|
|
20849
|
-
if (parentPath !== null && parentPath !== safeNormalize(tsPath)) {
|
|
20850
|
-
const existing = parentFile.get(parentPath);
|
|
20851
|
-
if (existing)
|
|
20852
|
-
existing.push(entity);
|
|
20853
|
-
else
|
|
20854
|
-
parentFile.set(parentPath, [entity]);
|
|
20855
|
-
}
|
|
20856
|
-
}
|
|
20857
|
-
}
|
|
20858
|
-
}
|
|
20859
|
-
const bundle = { parentFile, resource };
|
|
20860
|
-
indexByRoot.set(userAngularRoot, bundle);
|
|
20861
|
-
return bundle;
|
|
20862
|
-
}, getOrBuildResourceIndex = (userAngularRoot) => getOrBuildIndexes(userAngularRoot).resource, resolveDescendantsOfParent = (params) => {
|
|
20863
|
-
const norm = safeNormalize(params.changedFilePath);
|
|
20864
|
-
let rootStat;
|
|
20865
|
-
try {
|
|
20866
|
-
rootStat = statSync4(params.userAngularRoot);
|
|
20867
|
-
} catch {
|
|
20868
|
-
return [];
|
|
20869
|
-
}
|
|
20870
|
-
if (!rootStat.isDirectory())
|
|
20871
|
-
return [];
|
|
20872
|
-
const bundle = getOrBuildIndexes(params.userAngularRoot);
|
|
20873
|
-
return bundle.parentFile.get(norm) ?? [];
|
|
20874
|
-
}, invalidateResourceIndex = () => {
|
|
20875
|
-
indexByRoot.clear();
|
|
20876
|
-
};
|
|
20877
|
-
var init_resolveOwningComponents = __esm(() => {
|
|
20878
|
-
ENTITY_DECORATORS = {
|
|
20879
|
-
Component: "component",
|
|
20880
|
-
Directive: "directive",
|
|
20881
|
-
Pipe: "pipe",
|
|
20882
|
-
Injectable: "service"
|
|
20883
|
-
};
|
|
20884
|
-
indexByRoot = new Map;
|
|
20885
|
-
});
|
|
20886
|
-
|
|
20887
20987
|
// src/dev/angular/hmrCompiler.ts
|
|
20888
20988
|
var exports_hmrCompiler = {};
|
|
20889
20989
|
__export(exports_hmrCompiler, {
|
|
@@ -21348,6 +21448,35 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21348
21448
|
for (const importer of findStyleEntriesImporting(changedStylePath)) {
|
|
21349
21449
|
enqueueImporter(state, importer);
|
|
21350
21450
|
}
|
|
21451
|
+
enqueueAngularOwningComponentForStyle(state, changedStylePath);
|
|
21452
|
+
}, enqueueAngularOwningComponentForStyle = (state, changedStylePath) => {
|
|
21453
|
+
const angularDir = state.resolvedPaths.angularDir;
|
|
21454
|
+
if (!angularDir)
|
|
21455
|
+
return;
|
|
21456
|
+
const visited = new Set;
|
|
21457
|
+
const stack = [
|
|
21458
|
+
changedStylePath,
|
|
21459
|
+
...findStyleEntriesImporting(changedStylePath)
|
|
21460
|
+
];
|
|
21461
|
+
while (stack.length > 0) {
|
|
21462
|
+
const stylePath = stack.pop();
|
|
21463
|
+
if (!stylePath || visited.has(stylePath))
|
|
21464
|
+
continue;
|
|
21465
|
+
visited.add(stylePath);
|
|
21466
|
+
for (const upstream of findStyleEntriesImporting(stylePath)) {
|
|
21467
|
+
if (!visited.has(upstream))
|
|
21468
|
+
stack.push(upstream);
|
|
21469
|
+
}
|
|
21470
|
+
try {
|
|
21471
|
+
const owners = resolveOwningComponents({
|
|
21472
|
+
changedFilePath: stylePath,
|
|
21473
|
+
userAngularRoot: angularDir
|
|
21474
|
+
});
|
|
21475
|
+
for (const owner of owners) {
|
|
21476
|
+
enqueueImporter(state, owner.componentFilePath);
|
|
21477
|
+
}
|
|
21478
|
+
} catch {}
|
|
21479
|
+
}
|
|
21351
21480
|
}, queueFileChange = async (state, filePath, config, onRebuildComplete) => {
|
|
21352
21481
|
const framework = detectFramework(filePath, state.resolvedPaths);
|
|
21353
21482
|
if (framework === "ignored") {
|
|
@@ -21361,7 +21490,48 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21361
21490
|
invalidate(resolve37(filePath));
|
|
21362
21491
|
const relPath = relative16(process.cwd(), filePath);
|
|
21363
21492
|
logHmrUpdate(relPath);
|
|
21364
|
-
|
|
21493
|
+
const angularDir = state.resolvedPaths.angularDir;
|
|
21494
|
+
let hasAngularDependent = false;
|
|
21495
|
+
if (angularDir && state.dependencyGraph) {
|
|
21496
|
+
try {
|
|
21497
|
+
const { addFileToGraph: addFileToGraph2 } = await Promise.resolve().then(() => (init_dependencyGraph(), exports_dependencyGraph));
|
|
21498
|
+
addFileToGraph2(state.dependencyGraph, resolve37(filePath));
|
|
21499
|
+
const affected = getAffectedFiles(state.dependencyGraph, resolve37(filePath));
|
|
21500
|
+
for (const dependent of affected) {
|
|
21501
|
+
if (dependent === resolve37(filePath))
|
|
21502
|
+
continue;
|
|
21503
|
+
const dependentFramework = detectFramework(dependent, state.resolvedPaths);
|
|
21504
|
+
if (dependentFramework !== "angular")
|
|
21505
|
+
continue;
|
|
21506
|
+
hasAngularDependent = true;
|
|
21507
|
+
if (!state.fileChangeQueue.has("angular")) {
|
|
21508
|
+
state.fileChangeQueue.set("angular", []);
|
|
21509
|
+
}
|
|
21510
|
+
const angularQueue = state.fileChangeQueue.get("angular");
|
|
21511
|
+
if (angularQueue && !angularQueue.includes(dependent)) {
|
|
21512
|
+
angularQueue.push(dependent);
|
|
21513
|
+
}
|
|
21514
|
+
}
|
|
21515
|
+
} catch {}
|
|
21516
|
+
}
|
|
21517
|
+
if (!hasAngularDependent) {
|
|
21518
|
+
return;
|
|
21519
|
+
}
|
|
21520
|
+
try {
|
|
21521
|
+
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
21522
|
+
const { invalidateModule: invalidateModuleServer } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21523
|
+
const generatedAngularRoot = getFrameworkGeneratedDir2("angular");
|
|
21524
|
+
const sourceAbs = resolve37(filePath).replace(/\\/g, "/");
|
|
21525
|
+
const generatedTwin = `${generatedAngularRoot.replace(/\\/g, "/")}${sourceAbs.replace(/\.ts$/, ".js")}`;
|
|
21526
|
+
invalidateModuleServer(generatedTwin);
|
|
21527
|
+
} catch {}
|
|
21528
|
+
if (!state.fileChangeQueue.has("unknown")) {
|
|
21529
|
+
state.fileChangeQueue.set("unknown", []);
|
|
21530
|
+
}
|
|
21531
|
+
const unknownQueue = state.fileChangeQueue.get("unknown");
|
|
21532
|
+
if (unknownQueue && !unknownQueue.includes(filePath)) {
|
|
21533
|
+
unknownQueue.push(filePath);
|
|
21534
|
+
}
|
|
21365
21535
|
}
|
|
21366
21536
|
if (!state.fileChangeQueue.has(framework)) {
|
|
21367
21537
|
state.fileChangeQueue.set(framework, []);
|
|
@@ -21545,6 +21715,26 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21545
21715
|
break;
|
|
21546
21716
|
}
|
|
21547
21717
|
}
|
|
21718
|
+
for (const editedFile of userEdited) {
|
|
21719
|
+
if (!editedFile.endsWith(".ts"))
|
|
21720
|
+
continue;
|
|
21721
|
+
if (editedFile.endsWith(".d.ts"))
|
|
21722
|
+
continue;
|
|
21723
|
+
const detected = detectFramework(editedFile, state.resolvedPaths);
|
|
21724
|
+
if (detected !== "unknown")
|
|
21725
|
+
continue;
|
|
21726
|
+
try {
|
|
21727
|
+
const affected = getAffectedFiles(state.dependencyGraph, resolve37(editedFile));
|
|
21728
|
+
const hasAngularConsumer = affected.some((dep) => dep !== resolve37(editedFile) && detectFramework(dep, state.resolvedPaths) === "angular");
|
|
21729
|
+
if (hasAngularConsumer) {
|
|
21730
|
+
return {
|
|
21731
|
+
kind: "rebootstrap",
|
|
21732
|
+
reason: `non-angular helper edited (${editedFile}) \u2014 angular dependents need fresh bundle for __abs_deps to point at new exports`,
|
|
21733
|
+
tier: 1
|
|
21734
|
+
};
|
|
21735
|
+
}
|
|
21736
|
+
} catch {}
|
|
21737
|
+
}
|
|
21548
21738
|
const queue = [];
|
|
21549
21739
|
const queueIds = new Set;
|
|
21550
21740
|
let anyFingerprintChanged = false;
|
|
@@ -22982,6 +23172,7 @@ var init_rebuildTrigger = __esm(() => {
|
|
|
22982
23172
|
init_telemetryEvent();
|
|
22983
23173
|
init_assetStore();
|
|
22984
23174
|
init_pathUtils();
|
|
23175
|
+
init_resolveOwningComponents();
|
|
22985
23176
|
init_webSocket();
|
|
22986
23177
|
init_stylePreprocessor();
|
|
22987
23178
|
init_compileTailwind();
|
|
@@ -23643,5 +23834,5 @@ export {
|
|
|
23643
23834
|
build
|
|
23644
23835
|
};
|
|
23645
23836
|
|
|
23646
|
-
//# debugId=
|
|
23837
|
+
//# debugId=DACC30B88A8A516D64756E2164756E21
|
|
23647
23838
|
//# sourceMappingURL=build.js.map
|