Skip to content

Commit

Permalink
fix: replace bootcdn by jsdelivr
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed May 29, 2024
1 parent fc41a40 commit 28fa206
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/vite-plugin-monkey/src/node/cdn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,21 @@ export const bytecdntp = (
};

/**
* `https://cdn.bootcdn.net/ajax/libs/${name}/${version}/${pathname}`
* @param exportVarName cdn-exportVarName or resourceName
* @see https://www.bootcdn.cn/all/
* `https://cdn.jsdelivr.net/npm/${name}@${version}/${pathname}`
* @deprecated bootcdn will return virus-infected code. Please stop using it and switch to other sources
*/
export const bootcdn = (
exportVarName = '',
pathname = '',
): [string, ModuleToUrlFc] => {
console.warn(
'bootcdn will return virus-infected code. Please stop using it and switch to other sources. now it will return jsdelivr url.',
);
return [
exportVarName,
(version, name, _importName = '', resolveName = '') => {
const p = pathname || resolveName;
return `https://cdn.bootcdn.net/ajax/libs/${name}/${version}/${p}`;
return `https://fastly.jsdelivr.net/npm/${name}@${version}/${p}`;
},
];
};
Expand Down

0 comments on commit 28fa206

Please sign in to comment.