noxcturnal 0.1.2 → 0.1.3
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/README.md +19 -0
- package/dist/noxcturnal.d.ts +48 -5
- package/dist/noxcturnal.js +1255 -1090
- package/dist/noxcturnal.js.map +1 -1
- package/dist/noxcturnal.mjs +619 -454
- package/dist/noxcturnal.mjs.map +1 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -63,6 +63,25 @@ Every plugin in a phase observes the same immutable input. Its edits become visi
|
|
|
63
63
|
phase boundary, after validation and an optional reparse. Split dependent transforms into separate
|
|
64
64
|
phases when a later transform must observe an earlier transform's output.
|
|
65
65
|
|
|
66
|
+
Plugins that only apply to particular syntax can declare a necessary condition:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
contract: {
|
|
70
|
+
syntax: {
|
|
71
|
+
anyOf: ['AsyncFunction', 'Super'];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The plugin runs only when at least one listed feature occurs in the current phase's input.
|
|
77
|
+
Features are concrete AST node kinds, plus `AsyncFunction` (including async arrows and methods)
|
|
78
|
+
and `GeneratorFunction` (including generator methods). Comments, strings, and property names do
|
|
79
|
+
not count as the syntax they mention. Choose a conservative condition: use `analyze` for further
|
|
80
|
+
semantic checks. A rejected plugin skips all lifecycle hooks, including state creation and cleanup,
|
|
81
|
+
and adds no retention or child hydration requirements. Native syntax selection shares the input
|
|
82
|
+
parse with active visitors and is reevaluated when earlier phases change the source. Pipelines
|
|
83
|
+
without syntax requirements keep their existing execution path.
|
|
84
|
+
|
|
66
85
|
`path.matchesPattern()` uses native AST facts. Declare `fields: ['memberPath']` for static or
|
|
67
86
|
computed member expressions or `fields: ['name']` for identifiers, including in child contracts.
|
|
68
87
|
Missing declarations throw. An identifier reached through a `memberPath` declaration returns false,
|
package/dist/noxcturnal.d.ts
CHANGED
|
@@ -1047,7 +1047,7 @@ interface NativeChildRoles {
|
|
|
1047
1047
|
};
|
|
1048
1048
|
TSModuleDeclaration: {
|
|
1049
1049
|
readonly body: {
|
|
1050
|
-
readonly child: 'TSModuleBlock';
|
|
1050
|
+
readonly child: 'TSModuleBlock' | 'TSModuleDeclaration';
|
|
1051
1051
|
readonly list: false;
|
|
1052
1052
|
};
|
|
1053
1053
|
};
|
|
@@ -4431,6 +4431,8 @@ interface PreflightReactRefresh {
|
|
|
4431
4431
|
}
|
|
4432
4432
|
/** Focused Metro-compatible post-processing. Each operation is independently selectable. */
|
|
4433
4433
|
interface PreflightOptimize {
|
|
4434
|
+
/** Top-level bindings are private to a module wrapper. Affects DCE only, not parsing. */
|
|
4435
|
+
moduleContext?: boolean | undefined;
|
|
4434
4436
|
constantFolding?: boolean | undefined;
|
|
4435
4437
|
deadCodeElimination?: boolean | undefined;
|
|
4436
4438
|
}
|
|
@@ -4828,7 +4830,9 @@ declare enum ArtifactDemand {
|
|
|
4828
4830
|
}
|
|
4829
4831
|
|
|
4830
4832
|
interface NativePreflightOptionsInput {
|
|
4833
|
+
functionMap?: boolean;
|
|
4831
4834
|
sourceFilename?: string;
|
|
4835
|
+
optimizationModuleContext?: boolean;
|
|
4832
4836
|
reactCompiler?: boolean;
|
|
4833
4837
|
reactCompilerCompilationMode?: string;
|
|
4834
4838
|
reactCompilerPanicThreshold?: string;
|
|
@@ -4889,6 +4893,7 @@ interface NativePreflightOptionsInput {
|
|
|
4889
4893
|
}
|
|
4890
4894
|
interface NativePreflightResultOutput {
|
|
4891
4895
|
status: 'complete' | 'unsupported' | 'error';
|
|
4896
|
+
functionMap?: FunctionMap;
|
|
4892
4897
|
changed: boolean;
|
|
4893
4898
|
normalizedJavascript: boolean;
|
|
4894
4899
|
jsx: boolean;
|
|
@@ -4901,6 +4906,20 @@ interface NativePreflightResultOutput {
|
|
|
4901
4906
|
helpersUsed: string[];
|
|
4902
4907
|
}
|
|
4903
4908
|
interface NativeBinding$1 {
|
|
4909
|
+
NativeParsedSource: new (
|
|
4910
|
+
source: string,
|
|
4911
|
+
filename: string
|
|
4912
|
+
) => {
|
|
4913
|
+
syntaxFacts(): string[];
|
|
4914
|
+
functionMap(): FunctionMap;
|
|
4915
|
+
materializeRouted(manifest: Buffer): Buffer;
|
|
4916
|
+
materialize(
|
|
4917
|
+
retentionManifest: Buffer,
|
|
4918
|
+
initialRouteManifest: Buffer
|
|
4919
|
+
): NativeIndexedSessionBinding;
|
|
4920
|
+
validate(): void;
|
|
4921
|
+
close(): void;
|
|
4922
|
+
};
|
|
4904
4923
|
NativeSourceText: new (source: string) => {
|
|
4905
4924
|
generateUid(name: string, filename: string): string;
|
|
4906
4925
|
whitespace(): number[];
|
|
@@ -4943,9 +4962,16 @@ interface NativeBinding$1 {
|
|
|
4943
4962
|
initialRouteManifest?: Buffer,
|
|
4944
4963
|
buildInitialRoute?: boolean
|
|
4945
4964
|
) => {
|
|
4965
|
+
generateUid(name: string): string | null;
|
|
4946
4966
|
nextRoutedPacked(manifest: Buffer, rootStart?: number, rootEnd?: number): Buffer;
|
|
4947
4967
|
queryGlobalsBuffer(names: string[]): Buffer;
|
|
4948
4968
|
globalBindingReferencesBuffer(name: string): Buffer;
|
|
4969
|
+
queryBindingsBatch(
|
|
4970
|
+
requests: {
|
|
4971
|
+
name: string;
|
|
4972
|
+
scopeId: number;
|
|
4973
|
+
}[]
|
|
4974
|
+
): ReturnType<NativeIndexedSessionBinding['queryBindings']>;
|
|
4949
4975
|
queryBindings(
|
|
4950
4976
|
name?: string,
|
|
4951
4977
|
scopeId?: number,
|
|
@@ -5052,6 +5078,13 @@ interface NativeBinding$1 {
|
|
|
5052
5078
|
calleeGlobal: boolean;
|
|
5053
5079
|
staticArgument?: string;
|
|
5054
5080
|
}[];
|
|
5081
|
+
queryCallsBatch(
|
|
5082
|
+
requests: {
|
|
5083
|
+
callee: string;
|
|
5084
|
+
globalOnly?: boolean;
|
|
5085
|
+
staticArguments?: boolean;
|
|
5086
|
+
}[]
|
|
5087
|
+
): ReturnType<NativeIndexedSessionBinding['queryCalls']>[];
|
|
5055
5088
|
queryNodesPackedBuffer(nodeTypes: string[]): Buffer;
|
|
5056
5089
|
scopeParentId(scopeId: number): number | null;
|
|
5057
5090
|
close(): void;
|
|
@@ -5151,7 +5184,7 @@ interface NativeBinding$1 {
|
|
|
5151
5184
|
rootEnd?: number
|
|
5152
5185
|
): Buffer;
|
|
5153
5186
|
/**
|
|
5154
|
-
* Throws for
|
|
5187
|
+
* Throws for internal failures and invalid constructs — a `var` binding in a
|
|
5155
5188
|
* match pattern, say. `bailed` is for everything the erasure merely does not
|
|
5156
5189
|
* cover, where the parser adapter is expected to take over; a throw means it
|
|
5157
5190
|
* would fail too, so the message is the answer.
|
|
@@ -5175,6 +5208,7 @@ interface NativeBinding$1 {
|
|
|
5175
5208
|
validateStatements(code: string, parserMode?: string): void;
|
|
5176
5209
|
}
|
|
5177
5210
|
declare const native: NativeBinding$1;
|
|
5211
|
+
type NativeIndexedSessionBinding = InstanceType<NativeBinding$1['NativeIndexedSession']>;
|
|
5178
5212
|
|
|
5179
5213
|
declare class NativeTransformError extends Error {
|
|
5180
5214
|
readonly diagnostics: Diagnostic[];
|
|
@@ -6016,12 +6050,20 @@ declare function defineVisitor<
|
|
|
6016
6050
|
contract: Contract & ValidateContract<Route, Contract>,
|
|
6017
6051
|
handler: TypedVisitorHandler<Route, Contract, State>
|
|
6018
6052
|
): DefinedVisitor<State>;
|
|
6053
|
+
/** Concrete AST kinds, plus function modifiers needed by compatibility repairs. */
|
|
6054
|
+
type SyntaxFeature = NativeNodeType | 'AsyncFunction' | 'GeneratorFunction';
|
|
6019
6055
|
/**
|
|
6020
|
-
* Plugin-level requirements and typings for `context`:
|
|
6021
|
-
* semantic queries. The visitor contract types the path;
|
|
6022
|
-
* types the context.
|
|
6056
|
+
* Plugin-level requirements and typings for `context`: syntax applicability,
|
|
6057
|
+
* metadata ownership, and semantic queries. The visitor contract types the path;
|
|
6058
|
+
* the plugin contract types the context.
|
|
6023
6059
|
*/
|
|
6024
6060
|
interface PluginContract {
|
|
6061
|
+
/** Run this plugin only when at least one feature occurs in the current phase
|
|
6062
|
+
* input. Rejected plugins skip every lifecycle hook and contribute no retained
|
|
6063
|
+
* data. Comments and string contents do not count as syntax. */
|
|
6064
|
+
syntax?: {
|
|
6065
|
+
readonly anyOf: readonly SyntaxFeature[];
|
|
6066
|
+
};
|
|
6025
6067
|
metadata?: {
|
|
6026
6068
|
writes?: readonly string[];
|
|
6027
6069
|
reads?: readonly string[];
|
|
@@ -6396,6 +6438,7 @@ export type {
|
|
|
6396
6438
|
SourceMapMode,
|
|
6397
6439
|
StoredVisitorContract,
|
|
6398
6440
|
StringLiteralView,
|
|
6441
|
+
SyntaxFeature,
|
|
6399
6442
|
TransformDecision,
|
|
6400
6443
|
TransformOptions,
|
|
6401
6444
|
TransformResult,
|