@builder.io/sdk-vue 0.5.9 → 0.6.1-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -4
- package/package.json +145 -22
- package/vue2/css/package.json +4 -0
- package/vue2/node_modules/@types/node/LICENSE +21 -0
- package/vue2/node_modules/@types/node/README.md +16 -0
- package/vue2/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/vue2/node_modules/@types/node/assert.d.ts +962 -0
- package/vue2/node_modules/@types/node/async_hooks.d.ts +497 -0
- package/vue2/node_modules/@types/node/buffer.d.ts +2236 -0
- package/vue2/node_modules/@types/node/child_process.d.ts +1396 -0
- package/vue2/node_modules/@types/node/cluster.d.ts +414 -0
- package/vue2/node_modules/@types/node/console.d.ts +412 -0
- package/vue2/node_modules/@types/node/constants.d.ts +18 -0
- package/vue2/node_modules/@types/node/crypto.d.ts +3869 -0
- package/vue2/node_modules/@types/node/dgram.d.ts +545 -0
- package/vue2/node_modules/@types/node/diagnostics_channel.d.ts +191 -0
- package/vue2/node_modules/@types/node/dns/promises.d.ts +369 -0
- package/vue2/node_modules/@types/node/dns.d.ts +655 -0
- package/vue2/node_modules/@types/node/domain.d.ts +170 -0
- package/vue2/node_modules/@types/node/events.d.ts +641 -0
- package/vue2/node_modules/@types/node/fs/promises.d.ts +1094 -0
- package/vue2/node_modules/@types/node/fs.d.ts +3803 -0
- package/vue2/node_modules/@types/node/globals.d.ts +287 -0
- package/vue2/node_modules/@types/node/globals.global.d.ts +1 -0
- package/vue2/node_modules/@types/node/http.d.ts +1504 -0
- package/vue2/node_modules/@types/node/http2.d.ts +2100 -0
- package/vue2/node_modules/@types/node/https.d.ts +532 -0
- package/vue2/node_modules/@types/node/index.d.ts +131 -0
- package/vue2/node_modules/@types/node/inspector.d.ts +2745 -0
- package/vue2/node_modules/@types/node/module.d.ts +115 -0
- package/vue2/node_modules/@types/node/net.d.ts +828 -0
- package/vue2/node_modules/@types/node/os.d.ts +455 -0
- package/vue2/node_modules/@types/node/package.json +232 -0
- package/vue2/node_modules/@types/node/path.d.ts +191 -0
- package/vue2/node_modules/@types/node/perf_hooks.d.ts +586 -0
- package/vue2/node_modules/@types/node/process.d.ts +1481 -0
- package/vue2/node_modules/@types/node/punycode.d.ts +117 -0
- package/vue2/node_modules/@types/node/querystring.d.ts +131 -0
- package/vue2/node_modules/@types/node/readline.d.ts +543 -0
- package/vue2/node_modules/@types/node/repl.d.ts +424 -0
- package/vue2/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/vue2/node_modules/@types/node/stream/promises.d.ts +42 -0
- package/vue2/node_modules/@types/node/stream/web.d.ts +392 -0
- package/vue2/node_modules/@types/node/stream.d.ts +1363 -0
- package/vue2/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/vue2/node_modules/@types/node/test.d.ts +190 -0
- package/vue2/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/vue2/node_modules/@types/node/timers.d.ts +94 -0
- package/vue2/node_modules/@types/node/tls.d.ts +1019 -0
- package/vue2/node_modules/@types/node/trace_events.d.ts +161 -0
- package/vue2/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/vue2/node_modules/@types/node/ts4.8/assert.d.ts +962 -0
- package/vue2/node_modules/@types/node/ts4.8/async_hooks.d.ts +497 -0
- package/vue2/node_modules/@types/node/ts4.8/buffer.d.ts +2236 -0
- package/vue2/node_modules/@types/node/ts4.8/child_process.d.ts +1396 -0
- package/vue2/node_modules/@types/node/ts4.8/cluster.d.ts +414 -0
- package/vue2/node_modules/@types/node/ts4.8/console.d.ts +412 -0
- package/vue2/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
- package/vue2/node_modules/@types/node/ts4.8/crypto.d.ts +3866 -0
- package/vue2/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
- package/vue2/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
- package/vue2/node_modules/@types/node/ts4.8/dns/promises.d.ts +368 -0
- package/vue2/node_modules/@types/node/ts4.8/dns.d.ts +654 -0
- package/vue2/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/vue2/node_modules/@types/node/ts4.8/events.d.ts +641 -0
- package/vue2/node_modules/@types/node/ts4.8/fs/promises.d.ts +1094 -0
- package/vue2/node_modules/@types/node/ts4.8/fs.d.ts +3802 -0
- package/vue2/node_modules/@types/node/ts4.8/globals.d.ts +284 -0
- package/vue2/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/vue2/node_modules/@types/node/ts4.8/http.d.ts +1503 -0
- package/vue2/node_modules/@types/node/ts4.8/http2.d.ts +2100 -0
- package/vue2/node_modules/@types/node/ts4.8/https.d.ts +532 -0
- package/vue2/node_modules/@types/node/ts4.8/index.d.ts +86 -0
- package/vue2/node_modules/@types/node/ts4.8/inspector.d.ts +2745 -0
- package/vue2/node_modules/@types/node/ts4.8/module.d.ts +115 -0
- package/vue2/node_modules/@types/node/ts4.8/net.d.ts +828 -0
- package/vue2/node_modules/@types/node/ts4.8/os.d.ts +456 -0
- package/vue2/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/vue2/node_modules/@types/node/ts4.8/perf_hooks.d.ts +586 -0
- package/vue2/node_modules/@types/node/ts4.8/process.d.ts +1481 -0
- package/vue2/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/vue2/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
- package/vue2/node_modules/@types/node/ts4.8/readline.d.ts +543 -0
- package/vue2/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
- package/vue2/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/vue2/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
- package/vue2/node_modules/@types/node/ts4.8/stream/web.d.ts +392 -0
- package/vue2/node_modules/@types/node/ts4.8/stream.d.ts +1363 -0
- package/vue2/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/vue2/node_modules/@types/node/ts4.8/test.d.ts +190 -0
- package/vue2/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/vue2/node_modules/@types/node/ts4.8/timers.d.ts +94 -0
- package/vue2/node_modules/@types/node/ts4.8/tls.d.ts +1019 -0
- package/vue2/node_modules/@types/node/ts4.8/trace_events.d.ts +161 -0
- package/vue2/node_modules/@types/node/ts4.8/tty.d.ts +204 -0
- package/vue2/node_modules/@types/node/ts4.8/url.d.ts +855 -0
- package/vue2/node_modules/@types/node/ts4.8/util.d.ts +1594 -0
- package/vue2/node_modules/@types/node/ts4.8/v8.d.ts +472 -0
- package/vue2/node_modules/@types/node/ts4.8/vm.d.ts +507 -0
- package/vue2/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
- package/vue2/node_modules/@types/node/ts4.8/worker_threads.d.ts +649 -0
- package/vue2/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/vue2/node_modules/@types/node/tty.d.ts +204 -0
- package/vue2/node_modules/@types/node/url.d.ts +855 -0
- package/vue2/node_modules/@types/node/util.d.ts +1594 -0
- package/vue2/node_modules/@types/node/v8.d.ts +472 -0
- package/vue2/node_modules/@types/node/vm.d.ts +507 -0
- package/vue2/node_modules/@types/node/wasi.d.ts +158 -0
- package/vue2/node_modules/@types/node/worker_threads.d.ts +649 -0
- package/vue2/node_modules/@types/node/zlib.d.ts +517 -0
- package/vue2/node_modules/@vitejs/plugin-vue2/LICENSE +21 -0
- package/vue2/node_modules/@vitejs/plugin-vue2/README.md +115 -0
- package/vue2/node_modules/@vitejs/plugin-vue2/package.json +65 -0
- package/vue2/node_modules/@vue/compiler-sfc/LICENSE +21 -0
- package/vue2/node_modules/@vue/compiler-sfc/package.json +34 -0
- package/vue2/node_modules/@vue/tsconfig/README.md +31 -0
- package/vue2/node_modules/@vue/tsconfig/package.json +35 -0
- package/vue2/node_modules/@vue/tsconfig/tsconfig.json +40 -0
- package/vue2/node_modules/@vue/tsconfig/tsconfig.node.json +17 -0
- package/vue2/node_modules/@vue/tsconfig/tsconfig.web.json +19 -0
- package/vue2/node_modules/rollup/LICENSE.md +695 -0
- package/vue2/node_modules/rollup/README.md +125 -0
- package/vue2/node_modules/rollup/package.json +178 -0
- package/vue2/node_modules/vite/LICENSE.md +3396 -0
- package/vue2/node_modules/vite/README.md +20 -0
- package/vue2/node_modules/vite/bin/openChrome.applescript +95 -0
- package/vue2/node_modules/vite/bin/vite.js +61 -0
- package/vue2/node_modules/vite/client.d.ts +281 -0
- package/vue2/node_modules/vite/index.cjs +34 -0
- package/vue2/node_modules/vite/package.json +170 -0
- package/vue2/node_modules/vite-plugin-dts/LICENSE +21 -0
- package/vue2/node_modules/vite-plugin-dts/README.md +368 -0
- package/vue2/node_modules/vite-plugin-dts/README.zh-CN.md +368 -0
- package/vue2/node_modules/vite-plugin-dts/node_modules/vue-tsc/LICENSE +21 -0
- package/vue2/node_modules/vite-plugin-dts/node_modules/vue-tsc/README.md +36 -0
- package/vue2/node_modules/vite-plugin-dts/node_modules/vue-tsc/bin/vue-tsc.js +67 -0
- package/vue2/node_modules/vite-plugin-dts/node_modules/vue-tsc/out/index.d.ts +16 -0
- package/vue2/node_modules/vite-plugin-dts/node_modules/vue-tsc/out/index.js +120 -0
- package/vue2/node_modules/vite-plugin-dts/node_modules/vue-tsc/out/shared.d.ts +8 -0
- package/vue2/node_modules/vite-plugin-dts/node_modules/vue-tsc/out/shared.js +5 -0
- package/vue2/node_modules/vite-plugin-dts/node_modules/vue-tsc/package.json +28 -0
- package/vue2/node_modules/vite-plugin-dts/package.json +103 -0
- package/vue2/node_modules/vue/LICENSE +21 -0
- package/vue2/node_modules/vue/README.md +118 -0
- package/vue2/node_modules/vue/compiler-sfc/index.d.ts +1 -0
- package/vue2/node_modules/vue/compiler-sfc/index.js +1 -0
- package/vue2/node_modules/vue/compiler-sfc/index.mjs +1 -0
- package/vue2/node_modules/vue/compiler-sfc/package.json +5 -0
- package/vue2/node_modules/vue/package.json +132 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/api-extractor.json +64 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/node_modules/.bin/lessc +17 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/node_modules/.bin/parser +17 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/node_modules/.bin/sass +17 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/node_modules/.bin/stylus +17 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/package.json +34 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/babelUtils.ts +423 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/compileScript.ts +1911 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/compileStyle.ts +147 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/compileTemplate.ts +205 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/cssVars.ts +179 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/index.ts +31 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/parse.ts +129 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/parseComponent.ts +220 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/prefixIdentifiers.ts +82 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/rewriteDefault.ts +115 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/stylePlugins/scoped.ts +203 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/stylePlugins/trim.ts +18 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/stylePreprocessors.ts +135 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/templateCompilerModules/assetUrl.ts +84 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/templateCompilerModules/srcset.ts +76 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/templateCompilerModules/utils.ts +86 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/types.ts +69 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/src/warn.ts +16 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/test/__snapshots__/compileScript.spec.ts.snap +925 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/test/__snapshots__/cssVars.spec.ts.snap +189 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/test/compileScript.spec.ts +1594 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/test/compileStyle.spec.ts +203 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/test/compileTemplate.spec.ts +258 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/test/cssVars.spec.ts +247 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/test/parseComponent.spec.ts +269 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/test/prefixIdentifiers.spec.ts +97 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/test/rewriteDefault.spec.ts +245 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/test/stylePluginScoped.spec.ts +137 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/test/tsconfig.json +7 -0
- package/vue2/node_modules/vue/packages/compiler-sfc/test/util.ts +35 -0
- package/vue2/node_modules/vue/src/compiler/codeframe.ts +52 -0
- package/vue2/node_modules/vue/src/compiler/codegen/events.ts +170 -0
- package/vue2/node_modules/vue/src/compiler/codegen/index.ts +668 -0
- package/vue2/node_modules/vue/src/compiler/create-compiler.ts +83 -0
- package/vue2/node_modules/vue/src/compiler/directives/bind.ts +9 -0
- package/vue2/node_modules/vue/src/compiler/directives/index.ts +9 -0
- package/vue2/node_modules/vue/src/compiler/directives/model.ts +145 -0
- package/vue2/node_modules/vue/src/compiler/directives/on.ts +9 -0
- package/vue2/node_modules/vue/src/compiler/error-detector.ts +158 -0
- package/vue2/node_modules/vue/src/compiler/helpers.ts +243 -0
- package/vue2/node_modules/vue/src/compiler/index.ts +24 -0
- package/vue2/node_modules/vue/src/compiler/optimizer.ts +135 -0
- package/vue2/node_modules/vue/src/compiler/parser/entity-decoder.ts +9 -0
- package/vue2/node_modules/vue/src/compiler/parser/filter-parser.ts +116 -0
- package/vue2/node_modules/vue/src/compiler/parser/html-parser.ts +341 -0
- package/vue2/node_modules/vue/src/compiler/parser/index.ts +999 -0
- package/vue2/node_modules/vue/src/compiler/parser/text-parser.ts +52 -0
- package/vue2/node_modules/vue/src/compiler/to-function.ts +119 -0
- package/vue2/node_modules/vue/src/core/components/index.ts +5 -0
- package/vue2/node_modules/vue/src/core/components/keep-alive.ts +165 -0
- package/vue2/node_modules/vue/src/core/config.ts +128 -0
- package/vue2/node_modules/vue/src/core/global-api/assets.ts +35 -0
- package/vue2/node_modules/vue/src/core/global-api/extend.ts +94 -0
- package/vue2/node_modules/vue/src/core/global-api/index.ts +68 -0
- package/vue2/node_modules/vue/src/core/global-api/mixin.ts +9 -0
- package/vue2/node_modules/vue/src/core/global-api/use.ts +23 -0
- package/vue2/node_modules/vue/src/core/index.ts +27 -0
- package/vue2/node_modules/vue/src/core/instance/events.ts +160 -0
- package/vue2/node_modules/vue/src/core/instance/index.ts +27 -0
- package/vue2/node_modules/vue/src/core/instance/init.ts +140 -0
- package/vue2/node_modules/vue/src/core/instance/inject.ts +80 -0
- package/vue2/node_modules/vue/src/core/instance/lifecycle.ts +415 -0
- package/vue2/node_modules/vue/src/core/instance/proxy.ts +97 -0
- package/vue2/node_modules/vue/src/core/instance/render-helpers/bind-dynamic-keys.ts +36 -0
- package/vue2/node_modules/vue/src/core/instance/render-helpers/bind-object-listeners.ts +18 -0
- package/vue2/node_modules/vue/src/core/instance/render-helpers/bind-object-props.ts +59 -0
- package/vue2/node_modules/vue/src/core/instance/render-helpers/check-keycodes.ts +33 -0
- package/vue2/node_modules/vue/src/core/instance/render-helpers/index.ts +31 -0
- package/vue2/node_modules/vue/src/core/instance/render-helpers/render-list.ts +49 -0
- package/vue2/node_modules/vue/src/core/instance/render-helpers/render-slot.ts +39 -0
- package/vue2/node_modules/vue/src/core/instance/render-helpers/render-static.ts +57 -0
- package/vue2/node_modules/vue/src/core/instance/render-helpers/resolve-filter.ts +8 -0
- package/vue2/node_modules/vue/src/core/instance/render-helpers/resolve-scoped-slots.ts +30 -0
- package/vue2/node_modules/vue/src/core/instance/render-helpers/resolve-slots.ts +51 -0
- package/vue2/node_modules/vue/src/core/instance/render.ts +173 -0
- package/vue2/node_modules/vue/src/core/instance/state.ts +387 -0
- package/vue2/node_modules/vue/src/core/observer/array.ts +54 -0
- package/vue2/node_modules/vue/src/core/observer/dep.ts +108 -0
- package/vue2/node_modules/vue/src/core/observer/index.ts +338 -0
- package/vue2/node_modules/vue/src/core/observer/scheduler.ts +199 -0
- package/vue2/node_modules/vue/src/core/observer/traverse.ts +47 -0
- package/vue2/node_modules/vue/src/core/observer/watcher.ts +278 -0
- package/vue2/node_modules/vue/src/core/util/debug.ts +105 -0
- package/vue2/node_modules/vue/src/core/util/env.ts +93 -0
- package/vue2/node_modules/vue/src/core/util/error.ts +81 -0
- package/vue2/node_modules/vue/src/core/util/index.ts +9 -0
- package/vue2/node_modules/vue/src/core/util/lang.ts +45 -0
- package/vue2/node_modules/vue/src/core/util/next-tick.ts +117 -0
- package/vue2/node_modules/vue/src/core/util/options.ts +489 -0
- package/vue2/node_modules/vue/src/core/util/perf.ts +28 -0
- package/vue2/node_modules/vue/src/core/util/props.ts +254 -0
- package/vue2/node_modules/vue/src/core/vdom/create-component.ts +275 -0
- package/vue2/node_modules/vue/src/core/vdom/create-element.ts +172 -0
- package/vue2/node_modules/vue/src/core/vdom/create-functional-component.ts +180 -0
- package/vue2/node_modules/vue/src/core/vdom/helpers/extract-props.ts +75 -0
- package/vue2/node_modules/vue/src/core/vdom/helpers/get-first-component-child.ts +16 -0
- package/vue2/node_modules/vue/src/core/vdom/helpers/index.ts +7 -0
- package/vue2/node_modules/vue/src/core/vdom/helpers/is-async-placeholder.ts +6 -0
- package/vue2/node_modules/vue/src/core/vdom/helpers/merge-hook.ts +40 -0
- package/vue2/node_modules/vue/src/core/vdom/helpers/normalize-children.ts +99 -0
- package/vue2/node_modules/vue/src/core/vdom/helpers/normalize-scoped-slots.ts +97 -0
- package/vue2/node_modules/vue/src/core/vdom/helpers/resolve-async-component.ts +157 -0
- package/vue2/node_modules/vue/src/core/vdom/helpers/update-listeners.ts +101 -0
- package/vue2/node_modules/vue/src/core/vdom/modules/directives.ts +137 -0
- package/vue2/node_modules/vue/src/core/vdom/modules/index.ts +4 -0
- package/vue2/node_modules/vue/src/core/vdom/modules/template-ref.ts +94 -0
- package/vue2/node_modules/vue/src/core/vdom/patch.ts +904 -0
- package/vue2/node_modules/vue/src/core/vdom/vnode.ts +119 -0
- package/vue2/node_modules/vue/src/global.d.ts +17 -0
- package/vue2/node_modules/vue/src/platforms/web/compiler/directives/html.ts +8 -0
- package/vue2/node_modules/vue/src/platforms/web/compiler/directives/index.ts +9 -0
- package/vue2/node_modules/vue/src/platforms/web/compiler/directives/model.ts +181 -0
- package/vue2/node_modules/vue/src/platforms/web/compiler/directives/text.ts +8 -0
- package/vue2/node_modules/vue/src/platforms/web/compiler/index.ts +6 -0
- package/vue2/node_modules/vue/src/platforms/web/compiler/modules/class.ts +44 -0
- package/vue2/node_modules/vue/src/platforms/web/compiler/modules/index.ts +5 -0
- package/vue2/node_modules/vue/src/platforms/web/compiler/modules/model.ts +89 -0
- package/vue2/node_modules/vue/src/platforms/web/compiler/modules/style.ts +47 -0
- package/vue2/node_modules/vue/src/platforms/web/compiler/options.ts +25 -0
- package/vue2/node_modules/vue/src/platforms/web/compiler/util.ts +22 -0
- package/vue2/node_modules/vue/src/platforms/web/entry-compiler.ts +4 -0
- package/vue2/node_modules/vue/src/platforms/web/entry-runtime-esm.ts +5 -0
- package/vue2/node_modules/vue/src/platforms/web/entry-runtime-with-compiler-esm.ts +5 -0
- package/vue2/node_modules/vue/src/platforms/web/entry-runtime-with-compiler.ts +10 -0
- package/vue2/node_modules/vue/src/platforms/web/entry-runtime.ts +7 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/class-util.ts +61 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/components/index.ts +7 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/components/transition-group.ts +204 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/components/transition.ts +205 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/directives/index.ts +7 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/directives/model.ts +148 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/directives/show.ts +61 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/index.ts +75 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/modules/attrs.ts +115 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/modules/class.ts +37 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/modules/dom-props.ts +123 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/modules/events.ts +127 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/modules/index.ts +8 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/modules/style.ts +104 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/modules/transition.ts +341 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/node-ops.ts +66 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/patch.ts +10 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime/transition-util.ts +215 -0
- package/vue2/node_modules/vue/src/platforms/web/runtime-with-compiler.ts +110 -0
- package/vue2/node_modules/vue/src/platforms/web/util/attrs.ts +58 -0
- package/vue2/node_modules/vue/src/platforms/web/util/class.ts +87 -0
- package/vue2/node_modules/vue/src/platforms/web/util/compat.ts +16 -0
- package/vue2/node_modules/vue/src/platforms/web/util/element.ts +76 -0
- package/vue2/node_modules/vue/src/platforms/web/util/index.ts +21 -0
- package/vue2/node_modules/vue/src/platforms/web/util/style.ts +71 -0
- package/vue2/node_modules/vue/src/shared/constants.ts +20 -0
- package/vue2/node_modules/vue/src/shared/util.ts +372 -0
- package/vue2/node_modules/vue/src/v3/apiAsyncComponent.ts +117 -0
- package/vue2/node_modules/vue/src/v3/apiInject.ts +71 -0
- package/vue2/node_modules/vue/src/v3/apiLifecycle.ts +68 -0
- package/vue2/node_modules/vue/src/v3/apiSetup.ts +246 -0
- package/vue2/node_modules/vue/src/v3/apiWatch.ts +349 -0
- package/vue2/node_modules/vue/src/v3/currentInstance.ts +23 -0
- package/vue2/node_modules/vue/src/v3/debug.ts +21 -0
- package/vue2/node_modules/vue/src/v3/h.ts +18 -0
- package/vue2/node_modules/vue/src/v3/index.ts +96 -0
- package/vue2/node_modules/vue/src/v3/reactivity/computed.ts +100 -0
- package/vue2/node_modules/vue/src/v3/reactivity/effect.ts +20 -0
- package/vue2/node_modules/vue/src/v3/reactivity/effectScope.ts +137 -0
- package/vue2/node_modules/vue/src/v3/reactivity/operations.ts +14 -0
- package/vue2/node_modules/vue/src/v3/reactivity/reactive.ts +137 -0
- package/vue2/node_modules/vue/src/v3/reactivity/readonly.ts +127 -0
- package/vue2/node_modules/vue/src/v3/reactivity/ref.ts +296 -0
- package/vue2/node_modules/vue/src/v3/sfc-helpers/useCssModule.ts +24 -0
- package/vue2/node_modules/vue/src/v3/sfc-helpers/useCssVars.ts +34 -0
- package/vue2/package.json +49 -0
- package/vue2/src/blocks/BaseText.vue +25 -0
- package/vue2/src/blocks/button/button.vue +68 -0
- package/vue2/src/blocks/button/component-info.ts +35 -0
- package/vue2/src/blocks/columns/columns.vue +238 -0
- package/vue2/src/blocks/columns/component-info.ts +219 -0
- package/vue2/src/blocks/custom-code/component-info.ts +24 -0
- package/vue2/src/blocks/custom-code/custom-code.vue +88 -0
- package/vue2/src/blocks/embed/component-info.ts +38 -0
- package/vue2/src/blocks/embed/embed.vue +71 -0
- package/vue2/src/blocks/embed/helpers.ts +2 -0
- package/vue2/src/blocks/form/component-info.ts +233 -0
- package/vue2/src/blocks/form/form.vue +7 -0
- package/vue2/src/blocks/fragment/component-info.ts +8 -0
- package/vue2/src/blocks/fragment/fragment.vue +19 -0
- package/vue2/src/blocks/helpers.ts +43 -0
- package/vue2/src/blocks/image/component-info.ts +124 -0
- package/vue2/src/blocks/image/image.helpers.ts +47 -0
- package/vue2/src/blocks/image/image.vue +174 -0
- package/vue2/src/blocks/img/component-info.ts +16 -0
- package/vue2/src/blocks/img/img.vue +59 -0
- package/vue2/src/blocks/input/component-info.ts +47 -0
- package/vue2/src/blocks/input/input.vue +52 -0
- package/vue2/src/blocks/raw-text/component-info.ts +11 -0
- package/vue2/src/blocks/raw-text/raw-text.vue +35 -0
- package/vue2/src/blocks/section/component-info.ts +41 -0
- package/vue2/src/blocks/section/section.vue +47 -0
- package/vue2/src/blocks/select/component-info.ts +44 -0
- package/vue2/src/blocks/select/select.vue +50 -0
- package/vue2/src/blocks/submit-button/component-info.ts +27 -0
- package/vue2/src/blocks/submit-button/submit-button.vue +34 -0
- package/vue2/src/blocks/symbol/component-info.ts +35 -0
- package/vue2/src/blocks/symbol/symbol.helpers.ts +47 -0
- package/vue2/src/blocks/symbol/symbol.vue +143 -0
- package/vue2/src/blocks/text/component-info.ts +20 -0
- package/vue2/src/blocks/text/text.vue +23 -0
- package/vue2/src/blocks/textarea/component-info.ts +38 -0
- package/vue2/src/blocks/textarea/textarea.vue +38 -0
- package/vue2/src/blocks/video/component-info.ts +83 -0
- package/vue2/src/blocks/video/video.vue +105 -0
- package/vue2/src/components/block/block.helpers.ts +89 -0
- package/vue2/src/components/block/block.vue +203 -0
- package/vue2/src/components/block/components/block-styles.vue +110 -0
- package/vue2/src/components/block/components/block-wrapper.vue +83 -0
- package/vue2/src/components/block/components/component-ref/component-ref.helpers.ts +52 -0
- package/vue2/src/components/block/components/component-ref/component-ref.vue +97 -0
- package/vue2/src/components/block/components/interactive-element.vue +48 -0
- package/vue2/src/components/block/components/repeated-block.vue +51 -0
- package/vue2/src/components/block/types.ts +6 -0
- package/vue2/src/components/blocks/blocks-wrapper.vue +91 -0
- package/vue2/src/components/blocks/blocks.vue +99 -0
- package/vue2/src/components/content/components/enable-editor.vue +418 -0
- package/vue2/src/components/content/components/styles.helpers.ts +77 -0
- package/vue2/src/components/content/components/styles.vue +60 -0
- package/vue2/src/components/content/content.helpers.ts +42 -0
- package/vue2/src/components/content/content.types.ts +23 -0
- package/vue2/src/components/content/content.vue +205 -0
- package/vue2/src/components/content/index.ts +1 -0
- package/vue2/src/components/content/wrap-component-ref.ts +6 -0
- package/vue2/src/components/content-variants/content-variants.types.ts +20 -0
- package/vue2/src/components/content-variants/content-variants.vue +177 -0
- package/vue2/src/components/content-variants/helpers.ts +207 -0
- package/vue2/src/components/inlined-script.vue +18 -0
- package/vue2/src/components/inlined-styles.vue +18 -0
- package/vue2/src/constants/builder-registered-components.ts +62 -0
- package/vue2/src/constants/device-sizes.ts +59 -0
- package/vue2/src/constants/sdk-version.ts +1 -0
- package/vue2/src/constants/target.ts +4 -0
- package/vue2/src/context/builder.context.ts +16 -0
- package/vue2/src/context/components.context.ts +6 -0
- package/vue2/src/context/types.ts +36 -0
- package/vue2/src/functions/apply-patch-with-mutation.ts +61 -0
- package/vue2/src/functions/camel-to-kebab-case.ts +1 -0
- package/vue2/src/functions/deopt.ts +6 -0
- package/vue2/src/functions/evaluate/browser-runtime/browser.ts +41 -0
- package/vue2/src/functions/evaluate/browser-runtime/index.ts +1 -0
- package/vue2/src/functions/evaluate/edge-runtime/acorn-interpreter.ts +2891 -0
- package/vue2/src/functions/evaluate/edge-runtime/edge-runtime.ts +96 -0
- package/vue2/src/functions/evaluate/edge-runtime/index.ts +1 -0
- package/vue2/src/functions/evaluate/evaluate.ts +66 -0
- package/vue2/src/functions/evaluate/helpers.ts +32 -0
- package/vue2/src/functions/evaluate/index.ts +1 -0
- package/vue2/src/functions/evaluate/node-runtime/index.ts +1 -0
- package/vue2/src/functions/evaluate/placeholder-runtime.ts +4 -0
- package/vue2/src/functions/event-handler-name.ts +1 -0
- package/vue2/src/functions/extract-text-styles.ts +24 -0
- package/vue2/src/functions/fast-clone.ts +4 -0
- package/vue2/src/functions/fetch-builder-props.ts +62 -0
- package/vue2/src/functions/get-block-actions-handler.ts +16 -0
- package/vue2/src/functions/get-block-actions.ts +36 -0
- package/vue2/src/functions/get-block-component-options.ts +11 -0
- package/vue2/src/functions/get-block-properties.ts +82 -0
- package/vue2/src/functions/get-builder-search-params/index.ts +40 -0
- package/vue2/src/functions/get-content/generate-content-url.ts +45 -0
- package/vue2/src/functions/get-content/index.ts +110 -0
- package/vue2/src/functions/get-content/types.ts +62 -0
- package/vue2/src/functions/get-fetch.ts +11 -0
- package/vue2/src/functions/get-global-this.ts +16 -0
- package/vue2/src/functions/get-processed-block.ts +69 -0
- package/vue2/src/functions/get-react-native-block-styles.ts +27 -0
- package/vue2/src/functions/is-browser.ts +3 -0
- package/vue2/src/functions/is-edge-runtime.ts +9 -0
- package/vue2/src/functions/is-editing.ts +5 -0
- package/vue2/src/functions/is-iframe.ts +4 -0
- package/vue2/src/functions/is-previewing.ts +11 -0
- package/vue2/src/functions/on-change.ts +29 -0
- package/vue2/src/functions/register-component.ts +48 -0
- package/vue2/src/functions/register.ts +44 -0
- package/vue2/src/functions/sanitize-react-native-block-styles.ts +58 -0
- package/vue2/src/functions/set-editor-settings.ts +15 -0
- package/vue2/src/functions/set.ts +14 -0
- package/vue2/src/functions/track/helpers.ts +51 -0
- package/vue2/src/functions/track/index.ts +131 -0
- package/vue2/src/functions/track/interaction.ts +63 -0
- package/vue2/src/functions/transform-block-properties.ts +18 -0
- package/vue2/src/functions/transform-block.ts +6 -0
- package/vue2/src/helpers/ab-tests.ts +166 -0
- package/vue2/src/helpers/canTrack.ts +2 -0
- package/vue2/src/helpers/cookie.ts +81 -0
- package/vue2/src/helpers/css.ts +33 -0
- package/vue2/src/helpers/flatten.ts +19 -0
- package/vue2/src/helpers/localStorage.ts +36 -0
- package/vue2/src/helpers/logger.ts +7 -0
- package/vue2/src/helpers/nullable.ts +2 -0
- package/vue2/src/helpers/preview-lru-cache/get.ts +4 -0
- package/vue2/src/helpers/preview-lru-cache/helpers.ts +0 -0
- package/vue2/src/helpers/preview-lru-cache/init.ts +7 -0
- package/vue2/src/helpers/preview-lru-cache/set.ts +12 -0
- package/vue2/src/helpers/preview-lru-cache/types.ts +0 -0
- package/vue2/src/helpers/sessionId.ts +37 -0
- package/vue2/src/helpers/time.ts +2 -0
- package/vue2/src/helpers/url.ts +15 -0
- package/vue2/src/helpers/uuid.ts +17 -0
- package/vue2/src/helpers/visitorId.ts +37 -0
- package/vue2/src/index-helpers/blocks-exports.ts +20 -0
- package/vue2/src/index-helpers/top-of-file.ts +4 -0
- package/vue2/src/index.ts +8 -0
- package/vue2/src/scripts/init-editing.ts +113 -0
- package/vue2/src/server-index.ts +15 -0
- package/vue2/tsconfig.config.json +8 -0
- package/vue2/tsconfig.json +16 -0
- package/vue2/vite.config.js +31 -0
- package/vue3/css/package.json +4 -0
- package/vue3/node_modules/@types/node/LICENSE +21 -0
- package/vue3/node_modules/@types/node/README.md +16 -0
- package/vue3/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/vue3/node_modules/@types/node/assert.d.ts +962 -0
- package/vue3/node_modules/@types/node/async_hooks.d.ts +497 -0
- package/vue3/node_modules/@types/node/buffer.d.ts +2236 -0
- package/vue3/node_modules/@types/node/child_process.d.ts +1396 -0
- package/vue3/node_modules/@types/node/cluster.d.ts +414 -0
- package/vue3/node_modules/@types/node/console.d.ts +412 -0
- package/vue3/node_modules/@types/node/constants.d.ts +18 -0
- package/vue3/node_modules/@types/node/crypto.d.ts +3869 -0
- package/vue3/node_modules/@types/node/dgram.d.ts +545 -0
- package/vue3/node_modules/@types/node/diagnostics_channel.d.ts +191 -0
- package/vue3/node_modules/@types/node/dns/promises.d.ts +369 -0
- package/vue3/node_modules/@types/node/dns.d.ts +655 -0
- package/vue3/node_modules/@types/node/domain.d.ts +170 -0
- package/vue3/node_modules/@types/node/events.d.ts +641 -0
- package/vue3/node_modules/@types/node/fs/promises.d.ts +1094 -0
- package/vue3/node_modules/@types/node/fs.d.ts +3803 -0
- package/vue3/node_modules/@types/node/globals.d.ts +287 -0
- package/vue3/node_modules/@types/node/globals.global.d.ts +1 -0
- package/vue3/node_modules/@types/node/http.d.ts +1504 -0
- package/vue3/node_modules/@types/node/http2.d.ts +2100 -0
- package/vue3/node_modules/@types/node/https.d.ts +532 -0
- package/vue3/node_modules/@types/node/index.d.ts +131 -0
- package/vue3/node_modules/@types/node/inspector.d.ts +2745 -0
- package/vue3/node_modules/@types/node/module.d.ts +115 -0
- package/vue3/node_modules/@types/node/net.d.ts +828 -0
- package/vue3/node_modules/@types/node/os.d.ts +455 -0
- package/vue3/node_modules/@types/node/package.json +232 -0
- package/vue3/node_modules/@types/node/path.d.ts +191 -0
- package/vue3/node_modules/@types/node/perf_hooks.d.ts +586 -0
- package/vue3/node_modules/@types/node/process.d.ts +1481 -0
- package/vue3/node_modules/@types/node/punycode.d.ts +117 -0
- package/vue3/node_modules/@types/node/querystring.d.ts +131 -0
- package/vue3/node_modules/@types/node/readline.d.ts +543 -0
- package/vue3/node_modules/@types/node/repl.d.ts +424 -0
- package/vue3/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/vue3/node_modules/@types/node/stream/promises.d.ts +42 -0
- package/vue3/node_modules/@types/node/stream/web.d.ts +392 -0
- package/vue3/node_modules/@types/node/stream.d.ts +1363 -0
- package/vue3/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/vue3/node_modules/@types/node/test.d.ts +190 -0
- package/vue3/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/vue3/node_modules/@types/node/timers.d.ts +94 -0
- package/vue3/node_modules/@types/node/tls.d.ts +1019 -0
- package/vue3/node_modules/@types/node/trace_events.d.ts +161 -0
- package/vue3/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/vue3/node_modules/@types/node/ts4.8/assert.d.ts +962 -0
- package/vue3/node_modules/@types/node/ts4.8/async_hooks.d.ts +497 -0
- package/vue3/node_modules/@types/node/ts4.8/buffer.d.ts +2236 -0
- package/vue3/node_modules/@types/node/ts4.8/child_process.d.ts +1396 -0
- package/vue3/node_modules/@types/node/ts4.8/cluster.d.ts +414 -0
- package/vue3/node_modules/@types/node/ts4.8/console.d.ts +412 -0
- package/vue3/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
- package/vue3/node_modules/@types/node/ts4.8/crypto.d.ts +3866 -0
- package/vue3/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
- package/vue3/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
- package/vue3/node_modules/@types/node/ts4.8/dns/promises.d.ts +368 -0
- package/vue3/node_modules/@types/node/ts4.8/dns.d.ts +654 -0
- package/vue3/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/vue3/node_modules/@types/node/ts4.8/events.d.ts +641 -0
- package/vue3/node_modules/@types/node/ts4.8/fs/promises.d.ts +1094 -0
- package/vue3/node_modules/@types/node/ts4.8/fs.d.ts +3802 -0
- package/vue3/node_modules/@types/node/ts4.8/globals.d.ts +284 -0
- package/vue3/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/vue3/node_modules/@types/node/ts4.8/http.d.ts +1503 -0
- package/vue3/node_modules/@types/node/ts4.8/http2.d.ts +2100 -0
- package/vue3/node_modules/@types/node/ts4.8/https.d.ts +532 -0
- package/vue3/node_modules/@types/node/ts4.8/index.d.ts +86 -0
- package/vue3/node_modules/@types/node/ts4.8/inspector.d.ts +2745 -0
- package/vue3/node_modules/@types/node/ts4.8/module.d.ts +115 -0
- package/vue3/node_modules/@types/node/ts4.8/net.d.ts +828 -0
- package/vue3/node_modules/@types/node/ts4.8/os.d.ts +456 -0
- package/vue3/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/vue3/node_modules/@types/node/ts4.8/perf_hooks.d.ts +586 -0
- package/vue3/node_modules/@types/node/ts4.8/process.d.ts +1481 -0
- package/vue3/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/vue3/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
- package/vue3/node_modules/@types/node/ts4.8/readline.d.ts +543 -0
- package/vue3/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
- package/vue3/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/vue3/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
- package/vue3/node_modules/@types/node/ts4.8/stream/web.d.ts +392 -0
- package/vue3/node_modules/@types/node/ts4.8/stream.d.ts +1363 -0
- package/vue3/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/vue3/node_modules/@types/node/ts4.8/test.d.ts +190 -0
- package/vue3/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/vue3/node_modules/@types/node/ts4.8/timers.d.ts +94 -0
- package/vue3/node_modules/@types/node/ts4.8/tls.d.ts +1019 -0
- package/vue3/node_modules/@types/node/ts4.8/trace_events.d.ts +161 -0
- package/vue3/node_modules/@types/node/ts4.8/tty.d.ts +204 -0
- package/vue3/node_modules/@types/node/ts4.8/url.d.ts +855 -0
- package/vue3/node_modules/@types/node/ts4.8/util.d.ts +1594 -0
- package/vue3/node_modules/@types/node/ts4.8/v8.d.ts +472 -0
- package/vue3/node_modules/@types/node/ts4.8/vm.d.ts +507 -0
- package/vue3/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
- package/vue3/node_modules/@types/node/ts4.8/worker_threads.d.ts +649 -0
- package/vue3/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/vue3/node_modules/@types/node/tty.d.ts +204 -0
- package/vue3/node_modules/@types/node/url.d.ts +855 -0
- package/vue3/node_modules/@types/node/util.d.ts +1594 -0
- package/vue3/node_modules/@types/node/v8.d.ts +472 -0
- package/vue3/node_modules/@types/node/vm.d.ts +507 -0
- package/vue3/node_modules/@types/node/wasi.d.ts +158 -0
- package/vue3/node_modules/@types/node/worker_threads.d.ts +649 -0
- package/vue3/node_modules/@types/node/zlib.d.ts +517 -0
- package/vue3/node_modules/@vitejs/plugin-vue/LICENSE +21 -0
- package/vue3/node_modules/@vitejs/plugin-vue/README.md +171 -0
- package/vue3/node_modules/@vitejs/plugin-vue/package.json +51 -0
- package/vue3/node_modules/@vue/server-renderer/LICENSE +21 -0
- package/vue3/node_modules/@vue/server-renderer/README.md +178 -0
- package/vue3/node_modules/@vue/server-renderer/index.js +7 -0
- package/vue3/node_modules/@vue/server-renderer/package.json +41 -0
- package/vue3/node_modules/@vue/tsconfig/README.md +31 -0
- package/vue3/node_modules/@vue/tsconfig/package.json +35 -0
- package/vue3/node_modules/@vue/tsconfig/tsconfig.json +40 -0
- package/vue3/node_modules/@vue/tsconfig/tsconfig.node.json +17 -0
- package/vue3/node_modules/@vue/tsconfig/tsconfig.web.json +19 -0
- package/vue3/node_modules/esbuild/LICENSE.md +21 -0
- package/vue3/node_modules/esbuild/README.md +3 -0
- package/vue3/node_modules/esbuild/bin/esbuild +212 -0
- package/vue3/node_modules/esbuild/install.js +245 -0
- package/vue3/node_modules/esbuild/package.json +42 -0
- package/vue3/node_modules/vite/LICENSE.md +3450 -0
- package/vue3/node_modules/vite/README.md +20 -0
- package/vue3/node_modules/vite/bin/openChrome.applescript +95 -0
- package/vue3/node_modules/vite/bin/vite.js +61 -0
- package/vue3/node_modules/vite/client.d.ts +248 -0
- package/vue3/node_modules/vite/index.cjs +34 -0
- package/vue3/node_modules/vite/package.json +154 -0
- package/vue3/node_modules/vite-plugin-dts/LICENSE +21 -0
- package/vue3/node_modules/vite-plugin-dts/README.md +368 -0
- package/vue3/node_modules/vite-plugin-dts/README.zh-CN.md +368 -0
- package/vue3/node_modules/vite-plugin-dts/node_modules/vue-tsc/LICENSE +21 -0
- package/vue3/node_modules/vite-plugin-dts/node_modules/vue-tsc/README.md +36 -0
- package/vue3/node_modules/vite-plugin-dts/node_modules/vue-tsc/bin/vue-tsc.js +67 -0
- package/vue3/node_modules/vite-plugin-dts/node_modules/vue-tsc/out/index.d.ts +16 -0
- package/vue3/node_modules/vite-plugin-dts/node_modules/vue-tsc/out/index.js +120 -0
- package/vue3/node_modules/vite-plugin-dts/node_modules/vue-tsc/out/shared.d.ts +8 -0
- package/vue3/node_modules/vite-plugin-dts/node_modules/vue-tsc/out/shared.js +5 -0
- package/vue3/node_modules/vite-plugin-dts/node_modules/vue-tsc/package.json +28 -0
- package/vue3/node_modules/vite-plugin-dts/package.json +103 -0
- package/vue3/node_modules/vue/LICENSE +21 -0
- package/vue3/node_modules/vue/README.md +54 -0
- package/vue3/node_modules/vue/compiler-sfc/index.d.mts +1 -0
- package/vue3/node_modules/vue/compiler-sfc/index.d.ts +1 -0
- package/vue3/node_modules/vue/compiler-sfc/index.js +3 -0
- package/vue3/node_modules/vue/compiler-sfc/index.mjs +3 -0
- package/vue3/node_modules/vue/compiler-sfc/package.json +4 -0
- package/vue3/node_modules/vue/compiler-sfc/register-ts.js +5 -0
- package/vue3/node_modules/vue/index.js +7 -0
- package/vue3/node_modules/vue/index.mjs +1 -0
- package/vue3/node_modules/vue/jsx-runtime/index.d.ts +29 -0
- package/vue3/node_modules/vue/jsx-runtime/index.js +15 -0
- package/vue3/node_modules/vue/jsx-runtime/index.mjs +17 -0
- package/vue3/node_modules/vue/jsx-runtime/package.json +5 -0
- package/vue3/node_modules/vue/jsx.d.ts +26 -0
- package/vue3/node_modules/vue/macros-global.d.ts +19 -0
- package/vue3/node_modules/vue/macros.d.ts +112 -0
- package/vue3/node_modules/vue/package.json +103 -0
- package/vue3/node_modules/vue/ref-macros.d.ts +2 -0
- package/vue3/node_modules/vue/server-renderer/index.d.mts +1 -0
- package/vue3/node_modules/vue/server-renderer/index.d.ts +1 -0
- package/vue3/node_modules/vue/server-renderer/index.js +1 -0
- package/vue3/node_modules/vue/server-renderer/index.mjs +1 -0
- package/vue3/node_modules/vue/server-renderer/package.json +4 -0
- package/vue3/node_modules/vue-tsc/LICENSE +21 -0
- package/vue3/node_modules/vue-tsc/README.md +44 -0
- package/vue3/node_modules/vue-tsc/bin/vue-tsc.js +48 -0
- package/vue3/node_modules/vue-tsc/out/proxy.d.ts +4 -0
- package/vue3/node_modules/vue-tsc/out/proxy.js +110 -0
- package/vue3/node_modules/vue-tsc/package.json +26 -0
- package/vue3/package.json +48 -0
- package/vue3/src/blocks/BaseText.vue +25 -0
- package/vue3/src/blocks/button/button.vue +71 -0
- package/vue3/src/blocks/button/component-info.ts +35 -0
- package/vue3/src/blocks/columns/columns.vue +220 -0
- package/vue3/src/blocks/columns/component-info.ts +219 -0
- package/vue3/src/blocks/custom-code/component-info.ts +24 -0
- package/vue3/src/blocks/custom-code/custom-code.vue +88 -0
- package/vue3/src/blocks/embed/component-info.ts +38 -0
- package/vue3/src/blocks/embed/embed.vue +71 -0
- package/vue3/src/blocks/embed/helpers.ts +2 -0
- package/vue3/src/blocks/form/component-info.ts +233 -0
- package/vue3/src/blocks/form/form.vue +7 -0
- package/vue3/src/blocks/fragment/component-info.ts +8 -0
- package/vue3/src/blocks/fragment/fragment.vue +19 -0
- package/vue3/src/blocks/helpers.ts +43 -0
- package/vue3/src/blocks/image/component-info.ts +124 -0
- package/vue3/src/blocks/image/image.helpers.ts +47 -0
- package/vue3/src/blocks/image/image.vue +172 -0
- package/vue3/src/blocks/img/component-info.ts +16 -0
- package/vue3/src/blocks/img/img.vue +59 -0
- package/vue3/src/blocks/input/component-info.ts +47 -0
- package/vue3/src/blocks/input/input.vue +52 -0
- package/vue3/src/blocks/raw-text/component-info.ts +11 -0
- package/vue3/src/blocks/raw-text/raw-text.vue +35 -0
- package/vue3/src/blocks/section/component-info.ts +41 -0
- package/vue3/src/blocks/section/section.vue +47 -0
- package/vue3/src/blocks/select/component-info.ts +44 -0
- package/vue3/src/blocks/select/select.vue +46 -0
- package/vue3/src/blocks/submit-button/component-info.ts +27 -0
- package/vue3/src/blocks/submit-button/submit-button.vue +34 -0
- package/vue3/src/blocks/symbol/component-info.ts +35 -0
- package/vue3/src/blocks/symbol/symbol.helpers.ts +47 -0
- package/vue3/src/blocks/symbol/symbol.vue +134 -0
- package/vue3/src/blocks/text/component-info.ts +20 -0
- package/vue3/src/blocks/text/text.vue +23 -0
- package/vue3/src/blocks/textarea/component-info.ts +38 -0
- package/vue3/src/blocks/textarea/textarea.vue +38 -0
- package/vue3/src/blocks/video/component-info.ts +83 -0
- package/vue3/src/blocks/video/video.vue +105 -0
- package/vue3/src/components/block/block.helpers.ts +89 -0
- package/vue3/src/components/block/block.vue +214 -0
- package/vue3/src/components/block/components/block-styles.vue +100 -0
- package/vue3/src/components/block/components/block-wrapper.vue +86 -0
- package/vue3/src/components/block/components/component-ref/component-ref.helpers.ts +52 -0
- package/vue3/src/components/block/components/component-ref/component-ref.vue +74 -0
- package/vue3/src/components/block/components/interactive-element.vue +48 -0
- package/vue3/src/components/block/components/repeated-block.vue +51 -0
- package/vue3/src/components/block/types.ts +6 -0
- package/vue3/src/components/blocks/blocks-wrapper.vue +91 -0
- package/vue3/src/components/blocks/blocks.vue +78 -0
- package/vue3/src/components/content/components/enable-editor.vue +419 -0
- package/vue3/src/components/content/components/styles.helpers.ts +77 -0
- package/vue3/src/components/content/components/styles.vue +51 -0
- package/vue3/src/components/content/content.helpers.ts +42 -0
- package/vue3/src/components/content/content.types.ts +23 -0
- package/vue3/src/components/content/content.vue +169 -0
- package/vue3/src/components/content/index.ts +1 -0
- package/vue3/src/components/content/wrap-component-ref.ts +7 -0
- package/vue3/src/components/content-variants/content-variants.types.ts +20 -0
- package/vue3/src/components/content-variants/content-variants.vue +151 -0
- package/vue3/src/components/content-variants/helpers.ts +207 -0
- package/vue3/src/components/inlined-script.vue +12 -0
- package/vue3/src/components/inlined-styles.vue +12 -0
- package/vue3/src/constants/builder-registered-components.ts +62 -0
- package/vue3/src/constants/device-sizes.ts +59 -0
- package/vue3/src/constants/sdk-version.ts +1 -0
- package/vue3/src/constants/target.ts +4 -0
- package/vue3/src/context/builder.context.ts +16 -0
- package/vue3/src/context/components.context.ts +6 -0
- package/vue3/src/context/types.ts +36 -0
- package/vue3/src/functions/apply-patch-with-mutation.ts +61 -0
- package/vue3/src/functions/camel-to-kebab-case.ts +1 -0
- package/vue3/src/functions/deopt.ts +6 -0
- package/vue3/src/functions/evaluate/browser-runtime/browser.ts +41 -0
- package/vue3/src/functions/evaluate/browser-runtime/index.ts +1 -0
- package/vue3/src/functions/evaluate/edge-runtime/acorn-interpreter.ts +2891 -0
- package/vue3/src/functions/evaluate/edge-runtime/edge-runtime.ts +96 -0
- package/vue3/src/functions/evaluate/edge-runtime/index.ts +1 -0
- package/vue3/src/functions/evaluate/evaluate.ts +66 -0
- package/vue3/src/functions/evaluate/helpers.ts +32 -0
- package/vue3/src/functions/evaluate/index.ts +1 -0
- package/vue3/src/functions/evaluate/node-runtime/index.ts +1 -0
- package/vue3/src/functions/evaluate/placeholder-runtime.ts +4 -0
- package/vue3/src/functions/event-handler-name.ts +1 -0
- package/vue3/src/functions/extract-text-styles.ts +24 -0
- package/vue3/src/functions/fast-clone.ts +4 -0
- package/vue3/src/functions/fetch-builder-props.ts +62 -0
- package/vue3/src/functions/get-block-actions-handler.ts +16 -0
- package/vue3/src/functions/get-block-actions.ts +36 -0
- package/vue3/src/functions/get-block-component-options.ts +11 -0
- package/vue3/src/functions/get-block-properties.ts +82 -0
- package/vue3/src/functions/get-builder-search-params/index.ts +40 -0
- package/vue3/src/functions/get-content/generate-content-url.ts +45 -0
- package/vue3/src/functions/get-content/index.ts +110 -0
- package/vue3/src/functions/get-content/types.ts +62 -0
- package/vue3/src/functions/get-fetch.ts +11 -0
- package/vue3/src/functions/get-global-this.ts +16 -0
- package/vue3/src/functions/get-processed-block.ts +69 -0
- package/vue3/src/functions/get-react-native-block-styles.ts +27 -0
- package/vue3/src/functions/is-browser.ts +3 -0
- package/vue3/src/functions/is-edge-runtime.ts +9 -0
- package/vue3/src/functions/is-editing.ts +5 -0
- package/vue3/src/functions/is-iframe.ts +4 -0
- package/vue3/src/functions/is-previewing.ts +11 -0
- package/vue3/src/functions/on-change.ts +29 -0
- package/vue3/src/functions/register-component.ts +48 -0
- package/vue3/src/functions/register.ts +44 -0
- package/vue3/src/functions/sanitize-react-native-block-styles.ts +58 -0
- package/vue3/src/functions/set-editor-settings.ts +15 -0
- package/vue3/src/functions/set.ts +14 -0
- package/vue3/src/functions/track/helpers.ts +51 -0
- package/vue3/src/functions/track/index.ts +131 -0
- package/vue3/src/functions/track/interaction.ts +63 -0
- package/vue3/src/functions/transform-block-properties.ts +18 -0
- package/vue3/src/functions/transform-block.ts +6 -0
- package/vue3/src/helpers/ab-tests.ts +166 -0
- package/vue3/src/helpers/canTrack.ts +2 -0
- package/vue3/src/helpers/cookie.ts +81 -0
- package/vue3/src/helpers/css.ts +33 -0
- package/vue3/src/helpers/flatten.ts +19 -0
- package/vue3/src/helpers/localStorage.ts +36 -0
- package/vue3/src/helpers/logger.ts +7 -0
- package/vue3/src/helpers/nullable.ts +2 -0
- package/vue3/src/helpers/preview-lru-cache/get.ts +4 -0
- package/vue3/src/helpers/preview-lru-cache/helpers.ts +0 -0
- package/vue3/src/helpers/preview-lru-cache/init.ts +7 -0
- package/vue3/src/helpers/preview-lru-cache/set.ts +12 -0
- package/vue3/src/helpers/preview-lru-cache/types.ts +0 -0
- package/vue3/src/helpers/sessionId.ts +37 -0
- package/vue3/src/helpers/time.ts +2 -0
- package/vue3/src/helpers/url.ts +15 -0
- package/vue3/src/helpers/uuid.ts +17 -0
- package/vue3/src/helpers/visitorId.ts +37 -0
- package/vue3/src/index-helpers/blocks-exports.ts +20 -0
- package/vue3/src/index-helpers/top-of-file.ts +4 -0
- package/vue3/src/index.ts +8 -0
- package/vue3/src/scripts/init-editing.ts +113 -0
- package/vue3/src/server-index.ts +15 -0
- package/vue3/tsconfig.config.json +8 -0
- package/vue3/tsconfig.json +17 -0
- package/vue3/vite.config.js +31 -0
- package/packages/_vue2/dist/block-styles.2f2d681c.js +0 -78
- package/packages/_vue2/dist/block-styles.e0c362f1.cjs +0 -1
- package/packages/_vue2/dist/block-wrapper.60491ece.cjs +0 -1
- package/packages/_vue2/dist/block-wrapper.675417b1.js +0 -66
- package/packages/_vue2/dist/block.2b1ac86c.cjs +0 -3
- package/packages/_vue2/dist/block.b10ffc8d.js +0 -179
- package/packages/_vue2/dist/blocks-wrapper.1f4e53ec.js +0 -72
- package/packages/_vue2/dist/blocks-wrapper.87c356a1.cjs +0 -1
- package/packages/_vue2/dist/component-ref.d1a3e1db.js +0 -98
- package/packages/_vue2/dist/component-ref.e0e18275.cjs +0 -1
- package/packages/_vue2/dist/content.4dd9bed9.js +0 -913
- package/packages/_vue2/dist/content.e0c272e6.cjs +0 -1
- package/packages/_vue2/dist/css.3b52add0.js +0 -21
- package/packages/_vue2/dist/css.5b6afc6e.cjs +0 -6
- package/packages/_vue2/dist/enable-editor.29678a79.cjs +0 -1
- package/packages/_vue2/dist/enable-editor.c8c377d7.js +0 -427
- package/packages/_vue2/dist/evaluate.585803ce.cjs +0 -1
- package/packages/_vue2/dist/evaluate.b622b309.js +0 -97
- package/packages/_vue2/dist/get-block-actions.17f0418a.js +0 -36
- package/packages/_vue2/dist/get-block-actions.cc26a1a3.cjs +0 -1
- package/packages/_vue2/dist/get-block-properties.3a4c9314.js +0 -48
- package/packages/_vue2/dist/get-block-properties.fbe48fae.cjs +0 -1
- package/packages/_vue2/dist/get-processed-block.5937bfa6.cjs +0 -1
- package/packages/_vue2/dist/get-processed-block.92e6395c.js +0 -53
- package/packages/_vue2/dist/index.04a22940.cjs +0 -32
- package/packages/_vue2/dist/index.835b8ee0.js +0 -1413
- package/packages/_vue2/dist/inlined-script.0c7f9ce3.cjs +0 -1
- package/packages/_vue2/dist/inlined-script.3ec95873.js +0 -23
- package/packages/_vue2/dist/inlined-styles.89ce41e1.cjs +0 -1
- package/packages/_vue2/dist/inlined-styles.ccff7c47.js +0 -23
- package/packages/_vue2/dist/interactive-element.fa779554.js +0 -42
- package/packages/_vue2/dist/interactive-element.fdd261bc.cjs +0 -1
- package/packages/_vue2/dist/non-node-runtime.ddfeed94.cjs +0 -21
- package/packages/_vue2/dist/non-node-runtime.eb7f6595.js +0 -2477
- package/packages/_vue2/dist/repeated-block.3c989659.js +0 -38
- package/packages/_vue2/dist/repeated-block.48fbaaab.cjs +0 -1
- package/packages/_vue2/dist/sdk.cjs +0 -1
- package/packages/_vue2/dist/sdk.d.ts +0 -1
- package/packages/_vue2/dist/sdk.js +0 -29
- package/packages/_vue2/dist/set.87eb0329.cjs +0 -1
- package/packages/_vue2/dist/set.b219ab0e.js +0 -9
- package/packages/_vue2/dist/src/blocks/button/button.vue.d.ts +0 -17
- package/packages/_vue2/dist/src/blocks/button/component-info.d.ts +0 -2
- package/packages/_vue2/dist/src/blocks/columns/columns.vue.d.ts +0 -44
- package/packages/_vue2/dist/src/blocks/columns/component-info.d.ts +0 -2
- package/packages/_vue2/dist/src/blocks/custom-code/component-info.d.ts +0 -2
- package/packages/_vue2/dist/src/blocks/custom-code/custom-code.vue.d.ts +0 -14
- package/packages/_vue2/dist/src/blocks/embed/component-info.d.ts +0 -2
- package/packages/_vue2/dist/src/blocks/embed/embed.vue.d.ts +0 -18
- package/packages/_vue2/dist/src/blocks/embed/helpers.d.ts +0 -1
- package/packages/_vue2/dist/src/blocks/fragment/component-info.d.ts +0 -2
- package/packages/_vue2/dist/src/blocks/fragment/fragment.vue.d.ts +0 -7
- package/packages/_vue2/dist/src/blocks/helpers.d.ts +0 -13
- package/packages/_vue2/dist/src/blocks/image/component-info.d.ts +0 -2
- package/packages/_vue2/dist/src/blocks/image/image.helpers.d.ts +0 -1
- package/packages/_vue2/dist/src/blocks/image/image.vue.d.ts +0 -72
- package/packages/_vue2/dist/src/blocks/img/component-info.d.ts +0 -2
- package/packages/_vue2/dist/src/blocks/img/img.vue.d.ts +0 -38
- package/packages/_vue2/dist/src/blocks/section/component-info.d.ts +0 -2
- package/packages/_vue2/dist/src/blocks/section/section.vue.d.ts +0 -22
- package/packages/_vue2/dist/src/blocks/symbol/component-info.d.ts +0 -2
- package/packages/_vue2/dist/src/blocks/symbol/symbol.helpers.d.ts +0 -14
- package/packages/_vue2/dist/src/blocks/symbol/symbol.vue.d.ts +0 -37
- package/packages/_vue2/dist/src/blocks/text/component-info.d.ts +0 -2
- package/packages/_vue2/dist/src/blocks/text/text.vue.d.ts +0 -11
- package/packages/_vue2/dist/src/blocks/video/component-info.d.ts +0 -2
- package/packages/_vue2/dist/src/blocks/video/video.vue.d.ts +0 -64
- package/packages/_vue2/dist/src/components/block/block.helpers.d.ts +0 -13
- package/packages/_vue2/dist/src/components/block/block.vue.d.ts +0 -9
- package/packages/_vue2/dist/src/components/block/components/block-styles.vue.d.ts +0 -23
- package/packages/_vue2/dist/src/components/block/components/block-wrapper.vue.d.ts +0 -29
- package/packages/_vue2/dist/src/components/block/components/component-ref/component-ref.helpers.d.ts +0 -30
- package/packages/_vue2/dist/src/components/block/components/component-ref/component-ref.vue.d.ts +0 -2
- package/packages/_vue2/dist/src/components/block/components/interactive-element.vue.d.ts +0 -30
- package/packages/_vue2/dist/src/components/block/components/repeated-block.vue.d.ts +0 -16
- package/packages/_vue2/dist/src/components/block/types.d.ts +0 -6
- package/packages/_vue2/dist/src/components/blocks/blocks-wrapper.vue.d.ts +0 -30
- package/packages/_vue2/dist/src/components/blocks/blocks.vue.d.ts +0 -29
- package/packages/_vue2/dist/src/components/content/components/enable-editor.vue.d.ts +0 -56
- package/packages/_vue2/dist/src/components/content/components/styles.helpers.d.ts +0 -15
- package/packages/_vue2/dist/src/components/content/components/styles.vue.d.ts +0 -16
- package/packages/_vue2/dist/src/components/content/content.helpers.d.ts +0 -7
- package/packages/_vue2/dist/src/components/content/content.types.d.ts +0 -24
- package/packages/_vue2/dist/src/components/content/content.vue.d.ts +0 -26
- package/packages/_vue2/dist/src/components/content/wrap-component-ref.d.ts +0 -6
- package/packages/_vue2/dist/src/components/content-variants/content-variants.types.d.ts +0 -20
- package/packages/_vue2/dist/src/components/content-variants/content-variants.vue.d.ts +0 -50
- package/packages/_vue2/dist/src/components/content-variants/helpers.d.ts +0 -18
- package/packages/_vue2/dist/src/components/inlined-script.vue.d.ts +0 -11
- package/packages/_vue2/dist/src/components/inlined-styles.vue.d.ts +0 -11
- package/packages/_vue2/dist/src/constants/builder-registered-components.d.ts +0 -6
- package/packages/_vue2/dist/src/constants/device-sizes.d.ts +0 -13
- package/packages/_vue2/dist/src/constants/sdk-version.d.ts +0 -1
- package/packages/_vue2/dist/src/constants/target.d.ts +0 -2
- package/packages/_vue2/dist/src/context/builder.context.d.ts +0 -15
- package/packages/_vue2/dist/src/context/components.context.d.ts +0 -7
- package/packages/_vue2/dist/src/context/types.d.ts +0 -35
- package/packages/_vue2/dist/src/functions/camel-to-kebab-case.d.ts +0 -1
- package/packages/_vue2/dist/src/functions/evaluate/browser-runtime/browser.d.ts +0 -4
- package/packages/_vue2/dist/src/functions/evaluate/evaluate.d.ts +0 -6
- package/packages/_vue2/dist/src/functions/evaluate/helpers.d.ts +0 -18
- package/packages/_vue2/dist/src/functions/evaluate/index.d.ts +0 -1
- package/packages/_vue2/dist/src/functions/evaluate/non-node-runtime/acorn-interpreter.d.ts +0 -2
- package/packages/_vue2/dist/src/functions/evaluate/non-node-runtime/index.d.ts +0 -6
- package/packages/_vue2/dist/src/functions/evaluate/non-node-runtime/non-node-runtime.d.ts +0 -2
- package/packages/_vue2/dist/src/functions/event-handler-name.d.ts +0 -1
- package/packages/_vue2/dist/src/functions/extract-text-styles.d.ts +0 -4
- package/packages/_vue2/dist/src/functions/fast-clone.d.ts +0 -4
- package/packages/_vue2/dist/src/functions/fetch-builder-props.d.ts +0 -39
- package/packages/_vue2/dist/src/functions/get-block-actions-handler.d.ts +0 -8
- package/packages/_vue2/dist/src/functions/get-block-actions.d.ts +0 -10
- package/packages/_vue2/dist/src/functions/get-block-component-options.d.ts +0 -2
- package/packages/_vue2/dist/src/functions/get-block-properties.d.ts +0 -6
- package/packages/_vue2/dist/src/functions/get-builder-search-params/index.d.ts +0 -12
- package/packages/_vue2/dist/src/functions/get-content/generate-content-url.d.ts +0 -2
- package/packages/_vue2/dist/src/functions/get-content/index.d.ts +0 -29
- package/packages/_vue2/dist/src/functions/get-content/types.d.ts +0 -51
- package/packages/_vue2/dist/src/functions/get-fetch.d.ts +0 -1
- package/packages/_vue2/dist/src/functions/get-processed-block.d.ts +0 -10
- package/packages/_vue2/dist/src/functions/get-react-native-block-styles.d.ts +0 -7
- package/packages/_vue2/dist/src/functions/is-browser.d.ts +0 -1
- package/packages/_vue2/dist/src/functions/is-editing.d.ts +0 -1
- package/packages/_vue2/dist/src/functions/is-iframe.d.ts +0 -1
- package/packages/_vue2/dist/src/functions/is-non-node-server.d.ts +0 -4
- package/packages/_vue2/dist/src/functions/is-previewing.d.ts +0 -1
- package/packages/_vue2/dist/src/functions/register-component.d.ts +0 -15
- package/packages/_vue2/dist/src/functions/register.d.ts +0 -16
- package/packages/_vue2/dist/src/functions/sanitize-react-native-block-styles.d.ts +0 -3
- package/packages/_vue2/dist/src/functions/set-editor-settings.d.ts +0 -4
- package/packages/_vue2/dist/src/functions/set.d.ts +0 -7
- package/packages/_vue2/dist/src/functions/track/helpers.d.ts +0 -5
- package/packages/_vue2/dist/src/functions/track/index.d.ts +0 -51
- package/packages/_vue2/dist/src/functions/track/interaction.d.ts +0 -13
- package/packages/_vue2/dist/src/functions/transform-block-properties.d.ts +0 -2
- package/packages/_vue2/dist/src/functions/transform-block.d.ts +0 -2
- package/packages/_vue2/dist/src/helpers/ab-tests.d.ts +0 -9
- package/packages/_vue2/dist/src/helpers/canTrack.d.ts +0 -1
- package/packages/_vue2/dist/src/helpers/cookie.d.ts +0 -19
- package/packages/_vue2/dist/src/helpers/css.d.ts +0 -7
- package/packages/_vue2/dist/src/helpers/flatten.d.ts +0 -6
- package/packages/_vue2/dist/src/helpers/localStorage.d.ts +0 -9
- package/packages/_vue2/dist/src/helpers/logger.d.ts +0 -6
- package/packages/_vue2/dist/src/helpers/nullable.d.ts +0 -2
- package/packages/_vue2/dist/src/helpers/preview-lru-cache/get.d.ts +0 -2
- package/packages/_vue2/dist/src/helpers/preview-lru-cache/set.d.ts +0 -7
- package/packages/_vue2/dist/src/helpers/sessionId.d.ts +0 -6
- package/packages/_vue2/dist/src/helpers/url.d.ts +0 -6
- package/packages/_vue2/dist/src/helpers/uuid.d.ts +0 -8
- package/packages/_vue2/dist/src/helpers/visitorId.d.ts +0 -6
- package/packages/_vue2/dist/src/index-helpers/blocks-exports.d.ts +0 -88
- package/packages/_vue2/dist/src/index-helpers/top-of-file.d.ts +0 -1
- package/packages/_vue2/dist/src/index.d.ts +0 -7
- package/packages/_vue2/dist/src/scripts/init-editing.d.ts +0 -6
- package/packages/_vue2/dist/src/server-index.d.ts +0 -15
- package/packages/_vue2/dist/src/types/api-version.d.ts +0 -2
- package/packages/_vue2/dist/src/types/builder-block.d.ts +0 -66
- package/packages/_vue2/dist/src/types/builder-content.d.ts +0 -44
- package/packages/_vue2/dist/src/types/builder-props.d.ts +0 -9
- package/packages/_vue2/dist/src/types/can-track.d.ts +0 -3
- package/packages/_vue2/dist/src/types/components.d.ts +0 -111
- package/packages/_vue2/dist/src/types/deep-partial.d.ts +0 -3
- package/packages/_vue2/dist/src/types/element.d.ts +0 -59
- package/packages/_vue2/dist/src/types/enforced-partials.d.ts +0 -21
- package/packages/_vue2/dist/src/types/input.d.ts +0 -121
- package/packages/_vue2/dist/src/types/targets.d.ts +0 -1
- package/packages/_vue2/dist/src/types/typescript.d.ts +0 -11
- package/packages/_vue2/dist/style.css +0 -1
- package/packages/_vue2/dist/styles.22b87564.js +0 -89
- package/packages/_vue2/dist/styles.a3209286.cjs +0 -31
- package/packages/_vue3/dist/block-wrapper.4abbfa5d.cjs +0 -1
- package/packages/_vue3/dist/block-wrapper.e6a959ca.js +0 -54
- package/packages/_vue3/dist/component-ref.16c18e90.cjs +0 -1
- package/packages/_vue3/dist/component-ref.b3232d22.js +0 -111
- package/packages/_vue3/dist/get-block-actions.48118020.js +0 -79
- package/packages/_vue3/dist/get-block-actions.83a66ea4.cjs +0 -1
- package/packages/_vue3/dist/index.ee80c2d7.js +0 -3262
- package/packages/_vue3/dist/index.f36face2.cjs +0 -69
- package/packages/_vue3/dist/non-node-runtime.15581a63.js +0 -2475
- package/packages/_vue3/dist/non-node-runtime.fb2b33d0.cjs +0 -21
- package/packages/_vue3/dist/repeated-block.33f567b4.cjs +0 -1
- package/packages/_vue3/dist/repeated-block.53ae8c41.js +0 -33
- package/packages/_vue3/dist/sdk.cjs +0 -1
- package/packages/_vue3/dist/sdk.d.ts +0 -1
- package/packages/_vue3/dist/sdk.js +0 -29
- package/packages/_vue3/dist/src/blocks/button/button.vue.d.ts +0 -30
- package/packages/_vue3/dist/src/blocks/button/component-info.d.ts +0 -2
- package/packages/_vue3/dist/src/blocks/columns/columns.vue.d.ts +0 -69
- package/packages/_vue3/dist/src/blocks/columns/component-info.d.ts +0 -2
- package/packages/_vue3/dist/src/blocks/custom-code/component-info.d.ts +0 -2
- package/packages/_vue3/dist/src/blocks/custom-code/custom-code.vue.d.ts +0 -21
- package/packages/_vue3/dist/src/blocks/embed/component-info.d.ts +0 -2
- package/packages/_vue3/dist/src/blocks/embed/embed.vue.d.ts +0 -22
- package/packages/_vue3/dist/src/blocks/embed/helpers.d.ts +0 -1
- package/packages/_vue3/dist/src/blocks/fragment/component-info.d.ts +0 -2
- package/packages/_vue3/dist/src/blocks/fragment/fragment.vue.d.ts +0 -7
- package/packages/_vue3/dist/src/blocks/helpers.d.ts +0 -13
- package/packages/_vue3/dist/src/blocks/image/component-info.d.ts +0 -2
- package/packages/_vue3/dist/src/blocks/image/image.helpers.d.ts +0 -1
- package/packages/_vue3/dist/src/blocks/image/image.vue.d.ts +0 -72
- package/packages/_vue3/dist/src/blocks/img/component-info.d.ts +0 -2
- package/packages/_vue3/dist/src/blocks/img/img.vue.d.ts +0 -38
- package/packages/_vue3/dist/src/blocks/section/component-info.d.ts +0 -2
- package/packages/_vue3/dist/src/blocks/section/section.vue.d.ts +0 -22
- package/packages/_vue3/dist/src/blocks/symbol/component-info.d.ts +0 -2
- package/packages/_vue3/dist/src/blocks/symbol/symbol.helpers.d.ts +0 -14
- package/packages/_vue3/dist/src/blocks/symbol/symbol.vue.d.ts +0 -56
- package/packages/_vue3/dist/src/blocks/text/component-info.d.ts +0 -2
- package/packages/_vue3/dist/src/blocks/text/text.vue.d.ts +0 -11
- package/packages/_vue3/dist/src/blocks/video/component-info.d.ts +0 -2
- package/packages/_vue3/dist/src/blocks/video/video.vue.d.ts +0 -64
- package/packages/_vue3/dist/src/components/block/block.helpers.d.ts +0 -13
- package/packages/_vue3/dist/src/components/block/block.vue.d.ts +0 -9
- package/packages/_vue3/dist/src/components/block/components/block-styles.vue.d.ts +0 -23
- package/packages/_vue3/dist/src/components/block/components/block-wrapper.vue.d.ts +0 -29
- package/packages/_vue3/dist/src/components/block/components/component-ref/component-ref.helpers.d.ts +0 -30
- package/packages/_vue3/dist/src/components/block/components/component-ref/component-ref.vue.d.ts +0 -2
- package/packages/_vue3/dist/src/components/block/components/interactive-element.vue.d.ts +0 -30
- package/packages/_vue3/dist/src/components/block/components/repeated-block.vue.d.ts +0 -16
- package/packages/_vue3/dist/src/components/block/types.d.ts +0 -6
- package/packages/_vue3/dist/src/components/blocks/blocks-wrapper.vue.d.ts +0 -30
- package/packages/_vue3/dist/src/components/blocks/blocks.vue.d.ts +0 -29
- package/packages/_vue3/dist/src/components/content/components/enable-editor.vue.d.ts +0 -90
- package/packages/_vue3/dist/src/components/content/components/styles.helpers.d.ts +0 -15
- package/packages/_vue3/dist/src/components/content/components/styles.vue.d.ts +0 -16
- package/packages/_vue3/dist/src/components/content/content.helpers.d.ts +0 -7
- package/packages/_vue3/dist/src/components/content/content.types.d.ts +0 -24
- package/packages/_vue3/dist/src/components/content/content.vue.d.ts +0 -69
- package/packages/_vue3/dist/src/components/content/wrap-component-ref.d.ts +0 -6
- package/packages/_vue3/dist/src/components/content-variants/content-variants.types.d.ts +0 -20
- package/packages/_vue3/dist/src/components/content-variants/content-variants.vue.d.ts +0 -73
- package/packages/_vue3/dist/src/components/content-variants/helpers.d.ts +0 -41
- package/packages/_vue3/dist/src/components/inlined-script.vue.d.ts +0 -11
- package/packages/_vue3/dist/src/components/inlined-styles.vue.d.ts +0 -11
- package/packages/_vue3/dist/src/constants/builder-registered-components.d.ts +0 -6
- package/packages/_vue3/dist/src/constants/device-sizes.d.ts +0 -13
- package/packages/_vue3/dist/src/constants/sdk-version.d.ts +0 -1
- package/packages/_vue3/dist/src/constants/target.d.ts +0 -2
- package/packages/_vue3/dist/src/context/builder.context.d.ts +0 -15
- package/packages/_vue3/dist/src/context/components.context.d.ts +0 -7
- package/packages/_vue3/dist/src/context/types.d.ts +0 -35
- package/packages/_vue3/dist/src/functions/camel-to-kebab-case.d.ts +0 -1
- package/packages/_vue3/dist/src/functions/evaluate/browser-runtime/browser.d.ts +0 -4
- package/packages/_vue3/dist/src/functions/evaluate/evaluate.d.ts +0 -6
- package/packages/_vue3/dist/src/functions/evaluate/helpers.d.ts +0 -18
- package/packages/_vue3/dist/src/functions/evaluate/index.d.ts +0 -1
- package/packages/_vue3/dist/src/functions/evaluate/non-node-runtime/acorn-interpreter.d.ts +0 -2
- package/packages/_vue3/dist/src/functions/evaluate/non-node-runtime/index.d.ts +0 -6
- package/packages/_vue3/dist/src/functions/evaluate/non-node-runtime/non-node-runtime.d.ts +0 -2
- package/packages/_vue3/dist/src/functions/event-handler-name.d.ts +0 -1
- package/packages/_vue3/dist/src/functions/extract-text-styles.d.ts +0 -4
- package/packages/_vue3/dist/src/functions/fast-clone.d.ts +0 -4
- package/packages/_vue3/dist/src/functions/fetch-builder-props.d.ts +0 -39
- package/packages/_vue3/dist/src/functions/get-block-actions-handler.d.ts +0 -8
- package/packages/_vue3/dist/src/functions/get-block-actions.d.ts +0 -10
- package/packages/_vue3/dist/src/functions/get-block-component-options.d.ts +0 -2
- package/packages/_vue3/dist/src/functions/get-block-properties.d.ts +0 -6
- package/packages/_vue3/dist/src/functions/get-builder-search-params/index.d.ts +0 -12
- package/packages/_vue3/dist/src/functions/get-content/generate-content-url.d.ts +0 -2
- package/packages/_vue3/dist/src/functions/get-content/index.d.ts +0 -29
- package/packages/_vue3/dist/src/functions/get-content/types.d.ts +0 -51
- package/packages/_vue3/dist/src/functions/get-fetch.d.ts +0 -1
- package/packages/_vue3/dist/src/functions/get-processed-block.d.ts +0 -10
- package/packages/_vue3/dist/src/functions/get-react-native-block-styles.d.ts +0 -7
- package/packages/_vue3/dist/src/functions/is-browser.d.ts +0 -1
- package/packages/_vue3/dist/src/functions/is-editing.d.ts +0 -1
- package/packages/_vue3/dist/src/functions/is-iframe.d.ts +0 -1
- package/packages/_vue3/dist/src/functions/is-non-node-server.d.ts +0 -4
- package/packages/_vue3/dist/src/functions/is-previewing.d.ts +0 -1
- package/packages/_vue3/dist/src/functions/register-component.d.ts +0 -15
- package/packages/_vue3/dist/src/functions/register.d.ts +0 -16
- package/packages/_vue3/dist/src/functions/sanitize-react-native-block-styles.d.ts +0 -3
- package/packages/_vue3/dist/src/functions/set-editor-settings.d.ts +0 -4
- package/packages/_vue3/dist/src/functions/set.d.ts +0 -7
- package/packages/_vue3/dist/src/functions/track/helpers.d.ts +0 -5
- package/packages/_vue3/dist/src/functions/track/index.d.ts +0 -51
- package/packages/_vue3/dist/src/functions/track/interaction.d.ts +0 -13
- package/packages/_vue3/dist/src/functions/transform-block-properties.d.ts +0 -2
- package/packages/_vue3/dist/src/functions/transform-block.d.ts +0 -2
- package/packages/_vue3/dist/src/helpers/ab-tests.d.ts +0 -9
- package/packages/_vue3/dist/src/helpers/canTrack.d.ts +0 -1
- package/packages/_vue3/dist/src/helpers/cookie.d.ts +0 -19
- package/packages/_vue3/dist/src/helpers/css.d.ts +0 -7
- package/packages/_vue3/dist/src/helpers/flatten.d.ts +0 -6
- package/packages/_vue3/dist/src/helpers/localStorage.d.ts +0 -9
- package/packages/_vue3/dist/src/helpers/logger.d.ts +0 -6
- package/packages/_vue3/dist/src/helpers/nullable.d.ts +0 -2
- package/packages/_vue3/dist/src/helpers/preview-lru-cache/get.d.ts +0 -2
- package/packages/_vue3/dist/src/helpers/preview-lru-cache/set.d.ts +0 -7
- package/packages/_vue3/dist/src/helpers/sessionId.d.ts +0 -6
- package/packages/_vue3/dist/src/helpers/url.d.ts +0 -6
- package/packages/_vue3/dist/src/helpers/uuid.d.ts +0 -8
- package/packages/_vue3/dist/src/helpers/visitorId.d.ts +0 -6
- package/packages/_vue3/dist/src/index-helpers/blocks-exports.d.ts +0 -111
- package/packages/_vue3/dist/src/index-helpers/top-of-file.d.ts +0 -1
- package/packages/_vue3/dist/src/index.d.ts +0 -7
- package/packages/_vue3/dist/src/scripts/init-editing.d.ts +0 -6
- package/packages/_vue3/dist/src/server-index.d.ts +0 -15
- package/packages/_vue3/dist/src/types/api-version.d.ts +0 -2
- package/packages/_vue3/dist/src/types/builder-block.d.ts +0 -66
- package/packages/_vue3/dist/src/types/builder-content.d.ts +0 -44
- package/packages/_vue3/dist/src/types/builder-props.d.ts +0 -9
- package/packages/_vue3/dist/src/types/can-track.d.ts +0 -3
- package/packages/_vue3/dist/src/types/components.d.ts +0 -111
- package/packages/_vue3/dist/src/types/deep-partial.d.ts +0 -3
- package/packages/_vue3/dist/src/types/element.d.ts +0 -59
- package/packages/_vue3/dist/src/types/enforced-partials.d.ts +0 -21
- package/packages/_vue3/dist/src/types/input.d.ts +0 -121
- package/packages/_vue3/dist/src/types/targets.d.ts +0 -1
- package/packages/_vue3/dist/src/types/typescript.d.ts +0 -11
- package/packages/_vue3/dist/style.css +0 -1
- /package/{packages/_vue2/dist → vue2}/env.d.ts +0 -0
- /package/{packages/_vue3/dist → vue3}/env.d.ts +0 -0
|
@@ -0,0 +1,1594 @@
|
|
|
1
|
+
import { BindingTypes } from '../src/types'
|
|
2
|
+
import { compile, assertCode } from './util'
|
|
3
|
+
|
|
4
|
+
describe('SFC compile <script setup>', () => {
|
|
5
|
+
test('should expose top level declarations', () => {
|
|
6
|
+
const { content, bindings } = compile(`
|
|
7
|
+
<script setup>
|
|
8
|
+
import { x } from './x'
|
|
9
|
+
let a = 1
|
|
10
|
+
const b = 2
|
|
11
|
+
function c() {}
|
|
12
|
+
class d {}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import { xx } from './x'
|
|
17
|
+
let aa = 1
|
|
18
|
+
const bb = 2
|
|
19
|
+
function cc() {}
|
|
20
|
+
class dd {}
|
|
21
|
+
</script>
|
|
22
|
+
`)
|
|
23
|
+
expect(content).toMatch('return { aa, bb, cc, dd, a, b, c, d, xx, x }')
|
|
24
|
+
expect(bindings).toStrictEqual({
|
|
25
|
+
x: BindingTypes.SETUP_MAYBE_REF,
|
|
26
|
+
a: BindingTypes.SETUP_LET,
|
|
27
|
+
b: BindingTypes.SETUP_CONST,
|
|
28
|
+
c: BindingTypes.SETUP_CONST,
|
|
29
|
+
d: BindingTypes.SETUP_CONST,
|
|
30
|
+
xx: BindingTypes.SETUP_MAYBE_REF,
|
|
31
|
+
aa: BindingTypes.SETUP_LET,
|
|
32
|
+
bb: BindingTypes.SETUP_CONST,
|
|
33
|
+
cc: BindingTypes.SETUP_CONST,
|
|
34
|
+
dd: BindingTypes.SETUP_CONST
|
|
35
|
+
})
|
|
36
|
+
assertCode(content)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('binding analysis for destructure', () => {
|
|
40
|
+
const { content, bindings } = compile(`
|
|
41
|
+
<script setup>
|
|
42
|
+
const { foo, b: bar, ['x' + 'y']: baz, x: { y, zz: { z }}} = {}
|
|
43
|
+
</script>
|
|
44
|
+
`)
|
|
45
|
+
expect(content).toMatch('return { foo, bar, baz, y, z }')
|
|
46
|
+
expect(bindings).toStrictEqual({
|
|
47
|
+
foo: BindingTypes.SETUP_MAYBE_REF,
|
|
48
|
+
bar: BindingTypes.SETUP_MAYBE_REF,
|
|
49
|
+
baz: BindingTypes.SETUP_MAYBE_REF,
|
|
50
|
+
y: BindingTypes.SETUP_MAYBE_REF,
|
|
51
|
+
z: BindingTypes.SETUP_MAYBE_REF
|
|
52
|
+
})
|
|
53
|
+
assertCode(content)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test('defineProps()', () => {
|
|
57
|
+
const { content, bindings } = compile(`
|
|
58
|
+
<script setup>
|
|
59
|
+
const props = defineProps({
|
|
60
|
+
foo: String
|
|
61
|
+
})
|
|
62
|
+
const bar = 1
|
|
63
|
+
</script>
|
|
64
|
+
`)
|
|
65
|
+
// should generate working code
|
|
66
|
+
assertCode(content)
|
|
67
|
+
// should analyze bindings
|
|
68
|
+
expect(bindings).toStrictEqual({
|
|
69
|
+
foo: BindingTypes.PROPS,
|
|
70
|
+
bar: BindingTypes.SETUP_CONST,
|
|
71
|
+
props: BindingTypes.SETUP_REACTIVE_CONST
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
// should remove defineOptions import and call
|
|
75
|
+
expect(content).not.toMatch('defineProps')
|
|
76
|
+
// should generate correct setup signature
|
|
77
|
+
expect(content).toMatch(`setup(__props) {`)
|
|
78
|
+
// should assign user identifier to it
|
|
79
|
+
expect(content).toMatch(`const props = __props`)
|
|
80
|
+
// should include context options in default export
|
|
81
|
+
expect(content).toMatch(`export default {
|
|
82
|
+
props: {
|
|
83
|
+
foo: String
|
|
84
|
+
},`)
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
test('defineProps w/ external definition', () => {
|
|
88
|
+
const { content } = compile(`
|
|
89
|
+
<script setup>
|
|
90
|
+
import { propsModel } from './props'
|
|
91
|
+
const props = defineProps(propsModel)
|
|
92
|
+
</script>
|
|
93
|
+
`)
|
|
94
|
+
assertCode(content)
|
|
95
|
+
expect(content).toMatch(`export default {
|
|
96
|
+
props: propsModel,`)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
// #4764
|
|
100
|
+
test('defineProps w/ leading code', () => {
|
|
101
|
+
const { content } = compile(`
|
|
102
|
+
<script setup>import { x } from './x'
|
|
103
|
+
const props = defineProps({})
|
|
104
|
+
</script>
|
|
105
|
+
`)
|
|
106
|
+
// props declaration should be inside setup, not moved along with the import
|
|
107
|
+
expect(content).not.toMatch(`const props = __props\nimport`)
|
|
108
|
+
assertCode(content)
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
test('defineEmits()', () => {
|
|
112
|
+
const { content, bindings } = compile(`
|
|
113
|
+
<script setup>
|
|
114
|
+
const myEmit = defineEmits(['foo', 'bar'])
|
|
115
|
+
</script>
|
|
116
|
+
`)
|
|
117
|
+
assertCode(content)
|
|
118
|
+
expect(bindings).toStrictEqual({
|
|
119
|
+
myEmit: BindingTypes.SETUP_CONST
|
|
120
|
+
})
|
|
121
|
+
// should remove defineOptions import and call
|
|
122
|
+
expect(content).not.toMatch('defineEmits')
|
|
123
|
+
// should generate correct setup signature
|
|
124
|
+
expect(content).toMatch(`setup(__props, { emit: myEmit }) {`)
|
|
125
|
+
// should include context options in default export
|
|
126
|
+
expect(content).toMatch(`export default {
|
|
127
|
+
emits: ['foo', 'bar'],`)
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
test('defineProps/defineEmits in multi-variable declaration', () => {
|
|
131
|
+
const { content } = compile(`
|
|
132
|
+
<script setup>
|
|
133
|
+
const props = defineProps(['item']),
|
|
134
|
+
a = 1,
|
|
135
|
+
emit = defineEmits(['a']);
|
|
136
|
+
</script>
|
|
137
|
+
`)
|
|
138
|
+
assertCode(content)
|
|
139
|
+
expect(content).toMatch(`const a = 1;`) // test correct removal
|
|
140
|
+
expect(content).toMatch(`props: ['item'],`)
|
|
141
|
+
expect(content).toMatch(`emits: ['a'],`)
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
test('defineProps/defineEmits in multi-variable declaration (full removal)', () => {
|
|
145
|
+
const { content } = compile(`
|
|
146
|
+
<script setup>
|
|
147
|
+
const props = defineProps(['item']),
|
|
148
|
+
emit = defineEmits(['a']);
|
|
149
|
+
</script>
|
|
150
|
+
`)
|
|
151
|
+
assertCode(content)
|
|
152
|
+
expect(content).toMatch(`props: ['item'],`)
|
|
153
|
+
expect(content).toMatch(`emits: ['a'],`)
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
test('defineExpose()', () => {
|
|
157
|
+
const { content } = compile(`
|
|
158
|
+
<script setup>
|
|
159
|
+
defineExpose({ foo: 123 })
|
|
160
|
+
</script>
|
|
161
|
+
`)
|
|
162
|
+
assertCode(content)
|
|
163
|
+
// should remove defineOptions import and call
|
|
164
|
+
expect(content).not.toMatch('defineExpose')
|
|
165
|
+
// should generate correct setup signature
|
|
166
|
+
expect(content).toMatch(`setup(__props, { expose }) {`)
|
|
167
|
+
// should replace callee
|
|
168
|
+
expect(content).toMatch(/\bexpose\(\{ foo: 123 \}\)/)
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
test('<script> after <script setup> the script content not end with `\\n`', () => {
|
|
172
|
+
const { content } = compile(`
|
|
173
|
+
<script setup>
|
|
174
|
+
import { x } from './x'
|
|
175
|
+
</script>
|
|
176
|
+
<script>const n = 1</script>
|
|
177
|
+
`)
|
|
178
|
+
assertCode(content)
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
describe('<script> and <script setup> co-usage', () => {
|
|
182
|
+
test('script first', () => {
|
|
183
|
+
const { content } = compile(`
|
|
184
|
+
<script>
|
|
185
|
+
export const n = 1
|
|
186
|
+
|
|
187
|
+
export default {}
|
|
188
|
+
</script>
|
|
189
|
+
<script setup>
|
|
190
|
+
import { x } from './x'
|
|
191
|
+
x()
|
|
192
|
+
</script>
|
|
193
|
+
`)
|
|
194
|
+
assertCode(content)
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
test('script setup first', () => {
|
|
198
|
+
const { content } = compile(`
|
|
199
|
+
<script setup>
|
|
200
|
+
import { x } from './x'
|
|
201
|
+
x()
|
|
202
|
+
</script>
|
|
203
|
+
<script>
|
|
204
|
+
export const n = 1
|
|
205
|
+
export default {}
|
|
206
|
+
</script>
|
|
207
|
+
`)
|
|
208
|
+
assertCode(content)
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
test('script setup first, named default export', () => {
|
|
212
|
+
const { content } = compile(`
|
|
213
|
+
<script setup>
|
|
214
|
+
import { x } from './x'
|
|
215
|
+
x()
|
|
216
|
+
</script>
|
|
217
|
+
<script>
|
|
218
|
+
export const n = 1
|
|
219
|
+
const def = {}
|
|
220
|
+
export { def as default }
|
|
221
|
+
</script>
|
|
222
|
+
`)
|
|
223
|
+
assertCode(content)
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
// #4395
|
|
227
|
+
test('script setup first, lang="ts", script block content export default', () => {
|
|
228
|
+
const { content } = compile(`
|
|
229
|
+
<script setup lang="ts">
|
|
230
|
+
import { x } from './x'
|
|
231
|
+
x()
|
|
232
|
+
</script>
|
|
233
|
+
<script lang="ts">
|
|
234
|
+
export default {
|
|
235
|
+
name: "test"
|
|
236
|
+
}
|
|
237
|
+
</script>
|
|
238
|
+
`)
|
|
239
|
+
// ensure __default__ is declared before used
|
|
240
|
+
expect(content).toMatch(/const __default__[\S\s]*\.\.\.__default__/m)
|
|
241
|
+
assertCode(content)
|
|
242
|
+
})
|
|
243
|
+
|
|
244
|
+
describe('spaces in ExportDefaultDeclaration node', () => {
|
|
245
|
+
// #4371
|
|
246
|
+
test('with many spaces and newline', () => {
|
|
247
|
+
// #4371
|
|
248
|
+
const { content } = compile(`
|
|
249
|
+
<script>
|
|
250
|
+
export const n = 1
|
|
251
|
+
export default
|
|
252
|
+
{
|
|
253
|
+
some:'option'
|
|
254
|
+
}
|
|
255
|
+
</script>
|
|
256
|
+
<script setup>
|
|
257
|
+
import { x } from './x'
|
|
258
|
+
x()
|
|
259
|
+
</script>
|
|
260
|
+
`)
|
|
261
|
+
assertCode(content)
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
test('with minimal spaces', () => {
|
|
265
|
+
const { content } = compile(`
|
|
266
|
+
<script>
|
|
267
|
+
export const n = 1
|
|
268
|
+
export default{
|
|
269
|
+
some:'option'
|
|
270
|
+
}
|
|
271
|
+
</script>
|
|
272
|
+
<script setup>
|
|
273
|
+
import { x } from './x'
|
|
274
|
+
x()
|
|
275
|
+
</script>
|
|
276
|
+
`)
|
|
277
|
+
assertCode(content)
|
|
278
|
+
})
|
|
279
|
+
})
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
describe('imports', () => {
|
|
283
|
+
test('should hoist and expose imports', () => {
|
|
284
|
+
assertCode(
|
|
285
|
+
compile(`<script setup>
|
|
286
|
+
import { ref } from 'vue'
|
|
287
|
+
import 'foo/css'
|
|
288
|
+
</script>`).content
|
|
289
|
+
)
|
|
290
|
+
})
|
|
291
|
+
|
|
292
|
+
test('should extract comment for import or type declarations', () => {
|
|
293
|
+
assertCode(
|
|
294
|
+
compile(`
|
|
295
|
+
<script setup>
|
|
296
|
+
import a from 'a' // comment
|
|
297
|
+
import b from 'b'
|
|
298
|
+
</script>
|
|
299
|
+
`).content
|
|
300
|
+
)
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
// #2740
|
|
304
|
+
test('should allow defineProps/Emit at the start of imports', () => {
|
|
305
|
+
assertCode(
|
|
306
|
+
compile(`<script setup>
|
|
307
|
+
import { ref } from 'vue'
|
|
308
|
+
defineProps(['foo'])
|
|
309
|
+
defineEmits(['bar'])
|
|
310
|
+
const r = ref(0)
|
|
311
|
+
</script>`).content
|
|
312
|
+
)
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
test('import dedupe between <script> and <script setup>', () => {
|
|
316
|
+
const { content } = compile(`
|
|
317
|
+
<script>
|
|
318
|
+
import { x } from './x'
|
|
319
|
+
</script>
|
|
320
|
+
<script setup>
|
|
321
|
+
import { x } from './x'
|
|
322
|
+
x()
|
|
323
|
+
</script>
|
|
324
|
+
`)
|
|
325
|
+
assertCode(content)
|
|
326
|
+
expect(content.indexOf(`import { x }`)).toEqual(
|
|
327
|
+
content.lastIndexOf(`import { x }`)
|
|
328
|
+
)
|
|
329
|
+
})
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
// in dev mode, declared bindings are returned as an object from setup()
|
|
333
|
+
// when using TS, users may import types which should not be returned as
|
|
334
|
+
// values, so we need to check import usage in the template to determine
|
|
335
|
+
// what to be returned.
|
|
336
|
+
describe('dev mode import usage check', () => {
|
|
337
|
+
test('components', () => {
|
|
338
|
+
const { content } = compile(`
|
|
339
|
+
<script setup lang="ts">
|
|
340
|
+
import { FooBar, FooBaz, FooQux, foo } from './x'
|
|
341
|
+
const fooBar: FooBar = 1
|
|
342
|
+
</script>
|
|
343
|
+
<template>
|
|
344
|
+
<FooBaz></FooBaz>
|
|
345
|
+
<foo-qux/>
|
|
346
|
+
<foo/>
|
|
347
|
+
FooBar
|
|
348
|
+
</template>
|
|
349
|
+
`)
|
|
350
|
+
// FooBar: should not be matched by plain text or incorrect case
|
|
351
|
+
// FooBaz: used as PascalCase component
|
|
352
|
+
// FooQux: used as kebab-case component
|
|
353
|
+
// foo: lowercase component
|
|
354
|
+
expect(content).toMatch(`return { fooBar, FooBaz, FooQux, foo }`)
|
|
355
|
+
assertCode(content)
|
|
356
|
+
})
|
|
357
|
+
|
|
358
|
+
test('directive', () => {
|
|
359
|
+
const { content } = compile(`
|
|
360
|
+
<script setup lang="ts">
|
|
361
|
+
import { vMyDir } from './x'
|
|
362
|
+
</script>
|
|
363
|
+
<template>
|
|
364
|
+
<div v-my-dir></div>
|
|
365
|
+
</template>
|
|
366
|
+
`)
|
|
367
|
+
expect(content).toMatch(`return { vMyDir }`)
|
|
368
|
+
assertCode(content)
|
|
369
|
+
})
|
|
370
|
+
|
|
371
|
+
// https://github.com/vuejs/core/issues/4599
|
|
372
|
+
test('attribute expressions', () => {
|
|
373
|
+
const { content } = compile(`
|
|
374
|
+
<script setup lang="ts">
|
|
375
|
+
import { bar, baz } from './x'
|
|
376
|
+
const cond = true
|
|
377
|
+
</script>
|
|
378
|
+
<template>
|
|
379
|
+
<div :class="[cond ? '' : bar(), 'default']" :style="baz"></div>
|
|
380
|
+
</template>
|
|
381
|
+
`)
|
|
382
|
+
expect(content).toMatch(`return { cond, bar, baz }`)
|
|
383
|
+
assertCode(content)
|
|
384
|
+
})
|
|
385
|
+
|
|
386
|
+
test('vue interpolations', () => {
|
|
387
|
+
const { content } = compile(`
|
|
388
|
+
<script setup lang="ts">
|
|
389
|
+
import { x, y, z, x$y } from './x'
|
|
390
|
+
</script>
|
|
391
|
+
<template>
|
|
392
|
+
<div :id="z + 'y'">{{ x }} {{ yy }} {{ x$y }}</div>
|
|
393
|
+
</template>
|
|
394
|
+
`)
|
|
395
|
+
// x: used in interpolation
|
|
396
|
+
// y: should not be matched by {{ yy }} or 'y' in binding exps
|
|
397
|
+
// x$y: #4274 should escape special chars when creating Regex
|
|
398
|
+
expect(content).toMatch(`return { x, z, x$y }`)
|
|
399
|
+
assertCode(content)
|
|
400
|
+
})
|
|
401
|
+
|
|
402
|
+
// #4340 interpolations in template strings
|
|
403
|
+
test('js template string interpolations', () => {
|
|
404
|
+
const { content } = compile(`
|
|
405
|
+
<script setup lang="ts">
|
|
406
|
+
import { VAR, VAR2, VAR3 } from './x'
|
|
407
|
+
</script>
|
|
408
|
+
<template>
|
|
409
|
+
{{ \`\${VAR}VAR2\${VAR3}\` }}
|
|
410
|
+
</template>
|
|
411
|
+
`)
|
|
412
|
+
// VAR2 should not be matched
|
|
413
|
+
expect(content).toMatch(`return { VAR, VAR3 }`)
|
|
414
|
+
assertCode(content)
|
|
415
|
+
})
|
|
416
|
+
|
|
417
|
+
// edge case: last tag in template
|
|
418
|
+
test('last tag', () => {
|
|
419
|
+
const { content } = compile(`
|
|
420
|
+
<script setup lang="ts">
|
|
421
|
+
import { FooBaz, Last } from './x'
|
|
422
|
+
</script>
|
|
423
|
+
<template>
|
|
424
|
+
<FooBaz></FooBaz>
|
|
425
|
+
<Last/>
|
|
426
|
+
</template>
|
|
427
|
+
`)
|
|
428
|
+
expect(content).toMatch(`return { FooBaz, Last }`)
|
|
429
|
+
assertCode(content)
|
|
430
|
+
})
|
|
431
|
+
|
|
432
|
+
test('TS annotations', () => {
|
|
433
|
+
const { content } = compile(`
|
|
434
|
+
<script setup lang="ts">
|
|
435
|
+
import { Foo, Baz, Qux, Fred } from './x'
|
|
436
|
+
const a = 1
|
|
437
|
+
function b() {}
|
|
438
|
+
</script>
|
|
439
|
+
<template>
|
|
440
|
+
{{ a as Foo }}
|
|
441
|
+
{{ Baz }}
|
|
442
|
+
<Comp v-slot="{ data }: Qux">{{ data }}</Comp>
|
|
443
|
+
<div v-for="{ z = x as Qux } in list as Fred"/>
|
|
444
|
+
</template>
|
|
445
|
+
`)
|
|
446
|
+
|
|
447
|
+
expect(content).toMatch(`return { a, b, Baz }`)
|
|
448
|
+
assertCode(content)
|
|
449
|
+
})
|
|
450
|
+
})
|
|
451
|
+
|
|
452
|
+
// describe('inlineTemplate mode', () => {
|
|
453
|
+
// test('should work', () => {
|
|
454
|
+
// const { content } = compile(
|
|
455
|
+
// `
|
|
456
|
+
// <script setup>
|
|
457
|
+
// import { ref } from 'vue'
|
|
458
|
+
// const count = ref(0)
|
|
459
|
+
// </script>
|
|
460
|
+
// <template>
|
|
461
|
+
// <div>{{ count }}</div>
|
|
462
|
+
// <div>static</div>
|
|
463
|
+
// </template>
|
|
464
|
+
// `,
|
|
465
|
+
// { inlineTemplate: true }
|
|
466
|
+
// )
|
|
467
|
+
// // check snapshot and make sure helper imports and
|
|
468
|
+
// // hoists are placed correctly.
|
|
469
|
+
// assertCode(content)
|
|
470
|
+
// // in inline mode, no need to call expose() since nothing is exposed
|
|
471
|
+
// // anyway!
|
|
472
|
+
// expect(content).not.toMatch(`expose()`)
|
|
473
|
+
// })
|
|
474
|
+
|
|
475
|
+
// test('with defineExpose()', () => {
|
|
476
|
+
// const { content } = compile(
|
|
477
|
+
// `
|
|
478
|
+
// <script setup>
|
|
479
|
+
// const count = ref(0)
|
|
480
|
+
// defineExpose({ count })
|
|
481
|
+
// </script>
|
|
482
|
+
// `,
|
|
483
|
+
// { inlineTemplate: true }
|
|
484
|
+
// )
|
|
485
|
+
// assertCode(content)
|
|
486
|
+
// expect(content).toMatch(`setup(__props, { expose })`)
|
|
487
|
+
// expect(content).toMatch(`expose({ count })`)
|
|
488
|
+
// })
|
|
489
|
+
|
|
490
|
+
// test('referencing scope components and directives', () => {
|
|
491
|
+
// const { content } = compile(
|
|
492
|
+
// `
|
|
493
|
+
// <script setup>
|
|
494
|
+
// import ChildComp from './Child.vue'
|
|
495
|
+
// import SomeOtherComp from './Other.vue'
|
|
496
|
+
// import vMyDir from './my-dir'
|
|
497
|
+
// </script>
|
|
498
|
+
// <template>
|
|
499
|
+
// <div v-my-dir></div>
|
|
500
|
+
// <ChildComp/>
|
|
501
|
+
// <some-other-comp/>
|
|
502
|
+
// </template>
|
|
503
|
+
// `,
|
|
504
|
+
// { inlineTemplate: true }
|
|
505
|
+
// )
|
|
506
|
+
// expect(content).toMatch('[_unref(vMyDir)]')
|
|
507
|
+
// expect(content).toMatch('_createVNode(ChildComp)')
|
|
508
|
+
// // kebab-case component support
|
|
509
|
+
// expect(content).toMatch('_createVNode(SomeOtherComp)')
|
|
510
|
+
// assertCode(content)
|
|
511
|
+
// })
|
|
512
|
+
|
|
513
|
+
// test('avoid unref() when necessary', () => {
|
|
514
|
+
// // function, const, component import
|
|
515
|
+
// const { content } = compile(
|
|
516
|
+
// `<script setup>
|
|
517
|
+
// import { ref } from 'vue'
|
|
518
|
+
// import Foo, { bar } from './Foo.vue'
|
|
519
|
+
// import other from './util'
|
|
520
|
+
// import * as tree from './tree'
|
|
521
|
+
// const count = ref(0)
|
|
522
|
+
// const constant = {}
|
|
523
|
+
// const maybe = foo()
|
|
524
|
+
// let lett = 1
|
|
525
|
+
// function fn() {}
|
|
526
|
+
// </script>
|
|
527
|
+
// <template>
|
|
528
|
+
// <Foo>{{ bar }}</Foo>
|
|
529
|
+
// <div @click="fn">{{ count }} {{ constant }} {{ maybe }} {{ lett }} {{ other }}</div>
|
|
530
|
+
// {{ tree.foo() }}
|
|
531
|
+
// </template>
|
|
532
|
+
// `,
|
|
533
|
+
// { inlineTemplate: true }
|
|
534
|
+
// )
|
|
535
|
+
// // no need to unref vue component import
|
|
536
|
+
// expect(content).toMatch(`createVNode(Foo,`)
|
|
537
|
+
// // #2699 should unref named imports from .vue
|
|
538
|
+
// expect(content).toMatch(`unref(bar)`)
|
|
539
|
+
// // should unref other imports
|
|
540
|
+
// expect(content).toMatch(`unref(other)`)
|
|
541
|
+
// // no need to unref constant literals
|
|
542
|
+
// expect(content).not.toMatch(`unref(constant)`)
|
|
543
|
+
// // should directly use .value for known refs
|
|
544
|
+
// expect(content).toMatch(`count.value`)
|
|
545
|
+
// // should unref() on const bindings that may be refs
|
|
546
|
+
// expect(content).toMatch(`unref(maybe)`)
|
|
547
|
+
// // should unref() on let bindings
|
|
548
|
+
// expect(content).toMatch(`unref(lett)`)
|
|
549
|
+
// // no need to unref namespace import (this also preserves tree-shaking)
|
|
550
|
+
// expect(content).toMatch(`tree.foo()`)
|
|
551
|
+
// // no need to unref function declarations
|
|
552
|
+
// expect(content).toMatch(`{ onClick: fn }`)
|
|
553
|
+
// // no need to mark constant fns in patch flag
|
|
554
|
+
// expect(content).not.toMatch(`PROPS`)
|
|
555
|
+
// assertCode(content)
|
|
556
|
+
// })
|
|
557
|
+
|
|
558
|
+
// test('v-model codegen', () => {
|
|
559
|
+
// const { content } = compile(
|
|
560
|
+
// `<script setup>
|
|
561
|
+
// import { ref } from 'vue'
|
|
562
|
+
// const count = ref(0)
|
|
563
|
+
// const maybe = foo()
|
|
564
|
+
// let lett = 1
|
|
565
|
+
// </script>
|
|
566
|
+
// <template>
|
|
567
|
+
// <input v-model="count">
|
|
568
|
+
// <input v-model="maybe">
|
|
569
|
+
// <input v-model="lett">
|
|
570
|
+
// </template>
|
|
571
|
+
// `,
|
|
572
|
+
// { inlineTemplate: true }
|
|
573
|
+
// )
|
|
574
|
+
// // known const ref: set value
|
|
575
|
+
// expect(content).toMatch(`(count).value = $event`)
|
|
576
|
+
// // const but maybe ref: assign if ref, otherwise do nothing
|
|
577
|
+
// expect(content).toMatch(`_isRef(maybe) ? (maybe).value = $event : null`)
|
|
578
|
+
// // let: handle both cases
|
|
579
|
+
// expect(content).toMatch(
|
|
580
|
+
// `_isRef(lett) ? (lett).value = $event : lett = $event`
|
|
581
|
+
// )
|
|
582
|
+
// assertCode(content)
|
|
583
|
+
// })
|
|
584
|
+
|
|
585
|
+
// test('template assignment expression codegen', () => {
|
|
586
|
+
// const { content } = compile(
|
|
587
|
+
// `<script setup>
|
|
588
|
+
// import { ref } from 'vue'
|
|
589
|
+
// const count = ref(0)
|
|
590
|
+
// const maybe = foo()
|
|
591
|
+
// let lett = 1
|
|
592
|
+
// let v = ref(1)
|
|
593
|
+
// </script>
|
|
594
|
+
// <template>
|
|
595
|
+
// <div @click="count = 1"/>
|
|
596
|
+
// <div @click="maybe = count"/>
|
|
597
|
+
// <div @click="lett = count"/>
|
|
598
|
+
// <div @click="v += 1"/>
|
|
599
|
+
// <div @click="v -= 1"/>
|
|
600
|
+
// <div @click="() => {
|
|
601
|
+
// let a = '' + lett
|
|
602
|
+
// v = a
|
|
603
|
+
// }"/>
|
|
604
|
+
// <div @click="() => {
|
|
605
|
+
// // nested scopes
|
|
606
|
+
// (()=>{
|
|
607
|
+
// let x = a
|
|
608
|
+
// (()=>{
|
|
609
|
+
// let z = x
|
|
610
|
+
// let z2 = z
|
|
611
|
+
// })
|
|
612
|
+
// let lz = z
|
|
613
|
+
// })
|
|
614
|
+
// v = a
|
|
615
|
+
// }"/>
|
|
616
|
+
// </template>
|
|
617
|
+
// `,
|
|
618
|
+
// { inlineTemplate: true }
|
|
619
|
+
// )
|
|
620
|
+
// // known const ref: set value
|
|
621
|
+
// expect(content).toMatch(`count.value = 1`)
|
|
622
|
+
// // const but maybe ref: only assign after check
|
|
623
|
+
// expect(content).toMatch(`maybe.value = count.value`)
|
|
624
|
+
// // let: handle both cases
|
|
625
|
+
// expect(content).toMatch(
|
|
626
|
+
// `_isRef(lett) ? lett.value = count.value : lett = count.value`
|
|
627
|
+
// )
|
|
628
|
+
// expect(content).toMatch(`_isRef(v) ? v.value += 1 : v += 1`)
|
|
629
|
+
// expect(content).toMatch(`_isRef(v) ? v.value -= 1 : v -= 1`)
|
|
630
|
+
// expect(content).toMatch(`_isRef(v) ? v.value = a : v = a`)
|
|
631
|
+
// expect(content).toMatch(`_isRef(v) ? v.value = _ctx.a : v = _ctx.a`)
|
|
632
|
+
// assertCode(content)
|
|
633
|
+
// })
|
|
634
|
+
|
|
635
|
+
// test('template update expression codegen', () => {
|
|
636
|
+
// const { content } = compile(
|
|
637
|
+
// `<script setup>
|
|
638
|
+
// import { ref } from 'vue'
|
|
639
|
+
// const count = ref(0)
|
|
640
|
+
// const maybe = foo()
|
|
641
|
+
// let lett = 1
|
|
642
|
+
// </script>
|
|
643
|
+
// <template>
|
|
644
|
+
// <div @click="count++"/>
|
|
645
|
+
// <div @click="--count"/>
|
|
646
|
+
// <div @click="maybe++"/>
|
|
647
|
+
// <div @click="--maybe"/>
|
|
648
|
+
// <div @click="lett++"/>
|
|
649
|
+
// <div @click="--lett"/>
|
|
650
|
+
// </template>
|
|
651
|
+
// `,
|
|
652
|
+
// { inlineTemplate: true }
|
|
653
|
+
// )
|
|
654
|
+
// // known const ref: set value
|
|
655
|
+
// expect(content).toMatch(`count.value++`)
|
|
656
|
+
// expect(content).toMatch(`--count.value`)
|
|
657
|
+
// // const but maybe ref (non-ref case ignored)
|
|
658
|
+
// expect(content).toMatch(`maybe.value++`)
|
|
659
|
+
// expect(content).toMatch(`--maybe.value`)
|
|
660
|
+
// // let: handle both cases
|
|
661
|
+
// expect(content).toMatch(`_isRef(lett) ? lett.value++ : lett++`)
|
|
662
|
+
// expect(content).toMatch(`_isRef(lett) ? --lett.value : --lett`)
|
|
663
|
+
// assertCode(content)
|
|
664
|
+
// })
|
|
665
|
+
|
|
666
|
+
// test('template destructure assignment codegen', () => {
|
|
667
|
+
// const { content } = compile(
|
|
668
|
+
// `<script setup>
|
|
669
|
+
// import { ref } from 'vue'
|
|
670
|
+
// const val = {}
|
|
671
|
+
// const count = ref(0)
|
|
672
|
+
// const maybe = foo()
|
|
673
|
+
// let lett = 1
|
|
674
|
+
// </script>
|
|
675
|
+
// <template>
|
|
676
|
+
// <div @click="({ count } = val)"/>
|
|
677
|
+
// <div @click="[maybe] = val"/>
|
|
678
|
+
// <div @click="({ lett } = val)"/>
|
|
679
|
+
// </template>
|
|
680
|
+
// `,
|
|
681
|
+
// { inlineTemplate: true }
|
|
682
|
+
// )
|
|
683
|
+
// // known const ref: set value
|
|
684
|
+
// expect(content).toMatch(`({ count: count.value } = val)`)
|
|
685
|
+
// // const but maybe ref (non-ref case ignored)
|
|
686
|
+
// expect(content).toMatch(`[maybe.value] = val`)
|
|
687
|
+
// // let: assumes non-ref
|
|
688
|
+
// expect(content).toMatch(`{ lett: lett } = val`)
|
|
689
|
+
// assertCode(content)
|
|
690
|
+
// })
|
|
691
|
+
|
|
692
|
+
// test('ssr codegen', () => {
|
|
693
|
+
// const { content } = compile(
|
|
694
|
+
// `
|
|
695
|
+
// <script setup>
|
|
696
|
+
// import { ref } from 'vue'
|
|
697
|
+
// const count = ref(0)
|
|
698
|
+
// </script>
|
|
699
|
+
// <template>
|
|
700
|
+
// <div>{{ count }}</div>
|
|
701
|
+
// <div>static</div>
|
|
702
|
+
// </template>
|
|
703
|
+
// <style>
|
|
704
|
+
// div { color: v-bind(count) }
|
|
705
|
+
// </style>
|
|
706
|
+
// `,
|
|
707
|
+
// {
|
|
708
|
+
// inlineTemplate: true,
|
|
709
|
+
// templateOptions: {
|
|
710
|
+
// ssr: true
|
|
711
|
+
// }
|
|
712
|
+
// }
|
|
713
|
+
// )
|
|
714
|
+
// expect(content).toMatch(`\n __ssrInlineRender: true,\n`)
|
|
715
|
+
// expect(content).toMatch(`return (_ctx, _push`)
|
|
716
|
+
// expect(content).toMatch(`ssrInterpolate`)
|
|
717
|
+
// expect(content).not.toMatch(`useCssVars`)
|
|
718
|
+
// expect(content).toMatch(`"--${mockId}-count": (count.value)`)
|
|
719
|
+
// assertCode(content)
|
|
720
|
+
// })
|
|
721
|
+
// })
|
|
722
|
+
|
|
723
|
+
describe('with TypeScript', () => {
|
|
724
|
+
test('hoist type declarations', () => {
|
|
725
|
+
const { content } = compile(`
|
|
726
|
+
<script setup lang="ts">
|
|
727
|
+
export interface Foo {}
|
|
728
|
+
type Bar = {}
|
|
729
|
+
</script>`)
|
|
730
|
+
assertCode(content)
|
|
731
|
+
})
|
|
732
|
+
|
|
733
|
+
test('defineProps/Emit w/ runtime options', () => {
|
|
734
|
+
const { content } = compile(`
|
|
735
|
+
<script setup lang="ts">
|
|
736
|
+
const props = defineProps({ foo: String })
|
|
737
|
+
const emit = defineEmits(['a', 'b'])
|
|
738
|
+
</script>
|
|
739
|
+
`)
|
|
740
|
+
assertCode(content)
|
|
741
|
+
expect(content).toMatch(`export default /*#__PURE__*/_defineComponent({
|
|
742
|
+
props: { foo: String },
|
|
743
|
+
emits: ['a', 'b'],
|
|
744
|
+
setup(__props, { emit }) {`)
|
|
745
|
+
})
|
|
746
|
+
|
|
747
|
+
test('defineProps w/ type', () => {
|
|
748
|
+
const { content, bindings } = compile(`
|
|
749
|
+
<script setup lang="ts">
|
|
750
|
+
interface Test {}
|
|
751
|
+
|
|
752
|
+
type Alias = number[]
|
|
753
|
+
|
|
754
|
+
defineProps<{
|
|
755
|
+
string: string
|
|
756
|
+
number: number
|
|
757
|
+
boolean: boolean
|
|
758
|
+
object: object
|
|
759
|
+
objectLiteral: { a: number }
|
|
760
|
+
fn: (n: number) => void
|
|
761
|
+
functionRef: Function
|
|
762
|
+
objectRef: Object
|
|
763
|
+
dateTime: Date
|
|
764
|
+
array: string[]
|
|
765
|
+
arrayRef: Array<any>
|
|
766
|
+
tuple: [number, number]
|
|
767
|
+
set: Set<string>
|
|
768
|
+
literal: 'foo'
|
|
769
|
+
optional?: any
|
|
770
|
+
recordRef: Record<string, null>
|
|
771
|
+
interface: Test
|
|
772
|
+
alias: Alias
|
|
773
|
+
method(): void
|
|
774
|
+
symbol: symbol
|
|
775
|
+
|
|
776
|
+
union: string | number
|
|
777
|
+
literalUnion: 'foo' | 'bar'
|
|
778
|
+
literalUnionNumber: 1 | 2 | 3 | 4 | 5
|
|
779
|
+
literalUnionMixed: 'foo' | 1 | boolean
|
|
780
|
+
intersection: Test & {}
|
|
781
|
+
foo: ((item: any) => boolean) | null
|
|
782
|
+
}>()
|
|
783
|
+
</script>`)
|
|
784
|
+
assertCode(content)
|
|
785
|
+
expect(content).toMatch(`string: { type: String, required: true }`)
|
|
786
|
+
expect(content).toMatch(`number: { type: Number, required: true }`)
|
|
787
|
+
expect(content).toMatch(`boolean: { type: Boolean, required: true }`)
|
|
788
|
+
expect(content).toMatch(`object: { type: Object, required: true }`)
|
|
789
|
+
expect(content).toMatch(`objectLiteral: { type: Object, required: true }`)
|
|
790
|
+
expect(content).toMatch(`fn: { type: Function, required: true }`)
|
|
791
|
+
expect(content).toMatch(`functionRef: { type: Function, required: true }`)
|
|
792
|
+
expect(content).toMatch(`objectRef: { type: Object, required: true }`)
|
|
793
|
+
expect(content).toMatch(`dateTime: { type: Date, required: true }`)
|
|
794
|
+
expect(content).toMatch(`array: { type: Array, required: true }`)
|
|
795
|
+
expect(content).toMatch(`arrayRef: { type: Array, required: true }`)
|
|
796
|
+
expect(content).toMatch(`tuple: { type: Array, required: true }`)
|
|
797
|
+
expect(content).toMatch(`set: { type: Set, required: true }`)
|
|
798
|
+
expect(content).toMatch(`literal: { type: String, required: true }`)
|
|
799
|
+
expect(content).toMatch(`optional: { type: null, required: false }`)
|
|
800
|
+
expect(content).toMatch(`recordRef: { type: Object, required: true }`)
|
|
801
|
+
expect(content).toMatch(`interface: { type: Object, required: true }`)
|
|
802
|
+
expect(content).toMatch(`alias: { type: Array, required: true }`)
|
|
803
|
+
expect(content).toMatch(`method: { type: Function, required: true }`)
|
|
804
|
+
expect(content).toMatch(`symbol: { type: Symbol, required: true }`)
|
|
805
|
+
expect(content).toMatch(
|
|
806
|
+
`union: { type: [String, Number], required: true }`
|
|
807
|
+
)
|
|
808
|
+
expect(content).toMatch(`literalUnion: { type: String, required: true }`)
|
|
809
|
+
expect(content).toMatch(
|
|
810
|
+
`literalUnionNumber: { type: Number, required: true }`
|
|
811
|
+
)
|
|
812
|
+
expect(content).toMatch(
|
|
813
|
+
`literalUnionMixed: { type: [String, Number, Boolean], required: true }`
|
|
814
|
+
)
|
|
815
|
+
expect(content).toMatch(`intersection: { type: Object, required: true }`)
|
|
816
|
+
expect(content).toMatch(`foo: { type: [Function, null], required: true }`)
|
|
817
|
+
expect(bindings).toStrictEqual({
|
|
818
|
+
string: BindingTypes.PROPS,
|
|
819
|
+
number: BindingTypes.PROPS,
|
|
820
|
+
boolean: BindingTypes.PROPS,
|
|
821
|
+
object: BindingTypes.PROPS,
|
|
822
|
+
objectLiteral: BindingTypes.PROPS,
|
|
823
|
+
fn: BindingTypes.PROPS,
|
|
824
|
+
functionRef: BindingTypes.PROPS,
|
|
825
|
+
objectRef: BindingTypes.PROPS,
|
|
826
|
+
dateTime: BindingTypes.PROPS,
|
|
827
|
+
array: BindingTypes.PROPS,
|
|
828
|
+
arrayRef: BindingTypes.PROPS,
|
|
829
|
+
tuple: BindingTypes.PROPS,
|
|
830
|
+
set: BindingTypes.PROPS,
|
|
831
|
+
literal: BindingTypes.PROPS,
|
|
832
|
+
optional: BindingTypes.PROPS,
|
|
833
|
+
recordRef: BindingTypes.PROPS,
|
|
834
|
+
interface: BindingTypes.PROPS,
|
|
835
|
+
alias: BindingTypes.PROPS,
|
|
836
|
+
method: BindingTypes.PROPS,
|
|
837
|
+
symbol: BindingTypes.PROPS,
|
|
838
|
+
union: BindingTypes.PROPS,
|
|
839
|
+
literalUnion: BindingTypes.PROPS,
|
|
840
|
+
literalUnionNumber: BindingTypes.PROPS,
|
|
841
|
+
literalUnionMixed: BindingTypes.PROPS,
|
|
842
|
+
intersection: BindingTypes.PROPS,
|
|
843
|
+
foo: BindingTypes.PROPS
|
|
844
|
+
})
|
|
845
|
+
})
|
|
846
|
+
|
|
847
|
+
test('defineProps w/ interface', () => {
|
|
848
|
+
const { content, bindings } = compile(`
|
|
849
|
+
<script setup lang="ts">
|
|
850
|
+
interface Props { x?: number }
|
|
851
|
+
defineProps<Props>()
|
|
852
|
+
</script>
|
|
853
|
+
`)
|
|
854
|
+
assertCode(content)
|
|
855
|
+
expect(content).toMatch(`x: { type: Number, required: false }`)
|
|
856
|
+
expect(bindings).toStrictEqual({
|
|
857
|
+
x: BindingTypes.PROPS
|
|
858
|
+
})
|
|
859
|
+
})
|
|
860
|
+
|
|
861
|
+
test('defineProps w/ exported interface', () => {
|
|
862
|
+
const { content, bindings } = compile(`
|
|
863
|
+
<script setup lang="ts">
|
|
864
|
+
export interface Props { x?: number }
|
|
865
|
+
defineProps<Props>()
|
|
866
|
+
</script>
|
|
867
|
+
`)
|
|
868
|
+
assertCode(content)
|
|
869
|
+
expect(content).toMatch(`x: { type: Number, required: false }`)
|
|
870
|
+
expect(bindings).toStrictEqual({
|
|
871
|
+
x: BindingTypes.PROPS
|
|
872
|
+
})
|
|
873
|
+
})
|
|
874
|
+
|
|
875
|
+
test('defineProps w/ exported interface in normal script', () => {
|
|
876
|
+
const { content, bindings } = compile(`
|
|
877
|
+
<script lang="ts">
|
|
878
|
+
export interface Props { x?: number }
|
|
879
|
+
</script>
|
|
880
|
+
<script setup lang="ts">
|
|
881
|
+
defineProps<Props>()
|
|
882
|
+
</script>
|
|
883
|
+
`)
|
|
884
|
+
assertCode(content)
|
|
885
|
+
expect(content).toMatch(`x: { type: Number, required: false }`)
|
|
886
|
+
expect(bindings).toStrictEqual({
|
|
887
|
+
x: BindingTypes.PROPS
|
|
888
|
+
})
|
|
889
|
+
})
|
|
890
|
+
|
|
891
|
+
test('defineProps w/ type alias', () => {
|
|
892
|
+
const { content, bindings } = compile(`
|
|
893
|
+
<script setup lang="ts">
|
|
894
|
+
type Props = { x?: number }
|
|
895
|
+
defineProps<Props>()
|
|
896
|
+
</script>
|
|
897
|
+
`)
|
|
898
|
+
assertCode(content)
|
|
899
|
+
expect(content).toMatch(`x: { type: Number, required: false }`)
|
|
900
|
+
expect(bindings).toStrictEqual({
|
|
901
|
+
x: BindingTypes.PROPS
|
|
902
|
+
})
|
|
903
|
+
})
|
|
904
|
+
|
|
905
|
+
test('defineProps w/ exported type alias', () => {
|
|
906
|
+
const { content, bindings } = compile(`
|
|
907
|
+
<script setup lang="ts">
|
|
908
|
+
export type Props = { x?: number }
|
|
909
|
+
defineProps<Props>()
|
|
910
|
+
</script>
|
|
911
|
+
`)
|
|
912
|
+
assertCode(content)
|
|
913
|
+
expect(content).toMatch(`x: { type: Number, required: false }`)
|
|
914
|
+
expect(bindings).toStrictEqual({
|
|
915
|
+
x: BindingTypes.PROPS
|
|
916
|
+
})
|
|
917
|
+
})
|
|
918
|
+
|
|
919
|
+
test('withDefaults (static)', () => {
|
|
920
|
+
const { content, bindings } = compile(`
|
|
921
|
+
<script setup lang="ts">
|
|
922
|
+
const props = withDefaults(defineProps<{
|
|
923
|
+
foo?: string
|
|
924
|
+
bar?: number;
|
|
925
|
+
baz: boolean;
|
|
926
|
+
qux?(): number
|
|
927
|
+
}>(), {
|
|
928
|
+
foo: 'hi',
|
|
929
|
+
qux() { return 1 }
|
|
930
|
+
})
|
|
931
|
+
</script>
|
|
932
|
+
`)
|
|
933
|
+
assertCode(content)
|
|
934
|
+
expect(content).toMatch(
|
|
935
|
+
`foo: { type: String, required: false, default: 'hi' }`
|
|
936
|
+
)
|
|
937
|
+
expect(content).toMatch(`bar: { type: Number, required: false }`)
|
|
938
|
+
expect(content).toMatch(`baz: { type: Boolean, required: true }`)
|
|
939
|
+
expect(content).toMatch(
|
|
940
|
+
`qux: { type: Function, required: false, default() { return 1 } }`
|
|
941
|
+
)
|
|
942
|
+
expect(content).toMatch(
|
|
943
|
+
`{ foo: string, bar?: number, baz: boolean, qux(): number }`
|
|
944
|
+
)
|
|
945
|
+
expect(content).toMatch(`const props = __props`)
|
|
946
|
+
expect(bindings).toStrictEqual({
|
|
947
|
+
foo: BindingTypes.PROPS,
|
|
948
|
+
bar: BindingTypes.PROPS,
|
|
949
|
+
baz: BindingTypes.PROPS,
|
|
950
|
+
qux: BindingTypes.PROPS,
|
|
951
|
+
props: BindingTypes.SETUP_CONST
|
|
952
|
+
})
|
|
953
|
+
})
|
|
954
|
+
|
|
955
|
+
test('withDefaults (dynamic)', () => {
|
|
956
|
+
const { content } = compile(`
|
|
957
|
+
<script setup lang="ts">
|
|
958
|
+
import { defaults } from './foo'
|
|
959
|
+
const props = withDefaults(defineProps<{
|
|
960
|
+
foo?: string
|
|
961
|
+
bar?: number
|
|
962
|
+
baz: boolean
|
|
963
|
+
}>(), { ...defaults })
|
|
964
|
+
</script>
|
|
965
|
+
`)
|
|
966
|
+
assertCode(content)
|
|
967
|
+
expect(content).toMatch(`import { mergeDefaults as _mergeDefaults`)
|
|
968
|
+
expect(content).toMatch(
|
|
969
|
+
`
|
|
970
|
+
_mergeDefaults({
|
|
971
|
+
foo: { type: String, required: false },
|
|
972
|
+
bar: { type: Number, required: false },
|
|
973
|
+
baz: { type: Boolean, required: true }
|
|
974
|
+
}, { ...defaults })`.trim()
|
|
975
|
+
)
|
|
976
|
+
})
|
|
977
|
+
|
|
978
|
+
test('defineEmits w/ type', () => {
|
|
979
|
+
const { content } = compile(`
|
|
980
|
+
<script setup lang="ts">
|
|
981
|
+
const emit = defineEmits<(e: 'foo' | 'bar') => void>()
|
|
982
|
+
</script>
|
|
983
|
+
`)
|
|
984
|
+
assertCode(content)
|
|
985
|
+
expect(content).toMatch(`emit: ((e: 'foo' | 'bar') => void),`)
|
|
986
|
+
expect(content).toMatch(`emits: ["foo", "bar"]`)
|
|
987
|
+
})
|
|
988
|
+
|
|
989
|
+
test('defineEmits w/ type (union)', () => {
|
|
990
|
+
const type = `((e: 'foo' | 'bar') => void) | ((e: 'baz', id: number) => void)`
|
|
991
|
+
expect(() =>
|
|
992
|
+
compile(`
|
|
993
|
+
<script setup lang="ts">
|
|
994
|
+
const emit = defineEmits<${type}>()
|
|
995
|
+
</script>
|
|
996
|
+
`)
|
|
997
|
+
).toThrow()
|
|
998
|
+
})
|
|
999
|
+
|
|
1000
|
+
test('defineEmits w/ type (type literal w/ call signatures)', () => {
|
|
1001
|
+
const type = `{(e: 'foo' | 'bar'): void; (e: 'baz', id: number): void;}`
|
|
1002
|
+
const { content } = compile(`
|
|
1003
|
+
<script setup lang="ts">
|
|
1004
|
+
const emit = defineEmits<${type}>()
|
|
1005
|
+
</script>
|
|
1006
|
+
`)
|
|
1007
|
+
assertCode(content)
|
|
1008
|
+
expect(content).toMatch(`emit: (${type}),`)
|
|
1009
|
+
expect(content).toMatch(`emits: ["foo", "bar", "baz"]`)
|
|
1010
|
+
})
|
|
1011
|
+
|
|
1012
|
+
test('defineEmits w/ type (interface)', () => {
|
|
1013
|
+
const { content } = compile(`
|
|
1014
|
+
<script setup lang="ts">
|
|
1015
|
+
interface Emits { (e: 'foo' | 'bar'): void }
|
|
1016
|
+
const emit = defineEmits<Emits>()
|
|
1017
|
+
</script>
|
|
1018
|
+
`)
|
|
1019
|
+
assertCode(content)
|
|
1020
|
+
expect(content).toMatch(`emit: ({ (e: 'foo' | 'bar'): void }),`)
|
|
1021
|
+
expect(content).toMatch(`emits: ["foo", "bar"]`)
|
|
1022
|
+
})
|
|
1023
|
+
|
|
1024
|
+
test('defineEmits w/ type (exported interface)', () => {
|
|
1025
|
+
const { content } = compile(`
|
|
1026
|
+
<script setup lang="ts">
|
|
1027
|
+
export interface Emits { (e: 'foo' | 'bar'): void }
|
|
1028
|
+
const emit = defineEmits<Emits>()
|
|
1029
|
+
</script>
|
|
1030
|
+
`)
|
|
1031
|
+
assertCode(content)
|
|
1032
|
+
expect(content).toMatch(`emit: ({ (e: 'foo' | 'bar'): void }),`)
|
|
1033
|
+
expect(content).toMatch(`emits: ["foo", "bar"]`)
|
|
1034
|
+
})
|
|
1035
|
+
|
|
1036
|
+
test('defineEmits w/ type (type alias)', () => {
|
|
1037
|
+
const { content } = compile(`
|
|
1038
|
+
<script setup lang="ts">
|
|
1039
|
+
type Emits = { (e: 'foo' | 'bar'): void }
|
|
1040
|
+
const emit = defineEmits<Emits>()
|
|
1041
|
+
</script>
|
|
1042
|
+
`)
|
|
1043
|
+
assertCode(content)
|
|
1044
|
+
expect(content).toMatch(`emit: ({ (e: 'foo' | 'bar'): void }),`)
|
|
1045
|
+
expect(content).toMatch(`emits: ["foo", "bar"]`)
|
|
1046
|
+
})
|
|
1047
|
+
|
|
1048
|
+
test('defineEmits w/ type (exported type alias)', () => {
|
|
1049
|
+
const { content } = compile(`
|
|
1050
|
+
<script setup lang="ts">
|
|
1051
|
+
export type Emits = { (e: 'foo' | 'bar'): void }
|
|
1052
|
+
const emit = defineEmits<Emits>()
|
|
1053
|
+
</script>
|
|
1054
|
+
`)
|
|
1055
|
+
assertCode(content)
|
|
1056
|
+
expect(content).toMatch(`emit: ({ (e: 'foo' | 'bar'): void }),`)
|
|
1057
|
+
expect(content).toMatch(`emits: ["foo", "bar"]`)
|
|
1058
|
+
})
|
|
1059
|
+
|
|
1060
|
+
test('defineEmits w/ type (referenced function type)', () => {
|
|
1061
|
+
const { content } = compile(`
|
|
1062
|
+
<script setup lang="ts">
|
|
1063
|
+
type Emits = (e: 'foo' | 'bar') => void
|
|
1064
|
+
const emit = defineEmits<Emits>()
|
|
1065
|
+
</script>
|
|
1066
|
+
`)
|
|
1067
|
+
assertCode(content)
|
|
1068
|
+
expect(content).toMatch(`emit: ((e: 'foo' | 'bar') => void),`)
|
|
1069
|
+
expect(content).toMatch(`emits: ["foo", "bar"]`)
|
|
1070
|
+
})
|
|
1071
|
+
|
|
1072
|
+
test('defineEmits w/ type (referenced exported function type)', () => {
|
|
1073
|
+
const { content } = compile(`
|
|
1074
|
+
<script setup lang="ts">
|
|
1075
|
+
export type Emits = (e: 'foo' | 'bar') => void
|
|
1076
|
+
const emit = defineEmits<Emits>()
|
|
1077
|
+
</script>
|
|
1078
|
+
`)
|
|
1079
|
+
assertCode(content)
|
|
1080
|
+
expect(content).toMatch(`emit: ((e: 'foo' | 'bar') => void),`)
|
|
1081
|
+
expect(content).toMatch(`emits: ["foo", "bar"]`)
|
|
1082
|
+
})
|
|
1083
|
+
|
|
1084
|
+
test('runtime Enum', () => {
|
|
1085
|
+
const { content, bindings } = compile(
|
|
1086
|
+
`<script setup lang="ts">
|
|
1087
|
+
enum Foo { A = 123 }
|
|
1088
|
+
</script>`
|
|
1089
|
+
)
|
|
1090
|
+
assertCode(content)
|
|
1091
|
+
expect(bindings).toStrictEqual({
|
|
1092
|
+
Foo: BindingTypes.SETUP_CONST
|
|
1093
|
+
})
|
|
1094
|
+
})
|
|
1095
|
+
|
|
1096
|
+
test('runtime Enum in normal script', () => {
|
|
1097
|
+
const { content, bindings } = compile(
|
|
1098
|
+
`<script lang="ts">
|
|
1099
|
+
export enum D { D = "D" }
|
|
1100
|
+
const enum C { C = "C" }
|
|
1101
|
+
enum B { B = "B" }
|
|
1102
|
+
</script>
|
|
1103
|
+
<script setup lang="ts">
|
|
1104
|
+
enum Foo { A = 123 }
|
|
1105
|
+
</script>`
|
|
1106
|
+
)
|
|
1107
|
+
assertCode(content)
|
|
1108
|
+
expect(bindings).toStrictEqual({
|
|
1109
|
+
D: BindingTypes.SETUP_CONST,
|
|
1110
|
+
C: BindingTypes.SETUP_CONST,
|
|
1111
|
+
B: BindingTypes.SETUP_CONST,
|
|
1112
|
+
Foo: BindingTypes.SETUP_CONST
|
|
1113
|
+
})
|
|
1114
|
+
})
|
|
1115
|
+
|
|
1116
|
+
test('const Enum', () => {
|
|
1117
|
+
const { content, bindings } = compile(
|
|
1118
|
+
`<script setup lang="ts">
|
|
1119
|
+
const enum Foo { A = 123 }
|
|
1120
|
+
</script>`
|
|
1121
|
+
)
|
|
1122
|
+
assertCode(content)
|
|
1123
|
+
expect(bindings).toStrictEqual({
|
|
1124
|
+
Foo: BindingTypes.SETUP_CONST
|
|
1125
|
+
})
|
|
1126
|
+
})
|
|
1127
|
+
|
|
1128
|
+
test('import type', () => {
|
|
1129
|
+
const { content } = compile(
|
|
1130
|
+
`<script setup lang="ts">
|
|
1131
|
+
import type { Foo } from './main.ts'
|
|
1132
|
+
import { type Bar, Baz } from './main.ts'
|
|
1133
|
+
</script>`
|
|
1134
|
+
)
|
|
1135
|
+
expect(content).toMatch(`return { Baz }`)
|
|
1136
|
+
assertCode(content)
|
|
1137
|
+
})
|
|
1138
|
+
})
|
|
1139
|
+
|
|
1140
|
+
describe('errors', () => {
|
|
1141
|
+
test('<script> and <script setup> must have same lang', () => {
|
|
1142
|
+
expect(() =>
|
|
1143
|
+
compile(`<script>foo()</script><script setup lang="ts">bar()</script>`)
|
|
1144
|
+
).toThrow(`<script> and <script setup> must have the same language type`)
|
|
1145
|
+
})
|
|
1146
|
+
|
|
1147
|
+
const moduleErrorMsg = `cannot contain ES module exports`
|
|
1148
|
+
|
|
1149
|
+
test('non-type named exports', () => {
|
|
1150
|
+
expect(() =>
|
|
1151
|
+
compile(`<script setup>
|
|
1152
|
+
export const a = 1
|
|
1153
|
+
</script>`)
|
|
1154
|
+
).toThrow(moduleErrorMsg)
|
|
1155
|
+
|
|
1156
|
+
expect(() =>
|
|
1157
|
+
compile(`<script setup>
|
|
1158
|
+
export * from './foo'
|
|
1159
|
+
</script>`)
|
|
1160
|
+
).toThrow(moduleErrorMsg)
|
|
1161
|
+
|
|
1162
|
+
expect(() =>
|
|
1163
|
+
compile(`<script setup>
|
|
1164
|
+
const bar = 1
|
|
1165
|
+
export { bar as default }
|
|
1166
|
+
</script>`)
|
|
1167
|
+
).toThrow(moduleErrorMsg)
|
|
1168
|
+
})
|
|
1169
|
+
|
|
1170
|
+
test('defineProps/Emit() w/ both type and non-type args', () => {
|
|
1171
|
+
expect(() => {
|
|
1172
|
+
compile(`<script setup lang="ts">
|
|
1173
|
+
defineProps<{}>({})
|
|
1174
|
+
</script>`)
|
|
1175
|
+
}).toThrow(`cannot accept both type and non-type arguments`)
|
|
1176
|
+
|
|
1177
|
+
expect(() => {
|
|
1178
|
+
compile(`<script setup lang="ts">
|
|
1179
|
+
defineEmits<{}>({})
|
|
1180
|
+
</script>`)
|
|
1181
|
+
}).toThrow(`cannot accept both type and non-type arguments`)
|
|
1182
|
+
})
|
|
1183
|
+
|
|
1184
|
+
test('defineProps/Emit() referencing local var', () => {
|
|
1185
|
+
expect(() =>
|
|
1186
|
+
compile(`<script setup>
|
|
1187
|
+
const bar = 1
|
|
1188
|
+
defineProps({
|
|
1189
|
+
foo: {
|
|
1190
|
+
default: () => bar
|
|
1191
|
+
}
|
|
1192
|
+
})
|
|
1193
|
+
</script>`)
|
|
1194
|
+
).toThrow(`cannot reference locally declared variables`)
|
|
1195
|
+
|
|
1196
|
+
expect(() =>
|
|
1197
|
+
compile(`<script setup>
|
|
1198
|
+
const bar = 'hello'
|
|
1199
|
+
defineEmits([bar])
|
|
1200
|
+
</script>`)
|
|
1201
|
+
).toThrow(`cannot reference locally declared variables`)
|
|
1202
|
+
|
|
1203
|
+
// #4644
|
|
1204
|
+
expect(() =>
|
|
1205
|
+
compile(`
|
|
1206
|
+
<script>const bar = 1</script>
|
|
1207
|
+
<script setup>
|
|
1208
|
+
defineProps({
|
|
1209
|
+
foo: {
|
|
1210
|
+
default: () => bar
|
|
1211
|
+
}
|
|
1212
|
+
})
|
|
1213
|
+
</script>`)
|
|
1214
|
+
).not.toThrow(`cannot reference locally declared variables`)
|
|
1215
|
+
})
|
|
1216
|
+
|
|
1217
|
+
test('should allow defineProps/Emit() referencing scope var', () => {
|
|
1218
|
+
assertCode(
|
|
1219
|
+
compile(`<script setup>
|
|
1220
|
+
const bar = 1
|
|
1221
|
+
defineProps({
|
|
1222
|
+
foo: {
|
|
1223
|
+
default: bar => bar + 1
|
|
1224
|
+
}
|
|
1225
|
+
})
|
|
1226
|
+
defineEmits({
|
|
1227
|
+
foo: bar => bar > 1
|
|
1228
|
+
})
|
|
1229
|
+
</script>`).content
|
|
1230
|
+
)
|
|
1231
|
+
})
|
|
1232
|
+
|
|
1233
|
+
test('should allow defineProps/Emit() referencing imported binding', () => {
|
|
1234
|
+
assertCode(
|
|
1235
|
+
compile(`<script setup>
|
|
1236
|
+
import { bar } from './bar'
|
|
1237
|
+
defineProps({
|
|
1238
|
+
foo: {
|
|
1239
|
+
default: () => bar
|
|
1240
|
+
}
|
|
1241
|
+
})
|
|
1242
|
+
defineEmits({
|
|
1243
|
+
foo: () => bar > 1
|
|
1244
|
+
})
|
|
1245
|
+
</script>`).content
|
|
1246
|
+
)
|
|
1247
|
+
})
|
|
1248
|
+
})
|
|
1249
|
+
})
|
|
1250
|
+
|
|
1251
|
+
describe('SFC analyze <script> bindings', () => {
|
|
1252
|
+
it('can parse decorators syntax in typescript block', () => {
|
|
1253
|
+
const { scriptAst } = compile(`
|
|
1254
|
+
<script lang="ts">
|
|
1255
|
+
import { Options, Vue } from 'vue-class-component';
|
|
1256
|
+
@Options({
|
|
1257
|
+
components: {
|
|
1258
|
+
HelloWorld,
|
|
1259
|
+
},
|
|
1260
|
+
props: ['foo', 'bar']
|
|
1261
|
+
})
|
|
1262
|
+
export default class Home extends Vue {}
|
|
1263
|
+
</script>
|
|
1264
|
+
`)
|
|
1265
|
+
|
|
1266
|
+
expect(scriptAst).toBeDefined()
|
|
1267
|
+
})
|
|
1268
|
+
|
|
1269
|
+
it('recognizes props array declaration', () => {
|
|
1270
|
+
const { bindings } = compile(`
|
|
1271
|
+
<script>
|
|
1272
|
+
export default {
|
|
1273
|
+
props: ['foo', 'bar']
|
|
1274
|
+
}
|
|
1275
|
+
</script>
|
|
1276
|
+
`)
|
|
1277
|
+
expect(bindings).toStrictEqual({
|
|
1278
|
+
foo: BindingTypes.PROPS,
|
|
1279
|
+
bar: BindingTypes.PROPS
|
|
1280
|
+
})
|
|
1281
|
+
expect(bindings!.__isScriptSetup).toBe(false)
|
|
1282
|
+
})
|
|
1283
|
+
|
|
1284
|
+
it('recognizes props object declaration', () => {
|
|
1285
|
+
const { bindings } = compile(`
|
|
1286
|
+
<script>
|
|
1287
|
+
export default {
|
|
1288
|
+
props: {
|
|
1289
|
+
foo: String,
|
|
1290
|
+
bar: {
|
|
1291
|
+
type: String,
|
|
1292
|
+
},
|
|
1293
|
+
baz: null,
|
|
1294
|
+
qux: [String, Number]
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
</script>
|
|
1298
|
+
`)
|
|
1299
|
+
expect(bindings).toStrictEqual({
|
|
1300
|
+
foo: BindingTypes.PROPS,
|
|
1301
|
+
bar: BindingTypes.PROPS,
|
|
1302
|
+
baz: BindingTypes.PROPS,
|
|
1303
|
+
qux: BindingTypes.PROPS
|
|
1304
|
+
})
|
|
1305
|
+
expect(bindings!.__isScriptSetup).toBe(false)
|
|
1306
|
+
})
|
|
1307
|
+
|
|
1308
|
+
it('recognizes setup return', () => {
|
|
1309
|
+
const { bindings } = compile(`
|
|
1310
|
+
<script>
|
|
1311
|
+
const bar = 2
|
|
1312
|
+
export default {
|
|
1313
|
+
setup() {
|
|
1314
|
+
return {
|
|
1315
|
+
foo: 1,
|
|
1316
|
+
bar
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
</script>
|
|
1321
|
+
`)
|
|
1322
|
+
expect(bindings).toStrictEqual({
|
|
1323
|
+
foo: BindingTypes.SETUP_MAYBE_REF,
|
|
1324
|
+
bar: BindingTypes.SETUP_MAYBE_REF
|
|
1325
|
+
})
|
|
1326
|
+
expect(bindings!.__isScriptSetup).toBe(false)
|
|
1327
|
+
})
|
|
1328
|
+
|
|
1329
|
+
it('recognizes exported vars', () => {
|
|
1330
|
+
const { bindings } = compile(`
|
|
1331
|
+
<script>
|
|
1332
|
+
export const foo = 2
|
|
1333
|
+
</script>
|
|
1334
|
+
<script setup>
|
|
1335
|
+
console.log(foo)
|
|
1336
|
+
</script>
|
|
1337
|
+
`)
|
|
1338
|
+
expect(bindings).toStrictEqual({
|
|
1339
|
+
foo: BindingTypes.SETUP_CONST
|
|
1340
|
+
})
|
|
1341
|
+
})
|
|
1342
|
+
|
|
1343
|
+
it('recognizes async setup return', () => {
|
|
1344
|
+
const { bindings } = compile(`
|
|
1345
|
+
<script>
|
|
1346
|
+
const bar = 2
|
|
1347
|
+
export default {
|
|
1348
|
+
async setup() {
|
|
1349
|
+
return {
|
|
1350
|
+
foo: 1,
|
|
1351
|
+
bar
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
</script>
|
|
1356
|
+
`)
|
|
1357
|
+
expect(bindings).toStrictEqual({
|
|
1358
|
+
foo: BindingTypes.SETUP_MAYBE_REF,
|
|
1359
|
+
bar: BindingTypes.SETUP_MAYBE_REF
|
|
1360
|
+
})
|
|
1361
|
+
expect(bindings!.__isScriptSetup).toBe(false)
|
|
1362
|
+
})
|
|
1363
|
+
|
|
1364
|
+
it('recognizes data return', () => {
|
|
1365
|
+
const { bindings } = compile(`
|
|
1366
|
+
<script>
|
|
1367
|
+
const bar = 2
|
|
1368
|
+
export default {
|
|
1369
|
+
data() {
|
|
1370
|
+
return {
|
|
1371
|
+
foo: null,
|
|
1372
|
+
bar
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
</script>
|
|
1377
|
+
`)
|
|
1378
|
+
expect(bindings).toStrictEqual({
|
|
1379
|
+
foo: BindingTypes.DATA,
|
|
1380
|
+
bar: BindingTypes.DATA
|
|
1381
|
+
})
|
|
1382
|
+
})
|
|
1383
|
+
|
|
1384
|
+
it('recognizes methods', () => {
|
|
1385
|
+
const { bindings } = compile(`
|
|
1386
|
+
<script>
|
|
1387
|
+
export default {
|
|
1388
|
+
methods: {
|
|
1389
|
+
foo() {}
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
</script>
|
|
1393
|
+
`)
|
|
1394
|
+
expect(bindings).toStrictEqual({ foo: BindingTypes.OPTIONS })
|
|
1395
|
+
})
|
|
1396
|
+
|
|
1397
|
+
it('recognizes computeds', () => {
|
|
1398
|
+
const { bindings } = compile(`
|
|
1399
|
+
<script>
|
|
1400
|
+
export default {
|
|
1401
|
+
computed: {
|
|
1402
|
+
foo() {},
|
|
1403
|
+
bar: {
|
|
1404
|
+
get() {},
|
|
1405
|
+
set() {},
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
</script>
|
|
1410
|
+
`)
|
|
1411
|
+
expect(bindings).toStrictEqual({
|
|
1412
|
+
foo: BindingTypes.OPTIONS,
|
|
1413
|
+
bar: BindingTypes.OPTIONS
|
|
1414
|
+
})
|
|
1415
|
+
})
|
|
1416
|
+
|
|
1417
|
+
it('recognizes injections array declaration', () => {
|
|
1418
|
+
const { bindings } = compile(`
|
|
1419
|
+
<script>
|
|
1420
|
+
export default {
|
|
1421
|
+
inject: ['foo', 'bar']
|
|
1422
|
+
}
|
|
1423
|
+
</script>
|
|
1424
|
+
`)
|
|
1425
|
+
expect(bindings).toStrictEqual({
|
|
1426
|
+
foo: BindingTypes.OPTIONS,
|
|
1427
|
+
bar: BindingTypes.OPTIONS
|
|
1428
|
+
})
|
|
1429
|
+
})
|
|
1430
|
+
|
|
1431
|
+
it('recognizes injections object declaration', () => {
|
|
1432
|
+
const { bindings } = compile(`
|
|
1433
|
+
<script>
|
|
1434
|
+
export default {
|
|
1435
|
+
inject: {
|
|
1436
|
+
foo: {},
|
|
1437
|
+
bar: {},
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
</script>
|
|
1441
|
+
`)
|
|
1442
|
+
expect(bindings).toStrictEqual({
|
|
1443
|
+
foo: BindingTypes.OPTIONS,
|
|
1444
|
+
bar: BindingTypes.OPTIONS
|
|
1445
|
+
})
|
|
1446
|
+
})
|
|
1447
|
+
|
|
1448
|
+
it('works for mixed bindings', () => {
|
|
1449
|
+
const { bindings } = compile(`
|
|
1450
|
+
<script>
|
|
1451
|
+
export default {
|
|
1452
|
+
inject: ['foo'],
|
|
1453
|
+
props: {
|
|
1454
|
+
bar: String,
|
|
1455
|
+
},
|
|
1456
|
+
setup() {
|
|
1457
|
+
return {
|
|
1458
|
+
baz: null,
|
|
1459
|
+
}
|
|
1460
|
+
},
|
|
1461
|
+
data() {
|
|
1462
|
+
return {
|
|
1463
|
+
qux: null
|
|
1464
|
+
}
|
|
1465
|
+
},
|
|
1466
|
+
methods: {
|
|
1467
|
+
quux() {}
|
|
1468
|
+
},
|
|
1469
|
+
computed: {
|
|
1470
|
+
quuz() {}
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
</script>
|
|
1474
|
+
`)
|
|
1475
|
+
expect(bindings).toStrictEqual({
|
|
1476
|
+
foo: BindingTypes.OPTIONS,
|
|
1477
|
+
bar: BindingTypes.PROPS,
|
|
1478
|
+
baz: BindingTypes.SETUP_MAYBE_REF,
|
|
1479
|
+
qux: BindingTypes.DATA,
|
|
1480
|
+
quux: BindingTypes.OPTIONS,
|
|
1481
|
+
quuz: BindingTypes.OPTIONS
|
|
1482
|
+
})
|
|
1483
|
+
})
|
|
1484
|
+
|
|
1485
|
+
it('works for script setup', () => {
|
|
1486
|
+
const { bindings } = compile(`
|
|
1487
|
+
<script setup>
|
|
1488
|
+
import { ref as r } from 'vue'
|
|
1489
|
+
defineProps({
|
|
1490
|
+
foo: String
|
|
1491
|
+
})
|
|
1492
|
+
|
|
1493
|
+
const a = r(1)
|
|
1494
|
+
let b = 2
|
|
1495
|
+
const c = 3
|
|
1496
|
+
const { d } = someFoo()
|
|
1497
|
+
let { e } = someBar()
|
|
1498
|
+
</script>
|
|
1499
|
+
`)
|
|
1500
|
+
|
|
1501
|
+
expect(bindings).toStrictEqual({
|
|
1502
|
+
r: BindingTypes.SETUP_CONST,
|
|
1503
|
+
a: BindingTypes.SETUP_REF,
|
|
1504
|
+
b: BindingTypes.SETUP_LET,
|
|
1505
|
+
c: BindingTypes.SETUP_CONST,
|
|
1506
|
+
d: BindingTypes.SETUP_MAYBE_REF,
|
|
1507
|
+
e: BindingTypes.SETUP_LET,
|
|
1508
|
+
foo: BindingTypes.PROPS
|
|
1509
|
+
})
|
|
1510
|
+
})
|
|
1511
|
+
|
|
1512
|
+
describe('auto name inference', () => {
|
|
1513
|
+
test('basic', () => {
|
|
1514
|
+
const { content } = compile(
|
|
1515
|
+
`<script setup>const a = 1</script>
|
|
1516
|
+
<template>{{ a }}</template>`,
|
|
1517
|
+
undefined,
|
|
1518
|
+
{
|
|
1519
|
+
filename: 'FooBar.vue'
|
|
1520
|
+
}
|
|
1521
|
+
)
|
|
1522
|
+
expect(content).toMatch(`export default {
|
|
1523
|
+
__name: 'FooBar'`)
|
|
1524
|
+
assertCode(content)
|
|
1525
|
+
})
|
|
1526
|
+
|
|
1527
|
+
test('do not overwrite manual name (object)', () => {
|
|
1528
|
+
const { content } = compile(
|
|
1529
|
+
`<script>
|
|
1530
|
+
export default {
|
|
1531
|
+
name: 'Baz'
|
|
1532
|
+
}
|
|
1533
|
+
</script>
|
|
1534
|
+
<script setup>const a = 1</script>
|
|
1535
|
+
<template>{{ a }}</template>`,
|
|
1536
|
+
undefined,
|
|
1537
|
+
{
|
|
1538
|
+
filename: 'FooBar.vue'
|
|
1539
|
+
}
|
|
1540
|
+
)
|
|
1541
|
+
expect(content).not.toMatch(`name: 'FooBar'`)
|
|
1542
|
+
expect(content).toMatch(`name: 'Baz'`)
|
|
1543
|
+
assertCode(content)
|
|
1544
|
+
})
|
|
1545
|
+
|
|
1546
|
+
test('do not overwrite manual name (call)', () => {
|
|
1547
|
+
const { content } = compile(
|
|
1548
|
+
`<script>
|
|
1549
|
+
import { defineComponent } from 'vue'
|
|
1550
|
+
export default defineComponent({
|
|
1551
|
+
name: 'Baz'
|
|
1552
|
+
})
|
|
1553
|
+
</script>
|
|
1554
|
+
<script setup>const a = 1</script>
|
|
1555
|
+
<template>{{ a }}</template>`,
|
|
1556
|
+
undefined,
|
|
1557
|
+
{
|
|
1558
|
+
filename: 'FooBar.vue'
|
|
1559
|
+
}
|
|
1560
|
+
)
|
|
1561
|
+
expect(content).not.toMatch(`name: 'FooBar'`)
|
|
1562
|
+
expect(content).toMatch(`name: 'Baz'`)
|
|
1563
|
+
assertCode(content)
|
|
1564
|
+
})
|
|
1565
|
+
|
|
1566
|
+
// #12591
|
|
1567
|
+
test('should not error when performing ts expression check for v-on inline statement', () => {
|
|
1568
|
+
compile(`
|
|
1569
|
+
<script setup lang="ts">
|
|
1570
|
+
import { foo } from './foo'
|
|
1571
|
+
</script>
|
|
1572
|
+
<template>
|
|
1573
|
+
<div @click="$emit('update:a');"></div>
|
|
1574
|
+
</template>
|
|
1575
|
+
`)
|
|
1576
|
+
})
|
|
1577
|
+
|
|
1578
|
+
// #12841
|
|
1579
|
+
test('should not error when performing ts expression check for v-slot destructured default value', () => {
|
|
1580
|
+
compile(`
|
|
1581
|
+
<script setup lang="ts">
|
|
1582
|
+
import FooComp from './Foo.vue'
|
|
1583
|
+
</script>
|
|
1584
|
+
<template>
|
|
1585
|
+
<FooComp>
|
|
1586
|
+
<template #bar="{ bar = { baz: '' } }">
|
|
1587
|
+
{{ bar.baz }}
|
|
1588
|
+
</template>
|
|
1589
|
+
</FooComp>
|
|
1590
|
+
</template>
|
|
1591
|
+
`)
|
|
1592
|
+
})
|
|
1593
|
+
})
|
|
1594
|
+
})
|