@payloadcms/plugin-redirects 3.0.0-beta.9 → 3.0.0-canary.f6e77b8

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.
@@ -0,0 +1,2 @@
1
+ export type { RedirectsPluginConfig } from '../types.js';
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/exports/types.ts"],"sourcesContent":["export type { RedirectsPluginConfig } from '../types.js'\n"],"names":[],"rangeMappings":"","mappings":"AAAA,WAAwD"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type { Config } from 'payload/config';
2
- import type { PluginConfig } from './types.js';
3
- declare const redirects: (pluginConfig: PluginConfig) => (incomingConfig: Config) => Config;
4
- export { redirects };
2
+ import type { RedirectsPluginConfig } from './types.js';
3
+ export declare const redirectsPlugin: (pluginConfig: RedirectsPluginConfig) => (incomingConfig: Config) => Config;
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAI9C,QAAA,MAAM,SAAS,iBACE,YAAY,sBACV,MAAM,KAAG,MAuExB,CAAA;AAEJ,OAAO,EAAE,SAAS,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAIvD,eAAO,MAAM,eAAe,iBACX,qBAAqB,sBACnB,MAAM,KAAG,MAuExB,CAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import deepMerge from './deepMerge.js';
2
- const redirects = (pluginConfig)=>(incomingConfig)=>({
2
+ export const redirectsPlugin = (pluginConfig)=>(incomingConfig)=>({
3
3
  ...incomingConfig,
4
4
  collections: [
5
5
  ...incomingConfig?.collections || [],
@@ -72,6 +72,5 @@ const redirects = (pluginConfig)=>(incomingConfig)=>({
72
72
  }, pluginConfig?.overrides || {})
73
73
  ]
74
74
  });
75
- export { redirects };
76
75
 
77
76
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from 'payload/config'\n\nimport type { PluginConfig } from './types.js'\n\nimport deepMerge from './deepMerge.js'\n\nconst redirects =\n (pluginConfig: PluginConfig) =>\n (incomingConfig: Config): Config => ({\n ...incomingConfig,\n collections: [\n ...(incomingConfig?.collections || []),\n deepMerge(\n {\n slug: 'redirects',\n access: {\n read: (): boolean => true,\n },\n admin: {\n defaultColumns: ['from', 'to.type', 'createdAt'],\n },\n fields: [\n {\n name: 'from',\n type: 'text',\n index: true,\n label: 'From URL',\n required: true,\n },\n {\n name: 'to',\n type: 'group',\n fields: [\n {\n name: 'type',\n type: 'radio',\n admin: {\n layout: 'horizontal',\n },\n defaultValue: 'reference',\n label: 'To URL Type',\n options: [\n {\n label: 'Internal link',\n value: 'reference',\n },\n {\n label: 'Custom URL',\n value: 'custom',\n },\n ],\n },\n {\n name: 'reference',\n type: 'relationship',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'reference',\n },\n label: 'Document to redirect to',\n relationTo: pluginConfig?.collections || [],\n required: true,\n },\n {\n name: 'url',\n type: 'text',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'custom',\n },\n label: 'Custom URL',\n required: true,\n },\n ],\n label: false,\n },\n ],\n },\n pluginConfig?.overrides || {},\n ),\n ],\n })\n\nexport { redirects }\n"],"names":["deepMerge","redirects","pluginConfig","incomingConfig","collections","slug","access","read","admin","defaultColumns","fields","name","type","index","label","required","layout","defaultValue","options","value","condition","_","siblingData","relationTo","overrides"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,OAAOA,eAAe,iBAAgB;AAEtC,MAAMC,YACJ,CAACC,eACD,CAACC,iBAAoC,CAAA;YACnC,GAAGA,cAAc;YACjBC,aAAa;mBACPD,gBAAgBC,eAAe,EAAE;gBACrCJ,UACE;oBACEK,MAAM;oBACNC,QAAQ;wBACNC,MAAM,IAAe;oBACvB;oBACAC,OAAO;wBACLC,gBAAgB;4BAAC;4BAAQ;4BAAW;yBAAY;oBAClD;oBACAC,QAAQ;wBACN;4BACEC,MAAM;4BACNC,MAAM;4BACNC,OAAO;4BACPC,OAAO;4BACPC,UAAU;wBACZ;wBACA;4BACEJ,MAAM;4BACNC,MAAM;4BACNF,QAAQ;gCACN;oCACEC,MAAM;oCACNC,MAAM;oCACNJ,OAAO;wCACLQ,QAAQ;oCACV;oCACAC,cAAc;oCACdH,OAAO;oCACPI,SAAS;wCACP;4CACEJ,OAAO;4CACPK,OAAO;wCACT;wCACA;4CACEL,OAAO;4CACPK,OAAO;wCACT;qCACD;gCACH;gCACA;oCACER,MAAM;oCACNC,MAAM;oCACNJ,OAAO;wCACLY,WAAW,CAACC,GAAGC,cAAgBA,aAAaV,SAAS;oCACvD;oCACAE,OAAO;oCACPS,YAAYrB,cAAcE,eAAe,EAAE;oCAC3CW,UAAU;gCACZ;gCACA;oCACEJ,MAAM;oCACNC,MAAM;oCACNJ,OAAO;wCACLY,WAAW,CAACC,GAAGC,cAAgBA,aAAaV,SAAS;oCACvD;oCACAE,OAAO;oCACPC,UAAU;gCACZ;6BACD;4BACDD,OAAO;wBACT;qBACD;gBACH,GACAZ,cAAcsB,aAAa,CAAC;aAE/B;QACH,CAAA;AAEF,SAASvB,SAAS,GAAE"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from 'payload/config'\n\nimport type { RedirectsPluginConfig } from './types.js'\n\nimport deepMerge from './deepMerge.js'\n\nexport const redirectsPlugin =\n (pluginConfig: RedirectsPluginConfig) =>\n (incomingConfig: Config): Config => ({\n ...incomingConfig,\n collections: [\n ...(incomingConfig?.collections || []),\n deepMerge(\n {\n slug: 'redirects',\n access: {\n read: (): boolean => true,\n },\n admin: {\n defaultColumns: ['from', 'to.type', 'createdAt'],\n },\n fields: [\n {\n name: 'from',\n type: 'text',\n index: true,\n label: 'From URL',\n required: true,\n },\n {\n name: 'to',\n type: 'group',\n fields: [\n {\n name: 'type',\n type: 'radio',\n admin: {\n layout: 'horizontal',\n },\n defaultValue: 'reference',\n label: 'To URL Type',\n options: [\n {\n label: 'Internal link',\n value: 'reference',\n },\n {\n label: 'Custom URL',\n value: 'custom',\n },\n ],\n },\n {\n name: 'reference',\n type: 'relationship',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'reference',\n },\n label: 'Document to redirect to',\n relationTo: pluginConfig?.collections || [],\n required: true,\n },\n {\n name: 'url',\n type: 'text',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'custom',\n },\n label: 'Custom URL',\n required: true,\n },\n ],\n label: false,\n },\n ],\n },\n pluginConfig?.overrides || {},\n ),\n ],\n })\n"],"names":["deepMerge","redirectsPlugin","pluginConfig","incomingConfig","collections","slug","access","read","admin","defaultColumns","fields","name","type","index","label","required","layout","defaultValue","options","value","condition","_","siblingData","relationTo","overrides"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,OAAOA,eAAe,iBAAgB;AAEtC,OAAO,MAAMC,kBACX,CAACC,eACD,CAACC,iBAAoC,CAAA;YACnC,GAAGA,cAAc;YACjBC,aAAa;mBACPD,gBAAgBC,eAAe,EAAE;gBACrCJ,UACE;oBACEK,MAAM;oBACNC,QAAQ;wBACNC,MAAM,IAAe;oBACvB;oBACAC,OAAO;wBACLC,gBAAgB;4BAAC;4BAAQ;4BAAW;yBAAY;oBAClD;oBACAC,QAAQ;wBACN;4BACEC,MAAM;4BACNC,MAAM;4BACNC,OAAO;4BACPC,OAAO;4BACPC,UAAU;wBACZ;wBACA;4BACEJ,MAAM;4BACNC,MAAM;4BACNF,QAAQ;gCACN;oCACEC,MAAM;oCACNC,MAAM;oCACNJ,OAAO;wCACLQ,QAAQ;oCACV;oCACAC,cAAc;oCACdH,OAAO;oCACPI,SAAS;wCACP;4CACEJ,OAAO;4CACPK,OAAO;wCACT;wCACA;4CACEL,OAAO;4CACPK,OAAO;wCACT;qCACD;gCACH;gCACA;oCACER,MAAM;oCACNC,MAAM;oCACNJ,OAAO;wCACLY,WAAW,CAACC,GAAGC,cAAgBA,aAAaV,SAAS;oCACvD;oCACAE,OAAO;oCACPS,YAAYrB,cAAcE,eAAe,EAAE;oCAC3CW,UAAU;gCACZ;gCACA;oCACEJ,MAAM;oCACNC,MAAM;oCACNJ,OAAO;wCACLY,WAAW,CAACC,GAAGC,cAAgBA,aAAaV,SAAS;oCACvD;oCACAE,OAAO;oCACPC,UAAU;gCACZ;6BACD;4BACDD,OAAO;wBACT;qBACD;gBACH,GACAZ,cAAcsB,aAAa,CAAC;aAE/B;QACH,CAAA,EAAE"}
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { CollectionConfig } from 'payload/types';
2
- export interface PluginConfig {
2
+ export type RedirectsPluginConfig = {
3
3
  collections?: string[];
4
4
  overrides?: Partial<CollectionConfig>;
5
- }
5
+ };
6
6
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;CACtC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;CACtC,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload/types'\n\nexport interface PluginConfig {\n collections?: string[]\n overrides?: Partial<CollectionConfig>\n}\n"],"names":[],"rangeMappings":"","mappings":"AAEA,WAGC"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload/types'\n\nexport type RedirectsPluginConfig = {\n collections?: string[]\n overrides?: Partial<CollectionConfig>\n}\n"],"names":[],"rangeMappings":"","mappings":"AAEA,WAGC"}
package/package.json CHANGED
@@ -1,16 +1,7 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-redirects",
3
- "version": "3.0.0-beta.9",
4
- "homepage:": "https://payloadcms.com",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://github.com/payloadcms/payload.git",
8
- "directory": "packages/plugin-redirects"
9
- },
3
+ "version": "3.0.0-canary.f6e77b8",
10
4
  "description": "Redirects plugin for Payload",
11
- "main": "./dist/index.js",
12
- "types": "./dist/index.d.ts",
13
- "type": "module",
14
5
  "keywords": [
15
6
  "payload",
16
7
  "cms",
@@ -20,30 +11,43 @@
20
11
  "redirects",
21
12
  "nextjs"
22
13
  ],
23
- "author": "dev@payloadcms.com",
24
- "license": "MIT",
25
- "peerDependencies": {
26
- "payload": "3.0.0-beta.9"
27
- },
28
- "devDependencies": {
29
- "@types/express": "^4.17.9",
30
- "@types/react": "18.2.74",
31
- "react": "^18.0.0",
32
- "@payloadcms/eslint-config": "1.1.1",
33
- "payload": "3.0.0-beta.9"
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/payloadcms/payload.git",
17
+ "directory": "packages/plugin-redirects"
34
18
  },
19
+ "license": "MIT",
20
+ "author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
21
+ "type": "module",
35
22
  "exports": {
36
23
  ".": {
37
24
  "import": "./dist/index.js",
38
25
  "require": "./dist/index.js",
39
26
  "types": "./dist/index.d.ts"
27
+ },
28
+ "./*": {
29
+ "import": "./dist/exports/*.js",
30
+ "require": "./dist/exports/*.js",
31
+ "types": "./dist/exports/*.d.ts"
40
32
  }
41
33
  },
34
+ "main": "./dist/index.js",
35
+ "types": "./dist/index.d.ts",
42
36
  "files": [
43
37
  "dist",
44
38
  "types.js",
45
39
  "types.d.ts"
46
40
  ],
41
+ "devDependencies": {
42
+ "@types/express": "^4.17.9",
43
+ "@types/react": "18.2.74",
44
+ "@payloadcms/eslint-config": "1.1.1",
45
+ "payload": "3.0.0-canary.f6e77b8"
46
+ },
47
+ "peerDependencies": {
48
+ "payload": "3.0.0-canary.f6e77b8"
49
+ },
50
+ "homepage:": "https://payloadcms.com",
47
51
  "scripts": {
48
52
  "build": "pnpm copyfiles && pnpm build:swc && pnpm build:types",
49
53
  "build:swc": "swc ./src -d ./dist --config-file .swcrc",
package/src/index.ts DELETED
@@ -1,82 +0,0 @@
1
- import type { Config } from 'payload/config'
2
-
3
- import type { PluginConfig } from './types.js'
4
-
5
- import deepMerge from './deepMerge.js'
6
-
7
- const redirects =
8
- (pluginConfig: PluginConfig) =>
9
- (incomingConfig: Config): Config => ({
10
- ...incomingConfig,
11
- collections: [
12
- ...(incomingConfig?.collections || []),
13
- deepMerge(
14
- {
15
- slug: 'redirects',
16
- access: {
17
- read: (): boolean => true,
18
- },
19
- admin: {
20
- defaultColumns: ['from', 'to.type', 'createdAt'],
21
- },
22
- fields: [
23
- {
24
- name: 'from',
25
- type: 'text',
26
- index: true,
27
- label: 'From URL',
28
- required: true,
29
- },
30
- {
31
- name: 'to',
32
- type: 'group',
33
- fields: [
34
- {
35
- name: 'type',
36
- type: 'radio',
37
- admin: {
38
- layout: 'horizontal',
39
- },
40
- defaultValue: 'reference',
41
- label: 'To URL Type',
42
- options: [
43
- {
44
- label: 'Internal link',
45
- value: 'reference',
46
- },
47
- {
48
- label: 'Custom URL',
49
- value: 'custom',
50
- },
51
- ],
52
- },
53
- {
54
- name: 'reference',
55
- type: 'relationship',
56
- admin: {
57
- condition: (_, siblingData) => siblingData?.type === 'reference',
58
- },
59
- label: 'Document to redirect to',
60
- relationTo: pluginConfig?.collections || [],
61
- required: true,
62
- },
63
- {
64
- name: 'url',
65
- type: 'text',
66
- admin: {
67
- condition: (_, siblingData) => siblingData?.type === 'custom',
68
- },
69
- label: 'Custom URL',
70
- required: true,
71
- },
72
- ],
73
- label: false,
74
- },
75
- ],
76
- },
77
- pluginConfig?.overrides || {},
78
- ),
79
- ],
80
- })
81
-
82
- export { redirects }