@wxml/traverse
Advanced tools
Comparing version 0.0.2 to 0.0.3
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const colors = __importStar(require("colors")); | ||
const colors_1 = __importDefault(require("colors")); | ||
exports.default = { | ||
error(msg) { | ||
colors.red(`【Error】${msg}`); | ||
console.log(colors_1.default.red(`【Error】${msg}`)); | ||
}, | ||
warn(msg) { | ||
colors.yellow(`【Warn】${msg}`); | ||
console.log(colors_1.default.yellow(`【Warn】${msg}`)); | ||
}, | ||
trace(msg) { | ||
colors.green(`【Trace】${msg}`); | ||
console.log(colors_1.default.green(`【Trace】${msg}`)); | ||
}, | ||
}; |
@@ -754,3 +754,8 @@ "use strict"; | ||
} | ||
function traverseNode(node, opts, scope, state, parentPath, skipKeys) { | ||
let DEBUG_SETTING_FLAG = false; | ||
function traverseNode(node, opts, scope, state, parentPath, skipKeys, debugEnable = false) { | ||
if (!DEBUG_SETTING_FLAG) { | ||
debug.enabled = debugEnable; | ||
debugEnable = true; | ||
} | ||
const keys = VISITOR_KEYS[node.type]; | ||
@@ -757,0 +762,0 @@ if (!keys) |
{ | ||
"name": "@wxml/traverse", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "", | ||
"main": "lib/traverse.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "tsc & node ./tests/index.js", | ||
"build": "rimraf ./lib & tsc", | ||
"prepublish": "rimraf ./lib & tsc" | ||
}, | ||
@@ -24,5 +26,3 @@ "repository": { | ||
"peerDependencies": { | ||
"@babel/generator": "^7.20.14", | ||
"@babel/parser": "^7.20.15", | ||
"@babel/traverse": "^7.20.13" | ||
"@wxml/parser": "^0.4.0" | ||
}, | ||
@@ -32,4 +32,7 @@ "devDependencies": { | ||
"@babel/parser": "^7.20.15", | ||
"@babel/traverse": "^7.20.13" | ||
"@babel/traverse": "^7.20.13", | ||
"@wxml/generator": "^0.1.0", | ||
"@wxml/parser": "^0.4.0", | ||
"rimraf": "^4.1.2" | ||
} | ||
} |
@@ -1,13 +0,13 @@ | ||
import * as colors from 'colors'; | ||
import colors from 'colors'; | ||
export default { | ||
error(msg: string) { | ||
colors.red(`【Error】${msg}`); | ||
console.log(colors.red(`【Error】${msg}`)); | ||
}, | ||
warn(msg: string) { | ||
colors.yellow(`【Warn】${msg}`); | ||
console.log(colors.yellow(`【Warn】${msg}`)); | ||
}, | ||
trace(msg: string) { | ||
colors.green(`【Trace】${msg}`); | ||
console.log(colors.green(`【Trace】${msg}`)); | ||
}, | ||
} |
// https://github.com/wxmlfile/wxml-parser/blob/main/docs/ast.md#real-type | ||
// const visitors = require('./visitors'); | ||
// const { explode } = require('../../gulp/wxmlUtils/visitors'); | ||
// const ElementType = visitors.ElementType; | ||
import { ElementType, explode } from "./visitors"; | ||
@@ -858,2 +855,4 @@ import logger from "./logger"; | ||
} | ||
let DEBUG_SETTING_FLAG = false; | ||
function traverseNode( | ||
@@ -865,4 +864,9 @@ node: ASTNode, | ||
parentPath: NodePath, | ||
skipKeys?: string[] | ||
skipKeys?: string[], | ||
debugEnable = false, | ||
) { | ||
if (!DEBUG_SETTING_FLAG) { | ||
debug.enabled = debugEnable; | ||
debugEnable = true; | ||
} | ||
const keys = VISITOR_KEYS[node.type]; | ||
@@ -869,0 +873,0 @@ if (!keys) return false; |
@@ -6,3 +6,3 @@ { | ||
"sourceMap": false, | ||
"lib": ["ESNext"], | ||
"lib": ["ESNext", "DOM"], | ||
"target": "es6", | ||
@@ -9,0 +9,0 @@ "moduleResolution": "node", |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
80829
2
16
2443
1
6
2