@erudit-js/core 4.3.2 → 4.3.3

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.
@@ -12,6 +12,7 @@ import type { EruditContributors } from '../contributor.js';
12
12
  import type { EruditAsideMajor } from './asideMajor.js';
13
13
  import type { EruditFavicons } from './favicons.js';
14
14
  import type { EruditDependencies } from '../dependencies.js';
15
+ import type { EruditLastmod } from './lastmod.js';
15
16
  export interface EruditConfig {
16
17
  language?: EruditLanguage;
17
18
  debug?: EruditDebug;
@@ -29,6 +30,7 @@ export interface EruditConfig {
29
30
  sponsors?: EruditSponsors;
30
31
  seo?: EruditSeo;
31
32
  repository?: EruditRepository;
33
+ lastmod?: EruditLastmod;
32
34
  elements?: string[];
33
35
  countElements?: (string | string[])[];
34
36
  problemChecks?: string[];
@@ -3,7 +3,6 @@ export interface EruditDebug {
3
3
  slowTransition?: boolean;
4
4
  fakeApi?: Partial<{
5
5
  repository: boolean;
6
- lastChanged: boolean | string;
7
6
  }>;
8
7
  ads?: boolean;
9
8
  analytics?: boolean;
@@ -0,0 +1,35 @@
1
+ import type { EruditMode } from '../mode.js';
2
+ export interface LastmodProviderContext {
3
+ /** Content item full ID, e.g. `"test/my-topic"`. */
4
+ fullId: string;
5
+ /** Current erudit mode. */
6
+ mode: EruditMode;
7
+ /** Absolute path to the project root directory. */
8
+ projectPath: string;
9
+ }
10
+ /**
11
+ * Custom lastmod provider function.
12
+ * Called for each content item during build.
13
+ * Return a `Date` for the item's last modification time,
14
+ * or `undefined` to skip.
15
+ */
16
+ export type LastmodProvider = (context: LastmodProviderContext) => Date | undefined | Promise<Date | undefined>;
17
+ export interface EruditLastmodBase {
18
+ /** Whether lastmod collection is enabled. @default true */
19
+ enabled?: boolean;
20
+ }
21
+ export interface EruditLastmodGit extends EruditLastmodBase {
22
+ type: 'git';
23
+ }
24
+ export interface EruditLastmodCustom extends EruditLastmodBase {
25
+ type: 'custom';
26
+ /**
27
+ * Path to a file (relative to project root) whose default export
28
+ * is a {@link LastmodProvider} function.
29
+ * Resolved the same way as `problemChecks` and `elements`.
30
+ *
31
+ * @example './my-lastmod'
32
+ */
33
+ scriptPath: string;
34
+ }
35
+ export type EruditLastmod = EruditLastmodGit | EruditLastmodCustom;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erudit-js/core",
3
- "version": "4.3.2",
3
+ "version": "4.3.3",
4
4
  "type": "module",
5
5
  "description": "Erudit core essentials",
6
6
  "exports": {