@riotjs/compiler
Advanced tools
Comparing version 4.3.5 to 4.3.6
# Compiler Changes | ||
### v4.3.6 | ||
- Fix https://github.com/riot/compiler/issues/122 | ||
- Fix https://github.com/riot/compiler/pull/118 | ||
### v4.3.5 | ||
@@ -4,0 +8,0 @@ - Fix backslashed unicode css properties |
{ | ||
"name": "@riotjs/compiler", | ||
"version": "4.3.5", | ||
"version": "4.3.6", | ||
"description": "Compiler for riot .tag files", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.js", | ||
"debug": "mocha --inspect --inspect-brk -r esm test/*.spec.js test/**/*.spec.js", | ||
"prepublishOnly": "npm run build && npm run test" | ||
"prepublishOnly": "npm run build" | ||
}, | ||
@@ -38,11 +38,11 @@ "repository": { | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.4", | ||
"eslint": "^6.0.1", | ||
"eslint-config-riot": "^2.0.0", | ||
"coveralls": "^3.0.5", | ||
"eslint": "^6.1.0", | ||
"eslint-config-riot": "^3.0.0", | ||
"esm": "^3.2.25", | ||
"mocha": "^6.1.4", | ||
"mocha": "^6.2.0", | ||
"nyc": "^14.1.1", | ||
"rollup": "^1.16.7", | ||
"rollup": "^1.18.0", | ||
"rollup-plugin-alias": "^1.5.2", | ||
"rollup-plugin-commonjs": "^10.0.1", | ||
"rollup-plugin-commonjs": "^10.0.2", | ||
"rollup-plugin-json": "^4.0.0", | ||
@@ -60,5 +60,5 @@ "rollup-plugin-node-builtins": "^2.1.2", | ||
"dependencies": { | ||
"@riotjs/dom-bindings": "^4.2.4", | ||
"@riotjs/dom-bindings": "^4.2.5", | ||
"@riotjs/parser": "^4.0.3", | ||
"acorn": "^6.2.0", | ||
"acorn": "^6.2.1", | ||
"acorn-dynamic-import": "^4.0.0", | ||
@@ -68,4 +68,4 @@ "cssesc": "^3.0.0", | ||
"curri": "^1.0.1", | ||
"dom-nodes": "^1.0.0", | ||
"globals": "^11.12.0", | ||
"dom-nodes": "^1.1.3", | ||
"globals": "^12.0.0", | ||
"recast": "^0.18.1", | ||
@@ -72,0 +72,0 @@ "source-map": "^0.7.3" |
@@ -54,2 +54,3 @@ // import {IS_BOOLEAN,IS_CUSTOM,IS_RAW,IS_SPREAD,IS_VOID} from '@riotjs/parser/src/constants' | ||
export const SLOT_TAG_NODE_NAME = 'slot' | ||
export const PROGRESS_TAG_NODE_NAME = 'progress' | ||
@@ -56,0 +57,0 @@ // Riot Parser constants |
import { | ||
findDynamicAttributes, | ||
isEventAttribute, | ||
isProgressNode, | ||
isTextNode, | ||
@@ -10,10 +11,13 @@ isValueAttribute | ||
import eventExpression from './event' | ||
import {hasValueAttribute} from 'dom-nodes' | ||
import textExpression from './text' | ||
import valueExpression from './value' | ||
export function createExpression(sourceNode, sourceFile, sourceCode, childNodeIndex) { | ||
export function createExpression(sourceNode, sourceFile, sourceCode, childNodeIndex, parentNode) { | ||
switch (true) { | ||
case isTextNode(sourceNode): | ||
return textExpression(sourceNode, sourceFile, sourceCode, childNodeIndex) | ||
case isValueAttribute(sourceNode): | ||
// progress nodes value attributes will be rendered as attributes | ||
// see https://github.com/riot/compiler/issues/122 | ||
case isValueAttribute(sourceNode) && hasValueAttribute(parentNode.name) && !isProgressNode(parentNode): | ||
return valueExpression(sourceNode, sourceFile, sourceCode) | ||
@@ -36,3 +40,3 @@ case isEventAttribute(sourceNode): | ||
return findDynamicAttributes(sourceNode) | ||
.map(attribute => createExpression(attribute, sourceFile, sourceCode)) | ||
.map(attribute => createExpression(attribute, sourceFile, sourceCode, 0, sourceNode)) | ||
} |
@@ -14,2 +14,3 @@ import { | ||
KEY_ATTRIBUTE, | ||
PROGRESS_TAG_NODE_NAME, | ||
SCOPE, | ||
@@ -27,2 +28,3 @@ SLOT_ATTRIBUTE, | ||
isIdentifier, | ||
isNewExpression, | ||
isRaw, | ||
@@ -71,2 +73,3 @@ isThisExpression | ||
isBrowserAPI(node) || | ||
isNewExpression(node) || | ||
isNodeInScope(scope, node) | ||
@@ -141,3 +144,3 @@ ) | ||
this.traverse(path) | ||
} else { | ||
} else if (!path.node.object.callee) { | ||
replacePathScope(path, isThisExpression(path.node.object) ? path.node.property : path.node) | ||
@@ -518,2 +521,11 @@ } | ||
/** | ||
* True if the DOM node is a progress tag | ||
* @param {RiotParser.Node} node - riot parser node | ||
* @returns {boolean} true for the progress tags | ||
*/ | ||
export function isProgressNode(node) { | ||
return node.name === PROGRESS_TAG_NODE_NAME | ||
} | ||
/** | ||
* True if the node is an attribute and a DOM handler | ||
@@ -520,0 +532,0 @@ * @param {RiotParser.Node} node - riot parser node |
@@ -12,2 +12,3 @@ import globalScope from 'globals' | ||
export const isThisExpression = namedTypes.ThisExpression.check.bind(namedTypes.ThisExpression) | ||
export const isNewExpression = namedTypes.NewExpression.check.bind(namedTypes.NewExpression) | ||
export const isSequenceExpression = namedTypes.SequenceExpression.check.bind(namedTypes.SequenceExpression) | ||
@@ -19,2 +20,2 @@ export const isBinaryExpression = namedTypes.BinaryExpression.check.bind(namedTypes.BinaryExpression) | ||
export const isBuiltinAPI = ({name}) => builtinAPIs.includes(name) | ||
export const isRaw = (node) => node && node.raw | ||
export const isRaw = (node) => node && node.raw // eslint-disable-line |
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
1468013
37281
+ Addedglobals@12.4.0(transitive)
+ Addedtype-fest@0.8.1(transitive)
- Removedglobals@11.12.0(transitive)
Updated@riotjs/dom-bindings@^4.2.5
Updatedacorn@^6.2.1
Updateddom-nodes@^1.1.3
Updatedglobals@^12.0.0