@tuya-sat/micro-dev-loader 0.0.1-beta.1 → 0.0.2

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.
@@ -1,187 +1,180 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en" style="margin: 0; padding: 0;">
3
- <head>
4
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
5
- <meta charset="utf-8">
6
- <link rel="icon" href="favicon.ico">
7
- <meta name="viewport" content="width=device-width,initial-scale=1">
8
- <meta name="theme-color" content="#000000">
9
- <meta name="description" content="Tuya General Management Portal">
10
- <title>IoT SaaS App</title>
11
- <link href="/layout-static/2.c7981cdc.chunk.css" rel="stylesheet">
12
- <link href="/layout-static/main.efdba179.chunk.css" rel="stylesheet">
13
- </head>
14
- <body style="margin: 0; padding: 0;">
2
+ <html lang="en" style="margin: 0; padding: 0">
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
5
+ <meta charset="utf-8" />
6
+ <link rel="icon" href="favicon.ico" />
7
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
8
+ <meta name="theme-color" content="#000000" />
9
+ <meta name="description" content="Tuya General Management Portal" />
10
+ <title><%= appName %></title>
11
+ <style>
12
+ .c-debugger-container {
13
+ width: 100vw;
14
+ height: 100vh;
15
+ display: flex;
16
+ flex-direction: column;
17
+ }
18
+ .c-debugger-header {
19
+ flex: 0 0 auto;
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: space-between;
23
+ height: 55px;
24
+ padding: 0 16px;
25
+ border-bottom: 1px solid #eee;
26
+ color: rgba(0, 0, 0, 0.85);
27
+ }
28
+ .c-debugger-logo {
29
+ position: relative;
30
+ overflow: hidden;
31
+ display: flex;
32
+ align-items: center;
33
+ }
34
+ .c-debugger-title {
35
+ color: #000;
36
+ font-size: 14px;
37
+ font-weight: 700;
38
+ height: 32px;
39
+ line-height: 32px;
40
+ margin: 0 0 0 12px;
41
+ }
42
+ .c-debugger-main {
43
+ display: flex;
44
+ flex: 1 1 auto;
45
+ }
46
+ .c-debugger-side {
47
+ flex: 0 0 auto;
48
+ width: 208px;
49
+ height: 100%;
50
+ border-right: 1px solid #f0f2f5;
51
+ }
52
+ .c-debugger-content {
53
+ flex: 1 1 auto;
54
+ height: 100%;
55
+ background-color: #f0f2f5;
56
+ }
57
+ #root {
58
+ width: 100%;
59
+ height: 100%;
60
+ }
61
+ .c-debugger-lang-trigger {
62
+ position: relative;
63
+ display: flex;
64
+ align-items: center;
65
+ white-space: nowrap;
66
+ cursor: pointer;
67
+ font-size: 14px;
68
+ font-weight: normal;
69
+ height: 100%;
70
+ }
71
+ .c-debugger-lang-trigger:hover .c-debugger-lang-list {
72
+ display: block;
73
+ line-height: 1.5;
74
+ }
75
+ .c-debugger-lang-trigger .c-debugger-lang-list {
76
+ position: absolute;
77
+ top: 42px;
78
+ right: -5px;
79
+ display: none;
80
+ background: #ffffff;
81
+ border-radius: 2px;
82
+ outline: none;
83
+ box-shadow: 0 3px 6px -4px rgb(0 0 0 / 12%),
84
+ 0 6px 16px 0 rgb(0 0 0 / 8%), 0 9px 28px 8px rgb(0 0 0 / 5%);
85
+ }
86
+ .c-debugger-lang-trigger .c-debugger-lang-list span {
87
+ display: block;
88
+ padding: 5px 12px;
89
+ }
90
+ .c-debugger-lang-trigger .c-debugger-lang-list span:hover {
91
+ background-color: #f5f5f5;
92
+ }
93
+ .c-debugger-menu {
94
+ display: flex;
95
+ justify-content: flex-start;
96
+ align-items: center;
97
+ height: 40px;
98
+ padding: 0 0 0 17px;
99
+ margin: 4px 0 8px;
100
+ cursor: pointer;
101
+ font-size: 14px;
102
+ color: rgba(0, 0, 0, 0.85);
103
+ }
104
+ .c-debugger-menu-name {
105
+ margin-left: 10px;
106
+ }
107
+ .c-debugger-menu:hover {
108
+ color: #1890ff;
109
+ }
110
+ </style>
111
+ </head>
112
+ <body style="margin: 0; padding: 0">
113
+ <div class="c-debugger-container">
114
+ <div class="c-debugger-header">
115
+ <div class="c-debugger-logo">
116
+ <img
117
+ src="https://promotion-static.tuyacn.com/static/242969466160533504.png"
118
+ alt=""
119
+ style="height: 28px"
120
+ />
121
+ <div class="c-debugger-title"><%= appName %></div>
122
+ </div>
15
123
 
16
- <div id="mock-root">
17
- <div>
18
- <div class="pro-layout-master ant-design-pro ant-pro-basicLayout screen-xl ant-pro-basicLayout-fix-siderbar ant-pro-basicLayout-mix">
19
- <section class="ant-layout ant-layout-has-sider" style="min-height: 100%;">
20
- <div id="J_sider-slot" style="width: 208px; overflow: hidden; flex: 0 0 208px; max-width: 208px; min-width: 208px; transition: background-color 0.3s ease 0s, min-width 0.3s ease 0s, max-width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1) 0s;"></div>
21
- <aside
22
- id="J_sider"
23
- class="ant-layout-sider ant-layout-sider-light ant-pro-sider ant-pro-sider-fixed ant-pro-sider-layout-mix ant-pro-sider-light"
24
- style="overflow: hidden; padding-top: 48px; flex: 0 0 208px; max-width: 208px; min-width: 208px; width: 208px;"
25
- >
26
- <div class="ant-layout-sider-children">
27
- <div style="flex: 1 1 0%; overflow: hidden auto;">
28
- <% if (menus.length>0) { %>
29
- <ul class="ant-menu ant-menu-light ant-pro-sider-menu ant-menu-root ant-menu-inline" role="menu" style="width: 100%;">
30
- <li class="ant-menu-submenu ant-menu-submenu-inline ant-menu-submenu-open" role="menuitem">
31
- <div class="ant-menu-submenu-title" role="button" aria-expanded="true" aria-haspopup="true" aria-owns="/apps/1440611125199634515$Menu" style="padding-left: 16px;">
32
- <span class="ant-pro-menu-item" title="工单管理">
33
- <span class="ant-menu-item-icon">
34
- <img src="<%= appIcon %>" alt="" style="width: 16px; height: 16px; margin-top: -2px; margin-right: 10px;">
35
- </span>
36
- <span class="ant-pro-menu-item-title"><%= appName %></span>
37
- </span>
38
- <i class="ant-menu-submenu-arrow"></i>
39
- </div>
40
- <ul id="/apps/1440611125199634515$Menu" class="ant-menu ant-menu-sub ant-menu-inline" role="menu" style="">
41
- <% menus.forEach(function(menu){%>
42
- <li class="ant-menu-item ant-menu-item-only-child" role="menuitem" style="padding-left: 32px;">
43
- <a onclick="toPage('<%=menu.path %>')" style="height: 40px;">
44
- <span class="ant-pro-menu-item">
45
- <span class="ant-pro-menu-item-title"><%=menu.langName %></span>
46
- </span>
47
- </a>
48
- </li>
49
- <% }) %>
50
- </ul>
51
- </li>
52
- </ul>
53
- <%} else { %>
54
- <ul style="width: 100%;" class="ant-menu ant-menu-light ant-pro-sider-menu ant-menu-root ant-menu-inline" role="menu">
55
- <li class="ant-menu-item ant-menu-item-only-child" role="menuitem" style="padding-left: 16px;">
56
- <a style="height: 40px;" href="/">
57
- <span class="ant-pro-menu-item">
58
- <span class="ant-menu-item-icon">
59
- <img src="<%= appIcon %>" alt='' style="width: 16px; height: 16px; margin-top: -2px; margin-right: 10px;">
60
- </span>
61
- <span class="ant-pro-menu-item-title"><%= appName %></span>
62
- </span>
63
- </a>
64
- </li>
65
- </ul>
66
- <% } %>
67
- </div>
68
- <div class="ant-pro-sider-links">
69
- <ul class="ant-menu ant-menu-light ant-pro-sider-link-menu ant-menu-root ant-menu-inline" role="menu">
70
- <li
71
- id="J_sider-trigger"
72
- class="ant-menu-item ant-menu-item-only-child ant-pro-sider-collapsed-button"
73
- role="menuitem"
74
- style="padding-left: 16px;"
75
- >
76
- <span role="img" aria-label="menu-fold" class="anticon anticon-menu-fold">
77
- <svg viewBox="64 64 896 896" focusable="false" data-icon="menu-fold" width="1em" height="1em" fill="currentColor" aria-hidden="true">
78
- <path
79
- d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 000 13.8z"></path>
80
- </svg>
81
- </span>
82
- </li>
83
- </ul>
84
- </div>
124
+ <div class="c-debugger-lang-trigger">
125
+ <span id="c-debugger-lang-name"></span>
126
+ <div class="c-debugger-lang-list">
127
+ <span onclick="changeLng('en-US')">English</span>
128
+ <span onclick="changeLng('zh-CN')">简体中文</span>
85
129
  </div>
86
- </aside>
87
-
88
- <div style="position: relative;" class="ant-layout">
89
- <header class="ant-layout-header" style="height: 48px;"></header>
90
- <header class="ant-layout-header ant-pro-fixed-header ant-pro-fixed-header-action" style="padding: 0px; height: 48px; line-height: 48px; width: 100%; z-index: 100; right: 0px;">
91
- <div class="ant-pro-global-header">
92
- <div class="ant-pro-global-header-logo" style="flex: 1;">
93
- <a>
94
- <img src="https://images.tuyacn.com/rms-static/3bb090e0-d7e2-11eb-815d-e39234ce96ff-1624865222894.png" alt='' style="height: 28px;">
95
- <h1>IoT SaaS App Demo</h1>
96
- </a>
97
- </div>
98
- <style>
99
- .lang-trigger {
100
- position: relative;
101
- white-space: nowrap;
102
- cursor: pointer;
103
- }
104
- .lang-trigger:hover .lang-list {
105
- display: block;
106
- line-height: 1.5;
107
- }
108
- .lang-trigger .lang-list {
109
- position: absolute;
110
- top: 40px;
111
- right: 0;
112
- display: none;
113
- background: #ffffff;
114
- border-radius: 2px;
115
- outline: none;
116
- box-shadow: 0 3px 6px -4px rgb(0 0 0 / 12%), 0 6px 16px 0 rgb(0 0 0 / 8%), 0 9px 28px 8px rgb(0 0 0 / 5%);
117
- }
118
- .lang-trigger .lang-list span {
119
- display: block;
120
- padding: 5px 12px;
121
- }
122
- .lang-trigger .lang-list span:hover {
123
- background-color: #f5f5f5;
124
- }
125
- </style>
126
- <span class="lang-trigger">
127
- <span id="J_lng-name"></span>
128
- <div class="lang-list">
129
- <span onclick="changeLng('en-US')">English</span>
130
- <span onclick="changeLng('zh-CN')">简体中文</span>
131
- </div>
132
- </span>
133
- <script>
134
- ;(() => {
135
- const lngMap = {
136
- 'en-US': 'English',
137
- 'zh-CN': '简体中文',
138
- };
139
- const lng = localStorage.getItem('i18nextLng') || 'zh-CN';
140
- document.querySelector('#J_lng-name').innerHTML = lngMap[lng];
141
- })();
142
-
143
- function changeLng(lng, name) {
144
- localStorage.setItem('i18nextLng', lng);
145
- location.reload();
146
- }
147
- function toPage(path){
148
- mhistory && mhistory.push(path);
149
- }
150
- </script>
151
- </div>
152
- </header>
153
- <main
154
- class="ant-layout-content ant-pro-basicLayout-content ant-pro-basicLayout-has-header"
155
- style="margin: 0;"
156
- >
157
- <div id="container" style="height: calc(-56px + 100vh);"><div id="__qiankun_microapp_wrapper_for_demo" style="height: 100%">
158
-
159
- <%- appHtml %>
160
-
161
- </div></div>
162
- </main>
163
130
  </div>
164
- </section>
131
+ </div>
132
+ <div class="c-debugger-main">
133
+ <div class="c-debugger-side">
134
+ <% menus.forEach(function(menu){ %>
135
+ <div class="c-debugger-menu" onclick="toPage('<%= menu.path %>')">
136
+ <svg
137
+ viewBox="0 0 1024 1024"
138
+ version="1.1"
139
+ xmlns="http://www.w3.org/2000/svg"
140
+ p-id="2323"
141
+ width="14"
142
+ height="14"
143
+ >
144
+ <path
145
+ d="M192.037 287.953h640.124c17.673 0 32-14.327 32-32s-14.327-32-32-32H192.037c-17.673 0-32 14.327-32 32s14.327 32 32 32zM192.028 543.17h638.608c17.673 0 32-14.327 32-32s-14.327-32-32-32H192.028c-17.673 0-32 14.327-32 32s14.327 32 32 32zM832.161 735.802H192.037c-17.673 0-32 14.327-32 32s14.327 32 32 32h640.124c17.673 0 32-14.327 32-32s-14.327-32-32-32z"
146
+ fill=""
147
+ p-id="2324"
148
+ ></path>
149
+ </svg>
150
+ <div class="c-debugger-menu-name"><%= menu.langName %></div>
151
+ </div>
152
+ <% }); %>
153
+ </div>
154
+ <div class="c-debugger-content"><%- appHtml %></div>
155
+ </div>
165
156
  </div>
166
- </div>
167
- </div>
168
- <script>
169
- ;(function() {
170
- const $$ = document.querySelector.bind(document);
171
- const $sider = $$('#J_sider');
172
- const $siderSlot = $$('#J_sider-slot');
173
- const $siderTrigger = $$('#J_sider-trigger');
174
- let unfold = true;
157
+ <script>
158
+ (() => {
159
+ const lngMap = {
160
+ "en-US": "English",
161
+ "zh-CN": "简体中文",
162
+ };
163
+ const localLng = localStorage.getItem("i18nextLng");
164
+ const lng = lngMap[localLng] ? localLng : "zh-CN";
165
+ console.log(lng);
166
+ document.querySelector("#c-debugger-lang-name").textContent =
167
+ lngMap[lng];
168
+ })();
169
+
170
+ function toPage(path) {
171
+ window.location.href = new URL(path, window.location.origin);
172
+ }
175
173
 
176
- $siderTrigger.addEventListener('click', () => {
177
- ['width', 'max-width', 'min-width'].forEach((name) => {
178
- const width = `${unfold ? 208 : 48}px`;
179
- $sider.style[name] = width;
180
- $siderSlot.style[name] = width;
181
- });
182
- unfold = !unfold;
183
- });
184
- }());
185
- </script>
186
- </body>
174
+ function changeLng(lng, name) {
175
+ localStorage.setItem("i18nextLng", lng);
176
+ location.reload();
177
+ }
178
+ </script>
179
+ </body>
187
180
  </html>
package/dist/transform.js CHANGED
@@ -1,117 +1,117 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const core_1 = require("@babel/core");
7
- const template_1 = __importDefault(require("@babel/template"));
8
- const generator_1 = __importDefault(require("@babel/generator"));
9
- const plugin_syntax_typescript_1 = __importDefault(require("@babel/plugin-syntax-typescript"));
10
- const VUE_TYPES = ["VUE_TS", "VUE_JS"];
11
- const REACT_TYPES = ["REACT_TS", "REACT_JS"];
12
- class CodeMaker {
13
- constructor({ sourceCode, microFramework }) {
14
- this.ast = this.parse(sourceCode);
15
- this.microFramework = microFramework;
16
- }
17
- parse(code) {
18
- return (0, core_1.parse)(code, {
19
- plugins: [
20
- [
21
- plugin_syntax_typescript_1.default,
22
- {
23
- isTSX: true,
24
- allExtensions: true,
25
- },
26
- ],
27
- ],
28
- });
29
- }
30
- changeAst(props) {
31
- const temp = this.getTemp(props);
32
- (0, core_1.traverse)(this.ast, {
33
- ExportNamedDeclaration(path) {
34
- let isTarget = false;
35
- try {
36
- isTarget =
37
- path.node.declaration.kind === "let" &&
38
- path.node.declaration.declarations[0].id.name ===
39
- "hasPermission";
40
- }
41
- catch (_a) { }
42
- if (!isTarget) {
43
- return;
44
- }
45
- let tempNode = template_1.default.ast(temp);
46
- path.insertAfter(tempNode);
47
- },
48
- });
49
- }
50
- gtAst() {
51
- const { code } = (0, generator_1.default)(this.ast);
52
- return code;
53
- }
54
- vueReRenderTemp() {
55
- return `
56
- const reRender = () => {
57
- app.unmount()
58
- render({})
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.default = void 0;
6
+ var _core = require("@babel/core");
7
+ var _template = _interopRequireDefault(require("@babel/template"));
8
+ var _generator = _interopRequireDefault(require("@babel/generator"));
9
+ var _pluginSyntaxTypescript = _interopRequireDefault(require("@babel/plugin-syntax-typescript"));
10
+ function _classCallCheck(instance, Constructor) {
11
+ if (!(instance instanceof Constructor)) {
12
+ throw new TypeError("Cannot call a class as a function");
59
13
  }
60
- `;
61
- }
62
- reactReRenderTemp() {
63
- return `
64
- const reRender = () => {
65
- ReactDOM.unmountComponentAtNode(document.querySelector('#root'))
66
- render({})
14
+ }
15
+ function _defineProperties(target, props) {
16
+ for(var i = 0; i < props.length; i++){
17
+ var descriptor = props[i];
18
+ descriptor.enumerable = descriptor.enumerable || false;
19
+ descriptor.configurable = true;
20
+ if ("value" in descriptor) descriptor.writable = true;
21
+ Object.defineProperty(target, descriptor.key, descriptor);
67
22
  }
68
- `;
23
+ }
24
+ function _createClass(Constructor, protoProps, staticProps) {
25
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
26
+ if (staticProps) _defineProperties(Constructor, staticProps);
27
+ return Constructor;
28
+ }
29
+ function _interopRequireDefault(obj) {
30
+ return obj && obj.__esModule ? obj : {
31
+ default: obj
32
+ };
33
+ }
34
+ var VUE_TYPES = [
35
+ "VUE_TS",
36
+ "VUE_JS"
37
+ ];
38
+ var REACT_TYPES = [
39
+ "REACT_TS",
40
+ "REACT_JS"
41
+ ];
42
+ var CodeMaker = /*#__PURE__*/ function() {
43
+ "use strict";
44
+ function CodeMaker(param) {
45
+ var sourceCode = param.sourceCode, microFramework = param.microFramework;
46
+ _classCallCheck(this, CodeMaker);
47
+ this.ast = this.parse(sourceCode);
48
+ this.microFramework = microFramework;
69
49
  }
70
- getTemp(props) {
71
- const { privileges, authedCode } = props;
72
- const temp = `
73
- {
74
- window._allCodesStatusMap = new Map()
75
- window._authedCodeInfoProxy = {}
76
- hasPermission = (code) => {
77
- return window._allCodesStatusMap.get(code)
78
- };
79
- const changeAuthedMap = (authedCode) => {
80
- const privileges = ${JSON.stringify(privileges)}
81
- const allCodesStatus = privileges?.map(
82
- ({ name, code }) => [
83
- code,
84
- authedCode.includes(code),
85
- ]
86
- );
87
- window._allCodesStatusMap = new Map(allCodesStatus)
88
- }
89
-
90
- ${REACT_TYPES.includes(this.microFramework)
91
- ? this.reactReRenderTemp()
92
- : this.vueReRenderTemp()}
93
- const authedCodeInfo = {
94
- authedCode:${JSON.stringify(authedCode)}
95
- }
96
-
97
- changeAuthedMap(authedCodeInfo.authedCode)
98
- window._authedCodeInfoProxy = new Proxy(authedCodeInfo,{
99
- get(target,prop){
100
- return target[prop]
101
- },
102
- set(target,prop,value){
103
- if(prop === 'authedCode') {
104
- changeAuthedMap(value)
105
- reRender()
50
+ _createClass(CodeMaker, [
51
+ {
52
+ key: "parse",
53
+ value: function parse(code) {
54
+ return (0, _core).parse(code, {
55
+ plugins: [
56
+ [
57
+ _pluginSyntaxTypescript.default,
58
+ {
59
+ isTSX: true,
60
+ allExtensions: true
61
+ },
62
+ ],
63
+ ]
64
+ });
106
65
  }
107
- target[prop] = value
108
- return true
109
- }
110
- })
111
-
112
- }
113
- `;
114
- return temp;
115
- }
116
- }
66
+ },
67
+ {
68
+ key: "changeAst",
69
+ value: function changeAst(props) {
70
+ var temp = this.getTemp(props);
71
+ (0, _core).traverse(this.ast, {
72
+ ExportNamedDeclaration: function ExportNamedDeclaration(path) {
73
+ var isTarget = false;
74
+ try {
75
+ isTarget = path.node.declaration.kind === "let" && path.node.declaration.declarations[0].id.name === "hasPermission";
76
+ } catch (e) {
77
+ }
78
+ if (!isTarget) {
79
+ return;
80
+ }
81
+ var tempNode = _template.default.ast(temp);
82
+ path.insertAfter(tempNode);
83
+ }
84
+ });
85
+ }
86
+ },
87
+ {
88
+ key: "gtAst",
89
+ value: function gtAst() {
90
+ var code = (0, _generator).default(this.ast).code;
91
+ return code;
92
+ }
93
+ },
94
+ {
95
+ key: "vueReRenderTemp",
96
+ value: function vueReRenderTemp() {
97
+ return "\n const reRender = () => {\n app.unmount()\n render({})\n }\n ";
98
+ }
99
+ },
100
+ {
101
+ key: "reactReRenderTemp",
102
+ value: function reactReRenderTemp() {
103
+ return "\n const reRender = () => {\n ReactDOM.unmountComponentAtNode(document.querySelector('#root'))\n render({})\n }\n ";
104
+ }
105
+ },
106
+ {
107
+ key: "getTemp",
108
+ value: function getTemp(props) {
109
+ var privileges = props.privileges, authedCode = props.authedCode;
110
+ var temp = "\n {\n window._allCodesStatusMap = new Map()\n window._authedCodeInfoProxy = {}\n hasPermission = (code) => {\n return window._allCodesStatusMap.get(code)\n };\n const changeAuthedMap = (authedCode) => {\n const privileges = ".concat(JSON.stringify(privileges), "\n const allCodesStatus = privileges?.map(\n ({ name, code }) => [\n code,\n authedCode.includes(code),\n ]\n );\n window._allCodesStatusMap = new Map(allCodesStatus)\n }\n \n ").concat(REACT_TYPES.includes(this.microFramework) ? this.reactReRenderTemp() : this.vueReRenderTemp(), "\n const authedCodeInfo = {\n authedCode:").concat(JSON.stringify(authedCode), "\n }\n \n changeAuthedMap(authedCodeInfo.authedCode)\n window._authedCodeInfoProxy = new Proxy(authedCodeInfo,{\n get(target,prop){\n return target[prop]\n },\n set(target,prop,value){\n if(prop === 'authedCode') {\n changeAuthedMap(value)\n reRender()\n }\n target[prop] = value\n return true\n }\n })\n\n }\n ");
111
+ return temp;
112
+ }
113
+ }
114
+ ]);
115
+ return CodeMaker;
116
+ }();
117
117
  exports.default = CodeMaker;
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_extra_1 = __importDefault(require("fs-extra"));
7
- const path_1 = __importDefault(require("path"));
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.default = parseManifest;
6
+ var _fsExtra = _interopRequireDefault(require("fs-extra"));
7
+ var _path = _interopRequireDefault(require("path"));
8
+ function _interopRequireDefault(obj) {
9
+ return obj && obj.__esModule ? obj : {
10
+ default: obj
11
+ };
12
+ }
8
13
  function parseManifest() {
9
- const MANIFEST_FILE = "manifest.json";
10
- const cwd = process.cwd();
11
- const manifest = fs_extra_1.default.readJSONSync(path_1.default.resolve(cwd, MANIFEST_FILE), "utf-8");
14
+ var MANIFEST_FILE = "manifest.json";
15
+ var cwd = process.cwd();
16
+ var manifest = _fsExtra.default.readJSONSync(_path.default.resolve(cwd, MANIFEST_FILE), "utf-8");
12
17
  return manifest;
13
18
  }
14
- exports.default = parseManifest;
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@tuya-sat/micro-dev-loader",
3
- "version": "0.0.1-beta.1",
3
+ "version": "0.0.2",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "scripts": {
7
- "dev": "tsc --watch",
8
- "build": "rm -rf dist/ && tsc && yarn copyOtherFiles",
9
- "copyOtherFiles": "cp -R src/plugins/layoutMock/layout-static dist/plugins/layoutMock/layout-static",
7
+ "dev": "swc src -D -w -d dist",
8
+ "build": "swc src -D -d dist",
10
9
  "prepublish": "yarn build",
11
10
  "test": "jest --verbose ./__tests__"
12
11
  },
@@ -21,9 +20,20 @@
21
20
  "loader-utils": "^2.0.0"
22
21
  },
23
22
  "devDependencies": {
23
+ "@swc/cli": "^0.1.52",
24
+ "@swc/core": "^1.2.117",
24
25
  "@types/jest": "^26.0.24",
25
26
  "jest": "^27.0.6",
26
27
  "ts-jest": "^27.0.4",
27
28
  "typescript": "^4.4.4"
28
- }
29
+ },
30
+ "keywords": [
31
+ "saturn-project",
32
+ "micro-frontend",
33
+ "no-code",
34
+ "IoT",
35
+ "saas",
36
+ "cloud",
37
+ "tuya"
38
+ ]
29
39
  }
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import LayoutMockPlugin from "./plugins/layoutMock";
2
- declare const addjsLoader: (sourceCode: string) => string;
3
- export default addjsLoader;
4
- export { LayoutMockPlugin };
@@ -1,2 +0,0 @@
1
- declare const manifestDom = "\n(function ExternalRender() {\n const div = document.createElement('div');\n const { insertDom } = require(\"@tuya-sat/micro-dev-component\");\n insertDom(div)\n document.body.appendChild(div);\n})();\n";
2
- export default manifestDom;