Skip to content

Commit

Permalink
fix: remove staticfile cdn because it return virus-infected code (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Jun 29, 2024
1 parent 1efe9fb commit b2ce17a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pnpm create monkey

then you can choose the following template

| JavaScript | TypeScript |
| JavaScript | TypeScript |
| -------------------------------------------------------------- | -------------------------------------------------------------------- |
| [empty](/packages/create-monkey/template-empty) (only js) | [empty-ts](/packages/create-monkey/template-empty-ts) (only ts) |
| [vanilla](/packages/create-monkey/template-vanilla) (js + css) | [vanilla-ts](/packages/create-monkey/template-vanilla-ts) (ts + css) |
Expand Down Expand Up @@ -337,9 +337,7 @@ there is the following cdn to use, full detail see [cdn.ts](/packages/vite-plugi
- [jsdelivr](https://www.jsdelivr.com/)
- [unpkg](https://unpkg.com/)
- [bytecdntp](https://cdn.bytedance.com/)
- [bootcdn](https://www.bootcdn.cn/all/)
- [baomitu](https://cdn.baomitu.com/)
- [staticfile](https://staticfile.org/)
- [cdnjs](https://cdnjs.com/libraries)
- [zhimg](https://unpkg.zhimg.com/)
- [npmmirror](https://registry.npmmirror.com/)
Expand Down
4 changes: 1 addition & 3 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pnpm create monkey

然后你能从以下模板选择

| JavaScript | TypeScript |
| JavaScript | TypeScript |
| -------------------------------------------------------------- | -------------------------------------------------------------------- |
| [empty](/packages/create-monkey/template-empty) (only js) | [empty-ts](/packages/create-monkey/template-empty-ts) (only ts) |
| [vanilla](/packages/create-monkey/template-vanilla) (js + css) | [vanilla-ts](/packages/create-monkey/template-vanilla-ts) (ts + css) |
Expand Down Expand Up @@ -331,9 +331,7 @@ export default defineConfig({
- [jsdelivr](https://www.jsdelivr.com/)
- [unpkg](https://unpkg.com/)
- [bytecdntp](https://cdn.bytedance.com/)
- [bootcdn](https://www.bootcdn.cn/all/)
- [baomitu](https://cdn.baomitu.com/)
- [staticfile](https://staticfile.org/)
- [cdnjs](https://cdnjs.com/libraries)
- [zhimg](https://unpkg.zhimg.com/)
- [npmmirror](https://registry.npmmirror.com/)
Expand Down
12 changes: 7 additions & 5 deletions packages/vite-plugin-monkey/src/node/cdn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const bytecdntp = (
};

/**
* `https://cdn.jsdelivr.net/npm/${name}@${version}/${pathname}`
* `https://fastly.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 = (
Expand Down Expand Up @@ -125,19 +125,21 @@ export const baomitu = (
};

/**
* `https://cdn.staticfile.org/${name}/${version}/${pathname}`
* @param exportVarName cdn-exportVarName or resourceName
* @see https://staticfile.org/
* `https://fastly.jsdelivr.net/npm/${name}@${version}/${pathname}`
* @deprecated staticfile will return virus-infected code. Please stop using it and switch to other sources
*/
export const staticfile = (
exportVarName = '',
pathname = '',
): [string, ModuleToUrlFc] => {
console.warn(
'staticfile 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.staticfile.org/${name}/${version}/${p}`;
return `https://fastly.jsdelivr.net/npm/${name}@${version}/${p}`;
},
];
};
Expand Down

0 comments on commit b2ce17a

Please sign in to comment.