@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/index.js
CHANGED
|
@@ -527,6 +527,15 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
527
527
|
url: new URL(`file://${filePath}`)
|
|
528
528
|
});
|
|
529
529
|
const css = await runPostcss(result.css, filePath, config);
|
|
530
|
+
const loadedUrls = result.loadedUrls ?? [];
|
|
531
|
+
for (const url of loadedUrls) {
|
|
532
|
+
if (url.protocol !== "file:")
|
|
533
|
+
continue;
|
|
534
|
+
const dep = fileURLToPath(url);
|
|
535
|
+
if (resolve2(dep) === resolve2(filePath))
|
|
536
|
+
continue;
|
|
537
|
+
deps.add(dep);
|
|
538
|
+
}
|
|
530
539
|
recordStyleDeps(filePath, deps);
|
|
531
540
|
return css;
|
|
532
541
|
} catch (error) {
|
|
@@ -695,7 +704,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
695
704
|
}
|
|
696
705
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
697
706
|
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
698
|
-
const
|
|
707
|
+
const result = sass.compileString(contents, {
|
|
699
708
|
importers: [
|
|
700
709
|
createSassImporter(filePath, loadPaths, language, config)
|
|
701
710
|
],
|
|
@@ -703,8 +712,17 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
703
712
|
style: "expanded",
|
|
704
713
|
syntax: language === "sass" ? "indented" : "scss",
|
|
705
714
|
url: new URL(`file://${filePath}`)
|
|
706
|
-
})
|
|
707
|
-
|
|
715
|
+
});
|
|
716
|
+
const loadedUrls = result.loadedUrls ?? [];
|
|
717
|
+
for (const url of loadedUrls) {
|
|
718
|
+
if (url.protocol !== "file:")
|
|
719
|
+
continue;
|
|
720
|
+
const dep = fileURLToPath(url);
|
|
721
|
+
if (resolve2(dep) === resolve2(filePath))
|
|
722
|
+
continue;
|
|
723
|
+
addStyleImporter(filePath, dep);
|
|
724
|
+
}
|
|
725
|
+
return resolveCssImportsSync(result.css, dirname2(filePath), new Set([filePath]));
|
|
708
726
|
}
|
|
709
727
|
if (language === "less") {
|
|
710
728
|
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.`);
|
|
@@ -13841,6 +13859,12 @@ var fail = (reason, detail, location) => ({
|
|
|
13841
13859
|
return false;
|
|
13842
13860
|
if (a.decoratorOutputsArraySig !== b2.decoratorOutputsArraySig)
|
|
13843
13861
|
return false;
|
|
13862
|
+
if (a.hostBindingsSig !== b2.hostBindingsSig)
|
|
13863
|
+
return false;
|
|
13864
|
+
if (a.pageExportsSig !== b2.pageExportsSig)
|
|
13865
|
+
return false;
|
|
13866
|
+
if (a.schemasSig !== b2.schemasSig)
|
|
13867
|
+
return false;
|
|
13844
13868
|
return true;
|
|
13845
13869
|
}, recordFingerprint = (id, fp) => {
|
|
13846
13870
|
fingerprintCache.set(id, fp);
|
|
@@ -13864,25 +13888,47 @@ var fail = (reason, detail, location) => ({
|
|
|
13864
13888
|
if (!className)
|
|
13865
13889
|
continue;
|
|
13866
13890
|
const decorators = ts6.getDecorators(stmt) ?? [];
|
|
13867
|
-
const
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13891
|
+
const decoratorName = (() => {
|
|
13892
|
+
for (const d2 of decorators) {
|
|
13893
|
+
if (!ts6.isCallExpression(d2.expression))
|
|
13894
|
+
continue;
|
|
13895
|
+
const expr = d2.expression.expression;
|
|
13896
|
+
if (!ts6.isIdentifier(expr))
|
|
13897
|
+
continue;
|
|
13898
|
+
if (expr.text === "Component" || expr.text === "Directive" || expr.text === "Pipe" || expr.text === "Injectable") {
|
|
13899
|
+
return expr.text;
|
|
13900
|
+
}
|
|
13901
|
+
}
|
|
13902
|
+
return null;
|
|
13903
|
+
})();
|
|
13904
|
+
if (!decoratorName)
|
|
13878
13905
|
continue;
|
|
13879
|
-
const decoratorMeta = readDecoratorMeta(args);
|
|
13880
|
-
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
13881
|
-
const componentDir = dirname15(componentFilePath);
|
|
13882
|
-
const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
13883
13906
|
const projectRel = relative12(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
13884
13907
|
const id = encodeURIComponent(`${projectRel}@${className}`);
|
|
13885
|
-
|
|
13908
|
+
if (decoratorName === "Component") {
|
|
13909
|
+
const componentDecorator = decorators.find((d2) => {
|
|
13910
|
+
if (!ts6.isCallExpression(d2.expression))
|
|
13911
|
+
return false;
|
|
13912
|
+
const expr = d2.expression.expression;
|
|
13913
|
+
return ts6.isIdentifier(expr) && expr.text === "Component";
|
|
13914
|
+
});
|
|
13915
|
+
if (!componentDecorator)
|
|
13916
|
+
continue;
|
|
13917
|
+
const decoratorCall = componentDecorator.expression;
|
|
13918
|
+
const args = decoratorCall.arguments[0];
|
|
13919
|
+
if (!args || !ts6.isObjectLiteralExpression(args))
|
|
13920
|
+
continue;
|
|
13921
|
+
const decoratorMeta = readDecoratorMeta(args);
|
|
13922
|
+
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
13923
|
+
const componentDir = dirname15(componentFilePath);
|
|
13924
|
+
const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
13925
|
+
fingerprintCache.set(id, fingerprint);
|
|
13926
|
+
} else {
|
|
13927
|
+
try {
|
|
13928
|
+
const entityFingerprint = extractEntityFingerprint(stmt, className, sourceFile);
|
|
13929
|
+
entityFingerprintCache.set(id, entityFingerprint);
|
|
13930
|
+
} catch {}
|
|
13931
|
+
}
|
|
13886
13932
|
}
|
|
13887
13933
|
}, invalidateFingerprintCache = () => {
|
|
13888
13934
|
fingerprintCache.clear();
|
|
@@ -14137,6 +14183,8 @@ var fail = (reason, detail, location) => ({
|
|
|
14137
14183
|
const viewProvidersExpr = getProperty(args, "viewProviders");
|
|
14138
14184
|
const inputsArrayExpr = getProperty(args, "inputs");
|
|
14139
14185
|
const outputsArrayExpr = getProperty(args, "outputs");
|
|
14186
|
+
const hostExpr = getProperty(args, "host");
|
|
14187
|
+
const schemasExpr = getProperty(args, "schemas");
|
|
14140
14188
|
const styleUrls = [];
|
|
14141
14189
|
if (styleUrlsExpr && ts6.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
14142
14190
|
for (const el of styleUrlsExpr.elements) {
|
|
@@ -14172,6 +14220,8 @@ var fail = (reason, detail, location) => ({
|
|
|
14172
14220
|
viewProvidersExpr: viewProvidersExpr && ts6.isArrayLiteralExpression(viewProvidersExpr) ? viewProvidersExpr : null,
|
|
14173
14221
|
inputsArrayExpr: inputsArrayExpr && ts6.isArrayLiteralExpression(inputsArrayExpr) ? inputsArrayExpr : null,
|
|
14174
14222
|
outputsArrayExpr: outputsArrayExpr && ts6.isArrayLiteralExpression(outputsArrayExpr) ? outputsArrayExpr : null,
|
|
14223
|
+
hostExpr: hostExpr && ts6.isObjectLiteralExpression(hostExpr) ? hostExpr : null,
|
|
14224
|
+
schemasExpr: schemasExpr && ts6.isArrayLiteralExpression(schemasExpr) ? schemasExpr : null,
|
|
14175
14225
|
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? projectDefaults.preserveWhitespaces ?? false,
|
|
14176
14226
|
selector: getStringProperty(args, "selector"),
|
|
14177
14227
|
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
@@ -15187,6 +15237,28 @@ var fail = (reason, detail, location) => ({
|
|
|
15187
15237
|
const viewProvidersArraySig = decoratorMeta.viewProvidersExpr ? djb2Hash(decoratorMeta.viewProvidersExpr.getText()) : "";
|
|
15188
15238
|
const decoratorInputsArraySig = decoratorMeta.inputsArrayExpr ? djb2Hash(decoratorMeta.inputsArrayExpr.getText()) : "";
|
|
15189
15239
|
const decoratorOutputsArraySig = decoratorMeta.outputsArrayExpr ? djb2Hash(decoratorMeta.outputsArrayExpr.getText()) : "";
|
|
15240
|
+
const hostBindingsSig = decoratorMeta.hostExpr ? djb2Hash(decoratorMeta.hostExpr.getText()) : "";
|
|
15241
|
+
const schemasSig = decoratorMeta.schemasExpr ? djb2Hash(decoratorMeta.schemasExpr.getText()) : "";
|
|
15242
|
+
const PAGE_EXPORT_NAMES = new Set(["providers", "routes"]);
|
|
15243
|
+
const pageExportEntries = [];
|
|
15244
|
+
for (const stmt of sourceFile.statements) {
|
|
15245
|
+
if (!ts6.isVariableStatement(stmt))
|
|
15246
|
+
continue;
|
|
15247
|
+
const isExported = stmt.modifiers?.some((m) => m.kind === ts6.SyntaxKind.ExportKeyword);
|
|
15248
|
+
if (!isExported)
|
|
15249
|
+
continue;
|
|
15250
|
+
for (const decl of stmt.declarationList.declarations) {
|
|
15251
|
+
if (!ts6.isIdentifier(decl.name))
|
|
15252
|
+
continue;
|
|
15253
|
+
if (!PAGE_EXPORT_NAMES.has(decl.name.text))
|
|
15254
|
+
continue;
|
|
15255
|
+
if (!decl.initializer)
|
|
15256
|
+
continue;
|
|
15257
|
+
pageExportEntries.push(`${decl.name.text}=${djb2Hash(decl.initializer.getText())}`);
|
|
15258
|
+
}
|
|
15259
|
+
}
|
|
15260
|
+
pageExportEntries.sort();
|
|
15261
|
+
const pageExportsSig = pageExportEntries.length > 0 ? pageExportEntries.join("|") : "";
|
|
15190
15262
|
return {
|
|
15191
15263
|
animationsArraySig,
|
|
15192
15264
|
arrowFieldSig,
|
|
@@ -15198,14 +15270,17 @@ var fail = (reason, detail, location) => ({
|
|
|
15198
15270
|
encapsulation: decoratorMeta.encapsulation,
|
|
15199
15271
|
hasProviders: decoratorMeta.hasProviders,
|
|
15200
15272
|
hasViewProviders: decoratorMeta.hasViewProviders,
|
|
15273
|
+
hostBindingsSig,
|
|
15201
15274
|
hostDirectivesSig,
|
|
15202
15275
|
importsArraySig,
|
|
15203
15276
|
inputs: inputNames,
|
|
15204
15277
|
memberDecoratorSig,
|
|
15205
15278
|
outputs: outputNames,
|
|
15279
|
+
pageExportsSig,
|
|
15206
15280
|
propertyFieldNames,
|
|
15207
15281
|
providerImportSig,
|
|
15208
15282
|
providersArraySig,
|
|
15283
|
+
schemasSig,
|
|
15209
15284
|
selector: decoratorMeta.selector,
|
|
15210
15285
|
standalone: decoratorMeta.standalone,
|
|
15211
15286
|
topLevelImports,
|
|
@@ -15461,7 +15536,7 @@ ${block}
|
|
|
15461
15536
|
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
15462
15537
|
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
15463
15538
|
const fingerprintChanged = cachedFingerprint !== undefined && !fingerprintsEqual(cachedFingerprint, currentFingerprint);
|
|
15464
|
-
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);
|
|
15539
|
+
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);
|
|
15465
15540
|
const sourceFileObj = new compiler.ParseSourceFile(tsSource, componentFilePath);
|
|
15466
15541
|
const zeroLoc = new compiler.ParseLocation(sourceFileObj, 0, 0, 0);
|
|
15467
15542
|
const typeSourceSpan = new compiler.ParseSourceSpan(zeroLoc, zeroLoc);
|
|
@@ -18784,6 +18859,15 @@ var init_buildEmberVendor = __esm(() => {
|
|
|
18784
18859
|
});
|
|
18785
18860
|
|
|
18786
18861
|
// src/dev/dependencyGraph.ts
|
|
18862
|
+
var exports_dependencyGraph = {};
|
|
18863
|
+
__export(exports_dependencyGraph, {
|
|
18864
|
+
removeFileFromGraph: () => removeFileFromGraph,
|
|
18865
|
+
getAffectedFiles: () => getAffectedFiles,
|
|
18866
|
+
extractDependencies: () => extractDependencies,
|
|
18867
|
+
emptyDependencyGraph: () => emptyDependencyGraph,
|
|
18868
|
+
buildInitialDependencyGraph: () => buildInitialDependencyGraph,
|
|
18869
|
+
addFileToGraph: () => addFileToGraph
|
|
18870
|
+
});
|
|
18787
18871
|
import { existsSync as existsSync23, readFileSync as readFileSync16 } from "fs";
|
|
18788
18872
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
18789
18873
|
import { resolve as resolve27 } from "path";
|
|
@@ -19281,6 +19365,22 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
19281
19365
|
if (existsSync24(abs) && !roots.includes(abs))
|
|
19282
19366
|
roots.push(abs);
|
|
19283
19367
|
}
|
|
19368
|
+
try {
|
|
19369
|
+
const { readdirSync: readdirSync2 } = __require("fs");
|
|
19370
|
+
const entries = readdirSync2(cwd2, { withFileTypes: true });
|
|
19371
|
+
for (const entry of entries) {
|
|
19372
|
+
if (!entry.isDirectory())
|
|
19373
|
+
continue;
|
|
19374
|
+
if (entry.name.startsWith("."))
|
|
19375
|
+
continue;
|
|
19376
|
+
const abs = normalizePath(resolve29(cwd2, entry.name));
|
|
19377
|
+
if (roots.includes(abs))
|
|
19378
|
+
continue;
|
|
19379
|
+
if (shouldIgnorePath(abs, resolved))
|
|
19380
|
+
continue;
|
|
19381
|
+
roots.push(abs);
|
|
19382
|
+
}
|
|
19383
|
+
} catch {}
|
|
19284
19384
|
const extraDirs = config.dev?.watchDirs ?? [];
|
|
19285
19385
|
for (const dir of extraDirs)
|
|
19286
19386
|
push(dir);
|
|
@@ -19733,105 +19833,381 @@ var init_moduleMapper = __esm(() => {
|
|
|
19733
19833
|
init_reactComponentClassifier();
|
|
19734
19834
|
});
|
|
19735
19835
|
|
|
19736
|
-
// src/dev/
|
|
19737
|
-
var
|
|
19738
|
-
|
|
19739
|
-
|
|
19740
|
-
|
|
19741
|
-
|
|
19742
|
-
|
|
19743
|
-
|
|
19744
|
-
|
|
19745
|
-
|
|
19746
|
-
|
|
19747
|
-
|
|
19748
|
-
|
|
19749
|
-
|
|
19750
|
-
|
|
19836
|
+
// src/dev/angular/resolveOwningComponents.ts
|
|
19837
|
+
var exports_resolveOwningComponents = {};
|
|
19838
|
+
__export(exports_resolveOwningComponents, {
|
|
19839
|
+
resolveOwningComponents: () => resolveOwningComponents,
|
|
19840
|
+
resolveDescendantsOfParent: () => resolveDescendantsOfParent,
|
|
19841
|
+
invalidateResourceIndex: () => invalidateResourceIndex
|
|
19842
|
+
});
|
|
19843
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync19, statSync as statSync3 } from "fs";
|
|
19844
|
+
import { dirname as dirname19, extname as extname9, join as join29, resolve as resolve34 } from "path";
|
|
19845
|
+
import ts7 from "typescript";
|
|
19846
|
+
var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") || file5.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
19847
|
+
const out = [];
|
|
19848
|
+
const visit = (dir) => {
|
|
19849
|
+
let entries;
|
|
19850
|
+
try {
|
|
19851
|
+
entries = readdirSync2(dir, { withFileTypes: true });
|
|
19852
|
+
} catch {
|
|
19853
|
+
return;
|
|
19854
|
+
}
|
|
19855
|
+
for (const entry of entries) {
|
|
19856
|
+
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
19857
|
+
continue;
|
|
19858
|
+
}
|
|
19859
|
+
const full = join29(dir, entry.name);
|
|
19860
|
+
if (entry.isDirectory()) {
|
|
19861
|
+
visit(full);
|
|
19862
|
+
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
19863
|
+
out.push(full);
|
|
19864
|
+
}
|
|
19865
|
+
}
|
|
19751
19866
|
};
|
|
19752
|
-
|
|
19753
|
-
|
|
19754
|
-
|
|
19755
|
-
|
|
19756
|
-
|
|
19757
|
-
|
|
19758
|
-
|
|
19759
|
-
|
|
19760
|
-
|
|
19761
|
-
|
|
19762
|
-
|
|
19763
|
-
|
|
19764
|
-
|
|
19765
|
-
manifest,
|
|
19766
|
-
serverVersions
|
|
19767
|
-
},
|
|
19768
|
-
timestamp: Date.now(),
|
|
19769
|
-
type: "manifest"
|
|
19770
|
-
}));
|
|
19771
|
-
client2.send(JSON.stringify({
|
|
19772
|
-
message: "HMR client connected successfully",
|
|
19773
|
-
timestamp: Date.now(),
|
|
19774
|
-
type: "connected"
|
|
19775
|
-
}));
|
|
19776
|
-
}, handleClientDisconnect = (state, client2) => {
|
|
19777
|
-
state.connectedClients.delete(client2);
|
|
19778
|
-
}, parseJsonSafe = (raw) => JSON.parse(raw), parseMessage = (message) => {
|
|
19779
|
-
if (typeof message === "string") {
|
|
19780
|
-
return parseJsonSafe(message);
|
|
19781
|
-
}
|
|
19782
|
-
if (message instanceof Buffer) {
|
|
19783
|
-
return parseJsonSafe(message.toString());
|
|
19784
|
-
}
|
|
19785
|
-
if (message instanceof ArrayBuffer) {
|
|
19786
|
-
return parseJsonSafe(new TextDecoder().decode(new Uint8Array(message)));
|
|
19787
|
-
}
|
|
19788
|
-
if (ArrayBuffer.isView(message)) {
|
|
19789
|
-
const view = new Uint8Array(message.buffer, message.byteOffset, message.byteLength);
|
|
19790
|
-
return parseJsonSafe(new TextDecoder().decode(view));
|
|
19791
|
-
}
|
|
19792
|
-
if (typeof message === "object" && message !== null) {
|
|
19793
|
-
return message;
|
|
19867
|
+
visit(root);
|
|
19868
|
+
return out;
|
|
19869
|
+
}, getStringPropertyValue = (obj, name) => {
|
|
19870
|
+
for (const prop of obj.properties) {
|
|
19871
|
+
if (!ts7.isPropertyAssignment(prop))
|
|
19872
|
+
continue;
|
|
19873
|
+
const propName = ts7.isIdentifier(prop.name) ? prop.name.text : ts7.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
19874
|
+
if (propName !== name)
|
|
19875
|
+
continue;
|
|
19876
|
+
const init = prop.initializer;
|
|
19877
|
+
if (ts7.isStringLiteral(init) || ts7.isNoSubstitutionTemplateLiteral(init)) {
|
|
19878
|
+
return init.text;
|
|
19879
|
+
}
|
|
19794
19880
|
}
|
|
19795
19881
|
return null;
|
|
19796
|
-
},
|
|
19797
|
-
|
|
19798
|
-
|
|
19799
|
-
|
|
19800
|
-
|
|
19801
|
-
|
|
19802
|
-
|
|
19803
|
-
|
|
19804
|
-
|
|
19805
|
-
|
|
19806
|
-
|
|
19807
|
-
|
|
19808
|
-
|
|
19882
|
+
}, getStringArrayProperty = (obj, name) => {
|
|
19883
|
+
const out = [];
|
|
19884
|
+
for (const prop of obj.properties) {
|
|
19885
|
+
if (!ts7.isPropertyAssignment(prop))
|
|
19886
|
+
continue;
|
|
19887
|
+
const propName = ts7.isIdentifier(prop.name) ? prop.name.text : ts7.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
19888
|
+
if (propName !== name)
|
|
19889
|
+
continue;
|
|
19890
|
+
const init = prop.initializer;
|
|
19891
|
+
if (!ts7.isArrayLiteralExpression(init))
|
|
19892
|
+
continue;
|
|
19893
|
+
for (const element of init.elements) {
|
|
19894
|
+
if (ts7.isStringLiteral(element) || ts7.isNoSubstitutionTemplateLiteral(element)) {
|
|
19895
|
+
out.push(element.text);
|
|
19809
19896
|
}
|
|
19810
|
-
break;
|
|
19811
|
-
case "hmr-timing":
|
|
19812
|
-
logHmrUpdate(state.lastHmrPath ?? "", state.lastHmrFramework, data.duration);
|
|
19813
|
-
break;
|
|
19814
|
-
case "angular:hmr-ack": {
|
|
19815
|
-
const tag = data.tier === "tier-0" ? "tier-0" : "tier-1a";
|
|
19816
|
-
const suffix = data.error ? ` FAILED \u2014 ${data.error}` : ` applied in ${data.applyMs.toFixed(0)}ms`;
|
|
19817
|
-
logInfo(`[ng-hmr] ${tag} ${data.className}${suffix}`);
|
|
19818
|
-
break;
|
|
19819
19897
|
}
|
|
19820
19898
|
}
|
|
19821
|
-
|
|
19899
|
+
return out;
|
|
19900
|
+
}, parseDecoratedClasses = (filePath) => {
|
|
19901
|
+
let source;
|
|
19822
19902
|
try {
|
|
19823
|
-
|
|
19824
|
-
|
|
19825
|
-
|
|
19903
|
+
source = readFileSync19(filePath, "utf8");
|
|
19904
|
+
} catch {
|
|
19905
|
+
return [];
|
|
19906
|
+
}
|
|
19907
|
+
const sourceFile = ts7.createSourceFile(filePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
19908
|
+
const out = [];
|
|
19909
|
+
const visit = (node) => {
|
|
19910
|
+
if (ts7.isClassDeclaration(node) && node.name) {
|
|
19911
|
+
for (const decorator of ts7.getDecorators(node) ?? []) {
|
|
19912
|
+
const expr = decorator.expression;
|
|
19913
|
+
if (!ts7.isCallExpression(expr))
|
|
19914
|
+
continue;
|
|
19915
|
+
const fn2 = expr.expression;
|
|
19916
|
+
if (!ts7.isIdentifier(fn2))
|
|
19917
|
+
continue;
|
|
19918
|
+
const kind = ENTITY_DECORATORS[fn2.text];
|
|
19919
|
+
if (!kind)
|
|
19920
|
+
continue;
|
|
19921
|
+
let extendsName = null;
|
|
19922
|
+
for (const heritage of node.heritageClauses ?? []) {
|
|
19923
|
+
if (heritage.token !== ts7.SyntaxKind.ExtendsKeyword) {
|
|
19924
|
+
continue;
|
|
19925
|
+
}
|
|
19926
|
+
const first = heritage.types[0];
|
|
19927
|
+
if (first && ts7.isIdentifier(first.expression)) {
|
|
19928
|
+
extendsName = first.expression.text;
|
|
19929
|
+
}
|
|
19930
|
+
break;
|
|
19931
|
+
}
|
|
19932
|
+
const entry = {
|
|
19933
|
+
className: node.name.text,
|
|
19934
|
+
kind,
|
|
19935
|
+
styleUrls: [],
|
|
19936
|
+
templateUrls: [],
|
|
19937
|
+
extendsName
|
|
19938
|
+
};
|
|
19939
|
+
const arg = expr.arguments[0];
|
|
19940
|
+
if (arg && ts7.isObjectLiteralExpression(arg) && kind === "component") {
|
|
19941
|
+
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
19942
|
+
if (tplUrl)
|
|
19943
|
+
entry.templateUrls.push(tplUrl);
|
|
19944
|
+
const styleUrl = getStringPropertyValue(arg, "styleUrl");
|
|
19945
|
+
if (styleUrl)
|
|
19946
|
+
entry.styleUrls.push(styleUrl);
|
|
19947
|
+
entry.styleUrls.push(...getStringArrayProperty(arg, "styleUrls"));
|
|
19948
|
+
}
|
|
19949
|
+
out.push(entry);
|
|
19950
|
+
break;
|
|
19951
|
+
}
|
|
19826
19952
|
}
|
|
19827
|
-
|
|
19828
|
-
|
|
19953
|
+
ts7.forEachChild(node, visit);
|
|
19954
|
+
};
|
|
19955
|
+
visit(sourceFile);
|
|
19956
|
+
return out;
|
|
19957
|
+
}, safeNormalize = (path) => resolve34(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
19958
|
+
const { changedFilePath, userAngularRoot } = params;
|
|
19959
|
+
const changedAbs = safeNormalize(changedFilePath);
|
|
19960
|
+
const out = [];
|
|
19961
|
+
const ext = extname9(changedAbs).toLowerCase();
|
|
19962
|
+
if (ext === ".ts" || ext === ".tsx") {
|
|
19963
|
+
const classes = parseDecoratedClasses(changedAbs);
|
|
19964
|
+
for (const cls of classes) {
|
|
19965
|
+
out.push({
|
|
19966
|
+
className: cls.className,
|
|
19967
|
+
componentFilePath: changedAbs,
|
|
19968
|
+
kind: cls.kind
|
|
19969
|
+
});
|
|
19829
19970
|
}
|
|
19830
|
-
|
|
19831
|
-
}
|
|
19832
|
-
|
|
19833
|
-
|
|
19834
|
-
|
|
19971
|
+
return out;
|
|
19972
|
+
}
|
|
19973
|
+
if (ext !== ".html" && ext !== ".css" && ext !== ".scss" && ext !== ".sass") {
|
|
19974
|
+
return out;
|
|
19975
|
+
}
|
|
19976
|
+
let rootStat;
|
|
19977
|
+
try {
|
|
19978
|
+
rootStat = statSync3(userAngularRoot);
|
|
19979
|
+
} catch {
|
|
19980
|
+
return out;
|
|
19981
|
+
}
|
|
19982
|
+
if (!rootStat.isDirectory())
|
|
19983
|
+
return out;
|
|
19984
|
+
const index = getOrBuildResourceIndex(userAngularRoot);
|
|
19985
|
+
const owners = index.get(changedAbs);
|
|
19986
|
+
if (owners) {
|
|
19987
|
+
out.push(...owners);
|
|
19988
|
+
}
|
|
19989
|
+
return out;
|
|
19990
|
+
}, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
|
|
19991
|
+
let source;
|
|
19992
|
+
try {
|
|
19993
|
+
source = readFileSync19(childFilePath, "utf8");
|
|
19994
|
+
} catch {
|
|
19995
|
+
return null;
|
|
19996
|
+
}
|
|
19997
|
+
const sf = ts7.createSourceFile(childFilePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
19998
|
+
const childDir = dirname19(childFilePath);
|
|
19999
|
+
for (const stmt of sf.statements) {
|
|
20000
|
+
if (!ts7.isImportDeclaration(stmt))
|
|
20001
|
+
continue;
|
|
20002
|
+
if (!ts7.isStringLiteral(stmt.moduleSpecifier))
|
|
20003
|
+
continue;
|
|
20004
|
+
const clause = stmt.importClause;
|
|
20005
|
+
if (!clause || clause.isTypeOnly)
|
|
20006
|
+
continue;
|
|
20007
|
+
let matchesName = false;
|
|
20008
|
+
if (clause.name && clause.name.text === parentName)
|
|
20009
|
+
matchesName = true;
|
|
20010
|
+
if (!matchesName && clause.namedBindings && ts7.isNamedImports(clause.namedBindings)) {
|
|
20011
|
+
for (const el of clause.namedBindings.elements) {
|
|
20012
|
+
if (el.isTypeOnly)
|
|
20013
|
+
continue;
|
|
20014
|
+
if (el.name.text === parentName) {
|
|
20015
|
+
matchesName = true;
|
|
20016
|
+
break;
|
|
20017
|
+
}
|
|
20018
|
+
}
|
|
20019
|
+
}
|
|
20020
|
+
if (!matchesName)
|
|
20021
|
+
continue;
|
|
20022
|
+
const spec = stmt.moduleSpecifier.text;
|
|
20023
|
+
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
20024
|
+
return null;
|
|
20025
|
+
}
|
|
20026
|
+
const base = resolve34(childDir, spec);
|
|
20027
|
+
const candidates = [
|
|
20028
|
+
`${base}.ts`,
|
|
20029
|
+
`${base}.tsx`,
|
|
20030
|
+
`${base}/index.ts`,
|
|
20031
|
+
`${base}/index.tsx`
|
|
20032
|
+
];
|
|
20033
|
+
const angularRootNorm = safeNormalize(angularRoot);
|
|
20034
|
+
for (const candidate of candidates) {
|
|
20035
|
+
try {
|
|
20036
|
+
if (statSync3(candidate).isFile()) {
|
|
20037
|
+
const norm = safeNormalize(candidate);
|
|
20038
|
+
if (!norm.startsWith(angularRootNorm))
|
|
20039
|
+
return null;
|
|
20040
|
+
return norm;
|
|
20041
|
+
}
|
|
20042
|
+
} catch {}
|
|
20043
|
+
}
|
|
20044
|
+
return null;
|
|
20045
|
+
}
|
|
20046
|
+
return null;
|
|
20047
|
+
}, getOrBuildIndexes = (userAngularRoot) => {
|
|
20048
|
+
const cached = indexByRoot.get(userAngularRoot);
|
|
20049
|
+
if (cached)
|
|
20050
|
+
return cached;
|
|
20051
|
+
const resource = new Map;
|
|
20052
|
+
const parentFile = new Map;
|
|
20053
|
+
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
20054
|
+
const classes = parseDecoratedClasses(tsPath);
|
|
20055
|
+
const componentDir = dirname19(tsPath);
|
|
20056
|
+
for (const cls of classes) {
|
|
20057
|
+
const entity = {
|
|
20058
|
+
className: cls.className,
|
|
20059
|
+
componentFilePath: tsPath,
|
|
20060
|
+
kind: cls.kind
|
|
20061
|
+
};
|
|
20062
|
+
if (cls.kind === "component") {
|
|
20063
|
+
for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
|
|
20064
|
+
const abs = safeNormalize(resolve34(componentDir, url));
|
|
20065
|
+
const existing = resource.get(abs);
|
|
20066
|
+
if (existing)
|
|
20067
|
+
existing.push(entity);
|
|
20068
|
+
else
|
|
20069
|
+
resource.set(abs, [entity]);
|
|
20070
|
+
}
|
|
20071
|
+
}
|
|
20072
|
+
if (cls.extendsName !== null) {
|
|
20073
|
+
const parentPath = resolveParentClassFile(cls.extendsName, tsPath, userAngularRoot);
|
|
20074
|
+
if (parentPath !== null && parentPath !== safeNormalize(tsPath)) {
|
|
20075
|
+
const existing = parentFile.get(parentPath);
|
|
20076
|
+
if (existing)
|
|
20077
|
+
existing.push(entity);
|
|
20078
|
+
else
|
|
20079
|
+
parentFile.set(parentPath, [entity]);
|
|
20080
|
+
}
|
|
20081
|
+
}
|
|
20082
|
+
}
|
|
20083
|
+
}
|
|
20084
|
+
const bundle = { parentFile, resource };
|
|
20085
|
+
indexByRoot.set(userAngularRoot, bundle);
|
|
20086
|
+
return bundle;
|
|
20087
|
+
}, getOrBuildResourceIndex = (userAngularRoot) => getOrBuildIndexes(userAngularRoot).resource, resolveDescendantsOfParent = (params) => {
|
|
20088
|
+
const norm = safeNormalize(params.changedFilePath);
|
|
20089
|
+
let rootStat;
|
|
20090
|
+
try {
|
|
20091
|
+
rootStat = statSync3(params.userAngularRoot);
|
|
20092
|
+
} catch {
|
|
20093
|
+
return [];
|
|
20094
|
+
}
|
|
20095
|
+
if (!rootStat.isDirectory())
|
|
20096
|
+
return [];
|
|
20097
|
+
const bundle = getOrBuildIndexes(params.userAngularRoot);
|
|
20098
|
+
return bundle.parentFile.get(norm) ?? [];
|
|
20099
|
+
}, invalidateResourceIndex = () => {
|
|
20100
|
+
indexByRoot.clear();
|
|
20101
|
+
};
|
|
20102
|
+
var init_resolveOwningComponents = __esm(() => {
|
|
20103
|
+
ENTITY_DECORATORS = {
|
|
20104
|
+
Component: "component",
|
|
20105
|
+
Directive: "directive",
|
|
20106
|
+
Pipe: "pipe",
|
|
20107
|
+
Injectable: "service"
|
|
20108
|
+
};
|
|
20109
|
+
indexByRoot = new Map;
|
|
20110
|
+
});
|
|
20111
|
+
|
|
20112
|
+
// src/dev/webSocket.ts
|
|
20113
|
+
var trySendMessage = (client2, messageStr) => {
|
|
20114
|
+
try {
|
|
20115
|
+
client2.send(messageStr);
|
|
20116
|
+
return true;
|
|
20117
|
+
} catch {
|
|
20118
|
+
return false;
|
|
20119
|
+
}
|
|
20120
|
+
}, broadcastToClients = (state, message) => {
|
|
20121
|
+
const messageStr = JSON.stringify({
|
|
20122
|
+
...message,
|
|
20123
|
+
timestamp: Date.now()
|
|
20124
|
+
});
|
|
20125
|
+
const shouldRemove = (client2) => {
|
|
20126
|
+
return !trySendMessage(client2, messageStr);
|
|
20127
|
+
};
|
|
20128
|
+
const clientsToRemove = [];
|
|
20129
|
+
state.connectedClients.forEach((client2) => {
|
|
20130
|
+
if (shouldRemove(client2))
|
|
20131
|
+
clientsToRemove.push(client2);
|
|
20132
|
+
});
|
|
20133
|
+
clientsToRemove.forEach((client2) => {
|
|
20134
|
+
state.connectedClients.delete(client2);
|
|
20135
|
+
});
|
|
20136
|
+
}, handleClientConnect = (state, client2, manifest) => {
|
|
20137
|
+
state.connectedClients.add(client2);
|
|
20138
|
+
const serverVersions = serializeModuleVersions(state.moduleVersions);
|
|
20139
|
+
client2.send(JSON.stringify({
|
|
20140
|
+
data: {
|
|
20141
|
+
manifest,
|
|
20142
|
+
serverVersions
|
|
20143
|
+
},
|
|
20144
|
+
timestamp: Date.now(),
|
|
20145
|
+
type: "manifest"
|
|
20146
|
+
}));
|
|
20147
|
+
client2.send(JSON.stringify({
|
|
20148
|
+
message: "HMR client connected successfully",
|
|
20149
|
+
timestamp: Date.now(),
|
|
20150
|
+
type: "connected"
|
|
20151
|
+
}));
|
|
20152
|
+
}, handleClientDisconnect = (state, client2) => {
|
|
20153
|
+
state.connectedClients.delete(client2);
|
|
20154
|
+
}, parseJsonSafe = (raw) => JSON.parse(raw), parseMessage = (message) => {
|
|
20155
|
+
if (typeof message === "string") {
|
|
20156
|
+
return parseJsonSafe(message);
|
|
20157
|
+
}
|
|
20158
|
+
if (message instanceof Buffer) {
|
|
20159
|
+
return parseJsonSafe(message.toString());
|
|
20160
|
+
}
|
|
20161
|
+
if (message instanceof ArrayBuffer) {
|
|
20162
|
+
return parseJsonSafe(new TextDecoder().decode(new Uint8Array(message)));
|
|
20163
|
+
}
|
|
20164
|
+
if (ArrayBuffer.isView(message)) {
|
|
20165
|
+
const view = new Uint8Array(message.buffer, message.byteOffset, message.byteLength);
|
|
20166
|
+
return parseJsonSafe(new TextDecoder().decode(view));
|
|
20167
|
+
}
|
|
20168
|
+
if (typeof message === "object" && message !== null) {
|
|
20169
|
+
return message;
|
|
20170
|
+
}
|
|
20171
|
+
return null;
|
|
20172
|
+
}, handleParsedMessage = (state, client2, data) => {
|
|
20173
|
+
switch (data.type) {
|
|
20174
|
+
case "ping":
|
|
20175
|
+
client2.send(JSON.stringify({
|
|
20176
|
+
timestamp: Date.now(),
|
|
20177
|
+
type: "pong"
|
|
20178
|
+
}));
|
|
20179
|
+
break;
|
|
20180
|
+
case "request-rebuild":
|
|
20181
|
+
break;
|
|
20182
|
+
case "ready":
|
|
20183
|
+
if (data.framework) {
|
|
20184
|
+
state.activeFrameworks.add(data.framework);
|
|
20185
|
+
}
|
|
20186
|
+
break;
|
|
20187
|
+
case "hmr-timing":
|
|
20188
|
+
logHmrUpdate(state.lastHmrPath ?? "", state.lastHmrFramework, data.duration);
|
|
20189
|
+
break;
|
|
20190
|
+
case "angular:hmr-ack": {
|
|
20191
|
+
const tag = data.tier === "tier-0" ? "tier-0" : "tier-1a";
|
|
20192
|
+
const suffix = data.error ? ` FAILED \u2014 ${data.error}` : ` applied in ${data.applyMs.toFixed(0)}ms`;
|
|
20193
|
+
logInfo(`[ng-hmr] ${tag} ${data.className}${suffix}`);
|
|
20194
|
+
break;
|
|
20195
|
+
}
|
|
20196
|
+
}
|
|
20197
|
+
}, handleHMRMessage = (state, client2, message) => {
|
|
20198
|
+
try {
|
|
20199
|
+
const parsedData = parseMessage(message);
|
|
20200
|
+
if (parsedData === null) {
|
|
20201
|
+
return;
|
|
20202
|
+
}
|
|
20203
|
+
if (!isValidHMRClientMessage(parsedData)) {
|
|
20204
|
+
return;
|
|
20205
|
+
}
|
|
20206
|
+
handleParsedMessage(state, client2, parsedData);
|
|
20207
|
+
} catch {}
|
|
20208
|
+
};
|
|
20209
|
+
var init_webSocket = __esm(() => {
|
|
20210
|
+
init_logger();
|
|
19835
20211
|
});
|
|
19836
20212
|
|
|
19837
20213
|
// src/core/ssrCache.ts
|
|
@@ -19853,8 +20229,8 @@ __export(exports_moduleServer, {
|
|
|
19853
20229
|
createModuleServer: () => createModuleServer,
|
|
19854
20230
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
19855
20231
|
});
|
|
19856
|
-
import { existsSync as existsSync26, readFileSync as
|
|
19857
|
-
import { basename as basename11, dirname as
|
|
20232
|
+
import { existsSync as existsSync26, readFileSync as readFileSync20, statSync as statSync4 } from "fs";
|
|
20233
|
+
import { basename as basename11, dirname as dirname20, extname as extname10, join as join30, resolve as resolve35, relative as relative14 } from "path";
|
|
19858
20234
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
19859
20235
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
19860
20236
|
const allExports = [];
|
|
@@ -19874,7 +20250,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
19874
20250
|
${stubs}
|
|
19875
20251
|
`;
|
|
19876
20252
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
19877
|
-
const found = extensions.find((ext) => existsSync26(
|
|
20253
|
+
const found = extensions.find((ext) => existsSync26(resolve35(projectRoot, srcPath + ext)));
|
|
19878
20254
|
return found ? srcPath + found : srcPath;
|
|
19879
20255
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
19880
20256
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -19889,24 +20265,24 @@ ${stubs}
|
|
|
19889
20265
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
19890
20266
|
}, srcUrl = (relPath, projectRoot) => {
|
|
19891
20267
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
19892
|
-
const absPath =
|
|
20268
|
+
const absPath = resolve35(projectRoot, relPath);
|
|
19893
20269
|
const cached = mtimeCache.get(absPath);
|
|
19894
20270
|
if (cached !== undefined)
|
|
19895
20271
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
19896
20272
|
try {
|
|
19897
|
-
const mtime = Math.round(
|
|
20273
|
+
const mtime = Math.round(statSync4(absPath).mtimeMs);
|
|
19898
20274
|
mtimeCache.set(absPath, mtime);
|
|
19899
20275
|
return `${base}?v=${buildVersion(mtime, absPath)}`;
|
|
19900
20276
|
} catch {
|
|
19901
20277
|
return base;
|
|
19902
20278
|
}
|
|
19903
20279
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
19904
|
-
const absPath =
|
|
20280
|
+
const absPath = resolve35(fileDir, relPath);
|
|
19905
20281
|
const rel = relative14(projectRoot, absPath);
|
|
19906
|
-
const extension =
|
|
20282
|
+
const extension = extname10(rel);
|
|
19907
20283
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
19908
|
-
if (
|
|
19909
|
-
srcPath = relative14(projectRoot, resolveSvelteModulePath(
|
|
20284
|
+
if (extname10(srcPath) === ".svelte") {
|
|
20285
|
+
srcPath = relative14(projectRoot, resolveSvelteModulePath(resolve35(projectRoot, srcPath)));
|
|
19910
20286
|
}
|
|
19911
20287
|
return srcUrl(srcPath, projectRoot);
|
|
19912
20288
|
}, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -19925,13 +20301,13 @@ ${stubs}
|
|
|
19925
20301
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
19926
20302
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
19927
20303
|
if (!subpath) {
|
|
19928
|
-
const pkgDir =
|
|
19929
|
-
const pkgJsonPath =
|
|
20304
|
+
const pkgDir = resolve35(projectRoot, "node_modules", packageName ?? "");
|
|
20305
|
+
const pkgJsonPath = join30(pkgDir, "package.json");
|
|
19930
20306
|
if (existsSync26(pkgJsonPath)) {
|
|
19931
|
-
const pkg = JSON.parse(
|
|
20307
|
+
const pkg = JSON.parse(readFileSync20(pkgJsonPath, "utf-8"));
|
|
19932
20308
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
19933
20309
|
if (esmEntry) {
|
|
19934
|
-
const resolved =
|
|
20310
|
+
const resolved = resolve35(pkgDir, esmEntry);
|
|
19935
20311
|
if (existsSync26(resolved))
|
|
19936
20312
|
return relative14(projectRoot, resolved);
|
|
19937
20313
|
}
|
|
@@ -19963,7 +20339,7 @@ ${stubs}
|
|
|
19963
20339
|
};
|
|
19964
20340
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
19965
20341
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
19966
|
-
const fileDir =
|
|
20342
|
+
const fileDir = dirname20(filePath);
|
|
19967
20343
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
19968
20344
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
19969
20345
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
@@ -19978,12 +20354,12 @@ ${stubs}
|
|
|
19978
20354
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
|
|
19979
20355
|
result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
|
|
19980
20356
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
19981
|
-
const absPath =
|
|
20357
|
+
const absPath = resolve35(fileDir, relPath);
|
|
19982
20358
|
const rel = relative14(projectRoot, absPath);
|
|
19983
20359
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
19984
20360
|
});
|
|
19985
20361
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
19986
|
-
const absPath =
|
|
20362
|
+
const absPath = resolve35(fileDir, relPath);
|
|
19987
20363
|
const rel = relative14(projectRoot, absPath);
|
|
19988
20364
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
19989
20365
|
});
|
|
@@ -20029,7 +20405,7 @@ ${code}`;
|
|
|
20029
20405
|
reactFastRefreshWarningEmitted = true;
|
|
20030
20406
|
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.");
|
|
20031
20407
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
20032
|
-
const raw =
|
|
20408
|
+
const raw = readFileSync20(filePath, "utf-8");
|
|
20033
20409
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
20034
20410
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
20035
20411
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -20045,8 +20421,8 @@ ${transpiled}`;
|
|
|
20045
20421
|
transpiled += buildIslandMetadataExports(raw);
|
|
20046
20422
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
20047
20423
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
20048
|
-
const raw =
|
|
20049
|
-
const ext =
|
|
20424
|
+
const raw = readFileSync20(filePath, "utf-8");
|
|
20425
|
+
const ext = extname10(filePath);
|
|
20050
20426
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
20051
20427
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
20052
20428
|
let transpiler6 = jsTranspiler2;
|
|
@@ -20211,7 +20587,7 @@ ${code}`;
|
|
|
20211
20587
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
20212
20588
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
20213
20589
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
20214
|
-
const raw =
|
|
20590
|
+
const raw = readFileSync20(filePath, "utf-8");
|
|
20215
20591
|
if (!svelteCompiler) {
|
|
20216
20592
|
svelteCompiler = await import("svelte/compiler");
|
|
20217
20593
|
}
|
|
@@ -20273,7 +20649,7 @@ export default __script__;`;
|
|
|
20273
20649
|
return `${cssInjection}
|
|
20274
20650
|
${code}`;
|
|
20275
20651
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
20276
|
-
const rawSource =
|
|
20652
|
+
const rawSource = readFileSync20(filePath, "utf-8");
|
|
20277
20653
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
20278
20654
|
if (!vueCompiler) {
|
|
20279
20655
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
@@ -20296,7 +20672,7 @@ ${code}`;
|
|
|
20296
20672
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
20297
20673
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
20298
20674
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
20299
|
-
const hmrBase = vueDir ?
|
|
20675
|
+
const hmrBase = vueDir ? resolve35(vueDir) : projectRoot;
|
|
20300
20676
|
const hmrId = relative14(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
20301
20677
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
20302
20678
|
result += [
|
|
@@ -20328,7 +20704,7 @@ ${code}`;
|
|
|
20328
20704
|
}
|
|
20329
20705
|
});
|
|
20330
20706
|
}, handleCssRequest = (filePath) => {
|
|
20331
|
-
const raw =
|
|
20707
|
+
const raw = readFileSync20(filePath, "utf-8");
|
|
20332
20708
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
20333
20709
|
return [
|
|
20334
20710
|
`const style = document.createElement('style');`,
|
|
@@ -20460,8 +20836,8 @@ export default {};
|
|
|
20460
20836
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
20461
20837
|
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);`);
|
|
20462
20838
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
20463
|
-
const filePath =
|
|
20464
|
-
const ext =
|
|
20839
|
+
const filePath = resolve35(projectRoot, relPath);
|
|
20840
|
+
const ext = extname10(filePath);
|
|
20465
20841
|
if (ext === ".svelte")
|
|
20466
20842
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
20467
20843
|
if (ext)
|
|
@@ -20486,8 +20862,8 @@ export default {};
|
|
|
20486
20862
|
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
20487
20863
|
if (!TRANSPILABLE.has(ext))
|
|
20488
20864
|
return;
|
|
20489
|
-
const stat3 =
|
|
20490
|
-
const resolvedVueDir = vueDir ?
|
|
20865
|
+
const stat3 = statSync4(filePath);
|
|
20866
|
+
const resolvedVueDir = vueDir ? resolve35(vueDir) : undefined;
|
|
20491
20867
|
let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
20492
20868
|
const isAngularGeneratedJs = ext === ".js" && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
|
|
20493
20869
|
if (isAngularGeneratedJs) {
|
|
@@ -20514,12 +20890,12 @@ export default {};
|
|
|
20514
20890
|
cachedAngularUserRoot = configuredAngularUserRoot ?? null;
|
|
20515
20891
|
return cachedAngularUserRoot;
|
|
20516
20892
|
}, configuredAngularUserRoot, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
20517
|
-
const stat3 =
|
|
20893
|
+
const stat3 = statSync4(filePath);
|
|
20518
20894
|
const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
20519
20895
|
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
20520
20896
|
return jsResponse(content);
|
|
20521
20897
|
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
20522
|
-
const stat3 =
|
|
20898
|
+
const stat3 = statSync4(filePath);
|
|
20523
20899
|
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
20524
20900
|
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
20525
20901
|
return jsResponse(content);
|
|
@@ -20546,7 +20922,7 @@ export default {};
|
|
|
20546
20922
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
20547
20923
|
if (relPath === "bun:wrap" || relPath.startsWith("bun:wrap?"))
|
|
20548
20924
|
return handleBunWrapRequest();
|
|
20549
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
20925
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve35(projectRoot, relPath));
|
|
20550
20926
|
if (virtualCssResponse)
|
|
20551
20927
|
return virtualCssResponse;
|
|
20552
20928
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -20562,11 +20938,11 @@ export default {};
|
|
|
20562
20938
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
20563
20939
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
20564
20940
|
if (match[1])
|
|
20565
|
-
files.push(
|
|
20941
|
+
files.push(resolve35(projectRoot, match[1]));
|
|
20566
20942
|
}
|
|
20567
20943
|
return files;
|
|
20568
20944
|
}, invalidateModule = (filePath) => {
|
|
20569
|
-
const resolved =
|
|
20945
|
+
const resolved = resolve35(filePath);
|
|
20570
20946
|
invalidate(filePath);
|
|
20571
20947
|
if (resolved !== filePath)
|
|
20572
20948
|
invalidate(resolved);
|
|
@@ -20705,287 +21081,11 @@ var init_rewriteImports = __esm(() => {
|
|
|
20705
21081
|
rewriteVendorDirectories2 = rewriteVendorDirectories;
|
|
20706
21082
|
});
|
|
20707
21083
|
|
|
20708
|
-
// src/dev/angular/
|
|
20709
|
-
var
|
|
20710
|
-
__export(
|
|
20711
|
-
|
|
20712
|
-
|
|
20713
|
-
invalidateResourceIndex: () => invalidateResourceIndex
|
|
20714
|
-
});
|
|
20715
|
-
import { readdirSync as readdirSync2, readFileSync as readFileSync20, statSync as statSync4 } from "fs";
|
|
20716
|
-
import { dirname as dirname20, extname as extname10, join as join30, resolve as resolve35 } from "path";
|
|
20717
|
-
import ts7 from "typescript";
|
|
20718
|
-
var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") || file5.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
20719
|
-
const out = [];
|
|
20720
|
-
const visit = (dir) => {
|
|
20721
|
-
let entries;
|
|
20722
|
-
try {
|
|
20723
|
-
entries = readdirSync2(dir, { withFileTypes: true });
|
|
20724
|
-
} catch {
|
|
20725
|
-
return;
|
|
20726
|
-
}
|
|
20727
|
-
for (const entry of entries) {
|
|
20728
|
-
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
20729
|
-
continue;
|
|
20730
|
-
}
|
|
20731
|
-
const full = join30(dir, entry.name);
|
|
20732
|
-
if (entry.isDirectory()) {
|
|
20733
|
-
visit(full);
|
|
20734
|
-
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
20735
|
-
out.push(full);
|
|
20736
|
-
}
|
|
20737
|
-
}
|
|
20738
|
-
};
|
|
20739
|
-
visit(root);
|
|
20740
|
-
return out;
|
|
20741
|
-
}, getStringPropertyValue = (obj, name) => {
|
|
20742
|
-
for (const prop of obj.properties) {
|
|
20743
|
-
if (!ts7.isPropertyAssignment(prop))
|
|
20744
|
-
continue;
|
|
20745
|
-
const propName = ts7.isIdentifier(prop.name) ? prop.name.text : ts7.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
20746
|
-
if (propName !== name)
|
|
20747
|
-
continue;
|
|
20748
|
-
const init = prop.initializer;
|
|
20749
|
-
if (ts7.isStringLiteral(init) || ts7.isNoSubstitutionTemplateLiteral(init)) {
|
|
20750
|
-
return init.text;
|
|
20751
|
-
}
|
|
20752
|
-
}
|
|
20753
|
-
return null;
|
|
20754
|
-
}, getStringArrayProperty = (obj, name) => {
|
|
20755
|
-
const out = [];
|
|
20756
|
-
for (const prop of obj.properties) {
|
|
20757
|
-
if (!ts7.isPropertyAssignment(prop))
|
|
20758
|
-
continue;
|
|
20759
|
-
const propName = ts7.isIdentifier(prop.name) ? prop.name.text : ts7.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
20760
|
-
if (propName !== name)
|
|
20761
|
-
continue;
|
|
20762
|
-
const init = prop.initializer;
|
|
20763
|
-
if (!ts7.isArrayLiteralExpression(init))
|
|
20764
|
-
continue;
|
|
20765
|
-
for (const element of init.elements) {
|
|
20766
|
-
if (ts7.isStringLiteral(element) || ts7.isNoSubstitutionTemplateLiteral(element)) {
|
|
20767
|
-
out.push(element.text);
|
|
20768
|
-
}
|
|
20769
|
-
}
|
|
20770
|
-
}
|
|
20771
|
-
return out;
|
|
20772
|
-
}, parseDecoratedClasses = (filePath) => {
|
|
20773
|
-
let source;
|
|
20774
|
-
try {
|
|
20775
|
-
source = readFileSync20(filePath, "utf8");
|
|
20776
|
-
} catch {
|
|
20777
|
-
return [];
|
|
20778
|
-
}
|
|
20779
|
-
const sourceFile = ts7.createSourceFile(filePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
20780
|
-
const out = [];
|
|
20781
|
-
const visit = (node) => {
|
|
20782
|
-
if (ts7.isClassDeclaration(node) && node.name) {
|
|
20783
|
-
for (const decorator of ts7.getDecorators(node) ?? []) {
|
|
20784
|
-
const expr = decorator.expression;
|
|
20785
|
-
if (!ts7.isCallExpression(expr))
|
|
20786
|
-
continue;
|
|
20787
|
-
const fn2 = expr.expression;
|
|
20788
|
-
if (!ts7.isIdentifier(fn2))
|
|
20789
|
-
continue;
|
|
20790
|
-
const kind = ENTITY_DECORATORS[fn2.text];
|
|
20791
|
-
if (!kind)
|
|
20792
|
-
continue;
|
|
20793
|
-
let extendsName = null;
|
|
20794
|
-
for (const heritage of node.heritageClauses ?? []) {
|
|
20795
|
-
if (heritage.token !== ts7.SyntaxKind.ExtendsKeyword) {
|
|
20796
|
-
continue;
|
|
20797
|
-
}
|
|
20798
|
-
const first = heritage.types[0];
|
|
20799
|
-
if (first && ts7.isIdentifier(first.expression)) {
|
|
20800
|
-
extendsName = first.expression.text;
|
|
20801
|
-
}
|
|
20802
|
-
break;
|
|
20803
|
-
}
|
|
20804
|
-
const entry = {
|
|
20805
|
-
className: node.name.text,
|
|
20806
|
-
kind,
|
|
20807
|
-
styleUrls: [],
|
|
20808
|
-
templateUrls: [],
|
|
20809
|
-
extendsName
|
|
20810
|
-
};
|
|
20811
|
-
const arg = expr.arguments[0];
|
|
20812
|
-
if (arg && ts7.isObjectLiteralExpression(arg) && kind === "component") {
|
|
20813
|
-
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
20814
|
-
if (tplUrl)
|
|
20815
|
-
entry.templateUrls.push(tplUrl);
|
|
20816
|
-
const styleUrl = getStringPropertyValue(arg, "styleUrl");
|
|
20817
|
-
if (styleUrl)
|
|
20818
|
-
entry.styleUrls.push(styleUrl);
|
|
20819
|
-
entry.styleUrls.push(...getStringArrayProperty(arg, "styleUrls"));
|
|
20820
|
-
}
|
|
20821
|
-
out.push(entry);
|
|
20822
|
-
break;
|
|
20823
|
-
}
|
|
20824
|
-
}
|
|
20825
|
-
ts7.forEachChild(node, visit);
|
|
20826
|
-
};
|
|
20827
|
-
visit(sourceFile);
|
|
20828
|
-
return out;
|
|
20829
|
-
}, safeNormalize = (path) => resolve35(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
20830
|
-
const { changedFilePath, userAngularRoot } = params;
|
|
20831
|
-
const changedAbs = safeNormalize(changedFilePath);
|
|
20832
|
-
const out = [];
|
|
20833
|
-
const ext = extname10(changedAbs).toLowerCase();
|
|
20834
|
-
if (ext === ".ts" || ext === ".tsx") {
|
|
20835
|
-
const classes = parseDecoratedClasses(changedAbs);
|
|
20836
|
-
for (const cls of classes) {
|
|
20837
|
-
out.push({
|
|
20838
|
-
className: cls.className,
|
|
20839
|
-
componentFilePath: changedAbs,
|
|
20840
|
-
kind: cls.kind
|
|
20841
|
-
});
|
|
20842
|
-
}
|
|
20843
|
-
return out;
|
|
20844
|
-
}
|
|
20845
|
-
if (ext !== ".html" && ext !== ".css" && ext !== ".scss" && ext !== ".sass") {
|
|
20846
|
-
return out;
|
|
20847
|
-
}
|
|
20848
|
-
let rootStat;
|
|
20849
|
-
try {
|
|
20850
|
-
rootStat = statSync4(userAngularRoot);
|
|
20851
|
-
} catch {
|
|
20852
|
-
return out;
|
|
20853
|
-
}
|
|
20854
|
-
if (!rootStat.isDirectory())
|
|
20855
|
-
return out;
|
|
20856
|
-
const index = getOrBuildResourceIndex(userAngularRoot);
|
|
20857
|
-
const owners = index.get(changedAbs);
|
|
20858
|
-
if (owners) {
|
|
20859
|
-
out.push(...owners);
|
|
20860
|
-
}
|
|
20861
|
-
return out;
|
|
20862
|
-
}, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
|
|
20863
|
-
let source;
|
|
20864
|
-
try {
|
|
20865
|
-
source = readFileSync20(childFilePath, "utf8");
|
|
20866
|
-
} catch {
|
|
20867
|
-
return null;
|
|
20868
|
-
}
|
|
20869
|
-
const sf = ts7.createSourceFile(childFilePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
20870
|
-
const childDir = dirname20(childFilePath);
|
|
20871
|
-
for (const stmt of sf.statements) {
|
|
20872
|
-
if (!ts7.isImportDeclaration(stmt))
|
|
20873
|
-
continue;
|
|
20874
|
-
if (!ts7.isStringLiteral(stmt.moduleSpecifier))
|
|
20875
|
-
continue;
|
|
20876
|
-
const clause = stmt.importClause;
|
|
20877
|
-
if (!clause || clause.isTypeOnly)
|
|
20878
|
-
continue;
|
|
20879
|
-
let matchesName = false;
|
|
20880
|
-
if (clause.name && clause.name.text === parentName)
|
|
20881
|
-
matchesName = true;
|
|
20882
|
-
if (!matchesName && clause.namedBindings && ts7.isNamedImports(clause.namedBindings)) {
|
|
20883
|
-
for (const el of clause.namedBindings.elements) {
|
|
20884
|
-
if (el.isTypeOnly)
|
|
20885
|
-
continue;
|
|
20886
|
-
if (el.name.text === parentName) {
|
|
20887
|
-
matchesName = true;
|
|
20888
|
-
break;
|
|
20889
|
-
}
|
|
20890
|
-
}
|
|
20891
|
-
}
|
|
20892
|
-
if (!matchesName)
|
|
20893
|
-
continue;
|
|
20894
|
-
const spec = stmt.moduleSpecifier.text;
|
|
20895
|
-
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
20896
|
-
return null;
|
|
20897
|
-
}
|
|
20898
|
-
const base = resolve35(childDir, spec);
|
|
20899
|
-
const candidates = [
|
|
20900
|
-
`${base}.ts`,
|
|
20901
|
-
`${base}.tsx`,
|
|
20902
|
-
`${base}/index.ts`,
|
|
20903
|
-
`${base}/index.tsx`
|
|
20904
|
-
];
|
|
20905
|
-
const angularRootNorm = safeNormalize(angularRoot);
|
|
20906
|
-
for (const candidate of candidates) {
|
|
20907
|
-
try {
|
|
20908
|
-
if (statSync4(candidate).isFile()) {
|
|
20909
|
-
const norm = safeNormalize(candidate);
|
|
20910
|
-
if (!norm.startsWith(angularRootNorm))
|
|
20911
|
-
return null;
|
|
20912
|
-
return norm;
|
|
20913
|
-
}
|
|
20914
|
-
} catch {}
|
|
20915
|
-
}
|
|
20916
|
-
return null;
|
|
20917
|
-
}
|
|
20918
|
-
return null;
|
|
20919
|
-
}, getOrBuildIndexes = (userAngularRoot) => {
|
|
20920
|
-
const cached = indexByRoot.get(userAngularRoot);
|
|
20921
|
-
if (cached)
|
|
20922
|
-
return cached;
|
|
20923
|
-
const resource = new Map;
|
|
20924
|
-
const parentFile = new Map;
|
|
20925
|
-
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
20926
|
-
const classes = parseDecoratedClasses(tsPath);
|
|
20927
|
-
const componentDir = dirname20(tsPath);
|
|
20928
|
-
for (const cls of classes) {
|
|
20929
|
-
const entity = {
|
|
20930
|
-
className: cls.className,
|
|
20931
|
-
componentFilePath: tsPath,
|
|
20932
|
-
kind: cls.kind
|
|
20933
|
-
};
|
|
20934
|
-
if (cls.kind === "component") {
|
|
20935
|
-
for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
|
|
20936
|
-
const abs = safeNormalize(resolve35(componentDir, url));
|
|
20937
|
-
const existing = resource.get(abs);
|
|
20938
|
-
if (existing)
|
|
20939
|
-
existing.push(entity);
|
|
20940
|
-
else
|
|
20941
|
-
resource.set(abs, [entity]);
|
|
20942
|
-
}
|
|
20943
|
-
}
|
|
20944
|
-
if (cls.extendsName !== null) {
|
|
20945
|
-
const parentPath = resolveParentClassFile(cls.extendsName, tsPath, userAngularRoot);
|
|
20946
|
-
if (parentPath !== null && parentPath !== safeNormalize(tsPath)) {
|
|
20947
|
-
const existing = parentFile.get(parentPath);
|
|
20948
|
-
if (existing)
|
|
20949
|
-
existing.push(entity);
|
|
20950
|
-
else
|
|
20951
|
-
parentFile.set(parentPath, [entity]);
|
|
20952
|
-
}
|
|
20953
|
-
}
|
|
20954
|
-
}
|
|
20955
|
-
}
|
|
20956
|
-
const bundle = { parentFile, resource };
|
|
20957
|
-
indexByRoot.set(userAngularRoot, bundle);
|
|
20958
|
-
return bundle;
|
|
20959
|
-
}, getOrBuildResourceIndex = (userAngularRoot) => getOrBuildIndexes(userAngularRoot).resource, resolveDescendantsOfParent = (params) => {
|
|
20960
|
-
const norm = safeNormalize(params.changedFilePath);
|
|
20961
|
-
let rootStat;
|
|
20962
|
-
try {
|
|
20963
|
-
rootStat = statSync4(params.userAngularRoot);
|
|
20964
|
-
} catch {
|
|
20965
|
-
return [];
|
|
20966
|
-
}
|
|
20967
|
-
if (!rootStat.isDirectory())
|
|
20968
|
-
return [];
|
|
20969
|
-
const bundle = getOrBuildIndexes(params.userAngularRoot);
|
|
20970
|
-
return bundle.parentFile.get(norm) ?? [];
|
|
20971
|
-
}, invalidateResourceIndex = () => {
|
|
20972
|
-
indexByRoot.clear();
|
|
20973
|
-
};
|
|
20974
|
-
var init_resolveOwningComponents = __esm(() => {
|
|
20975
|
-
ENTITY_DECORATORS = {
|
|
20976
|
-
Component: "component",
|
|
20977
|
-
Directive: "directive",
|
|
20978
|
-
Pipe: "pipe",
|
|
20979
|
-
Injectable: "service"
|
|
20980
|
-
};
|
|
20981
|
-
indexByRoot = new Map;
|
|
20982
|
-
});
|
|
20983
|
-
|
|
20984
|
-
// src/dev/angular/hmrCompiler.ts
|
|
20985
|
-
var exports_hmrCompiler = {};
|
|
20986
|
-
__export(exports_hmrCompiler, {
|
|
20987
|
-
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
20988
|
-
encodeHmrComponentId: () => encodeHmrComponentId
|
|
21084
|
+
// src/dev/angular/hmrCompiler.ts
|
|
21085
|
+
var exports_hmrCompiler = {};
|
|
21086
|
+
__export(exports_hmrCompiler, {
|
|
21087
|
+
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
21088
|
+
encodeHmrComponentId: () => encodeHmrComponentId
|
|
20989
21089
|
});
|
|
20990
21090
|
import { dirname as dirname21, relative as relative15, resolve as resolve36 } from "path";
|
|
20991
21091
|
import { performance as performance2 } from "perf_hooks";
|
|
@@ -21445,6 +21545,35 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21445
21545
|
for (const importer of findStyleEntriesImporting(changedStylePath)) {
|
|
21446
21546
|
enqueueImporter(state, importer);
|
|
21447
21547
|
}
|
|
21548
|
+
enqueueAngularOwningComponentForStyle(state, changedStylePath);
|
|
21549
|
+
}, enqueueAngularOwningComponentForStyle = (state, changedStylePath) => {
|
|
21550
|
+
const angularDir = state.resolvedPaths.angularDir;
|
|
21551
|
+
if (!angularDir)
|
|
21552
|
+
return;
|
|
21553
|
+
const visited = new Set;
|
|
21554
|
+
const stack = [
|
|
21555
|
+
changedStylePath,
|
|
21556
|
+
...findStyleEntriesImporting(changedStylePath)
|
|
21557
|
+
];
|
|
21558
|
+
while (stack.length > 0) {
|
|
21559
|
+
const stylePath = stack.pop();
|
|
21560
|
+
if (!stylePath || visited.has(stylePath))
|
|
21561
|
+
continue;
|
|
21562
|
+
visited.add(stylePath);
|
|
21563
|
+
for (const upstream of findStyleEntriesImporting(stylePath)) {
|
|
21564
|
+
if (!visited.has(upstream))
|
|
21565
|
+
stack.push(upstream);
|
|
21566
|
+
}
|
|
21567
|
+
try {
|
|
21568
|
+
const owners = resolveOwningComponents({
|
|
21569
|
+
changedFilePath: stylePath,
|
|
21570
|
+
userAngularRoot: angularDir
|
|
21571
|
+
});
|
|
21572
|
+
for (const owner of owners) {
|
|
21573
|
+
enqueueImporter(state, owner.componentFilePath);
|
|
21574
|
+
}
|
|
21575
|
+
} catch {}
|
|
21576
|
+
}
|
|
21448
21577
|
}, queueFileChange = async (state, filePath, config, onRebuildComplete) => {
|
|
21449
21578
|
const framework = detectFramework(filePath, state.resolvedPaths);
|
|
21450
21579
|
if (framework === "ignored") {
|
|
@@ -21458,7 +21587,48 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21458
21587
|
invalidate(resolve39(filePath));
|
|
21459
21588
|
const relPath = relative16(process.cwd(), filePath);
|
|
21460
21589
|
logHmrUpdate(relPath);
|
|
21461
|
-
|
|
21590
|
+
const angularDir = state.resolvedPaths.angularDir;
|
|
21591
|
+
let hasAngularDependent = false;
|
|
21592
|
+
if (angularDir && state.dependencyGraph) {
|
|
21593
|
+
try {
|
|
21594
|
+
const { addFileToGraph: addFileToGraph2 } = await Promise.resolve().then(() => (init_dependencyGraph(), exports_dependencyGraph));
|
|
21595
|
+
addFileToGraph2(state.dependencyGraph, resolve39(filePath));
|
|
21596
|
+
const affected = getAffectedFiles(state.dependencyGraph, resolve39(filePath));
|
|
21597
|
+
for (const dependent of affected) {
|
|
21598
|
+
if (dependent === resolve39(filePath))
|
|
21599
|
+
continue;
|
|
21600
|
+
const dependentFramework = detectFramework(dependent, state.resolvedPaths);
|
|
21601
|
+
if (dependentFramework !== "angular")
|
|
21602
|
+
continue;
|
|
21603
|
+
hasAngularDependent = true;
|
|
21604
|
+
if (!state.fileChangeQueue.has("angular")) {
|
|
21605
|
+
state.fileChangeQueue.set("angular", []);
|
|
21606
|
+
}
|
|
21607
|
+
const angularQueue = state.fileChangeQueue.get("angular");
|
|
21608
|
+
if (angularQueue && !angularQueue.includes(dependent)) {
|
|
21609
|
+
angularQueue.push(dependent);
|
|
21610
|
+
}
|
|
21611
|
+
}
|
|
21612
|
+
} catch {}
|
|
21613
|
+
}
|
|
21614
|
+
if (!hasAngularDependent) {
|
|
21615
|
+
return;
|
|
21616
|
+
}
|
|
21617
|
+
try {
|
|
21618
|
+
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
21619
|
+
const { invalidateModule: invalidateModuleServer } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21620
|
+
const generatedAngularRoot = getFrameworkGeneratedDir2("angular");
|
|
21621
|
+
const sourceAbs = resolve39(filePath).replace(/\\/g, "/");
|
|
21622
|
+
const generatedTwin = `${generatedAngularRoot.replace(/\\/g, "/")}${sourceAbs.replace(/\.ts$/, ".js")}`;
|
|
21623
|
+
invalidateModuleServer(generatedTwin);
|
|
21624
|
+
} catch {}
|
|
21625
|
+
if (!state.fileChangeQueue.has("unknown")) {
|
|
21626
|
+
state.fileChangeQueue.set("unknown", []);
|
|
21627
|
+
}
|
|
21628
|
+
const unknownQueue = state.fileChangeQueue.get("unknown");
|
|
21629
|
+
if (unknownQueue && !unknownQueue.includes(filePath)) {
|
|
21630
|
+
unknownQueue.push(filePath);
|
|
21631
|
+
}
|
|
21462
21632
|
}
|
|
21463
21633
|
if (!state.fileChangeQueue.has(framework)) {
|
|
21464
21634
|
state.fileChangeQueue.set(framework, []);
|
|
@@ -21642,6 +21812,26 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21642
21812
|
break;
|
|
21643
21813
|
}
|
|
21644
21814
|
}
|
|
21815
|
+
for (const editedFile of userEdited) {
|
|
21816
|
+
if (!editedFile.endsWith(".ts"))
|
|
21817
|
+
continue;
|
|
21818
|
+
if (editedFile.endsWith(".d.ts"))
|
|
21819
|
+
continue;
|
|
21820
|
+
const detected = detectFramework(editedFile, state.resolvedPaths);
|
|
21821
|
+
if (detected !== "unknown")
|
|
21822
|
+
continue;
|
|
21823
|
+
try {
|
|
21824
|
+
const affected = getAffectedFiles(state.dependencyGraph, resolve39(editedFile));
|
|
21825
|
+
const hasAngularConsumer = affected.some((dep) => dep !== resolve39(editedFile) && detectFramework(dep, state.resolvedPaths) === "angular");
|
|
21826
|
+
if (hasAngularConsumer) {
|
|
21827
|
+
return {
|
|
21828
|
+
kind: "rebootstrap",
|
|
21829
|
+
reason: `non-angular helper edited (${editedFile}) \u2014 angular dependents need fresh bundle for __abs_deps to point at new exports`,
|
|
21830
|
+
tier: 1
|
|
21831
|
+
};
|
|
21832
|
+
}
|
|
21833
|
+
} catch {}
|
|
21834
|
+
}
|
|
21645
21835
|
const queue = [];
|
|
21646
21836
|
const queueIds = new Set;
|
|
21647
21837
|
let anyFingerprintChanged = false;
|
|
@@ -23079,6 +23269,7 @@ var init_rebuildTrigger = __esm(() => {
|
|
|
23079
23269
|
init_telemetryEvent();
|
|
23080
23270
|
init_assetStore();
|
|
23081
23271
|
init_pathUtils();
|
|
23272
|
+
init_resolveOwningComponents();
|
|
23082
23273
|
init_webSocket();
|
|
23083
23274
|
init_stylePreprocessor();
|
|
23084
23275
|
init_compileTailwind();
|
|
@@ -32352,5 +32543,5 @@ export {
|
|
|
32352
32543
|
ANGULAR_INIT_TIMEOUT_MS
|
|
32353
32544
|
};
|
|
32354
32545
|
|
|
32355
|
-
//# debugId=
|
|
32546
|
+
//# debugId=2AE6E8B266B7022864756E2164756E21
|
|
32356
32547
|
//# sourceMappingURL=index.js.map
|