comment-parser
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -65,3 +65,2 @@ var CommentParser = (function (exports) { | ||
var Markers; | ||
(function (Markers) { | ||
@@ -72,3 +71,3 @@ Markers["start"] = "/**"; | ||
Markers["end"] = "*/"; | ||
})(Markers || (Markers = {})); | ||
})(exports.Markers || (exports.Markers = {})); | ||
@@ -83,7 +82,7 @@ function getParser$1({ startLine = 0, } = {}) { | ||
if (block === null && | ||
rest.startsWith(Markers.start) && | ||
!rest.startsWith(Markers.nostart)) { | ||
rest.startsWith(exports.Markers.start) && | ||
!rest.startsWith(exports.Markers.nostart)) { | ||
block = []; | ||
tokens.delimiter = rest.slice(0, Markers.start.length); | ||
rest = rest.slice(Markers.start.length); | ||
tokens.delimiter = rest.slice(0, exports.Markers.start.length); | ||
rest = rest.slice(exports.Markers.start.length); | ||
[tokens.postDelimiter, rest] = splitSpace(rest); | ||
@@ -95,8 +94,8 @@ } | ||
} | ||
const isClosed = rest.trimRight().endsWith(Markers.end); | ||
const isClosed = rest.trimRight().endsWith(exports.Markers.end); | ||
if (tokens.delimiter === '' && | ||
rest.startsWith(Markers.delim) && | ||
!rest.startsWith(Markers.end)) { | ||
tokens.delimiter = Markers.delim; | ||
rest = rest.slice(Markers.delim.length); | ||
rest.startsWith(exports.Markers.delim) && | ||
!rest.startsWith(exports.Markers.end)) { | ||
tokens.delimiter = exports.Markers.delim; | ||
rest = rest.slice(exports.Markers.delim.length); | ||
[tokens.postDelimiter, rest] = splitSpace(rest); | ||
@@ -106,4 +105,4 @@ } | ||
const trimmed = rest.trimRight(); | ||
tokens.end = rest.slice(trimmed.length - Markers.end.length); | ||
rest = trimmed.slice(0, -Markers.end.length); | ||
tokens.end = rest.slice(trimmed.length - exports.Markers.end.length); | ||
rest = trimmed.slice(0, -exports.Markers.end.length); | ||
} | ||
@@ -351,3 +350,3 @@ tokens.description = rest; | ||
if (lines[0].tokens.description === '' && | ||
lines[0].tokens.delimiter === Markers.start) | ||
lines[0].tokens.delimiter === exports.Markers.start) | ||
lines = lines.slice(1); | ||
@@ -358,3 +357,3 @@ // skip the closing line with no description | ||
lastLine.tokens.description === '' && | ||
lastLine.tokens.end.endsWith(Markers.end)) | ||
lastLine.tokens.end.endsWith(exports.Markers.end)) | ||
lines = lines.slice(0, -1); | ||
@@ -435,3 +434,3 @@ // description starts at the last line of type definition | ||
const getWidth = (w, { tokens: t }) => ({ | ||
start: t.delimiter === Markers.start ? t.start.length : w.start, | ||
start: t.delimiter === exports.Markers.start ? t.start.length : w.start, | ||
tag: Math.max(w.tag, t.tag.length), | ||
@@ -454,3 +453,3 @@ type: Math.max(w.type, t.type.length), | ||
// dangling '*/' | ||
if (tokens.end === Markers.end && isEmpty) { | ||
if (tokens.end === exports.Markers.end && isEmpty) { | ||
tokens.start = space(w.start + 1); | ||
@@ -460,6 +459,6 @@ return Object.assign(Object.assign({}, line), { tokens }); | ||
switch (tokens.delimiter) { | ||
case Markers.start: | ||
case exports.Markers.start: | ||
tokens.start = space(w.start); | ||
break; | ||
case Markers.delim: | ||
case exports.Markers.delim: | ||
tokens.start = space(w.start + 1); | ||
@@ -466,0 +465,0 @@ break; |
@@ -0,1 +1,14 @@ | ||
# v1.1.4 | ||
- `bugfix` fix unsynced lib/ | ||
# v1.1.3 | ||
- export primitive type on the top level: Markers, Block, Spec, Line, Tokens, Problem | ||
# v1.1.2 | ||
- `bugfix` Allow to build nested tags from `name.subname` even if `name` wasn't d | ||
- `bugfix` Preserve indentation when extracting comments | ||
# v1.1.1 | ||
- add helpers for rewiring Spec.source <-> Spec.tags.source | ||
# v1.1.0 | ||
@@ -8,5 +21,2 @@ - split tokenizers into separate modules | ||
# v1.1.1 | ||
- add helpers for rewiring Spec.source <-> Spec.tags.source | ||
# v1.0.0 | ||
@@ -13,0 +23,0 @@ - complete rewrite in TS with more flexible API |
@@ -9,2 +9,3 @@ import { Options as ParserOptions } from './parser/index'; | ||
import { flow as flowTransform } from './transforms/index'; | ||
export * from './primitives'; | ||
export declare function parse(source: string, options?: Partial<ParserOptions>): import("./primitives").Block[]; | ||
@@ -11,0 +12,0 @@ export declare const stringify: import("./stringifier").Stringifier; |
@@ -10,2 +10,3 @@ import getParser from './parser/index'; | ||
import { flow as flowTransform } from './transforms/index'; | ||
export * from './primitives'; | ||
export function parse(source, options = {}) { | ||
@@ -12,0 +13,0 @@ return getParser(options)(source); |
@@ -9,2 +9,3 @@ import { Options as ParserOptions } from './parser/index'; | ||
import { flow as flowTransform } from './transforms/index'; | ||
export * from './primitives'; | ||
export declare function parse(source: string, options?: Partial<ParserOptions>): import("./primitives").Block[]; | ||
@@ -11,0 +12,0 @@ export declare const stringify: import("./stringifier").Stringifier; |
"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 __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -13,2 +23,3 @@ exports.tokenizers = exports.transforms = exports.inspect = exports.stringify = exports.parse = void 0; | ||
const index_3 = require("./transforms/index"); | ||
__exportStar(require("./primitives"), exports); | ||
function parse(source, options = {}) { | ||
@@ -15,0 +26,0 @@ return index_1.default(options)(source); |
{ | ||
"name": "comment-parser", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Generic JSDoc-like comment parser", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
267094
9091