@docusaurus/utils 2.0.0-beta.138b4c997 → 2.0.0-beta.14

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.
Files changed (88) hide show
  1. package/lib/constants.d.ts +20 -0
  2. package/lib/constants.d.ts.map +1 -0
  3. package/lib/constants.js +27 -0
  4. package/lib/constants.js.map +1 -0
  5. package/lib/escapePath.d.ts +1 -0
  6. package/lib/escapePath.d.ts.map +1 -0
  7. package/lib/escapePath.js +1 -0
  8. package/lib/escapePath.js.map +1 -0
  9. package/lib/globUtils.d.ts +12 -0
  10. package/lib/globUtils.d.ts.map +1 -0
  11. package/lib/globUtils.js +48 -0
  12. package/lib/globUtils.js.map +1 -0
  13. package/lib/hashUtils.d.ts +1 -0
  14. package/lib/hashUtils.d.ts.map +1 -0
  15. package/lib/hashUtils.js +5 -4
  16. package/lib/hashUtils.js.map +1 -0
  17. package/lib/index.d.ts +11 -7
  18. package/lib/index.d.ts.map +1 -0
  19. package/lib/index.js +43 -96
  20. package/lib/index.js.map +1 -0
  21. package/lib/markdownLinks.d.ts +1 -0
  22. package/lib/markdownLinks.d.ts.map +1 -0
  23. package/lib/markdownLinks.js +20 -6
  24. package/lib/markdownLinks.js.map +1 -0
  25. package/lib/markdownParser.d.ts +1 -0
  26. package/lib/markdownParser.d.ts.map +1 -0
  27. package/lib/markdownParser.js +17 -8
  28. package/lib/markdownParser.js.map +1 -0
  29. package/lib/mdxUtils.d.ts +17 -0
  30. package/lib/mdxUtils.d.ts.map +1 -0
  31. package/lib/mdxUtils.js +31 -0
  32. package/lib/mdxUtils.js.map +1 -0
  33. package/lib/{getFilePathForRoutePath.d.ts → normalizeUrl.d.ts} +2 -1
  34. package/lib/normalizeUrl.d.ts.map +1 -0
  35. package/lib/normalizeUrl.js +67 -0
  36. package/lib/normalizeUrl.js.map +1 -0
  37. package/lib/pathUtils.d.ts +1 -0
  38. package/lib/pathUtils.d.ts.map +1 -0
  39. package/lib/pathUtils.js +4 -5
  40. package/lib/pathUtils.js.map +1 -0
  41. package/lib/posixPath.d.ts +1 -0
  42. package/lib/posixPath.d.ts.map +1 -0
  43. package/lib/posixPath.js +1 -0
  44. package/lib/posixPath.js.map +1 -0
  45. package/lib/slugger.d.ts +14 -0
  46. package/lib/slugger.d.ts.map +1 -0
  47. package/lib/slugger.js +19 -0
  48. package/lib/slugger.js.map +1 -0
  49. package/lib/tags.d.ts +19 -0
  50. package/lib/tags.d.ts.map +1 -0
  51. package/lib/tags.js +73 -0
  52. package/lib/tags.js.map +1 -0
  53. package/lib/webpackUtils.d.ts +30 -0
  54. package/lib/webpackUtils.d.ts.map +1 -0
  55. package/lib/webpackUtils.js +110 -0
  56. package/lib/webpackUtils.js.map +1 -0
  57. package/package.json +25 -8
  58. package/src/constants.ts +38 -0
  59. package/src/deps.d.ts +14 -0
  60. package/src/globUtils.ts +63 -0
  61. package/src/index.ts +25 -96
  62. package/src/markdownLinks.ts +19 -8
  63. package/src/markdownParser.ts +21 -16
  64. package/src/mdxUtils.ts +32 -0
  65. package/src/normalizeUrl.ts +80 -0
  66. package/src/pathUtils.ts +2 -3
  67. package/src/slugger.ts +24 -0
  68. package/src/tags.ts +100 -0
  69. package/src/webpackUtils.ts +144 -0
  70. package/lib/.tsbuildinfo +0 -1
  71. package/lib/codeTranslationsUtils.d.ts +0 -11
  72. package/lib/codeTranslationsUtils.js +0 -50
  73. package/lib/getFilePathForRoutePath.js +0 -40
  74. package/src/__tests__/__fixtures__/defaultCodeTranslations/en.json +0 -4
  75. package/src/__tests__/__fixtures__/defaultCodeTranslations/fr-FR.json +0 -5
  76. package/src/__tests__/__fixtures__/defaultCodeTranslations/fr.json +0 -4
  77. package/src/__tests__/__snapshots__/index.test.ts.snap +0 -8
  78. package/src/__tests__/codeTranslationsUtils.test.ts +0 -112
  79. package/src/__tests__/escapePath.test.ts +0 -25
  80. package/src/__tests__/getFilePathForRoutePath.test.ts +0 -87
  81. package/src/__tests__/hashUtils.test.ts +0 -51
  82. package/src/__tests__/index.test.ts +0 -631
  83. package/src/__tests__/markdownParser.test.ts +0 -817
  84. package/src/__tests__/pathUtils.test.ts +0 -63
  85. package/src/__tests__/posixPath.test.ts +0 -25
  86. package/src/codeTranslationsUtils.ts +0 -56
  87. package/src/getFilePathForRoutePath.ts +0 -43
  88. package/tsconfig.json +0 -9
@@ -1,25 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import {escapePath} from '../escapePath';
9
-
10
- describe('escapePath', () => {
11
- test('escapePath works', () => {
12
- const asserts: Record<string, string> = {
13
- 'c:/aaaa\\bbbb': 'c:/aaaa\\\\bbbb',
14
- 'c:\\aaaa\\bbbb\\★': 'c:\\\\aaaa\\\\bbbb\\\\★',
15
- '\\\\?\\c:\\aaaa\\bbbb': '\\\\\\\\?\\\\c:\\\\aaaa\\\\bbbb',
16
- 'c:\\aaaa\\bbbb': 'c:\\\\aaaa\\\\bbbb',
17
- 'foo\\bar': 'foo\\\\bar',
18
- 'foo\\bar/lol': 'foo\\\\bar/lol',
19
- 'website\\docs/**/*.{md,mdx}': 'website\\\\docs/**/*.{md,mdx}',
20
- };
21
- Object.keys(asserts).forEach((file) => {
22
- expect(escapePath(file)).toBe(asserts[file]);
23
- });
24
- });
25
- });
@@ -1,87 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import {getFilePathForRoutePath} from '../getFilePathForRoutePath';
9
- import {posixPath} from '../posixPath';
10
-
11
- describe('getFilePathForRoutePath trailingSlash=undefined', () => {
12
- test('works for /', () => {
13
- expect(posixPath(getFilePathForRoutePath('/', undefined))).toEqual(
14
- '/index.html',
15
- );
16
- });
17
-
18
- test('works for /somePath', () => {
19
- expect(posixPath(getFilePathForRoutePath('/somePath', undefined))).toEqual(
20
- '/somePath/index.html',
21
- );
22
- });
23
-
24
- test('works for /somePath/', () => {
25
- expect(posixPath(getFilePathForRoutePath('/somePath/', undefined))).toEqual(
26
- '/somePath/index.html',
27
- );
28
- });
29
-
30
- test('works for /somePath/xyz.html', () => {
31
- expect(
32
- posixPath(getFilePathForRoutePath('/somePath/xyz.html', undefined)),
33
- ).toEqual('/somePath/xyz.html');
34
- });
35
- });
36
-
37
- describe('getFilePathForRoutePath trailingSlash=true', () => {
38
- test('works for /', () => {
39
- expect(posixPath(getFilePathForRoutePath('/', true))).toEqual(
40
- '/index.html',
41
- );
42
- });
43
-
44
- test('works for /somePath', () => {
45
- expect(posixPath(getFilePathForRoutePath('/somePath', true))).toEqual(
46
- '/somePath/index.html',
47
- );
48
- });
49
-
50
- test('works for /somePath/', () => {
51
- expect(posixPath(getFilePathForRoutePath('/somePath/', true))).toEqual(
52
- '/somePath/index.html',
53
- );
54
- });
55
-
56
- test('works for /somePath/xyz.html', () => {
57
- expect(
58
- posixPath(getFilePathForRoutePath('/somePath/xyz.html', true)),
59
- ).toEqual('/somePath/xyz.html');
60
- });
61
- });
62
-
63
- describe('getFilePathForRoutePath trailingSlash=false', () => {
64
- test('works for /', () => {
65
- expect(posixPath(getFilePathForRoutePath('/', false))).toEqual(
66
- '/index.html',
67
- );
68
- });
69
-
70
- test('works for /somePath', () => {
71
- expect(posixPath(getFilePathForRoutePath('/somePath', false))).toEqual(
72
- '/somePath.html',
73
- );
74
- });
75
-
76
- test('works for /somePath/', () => {
77
- expect(posixPath(getFilePathForRoutePath('/somePath/', false))).toEqual(
78
- '/somePath/index.html',
79
- );
80
- });
81
-
82
- test('works for /somePath/xyz.html', () => {
83
- expect(
84
- posixPath(getFilePathForRoutePath('/somePath/xyz.html', false)),
85
- ).toEqual('/somePath/xyz.html');
86
- });
87
- });
@@ -1,51 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import {simpleHash, docuHash} from '../hashUtils';
9
-
10
- describe('hashUtils', () => {
11
- test('simpleHash', () => {
12
- const asserts: Record<string, string> = {
13
- '': 'd41',
14
- '/foo-bar': '096',
15
- '/foo/bar': '1df',
16
- '/endi/lie': '9fa',
17
- '/endi-lie': 'fd3',
18
- '/yangshun/tay': '48d',
19
- '/yangshun-tay': 'f3b',
20
- '/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar':
21
- 'd46',
22
- '/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/test1-test2':
23
- '787',
24
- };
25
- Object.keys(asserts).forEach((str) => {
26
- expect(simpleHash(str, 3)).toBe(asserts[str]);
27
- });
28
- });
29
- });
30
-
31
- describe('docuHash', () => {
32
- test('docuHash works', () => {
33
- const asserts: Record<string, string> = {
34
- '': '-d41',
35
- '/': 'index',
36
- '/foo-bar': 'foo-bar-096',
37
- '/foo/bar': 'foo-bar-1df',
38
- '/endi/lie': 'endi-lie-9fa',
39
- '/endi-lie': 'endi-lie-fd3',
40
- '/yangshun/tay': 'yangshun-tay-48d',
41
- '/yangshun-tay': 'yangshun-tay-f3b',
42
- '/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar':
43
- 'foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo--d46',
44
- '/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/test1-test2':
45
- 'foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-test-1-test--787',
46
- };
47
- Object.keys(asserts).forEach((file) => {
48
- expect(docuHash(file)).toBe(asserts[file]);
49
- });
50
- });
51
- });