@gct-paas/core 0.1.0 → 0.1.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.
@@ -13,7 +13,7 @@ function getDefaultExportFromNamespaceIfNotNamed (n) {
13
13
  }
14
14
 
15
15
  function getAugmentedNamespace(n) {
16
- if (n.__esModule) return n;
16
+ if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n;
17
17
  var f = n.default;
18
18
  if (typeof f == "function") {
19
19
  var a = function a () {
@@ -80,9 +80,13 @@ class PluginPgkUtil {
80
80
  if (plugin.imports) {
81
81
  Object.keys(plugin.imports).forEach((key) => {
82
82
  const load = async () => {
83
- const module = await System.import(key);
84
- moduleMap[key] = module;
85
- this.module.set(key, module);
83
+ try {
84
+ const module = await System.import(key);
85
+ moduleMap[key] = module;
86
+ this.module.set(key, module);
87
+ } catch (error) {
88
+ console.error(error);
89
+ }
86
90
  };
87
91
  all.push(load());
88
92
  });
@@ -142,12 +146,23 @@ class PluginPgkUtil {
142
146
  const plugins = config.plugins;
143
147
  plugins.forEach((plugin) => {
144
148
  const module = moduleMap[plugin.key];
149
+ if (!module) {
150
+ console.error(`${plugin.key} \u63D2\u4EF6\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u914D\u7F6E\u662F\u5426\u6B63\u786E`);
151
+ return;
152
+ }
145
153
  if (platform === Platform.WEB) {
146
154
  const cls = module.web ?? module.default;
147
- _gct.register.designer.web.register(plugin.key, () => new cls());
155
+ if (cls) {
156
+ _gct.register.designer.web.register(plugin.key, () => new cls());
157
+ }
148
158
  } else {
149
159
  const cls = module.mobile ?? module.default;
150
- _gct.register.designer.mobile.register(plugin.key, () => new cls());
160
+ if (cls) {
161
+ _gct.register.designer.mobile.register(
162
+ plugin.key,
163
+ () => new cls()
164
+ );
165
+ }
151
166
  }
152
167
  });
153
168
  });
@@ -170,12 +185,20 @@ class PluginPgkUtil {
170
185
  const moduleMap = await this.loadPlugins(PluginModeEnum.DESIGN, configs);
171
186
  configs.forEach((plugin) => {
172
187
  const module = moduleMap[plugin.key];
188
+ if (!module) {
189
+ console.error(`${plugin.key} \u63D2\u4EF6\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u914D\u7F6E\u662F\u5426\u6B63\u786E`);
190
+ return;
191
+ }
173
192
  if (platform === Platform.WEB) {
174
193
  const cls = module.web ?? module.default;
175
- _gct.register.designer.web.register(plugin.key, () => new cls());
194
+ if (cls) {
195
+ _gct.register.designer.web.register(plugin.key, () => new cls());
196
+ }
176
197
  } else {
177
198
  const cls = module.mobile ?? module.default;
178
- _gct.register.designer.mobile.register(plugin.key, () => new cls());
199
+ if (cls) {
200
+ _gct.register.designer.mobile.register(plugin.key, () => new cls());
201
+ }
179
202
  }
180
203
  });
181
204
  } catch (error) {
@@ -194,6 +217,10 @@ class PluginPgkUtil {
194
217
  try {
195
218
  const moduleMap = await this.loadPlugins(PluginModeEnum.MOBILE, configs);
196
219
  configs.forEach((plugin) => {
220
+ if (!moduleMap[plugin.key]) {
221
+ console.error(`${plugin.key} \u63D2\u4EF6\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u914D\u7F6E\u662F\u5426\u6B63\u786E`);
222
+ return;
223
+ }
197
224
  _gct.register.render.mobile.register(
198
225
  plugin.key,
199
226
  moduleMap[plugin.key].default
@@ -215,6 +242,10 @@ class PluginPgkUtil {
215
242
  try {
216
243
  const moduleMap = await this.loadPlugins(PluginModeEnum.WEB, configs);
217
244
  configs.forEach((plugin) => {
245
+ if (!moduleMap[plugin.key]) {
246
+ console.error(`${plugin.key} \u63D2\u4EF6\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u914D\u7F6E\u662F\u5426\u6B63\u786E`);
247
+ return;
248
+ }
218
249
  _gct.register.render.web.register(
219
250
  plugin.key,
220
251
  moduleMap[plugin.key].default
@@ -26,9 +26,9 @@ function getToken() {
26
26
  }
27
27
  function setToken(token) {
28
28
  if (token) {
29
- setCookie(CoreConst.TOKEN, token, 0, true);
29
+ setCookie(CoreConst.TOKEN, token, 7, true);
30
30
  } else {
31
- clearCookie(CoreConst.TOKEN);
31
+ clearCookie(CoreConst.TOKEN, true);
32
32
  }
33
33
  }
34
34
  function getTenant() {
@@ -36,9 +36,9 @@ function getTenant() {
36
36
  }
37
37
  function setTenant(tenant) {
38
38
  if (tenant) {
39
- setCookie(CoreConst.TENANT, tenant, 0, true);
39
+ setCookie(CoreConst.TENANT, tenant, 7, true);
40
40
  } else {
41
- clearCookie(CoreConst.TENANT);
41
+ clearCookie(CoreConst.TENANT, true);
42
42
  }
43
43
  }
44
44
  function getPathQuery() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "main": "dist/index.min.cjs",
@@ -34,6 +34,7 @@
34
34
  "dev": "rollup -c -w --environment=NODE_ENV:development",
35
35
  "build": "npm run lint && rollup -c --environment=NODE_ENV:production && vite build --mode production --config vite.config.ts",
36
36
  "lint": "eslint src/",
37
+ "link2global": "pnpm link --global",
37
38
  "publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
38
39
  "publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
39
40
  "publish:alpha": "npm run build && npm publish --access public --tag=alpha --registry=https://registry.npmjs.org/",
@@ -56,8 +57,8 @@
56
57
  "vue-i18n": "9.6.5"
57
58
  },
58
59
  "devDependencies": {
59
- "@gct-paas/build": "0.1.0",
60
- "@gct-paas/cli": "0.1.0",
60
+ "@gct-paas/build": "0.1.2",
61
+ "@gct-paas/cli": "0.1.2",
61
62
  "@types/path-browserify": "^1.0.3",
62
63
  "@types/qs": "^6.9.18",
63
64
  "fs-extra": "^11.3.0"
@@ -65,5 +66,5 @@
65
66
  "peerDependencies": {
66
67
  "vue": "^3.x"
67
68
  },
68
- "gitHead": "96fcf21faa16ee10f8a5e0d023aae38641d91d36"
69
+ "gitHead": "d16ad2d01b1f566243002c25c90615ae8a0b36c2"
69
70
  }