@wtf/project-docs 1.0.1 → 1.1.0
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/README.md +2 -0
- package/api/.generated +49 -0
- package/api/@wtf/project-astro/README.md +68 -0
- package/api/@wtf/project-astro/config/README.md +38 -0
- package/api/@wtf/project-astro/config/functions/baseConfig.md +43 -0
- package/api/@wtf/project-astro/config/functions/baseOf.md +23 -0
- package/api/@wtf/project-astro/config/functions/siteOf.md +22 -0
- package/api/@wtf/project-astro/config/type-aliases/BaseOptions.md +73 -0
- package/api/@wtf/project-astro/config/type-aliases/Env.md +11 -0
- package/api/@wtf/project-astro/errors/README.md +16 -0
- package/api/@wtf/project-astro/errors/classes/BrokenLinksError.md +172 -0
- package/api/@wtf/project-astro/errors/classes/InvalidRedirectError.md +174 -0
- package/api/@wtf/project-astro/errors/classes/RedirectedLinksError.md +173 -0
- package/api/@wtf/project-astro/errors/classes/SiteError.md +192 -0
- package/api/@wtf/project-astro/index/README.md +19 -0
- package/api/@wtf/project-astro/index/type-aliases/BrokenLink.md +35 -0
- package/api/@wtf/project-astro/index/type-aliases/IgnoredLine.md +47 -0
- package/api/@wtf/project-astro/index/type-aliases/RedirectInput.md +17 -0
- package/api/@wtf/project-astro/index/type-aliases/RedirectMatch.md +35 -0
- package/api/@wtf/project-astro/index/type-aliases/RedirectRule.md +61 -0
- package/api/@wtf/project-astro/index/type-aliases/RedirectStatus.md +12 -0
- package/api/@wtf/project-astro/index/type-aliases/RedirectedLink.md +17 -0
- package/api/@wtf/project-astro/index/type-aliases/Redirects.md +35 -0
- package/api/@wtf/project-astro/links/README.md +27 -0
- package/api/@wtf/project-astro/links/functions/brokenLinksIn.md +27 -0
- package/api/@wtf/project-astro/links/functions/links.md +29 -0
- package/api/@wtf/project-astro/links/functions/redirectedLinksIn.md +27 -0
- package/api/@wtf/project-astro/links/variables/LINKS.md +11 -0
- package/api/@wtf/project-astro/pages/README.md +36 -0
- package/api/@wtf/project-astro/pages/functions/fixSearchUrlsIn.md +27 -0
- package/api/@wtf/project-astro/pages/functions/moveConflictingPages.md +23 -0
- package/api/@wtf/project-astro/pages/functions/pages.md +31 -0
- package/api/@wtf/project-astro/pages/functions/slashFolderLinksIn.md +35 -0
- package/api/@wtf/project-astro/pages/variables/PAGES.md +11 -0
- package/api/@wtf/project-astro/preview/README.md +34 -0
- package/api/@wtf/project-astro/preview/functions/files.md +39 -0
- package/api/@wtf/project-astro/preview/functions/listen.md +25 -0
- package/api/@wtf/project-astro/preview/functions/notFound.md +24 -0
- package/api/@wtf/project-astro/preview/functions/pagesOf.md +27 -0
- package/api/@wtf/project-astro/preview/type-aliases/FilesOptions.md +24 -0
- package/api/@wtf/project-astro/preview/type-aliases/Handler.md +21 -0
- package/api/@wtf/project-astro/preview/type-aliases/ListenOptions.md +35 -0
- package/api/@wtf/project-astro/preview/type-aliases/Listening.md +53 -0
- package/api/@wtf/project-astro/preview/type-aliases/Pages.md +35 -0
- package/api/@wtf/project-astro/redirects/README.md +28 -0
- package/api/@wtf/project-astro/redirects/functions/formatRedirects.md +28 -0
- package/api/@wtf/project-astro/redirects/functions/matchRedirect.md +35 -0
- package/api/@wtf/project-astro/redirects/functions/parseRedirects.md +32 -0
- package/api/@wtf/project-astro/redirects/variables/MAX_PARTS.md +11 -0
- package/api/@wtf/project-astro/redirects/variables/MAX_RULES.md +11 -0
- package/api/@wtf/project-astro/redirects/variables/MAX_SIZE.md +11 -0
- package/api/@wtf/project-oxfmt/variables/default.md +6 -6
- package/api/@wtf/project-oxlint/variables/default.md +17 -17
- package/api/@wtf/project-resolve/condition/variables/SOURCE_CONDITION.md +1 -1
- package/api/@wtf/project-resolve/env/functions/isHook.md +1 -1
- package/api/@wtf/project-resolve/env/functions/optionsWithoutHook.md +1 -1
- package/api/@wtf/project-resolve/env/functions/withoutHook.md +1 -1
- package/api/@wtf/project-resolve/env/type-aliases/Env.md +1 -1
- package/api/@wtf/project-resolve/errors/classes/ResolveError.md +4 -4
- package/api/@wtf/project-resolve/errors/classes/UnreadableWorkspaceError.md +6 -6
- package/api/@wtf/project-resolve/errors/classes/WorkspaceError.md +5 -5
- package/api/@wtf/project-resolve/hooks/functions/candidatesOf.md +1 -1
- package/api/@wtf/project-resolve/hooks/functions/sourcesHookOf.md +1 -1
- package/api/@wtf/project-resolve/hooks/functions/sourcesOf.md +1 -1
- package/api/@wtf/project-resolve/hooks/variables/resolveTypeScript.md +1 -1
- package/api/@wtf/project-resolve/node/functions/nodePlatform.md +5 -5
- package/api/@wtf/project-resolve/register/variables/REGISTERED.md +1 -1
- package/api/@wtf/project-resolve/workspace/functions/filesOf.md +1 -1
- package/api/@wtf/project-resolve/workspace/functions/packagesOf.md +1 -1
- package/api/@wtf/project-resolve/workspace/functions/workspaceAt.md +1 -1
- package/api/@wtf/project-resolve/workspace/functions/workspaceOf.md +1 -1
- package/api/@wtf/project-resolve/workspace/functions/workspaceRootAbove.md +1 -1
- package/api/@wtf/project-resolve/workspace/functions/workspaceRootOf.md +1 -1
- package/api/@wtf/project-resolve/workspace/type-aliases/Agent.md +1 -1
- package/api/@wtf/project-resolve/workspace/type-aliases/DirectoryEntry.md +4 -4
- package/api/@wtf/project-resolve/workspace/type-aliases/FileContents.md +3 -3
- package/api/@wtf/project-resolve/workspace/type-aliases/PackageManager.md +4 -4
- package/api/@wtf/project-resolve/workspace/type-aliases/PackageManagerName.md +1 -1
- package/api/@wtf/project-resolve/workspace/type-aliases/ProcessWorkspaceOptions.md +1 -1
- package/api/@wtf/project-resolve/workspace/type-aliases/Workspace.md +5 -5
- package/api/@wtf/project-resolve/workspace/type-aliases/WorkspaceDirectoryHandle.md +6 -6
- package/api/@wtf/project-resolve/workspace/type-aliases/WorkspaceFileHandle.md +3 -3
- package/api/@wtf/project-resolve/workspace/type-aliases/WorkspaceFiles.md +6 -6
- package/api/@wtf/project-resolve/workspace/type-aliases/WorkspaceOptions.md +2 -2
- package/api/@wtf/project-resolve/workspace/type-aliases/WorkspacePackage.md +4 -4
- package/api/@wtf/project-resolve/workspace/type-aliases/WorkspacePaths.md +7 -7
- package/api/@wtf/project-typedoc/config/functions/gitRevisionOf.md +1 -1
- package/api/@wtf/project-typedoc/config/functions/typedocConfig.md +1 -1
- package/api/@wtf/project-typedoc/config/type-aliases/RevisionSources.md +3 -3
- package/api/@wtf/project-typedoc/config/type-aliases/TypedocConfig.md +1 -1
- package/api/@wtf/project-typedoc/config/type-aliases/TypedocOptions.md +6 -6
- package/api/@wtf/project-typedoc/config/variables/nodeRun.md +1 -1
- package/api/@wtf/project-typedoc/plugins/functions/cleanGeneratedMarkdown.md +1 -1
- package/api/@wtf/project-typedoc/plugins/functions/linkTrackedSources.md +1 -1
- package/api/@wtf/project-typedoc/plugins/functions/preventMediaFiles.md +1 -1
- package/api/@wtf/project-typedoc/plugins/type-aliases/CleanGeneratedMarkdownOptions.md +3 -3
- package/api/@wtf/project-typedoc/plugins/type-aliases/LinkTrackedSourcesOptions.md +3 -3
- package/api/@wtf/project-typedoc/plugins/type-aliases/PreventMediaFilesOptions.md +3 -3
- package/api/@wtf/project-typedoc/plugins/type-aliases/Run.md +1 -1
- package/api/@wtf/project-typedoc/plugins/type-aliases/TypedocPlugin.md +1 -1
- package/api/@wtf/project-vite/functions/baseConfig.md +4 -4
- package/api/@wtf/project-vite/functions/buildsSite.md +1 -1
- package/api/@wtf/project-vite/functions/compress.md +1 -1
- package/api/@wtf/project-vite/functions/conditionsOf.md +1 -1
- package/api/@wtf/project-vite/type-aliases/BaseOptions.md +2 -2
- package/api/@wtf/project-vite/type-aliases/CompressOptions.md +4 -4
- package/api/@wtf/project-vite/variables/CLIENT_CONDITIONS.md +1 -1
- package/api/@wtf/project-vite/variables/COMPRESSIBLE.md +1 -1
- package/api/@wtf/project-vite/variables/FROM_DIST.md +1 -1
- package/api/@wtf/project-vite/variables/THRESHOLD.md +1 -1
- package/api/@wtf/project-vitest/browser/functions/browserConfig.md +1 -1
- package/api/@wtf/project-vitest/browser/functions/browserRootConfig.md +1 -1
- package/api/@wtf/project-vitest/browser/type-aliases/BrowserOptions.md +3 -3
- package/api/@wtf/project-vitest/config/functions/integrationConfig.md +1 -1
- package/api/@wtf/project-vitest/config/functions/packageConfig.md +1 -1
- package/api/@wtf/project-vitest/config/functions/rootConfig.md +1 -1
- package/api/@wtf/project-vitest/config/type-aliases/RootConfigOptions.md +2 -2
- package/api/@wtf/project-vitest/config/type-aliases/RootOptions.md +7 -7
- package/api/@wtf/project-vitest/config/variables/FROM_DIST.md +1 -1
- package/api/@wtf/project-vitest/config/variables/GUARD_TIMEOUT.md +1 -1
- package/api/@wtf/project-vitest/config/variables/integration.md +9 -9
- package/api/@wtf/project-vitest/process/functions/childEnv.md +1 -1
- package/api/@wtf/project-vitest/process/type-aliases/Env.md +1 -1
- package/api/@wtf/project-vitest/storybook/functions/storybookConfig.md +1 -1
- package/api/@wtf/project-vitest/storybook/type-aliases/StorybookOptions.md +2 -2
- package/api/@wtf/project-wpt/builtins/functions/builtins.md +1 -1
- package/api/@wtf/project-wpt/builtins/functions/intrinsics.md +1 -1
- package/api/@wtf/project-wpt/checkout/functions/checkoutFolderOf.md +1 -1
- package/api/@wtf/project-wpt/checkout/functions/checkoutTests.md +1 -1
- package/api/@wtf/project-wpt/checkout/functions/checkoutWpt.md +1 -1
- package/api/@wtf/project-wpt/checkout/functions/fileOf.md +1 -1
- package/api/@wtf/project-wpt/checkout/type-aliases/CheckedOutTests.md +3 -3
- package/api/@wtf/project-wpt/checkout/type-aliases/CheckoutOptions.md +8 -8
- package/api/@wtf/project-wpt/checkout/type-aliases/CheckoutTestsOptions.md +2 -2
- package/api/@wtf/project-wpt/checkout/variables/HARNESS.md +1 -1
- package/api/@wtf/project-wpt/checkout/variables/REWRITES.md +1 -1
- package/api/@wtf/project-wpt/checkout/variables/WPT_REPOSITORY.md +1 -1
- package/api/@wtf/project-wpt/errors/classes/HarnessFailedError.md +4 -4
- package/api/@wtf/project-wpt/errors/classes/InvalidCommitError.md +4 -4
- package/api/@wtf/project-wpt/errors/classes/InvalidExpectationsError.md +4 -4
- package/api/@wtf/project-wpt/errors/classes/NoSuiteError.md +4 -4
- package/api/@wtf/project-wpt/errors/classes/NotInWptError.md +5 -5
- package/api/@wtf/project-wpt/errors/classes/StaleExpectationError.md +4 -4
- package/api/@wtf/project-wpt/errors/classes/SubtestFailedError.md +4 -4
- package/api/@wtf/project-wpt/errors/classes/UnexpectedPassError.md +4 -4
- package/api/@wtf/project-wpt/errors/classes/WptError.md +4 -4
- package/api/@wtf/project-wpt/errors/classes/WptFetchError.md +4 -4
- package/api/@wtf/project-wpt/expectations/functions/checkHarness.md +1 -1
- package/api/@wtf/project-wpt/expectations/functions/checkSubtest.md +1 -1
- package/api/@wtf/project-wpt/expectations/functions/expectationOf.md +1 -1
- package/api/@wtf/project-wpt/expectations/functions/expectationsIssues.md +1 -1
- package/api/@wtf/project-wpt/expectations/functions/readExpectations.md +1 -1
- package/api/@wtf/project-wpt/expectations/functions/staleOf.md +1 -1
- package/api/@wtf/project-wpt/expectations/type-aliases/ReadExpectations.md +3 -3
- package/api/@wtf/project-wpt/index/type-aliases/ClearTimeout.md +1 -1
- package/api/@wtf/project-wpt/index/type-aliases/CreateRealm.md +1 -1
- package/api/@wtf/project-wpt/index/type-aliases/Env.md +1 -1
- package/api/@wtf/project-wpt/index/type-aliases/Exec.md +1 -1
- package/api/@wtf/project-wpt/index/type-aliases/Expectations.md +1 -1
- package/api/@wtf/project-wpt/index/type-aliases/FileExpectation.md +4 -4
- package/api/@wtf/project-wpt/index/type-aliases/FileResult.md +4 -4
- package/api/@wtf/project-wpt/index/type-aliases/Globals.md +1 -1
- package/api/@wtf/project-wpt/index/type-aliases/HarnessResult.md +4 -4
- package/api/@wtf/project-wpt/index/type-aliases/HarnessStatus.md +1 -1
- package/api/@wtf/project-wpt/index/type-aliases/HoldRejections.md +1 -1
- package/api/@wtf/project-wpt/index/type-aliases/Performance.md +3 -3
- package/api/@wtf/project-wpt/index/type-aliases/Realm.md +3 -3
- package/api/@wtf/project-wpt/index/type-aliases/SetTimeout.md +1 -1
- package/api/@wtf/project-wpt/index/type-aliases/SubtestResult.md +5 -5
- package/api/@wtf/project-wpt/index/type-aliases/SubtestStatus.md +1 -1
- package/api/@wtf/project-wpt/index/type-aliases/WptFile.md +3 -3
- package/api/@wtf/project-wpt/index/type-aliases/WptFiles.md +9 -9
- package/api/@wtf/project-wpt/index/type-aliases/WptPaths.md +4 -4
- package/api/@wtf/project-wpt/index/type-aliases/WptPlatform.md +6 -6
- package/api/@wtf/project-wpt/index/type-aliases/WptSystem.md +6 -6
- package/api/@wtf/project-wpt/index/type-aliases/WptTest.md +3 -3
- package/api/@wtf/project-wpt/meta/functions/idOf.md +1 -1
- package/api/@wtf/project-wpt/meta/functions/metaOf.md +1 -1
- package/api/@wtf/project-wpt/meta/functions/runsOutsideWindow.md +1 -1
- package/api/@wtf/project-wpt/meta/functions/scriptPathsOf.md +1 -1
- package/api/@wtf/project-wpt/meta/functions/testsOf.md +1 -1
- package/api/@wtf/project-wpt/meta/type-aliases/Meta.md +6 -6
- package/api/@wtf/project-wpt/node/functions/nodePlatform.md +1 -1
- package/api/@wtf/project-wpt/node/functions/nodeSystem.md +1 -1
- package/api/@wtf/project-wpt/node/variables/nodeExec.md +1 -1
- package/api/@wtf/project-wpt/node/variables/nodeFiles.md +1 -1
- package/api/@wtf/project-wpt/node/variables/nodeRealm.md +1 -1
- package/api/@wtf/project-wpt/node/variables/nodeRejections.md +1 -1
- package/api/@wtf/project-wpt/run/functions/runTest.md +1 -1
- package/api/@wtf/project-wpt/run/type-aliases/RunOptions.md +8 -8
- package/api/@wtf/project-wpt/run/type-aliases/RunPlatform.md +1 -1
- package/api/@wtf/project-wpt/run/variables/LONG_TIMEOUT.md +1 -1
- package/api/@wtf/project-wpt/run/variables/TIMEOUT.md +1 -1
- package/api/@wtf/project-wpt/run/variables/WPT_ORIGIN.md +1 -1
- package/api/@wtf/project-wpt/suite/functions/wptSuite.md +1 -1
- package/api/@wtf/project-wpt/suite/type-aliases/WptSuiteOptions.md +8 -8
- package/api/README.md +1 -0
- package/api/trains.json +3 -0
- package/guides/astro.md +173 -0
- package/package.json +3 -2
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
type Meta = object;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/meta.ts:14](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/meta.ts:14](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/meta.ts#L14)
|
|
10
10
|
|
|
11
11
|
The `// META:` lines of a test file.
|
|
12
12
|
|
|
@@ -18,7 +18,7 @@ The `// META:` lines of a test file.
|
|
|
18
18
|
readonly globals: readonly string[];
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Defined in: [packages/project-wpt/src/meta.ts:22](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
21
|
+
Defined in: [packages/project-wpt/src/meta.ts:22](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/meta.ts#L22)
|
|
22
22
|
|
|
23
23
|
The globals of `global=` it runs in; empty when it names none.
|
|
24
24
|
|
|
@@ -30,7 +30,7 @@ The globals of `global=` it runs in; empty when it names none.
|
|
|
30
30
|
readonly long: boolean;
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Defined in: [packages/project-wpt/src/meta.ts:18](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
33
|
+
Defined in: [packages/project-wpt/src/meta.ts:18](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/meta.ts#L18)
|
|
34
34
|
|
|
35
35
|
Whether a `timeout=long` gives it longer.
|
|
36
36
|
|
|
@@ -42,7 +42,7 @@ Whether a `timeout=long` gives it longer.
|
|
|
42
42
|
readonly scripts: readonly string[];
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Defined in: [packages/project-wpt/src/meta.ts:16](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
45
|
+
Defined in: [packages/project-wpt/src/meta.ts:16](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/meta.ts#L16)
|
|
46
46
|
|
|
47
47
|
The scripts of `script=`, as written: from the root by a leading `/`, else from the file.
|
|
48
48
|
|
|
@@ -54,7 +54,7 @@ The scripts of `script=`, as written: from the root by a leading `/`, else from
|
|
|
54
54
|
readonly optional title?: string;
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Defined in: [packages/project-wpt/src/meta.ts:24](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
57
|
+
Defined in: [packages/project-wpt/src/meta.ts:24](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/meta.ts#L24)
|
|
58
58
|
|
|
59
59
|
Its `title=`.
|
|
60
60
|
|
|
@@ -66,6 +66,6 @@ Its `title=`.
|
|
|
66
66
|
readonly variants: readonly string[];
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
Defined in: [packages/project-wpt/src/meta.ts:20](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
69
|
+
Defined in: [packages/project-wpt/src/meta.ts:20](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/meta.ts#L20)
|
|
70
70
|
|
|
71
71
|
The queries of `variant=`, each a test of the file: `?1-1000`.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function nodePlatform(): WptPlatform;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/node.ts:99](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/node.ts:99](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/node.ts#L99)
|
|
10
10
|
|
|
11
11
|
Node's process as the runner's platform: its environment and working folder as they are when a
|
|
12
12
|
member is read, its timers, and `performance`.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function nodeSystem(): WptSystem;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/node.ts:174](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/node.ts:174](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/node.ts#L174)
|
|
10
10
|
|
|
11
11
|
Each service the runner takes, of Node: see the module.
|
|
12
12
|
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
const nodeExec: Exec;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/node.ts:114](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/node.ts:114](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/node.ts#L114)
|
|
10
10
|
|
|
11
11
|
Runs a command by Node, to its end: what it wrote on stdout, or an error of what it wrote on stderr.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
const nodeFiles: WptFiles;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/node.ts:55](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/node.ts:55](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/node.ts#L55)
|
|
10
10
|
|
|
11
11
|
The disk, by absolute paths, as the runner reads the checkout and the expectations, and locks a
|
|
12
12
|
checkout: a link is what it links to, an entry that is not there a `NotFoundError`, and a file
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
const nodeRealm: CreateRealm;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/node.ts:126](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/node.ts:126](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/node.ts#L126)
|
|
10
10
|
|
|
11
11
|
Makes a realm of a `node:vm` context of the `globals` given, with nothing of the process's own.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
const nodeRejections: HoldRejections;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/node.ts:153](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/node.ts:153](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/node.ts#L153)
|
|
10
10
|
|
|
11
11
|
Holds a listener of the process's rejections no one handles. The process has one report of them
|
|
12
12
|
for all its realms, so the listeners it has already, as Vitest's, are set aside while a listener
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function runTest(test, __namedParameters): Promise<FileResult>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/run.ts:257](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/run.ts:257](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L257)
|
|
10
10
|
|
|
11
11
|
A test file of the checkout in `folder`, run in a context of its own, of the built-ins and the
|
|
12
12
|
caller's `globals`: its harness, and each subtest, as testharness.js reports them. An error a
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
type RunOptions = object;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/run.ts:54](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/run.ts:54](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L54)
|
|
10
10
|
|
|
11
11
|
How a test file runs.
|
|
12
12
|
|
|
@@ -18,7 +18,7 @@ How a test file runs.
|
|
|
18
18
|
readonly files: Pick<WptFiles, "readFile" | "readBytes">;
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Defined in: [packages/project-wpt/src/run.ts:65](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
21
|
+
Defined in: [packages/project-wpt/src/run.ts:65](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L65)
|
|
22
22
|
|
|
23
23
|
The file system the checkout is read by.
|
|
24
24
|
|
|
@@ -30,7 +30,7 @@ The file system the checkout is read by.
|
|
|
30
30
|
readonly folder: string;
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Defined in: [packages/project-wpt/src/run.ts:67](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
33
|
+
Defined in: [packages/project-wpt/src/run.ts:67](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L67)
|
|
34
34
|
|
|
35
35
|
The folder of the checkout of the WPT, as ./checkout gives it.
|
|
36
36
|
|
|
@@ -42,7 +42,7 @@ The folder of the checkout of the WPT, as ./checkout gives it.
|
|
|
42
42
|
readonly optional globals?: (file) => Globals;
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Defined in: [packages/project-wpt/src/run.ts:69](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
45
|
+
Defined in: [packages/project-wpt/src/run.ts:69](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L69)
|
|
46
46
|
|
|
47
47
|
The globals the file's context has besides its built-ins: the implementation under test.
|
|
48
48
|
|
|
@@ -64,7 +64,7 @@ The globals the file's context has besides its built-ins: the implementation und
|
|
|
64
64
|
readonly platform: RunPlatform;
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
Defined in: [packages/project-wpt/src/run.ts:56](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
67
|
+
Defined in: [packages/project-wpt/src/run.ts:56](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L56)
|
|
68
68
|
|
|
69
69
|
The platform whose timers the file's timers, and the file's time, run by.
|
|
70
70
|
|
|
@@ -76,7 +76,7 @@ The platform whose timers the file's timers, and the file's time, run by.
|
|
|
76
76
|
readonly realm: CreateRealm;
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
Defined in: [packages/project-wpt/src/run.ts:58](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
79
|
+
Defined in: [packages/project-wpt/src/run.ts:58](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L58)
|
|
80
80
|
|
|
81
81
|
Makes the realm the file runs in: in Node, `nodeRealm` of ./node, a `node:vm` context.
|
|
82
82
|
|
|
@@ -88,7 +88,7 @@ Makes the realm the file runs in: in Node, `nodeRealm` of ./node, a `node:vm` co
|
|
|
88
88
|
readonly rejections: HoldRejections;
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
Defined in: [packages/project-wpt/src/run.ts:63](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
91
|
+
Defined in: [packages/project-wpt/src/run.ts:63](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L63)
|
|
92
92
|
|
|
93
93
|
Gives a listener each rejection no one handles, until it is stopped: in Node,
|
|
94
94
|
`nodeRejections` of ./node.
|
|
@@ -101,6 +101,6 @@ Gives a listener each rejection no one handles, until it is stopped: in Node,
|
|
|
101
101
|
readonly optional timeout?: number;
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
Defined in: [packages/project-wpt/src/run.ts:71](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
104
|
+
Defined in: [packages/project-wpt/src/run.ts:71](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L71)
|
|
105
105
|
|
|
106
106
|
How long it may take, in milliseconds: [TIMEOUT](../variables/TIMEOUT.md), or [LONG\_TIMEOUT](../variables/LONG_TIMEOUT.md) if long.
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
type RunPlatform = Pick<WptPlatform, "setTimeout" | "clearTimeout">;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/run.ts:51](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/run.ts:51](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L51)
|
|
10
10
|
|
|
11
11
|
The members of the platform a run takes: its timers.
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
const LONG_TIMEOUT: 60000 = 60_000;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/run.ts:48](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/run.ts:48](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L48)
|
|
10
10
|
|
|
11
11
|
How long a file of `// META: timeout=long` may take, in milliseconds: six times as long.
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
const TIMEOUT: 10000 = 10_000;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/run.ts:45](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/run.ts:45](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L45)
|
|
10
10
|
|
|
11
11
|
How long a file may take, in milliseconds: 10 seconds, as the WPT gives one.
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
const WPT_ORIGIN: "http://web-platform.test:8000" = 'http://web-platform.test:8000';
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/run.ts:42](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/run.ts:42](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/run.ts#L42)
|
|
10
10
|
|
|
11
11
|
The origin a test file is at, as the WPT's server has it.
|
|
@@ -10,7 +10,7 @@ function wptSuite(
|
|
|
10
10
|
): void;
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Defined in: [packages/project-wpt/src/suite.ts:98](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
13
|
+
Defined in: [packages/project-wpt/src/suite.ts:98](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/suite.ts#L98)
|
|
14
14
|
|
|
15
15
|
A suite of the WPT, by its `name`: each test file of its `files` and `dirs`, at its `commit`,
|
|
16
16
|
run against the `globals` it maps in, each subtest a test, green when only what its
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
type WptSuiteOptions = WptPaths & object;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/project-wpt/src/suite.ts:53](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
9
|
+
Defined in: [packages/project-wpt/src/suite.ts:53](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/suite.ts#L53)
|
|
10
10
|
|
|
11
11
|
What a suite runs, and against what.
|
|
12
12
|
|
|
@@ -14,10 +14,10 @@ What a suite runs, and against what.
|
|
|
14
14
|
|
|
15
15
|
| Name | Type | Description | Defined in |
|
|
16
16
|
| ------ | ------ | ------ | ------ |
|
|
17
|
-
| `commit` | `string` | The commit of the WPT the suite's tests are pinned to, its full hash: what moves it is a change of the repo, reviewed. | [packages/project-wpt/src/suite.ts:58](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
18
|
-
| `expectations?` | \| `string` \| `URL` \| [`Expectations`](../../index/type-aliases/Expectations.md) | The known failures of the suite, or of its run: a JSON file, by its path from `root` or its URL, or the object; none by default. | [packages/project-wpt/src/suite.ts:75](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
19
|
-
| `globals()?` | (`file`) => [`Globals`](../../index/type-aliases/Globals.md) | The globals of each test file's context, over its built-ins: the implementation under test, made anew of each file. `undefined` of a name takes a built-in out. | [packages/project-wpt/src/suite.ts:65](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
20
|
-
| `repository?` | `string` | The git repository of the WPT, as a mirror: the WPT's own on GitHub by default. | [packages/project-wpt/src/suite.ts:60](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
21
|
-
| `root?` | `string` \| `URL` | The folder of the project, whose `node_modules/.cache/wpt` keeps the checkouts, and from which a path of `expectations` is read: the platform's working folder by default. | [packages/project-wpt/src/suite.ts:80](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
22
|
-
| `run?` | `string` | The name of the run, of a suite run against more than one implementation, each a `wptSuite` of its own, each of its own `expectations`: `doubles`, `node`. Its tests are named by it. | [packages/project-wpt/src/suite.ts:70](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
23
|
-
| `timeout?` | `number` | How long each file may take, in milliseconds, in place of the WPT's 10 s, or 60 s if long. | [packages/project-wpt/src/suite.ts:82](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.0
|
|
17
|
+
| `commit` | `string` | The commit of the WPT the suite's tests are pinned to, its full hash: what moves it is a change of the repo, reviewed. | [packages/project-wpt/src/suite.ts:58](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/suite.ts#L58) |
|
|
18
|
+
| `expectations?` | \| `string` \| `URL` \| [`Expectations`](../../index/type-aliases/Expectations.md) | The known failures of the suite, or of its run: a JSON file, by its path from `root` or its URL, or the object; none by default. | [packages/project-wpt/src/suite.ts:75](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/suite.ts#L75) |
|
|
19
|
+
| `globals()?` | (`file`) => [`Globals`](../../index/type-aliases/Globals.md) | The globals of each test file's context, over its built-ins: the implementation under test, made anew of each file. `undefined` of a name takes a built-in out. | [packages/project-wpt/src/suite.ts:65](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/suite.ts#L65) |
|
|
20
|
+
| `repository?` | `string` | The git repository of the WPT, as a mirror: the WPT's own on GitHub by default. | [packages/project-wpt/src/suite.ts:60](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/suite.ts#L60) |
|
|
21
|
+
| `root?` | `string` \| `URL` | The folder of the project, whose `node_modules/.cache/wpt` keeps the checkouts, and from which a path of `expectations` is read: the platform's working folder by default. | [packages/project-wpt/src/suite.ts:80](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/suite.ts#L80) |
|
|
22
|
+
| `run?` | `string` | The name of the run, of a suite run against more than one implementation, each a `wptSuite` of its own, each of its own `expectations`: `doubles`, `node`. Its tests are named by it. | [packages/project-wpt/src/suite.ts:70](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/suite.ts#L70) |
|
|
23
|
+
| `timeout?` | `number` | How long each file may take, in milliseconds, in place of the WPT's 10 s, or 60 s if long. | [packages/project-wpt/src/suite.ts:82](https://gitlab.com/wetryfun/project/project/-/blob/docs-v1.1.0/packages/project-wpt/src/suite.ts#L82) |
|
package/api/README.md
CHANGED
package/api/trains.json
CHANGED
package/guides/astro.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Astro sites
|
|
2
|
+
|
|
3
|
+
This guide shows you how to build an Astro site that serves on GitLab Pages as it does on your
|
|
4
|
+
machine: one base config for its `astro.config.mjs`, a build that GitLab Pages serves without a
|
|
5
|
+
redirect, a build that fails on a link that leads nowhere, and a preview that serves the build as
|
|
6
|
+
GitLab Pages does, before it ships.
|
|
7
|
+
|
|
8
|
+
`@wtf/project-astro` holds it. Astro is a peer dependency: your site names `astro`.
|
|
9
|
+
|
|
10
|
+
| Export | What it is |
|
|
11
|
+
| ------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
12
|
+
| `./config` | `baseConfig(options)`, the base of an `astro.config.mjs`, merged with your own by `mergeConfig` |
|
|
13
|
+
| `./pages` | `pages()`, the integration that makes the build serve on GitLab Pages, and the passes it runs |
|
|
14
|
+
| `./links` | `links()`, the integration that fails the build on a link of no page, or of a redirect, and its checks |
|
|
15
|
+
| `./redirects` | `parseRedirects`, `formatRedirects` and `matchRedirect`: a `_redirects` file read, written and matched |
|
|
16
|
+
| `./preview` | `pagesOf(folder, base)`, a built site served as GitLab Pages serves it, and `listen`, on Node's HTTP server |
|
|
17
|
+
| bin | `project-astro preview [folder]`, which serves a built folder as GitLab Pages does |
|
|
18
|
+
|
|
19
|
+
## Start from the base
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
// astro.config.mjs
|
|
23
|
+
import { defineConfig, mergeConfig } from 'astro/config'
|
|
24
|
+
|
|
25
|
+
import { baseConfig } from '@wtf/project-astro/config'
|
|
26
|
+
|
|
27
|
+
export default defineConfig(
|
|
28
|
+
mergeConfig(baseConfig(), {
|
|
29
|
+
site: 'https://example.com/',
|
|
30
|
+
outDir: 'public',
|
|
31
|
+
publicDir: 'static'
|
|
32
|
+
})
|
|
33
|
+
)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`mergeConfig` of `astro/config` puts your settings over the base's, and your integrations after its
|
|
37
|
+
own. The base sets:
|
|
38
|
+
|
|
39
|
+
- `trailingSlash: 'never'` and `build: { format: 'preserve' }`. A page is built where its route
|
|
40
|
+
names it: `guides.astro` as `guides.html`, served at `/guides`. A page that has pages below it is
|
|
41
|
+
served as a folder, `/guides/`, once `pages()` moves it there.
|
|
42
|
+
- `site` and `base`, from the URL GitLab Pages serves the site at: `ASTRO_BASE`, set it for a domain
|
|
43
|
+
of your own, or else `CI_PAGES_URL`, which a GitLab pipeline sets. The base is the path of that
|
|
44
|
+
URL, such as `/project/` of `https://group.gitlab.io/project`, and none of a site at the root of
|
|
45
|
+
its domain. `siteOf(env)` and `baseOf(env)` of `./config` read them. A `site` of your own wins.
|
|
46
|
+
- `markdown.processor`, the remark and rehype processor of `@astrojs/markdown-remark`, `unified()`,
|
|
47
|
+
with the plugins you give it.
|
|
48
|
+
- `vite`, from `baseConfig()` of `@wtf/project-vite/config`: the workspace's packages from their
|
|
49
|
+
source, and compressed copies of the scripts and styles of the build (see
|
|
50
|
+
[Vite, and sites](vite.md)).
|
|
51
|
+
- `integrations`: `pages()`, then `links()`.
|
|
52
|
+
|
|
53
|
+
Give the markdown plugins, the options of the Vite base, and which integrations you want, to
|
|
54
|
+
`baseConfig`:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import type { RehypePlugins, RemarkPlugins } from 'astro'
|
|
58
|
+
import { defineConfig, mergeConfig } from 'astro/config'
|
|
59
|
+
|
|
60
|
+
import { baseConfig } from '@wtf/project-astro/config'
|
|
61
|
+
|
|
62
|
+
declare const remarkPlugins: RemarkPlugins
|
|
63
|
+
declare const rehypePlugins: RehypePlugins
|
|
64
|
+
|
|
65
|
+
export default defineConfig(
|
|
66
|
+
mergeConfig(
|
|
67
|
+
baseConfig({
|
|
68
|
+
markdown: { remarkPlugins, rehypePlugins },
|
|
69
|
+
vite: { compress: false },
|
|
70
|
+
links: false
|
|
71
|
+
}),
|
|
72
|
+
{ site: 'https://example.com/' }
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
A `markdown.processor` of your own replaces the base's whole.
|
|
78
|
+
|
|
79
|
+
## Serve on GitLab Pages
|
|
80
|
+
|
|
81
|
+
GitLab Pages serves a folder as it is. Two things of an Astro build trip it, and `pages()` fixes
|
|
82
|
+
each once the build is done:
|
|
83
|
+
|
|
84
|
+
- It cannot serve a page `guides.html` that has a folder `guides/` beside it. `pages()` moves the
|
|
85
|
+
page to `guides/index.html` (`moveConflictingPages`).
|
|
86
|
+
- It answers `/guides`, the URL of a folder, with a redirect to `/guides/`. `pages()` gives each
|
|
87
|
+
link to a folder's page its final slash, of each `href`, each `<option value>` and each `<loc>` of
|
|
88
|
+
the sitemap (`slashFolderLinksIn`). A link to a page `X.html` keeps none: GitLab Pages serves it
|
|
89
|
+
at `X`.
|
|
90
|
+
|
|
91
|
+
The search index of Starlight, Pagefind's, records each page where it was built. `pages()` gives
|
|
92
|
+
each page of it the URL it is served at once it moved (`fixSearchUrlsIn`).
|
|
93
|
+
|
|
94
|
+
`pages()` runs after every other integration of your site, whatever their order, so it moves what
|
|
95
|
+
Starlight and your own integrations wrote, and fixes the index Starlight's search wrote.
|
|
96
|
+
|
|
97
|
+
## Check the links
|
|
98
|
+
|
|
99
|
+
`links()` checks each internal link of each page of the build: an `href` of a path, relative or from
|
|
100
|
+
the root, or a URL of the site, below its base. It resolves each one the way GitLab Pages serves the
|
|
101
|
+
folder: a file, a folder's `index.html`, a page `<path>.html`, then the rules of the folder's
|
|
102
|
+
`_redirects`. It fails the build:
|
|
103
|
+
|
|
104
|
+
- with a `BrokenLinksError` of `./errors`, of each link that leads to no page;
|
|
105
|
+
- with a `RedirectedLinksError`, of each link that leads to its page only through a redirect, which
|
|
106
|
+
costs each reader a round trip. It says where each one leads: link there.
|
|
107
|
+
|
|
108
|
+
It logs each link with its page first. It runs after `pages()`, so a link `pages()` gave its slash
|
|
109
|
+
passes. Run the checks on a folder yourself with `brokenLinksIn(folder, base)` and
|
|
110
|
+
`redirectedLinksIn(folder, base)`.
|
|
111
|
+
|
|
112
|
+
## Write `_redirects`
|
|
113
|
+
|
|
114
|
+
GitLab Pages reads the rules of a `_redirects` file at the top of the site: a path to match, a
|
|
115
|
+
target and a status, `301` or `302` to redirect and `200` to rewrite, with `:placeholders` and a
|
|
116
|
+
`*` splat at the end. Its paths include the site's base. It ignores what it does not support: other
|
|
117
|
+
statuses, the force flag, conditions, query parameters and the lines past its limits.
|
|
118
|
+
|
|
119
|
+
Write the file with `formatRedirects`, which throws an `InvalidRedirectError` of a rule GitLab Pages
|
|
120
|
+
would ignore, rather than ship it:
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
import type { AstroIntegration } from 'astro'
|
|
124
|
+
import { writeFileSync } from 'node:fs'
|
|
125
|
+
|
|
126
|
+
import { formatRedirects } from '@wtf/project-astro/redirects'
|
|
127
|
+
|
|
128
|
+
/** The `_redirects` of a site whose base sends a reader to the English pages. */
|
|
129
|
+
export const redirects = (): AstroIntegration => {
|
|
130
|
+
let base = '/'
|
|
131
|
+
return {
|
|
132
|
+
name: 'redirects',
|
|
133
|
+
hooks: {
|
|
134
|
+
'astro:config:done': ({ config }) => {
|
|
135
|
+
base = config.base.endsWith('/') ? config.base : `${config.base}/`
|
|
136
|
+
},
|
|
137
|
+
'astro:build:done': ({ dir }) => {
|
|
138
|
+
const text = formatRedirects([{ from: base, to: `${base}en/`, status: 302 }])
|
|
139
|
+
writeFileSync(new URL('_redirects', dir), text)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`parseRedirects(text)` reads one back, with each line GitLab Pages ignores and why, and
|
|
147
|
+
`matchRedirect(rules, path)` finds the rule that answers a path, with where it sends it.
|
|
148
|
+
|
|
149
|
+
## Preview the build
|
|
150
|
+
|
|
151
|
+
`astro preview` serves the build as Astro does, not as GitLab Pages does: it reads no
|
|
152
|
+
`_redirects`. `project-astro preview` serves it as GitLab Pages does: a file at the path, then the
|
|
153
|
+
first rule of `_redirects` that matches, then `404.html`, under the site's base.
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"scripts": {
|
|
158
|
+
"build": "astro build",
|
|
159
|
+
"preview": "project-astro preview public"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
| Option | Default |
|
|
165
|
+
| --------------- | ------------------------------------------------ |
|
|
166
|
+
| `[folder]` | `dist` |
|
|
167
|
+
| `--base <path>` | the base of `ASTRO_BASE` or `CI_PAGES_URL`, or / |
|
|
168
|
+
| `--host <host>` | `localhost` |
|
|
169
|
+
| `--port <port>` | `4321` |
|
|
170
|
+
|
|
171
|
+
It says on stderr each line of `_redirects` that GitLab Pages ignores, and why. An end-to-end test
|
|
172
|
+
can start it as its web server, or serve the build itself with `pagesOf` and `listen` of
|
|
173
|
+
`./preview`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wtf/project-docs",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "Guides and API reference for the @wtf/project packages: the shared TypeScript, oxlint, oxfmt, Vite, Vitest and
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Guides and API reference for the @wtf/project packages: the shared TypeScript, oxlint, oxfmt, Vite, Vitest, TypeDoc and Astro configs of a pnpm workspace, the resolve hook that runs its TypeScript from source, the runner of the Web Platform Tests, and the Astro integrations that make a site serve on GitLab Pages.",
|
|
5
5
|
"homepage": "https://gitlab.com/wetryfun/project/project/-/tree/main/packages/project-docs",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://gitlab.com/wetryfun/project/project/-/issues"
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"typedoc": "typedoc"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@wtf/project-astro": "1.0.0",
|
|
39
40
|
"@wtf/project-oxfmt": "1.0.0",
|
|
40
41
|
"@wtf/project-oxlint": "1.0.0",
|
|
41
42
|
"@wtf/project-resolve": "1.0.0",
|