From 3b9f4cda7a7c4d78c878d447010e0aa274404248 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 3 Mar 2022 13:39:23 +0100 Subject: [PATCH 01/24] Fix types to support instances of `Node` again --- index.js | 5 +++-- package.json | 1 + test.js | 20 ++++++++++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 1b4a320..848978f 100644 --- a/index.js +++ b/index.js @@ -1,14 +1,15 @@ /** * @typedef {import('unist').Point} Point + * @typedef {import('unist').Node} Node * @typedef {import('unist').Position} Position - * @typedef {Record & {type: string, position?: Position|undefined}} NodeLike + * @typedef {object & {type: string, position?: Position|undefined}} NodeLike */ /** * Stringify one point, a position (start and end points), or a node’s * positional information. * - * @param {NodeLike|Position|Point|null} [value] + * @param {Node|NodeLike|Position|Point|null} [value] * @returns {string} */ export function stringifyPosition(value) { diff --git a/package.json b/package.json index 38ea1f3..c22c9db 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "@types/unist": "^2.0.0" }, "devDependencies": { + "@types/mdast": "^3.0.0", "@types/tape": "^4.0.0", "c8": "^7.0.0", "prettier": "^2.0.0", diff --git a/test.js b/test.js index 5ae7b4d..921e87c 100644 --- a/test.js +++ b/test.js @@ -77,7 +77,22 @@ test('stringifyPosition', function (t) { } }), '2:5-2:6', - 'should return a range for `node` with valid `position`' + 'should return a range for `node` with valid `position` (types: literal object)' + ) + + t.equal( + stringifyPosition( + /** @type {import('mdast').Root} */ ({ + type: 'root', + children: [], + position: { + start: {line: 1, column: 1}, + end: {line: 2, column: 1} + } + }) + ), + '1:1-2:1', + 'should return a range for `node` with valid `position` (types: explicit instance of node)' ) t.equal( @@ -102,9 +117,10 @@ test('stringifyPosition', function (t) { ) t.equal( - // @ts-expect-error runtime. stringifyPosition({ + // @ts-expect-error runtime. start: {line: null, column: null}, + // @ts-expect-error runtime. end: {line: null, column: null} }), '1:1-1:1', From c11abaa2dd12a12de3342af56b6473b8e3b0eb9e Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 3 Mar 2022 13:42:23 +0100 Subject: [PATCH 02/24] 3.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c22c9db..5d23327 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "unist-util-stringify-position", - "version": "3.0.1", + "version": "3.0.2", "description": "unist utility to serialize a node, position, or point as a human readable location", "license": "MIT", "keywords": [ From 766c63c1caf71a68ea5df8bc501756e0a5c05bb4 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Sun, 5 Jun 2022 16:14:15 +0200 Subject: [PATCH 03/24] Update dev-dependencies --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5d23327..374887c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "tape": "^5.0.0", "type-coverage": "^2.0.0", "typescript": "^4.0.0", - "xo": "^0.48.0" + "xo": "^0.49.0" }, "scripts": { "prepack": "npm run build && npm run format", From dcf4b52926ed57388ff3375573e17a8486a1b291 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Sun, 5 Jun 2022 16:17:13 +0200 Subject: [PATCH 04/24] Refactor some docs --- readme.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/readme.md b/readme.md index 5fe2e1d..e9987d8 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,7 @@ [![Backers][backers-badge]][collective] [![Chat][chat-badge]][chat] -**[unist][]** utility to pretty print the positional information of a node. +[unist][] utility to pretty print the positional info of a node. ## Contents @@ -39,7 +39,7 @@ For example, when throwing errors or warning messages about something. ## Install This package is [ESM only][esm]. -In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: +In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]: ```sh npm install unist-util-stringify-position @@ -83,7 +83,7 @@ There is no default export. ### `stringifyPosition(node|position|point)` -Stringify a [point][], [position][], or a [node][]. +Stringify a point, position, or node. ###### Parameters @@ -96,22 +96,23 @@ Stringify a [point][], [position][], or a [node][]. ###### Returns -`string?` — A range `ls:cs-le:ce` (when given `node` or `position`) or a point -`l:c` (when given `point`), where `l` stands for line, `c` for column, `s` for -`start`, and `e` for end. +Pretty printed positional info of a node (`string`). +In the format of a range `ls:cs-le:ce` (when given `node` or `position`) or a +point `l:c` (when given `point`), where `l` stands for line, `c` for column, `s` +for `start`, and `e` for end. An empty string (`''`) is returned if the given value is neither `node`, `position`, nor `point`. ## Types This package is fully typed with [TypeScript][]. -There are no additional types exported. +It exports no additional types. ## Compatibility Projects maintained by the unified collective are compatible with all maintained versions of Node.js. -As of now, that is Node.js 12.20+, 14.14+, and 16.0+. +As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+. Our projects sometimes work with older versions, but this is not guaranteed. ## Security From 55fe3ee4619614ddf7e8e1abb6e0bbe022e82bfc Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 23 Jan 2023 13:03:11 +0100 Subject: [PATCH 05/24] Update dev-dependencies --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 374887c..25f5d94 100644 --- a/package.json +++ b/package.json @@ -41,13 +41,13 @@ "@types/tape": "^4.0.0", "c8": "^7.0.0", "prettier": "^2.0.0", - "remark-cli": "^10.0.0", + "remark-cli": "^11.0.0", "remark-preset-wooorm": "^9.0.0", "rimraf": "^3.0.0", "tape": "^5.0.0", "type-coverage": "^2.0.0", "typescript": "^4.0.0", - "xo": "^0.49.0" + "xo": "^0.53.0" }, "scripts": { "prepack": "npm run build && npm run format", From 7020fea1aba888b1a47806ac73fc6551b4cb2779 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 23 Jan 2023 13:03:16 +0100 Subject: [PATCH 06/24] Fix types --- index.js | 24 +++++++++++++++++++----- test.js | 17 +---------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/index.js b/index.js index 848978f..20ce0d1 100644 --- a/index.js +++ b/index.js @@ -2,14 +2,28 @@ * @typedef {import('unist').Point} Point * @typedef {import('unist').Node} Node * @typedef {import('unist').Position} Position - * @typedef {object & {type: string, position?: Position|undefined}} NodeLike + */ + +/** + * @typedef NodeLike + * @property {string} type + * @property {PositionLike | null | undefined} [position] + * + * @typedef PositionLike + * @property {PointLike | null | undefined} [start] + * @property {PointLike | null | undefined} [end] + * + * @typedef PointLike + * @property {number | null | undefined} [line] + * @property {number | null | undefined} [column] + * @property {number | null | undefined} [offset] */ /** * Stringify one point, a position (start and end points), or a node’s * positional information. * - * @param {Node|NodeLike|Position|Point|null} [value] + * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value] * @returns {string} */ export function stringifyPosition(value) { @@ -38,7 +52,7 @@ export function stringifyPosition(value) { } /** - * @param {Point|undefined} point + * @param {Point | PointLike | null | undefined} point * @returns {string} */ function point(point) { @@ -46,7 +60,7 @@ function point(point) { } /** - * @param {Position|undefined} pos + * @param {Position | PositionLike | null | undefined} pos * @returns {string} */ function position(pos) { @@ -54,7 +68,7 @@ function position(pos) { } /** - * @param {number|undefined} value + * @param {number | null | undefined} value * @returns {number} */ function index(value) { diff --git a/test.js b/test.js index 921e87c..d850a64 100644 --- a/test.js +++ b/test.js @@ -24,12 +24,7 @@ test('stringifyPosition', function (t) { '', 'should return empty `string` with `number`' ) - t.equal( - // @ts-expect-error runtime. - stringifyPosition({}), - '', - 'should return empty `string` with `{}`' - ) + t.equal(stringifyPosition({}), '', 'should return empty `string` with `{}`') t.equal( stringifyPosition({type: 'text'}), @@ -47,7 +42,6 @@ test('stringifyPosition', function (t) { t.equal( stringifyPosition({ type: 'text', - // @ts-expect-error runtime. position: {start: {}, end: {}} }), '1:1-1:1', @@ -58,9 +52,7 @@ test('stringifyPosition', function (t) { stringifyPosition({ type: 'text', position: { - // @ts-expect-error runtime. start: {line: null, column: null}, - // @ts-expect-error runtime. end: {line: null, column: null} } }), @@ -96,7 +88,6 @@ test('stringifyPosition', function (t) { ) t.equal( - // @ts-expect-error runtime. stringifyPosition({start: null, end: null}), '1:1-1:1', 'should return a range for a `position` without `point`s' @@ -110,7 +101,6 @@ test('stringifyPosition', function (t) { ) t.equal( - // @ts-expect-error runtime. stringifyPosition({start: {}, end: {}}), '1:1-1:1', 'should return range for `position` with invalid `point`s #1' @@ -118,9 +108,7 @@ test('stringifyPosition', function (t) { t.equal( stringifyPosition({ - // @ts-expect-error runtime. start: {line: null, column: null}, - // @ts-expect-error runtime. end: {line: null, column: null} }), '1:1-1:1', @@ -137,7 +125,6 @@ test('stringifyPosition', function (t) { ) t.equal( - // @ts-expect-error runtime. stringifyPosition({line: null, column: null}), '1:1', 'should return a point for a `point` without indices' @@ -151,14 +138,12 @@ test('stringifyPosition', function (t) { ) t.equal( - // @ts-expect-error runtime. stringifyPosition({line: 4}), '4:1', 'should return a point for a partially valid `point` #1' ) t.equal( - // @ts-expect-error runtime. stringifyPosition({column: 12}), '1:12', 'should return a point for a partially valid `point` #1' From 908163ad2078bfe632690a87190c1514a0ea539d Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 23 Jan 2023 13:03:25 +0100 Subject: [PATCH 07/24] Update Actions --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe284ad..89dc06c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,15 +7,15 @@ jobs: name: ${{matrix.node}} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: dcodeIO/setup-node-nvm@master + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: ${{matrix.node}} - run: npm install - run: npm test - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v3 strategy: matrix: node: - - lts/erbium + - lts/fermium - node From 9054f2debe4205cbae1c84d5d54eed8b4db60acf Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 23 Jan 2023 13:03:56 +0100 Subject: [PATCH 08/24] Update `tsconfig.json` --- package.json | 6 +++--- tsconfig.json | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 25f5d94..cc75df8 100644 --- a/package.json +++ b/package.json @@ -51,10 +51,10 @@ }, "scripts": { "prepack": "npm run build && npm run format", - "build": "rimraf \"*.d.ts\" && tsc && type-coverage", + "build": "tsc --build --clean && tsc --build && type-coverage", "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", - "test-api": "node test.js", - "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js", + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", "test": "npm run build && npm run format && npm run test-coverage" }, "prettier": { diff --git a/tsconfig.json b/tsconfig.json index e31adf8..ebe8889 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,17 @@ { - "include": ["*.js"], + "include": ["**/*.js"], + "exclude": ["coverage/", "node_modules/"], "compilerOptions": { - "target": "ES2020", - "lib": ["ES2020"], - "module": "ES2020", - "moduleResolution": "node", - "allowJs": true, "checkJs": true, "declaration": true, "emitDeclarationOnly": true, - "allowSyntheticDefaultImports": true, + "exactOptionalPropertyTypes": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es2020"], + "module": "node16", + "newLine": "lf", "skipLibCheck": true, - "strict": true + "strict": true, + "target": "es2020" } } From 3b5aa323c02fd012ddc1238dc2ae8351247ec1be Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 23 Jan 2023 13:04:37 +0100 Subject: [PATCH 09/24] Refactor to move implementation to `lib/` --- index.js | 77 +--------------------------------------------------- lib/index.js | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 78 insertions(+), 76 deletions(-) create mode 100644 lib/index.js diff --git a/index.js b/index.js index 20ce0d1..93163ea 100644 --- a/index.js +++ b/index.js @@ -1,76 +1 @@ -/** - * @typedef {import('unist').Point} Point - * @typedef {import('unist').Node} Node - * @typedef {import('unist').Position} Position - */ - -/** - * @typedef NodeLike - * @property {string} type - * @property {PositionLike | null | undefined} [position] - * - * @typedef PositionLike - * @property {PointLike | null | undefined} [start] - * @property {PointLike | null | undefined} [end] - * - * @typedef PointLike - * @property {number | null | undefined} [line] - * @property {number | null | undefined} [column] - * @property {number | null | undefined} [offset] - */ - -/** - * Stringify one point, a position (start and end points), or a node’s - * positional information. - * - * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value] - * @returns {string} - */ -export function stringifyPosition(value) { - // Nothing. - if (!value || typeof value !== 'object') { - return '' - } - - // Node. - if ('position' in value || 'type' in value) { - return position(value.position) - } - - // Position. - if ('start' in value || 'end' in value) { - return position(value) - } - - // Point. - if ('line' in value || 'column' in value) { - return point(value) - } - - // ? - return '' -} - -/** - * @param {Point | PointLike | null | undefined} point - * @returns {string} - */ -function point(point) { - return index(point && point.line) + ':' + index(point && point.column) -} - -/** - * @param {Position | PositionLike | null | undefined} pos - * @returns {string} - */ -function position(pos) { - return point(pos && pos.start) + '-' + point(pos && pos.end) -} - -/** - * @param {number | null | undefined} value - * @returns {number} - */ -function index(value) { - return value && typeof value === 'number' ? value : 1 -} +export {stringifyPosition} from './lib/index.js' diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 0000000..20ce0d1 --- /dev/null +++ b/lib/index.js @@ -0,0 +1,76 @@ +/** + * @typedef {import('unist').Point} Point + * @typedef {import('unist').Node} Node + * @typedef {import('unist').Position} Position + */ + +/** + * @typedef NodeLike + * @property {string} type + * @property {PositionLike | null | undefined} [position] + * + * @typedef PositionLike + * @property {PointLike | null | undefined} [start] + * @property {PointLike | null | undefined} [end] + * + * @typedef PointLike + * @property {number | null | undefined} [line] + * @property {number | null | undefined} [column] + * @property {number | null | undefined} [offset] + */ + +/** + * Stringify one point, a position (start and end points), or a node’s + * positional information. + * + * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value] + * @returns {string} + */ +export function stringifyPosition(value) { + // Nothing. + if (!value || typeof value !== 'object') { + return '' + } + + // Node. + if ('position' in value || 'type' in value) { + return position(value.position) + } + + // Position. + if ('start' in value || 'end' in value) { + return position(value) + } + + // Point. + if ('line' in value || 'column' in value) { + return point(value) + } + + // ? + return '' +} + +/** + * @param {Point | PointLike | null | undefined} point + * @returns {string} + */ +function point(point) { + return index(point && point.line) + ':' + index(point && point.column) +} + +/** + * @param {Position | PositionLike | null | undefined} pos + * @returns {string} + */ +function position(pos) { + return point(pos && pos.start) + '-' + point(pos && pos.end) +} + +/** + * @param {number | null | undefined} value + * @returns {number} + */ +function index(value) { + return value && typeof value === 'number' ? value : 1 +} diff --git a/package.json b/package.json index cc75df8..c48bdd9 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "main": "index.js", "types": "index.d.ts", "files": [ + "lib/", "index.d.ts", "index.js" ], From 474ed7b41d0576be8db58155fd6e937423334e1a Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 23 Jan 2023 13:06:06 +0100 Subject: [PATCH 10/24] Refactor code-style * Add more docs to JSDoc --- lib/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/index.js b/lib/index.js index 20ce0d1..82c20b4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,6 +1,6 @@ /** - * @typedef {import('unist').Point} Point * @typedef {import('unist').Node} Node + * @typedef {import('unist').Point} Point * @typedef {import('unist').Position} Position */ @@ -20,11 +20,13 @@ */ /** - * Stringify one point, a position (start and end points), or a node’s - * positional information. + * Serialize the positional info of a point, position (start and end points), + * or node. * * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value] + * Node, position, or point. * @returns {string} + * Positional info. */ export function stringifyPosition(value) { // Nothing. From 9af09562460e7e3f492fe5516d6a2d7f1c473f3a Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 23 Jan 2023 13:06:16 +0100 Subject: [PATCH 11/24] Add `ignore-scripts` to `.npmrc` --- .npmrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmrc b/.npmrc index 43c97e7..9951b11 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ package-lock=false +ignore-scripts=true From 0964663484db703416cb4f18073a473e692abe16 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 23 Jan 2023 13:07:00 +0100 Subject: [PATCH 12/24] Use Node test runner --- .github/workflows/main.yml | 2 +- package.json | 4 +-- test.js | 53 ++++++++++++++++++++------------------ 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 89dc06c..fb63387 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,5 +17,5 @@ jobs: strategy: matrix: node: - - lts/fermium + - lts/gallium - node diff --git a/package.json b/package.json index c48bdd9..f353978 100644 --- a/package.json +++ b/package.json @@ -39,13 +39,11 @@ }, "devDependencies": { "@types/mdast": "^3.0.0", - "@types/tape": "^4.0.0", + "@types/node": "^18.0.0", "c8": "^7.0.0", "prettier": "^2.0.0", "remark-cli": "^11.0.0", "remark-preset-wooorm": "^9.0.0", - "rimraf": "^3.0.0", - "tape": "^5.0.0", "type-coverage": "^2.0.0", "typescript": "^4.0.0", "xo": "^0.53.0" diff --git a/test.js b/test.js index d850a64..591a6f9 100644 --- a/test.js +++ b/test.js @@ -1,45 +1,50 @@ -import test from 'tape' +import assert from 'node:assert/strict' +import test from 'node:test' import {stringifyPosition} from './index.js' -test('stringifyPosition', function (t) { - t.equal( +test('stringifyPosition', function () { + assert.equal( stringifyPosition(), '', 'should return empty `string` with `undefined`' ) - t.equal( + assert.equal( stringifyPosition(null), '', 'should return empty `string` with `null`' ) - t.equal( + assert.equal( // @ts-expect-error runtime. stringifyPosition('foo'), '', 'should return empty `string` with `string`' ) - t.equal( + assert.equal( // @ts-expect-error runtime. stringifyPosition(5), '', 'should return empty `string` with `number`' ) - t.equal(stringifyPosition({}), '', 'should return empty `string` with `{}`') + assert.equal( + stringifyPosition({}), + '', + 'should return empty `string` with `{}`' + ) - t.equal( + assert.equal( stringifyPosition({type: 'text'}), '1:1-1:1', 'should return a range for a `node` without `position`' ) - t.equal( + assert.equal( // @ts-expect-error runtime. stringifyPosition({type: 'text', position: 3}), '1:1-1:1', 'should return a range for `node` with invalid `position` #1' ) - t.equal( + assert.equal( stringifyPosition({ type: 'text', position: {start: {}, end: {}} @@ -48,7 +53,7 @@ test('stringifyPosition', function (t) { 'should return a range for `node` with invalid `position` #2' ) - t.equal( + assert.equal( stringifyPosition({ type: 'text', position: { @@ -60,7 +65,7 @@ test('stringifyPosition', function (t) { 'should return a range for `node` with invalid `position` #3' ) - t.equal( + assert.equal( stringifyPosition({ type: 'text', position: { @@ -72,7 +77,7 @@ test('stringifyPosition', function (t) { 'should return a range for `node` with valid `position` (types: literal object)' ) - t.equal( + assert.equal( stringifyPosition( /** @type {import('mdast').Root} */ ({ type: 'root', @@ -87,26 +92,26 @@ test('stringifyPosition', function (t) { 'should return a range for `node` with valid `position` (types: explicit instance of node)' ) - t.equal( + assert.equal( stringifyPosition({start: null, end: null}), '1:1-1:1', 'should return a range for a `position` without `point`s' ) - t.equal( + assert.equal( // @ts-expect-error runtime. stringifyPosition({start: 3, end: 6}), '1:1-1:1', 'should return a range for `position` with invalid `point`s #1' ) - t.equal( + assert.equal( stringifyPosition({start: {}, end: {}}), '1:1-1:1', 'should return range for `position` with invalid `point`s #1' ) - t.equal( + assert.equal( stringifyPosition({ start: {line: null, column: null}, end: {line: null, column: null} @@ -115,7 +120,7 @@ test('stringifyPosition', function (t) { 'should return range for `position` with invalid `point`s #3' ) - t.equal( + assert.equal( stringifyPosition({ start: {line: 2, column: 5}, end: {line: 2, column: 6} @@ -124,36 +129,34 @@ test('stringifyPosition', function (t) { 'should return range for `position` with valid `point`s' ) - t.equal( + assert.equal( stringifyPosition({line: null, column: null}), '1:1', 'should return a point for a `point` without indices' ) - t.equal( + assert.equal( // @ts-expect-error runtime. stringifyPosition({line: 'foo', column: 'bar'}), '1:1', 'should return a point for a `point` with invalid indices #1' ) - t.equal( + assert.equal( stringifyPosition({line: 4}), '4:1', 'should return a point for a partially valid `point` #1' ) - t.equal( + assert.equal( stringifyPosition({column: 12}), '1:12', 'should return a point for a partially valid `point` #1' ) - t.equal( + assert.equal( stringifyPosition({line: 5, column: 2}), '5:2', 'should return a point for a valid `point`' ) - - t.end() }) From 3fcfc0ed1bbbec441b042d8df55163bc2f7d4e15 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 23 Jan 2023 13:07:16 +0100 Subject: [PATCH 13/24] Add tests for exposed identifiers --- test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test.js b/test.js index 591a6f9..9681c10 100644 --- a/test.js +++ b/test.js @@ -1,8 +1,15 @@ import assert from 'node:assert/strict' import test from 'node:test' import {stringifyPosition} from './index.js' +import * as mod from './index.js' test('stringifyPosition', function () { + assert.deepEqual( + Object.keys(mod).sort(), + ['stringifyPosition'], + 'should expose the public api' + ) + assert.equal( stringifyPosition(), '', From 8becab7934e9e1e6b8775e6d43d688cc4882d8e1 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 23 Jan 2023 13:09:47 +0100 Subject: [PATCH 14/24] Add improved docs --- lib/index.js | 8 +++++++- readme.md | 18 +++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/index.js b/lib/index.js index 82c20b4..7474343 100644 --- a/lib/index.js +++ b/lib/index.js @@ -26,7 +26,13 @@ * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value] * Node, position, or point. * @returns {string} - * Positional info. + * Pretty printed positional info of a node (`string`). + * + * In the format of a range `ls:cs-le:ce` (when given `node` or `position`) + * or a point `l:c` (when given `point`), where `l` stands for line, `c` for + * column, `s` for `start`, and `e` for end. + * An empty string (`''`) is returned if the given value is neither `node`, + * `position`, nor `point`. */ export function stringifyPosition(value) { // Nothing. diff --git a/readme.md b/readme.md index e9987d8..323f960 100644 --- a/readme.md +++ b/readme.md @@ -39,7 +39,7 @@ For example, when throwing errors or warning messages about something. ## Install This package is [ESM only][esm]. -In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with [npm][]: +In Node.js (version 14.14+ and 16.0+), install with [npm][]: ```sh npm install unist-util-stringify-position @@ -78,25 +78,27 @@ stringifyPosition({ ## API -This package exports the identifier `stringifyPosition`. +This package exports the identifier [`stringifyPosition`][stringifyposition]. There is no default export. ### `stringifyPosition(node|position|point)` -Stringify a point, position, or node. +Serialize the positional info of a point, position (start and end points), or +node. ###### Parameters * `node` ([`Node`][node]) - — node whose `'position'` property to stringify + — node whose `position` fields to serialize * `position` ([`Position`][position]) - — position whose `'start'` and `'end'` points to stringify + — position whose `start` and `end` points to serialize * `point` ([`Point`][point]) - — point whose `'line'` and `'column'` to stringify + — point whose `line` and `column` fields to serialize ###### Returns Pretty printed positional info of a node (`string`). + In the format of a range `ls:cs-le:ce` (when given `node` or `position`) or a point `l:c` (when given `point`), where `l` stands for line, `c` for column, `s` for `start`, and `e` for end. @@ -112,7 +114,7 @@ It exports no additional types. Projects maintained by the unified collective are compatible with all maintained versions of Node.js. -As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+. +As of now, that is Node.js 14.14+ and 16.0+. Our projects sometimes work with older versions, but this is not guaranteed. ## Security @@ -197,3 +199,5 @@ abide by its terms. [position]: https://github.com/syntax-tree/unist#position [point]: https://github.com/syntax-tree/unist#point + +[stringifyposition]: #stringifypositionnodepositionpoint From e0cad5fc199831b457ce0efc1fab11dcdc097d11 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 23 Jan 2023 13:10:48 +0100 Subject: [PATCH 15/24] 3.0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f353978..51e32c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "unist-util-stringify-position", - "version": "3.0.2", + "version": "3.0.3", "description": "unist utility to serialize a node, position, or point as a human readable location", "license": "MIT", "keywords": [ From c376ee3bb9b69ec8a4c943b7eb72314afd77b080 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 30 Jun 2023 14:00:55 +0200 Subject: [PATCH 16/24] Update dev-dependencies --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 51e32c2..63fabeb 100644 --- a/package.json +++ b/package.json @@ -39,14 +39,14 @@ }, "devDependencies": { "@types/mdast": "^3.0.0", - "@types/node": "^18.0.0", - "c8": "^7.0.0", + "@types/node": "^20.0.0", + "c8": "^8.0.0", "prettier": "^2.0.0", "remark-cli": "^11.0.0", "remark-preset-wooorm": "^9.0.0", "type-coverage": "^2.0.0", - "typescript": "^4.0.0", - "xo": "^0.53.0" + "typescript": "^5.0.0", + "xo": "^0.54.0" }, "scripts": { "prepack": "npm run build && npm run format", From 67038e37c5d07a75d26a976b54797ec7b03dd838 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 30 Jun 2023 14:01:21 +0200 Subject: [PATCH 17/24] Refactor `package.json`, `tsconfig.json` --- package.json | 19 ++++++++++--------- tsconfig.json | 10 ++++------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 63fabeb..7a5d419 100644 --- a/package.json +++ b/package.json @@ -53,28 +53,29 @@ "build": "tsc --build --clean && tsc --build && type-coverage", "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", "test-api": "node --conditions development test.js", - "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", "test": "npm run build && npm run format && npm run test-coverage" }, "prettier": { - "tabWidth": 2, - "useTabs": false, - "singleQuote": true, "bracketSpacing": false, "semi": false, - "trailingComma": "none" - }, - "xo": { - "prettier": true + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false }, "remarkConfig": { "plugins": [ - "preset-wooorm" + "remark-preset-wooorm" ] }, "typeCoverage": { "atLeast": 100, "detail": true, + "ignoreCatch": true, "strict": true + }, + "xo": { + "prettier": true } } diff --git a/tsconfig.json b/tsconfig.json index ebe8889..870d82c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,15 @@ { - "include": ["**/*.js"], - "exclude": ["coverage/", "node_modules/"], "compilerOptions": { "checkJs": true, + "customConditions": ["development"], "declaration": true, "emitDeclarationOnly": true, "exactOptionalPropertyTypes": true, - "forceConsistentCasingInFileNames": true, "lib": ["es2020"], "module": "node16", - "newLine": "lf", - "skipLibCheck": true, "strict": true, "target": "es2020" - } + }, + "exclude": ["coverage/", "node_modules/"], + "include": ["**/*.js"] } From e85618b26da32c8f6a80e01614c110a813efb182 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 30 Jun 2023 14:07:18 +0200 Subject: [PATCH 18/24] Refactor code-style --- lib/index.js | 10 +- test.js | 370 ++++++++++++++++++++++++++++----------------------- 2 files changed, 211 insertions(+), 169 deletions(-) diff --git a/lib/index.js b/lib/index.js index 7474343..109b646 100644 --- a/lib/index.js +++ b/lib/index.js @@ -9,21 +9,21 @@ * @property {string} type * @property {PositionLike | null | undefined} [position] * - * @typedef PositionLike - * @property {PointLike | null | undefined} [start] - * @property {PointLike | null | undefined} [end] - * * @typedef PointLike * @property {number | null | undefined} [line] * @property {number | null | undefined} [column] * @property {number | null | undefined} [offset] + * + * @typedef PositionLike + * @property {PointLike | null | undefined} [start] + * @property {PointLike | null | undefined} [end] */ /** * Serialize the positional info of a point, position (start and end points), * or node. * - * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value] + * @param {Node | NodeLike | Point | PointLike | Position | PositionLike | null | undefined} [value] * Node, position, or point. * @returns {string} * Pretty printed positional info of a node (`string`). diff --git a/test.js b/test.js index 9681c10..55f69e7 100644 --- a/test.js +++ b/test.js @@ -1,169 +1,211 @@ import assert from 'node:assert/strict' import test from 'node:test' import {stringifyPosition} from './index.js' -import * as mod from './index.js' - -test('stringifyPosition', function () { - assert.deepEqual( - Object.keys(mod).sort(), - ['stringifyPosition'], - 'should expose the public api' - ) - - assert.equal( - stringifyPosition(), - '', - 'should return empty `string` with `undefined`' - ) - assert.equal( - stringifyPosition(null), - '', - 'should return empty `string` with `null`' - ) - assert.equal( - // @ts-expect-error runtime. - stringifyPosition('foo'), - '', - 'should return empty `string` with `string`' - ) - assert.equal( - // @ts-expect-error runtime. - stringifyPosition(5), - '', - 'should return empty `string` with `number`' - ) - assert.equal( - stringifyPosition({}), - '', - 'should return empty `string` with `{}`' - ) - - assert.equal( - stringifyPosition({type: 'text'}), - '1:1-1:1', - 'should return a range for a `node` without `position`' - ) - - assert.equal( - // @ts-expect-error runtime. - stringifyPosition({type: 'text', position: 3}), - '1:1-1:1', - 'should return a range for `node` with invalid `position` #1' - ) - - assert.equal( - stringifyPosition({ - type: 'text', - position: {start: {}, end: {}} - }), - '1:1-1:1', - 'should return a range for `node` with invalid `position` #2' - ) - - assert.equal( - stringifyPosition({ - type: 'text', - position: { - start: {line: null, column: null}, - end: {line: null, column: null} - } - }), - '1:1-1:1', - 'should return a range for `node` with invalid `position` #3' - ) - - assert.equal( - stringifyPosition({ - type: 'text', - position: { - start: {line: 2, column: 5}, - end: {line: 2, column: 6} - } - }), - '2:5-2:6', - 'should return a range for `node` with valid `position` (types: literal object)' - ) - - assert.equal( - stringifyPosition( - /** @type {import('mdast').Root} */ ({ - type: 'root', - children: [], - position: { - start: {line: 1, column: 1}, - end: {line: 2, column: 1} - } - }) - ), - '1:1-2:1', - 'should return a range for `node` with valid `position` (types: explicit instance of node)' - ) - - assert.equal( - stringifyPosition({start: null, end: null}), - '1:1-1:1', - 'should return a range for a `position` without `point`s' - ) - - assert.equal( - // @ts-expect-error runtime. - stringifyPosition({start: 3, end: 6}), - '1:1-1:1', - 'should return a range for `position` with invalid `point`s #1' - ) - - assert.equal( - stringifyPosition({start: {}, end: {}}), - '1:1-1:1', - 'should return range for `position` with invalid `point`s #1' - ) - - assert.equal( - stringifyPosition({ - start: {line: null, column: null}, - end: {line: null, column: null} - }), - '1:1-1:1', - 'should return range for `position` with invalid `point`s #3' - ) - - assert.equal( - stringifyPosition({ - start: {line: 2, column: 5}, - end: {line: 2, column: 6} - }), - '2:5-2:6', - 'should return range for `position` with valid `point`s' - ) - - assert.equal( - stringifyPosition({line: null, column: null}), - '1:1', - 'should return a point for a `point` without indices' - ) - assert.equal( - // @ts-expect-error runtime. - stringifyPosition({line: 'foo', column: 'bar'}), - '1:1', - 'should return a point for a `point` with invalid indices #1' - ) - - assert.equal( - stringifyPosition({line: 4}), - '4:1', - 'should return a point for a partially valid `point` #1' - ) - - assert.equal( - stringifyPosition({column: 12}), - '1:12', - 'should return a point for a partially valid `point` #1' - ) - - assert.equal( - stringifyPosition({line: 5, column: 2}), - '5:2', - 'should return a point for a valid `point`' - ) +test('stringifyPosition', async function (t) { + await t.test('should expose the public api', async function () { + assert.deepEqual(Object.keys(await import('./index.js')).sort(), [ + 'stringifyPosition' + ]) + }) + + await t.test( + 'should return empty `string` with `undefined`', + async function () { + assert.equal(stringifyPosition(), '') + } + ) + + await t.test('should return empty `string` with `null`', async function () { + assert.equal(stringifyPosition(null), '') + }) + + await t.test('should return empty `string` with `string`', async function () { + assert.equal( + // @ts-expect-error runtime. + stringifyPosition('foo'), + '' + ) + }) + + await t.test('should return empty `string` with `number`', async function () { + assert.equal( + // @ts-expect-error runtime. + stringifyPosition(5), + '' + ) + }) + + await t.test('should return empty `string` with `{}`', async function () { + assert.equal(stringifyPosition({}), '') + }) + + await t.test( + 'should return a range for a `node` without `position`', + async function () { + assert.equal(stringifyPosition({type: 'text'}), '1:1-1:1') + } + ) + + await t.test( + 'should return a range for `node` with invalid `position` #1', + async function () { + assert.equal( + // @ts-expect-error runtime. + stringifyPosition({type: 'text', position: 3}), + '1:1-1:1' + ) + } + ) + + await t.test( + 'should return a range for `node` with invalid `position` #2', + async function () { + assert.equal( + stringifyPosition({ + type: 'text', + position: {start: {}, end: {}} + }), + '1:1-1:1' + ) + } + ) + + await t.test( + 'should return a range for `node` with invalid `position` #3', + async function () { + assert.equal( + stringifyPosition({ + type: 'text', + position: { + start: {line: null, column: null}, + end: {line: null, column: null} + } + }), + '1:1-1:1' + ) + } + ) + + await t.test( + 'should return a range for `node` with valid `position` (types: literal object)', + async function () { + assert.equal( + stringifyPosition({ + type: 'text', + position: { + start: {line: 2, column: 5}, + end: {line: 2, column: 6} + } + }), + '2:5-2:6' + ) + } + ) + + await t.test( + 'should return a range for `node` with valid `position` (types: explicit instance of node)', + async function () { + assert.equal( + stringifyPosition( + /** @type {import('mdast').Root} */ ({ + type: 'root', + children: [], + position: { + start: {line: 1, column: 1}, + end: {line: 2, column: 1} + } + }) + ), + '1:1-2:1' + ) + } + ) + + await t.test( + 'should return a range for a `position` without `point`s', + async function () { + assert.equal(stringifyPosition({start: null, end: null}), '1:1-1:1') + } + ) + + await t.test( + 'should return a range for `position` with invalid `point`s #1', + async function () { + assert.equal( + // @ts-expect-error runtime. + stringifyPosition({start: 3, end: 6}), + '1:1-1:1' + ) + } + ) + + await t.test( + 'should return range for `position` with invalid `point`s #1', + async function () { + assert.equal(stringifyPosition({start: {}, end: {}}), '1:1-1:1') + } + ) + + await t.test( + 'should return range for `position` with invalid `point`s #3', + async function () { + assert.equal( + stringifyPosition({ + start: {line: null, column: null}, + end: {line: null, column: null} + }), + '1:1-1:1' + ) + } + ) + + await t.test( + 'should return range for `position` with valid `point`s', + async function () { + assert.equal( + stringifyPosition({ + start: {line: 2, column: 5}, + end: {line: 2, column: 6} + }), + '2:5-2:6' + ) + } + ) + + await t.test( + 'should return a point for a `point` without indices', + async function () { + assert.equal(stringifyPosition({line: null, column: null}), '1:1') + } + ) + + await t.test( + 'should return a point for a `point` with invalid indices #1', + async function () { + assert.equal( + // @ts-expect-error runtime. + stringifyPosition({line: 'foo', column: 'bar'}), + '1:1' + ) + } + ) + + await t.test( + 'should return a point for a partially valid `point` #1', + async function () { + assert.equal(stringifyPosition({line: 4}), '4:1') + } + ) + + await t.test( + 'should return a point for a partially valid `point` #1', + async function () { + assert.equal(stringifyPosition({column: 12}), '1:12') + } + ) + + await t.test('should return a point for a valid `point`', async function () { + assert.equal(stringifyPosition({line: 5, column: 2}), '5:2') + }) }) From 9e165c37560cc8f72e2cff2a5d586da6582ed434 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 30 Jun 2023 14:07:35 +0200 Subject: [PATCH 19/24] Refactor `.npmrc` --- .npmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.npmrc b/.npmrc index 9951b11..3757b30 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,2 @@ -package-lock=false ignore-scripts=true +package-lock=false From d7621079e3be8390f00cec0becf0b5365272c167 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 30 Jun 2023 14:08:35 +0200 Subject: [PATCH 20/24] Refactor docs --- readme.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/readme.md b/readme.md index 323f960..8e70201 100644 --- a/readme.md +++ b/readme.md @@ -39,7 +39,7 @@ For example, when throwing errors or warning messages about something. ## Install This package is [ESM only][esm]. -In Node.js (version 14.14+ and 16.0+), install with [npm][]: +In Node.js (version 16+), install with [npm][]: ```sh npm install unist-util-stringify-position @@ -112,10 +112,13 @@ It exports no additional types. ## Compatibility -Projects maintained by the unified collective are compatible with all maintained +Projects maintained by the unified collective are compatible with maintained versions of Node.js. -As of now, that is Node.js 14.14+ and 16.0+. -Our projects sometimes work with older versions, but this is not guaranteed. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`unist-util-stringify-position@^3`, compatible with Node.js 12. ## Security @@ -160,9 +163,9 @@ abide by its terms. [downloads]: https://www.npmjs.com/package/unist-util-stringify-position -[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-stringify-position.svg +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-stringify-position -[size]: https://bundlephobia.com/result?p=unist-util-stringify-position +[size]: https://bundlejs.com/?q=unist-util-stringify-position [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg @@ -186,11 +189,11 @@ abide by its terms. [typescript]: https://www.typescriptlang.org -[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md +[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md -[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md +[support]: https://github.com/syntax-tree/.github/blob/main/support.md -[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md +[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md [unist]: https://github.com/syntax-tree/unist From dc23794af663e9a54853eaeb8902d9e4e964d9c4 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 30 Jun 2023 14:09:57 +0200 Subject: [PATCH 21/24] Change to use `export` map --- package.json | 3 +-- test.js | 9 +++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 7a5d419..c424a62 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,7 @@ ], "sideEffects": false, "type": "module", - "main": "index.js", - "types": "index.d.ts", + "exports": "./index.js", "files": [ "lib/", "index.d.ts", diff --git a/test.js b/test.js index 55f69e7..b99f73f 100644 --- a/test.js +++ b/test.js @@ -1,12 +1,13 @@ import assert from 'node:assert/strict' import test from 'node:test' -import {stringifyPosition} from './index.js' +import {stringifyPosition} from 'unist-util-stringify-position' test('stringifyPosition', async function (t) { await t.test('should expose the public api', async function () { - assert.deepEqual(Object.keys(await import('./index.js')).sort(), [ - 'stringifyPosition' - ]) + assert.deepEqual( + Object.keys(await import('unist-util-stringify-position')).sort(), + ['stringifyPosition'] + ) }) await t.test( From d6f7251f1228bcc9983d3fd3648b3ae263052e49 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 30 Jun 2023 14:10:10 +0200 Subject: [PATCH 22/24] Change to require Node.js 16 --- readme.md | 2 +- tsconfig.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 8e70201..445fd80 100644 --- a/readme.md +++ b/readme.md @@ -118,7 +118,7 @@ versions of Node.js. When we cut a new major release, we drop support for unmaintained versions of Node. This means we try to keep the current release line, -`unist-util-stringify-position@^3`, compatible with Node.js 12. +`unist-util-stringify-position@^4`, compatible with Node.js 16. ## Security diff --git a/tsconfig.json b/tsconfig.json index 870d82c..82cc749 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,10 +5,10 @@ "declaration": true, "emitDeclarationOnly": true, "exactOptionalPropertyTypes": true, - "lib": ["es2020"], + "lib": ["es2022"], "module": "node16", "strict": true, - "target": "es2020" + "target": "es2022" }, "exclude": ["coverage/", "node_modules/"], "include": ["**/*.js"] From 6f1e0f010f94cd03fe2091c7d5954cbc05ee09d3 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 7 Jul 2023 12:08:50 +0200 Subject: [PATCH 23/24] Update `@types/unist` --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c424a62..f65ef3c 100644 --- a/package.json +++ b/package.json @@ -34,10 +34,10 @@ "index.js" ], "dependencies": { - "@types/unist": "^2.0.0" + "@types/unist": "^3.0.0" }, "devDependencies": { - "@types/mdast": "^3.0.0", + "@types/mdast": "^4.0.0", "@types/node": "^20.0.0", "c8": "^8.0.0", "prettier": "^2.0.0", From be908410e4acaca52ea5a723ca7c558fdb269cab Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 7 Jul 2023 12:09:21 +0200 Subject: [PATCH 24/24] 4.0.0 --- package.json | 2 +- readme.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f65ef3c..334550f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "unist-util-stringify-position", - "version": "3.0.3", + "version": "4.0.0", "description": "unist utility to serialize a node, position, or point as a human readable location", "license": "MIT", "keywords": [ diff --git a/readme.md b/readme.md index 445fd80..af692c8 100644 --- a/readme.md +++ b/readme.md @@ -48,14 +48,14 @@ npm install unist-util-stringify-position In Deno with [`esm.sh`][esmsh]: ```js -import {stringifyPosition} from 'https://esm.sh/unist-util-stringify-position@3' +import {stringifyPosition} from 'https://esm.sh/unist-util-stringify-position@4' ``` In browsers with [`esm.sh`][esmsh]: ```html ```