-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import {normalizeUrl, simpleHash} from '@docusaurus/utils'; | ||
import type {DocusaurusConfig, SiteStorage} from '@docusaurus/types'; | ||
|
||
type Params = Pick<DocusaurusConfig, 'url' | 'baseUrl' | 'future'>; | ||
|
||
function automaticNamespace(params: Params): string { | ||
return simpleHash(normalizeUrl([params.url, params.baseUrl]), 3); | ||
} | ||
|
||
function getNamespaceString(params: Params): string | null { | ||
if (params.future.experimental_storage.namespace === true) { | ||
return automaticNamespace(params); | ||
} else if (params.future.experimental_storage.namespace === false) { | ||
return null; | ||
} else { | ||
return params.future.experimental_storage.namespace; | ||
} | ||
} | ||
|
||
export function createSiteStorage(config: DocusaurusConfig): SiteStorage { | ||
const {type} = config.future.experimental_storage; | ||
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18.0)simple site › readVersionDocs
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18.0)simple site › normal docs
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18.0)simple site › docs with editUrl
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18.0)simple site › docs with custom editUrl & unrelated frontMatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18.0)simple site › docs with function editUrl
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18.0)simple site › docs with last update time and author
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18.0)simple site › docs with draft frontmatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18.0)simple site › docs with unlisted frontmatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18.0)simple site › docs with last_update front matter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18.0)simple site › docs with only last_update author front matter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18)simple site › readVersionDocs
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18)simple site › normal docs
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18)simple site › docs with editUrl
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18)simple site › docs with custom editUrl & unrelated frontMatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18)simple site › docs with function editUrl
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18)simple site › docs with last update time and author
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18)simple site › docs with draft frontmatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18)simple site › docs with unlisted frontmatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18)simple site › docs with last_update front matter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (18)simple site › docs with only last_update author front matter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (20)simple site › readVersionDocs
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (20)simple site › normal docs
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (20)simple site › docs with editUrl
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (20)simple site › docs with custom editUrl & unrelated frontMatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (20)simple site › docs with function editUrl
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (20)simple site › docs with last update time and author
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (20)simple site › docs with draft frontmatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (20)simple site › docs with unlisted frontmatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (20)simple site › docs with last_update front matter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Tests (20)simple site › docs with only last_update author front matter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18.0)simple site › readVersionDocs
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18.0)simple site › normal docs
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18.0)simple site › docs with editUrl
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18.0)simple site › docs with custom editUrl & unrelated frontMatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18.0)simple site › docs with function editUrl
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18.0)simple site › docs with last update time and author
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18.0)simple site › docs with draft frontmatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18.0)simple site › docs with unlisted frontmatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18.0)simple site › docs with last_update front matter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18.0)simple site › docs with only last_update author front matter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18)simple site › readVersionDocs
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18)simple site › normal docs
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18)simple site › docs with editUrl
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18)simple site › docs with custom editUrl & unrelated frontMatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18)simple site › docs with function editUrl
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18)simple site › docs with last update time and author
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18)simple site › docs with draft frontmatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18)simple site › docs with unlisted frontmatter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18)simple site › docs with last_update front matter
Check failure on line 28 in packages/docusaurus/src/server/storage.ts GitHub Actions / Windows Tests (18)simple site › docs with only last_update author front matter
|
||
const namespaceString = getNamespaceString(config); | ||
|
||
const namespace = namespaceString ? `-${namespaceString}` : ''; | ||
return { | ||
type, | ||
namespace, | ||
}; | ||
} |