@payloadcms/plugin-redirects 3.0.0-alpha.48 → 3.0.0-alpha.50

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Config } from 'payload/config';
2
2
  import type { PluginConfig } from './types.js';
3
3
  declare const redirects: (pluginConfig: PluginConfig) => (incomingConfig: Config) => Config;
4
- export default redirects;
4
+ export { redirects };
5
5
  //# 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,eAAe,SAAS,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,YAAY,EAAE,MAAM,YAAY,CAAA;AAI9C,QAAA,MAAM,SAAS,iBACE,YAAY,sBACV,MAAM,KAAG,MAuExB,CAAA;AAEJ,OAAO,EAAE,SAAS,EAAE,CAAA"}
package/dist/index.js CHANGED
@@ -72,6 +72,6 @@ const redirects = (pluginConfig)=>(incomingConfig)=>({
72
72
  }, pluginConfig?.overrides || {})
73
73
  ]
74
74
  });
75
- export default redirects;
75
+ export { redirects };
76
76
 
77
77
  //# 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 default 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"],"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,eAAevB,UAAS"}
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"],"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"}
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-redirects",
3
- "version": "3.0.0-alpha.48",
3
+ "version": "3.0.0-alpha.50",
4
4
  "homepage:": "https://payloadcms.com",
5
- "repository": "git@github.com:payloadcms/plugin-redirects.git",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/payloadcms/payload.git",
8
+ "directory": "packages/plugin-redirects"
9
+ },
6
10
  "description": "Redirects plugin for Payload",
7
11
  "main": "./dist/index.js",
8
12
  "types": "./dist/index.d.ts",
@@ -19,18 +23,21 @@
19
23
  "author": "dev@payloadcms.com",
20
24
  "license": "MIT",
21
25
  "peerDependencies": {
22
- "payload": "3.0.0-alpha.48"
26
+ "payload": "3.0.0-alpha.50"
23
27
  },
24
28
  "devDependencies": {
25
29
  "@types/express": "^4.17.9",
26
30
  "@types/react": "18.0.21",
27
31
  "react": "^18.0.0",
28
- "@payloadcms/eslint-config": "1.1.1",
29
- "payload": "3.0.0-alpha.48"
32
+ "payload": "3.0.0-alpha.50",
33
+ "@payloadcms/eslint-config": "1.1.1"
30
34
  },
31
- "exports": null,
32
- "publishConfig": {
33
- "registry": "https://registry.npmjs.org/"
35
+ "exports": {
36
+ ".": {
37
+ "import": "./dist/index.js",
38
+ "require": "./dist/index.js",
39
+ "types": "./dist/index.d.ts"
40
+ }
34
41
  },
35
42
  "files": [
36
43
  "dist",
package/src/index.ts ADDED
@@ -0,0 +1,82 @@
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 }