@payloadcms/plugin-redirects 4.0.0-internal.bc5cf8c → 4.0.0-internal.c7d5de4
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/LICENSE.md +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/redirectTypes.d.ts +1 -1
- package/dist/redirectTypes.d.ts.map +1 -1
- package/package.json +4 -4
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2018-
|
|
3
|
+
Copyright (c) 2018-2026 Payload CMS, LLC <info@payloadcms.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Config } from 'payload';
|
|
2
1
|
import type { RedirectsPluginConfig } from './types.js';
|
|
3
2
|
export { redirectOptions, redirectTypes } from './redirectTypes.js';
|
|
4
3
|
export { translations as redirectsTranslations } from './translations/index.js';
|
|
5
|
-
export declare const redirectsPlugin: (
|
|
4
|
+
export declare const redirectsPlugin: (options: RedirectsPluginConfig) => import("payload").Plugin;
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAKvD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/E,eAAO,MAAM,eAAe,8DAoH1B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { definePlugin } from 'payload';
|
|
1
2
|
import { deepMergeSimple } from 'payload/shared';
|
|
2
3
|
import { redirectOptions } from './redirectTypes.js';
|
|
3
4
|
import { translations } from './translations/index.js';
|
|
4
5
|
export { redirectOptions, redirectTypes } from './redirectTypes.js';
|
|
5
6
|
export { translations as redirectsTranslations } from './translations/index.js';
|
|
6
|
-
export const redirectsPlugin = (
|
|
7
|
+
export const redirectsPlugin = definePlugin({
|
|
8
|
+
slug: '@payloadcms/plugin-redirects',
|
|
9
|
+
plugin: ({ config: incomingConfig, options: pluginConfig })=>{
|
|
7
10
|
// Merge translations FIRST (before building fields)
|
|
8
11
|
if (!incomingConfig.i18n) {
|
|
9
12
|
incomingConfig.i18n = {};
|
|
@@ -111,6 +114,7 @@ export const redirectsPlugin = (pluginConfig)=>(incomingConfig)=>{
|
|
|
111
114
|
redirectsCollection
|
|
112
115
|
]
|
|
113
116
|
};
|
|
114
|
-
}
|
|
117
|
+
}
|
|
118
|
+
});
|
|
115
119
|
|
|
116
120
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Field, SelectField } from 'payload'\n\nimport { definePlugin } from 'payload'\nimport { deepMergeSimple } from 'payload/shared'\n\nimport type { RedirectsPluginConfig } from './types.js'\n\nimport { redirectOptions } from './redirectTypes.js'\nimport { translations } from './translations/index.js'\n\nexport { redirectOptions, redirectTypes } from './redirectTypes.js'\nexport { translations as redirectsTranslations } from './translations/index.js'\nexport const redirectsPlugin = definePlugin<RedirectsPluginConfig>({\n slug: '@payloadcms/plugin-redirects',\n plugin: ({ config: incomingConfig, options: pluginConfig }) => {\n // Merge translations FIRST (before building fields)\n if (!incomingConfig.i18n) {\n incomingConfig.i18n = {}\n }\n\n if (!incomingConfig.i18n?.translations) {\n incomingConfig.i18n.translations = {}\n }\n\n incomingConfig.i18n.translations = deepMergeSimple(\n translations,\n incomingConfig.i18n?.translations,\n )\n\n const redirectSelectField: SelectField = {\n name: 'type',\n type: 'select',\n // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:redirectType'),\n options: redirectOptions.filter((option) =>\n pluginConfig?.redirectTypes?.includes(option.value),\n ),\n required: true,\n ...((pluginConfig?.redirectTypeFieldOverride || {}) as {\n hasMany: boolean\n } & Partial<SelectField>),\n }\n\n const defaultFields: Field[] = [\n {\n name: 'from',\n type: 'text',\n index: true,\n // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:fromUrl'),\n required: true,\n unique: 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 // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:toUrlType'),\n options: [\n {\n // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:internalLink'),\n value: 'reference',\n },\n {\n // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:customUrl'),\n value: 'custom',\n },\n ],\n },\n {\n name: 'reference',\n type: 'relationship',\n admin: {\n condition: (_, siblingData) => siblingData?.type === 'reference',\n },\n // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:documentToRedirect'),\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 // @ts-expect-error - translations are not typed in plugins yet\n label: ({ t }) => t('plugin-redirects:customUrl'),\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})\n"],"names":["definePlugin","deepMergeSimple","redirectOptions","translations","redirectTypes","redirectsTranslations","redirectsPlugin","slug","plugin","config","incomingConfig","options","pluginConfig","i18n","redirectSelectField","name","type","label","t","filter","option","includes","value","required","redirectTypeFieldOverride","defaultFields","index","unique","fields","admin","layout","defaultValue","condition","_","siblingData","relationTo","collections","redirectsCollection","overrides","access","read","defaultColumns"],"mappings":"AAEA,SAASA,YAAY,QAAQ,UAAS;AACtC,SAASC,eAAe,QAAQ,iBAAgB;AAIhD,SAASC,eAAe,QAAQ,qBAAoB;AACpD,SAASC,YAAY,QAAQ,0BAAyB;AAEtD,SAASD,eAAe,EAAEE,aAAa,QAAQ,qBAAoB;AACnE,SAASD,gBAAgBE,qBAAqB,QAAQ,0BAAyB;AAC/E,OAAO,MAAMC,kBAAkBN,aAAoC;IACjEO,MAAM;IACNC,QAAQ,CAAC,EAAEC,QAAQC,cAAc,EAAEC,SAASC,YAAY,EAAE;QACxD,oDAAoD;QACpD,IAAI,CAACF,eAAeG,IAAI,EAAE;YACxBH,eAAeG,IAAI,GAAG,CAAC;QACzB;QAEA,IAAI,CAACH,eAAeG,IAAI,EAAEV,cAAc;YACtCO,eAAeG,IAAI,CAACV,YAAY,GAAG,CAAC;QACtC;QAEAO,eAAeG,IAAI,CAACV,YAAY,GAAGF,gBACjC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AO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;wBACpBK,UAAU;oBACZ;iBACD;gBACDN,OAAO;YACT;eACIL,cAAcR,gBAAgB;gBAACU;aAAoB,GAAG,EAAE;SAC7D;QAED,MAAMuB,sBAAwC;YAC5C,GAAIzB,cAAc0B,aAAa,CAAC,CAAC;YACjC/B,MAAMK,cAAc0B,WAAW/B,QAAQ;YACvCgC,QAAQ;gBACNC,MAAM,IAAM;gBACZ,GAAI5B,cAAc0B,WAAWC,UAAU,CAAC,CAAC;YAC3C;YACAV,OAAO;gBACLY,gBAAgB;oBAAC;oBAAQ;oBAAW;iBAAY;gBAChD,GAAI7B,cAAc0B,WAAWT,SAAS,CAAC,CAAC;YAC1C;YACAD,QACEhB,cAAc0B,WAAWV,UAAU,OAAOhB,cAAc0B,WAAWV,WAAW,aAC1EhB,cAAc0B,UAAUV,OAAO;gBAAEH;YAAc,KAC/CA;QACR;QAEA,OAAO;YACL,GAAGf,cAAc;YACjB0B,aAAa;mBAAK1B,gBAAgB0B,eAAe,EAAE;gBAAGC;aAAoB;QAC5E;IACF;AACF,GAAE"}
|
package/dist/redirectTypes.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirectTypes.d.ts","sourceRoot":"","sources":["../src/redirectTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"redirectTypes.d.ts","sourceRoot":"","sources":["../src/redirectTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,YAAI,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;AAEzE,eAAO,MAAM,eAAe,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;CAAE,EAqBrF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-redirects",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.c7d5de4",
|
|
4
4
|
"description": "Redirects plugin for Payload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
"types.d.ts"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@payloadcms/translations": "4.0.0-internal.
|
|
51
|
-
"payload": "4.0.0-internal.
|
|
50
|
+
"@payloadcms/translations": "4.0.0-internal.c7d5de4",
|
|
51
|
+
"payload": "4.0.0-internal.c7d5de4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@payloadcms/eslint-config": "3.28.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"payload": "4.0.0-internal.
|
|
57
|
+
"payload": "4.0.0-internal.c7d5de4"
|
|
58
58
|
},
|
|
59
59
|
"homepage:": "https://payloadcms.com",
|
|
60
60
|
"scripts": {
|