@vue.ts/complex-types 1.0.0-beta.8 → 1.0.0-beta.9

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/astro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-Uzu3N3Su.js";
1
+ import { t as Options } from "./types-B0cfnWIB.js";
2
2
 
3
3
  //#region src/astro.d.ts
4
4
  declare const _default: (options: Options) => {
package/dist/astro.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-BdrJkBhP.js";
1
+ import { r as unpluginFactory } from "./src-wLNIJnZT.js";
2
2
  import { createVitePlugin } from "unplugin";
3
3
 
4
4
  //#region src/astro.ts
package/dist/esbuild.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as Options } from "./types-Uzu3N3Su.js";
2
- import "./types-B3d3HWOR.js";
1
+ import { t as Options } from "./types-B0cfnWIB.js";
2
+ import "./types-u_Hr5uXA.js";
3
3
  import * as esbuild0 from "esbuild";
4
4
 
5
5
  //#region src/esbuild.d.ts
package/dist/esbuild.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-BdrJkBhP.js";
1
+ import { r as unpluginFactory } from "./src-wLNIJnZT.js";
2
2
  import { createEsbuildPlugin } from "unplugin";
3
3
 
4
4
  //#region src/esbuild.ts
package/dist/farm.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as Options } from "./types-Uzu3N3Su.js";
2
- import "./types-B3d3HWOR.js";
1
+ import { t as Options } from "./types-B0cfnWIB.js";
2
+ import "./types-u_Hr5uXA.js";
3
3
  import * as _farmfe_core0 from "@farmfe/core";
4
4
 
5
5
  //#region src/farm.d.ts
package/dist/farm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-BdrJkBhP.js";
1
+ import { r as unpluginFactory } from "./src-wLNIJnZT.js";
2
2
  import { createFarmPlugin } from "unplugin";
3
3
 
4
4
  //#region src/farm.ts
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Options } from "./types-Uzu3N3Su.js";
1
+ import { t as Options } from "./types-B0cfnWIB.js";
2
2
  import * as unplugin0 from "unplugin";
3
3
  import { UnpluginFactory } from "unplugin";
4
4
 
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as unplugin, r as unpluginFactory, t as src_default } from "./src-BdrJkBhP.js";
1
+ import { n as unplugin, r as unpluginFactory, t as src_default } from "./src-wLNIJnZT.js";
2
2
 
3
3
  export { src_default as default, unplugin, unpluginFactory };
package/dist/nuxt.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as Options } from "./types-Uzu3N3Su.js";
2
- import "./types-B3d3HWOR.js";
1
+ import { t as Options } from "./types-B0cfnWIB.js";
2
+ import "./types-u_Hr5uXA.js";
3
3
  import * as _nuxt_schema0 from "@nuxt/schema";
4
4
 
5
5
  //#region src/nuxt.d.ts
package/dist/nuxt.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./src-BdrJkBhP.js";
2
- import { t as vite_default } from "./vite-Be1u3jtj.js";
3
- import { t as webpack_default } from "./webpack-C0BFuSnK.js";
1
+ import "./src-wLNIJnZT.js";
2
+ import { t as vite_default } from "./vite-B7R6skxU.js";
3
+ import { t as webpack_default } from "./webpack-CVxLsdbd.js";
4
4
  import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
5
5
 
6
6
  //#region src/nuxt.ts
@@ -1,5 +1,5 @@
1
- import { t as Options } from "./types-Uzu3N3Su.js";
2
- import "./types-B3d3HWOR.js";
1
+ import { t as Options } from "./types-B0cfnWIB.js";
2
+ import "./types-u_Hr5uXA.js";
3
3
  import * as rolldown0 from "rolldown";
4
4
 
5
5
  //#region src/rolldown.d.ts
package/dist/rolldown.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-BdrJkBhP.js";
1
+ import { r as unpluginFactory } from "./src-wLNIJnZT.js";
2
2
  import { createRolldownPlugin } from "unplugin";
3
3
 
4
4
  //#region src/rolldown.ts
package/dist/rollup.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as Options } from "./types-Uzu3N3Su.js";
2
- import "./types-B3d3HWOR.js";
1
+ import { t as Options } from "./types-B0cfnWIB.js";
2
+ import "./types-u_Hr5uXA.js";
3
3
  import * as rollup0 from "rollup";
4
4
 
5
5
  //#region src/rollup.d.ts
package/dist/rollup.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-BdrJkBhP.js";
1
+ import { r as unpluginFactory } from "./src-wLNIJnZT.js";
2
2
  import { createRollupPlugin } from "unplugin";
3
3
 
4
4
  //#region src/rollup.ts
package/dist/rspack.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as Options } from "./types-Uzu3N3Su.js";
2
- import "./types-B3d3HWOR.js";
1
+ import { t as Options } from "./types-B0cfnWIB.js";
2
+ import "./types-u_Hr5uXA.js";
3
3
 
4
4
  //#region src/rspack.d.ts
5
5
  declare const _default: (options?: Options | undefined) => RspackPluginInstance;
package/dist/rspack.js CHANGED
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-BdrJkBhP.js";
1
+ import { r as unpluginFactory } from "./src-wLNIJnZT.js";
2
2
  import { createRspackPlugin } from "unplugin";
3
3
 
4
4
  //#region src/rspack.ts
@@ -1,10 +1,11 @@
1
1
  import { createUnplugin } from "unplugin";
2
2
  import { ensureLanguage, getLanguage } from "@vue.ts/language";
3
- import { createFilter, normalizePath } from "@vue.ts/shared";
3
+ import { createFilter } from "unplugin-utils";
4
4
  import MagicString from "magic-string";
5
5
  import ts from "typescript";
6
6
  import { join } from "node:path";
7
7
  import { defu } from "defu";
8
+ import { normalizePath } from "@vue.ts/shared";
8
9
  import { isReservedProp } from "@vue/shared";
9
10
 
10
11
  //#region src/core/utils.ts
@@ -177,18 +178,47 @@ function transform(code, id, options) {
177
178
 
178
179
  //#endregion
179
180
  //#region src/index.ts
181
+ const languageExtRegexp = /\.((?:c|m)?(?:j|t)sx?|d\.ts|vue)$/i;
180
182
  const unpluginFactory = (options = {}) => {
181
183
  const resolvedOptions = resolveOptions(options);
182
184
  const filter = createFilter(resolvedOptions.include, resolvedOptions.exclude);
183
185
  return {
184
186
  name: "@vue.ts/complex-types",
185
187
  enforce: "pre",
188
+ vite: { async handleHotUpdate(ctx) {
189
+ const { file } = ctx;
190
+ if (!languageExtRegexp.test(file)) return;
191
+ const language = getLanguage();
192
+ const { read } = ctx;
193
+ async function readAndUpdateLanguage() {
194
+ const content = await read();
195
+ language.updateFile(file, content);
196
+ return content;
197
+ }
198
+ if (!filter(file)) {
199
+ await readAndUpdateLanguage();
200
+ return;
201
+ }
202
+ let cached;
203
+ ctx.read = async () => {
204
+ cached ??= (async () => {
205
+ const code = await readAndUpdateLanguage();
206
+ return transform(code, file, resolvedOptions)?.code ?? code;
207
+ })();
208
+ return cached;
209
+ };
210
+ for (const mod of ctx.modules) ctx.server.moduleGraph.invalidateModule(mod);
211
+ return ctx.modules;
212
+ } },
186
213
  buildStart() {
187
214
  ensureLanguage(resolveOptions(options).tsconfigPath);
188
215
  },
189
- transform(code, id) {
190
- if (!filter(id)) return;
191
- return transform(code, id, resolvedOptions);
216
+ transform: {
217
+ filter: { id: {
218
+ include: resolvedOptions.include,
219
+ exclude: resolvedOptions.exclude
220
+ } },
221
+ handler: (code, id) => transform(code, id, resolvedOptions)
192
222
  }
193
223
  };
194
224
  };
@@ -1,6 +1,6 @@
1
+ import { FilterPattern } from "unplugin";
1
2
  import MagicString from "magic-string";
2
3
  import ts from "typescript";
3
- import { FilterPattern } from "@rollup/pluginutils";
4
4
 
5
5
  //#region ../shared/src/types.d.ts
6
6
  interface BaseOptions {
package/dist/types.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { a as Transformers, i as Transformer, n as ResolvedOptions, o as ValidTransforms, r as TransformOptions, t as Options } from "./types-Uzu3N3Su.js";
2
- import "./types-B3d3HWOR.js";
1
+ import { a as Transformers, i as Transformer, n as ResolvedOptions, o as ValidTransforms, r as TransformOptions, t as Options } from "./types-B0cfnWIB.js";
2
+ import "./types-u_Hr5uXA.js";
3
3
  export { Options, ResolvedOptions, TransformOptions, Transformer, Transformers, ValidTransforms };
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-BdrJkBhP.js";
1
+ import { r as unpluginFactory } from "./src-wLNIJnZT.js";
2
2
  import { createVitePlugin } from "unplugin";
3
3
 
4
4
  //#region src/vite.ts
package/dist/vite.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as Options } from "./types-Uzu3N3Su.js";
2
- import "./types-B3d3HWOR.js";
1
+ import { t as Options } from "./types-B0cfnWIB.js";
2
+ import "./types-u_Hr5uXA.js";
3
3
  import * as vite0 from "vite";
4
4
 
5
5
  //#region src/vite.d.ts
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./src-BdrJkBhP.js";
2
- import { t as vite_default } from "./vite-Be1u3jtj.js";
1
+ import "./src-wLNIJnZT.js";
2
+ import { t as vite_default } from "./vite-B7R6skxU.js";
3
3
 
4
4
  export { vite_default as default };
@@ -1,4 +1,4 @@
1
- import { r as unpluginFactory } from "./src-BdrJkBhP.js";
1
+ import { r as unpluginFactory } from "./src-wLNIJnZT.js";
2
2
  import { createWebpackPlugin } from "unplugin";
3
3
 
4
4
  //#region src/webpack.ts
package/dist/webpack.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as Options } from "./types-Uzu3N3Su.js";
2
- import "./types-B3d3HWOR.js";
1
+ import { t as Options } from "./types-B0cfnWIB.js";
2
+ import "./types-u_Hr5uXA.js";
3
3
  import * as webpack0 from "webpack";
4
4
 
5
5
  //#region src/webpack.d.ts
package/dist/webpack.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./src-BdrJkBhP.js";
2
- import { t as webpack_default } from "./webpack-C0BFuSnK.js";
1
+ import "./src-wLNIJnZT.js";
2
+ import { t as webpack_default } from "./webpack-CVxLsdbd.js";
3
3
 
4
4
  export { webpack_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue.ts/complex-types",
3
- "version": "1.0.0-beta.8",
3
+ "version": "1.0.0-beta.9",
4
4
  "author": "Ray <i@mk1.io> (@so1ve)",
5
5
  "type": "module",
6
6
  "description": "Resolve complex types in Vue SFCs.",
@@ -66,16 +66,17 @@
66
66
  "@vue/shared": "^3.5.22",
67
67
  "defu": "^6.1.4",
68
68
  "magic-string": "^0.30.21",
69
- "unplugin": "^2.3.10",
70
- "@vue.ts/language": "1.0.0-beta.8",
71
- "@vue.ts/shared": "1.0.0-beta.8"
69
+ "unplugin": "2.3.10",
70
+ "unplugin-utils": "^0.3.1",
71
+ "@vue.ts/language": "1.0.0-beta.9",
72
+ "@vue.ts/shared": "1.0.0-beta.9"
72
73
  },
73
74
  "devDependencies": {
74
75
  "@nuxt/schema": "^4.2.0",
75
76
  "@vue-macros/better-define": "^3.1.1",
76
77
  "rolldown": "1.0.0-beta.45",
77
78
  "rollup": "^4.52.5",
78
- "vite": "^7.1.12",
79
+ "vite": "7.1.12",
79
80
  "webpack": "^5.102.1"
80
81
  },
81
82
  "peerDependencies": {
@@ -1,24 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
-
23
- //#endregion
24
- export { };