svelte-preprocess
Advanced tools
Comparing version 4.6.7 to 4.6.8
@@ -0,1 +1,10 @@ | ||
## [4.6.8](https://github.com/sveltejs/svelte-preprocess/compare/v4.6.7...v4.6.8) (2021-02-11) | ||
### Bug Fixes | ||
* 🐛 make markup tag regexp less greedy ([64f3362](https://github.com/sveltejs/svelte-preprocess/commit/64f3362d27d0defdcc0fd684022ebacb49c1aaf4)), closes [#310](https://github.com/sveltejs/svelte-preprocess/issues/310) | ||
## [4.6.7](https://github.com/sveltejs/svelte-preprocess/compare/v4.6.5...v4.6.7) (2021-02-10) | ||
@@ -2,0 +11,0 @@ |
@@ -159,4 +159,5 @@ "use strict"; | ||
let { code, map, dependencies } = transformResult; | ||
const hasPostcss = await utils_1.hasDepInstalled('postcss'); | ||
// istanbul ignore else | ||
if (await utils_1.hasDepInstalled('postcss')) { | ||
if (hasPostcss) { | ||
if (transformers.postcss) { | ||
@@ -163,0 +164,0 @@ const { alias, lang } = language_1.getLanguage(attributes); |
@@ -7,3 +7,3 @@ "use strict"; | ||
markupTagName = markupTagName.toLocaleLowerCase(); | ||
const markupPattern = new RegExp(`<${markupTagName}([\\s\\S]*?)(?:>([\\s\\S]*)<\\/${markupTagName}>|/>)`); | ||
const markupPattern = new RegExp(`/<!--[^]*?-->|<${markupTagName}(\\s[^]*?)?(?:>([^]*?)<\\/${markupTagName}>|\\/>)`); | ||
const templateMatch = content.match(markupPattern); | ||
@@ -14,3 +14,3 @@ /** If no <template> was found, run the transformer over the whole thing */ | ||
} | ||
const [fullMatch, attributesStr, templateCode] = templateMatch; | ||
const [fullMatch, attributesStr = '', templateCode] = templateMatch; | ||
/** Transform an attribute string into a key-value object */ | ||
@@ -17,0 +17,0 @@ const attributes = attributesStr |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getTagInfo = void 0; | ||
const fs_1 = require("fs"); | ||
const fs_1 = __importStar(require("fs")); | ||
const path_1 = require("path"); | ||
const language_1 = require("./language"); | ||
const utils_1 = require("./utils"); | ||
const { access, readFile } = fs_1.promises; | ||
const resolveSrc = (importerFile, srcPath) => path_1.resolve(path_1.dirname(importerFile), srcPath); | ||
const getSrcContent = (file) => { | ||
return new Promise((resolve, reject) => { | ||
fs_1.readFile(file, (error, data) => { | ||
// istanbul ignore if | ||
if (error) | ||
reject(error); | ||
else | ||
resolve(data.toString()); | ||
}); | ||
}); | ||
}; | ||
async function doesFileExist(file) { | ||
return new Promise((resolve) => fs_1.access(file, 0, (err) => resolve(!err))); | ||
return access(file, fs_1.default.constants.F_OK) | ||
.then(() => true) | ||
.catch(() => false); | ||
} | ||
@@ -38,7 +49,7 @@ const getTagInfo = async ({ attributes, filename, content, }) => { | ||
if (await doesFileExist(path)) { | ||
content = await getSrcContent(path); | ||
content = (await readFile(path)).toString(); | ||
dependencies.push(path); | ||
} | ||
else { | ||
console.warn(`[svelte-preprocess] The file "${path}" was not found.`); | ||
console.warn(`[svelte-preprocess] The file "${path}" was not found.`); | ||
} | ||
@@ -45,0 +56,0 @@ } |
{ | ||
"name": "svelte-preprocess", | ||
"version": "4.6.7", | ||
"version": "4.6.8", | ||
"license": "MIT", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.js", | ||
"engines": { | ||
"node": ">= 9.11.2" | ||
"node": ">= 10.x" | ||
}, | ||
@@ -24,0 +24,0 @@ "files": [ |
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
121606
1804