@vue/compiler-sfc
Advanced tools
Comparing version 3.0.0-alpha.7 to 3.0.0-alpha.8
@@ -9,2 +9,3 @@ 'use strict'; | ||
var LRUCache = _interopDefault(require('lru-cache')); | ||
var shared = require('@vue/shared'); | ||
var compilerCore = require('@vue/compiler-core'); | ||
@@ -17,41 +18,2 @@ var url = require('url'); | ||
const range = 2; | ||
function generateCodeFrame(source, start = 0, end = source.length) { | ||
const lines = source.split(/\r?\n/); | ||
let count = 0; | ||
const res = []; | ||
for (let i = 0; i < lines.length; i++) { | ||
count += lines[i].length + 1; | ||
if (count >= start) { | ||
for (let j = i - range; j <= i + range || end > count; j++) { | ||
if (j < 0 || j >= lines.length) | ||
continue; | ||
const line = j + 1; | ||
res.push(`${line}${' '.repeat(3 - String(line).length)}| ${lines[j]}`); | ||
const lineLength = lines[j].length; | ||
if (j === i) { | ||
// push underline | ||
const pad = start - (count - lineLength) + 1; | ||
const length = Math.max(1, end > count ? lineLength - pad : end - start); | ||
res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length)); | ||
} | ||
else if (j > i) { | ||
if (end > count) { | ||
const length = Math.max(Math.min(end - count, lineLength), 1); | ||
res.push(` | ` + '^'.repeat(length)); | ||
} | ||
count += lineLength + 1; | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
return res.join('\n'); | ||
} | ||
const EMPTY_OBJ = Object.freeze({}) | ||
; | ||
const isString = (val) => typeof val === 'string'; | ||
const isObject = (val) => val !== null && typeof val === 'object'; | ||
const SFC_CACHE_MAX_SIZE = 500; | ||
@@ -142,3 +104,3 @@ const sourceToSFC = new LRUCache(SFC_CACHE_MAX_SIZE); | ||
function warnDuplicateBlock(source, filename, node) { | ||
const codeFrame = generateCodeFrame(source, node.loc.start.offset, node.loc.end.offset); | ||
const codeFrame = shared.generateCodeFrame(source, node.loc.start.offset, node.loc.end.offset); | ||
const location = `${filename}:${node.loc.start.line}:${node.loc.start.column}`; | ||
@@ -262,3 +224,3 @@ console.warn(`Single file component can contain only one ${node.tag} element (${location}):\n\n${codeFrame}`); | ||
// @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost | ||
return url.parse(isString(urlString) ? urlString : ''); | ||
return url.parse(shared.isString(urlString) ? urlString : ''); | ||
} | ||
@@ -457,3 +419,3 @@ | ||
let nodeTransforms = []; | ||
if (isObject(transformAssetUrls)) { | ||
if (shared.isObject(transformAssetUrls)) { | ||
nodeTransforms = [ | ||
@@ -460,0 +422,0 @@ createAssetUrlTransformWithOptions(transformAssetUrls), |
{ | ||
"name": "@vue/compiler-sfc", | ||
"version": "3.0.0-alpha.7", | ||
"version": "3.0.0-alpha.8", | ||
"description": "@vue/compiler-sfc", | ||
@@ -18,3 +18,3 @@ "main": "dist/compiler-sfc.cjs.js", | ||
"type": "git", | ||
"url": "git+https://github.com/vuejs/vue.git" | ||
"url": "git+https://github.com/vuejs/vue-next.git" | ||
}, | ||
@@ -27,11 +27,12 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/vuejs/vue/issues" | ||
"url": "https://github.com/vuejs/vue-next/issues" | ||
}, | ||
"homepage": "https://github.com/vuejs/vue/tree/dev/packages/compiler-sfc#readme", | ||
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-sfc#readme", | ||
"peerDependencies": { | ||
"vue": "3.0.0-alpha.7" | ||
"vue": "3.0.0-alpha.8" | ||
}, | ||
"dependencies": { | ||
"@vue/compiler-core": "3.0.0-alpha.7", | ||
"@vue/compiler-dom": "3.0.0-alpha.7", | ||
"@vue/shared": "3.0.0-alpha.8", | ||
"@vue/compiler-core": "3.0.0-alpha.8", | ||
"@vue/compiler-dom": "3.0.0-alpha.8", | ||
"consolidate": "^0.15.1", | ||
@@ -38,0 +39,0 @@ "hash-sum": "^2.0.0", |
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
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1
37160
11
931
+ Added@vue/shared@3.0.0-alpha.8
+ Added@babel/helper-string-parser@7.24.8(transitive)
+ Added@babel/helper-validator-identifier@7.24.7(transitive)
+ Added@babel/parser@7.25.6(transitive)
+ Added@babel/types@7.25.6(transitive)
+ Added@vue/compiler-core@3.0.0-alpha.8(transitive)
+ Added@vue/compiler-dom@3.0.0-alpha.8(transitive)
+ Added@vue/reactivity@3.0.0-alpha.8(transitive)
+ Added@vue/runtime-core@3.0.0-alpha.8(transitive)
+ Added@vue/runtime-dom@3.0.0-alpha.8(transitive)
+ Added@vue/shared@3.0.0-alpha.8(transitive)
+ Addedto-fast-properties@2.0.0(transitive)
+ Addedvue@3.0.0-alpha.8(transitive)
- Removed@vue/compiler-core@3.0.0-alpha.7(transitive)
- Removed@vue/compiler-dom@3.0.0-alpha.7(transitive)
- Removed@vue/reactivity@3.0.0-alpha.7(transitive)
- Removed@vue/runtime-core@3.0.0-alpha.7(transitive)
- Removed@vue/runtime-dom@3.0.0-alpha.7(transitive)
- Removedacorn@7.4.1(transitive)
- Removedvue@3.0.0-alpha.7(transitive)