$
This commit is contained in:
13
node_modules/@riotjs/compiler/src/utils/add-lines-offset.js
generated
vendored
Normal file
13
node_modules/@riotjs/compiler/src/utils/add-lines-offset.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import getLineAndColumnByPosition from './get-line-and-column-by-position'
|
||||
|
||||
/**
|
||||
* Add the offset to the code that must be parsed in order to generate properly the sourcemaps
|
||||
* @param {string} input - input string
|
||||
* @param {string} source - original source code
|
||||
* @param {RiotParser.Node} node - node that we are going to transform
|
||||
* @return {string} the input string with the offset properly set
|
||||
*/
|
||||
export default function addLineOffset(input, source, node) {
|
||||
const {column, line} = getLineAndColumnByPosition(source, node.start)
|
||||
return `${'\n'.repeat(line - 1)}${' '.repeat(column + 1)}${input}`
|
||||
}
|
27
node_modules/@riotjs/compiler/src/utils/ast-nodes-checks.js
generated
vendored
Normal file
27
node_modules/@riotjs/compiler/src/utils/ast-nodes-checks.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import {builtin} from 'globals/globals.json'
|
||||
import {namedTypes} from './build-types'
|
||||
|
||||
const browserAPIs = ['window', 'document', 'console']
|
||||
const builtinAPIs = Object.keys(builtin)
|
||||
|
||||
export const isIdentifier = n => namedTypes.Identifier.check(n)
|
||||
export const isLiteral = n => namedTypes.Literal.check(n)
|
||||
export const isExpressionStatement = n => namedTypes.ExpressionStatement.check(n)
|
||||
export const isThisExpression = n => namedTypes.ThisExpression.check(n)
|
||||
export const isObjectExpression = n => namedTypes.ObjectExpression.check(n)
|
||||
export const isThisExpressionStatement = n =>
|
||||
isExpressionStatement(n) &&
|
||||
isMemberExpression(n.expression.left) &&
|
||||
isThisExpression(n.expression.left.object)
|
||||
export const isNewExpression = n => namedTypes.NewExpression.check(n)
|
||||
export const isSequenceExpression = n => namedTypes.SequenceExpression.check(n)
|
||||
export const isExportDefaultStatement = n => namedTypes.ExportDefaultDeclaration.check(n)
|
||||
export const isMemberExpression = n => namedTypes.MemberExpression.check(n)
|
||||
export const isImportDeclaration = n => namedTypes.ImportDeclaration.check(n)
|
||||
export const isTypeAliasDeclaration = n => namedTypes.TSTypeAliasDeclaration.check(n)
|
||||
export const isInterfaceDeclaration = n => namedTypes.TSInterfaceDeclaration.check(n)
|
||||
export const isExportNamedDeclaration = n => namedTypes.ExportNamedDeclaration.check(n)
|
||||
|
||||
export const isBrowserAPI = ({name}) => browserAPIs.includes(name)
|
||||
export const isBuiltinAPI = ({name}) => builtinAPIs.includes(name)
|
||||
export const isRaw = n => n && n.raw
|
5
node_modules/@riotjs/compiler/src/utils/build-types.js
generated
vendored
Normal file
5
node_modules/@riotjs/compiler/src/utils/build-types.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import {types as astTypes} from 'recast'
|
||||
|
||||
export const types = astTypes
|
||||
export const builders = astTypes.builders
|
||||
export const namedTypes = astTypes.namedTypes
|
8
node_modules/@riotjs/compiler/src/utils/clone-deep.js
generated
vendored
Normal file
8
node_modules/@riotjs/compiler/src/utils/clone-deep.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Simple clone deep function, do not use it for classes or recursive objects!
|
||||
* @param {*} source - possibily an object to clone
|
||||
* @returns {*} the object we wanted to clone
|
||||
*/
|
||||
export default function cloneDeep(source) {
|
||||
return JSON.parse(JSON.stringify(source))
|
||||
}
|
22
node_modules/@riotjs/compiler/src/utils/compose-sourcemaps.js
generated
vendored
Normal file
22
node_modules/@riotjs/compiler/src/utils/compose-sourcemaps.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import asJSON from './sourcemap-as-json'
|
||||
import {composeSourceMaps} from 'recast/lib/util'
|
||||
import {isNode} from '@riotjs/util/checks'
|
||||
|
||||
/**
|
||||
* Compose two sourcemaps
|
||||
* @param { SourceMapGenerator } formerMap - original sourcemap
|
||||
* @param { SourceMapGenerator } latterMap - target sourcemap
|
||||
* @returns { Object } sourcemap json
|
||||
*/
|
||||
export default function composeSourcemaps(formerMap, latterMap) {
|
||||
if (
|
||||
isNode() &&
|
||||
formerMap && latterMap && latterMap.mappings
|
||||
) {
|
||||
return composeSourceMaps(asJSON(formerMap), asJSON(latterMap))
|
||||
} else if (isNode() && formerMap) {
|
||||
return asJSON(formerMap)
|
||||
}
|
||||
|
||||
return {}
|
||||
}
|
10
node_modules/@riotjs/compiler/src/utils/create-sourcemap.js
generated
vendored
Normal file
10
node_modules/@riotjs/compiler/src/utils/create-sourcemap.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { SourceMapGenerator } from 'source-map'
|
||||
|
||||
/**
|
||||
* Create a new sourcemap generator
|
||||
* @param { Object } options - sourcemap options
|
||||
* @returns { SourceMapGenerator } SourceMapGenerator instance
|
||||
*/
|
||||
export default function createSourcemap(options) {
|
||||
return new SourceMapGenerator(options)
|
||||
}
|
12
node_modules/@riotjs/compiler/src/utils/custom-ast-nodes.js
generated
vendored
Normal file
12
node_modules/@riotjs/compiler/src/utils/custom-ast-nodes.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import {builders} from './build-types'
|
||||
|
||||
export function nullNode() {
|
||||
return builders.literal(null)
|
||||
}
|
||||
|
||||
export function simplePropertyNode(key, value) {
|
||||
const property = builders.property('init', builders.identifier(key), value, false)
|
||||
|
||||
property.sho
|
||||
return property
|
||||
}
|
19
node_modules/@riotjs/compiler/src/utils/generate-ast.js
generated
vendored
Normal file
19
node_modules/@riotjs/compiler/src/utils/generate-ast.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import {parse as customParser} from 'recast/parsers/typescript'
|
||||
import {parse} from 'recast'
|
||||
/**
|
||||
* Parse a js source to generate the AST
|
||||
* @param {string} source - javascript source
|
||||
* @param {Object} options - parser options
|
||||
* @returns {AST} AST tree
|
||||
*/
|
||||
export default function generateAST(source, options) {
|
||||
return parse(source, {
|
||||
parser: {
|
||||
parse: (source, opts) => customParser(source, {
|
||||
...opts,
|
||||
ecmaVersion: 'latest'
|
||||
})
|
||||
},
|
||||
...options
|
||||
})
|
||||
}
|
22
node_modules/@riotjs/compiler/src/utils/generate-javascript.js
generated
vendored
Normal file
22
node_modules/@riotjs/compiler/src/utils/generate-javascript.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import {parse as customParser} from 'recast/parsers/typescript'
|
||||
import {print} from 'recast'
|
||||
/**
|
||||
* Generate the javascript from an ast source
|
||||
* @param {AST} ast - ast object
|
||||
* @param {Object} options - printer options
|
||||
* @returns {Object} code + map
|
||||
*/
|
||||
export default function generateJavascript(ast, options) {
|
||||
return print(ast, {
|
||||
...options,
|
||||
parser: {
|
||||
parse: (source, opts) => customParser(source, {
|
||||
...opts,
|
||||
ecmaVersion: 'latest'
|
||||
})
|
||||
},
|
||||
tabWidth: 2,
|
||||
wrapColumn: 0,
|
||||
quote: 'single'
|
||||
})
|
||||
}
|
16
node_modules/@riotjs/compiler/src/utils/get-line-and-column-by-position.js
generated
vendored
Normal file
16
node_modules/@riotjs/compiler/src/utils/get-line-and-column-by-position.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import splitStringByEOL from './split-string-by-EOL'
|
||||
|
||||
/**
|
||||
* Get the line and the column of a source text based on its position in the string
|
||||
* @param { string } string - target string
|
||||
* @param { number } position - target position
|
||||
* @returns { Object } object containing the source text line and column
|
||||
*/
|
||||
export default function getLineAndColumnByPosition(string, position) {
|
||||
const lines = splitStringByEOL(string.slice(0, position))
|
||||
|
||||
return {
|
||||
line: lines.length,
|
||||
column: lines[lines.length - 1].length
|
||||
}
|
||||
}
|
24
node_modules/@riotjs/compiler/src/utils/get-preprocessor-type-by-attribute.js
generated
vendored
Normal file
24
node_modules/@riotjs/compiler/src/utils/get-preprocessor-type-by-attribute.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
const ATTRIBUTE_TYPE_NAME = 'type'
|
||||
|
||||
/**
|
||||
* Get the type attribute from a node generated by the riot parser
|
||||
* @param { Object} sourceNode - riot parser node
|
||||
* @returns { string|null } a valid type to identify the preprocessor to use or nothing
|
||||
*/
|
||||
export default function getPreprocessorTypeByAttribute(sourceNode) {
|
||||
const typeAttribute = sourceNode.attributes ?
|
||||
sourceNode.attributes.find(attribute => attribute.name === ATTRIBUTE_TYPE_NAME) :
|
||||
null
|
||||
|
||||
return typeAttribute ? normalize(typeAttribute.value) : null
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the noise in case a user has defined the preprocessor type='text/scss'
|
||||
* @param { string } value - input string
|
||||
* @returns { string } normalized string
|
||||
*/
|
||||
function normalize(value) {
|
||||
return value.replace('text/', '')
|
||||
}
|
30
node_modules/@riotjs/compiler/src/utils/has-html-outside-root-node.js
generated
vendored
Normal file
30
node_modules/@riotjs/compiler/src/utils/has-html-outside-root-node.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import {isObject} from '@riotjs/util/checks'
|
||||
/**
|
||||
* Find whether there is html code outside of the root node
|
||||
* @param {RiotParser.Node} root - node generated by the riot compiler
|
||||
* @param {string} code - riot tag source code
|
||||
* @param {Function} parse - riot parser function
|
||||
* @returns {boolean} true if extra markup is detected
|
||||
*/
|
||||
export default function hasHTMLOutsideRootNode(root, code, parse) {
|
||||
const additionalCode = root ? [
|
||||
// head
|
||||
code.substr(0, root.start),
|
||||
// tail
|
||||
code.substr(root.end, code.length)
|
||||
].join('').trim() : ''
|
||||
|
||||
if (additionalCode) {
|
||||
// if there are parsing errors we assume that there are no html
|
||||
// tags outside of the root node
|
||||
try {
|
||||
const { template, javascript, css } = parse(additionalCode).output
|
||||
|
||||
return [template, javascript, css].some(isObject)
|
||||
} catch (error) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
50
node_modules/@riotjs/compiler/src/utils/html-entities/encode.js
generated
vendored
Normal file
50
node_modules/@riotjs/compiler/src/utils/html-entities/encode.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import entities from './entities.json'
|
||||
|
||||
const HTMLEntityRe = /&(\S+);/g
|
||||
const HEX_NUMBER = /^[\da-fA-F]+$/
|
||||
const DECIMAL_NUMBER = /^\d+$/
|
||||
|
||||
/**
|
||||
* Encode unicode hex html entities like for example Ȣ
|
||||
* @param {string} string - input string
|
||||
* @returns {string} encoded string
|
||||
*/
|
||||
export function encodeHex(string) {
|
||||
const hex = string.substr(2)
|
||||
|
||||
return HEX_NUMBER.test(hex) ?
|
||||
String.fromCodePoint(parseInt(hex, 16)) :
|
||||
string
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode unicode decimal html entities like for example Þ
|
||||
* @param {string} string - input string
|
||||
* @returns {string} encoded string
|
||||
*/
|
||||
export function encodeDecimal(string) {
|
||||
const nr = string.substr(1)
|
||||
|
||||
return DECIMAL_NUMBER.test(nr) ?
|
||||
String.fromCodePoint(parseInt(nr, 10))
|
||||
: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode html entities in strings like
|
||||
* @param {string} string - input string
|
||||
* @returns {string} encoded string
|
||||
*/
|
||||
export default function encodeHTMLEntities(string) {
|
||||
return string.replace(HTMLEntityRe, (match, entity) => {
|
||||
const [firstChar, secondChar] = entity
|
||||
|
||||
if (firstChar === '#') {
|
||||
return secondChar === 'x' ?
|
||||
encodeHex(entity) :
|
||||
encodeDecimal(entity)
|
||||
} else {
|
||||
return entities[entity] || entity
|
||||
}
|
||||
})
|
||||
}
|
255
node_modules/@riotjs/compiler/src/utils/html-entities/entities.json
generated
vendored
Normal file
255
node_modules/@riotjs/compiler/src/utils/html-entities/entities.json
generated
vendored
Normal file
@@ -0,0 +1,255 @@
|
||||
{
|
||||
"quot": "\u0022",
|
||||
"amp": "&",
|
||||
"apos": "\u0027",
|
||||
"lt": "<",
|
||||
"gt": ">",
|
||||
"nbsp": "\u00A0",
|
||||
"iexcl": "\u00A1",
|
||||
"cent": "\u00A2",
|
||||
"pound": "\u00A3",
|
||||
"curren": "\u00A4",
|
||||
"yen": "\u00A5",
|
||||
"brvbar": "\u00A6",
|
||||
"sect": "\u00A7",
|
||||
"uml": "\u00A8",
|
||||
"copy": "\u00A9",
|
||||
"ordf": "\u00AA",
|
||||
"laquo": "\u00AB",
|
||||
"not": "\u00AC",
|
||||
"shy": "\u00AD",
|
||||
"reg": "\u00AE",
|
||||
"macr": "\u00AF",
|
||||
"deg": "\u00B0",
|
||||
"plusmn": "\u00B1",
|
||||
"sup2": "\u00B2",
|
||||
"sup3": "\u00B3",
|
||||
"acute": "\u00B4",
|
||||
"micro": "\u00B5",
|
||||
"para": "\u00B6",
|
||||
"middot": "\u00B7",
|
||||
"cedil": "\u00B8",
|
||||
"sup1": "\u00B9",
|
||||
"ordm": "\u00BA",
|
||||
"raquo": "\u00BB",
|
||||
"frac14": "\u00BC",
|
||||
"frac12": "\u00BD",
|
||||
"frac34": "\u00BE",
|
||||
"iquest": "\u00BF",
|
||||
"Agrave": "\u00C0",
|
||||
"Aacute": "\u00C1",
|
||||
"Acirc": "\u00C2",
|
||||
"Atilde": "\u00C3",
|
||||
"Auml": "\u00C4",
|
||||
"Aring": "\u00C5",
|
||||
"AElig": "\u00C6",
|
||||
"Ccedil": "\u00C7",
|
||||
"Egrave": "\u00C8",
|
||||
"Eacute": "\u00C9",
|
||||
"Ecirc": "\u00CA",
|
||||
"Euml": "\u00CB",
|
||||
"Igrave": "\u00CC",
|
||||
"Iacute": "\u00CD",
|
||||
"Icirc": "\u00CE",
|
||||
"Iuml": "\u00CF",
|
||||
"ETH": "\u00D0",
|
||||
"Ntilde": "\u00D1",
|
||||
"Ograve": "\u00D2",
|
||||
"Oacute": "\u00D3",
|
||||
"Ocirc": "\u00D4",
|
||||
"Otilde": "\u00D5",
|
||||
"Ouml": "\u00D6",
|
||||
"times": "\u00D7",
|
||||
"Oslash": "\u00D8",
|
||||
"Ugrave": "\u00D9",
|
||||
"Uacute": "\u00DA",
|
||||
"Ucirc": "\u00DB",
|
||||
"Uuml": "\u00DC",
|
||||
"Yacute": "\u00DD",
|
||||
"THORN": "\u00DE",
|
||||
"szlig": "\u00DF",
|
||||
"agrave": "\u00E0",
|
||||
"aacute": "\u00E1",
|
||||
"acirc": "\u00E2",
|
||||
"atilde": "\u00E3",
|
||||
"auml": "\u00E4",
|
||||
"aring": "\u00E5",
|
||||
"aelig": "\u00E6",
|
||||
"ccedil": "\u00E7",
|
||||
"egrave": "\u00E8",
|
||||
"eacute": "\u00E9",
|
||||
"ecirc": "\u00EA",
|
||||
"euml": "\u00EB",
|
||||
"igrave": "\u00EC",
|
||||
"iacute": "\u00ED",
|
||||
"icirc": "\u00EE",
|
||||
"iuml": "\u00EF",
|
||||
"eth": "\u00F0",
|
||||
"ntilde": "\u00F1",
|
||||
"ograve": "\u00F2",
|
||||
"oacute": "\u00F3",
|
||||
"ocirc": "\u00F4",
|
||||
"otilde": "\u00F5",
|
||||
"ouml": "\u00F6",
|
||||
"divide": "\u00F7",
|
||||
"oslash": "\u00F8",
|
||||
"ugrave": "\u00F9",
|
||||
"uacute": "\u00FA",
|
||||
"ucirc": "\u00FB",
|
||||
"uuml": "\u00FC",
|
||||
"yacute": "\u00FD",
|
||||
"thorn": "\u00FE",
|
||||
"yuml": "\u00FF",
|
||||
"OElig": "\u0152",
|
||||
"oelig": "\u0153",
|
||||
"Scaron": "\u0160",
|
||||
"scaron": "\u0161",
|
||||
"Yuml": "\u0178",
|
||||
"fnof": "\u0192",
|
||||
"circ": "\u02C6",
|
||||
"tilde": "\u02DC",
|
||||
"Alpha": "\u0391",
|
||||
"Beta": "\u0392",
|
||||
"Gamma": "\u0393",
|
||||
"Delta": "\u0394",
|
||||
"Epsilon": "\u0395",
|
||||
"Zeta": "\u0396",
|
||||
"Eta": "\u0397",
|
||||
"Theta": "\u0398",
|
||||
"Iota": "\u0399",
|
||||
"Kappa": "\u039A",
|
||||
"Lambda": "\u039B",
|
||||
"Mu": "\u039C",
|
||||
"Nu": "\u039D",
|
||||
"Xi": "\u039E",
|
||||
"Omicron": "\u039F",
|
||||
"Pi": "\u03A0",
|
||||
"Rho": "\u03A1",
|
||||
"Sigma": "\u03A3",
|
||||
"Tau": "\u03A4",
|
||||
"Upsilon": "\u03A5",
|
||||
"Phi": "\u03A6",
|
||||
"Chi": "\u03A7",
|
||||
"Psi": "\u03A8",
|
||||
"Omega": "\u03A9",
|
||||
"alpha": "\u03B1",
|
||||
"beta": "\u03B2",
|
||||
"gamma": "\u03B3",
|
||||
"delta": "\u03B4",
|
||||
"epsilon": "\u03B5",
|
||||
"zeta": "\u03B6",
|
||||
"eta": "\u03B7",
|
||||
"theta": "\u03B8",
|
||||
"iota": "\u03B9",
|
||||
"kappa": "\u03BA",
|
||||
"lambda": "\u03BB",
|
||||
"mu": "\u03BC",
|
||||
"nu": "\u03BD",
|
||||
"xi": "\u03BE",
|
||||
"omicron": "\u03BF",
|
||||
"pi": "\u03C0",
|
||||
"rho": "\u03C1",
|
||||
"sigmaf": "\u03C2",
|
||||
"sigma": "\u03C3",
|
||||
"tau": "\u03C4",
|
||||
"upsilon": "\u03C5",
|
||||
"phi": "\u03C6",
|
||||
"chi": "\u03C7",
|
||||
"psi": "\u03C8",
|
||||
"omega": "\u03C9",
|
||||
"thetasym": "\u03D1",
|
||||
"upsih": "\u03D2",
|
||||
"piv": "\u03D6",
|
||||
"ensp": "\u2002",
|
||||
"emsp": "\u2003",
|
||||
"thinsp": "\u2009",
|
||||
"zwnj": "\u200C",
|
||||
"zwj": "\u200D",
|
||||
"lrm": "\u200E",
|
||||
"rlm": "\u200F",
|
||||
"ndash": "\u2013",
|
||||
"mdash": "\u2014",
|
||||
"lsquo": "\u2018",
|
||||
"rsquo": "\u2019",
|
||||
"sbquo": "\u201A",
|
||||
"ldquo": "\u201C",
|
||||
"rdquo": "\u201D",
|
||||
"bdquo": "\u201E",
|
||||
"dagger": "\u2020",
|
||||
"Dagger": "\u2021",
|
||||
"bull": "\u2022",
|
||||
"hellip": "\u2026",
|
||||
"permil": "\u2030",
|
||||
"prime": "\u2032",
|
||||
"Prime": "\u2033",
|
||||
"lsaquo": "\u2039",
|
||||
"rsaquo": "\u203A",
|
||||
"oline": "\u203E",
|
||||
"frasl": "\u2044",
|
||||
"euro": "\u20AC",
|
||||
"image": "\u2111",
|
||||
"weierp": "\u2118",
|
||||
"real": "\u211C",
|
||||
"trade": "\u2122",
|
||||
"alefsym": "\u2135",
|
||||
"larr": "\u2190",
|
||||
"uarr": "\u2191",
|
||||
"rarr": "\u2192",
|
||||
"darr": "\u2193",
|
||||
"harr": "\u2194",
|
||||
"crarr": "\u21B5",
|
||||
"lArr": "\u21D0",
|
||||
"uArr": "\u21D1",
|
||||
"rArr": "\u21D2",
|
||||
"dArr": "\u21D3",
|
||||
"hArr": "\u21D4",
|
||||
"forall": "\u2200",
|
||||
"part": "\u2202",
|
||||
"exist": "\u2203",
|
||||
"empty": "\u2205",
|
||||
"nabla": "\u2207",
|
||||
"isin": "\u2208",
|
||||
"notin": "\u2209",
|
||||
"ni": "\u220B",
|
||||
"prod": "\u220F",
|
||||
"sum": "\u2211",
|
||||
"minus": "\u2212",
|
||||
"lowast": "\u2217",
|
||||
"radic": "\u221A",
|
||||
"prop": "\u221D",
|
||||
"infin": "\u221E",
|
||||
"ang": "\u2220",
|
||||
"and": "\u2227",
|
||||
"or": "\u2228",
|
||||
"cap": "\u2229",
|
||||
"cup": "\u222A",
|
||||
"int": "\u222B",
|
||||
"there4": "\u2234",
|
||||
"sim": "\u223C",
|
||||
"cong": "\u2245",
|
||||
"asymp": "\u2248",
|
||||
"ne": "\u2260",
|
||||
"equiv": "\u2261",
|
||||
"le": "\u2264",
|
||||
"ge": "\u2265",
|
||||
"sub": "\u2282",
|
||||
"sup": "\u2283",
|
||||
"nsub": "\u2284",
|
||||
"sube": "\u2286",
|
||||
"supe": "\u2287",
|
||||
"oplus": "\u2295",
|
||||
"otimes": "\u2297",
|
||||
"perp": "\u22A5",
|
||||
"sdot": "\u22C5",
|
||||
"lceil": "\u2308",
|
||||
"rceil": "\u2309",
|
||||
"lfloor": "\u230A",
|
||||
"rfloor": "\u230B",
|
||||
"lang": "\u2329",
|
||||
"rang": "\u232A",
|
||||
"loz": "\u25CA",
|
||||
"spades": "\u2660",
|
||||
"clubs": "\u2663",
|
||||
"hearts": "\u2665",
|
||||
"diams": "\u2666"
|
||||
}
|
8
node_modules/@riotjs/compiler/src/utils/is-empty-array.js
generated
vendored
Normal file
8
node_modules/@riotjs/compiler/src/utils/is-empty-array.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Ckeck if an Array-like object has empty length
|
||||
* @param {Array} target - Array-like object
|
||||
* @returns {boolean} target is empty or null
|
||||
*/
|
||||
export default function isEmptyArray(target) {
|
||||
return !target || !target.length
|
||||
}
|
10
node_modules/@riotjs/compiler/src/utils/is-empty-sourcemap.js
generated
vendored
Normal file
10
node_modules/@riotjs/compiler/src/utils/is-empty-sourcemap.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import isEmptyArray from './is-empty-array'
|
||||
|
||||
/**
|
||||
* True if the sourcemap has no mappings, it is empty
|
||||
* @param {Object} map - sourcemap json
|
||||
* @returns {boolean} true if empty
|
||||
*/
|
||||
export default function isEmptySourcemap(map) {
|
||||
return !map || isEmptyArray(map.mappings)
|
||||
}
|
7
node_modules/@riotjs/compiler/src/utils/mock/assert-mock-api.js
generated
vendored
Normal file
7
node_modules/@riotjs/compiler/src/utils/mock/assert-mock-api.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
const assert = {
|
||||
ok: () => true,
|
||||
strictEqual: () => true,
|
||||
deepEqual: () => true
|
||||
}
|
||||
|
||||
export default assert
|
1
node_modules/@riotjs/compiler/src/utils/mock/os-mock-api.js
generated
vendored
Normal file
1
node_modules/@riotjs/compiler/src/utils/mock/os-mock-api.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const EOL = '\n'
|
19
node_modules/@riotjs/compiler/src/utils/mock/sourcemap-mock-api.js
generated
vendored
Normal file
19
node_modules/@riotjs/compiler/src/utils/mock/sourcemap-mock-api.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// mock the sourcemaps api for the browser bundle
|
||||
// we do not need sourcemaps with the in browser compilation
|
||||
const noop = function() {}
|
||||
|
||||
export const SourceMapGenerator = function() {
|
||||
return {
|
||||
addMapping: noop,
|
||||
setSourceContent: noop,
|
||||
toJSON: () => ({})
|
||||
}
|
||||
}
|
||||
export const SourceMapConsumer = function() {}
|
||||
export const SourceNode = function() {}
|
||||
|
||||
export default {
|
||||
SourceNode,
|
||||
SourceMapConsumer,
|
||||
SourceMapGenerator
|
||||
}
|
18
node_modules/@riotjs/compiler/src/utils/preprocess-node.js
generated
vendored
Normal file
18
node_modules/@riotjs/compiler/src/utils/preprocess-node.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import {execute as runPreprocessor} from '../preprocessors'
|
||||
|
||||
/**
|
||||
* Preprocess a riot parser node
|
||||
* @param { string } preprocessorType - either css, js
|
||||
* @param { string } preprocessorName - preprocessor id
|
||||
* @param { Object } meta - compilation meta information
|
||||
* @param { RiotParser.nodeTypes } node - css node detected by the parser
|
||||
* @returns { Output } code and sourcemap generated by the preprocessor
|
||||
*/
|
||||
export default function preprocess(preprocessorType, preprocessorName, meta, node) {
|
||||
const code = node.text
|
||||
|
||||
return (preprocessorName ?
|
||||
runPreprocessor(preprocessorType, preprocessorName, meta, code) :
|
||||
{ code }
|
||||
)
|
||||
}
|
10
node_modules/@riotjs/compiler/src/utils/sourcemap-as-json.js
generated
vendored
Normal file
10
node_modules/@riotjs/compiler/src/utils/sourcemap-as-json.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Return a source map as JSON, it it has not the toJSON method it means it can
|
||||
* be used right the way
|
||||
* @param { SourceMapGenerator|Object } map - a sourcemap generator or simply an json object
|
||||
* @returns { Object } the source map as JSON
|
||||
*/
|
||||
export default function sourcemapAsJSON(map) {
|
||||
if (map && map.toJSON) return map.toJSON()
|
||||
return map
|
||||
}
|
10
node_modules/@riotjs/compiler/src/utils/split-string-by-EOL.js
generated
vendored
Normal file
10
node_modules/@riotjs/compiler/src/utils/split-string-by-EOL.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
const LINES_RE = /\r\n?|\n/g
|
||||
|
||||
/**
|
||||
* Split a string into a rows array generated from its EOL matches
|
||||
* @param { string } string [description]
|
||||
* @returns { Array } array containing all the string rows
|
||||
*/
|
||||
export default function splitStringByEOL(string) {
|
||||
return string.split(LINES_RE)
|
||||
}
|
9
node_modules/@riotjs/compiler/src/utils/trim-end.js
generated
vendored
Normal file
9
node_modules/@riotjs/compiler/src/utils/trim-end.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Native String.prototype.trimEnd method with fallback to String.prototype.trimRight
|
||||
* Edge doesn't support the first one
|
||||
* @param {string} string - input string
|
||||
* @returns {string} trimmed output
|
||||
*/
|
||||
export default function trimEnd(string) {
|
||||
return (string.trimEnd || string.trimRight).apply(string)
|
||||
}
|
9
node_modules/@riotjs/compiler/src/utils/trim-start.js
generated
vendored
Normal file
9
node_modules/@riotjs/compiler/src/utils/trim-start.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Native String.prototype.trimStart method with fallback to String.prototype.trimLeft
|
||||
* Edge doesn't support the first one
|
||||
* @param {string} string - input string
|
||||
* @returns {string} trimmed output
|
||||
*/
|
||||
export default function trimStart(string) {
|
||||
return (string.trimStart || string.trimLeft).apply(string)
|
||||
}
|
9
node_modules/@riotjs/compiler/src/utils/unescape-char.js
generated
vendored
Normal file
9
node_modules/@riotjs/compiler/src/utils/unescape-char.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Unescape the user escaped chars
|
||||
* @param {string} string - input string
|
||||
* @param {string} char - probably a '{' or anything the user want's to escape
|
||||
* @returns {string} cleaned up string
|
||||
*/
|
||||
export default function unescapeChar(string, char) {
|
||||
return string.replace(RegExp(`\\\\${char}`, 'gm'), char)
|
||||
}
|
Reference in New Issue
Block a user