@tryghost/url-utils 2.0.0 → 2.0.4

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.
@@ -1,5 +1,3 @@
1
- const cheerio = require('cheerio');
2
-
3
1
  function escapeRegExp(string) {
4
2
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
5
3
  }
@@ -18,6 +16,7 @@ function htmlTransform(html = '', siteUrl, transformFunction, itemPath, _options
18
16
  return html;
19
17
  }
20
18
 
19
+ const cheerio = require('cheerio');
21
20
  const htmlContent = cheerio.load(html, {decodeEntities: false});
22
21
 
23
22
  // replacements is keyed with the attr name + original relative value so
@@ -1,4 +1,4 @@
1
- const remark = require('remark');
1
+ let remark;
2
2
  const footnotes = require('remark-footnotes');
3
3
  const visit = require('unist-util-visit');
4
4
 
@@ -25,6 +25,10 @@ function markdownTransform(markdown = '', siteUrl, transformFunctions, itemPath,
25
25
 
26
26
  const replacements = [];
27
27
 
28
+ if (!remark) {
29
+ remark = require('remark');
30
+ }
31
+
28
32
  const tree = remark()
29
33
  .use({settings: {commonmark: true}})
30
34
  .use(footnotes, {inlineNotes: true})
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@tryghost/url-utils",
3
- "version": "2.0.0",
3
+ "version": "2.0.4",
4
4
  "repository": "https://github.com/TryGhost/SDK/tree/master/packages/url-utils",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
7
7
  "main": "lib/index.js",
8
8
  "scripts": {
9
9
  "dev": "echo \"Implement me!\"",
10
- "test": "NODE_ENV=testing mocha './test/**/*.test.js'",
10
+ "test": "NODE_ENV=testing c8 --reporter text --reporter cobertura mocha './test/**/*.test.js'",
11
11
  "lint": "eslint . --ext .js --cache",
12
12
  "posttest": "yarn lint"
13
13
  },
@@ -18,7 +18,8 @@
18
18
  "access": "public"
19
19
  },
20
20
  "devDependencies": {
21
- "@tryghost/config-url-helpers": "^0.1.0",
21
+ "@tryghost/config-url-helpers": "0.1.3",
22
+ "c8": "7.10.0",
22
23
  "mocha": "7.2.0",
23
24
  "rewire": "5.0.0",
24
25
  "should": "13.2.3",
@@ -32,5 +33,5 @@
32
33
  "remark-footnotes": "^1.0.0",
33
34
  "unist-util-visit": "^2.0.0"
34
35
  },
35
- "gitHead": "7e16043cffbd492a5b07e549785e1dbf89f3e98a"
36
+ "gitHead": "ded6bed1a13fb38b9f5ab443714d970938cb79a1"
36
37
  }