@vixt/uni 0.5.1 → 0.5.3

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/dist/index.d.mts CHANGED
@@ -65,7 +65,12 @@ interface ModuleOptions {
65
65
  declare const uniModules: _vixt_core.VixtModule<_vixt_core.ModuleOptions>;
66
66
 
67
67
  /** 增加小程序中vueuse的运行所需 */
68
- declare function vueusePolyfill(code: string, id: string): string;
68
+ declare function transformMpRuntime(code: string, id: string): string;
69
+ /**
70
+ * 修复h5报错`Cannot assign to read only property '_' of object '#<Object>'`
71
+ * @see https://ask.dcloud.net.cn/question/194973
72
+ */
73
+ declare function transformH5Runtime(code: string, id: string): string;
69
74
  /** 移除路径中的'../' */
70
75
  declare function patchNormalizeNodeModules(): void;
71
76
  declare const uniPatch: (options?: any) => vite.PluginOption;
@@ -74,5 +79,5 @@ declare function uniVueUseResolver(): ImportsMap;
74
79
 
75
80
  declare const _default: (options?: _vixt_core.VixtOptions | undefined) => vite.PluginOption;
76
81
 
77
- export { appUni, _default as default, generateMainTs, patchNormalizeNodeModules, presetUni, uniModules, uniPatch, uniVueUseResolver, vueusePolyfill };
82
+ export { appUni, _default as default, generateMainTs, patchNormalizeNodeModules, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
78
83
  export type { ModuleOptions };
package/dist/index.d.ts CHANGED
@@ -65,7 +65,12 @@ interface ModuleOptions {
65
65
  declare const uniModules: _vixt_core.VixtModule<_vixt_core.ModuleOptions>;
66
66
 
67
67
  /** 增加小程序中vueuse的运行所需 */
68
- declare function vueusePolyfill(code: string, id: string): string;
68
+ declare function transformMpRuntime(code: string, id: string): string;
69
+ /**
70
+ * 修复h5报错`Cannot assign to read only property '_' of object '#<Object>'`
71
+ * @see https://ask.dcloud.net.cn/question/194973
72
+ */
73
+ declare function transformH5Runtime(code: string, id: string): string;
69
74
  /** 移除路径中的'../' */
70
75
  declare function patchNormalizeNodeModules(): void;
71
76
  declare const uniPatch: (options?: any) => vite.PluginOption;
@@ -74,5 +79,5 @@ declare function uniVueUseResolver(): ImportsMap;
74
79
 
75
80
  declare const _default: (options?: _vixt_core.VixtOptions | undefined) => vite.PluginOption;
76
81
 
77
- export { appUni, _default as default, generateMainTs, patchNormalizeNodeModules, presetUni, uniModules, uniPatch, uniVueUseResolver, vueusePolyfill };
82
+ export { appUni, _default as default, generateMainTs, patchNormalizeNodeModules, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
78
83
  export type { ModuleOptions };
package/dist/index.mjs CHANGED
@@ -106,7 +106,7 @@ const appUni = defineVixtModule({
106
106
  }
107
107
  });
108
108
 
109
- function vueusePolyfill(code, id) {
109
+ function transformMpRuntime(code, id) {
110
110
  if (!id.endsWith("@dcloudio/uni-mp-vue/dist/vue.runtime.esm.js"))
111
111
  return code;
112
112
  code += `
@@ -115,6 +115,12 @@ export const TransitionGroup = {}
115
115
  `;
116
116
  return code;
117
117
  }
118
+ function transformH5Runtime(code, id) {
119
+ if (!id.endsWith("@dcloudio/uni-h5-vue/dist/vue.runtime.esm.js"))
120
+ return code;
121
+ code = code.replace(`def(children, "_", type);`, `def(children, "_", type, true);`);
122
+ return code;
123
+ }
118
124
  function patchNormalizeNodeModules() {
119
125
  const matched = `str = normalizePath(str).replace(NODE_MODULES_REGEX, 'node-modules');`;
120
126
  const replaced = `str = normalizePath(str).replace(NODE_MODULES_REGEX, 'node-modules').replace(/\\.\\.\\//g, '');`;
@@ -130,7 +136,8 @@ const uniPatch = defineVitePlugin(() => {
130
136
  return {
131
137
  name: "vixt:uni-patch",
132
138
  transform(code, id) {
133
- code = vueusePolyfill(code, id);
139
+ code = transformMpRuntime(code, id);
140
+ code = transformH5Runtime(code, id);
134
141
  return code;
135
142
  }
136
143
  };
@@ -272,4 +279,4 @@ const defaults = {
272
279
  };
273
280
  const index = createVixtPlugin({ defaults });
274
281
 
275
- export { appUni, index as default, generateMainTs, patchNormalizeNodeModules, presetUni, uniModules, uniPatch, uniVueUseResolver, vueusePolyfill };
282
+ export { appUni, index as default, generateMainTs, patchNormalizeNodeModules, presetUni, transformH5Runtime, transformMpRuntime, uniModules, uniPatch, uniVueUseResolver };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/uni",
3
3
  "type": "module",
4
- "version": "0.5.1",
4
+ "version": "0.5.3",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://soullyoko.github.io/vixt/",
@@ -33,8 +33,8 @@
33
33
  "@uni-helper/vite-plugin-uni-layouts": "^0.1.10",
34
34
  "@uni-helper/vite-plugin-uni-pages": "^0.2.28",
35
35
  "unocss-applet": "^0.10.0",
36
- "@vixt/core": "0.5.1",
37
- "@vixt/vue": "0.5.1"
36
+ "@vixt/vue": "0.5.3",
37
+ "@vixt/core": "0.5.3"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "unbuild",