svelte-preprocess
Advanced tools
Comparing version 3.1.3 to 3.1.4
@@ -1,2 +0,2 @@ | ||
## [3.1.3](https://github.com/kaisermann/svelte-preprocess/compare/v3.1.1...v3.1.3) (2019-10-23) | ||
## [3.1.4](https://github.com/kaisermann/svelte-preprocess/compare/v3.1.2...v3.1.4) (2019-10-23) | ||
@@ -7,2 +7,10 @@ | ||
* :bug: Try to only include files with local paths ([4c2c4e3](https://github.com/kaisermann/svelte-preprocess/commit/4c2c4e317e8de62bc161e7a1626892f08e98ce82)) | ||
## [3.1.2](https://github.com/kaisermann/svelte-preprocess/compare/v3.1.1...v3.1.2) (2019-09-25) | ||
### Bug Fixes | ||
* 🐛 import less cjs instead of es6 ([bf8627f](https://github.com/kaisermann/svelte-preprocess/commit/bf8627f3f4bde0d598769a67de10194bbcf04701)) | ||
@@ -9,0 +17,0 @@ |
{ | ||
"name": "svelte-preprocess", | ||
"version": "3.1.3", | ||
"version": "3.1.4", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -1,2 +0,2 @@ | ||
const { readFile } = require('fs'); | ||
const { readFile, exists } = require('fs'); | ||
const { resolve, dirname, basename } = require('path'); | ||
@@ -26,5 +26,7 @@ | ||
const resolveSrc = (exports.resolveSrc = (importerFile, srcPath) => | ||
resolve(dirname(importerFile), srcPath)); | ||
const resolveSrc = (importerFile, srcPath) => | ||
resolve(dirname(importerFile), srcPath); | ||
const doesFileExist = path => new Promise(res => exists(path, res)); | ||
const getSrcContent = (exports.getSrcContent = file => { | ||
@@ -44,6 +46,8 @@ return new Promise((resolve, reject) => { | ||
/** Only try to get local files (path starts with ./ or ../) */ | ||
if (attributes.src.match(/^\.{1,2}\//)) { | ||
const file = resolveSrc(filename, attributes.src); | ||
content = await getSrcContent(file); | ||
dependencies.push(file); | ||
if (attributes.src.match(/^(https?:)?\/\//) == null) { | ||
const filepath = resolveSrc(filename, attributes.src); | ||
if (await doesFileExist(filepath)) { | ||
content = await getSrcContent(filepath); | ||
dependencies.push(filepath); | ||
} | ||
} | ||
@@ -50,0 +54,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48787
789