@vue/compiler-sfc
Advanced tools
Comparing version 3.0.0-beta.4 to 3.0.0-beta.5
@@ -8,7 +8,7 @@ 'use strict'; | ||
var sourceMap = require('source-map'); | ||
var LRUCache = _interopDefault(require('lru-cache')); | ||
var shared = require('@vue/shared'); | ||
var CompilerDOM = require('@vue/compiler-dom'); | ||
var compilerCore = require('@vue/compiler-core'); | ||
var url = require('url'); | ||
var consolidate = _interopDefault(require('consolidate')); | ||
var CompilerSSR = require('@vue/compiler-ssr'); | ||
var postcss = _interopDefault(require('postcss')); | ||
@@ -19,4 +19,4 @@ var selectorParser = _interopDefault(require('postcss-selector-parser')); | ||
const SFC_CACHE_MAX_SIZE = 500; | ||
const sourceToSFC = new LRUCache(SFC_CACHE_MAX_SIZE); | ||
function parse(source, { sourceMap = true, filename = 'component.vue', sourceRoot = '', pad = false, compiler = require('@vue/compiler-dom') } = {}) { | ||
const sourceToSFC = new (require('lru-cache'))(SFC_CACHE_MAX_SIZE); | ||
function parse(source, { sourceMap = true, filename = 'component.vue', sourceRoot = '', pad = false, compiler = CompilerDOM } = {}) { | ||
const sourceKey = source + sourceMap + filename + sourceRoot + pad + compiler.parse; | ||
@@ -380,4 +380,8 @@ const cache = sourceToSFC.get(sourceKey); | ||
function compileTemplate(options) { | ||
const { preprocessLang } = options; | ||
const preprocessor = preprocessLang && consolidate[preprocessLang]; | ||
const { preprocessLang, preprocessCustomRequire } = options; | ||
const preprocessor = preprocessLang | ||
? preprocessCustomRequire | ||
? preprocessCustomRequire(preprocessLang) | ||
: require('consolidate')[preprocessLang] | ||
: false; | ||
if (preprocessor) { | ||
@@ -415,3 +419,3 @@ try { | ||
} | ||
function doCompileTemplate({ filename, inMap, source, ssr = false, compiler = ssr ? require('@vue/compiler-ssr') : require('@vue/compiler-dom'), compilerOptions = {}, transformAssetUrls }) { | ||
function doCompileTemplate({ filename, inMap, source, ssr = false, compiler = ssr ? CompilerSSR : CompilerDOM, compilerOptions = {}, transformAssetUrls }) { | ||
const errors = []; | ||
@@ -787,13 +791,11 @@ let nodeTransforms = []; | ||
if (modules) { | ||
if (options.isAsync) { | ||
plugins.push(require('postcss-modules')({ | ||
...modulesOptions, | ||
getJSON: (cssFileName, json) => { | ||
cssModules = json; | ||
} | ||
})); | ||
if (!options.isAsync) { | ||
throw new Error('[@vue/compiler-sfc] `modules` option can only be used with compileStyleAsync().'); | ||
} | ||
else { | ||
throw new Error('`modules` option can only be used with compileStyleAsync().'); | ||
} | ||
plugins.push(require('postcss-modules')({ | ||
...modulesOptions, | ||
getJSON: (_cssFileName, json) => { | ||
cssModules = json; | ||
} | ||
})); | ||
} | ||
@@ -800,0 +802,0 @@ const postCSSOptions = { |
@@ -29,3 +29,3 @@ import { CodegenResult } from '@vue/compiler-core'; | ||
declare interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions { | ||
export declare interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions { | ||
isAsync?: boolean; | ||
@@ -119,2 +119,3 @@ modules?: boolean; | ||
preprocessOptions?: any; | ||
preprocessCustomRequire?: (id: string) => any; | ||
transformAssetUrls?: AssetURLOptions | boolean; | ||
@@ -121,0 +122,0 @@ } |
{ | ||
"name": "@vue/compiler-sfc", | ||
"version": "3.0.0-beta.4", | ||
"version": "3.0.0-beta.5", | ||
"description": "@vue/compiler-sfc", | ||
@@ -11,6 +11,10 @@ "main": "dist/compiler-sfc.cjs.js", | ||
"buildOptions": { | ||
"name": "VueCompilerSFC", | ||
"formats": [ | ||
"cjs", | ||
"global", | ||
"esm-browser" | ||
], | ||
"prod": false, | ||
"formats": [ | ||
"cjs" | ||
] | ||
"enableNonBrowserBranches": true | ||
}, | ||
@@ -31,9 +35,9 @@ "repository": { | ||
"peerDependencies": { | ||
"vue": "3.0.0-beta.4" | ||
"vue": "3.0.0-beta.5" | ||
}, | ||
"dependencies": { | ||
"@vue/compiler-core": "3.0.0-beta.4", | ||
"@vue/compiler-dom": "3.0.0-beta.4", | ||
"@vue/compiler-ssr": "3.0.0-beta.4", | ||
"@vue/shared": "3.0.0-beta.4", | ||
"@vue/compiler-core": "3.0.0-beta.5", | ||
"@vue/compiler-dom": "3.0.0-beta.5", | ||
"@vue/compiler-ssr": "3.0.0-beta.5", | ||
"@vue/shared": "3.0.0-beta.5", | ||
"consolidate": "^0.15.1", | ||
@@ -40,0 +44,0 @@ "hash-sum": "^2.0.0", |
@@ -9,4 +9,8 @@ # @vue/compiler-sfc | ||
## Browser Build Usage | ||
This package relies on `postcss`, `postcss-selector-parser` and `postcss-modules` | ||
## API | ||
TODO |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
High entropy strings
Supply chain riskContains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.
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
2128979
6
58446
16
8
2
+ Added@vue/compiler-core@3.0.0-beta.5(transitive)
+ Added@vue/compiler-dom@3.0.0-beta.5(transitive)
+ Added@vue/compiler-ssr@3.0.0-beta.5(transitive)
+ Added@vue/reactivity@3.0.0-beta.5(transitive)
+ Added@vue/runtime-core@3.0.0-beta.5(transitive)
+ Added@vue/runtime-dom@3.0.0-beta.5(transitive)
+ Added@vue/shared@3.0.0-beta.5(transitive)
+ Addedvue@3.0.0-beta.5(transitive)
- Removed@vue/compiler-core@3.0.0-beta.4(transitive)
- Removed@vue/compiler-dom@3.0.0-beta.4(transitive)
- Removed@vue/compiler-ssr@3.0.0-beta.4(transitive)
- Removed@vue/reactivity@3.0.0-beta.4(transitive)
- Removed@vue/runtime-core@3.0.0-beta.4(transitive)
- Removed@vue/runtime-dom@3.0.0-beta.4(transitive)
- Removed@vue/shared@3.0.0-beta.4(transitive)
- Removedvue@3.0.0-beta.4(transitive)
Updated@vue/shared@3.0.0-beta.5