@servable/tools 1.6.2 → 1.6.3

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "type": "module",
4
4
  "source": "src/index.js",
5
5
  "main": "src/index.js",
6
- "version": "1.6.2",
6
+ "version": "1.6.3",
7
7
  "description": "Servable tools is a utility that builds a protocol's manifest and documents it.",
8
8
  "author": "Servable Community",
9
9
  "license": "ISC",
@@ -78,7 +78,7 @@
78
78
  "json2md": "^2.0.0",
79
79
  "mime": "^4.0.0",
80
80
  "parse-comments": "^1.0.0",
81
- "path-sanitizer": "^2.0.0",
81
+ "path-sanitizer": "^3.1.0",
82
82
  "semver": "^7.5.4",
83
83
  "jimp": "^1.6.0",
84
84
  "underscore": "^1.13.3"
@@ -3,8 +3,8 @@ import fs from 'fs'
3
3
 
4
4
  export default async ({ payload, path }) => {
5
5
  const { path, protocol, classes } = payload
6
- const rootPath = sanitizePath(`${path}/generated`)
6
+ const rootPath = sanitizePath.default(`${path}/generated`)
7
7
 
8
- const protocolPath = sanitizePath(`${rootPath}/index.md`)
8
+ const protocolPath = sanitizePath.default(`${rootPath}/index.md`)
9
9
  fs.promises.writeFile(protocolPath, protocol)
10
10
  }
@@ -12,7 +12,7 @@ export default async ({ item, path, includeAuxiliary }) => {
12
12
  classes,
13
13
  } = item
14
14
 
15
- const rootPath = sanitizePath(`${path}/documentation/generated`)
15
+ const rootPath = sanitizePath.default(`${path}/documentation/generated`)
16
16
 
17
17
  if ((await checkFileExists(rootPath))) {
18
18
  await fse.emptyDir(rootPath)
@@ -10,7 +10,7 @@ export default async ({ chunk, path, includeAuxiliary }) => {
10
10
  auxiliary
11
11
  } = chunk
12
12
 
13
- const chunkPath = `/${sanitizePath(`${path}/${id}.md`)}`
13
+ const chunkPath = `/${sanitizePath.default(`${path}/${id}.md`)}`
14
14
  let text = json2md([{ h1: name }, ...payload])
15
15
  if (includeAuxiliary && auxiliary) {
16
16
  text = `${text}\n${auxiliary}`
@@ -3,8 +3,8 @@ import fs from 'fs'
3
3
 
4
4
  export default async ({ payload, path }) => {
5
5
  const { path, protocol, classes } = payload
6
- const rootPath = sanitizePath(`${path}/generated`)
6
+ const rootPath = sanitizePath.default(`${path}/generated`)
7
7
 
8
- const protocolPath = sanitizePath(`${rootPath}/index.md`)
8
+ const protocolPath = sanitizePath.default(`${rootPath}/index.md`)
9
9
  fs.promises.writeFile(protocolPath, protocol)
10
10
  }
@@ -12,7 +12,7 @@ export default async ({ item, path, includeAuxiliary }) => {
12
12
  classes,
13
13
  } = item
14
14
 
15
- const rootPath = sanitizePath(`${path}/documentation/generated`)
15
+ const rootPath = sanitizePath.default(`${path}/documentation/generated`)
16
16
 
17
17
  if ((await checkFileExists(rootPath))) {
18
18
  await fse.emptyDir(rootPath)
@@ -10,7 +10,7 @@ export default async ({ chunk, path, includeAuxiliary }) => {
10
10
  auxiliary
11
11
  } = chunk
12
12
 
13
- const chunkPath = `/${sanitizePath(`${path}/${id}.md`)}`
13
+ const chunkPath = `/${sanitizePath.default(`${path}/${id}.md`)}`
14
14
  let text = json2md([{ h1: name }, ...payload])
15
15
  if (includeAuxiliary && auxiliary) {
16
16
  text = `${text}\n${auxiliary}`
@@ -43,7 +43,7 @@ export default class ProtocolLoader {
43
43
  async loadExtraction({ servableConfig } = {}) {
44
44
  try {
45
45
  this.extraction = await extract({
46
- path: `${sanitizePath(this.path)}`,
46
+ path: `${sanitizePath.default(this.path)}`,
47
47
  dataTemplateType: DataTemplateType.Protocol
48
48
  })
49
49
  // const e = JSON.stringify(this.extraction)
@@ -15,7 +15,7 @@ export default async ({
15
15
 
16
16
  let extraction = _extraction
17
17
  if (!extraction && path) {
18
- extraction = await extract({ path: `${sanitizePath(path)}`, dataTemplateType: type })
18
+ extraction = await extract({ path: `${sanitizePath.default(path)}`, dataTemplateType: type })
19
19
  }
20
20
 
21
21
  if (!extraction) {
@@ -30,9 +30,9 @@ export default async (props) => {
30
30
 
31
31
  const fullPathForVariant = ({ variant, fullPath, extensionType }) => {
32
32
  if (!variant) {
33
- return `${sanitizePath(`${fullPath}.${extensionType}`)}`
33
+ return `${sanitizePath.default(`${fullPath}.${extensionType}`)}`
34
34
  }
35
35
 
36
- // return `/${sanitizePath(`${fullPath}${variant.trim()}.${extensionType}`)}`
36
+ // return `/${sanitizePath.default(`${fullPath}${variant.trim()}.${extensionType}`)}`
37
37
  return `${fullPath}${variant.trim()}.${extensionType}`
38
38
  }
@@ -18,9 +18,9 @@ export default async (props) => {
18
18
  const extensionType = mime.getExtension(mimeType)
19
19
 
20
20
  let documentation = null
21
- let md = `${sanitizePath(`${props.fullPath}.md`)}`
21
+ let md = `${sanitizePath.default(`${props.fullPath}.md`)}`
22
22
  if (!(await checkFileExists(md))) {
23
- md = `${sanitizePath(`${props.fullPath}.mdx`)}`
23
+ md = `${sanitizePath.default(`${props.fullPath}.mdx`)}`
24
24
  }
25
25
 
26
26
  if (await checkFileExists(md)) {
@@ -13,7 +13,7 @@ export default async (props) => {
13
13
  params = {}
14
14
  } = route
15
15
 
16
- let fullPath = `${sanitizePath(`${parentLeafPath}/${route.path}`)}`
16
+ let fullPath = `${sanitizePath.default(`${parentLeafPath}/${route.path}`)}`
17
17
  let files = null
18
18
  const result = {
19
19
  ...route,
@@ -86,7 +86,7 @@ export default async (props) => {
86
86
  default: break
87
87
  }
88
88
 
89
- result.leafPath = `${sanitizePath(result.leafPath)}`
89
+ result.leafPath = `${sanitizePath.default(result.leafPath)}`
90
90
 
91
91
  if (files && files.length) {
92
92
  files = files.filter(a => a.module)