@vuepress/plugin-replace-assets 2.0.0-rc.128 → 2.0.0-rc.130

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.
@@ -4,10 +4,12 @@ import { Plugin } from "vuepress/core";
4
4
  //#region src/node/types.d.ts
5
5
  /**
6
6
  * Assets Replacement Target Path
7
+ *
7
8
  * - `string`: Directly concatenated before the original path
8
9
  * - `(url) => string`: Custom replacement method, returns the new path
9
10
  *
10
11
  * 资源替换目标路径
12
+ *
11
13
  * - `string`: 直接拼接在原始路径前面
12
14
  * - `(url) => string`: 自定义替换方法,返回新路径
13
15
  */
@@ -23,38 +25,39 @@ interface ReplacementRule {
23
25
  *
24
26
  * - `RegExp`: Match using regular expression
25
27
  * - `string`: Match using string
26
- * - Strings starting with `^` or ending with `$` are automatically converted to regular expressions
28
+ *
29
+ * - Strings starting with `^` or ending with `$` are automatically converted to
30
+ * regular expressions
27
31
  * - For ordinary strings, checks if they appear at the start or end
28
32
  *
29
33
  * 资源匹配
30
34
  *
31
35
  * - `RegExp`: 匹配正则
32
36
  * - `string`: 匹配字符串
37
+ *
33
38
  * - 以 `^` 开头或以 `$` 结尾的字符串,会自动转换为正则
34
39
  * - 普通字符串检查是否以其作为开头或结尾
35
40
  *
36
41
  * @example
37
- * ```
38
- * '^/foo/'
39
- * '.jpg$'
40
- * /\.jpg$/
41
- * ```
42
+ * '^/foo/'
43
+ * '.jpg$'
44
+ * /\.jpg$/
42
45
  */
43
46
  find: RegExp | string;
44
47
  /**
45
48
  * Assets Replacement Target Path
49
+ *
46
50
  * - `string`: Directly concatenated before the original path
47
51
  * - `(url) => string`: Custom replacement method, returns the new path
48
52
  *
49
53
  * 资源替换目标路径
54
+ *
50
55
  * - `string`: 直接拼接在原始路径前面
51
56
  * - `(url) => string`: 自定义替换方法,返回新路径
52
57
  *
53
58
  * @example
54
- * ```
55
- * 'https://example.com'
56
- * (url) => `https://example.com${url}`
57
- * ```
59
+ * 'https://example.com'
60
+ * (url) => `https://example.com${url}`
58
61
  */
59
62
  replacement: Replacement;
60
63
  }
@@ -65,53 +68,51 @@ interface ReplaceAssetsOptions {
65
68
  * 自定义资源替换规则
66
69
  *
67
70
  * @example
68
- * ```ts
69
- * {
70
- * rules: [{
71
- * find: /^\/images\/.*\.(jpe?g|png|gif|svg)$/,
72
- * replacement: 'https://cdn.example.com/images/',
73
- * }]
74
- * }
75
- * ```
71
+ * ;({
72
+ * rules: [
73
+ * {
74
+ * find: /^\/images\/.*\.(jpe?g|png|gif|svg)$/,
75
+ * replacement: 'https://cdn.example.com/images/',
76
+ * },
77
+ * ],
78
+ * })
76
79
  */
77
80
  rules?: ReplacementRule | ReplacementRule[];
78
81
  /**
79
- * Built-in image matching rules, designed to match and find common image paths starting with `^/images/`
82
+ * Built-in image matching rules, designed to match and find common image
83
+ * paths starting with `^/images/`
80
84
  *
81
85
  * 内置的图片匹配规则,匹配查找 `^/images/` 开头的常见的图片路径
82
86
  *
83
87
  * @example
84
- * ```
85
- * {
86
- * image: 'https://example.com'
87
- * }
88
- * ```
88
+ * ;({
89
+ * image: 'https://example.com',
90
+ * })
89
91
  */
90
92
  image?: Replacement;
91
93
  /**
92
- * Built-in media matching rules, designed to match and locate common media paths such as videos and audio that start with `^/medias/`.
94
+ * Built-in media matching rules, designed to match and locate common media
95
+ * paths such as videos and audio that start with `^/medias/`.
93
96
  *
94
97
  * 内置的媒体匹配规则,匹配查找 `^/medias/` 开头的常见的视频、音频等媒体路径
95
98
  *
96
99
  * @example
97
- * ```
98
- * {
99
- * media: 'https://example.com'
100
- * }
101
- * ```
100
+ * ;({
101
+ * media: 'https://example.com',
102
+ * })
102
103
  */
103
104
  media?: Replacement;
104
105
  /**
105
- * Equivalent to setting both {@link ReplaceAssetsOptions.image image} and {@link ReplaceAssetsOptions.media media} simultaneously.
106
+ * Equivalent to setting both {@link ReplaceAssetsOptions.image image} and
107
+ * {@link ReplaceAssetsOptions.media media} simultaneously.
106
108
  *
107
- * 相当于同时设置 {@link ReplaceAssetsOptions.image image} 和 {@link ReplaceAssetsOptions.media media}
109
+ * 相当于同时设置 {@link ReplaceAssetsOptions.image image} 和
110
+ * {@link ReplaceAssetsOptions.media media}
108
111
  *
109
112
  * @example
110
- * ```
111
- * {
112
- * all: 'https://example.com'
113
- * }
114
- * ```
113
+ * ;({
114
+ * all: 'https://example.com',
115
+ * })
115
116
  */
116
117
  all?: Replacement;
117
118
  }
@@ -129,13 +130,9 @@ type ReplaceAssetsPluginOptions = ReplaceAssetsOptions | Replacement | Replaceme
129
130
  * 资源路径替换插件
130
131
  *
131
132
  * @example
132
- * ```
133
- * export default defineUserConfig({
134
- * plugins: [
135
- * replaceAssetsPlugin('https://cnd.example.com')
136
- * ]
137
- * })
138
- * ```
133
+ * export default defineUserConfig({
134
+ * plugins: [replaceAssetsPlugin('https://cnd.example.com')],
135
+ * })
139
136
  */
140
137
  declare const replaceAssetsPlugin: (options?: ReplaceAssetsPluginOptions) => Plugin;
141
138
  //#endregion
@@ -153,23 +150,27 @@ declare const normalizeRules: (options?: ReplaceAssetsPluginOptions) => Replacem
153
150
  /**
154
151
  * Check if url matches find
155
152
  *
156
- * @param find - The find pattern, can be a string or a RegExp / 查找模式,可以是字符串或正则表达式
153
+ * @param find - The find pattern, can be a string or a RegExp /
154
+ * 查找模式,可以是字符串或正则表达式
157
155
  * @param url - The URL to check / 要检查的 URL
158
- * @returns True if the URL matches the find pattern, false otherwise / 如果 URL 匹配查找模式则返回 true,否则返回 false
156
+ * @returns True if the URL matches the find pattern, false otherwise / 如果 URL
157
+ * 匹配查找模式则返回 true,否则返回 false
159
158
  */
160
159
  declare const isMatchUrl: (find: RegExp | string, url: string) => boolean;
161
160
  /**
162
161
  * Replace asset with rules
163
162
  *
163
+ * @example
164
+ * replacementAssetWithRules(
165
+ * [{ find: '/foo/', replacement: 'https://example.com' }],
166
+ * '/foo/a.jpg',
167
+ * )
168
+ * // -> 'https://example.com/foo/a.jpg'
169
+ *
164
170
  * @param rules - Replacement rules / 替换规则
165
171
  * @param url - The original asset URL / 原始资源 URL
166
- * @returns The replaced asset URL if matched, otherwise return undefined / 如果匹配则返回替换后的资源 URL,否则返回 undefined
167
- *
168
- * @example
169
- * ```ts
170
- * replacementAssetWithRules([{ find: '/foo/', replacement: 'https://example.com' }], '/foo/a.jpg')
171
- * // -> 'https://example.com/foo/a.jpg'
172
- * ```
172
+ * @returns The replaced asset URL if matched, otherwise return undefined /
173
+ * 如果匹配则返回替换后的资源 URL,否则返回 undefined
173
174
  */
174
175
  declare const replacementAssetWithRules: (rules: ReplacementRule[], url: string) => string | void;
175
176
  declare const transformAssets: (code: string, pattern: RegExp, rules: ReplacementRule[]) => string;
@@ -1,2 +1,2 @@
1
- import{addViteConfig as e,configWebpack as t,getBundlerName as n,isArray as r,isFunction as i,removeEndingSlash as a,removeLeadingSlash as o}from"@vuepress/helper";import{createVitePlugin as s,createWebpackPlugin as c}from"unplugin";import l from"magic-string";const u=[`apng`,`bmp`,`png`,`jpe?g`,`jfif`,`pjpeg`,`pjp`,`gif`,`svg`,`ico`,`webp`,`avif`,`cur`,`jxl`],d=[`mp4`,`webm`,`ogg`,`mp3`,`wav`,`flac`,`aac`,`opus`,`mov`,`m4a`,`vtt`,`pdf`],f=(e,t)=>RegExp(`^/${e}/.*\\.(?:${t.join(`|`)})(\\?.*)?$`),p=e=>{let t=[];return e?((typeof e==`string`||i(e))&&(e={all:e}),r(e)?(t.push(...e),t):`find`in e?(e.find&&e.replacement&&t.push(e),t):(e.rules&&t.push(...r(e.rules)?e.rules:[e.rules]),(e.image||e.all)&&t.push({find:f(`images`,u),replacement:e.image||e.all}),(e.media||e.all)&&t.push({find:f(`medias`,d),replacement:e.media||e.all}),t)):[]},m=e=>{let t=`(${e}.*?)`;return new RegExp([`(?:"${t}")`,`(?:'${t}')`,`(?:\\(${t}\\))`,`(?:\\('${t}'\\))`,`(?:\\("${t}"\\))`,`(?:\\\\"${t}\\\\")`].join(`|`),`gu`)},h=(e,t)=>e?t?`${a(t)}/${o(e)}`:e:``,g=new Map,_=(e,t)=>{if(typeof e==`string`){if(e.startsWith(`^`)||e.endsWith(`$`)){let n=g.get(e);return n||(n=new RegExp(e),g.set(e,n)),n.test(t)}return t.endsWith(e)||t.startsWith(e)}return e.test(t)},v=new Map,y=(e,t)=>{if(v.has(t))return v.get(t);for(let{find:n,replacement:r}of e)if(n&&_(n,t)){let e=typeof r==`function`?h(r(t)):h(t,r);if(e)return v.set(t,e),e}},b=String.raw`\"`,x=(e,t,n)=>{let r=new l(e),i,a=!1;for(;i=t.exec(e);){let e=i[6]||i[5]||i[4]||i[3]||i[2]||i[1],[t,o]=i[0].startsWith(`(`)?[`("`,`")`]:i[0].startsWith(b)?[b,b]:[`"`,`"`],s=i.index,c=s+i[0].length,l=y(n,e);l&&(a=!0,r.update(s,c,`${t}${l}${o}`))}return a?r.toString():e},S=(e,t)=>{let n=m(`/[^/]`);return{name:`vuepress:replace-assets`,enforce:t?.framework===`vite`?`pre`:void 0,transform:{filter:{id:{exclude:[/\.json(?:$|\?)/,/\.html?$/]}},handler(t){return x(t,n,e)}}}},C=()=>s(S),w=()=>c(S),T=r=>{let i={name:`@vuepress/plugin-replace-assets`},a=p(r);return a.length===0?i:{...i,extendsBundlerOptions(r,i){let o=n(i);o===`vite`&&e(r,i,{plugins:[C()(a)]}),o===`webpack`&&t(r,i,e=>{e.plugins??=[];let t=w();e.plugins.push(t(a))})}}};export{f as createFindPattern,C as createVitePluginReplaceAssets,w as createWebpackPluginReplaceAssets,_ as isMatchUrl,p as normalizeRules,T as replaceAssetsPlugin,y as replacementAssetWithRules,x as transformAssets};
1
+ import{addViteConfig as e,configWebpack as t,getBundlerName as n,isArray as r,isFunction as i,removeEndingSlash as a,removeLeadingSlash as o}from"@vuepress/helper";import{createVitePlugin as s,createWebpackPlugin as c}from"unplugin";import l from"magic-string";const u=[`apng`,`bmp`,`png`,`jpe?g`,`jfif`,`pjpeg`,`pjp`,`gif`,`svg`,`ico`,`webp`,`avif`,`cur`,`jxl`],d=[`mp4`,`webm`,`ogg`,`mp3`,`wav`,`flac`,`aac`,`opus`,`mov`,`m4a`,`vtt`,`pdf`],f=(e,t)=>RegExp(`^/${e}/.*\\.(?:${t.join(`|`)})(\\?.*)?$`,`u`),p=e=>{let t=[];return e?((typeof e==`string`||i(e))&&(e={all:e}),r(e)?(t.push(...e),t):`find`in e?(e.find&&e.replacement&&t.push(e),t):(e.rules&&t.push(...r(e.rules)?e.rules:[e.rules]),(e.image||e.all)&&t.push({find:f(`images`,u),replacement:e.image||e.all}),(e.media||e.all)&&t.push({find:f(`medias`,d),replacement:e.media||e.all}),t)):[]},m=e=>{let t=`(${e}.*?)`;return new RegExp([`(?:"${t}")`,`(?:'${t}')`,`(?:\\(${t}\\))`,`(?:\\('${t}'\\))`,`(?:\\("${t}"\\))`,`(?:\\\\"${t}\\\\")`].join(`|`),`gu`)},h=(e,t)=>e?t?`${a(t)}/${o(e)}`:e:``,g=new Map,_=(e,t)=>{if(typeof e==`string`){if(e.startsWith(`^`)||e.endsWith(`$`)){let n=g.get(e);return n||(n=new RegExp(e,`u`),g.set(e,n)),n.test(t)}return t.endsWith(e)||t.startsWith(e)}return e.test(t)},v=new Map,y=(e,t)=>{if(v.has(t))return v.get(t);for(let{find:n,replacement:r}of e)if(n&&_(n,t)){let e=typeof r==`function`?h(r(t)):h(t,r);if(e)return v.set(t,e),e}},b=String.raw`\"`,x=(e,t,n)=>{let r=new l(e),i,a=!1;for(;i=t.exec(e);){let e=i[6]||i[5]||i[4]||i[3]||i[2]||i[1],[t,o]=i[0].startsWith(`(`)?[`("`,`")`]:i[0].startsWith(b)?[b,b]:[`"`,`"`],s=i.index,c=s+i[0].length,l=y(n,e);l&&(a=!0,r.update(s,c,`${t}${l}${o}`))}return a?r.toString():e},S=(e,t)=>{let n=m(`/[^/]`);return{name:`vuepress:replace-assets`,enforce:t?.framework===`vite`?`pre`:void 0,transform:{filter:{id:{exclude:[/\.json(?:$|\?)/u,/\.html?$/u]}},handler(t){return x(t,n,e)}}}},C=()=>s(S),w=()=>c(S),T=r=>{let i={name:`@vuepress/plugin-replace-assets`},a=p(r);return a.length===0?i:{...i,extendsBundlerOptions(r,i){let o=n(i);o===`vite`&&e(r,i,{plugins:[C()(a)]}),o===`webpack`&&t(r,i,e=>{e.plugins??=[];let t=w();e.plugins.push(t(a))})}}};export{f as createFindPattern,C as createVitePluginReplaceAssets,w as createWebpackPluginReplaceAssets,_ as isMatchUrl,p as normalizeRules,T as replaceAssetsPlugin,y as replacementAssetWithRules,x as transformAssets};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/node/constants.ts","../../src/node/normalizeRules.ts","../../src/node/utils.ts","../../src/node/transformAssets.ts","../../src/node/unplugin.ts","../../src/node/replaceAssetsPlugin.ts"],"sourcesContent":["export const PLUGIN_NAME = '@vuepress/plugin-replace-assets'\n\n/**\n * images extensions\n */\nexport const KNOWN_IMAGE_EXTENSIONS: string[] = [\n 'apng',\n 'bmp',\n 'png',\n 'jpe?g',\n 'jfif',\n 'pjpeg',\n 'pjp',\n 'gif',\n 'svg',\n 'ico',\n 'webp',\n 'avif',\n 'cur',\n 'jxl',\n]\n\n/**\n * media extensions\n */\nexport const KNOWN_MEDIA_EXTENSIONS: string[] = [\n 'mp4',\n 'webm',\n 'ogg',\n 'mp3',\n 'wav',\n 'flac',\n 'aac',\n 'opus',\n 'mov',\n 'm4a',\n 'vtt',\n\n 'pdf',\n]\n","import { isArray, isFunction } from '@vuepress/helper'\n\nimport { KNOWN_IMAGE_EXTENSIONS, KNOWN_MEDIA_EXTENSIONS } from './constants.js'\nimport type { ReplaceAssetsPluginOptions, ReplacementRule } from './types.js'\n\nexport const createFindPattern = (dir: string, extensions: string[]): RegExp =>\n new RegExp(`^/${dir}/.*\\\\.(?:${extensions.join('|')})(\\\\?.*)?$`)\n\n/**\n * Normalize replacement rules\n *\n * @param options - The plugin options to normalize\n * @returns Normalized replacement rules\n */\nexport const normalizeRules = (\n options?: ReplaceAssetsPluginOptions,\n): ReplacementRule[] => {\n const normalized: ReplacementRule[] = []\n\n if (!options) return []\n\n if (typeof options === 'string' || isFunction(options)) {\n // oxlint-disable-next-line no-param-reassign\n options = {\n all: options,\n }\n }\n\n if (isArray(options)) {\n normalized.push(...options)\n return normalized\n }\n\n if ('find' in options) {\n if (options.find && options.replacement) normalized.push(options)\n return normalized\n }\n\n if (options.rules) {\n normalized.push(\n ...(isArray(options.rules) ? options.rules : [options.rules]),\n )\n }\n\n if (options.image || options.all) {\n normalized.push({\n find: createFindPattern('images', KNOWN_IMAGE_EXTENSIONS),\n replacement: options.image || options.all!,\n })\n }\n\n if (options.media || options.all) {\n normalized.push({\n find: createFindPattern('medias', KNOWN_MEDIA_EXTENSIONS),\n replacement: options.media || options.all!,\n })\n }\n\n return normalized\n}\n","import { removeEndingSlash, removeLeadingSlash } from '@vuepress/helper'\n\nexport const createAssetPattern = (prefix: string): RegExp => {\n // oxlint-disable-next-line id-length\n const s = `(${prefix}.*?)`\n return new RegExp(\n [\n `(?:\"${s}\")`, // \"prefix\"\n `(?:'${s}')`, // 'prefix'\n `(?:\\\\(${s}\\\\))`, // (prefix)\n `(?:\\\\('${s}'\\\\))`, // ('prefix')\n `(?:\\\\(\"${s}\"\\\\))`, // (\"prefix\")\n `(?:\\\\\\\\\"${s}\\\\\\\\\")`, // \\\"prefix\\\"\n ].join('|'),\n 'gu',\n )\n}\n\n/**\n * Normalize url\n *\n * @param url - The url to normalize\n * @param base - The base url to prepend to the url\n * @returns Normalized url\n *\n * @example\n * ```ts\n * normalizeUrl('/bar', '/foo/') // -> /foo/bar\n * ```\n */\nexport const normalizeUrl = (url: string, base?: string): string => {\n if (!url) return ''\n\n if (base) return `${removeEndingSlash(base)}/${removeLeadingSlash(url)}`\n\n return url\n}\n","import MagicString from 'magic-string'\n\nimport type { ReplacementRule } from './types.js'\nimport { normalizeUrl } from './utils.js'\n\nconst regexpCache = new Map<string, RegExp>()\n\n/**\n * Check if url matches find\n *\n * @param find - The find pattern, can be a string or a RegExp / 查找模式,可以是字符串或正则表达式\n * @param url - The URL to check / 要检查的 URL\n * @returns True if the URL matches the find pattern, false otherwise / 如果 URL 匹配查找模式则返回 true,否则返回 false\n */\nexport const isMatchUrl = (find: RegExp | string, url: string): boolean => {\n if (typeof find === 'string') {\n // like regexp string, start with `^` or end with `$`\n if (find.startsWith('^') || find.endsWith('$')) {\n let re = regexpCache.get(find)\n if (!re) {\n re = new RegExp(find)\n regexpCache.set(find, re)\n }\n return re.test(url)\n }\n\n return url.endsWith(find) || url.startsWith(find)\n }\n\n return find.test(url)\n}\n\nconst cache = new Map<string, string>()\n\n/**\n * Replace asset with rules\n *\n * @param rules - Replacement rules / 替换规则\n * @param url - The original asset URL / 原始资源 URL\n * @returns The replaced asset URL if matched, otherwise return undefined / 如果匹配则返回替换后的资源 URL,否则返回 undefined\n *\n * @example\n * ```ts\n * replacementAssetWithRules([{ find: '/foo/', replacement: 'https://example.com' }], '/foo/a.jpg')\n * // -> 'https://example.com/foo/a.jpg'\n * ```\n */\nexport const replacementAssetWithRules = (\n rules: ReplacementRule[],\n url: string,\n): string | void => {\n if (cache.has(url)) return cache.get(url)\n\n for (const { find, replacement } of rules) {\n if (find && isMatchUrl(find, url)) {\n const replaced =\n typeof replacement === 'function'\n ? normalizeUrl(replacement(url))\n : normalizeUrl(url, replacement)\n\n /* istanbul ignore if -- @preserve */\n if (replaced) {\n cache.set(url, replaced)\n return replaced\n }\n }\n }\n}\n\nconst ESCAPED_DOUBLE_QUOTE = String.raw`\\\"`\n\nexport const transformAssets = (\n code: string,\n pattern: RegExp,\n rules: ReplacementRule[],\n): string => {\n const str = new MagicString(code)\n let matched: RegExpExecArray | null\n let hasMatched = false\n\n while ((matched = pattern.exec(code))) {\n const assetUrl =\n matched[6] ||\n matched[5] ||\n matched[4] ||\n matched[3] ||\n matched[2] ||\n matched[1]\n const [left, right] = matched[0].startsWith('(')\n ? ['(\"', '\")']\n : matched[0].startsWith(ESCAPED_DOUBLE_QUOTE)\n ? [ESCAPED_DOUBLE_QUOTE, ESCAPED_DOUBLE_QUOTE]\n : ['\"', '\"']\n\n const start = matched.index\n const end = start + matched[0].length\n const resolved = replacementAssetWithRules(rules, assetUrl)\n if (resolved) {\n hasMatched = true\n str.update(start, end, `${left}${resolved}${right}`)\n }\n }\n\n if (!hasMatched) return code\n\n return str.toString()\n}\n","import type {\n UnpluginFactory,\n VitePlugin,\n WebpackPluginInstance,\n} from 'unplugin'\nimport { createVitePlugin, createWebpackPlugin } from 'unplugin'\n\nimport { transformAssets } from './transformAssets.js'\nimport type { ReplacementRule } from './types.js'\nimport { createAssetPattern } from './utils.js'\n\nconst replaceAssetsFactory: UnpluginFactory<ReplacementRule[]> = (\n rules,\n meta,\n) => {\n const pattern = createAssetPattern('/[^/]')\n return {\n name: 'vuepress:replace-assets',\n enforce: meta?.framework === 'vite' ? 'pre' : undefined,\n transform: {\n filter: { id: { exclude: [/\\.json(?:$|\\?)/, /\\.html?$/] } },\n handler(code) {\n return transformAssets(code, pattern, rules)\n },\n },\n }\n}\n\nexport const createVitePluginReplaceAssets: () => (\n options: ReplacementRule[],\n) => VitePlugin | VitePlugin[] = () => createVitePlugin(replaceAssetsFactory)\n\nexport const createWebpackPluginReplaceAssets: () => (\n options: ReplacementRule[],\n) => WebpackPluginInstance = () => createWebpackPlugin(replaceAssetsFactory)\n","import { addViteConfig, configWebpack, getBundlerName } from '@vuepress/helper'\nimport type { Plugin } from 'vuepress/core'\n\nimport { PLUGIN_NAME } from './constants.js'\nimport { normalizeRules } from './normalizeRules.js'\nimport type { ReplaceAssetsPluginOptions } from './types.js'\nimport {\n createVitePluginReplaceAssets,\n createWebpackPluginReplaceAssets,\n} from './unplugin.js'\n\n/**\n * Plugin for replacing assets path\n *\n * 资源路径替换插件\n *\n * @example\n * ```\n * export default defineUserConfig({\n * plugins: [\n * replaceAssetsPlugin('https://cnd.example.com')\n * ]\n * })\n * ```\n */\nexport const replaceAssetsPlugin = (\n options?: ReplaceAssetsPluginOptions,\n): Plugin => {\n const EMPTY_PLUGIN = { name: PLUGIN_NAME }\n\n const rules = normalizeRules(options)\n\n if (rules.length === 0) return EMPTY_PLUGIN\n\n return {\n ...EMPTY_PLUGIN,\n\n extendsBundlerOptions(bundlerOptions, app) {\n const bundle = getBundlerName(app)\n\n if (bundle === 'vite') {\n const replaceAssets = createVitePluginReplaceAssets()\n addViteConfig(bundlerOptions, app, {\n plugins: [replaceAssets(rules)],\n })\n }\n\n if (bundle === 'webpack') {\n configWebpack(bundlerOptions, app, (config) => {\n config.plugins ??= []\n const replaceAssets = createWebpackPluginReplaceAssets()\n config.plugins.push(replaceAssets(rules))\n })\n }\n },\n }\n}\n"],"mappings":"qQAAA,MAKa,EAAmC,CAC9C,OACA,MACA,MACA,QACA,OACA,QACA,MACA,MACA,MACA,MACA,OACA,OACA,MACA,MACD,CAKY,EAAmC,CAC9C,MACA,OACA,MACA,MACA,MACA,OACA,MACA,OACA,MACA,MACA,MAEA,MACD,CClCY,GAAqB,EAAa,IACzC,OAAO,KAAK,EAAI,WAAW,EAAW,KAAK,IAAI,CAAC,YAAY,CAQrD,EACX,GACsB,CACtB,IAAM,EAAgC,EAAE,CAyCxC,OAvCK,IAED,OAAO,GAAY,UAAY,EAAW,EAAQ,IAEpD,EAAU,CACR,IAAK,EACN,EAGC,EAAQ,EAAQ,EAClB,EAAW,KAAK,GAAG,EAAQ,CACpB,GAGL,SAAU,GACR,EAAQ,MAAQ,EAAQ,aAAa,EAAW,KAAK,EAAQ,CAC1D,IAGL,EAAQ,OACV,EAAW,KACT,GAAI,EAAQ,EAAQ,MAAM,CAAG,EAAQ,MAAQ,CAAC,EAAQ,MAAM,CAC7D,EAGC,EAAQ,OAAS,EAAQ,MAC3B,EAAW,KAAK,CACd,KAAM,EAAkB,SAAU,EAAuB,CACzD,YAAa,EAAQ,OAAS,EAAQ,IACvC,CAAC,EAGA,EAAQ,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GP"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/node/constants.ts","../../src/node/normalizeRules.ts","../../src/node/utils.ts","../../src/node/transformAssets.ts","../../src/node/unplugin.ts","../../src/node/replaceAssetsPlugin.ts"],"sourcesContent":["export const PLUGIN_NAME = '@vuepress/plugin-replace-assets'\n\n/** Images extensions */\nexport const KNOWN_IMAGE_EXTENSIONS: string[] = [\n 'apng',\n 'bmp',\n 'png',\n 'jpe?g',\n 'jfif',\n 'pjpeg',\n 'pjp',\n 'gif',\n 'svg',\n 'ico',\n 'webp',\n 'avif',\n 'cur',\n 'jxl',\n]\n\n/** Media extensions */\nexport const KNOWN_MEDIA_EXTENSIONS: string[] = [\n 'mp4',\n 'webm',\n 'ogg',\n 'mp3',\n 'wav',\n 'flac',\n 'aac',\n 'opus',\n 'mov',\n 'm4a',\n 'vtt',\n\n 'pdf',\n]\n","import { isArray, isFunction } from '@vuepress/helper'\n\nimport { KNOWN_IMAGE_EXTENSIONS, KNOWN_MEDIA_EXTENSIONS } from './constants.js'\nimport type { ReplaceAssetsPluginOptions, ReplacementRule } from './types.js'\n\nexport const createFindPattern = (dir: string, extensions: string[]): RegExp =>\n new RegExp(`^/${dir}/.*\\\\.(?:${extensions.join('|')})(\\\\?.*)?$`, 'u')\n\n/**\n * Normalize replacement rules\n *\n * @param options - The plugin options to normalize\n * @returns Normalized replacement rules\n */\nexport const normalizeRules = (\n options?: ReplaceAssetsPluginOptions,\n): ReplacementRule[] => {\n const normalized: ReplacementRule[] = []\n\n if (!options) return []\n\n if (typeof options === 'string' || isFunction(options)) {\n // oxlint-disable-next-line no-param-reassign\n options = {\n all: options,\n }\n }\n\n if (isArray(options)) {\n normalized.push(...options)\n return normalized\n }\n\n if ('find' in options) {\n if (options.find && options.replacement) normalized.push(options)\n return normalized\n }\n\n if (options.rules) {\n normalized.push(\n ...(isArray(options.rules) ? options.rules : [options.rules]),\n )\n }\n\n if (options.image || options.all) {\n normalized.push({\n find: createFindPattern('images', KNOWN_IMAGE_EXTENSIONS),\n replacement: options.image || options.all!,\n })\n }\n\n if (options.media || options.all) {\n normalized.push({\n find: createFindPattern('medias', KNOWN_MEDIA_EXTENSIONS),\n replacement: options.media || options.all!,\n })\n }\n\n return normalized\n}\n","import { removeEndingSlash, removeLeadingSlash } from '@vuepress/helper'\n\nexport const createAssetPattern = (prefix: string): RegExp => {\n // oxlint-disable-next-line id-length\n const s = `(${prefix}.*?)`\n return new RegExp(\n [\n `(?:\"${s}\")`, // \"prefix\"\n `(?:'${s}')`, // 'prefix'\n `(?:\\\\(${s}\\\\))`, // (prefix)\n `(?:\\\\('${s}'\\\\))`, // ('prefix')\n `(?:\\\\(\"${s}\"\\\\))`, // (\"prefix\")\n `(?:\\\\\\\\\"${s}\\\\\\\\\")`, // \\\"prefix\\\"\n ].join('|'),\n 'gu',\n )\n}\n\n/**\n * Normalize url\n *\n * @example\n * normalizeUrl('/bar', '/foo/') // -> /foo/bar\n *\n * @param url - The url to normalize\n * @param base - The base url to prepend to the url\n * @returns Normalized url\n */\nexport const normalizeUrl = (url: string, base?: string): string => {\n if (!url) return ''\n\n if (base) return `${removeEndingSlash(base)}/${removeLeadingSlash(url)}`\n\n return url\n}\n","import MagicString from 'magic-string'\n\nimport type { ReplacementRule } from './types.js'\nimport { normalizeUrl } from './utils.js'\n\nconst regexpCache = new Map<string, RegExp>()\n\n/**\n * Check if url matches find\n *\n * @param find - The find pattern, can be a string or a RegExp /\n * 查找模式,可以是字符串或正则表达式\n * @param url - The URL to check / 要检查的 URL\n * @returns True if the URL matches the find pattern, false otherwise / 如果 URL\n * 匹配查找模式则返回 true,否则返回 false\n */\nexport const isMatchUrl = (find: RegExp | string, url: string): boolean => {\n if (typeof find === 'string') {\n // like regexp string, start with `^` or end with `$`\n if (find.startsWith('^') || find.endsWith('$')) {\n let re = regexpCache.get(find)\n if (!re) {\n re = new RegExp(find, 'u')\n regexpCache.set(find, re)\n }\n return re.test(url)\n }\n\n return url.endsWith(find) || url.startsWith(find)\n }\n\n return find.test(url)\n}\n\nconst cache = new Map<string, string>()\n\n/**\n * Replace asset with rules\n *\n * @example\n * replacementAssetWithRules(\n * [{ find: '/foo/', replacement: 'https://example.com' }],\n * '/foo/a.jpg',\n * )\n * // -> 'https://example.com/foo/a.jpg'\n *\n * @param rules - Replacement rules / 替换规则\n * @param url - The original asset URL / 原始资源 URL\n * @returns The replaced asset URL if matched, otherwise return undefined /\n * 如果匹配则返回替换后的资源 URL,否则返回 undefined\n */\nexport const replacementAssetWithRules = (\n rules: ReplacementRule[],\n url: string,\n): string | void => {\n if (cache.has(url)) return cache.get(url)\n\n for (const { find, replacement } of rules) {\n if (find && isMatchUrl(find, url)) {\n const replaced =\n typeof replacement === 'function'\n ? normalizeUrl(replacement(url))\n : normalizeUrl(url, replacement)\n\n /* istanbul ignore if -- @preserve */\n if (replaced) {\n cache.set(url, replaced)\n return replaced\n }\n }\n }\n}\n\nconst ESCAPED_DOUBLE_QUOTE = String.raw`\\\"`\n\nexport const transformAssets = (\n code: string,\n pattern: RegExp,\n rules: ReplacementRule[],\n): string => {\n const str = new MagicString(code)\n let matched: RegExpExecArray | null\n let hasMatched = false\n\n while ((matched = pattern.exec(code))) {\n const assetUrl =\n matched[6] ||\n matched[5] ||\n matched[4] ||\n matched[3] ||\n matched[2] ||\n matched[1]\n const [left, right] = matched[0].startsWith('(')\n ? ['(\"', '\")']\n : matched[0].startsWith(ESCAPED_DOUBLE_QUOTE)\n ? [ESCAPED_DOUBLE_QUOTE, ESCAPED_DOUBLE_QUOTE]\n : ['\"', '\"']\n\n const start = matched.index\n const end = start + matched[0].length\n const resolved = replacementAssetWithRules(rules, assetUrl)\n if (resolved) {\n hasMatched = true\n str.update(start, end, `${left}${resolved}${right}`)\n }\n }\n\n if (!hasMatched) return code\n\n return str.toString()\n}\n","import type {\n UnpluginFactory,\n VitePlugin,\n WebpackPluginInstance,\n} from 'unplugin'\nimport { createVitePlugin, createWebpackPlugin } from 'unplugin'\n\nimport { transformAssets } from './transformAssets.js'\nimport type { ReplacementRule } from './types.js'\nimport { createAssetPattern } from './utils.js'\n\nconst replaceAssetsFactory: UnpluginFactory<ReplacementRule[]> = (\n rules,\n meta,\n) => {\n const pattern = createAssetPattern('/[^/]')\n return {\n name: 'vuepress:replace-assets',\n enforce: meta?.framework === 'vite' ? 'pre' : undefined,\n transform: {\n filter: { id: { exclude: [/\\.json(?:$|\\?)/u, /\\.html?$/u] } },\n handler(code) {\n return transformAssets(code, pattern, rules)\n },\n },\n }\n}\n\nexport const createVitePluginReplaceAssets: () => (\n options: ReplacementRule[],\n) => VitePlugin | VitePlugin[] = () => createVitePlugin(replaceAssetsFactory)\n\nexport const createWebpackPluginReplaceAssets: () => (\n options: ReplacementRule[],\n) => WebpackPluginInstance = () => createWebpackPlugin(replaceAssetsFactory)\n","import { addViteConfig, configWebpack, getBundlerName } from '@vuepress/helper'\nimport type { Plugin } from 'vuepress/core'\n\nimport { PLUGIN_NAME } from './constants.js'\nimport { normalizeRules } from './normalizeRules.js'\nimport type { ReplaceAssetsPluginOptions } from './types.js'\nimport {\n createVitePluginReplaceAssets,\n createWebpackPluginReplaceAssets,\n} from './unplugin.js'\n\n/**\n * Plugin for replacing assets path\n *\n * 资源路径替换插件\n *\n * @example\n * export default defineUserConfig({\n * plugins: [replaceAssetsPlugin('https://cnd.example.com')],\n * })\n */\nexport const replaceAssetsPlugin = (\n options?: ReplaceAssetsPluginOptions,\n): Plugin => {\n const EMPTY_PLUGIN = { name: PLUGIN_NAME }\n\n const rules = normalizeRules(options)\n\n if (rules.length === 0) return EMPTY_PLUGIN\n\n return {\n ...EMPTY_PLUGIN,\n\n extendsBundlerOptions(bundlerOptions, app) {\n const bundle = getBundlerName(app)\n\n if (bundle === 'vite') {\n const replaceAssets = createVitePluginReplaceAssets()\n addViteConfig(bundlerOptions, app, {\n plugins: [replaceAssets(rules)],\n })\n }\n\n if (bundle === 'webpack') {\n configWebpack(bundlerOptions, app, (config) => {\n config.plugins ??= []\n const replaceAss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,EACtD,IACF,EAAa,GACb,EAAI,OAAO,EAAO,EAAK,GAAG,IAAO,IAAW,GAAO,EAEvD,CAIA,OAFK,EAEE,EAAI,SAAS,EAFI,CAG1B,ECnGM,GACJ,EACA,IACG,CACH,IAAM,EAAU,EAAmB,OAAO,EAC1C,MAAO,CACL,KAAM,0BACN,QAAS,GAAM,YAAc,OAAS,MAAQ,IAAA,GAC9C,UAAW,CACT,OAAQ,CAAE,GAAI,CAAE,QAAS,CAAC,kBAAmB,WAAW,CAAE,CAAE,EAC5D,QAAQ,EAAM,CACZ,OAAO,EAAgB,EAAM,EAAS,CAAK,CAC7C,CACF,CACF,CACF,EAEa,MAE0B,EAAiB,CAAoB,EAE/D,MAEsB,EAAoB,CAAoB,ECb9D,EACX,GACW,CACX,IAAM,EAAe,CAAE,KAAM,iCAAY,EAEnC,EAAQ,EAAe,CAAO,EAIpC,OAFI,EAAM,SAAW,EAAU,EAExB,CACL,GAAG,EAEH,sBAAsB,EAAgB,EAAK,CACzC,IAAM,EAAS,EAAe,CAAG,EAE7B,IAAW,QAEb,EAAc,EAAgB,EAAK,CACjC,QAAS,CAFW,EAEE,EAAE,CAAK,CAAC,CAChC,CAAC,EAGC,IAAW,WACb,EAAc,EAAgB,EAAM,GAAW,CAC7C,EAAO,UAAY,CAAC,EACpB,IAAM,EAAgB,EAAiC,EACvD,EAAO,QAAQ,KAAK,EAAc,CAAK,CAAC,CAC1C,CAAC,CAEL,CACF,CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/plugin-replace-assets",
3
- "version": "2.0.0-rc.128",
3
+ "version": "2.0.0-rc.130",
4
4
  "description": "VuePress plugin - replace assets",
5
5
  "keywords": [
6
6
  "plugin",
@@ -41,15 +41,15 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@vuepress/helper": "2.0.0-rc.128",
44
+ "@vuepress/helper": "2.0.0-rc.130",
45
45
  "magic-string": "^0.30.21",
46
46
  "unplugin": "^3.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "webpack": "^5.105.4"
49
+ "webpack": "^5.106.2"
50
50
  },
51
51
  "peerDependencies": {
52
- "vuepress": "2.0.0-rc.28"
52
+ "vuepress": "2.0.0-rc.30"
53
53
  },
54
- "gitHead": "47b25c2008dc496e4638cae7528374846d3660dd"
54
+ "gitHead": "3612bba34c7299f3bad032390904c8c27cd417cc"
55
55
  }