textlint-util-to-string
Advanced tools
Comparing version 3.3.3 to 3.3.4
import { TxtNode } from "@textlint/ast-node-types"; | ||
import { Node as UnistNode } from "unist"; | ||
import { UnistNode } from "./UnistNode"; | ||
export type StringSourceReplacerMaskValueCommand = { | ||
@@ -4,0 +4,0 @@ type: "StringSourceReplacerMaskValueCommand"; |
@@ -1,5 +0,5 @@ | ||
import type { TxtNode, TxtNodeLocation, TxtNodeRange } from "@textlint/ast-node-types"; | ||
import type { TxtNode, TxtNodeLocation, TxtNodeRange, TxtParagraphNode } from "@textlint/ast-node-types"; | ||
import { SourcePosition } from "structured-source"; | ||
import type { Node as UnistNode } from "unist"; | ||
import { emptyValue, maskValue, StringSourceReplacerCommand } from "./replacer"; | ||
import { UnistNode } from "./UnistNode"; | ||
export type StringSourceOptions = { | ||
@@ -84,3 +84,3 @@ replacer?: ({ node, parent }: { | ||
originalPositionFromIndex(generatedIndex: number, isEnd?: boolean): SourcePosition | undefined; | ||
isParagraphNode(node: TxtNode | StringSourceTxtParentNodeLikeNode): boolean; | ||
isParagraphNode(node: TxtNode | StringSourceTxtParentNodeLikeNode): node is TxtParagraphNode; | ||
isStringNode(node: TxtNode | UnistNode): boolean; | ||
@@ -87,0 +87,0 @@ /** |
{ | ||
"name": "textlint-util-to-string", | ||
"version": "3.3.3", | ||
"version": "3.3.4", | ||
"description": "textlint utility that convert Paragraph Node to text with SourceMap.", | ||
@@ -31,3 +31,4 @@ "homepage": "https://github.com/textlint/textlint-util-to-string", | ||
"prepublish": "npm run --if-present build", | ||
"test": "mocha \"test/**/*.{js,ts}\"", | ||
"typecheck": "tsc --noEmit", | ||
"test": "npm run typecheck && mocha \"test/**/*.{js,ts}\"", | ||
"watch": "tsc -p . --watch", | ||
@@ -34,0 +35,0 @@ "format": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"", |
import { TxtNode } from "@textlint/ast-node-types"; | ||
import { Node as UnistNode } from "unist"; | ||
import { UnistNode } from "./UnistNode"; | ||
@@ -4,0 +4,0 @@ export type StringSourceReplacerMaskValueCommand = { |
@@ -1,4 +0,3 @@ | ||
import type { TxtHtmlNode, TxtNode, TxtNodeLocation, TxtNodeRange } from "@textlint/ast-node-types"; | ||
import type { TxtHtmlNode, TxtNode, TxtNodeLocation, TxtNodeRange, TxtParagraphNode } from "@textlint/ast-node-types"; | ||
import { SourcePosition, StructuredSource } from "structured-source"; | ||
import type { Node as UnistNode } from "unist"; | ||
import unified from "unified"; | ||
@@ -8,2 +7,3 @@ // @ts-expect-error no type definition | ||
import { emptyValue, handleReplacerCommand, maskValue, StringSourceReplacerCommand } from "./replacer"; | ||
import { UnistNode } from "./UnistNode"; | ||
@@ -232,3 +232,3 @@ const isTxtNode = (node: unknown): node is TxtNode => { | ||
isParagraphNode(node: TxtNode | StringSourceTxtParentNodeLikeNode): boolean { | ||
isParagraphNode(node: TxtNode | StringSourceTxtParentNodeLikeNode): node is TxtParagraphNode { | ||
return node.type === "Paragraph"; | ||
@@ -316,3 +316,3 @@ } | ||
const container = this.isParagraphNode(parent) ? newNode : parent; | ||
const rawValue = container.raw as string | undefined; | ||
const rawValue = "raw" in container ? container.raw : undefined; | ||
if (rawValue === undefined) { | ||
@@ -319,0 +319,0 @@ return; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
3893805
19
4206