mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-03 13:02:20 +00:00
Replace vue-svg-loader dependency with simple JS file (fixes a security alert) (#389)
This commit is contained in:
parent
330697bb98
commit
3c29633745
5 changed files with 244 additions and 15609 deletions
15827
frontend/package-lock.json
generated
15827
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -40,7 +40,6 @@
|
|||
"sass-loader": "^8.0.2",
|
||||
"typescript": "^4.4.2",
|
||||
"vue-loader": "^16.5.0",
|
||||
"vue-svg-loader": "^0.17.0-beta.2",
|
||||
"vue-template-compiler": "^2.6.14",
|
||||
"wasm-pack": "^0.10.1"
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
export function download(filename: string, fileData: string) {
|
||||
let type = "text/plain;charset=utf-8";
|
||||
if (filename.endsWith(".svg")) {
|
||||
type = "image/svg+xml;charset=utf-8";
|
||||
}
|
||||
const type = filename.endsWith(".svg") ? "image/svg+xml;charset=utf-8" : "text/plain;charset=utf-8";
|
||||
const blob = new Blob([fileData], { type });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const element = document.createElement("a");
|
||||
|
|
4
frontend/vue-svg-loader.js
Normal file
4
frontend/vue-svg-loader.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
module.exports = function VueSvgLoader(svg) {
|
||||
this.cacheable();
|
||||
return `<template>${svg}</template>`;
|
||||
};
|
|
@ -78,20 +78,22 @@ module.exports = {
|
|||
})
|
||||
);
|
||||
|
||||
// Vue SVG Loader enables importing .svg files into .vue single-file components and using them directly in the HTML
|
||||
// https://vue-svg-loader.js.org/
|
||||
// Change the loaders used by the Vue compilation process
|
||||
config.module
|
||||
// Replace Vue's existing base loader by first clearing it (https://cli.vuejs.org/guide/webpack.html#replacing-loaders-of-a-rule)
|
||||
// Replace Vue's existing base loader by first clearing it
|
||||
// https://cli.vuejs.org/guide/webpack.html#replacing-loaders-of-a-rule
|
||||
.rule("svg")
|
||||
.uses.clear()
|
||||
.end()
|
||||
// Add vue-loader as a loader
|
||||
// Add vue-loader as a loader for Vue single-file components
|
||||
// https://www.npmjs.com/package/vue-loader
|
||||
.use("vue-loader")
|
||||
.loader("vue-loader")
|
||||
.end()
|
||||
// Add vue-svg-loader as a loader
|
||||
.use("vue-svg-loader")
|
||||
.loader("vue-svg-loader")
|
||||
// Add vue-svg-loader as a loader for importing .svg files into Vue single-file components
|
||||
// Located in ./vue-svg-loader.js
|
||||
.use("./vue-svg-loader")
|
||||
.loader("./vue-svg-loader")
|
||||
.end();
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue