first commit
This commit is contained in:
15
app_vue/node_modules/@vue/component-compiler-utils/dist/templateCompilerModules/assetUrl.d.ts
generated
vendored
Normal file
15
app_vue/node_modules/@vue/component-compiler-utils/dist/templateCompilerModules/assetUrl.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import { ASTNode } from './utils';
|
||||
export interface AssetURLOptions {
|
||||
[name: string]: string | string[];
|
||||
}
|
||||
export interface TransformAssetUrlsOptions {
|
||||
/**
|
||||
* If base is provided, instead of transforming relative asset urls into
|
||||
* imports, they will be directly rewritten to absolute urls.
|
||||
*/
|
||||
base?: string;
|
||||
}
|
||||
declare const _default: (userOptions?: AssetURLOptions | undefined, transformAssetUrlsOption?: TransformAssetUrlsOptions | undefined) => {
|
||||
postTransformNode: (node: ASTNode) => void;
|
||||
};
|
||||
export default _default;
|
46
app_vue/node_modules/@vue/component-compiler-utils/dist/templateCompilerModules/assetUrl.js
generated
vendored
Normal file
46
app_vue/node_modules/@vue/component-compiler-utils/dist/templateCompilerModules/assetUrl.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
// vue compiler module for transforming `<tag>:<attribute>` to `require`
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("./utils");
|
||||
const defaultOptions = {
|
||||
audio: 'src',
|
||||
video: ['src', 'poster'],
|
||||
source: 'src',
|
||||
img: 'src',
|
||||
image: ['xlink:href', 'href'],
|
||||
use: ['xlink:href', 'href']
|
||||
};
|
||||
exports.default = (userOptions, transformAssetUrlsOption) => {
|
||||
const options = userOptions
|
||||
? Object.assign({}, defaultOptions, userOptions)
|
||||
: defaultOptions;
|
||||
return {
|
||||
postTransformNode: (node) => {
|
||||
transform(node, options, transformAssetUrlsOption);
|
||||
}
|
||||
};
|
||||
};
|
||||
function transform(node, options, transformAssetUrlsOption) {
|
||||
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, transformAssetUrlsOption));
|
||||
}
|
||||
else if (Array.isArray(attributes)) {
|
||||
attributes.forEach(item => node.attrs.some(attr => rewrite(attr, item, transformAssetUrlsOption)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function rewrite(attr, name, transformAssetUrlsOption) {
|
||||
if (attr.name === name) {
|
||||
const value = attr.value;
|
||||
// only transform static URLs
|
||||
if (value.charAt(0) === '"' && value.charAt(value.length - 1) === '"') {
|
||||
attr.value = utils_1.urlToRequire(value.slice(1, -1), transformAssetUrlsOption);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
6
app_vue/node_modules/@vue/component-compiler-utils/dist/templateCompilerModules/srcset.d.ts
generated
vendored
Normal file
6
app_vue/node_modules/@vue/component-compiler-utils/dist/templateCompilerModules/srcset.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import { ASTNode } from './utils';
|
||||
import { TransformAssetUrlsOptions } from './assetUrl';
|
||||
declare const _default: (transformAssetUrlsOptions?: TransformAssetUrlsOptions | undefined) => {
|
||||
postTransformNode: (node: ASTNode) => void;
|
||||
};
|
||||
export default _default;
|
54
app_vue/node_modules/@vue/component-compiler-utils/dist/templateCompilerModules/srcset.js
generated
vendored
Normal file
54
app_vue/node_modules/@vue/component-compiler-utils/dist/templateCompilerModules/srcset.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
// vue compiler module for transforming `img:srcset` to a number of `require`s
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("./utils");
|
||||
exports.default = (transformAssetUrlsOptions) => ({
|
||||
postTransformNode: (node) => {
|
||||
transform(node, transformAssetUrlsOptions);
|
||||
}
|
||||
});
|
||||
// http://w3c.github.io/html/semantics-embedded-content.html#ref-for-image-candidate-string-5
|
||||
const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g;
|
||||
function transform(node, transformAssetUrlsOptions) {
|
||||
const tags = ['img', 'source'];
|
||||
if (tags.indexOf(node.tag) !== -1 && node.attrs) {
|
||||
node.attrs.forEach(attr => {
|
||||
if (attr.name === 'srcset') {
|
||||
// same logic as in transform-require.js
|
||||
const value = attr.value;
|
||||
const isStatic = value.charAt(0) === '"' && value.charAt(value.length - 1) === '"';
|
||||
if (!isStatic) {
|
||||
return;
|
||||
}
|
||||
const imageCandidates = value
|
||||
.substr(1, value.length - 2)
|
||||
.split(',')
|
||||
.map(s => {
|
||||
// The attribute value arrives here with all whitespace, except
|
||||
// normal spaces, represented by escape sequences
|
||||
const [url, descriptor] = s
|
||||
.replace(escapedSpaceCharacters, ' ')
|
||||
.trim()
|
||||
.split(' ', 2);
|
||||
return {
|
||||
require: utils_1.urlToRequire(url, transformAssetUrlsOptions),
|
||||
descriptor
|
||||
};
|
||||
});
|
||||
// "require(url1)"
|
||||
// "require(url1) 1x"
|
||||
// "require(url1), require(url2)"
|
||||
// "require(url1), require(url2) 2x"
|
||||
// "require(url1) 1x, require(url2)"
|
||||
// "require(url1) 1x, require(url2) 2x"
|
||||
const code = imageCandidates
|
||||
.map(({ require, descriptor }) => `${require} + "${descriptor ? ' ' + descriptor : ''}, " + `)
|
||||
.join('')
|
||||
.slice(0, -6)
|
||||
.concat('"')
|
||||
.replace(/ \+ ""$/, '');
|
||||
attr.value = code;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
10
app_vue/node_modules/@vue/component-compiler-utils/dist/templateCompilerModules/utils.d.ts
generated
vendored
Normal file
10
app_vue/node_modules/@vue/component-compiler-utils/dist/templateCompilerModules/utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import { TransformAssetUrlsOptions } from './assetUrl';
|
||||
export interface Attr {
|
||||
name: string;
|
||||
value: string;
|
||||
}
|
||||
export interface ASTNode {
|
||||
tag: string;
|
||||
attrs: Attr[];
|
||||
}
|
||||
export declare function urlToRequire(url: string, transformAssetUrlsOption?: TransformAssetUrlsOptions): string;
|
60
app_vue/node_modules/@vue/component-compiler-utils/dist/templateCompilerModules/utils.js
generated
vendored
Normal file
60
app_vue/node_modules/@vue/component-compiler-utils/dist/templateCompilerModules/utils.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.urlToRequire = void 0;
|
||||
const url_1 = require("url");
|
||||
const path_1 = __importDefault(require("path"));
|
||||
function urlToRequire(url, transformAssetUrlsOption = {}) {
|
||||
const returnValue = `"${url}"`;
|
||||
// same logic as in transform-require.js
|
||||
const firstChar = url.charAt(0);
|
||||
if (firstChar === '~') {
|
||||
const secondChar = url.charAt(1);
|
||||
url = url.slice(secondChar === '/' ? 2 : 1);
|
||||
}
|
||||
const uriParts = parseUriParts(url);
|
||||
if (transformAssetUrlsOption.base) {
|
||||
// explicit base - directly rewrite the url into absolute url
|
||||
// does not apply to absolute urls or urls that start with `@`
|
||||
// since they are aliases
|
||||
if (firstChar === '.' || firstChar === '~') {
|
||||
// when packaged in the browser, path will be using the posix-
|
||||
// only version provided by rollup-plugin-node-builtins.
|
||||
return `"${(path_1.default.posix || path_1.default).join(transformAssetUrlsOption.base, uriParts.path + (uriParts.hash || ''))}"`;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
if (firstChar === '.' || firstChar === '~' || firstChar === '@') {
|
||||
if (!uriParts.hash) {
|
||||
return `require("${url}")`;
|
||||
}
|
||||
else {
|
||||
// support uri fragment case by excluding it from
|
||||
// the require and instead appending it as string;
|
||||
// assuming that the path part is sufficient according to
|
||||
// the above caseing(t.i. no protocol-auth-host parts expected)
|
||||
return `require("${uriParts.path}") + "${uriParts.hash}"`;
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
exports.urlToRequire = urlToRequire;
|
||||
/**
|
||||
* vuejs/component-compiler-utils#22 Support uri fragment in transformed require
|
||||
* @param urlString an url as a string
|
||||
*/
|
||||
function parseUriParts(urlString) {
|
||||
// initialize return value
|
||||
const returnValue = url_1.parse('');
|
||||
if (urlString) {
|
||||
// A TypeError is thrown if urlString is not a string
|
||||
// @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
|
||||
if ('string' === typeof urlString) {
|
||||
// check is an uri
|
||||
return url_1.parse(urlString); // take apart the uri
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
Reference in New Issue
Block a user