@riebeckite/plugin-rename 0.0.13 → 0.0.15
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 -1
- package/README_ja.md +2 -1
- package/dist/index.js +3 -8
- package/dist/src/lock.d.ts +5 -5
- package/package.json +2 -2
package/README.md
CHANGED
package/README_ja.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// index.ts
|
|
2
2
|
import {
|
|
3
|
-
definePlugin
|
|
4
|
-
isPublished
|
|
3
|
+
definePlugin
|
|
5
4
|
} from "@riebeckite/core";
|
|
6
5
|
|
|
7
6
|
// src/lock.ts
|
|
@@ -16,10 +15,9 @@ function emptyRouteLock() {
|
|
|
16
15
|
function isRedirectStatus(value) {
|
|
17
16
|
return value === 301 || value === 302 || value === 307 || value === 308;
|
|
18
17
|
}
|
|
19
|
-
function buildRouteLock(entries
|
|
18
|
+
function buildRouteLock(entries) {
|
|
20
19
|
const routes = {};
|
|
21
20
|
for (const entry of entries) {
|
|
22
|
-
if (!isPublished2(entry.frontmatter)) continue;
|
|
23
21
|
const id = readId(entry.frontmatter);
|
|
24
22
|
routes[entry.slug] = id ? { permalink: entry.permalink, contentHash: hashContent(entry.html), id } : { permalink: entry.permalink, contentHash: hashContent(entry.html) };
|
|
25
23
|
}
|
|
@@ -243,10 +241,7 @@ function renamePlugin(options = {}) {
|
|
|
243
241
|
return;
|
|
244
242
|
}
|
|
245
243
|
const previous = await readLock(cache, logger);
|
|
246
|
-
const current = buildRouteLock(
|
|
247
|
-
manifest.entries,
|
|
248
|
-
(frontmatter) => isPublished(config, frontmatter)
|
|
249
|
-
);
|
|
244
|
+
const current = buildRouteLock(manifest.publicEntries);
|
|
250
245
|
const result = diffRoutes(previous, current, {
|
|
251
246
|
status,
|
|
252
247
|
onUnexpectedRemoval
|
package/dist/src/lock.d.ts
CHANGED
|
@@ -34,8 +34,8 @@ export type DiffRoutesOptions = {
|
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
36
|
* Minimal shape `buildRouteLock` reads from a content manifest entry. Only
|
|
37
|
-
*
|
|
38
|
-
*
|
|
37
|
+
* routable entries should reach this function so this module stays free of any
|
|
38
|
+
* runtime Core import.
|
|
39
39
|
*/
|
|
40
40
|
export type RouteLockSourceEntry = {
|
|
41
41
|
slug: string;
|
|
@@ -47,11 +47,11 @@ export declare function hashContent(html: string): string;
|
|
|
47
47
|
export declare function emptyRouteLock(): RouteLock;
|
|
48
48
|
export declare function isRedirectStatus(value: unknown): value is RedirectStatus;
|
|
49
49
|
/**
|
|
50
|
-
* Builds the current route lock from manifest
|
|
51
|
-
* slug and only
|
|
50
|
+
* Builds the current route lock from the routed manifest view. Entries are keyed by
|
|
51
|
+
* slug and only routable entries are considered. Output is deterministic:
|
|
52
52
|
* route keys are sorted and redirects (always empty here) stay sorted.
|
|
53
53
|
*/
|
|
54
|
-
export declare function buildRouteLock(entries: readonly RouteLockSourceEntry[]
|
|
54
|
+
export declare function buildRouteLock(entries: readonly RouteLockSourceEntry[]): RouteLock;
|
|
55
55
|
/**
|
|
56
56
|
* Parses a persisted lock. Returns `undefined` when the value is corrupt or
|
|
57
57
|
* uses an unknown format, so callers can fall back to an empty lock.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-rename",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
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.15"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"tsx": "^4.22.4"
|