@riotjs/compiler
Advanced tools
Comparing version 4.3.2 to 4.3.3
# Compiler Changes | ||
### v4.3.3 | ||
- Fix https://github.com/riot/compiler/issues/119 | ||
- Fix https://github.com/riot/riot/issues/2726 | ||
### v4.3.2 | ||
@@ -4,0 +8,0 @@ - Fix void tags will be automatically corrected for example: |
{ | ||
"name": "@riotjs/compiler", | ||
"version": "4.3.2", | ||
"version": "4.3.3", | ||
"description": "Compiler for riot .tag files", | ||
@@ -43,3 +43,3 @@ "main": "dist/index.js", | ||
"nyc": "^14.1.1", | ||
"rollup": "^1.16.3", | ||
"rollup": "^1.16.7", | ||
"rollup-plugin-alias": "^1.5.2", | ||
@@ -59,6 +59,7 @@ "rollup-plugin-commonjs": "^10.0.1", | ||
"dependencies": { | ||
"@riotjs/dom-bindings": "^4.2.2", | ||
"@riotjs/dom-bindings": "^4.2.4", | ||
"@riotjs/parser": "^4.0.3", | ||
"acorn": "^6.1.1", | ||
"acorn": "^6.2.0", | ||
"acorn-dynamic-import": "^4.0.0", | ||
"cssesc": "^3.0.0", | ||
"cumpa": "^1.0.1", | ||
@@ -65,0 +66,0 @@ "curri": "^1.0.1", |
import {builders, types} from '../../utils/build-types' | ||
import {TAG_CSS_PROPERTY} from '../../constants' | ||
import cssEscape from 'cssesc' | ||
import getPreprocessorTypeByAttribute from '../../utils/get-preprocessor-type-by-attribute' | ||
@@ -98,4 +99,8 @@ import preprocess from '../../utils/preprocess-node' | ||
const preprocessorOutput = preprocess('css', preprocessorName, meta, cssNode) | ||
const escapedCssIdentifier = cssEscape(meta.tagName, { | ||
isIdentifier: true | ||
}) | ||
const cssCode = (options.scopedCss ? | ||
scopedCSS(meta.tagName, preprocessorOutput.code) : | ||
scopedCSS(escapedCssIdentifier, preprocessorOutput.code) : | ||
preprocessorOutput.code | ||
@@ -102,0 +107,0 @@ ).trim() |
@@ -69,3 +69,3 @@ import { | ||
isBrowserAPI(node) || | ||
scope.lookup(getName(node)) | ||
isNodeInScope(scope, node) | ||
) | ||
@@ -75,2 +75,26 @@ } | ||
/** | ||
* Checks if the identifier of a given node exists in a scope | ||
* @param {Scope} scope - scope where to search for the identifier | ||
* @param {types.Node} node - node to search for the identifier | ||
* @returns {boolean} true if the node identifier is defined in the given scope | ||
*/ | ||
function isNodeInScope(scope, node) { | ||
const traverse = (isInScope = false) => { | ||
types.visit(node, { | ||
visitIdentifier(path) { | ||
if (scope.lookup(getName(path.node))) { | ||
isInScope = true | ||
} | ||
this.abort() | ||
} | ||
}) | ||
return isInScope | ||
} | ||
return traverse() | ||
} | ||
/** | ||
* Replace the path scope with a member Expression | ||
@@ -111,3 +135,3 @@ * @param { types.NodePath } path - containing the current node visited | ||
function visitMemberExpression(path) { | ||
if (!isGlobal({ node: path.node.object, scope: path.scope })) { | ||
if (!isGlobal(path) && !isGlobal({ node: path.node.object, scope: path.scope })) { | ||
if (isBinaryExpression(path.node.object)) { | ||
@@ -114,0 +138,0 @@ this.traverse(path.get('object')) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1463204
37183
11
+ Addedcssesc@^3.0.0
+ Addedcssesc@3.0.0(transitive)
Updated@riotjs/dom-bindings@^4.2.4
Updatedacorn@^6.2.0