@vue/compiler-sfc
Advanced tools
Comparing version 3.0.0-beta.3 to 3.0.0-beta.4
@@ -672,4 +672,4 @@ 'use strict'; | ||
const scss = { | ||
render(source, map, options) { | ||
const nodeSass = require('sass'); | ||
render(source, map, options, load = require) { | ||
const nodeSass = load('sass'); | ||
const finalOptions = { | ||
@@ -699,7 +699,7 @@ ...options, | ||
const sass = { | ||
render(source, map, options) { | ||
render(source, map, options, load) { | ||
return scss.render(source, map, { | ||
...options, | ||
indentedSyntax: true | ||
}); | ||
}, load); | ||
} | ||
@@ -709,4 +709,4 @@ }; | ||
const less = { | ||
render(source, map, options) { | ||
const nodeLess = require('less'); | ||
render(source, map, options, load = require) { | ||
const nodeLess = load('less'); | ||
let result; | ||
@@ -732,4 +732,4 @@ let error = null; | ||
const styl = { | ||
render(source, map, options) { | ||
const nodeStylus = require('stylus'); | ||
render(source, map, options, load = require) { | ||
const nodeStylus = load('stylus'); | ||
try { | ||
@@ -763,3 +763,2 @@ const ref = nodeStylus(source); | ||
// const postcss = require('postcss') | ||
function compileStyle(options) { | ||
@@ -775,3 +774,3 @@ return doCompileStyle({ | ||
function doCompileStyle(options) { | ||
const { filename, id, scoped = true, trim = true, preprocessLang, postcssOptions, postcssPlugins } = options; | ||
const { filename, id, scoped = false, trim = true, modules = false, modulesOptions = {}, preprocessLang, postcssOptions, postcssPlugins } = options; | ||
const preprocessor = preprocessLang && processors[preprocessLang]; | ||
@@ -788,2 +787,16 @@ const preProcessedSource = preprocessor && preprocess$1(options, preprocessor); | ||
} | ||
let cssModules; | ||
if (modules) { | ||
if (options.isAsync) { | ||
plugins.push(require('postcss-modules')({ | ||
...modulesOptions, | ||
getJSON: (cssFileName, json) => { | ||
cssModules = json; | ||
} | ||
})); | ||
} | ||
else { | ||
throw new Error('`modules` option can only be used with compileStyleAsync().'); | ||
} | ||
} | ||
const postCSSOptions = { | ||
@@ -817,2 +830,3 @@ ...postcssOptions, | ||
errors, | ||
modules: cssModules, | ||
rawResult: result | ||
@@ -845,3 +859,3 @@ })) | ||
...options.preprocessOptions | ||
}); | ||
}, options.preprocessCustomRequire); | ||
} | ||
@@ -848,0 +862,0 @@ |
@@ -20,3 +20,3 @@ import { CodegenResult } from '@vue/compiler-core'; | ||
export declare function compileStyleAsync(options: SFCStyleCompileOptions): Promise<SFCStyleCompileResults>; | ||
export declare function compileStyleAsync(options: SFCAsyncStyleCompileOptions): Promise<SFCStyleCompileResults>; | ||
@@ -30,2 +30,14 @@ export declare function compileTemplate(options: SFCTemplateCompileOptions): SFCTemplateCompileResults; | ||
declare interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions { | ||
isAsync?: boolean; | ||
modules?: boolean; | ||
modulesOptions?: { | ||
scopeBehaviour?: 'global' | 'local'; | ||
globalModulePaths?: string[]; | ||
generateScopedName?: string | ((name: string, filename: string, css: string) => string); | ||
hashPrefix?: string; | ||
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly'; | ||
}; | ||
} | ||
export declare interface SFCBlock { | ||
@@ -81,2 +93,3 @@ type: string; | ||
preprocessOptions?: any; | ||
preprocessCustomRequire?: (id: string) => any; | ||
postcssOptions?: any; | ||
@@ -91,2 +104,3 @@ postcssPlugins?: any[]; | ||
errors: Error[]; | ||
modules?: Record<string, string>; | ||
} | ||
@@ -93,0 +107,0 @@ |
{ | ||
"name": "@vue/compiler-sfc", | ||
"version": "3.0.0-beta.3", | ||
"version": "3.0.0-beta.4", | ||
"description": "@vue/compiler-sfc", | ||
@@ -30,9 +30,9 @@ "main": "dist/compiler-sfc.cjs.js", | ||
"peerDependencies": { | ||
"vue": "3.0.0-beta.3" | ||
"vue": "3.0.0-beta.4" | ||
}, | ||
"dependencies": { | ||
"@vue/shared": "3.0.0-beta.3", | ||
"@vue/compiler-core": "3.0.0-beta.3", | ||
"@vue/compiler-dom": "3.0.0-beta.3", | ||
"@vue/compiler-ssr": "3.0.0-beta.3", | ||
"@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", | ||
"consolidate": "^0.15.1", | ||
@@ -42,3 +42,4 @@ "hash-sum": "^2.0.0", | ||
"merge-source-map": "^1.1.0", | ||
"postcss": "^7.0.21", | ||
"postcss": "^7.0.27", | ||
"postcss-modules": "^2.0.0", | ||
"postcss-selector-parser": "^6.0.2", | ||
@@ -45,0 +46,0 @@ "source-map": "^0.6.1" |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
38415
959
13
3
+ Addedpostcss-modules@^2.0.0
+ Added@vue/compiler-core@3.0.0-beta.4(transitive)
+ Added@vue/compiler-dom@3.0.0-beta.4(transitive)
+ Added@vue/compiler-ssr@3.0.0-beta.4(transitive)
+ Added@vue/reactivity@3.0.0-beta.4(transitive)
+ Added@vue/runtime-core@3.0.0-beta.4(transitive)
+ Added@vue/runtime-dom@3.0.0-beta.4(transitive)
+ Added@vue/shared@3.0.0-beta.4(transitive)
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.13.2.1(transitive)
+ Addedbig.js@5.2.2(transitive)
+ Addedchalk@1.1.32.4.2(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedcss-modules-loader-core@1.1.0(transitive)
+ Addedcss-selector-tokenizer@0.7.3(transitive)
+ Addedemojis-list@3.0.0(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedfastparse@1.1.2(transitive)
+ Addedgeneric-names@2.0.1(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhas-flag@1.0.03.0.0(transitive)
+ Addedicss-replace-symbols@1.1.0(transitive)
+ Addedjson5@1.0.2(transitive)
+ Addedloader-utils@1.4.2(transitive)
+ Addedlodash.camelcase@4.3.0(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedpostcss@6.0.16.0.23(transitive)
+ Addedpostcss-modules@2.0.0(transitive)
+ Addedpostcss-modules-extract-imports@1.1.0(transitive)
+ Addedpostcss-modules-local-by-default@1.2.0(transitive)
+ Addedpostcss-modules-scope@1.1.0(transitive)
+ Addedpostcss-modules-values@1.3.0(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedstring-hash@1.1.3(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.03.2.35.5.0(transitive)
+ Addedvue@3.0.0-beta.4(transitive)
- Removed@vue/compiler-core@3.0.0-beta.3(transitive)
- Removed@vue/compiler-dom@3.0.0-beta.3(transitive)
- Removed@vue/compiler-ssr@3.0.0-beta.3(transitive)
- Removed@vue/reactivity@3.0.0-beta.3(transitive)
- Removed@vue/runtime-core@3.0.0-beta.3(transitive)
- Removed@vue/runtime-dom@3.0.0-beta.3(transitive)
- Removed@vue/shared@3.0.0-beta.3(transitive)
- Removedvue@3.0.0-beta.3(transitive)
Updated@vue/shared@3.0.0-beta.4
Updatedpostcss@^7.0.27