fix(options): inferParser for standalone (#4721)

master
Ika 2018-06-22 12:43:44 +08:00 committed by GitHub
parent 5cfaba6a1c
commit f53b5b8323
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -44,6 +44,7 @@
"mem": "1.1.0",
"minimatch": "3.0.4",
"minimist": "1.2.0",
"normalize-path": "3.0.0",
"parse5": "3.0.3",
"postcss-less": "1.1.5",
"postcss-media-query-parser": "0.2.3",

View File

@ -1,6 +1,6 @@
"use strict";
const path = require("path");
const normalizePath = require("normalize-path");
const UndefinedParserError = require("../common/errors").UndefinedParserError;
const getSupportInfo = require("../main/support").getSupportInfo;
const normalizer = require("./options-normalizer");
@ -113,8 +113,9 @@ function getPlugin(options) {
}
function inferParser(filepath, plugins) {
const extension = path.extname(filepath);
const filename = path.basename(filepath).toLowerCase();
const filepathParts = normalizePath(filepath).split("/");
const filename = filepathParts[filepathParts.length - 1].toLowerCase();
const extension = filename.match(/((\.[^.]*)?)$/)[1];
const language = getSupportInfo(null, {
plugins

View File

@ -4193,6 +4193,10 @@ normalize-package-data@^2.3.4:
semver "2 || 3 || 4 || 5"
validate-npm-package-license "^3.0.1"
normalize-path@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
normalize-path@^2.0.1, normalize-path@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9"