first commit

This commit is contained in:
monjack
2025-06-20 18:01:48 +08:00
commit 6daa6d65c1
24611 changed files with 2512443 additions and 0 deletions

7
app_vue/node_modules/vue-loader/dist/compiler.d.ts generated vendored Normal file
View File

@ -0,0 +1,7 @@
declare module 'vue/compiler-sfc' {
interface SFCDescriptor {
id: string;
}
}
import * as _compiler from 'vue/compiler-sfc';
export declare let compiler: typeof _compiler;

17
app_vue/node_modules/vue-loader/dist/compiler.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.compiler = void 0;
try {
// Vue 3.2.13+ ships the SFC compiler directly under the `vue` package
// making it no longer necessary to have @vue/compiler-sfc separately installed.
exports.compiler = require('vue/compiler-sfc');
}
catch (e) {
try {
exports.compiler = require('@vue/compiler-sfc');
}
catch (e) {
throw new Error(`@vitejs/plugin-vue requires vue (>=3.2.13) or @vue/compiler-sfc ` +
`to be present in the dependency tree.`);
}
}

1
app_vue/node_modules/vue-loader/dist/cssModules.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export declare function genCSSModulesCode(id: string, index: number, request: string, moduleName: string | boolean, needsHotReload: boolean): string;

21
app_vue/node_modules/vue-loader/dist/cssModules.js generated vendored Normal file
View File

@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.genCSSModulesCode = void 0;
function genCSSModulesCode(id, index, request, moduleName, needsHotReload) {
const styleVar = `style${index}`;
let code = `\nimport ${styleVar} from ${request}`;
// inject variable
const name = typeof moduleName === 'string' ? moduleName : '$style';
code += `\ncssModules["${name}"] = ${styleVar}`;
if (needsHotReload) {
code += `
if (module.hot) {
module.hot.accept(${request}, () => {
cssModules["${name}"] = ${styleVar}
__VUE_HMR_RUNTIME__.rerender("${id}")
})
}`;
}
return code;
}
exports.genCSSModulesCode = genCSSModulesCode;

View File

@ -0,0 +1,4 @@
import type { CompilerOptions, SFCDescriptor } from 'vue/compiler-sfc';
export declare const descriptorCache: Map<string, SFCDescriptor>;
export declare function setDescriptor(filename: string, entry: SFCDescriptor): void;
export declare function getDescriptor(filename: string, compilerOptions?: CompilerOptions): SFCDescriptor;

View File

@ -0,0 +1,54 @@
"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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDescriptor = exports.setDescriptor = exports.descriptorCache = void 0;
const fs = __importStar(require("fs"));
const compiler_1 = require("./compiler");
const { parse } = compiler_1.compiler;
exports.descriptorCache = new Map();
function setDescriptor(filename, entry) {
exports.descriptorCache.set(cleanQuery(filename), entry);
}
exports.setDescriptor = setDescriptor;
function getDescriptor(filename, compilerOptions) {
filename = cleanQuery(filename);
if (exports.descriptorCache.has(filename)) {
return exports.descriptorCache.get(filename);
}
// This function should only be called after the descriptor has been
// cached by the main loader.
// If this is somehow called without a cache hit, it's probably due to sub
// loaders being run in separate threads. The only way to deal with this is to
// read from disk directly...
const source = fs.readFileSync(filename, 'utf-8');
const { descriptor } = parse(source, {
filename,
sourceMap: true,
templateParseOptions: compilerOptions,
});
exports.descriptorCache.set(filename, descriptor);
return descriptor;
}
exports.getDescriptor = getDescriptor;
function cleanQuery(str) {
const i = str.indexOf('?');
return i > 0 ? str.slice(0, i) : str;
}

View File

@ -0,0 +1,2 @@
declare const _default: (sfc: any, props: [string, string][]) => any;
export default _default;

11
app_vue/node_modules/vue-loader/dist/exportHelper.js generated vendored Normal file
View File

@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// runtime helper for setting properties on components
// in a tree-shakable way
exports.default = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};

View File

@ -0,0 +1,2 @@
import type { CompilerError } from 'vue/compiler-sfc';
export declare function formatError(err: SyntaxError | CompilerError, source: string, file: string): void;

17
app_vue/node_modules/vue-loader/dist/formatError.js generated vendored Normal file
View File

@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatError = void 0;
const compiler_1 = require("./compiler");
const chalk = require("chalk");
const { generateCodeFrame } = compiler_1.compiler;
function formatError(err, source, file) {
const loc = err.loc;
if (!loc) {
return;
}
const locString = `:${loc.start.line}:${loc.start.column}`;
const filePath = chalk.gray(`at ${file}${locString}`);
const codeframe = generateCodeFrame(source, loc.start.offset, loc.end.offset);
err.message = `\n${chalk.red(`VueCompilerError: ${err.message}`)}\n${filePath}\n${chalk.yellow(codeframe)}\n`;
}
exports.formatError = formatError;

1
app_vue/node_modules/vue-loader/dist/hotReload.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export declare function genHotReloadCode(id: string, templateRequest: string | undefined): string;

26
app_vue/node_modules/vue-loader/dist/hotReload.js generated vendored Normal file
View File

@ -0,0 +1,26 @@
"use strict";
// __VUE_HMR_RUNTIME__ is injected to global scope by @vue/runtime-core
Object.defineProperty(exports, "__esModule", { value: true });
exports.genHotReloadCode = void 0;
function genHotReloadCode(id, templateRequest) {
return `
/* hot reload */
if (module.hot) {
__exports__.__hmrId = "${id}"
const api = __VUE_HMR_RUNTIME__
module.hot.accept()
if (!api.createRecord('${id}', __exports__)) {
api.reload('${id}', __exports__)
}
${templateRequest ? genTemplateHotReloadCode(id, templateRequest) : ''}
}
`;
}
exports.genHotReloadCode = genHotReloadCode;
function genTemplateHotReloadCode(id, request) {
return `
module.hot.accept(${request}, () => {
api.rerender('${id}', render)
})
`;
}

31
app_vue/node_modules/vue-loader/dist/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,31 @@
import type { LoaderContext } from 'webpack';
import type { TemplateCompiler, CompilerOptions, SFCTemplateCompileOptions, SFCScriptCompileOptions } from 'vue/compiler-sfc';
import VueLoaderPlugin from './plugin';
export { VueLoaderPlugin };
export interface VueLoaderOptions {
babelParserPlugins?: SFCScriptCompileOptions['babelParserPlugins'];
transformAssetUrls?: SFCTemplateCompileOptions['transformAssetUrls'];
compiler?: TemplateCompiler | string;
compilerOptions?: CompilerOptions;
/**
* TODO remove in 3.4
* @deprecated
*/
reactivityTransform?: boolean;
/**
* @experimental
*/
propsDestructure?: boolean;
/**
* @experimental
*/
defineModel?: boolean;
customElement?: boolean | RegExp;
hotReload?: boolean;
exposeFilename?: boolean;
appendExtension?: boolean;
enableTsInTemplate?: boolean;
experimentalInlineMatchResource?: boolean;
isServerBuild?: boolean;
}
export default function loader(this: LoaderContext<VueLoaderOptions>, source: string): string | void;

282
app_vue/node_modules/vue-loader/dist/index.js generated vendored Normal file
View File

@ -0,0 +1,282 @@
"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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VueLoaderPlugin = void 0;
const path = __importStar(require("path"));
const qs = __importStar(require("querystring"));
const hash = require("hash-sum");
const compiler_1 = require("./compiler");
const select_1 = require("./select");
const hotReload_1 = require("./hotReload");
const cssModules_1 = require("./cssModules");
const formatError_1 = require("./formatError");
const plugin_1 = __importDefault(require("./plugin"));
exports.VueLoaderPlugin = plugin_1.default;
const resolveScript_1 = require("./resolveScript");
const descriptorCache_1 = require("./descriptorCache");
const util_1 = require("./util");
let errorEmitted = false;
const { parse } = compiler_1.compiler;
const exportHelperPath = require.resolve('./exportHelper');
function loader(source) {
var _a;
const loaderContext = this;
// check if plugin is installed
if (!errorEmitted &&
!loaderContext['thread-loader'] &&
!loaderContext[plugin_1.default.NS]) {
loaderContext.emitError(new Error(`vue-loader was used without the corresponding plugin. ` +
`Make sure to include VueLoaderPlugin in your webpack config.`));
errorEmitted = true;
}
const stringifyRequest = (r) => (0, util_1.stringifyRequest)(loaderContext, r);
const { mode, target, sourceMap, rootContext, resourcePath, resourceQuery: _resourceQuery = '', _compiler, } = loaderContext;
const isWebpack5 = (0, util_1.testWebpack5)(_compiler);
const rawQuery = _resourceQuery.slice(1);
const incomingQuery = qs.parse(rawQuery);
const resourceQuery = rawQuery ? `&${rawQuery}` : '';
const options = ((0, util_1.getOptions)(loaderContext) || {});
const enableInlineMatchResource = isWebpack5 && Boolean(options.experimentalInlineMatchResource);
const isServer = (_a = options.isServerBuild) !== null && _a !== void 0 ? _a : target === 'node';
const isProduction = mode === 'production' || process.env.NODE_ENV === 'production';
const filename = resourcePath.replace(/\?.*$/, '');
const { descriptor, errors } = parse(source, {
filename,
sourceMap,
templateParseOptions: options.compilerOptions,
});
const asCustomElement = typeof options.customElement === 'boolean'
? options.customElement
: (options.customElement || /\.ce\.vue$/).test(filename);
// cache descriptor
(0, descriptorCache_1.setDescriptor)(filename, descriptor);
if (errors.length) {
errors.forEach((err) => {
(0, formatError_1.formatError)(err, source, resourcePath);
loaderContext.emitError(err);
});
return ``;
}
// module id for scoped CSS & hot-reload
const rawShortFilePath = path
.relative(rootContext || process.cwd(), filename)
.replace(/^(\.\.[\/\\])+/, '');
const shortFilePath = rawShortFilePath.replace(/\\/g, '/');
const id = hash(isProduction
? shortFilePath + '\n' + source.replace(/\r\n/g, '\n')
: shortFilePath);
// if the query has a type field, this is a language block request
// e.g. foo.vue?type=template&id=xxxxx
// and we will return early
if (incomingQuery.type) {
return (0, select_1.selectBlock)(descriptor, id, options, loaderContext, incomingQuery, !!options.appendExtension);
}
// feature information
const hasScoped = descriptor.styles.some((s) => s.scoped);
const needsHotReload = !isServer &&
!isProduction &&
!!(descriptor.script || descriptor.scriptSetup || descriptor.template) &&
options.hotReload !== false;
// extra properties to attach to the script object
// we need to do this in a tree-shaking friendly manner
const propsToAttach = [];
// script
let scriptImport = `const script = {}`;
let isTS = false;
const { script, scriptSetup } = descriptor;
if (script || scriptSetup) {
const lang = (script === null || script === void 0 ? void 0 : script.lang) || (scriptSetup === null || scriptSetup === void 0 ? void 0 : scriptSetup.lang);
isTS = !!(lang && /tsx?/.test(lang));
const externalQuery = Boolean(script && !scriptSetup && script.src)
? `&external`
: ``;
const src = (script && !scriptSetup && script.src) || resourcePath;
const attrsQuery = attrsToQuery((scriptSetup || script).attrs, 'js');
const query = `?vue&type=script${attrsQuery}${resourceQuery}${externalQuery}`;
let scriptRequest;
if (enableInlineMatchResource) {
scriptRequest = stringifyRequest((0, util_1.genMatchResource)(this, src, query, lang || 'js'));
}
else {
scriptRequest = stringifyRequest(src + query);
}
scriptImport =
`import script from ${scriptRequest}\n` +
// support named exports
`export * from ${scriptRequest}`;
}
// template
let templateImport = ``;
let templateRequest;
const renderFnName = isServer ? `ssrRender` : `render`;
const useInlineTemplate = (0, resolveScript_1.canInlineTemplate)(descriptor, isProduction);
if (descriptor.template && !useInlineTemplate) {
const src = descriptor.template.src || resourcePath;
const externalQuery = Boolean(descriptor.template.src) ? `&external` : ``;
const idQuery = `&id=${id}`;
const scopedQuery = hasScoped ? `&scoped=true` : ``;
const attrsQuery = attrsToQuery(descriptor.template.attrs);
const tsQuery = options.enableTsInTemplate !== false && isTS ? `&ts=true` : ``;
const query = `?vue&type=template${idQuery}${scopedQuery}${tsQuery}${attrsQuery}${resourceQuery}${externalQuery}`;
if (enableInlineMatchResource) {
templateRequest = stringifyRequest((0, util_1.genMatchResource)(this, src, query, options.enableTsInTemplate !== false && isTS ? 'ts' : 'js'));
}
else {
templateRequest = stringifyRequest(src + query);
}
templateImport = `import { ${renderFnName} } from ${templateRequest}`;
propsToAttach.push([renderFnName, renderFnName]);
}
// styles
let stylesCode = ``;
let hasCSSModules = false;
const nonWhitespaceRE = /\S+/;
if (descriptor.styles.length) {
descriptor.styles
.filter((style) => style.src || nonWhitespaceRE.test(style.content))
.forEach((style, i) => {
const src = style.src || resourcePath;
const attrsQuery = attrsToQuery(style.attrs, 'css');
const lang = String(style.attrs.lang || 'css');
// make sure to only pass id when necessary so that we don't inject
// duplicate tags when multiple components import the same css file
const idQuery = !style.src || style.scoped ? `&id=${id}` : ``;
const inlineQuery = asCustomElement ? `&inline` : ``;
const externalQuery = Boolean(style.src) ? `&external` : ``;
const query = `?vue&type=style&index=${i}${idQuery}${inlineQuery}${attrsQuery}${resourceQuery}${externalQuery}`;
let styleRequest;
if (enableInlineMatchResource) {
styleRequest = stringifyRequest((0, util_1.genMatchResource)(this, src, query, lang));
}
else {
styleRequest = stringifyRequest(src + query);
}
if (style.module) {
if (asCustomElement) {
loaderContext.emitError(new Error(`<style module> is not supported in custom element mode.`));
}
if (!hasCSSModules) {
stylesCode += `\nconst cssModules = {}`;
propsToAttach.push([`__cssModules`, `cssModules`]);
hasCSSModules = true;
}
stylesCode += (0, cssModules_1.genCSSModulesCode)(id, i, styleRequest, style.module, needsHotReload);
}
else {
if (asCustomElement) {
stylesCode += `\nimport _style_${i} from ${styleRequest}`;
}
else {
stylesCode += `\nimport ${styleRequest}`;
}
}
// TODO SSR critical CSS collection
});
if (asCustomElement) {
propsToAttach.push([
`styles`,
`[${descriptor.styles.map((_, i) => `_style_${i}`)}]`,
]);
}
}
let code = [templateImport, scriptImport, stylesCode]
.filter(Boolean)
.join('\n');
// attach scope Id for runtime use
if (hasScoped) {
propsToAttach.push([`__scopeId`, `"data-v-${id}"`]);
}
// Expose filename. This is used by the devtools and Vue runtime warnings.
if (!isProduction) {
// Expose the file's full path in development, so that it can be opened
// from the devtools.
propsToAttach.push([
`__file`,
JSON.stringify(rawShortFilePath.replace(/\\/g, '/')),
]);
}
else if (options.exposeFilename) {
// Libraries can opt-in to expose their components' filenames in production builds.
// For security reasons, only expose the file's basename in production.
propsToAttach.push([`__file`, JSON.stringify(path.basename(resourcePath))]);
}
// custom blocks
if (descriptor.customBlocks && descriptor.customBlocks.length) {
code += `\n/* custom blocks */\n`;
code +=
descriptor.customBlocks
.map((block, i) => {
const src = block.attrs.src || resourcePath;
const attrsQuery = attrsToQuery(block.attrs);
const blockTypeQuery = `&blockType=${qs.escape(block.type)}`;
const issuerQuery = block.attrs.src
? `&issuerPath=${qs.escape(resourcePath)}`
: '';
const externalQuery = Boolean(block.attrs.src) ? `&external` : ``;
const query = `?vue&type=custom&index=${i}${blockTypeQuery}${issuerQuery}${attrsQuery}${resourceQuery}${externalQuery}`;
let customRequest;
if (enableInlineMatchResource) {
customRequest = stringifyRequest((0, util_1.genMatchResource)(this, src, query, block.attrs.lang));
}
else {
customRequest = stringifyRequest(src + query);
}
return (`import block${i} from ${customRequest}\n` +
`if (typeof block${i} === 'function') block${i}(script)`);
})
.join(`\n`) + `\n`;
}
// finalize
if (!propsToAttach.length) {
code += `\n\nconst __exports__ = script;`;
}
else {
code += `\n\nimport exportComponent from ${stringifyRequest(exportHelperPath)}`;
code += `\nconst __exports__ = /*#__PURE__*/exportComponent(script, [${propsToAttach
.map(([key, val]) => `['${key}',${val}]`)
.join(',')}])`;
}
if (needsHotReload) {
code += (0, hotReload_1.genHotReloadCode)(id, templateRequest);
}
code += `\n\nexport default __exports__`;
return code;
}
exports.default = loader;
// these are built-in query parameters so should be ignored
// if the user happen to add them as attrs
const ignoreList = ['id', 'index', 'src', 'type'];
function attrsToQuery(attrs, langFallback) {
let query = ``;
for (const name in attrs) {
const value = attrs[name];
if (!ignoreList.includes(name)) {
query += `&${qs.escape(name)}=${value ? qs.escape(String(value)) : ``}`;
}
}
if (langFallback && !(`lang` in attrs)) {
query += `&lang=${langFallback}`;
}
return query;
}

4
app_vue/node_modules/vue-loader/dist/pitcher.d.ts generated vendored Normal file
View File

@ -0,0 +1,4 @@
import type { LoaderDefinitionFunction } from 'webpack';
declare const pitcher: LoaderDefinitionFunction;
export declare const pitch: () => string | undefined;
export default pitcher;

149
app_vue/node_modules/vue-loader/dist/pitcher.js generated vendored Normal file
View File

@ -0,0 +1,149 @@
"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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.pitch = void 0;
const qs = __importStar(require("querystring"));
const util_1 = require("./util");
const selfPath = require.resolve('./index');
// const templateLoaderPath = require.resolve('./templateLoader')
const stylePostLoaderPath = require.resolve('./stylePostLoader');
const styleInlineLoaderPath = require.resolve('./styleInlineLoader');
const isESLintLoader = (l) => /(\/|\\|@)eslint-loader/.test(l.path);
const isNullLoader = (l) => /(\/|\\|@)null-loader/.test(l.path);
const isCSSLoader = (l) => /(\/|\\|@)css-loader/.test(l.path);
const isCacheLoader = (l) => /(\/|\\|@)cache-loader/.test(l.path);
const isNotPitcher = (l) => l.path !== __filename;
const pitcher = (code) => code;
// This pitching loader is responsible for intercepting all vue block requests
// and transform it into appropriate requests.
const pitch = function () {
var _a;
const context = this;
const rawLoaders = context.loaders.filter(isNotPitcher);
let loaders = rawLoaders;
// do not inject if user uses null-loader to void the type (#1239)
if (loaders.some(isNullLoader)) {
return;
}
const query = qs.parse(context.resourceQuery.slice(1));
const isInlineBlock = /\.vue$/.test(context.resourcePath);
// eslint-loader may get matched multiple times
// if this is an inline block, since the whole file itself is being linted,
// remove eslint-loader to avoid duplicate linting.
if (isInlineBlock) {
loaders = loaders.filter((l) => !isESLintLoader(l));
}
// Important: dedupe loaders since both the original rule
// and the cloned rule would match a source import request or a
// resourceQuery-only rule that intends to target a custom block with no lang
const seen = new Map();
loaders = loaders.filter((loader) => {
const identifier = typeof loader === 'string'
? loader
: // Dedupe based on both path and query if available. This is important
// in Vue CLI so that postcss-loaders with different options can co-exist
loader.path + loader.query;
if (!seen.has(identifier)) {
seen.set(identifier, true);
return true;
}
});
// Inject style-post-loader before css-loader for scoped CSS and trimming
const isWebpack5 = (0, util_1.testWebpack5)(context._compiler);
const options = ((0, util_1.getOptions)(context) || {});
if (query.type === `style`) {
if (isWebpack5 && ((_a = context._compiler) === null || _a === void 0 ? void 0 : _a.options.experiments.css)) {
// If user enables `experiments.css`, then we are trying to emit css code directly.
// Although we can target requests like `xxx.vue?type=style` to match `type: "css"`,
// it will make the plugin a mess.
if (!options.experimentalInlineMatchResource) {
context.emitError(new Error('`experimentalInlineMatchResource` should be enabled if `experiments.css` enabled currently'));
return '';
}
if (query.inline || query.module) {
context.emitError(new Error('`inline` or `module` is currently not supported with `experiments.css` enabled'));
return '';
}
const loaderString = [stylePostLoaderPath, ...loaders]
.map((loader) => {
return typeof loader === 'string' ? loader : loader.request;
})
.join('!');
const styleRequest = (0, util_1.stringifyRequest)(context, `${context.resourcePath}${query.lang ? `.${query.lang}` : ''}${context.resourceQuery}!=!-!${loaderString}!${context.resource}`);
return `@import ${styleRequest};`;
}
const cssLoaderIndex = loaders.findIndex(isCSSLoader);
if (cssLoaderIndex > -1) {
// if inlined, ignore any loaders after css-loader and replace w/ inline
// loader
const afterLoaders = query.inline != null
? [styleInlineLoaderPath]
: loaders.slice(0, cssLoaderIndex + 1);
const beforeLoaders = loaders.slice(cssLoaderIndex + 1);
return genProxyModule([...afterLoaders, stylePostLoaderPath, ...beforeLoaders], context, !!query.module || query.inline != null, query.lang || 'css');
}
}
// if a custom block has no other matching loader other than vue-loader itself
// or cache-loader, we should ignore it
if (query.type === `custom` && shouldIgnoreCustomBlock(loaders)) {
return ``;
}
// Rewrite request. Technically this should only be done when we have deduped
// loaders. But somehow this is required for block source maps to work.
return genProxyModule(loaders, context, query.type !== 'template', query.ts ? 'ts' : query.lang);
};
exports.pitch = pitch;
function genProxyModule(loaders, context, exportDefault = true, lang = 'js') {
const request = genRequest(loaders, lang, context);
// return a proxy module which simply re-exports everything from the
// actual request. Note for template blocks the compiled module has no
// default export.
return ((exportDefault ? `export { default } from ${request}; ` : ``) +
`export * from ${request}`);
}
function genRequest(loaders, lang, context) {
const isWebpack5 = (0, util_1.testWebpack5)(context._compiler);
const options = ((0, util_1.getOptions)(context) || {});
const enableInlineMatchResource = isWebpack5 && options.experimentalInlineMatchResource;
const loaderStrings = loaders.map((loader) => {
return typeof loader === 'string' ? loader : loader.request;
});
const resource = context.resourcePath + context.resourceQuery;
if (enableInlineMatchResource) {
return (0, util_1.stringifyRequest)(context, `${context.resourcePath}${lang ? `.${lang}` : ''}${context.resourceQuery}!=!-!${[...loaderStrings, resource].join('!')}`);
}
return (0, util_1.stringifyRequest)(context, '-!' + [...loaderStrings, resource].join('!'));
}
function shouldIgnoreCustomBlock(loaders) {
const actualLoaders = loaders.filter((loader) => {
// vue-loader
if (loader.path === selfPath) {
return false;
}
// cache-loader
if (isCacheLoader(loader)) {
return false;
}
return true;
});
return actualLoaders.length === 0;
}
exports.default = pitcher;

6
app_vue/node_modules/vue-loader/dist/plugin.d.ts generated vendored Normal file
View File

@ -0,0 +1,6 @@
import type { Compiler } from 'webpack';
declare class Plugin {
static NS: string;
apply(compiler: Compiler): void;
}
export default Plugin;

20
app_vue/node_modules/vue-loader/dist/plugin.js generated vendored Normal file
View File

@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("./util");
const NS = 'vue-loader';
class Plugin {
apply(compiler) {
let Ctor;
if ((0, util_1.testWebpack5)(compiler)) {
// webpack5 and upper
Ctor = require('./pluginWebpack5').default;
}
else {
// webpack4 and lower
Ctor = require('./pluginWebpack4').default;
}
new Ctor().apply(compiler);
}
}
Plugin.NS = NS;
exports.default = Plugin;

View File

@ -0,0 +1,6 @@
import type { Compiler } from 'webpack';
declare class VueLoaderPlugin {
static NS: string;
apply(compiler: Compiler): void;
}
export default VueLoaderPlugin;

237
app_vue/node_modules/vue-loader/dist/pluginWebpack4.js generated vendored Normal file
View File

@ -0,0 +1,237 @@
"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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const qs = __importStar(require("querystring"));
const resolveScript_1 = require("./resolveScript");
const fs = require("fs");
const compiler_1 = require("./compiler");
const descriptorCache_1 = require("./descriptorCache");
const util_1 = require("./util");
const RuleSet = require('webpack/lib/RuleSet');
const id = 'vue-loader-plugin';
const NS = 'vue-loader';
class VueLoaderPlugin {
apply(compiler) {
// inject NS for plugin installation check in the main loader
compiler.hooks.compilation.tap(id, (compilation) => {
compilation.hooks.normalModuleLoader.tap(id, (loaderContext) => {
loaderContext[NS] = true;
});
});
const rawRules = compiler.options.module.rules;
// use webpack's RuleSet utility to normalize user rules
const rules = new RuleSet(rawRules).rules;
// find the rule that applies to vue files
let vueRuleIndex = rawRules.findIndex(createMatcher(`foo.vue`));
if (vueRuleIndex < 0) {
vueRuleIndex = rawRules.findIndex(createMatcher(`foo.vue.html`));
}
const vueRule = rules[vueRuleIndex];
if (!vueRule) {
throw new Error(`[VueLoaderPlugin Error] No matching rule for .vue files found.\n` +
`Make sure there is at least one root-level rule that matches .vue or .vue.html files.`);
}
if (vueRule.oneOf) {
throw new Error(`[VueLoaderPlugin Error] vue-loader currently does not support vue rules with oneOf.`);
}
// get the normlized "use" for vue files
const vueUse = vueRule.use;
// get vue-loader options
const vueLoaderUseIndex = vueUse.findIndex((u) => {
// FIXME: this code logic is incorrect when project paths starts with `vue-loader-something`
return /^vue-loader|(\/|\\|@)vue-loader/.test(u.loader || '');
});
if (vueLoaderUseIndex < 0) {
throw new Error(`[VueLoaderPlugin Error] No matching use for vue-loader is found.\n` +
`Make sure the rule matching .vue files include vue-loader in its use.`);
}
const vueLoaderUse = vueUse[vueLoaderUseIndex];
const vueLoaderOptions = (vueLoaderUse.options =
vueLoaderUse.options || {});
// for each user rule (except the vue rule), create a cloned rule
// that targets the corresponding language blocks in *.vue files.
const clonedRules = rules.filter((r) => r !== vueRule).map(cloneRule);
// rule for template compiler
const templateCompilerRule = {
loader: require.resolve('./templateLoader'),
resourceQuery: (query) => {
const parsed = qs.parse(query.slice(1));
return parsed.vue != null && parsed.type === 'template';
},
options: Object.assign({ ident: vueLoaderUse.ident }, vueLoaderOptions),
};
// for each rule that matches plain .js/.ts files, also create a clone and
// match it against the compiled template code inside *.vue files, so that
// compiled vue render functions receive the same treatment as user code
// (mostly babel)
const matchesJS = createMatcher(`test.js`);
const matchesTS = createMatcher(`test.ts`);
const jsRulesForRenderFn = rules
.filter((r) => r !== vueRule && (matchesJS(r) || matchesTS(r)))
.map(cloneRuleForRenderFn);
// pitcher for block requests (for injecting stylePostLoader and deduping
// loaders matched for src imports)
const pitcher = {
loader: require.resolve('./pitcher'),
resourceQuery: (query) => {
const parsed = qs.parse(query.slice(1));
return parsed.vue != null;
},
};
// replace original rules
compiler.options.module.rules = [
pitcher,
...jsRulesForRenderFn,
templateCompilerRule,
...clonedRules,
...rules,
];
// 3.3 HMR support for imported types
if ((0, util_1.needHMR)(vueLoaderOptions, compiler.options) &&
compiler_1.compiler.invalidateTypeCache) {
let watcher;
const WatchPack = require('watchpack');
compiler.hooks.afterCompile.tap(id, (compilation) => {
if (compilation.compiler === compiler) {
// type-only imports can be tree-shaken and not registered as a
// watched file at all, so we have to manually ensure they are watched.
const files = [...resolveScript_1.typeDepToSFCMap.keys()];
const oldWatcher = watcher;
watcher = new WatchPack({ aggregateTimeout: 0 });
watcher.once('aggregated', (changes, removals) => {
for (const file of changes) {
// bust compiler-sfc type dep cache
compiler_1.compiler.invalidateTypeCache(file);
const affectedSFCs = resolveScript_1.typeDepToSFCMap.get(file);
if (affectedSFCs) {
for (const sfc of affectedSFCs) {
// bust script resolve cache
const desc = descriptorCache_1.descriptorCache.get(sfc);
if (desc)
resolveScript_1.clientCache.delete(desc);
// force update importing SFC
fs.writeFileSync(sfc, fs.readFileSync(sfc, 'utf-8'));
}
}
}
for (const file of removals) {
compiler_1.compiler.invalidateTypeCache(file);
}
});
watcher.watch({ files, startTime: Date.now() });
if (oldWatcher) {
oldWatcher.close();
}
}
});
compiler.hooks.watchClose.tap(id, () => {
if (watcher) {
watcher.close();
}
});
// In some cases, e.g. in this project's tests,
// even though needsHMR() returns true, webpack is not watching, thus no watchClose hook is called.
// So we need to close the watcher when webpack is done.
compiler.hooks.done.tap(id, () => {
if (watcher) {
watcher.close();
}
});
}
}
}
VueLoaderPlugin.NS = NS;
function createMatcher(fakeFile) {
return (rule) => {
// #1201 we need to skip the `include` check when locating the vue rule
const clone = Object.assign({}, rule);
delete clone.include;
const normalized = RuleSet.normalizeRule(clone, {}, '');
return !rule.enforce && normalized.resource && normalized.resource(fakeFile);
};
}
function cloneRule(rule) {
const resource = rule.resource;
const resourceQuery = rule.resourceQuery;
// Assuming `test` and `resourceQuery` tests are executed in series and
// synchronously (which is true based on RuleSet's implementation), we can
// save the current resource being matched from `test` so that we can access
// it in `resourceQuery`. This ensures when we use the normalized rule's
// resource check, include/exclude are matched correctly.
let currentResource;
const res = Object.assign(Object.assign({}, rule), { resource: (resource) => {
currentResource = resource;
return true;
}, resourceQuery: (query) => {
const parsed = qs.parse(query.slice(1));
if (parsed.vue == null) {
return false;
}
if (resource && parsed.lang == null) {
return false;
}
const fakeResourcePath = `${currentResource}.${parsed.lang}`;
if (resource && !resource(fakeResourcePath)) {
return false;
}
if (resourceQuery && !resourceQuery(query)) {
return false;
}
return true;
} });
if (rule.rules) {
res.rules = rule.rules.map(cloneRule);
}
if (rule.oneOf) {
res.oneOf = rule.oneOf.map(cloneRule);
}
return res;
}
function cloneRuleForRenderFn(rule) {
const resource = rule.resource;
const resourceQuery = rule.resourceQuery;
let currentResource;
const res = Object.assign(Object.assign({}, rule), { resource: (resource) => {
currentResource = resource;
return true;
}, resourceQuery: (query) => {
const parsed = qs.parse(query.slice(1));
if (parsed.vue == null || parsed.type !== 'template') {
return false;
}
const fakeResourcePath = `${currentResource}.${parsed.ts ? `ts` : `js`}`;
if (resource && !resource(fakeResourcePath)) {
return false;
}
if (resourceQuery && !resourceQuery(query)) {
return false;
}
return true;
} });
if (rule.rules) {
res.rules = rule.rules.map(cloneRuleForRenderFn);
}
if (rule.oneOf) {
res.oneOf = rule.oneOf.map(cloneRuleForRenderFn);
}
return res;
}
exports.default = VueLoaderPlugin;

View File

@ -0,0 +1,6 @@
import type { Compiler } from 'webpack';
declare class VueLoaderPlugin {
static NS: string;
apply(compiler: Compiler): void;
}
export default VueLoaderPlugin;

314
app_vue/node_modules/vue-loader/dist/pluginWebpack5.js generated vendored Normal file
View File

@ -0,0 +1,314 @@
"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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const qs = __importStar(require("querystring"));
const util_1 = require("./util");
const resolveScript_1 = require("./resolveScript");
const compiler_1 = require("./compiler");
const descriptorCache_1 = require("./descriptorCache");
const id = 'vue-loader-plugin';
const NS = 'vue-loader';
const NormalModule = require('webpack/lib/NormalModule');
const BasicEffectRulePlugin = require('webpack/lib/rules/BasicEffectRulePlugin');
const BasicMatcherRulePlugin = require('webpack/lib/rules/BasicMatcherRulePlugin');
const UseEffectRulePlugin = require('webpack/lib/rules/UseEffectRulePlugin');
const RuleSetCompiler = require('webpack/lib/rules/RuleSetCompiler');
let objectMatcherRulePlugins = [];
try {
const ObjectMatcherRulePlugin = require('webpack/lib/rules/ObjectMatcherRulePlugin');
objectMatcherRulePlugins.push(new ObjectMatcherRulePlugin('assert', 'assertions'), new ObjectMatcherRulePlugin('descriptionData'));
}
catch (e) {
const DescriptionDataMatcherRulePlugin = require('webpack/lib/rules/DescriptionDataMatcherRulePlugin');
objectMatcherRulePlugins.push(new DescriptionDataMatcherRulePlugin());
}
const ruleSetCompiler = new RuleSetCompiler([
new BasicMatcherRulePlugin('test', 'resource'),
new BasicMatcherRulePlugin('mimetype'),
new BasicMatcherRulePlugin('dependency'),
new BasicMatcherRulePlugin('include', 'resource'),
new BasicMatcherRulePlugin('exclude', 'resource', true),
new BasicMatcherRulePlugin('conditions'),
new BasicMatcherRulePlugin('resource'),
new BasicMatcherRulePlugin('resourceQuery'),
new BasicMatcherRulePlugin('resourceFragment'),
new BasicMatcherRulePlugin('realResource'),
new BasicMatcherRulePlugin('issuer'),
new BasicMatcherRulePlugin('compiler'),
new BasicMatcherRulePlugin('issuerLayer'),
...objectMatcherRulePlugins,
new BasicEffectRulePlugin('type'),
new BasicEffectRulePlugin('sideEffects'),
new BasicEffectRulePlugin('parser'),
new BasicEffectRulePlugin('resolve'),
new BasicEffectRulePlugin('generator'),
new BasicEffectRulePlugin('layer'),
new UseEffectRulePlugin(),
]);
class VueLoaderPlugin {
apply(compiler) {
// @ts-ignore
const normalModule = compiler.webpack.NormalModule || NormalModule;
// add NS marker so that the loader can detect and report missing plugin
compiler.hooks.compilation.tap(id, (compilation) => {
normalModule
.getCompilationHooks(compilation)
.loader.tap(id, (loaderContext) => {
loaderContext[NS] = true;
});
});
const rules = compiler.options.module.rules;
let rawVueRule;
let vueRules = [];
for (const rawRule of rules) {
// skip rules with 'enforce'. eg. rule for eslint-loader
if (rawRule.enforce) {
continue;
}
vueRules = match(rawRule, 'foo.vue');
if (!vueRules.length) {
vueRules = match(rawRule, 'foo.vue.html');
}
if (vueRules.length > 0) {
if (rawRule.oneOf) {
throw new Error(`[VueLoaderPlugin Error] vue-loader currently does not support vue rules with oneOf.`);
}
rawVueRule = rawRule;
break;
}
}
if (!vueRules.length) {
throw new Error(`[VueLoaderPlugin Error] No matching rule for .vue files found.\n` +
`Make sure there is at least one root-level rule that matches .vue or .vue.html files.`);
}
// get the normalized "use" for vue files
const vueUse = vueRules
.filter((rule) => rule.type === 'use')
.map((rule) => rule.value);
// get vue-loader options
const vueLoaderUseIndex = vueUse.findIndex((u) => {
// FIXME: this code logic is incorrect when project paths starts with `vue-loader-something`
return /^vue-loader|(\/|\\|@)vue-loader/.test(u.loader);
});
if (vueLoaderUseIndex < 0) {
throw new Error(`[VueLoaderPlugin Error] No matching use for vue-loader is found.\n` +
`Make sure the rule matching .vue files include vue-loader in its use.`);
}
// make sure vue-loader options has a known ident so that we can share
// options by reference in the template-loader by using a ref query like
// template-loader??vue-loader-options
const vueLoaderUse = vueUse[vueLoaderUseIndex];
const vueLoaderOptions = (vueLoaderUse.options =
vueLoaderUse.options || {});
const enableInlineMatchResource = vueLoaderOptions.experimentalInlineMatchResource;
// for each user rule (except the vue rule), create a cloned rule
// that targets the corresponding language blocks in *.vue files.
const refs = new Map();
const clonedRules = rules
.filter((r) => r !== rawVueRule)
.map((rawRule) => cloneRule(rawRule, refs, langBlockRuleCheck, langBlockRuleResource));
// fix conflict with config.loader and config.options when using config.use
delete rawVueRule.loader;
delete rawVueRule.options;
rawVueRule.use = vueUse;
// rule for template compiler
const templateCompilerRule = {
loader: require.resolve('./templateLoader'),
resourceQuery: (query) => {
if (!query) {
return false;
}
const parsed = qs.parse(query.slice(1));
return parsed.vue != null && parsed.type === 'template';
},
options: vueLoaderOptions,
};
// for each rule that matches plain .js files, also create a clone and
// match it against the compiled template code inside *.vue files, so that
// compiled vue render functions receive the same treatment as user code
// (mostly babel)
const jsRulesForRenderFn = rules
.filter((r) => r !== rawVueRule &&
(match(r, 'test.js').length > 0 || match(r, 'test.ts').length > 0))
.map((rawRule) => cloneRule(rawRule, refs, jsRuleCheck, jsRuleResource));
// global pitcher (responsible for injecting template compiler loader & CSS
// post loader)
const pitcher = {
loader: require.resolve('./pitcher'),
resourceQuery: (query) => {
if (!query) {
return false;
}
const parsed = qs.parse(query.slice(1));
return parsed.vue != null;
},
options: vueLoaderOptions,
};
// replace original rules
if (enableInlineMatchResource) {
// Match rules using `vue-loader`
const vueLoaderRules = rules.filter((rule) => {
const matchOnce = (use) => {
let loaderString = '';
if (!use) {
return loaderString;
}
if (typeof use === 'string') {
loaderString = use;
}
else if (Array.isArray(use)) {
loaderString = matchOnce(use[0]);
}
else if (typeof use === 'object' && use.loader) {
loaderString = use.loader;
}
return loaderString;
};
const loader = rule.loader || matchOnce(rule.use);
return (loader === require('../package.json').name ||
loader.startsWith(require.resolve('./index')));
});
compiler.options.module.rules = [
pitcher,
...rules.filter((rule) => !vueLoaderRules.includes(rule)),
templateCompilerRule,
...clonedRules,
...vueLoaderRules,
];
}
else {
compiler.options.module.rules = [
pitcher,
...jsRulesForRenderFn,
templateCompilerRule,
...clonedRules,
...rules,
];
}
// 3.3 HMR support for imported types
if ((0, util_1.needHMR)(vueLoaderOptions, compiler.options) &&
compiler_1.compiler.invalidateTypeCache) {
compiler.hooks.afterCompile.tap(id, (compilation) => {
if (compilation.compiler === compiler) {
for (const file of resolveScript_1.typeDepToSFCMap.keys()) {
compilation.fileDependencies.add(file);
}
}
});
compiler.hooks.watchRun.tap(id, () => {
if (!compiler.modifiedFiles)
return;
for (const file of compiler.modifiedFiles) {
compiler_1.compiler.invalidateTypeCache(file);
const affectedSFCs = resolveScript_1.typeDepToSFCMap.get(file);
if (affectedSFCs) {
for (const sfc of affectedSFCs) {
// bust script resolve cache
const desc = descriptorCache_1.descriptorCache.get(sfc);
if (desc)
resolveScript_1.clientCache.delete(desc);
// force update importing SFC
// @ts-ignore
compiler.fileTimestamps.set(sfc, {
safeTime: Date.now(),
timestamp: Date.now(),
});
}
}
}
for (const file of compiler.removedFiles) {
compiler_1.compiler.invalidateTypeCache(file);
}
});
}
}
}
VueLoaderPlugin.NS = NS;
const matcherCache = new WeakMap();
function match(rule, fakeFile) {
let ruleSet = matcherCache.get(rule);
if (!ruleSet) {
// skip the `include` check when locating the vue rule
const clonedRawRule = Object.assign({}, rule);
delete clonedRawRule.include;
ruleSet = ruleSetCompiler.compile([clonedRawRule]);
matcherCache.set(rule, ruleSet);
}
return ruleSet.exec({
resource: fakeFile,
});
}
const langBlockRuleCheck = (query, rule) => {
return (query.type === 'custom' || !rule.conditions.length || query.lang != null);
};
const langBlockRuleResource = (query, resource) => `${resource}.${query.lang}`;
const jsRuleCheck = (query) => {
return query.type === 'template';
};
const jsRuleResource = (query, resource) => `${resource}.${query.ts ? `ts` : `js`}`;
let uid = 0;
function cloneRule(rawRule, refs, ruleCheck, ruleResource) {
const compiledRule = ruleSetCompiler.compileRule(`clonedRuleSet-${++uid}`, rawRule, refs);
// do not process rule with enforce
if (!rawRule.enforce) {
const ruleUse = compiledRule.effects
.filter((effect) => effect.type === 'use')
.map((effect) => effect.value);
// fix conflict with config.loader and config.options when using config.use
delete rawRule.loader;
delete rawRule.options;
rawRule.use = ruleUse;
}
let currentResource;
const res = Object.assign(Object.assign({}, rawRule), { resource: (resources) => {
currentResource = resources;
return true;
}, resourceQuery: (query) => {
if (!query) {
return false;
}
const parsed = qs.parse(query.slice(1));
if (parsed.vue == null) {
return false;
}
if (!ruleCheck(parsed, compiledRule)) {
return false;
}
const fakeResourcePath = ruleResource(parsed, currentResource);
for (const condition of compiledRule.conditions) {
// add support for resourceQuery
const request = condition.property === 'resourceQuery' ? query : fakeResourcePath;
if (condition && !condition.fn(request)) {
return false;
}
}
return true;
} });
delete res.test;
if (rawRule.rules) {
res.rules = rawRule.rules.map((rule) => cloneRule(rule, refs, ruleCheck, ruleResource));
}
if (rawRule.oneOf) {
res.oneOf = rawRule.oneOf.map((rule) => cloneRule(rule, refs, ruleCheck, ruleResource));
}
return res;
}
exports.default = VueLoaderPlugin;

View File

@ -0,0 +1,13 @@
import type { LoaderContext } from 'webpack';
import type { SFCDescriptor, SFCScriptBlock } from 'vue/compiler-sfc';
import type { VueLoaderOptions } from 'src';
export declare const clientCache: WeakMap<SFCDescriptor, SFCScriptBlock | null>;
export declare const typeDepToSFCMap: Map<string, Set<string>>;
/**
* inline template mode can only be enabled if:
* - is production (separate compilation needed for HMR during dev)
* - template has no pre-processor (separate loader chain required)
* - template is not using src
*/
export declare function canInlineTemplate(descriptor: SFCDescriptor, isProd: boolean): boolean;
export declare function resolveScript(descriptor: SFCDescriptor, scopeId: string, options: VueLoaderOptions, loaderContext: LoaderContext<VueLoaderOptions>): SFCScriptBlock | null;

86
app_vue/node_modules/vue-loader/dist/resolveScript.js generated vendored Normal file
View File

@ -0,0 +1,86 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveScript = exports.canInlineTemplate = exports.typeDepToSFCMap = exports.clientCache = void 0;
const util_1 = require("./util");
const compiler_1 = require("./compiler");
const { compileScript } = compiler_1.compiler;
exports.clientCache = new WeakMap();
const serverCache = new WeakMap();
exports.typeDepToSFCMap = new Map();
/**
* inline template mode can only be enabled if:
* - is production (separate compilation needed for HMR during dev)
* - template has no pre-processor (separate loader chain required)
* - template is not using src
*/
function canInlineTemplate(descriptor, isProd) {
const templateLang = descriptor.template && descriptor.template.lang;
const templateSrc = descriptor.template && descriptor.template.src;
return isProd && !!descriptor.scriptSetup && !templateLang && !templateSrc;
}
exports.canInlineTemplate = canInlineTemplate;
function resolveScript(descriptor, scopeId, options, loaderContext) {
var _a;
if (!descriptor.script && !descriptor.scriptSetup) {
return null;
}
const isProd = loaderContext.mode === 'production' || process.env.NODE_ENV === 'production';
const isServer = (_a = options.isServerBuild) !== null && _a !== void 0 ? _a : loaderContext.target === 'node';
const enableInline = canInlineTemplate(descriptor, isProd);
const cacheToUse = isServer ? serverCache : exports.clientCache;
const cached = cacheToUse.get(descriptor);
if (cached) {
return cached;
}
let resolved = null;
let templateCompiler;
if (typeof options.compiler === 'string') {
templateCompiler = require(options.compiler);
}
else {
templateCompiler = options.compiler;
}
try {
resolved = compileScript(descriptor, {
id: scopeId,
isProd,
inlineTemplate: enableInline,
// @ts-ignore this has been removed in 3.4
reactivityTransform: options.reactivityTransform,
propsDestructure: options.propsDestructure,
defineModel: options.defineModel,
babelParserPlugins: options.babelParserPlugins,
templateOptions: {
ssr: isServer,
compiler: templateCompiler,
compilerOptions: Object.assign(Object.assign({}, options.compilerOptions), (0, util_1.resolveTemplateTSOptions)(descriptor, options)),
transformAssetUrls: options.transformAssetUrls || true,
},
});
}
catch (e) {
loaderContext.emitError(e);
}
if (!isProd && (resolved === null || resolved === void 0 ? void 0 : resolved.deps)) {
for (const [key, sfcs] of exports.typeDepToSFCMap) {
if (sfcs.has(descriptor.filename) && !resolved.deps.includes(key)) {
sfcs.delete(descriptor.filename);
if (!sfcs.size) {
exports.typeDepToSFCMap.delete(key);
}
}
}
for (const dep of resolved.deps) {
const existingSet = exports.typeDepToSFCMap.get(dep);
if (!existingSet) {
exports.typeDepToSFCMap.set(dep, new Set([descriptor.filename]));
}
else {
existingSet.add(descriptor.filename);
}
}
}
cacheToUse.set(descriptor, resolved);
return resolved;
}
exports.resolveScript = resolveScript;

6
app_vue/node_modules/vue-loader/dist/select.d.ts generated vendored Normal file
View File

@ -0,0 +1,6 @@
/// <reference types="node" />
import type { LoaderContext } from 'webpack';
import type { SFCDescriptor } from 'vue/compiler-sfc';
import type { ParsedUrlQuery } from 'querystring';
import type { VueLoaderOptions } from 'src';
export declare function selectBlock(descriptor: SFCDescriptor, scopeId: string, options: VueLoaderOptions, loaderContext: LoaderContext<VueLoaderOptions>, query: ParsedUrlQuery, appendExtension: boolean): void;

41
app_vue/node_modules/vue-loader/dist/select.js generated vendored Normal file
View File

@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.selectBlock = void 0;
const resolveScript_1 = require("./resolveScript");
function selectBlock(descriptor, scopeId, options, loaderContext, query, appendExtension) {
// template
if (query.type === `template`) {
// if we are receiving a query with type it can only come from a *.vue file
// that contains that block, so the block is guaranteed to exist.
const template = descriptor.template;
if (appendExtension) {
loaderContext.resourcePath += '.' + (template.lang || 'html');
}
loaderContext.callback(null, template.content, template.map);
return;
}
// script
if (query.type === `script`) {
const script = (0, resolveScript_1.resolveScript)(descriptor, scopeId, options, loaderContext);
if (appendExtension) {
loaderContext.resourcePath += '.' + (script.lang || 'js');
}
loaderContext.callback(null, script.content, script.map);
return;
}
// styles
if (query.type === `style` && query.index != null) {
const style = descriptor.styles[Number(query.index)];
if (appendExtension) {
loaderContext.resourcePath += '.' + (style.lang || 'css');
}
loaderContext.callback(null, style.content, style.map);
return;
}
// custom
if (query.type === 'custom' && query.index != null) {
const block = descriptor.customBlocks[Number(query.index)];
loaderContext.callback(null, block.content, block.map);
}
}
exports.selectBlock = selectBlock;

View File

@ -0,0 +1,3 @@
import type { LoaderDefinitionFunction } from 'webpack';
declare const StyleInineLoader: LoaderDefinitionFunction;
export default StyleInineLoader;

View File

@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const StyleInineLoader = function (source) {
// TODO minify this?
return `export default ${JSON.stringify(source)}`;
};
exports.default = StyleInineLoader;

View File

@ -0,0 +1,3 @@
import type { LoaderDefinitionFunction } from 'webpack';
declare const StylePostLoader: LoaderDefinitionFunction;
export default StylePostLoader;

View File

@ -0,0 +1,51 @@
"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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const qs = __importStar(require("querystring"));
const compiler_1 = require("./compiler");
const { compileStyle } = compiler_1.compiler;
// This is a post loader that handles scoped CSS transforms.
// Injected right before css-loader by the global pitcher (../pitch.js)
// for any <style scoped> selection requests initiated from within vue files.
const StylePostLoader = function (source, inMap) {
const query = qs.parse(this.resourceQuery.slice(1));
// skip normal CSS files
if (!('vue' in query) || query.type !== 'style' || !query.id) {
this.callback(null, source, inMap);
return;
}
const { code, map, errors } = compileStyle({
source: source,
filename: this.resourcePath,
id: `data-v-${query.id}`,
map: inMap,
scoped: !!query.scoped,
trim: true,
isProd: this.mode === 'production' || process.env.NODE_ENV === 'production',
});
if (errors.length) {
this.callback(errors[0]);
}
else {
this.callback(null, code, map);
}
};
exports.default = StylePostLoader;

View File

@ -0,0 +1,3 @@
import type { LoaderDefinitionFunction } from 'webpack';
declare const TemplateLoader: LoaderDefinitionFunction;
export default TemplateLoader;

91
app_vue/node_modules/vue-loader/dist/templateLoader.js generated vendored Normal file
View File

@ -0,0 +1,91 @@
"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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const qs = __importStar(require("querystring"));
const formatError_1 = require("./formatError");
const descriptorCache_1 = require("./descriptorCache");
const resolveScript_1 = require("./resolveScript");
const util_1 = require("./util");
const compiler_1 = require("./compiler");
const { compileTemplate } = compiler_1.compiler;
// Loader that compiles raw template into JavaScript functions.
// This is injected by the global pitcher (../pitch) for template
// selection requests initiated from vue files.
const TemplateLoader = function (source, inMap) {
var _a;
source = String(source);
const loaderContext = this;
// although this is not the main vue-loader, we can get access to the same
// vue-loader options because we've set an ident in the plugin and used that
// ident to create the request for this loader in the pitcher.
const options = ((0, util_1.getOptions)(loaderContext) || {});
const isServer = (_a = options.isServerBuild) !== null && _a !== void 0 ? _a : loaderContext.target === 'node';
const isProd = loaderContext.mode === 'production' || process.env.NODE_ENV === 'production';
const query = qs.parse(loaderContext.resourceQuery.slice(1));
const scopeId = query.id;
const descriptor = (0, descriptorCache_1.getDescriptor)(loaderContext.resourcePath, options.compilerOptions);
const script = (0, resolveScript_1.resolveScript)(descriptor, query.id, options, loaderContext);
let templateCompiler;
if (typeof options.compiler === 'string') {
templateCompiler = require(options.compiler);
}
else {
templateCompiler = options.compiler;
}
const compiled = compileTemplate({
source,
ast: descriptor.template && !descriptor.template.lang
? descriptor.template.ast
: undefined,
filename: loaderContext.resourcePath,
inMap,
id: scopeId,
scoped: !!query.scoped,
slotted: descriptor.slotted,
isProd,
ssr: isServer,
ssrCssVars: descriptor.cssVars,
compiler: templateCompiler,
compilerOptions: Object.assign(Object.assign(Object.assign({}, options.compilerOptions), { scopeId: query.scoped ? `data-v-${scopeId}` : undefined, bindingMetadata: script ? script.bindings : undefined }), (0, util_1.resolveTemplateTSOptions)(descriptor, options)),
transformAssetUrls: options.transformAssetUrls || true,
});
// tips
if (compiled.tips.length) {
compiled.tips.forEach((tip) => {
loaderContext.emitWarning(new Error(tip));
});
}
// errors
if (compiled.errors && compiled.errors.length) {
compiled.errors.forEach((err) => {
if (typeof err === 'string') {
loaderContext.emitError(new Error(err));
}
else {
(0, formatError_1.formatError)(err, inMap ? inMap.sourcesContent[0] : source, loaderContext.resourcePath);
loaderContext.emitError(err);
}
});
}
const { code, map } = compiled;
loaderContext.callback(null, code, map);
};
exports.default = TemplateLoader;

9
app_vue/node_modules/vue-loader/dist/util.d.ts generated vendored Normal file
View File

@ -0,0 +1,9 @@
import type { Compiler, LoaderContext } from 'webpack';
import type { SFCDescriptor, CompilerOptions } from 'vue/compiler-sfc';
import type { VueLoaderOptions } from '.';
export declare function needHMR(vueLoaderOptions: VueLoaderOptions, compilerOptions: Compiler['options']): boolean;
export declare function resolveTemplateTSOptions(descriptor: SFCDescriptor, options: VueLoaderOptions): CompilerOptions | null;
export declare function getOptions(loaderContext: LoaderContext<VueLoaderOptions>): any;
export declare function stringifyRequest(loaderContext: LoaderContext<VueLoaderOptions>, request: string): string;
export declare function genMatchResource(context: LoaderContext<VueLoaderOptions>, resourcePath: string, resourceQuery?: string, lang?: string): string;
export declare const testWebpack5: (compiler?: Compiler | undefined) => boolean;

178
app_vue/node_modules/vue-loader/dist/util.js generated vendored Normal file
View File

@ -0,0 +1,178 @@
"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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.testWebpack5 = exports.genMatchResource = exports.stringifyRequest = exports.getOptions = exports.resolveTemplateTSOptions = exports.needHMR = void 0;
const querystring_1 = __importDefault(require("querystring"));
const path = __importStar(require("path"));
function needHMR(vueLoaderOptions, compilerOptions) {
var _a;
const isServer = (_a = vueLoaderOptions.isServerBuild) !== null && _a !== void 0 ? _a : compilerOptions.target === 'node';
const isProduction = compilerOptions.mode === 'production' ||
process.env.NODE_ENV === 'production';
return !isServer && !isProduction && vueLoaderOptions.hotReload !== false;
}
exports.needHMR = needHMR;
function resolveTemplateTSOptions(descriptor, options) {
var _a, _b, _c;
if (options.enableTsInTemplate === false)
return null;
const lang = ((_a = descriptor.script) === null || _a === void 0 ? void 0 : _a.lang) || ((_b = descriptor.scriptSetup) === null || _b === void 0 ? void 0 : _b.lang);
const isTS = !!(lang && /tsx?$/.test(lang));
let expressionPlugins = ((_c = options === null || options === void 0 ? void 0 : options.compilerOptions) === null || _c === void 0 ? void 0 : _c.expressionPlugins) || [];
if (isTS && !expressionPlugins.includes('typescript')) {
expressionPlugins = [...expressionPlugins, 'typescript'];
}
return {
isTS,
expressionPlugins,
};
}
exports.resolveTemplateTSOptions = resolveTemplateTSOptions;
// loader utils removed getOptions in 3.x, but it's not available on webpack 4
// loader context
function getOptions(loaderContext) {
const query = loaderContext.query;
if (typeof query === 'string' && query !== '') {
return parseQuery(query);
}
if (!query || typeof query !== 'object') {
// Not object-like queries are not supported.
return {};
}
return query;
}
exports.getOptions = getOptions;
const specialValues = {
null: null,
true: true,
false: false,
};
function parseQuery(query) {
if (query.substr(0, 1) !== '?') {
throw new Error("A valid query string passed to parseQuery should begin with '?'");
}
query = query.substr(1);
if (!query) {
return {};
}
if (query.substr(0, 1) === '{' && query.substr(-1) === '}') {
return JSON.parse(query);
}
const queryArgs = query.split(/[,&]/g);
const result = Object.create(null);
queryArgs.forEach((arg) => {
const idx = arg.indexOf('=');
if (idx >= 0) {
let name = arg.substr(0, idx);
let value = decodeURIComponent(arg.substr(idx + 1));
// eslint-disable-next-line no-prototype-builtins
if (specialValues.hasOwnProperty(value)) {
value = specialValues[value];
}
if (name.substr(-2) === '[]') {
name = decodeURIComponent(name.substr(0, name.length - 2));
if (!Array.isArray(result[name])) {
result[name] = [];
}
result[name].push(value);
}
else {
name = decodeURIComponent(name);
result[name] = value;
}
}
else {
if (arg.substr(0, 1) === '-') {
result[decodeURIComponent(arg.substr(1))] = false;
}
else if (arg.substr(0, 1) === '+') {
result[decodeURIComponent(arg.substr(1))] = true;
}
else {
result[decodeURIComponent(arg)] = true;
}
}
});
return result;
}
const matchRelativePath = /^\.\.?[/\\]/;
function isAbsolutePath(str) {
return path.posix.isAbsolute(str) || path.win32.isAbsolute(str);
}
function isRelativePath(str) {
return matchRelativePath.test(str);
}
function stringifyRequest(loaderContext, request) {
const splitted = request.split('!');
const context = loaderContext.context ||
// @ts-ignore
(loaderContext.options && loaderContext.options.context);
return JSON.stringify(splitted
.map((part) => {
// First, separate singlePath from query, because the query might contain paths again
const splittedPart = part.match(/^(.*?)(\?.*)/);
const query = splittedPart ? splittedPart[2] : '';
let singlePath = splittedPart ? splittedPart[1] : part;
if (isAbsolutePath(singlePath) && context) {
singlePath = path.relative(context, singlePath);
if (isAbsolutePath(singlePath)) {
// If singlePath still matches an absolute path, singlePath was on a different drive than context.
// In this case, we leave the path platform-specific without replacing any separators.
// @see https://github.com/webpack/loader-utils/pull/14
return singlePath + query;
}
if (isRelativePath(singlePath) === false) {
// Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
singlePath = './' + singlePath;
}
}
return singlePath.replace(/\\/g, '/') + query;
})
.join('!'));
}
exports.stringifyRequest = stringifyRequest;
function genMatchResource(context, resourcePath, resourceQuery, lang) {
resourceQuery = resourceQuery || '';
const loaders = [];
const parsedQuery = querystring_1.default.parse(resourceQuery.slice(1));
// process non-external resources
if ('vue' in parsedQuery && !('external' in parsedQuery)) {
const currentRequest = context.loaders
.slice(context.loaderIndex)
.map((obj) => obj.request);
loaders.push(...currentRequest);
}
const loaderString = loaders.join('!');
return `${resourcePath}${lang ? `.${lang}` : ''}${resourceQuery}!=!${loaderString ? `${loaderString}!` : ''}${resourcePath}${resourceQuery}`;
}
exports.genMatchResource = genMatchResource;
const testWebpack5 = (compiler) => {
var _a;
if (!compiler) {
return false;
}
const webpackVersion = (_a = compiler === null || compiler === void 0 ? void 0 : compiler.webpack) === null || _a === void 0 ? void 0 : _a.version;
return Boolean(webpackVersion && Number(webpackVersion.split('.')[0]) > 4);
};
exports.testWebpack5 = testWebpack5;