yuku-parser 0.6.8 → 0.6.10

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 CHANGED
@@ -60,7 +60,7 @@ sourceTypeFromPath("foo.mjs"); // "module"
60
60
 
61
61
  ## Walking the AST
62
62
 
63
- The AST is standard ESTree, and [`yuku-ast`](https://www.npmjs.com/package/yuku-ast) walks it with typed visitors, alias groups, in-place mutation, and syntactic utilities:
63
+ The AST is standard ESTree, and [`yuku-ast`](https://www.npmjs.com/package/yuku-ast) walks it with typed visitors, alias groups, in-place mutation, and syntactic utilities. `walk` imported from this package still works as a deprecated re-export and will be removed in the next major version:
64
64
 
65
65
  ```ts
66
66
  import { parse } from "yuku-parser";
package/index.d.ts CHANGED
@@ -70,22 +70,19 @@ interface ParseResult {
70
70
  */
71
71
  export function parse(source: string, options?: ParseOptions): ParseResult;
72
72
 
73
- // Walking
73
+ // Deprecated walking surface. Walking moved to the yuku-ast package,
74
+ // these delegate there and will be removed in the next major version.
74
75
 
75
- /** A visitor function for one node type. */
76
+ /** @deprecated Import `WalkHandler` from the yuku-ast package instead. */
76
77
  type WalkHandler<T extends Node = Node, S = unknown> = (node: T, ctx: WalkContext<T, S>) => void;
77
78
 
78
- /** Enter/leave hooks for one node type. */
79
+ /** @deprecated Import `WalkHooks` from the yuku-ast package instead. */
79
80
  interface WalkHooks<T extends Node = Node, S = unknown> {
80
81
  enter?: WalkHandler<T, S>;
81
82
  leave?: WalkHandler<T, S>;
82
83
  }
83
84
 
84
- /**
85
- * Handlers keyed by node `type`, or the universal `enter`/`leave`. A bare
86
- * function is an enter handler; per node `enter` runs before children and
87
- * `leave` after.
88
- */
85
+ /** @deprecated Import `Visitors` from the yuku-ast package instead. */
89
86
  type Visitors<S = unknown> = {
90
87
  [K in NodeType]?: WalkHandler<NodeOfType<K>, S> | WalkHooks<NodeOfType<K>, S>;
91
88
  } & {
@@ -94,9 +91,8 @@ type Visitors<S = unknown> = {
94
91
  };
95
92
 
96
93
  /**
97
- * Walk an AST depth-first, dispatching to typed visitors and mutating
98
- * in place. Traversal order is driven by tables generated from the
99
- * parser's AST definition, so it can never drift. Returns the root.
94
+ * @deprecated Walking moved to the yuku-ast package. Install yuku-ast
95
+ * and import `walk` from there. Removed in the next major version.
100
96
  */
101
97
  export function walk<T extends Node, S = unknown>(root: T, visitors: Visitors<S>, state?: S): T;
102
98
 
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { walk as astWalk } from "yuku-ast";
1
2
  import binding from "./binding.js";
2
3
  import { decode } from "./decode.js";
3
4
 
@@ -16,3 +17,5 @@ export function langFromPath(path) {
16
17
  export function sourceTypeFromPath(path) {
17
18
  return path.endsWith(".cjs") || path.endsWith(".cts") ? "script" : "module";
18
19
  }
20
+
21
+ export { WalkContext, walk } from "yuku-ast";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuku-parser",
3
- "version": "0.6.8",
3
+ "version": "0.6.10",
4
4
  "description": "High-performance JavaScript/TypeScript parser",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,20 +17,21 @@
17
17
  "decode.js"
18
18
  ],
19
19
  "optionalDependencies": {
20
- "@yuku-parser/binding-linux-x64-gnu": "0.6.8",
21
- "@yuku-parser/binding-linux-arm64-gnu": "0.6.8",
22
- "@yuku-parser/binding-linux-arm-gnu": "0.6.8",
23
- "@yuku-parser/binding-linux-x64-musl": "0.6.8",
24
- "@yuku-parser/binding-linux-arm64-musl": "0.6.8",
25
- "@yuku-parser/binding-linux-arm-musl": "0.6.8",
26
- "@yuku-parser/binding-darwin-x64": "0.6.8",
27
- "@yuku-parser/binding-darwin-arm64": "0.6.8",
28
- "@yuku-parser/binding-win32-x64": "0.6.8",
29
- "@yuku-parser/binding-win32-arm64": "0.6.8",
30
- "@yuku-parser/binding-freebsd-x64": "0.6.8"
20
+ "@yuku-parser/binding-linux-x64-gnu": "0.6.10",
21
+ "@yuku-parser/binding-linux-arm64-gnu": "0.6.10",
22
+ "@yuku-parser/binding-linux-arm-gnu": "0.6.10",
23
+ "@yuku-parser/binding-linux-x64-musl": "0.6.10",
24
+ "@yuku-parser/binding-linux-arm64-musl": "0.6.10",
25
+ "@yuku-parser/binding-linux-arm-musl": "0.6.10",
26
+ "@yuku-parser/binding-darwin-x64": "0.6.10",
27
+ "@yuku-parser/binding-darwin-arm64": "0.6.10",
28
+ "@yuku-parser/binding-win32-x64": "0.6.10",
29
+ "@yuku-parser/binding-win32-arm64": "0.6.10",
30
+ "@yuku-parser/binding-freebsd-x64": "0.6.10"
31
31
  },
32
32
  "dependencies": {
33
- "@yuku-toolchain/types": "0.6.5"
33
+ "@yuku-toolchain/types": "0.6.8",
34
+ "yuku-ast": "0.6.8"
34
35
  },
35
36
  "keywords": [
36
37
  "acorn",