mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-21 14:13:36 +08:00
docs:更新文档
This commit is contained in:
2
node_modules/vite/dist/node/utils/babelParse.d.ts
generated
vendored
Normal file
2
node_modules/vite/dist/node/utils/babelParse.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { Statement } from '@babel/types';
|
||||
export declare function parse(source: string): Statement[];
|
||||
21
node_modules/vite/dist/node/utils/babelParse.js
generated
vendored
Normal file
21
node_modules/vite/dist/node/utils/babelParse.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parse = void 0;
|
||||
const parser_1 = require("@babel/parser");
|
||||
function parse(source) {
|
||||
return parser_1.parse(source, {
|
||||
sourceType: 'module',
|
||||
plugins: [
|
||||
// required for import.meta.hot
|
||||
'importMeta',
|
||||
// by default we enable proposals slated for ES2020.
|
||||
// full list at https://babeljs.io/docs/en/next/babel-parser#plugins
|
||||
// this should be kept in async with @vue/compiler-core's support range
|
||||
'bigInt',
|
||||
'optionalChaining',
|
||||
'nullishCoalescingOperator'
|
||||
]
|
||||
}).program.body;
|
||||
}
|
||||
exports.parse = parse;
|
||||
//# sourceMappingURL=babelParse.js.map
|
||||
1
node_modules/vite/dist/node/utils/babelParse.js.map
generated
vendored
Normal file
1
node_modules/vite/dist/node/utils/babelParse.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"babelParse.js","sourceRoot":"","sources":["../../../src/node/utils/babelParse.ts"],"names":[],"mappings":";;;AAAA,0CAA+C;AAG/C,SAAgB,KAAK,CAAC,MAAc;IAClC,OAAO,cAAM,CAAC,MAAM,EAAE;QACpB,UAAU,EAAE,QAAQ;QACpB,OAAO,EAAE;YACP,+BAA+B;YAC/B,YAAY;YACZ,oDAAoD;YACpD,oEAAoE;YACpE,uEAAuE;YACvE,QAAQ;YACR,kBAAkB;YAClB,2BAA2B;SAC5B;KACF,CAAC,CAAC,OAAO,CAAC,IAAI,CAAA;AACjB,CAAC;AAdD,sBAcC"}
|
||||
1
node_modules/vite/dist/node/utils/createCertificate.d.ts
generated
vendored
Normal file
1
node_modules/vite/dist/node/utils/createCertificate.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function createCertificate(): any;
|
||||
70
node_modules/vite/dist/node/utils/createCertificate.js
generated
vendored
Normal file
70
node_modules/vite/dist/node/utils/createCertificate.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createCertificate = void 0;
|
||||
// https://github.com/webpack/webpack-dev-server/blob/master/lib/utils/createCertificate.js
|
||||
function createCertificate() {
|
||||
const pems = require('selfsigned').generate(null, {
|
||||
algorithm: 'sha256',
|
||||
days: 30,
|
||||
keySize: 2048,
|
||||
extensions: [
|
||||
// {
|
||||
// name: 'basicConstraints',
|
||||
// cA: true,
|
||||
// },
|
||||
{
|
||||
name: 'keyUsage',
|
||||
keyCertSign: true,
|
||||
digitalSignature: true,
|
||||
nonRepudiation: true,
|
||||
keyEncipherment: true,
|
||||
dataEncipherment: true
|
||||
},
|
||||
{
|
||||
name: 'extKeyUsage',
|
||||
serverAuth: true,
|
||||
clientAuth: true,
|
||||
codeSigning: true,
|
||||
timeStamping: true
|
||||
},
|
||||
{
|
||||
name: 'subjectAltName',
|
||||
altNames: [
|
||||
{
|
||||
// type 2 is DNS
|
||||
type: 2,
|
||||
value: 'localhost'
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
value: 'localhost.localdomain'
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
value: 'lvh.me'
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
value: '*.lvh.me'
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
value: '[::1]'
|
||||
},
|
||||
{
|
||||
// type 7 is IP
|
||||
type: 7,
|
||||
ip: '127.0.0.1'
|
||||
},
|
||||
{
|
||||
type: 7,
|
||||
ip: 'fe80::1'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
return pems.private + pems.cert;
|
||||
}
|
||||
exports.createCertificate = createCertificate;
|
||||
//# sourceMappingURL=createCertificate.js.map
|
||||
1
node_modules/vite/dist/node/utils/createCertificate.js.map
generated
vendored
Normal file
1
node_modules/vite/dist/node/utils/createCertificate.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"createCertificate.js","sourceRoot":"","sources":["../../../src/node/utils/createCertificate.ts"],"names":[],"mappings":";;;AAAA,2FAA2F;AAC3F,SAAgB,iBAAiB;IAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE;QAChD,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,EAAE;QACR,OAAO,EAAE,IAAI;QACb,UAAU,EAAE;YACV,IAAI;YACJ,8BAA8B;YAC9B,cAAc;YACd,KAAK;YACL;gBACE,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,IAAI;gBACjB,gBAAgB,EAAE,IAAI;gBACtB,cAAc,EAAE,IAAI;gBACpB,eAAe,EAAE,IAAI;gBACrB,gBAAgB,EAAE,IAAI;aACvB;YACD;gBACE,IAAI,EAAE,aAAa;gBACnB,UAAU,EAAE,IAAI;gBAChB,UAAU,EAAE,IAAI;gBAChB,WAAW,EAAE,IAAI;gBACjB,YAAY,EAAE,IAAI;aACnB;YACD;gBACE,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE;oBACR;wBACE,gBAAgB;wBAChB,IAAI,EAAE,CAAC;wBACP,KAAK,EAAE,WAAW;qBACnB;oBACD;wBACE,IAAI,EAAE,CAAC;wBACP,KAAK,EAAE,uBAAuB;qBAC/B;oBACD;wBACE,IAAI,EAAE,CAAC;wBACP,KAAK,EAAE,QAAQ;qBAChB;oBACD;wBACE,IAAI,EAAE,CAAC;wBACP,KAAK,EAAE,UAAU;qBAClB;oBACD;wBACE,IAAI,EAAE,CAAC;wBACP,KAAK,EAAE,OAAO;qBACf;oBACD;wBACE,eAAe;wBACf,IAAI,EAAE,CAAC;wBACP,EAAE,EAAE,WAAW;qBAChB;oBACD;wBACE,IAAI,EAAE,CAAC;wBACP,EAAE,EAAE,SAAS;qBACd;iBACF;aACF;SACF;KACF,CAAC,CAAA;IACF,OAAO,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAA;AACjC,CAAC;AA/DD,8CA+DC"}
|
||||
17
node_modules/vite/dist/node/utils/cssUtils.d.ts
generated
vendored
Normal file
17
node_modules/vite/dist/node/utils/cssUtils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { SFCAsyncStyleCompileOptions, SFCStyleCompileResults } from '@vue/compiler-sfc';
|
||||
export declare const urlRE: RegExp;
|
||||
export declare const cssPreprocessLangRE: RegExp;
|
||||
export declare const cssModuleRE: RegExp;
|
||||
export declare const isCSSRequest: (file: string) => boolean;
|
||||
declare type Replacer = (url: string) => string | Promise<string>;
|
||||
export declare function rewriteCssUrls(css: string, replacerOrBase: string | Replacer): Promise<string>;
|
||||
export declare function compileCss(root: string, publicPath: string, { source, filename, scoped, vars, modules, preprocessLang, preprocessOptions, modulesOptions }: SFCAsyncStyleCompileOptions, isBuild?: boolean): Promise<SFCStyleCompileResults | string>;
|
||||
export declare function resolvePostcssOptions(root: string, isBuild: boolean): Promise<{
|
||||
options: import("postcss").ProcessOptions | null;
|
||||
plugins: (import("postcss").Plugin<any> | import("postcss").Transformer | import("postcss").Processor)[];
|
||||
}>;
|
||||
export declare const cssImporterMap: Map<string, Set<string>>;
|
||||
export declare const cssImporteeMap: Map<string, Set<string>>;
|
||||
export declare function getCssImportBoundaries(filePath: string, boundaries?: Set<string>): Set<string>;
|
||||
export declare function recordCssImportChain(dependencies: Set<string>, filePath: string): void;
|
||||
export {};
|
||||
165
node_modules/vite/dist/node/utils/cssUtils.js
generated
vendored
Normal file
165
node_modules/vite/dist/node/utils/cssUtils.js
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.recordCssImportChain = exports.getCssImportBoundaries = exports.cssImporteeMap = exports.cssImporterMap = exports.resolvePostcssOptions = exports.compileCss = exports.rewriteCssUrls = exports.isCSSRequest = exports.cssModuleRE = exports.cssPreprocessLangRE = exports.urlRE = void 0;
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const chalk_1 = __importDefault(require("chalk"));
|
||||
const transformUtils_1 = require("./transformUtils");
|
||||
const pathUtils_1 = require("./pathUtils");
|
||||
const resolveVue_1 = require("./resolveVue");
|
||||
const hash_sum_1 = __importDefault(require("hash-sum"));
|
||||
exports.urlRE = /url\(\s*('[^']+'|"[^"]+"|[^'")]+)\s*\)/;
|
||||
exports.cssPreprocessLangRE = /\.(less|sass|scss|styl|stylus|postcss)$/;
|
||||
exports.cssModuleRE = /\.module\.(less|sass|scss|styl|stylus|postcss|css)$/;
|
||||
exports.isCSSRequest = (file) => file.endsWith('.css') || exports.cssPreprocessLangRE.test(file);
|
||||
function rewriteCssUrls(css, replacerOrBase) {
|
||||
let replacer;
|
||||
if (typeof replacerOrBase === 'string') {
|
||||
replacer = (rawUrl) => {
|
||||
return path_1.default.posix.resolve(path_1.default.posix.dirname(replacerOrBase), rawUrl);
|
||||
};
|
||||
}
|
||||
else {
|
||||
replacer = replacerOrBase;
|
||||
}
|
||||
return transformUtils_1.asyncReplace(css, exports.urlRE, async (match) => {
|
||||
let [matched, rawUrl] = match;
|
||||
let wrap = '';
|
||||
const first = rawUrl[0];
|
||||
if (first === `"` || first === `'`) {
|
||||
wrap = first;
|
||||
rawUrl = rawUrl.slice(1, -1);
|
||||
}
|
||||
if (pathUtils_1.isExternalUrl(rawUrl) ||
|
||||
rawUrl.startsWith('data:') ||
|
||||
rawUrl.startsWith('#')) {
|
||||
return matched;
|
||||
}
|
||||
return `url(${wrap}${await replacer(rawUrl)}${wrap})`;
|
||||
});
|
||||
}
|
||||
exports.rewriteCssUrls = rewriteCssUrls;
|
||||
async function compileCss(root, publicPath, { source, filename, scoped, vars, modules, preprocessLang, preprocessOptions = {}, modulesOptions = {} }, isBuild = false) {
|
||||
const id = hash_sum_1.default(publicPath);
|
||||
const postcssConfig = await loadPostcssConfig(root);
|
||||
const { compileStyleAsync } = resolveVue_1.resolveCompiler(root);
|
||||
if (publicPath.endsWith('.css') &&
|
||||
!modules &&
|
||||
!postcssConfig &&
|
||||
!isBuild &&
|
||||
!source.includes('@import')) {
|
||||
// no need to invoke compile for plain css if no postcss config is present
|
||||
return source;
|
||||
}
|
||||
const { options: postcssOptions, plugins: postcssPlugins } = await resolvePostcssOptions(root, isBuild);
|
||||
if (preprocessLang) {
|
||||
preprocessOptions = preprocessOptions[preprocessLang] || preprocessOptions;
|
||||
// include node_modules for imports by default
|
||||
switch (preprocessLang) {
|
||||
case 'scss':
|
||||
case 'sass':
|
||||
preprocessOptions = {
|
||||
includePaths: ['node_modules'],
|
||||
...preprocessOptions
|
||||
};
|
||||
break;
|
||||
case 'less':
|
||||
case 'stylus':
|
||||
preprocessOptions = {
|
||||
paths: ['node_modules'],
|
||||
...preprocessOptions
|
||||
};
|
||||
}
|
||||
}
|
||||
return await compileStyleAsync({
|
||||
source,
|
||||
filename,
|
||||
id: `data-v-${id}`,
|
||||
scoped,
|
||||
vars,
|
||||
modules,
|
||||
modulesOptions: {
|
||||
generateScopedName: `[local]_${id}`,
|
||||
localsConvention: 'camelCase',
|
||||
...modulesOptions
|
||||
},
|
||||
preprocessLang,
|
||||
preprocessCustomRequire: (id) => require(pathUtils_1.resolveFrom(root, id)),
|
||||
preprocessOptions,
|
||||
postcssOptions,
|
||||
postcssPlugins
|
||||
});
|
||||
}
|
||||
exports.compileCss = compileCss;
|
||||
let cachedPostcssConfig;
|
||||
async function loadPostcssConfig(root) {
|
||||
if (cachedPostcssConfig !== undefined) {
|
||||
return cachedPostcssConfig;
|
||||
}
|
||||
try {
|
||||
const load = require('postcss-load-config');
|
||||
return (cachedPostcssConfig = await load({}, root));
|
||||
}
|
||||
catch (e) {
|
||||
if (!/No PostCSS Config found/.test(e.message)) {
|
||||
console.error(chalk_1.default.red(`[vite] Error loading postcss config:`));
|
||||
console.error(e);
|
||||
}
|
||||
return (cachedPostcssConfig = null);
|
||||
}
|
||||
}
|
||||
async function resolvePostcssOptions(root, isBuild) {
|
||||
const config = await loadPostcssConfig(root);
|
||||
const options = config && config.options;
|
||||
const plugins = config && config.plugins ? config.plugins.slice() : [];
|
||||
plugins.unshift(require('postcss-import')());
|
||||
if (isBuild) {
|
||||
plugins.push(require('postcss-discard-comments')({ removeAll: true }));
|
||||
}
|
||||
return {
|
||||
options,
|
||||
plugins
|
||||
};
|
||||
}
|
||||
exports.resolvePostcssOptions = resolvePostcssOptions;
|
||||
exports.cssImporterMap = new Map();
|
||||
exports.cssImporteeMap = new Map();
|
||||
function getCssImportBoundaries(filePath, boundaries = new Set()) {
|
||||
if (!exports.cssImporterMap.has(filePath)) {
|
||||
return boundaries;
|
||||
}
|
||||
const importers = exports.cssImporterMap.get(filePath);
|
||||
for (const importer of importers) {
|
||||
boundaries.add(importer);
|
||||
getCssImportBoundaries(importer, boundaries);
|
||||
}
|
||||
return boundaries;
|
||||
}
|
||||
exports.getCssImportBoundaries = getCssImportBoundaries;
|
||||
function recordCssImportChain(dependencies, filePath) {
|
||||
const preImportees = exports.cssImporteeMap.get(filePath);
|
||||
// if import code change, should removed unused previous importee
|
||||
if (preImportees) {
|
||||
for (const preImportee of preImportees) {
|
||||
if (!dependencies.has(preImportee)) {
|
||||
const importers = exports.cssImporterMap.get(preImportee);
|
||||
if (importers) {
|
||||
importers.delete(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dependencies.forEach((dependency) => {
|
||||
if (exports.cssImporterMap.has(dependency)) {
|
||||
exports.cssImporterMap.get(dependency).add(filePath);
|
||||
}
|
||||
else {
|
||||
exports.cssImporterMap.set(dependency, new Set([filePath]));
|
||||
}
|
||||
});
|
||||
exports.cssImporteeMap.set(filePath, dependencies);
|
||||
}
|
||||
exports.recordCssImportChain = recordCssImportChain;
|
||||
//# sourceMappingURL=cssUtils.js.map
|
||||
1
node_modules/vite/dist/node/utils/cssUtils.js.map
generated
vendored
Normal file
1
node_modules/vite/dist/node/utils/cssUtils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cssUtils.js","sourceRoot":"","sources":["../../../src/node/utils/cssUtils.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAEvB,kDAAyB;AACzB,qDAA+C;AAC/C,2CAAwD;AACxD,6CAA8C;AAC9C,wDAA+B;AAMlB,QAAA,KAAK,GAAG,wCAAwC,CAAA;AAChD,QAAA,mBAAmB,GAAG,yCAAyC,CAAA;AAC/D,QAAA,WAAW,GAAG,qDAAqD,CAAA;AAEnE,QAAA,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE,CAC3C,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,2BAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAIzD,SAAgB,cAAc,CAC5B,GAAW,EACX,cAAiC;IAEjC,IAAI,QAAkB,CAAA;IACtB,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE;QACtC,QAAQ,GAAG,CAAC,MAAM,EAAE,EAAE;YACpB,OAAO,cAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,CAAA;QACvE,CAAC,CAAA;KACF;SAAM;QACL,QAAQ,GAAG,cAAc,CAAA;KAC1B;IAED,OAAO,6BAAY,CAAC,GAAG,EAAE,aAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QAC9C,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CAAA;IAC/C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;QAChC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACxB,sBAAsB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;KAC7C;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAbD,wDAaC;AAED,SAAgB,oBAAoB,CAClC,YAAyB,EACzB,QAAgB;IAEhB,MAAM,YAAY,GAAG,sBAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACjD,iEAAiE;IACjE,IAAI,YAAY,EAAE;QAChB,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;YACtC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;gBAClC,MAAM,SAAS,GAAG,sBAAc,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;gBACjD,IAAI,SAAS,EAAE;oBACb,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;iBAC3B;aACF;SACF;KACF;IAED,YAAY,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QAClC,IAAI,sBAAc,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAClC,sBAAc,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;SAC9C;aAAM;YACL,sBAAc,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;SACpD;IACH,CAAC,CAAC,CAAA;IAEF,sBAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;AAC5C,CAAC;AA1BD,oDA0BC"}
|
||||
22
node_modules/vite/dist/node/utils/fsUtils.d.ts
generated
vendored
Normal file
22
node_modules/vite/dist/node/utils/fsUtils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/// <reference types="node" />
|
||||
import { Context } from '../server';
|
||||
import { Readable } from 'stream';
|
||||
import { HMRWatcher } from '../server/serverPluginHmr';
|
||||
/**
|
||||
* Read a file with in-memory cache.
|
||||
* Also sets appropriate headers and body on the Koa context.
|
||||
* This is exposed on middleware context as `ctx.read` with the `ctx` already
|
||||
* bound, so it can be used as `ctx.read(file)`.
|
||||
*/
|
||||
export declare function cachedRead(ctx: Context | null, file: string): Promise<Buffer>;
|
||||
/**
|
||||
* Read already set body on a Koa context and normalize it into a string.
|
||||
* Useful in post-processing middlewares.
|
||||
*/
|
||||
export declare function readBody(stream: Readable | Buffer | string | null): Promise<string | null>;
|
||||
export declare function lookupFile(dir: string, formats: string[], pathOnly?: boolean): string | undefined;
|
||||
/**
|
||||
* Files under root are watched by default, but with user aliases we can still
|
||||
* serve files out of root. Add such files to the watcher (if not node_modules)
|
||||
*/
|
||||
export declare function watchFileIfOutOfRoot(watcher: HMRWatcher, root: string, file: string): void;
|
||||
126
node_modules/vite/dist/node/utils/fsUtils.js
generated
vendored
Normal file
126
node_modules/vite/dist/node/utils/fsUtils.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.watchFileIfOutOfRoot = exports.lookupFile = exports.readBody = exports.cachedRead = void 0;
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const lru_cache_1 = __importDefault(require("lru-cache"));
|
||||
const stream_1 = require("stream");
|
||||
const serverPluginServeStatic_1 = require("../server/serverPluginServeStatic");
|
||||
const mime_types_1 = __importDefault(require("mime-types"));
|
||||
const getETag = require('etag');
|
||||
const fsReadCache = new lru_cache_1.default({
|
||||
max: 10000
|
||||
});
|
||||
/**
|
||||
* Read a file with in-memory cache.
|
||||
* Also sets appropriate headers and body on the Koa context.
|
||||
* This is exposed on middleware context as `ctx.read` with the `ctx` already
|
||||
* bound, so it can be used as `ctx.read(file)`.
|
||||
*/
|
||||
async function cachedRead(ctx, file) {
|
||||
const lastModified = fs_extra_1.default.statSync(file).mtimeMs;
|
||||
const cached = fsReadCache.get(file);
|
||||
if (ctx) {
|
||||
ctx.set('Cache-Control', 'no-cache');
|
||||
ctx.type = mime_types_1.default.lookup(path_1.default.extname(file)) || 'application/octet-stream';
|
||||
}
|
||||
if (cached && cached.lastModified === lastModified) {
|
||||
if (ctx) {
|
||||
// a private marker in case the user ticks "disable cache" during dev
|
||||
ctx.__notModified = true;
|
||||
ctx.etag = cached.etag;
|
||||
ctx.lastModified = new Date(cached.lastModified);
|
||||
if (ctx.get('If-None-Match') === ctx.etag && serverPluginServeStatic_1.seenUrls.has(ctx.url)) {
|
||||
ctx.status = 304;
|
||||
}
|
||||
serverPluginServeStatic_1.seenUrls.add(ctx.url);
|
||||
ctx.body = cached.content;
|
||||
}
|
||||
return cached.content;
|
||||
}
|
||||
// #395 some file is an binary file, eg. font
|
||||
let content = await fs_extra_1.default.readFile(file);
|
||||
// Populate the "sourcesContent" array and resolve relative paths in the
|
||||
// "sources" array, so the debugger can trace back to the original source.
|
||||
if (file.endsWith('.map')) {
|
||||
const map = JSON.parse(content.toString('utf8'));
|
||||
if (!map.sourcesContent || !map.sources.every(path_1.default.isAbsolute)) {
|
||||
const sourcesContent = map.sourcesContent || [];
|
||||
map.sources = await Promise.all(map.sources.map(async (source, i) => {
|
||||
const originalPath = path_1.default.resolve(path_1.default.dirname(file), source);
|
||||
if (!sourcesContent[i]) {
|
||||
const originalCode = await cachedRead(null, originalPath);
|
||||
sourcesContent[i] = originalCode.toString('utf8');
|
||||
}
|
||||
return originalPath;
|
||||
}));
|
||||
map.sourcesContent = sourcesContent;
|
||||
content = Buffer.from(JSON.stringify(map));
|
||||
}
|
||||
}
|
||||
const etag = getETag(content);
|
||||
fsReadCache.set(file, {
|
||||
content,
|
||||
etag,
|
||||
lastModified
|
||||
});
|
||||
if (ctx) {
|
||||
ctx.etag = etag;
|
||||
ctx.lastModified = new Date(lastModified);
|
||||
ctx.body = content;
|
||||
ctx.status = 200;
|
||||
// watch the file if it's out of root.
|
||||
const { root, watcher } = ctx;
|
||||
watchFileIfOutOfRoot(watcher, root, file);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
exports.cachedRead = cachedRead;
|
||||
/**
|
||||
* Read already set body on a Koa context and normalize it into a string.
|
||||
* Useful in post-processing middlewares.
|
||||
*/
|
||||
async function readBody(stream) {
|
||||
if (stream instanceof stream_1.Readable) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let res = '';
|
||||
stream
|
||||
.on('data', (chunk) => (res += chunk))
|
||||
.on('error', reject)
|
||||
.on('end', () => {
|
||||
resolve(res);
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
return !stream || typeof stream === 'string' ? stream : stream.toString();
|
||||
}
|
||||
}
|
||||
exports.readBody = readBody;
|
||||
function lookupFile(dir, formats, pathOnly = false) {
|
||||
for (const format of formats) {
|
||||
const fullPath = path_1.default.join(dir, format);
|
||||
if (fs_extra_1.default.existsSync(fullPath) && fs_extra_1.default.statSync(fullPath).isFile()) {
|
||||
return pathOnly ? fullPath : fs_extra_1.default.readFileSync(fullPath, 'utf-8');
|
||||
}
|
||||
}
|
||||
const parentDir = path_1.default.dirname(dir);
|
||||
if (parentDir !== dir) {
|
||||
return lookupFile(parentDir, formats, pathOnly);
|
||||
}
|
||||
}
|
||||
exports.lookupFile = lookupFile;
|
||||
/**
|
||||
* Files under root are watched by default, but with user aliases we can still
|
||||
* serve files out of root. Add such files to the watcher (if not node_modules)
|
||||
*/
|
||||
function watchFileIfOutOfRoot(watcher, root, file) {
|
||||
if (!file.startsWith(root) && !/node_modules/.test(file)) {
|
||||
watcher.add(file);
|
||||
}
|
||||
}
|
||||
exports.watchFileIfOutOfRoot = watchFileIfOutOfRoot;
|
||||
//# sourceMappingURL=fsUtils.js.map
|
||||
1
node_modules/vite/dist/node/utils/fsUtils.js.map
generated
vendored
Normal file
1
node_modules/vite/dist/node/utils/fsUtils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fsUtils.js","sourceRoot":"","sources":["../../../src/node/utils/fsUtils.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,wDAAyB;AACzB,0DAAgC;AAGhC,mCAAiC;AACjC,+EAA4D;AAC5D,4DAA6B;AAG7B,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAQ/B,MAAM,WAAW,GAAG,IAAI,mBAAQ,CAAqB;IACnD,GAAG,EAAE,KAAK;CACX,CAAC,CAAA;AAEF;;;;;GAKG;AACI,KAAK,UAAU,UAAU,CAC9B,GAAmB,EACnB,IAAY;IAEZ,MAAM,YAAY,GAAG,kBAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAA;IAC9C,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACpC,IAAI,GAAG,EAAE;QACP,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;QACpC,GAAG,CAAC,IAAI,GAAG,oBAAI,CAAC,MAAM,CAAC,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,0BAA0B,CAAA;KACzE;IACD,IAAI,MAAM,IAAI,MAAM,CAAC,YAAY,KAAK,YAAY,EAAE;QAClD,IAAI,GAAG,EAAE;YACP,qEAAqE;YACrE,GAAG,CAAC,aAAa,GAAG,IAAI,CAAA;YACxB,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;YACtB,GAAG,CAAC,YAAY,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;YAChD,IAAI,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,kCAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;g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AAC,QAAQ,EAAE,CAAA;KAC1E;AACH,CAAC;AAhBD,4BAgBC;AAED,SAAgB,UAAU,CACxB,GAAW,EACX,OAAiB,EACjB,QAAQ,GAAG,KAAK;IAEhB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QACvC,IAAI,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,kBAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,EAAE;YAC7D,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,kBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;SAChE;KACF;IACD,MAAM,SAAS,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACnC,IAAI,SAAS,KAAK,GAAG,EAAE;QACrB,OAAO,UAAU,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;KAChD;AACH,CAAC;AAfD,gCAeC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAClC,OAAmB,EACnB,IAAY,EACZ,IAAY;IAEZ,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACxD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;KAClB;AACH,CAAC;AARD,oDAQC"}
|
||||
5
node_modules/vite/dist/node/utils/index.d.ts
generated
vendored
Normal file
5
node_modules/vite/dist/node/utils/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './fsUtils';
|
||||
export * from './pathUtils';
|
||||
export * from './transformUtils';
|
||||
export * from './resolveVue';
|
||||
export declare function toArray<T>(arg: T | T[] | undefined): T[];
|
||||
22
node_modules/vite/dist/node/utils/index.js
generated
vendored
Normal file
22
node_modules/vite/dist/node/utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.toArray = void 0;
|
||||
__exportStar(require("./fsUtils"), exports);
|
||||
__exportStar(require("./pathUtils"), exports);
|
||||
__exportStar(require("./transformUtils"), exports);
|
||||
__exportStar(require("./resolveVue"), exports);
|
||||
function toArray(arg) {
|
||||
return arg === void 0 ? [] : Array.isArray(arg) ? arg : [arg];
|
||||
}
|
||||
exports.toArray = toArray;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/vite/dist/node/utils/index.js.map
generated
vendored
Normal file
1
node_modules/vite/dist/node/utils/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,4CAAyB;AACzB,8CAA2B;AAC3B,mDAAgC;AAChC,+CAA4B;AAE5B,SAAgB,OAAO,CAAI,GAAwB;IACjD,OAAO,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAC/D,CAAC;AAFD,0BAEC"}
|
||||
12
node_modules/vite/dist/node/utils/openBrowser.d.ts
generated
vendored
Normal file
12
node_modules/vite/dist/node/utils/openBrowser.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file at
|
||||
* https://github.com/facebook/create-react-app/blob/master/LICENSE
|
||||
*/
|
||||
/**
|
||||
* Reads the BROWSER environment variable and decides what to do with it. Returns
|
||||
* true if it opened a browser or ran a node.js script, otherwise false.
|
||||
*/
|
||||
export declare function openBrowser(url: string): boolean;
|
||||
117
node_modules/vite/dist/node/utils/openBrowser.js
generated
vendored
Normal file
117
node_modules/vite/dist/node/utils/openBrowser.js
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file at
|
||||
* https://github.com/facebook/create-react-app/blob/master/LICENSE
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.openBrowser = void 0;
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const open_1 = __importDefault(require("open"));
|
||||
const execa_1 = __importDefault(require("execa"));
|
||||
const chalk_1 = __importDefault(require("chalk"));
|
||||
const child_process_1 = require("child_process");
|
||||
// https://github.com/sindresorhus/open#app
|
||||
const OSX_CHROME = 'google chrome';
|
||||
function getBrowserEnv() {
|
||||
// Attempt to honor this environment variable.
|
||||
// It is specific to the operating system.
|
||||
// See https://github.com/sindresorhus/open#app for documentation.
|
||||
const value = process.env.BROWSER;
|
||||
let action;
|
||||
if (!value) {
|
||||
// Default.
|
||||
action = 1 /* BROWSER */;
|
||||
}
|
||||
else if (value.toLowerCase().endsWith('.js')) {
|
||||
action = 2 /* SCRIPT */;
|
||||
}
|
||||
else if (value.toLowerCase() === 'none') {
|
||||
action = 0 /* NONE */;
|
||||
}
|
||||
else {
|
||||
action = 1 /* BROWSER */;
|
||||
}
|
||||
return { action, value };
|
||||
}
|
||||
function executeNodeScript(scriptPath, url) {
|
||||
const extraArgs = process.argv.slice(2);
|
||||
const child = execa_1.default('node', [scriptPath, ...extraArgs, url], {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
child.on('close', (code) => {
|
||||
if (code !== 0) {
|
||||
console.log();
|
||||
console.log(chalk_1.default.red('The script specified as BROWSER environment variable failed.'));
|
||||
console.log(chalk_1.default.cyan(scriptPath) + ' exited with code ' + code + '.');
|
||||
console.log();
|
||||
return;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
function startBrowserProcess(browser, url) {
|
||||
// If we're on OS X, the user hasn't specifically
|
||||
// requested a different browser, we can try opening
|
||||
// Chrome with AppleScript. This lets us reuse an
|
||||
// existing tab when possible instead of creating a new one.
|
||||
const shouldTryOpenChromeWithAppleScript = process.platform === 'darwin' &&
|
||||
(typeof browser !== 'string' || browser === OSX_CHROME);
|
||||
if (shouldTryOpenChromeWithAppleScript) {
|
||||
try {
|
||||
// Try our best to reuse existing tab
|
||||
// on OS X Google Chrome with AppleScript
|
||||
child_process_1.execSync('ps cax | grep "Google Chrome"');
|
||||
child_process_1.execSync('osascript openChrome.applescript "' + encodeURI(url) + '"', {
|
||||
cwd: path_1.default.resolve(__dirname, '../../bin'),
|
||||
stdio: 'ignore'
|
||||
});
|
||||
return true;
|
||||
}
|
||||
catch (err) {
|
||||
// Ignore errors
|
||||
}
|
||||
}
|
||||
// Another special case: on OS X, check if BROWSER has been set to "open".
|
||||
// In this case, instead of passing the string `open` to `open` function (which won't work),
|
||||
// just ignore it (thus ensuring the intended behavior, i.e. opening the system browser):
|
||||
// https://github.com/facebook/create-react-app/pull/1690#issuecomment-283518768
|
||||
if (process.platform === 'darwin' && browser === 'open') {
|
||||
browser = undefined;
|
||||
}
|
||||
// Fallback to open
|
||||
// (It will always open new tab)
|
||||
try {
|
||||
var options = { app: browser, url: true };
|
||||
open_1.default(url, options).catch(() => { }); // Prevent `unhandledRejection` error.
|
||||
return true;
|
||||
}
|
||||
catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Reads the BROWSER environment variable and decides what to do with it. Returns
|
||||
* true if it opened a browser or ran a node.js script, otherwise false.
|
||||
*/
|
||||
function openBrowser(url) {
|
||||
const { action, value } = getBrowserEnv();
|
||||
switch (action) {
|
||||
case 0 /* NONE */:
|
||||
// Special case: BROWSER="none" will prevent opening completely.
|
||||
return false;
|
||||
case 2 /* SCRIPT */:
|
||||
return executeNodeScript(value, url);
|
||||
case 1 /* BROWSER */:
|
||||
return startBrowserProcess(value, url);
|
||||
default:
|
||||
throw new Error('Not implemented.');
|
||||
}
|
||||
}
|
||||
exports.openBrowser = openBrowser;
|
||||
//# sourceMappingURL=openBrowser.js.map
|
||||
1
node_modules/vite/dist/node/utils/openBrowser.js.map
generated
vendored
Normal file
1
node_modules/vite/dist/node/utils/openBrowser.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"openBrowser.js","sourceRoot":"","sources":["../../../src/node/utils/openBrowser.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,gDAAuB;AACvB,gDAAuB;AACvB,kDAAyB;AACzB,kDAAyB;AACzB,iDAAwC;AAExC,2CAA2C;AAC3C,MAAM,UAAU,GAAG,eAAe,CAAA;AAQlC,SAAS,aAAa;IACpB,8CAA8C;IAC9C,0CAA0C;IAC1C,kEAAkE;IAClE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAA;IACjC,IAAI,MAAM,CAAA;IACV,IAAI,CAAC,KAAK,EAAE;QACV,WAAW;QACX,MAAM,kBAAkB,CAAA;KACzB;SAAM,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;Q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Normal file
33
node_modules/vite/dist/node/utils/pathUtils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { ParsedUrlQuery } from 'querystring';
|
||||
import { Context } from '../server';
|
||||
export declare const resolveFrom: (root: string, id: string) => string;
|
||||
export declare const queryRE: RegExp;
|
||||
export declare const hashRE: RegExp;
|
||||
export declare const cleanUrl: (url: string) => string;
|
||||
export declare const parseWithQuery: (id: string) => {
|
||||
path: string;
|
||||
query: ParsedUrlQuery;
|
||||
};
|
||||
export declare const bareImportRE: RegExp;
|
||||
export declare const isExternalUrl: (url: string) => boolean;
|
||||
export declare const isDataUrl: (url: string) => boolean;
|
||||
/**
|
||||
* Check if a file is a static asset that vite can process.
|
||||
*/
|
||||
export declare const isStaticAsset: (file: string) => boolean;
|
||||
/**
|
||||
* Check if a request is an import from js instead of a native resource request
|
||||
* i.e. differentiate
|
||||
* `import('/style.css')`
|
||||
* from
|
||||
* `<link rel="stylesheet" href="/style.css">`
|
||||
*
|
||||
* The ?import query is injected by serverPluginModuleRewrite.
|
||||
*/
|
||||
export declare const isImportRequest: (ctx: Context) => boolean;
|
||||
export declare function parseNodeModuleId(id: string): {
|
||||
scope: string;
|
||||
name: string;
|
||||
inPkgPath: string;
|
||||
};
|
||||
export declare function removeUnRelatedHmrQuery(url: string): string;
|
||||
88
node_modules/vite/dist/node/utils/pathUtils.js
generated
vendored
Normal file
88
node_modules/vite/dist/node/utils/pathUtils.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.removeUnRelatedHmrQuery = exports.parseNodeModuleId = exports.isImportRequest = exports.isStaticAsset = exports.isDataUrl = exports.isExternalUrl = exports.bareImportRE = exports.parseWithQuery = exports.cleanUrl = exports.hashRE = exports.queryRE = exports.resolveFrom = void 0;
|
||||
const slash_1 = __importDefault(require("slash"));
|
||||
const querystring_1 = __importDefault(require("querystring"));
|
||||
const resolve_1 = __importDefault(require("resolve"));
|
||||
const resolver_1 = require("../resolver");
|
||||
let isRunningWithYarnPnp;
|
||||
try {
|
||||
isRunningWithYarnPnp = Boolean(require('pnpapi'));
|
||||
}
|
||||
catch { }
|
||||
exports.resolveFrom = (root, id) => resolve_1.default.sync(id, {
|
||||
basedir: root,
|
||||
extensions: resolver_1.supportedExts,
|
||||
// necessary to work with pnpm
|
||||
preserveSymlinks: isRunningWithYarnPnp || false
|
||||
});
|
||||
exports.queryRE = /\?.*$/;
|
||||
exports.hashRE = /#.*$/;
|
||||
exports.cleanUrl = (url) => url.replace(exports.hashRE, '').replace(exports.queryRE, '');
|
||||
exports.parseWithQuery = (id) => {
|
||||
const queryMatch = id.match(exports.queryRE);
|
||||
if (queryMatch) {
|
||||
return {
|
||||
path: slash_1.default(exports.cleanUrl(id)),
|
||||
query: querystring_1.default.parse(queryMatch[0].slice(1))
|
||||
};
|
||||
}
|
||||
return {
|
||||
path: id,
|
||||
query: {}
|
||||
};
|
||||
};
|
||||
exports.bareImportRE = /^[^\/\.]/;
|
||||
const externalRE = /^(https?:)?\/\//;
|
||||
exports.isExternalUrl = (url) => externalRE.test(url);
|
||||
const dataUrlRE = /^\s*data:/i;
|
||||
exports.isDataUrl = (url) => dataUrlRE.test(url);
|
||||
const imageRE = /\.(png|jpe?g|gif|svg|ico|webp)(\?.*)?$/;
|
||||
const mediaRE = /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/;
|
||||
const fontsRE = /\.(woff2?|eot|ttf|otf)(\?.*)?$/i;
|
||||
/**
|
||||
* Check if a file is a static asset that vite can process.
|
||||
*/
|
||||
exports.isStaticAsset = (file) => {
|
||||
return imageRE.test(file) || mediaRE.test(file) || fontsRE.test(file);
|
||||
};
|
||||
/**
|
||||
* Check if a request is an import from js instead of a native resource request
|
||||
* i.e. differentiate
|
||||
* `import('/style.css')`
|
||||
* from
|
||||
* `<link rel="stylesheet" href="/style.css">`
|
||||
*
|
||||
* The ?import query is injected by serverPluginModuleRewrite.
|
||||
*/
|
||||
exports.isImportRequest = (ctx) => {
|
||||
return ctx.query.import != null;
|
||||
};
|
||||
function parseNodeModuleId(id) {
|
||||
const parts = id.split('/');
|
||||
let scope = '', name = '', inPkgPath = '';
|
||||
if (id.startsWith('@'))
|
||||
scope = parts.shift();
|
||||
name = parts.shift();
|
||||
inPkgPath = parts.join('/');
|
||||
return {
|
||||
scope,
|
||||
name,
|
||||
inPkgPath
|
||||
};
|
||||
}
|
||||
exports.parseNodeModuleId = parseNodeModuleId;
|
||||
function removeUnRelatedHmrQuery(url) {
|
||||
const { path, query } = exports.parseWithQuery(url);
|
||||
delete query.t;
|
||||
delete query.import;
|
||||
if (Object.keys(query).length) {
|
||||
return path + '?' + querystring_1.default.stringify(query);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
exports.removeUnRelatedHmrQuery = removeUnRelatedHmrQuery;
|
||||
//# sourceMappingURL=pathUtils.js.map
|
||||
1
node_modules/vite/dist/node/utils/pathUtils.js.map
generated
vendored
Normal file
1
node_modules/vite/dist/node/utils/pathUtils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pathUtils.js","sourceRoot":"","sources":["../../../src/node/utils/pathUtils.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,8DAAgD;AAChD,sDAA6B;AAC7B,0CAA2C;AAG3C,IAAI,oBAA6B,CAAA;AACjC,IAAI;IACF,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;CAClD;AAAC,MAAM,GAAE;AAEG,QAAA,WAAW,GAAG,CAAC,IAAY,EAAE,EAAU,EAAE,EAAE,CACtD,iBAAO,CAAC,IAAI,CAAC,EAAE,EAAE;IACf,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,wBAAa;IACzB,8BAA8B;IAC9B,gBAAgB,E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IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACvE,CAAC,CAAA;AAED;;;;;;;;GAQG;AACU,QAAA,eAAe,GAAG,CAAC,GAAY,EAAW,EAAE;IACvD,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAA;AACjC,CAAC,CAAA;AAED,SAAgB,iBAAiB,CAAC,EAAU;IAC1C,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC3B,IAAI,KAAK,GAAG,EAAE,EACZ,IAAI,GAAG,EAAE,EACT,SAAS,GAAG,EAAE,CAAA;IAChB,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,KAAK,GAAG,KAAK,CAAC,KAAK,EAAG,CAAA;IAC9C,IAAI,GAAG,KAAK,CAAC,KAAK,EAAG,CAAA;IACrB,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC3B,OAAO;QACL,KAAK;QACL,IAAI;QACJ,SAAS;KACV,CAAA;AACH,CAAC;AAbD,8CAaC;AAED,SAAgB,uBAAuB,CAAC,GAAW;IACjD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,sBAAc,CAAC,GAAG,CAAC,CAAA;IAC3C,OAAO,KAAK,CAAC,CAAC,CAAA;IACd,OAAO,KAAK,CAAC,MAAM,CAAA;IACnB,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;QAC7B,OAAO,IAAI,GAAG,GAAG,GAAG,qBAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;KACxC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AARD,0DAQC"}
|
||||
14
node_modules/vite/dist/node/utils/resolveVue.d.ts
generated
vendored
Normal file
14
node_modules/vite/dist/node/utils/resolveVue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import sfcCompiler from '@vue/compiler-sfc';
|
||||
interface ResolvedVuePaths {
|
||||
vue: string;
|
||||
'@vue/runtime-dom': string;
|
||||
'@vue/runtime-core': string;
|
||||
'@vue/reactivity': string;
|
||||
'@vue/shared': string;
|
||||
compiler: string;
|
||||
version: string;
|
||||
isLocal: boolean;
|
||||
}
|
||||
export declare function resolveVue(root: string): ResolvedVuePaths;
|
||||
export declare function resolveCompiler(cwd: string): typeof sfcCompiler;
|
||||
export {};
|
||||
86
node_modules/vite/dist/node/utils/resolveVue.js
generated
vendored
Normal file
86
node_modules/vite/dist/node/utils/resolveVue.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveCompiler = exports.resolveVue = void 0;
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const pathUtils_1 = require("./pathUtils");
|
||||
const chalk_1 = __importDefault(require("chalk"));
|
||||
const fsUtils_1 = require("./fsUtils");
|
||||
let resolved = undefined;
|
||||
// Resolve the correct `vue` and `@vue.compiler-sfc` to use.
|
||||
// If the user project has local installations of these, they should be used;
|
||||
// otherwise, fallback to the dependency of Vite itself.
|
||||
function resolveVue(root) {
|
||||
if (resolved) {
|
||||
return resolved;
|
||||
}
|
||||
let vueVersion;
|
||||
let vueBasePath;
|
||||
let compilerPath;
|
||||
const projectPkg = JSON.parse(fsUtils_1.lookupFile(root, ['package.json']) || `{}`);
|
||||
let isLocal = !!(projectPkg.dependencies && projectPkg.dependencies.vue);
|
||||
if (isLocal) {
|
||||
try {
|
||||
const userVuePkg = pathUtils_1.resolveFrom(root, 'vue/package.json');
|
||||
vueBasePath = path_1.default.dirname(userVuePkg);
|
||||
vueVersion = fs_extra_1.default.readJSONSync(userVuePkg).version;
|
||||
isLocal = true;
|
||||
}
|
||||
catch (e) {
|
||||
// user has vue listed but not actually installed.
|
||||
isLocal = false;
|
||||
}
|
||||
}
|
||||
if (isLocal) {
|
||||
// user has local vue, verify that the same version of @vue/compiler-sfc
|
||||
// is also installed.
|
||||
try {
|
||||
const compilerPkgPath = pathUtils_1.resolveFrom(root, '@vue/compiler-sfc/package.json');
|
||||
const compilerPkg = require(compilerPkgPath);
|
||||
if (compilerPkg.version !== vueVersion) {
|
||||
throw new Error();
|
||||
}
|
||||
compilerPath = path_1.default.join(path_1.default.dirname(compilerPkgPath), compilerPkg.main);
|
||||
}
|
||||
catch (e) {
|
||||
// user has local vue but has no compiler-sfc
|
||||
console.error(chalk_1.default.red(`[vite] Error: a local installation of \`vue\` is detected but ` +
|
||||
`no matching \`@vue/compiler-sfc\` is found. Make sure to install ` +
|
||||
`both and use the same version.`));
|
||||
compilerPath = require.resolve('@vue/compiler-sfc');
|
||||
}
|
||||
}
|
||||
else {
|
||||
// user has no local vue, use vite's dependency version
|
||||
vueVersion = require('vue/package.json').version;
|
||||
vueBasePath = path_1.default.dirname(require.resolve('vue/package.json'));
|
||||
compilerPath = require.resolve('@vue/compiler-sfc');
|
||||
}
|
||||
const resolvePath = (name, from) => pathUtils_1.resolveFrom(from, `@vue/${name}/dist/${name}.esm-bundler.js`);
|
||||
// resolve nested dependencies with correct base dirs so that this works with
|
||||
// strict package managers - e.g. pnpm / yarn 2
|
||||
const runtimeDomPath = resolvePath('runtime-dom', vueBasePath);
|
||||
const runtimeCorePath = resolvePath('runtime-core', runtimeDomPath);
|
||||
const reactivityPath = resolvePath('reactivity', runtimeCorePath);
|
||||
const sharedPath = resolvePath('shared', runtimeCorePath);
|
||||
resolved = {
|
||||
version: vueVersion,
|
||||
vue: runtimeDomPath,
|
||||
'@vue/runtime-dom': runtimeDomPath,
|
||||
'@vue/runtime-core': runtimeCorePath,
|
||||
'@vue/reactivity': reactivityPath,
|
||||
'@vue/shared': sharedPath,
|
||||
compiler: compilerPath,
|
||||
isLocal
|
||||
};
|
||||
return resolved;
|
||||
}
|
||||
exports.resolveVue = resolveVue;
|
||||
function resolveCompiler(cwd) {
|
||||
return require(resolveVue(cwd).compiler);
|
||||
}
|
||||
exports.resolveCompiler = resolveCompiler;
|
||||
//# sourceMappingURL=resolveVue.js.map
|
||||
1
node_modules/vite/dist/node/utils/resolveVue.js.map
generated
vendored
Normal file
1
node_modules/vite/dist/node/utils/resolveVue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"resolveVue.js","sourceRoot":"","sources":["../../../src/node/utils/resolveVue.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,wDAAyB;AACzB,2CAAyC;AAEzC,kDAAyB;AACzB,uCAAsC;AAatC,IAAI,QAAQ,GAAiC,SAAS,CAAA;AAEtD,4DAA4D;AAC5D,6EAA6E;AAC7E,wDAAwD;AACxD,SAAgB,UAAU,CAAC,IAAY;IACrC,IAAI,QAAQ,EAAE;QACZ,OAAO,QAAQ,CAAA;KAChB;IACD,IAAI,UAAkB,CAAA;IACtB,IAAI,WAAmB,CAAA;IACvB,IAAI,YAAoB,CAAA;IAExB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAU,CAAC,IAAI,EAAE,CAAC,cAAc,CAAC,CAAC,IAAI,IAAI,CAAC,CAAA;IACzE,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACxE,IAAI,OAAO,EAAE;QACX,IAAI;YACF,MAAM,UAAU,GAAG,uBAAW,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAA;YACxD,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;YACtC,UAAU,GAAG,kBAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,OAAO,CAAA;YAChD,OAAO,GAAG,IAAI,CAAA;SACf;QAAC,OAAO,CAAC,EAAE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AAc,GAAG,WAAW,CAAC,YAAY,EAAE,eAAe,CAAC,CAAA;IACjE,MAAM,UAAU,GAAG,WAAW,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAA;IAEzD,QAAQ,GAAG;QACT,OAAO,EAAE,UAAW;QACpB,GAAG,EAAE,cAAc;QACnB,kBAAkB,EAAE,cAAc;QAClC,mBAAmB,EAAE,eAAe;QACpC,iBAAiB,EAAE,cAAc;QACjC,aAAa,EAAE,UAAU;QACzB,QAAQ,EAAE,YAAY;QACtB,OAAO;KACR,CAAA;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AA1ED,gCA0EC;AAED,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAA;AAC1C,CAAC;AAFD,0CAEC"}
|
||||
4
node_modules/vite/dist/node/utils/transformUtils.d.ts
generated
vendored
Normal file
4
node_modules/vite/dist/node/utils/transformUtils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { IndexHtmlTransform } from '../transform';
|
||||
export declare function asyncReplace(input: string, re: RegExp, replacer: (match: RegExpExecArray) => string | Promise<string>): Promise<string>;
|
||||
export declare function injectScriptToHtml(html: string, script: string): string;
|
||||
export declare function transformIndexHtml(html: string, transforms: IndexHtmlTransform[] | undefined, apply: 'pre' | 'post', isBuild?: boolean): Promise<string>;
|
||||
46
node_modules/vite/dist/node/utils/transformUtils.js
generated
vendored
Normal file
46
node_modules/vite/dist/node/utils/transformUtils.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.transformIndexHtml = exports.injectScriptToHtml = exports.asyncReplace = void 0;
|
||||
async function asyncReplace(input, re, replacer) {
|
||||
let match;
|
||||
let remaining = input;
|
||||
let rewritten = '';
|
||||
while ((match = re.exec(remaining))) {
|
||||
rewritten += remaining.slice(0, match.index);
|
||||
rewritten += await replacer(match);
|
||||
remaining = remaining.slice(match.index + match[0].length);
|
||||
}
|
||||
rewritten += remaining;
|
||||
return rewritten;
|
||||
}
|
||||
exports.asyncReplace = asyncReplace;
|
||||
const injectReplaceRE = [/<head>/, /<!doctype html>/i];
|
||||
function injectScriptToHtml(html, script) {
|
||||
// inject after head or doctype
|
||||
for (const re of injectReplaceRE) {
|
||||
if (re.test(html)) {
|
||||
return html.replace(re, `$&${script}`);
|
||||
}
|
||||
}
|
||||
// if no <head> tag or doctype is present, just prepend
|
||||
return script + html;
|
||||
}
|
||||
exports.injectScriptToHtml = injectScriptToHtml;
|
||||
async function transformIndexHtml(html, transforms = [], apply, isBuild = false) {
|
||||
const trans = transforms
|
||||
.map((t) => {
|
||||
return typeof t === 'function' && apply === 'post'
|
||||
? t
|
||||
: t.apply === apply
|
||||
? t.transform
|
||||
: undefined;
|
||||
})
|
||||
.filter(Boolean);
|
||||
let code = html;
|
||||
for (const transform of trans) {
|
||||
code = await transform({ isBuild, code });
|
||||
}
|
||||
return code;
|
||||
}
|
||||
exports.transformIndexHtml = transformIndexHtml;
|
||||
//# sourceMappingURL=transformUtils.js.map
|
||||
1
node_modules/vite/dist/node/utils/transformUtils.js.map
generated
vendored
Normal file
1
node_modules/vite/dist/node/utils/transformUtils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"transformUtils.js","sourceRoot":"","sources":["../../../src/node/utils/transformUtils.ts"],"names":[],"mappings":";;;AAEO,KAAK,UAAU,YAAY,CAChC,KAAa,EACb,EAAU,EACV,QAA8D;IAE9D,IAAI,KAA6B,CAAA;IACjC,IAAI,SAAS,GAAG,KAAK,CAAA;IACrB,IAAI,SAAS,GAAG,EAAE,CAAA;IAClB,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE;QACnC,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAA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