@nudojs/parser 0.3.1 → 0.4.0

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.
Files changed (2) hide show
  1. package/dist/index.js +4 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -400,7 +400,8 @@ function parseDirectivesFromComments(comments) {
400
400
  const parenStart = match.index + match[0].length - 1;
401
401
  const argsStr = extractBalancedParens(text, parenStart);
402
402
  if (argsStr === null) continue;
403
- const args = splitTopLevelArgs(argsStr).map(parseTypeValueExpr);
403
+ const cleaned = argsStr.split("\n").map((line) => line.replace(/^\s*\*\s?/, "")).join("\n");
404
+ const args = splitTopLevelArgs(cleaned).map(parseTypeValueExpr);
404
405
  const afterParen = parenStart + argsStr.length + 2;
405
406
  const restLine = text.slice(afterParen).split("\n")[0].trim();
406
407
  const arrowMatch = restLine.match(/^=>\s*(.+)/);
@@ -432,8 +433,8 @@ function parseDirectivesFromComments(comments) {
432
433
  }
433
434
  function getFunctionName(node) {
434
435
  if (node.type === "FunctionDeclaration" && node.id) return node.id.name;
435
- if (node.type === "ExportNamedDeclaration" && node.declaration?.type === "FunctionDeclaration" && node.declaration.id) {
436
- return node.declaration.id.name;
436
+ if (node.type === "ExportNamedDeclaration") {
437
+ return node.declaration ? getFunctionName(node.declaration) : "<anonymous>";
437
438
  }
438
439
  if (node.type === "ExportDefaultDeclaration" && node.declaration.type === "FunctionDeclaration" && node.declaration.id) {
439
440
  return node.declaration.id.name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nudojs/parser",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Babel-based parser and directive extraction for Nudo",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "registry": "https://registry.npmjs.org"
37
37
  },
38
38
  "dependencies": {
39
- "@nudojs/core": "0.3.1"
39
+ "@nudojs/core": "0.4.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "tsup src/index.ts --format esm --dts"