@riebeckite/plugin-deploy 0.0.31 → 0.0.33
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 +14 -9
- package/README_ja.md +15 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -3
- package/dist/src/plugin.d.ts +3 -10
- package/dist/src/redirects.d.ts +0 -5
- package/dist/src/types.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,21 +10,21 @@ It does not upload anything and never writes to the filesystem.
|
|
|
10
10
|
|
|
11
11
|
## Overview
|
|
12
12
|
|
|
13
|
-
`
|
|
14
|
-
provider-specific files for Cloudflare Pages,
|
|
15
|
-
All planning is pure and deterministic: no timestamps,
|
|
16
|
-
stable path order.
|
|
13
|
+
`deploy()` reads public redirects from the content manifest and plans the
|
|
14
|
+
provider-specific files for Cloudflare Pages, Cloudflare Workers, Netlify,
|
|
15
|
+
Vercel, or GitHub Pages. All planning is pure and deterministic: no timestamps,
|
|
16
|
+
no randomness, and a stable path order.
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
20
|
```ts
|
|
21
21
|
import { defineConfig } from "@riebeckite/core";
|
|
22
|
-
import {
|
|
22
|
+
import { deploy } from "@riebeckite/plugin-deploy";
|
|
23
23
|
|
|
24
24
|
export default defineConfig({
|
|
25
25
|
plugins: [
|
|
26
|
-
|
|
27
|
-
provider: ["cloudflare-
|
|
26
|
+
deploy({
|
|
27
|
+
provider: ["cloudflare-workers", "github-pages"],
|
|
28
28
|
cname: "example.com",
|
|
29
29
|
headers: { "X-Frame-Options": "DENY" },
|
|
30
30
|
}),
|
|
@@ -40,17 +40,22 @@ is skipped and reported with a `deploy-unresolved-redirect` diagnostic.
|
|
|
40
40
|
|
|
41
41
|
| Provider | Files |
|
|
42
42
|
| --- | --- |
|
|
43
|
-
| `cloudflare-pages`, `netlify` | `_redirects` (when redirects exist), `_headers` (when headers are configured) |
|
|
43
|
+
| `cloudflare-pages`, `cloudflare-workers`, `netlify` | `_redirects` (when redirects exist), `_headers` (when headers are configured) |
|
|
44
44
|
| `vercel` | `vercel.json` |
|
|
45
45
|
| `github-pages` | `.nojekyll`, `404.html`, `CNAME` (when configured), one `<from>/index.html` meta-refresh stub per redirect |
|
|
46
46
|
|
|
47
|
+
`cloudflare-workers` produces the same files as `cloudflare-pages`, because
|
|
48
|
+
Workers Static Assets reads both `_redirects` and `_headers`. Cloudflare applies
|
|
49
|
+
`_redirects` only to static asset responses, not to responses generated by
|
|
50
|
+
Worker code.
|
|
51
|
+
|
|
47
52
|
GitHub Pages has no `_redirects` syntax, so every redirect becomes an HTML stub
|
|
48
53
|
with a meta refresh and a `<link rel="canonical">`. A redirect from `/` is
|
|
49
54
|
skipped because the root cannot be stubbed.
|
|
50
55
|
|
|
51
56
|
## Public API
|
|
52
57
|
|
|
53
|
-
- `
|
|
58
|
+
- `deploy(options: DeployOptions): RiebeckitePlugin`
|
|
54
59
|
- `planDeployOutputs({ provider, redirects, options }): DeployOutput[]`
|
|
55
60
|
- `renderRedirectLines(redirects): string`
|
|
56
61
|
- `renderVercelConfig({ redirects, options }): string`
|
package/README_ja.md
CHANGED
|
@@ -2,28 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- Generated from docs/docs/plugins/deploy.ja.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
|
|
4
4
|
|
|
5
|
-
Riebeckite
|
|
6
|
-
ファイルを組み立て、ビルドの generated-output シンク経由で出力します。
|
|
5
|
+
Riebeckite の静的ホスティング向けの出力ヘルパーです。デプロイ先に必要なファイルを組み立て、ビルドの生成出力シンクへ渡します。
|
|
7
6
|
アップロードは行わず、ファイルシステムにも書き込みません。
|
|
8
7
|
|
|
9
8
|
[English](./README.md)
|
|
10
9
|
|
|
11
10
|
## 概要
|
|
12
11
|
|
|
13
|
-
`
|
|
14
|
-
Cloudflare Pages / Netlify / Vercel / GitHub Pages
|
|
15
|
-
|
|
12
|
+
`deploy()` はコンテンツマニフェストの公開リダイレクトを読み、
|
|
13
|
+
Cloudflare Pages / Cloudflare Workers / Netlify / Vercel / GitHub Pages 向けの
|
|
14
|
+
ファイルを計画します。出力計画は純粋かつ決定的です。タイムスタンプや乱数は使わず、
|
|
15
|
+
パスの順序も安定します。
|
|
16
16
|
|
|
17
17
|
## 使い方
|
|
18
18
|
|
|
19
19
|
```ts
|
|
20
20
|
import { defineConfig } from "@riebeckite/core";
|
|
21
|
-
import {
|
|
21
|
+
import { deploy } from "@riebeckite/plugin-deploy";
|
|
22
22
|
|
|
23
23
|
export default defineConfig({
|
|
24
24
|
plugins: [
|
|
25
|
-
|
|
26
|
-
provider: ["cloudflare-
|
|
25
|
+
deploy({
|
|
26
|
+
provider: ["cloudflare-workers", "github-pages"],
|
|
27
27
|
cname: "example.com",
|
|
28
28
|
headers: { "X-Frame-Options": "DENY" },
|
|
29
29
|
}),
|
|
@@ -39,17 +39,22 @@ export default defineConfig({
|
|
|
39
39
|
|
|
40
40
|
| プロバイダ | ファイル |
|
|
41
41
|
| --- | --- |
|
|
42
|
-
| `cloudflare-pages`, `netlify` | `_redirects`(リダイレクトがある場合)、`_headers`(ヘッダー設定時) |
|
|
42
|
+
| `cloudflare-pages`, `cloudflare-workers`, `netlify` | `_redirects`(リダイレクトがある場合)、`_headers`(ヘッダー設定時) |
|
|
43
43
|
| `vercel` | `vercel.json` |
|
|
44
44
|
| `github-pages` | `.nojekyll`、`404.html`、`CNAME`(設定時)、リダイレクトごとの `<from>/index.html` メタリフレッシュ |
|
|
45
45
|
|
|
46
|
+
`cloudflare-workers` は `cloudflare-pages` と同じファイルを出力します。Workers
|
|
47
|
+
Static Assets が `_redirects` と `_headers` の両方を読むためです。ただし Cloudflare
|
|
48
|
+
は `_redirects` を静的アセットのレスポンスにのみ適用し、Worker コードが返す
|
|
49
|
+
レスポンスには適用しません。
|
|
50
|
+
|
|
46
51
|
GitHub Pages には `_redirects` 構文がないため、各リダイレクトはメタリフレッシュと
|
|
47
52
|
`<link rel="canonical">` を持つ HTML スタブになります。`/` からのリダイレクトは
|
|
48
53
|
ルートをスタブ化できないためスキップします。
|
|
49
54
|
|
|
50
55
|
## 公開 API
|
|
51
56
|
|
|
52
|
-
- `
|
|
57
|
+
- `deploy(options: DeployOptions): RiebeckitePlugin`
|
|
53
58
|
- `planDeployOutputs({ provider, redirects, options }): DeployOutput[]`
|
|
54
59
|
- `renderRedirectLines(redirects): string`
|
|
55
60
|
- `renderVercelConfig({ redirects, options }): string`
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { deploy } from "./src/plugin.js";
|
|
2
2
|
export { mergePlannedOutputs, planDeployOutputs, renderHeaders, renderVercelConfig, } from "./src/providers.js";
|
|
3
3
|
export { isPermanentRedirect, renderNotFoundPage, renderRedirectLines, renderRedirectStub, } from "./src/redirects.js";
|
|
4
4
|
export type { DeployOptions, DeployOutput, DeployProvider, PublicRedirect, } from "./src/types.js";
|
package/dist/index.js
CHANGED
|
@@ -147,7 +147,8 @@ function planDeployOutputs(args) {
|
|
|
147
147
|
};
|
|
148
148
|
switch (provider) {
|
|
149
149
|
case "netlify":
|
|
150
|
-
case "cloudflare-pages":
|
|
150
|
+
case "cloudflare-pages":
|
|
151
|
+
case "cloudflare-workers": {
|
|
151
152
|
const lines = renderRedirectLines(redirects);
|
|
152
153
|
if (lines.length > 0) add("_redirects", lines);
|
|
153
154
|
if (options?.headers && Object.keys(options.headers).length > 0) {
|
|
@@ -218,7 +219,7 @@ function resolvePublicRedirects(manifest, diagnostics) {
|
|
|
218
219
|
}
|
|
219
220
|
return redirects;
|
|
220
221
|
}
|
|
221
|
-
function
|
|
222
|
+
function deploy(options) {
|
|
222
223
|
return definePlugin({
|
|
223
224
|
name: PLUGIN_NAME,
|
|
224
225
|
options,
|
|
@@ -248,7 +249,7 @@ function deployPlugin(options) {
|
|
|
248
249
|
});
|
|
249
250
|
}
|
|
250
251
|
export {
|
|
251
|
-
|
|
252
|
+
deploy,
|
|
252
253
|
isPermanentRedirect,
|
|
253
254
|
mergePlannedOutputs,
|
|
254
255
|
planDeployOutputs,
|
package/dist/src/plugin.d.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { DeployOptions
|
|
3
|
-
/**
|
|
4
|
-
* Maps the manifest's public redirects to deploy-friendly redirects. Only
|
|
5
|
-
* `manifest.publicRedirects` is read: `manifest.redirects` also contains
|
|
6
|
-
* non-public paths, which must never leak into deploy files. A redirect whose
|
|
7
|
-
* target slug no longer exists is skipped and reported as a diagnostic.
|
|
8
|
-
*/
|
|
9
|
-
export declare function resolvePublicRedirects(manifest: ContentManifest, diagnostics: Diagnostic[]): PublicRedirect[];
|
|
1
|
+
import { type RiebeckitePlugin } from "@riebeckite/core";
|
|
2
|
+
import type { DeployOptions } from "./types.js";
|
|
10
3
|
/**
|
|
11
4
|
* Prepares static hosting files for one or more deploy targets. The plugin only
|
|
12
5
|
* plans and emits files through the build's generated-output sink; it never
|
|
13
6
|
* writes to the filesystem and never uploads anything.
|
|
14
7
|
*/
|
|
15
|
-
export declare function
|
|
8
|
+
export declare function deploy(options: DeployOptions): RiebeckitePlugin;
|
package/dist/src/redirects.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import type { PublicRedirect } from "./types.js";
|
|
2
2
|
export declare function isPermanentRedirect(status: PublicRedirect["status"]): boolean;
|
|
3
|
-
/**
|
|
4
|
-
* Deterministic ordering shared by every renderer: by `from`, then `to`, then
|
|
5
|
-
* `status`, using code-unit comparison so the result never depends on locale.
|
|
6
|
-
*/
|
|
7
|
-
export declare function compareRedirects(left: PublicRedirect, right: PublicRedirect): number;
|
|
8
3
|
export declare function compareStrings(left: string, right: string): number;
|
|
9
4
|
/**
|
|
10
5
|
* Drops incomplete redirects, removes exact duplicates, and sorts the rest.
|
package/dist/src/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* intentionally out of scope: the plugin only plans deterministic files that a
|
|
4
4
|
* deploy step can then pick up.
|
|
5
5
|
*/
|
|
6
|
-
export type DeployProvider = "cloudflare-pages" | "netlify" | "vercel" | "github-pages";
|
|
6
|
+
export type DeployProvider = "cloudflare-pages" | "cloudflare-workers" | "netlify" | "vercel" | "github-pages";
|
|
7
7
|
/**
|
|
8
8
|
* A previous public path that should keep working after a permalink change.
|
|
9
9
|
* `from` is the old public path, `to` is the current permalink of the target
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-deploy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@riebeckite/core": "0.0.
|
|
17
|
+
"@riebeckite/core": "0.0.33"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"tsx": "^4.22.4"
|