first commit

This commit is contained in:
jefferyzhao
2025-07-31 17:44:12 +08:00
commit b9bdc8598b
42390 changed files with 4467935 additions and 0 deletions

21
node_modules/@vue/babel-preset-app/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017-present, Yuxi (Evan) You
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

103
node_modules/@vue/babel-preset-app/README.md generated vendored Normal file
View File

@ -0,0 +1,103 @@
# @vue/babel-preset-app
This is the default Babel preset used in all Vue CLI projects. **Note: this preset is meant to be used exclusively in projects created via Vue CLI and does not consider external use cases.**
## Included Features
### [@babel/preset-env](https://new.babeljs.io/docs/en/next/babel-preset-env.html)
`preset-env` automatically determines the transforms and polyfills to apply based on your browser target. See [Browser Compatibility](https://cli.vuejs.org/guide/browser-compatibility.html) section in docs for more details.
- `modules: false`
- auto set to `'commonjs'` in Jest tests
- [`useBuiltIns: 'usage'`](#usebuiltins)
- `targets`:
- by default `@babel/preset-env` will use [`browserslist config sources`](https://github.com/browserslist/browserslist#queries) (browserslist key in package.json file is recommend) unless either the [`targets`](https://babeljs.io/docs/en/babel-preset-env#targets) or [`ignoreBrowserslistConfig`](https://babeljs.io/docs/en/babel-preset-env#ignorebrowserslistconfig) options are set.
- set to `{ node: 'current' }` when running unit tests in Node.js
- Includes `Promise` polyfill by default so that they are usable even in non-transpiled dependencies (only for environments that need it)
### Stage 3 or Below
Only the following stage 3 or below features are supported (object rest spread is supported as part of `preset-env`):
- [Dynamic Import Syntax](https://github.com/tc39/proposal-dynamic-import)
- [Proposal Class Properties](https://babeljs.io/docs/en/next/babel-plugin-proposal-class-properties.html)
- [Proposal Decorators (legacy)](https://babeljs.io/docs/en/next/babel-plugin-proposal-decorators.html)
If you need additional stage 3 or below features, you need to install and configure it yourself.
### Vue JSX support
- [@babel/plugin-syntax-jsx](https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-jsx)
- [@vue/babel-preset-jsx](https://github.com/vuejs/jsx)
### [@babel/plugin-transform-runtime](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime)
`transform-runtime` avoids inlining helpers in every file. This is enabled for helpers only, since polyfills are handled by `babel-preset-env`.
## Options
- All options from [@babel/preset-env](https://babeljs.io/docs/en/next/babel-preset-env.html) are supported, with some of them having smarter defaults.
### modules
- Default:
- `false` when building with webpack
- `'commonjs'` when running tests in Jest.
Explicitly set `modules` option for `babel-preset-env`. See [babel-preset-env docs](https://github.com/babel/babel/tree/master/packages/babel-preset-env#modules) for more details.
### targets
- Default:
- `@vue/babel-preset-app` will use [`browserslist config sources`](https://github.com/browserslist/browserslist#queries) (browserslist key in package.json file is recommend) unless either the [`targets`](https://babeljs.io/docs/en/babel-preset-env#targets) or [`ignoreBrowserslistConfig`](https://babeljs.io/docs/en/babel-preset-env#ignorebrowserslistconfig) options are set.
- set to `{ node: 'current' }` when running unit tests in Node.js
Explicitly set `targets` option for `babel-preset-env`. See [babel-preset-env docs](https://github.com/babel/babel/tree/master/packages/babel-preset-env#targets) for more details.
### useBuiltIns
- Default: `'usage'`
- Allowed values: `'usage' | 'entry' | false`
Explicitly set `useBuiltIns` option for `babel-preset-env`.
The default value is `'usage'`, which adds imports to polyfills based on the usage in transpiled code. For example, if you use `Object.assign` in your code, the corresponding polyfill will be auto-imported if your target environment does not supports it.
If you are building a library or web component instead of an app, you probably want to set this to `false` and let the consuming app be responsible for the polyfills.
Note that the usage detection does not apply to your dependencies (which are excluded by `cli-plugin-babel` by default). If one of your dependencies need polyfills, you have a few options:
1. **If the dependency is written in an ES version that your target environments do not support:** Add that dependency to the `transpileDependencies` option in `vue.config.js`. This would enable both syntax transforms and usage-based polyfill detection for that dependency.
2. **If the dependency ships ES5 code and explicitly lists the polyfills needed:** you can pre-include the needed polyfills using the [polyfills](#polyfills) option for this preset.
3. **If the dependency ships ES5 code, but uses ES6+ features without explicitly listing polyfill requirements (e.g. Vuetify):** Use `useBuiltIns: 'entry'` and then add `import '@babel/polyfill'` to your entry file. This will import **ALL** polyfills based on your `browserslist` targets so that you don't need to worry about dependency polyfills anymore, but will likely increase your final bundle size with some unused polyfills.
See [@babel/preset-env docs](https://new.babeljs.io/docs/en/next/babel-preset-env.html#usebuiltins-usage) for more details.
### polyfills
- Default: `['es.array.iterator', 'es.promise', 'es.object.assign', 'es.promise.finally']`
A list of [core-js](https://github.com/zloirock/core-js) polyfills to pre-include when using `useBuiltIns: 'usage'`. **These polyfills are automatically excluded if they are not needed for your target environments**.
Use this option when you have 3rd party dependencies that are not processed by Babel but have specific polyfill requirements (e.g. Axios and Vuex require Promise support).
### jsx
- Default: `true`.
Set to `false` to disable JSX support. Or you can toggle [@vue/babel-preset-jsx](https://github.com/vuejs/jsx/tree/dev/packages/babel-preset-jsx) (or [@vue/babel-plugin-jsx](https://github.com/vuejs/jsx-next) for Vue 3 projects) features here.
### loose
- Default: `false`.
Setting this to `true` will generate code that is more performant but less spec-compliant.
### entryFiles
- Default: `[]`
Multi page repo use `entryFiles` to ensure inject polyfills to all entry file.

297
node_modules/@vue/babel-preset-app/index.js generated vendored Normal file
View File

@ -0,0 +1,297 @@
const path = require('path')
const semver = require('semver')
const defaultPolyfills = [
// promise polyfill alone doesn't work in IE,
// needs this as well. see: #1642
'es.array.iterator',
// this is required for webpack code splitting, vuex etc.
'es.promise',
// this is needed for object rest spread support in templates
// as vue-template-es2015-compiler 1.8+ compiles it to Object.assign() calls.
'es.object.assign',
// #2012 es.promise replaces native Promise in FF and causes missing finally
'es.promise.finally'
]
const {
default: getTargets,
isRequired
} = require('@babel/helper-compilation-targets')
function getIntersectionTargets (targets, constraintTargets) {
const intersection = Object.keys(constraintTargets).reduce(
(results, browser) => {
// exclude the browsers that the user does not need
if (!targets[browser]) {
return results
}
// if the user-specified version is higher the minimum version that supports esmodule, than use it
results[browser] = semver.gt(
semver.coerce(constraintTargets[browser]),
semver.coerce(targets[browser])
)
? constraintTargets[browser]
: targets[browser]
return results
},
{}
)
return intersection
}
function getModernTargets (targets) {
const allModernTargets = getTargets(
{ esmodules: true },
{ ignoreBrowserslistConfig: true }
)
// use the intersection of modern mode browsers and user defined targets config
const result = getIntersectionTargets(targets, allModernTargets)
// webpack 4 uses acorn 6, which does not support newer syntaxes such as optional chaining
// so we have to add samsung 12 as a target to force transpiling these syntaxes
// https://github.com/vuejs/vue-cli/issues/6449#issuecomment-828559068
result.samsung = '12.0.0'
return result
}
function getWCTargets (targets) {
// targeting browsers that at least support ES2015 classes
// https://github.com/babel/babel/blob/v7.9.6/packages/babel-compat-data/data/plugins.json#L194-L204
const allWCTargets = getTargets(
{
browsers: [
'Chrome >= 46',
'Firefox >= 45',
'Safari >= 10',
'Edge >= 13',
'iOS >= 10',
'Electron >= 0.36'
]
},
{ ignoreBrowserslistConfig: true }
)
// use the intersection of browsers supporting Web Components and user defined targets config
return getIntersectionTargets(targets, allWCTargets)
}
function getPolyfills (targets, includes) {
// if no targets specified, include all default polyfills
if (!targets || !Object.keys(targets).length) {
return includes
}
const compatData = require('core-js-compat').data
return includes.filter(item => {
if (!compatData[item]) {
throw new Error(`Cannot find polyfill ${item}, please refer to 'core-js-compat' for a complete list of available modules`)
}
return isRequired(item, targets, { compatData })
})
}
module.exports = (context, options = {}) => {
const presets = []
const plugins = []
const defaultEntryFiles = JSON.parse(process.env.VUE_CLI_ENTRY_FILES || '[]')
// Though in the vue-cli repo, we only use the two environment variables
// for tests, users may have relied on them for some features,
// dropping them may break some projects.
// So in the following blocks we don't directly test the `NODE_ENV`.
// Rather, we turn it into the two commonly used feature flags.
if (!process.env.VUE_CLI_TEST && process.env.NODE_ENV === 'test') {
// Both Jest & Mocha set NODE_ENV to 'test'.
// And both requires the `node` target.
process.env.VUE_CLI_BABEL_TARGET_NODE = 'true'
// Jest runs without bundling so it needs this.
// With the node target, tree shaking is not a necessity,
// so we set it for maximum compatibility.
process.env.VUE_CLI_BABEL_TRANSPILE_MODULES = 'true'
}
// JSX
if (options.jsx !== false) {
let jsxOptions = {}
if (typeof options.jsx === 'object') {
jsxOptions = options.jsx
}
let vueVersion = 2
try {
const Vue = require('vue')
vueVersion = semver.major(Vue.version)
} catch (e) {}
if (vueVersion === 2) {
presets.push([require('@vue/babel-preset-jsx'), jsxOptions])
} else if (vueVersion === 3) {
plugins.push([require('@vue/babel-plugin-jsx'), jsxOptions])
}
}
const runtimePath = path.dirname(require.resolve('@babel/runtime/package.json'))
const runtimeVersion = require('@babel/runtime/package.json').version
const {
polyfills: userPolyfills,
loose = false,
debug = false,
useBuiltIns = 'usage',
modules = false,
bugfixes = true,
targets: rawTargets,
spec,
ignoreBrowserslistConfig,
configPath,
include,
exclude,
shippedProposals,
forceAllTransforms,
decoratorsBeforeExport,
decoratorsLegacy,
// entry file list
entryFiles = defaultEntryFiles,
// Undocumented option of @babel/plugin-transform-runtime.
// When enabled, an absolute path is used when importing a runtime helper after transforming.
// This ensures the transpiled file always use the runtime version required in this package.
// However, this may cause hash inconsistency if the project is moved to another directory.
// So here we allow user to explicit disable this option if hash consistency is a requirement
// and the runtime version is sure to be correct.
absoluteRuntime = runtimePath,
// https://babeljs.io/docs/en/babel-plugin-transform-runtime#version
// By default transform-runtime assumes that @babel/runtime@7.0.0-beta.0 is installed, which means helpers introduced later than 7.0.0-beta.0 will be inlined instead of imported.
// See https://github.com/babel/babel/issues/10261
// And https://github.com/facebook/docusaurus/pull/2111
version = runtimeVersion
} = options
// resolve targets for preset-env
let targets = getTargets(rawTargets, { ignoreBrowserslistConfig, configPath })
// Webpack 4 uses acorn 6 underlyingly;
// The highest ESLint version that Vue CLI v4 supports is 6.x;
// Both can only parse ES2019 syntax + BigInt at most.
// Thus, newer syntaxes such as optional chaining and nullish coalescing won't
// be accept by webpack / ESLint, and must be processed by Babel first.
// Chrome 79 is the last Chrome version that doesn't support these syntaxes.
// So the targets set by the user cannot be higher than Chrome 79.
if (!targets.chrome || semver.gt(targets.chrome, '79.0.0')) {
targets.chrome = '79.0.0'
}
if (process.env.VUE_CLI_BABEL_TARGET_NODE) {
// running tests in Node.js
targets = { node: '12' }
} else if (process.env.VUE_CLI_BUILD_TARGET === 'wc' || process.env.VUE_CLI_BUILD_TARGET === 'wc-async') {
// targeting browsers that at least support ES2015 classes
targets = getWCTargets(targets)
} else if (process.env.VUE_CLI_MODERN_BUILD) {
// targeting browsers that at least support <script type="module">
targets = getModernTargets(targets)
}
// included-by-default polyfills. These are common polyfills that 3rd party
// dependencies may rely on (e.g. Vuex relies on Promise), but since with
// useBuiltIns: 'usage' we won't be running Babel on these deps, they need to
// be force-included.
let polyfills
const buildTarget = process.env.VUE_CLI_BUILD_TARGET || 'app'
if (
buildTarget === 'app' &&
useBuiltIns === 'usage' &&
!process.env.VUE_CLI_BABEL_TARGET_NODE
) {
polyfills = getPolyfills(targets, userPolyfills || defaultPolyfills)
plugins.push([
require('./polyfillsPlugin'),
{ polyfills, entryFiles, useAbsolutePath: !!absoluteRuntime }
])
} else {
polyfills = []
}
const envOptions = {
bugfixes,
corejs: useBuiltIns ? require('core-js/package.json').version : false,
spec,
loose,
debug,
modules,
targets,
useBuiltIns,
ignoreBrowserslistConfig,
configPath,
include,
exclude: polyfills.concat(exclude || []),
shippedProposals,
forceAllTransforms
}
// cli-plugin-jest sets this to true because Jest runs without bundling
if (process.env.VUE_CLI_BABEL_TRANSPILE_MODULES) {
envOptions.modules = 'commonjs'
if (process.env.VUE_CLI_BABEL_TARGET_NODE) {
// necessary for dynamic import to work in tests
plugins.push(require('babel-plugin-dynamic-import-node'))
}
}
// pass options along to babel-preset-env
presets.unshift([require('@babel/preset-env'), envOptions])
// additional <= stage-3 plugins
// Babel 7 is removing stage presets altogether because people are using
// too many unstable proposals. Let's be conservative in the defaults here.
plugins.push(
require('@babel/plugin-syntax-dynamic-import'),
[require('@babel/plugin-proposal-decorators'), {
decoratorsBeforeExport,
legacy: decoratorsLegacy !== false
}],
[require('@babel/plugin-proposal-class-properties'), { loose }]
)
// transform runtime, but only for helpers
plugins.push([require('@babel/plugin-transform-runtime'), {
regenerator: useBuiltIns !== 'usage',
// polyfills are injected by preset-env & polyfillsPlugin, so no need to add them again
corejs: false,
helpers: useBuiltIns === 'usage',
useESModules: !process.env.VUE_CLI_BABEL_TRANSPILE_MODULES,
absoluteRuntime,
version
}])
return {
sourceType: 'unambiguous',
overrides: [{
exclude: [/@babel[\/|\\\\]runtime/, /core-js/],
presets,
plugins
}, {
// there are some untranspiled code in @babel/runtime
// https://github.com/babel/babel/issues/9903
include: [/@babel[\/|\\\\]runtime/],
presets: [
[require('@babel/preset-env'), envOptions]
]
}]
}
}
// a special flag to tell @vue/cli-plugin-babel to include @babel/runtime for transpilation
// otherwise the above `include` option won't take effect
process.env.VUE_CLI_TRANSPILE_BABEL_RUNTIME = true

56
node_modules/@vue/babel-preset-app/package.json generated vendored Normal file
View File

@ -0,0 +1,56 @@
{
"name": "@vue/babel-preset-app",
"version": "4.5.19",
"description": "babel-preset-app for vue-cli",
"main": "index.js",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/babel-preset-app"
},
"keywords": [
"vue",
"cli"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/vue-cli/issues"
},
"homepage": "https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/babel-preset-app#readme",
"dependencies": {
"@babel/core": "^7.11.0",
"@babel/helper-compilation-targets": "^7.9.6",
"@babel/helper-module-imports": "^7.8.3",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-jsx": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.11.0",
"@babel/preset-env": "^7.11.0",
"@babel/runtime": "^7.11.0",
"@vue/babel-plugin-jsx": "^1.0.3",
"@vue/babel-preset-jsx": "^1.2.4",
"babel-plugin-dynamic-import-node": "^2.3.3",
"core-js": "^3.6.5",
"core-js-compat": "^3.6.5",
"semver": "^6.1.0"
},
"peerDependencies": {
"@babel/core": "*",
"core-js": "^3",
"vue": "^2 || ^3.0.0-0"
},
"peerDependenciesMeta": {
"core-js": {
"optional": true
},
"vue": {
"optional": true
}
},
"gitHead": "bef7a67566585876d56fa0e41b364675467bba8f"
}

43
node_modules/@vue/babel-preset-app/polyfillsPlugin.js generated vendored Normal file
View File

@ -0,0 +1,43 @@
const { addSideEffect } = require('@babel/helper-module-imports')
// slightly modifiled from @babel/preset-env/src/utils
// use an absolute path for core-js modules, to fix conflicts of different core-js versions
// TODO: remove the `useAbsolutePath` option in v5,
// because `core-js` is sure to be present in newer projects;
// we only need absolute path for babel runtime helpers, not for polyfills
function getModulePath (mod, useAbsolutePath) {
const modPath =
mod === 'regenerator-runtime'
? 'regenerator-runtime/runtime'
: `core-js/modules/${mod}`
return useAbsolutePath ? require.resolve(modPath) : modPath
}
function createImport (path, mod, useAbsolutePath) {
return addSideEffect(path, getModulePath(mod, useAbsolutePath))
}
// add polyfill imports to the first file encountered.
module.exports = (
{ types },
{ polyfills, entryFiles = [], useAbsolutePath }
) => {
return {
name: 'vue-cli-inject-polyfills',
visitor: {
Program (path, state) {
if (!entryFiles.includes(state.filename)) {
return
}
// imports are injected in reverse order
polyfills
.slice()
.reverse()
.forEach(p => {
createImport(path, p, useAbsolutePath)
})
}
}
}
}