@payloadcms/plugin-redirects 3.0.0-canary.ff8c8fd → 3.0.1-canary.34c6cc0

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.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config, Field, SelectField } from 'payload'\n\nimport type { RedirectsPluginConfig } from './types.js'\n\nimport { redirectOptions } from './redirectTypes.js'\n\nexport { redirectOptions, redirectTypes } from './redirectTypes.js'\nexport const redirectsPlugin =\n (pluginConfig: RedirectsPluginConfig) =>\n (incomingConfig: Config): Config => {\n const redirectSelectField: SelectField = {\n name: 'type',\n type: 'select',\n label: 'Redirect Type',\n options: redirectOptions.filter((option) =>\n pluginConfig?.redirectTypes?.includes(option.value),\n ),\n required: true,\n ...(pluginConfig?.redirectTypeFieldOverride || {}),\n }\n\n const defaultFields: Field[] = [\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 ...(pluginConfig?.redirectTypes ? [redirectSelectField] : []),\n ]\n\n const redirectsCollection: CollectionConfig = {\n ...(pluginConfig?.overrides || {}),\n slug: pluginConfig?.overrides?.slug || 'redirects',\n access: {\n read: () => true,\n ...(pluginConfig?.overrides?.access || {}),\n },\n admin: {\n defaultColumns: ['from', 'to.type', 'createdAt'],\n ...(pluginConfig?.overrides?.admin || {}),\n },\n fields:\n pluginConfig?.overrides?.fields && typeof pluginConfig?.overrides?.fields === 'function'\n ? pluginConfig?.overrides.fields({ defaultFields })\n : defaultFields,\n }\n\n return {\n ...incomingConfig,\n collections: [...(incomingConfig?.collections || []), redirectsCollection],\n }\n }\n"],"names":["redirectOptions","redirectTypes","redirectsPlugin","pluginConfig","incomingConfig","redirectSelectField","name","type","label","options","filter","option","includes","value","required","redirectTypeFieldOverride","defaultFields","index","fields","admin","layout","defaultValue","condition","_","siblingData","relationTo","collections","redirectsCollection","overrides","slug","access","read","defaultColumns"],"mappings":"AAIA,SAASA,eAAe,QAAQ,qBAAoB;AAEpD,SAASA,eAAe,EAAEC,aAAa,QAAQ,qBAAoB;AACnE,OAAO,MAAMC,kBACX,CAACC,eACD,CAACC;QACC,MAAMC,sBAAmC;YACvCC,MAAM;YACNC,MAAM;YACNC,OAAO;YACPC,SAAST,gBAAgBU,MAAM,CAAC,CAACC,SAC/BR,cAAcF,eAAeW,SAASD,OAAOE,KAAK;YAEpDC,UAAU;YACV,GAAIX,cAAcY,6BAA6B,CAAC,CAAC;QACnD;QAEA,MAAMC,gBAAyB;YAC7B;gBACEV,MAAM;gBACNC,MAAM;gBACNU,OAAO;gBACPT,OAAO;gBACPM,UAAU;YACZ;YACA;gBACER,MAAM;gBACNC,MAAM;gBACNW,QAAQ;oBACN;wBACEZ,MAAM;wBACNC,MAAM;wBACNY,OAAO;4BACLC,QAAQ;wBACV;wBACAC,cAAc;wBACdb,OAAO;wBACPC,SAAS;4BACP;gCACED,OAAO;gCACPK,OAAO;4BACT;4BACA;gCACEL,OAAO;gCACPK,OAAO;4BACT;yBACD;oBACH;oBACA;wBACEP,MAAM;wBACNC,MAAM;wBACNY,OAAO;4BACLG,WAAW,CAACC,GAAGC,cAAgBA,aAAajB,SAAS;wBACvD;wBACAC,OAAO;wBACPiB,YAAYtB,cAAcuB,eAAe,EAAE;wBAC3CZ,UAAU;oBACZ;oBACA;wBACER,MAAM;wBACNC,MAAM;wBACNY,OAAO;4BACLG,WAAW,CAACC,GAAGC,cAAgBA,aAAajB,SAAS;wBACvD;wBACAC,OAAO;wBACPM,UAAU;oBACZ;iBACD;gBACDN,OAAO;YACT;eACIL,cAAcF,gBAAgB;gBAACI;aAAoB,GAAG,EAAE;SAC7D;QAED,MAAMsB,sBAAwC;YAC5C,GAAIxB,cAAcyB,aAAa,CAAC,CAAC;YACjCC,MAAM1B,cAAcyB,WAAWC,QAAQ;YACvCC,QAAQ;gBACNC,MAAM,IAAM;gBACZ,GAAI5B,cAAcyB,WAAWE,UAAU,CAAC,CAAC;YAC3C;YACAX,OAAO;gBACLa,gBAAgB;oBAAC;oBAAQ;oBAAW;iBAAY;gBAChD,GAAI7B,cAAcyB,WAAWT,SAAS,CAAC,CAAC;YAC1C;YACAD,QACEf,cAAcyB,WAAWV,UAAU,OAAOf,cAAcyB,WAAWV,WAAW,aAC1Ef,cAAcyB,UAAUV,OAAO;gBAAEF;YAAc,KAC/CA;QACR;QAEA,OAAO;YACL,GAAGZ,cAAc;YACjBsB,aAAa;mBAAKtB,gBAAgBsB,eAAe,EAAE;gBAAGC;aAAoB;QAC5E;IACF,EAAC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config, Field, SelectField } from 'payload'\n\nimport type { RedirectsPluginConfig } from './types.js'\n\nimport { redirectOptions } from './redirectTypes.js'\n\nexport { redirectOptions, redirectTypes } from './redirectTypes.js'\nexport const redirectsPlugin =\n (pluginConfig: RedirectsPluginConfig) =>\n (incomingConfig: Config): Config => {\n const redirectSelectField: SelectField = {\n name: 'type',\n type: 'select',\n label: 'Redirect Type',\n options: redirectOptions.filter((option) =>\n pluginConfig?.redirectTypes?.includes(option.value),\n ),\n required: true,\n ...((pluginConfig?.redirectTypeFieldOverride || {}) as SelectField),\n }\n\n const defaultFields: Field[] = [\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 ...(pluginConfig?.redirectTypes ? [redirectSelectField] : []),\n ]\n\n const redirectsCollection: CollectionConfig = {\n ...(pluginConfig?.overrides || {}),\n slug: pluginConfig?.overrides?.slug || 'redirects',\n access: {\n read: () => true,\n ...(pluginConfig?.overrides?.access || {}),\n },\n admin: {\n defaultColumns: ['from', 'to.type', 'createdAt'],\n ...(pluginConfig?.overrides?.admin || {}),\n },\n fields:\n pluginConfig?.overrides?.fields && typeof pluginConfig?.overrides?.fields === 'function'\n ? pluginConfig?.overrides.fields({ defaultFields })\n : defaultFields,\n }\n\n return {\n ...incomingConfig,\n collections: [...(incomingConfig?.collections || []), redirectsCollection],\n }\n }\n"],"names":["redirectOptions","redirectTypes","redirectsPlugin","pluginConfig","incomingConfig","redirectSelectField","name","type","label","options","filter","option","includes","value","required","redirectTypeFieldOverride","defaultFields","index","fields","admin","layout","defaultValue","condition","_","siblingData","relationTo","collections","redirectsCollection","overrides","slug","access","read","defaultColumns"],"mappings":"AAIA,SAASA,eAAe,QAAQ,qBAAoB;AAEpD,SAASA,eAAe,EAAEC,aAAa,QAAQ,qBAAoB;AACnE,OAAO,MAAMC,kBACX,CAACC,eACD,CAACC;QACC,MAAMC,sBAAmC;YACvCC,MAAM;YACNC,MAAM;YAC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cyB,WAAWV,WAAW,aAC1Ef,cAAcyB,UAAUV,OAAO;gBAAEF;YAAc,KAC/CA;QACR;QAEA,OAAO;YACL,GAAGZ,cAAc;YACjBsB,aAAa;mBAAKtB,gBAAgBsB,eAAe,EAAE;gBAAGC;aAAoB;QAC5E;IACF,EAAC"}
package/license.md ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018-2024 Payload CMS, Inc. <info@payloadcms.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-redirects",
3
- "version": "3.0.0-canary.ff8c8fd",
3
+ "version": "3.0.1-canary.34c6cc0",
4
4
  "description": "Redirects plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -18,6 +18,13 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
21
+ "maintainers": [
22
+ {
23
+ "name": "Payload",
24
+ "email": "info@payloadcms.com",
25
+ "url": "https://payloadcms.com"
26
+ }
27
+ ],
21
28
  "type": "module",
22
29
  "exports": {
23
30
  ".": {
@@ -39,25 +46,20 @@
39
46
  "types.d.ts"
40
47
  ],
41
48
  "devDependencies": {
42
- "@types/express": "^4.17.9",
43
- "@types/react": "npm:types-react@19.0.0-rc.0",
44
- "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
45
- "payload": "3.0.0-canary.ff8c8fd",
46
- "@payloadcms/eslint-config": "3.0.0-beta.59"
49
+ "@payloadcms/eslint-config": "3.0.0-beta.112",
50
+ "payload": "3.0.1-canary.34c6cc0"
47
51
  },
48
52
  "peerDependencies": {
49
- "payload": "3.0.0-canary.ff8c8fd"
53
+ "payload": "3.0.1-canary.34c6cc0"
50
54
  },
51
55
  "homepage:": "https://payloadcms.com",
52
- "overrides": {
53
- "@types/react": "npm:types-react@19.0.0-rc.0",
54
- "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0"
55
- },
56
56
  "scripts": {
57
57
  "build": "pnpm copyfiles && pnpm build:types && pnpm build:swc",
58
58
  "build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
59
59
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
60
60
  "clean": "rimraf {dist,*.tsbuildinfo}",
61
- "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/"
61
+ "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
62
+ "lint": "eslint .",
63
+ "lint:fix": "eslint . --fix"
62
64
  }
63
65
  }