🔧
This commit is contained in:
+172
-162
@@ -15,9 +15,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-x64": {
|
||||
"version": "0.19.10",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.10.tgz",
|
||||
"integrity": "sha512-whqLG6Sc70AbU73fFYvuYzaE4MNMBIlR1Y/IrUeOXFrWHxBEjjbZaQ3IXIQS8wJdAzue2GwYZCjOrgrU1oUHoA==",
|
||||
"version": "0.19.11",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz",
|
||||
"integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -84,10 +84,15 @@
|
||||
"vue": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
|
||||
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
||||
"version": "4.9.1",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.1.tgz",
|
||||
"integrity": "sha512-PyJsSsafjmIhVgaI1Zdj7m8BB8mMckFah/xbpplObyHfiXzKcI5UOUXRyOdHW7nz4DpMCuzLnF7v5IWHenCwYA==",
|
||||
"version": "4.9.5",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.5.tgz",
|
||||
"integrity": "sha512-1q+mykKE3Vot1kaFJIDoUFv5TuW+QQVaf2FmTT9krg86pQrGStOSJJ0Zil7CFagyxDuouTepzt5Y5TVzyajOdQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -96,10 +101,15 @@
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
|
||||
"integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw=="
|
||||
},
|
||||
"node_modules/@vitejs/plugin-vue": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.0.0.tgz",
|
||||
"integrity": "sha512-7x5e8X4J1Wi4NxudGjJBd2OFerAi/0nzF80ojCzvfj347WVr0YSn82C8BSsgwSHzlk9Kw5xnZfj0/7RLnNwP5w==",
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.0.3.tgz",
|
||||
"integrity": "sha512-b8S5dVS40rgHdDrw+DQi/xOM9ed+kSRZzfm1T74bMmBDCd8XO87NKlFYInzCtwvtWwXZvo1QxE2OSspTATWrbA==",
|
||||
"engines": {
|
||||
"node": "^18.0.0 || >=20.0.0"
|
||||
},
|
||||
@@ -109,106 +119,94 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-core": {
|
||||
"version": "3.2.36",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.36.tgz",
|
||||
"integrity": "sha512-bbyZM5hvBicv0PW3KUfVi+x3ylHnfKG7DOn5wM+f2OztTzTjLEyBb/5yrarIYpmnGitVGbjZqDbODyW4iK8hqw==",
|
||||
"version": "3.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.15.tgz",
|
||||
"integrity": "sha512-XcJQVOaxTKCnth1vCxEChteGuwG6wqnUHxAm1DO3gCz0+uXKaJNx8/digSz4dLALCy8n2lKq24jSUs8segoqIw==",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.16.4",
|
||||
"@vue/shared": "3.2.36",
|
||||
"@babel/parser": "^7.23.6",
|
||||
"@vue/shared": "3.4.15",
|
||||
"entities": "^4.5.0",
|
||||
"estree-walker": "^2.0.2",
|
||||
"source-map": "^0.6.1"
|
||||
"source-map-js": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-dom": {
|
||||
"version": "3.2.36",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.36.tgz",
|
||||
"integrity": "sha512-tcOTAOiW4s24QLnq+ON6J+GRONXJ+A/mqKCORi0LSlIh8XQlNnlm24y8xIL8la+ZDgkdbjarQ9ZqYSvEja6gVA==",
|
||||
"version": "3.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.15.tgz",
|
||||
"integrity": "sha512-wox0aasVV74zoXyblarOM3AZQz/Z+OunYcIHe1OsGclCHt8RsRm04DObjefaI82u6XDzv+qGWZ24tIsRAIi5MQ==",
|
||||
"dependencies": {
|
||||
"@vue/compiler-core": "3.2.36",
|
||||
"@vue/shared": "3.2.36"
|
||||
"@vue/compiler-core": "3.4.15",
|
||||
"@vue/shared": "3.4.15"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-sfc": {
|
||||
"version": "3.2.36",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.2.36.tgz",
|
||||
"integrity": "sha512-AvGb4bTj4W8uQ4BqaSxo7UwTEqX5utdRSMyHy58OragWlt8nEACQ9mIeQh3K4di4/SX+41+pJrLIY01lHAOFOA==",
|
||||
"version": "3.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.15.tgz",
|
||||
"integrity": "sha512-LCn5M6QpkpFsh3GQvs2mJUOAlBQcCco8D60Bcqmf3O3w5a+KWS5GvYbrrJBkgvL1BDnTp+e8q0lXCLgHhKguBA==",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.16.4",
|
||||
"@vue/compiler-core": "3.2.36",
|
||||
"@vue/compiler-dom": "3.2.36",
|
||||
"@vue/compiler-ssr": "3.2.36",
|
||||
"@vue/reactivity-transform": "3.2.36",
|
||||
"@vue/shared": "3.2.36",
|
||||
"@babel/parser": "^7.23.6",
|
||||
"@vue/compiler-core": "3.4.15",
|
||||
"@vue/compiler-dom": "3.4.15",
|
||||
"@vue/compiler-ssr": "3.4.15",
|
||||
"@vue/shared": "3.4.15",
|
||||
"estree-walker": "^2.0.2",
|
||||
"magic-string": "^0.25.7",
|
||||
"postcss": "^8.1.10",
|
||||
"source-map": "^0.6.1"
|
||||
"magic-string": "^0.30.5",
|
||||
"postcss": "^8.4.33",
|
||||
"source-map-js": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-ssr": {
|
||||
"version": "3.2.36",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.2.36.tgz",
|
||||
"integrity": "sha512-+KugInUFRvOxEdLkZwE+W43BqHyhBh0jpYXhmqw1xGq2dmE6J9eZ8UUSOKNhdHtQ/iNLWWeK/wPZkVLUf3YGaw==",
|
||||
"version": "3.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.15.tgz",
|
||||
"integrity": "sha512-1jdeQyiGznr8gjFDadVmOJqZiLNSsMa5ZgqavkPZ8O2wjHv0tVuAEsw5hTdUoUW4232vpBbL/wJhzVW/JwY1Uw==",
|
||||
"dependencies": {
|
||||
"@vue/compiler-dom": "3.2.36",
|
||||
"@vue/shared": "3.2.36"
|
||||
"@vue/compiler-dom": "3.4.15",
|
||||
"@vue/shared": "3.4.15"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/reactivity": {
|
||||
"version": "3.2.36",
|
||||
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.2.36.tgz",
|
||||
"integrity": "sha512-c2qvopo0crh9A4GXi2/2kfGYMxsJW4tVILrqRPydVGZHhq0fnzy6qmclWOhBFckEhmyxmpHpdJtIRYGeKcuhnA==",
|
||||
"version": "3.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.15.tgz",
|
||||
"integrity": "sha512-55yJh2bsff20K5O84MxSvXKPHHt17I2EomHznvFiJCAZpJTNW8IuLj1xZWMLELRhBK3kkFV/1ErZGHJfah7i7w==",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/reactivity-transform": {
|
||||
"version": "3.2.36",
|
||||
"resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.2.36.tgz",
|
||||
"integrity": "sha512-Jk5o2BhpODC9XTA7o4EL8hSJ4JyrFWErLtClG3NH8wDS7ri9jBDWxI7/549T7JY9uilKsaNM+4pJASLj5dtRwA==",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.16.4",
|
||||
"@vue/compiler-core": "3.2.36",
|
||||
"@vue/shared": "3.2.36",
|
||||
"estree-walker": "^2.0.2",
|
||||
"magic-string": "^0.25.7"
|
||||
"@vue/shared": "3.4.15"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/runtime-core": {
|
||||
"version": "3.2.36",
|
||||
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.2.36.tgz",
|
||||
"integrity": "sha512-PTWBD+Lub+1U3/KhbCExrfxyS14hstLX+cBboxVHaz+kXoiDLNDEYAovPtxeTutbqtClIXtft+wcGdC+FUQ9qQ==",
|
||||
"version": "3.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.15.tgz",
|
||||
"integrity": "sha512-6E3by5m6v1AkW0McCeAyhHTw+3y17YCOKG0U0HDKDscV4Hs0kgNT5G+GCHak16jKgcCDHpI9xe5NKb8sdLCLdw==",
|
||||
"dependencies": {
|
||||
"@vue/reactivity": "3.2.36",
|
||||
"@vue/shared": "3.2.36"
|
||||
"@vue/reactivity": "3.4.15",
|
||||
"@vue/shared": "3.4.15"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/runtime-dom": {
|
||||
"version": "3.2.36",
|
||||
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.2.36.tgz",
|
||||
"integrity": "sha512-gYPYblm7QXHVuBohqNRRT7Wez0f2Mx2D40rb4fleehrJU9CnkjG0phhcGEZFfGwCmHZRqBCRgbFWE98bPULqkg==",
|
||||
"version": "3.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.15.tgz",
|
||||
"integrity": "sha512-EVW8D6vfFVq3V/yDKNPBFkZKGMFSvZrUQmx196o/v2tHKdwWdiZjYUBS+0Ez3+ohRyF8Njwy/6FH5gYJ75liUw==",
|
||||
"dependencies": {
|
||||
"@vue/runtime-core": "3.2.36",
|
||||
"@vue/shared": "3.2.36",
|
||||
"csstype": "^2.6.8"
|
||||
"@vue/runtime-core": "3.4.15",
|
||||
"@vue/shared": "3.4.15",
|
||||
"csstype": "^3.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/server-renderer": {
|
||||
"version": "3.2.36",
|
||||
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.2.36.tgz",
|
||||
"integrity": "sha512-uZE0+jfye6yYXWvAQYeHZv+f50sRryvy16uiqzk3jn8hEY8zTjI+rzlmZSGoE915k+W/Ol9XSw6vxOUD8dGkUg==",
|
||||
"version": "3.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.15.tgz",
|
||||
"integrity": "sha512-3HYzaidu9cHjrT+qGUuDhFYvF/j643bHC6uUN9BgM11DVy+pM6ATsG6uPBLnkwOgs7BpJABReLmpL3ZPAsUaqw==",
|
||||
"dependencies": {
|
||||
"@vue/compiler-ssr": "3.2.36",
|
||||
"@vue/shared": "3.2.36"
|
||||
"@vue/compiler-ssr": "3.4.15",
|
||||
"@vue/shared": "3.4.15"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "3.2.36"
|
||||
"vue": "3.4.15"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/shared": {
|
||||
"version": "3.2.36",
|
||||
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.36.tgz",
|
||||
"integrity": "sha512-JtB41wXl7Au3+Nl3gD16Cfpj7k/6aCroZ6BbOiCMFCMvrOpkg/qQUXTso2XowaNqBbnkuGHurLAqkLBxNGc1hQ=="
|
||||
"version": "3.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.15.tgz",
|
||||
"integrity": "sha512-KzfPTxVaWfB+eGcGdbSf4CWdaXcGDqckoeXUh7SB3fZdEtzPCK2Vq9B/lRRL3yutax/LWITz+SwvgyOxz5V75g=="
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
@@ -216,11 +214,11 @@
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.6.3",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.3.tgz",
|
||||
"integrity": "sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww==",
|
||||
"version": "1.6.5",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz",
|
||||
"integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.0",
|
||||
"follow-redirects": "^1.15.4",
|
||||
"form-data": "^4.0.0",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
@@ -250,9 +248,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/csstype": {
|
||||
"version": "2.6.21",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz",
|
||||
"integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w=="
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
|
||||
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
|
||||
},
|
||||
"node_modules/deepmerge": {
|
||||
"version": "4.3.1",
|
||||
@@ -283,10 +281,21 @@
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/entities": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.19.10",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.10.tgz",
|
||||
"integrity": "sha512-S1Y27QGt/snkNYrRcswgRFqZjaTG5a5xM3EQo97uNBnH505pdzSNe/HLBq1v0RO7iK/ngdbhJB6mDAp0OK+iUA==",
|
||||
"version": "0.19.11",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz",
|
||||
"integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==",
|
||||
"hasInstallScript": true,
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
@@ -295,29 +304,29 @@
|
||||
"node": ">=12"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.19.10",
|
||||
"@esbuild/android-arm": "0.19.10",
|
||||
"@esbuild/android-arm64": "0.19.10",
|
||||
"@esbuild/android-x64": "0.19.10",
|
||||
"@esbuild/darwin-arm64": "0.19.10",
|
||||
"@esbuild/darwin-x64": "0.19.10",
|
||||
"@esbuild/freebsd-arm64": "0.19.10",
|
||||
"@esbuild/freebsd-x64": "0.19.10",
|
||||
"@esbuild/linux-arm": "0.19.10",
|
||||
"@esbuild/linux-arm64": "0.19.10",
|
||||
"@esbuild/linux-ia32": "0.19.10",
|
||||
"@esbuild/linux-loong64": "0.19.10",
|
||||
"@esbuild/linux-mips64el": "0.19.10",
|
||||
"@esbuild/linux-ppc64": "0.19.10",
|
||||
"@esbuild/linux-riscv64": "0.19.10",
|
||||
"@esbuild/linux-s390x": "0.19.10",
|
||||
"@esbuild/linux-x64": "0.19.10",
|
||||
"@esbuild/netbsd-x64": "0.19.10",
|
||||
"@esbuild/openbsd-x64": "0.19.10",
|
||||
"@esbuild/sunos-x64": "0.19.10",
|
||||
"@esbuild/win32-arm64": "0.19.10",
|
||||
"@esbuild/win32-ia32": "0.19.10",
|
||||
"@esbuild/win32-x64": "0.19.10"
|
||||
"@esbuild/aix-ppc64": "0.19.11",
|
||||
"@esbuild/android-arm": "0.19.11",
|
||||
"@esbuild/android-arm64": "0.19.11",
|
||||
"@esbuild/android-x64": "0.19.11",
|
||||
"@esbuild/darwin-arm64": "0.19.11",
|
||||
"@esbuild/darwin-x64": "0.19.11",
|
||||
"@esbuild/freebsd-arm64": "0.19.11",
|
||||
"@esbuild/freebsd-x64": "0.19.11",
|
||||
"@esbuild/linux-arm": "0.19.11",
|
||||
"@esbuild/linux-arm64": "0.19.11",
|
||||
"@esbuild/linux-ia32": "0.19.11",
|
||||
"@esbuild/linux-loong64": "0.19.11",
|
||||
"@esbuild/linux-mips64el": "0.19.11",
|
||||
"@esbuild/linux-ppc64": "0.19.11",
|
||||
"@esbuild/linux-riscv64": "0.19.11",
|
||||
"@esbuild/linux-s390x": "0.19.11",
|
||||
"@esbuild/linux-x64": "0.19.11",
|
||||
"@esbuild/netbsd-x64": "0.19.11",
|
||||
"@esbuild/openbsd-x64": "0.19.11",
|
||||
"@esbuild/sunos-x64": "0.19.11",
|
||||
"@esbuild/win32-arm64": "0.19.11",
|
||||
"@esbuild/win32-ia32": "0.19.11",
|
||||
"@esbuild/win32-x64": "0.19.11"
|
||||
}
|
||||
},
|
||||
"node_modules/estree-walker": {
|
||||
@@ -326,9 +335,9 @@
|
||||
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.3",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz",
|
||||
"integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==",
|
||||
"version": "1.15.5",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz",
|
||||
"integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
@@ -464,11 +473,14 @@
|
||||
"integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ=="
|
||||
},
|
||||
"node_modules/magic-string": {
|
||||
"version": "0.25.9",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz",
|
||||
"integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==",
|
||||
"version": "0.30.5",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz",
|
||||
"integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==",
|
||||
"dependencies": {
|
||||
"sourcemap-codec": "^1.4.8"
|
||||
"@jridgewell/sourcemap-codec": "^1.4.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
@@ -538,9 +550,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.32",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz",
|
||||
"integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==",
|
||||
"version": "8.4.33",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz",
|
||||
"integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
@@ -584,9 +596,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "4.9.1",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.1.tgz",
|
||||
"integrity": "sha512-pgPO9DWzLoW/vIhlSoDByCzcpX92bKEorbgXuZrqxByte3JFk2xSW2JEeAcyLc9Ru9pqcNNW+Ob7ntsk2oT/Xw==",
|
||||
"version": "4.9.5",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.5.tgz",
|
||||
"integrity": "sha512-E4vQW0H/mbNMw2yLSqJyjtkHY9dslf/p0zuT1xehNRqUTBOFMqEjguDvqhXr7N7r/4ttb2jr4T41d3dncmIgbQ==",
|
||||
"dependencies": {
|
||||
"@types/estree": "1.0.5"
|
||||
},
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
},
|
||||
@@ -595,31 +610,32 @@
|
||||
"npm": ">=8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-android-arm-eabi": "4.9.1",
|
||||
"@rollup/rollup-android-arm64": "4.9.1",
|
||||
"@rollup/rollup-darwin-arm64": "4.9.1",
|
||||
"@rollup/rollup-darwin-x64": "4.9.1",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.9.1",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.9.1",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.9.1",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.9.1",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.9.1",
|
||||
"@rollup/rollup-linux-x64-musl": "4.9.1",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.9.1",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.9.1",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.9.1",
|
||||
"@rollup/rollup-android-arm-eabi": "4.9.5",
|
||||
"@rollup/rollup-android-arm64": "4.9.5",
|
||||
"@rollup/rollup-darwin-arm64": "4.9.5",
|
||||
"@rollup/rollup-darwin-x64": "4.9.5",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.9.5",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.9.5",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.9.5",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.9.5",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.9.5",
|
||||
"@rollup/rollup-linux-x64-musl": "4.9.5",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.9.5",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.9.5",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.9.5",
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/set-function-length": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz",
|
||||
"integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz",
|
||||
"integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==",
|
||||
"dependencies": {
|
||||
"define-data-property": "^1.1.1",
|
||||
"get-intrinsic": "^1.2.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-intrinsic": "^1.2.2",
|
||||
"gopd": "^1.0.1",
|
||||
"has-property-descriptors": "^1.0.0"
|
||||
"has-property-descriptors": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@@ -638,14 +654,6 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
|
||||
@@ -654,16 +662,10 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sourcemap-codec": {
|
||||
"version": "1.4.8",
|
||||
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
|
||||
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
|
||||
"deprecated": "Please use @jridgewell/sourcemap-codec instead"
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "5.0.10",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.10.tgz",
|
||||
"integrity": "sha512-2P8J7WWgmc355HUMlFrwofacvr98DAjoE52BfdbwQtyLH06XKwaL/FMnmKM2crF0iX4MpmMKoDlNCB1ok7zHCw==",
|
||||
"version": "5.0.12",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.12.tgz",
|
||||
"integrity": "sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.19.3",
|
||||
"postcss": "^8.4.32",
|
||||
@@ -725,15 +727,23 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vue": {
|
||||
"version": "3.2.36",
|
||||
"resolved": "https://registry.npmjs.org/vue/-/vue-3.2.36.tgz",
|
||||
"integrity": "sha512-5yTXmrE6gW8IQgttzHW5bfBiFA6mx35ZXHjGLDmKYzW6MMmYvCwuKybANRepwkMYeXw2v1buGg3/lPICY5YlZw==",
|
||||
"version": "3.4.15",
|
||||
"resolved": "https://registry.npmjs.org/vue/-/vue-3.4.15.tgz",
|
||||
"integrity": "sha512-jC0GH4KkWLWJOEQjOpkqU1bQsBwf4R1rsFtw5GQJbjHVKWDzO6P0nWWBTmjp1xSemAioDFj1jdaK1qa3DnMQoQ==",
|
||||
"dependencies": {
|
||||
"@vue/compiler-dom": "3.2.36",
|
||||
"@vue/compiler-sfc": "3.2.36",
|
||||
"@vue/runtime-dom": "3.2.36",
|
||||
"@vue/server-renderer": "3.2.36",
|
||||
"@vue/shared": "3.2.36"
|
||||
"@vue/compiler-dom": "3.4.15",
|
||||
"@vue/compiler-sfc": "3.4.15",
|
||||
"@vue/runtime-dom": "3.4.15",
|
||||
"@vue/server-renderer": "3.4.15",
|
||||
"@vue/shared": "3.4.15"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@esbuild/win32-x64",
|
||||
"version": "0.19.10",
|
||||
"version": "0.19.11",
|
||||
"description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.",
|
||||
"repository": "https://github.com/evanw/esbuild",
|
||||
"license": "MIT",
|
||||
|
||||
Generated
Vendored
+200
@@ -0,0 +1,200 @@
|
||||
# @jridgewell/sourcemap-codec
|
||||
|
||||
Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit).
|
||||
|
||||
|
||||
## Why?
|
||||
|
||||
Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap.
|
||||
|
||||
This package makes the process slightly easier.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @jridgewell/sourcemap-codec
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { encode, decode } from '@jridgewell/sourcemap-codec';
|
||||
|
||||
var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
|
||||
|
||||
assert.deepEqual( decoded, [
|
||||
// the first line (of the generated code) has no mappings,
|
||||
// as shown by the starting semi-colon (which separates lines)
|
||||
[],
|
||||
|
||||
// the second line contains four (comma-separated) segments
|
||||
[
|
||||
// segments are encoded as you'd expect:
|
||||
// [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ]
|
||||
|
||||
// i.e. the first segment begins at column 2, and maps back to the second column
|
||||
// of the second line (both zero-based) of the 0th source, and uses the 0th
|
||||
// name in the `map.names` array
|
||||
[ 2, 0, 2, 2, 0 ],
|
||||
|
||||
// the remaining segments are 4-length rather than 5-length,
|
||||
// because they don't map a name
|
||||
[ 4, 0, 2, 4 ],
|
||||
[ 6, 0, 2, 5 ],
|
||||
[ 7, 0, 2, 7 ]
|
||||
],
|
||||
|
||||
// the final line contains two segments
|
||||
[
|
||||
[ 2, 1, 10, 19 ],
|
||||
[ 12, 1, 11, 20 ]
|
||||
]
|
||||
]);
|
||||
|
||||
var encoded = encode( decoded );
|
||||
assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
|
||||
```
|
||||
|
||||
## Benchmarks
|
||||
|
||||
```
|
||||
node v18.0.0
|
||||
|
||||
amp.js.map - 45120 segments
|
||||
|
||||
Decode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 5479160 bytes
|
||||
sourcemap-codec 5659336 bytes
|
||||
source-map-0.6.1 17144440 bytes
|
||||
source-map-0.8.0 6867424 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Decode speed:
|
||||
decode: @jridgewell/sourcemap-codec x 502 ops/sec ±1.03% (90 runs sampled)
|
||||
decode: sourcemap-codec x 445 ops/sec ±0.97% (92 runs sampled)
|
||||
decode: source-map-0.6.1 x 36.01 ops/sec ±1.64% (49 runs sampled)
|
||||
decode: source-map-0.8.0 x 367 ops/sec ±0.04% (95 runs sampled)
|
||||
Fastest is decode: @jridgewell/sourcemap-codec
|
||||
|
||||
Encode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 1261620 bytes
|
||||
sourcemap-codec 9119248 bytes
|
||||
source-map-0.6.1 8968560 bytes
|
||||
source-map-0.8.0 8952952 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Encode speed:
|
||||
encode: @jridgewell/sourcemap-codec x 738 ops/sec ±0.42% (98 runs sampled)
|
||||
encode: sourcemap-codec x 238 ops/sec ±0.73% (88 runs sampled)
|
||||
encode: source-map-0.6.1 x 162 ops/sec ±0.43% (84 runs sampled)
|
||||
encode: source-map-0.8.0 x 191 ops/sec ±0.34% (90 runs sampled)
|
||||
Fastest is encode: @jridgewell/sourcemap-codec
|
||||
|
||||
|
||||
***
|
||||
|
||||
|
||||
babel.min.js.map - 347793 segments
|
||||
|
||||
Decode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 35338184 bytes
|
||||
sourcemap-codec 35922736 bytes
|
||||
source-map-0.6.1 62366360 bytes
|
||||
source-map-0.8.0 44337416 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Decode speed:
|
||||
decode: @jridgewell/sourcemap-codec x 40.35 ops/sec ±4.47% (54 runs sampled)
|
||||
decode: sourcemap-codec x 36.76 ops/sec ±3.67% (51 runs sampled)
|
||||
decode: source-map-0.6.1 x 4.44 ops/sec ±2.15% (16 runs sampled)
|
||||
decode: source-map-0.8.0 x 59.35 ops/sec ±0.05% (78 runs sampled)
|
||||
Fastest is decode: source-map-0.8.0
|
||||
|
||||
Encode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 7212604 bytes
|
||||
sourcemap-codec 21421456 bytes
|
||||
source-map-0.6.1 25286888 bytes
|
||||
source-map-0.8.0 25498744 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Encode speed:
|
||||
encode: @jridgewell/sourcemap-codec x 112 ops/sec ±0.13% (84 runs sampled)
|
||||
encode: sourcemap-codec x 30.23 ops/sec ±2.76% (53 runs sampled)
|
||||
encode: source-map-0.6.1 x 19.43 ops/sec ±3.70% (37 runs sampled)
|
||||
encode: source-map-0.8.0 x 19.40 ops/sec ±3.26% (37 runs sampled)
|
||||
Fastest is encode: @jridgewell/sourcemap-codec
|
||||
|
||||
|
||||
***
|
||||
|
||||
|
||||
preact.js.map - 1992 segments
|
||||
|
||||
Decode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 500272 bytes
|
||||
sourcemap-codec 516864 bytes
|
||||
source-map-0.6.1 1596672 bytes
|
||||
source-map-0.8.0 517272 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Decode speed:
|
||||
decode: @jridgewell/sourcemap-codec x 16,137 ops/sec ±0.17% (99 runs sampled)
|
||||
decode: sourcemap-codec x 12,139 ops/sec ±0.13% (99 runs sampled)
|
||||
decode: source-map-0.6.1 x 1,264 ops/sec ±0.12% (100 runs sampled)
|
||||
decode: source-map-0.8.0 x 9,894 ops/sec ±0.08% (101 runs sampled)
|
||||
Fastest is decode: @jridgewell/sourcemap-codec
|
||||
|
||||
Encode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 321026 bytes
|
||||
sourcemap-codec 830832 bytes
|
||||
source-map-0.6.1 586608 bytes
|
||||
source-map-0.8.0 586680 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Encode speed:
|
||||
encode: @jridgewell/sourcemap-codec x 19,876 ops/sec ±0.78% (95 runs sampled)
|
||||
encode: sourcemap-codec x 6,983 ops/sec ±0.15% (100 runs sampled)
|
||||
encode: source-map-0.6.1 x 5,070 ops/sec ±0.12% (102 runs sampled)
|
||||
encode: source-map-0.8.0 x 5,641 ops/sec ±0.17% (100 runs sampled)
|
||||
Fastest is encode: @jridgewell/sourcemap-codec
|
||||
|
||||
|
||||
***
|
||||
|
||||
|
||||
react.js.map - 5726 segments
|
||||
|
||||
Decode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 734848 bytes
|
||||
sourcemap-codec 954200 bytes
|
||||
source-map-0.6.1 2276432 bytes
|
||||
source-map-0.8.0 955488 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Decode speed:
|
||||
decode: @jridgewell/sourcemap-codec x 5,723 ops/sec ±0.12% (98 runs sampled)
|
||||
decode: sourcemap-codec x 4,555 ops/sec ±0.09% (101 runs sampled)
|
||||
decode: source-map-0.6.1 x 437 ops/sec ±0.11% (93 runs sampled)
|
||||
decode: source-map-0.8.0 x 3,441 ops/sec ±0.15% (100 runs sampled)
|
||||
Fastest is decode: @jridgewell/sourcemap-codec
|
||||
|
||||
Encode Memory Usage:
|
||||
@jridgewell/sourcemap-codec 638672 bytes
|
||||
sourcemap-codec 1109840 bytes
|
||||
source-map-0.6.1 1321224 bytes
|
||||
source-map-0.8.0 1324448 bytes
|
||||
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||
|
||||
Encode speed:
|
||||
encode: @jridgewell/sourcemap-codec x 6,801 ops/sec ±0.48% (98 runs sampled)
|
||||
encode: sourcemap-codec x 2,533 ops/sec ±0.13% (101 runs sampled)
|
||||
encode: source-map-0.6.1 x 2,248 ops/sec ±0.08% (100 runs sampled)
|
||||
encode: source-map-0.8.0 x 2,303 ops/sec ±0.15% (100 runs sampled)
|
||||
Fastest is encode: @jridgewell/sourcemap-codec
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
MIT
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
const comma = ','.charCodeAt(0);
|
||||
const semicolon = ';'.charCodeAt(0);
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
const intToChar = new Uint8Array(64); // 64 possible chars.
|
||||
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
||||
for (let i = 0; i < chars.length; i++) {
|
||||
const c = chars.charCodeAt(i);
|
||||
intToChar[i] = c;
|
||||
charToInt[c] = i;
|
||||
}
|
||||
// Provide a fallback for older environments.
|
||||
const td = typeof TextDecoder !== 'undefined'
|
||||
? /* #__PURE__ */ new TextDecoder()
|
||||
: typeof Buffer !== 'undefined'
|
||||
? {
|
||||
decode(buf) {
|
||||
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||
return out.toString();
|
||||
},
|
||||
}
|
||||
: {
|
||||
decode(buf) {
|
||||
let out = '';
|
||||
for (let i = 0; i < buf.length; i++) {
|
||||
out += String.fromCharCode(buf[i]);
|
||||
}
|
||||
return out;
|
||||
},
|
||||
};
|
||||
function decode(mappings) {
|
||||
const state = new Int32Array(5);
|
||||
const decoded = [];
|
||||
let index = 0;
|
||||
do {
|
||||
const semi = indexOf(mappings, index);
|
||||
const line = [];
|
||||
let sorted = true;
|
||||
let lastCol = 0;
|
||||
state[0] = 0;
|
||||
for (let i = index; i < semi; i++) {
|
||||
let seg;
|
||||
i = decodeInteger(mappings, i, state, 0); // genColumn
|
||||
const col = state[0];
|
||||
if (col < lastCol)
|
||||
sorted = false;
|
||||
lastCol = col;
|
||||
if (hasMoreVlq(mappings, i, semi)) {
|
||||
i = decodeInteger(mappings, i, state, 1); // sourcesIndex
|
||||
i = decodeInteger(mappings, i, state, 2); // sourceLine
|
||||
i = decodeInteger(mappings, i, state, 3); // sourceColumn
|
||||
if (hasMoreVlq(mappings, i, semi)) {
|
||||
i = decodeInteger(mappings, i, state, 4); // namesIndex
|
||||
seg = [col, state[1], state[2], state[3], state[4]];
|
||||
}
|
||||
else {
|
||||
seg = [col, state[1], state[2], state[3]];
|
||||
}
|
||||
}
|
||||
else {
|
||||
seg = [col];
|
||||
}
|
||||
line.push(seg);
|
||||
}
|
||||
if (!sorted)
|
||||
sort(line);
|
||||
decoded.push(line);
|
||||
index = semi + 1;
|
||||
} while (index <= mappings.length);
|
||||
return decoded;
|
||||
}
|
||||
function indexOf(mappings, index) {
|
||||
const idx = mappings.indexOf(';', index);
|
||||
return idx === -1 ? mappings.length : idx;
|
||||
}
|
||||
function decodeInteger(mappings, pos, state, j) {
|
||||
let value = 0;
|
||||
let shift = 0;
|
||||
let integer = 0;
|
||||
do {
|
||||
const c = mappings.charCodeAt(pos++);
|
||||
integer = charToInt[c];
|
||||
value |= (integer & 31) << shift;
|
||||
shift += 5;
|
||||
} while (integer & 32);
|
||||
const shouldNegate = value & 1;
|
||||
value >>>= 1;
|
||||
if (shouldNegate) {
|
||||
value = -0x80000000 | -value;
|
||||
}
|
||||
state[j] += value;
|
||||
return pos;
|
||||
}
|
||||
function hasMoreVlq(mappings, i, length) {
|
||||
if (i >= length)
|
||||
return false;
|
||||
return mappings.charCodeAt(i) !== comma;
|
||||
}
|
||||
function sort(line) {
|
||||
line.sort(sortComparator);
|
||||
}
|
||||
function sortComparator(a, b) {
|
||||
return a[0] - b[0];
|
||||
}
|
||||
function encode(decoded) {
|
||||
const state = new Int32Array(5);
|
||||
const bufLength = 1024 * 16;
|
||||
const subLength = bufLength - 36;
|
||||
const buf = new Uint8Array(bufLength);
|
||||
const sub = buf.subarray(0, subLength);
|
||||
let pos = 0;
|
||||
let out = '';
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
const line = decoded[i];
|
||||
if (i > 0) {
|
||||
if (pos === bufLength) {
|
||||
out += td.decode(buf);
|
||||
pos = 0;
|
||||
}
|
||||
buf[pos++] = semicolon;
|
||||
}
|
||||
if (line.length === 0)
|
||||
continue;
|
||||
state[0] = 0;
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const segment = line[j];
|
||||
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
||||
// may push a comma.
|
||||
if (pos > subLength) {
|
||||
out += td.decode(sub);
|
||||
buf.copyWithin(0, subLength, pos);
|
||||
pos -= subLength;
|
||||
}
|
||||
if (j > 0)
|
||||
buf[pos++] = comma;
|
||||
pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
|
||||
if (segment.length === 1)
|
||||
continue;
|
||||
pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
|
||||
pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
|
||||
pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
|
||||
if (segment.length === 4)
|
||||
continue;
|
||||
pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
|
||||
}
|
||||
}
|
||||
return out + td.decode(buf.subarray(0, pos));
|
||||
}
|
||||
function encodeInteger(buf, pos, state, segment, j) {
|
||||
const next = segment[j];
|
||||
let num = next - state[j];
|
||||
state[j] = next;
|
||||
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
||||
do {
|
||||
let clamped = num & 0b011111;
|
||||
num >>>= 5;
|
||||
if (num > 0)
|
||||
clamped |= 0b100000;
|
||||
buf[pos++] = intToChar[clamped];
|
||||
} while (num > 0);
|
||||
return pos;
|
||||
}
|
||||
|
||||
export { decode, encode };
|
||||
//# sourceMappingURL=sourcemap-codec.mjs.map
|
||||
+1
File diff suppressed because one or more lines are too long
+175
@@ -0,0 +1,175 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sourcemapCodec = {}));
|
||||
})(this, (function (exports) { 'use strict';
|
||||
|
||||
const comma = ','.charCodeAt(0);
|
||||
const semicolon = ';'.charCodeAt(0);
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
const intToChar = new Uint8Array(64); // 64 possible chars.
|
||||
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
||||
for (let i = 0; i < chars.length; i++) {
|
||||
const c = chars.charCodeAt(i);
|
||||
intToChar[i] = c;
|
||||
charToInt[c] = i;
|
||||
}
|
||||
// Provide a fallback for older environments.
|
||||
const td = typeof TextDecoder !== 'undefined'
|
||||
? /* #__PURE__ */ new TextDecoder()
|
||||
: typeof Buffer !== 'undefined'
|
||||
? {
|
||||
decode(buf) {
|
||||
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||
return out.toString();
|
||||
},
|
||||
}
|
||||
: {
|
||||
decode(buf) {
|
||||
let out = '';
|
||||
for (let i = 0; i < buf.length; i++) {
|
||||
out += String.fromCharCode(buf[i]);
|
||||
}
|
||||
return out;
|
||||
},
|
||||
};
|
||||
function decode(mappings) {
|
||||
const state = new Int32Array(5);
|
||||
const decoded = [];
|
||||
let index = 0;
|
||||
do {
|
||||
const semi = indexOf(mappings, index);
|
||||
const line = [];
|
||||
let sorted = true;
|
||||
let lastCol = 0;
|
||||
state[0] = 0;
|
||||
for (let i = index; i < semi; i++) {
|
||||
let seg;
|
||||
i = decodeInteger(mappings, i, state, 0); // genColumn
|
||||
const col = state[0];
|
||||
if (col < lastCol)
|
||||
sorted = false;
|
||||
lastCol = col;
|
||||
if (hasMoreVlq(mappings, i, semi)) {
|
||||
i = decodeInteger(mappings, i, state, 1); // sourcesIndex
|
||||
i = decodeInteger(mappings, i, state, 2); // sourceLine
|
||||
i = decodeInteger(mappings, i, state, 3); // sourceColumn
|
||||
if (hasMoreVlq(mappings, i, semi)) {
|
||||
i = decodeInteger(mappings, i, state, 4); // namesIndex
|
||||
seg = [col, state[1], state[2], state[3], state[4]];
|
||||
}
|
||||
else {
|
||||
seg = [col, state[1], state[2], state[3]];
|
||||
}
|
||||
}
|
||||
else {
|
||||
seg = [col];
|
||||
}
|
||||
line.push(seg);
|
||||
}
|
||||
if (!sorted)
|
||||
sort(line);
|
||||
decoded.push(line);
|
||||
index = semi + 1;
|
||||
} while (index <= mappings.length);
|
||||
return decoded;
|
||||
}
|
||||
function indexOf(mappings, index) {
|
||||
const idx = mappings.indexOf(';', index);
|
||||
return idx === -1 ? mappings.length : idx;
|
||||
}
|
||||
function decodeInteger(mappings, pos, state, j) {
|
||||
let value = 0;
|
||||
let shift = 0;
|
||||
let integer = 0;
|
||||
do {
|
||||
const c = mappings.charCodeAt(pos++);
|
||||
integer = charToInt[c];
|
||||
value |= (integer & 31) << shift;
|
||||
shift += 5;
|
||||
} while (integer & 32);
|
||||
const shouldNegate = value & 1;
|
||||
value >>>= 1;
|
||||
if (shouldNegate) {
|
||||
value = -0x80000000 | -value;
|
||||
}
|
||||
state[j] += value;
|
||||
return pos;
|
||||
}
|
||||
function hasMoreVlq(mappings, i, length) {
|
||||
if (i >= length)
|
||||
return false;
|
||||
return mappings.charCodeAt(i) !== comma;
|
||||
}
|
||||
function sort(line) {
|
||||
line.sort(sortComparator);
|
||||
}
|
||||
function sortComparator(a, b) {
|
||||
return a[0] - b[0];
|
||||
}
|
||||
function encode(decoded) {
|
||||
const state = new Int32Array(5);
|
||||
const bufLength = 1024 * 16;
|
||||
const subLength = bufLength - 36;
|
||||
const buf = new Uint8Array(bufLength);
|
||||
const sub = buf.subarray(0, subLength);
|
||||
let pos = 0;
|
||||
let out = '';
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
const line = decoded[i];
|
||||
if (i > 0) {
|
||||
if (pos === bufLength) {
|
||||
out += td.decode(buf);
|
||||
pos = 0;
|
||||
}
|
||||
buf[pos++] = semicolon;
|
||||
}
|
||||
if (line.length === 0)
|
||||
continue;
|
||||
state[0] = 0;
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const segment = line[j];
|
||||
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
||||
// may push a comma.
|
||||
if (pos > subLength) {
|
||||
out += td.decode(sub);
|
||||
buf.copyWithin(0, subLength, pos);
|
||||
pos -= subLength;
|
||||
}
|
||||
if (j > 0)
|
||||
buf[pos++] = comma;
|
||||
pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
|
||||
if (segment.length === 1)
|
||||
continue;
|
||||
pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
|
||||
pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
|
||||
pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
|
||||
if (segment.length === 4)
|
||||
continue;
|
||||
pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
|
||||
}
|
||||
}
|
||||
return out + td.decode(buf.subarray(0, pos));
|
||||
}
|
||||
function encodeInteger(buf, pos, state, segment, j) {
|
||||
const next = segment[j];
|
||||
let num = next - state[j];
|
||||
state[j] = next;
|
||||
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
||||
do {
|
||||
let clamped = num & 0b011111;
|
||||
num >>>= 5;
|
||||
if (num > 0)
|
||||
clamped |= 0b100000;
|
||||
buf[pos++] = intToChar[clamped];
|
||||
} while (num > 0);
|
||||
return pos;
|
||||
}
|
||||
|
||||
exports.decode = decode;
|
||||
exports.encode = encode;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=sourcemap-codec.umd.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
@@ -3,3 +3,4 @@ export declare type SourceMapLine = SourceMapSegment[];
|
||||
export declare type SourceMapMappings = SourceMapLine[];
|
||||
export declare function decode(mappings: string): SourceMapMappings;
|
||||
export declare function encode(decoded: SourceMapMappings): string;
|
||||
export declare function encode(decoded: Readonly<SourceMapMappings>): string;
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"name": "@jridgewell/sourcemap-codec",
|
||||
"version": "1.4.15",
|
||||
"description": "Encode/decode sourcemap mappings",
|
||||
"keywords": [
|
||||
"sourcemap",
|
||||
"vlq"
|
||||
],
|
||||
"main": "dist/sourcemap-codec.umd.js",
|
||||
"module": "dist/sourcemap-codec.mjs",
|
||||
"types": "dist/types/sourcemap-codec.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"types": "./dist/types/sourcemap-codec.d.ts",
|
||||
"browser": "./dist/sourcemap-codec.umd.js",
|
||||
"require": "./dist/sourcemap-codec.umd.js",
|
||||
"import": "./dist/sourcemap-codec.mjs"
|
||||
},
|
||||
"./dist/sourcemap-codec.umd.js"
|
||||
],
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"benchmark": "run-s build:rollup benchmark:*",
|
||||
"benchmark:install": "cd benchmark && npm install",
|
||||
"benchmark:only": "node --expose-gc benchmark/index.js",
|
||||
"build": "run-s -n build:*",
|
||||
"build:rollup": "rollup -c rollup.config.js",
|
||||
"build:ts": "tsc --project tsconfig.build.json",
|
||||
"lint": "run-s -n lint:*",
|
||||
"lint:prettier": "npm run test:lint:prettier -- --write",
|
||||
"lint:ts": "npm run test:lint:ts -- --fix",
|
||||
"prebuild": "rm -rf dist",
|
||||
"prepublishOnly": "npm run preversion",
|
||||
"preversion": "run-s test build",
|
||||
"pretest": "run-s build:rollup",
|
||||
"test": "run-s -n test:lint test:only",
|
||||
"test:debug": "mocha --inspect-brk",
|
||||
"test:lint": "run-s -n test:lint:*",
|
||||
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
|
||||
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
||||
"test:only": "mocha",
|
||||
"test:coverage": "c8 mocha",
|
||||
"test:watch": "mocha --watch"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jridgewell/sourcemap-codec.git"
|
||||
},
|
||||
"author": "Rich Harris",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "8.3.0",
|
||||
"@types/node": "17.0.15",
|
||||
"@typescript-eslint/eslint-plugin": "5.10.0",
|
||||
"@typescript-eslint/parser": "5.10.0",
|
||||
"benchmark": "2.1.4",
|
||||
"c8": "7.11.2",
|
||||
"eslint": "8.7.0",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"mocha": "9.2.0",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "2.5.1",
|
||||
"rollup": "2.64.0",
|
||||
"source-map": "0.6.1",
|
||||
"source-map-js": "1.0.2",
|
||||
"sourcemap-codec": "1.4.8",
|
||||
"typescript": "4.5.4"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@rollup/rollup-win32-x64-msvc",
|
||||
"version": "4.9.1",
|
||||
"version": "4.9.5",
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
|
||||
BIN
Binary file not shown.
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
# Installation
|
||||
> `npm install --save @types/estree`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for estree (https://github.com/estree/estree).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Mon, 06 Nov 2023 22:41:05 GMT
|
||||
* Dependencies: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [RReverser](https://github.com/RReverser).
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
declare namespace ESTree {
|
||||
interface FlowTypeAnnotation extends Node {}
|
||||
|
||||
interface FlowBaseTypeAnnotation extends FlowTypeAnnotation {}
|
||||
|
||||
interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {}
|
||||
|
||||
interface FlowDeclaration extends Declaration {}
|
||||
|
||||
interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||
|
||||
interface ArrayTypeAnnotation extends FlowTypeAnnotation {
|
||||
elementType: FlowTypeAnnotation;
|
||||
}
|
||||
|
||||
interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
|
||||
|
||||
interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||
|
||||
interface ClassImplements extends Node {
|
||||
id: Identifier;
|
||||
typeParameters?: TypeParameterInstantiation | null;
|
||||
}
|
||||
|
||||
interface ClassProperty {
|
||||
key: Expression;
|
||||
value?: Expression | null;
|
||||
typeAnnotation?: TypeAnnotation | null;
|
||||
computed: boolean;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
interface DeclareClass extends FlowDeclaration {
|
||||
id: Identifier;
|
||||
typeParameters?: TypeParameterDeclaration | null;
|
||||
body: ObjectTypeAnnotation;
|
||||
extends: InterfaceExtends[];
|
||||
}
|
||||
|
||||
interface DeclareFunction extends FlowDeclaration {
|
||||
id: Identifier;
|
||||
}
|
||||
|
||||
interface DeclareModule extends FlowDeclaration {
|
||||
id: Literal | Identifier;
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
interface DeclareVariable extends FlowDeclaration {
|
||||
id: Identifier;
|
||||
}
|
||||
|
||||
interface FunctionTypeAnnotation extends FlowTypeAnnotation {
|
||||
params: FunctionTypeParam[];
|
||||
returnType: FlowTypeAnnotation;
|
||||
rest?: FunctionTypeParam | null;
|
||||
typeParameters?: TypeParameterDeclaration | null;
|
||||
}
|
||||
|
||||
interface FunctionTypeParam {
|
||||
name: Identifier;
|
||||
typeAnnotation: FlowTypeAnnotation;
|
||||
optional: boolean;
|
||||
}
|
||||
|
||||
interface GenericTypeAnnotation extends FlowTypeAnnotation {
|
||||
id: Identifier | QualifiedTypeIdentifier;
|
||||
typeParameters?: TypeParameterInstantiation | null;
|
||||
}
|
||||
|
||||
interface InterfaceExtends extends Node {
|
||||
id: Identifier | QualifiedTypeIdentifier;
|
||||
typeParameters?: TypeParameterInstantiation | null;
|
||||
}
|
||||
|
||||
interface InterfaceDeclaration extends FlowDeclaration {
|
||||
id: Identifier;
|
||||
typeParameters?: TypeParameterDeclaration | null;
|
||||
extends: InterfaceExtends[];
|
||||
body: ObjectTypeAnnotation;
|
||||
}
|
||||
|
||||
interface IntersectionTypeAnnotation extends FlowTypeAnnotation {
|
||||
types: FlowTypeAnnotation[];
|
||||
}
|
||||
|
||||
interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||
|
||||
interface NullableTypeAnnotation extends FlowTypeAnnotation {
|
||||
typeAnnotation: TypeAnnotation;
|
||||
}
|
||||
|
||||
interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
|
||||
|
||||
interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||
|
||||
interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
|
||||
|
||||
interface StringTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||
|
||||
interface TupleTypeAnnotation extends FlowTypeAnnotation {
|
||||
types: FlowTypeAnnotation[];
|
||||
}
|
||||
|
||||
interface TypeofTypeAnnotation extends FlowTypeAnnotation {
|
||||
argument: FlowTypeAnnotation;
|
||||
}
|
||||
|
||||
interface TypeAlias extends FlowDeclaration {
|
||||
id: Identifier;
|
||||
typeParameters?: TypeParameterDeclaration | null;
|
||||
right: FlowTypeAnnotation;
|
||||
}
|
||||
|
||||
interface TypeAnnotation extends Node {
|
||||
typeAnnotation: FlowTypeAnnotation;
|
||||
}
|
||||
|
||||
interface TypeCastExpression extends Expression {
|
||||
expression: Expression;
|
||||
typeAnnotation: TypeAnnotation;
|
||||
}
|
||||
|
||||
interface TypeParameterDeclaration extends Node {
|
||||
params: Identifier[];
|
||||
}
|
||||
|
||||
interface TypeParameterInstantiation extends Node {
|
||||
params: FlowTypeAnnotation[];
|
||||
}
|
||||
|
||||
interface ObjectTypeAnnotation extends FlowTypeAnnotation {
|
||||
properties: ObjectTypeProperty[];
|
||||
indexers: ObjectTypeIndexer[];
|
||||
callProperties: ObjectTypeCallProperty[];
|
||||
}
|
||||
|
||||
interface ObjectTypeCallProperty extends Node {
|
||||
value: FunctionTypeAnnotation;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
interface ObjectTypeIndexer extends Node {
|
||||
id: Identifier;
|
||||
key: FlowTypeAnnotation;
|
||||
value: FlowTypeAnnotation;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
interface ObjectTypeProperty extends Node {
|
||||
key: Expression;
|
||||
value: FlowTypeAnnotation;
|
||||
optional: boolean;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
interface QualifiedTypeIdentifier extends Node {
|
||||
qualification: Identifier | QualifiedTypeIdentifier;
|
||||
id: Identifier;
|
||||
}
|
||||
|
||||
interface UnionTypeAnnotation extends FlowTypeAnnotation {
|
||||
types: FlowTypeAnnotation[];
|
||||
}
|
||||
|
||||
interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||
}
|
||||
+683
@@ -0,0 +1,683 @@
|
||||
// This definition file follows a somewhat unusual format. ESTree allows
|
||||
// runtime type checks based on the `type` parameter. In order to explain this
|
||||
// to typescript we want to use discriminated union types:
|
||||
// https://github.com/Microsoft/TypeScript/pull/9163
|
||||
//
|
||||
// For ESTree this is a bit tricky because the high level interfaces like
|
||||
// Node or Function are pulling double duty. We want to pass common fields down
|
||||
// to the interfaces that extend them (like Identifier or
|
||||
// ArrowFunctionExpression), but you can't extend a type union or enforce
|
||||
// common fields on them. So we've split the high level interfaces into two
|
||||
// types, a base type which passes down inherited fields, and a type union of
|
||||
// all types which extend the base type. Only the type union is exported, and
|
||||
// the union is how other types refer to the collection of inheriting types.
|
||||
//
|
||||
// This makes the definitions file here somewhat more difficult to maintain,
|
||||
// but it has the notable advantage of making ESTree much easier to use as
|
||||
// an end user.
|
||||
|
||||
export interface BaseNodeWithoutComments {
|
||||
// Every leaf interface that extends BaseNode must specify a type property.
|
||||
// The type property should be a string literal. For example, Identifier
|
||||
// has: `type: "Identifier"`
|
||||
type: string;
|
||||
loc?: SourceLocation | null | undefined;
|
||||
range?: [number, number] | undefined;
|
||||
}
|
||||
|
||||
export interface BaseNode extends BaseNodeWithoutComments {
|
||||
leadingComments?: Comment[] | undefined;
|
||||
trailingComments?: Comment[] | undefined;
|
||||
}
|
||||
|
||||
export interface NodeMap {
|
||||
AssignmentProperty: AssignmentProperty;
|
||||
CatchClause: CatchClause;
|
||||
Class: Class;
|
||||
ClassBody: ClassBody;
|
||||
Expression: Expression;
|
||||
Function: Function;
|
||||
Identifier: Identifier;
|
||||
Literal: Literal;
|
||||
MethodDefinition: MethodDefinition;
|
||||
ModuleDeclaration: ModuleDeclaration;
|
||||
ModuleSpecifier: ModuleSpecifier;
|
||||
Pattern: Pattern;
|
||||
PrivateIdentifier: PrivateIdentifier;
|
||||
Program: Program;
|
||||
Property: Property;
|
||||
PropertyDefinition: PropertyDefinition;
|
||||
SpreadElement: SpreadElement;
|
||||
Statement: Statement;
|
||||
Super: Super;
|
||||
SwitchCase: SwitchCase;
|
||||
TemplateElement: TemplateElement;
|
||||
VariableDeclarator: VariableDeclarator;
|
||||
}
|
||||
|
||||
export type Node = NodeMap[keyof NodeMap];
|
||||
|
||||
export interface Comment extends BaseNodeWithoutComments {
|
||||
type: "Line" | "Block";
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface SourceLocation {
|
||||
source?: string | null | undefined;
|
||||
start: Position;
|
||||
end: Position;
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
/** >= 1 */
|
||||
line: number;
|
||||
/** >= 0 */
|
||||
column: number;
|
||||
}
|
||||
|
||||
export interface Program extends BaseNode {
|
||||
type: "Program";
|
||||
sourceType: "script" | "module";
|
||||
body: Array<Directive | Statement | ModuleDeclaration>;
|
||||
comments?: Comment[] | undefined;
|
||||
}
|
||||
|
||||
export interface Directive extends BaseNode {
|
||||
type: "ExpressionStatement";
|
||||
expression: Literal;
|
||||
directive: string;
|
||||
}
|
||||
|
||||
export interface BaseFunction extends BaseNode {
|
||||
params: Pattern[];
|
||||
generator?: boolean | undefined;
|
||||
async?: boolean | undefined;
|
||||
// The body is either BlockStatement or Expression because arrow functions
|
||||
// can have a body that's either. FunctionDeclarations and
|
||||
// FunctionExpressions have only BlockStatement bodies.
|
||||
body: BlockStatement | Expression;
|
||||
}
|
||||
|
||||
export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
||||
|
||||
export type Statement =
|
||||
| ExpressionStatement
|
||||
| BlockStatement
|
||||
| StaticBlock
|
||||
| EmptyStatement
|
||||
| DebuggerStatement
|
||||
| WithStatement
|
||||
| ReturnStatement
|
||||
| LabeledStatement
|
||||
| BreakStatement
|
||||
| ContinueStatement
|
||||
| IfStatement
|
||||
| SwitchStatement
|
||||
| ThrowStatement
|
||||
| TryStatement
|
||||
| WhileStatement
|
||||
| DoWhileStatement
|
||||
| ForStatement
|
||||
| ForInStatement
|
||||
| ForOfStatement
|
||||
| Declaration;
|
||||
|
||||
export interface BaseStatement extends BaseNode {}
|
||||
|
||||
export interface EmptyStatement extends BaseStatement {
|
||||
type: "EmptyStatement";
|
||||
}
|
||||
|
||||
export interface BlockStatement extends BaseStatement {
|
||||
type: "BlockStatement";
|
||||
body: Statement[];
|
||||
innerComments?: Comment[] | undefined;
|
||||
}
|
||||
|
||||
export interface StaticBlock extends Omit<BlockStatement, "type"> {
|
||||
type: "StaticBlock";
|
||||
}
|
||||
|
||||
export interface ExpressionStatement extends BaseStatement {
|
||||
type: "ExpressionStatement";
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
export interface IfStatement extends BaseStatement {
|
||||
type: "IfStatement";
|
||||
test: Expression;
|
||||
consequent: Statement;
|
||||
alternate?: Statement | null | undefined;
|
||||
}
|
||||
|
||||
export interface LabeledStatement extends BaseStatement {
|
||||
type: "LabeledStatement";
|
||||
label: Identifier;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface BreakStatement extends BaseStatement {
|
||||
type: "BreakStatement";
|
||||
label?: Identifier | null | undefined;
|
||||
}
|
||||
|
||||
export interface ContinueStatement extends BaseStatement {
|
||||
type: "ContinueStatement";
|
||||
label?: Identifier | null | undefined;
|
||||
}
|
||||
|
||||
export interface WithStatement extends BaseStatement {
|
||||
type: "WithStatement";
|
||||
object: Expression;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface SwitchStatement extends BaseStatement {
|
||||
type: "SwitchStatement";
|
||||
discriminant: Expression;
|
||||
cases: SwitchCase[];
|
||||
}
|
||||
|
||||
export interface ReturnStatement extends BaseStatement {
|
||||
type: "ReturnStatement";
|
||||
argument?: Expression | null | undefined;
|
||||
}
|
||||
|
||||
export interface ThrowStatement extends BaseStatement {
|
||||
type: "ThrowStatement";
|
||||
argument: Expression;
|
||||
}
|
||||
|
||||
export interface TryStatement extends BaseStatement {
|
||||
type: "TryStatement";
|
||||
block: BlockStatement;
|
||||
handler?: CatchClause | null | undefined;
|
||||
finalizer?: BlockStatement | null | undefined;
|
||||
}
|
||||
|
||||
export interface WhileStatement extends BaseStatement {
|
||||
type: "WhileStatement";
|
||||
test: Expression;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface DoWhileStatement extends BaseStatement {
|
||||
type: "DoWhileStatement";
|
||||
body: Statement;
|
||||
test: Expression;
|
||||
}
|
||||
|
||||
export interface ForStatement extends BaseStatement {
|
||||
type: "ForStatement";
|
||||
init?: VariableDeclaration | Expression | null | undefined;
|
||||
test?: Expression | null | undefined;
|
||||
update?: Expression | null | undefined;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface BaseForXStatement extends BaseStatement {
|
||||
left: VariableDeclaration | Pattern;
|
||||
right: Expression;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface ForInStatement extends BaseForXStatement {
|
||||
type: "ForInStatement";
|
||||
}
|
||||
|
||||
export interface DebuggerStatement extends BaseStatement {
|
||||
type: "DebuggerStatement";
|
||||
}
|
||||
|
||||
export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
||||
|
||||
export interface BaseDeclaration extends BaseStatement {}
|
||||
|
||||
export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
|
||||
type: "FunctionDeclaration";
|
||||
/** It is null when a function declaration is a part of the `export default function` statement */
|
||||
id: Identifier | null;
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
|
||||
id: Identifier;
|
||||
}
|
||||
|
||||
export interface VariableDeclaration extends BaseDeclaration {
|
||||
type: "VariableDeclaration";
|
||||
declarations: VariableDeclarator[];
|
||||
kind: "var" | "let" | "const";
|
||||
}
|
||||
|
||||
export interface VariableDeclarator extends BaseNode {
|
||||
type: "VariableDeclarator";
|
||||
id: Pattern;
|
||||
init?: Expression | null | undefined;
|
||||
}
|
||||
|
||||
export interface ExpressionMap {
|
||||
ArrayExpression: ArrayExpression;
|
||||
ArrowFunctionExpression: ArrowFunctionExpression;
|
||||
AssignmentExpression: AssignmentExpression;
|
||||
AwaitExpression: AwaitExpression;
|
||||
BinaryExpression: BinaryExpression;
|
||||
CallExpression: CallExpression;
|
||||
ChainExpression: ChainExpression;
|
||||
ClassExpression: ClassExpression;
|
||||
ConditionalExpression: ConditionalExpression;
|
||||
FunctionExpression: FunctionExpression;
|
||||
Identifier: Identifier;
|
||||
ImportExpression: ImportExpression;
|
||||
Literal: Literal;
|
||||
LogicalExpression: LogicalExpression;
|
||||
MemberExpression: MemberExpression;
|
||||
MetaProperty: MetaProperty;
|
||||
NewExpression: NewExpression;
|
||||
ObjectExpression: ObjectExpression;
|
||||
SequenceExpression: SequenceExpression;
|
||||
TaggedTemplateExpression: TaggedTemplateExpression;
|
||||
TemplateLiteral: TemplateLiteral;
|
||||
ThisExpression: ThisExpression;
|
||||
UnaryExpression: UnaryExpression;
|
||||
UpdateExpression: UpdateExpression;
|
||||
YieldExpression: YieldExpression;
|
||||
}
|
||||
|
||||
export type Expression = ExpressionMap[keyof ExpressionMap];
|
||||
|
||||
export interface BaseExpression extends BaseNode {}
|
||||
|
||||
export type ChainElement = SimpleCallExpression | MemberExpression;
|
||||
|
||||
export interface ChainExpression extends BaseExpression {
|
||||
type: "ChainExpression";
|
||||
expression: ChainElement;
|
||||
}
|
||||
|
||||
export interface ThisExpression extends BaseExpression {
|
||||
type: "ThisExpression";
|
||||
}
|
||||
|
||||
export interface ArrayExpression extends BaseExpression {
|
||||
type: "ArrayExpression";
|
||||
elements: Array<Expression | SpreadElement | null>;
|
||||
}
|
||||
|
||||
export interface ObjectExpression extends BaseExpression {
|
||||
type: "ObjectExpression";
|
||||
properties: Array<Property | SpreadElement>;
|
||||
}
|
||||
|
||||
export interface PrivateIdentifier extends BaseNode {
|
||||
type: "PrivateIdentifier";
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Property extends BaseNode {
|
||||
type: "Property";
|
||||
key: Expression | PrivateIdentifier;
|
||||
value: Expression | Pattern; // Could be an AssignmentProperty
|
||||
kind: "init" | "get" | "set";
|
||||
method: boolean;
|
||||
shorthand: boolean;
|
||||
computed: boolean;
|
||||
}
|
||||
|
||||
export interface PropertyDefinition extends BaseNode {
|
||||
type: "PropertyDefinition";
|
||||
key: Expression | PrivateIdentifier;
|
||||
value?: Expression | null | undefined;
|
||||
computed: boolean;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
export interface FunctionExpression extends BaseFunction, BaseExpression {
|
||||
id?: Identifier | null | undefined;
|
||||
type: "FunctionExpression";
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
export interface SequenceExpression extends BaseExpression {
|
||||
type: "SequenceExpression";
|
||||
expressions: Expression[];
|
||||
}
|
||||
|
||||
export interface UnaryExpression extends BaseExpression {
|
||||
type: "UnaryExpression";
|
||||
operator: UnaryOperator;
|
||||
prefix: true;
|
||||
argument: Expression;
|
||||
}
|
||||
|
||||
export interface BinaryExpression extends BaseExpression {
|
||||
type: "BinaryExpression";
|
||||
operator: BinaryOperator;
|
||||
left: Expression;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export interface AssignmentExpression extends BaseExpression {
|
||||
type: "AssignmentExpression";
|
||||
operator: AssignmentOperator;
|
||||
left: Pattern | MemberExpression;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export interface UpdateExpression extends BaseExpression {
|
||||
type: "UpdateExpression";
|
||||
operator: UpdateOperator;
|
||||
argument: Expression;
|
||||
prefix: boolean;
|
||||
}
|
||||
|
||||
export interface LogicalExpression extends BaseExpression {
|
||||
type: "LogicalExpression";
|
||||
operator: LogicalOperator;
|
||||
left: Expression;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export interface ConditionalExpression extends BaseExpression {
|
||||
type: "ConditionalExpression";
|
||||
test: Expression;
|
||||
alternate: Expression;
|
||||
consequent: Expression;
|
||||
}
|
||||
|
||||
export interface BaseCallExpression extends BaseExpression {
|
||||
callee: Expression | Super;
|
||||
arguments: Array<Expression | SpreadElement>;
|
||||
}
|
||||
export type CallExpression = SimpleCallExpression | NewExpression;
|
||||
|
||||
export interface SimpleCallExpression extends BaseCallExpression {
|
||||
type: "CallExpression";
|
||||
optional: boolean;
|
||||
}
|
||||
|
||||
export interface NewExpression extends BaseCallExpression {
|
||||
type: "NewExpression";
|
||||
}
|
||||
|
||||
export interface MemberExpression extends BaseExpression, BasePattern {
|
||||
type: "MemberExpression";
|
||||
object: Expression | Super;
|
||||
property: Expression | PrivateIdentifier;
|
||||
computed: boolean;
|
||||
optional: boolean;
|
||||
}
|
||||
|
||||
export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
|
||||
|
||||
export interface BasePattern extends BaseNode {}
|
||||
|
||||
export interface SwitchCase extends BaseNode {
|
||||
type: "SwitchCase";
|
||||
test?: Expression | null | undefined;
|
||||
consequent: Statement[];
|
||||
}
|
||||
|
||||
export interface CatchClause extends BaseNode {
|
||||
type: "CatchClause";
|
||||
param: Pattern | null;
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
export interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
||||
type: "Identifier";
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
||||
|
||||
export interface SimpleLiteral extends BaseNode, BaseExpression {
|
||||
type: "Literal";
|
||||
value: string | boolean | number | null;
|
||||
raw?: string | undefined;
|
||||
}
|
||||
|
||||
export interface RegExpLiteral extends BaseNode, BaseExpression {
|
||||
type: "Literal";
|
||||
value?: RegExp | null | undefined;
|
||||
regex: {
|
||||
pattern: string;
|
||||
flags: string;
|
||||
};
|
||||
raw?: string | undefined;
|
||||
}
|
||||
|
||||
export interface BigIntLiteral extends BaseNode, BaseExpression {
|
||||
type: "Literal";
|
||||
value?: bigint | null | undefined;
|
||||
bigint: string;
|
||||
raw?: string | undefined;
|
||||
}
|
||||
|
||||
export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
||||
|
||||
export type BinaryOperator =
|
||||
| "=="
|
||||
| "!="
|
||||
| "==="
|
||||
| "!=="
|
||||
| "<"
|
||||
| "<="
|
||||
| ">"
|
||||
| ">="
|
||||
| "<<"
|
||||
| ">>"
|
||||
| ">>>"
|
||||
| "+"
|
||||
| "-"
|
||||
| "*"
|
||||
| "/"
|
||||
| "%"
|
||||
| "**"
|
||||
| "|"
|
||||
| "^"
|
||||
| "&"
|
||||
| "in"
|
||||
| "instanceof";
|
||||
|
||||
export type LogicalOperator = "||" | "&&" | "??";
|
||||
|
||||
export type AssignmentOperator =
|
||||
| "="
|
||||
| "+="
|
||||
| "-="
|
||||
| "*="
|
||||
| "/="
|
||||
| "%="
|
||||
| "**="
|
||||
| "<<="
|
||||
| ">>="
|
||||
| ">>>="
|
||||
| "|="
|
||||
| "^="
|
||||
| "&="
|
||||
| "||="
|
||||
| "&&="
|
||||
| "??=";
|
||||
|
||||
export type UpdateOperator = "++" | "--";
|
||||
|
||||
export interface ForOfStatement extends BaseForXStatement {
|
||||
type: "ForOfStatement";
|
||||
await: boolean;
|
||||
}
|
||||
|
||||
export interface Super extends BaseNode {
|
||||
type: "Super";
|
||||
}
|
||||
|
||||
export interface SpreadElement extends BaseNode {
|
||||
type: "SpreadElement";
|
||||
argument: Expression;
|
||||
}
|
||||
|
||||
export interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
||||
type: "ArrowFunctionExpression";
|
||||
expression: boolean;
|
||||
body: BlockStatement | Expression;
|
||||
}
|
||||
|
||||
export interface YieldExpression extends BaseExpression {
|
||||
type: "YieldExpression";
|
||||
argument?: Expression | null | undefined;
|
||||
delegate: boolean;
|
||||
}
|
||||
|
||||
export interface TemplateLiteral extends BaseExpression {
|
||||
type: "TemplateLiteral";
|
||||
quasis: TemplateElement[];
|
||||
expressions: Expression[];
|
||||
}
|
||||
|
||||
export interface TaggedTemplateExpression extends BaseExpression {
|
||||
type: "TaggedTemplateExpression";
|
||||
tag: Expression;
|
||||
quasi: TemplateLiteral;
|
||||
}
|
||||
|
||||
export interface TemplateElement extends BaseNode {
|
||||
type: "TemplateElement";
|
||||
tail: boolean;
|
||||
value: {
|
||||
/** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */
|
||||
cooked?: string | null | undefined;
|
||||
raw: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AssignmentProperty extends Property {
|
||||
value: Pattern;
|
||||
kind: "init";
|
||||
method: boolean; // false
|
||||
}
|
||||
|
||||
export interface ObjectPattern extends BasePattern {
|
||||
type: "ObjectPattern";
|
||||
properties: Array<AssignmentProperty | RestElement>;
|
||||
}
|
||||
|
||||
export interface ArrayPattern extends BasePattern {
|
||||
type: "ArrayPattern";
|
||||
elements: Array<Pattern | null>;
|
||||
}
|
||||
|
||||
export interface RestElement extends BasePattern {
|
||||
type: "RestElement";
|
||||
argument: Pattern;
|
||||
}
|
||||
|
||||
export interface AssignmentPattern extends BasePattern {
|
||||
type: "AssignmentPattern";
|
||||
left: Pattern;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export type Class = ClassDeclaration | ClassExpression;
|
||||
export interface BaseClass extends BaseNode {
|
||||
superClass?: Expression | null | undefined;
|
||||
body: ClassBody;
|
||||
}
|
||||
|
||||
export interface ClassBody extends BaseNode {
|
||||
type: "ClassBody";
|
||||
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>;
|
||||
}
|
||||
|
||||
export interface MethodDefinition extends BaseNode {
|
||||
type: "MethodDefinition";
|
||||
key: Expression | PrivateIdentifier;
|
||||
value: FunctionExpression;
|
||||
kind: "constructor" | "method" | "get" | "set";
|
||||
computed: boolean;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
|
||||
type: "ClassDeclaration";
|
||||
/** It is null when a class declaration is a part of the `export default class` statement */
|
||||
id: Identifier | null;
|
||||
}
|
||||
|
||||
export interface ClassDeclaration extends MaybeNamedClassDeclaration {
|
||||
id: Identifier;
|
||||
}
|
||||
|
||||
export interface ClassExpression extends BaseClass, BaseExpression {
|
||||
type: "ClassExpression";
|
||||
id?: Identifier | null | undefined;
|
||||
}
|
||||
|
||||
export interface MetaProperty extends BaseExpression {
|
||||
type: "MetaProperty";
|
||||
meta: Identifier;
|
||||
property: Identifier;
|
||||
}
|
||||
|
||||
export type ModuleDeclaration =
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportDefaultDeclaration
|
||||
| ExportAllDeclaration;
|
||||
export interface BaseModuleDeclaration extends BaseNode {}
|
||||
|
||||
export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier;
|
||||
export interface BaseModuleSpecifier extends BaseNode {
|
||||
local: Identifier;
|
||||
}
|
||||
|
||||
export interface ImportDeclaration extends BaseModuleDeclaration {
|
||||
type: "ImportDeclaration";
|
||||
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
||||
source: Literal;
|
||||
}
|
||||
|
||||
export interface ImportSpecifier extends BaseModuleSpecifier {
|
||||
type: "ImportSpecifier";
|
||||
imported: Identifier;
|
||||
}
|
||||
|
||||
export interface ImportExpression extends BaseExpression {
|
||||
type: "ImportExpression";
|
||||
source: Expression;
|
||||
}
|
||||
|
||||
export interface ImportDefaultSpecifier extends BaseModuleSpecifier {
|
||||
type: "ImportDefaultSpecifier";
|
||||
}
|
||||
|
||||
export interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
||||
type: "ImportNamespaceSpecifier";
|
||||
}
|
||||
|
||||
export interface ExportNamedDeclaration extends BaseModuleDeclaration {
|
||||
type: "ExportNamedDeclaration";
|
||||
declaration?: Declaration | null | undefined;
|
||||
specifiers: ExportSpecifier[];
|
||||
source?: Literal | null | undefined;
|
||||
}
|
||||
|
||||
export interface ExportSpecifier extends BaseModuleSpecifier {
|
||||
type: "ExportSpecifier";
|
||||
exported: Identifier;
|
||||
}
|
||||
|
||||
export interface ExportDefaultDeclaration extends BaseModuleDeclaration {
|
||||
type: "ExportDefaultDeclaration";
|
||||
declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression;
|
||||
}
|
||||
|
||||
export interface ExportAllDeclaration extends BaseModuleDeclaration {
|
||||
type: "ExportAllDeclaration";
|
||||
exported: Identifier | null;
|
||||
source: Literal;
|
||||
}
|
||||
|
||||
export interface AwaitExpression extends BaseExpression {
|
||||
type: "AwaitExpression";
|
||||
argument: Expression;
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "@types/estree",
|
||||
"version": "1.0.5",
|
||||
"description": "TypeScript definitions for estree",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "RReverser",
|
||||
"githubUsername": "RReverser",
|
||||
"url": "https://github.com/RReverser"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/estree"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "6f0eeaffe488ce594e73f8df619c677d752a279b51edbc744e4aebb20db4b3a7",
|
||||
"typeScriptVersion": "4.5",
|
||||
"nonNpm": true
|
||||
}
|
||||
+27
-11
@@ -19,7 +19,7 @@ const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
||||
const require$$0__default = /*#__PURE__*/_interopDefaultCompat(require$$0);
|
||||
const require$$1__default = /*#__PURE__*/_interopDefaultCompat(require$$1);
|
||||
|
||||
const version = "5.0.0";
|
||||
const version = "5.0.3";
|
||||
|
||||
function resolveCompiler(root) {
|
||||
const compiler = tryResolveCompiler(root) || tryResolveCompiler();
|
||||
@@ -82,10 +82,11 @@ function slash(path) {
|
||||
const cache = /* @__PURE__ */ new Map();
|
||||
const hmrCache = /* @__PURE__ */ new Map();
|
||||
const prevCache = /* @__PURE__ */ new Map();
|
||||
function createDescriptor(filename, source, { root, isProduction, sourceMap, compiler }, hmr = false) {
|
||||
function createDescriptor(filename, source, { root, isProduction, sourceMap, compiler, template }, hmr = false) {
|
||||
const { descriptor, errors } = compiler.parse(source, {
|
||||
filename,
|
||||
sourceMap
|
||||
sourceMap,
|
||||
templateParseOptions: template?.compilerOptions
|
||||
});
|
||||
const normalizedPath = slash(path__default.normalize(path__default.relative(root, filename)));
|
||||
descriptor.id = getHash(normalizedPath + (isProduction ? source : ""));
|
||||
@@ -283,8 +284,7 @@ function resolveTemplateCompilerOptions(descriptor, options, ssr) {
|
||||
return {
|
||||
...options.template,
|
||||
id,
|
||||
// @ts-ignore TODO remove ignore when dep is updated to 3.4
|
||||
ast: descriptor.template?.ast,
|
||||
ast: canReuseAST(options.compiler.version) ? descriptor.template?.ast : void 0,
|
||||
filename,
|
||||
scoped: hasScoped,
|
||||
slotted: descriptor.slotted,
|
||||
@@ -304,6 +304,15 @@ function resolveTemplateCompilerOptions(descriptor, options, ssr) {
|
||||
}
|
||||
};
|
||||
}
|
||||
function canReuseAST(version) {
|
||||
if (version) {
|
||||
const [_, minor, patch] = version.split(".").map(Number);
|
||||
if (minor >= 4 && patch >= 3) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const clientCache = /* @__PURE__ */ new WeakMap();
|
||||
const ssrCache = /* @__PURE__ */ new WeakMap();
|
||||
@@ -2145,7 +2154,7 @@ const _debug = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
|
||||
|
||||
const debug = _debug("vite:hmr");
|
||||
const directRequestRE = /(?:\?|&)direct\b/;
|
||||
async function handleHotUpdate({ file, modules, read }, options) {
|
||||
async function handleHotUpdate({ file, modules, read }, options, customElement) {
|
||||
const prevDescriptor = getDescriptor(file, options, false, true);
|
||||
if (!prevDescriptor) {
|
||||
return;
|
||||
@@ -2156,7 +2165,7 @@ async function handleHotUpdate({ file, modules, read }, options) {
|
||||
const affectedModules = /* @__PURE__ */ new Set();
|
||||
const mainModule = getMainModule(modules);
|
||||
const templateModule = modules.find((m) => /type=template/.test(m.url));
|
||||
resolveScript(descriptor, options, false);
|
||||
resolveScript(descriptor, options, false, customElement);
|
||||
const scriptChanged = hasScriptChanged(prevDescriptor, descriptor);
|
||||
if (scriptChanged) {
|
||||
affectedModules.add(getScriptModule(modules) || mainModule);
|
||||
@@ -2267,11 +2276,11 @@ function isEqualBlock(a, b) {
|
||||
function isOnlyTemplateChanged(prev, next) {
|
||||
return !hasScriptChanged(prev, next) && prev.styles.length === next.styles.length && prev.styles.every((s, i) => isEqualBlock(s, next.styles[i])) && prev.customBlocks.length === next.customBlocks.length && prev.customBlocks.every((s, i) => isEqualBlock(s, next.customBlocks[i]));
|
||||
}
|
||||
function deepEqual(obj1, obj2, excludeProps = []) {
|
||||
function deepEqual(obj1, obj2, excludeProps = [], deepParentsOfObj1 = []) {
|
||||
if (typeof obj1 !== typeof obj2) {
|
||||
return false;
|
||||
}
|
||||
if (obj1 == null || obj2 == null || typeof obj1 !== "object") {
|
||||
if (obj1 == null || obj2 == null || typeof obj1 !== "object" || deepParentsOfObj1.includes(obj1)) {
|
||||
return obj1 === obj2;
|
||||
}
|
||||
const keys1 = Object.keys(obj1);
|
||||
@@ -2283,7 +2292,10 @@ function deepEqual(obj1, obj2, excludeProps = []) {
|
||||
if (excludeProps.includes(key)) {
|
||||
continue;
|
||||
}
|
||||
if (!deepEqual(obj1[key], obj2[key], excludeProps)) {
|
||||
if (!deepEqual(obj1[key], obj2[key], excludeProps, [
|
||||
...deepParentsOfObj1,
|
||||
obj1
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2816,7 +2828,11 @@ function vuePlugin(rawOptions = {}) {
|
||||
return handleTypeDepChange(typeDepToSFCMap.get(ctx.file), ctx);
|
||||
}
|
||||
if (filter.value(ctx.file)) {
|
||||
return handleHotUpdate(ctx, options.value);
|
||||
return handleHotUpdate(
|
||||
ctx,
|
||||
options.value,
|
||||
customElementFilter.value(ctx.file)
|
||||
);
|
||||
}
|
||||
},
|
||||
config(config) {
|
||||
|
||||
+27
-11
@@ -7,7 +7,7 @@ import { createHash } from 'node:crypto';
|
||||
import require$$0 from 'tty';
|
||||
import require$$1 from 'util';
|
||||
|
||||
const version = "5.0.0";
|
||||
const version = "5.0.3";
|
||||
|
||||
function resolveCompiler(root) {
|
||||
const compiler = tryResolveCompiler(root) || tryResolveCompiler();
|
||||
@@ -70,10 +70,11 @@ function slash(path) {
|
||||
const cache = /* @__PURE__ */ new Map();
|
||||
const hmrCache = /* @__PURE__ */ new Map();
|
||||
const prevCache = /* @__PURE__ */ new Map();
|
||||
function createDescriptor(filename, source, { root, isProduction, sourceMap, compiler }, hmr = false) {
|
||||
function createDescriptor(filename, source, { root, isProduction, sourceMap, compiler, template }, hmr = false) {
|
||||
const { descriptor, errors } = compiler.parse(source, {
|
||||
filename,
|
||||
sourceMap
|
||||
sourceMap,
|
||||
templateParseOptions: template?.compilerOptions
|
||||
});
|
||||
const normalizedPath = slash(path.normalize(path.relative(root, filename)));
|
||||
descriptor.id = getHash(normalizedPath + (isProduction ? source : ""));
|
||||
@@ -271,8 +272,7 @@ function resolveTemplateCompilerOptions(descriptor, options, ssr) {
|
||||
return {
|
||||
...options.template,
|
||||
id,
|
||||
// @ts-ignore TODO remove ignore when dep is updated to 3.4
|
||||
ast: descriptor.template?.ast,
|
||||
ast: canReuseAST(options.compiler.version) ? descriptor.template?.ast : void 0,
|
||||
filename,
|
||||
scoped: hasScoped,
|
||||
slotted: descriptor.slotted,
|
||||
@@ -292,6 +292,15 @@ function resolveTemplateCompilerOptions(descriptor, options, ssr) {
|
||||
}
|
||||
};
|
||||
}
|
||||
function canReuseAST(version) {
|
||||
if (version) {
|
||||
const [_, minor, patch] = version.split(".").map(Number);
|
||||
if (minor >= 4 && patch >= 3) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const clientCache = /* @__PURE__ */ new WeakMap();
|
||||
const ssrCache = /* @__PURE__ */ new WeakMap();
|
||||
@@ -2133,7 +2142,7 @@ const _debug = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
|
||||
|
||||
const debug = _debug("vite:hmr");
|
||||
const directRequestRE = /(?:\?|&)direct\b/;
|
||||
async function handleHotUpdate({ file, modules, read }, options) {
|
||||
async function handleHotUpdate({ file, modules, read }, options, customElement) {
|
||||
const prevDescriptor = getDescriptor(file, options, false, true);
|
||||
if (!prevDescriptor) {
|
||||
return;
|
||||
@@ -2144,7 +2153,7 @@ async function handleHotUpdate({ file, modules, read }, options) {
|
||||
const affectedModules = /* @__PURE__ */ new Set();
|
||||
const mainModule = getMainModule(modules);
|
||||
const templateModule = modules.find((m) => /type=template/.test(m.url));
|
||||
resolveScript(descriptor, options, false);
|
||||
resolveScript(descriptor, options, false, customElement);
|
||||
const scriptChanged = hasScriptChanged(prevDescriptor, descriptor);
|
||||
if (scriptChanged) {
|
||||
affectedModules.add(getScriptModule(modules) || mainModule);
|
||||
@@ -2255,11 +2264,11 @@ function isEqualBlock(a, b) {
|
||||
function isOnlyTemplateChanged(prev, next) {
|
||||
return !hasScriptChanged(prev, next) && prev.styles.length === next.styles.length && prev.styles.every((s, i) => isEqualBlock(s, next.styles[i])) && prev.customBlocks.length === next.customBlocks.length && prev.customBlocks.every((s, i) => isEqualBlock(s, next.customBlocks[i]));
|
||||
}
|
||||
function deepEqual(obj1, obj2, excludeProps = []) {
|
||||
function deepEqual(obj1, obj2, excludeProps = [], deepParentsOfObj1 = []) {
|
||||
if (typeof obj1 !== typeof obj2) {
|
||||
return false;
|
||||
}
|
||||
if (obj1 == null || obj2 == null || typeof obj1 !== "object") {
|
||||
if (obj1 == null || obj2 == null || typeof obj1 !== "object" || deepParentsOfObj1.includes(obj1)) {
|
||||
return obj1 === obj2;
|
||||
}
|
||||
const keys1 = Object.keys(obj1);
|
||||
@@ -2271,7 +2280,10 @@ function deepEqual(obj1, obj2, excludeProps = []) {
|
||||
if (excludeProps.includes(key)) {
|
||||
continue;
|
||||
}
|
||||
if (!deepEqual(obj1[key], obj2[key], excludeProps)) {
|
||||
if (!deepEqual(obj1[key], obj2[key], excludeProps, [
|
||||
...deepParentsOfObj1,
|
||||
obj1
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2804,7 +2816,11 @@ function vuePlugin(rawOptions = {}) {
|
||||
return handleTypeDepChange(typeDepToSFCMap.get(ctx.file), ctx);
|
||||
}
|
||||
if (filter.value(ctx.file)) {
|
||||
return handleHotUpdate(ctx, options.value);
|
||||
return handleHotUpdate(
|
||||
ctx,
|
||||
options.value,
|
||||
customElementFilter.value(ctx.file)
|
||||
);
|
||||
}
|
||||
},
|
||||
config(config) {
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vitejs/plugin-vue",
|
||||
"version": "5.0.0",
|
||||
"version": "5.0.3",
|
||||
"license": "MIT",
|
||||
"author": "Evan You",
|
||||
"files": [
|
||||
@@ -35,11 +35,11 @@
|
||||
"@jridgewell/gen-mapping": "^0.3.3",
|
||||
"@jridgewell/trace-mapping": "^0.3.20",
|
||||
"debug": "^4.3.4",
|
||||
"rollup": "^4.6.1",
|
||||
"rollup": "^4.9.2",
|
||||
"slash": "^5.1.0",
|
||||
"source-map-js": "^1.0.2",
|
||||
"vite": "^5.0.6",
|
||||
"vue": "^3.3.10"
|
||||
"vite": "^5.0.10",
|
||||
"vue": "^3.4.5"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "unbuild --stub",
|
||||
|
||||
+5980
-5186
File diff suppressed because it is too large
Load Diff
+5860
-5060
File diff suppressed because it is too large
Load Diff
+743
-908
File diff suppressed because it is too large
Load Diff
+5252
-4452
File diff suppressed because it is too large
Load Diff
+21
-6
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/compiler-core",
|
||||
"version": "3.2.36",
|
||||
"version": "3.4.15",
|
||||
"description": "@vue/compiler-core",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-core.esm-bundler.js",
|
||||
@@ -9,6 +9,20 @@
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/compiler-core.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/compiler-core.cjs.prod.js",
|
||||
"development": "./dist/compiler-core.cjs.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"module": "./dist/compiler-core.esm-bundler.js",
|
||||
"import": "./dist/compiler-core.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerCore",
|
||||
"compat": true,
|
||||
@@ -32,12 +46,13 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36",
|
||||
"@babel/parser": "^7.16.4",
|
||||
"@babel/parser": "^7.23.6",
|
||||
"entities": "^4.5.0",
|
||||
"estree-walker": "^2.0.2",
|
||||
"source-map": "^0.6.1"
|
||||
"source-map-js": "^1.0.2",
|
||||
"@vue/shared": "3.4.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/types": "^7.16.0"
|
||||
"@babel/types": "^7.23.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
+609
-3018
File diff suppressed because it is too large
Load Diff
+546
-2963
File diff suppressed because it is too large
Load Diff
+36
-57
@@ -1,66 +1,45 @@
|
||||
import { CodegenResult } from '@vue/compiler-core';
|
||||
import { CompilerError } from '@vue/compiler-core';
|
||||
import { CompilerOptions } from '@vue/compiler-core';
|
||||
import { DirectiveTransform } from '@vue/compiler-core';
|
||||
import { NodeTransform } from '@vue/compiler-core';
|
||||
import { ParserOptions } from '@vue/compiler-core';
|
||||
import { RootNode } from '@vue/compiler-core';
|
||||
import { SourceLocation } from '@vue/compiler-core';
|
||||
|
||||
export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
|
||||
|
||||
export declare function createDOMCompilerError(code: DOMErrorCodes, loc?: SourceLocation): DOMCompilerError;
|
||||
|
||||
declare interface DOMCompilerError extends CompilerError {
|
||||
code: DOMErrorCodes;
|
||||
}
|
||||
|
||||
export declare const DOMDirectiveTransforms: Record<string, DirectiveTransform>;
|
||||
|
||||
export declare const enum DOMErrorCodes {
|
||||
X_V_HTML_NO_EXPRESSION = 50,
|
||||
X_V_HTML_WITH_CHILDREN = 51,
|
||||
X_V_TEXT_NO_EXPRESSION = 52,
|
||||
X_V_TEXT_WITH_CHILDREN = 53,
|
||||
X_V_MODEL_ON_INVALID_ELEMENT = 54,
|
||||
X_V_MODEL_ARG_ON_ELEMENT = 55,
|
||||
X_V_MODEL_ON_FILE_INPUT_ELEMENT = 56,
|
||||
X_V_MODEL_UNNECESSARY_VALUE = 57,
|
||||
X_V_SHOW_NO_EXPRESSION = 58,
|
||||
X_TRANSITION_INVALID_CHILDREN = 59,
|
||||
X_IGNORED_SIDE_EFFECT_TAG = 60,
|
||||
__EXTEND_POINT__ = 61
|
||||
}
|
||||
|
||||
export declare const DOMNodeTransforms: NodeTransform[];
|
||||
|
||||
export declare function parse(template: string, options?: ParserOptions): RootNode;
|
||||
import { ParserOptions, NodeTransform, SourceLocation, CompilerError, DirectiveTransform, RootNode, CompilerOptions, CodegenResult } from '@vue/compiler-core';
|
||||
export * from '@vue/compiler-core';
|
||||
|
||||
export declare const parserOptions: ParserOptions;
|
||||
|
||||
export declare const transformStyle: NodeTransform;
|
||||
|
||||
export declare const V_MODEL_RADIO: unique symbol;
|
||||
export declare const V_MODEL_CHECKBOX: unique symbol;
|
||||
export declare const V_MODEL_TEXT: unique symbol;
|
||||
export declare const V_MODEL_SELECT: unique symbol;
|
||||
export declare const V_MODEL_DYNAMIC: unique symbol;
|
||||
export declare const V_ON_WITH_MODIFIERS: unique symbol;
|
||||
export declare const V_ON_WITH_KEYS: unique symbol;
|
||||
export declare const V_SHOW: unique symbol;
|
||||
export declare const TRANSITION: unique symbol;
|
||||
|
||||
export declare const TRANSITION_GROUP: unique symbol;
|
||||
|
||||
export declare const V_MODEL_CHECKBOX: unique symbol;
|
||||
export declare const transformStyle: NodeTransform;
|
||||
|
||||
export declare const V_MODEL_DYNAMIC: unique symbol;
|
||||
interface DOMCompilerError extends CompilerError {
|
||||
code: DOMErrorCodes;
|
||||
}
|
||||
export declare function createDOMCompilerError(code: DOMErrorCodes, loc?: SourceLocation): DOMCompilerError;
|
||||
export declare enum DOMErrorCodes {
|
||||
X_V_HTML_NO_EXPRESSION = 53,
|
||||
X_V_HTML_WITH_CHILDREN = 54,
|
||||
X_V_TEXT_NO_EXPRESSION = 55,
|
||||
X_V_TEXT_WITH_CHILDREN = 56,
|
||||
X_V_MODEL_ON_INVALID_ELEMENT = 57,
|
||||
X_V_MODEL_ARG_ON_ELEMENT = 58,
|
||||
X_V_MODEL_ON_FILE_INPUT_ELEMENT = 59,
|
||||
X_V_MODEL_UNNECESSARY_VALUE = 60,
|
||||
X_V_SHOW_NO_EXPRESSION = 61,
|
||||
X_TRANSITION_INVALID_CHILDREN = 62,
|
||||
X_IGNORED_SIDE_EFFECT_TAG = 63,
|
||||
__EXTEND_POINT__ = 64
|
||||
}
|
||||
export declare const DOMErrorMessages: {
|
||||
[code: number]: string;
|
||||
};
|
||||
|
||||
export declare const V_MODEL_RADIO: unique symbol;
|
||||
export declare const DOMNodeTransforms: NodeTransform[];
|
||||
export declare const DOMDirectiveTransforms: Record<string, DirectiveTransform>;
|
||||
export declare function compile(src: string | RootNode, options?: CompilerOptions): CodegenResult;
|
||||
export declare function parse(template: string, options?: ParserOptions): RootNode;
|
||||
|
||||
export declare const V_MODEL_SELECT: unique symbol;
|
||||
|
||||
export declare const V_MODEL_TEXT: unique symbol;
|
||||
|
||||
export declare const V_ON_WITH_KEYS: unique symbol;
|
||||
|
||||
export declare const V_ON_WITH_MODIFIERS: unique symbol;
|
||||
|
||||
export declare const V_SHOW: unique symbol;
|
||||
|
||||
|
||||
export * from "@vue/compiler-core";
|
||||
|
||||
export { }
|
||||
|
||||
+5746
-4960
File diff suppressed because it is too large
Load Diff
+6
-1
File diff suppressed because one or more lines are too long
+443
-420
@@ -1,483 +1,506 @@
|
||||
import { registerRuntimeHelpers, isBuiltInType, createSimpleExpression, createCompilerError, createObjectProperty, getConstantType, createCallExpression, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyVBind, transformOn as transformOn$1, createCompoundExpression, isStaticExp, checkCompatEnabled, noopDirectiveTransform, baseCompile, baseParse } from '@vue/compiler-core';
|
||||
/**
|
||||
* @vue/compiler-dom v3.4.15
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
import { registerRuntimeHelpers, createSimpleExpression, createCompilerError, createObjectProperty, getConstantType, createCallExpression, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyVBind, findDir, isStaticArgOf, transformOn as transformOn$1, isStaticExp, createCompoundExpression, checkCompatEnabled, noopDirectiveTransform, baseCompile, baseParse } from '@vue/compiler-core';
|
||||
export * from '@vue/compiler-core';
|
||||
import { isVoidTag, isHTMLTag, isSVGTag, makeMap, parseStringStyle, capitalize, extend } from '@vue/shared';
|
||||
import { isVoidTag, isHTMLTag, isSVGTag, isMathMLTag, parseStringStyle, capitalize, makeMap, extend } from '@vue/shared';
|
||||
|
||||
const V_MODEL_RADIO = Symbol((process.env.NODE_ENV !== 'production') ? `vModelRadio` : ``);
|
||||
const V_MODEL_CHECKBOX = Symbol((process.env.NODE_ENV !== 'production') ? `vModelCheckbox` : ``);
|
||||
const V_MODEL_TEXT = Symbol((process.env.NODE_ENV !== 'production') ? `vModelText` : ``);
|
||||
const V_MODEL_SELECT = Symbol((process.env.NODE_ENV !== 'production') ? `vModelSelect` : ``);
|
||||
const V_MODEL_DYNAMIC = Symbol((process.env.NODE_ENV !== 'production') ? `vModelDynamic` : ``);
|
||||
const V_ON_WITH_MODIFIERS = Symbol((process.env.NODE_ENV !== 'production') ? `vOnModifiersGuard` : ``);
|
||||
const V_ON_WITH_KEYS = Symbol((process.env.NODE_ENV !== 'production') ? `vOnKeysGuard` : ``);
|
||||
const V_SHOW = Symbol((process.env.NODE_ENV !== 'production') ? `vShow` : ``);
|
||||
const TRANSITION = Symbol((process.env.NODE_ENV !== 'production') ? `Transition` : ``);
|
||||
const TRANSITION_GROUP = Symbol((process.env.NODE_ENV !== 'production') ? `TransitionGroup` : ``);
|
||||
const V_MODEL_RADIO = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelRadio` : ``);
|
||||
const V_MODEL_CHECKBOX = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelCheckbox` : ``);
|
||||
const V_MODEL_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelText` : ``);
|
||||
const V_MODEL_SELECT = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelSelect` : ``);
|
||||
const V_MODEL_DYNAMIC = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelDynamic` : ``);
|
||||
const V_ON_WITH_MODIFIERS = Symbol(!!(process.env.NODE_ENV !== "production") ? `vOnModifiersGuard` : ``);
|
||||
const V_ON_WITH_KEYS = Symbol(!!(process.env.NODE_ENV !== "production") ? `vOnKeysGuard` : ``);
|
||||
const V_SHOW = Symbol(!!(process.env.NODE_ENV !== "production") ? `vShow` : ``);
|
||||
const TRANSITION = Symbol(!!(process.env.NODE_ENV !== "production") ? `Transition` : ``);
|
||||
const TRANSITION_GROUP = Symbol(!!(process.env.NODE_ENV !== "production") ? `TransitionGroup` : ``);
|
||||
registerRuntimeHelpers({
|
||||
[V_MODEL_RADIO]: `vModelRadio`,
|
||||
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
||||
[V_MODEL_TEXT]: `vModelText`,
|
||||
[V_MODEL_SELECT]: `vModelSelect`,
|
||||
[V_MODEL_DYNAMIC]: `vModelDynamic`,
|
||||
[V_ON_WITH_MODIFIERS]: `withModifiers`,
|
||||
[V_ON_WITH_KEYS]: `withKeys`,
|
||||
[V_SHOW]: `vShow`,
|
||||
[TRANSITION]: `Transition`,
|
||||
[TRANSITION_GROUP]: `TransitionGroup`
|
||||
[V_MODEL_RADIO]: `vModelRadio`,
|
||||
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
||||
[V_MODEL_TEXT]: `vModelText`,
|
||||
[V_MODEL_SELECT]: `vModelSelect`,
|
||||
[V_MODEL_DYNAMIC]: `vModelDynamic`,
|
||||
[V_ON_WITH_MODIFIERS]: `withModifiers`,
|
||||
[V_ON_WITH_KEYS]: `withKeys`,
|
||||
[V_SHOW]: `vShow`,
|
||||
[TRANSITION]: `Transition`,
|
||||
[TRANSITION_GROUP]: `TransitionGroup`
|
||||
});
|
||||
|
||||
/* eslint-disable no-restricted-globals */
|
||||
let decoder;
|
||||
function decodeHtmlBrowser(raw, asAttr = false) {
|
||||
if (!decoder) {
|
||||
decoder = document.createElement('div');
|
||||
}
|
||||
if (asAttr) {
|
||||
decoder.innerHTML = `<div foo="${raw.replace(/"/g, '"')}">`;
|
||||
return decoder.children[0].getAttribute('foo');
|
||||
}
|
||||
else {
|
||||
decoder.innerHTML = raw;
|
||||
return decoder.textContent;
|
||||
}
|
||||
if (!decoder) {
|
||||
decoder = document.createElement("div");
|
||||
}
|
||||
if (asAttr) {
|
||||
decoder.innerHTML = `<div foo="${raw.replace(/"/g, """)}">`;
|
||||
return decoder.children[0].getAttribute("foo");
|
||||
} else {
|
||||
decoder.innerHTML = raw;
|
||||
return decoder.textContent;
|
||||
}
|
||||
}
|
||||
|
||||
const isRawTextContainer = /*#__PURE__*/ makeMap('style,iframe,script,noscript', true);
|
||||
const parserOptions = {
|
||||
isVoidTag,
|
||||
isNativeTag: tag => isHTMLTag(tag) || isSVGTag(tag),
|
||||
isPreTag: tag => tag === 'pre',
|
||||
decodeEntities: decodeHtmlBrowser ,
|
||||
isBuiltInComponent: (tag) => {
|
||||
if (isBuiltInType(tag, `Transition`)) {
|
||||
return TRANSITION;
|
||||
}
|
||||
else if (isBuiltInType(tag, `TransitionGroup`)) {
|
||||
return TRANSITION_GROUP;
|
||||
}
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
||||
getNamespace(tag, parent) {
|
||||
let ns = parent ? parent.ns : 0 /* HTML */;
|
||||
if (parent && ns === 2 /* MATH_ML */) {
|
||||
if (parent.tag === 'annotation-xml') {
|
||||
if (tag === 'svg') {
|
||||
return 1 /* SVG */;
|
||||
}
|
||||
if (parent.props.some(a => a.type === 6 /* ATTRIBUTE */ &&
|
||||
a.name === 'encoding' &&
|
||||
a.value != null &&
|
||||
(a.value.content === 'text/html' ||
|
||||
a.value.content === 'application/xhtml+xml'))) {
|
||||
ns = 0 /* HTML */;
|
||||
}
|
||||
}
|
||||
else if (/^m(?:[ions]|text)$/.test(parent.tag) &&
|
||||
tag !== 'mglyph' &&
|
||||
tag !== 'malignmark') {
|
||||
ns = 0 /* HTML */;
|
||||
}
|
||||
}
|
||||
else if (parent && ns === 1 /* SVG */) {
|
||||
if (parent.tag === 'foreignObject' ||
|
||||
parent.tag === 'desc' ||
|
||||
parent.tag === 'title') {
|
||||
ns = 0 /* HTML */;
|
||||
}
|
||||
}
|
||||
if (ns === 0 /* HTML */) {
|
||||
if (tag === 'svg') {
|
||||
return 1 /* SVG */;
|
||||
}
|
||||
if (tag === 'math') {
|
||||
return 2 /* MATH_ML */;
|
||||
}
|
||||
}
|
||||
return ns;
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
|
||||
getTextMode({ tag, ns }) {
|
||||
if (ns === 0 /* HTML */) {
|
||||
if (tag === 'textarea' || tag === 'title') {
|
||||
return 1 /* RCDATA */;
|
||||
}
|
||||
if (isRawTextContainer(tag)) {
|
||||
return 2 /* RAWTEXT */;
|
||||
}
|
||||
}
|
||||
return 0 /* DATA */;
|
||||
parseMode: "html",
|
||||
isVoidTag,
|
||||
isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
|
||||
isPreTag: (tag) => tag === "pre",
|
||||
decodeEntities: decodeHtmlBrowser ,
|
||||
isBuiltInComponent: (tag) => {
|
||||
if (tag === "Transition" || tag === "transition") {
|
||||
return TRANSITION;
|
||||
} else if (tag === "TransitionGroup" || tag === "transition-group") {
|
||||
return TRANSITION_GROUP;
|
||||
}
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
||||
getNamespace(tag, parent, rootNamespace) {
|
||||
let ns = parent ? parent.ns : rootNamespace;
|
||||
if (parent && ns === 2) {
|
||||
if (parent.tag === "annotation-xml") {
|
||||
if (tag === "svg") {
|
||||
return 1;
|
||||
}
|
||||
if (parent.props.some(
|
||||
(a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
|
||||
)) {
|
||||
ns = 0;
|
||||
}
|
||||
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
|
||||
ns = 0;
|
||||
}
|
||||
} else if (parent && ns === 1) {
|
||||
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
|
||||
ns = 0;
|
||||
}
|
||||
}
|
||||
if (ns === 0) {
|
||||
if (tag === "svg") {
|
||||
return 1;
|
||||
}
|
||||
if (tag === "math") {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return ns;
|
||||
}
|
||||
};
|
||||
|
||||
// Parse inline CSS strings for static style attributes into an object.
|
||||
// This is a NodeTransform since it works on the static `style` attribute and
|
||||
// converts it into a dynamic equivalent:
|
||||
// style="color: red" -> :style='{ "color": "red" }'
|
||||
// It is then processed by `transformElement` and included in the generated
|
||||
// props.
|
||||
const transformStyle = node => {
|
||||
if (node.type === 1 /* ELEMENT */) {
|
||||
node.props.forEach((p, i) => {
|
||||
if (p.type === 6 /* ATTRIBUTE */ && p.name === 'style' && p.value) {
|
||||
// replace p with an expression node
|
||||
node.props[i] = {
|
||||
type: 7 /* DIRECTIVE */,
|
||||
name: `bind`,
|
||||
arg: createSimpleExpression(`style`, true, p.loc),
|
||||
exp: parseInlineCSS(p.value.content, p.loc),
|
||||
modifiers: [],
|
||||
loc: p.loc
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
const transformStyle = (node) => {
|
||||
if (node.type === 1) {
|
||||
node.props.forEach((p, i) => {
|
||||
if (p.type === 6 && p.name === "style" && p.value) {
|
||||
node.props[i] = {
|
||||
type: 7,
|
||||
name: `bind`,
|
||||
arg: createSimpleExpression(`style`, true, p.loc),
|
||||
exp: parseInlineCSS(p.value.content, p.loc),
|
||||
modifiers: [],
|
||||
loc: p.loc
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const parseInlineCSS = (cssText, loc) => {
|
||||
const normalized = parseStringStyle(cssText);
|
||||
return createSimpleExpression(JSON.stringify(normalized), false, loc, 3 /* CAN_STRINGIFY */);
|
||||
const normalized = parseStringStyle(cssText);
|
||||
return createSimpleExpression(
|
||||
JSON.stringify(normalized),
|
||||
false,
|
||||
loc,
|
||||
3
|
||||
);
|
||||
};
|
||||
|
||||
function createDOMCompilerError(code, loc) {
|
||||
return createCompilerError(code, loc, (process.env.NODE_ENV !== 'production') || !true ? DOMErrorMessages : undefined);
|
||||
return createCompilerError(
|
||||
code,
|
||||
loc,
|
||||
!!(process.env.NODE_ENV !== "production") || false ? DOMErrorMessages : void 0
|
||||
);
|
||||
}
|
||||
const DOMErrorCodes = {
|
||||
"X_V_HTML_NO_EXPRESSION": 53,
|
||||
"53": "X_V_HTML_NO_EXPRESSION",
|
||||
"X_V_HTML_WITH_CHILDREN": 54,
|
||||
"54": "X_V_HTML_WITH_CHILDREN",
|
||||
"X_V_TEXT_NO_EXPRESSION": 55,
|
||||
"55": "X_V_TEXT_NO_EXPRESSION",
|
||||
"X_V_TEXT_WITH_CHILDREN": 56,
|
||||
"56": "X_V_TEXT_WITH_CHILDREN",
|
||||
"X_V_MODEL_ON_INVALID_ELEMENT": 57,
|
||||
"57": "X_V_MODEL_ON_INVALID_ELEMENT",
|
||||
"X_V_MODEL_ARG_ON_ELEMENT": 58,
|
||||
"58": "X_V_MODEL_ARG_ON_ELEMENT",
|
||||
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59,
|
||||
"59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
|
||||
"X_V_MODEL_UNNECESSARY_VALUE": 60,
|
||||
"60": "X_V_MODEL_UNNECESSARY_VALUE",
|
||||
"X_V_SHOW_NO_EXPRESSION": 61,
|
||||
"61": "X_V_SHOW_NO_EXPRESSION",
|
||||
"X_TRANSITION_INVALID_CHILDREN": 62,
|
||||
"62": "X_TRANSITION_INVALID_CHILDREN",
|
||||
"X_IGNORED_SIDE_EFFECT_TAG": 63,
|
||||
"63": "X_IGNORED_SIDE_EFFECT_TAG",
|
||||
"__EXTEND_POINT__": 64,
|
||||
"64": "__EXTEND_POINT__"
|
||||
};
|
||||
const DOMErrorMessages = {
|
||||
[50 /* X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
|
||||
[51 /* X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
|
||||
[52 /* X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
|
||||
[53 /* X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
|
||||
[54 /* X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
||||
[55 /* X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
|
||||
[56 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
||||
[57 /* X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
||||
[58 /* X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
|
||||
[59 /* X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
|
||||
[60 /* X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
||||
[53]: `v-html is missing expression.`,
|
||||
[54]: `v-html will override element children.`,
|
||||
[55]: `v-text is missing expression.`,
|
||||
[56]: `v-text will override element children.`,
|
||||
[57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
||||
[58]: `v-model argument is not supported on plain elements.`,
|
||||
[59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
||||
[60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
||||
[61]: `v-show is missing expression.`,
|
||||
[62]: `<Transition> expects exactly one child element or component.`,
|
||||
[63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
||||
};
|
||||
|
||||
const transformVHtml = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(createDOMCompilerError(50 /* X_V_HTML_NO_EXPRESSION */, loc));
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(createDOMCompilerError(51 /* X_V_HTML_WITH_CHILDREN */, loc));
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
createObjectProperty(createSimpleExpression(`innerHTML`, true, loc), exp || createSimpleExpression('', true))
|
||||
]
|
||||
};
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(53, loc)
|
||||
);
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(
|
||||
createDOMCompilerError(54, loc)
|
||||
);
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
createObjectProperty(
|
||||
createSimpleExpression(`innerHTML`, true, loc),
|
||||
exp || createSimpleExpression("", true)
|
||||
)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformVText = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(createDOMCompilerError(52 /* X_V_TEXT_NO_EXPRESSION */, loc));
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(createDOMCompilerError(53 /* X_V_TEXT_WITH_CHILDREN */, loc));
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
createObjectProperty(createSimpleExpression(`textContent`, true), exp
|
||||
? getConstantType(exp, context) > 0
|
||||
? exp
|
||||
: createCallExpression(context.helperString(TO_DISPLAY_STRING), [exp], loc)
|
||||
: createSimpleExpression('', true))
|
||||
]
|
||||
};
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(55, loc)
|
||||
);
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(
|
||||
createDOMCompilerError(56, loc)
|
||||
);
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
createObjectProperty(
|
||||
createSimpleExpression(`textContent`, true),
|
||||
exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
|
||||
context.helperString(TO_DISPLAY_STRING),
|
||||
[exp],
|
||||
loc
|
||||
) : createSimpleExpression("", true)
|
||||
)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformModel = (dir, node, context) => {
|
||||
const baseResult = transformModel$1(dir, node, context);
|
||||
// base transform has errors OR component v-model (only need props)
|
||||
if (!baseResult.props.length || node.tagType === 1 /* COMPONENT */) {
|
||||
return baseResult;
|
||||
}
|
||||
if (dir.arg) {
|
||||
context.onError(createDOMCompilerError(55 /* X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
|
||||
}
|
||||
function checkDuplicatedValue() {
|
||||
const value = findProp(node, 'value');
|
||||
if (value) {
|
||||
context.onError(createDOMCompilerError(57 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
|
||||
}
|
||||
}
|
||||
const { tag } = node;
|
||||
const isCustomElement = context.isCustomElement(tag);
|
||||
if (tag === 'input' ||
|
||||
tag === 'textarea' ||
|
||||
tag === 'select' ||
|
||||
isCustomElement) {
|
||||
let directiveToUse = V_MODEL_TEXT;
|
||||
let isInvalidType = false;
|
||||
if (tag === 'input' || isCustomElement) {
|
||||
const type = findProp(node, `type`);
|
||||
if (type) {
|
||||
if (type.type === 7 /* DIRECTIVE */) {
|
||||
// :type="foo"
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
}
|
||||
else if (type.value) {
|
||||
switch (type.value.content) {
|
||||
case 'radio':
|
||||
directiveToUse = V_MODEL_RADIO;
|
||||
break;
|
||||
case 'checkbox':
|
||||
directiveToUse = V_MODEL_CHECKBOX;
|
||||
break;
|
||||
case 'file':
|
||||
isInvalidType = true;
|
||||
context.onError(createDOMCompilerError(56 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
|
||||
break;
|
||||
default:
|
||||
// text type
|
||||
(process.env.NODE_ENV !== 'production') && checkDuplicatedValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (hasDynamicKeyVBind(node)) {
|
||||
// element has bindings with dynamic keys, which can possibly contain
|
||||
// "type".
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
}
|
||||
else {
|
||||
// text type
|
||||
(process.env.NODE_ENV !== 'production') && checkDuplicatedValue();
|
||||
}
|
||||
}
|
||||
else if (tag === 'select') {
|
||||
directiveToUse = V_MODEL_SELECT;
|
||||
}
|
||||
else {
|
||||
// textarea
|
||||
(process.env.NODE_ENV !== 'production') && checkDuplicatedValue();
|
||||
}
|
||||
// inject runtime directive
|
||||
// by returning the helper symbol via needRuntime
|
||||
// the import will replaced a resolveDirective call.
|
||||
if (!isInvalidType) {
|
||||
baseResult.needRuntime = context.helper(directiveToUse);
|
||||
}
|
||||
}
|
||||
else {
|
||||
context.onError(createDOMCompilerError(54 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
|
||||
}
|
||||
// native vmodel doesn't need the `modelValue` props since they are also
|
||||
// passed to the runtime as `binding.value`. removing it reduces code size.
|
||||
baseResult.props = baseResult.props.filter(p => !(p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
|
||||
p.key.content === 'modelValue'));
|
||||
const baseResult = transformModel$1(dir, node, context);
|
||||
if (!baseResult.props.length || node.tagType === 1) {
|
||||
return baseResult;
|
||||
}
|
||||
if (dir.arg) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
58,
|
||||
dir.arg.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
function checkDuplicatedValue() {
|
||||
const value = findDir(node, "bind");
|
||||
if (value && isStaticArgOf(value.arg, "value")) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
60,
|
||||
value.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
const { tag } = node;
|
||||
const isCustomElement = context.isCustomElement(tag);
|
||||
if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
|
||||
let directiveToUse = V_MODEL_TEXT;
|
||||
let isInvalidType = false;
|
||||
if (tag === "input" || isCustomElement) {
|
||||
const type = findProp(node, `type`);
|
||||
if (type) {
|
||||
if (type.type === 7) {
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
} else if (type.value) {
|
||||
switch (type.value.content) {
|
||||
case "radio":
|
||||
directiveToUse = V_MODEL_RADIO;
|
||||
break;
|
||||
case "checkbox":
|
||||
directiveToUse = V_MODEL_CHECKBOX;
|
||||
break;
|
||||
case "file":
|
||||
isInvalidType = true;
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
59,
|
||||
dir.loc
|
||||
)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
!!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (hasDynamicKeyVBind(node)) {
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
} else {
|
||||
!!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
|
||||
}
|
||||
} else if (tag === "select") {
|
||||
directiveToUse = V_MODEL_SELECT;
|
||||
} else {
|
||||
!!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
|
||||
}
|
||||
if (!isInvalidType) {
|
||||
baseResult.needRuntime = context.helper(directiveToUse);
|
||||
}
|
||||
} else {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
57,
|
||||
dir.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
baseResult.props = baseResult.props.filter(
|
||||
(p) => !(p.key.type === 4 && p.key.content === "modelValue")
|
||||
);
|
||||
return baseResult;
|
||||
};
|
||||
|
||||
const isEventOptionModifier = /*#__PURE__*/ makeMap(`passive,once,capture`);
|
||||
const isNonKeyModifier = /*#__PURE__*/ makeMap(
|
||||
// event propagation management
|
||||
`stop,prevent,self,` +
|
||||
// system modifiers + exact
|
||||
`ctrl,shift,alt,meta,exact,` +
|
||||
// mouse
|
||||
`middle`);
|
||||
// left & right could be mouse or key modifiers based on event type
|
||||
const maybeKeyModifier = /*#__PURE__*/ makeMap('left,right');
|
||||
const isKeyboardEvent = /*#__PURE__*/ makeMap(`onkeyup,onkeydown,onkeypress`, true);
|
||||
const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
|
||||
const isNonKeyModifier = /* @__PURE__ */ makeMap(
|
||||
// event propagation management
|
||||
`stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
|
||||
);
|
||||
const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
|
||||
const isKeyboardEvent = /* @__PURE__ */ makeMap(
|
||||
`onkeyup,onkeydown,onkeypress`,
|
||||
true
|
||||
);
|
||||
const resolveModifiers = (key, modifiers, context, loc) => {
|
||||
const keyModifiers = [];
|
||||
const nonKeyModifiers = [];
|
||||
const eventOptionModifiers = [];
|
||||
for (let i = 0; i < modifiers.length; i++) {
|
||||
const modifier = modifiers[i];
|
||||
if (modifier === 'native' &&
|
||||
checkCompatEnabled("COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */, context, loc)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
const keyModifiers = [];
|
||||
const nonKeyModifiers = [];
|
||||
const eventOptionModifiers = [];
|
||||
for (let i = 0; i < modifiers.length; i++) {
|
||||
const modifier = modifiers[i];
|
||||
if (modifier === "native" && checkCompatEnabled(
|
||||
"COMPILER_V_ON_NATIVE",
|
||||
context,
|
||||
loc
|
||||
)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
} else if (isEventOptionModifier(modifier)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
} else {
|
||||
if (maybeKeyModifier(modifier)) {
|
||||
if (isStaticExp(key)) {
|
||||
if (isKeyboardEvent(key.content)) {
|
||||
keyModifiers.push(modifier);
|
||||
} else {
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
} else {
|
||||
keyModifiers.push(modifier);
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
else if (isEventOptionModifier(modifier)) {
|
||||
// eventOptionModifiers: modifiers for addEventListener() options,
|
||||
// e.g. .passive & .capture
|
||||
eventOptionModifiers.push(modifier);
|
||||
}
|
||||
else {
|
||||
// runtimeModifiers: modifiers that needs runtime guards
|
||||
if (maybeKeyModifier(modifier)) {
|
||||
if (isStaticExp(key)) {
|
||||
if (isKeyboardEvent(key.content)) {
|
||||
keyModifiers.push(modifier);
|
||||
}
|
||||
else {
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
else {
|
||||
keyModifiers.push(modifier);
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isNonKeyModifier(modifier)) {
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
else {
|
||||
keyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isNonKeyModifier(modifier)) {
|
||||
nonKeyModifiers.push(modifier);
|
||||
} else {
|
||||
keyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
keyModifiers,
|
||||
nonKeyModifiers,
|
||||
eventOptionModifiers
|
||||
};
|
||||
}
|
||||
return {
|
||||
keyModifiers,
|
||||
nonKeyModifiers,
|
||||
eventOptionModifiers
|
||||
};
|
||||
};
|
||||
const transformClick = (key, event) => {
|
||||
const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === 'onclick';
|
||||
return isStaticClick
|
||||
? createSimpleExpression(event, true)
|
||||
: key.type !== 4 /* SIMPLE_EXPRESSION */
|
||||
? createCompoundExpression([
|
||||
`(`,
|
||||
key,
|
||||
`) === "onClick" ? "${event}" : (`,
|
||||
key,
|
||||
`)`
|
||||
])
|
||||
: key;
|
||||
const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
|
||||
return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
|
||||
`(`,
|
||||
key,
|
||||
`) === "onClick" ? "${event}" : (`,
|
||||
key,
|
||||
`)`
|
||||
]) : key;
|
||||
};
|
||||
const transformOn = (dir, node, context) => {
|
||||
return transformOn$1(dir, node, context, baseResult => {
|
||||
const { modifiers } = dir;
|
||||
if (!modifiers.length)
|
||||
return baseResult;
|
||||
let { key, value: handlerExp } = baseResult.props[0];
|
||||
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
||||
// normalize click.right and click.middle since they don't actually fire
|
||||
if (nonKeyModifiers.includes('right')) {
|
||||
key = transformClick(key, `onContextmenu`);
|
||||
}
|
||||
if (nonKeyModifiers.includes('middle')) {
|
||||
key = transformClick(key, `onMouseup`);
|
||||
}
|
||||
if (nonKeyModifiers.length) {
|
||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
|
||||
handlerExp,
|
||||
JSON.stringify(nonKeyModifiers)
|
||||
]);
|
||||
}
|
||||
if (keyModifiers.length &&
|
||||
// if event name is dynamic, always wrap with keys guard
|
||||
(!isStaticExp(key) || isKeyboardEvent(key.content))) {
|
||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
|
||||
handlerExp,
|
||||
JSON.stringify(keyModifiers)
|
||||
]);
|
||||
}
|
||||
if (eventOptionModifiers.length) {
|
||||
const modifierPostfix = eventOptionModifiers.map(capitalize).join('');
|
||||
key = isStaticExp(key)
|
||||
? createSimpleExpression(`${key.content}${modifierPostfix}`, true)
|
||||
: createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
|
||||
}
|
||||
return {
|
||||
props: [createObjectProperty(key, handlerExp)]
|
||||
};
|
||||
});
|
||||
return transformOn$1(dir, node, context, (baseResult) => {
|
||||
const { modifiers } = dir;
|
||||
if (!modifiers.length)
|
||||
return baseResult;
|
||||
let { key, value: handlerExp } = baseResult.props[0];
|
||||
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
||||
if (nonKeyModifiers.includes("right")) {
|
||||
key = transformClick(key, `onContextmenu`);
|
||||
}
|
||||
if (nonKeyModifiers.includes("middle")) {
|
||||
key = transformClick(key, `onMouseup`);
|
||||
}
|
||||
if (nonKeyModifiers.length) {
|
||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
|
||||
handlerExp,
|
||||
JSON.stringify(nonKeyModifiers)
|
||||
]);
|
||||
}
|
||||
if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
|
||||
(!isStaticExp(key) || isKeyboardEvent(key.content))) {
|
||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
|
||||
handlerExp,
|
||||
JSON.stringify(keyModifiers)
|
||||
]);
|
||||
}
|
||||
if (eventOptionModifiers.length) {
|
||||
const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
|
||||
key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
|
||||
}
|
||||
return {
|
||||
props: [createObjectProperty(key, handlerExp)]
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const transformShow = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(createDOMCompilerError(58 /* X_V_SHOW_NO_EXPRESSION */, loc));
|
||||
}
|
||||
return {
|
||||
props: [],
|
||||
needRuntime: context.helper(V_SHOW)
|
||||
};
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(61, loc)
|
||||
);
|
||||
}
|
||||
return {
|
||||
props: [],
|
||||
needRuntime: context.helper(V_SHOW)
|
||||
};
|
||||
};
|
||||
|
||||
const transformTransition = (node, context) => {
|
||||
if (node.type === 1 /* ELEMENT */ &&
|
||||
node.tagType === 1 /* COMPONENT */) {
|
||||
const component = context.isBuiltInComponent(node.tag);
|
||||
if (component === TRANSITION) {
|
||||
return () => {
|
||||
if (!node.children.length) {
|
||||
return;
|
||||
}
|
||||
// warn multiple transition children
|
||||
if (hasMultipleChildren(node)) {
|
||||
context.onError(createDOMCompilerError(59 /* X_TRANSITION_INVALID_CHILDREN */, {
|
||||
start: node.children[0].loc.start,
|
||||
end: node.children[node.children.length - 1].loc.end,
|
||||
source: ''
|
||||
}));
|
||||
}
|
||||
// check if it's s single child w/ v-show
|
||||
// if yes, inject "persisted: true" to the transition props
|
||||
const child = node.children[0];
|
||||
if (child.type === 1 /* ELEMENT */) {
|
||||
for (const p of child.props) {
|
||||
if (p.type === 7 /* DIRECTIVE */ && p.name === 'show') {
|
||||
node.props.push({
|
||||
type: 6 /* ATTRIBUTE */,
|
||||
name: 'persisted',
|
||||
value: undefined,
|
||||
loc: node.loc
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (node.type === 1 && node.tagType === 1) {
|
||||
const component = context.isBuiltInComponent(node.tag);
|
||||
if (component === TRANSITION) {
|
||||
return () => {
|
||||
if (!node.children.length) {
|
||||
return;
|
||||
}
|
||||
if (hasMultipleChildren(node)) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
62,
|
||||
{
|
||||
start: node.children[0].loc.start,
|
||||
end: node.children[node.children.length - 1].loc.end,
|
||||
source: ""
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
const child = node.children[0];
|
||||
if (child.type === 1) {
|
||||
for (const p of child.props) {
|
||||
if (p.type === 7 && p.name === "show") {
|
||||
node.props.push({
|
||||
type: 6,
|
||||
name: "persisted",
|
||||
nameLoc: node.loc,
|
||||
value: void 0,
|
||||
loc: node.loc
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
function hasMultipleChildren(node) {
|
||||
// #1352 filter out potential comment nodes.
|
||||
const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */ &&
|
||||
!(c.type === 2 /* TEXT */ && !c.content.trim())));
|
||||
const child = children[0];
|
||||
return (children.length !== 1 ||
|
||||
child.type === 11 /* FOR */ ||
|
||||
(child.type === 9 /* IF */ && child.branches.some(hasMultipleChildren)));
|
||||
const children = node.children = node.children.filter(
|
||||
(c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
|
||||
);
|
||||
const child = children[0];
|
||||
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
|
||||
}
|
||||
|
||||
const ignoreSideEffectTags = (node, context) => {
|
||||
if (node.type === 1 /* ELEMENT */ &&
|
||||
node.tagType === 0 /* ELEMENT */ &&
|
||||
(node.tag === 'script' || node.tag === 'style')) {
|
||||
context.onError(createDOMCompilerError(60 /* X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
|
||||
context.removeNode();
|
||||
}
|
||||
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
|
||||
!!(process.env.NODE_ENV !== "production") && context.onError(
|
||||
createDOMCompilerError(
|
||||
63,
|
||||
node.loc
|
||||
)
|
||||
);
|
||||
context.removeNode();
|
||||
}
|
||||
};
|
||||
|
||||
const DOMNodeTransforms = [
|
||||
transformStyle,
|
||||
...((process.env.NODE_ENV !== 'production') ? [transformTransition] : [])
|
||||
transformStyle,
|
||||
...!!(process.env.NODE_ENV !== "production") ? [transformTransition] : []
|
||||
];
|
||||
const DOMDirectiveTransforms = {
|
||||
cloak: noopDirectiveTransform,
|
||||
html: transformVHtml,
|
||||
text: transformVText,
|
||||
model: transformModel,
|
||||
on: transformOn,
|
||||
show: transformShow
|
||||
cloak: noopDirectiveTransform,
|
||||
html: transformVHtml,
|
||||
text: transformVText,
|
||||
model: transformModel,
|
||||
// override compiler-core
|
||||
on: transformOn,
|
||||
// override compiler-core
|
||||
show: transformShow
|
||||
};
|
||||
function compile(template, options = {}) {
|
||||
return baseCompile(template, extend({}, parserOptions, options, {
|
||||
nodeTransforms: [
|
||||
// ignore <script> and <tag>
|
||||
// this is not put inside DOMNodeTransforms because that list is used
|
||||
// by compiler-ssr to generate vnode fallback branches
|
||||
ignoreSideEffectTags,
|
||||
...DOMNodeTransforms,
|
||||
...(options.nodeTransforms || [])
|
||||
],
|
||||
directiveTransforms: extend({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
|
||||
transformHoist: null
|
||||
}));
|
||||
function compile(src, options = {}) {
|
||||
return baseCompile(
|
||||
src,
|
||||
extend({}, parserOptions, options, {
|
||||
nodeTransforms: [
|
||||
// ignore <script> and <tag>
|
||||
// this is not put inside DOMNodeTransforms because that list is used
|
||||
// by compiler-ssr to generate vnode fallback branches
|
||||
ignoreSideEffectTags,
|
||||
...DOMNodeTransforms,
|
||||
...options.nodeTransforms || []
|
||||
],
|
||||
directiveTransforms: extend(
|
||||
{},
|
||||
DOMDirectiveTransforms,
|
||||
options.directiveTransforms || {}
|
||||
),
|
||||
transformHoist: null
|
||||
})
|
||||
);
|
||||
}
|
||||
function parse(template, options = {}) {
|
||||
return baseParse(template, extend({}, parserOptions, options));
|
||||
return baseParse(template, extend({}, parserOptions, options));
|
||||
}
|
||||
|
||||
export { DOMDirectiveTransforms, DOMNodeTransforms, TRANSITION, TRANSITION_GROUP, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, compile, createDOMCompilerError, parse, parserOptions, transformStyle };
|
||||
export { DOMDirectiveTransforms, DOMErrorCodes, DOMErrorMessages, DOMNodeTransforms, TRANSITION, TRANSITION_GROUP, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, compile, createDOMCompilerError, parse, parserOptions, transformStyle };
|
||||
|
||||
+5766
-4969
File diff suppressed because it is too large
Load Diff
+6
-1
File diff suppressed because one or more lines are too long
+18
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/compiler-dom",
|
||||
"version": "3.2.36",
|
||||
"version": "3.4.15",
|
||||
"description": "@vue/compiler-dom",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-dom.esm-bundler.js",
|
||||
@@ -11,6 +11,20 @@
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/compiler-dom.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/compiler-dom.cjs.prod.js",
|
||||
"development": "./dist/compiler-dom.cjs.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"module": "./dist/compiler-dom.esm-bundler.js",
|
||||
"import": "./dist/compiler-dom.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerDOM",
|
||||
@@ -37,7 +51,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36",
|
||||
"@vue/compiler-core": "3.2.36"
|
||||
"@vue/shared": "3.4.15",
|
||||
"@vue/compiler-core": "3.4.15"
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
|
||||
**Note: as of 3.2.13+, this package is included as a dependency of the main `vue` package and can be accessed as `vue/compiler-sfc`. This means you no longer need to explicitly install this package and ensure its version match that of `vue`'s. Just use the main `vue/compiler-sfc` deep import instead.**
|
||||
|
||||
This package contains lower level utilities that you can use if you are writing a plugin / transform for a bundler or module system that compiles Vue Single File Components (SFCs) into JavaScript. It is used in [vue-loader](https://github.com/vuejs/vue-loader), [rollup-plugin-vue](https://github.com/vuejs/rollup-plugin-vue) and [vite](https://github.com/vitejs/vite).
|
||||
This package contains lower level utilities that you can use if you are writing a plugin / transform for a bundler or module system that compiles Vue Single File Components (SFCs) into JavaScript. It is used in [vue-loader](https://github.com/vuejs/vue-loader) and [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue).
|
||||
|
||||
## API
|
||||
|
||||
@@ -77,4 +77,4 @@ export default script
|
||||
|
||||
Options needed for these APIs can be passed via the query string.
|
||||
|
||||
For detailed API references and options, check out the source type definitions. For actual usage of these APIs, check out [rollup-plugin-vue](https://github.com/vuejs/rollup-plugin-vue/tree/next) or [vue-loader](https://github.com/vuejs/vue-loader/tree/next).
|
||||
For detailed API references and options, check out the source type definitions. For actual usage of these APIs, check out [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue) or [vue-loader](https://github.com/vuejs/vue-loader/tree/next).
|
||||
|
||||
+17914
-14807
File diff suppressed because one or more lines are too long
+488
-267
@@ -1,27 +1,19 @@
|
||||
import { parse as babelParse } from '@babel/parser';
|
||||
import { BindingMetadata } from '@vue/compiler-core';
|
||||
import { CodegenResult } from '@vue/compiler-core';
|
||||
import { CompilerError } from '@vue/compiler-core';
|
||||
import { CompilerOptions } from '@vue/compiler-core';
|
||||
import { ElementNode } from '@vue/compiler-core';
|
||||
import { extractIdentifiers } from '@vue/compiler-core';
|
||||
import { generateCodeFrame } from '@vue/compiler-core';
|
||||
import { isInDestructureAssignment } from '@vue/compiler-core';
|
||||
import { isStaticProperty } from '@vue/compiler-core';
|
||||
import { LazyResult } from 'postcss';
|
||||
import MagicString from 'magic-string';
|
||||
import { ParserOptions } from '@vue/compiler-core';
|
||||
import * as _babel_types from '@babel/types';
|
||||
import { Statement, Expression, TSType, Node, Program, CallExpression, ObjectPattern, TSModuleDeclaration, TSPropertySignature, TSMethodSignature, TSCallSignatureDeclaration, TSFunctionType } from '@babel/types';
|
||||
import { RootNode, CompilerOptions, CodegenResult, ParserOptions, CompilerError, SourceLocation, BindingMetadata as BindingMetadata$1 } from '@vue/compiler-core';
|
||||
export { BindingMetadata, CompilerError, CompilerOptions, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers } from '@vue/compiler-core';
|
||||
import { RawSourceMap } from 'source-map-js';
|
||||
import { ParserPlugin } from '@babel/parser';
|
||||
import { RawSourceMap } from 'source-map';
|
||||
import { Result } from 'postcss';
|
||||
import { RootNode } from '@vue/compiler-core';
|
||||
import { shouldTransform as shouldTransformRef } from '@vue/reactivity-transform';
|
||||
import { SourceLocation } from '@vue/compiler-core';
|
||||
import { transform as transformRef } from '@vue/reactivity-transform';
|
||||
import { transformAST as transformRefAST } from '@vue/reactivity-transform';
|
||||
import { walkIdentifiers } from '@vue/compiler-core';
|
||||
export { parse as babelParse } from '@babel/parser';
|
||||
import { Result, LazyResult } from 'postcss';
|
||||
import MagicString from 'magic-string';
|
||||
export { default as MagicString } from 'magic-string';
|
||||
import TS from 'typescript';
|
||||
|
||||
export declare interface AssetURLOptions {
|
||||
export interface AssetURLTagConfig {
|
||||
[name: string]: string[];
|
||||
}
|
||||
export interface AssetURLOptions {
|
||||
/**
|
||||
* If base is provided, instead of transforming relative asset urls into
|
||||
* imports, they will be directly rewritten to absolute urls.
|
||||
@@ -34,240 +26,22 @@ export declare interface AssetURLOptions {
|
||||
tags?: AssetURLTagConfig;
|
||||
}
|
||||
|
||||
export declare interface AssetURLTagConfig {
|
||||
[name: string]: string[];
|
||||
export interface TemplateCompiler {
|
||||
compile(source: string | RootNode, options: CompilerOptions): CodegenResult;
|
||||
parse(template: string, options: ParserOptions): RootNode;
|
||||
}
|
||||
|
||||
export { babelParse }
|
||||
|
||||
export { BindingMetadata }
|
||||
|
||||
export { CompilerError }
|
||||
|
||||
export { CompilerOptions }
|
||||
|
||||
/**
|
||||
* Compile `<script setup>`
|
||||
* It requires the whole SFC descriptor because we need to handle and merge
|
||||
* normal `<script>` + `<script setup>` if both are present.
|
||||
*/
|
||||
export declare function compileScript(sfc: SFCDescriptor, options: SFCScriptCompileOptions): SFCScriptBlock;
|
||||
|
||||
export declare function compileStyle(options: SFCStyleCompileOptions): SFCStyleCompileResults;
|
||||
|
||||
export declare function compileStyleAsync(options: SFCAsyncStyleCompileOptions): Promise<SFCStyleCompileResults>;
|
||||
|
||||
export declare function compileTemplate(options: SFCTemplateCompileOptions): SFCTemplateCompileResults;
|
||||
|
||||
/**
|
||||
* Aligns with postcss-modules
|
||||
* https://github.com/css-modules/postcss-modules
|
||||
*/
|
||||
declare interface CSSModulesOptions {
|
||||
scopeBehaviour?: 'global' | 'local';
|
||||
generateScopedName?: string | ((name: string, filename: string, css: string) => string);
|
||||
hashPrefix?: string;
|
||||
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
|
||||
exportGlobals?: boolean;
|
||||
globalModulePaths?: RegExp[];
|
||||
}
|
||||
|
||||
export { extractIdentifiers }
|
||||
|
||||
export { generateCodeFrame }
|
||||
|
||||
declare interface ImportBinding {
|
||||
isType: boolean;
|
||||
imported: string;
|
||||
source: string;
|
||||
isFromSetup: boolean;
|
||||
isUsedInTemplate: boolean;
|
||||
}
|
||||
|
||||
export { isInDestructureAssignment }
|
||||
|
||||
export { isStaticProperty }
|
||||
|
||||
export { MagicString }
|
||||
|
||||
export declare function parse(source: string, { sourceMap, filename, sourceRoot, pad, ignoreEmpty, compiler }?: SFCParseOptions): SFCParseResult;
|
||||
|
||||
declare type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus';
|
||||
|
||||
/**
|
||||
* Utility for rewriting `export default` in a script block into a variable
|
||||
* declaration so that we can inject things into it
|
||||
*/
|
||||
export declare function rewriteDefault(input: string, as: string, parserPlugins?: ParserPlugin[]): string;
|
||||
|
||||
export declare interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions {
|
||||
isAsync?: boolean;
|
||||
modules?: boolean;
|
||||
modulesOptions?: CSSModulesOptions;
|
||||
}
|
||||
|
||||
export declare interface SFCBlock {
|
||||
type: string;
|
||||
content: string;
|
||||
attrs: Record<string, string | true>;
|
||||
loc: SourceLocation;
|
||||
map?: RawSourceMap;
|
||||
lang?: string;
|
||||
src?: string;
|
||||
}
|
||||
|
||||
export declare interface SFCDescriptor {
|
||||
filename: string;
|
||||
source: string;
|
||||
template: SFCTemplateBlock | null;
|
||||
script: SFCScriptBlock | null;
|
||||
scriptSetup: SFCScriptBlock | null;
|
||||
styles: SFCStyleBlock[];
|
||||
customBlocks: SFCBlock[];
|
||||
cssVars: string[];
|
||||
/**
|
||||
* whether the SFC uses :slotted() modifier.
|
||||
* this is used as a compiler optimization hint.
|
||||
*/
|
||||
slotted: boolean;
|
||||
/**
|
||||
* compare with an existing descriptor to determine whether HMR should perform
|
||||
* a reload vs. re-render.
|
||||
*
|
||||
* Note: this comparison assumes the prev/next script are already identical,
|
||||
* and only checks the special case where <script setup lang="ts"> unused import
|
||||
* pruning result changes due to template changes.
|
||||
*/
|
||||
shouldForceReload: (prevImports: Record<string, ImportBinding>) => boolean;
|
||||
}
|
||||
|
||||
export declare interface SFCParseOptions {
|
||||
filename?: string;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
pad?: boolean | 'line' | 'space';
|
||||
ignoreEmpty?: boolean;
|
||||
compiler?: TemplateCompiler;
|
||||
}
|
||||
|
||||
export declare interface SFCParseResult {
|
||||
descriptor: SFCDescriptor;
|
||||
errors: (CompilerError | SyntaxError)[];
|
||||
}
|
||||
|
||||
export declare interface SFCScriptBlock extends SFCBlock {
|
||||
type: 'script';
|
||||
setup?: string | boolean;
|
||||
bindings?: BindingMetadata;
|
||||
imports?: Record<string, ImportBinding>;
|
||||
/**
|
||||
* import('\@babel/types').Statement
|
||||
*/
|
||||
scriptAst?: any[];
|
||||
/**
|
||||
* import('\@babel/types').Statement
|
||||
*/
|
||||
scriptSetupAst?: any[];
|
||||
}
|
||||
|
||||
export declare interface SFCScriptCompileOptions {
|
||||
/**
|
||||
* Scope ID for prefixing injected CSS variables.
|
||||
* This must be consistent with the `id` passed to `compileStyle`.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Production mode. Used to determine whether to generate hashed CSS variables
|
||||
*/
|
||||
isProd?: boolean;
|
||||
/**
|
||||
* Enable/disable source map. Defaults to true.
|
||||
*/
|
||||
sourceMap?: boolean;
|
||||
/**
|
||||
* https://babeljs.io/docs/en/babel-parser#plugins
|
||||
*/
|
||||
babelParserPlugins?: ParserPlugin[];
|
||||
/**
|
||||
* (Experimental) Enable syntax transform for using refs without `.value` and
|
||||
* using destructured props with reactivity
|
||||
*/
|
||||
reactivityTransform?: boolean;
|
||||
/**
|
||||
* (Experimental) Enable syntax transform for using refs without `.value`
|
||||
* https://github.com/vuejs/rfcs/discussions/369
|
||||
* @deprecated now part of `reactivityTransform`
|
||||
* @default false
|
||||
*/
|
||||
refTransform?: boolean;
|
||||
/**
|
||||
* (Experimental) Enable syntax transform for destructuring from defineProps()
|
||||
* https://github.com/vuejs/rfcs/discussions/394
|
||||
* @deprecated now part of `reactivityTransform`
|
||||
* @default false
|
||||
*/
|
||||
propsDestructureTransform?: boolean;
|
||||
/**
|
||||
* @deprecated use `reactivityTransform` instead.
|
||||
*/
|
||||
refSugar?: boolean;
|
||||
/**
|
||||
* Compile the template and inline the resulting render function
|
||||
* directly inside setup().
|
||||
* - Only affects `<script setup>`
|
||||
* - This should only be used in production because it prevents the template
|
||||
* from being hot-reloaded separately from component state.
|
||||
*/
|
||||
inlineTemplate?: boolean;
|
||||
/**
|
||||
* Options for template compilation when inlining. Note these are options that
|
||||
* would normally be passed to `compiler-sfc`'s own `compileTemplate()`, not
|
||||
* options passed to `compiler-dom`.
|
||||
*/
|
||||
templateOptions?: Partial<SFCTemplateCompileOptions>;
|
||||
}
|
||||
|
||||
export declare interface SFCStyleBlock extends SFCBlock {
|
||||
type: 'style';
|
||||
scoped?: boolean;
|
||||
module?: string | boolean;
|
||||
}
|
||||
|
||||
export declare interface SFCStyleCompileOptions {
|
||||
source: string;
|
||||
filename: string;
|
||||
id: string;
|
||||
scoped?: boolean;
|
||||
trim?: boolean;
|
||||
isProd?: boolean;
|
||||
inMap?: RawSourceMap;
|
||||
preprocessLang?: PreprocessLang;
|
||||
preprocessOptions?: any;
|
||||
preprocessCustomRequire?: (id: string) => any;
|
||||
postcssOptions?: any;
|
||||
postcssPlugins?: any[];
|
||||
/**
|
||||
* @deprecated use `inMap` instead.
|
||||
*/
|
||||
map?: RawSourceMap;
|
||||
}
|
||||
|
||||
export declare interface SFCStyleCompileResults {
|
||||
export interface SFCTemplateCompileResults {
|
||||
code: string;
|
||||
map: RawSourceMap | undefined;
|
||||
rawResult: Result | LazyResult | undefined;
|
||||
errors: Error[];
|
||||
modules?: Record<string, string>;
|
||||
dependencies: Set<string>;
|
||||
}
|
||||
|
||||
export declare interface SFCTemplateBlock extends SFCBlock {
|
||||
type: 'template';
|
||||
ast: ElementNode;
|
||||
}
|
||||
|
||||
export declare interface SFCTemplateCompileOptions {
|
||||
ast?: RootNode;
|
||||
preamble?: string;
|
||||
source: string;
|
||||
tips: string[];
|
||||
errors: (string | CompilerError)[];
|
||||
map?: RawSourceMap;
|
||||
}
|
||||
export interface SFCTemplateCompileOptions {
|
||||
source: string;
|
||||
ast?: RootNode;
|
||||
filename: string;
|
||||
id: string;
|
||||
scoped?: boolean;
|
||||
@@ -292,30 +66,477 @@ export declare interface SFCTemplateCompileOptions {
|
||||
*/
|
||||
transformAssetUrls?: AssetURLOptions | AssetURLTagConfig | boolean;
|
||||
}
|
||||
export declare function compileTemplate(options: SFCTemplateCompileOptions): SFCTemplateCompileResults;
|
||||
|
||||
export declare interface SFCTemplateCompileResults {
|
||||
code: string;
|
||||
ast?: RootNode;
|
||||
preamble?: string;
|
||||
export interface SFCScriptCompileOptions {
|
||||
/**
|
||||
* Scope ID for prefixing injected CSS variables.
|
||||
* This must be consistent with the `id` passed to `compileStyle`.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Production mode. Used to determine whether to generate hashed CSS variables
|
||||
*/
|
||||
isProd?: boolean;
|
||||
/**
|
||||
* Enable/disable source map. Defaults to true.
|
||||
*/
|
||||
sourceMap?: boolean;
|
||||
/**
|
||||
* https://babeljs.io/docs/en/babel-parser#plugins
|
||||
*/
|
||||
babelParserPlugins?: ParserPlugin[];
|
||||
/**
|
||||
* A list of files to parse for global types to be made available for type
|
||||
* resolving in SFC macros. The list must be fully resolved file system paths.
|
||||
*/
|
||||
globalTypeFiles?: string[];
|
||||
/**
|
||||
* Compile the template and inline the resulting render function
|
||||
* directly inside setup().
|
||||
* - Only affects `<script setup>`
|
||||
* - This should only be used in production because it prevents the template
|
||||
* from being hot-reloaded separately from component state.
|
||||
*/
|
||||
inlineTemplate?: boolean;
|
||||
/**
|
||||
* Generate the final component as a variable instead of default export.
|
||||
* This is useful in e.g. @vitejs/plugin-vue where the script needs to be
|
||||
* placed inside the main module.
|
||||
*/
|
||||
genDefaultAs?: string;
|
||||
/**
|
||||
* Options for template compilation when inlining. Note these are options that
|
||||
* would normally be passed to `compiler-sfc`'s own `compileTemplate()`, not
|
||||
* options passed to `compiler-dom`.
|
||||
*/
|
||||
templateOptions?: Partial<SFCTemplateCompileOptions>;
|
||||
/**
|
||||
* Hoist <script setup> static constants.
|
||||
* - Only enables when one `<script setup>` exists.
|
||||
* @default true
|
||||
*/
|
||||
hoistStatic?: boolean;
|
||||
/**
|
||||
* (**Experimental**) Enable reactive destructure for `defineProps`
|
||||
* @default false
|
||||
*/
|
||||
propsDestructure?: boolean;
|
||||
/**
|
||||
* File system access methods to be used when resolving types
|
||||
* imported in SFC macros. Defaults to ts.sys in Node.js, can be overwritten
|
||||
* to use a virtual file system for use in browsers (e.g. in REPLs)
|
||||
*/
|
||||
fs?: {
|
||||
fileExists(file: string): boolean;
|
||||
readFile(file: string): string | undefined;
|
||||
realpath?(file: string): string;
|
||||
};
|
||||
/**
|
||||
* Transform Vue SFCs into custom elements.
|
||||
*/
|
||||
customElement?: boolean | ((filename: string) => boolean);
|
||||
}
|
||||
interface ImportBinding {
|
||||
isType: boolean;
|
||||
imported: string;
|
||||
local: string;
|
||||
source: string;
|
||||
tips: string[];
|
||||
errors: (string | CompilerError)[];
|
||||
isFromSetup: boolean;
|
||||
isUsedInTemplate: boolean;
|
||||
}
|
||||
/**
|
||||
* Compile `<script setup>`
|
||||
* It requires the whole SFC descriptor because we need to handle and merge
|
||||
* normal `<script>` + `<script setup>` if both are present.
|
||||
*/
|
||||
export declare function compileScript(sfc: SFCDescriptor, options: SFCScriptCompileOptions): SFCScriptBlock;
|
||||
|
||||
export interface SFCParseOptions {
|
||||
filename?: string;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
pad?: boolean | 'line' | 'space';
|
||||
ignoreEmpty?: boolean;
|
||||
compiler?: TemplateCompiler;
|
||||
templateParseOptions?: ParserOptions;
|
||||
/**
|
||||
* TODO remove in 3.5
|
||||
* @deprecated use `templateParseOptions: { prefixIdentifiers: false }` instead
|
||||
*/
|
||||
parseExpressions?: boolean;
|
||||
}
|
||||
export interface SFCBlock {
|
||||
type: string;
|
||||
content: string;
|
||||
attrs: Record<string, string | true>;
|
||||
loc: SourceLocation;
|
||||
map?: RawSourceMap;
|
||||
lang?: string;
|
||||
src?: string;
|
||||
}
|
||||
export interface SFCTemplateBlock extends SFCBlock {
|
||||
type: 'template';
|
||||
ast?: RootNode;
|
||||
}
|
||||
export interface SFCScriptBlock extends SFCBlock {
|
||||
type: 'script';
|
||||
setup?: string | boolean;
|
||||
bindings?: BindingMetadata$1;
|
||||
imports?: Record<string, ImportBinding>;
|
||||
scriptAst?: _babel_types.Statement[];
|
||||
scriptSetupAst?: _babel_types.Statement[];
|
||||
warnings?: string[];
|
||||
/**
|
||||
* Fully resolved dependency file paths (unix slashes) with imported types
|
||||
* used in macros, used for HMR cache busting in @vitejs/plugin-vue and
|
||||
* vue-loader.
|
||||
*/
|
||||
deps?: string[];
|
||||
}
|
||||
export interface SFCStyleBlock extends SFCBlock {
|
||||
type: 'style';
|
||||
scoped?: boolean;
|
||||
module?: string | boolean;
|
||||
}
|
||||
export interface SFCDescriptor {
|
||||
filename: string;
|
||||
source: string;
|
||||
template: SFCTemplateBlock | null;
|
||||
script: SFCScriptBlock | null;
|
||||
scriptSetup: SFCScriptBlock | null;
|
||||
styles: SFCStyleBlock[];
|
||||
customBlocks: SFCBlock[];
|
||||
cssVars: string[];
|
||||
/**
|
||||
* whether the SFC uses :slotted() modifier.
|
||||
* this is used as a compiler optimization hint.
|
||||
*/
|
||||
slotted: boolean;
|
||||
/**
|
||||
* compare with an existing descriptor to determine whether HMR should perform
|
||||
* a reload vs. re-render.
|
||||
*
|
||||
* Note: this comparison assumes the prev/next script are already identical,
|
||||
* and only checks the special case where <script setup lang="ts"> unused import
|
||||
* pruning result changes due to template changes.
|
||||
*/
|
||||
shouldForceReload: (prevImports: Record<string, ImportBinding>) => boolean;
|
||||
}
|
||||
export interface SFCParseResult {
|
||||
descriptor: SFCDescriptor;
|
||||
errors: (CompilerError | SyntaxError)[];
|
||||
}
|
||||
export declare function parse(source: string, options?: SFCParseOptions): SFCParseResult;
|
||||
|
||||
type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus';
|
||||
|
||||
export interface SFCStyleCompileOptions {
|
||||
source: string;
|
||||
filename: string;
|
||||
id: string;
|
||||
scoped?: boolean;
|
||||
trim?: boolean;
|
||||
isProd?: boolean;
|
||||
inMap?: RawSourceMap;
|
||||
preprocessLang?: PreprocessLang;
|
||||
preprocessOptions?: any;
|
||||
preprocessCustomRequire?: (id: string) => any;
|
||||
postcssOptions?: any;
|
||||
postcssPlugins?: any[];
|
||||
/**
|
||||
* @deprecated use `inMap` instead.
|
||||
*/
|
||||
map?: RawSourceMap;
|
||||
}
|
||||
/**
|
||||
* Aligns with postcss-modules
|
||||
* https://github.com/css-modules/postcss-modules
|
||||
*/
|
||||
interface CSSModulesOptions {
|
||||
scopeBehaviour?: 'global' | 'local';
|
||||
generateScopedName?: string | ((name: string, filename: string, css: string) => string);
|
||||
hashPrefix?: string;
|
||||
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
|
||||
exportGlobals?: boolean;
|
||||
globalModulePaths?: RegExp[];
|
||||
}
|
||||
export interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions {
|
||||
isAsync?: boolean;
|
||||
modules?: boolean;
|
||||
modulesOptions?: CSSModulesOptions;
|
||||
}
|
||||
export interface SFCStyleCompileResults {
|
||||
code: string;
|
||||
map: RawSourceMap | undefined;
|
||||
rawResult: Result | LazyResult | undefined;
|
||||
errors: Error[];
|
||||
modules?: Record<string, string>;
|
||||
dependencies: Set<string>;
|
||||
}
|
||||
export declare function compileStyle(options: SFCStyleCompileOptions): SFCStyleCompileResults;
|
||||
export declare function compileStyleAsync(options: SFCAsyncStyleCompileOptions): Promise<SFCStyleCompileResults>;
|
||||
|
||||
export { shouldTransformRef }
|
||||
export declare function rewriteDefault(input: string, as: string, parserPlugins?: ParserPlugin[]): string;
|
||||
/**
|
||||
* Utility for rewriting `export default` in a script block into a variable
|
||||
* declaration so that we can inject things into it
|
||||
*/
|
||||
export declare function rewriteDefaultAST(ast: Statement[], s: MagicString, as: string): void;
|
||||
|
||||
export declare interface TemplateCompiler {
|
||||
compile(template: string, options: CompilerOptions): CodegenResult;
|
||||
parse(template: string, options: ParserOptions): RootNode;
|
||||
type PropsDestructureBindings = Record<string, // public prop key
|
||||
{
|
||||
local: string;
|
||||
default?: Expression;
|
||||
}>;
|
||||
export declare function extractRuntimeProps(ctx: TypeResolveContext): string | undefined;
|
||||
|
||||
interface ModelDecl {
|
||||
type: TSType | undefined;
|
||||
options: string | undefined;
|
||||
identifier: string | undefined;
|
||||
runtimeOptionNodes: Node[];
|
||||
}
|
||||
|
||||
export { transformRef }
|
||||
declare enum BindingTypes {
|
||||
/**
|
||||
* returned from data()
|
||||
*/
|
||||
DATA = "data",
|
||||
/**
|
||||
* declared as a prop
|
||||
*/
|
||||
PROPS = "props",
|
||||
/**
|
||||
* a local alias of a `<script setup>` destructured prop.
|
||||
* the original is stored in __propsAliases of the bindingMetadata object.
|
||||
*/
|
||||
PROPS_ALIASED = "props-aliased",
|
||||
/**
|
||||
* a let binding (may or may not be a ref)
|
||||
*/
|
||||
SETUP_LET = "setup-let",
|
||||
/**
|
||||
* a const binding that can never be a ref.
|
||||
* these bindings don't need `unref()` calls when processed in inlined
|
||||
* template expressions.
|
||||
*/
|
||||
SETUP_CONST = "setup-const",
|
||||
/**
|
||||
* a const binding that does not need `unref()`, but may be mutated.
|
||||
*/
|
||||
SETUP_REACTIVE_CONST = "setup-reactive-const",
|
||||
/**
|
||||
* a const binding that may be a ref.
|
||||
*/
|
||||
SETUP_MAYBE_REF = "setup-maybe-ref",
|
||||
/**
|
||||
* bindings that are guaranteed to be refs
|
||||
*/
|
||||
SETUP_REF = "setup-ref",
|
||||
/**
|
||||
* declared by other options, e.g. computed, inject
|
||||
*/
|
||||
OPTIONS = "options",
|
||||
/**
|
||||
* a literal constant, e.g. 'foo', 1, true
|
||||
*/
|
||||
LITERAL_CONST = "literal-const"
|
||||
}
|
||||
type BindingMetadata = {
|
||||
[key: string]: BindingTypes | undefined;
|
||||
} & {
|
||||
__isScriptSetup?: boolean;
|
||||
__propsAliases?: Record<string, string>;
|
||||
};
|
||||
|
||||
export { transformRefAST }
|
||||
export declare class ScriptCompileContext {
|
||||
descriptor: SFCDescriptor;
|
||||
options: Partial<SFCScriptCompileOptions>;
|
||||
isJS: boolean;
|
||||
isTS: boolean;
|
||||
isCE: boolean;
|
||||
scriptAst: Program | null;
|
||||
scriptSetupAst: Program | null;
|
||||
source: string;
|
||||
filename: string;
|
||||
s: MagicString;
|
||||
startOffset: number | undefined;
|
||||
endOffset: number | undefined;
|
||||
scope?: TypeScope;
|
||||
globalScopes?: TypeScope[];
|
||||
userImports: Record<string, ImportBinding>;
|
||||
hasDefinePropsCall: boolean;
|
||||
hasDefineEmitCall: boolean;
|
||||
hasDefineExposeCall: boolean;
|
||||
hasDefaultExportName: boolean;
|
||||
hasDefaultExportRender: boolean;
|
||||
hasDefineOptionsCall: boolean;
|
||||
hasDefineSlotsCall: boolean;
|
||||
hasDefineModelCall: boolean;
|
||||
propsCall: CallExpression | undefined;
|
||||
propsDecl: Node | undefined;
|
||||
propsRuntimeDecl: Node | undefined;
|
||||
propsTypeDecl: Node | undefined;
|
||||
propsDestructureDecl: ObjectPattern | undefined;
|
||||
propsDestructuredBindings: PropsDestructureBindings;
|
||||
propsDestructureRestId: string | undefined;
|
||||
propsRuntimeDefaults: Node | undefined;
|
||||
emitsRuntimeDecl: Node | undefined;
|
||||
emitsTypeDecl: Node | undefined;
|
||||
emitDecl: Node | undefined;
|
||||
modelDecls: Record<string, ModelDecl>;
|
||||
optionsRuntimeDecl: Node | undefined;
|
||||
bindingMetadata: BindingMetadata;
|
||||
helperImports: Set<string>;
|
||||
helper(key: string): string;
|
||||
/**
|
||||
* to be exposed on compiled script block for HMR cache busting
|
||||
*/
|
||||
deps?: Set<string>;
|
||||
/**
|
||||
* cache for resolved fs
|
||||
*/
|
||||
fs?: NonNullable<SFCScriptCompileOptions['fs']>;
|
||||
constructor(descriptor: SFCDescriptor, options: Partial<SFCScriptCompileOptions>);
|
||||
getString(node: Node, scriptSetup?: boolean): string;
|
||||
error(msg: string, node: Node, scope?: TypeScope): never;
|
||||
}
|
||||
|
||||
export type SimpleTypeResolveOptions = Partial<Pick<SFCScriptCompileOptions, 'globalTypeFiles' | 'fs' | 'babelParserPlugins' | 'isProd'>>;
|
||||
/**
|
||||
* TypeResolveContext is compatible with ScriptCompileContext
|
||||
* but also allows a simpler version of it with minimal required properties
|
||||
* when resolveType needs to be used in a non-SFC context, e.g. in a babel
|
||||
* plugin. The simplest context can be just:
|
||||
* ```ts
|
||||
* const ctx: SimpleTypeResolveContext = {
|
||||
* filename: '...',
|
||||
* source: '...',
|
||||
* options: {},
|
||||
* error() {},
|
||||
* ast: []
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'helper' | 'getString' | 'propsTypeDecl' | 'propsRuntimeDefaults' | 'propsDestructuredBindings' | 'emitsTypeDecl' | 'isCE'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & {
|
||||
ast: Statement[];
|
||||
options: SimpleTypeResolveOptions;
|
||||
};
|
||||
export type TypeResolveContext = ScriptCompileContext | SimpleTypeResolveContext;
|
||||
type Import = Pick<ImportBinding, 'source' | 'imported'>;
|
||||
interface WithScope {
|
||||
_ownerScope: TypeScope;
|
||||
}
|
||||
type ScopeTypeNode = Node & WithScope & {
|
||||
_ns?: TSModuleDeclaration & WithScope;
|
||||
};
|
||||
declare class TypeScope {
|
||||
filename: string;
|
||||
source: string;
|
||||
offset: number;
|
||||
imports: Record<string, Import>;
|
||||
types: Record<string, ScopeTypeNode>;
|
||||
declares: Record<string, ScopeTypeNode>;
|
||||
constructor(filename: string, source: string, offset?: number, imports?: Record<string, Import>, types?: Record<string, ScopeTypeNode>, declares?: Record<string, ScopeTypeNode>);
|
||||
isGenericScope: boolean;
|
||||
resolvedImportSources: Record<string, string>;
|
||||
exportedTypes: Record<string, ScopeTypeNode>;
|
||||
exportedDeclares: Record<string, ScopeTypeNode>;
|
||||
}
|
||||
interface MaybeWithScope {
|
||||
_ownerScope?: TypeScope;
|
||||
}
|
||||
interface ResolvedElements {
|
||||
props: Record<string, (TSPropertySignature | TSMethodSignature) & {
|
||||
_ownerScope: TypeScope;
|
||||
}>;
|
||||
calls?: (TSCallSignatureDeclaration | TSFunctionType)[];
|
||||
}
|
||||
/**
|
||||
* Resolve arbitrary type node to a list of type elements that can be then
|
||||
* mapped to runtime props or emits.
|
||||
*/
|
||||
export declare function resolveTypeElements(ctx: TypeResolveContext, node: Node & MaybeWithScope & {
|
||||
_resolvedElements?: ResolvedElements;
|
||||
}, scope?: TypeScope, typeParameters?: Record<string, Node>): ResolvedElements;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare function registerTS(_loadTS: () => typeof TS): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare function invalidateTypeCache(filename: string): void;
|
||||
export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope): string[];
|
||||
|
||||
export declare function extractRuntimeEmits(ctx: TypeResolveContext): Set<string>;
|
||||
|
||||
export declare const version: string;
|
||||
|
||||
export declare const parseCache: Map<string, SFCParseResult>;
|
||||
export declare const errorMessages: {
|
||||
0: string;
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
4: string;
|
||||
5: string;
|
||||
6: string;
|
||||
7: string;
|
||||
8: string;
|
||||
9: string;
|
||||
10: string;
|
||||
11: string;
|
||||
12: string;
|
||||
13: string;
|
||||
14: string;
|
||||
15: string;
|
||||
16: string;
|
||||
17: string;
|
||||
18: string;
|
||||
19: string;
|
||||
20: string;
|
||||
21: string;
|
||||
22: string;
|
||||
23: string;
|
||||
24: string;
|
||||
25: string;
|
||||
26: string;
|
||||
27: string;
|
||||
28: string;
|
||||
29: string;
|
||||
30: string;
|
||||
31: string;
|
||||
32: string;
|
||||
33: string;
|
||||
34: string;
|
||||
35: string;
|
||||
36: string;
|
||||
37: string;
|
||||
38: string;
|
||||
39: string;
|
||||
40: string;
|
||||
41: string;
|
||||
42: string;
|
||||
43: string;
|
||||
44: string;
|
||||
45: string;
|
||||
46: string;
|
||||
47: string;
|
||||
48: string;
|
||||
49: string;
|
||||
50: string;
|
||||
51: string;
|
||||
52: string;
|
||||
};
|
||||
|
||||
export declare const walk: any;
|
||||
|
||||
export { walkIdentifiers }
|
||||
/**
|
||||
* @deprecated this is preserved to avoid breaking vite-plugin-vue < 5.0
|
||||
* with reactivityTransform: true. The desired behavior should be silently
|
||||
* ignoring the option instead of breaking.
|
||||
*/
|
||||
export declare const shouldTransformRef: () => boolean;
|
||||
|
||||
export { }
|
||||
|
||||
+37061
-37746
File diff suppressed because one or more lines are too long
+27
-19
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/compiler-sfc",
|
||||
"version": "3.2.36",
|
||||
"version": "3.4.15",
|
||||
"description": "@vue/compiler-sfc",
|
||||
"main": "dist/compiler-sfc.cjs.js",
|
||||
"module": "dist/compiler-sfc.esm-browser.js",
|
||||
@@ -8,6 +8,16 @@
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/compiler-sfc.d.ts",
|
||||
"node": "./dist/compiler-sfc.cjs.js",
|
||||
"module": "./dist/compiler-sfc.esm-browser.js",
|
||||
"import": "./dist/compiler-sfc.esm-browser.js",
|
||||
"require": "./dist/compiler-sfc.cjs.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerSFC",
|
||||
"formats": [
|
||||
@@ -32,28 +42,26 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.16.4",
|
||||
"@vue/compiler-core": "3.2.36",
|
||||
"@vue/compiler-dom": "3.2.36",
|
||||
"@vue/compiler-ssr": "3.2.36",
|
||||
"@vue/reactivity-transform": "3.2.36",
|
||||
"@vue/shared": "3.2.36",
|
||||
"@babel/parser": "^7.23.6",
|
||||
"estree-walker": "^2.0.2",
|
||||
"magic-string": "^0.25.7",
|
||||
"source-map": "^0.6.1",
|
||||
"postcss": "^8.1.10"
|
||||
"magic-string": "^0.30.5",
|
||||
"postcss": "^8.4.33",
|
||||
"source-map-js": "^1.0.2",
|
||||
"@vue/compiler-core": "3.4.15",
|
||||
"@vue/shared": "3.4.15",
|
||||
"@vue/compiler-dom": "3.4.15",
|
||||
"@vue/compiler-ssr": "3.4.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/estree": "^0.0.48",
|
||||
"@babel/types": "^7.16.0",
|
||||
"@types/lru-cache": "^5.1.0",
|
||||
"pug": "^3.0.1",
|
||||
"sass": "^1.26.9",
|
||||
"@babel/types": "^7.23.6",
|
||||
"@vue/consolidate": "^0.17.3",
|
||||
"hash-sum": "^2.0.0",
|
||||
"lru-cache": "^5.1.1",
|
||||
"lru-cache": "^10.1.0",
|
||||
"merge-source-map": "^1.1.0",
|
||||
"postcss-modules": "^4.0.0",
|
||||
"postcss-selector-parser": "^6.0.4"
|
||||
"minimatch": "^9.0.3",
|
||||
"postcss-modules": "^6.0.0",
|
||||
"postcss-selector-parser": "^6.0.15",
|
||||
"pug": "^3.0.2",
|
||||
"sass": "^1.69.7"
|
||||
}
|
||||
}
|
||||
}
|
||||
+1198
-1105
File diff suppressed because it is too large
Load Diff
+2
-4
@@ -1,6 +1,4 @@
|
||||
import { CodegenResult } from '@vue/compiler-dom';
|
||||
import { CompilerOptions } from '@vue/compiler-dom';
|
||||
import { RootNode, CompilerOptions, CodegenResult } from '@vue/compiler-dom';
|
||||
|
||||
export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
|
||||
export declare function compile(source: string | RootNode, options?: CompilerOptions): CodegenResult;
|
||||
|
||||
export { }
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/compiler-ssr",
|
||||
"version": "3.2.36",
|
||||
"version": "3.4.15",
|
||||
"description": "@vue/compiler-ssr",
|
||||
"main": "dist/compiler-ssr.cjs.js",
|
||||
"types": "dist/compiler-ssr.d.ts",
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36",
|
||||
"@vue/compiler-dom": "3.2.36"
|
||||
"@vue/shared": "3.4.15",
|
||||
"@vue/compiler-dom": "3.4.15"
|
||||
}
|
||||
}
|
||||
}
|
||||
-121
@@ -1,121 +0,0 @@
|
||||
# @vue/reactivity-transform
|
||||
|
||||
> ⚠️ 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!
|
||||
>
|
||||
> Follow https://github.com/vuejs/rfcs/discussions/369 for details and updates.
|
||||
|
||||
## Basic Rules
|
||||
|
||||
- Ref-creating APIs have `$`-prefixed versions that create reactive variables instead. They also do not need to be explicitly imported. These include:
|
||||
- `ref`
|
||||
- `computed`
|
||||
- `shallowRef`
|
||||
- `customRef`
|
||||
- `toRef`
|
||||
- `$()` can be used to destructure an object into reactive variables, or turn existing refs into reactive variables
|
||||
- `$$()` to "escape" the transform, which allows access to underlying refs
|
||||
|
||||
```js
|
||||
import { watchEffect } from 'vue'
|
||||
|
||||
// bind ref as a variable
|
||||
let count = $ref(0)
|
||||
|
||||
watchEffect(() => {
|
||||
// no need for .value
|
||||
console.log(count)
|
||||
})
|
||||
|
||||
// assignments are reactive
|
||||
count++
|
||||
|
||||
// get the actual ref
|
||||
console.log($$(count)) // { value: 1 }
|
||||
```
|
||||
|
||||
Macros can be optionally imported to make it more explicit:
|
||||
|
||||
```js
|
||||
// not necessary, but also works
|
||||
import { $, $ref } from 'vue/macros'
|
||||
|
||||
let count = $ref(0)
|
||||
const { x, y } = $(useMouse())
|
||||
```
|
||||
|
||||
### Global Types
|
||||
|
||||
To enable types for the macros globally, include the following in a `.d.ts` file:
|
||||
|
||||
```ts
|
||||
/// <reference types="vue/macros-global" />
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This 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.
|
||||
|
||||
### `shouldTransform`
|
||||
|
||||
Can be used to do a cheap check to determine whether full transform should be performed.
|
||||
|
||||
```js
|
||||
import { shouldTransform } from '@vue/reactivity-transform'
|
||||
|
||||
shouldTransform(`let a = ref(0)`) // false
|
||||
shouldTransform(`let a = $ref(0)`) // true
|
||||
```
|
||||
|
||||
### `transform`
|
||||
|
||||
```js
|
||||
import { transform } from '@vue/reactivity-transform'
|
||||
|
||||
const src = `let a = $ref(0); a++`
|
||||
const {
|
||||
code, // import { ref as _ref } from 'vue'; let a = (ref(0)); a.value++"
|
||||
map
|
||||
} = transform(src, {
|
||||
filename: 'foo.ts',
|
||||
sourceMap: true,
|
||||
|
||||
// @babel/parser plugins to enable.
|
||||
// 'typescript' and 'jsx' will be auto-inferred from filename if provided,
|
||||
// so in most cases explicit parserPlugins are not necessary
|
||||
parserPlugins: [
|
||||
/* ... */
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
**Options**
|
||||
|
||||
```ts
|
||||
interface RefTransformOptions {
|
||||
filename?: string
|
||||
sourceMap?: boolean // default: false
|
||||
parserPlugins?: ParserPlugin[]
|
||||
importHelpersFrom?: string // default: "vue"
|
||||
}
|
||||
```
|
||||
|
||||
### `transformAST`
|
||||
|
||||
Transform with an existing Babel AST + MagicString instance. This is used internally by `@vue/compiler-sfc` to avoid double parse/transform cost.
|
||||
|
||||
```js
|
||||
import { transformAST } from '@vue/reactivity-transform'
|
||||
import { parse } from '@babel/parser'
|
||||
import MagicString from 'magic-string'
|
||||
|
||||
const src = `let a = $ref(0); a++`
|
||||
const ast = parse(src, { sourceType: 'module' })
|
||||
const s = new MagicString(src)
|
||||
|
||||
const {
|
||||
rootRefs, // ['a']
|
||||
importedHelpers // ['ref']
|
||||
} = transformAST(ast, s)
|
||||
|
||||
console.log(s.toString()) // let a = _ref(0); a.value++
|
||||
```
|
||||
-538
@@ -1,538 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var MagicString = require('magic-string');
|
||||
var estreeWalker = require('estree-walker');
|
||||
var compilerCore = require('@vue/compiler-core');
|
||||
var parser = require('@babel/parser');
|
||||
var shared = require('@vue/shared');
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
||||
|
||||
var MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
|
||||
|
||||
const CONVERT_SYMBOL = '$';
|
||||
const ESCAPE_SYMBOL = '$$';
|
||||
const shorthands = ['ref', 'computed', 'shallowRef', 'toRef', 'customRef'];
|
||||
const transformCheckRE = /[^\w]\$(?:\$|ref|computed|shallowRef)?\s*(\(|\<)/;
|
||||
function shouldTransform(src) {
|
||||
return transformCheckRE.test(src);
|
||||
}
|
||||
function transform(src, { filename, sourceMap, parserPlugins, importHelpersFrom = 'vue' } = {}) {
|
||||
const plugins = parserPlugins || [];
|
||||
if (filename) {
|
||||
if (/\.tsx?$/.test(filename)) {
|
||||
plugins.push('typescript');
|
||||
}
|
||||
if (filename.endsWith('x')) {
|
||||
plugins.push('jsx');
|
||||
}
|
||||
}
|
||||
const ast = parser.parse(src, {
|
||||
sourceType: 'module',
|
||||
plugins
|
||||
});
|
||||
const s = new MagicString__default(src);
|
||||
const res = transformAST(ast.program, s, 0);
|
||||
// inject helper imports
|
||||
if (res.importedHelpers.length) {
|
||||
s.prepend(`import { ${res.importedHelpers
|
||||
.map(h => `${h} as _${h}`)
|
||||
.join(', ')} } from '${importHelpersFrom}'\n`);
|
||||
}
|
||||
return {
|
||||
...res,
|
||||
code: s.toString(),
|
||||
map: sourceMap
|
||||
? s.generateMap({
|
||||
source: filename,
|
||||
hires: true,
|
||||
includeContent: true
|
||||
})
|
||||
: null
|
||||
};
|
||||
}
|
||||
function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
||||
// TODO remove when out of experimental
|
||||
warnExperimental();
|
||||
let convertSymbol = CONVERT_SYMBOL;
|
||||
let escapeSymbol = ESCAPE_SYMBOL;
|
||||
// macro import handling
|
||||
for (const node of ast.body) {
|
||||
if (node.type === 'ImportDeclaration' &&
|
||||
node.source.value === 'vue/macros') {
|
||||
// remove macro imports
|
||||
s.remove(node.start + offset, node.end + offset);
|
||||
// check aliasing
|
||||
for (const specifier of node.specifiers) {
|
||||
if (specifier.type === 'ImportSpecifier') {
|
||||
const imported = specifier.imported.name;
|
||||
const local = specifier.local.name;
|
||||
if (local !== imported) {
|
||||
if (imported === ESCAPE_SYMBOL) {
|
||||
escapeSymbol = local;
|
||||
}
|
||||
else if (imported === CONVERT_SYMBOL) {
|
||||
convertSymbol = local;
|
||||
}
|
||||
else {
|
||||
error(`macro imports for ref-creating methods do not support aliasing.`, specifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const importedHelpers = new Set();
|
||||
const rootScope = {};
|
||||
const scopeStack = [rootScope];
|
||||
let currentScope = rootScope;
|
||||
let escapeScope; // inside $$()
|
||||
const excludedIds = new WeakSet();
|
||||
const parentStack = [];
|
||||
const propsLocalToPublicMap = Object.create(null);
|
||||
if (knownRefs) {
|
||||
for (const key of knownRefs) {
|
||||
rootScope[key] = true;
|
||||
}
|
||||
}
|
||||
if (knownProps) {
|
||||
for (const key in knownProps) {
|
||||
const { local } = knownProps[key];
|
||||
rootScope[local] = 'prop';
|
||||
propsLocalToPublicMap[local] = key;
|
||||
}
|
||||
}
|
||||
function isRefCreationCall(callee) {
|
||||
if (callee === convertSymbol) {
|
||||
return convertSymbol;
|
||||
}
|
||||
if (callee[0] === '$' && shorthands.includes(callee.slice(1))) {
|
||||
return callee;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function error(msg, node) {
|
||||
const e = new Error(msg);
|
||||
e.node = node;
|
||||
throw e;
|
||||
}
|
||||
function helper(msg) {
|
||||
importedHelpers.add(msg);
|
||||
return `_${msg}`;
|
||||
}
|
||||
function registerBinding(id, isRef = false) {
|
||||
excludedIds.add(id);
|
||||
if (currentScope) {
|
||||
currentScope[id.name] = isRef;
|
||||
}
|
||||
else {
|
||||
error('registerBinding called without active scope, something is wrong.', id);
|
||||
}
|
||||
}
|
||||
const registerRefBinding = (id) => registerBinding(id, true);
|
||||
let tempVarCount = 0;
|
||||
function genTempVar() {
|
||||
return `__$temp_${++tempVarCount}`;
|
||||
}
|
||||
function snip(node) {
|
||||
return s.original.slice(node.start + offset, node.end + offset);
|
||||
}
|
||||
function walkScope(node, isRoot = false) {
|
||||
for (const stmt of node.body) {
|
||||
if (stmt.type === 'VariableDeclaration') {
|
||||
walkVariableDeclaration(stmt, isRoot);
|
||||
}
|
||||
else if (stmt.type === 'FunctionDeclaration' ||
|
||||
stmt.type === 'ClassDeclaration') {
|
||||
if (stmt.declare || !stmt.id)
|
||||
continue;
|
||||
registerBinding(stmt.id);
|
||||
}
|
||||
else if ((stmt.type === 'ForOfStatement' || stmt.type === 'ForInStatement') &&
|
||||
stmt.left.type === 'VariableDeclaration') {
|
||||
walkVariableDeclaration(stmt.left);
|
||||
}
|
||||
else if (stmt.type === 'ExportNamedDeclaration' &&
|
||||
stmt.declaration &&
|
||||
stmt.declaration.type === 'VariableDeclaration') {
|
||||
walkVariableDeclaration(stmt.declaration, isRoot);
|
||||
}
|
||||
else if (stmt.type === 'LabeledStatement' &&
|
||||
stmt.body.type === 'VariableDeclaration') {
|
||||
walkVariableDeclaration(stmt.body, isRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
function walkVariableDeclaration(stmt, isRoot = false) {
|
||||
if (stmt.declare) {
|
||||
return;
|
||||
}
|
||||
for (const decl of stmt.declarations) {
|
||||
let refCall;
|
||||
const isCall = decl.init &&
|
||||
decl.init.type === 'CallExpression' &&
|
||||
decl.init.callee.type === 'Identifier';
|
||||
if (isCall &&
|
||||
(refCall = isRefCreationCall(decl.init.callee.name))) {
|
||||
processRefDeclaration(refCall, decl.id, decl.init);
|
||||
}
|
||||
else {
|
||||
const isProps = isRoot && isCall && decl.init.callee.name === 'defineProps';
|
||||
for (const id of compilerCore.extractIdentifiers(decl.id)) {
|
||||
if (isProps) {
|
||||
// for defineProps destructure, only exclude them since they
|
||||
// are already passed in as knownProps
|
||||
excludedIds.add(id);
|
||||
}
|
||||
else {
|
||||
registerBinding(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function processRefDeclaration(method, id, call) {
|
||||
excludedIds.add(call.callee);
|
||||
if (method === convertSymbol) {
|
||||
// $
|
||||
// remove macro
|
||||
s.remove(call.callee.start + offset, call.callee.end + offset);
|
||||
if (id.type === 'Identifier') {
|
||||
// single variable
|
||||
registerRefBinding(id);
|
||||
}
|
||||
else if (id.type === 'ObjectPattern') {
|
||||
processRefObjectPattern(id, call);
|
||||
}
|
||||
else if (id.type === 'ArrayPattern') {
|
||||
processRefArrayPattern(id, call);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// shorthands
|
||||
if (id.type === 'Identifier') {
|
||||
registerRefBinding(id);
|
||||
// replace call
|
||||
s.overwrite(call.start + offset, call.start + method.length + offset, helper(method.slice(1)));
|
||||
}
|
||||
else {
|
||||
error(`${method}() cannot be used with destructure patterns.`, call);
|
||||
}
|
||||
}
|
||||
}
|
||||
function processRefObjectPattern(pattern, call, tempVar, path = []) {
|
||||
if (!tempVar) {
|
||||
tempVar = genTempVar();
|
||||
// const { x } = $(useFoo()) --> const __$temp_1 = useFoo()
|
||||
s.overwrite(pattern.start + offset, pattern.end + offset, tempVar);
|
||||
}
|
||||
for (const p of pattern.properties) {
|
||||
let nameId;
|
||||
let key;
|
||||
let defaultValue;
|
||||
if (p.type === 'ObjectProperty') {
|
||||
if (p.key.start === p.value.start) {
|
||||
// shorthand { foo }
|
||||
nameId = p.key;
|
||||
if (p.value.type === 'Identifier') {
|
||||
// avoid shorthand value identifier from being processed
|
||||
excludedIds.add(p.value);
|
||||
}
|
||||
else if (p.value.type === 'AssignmentPattern' &&
|
||||
p.value.left.type === 'Identifier') {
|
||||
// { foo = 1 }
|
||||
excludedIds.add(p.value.left);
|
||||
defaultValue = p.value.right;
|
||||
}
|
||||
}
|
||||
else {
|
||||
key = p.computed ? p.key : p.key.name;
|
||||
if (p.value.type === 'Identifier') {
|
||||
// { foo: bar }
|
||||
nameId = p.value;
|
||||
}
|
||||
else if (p.value.type === 'ObjectPattern') {
|
||||
processRefObjectPattern(p.value, call, tempVar, [...path, key]);
|
||||
}
|
||||
else if (p.value.type === 'ArrayPattern') {
|
||||
processRefArrayPattern(p.value, call, tempVar, [...path, key]);
|
||||
}
|
||||
else if (p.value.type === 'AssignmentPattern') {
|
||||
if (p.value.left.type === 'Identifier') {
|
||||
// { foo: bar = 1 }
|
||||
nameId = p.value.left;
|
||||
defaultValue = p.value.right;
|
||||
}
|
||||
else if (p.value.left.type === 'ObjectPattern') {
|
||||
processRefObjectPattern(p.value.left, call, tempVar, [
|
||||
...path,
|
||||
[key, p.value.right]
|
||||
]);
|
||||
}
|
||||
else if (p.value.left.type === 'ArrayPattern') {
|
||||
processRefArrayPattern(p.value.left, call, tempVar, [
|
||||
...path,
|
||||
[key, p.value.right]
|
||||
]);
|
||||
}
|
||||
else ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// rest element { ...foo }
|
||||
error(`reactivity destructure does not support rest elements.`, p);
|
||||
}
|
||||
if (nameId) {
|
||||
registerRefBinding(nameId);
|
||||
// inject toRef() after original replaced pattern
|
||||
const source = pathToString(tempVar, path);
|
||||
const keyStr = shared.isString(key)
|
||||
? `'${key}'`
|
||||
: key
|
||||
? snip(key)
|
||||
: `'${nameId.name}'`;
|
||||
const defaultStr = defaultValue ? `, ${snip(defaultValue)}` : ``;
|
||||
s.appendLeft(call.end + offset, `,\n ${nameId.name} = ${helper('toRef')}(${source}, ${keyStr}${defaultStr})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function processRefArrayPattern(pattern, call, tempVar, path = []) {
|
||||
if (!tempVar) {
|
||||
// const [x] = $(useFoo()) --> const __$temp_1 = useFoo()
|
||||
tempVar = genTempVar();
|
||||
s.overwrite(pattern.start + offset, pattern.end + offset, tempVar);
|
||||
}
|
||||
for (let i = 0; i < pattern.elements.length; i++) {
|
||||
const e = pattern.elements[i];
|
||||
if (!e)
|
||||
continue;
|
||||
let nameId;
|
||||
let defaultValue;
|
||||
if (e.type === 'Identifier') {
|
||||
// [a] --> [__a]
|
||||
nameId = e;
|
||||
}
|
||||
else if (e.type === 'AssignmentPattern') {
|
||||
// [a = 1]
|
||||
nameId = e.left;
|
||||
defaultValue = e.right;
|
||||
}
|
||||
else if (e.type === 'RestElement') {
|
||||
// [...a]
|
||||
error(`reactivity destructure does not support rest elements.`, e);
|
||||
}
|
||||
else if (e.type === 'ObjectPattern') {
|
||||
processRefObjectPattern(e, call, tempVar, [...path, i]);
|
||||
}
|
||||
else if (e.type === 'ArrayPattern') {
|
||||
processRefArrayPattern(e, call, tempVar, [...path, i]);
|
||||
}
|
||||
if (nameId) {
|
||||
registerRefBinding(nameId);
|
||||
// inject toRef() after original replaced pattern
|
||||
const source = pathToString(tempVar, path);
|
||||
const defaultStr = defaultValue ? `, ${snip(defaultValue)}` : ``;
|
||||
s.appendLeft(call.end + offset, `,\n ${nameId.name} = ${helper('toRef')}(${source}, ${i}${defaultStr})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function pathToString(source, path) {
|
||||
if (path.length) {
|
||||
for (const seg of path) {
|
||||
if (shared.isArray(seg)) {
|
||||
source = `(${source}${segToString(seg[0])} || ${snip(seg[1])})`;
|
||||
}
|
||||
else {
|
||||
source += segToString(seg);
|
||||
}
|
||||
}
|
||||
}
|
||||
return source;
|
||||
}
|
||||
function segToString(seg) {
|
||||
if (typeof seg === 'number') {
|
||||
return `[${seg}]`;
|
||||
}
|
||||
else if (typeof seg === 'string') {
|
||||
return `.${seg}`;
|
||||
}
|
||||
else {
|
||||
return snip(seg);
|
||||
}
|
||||
}
|
||||
function rewriteId(scope, id, parent, parentStack) {
|
||||
if (shared.hasOwn(scope, id.name)) {
|
||||
const bindingType = scope[id.name];
|
||||
if (bindingType) {
|
||||
const isProp = bindingType === 'prop';
|
||||
if (compilerCore.isStaticProperty(parent) && parent.shorthand) {
|
||||
// let binding used in a property shorthand
|
||||
// skip for destructure patterns
|
||||
if (!parent.inPattern ||
|
||||
compilerCore.isInDestructureAssignment(parent, parentStack)) {
|
||||
if (isProp) {
|
||||
if (escapeScope) {
|
||||
// prop binding in $$()
|
||||
// { prop } -> { prop: __props_prop }
|
||||
registerEscapedPropBinding(id);
|
||||
s.appendLeft(id.end + offset, `: __props_${propsLocalToPublicMap[id.name]}`);
|
||||
}
|
||||
else {
|
||||
// { prop } -> { prop: __props.prop }
|
||||
s.appendLeft(id.end + offset, `: ${shared.genPropsAccessExp(propsLocalToPublicMap[id.name])}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// { foo } -> { foo: foo.value }
|
||||
s.appendLeft(id.end + offset, `: ${id.name}.value`);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isProp) {
|
||||
if (escapeScope) {
|
||||
// x --> __props_x
|
||||
registerEscapedPropBinding(id);
|
||||
s.overwrite(id.start + offset, id.end + offset, `__props_${propsLocalToPublicMap[id.name]}`);
|
||||
}
|
||||
else {
|
||||
// x --> __props.x
|
||||
s.overwrite(id.start + offset, id.end + offset, shared.genPropsAccessExp(propsLocalToPublicMap[id.name]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
// x --> x.value
|
||||
s.appendLeft(id.end + offset, '.value');
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const propBindingRefs = {};
|
||||
function registerEscapedPropBinding(id) {
|
||||
if (!propBindingRefs.hasOwnProperty(id.name)) {
|
||||
propBindingRefs[id.name] = true;
|
||||
const publicKey = propsLocalToPublicMap[id.name];
|
||||
s.prependRight(offset, `const __props_${publicKey} = ${helper(`toRef`)}(__props, '${publicKey}')\n`);
|
||||
}
|
||||
}
|
||||
// check root scope first
|
||||
walkScope(ast, true);
|
||||
estreeWalker.walk(ast, {
|
||||
enter(node, parent) {
|
||||
parent && parentStack.push(parent);
|
||||
// function scopes
|
||||
if (compilerCore.isFunctionType(node)) {
|
||||
scopeStack.push((currentScope = {}));
|
||||
compilerCore.walkFunctionParams(node, registerBinding);
|
||||
if (node.body.type === 'BlockStatement') {
|
||||
walkScope(node.body);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// catch param
|
||||
if (node.type === 'CatchClause') {
|
||||
scopeStack.push((currentScope = {}));
|
||||
if (node.param && node.param.type === 'Identifier') {
|
||||
registerBinding(node.param);
|
||||
}
|
||||
walkScope(node.body);
|
||||
return;
|
||||
}
|
||||
// non-function block scopes
|
||||
if (node.type === 'BlockStatement' && !compilerCore.isFunctionType(parent)) {
|
||||
scopeStack.push((currentScope = {}));
|
||||
walkScope(node);
|
||||
return;
|
||||
}
|
||||
// skip type nodes
|
||||
if (parent &&
|
||||
parent.type.startsWith('TS') &&
|
||||
parent.type !== 'TSAsExpression' &&
|
||||
parent.type !== 'TSNonNullExpression' &&
|
||||
parent.type !== 'TSTypeAssertion') {
|
||||
return this.skip();
|
||||
}
|
||||
if (node.type === 'Identifier' &&
|
||||
// if inside $$(), skip unless this is a destructured prop binding
|
||||
!(escapeScope && rootScope[node.name] !== 'prop') &&
|
||||
compilerCore.isReferencedIdentifier(node, parent, parentStack) &&
|
||||
!excludedIds.has(node)) {
|
||||
// walk up the scope chain to check if id should be appended .value
|
||||
let i = scopeStack.length;
|
||||
while (i--) {
|
||||
if (rewriteId(scopeStack[i], node, parent, parentStack)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.type === 'CallExpression' && node.callee.type === 'Identifier') {
|
||||
const callee = node.callee.name;
|
||||
const refCall = isRefCreationCall(callee);
|
||||
if (refCall && (!parent || parent.type !== 'VariableDeclarator')) {
|
||||
return error(`${refCall} can only be used as the initializer of ` +
|
||||
`a variable declaration.`, node);
|
||||
}
|
||||
if (callee === escapeSymbol) {
|
||||
s.remove(node.callee.start + offset, node.callee.end + offset);
|
||||
escapeScope = node;
|
||||
}
|
||||
// TODO remove when out of experimental
|
||||
if (callee === '$raw') {
|
||||
error(`$raw() has been replaced by $$(). ` +
|
||||
`See ${RFC_LINK} for latest updates.`, node);
|
||||
}
|
||||
if (callee === '$fromRef') {
|
||||
error(`$fromRef() has been replaced by $(). ` +
|
||||
`See ${RFC_LINK} for latest updates.`, node);
|
||||
}
|
||||
}
|
||||
},
|
||||
leave(node, parent) {
|
||||
parent && parentStack.pop();
|
||||
if ((node.type === 'BlockStatement' && !compilerCore.isFunctionType(parent)) ||
|
||||
compilerCore.isFunctionType(node)) {
|
||||
scopeStack.pop();
|
||||
currentScope = scopeStack[scopeStack.length - 1] || null;
|
||||
}
|
||||
if (node === escapeScope) {
|
||||
escapeScope = undefined;
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
rootRefs: Object.keys(rootScope).filter(key => rootScope[key] === true),
|
||||
importedHelpers: [...importedHelpers]
|
||||
};
|
||||
}
|
||||
const RFC_LINK = `https://github.com/vuejs/rfcs/discussions/369`;
|
||||
const hasWarned = {};
|
||||
function warnExperimental() {
|
||||
// eslint-disable-next-line
|
||||
if (typeof window !== 'undefined') {
|
||||
return;
|
||||
}
|
||||
warnOnce(`Reactivity transform is an experimental feature.\n` +
|
||||
`Experimental features may change behavior between patch versions.\n` +
|
||||
`It is recommended to pin your vue dependencies to exact versions to avoid breakage.\n` +
|
||||
`You can follow the proposal's status at ${RFC_LINK}.`);
|
||||
}
|
||||
function warnOnce(msg) {
|
||||
const isNodeProd = typeof process !== 'undefined' && process.env.NODE_ENV === 'production';
|
||||
if (!isNodeProd && !false && !hasWarned[msg]) {
|
||||
hasWarned[msg] = true;
|
||||
warn(msg);
|
||||
}
|
||||
}
|
||||
function warn(msg) {
|
||||
console.warn(`\x1b[1m\x1b[33m[@vue/reactivity-transform]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`);
|
||||
}
|
||||
|
||||
exports.shouldTransform = shouldTransform;
|
||||
exports.transform = transform;
|
||||
exports.transformAST = transformAST;
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
import MagicString from 'magic-string';
|
||||
import { ParserPlugin } from '@babel/parser';
|
||||
import { Program } from '@babel/types';
|
||||
import { SourceMap } from 'magic-string';
|
||||
|
||||
export declare interface RefTransformOptions {
|
||||
filename?: string;
|
||||
sourceMap?: boolean;
|
||||
parserPlugins?: ParserPlugin[];
|
||||
importHelpersFrom?: string;
|
||||
}
|
||||
|
||||
export declare interface RefTransformResults {
|
||||
code: string;
|
||||
map: SourceMap | null;
|
||||
rootRefs: string[];
|
||||
importedHelpers: string[];
|
||||
}
|
||||
|
||||
export declare function shouldTransform(src: string): boolean;
|
||||
|
||||
export declare function transform(src: string, { filename, sourceMap, parserPlugins, importHelpersFrom }?: RefTransformOptions): RefTransformResults;
|
||||
|
||||
export declare function transformAST(ast: Program, s: MagicString, offset?: number, knownRefs?: string[], knownProps?: Record<string, // public prop key
|
||||
{
|
||||
local: string;
|
||||
default?: any;
|
||||
}>): {
|
||||
rootRefs: string[];
|
||||
importedHelpers: string[];
|
||||
};
|
||||
|
||||
export { }
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"name": "@vue/reactivity-transform",
|
||||
"version": "3.2.36",
|
||||
"description": "@vue/reactivity-transform",
|
||||
"main": "dist/reactivity-transform.cjs.js",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"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"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/dev/packages/reactivity-transform#readme",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.16.4",
|
||||
"@vue/compiler-core": "3.2.36",
|
||||
"@vue/shared": "3.2.36",
|
||||
"estree-walker": "^2.0.2",
|
||||
"magic-string": "^0.25.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.16.0",
|
||||
"@babel/types": "^7.16.0"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
This package is inlined into Global & Browser ESM builds of user-facing renderers (e.g. `@vue/runtime-dom`), but also published as a package that can be used standalone. The standalone build should not be used alongside a pre-bundled build of a user-facing renderer, as they will have different internal storage for reactivity connections. A user-facing renderer should re-export all APIs from this package.
|
||||
|
||||
For full exposed APIs, see `src/index.ts`. You can also run `yarn build reactivity --types` from repo root, which will generate an API report at `temp/reactivity.api.md`.
|
||||
For full exposed APIs, see `src/index.ts`.
|
||||
|
||||
## Credits
|
||||
|
||||
|
||||
+1089
-1085
File diff suppressed because it is too large
Load Diff
+1006
-1016
File diff suppressed because it is too large
Load Diff
+607
-297
@@ -1,180 +1,17 @@
|
||||
import { IfAny } from '@vue/shared';
|
||||
|
||||
declare type BaseTypes = string | number | boolean;
|
||||
|
||||
declare type Builtin = Primitive | Function | Date | Error | RegExp;
|
||||
|
||||
declare type CollectionTypes = IterableCollections | WeakCollections;
|
||||
|
||||
export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
|
||||
|
||||
export declare function computed<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions): WritableComputedRef<T>;
|
||||
|
||||
export declare type ComputedGetter<T> = (...args: any[]) => T;
|
||||
|
||||
export declare interface ComputedRef<T = any> extends WritableComputedRef<T> {
|
||||
readonly value: T;
|
||||
[ComputedRefSymbol]: true;
|
||||
export declare enum TrackOpTypes {
|
||||
GET = "get",
|
||||
HAS = "has",
|
||||
ITERATE = "iterate"
|
||||
}
|
||||
|
||||
declare class ComputedRefImpl<T> {
|
||||
private readonly _setter;
|
||||
dep?: Dep;
|
||||
private _value;
|
||||
readonly effect: ReactiveEffect<T>;
|
||||
readonly __v_isRef = true;
|
||||
readonly [ReactiveFlags.IS_READONLY]: boolean;
|
||||
_dirty: boolean;
|
||||
_cacheable: boolean;
|
||||
constructor(getter: ComputedGetter<T>, _setter: ComputedSetter<T>, isReadonly: boolean, isSSR: boolean);
|
||||
get value(): T;
|
||||
set value(newValue: T);
|
||||
export declare enum TriggerOpTypes {
|
||||
SET = "set",
|
||||
ADD = "add",
|
||||
DELETE = "delete",
|
||||
CLEAR = "clear"
|
||||
}
|
||||
|
||||
declare const ComputedRefSymbol: unique symbol;
|
||||
|
||||
export declare type ComputedSetter<T> = (v: T) => void;
|
||||
|
||||
export declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
|
||||
|
||||
export declare type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
|
||||
get: () => T;
|
||||
set: (value: T) => void;
|
||||
};
|
||||
|
||||
export declare type DebuggerEvent = {
|
||||
effect: ReactiveEffect;
|
||||
} & DebuggerEventExtraInfo;
|
||||
|
||||
export declare type DebuggerEventExtraInfo = {
|
||||
target: object;
|
||||
type: TrackOpTypes | TriggerOpTypes;
|
||||
key: any;
|
||||
newValue?: any;
|
||||
oldValue?: any;
|
||||
oldTarget?: Map<any, any> | Set<any>;
|
||||
};
|
||||
|
||||
export declare interface DebuggerOptions {
|
||||
onTrack?: (event: DebuggerEvent) => void;
|
||||
onTrigger?: (event: DebuggerEvent) => void;
|
||||
}
|
||||
|
||||
export declare type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends WeakSet<infer U> ? WeakSet<DeepReadonly<U>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends Ref<infer U> ? Readonly<Ref<DeepReadonly<U>>> : T extends {} ? {
|
||||
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
||||
} : Readonly<T>;
|
||||
|
||||
export declare function deferredComputed<T>(getter: () => T): ComputedRef<T>;
|
||||
|
||||
declare type Dep = Set<ReactiveEffect> & TrackedMarkers;
|
||||
|
||||
export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffectRunner;
|
||||
|
||||
export declare type EffectScheduler = (...args: any[]) => any;
|
||||
|
||||
export declare class EffectScope {
|
||||
/* Excluded from this release type: active */
|
||||
/* Excluded from this release type: effects */
|
||||
/* Excluded from this release type: cleanups */
|
||||
/* Excluded from this release type: parent */
|
||||
/* Excluded from this release type: scopes */
|
||||
/* Excluded from this release type: index */
|
||||
constructor(detached?: boolean);
|
||||
run<T>(fn: () => T): T | undefined;
|
||||
/* Excluded from this release type: on */
|
||||
/* Excluded from this release type: off */
|
||||
stop(fromParent?: boolean): void;
|
||||
}
|
||||
|
||||
export declare function effectScope(detached?: boolean): EffectScope;
|
||||
|
||||
export declare function enableTracking(): void;
|
||||
|
||||
export declare function getCurrentScope(): EffectScope | undefined;
|
||||
|
||||
export declare function isProxy(value: unknown): boolean;
|
||||
|
||||
export declare function isReactive(value: unknown): boolean;
|
||||
|
||||
export declare function isReadonly(value: unknown): boolean;
|
||||
|
||||
export declare function isRef<T>(r: Ref<T> | unknown): r is Ref<T>;
|
||||
|
||||
export declare function isShallow(value: unknown): boolean;
|
||||
|
||||
declare type IterableCollections = Map<any, any> | Set<any>;
|
||||
|
||||
export declare const ITERATE_KEY: unique symbol;
|
||||
|
||||
export declare function markRaw<T extends object>(value: T): T & {
|
||||
[RawSymbol]?: true;
|
||||
};
|
||||
|
||||
export declare function onScopeDispose(fn: () => void): void;
|
||||
|
||||
export declare function pauseTracking(): void;
|
||||
|
||||
declare type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
||||
|
||||
export declare function proxyRefs<T extends object>(objectWithRefs: T): ShallowUnwrapRef<T>;
|
||||
|
||||
declare const RawSymbol: unique symbol;
|
||||
|
||||
/**
|
||||
* Creates a reactive copy of the original object.
|
||||
*
|
||||
* The reactive conversion is "deep"—it affects all nested properties. In the
|
||||
* ES2015 Proxy based implementation, the returned proxy is **not** equal to the
|
||||
* original object. It is recommended to work exclusively with the reactive
|
||||
* proxy and avoid relying on the original object.
|
||||
*
|
||||
* A reactive object also automatically unwraps refs contained in it, so you
|
||||
* don't need to use `.value` when accessing and mutating their value:
|
||||
*
|
||||
* ```js
|
||||
* const count = ref(0)
|
||||
* const obj = reactive({
|
||||
* count
|
||||
* })
|
||||
*
|
||||
* obj.count++
|
||||
* obj.count // -> 1
|
||||
* count.value // -> 1
|
||||
* ```
|
||||
*/
|
||||
export declare function reactive<T extends object>(target: T): UnwrapNestedRefs<T>;
|
||||
|
||||
export declare class ReactiveEffect<T = any> {
|
||||
fn: () => T;
|
||||
scheduler: EffectScheduler | null;
|
||||
active: boolean;
|
||||
deps: Dep[];
|
||||
parent: ReactiveEffect | undefined;
|
||||
/* Excluded from this release type: computed */
|
||||
/* Excluded from this release type: allowRecurse */
|
||||
/* Excluded from this release type: deferStop */
|
||||
onStop?: () => void;
|
||||
onTrack?: (event: DebuggerEvent) => void;
|
||||
onTrigger?: (event: DebuggerEvent) => void;
|
||||
constructor(fn: () => T, scheduler?: EffectScheduler | null, scope?: EffectScope);
|
||||
run(): T | undefined;
|
||||
stop(): void;
|
||||
}
|
||||
|
||||
export declare interface ReactiveEffectOptions extends DebuggerOptions {
|
||||
lazy?: boolean;
|
||||
scheduler?: EffectScheduler;
|
||||
scope?: EffectScope;
|
||||
allowRecurse?: boolean;
|
||||
onStop?: () => void;
|
||||
}
|
||||
|
||||
export declare interface ReactiveEffectRunner<T = any> {
|
||||
(): T;
|
||||
effect: ReactiveEffect;
|
||||
}
|
||||
|
||||
export declare const enum ReactiveFlags {
|
||||
export declare enum ReactiveFlags {
|
||||
SKIP = "__v_skip",
|
||||
IS_REACTIVE = "__v_isReactive",
|
||||
IS_READONLY = "__v_isReadonly",
|
||||
@@ -182,13 +19,393 @@ export declare const enum ReactiveFlags {
|
||||
RAW = "__v_raw"
|
||||
}
|
||||
|
||||
type Dep = Map<ReactiveEffect, number> & {
|
||||
cleanup: () => void;
|
||||
computed?: ComputedRefImpl<any>;
|
||||
};
|
||||
|
||||
export declare class EffectScope {
|
||||
detached: boolean;
|
||||
constructor(detached?: boolean);
|
||||
get active(): boolean;
|
||||
run<T>(fn: () => T): T | undefined;
|
||||
stop(fromParent?: boolean): void;
|
||||
}
|
||||
/**
|
||||
* Creates a readonly copy of the original object. Note the returned copy is not
|
||||
* made reactive, but `readonly` can be called on an already reactive object.
|
||||
* Creates an effect scope object which can capture the reactive effects (i.e.
|
||||
* computed and watchers) created within it so that these effects can be
|
||||
* disposed together. For detailed use cases of this API, please consult its
|
||||
* corresponding {@link https://github.com/vuejs/rfcs/blob/master/active-rfcs/0041-reactivity-effect-scope.md | RFC}.
|
||||
*
|
||||
* @param detached - Can be used to create a "detached" effect scope.
|
||||
* @see {@link https://vuejs.org/api/reactivity-advanced.html#effectscope}
|
||||
*/
|
||||
export declare function effectScope(detached?: boolean): EffectScope;
|
||||
/**
|
||||
* Returns the current active effect scope if there is one.
|
||||
*
|
||||
* @see {@link https://vuejs.org/api/reactivity-advanced.html#getcurrentscope}
|
||||
*/
|
||||
export declare function getCurrentScope(): EffectScope | undefined;
|
||||
/**
|
||||
* Registers a dispose callback on the current active effect scope. The
|
||||
* callback will be invoked when the associated effect scope is stopped.
|
||||
*
|
||||
* @param fn - The callback function to attach to the scope's cleanup.
|
||||
* @see {@link https://vuejs.org/api/reactivity-advanced.html#onscopedispose}
|
||||
*/
|
||||
export declare function onScopeDispose(fn: () => void): void;
|
||||
|
||||
export type EffectScheduler = (...args: any[]) => any;
|
||||
export type DebuggerEvent = {
|
||||
effect: ReactiveEffect;
|
||||
} & DebuggerEventExtraInfo;
|
||||
export type DebuggerEventExtraInfo = {
|
||||
target: object;
|
||||
type: TrackOpTypes | TriggerOpTypes;
|
||||
key: any;
|
||||
newValue?: any;
|
||||
oldValue?: any;
|
||||
oldTarget?: Map<any, any> | Set<any>;
|
||||
};
|
||||
export declare class ReactiveEffect<T = any> {
|
||||
fn: () => T;
|
||||
trigger: () => void;
|
||||
scheduler?: EffectScheduler | undefined;
|
||||
active: boolean;
|
||||
deps: Dep[];
|
||||
onStop?: () => void;
|
||||
onTrack?: (event: DebuggerEvent) => void;
|
||||
onTrigger?: (event: DebuggerEvent) => void;
|
||||
constructor(fn: () => T, trigger: () => void, scheduler?: EffectScheduler | undefined, scope?: EffectScope);
|
||||
get dirty(): boolean;
|
||||
set dirty(v: boolean);
|
||||
run(): T;
|
||||
stop(): void;
|
||||
}
|
||||
export interface DebuggerOptions {
|
||||
onTrack?: (event: DebuggerEvent) => void;
|
||||
onTrigger?: (event: DebuggerEvent) => void;
|
||||
}
|
||||
export interface ReactiveEffectOptions extends DebuggerOptions {
|
||||
lazy?: boolean;
|
||||
scheduler?: EffectScheduler;
|
||||
scope?: EffectScope;
|
||||
allowRecurse?: boolean;
|
||||
onStop?: () => void;
|
||||
}
|
||||
export interface ReactiveEffectRunner<T = any> {
|
||||
(): T;
|
||||
effect: ReactiveEffect;
|
||||
}
|
||||
/**
|
||||
* Registers the given function to track reactive updates.
|
||||
*
|
||||
* The given function will be run once immediately. Every time any reactive
|
||||
* property that's accessed within it gets updated, the function will run again.
|
||||
*
|
||||
* @param fn - The function that will track reactive updates.
|
||||
* @param options - Allows to control the effect's behaviour.
|
||||
* @returns A runner that can be used to control the effect after creation.
|
||||
*/
|
||||
export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffectRunner;
|
||||
/**
|
||||
* Stops the effect associated with the given runner.
|
||||
*
|
||||
* @param runner - Association with the effect to stop tracking.
|
||||
*/
|
||||
export declare function stop(runner: ReactiveEffectRunner): void;
|
||||
/**
|
||||
* Temporarily pauses tracking.
|
||||
*/
|
||||
export declare function pauseTracking(): void;
|
||||
/**
|
||||
* Re-enables effect tracking (if it was paused).
|
||||
*/
|
||||
export declare function enableTracking(): void;
|
||||
/**
|
||||
* Resets the previous global effect tracking state.
|
||||
*/
|
||||
export declare function resetTracking(): void;
|
||||
export declare function pauseScheduling(): void;
|
||||
export declare function resetScheduling(): void;
|
||||
|
||||
declare const ComputedRefSymbol: unique symbol;
|
||||
export interface ComputedRef<T = any> extends WritableComputedRef<T> {
|
||||
readonly value: T;
|
||||
[ComputedRefSymbol]: true;
|
||||
}
|
||||
export interface WritableComputedRef<T> extends Ref<T> {
|
||||
readonly effect: ReactiveEffect<T>;
|
||||
}
|
||||
export type ComputedGetter<T> = (oldValue?: T) => T;
|
||||
export type ComputedSetter<T> = (newValue: T) => void;
|
||||
export interface WritableComputedOptions<T> {
|
||||
get: ComputedGetter<T>;
|
||||
set: ComputedSetter<T>;
|
||||
}
|
||||
declare class ComputedRefImpl<T> {
|
||||
private readonly _setter;
|
||||
dep?: Dep;
|
||||
private _value;
|
||||
readonly effect: ReactiveEffect<T>;
|
||||
readonly __v_isRef = true;
|
||||
readonly [ReactiveFlags.IS_READONLY]: boolean;
|
||||
_cacheable: boolean;
|
||||
constructor(getter: ComputedGetter<T>, _setter: ComputedSetter<T>, isReadonly: boolean, isSSR: boolean);
|
||||
get value(): T;
|
||||
set value(newValue: T);
|
||||
get _dirty(): boolean;
|
||||
set _dirty(v: boolean);
|
||||
}
|
||||
/**
|
||||
* Takes a getter function and returns a readonly reactive ref object for the
|
||||
* returned value from the getter. It can also take an object with get and set
|
||||
* functions to create a writable ref object.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* // Creating a readonly computed ref:
|
||||
* const count = ref(1)
|
||||
* const plusOne = computed(() => count.value + 1)
|
||||
*
|
||||
* console.log(plusOne.value) // 2
|
||||
* plusOne.value++ // error
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* // Creating a writable computed ref:
|
||||
* const count = ref(1)
|
||||
* const plusOne = computed({
|
||||
* get: () => count.value + 1,
|
||||
* set: (val) => {
|
||||
* count.value = val - 1
|
||||
* }
|
||||
* })
|
||||
*
|
||||
* plusOne.value = 1
|
||||
* console.log(count.value) // 0
|
||||
* ```
|
||||
*
|
||||
* @param getter - Function that produces the next value.
|
||||
* @param debugOptions - For debugging. See {@link https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging}.
|
||||
* @see {@link https://vuejs.org/api/reactivity-core.html#computed}
|
||||
*/
|
||||
export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
|
||||
export declare function computed<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions): WritableComputedRef<T>;
|
||||
|
||||
export type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
|
||||
/**
|
||||
* Returns a reactive proxy of the object.
|
||||
*
|
||||
* The reactive conversion is "deep": it affects all nested properties. A
|
||||
* reactive object also deeply unwraps any properties that are refs while
|
||||
* maintaining reactivity.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const obj = reactive({ count: 0 })
|
||||
* ```
|
||||
*
|
||||
* @param target - The source object.
|
||||
* @see {@link https://vuejs.org/api/reactivity-core.html#reactive}
|
||||
*/
|
||||
export declare function reactive<T extends object>(target: T): UnwrapNestedRefs<T>;
|
||||
declare const ShallowReactiveMarker: unique symbol;
|
||||
export type ShallowReactive<T> = T & {
|
||||
[ShallowReactiveMarker]?: true;
|
||||
};
|
||||
/**
|
||||
* Shallow version of {@link reactive()}.
|
||||
*
|
||||
* Unlike {@link reactive()}, there is no deep conversion: only root-level
|
||||
* properties are reactive for a shallow reactive object. Property values are
|
||||
* stored and exposed as-is - this also means properties with ref values will
|
||||
* not be automatically unwrapped.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const state = shallowReactive({
|
||||
* foo: 1,
|
||||
* nested: {
|
||||
* bar: 2
|
||||
* }
|
||||
* })
|
||||
*
|
||||
* // mutating state's own properties is reactive
|
||||
* state.foo++
|
||||
*
|
||||
* // ...but does not convert nested objects
|
||||
* isReactive(state.nested) // false
|
||||
*
|
||||
* // NOT reactive
|
||||
* state.nested.bar++
|
||||
* ```
|
||||
*
|
||||
* @param target - The source object.
|
||||
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreactive}
|
||||
*/
|
||||
export declare function shallowReactive<T extends object>(target: T): ShallowReactive<T>;
|
||||
type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
||||
type Builtin = Primitive | Function | Date | Error | RegExp;
|
||||
export type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends WeakSet<infer U> ? WeakSet<DeepReadonly<U>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends Ref<infer U> ? Readonly<Ref<DeepReadonly<U>>> : T extends {} ? {
|
||||
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
||||
} : Readonly<T>;
|
||||
/**
|
||||
* Takes an object (reactive or plain) or a ref and returns a readonly proxy to
|
||||
* the original.
|
||||
*
|
||||
* A readonly proxy is deep: any nested property accessed will be readonly as
|
||||
* well. It also has the same ref-unwrapping behavior as {@link reactive()},
|
||||
* except the unwrapped values will also be made readonly.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const original = reactive({ count: 0 })
|
||||
*
|
||||
* const copy = readonly(original)
|
||||
*
|
||||
* watchEffect(() => {
|
||||
* // works for reactivity tracking
|
||||
* console.log(copy.count)
|
||||
* })
|
||||
*
|
||||
* // mutating original will trigger watchers relying on the copy
|
||||
* original.count++
|
||||
*
|
||||
* // mutating the copy will fail and result in a warning
|
||||
* copy.count++ // warning!
|
||||
* ```
|
||||
*
|
||||
* @param target - The source object.
|
||||
* @see {@link https://vuejs.org/api/reactivity-core.html#readonly}
|
||||
*/
|
||||
export declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>;
|
||||
/**
|
||||
* Shallow version of {@link readonly()}.
|
||||
*
|
||||
* Unlike {@link readonly()}, there is no deep conversion: only root-level
|
||||
* properties are made readonly. Property values are stored and exposed as-is -
|
||||
* this also means properties with ref values will not be automatically
|
||||
* unwrapped.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const state = shallowReadonly({
|
||||
* foo: 1,
|
||||
* nested: {
|
||||
* bar: 2
|
||||
* }
|
||||
* })
|
||||
*
|
||||
* // mutating state's own properties will fail
|
||||
* state.foo++
|
||||
*
|
||||
* // ...but works on nested objects
|
||||
* isReadonly(state.nested) // false
|
||||
*
|
||||
* // works
|
||||
* state.nested.bar++
|
||||
* ```
|
||||
*
|
||||
* @param target - The source object.
|
||||
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreadonly}
|
||||
*/
|
||||
export declare function shallowReadonly<T extends object>(target: T): Readonly<T>;
|
||||
/**
|
||||
* Checks if an object is a proxy created by {@link reactive()} or
|
||||
* {@link shallowReactive()} (or {@link ref()} in some cases).
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* isReactive(reactive({})) // => true
|
||||
* isReactive(readonly(reactive({}))) // => true
|
||||
* isReactive(ref({}).value) // => true
|
||||
* isReactive(readonly(ref({})).value) // => true
|
||||
* isReactive(ref(true)) // => false
|
||||
* isReactive(shallowRef({}).value) // => false
|
||||
* isReactive(shallowReactive({})) // => true
|
||||
* ```
|
||||
*
|
||||
* @param value - The value to check.
|
||||
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreactive}
|
||||
*/
|
||||
export declare function isReactive(value: unknown): boolean;
|
||||
/**
|
||||
* Checks whether the passed value is a readonly object. The properties of a
|
||||
* readonly object can change, but they can't be assigned directly via the
|
||||
* passed object.
|
||||
*
|
||||
* The proxies created by {@link readonly()} and {@link shallowReadonly()} are
|
||||
* both considered readonly, as is a computed ref without a set function.
|
||||
*
|
||||
* @param value - The value to check.
|
||||
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreadonly}
|
||||
*/
|
||||
export declare function isReadonly(value: unknown): boolean;
|
||||
export declare function isShallow(value: unknown): boolean;
|
||||
/**
|
||||
* Checks if an object is a proxy created by {@link reactive},
|
||||
* {@link readonly}, {@link shallowReactive} or {@link shallowReadonly()}.
|
||||
*
|
||||
* @param value - The value to check.
|
||||
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
|
||||
*/
|
||||
export declare function isProxy(value: unknown): boolean;
|
||||
/**
|
||||
* Returns the raw, original object of a Vue-created proxy.
|
||||
*
|
||||
* `toRaw()` can return the original object from proxies created by
|
||||
* {@link reactive()}, {@link readonly()}, {@link shallowReactive()} or
|
||||
* {@link shallowReadonly()}.
|
||||
*
|
||||
* This is an escape hatch that can be used to temporarily read without
|
||||
* incurring proxy access / tracking overhead or write without triggering
|
||||
* changes. It is **not** recommended to hold a persistent reference to the
|
||||
* original object. Use with caution.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const foo = {}
|
||||
* const reactiveFoo = reactive(foo)
|
||||
*
|
||||
* console.log(toRaw(reactiveFoo) === foo) // true
|
||||
* ```
|
||||
*
|
||||
* @param observed - The object for which the "raw" value is requested.
|
||||
* @see {@link https://vuejs.org/api/reactivity-advanced.html#toraw}
|
||||
*/
|
||||
export declare function toRaw<T>(observed: T): T;
|
||||
export type Raw<T> = T & {
|
||||
[RawSymbol]?: true;
|
||||
};
|
||||
/**
|
||||
* Marks an object so that it will never be converted to a proxy. Returns the
|
||||
* object itself.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const foo = markRaw({})
|
||||
* console.log(isReactive(reactive(foo))) // false
|
||||
*
|
||||
* // also works when nested inside other reactive objects
|
||||
* const bar = reactive({ foo })
|
||||
* console.log(isReactive(bar.foo)) // false
|
||||
* ```
|
||||
*
|
||||
* **Warning:** `markRaw()` together with the shallow APIs such as
|
||||
* {@link shallowReactive()} allow you to selectively opt-out of the default
|
||||
* deep reactive/readonly conversion and embed raw, non-proxied objects in your
|
||||
* state graph.
|
||||
*
|
||||
* @param value - The object to be marked as "raw".
|
||||
* @see {@link https://vuejs.org/api/reactivity-advanced.html#markraw}
|
||||
*/
|
||||
export declare function markRaw<T extends object>(value: T): Raw<T>;
|
||||
|
||||
export declare interface Ref<T = any> {
|
||||
declare const RefSymbol: unique symbol;
|
||||
declare const RawSymbol: unique symbol;
|
||||
export interface Ref<T = any> {
|
||||
value: T;
|
||||
/**
|
||||
* Type differentiator only.
|
||||
@@ -197,15 +414,190 @@ export declare interface Ref<T = any> {
|
||||
*/
|
||||
[RefSymbol]: true;
|
||||
}
|
||||
|
||||
export declare function ref<T extends object>(value: T): [T] extends [Ref] ? T : Ref<UnwrapRef<T>>;
|
||||
|
||||
/**
|
||||
* Checks if a value is a ref object.
|
||||
*
|
||||
* @param r - The value to inspect.
|
||||
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isref}
|
||||
*/
|
||||
export declare function isRef<T>(r: Ref<T> | unknown): r is Ref<T>;
|
||||
/**
|
||||
* Takes an inner value and returns a reactive and mutable ref object, which
|
||||
* has a single property `.value` that points to the inner value.
|
||||
*
|
||||
* @param value - The object to wrap in the ref.
|
||||
* @see {@link https://vuejs.org/api/reactivity-core.html#ref}
|
||||
*/
|
||||
export declare function ref<T>(value: T): Ref<UnwrapRef<T>>;
|
||||
|
||||
export declare function ref<T = any>(): Ref<T | undefined>;
|
||||
|
||||
declare const RefSymbol: unique symbol;
|
||||
|
||||
declare const ShallowRefMarker: unique symbol;
|
||||
export type ShallowRef<T = any> = Ref<T> & {
|
||||
[ShallowRefMarker]?: true;
|
||||
};
|
||||
/**
|
||||
* Shallow version of {@link ref()}.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const state = shallowRef({ count: 1 })
|
||||
*
|
||||
* // does NOT trigger change
|
||||
* state.value.count = 2
|
||||
*
|
||||
* // does trigger change
|
||||
* state.value = { count: 2 }
|
||||
* ```
|
||||
*
|
||||
* @param value - The "inner value" for the shallow ref.
|
||||
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowref}
|
||||
*/
|
||||
export declare function shallowRef<T>(value: T): Ref extends T ? T extends Ref ? IfAny<T, ShallowRef<T>, T> : ShallowRef<T> : ShallowRef<T>;
|
||||
export declare function shallowRef<T = any>(): ShallowRef<T | undefined>;
|
||||
/**
|
||||
* Force trigger effects that depends on a shallow ref. This is typically used
|
||||
* after making deep mutations to the inner value of a shallow ref.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const shallow = shallowRef({
|
||||
* greet: 'Hello, world'
|
||||
* })
|
||||
*
|
||||
* // Logs "Hello, world" once for the first run-through
|
||||
* watchEffect(() => {
|
||||
* console.log(shallow.value.greet)
|
||||
* })
|
||||
*
|
||||
* // This won't trigger the effect because the ref is shallow
|
||||
* shallow.value.greet = 'Hello, universe'
|
||||
*
|
||||
* // Logs "Hello, universe"
|
||||
* triggerRef(shallow)
|
||||
* ```
|
||||
*
|
||||
* @param ref - The ref whose tied effects shall be executed.
|
||||
* @see {@link https://vuejs.org/api/reactivity-advanced.html#triggerref}
|
||||
*/
|
||||
export declare function triggerRef(ref: Ref): void;
|
||||
export type MaybeRef<T = any> = T | Ref<T>;
|
||||
export type MaybeRefOrGetter<T = any> = MaybeRef<T> | (() => T);
|
||||
/**
|
||||
* Returns the inner value if the argument is a ref, otherwise return the
|
||||
* argument itself. This is a sugar function for
|
||||
* `val = isRef(val) ? val.value : val`.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* function useFoo(x: number | Ref<number>) {
|
||||
* const unwrapped = unref(x)
|
||||
* // unwrapped is guaranteed to be number now
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param ref - Ref or plain value to be converted into the plain value.
|
||||
* @see {@link https://vuejs.org/api/reactivity-utilities.html#unref}
|
||||
*/
|
||||
export declare function unref<T>(ref: MaybeRef<T> | ComputedRef<T>): T;
|
||||
/**
|
||||
* Normalizes values / refs / getters to values.
|
||||
* This is similar to {@link unref()}, except that it also normalizes getters.
|
||||
* If the argument is a getter, it will be invoked and its return value will
|
||||
* be returned.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* toValue(1) // 1
|
||||
* toValue(ref(1)) // 1
|
||||
* toValue(() => 1) // 1
|
||||
* ```
|
||||
*
|
||||
* @param source - A getter, an existing ref, or a non-function value.
|
||||
* @see {@link https://vuejs.org/api/reactivity-utilities.html#tovalue}
|
||||
*/
|
||||
export declare function toValue<T>(source: MaybeRefOrGetter<T> | ComputedRef<T>): T;
|
||||
/**
|
||||
* Returns a reactive proxy for the given object.
|
||||
*
|
||||
* If the object already is reactive, it's returned as-is. If not, a new
|
||||
* reactive proxy is created. Direct child properties that are refs are properly
|
||||
* handled, as well.
|
||||
*
|
||||
* @param objectWithRefs - Either an already-reactive object or a simple object
|
||||
* that contains refs.
|
||||
*/
|
||||
export declare function proxyRefs<T extends object>(objectWithRefs: T): ShallowUnwrapRef<T>;
|
||||
export type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
|
||||
get: () => T;
|
||||
set: (value: T) => void;
|
||||
};
|
||||
/**
|
||||
* Creates a customized ref with explicit control over its dependency tracking
|
||||
* and updates triggering.
|
||||
*
|
||||
* @param factory - The function that receives the `track` and `trigger` callbacks.
|
||||
* @see {@link https://vuejs.org/api/reactivity-advanced.html#customref}
|
||||
*/
|
||||
export declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
|
||||
export type ToRefs<T = any> = {
|
||||
[K in keyof T]: ToRef<T[K]>;
|
||||
};
|
||||
/**
|
||||
* Converts a reactive object to a plain object where each property of the
|
||||
* resulting object is a ref pointing to the corresponding property of the
|
||||
* original object. Each individual ref is created using {@link toRef()}.
|
||||
*
|
||||
* @param object - Reactive object to be made into an object of linked refs.
|
||||
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
|
||||
*/
|
||||
export declare function toRefs<T extends object>(object: T): ToRefs<T>;
|
||||
export type ToRef<T> = IfAny<T, Ref<T>, [T] extends [Ref] ? T : Ref<T>>;
|
||||
/**
|
||||
* Used to normalize values / refs / getters into refs.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* // returns existing refs as-is
|
||||
* toRef(existingRef)
|
||||
*
|
||||
* // creates a ref that calls the getter on .value access
|
||||
* toRef(() => props.foo)
|
||||
*
|
||||
* // creates normal refs from non-function values
|
||||
* // equivalent to ref(1)
|
||||
* toRef(1)
|
||||
* ```
|
||||
*
|
||||
* Can also be used to create a ref for a property on a source reactive object.
|
||||
* The created ref is synced with its source property: mutating the source
|
||||
* property will update the ref, and vice-versa.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const state = reactive({
|
||||
* foo: 1,
|
||||
* bar: 2
|
||||
* })
|
||||
*
|
||||
* const fooRef = toRef(state, 'foo')
|
||||
*
|
||||
* // mutating the ref updates the original
|
||||
* fooRef.value++
|
||||
* console.log(state.foo) // 2
|
||||
*
|
||||
* // mutating the original also updates the ref
|
||||
* state.foo++
|
||||
* console.log(fooRef.value) // 3
|
||||
* ```
|
||||
*
|
||||
* @param source - A getter, an existing ref, a non-function value, or a
|
||||
* reactive object to create a property ref from.
|
||||
* @param [key] - (optional) Name of the property in the reactive object.
|
||||
* @see {@link https://vuejs.org/api/reactivity-utilities.html#toref}
|
||||
*/
|
||||
export declare function toRef<T>(value: T): T extends () => infer R ? Readonly<Ref<R>> : T extends Ref ? T : Ref<UnwrapRef<T>>;
|
||||
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
||||
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
|
||||
type BaseTypes = string | number | boolean;
|
||||
/**
|
||||
* This is a special exported interface for other packages to declare
|
||||
* additional types that should bail out for ref unwrapping. For example
|
||||
@@ -218,114 +610,17 @@ declare const RefSymbol: unique symbol;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Note that api-extractor somehow refuses to include `declare module`
|
||||
* augmentations in its generated d.ts, so we have to manually append them
|
||||
* to the final generated d.ts in our build process.
|
||||
*/
|
||||
export declare interface RefUnwrapBailTypes {
|
||||
export interface RefUnwrapBailTypes {
|
||||
}
|
||||
|
||||
export declare function resetTracking(): void;
|
||||
|
||||
export declare type ShallowReactive<T> = T & {
|
||||
[ShallowReactiveMarker]?: true;
|
||||
export type ShallowUnwrapRef<T> = {
|
||||
[K in keyof T]: DistrubuteRef<T[K]>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a shallowly-reactive copy of the original object, where only the root
|
||||
* level properties are reactive. It also does not auto-unwrap refs (even at the
|
||||
* root level).
|
||||
*/
|
||||
export declare function shallowReactive<T extends object>(target: T): ShallowReactive<T>;
|
||||
|
||||
declare const ShallowReactiveMarker: unique symbol;
|
||||
|
||||
/**
|
||||
* Returns a reactive-copy of the original object, where only the root level
|
||||
* properties are readonly, and does NOT unwrap refs nor recursively convert
|
||||
* returned properties.
|
||||
* This is used for creating the props proxy object for stateful components.
|
||||
*/
|
||||
export declare function shallowReadonly<T extends object>(target: T): Readonly<T>;
|
||||
|
||||
export declare type ShallowRef<T = any> = Ref<T> & {
|
||||
[ShallowRefMarker]?: true;
|
||||
};
|
||||
|
||||
export declare function shallowRef<T extends object>(value: T): T extends Ref ? T : ShallowRef<T>;
|
||||
|
||||
export declare function shallowRef<T>(value: T): ShallowRef<T>;
|
||||
|
||||
export declare function shallowRef<T = any>(): ShallowRef<T | undefined>;
|
||||
|
||||
declare const ShallowRefMarker: unique symbol;
|
||||
|
||||
export declare type ShallowUnwrapRef<T> = {
|
||||
[K in keyof T]: T[K] extends Ref<infer V> ? V : T[K] extends Ref<infer V> | undefined ? unknown extends V ? undefined : V | undefined : T[K];
|
||||
};
|
||||
|
||||
declare function stop_2(runner: ReactiveEffectRunner): void;
|
||||
export { stop_2 as stop }
|
||||
|
||||
export declare function toRaw<T>(observed: T): T;
|
||||
|
||||
export declare type ToRef<T> = IfAny<T, Ref<T>, [T] extends [Ref] ? T : Ref<T>>;
|
||||
|
||||
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
||||
|
||||
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
|
||||
|
||||
export declare type ToRefs<T = any> = {
|
||||
[K in keyof T]: ToRef<T[K]>;
|
||||
};
|
||||
|
||||
export declare function toRefs<T extends object>(object: T): ToRefs<T>;
|
||||
|
||||
export declare function track(target: object, type: TrackOpTypes, key: unknown): void;
|
||||
|
||||
/**
|
||||
* wasTracked and newTracked maintain the status for several levels of effect
|
||||
* tracking recursion. One bit per level is used to define whether the dependency
|
||||
* was/is tracked.
|
||||
*/
|
||||
declare type TrackedMarkers = {
|
||||
/**
|
||||
* wasTracked
|
||||
*/
|
||||
w: number;
|
||||
/**
|
||||
* newTracked
|
||||
*/
|
||||
n: number;
|
||||
};
|
||||
|
||||
export declare const enum TrackOpTypes {
|
||||
GET = "get",
|
||||
HAS = "has",
|
||||
ITERATE = "iterate"
|
||||
}
|
||||
|
||||
export declare function trigger(target: object, type: TriggerOpTypes, key?: unknown, newValue?: unknown, oldValue?: unknown, oldTarget?: Map<unknown, unknown> | Set<unknown>): void;
|
||||
|
||||
export declare const enum TriggerOpTypes {
|
||||
SET = "set",
|
||||
ADD = "add",
|
||||
DELETE = "delete",
|
||||
CLEAR = "clear"
|
||||
}
|
||||
|
||||
export declare function triggerRef(ref: Ref): void;
|
||||
|
||||
export declare function unref<T>(ref: T | Ref<T>): T;
|
||||
|
||||
export declare type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
|
||||
|
||||
export declare type UnwrapRef<T> = T extends ShallowRef<infer V> ? V : T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
||||
|
||||
declare type UnwrapRefSimple<T> = T extends Function | CollectionTypes | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
|
||||
type DistrubuteRef<T> = T extends Ref<infer V> ? V : T;
|
||||
export type UnwrapRef<T> = T extends ShallowRef<infer V> ? V : T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
||||
type UnwrapRefSimple<T> = T extends Function | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
|
||||
[RawSymbol]?: true;
|
||||
} ? T : T extends Array<any> ? {
|
||||
} ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? {
|
||||
[K in keyof T]: UnwrapRefSimple<T[K]>;
|
||||
} : T extends object & {
|
||||
[ShallowReactiveMarker]?: never;
|
||||
@@ -333,15 +628,30 @@ declare type UnwrapRefSimple<T> = T extends Function | CollectionTypes | BaseTyp
|
||||
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
|
||||
} : T;
|
||||
|
||||
declare type WeakCollections = WeakMap<any, any> | WeakSet<any>;
|
||||
/**
|
||||
* @deprecated use `computed` instead. See #5912
|
||||
*/
|
||||
export declare const deferredComputed: typeof computed;
|
||||
|
||||
export declare interface WritableComputedOptions<T> {
|
||||
get: ComputedGetter<T>;
|
||||
set: ComputedSetter<T>;
|
||||
}
|
||||
export declare const ITERATE_KEY: unique symbol;
|
||||
/**
|
||||
* Tracks access to a reactive property.
|
||||
*
|
||||
* This will check which effect is running at the moment and record it as dep
|
||||
* which records all effects that depend on the reactive property.
|
||||
*
|
||||
* @param target - Object holding the reactive property.
|
||||
* @param type - Defines the type of access to the reactive property.
|
||||
* @param key - Identifier of the reactive property to track.
|
||||
*/
|
||||
export declare function track(target: object, type: TrackOpTypes, key: unknown): void;
|
||||
/**
|
||||
* Finds all deps associated with the target (or a specific property) and
|
||||
* triggers the effects stored within.
|
||||
*
|
||||
* @param target - The reactive object.
|
||||
* @param type - Defines the type of the operation that needs to trigger effects.
|
||||
* @param key - Can be used to target a specific reactive property in the target object.
|
||||
*/
|
||||
export declare function trigger(target: object, type: TriggerOpTypes, key?: unknown, newValue?: unknown, oldValue?: unknown, oldTarget?: Map<unknown, unknown> | Set<unknown>): void;
|
||||
|
||||
export declare interface WritableComputedRef<T> extends Ref<T> {
|
||||
readonly effect: ReactiveEffect<T>;
|
||||
}
|
||||
|
||||
export { }
|
||||
|
||||
+1109
-1126
File diff suppressed because it is too large
Load Diff
+6
-1
File diff suppressed because one or more lines are too long
+1085
-1100
File diff suppressed because it is too large
Load Diff
+1116
-1129
File diff suppressed because it is too large
Load Diff
+6
-1
File diff suppressed because one or more lines are too long
+17
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/reactivity",
|
||||
"version": "3.2.36",
|
||||
"version": "3.4.15",
|
||||
"description": "@vue/reactivity",
|
||||
"main": "index.js",
|
||||
"module": "dist/reactivity.esm-bundler.js",
|
||||
@@ -11,6 +11,20 @@
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/reactivity.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/reactivity.cjs.prod.js",
|
||||
"development": "./dist/reactivity.cjs.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"module": "./dist/reactivity.esm-bundler.js",
|
||||
"import": "./dist/reactivity.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -36,6 +50,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36"
|
||||
"@vue/shared": "3.4.15"
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -2,18 +2,18 @@
|
||||
|
||||
> This package is published only for typing and building custom renderers. It is NOT meant to be used in applications.
|
||||
|
||||
For full exposed APIs, see `src/index.ts`. You can also run `yarn build runtime-core --types` from repo root, which will generate an API report at `temp/runtime-core.api.md`.
|
||||
For full exposed APIs, see `src/index.ts`.
|
||||
|
||||
## Building a Custom Renderer
|
||||
|
||||
``` ts
|
||||
```ts
|
||||
import { createRenderer } from '@vue/runtime-core'
|
||||
|
||||
const { render, createApp } = createRenderer({
|
||||
patchProp,
|
||||
insert,
|
||||
remove,
|
||||
createElement,
|
||||
createElement
|
||||
// ...
|
||||
})
|
||||
|
||||
|
||||
+7402
-7051
File diff suppressed because it is too large
Load Diff
+5814
-5686
File diff suppressed because it is too large
Load Diff
+1340
-1690
File diff suppressed because it is too large
Load Diff
+7469
-7159
File diff suppressed because it is too large
Load Diff
+18
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/runtime-core",
|
||||
"version": "3.2.36",
|
||||
"version": "3.4.15",
|
||||
"description": "@vue/runtime-core",
|
||||
"main": "index.js",
|
||||
"module": "dist/runtime-core.esm-bundler.js",
|
||||
@@ -9,6 +9,20 @@
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/runtime-core.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/runtime-core.cjs.prod.js",
|
||||
"development": "./dist/runtime-core.cjs.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"module": "./dist/runtime-core.esm-bundler.js",
|
||||
"import": "./dist/runtime-core.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueRuntimeCore",
|
||||
"formats": [
|
||||
@@ -32,7 +46,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36",
|
||||
"@vue/reactivity": "3.2.36"
|
||||
"@vue/shared": "3.4.15",
|
||||
"@vue/reactivity": "3.4.15"
|
||||
}
|
||||
}
|
||||
}
|
||||
+1416
-1530
File diff suppressed because it is too large
Load Diff
+1323
-1432
File diff suppressed because it is too large
Load Diff
+1156
-1367
File diff suppressed because it is too large
Load Diff
+10078
-9859
File diff suppressed because it is too large
Load Diff
+11
-1
File diff suppressed because one or more lines are too long
+1473
-1584
File diff suppressed because it is too large
Load Diff
+10079
-9847
File diff suppressed because it is too large
Load Diff
+11
-1
File diff suppressed because one or more lines are too long
+19
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/runtime-dom",
|
||||
"version": "3.2.36",
|
||||
"version": "3.4.15",
|
||||
"description": "@vue/runtime-dom",
|
||||
"main": "index.js",
|
||||
"module": "dist/runtime-dom.esm-bundler.js",
|
||||
@@ -10,6 +10,20 @@
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/runtime-dom.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/runtime-dom.cjs.prod.js",
|
||||
"development": "./dist/runtime-dom.cjs.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"module": "./dist/runtime-dom.esm-bundler.js",
|
||||
"import": "./dist/runtime-dom.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"buildOptions": {
|
||||
"name": "VueRuntimeDOM",
|
||||
@@ -35,8 +49,8 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36",
|
||||
"@vue/runtime-core": "3.2.36",
|
||||
"csstype": "^2.6.8"
|
||||
"csstype": "^3.1.3",
|
||||
"@vue/shared": "3.4.15",
|
||||
"@vue/runtime-core": "3.4.15"
|
||||
}
|
||||
}
|
||||
}
|
||||
+984
-897
File diff suppressed because it is too large
Load Diff
+751
-693
File diff suppressed because it is too large
Load Diff
+44
-75
@@ -1,56 +1,63 @@
|
||||
/// <reference types="node" />
|
||||
import { VNode, ComponentInternalInstance, App, Slots, Component } from 'vue';
|
||||
import { Readable, Writable } from 'node:stream';
|
||||
import { ComponentPublicInstance, Directive } from '@vue/runtime-core';
|
||||
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
||||
|
||||
import { App } from 'vue';
|
||||
import { Component } from 'vue';
|
||||
import { ComponentInternalInstance } from 'vue';
|
||||
import { ComponentPublicInstance } from '@vue/runtime-core';
|
||||
import { Directive } from '@vue/runtime-core';
|
||||
import { Readable } from 'stream';
|
||||
import { Slots } from 'vue';
|
||||
import { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
||||
import { VNode } from 'vue';
|
||||
import { Writable } from 'stream';
|
||||
type SSRBuffer = SSRBufferItem[] & {
|
||||
hasAsync?: boolean;
|
||||
};
|
||||
type SSRBufferItem = string | SSRBuffer | Promise<SSRBuffer>;
|
||||
type PushFn = (item: SSRBufferItem) => void;
|
||||
type Props = Record<string, unknown>;
|
||||
export type SSRContext = {
|
||||
[key: string]: any;
|
||||
teleports?: Record<string, string>;
|
||||
};
|
||||
export declare function renderVNode(push: PushFn, vnode: VNode, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
||||
|
||||
export declare function pipeToNodeWritable(input: App | VNode, context: SSRContext | undefined, writable: Writable): void;
|
||||
|
||||
export declare function pipeToWebWritable(input: App | VNode, context: SSRContext | undefined, writable: WritableStream): void;
|
||||
|
||||
declare type Props = Record<string, unknown>;
|
||||
|
||||
declare type PushFn = (item: SSRBufferItem) => void;
|
||||
|
||||
export declare function renderToNodeStream(input: App | VNode, context?: SSRContext): Readable;
|
||||
export declare function renderToString(input: App | VNode, context?: SSRContext): Promise<string>;
|
||||
|
||||
export interface SimpleReadable {
|
||||
push(chunk: string | null): void;
|
||||
destroy(err: any): void;
|
||||
}
|
||||
export declare function renderToSimpleStream<T extends SimpleReadable>(input: App | VNode, context: SSRContext, stream: T): T;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function renderToStream(input: App | VNode, context?: SSRContext): Readable;
|
||||
|
||||
export declare function renderToString(input: App | VNode, context?: SSRContext): Promise<string>;
|
||||
|
||||
export declare function renderToNodeStream(input: App | VNode, context?: SSRContext): Readable;
|
||||
export declare function pipeToNodeWritable(input: App | VNode, context: SSRContext | undefined, writable: Writable): void;
|
||||
export declare function renderToWebStream(input: App | VNode, context?: SSRContext): ReadableStream;
|
||||
export declare function pipeToWebWritable(input: App | VNode, context: SSRContext | undefined, writable: WritableStream): void;
|
||||
|
||||
export declare interface SimpleReadable {
|
||||
push(chunk: string | null): void;
|
||||
destroy(err: any): void;
|
||||
}
|
||||
type SSRSlots = Record<string, SSRSlot>;
|
||||
type SSRSlot = (props: Props, push: PushFn, parentComponent: ComponentInternalInstance | null, scopeId: string | null) => void;
|
||||
export declare function ssrRenderSlot(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
||||
export declare function ssrRenderSlotInner(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance, slotScopeId?: string, transition?: boolean): void;
|
||||
|
||||
declare type SSRBuffer = SSRBufferItem[] & {
|
||||
hasAsync?: boolean;
|
||||
};
|
||||
export declare function ssrRenderComponent(comp: Component, props?: Props | null, children?: Slots | SSRSlots | null, parentComponent?: ComponentInternalInstance | null, slotScopeId?: string): SSRBuffer | Promise<SSRBuffer>;
|
||||
|
||||
declare type SSRBufferItem = string | SSRBuffer | Promise<SSRBuffer>;
|
||||
export declare function ssrRenderTeleport(parentPush: PushFn, contentRenderFn: (push: PushFn) => void, target: string, disabled: boolean, parentComponent: ComponentInternalInstance): void;
|
||||
|
||||
export declare type SSRContext = {
|
||||
[key: string]: any;
|
||||
teleports?: Record<string, string>;
|
||||
__teleportBuffers?: Record<string, SSRBuffer>;
|
||||
};
|
||||
export declare function ssrRenderAttrs(props: Record<string, unknown>, tag?: string): string;
|
||||
export declare function ssrRenderDynamicAttr(key: string, value: unknown, tag?: string): string;
|
||||
export declare function ssrRenderAttr(key: string, value: unknown): string;
|
||||
export declare function ssrRenderClass(raw: unknown): string;
|
||||
export declare function ssrRenderStyle(raw: unknown): string;
|
||||
|
||||
export declare function ssrInterpolate(value: unknown): string;
|
||||
|
||||
export declare function ssrRenderList(source: unknown, renderItem: (value: unknown, key: string | number, index?: number) => void): void;
|
||||
|
||||
export declare function ssrRenderSuspense(push: PushFn, { default: renderContent }: Record<string, (() => void) | undefined>): Promise<void>;
|
||||
|
||||
export declare function ssrGetDirectiveProps(instance: ComponentPublicInstance, dir: Directive, value?: any, arg?: string, modifiers?: Record<string, boolean>): Record<string, any>;
|
||||
|
||||
export declare const ssrLooseEqual: (a: unknown, b: unknown) => boolean;
|
||||
export declare function ssrLooseContain(arr: unknown[], value: unknown): boolean;
|
||||
export declare function ssrRenderDynamicModel(type: unknown, model: unknown, value: unknown): string;
|
||||
export declare function ssrGetDynamicModelProps(existingProps: any, model: unknown): {
|
||||
checked: boolean;
|
||||
value?: undefined;
|
||||
@@ -59,42 +66,4 @@ export declare function ssrGetDynamicModelProps(existingProps: any, model: unkno
|
||||
checked?: undefined;
|
||||
} | null;
|
||||
|
||||
export { ssrIncludeBooleanAttr }
|
||||
|
||||
export declare function ssrInterpolate(value: unknown): string;
|
||||
|
||||
export declare function ssrLooseContain(arr: unknown[], value: unknown): boolean;
|
||||
|
||||
export declare const ssrLooseEqual: (a: unknown, b: unknown) => boolean;
|
||||
|
||||
export declare function ssrRenderAttr(key: string, value: unknown): string;
|
||||
|
||||
export declare function ssrRenderAttrs(props: Record<string, unknown>, tag?: string): string;
|
||||
|
||||
export declare function ssrRenderClass(raw: unknown): string;
|
||||
|
||||
export declare function ssrRenderComponent(comp: Component, props?: Props | null, children?: Slots | SSRSlots | null, parentComponent?: ComponentInternalInstance | null, slotScopeId?: string): SSRBuffer | Promise<SSRBuffer>;
|
||||
|
||||
export declare function ssrRenderDynamicAttr(key: string, value: unknown, tag?: string): string;
|
||||
|
||||
export declare function ssrRenderDynamicModel(type: unknown, model: unknown, value: unknown): string;
|
||||
|
||||
export declare function ssrRenderList(source: unknown, renderItem: (value: unknown, key: string | number, index?: number) => void): void;
|
||||
|
||||
export declare function ssrRenderSlot(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
||||
|
||||
export declare function ssrRenderSlotInner(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
||||
|
||||
export declare function ssrRenderStyle(raw: unknown): string;
|
||||
|
||||
export declare function ssrRenderSuspense(push: PushFn, { default: renderContent }: Record<string, (() => void) | undefined>): Promise<void>;
|
||||
|
||||
export declare function ssrRenderTeleport(parentPush: PushFn, contentRenderFn: (push: PushFn) => void, target: string, disabled: boolean, parentComponent: ComponentInternalInstance): void;
|
||||
|
||||
export declare function ssrRenderVNode(push: PushFn, vnode: VNode, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
||||
|
||||
declare type SSRSlot = (props: Props, push: PushFn, parentComponent: ComponentInternalInstance | null, scopeId: string | null) => void;
|
||||
|
||||
declare type SSRSlots = Record<string, SSRSlot>;
|
||||
|
||||
export { }
|
||||
export { renderVNode as ssrRenderVNode };
|
||||
|
||||
+7906
File diff suppressed because it is too large
Load Diff
+6
File diff suppressed because one or more lines are too long
+936
-870
File diff suppressed because it is too large
Load Diff
+20
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/server-renderer",
|
||||
"version": "3.2.36",
|
||||
"version": "3.4.15",
|
||||
"description": "@vue/server-renderer",
|
||||
"main": "index.js",
|
||||
"module": "dist/server-renderer.esm-bundler.js",
|
||||
@@ -9,10 +9,25 @@
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/server-renderer.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/server-renderer.cjs.prod.js",
|
||||
"development": "./dist/server-renderer.cjs.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"module": "./dist/server-renderer.esm-bundler.js",
|
||||
"import": "./dist/server-renderer.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueServerRenderer",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
@@ -31,10 +46,10 @@
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
|
||||
"peerDependencies": {
|
||||
"vue": "3.2.36"
|
||||
"vue": "3.4.15"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36",
|
||||
"@vue/compiler-ssr": "3.2.36"
|
||||
"@vue/compiler-ssr": "3.4.15",
|
||||
"@vue/shared": "3.4.15"
|
||||
}
|
||||
}
|
||||
}
|
||||
+460
-558
File diff suppressed because it is too large
Load Diff
+459
-556
File diff suppressed because it is too large
Load Diff
+150
-183
@@ -1,142 +1,3 @@
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const camelize: (str: string) => string;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const capitalize: (str: string) => string;
|
||||
|
||||
export declare const def: (obj: object, key: string | symbol, value: any) => void;
|
||||
|
||||
export declare const EMPTY_ARR: readonly never[];
|
||||
|
||||
export declare const EMPTY_OBJ: {
|
||||
readonly [key: string]: any;
|
||||
};
|
||||
|
||||
export declare function escapeHtml(string: unknown): string;
|
||||
|
||||
export declare function escapeHtmlComment(src: string): string;
|
||||
|
||||
export declare const extend: {
|
||||
<T, U>(target: T, source: U): T & U;
|
||||
<T_1, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
||||
<T_2, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
||||
(target: object, ...sources: any[]): any;
|
||||
};
|
||||
|
||||
export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
|
||||
|
||||
export declare function genPropsAccessExp(name: string): string;
|
||||
|
||||
export declare const getGlobalThis: () => any;
|
||||
|
||||
export declare const hasChanged: (value: any, oldValue: any) => boolean;
|
||||
|
||||
export declare const hasOwn: (val: object, key: string | symbol) => key is never;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const hyphenate: (str: string) => string;
|
||||
|
||||
export declare type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
||||
|
||||
/**
|
||||
* Boolean attributes should be included if the value is truthy or ''.
|
||||
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
||||
*/
|
||||
export declare function includeBooleanAttr(value: unknown): boolean;
|
||||
|
||||
export declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
|
||||
|
||||
export declare const isArray: (arg: any) => arg is any[];
|
||||
|
||||
/**
|
||||
* The full list is needed during SSR to produce the correct initial markup.
|
||||
*/
|
||||
export declare const isBooleanAttr: (key: string) => boolean;
|
||||
|
||||
export declare const isBuiltInDirective: (key: string) => boolean;
|
||||
|
||||
export declare const isDate: (val: unknown) => val is Date;
|
||||
|
||||
export declare const isFunction: (val: unknown) => val is Function;
|
||||
|
||||
export declare const isGloballyWhitelisted: (key: string) => boolean;
|
||||
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isHTMLTag: (key: string) => boolean;
|
||||
|
||||
export declare const isIntegerKey: (key: unknown) => boolean;
|
||||
|
||||
/**
|
||||
* Known attributes, this is used for stringification of runtime static nodes
|
||||
* so that we don't stringify bindings that cannot be set from HTML.
|
||||
* Don't also forget to allow `data-*` and `aria-*`!
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||
*/
|
||||
export declare const isKnownHtmlAttr: (key: string) => boolean;
|
||||
|
||||
/**
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
||||
*/
|
||||
export declare const isKnownSvgAttr: (key: string) => boolean;
|
||||
|
||||
export declare const isMap: (val: unknown) => val is Map<any, any>;
|
||||
|
||||
export declare const isModelListener: (key: string) => boolean;
|
||||
|
||||
/**
|
||||
* CSS properties that accept plain numbers
|
||||
*/
|
||||
export declare const isNoUnitNumericStyleProp: (key: string) => boolean;
|
||||
|
||||
export declare const isObject: (val: unknown) => val is Record<any, any>;
|
||||
|
||||
export declare const isOn: (key: string) => boolean;
|
||||
|
||||
export declare const isPlainObject: (val: unknown) => val is object;
|
||||
|
||||
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
||||
|
||||
export declare const isReservedProp: (key: string) => boolean;
|
||||
|
||||
export declare const isSet: (val: unknown) => val is Set<any>;
|
||||
|
||||
export declare const isSpecialBooleanAttr: (key: string) => boolean;
|
||||
|
||||
export declare function isSSRSafeAttrName(name: string): boolean;
|
||||
|
||||
export declare const isString: (val: unknown) => val is string;
|
||||
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isSVGTag: (key: string) => boolean;
|
||||
|
||||
export declare const isSymbol: (val: unknown) => val is symbol;
|
||||
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isVoidTag: (key: string) => boolean;
|
||||
|
||||
export declare function looseEqual(a: any, b: any): boolean;
|
||||
|
||||
export declare function looseIndexOf(arr: any[], val: any): number;
|
||||
|
||||
export declare type LooseRequired<T> = {
|
||||
[P in string & keyof T]: T[P];
|
||||
};
|
||||
|
||||
/**
|
||||
* Make a map and return a function for checking if a key
|
||||
* is in that map.
|
||||
@@ -146,31 +7,73 @@ export declare type LooseRequired<T> = {
|
||||
*/
|
||||
export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
|
||||
|
||||
export declare const EMPTY_OBJ: {
|
||||
readonly [key: string]: any;
|
||||
};
|
||||
export declare const EMPTY_ARR: readonly never[];
|
||||
export declare const NOOP: () => void;
|
||||
/**
|
||||
* Always return false.
|
||||
*/
|
||||
export declare const NO: () => boolean;
|
||||
|
||||
export declare const NOOP: () => void;
|
||||
|
||||
export declare function normalizeClass(value: unknown): string;
|
||||
|
||||
export declare type NormalizedStyle = Record<string, string | number>;
|
||||
|
||||
export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null;
|
||||
|
||||
export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined;
|
||||
|
||||
export declare const objectToString: () => string;
|
||||
|
||||
export declare function parseStringStyle(cssText: string): NormalizedStyle;
|
||||
|
||||
/**
|
||||
* dev only flag -> name mapping
|
||||
*/
|
||||
export declare const PatchFlagNames: {
|
||||
[x: number]: string;
|
||||
export declare const isOn: (key: string) => boolean;
|
||||
export declare const isModelListener: (key: string) => boolean;
|
||||
export declare const extend: {
|
||||
<T extends {}, U>(target: T, source: U): T & U;
|
||||
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
||||
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
||||
(target: object, ...sources: any[]): any;
|
||||
};
|
||||
export declare const remove: <T>(arr: T[], el: T) => void;
|
||||
export declare const hasOwn: (val: object, key: string | symbol) => key is never;
|
||||
export declare const isArray: (arg: any) => arg is any[];
|
||||
export declare const isMap: (val: unknown) => val is Map<any, any>;
|
||||
export declare const isSet: (val: unknown) => val is Set<any>;
|
||||
export declare const isDate: (val: unknown) => val is Date;
|
||||
export declare const isRegExp: (val: unknown) => val is RegExp;
|
||||
export declare const isFunction: (val: unknown) => val is Function;
|
||||
export declare const isString: (val: unknown) => val is string;
|
||||
export declare const isSymbol: (val: unknown) => val is symbol;
|
||||
export declare const isObject: (val: unknown) => val is Record<any, any>;
|
||||
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
||||
export declare const objectToString: () => string;
|
||||
export declare const toTypeString: (value: unknown) => string;
|
||||
export declare const toRawType: (value: unknown) => string;
|
||||
export declare const isPlainObject: (val: unknown) => val is object;
|
||||
export declare const isIntegerKey: (key: unknown) => boolean;
|
||||
export declare const isReservedProp: (key: string) => boolean;
|
||||
export declare const isBuiltInDirective: (key: string) => boolean;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const camelize: (str: string) => string;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const hyphenate: (str: string) => string;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const capitalize: <T extends string>(str: T) => Capitalize<T>;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const toHandlerKey: <T extends string>(str: T) => T extends "" ? "" : `on${Capitalize<T>}`;
|
||||
export declare const hasChanged: (value: any, oldValue: any) => boolean;
|
||||
export declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
|
||||
export declare const def: (obj: object, key: string | symbol, value: any) => void;
|
||||
/**
|
||||
* "123-foo" will be parsed to 123
|
||||
* This is used for the .number modifier in v-model
|
||||
*/
|
||||
export declare const looseToNumber: (val: any) => any;
|
||||
/**
|
||||
* Only concerns number-like strings
|
||||
* "123-foo" will be returned as-is
|
||||
*/
|
||||
export declare const toNumber: (val: any) => any;
|
||||
export declare const getGlobalThis: () => any;
|
||||
export declare function genPropsAccessExp(name: string): string;
|
||||
|
||||
/**
|
||||
* Patch flags are optimization hints generated by the compiler.
|
||||
@@ -190,7 +93,7 @@ export declare const PatchFlagNames: {
|
||||
* Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the
|
||||
* flags are handled during diff.
|
||||
*/
|
||||
export declare const enum PatchFlags {
|
||||
export declare enum PatchFlags {
|
||||
/**
|
||||
* Indicates an element with dynamic textContent (children fast path)
|
||||
*/
|
||||
@@ -226,10 +129,11 @@ export declare const enum PatchFlags {
|
||||
*/
|
||||
FULL_PROPS = 16,
|
||||
/**
|
||||
* Indicates an element with event listeners (which need to be attached
|
||||
* during hydration)
|
||||
* Indicates an element that requires props hydration
|
||||
* (but not necessarily patching)
|
||||
* e.g. event listeners & v-bind with prop modifier
|
||||
*/
|
||||
HYDRATE_EVENTS = 32,
|
||||
NEED_HYDRATION = 32,
|
||||
/**
|
||||
* Indicates a fragment whose children order doesn't change.
|
||||
*/
|
||||
@@ -282,12 +186,12 @@ export declare const enum PatchFlags {
|
||||
*/
|
||||
BAIL = -2
|
||||
}
|
||||
/**
|
||||
* dev only flag -> name mapping
|
||||
*/
|
||||
export declare const PatchFlagNames: Record<PatchFlags, string>;
|
||||
|
||||
export declare const propsToAttrMap: Record<string, string | undefined>;
|
||||
|
||||
export declare const remove: <T>(arr: T[], el: T) => void;
|
||||
|
||||
export declare const enum ShapeFlags {
|
||||
export declare enum ShapeFlags {
|
||||
ELEMENT = 1,
|
||||
FUNCTIONAL_COMPONENT = 2,
|
||||
STATEFUL_COMPONENT = 4,
|
||||
@@ -301,7 +205,7 @@ export declare const enum ShapeFlags {
|
||||
COMPONENT = 6
|
||||
}
|
||||
|
||||
export declare const enum SlotFlags {
|
||||
export declare enum SlotFlags {
|
||||
/**
|
||||
* Stable slots that only reference slot props or context state. The slot
|
||||
* can fully capture its own dependencies so when passed down the parent won't
|
||||
@@ -322,7 +226,6 @@ export declare const enum SlotFlags {
|
||||
*/
|
||||
FORWARDED = 3
|
||||
}
|
||||
|
||||
/**
|
||||
* Dev only
|
||||
*/
|
||||
@@ -332,7 +235,73 @@ export declare const slotFlagsText: {
|
||||
3: string;
|
||||
};
|
||||
|
||||
export declare const isGloballyAllowed: (key: string) => boolean;
|
||||
/** @deprecated use `isGloballyAllowed` instead */
|
||||
export declare const isGloballyWhitelisted: (key: string) => boolean;
|
||||
|
||||
export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
|
||||
|
||||
export type NormalizedStyle = Record<string, string | number>;
|
||||
export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined;
|
||||
export declare function parseStringStyle(cssText: string): NormalizedStyle;
|
||||
export declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string;
|
||||
export declare function normalizeClass(value: unknown): string;
|
||||
export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null;
|
||||
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isHTMLTag: (key: string) => boolean;
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isSVGTag: (key: string) => boolean;
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isMathMLTag: (key: string) => boolean;
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isVoidTag: (key: string) => boolean;
|
||||
|
||||
export declare const isSpecialBooleanAttr: (key: string) => boolean;
|
||||
/**
|
||||
* The full list is needed during SSR to produce the correct initial markup.
|
||||
*/
|
||||
export declare const isBooleanAttr: (key: string) => boolean;
|
||||
/**
|
||||
* Boolean attributes should be included if the value is truthy or ''.
|
||||
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
||||
*/
|
||||
export declare function includeBooleanAttr(value: unknown): boolean;
|
||||
export declare function isSSRSafeAttrName(name: string): boolean;
|
||||
export declare const propsToAttrMap: Record<string, string | undefined>;
|
||||
/**
|
||||
* Known attributes, this is used for stringification of runtime static nodes
|
||||
* so that we don't stringify bindings that cannot be set from HTML.
|
||||
* Don't also forget to allow `data-*` and `aria-*`!
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||
*/
|
||||
export declare const isKnownHtmlAttr: (key: string) => boolean;
|
||||
/**
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
||||
*/
|
||||
export declare const isKnownSvgAttr: (key: string) => boolean;
|
||||
/**
|
||||
* Shared between server-renderer and runtime-core hydration logic
|
||||
*/
|
||||
export declare function isRenderableAttrValue(value: unknown): boolean;
|
||||
|
||||
export declare function escapeHtml(string: unknown): string;
|
||||
export declare function escapeHtmlComment(src: string): string;
|
||||
|
||||
export declare function looseEqual(a: any, b: any): boolean;
|
||||
export declare function looseIndexOf(arr: any[], val: any): number;
|
||||
|
||||
/**
|
||||
* For converting {{ interpolation }} values to displayed strings.
|
||||
@@ -340,17 +309,15 @@ export declare function stringifyStyle(styles: NormalizedStyle | string | undefi
|
||||
*/
|
||||
export declare const toDisplayString: (val: unknown) => string;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const toHandlerKey: (str: string) => string;
|
||||
export type Prettify<T> = {
|
||||
[K in keyof T]: T[K];
|
||||
} & {};
|
||||
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
||||
export type LooseRequired<T> = {
|
||||
[P in keyof (T & Required<T>)]: T[P];
|
||||
};
|
||||
export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
||||
export type Awaited<T> = T extends null | undefined ? T : T extends object & {
|
||||
then(onfulfilled: infer F, ...args: infer _): any;
|
||||
} ? F extends (value: infer V, ...args: infer _) => any ? Awaited<V> : never : T;
|
||||
|
||||
export declare const toNumber: (val: any) => any;
|
||||
|
||||
export declare const toRawType: (value: unknown) => string;
|
||||
|
||||
export declare const toTypeString: (value: unknown) => string;
|
||||
|
||||
export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
||||
|
||||
export { }
|
||||
|
||||
+452
-558
File diff suppressed because it is too large
Load Diff
+16
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vue/shared",
|
||||
"version": "3.2.36",
|
||||
"version": "3.4.15",
|
||||
"description": "internal utils shared across @vue packages",
|
||||
"main": "index.js",
|
||||
"module": "dist/shared.esm-bundler.js",
|
||||
@@ -9,6 +9,20 @@
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/shared.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/shared.cjs.prod.js",
|
||||
"development": "./dist/shared.cjs.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"module": "./dist/shared.esm-bundler.js",
|
||||
"import": "./dist/shared.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"buildOptions": {
|
||||
"formats": [
|
||||
@@ -30,4 +44,4 @@
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
|
||||
}
|
||||
}
|
||||
+27
@@ -1,5 +1,32 @@
|
||||
# Changelog
|
||||
|
||||
## [1.6.5](https://github.com/axios/axios/compare/v1.6.4...v1.6.5) (2024-01-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ci:** refactor notify action as a job of publish action; ([#6176](https://github.com/axios/axios/issues/6176)) ([0736f95](https://github.com/axios/axios/commit/0736f95ce8776366dc9ca569f49ba505feb6373c))
|
||||
* **dns:** fixed lookup error handling; ([#6175](https://github.com/axios/axios/issues/6175)) ([f4f2b03](https://github.com/axios/axios/commit/f4f2b039dd38eb4829e8583caede4ed6d2dd59be))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+41/-6 (#6176 #6175 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman "+6/-1 ()")
|
||||
|
||||
## [1.6.4](https://github.com/axios/axios/compare/v1.6.3...v1.6.4) (2024-01-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **security:** fixed formToJSON prototype pollution vulnerability; ([#6167](https://github.com/axios/axios/issues/6167)) ([3c0c11c](https://github.com/axios/axios/commit/3c0c11cade045c4412c242b5727308cff9897a0e))
|
||||
* **security:** fixed security vulnerability in follow-redirects ([#6163](https://github.com/axios/axios/issues/6163)) ([75af1cd](https://github.com/axios/axios/commit/75af1cdff5b3a6ca3766d3d3afbc3115bb0811b8))
|
||||
|
||||
### Contributors to this release
|
||||
|
||||
- <img src="https://avatars.githubusercontent.com/u/4814473?v=4&s=18" alt="avatar" width="18"/> [Jay](https://github.com/jasonsaayman "+34/-6 ()")
|
||||
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+34/-3 (#6172 #6167 )")
|
||||
- <img src="https://avatars.githubusercontent.com/u/1402060?v=4&s=18" alt="avatar" width="18"/> [Guy Nesher](https://github.com/gnesher "+10/-10 (#6163 )")
|
||||
|
||||
## [1.6.3](https://github.com/axios/axios/compare/v1.6.2...v1.6.3) (2023-12-26)
|
||||
|
||||
|
||||
|
||||
+37
-4
@@ -1,17 +1,50 @@
|
||||
<h3 align="center">
|
||||
Platinum sponsors
|
||||
<br>
|
||||
</h3>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://axios-http.com"><img src="https://axios-http.com/assets/logo.svg" /></a><br>
|
||||
<a href="https://runalloy.com?utm_source=github&utm_medium=referral&utm_campaign=121423_axios">
|
||||
<picture>
|
||||
<source width="400px" media="(prefers-color-scheme: dark)" srcset="https://github.com/axios/axios/assets/4814473/f6067247-7eba-4069-852a-ab1bb85b1780">
|
||||
<source width="400px" media="(prefers-color-scheme: light)" srcset="https://github.com/axios/axios/assets/4814473/75c37f4d-36e6-44f5-a068-3edd77c00a10">
|
||||
<img width="400px" src="https://github.com/axios/axios/assets/4814473/75c37f4d-36e6-44f5-a068-3edd77c00a10" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
<p align="center">Alloy is the integration development platform that makes it simple and <br>fast for SaaS companies to launch critical user-facing integrations.</p>
|
||||
<p align="center">
|
||||
<a href="https://runalloy.com/signup?utm_source=github&utm_medium=referral&utm_campaign=11823_axios"><b>Sign up free</b></a> •
|
||||
<a href="https://docs.runalloy.com/docs?utm_source=github&utm_medium=referral&utm_campaign=11823_axios"><b>Documentation</b></a>
|
||||
</p>
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
<h3 align="center">
|
||||
A special thanks to your headline sponsors
|
||||
Gold sponsors
|
||||
<br><br>
|
||||
</h3>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://runalloy.com?utm_source=github&utm_medium=referral&utm_campaign=121423_axios"><img style="width:20rem" src="https://github.com/axios/axios/assets/4814473/d50a6cbb-bbe7-4e70-9e1a-f698c6cdc437" /></a>
|
||||
<br><br>
|
||||
<a href="https://stytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=logo&utm_campaign=axios-http">
|
||||
<picture>
|
||||
<source width="200px" media="(prefers-color-scheme: dark)" srcset="https://github.com/axios/axios/assets/4814473/538d715a-13c7-4668-ae7d-37a4548423f4">
|
||||
<source width="200px" media="(prefers-color-scheme: light)" srcset="https://github.com/axios/axios/assets/4814473/b6a9a7bc-9fb1-4b9b-909f-1b4bee1fd142">
|
||||
<img width="200px" src="https://github.com/axios/axios/assets/4814473/b6a9a7bc-9fb1-4b9b-909f-1b4bee1fd142" />
|
||||
</picture>
|
||||
</a>
|
||||
<p align="center">API-first authentication, authorization, and fraud prevention</p>
|
||||
<p align="center">
|
||||
<a href="https://stytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http"><b>Website</b></a> •
|
||||
<a href="https://stytch.com/docs?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=docs-link&utm_campaign=axios-http"><b>Documentation</b></a> • <a href="https://github.com/stytchauth/stytch-node?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=node-sdk&utm_campaign=axios-http"><b>Node.js Backend SDK</b></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<br><br>
|
||||
<div align="center">
|
||||
<a href="https://axios-http.com"><img src="https://axios-http.com/assets/logo.svg" /></a><br>
|
||||
</div>
|
||||
|
||||
<p align="center">Promise based HTTP client for the browser and node.js</p>
|
||||
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Axios v1.6.3 Copyright (c) 2023 Matt Zabriskie and contributors
|
||||
// Axios v1.6.5 Copyright (c) 2024 Matt Zabriskie and contributors
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
@@ -1387,6 +1387,7 @@
|
||||
function formDataToJSON(formData) {
|
||||
function buildPath(path, value, target, index) {
|
||||
var name = path[index++];
|
||||
if (name === '__proto__') return true;
|
||||
var isNumericKey = Number.isFinite(+name);
|
||||
var isLast = index >= path.length;
|
||||
name = !name && utils$1.isArray(target) ? target.length : name;
|
||||
@@ -2519,7 +2520,7 @@
|
||||
return config;
|
||||
}
|
||||
|
||||
var VERSION = "1.6.3";
|
||||
var VERSION = "1.6.5";
|
||||
|
||||
var validators$1 = {};
|
||||
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+5
-2
@@ -1,4 +1,4 @@
|
||||
// Axios v1.6.3 Copyright (c) 2023 Matt Zabriskie and contributors
|
||||
// Axios v1.6.5 Copyright (c) 2024 Matt Zabriskie and contributors
|
||||
'use strict';
|
||||
|
||||
function bind(fn, thisArg) {
|
||||
@@ -1352,6 +1352,9 @@ function arrayToObject(arr) {
|
||||
function formDataToJSON(formData) {
|
||||
function buildPath(path, value, target, index) {
|
||||
let name = path[index++];
|
||||
|
||||
if (name === '__proto__') return true;
|
||||
|
||||
const isNumericKey = Number.isFinite(+name);
|
||||
const isLast = index >= path.length;
|
||||
name = !name && utils$1.isArray(target) ? target.length : name;
|
||||
@@ -2655,7 +2658,7 @@ function mergeConfig(config1, config2) {
|
||||
return config;
|
||||
}
|
||||
|
||||
const VERSION = "1.6.3";
|
||||
const VERSION = "1.6.5";
|
||||
|
||||
const validators$1 = {};
|
||||
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+5
-2
@@ -1,4 +1,4 @@
|
||||
// Axios v1.6.3 Copyright (c) 2023 Matt Zabriskie and contributors
|
||||
// Axios v1.6.5 Copyright (c) 2024 Matt Zabriskie and contributors
|
||||
function bind(fn, thisArg) {
|
||||
return function wrap() {
|
||||
return fn.apply(thisArg, arguments);
|
||||
@@ -1350,6 +1350,9 @@ function arrayToObject(arr) {
|
||||
function formDataToJSON(formData) {
|
||||
function buildPath(path, value, target, index) {
|
||||
let name = path[index++];
|
||||
|
||||
if (name === '__proto__') return true;
|
||||
|
||||
const isNumericKey = Number.isFinite(+name);
|
||||
const isLast = index >= path.length;
|
||||
name = !name && utils$1.isArray(target) ? target.length : name;
|
||||
@@ -2653,7 +2656,7 @@ function mergeConfig$1(config1, config2) {
|
||||
return config;
|
||||
}
|
||||
|
||||
const VERSION$1 = "1.6.3";
|
||||
const VERSION$1 = "1.6.5";
|
||||
|
||||
const validators$1 = {};
|
||||
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+9
-2
@@ -1,4 +1,4 @@
|
||||
// Axios v1.6.3 Copyright (c) 2023 Matt Zabriskie and contributors
|
||||
// Axios v1.6.5 Copyright (c) 2024 Matt Zabriskie and contributors
|
||||
'use strict';
|
||||
|
||||
const FormData$1 = require('form-data');
|
||||
@@ -1368,6 +1368,9 @@ function arrayToObject(arr) {
|
||||
function formDataToJSON(formData) {
|
||||
function buildPath(path, value, target, index) {
|
||||
let name = path[index++];
|
||||
|
||||
if (name === '__proto__') return true;
|
||||
|
||||
const isNumericKey = Number.isFinite(+name);
|
||||
const isLast = index >= path.length;
|
||||
name = !name && utils$1.isArray(target) ? target.length : name;
|
||||
@@ -2019,7 +2022,7 @@ function buildFullPath(baseURL, requestedURL) {
|
||||
return requestedURL;
|
||||
}
|
||||
|
||||
const VERSION = "1.6.3";
|
||||
const VERSION = "1.6.5";
|
||||
|
||||
function parseProtocol(url) {
|
||||
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
||||
@@ -2650,6 +2653,10 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
// hotfix to support opt.all option which is required for node 20.x
|
||||
lookup = (hostname, opt, cb) => {
|
||||
_lookup(hostname, opt, (err, arg0, arg1) => {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
||||
|
||||
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+4
@@ -171,6 +171,10 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
// hotfix to support opt.all option which is required for node 20.x
|
||||
lookup = (hostname, opt, cb) => {
|
||||
_lookup(hostname, opt, (err, arg0, arg1) => {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
||||
|
||||
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
export const VERSION = "1.6.3";
|
||||
export const VERSION = "1.6.5";
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user