@anywayseo/gatsby-plugin 1.0.0 → 1.1.0

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/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { getValidSource } from './utils/source';
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getValidSource = void 0;
4
+ var source_1 = require("./utils/source");
5
+ Object.defineProperty(exports, "getValidSource", { enumerable: true, get: function () { return source_1.getValidSource; } });
package/package.json CHANGED
@@ -1,23 +1,24 @@
1
1
  {
2
2
  "name": "@anywayseo/gatsby-plugin",
3
3
  "description": "Shared config for Anywayseo sites",
4
- "version": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "author": "zerg41",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
10
10
  "files": [
11
+ "index.js",
12
+ "index.d.ts",
11
13
  "gatsby-node.js",
12
14
  "gatsby-node.d.ts",
13
15
  "utils",
16
+ "types",
14
17
  "README.md",
15
18
  "LICENSE"
16
19
  ],
17
- "main": "gatsby-node.js",
18
- "types": "gatsby-node.d.ts",
19
20
  "scripts": {
20
- "clean": "rimraf utils types gatsby-node.js gatsby-node.d.ts",
21
+ "clean": "rimraf index.js index.d.ts gatsby-node.js gatsby-node.d.ts utils types",
21
22
  "build": "npm run clean && tsc",
22
23
  "prepack": "npm run build",
23
24
  "preversion": "tsc --noEmit",
@@ -34,4 +35,4 @@
34
35
  "peerDependencies": {
35
36
  "gatsby": "^5.0.0"
36
37
  }
37
- }
38
+ }
@@ -0,0 +1,27 @@
1
+ import type { IPluginRefOptions } from 'gatsby';
2
+ export type Source = 'local' | 'remote';
3
+ export interface IPluginOptions extends IPluginRefOptions {
4
+ source: Source;
5
+ strapiApiUrl?: string;
6
+ strapiAccessToken?: string;
7
+ }
8
+ export interface IGetAllStrapiPageSlugQuery {
9
+ allStrapiPage?: {
10
+ nodes: {
11
+ slug: string;
12
+ }[];
13
+ };
14
+ }
15
+ export interface IGetAllMdxPageQuery {
16
+ allMdx?: {
17
+ nodes: {
18
+ frontmatter: {
19
+ slug: string;
20
+ title: string;
21
+ };
22
+ internal: {
23
+ contentFilePath: string;
24
+ };
25
+ }[];
26
+ };
27
+ }
package/types/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import type { Source } from '../types';
2
+ export declare function getValidSource(source?: string): Source;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getValidSource = getValidSource;
4
+ function isValidSource(value) {
5
+ const validSources = ['local', 'remote'];
6
+ return validSources.includes(value);
7
+ }
8
+ function getValidSource(source) {
9
+ console.info('Selected source mode is:', source);
10
+ if (source && isValidSource(source)) {
11
+ return source;
12
+ }
13
+ console.warn('Invalid or missing GATSBY_SITE_SOURCE. Defaulting to "local".');
14
+ return 'local';
15
+ }