@zenithbuild/cli 0.6.17 → 0.7.0
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/build/compiler-runtime.d.ts +59 -0
- package/dist/build/compiler-runtime.js +277 -0
- package/dist/build/expression-rewrites.d.ts +88 -0
- package/dist/build/expression-rewrites.js +372 -0
- package/dist/build/hoisted-code-transforms.d.ts +44 -0
- package/dist/build/hoisted-code-transforms.js +316 -0
- package/dist/build/merge-component-ir.d.ts +16 -0
- package/dist/build/merge-component-ir.js +257 -0
- package/dist/build/page-component-loop.d.ts +92 -0
- package/dist/build/page-component-loop.js +257 -0
- package/dist/build/page-ir-normalization.d.ts +23 -0
- package/dist/build/page-ir-normalization.js +370 -0
- package/dist/build/page-loop-metrics.d.ts +100 -0
- package/dist/build/page-loop-metrics.js +131 -0
- package/dist/build/page-loop-state.d.ts +261 -0
- package/dist/build/page-loop-state.js +92 -0
- package/dist/build/page-loop.d.ts +33 -0
- package/dist/build/page-loop.js +217 -0
- package/dist/build/scoped-identifier-rewrite.d.ts +112 -0
- package/dist/build/scoped-identifier-rewrite.js +245 -0
- package/dist/build/server-script.d.ts +41 -0
- package/dist/build/server-script.js +210 -0
- package/dist/build/type-declarations.d.ts +16 -0
- package/dist/build/type-declarations.js +158 -0
- package/dist/build/typescript-expression-utils.d.ts +23 -0
- package/dist/build/typescript-expression-utils.js +272 -0
- package/dist/build.d.ts +10 -18
- package/dist/build.js +74 -2261
- package/dist/component-instance-ir.d.ts +2 -2
- package/dist/component-instance-ir.js +146 -39
- package/dist/component-occurrences.js +63 -15
- package/dist/config.d.ts +66 -0
- package/dist/config.js +86 -0
- package/dist/debug-script.d.ts +1 -0
- package/dist/debug-script.js +8 -0
- package/dist/dev-build-session.d.ts +23 -0
- package/dist/dev-build-session.js +421 -0
- package/dist/dev-server.js +256 -54
- package/dist/framework-components/Image.zen +316 -0
- package/dist/images/materialize.d.ts +17 -0
- package/dist/images/materialize.js +200 -0
- package/dist/images/payload.d.ts +18 -0
- package/dist/images/payload.js +65 -0
- package/dist/images/runtime.d.ts +4 -0
- package/dist/images/runtime.js +254 -0
- package/dist/images/service.d.ts +4 -0
- package/dist/images/service.js +302 -0
- package/dist/images/shared.d.ts +58 -0
- package/dist/images/shared.js +306 -0
- package/dist/index.js +2 -17
- package/dist/manifest.js +45 -0
- package/dist/preview.d.ts +4 -1
- package/dist/preview.js +59 -6
- package/dist/resolve-components.js +20 -3
- package/dist/server-contract.js +3 -2
- package/dist/server-script-composition.d.ts +39 -0
- package/dist/server-script-composition.js +133 -0
- package/dist/startup-profile.d.ts +10 -0
- package/dist/startup-profile.js +62 -0
- package/dist/toolchain-paths.d.ts +1 -0
- package/dist/toolchain-paths.js +31 -0
- package/dist/version-check.d.ts +2 -1
- package/dist/version-check.js +12 -5
- package/package.json +5 -4
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export function createPagePhaseTotals(): {
|
|
2
|
+
occurrenceCollectMs: number;
|
|
3
|
+
serverExtractMs: number;
|
|
4
|
+
selfRewriteMs: number;
|
|
5
|
+
componentLoopMs: number;
|
|
6
|
+
cloneMs: number;
|
|
7
|
+
instanceRewriteMs: number;
|
|
8
|
+
mergeMs: number;
|
|
9
|
+
occurrencePlanApplyMs: number;
|
|
10
|
+
expressionApplyMs: number;
|
|
11
|
+
scopedRewritePlanMs: number;
|
|
12
|
+
scopedRewriteApplyMs: number;
|
|
13
|
+
scopedRewriteMs: number;
|
|
14
|
+
normalizeMs: number;
|
|
15
|
+
};
|
|
16
|
+
export function createMergePhaseTotals(): {
|
|
17
|
+
componentScriptsMs: number;
|
|
18
|
+
componentInstancesMs: number;
|
|
19
|
+
refBindingsMs: number;
|
|
20
|
+
importsMs: number;
|
|
21
|
+
hoistedSymbolsMs: number;
|
|
22
|
+
runtimeSignalsMs: number;
|
|
23
|
+
hoistedCodeMs: number;
|
|
24
|
+
codeRebaseImportsMs: number;
|
|
25
|
+
codeFilterImportsMs: number;
|
|
26
|
+
codePropsPreludeMs: number;
|
|
27
|
+
codeTranspileMs: number;
|
|
28
|
+
codeTranspileCacheHits: number;
|
|
29
|
+
codeTranspileCacheMisses: number;
|
|
30
|
+
codeTranspileExactNoopCount: number;
|
|
31
|
+
codeTranspileTrimmedNoopCount: number;
|
|
32
|
+
codeTranspileChangedOutputCount: number;
|
|
33
|
+
codeDedupeImportsMs: number;
|
|
34
|
+
codeDeferRuntimeMs: number;
|
|
35
|
+
codeDeferRuntimeCacheHits: number;
|
|
36
|
+
codeDeferRuntimeCacheMisses: number;
|
|
37
|
+
};
|
|
38
|
+
export function createComponentLoopPhaseTotals(): {
|
|
39
|
+
componentSourceReadMs: number;
|
|
40
|
+
ownerSourceReadMs: number;
|
|
41
|
+
componentDocModeDetectMs: number;
|
|
42
|
+
componentExpressionRewriteBuildMs: number;
|
|
43
|
+
ownerExpressionRewriteBuildMs: number;
|
|
44
|
+
ownerScopeRewriteBuildMs: number;
|
|
45
|
+
};
|
|
46
|
+
export function createOccurrenceApplyPhaseTotals(): {
|
|
47
|
+
queueBuildMs: number;
|
|
48
|
+
expressionLookupMs: number;
|
|
49
|
+
refLookupMs: number;
|
|
50
|
+
bindingResolutionMs: number;
|
|
51
|
+
};
|
|
52
|
+
export function createBindingResolutionTotals(): {
|
|
53
|
+
pageMapConstructionMs: number;
|
|
54
|
+
compiledSignalRemapMs: number;
|
|
55
|
+
fallbackSignalStateLookupMs: number;
|
|
56
|
+
};
|
|
57
|
+
export function createScopedRewritePhaseTotals(): {
|
|
58
|
+
totalValues: number;
|
|
59
|
+
cacheHitCount: number;
|
|
60
|
+
cacheMissCount: number;
|
|
61
|
+
cacheMissMs: number;
|
|
62
|
+
identifierCheckMs: number;
|
|
63
|
+
fastSkipCount: number;
|
|
64
|
+
fastSkipMs: number;
|
|
65
|
+
rewriteCallMs: number;
|
|
66
|
+
changedMissCount: number;
|
|
67
|
+
unchangedMissCount: number;
|
|
68
|
+
};
|
|
69
|
+
export function addBreakdown(target: any, source: any): void;
|
|
70
|
+
export function roundBreakdown(startupProfile: any, value: any): {
|
|
71
|
+
[k: string]: any;
|
|
72
|
+
};
|
|
73
|
+
export function recordPageProfile({ pageProfiles, entry, componentOccurrences, pageExpandMs, pageCompileMs, pageOwnerCompileMs, pageComponentCompileMs, pageComponentCacheHits, pageComponentCacheMisses, pagePhase, startupProfile, pageStartedAt }: {
|
|
74
|
+
pageProfiles: any;
|
|
75
|
+
entry: any;
|
|
76
|
+
componentOccurrences: any;
|
|
77
|
+
pageExpandMs: any;
|
|
78
|
+
pageCompileMs: any;
|
|
79
|
+
pageOwnerCompileMs: any;
|
|
80
|
+
pageComponentCompileMs: any;
|
|
81
|
+
pageComponentCacheHits: any;
|
|
82
|
+
pageComponentCacheMisses: any;
|
|
83
|
+
pagePhase: any;
|
|
84
|
+
startupProfile: any;
|
|
85
|
+
pageStartedAt: any;
|
|
86
|
+
}): void;
|
|
87
|
+
export function emitPageLoopSummary({ startupProfile, manifest, pageLoopStartedAt, compilerTotals, expressionRewriteMetrics, pagePhaseTotals, occurrenceApplyPhaseTotals, bindingResolutionTotals, scopedRewritePhaseTotals, mergePhaseTotals, componentLoopPhaseTotals, pageProfiles }: {
|
|
88
|
+
startupProfile: any;
|
|
89
|
+
manifest: any;
|
|
90
|
+
pageLoopStartedAt: any;
|
|
91
|
+
compilerTotals: any;
|
|
92
|
+
expressionRewriteMetrics: any;
|
|
93
|
+
pagePhaseTotals: any;
|
|
94
|
+
occurrenceApplyPhaseTotals: any;
|
|
95
|
+
bindingResolutionTotals: any;
|
|
96
|
+
scopedRewritePhaseTotals: any;
|
|
97
|
+
mergePhaseTotals: any;
|
|
98
|
+
componentLoopPhaseTotals: any;
|
|
99
|
+
pageProfiles: any;
|
|
100
|
+
}): void;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { performance } from 'node:perf_hooks';
|
|
2
|
+
export function createPagePhaseTotals() {
|
|
3
|
+
return {
|
|
4
|
+
occurrenceCollectMs: 0,
|
|
5
|
+
serverExtractMs: 0,
|
|
6
|
+
selfRewriteMs: 0,
|
|
7
|
+
componentLoopMs: 0,
|
|
8
|
+
cloneMs: 0,
|
|
9
|
+
instanceRewriteMs: 0,
|
|
10
|
+
mergeMs: 0,
|
|
11
|
+
occurrencePlanApplyMs: 0,
|
|
12
|
+
expressionApplyMs: 0,
|
|
13
|
+
scopedRewritePlanMs: 0,
|
|
14
|
+
scopedRewriteApplyMs: 0,
|
|
15
|
+
scopedRewriteMs: 0,
|
|
16
|
+
normalizeMs: 0
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function createMergePhaseTotals() {
|
|
20
|
+
return {
|
|
21
|
+
componentScriptsMs: 0,
|
|
22
|
+
componentInstancesMs: 0,
|
|
23
|
+
refBindingsMs: 0,
|
|
24
|
+
importsMs: 0,
|
|
25
|
+
hoistedSymbolsMs: 0,
|
|
26
|
+
runtimeSignalsMs: 0,
|
|
27
|
+
hoistedCodeMs: 0,
|
|
28
|
+
codeRebaseImportsMs: 0,
|
|
29
|
+
codeFilterImportsMs: 0,
|
|
30
|
+
codePropsPreludeMs: 0,
|
|
31
|
+
codeTranspileMs: 0,
|
|
32
|
+
codeTranspileCacheHits: 0,
|
|
33
|
+
codeTranspileCacheMisses: 0,
|
|
34
|
+
codeTranspileExactNoopCount: 0,
|
|
35
|
+
codeTranspileTrimmedNoopCount: 0,
|
|
36
|
+
codeTranspileChangedOutputCount: 0,
|
|
37
|
+
codeDedupeImportsMs: 0,
|
|
38
|
+
codeDeferRuntimeMs: 0,
|
|
39
|
+
codeDeferRuntimeCacheHits: 0,
|
|
40
|
+
codeDeferRuntimeCacheMisses: 0
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function createComponentLoopPhaseTotals() {
|
|
44
|
+
return {
|
|
45
|
+
componentSourceReadMs: 0,
|
|
46
|
+
ownerSourceReadMs: 0,
|
|
47
|
+
componentDocModeDetectMs: 0,
|
|
48
|
+
componentExpressionRewriteBuildMs: 0,
|
|
49
|
+
ownerExpressionRewriteBuildMs: 0,
|
|
50
|
+
ownerScopeRewriteBuildMs: 0
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function createOccurrenceApplyPhaseTotals() {
|
|
54
|
+
return {
|
|
55
|
+
queueBuildMs: 0,
|
|
56
|
+
expressionLookupMs: 0,
|
|
57
|
+
refLookupMs: 0,
|
|
58
|
+
bindingResolutionMs: 0
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export function createBindingResolutionTotals() {
|
|
62
|
+
return {
|
|
63
|
+
pageMapConstructionMs: 0,
|
|
64
|
+
compiledSignalRemapMs: 0,
|
|
65
|
+
fallbackSignalStateLookupMs: 0
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export function createScopedRewritePhaseTotals() {
|
|
69
|
+
return {
|
|
70
|
+
totalValues: 0,
|
|
71
|
+
cacheHitCount: 0,
|
|
72
|
+
cacheMissCount: 0,
|
|
73
|
+
cacheMissMs: 0,
|
|
74
|
+
identifierCheckMs: 0,
|
|
75
|
+
fastSkipCount: 0,
|
|
76
|
+
fastSkipMs: 0,
|
|
77
|
+
rewriteCallMs: 0,
|
|
78
|
+
changedMissCount: 0,
|
|
79
|
+
unchangedMissCount: 0
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function addBreakdown(target, source) {
|
|
83
|
+
for (const [key, value] of Object.entries(source)) {
|
|
84
|
+
target[key] += value;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export function roundBreakdown(startupProfile, value) {
|
|
88
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, startupProfile.roundMs(item)]));
|
|
89
|
+
}
|
|
90
|
+
export function recordPageProfile({ pageProfiles, entry, componentOccurrences, pageExpandMs, pageCompileMs, pageOwnerCompileMs, pageComponentCompileMs, pageComponentCacheHits, pageComponentCacheMisses, pagePhase, startupProfile, pageStartedAt }) {
|
|
91
|
+
pageProfiles.push({
|
|
92
|
+
route: entry.path,
|
|
93
|
+
file: entry.file,
|
|
94
|
+
componentOccurrences,
|
|
95
|
+
expandMs: pageExpandMs,
|
|
96
|
+
pageCompileMs,
|
|
97
|
+
ownerCompileMs: pageOwnerCompileMs,
|
|
98
|
+
componentCompileMs: startupProfile.roundMs(pageComponentCompileMs),
|
|
99
|
+
componentCacheHits: pageComponentCacheHits,
|
|
100
|
+
componentCacheMisses: pageComponentCacheMisses,
|
|
101
|
+
occurrenceCollectMs: pagePhase.occurrenceCollectMs,
|
|
102
|
+
serverExtractMs: pagePhase.serverExtractMs,
|
|
103
|
+
selfRewriteMs: pagePhase.selfRewriteMs,
|
|
104
|
+
componentLoopMs: pagePhase.componentLoopMs,
|
|
105
|
+
cloneMs: startupProfile.roundMs(pagePhase.cloneMs),
|
|
106
|
+
instanceRewriteMs: startupProfile.roundMs(pagePhase.instanceRewriteMs),
|
|
107
|
+
mergeMs: startupProfile.roundMs(pagePhase.mergeMs),
|
|
108
|
+
occurrencePlanApplyMs: pagePhase.occurrencePlanApplyMs,
|
|
109
|
+
expressionApplyMs: pagePhase.expressionApplyMs,
|
|
110
|
+
scopedRewritePlanMs: pagePhase.scopedRewritePlanMs,
|
|
111
|
+
scopedRewriteApplyMs: pagePhase.scopedRewriteApplyMs,
|
|
112
|
+
scopedRewriteMs: pagePhase.scopedRewriteMs,
|
|
113
|
+
normalizeMs: pagePhase.normalizeMs,
|
|
114
|
+
totalMs: startupProfile.roundMs(performance.now() - pageStartedAt)
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
export function emitPageLoopSummary({ startupProfile, manifest, pageLoopStartedAt, compilerTotals, expressionRewriteMetrics, pagePhaseTotals, occurrenceApplyPhaseTotals, bindingResolutionTotals, scopedRewritePhaseTotals, mergePhaseTotals, componentLoopPhaseTotals, pageProfiles }) {
|
|
118
|
+
startupProfile.emit('page_loop_summary', {
|
|
119
|
+
manifestPages: manifest.length,
|
|
120
|
+
totalMs: startupProfile.roundMs(performance.now() - pageLoopStartedAt),
|
|
121
|
+
compilerTotals,
|
|
122
|
+
expressionRewriteMetrics,
|
|
123
|
+
pagePhaseTotals: roundBreakdown(startupProfile, pagePhaseTotals),
|
|
124
|
+
occurrenceApplyPhaseTotals: roundBreakdown(startupProfile, occurrenceApplyPhaseTotals),
|
|
125
|
+
bindingResolutionTotals: roundBreakdown(startupProfile, bindingResolutionTotals),
|
|
126
|
+
scopedRewritePhaseTotals: roundBreakdown(startupProfile, scopedRewritePhaseTotals),
|
|
127
|
+
mergePhaseTotals: roundBreakdown(startupProfile, mergePhaseTotals),
|
|
128
|
+
componentLoopPhaseTotals: roundBreakdown(startupProfile, componentLoopPhaseTotals),
|
|
129
|
+
slowestPages: [...pageProfiles].sort((left, right) => right.totalMs - left.totalMs).slice(0, 5)
|
|
130
|
+
});
|
|
131
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
export function createPageLoopState(): {
|
|
2
|
+
expressionRewriteMetrics: {
|
|
3
|
+
calls: number;
|
|
4
|
+
cacheHits: number;
|
|
5
|
+
cacheMisses: number;
|
|
6
|
+
templateCompileMs: number;
|
|
7
|
+
};
|
|
8
|
+
pagePhaseTotals: {
|
|
9
|
+
occurrenceCollectMs: number;
|
|
10
|
+
serverExtractMs: number;
|
|
11
|
+
selfRewriteMs: number;
|
|
12
|
+
componentLoopMs: number;
|
|
13
|
+
cloneMs: number;
|
|
14
|
+
instanceRewriteMs: number;
|
|
15
|
+
mergeMs: number;
|
|
16
|
+
occurrencePlanApplyMs: number;
|
|
17
|
+
expressionApplyMs: number;
|
|
18
|
+
scopedRewritePlanMs: number;
|
|
19
|
+
scopedRewriteApplyMs: number;
|
|
20
|
+
scopedRewriteMs: number;
|
|
21
|
+
normalizeMs: number;
|
|
22
|
+
};
|
|
23
|
+
occurrenceApplyPhaseTotals: {
|
|
24
|
+
queueBuildMs: number;
|
|
25
|
+
expressionLookupMs: number;
|
|
26
|
+
refLookupMs: number;
|
|
27
|
+
bindingResolutionMs: number;
|
|
28
|
+
};
|
|
29
|
+
bindingResolutionTotals: {
|
|
30
|
+
pageMapConstructionMs: number;
|
|
31
|
+
compiledSignalRemapMs: number;
|
|
32
|
+
fallbackSignalStateLookupMs: number;
|
|
33
|
+
};
|
|
34
|
+
scopedRewritePhaseTotals: {
|
|
35
|
+
totalValues: number;
|
|
36
|
+
cacheHitCount: number;
|
|
37
|
+
cacheMissCount: number;
|
|
38
|
+
cacheMissMs: number;
|
|
39
|
+
identifierCheckMs: number;
|
|
40
|
+
fastSkipCount: number;
|
|
41
|
+
fastSkipMs: number;
|
|
42
|
+
rewriteCallMs: number;
|
|
43
|
+
changedMissCount: number;
|
|
44
|
+
unchangedMissCount: number;
|
|
45
|
+
};
|
|
46
|
+
mergePhaseTotals: {
|
|
47
|
+
componentScriptsMs: number;
|
|
48
|
+
componentInstancesMs: number;
|
|
49
|
+
refBindingsMs: number;
|
|
50
|
+
importsMs: number;
|
|
51
|
+
hoistedSymbolsMs: number;
|
|
52
|
+
runtimeSignalsMs: number;
|
|
53
|
+
hoistedCodeMs: number;
|
|
54
|
+
codeRebaseImportsMs: number;
|
|
55
|
+
codeFilterImportsMs: number;
|
|
56
|
+
codePropsPreludeMs: number;
|
|
57
|
+
codeTranspileMs: number;
|
|
58
|
+
codeTranspileCacheHits: number;
|
|
59
|
+
codeTranspileCacheMisses: number;
|
|
60
|
+
codeTranspileExactNoopCount: number;
|
|
61
|
+
codeTranspileTrimmedNoopCount: number;
|
|
62
|
+
codeTranspileChangedOutputCount: number;
|
|
63
|
+
codeDedupeImportsMs: number;
|
|
64
|
+
codeDeferRuntimeMs: number;
|
|
65
|
+
codeDeferRuntimeCacheHits: number;
|
|
66
|
+
codeDeferRuntimeCacheMisses: number;
|
|
67
|
+
};
|
|
68
|
+
componentLoopPhaseTotals: {
|
|
69
|
+
componentSourceReadMs: number;
|
|
70
|
+
ownerSourceReadMs: number;
|
|
71
|
+
componentDocModeDetectMs: number;
|
|
72
|
+
componentExpressionRewriteBuildMs: number;
|
|
73
|
+
ownerExpressionRewriteBuildMs: number;
|
|
74
|
+
ownerScopeRewriteBuildMs: number;
|
|
75
|
+
};
|
|
76
|
+
pageProfiles: never[];
|
|
77
|
+
envelopes: never[];
|
|
78
|
+
componentIrCache: Map<any, any>;
|
|
79
|
+
componentDocumentModeCache: Map<any, any>;
|
|
80
|
+
componentExpressionRewriteCache: Map<any, any>;
|
|
81
|
+
templateExpressionCache: Map<any, any>;
|
|
82
|
+
hoistedCodeTransformCache: {
|
|
83
|
+
transpileToJs: Map<any, any>;
|
|
84
|
+
deferRuntime: Map<any, any>;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export function createPageLoopCaches(): {
|
|
88
|
+
componentIrCache: Map<any, any>;
|
|
89
|
+
componentDocumentModeCache: Map<any, any>;
|
|
90
|
+
componentExpressionRewriteCache: Map<any, any>;
|
|
91
|
+
templateExpressionCache: Map<any, any>;
|
|
92
|
+
hoistedCodeTransformCache: {
|
|
93
|
+
transpileToJs: Map<any, any>;
|
|
94
|
+
deferRuntime: Map<any, any>;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export function createPageLoopExecutionState(): {
|
|
98
|
+
expressionRewriteMetrics: {
|
|
99
|
+
calls: number;
|
|
100
|
+
cacheHits: number;
|
|
101
|
+
cacheMisses: number;
|
|
102
|
+
templateCompileMs: number;
|
|
103
|
+
};
|
|
104
|
+
pagePhaseTotals: {
|
|
105
|
+
occurrenceCollectMs: number;
|
|
106
|
+
serverExtractMs: number;
|
|
107
|
+
selfRewriteMs: number;
|
|
108
|
+
componentLoopMs: number;
|
|
109
|
+
cloneMs: number;
|
|
110
|
+
instanceRewriteMs: number;
|
|
111
|
+
mergeMs: number;
|
|
112
|
+
occurrencePlanApplyMs: number;
|
|
113
|
+
expressionApplyMs: number;
|
|
114
|
+
scopedRewritePlanMs: number;
|
|
115
|
+
scopedRewriteApplyMs: number;
|
|
116
|
+
scopedRewriteMs: number;
|
|
117
|
+
normalizeMs: number;
|
|
118
|
+
};
|
|
119
|
+
occurrenceApplyPhaseTotals: {
|
|
120
|
+
queueBuildMs: number;
|
|
121
|
+
expressionLookupMs: number;
|
|
122
|
+
refLookupMs: number;
|
|
123
|
+
bindingResolutionMs: number;
|
|
124
|
+
};
|
|
125
|
+
bindingResolutionTotals: {
|
|
126
|
+
pageMapConstructionMs: number;
|
|
127
|
+
compiledSignalRemapMs: number;
|
|
128
|
+
fallbackSignalStateLookupMs: number;
|
|
129
|
+
};
|
|
130
|
+
scopedRewritePhaseTotals: {
|
|
131
|
+
totalValues: number;
|
|
132
|
+
cacheHitCount: number;
|
|
133
|
+
cacheMissCount: number;
|
|
134
|
+
cacheMissMs: number;
|
|
135
|
+
identifierCheckMs: number;
|
|
136
|
+
fastSkipCount: number;
|
|
137
|
+
fastSkipMs: number;
|
|
138
|
+
rewriteCallMs: number;
|
|
139
|
+
changedMissCount: number;
|
|
140
|
+
unchangedMissCount: number;
|
|
141
|
+
};
|
|
142
|
+
mergePhaseTotals: {
|
|
143
|
+
componentScriptsMs: number;
|
|
144
|
+
componentInstancesMs: number;
|
|
145
|
+
refBindingsMs: number;
|
|
146
|
+
importsMs: number;
|
|
147
|
+
hoistedSymbolsMs: number;
|
|
148
|
+
runtimeSignalsMs: number;
|
|
149
|
+
hoistedCodeMs: number;
|
|
150
|
+
codeRebaseImportsMs: number;
|
|
151
|
+
codeFilterImportsMs: number;
|
|
152
|
+
codePropsPreludeMs: number;
|
|
153
|
+
codeTranspileMs: number;
|
|
154
|
+
codeTranspileCacheHits: number;
|
|
155
|
+
codeTranspileCacheMisses: number;
|
|
156
|
+
codeTranspileExactNoopCount: number;
|
|
157
|
+
codeTranspileTrimmedNoopCount: number;
|
|
158
|
+
codeTranspileChangedOutputCount: number;
|
|
159
|
+
codeDedupeImportsMs: number;
|
|
160
|
+
codeDeferRuntimeMs: number;
|
|
161
|
+
codeDeferRuntimeCacheHits: number;
|
|
162
|
+
codeDeferRuntimeCacheMisses: number;
|
|
163
|
+
};
|
|
164
|
+
componentLoopPhaseTotals: {
|
|
165
|
+
componentSourceReadMs: number;
|
|
166
|
+
ownerSourceReadMs: number;
|
|
167
|
+
componentDocModeDetectMs: number;
|
|
168
|
+
componentExpressionRewriteBuildMs: number;
|
|
169
|
+
ownerExpressionRewriteBuildMs: number;
|
|
170
|
+
ownerScopeRewriteBuildMs: number;
|
|
171
|
+
};
|
|
172
|
+
pageProfiles: never[];
|
|
173
|
+
envelopes: never[];
|
|
174
|
+
};
|
|
175
|
+
export function preparePageIrForMerge(pageIr: any): void;
|
|
176
|
+
export function applyServerEnvelopeToPageIr({ pageIr, composedServer, hasGuard, hasLoad, entry, srcDir, sourceFile }: {
|
|
177
|
+
pageIr: any;
|
|
178
|
+
composedServer: any;
|
|
179
|
+
hasGuard: any;
|
|
180
|
+
hasLoad: any;
|
|
181
|
+
entry: any;
|
|
182
|
+
srcDir: any;
|
|
183
|
+
sourceFile: any;
|
|
184
|
+
}): void;
|
|
185
|
+
export function buildOccurrenceCountByPath(componentOccurrences: any): Map<any, any>;
|
|
186
|
+
export function createPageBuildState(): {
|
|
187
|
+
pagePhase: {
|
|
188
|
+
occurrenceCollectMs: number;
|
|
189
|
+
serverExtractMs: number;
|
|
190
|
+
selfRewriteMs: number;
|
|
191
|
+
componentLoopMs: number;
|
|
192
|
+
cloneMs: number;
|
|
193
|
+
instanceRewriteMs: number;
|
|
194
|
+
mergeMs: number;
|
|
195
|
+
occurrencePlanApplyMs: number;
|
|
196
|
+
expressionApplyMs: number;
|
|
197
|
+
scopedRewritePlanMs: number;
|
|
198
|
+
scopedRewriteApplyMs: number;
|
|
199
|
+
scopedRewriteMs: number;
|
|
200
|
+
normalizeMs: number;
|
|
201
|
+
};
|
|
202
|
+
pageOccurrenceApplyBreakdown: {
|
|
203
|
+
queueBuildMs: number;
|
|
204
|
+
expressionLookupMs: number;
|
|
205
|
+
refLookupMs: number;
|
|
206
|
+
bindingResolutionMs: number;
|
|
207
|
+
};
|
|
208
|
+
pageBindingResolutionBreakdown: {
|
|
209
|
+
pageMapConstructionMs: number;
|
|
210
|
+
compiledSignalRemapMs: number;
|
|
211
|
+
fallbackSignalStateLookupMs: number;
|
|
212
|
+
};
|
|
213
|
+
pageScopedRewriteBreakdown: {
|
|
214
|
+
totalValues: number;
|
|
215
|
+
cacheHitCount: number;
|
|
216
|
+
cacheMissCount: number;
|
|
217
|
+
cacheMissMs: number;
|
|
218
|
+
identifierCheckMs: number;
|
|
219
|
+
fastSkipCount: number;
|
|
220
|
+
fastSkipMs: number;
|
|
221
|
+
rewriteCallMs: number;
|
|
222
|
+
changedMissCount: number;
|
|
223
|
+
unchangedMissCount: number;
|
|
224
|
+
};
|
|
225
|
+
pageMergeBreakdown: {
|
|
226
|
+
componentScriptsMs: number;
|
|
227
|
+
componentInstancesMs: number;
|
|
228
|
+
refBindingsMs: number;
|
|
229
|
+
importsMs: number;
|
|
230
|
+
hoistedSymbolsMs: number;
|
|
231
|
+
runtimeSignalsMs: number;
|
|
232
|
+
hoistedCodeMs: number;
|
|
233
|
+
codeRebaseImportsMs: number;
|
|
234
|
+
codeFilterImportsMs: number;
|
|
235
|
+
codePropsPreludeMs: number;
|
|
236
|
+
codeTranspileMs: number;
|
|
237
|
+
codeTranspileCacheHits: number;
|
|
238
|
+
codeTranspileCacheMisses: number;
|
|
239
|
+
codeTranspileExactNoopCount: number;
|
|
240
|
+
codeTranspileTrimmedNoopCount: number;
|
|
241
|
+
codeTranspileChangedOutputCount: number;
|
|
242
|
+
codeDedupeImportsMs: number;
|
|
243
|
+
codeDeferRuntimeMs: number;
|
|
244
|
+
codeDeferRuntimeCacheHits: number;
|
|
245
|
+
codeDeferRuntimeCacheMisses: number;
|
|
246
|
+
};
|
|
247
|
+
pageComponentLoopBreakdown: {
|
|
248
|
+
componentSourceReadMs: number;
|
|
249
|
+
ownerSourceReadMs: number;
|
|
250
|
+
componentDocModeDetectMs: number;
|
|
251
|
+
componentExpressionRewriteBuildMs: number;
|
|
252
|
+
ownerExpressionRewriteBuildMs: number;
|
|
253
|
+
ownerScopeRewriteBuildMs: number;
|
|
254
|
+
};
|
|
255
|
+
pageExpandMs: number;
|
|
256
|
+
pageCompileMs: number;
|
|
257
|
+
pageOwnerCompileMs: number;
|
|
258
|
+
pageComponentCompileMs: number;
|
|
259
|
+
pageComponentCacheHits: number;
|
|
260
|
+
pageComponentCacheMisses: number;
|
|
261
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { relative } from 'node:path';
|
|
2
|
+
import { createBindingResolutionTotals, createComponentLoopPhaseTotals, createMergePhaseTotals, createOccurrenceApplyPhaseTotals, createPagePhaseTotals, createScopedRewritePhaseTotals } from './page-loop-metrics.js';
|
|
3
|
+
export function createPageLoopState() {
|
|
4
|
+
return {
|
|
5
|
+
...createPageLoopCaches(),
|
|
6
|
+
...createPageLoopExecutionState()
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function createPageLoopCaches() {
|
|
10
|
+
return {
|
|
11
|
+
componentIrCache: new Map(),
|
|
12
|
+
componentDocumentModeCache: new Map(),
|
|
13
|
+
componentExpressionRewriteCache: new Map(),
|
|
14
|
+
templateExpressionCache: new Map(),
|
|
15
|
+
hoistedCodeTransformCache: {
|
|
16
|
+
transpileToJs: new Map(),
|
|
17
|
+
deferRuntime: new Map()
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function createPageLoopExecutionState() {
|
|
22
|
+
return {
|
|
23
|
+
expressionRewriteMetrics: {
|
|
24
|
+
calls: 0,
|
|
25
|
+
cacheHits: 0,
|
|
26
|
+
cacheMisses: 0,
|
|
27
|
+
templateCompileMs: 0
|
|
28
|
+
},
|
|
29
|
+
pagePhaseTotals: createPagePhaseTotals(),
|
|
30
|
+
occurrenceApplyPhaseTotals: createOccurrenceApplyPhaseTotals(),
|
|
31
|
+
bindingResolutionTotals: createBindingResolutionTotals(),
|
|
32
|
+
scopedRewritePhaseTotals: createScopedRewritePhaseTotals(),
|
|
33
|
+
mergePhaseTotals: createMergePhaseTotals(),
|
|
34
|
+
componentLoopPhaseTotals: createComponentLoopPhaseTotals(),
|
|
35
|
+
pageProfiles: [],
|
|
36
|
+
envelopes: []
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function preparePageIrForMerge(pageIr) {
|
|
40
|
+
pageIr.components_scripts = pageIr.components_scripts || {};
|
|
41
|
+
pageIr.component_instances = pageIr.component_instances || [];
|
|
42
|
+
pageIr.signals = Array.isArray(pageIr.signals) ? pageIr.signals : [];
|
|
43
|
+
pageIr.hoisted = pageIr.hoisted || { imports: [], declarations: [], functions: [], signals: [], state: [], code: [] };
|
|
44
|
+
pageIr.hoisted.imports = pageIr.hoisted.imports || [];
|
|
45
|
+
pageIr.hoisted.declarations = pageIr.hoisted.declarations || [];
|
|
46
|
+
pageIr.hoisted.functions = pageIr.hoisted.functions || [];
|
|
47
|
+
pageIr.hoisted.signals = pageIr.hoisted.signals || [];
|
|
48
|
+
pageIr.hoisted.state = pageIr.hoisted.state || [];
|
|
49
|
+
pageIr.hoisted.code = pageIr.hoisted.code || [];
|
|
50
|
+
}
|
|
51
|
+
export function applyServerEnvelopeToPageIr({ pageIr, composedServer, hasGuard, hasLoad, entry, srcDir, sourceFile }) {
|
|
52
|
+
if (composedServer.serverScript) {
|
|
53
|
+
pageIr.server_script = composedServer.serverScript;
|
|
54
|
+
pageIr.prerender = composedServer.serverScript.prerender === true;
|
|
55
|
+
if (pageIr.ssr_data === undefined) {
|
|
56
|
+
pageIr.ssr_data = null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (pageIr.prerender === true && (hasGuard || hasLoad)) {
|
|
60
|
+
throw new Error(`[zenith] Build failed for ${entry.file}: protected routes require SSR/runtime. ` +
|
|
61
|
+
'Cannot prerender a static route with a `guard` or `load` function.');
|
|
62
|
+
}
|
|
63
|
+
pageIr.has_guard = hasGuard;
|
|
64
|
+
pageIr.has_load = hasLoad;
|
|
65
|
+
pageIr.guard_module_ref = composedServer.guardPath ? relative(srcDir, composedServer.guardPath).replaceAll('\\', '/') : null;
|
|
66
|
+
pageIr.load_module_ref = composedServer.loadPath ? relative(srcDir, composedServer.loadPath).replaceAll('\\', '/') : null;
|
|
67
|
+
preparePageIrForMerge(pageIr);
|
|
68
|
+
}
|
|
69
|
+
export function buildOccurrenceCountByPath(componentOccurrences) {
|
|
70
|
+
const occurrenceCountByPath = new Map();
|
|
71
|
+
for (const occurrence of componentOccurrences) {
|
|
72
|
+
const key = occurrence.componentPath || occurrence.name;
|
|
73
|
+
occurrenceCountByPath.set(key, (occurrenceCountByPath.get(key) || 0) + 1);
|
|
74
|
+
}
|
|
75
|
+
return occurrenceCountByPath;
|
|
76
|
+
}
|
|
77
|
+
export function createPageBuildState() {
|
|
78
|
+
return {
|
|
79
|
+
pagePhase: createPagePhaseTotals(),
|
|
80
|
+
pageOccurrenceApplyBreakdown: createOccurrenceApplyPhaseTotals(),
|
|
81
|
+
pageBindingResolutionBreakdown: createBindingResolutionTotals(),
|
|
82
|
+
pageScopedRewriteBreakdown: createScopedRewritePhaseTotals(),
|
|
83
|
+
pageMergeBreakdown: createMergePhaseTotals(),
|
|
84
|
+
pageComponentLoopBreakdown: createComponentLoopPhaseTotals(),
|
|
85
|
+
pageExpandMs: 0,
|
|
86
|
+
pageCompileMs: 0,
|
|
87
|
+
pageOwnerCompileMs: 0,
|
|
88
|
+
pageComponentCompileMs: 0,
|
|
89
|
+
pageComponentCacheHits: 0,
|
|
90
|
+
pageComponentCacheMisses: 0
|
|
91
|
+
};
|
|
92
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {{
|
|
3
|
+
* manifest: Array<{ path: string, file: string }>
|
|
4
|
+
* pagesDir: string
|
|
5
|
+
* srcDir: string
|
|
6
|
+
* registry: Map<string, string>
|
|
7
|
+
* compilerOpts: object
|
|
8
|
+
* compilerBin: string|object
|
|
9
|
+
* softNavigationEnabled: boolean
|
|
10
|
+
* startupProfile: ReturnType<import('../startup-profile.js').createStartupProfiler>
|
|
11
|
+
* compilerTotals: Record<string, number>
|
|
12
|
+
* emitCompilerWarning: (line: string) => void
|
|
13
|
+
* }} input
|
|
14
|
+
* @returns {Promise<{ envelopes: object[], expressionRewriteMetrics: Record<string, number> }>}
|
|
15
|
+
*/
|
|
16
|
+
export function buildPageEnvelopes(input: {
|
|
17
|
+
manifest: Array<{
|
|
18
|
+
path: string;
|
|
19
|
+
file: string;
|
|
20
|
+
}>;
|
|
21
|
+
pagesDir: string;
|
|
22
|
+
srcDir: string;
|
|
23
|
+
registry: Map<string, string>;
|
|
24
|
+
compilerOpts: object;
|
|
25
|
+
compilerBin: string | object;
|
|
26
|
+
softNavigationEnabled: boolean;
|
|
27
|
+
startupProfile: ReturnType<typeof import("../startup-profile.js").createStartupProfiler>;
|
|
28
|
+
compilerTotals: Record<string, number>;
|
|
29
|
+
emitCompilerWarning: (line: string) => void;
|
|
30
|
+
}): Promise<{
|
|
31
|
+
envelopes: object[];
|
|
32
|
+
expressionRewriteMetrics: Record<string, number>;
|
|
33
|
+
}>;
|