{"bugs":{"url":"https://github.com/vuejs/core/issues"},"dist":{"shasum":"3ba87978a46699a41fef87f219f1f1a4799c5e0f","tarball":"https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.3.0-beta.5.tgz","fileCount":5,"integrity":"sha512-v/PCri6+vL8WwwgowHlIopwiqonCj9wV60ZYDdX8AMDxk9Q01h2cWh61JF4XOX7qDs7NdJ7zSVyKSz4B98OXBw==","signatures":[{"sig":"MEQCIHMdxMCItYY+nj98VCWEFTAWIREHRUXbn3Ll5POx0wHCAiBJB8GjPN9AzxlnkxD69asiBj3Gv+lI2qW2A3RligZ9/A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24176},"main":"dist/reactivity-transform.cjs.js","name":"@vue/reactivity-transform","types":"dist/reactivity-transform.d.ts","author":{"name":"Evan You"},"readme":"# @vue/reactivity-transform\n\n> ⚠️ This is experimental and the proposal has been dropped.\n> The feature is now marked as deprecated and will be removed from Vue core\n> in 3.4.\n>\n> See reason for deprecation [here](https://github.com/vuejs/rfcs/discussions/369#discussioncomment-5059028).\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","gitHead":"847658b7a2e761b68a6615491d126c991a71cc7a","license":"MIT","_npmUser":{"name":"yyx990803","email":"yyx990803@gmail.com"},"homepage":"https://github.com/vuejs/core/tree/dev/packages/reactivity-transform#readme","keywords":["vue"],"repository":{"url":"git+https://github.com/vuejs/core.git","type":"git","directory":"packages/reactivity-transform"},"_npmVersion":"9.3.1","description":"@vue/reactivity-transform","directories":{},"maintainers":[{"name":"yyx990803","email":"yyx990803@gmail.com"}],"_nodeVersion":"18.14.0","buildOptions":{"prod":false,"formats":["cjs"]},"dependencies":{"@vue/shared":"3.3.0-beta.5","magic-string":"^0.30.0","@babel/parser":"^7.20.15","estree-walker":"^2.0.2","@vue/compiler-core":"3.3.0-beta.5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@babel/core":"^7.21.3","@babel/types":"^7.21.3"},"_npmOperationalInternal":{"tmp":"tmp/reactivity-transform_3.3.0-beta.5_1683535272306_0.5189917786903302","host":"s3://npm-registry-packages"},"_id":"@vue/reactivity-transform@3.3.0-beta.5","version":"3.3.0-beta.5"}