@putout/processor-markdown 5.5.0 → 5.6.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.
package/lib/markdown.js CHANGED
@@ -1,13 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const {createSimport} = require('simport');
4
3
  const once = require('once');
5
4
 
6
5
  const {toPlace} = require('./parse-place');
7
6
  const {initParseStore} = require('./parse-store');
8
7
 
9
- const simport = createSimport(__filename);
10
-
11
8
  const parseStore = initParseStore();
12
9
 
13
10
  const text = ({value}) => value;
@@ -26,19 +23,11 @@ module.exports.files = [
26
23
  ];
27
24
 
28
25
  const loadDependencies = once(async () => {
29
- const stringify = await simport('remark-stringify');
30
- const preset = await simport('remark-preset-lint-consistent');
31
- const jsonProcessor = await simport('@putout/processor-json');
32
- const {run} = await simport('./rules/index.mjs');
33
-
34
- // Fix: TypeError: visit is not a function
35
- //
36
- // remark installs "uninst-util-visit" v2 using npm and has `module.exports = visit`
37
- // but v3 has `export const visit = () => {}`
38
- // and simport imports nearest version of "uninst-util-visit" which is v2
39
- // that's why regular import should be used here while remark not transit to v3
26
+ const {default: stringify} = await import('remark-stringify');
27
+ const {default: preset} = await import('remark-preset-lint-consistent');
28
+ const {default: jsonProcessor} = await import('@putout/processor-json');
29
+ const {run} = await import('./rules/index.mjs');
40
30
  const {visit} = await import('unist-util-visit');
41
- // sometimes cannot load unified with simport on node v14
42
31
  const {unified} = await import('unified');
43
32
 
44
33
  return {
@@ -1,8 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const {createSimport} = require('simport');
4
- const simport = createSimport(__filename);
5
-
6
3
  module.exports.initParseStore = () => {
7
4
  let cache = null;
8
5
  let parse = null;
@@ -24,7 +21,7 @@ module.exports.initParseStore = () => {
24
21
 
25
22
  fn.init = async () => {
26
23
  cache = null;
27
- parse = await simport('remark-parse');
24
+ ({default: parse} = await import('remark-parse'));
28
25
  };
29
26
 
30
27
  fn.clear = async () => {
@@ -2,10 +2,8 @@ const report = () => 'Merge heading spaces';
2
2
 
3
3
  const fix = (heading) => {
4
4
  const newChildren = [];
5
- const n = heading.children.length;
6
5
 
7
- for (let i = 0; i < n; i++) {
8
- const node = heading.children[i];
6
+ for (const [i, node] of heading.children.entries()) {
9
7
  const nextNode = heading.children[i + 1];
10
8
 
11
9
  if (bothSpaces(node, nextNode))
@@ -23,10 +21,7 @@ const traverse = (tree, {push}) => {
23
21
  if (heading.type !== 'heading')
24
22
  return;
25
23
 
26
- const n = heading.children.length;
27
-
28
- for (let i = 0; i < n; i++) {
29
- const node = heading.children[i];
24
+ for (const [i, node] of heading.children.entries()) {
30
25
  const nextNode = heading.children[i + 1];
31
26
 
32
27
  if (bothSpaces(node, nextNode)) {
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@putout/processor-markdown",
3
- "version": "5.5.0",
3
+ "version": "5.6.0",
4
+ "type": "commonjs",
4
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
6
  "description": "putout processor adds ability to parse markdown files and lint js snippets",
6
- "homepage": "http://github.com/coderaiser/putout",
7
+ "homepage": "https://github.com/coderaiser/putout/tree/master/packages/processor-markdown#readme",
7
8
  "main": "lib/markdown.js",
8
9
  "release": false,
9
10
  "tag": false,
@@ -28,7 +29,6 @@
28
29
  "remark-parse": "^10.0.0",
29
30
  "remark-preset-lint-consistent": "^5.0.0",
30
31
  "remark-stringify": "^10.0.0",
31
- "simport": "^1.2.0",
32
32
  "unified": "^10.0.0",
33
33
  "unified-lint-rule": "^2.1.0",
34
34
  "unist-util-visit": "^4.0.0"
@@ -39,11 +39,11 @@
39
39
  "markdown"
40
40
  ],
41
41
  "devDependencies": {
42
- "@putout/test": "^3.5.0",
42
+ "@putout/test": "^4.0.0",
43
43
  "c8": "^7.5.0",
44
44
  "eslint": "^8.0.1",
45
45
  "eslint-plugin-node": "^11.0.0",
46
- "eslint-plugin-putout": "^11.0.0",
46
+ "eslint-plugin-putout": "^13.0.0",
47
47
  "lerna": "^4.0.0",
48
48
  "madrun": "^8.0.1",
49
49
  "nodemon": "^2.0.1",