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/cli-plugin-babel/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.

41
node_modules/@vue/cli-plugin-babel/README.md generated vendored Normal file
View File

@ -0,0 +1,41 @@
# @vue/cli-plugin-babel
> babel plugin for vue-cli
## Configuration
Uses Babel 7 + `babel-loader` + [@vue/babel-preset-app](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app) by default, but can be configured via `babel.config.js` to use any other Babel presets or plugins.
By default, `babel-loader` excludes files inside `node_modules` dependencies. If you wish to explicitly transpile a dependency module, you will need to add it to the `transpileDependencies` option in `vue.config.js`:
``` js
module.exports = {
transpileDependencies: [
// can be string or regex
'my-dep',
/other-dep/
]
}
```
## Caching
[cache-loader](https://github.com/webpack-contrib/cache-loader) is enabled by default and cache is stored in `<projectRoot>/node_modules/.cache/babel-loader`.
## Parallelization
[thread-loader](https://github.com/webpack-contrib/thread-loader) is enabled by default when the machine has more than 1 CPU cores. This can be turned off by setting `parallel: false` in `vue.config.js`.
`parallel` should be set to `false` when using Babel in combination with non-serializable loader options, such as regexes, dates and functions. These options would not be passed correctly to `babel-loader` which may lead to unexpected errors.
## Installing in an Already Created Project
``` sh
vue add babel
```
## Injected webpack-chain Rules
- `config.rule('js')`
- `config.rule('js').use('babel-loader')`
- `config.rule('js').use('cache-loader')`

View File

@ -0,0 +1,41 @@
module.exports = function (fileInfo, api) {
const j = api.jscodeshift
const root = j(fileInfo.source)
const useDoubleQuote = root.find(j.Literal).some(({ node }) => node.raw.startsWith('"'))
root
.find(j.Literal, { value: '@vue/app' })
.replaceWith(j.stringLiteral('@vue/cli-plugin-babel/preset'))
root
.find(j.Literal, { value: '@vue/babel-preset-app' })
.replaceWith(j.stringLiteral('@vue/cli-plugin-babel/preset'))
const templateLiterals = root
.find(j.TemplateLiteral, {
expressions: { length: 0 }
})
templateLiterals
.find(j.TemplateElement, {
value: {
cooked: '@vue/app'
}
})
.closest(j.TemplateLiteral)
.replaceWith(j.stringLiteral('@vue/cli-plugin-babel/preset'))
templateLiterals
.find(j.TemplateElement, {
value: {
cooked: '@vue/babel-preset-app'
}
})
.closest(j.TemplateLiteral)
.replaceWith(j.stringLiteral('@vue/cli-plugin-babel/preset'))
return root.toSource({
lineTerminator: '\n',
quote: useDoubleQuote ? 'double' : 'single'
})
}

16
node_modules/@vue/cli-plugin-babel/generator.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
module.exports = api => {
// Most likely you want to overwrite the whole config to ensure it's working
// without conflicts, e.g. for a project that used Jest without Babel.
// It should be rare for the user to have their own special babel config
// without using the Babel plugin already.
delete api.generator.files['babel.config.js']
api.extendPackage({
babel: {
presets: ['@vue/cli-plugin-babel/preset']
},
dependencies: {
'core-js': '^3.6.5'
}
})
}

92
node_modules/@vue/cli-plugin-babel/index.js generated vendored Normal file
View File

@ -0,0 +1,92 @@
const path = require('path')
const babel = require('@babel/core')
const { isWindows } = require('@vue/cli-shared-utils')
function genTranspileDepRegex (transpileDependencies) {
const deps = transpileDependencies.map(dep => {
if (typeof dep === 'string') {
const depPath = path.join('node_modules', dep, '/')
return isWindows
? depPath.replace(/\\/g, '\\\\') // double escape for windows style path
: depPath
} else if (dep instanceof RegExp) {
return dep.source
}
})
return deps.length ? new RegExp(deps.join('|')) : null
}
module.exports = (api, options) => {
const useThreads = process.env.NODE_ENV === 'production' && !!options.parallel
const cliServicePath = path.dirname(require.resolve('@vue/cli-service'))
const transpileDepRegex = genTranspileDepRegex(options.transpileDependencies)
// try to load the project babel config;
// if the default preset is used,
// there will be a VUE_CLI_TRANSPILE_BABEL_RUNTIME env var set.
// the `filename` field is required
// in case there're filename-related options like `ignore` in the user config
babel.loadPartialConfigSync({ filename: api.resolve('src/main.js') })
api.chainWebpack(webpackConfig => {
webpackConfig.resolveLoader.modules.prepend(path.join(__dirname, 'node_modules'))
const jsRule = webpackConfig.module
.rule('js')
.test(/\.m?jsx?$/)
.exclude
.add(filepath => {
// always transpile js in vue files
if (/\.vue\.jsx?$/.test(filepath)) {
return false
}
// exclude dynamic entries from cli-service
if (filepath.startsWith(cliServicePath)) {
return true
}
// only include @babel/runtime when the @vue/babel-preset-app preset is used
if (
process.env.VUE_CLI_TRANSPILE_BABEL_RUNTIME &&
filepath.includes(path.join('@babel', 'runtime'))
) {
return false
}
// check if this is something the user explicitly wants to transpile
if (transpileDepRegex && transpileDepRegex.test(filepath)) {
return false
}
// Don't transpile node_modules
return /node_modules/.test(filepath)
})
.end()
.use('cache-loader')
.loader(require.resolve('cache-loader'))
.options(api.genCacheConfig('babel-loader', {
'@babel/core': require('@babel/core/package.json').version,
'@vue/babel-preset-app': require('@vue/babel-preset-app/package.json').version,
'babel-loader': require('babel-loader/package.json').version,
modern: !!process.env.VUE_CLI_MODERN_BUILD,
browserslist: api.service.pkg.browserslist
}, [
'babel.config.js',
'.browserslistrc'
]))
.end()
if (useThreads) {
const threadLoaderConfig = jsRule
.use('thread-loader')
.loader(require.resolve('thread-loader'))
if (typeof options.parallel === 'number') {
threadLoaderConfig.options({ workers: options.parallel })
}
}
jsRule
.use('babel-loader')
.loader(require.resolve('babel-loader'))
})
}

BIN
node_modules/@vue/cli-plugin-babel/logo.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

24
node_modules/@vue/cli-plugin-babel/migrator/index.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
const { chalk } = require('@vue/cli-shared-utils')
module.exports = api => {
api.transformScript(
'babel.config.js',
require('../codemods/usePluginPreset')
)
if (api.fromVersion('^3')) {
api.extendPackage(
{
dependencies: {
'core-js': '^3.6.5'
}
},
{ warnIncompatibleVersions: false }
)
// TODO: implement a codemod to migrate polyfills
api.exitLog(`core-js has been upgraded from v2 to v3.
If you have any custom polyfills defined in ${chalk.yellow('babel.config.js')}, please be aware their names may have been changed.
For more complete changelog, see https://github.com/zloirock/core-js/blob/master/CHANGELOG.md#300---20190319`)
}
}

41
node_modules/@vue/cli-plugin-babel/package.json generated vendored Normal file
View File

@ -0,0 +1,41 @@
{
"name": "@vue/cli-plugin-babel",
"version": "4.5.19",
"description": "babel plugin for vue-cli",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-plugin-babel"
},
"keywords": [
"vue",
"cli",
"babel"
],
"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/cli-plugin-babel#readme",
"dependencies": {
"@babel/core": "^7.11.0",
"@vue/babel-preset-app": "^4.5.19",
"@vue/cli-shared-utils": "^4.5.19",
"babel-loader": "^8.1.0",
"cache-loader": "^4.1.0",
"thread-loader": "^2.1.3",
"webpack": "^4.0.0"
},
"peerDependencies": {
"@vue/cli-service": "^3.0.0 || ^4.0.0-0"
},
"devDependencies": {
"jscodeshift": "^0.10.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "bef7a67566585876d56fa0e41b364675467bba8f"
}

1
node_modules/@vue/cli-plugin-babel/preset.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require('@vue/babel-preset-app')