@diplodoc/transform 4.50.4 → 4.51.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/dist/css/_yfm-only.css.map +1 -1
- package/dist/css/_yfm-only.min.css.map +1 -1
- package/dist/css/base.css.map +1 -1
- package/dist/css/base.min.css.map +1 -1
- package/dist/css/print.css.map +1 -1
- package/dist/css/yfm.css.map +1 -1
- package/dist/css/yfm.min.css.map +1 -1
- package/lib/md.js +6 -3
- package/lib/md.js.map +1 -1
- package/lib/plugins/block-anchor/index.js +6 -1
- package/lib/plugins/block-anchor/index.js.map +1 -1
- package/lib/plugins/includes/index.js +1 -0
- package/lib/plugins/includes/index.js.map +1 -1
- package/lib/typings.d.ts +6 -0
- package/lib/utilsFS.js +5 -4
- package/lib/utilsFS.js.map +1 -1
- package/lib/yfmlint/index.js +3 -1
- package/lib/yfmlint/index.js.map +1 -1
- package/lib/yfmlint/typings.d.ts +2 -0
- package/package.json +2 -1
- package/src/transform/md.ts +7 -2
- package/src/transform/plugins/block-anchor/index.ts +5 -1
- package/src/transform/plugins/includes/index.ts +1 -0
- package/src/transform/typings.ts +7 -0
- package/src/transform/utilsFS.ts +5 -4
- package/src/transform/yfmlint/index.ts +3 -1
- package/src/transform/yfmlint/typings.ts +3 -0
package/src/transform/utilsFS.ts
CHANGED
|
@@ -3,13 +3,14 @@ import type {Dictionary} from 'lodash';
|
|
|
3
3
|
import {readFileSync, realpathSync, statSync} from 'fs';
|
|
4
4
|
import escapeRegExp from 'lodash/escapeRegExp';
|
|
5
5
|
import {join, parse, relative, resolve, sep} from 'path';
|
|
6
|
+
import QuickLRU from 'quick-lru';
|
|
6
7
|
|
|
7
8
|
import liquidSnippet from './liquid';
|
|
8
9
|
import {StateCore} from './typings';
|
|
9
10
|
import {defaultTransformLink} from './utils';
|
|
10
11
|
import {preprocess} from './preprocessors';
|
|
11
12
|
|
|
12
|
-
const filesCache
|
|
13
|
+
const filesCache = new QuickLRU<string, string>({maxSize: 1000});
|
|
13
14
|
|
|
14
15
|
export function isFileExists(file: string) {
|
|
15
16
|
try {
|
|
@@ -62,11 +63,11 @@ export function getFileTokens(
|
|
|
62
63
|
|
|
63
64
|
// Read the content only if we dont have one in the args
|
|
64
65
|
if (!content) {
|
|
65
|
-
if (filesCache
|
|
66
|
-
content = filesCache
|
|
66
|
+
if (filesCache.has(path)) {
|
|
67
|
+
content = filesCache.get(path) as string;
|
|
67
68
|
} else {
|
|
68
69
|
content = readFileSync(path, 'utf8');
|
|
69
|
-
filesCache
|
|
70
|
+
filesCache.set(path, content);
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
|
|
@@ -56,7 +56,9 @@ function yfmlint(opts: Options) {
|
|
|
56
56
|
lintRules = union(lintRules, customLintRules);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
// TODO: set to false in next major
|
|
60
|
+
const {enableMarkdownAttrs = true} = opts;
|
|
61
|
+
const plugins = customPlugins && [...(enableMarkdownAttrs ? [attrs] : []), ...customPlugins];
|
|
60
62
|
const preparedPlugins = plugins && plugins.map((plugin) => [plugin, pluginOptions]);
|
|
61
63
|
|
|
62
64
|
// Run preprocessor
|