@shijiu/jsview 3.0.0-next-vue.0 → 3.0.0-test.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview",
3
- "version": "3.0.0-next-vue.0",
3
+ "version": "3.0.0-test.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "jsview-post-build": "./tools/jsview-post-build.mjs",
@@ -1,5 +1,5 @@
1
1
  diff --git a/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js b/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
2
- index 42090ab..fe02eba 100644
2
+ index 42090ab..c1c9825 100644
3
3
  --- a/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
4
4
  +++ b/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
5
5
  @@ -5,6 +5,11 @@
@@ -8,27 +8,26 @@ index 42090ab..fe02eba 100644
8
8
  import { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, camelize, camelize as camelize$1, capitalize, capitalize as capitalize$1, def, extend, getEscapedCssVarName, getGlobalThis, getModifierPropName, getSequence, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isBuiltInTag, isFunction, isGloballyAllowed, isKnownHtmlAttr, isKnownSvgAttr, isModelListener, isObject, isOn, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isString, isSymbol, looseEqual, looseToNumber, makeMap, normalizeClass, normalizeClass as normalizeClass$1, normalizeCssVarValue, normalizeProps, normalizeStyle, normalizeStyle as normalizeStyle$1, remove, stringifyStyle, toDisplayString, toHandlerKey, toHandlerKey as toHandlerKey$1, toNumber, toRawType } from "@vue/shared";
9
9
  +
10
10
  +// JsView Added >>>
11
- +import { jsvSliceDelayQueue, jsvPostDelayQueue, jsvRemoveNodeIfRenderBreaked, jsvCancelPatchIfRenderBreaked, jsvUpdatePatchNode, jsvResetPatchNode } from "@shijiu/jsview/thirdparty/@vue/runtime-core/jsview-render-break.mjs";
11
+ +import { jsvFlushDelayJobs, jsvPostDelayQueue, jsvRemoveNodeIfRenderBreaked, jsvCancelPatchIfRenderBreaked, jsvUpdatePatchNode, jsvResetPatchNode } from "@shijiu/jsview/thirdparty/@vue/runtime-core/jsview-render-break.mjs";
12
12
  +// JsView Added <<<
13
13
  +
14
14
  //#region packages/runtime-core/src/warning.ts
15
15
  const stack = [];
16
16
  /**
17
- @@ -366,6 +371,13 @@ function flushOnAppMount(instance) {
17
+ @@ -366,6 +371,12 @@ function flushOnAppMount(instance) {
18
18
  }
19
19
  function flushJobs(seen) {
20
20
  if (!!(process.env.NODE_ENV !== "production")) seen || (seen = /* @__PURE__ */ new Map());
21
21
  +
22
22
  +// JsView Added >>>
23
23
  +// 将延迟后的任务放入执行队列前,如果任务本身已经失效了,此instance.update就会被设置成inactive
24
- + const jsvDelayQueueSize = jsvSliceDelayQueue(jobs);
25
- + jobsLength += jsvDelayQueueSize;
24
+ + jsvFlushDelayJobs(seen, checkRecursiveUpdates, handleError);
26
25
  +// JsView Added <<<
27
26
  +
28
27
  try {
29
28
  while (flushIndex < jobsLength) {
30
29
  const job = jobs[flushIndex];
31
- @@ -393,6 +405,10 @@ function flushJobs(seen) {
30
+ @@ -393,6 +404,10 @@ function flushJobs(seen) {
32
31
  currentFlushPromise = null;
33
32
  if (jobsLength || postJobs.length) flushJobs(seen);
34
33
  }
@@ -39,7 +38,7 @@ index 42090ab..fe02eba 100644
39
38
  }
40
39
  function checkRecursiveUpdates(seen, fn) {
41
40
  const count = seen.get(fn) || 0;
42
- @@ -2440,6 +2456,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
41
+ @@ -2440,6 +2455,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
43
42
  if (!res && maybeSelfReference) return Component;
44
43
  if (!!(process.env.NODE_ENV !== "production") && warnMissing && !res) {
45
44
  const extra = type === "components" ? "\nIf this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement." : ``;
@@ -51,7 +50,7 @@ index 42090ab..fe02eba 100644
51
50
  warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
52
51
  }
53
52
  return res;
54
- @@ -3637,7 +3658,12 @@ const isElementRoot = (vnode) => {
53
+ @@ -3637,7 +3657,12 @@ const isElementRoot = (vnode) => {
55
54
  };
56
55
  function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
57
56
  const { props: prevProps, children: prevChildren, component } = prevVNode;
@@ -65,7 +64,7 @@ index 42090ab..fe02eba 100644
65
64
  const emits = component.emitsOptions;
66
65
  if (!!(process.env.NODE_ENV !== "production") && (prevChildren || nextChildren) && isHmrUpdating) return true;
67
66
  if (nextVNode.dirs || nextVNode.transition) return true;
68
- @@ -4173,6 +4199,17 @@ function baseCreateRenderer(options, createHydrationFns) {
67
+ @@ -4173,6 +4198,17 @@ function baseCreateRenderer(options, createHydrationFns) {
69
68
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
70
69
  const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, insertStaticContent: hostInsertStaticContent } = options;
71
70
  const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = !!(process.env.NODE_ENV !== "production") && isHmrUpdating ? false : !!n2.dynamicChildren) => {
@@ -83,7 +82,7 @@ index 42090ab..fe02eba 100644
83
82
  if (n1 === n2) return;
84
83
  if (n1 && !isSameVNodeType(n1, n2)) {
85
84
  anchor = getNextHostNode(n1);
86
- @@ -4183,6 +4220,16 @@ function baseCreateRenderer(options, createHydrationFns) {
85
+ @@ -4183,6 +4219,16 @@ function baseCreateRenderer(options, createHydrationFns) {
87
86
  optimized = false;
88
87
  n2.dynamicChildren = null;
89
88
  }
@@ -100,7 +99,7 @@ index 42090ab..fe02eba 100644
100
99
  const { type, ref, shapeFlag } = n2;
101
100
  switch (type) {
102
101
  case Text:
103
- @@ -4209,6 +4256,11 @@ function baseCreateRenderer(options, createHydrationFns) {
102
+ @@ -4209,6 +4255,11 @@ function baseCreateRenderer(options, createHydrationFns) {
104
103
  }
105
104
  if (ref != null && parentComponent) setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
106
105
  else if (ref == null && n1 && n1.ref != null) setRef(n1.ref, null, parentSuspense, n1, true);
@@ -112,7 +111,7 @@ index 42090ab..fe02eba 100644
112
111
  };
113
112
  const processText = (n1, n2, container, anchor) => {
114
113
  if (n1 == null) hostInsert(n2.el = hostCreateText(n2.children), container, anchor);
115
- @@ -4536,6 +4588,11 @@ function baseCreateRenderer(options, createHydrationFns) {
114
+ @@ -4536,6 +4587,11 @@ function baseCreateRenderer(options, createHydrationFns) {
116
115
  fn() {
117
116
  const { instance, initialVNode, container, anchor, parentSuspense, namespace, optimized } = this;
118
117
  if (!instance.isMounted) {
@@ -124,7 +123,7 @@ index 42090ab..fe02eba 100644
124
123
  let vnodeHook;
125
124
  const { el, props } = initialVNode;
126
125
  const { bm, parent, root, type } = instance;
127
- @@ -4574,7 +4631,17 @@ function baseCreateRenderer(options, createHydrationFns) {
126
+ @@ -4574,7 +4630,17 @@ function baseCreateRenderer(options, createHydrationFns) {
128
127
  instance.isMounted = true;
129
128
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) devtoolsComponentAdded(instance);
130
129
  this.initialVNode = this.container = this.anchor = null;
@@ -142,7 +141,7 @@ index 42090ab..fe02eba 100644
142
141
  let { next, bu, u, parent, vnode } = instance;
143
142
  {
144
143
  const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
145
- @@ -4608,7 +4675,14 @@ function baseCreateRenderer(options, createHydrationFns) {
144
+ @@ -4608,7 +4674,14 @@ function baseCreateRenderer(options, createHydrationFns) {
146
145
  const prevTree = instance.subTree;
147
146
  instance.subTree = nextTree;
148
147
  if (!!(process.env.NODE_ENV !== "production")) startMeasure(instance, `patch`);
@@ -158,7 +157,7 @@ index 42090ab..fe02eba 100644
158
157
  if (!!(process.env.NODE_ENV !== "production")) endMeasure(instance, `patch`);
159
158
  next.el = nextTree.el;
160
159
  if (originNext === null) updateHOCHostEl(instance, nextTree.el);
161
- @@ -4616,6 +4690,11 @@ function baseCreateRenderer(options, createHydrationFns) {
160
+ @@ -4616,6 +4689,11 @@ function baseCreateRenderer(options, createHydrationFns) {
162
161
  if (vnodeHook = next.props && next.props.onVnodeUpdated) queuePostRenderEffect(() => invokeVNodeHook(vnodeHook, parent, next, vnode), void 0, parentSuspense);
163
162
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) devtoolsComponentUpdated(instance);
164
163
  if (!!(process.env.NODE_ENV !== "production")) popWarningContext();
@@ -170,19 +169,22 @@ index 42090ab..fe02eba 100644
170
169
  }
171
170
  }
172
171
  }
173
- @@ -4820,6 +4899,11 @@ function baseCreateRenderer(options, createHydrationFns) {
172
+ @@ -4820,6 +4898,14 @@ function baseCreateRenderer(options, createHydrationFns) {
174
173
  else parentComponent.ctx.deactivate(vnode);
175
174
  return;
176
175
  }
177
176
  +
178
177
  +// JsView Added >>>
179
- + jsvResetPatchNode(vnode);
178
+ + const breaked = jsvResetPatchNode(vnode);
179
+ + if (breaked) {
180
+ + return;
181
+ + }
180
182
  +// JsView Added <<<
181
183
  +
182
184
  const shouldInvokeDirs = shapeFlag & 1 && dirs;
183
185
  const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
184
186
  let vnodeHook;
185
- @@ -5505,6 +5589,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
187
+ @@ -5505,6 +5591,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
186
188
  patchFlag,
187
189
  dynamicProps,
188
190
  dynamicChildren: null,
@@ -3,31 +3,41 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- const jsvDelayQueue = [];
6
+ const jsvDelayQueueRecord = [];
7
+ let jsvDelayQueue = [];
7
8
  let jsvPendingForFirstDelayRender = false;
8
9
  let jsvDelayQueueTimer = 0;
9
10
  let jsvDelayQueueTaskToken = 1;
10
- const jsvDelayQueueRecord = [];
11
11
  let JsvRenderCount = 0;
12
12
 
13
- function jsvSliceDelayQueue(queue)
13
+ function jsvFlushDelayJobs(seen, checkRecursiveUpdates, handleError)
14
14
  {
15
- let delayQueueSize = jsvDelayQueue?.length ?? 0;
16
-
17
15
  if (jsvDelayQueue.length > 0 && !jsvPendingForFirstDelayRender) {
18
16
  // 将延迟后的任务放入执行队列前,如果任务本身已经失效了,此instance.update就会被设置成inactive
19
17
  // console.log("QCodeDrop jsvDelayQueue.length=", jsvDelayQueue.length);
20
- queue.unshift(...jsvDelayQueue);
18
+ const jobs = jsvDelayQueue;
21
19
 
22
20
  // 记录 Recorder 用于调试
23
21
  // jsvDelayQueueRecord.length = 0;
24
22
  // jsvDelayQueueRecord.unshift(...jsvDelayQueue);
25
23
 
26
- jsvDelayQueue.length = 0;
24
+ jsvDelayQueue = [];
27
25
  jsvDelayQueueTaskToken++;
28
- }
29
26
 
30
- return delayQueueSize;
27
+ for (const job of jobs) {
28
+ if (!(job.flags & 4)) {
29
+ if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, job)) continue;
30
+ if (job.flags & 2) job.flags &= -2;
31
+ try {
32
+ job();
33
+ } catch (err) {
34
+ handleError(err, job.i, job.i ? 15 : 14);
35
+ } finally {
36
+ if (!(job.flags & 2)) job.flags &= -2;
37
+ }
38
+ }
39
+ }
40
+ }
31
41
  }
32
42
 
33
43
  function jsvPostDelayQueue(queueFlush)
@@ -167,20 +177,22 @@ function jsvResetPatchNode(vnode)
167
177
  // 但是 mount 状态需要进行记录,避免由于RenderBreaker引起子节点未patch因为无法umount状态
168
178
 
169
179
  if (vnode.jsvRenderBreaker?.breaked) {
170
- vnode.el.parentNode.removeChild(vnode.el);
180
+ vnode.el?.parentNode.removeChild(vnode.el);
171
181
  vnode.el = null;
172
182
  vnode.anchor = null;
173
183
  vnode.jsvRenderBreaker = null;
174
184
  }
175
- return;
185
+ return true;
176
186
  } else {
177
187
  // unmount时重置jsvPatchedFlag
178
188
  vnode.jsvPatchedFlag = false;
179
189
  }
190
+
191
+ return false;
180
192
  }
181
193
 
182
194
  export {
183
- jsvSliceDelayQueue,
195
+ jsvFlushDelayJobs,
184
196
  jsvPostDelayQueue,
185
197
  jsvRemoveNodeIfRenderBreaked,
186
198
  jsvCancelPatchIfRenderBreaked,
@@ -50,9 +50,9 @@ function checkNpmMissingDepPkgs(options, linkablePkgNames)
50
50
 
51
51
  for (const dep in linkablePkgObj.dependencies ?? {}) {
52
52
  const depPath = path.resolve(options.modulesDir, dep);
53
- if (fs.existsSync(depPath)) {
54
- continue;
55
- }
53
+ // if (fs.existsSync(depPath)) {
54
+ // continue;
55
+ // }
56
56
 
57
57
  const depPkg = dep + "@" + linkablePkgObj.dependencies[dep];
58
58
  missingDepPkgs += ' ' + depPkg;
@@ -231,7 +231,7 @@ async function printRevision(options)
231
231
  Logger.Info('**************************************************');
232
232
  }
233
233
 
234
- function doPostInstall(framework, pkgNeedPatch, skipCheckVersion, skipCheckNpmcmd)
234
+ function doPostInstall(framework, pkgNeedPatches, skipCheckVersion, skipCheckNpmcmd)
235
235
  {
236
236
  const options = getOptions(framework);
237
237
  options.projectDir = process.cwd();
@@ -259,9 +259,7 @@ function doPostInstall(framework, pkgNeedPatch, skipCheckVersion, skipCheckNpmcm
259
259
  checkNpmLinkForDebug(options, linkablePkgNames);
260
260
 
261
261
  Logger.Tip('Stage 2: Auto patching packages...');
262
- autoPatchPackages(options, pkgNeedPatch.patchModules);
263
-
264
- // installPatches(options, pkgNeedPatch.installModules, skipCheckVersion);
262
+ autoPatchPackages(options, pkgNeedPatches);
265
263
 
266
264
  printRevision(options);
267
265
  }
@@ -270,35 +268,23 @@ function main(argv)
270
268
  {
271
269
  checkNodeVersion();
272
270
 
273
- let pkgNeedPatch;
271
+ let pkgNeedPatches;
274
272
 
275
273
  switch (argv.framework) {
276
274
  case 'vue':
277
- pkgNeedPatch = {
278
- installModules: [
279
- // '@vitejs/plugin-vue',
280
- // '@vue/compiler-dom',
281
- // '@vue/compiler-sfc',
282
- // '@vue/runtime-core',
283
- // '@vue/runtime-dom',
284
- // 'postcss-js',
285
- 'vite',
286
- // 'vue-router',
287
- ],
288
- patchModules: [
289
- '@vitejs+plugin-vue+6.0.6.patch',
290
- '@vue+compiler-dom+3.6.0-beta.10.patch',
291
- '@vue+compiler-sfc+3.6.0-beta.10.patch',
292
- '@vue+runtime-core+3.6.0-beta.10.patch',
293
- '@vue+runtime-dom+3.6.0-beta.10.patch',
294
- 'postcss-js+5.1.0.patch',
295
- 'vite+8.0.9.patch',
296
- 'vue-router+5.0.6.patch',
297
- ]
298
- };
275
+ pkgNeedPatches = [
276
+ '@vitejs+plugin-vue+6.0.6.patch',
277
+ '@vue+compiler-dom+3.6.0-beta.10.patch',
278
+ '@vue+compiler-sfc+3.6.0-beta.10.patch',
279
+ '@vue+runtime-core+3.6.0-beta.10.patch',
280
+ '@vue+runtime-dom+3.6.0-beta.10.patch',
281
+ 'postcss-js+5.1.0.patch',
282
+ 'vite+8.0.9.patch',
283
+ 'vue-router+5.0.6.patch',
284
+ ]
299
285
  break;
300
286
  // case 'react':
301
- // pkgNeedPatch = [
287
+ // pkgNeedPatches = [
302
288
  // 'react-dev-utils',
303
289
  // 'react-dom',
304
290
  // 'react-scripts',
@@ -313,7 +299,7 @@ function main(argv)
313
299
  argv.skipCheckVersion = true;
314
300
  }
315
301
 
316
- doPostInstall(argv.framework, pkgNeedPatch, argv.skipCheckVersion, argv.skipCheckNpmcmd);
302
+ doPostInstall(argv.framework, pkgNeedPatches, argv.skipCheckVersion, argv.skipCheckNpmcmd);
317
303
  }
318
304
 
319
305
  const requiredUsages = {