@riebeckite/plugin-rename 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 +3 -3
- package/README_ja.md +6 -6
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,11 +12,11 @@ machinery.
|
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
14
|
import { defineConfig } from "@riebeckite/core";
|
|
15
|
-
import {
|
|
15
|
+
import { rename } from "@riebeckite/plugin-rename";
|
|
16
16
|
|
|
17
17
|
export default defineConfig({
|
|
18
18
|
plugins: [
|
|
19
|
-
|
|
19
|
+
rename({
|
|
20
20
|
status: 308,
|
|
21
21
|
onUnexpectedRemoval: "warning",
|
|
22
22
|
}),
|
|
@@ -104,7 +104,7 @@ history and cannot detect a rename that happened before the lock existed.
|
|
|
104
104
|
|
|
105
105
|
Functions:
|
|
106
106
|
|
|
107
|
-
- `
|
|
107
|
+
- `rename(options?)` / `rename(options?)`
|
|
108
108
|
- `diffRoutes(previous, current, options?)`
|
|
109
109
|
- `buildRouteLock(entries, isPublished)`
|
|
110
110
|
- `collapseRedirects(rules)`
|
package/README_ja.md
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
import { defineConfig } from "@riebeckite/core";
|
|
13
|
-
import {
|
|
13
|
+
import { rename } from "@riebeckite/plugin-rename";
|
|
14
14
|
|
|
15
15
|
export default defineConfig({
|
|
16
16
|
plugins: [
|
|
17
|
-
|
|
17
|
+
rename({
|
|
18
18
|
status: 308,
|
|
19
19
|
onUnexpectedRemoval: "warning",
|
|
20
20
|
}),
|
|
@@ -57,9 +57,9 @@ buildRouteLock ──► 現在の RouteLock
|
|
|
57
57
|
|
|
58
58
|
## 状態の保存
|
|
59
59
|
|
|
60
|
-
プラグインが直接ファイルを書き込むことはありません。ビルドをまたぐ状態はルートロックのみで、`context.cache` の `routes.lock`
|
|
60
|
+
プラグインが直接ファイルを書き込むことはありません。ビルドをまたぐ状態はルートロックのみで、`context.cache` の `routes.lock` キーに保存します。キャッシュは解決済みのプラグインキャッシュディレクトリ(標準的な HonoX 構成では `.riebeckite/cache`)に作られ、gitignore の対象になるため、ロックはそのマシンに限定されます。存在しない場合や壊れている場合は空のロックから再生成します。
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
ロックがそのマシンに限定されるため、新しいマシンでの初回ビルドには履歴がなく、ロックが存在する前に起きたリネームは検出できません。
|
|
63
63
|
|
|
64
64
|
## オプション
|
|
65
65
|
|
|
@@ -76,13 +76,13 @@ buildRouteLock ──► 現在の RouteLock
|
|
|
76
76
|
- 恒久的なリダイレクトのチェーンは推移的に集約します(`A → B` と `B → C` は `A → C` になる)。
|
|
77
77
|
- ロックは決定的です。ルートキーとリダイレクトをソートし、タイムスタンプや乱数を使いません。
|
|
78
78
|
- リダイレクトは毎ビルドで再適用されるため、CLI ビルドと SSG ビルドが同じリダイレクトを再現します。
|
|
79
|
-
- 増分ビルドではロックを外部依存として公開しますが、その fingerprint
|
|
79
|
+
- 増分ビルドではロックを外部依存として公開しますが、その fingerprint が対象にするのは適用済みのリダイレクトだけで、ルートの台帳は含みません。ルートの追加と削除は、content change set と redirect 出力自体を通じて、影響を受ける出力をすでに無効化します。そのため、ロックを更新しただけで、変わっていない出力が無効化されることはありません。
|
|
80
80
|
|
|
81
81
|
## エクスポート
|
|
82
82
|
|
|
83
83
|
関数のシグネチャは次のとおりです。
|
|
84
84
|
|
|
85
|
-
- `
|
|
85
|
+
- `rename(options?)` / `rename(options?)`
|
|
86
86
|
- `diffRoutes(previous, current, options?)`
|
|
87
87
|
- `buildRouteLock(entries, isPublished)`
|
|
88
88
|
- `collapseRedirects(rules)`
|
package/dist/index.d.ts
CHANGED
|
@@ -15,5 +15,4 @@ export type RenameOptions = {
|
|
|
15
15
|
* machinery (`manifest.redirects`). The only cross-build state is a JSON route
|
|
16
16
|
* lock persisted through `context.cache`; no files are written directly.
|
|
17
17
|
*/
|
|
18
|
-
export declare function
|
|
19
|
-
export declare const rename: typeof renamePlugin;
|
|
18
|
+
export declare function rename(options?: RenameOptions): RiebeckitePlugin<RenameOptions>;
|
package/dist/index.js
CHANGED
|
@@ -209,7 +209,7 @@ function isRecord(value) {
|
|
|
209
209
|
var PLUGIN_NAME = "rename";
|
|
210
210
|
var LOCK_KEY = "routes.lock";
|
|
211
211
|
var CACHE_VERSION = "1";
|
|
212
|
-
function
|
|
212
|
+
function rename(options = {}) {
|
|
213
213
|
const enabled = options.enabled ?? true;
|
|
214
214
|
const status = options.status ?? 308;
|
|
215
215
|
const onUnexpectedRemoval = options.onUnexpectedRemoval ?? "warning";
|
|
@@ -295,7 +295,6 @@ function renamePlugin(options = {}) {
|
|
|
295
295
|
}
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
|
-
var rename = renamePlugin;
|
|
299
298
|
async function writeLock(cache, lock, logger) {
|
|
300
299
|
try {
|
|
301
300
|
await cache.set(LOCK_KEY, lock);
|
|
@@ -324,6 +323,5 @@ export {
|
|
|
324
323
|
hashContent,
|
|
325
324
|
isRedirectStatus,
|
|
326
325
|
parseRouteLock,
|
|
327
|
-
rename
|
|
328
|
-
renamePlugin
|
|
326
|
+
rename
|
|
329
327
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-rename",
|
|
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"
|