mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-16 10:37:20 +02:00
fix(v2): refactor routes.ts + add route hash for chunkNames key (#3001)
* add simpleHash util * refactor/split the routes generation logic + add route hash to avoid chunk conflicts * minor fixes + fix tests * fix comment typo
This commit is contained in:
parent
984e2d4598
commit
cf97662eef
6 changed files with 161 additions and 149 deletions
|
@ -8,6 +8,7 @@
|
|||
import path from 'path';
|
||||
import {
|
||||
fileToPath,
|
||||
simpleHash,
|
||||
docuHash,
|
||||
genComponentName,
|
||||
genChunkName,
|
||||
|
@ -71,6 +72,21 @@ describe('load utils', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('simpleHash', () => {
|
||||
const asserts = {
|
||||
'': 'd41',
|
||||
'/foo-bar': '096',
|
||||
'/foo/bar': '1df',
|
||||
'/endi/lie': '9fa',
|
||||
'/endi-lie': 'fd3',
|
||||
'/yangshun/tay': '48d',
|
||||
'/yangshun-tay': 'f3b',
|
||||
};
|
||||
Object.keys(asserts).forEach((file) => {
|
||||
expect(simpleHash(file, 3)).toBe(asserts[file]);
|
||||
});
|
||||
});
|
||||
|
||||
test('docuHash', () => {
|
||||
const asserts = {
|
||||
'': '-d41',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue