@wyw-in-js/transform 2.0.0-alpha.0 → 2.0.0-alpha.1
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/esm/cache.js +7 -0
- package/esm/cache.js.map +1 -1
- package/esm/debug/fileReporter.js +35 -1
- package/esm/debug/fileReporter.js.map +1 -1
- package/esm/eval/broker.js +230 -89
- package/esm/eval/broker.js.map +1 -1
- package/esm/eval/protocol.js.map +1 -1
- package/esm/eval/runner.js +143 -24
- package/esm/eval/runner.js.map +1 -1
- package/esm/module.js +70 -43
- package/esm/module.js.map +1 -1
- package/esm/transform/Entrypoint.types.js.map +1 -1
- package/esm/transform/generators/processEntrypoint.js +35 -20
- package/esm/transform/generators/processEntrypoint.js.map +1 -1
- package/esm/transform/generators/resolveImports.js +48 -2
- package/esm/transform/generators/resolveImports.js.map +1 -1
- package/esm/transform/generators/resolveStaticOxcValues/cache.js +182 -0
- package/esm/transform/generators/resolveStaticOxcValues/cache.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/candidateResolver.js +146 -0
- package/esm/transform/generators/resolveStaticOxcValues/candidateResolver.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/dependencies.js +33 -0
- package/esm/transform/generators/resolveStaticOxcValues/dependencies.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/environment.js +29 -0
- package/esm/transform/generators/resolveStaticOxcValues/environment.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/exportResolver.js +351 -0
- package/esm/transform/generators/resolveStaticOxcValues/exportResolver.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/exportTargets.js +253 -0
- package/esm/transform/generators/resolveStaticOxcValues/exportTargets.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/objectAssign.js +310 -0
- package/esm/transform/generators/resolveStaticOxcValues/objectAssign.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/objectAssignStaticExport.js +74 -0
- package/esm/transform/generators/resolveStaticOxcValues/objectAssignStaticExport.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/opaqueRuntime.js +229 -0
- package/esm/transform/generators/resolveStaticOxcValues/opaqueRuntime.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/processorStaticExport.js +172 -0
- package/esm/transform/generators/resolveStaticOxcValues/processorStaticExport.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/processorStaticModel.js +476 -0
- package/esm/transform/generators/resolveStaticOxcValues/processorStaticModel.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/processorTarget.js +55 -0
- package/esm/transform/generators/resolveStaticOxcValues/processorTarget.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/programAnalysis.js +123 -0
- package/esm/transform/generators/resolveStaticOxcValues/programAnalysis.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/prune.js +186 -0
- package/esm/transform/generators/resolveStaticOxcValues/prune.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/resolveStaticOxcPreevalValues.js +183 -0
- package/esm/transform/generators/resolveStaticOxcValues/resolveStaticOxcPreevalValues.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/staticExpression.js +298 -0
- package/esm/transform/generators/resolveStaticOxcValues/staticExpression.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/staticExpressionDependencies.js +298 -0
- package/esm/transform/generators/resolveStaticOxcValues/staticExpressionDependencies.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/types.js +3 -0
- package/esm/transform/generators/resolveStaticOxcValues/types.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues/zeroArgFunctionStaticExport.js +59 -0
- package/esm/transform/generators/resolveStaticOxcValues/zeroArgFunctionStaticExport.js.map +1 -0
- package/esm/transform/generators/resolveStaticOxcValues.js +1 -2910
- package/esm/transform/generators/resolveStaticOxcValues.js.map +1 -1
- package/esm/transform/generators/transform.js +57 -45
- package/esm/transform/generators/transform.js.map +1 -1
- package/esm/transform/helpers/loadWywOptions.js +33 -4
- package/esm/transform/helpers/loadWywOptions.js.map +1 -1
- package/esm/transform.js +3 -1
- package/esm/transform.js.map +1 -1
- package/esm/utils/EventEmitter.js +42 -9
- package/esm/utils/EventEmitter.js.map +1 -1
- package/esm/utils/applyOxcProcessors/applyOxcProcessors.js +160 -0
- package/esm/utils/applyOxcProcessors/applyOxcProcessors.js.map +1 -0
- package/esm/utils/applyOxcProcessors/cleanupBindings.js +157 -0
- package/esm/utils/applyOxcProcessors/cleanupBindings.js.map +1 -0
- package/esm/utils/applyOxcProcessors/cleanupRemovals.js +431 -0
- package/esm/utils/applyOxcProcessors/cleanupRemovals.js.map +1 -0
- package/esm/utils/applyOxcProcessors/displayName.js +93 -0
- package/esm/utils/applyOxcProcessors/displayName.js.map +1 -0
- package/esm/utils/applyOxcProcessors/expressionValues.js +152 -0
- package/esm/utils/applyOxcProcessors/expressionValues.js.map +1 -0
- package/esm/utils/applyOxcProcessors/processorFactory.js +62 -0
- package/esm/utils/applyOxcProcessors/processorFactory.js.map +1 -0
- package/esm/utils/applyOxcProcessors/processorUsages.js +143 -0
- package/esm/utils/applyOxcProcessors/processorUsages.js.map +1 -0
- package/esm/utils/applyOxcProcessors/sameFileStaticValues.js +207 -0
- package/esm/utils/applyOxcProcessors/sameFileStaticValues.js.map +1 -0
- package/esm/utils/applyOxcProcessors/shared.js +29 -0
- package/esm/utils/applyOxcProcessors/shared.js.map +1 -0
- package/esm/utils/applyOxcProcessors/types.js +2 -0
- package/esm/utils/applyOxcProcessors/types.js.map +1 -0
- package/esm/utils/applyOxcProcessors.js +1 -1216
- package/esm/utils/applyOxcProcessors.js.map +1 -1
- package/esm/utils/collectOxcRuntime/normalizeRuntimeCode.js +157 -0
- package/esm/utils/collectOxcRuntime/normalizeRuntimeCode.js.map +1 -0
- package/esm/utils/collectOxcRuntime/sourceMap.js +36 -0
- package/esm/utils/collectOxcRuntime/sourceMap.js.map +1 -0
- package/esm/utils/collectOxcRuntime/types.js +2 -0
- package/esm/utils/collectOxcRuntime/types.js.map +1 -0
- package/esm/utils/collectOxcRuntime.js +5 -193
- package/esm/utils/collectOxcRuntime.js.map +1 -1
- package/esm/utils/collectOxcTemplateDependencies/expressionExtraction.js +496 -0
- package/esm/utils/collectOxcTemplateDependencies/expressionExtraction.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies/expressionReplacements.js +113 -0
- package/esm/utils/collectOxcTemplateDependencies/expressionReplacements.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies/scopeAnalysis.js +387 -0
- package/esm/utils/collectOxcTemplateDependencies/scopeAnalysis.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies/staticBindings.js +17 -0
- package/esm/utils/collectOxcTemplateDependencies/staticBindings.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies/staticEvaluator.js +540 -0
- package/esm/utils/collectOxcTemplateDependencies/staticEvaluator.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies/types.js +2 -0
- package/esm/utils/collectOxcTemplateDependencies/types.js.map +1 -0
- package/esm/utils/collectOxcTemplateDependencies.js +3 -1397
- package/esm/utils/collectOxcTemplateDependencies.js.map +1 -1
- package/esm/utils/nativeResolver.js +93 -0
- package/esm/utils/nativeResolver.js.map +1 -0
- package/esm/utils/oxc/ast.js +28 -0
- package/esm/utils/oxc/ast.js.map +1 -0
- package/esm/utils/oxc/parse.js +3 -0
- package/esm/utils/oxc/parse.js.map +1 -0
- package/esm/utils/oxc/replacements.js +14 -0
- package/esm/utils/oxc/replacements.js.map +1 -0
- package/esm/utils/oxc/sourceLocations.js +59 -0
- package/esm/utils/oxc/sourceLocations.js.map +1 -0
- package/esm/utils/oxcPreevalStage/evalStrategy.js +3 -0
- package/esm/utils/oxcPreevalStage/evalStrategy.js.map +1 -0
- package/esm/utils/oxcPreevalStage/prepareCode.js +21 -0
- package/esm/utils/oxcPreevalStage/prepareCode.js.map +1 -0
- package/esm/utils/oxcPreevalStage/prevalExport.js +23 -0
- package/esm/utils/oxcPreevalStage/prevalExport.js.map +1 -0
- package/esm/utils/oxcPreevalStage/processors.js +17 -0
- package/esm/utils/oxcPreevalStage/processors.js.map +1 -0
- package/esm/utils/oxcPreevalStage/staticOverlay.js +18 -0
- package/esm/utils/oxcPreevalStage/staticOverlay.js.map +1 -0
- package/esm/utils/oxcPreevalStage/types.js +2 -0
- package/esm/utils/oxcPreevalStage/types.js.map +1 -0
- package/esm/utils/oxcPreevalStage.js +17 -73
- package/esm/utils/oxcPreevalStage.js.map +1 -1
- package/esm/utils/oxcPreevalTransforms.js +12 -1
- package/esm/utils/oxcPreevalTransforms.js.map +1 -1
- package/esm/utils/processorStaticSemantics.js +157 -0
- package/esm/utils/processorStaticSemantics.js.map +1 -0
- package/esm/utils/resolveWithConditions.js +3 -3
- package/esm/utils/resolveWithConditions.js.map +1 -1
- package/package.json +4 -3
- package/types/cache.js +8 -0
- package/types/debug/fileReporter.js +46 -1
- package/types/eval/broker.d.ts +6 -2
- package/types/eval/broker.js +244 -95
- package/types/eval/protocol.d.ts +15 -1
- package/types/module.d.ts +4 -1
- package/types/module.js +97 -48
- package/types/transform/Entrypoint.types.d.ts +3 -0
- package/types/transform/generators/resolveImports.d.ts +3 -1
- package/types/transform/generators/resolveImports.js +49 -2
- package/types/transform/generators/resolveStaticOxcValues/cache.d.ts +25 -0
- package/types/transform/generators/resolveStaticOxcValues/cache.js +182 -0
- package/types/transform/generators/resolveStaticOxcValues/candidateResolver.d.ts +5 -0
- package/types/transform/generators/resolveStaticOxcValues/candidateResolver.js +149 -0
- package/types/transform/generators/resolveStaticOxcValues/dependencies.d.ts +6 -0
- package/types/transform/generators/resolveStaticOxcValues/dependencies.js +37 -0
- package/types/transform/generators/resolveStaticOxcValues/environment.d.ts +12 -0
- package/types/transform/generators/resolveStaticOxcValues/environment.js +32 -0
- package/types/transform/generators/resolveStaticOxcValues/exportResolver.d.ts +4 -0
- package/types/transform/generators/resolveStaticOxcValues/exportResolver.js +358 -0
- package/types/transform/generators/resolveStaticOxcValues/exportTargets.d.ts +20 -0
- package/types/transform/generators/resolveStaticOxcValues/exportTargets.js +285 -0
- package/types/transform/generators/resolveStaticOxcValues/objectAssign.d.ts +41 -0
- package/types/transform/generators/resolveStaticOxcValues/objectAssign.js +352 -0
- package/types/transform/generators/resolveStaticOxcValues/objectAssignStaticExport.d.ts +6 -0
- package/types/transform/generators/resolveStaticOxcValues/objectAssignStaticExport.js +88 -0
- package/types/transform/generators/resolveStaticOxcValues/opaqueRuntime.d.ts +13 -0
- package/types/transform/generators/resolveStaticOxcValues/opaqueRuntime.js +263 -0
- package/types/transform/generators/resolveStaticOxcValues/processorStaticExport.d.ts +4 -0
- package/types/transform/generators/resolveStaticOxcValues/processorStaticExport.js +191 -0
- package/types/transform/generators/resolveStaticOxcValues/processorStaticModel.d.ts +40 -0
- package/types/transform/generators/resolveStaticOxcValues/processorStaticModel.js +516 -0
- package/types/transform/generators/resolveStaticOxcValues/processorTarget.d.ts +5 -0
- package/types/transform/generators/resolveStaticOxcValues/processorTarget.js +62 -0
- package/types/transform/generators/resolveStaticOxcValues/programAnalysis.d.ts +11 -0
- package/types/transform/generators/resolveStaticOxcValues/programAnalysis.js +133 -0
- package/types/transform/generators/resolveStaticOxcValues/prune.d.ts +15 -0
- package/types/transform/generators/resolveStaticOxcValues/prune.js +220 -0
- package/types/transform/generators/resolveStaticOxcValues/resolveStaticOxcPreevalValues.d.ts +2 -0
- package/types/transform/generators/resolveStaticOxcValues/resolveStaticOxcPreevalValues.js +197 -0
- package/types/transform/generators/resolveStaticOxcValues/staticExpression.d.ts +25 -0
- package/types/transform/generators/resolveStaticOxcValues/staticExpression.js +391 -0
- package/types/transform/generators/resolveStaticOxcValues/staticExpressionDependencies.d.ts +14 -0
- package/types/transform/generators/resolveStaticOxcValues/staticExpressionDependencies.js +304 -0
- package/types/transform/generators/resolveStaticOxcValues/types.d.ts +99 -0
- package/types/transform/generators/resolveStaticOxcValues/types.js +2 -0
- package/types/transform/generators/resolveStaticOxcValues/zeroArgFunctionStaticExport.d.ts +7 -0
- package/types/transform/generators/resolveStaticOxcValues/zeroArgFunctionStaticExport.js +64 -0
- package/types/transform/generators/resolveStaticOxcValues.d.ts +1 -2
- package/types/transform/generators/resolveStaticOxcValues.js +1 -3235
- package/types/transform/generators/transform.js +63 -49
- package/types/transform/helpers/loadWywOptions.js +23 -3
- package/types/transform.js +3 -1
- package/types/utils/EventEmitter.d.ts +16 -1
- package/types/utils/EventEmitter.js +44 -9
- package/types/utils/applyOxcProcessors/applyOxcProcessors.d.ts +8 -0
- package/types/utils/applyOxcProcessors/applyOxcProcessors.js +167 -0
- package/types/utils/applyOxcProcessors/cleanupBindings.d.ts +12 -0
- package/types/utils/applyOxcProcessors/cleanupBindings.js +189 -0
- package/types/utils/applyOxcProcessors/cleanupRemovals.d.ts +16 -0
- package/types/utils/applyOxcProcessors/cleanupRemovals.js +482 -0
- package/types/utils/applyOxcProcessors/displayName.d.ts +9 -0
- package/types/utils/applyOxcProcessors/displayName.js +113 -0
- package/types/utils/applyOxcProcessors/expressionValues.d.ts +11 -0
- package/types/utils/applyOxcProcessors/expressionValues.js +170 -0
- package/types/utils/applyOxcProcessors/processorFactory.d.ts +7 -0
- package/types/utils/applyOxcProcessors/processorFactory.js +70 -0
- package/types/utils/applyOxcProcessors/processorUsages.d.ts +16 -0
- package/types/utils/applyOxcProcessors/processorUsages.js +163 -0
- package/types/utils/applyOxcProcessors/sameFileStaticValues.d.ts +23 -0
- package/types/utils/applyOxcProcessors/sameFileStaticValues.js +211 -0
- package/types/utils/applyOxcProcessors/shared.d.ts +10 -0
- package/types/utils/applyOxcProcessors/shared.js +37 -0
- package/types/utils/applyOxcProcessors/types.d.ts +88 -0
- package/types/utils/applyOxcProcessors/types.js +1 -0
- package/types/utils/applyOxcProcessors.d.ts +1 -16
- package/types/utils/applyOxcProcessors.js +1 -1391
- package/types/utils/collectOxcRuntime/normalizeRuntimeCode.d.ts +1 -0
- package/types/utils/collectOxcRuntime/normalizeRuntimeCode.js +185 -0
- package/types/utils/collectOxcRuntime/sourceMap.d.ts +2 -0
- package/types/utils/collectOxcRuntime/sourceMap.js +37 -0
- package/types/utils/collectOxcRuntime/types.d.ts +16 -0
- package/types/utils/collectOxcRuntime/types.js +1 -0
- package/types/utils/collectOxcRuntime.d.ts +2 -12
- package/types/utils/collectOxcRuntime.js +5 -224
- package/types/utils/collectOxcTemplateDependencies/expressionExtraction.d.ts +6 -0
- package/types/utils/collectOxcTemplateDependencies/expressionExtraction.js +550 -0
- package/types/utils/collectOxcTemplateDependencies/expressionReplacements.d.ts +11 -0
- package/types/utils/collectOxcTemplateDependencies/expressionReplacements.js +131 -0
- package/types/utils/collectOxcTemplateDependencies/scopeAnalysis.d.ts +20 -0
- package/types/utils/collectOxcTemplateDependencies/scopeAnalysis.js +434 -0
- package/types/utils/collectOxcTemplateDependencies/staticBindings.d.ts +7 -0
- package/types/utils/collectOxcTemplateDependencies/staticBindings.js +13 -0
- package/types/utils/collectOxcTemplateDependencies/staticEvaluator.d.ts +13 -0
- package/types/utils/collectOxcTemplateDependencies/staticEvaluator.js +626 -0
- package/types/utils/collectOxcTemplateDependencies/types.d.ts +116 -0
- package/types/utils/collectOxcTemplateDependencies/types.js +1 -0
- package/types/utils/collectOxcTemplateDependencies.d.ts +4 -38
- package/types/utils/collectOxcTemplateDependencies.js +3 -1580
- package/types/utils/nativeResolver.d.ts +13 -0
- package/types/utils/nativeResolver.js +91 -0
- package/types/utils/oxc/ast.d.ts +4 -0
- package/types/utils/oxc/ast.js +37 -0
- package/types/utils/oxc/parse.d.ts +3 -0
- package/types/utils/oxc/parse.js +2 -0
- package/types/utils/oxc/replacements.d.ts +12 -0
- package/types/utils/oxc/replacements.js +18 -0
- package/types/utils/oxc/sourceLocations.d.ts +5 -0
- package/types/utils/oxc/sourceLocations.js +63 -0
- package/types/utils/oxcPreevalStage/evalStrategy.d.ts +3 -0
- package/types/utils/oxcPreevalStage/evalStrategy.js +2 -0
- package/types/utils/oxcPreevalStage/prepareCode.d.ts +3 -0
- package/types/utils/oxcPreevalStage/prepareCode.js +20 -0
- package/types/utils/oxcPreevalStage/prevalExport.d.ts +1 -0
- package/types/utils/oxcPreevalStage/prevalExport.js +22 -0
- package/types/utils/oxcPreevalStage/processors.d.ts +10 -0
- package/types/utils/oxcPreevalStage/processors.js +16 -0
- package/types/utils/oxcPreevalStage/staticOverlay.d.ts +3 -0
- package/types/utils/oxcPreevalStage/staticOverlay.js +23 -0
- package/types/utils/oxcPreevalStage/types.d.ts +22 -0
- package/types/utils/oxcPreevalStage/types.js +1 -0
- package/types/utils/oxcPreevalStage.d.ts +2 -18
- package/types/utils/oxcPreevalStage.js +17 -79
- package/types/utils/oxcPreevalTransforms.js +14 -1
- package/types/utils/processorStaticSemantics.d.ts +13 -0
- package/types/utils/processorStaticSemantics.js +191 -0
- package/types/utils/resolveWithConditions.js +3 -3
- package/esm/eval/resolverStrategy.js +0 -51
- package/esm/eval/resolverStrategy.js.map +0 -1
- package/types/eval/resolverStrategy.d.ts +0 -13
- package/types/eval/resolverStrategy.js +0 -46
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { ExpressionValue, ValueType } from '@wyw-in-js/shared';
|
|
2
|
+
import type { AssignmentExpression, Expression, Node, TemplateLiteral, UpdateExpression, VariableDeclaration, VariableDeclarator } from 'oxc-parser';
|
|
3
|
+
import type { OxcValueReplacement } from '../oxc/replacements';
|
|
4
|
+
import type { OxcLocationLookup } from '../oxc/sourceLocations';
|
|
5
|
+
export type OxcFunctionLikeNode = Node & {
|
|
6
|
+
async: boolean;
|
|
7
|
+
body: Node | null;
|
|
8
|
+
id?: {
|
|
9
|
+
name: string;
|
|
10
|
+
} | null;
|
|
11
|
+
params: Node[];
|
|
12
|
+
};
|
|
13
|
+
export type BindingKind = 'function' | 'import' | 'param' | 'variable';
|
|
14
|
+
export type ScopedDeclarationKind = 'const' | 'let' | 'var';
|
|
15
|
+
export type Binding = {
|
|
16
|
+
declarationKind?: ScopedDeclarationKind;
|
|
17
|
+
declaredAt: number;
|
|
18
|
+
declaration: VariableDeclaration | null;
|
|
19
|
+
declarator: VariableDeclarator | null;
|
|
20
|
+
functionNode?: OxcFunctionLikeNode | null;
|
|
21
|
+
imported?: 'default' | '*' | string;
|
|
22
|
+
importedFrom?: string;
|
|
23
|
+
isRoot: boolean;
|
|
24
|
+
kind: BindingKind;
|
|
25
|
+
name: string;
|
|
26
|
+
scope: Scope;
|
|
27
|
+
};
|
|
28
|
+
export type Replacement = OxcValueReplacement;
|
|
29
|
+
export type SpanLookup = Set<string> | null;
|
|
30
|
+
export type LocationLookup = OxcLocationLookup;
|
|
31
|
+
export type ExpressionSpan = {
|
|
32
|
+
end: number;
|
|
33
|
+
start: number;
|
|
34
|
+
};
|
|
35
|
+
export type Scope = {
|
|
36
|
+
bindings: Map<string, Binding>;
|
|
37
|
+
depth: number;
|
|
38
|
+
end: number;
|
|
39
|
+
functionBoundary: boolean;
|
|
40
|
+
params: Set<string>;
|
|
41
|
+
parent: Scope | null;
|
|
42
|
+
root: boolean;
|
|
43
|
+
start: number;
|
|
44
|
+
};
|
|
45
|
+
export type ReferenceIdentifier = {
|
|
46
|
+
end: number;
|
|
47
|
+
name: string;
|
|
48
|
+
start: number;
|
|
49
|
+
};
|
|
50
|
+
export type OxcStaticImportReference = {
|
|
51
|
+
imported: 'default' | string;
|
|
52
|
+
importLocal?: string;
|
|
53
|
+
local: string;
|
|
54
|
+
source: string;
|
|
55
|
+
};
|
|
56
|
+
export type OxcStaticValue = {
|
|
57
|
+
name: string;
|
|
58
|
+
value: unknown;
|
|
59
|
+
};
|
|
60
|
+
export type OxcStaticValueCandidate = {
|
|
61
|
+
imports: OxcStaticImportReference[];
|
|
62
|
+
inlineConstants?: Record<string, unknown>;
|
|
63
|
+
name: string;
|
|
64
|
+
source: string;
|
|
65
|
+
};
|
|
66
|
+
export type TemplateExtractionResult = {
|
|
67
|
+
code: string;
|
|
68
|
+
dependencyNames: string[];
|
|
69
|
+
expressionValues: Omit<ExpressionValue, 'buildCodeFrameError'>[];
|
|
70
|
+
staticValueCandidates: OxcStaticValueCandidate[];
|
|
71
|
+
staticValues: OxcStaticValue[];
|
|
72
|
+
};
|
|
73
|
+
export type StaticBindings = Record<string, Record<string, unknown>>;
|
|
74
|
+
export type ExtractedExpression = {
|
|
75
|
+
expressionCode: string;
|
|
76
|
+
hasInlinableLocalReference?: boolean;
|
|
77
|
+
importedFrom: string[];
|
|
78
|
+
kind: ValueType.FUNCTION | ValueType.LAZY;
|
|
79
|
+
staticExpressionCode?: string;
|
|
80
|
+
staticImports: OxcStaticImportReference[];
|
|
81
|
+
staticValue?: unknown;
|
|
82
|
+
};
|
|
83
|
+
export type StaticLocalExpression = {
|
|
84
|
+
importedFrom: string[];
|
|
85
|
+
imports: OxcStaticImportReference[];
|
|
86
|
+
source: string;
|
|
87
|
+
};
|
|
88
|
+
export type ProgramAnalysis = {
|
|
89
|
+
bindingsByName: Map<string, Binding[]>;
|
|
90
|
+
rootMutationsByBinding: Map<string, Array<AssignmentExpression | UpdateExpression>>;
|
|
91
|
+
targetExpressions: Expression[];
|
|
92
|
+
templateLiterals: TemplateLiteral[];
|
|
93
|
+
usedNames: Set<string>;
|
|
94
|
+
};
|
|
95
|
+
export type ExtractionContext = {
|
|
96
|
+
bindingResolutionCache: Map<string, Map<number, Binding | null>>;
|
|
97
|
+
bindingsByName: Map<string, Binding[]>;
|
|
98
|
+
code: string;
|
|
99
|
+
currentInsertionPoint: number;
|
|
100
|
+
currentExpressionStart: number;
|
|
101
|
+
dependencyNames: Set<string>;
|
|
102
|
+
expressionValues: Omit<ExpressionValue, 'buildCodeFrameError'>[];
|
|
103
|
+
filename: string;
|
|
104
|
+
hoistedBindingNames: Map<string, string>;
|
|
105
|
+
hoistedDeclarations: Map<string, string>;
|
|
106
|
+
hoistedDeclarationsByInsertionPoint: Map<number, string[]>;
|
|
107
|
+
loc: LocationLookup;
|
|
108
|
+
referencesByNode: WeakMap<Node, ReferenceIdentifier[]>;
|
|
109
|
+
replacements: Replacement[];
|
|
110
|
+
rootMutationsByBinding: Map<string, Array<AssignmentExpression | UpdateExpression>>;
|
|
111
|
+
staticBindings?: StaticBindings;
|
|
112
|
+
staticImportAliases: Map<string, string>;
|
|
113
|
+
staticValueCandidates: OxcStaticValueCandidate[];
|
|
114
|
+
staticValues: OxcStaticValue[];
|
|
115
|
+
usedNames: Set<string>;
|
|
116
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,38 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
export type OxcStaticImportReference = {
|
|
7
|
-
imported: 'default' | string;
|
|
8
|
-
importLocal?: string;
|
|
9
|
-
local: string;
|
|
10
|
-
source: string;
|
|
11
|
-
};
|
|
12
|
-
export type OxcStaticValue = {
|
|
13
|
-
name: string;
|
|
14
|
-
value: unknown;
|
|
15
|
-
};
|
|
16
|
-
export type OxcStaticValueCandidate = {
|
|
17
|
-
imports: OxcStaticImportReference[];
|
|
18
|
-
name: string;
|
|
19
|
-
source: string;
|
|
20
|
-
};
|
|
21
|
-
type TemplateExtractionResult = {
|
|
22
|
-
code: string;
|
|
23
|
-
dependencyNames: string[];
|
|
24
|
-
expressionValues: Omit<ExpressionValue, 'buildCodeFrameError'>[];
|
|
25
|
-
staticValueCandidates: OxcStaticValueCandidate[];
|
|
26
|
-
staticValues: OxcStaticValue[];
|
|
27
|
-
};
|
|
28
|
-
declare const oxcStaticCallableValue: unique symbol;
|
|
29
|
-
type OxcStaticCallableValue = {
|
|
30
|
-
[oxcStaticCallableValue]: unknown;
|
|
31
|
-
};
|
|
32
|
-
export declare const createOxcStaticCallableValue: (value: unknown) => OxcStaticCallableValue;
|
|
33
|
-
export declare const isOxcStaticSerializableValue: (value: unknown) => boolean;
|
|
34
|
-
export declare const evaluateOxcStaticExpressionAt: (code: string, filename: string, expressionSpan: ExpressionSpan, staticBindings?: Map<string, unknown>) => unknown | undefined;
|
|
35
|
-
export declare const evaluateOxcStaticExpression: (source: string, filename: string, staticBindings?: Map<string, unknown>) => unknown | undefined;
|
|
36
|
-
export declare const collectOxcExpressionDependencies: (code: string, filename: string, evaluate?: boolean, targetExpressionSpans?: ExpressionSpan[]) => TemplateExtractionResult;
|
|
37
|
-
export declare const collectOxcTemplateDependencies: (code: string, filename: string, evaluate?: boolean, targetTemplateSpans?: ExpressionSpan[]) => TemplateExtractionResult;
|
|
38
|
-
export {};
|
|
1
|
+
export type { OxcStaticImportReference, OxcStaticValue, OxcStaticValueCandidate, StaticBindings, } from './collectOxcTemplateDependencies/types';
|
|
2
|
+
export { lookupStaticBinding } from './collectOxcTemplateDependencies/staticBindings';
|
|
3
|
+
export { createOxcStaticCallableValue } from './collectOxcTemplateDependencies/staticEvaluator';
|
|
4
|
+
export { collectOxcExpressionDependencies, collectOxcTemplateDependencies, evaluateOxcStaticExpression, evaluateOxcStaticExpressionAt, isOxcStaticSerializableValue, } from './collectOxcTemplateDependencies/expressionExtraction';
|