mirror of
https://github.com/denoland/deno.git
synced 2025-02-14 01:26:14 -05:00
1 line
6.8 KiB
JSON
1 line
6.8 KiB
JSON
{"name":"@vue/reactivity-transform","dist-tags":{"latest":"3.2.38"},"versions":{"3.2.38":{"name":"@vue/reactivity-transform","version":"3.2.38","description":"@vue/reactivity-transform","main":"dist/reactivity-transform.cjs.js","buildOptions":{"formats":["cjs"],"prod":false},"types":"dist/reactivity-transform.d.ts","repository":{"type":"git","url":"git+https://github.com/vuejs/core.git","directory":"packages/reactivity-transform"},"author":{"name":"Evan You"},"license":"MIT","bugs":{"url":"https://github.com/vuejs/core/issues"},"dependencies":{"@babel/parser":"^7.16.4","@vue/compiler-core":"3.2.38","@vue/shared":"3.2.38","estree-walker":"^2.0.2","magic-string":"^0.25.7"},"devDependencies":{"@babel/core":"^7.16.0","@babel/types":"^7.16.0"},"licenseText":"The MIT License (MIT)\n\nCopyright (c) 2018-present, Yuxi (Evan) You\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","_id":"@vue/reactivity-transform@3.2.38","dist":{"shasum":"a856c217b2ead99eefb6fddb1d61119b2cb67984","integrity":"sha512-3SD3Jmi1yXrDwiNJqQ6fs1x61WsDLqVk4NyKVz78mkaIRh6d3IqtRnptgRfXn+Fzf+m6B1KxBYWq1APj6h4qeA==","tarball":"http://localhost:4260/@vue/reactivity-transform/reactivity-transform-3.2.38.tgz","fileCount":7,"unpackedSize":27932,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDakLqeNSGQjKBB/vOqgoXVtdzQeMvPlVfcvl7L4q/7FQIhAKIya/6uNljjlCXYXL1mYtD0IKgT0O5nz/CoJl9X+rv3"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjDcQDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqOlQ//WzyJG05nw3a2R5FO0wwuaJr+QgPuXZ5C4cUcla7pXDq+lG2B\r\n54PLZIkBvvCOfC9RuH83LGxjWydcAZof8tbHF07Pqw5hI4JKVtw/oMjXBInG\r\nlsb50SfJqOtWTjfiWpMbHTklO5wijAmF4CnBN8/Z0t9kg3penW0a7XAZpZBp\r\nHqkhhd8kf2msXn7PzF9y+KNEQYwYlqhjSZo5wMv9agicJ+J9L1itoE/L2ql8\r\nmj+ea385lkn/KkZBud/Y9QoVantPCconf7cWwhskbkcjGoloWvp4OG+ppAkC\r\nKBJjSFBjWKDEaqzhPsdQ7o3XOElsNH1mhpqhfJ7gG/4DcZIW4JFQxl792H5N\r\nOT/julZPI2xp3h5cJ+CWVFo7OQDDF79h5nlPOqtjYgnSPdbkWE8PeQiSMEiT\r\nvvD1s+ozx1HvMUK2HzU/DRvTrRAGmbm8S7xpf5fulczUmx/BqkecdTn7NvRG\r\nX2wLzebFtukAjs7IbDiaPOo7bN8fxKcelRMR41dQWjUdFYFpZ6ceg4IyIrI1\r\nPlf+X/AQe6d7TzTx6/sh7qbfp38X1b6pLXaLevZTvzzrUkB9lJbxv1gpaLbH\r\nJFBr48TE/bx8kThEHR4Cr2u+b03ojqUrQ7GmkoDHQJSy6uT8u1YNC5NbUCy9\r\ncgs9aOgKIuN4kAT4GZhaoaDCnNzahdUy1QA=\r\n=Pp3l\r\n-----END PGP SIGNATURE-----\r\n"},"directories":{},"_hasShrinkwrap":false}},"description":"@vue/reactivity-transform","homepage":"https://github.com/vuejs/core/tree/dev/packages/reactivity-transform#readme","repository":{"type":"git","url":"git+https://github.com/vuejs/core.git","directory":"packages/reactivity-transform"},"author":{"name":"Evan You"},"bugs":{"url":"https://github.com/vuejs/core/issues"},"license":"MIT","readme":"# @vue/reactivity-transform\n\n> ⚠️ This is experimental and currently only provided for testing and feedback. It may break during patches or even be removed. Use at your own risk!\n>\n> Follow https://github.com/vuejs/rfcs/discussions/369 for details and updates.\n\n## Basic Rules\n\n- Ref-creating APIs have `$`-prefixed versions that create reactive variables instead. They also do not need to be explicitly imported. These include:\n - `ref`\n - `computed`\n - `shallowRef`\n - `customRef`\n - `toRef`\n- `$()` can be used to destructure an object into reactive variables, or turn existing refs into reactive variables\n- `$$()` to \"escape\" the transform, which allows access to underlying refs\n\n```js\nimport { watchEffect } from 'vue'\n\n// bind ref as a variable\nlet count = $ref(0)\n\nwatchEffect(() => {\n // no need for .value\n console.log(count)\n})\n\n// assignments are reactive\ncount++\n\n// get the actual ref\nconsole.log($$(count)) // { value: 1 }\n```\n\nMacros can be optionally imported to make it more explicit:\n\n```js\n// not necessary, but also works\nimport { $, $ref } from 'vue/macros'\n\nlet count = $ref(0)\nconst { x, y } = $(useMouse())\n```\n\n### Global Types\n\nTo enable types for the macros globally, include the following in a `.d.ts` file:\n\n```ts\n/// <reference types=\"vue/macros-global\" />\n```\n\n## API\n\nThis package is the lower-level transform that can be used standalone. Higher-level tooling (e.g. `@vitejs/plugin-vue` and `vue-loader`) will provide integration via options.\n\n### `shouldTransform`\n\nCan be used to do a cheap check to determine whether full transform should be performed.\n\n```js\nimport { shouldTransform } from '@vue/reactivity-transform'\n\nshouldTransform(`let a = ref(0)`) // false\nshouldTransform(`let a = $ref(0)`) // true\n```\n\n### `transform`\n\n```js\nimport { transform } from '@vue/reactivity-transform'\n\nconst src = `let a = $ref(0); a++`\nconst {\n code, // import { ref as _ref } from 'vue'; let a = (ref(0)); a.value++\"\n map\n} = transform(src, {\n filename: 'foo.ts',\n sourceMap: true,\n\n // @babel/parser plugins to enable.\n // 'typescript' and 'jsx' will be auto-inferred from filename if provided,\n // so in most cases explicit parserPlugins are not necessary\n parserPlugins: [\n /* ... */\n ]\n})\n```\n\n**Options**\n\n```ts\ninterface RefTransformOptions {\n filename?: string\n sourceMap?: boolean // default: false\n parserPlugins?: ParserPlugin[]\n importHelpersFrom?: string // default: \"vue\"\n}\n```\n\n### `transformAST`\n\nTransform with an existing Babel AST + MagicString instance. This is used internally by `@vue/compiler-sfc` to avoid double parse/transform cost.\n\n```js\nimport { transformAST } from '@vue/reactivity-transform'\nimport { parse } from '@babel/parser'\nimport MagicString from 'magic-string'\n\nconst src = `let a = $ref(0); a++`\nconst ast = parse(src, { sourceType: 'module' })\nconst s = new MagicString(src)\n\nconst {\n rootRefs, // ['a']\n importedHelpers // ['ref']\n} = transformAST(ast, s)\n\nconsole.log(s.toString()) // let a = _ref(0); a.value++\n```\n","readmeFilename":"README.md"}
|