@component-compass/parser-react 0.0.2 → 0.0.4
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/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/walk-jsx.d.ts +4 -1
- package/dist/walk-jsx.js +924 -344
- package/dist/walk-jsx.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -3,14 +3,22 @@ export const reactPlugin = {
|
|
|
3
3
|
name: "react",
|
|
4
4
|
extensions: [".tsx", ".jsx", ".ts", ".js"],
|
|
5
5
|
parse(file, source, ctx) {
|
|
6
|
+
// Single-pass scan invariant (#48): scan.ts owns the parse and threads
|
|
7
|
+
// the oxc Program through ctx.ast.
|
|
8
|
+
const program = ctx.ast;
|
|
9
|
+
if (program === undefined) {
|
|
10
|
+
throw new Error("parser-react: ctx.ast must be provided (single-pass scan, #48)");
|
|
11
|
+
}
|
|
6
12
|
return walkJsx({
|
|
7
13
|
file,
|
|
8
14
|
source,
|
|
15
|
+
ast: program,
|
|
9
16
|
resolveLazyManifest: ctx.resolveLazyManifest,
|
|
10
17
|
lookupByTag: ctx.lookupByTag,
|
|
11
18
|
localIndex: ctx.localIndex,
|
|
12
19
|
captureValues: ctx.config.captureValues,
|
|
13
20
|
repoRoot: ctx.repoRoot,
|
|
21
|
+
...(ctx.collector !== undefined ? { collector: ctx.collector } : {}),
|
|
14
22
|
});
|
|
15
23
|
},
|
|
16
24
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC;IAC1C,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;QACrB,uEAAuE;QACvE,mCAAmC;QACnC,MAAM,OAAO,GAAG,GAAG,CAAC,GAA0B,CAAC;QAC/C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,OAAO,CAAC;YACb,IAAI;YACJ,MAAM;YACN,GAAG,EAAE,OAAO;YACZ,mBAAmB,EAAE,GAAG,CAAC,mBAAmB;YAC5C,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,aAAa;YACvC,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,GAAG,CAAC,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACrE,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
package/dist/walk-jsx.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Program } from "@oxc-project/types";
|
|
2
|
+
import type { DiagnosticCollector, Occurrence, FileImport, WrapperDef, Warning, LocalDefinitionIndex, LookupByTag, ResolveLazyManifest } from "@component-compass/plugin-core";
|
|
2
3
|
type WalkOptions = {
|
|
3
4
|
file: string;
|
|
4
5
|
source: string;
|
|
6
|
+
ast: Program;
|
|
5
7
|
resolveLazyManifest: ResolveLazyManifest;
|
|
6
8
|
lookupByTag: LookupByTag;
|
|
7
9
|
localIndex: LocalDefinitionIndex;
|
|
8
10
|
captureValues: boolean;
|
|
9
11
|
repoRoot: string;
|
|
12
|
+
collector?: DiagnosticCollector;
|
|
10
13
|
};
|
|
11
14
|
export type WalkOutput = {
|
|
12
15
|
occurrences: Occurrence[];
|