Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ast-generator

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ast-generator - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

41

dist/index.js

@@ -43,3 +43,2 @@ #!/usr/bin/env node

// src/index.ts
var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
var _commander = require('commander');

@@ -185,12 +184,12 @@

}
const defined = new Set(grammar.nodes.map((n) => n.name));
const unreferenced = new Set(grammar.nodes.map((n) => n.name));
for (const name of referenced) {
defined.delete(name);
unreferenced.delete(name);
}
defined.delete("Document");
unreferenced.delete(grammar.startNode);
_tinyinvariant2.default.call(void 0,
defined.size === 0,
`The following node kinds are never referenced: ${Array.from(defined).join(
", "
)}`
unreferenced.size === 0,
`The following node kinds are never referenced: ${Array.from(
unreferenced
).join(", ")}`
);

@@ -296,2 +295,4 @@ }

return {
// The first-defined node in the document is the start node
startNode: Object.keys(nodesByName)[0],
nodesByName,

@@ -327,2 +328,13 @@ nodes: Object.keys(nodesByName).sort().map((name) => nodesByName[name]),

}
function asNode<N extends Node>(node: N): N {
return Object.defineProperties(
node,
{
_kind: { enumerable: false },
range: { enumerable: false }
}
);
}
`

@@ -403,3 +415,3 @@ ];

${runtimeTypeChecks.length > 0 ? `DEBUG && (() => { ${runtimeTypeChecks.join("\n")} })()` : ""}
return {
return asNode({
_kind: ${JSON.stringify(node.name)},

@@ -409,3 +421,3 @@ ${[...node.fields.map((field) => field.name), "range"].join(

)}
}
});
}

@@ -490,2 +502,9 @@ `);

// src/index.ts
function red(msg) {
if (typeof process !== "undefined" && process.stdout.isTTY) {
return "\x1B[31m" + msg + "\x1B[39m";
} else {
return msg;
}
}
function main() {

@@ -506,4 +525,4 @@ return __async(this, null, function* () {

main().then(() => process.exit(0)).catch((e) => {
console.error(_chalk2.default.red(e.message));
console.error(red(e.message));
process.exit(1);
});
{
"name": "ast-generator",
"version": "0.1.0",
"version": "0.2.0",
"description": "Helper to generate a TypeScript or JavaScript module for an arbitrary AST definition from a specification.",

@@ -16,3 +16,4 @@ "bin": {

"format": "eslint --fix src/ ; prettier --write src/",
"test": "vitest run --coverage"
"test": "vitest run --coverage",
"release": "npm run test && npm run lint && npm run build && release-it"
},

@@ -36,3 +37,2 @@ "author": "Vincent Driessen",

"dependencies": {
"chalk": "<5",
"commander": "^10.0.0",

@@ -44,12 +44,15 @@ "prettier": "^2.8.7",

"devDependencies": {
"@release-it/keep-a-changelog": "^5.0.0",
"@types/node": "^20.11.21",
"@types/prettier": "^2.7.2",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@vitest/coverage-istanbul": "^0.29.8",
"eslint": "^8.38.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-simple-import-sort": "^10.0.0",
"tsup": "^6.7.0",
"vitest": "^0.29.8"
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@vitest/coverage-istanbul": "^1.3.1",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-simple-import-sort": "^12.0.0",
"release-it": "^17.1.1",
"tsup": "^8.0.2",
"vitest": "^1.3.1"
},
"sideEffects": false
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc