From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- .../lib/templateCompilerModules/assetUrl.ts.html | 222 +++++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 node_modules/@vue/component-compiler-utils/coverage/lcov-report/lib/templateCompilerModules/assetUrl.ts.html (limited to 'node_modules/@vue/component-compiler-utils/coverage/lcov-report/lib/templateCompilerModules/assetUrl.ts.html') diff --git a/node_modules/@vue/component-compiler-utils/coverage/lcov-report/lib/templateCompilerModules/assetUrl.ts.html b/node_modules/@vue/component-compiler-utils/coverage/lcov-report/lib/templateCompilerModules/assetUrl.ts.html new file mode 100644 index 00000000..31537c15 --- /dev/null +++ b/node_modules/@vue/component-compiler-utils/coverage/lcov-report/lib/templateCompilerModules/assetUrl.ts.html @@ -0,0 +1,222 @@ + + + + Code coverage report for lib/templateCompilerModules/assetUrl.ts + + + + + + + +
+
+

+ All files / lib/templateCompilerModules assetUrl.ts +

+
+
+ 100% + Statements + 20/20 +
+
+ 88.24% + Branches + 15/17 +
+
+ 100% + Functions + 7/7 +
+
+ 100% + Lines + 17/17 +
+
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52  +  +  +  +  +  +  +  +1x +  +  +  +  +  +  +  +4x +  +  +  +4x +  +19x +  +  +  +  +  +19x +80x +14x +14x +13x +1x +2x +  +  +  +  +  +  +15x +14x +  +14x +14x +14x +  +  +1x +  + 
// vue compiler module for transforming `<tag>:<attribute>` to `require`
+ 
+import { urlToRequire, ASTNode, Attr } from './utils'
+ 
+export interface AssetURLOptions {
+  [name: string]: string | string[]
+}
+ 
+const defaultOptions: AssetURLOptions = {
+  video: ['src', 'poster'],
+  source: 'src',
+  img: 'src',
+  image: ['xlink:href', 'href']
+}
+ 
+export default (userOptions?: AssetURLOptions) => {
+  const options = userOptions
+    ? Object.assign({}, defaultOptions, userOptions)
+    : defaultOptions
+ 
+  return {
+    postTransformNode: (node: ASTNode) => {
+      transform(node, options)
+    }
+  }
+}
+ 
+function transform(node: ASTNode, options: AssetURLOptions) {
+  for (const tag in options) {
+    if ((tag === '*' || node.tag === tag) && node.attrs) {
+      const attributes = options[tag]
+      if (typeof attributes === 'string') {
+        node.attrs.some(attr => rewrite(attr, attributes))
+      } else Eif (Array.isArray(attributes)) {
+        attributes.forEach(item => node.attrs.some(attr => rewrite(attr, item)))
+      }
+    }
+  }
+}
+ 
+function rewrite(attr: Attr, name: string) {
+  if (attr.name === name) {
+    const value = attr.value
+    // only transform static URLs
+    Eif (value.charAt(0) === '"' && value.charAt(value.length - 1) === '"') {
+      attr.value = urlToRequire(value.slice(1, -1))
+      return true
+    }
+  }
+  return false
+}
+ 
+
+
+ + + + + + + + -- cgit v1.2.3