@vixt/uni 0.5.15 → 0.5.17

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
@@ -92,13 +92,16 @@ declare function patchUnocssGlobalBuildScan(config: ResolvedConfig): void;
92
92
  * @see https://github.com/uni-helper/vite-plugin-uni-components/blob/main/packages/core/src/index.ts#L27
93
93
  */
94
94
  declare function patchUniComponents(config: ResolvedConfig): void;
95
+ /**
96
+ * fix `@uni-helper/vite-plugin-uni-pages` client types
97
+ * @see https://github.com/uni-helper/vite-plugin-uni-pages/blob/main/packages/core/client.d.ts#L4
98
+ */
99
+ declare function patchUniPagesTypes(): void;
95
100
  declare const uniPatch: (options?: any) => vite.PluginOption;
96
101
 
97
102
  declare function uniVueUseResolver(): ImportsMap;
98
103
 
99
- declare function genarateVirtualUniPagesTypes(vixt: Vixt): void;
100
-
101
104
  declare const _default: (options?: _vixt_core.VixtOptions | undefined) => vite.PluginOption;
102
105
 
103
- export { appUni, _default as default, genarateVirtualUniPagesTypes, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, transformVueDevtools, uniModules, uniPatch, uniVueUseResolver };
106
+ export { appUni, _default as default, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUniPagesTypes, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, transformVueDevtools, uniModules, uniPatch, uniVueUseResolver };
104
107
  export type { ModuleOptions };
package/dist/index.d.ts CHANGED
@@ -92,13 +92,16 @@ declare function patchUnocssGlobalBuildScan(config: ResolvedConfig): void;
92
92
  * @see https://github.com/uni-helper/vite-plugin-uni-components/blob/main/packages/core/src/index.ts#L27
93
93
  */
94
94
  declare function patchUniComponents(config: ResolvedConfig): void;
95
+ /**
96
+ * fix `@uni-helper/vite-plugin-uni-pages` client types
97
+ * @see https://github.com/uni-helper/vite-plugin-uni-pages/blob/main/packages/core/client.d.ts#L4
98
+ */
99
+ declare function patchUniPagesTypes(): void;
95
100
  declare const uniPatch: (options?: any) => vite.PluginOption;
96
101
 
97
102
  declare function uniVueUseResolver(): ImportsMap;
98
103
 
99
- declare function genarateVirtualUniPagesTypes(vixt: Vixt): void;
100
-
101
104
  declare const _default: (options?: _vixt_core.VixtOptions | undefined) => vite.PluginOption;
102
105
 
103
- export { appUni, _default as default, genarateVirtualUniPagesTypes, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, transformVueDevtools, uniModules, uniPatch, uniVueUseResolver };
106
+ export { appUni, _default as default, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUniPagesTypes, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, transformVueDevtools, uniModules, uniPatch, uniVueUseResolver };
104
107
  export type { ModuleOptions };
package/dist/index.mjs CHANGED
@@ -156,8 +156,20 @@ function patchUniComponents(config) {
156
156
  if (JSON.stringify(config.build.watch) === "{}")
157
157
  config.build.watch = null;
158
158
  }
159
+ function patchUniPagesTypes() {
160
+ const matched = ` import type { SubPackage } from './src/config/types/index'
161
+ import type { PageMetaDatum } from './src/types'`;
162
+ const replaced = ` import type { PageMetaDatum, SubPackage } from '@uni-helper/vite-plugin-uni-pages'`;
163
+ const codePath = path.resolve(resolvePathSync("@uni-helper/vite-plugin-uni-pages"), "../../client.d.ts");
164
+ let code = codePath && fs.readFileSync(codePath, "utf-8");
165
+ if (code.includes(matched)) {
166
+ code = code.replace(matched, replaced);
167
+ fs.outputFileSync(codePath, code);
168
+ }
169
+ }
159
170
  const uniPatch = defineVitePlugin(() => {
160
171
  patchNormalizeNodeModules();
172
+ patchUniPagesTypes();
161
173
  return [
162
174
  {
163
175
  name: "vixt:uni-patch-runtime",
@@ -227,19 +239,6 @@ function uniVueUseResolver() {
227
239
  return _cache || {};
228
240
  }
229
241
 
230
- function genarateVirtualUniPagesTypes(vixt) {
231
- const { buildTypesDir } = vixt.options;
232
- const codePath = path.resolve(buildTypesDir, "virtual-uni-pages.d.ts");
233
- const code = `declare module 'virtual:uni-pages' {
234
- import type { PageMetaDatum, SubPackage } from '@uni-helper/vite-plugin-uni-pages'
235
-
236
- export const pages: PageMetaDatum[]
237
- export const subPackages: SubPackage[]
238
- }
239
- `;
240
- fs.outputFileSync(codePath, code);
241
- }
242
-
243
242
  const name$1 = "vixt:preset-uni";
244
243
  const presetUni = defineVixtModule({
245
244
  meta: { name: name$1 },
@@ -265,7 +264,6 @@ const presetUni = defineVixtModule({
265
264
  unocss: {}
266
265
  };
267
266
  const options = vixt.options = defu(vixt.options, defaultOptions);
268
- genarateVirtualUniPagesTypes(vixt);
269
267
  const modules = [
270
268
  Pages(options.uniPages),
271
269
  Layouts(options.uniLayouts),
@@ -333,7 +331,7 @@ const defaults = {
333
331
  typescript: {
334
332
  tsConfig: {
335
333
  compilerOptions: {
336
- types: ["@dcloudio/types", "@uni-helper/uni-app-types", "@uni-helper/vite-plugin-uni-pages/client"]
334
+ types: ["@dcloudio/types", "@uni-helper/uni-app-types"]
337
335
  },
338
336
  vueCompilerOptions: {
339
337
  plugins: ["@uni-helper/uni-app-types/volar-plugin"]
@@ -343,4 +341,4 @@ const defaults = {
343
341
  };
344
342
  const index = createVixtPlugin({ defaults });
345
343
 
346
- export { appUni, index as default, genarateVirtualUniPagesTypes, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, transformVueDevtools, uniModules, uniPatch, uniVueUseResolver };
344
+ export { appUni, index as default, generateMainTs, patchAdjustCssExtname, patchNormalizeNodeModules, patchUniComponents, patchUniPagesTypes, patchUnocssGlobalBuildScan, presetUni, transformH5Runtime, transformMpRuntime, transformVueDevtools, 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.15",
4
+ "version": "0.5.17",
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.11",
34
34
  "@uni-helper/vite-plugin-uni-pages": "^0.3.22",
35
35
  "unocss-applet": "^0.12.2",
36
- "@vixt/core": "0.5.15",
37
- "@vixt/vue": "0.5.15"
36
+ "@vixt/vue": "0.5.17",
37
+ "@vixt/core": "0.5.17"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "unbuild",