@taprootio/site-authoring 0.12.3 → 0.12.4
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taprootio/site-authoring",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.4",
|
|
4
4
|
"description": "Taproot site authoring CLI: sign in once in the browser, then pull, validate, push, preview, approve, and deploy a site from the terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "ISC",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SiteAuthoringError } from "./errors.js";
|
|
2
|
+
import { RUNTIME_MIRROR_PATH_REASON, isRuntimeMirrorPath } from "./reserved-paths.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The redirect map's workspace contract (TR00702).
|
|
@@ -203,6 +204,7 @@ export function redirectSourceRefusalReason(path) {
|
|
|
203
204
|
if (first === RESERVED_INTEGRATION_DATA_SEGMENT) {
|
|
204
205
|
return `'/${segments[0]}' is reserved for integration data, so nothing under it can be a redirect source.`;
|
|
205
206
|
}
|
|
207
|
+
if (isRuntimeMirrorPath(decoded)) return RUNTIME_MIRROR_PATH_REASON;
|
|
206
208
|
if (GENERATED_ROOT_FILES.includes(first)) {
|
|
207
209
|
return `'/${segments[0]}' is a file the site generates, so neither it nor anything under it can be a redirect source.`;
|
|
208
210
|
}
|
package/src/reference-help.js
CHANGED
|
@@ -659,7 +659,9 @@ const WORKFLOW_REFERENCES = Object.freeze({
|
|
|
659
659
|
+ "no separate propagation delay; an entry a check does not see belongs to a release that is not being "
|
|
660
660
|
+ "served yet.",
|
|
661
661
|
"A source cannot name a file the site generates: '/index.html' or any page's own 'index.html', '/404.html', "
|
|
662
|
-
+ "'/sitemap.xml', '/robots.txt', '/favicon.ico', or a path under the sitemap or robots names.
|
|
662
|
+
+ "'/sitemap.xml', '/robots.txt', '/favicon.ico', or a path under the sitemap or robots names. Nothing under "
|
|
663
|
+
+ "'/taproot/<version>/' (for example '/taproot/5.0.62/manifest.json') can be a source either: the platform "
|
|
664
|
+
+ "serves the published-site runtime there before any redirect. The platform "
|
|
663
665
|
+ "already redirects every '…/index.html' address to its directory, so no entry is needed for one. A source "
|
|
664
666
|
+ "that could not be stored as a file (a dot-prefixed segment, a reserved device name, an escaped percent "
|
|
665
667
|
+ "sign) is refused too. 'validate' names the entry and the reason.",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Site paths the platform reserves on every site host.
|
|
3
|
+
*
|
|
4
|
+
* The published-site Worker ships the immutable runtime as static assets at
|
|
5
|
+
* `/taproot/<semver>/...` (TR01144), and Cloudflare answers a matching request
|
|
6
|
+
* before the Worker runs, so a page or redirect authored there could never be
|
|
7
|
+
* reached. This is the one place the package owns that prefix; page push and
|
|
8
|
+
* the redirect map both ask here. The API is the authority and mirrors the rule
|
|
9
|
+
* in `PublishedOutputPaths.IsRuntimeMirrorPath`; both are pinned by the same
|
|
10
|
+
* test vectors.
|
|
11
|
+
*/
|
|
12
|
+
const RUNTIME_MIRROR_PATH =
|
|
13
|
+
/^taproot\/[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\/|$)/iu;
|
|
14
|
+
|
|
15
|
+
/** Whether a site-relative path (no leading slash) is `taproot/<semver>` or under it. */
|
|
16
|
+
export function isRuntimeMirrorPath(path) {
|
|
17
|
+
return RUNTIME_MIRROR_PATH.test(path);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const RUNTIME_MIRROR_PATH_REASON =
|
|
21
|
+
"'/taproot/<version>/' is reserved for the published-site runtime, which the platform answers before any page "
|
|
22
|
+
+ "or redirect, so nothing under it can be authored.";
|
package/src/verbs/pages-push.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createPage, listSitePages, PAGE_STATUS_DELETED, updatePage, withRefusalGuidance } from "../api.js";
|
|
2
2
|
import { VERB_PAGES_PUSH } from "../constants.js";
|
|
3
3
|
import { SiteAuthoringError } from "../errors.js";
|
|
4
|
+
import { RUNTIME_MIRROR_PATH_REASON, isRuntimeMirrorPath } from "../reserved-paths.js";
|
|
4
5
|
import { boundedList, openSession, successResult, warnIfExternalWritesPaused } from "../session.js";
|
|
5
6
|
import { SETTINGS_TYPE_TAPROOT_STYLES } from "../settings-catalog.js";
|
|
6
7
|
import {
|
|
@@ -484,6 +485,14 @@ export async function readWorkspacePageSource({ workspaceDir, file, manifestEntr
|
|
|
484
485
|
);
|
|
485
486
|
}
|
|
486
487
|
|
|
488
|
+
if (isRuntimeMirrorPath(pagePath)) {
|
|
489
|
+
throw documentError(
|
|
490
|
+
"pages.path_unsupported",
|
|
491
|
+
`'${file}' declares page path '${pagePath}': ${RUNTIME_MIRROR_PATH_REASON}`,
|
|
492
|
+
file,
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
|
|
487
496
|
return {
|
|
488
497
|
file,
|
|
489
498
|
pagePath,
|