docs:更新文档

This commit is contained in:
张益铭
2021-03-01 15:06:11 +08:00
parent 1542135ab0
commit 9064b372e8
5835 changed files with 904126 additions and 161722 deletions

54
node_modules/vue/README.md generated vendored Normal file
View File

@@ -0,0 +1,54 @@
# vue
## Which dist file to use?
### From CDN or without a Bundler
- **`vue(.runtime).global(.prod).js`**:
- For direct use via `<script src="...">` in the browser. Exposes the `Vue` global.
- Note that global builds are not [UMD](https://github.com/umdjs/umd) builds. They are built as [IIFEs](https://developer.mozilla.org/en-US/docs/Glossary/IIFE) and is only meant for direct use via `<script src="...">`.
- In-browser template compilation:
- **`vue.global.js`** is the "full" build that includes both the compiler and the runtime so it supports compiling templates on the fly.
- **`vue.runtime.global.js`** contains only the runtime and requires templates to be pre-compiled during a build step.
- Inlines all Vue core internal packages - i.e. it's a single file with no dependencies on other files. This means you **must** import everything from this file and this file only to ensure you are getting the same instance of code.
- Contains hard-coded prod/dev branches, and the prod build is pre-minified. Use the `*.prod.js` files for production.
- **`vue(.runtime).esm-browser(.prod).js`**:
- For usage via native ES modules imports (in browser via `<script type="module">`.
- Shares the same runtime compilation, dependency inlining and hard-coded prod/dev behavior with the global build.
### With a Bundler
- **`vue(.runtime).esm-bundler.js`**:
- For use with bundlers like `webpack`, `rollup` and `parcel`.
- Leaves prod/dev branches with `process.env.NODE_ENV` guards (must be replaced by bundler)
- Does not ship minified builds (to be done together with the rest of the code after bundling)
- Imports dependencies (e.g. `@vue/runtime-core`, `@vue/runtime-compiler`)
- Imported dependencies are also `esm-bundler` builds and will in turn import their dependencies (e.g. `@vue/runtime-core` imports `@vue/reactivity`)
- This means you **can** install/import these deps individually without ending up with different instances of these dependencies, but you must make sure they all resolve to the same version.
- In-browser template compilation:
- **`vue.runtime.esm-bundler.js` (default)** is runtime only, and requires all templates to be pre-compiled. This is the default entry for bundlers (via `module` field in `package.json`) because when using a bundler templates are typically pre-compiled (e.g. in `*.vue` files).
- **`vue.esm-bundler.js`**: includes the runtime compiler. Use this if you are using a bundler but still want runtime template compilation (e.g. in-DOM templates or templates via inline JavaScript strings). You will need to configure your bundler to alias `vue` to this file.
#### Bundler Build Feature Flags
Starting with 3.0.0-rc.3, `esm-bundler` builds now exposes global feature flags that can be overwritten at compile time:
- `__VUE_OPTIONS_API__` (enable/disable Options API support, default: `true`)
- `__VUE_PROD_DEVTOOLS__` (enable/disable devtools support in production, default: `false`)
The build will work without configuring these flags, however it is **strongly recommended** to properly configure them in order to get proper tree-shaking in the final bundle. To configure these flags:
- webpack: use [DefinePlugin](https://webpack.js.org/plugins/define-plugin/)
- Rollup: use [@rollup/plugin-replace](https://github.com/rollup/plugins/tree/master/packages/replace)
- Vite: configured by default, but can be overwritten using the [`define` option](https://github.com/vitejs/vite/blob/a4133c073e640b17276b2de6e91a6857bdf382e1/src/node/config.ts#L72-L76)
Note: the replacement value **must be boolean literals** and cannot be strings, otherwise the bundler/minifier will not be able to properly evaluate the conditions.
### For Server-Side Rendering
- **`vue.cjs(.prod).js`**:
- For use in Node.js server-side rendering via `require()`.
- If you bundle your app with webpack with `target: 'node'` and properly externalize `vue`, this is the build that will be loaded.
- The dev/prod files are pre-built, but the appropriate file is automatically required based on `process.env.NODE_ENV`.

82
node_modules/vue/dist/vue.cjs.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var runtimeDom = require('@vue/runtime-dom');
var shared = require('@vue/shared');
var compilerDom = require('@vue/compiler-dom');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
n[k] = e[k];
});
}
n['default'] = e;
return Object.freeze(n);
}
var runtimeDom__namespace = /*#__PURE__*/_interopNamespace(runtimeDom);
function initDev() {
const target = shared.getGlobalThis();
target.__VUE__ = true;
runtimeDom.setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);
}
// This entry is the "full-build" that includes both the runtime
initDev();
const compileCache = Object.create(null);
function compileToFunction(template, options) {
if (!shared.isString(template)) {
if (template.nodeType) {
template = template.innerHTML;
}
else {
runtimeDom.warn(`invalid template option: `, template);
return shared.NOOP;
}
}
const key = template;
const cached = compileCache[key];
if (cached) {
return cached;
}
if (template[0] === '#') {
const el = document.querySelector(template);
if ( !el) {
runtimeDom.warn(`Template element not found or is empty: ${template}`);
}
// __UNSAFE__
// Reason: potential execution of JS expressions in in-DOM template.
// The user must make sure the in-DOM template is trusted. If it's rendered
// by the server, the template should not contain any user data.
template = el ? el.innerHTML : ``;
}
const { code } = compilerDom.compile(template, shared.extend({
hoistStatic: true,
onError(err) {
{
const message = `Template compilation error: ${err.message}`;
const codeFrame = err.loc &&
shared.generateCodeFrame(template, err.loc.start.offset, err.loc.end.offset);
runtimeDom.warn(codeFrame ? `${message}\n${codeFrame}` : message);
}
}
}, options));
// The wildcard import results in a huge object with every export
// with keys that cannot be mangled, and can be quite heavy size-wise.
// In the global build we know `Vue` is available globally so we can avoid
// the wildcard object.
const render = ( new Function('Vue', code)(runtimeDom__namespace));
render._rc = true;
return (compileCache[key] = render);
}
runtimeDom.registerRuntimeCompiler(compileToFunction);
Object.keys(runtimeDom).forEach(function (k) {
if (k !== 'default') exports[k] = runtimeDom[k];
});
exports.compile = compileToFunction;

69
node_modules/vue/dist/vue.cjs.prod.js generated vendored Normal file
View File

@@ -0,0 +1,69 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var runtimeDom = require('@vue/runtime-dom');
var shared = require('@vue/shared');
var compilerDom = require('@vue/compiler-dom');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
n[k] = e[k];
});
}
n['default'] = e;
return Object.freeze(n);
}
var runtimeDom__namespace = /*#__PURE__*/_interopNamespace(runtimeDom);
// This entry is the "full-build" that includes both the runtime
const compileCache = Object.create(null);
function compileToFunction(template, options) {
if (!shared.isString(template)) {
if (template.nodeType) {
template = template.innerHTML;
}
else {
return shared.NOOP;
}
}
const key = template;
const cached = compileCache[key];
if (cached) {
return cached;
}
if (template[0] === '#') {
const el = document.querySelector(template);
// __UNSAFE__
// Reason: potential execution of JS expressions in in-DOM template.
// The user must make sure the in-DOM template is trusted. If it's rendered
// by the server, the template should not contain any user data.
template = el ? el.innerHTML : ``;
}
const { code } = compilerDom.compile(template, shared.extend({
hoistStatic: true,
onError(err) {
{
/* istanbul ignore next */
throw err;
}
}
}, options));
// The wildcard import results in a huge object with every export
// with keys that cannot be mangled, and can be quite heavy size-wise.
// In the global build we know `Vue` is available globally so we can avoid
// the wildcard object.
const render = ( new Function('Vue', code)(runtimeDom__namespace));
render._rc = true;
return (compileCache[key] = render);
}
runtimeDom.registerRuntimeCompiler(compileToFunction);
Object.keys(runtimeDom).forEach(function (k) {
if (k !== 'default') exports[k] = runtimeDom[k];
});
exports.compile = compileToFunction;

8
node_modules/vue/dist/vue.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import { CompilerOptions } from '@vue/compiler-dom';
import { RenderFunction } from '@vue/runtime-dom';
export declare function compile(template: string | HTMLElement, options?: CompilerOptions): RenderFunction;
export * from "@vue/runtime-dom";
export { }

13424
node_modules/vue/dist/vue.esm-browser.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/vue/dist/vue.esm-browser.prod.js generated vendored Normal file

File diff suppressed because one or more lines are too long

72
node_modules/vue/dist/vue.esm-bundler.js generated vendored Normal file
View File

@@ -0,0 +1,72 @@
import * as runtimeDom from '@vue/runtime-dom';
import { setDevtoolsHook, initCustomFormatter, warn, registerRuntimeCompiler } from '@vue/runtime-dom';
export * from '@vue/runtime-dom';
import { getGlobalThis, isString, NOOP, extend, generateCodeFrame } from '@vue/shared';
import { compile } from '@vue/compiler-dom';
function initDev() {
const target = getGlobalThis();
target.__VUE__ = true;
setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);
{
console.info(`You are running a development build of Vue.\n` +
`Make sure to use the production build (*.prod.js) when deploying for production.`);
initCustomFormatter();
}
}
// This entry is the "full-build" that includes both the runtime
(process.env.NODE_ENV !== 'production') && initDev();
const compileCache = Object.create(null);
function compileToFunction(template, options) {
if (!isString(template)) {
if (template.nodeType) {
template = template.innerHTML;
}
else {
(process.env.NODE_ENV !== 'production') && warn(`invalid template option: `, template);
return NOOP;
}
}
const key = template;
const cached = compileCache[key];
if (cached) {
return cached;
}
if (template[0] === '#') {
const el = document.querySelector(template);
if ((process.env.NODE_ENV !== 'production') && !el) {
warn(`Template element not found or is empty: ${template}`);
}
// __UNSAFE__
// Reason: potential execution of JS expressions in in-DOM template.
// The user must make sure the in-DOM template is trusted. If it's rendered
// by the server, the template should not contain any user data.
template = el ? el.innerHTML : ``;
}
const { code } = compile(template, extend({
hoistStatic: true,
onError(err) {
if ((process.env.NODE_ENV !== 'production')) {
const message = `Template compilation error: ${err.message}`;
const codeFrame = err.loc &&
generateCodeFrame(template, err.loc.start.offset, err.loc.end.offset);
warn(codeFrame ? `${message}\n${codeFrame}` : message);
}
else {
/* istanbul ignore next */
throw err;
}
}
}, options));
// The wildcard import results in a huge object with every export
// with keys that cannot be mangled, and can be quite heavy size-wise.
// In the global build we know `Vue` is available globally so we can avoid
// the wildcard object.
const render = ( new Function('Vue', code)(runtimeDom));
render._rc = true;
return (compileCache[key] = render);
}
registerRuntimeCompiler(compileToFunction);
export { compileToFunction as compile };

13408
node_modules/vue/dist/vue.global.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/vue/dist/vue.global.prod.js generated vendored Normal file

File diff suppressed because one or more lines are too long

9181
node_modules/vue/dist/vue.runtime.esm-browser.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

26
node_modules/vue/dist/vue.runtime.esm-bundler.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import { setDevtoolsHook, initCustomFormatter, warn } from '@vue/runtime-dom';
export * from '@vue/runtime-dom';
import { getGlobalThis } from '@vue/shared';
function initDev() {
const target = getGlobalThis();
target.__VUE__ = true;
setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);
{
console.info(`You are running a development build of Vue.\n` +
`Make sure to use the production build (*.prod.js) when deploying for production.`);
initCustomFormatter();
}
}
// This entry exports the runtime only, and is built as
(process.env.NODE_ENV !== 'production') && initDev();
const compile = () => {
if ((process.env.NODE_ENV !== 'production')) {
warn(`Runtime compilation is not supported in this build of Vue.` +
( ` Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".`
) /* should not happen */);
}
};
export { compile };

9277
node_modules/vue/dist/vue.runtime.global.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/vue/dist/vue.runtime.global.prod.js generated vendored Normal file

File diff suppressed because one or more lines are too long

7
node_modules/vue/index.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/vue.cjs.prod.js')
} else {
module.exports = require('./dist/vue.cjs.js')
}

81
node_modules/vue/package.json generated vendored Normal file
View File

@@ -0,0 +1,81 @@
{
"_args": [
[
"vue@3.0.2",
"J:\\Github\\CURD-TS"
]
],
"_development": true,
"_from": "vue@3.0.2",
"_id": "vue@3.0.2",
"_inBundle": false,
"_integrity": "sha1-nVt7KYPzXmSjTRPHydaDEjn+yjw=",
"_location": "/vue",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "vue@3.0.2",
"name": "vue",
"escapedName": "vue",
"rawSpec": "3.0.2",
"saveSpec": null,
"fetchSpec": "3.0.2"
},
"_requiredBy": [
"/vite",
"/vitepress"
],
"_resolved": "http://192.168.250.101:4873/vue/-/vue-3.0.2.tgz",
"_spec": "3.0.2",
"_where": "J:\\Github\\CURD-TS",
"author": {
"name": "Evan You"
},
"bugs": {
"url": "https://github.com/vuejs/vue-next/issues"
},
"buildOptions": {
"name": "Vue",
"formats": [
"esm-bundler",
"esm-bundler-runtime",
"cjs",
"global",
"global-runtime",
"esm-browser",
"esm-browser-runtime"
]
},
"dependencies": {
"@vue/compiler-dom": "3.0.2",
"@vue/runtime-dom": "3.0.2",
"@vue/shared": "3.0.2"
},
"description": "vue",
"devDependencies": {
"lodash": "^4.17.15",
"marked": "^0.7.0",
"todomvc-app-css": "^2.3.0"
},
"files": [
"index.js",
"dist"
],
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/vue#readme",
"jsdelivr": "dist/vue.global.js",
"keywords": [
"vue"
],
"license": "MIT",
"main": "index.js",
"module": "dist/vue.runtime.esm-bundler.js",
"name": "vue",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-next.git"
},
"types": "dist/vue.d.ts",
"unpkg": "dist/vue.global.js",
"version": "3.0.2"
}