@shijiu/jsview-vue 0.0.1-beta.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.
Files changed (252) hide show
  1. package/docs/IMPORT_CHANGE_LOG.txt +3 -0
  2. package/docs/git_commit.md +15 -0
  3. package/docs/test_version_up.txt +1 -0
  4. package/dom/bin/jsview-dom-1.0.313.tgz +0 -0
  5. package/dom/browser-root-style.css +21 -0
  6. package/dom/jsv-browser-debug-dom.js +8 -0
  7. package/dom/jsv-dom.js +6 -0
  8. package/dom/jsv-forge-define.js +6 -0
  9. package/dom/target_core_revision.js +14 -0
  10. package/load/header_script_loader.js +134 -0
  11. package/load/jsview-main.js +42 -0
  12. package/load/jsview.config.default.js +37 -0
  13. package/load/jsview.default.config.js +37 -0
  14. package/load/loader.js +172 -0
  15. package/load/loader_webkit.js +40 -0
  16. package/package.json +27 -0
  17. package/patch/node_modules/@babel/preset-env/lib/available-plugins.js +219 -0
  18. package/patch/node_modules/@vue/cli-plugin-typescript/index.js +100 -0
  19. package/patch/node_modules/@vue/cli-service/lib/commands/serve.js +395 -0
  20. package/patch/node_modules/@vue/cli-service/lib/config/app.js +272 -0
  21. package/patch/node_modules/@vue/cli-service/lib/config/assets.js +70 -0
  22. package/patch/node_modules/@vue/cli-service/lib/config/base.js +212 -0
  23. package/patch/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +2566 -0
  24. package/patch/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +274 -0
  25. package/patch/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +1596 -0
  26. package/patch/node_modules/postcss-js/objectifier.js +90 -0
  27. package/patch/node_modules/vue-loader/dist/resolveScript.js +70 -0
  28. package/patch/package-lock.json +30051 -0
  29. package/samples/AdvanceMetroWidget/App.vue +123 -0
  30. package/samples/AdvanceMetroWidget/Frame.vue +101 -0
  31. package/samples/AdvanceMetroWidget/Item.vue +58 -0
  32. package/samples/AdvanceMetroWidget/data.js +137 -0
  33. package/samples/AnimPicture/App.vue +224 -0
  34. package/samples/AnimPicture/assets/animated_webp.webp +0 -0
  35. package/samples/AnimPicture/assets/ball_3.webp +0 -0
  36. package/samples/AnimPicture/assets/girl_run.gif +0 -0
  37. package/samples/AnimPicture/assets/quan.webp +0 -0
  38. package/samples/Basic/App.vue +129 -0
  39. package/samples/Basic/assets/border.png +0 -0
  40. package/samples/Basic/assets/border2.png +0 -0
  41. package/samples/Basic/assets/icon.png +0 -0
  42. package/samples/Basic/assets/test.jpg +0 -0
  43. package/samples/Basic/components/ContentBlock.vue +36 -0
  44. package/samples/Basic/components/FontStyle.css +10 -0
  45. package/samples/Basic/components/TitleBar.vue +29 -0
  46. package/samples/Basic/components/anim/AnimGroup.vue +68 -0
  47. package/samples/Basic/components/anim/AnimKeyframeBasic.vue +102 -0
  48. package/samples/Basic/components/anim/AnimKeyframeComposite.vue +53 -0
  49. package/samples/Basic/components/anim/AnimTransition.vue +116 -0
  50. package/samples/Basic/components/div/DivBackground.vue +15 -0
  51. package/samples/Basic/components/div/DivClip.vue +81 -0
  52. package/samples/Basic/components/div/DivCssScoped.vue +27 -0
  53. package/samples/Basic/components/div/DivCssVar.vue +50 -0
  54. package/samples/Basic/components/div/DivGroup1.vue +33 -0
  55. package/samples/Basic/components/div/DivGroup2.vue +41 -0
  56. package/samples/Basic/components/div/DivLayout.vue +12 -0
  57. package/samples/Basic/components/div/DivRadius.vue +47 -0
  58. package/samples/Basic/components/text/TextAlign.vue +48 -0
  59. package/samples/Basic/components/text/TextFontStyle.vue +58 -0
  60. package/samples/Basic/components/text/TextGroup.vue +32 -0
  61. package/samples/Basic/components/text/TextOverflow.vue +78 -0
  62. package/samples/BasicFocusControl/App.vue +125 -0
  63. package/samples/BasicFocusControl/components/BaseBlock.vue +51 -0
  64. package/samples/BasicFocusControl/components/MainArea.vue +98 -0
  65. package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +21 -0
  66. package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +30 -0
  67. package/samples/BasicFocusControl/components/SideBar.vue +73 -0
  68. package/samples/BasicFocusControl/components/SideBarBlock.vue +30 -0
  69. package/samples/ClassNameDemo/App.vue +119 -0
  70. package/samples/ClassNameDemo/assets/bg.jpg +0 -0
  71. package/samples/ClassNameDemo/assets/coupon_content.png +0 -0
  72. package/samples/ClassNameDemo/assets/coupon_left.png +0 -0
  73. package/samples/ClassNameDemo/assets/coupon_mid.png +0 -0
  74. package/samples/ClassNameDemo/assets/coupon_right.png +0 -0
  75. package/samples/ClassNameDemo/assets/focus_border.png +0 -0
  76. package/samples/ClassNameDemo/assets/holder_logo.png +0 -0
  77. package/samples/ClassNameDemo/assets/jrbm.png +0 -0
  78. package/samples/ClassNameDemo/assets/line_left.png +0 -0
  79. package/samples/ClassNameDemo/assets/line_mid.png +0 -0
  80. package/samples/ClassNameDemo/assets/line_right.png +0 -0
  81. package/samples/ClassNameDemo/assets/loading.png +0 -0
  82. package/samples/ClassNameDemo/assets/logo.png +0 -0
  83. package/samples/ClassNameDemo/assets/mcjx.png +0 -0
  84. package/samples/ClassNameDemo/assets/tao.png +0 -0
  85. package/samples/ClassNameDemo/assets/tmall.png +0 -0
  86. package/samples/ClassNameDemo/components/ContentItem.vue +253 -0
  87. package/samples/ClassNameDemo/components/LoadingView.vue +43 -0
  88. package/samples/ClassNameDemo/components/TitleView.vue +24 -0
  89. package/samples/ClassNameDemo/data.js +24 -0
  90. package/samples/ColorSpace/App.vue +135 -0
  91. package/samples/ColorSpace/bmpDemo.bmp +0 -0
  92. package/samples/ColorSpace/jpegDemo.jpeg +0 -0
  93. package/samples/ColorSpace/pngDemo.png +0 -0
  94. package/samples/ColorSpace/pngNoAlphaDemo.png +0 -0
  95. package/samples/DemoHomepage/App.vue +31 -0
  96. package/samples/DemoHomepage/components/BodyFrame.vue +82 -0
  97. package/samples/DemoHomepage/components/Dialog.vue +94 -0
  98. package/samples/DemoHomepage/components/Item.vue +77 -0
  99. package/samples/DemoHomepage/components/TabFrame.vue +86 -0
  100. package/samples/DemoHomepage/router.js +132 -0
  101. package/samples/DemoHomepage/views/Homepage.vue +186 -0
  102. package/samples/FlipCard/App.vue +80 -0
  103. package/samples/FlipCard/FlipCard.vue +124 -0
  104. package/samples/FlipCard/assets/blue_egg.png +0 -0
  105. package/samples/FlipCard/assets/red_egg.png +0 -0
  106. package/samples/FlipCard/data.js +13 -0
  107. package/samples/FlowMultiWidget/App.vue +91 -0
  108. package/samples/FlowMultiWidget/assets/nine_patch_focus.png +0 -0
  109. package/samples/FlowMultiWidget/components/Block.vue +107 -0
  110. package/samples/FlowMultiWidget/components/FlowPage.vue +60 -0
  111. package/samples/FlowMultiWidget/components/Item.vue +103 -0
  112. package/samples/FlowMultiWidget/components/MenuItem.vue +72 -0
  113. package/samples/FlowMultiWidget/components/MyMenu.vue +90 -0
  114. package/samples/FlowMultiWidget/data.js +446 -0
  115. package/samples/HashHistory/App.vue +124 -0
  116. package/samples/HashHistory/components/HorizontalButtonList.vue +114 -0
  117. package/samples/HashHistory/components/Item.vue +74 -0
  118. package/samples/HashHistory/router.js +30 -0
  119. package/samples/HashHistory/views/BasePage.vue +19 -0
  120. package/samples/HashHistory/views/MainPage.vue +68 -0
  121. package/samples/HashHistory/views/SubPage.vue +79 -0
  122. package/samples/HashHistory/views/SubPageFirst.vue +10 -0
  123. package/samples/HashHistory/views/SubPageSecond.vue +10 -0
  124. package/samples/LongImage/App.vue +96 -0
  125. package/samples/LongImage/Button.vue +153 -0
  126. package/samples/LongImage/LongImageScroll.vue +127 -0
  127. package/samples/LongImage/Scroll.vue +16 -0
  128. package/samples/LongImage/assets/1280x7200.jpg +0 -0
  129. package/samples/LongText/App.vue +111 -0
  130. package/samples/LongText/Button.vue +153 -0
  131. package/samples/LongText/LongTextScroll.vue +225 -0
  132. package/samples/LongText/Scroll.vue +16 -0
  133. package/samples/Preload/App.vue +146 -0
  134. package/samples/Preload/data.js +23 -0
  135. package/samples/Preload/images/awesomeface.png +0 -0
  136. package/samples/Preload/images/cat.jpg +0 -0
  137. package/samples/Preload/images/rank.png +0 -0
  138. package/samples/Preload/images/rank_focus.png +0 -0
  139. package/samples/Preload/images/rule.png +0 -0
  140. package/samples/Preload/images/rule_focus.png +0 -0
  141. package/samples/Preload/images/start.png +0 -0
  142. package/samples/Preload/images/start_focus.png +0 -0
  143. package/samples/Preload/preloadItem.vue +22 -0
  144. package/samples/QrcodeDemo/App.vue +73 -0
  145. package/samples/SimpleWidgetDemo/App.vue +204 -0
  146. package/samples/SimpleWidgetDemo/Item.vue +83 -0
  147. package/samples/SimpleWidgetDemo/assets/bg.jpg +0 -0
  148. package/samples/SimpleWidgetDemo/assets/coupon_content.png +0 -0
  149. package/samples/SimpleWidgetDemo/assets/coupon_left.png +0 -0
  150. package/samples/SimpleWidgetDemo/assets/coupon_mid.png +0 -0
  151. package/samples/SimpleWidgetDemo/assets/coupon_right.png +0 -0
  152. package/samples/SimpleWidgetDemo/assets/focus_border.png +0 -0
  153. package/samples/SimpleWidgetDemo/assets/holder_logo.png +0 -0
  154. package/samples/SimpleWidgetDemo/assets/jrbm.png +0 -0
  155. package/samples/SimpleWidgetDemo/assets/line_left.png +0 -0
  156. package/samples/SimpleWidgetDemo/assets/line_mid.png +0 -0
  157. package/samples/SimpleWidgetDemo/assets/line_right.png +0 -0
  158. package/samples/SimpleWidgetDemo/assets/loading.png +0 -0
  159. package/samples/SimpleWidgetDemo/assets/logo.png +0 -0
  160. package/samples/SimpleWidgetDemo/assets/mcjx.png +0 -0
  161. package/samples/SimpleWidgetDemo/assets/tao.png +0 -0
  162. package/samples/SimpleWidgetDemo/assets/tmall.png +0 -0
  163. package/samples/SimpleWidgetDemo/border.png +0 -0
  164. package/samples/SimpleWidgetDemo/components/ContentItem.vue +412 -0
  165. package/samples/SimpleWidgetDemo/components/MyTab.vue +117 -0
  166. package/samples/SimpleWidgetDemo/data.js +110 -0
  167. package/samples/SprayView/App.vue +270 -0
  168. package/samples/SprayView/assets/snow.png +0 -0
  169. package/samples/SpriteImage/App.vue +174 -0
  170. package/samples/SpriteImage/images/cat_run.png +0 -0
  171. package/samples/SpriteImage/images/egg_break.json +116 -0
  172. package/samples/SpriteImage/images/egg_break.png +0 -0
  173. package/samples/SpriteImage/images/sprite.png +0 -0
  174. package/samples/TextBox/App.vue +179 -0
  175. package/samples/TextBox/RenderCenter.vue +109 -0
  176. package/samples/TextBox/RenderLeft.vue +109 -0
  177. package/samples/TextBox/RenderOneLine.vue +120 -0
  178. package/samples/TextBox/RenderRight.vue +107 -0
  179. package/samples/TextShadowDemo/App.vue +98 -0
  180. package/samples/TextureSize/App.vue +142 -0
  181. package/samples/TextureSize/bmpDemo.bmp +0 -0
  182. package/samples/TextureSize/jpegDemo.jpeg +0 -0
  183. package/samples/TextureSize/jpgDemo.jpg +0 -0
  184. package/samples/TextureSize/pngDemo.png +0 -0
  185. package/samples/TextureSize/pngNoAlphaDemo.png +0 -0
  186. package/samples/ThrowMoveDemo/AccelerateDemo.vue +118 -0
  187. package/samples/ThrowMoveDemo/App.vue +114 -0
  188. package/samples/ThrowMoveDemo/LRParabolicDemo.vue +116 -0
  189. package/samples/ThrowMoveDemo/TargetDemo.vue +117 -0
  190. package/samples/ThrowMoveDemo/UDParabolicDemo.vue +122 -0
  191. package/samples/TransitPage/App.vue +41 -0
  192. package/samples/VideoDemo/App.vue +137 -0
  193. package/samples/VideoDemo/components/Button.vue +69 -0
  194. package/samples/VideoDemo/components/Controllor.vue +195 -0
  195. package/samples/VideoDemo/components/VideoFrame.vue +152 -0
  196. package/scripts/git-commit-empty.js +21 -0
  197. package/scripts/install-local-packages.js +121 -0
  198. package/scripts/make-js.sh +181 -0
  199. package/scripts/post-build.js +132 -0
  200. package/scripts/post-install.js +127 -0
  201. package/scripts/pre-pack.js +2 -0
  202. package/scripts/run-android.js +64 -0
  203. package/utils/JsViewEngineWidget/bin/shijiu-jsview-vue-widget-1.0.1.tgz +0 -0
  204. package/utils/JsViewEngineWidget/index.d.ts +32 -0
  205. package/utils/JsViewEngineWidget/index.js +6 -0
  206. package/utils/JsViewVueTools/DebugContentShellJBridge.js +16 -0
  207. package/utils/JsViewVueTools/DebugTool.js +21 -0
  208. package/utils/JsViewVueTools/DefaultKeyMap.js +12 -0
  209. package/utils/JsViewVueTools/JsvDynamicCssStyle.js +73 -0
  210. package/utils/JsViewVueTools/JsvDynamicKeyFrames.js +128 -0
  211. package/utils/JsViewVueTools/JsvHashHistory.js +112 -0
  212. package/utils/JsViewVueTools/JsvRuntimeBridge.js +417 -0
  213. package/utils/JsViewVueTools/JsvStyleClass.js +290 -0
  214. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +80 -0
  215. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +148 -0
  216. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +55 -0
  217. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/ApicDataBase.js +29 -0
  218. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +124 -0
  219. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/GifData.js +83 -0
  220. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/LoopToolBase.js +25 -0
  221. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/NormalLoopTool.js +61 -0
  222. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/PartLoopTool.js +119 -0
  223. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/Viewer.js +106 -0
  224. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/WebpData.js +141 -0
  225. package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetLoader.js +20 -0
  226. package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetWrapper.js +11 -0
  227. package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +204 -0
  228. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +64 -0
  229. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +427 -0
  230. package/utils/JsViewVueWidget/JsvActorMove/index.js +12 -0
  231. package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +179 -0
  232. package/utils/JsViewVueWidget/JsvApic/index.js +17 -0
  233. package/utils/JsViewVueWidget/JsvMarquee.vue +197 -0
  234. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +92 -0
  235. package/utils/JsViewVueWidget/JsvNinePatch.vue +76 -0
  236. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +351 -0
  237. package/utils/JsViewVueWidget/JsvPreload/index.js +21 -0
  238. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +140 -0
  239. package/utils/JsViewVueWidget/JsvQrcode/index.js +18 -0
  240. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +140 -0
  241. package/utils/JsViewVueWidget/JsvSpray/index.js +15 -0
  242. package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +448 -0
  243. package/utils/JsViewVueWidget/JsvSpriteAnim/SpriteController.js +57 -0
  244. package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +6 -0
  245. package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +35 -0
  246. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +495 -0
  247. package/utils/JsViewVueWidget/JsvSwiper/index.js +10 -0
  248. package/utils/JsViewVueWidget/JsvSwiper3D/Indicator.vue +35 -0
  249. package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +404 -0
  250. package/utils/JsViewVueWidget/JsvSwiper3D/index.js +10 -0
  251. package/utils/JsViewVueWidget/JsvTextBox.vue +111 -0
  252. package/utils/JsViewVueWidget/JsvVideo.vue +36 -0
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require('child_process');
4
+
5
+ function main() {
6
+ // 安装dom和widget
7
+ let cmdLine = "git diff --cached";
8
+ console.info("\nRunning [" + cmdLine + "]... ");
9
+ let ret = execSync(cmdLine, { stderr: "inherit" });
10
+ if(ret) {
11
+ console.error("\nError: There have same uncommitted files in cache, please cleanup first.");
12
+ process.exit(1);
13
+ }
14
+
15
+
16
+ // 安装dom和widget
17
+ cmdLine = "git commit --allow-empty -m \"强制版本+1\"";
18
+ console.info("\nRunning [" + cmdLine + "]... ");
19
+ execSync(cmdLine, { stdio: "inherit", stderr: "inherit" });
20
+ }
21
+ main();
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require("path");
4
+ const fs = require("fs");
5
+ const { execSync } = require('child_process');
6
+
7
+ function cpSync(workDir, src, dest) {
8
+ const exists = fs.existsSync(src);
9
+ const stats = exists && fs.statSync(src);
10
+ const isDirectory = exists && stats.isDirectory();
11
+ if (isDirectory) {
12
+ if (fs.existsSync(dest) == false) {
13
+ fs.mkdirSync(dest);
14
+ }
15
+ fs.readdirSync(src).forEach(function(childItemName) {
16
+ cpSync(
17
+ workDir,
18
+ path.join(src, childItemName),
19
+ path.join(dest, childItemName)
20
+ );
21
+ });
22
+ } else {
23
+ console.info(
24
+ " " + path.relative(workDir, src) + " -> " + path.relative(workDir, dest)
25
+ );
26
+ fs.copyFileSync(src, dest);
27
+ }
28
+ }
29
+
30
+ function rmSync(path) {
31
+ if (!!fs.rmSync) {
32
+ fs.rmSync(path, { recursive: true, force: true });
33
+ } else {
34
+ deleteFolderRecursive(path)
35
+ }
36
+ }
37
+
38
+ function deleteFolderRecursive(path) {
39
+ var files = [];
40
+ if (fs.existsSync(path)) {
41
+ files = fs.readdirSync(path);
42
+ files.forEach(function(file, index) {
43
+ var curPath = path + "/" + file;
44
+ if (fs.lstatSync(curPath).isDirectory()) {
45
+ // recurse
46
+ deleteFolderRecursive(curPath);
47
+ } else {
48
+ // delete file
49
+ fs.unlinkSync(curPath);
50
+ }
51
+ });
52
+ fs.rmdirSync(path);
53
+ }
54
+ }
55
+
56
+ function installPackages(options) {
57
+ // react/vue3共同的dom
58
+ const jsviewDomDir = options.rootDir + '/jsview/dom/bin/';
59
+ const jsviewDomPath = fs.readdirSync(jsviewDomDir).pop(); // 选择最后一个tgz
60
+ console.info('Found jsview-dom package: ' + jsviewDomDir + '/' + jsviewDomPath);
61
+ let cmdLine = "npm install file:" + jsviewDomDir + '/' + jsviewDomPath + " jsview-dom";
62
+ console.info("\nRunning [" + cmdLine + "]... ");
63
+ execSync(cmdLine, { stdio: "inherit", stderr: "inherit" });
64
+
65
+ // vue专有的widget
66
+ const jsviewReactWidgetDir = options.rootDir + '/jsview/utils/JsViewEngineWidget/bin/';
67
+ const jsviewReactWidgetPath = fs.readdirSync(jsviewReactWidgetDir).pop(); // 选择最后一个tgz
68
+ console.info('Found jsview-vue-widget package: ' + jsviewReactWidgetDir + '/' + jsviewReactWidgetPath);
69
+ cmdLine = "npm install file:" + jsviewReactWidgetDir + '/' + jsviewReactWidgetPath + " @shijiu-jsview/vue-widget";
70
+ console.info("\nRunning [" + cmdLine + "]... ");
71
+ execSync(cmdLine, { stdio: "inherit", stderr: "inherit" });
72
+
73
+ console.info("\nPatching jsview from " + options.patchDir);
74
+ cpSync(
75
+ options.rootDir,
76
+ options.patchDir + "/node_modules",
77
+ options.rootDir + "/node_modules"
78
+ );
79
+
80
+ console.info("\nCleanup node_modules cache... ");
81
+ const nodeModuleCacheDir = options.rootDir + "/node_modules/.cache";
82
+ rmSync(nodeModuleCacheDir);
83
+ }
84
+
85
+ async function printRevision(options) {
86
+ const jsveiwVersionFile = options.jsviewDir + "/dom/target_core_revision.js";
87
+
88
+ const jsviewTargetVersion = require(jsveiwVersionFile);
89
+
90
+ console.log("");
91
+ console.log("**************************************************");
92
+ console.log("* Update revision to:");
93
+ console.log("* CORE: " + jsviewTargetVersion.CoreRevision);
94
+ console.log("* ENGINE JS URL: " + jsviewTargetVersion.JseUrl);
95
+ console.log("**************************************************");
96
+ }
97
+
98
+ function backupPkgLock() {
99
+ const pkgLockName = 'package-lock.json';
100
+ const scriptDir = path.resolve(__dirname);
101
+ const rootDir = path.join(scriptDir, '/../../');
102
+
103
+ console.info("\nBackuping " + pkgLockName);
104
+ cpSync(rootDir, rootDir + pkgLockName, rootDir + '/jsview/patch/' + pkgLockName);
105
+ }
106
+
107
+ function main() {
108
+ const options = {
109
+ rootDir: path.resolve(__dirname, "../../"),
110
+ jsviewDir: path.resolve(__dirname, "../"),
111
+ patchDir: path.resolve(__dirname, "../patch"),
112
+ };
113
+
114
+
115
+ installPackages(options);
116
+
117
+ backupPkgLock();
118
+
119
+ printRevision(options);
120
+ }
121
+ main();
@@ -0,0 +1,181 @@
1
+ #!/bin/bash
2
+
3
+ set -o errexit
4
+ set -o nounset
5
+
6
+ print_usage()
7
+ {
8
+ echo '
9
+ NAME
10
+ make-js
11
+
12
+ SYNOPSIS
13
+ make-js
14
+
15
+ DESCRIPTION
16
+ build sample_with_button APK. auto setup code revision
17
+ Example: ./make-js
18
+
19
+ OPTIONS
20
+ --certpath=Path(from folder react_js) of certification, such as src/appConfig = react_js/src/appConfig/
21
+ default value is src/appConfig
22
+ -h, --help
23
+ Optional. Print help infomation and exit successfully.;
24
+ ';
25
+ }
26
+
27
+ parse_options()
28
+ {
29
+ cmd_getopt="getopt";
30
+ if [ "$KERNEL_NAME" == "Darwin" ]; then
31
+ cmd_getopt="/usr/local/Cellar/gnu-getopt/2.37.2/bin/getopt";
32
+ fi
33
+
34
+ options=`$cmd_getopt -o h \
35
+ --long "certpath:,help" \
36
+ -n 'make-js' -- "$@"`;
37
+ eval set -- "$options"
38
+ while true; do
39
+ case "$1" in
40
+ (-h | --help)
41
+ print_usage;
42
+ exit 0;
43
+ ;;
44
+ (--certpath)
45
+ CERT_PATH=$2;
46
+ shift 2;
47
+ ;;
48
+ (- | --)
49
+ shift;
50
+ break;
51
+ ;;
52
+ (*)
53
+ echo "Internal error!";
54
+ exit 1;
55
+ ;;
56
+ esac
57
+ done
58
+ }
59
+
60
+ logdbg()
61
+ {
62
+ if [[ $DEBUG_VERBOSE == false ]]; then
63
+ return;
64
+ fi
65
+
66
+ echo -e " [d]: $@";
67
+ }
68
+
69
+ logtrace()
70
+ {
71
+ echo -e "\033[1;34m [-]: $@ \033[00m";
72
+ }
73
+
74
+ loginfo()
75
+ {
76
+ echo -e "\033[1;32m [+]: $@ \033[00m";
77
+ }
78
+
79
+ logwarn()
80
+ {
81
+ echo -e "\033[1;33m [!]: $@ \033[00m";
82
+ }
83
+
84
+ logerr_and_exit()
85
+ {
86
+ echo -e "\033[1;31m [x]: $@ \033[00m";
87
+ exit 1;
88
+ }
89
+
90
+ trim() {
91
+ local var="$*"
92
+ var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
93
+ var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
94
+ echo -n "$var"
95
+ }
96
+
97
+ print_version_log()
98
+ {
99
+ logtrace "*********************************************************";
100
+ logtrace " Version infomation";
101
+ logtrace " codeRevision : ${CODE_REVISION}";
102
+ logtrace "*********************************************************";
103
+ }
104
+
105
+ prepare_env()
106
+ {
107
+ CODE_REVISION="$(git rev-list --count HEAD)";
108
+ }
109
+
110
+ # common variable
111
+ SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd);
112
+ PROJECT_DIR=$(dirname "$SCRIPT_DIR");
113
+ PROJECT_DIR=$(dirname "$PROJECT_DIR");
114
+ KERNEL_NAME=$(uname -s);
115
+ DEBUG_VERBOSE=false;
116
+ CERT_PATH=src/appConfig
117
+
118
+ # specific variable
119
+ CODE_REVISION=0;
120
+
121
+ main_run()
122
+ {
123
+ loginfo "parsing options";
124
+ parse_options $@;
125
+
126
+ loginfo "prepare env";
127
+ prepare_env;
128
+
129
+ print_version_log;
130
+
131
+ # TODO: cd 到vue工程代码的根目录(有node_modules的那个目录)
132
+ # cd react_js;
133
+
134
+ # 更新环境状态
135
+ #if [ -f "package-lock.json-perfect" ]; then
136
+ #loginfo "USE package-lock.json-perfect"
137
+ #cp package-lock.json-perfect package-lock.json
138
+ #fi
139
+ npm ci
140
+ #cd jsview/
141
+ #node scripts/do-patch.js
142
+ #cd ../
143
+
144
+ loginfo "CERT_PATH=${CERT_PATH}"
145
+
146
+ # 替换App为DemoHomepage
147
+ SED_CMD='sed -i ';
148
+ if [ "$KERNEL_NAME" == "Darwin" ]; then
149
+ SED_CMD+=' ""';
150
+ fi
151
+ $SED_CMD 's|@/App.vue|jsview/samples/DemoHomepage/App.vue|' src/main.ts;
152
+
153
+
154
+ # 生成crt和pem签名文件
155
+ cp ${CERT_PATH}/app_sign_private_key_sample.crt src/appConfig/app_sign_private_key.crt
156
+ cp ${CERT_PATH}/app_sign_public_key_sample.pem src/appConfig/app_sign_public_key.pem
157
+
158
+ # 编译JS
159
+ npm run-script build
160
+
161
+ # 输出主文件路径
162
+ local main_path=`find dist | grep "main\..*\.js$"`
163
+ echo "MAIN JS SUB_PATH: ${main_path}"
164
+
165
+ # 输出 Core 版本信息
166
+ local core_revision=`cat jsview/dom/target_core_revision.js | grep "CoreRevision"`
167
+ core_revision=${core_revision#*\"CoreRevision\":}; # 去掉开头
168
+ core_revision=${core_revision%,*}; # 去掉末尾的引号
169
+ echo "CORE REVISION: ${core_revision}"
170
+
171
+ # 输出 engineJs 信息
172
+ local engine_js=`cat jsview/dom/target_core_revision.js | grep "JsViewES6"`
173
+ engine_js=${engine_js#*\"}; # 去掉开头的引号
174
+ engine_js=${engine_js%\",*}; # 去掉末尾的引号
175
+ echo "ENGINE JS: ${engine_js}"
176
+
177
+ loginfo "DONE !!!";
178
+ loginfo "BUILD SUCCESSED";
179
+ }
180
+
181
+ main_run $@;
@@ -0,0 +1,132 @@
1
+ #!/usr/bin/env node
2
+
3
+ const crypto = require('crypto');
4
+ const fs = require('fs');
5
+ const md5 = require('md5.js');
6
+ const path = require('path');
7
+
8
+ // main.js处理AppData信息
9
+ function prepareMainAppData(options, fileMd5)
10
+ {
11
+
12
+ // 加载私钥文件
13
+ const privateKeyPath = 'src/appConfig/app_sign_private_key.crt';
14
+ const privateKeyFile = path.resolve(options.rootDir, privateKeyPath);
15
+ if (!fs.existsSync(privateKeyFile)) {
16
+ console.error('Failed to open private key file from ' + privateKeyPath);
17
+ process.exit(1);
18
+ }
19
+ const privateKeyText = fs.readFileSync(privateKeyFile);
20
+ if (privateKeyText.indexOf('-----BEGIN PRIVATE KEY-----') < 0) {
21
+ console.error('Get private from src/appConfig/app_sign_private_key.crt failed.');
22
+ process.exit(1);
23
+ }
24
+
25
+ // 加载公钥文件
26
+ const publicKeyPath = 'src/appConfig/app_sign_public_key.pem';
27
+ const publicKeyFile = path.resolve(options.rootDir, publicKeyPath);
28
+ if (!fs.existsSync(publicKeyFile)) {
29
+ console.error('Failed to open public key file from ' + publicKeyPath);
30
+ process.exit(1);
31
+ }
32
+ const publicKeyText = fs.readFileSync(publicKeyFile);
33
+ if (publicKeyText.indexOf('-----BEGIN PUBLIC KEY-----') < 0) {
34
+ console.error('Get private from src/appConfig/app_sign_public_key.pem failed.');
35
+ process.exit(1);
36
+ }
37
+ // 公钥格式转化pem -> der,因为java中的解码处理只识别der格式
38
+ let publicKeyDerText = publicKeyText.toString();
39
+ if (publicKeyDerText.indexOf('\r') >= 0) {
40
+ publicKeyDerText = publicKeyDerText.replace(/\r/g, '');
41
+ }
42
+ if (publicKeyDerText.indexOf('\n') >= 0) {
43
+ publicKeyDerText = publicKeyDerText.replace(/\n/g, '');
44
+ }
45
+ publicKeyDerText = publicKeyDerText.replace('-----BEGIN PUBLIC KEY-----', '');
46
+ publicKeyDerText = publicKeyDerText.replace('-----END PUBLIC KEY-----', '');
47
+
48
+ // 编码md5值
49
+ const encryptCodeBase64 = crypto.privateEncrypt({
50
+ key: privateKeyText,
51
+ padding: crypto.constants.RSA_PKCS1_PADDING
52
+ },
53
+ Buffer.from(fileMd5)
54
+ ).toString('base64');
55
+
56
+ // 校验publicKey是否是配对的
57
+ const decryptCode = crypto.publicDecrypt({
58
+ key: publicKeyText,
59
+ padding: crypto.constants.RSA_PKCS1_PADDING
60
+ },
61
+ Buffer.from(encryptCodeBase64, 'base64')
62
+ ).toString();
63
+ if (decryptCode !== fileMd5) {
64
+ console.error('Error: public key dismath to private key!');
65
+ process.exit(1);
66
+ }
67
+
68
+ // 获取AppData信息
69
+ const appConfigPath = 'src/appConfig/app_config.json';
70
+ const appConfigFile = path.resolve(options.rootDir, appConfigPath);
71
+ if (!fs.existsSync(appConfigFile)) {
72
+ console.error('Failed to open app config file from ' + appConfigPath);
73
+ process.exit(1);
74
+ }
75
+ const appConfigText = fs.readFileSync(appConfigFile);
76
+ const appDataOriginJson = JSON.parse(appConfigText);
77
+
78
+ // 组装AppData
79
+ let targetAppData = {};
80
+ Object.assign(targetAppData, appDataOriginJson); // 同步包括AppName在内的所有信息
81
+ targetAppData.PublicKeys = [publicKeyDerText]; // 使用签名数组,支持后续追加签名
82
+ targetAppData.EncryptCodes = [encryptCodeBase64]; // 同样使用数组,支持后续追加
83
+
84
+ return JSON.stringify(targetAppData);
85
+ }
86
+
87
+ function signApp(options)
88
+ {
89
+ const jsDir = path.resolve(options.distDir, 'js');
90
+ const jsFiles = fs.readdirSync(jsDir);
91
+ jsFiles.forEach((file, index) => {
92
+ if (!file.endsWith('.js')) {
93
+ return;
94
+ }
95
+
96
+ const jsFile = path.resolve(jsDir, file);
97
+ console.log('Updating ' + path.relative(options.rootDir, jsFile));
98
+
99
+ var jsvAppContents = fs.readFileSync(jsFile);
100
+ const jsvAppMd5 = new md5().update(jsvAppContents).digest('hex');
101
+ let appDataInfo = '';
102
+ if (jsFile.indexOf('main.jsv.') > 0) {
103
+ // 对main文件加入应用头信息
104
+ appDataInfo = prepareMainAppData(options, jsvAppMd5);
105
+
106
+ // 格式化jsvapp信息 /*jsvapp:内容长度:{内容}*/
107
+ // 使用TextEncoder解决中文长度问题
108
+ const infoLen = new TextEncoder().encode(appDataInfo).length;
109
+ appDataInfo = '/*jsvapp:' + infoLen + ':' + appDataInfo + '*/';
110
+ }
111
+ jsvAppContents = '/*jsvmd5:' + jsvAppMd5 + '*/' + appDataInfo + jsvAppContents;
112
+ fs.writeFileSync(jsFile, jsvAppContents);
113
+ });
114
+ }
115
+
116
+ function main() {
117
+ const rootDir = process.cwd();
118
+ const options = {
119
+ rootDir: rootDir,
120
+ jsviewDir: path.resolve(rootDir, 'jsview'),
121
+ patchDir: path.resolve(rootDir, 'jsview/patch'),
122
+ distDir: path.resolve(rootDir, 'dist'),
123
+ };
124
+
125
+ console.info('Signing JsView App...');
126
+ console.info();
127
+ signApp(options);
128
+ console.info();
129
+ console.info('Sign complete.');
130
+ }
131
+
132
+ main();
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require("path");
4
+ const fs = require("fs");
5
+ const { execSync } = require('child_process');
6
+
7
+ function cpSync(workDir, src, dest) {
8
+ const exists = fs.existsSync(src);
9
+ const stats = exists && fs.statSync(src);
10
+ const isDirectory = exists && stats.isDirectory();
11
+ if (isDirectory) {
12
+ if (fs.existsSync(dest) == false) {
13
+ fs.mkdirSync(dest);
14
+ }
15
+ fs.readdirSync(src).forEach(function(childItemName) {
16
+ cpSync(
17
+ workDir,
18
+ path.join(src, childItemName),
19
+ path.join(dest, childItemName)
20
+ );
21
+ });
22
+ } else {
23
+ console.info(
24
+ " " + path.relative(workDir, src) + " -> " + path.relative(workDir, dest)
25
+ );
26
+ fs.copyFileSync(src, dest);
27
+ }
28
+ }
29
+
30
+ function rmSync(path) {
31
+ if (!!fs.rmSync) {
32
+ fs.rmSync(path, { recursive: true, force: true });
33
+ } else {
34
+ deleteFolderRecursive(path)
35
+ }
36
+ }
37
+
38
+ function deleteFolderRecursive(path) {
39
+ var files = [];
40
+ if (fs.existsSync(path)) {
41
+ files = fs.readdirSync(path);
42
+ files.forEach(function(file, index) {
43
+ var curPath = path + "/" + file;
44
+ if (fs.lstatSync(curPath).isDirectory()) {
45
+ // recurse
46
+ deleteFolderRecursive(curPath);
47
+ } else {
48
+ // delete file
49
+ fs.unlinkSync(curPath);
50
+ }
51
+ });
52
+ fs.rmdirSync(path);
53
+ }
54
+ }
55
+
56
+ function checkNpmCommand() {
57
+ let command = process.env.npm_command;
58
+ if(!command) {
59
+ command = process.env.npm_config_refer; // for linux
60
+ }
61
+ if(command == 'ci') {
62
+ return;
63
+ }
64
+
65
+ console.warn();
66
+ console.warn(`!!! Warn: Not recommended for use 'npm ${process.env.npm_command} '.`);
67
+ console.warn("Please use 'npm ci' to install node modules.");
68
+ console.warn();
69
+ }
70
+
71
+ function installDepends(options) {
72
+ // react/vue3共同的dom
73
+ //const jsviewDomPath =
74
+ //options.rootDir + "/jsview/dom/bin/jsview-dom-1.0.1.tgz";
75
+
76
+ // react专有的widget
77
+ //const jsviewReactWidgetPath =
78
+ //options.rootDir +
79
+ //"/jsview/utils/JsViewEngineWidget/bin/shijiu-jsview-vue-widget-1.0.0.tgz";
80
+
81
+ // 安装dom和widget
82
+ // 废弃:通过package依赖安装
83
+ //const cmdLine =
84
+ //"npm install file:" + jsviewDomPath + " file:" + jsviewReactWidgetPath;
85
+ //console.info("\nRunning [" + cmdLine + "]... ");
86
+ //execSync(cmdLine, { stdio: "inherit", stderr: "inherit" });
87
+
88
+ console.info("\nPatching jsview from " + options.patchDir);
89
+ cpSync(
90
+ options.rootDir,
91
+ options.patchDir + "/node_modules",
92
+ options.rootDir + "/node_modules"
93
+ );
94
+
95
+ console.info("\nCleanup node_modules cache... ");
96
+ const nodeModuleCacheDir = options.rootDir + "/node_modules/.cache";
97
+ rmSync(nodeModuleCacheDir);
98
+ }
99
+
100
+ async function printRevision(options) {
101
+ const jsveiwVersionFile = options.jsviewDir + "/dom/target_core_revision.js";
102
+
103
+ const jsviewTargetVersion = require(jsveiwVersionFile);
104
+
105
+ console.log("**************************************************");
106
+ console.log("* Update revision to:");
107
+ console.log("* CORE: " + jsviewTargetVersion.CoreRevision);
108
+ console.log("* ENGINE JS URL: " + jsviewTargetVersion.JseUrl);
109
+ console.log("**************************************************");
110
+ }
111
+
112
+ function main() {
113
+ const rootDir = process.cwd();
114
+ const options = {
115
+ rootDir: rootDir,
116
+ jsviewDir: path.resolve(rootDir, "jsview"),
117
+ patchDir: path.resolve(rootDir, "jsview/patch"),
118
+ distDir: path.resolve(rootDir, "dist"),
119
+ };
120
+
121
+ checkNpmCommand();
122
+
123
+ installDepends(options);
124
+
125
+ printRevision(options);
126
+ }
127
+ main();
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+
3
+ const childProcess = require('child_process');
4
+ const path = require('path');
5
+
6
+ function getOptions() {
7
+ const options = {
8
+ androidPackage: "com.qcode.jsview.sample_demo/com.qcode.jsview.sample.SingleActivity",
9
+ coreRevision: null,
10
+ jseUrl: null,
11
+ homepageUrl: null,
12
+ }
13
+
14
+ if (process.argv.length >= 3) {
15
+ options.androidPackage = process.argv[2];
16
+ }
17
+
18
+ const rootDir = process.cwd();
19
+ const jsviewDir = path.resolve(rootDir, 'jsview');
20
+ const jsveiwVersionFile = path.resolve(jsviewDir, 'dom/target_core_revision.js');
21
+ const jsviewTargetVersion = require(jsveiwVersionFile);
22
+ options.coreRevision = jsviewTargetVersion.CoreRevision;
23
+ options.jseUrl = jsviewTargetVersion.JseUrl;
24
+
25
+ const homepageUrlFile = path.resolve(rootDir, 'node_modules/.cache/jsview/network');
26
+ let homepageUrl = require(homepageUrlFile);
27
+ homepageUrl = homepageUrl.replace(/\u001b\[.*?m/g, '')
28
+ options.homepageUrl = homepageUrl + "js/main.jsv.js";
29
+
30
+ return options;
31
+ }
32
+
33
+ function printRevision(options) {
34
+ console.log("**************************************************");
35
+ console.log("* Android Package: " + options.androidPackage);
36
+ console.log("* Core: " + options.coreRevision);
37
+ console.log("* Engine JS url: " + options.jseUrl);
38
+ console.log("* Homepage url: " + options.homepageUrl);
39
+ console.log("**************************************************");
40
+ }
41
+
42
+ function androidStartActivity(options) {
43
+ let cmdline = "adb shell am start";
44
+ cmdline += ` -n ${options.androidPackage}`;
45
+ cmdline += ` --es COREVERSIONRANGE "${options.coreRevision}"`;
46
+ cmdline += ` --es ENGINE "${options.jseUrl}"`;
47
+ cmdline += ` --es URL "${options.homepageUrl}"`;
48
+ console.log(`Run command: ${cmdline}\n`);
49
+ try {
50
+ childProcess.execSync(cmdline, {stdio: [0, 1, 2]});
51
+ } catch (e) {
52
+ // console.log(e);
53
+ }
54
+ }
55
+
56
+
57
+ function main() {
58
+ const options = getOptions();
59
+
60
+ printRevision(options);
61
+
62
+ androidStartActivity(options);
63
+ }
64
+ main()
@@ -0,0 +1,32 @@
1
+ // 添加jsvCreateFocusManager的声明
2
+ export declare function jsvCreateFocusManager(): Plugin_2;
3
+
4
+ // 添加JsvFocusManager的声明
5
+ export declare interface JsvFocusManager {
6
+ // declareAlias(alias: String, block?: String): Void;
7
+ // changeFocusTo(nameOrSpace: String, name?: String, exact?: Boolean): Void
8
+ }
9
+
10
+ declare module '@vue/runtime-core' {
11
+ export interface ComponentCustomProperties {
12
+ $jsvFocusManager: JsvFocusManager
13
+ }
14
+ }
15
+
16
+ // 添加JsvFocusBlock的声明
17
+ export declare interface JsvFocusBlock {
18
+ getName(): String;
19
+ getNamespace(): String;
20
+ findBlockByName(name: String): JsvFocusBlock;
21
+ requestFocus(): Void
22
+ debugPrintFocusChain(): Void
23
+ debugPrintLastFocus(): Void
24
+ }
25
+
26
+ // 添加JsvFocusEvent的声明
27
+ export declare interface JsvFocusEvent {
28
+ ownerNode: JsvFocusBlock;
29
+ type: string;
30
+ keyCode: number;
31
+ key: string;
32
+ }
@@ -0,0 +1,6 @@
1
+ // Release Entry
2
+ export * from "@shijiu-jsview/vue-widget"
3
+
4
+ // Debug Entry
5
+ // TODO: 进行编译(yarn build)时,需要关闭掉此require
6
+ // export * from "./code"