function createSwcPath(node, parent, stop, scope) {
  /** @type {SwcPath} */
  const swcPath = {
    node,
    parent,
    stop,
    // TODO: "pre-traverse" the missing scope parts instead via getter that adds refs and bindings for current scope
    scope,
    parentPath: parent ? getPathFromNode(parent) : null,
    get(/** @type {string} */ id) {
      const swcPathForNode = getPathFromNode(node[id]);
      if (node[id] && !swcPathForNode) {
        // throw new Error(
        //   `[oxcTraverse]: Use {needsAdvancedPaths: true} to find path for node: ${node[name]}`,
        // );
        // TODO: "pre-traverse" the missing path parts instead
      }
      return swcPathForNode;
    },
    get type() {
      return node.type;
    },
    traverse(visitor) {
      // eslint-disable-next-line no-use-before-define
      return oxcTraverse(node, visitor);
    },
  };
  swcPathCache.set(node, swcPath);
  return swcPath;
}
@param {SwcNode} node
@param {SwcNode|null} parent
@param {Function} stop
@param {SwcScope} [scope]
@returns {SwcPath}