aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/estree-walker/src/async.js
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-14 14:46:37 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-14 14:46:37 -0800
commitafa87af01c79a9baa539f2992d32154d2a4739bd (patch)
tree92c7416db734270a2fee1d72ee9cc119379ff8e1 /vanilla/node_modules/estree-walker/src/async.js
parent3b927e84d200402281f68181cd4253bc77e5528d (diff)
downloadneko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.gz
neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.bz2
neko-afa87af01c79a9baa539f2992d32154d2a4739bd.zip
task: delete vanilla js prototype\n\n- Removed vanilla/ directory and web/dist/vanilla directory\n- Updated Makefile, Dockerfile, and CI workflow to remove vanilla references\n- Cleaned up web/web.go to remove vanilla embed and routes\n- Verified build and tests pass\n\nCloses NK-2tcnmq
Diffstat (limited to 'vanilla/node_modules/estree-walker/src/async.js')
-rw-r--r--vanilla/node_modules/estree-walker/src/async.js152
1 files changed, 0 insertions, 152 deletions
diff --git a/vanilla/node_modules/estree-walker/src/async.js b/vanilla/node_modules/estree-walker/src/async.js
deleted file mode 100644
index f068c71..0000000
--- a/vanilla/node_modules/estree-walker/src/async.js
+++ /dev/null
@@ -1,152 +0,0 @@
-import { WalkerBase } from './walker.js';
-
-/**
- * @typedef { import('estree').Node} Node
- * @typedef { import('./walker.js').WalkerContext} WalkerContext
- * @typedef {(
- * this: WalkerContext,
- * node: Node,
- * parent: Node | null,
- * key: string | number | symbol | null | undefined,
- * index: number | null | undefined
- * ) => Promise<void>} AsyncHandler
- */
-
-export class AsyncWalker extends WalkerBase {
- /**
- *
- * @param {AsyncHandler} [enter]
- * @param {AsyncHandler} [leave]
- */
- constructor(enter, leave) {
- super();
-
- /** @type {boolean} */
- this.should_skip = false;
-
- /** @type {boolean} */
- this.should_remove = false;
-
- /** @type {Node | null} */
- this.replacement = null;
-
- /** @type {WalkerContext} */
- this.context = {
- skip: () => (this.should_skip = true),
- remove: () => (this.should_remove = true),
- replace: (node) => (this.replacement = node)
- };
-
- /** @type {AsyncHandler | undefined} */
- this.enter = enter;
-
- /** @type {AsyncHandler | undefined} */
- this.leave = leave;
- }
-
- /**
- * @template {Node} Parent
- * @param {Node} node
- * @param {Parent | null} parent
- * @param {keyof Parent} [prop]
- * @param {number | null} [index]
- * @returns {Promise<Node | null>}
- */
- async visit(node, parent, prop, index) {
- if (node) {
- if (this.enter) {
- const _should_skip = this.should_skip;
- const _should_remove = this.should_remove;
- const _replacement = this.replacement;
- this.should_skip = false;
- this.should_remove = false;
- this.replacement = null;
-
- await this.enter.call(this.context, node, parent, prop, index);
-
- if (this.replacement) {
- node = this.replacement;
- this.replace(parent, prop, index, node);
- }
-
- if (this.should_remove) {
- this.remove(parent, prop, index);
- }
-
- const skipped = this.should_skip;
- const removed = this.should_remove;
-
- this.should_skip = _should_skip;
- this.should_remove = _should_remove;
- this.replacement = _replacement;
-
- if (skipped) return node;
- if (removed) return null;
- }
-
- /** @type {keyof Node} */
- let key;
-
- for (key in node) {
- /** @type {unknown} */
- const value = node[key];
-
- if (value && typeof value === 'object') {
- if (Array.isArray(value)) {
- const nodes = /** @type {Array<unknown>} */ (value);
- for (let i = 0; i < nodes.length; i += 1) {
- const item = nodes[i];
- if (isNode(item)) {
- if (!(await this.visit(item, node, key, i))) {
- // removed
- i--;
- }
- }
- }
- } else if (isNode(value)) {
- await this.visit(value, node, key, null);
- }
- }
- }
-
- if (this.leave) {
- const _replacement = this.replacement;
- const _should_remove = this.should_remove;
- this.replacement = null;
- this.should_remove = false;
-
- await this.leave.call(this.context, node, parent, prop, index);
-
- if (this.replacement) {
- node = this.replacement;
- this.replace(parent, prop, index, node);
- }
-
- if (this.should_remove) {
- this.remove(parent, prop, index);
- }
-
- const removed = this.should_remove;
-
- this.replacement = _replacement;
- this.should_remove = _should_remove;
-
- if (removed) return null;
- }
- }
-
- return node;
- }
-}
-
-/**
- * Ducktype a node.
- *
- * @param {unknown} value
- * @returns {value is Node}
- */
-function isNode(value) {
- return (
- value !== null && typeof value === 'object' && 'type' in value && typeof value.type === 'string'
- );
-}