How to use createHydrationRenderer method in Playwright Internal

Best JavaScript code snippet using playwright-internal

runtime-dom.esm-bundler-bd54d879.js

Source:runtime-dom.esm-bundler-bd54d879.js Github

copy

Full Screen

...1464}1465function ensureHydrationRenderer() {1466 renderer = enabledHydration1467 ? renderer1468 : createHydrationRenderer(rendererOptions);1469 enabledHydration = true;1470 return renderer;1471}1472// use explicit type casts here to avoid import() calls in rolled-up d.ts1473const render = ((...args) => {1474 ensureRenderer().render(...args);1475});1476const hydrate = ((...args) => {1477 ensureHydrationRenderer().hydrate(...args);1478});1479const createApp = ((...args) => {1480 const app = ensureRenderer().createApp(...args);1481 const { mount } = app;1482 app.mount = (containerOrSelector) => { ...

Full Screen

Full Screen

vuex.js

Source:vuex.js Github

copy

Full Screen

1import { T as Transition, a as TransitionGroup, V as VueElement, c as createApp, b as createSSRApp, d as defineCustomElement, e as defineSSRCustomElement, h as hydrate, i as initDirectivesForSSR, r as render, u as useCssModule, f as useCssVars, v as vModelCheckbox, g as vModelDynamic, j as vModelRadio, k as vModelSelect, l as vModelText, m as vShow, w as withKeys, n as withModifiers } from './common/runtime-dom.esm-bundler-bd54d879.js';2import { a3 as EffectScope, a4 as ReactiveEffect, Z as computed, a5 as customRef, a6 as effect, a7 as effectScope, a8 as getCurrentScope, a9 as isProxy, aa as isReactive, ab as isReadonly, ac as isRef, ad as markRaw, ae as onScopeDispose, af as proxyRefs, _ as reactive, ag as readonly, a1 as ref, ah as shallowReactive, ai as shallowReadonly, X as shallowRef, aj as stop, R as toRaw, ak as toRef, al as toRefs, am as triggerRef, Y as unref, s as camelize, u as capitalize, n as normalizeClass, an as normalizeProps, f as normalizeStyle, t as toDisplayString, ao as toHandlerKey, I as BaseTransition, ap as Comment, F as Fragment, aq as KeepAlive, S as Static, ar as Suspense, as as Teleport, at as Text, y as callWithAsyncErrorHandling, au as callWithErrorHandling, av as cloneVNode, aw as compatUtils, c as createBlock, ax as createCommentVNode, d as createElementBlock, a as createBaseVNode, W as createHydrationRenderer, i as createRenderer, ay as createSlots, az as createStaticVNode, g as createTextVNode, e as createVNode, aA as defineAsyncComponent, z as defineComponent, aB as defineEmits, aC as defineExpose, aD as defineProps, aE as devtools, O as getCurrentInstance, T as getTransitionRawChildren, aF as guardReactiveProps, H as h, aG as handleError, aH as initCustomFormatter, $ as inject, aI as isMemoSame, aJ as isRuntimeOnly, aK as isVNode, aL as mergeDefaults, aM as mergeProps, A as nextTick, aN as onActivated, aO as onBeforeMount, aP as onBeforeUnmount, aQ as onBeforeUpdate, aR as onDeactivated, aS as onErrorCaptured, D as onMounted, aT as onRenderTracked, aU as onRenderTriggered, aV as onServerPrefetch, G as onUnmounted, Q as onUpdated, o as openBlock, aW as popScopeId, a0 as provide, aX as pushScopeId, aY as queuePostFlushCb, aZ as registerRuntimeCompiler, b as renderList, a_ as renderSlot, r as resolveComponent, a$ as resolveDirective, b0 as resolveDynamicComponent, b1 as resolveFilter, V as resolveTransitionHooks, b2 as setBlockTracking, b3 as setDevtoolsHook, U as setTransitionHooks, b4 as ssrContextKey, b5 as ssrUtils, b6 as toHandlers, b7 as transformVNodeArgs, b8 as useAttrs, b9 as useSSRContext, ba as useSlots, P as useTransitionState, bb as version$1, bc as warn, a2 as watch, bd as watchEffect, C as watchPostEffect, be as watchSyncEffect, bf as withAsyncContext, w as withCtx, bg as withDefaults, bh as withDirectives, bi as withMemo, bj as withScopeId } from './common/runtime-core.esm-bundler-928c6f2b.js';3const compile = () => {4};5var vue_runtime_esmBundler = /*#__PURE__*/Object.freeze({6 __proto__: null,7 compile: compile,8 EffectScope: EffectScope,9 ReactiveEffect: ReactiveEffect,10 computed: computed,11 customRef: customRef,12 effect: effect,13 effectScope: effectScope,14 getCurrentScope: getCurrentScope,15 isProxy: isProxy,16 isReactive: isReactive,17 isReadonly: isReadonly,18 isRef: isRef,19 markRaw: markRaw,20 onScopeDispose: onScopeDispose,21 proxyRefs: proxyRefs,22 reactive: reactive,23 readonly: readonly,24 ref: ref,25 shallowReactive: shallowReactive,26 shallowReadonly: shallowReadonly,27 shallowRef: shallowRef,28 stop: stop,29 toRaw: toRaw,30 toRef: toRef,31 toRefs: toRefs,32 triggerRef: triggerRef,33 unref: unref,34 camelize: camelize,35 capitalize: capitalize,36 normalizeClass: normalizeClass,37 normalizeProps: normalizeProps,38 normalizeStyle: normalizeStyle,39 toDisplayString: toDisplayString,40 toHandlerKey: toHandlerKey,41 BaseTransition: BaseTransition,42 Comment: Comment,43 Fragment: Fragment,44 KeepAlive: KeepAlive,45 Static: Static,46 Suspense: Suspense,47 Teleport: Teleport,48 Text: Text,49 callWithAsyncErrorHandling: callWithAsyncErrorHandling,50 callWithErrorHandling: callWithErrorHandling,51 cloneVNode: cloneVNode,52 compatUtils: compatUtils,53 createBlock: createBlock,54 createCommentVNode: createCommentVNode,55 createElementBlock: createElementBlock,56 createElementVNode: createBaseVNode,57 createHydrationRenderer: createHydrationRenderer,58 createRenderer: createRenderer,59 createSlots: createSlots,60 createStaticVNode: createStaticVNode,61 createTextVNode: createTextVNode,62 createVNode: createVNode,63 defineAsyncComponent: defineAsyncComponent,64 defineComponent: defineComponent,65 defineEmits: defineEmits,66 defineExpose: defineExpose,67 defineProps: defineProps,68 get devtools () { return devtools; },69 getCurrentInstance: getCurrentInstance,70 getTransitionRawChildren: getTransitionRawChildren,71 guardReactiveProps: guardReactiveProps,72 h: h,73 handleError: handleError,74 initCustomFormatter: initCustomFormatter,75 inject: inject,76 isMemoSame: isMemoSame,77 isRuntimeOnly: isRuntimeOnly,78 isVNode: isVNode,79 mergeDefaults: mergeDefaults,80 mergeProps: mergeProps,81 nextTick: nextTick,82 onActivated: onActivated,83 onBeforeMount: onBeforeMount,84 onBeforeUnmount: onBeforeUnmount,85 onBeforeUpdate: onBeforeUpdate,86 onDeactivated: onDeactivated,87 onErrorCaptured: onErrorCaptured,88 onMounted: onMounted,89 onRenderTracked: onRenderTracked,90 onRenderTriggered: onRenderTriggered,91 onServerPrefetch: onServerPrefetch,92 onUnmounted: onUnmounted,93 onUpdated: onUpdated,94 openBlock: openBlock,95 popScopeId: popScopeId,96 provide: provide,97 pushScopeId: pushScopeId,98 queuePostFlushCb: queuePostFlushCb,99 registerRuntimeCompiler: registerRuntimeCompiler,100 renderList: renderList,101 renderSlot: renderSlot,102 resolveComponent: resolveComponent,103 resolveDirective: resolveDirective,104 resolveDynamicComponent: resolveDynamicComponent,105 resolveFilter: resolveFilter,106 resolveTransitionHooks: resolveTransitionHooks,107 setBlockTracking: setBlockTracking,108 setDevtoolsHook: setDevtoolsHook,109 setTransitionHooks: setTransitionHooks,110 ssrContextKey: ssrContextKey,111 ssrUtils: ssrUtils,112 toHandlers: toHandlers,113 transformVNodeArgs: transformVNodeArgs,114 useAttrs: useAttrs,115 useSSRContext: useSSRContext,116 useSlots: useSlots,117 useTransitionState: useTransitionState,118 version: version$1,119 warn: warn,120 watch: watch,121 watchEffect: watchEffect,122 watchPostEffect: watchPostEffect,123 watchSyncEffect: watchSyncEffect,124 withAsyncContext: withAsyncContext,125 withCtx: withCtx,126 withDefaults: withDefaults,127 withDirectives: withDirectives,128 withMemo: withMemo,129 withScopeId: withScopeId,130 Transition: Transition,131 TransitionGroup: TransitionGroup,132 VueElement: VueElement,133 createApp: createApp,134 createSSRApp: createSSRApp,135 defineCustomElement: defineCustomElement,136 defineSSRCustomElement: defineSSRCustomElement,137 hydrate: hydrate,138 initDirectivesForSSR: initDirectivesForSSR,139 render: render,140 useCssModule: useCssModule,141 useCssVars: useCssVars,142 vModelCheckbox: vModelCheckbox,143 vModelDynamic: vModelDynamic,144 vModelRadio: vModelRadio,145 vModelSelect: vModelSelect,146 vModelText: vModelText,147 vShow: vShow,148 withKeys: withKeys,149 withModifiers: withModifiers150});151function getDevtoolsGlobalHook() {152 return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;153}154function getTarget() {155 // @ts-ignore156 return (typeof navigator !== 'undefined' && typeof window !== 'undefined')157 ? window158 : typeof global !== 'undefined'159 ? global160 : {};161}162const isProxyAvailable = typeof Proxy === 'function';163const HOOK_SETUP = 'devtools-plugin:setup';164const HOOK_PLUGIN_SETTINGS_SET = 'plugin:settings:set';165class ApiProxy {166 constructor(plugin, hook) {167 this.target = null;168 this.targetQueue = [];169 this.onQueue = [];170 this.plugin = plugin;171 this.hook = hook;172 const defaultSettings = {};173 if (plugin.settings) {174 for (const id in plugin.settings) {175 const item = plugin.settings[id];176 defaultSettings[id] = item.defaultValue;177 }178 }179 const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;180 let currentSettings = { ...defaultSettings };181 try {182 const raw = localStorage.getItem(localSettingsSaveId);183 const data = JSON.parse(raw);184 Object.assign(currentSettings, data);185 }186 catch (e) {187 // noop188 }189 this.fallbacks = {190 getSettings() {191 return currentSettings;192 },193 setSettings(value) {194 try {195 localStorage.setItem(localSettingsSaveId, JSON.stringify(value));196 }197 catch (e) {198 // noop199 }200 currentSettings = value;201 }202 };203 hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {204 if (pluginId === this.plugin.id) {205 this.fallbacks.setSettings(value);206 }207 });208 this.proxiedOn = new Proxy({}, {209 get: (_target, prop) => {210 if (this.target) {211 return this.target.on[prop];212 }213 else {214 return (...args) => {215 this.onQueue.push({216 method: prop,217 args218 });219 };220 }221 }222 });223 this.proxiedTarget = new Proxy({}, {224 get: (_target, prop) => {225 if (this.target) {226 return this.target[prop];227 }228 else if (prop === 'on') {229 return this.proxiedOn;230 }231 else if (Object.keys(this.fallbacks).includes(prop)) {232 return (...args) => {233 this.targetQueue.push({234 method: prop,235 args,236 resolve: () => { }237 });238 return this.fallbacks[prop](...args);239 };240 }241 else {242 return (...args) => {243 return new Promise(resolve => {244 this.targetQueue.push({245 method: prop,246 args,247 resolve248 });249 });250 };251 }252 }253 });254 }255 async setRealTarget(target) {256 this.target = target;257 for (const item of this.onQueue) {258 this.target.on[item.method](...item.args);259 }260 for (const item of this.targetQueue) {261 item.resolve(await this.target[item.method](...item.args));262 }263 }264}265function setupDevtoolsPlugin(pluginDescriptor, setupFn) {266 const target = getTarget();267 const hook = getDevtoolsGlobalHook();268 const enableProxy = isProxyAvailable && pluginDescriptor.enableEarlyProxy;269 if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {270 hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);271 }272 else {273 const proxy = enableProxy ? new ApiProxy(pluginDescriptor, hook) : null;274 const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];275 list.push({276 pluginDescriptor,277 setupFn,278 proxy279 });280 if (proxy)281 setupFn(proxy.proxiedTarget);282 }283}284var esm = /*#__PURE__*/Object.freeze({285 __proto__: null,286 setupDevtoolsPlugin: setupDevtoolsPlugin287});288var storeKey = 'store';289function useStore (key) {290 if ( key === void 0 ) key = null;291 return vue_runtime_esmBundler.inject(key !== null ? key : storeKey)292}293/**294 * Get the first item that pass the test295 * by second argument function296 *297 * @param {Array} list298 * @param {Function} f299 * @return {*}300 */301function find (list, f) {302 return list.filter(f)[0]303}304/**305 * Deep copy the given object considering circular structure.306 * This function caches all nested objects and its copies.307 * If it detects circular structure, use cached copy to avoid infinite loop.308 *309 * @param {*} obj310 * @param {Array<Object>} cache311 * @return {*}312 */313function deepCopy (obj, cache) {314 if ( cache === void 0 ) cache = [];315 // just return if obj is immutable value316 if (obj === null || typeof obj !== 'object') {317 return obj318 }319 // if obj is hit, it is in circular structure320 var hit = find(cache, function (c) { return c.original === obj; });321 if (hit) {322 return hit.copy323 }324 var copy = Array.isArray(obj) ? [] : {};325 // put the copy into cache at first326 // because we want to refer it in recursive deepCopy327 cache.push({328 original: obj,329 copy: copy330 });331 Object.keys(obj).forEach(function (key) {332 copy[key] = deepCopy(obj[key], cache);333 });334 return copy335}336/**337 * forEach for object338 */339function forEachValue (obj, fn) {340 Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });341}342function isObject (obj) {343 return obj !== null && typeof obj === 'object'344}345function isPromise (val) {346 return val && typeof val.then === 'function'347}348function partial (fn, arg) {349 return function () {350 return fn(arg)351 }352}353function genericSubscribe (fn, subs, options) {354 if (subs.indexOf(fn) < 0) {355 options && options.prepend356 ? subs.unshift(fn)357 : subs.push(fn);358 }359 return function () {360 var i = subs.indexOf(fn);361 if (i > -1) {362 subs.splice(i, 1);363 }364 }365}366function resetStore (store, hot) {367 store._actions = Object.create(null);368 store._mutations = Object.create(null);369 store._wrappedGetters = Object.create(null);370 store._modulesNamespaceMap = Object.create(null);371 var state = store.state;372 // init all modules373 installModule(store, state, [], store._modules.root, true);374 // reset state375 resetStoreState(store, state, hot);376}377function resetStoreState (store, state, hot) {378 var oldState = store._state;379 // bind store public getters380 store.getters = {};381 // reset local getters cache382 store._makeLocalGettersCache = Object.create(null);383 var wrappedGetters = store._wrappedGetters;384 var computedObj = {};385 forEachValue(wrappedGetters, function (fn, key) {386 // use computed to leverage its lazy-caching mechanism387 // direct inline function use will lead to closure preserving oldState.388 // using partial to return function with only arguments preserved in closure environment.389 computedObj[key] = partial(fn, store);390 Object.defineProperty(store.getters, key, {391 // TODO: use `computed` when it's possible. at the moment we can't due to392 // https://github.com/vuejs/vuex/pull/1883393 get: function () { return computedObj[key](); },394 enumerable: true // for local getters395 });396 });397 store._state = vue_runtime_esmBundler.reactive({398 data: state399 });400 // enable strict mode for new state401 if (store.strict) {402 enableStrictMode(store);403 }404 if (oldState) {405 if (hot) {406 // dispatch changes in all subscribed watchers407 // to force getter re-evaluation for hot reloading.408 store._withCommit(function () {409 oldState.data = null;410 });411 }412 }413}414function installModule (store, rootState, path, module, hot) {415 var isRoot = !path.length;416 var namespace = store._modules.getNamespace(path);417 // register in namespace map418 if (module.namespaced) {419 if (store._modulesNamespaceMap[namespace] && ("production" !== 'production')) {420 console.error(("[vuex] duplicate namespace " + namespace + " for the namespaced module " + (path.join('/'))));421 }422 store._modulesNamespaceMap[namespace] = module;423 }424 // set state425 if (!isRoot && !hot) {426 var parentState = getNestedState(rootState, path.slice(0, -1));427 var moduleName = path[path.length - 1];428 store._withCommit(function () {429 parentState[moduleName] = module.state;430 });431 }432 var local = module.context = makeLocalContext(store, namespace, path);433 module.forEachMutation(function (mutation, key) {434 var namespacedType = namespace + key;435 registerMutation(store, namespacedType, mutation, local);436 });437 module.forEachAction(function (action, key) {438 var type = action.root ? key : namespace + key;439 var handler = action.handler || action;440 registerAction(store, type, handler, local);441 });442 module.forEachGetter(function (getter, key) {443 var namespacedType = namespace + key;444 registerGetter(store, namespacedType, getter, local);445 });446 module.forEachChild(function (child, key) {447 installModule(store, rootState, path.concat(key), child, hot);448 });449}450/**451 * make localized dispatch, commit, getters and state452 * if there is no namespace, just use root ones453 */454function makeLocalContext (store, namespace, path) {455 var noNamespace = namespace === '';456 var local = {457 dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) {458 var args = unifyObjectStyle(_type, _payload, _options);459 var payload = args.payload;460 var options = args.options;461 var type = args.type;462 if (!options || !options.root) {463 type = namespace + type;464 }465 return store.dispatch(type, payload)466 },467 commit: noNamespace ? store.commit : function (_type, _payload, _options) {468 var args = unifyObjectStyle(_type, _payload, _options);469 var payload = args.payload;470 var options = args.options;471 var type = args.type;472 if (!options || !options.root) {473 type = namespace + type;474 }475 store.commit(type, payload, options);476 }477 };478 // getters and state object must be gotten lazily479 // because they will be changed by state update480 Object.defineProperties(local, {481 getters: {482 get: noNamespace483 ? function () { return store.getters; }484 : function () { return makeLocalGetters(store, namespace); }485 },486 state: {487 get: function () { return getNestedState(store.state, path); }488 }489 });490 return local491}492function makeLocalGetters (store, namespace) {493 if (!store._makeLocalGettersCache[namespace]) {494 var gettersProxy = {};495 var splitPos = namespace.length;496 Object.keys(store.getters).forEach(function (type) {497 // skip if the target getter is not match this namespace498 if (type.slice(0, splitPos) !== namespace) { return }499 // extract local getter type500 var localType = type.slice(splitPos);501 // Add a port to the getters proxy.502 // Define as getter property because503 // we do not want to evaluate the getters in this time.504 Object.defineProperty(gettersProxy, localType, {505 get: function () { return store.getters[type]; },506 enumerable: true507 });508 });509 store._makeLocalGettersCache[namespace] = gettersProxy;510 }511 return store._makeLocalGettersCache[namespace]512}513function registerMutation (store, type, handler, local) {514 var entry = store._mutations[type] || (store._mutations[type] = []);515 entry.push(function wrappedMutationHandler (payload) {516 handler.call(store, local.state, payload);517 });518}519function registerAction (store, type, handler, local) {520 var entry = store._actions[type] || (store._actions[type] = []);521 entry.push(function wrappedActionHandler (payload) {522 var res = handler.call(store, {523 dispatch: local.dispatch,524 commit: local.commit,525 getters: local.getters,526 state: local.state,527 rootGetters: store.getters,528 rootState: store.state529 }, payload);530 if (!isPromise(res)) {531 res = Promise.resolve(res);532 }533 if (store._devtoolHook) {534 return res.catch(function (err) {535 store._devtoolHook.emit('vuex:error', err);536 throw err537 })538 } else {539 return res540 }541 });542}543function registerGetter (store, type, rawGetter, local) {544 if (store._wrappedGetters[type]) {545 return546 }547 store._wrappedGetters[type] = function wrappedGetter (store) {548 return rawGetter(549 local.state, // local state550 local.getters, // local getters551 store.state, // root state552 store.getters // root getters553 )554 };555}556function enableStrictMode (store) {557 vue_runtime_esmBundler.watch(function () { return store._state.data; }, function () {558 }, { deep: true, flush: 'sync' });559}560function getNestedState (state, path) {561 return path.reduce(function (state, key) { return state[key]; }, state)562}563function unifyObjectStyle (type, payload, options) {564 if (isObject(type) && type.type) {565 options = payload;566 payload = type;567 type = type.type;568 }569 return { type: type, payload: payload, options: options }570}571var LABEL_VUEX_BINDINGS = 'vuex bindings';572var MUTATIONS_LAYER_ID = 'vuex:mutations';573var ACTIONS_LAYER_ID = 'vuex:actions';574var INSPECTOR_ID = 'vuex';575var actionId = 0;576function addDevtools (app, store) {577 esm.setupDevtoolsPlugin(578 {579 id: 'org.vuejs.vuex',580 app: app,581 label: 'Vuex',582 homepage: 'https://next.vuex.vuejs.org/',583 logo: 'https://vuejs.org/images/icons/favicon-96x96.png',584 packageName: 'vuex',585 componentStateTypes: [LABEL_VUEX_BINDINGS]586 },587 function (api) {588 api.addTimelineLayer({589 id: MUTATIONS_LAYER_ID,590 label: 'Vuex Mutations',591 color: COLOR_LIME_500592 });593 api.addTimelineLayer({594 id: ACTIONS_LAYER_ID,595 label: 'Vuex Actions',596 color: COLOR_LIME_500597 });598 api.addInspector({599 id: INSPECTOR_ID,600 label: 'Vuex',601 icon: 'storage',602 treeFilterPlaceholder: 'Filter stores...'603 });604 api.on.getInspectorTree(function (payload) {605 if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {606 if (payload.filter) {607 var nodes = [];608 flattenStoreForInspectorTree(nodes, store._modules.root, payload.filter, '');609 payload.rootNodes = nodes;610 } else {611 payload.rootNodes = [612 formatStoreForInspectorTree(store._modules.root, '')613 ];614 }615 }616 });617 api.on.getInspectorState(function (payload) {618 if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {619 var modulePath = payload.nodeId;620 makeLocalGetters(store, modulePath);621 payload.state = formatStoreForInspectorState(622 getStoreModule(store._modules, modulePath),623 modulePath === 'root' ? store.getters : store._makeLocalGettersCache,624 modulePath625 );626 }627 });628 api.on.editInspectorState(function (payload) {629 if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {630 var modulePath = payload.nodeId;631 var path = payload.path;632 if (modulePath !== 'root') {633 path = modulePath.split('/').filter(Boolean).concat( path);634 }635 store._withCommit(function () {636 payload.set(store._state.data, path, payload.state.value);637 });638 }639 });640 store.subscribe(function (mutation, state) {641 var data = {};642 if (mutation.payload) {643 data.payload = mutation.payload;644 }645 data.state = state;646 api.notifyComponentUpdate();647 api.sendInspectorTree(INSPECTOR_ID);648 api.sendInspectorState(INSPECTOR_ID);649 api.addTimelineEvent({650 layerId: MUTATIONS_LAYER_ID,651 event: {652 time: Date.now(),653 title: mutation.type,654 data: data655 }656 });657 });658 store.subscribeAction({659 before: function (action, state) {660 var data = {};661 if (action.payload) {662 data.payload = action.payload;663 }664 action._id = actionId++;665 action._time = Date.now();666 data.state = state;667 api.addTimelineEvent({668 layerId: ACTIONS_LAYER_ID,669 event: {670 time: action._time,671 title: action.type,672 groupId: action._id,673 subtitle: 'start',674 data: data675 }676 });677 },678 after: function (action, state) {679 var data = {};680 var duration = Date.now() - action._time;681 data.duration = {682 _custom: {683 type: 'duration',684 display: (duration + "ms"),685 tooltip: 'Action duration',686 value: duration687 }688 };689 if (action.payload) {690 data.payload = action.payload;691 }692 data.state = state;693 api.addTimelineEvent({694 layerId: ACTIONS_LAYER_ID,695 event: {696 time: Date.now(),697 title: action.type,698 groupId: action._id,699 subtitle: 'end',700 data: data701 }702 });703 }704 });705 }706 );707}708// extracted from tailwind palette709var COLOR_LIME_500 = 0x84cc16;710var COLOR_DARK = 0x666666;711var COLOR_WHITE = 0xffffff;712var TAG_NAMESPACED = {713 label: 'namespaced',714 textColor: COLOR_WHITE,715 backgroundColor: COLOR_DARK716};717/**718 * @param {string} path719 */720function extractNameFromPath (path) {721 return path && path !== 'root' ? path.split('/').slice(-2, -1)[0] : 'Root'722}723/**724 * @param {*} module725 * @return {import('@vue/devtools-api').CustomInspectorNode}726 */727function formatStoreForInspectorTree (module, path) {728 return {729 id: path || 'root',730 // all modules end with a `/`, we want the last segment only731 // cart/ -> cart732 // nested/cart/ -> cart733 label: extractNameFromPath(path),734 tags: module.namespaced ? [TAG_NAMESPACED] : [],735 children: Object.keys(module._children).map(function (moduleName) { return formatStoreForInspectorTree(736 module._children[moduleName],737 path + moduleName + '/'738 ); }739 )740 }741}742/**743 * @param {import('@vue/devtools-api').CustomInspectorNode[]} result744 * @param {*} module745 * @param {string} filter746 * @param {string} path747 */748function flattenStoreForInspectorTree (result, module, filter, path) {749 if (path.includes(filter)) {750 result.push({751 id: path || 'root',752 label: path.endsWith('/') ? path.slice(0, path.length - 1) : path || 'Root',753 tags: module.namespaced ? [TAG_NAMESPACED] : []754 });755 }756 Object.keys(module._children).forEach(function (moduleName) {757 flattenStoreForInspectorTree(result, module._children[moduleName], filter, path + moduleName + '/');758 });759}760/**761 * @param {*} module762 * @return {import('@vue/devtools-api').CustomInspectorState}763 */764function formatStoreForInspectorState (module, getters, path) {765 getters = path === 'root' ? getters : getters[path];766 var gettersKeys = Object.keys(getters);767 var storeState = {768 state: Object.keys(module.state).map(function (key) { return ({769 key: key,770 editable: true,771 value: module.state[key]772 }); })773 };774 if (gettersKeys.length) {775 var tree = transformPathsToObjectTree(getters);776 storeState.getters = Object.keys(tree).map(function (key) { return ({777 key: key.endsWith('/') ? extractNameFromPath(key) : key,778 editable: false,779 value: canThrow(function () { return tree[key]; })780 }); });781 }782 return storeState783}784function transformPathsToObjectTree (getters) {785 var result = {};786 Object.keys(getters).forEach(function (key) {787 var path = key.split('/');788 if (path.length > 1) {789 var target = result;790 var leafKey = path.pop();791 path.forEach(function (p) {792 if (!target[p]) {793 target[p] = {794 _custom: {795 value: {},796 display: p,797 tooltip: 'Module',798 abstract: true799 }800 };801 }802 target = target[p]._custom.value;803 });804 target[leafKey] = canThrow(function () { return getters[key]; });805 } else {806 result[key] = canThrow(function () { return getters[key]; });807 }808 });809 return result810}811function getStoreModule (moduleMap, path) {812 var names = path.split('/').filter(function (n) { return n; });813 return names.reduce(814 function (module, moduleName, i) {815 var child = module[moduleName];816 if (!child) {817 throw new Error(("Missing module \"" + moduleName + "\" for path \"" + path + "\"."))818 }819 return i === names.length - 1 ? child : child._children820 },821 path === 'root' ? moduleMap : moduleMap.root._children822 )823}824function canThrow (cb) {825 try {826 return cb()827 } catch (e) {828 return e829 }830}831// Base data struct for store's module, package with some attribute and method832var Module = function Module (rawModule, runtime) {833 this.runtime = runtime;834 // Store some children item835 this._children = Object.create(null);836 // Store the origin module object which passed by programmer837 this._rawModule = rawModule;838 var rawState = rawModule.state;839 // Store the origin module's state840 this.state = (typeof rawState === 'function' ? rawState() : rawState) || {};841};842var prototypeAccessors$1 = { namespaced: { configurable: true } };843prototypeAccessors$1.namespaced.get = function () {844 return !!this._rawModule.namespaced845};846Module.prototype.addChild = function addChild (key, module) {847 this._children[key] = module;848};849Module.prototype.removeChild = function removeChild (key) {850 delete this._children[key];851};852Module.prototype.getChild = function getChild (key) {853 return this._children[key]854};855Module.prototype.hasChild = function hasChild (key) {856 return key in this._children857};858Module.prototype.update = function update (rawModule) {859 this._rawModule.namespaced = rawModule.namespaced;860 if (rawModule.actions) {861 this._rawModule.actions = rawModule.actions;862 }863 if (rawModule.mutations) {864 this._rawModule.mutations = rawModule.mutations;865 }866 if (rawModule.getters) {867 this._rawModule.getters = rawModule.getters;868 }869};870Module.prototype.forEachChild = function forEachChild (fn) {871 forEachValue(this._children, fn);872};873Module.prototype.forEachGetter = function forEachGetter (fn) {874 if (this._rawModule.getters) {875 forEachValue(this._rawModule.getters, fn);876 }877};878Module.prototype.forEachAction = function forEachAction (fn) {879 if (this._rawModule.actions) {880 forEachValue(this._rawModule.actions, fn);881 }882};883Module.prototype.forEachMutation = function forEachMutation (fn) {884 if (this._rawModule.mutations) {885 forEachValue(this._rawModule.mutations, fn);886 }887};888Object.defineProperties( Module.prototype, prototypeAccessors$1 );889var ModuleCollection = function ModuleCollection (rawRootModule) {890 // register root module (Vuex.Store options)891 this.register([], rawRootModule, false);892};893ModuleCollection.prototype.get = function get (path) {894 return path.reduce(function (module, key) {895 return module.getChild(key)896 }, this.root)897};898ModuleCollection.prototype.getNamespace = function getNamespace (path) {899 var module = this.root;900 return path.reduce(function (namespace, key) {901 module = module.getChild(key);902 return namespace + (module.namespaced ? key + '/' : '')903 }, '')904};905ModuleCollection.prototype.update = function update$1 (rawRootModule) {906 update([], this.root, rawRootModule);907};908ModuleCollection.prototype.register = function register (path, rawModule, runtime) {909 var this$1$1 = this;910 if ( runtime === void 0 ) runtime = true;911 var newModule = new Module(rawModule, runtime);912 if (path.length === 0) {913 this.root = newModule;914 } else {915 var parent = this.get(path.slice(0, -1));916 parent.addChild(path[path.length - 1], newModule);917 }918 // register nested modules919 if (rawModule.modules) {920 forEachValue(rawModule.modules, function (rawChildModule, key) {921 this$1$1.register(path.concat(key), rawChildModule, runtime);922 });923 }924};925ModuleCollection.prototype.unregister = function unregister (path) {926 var parent = this.get(path.slice(0, -1));927 var key = path[path.length - 1];928 var child = parent.getChild(key);929 if (!child) {930 return931 }932 if (!child.runtime) {933 return934 }935 parent.removeChild(key);936};937ModuleCollection.prototype.isRegistered = function isRegistered (path) {938 var parent = this.get(path.slice(0, -1));939 var key = path[path.length - 1];940 if (parent) {941 return parent.hasChild(key)942 }943 return false944};945function update (path, targetModule, newModule) {946 // update target module947 targetModule.update(newModule);948 // update nested modules949 if (newModule.modules) {950 for (var key in newModule.modules) {951 if (!targetModule.getChild(key)) {952 return953 }954 update(955 path.concat(key),956 targetModule.getChild(key),957 newModule.modules[key]958 );959 }960 }961}962function createStore (options) {963 return new Store(options)964}965var Store = function Store (options) {966 var this$1$1 = this;967 if ( options === void 0 ) options = {};968 var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];969 var strict = options.strict; if ( strict === void 0 ) strict = false;970 var devtools = options.devtools;971 // store internal state972 this._committing = false;973 this._actions = Object.create(null);974 this._actionSubscribers = [];975 this._mutations = Object.create(null);976 this._wrappedGetters = Object.create(null);977 this._modules = new ModuleCollection(options);978 this._modulesNamespaceMap = Object.create(null);979 this._subscribers = [];980 this._makeLocalGettersCache = Object.create(null);981 this._devtools = devtools;982 // bind commit and dispatch to self983 var store = this;984 var ref = this;985 var dispatch = ref.dispatch;986 var commit = ref.commit;987 this.dispatch = function boundDispatch (type, payload) {988 return dispatch.call(store, type, payload)989 };990 this.commit = function boundCommit (type, payload, options) {991 return commit.call(store, type, payload, options)992 };993 // strict mode994 this.strict = strict;995 var state = this._modules.root.state;996 // init root module.997 // this also recursively registers all sub-modules998 // and collects all module getters inside this._wrappedGetters999 installModule(this, state, [], this._modules.root);1000 // initialize the store state, which is responsible for the reactivity1001 // (also registers _wrappedGetters as computed properties)1002 resetStoreState(this, state);1003 // apply plugins1004 plugins.forEach(function (plugin) { return plugin(this$1$1); });1005};1006var prototypeAccessors = { state: { configurable: true } };1007Store.prototype.install = function install (app, injectKey) {1008 app.provide(injectKey || storeKey, this);1009 app.config.globalProperties.$store = this;1010 var useDevtools = this._devtools !== undefined1011 ? this._devtools1012 : false;1013 if (useDevtools) {1014 addDevtools(app, this);1015 }1016};1017prototypeAccessors.state.get = function () {1018 return this._state.data1019};1020prototypeAccessors.state.set = function (v) {1021};1022Store.prototype.commit = function commit (_type, _payload, _options) {1023 var this$1$1 = this;1024 // check object-style commit1025 var ref = unifyObjectStyle(_type, _payload, _options);1026 var type = ref.type;1027 var payload = ref.payload;1028 var mutation = { type: type, payload: payload };1029 var entry = this._mutations[type];1030 if (!entry) {1031 return1032 }1033 this._withCommit(function () {1034 entry.forEach(function commitIterator (handler) {1035 handler(payload);1036 });1037 });1038 this._subscribers1039 .slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe1040 .forEach(function (sub) { return sub(mutation, this$1$1.state); });1041};1042Store.prototype.dispatch = function dispatch (_type, _payload) {1043 var this$1$1 = this;1044 // check object-style dispatch1045 var ref = unifyObjectStyle(_type, _payload);1046 var type = ref.type;1047 var payload = ref.payload;1048 var action = { type: type, payload: payload };1049 var entry = this._actions[type];1050 if (!entry) {1051 return1052 }1053 try {1054 this._actionSubscribers1055 .slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe1056 .filter(function (sub) { return sub.before; })1057 .forEach(function (sub) { return sub.before(action, this$1$1.state); });1058 } catch (e) {1059 }1060 var result = entry.length > 11061 ? Promise.all(entry.map(function (handler) { return handler(payload); }))1062 : entry[0](payload);1063 return new Promise(function (resolve, reject) {1064 result.then(function (res) {1065 try {1066 this$1$1._actionSubscribers1067 .filter(function (sub) { return sub.after; })1068 .forEach(function (sub) { return sub.after(action, this$1$1.state); });1069 } catch (e) {1070 }1071 resolve(res);1072 }, function (error) {1073 try {1074 this$1$1._actionSubscribers1075 .filter(function (sub) { return sub.error; })1076 .forEach(function (sub) { return sub.error(action, this$1$1.state, error); });1077 } catch (e) {1078 }1079 reject(error);1080 });1081 })1082};1083Store.prototype.subscribe = function subscribe (fn, options) {1084 return genericSubscribe(fn, this._subscribers, options)1085};1086Store.prototype.subscribeAction = function subscribeAction (fn, options) {1087 var subs = typeof fn === 'function' ? { before: fn } : fn;1088 return genericSubscribe(subs, this._actionSubscribers, options)1089};1090Store.prototype.watch = function watch$1 (getter, cb, options) {1091 var this$1$1 = this;1092 return vue_runtime_esmBundler.watch(function () { return getter(this$1$1.state, this$1$1.getters); }, cb, Object.assign({}, options))1093};1094Store.prototype.replaceState = function replaceState (state) {1095 var this$1$1 = this;1096 this._withCommit(function () {1097 this$1$1._state.data = state;1098 });1099};1100Store.prototype.registerModule = function registerModule (path, rawModule, options) {1101 if ( options === void 0 ) options = {};1102 if (typeof path === 'string') { path = [path]; }1103 this._modules.register(path, rawModule);1104 installModule(this, this.state, path, this._modules.get(path), options.preserveState);1105 // reset store to update getters...1106 resetStoreState(this, this.state);1107};1108Store.prototype.unregisterModule = function unregisterModule (path) {1109 var this$1$1 = this;1110 if (typeof path === 'string') { path = [path]; }1111 this._modules.unregister(path);1112 this._withCommit(function () {1113 var parentState = getNestedState(this$1$1.state, path.slice(0, -1));1114 delete parentState[path[path.length - 1]];1115 });1116 resetStore(this);1117};1118Store.prototype.hasModule = function hasModule (path) {1119 if (typeof path === 'string') { path = [path]; }1120 return this._modules.isRegistered(path)1121};1122Store.prototype.hotUpdate = function hotUpdate (newOptions) {1123 this._modules.update(newOptions);1124 resetStore(this, true);1125};1126Store.prototype._withCommit = function _withCommit (fn) {1127 var committing = this._committing;1128 this._committing = true;1129 fn();1130 this._committing = committing;1131};1132Object.defineProperties( Store.prototype, prototypeAccessors );1133/**1134 * Reduce the code which written in Vue.js for getting the state.1135 * @param {String} [namespace] - Module's namespace1136 * @param {Object|Array} states # Object's item can be a function which accept state and getters for param, you can do something for state and getters in it.1137 * @param {Object}1138 */1139var mapState = normalizeNamespace(function (namespace, states) {1140 var res = {};1141 normalizeMap(states).forEach(function (ref) {1142 var key = ref.key;1143 var val = ref.val;1144 res[key] = function mappedState () {1145 var state = this.$store.state;1146 var getters = this.$store.getters;1147 if (namespace) {1148 var module = getModuleByNamespace(this.$store, 'mapState', namespace);1149 if (!module) {1150 return1151 }1152 state = module.context.state;1153 getters = module.context.getters;1154 }1155 return typeof val === 'function'1156 ? val.call(this, state, getters)1157 : state[val]1158 };1159 // mark vuex getter for devtools1160 res[key].vuex = true;1161 });1162 return res1163});1164/**1165 * Reduce the code which written in Vue.js for committing the mutation1166 * @param {String} [namespace] - Module's namespace1167 * @param {Object|Array} mutations # Object's item can be a function which accept `commit` function as the first param, it can accept another params. You can commit mutation and do any other things in this function. specially, You need to pass anthor params from the mapped function.1168 * @return {Object}1169 */1170var mapMutations = normalizeNamespace(function (namespace, mutations) {1171 var res = {};1172 normalizeMap(mutations).forEach(function (ref) {1173 var key = ref.key;1174 var val = ref.val;1175 res[key] = function mappedMutation () {1176 var args = [], len = arguments.length;1177 while ( len-- ) args[ len ] = arguments[ len ];1178 // Get the commit method from store1179 var commit = this.$store.commit;1180 if (namespace) {1181 var module = getModuleByNamespace(this.$store, 'mapMutations', namespace);1182 if (!module) {1183 return1184 }1185 commit = module.context.commit;1186 }1187 return typeof val === 'function'1188 ? val.apply(this, [commit].concat(args))1189 : commit.apply(this.$store, [val].concat(args))1190 };1191 });1192 return res1193});1194/**1195 * Reduce the code which written in Vue.js for getting the getters1196 * @param {String} [namespace] - Module's namespace1197 * @param {Object|Array} getters1198 * @return {Object}1199 */1200var mapGetters = normalizeNamespace(function (namespace, getters) {1201 var res = {};1202 normalizeMap(getters).forEach(function (ref) {1203 var key = ref.key;1204 var val = ref.val;1205 // The namespace has been mutated by normalizeNamespace1206 val = namespace + val;1207 res[key] = function mappedGetter () {1208 if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) {1209 return1210 }1211 return this.$store.getters[val]1212 };1213 // mark vuex getter for devtools1214 res[key].vuex = true;1215 });1216 return res1217});1218/**1219 * Reduce the code which written in Vue.js for dispatch the action1220 * @param {String} [namespace] - Module's namespace1221 * @param {Object|Array} actions # Object's item can be a function which accept `dispatch` function as the first param, it can accept anthor params. You can dispatch action and do any other things in this function. specially, You need to pass anthor params from the mapped function.1222 * @return {Object}1223 */1224var mapActions = normalizeNamespace(function (namespace, actions) {1225 var res = {};1226 normalizeMap(actions).forEach(function (ref) {1227 var key = ref.key;1228 var val = ref.val;1229 res[key] = function mappedAction () {1230 var args = [], len = arguments.length;1231 while ( len-- ) args[ len ] = arguments[ len ];1232 // get dispatch function from store1233 var dispatch = this.$store.dispatch;1234 if (namespace) {1235 var module = getModuleByNamespace(this.$store, 'mapActions', namespace);1236 if (!module) {1237 return1238 }1239 dispatch = module.context.dispatch;1240 }1241 return typeof val === 'function'1242 ? val.apply(this, [dispatch].concat(args))1243 : dispatch.apply(this.$store, [val].concat(args))1244 };1245 });1246 return res1247});1248/**1249 * Rebinding namespace param for mapXXX function in special scoped, and return them by simple object1250 * @param {String} namespace1251 * @return {Object}1252 */1253var createNamespacedHelpers = function (namespace) { return ({1254 mapState: mapState.bind(null, namespace),1255 mapGetters: mapGetters.bind(null, namespace),1256 mapMutations: mapMutations.bind(null, namespace),1257 mapActions: mapActions.bind(null, namespace)1258}); };1259/**1260 * Normalize the map1261 * normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ]1262 * normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ]1263 * @param {Array|Object} map1264 * @return {Object}1265 */1266function normalizeMap (map) {1267 if (!isValidMap(map)) {1268 return []1269 }1270 return Array.isArray(map)1271 ? map.map(function (key) { return ({ key: key, val: key }); })1272 : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); })1273}1274/**1275 * Validate whether given map is valid or not1276 * @param {*} map1277 * @return {Boolean}1278 */1279function isValidMap (map) {1280 return Array.isArray(map) || isObject(map)1281}1282/**1283 * Return a function expect two param contains namespace and map. it will normalize the namespace and then the param's function will handle the new namespace and the map.1284 * @param {Function} fn1285 * @return {Function}1286 */1287function normalizeNamespace (fn) {1288 return function (namespace, map) {1289 if (typeof namespace !== 'string') {1290 map = namespace;1291 namespace = '';1292 } else if (namespace.charAt(namespace.length - 1) !== '/') {1293 namespace += '/';1294 }1295 return fn(namespace, map)1296 }1297}1298/**1299 * Search a special module from store by namespace. if module not exist, print error message.1300 * @param {Object} store1301 * @param {String} helper1302 * @param {String} namespace1303 * @return {Object}1304 */1305function getModuleByNamespace (store, helper, namespace) {1306 var module = store._modulesNamespaceMap[namespace];1307 return module1308}1309// Credits: borrowed code from fcomb/redux-logger1310function createLogger (ref) {1311 if ( ref === void 0 ) ref = {};1312 var collapsed = ref.collapsed; if ( collapsed === void 0 ) collapsed = true;1313 var filter = ref.filter; if ( filter === void 0 ) filter = function (mutation, stateBefore, stateAfter) { return true; };1314 var transformer = ref.transformer; if ( transformer === void 0 ) transformer = function (state) { return state; };1315 var mutationTransformer = ref.mutationTransformer; if ( mutationTransformer === void 0 ) mutationTransformer = function (mut) { return mut; };1316 var actionFilter = ref.actionFilter; if ( actionFilter === void 0 ) actionFilter = function (action, state) { return true; };1317 var actionTransformer = ref.actionTransformer; if ( actionTransformer === void 0 ) actionTransformer = function (act) { return act; };1318 var logMutations = ref.logMutations; if ( logMutations === void 0 ) logMutations = true;1319 var logActions = ref.logActions; if ( logActions === void 0 ) logActions = true;1320 var logger = ref.logger; if ( logger === void 0 ) logger = console;1321 return function (store) {1322 var prevState = deepCopy(store.state);1323 if (typeof logger === 'undefined') {1324 return1325 }1326 if (logMutations) {1327 store.subscribe(function (mutation, state) {1328 var nextState = deepCopy(state);1329 if (filter(mutation, prevState, nextState)) {1330 var formattedTime = getFormattedTime();1331 var formattedMutation = mutationTransformer(mutation);1332 var message = "mutation " + (mutation.type) + formattedTime;1333 startMessage(logger, message, collapsed);1334 logger.log('%c prev state', 'color: #9E9E9E; font-weight: bold', transformer(prevState));1335 logger.log('%c mutation', 'color: #03A9F4; font-weight: bold', formattedMutation);1336 logger.log('%c next state', 'color: #4CAF50; font-weight: bold', transformer(nextState));1337 endMessage(logger);1338 }1339 prevState = nextState;1340 });1341 }1342 if (logActions) {1343 store.subscribeAction(function (action, state) {1344 if (actionFilter(action, state)) {1345 var formattedTime = getFormattedTime();1346 var formattedAction = actionTransformer(action);1347 var message = "action " + (action.type) + formattedTime;1348 startMessage(logger, message, collapsed);1349 logger.log('%c action', 'color: #03A9F4; font-weight: bold', formattedAction);1350 endMessage(logger);1351 }1352 });1353 }1354 }1355}1356function startMessage (logger, message, collapsed) {1357 var startMessage = collapsed1358 ? logger.groupCollapsed1359 : logger.group;1360 // render1361 try {1362 startMessage.call(logger, message);1363 } catch (e) {1364 logger.log(message);1365 }1366}1367function endMessage (logger) {1368 try {1369 logger.groupEnd();1370 } catch (e) {1371 logger.log('—— log end ——');1372 }1373}1374function getFormattedTime () {1375 var time = new Date();1376 return (" @ " + (pad(time.getHours(), 2)) + ":" + (pad(time.getMinutes(), 2)) + ":" + (pad(time.getSeconds(), 2)) + "." + (pad(time.getMilliseconds(), 3)))1377}1378function repeat (str, times) {1379 return (new Array(times + 1)).join(str)1380}1381function pad (num, maxLength) {1382 return repeat('0', maxLength - num.toString().length) + num1383}1384var index_cjs = {1385 version: '4.0.2',1386 Store: Store,1387 storeKey: storeKey,1388 createStore: createStore,1389 useStore: useStore,1390 mapState: mapState,1391 mapMutations: mapMutations,1392 mapGetters: mapGetters,1393 mapActions: mapActions,1394 createNamespacedHelpers: createNamespacedHelpers,1395 createLogger: createLogger1396};1397var vuex_cjs = index_cjs;1398const {1399 version,1400 Store: Store$1,1401 storeKey: storeKey$1,1402 createStore: createStore$1,1403 install,1404 useStore: useStore$1,1405 mapState: mapState$1,1406 mapMutations: mapMutations$1,1407 mapGetters: mapGetters$1,1408 mapActions: mapActions$1,1409 createNamespacedHelpers: createNamespacedHelpers$1,1410 createLogger: createLogger$11411} = vuex_cjs;...

Full Screen

Full Screen

note-generate-code.js

Source:note-generate-code.js Github

copy

Full Screen

1const FRAGMENT = Symbol( `Fragment` );2const TELEPORT = Symbol( `Teleport` );3const SUSPENSE = Symbol( `Suspense` );4const KEEP_ALIVE = Symbol( `KeepAlive` );5const BASE_TRANSITION = Symbol( `BaseTransition` );6const OPEN_BLOCK = Symbol( `openBlock` );7const CREATE_BLOCK = Symbol( `createBlock` );8const CREATE_VNODE = Symbol( `createVNode` );9const CREATE_COMMENT = Symbol( `createCommentVNode` );10const CREATE_TEXT = Symbol( `createTextVNode` );11const CREATE_STATIC = Symbol( `createStaticVNode` );12const RESOLVE_COMPONENT = Symbol( `resolveComponent` );13const RESOLVE_DYNAMIC_COMPONENT = Symbol( `resolveDynamicComponent` );14const RESOLVE_DIRECTIVE = Symbol( `resolveDirective` );15const WITH_DIRECTIVES = Symbol( `withDirectives` );16const RENDER_LIST = Symbol( `renderList` );17const RENDER_SLOT = Symbol( `renderSlot` );18const CREATE_SLOTS = Symbol( `createSlots` );19const TO_DISPLAY_STRING = Symbol( `toDisplayString` );20const MERGE_PROPS = Symbol( `mergeProps` );21const TO_HANDLERS = Symbol( `toHandlers` );22const CAMELIZE = Symbol( `camelize` );23const CAPITALIZE = Symbol( `capitalize` );24const SET_BLOCK_TRACKING = Symbol( `setBlockTracking` );25const PUSH_SCOPE_ID = Symbol( `pushScopeId` );26const POP_SCOPE_ID = Symbol( `popScopeId` );27const WITH_SCOPE_ID = Symbol( `withScopeId` );28const WITH_CTX = Symbol( `withCtx` );29const helperNameMap = {30 [FRAGMENT]: `Fragment`,31 [TELEPORT]: `Teleport`,32 [SUSPENSE]: `Suspense`,33 [KEEP_ALIVE]: `KeepAlive`,34 [BASE_TRANSITION]: `BaseTransition`,35 [OPEN_BLOCK]: `openBlock`,36 [CREATE_BLOCK]: `createBlock`,37 [CREATE_VNODE]: `_createVNode`,38 [CREATE_COMMENT]: `createCommentVNode`,39 [CREATE_TEXT]: `createTextVNode`,40 [CREATE_STATIC]: `createStaticVNode`,41 [RESOLVE_COMPONENT]: `resolveComponent`,42 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,43 [RESOLVE_DIRECTIVE]: `resolveDirective`,44 [WITH_DIRECTIVES]: `withDirectives`,45 [RENDER_LIST]: `renderList`,46 [RENDER_SLOT]: `renderSlot`,47 [CREATE_SLOTS]: `createSlots`,48 [TO_DISPLAY_STRING]: `toDisplayString`,49 [MERGE_PROPS]: `mergeProps`,50 [TO_HANDLERS]: `toHandlers`,51 [CAMELIZE]: `camelize`,52 [CAPITALIZE]: `capitalize`,53 [SET_BLOCK_TRACKING]: `setBlockTracking`,54 [PUSH_SCOPE_ID]: `pushScopeId`,55 [POP_SCOPE_ID]: `popScopeId`,56 [WITH_SCOPE_ID]: `withScopeId`,57 [WITH_CTX]: `withCtx`58};59const vnode = {60 __v_isVNode: true,61 ["__v_skip" /* SKIP */]: true,62 type,63 props,64 key: props && normalizeKey(props),65 ref: props && normalizeRef(props),66 scopeId: currentScopeId,67 children: null,68 component: null,69 suspense: null,70 ssContent: null,71 ssFallback: null,72 dirs: null,73 transition: null,74 el: null,75 anchor: null,76 target: null,77 targetAnchor: null,78 staticCount: 0,79 shapeFlag,80 patchFlag,81 dynamicProps,82 dynamicChildren: null,83 appContext: null84};85/*86* vnode shapeFlag: 87* 基本部分:0;1 ELEMENT; 2 FUNCTIONAL_COMPONENT; 4 STATEFUL_COMPONENT; 64 TELEPORT; 128 SUSPENSE88* 附加部分:0; 8 parent not TELEPORT,children is string; 16 children is array or string and parent not teleport; 32 SLOTS_CHILDREN (chidlren is object && paren not (ELEMENT|TELEPORT)), children is function89*90*/91const shapeFlag = isString(type)92? 1 /* ELEMENT */93: isSuspense(type)94 ? 128 /* SUSPENSE */95 : isTeleport(type)96 ? 64 /* TELEPORT */97 : isObject(type)98 ? 4 /* STATEFUL_COMPONENT */99 : isFunction(type)100 ? 2 /* FUNCTIONAL_COMPONENT */101 : 0;102function baseCompile(template, options = {}) {103 const onError = options.onError || defaultOnError;104 const isModuleMode = options.mode === 'module';105 /* istanbul ignore if */106 {107 if (options.prefixIdentifiers === true) {108 onError(createCompilerError(45 /* X_PREFIX_ID_NOT_SUPPORTED */));109 }110 else if (isModuleMode) {111 onError(createCompilerError(46 /* X_MODULE_MODE_NOT_SUPPORTED */));112 }113 }114 const prefixIdentifiers = !true ;115 if ( options.cacheHandlers) {116 onError(createCompilerError(47 /* X_CACHE_HANDLER_NOT_SUPPORTED */));117 }118 if (options.scopeId && !isModuleMode) {119 onError(createCompilerError(48 /* X_SCOPE_ID_NOT_SUPPORTED */));120 }121 const ast = isString(template) ? baseParse(template, options) : template;122 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();123 transform(ast, extend({}, options, {124 prefixIdentifiers,125 nodeTransforms: [126 ...nodeTransforms,127 ...(options.nodeTransforms || []) // user transforms128 ],129 directiveTransforms: extend({}, directiveTransforms, options.directiveTransforms || {} // user transforms130 )131 }));132 return generate(ast, extend({}, options, {133 prefixIdentifiers134 }));135}136function generate(ast, options = {}) {137 const context = createCodegenContext(ast, options);138 if (options.onContextCreated)139 options.onContextCreated(context);140 // 默认:mode = 'function'141 // prefixIdentifiers = mode === 'module'142 const { mode, push, prefixIdentifiers, indent, deindent, newline, scopeId, ssr } = context;143 const hasHelpers = ast.helpers.length > 0;144 const useWithBlock = !prefixIdentifiers && mode !== 'module';145 // preambles146 {147 genFunctionPreamble(ast, context);148 }149 // binding optimizations150 const optimizeSources = options.bindingMetadata151 ? `, $props, $setup, $data, $options`152 : ``;153 // enter render function154 // 1. 普通155 // function render(_ctx, _cache, $props, $setup, $data, $options){。。。}156 if (!ssr) {157 push(`function render(_ctx, _cache${optimizeSources}) {`);158 }159 // 2. ssr160 // function ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options){。。。}161 else {162 push(`function ssrRender(_ctx, _push, _parent, _attrs${optimizeSources}) {`);163 }164 indent();165 // 默认:mode = 'function'166 if (useWithBlock) {167 push(`with (_ctx) {`);168 indent();169 // function mode const declarations should be inside with block170 // also they should be renamed to avoid collision with user properties171 if (hasHelpers) {172 push(`const { ${ast.helpers173 .map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)174 .join(', ')} } = _Vue`);175 push(`\n`);176 newline();177 }178 }179 // generate asset resolution statements180 if (ast.components.length) {181 genAssets(ast.components, 'component', context);182 if (ast.directives.length || ast.temps > 0) {183 newline();184 }185 }186 if (ast.directives.length) {187 genAssets(ast.directives, 'directive', context);188 if (ast.temps > 0) {189 newline();190 }191 }192 if (ast.temps > 0) {193 push(`let `);194 for (let i = 0; i < ast.temps; i++) {195 push(`${i > 0 ? `, ` : ``}_temp${i}`);196 }197 }198 if (ast.components.length || ast.directives.length || ast.temps) {199 push(`\n`);200 newline();201 }202 // generate the VNode tree expression203 if (!ssr) {204 push(`return `);205 }206 if (ast.codegenNode) {207 genNode(ast.codegenNode, context);208 }209 else {210 push(`null`);211 }212 if (useWithBlock) {213 deindent();214 push(`}`);215 }216 deindent();217 push(`}`);218 return {219 ast,220 code: context.code,221 // SourceMapGenerator does have toJSON() method but it's not in the types222 map: context.map ? context.map.toJSON() : undefined223 };224}225 const PURE_ANNOTATION = `/*#__PURE__*/`;226 function createCodegenContext(ast, { 227 mode = 'function', 228 prefixIdentifiers = mode === 'module', 229 sourceMap = false, 230 filename = `template.vue.html`, 231 scopeId = null, 232 optimizeImports = false, 233 runtimeGlobalName = `Vue`, 234 runtimeModuleName = `vue`, 235 ssr = false 236 }) {237 const context = {238 mode,239 prefixIdentifiers,240 sourceMap,241 filename,242 scopeId,243 optimizeImports,244 runtimeGlobalName,245 runtimeModuleName,246 ssr,247 source: ast.loc.source,248 code: ``,249 column: 1,250 line: 1,251 offset: 0,252 indentLevel: 0,253 pure: false,254 map: undefined,255 helper(key) {256 return `_${helperNameMap[key]}`;257 },258 push(code, node) {259 context.code += code;260 },261 indent() {262 newline(++context.indentLevel);263 },264 deindent(withoutNewLine = false) {265 if (withoutNewLine) {266 --context.indentLevel;267 }268 else {269 newline(--context.indentLevel);270 }271 },272 newline() {273 newline(context.indentLevel);274 }275 };276 function newline(n) {277 context.push('\n' + ` `.repeat(n));278 }279 return context;280 }281 function genFunctionPreamble(ast, context) {282 const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName } = context;283 const VueBinding = runtimeGlobalName;284 const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;285 // Generate const declaration for helpers286 // In prefix mode, we place the const declaration at top so it's done287 // only once; But if we not prefixing, we place the declaration inside the288 // with block so it doesn't incur the `in` check cost for every helper access.289 if (ast.helpers.length > 0) {290 {291 // "with" mode.292 // save Vue in a separate variable to avoid collision293 push(`const _Vue = ${VueBinding}\n`);294 // in "with" mode, helpers are declared inside the with block to avoid295 // has check cost, but hoists are lifted out of the function - we need296 // to provide the helper here.297 if (ast.hoists.length) {298 const staticHelpers = [299 CREATE_VNODE,300 CREATE_COMMENT,301 CREATE_TEXT,302 CREATE_STATIC303 ]304 .filter(helper => ast.helpers.includes(helper))305 .map(aliasHelper)306 .join(', ');307 push(`const { ${staticHelpers} } = _Vue\n`);308 }309 }310 }311 genHoists(ast.hoists, context);312 newline();313 push(`return `);314 }315 function genAssets(assets, type, { helper, push, newline }) {316 const resolver = helper(type === 'component' ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE);317 for (let i = 0; i < assets.length; i++) {318 const id = assets[i];319 push(`const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)})`);320 if (i < assets.length - 1) {321 newline();322 }323 }324 }325 function genNode(node, context) {326 if (isString(node)) {327 context.push(node);328 return;329 }330 if (isSymbol(node)) {331 context.push(context.helper(node));332 return;333 }334 switch (node.type) {335 case 1 /* ELEMENT */:336 case 9 /* IF */:337 case 11 /* FOR */:338 339 assert(node.codegenNode != null, `Codegen node is missing for element/if/for node. ` +340 `Apply appropriate transforms first.`);341 genNode(node.codegenNode, context);342 break;343 case 2 /* TEXT */:344 genText(node, context);345 break;346 case 4 /* SIMPLE_EXPRESSION */:347 genExpression(node, context);348 break;349 case 5 /* INTERPOLATION */:350 genInterpolation(node, context);351 break;352 case 12 /* TEXT_CALL */:353 genNode(node.codegenNode, context);354 break;355 case 8 /* COMPOUND_EXPRESSION */:356 genCompoundExpression(node, context);357 break;358 case 3 /* COMMENT */:359 genComment(node, context);360 break;361 /**362 * 363 * 1.root, children > 1; 364 * 2. children.length !== 1 || firstChild.type !== 1 ELEMENT && (children.length !== 1 || firstChild.type !== 11 fornode )365 * 3.fornode366 * 4.postTransformElement367 */368 case 13 /* VNODE_CALL */:369 genVNodeCall(node, context);370 break;371 case 14 /* JS_CALL_EXPRESSION */:372 genCallExpression(node, context);373 break;374 case 15 /* JS_OBJECT_EXPRESSION */:375 genObjectExpression(node, context);376 break;377 case 17 /* JS_ARRAY_EXPRESSION */:378 genArrayExpression(node, context);379 break;380 case 18 /* JS_FUNCTION_EXPRESSION */:381 genFunctionExpression(node, context);382 break;383 case 19 /* JS_CONDITIONAL_EXPRESSION */:384 genConditionalExpression(node, context);385 break;386 case 20 /* JS_CACHE_EXPRESSION */:387 genCacheExpression(node, context);388 break;389 // SSR only types390 case 21 /* JS_BLOCK_STATEMENT */:391 break;392 case 22 /* JS_TEMPLATE_LITERAL */:393 break;394 case 23 /* JS_IF_STATEMENT */:395 break;396 case 24 /* JS_ASSIGNMENT_EXPRESSION */:397 break;398 case 25 /* JS_SEQUENCE_EXPRESSION */:399 break;400 case 26 /* JS_RETURN_STATEMENT */:401 break;402 /* istanbul ignore next */403 case 10 /* IF_BRANCH */:404 // noop405 break;406 default:407 {408 assert(false, `unhandled codegen node type: ${node.type}`);409 // make sure we exhaust all possible types410 const exhaustiveCheck = node;411 return exhaustiveCheck;412 }413 }414 }415 function genText(node, context) {416 context.push(JSON.stringify(node.content), node);417 }418 function genExpression(node, context) {419 const { content, isStatic } = node;420 context.push(isStatic ? JSON.stringify(content) : content, node);421 }422 function genInterpolation(node, context) {423 const { push, helper, pure } = context;424 if (pure)425 push(PURE_ANNOTATION);426 push(`${helper(TO_DISPLAY_STRING)}(`);427 genNode(node.content, context);428 push(`)`);429 }430 function genCompoundExpression(node, context) {431 for (let i = 0; i < node.children.length; i++) {432 const child = node.children[i];433 if (isString(child)) {434 context.push(child);435 }436 else {437 genNode(child, context);438 }439 }440 }441 function genExpressionAsPropertyKey(node, context) {442 const { push } = context;443 if (node.type === 8 /* COMPOUND_EXPRESSION */) {444 push(`[`);445 genCompoundExpression(node, context);446 push(`]`);447 }448 else if (node.isStatic) {449 // only quote keys if necessary450 const text = isSimpleIdentifier(node.content)451 ? node.content452 : JSON.stringify(node.content);453 push(text, node);454 }455 else {456 push(`[${node.content}]`, node);457 }458 }459 function genComment(node, context) {460 {461 const { push, helper, pure } = context;462 if (pure) {463 push(PURE_ANNOTATION);464 }465 push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node);466 }467 }468 function genVNodeCall(node, context) {469 const { push, helper, pure } = context;470 const { tag, props, children, patchFlag, dynamicProps, directives, isBlock, disableTracking } = node;471 if (directives) {472 push(helper(WITH_DIRECTIVES) + `(`);473 }474 if (isBlock) {475 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);476 }477 if (pure) {478 push(PURE_ANNOTATION);479 }480 push(helper(isBlock ? CREATE_BLOCK : CREATE_VNODE) + `(`, node);481 genNodeList(genNullableArgs([tag, props, children, patchFlag, dynamicProps]), context);482 push(`)`);483 if (isBlock) {484 push(`)`);485 }486 if (directives) {487 push(`, `);488 genNode(directives, context);489 push(`)`);490 }491 }492 /**493 * Adds directives to a VNode.494 */495 function withDirectives(vnode, directives) {496 const internalInstance = currentRenderingInstance;497 if (internalInstance === null) {498 warn(`withDirectives can only be used inside render functions.`);499 return vnode;500 }501 const instance = internalInstance.proxy;502 const bindings = vnode.dirs || (vnode.dirs = []);503 for (let i = 0; i < directives.length; i++) {504 let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];505 if (isFunction(dir)) {506 dir = {507 mounted: dir,508 updated: dir509 };510 }511 bindings.push({512 dir,513 instance,514 value,515 oldValue: void 0,516 arg,517 modifiers518 });519 }520 return vnode;521 }522 /**523 * Create a block root vnode. Takes the same exact arguments as `createVNode`.524 * A block root keeps track of dynamic nodes within the block in the525 * `dynamicChildren` array.526 *527 * @private528 */529 function createBlock(type, props, children, patchFlag, dynamicProps) {530 const vnode = createVNode(type, props, children, patchFlag, dynamicProps, true /* isBlock: prevent a block from tracking itself */);531 // save current block children on the block vnode532 vnode.dynamicChildren = currentBlock || EMPTY_ARR;533 // close block534 closeBlock();535 // a block is always going to be patched, so track it as a child of its536 // parent block537 if (shouldTrack$1 > 0 && currentBlock) {538 currentBlock.push(vnode);539 }540 return vnode;541 }542 const createVNodeWithArgsTransform = (...args) => {543 return _createVNode(...(vnodeArgsTransformer544 ? vnodeArgsTransformer(args, currentRenderingInstance)545 : args));546 };547 function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {548 if (!type || type === NULL_DYNAMIC_COMPONENT) {549 if ( !type) {550 warn(`Invalid vnode type when creating vnode: ${type}.`);551 }552 type = Comment;553 }554 if (isVNode(type)) {555 // createVNode receiving an existing vnode. This happens in cases like556 // <component :is="vnode"/>557 // #2078 make sure to merge refs during the clone instead of overwriting it558 const cloned = cloneVNode(type, props, true /* mergeRef: true */);559 if (children) {560 normalizeChildren(cloned, children);561 }562 return cloned;563 }564 // class component normalization.565 if (isClassComponent(type)) {566 type = type.__vccOpts;567 }568 // class & style normalization.569 if (props) {570 // for reactive or proxy objects, we need to clone it to enable mutation.571 if (isProxy(props) || InternalObjectKey in props) {572 props = extend({}, props);573 }574 let { class: klass, style } = props;575 if (klass && !isString(klass)) {576 props.class = normalizeClass(klass);577 }578 if (isObject(style)) {579 // reactive state objects need to be cloned since they are likely to be580 // mutated581 if (isProxy(style) && !isArray(style)) {582 style = extend({}, style);583 }584 props.style = normalizeStyle(style);585 }586 }587 // encode the vnode type information into a bitmap588 const shapeFlag = isString(type)589 ? 1 /* ELEMENT */590 : isSuspense(type)591 ? 128 /* SUSPENSE */592 : isTeleport(type)593 ? 64 /* TELEPORT */594 : isObject(type)595 ? 4 /* STATEFUL_COMPONENT */596 : isFunction(type)597 ? 2 /* FUNCTIONAL_COMPONENT */598 : 0;599 if ( shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {600 type = toRaw(type);601 warn(`Vue received a Component which was made a reactive object. This can ` +602 `lead to unnecessary performance overhead, and should be avoided by ` +603 `marking the component with \`markRaw\` or using \`shallowRef\` ` +604 `instead of \`ref\`.`, `\nComponent that was made reactive: `, type);605 }606 const vnode = {607 __v_isVNode: true,608 ["__v_skip" /* SKIP */]: true,609 type,610 props,611 key: props && normalizeKey(props),612 ref: props && normalizeRef(props),613 scopeId: currentScopeId,614 children: null,615 component: null,616 suspense: null,617 ssContent: null,618 ssFallback: null,619 dirs: null,620 transition: null,621 el: null,622 anchor: null,623 target: null,624 targetAnchor: null,625 staticCount: 0,626 shapeFlag,627 patchFlag,628 dynamicProps,629 dynamicChildren: null,630 appContext: null631 };632 // validate key633 if ( vnode.key !== vnode.key) {634 warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);635 }636 normalizeChildren(vnode, children);637 // normalize suspense children638 if ( shapeFlag & 128 /* SUSPENSE */) {639 const { content, fallback } = normalizeSuspenseChildren(vnode);640 vnode.ssContent = content;641 vnode.ssFallback = fallback;642 }643 if (shouldTrack$1 > 0 &&644 // avoid a block node from tracking itself645 !isBlockNode &&646 // has current parent block647 currentBlock &&648 // presence of a patch flag indicates this node needs patching on updates.649 // component nodes also should always be patched, because even if the650 // component doesn't need to update, it needs to persist the instance on to651 // the next vnode so that it can be properly unmounted later.652 (patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&653 // the EVENTS flag is only for hydration and if it is the only flag, the654 // vnode should not be considered dynamic due to handler caching.655 patchFlag !== 32 /* HYDRATE_EVENTS */) {656 currentBlock.push(vnode);657 }658 return vnode;659 }660 function normalizeChildren(vnode, children) {661 let type = 0;662 const { shapeFlag } = vnode;663 if (children == null) {664 children = null;665 }666 else if (isArray(children)) {667 type = 16 /* ARRAY_CHILDREN */;668 }669 else if (typeof children === 'object') {670 if (shapeFlag & 1 /* ELEMENT */ || shapeFlag & 64 /* TELEPORT */) {671 // Normalize slot to plain children for plain element and Teleport672 const slot = children.default;673 if (slot) {674 // _c marker is added by withCtx() indicating this is a compiled slot675 slot._c && setCompiledSlotRendering(1);676 normalizeChildren(vnode, slot());677 slot._c && setCompiledSlotRendering(-1);678 }679 return;680 }681 else {682 type = 32 /* SLOTS_CHILDREN */;683 const slotFlag = children._;684 if (!slotFlag && !(InternalObjectKey in children)) {685 children._ctx = currentRenderingInstance;686 }687 else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {688 // a child component receives forwarded slots from the parent.689 // its slot type is determined by its parent's slot type.690 if (currentRenderingInstance.vnode.patchFlag & 1024 /* DYNAMIC_SLOTS */) {691 children._ = 2 /* DYNAMIC */;692 vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;693 }694 else {695 children._ = 1 /* STABLE */;696 }697 }698 }699 }700 else if (isFunction(children)) {701 children = { default: children, _ctx: currentRenderingInstance };702 type = 32 /* SLOTS_CHILDREN */;703 }704 else {705 children = String(children);706 // force teleport children to array so it can be moved around707 if (shapeFlag & 64 /* TELEPORT */) {708 type = 16 /* ARRAY_CHILDREN */;709 children = [createTextVNode(children)];710 }711 else {712 type = 8 /* TEXT_CHILDREN */;713 }714 }715 vnode.children = children;716 vnode.shapeFlag |= type;717 }718 function normalizeSuspenseChildren(vnode) {719 const { shapeFlag, children } = vnode;720 let content;721 let fallback;722 if (shapeFlag & 32 /* SLOTS_CHILDREN */) {723 content = normalizeSuspenseSlot(children.default);724 fallback = normalizeSuspenseSlot(children.fallback);725 }726 else {727 content = normalizeSuspenseSlot(children);728 fallback = normalizeVNode(null);729 }730 return {731 content,732 fallback733 };734 }735 function normalizeVNode(child) {736 if (child == null || typeof child === 'boolean') {737 // empty placeholder738 return createVNode(Comment);739 }740 else if (isArray(child)) {741 // fragment742 return createVNode(Fragment, null, child);743 }744 else if (typeof child === 'object') {745 // already vnode, this should be the most common since compiled templates746 // always produce all-vnode children arrays747 return child.el === null ? child : cloneVNode(child);748 }749 else {750 // strings and numbers751 return createVNode(Text, null, String(child));752 }753 }754 function normalizeSuspenseSlot(s) {755 if (isFunction(s)) {756 s = s();757 }758 if (isArray(s)) {759 const singleChild = filterSingleRoot(s);760 if ( !singleChild) {761 warn(`<Suspense> slots expect a single root node.`);762 }763 s = singleChild;764 }765 return normalizeVNode(s);766 }767 function filterSingleRoot(children) {768 const filtered = children.filter(child => {769 return !(isVNode(child) &&770 child.type === Comment &&771 child.children !== 'v-if');772 });773 return filtered.length === 1 && isVNode(filtered[0]) ? filtered[0] : null;774 }775 function genNodeList(nodes, context, multilines = false, comma = true) {776 const { push, newline } = context;777 for (let i = 0; i < nodes.length; i++) {778 const node = nodes[i];779 if (isString(node)) {780 push(node);781 }782 else if (isArray(node)) {783 genNodeListAsArray(node, context);784 }785 else {786 genNode(node, context);787 }788 if (i < nodes.length - 1) {789 if (multilines) {790 comma && push(',');791 newline();792 }793 else {794 comma && push(', ');795 }796 }797 }798 }799 function genNullableArgs(args) {800 let i = args.length;801 while (i--) {802 if (args[i] != null)803 break;804 }805 return args.slice(0, i + 1).map(arg => arg || `null`);806 }807 // JavaScript808 function genCallExpression(node, context) {809 const { push, helper, pure } = context;810 const callee = isString(node.callee) ? node.callee : helper(node.callee);811 if (pure) {812 push(PURE_ANNOTATION);813 }814 push(callee + `(`, node);815 genNodeList(node.arguments, context);816 push(`)`);817 }818 function genObjectExpression(node, context) {819 const { push, indent, deindent, newline } = context;820 const { properties } = node;821 if (!properties.length) {822 push(`{}`, node);823 return;824 }825 const multilines = properties.length > 1 ||826 (827 properties.some(p => p.value.type !== 4 /* SIMPLE_EXPRESSION */));828 push(multilines ? `{` : `{ `);829 multilines && indent();830 for (let i = 0; i < properties.length; i++) {831 const { key, value } = properties[i];832 // key833 genExpressionAsPropertyKey(key, context);834 push(`: `);835 // value836 genNode(value, context);837 if (i < properties.length - 1) {838 // will only reach this if it's multilines839 push(`,`);840 newline();841 }842 }843 multilines && deindent();844 push(multilines ? `}` : ` }`);845 }846 function genArrayExpression(node, context) {847 genNodeListAsArray(node.elements, context);848 }849 function genNodeListAsArray(nodes, context) {850 const multilines = nodes.length > 3 ||851 ( nodes.some(n => isArray(n) || !isText$1(n)));852 context.push(`[`);853 multilines && context.indent();854 genNodeList(nodes, context, multilines);855 multilines && context.deindent();856 context.push(`]`);857 }858 function genFunctionExpression(node, context) {859 const { push, indent, deindent, scopeId, mode } = context;860 const { params, returns, body, newline, isSlot } = node;861 if (isSlot) {862 push(`_${helperNameMap[WITH_CTX]}(`);863 }864 push(`(`, node);865 if (isArray(params)) {866 genNodeList(params, context);867 }868 else if (params) {869 genNode(params, context);870 }871 push(`) => `);872 if (newline || body) {873 push(`{`);874 indent();875 }876 if (returns) {877 if (newline) {878 push(`return `);879 }880 if (isArray(returns)) {881 genNodeListAsArray(returns, context);882 }883 else {884 genNode(returns, context);885 }886 }887 else if (body) {888 genNode(body, context);889 }890 if (newline || body) {891 deindent();892 push(`}`);893 }894 if ( isSlot) {895 push(`)`);896 }897 }898 function genConditionalExpression(node, context) {899 const { test, consequent, alternate, newline: needNewline } = node;900 const { push, indent, deindent, newline } = context;901 if (test.type === 4 /* SIMPLE_EXPRESSION */) {902 const needsParens = !isSimpleIdentifier(test.content);903 needsParens && push(`(`);904 genExpression(test, context);905 needsParens && push(`)`);906 }907 else {908 push(`(`);909 genNode(test, context);910 push(`)`);911 }912 needNewline && indent();913 context.indentLevel++;914 needNewline || push(` `);915 push(`? `);916 genNode(consequent, context);917 context.indentLevel--;918 needNewline && newline();919 needNewline || push(` `);920 push(`: `);921 const isNested = alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */;922 if (!isNested) {923 context.indentLevel++;924 }925 genNode(alternate, context);926 if (!isNested) {927 context.indentLevel--;928 }929 needNewline && deindent(true /* without newline */);930 }931 function genCacheExpression(node, context) {932 const { push, helper, indent, deindent, newline } = context;933 push(`_cache[${node.index}] || (`);934 if (node.isVNode) {935 indent();936 push(`${helper(SET_BLOCK_TRACKING)}(-1),`);937 newline();938 }939 push(`_cache[${node.index}] = `);940 genNode(node.value, context);941 if (node.isVNode) {942 push(`,`);943 newline();944 push(`${helper(SET_BLOCK_TRACKING)}(1),`);945 newline();946 push(`_cache[${node.index}]`);947 deindent();948 }949 push(`)`);950 }951/**952 * block tracking 机制953 */954// Since v-if and v-for are the two possible ways node structure can dynamically955// change, once we consider v-if branches and each v-for fragment a block, we956// can divide a template into nested blocks, and within each block the node957// structure would be stable. This allows us to skip most children diffing958// and only worry about the dynamic nodes (indicated by patch flags).959const blockStack = [];960let currentBlock = null;961/**962 * Open a block.963 * This must be called before `createBlock`. It cannot be part of `createBlock`964 * because the children of the block are evaluated before `createBlock` itself965 * is called. The generated code typically looks like this:966 *967 * ```js968 * function render() {969 * return (openBlock(),createBlock('div', null, [...]))970 * }971 * ```972 * disableTracking is true when creating a v-for fragment block, since a v-for973 * fragment always diffs its children.974 *975 * @private976 */977function openBlock(disableTracking = false) {978 blockStack.push((currentBlock = disableTracking ? null : []));979}980function closeBlock() {981 blockStack.pop();982 currentBlock = blockStack[blockStack.length - 1] || null;983}984/**985 * Create a block root vnode. Takes the same exact arguments as `createVNode`.986 * A block root keeps track of dynamic nodes within the block in the987 * `dynamicChildren` array.988 *989 * @private990 */991// createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false)992function createBlock(type, props, children, patchFlag, dynamicProps) {993 const vnode = createVNode(type, props, children, patchFlag, dynamicProps, true /* isBlock: prevent a block from tracking itself */);994 // save current block children on the block vnode995 vnode.dynamicChildren = currentBlock || EMPTY_ARR;996 // close block997 closeBlock();998 // a block is always going to be patched, so track it as a child of its999 // parent block1000 if (shouldTrack$1 > 0 && currentBlock) {1001 currentBlock.push(vnode);1002 }1003 return vnode;1004}1005// Whether we should be tracking dynamic child nodes inside a block.1006// Only tracks when this value is > 01007// We are not using a simple boolean because this value may need to be1008// incremented/decremented by nested usage of v-once (see below)1009let shouldTrack$1 = 1;1010/**1011 * Block tracking sometimes needs to be disabled, for example during the1012 * creation of a tree that needs to be cached by v-once. The compiler generates1013 * code like this:1014 *1015 * ``` js1016 * _cache[1] || (1017 * setBlockTracking(-1),1018 * _cache[1] = createVNode(...),1019 * setBlockTracking(1),1020 * _cache[1]1021 * )1022 * ```1023 *1024 * @private1025 */1026function setBlockTracking(value) {1027 shouldTrack$1 += value;1028}1029var runtimeDom = /*#__PURE__*/Object.freeze({1030 __proto__: null,1031 render: render,1032 hydrate: hydrate,1033 createApp: createApp,1034 createSSRApp: createSSRApp,1035 useCssModule: useCssModule,1036 useCssVars: useCssVars,1037 Transition: Transition,1038 TransitionGroup: TransitionGroup,1039 vModelText: vModelText,1040 vModelCheckbox: vModelCheckbox,1041 vModelRadio: vModelRadio,1042 vModelSelect: vModelSelect,1043 vModelDynamic: vModelDynamic,1044 withModifiers: withModifiers,1045 withKeys: withKeys,1046 vShow: vShow,1047 reactive: reactive,1048 ref: ref,1049 readonly: readonly,1050 unref: unref,1051 proxyRefs: proxyRefs,1052 isRef: isRef,1053 toRef: toRef,1054 toRefs: toRefs,1055 isProxy: isProxy,1056 isReactive: isReactive,1057 isReadonly: isReadonly,1058 customRef: customRef,1059 triggerRef: triggerRef,1060 shallowRef: shallowRef,1061 shallowReactive: shallowReactive,1062 shallowReadonly: shallowReadonly,1063 markRaw: markRaw,1064 toRaw: toRaw,1065 computed: computed$1,1066 watch: watch,1067 watchEffect: watchEffect,1068 onBeforeMount: onBeforeMount,1069 onMounted: onMounted,1070 onBeforeUpdate: onBeforeUpdate,1071 onUpdated: onUpdated,1072 onBeforeUnmount: onBeforeUnmount,1073 onUnmounted: onUnmounted,1074 onActivated: onActivated,1075 onDeactivated: onDeactivated,1076 onRenderTracked: onRenderTracked,1077 onRenderTriggered: onRenderTriggered,1078 onErrorCaptured: onErrorCaptured,1079 provide: provide,1080 inject: inject,1081 nextTick: nextTick,1082 defineComponent: defineComponent,1083 defineAsyncComponent: defineAsyncComponent,1084 getCurrentInstance: getCurrentInstance,1085 h: h,1086 createVNode: createVNode,1087 cloneVNode: cloneVNode,1088 mergeProps: mergeProps,1089 isVNode: isVNode,1090 Fragment: Fragment,1091 Text: Text,1092 Comment: Comment,1093 Static: Static,1094 Teleport: Teleport,1095 Suspense: Suspense,1096 KeepAlive: KeepAlive,1097 BaseTransition: BaseTransition,1098 withDirectives: withDirectives,1099 useSSRContext: useSSRContext,1100 ssrContextKey: ssrContextKey,1101 createRenderer: createRenderer,1102 createHydrationRenderer: createHydrationRenderer,1103 queuePostFlushCb: queuePostFlushCb,1104 warn: warn,1105 handleError: handleError,1106 callWithErrorHandling: callWithErrorHandling,1107 callWithAsyncErrorHandling: callWithAsyncErrorHandling,1108 resolveComponent: resolveComponent,1109 resolveDirective: resolveDirective,1110 resolveDynamicComponent: resolveDynamicComponent,1111 registerRuntimeCompiler: registerRuntimeCompiler,1112 useTransitionState: useTransitionState,1113 resolveTransitionHooks: resolveTransitionHooks,1114 setTransitionHooks: setTransitionHooks,1115 getTransitionRawChildren: getTransitionRawChildren,1116 get devtools () { return devtools; },1117 setDevtoolsHook: setDevtoolsHook,1118 withCtx: withCtx,1119 renderList: renderList,1120 toHandlers: toHandlers,1121 renderSlot: renderSlot,1122 createSlots: createSlots,1123 pushScopeId: pushScopeId,1124 popScopeId: popScopeId,1125 withScopeId: withScopeId,1126 openBlock: openBlock,1127 createBlock: createBlock,1128 setBlockTracking: setBlockTracking,1129 createTextVNode: createTextVNode,1130 createCommentVNode: createCommentVNode,1131 createStaticVNode: createStaticVNode,1132 toDisplayString: toDisplayString,1133 camelize: camelize,1134 capitalize: capitalize,1135 transformVNodeArgs: transformVNodeArgs,1136 version: version,1137 ssrUtils: ssrUtils1138 });1139function compileToFunction(template, options) {1140 if (!isString(template)) {1141 if (template.nodeType) {1142 template = template.innerHTML;1143 }1144 else {1145 warn(`invalid template option: `, template);1146 return NOOP;1147 }1148 }1149 const key = template;1150 const cached = compileCache[key];1151 if (cached) {1152 return cached;1153 }1154 if (template[0] === '#') {1155 const el = document.querySelector(template);1156 if ( !el) {1157 warn(`Template element not found or is empty: ${template}`);1158 }1159 // __UNSAFE__1160 // Reason: potential execution of JS expressions in in-DOM template.1161 // The user must make sure the in-DOM template is trusted. If it's rendered1162 // by the server, the template should not contain any user data.1163 template = el ? el.innerHTML : ``;1164 }1165 const { code } = compile$1(template, extend({1166 hoistStatic: true,1167 onError(err) {1168 {1169 const message = `Template compilation error: ${err.message}`;1170 const codeFrame = err.loc &&1171 generateCodeFrame(template, err.loc.start.offset, err.loc.end.offset);1172 warn(codeFrame ? `${message}\n${codeFrame}` : message);1173 }1174 }1175 }, options));1176 // The wildcard import results in a huge object with every export1177 // with keys that cannot be mangled, and can be quite heavy size-wise.1178 // In the global build we know `Vue` is available globally so we can avoid1179 // the wildcard object.1180 const render = ( new Function('Vue', code)(runtimeDom));1181 render._rc = true;1182 return (compileCache[key] = render);...

Full Screen

Full Screen

runtime-dom.esm-bundler.js

Source:runtime-dom.esm-bundler.js Github

copy

Full Screen

...1068}1069function ensureHydrationRenderer() {1070 renderer = enabledHydration1071 ? renderer1072 : createHydrationRenderer(rendererOptions);1073 enabledHydration = true;1074 return renderer;1075}1076// use explicit type casts here to avoid import() calls in rolled-up d.ts1077const render = ((...args) => {1078 ensureRenderer().render(...args);1079});1080const hydrate = ((...args) => {1081 ensureHydrationRenderer().hydrate(...args);1082});1083const createApp = ((...args) => {1084 const app = ensureRenderer().createApp(...args);1085 if ((process.env.NODE_ENV !== 'production')) {1086 injectNativeTagCheck(app); ...

Full Screen

Full Screen

vendor.js

Source:vendor.js Github

copy

Full Screen

1(self["webpackChunk"] = self["webpackChunk"] || []).push([["/js/vendor"],{2/***/ "./node_modules/vue/dist/vue.esm-bundler.js":3/*!**************************************************!*\4 !*** ./node_modules/vue/dist/vue.esm-bundler.js ***!5 \**************************************************/6/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {7"use strict";8__webpack_require__.r(__webpack_exports__);9/* harmony export */ __webpack_require__.d(__webpack_exports__, {10/* harmony export */ "BaseTransition": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.BaseTransition,11/* harmony export */ "Comment": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.Comment,12/* harmony export */ "Fragment": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.Fragment,13/* harmony export */ "KeepAlive": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.KeepAlive,14/* harmony export */ "Static": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.Static,15/* harmony export */ "Suspense": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.Suspense,16/* harmony export */ "Teleport": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.Teleport,17/* harmony export */ "Text": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.Text,18/* harmony export */ "Transition": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.Transition,19/* harmony export */ "TransitionGroup": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.TransitionGroup,20/* harmony export */ "callWithAsyncErrorHandling": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.callWithAsyncErrorHandling,21/* harmony export */ "callWithErrorHandling": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.callWithErrorHandling,22/* harmony export */ "camelize": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.camelize,23/* harmony export */ "capitalize": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.capitalize,24/* harmony export */ "cloneVNode": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.cloneVNode,25/* harmony export */ "computed": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.computed,26/* harmony export */ "createApp": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.createApp,27/* harmony export */ "createBlock": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.createBlock,28/* harmony export */ "createCommentVNode": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode,29/* harmony export */ "createHydrationRenderer": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.createHydrationRenderer,30/* harmony export */ "createRenderer": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.createRenderer,31/* harmony export */ "createSSRApp": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.createSSRApp,32/* harmony export */ "createSlots": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.createSlots,33/* harmony export */ "createStaticVNode": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.createStaticVNode,34/* harmony export */ "createTextVNode": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.createTextVNode,35/* harmony export */ "createVNode": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.createVNode,36/* harmony export */ "customRef": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.customRef,37/* harmony export */ "defineAsyncComponent": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.defineAsyncComponent,38/* harmony export */ "defineComponent": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.defineComponent,39/* harmony export */ "defineEmit": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.defineEmit,40/* harmony export */ "defineProps": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.defineProps,41/* harmony export */ "devtools": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.devtools,42/* harmony export */ "getCurrentInstance": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.getCurrentInstance,43/* harmony export */ "getTransitionRawChildren": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.getTransitionRawChildren,44/* harmony export */ "h": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.h,45/* harmony export */ "handleError": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.handleError,46/* harmony export */ "hydrate": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.hydrate,47/* harmony export */ "initCustomFormatter": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.initCustomFormatter,48/* harmony export */ "inject": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.inject,49/* harmony export */ "isProxy": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.isProxy,50/* harmony export */ "isReactive": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.isReactive,51/* harmony export */ "isReadonly": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.isReadonly,52/* harmony export */ "isRef": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.isRef,53/* harmony export */ "isVNode": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.isVNode,54/* harmony export */ "markRaw": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.markRaw,55/* harmony export */ "mergeProps": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.mergeProps,56/* harmony export */ "nextTick": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.nextTick,57/* harmony export */ "onActivated": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.onActivated,58/* harmony export */ "onBeforeMount": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.onBeforeMount,59/* harmony export */ "onBeforeUnmount": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.onBeforeUnmount,60/* harmony export */ "onBeforeUpdate": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.onBeforeUpdate,61/* harmony export */ "onDeactivated": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.onDeactivated,62/* harmony export */ "onErrorCaptured": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.onErrorCaptured,63/* harmony export */ "onMounted": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.onMounted,64/* harmony export */ "onRenderTracked": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.onRenderTracked,65/* harmony export */ "onRenderTriggered": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.onRenderTriggered,66/* harmony export */ "onUnmounted": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.onUnmounted,67/* harmony export */ "onUpdated": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.onUpdated,68/* harmony export */ "openBlock": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.openBlock,69/* harmony export */ "popScopeId": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.popScopeId,70/* harmony export */ "provide": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.provide,71/* harmony export */ "proxyRefs": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.proxyRefs,72/* harmony export */ "pushScopeId": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.pushScopeId,73/* harmony export */ "queuePostFlushCb": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.queuePostFlushCb,74/* harmony export */ "reactive": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.reactive,75/* harmony export */ "readonly": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.readonly,76/* harmony export */ "ref": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.ref,77/* harmony export */ "registerRuntimeCompiler": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.registerRuntimeCompiler,78/* harmony export */ "render": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.render,79/* harmony export */ "renderList": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.renderList,80/* harmony export */ "renderSlot": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.renderSlot,81/* harmony export */ "resolveComponent": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.resolveComponent,82/* harmony export */ "resolveDirective": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.resolveDirective,83/* harmony export */ "resolveDynamicComponent": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.resolveDynamicComponent,84/* harmony export */ "resolveTransitionHooks": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.resolveTransitionHooks,85/* harmony export */ "setBlockTracking": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.setBlockTracking,86/* harmony export */ "setDevtoolsHook": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.setDevtoolsHook,87/* harmony export */ "setTransitionHooks": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.setTransitionHooks,88/* harmony export */ "shallowReactive": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.shallowReactive,89/* harmony export */ "shallowReadonly": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.shallowReadonly,90/* harmony export */ "shallowRef": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.shallowRef,91/* harmony export */ "ssrContextKey": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.ssrContextKey,92/* harmony export */ "ssrUtils": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.ssrUtils,93/* harmony export */ "toDisplayString": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.toDisplayString,94/* harmony export */ "toHandlerKey": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.toHandlerKey,95/* harmony export */ "toHandlers": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.toHandlers,96/* harmony export */ "toRaw": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.toRaw,97/* harmony export */ "toRef": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.toRef,98/* harmony export */ "toRefs": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.toRefs,99/* harmony export */ "transformVNodeArgs": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.transformVNodeArgs,100/* harmony export */ "triggerRef": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.triggerRef,101/* harmony export */ "unref": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.unref,102/* harmony export */ "useContext": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.useContext,103/* harmony export */ "useCssModule": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.useCssModule,104/* harmony export */ "useCssVars": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.useCssVars,105/* harmony export */ "useSSRContext": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.useSSRContext,106/* harmony export */ "useTransitionState": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.useTransitionState,107/* harmony export */ "vModelCheckbox": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.vModelCheckbox,108/* harmony export */ "vModelDynamic": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.vModelDynamic,109/* harmony export */ "vModelRadio": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.vModelRadio,110/* harmony export */ "vModelSelect": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.vModelSelect,111/* harmony export */ "vModelText": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.vModelText,112/* harmony export */ "vShow": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.vShow,113/* harmony export */ "version": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.version,114/* harmony export */ "warn": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.warn,115/* harmony export */ "watch": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.watch,116/* harmony export */ "watchEffect": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.watchEffect,117/* harmony export */ "withCtx": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.withCtx,118/* harmony export */ "withDirectives": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.withDirectives,119/* harmony export */ "withKeys": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.withKeys,120/* harmony export */ "withModifiers": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.withModifiers,121/* harmony export */ "withScopeId": () => /* reexport safe */ _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__.withScopeId,122/* harmony export */ "compile": () => /* binding */ compileToFunction123/* harmony export */ });124/* harmony import */ var _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @vue/runtime-dom */ "./node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js");125/* harmony import */ var _vue_runtime_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @vue/runtime-dom */ "./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js");126/* harmony import */ var _vue_shared__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @vue/shared */ "./node_modules/@vue/shared/dist/shared.esm-bundler.js");127/* harmony import */ var _vue_compiler_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @vue/compiler-dom */ "./node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js");128function initDev() {129 const target = (0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.getGlobalThis)();130 target.__VUE__ = true;131 (0,_vue_runtime_dom__WEBPACK_IMPORTED_MODULE_2__.setDevtoolsHook)(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);132 {133 (0,_vue_runtime_dom__WEBPACK_IMPORTED_MODULE_2__.initCustomFormatter)();134 }135}136// This entry is the "full-build" that includes both the runtime137( true) && initDev();138const compileCache = Object.create(null);139function compileToFunction(template, options) {140 if (!(0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.isString)(template)) {141 if (template.nodeType) {142 template = template.innerHTML;143 }144 else {145 ( true) && (0,_vue_runtime_dom__WEBPACK_IMPORTED_MODULE_2__.warn)(`invalid template option: `, template);146 return _vue_shared__WEBPACK_IMPORTED_MODULE_1__.NOOP;147 }148 }149 const key = template;150 const cached = compileCache[key];151 if (cached) {152 return cached;153 }154 if (template[0] === '#') {155 const el = document.querySelector(template);156 if (( true) && !el) {157 (0,_vue_runtime_dom__WEBPACK_IMPORTED_MODULE_2__.warn)(`Template element not found or is empty: ${template}`);158 }159 // __UNSAFE__160 // Reason: potential execution of JS expressions in in-DOM template.161 // The user must make sure the in-DOM template is trusted. If it's rendered162 // by the server, the template should not contain any user data.163 template = el ? el.innerHTML : ``;164 }165 const { code } = (0,_vue_compiler_dom__WEBPACK_IMPORTED_MODULE_3__.compile)(template, (0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.extend)({166 hoistStatic: true,167 onError(err) {168 if ((true)) {169 const message = `Template compilation error: ${err.message}`;170 const codeFrame = err.loc &&171 (0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.generateCodeFrame)(template, err.loc.start.offset, err.loc.end.offset);172 (0,_vue_runtime_dom__WEBPACK_IMPORTED_MODULE_2__.warn)(codeFrame ? `${message}\n${codeFrame}` : message);173 }174 else {}175 }176 }, options));177 // The wildcard import results in a huge object with every export178 // with keys that cannot be mangled, and can be quite heavy size-wise.179 // In the global build we know `Vue` is available globally so we can avoid180 // the wildcard object.181 const render = ( new Function('Vue', code)(_vue_runtime_dom__WEBPACK_IMPORTED_MODULE_0__));182 render._rc = true;183 return (compileCache[key] = render);184}185(0,_vue_runtime_dom__WEBPACK_IMPORTED_MODULE_2__.registerRuntimeCompiler)(compileToFunction);186/***/ })...

Full Screen

Full Screen

vue.esm.re-export.js

Source:vue.esm.re-export.js Github

copy

Full Screen

1import { BaseTransition, Comment, Fragment, KeepAlive, Static, Suspense, 2 Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, 3 callWithErrorHandling, camelize, capitalize, cloneVNode, compile, 4 computed, createApp, createBlock, createCommentVNode, 5 createHydrationRenderer, createRenderer, createSSRApp, createSlots, 6 createStaticVNode, createTextVNode, createVNode, customRef, 7 defineAsyncComponent, defineComponent, defineEmit, defineProps, 8 devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, 9 hydrate, initCustomFormatter, inject, isProxy, isReactive, isReadonly, 10 isRef, isVNode, markRaw, mergeProps, nextTick, onActivated, onBeforeMount, 11 onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, 12 onRenderTracked, onRenderTriggered, onUnmounted, onUpdated, openBlock, 13 popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, 14 readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, 15 resolveComponent, resolveDirective, resolveDynamicComponent, 16 resolveTransitionHooks, setBlockTracking, setDevtoolsHook, 17 setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, 18 ssrContextKey, ssrUtils, toDisplayString, toHandlerKey, toHandlers, 19 toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useContext, 20 useCssModule, useCssVars, useSSRContext, useTransitionState, 21 vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, 22 vShow, version, warn, watch, watchEffect, withCtx, withDirectives, 23 withKeys, withModifiers, withScopeId } 24 from "/node_modules/vue/dist/vue.esm-browser.js";25export { BaseTransition, Comment, Fragment, KeepAlive, Static, Suspense, 26 Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, 27 callWithErrorHandling, camelize, capitalize, cloneVNode, compile, 28 computed, createApp, createBlock, createCommentVNode, 29 createHydrationRenderer, createRenderer, createSSRApp, createSlots, 30 createStaticVNode, createTextVNode, createVNode, customRef, 31 defineAsyncComponent, defineComponent, defineEmit, defineProps, 32 devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, 33 hydrate, initCustomFormatter, inject, isProxy, isReactive, isReadonly, 34 isRef, isVNode, markRaw, mergeProps, nextTick, onActivated, onBeforeMount, 35 onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, 36 onRenderTracked, onRenderTriggered, onUnmounted, onUpdated, openBlock, 37 popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, 38 readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, 39 resolveComponent, resolveDirective, resolveDynamicComponent, 40 resolveTransitionHooks, setBlockTracking, setDevtoolsHook, 41 setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, 42 ssrContextKey, ssrUtils, toDisplayString, toHandlerKey, toHandlers, 43 toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useContext, 44 useCssModule, useCssVars, useSSRContext, useTransitionState, 45 vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, 46 vShow, version, warn, watch, watchEffect, withCtx, withDirectives, ...

Full Screen

Full Screen

vue-v3.js

Source:vue-v3.js Github

copy

Full Screen

1/**2 * @type {import('.').LibMeta}3 */4module.exports = {5 name: 'Vue',6 members: [7 'BaseTransition',8 'Comment',9 'EffectScope',10 'Fragment',11 'KeepAlive',12 'ReactiveEffect',13 'Static',14 'Suspense',15 'Teleport',16 'Text',17 'Transition',18 'TransitionGroup',19 'VueElement',20 'callWithAsyncErrorHandling',21 'callWithErrorHandling',22 'camelize',23 'capitalize',24 'cloneVNode',25 'compatUtils',26 'compile',27 'computed',28 'createApp',29 'createBlock',30 'createCommentVNode',31 'createElementBlock',32 'createElementVNode',33 'createHydrationRenderer',34 'createPropsRestProxy',35 'createRenderer',36 'createSSRApp',37 'createSlots',38 'createStaticVNode',39 'createTextVNode',40 'createVNode',41 'customRef',42 'defineAsyncComponent',43 'defineComponent',44 'defineCustomElement',45 'defineEmits',46 'defineExpose',47 'defineProps',48 'defineSSRCustomElement',49 'effect',50 'effectScope',51 'getCurrentInstance',52 'getCurrentScope',53 'getTransitionRawChildren',54 'guardReactiveProps',55 'h',56 'handleError',57 'hydrate',58 'initCustomFormatter',59 'initDirectivesForSSR',60 'inject',61 'isMemoSame',62 'isProxy',63 'isReactive',64 'isReadonly',65 'isRef',66 'isRuntimeOnly',67 'isShallow',68 'isVNode',69 'markRaw',70 'mergeDefaults',71 'mergeProps',72 'nextTick',73 'normalizeClass',74 'normalizeProps',75 'normalizeStyle',76 'onActivated',77 'onBeforeMount',78 'onBeforeUnmount',79 'onBeforeUpdate',80 'onDeactivated',81 'onErrorCaptured',82 'onMounted',83 'onRenderTracked',84 'onRenderTriggered',85 'onScopeDispose',86 'onServerPrefetch',87 'onUnmounted',88 'onUpdated',89 'openBlock',90 'popScopeId',91 'provide',92 'proxyRefs',93 'pushScopeId',94 'queuePostFlushCb',95 'reactive',96 'readonly',97 'ref',98 'registerRuntimeCompiler',99 'render',100 'renderList',101 'renderSlot',102 'resolveComponent',103 'resolveDirective',104 'resolveDynamicComponent',105 'resolveFilter',106 'resolveTransitionHooks',107 'setBlockTracking',108 'setDevtoolsHook',109 'setTransitionHooks',110 'shallowReactive',111 'shallowReadonly',112 'shallowRef',113 'ssrContextKey',114 'ssrUtils',115 'stop',116 'toDisplayString',117 'toHandlerKey',118 'toHandlers',119 'toRaw',120 'toRef',121 'toRefs',122 'transformVNodeArgs',123 'triggerRef',124 'unref',125 'useAttrs',126 'useCssModule',127 'useCssVars',128 'useSSRContext',129 'useSlots',130 'useTransitionState',131 'vModelCheckbox',132 'vModelDynamic',133 'vModelRadio',134 'vModelSelect',135 'vModelText',136 'vShow',137 'version',138 'warn',139 'watch',140 'watchEffect',141 'watchPostEffect',142 'watchSyncEffect',143 'withAsyncContext',144 'withCtx',145 'withDefaults',146 'withDirectives',147 'withKeys',148 'withMemo',149 'withModifiers',150 'withScopeId',151 ],...

Full Screen

Full Screen

Vue.mjs

Source:Vue.mjs Github

copy

Full Screen

1/**2 * Wrap Vue 3 library to use as ES6 module in TeqFW on the front.3 *4 * @namespace TeqFw_Vue_Front_Lib_Vue5 */6if (window.Vue === undefined) {7 throw new Error(`8Add9<script type="application/javascript" src="./src/vue/vue.global.prod.js"></script>10to your startup HTML to use Vue 3. 11`);12}13// export corresponds to Vue v. 3.2.23:14export const {15 BaseTransition,16 callWithAsyncErrorHandling,17 callWithErrorHandling,18 camelize,19 capitalize,20 cloneVNode,21 Comment,22 compatUtils,23 compile,24 computed,25 createApp,26 createBlock,27 createCommentVNode,28 createElementBlock,29 createElementVNode,30 createHydrationRenderer,31 createPropsRestProxy,32 createRenderer,33 createSlots,34 createSSRApp,35 createStaticVNode,36 createTextVNode,37 createVNode,38 customRef,39 defineAsyncComponent,40 defineComponent,41 defineCustomElement,42 defineEmits,43 defineExpose,44 defineProps,45 defineSSRCustomElement,46 effect,47 EffectScope,48 effectScope,49 Fragment,50 getCurrentInstance,51 getCurrentScope,52 getTransitionRawChildren,53 guardReactiveProps,54 h,55 handleError,56 hydrate,57 initCustomFormatter,58 initDirectivesForSSR,59 inject,60 isMemoSame,61 isProxy,62 isReactive,63 isReadonly,64 isRef,65 isRuntimeOnly,66 isVNode,67 KeepAlive,68 markRaw,69 mergeDefaults,70 mergeProps,71 nextTick,72 normalizeClass,73 normalizeProps,74 normalizeStyle,75 onActivated,76 onBeforeMount,77 onBeforeUnmount,78 onBeforeUpdate,79 onDeactivated,80 onErrorCaptured,81 onMounted,82 onRenderTracked,83 onRenderTriggered,84 onScopeDispose,85 onServerPrefetch,86 onUnmounted,87 onUpdated,88 openBlock,89 popScopeId,90 provide,91 proxyRefs,92 pushScopeId,93 queuePostFlushCb,94 reactive,95 ReactiveEffect,96 readonly,97 ref,98 registerRuntimeCompiler,99 render,100 renderList,101 renderSlot,102 resolveComponent,103 resolveDirective,104 resolveDynamicComponent,105 resolveFilter,106 resolveTransitionHooks,107 setBlockTracking,108 setDevtoolsHook,109 setTransitionHooks,110 shallowReactive,111 shallowReadonly,112 shallowRef,113 ssrContextKey,114 ssrUtils,115 Static,116 stop,117 Suspense,118 Teleport,119 Text,120 toDisplayString,121 toHandlerKey,122 toHandlers,123 toRaw,124 toRef,125 toRefs,126 transformVNodeArgs,127 Transition,128 TransitionGroup,129 triggerRef,130 unref,131 useAttrs,132 useCssModule,133 useCssVars,134 useSlots,135 useSSRContext,136 useTransitionState,137 version,138 vModelCheckbox,139 vModelDynamic,140 vModelRadio,141 vModelSelect,142 vModelText,143 vShow,144 VueElement,145 warn,146 watch,147 watchEffect,148 watchPostEffect,149 watchSyncEffect,150 withAsyncContext,151 withCtx,152 withDefaults,153 withDirectives,154 withKeys,155 withMemo,156 withModifiers,157 withScopeId,...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { createHydrationRenderer } = require("playwright/lib/server/hydrate");2const { createHydrationRenderer } = require("playwright/lib/server/hydrate");3const { createServer } = require("http");4const { join } = require("path");5const { parse } = require("url");6const { createReadStream } = require("fs");7const { createHydrationRenderer } = require("playwright/lib/server/hydrate");8const server = createServer(async (req, res) => {9 const { pathname } = parse(req.url);10 if (pathname === "/") {11 res.setHeader("Content-Type", "text/html");12 const renderer = createHydrationRenderer({13 template: await createReadStream(join(__dirname, "index.html")),14 renderScript: join(__dirname, "render.js"),15 });16 await renderer.renderToStream(res);17 res.end();18 } else {19 res.statusCode = 404;20 res.end("Not found");21 }22});23server.listen(8080, () => {24});25const { createPage } = require("playwright");26const page = await createPage();27await page.screenshot({ path: "example.png" });28await page.close();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { createHydrationRenderer } = require('playwright/lib/server/hydrate');2const renderer = createHydrationRenderer();3const { render } = require('playwright/lib/server/hydrate');4const { html } = require('playwright/lib/server/dom');5const { ElementHandle } = require('playwright/lib/server/dom');6const { JSHandle } = require('playwright/lib/server/dom');7const { parseHydrationData } = require('playwright/lib/server/hydrate');8const { parseHydrationData } = require('playwright/lib/server/hydrate');9const { serializeHydrationData } = require('playwright/lib/server/hydrate');10const { serializeHydrationData } = require('playwright/lib/server/hydrate');11const { createPlaywrightServer } = require('playwright/lib/server/playwrightServer');12const server = createPlaywrightServer();13const { createPlaywrightServer } = require('playwright/lib/server/playwrightServer');14const server = createPlaywrightServer();15const { createPlaywrightServer } = require('playwright/lib/server/playwrightServer');16const server = createPlaywrightServer();17const { createPlaywrightServer } = require('playwright/lib/server/playwrightServer');18const server = createPlaywrightServer();19const { createPlaywrightServer } = require('playwright/lib/server/playwrightServer');20const server = createPlaywrightServer();21const { createPlaywrightServer } = require('playwright/lib/server/playwrightServer');22const server = createPlaywrightServer();23const { createPlaywrightServer } = require('playwright/lib/server/playwrightServer');24const server = createPlaywrightServer();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { createHydrationRenderer } = require('playwright-core/lib/server/webkit');2const { createHydrationRenderer } = require('playwright-core/lib/server/chromium');3const { createHydrationRenderer } = require('playwright-core/lib/server/firefox');4const { createHydrationRenderer } = require('playwright-core/lib/server/inspector');5const { createHydrationRenderer } = require('playwright-core/lib/server/electron');6const { createHydrationRenderer } = require('playwright-core/lib/server/android');

Full Screen

Using AI Code Generation

copy

Full Screen

1const {createHydrationRenderer} = require('playwright/lib/server/supplements/hydrate/hydrateRenderer');2const {createHydrationRenderer} = require('playwright/lib/server/supplements/hydrate/hydrateRenderer');3const {createHydrationRenderer} = require('playwright/lib/server/supplements/hydrate/hydrateRenderer');4const {createHydrationRenderer} = require('playwright/lib/server/supplements/hydrate/hydrateRenderer');5const {createHydrationRenderer} = require('playwright/lib/server/supplements/hydrate/hydrateRenderer');6const {createHydrationRenderer} = require('playwright/lib/server/supplements/hydrate/hydrateRenderer');7const {createHydrationRenderer} = require('playwright/lib/server/supplements/hydrate/hydrateRenderer');8const {createHydrationRenderer} = require('playwright/lib/server/supplements/hydrate/hydrateRenderer');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { createHydrationRenderer } = require('playwright/lib/server/hydrate');2const { parse } = require('playwright/lib/server/dom');3const { createServer } = require('http');4const { createReadStream } = require('fs');5const { join } = require('path');6const { promisify } = require('util');7const { createHash } = require('crypto');8const { createBundleRenderer } = require('vue-server-renderer');9const { createReadStream: createReadStream2 } = require('fs');10const { createReadStream: createReadStream3 } = require('fs');11const { createReadStream: createReadStream4 } = require('fs');12const { createReadStream: createReadStream5 } = require('fs');13const { createReadStream: createReadStream6 } = require('fs');14const { createReadStream: createReadStream7 } = require('fs');15const { createReadStream: createReadStream8 } = require('fs');16const { createReadStream: createReadStream9 } = require('fs');17const { createReadStream: createReadStream10 } = require('fs');18const { createReadStream: createReadStream11 } = require('fs');19const { createReadStream: createReadStream12 } = require('fs');20const { createReadStream: createReadStream13 } = require('fs');21const { createReadStream: createReadStream14 } = require('fs');22const { createReadStream: createReadStream15 } = require('fs');23const { createReadStream: createReadStream16 } = require('fs');24const { createReadStream: createReadStream17 } = require('fs');25const { createReadStream: createReadStream18 } = require('fs');26const { createReadStream: createReadStream19 } = require('fs');27const { createReadStream: createReadStream20 } = require('fs');28const { createReadStream: createReadStream21 } = require('fs');29const { createReadStream: createReadStream22 } = require('fs');30const { createReadStream: createReadStream23 } = require('fs');31const { createReadStream: createReadStream24 } = require('fs');32const { createReadStream: createReadStream25 } = require('fs');33const { createReadStream: createReadStream26 } = require('fs');34const { createReadStream: createReadStream27 } = require('fs');35const { createReadStream: createReadStream28 } = require('fs');36const { createReadStream: createReadStream29 } = require('fs');37const { createReadStream: createReadStream30 } =

Full Screen

Using AI Code Generation

copy

Full Screen

1const { createHydrationRenderer } = require('playwright');2const renderer = createHydrationRenderer();3const { createHydrationRenderer } = require('playwright');4const renderer = createHydrationRenderer();5const { createHydrationRenderer } = require('playwright');6const renderer = createHydrationRenderer();7const { createHydrationRenderer } = require('playwright');8const renderer = createHydrationRenderer();9const { createHydrationRenderer } = require('playwright');10const renderer = createHydrationRenderer();11const { createHydrationRenderer } = require('playwright');12const renderer = createHydrationRenderer();13const { createHydrationRenderer } = require('playwright');14const renderer = createHydrationRenderer();15const { createHydrationRenderer } = require('playwright');16const renderer = createHydrationRenderer();17const { createHydrationRenderer } = require('playwright');18const renderer = createHydrationRenderer();19const { createHydrationRenderer } = require('playwright');20const renderer = createHydrationRenderer();21const { createHydrationRenderer } = require('playwright');22const renderer = createHydrationRenderer();23renderer.render(document, 'https

Full Screen

Using AI Code Generation

copy

Full Screen

1import { createHydrationRenderer } from 'playwright/lib/server/hybridRenderer';2const renderer = createHydrationRenderer();3renderer.hydrate(document, html, script);4renderer.dispose();5import { createHydrationRenderer } from 'playwright/lib/server/hybridRenderer';6const renderer = createHydrationRenderer();7renderer.hydrate(document, html, script);8renderer.dispose();9import { createHydrationRenderer } from 'playwright/lib/server/hybridRenderer';10const renderer = createHydrationRenderer();11renderer.hydrate(document, html, script);12renderer.dispose();13import { createHydrationRenderer } from 'playwright/lib/server/hybridRenderer';14const renderer = createHydrationRenderer();15renderer.hydrate(document, html, script);16renderer.dispose();17import { createHydrationRenderer } from 'playwright/lib/server/hybridRenderer';18const renderer = createHydrationRenderer();19renderer.hydrate(document, html, script);20renderer.dispose();21import { createHydrationRenderer } from 'playwright/lib/server/hybridRenderer';22const renderer = createHydrationRenderer();23renderer.hydrate(document, html, script);24renderer.dispose();25import { createHydrationRenderer } from 'playwright/lib/server/hybridRenderer';26const renderer = createHydrationRenderer();27renderer.hydrate(document, html, script);28renderer.dispose();29import { createHydrationRenderer } from 'playwright/lib/server/hybridRenderer';30const renderer = createHydrationRenderer();31renderer.hydrate(document, html, script);32renderer.dispose();33import { createHydrationRenderer } from 'playwright/lib/server/hybridRenderer';34const renderer = createHydrationRenderer();35renderer.hydrate(document, html, script);36renderer.dispose();37import { createHydrationRenderer } from 'playwright/lib/server/hybridRenderer';

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful